pi-roundtable-web 0.26.2 → 0.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +16 -1
  3. package/dist/chunk-account-hck7mhf8.js +1 -0
  4. package/dist/{chunk-action-menu-ec9jqtxq.js → chunk-action-menu-beqh40k6.js} +1 -1
  5. package/dist/chunk-agent-znnth24t.js +1 -0
  6. package/dist/chunk-arranged-rooms-wfakrddk.js +1 -0
  7. package/dist/chunk-bulk-actions-c4tkvk9g.js +1 -0
  8. package/dist/chunk-character-creator-qwcsdytw.js +1 -0
  9. package/dist/{chunk-codeeditor-jm2sm333.js → chunk-codeeditor-6xavqntt.js} +2 -2
  10. package/dist/chunk-confirm-z95j9jt3.js +1 -0
  11. package/dist/{chunk-connectors-mhnw6d79.js → chunk-connectors-7xqsg5q5.js} +1 -1
  12. package/dist/{chunk-conversations-yjyq4g1y.js → chunk-conversations-zc4mv6vj.js} +1 -1
  13. package/dist/{chunk-drag-nyq52ck7.js → chunk-drag-0mefcvp3.js} +1 -1
  14. package/dist/{chunk-entry-red1597w.js → chunk-entry-hrt97qed.js} +1 -1
  15. package/dist/chunk-folder-list-nemtqbnc.js +1 -0
  16. package/dist/chunk-folds-xpg9qcwf.js +1 -0
  17. package/dist/chunk-gate-86r8a2vf.js +1 -0
  18. package/dist/chunk-group-scene-g24kxz6f.js +1 -0
  19. package/dist/chunk-group-table-851jm8ef.js +1 -0
  20. package/dist/chunk-host-icons-23zhqpmc.js +1 -0
  21. package/dist/chunk-host-picture-8tnh2wam.js +1 -0
  22. package/dist/chunk-host-state-j41sp065.js +1 -0
  23. package/dist/chunk-host-ui-cje7a9t9.js +1 -0
  24. package/dist/chunk-index-1fn8q4ps.js +2 -0
  25. package/dist/{chunk-index-kfv996qe.js → chunk-index-30vw4nhh.js} +35 -3
  26. package/dist/{chunk-index-tmx30r1w.js → chunk-index-3aa5czxj.js} +2 -2
  27. package/dist/chunk-index-3k7sdph2.js +1 -0
  28. package/dist/{chunk-index-7bbqtdce.js → chunk-index-3wbyq10m.js} +2 -2
  29. package/dist/{chunk-index-9nents16.js → chunk-index-47yspxa4.js} +2 -2
  30. package/dist/chunk-index-4s1qj9we.js +2 -0
  31. package/dist/chunk-index-5fz5e1ct.js +2 -0
  32. package/dist/{chunk-index-kw85ajap.js → chunk-index-67p2sc14.js} +3 -3
  33. package/dist/{chunk-index-0xj30mzw.js → chunk-index-6c8mewwy.js} +12 -12
  34. package/dist/{chunk-index-934zgd18.js → chunk-index-84wbc80d.js} +2 -2
  35. package/dist/{chunk-index-y00wke93.js → chunk-index-8eexybcx.js} +2 -2
  36. package/dist/{chunk-index-1f0j335v.js → chunk-index-agrvqf5b.js} +2 -2
  37. package/dist/chunk-index-azrnzgev.js +2 -0
  38. package/dist/chunk-index-c2ag3qw2.js +2 -0
  39. package/dist/chunk-index-e90kztkx.js +4 -0
  40. package/dist/chunk-index-efgm0066.js +2 -0
  41. package/dist/{chunk-index-b7jjca66.js → chunk-index-eh0wb6g0.js} +2 -2
  42. package/dist/{chunk-index-yrhbhmxz.js → chunk-index-eyc2rkq5.js} +2 -2
  43. package/dist/{chunk-index-datrrs6b.js → chunk-index-fe0m5mht.js} +2 -2
  44. package/dist/{chunk-index-f3b5nch2.js → chunk-index-gt42wjby.js} +3 -3
  45. package/dist/{chunk-index-6tpr6r6d.js → chunk-index-hc0dgmrs.js} +2 -2
  46. package/dist/{chunk-index-0n6ja7my.js → chunk-index-hczrjnky.js} +1 -1
  47. package/dist/chunk-index-hrtyanda.js +2 -0
  48. package/dist/chunk-index-j479p62w.js +2 -0
  49. package/dist/{chunk-index-cmxs5y22.js → chunk-index-jq970hsd.js} +3 -3
  50. package/dist/chunk-index-kankja6p.js +50 -0
  51. package/dist/chunk-index-kb44jp50.js +2 -0
  52. package/dist/{chunk-index-029209sy.js → chunk-index-m65cv329.js} +2 -2
  53. package/dist/chunk-index-mnwdbb4n.js +2 -0
  54. package/dist/chunk-index-n6zrc05a.js +2 -0
  55. package/dist/chunk-index-n93wqszt.js +8 -0
  56. package/dist/{chunk-index-43k1rjmx.js → chunk-index-nrexxkar.js} +2 -2
  57. package/dist/chunk-index-pgxgq61x.js +2 -0
  58. package/dist/chunk-index-q5vzjqr5.js +2 -0
  59. package/dist/chunk-index-qqwk157d.js +2 -0
  60. package/dist/{chunk-index-ewj52be9.js → chunk-index-r1v895tj.js} +2 -2
  61. package/dist/chunk-index-r3tqhew8.js +2 -0
  62. package/dist/chunk-index-raf772z6.js +2 -0
  63. package/dist/{chunk-index-smw1n2pt.js → chunk-index-rcxz5w5d.js} +5 -5
  64. package/dist/chunk-index-rg9vh59e.js +1 -0
  65. package/dist/chunk-index-sxq69p1f.js +2 -0
  66. package/dist/chunk-index-taq2psr6.js +2 -0
  67. package/dist/{chunk-index-frwa2fmc.js → chunk-index-tsxsy4qs.js} +2 -2
  68. package/dist/chunk-index-wc83vb0a.js +2 -0
  69. package/dist/chunk-index-xbs8q4kn.js +2 -0
  70. package/dist/chunk-index-xxbveevc.js +2 -0
  71. package/dist/chunk-index-zx6yka30.js +2 -0
  72. package/dist/chunk-lang-css-yrc25qk9.js +1 -0
  73. package/dist/{chunk-lang-dockerfile-46rk929v.js → chunk-lang-dockerfile-tjxsnhr9.js} +1 -1
  74. package/dist/{chunk-lang-go-qb0qdpg7.js → chunk-lang-go-drmfa25k.js} +3 -3
  75. package/dist/chunk-lang-html-rwe8epvf.js +1 -0
  76. package/dist/chunk-lang-javascript-d6x6qjtg.js +1 -0
  77. package/dist/{chunk-lang-json-1q4fp694.js → chunk-lang-json-790swysy.js} +1 -1
  78. package/dist/{chunk-lang-markdown-5w7t28wa.js → chunk-lang-markdown-483dkxcq.js} +5 -5
  79. package/dist/{chunk-lang-python-3dq0p4rf.js → chunk-lang-python-v9s40bzj.js} +2 -2
  80. package/dist/{chunk-lang-rust-70pa0agr.js → chunk-lang-rust-z4gry1bf.js} +1 -1
  81. package/dist/{chunk-lang-shell-4pxt7hf4.js → chunk-lang-shell-egsvk8rj.js} +1 -1
  82. package/dist/{chunk-lang-sql-kgcbh2a9.js → chunk-lang-sql-75j3denr.js} +2 -2
  83. package/dist/{chunk-lang-toml-99t95pab.js → chunk-lang-toml-7dbjvhex.js} +1 -1
  84. package/dist/chunk-lang-typescript-1rv9vdcz.js +1 -0
  85. package/dist/{chunk-lang-xml-mnbv9yfa.js → chunk-lang-xml-jg1sv4h2.js} +1 -1
  86. package/dist/{chunk-lang-yaml-2by9g1dy.js → chunk-lang-yaml-g3v7s5je.js} +1 -1
  87. package/dist/chunk-layout-actions-6assr93n.js +1 -0
  88. package/dist/chunk-menu-items-9szcza00.js +2 -0
  89. package/dist/chunk-mode-toggle-bzbq7ycq.js +1 -0
  90. package/dist/{chunk-note-row-72n6cqyk.js → chunk-note-row-g20h11pm.js} +2 -2
  91. package/dist/chunk-notes-gc8bssxn.js +1 -0
  92. package/dist/chunk-notice-bell-jehad6sx.js +1 -0
  93. package/dist/{chunk-notices-evny44be.js → chunk-notices-prqkv7ge.js} +1 -1
  94. package/dist/chunk-onboarding-mdtc2mb7.js +1 -0
  95. package/dist/{chunk-overview-42h45ehd.js → chunk-overview-2j1s6kqg.js} +1 -1
  96. package/dist/chunk-palette-4qt6ewem.js +1 -0
  97. package/dist/chunk-placement-items-2eect825.js +1 -0
  98. package/dist/{chunk-profile-bqcgkgk4.js → chunk-profile-pfzyc04p.js} +1 -1
  99. package/dist/chunk-prompt-history-2bcp2rky.js +1 -0
  100. package/dist/chunk-prompts-052mb05y.js +1 -0
  101. package/dist/chunk-room-confirms-asvmjh5s.js +1 -0
  102. package/dist/{chunk-room-menu-7s0feajw.js → chunk-room-menu-dm2r2hk6.js} +1 -1
  103. package/dist/chunk-rooms-menu-button-32hemzxc.js +1 -0
  104. package/dist/{chunk-schedules-zba7krac.js → chunk-schedules-64h9gfwn.js} +1 -1
  105. package/dist/{chunk-seat-menu-ca5p4e9q.js → chunk-seat-menu-vrpc40v9.js} +1 -1
  106. package/dist/chunk-sheet-hosts-jaqx490x.js +1 -0
  107. package/dist/chunk-shortcut-help-bdbkdcs9.js +26 -0
  108. package/dist/chunk-shortcuts-qft33r8t.js +1 -0
  109. package/dist/{chunk-skill-editor-n0y9pd90.js → chunk-skill-editor-z3dx2895.js} +2 -2
  110. package/dist/{chunk-skills-ea4vb2s4.js → chunk-skills-4jfcv39n.js} +1 -1
  111. package/dist/chunk-switcher-list-xysjd4tw.js +1 -0
  112. package/dist/{chunk-tab-dot-4tkpxqeh.js → chunk-tab-dot-1p68ybf8.js} +1 -1
  113. package/dist/chunk-table-0v4q4dx3.js +1 -0
  114. package/dist/{chunk-table-seats-qeytqe0m.js → chunk-table-seats-f683hx8k.js} +1 -1
  115. package/dist/{chunk-table2d-18y029k9.js → chunk-table2d-1a6atjhj.js} +1 -1
  116. package/dist/{chunk-table3d-q2s31ae0.js → chunk-table3d-k0ffeffj.js} +23 -23
  117. package/dist/chunk-thread-actions-4rpfg4fq.js +1 -0
  118. package/dist/chunk-thread-cards-t794fp4d.js +1 -0
  119. package/dist/chunk-thread-list-1pcygpka.js +1 -0
  120. package/dist/chunk-transcript-km4e3aey.js +1 -0
  121. package/dist/chunk-where-phjwqggy.js +1 -0
  122. package/dist/{chunk-workspace-h0p32ygy.js → chunk-workspace-d064v56e.js} +2 -2
  123. package/dist/chunk-zh-tw-qf18hcxc.js +1 -0
  124. package/dist/index.html +1 -1
  125. package/dist/sw.js +1 -1
  126. package/package.json +2 -2
  127. package/src/api-types.ts +22 -0
  128. package/src/app/routes.ts +105 -2
  129. package/src/app/threads.ts +11 -0
  130. package/src/host/host-app.ts +15 -1
  131. package/src/host/read-all.ts +80 -0
  132. package/src/host/reads.ts +67 -0
  133. package/src/i18n/zh-tw.ts +18 -4
  134. package/dist/chunk-account-nhpd9j90.js +0 -1
  135. package/dist/chunk-agent-d1xfrawq.js +0 -1
  136. package/dist/chunk-arranged-rooms-bga8yk2v.js +0 -1
  137. package/dist/chunk-character-creator-k67f77w5.js +0 -1
  138. package/dist/chunk-confirm-wc5xraev.js +0 -1
  139. package/dist/chunk-folder-list-x56y26yq.js +0 -1
  140. package/dist/chunk-folds-3p7s2nvx.js +0 -1
  141. package/dist/chunk-gate-h41bv4y9.js +0 -1
  142. package/dist/chunk-group-scene-7eb6jyev.js +0 -1
  143. package/dist/chunk-group-table-rca48kt0.js +0 -1
  144. package/dist/chunk-host-icons-x318gjqp.js +0 -1
  145. package/dist/chunk-host-picture-xswcakgy.js +0 -1
  146. package/dist/chunk-host-state-bpahvk54.js +0 -1
  147. package/dist/chunk-host-ui-tsbwwk38.js +0 -1
  148. package/dist/chunk-index-066vzexw.js +0 -2
  149. package/dist/chunk-index-0h4h76kw.js +0 -2
  150. package/dist/chunk-index-2f5nfekb.js +0 -8
  151. package/dist/chunk-index-31ays46f.js +0 -2
  152. package/dist/chunk-index-4gk88a0x.js +0 -4
  153. package/dist/chunk-index-4mf29sbx.js +0 -2
  154. package/dist/chunk-index-51n20yhb.js +0 -2
  155. package/dist/chunk-index-84v7j6vh.js +0 -50
  156. package/dist/chunk-index-8f9jer8r.js +0 -2
  157. package/dist/chunk-index-91z3g774.js +0 -1
  158. package/dist/chunk-index-9w0sar6s.js +0 -2
  159. package/dist/chunk-index-a768zmp6.js +0 -2
  160. package/dist/chunk-index-c5x70d9g.js +0 -2
  161. package/dist/chunk-index-cwc1vvpw.js +0 -2
  162. package/dist/chunk-index-d85x96q0.js +0 -2
  163. package/dist/chunk-index-dep2e3f3.js +0 -2
  164. package/dist/chunk-index-dtste2ed.js +0 -2
  165. package/dist/chunk-index-grkczq2c.js +0 -2
  166. package/dist/chunk-index-gzvkpe3e.js +0 -2
  167. package/dist/chunk-index-satam151.js +0 -2
  168. package/dist/chunk-index-th43f690.js +0 -2
  169. package/dist/chunk-index-ths2hxpe.js +0 -1
  170. package/dist/chunk-index-y4sqmenv.js +0 -2
  171. package/dist/chunk-index-zd76pr2k.js +0 -2
  172. package/dist/chunk-lang-css-fa7c0zfj.js +0 -1
  173. package/dist/chunk-lang-html-47mf2y0v.js +0 -1
  174. package/dist/chunk-lang-javascript-d32qrvxz.js +0 -1
  175. package/dist/chunk-lang-typescript-4k1d8z7s.js +0 -1
  176. package/dist/chunk-layout-actions-cgghzj1w.js +0 -1
  177. package/dist/chunk-menu-items-24cfwawa.js +0 -2
  178. package/dist/chunk-mode-toggle-v4baz3r1.js +0 -1
  179. package/dist/chunk-notes-83s3tsey.js +0 -1
  180. package/dist/chunk-notice-bell-a4ty5h1p.js +0 -1
  181. package/dist/chunk-onboarding-q1avjbrx.js +0 -1
  182. package/dist/chunk-palette-e44qepmh.js +0 -1
  183. package/dist/chunk-placement-items-v466t0sv.js +0 -1
  184. package/dist/chunk-prompt-history-hgbtcn4b.js +0 -1
  185. package/dist/chunk-prompts-czs8y6r1.js +0 -1
  186. package/dist/chunk-room-confirms-h8cdj3ng.js +0 -1
  187. package/dist/chunk-rooms-menu-button-gawqvpsr.js +0 -1
  188. package/dist/chunk-sheet-hosts-ssbz6hf2.js +0 -1
  189. package/dist/chunk-switcher-list-pj5csqr9.js +0 -1
  190. package/dist/chunk-table-j8nmtdnn.js +0 -1
  191. package/dist/chunk-thread-actions-w3eadnh7.js +0 -1
  192. package/dist/chunk-thread-cards-fbpky3c9.js +0 -1
  193. package/dist/chunk-thread-list-pghe84be.js +0 -1
  194. package/dist/chunk-transcript-eqzxgqys.js +0 -1
  195. package/dist/chunk-where-ygyr4jdj.js +0 -1
  196. package/dist/chunk-zh-tw-k6xx1hp2.js +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.26.3] - 2026-10-30
9
+
10
+ ### Added
11
+
12
+ - **Mark all as read.** The room list's menu and each folder's menu have **Mark all as read**, left out when nothing in its scope is unread (a folder's scope is its rooms and the threads under them). It sets the person's read cursor to the newest message in every room they may read, agent, group, thread and host rooms, in one call: `POST api/rooms/read-all` with `{ "rooms": [...] }` (at most 500; left out, every room the list shows), owners only, with rooms the person may not read passed over. The unread badges, the tab title's count and the tab icon's dot clear at once, the person's other pages and devices hear of it through the `read` frames a single read sends and a `changed` frame, and a notice offers Undo for five seconds: `{ "restore": [...] }` to the same route puts each cursor back unless the person has read on since. Nothing asks first
13
+ - **Clear all finished threads.** The same two menus have **Clear all finished threads**, which hides every finished dispatch thread under every room of the list, or under the folder's rooms, in one call: `POST api/rooms/dismiss-finished-threads` with `{ "rooms": [...] }`, owners only, open threads never touched. The answer names the threads cleared by room, and the notice's Undo puts exactly those back through `undismiss-threads`
14
+ - Keyboard shortcuts in the owner app. Alt+↑ / Alt+↓ (Option on a Mac) go to the previous or next room in the order the room list shows (folders respected, a folded folder skipped unless it holds the open room, threads after their room, no wrapping), and Alt+Shift+↑ / Alt+Shift+↓ to the previous or next room with unread messages. Switching uses the router as a click does and scrolls the open room's row into view; it works on a page with no list too. In a text field the arrows act only when the field is empty or the caret is at the very start (up) or very end (down) with nothing selected, and nothing acts while an input method composes. Esc closes the topmost menu or sheet and otherwise lets go of the message box without touching its text. `?` outside a text field opens a sheet that lists the keys (a lazy chunk; en and zh-TW wording). Ctrl/⌘ K, which opens the search, now also ignores an input method's composition. The handler is a part that loads after the first paint, about 0.1 KB gzipped more in the first load.
15
+ - A message nobody has seen yet wears an unread frame: a soft ring and glow in the accent colour, uniform on every side (no thick or one-sided border), in the modern and camelot looks, light and dark. It marks the messages past the person's read marker as the room opened, and those that arrive while the tab is hidden or the log is scrolled away from its end, in agent, group, thread and host rooms. The person's own messages, lines the server wrote, internal notes and a message that arrives while they are watching the end of the log do not get one. Passing a pointer over a message, focusing it with the keyboard, or tapping it clears its frame, each message on its own; on a touch screen a frame also clears once the message has stood at least half in view (or half of the screen, for a long one) for one and a half seconds, through one IntersectionObserver. It is only a look: what the server counts as read, the read API and the "New messages" divider are unchanged, a cleared frame stays cleared until the page is reloaded, and `prefers-reduced-motion: reduce` removes it without the fade. The code and its styles load with the read marks (the lazy host chunk), not with the first page.
16
+
17
+ ### Changed
18
+
19
+ - Clearing finished dispatch threads no longer asks first, however many there are: **Clear finished** in a room's list of threads and the new menu items clear at once, and the notice's Undo is the way back
20
+
8
21
  ## [0.26.2] - 2026-10-30
9
22
 
10
23
  ### Added
package/README.md CHANGED
@@ -149,7 +149,9 @@ The app hosts the core's dispatch threads (`ChatSurface.threads`). A background
149
149
 
150
150
  A thread's room is read only: a `send` to it is refused with `read_only`, and it has no modes. Its cards are the dispatch's own, such as a coding job's approvals, and any owner answers them there as in any room. Agents post in it under their own names. A closed thread stays readable (the list keeps the 30 newest closed ones), and the host closes the threads a restart left open, with a restart notice. `GET api/rooms` lists a thread with `parent` and, once closed, `closed: true`; opening and closing one sends `changed`.
151
151
 
152
- Each thread is a card in that list: its title, its room's knight, a badge (in progress or finished), the time of its last post and its unread count. A going-on thread wears its knight's tint and a finished one rests. An owner clears a finished thread off the list by swiping its card to the right (the card slides out, the list closes the gap, and a notice offers Undo for five seconds), by pressing the menu button on the card, by holding it or right-clicking it (**Clear this thread**, **Clear all finished**), or with Delete on a focused card; **Clear finished** in the header of the finished threads does the same for all of them, after a question with the count when there are more than five. A going-on thread does not swipe: the card gives a little and springs back. Clearing hides a thread and does not delete it: it leaves the list for every owner and every open page at once, and stays readable by its address and through the links in its room. The routes are `POST api/rooms/<thread>/dismiss` (409 while the thread is open), `POST api/rooms/<room>/dismiss-threads` (every finished thread of the room), their undos `POST api/rooms/<thread>/undismiss` and `POST api/rooms/<room>/undismiss-threads` (body `{ "threads": [<keys>] }`, at most 100, those that hang under the room), and `GET api/rooms/<thread>` for the view of a thread the list does not carry. All of them are the owners' like the rest of `api/rooms`.
152
+ Each thread is a card in that list: its title, its room's knight, a badge (in progress or finished), the time of its last post and its unread count. A going-on thread wears its knight's tint and a finished one rests. An owner clears a finished thread off the list by swiping its card to the right (the card slides out, the list closes the gap, and a notice offers Undo for five seconds), by pressing the menu button on the card, by holding it or right-clicking it (**Clear this thread**, **Clear all finished**), or with Delete on a focused card; **Clear finished** in the header of the finished threads does the same for all of them. Nothing asks first, however many there are: the notice's Undo is the way back. A going-on thread does not swipe: the card gives a little and springs back. Clearing hides a thread and does not delete it: it leaves the list for every owner and every open page at once, and stays readable by its address and through the links in its room. The routes are `POST api/rooms/<thread>/dismiss` (409 while the thread is open), `POST api/rooms/<room>/dismiss-threads` (every finished thread of the room), their undos `POST api/rooms/<thread>/undismiss` and `POST api/rooms/<room>/undismiss-threads` (body `{ "threads": [<keys>] }`, at most 100, those that hang under the room), and `GET api/rooms/<thread>` for the view of a thread the list does not carry. All of them are the owners' like the rest of `api/rooms`.
153
+
154
+ The room list's menu (the button beside the search) and each folder's menu clear every finished thread at once: **Clear all finished threads** takes the finished threads of every room in the list, or of the folder's rooms. The route is `POST api/rooms/dismiss-finished-threads` with `{ "rooms": [<keys>] }` (at most 500; left out, every room the list shows). It answers with the number cleared and the cleared threads' keys by room (`{ "dismissed": 3, "threads": { "<room>": [<keys>] } }`), which the notice's Undo sends back through `undismiss-threads`, room by room. Open threads are never cleared, and the item is left out of the menu when no finished thread is listed.
153
155
 
154
156
 
155
157
  ### Making and arranging agents
@@ -190,6 +192,18 @@ Until the owners arrange something, the page is the plain list it always was; th
190
192
 
191
193
  The layout lives in three additive tables created by the plugin's migration `web-room-layout`: `web_room_folders`, `web_room_folder_rooms` and `web_room_pins`. Every write takes one advisory lock and rewrites the positions densely, so two devices editing at once leave no gap and no duplicate.
192
194
 
195
+ ### Keyboard shortcuts
196
+
197
+ | Keys (Mac / elsewhere) | What they do |
198
+ |---|---|
199
+ | ⌥↑ / ⌥↓, Alt+↑ / Alt+↓ | The previous or next room, in the order the room list shows: Home, the pinned rooms, the folders (a folded folder is skipped unless it holds the open room), the rest, with a room's open threads after it and its finished threads only while their fold is open. The run does not wrap. On a page that shows no list, such as a room open full screen on a phone, the same order applies; from a page that is no room, the first key press opens the first or the last room. Hosts' own room kinds are not in the run. |
200
+ | ⌥⇧↑ / ⌥⇧↓, Alt+Shift+↑ / Alt+Shift+↓ | The previous or next room with unread messages, in the same order; folded folders and finished threads are searched too. |
201
+ | ⌘K, Ctrl+K | Find a room (the search sheet), from anywhere, a message box included. |
202
+ | Esc | Closes the topmost menu or sheet; with none open, the message box lets go of focus. Typed text is never discarded. |
203
+ | ? | Opens the list of these shortcuts, a sheet that loads on the first press. Typing `?` in a text field types it. |
204
+
205
+ Switching goes through the same router as a click on the row, so it adds a history entry, uses the same view transition, and scrolls the open room's row into view in the list. Nothing here acts while an input method is composing. In a text field Option/Alt with the up and down arrows is paragraph navigation on a Mac, so the room keys act only when the field is empty or the caret rests at its very start (up) or very end (down) with nothing selected; Shift, Ctrl/Cmd and plain arrows are never taken. While a menu, sheet or the room drawer is open the room keys leave the page alone.
206
+
193
207
  ### Uploads
194
208
 
195
209
  An owner may send a file of any kind in a room, up to four to a message: the button, a paste (a copied image, say) or a drop. `POST <mount>/api/uploads` takes one file as `multipart/form-data` (field `file`) and answers `{id, name, type, size}`; the message then names it in `uploads`. A long text goes as a file too: the page turns a paste of 4,000 characters or more into a `pasted-text-<n>.txt` chip, and a message over 32,000 characters into `message.txt` with the line "(long text attached)"; the server still refuses a text over 32,000 characters.
@@ -861,6 +875,7 @@ A room's key is `<surface>:<kind>.<id>`, with an id of 8 to 64 letters, digits,
861
875
  - **Pages.** A page is at `<mount>/p/<id>` and is built from sections: Markdown, a list of rows (each may open a link and carry buttons), a form with an action, and a card. `place` is `main` (the navigation), `settings` (the Settings pane) or `hidden`. `visible(viewer)` is asked on every fetch and action; a page that is not visible is a `404`. `app.pages.changed(id?)` sends the viewers who may see it a `page_changed` frame and their page fetches the view again.
862
876
  - **Retention.** A kind's `retention: { textDays, fileDays }` deletes its messages, author names, host cards and files that old, counted from each message's `at` (a card's from when it was first posted). Without it nothing is deleted. A card the host still wants, such as a ticket's pinned card while the ticket is open, carries `keep: true` in `card` and `updateCard`: the sweep skips it for as long as the host passes `keep: true`, and `updateCard` without it makes the card an ordinary one again.
863
877
  - **Read marks.** The page tells the app how far a person has read (the newest message in view, at most once a second, never while the page is hidden). The app keeps one cursor per person and room, for host rooms and agent rooms alike (among owners), and computes each room's `unread` from it; the list and the drawer show the count, an attention dot where the host sets `attention`, and the room opens with a "new messages" divider where the person stopped. Under each message the people who have read up to it are named: "Seen by 2", with their pictures; a person's own mark is not shown to them.
878
+ - **Mark all as read.** The room list's menu and each folder's menu have **Mark all as read**, left out when nothing in its scope is unread (a folder's scope is its rooms and the threads under them). It reads every room the person may read, agent, group, thread and host rooms, up to the newest message in one call: `POST api/rooms/read-all` with `{ "rooms": [<keys>] }` (at most 500; left out, every room the list shows, host rooms excepted), owners only like the rest of `api/rooms`. Rooms the person may not read are passed over as if they were not named. The answer lists the cursors that moved, `{ "moved": [{ "room", "from", "to" }] }`; sending them back as `{ "restore": [...] }` to the same route puts each cursor back where it was, unless the person has read on since. The unread badges, the tab title's count and the tab icon's dot clear at once, the person's other pages and devices hear of it through the same `read` frames a single read sends (and a `changed` frame for the lists), and a notice offers Undo for five seconds. Nothing asks first.
864
879
  - **The page is lazy.** The room, the lists and the pages load as separate chunks when first opened, so the app's first load is the same size as before.
865
880
 
866
881
  ## App protocol
@@ -0,0 +1 @@
1
+ import{h,Q,S,e,w}from"./chunk-index-kankja6p.js";var a={profile:S(()=>(h("pfzyc04p"),import("./chunk-profile-pfzyc04p.js")).then((o)=>({default:o.ProfilePage}))),notices:S(()=>(h("prqkv7ge"),import("./chunk-notices-prqkv7ge.js")).then((o)=>({default:o.NoticesPage}))),onboarding:S(()=>(h("mdtc2mb7"),import("./chunk-onboarding-mdtc2mb7.js")).then((o)=>({default:o.OnboardingPage})))};function n({pane:o}){let t=a[o];return t?e(Q,{fallback:e(w,{}),children:e(t,{})}):null}export{n as default};
@@ -1 +1 @@
1
- import{o,Fe,a,r,g,e,n,s,un,ks}from"./chunk-index-84v7j6vh.js";import{D}from"./chunk-index-9nents16.js";var L=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,k={rtMenu:!0},x=()=>Boolean(window.history.state?.rtMenu),w=8,M=(t)=>t?.isConnected?t:null;function y(t){return t.items.map((u)=>n("button",{type:"button",role:u.checked===void 0?"menuitem":"menuitemcheckbox",...u.checked===void 0?{}:{"aria-checked":u.checked},className:"menu-item menu-link","data-tone":u.tone,onClick:()=>t.onChoose(u),children:[u.icon?e("span",{className:"menu-icon","data-tone":u.tone,children:e(s,{name:u.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:u.label})}),u.checked?e(s,{name:"check",size:18,className:"menu-check"}):null]},u.id))}function H({menu:t}){let u=a(void 0);if(t)u.current=t;let c=u.current,m=a(!1),p=a(void 0),h=t?.serial;return o(()=>{if(h===void 0)return;return window.history.pushState(k,"",window.location.href),m.current=!0,()=>{if(m.current)m.current=!1,window.history.back()}},[h]),o(()=>{let f=()=>{if(!m.current||x())return;m.current=!1,un();let E=p.current;p.current=void 0,E?.()};return window.addEventListener("popstate",f),()=>window.removeEventListener("popstate",f)},[]),e(D,{open:t!==void 0,title:c?.title??"",onClose:un,restoreFocus:()=>M(c?.source??null),children:c?e("div",{className:"menu action-items",role:"menu","aria-label":c.title,children:e(y,{items:c.items,onChoose:(f)=>{if(!m.current){un(),f.run();return}p.current=f.run,window.history.back()}})}):null})}function T({menu:t}){let u=a(null),[c,m]=r(t.at),{source:p}=t,h=(i)=>{M(p)?.focus(),un(),i?.()},f=a(h);f.current=h,Fe(()=>{let i=u.current;if(!i)return;let d=i.getBoundingClientRect();m({x:Math.max(w,Math.min(t.at.x,window.innerWidth-d.width-w)),y:Math.max(w,Math.min(t.at.y,window.innerHeight-d.height-w))}),i.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),o(()=>{let i=(l)=>{if(l.target instanceof Node&&u.current?.contains(l.target))return;un()},d=()=>un();return document.addEventListener("pointerdown",i,!0),document.addEventListener("wheel",i,{capture:!0,passive:!0}),document.addEventListener("touchmove",i,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",i,!0),document.removeEventListener("wheel",i,!0),document.removeEventListener("touchmove",i,!0),window.removeEventListener("resize",d)}},[]);let E=(i)=>{let d=[...u.current?.querySelectorAll('[role^="menuitem"]')??[]],l=d.indexOf(document.activeElement),v=(b)=>{i.preventDefault(),d[(b+d.length)%d.length]?.focus()};switch(i.key){case"Escape":i.preventDefault(),i.stopPropagation(),f.current();return;case"ArrowDown":return v(l+1);case"ArrowUp":return v(l<0?-1:l-1);case"Tab":return v(i.shiftKey?l<0?-1:l-1:l+1);case"Home":return v(0);case"End":return v(-1)}};return e("div",{ref:u,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${c.x}px`,top:`${c.y}px`},onKeyDown:E,children:e(y,{items:t.items,onChoose:(i)=>h(i.run)})})}function O(){let t=ks(),u=a(void 0);if(t&&u.current?.serial!==t.serial)u.current={serial:t.serial,sheet:L()};let c=Boolean(t&&u.current?.sheet);return n(g,{children:[e(H,{menu:c?t:void 0}),t&&!c?e(T,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
1
+ import{s,Fe,a,r,g,e,n,o,kt,zo}from"./chunk-index-kankja6p.js";import{L}from"./chunk-index-47yspxa4.js";var k=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,x={rtMenu:!0},H=()=>Boolean(window.history.state?.rtMenu),w=8,M=(t)=>t?.isConnected?t:null;function y(t){return t.items.map((u)=>n("button",{type:"button",role:u.checked===void 0?"menuitem":"menuitemcheckbox",...u.checked===void 0?{}:{"aria-checked":u.checked},className:"menu-item menu-link","data-tone":u.tone,onClick:()=>t.onChoose(u),children:[u.icon?e("span",{className:"menu-icon","data-tone":u.tone,children:e(o,{name:u.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:u.label})}),u.checked?e(o,{name:"check",size:18,className:"menu-check"}):null]},u.id))}function T({menu:t}){let u=a(void 0);if(t)u.current=t;let c=u.current,m=a(!1),p=a(void 0),h=t?.serial;return s(()=>{if(h===void 0)return;return window.history.pushState(x,"",window.location.href),m.current=!0,()=>{if(m.current)m.current=!1,window.history.back()}},[h]),s(()=>{let f=()=>{if(!m.current||H())return;m.current=!1,kt();let E=p.current;p.current=void 0,E?.()};return window.addEventListener("popstate",f),()=>window.removeEventListener("popstate",f)},[]),e(L,{open:t!==void 0,title:c?.title??"",onClose:kt,restoreFocus:()=>M(c?.source??null),children:c?e("div",{className:"menu action-items",role:"menu","aria-label":c.title,children:e(y,{items:c.items,onChoose:(f)=>{if(!m.current){kt(),f.run();return}p.current=f.run,window.history.back()}})}):null})}function C({menu:t}){let u=a(null),[c,m]=r(t.at),{source:p}=t,h=(i)=>{M(p)?.focus(),kt(),i?.()},f=a(h);f.current=h,Fe(()=>{let i=u.current;if(!i)return;let d=i.getBoundingClientRect();m({x:Math.max(w,Math.min(t.at.x,window.innerWidth-d.width-w)),y:Math.max(w,Math.min(t.at.y,window.innerHeight-d.height-w))}),i.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),s(()=>{let i=(l)=>{if(l.target instanceof Node&&u.current?.contains(l.target))return;kt()},d=()=>kt();return document.addEventListener("pointerdown",i,!0),document.addEventListener("wheel",i,{capture:!0,passive:!0}),document.addEventListener("touchmove",i,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",i,!0),document.removeEventListener("wheel",i,!0),document.removeEventListener("touchmove",i,!0),window.removeEventListener("resize",d)}},[]);let E=(i)=>{let d=[...u.current?.querySelectorAll('[role^="menuitem"]')??[]],l=d.indexOf(document.activeElement),v=(b)=>{i.preventDefault(),d[(b+d.length)%d.length]?.focus()};switch(i.key){case"Escape":i.preventDefault(),i.stopPropagation(),f.current();return;case"ArrowDown":return v(l+1);case"ArrowUp":return v(l<0?-1:l-1);case"Tab":return v(i.shiftKey?l<0?-1:l-1:l+1);case"Home":return v(0);case"End":return v(-1)}};return e("div",{ref:u,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${c.x}px`,top:`${c.y}px`},onKeyDown:E,children:e(y,{items:t.items,onChoose:(i)=>h(i.run)})})}function O(){let t=zo(),u=a(void 0);if(t&&u.current?.serial!==t.serial)u.current={serial:t.serial,sheet:k()};let c=Boolean(t&&u.current?.sheet);return n(g,{children:[e(T,{menu:c?t:void 0}),t&&!c?e(C,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
@@ -0,0 +1 @@
1
+ import{s,e,F,d,w,tt}from"./chunk-index-kankja6p.js";function g({name:o}){let i=d((t)=>t.listed),r=d((t)=>Object.values(t.rooms).find((m)=>m.view?.kind==="agent"&&m.view.name===o)?.view?.key,o);return s(()=>{if(r)F("room",r,{replace:!0}),tt(o);else if(i)F("rooms",void 0,{replace:!0})},[r,i,o]),e("div",{className:"page",children:e(w,{})})}export{g as AgentPage};
@@ -0,0 +1 @@
1
+ import{h,Q,S,J,N,a,t,g,e,n,o,_e,d,k,_,fe,Yt,mn,ne,Fi,di,kr,Ht,fi,_r}from"./chunk-index-kankja6p.js";import{Ee}from"./chunk-index-qqwk157d.js";import{ti}from"./chunk-index-azrnzgev.js";import"./chunk-index-raf772z6.js";import{Wn}from"./chunk-index-r3tqhew8.js";import{Jn,ei}from"./chunk-index-gt42wjby.js";import{qt}from"./chunk-index-1fn8q4ps.js";import"./chunk-index-sxq69p1f.js";import"./chunk-index-xxbveevc.js";import{it}from"./chunk-index-nrexxkar.js";Jn();var M=S(()=>(h("nemtqbnc"),import("./chunk-folder-list-nemtqbnc.js")).then((s)=>({default:s.FolderList}))),O=J(function(l){let{view:r}=l,p=qt(()=>Yt(r.key),r.home?void 0:ei(r.key));return e(kr,{...l,press:p,item:{...r.home?{}:{"data-drop-item":"","data-key":r.key},...l.arranging?{"data-arranging":""}:{}},after:l.arranging?e("button",{type:"button",className:"icon-button row-more","aria-haspopup":"menu","aria-label":t("Room menu"),onClick:(c)=>{let u=c.currentTarget;Yt(r.key).then((i)=>{if(!i)return;let y=u.getBoundingClientRect();fe({...i,at:{x:y.left,y:y.bottom},via:"key",source:u})},()=>{return})},children:e(o,{name:"more",size:18})}):null})});function P(s){let{now:l}=ne(),{timeZone:r}=_(),p=Ht(s.rooms);return e("ul",{className:"room-list",children:p.map(({key:c,...u})=>{let i=s.threads[c];return e(O,{...u,active:c===s.active,now:l,timeZone:r,arranging:s.arranging,...i?{threads:e(fi,{open:i.open,closed:i.closed,active:s.active,parent:c})}:{}},c)})})}function v(s){let r=Ht(s.rooms).length===0;if(r&&s.zone?.kind!=="pinned")return null;return n("section",{className:"stack",...r?{"data-empty":""}:{},...s.zone?{"data-drop-zone":s.zone.kind,"data-zone-id":s.zone.id}:{},children:[e("h2",{className:"section-title",children:s.title}),r?null:e(P,{rooms:s.rooms,threads:s.threads,active:s.active,arranging:s.arranging})]})}function re(s){let l=Boolean(_().kinds?.length),r=d((m)=>JSON.stringify({listed:m.listed,...it(m,(F)=>_e(m,F))})),p=ti(),c=a(r);if(!p)c.current=r;let u=c.current,{listed:i,...y}=N(()=>JSON.parse(u),[u]),{home:z,pinned:A,folders:R,restAgents:T,restGroups:D,rest:C,threads:L,orphans:f}=y,w=Fi(),K=z.length+A.length+C.length===0&&R.every((m)=>m.rooms.length===0)&&f.open.length+f.closed.length===0,b={threads:L,active:s.active,arranging:w};return n("div",{className:"page","data-column":s.active?"":void 0,"data-drop-root":"",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Rooms")}),n("div",{className:"actions",children:[n("button",{type:"button",className:"header-button search-button",onClick:s.onSearch,children:[e(o,{name:"search",size:16}),e("span",{children:t("Find a room")}),e("kbd",{children:"⌘K"})]}),i?e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(m)=>Wn(m.currentTarget),children:e(o,{name:"more",size:18})}):null,e("button",{type:"button",className:"header-button icon-button","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(m)=>mn(m.currentTarget),children:e(o,{name:"plus"})})]})]}),w?n("div",{className:"arrange-bar",children:[n("button",{type:"button",className:"secondary",onClick:()=>Ee({kind:"new"}),children:[e(o,{name:"plus",size:16}),e("span",{children:t("Add a folder")})]}),e("button",{type:"button",onClick:()=>di(!1),children:t("Done")})]}):null,i&&K&&!l?e(k,{children:t("No rooms yet. Rooms appear when the team has a knight.")}):null,!i?n("div",{className:"stack","aria-busy":"true",children:[e("div",{className:"skeleton"}),e("div",{className:"skeleton"}),e("div",{className:"skeleton"})]}):null,e(v,{title:t("Home"),rooms:z,...b}),e(v,{title:t("Pinned"),rooms:A,zone:{kind:"pinned",id:"pinned"},...b}),R.length>0?e("div",{className:"stack folder-list","data-folder-list":"",children:e(Q,{fallback:e("div",{className:"skeleton","aria-busy":"true"}),children:e(M,{folders:R,active:s.active,listed:i,rooms:(m)=>e(P,{rooms:m,threads:L,active:s.active,arranging:w})})})}):null,R.length>0?e(v,{title:t("Ungrouped"),rooms:C,zone:{kind:"rest",id:"rest"},...b}):n(g,{children:[e(v,{title:t("Knights"),rooms:T,zone:{kind:"rest",id:"rest-agents"},...b}),e(v,{title:t("Groups"),rooms:D,zone:{kind:"rest",id:"rest-groups"},...b})]}),f.open.length+f.closed.length>0?n("section",{className:"stack",children:[e("h2",{className:"section-title",children:t("Dispatch threads")}),e(fi,{open:f.open,closed:f.closed,active:s.active})]}):null,e(_r,{active:s.active})]})}export{re as ArrangedRoomsPage};
@@ -0,0 +1 @@
1
+ import{t,te,y,u,p}from"./chunk-index-kankja6p.js";import{Jt}from"./chunk-index-raf772z6.js";import{pi,Er}from"./chunk-index-xbs8q4kn.js";import{Ir}from"./chunk-index-sxq69p1f.js";import"./chunk-index-xxbveevc.js";var s=500,d=(e)=>{let n=[];for(let r=0;r<e.length;r+=s)n.push(e.slice(r,r+s));return n},i=()=>y.dispatch({type:"changed"});async function v(e){let n=Ir(e),r=Object.keys(n);if(r.length===0)return;let a=[];try{for(let o of d(r))a.push(...(await pi.readAll(o)).moved)}catch(o){p(u(o),"danger"),i();return}Jt(Object.fromEntries(r.map((o)=>[o,0]))),p(te(r.length,"Marked {count} room as read","Marked {count} rooms as read"),"info",a.length?{label:t("Undo"),run:()=>void l(a,n)}:void 0)}async function l(e,n){try{for(let r of d(e)){let{restored:a}=await pi.unreadAll(r);Jt(Object.fromEntries(a.map((o)=>[o,n[o]??0])))}}catch(r){p(u(r),"danger")}i()}var R=(e)=>Er(e);export{R as clearAllFinished,v as markAllRead};
@@ -0,0 +1 @@
1
+ import{Be,jt,G,hi,bn}from"./chunk-index-eyc2rkq5.js";import{J,gr,s,A,N,a,r,t,c,g,e,n,si,le,O,u,p,gn,he,Ze,Me}from"./chunk-index-kankja6p.js";import{K}from"./chunk-index-3wbyq10m.js";import{L}from"./chunk-index-47yspxa4.js";var ue={"hat.none":"No hat","hat.goggcap":"Leather cap","hat.tallcap":"Burgundian felt cap","hat.softcap":"Soft cap","hat.hardhat":"Iron skullcap","hat.fcap":"Hunter's cap","hat.winghelm":"Winged helm","hat.helm":"Helm","hat.mortar":"Biretta","hat.beret":"Chaperon","hat.goggles":"Pointed cap","hat.tricorn":"Pilgrim hat","hat.sailor":"Straw hat","hat.kettle":"Kettle hat","hat.cavalier":"Feathered hat","hat.toque":"Linen cook's cap","hair.none":"No hair","beard.none":"No beard","accessory.none":"No accessory","prop.beads":"Prayer beads","prop.marotte":"Marotte","prop.map":"Chart","prop.flask":"Alchemist's phial","prop.telescope":"Astrolabe","prop.wrench":"Dividers","outfit.surplice":"Surplice","outfit.overalls":"Work jerkin","outfit.armor":"Mail hauberk","outfit.apron":"Smith's apron","outfit.chef":"Cook's tunic","outfit.coat":"Doublet","outfit.vest":"Pourpoint","outfit.sailor":"Mariner's tunic","hair.bob":"Bob","hair.bun":"Bun","hair.ponytail":"Ponytail"},Y=(i)=>i.charAt(0).toUpperCase()+i.slice(1);function S(i,l){let m=`character.${i}.${l}`,h=t(m);if(h!==m)return h;if(i==="class")return G.classes[l]?.label??Y(l);return ue[`${i}.${l}`]??Y(l)}function Z(i){let l=`character.jobs.${i}`,m=t(l);return m!==l?m:G.classes[i]?.jobs??""}var z=[{field:"hat",title:c("Hat"),ids:G.hats},{field:"outfit",title:c("Outfit"),ids:G.outfits},{field:"prop",title:c("Prop"),ids:G.props},{field:"hair",title:c("Hair"),ids:G.hair},{field:"beard",title:c("Beard"),ids:["none",...G.beards]},{field:"accessory",title:c("Accessory"),ids:["none",...G.accessories]}],fe=new Set(["class","colors","palette","build","skin","hairColor",...z.map((i)=>i.field)]),re=Object.keys(G.palettes),ee={idle:c("Idle"),thinking:c("Thinking"),working:c("Working"),waiting:c("Waiting for you"),done:c("Done"),error:c("Error"),sleepy:c("Sleepy")},me={slim:c("Slim"),regular:c("Regular"),stout:c("Stout")};function W(i){return{class:i.class,outfit:i.outfit,hat:i.hat,prop:i.prop,hair:i.hair,beard:i.beard,accessory:i.accessory,build:i.build,skin:i.skin,hairColor:i.hairColor,colors:{...i.colors}}}var te=(i)=>JSON.stringify(W(i)),k=(i)=>i[Math.floor(Math.random()*i.length)];function be(){return{class:k(Be),outfit:k(G.outfits),hat:k(G.hats),prop:k(G.props),hair:k(G.hair),beard:k(["none",...G.beards]),accessory:k(["none",...G.accessories]),build:k(["slim","regular","stout"]),skin:k([0,1,2,3,4,5]),hairColor:k(G.hairColors),palette:k(re)}}var ie=J(function(l){return n("button",{type:"button",className:"creator-tile","aria-pressed":l.pressed,title:l.hint?`${l.label} — ${l.hint}`:l.label,onClick:l.onPick,...l.data,children:[e(he,{spec:l.spec,size:l.size,live:!1}),e("span",{children:l.label})]})});function ge(i,l,m){let h=JSON.stringify({...i,[l]:0});return N(()=>m.map((d)=>({...i,[l]:d})),[h,l,m])}function pe(){let i=a(null),[l,m]=r();return s(()=>{let h=i.current;if(!h)return;let d=()=>{let v=h.scrollLeft>1,w=h.scrollLeft+h.clientWidth<h.scrollWidth-1;m(v&&w?"both":w?"end":v?"start":void 0)};d(),h.addEventListener("scroll",d,{passive:!0});let b=typeof ResizeObserver>"u"?void 0:new ResizeObserver(d);return b?.observe(h),()=>{h.removeEventListener("scroll",d),b?.disconnect()}},[]),[i,l]}function ye(i){let{part:l}=i,m=ge(i.shown,l.field,l.ids),[h,d]=pe();return e("div",{className:"creator-strip",ref:h,"data-more":d,children:l.ids.map((b,v)=>e(ie,{data:{[`data-${l.field}`]:b},spec:m[v],size:44,label:S(l.field,b),pressed:i.draft[l.field]===b,onPick:()=>i.onPick(b)},b))})}function M(i){return e("button",{type:"button",className:"creator-swatch","aria-pressed":i.pressed,"aria-label":i.label,title:i.label,style:{background:i.background},onClick:i.onPick,...i.data})}function P(i){return n("div",{className:"creator-field","data-field":i.field,children:[i.title?e("h3",{children:i.title}):null,i.children,i.error?e("p",{className:"field-error",role:"alert",children:i.error}):null]})}function Oe(i){let[l,m]=r(i.character),h=gr(l),[d,b]=r({}),[v,w]=r(!1),[I,ne]=r("idle"),[U,R]=r(),[D,_]=r(),j=Me("(max-width: 719px)"),V=a(null),F=A(),oe=Ze(l),se=gn(),E=te(l)!==te(i.character);s(()=>m(i.character),[i.character]),s(()=>{if(!E||i.onPick)return;let o=(y)=>y.preventDefault(),f=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let T=y.target instanceof Element?y.target.closest("a"):null;if(!T||T.target||T.hasAttribute("download"))return;if(V.current?.contains(T))return;y.preventDefault(),y.stopPropagation(),R({kind:"link",anchor:T})},H=si((y)=>R({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",o),document.addEventListener("click",f,!0),()=>{H(),window.removeEventListener("beforeunload",o),document.removeEventListener("click",f,!0)}},[E,i.onPick]);let C=(o)=>{b({}),m((f)=>hi(o,f))},ce=async()=>{if(i.onPick){i.onPick(W(l),l);return}w(!0),b({});try{let o=await O.setCharacter(i.name,W(l));i.onSaved?.(o),p(t("Saved."))}catch(o){let f=o instanceof le&&o.field?o.field.split(".")[0]:void 0,H=f&&fe.has(f)?f:"*";b({[H]:u(o)})}finally{w(!1)}},de=async()=>{let o=U;if(m(i.character),b({}),o?.kind==="link")setTimeout(()=>o.anchor.click(),0);else if(o?.kind==="navigate")o.proceed()},q=e(P,{field:"class",title:t("Class"),error:d.class,children:e("div",{className:"creator-grid",children:Be.map((o)=>e(ke,{id:o,base:h,pressed:l.class===o,onPick:()=>C({class:o,colors:l.colors})},o))})}),x=n(P,{field:"colors",title:t("Colors"),error:d.colors??d.palette,children:[n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Palette")}),re.map((o)=>{let f=G.palettes[o];return e(M,{data:{"data-palette":o},label:S("palette",o),pressed:l.palette===o,background:`linear-gradient(135deg, ${f.primary} 52%, ${f.trim} 52%)`,onPick:()=>C({palette:o})},o)})]}),e("div",{className:"creator-custom",children:["primary","secondary","trim"].map((o)=>n("label",{children:[e("span",{children:o==="primary"?t("Primary (the accent)"):o==="secondary"?t("Secondary"):t("Trim")}),e("input",{type:"color",value:l.colors[o],onChange:(f)=>C({colors:{[o]:f.target.value}})})]},o))})]}),Q=z.map((o)=>e(P,{field:o.field,title:t(o.title),error:d[o.field],children:e(ye,{part:o,draft:l,shown:h,onPick:(f)=>C({[o.field]:f})})},o.field)),X=n(g,{children:[e(P,{field:"build",title:t("Build"),error:d.build,children:n("fieldset",{className:"segmented",children:[e("legend",{className:"visually-hidden",children:t("Build")}),["slim","regular","stout"].map((o)=>n("label",{"data-checked":l.build===o,children:[e("input",{type:"radio",name:`${F}-build`,checked:l.build===o,onChange:()=>C({build:o})}),ae(o)]},o))]})}),e(P,{field:"skin",title:t("Skin tone"),error:d.skin,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Skin tone")}),(se??G.skins).map((o,f)=>e(M,{data:{"data-skin":String(f)},label:t("Skin tone {n}",{n:f+1}),pressed:l.skin===f,background:o,onPick:()=>C({skin:f})},f))]})}),e(P,{field:"hairColor",title:t("Hair color"),error:d.hairColor,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Hair color")}),G.hairColors.map((o,f)=>e(M,{data:{"data-hair-color":o},label:t("Hair color {n}",{n:f+1}),pressed:l.hairColor===o,background:o,onPick:()=>C({hairColor:o})},o)),e("input",{type:"color","aria-label":t("Hair color"),value:l.hairColor,onChange:(o)=>C({hairColor:o.target.value})})]})})]}),B=[{id:"class",title:t("Class"),summary:S("class",l.class),error:d.class,node:q},{id:"colors",title:t("Colors"),summary:l.palette?S("palette",l.palette):l.colors.primary,error:d.colors??d.palette,node:x},...z.map((o,f)=>({id:o.field,title:t(o.title),summary:S(o.field,l[o.field]),error:d[o.field],node:Q[f]})),{id:"body",title:t("Body"),summary:ae(l.build),error:d.build??d.skin??d.hairColor,node:X}];return n("form",{ref:V,className:"creator",style:oe,"aria-labelledby":F,onSubmit:(o)=>{if(o.preventDefault(),(E||i.onPick)&&!v)ce()},children:[e("h2",{id:F,className:"visually-hidden",children:t("Character of {name}",{name:i.displayName})}),n("div",{className:"creator-preview",children:[e(he,{spec:l,name:i.name,state:I,size:176,label:t("{name}, {state}",{name:i.displayName,state:t(ee[I])})}),e("button",{type:"button",className:"secondary","data-action":"cycle",onClick:()=>ne((o)=>jt[(jt.indexOf(o)+1)%jt.length]??"idle"),children:t("Preview states")}),e("span",{className:"meta","aria-live":"polite",children:t(ee[I])})]}),n("div",{className:"creator-body",children:[d["*"]?e("p",{className:"field-error",role:"alert","data-field":"*",children:d["*"]}):null,j?e("ul",{className:"creator-sections",children:B.map((o)=>e("li",{children:n("button",{type:"button",className:"creator-section secondary",onClick:()=>_(o.id),children:[e("strong",{children:o.title}),e("span",{className:"meta",children:o.summary}),o.error?e("span",{className:"field-error",role:"alert",children:o.error}):null]})},o.id))}):n(g,{children:[q,x,Q,X]}),n("div",{className:"actions creator-actions",children:[e("button",{type:"button",className:"secondary","data-action":"suggest",onClick:()=>{b({}),m(bn({name:i.name,displayName:i.displayName,prompt:i.prompt}))},children:t("Suggest from role")}),e("button",{type:"button",className:"secondary","data-action":"randomize",onClick:()=>C(be()),children:t("Randomize")}),e("button",{type:"button",className:"secondary","data-action":"cancel",onClick:()=>{if(i.onCancel)i.onCancel();else if(E)R({kind:"cancel"})},children:t("Cancel")}),e("button",{type:"submit","data-action":"save",disabled:!E&&!i.onPick||v,children:v?t("Saving…"):i.onPick?t("Use this look"):t("Save")})]})]}),e(L,{open:j&&D!==void 0,title:B.find((o)=>o.id===D)?.title??"",onClose:()=>_(void 0),children:e("div",{className:"stack",children:B.find((o)=>o.id===D)?.node})}),e(K,{open:U!==void 0,title:t("Discard your changes?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>R(void 0),onConfirm:de,children:e("p",{children:t("The new look for {name} has not been saved.",{name:i.displayName})})})]})}var ae=(i)=>t(me[i]);function ke(i){let l=i.base.colors,m=N(()=>hi({class:i.id,colors:l}),[i.id,l]);return e(ie,{data:{"data-class":i.id},spec:m,size:56,label:S("class",i.id),hint:Z(i.id),pressed:i.pressed,onPick:i.onPick})}export{Oe as CharacterCreator};
@@ -1,2 +1,2 @@
1
- import{U,pe,fi,Dr,hi,lt,me,l,v,_e,Ne,Lt,Le,q,se,oe,I,Ot,yt,Xe,ge,E,ee,Te,y,wt,Ur,Vr,qr,pi,Dn,Br,Fr,Gr,Zr,T,i,C,je,It,qn,Zi,bn,vn,Hr,jr,ut}from"./chunk-index-0xj30mzw.js";import{f}from"./chunk-index-84v7j6vh.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ce(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function be(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);if(!o)return!1;return r(n.update(o)),!0}}var rn=be(an,0);var on=be(Ye,0);var ln=be((e,t)=>Ye(e,t,cn(t)),0);function Ce(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var G=50;function sn(e,{open:t,close:n},r,o){let s=e.sliceDoc(r-G,r),c=e.sliceDoc(o,o+G),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(c)[0].length,d=s.length-a;if(s.slice(d-t.length,d)==t&&c.slice(u,u+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:o+u,margin:u&&1}};let h,m;if(o-r<=2*G)h=m=e.sliceDoc(r,o);else h=e.sliceDoc(r,r+G),m=e.sliceDoc(o-G,o);let p=/^\s*/.exec(h)[0].length,D=/\s*$/.exec(m)[0].length,M=m.length-D-n.length;if(h.slice(p,p+t.length)==t&&m.slice(M,M+n.length)==n)return{open:{pos:r+p+t.length,margin:/\s/.test(h.charAt(p+t.length))?1:0},close:{pos:o-D-n.length,margin:/\s/.test(m.charAt(M-1))?1:0}};return null}function cn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);if(o.from>r.from&&o.from==n.to)o=n.to==r.to+1?r:e.doc.lineAt(n.to-1);let s=t.length-1;if(s>=0&&t[s].to>r.from)t[s].to=o.to;else t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function Ye(e,t,n=t.selection.ranges){let r=n.map((s)=>Ce(t,s.from).block);if(!r.every((s)=>s))return null;let o=n.map((s,c)=>sn(t,r[c],s.from,s.to));if(e!=2&&!o.every((s)=>s))return{changes:t.changes(n.map((s,c)=>{if(o[c])return[];return[{from:s.from,insert:r[c].open+" "},{from:s.to,insert:" "+r[c].close}]}))};else if(e!=1&&o.some((s)=>s)){let s=[];for(let c=0,a;c<o.length;c++)if(a=o[c]){let u=r[c],{open:d,close:h}=a;s.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:h.pos-h.margin,to:h.pos+u.close.length})}return{changes:s}}return null}function an(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:s,to:c}of n){let a=r.length,u=1e9,d;for(let h=s;h<=c;){let m=t.doc.lineAt(h);if(d==null){if(d=Ce(t,m.from).line,!d)continue e}if(m.from>o&&(s==c||c>m.from)){o=m.from;let p=/^\s*/.exec(m.text)[0].length,D=p==m.length,M=m.text.slice(p,p+d.length)==d?p:-1;if(p<m.text.length&&p<u)u=p;r.push({line:m,comment:M,token:d,indent:p,empty:D,single:!1})}h=m.to+1}if(u<1e9){for(let h=a;h<r.length;h++)if(r[h].indent<r[h].line.text.length)r[h].indent=u}if(r.length==a+1)r[a].single=!0}if(e!=2&&r.some((s)=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:d,empty:h,single:m}of r)if(m||!h)s.push({from:a.from+d,insert:u+" "});let c=t.changes(s);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&r.some((s)=>s.comment>=0)){let s=[];for(let{line:c,comment:a,token:u}of r)if(a>=0){let d=c.from+a,h=d+u.length;if(c.text[h-c.from]==" ")h++;s.push({from:d,to:h})}return{changes:s}}return null}var Se=Le.define(),un=Le.define(),hn=v.define(),Ze=v.define({combine(e){return Ot(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,o)=>t(r,o)||n(r,o)})}}),et=_e.define({create(){return B.empty},update(e,t){let n=t.state.facet(Ze),r=t.annotation(Se);if(r){let u=x.fromTransaction(t,r.selection),d=r.side,h=d==0?e.undone:e.done;if(u)h=Q(h,h.length,n.minDepth,u);else h=rt(h,t.startState.selection);return new B(d==0?r.rest:h,d==0?h:r.rest)}let o=t.annotation(un);if(o=="full"||o=="before")e=e.isolate();if(t.annotation(se.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let s=x.fromTransaction(t),c=t.annotation(se.time),a=t.annotation(se.userEvent);if(s)e=e.addChanges(s,c,a,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,c,a,n.newGroupDelay);if(o=="full"||o=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new B(e.done.map(x.fromJSON),e.undone.map(x.fromJSON))}});function tt(e={}){return[et,Ze.of(e),y.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?X:t.inputType=="historyRedo"?z:null;if(!r)return!1;return t.preventDefault(),r(n)}})]}function j(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(et,!1);if(!o)return!1;let s=o.pop(e,n,t);if(!s)return!1;return r(s),!0}}var X=j(0,!1),z=j(1,!1),fn=j(0,!0),dn=j(1,!0);class x{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new x(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((r)=>r.toJSON())}}static fromJSON(e){return new x(e.changes&&me.fromJSON(e.changes),[],e.mapped&&lt.fromJSON(e.mapped),e.startSelection&&l.fromJSON(e.startSelection),e.selectionsAfter.map(l.fromJSON))}static fromTransaction(e,t){let n=k;for(let r of e.startState.facet(hn)){let o=r(e);if(o.length)n=n.concat(o)}if(!n.length&&e.changes.empty)return null;return new x(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,k)}static selection(e){return new x(void 0,k,void 0,void 0,e)}}function Q(e,t,n,r){let o=t+1>n+20?t-n-1:0,s=e.slice(o,t);return s.push(r),s}function mn(e,t){let n=[],r=!1;return e.iterChangedRanges((o,s)=>n.push(o,s)),t.iterChangedRanges((o,s,c,a)=>{for(let u=0;u<n.length;){let d=n[u++],h=n[u++];if(a>=d&&c<=h)r=!0}}),r}function pn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function nt(e,t){return!e.length?t:!t.length?e:e.concat(t)}var k=[],gn=200;function rt(e,t){if(!e.length)return[x.selection([t])];else{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-gn));if(r.length&&r[r.length-1].eq(t))return e;return r.push(t),Q(e,e.length-1,1e9,n.setSelAfter(r))}}function yn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function xe(e,t){if(!e.length)return e;let n=e.length,r=k;while(n){let o=xn(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let s=e.slice(0,n);return s[n-1]=o,s}else t=o.mapped,n--,r=o.selectionsAfter}return r.length?[x.selection(r)]:k}function xn(e,t,n){let r=nt(e.selectionsAfter.length?e.selectionsAfter.map((a)=>a.map(t)):k,n);if(!e.changes)return x.selection(r);let o=e.changes.map(t),s=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(s):s;return new x(o,q.mapEffects(e.effects,t),c,e.startSelection.map(s),r)}var Sn=/^(input\.type|delete)($|\.)/;class B{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new B(this.done,this.undone):this}addChanges(e,t,n,r,o){let s=this.done,c=s[s.length-1];if(c&&c.changes&&!c.changes.empty&&e.changes&&(!n||Sn.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,mn(c.changes,e.changes))||n=="input.type.compose"))s=Q(s,s.length-1,r.minDepth,new x(e.changes.compose(c.changes),nt(q.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,k));else s=Q(s,s.length,r.minDepth,e);return new B(s,k,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:k;if(o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&pn(o[o.length-1],e))return this;return new B(rt(this.done,e),this.undone,t,n)}addMapping(e){return new B(xe(this.done,e),xe(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Se.of({side:e,rest:yn(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!o.changes)return null;else{let c=r.length==1?k:r.slice(0,r.length-1);if(o.mapped)c=xe(c,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Se.of({side:e,rest:c,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}B.empty=new B(k,k);var ot=[{key:"Mod-z",run:X,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:z,preventDefault:!0},{linux:"Ctrl-Shift-z",run:z,preventDefault:!0},{key:"Mod-u",run:fn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:dn,preventDefault:!0}];function F(e,t){return l.create(e.ranges.map(t),e.mainIndex)}function A(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(A(e,r)),!0}function Y(e,t){return l.cursor(t?e.to:e.from)}function it(e,t){return L(e,(n)=>n.empty?e.moveByChar(n,t):Y(n,t))}function g(e){return e.textDirectionAt(e.state.selection.main.head)==ee.LTR}var st=(e)=>it(e,!g(e)),ct=(e)=>it(e,g(e));function at(e,t){return L(e,(n)=>n.empty?e.moveByGroup(n,t):Y(n,t))}var kn=(e)=>at(e,!g(e)),Cn=(e)=>at(e,g(e));var no=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Mn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Z(e,t,n){let r=C(e).resolveInner(t.head),o=n?T.closedBy:T.openedBy;for(let u=t.head;;){let d=n?r.childAfter(u):r.childBefore(u);if(!d)break;if(Mn(e,d,o))r=d;else u=n?d.to:d.from}let s=r.type.prop(o),c,a;if(s&&(c=n?ut(e,r.from,1):ut(e,r.to,-1))&&c.matched)a=n?c.end.to:c.end.from;else a=n?r.to:r.from;return l.cursor(a,n?-1:1)}var An=(e)=>L(e,(t)=>Z(e.state,t,!g(e))),Ln=(e)=>L(e,(t)=>Z(e.state,t,g(e)));function ht(e,t){return L(e,(n)=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var ft=(e)=>ht(e,!1),dt=(e)=>ht(e,!0);function mt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let s of e.state.facet(y.scrollMargins)){let c=s(e);if(c===null||c===void 0?void 0:c.top)n=Math.max(c===null||c===void 0?void 0:c.top,n);if(c===null||c===void 0?void 0:c.bottom)r=Math.max(c===null||c===void 0?void 0:c.bottom,r)}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function pt(e,t){let n=mt(e),{state:r}=e,o=F(r.selection,(c)=>c.empty?e.moveVertically(c,t,n.height):Y(c,t));if(o.eq(r.selection))return!1;let s;if(n.selfScroll){let c=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),u=a.top+n.marginTop,d=a.bottom-n.marginBottom;if(c&&c.top>u&&c.bottom<d)s=y.scrollIntoView(o.main.head,{y:"start",yMargin:c.top-u})}return e.dispatch(A(r,o),{effects:s}),!0}var Ge=(e)=>pt(e,!1),ke=(e)=>pt(e,!0);function w(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from))o=e.moveToLineBoundary(t,n,!1);if(!n&&o.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;if(s&&t.head!=r.from+s)o=l.cursor(r.from+s)}return o}var Bn=(e)=>L(e,(t)=>w(e,t,!0)),En=(e)=>L(e,(t)=>w(e,t,!1)),Tn=(e)=>L(e,(t)=>w(e,t,!g(e))),wn=(e)=>L(e,(t)=>w(e,t,g(e))),Wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!1,!1)),Rn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!0,!1));function On(e,t,n){let r=!1,o=F(e.selection,(s)=>{let c=ut(e,s.head,-1)||ut(e,s.head,1)||s.head>0&&ut(e,s.head-1,1)||s.head<e.doc.length&&ut(e,s.head+1,-1);if(!c||!c.end)return s;r=!0;let a=c.start.from==s.head?c.end.to:c.end.from;return n?l.range(s.anchor,a):l.cursor(a)});if(!r)return!1;return t(A(e,o)),!0}var Fn=({state:e,dispatch:t})=>On(e,t,!1);function b(e,t,n){let r=F(e.state.selection,(o)=>{if(o.undirectional&&o.head>=o.anchor!=t)o=l.range(o.head,o.anchor);let s=n(o);return l.range(o.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});if(r.eq(e.state.selection))return!1;return e.dispatch(A(e.state,r)),!0}function gt(e,t){return b(e,t,(n)=>e.moveByChar(n,t))}var xt=(e)=>gt(e,!g(e)),St=(e)=>gt(e,g(e));function kt(e,t){return b(e,t,(n)=>e.moveByGroup(n,t))}var In=(e)=>kt(e,!g(e)),Pn=(e)=>kt(e,g(e));var Nn=(e)=>{let t=!g(e);return b(e,t,(n)=>Z(e.state,n,t))},Vn=(e)=>{let t=g(e);return b(e,t,(n)=>Z(e.state,n,t))};function vt(e,t){return b(e,t,(n)=>e.moveVertically(n,t))}var bt=(e)=>vt(e,!1),Ct=(e)=>vt(e,!0);function Mt(e,t){return b(e,t,(n)=>e.moveVertically(n,t,mt(e).height))}var Ue=(e)=>Mt(e,!1),ze=(e)=>Mt(e,!0),Gn=(e)=>b(e,!0,(t)=>w(e,t,!0)),Un=(e)=>b(e,!1,(t)=>w(e,t,!1)),zn=(e)=>{let t=!g(e);return b(e,t,(n)=>w(e,n,t))},_n=(e)=>{let t=g(e);return b(e,t,(n)=>w(e,n,t))},Jn=(e)=>b(e,!1,(t)=>l.cursor(e.lineBlockAt(t.head).from)),$n=(e)=>b(e,!0,(t)=>l.cursor(e.lineBlockAt(t.head).to)),Je=({state:e,dispatch:t})=>(t(A(e,{anchor:0})),!0),$e=({state:e,dispatch:t})=>(t(A(e,{anchor:e.doc.length})),!0),Ke=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:0})),!0),He=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Kn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Hn=({state:e,dispatch:t})=>{let n=te(e).map(({from:r,to:o})=>l.undirectionalRange(r,Math.min(o+1,e.doc.length)));return t(e.update({selection:l.create(n),userEvent:"select"})),!0},Qn=({state:e,dispatch:t})=>{let n=F(e.selection,(r)=>{let o=C(e),s=o.resolveStack(r.from,1);if(r.empty){let c=o.resolveStack(r.from,-1);if(c.node.from>=s.node.from&&c.node.to<=s.node.to)s=c}for(let c=s;c;c=c.next){let{node:a}=c;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&c.next)return l.undirectionalRange(a.from,a.to)}return r});if(n.eq(e.selection))return!1;return t(A(e,n)),!0};function At(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let s of n.selection.ranges){let c=n.doc.lineAt(s.head);if(t?c.to<e.state.doc.length:c.from>0)for(let a=s;;){let u=e.moveVertically(a,t);if(u.head<c.from||u.head>c.to){if(!o.some((d)=>d.head==u.head))o.push(u);break}else if(u.head==a.head)break;else a=u}}if(o.length==r.ranges.length)return!1;return e.dispatch(A(n,l.create(o,o.length-1))),!0}var jn=(e)=>At(e,!1),Xn=(e)=>At(e,!0),Yn=({state:e,dispatch:t})=>{let n=e.selection,r=null;if(n.ranges.length>1)r=l.create([n.main]);else if(!n.main.empty)r=l.create([l.cursor(n.main.head)]);if(!r)return!1;return t(A(e,r)),!0};function _(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s)=>{let{from:c,to:a}=s;if(c==a){let u=t(s);if(u<c)n="delete.backward",u=H(e,u,!1);else if(u>c)n="delete.forward",u=H(e,u,!0);c=Math.min(c,u),a=Math.max(a,u)}else c=H(e,c,!1),a=H(e,a,!0);return c==a?{range:s}:{changes:{from:c,to:a},range:l.cursor(c,c<s.head?-1:1)}});if(o.changes.empty)return!1;return e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?y.announce.of(r.phrase("Selection deleted")):void 0})),!0}function H(e,t,n){if(e instanceof y)for(let r of e.state.facet(y.atomicRanges).map((o)=>o(e)))r.between(t,t,(o,s)=>{if(o<t&&s>t)t=n?s:o});return t}var Bt=(e,t,n)=>_(e,(r)=>{let o=r.from,{state:s}=e,c=s.doc.lineAt(o),a,u;if(n&&!t&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(a=c.text.slice(0,o-c.from))){if(a[a.length-1]=="\t")return o-1;let d=Xe(a,s.tabSize),h=d%It(s)||It(s);for(let m=0;m<h&&a[a.length-1-m]==" ";m++)o--;u=o}else if(u=pe(c.text,o-c.from,t,t)+c.from,u==o&&c.number!=(t?s.doc.lines:1))u+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from)))u=pe(c.text,u-c.from,!1,!1)+c.from;return u}),ve=(e)=>Bt(e,!1,!0);var Dt=(e)=>Bt(e,!0,!1),Et=(e,t)=>_(e,(n)=>{let r=n.head,{state:o}=e,s=o.doc.lineAt(r),c=o.charCategorizer(r);for(let a=null;;){if(r==(t?s.to:s.from)){if(r==n.head&&s.number!=(t?o.doc.lines:1))r+=t?1:-1;break}let u=pe(s.text,r-s.from,t)+s.from,d=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),h=c(d);if(a!=null&&h!=a)break;if(d!=" "||r!=n.head)a=h;r=u}return r}),Tt=(e)=>Et(e,!1),Zn=(e)=>Et(e,!0);var er=(e)=>_(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var tr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var rr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>({changes:{from:r.from,to:r.to,insert:U.of(["",""])},range:l.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},or=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let o=r.from,s=e.doc.lineAt(o),c=o==s.from?o-1:pe(s.text,o-s.from,!1)+s.from,a=o==s.to?o+1:pe(s.text,o-s.from,!0)+s.from;return{changes:{from:c,to:a,insert:e.doc.slice(o,a).append(e.doc.slice(c,o))},range:l.cursor(a)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function te(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from)s=e.doc.lineAt(r.to-1);if(n>=o.number){let c=t[t.length-1];c.to=s.to,c.ranges.push(r)}else t.push({from:o.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Wt(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let s of te(e)){if(n?s.to==e.doc.length:s.from==0)continue;let c=e.doc.lineAt(n?s.to+1:s.from-1),a=c.length+1;if(n){r.push({from:s.to,to:c.to},{from:s.from,insert:c.text+e.lineBreak});for(let u of s.ranges)o.push(l.range(Math.min(e.doc.length,u.anchor+a),Math.min(e.doc.length,u.head+a)))}else{r.push({from:c.from,to:s.from},{from:s.to,insert:e.lineBreak+c.text});for(let u of s.ranges)o.push(l.range(u.anchor-a,u.head-a))}}if(!r.length)return!1;return t(e.update({changes:r,scrollIntoView:!0,selection:l.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0}var lr=({state:e,dispatch:t})=>Wt(e,t,!1),ir=({state:e,dispatch:t})=>Wt(e,t,!0);function Rt(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of te(e))if(n)r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak});else r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var sr=({state:e,dispatch:t})=>Rt(e,t,!1),cr=({state:e,dispatch:t})=>Rt(e,t,!0),ar=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(te(t).map(({from:o,to:s})=>{if(o>0)o--;else if(s<t.doc.length)s++;return{from:o,to:s}})),r=F(t.selection,(o)=>{let s=void 0;if(e.lineWrapping){let c=e.lineBlockAt(o.head),a=e.coordsAtPos(o.head,o.assoc||1);if(a)s=c.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2}return e.moveVertically(o,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ur(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),s;if(r&&o&&r.to<=t&&o.from>=t&&(s=r.type.prop(T.closedBy))&&s.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from)))return{from:r.to,to:o.from};return null}var Qe=Ft(!1),hr=Ft(!0);function Ft(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((o)=>{let{from:s,to:c}=o,a=t.doc.lineAt(s),u=!e&&s==c&&ur(t,s);if(e)s=c=(c<=a.to?a:t.doc.lineAt(c)).to;let d=new bn(t,{simulateBreak:s,simulateDoubleBreak:!!u}),h=Zi(d,s);if(h==null)h=Xe(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize);while(c<a.to&&/\s/.test(a.text[c-a.from]))c++;if(u)({from:s,to:c}=u);else if(s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s)))s=a.from;let m=["",qn(t,h)];if(u)m.push(qn(t,d.lineIndent(a.from,-1)));return{changes:{from:s,to:c,insert:U.of(m)},range:l.cursor(s+1+m[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Me(e,t){let n=-1;return e.changeByRange((r)=>{let o=[];for(let c=r.from;c<=r.to;){let a=e.doc.lineAt(c);if(a.number>n&&(r.empty||r.to>a.from))t(a,o,r),n=a.number;c=a.to+1}let s=e.changes(o);return{changes:o,range:l.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var fr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new bn(e,{overrideIndentation:(s)=>{let c=n[s];return c==null?-1:c}}),o=Me(e,(s,c,a)=>{let u=Zi(r,s.from);if(u==null)return;if(!/\S/.test(s.text))u=0;let d=/^\s*/.exec(s.text)[0],h=qn(e,u);if(d!=h||a.from<s.from+d.length)n[s.from]=u,c.push({from:s.from,to:s.from+d.length,insert:h})});if(!o.changes.empty)t(e.update(o,{userEvent:"indent"}));return!0},ne=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{r.push({from:n.from,insert:e.facet(je)})}),{userEvent:"input.indent"})),!0},Pt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Me(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let s=Xe(o,e.tabSize),c=0,a=qn(e,Math.max(0,s-It(e)));while(c<o.length&&c<a.length&&o.charCodeAt(c)==a.charCodeAt(c))c++;r.push({from:n.from+c,to:n.from+o.length,insert:a.slice(c)})}),{userEvent:"delete.dedent"})),!0},dr=(e)=>(e.setTabFocusMode(),!0);var mr=[{key:"Ctrl-b",run:st,shift:xt,preventDefault:!0},{key:"Ctrl-f",run:ct,shift:St},{key:"Ctrl-p",run:ft,shift:bt},{key:"Ctrl-n",run:dt,shift:Ct},{key:"Ctrl-a",run:Wn,shift:Jn},{key:"Ctrl-e",run:Rn,shift:$n},{key:"Ctrl-d",run:Dt},{key:"Ctrl-h",run:ve},{key:"Ctrl-k",run:er},{key:"Ctrl-Alt-h",run:Tt},{key:"Ctrl-o",run:rr},{key:"Ctrl-t",run:or},{key:"Ctrl-v",run:ke}],pr=[{key:"ArrowLeft",run:st,shift:xt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:kn,shift:In,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Tn,shift:zn,preventDefault:!0},{key:"ArrowRight",run:ct,shift:St,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Cn,shift:Pn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wn,shift:_n,preventDefault:!0},{key:"ArrowUp",run:ft,shift:bt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Je,shift:Ke},{mac:"Ctrl-ArrowUp",run:Ge,shift:Ue},{key:"ArrowDown",run:dt,shift:Ct,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$e,shift:He},{mac:"Ctrl-ArrowDown",run:ke,shift:ze},{key:"PageUp",run:Ge,shift:Ue},{key:"PageDown",run:ke,shift:ze},{key:"Home",run:En,shift:Un,preventDefault:!0},{key:"Mod-Home",run:Je,shift:Ke},{key:"End",run:Bn,shift:Gn,preventDefault:!0},{key:"Mod-End",run:$e,shift:He},{key:"Enter",run:Qe,shift:Qe},{key:"Mod-a",run:Kn},{key:"Backspace",run:ve,shift:ve,preventDefault:!0},{key:"Delete",run:Dt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Tt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Zn,preventDefault:!0},{mac:"Mod-Backspace",run:tr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(mr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),Nt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:An,shift:Nn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ln,shift:Vn},{key:"Alt-ArrowUp",run:lr},{key:"Shift-Alt-ArrowUp",run:sr},{key:"Alt-ArrowDown",run:ir},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:jn},{key:"Mod-Alt-ArrowDown",run:Xn},{key:"Escape",run:Yn},{key:"Mod-Enter",run:hr},{key:"Alt-l",mac:"Ctrl-l",run:Hn},{key:"Mod-i",run:Qn,preventDefault:!0},{key:"Mod-[",run:Pt},{key:"Mod-]",run:ne},{key:"Mod-Alt-\\",run:fr},{key:"Shift-Mod-k",run:ar},{key:"Shift-Mod-\\",run:Fn},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dr}].concat(pr),qt={key:"Tab",run:ne,shift:Pt};var Vt=typeof String.prototype.normalize=="function"?(e)=>e.normalize("NFKD"):(e)=>e;class R{constructor(e,t,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?(c)=>o(Vt(c)):Vt,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return fi(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Dr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=hi(e);let r=this.normalize(t);if(r.length)for(let o=0,s=n,c=!0;;o++){let a=r.charCodeAt(o),u=this.match(a,s,c,this.bufferPos+this.bufferStart,o==r.length-1);if(u)return this.value=u,this;if(o==r.length-1)break;if(c&&o<t.length&&t.charCodeAt(o)==a)s++;else c=!1}}}match(e,t,n,r,o){let s=null;for(let c=0;c<this.matches.length;){let a=this.matches[c],u=!1;if(this.query.charCodeAt(a.index)==e)if(a.index==this.query.length-1)s={from:a.from,to:r,precise:o&&a.precise};else a.index++,u=!0;if(u)c++;else this.matches.splice(c,1)}if(this.query.charCodeAt(0)==e)if(this.query.length==1)s={from:t,to:r,precise:n&&o};else this.matches.push({from:t,index:1,precise:n});if(s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart))s=null;return s}}if(typeof Symbol<"u")R.prototype[Symbol.iterator]=function(){return this};var zt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Ee="gm"+(/x/.unicode==null?"":"u");class we{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=zt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new We(e,t,n,r,o);this.re=new RegExp(t,Ee+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.iter=e.iter();let s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=ce(e,r),this.getLine(this.curLineStart)}getLine(e){if(this.iter.next(e),this.iter.lineBreak)this.curLine="";else{if(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ce(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length)this.nextLine();if((n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}var Ae=new WeakMap;class V{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Ae.get(e);if(!r||r.from>=n||r.to<=t){let c=new V(t,e.sliceString(t,n));return Ae.set(e,c),c}if(r.from==t&&r.to==n)return r;let{text:o,from:s}=r;if(s>t)o=e.sliceString(t,s)+o,s=t;if(r.to<n)o+=e.sliceString(r.to,n);return Ae.set(e,new V(s,o)),new V(t,o.slice(t-s,n-s))}}class We{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=zt,this.matchPos=ce(e,r),this.re=new RegExp(t,Ee+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.flat=V.get(e,r,this.chunkEnd(r+5000))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e)this.re.lastIndex=e+1,t=this.re.exec(this.flat.text);if(t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this.matchPos=ce(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=V.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")we.prototype[Symbol.iterator]=We.prototype[Symbol.iterator]=function(){return this};function gr(e){try{return new RegExp(e,Ee),!0}catch(t){return!1}}function ce(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;while(t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344)t++;return t}var yr=(e)=>{let t=Fr(e,"cm-goto-line");if(t){let c=t.dom.querySelector("input[type=text]");if(c)c.select();return!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:o,result:s}=Br(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then((c)=>{let a=c&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(c.elements.line.value);if(!a){e.dispatch({effects:o});return}let u=n.doc.lineAt(n.selection.main.head),[,d,h,m,p]=a,D=m?+m.slice(1):0,M=h?+h:u.number;if(h&&p){let ye=M/100;if(d)ye=ye*(d=="-"?-1:1)+u.number/n.doc.lines;M=Math.round(n.doc.lines*ye)}else if(h&&d)M=M*(d=="-"?-1:1)+u.number;let qe=n.doc.line(Math.max(1,Math.min(n.doc.lines,M))),Ve=l.cursor(qe.from+Math.max(0,Math.min(D,qe.length)));e.dispatch({effects:[o,y.scrollIntoView(Ve.from,{y:"center"})],selection:Ve})}),!0},xr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_t=v.define({combine(e){return Ot(e,xr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jt(e){let t=[Cr,br];if(e)t.push(_t.of(e));return t}var Sr=E.mark({class:"cm-selectionMatch"}),kr=E.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Gt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=oe.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=oe.Word)}function vr(e,t,n,r){return e(t.sliceDoc(n,n+1))==oe.Word&&e(t.sliceDoc(r-1,r))==oe.Word}var br=Te.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){if(e.selectionSet||e.docChanged||e.viewportChanged)this.decorations=this.getDeco(e.view)}getDeco(e){let t=e.state.facet(_t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let o=r.main,s,c=null;if(o.empty){if(!t.highlightWordAroundCursor)return E.none;let u=n.wordAt(o.head);if(!u)return E.none;c=n.charCategorizer(o.head),s=n.sliceDoc(u.from,u.to)}else{let u=o.to-o.from;if(u<t.minSelectionLength||u>200)return E.none;if(t.wholeWords){if(s=n.sliceDoc(o.from,o.to),c=n.charCategorizer(o.head),!(Gt(c,n,o.from,o.to)&&vr(c,n,o.from,o.to)))return E.none}else if(s=n.sliceDoc(o.from,o.to),!s)return E.none}let a=[];for(let u of e.visibleRanges){let d=new R(n.doc,s,u.from,u.to);while(!d.next().done){let{from:h,to:m}=d.value;if(!c||Gt(c,n,h,m)){if(o.empty&&h<=o.from&&m>=o.to)a.push(kr.range(h,m));else if(h>=o.to||m<=o.from)a.push(Sr.range(h,m));if(a.length>t.maxMatches)return E.none}}}return E.set(a)}},{decorations:(e)=>e.decorations}),Cr=y.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Mr=({state:e,dispatch:t})=>{let{selection:n}=e,r=l.create(n.ranges.map((o)=>e.wordAt(o.head)||l.cursor(o.head)),n.mainIndex);if(r.eq(n))return!1;return t(e.update({selection:r})),!0};function Ar(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),s=o&&o.from==n.from&&o.to==n.to;for(let c=!1,a=new R(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(c)return null;a=new R(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),c=!0}else{if(c&&r.some((u)=>u.from==a.value.from))continue;if(s){let u=e.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}var Lr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((s)=>s.from===s.to))return Mr({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((s)=>e.sliceDoc(s.from,s.to)!=r))return!1;let o=Ar(e,r);if(!o)return!1;return t(e.update({selection:e.selection.addRange(l.range(o.from,o.to),!1),effects:y.scrollIntoView(o.to)})),!0},O=v.define({combine(e){return Ot(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>y.scrollIntoView(t)})}});function $t(e){return e?[O.of(e),De]:De}class Re{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||gr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
2
- `:n=="r"?"\r":n=="t"?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ht(this):new Kt(this)}getCursor(e,t=0,n){let r=e.doc?e:I.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?N(this,r,t,n):P(this,r,t,n)}}class Oe{constructor(e){this.spec=e}}function Er(e,t,n){return(r,o,s,c)=>{if(n&&!n(r,o,s,c))return!1;let a=r>=c&&o<=c+s.length?s.slice(r-c,o-c):t.doc.sliceString(r,o);return e(a,t,r,o)}}function P(e,t,n,r){let o;if(e.wholeWord)o=Tr(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Er(e.test,t,o);return new R(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(s)=>s.toLowerCase(),o)}function Tr(e,t){return(n,r,o,s)=>{if(s>n||s+o.length<r)s=Math.max(0,n-2),o=e.sliceString(s,Math.min(e.length,r+2));return(t(ae(o,n-s))!=oe.Word||t(ue(o,n-s))!=oe.Word)&&(t(ue(o,r-s))!=oe.Word||t(ae(o,r-s))!=oe.Word)}}class Kt extends Oe{constructor(e){super(e)}nextMatch(e,t,n){let r=P(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);r=P(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let o=Math.max(t,r-1e4-this.spec.unquoted.length),s=P(this.spec,e,o,r),c=null;while(!s.nextOverlapping().done)c=s.value;if(c)return c;if(o==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);if(!r)r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length);return r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=P(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=P(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}function wr(e,t,n){return(r,o,s)=>(!n||n(r,o,s))&&e(s[0],t,r,o)}function N(e,t,n,r){let o;if(e.wholeWord)o=Wr(t.charCategorizer(t.selection.main.head));if(e.test)o=wr(e.test,t,o);return new we(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ae(e,t){return e.slice(pe(e,t,!1),t)}function ue(e,t){return e.slice(t,pe(e,t))}function Wr(e){return(t,n,r)=>!r[0].length||(e(ae(r.input,r.index))!=oe.Word||e(ue(r.input,r.index))!=oe.Word)&&(e(ue(r.input,r.index+r[0].length))!=oe.Word||e(ae(r.input,r.index+r[0].length))!=oe.Word)}class Ht extends Oe{nextMatch(e,t,n){let r=N(this.spec,e,n,e.doc.length).next();if(r.done)r=N(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-r*1e4),s=N(this.spec,e,o,n),c=null;while(!s.next().done)c=s.value;if(c&&(o==t||c.from>o+10))return c;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return t})}matchAll(e,t){let n=N(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=N(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}var J=q.define(),Fe=q.define(),W=_e.define({create(e){return new ie(Be(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(J))e=new ie(n.value.create(),e.panel);else if(n.is(Fe))e=new ie(e.query,n.value?Ie:null);return e},provide:(e)=>Dn.from(e,(t)=>t.panel)});class ie{constructor(e,t){this.query=e,this.panel=t}}var Rr=E.mark({class:"cm-searchMatch"}),Or=E.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ir=Te.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(W))}update(e){let t=e.state.field(W);if(t!=e.startState.field(W)||e.docChanged||e.selectionSet||e.viewportChanged)this.decorations=this.highlight(t)}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new yt;for(let o=0,s=n.visibleRanges,c=s.length;o<c;o++){let{from:a,to:u}=s[o];while(o<c-1&&u>s[o+1].from-500)u=s[++o].to;e.highlight(n.state,a,u,(d,h)=>{let m=n.state.selection.ranges.some((p)=>p.from==d&&p.to==h);r.add(d,h,m?Or:Rr)})}return r.finish()}},{decorations:(e)=>e.decorations});function K(e){return(t)=>{let n=t.state.field(W,!1);return n&&n.query.spec.valid?e(t,n):de(t)}}var he=K((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=l.single(r.from,r.to),s=e.state.facet(O);return e.dispatch({selection:o,effects:[Pe(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),jt(e),!0}),fe=K((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let s=l.single(o.from,o.to),c=e.state.facet(O);return e.dispatch({selection:s,effects:[Pe(e,o),c.scrollToMatch(s.main,e)],userEvent:"select.search"}),jt(e),!0}),Pr=K((e,{query:t})=>{let n=t.matchAll(e.state,1000);if(!n||!n.length)return!1;return e.dispatch({selection:l.create(n.map((r)=>l.range(r.from,r.to))),userEvent:"select.search.matches"}),!0}),Nr=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,s=[],c=0;for(let a=new R(e.doc,e.sliceDoc(r,o));!a.next().done;){if(s.length>1000)return!1;if(a.value.from==r)c=s.length;s.push(l.range(a.value.from,a.value.to))}return t(e.update({selection:l.create(s,c),userEvent:"select.search.matches"})),!0},Ut=K((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let c=s,a=[],u,d,h=[];if(!c.precise)c=t.nextMatch(n,c.from,c.to);else if(c.from==r&&c.to==o)d=n.toText(t.getReplacement(c)),a.push({from:c.from,to:c.to,insert:d}),c=t.nextMatch(n,c.from,c.to),h.push(y.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."));let m=e.state.changes(a);if(c)u=l.single(c.from,c.to).map(m),h.push(Pe(e,c)),h.push(n.facet(O).scrollToMatch(u.main,e));return e.dispatch({changes:m,selection:u,effects:h,userEvent:"input.replace"}),!0}),zr=K((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let o of t.matchAll(e.state,1e9)){let{from:s,to:c,precise:a}=o;if(a)n.push({from:s,to:c,insert:t.getReplacement(o)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:y.announce.of(r),userEvent:"input.replace.all"}),!0});function Ie(e){return e.state.facet(O).createPanel(e)}function Be(e,t){var n,r,o,s,c;let a=e.selection.main,u=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!u)return t;let d=e.facet(O);return new Re({search:((n=t===null||t===void 0?void 0:t.literal)!==null&&n!==void 0?n:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=t===null||t===void 0?void 0:t.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(o=t===null||t===void 0?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(s=t===null||t===void 0?void 0:t.regexp)!==null&&s!==void 0?s:d.regexp,wholeWord:(c=t===null||t===void 0?void 0:t.wholeWord)!==null&&c!==void 0?c:d.wholeWord})}function Qt(e){let t=pi(e,Ie);return t&&t.dom.querySelector("[main-field]")}function jt(e){let t=Qt(e);if(t&&t==e.root.activeElement)t.select()}var de=(e)=>{let t=e.state.field(W,!1);if(t&&t.panel){let n=Qt(e);if(n&&n!=e.root.activeElement){let r=Be(e.state,t.query.spec);if(r.valid)e.dispatch({effects:J.of(r)});n.focus(),n.select()}}else e.dispatch({effects:[Fe.of(!0),t?J.of(Be(e.state,t.query.spec)):q.appendConfig.of(De)]});return!0},Xt=(e)=>{let t=e.state.field(W,!1);if(!t||!t.panel)return!1;let n=pi(e,Ie);if(n&&n.dom.contains(e.root.activeElement))e.focus();return e.dispatch({effects:Fe.of(!1)}),!0},Yt=[{key:"Mod-f",run:de,scope:"editor search-panel"},{key:"F3",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Xt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Nr},{key:"Mod-Alt-g",run:yr},{key:"Mod-d",run:Lr,preventDefault:!0}];class Zt{constructor(e){this.view=e;let t=this.query=e.state.field(W).query.spec;this.commit=this.commit.bind(this),this.searchField=ge("input",{value:t.search,placeholder:S(e,"Find"),"aria-label":S(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ge("input",{value:t.replace,placeholder:S(e,"Replace"),"aria-label":S(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ge("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ge("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ge("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,s){return ge("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=ge("div",{onkeydown:(r)=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>he(e),[S(e,"next")]),n("prev",()=>fe(e),[S(e,"previous")]),n("select",()=>Pr(e),[S(e,"all")]),ge("label",null,[this.caseField,S(e,"match case")]),ge("label",null,[this.reField,S(e,"regexp")]),ge("label",null,[this.wordField,S(e,"by word")]),...e.state.readOnly?[]:[ge("br"),this.replaceField,n("replace",()=>Ut(e),[S(e,"replace")]),n("replaceAll",()=>zr(e),[S(e,"replace all")])],ge("button",{name:"close",onclick:()=>Xt(e),"aria-label":S(e,"close"),type:"button"},["×"])])}commit(){let e=new Re({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query))this.query=e,this.view.dispatch({effects:J.of(e)})}keydown(e){if(Ur(this.view,e,"search-panel"))e.preventDefault();else if(e.keyCode==13&&e.target==this.searchField)e.preventDefault(),(e.shiftKey?fe:he)(this.view);else if(e.keyCode==13&&e.target==this.replaceField)e.preventDefault(),Ut(this.view)}update(e){for(let t of e.transactions)for(let n of t.effects)if(n.is(J)&&!n.value.eq(this.query))this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(O).top}}function S(e,t){return e.state.phrase(t)}var re=30,le=/[\s\.,:;?!]/;function Pe(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-re),c=Math.min(o,n+re),a=e.state.sliceDoc(s,c);if(s!=r.from){for(let u=0;u<re;u++)if(!le.test(a[u+1])&&le.test(a[u])){a=a.slice(u);break}}if(c!=o){for(let u=a.length-1;u>a.length-re;u--)if(!le.test(a[u-1])&&le.test(a[u])){a=a.slice(0,u);break}}return y.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}var _r=y.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),De=[W,Ne.low(Ir),_r];var Jr=y.theme({"&":{color:"var(--code-fg)",backgroundColor:"var(--code-bg)",height:"100%",fontSize:"var(--code-size, 13px)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--code-fg)",padding:"0.5rem 0"},".cm-line":{padding:"0 0.75rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--code-fg)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--code-selection)"},".cm-activeLine":{backgroundColor:"var(--code-active-line)"},".cm-gutters":{backgroundColor:"var(--code-gutter-bg)",color:"var(--code-gutter)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--code-active-line)",color:"var(--code-fg)"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 0.5rem",minWidth:"2.25rem"},".cm-matchingBracket, .cm-nonmatchingBracket":{backgroundColor:"var(--code-selection)",outline:"1px solid var(--border-strong)"},".cm-searchMatch":{backgroundColor:"var(--warn-soft)",outline:"1px solid var(--warn)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)",outline:"1px solid var(--accent)"},".cm-panels":{backgroundColor:"var(--surface-2)",color:"var(--text)",borderColor:"var(--border)",fontFamily:"var(--font)"},".cm-panels-top":{borderBottom:"1px solid var(--border)"},".cm-panel.cm-search":{padding:"0.5rem 2rem 0.5rem 0.5rem"},".cm-panel.cm-search input, .cm-panel.cm-search button, .cm-panel.cm-search label":{fontSize:"0.875rem"},".cm-panel.cm-search input[type=text]":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--control-border)",borderRadius:"var(--radius-sm)",padding:"0.25rem 0.5rem"},".cm-panel.cm-search button":{backgroundColor:"var(--surface-3)",color:"var(--text)",border:"1px solid var(--border-strong)",borderRadius:"var(--radius-sm)",backgroundImage:"none",padding:"0.25rem 0.625rem"},".cm-panel.cm-search [name=close]":{color:"var(--muted)"}}),$r=vn.define([{tag:[i.keyword,i.modifier,i.operatorKeyword,i.controlKeyword],color:"var(--code-keyword)"},{tag:[i.string,i.regexp,i.special(i.string),i.inserted],color:"var(--code-string)"},{tag:[i.number,i.bool,i.null,i.atom,i.literal],color:"var(--code-number)"},{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:"var(--code-comment)",fontStyle:"italic"},{tag:[i.typeName,i.className,i.namespace,i.tagName,i.standard(i.tagName)],color:"var(--code-type)"},{tag:[i.function(i.variableName),i.function(i.propertyName),i.definition(i.variableName),i.labelName],color:"var(--code-function)"},{tag:[i.meta,i.processingInstruction,i.annotation,i.attributeName,i.propertyName,i.heading],color:"var(--code-meta)"},{tag:i.heading,fontWeight:"bold"},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:i.link,color:"var(--code-function)",textDecoration:"underline"},{tag:i.url,color:"var(--code-function)"},{tag:i.invalid,color:"var(--danger)"},{tag:i.deleted,color:"var(--danger)"}]),en=[Jr,Hr($r)];var Kr={typescript:()=>(f("4k1d8z7s"),import("./chunk-lang-typescript-4k1d8z7s.js")),javascript:()=>(f("d32qrvxz"),import("./chunk-lang-javascript-d32qrvxz.js")),json:()=>(f("1q4fp694"),import("./chunk-lang-json-1q4fp694.js")),markdown:()=>(f("5w7t28wa"),import("./chunk-lang-markdown-5w7t28wa.js")),css:()=>(f("fa7c0zfj"),import("./chunk-lang-css-fa7c0zfj.js")),html:()=>(f("47mf2y0v"),import("./chunk-lang-html-47mf2y0v.js")),python:()=>(f("3dq0p4rf"),import("./chunk-lang-python-3dq0p4rf.js")),yaml:()=>(f("2by9g1dy"),import("./chunk-lang-yaml-2by9g1dy.js")),go:()=>(f("qb0qdpg7"),import("./chunk-lang-go-qb0qdpg7.js")),rust:()=>(f("70pa0agr"),import("./chunk-lang-rust-70pa0agr.js")),sql:()=>(f("kgcbh2a9"),import("./chunk-lang-sql-kgcbh2a9.js")),xml:()=>(f("mnbv9yfa"),import("./chunk-lang-xml-mnbv9yfa.js")),shell:()=>(f("4pxt7hf4"),import("./chunk-lang-shell-4pxt7hf4.js")),toml:()=>(f("99t95pab"),import("./chunk-lang-toml-99t95pab.js")),dockerfile:()=>(f("46rk929v"),import("./chunk-lang-dockerfile-46rk929v.js"))};async function tn(e){if(e==="plain")return;try{return(await Kr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function Qr(e){if(typeof e.attachShadow!=="function"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in Document.prototype))return{parent:e,root:void 0};let t=e.shadowRoot??e.attachShadow({mode:"open"}),n=new CSSStyleSheet;return n.replaceSync(":host{display:flex;flex-direction:column;min-height:0}.cm-editor{flex:1;min-height:0}"),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],{parent:t,root:t}}async function vo(e){let t=new Lt,n=new Lt,r=new Lt,o=await tn(e.language),s=(m)=>[I.readOnly.of(!m),y.editable.of(m)],c={editable:e.editable,wrap:e.wrap,language:o??[]},a,u=(m)=>[Gr(),qr(),Zr(),tt(),Vr(),jr(),Jt(),$t({top:!0}),je.of(" "),I.phrases.of(e.phrases),en,wt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},qt,...Yt,...ot,...Nt]),I.lineSeparator.of(m),t.of(s(c.editable)),n.of(c.wrap?y.lineWrapping:[]),r.of(c.language),y.updateListener.of((p)=>{if(p.docChanged)e.onChange()})],d=Qr(e.parent),h=new y({parent:d.parent,root:d.root,state:I.create({doc:e.text,extensions:u(e.eol)})});return a=h.state.doc,{text:()=>h.state.doc.sliceString(0,void 0,h.state.lineBreak),dirty:()=>a===void 0||!h.state.doc.eq(a),snapshot:()=>h.state.doc,markSaved:(m)=>{a=m??h.state.doc},replace:(m,p)=>{let D=h.scrollDOM.scrollTop;h.setState(I.create({doc:m,extensions:u(p)})),a=h.state.doc,h.scrollDOM.scrollTop=D},setEditable:(m)=>{c.editable=m,h.dispatch({effects:t.reconfigure(s(m))})},setWrap:(m)=>{c.wrap=m,h.dispatch({effects:n.reconfigure(m?y.lineWrapping:[])})},setLanguage:async(m)=>{c.language=await tn(m)??[],h.dispatch({effects:r.reconfigure(c.language)})},undo:()=>{X(h)},redo:()=>{z(h)},find:()=>{de(h)},tab:()=>{ne(h)},focus:()=>h.focus(),scrollTop:()=>h.scrollDOM.scrollTop,scrollTo:(m)=>{h.scrollDOM.scrollTop=m},destroy:()=>h.destroy()}}export{vo as createEditor};
1
+ import{V,pe,bi,Hr,vi,ut,me,l,x,ke,Le,zt,Xe,B,oe,se,D,bt,vt,ze,ge,E,ee,Te,b,Tt,jr,Kr,Jr,xi,Vn,eo,to,no,io,T,i,C,je,Ut,Fn,Ki,xn,Sn,so,ao,ft}from"./chunk-index-6c8mewwy.js";import{h}from"./chunk-index-kankja6p.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Me(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function Ce(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=e(t,n);if(!o)return!1;return r(n.update(o)),!0}}var rn=Ce(an,0);var on=Ce(Ye,0);var ln=Ce((e,t)=>Ye(e,t,cn(t)),0);function Me(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var U=50;function sn(e,{open:t,close:n},r,o){let s=e.sliceDoc(r-U,r),c=e.sliceDoc(o,o+U),a=/\s*$/.exec(s)[0].length,u=/^\s*/.exec(c)[0].length,d=s.length-a;if(s.slice(d-t.length,d)==t&&c.slice(u,u+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:o+u,margin:u&&1}};let f,m;if(o-r<=2*U)f=m=e.sliceDoc(r,o);else f=e.sliceDoc(r,r+U),m=e.sliceDoc(o-U,o);let p=/^\s*/.exec(f)[0].length,W=/\s*$/.exec(m)[0].length,M=m.length-W-n.length;if(f.slice(p,p+t.length)==t&&m.slice(M,M+n.length)==n)return{open:{pos:r+p+t.length,margin:/\s/.test(f.charAt(p+t.length))?1:0},close:{pos:o-W-n.length,margin:/\s/.test(m.charAt(M-1))?1:0}};return null}function cn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),o=n.to<=r.to?r:e.doc.lineAt(n.to);if(o.from>r.from&&o.from==n.to)o=n.to==r.to+1?r:e.doc.lineAt(n.to-1);let s=t.length-1;if(s>=0&&t[s].to>r.from)t[s].to=o.to;else t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function Ye(e,t,n=t.selection.ranges){let r=n.map((s)=>Me(t,s.from).block);if(!r.every((s)=>s))return null;let o=n.map((s,c)=>sn(t,r[c],s.from,s.to));if(e!=2&&!o.every((s)=>s))return{changes:t.changes(n.map((s,c)=>{if(o[c])return[];return[{from:s.from,insert:r[c].open+" "},{from:s.to,insert:" "+r[c].close}]}))};else if(e!=1&&o.some((s)=>s)){let s=[];for(let c=0,a;c<o.length;c++)if(a=o[c]){let u=r[c],{open:d,close:f}=a;s.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:f.pos-f.margin,to:f.pos+u.close.length})}return{changes:s}}return null}function an(e,t,n=t.selection.ranges){let r=[],o=-1;e:for(let{from:s,to:c}of n){let a=r.length,u=1e9,d;for(let f=s;f<=c;){let m=t.doc.lineAt(f);if(d==null){if(d=Me(t,m.from).line,!d)continue e}if(m.from>o&&(s==c||c>m.from)){o=m.from;let p=/^\s*/.exec(m.text)[0].length,W=p==m.length,M=m.text.slice(p,p+d.length)==d?p:-1;if(p<m.text.length&&p<u)u=p;r.push({line:m,comment:M,token:d,indent:p,empty:W,single:!1})}f=m.to+1}if(u<1e9){for(let f=a;f<r.length;f++)if(r[f].indent<r[f].line.text.length)r[f].indent=u}if(r.length==a+1)r[a].single=!0}if(e!=2&&r.some((s)=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:u,indent:d,empty:f,single:m}of r)if(m||!f)s.push({from:a.from+d,insert:u+" "});let c=t.changes(s);return{changes:c,selection:t.selection.map(c,1)}}else if(e!=1&&r.some((s)=>s.comment>=0)){let s=[];for(let{line:c,comment:a,token:u}of r)if(a>=0){let d=c.from+a,f=d+u.length;if(c.text[f-c.from]==" ")f++;s.push({from:d,to:f})}return{changes:s}}return null}var Se=Xe.define(),un=Xe.define(),hn=x.define(),Ze=x.define({combine(e){return bt(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,o)=>t(r,o)||n(r,o)})}}),et=ke.define({create(){return w.empty},update(e,t){let n=t.state.facet(Ze),r=t.annotation(Se);if(r){let u=y.fromTransaction(t,r.selection),d=r.side,f=d==0?e.undone:e.done;if(u)f=Q(f,f.length,n.minDepth,u);else f=rt(f,t.startState.selection);return new w(d==0?r.rest:f,d==0?f:r.rest)}let o=t.annotation(un);if(o=="full"||o=="before")e=e.isolate();if(t.annotation(oe.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let s=y.fromTransaction(t),c=t.annotation(oe.time),a=t.annotation(oe.userEvent);if(s)e=e.addChanges(s,c,a,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,c,a,n.newGroupDelay);if(o=="full"||o=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new w(e.done.map(y.fromJSON),e.undone.map(y.fromJSON))}});function tt(e={}){return[et,Ze.of(e),b.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?X:t.inputType=="historyRedo"?z:null;if(!r)return!1;return t.preventDefault(),r(n)}})]}function j(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let o=n.field(et,!1);if(!o)return!1;let s=o.pop(e,n,t);if(!s)return!1;return r(s),!0}}var X=j(0,!1),z=j(1,!1),fn=j(0,!0),dn=j(1,!0);class y{constructor(e,t,n,r,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new y(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((r)=>r.toJSON())}}static fromJSON(e){return new y(e.changes&&me.fromJSON(e.changes),[],e.mapped&&ut.fromJSON(e.mapped),e.startSelection&&l.fromJSON(e.startSelection),e.selectionsAfter.map(l.fromJSON))}static fromTransaction(e,t){let n=k;for(let r of e.startState.facet(hn)){let o=r(e);if(o.length)n=n.concat(o)}if(!n.length&&e.changes.empty)return null;return new y(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,k)}static selection(e){return new y(void 0,k,void 0,void 0,e)}}function Q(e,t,n,r){let o=t+1>n+20?t-n-1:0,s=e.slice(o,t);return s.push(r),s}function mn(e,t){let n=[],r=!1;return e.iterChangedRanges((o,s)=>n.push(o,s)),t.iterChangedRanges((o,s,c,a)=>{for(let u=0;u<n.length;){let d=n[u++],f=n[u++];if(a>=d&&c<=f)r=!0}}),r}function pn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function nt(e,t){return!e.length?t:!t.length?e:e.concat(t)}var k=[],gn=200;function rt(e,t){if(!e.length)return[y.selection([t])];else{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-gn));if(r.length&&r[r.length-1].eq(t))return e;return r.push(t),Q(e,e.length-1,1e9,n.setSelAfter(r))}}function yn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function xe(e,t){if(!e.length)return e;let n=e.length,r=k;while(n){let o=kn(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let s=e.slice(0,n);return s[n-1]=o,s}else t=o.mapped,n--,r=o.selectionsAfter}return r.length?[y.selection(r)]:k}function kn(e,t,n){let r=nt(e.selectionsAfter.length?e.selectionsAfter.map((a)=>a.map(t)):k,n);if(!e.changes)return y.selection(r);let o=e.changes.map(t),s=t.mapDesc(e.changes,!0),c=e.mapped?e.mapped.composeDesc(s):s;return new y(o,B.mapEffects(e.effects,t),c,e.startSelection.map(s),r)}var vn=/^(input\.type|delete)($|\.)/;class w{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new w(this.done,this.undone):this}addChanges(e,t,n,r,o){let s=this.done,c=s[s.length-1];if(c&&c.changes&&!c.changes.empty&&e.changes&&(!n||vn.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,mn(c.changes,e.changes))||n=="input.type.compose"))s=Q(s,s.length-1,r.minDepth,new y(e.changes.compose(c.changes),nt(B.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,k));else s=Q(s,s.length,r.minDepth,e);return new w(s,k,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:k;if(o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&pn(o[o.length-1],e))return this;return new w(rt(this.done,e),this.undone,t,n)}addMapping(e){return new w(xe(this.done,e),xe(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],s=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Se.of({side:e,rest:yn(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!o.changes)return null;else{let c=r.length==1?k:r.slice(0,r.length-1);if(o.mapped)c=xe(c,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Se.of({side:e,rest:c,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}w.empty=new w(k,k);var ot=[{key:"Mod-z",run:X,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:z,preventDefault:!0},{linux:"Ctrl-Shift-z",run:z,preventDefault:!0},{key:"Mod-u",run:fn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:dn,preventDefault:!0}];function P(e,t){return l.create(e.ranges.map(t),e.mainIndex)}function A(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function L({state:e,dispatch:t},n){let r=P(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(A(e,r)),!0}function Y(e,t){return l.cursor(t?e.to:e.from)}function lt(e,t){return L(e,(n)=>n.empty?e.moveByChar(n,t):Y(n,t))}function g(e){return e.textDirectionAt(e.state.selection.main.head)==ee.LTR}var it=(e)=>lt(e,!g(e)),st=(e)=>lt(e,g(e));function ct(e,t){return L(e,(n)=>n.empty?e.moveByGroup(n,t):Y(n,t))}var bn=(e)=>ct(e,!g(e)),Cn=(e)=>ct(e,g(e));var Qr=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Mn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Z(e,t,n){let r=C(e).resolveInner(t.head),o=n?T.closedBy:T.openedBy;for(let u=t.head;;){let d=n?r.childAfter(u):r.childBefore(u);if(!d)break;if(Mn(e,d,o))r=d;else u=n?d.to:d.from}let s=r.type.prop(o),c,a;if(s&&(c=n?ft(e,r.from,1):ft(e,r.to,-1))&&c.matched)a=n?c.end.to:c.end.from;else a=n?r.to:r.from;return l.cursor(a,n?-1:1)}var An=(e)=>L(e,(t)=>Z(e.state,t,!g(e))),Ln=(e)=>L(e,(t)=>Z(e.state,t,g(e)));function at(e,t){return L(e,(n)=>{if(!n.empty)return Y(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}var ht=(e)=>at(e,!1),dt=(e)=>at(e,!0);function mt(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,o;if(t){for(let s of e.state.facet(b.scrollMargins)){let c=s(e);if(c===null||c===void 0?void 0:c.top)n=Math.max(c===null||c===void 0?void 0:c.top,n);if(c===null||c===void 0?void 0:c.bottom)r=Math.max(c===null||c===void 0?void 0:c.bottom,r)}o=e.scrollDOM.clientHeight-n-r}else o=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,o-5)}}function pt(e,t){let n=mt(e),{state:r}=e,o=P(r.selection,(c)=>c.empty?e.moveVertically(c,t,n.height):Y(c,t));if(o.eq(r.selection))return!1;let s;if(n.selfScroll){let c=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),u=a.top+n.marginTop,d=a.bottom-n.marginBottom;if(c&&c.top>u&&c.bottom<d)s=b.scrollIntoView(o.main.head,{y:"start",yMargin:c.top-u})}return e.dispatch(A(r,o),{effects:s}),!0}var Ge=(e)=>pt(e,!1),ve=(e)=>pt(e,!0);function R(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from))o=e.moveToLineBoundary(t,n,!1);if(!n&&o.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;if(s&&t.head!=r.from+s)o=l.cursor(r.from+s)}return o}var Bn=(e)=>L(e,(t)=>R(e,t,!0)),Dn=(e)=>L(e,(t)=>R(e,t,!1)),En=(e)=>L(e,(t)=>R(e,t,!g(e))),Tn=(e)=>L(e,(t)=>R(e,t,g(e))),wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!1,!1)),Wn=(e)=>L(e,(t)=>e.moveToLineBoundary(t,!0,!1));function Rn(e,t,n){let r=!1,o=P(e.selection,(s)=>{let c=ft(e,s.head,-1)||ft(e,s.head,1)||s.head>0&&ft(e,s.head-1,1)||s.head<e.doc.length&&ft(e,s.head+1,-1);if(!c||!c.end)return s;r=!0;let a=c.start.from==s.head?c.end.to:c.end.from;return n?l.range(s.anchor,a):l.cursor(a)});if(!r)return!1;return t(A(e,o)),!0}var On=({state:e,dispatch:t})=>Rn(e,t,!1);function v(e,t,n){let r=P(e.state.selection,(o)=>{if(o.undirectional&&o.head>=o.anchor!=t)o=l.range(o.head,o.anchor);let s=n(o);return l.range(o.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});if(r.eq(e.state.selection))return!1;return e.dispatch(A(e.state,r)),!0}function gt(e,t){return v(e,t,(n)=>e.moveByChar(n,t))}var yt=(e)=>gt(e,!g(e)),xt=(e)=>gt(e,g(e));function St(e,t){return v(e,t,(n)=>e.moveByGroup(n,t))}var In=(e)=>St(e,!g(e)),Pn=(e)=>St(e,g(e));var Nn=(e)=>{let t=!g(e);return v(e,t,(n)=>Z(e.state,n,t))},qn=(e)=>{let t=g(e);return v(e,t,(n)=>Z(e.state,n,t))};function kt(e,t){return v(e,t,(n)=>e.moveVertically(n,t))}var Ct=(e)=>kt(e,!1),Mt=(e)=>kt(e,!0);function At(e,t){return v(e,t,(n)=>e.moveVertically(n,t,mt(e).height))}var Ue=(e)=>At(e,!1),_e=(e)=>At(e,!0),Gn=(e)=>v(e,!0,(t)=>R(e,t,!0)),Un=(e)=>v(e,!1,(t)=>R(e,t,!1)),zn=(e)=>{let t=!g(e);return v(e,t,(n)=>R(e,n,t))},_n=(e)=>{let t=g(e);return v(e,t,(n)=>R(e,n,t))},Jn=(e)=>v(e,!1,(t)=>l.cursor(e.lineBlockAt(t.head).from)),$n=(e)=>v(e,!0,(t)=>l.cursor(e.lineBlockAt(t.head).to)),Je=({state:e,dispatch:t})=>(t(A(e,{anchor:0})),!0),$e=({state:e,dispatch:t})=>(t(A(e,{anchor:e.doc.length})),!0),Ke=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:0})),!0),He=({state:e,dispatch:t})=>(t(A(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Kn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Hn=({state:e,dispatch:t})=>{let n=te(e).map(({from:r,to:o})=>l.undirectionalRange(r,Math.min(o+1,e.doc.length)));return t(e.update({selection:l.create(n),userEvent:"select"})),!0},Qn=({state:e,dispatch:t})=>{let n=P(e.selection,(r)=>{let o=C(e),s=o.resolveStack(r.from,1);if(r.empty){let c=o.resolveStack(r.from,-1);if(c.node.from>=s.node.from&&c.node.to<=s.node.to)s=c}for(let c=s;c;c=c.next){let{node:a}=c;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&c.next)return l.undirectionalRange(a.from,a.to)}return r});if(n.eq(e.selection))return!1;return t(A(e,n)),!0};function Lt(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let s of n.selection.ranges){let c=n.doc.lineAt(s.head);if(t?c.to<e.state.doc.length:c.from>0)for(let a=s;;){let u=e.moveVertically(a,t);if(u.head<c.from||u.head>c.to){if(!o.some((d)=>d.head==u.head))o.push(u);break}else if(u.head==a.head)break;else a=u}}if(o.length==r.ranges.length)return!1;return e.dispatch(A(n,l.create(o,o.length-1))),!0}var jn=(e)=>Lt(e,!1),Xn=(e)=>Lt(e,!0),Yn=({state:e,dispatch:t})=>{let n=e.selection,r=null;if(n.ranges.length>1)r=l.create([n.main]);else if(!n.main.empty)r=l.create([l.cursor(n.main.head)]);if(!r)return!1;return t(A(e,r)),!0};function _(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s)=>{let{from:c,to:a}=s;if(c==a){let u=t(s);if(u<c)n="delete.backward",u=H(e,u,!1);else if(u>c)n="delete.forward",u=H(e,u,!0);c=Math.min(c,u),a=Math.max(a,u)}else c=H(e,c,!1),a=H(e,a,!0);return c==a?{range:s}:{changes:{from:c,to:a},range:l.cursor(c,c<s.head?-1:1)}});if(o.changes.empty)return!1;return e.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?b.announce.of(r.phrase("Selection deleted")):void 0})),!0}function H(e,t,n){if(e instanceof b)for(let r of e.state.facet(b.atomicRanges).map((o)=>o(e)))r.between(t,t,(o,s)=>{if(o<t&&s>t)t=n?s:o});return t}var Bt=(e,t,n)=>_(e,(r)=>{let o=r.from,{state:s}=e,c=s.doc.lineAt(o),a,u;if(n&&!t&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(a=c.text.slice(0,o-c.from))){if(a[a.length-1]=="\t")return o-1;let d=ze(a,s.tabSize),f=d%Ut(s)||Ut(s);for(let m=0;m<f&&a[a.length-1-m]==" ";m++)o--;u=o}else if(u=pe(c.text,o-c.from,t,t)+c.from,u==o&&c.number!=(t?s.doc.lines:1))u+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from)))u=pe(c.text,u-c.from,!1,!1)+c.from;return u}),be=(e)=>Bt(e,!1,!0);var Dt=(e)=>Bt(e,!0,!1),Et=(e,t)=>_(e,(n)=>{let r=n.head,{state:o}=e,s=o.doc.lineAt(r),c=o.charCategorizer(r);for(let a=null;;){if(r==(t?s.to:s.from)){if(r==n.head&&s.number!=(t?o.doc.lines:1))r+=t?1:-1;break}let u=pe(s.text,r-s.from,t)+s.from,d=s.text.slice(Math.min(r,u)-s.from,Math.max(r,u)-s.from),f=c(d);if(a!=null&&f!=a)break;if(d!=" "||r!=n.head)a=f;r=u}return r}),wt=(e)=>Et(e,!1),Zn=(e)=>Et(e,!0);var er=(e)=>_(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var tr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nr=(e)=>_(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var rr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>({changes:{from:r.from,to:r.to,insert:V.of(["",""])},range:l.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},or=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((r)=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let o=r.from,s=e.doc.lineAt(o),c=o==s.from?o-1:pe(s.text,o-s.from,!1)+s.from,a=o==s.to?o+1:pe(s.text,o-s.from,!0)+s.from;return{changes:{from:c,to:a,insert:e.doc.slice(o,a).append(e.doc.slice(c,o))},range:l.cursor(a)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function te(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from)s=e.doc.lineAt(r.to-1);if(n>=o.number){let c=t[t.length-1];c.to=s.to,c.ranges.push(r)}else t.push({from:o.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Wt(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let s of te(e)){if(n?s.to==e.doc.length:s.from==0)continue;let c=e.doc.lineAt(n?s.to+1:s.from-1),a=c.length+1;if(n){r.push({from:s.to,to:c.to},{from:s.from,insert:c.text+e.lineBreak});for(let u of s.ranges)o.push(l.range(Math.min(e.doc.length,u.anchor+a),Math.min(e.doc.length,u.head+a)))}else{r.push({from:c.from,to:s.from},{from:s.to,insert:e.lineBreak+c.text});for(let u of s.ranges)o.push(l.range(u.anchor-a,u.head-a))}}if(!r.length)return!1;return t(e.update({changes:r,scrollIntoView:!0,selection:l.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0}var lr=({state:e,dispatch:t})=>Wt(e,t,!1),ir=({state:e,dispatch:t})=>Wt(e,t,!0);function Rt(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of te(e))if(n)r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak});else r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let o=e.changes(r);return t(e.update({changes:o,selection:e.selection.map(o,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var sr=({state:e,dispatch:t})=>Rt(e,t,!1),cr=({state:e,dispatch:t})=>Rt(e,t,!0),ar=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(te(t).map(({from:o,to:s})=>{if(o>0)o--;else if(s<t.doc.length)s++;return{from:o,to:s}})),r=P(t.selection,(o)=>{let s=void 0;if(e.lineWrapping){let c=e.lineBlockAt(o.head),a=e.coordsAtPos(o.head,o.assoc||1);if(a)s=c.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2}return e.moveVertically(o,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ur(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=C(e).resolveInner(t),r=n.childBefore(t),o=n.childAfter(t),s;if(r&&o&&r.to<=t&&o.from>=t&&(s=r.type.prop(T.closedBy))&&s.indexOf(o.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(o.from).from&&!/\S/.test(e.sliceDoc(r.to,o.from)))return{from:r.to,to:o.from};return null}var Qe=Ot(!1),hr=Ot(!0);function Ot(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange((o)=>{let{from:s,to:c}=o,a=t.doc.lineAt(s),u=!e&&s==c&&ur(t,s);if(e)s=c=(c<=a.to?a:t.doc.lineAt(c)).to;let d=new xn(t,{simulateBreak:s,simulateDoubleBreak:!!u}),f=Ki(d,s);if(f==null)f=ze(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize);while(c<a.to&&/\s/.test(a.text[c-a.from]))c++;if(u)({from:s,to:c}=u);else if(s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s)))s=a.from;let m=["",Fn(t,f)];if(u)m.push(Fn(t,d.lineIndent(a.from,-1)));return{changes:{from:s,to:c,insert:V.of(m)},range:l.cursor(s+1+m[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ae(e,t){let n=-1;return e.changeByRange((r)=>{let o=[];for(let c=r.from;c<=r.to;){let a=e.doc.lineAt(c);if(a.number>n&&(r.empty||r.to>a.from))t(a,o,r),n=a.number;c=a.to+1}let s=e.changes(o);return{changes:o,range:l.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var fr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new xn(e,{overrideIndentation:(s)=>{let c=n[s];return c==null?-1:c}}),o=Ae(e,(s,c,a)=>{let u=Ki(r,s.from);if(u==null)return;if(!/\S/.test(s.text))u=0;let d=/^\s*/.exec(s.text)[0],f=Fn(e,u);if(d!=f||a.from<s.from+d.length)n[s.from]=u,c.push({from:s.from,to:s.from+d.length,insert:f})});if(!o.changes.empty)t(e.update(o,{userEvent:"indent"}));return!0},ne=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Ae(e,(n,r)=>{r.push({from:n.from,insert:e.facet(je)})}),{userEvent:"input.indent"})),!0},Ft=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Ae(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let s=ze(o,e.tabSize),c=0,a=Fn(e,Math.max(0,s-Ut(e)));while(c<o.length&&c<a.length&&o.charCodeAt(c)==a.charCodeAt(c))c++;r.push({from:n.from+c,to:n.from+o.length,insert:a.slice(c)})}),{userEvent:"delete.dedent"})),!0},dr=(e)=>(e.setTabFocusMode(),!0);var mr=[{key:"Ctrl-b",run:it,shift:yt,preventDefault:!0},{key:"Ctrl-f",run:st,shift:xt},{key:"Ctrl-p",run:ht,shift:Ct},{key:"Ctrl-n",run:dt,shift:Mt},{key:"Ctrl-a",run:wn,shift:Jn},{key:"Ctrl-e",run:Wn,shift:$n},{key:"Ctrl-d",run:Dt},{key:"Ctrl-h",run:be},{key:"Ctrl-k",run:er},{key:"Ctrl-Alt-h",run:wt},{key:"Ctrl-o",run:rr},{key:"Ctrl-t",run:or},{key:"Ctrl-v",run:ve}],pr=[{key:"ArrowLeft",run:it,shift:yt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bn,shift:In,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:En,shift:zn,preventDefault:!0},{key:"ArrowRight",run:st,shift:xt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Cn,shift:Pn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Tn,shift:_n,preventDefault:!0},{key:"ArrowUp",run:ht,shift:Ct,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Je,shift:Ke},{mac:"Ctrl-ArrowUp",run:Ge,shift:Ue},{key:"ArrowDown",run:dt,shift:Mt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$e,shift:He},{mac:"Ctrl-ArrowDown",run:ve,shift:_e},{key:"PageUp",run:Ge,shift:Ue},{key:"PageDown",run:ve,shift:_e},{key:"Home",run:Dn,shift:Un,preventDefault:!0},{key:"Mod-Home",run:Je,shift:Ke},{key:"End",run:Bn,shift:Gn,preventDefault:!0},{key:"Mod-End",run:$e,shift:He},{key:"Enter",run:Qe,shift:Qe},{key:"Mod-a",run:Kn},{key:"Backspace",run:be,shift:be,preventDefault:!0},{key:"Delete",run:Dt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:wt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Zn,preventDefault:!0},{mac:"Mod-Backspace",run:tr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(mr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),It=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:An,shift:Nn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ln,shift:qn},{key:"Alt-ArrowUp",run:lr},{key:"Shift-Alt-ArrowUp",run:sr},{key:"Alt-ArrowDown",run:ir},{key:"Shift-Alt-ArrowDown",run:cr},{key:"Mod-Alt-ArrowUp",run:jn},{key:"Mod-Alt-ArrowDown",run:Xn},{key:"Escape",run:Yn},{key:"Mod-Enter",run:hr},{key:"Alt-l",mac:"Ctrl-l",run:Hn},{key:"Mod-i",run:Qn,preventDefault:!0},{key:"Mod-[",run:Ft},{key:"Mod-]",run:ne},{key:"Mod-Alt-\\",run:fr},{key:"Shift-Mod-k",run:ar},{key:"Shift-Mod-\\",run:On},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dr}].concat(pr),Pt={key:"Tab",run:ne,shift:Ft};var Nt=typeof String.prototype.normalize=="function"?(e)=>e.normalize("NFKD"):(e)=>e;class F{constructor(e,t,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?(c)=>o(Nt(c)):Nt,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return bi(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Hr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=vi(e);let r=this.normalize(t);if(r.length)for(let o=0,s=n,c=!0;;o++){let a=r.charCodeAt(o),u=this.match(a,s,c,this.bufferPos+this.bufferStart,o==r.length-1);if(u)return this.value=u,this;if(o==r.length-1)break;if(c&&o<t.length&&t.charCodeAt(o)==a)s++;else c=!1}}}match(e,t,n,r,o){let s=null;for(let c=0;c<this.matches.length;){let a=this.matches[c],u=!1;if(this.query.charCodeAt(a.index)==e)if(a.index==this.query.length-1)s={from:a.from,to:r,precise:o&&a.precise};else a.index++,u=!0;if(u)c++;else this.matches.splice(c,1)}if(this.query.charCodeAt(0)==e)if(this.query.length==1)s={from:t,to:r,precise:n&&o};else this.matches.push({from:t,index:1,precise:n});if(s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart))s=null;return s}}if(typeof Symbol<"u")F.prototype[Symbol.iterator]=function(){return this};var Gt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},we="gm"+(/x/.unicode==null?"":"u");class We{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=Gt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Re(e,t,n,r,o);this.re=new RegExp(t,we+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.iter=e.iter();let s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=ce(e,r),this.getLine(this.curLineStart)}getLine(e){if(this.iter.next(e),this.iter.lineBreak)this.curLine="";else{if(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){if(this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=ce(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length)this.nextLine();if((n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}var Be=new WeakMap;class G{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Be.get(e);if(!r||r.from>=n||r.to<=t){let c=new G(t,e.sliceString(t,n));return Be.set(e,c),c}if(r.from==t&&r.to==n)return r;let{text:o,from:s}=r;if(s>t)o=e.sliceString(t,s)+o,s=t;if(r.to<n)o+=e.sliceString(r.to,n);return Be.set(e,new G(s,o)),new G(t,o.slice(t-s,n-s))}}class Re{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=Gt,this.matchPos=ce(e,r),this.re=new RegExp(t,we+((n===null||n===void 0?void 0:n.ignoreCase)?"i":"")),this.test=n===null||n===void 0?void 0:n.test,this.flat=G.get(e,r,this.chunkEnd(r+5000))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e)this.re.lastIndex=e+1,t=this.re.exec(this.flat.text);if(t){let n=this.flat.from+t.index,r=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this.matchPos=ce(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=G.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol<"u")We.prototype[Symbol.iterator]=Re.prototype[Symbol.iterator]=function(){return this};function gr(e){try{return new RegExp(e,we),!0}catch(t){return!1}}function ce(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;while(t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344)t++;return t}var yr=(e)=>{let t=to(e,"cm-goto-line");if(t){let c=t.dom.querySelector("input[type=text]");if(c)c.select();return!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:o,result:s}=eo(e,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then((c)=>{let a=c&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(c.elements.line.value);if(!a){e.dispatch({effects:o});return}let u=n.doc.lineAt(n.selection.main.head),[,d,f,m,p]=a,W=m?+m.slice(1):0,M=f?+f:u.number;if(f&&p){let ye=M/100;if(d)ye=ye*(d=="-"?-1:1)+u.number/n.doc.lines;M=Math.round(n.doc.lines*ye)}else if(f&&d)M=M*(d=="-"?-1:1)+u.number;let qe=n.doc.line(Math.max(1,Math.min(n.doc.lines,M))),Ve=l.cursor(qe.from+Math.max(0,Math.min(W,qe.length)));e.dispatch({effects:[o,b.scrollIntoView(Ve.from,{y:"center"})],selection:Ve})}),!0},xr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_t=x.define({combine(e){return bt(e,xr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jt(e){let t=[Cr,br];if(e)t.push(_t.of(e));return t}var Sr=E.mark({class:"cm-selectionMatch"}),kr=E.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function qt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=se.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=se.Word)}function vr(e,t,n,r){return e(t.sliceDoc(n,n+1))==se.Word&&e(t.sliceDoc(r-1,r))==se.Word}var br=Te.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){if(e.selectionSet||e.docChanged||e.viewportChanged)this.decorations=this.getDeco(e.view)}getDeco(e){let t=e.state.facet(_t),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let o=r.main,s,c=null;if(o.empty){if(!t.highlightWordAroundCursor)return E.none;let u=n.wordAt(o.head);if(!u)return E.none;c=n.charCategorizer(o.head),s=n.sliceDoc(u.from,u.to)}else{let u=o.to-o.from;if(u<t.minSelectionLength||u>200)return E.none;if(t.wholeWords){if(s=n.sliceDoc(o.from,o.to),c=n.charCategorizer(o.head),!(qt(c,n,o.from,o.to)&&vr(c,n,o.from,o.to)))return E.none}else if(s=n.sliceDoc(o.from,o.to),!s)return E.none}let a=[];for(let u of e.visibleRanges){let d=new F(n.doc,s,u.from,u.to);while(!d.next().done){let{from:f,to:m}=d.value;if(!c||qt(c,n,f,m)){if(o.empty&&f<=o.from&&m>=o.to)a.push(kr.range(f,m));else if(f>=o.to||m<=o.from)a.push(Sr.range(f,m));if(a.length>t.maxMatches)return E.none}}}return E.set(a)}},{decorations:(e)=>e.decorations}),Cr=b.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Mr=({state:e,dispatch:t})=>{let{selection:n}=e,r=l.create(n.ranges.map((o)=>e.wordAt(o.head)||l.cursor(o.head)),n.mainIndex);if(r.eq(n))return!1;return t(e.update({selection:r})),!0};function Ar(e,t){let{main:n,ranges:r}=e.selection,o=e.wordAt(n.head),s=o&&o.from==n.from&&o.to==n.to;for(let c=!1,a=new F(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(c)return null;a=new F(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),c=!0}else{if(c&&r.some((u)=>u.from==a.value.from))continue;if(s){let u=e.wordAt(a.value.from);if(!u||u.from!=a.value.from||u.to!=a.value.to)continue}return a.value}}var Lr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((s)=>s.from===s.to))return Mr({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((s)=>e.sliceDoc(s.from,s.to)!=r))return!1;let o=Ar(e,r);if(!o)return!1;return t(e.update({selection:e.selection.addRange(l.range(o.from,o.to),!1),effects:b.scrollIntoView(o.to)})),!0},I=x.define({combine(e){return bt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>b.scrollIntoView(t)})}});function $t(e){return e?[I.of(e),Ee]:Ee}class Oe{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||gr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
2
+ `:n=="r"?"\r":n=="t"?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ht(this):new Kt(this)}getCursor(e,t=0,n){let r=e.doc?e:D.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?q(this,r,t,n):N(this,r,t,n)}}class Fe{constructor(e){this.spec=e}}function Br(e,t,n){return(r,o,s,c)=>{if(n&&!n(r,o,s,c))return!1;let a=r>=c&&o<=c+s.length?s.slice(r-c,o-c):t.doc.sliceString(r,o);return e(a,t,r,o)}}function N(e,t,n,r){let o;if(e.wholeWord)o=Dr(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Br(e.test,t,o);return new F(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(s)=>s.toLowerCase(),o)}function Dr(e,t){return(n,r,o,s)=>{if(s>n||s+o.length<r)s=Math.max(0,n-2),o=e.sliceString(s,Math.min(e.length,r+2));return(t(ae(o,n-s))!=se.Word||t(ue(o,n-s))!=se.Word)&&(t(ue(o,r-s))!=se.Word||t(ae(o,r-s))!=se.Word)}}class Kt extends Fe{constructor(e){super(e)}nextMatch(e,t,n){let r=N(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let o=Math.min(e.doc.length,t+this.spec.unquoted.length);r=N(this.spec,e,0,o).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let o=Math.max(t,r-1e4-this.spec.unquoted.length),s=N(this.spec,e,o,r),c=null;while(!s.nextOverlapping().done)c=s.value;if(c)return c;if(o==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);if(!r)r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length);return r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=N(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=N(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}function Er(e,t,n){return(r,o,s)=>(!n||n(r,o,s))&&e(s[0],t,r,o)}function q(e,t,n,r){let o;if(e.wholeWord)o=Tr(t.charCategorizer(t.selection.main.head));if(e.test)o=Er(e.test,t,o);return new We(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ae(e,t){return e.slice(pe(e,t,!1),t)}function ue(e,t){return e.slice(t,pe(e,t))}function Tr(e){return(t,n,r)=>!r[0].length||(e(ae(r.input,r.index))!=se.Word||e(ue(r.input,r.index))!=se.Word)&&(e(ue(r.input,r.index+r[0].length))!=se.Word||e(ae(r.input,r.index+r[0].length))!=se.Word)}class Ht extends Fe{nextMatch(e,t,n){let r=q(this.spec,e,n,e.doc.length).next();if(r.done)r=q(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let o=Math.max(t,n-r*1e4),s=q(this.spec,e,o,n),c=null;while(!s.next().done)c=s.value;if(c&&(o==t||c.from>o+10))return c;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o<e.match.length)return e.match[o]+n.slice(r)}return t})}matchAll(e,t){let n=q(this.spec,e,0,e.doc.length),r=[];while(!n.next().done){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let o=q(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));while(!o.next().done)r(o.value.from,o.value.to)}}var J=B.define(),Ie=B.define(),O=ke.define({create(e){return new ie(De(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(J))e=new ie(n.value.create(),e.panel);else if(n.is(Ie))e=new ie(e.query,n.value?Pe:null);return e},provide:(e)=>Vn.from(e,(t)=>t.panel)});class ie{constructor(e,t){this.query=e,this.panel=t}}var wr=E.mark({class:"cm-searchMatch"}),Wr=E.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Rr=Te.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(O))}update(e){let t=e.state.field(O);if(t!=e.startState.field(O)||e.docChanged||e.selectionSet||e.viewportChanged)this.decorations=this.highlight(t)}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new vt;for(let o=0,s=n.visibleRanges,c=s.length;o<c;o++){let{from:a,to:u}=s[o];while(o<c-1&&u>s[o+1].from-500)u=s[++o].to;e.highlight(n.state,a,u,(d,f)=>{let m=n.state.selection.ranges.some((p)=>p.from==d&&p.to==f);r.add(d,f,m?Wr:wr)})}return r.finish()}},{decorations:(e)=>e.decorations});function K(e){return(t)=>{let n=t.state.field(O,!1);return n&&n.query.spec.valid?e(t,n):de(t)}}var he=K((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let o=l.single(r.from,r.to),s=e.state.facet(I);return e.dispatch({selection:o,effects:[Ne(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),jt(e),!0}),fe=K((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,o=t.prevMatch(n,r,r);if(!o)return!1;let s=l.single(o.from,o.to),c=e.state.facet(I);return e.dispatch({selection:s,effects:[Ne(e,o),c.scrollToMatch(s.main,e)],userEvent:"select.search"}),jt(e),!0}),Or=K((e,{query:t})=>{let n=t.matchAll(e.state,1000);if(!n||!n.length)return!1;return e.dispatch({selection:l.create(n.map((r)=>l.range(r.from,r.to))),userEvent:"select.search.matches"}),!0}),Fr=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:o}=n.main,s=[],c=0;for(let a=new F(e.doc,e.sliceDoc(r,o));!a.next().done;){if(s.length>1000)return!1;if(a.value.from==r)c=s.length;s.push(l.range(a.value.from,a.value.to))}return t(e.update({selection:l.create(s,c),userEvent:"select.search.matches"})),!0},Vt=K((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let c=s,a=[],u,d,f=[];if(!c.precise)c=t.nextMatch(n,c.from,c.to);else if(c.from==r&&c.to==o)d=n.toText(t.getReplacement(c)),a.push({from:c.from,to:c.to,insert:d}),c=t.nextMatch(n,c.from,c.to),f.push(b.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."));let m=e.state.changes(a);if(c)u=l.single(c.from,c.to).map(m),f.push(Ne(e,c)),f.push(n.facet(I).scrollToMatch(u.main,e));return e.dispatch({changes:m,selection:u,effects:f,userEvent:"input.replace"}),!0}),Ir=K((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let o of t.matchAll(e.state,1e9)){let{from:s,to:c,precise:a}=o;if(a)n.push({from:s,to:c,insert:t.getReplacement(o)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:b.announce.of(r),userEvent:"input.replace.all"}),!0});function Pe(e){return e.state.facet(I).createPanel(e)}function De(e,t){var n,r,o,s,c;let a=e.selection.main,u=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!u)return t;let d=e.facet(I);return new Oe({search:((n=t===null||t===void 0?void 0:t.literal)!==null&&n!==void 0?n:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(r=t===null||t===void 0?void 0:t.caseSensitive)!==null&&r!==void 0?r:d.caseSensitive,literal:(o=t===null||t===void 0?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(s=t===null||t===void 0?void 0:t.regexp)!==null&&s!==void 0?s:d.regexp,wholeWord:(c=t===null||t===void 0?void 0:t.wholeWord)!==null&&c!==void 0?c:d.wholeWord})}function Qt(e){let t=xi(e,Pe);return t&&t.dom.querySelector("[main-field]")}function jt(e){let t=Qt(e);if(t&&t==e.root.activeElement)t.select()}var de=(e)=>{let t=e.state.field(O,!1);if(t&&t.panel){let n=Qt(e);if(n&&n!=e.root.activeElement){let r=De(e.state,t.query.spec);if(r.valid)e.dispatch({effects:J.of(r)});n.focus(),n.select()}}else e.dispatch({effects:[Ie.of(!0),t?J.of(De(e.state,t.query.spec)):B.appendConfig.of(Ee)]});return!0},Xt=(e)=>{let t=e.state.field(O,!1);if(!t||!t.panel)return!1;let n=xi(e,Pe);if(n&&n.dom.contains(e.root.activeElement))e.focus();return e.dispatch({effects:Ie.of(!1)}),!0},Yt=[{key:"Mod-f",run:de,scope:"editor search-panel"},{key:"F3",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:he,shift:fe,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Xt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Fr},{key:"Mod-Alt-g",run:yr},{key:"Mod-d",run:Lr,preventDefault:!0}];class Zt{constructor(e){this.view=e;let t=this.query=e.state.field(O).query.spec;this.commit=this.commit.bind(this),this.searchField=ge("input",{value:t.search,placeholder:S(e,"Find"),"aria-label":S(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ge("input",{value:t.replace,placeholder:S(e,"Replace"),"aria-label":S(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ge("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ge("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ge("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,s){return ge("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=ge("div",{onkeydown:(r)=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>he(e),[S(e,"next")]),n("prev",()=>fe(e),[S(e,"previous")]),n("select",()=>Or(e),[S(e,"all")]),ge("label",null,[this.caseField,S(e,"match case")]),ge("label",null,[this.reField,S(e,"regexp")]),ge("label",null,[this.wordField,S(e,"by word")]),...e.state.readOnly?[]:[ge("br"),this.replaceField,n("replace",()=>Vt(e),[S(e,"replace")]),n("replaceAll",()=>Ir(e),[S(e,"replace all")])],ge("button",{name:"close",onclick:()=>Xt(e),"aria-label":S(e,"close"),type:"button"},["×"])])}commit(){let e=new Oe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query))this.query=e,this.view.dispatch({effects:J.of(e)})}keydown(e){if(jr(this.view,e,"search-panel"))e.preventDefault();else if(e.keyCode==13&&e.target==this.searchField)e.preventDefault(),(e.shiftKey?fe:he)(this.view);else if(e.keyCode==13&&e.target==this.replaceField)e.preventDefault(),Vt(this.view)}update(e){for(let t of e.transactions)for(let n of t.effects)if(n.is(J)&&!n.value.eq(this.query))this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}}function S(e,t){return e.state.phrase(t)}var re=30,le=/[\s\.,:;?!]/;function Ne(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-re),c=Math.min(o,n+re),a=e.state.sliceDoc(s,c);if(s!=r.from){for(let u=0;u<re;u++)if(!le.test(a[u+1])&&le.test(a[u])){a=a.slice(u);break}}if(c!=o){for(let u=a.length-1;u>a.length-re;u--)if(!le.test(a[u-1])&&le.test(a[u])){a=a.slice(0,u);break}}return b.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}var Pr=b.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Ee=[O,Le.low(Rr),Pr];var Nr=b.theme({"&":{color:"var(--code-fg)",backgroundColor:"var(--code-bg)",height:"100%",fontSize:"var(--code-size, 13px)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"var(--font-mono)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--code-fg)",padding:"0.5rem 0"},".cm-line":{padding:"0 0.75rem"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--code-fg)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--code-selection)"},".cm-activeLine":{backgroundColor:"var(--code-active-line)"},".cm-gutters":{backgroundColor:"var(--code-gutter-bg)",color:"var(--code-gutter)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLineGutter":{backgroundColor:"var(--code-active-line)",color:"var(--code-fg)"},".cm-lineNumbers .cm-gutterElement":{padding:"0 0.5rem 0 0.5rem",minWidth:"2.25rem"},".cm-matchingBracket, .cm-nonmatchingBracket":{backgroundColor:"var(--code-selection)",outline:"1px solid var(--border-strong)"},".cm-searchMatch":{backgroundColor:"var(--warn-soft)",outline:"1px solid var(--warn)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--accent-soft)",outline:"1px solid var(--accent)"},".cm-panels":{backgroundColor:"var(--surface-2)",color:"var(--text)",borderColor:"var(--border)",fontFamily:"var(--font)"},".cm-panels-top":{borderBottom:"1px solid var(--border)"},".cm-panel.cm-search":{padding:"0.5rem 2rem 0.5rem 0.5rem"},".cm-panel.cm-search input, .cm-panel.cm-search button, .cm-panel.cm-search label":{fontSize:"0.875rem"},".cm-panel.cm-search input[type=text]":{backgroundColor:"var(--surface)",color:"var(--text)",border:"1px solid var(--control-border)",borderRadius:"var(--radius-sm)",padding:"0.25rem 0.5rem"},".cm-panel.cm-search button":{backgroundColor:"var(--surface-3)",color:"var(--text)",border:"1px solid var(--border-strong)",borderRadius:"var(--radius-sm)",backgroundImage:"none",padding:"0.25rem 0.625rem"},".cm-panel.cm-search [name=close]":{color:"var(--muted)"}}),qr=Sn.define([{tag:[i.keyword,i.modifier,i.operatorKeyword,i.controlKeyword],color:"var(--code-keyword)"},{tag:[i.string,i.regexp,i.special(i.string),i.inserted],color:"var(--code-string)"},{tag:[i.number,i.bool,i.null,i.atom,i.literal],color:"var(--code-number)"},{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:"var(--code-comment)",fontStyle:"italic"},{tag:[i.typeName,i.className,i.namespace,i.tagName,i.standard(i.tagName)],color:"var(--code-type)"},{tag:[i.function(i.variableName),i.function(i.propertyName),i.definition(i.variableName),i.labelName],color:"var(--code-function)"},{tag:[i.meta,i.processingInstruction,i.annotation,i.attributeName,i.propertyName,i.heading],color:"var(--code-meta)"},{tag:i.heading,fontWeight:"bold"},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:i.link,color:"var(--code-function)",textDecoration:"underline"},{tag:i.url,color:"var(--code-function)"},{tag:i.invalid,color:"var(--danger)"},{tag:i.deleted,color:"var(--danger)"}]),en=[Nr,so(qr)];var Vr={typescript:()=>(h("1rv9vdcz"),import("./chunk-lang-typescript-1rv9vdcz.js")),javascript:()=>(h("d6x6qjtg"),import("./chunk-lang-javascript-d6x6qjtg.js")),json:()=>(h("790swysy"),import("./chunk-lang-json-790swysy.js")),markdown:()=>(h("483dkxcq"),import("./chunk-lang-markdown-483dkxcq.js")),css:()=>(h("yrc25qk9"),import("./chunk-lang-css-yrc25qk9.js")),html:()=>(h("rwe8epvf"),import("./chunk-lang-html-rwe8epvf.js")),python:()=>(h("v9s40bzj"),import("./chunk-lang-python-v9s40bzj.js")),yaml:()=>(h("g3v7s5je"),import("./chunk-lang-yaml-g3v7s5je.js")),go:()=>(h("drmfa25k"),import("./chunk-lang-go-drmfa25k.js")),rust:()=>(h("z4gry1bf"),import("./chunk-lang-rust-z4gry1bf.js")),sql:()=>(h("75j3denr"),import("./chunk-lang-sql-75j3denr.js")),xml:()=>(h("jg1sv4h2"),import("./chunk-lang-xml-jg1sv4h2.js")),shell:()=>(h("egsvk8rj"),import("./chunk-lang-shell-egsvk8rj.js")),toml:()=>(h("7dbjvhex"),import("./chunk-lang-toml-7dbjvhex.js")),dockerfile:()=>(h("tjxsnhr9"),import("./chunk-lang-dockerfile-tjxsnhr9.js"))};async function tn(e){if(e==="plain")return;try{return(await Vr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function Gr(e){if(typeof e.attachShadow!=="function"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in Document.prototype))return{parent:e,root:void 0};let t=e.shadowRoot??e.attachShadow({mode:"open"}),n=new CSSStyleSheet;return n.replaceSync(":host{display:flex;flex-direction:column;min-height:0}.cm-editor{flex:1;min-height:0}"),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],{parent:t,root:t}}async function vo(e){let t=new zt,n=new zt,r=new zt,o=await tn(e.language),s=(m)=>[D.readOnly.of(!m),b.editable.of(m)],c={editable:e.editable,wrap:e.wrap,language:o??[]},a,u=(m)=>[no(),Jr(),io(),tt(),Kr(),ao(),Jt(),$t({top:!0}),je.of(" "),D.phrases.of(e.phrases),en,Tt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},Pt,...Yt,...ot,...It]),D.lineSeparator.of(m),t.of(s(c.editable)),n.of(c.wrap?b.lineWrapping:[]),r.of(c.language),b.updateListener.of((p)=>{if(p.docChanged)e.onChange()})],d=Gr(e.parent),f=new b({parent:d.parent,root:d.root,state:D.create({doc:e.text,extensions:u(e.eol)})});return a=f.state.doc,{text:()=>f.state.doc.sliceString(0,void 0,f.state.lineBreak),dirty:()=>a===void 0||!f.state.doc.eq(a),snapshot:()=>f.state.doc,markSaved:(m)=>{a=m??f.state.doc},replace:(m,p)=>{let W=f.scrollDOM.scrollTop;f.setState(D.create({doc:m,extensions:u(p)})),a=f.state.doc,f.scrollDOM.scrollTop=W},setEditable:(m)=>{c.editable=m,f.dispatch({effects:t.reconfigure(s(m))})},setWrap:(m)=>{c.wrap=m,f.dispatch({effects:n.reconfigure(m?b.lineWrapping:[])})},setLanguage:async(m)=>{c.language=await tn(m)??[],f.dispatch({effects:r.reconfigure(c.language)})},undo:()=>{X(f)},redo:()=>{z(f)},find:()=>{de(f)},tab:()=>{ne(f)},focus:()=>f.focus(),scrollTop:()=>f.scrollDOM.scrollTop,scrollTo:(m)=>{f.scrollDOM.scrollTop=m},destroy:()=>f.destroy()}}export{vo as createEditor};
@@ -0,0 +1 @@
1
+ import{K}from"./chunk-index-3wbyq10m.js";import"./chunk-index-47yspxa4.js";export{K as Confirm};
@@ -1 +1 @@
1
- import{t,g,e,n,O,S,m,k,P,_}from"./chunk-index-84v7j6vh.js";import{ye}from"./chunk-index-th43f690.js";function p(){let{connectorAdminUrl:o}=_(),{data:r,error:s}=ye(()=>O.connectors(),"connectors");return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h2",{children:t("Connectors")}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the knights.")})]}),o?e("a",{href:o,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),s?e(m,{message:s}):null,!r&&!s?e(S,{}):null,r?n(g,{children:[e("h3",{children:t("Upstream gateways")}),r.gateways.length===0?e(k,{children:t("No gateways.")}):null,r.gateways.map((a)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:a.enabled?t("Enabled"):t("Disabled")}),e(P,{tone:a.reachable?"plain":"warn",children:a.reachable?t("Reachable"):t("Unreachable")}),e(P,{children:t("{count} tools",{count:a.tools})})]})},a.name)),e("h3",{children:t("Virtual servers")}),r.servers.length===0?e(k,{children:t("No virtual servers.")}):null,r.servers.map((a)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:t("{count} tools",{count:a.tools.length})})]}),n("p",{children:[t("Used by"),": ",a.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:a.tools.map((l)=>e("li",{children:l},l))})]})]},a.name))]}):null]})}export{p as ConnectorsPage};
1
+ import{t,g,e,n,O,w,m,k,P,_}from"./chunk-index-kankja6p.js";import{ye}from"./chunk-index-wc83vb0a.js";function p(){let{connectorAdminUrl:o}=_(),{data:r,error:s}=ye(()=>O.connectors(),"connectors");return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h2",{children:t("Connectors")}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the knights.")})]}),o?e("a",{href:o,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),s?e(m,{message:s}):null,!r&&!s?e(w,{}):null,r?n(g,{children:[e("h3",{children:t("Upstream gateways")}),r.gateways.length===0?e(k,{children:t("No gateways.")}):null,r.gateways.map((a)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:a.enabled?t("Enabled"):t("Disabled")}),e(P,{tone:a.reachable?"plain":"warn",children:a.reachable?t("Reachable"):t("Unreachable")}),e(P,{children:t("{count} tools",{count:a.tools})})]})},a.name)),e("h3",{children:t("Virtual servers")}),r.servers.length===0?e(k,{children:t("No virtual servers.")}):null,r.servers.map((a)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(P,{children:t("{count} tools",{count:a.tools.length})})]}),n("p",{children:[t("Used by"),": ",a.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:a.tools.map((l)=>e("li",{children:l},l))})]})]},a.name))]}):null]})}export{p as ConnectorsPage};
@@ -1 +1 @@
1
- import{t,c,g,e,n,x,O,S,m,k,P,_,Pe,ie,Qe,on,si,te}from"./chunk-index-84v7j6vh.js";import{ye}from"./chunk-index-th43f690.js";var u=[{kind:"owner",title:c("Owner channels"),note:c("Direct messages and channels where the owner talks to a knight.")},{kind:"agent",title:c("Bot server channels"),note:c("The bot server's one-to-one channels.")},{kind:"group",title:c("Group channels"),note:c("The bot server's group channels.")},{kind:"outside",title:c("Outside AI clients"),note:c("Conversations an outside AI client holds over MCP.")},{kind:"plugin",title:c("Plugin conversations"),note:c("Conversations a plugin runs, such as a web chat, as the host recorded them.")}];function A(){let{timeZone:o}=_(),{now:i}=te(),{data:a,error:s}=ye(()=>O.conversations(),"conversations"),d=a?.conversations;if(!d)return s?e(m,{message:s}):e(S,{});return n(g,{children:[s?e(m,{message:s}):null,u.map((r)=>{let h=d.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),h.length===0?e(k,{children:t("None stored.")}):null,h.map((l)=>e(v,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function v(o){let{item:i}=o,a=on(i.channel,i.id),s=si(i);return n("a",{className:"card card-link",href:x("conversations",i.key),children:[n("div",{className:"card-head",children:[e("strong",{children:s}),i.busy>0?e(P,{tone:"busy",children:t("running")}):null,i.liveBytes===0?e(P,{children:t("archived only")}):null]}),n("p",{className:"meta",children:[(i.kind==="outside"||i.kind==="plugin")&&i.startedAt?`${t("Started")} ${ie(i.startedAt,o.timeZone)} · `:a.detail?`${a.detail} · `:"",i.principal?`${i.visibility==="private"?t("Private to {name}",{name:i.principal.name}):t("Shared · {name}",{name:i.principal.name})} · `:"",t("Last active")," ",Pe(i.lastActive,o.now,o.timeZone)," ·"," ",Qe(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{A as ConversationsPage};
1
+ import{t,c,g,e,n,v,O,w,m,k,P,_,Pe,ie,Qe,un,ci,ne}from"./chunk-index-kankja6p.js";import{ye}from"./chunk-index-wc83vb0a.js";var u=[{kind:"owner",title:c("Owner channels"),note:c("Direct messages and channels where the owner talks to a knight.")},{kind:"agent",title:c("Bot server channels"),note:c("The bot server's one-to-one channels.")},{kind:"group",title:c("Group channels"),note:c("The bot server's group channels.")},{kind:"outside",title:c("Outside AI clients"),note:c("Conversations an outside AI client holds over MCP.")},{kind:"plugin",title:c("Plugin conversations"),note:c("Conversations a plugin runs, such as a web chat, as the host recorded them.")}];function Z(){let{timeZone:o}=_(),{now:i}=ne(),{data:a,error:s}=ye(()=>O.conversations(),"conversations"),d=a?.conversations;if(!d)return s?e(m,{message:s}):e(w,{});return n(g,{children:[s?e(m,{message:s}):null,u.map((r)=>{let h=d.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),h.length===0?e(k,{children:t("None stored.")}):null,h.map((l)=>e(p,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function p(o){let{item:i}=o,a=un(i.channel,i.id),s=ci(i);return n("a",{className:"card card-link",href:v("conversations",i.key),children:[n("div",{className:"card-head",children:[e("strong",{children:s}),i.busy>0?e(P,{tone:"busy",children:t("running")}):null,i.liveBytes===0?e(P,{children:t("archived only")}):null]}),n("p",{className:"meta",children:[(i.kind==="outside"||i.kind==="plugin")&&i.startedAt?`${t("Started")} ${ie(i.startedAt,o.timeZone)} · `:a.detail?`${a.detail} · `:"",i.principal?`${i.visibility==="private"?t("Private to {name}",{name:i.principal.name}):t("Shared · {name}",{name:i.principal.name})} · `:"",t("Last active")," ",Pe(i.lastActive,o.now,o.timeZone)," ·"," ",Qe(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{Z as ConversationsPage};
@@ -1 +1 @@
1
- import{Or}from"./chunk-index-84v7j6vh.js";import{rr}from"./chunk-index-gzvkpe3e.js";import{Ls,zs,$r,Nr,Is,Ds}from"./chunk-index-9w0sar6s.js";var ne=Or,re=(a)=>{for(let n=a;n;n=n.parentElement){let{overflowY:l}=getComputedStyle(n);if((l==="auto"||l==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function se(a){let{item:n,root:l,key:u,mode:C}=a,c=re(l),O=c===document.scrollingElement||c===document.documentElement,k=()=>O?0:c.getBoundingClientRect().top,X=()=>O?window.innerHeight:c.clientHeight,x=(e)=>e-k()+c.scrollTop,p=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},y=document.createElement("div");y.className="drop-line",y.setAttribute("aria-hidden","true");let z=[],P=[],g=[],h=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...l.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{j()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},j=()=>{if(C==="room"){P=[...l.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:H}=p(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+H,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...p(o)})):[]}});return}g=[...l.querySelectorAll(":scope > [data-folder-block]")],h=g.map((t)=>({key:t.dataset.key??"",...p(t)})),R=g.map((t)=>({key:t.dataset.key??"",...p(t.querySelector("[data-folder-head]")??t)}));let e=p(l);B={top:e.top,bottom:e.top+e.height}};rr(!0);let G=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),l.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-G;if(F)c.scrollTop+=F;D();let J=x(a.y),I={x:0,y:a.y},Z=!1,f=0,w,d,q={type:"cancel"};try{n.setPointerCapture(a.pointerId)}catch{}let _=()=>{f=0;let e=x(I.y),t=e-J;if(Math.abs(t)>ne)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=Ls(z,u,e);q=o?{type:"room",drop:o}:{type:"cancel"};let M=o?z.indexOf(o.zone):-1;r=P[M];let E=r?.contains(n)??!1,s=o?o.zone.items:[],m=E?[...r.querySelectorAll("[data-drop-item]")]:[],v=s.findIndex((i)=>i.key===u),W=o?Nr(s.map((i)=>i.key),u,o.before):0,ee=s.length>1?Math.max(0,(s[1]?.top??0)-(s[0]?.top??0)-(s[0]?.height??0)):0,U=E&&v>=0?$r(s,v,W,ee):[];for(let i of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))i.style.removeProperty("transform");if(m.forEach((i,A)=>{if(U[A])i.style.transform=`translate3d(0, ${U[A]}px, 0)`}),r&&o&&!E){let i=o.before===null?void 0:o.zone.items.find((oe)=>oe.key===o.before),A=p(r).top,te=i?i.top-A:o.zone.items.length?p(r).height:0;y.style.top=`${te}px`,r.append(y)}else y.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let i=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{a.open(i),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),L()}))},Ds)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=zs(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?Nr(h.map((m)=>m.key),u,o.before):M,s=$r(h,M,E,12);g.forEach((m,v)=>{if(m!==n)m.style.transform=s[v]?`translate3d(0, ${s[v]}px, 0)`:""})}if(r!==w)w?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),w=r;let H=Is(I.y,k(),k()+X());if(H)c.scrollTop+=H,L()},L=()=>{if(!f)f=requestAnimationFrame(_)},b=(e)=>{Q(),a.done(e)},S=(e)=>e.pointerId===a.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},L()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),f)cancelAnimationFrame(f),_();b(Z?q:{type:"tap"})},V=(e)=>{if(S(e))b({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),b({type:"cancel"})},T=(e)=>e.preventDefault();function Q(){if(rr(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",T,!0),window.removeEventListener("contextmenu",T,!0),f)cancelAnimationFrame(f);if(d)clearTimeout(d.timer);w?.removeAttribute("data-drop-target"),y.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),l.removeAttribute("data-reordering");for(let e of l.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(a.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",T,{capture:!0,passive:!1}),window.addEventListener("contextmenu",T,!0),L(),()=>b({type:"cancel"})}export{se as lift};
1
+ import{xr}from"./chunk-index-kankja6p.js";import{cr}from"./chunk-index-azrnzgev.js";import{Ho,Ko,Lr,Xr,Jo,es}from"./chunk-index-4s1qj9we.js";var ne=xr,re=(a)=>{for(let n=a;n;n=n.parentElement){let{overflowY:l}=getComputedStyle(n);if((l==="auto"||l==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function se(a){let{item:n,root:l,key:u,mode:C}=a,c=re(l),O=c===document.scrollingElement||c===document.documentElement,k=()=>O?0:c.getBoundingClientRect().top,X=()=>O?window.innerHeight:c.clientHeight,x=(e)=>e-k()+c.scrollTop,p=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},y=document.createElement("div");y.className="drop-line",y.setAttribute("aria-hidden","true");let z=[],P=[],g=[],h=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...l.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{j()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},j=()=>{if(C==="room"){P=[...l.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:H}=p(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+H,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...p(o)})):[]}});return}g=[...l.querySelectorAll(":scope > [data-folder-block]")],h=g.map((t)=>({key:t.dataset.key??"",...p(t)})),R=g.map((t)=>({key:t.dataset.key??"",...p(t.querySelector("[data-folder-head]")??t)}));let e=p(l);B={top:e.top,bottom:e.top+e.height}};cr(!0);let G=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),l.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-G;if(F)c.scrollTop+=F;D();let J=x(a.y),I={x:0,y:a.y},Z=!1,f=0,w,d,q={type:"cancel"};try{n.setPointerCapture(a.pointerId)}catch{}let _=()=>{f=0;let e=x(I.y),t=e-J;if(Math.abs(t)>ne)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=Ho(z,u,e);q=o?{type:"room",drop:o}:{type:"cancel"};let M=o?z.indexOf(o.zone):-1;r=P[M];let E=r?.contains(n)??!1,s=o?o.zone.items:[],m=E?[...r.querySelectorAll("[data-drop-item]")]:[],v=s.findIndex((i)=>i.key===u),W=o?Xr(s.map((i)=>i.key),u,o.before):0,ee=s.length>1?Math.max(0,(s[1]?.top??0)-(s[0]?.top??0)-(s[0]?.height??0)):0,U=E&&v>=0?Lr(s,v,W,ee):[];for(let i of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))i.style.removeProperty("transform");if(m.forEach((i,A)=>{if(U[A])i.style.transform=`translate3d(0, ${U[A]}px, 0)`}),r&&o&&!E){let i=o.before===null?void 0:o.zone.items.find((oe)=>oe.key===o.before),A=p(r).top,te=i?i.top-A:o.zone.items.length?p(r).height:0;y.style.top=`${te}px`,r.append(y)}else y.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let i=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{a.open(i),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),L()}))},es)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=Ko(R,B,u,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let M=h.findIndex((m)=>m.key===u),E=o?Xr(h.map((m)=>m.key),u,o.before):M,s=Lr(h,M,E,12);g.forEach((m,v)=>{if(m!==n)m.style.transform=s[v]?`translate3d(0, ${s[v]}px, 0)`:""})}if(r!==w)w?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),w=r;let H=Jo(I.y,k(),k()+X());if(H)c.scrollTop+=H,L()},L=()=>{if(!f)f=requestAnimationFrame(_)},b=(e)=>{Q(),a.done(e)},S=(e)=>e.pointerId===a.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},L()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),f)cancelAnimationFrame(f),_();b(Z?q:{type:"tap"})},V=(e)=>{if(S(e))b({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),b({type:"cancel"})},T=(e)=>e.preventDefault();function Q(){if(cr(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",T,!0),window.removeEventListener("contextmenu",T,!0),f)cancelAnimationFrame(f);if(d)clearTimeout(d.timer);w?.removeAttribute("data-drop-target"),y.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),l.removeAttribute("data-reordering");for(let e of l.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(a.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",T,{capture:!0,passive:!1}),window.addEventListener("contextmenu",T,!0),L(),()=>b({type:"cancel"})}export{se as lift};
@@ -1 +1 @@
1
- import{Mt,qt}from"./chunk-index-31ays46f.js";import{f}from"./chunk-index-84v7j6vh.js";function H(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function x(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((r)=>{let d=new URLSearchParams(r).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(c,n,T){let r=n.variant==="compact",d=n.labels??qt,l=new Map,E=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};E(n.seats);let m={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=r?"compact":"full";let g=document.createElement("div");g.className="rt-table-stage",o.appendChild(g);let i=null,y=!1,A=()=>!r&&(Boolean(n.listBelow)||y);c.appendChild(o);let u=new Map,p=()=>{if(!A()){i?.remove(),i=null,u.clear(),delete o.dataset.list;return}if(!i)i=document.createElement("ul"),i.className="rt-table-list",i.setAttribute("aria-label",d.table),o.appendChild(i),o.dataset.list="";for(let e of[...u.keys()])if(!l.has(e))u.delete(e);for(let e of l.values()){let t=u.get(e.id);if(!t){t=document.createElement("button"),t.type="button",t.dataset.seat=e.id;let s=e.id;t.addEventListener("click",(S)=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name,at:Mt(S,S.currentTarget)})}),u.set(e.id,t)}t.textContent=d.seat(e.name,e.state??"idle"),t.style.setProperty("--seat",e.color)}i.replaceChildren(...[...l.values()].map((e)=>{let t=document.createElement("li"),s=u.get(e.id);if(s)t.appendChild(s);return t}))};p();let w=(e)=>{y=!e,p(),n.onNames?.(e)},v=async()=>{let{createTable2D:e}=await (f("18y029k9"),import("./chunk-table2d-18y029k9.js"));a=e(g,{...n,theme:m.t,scheme:m.s,seats:[...l.values()]}),w(!0)},C=async()=>{let{createTable3D:e}=await (f("q2s31ae0"),import("./chunk-table3d-q2s31ae0.js"));a=e(g,{...n,theme:m.t,scheme:m.s,seats:[...l.values()],onNames:w},()=>{a?.dispose(),v()})};if(r||T==="svg"||T!=="webgl"&&(x(location.search,location.hash)||!H()))await v();else try{await C()}catch{await v()}let L,M=n.onSeatMenu;if(M&&!r){let{attachSeatMenu:e}=await (f("ca5p4e9q"),import("./chunk-seat-menu-ca5p4e9q.js"));L=e(o,(t,s,S)=>{let b=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,h=l.get(b??a?.seatAt?.(s,S)??"");return h?{id:h.id,name:h.name}:void 0},M)}return{get kind(){return a.kind},setTheme(e,t){m={t:e,s:t},a.setTheme(e,t)},setSeats(e){E(e),p(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;p(),a.setState(e,t)},setAvatar(e,t){let s=l.get(e);if(s)s.avatarSvg=t;return a.setAvatar(e,t)},setReducedMotion:(e)=>a.setReducedMotion(e),resetCamera:()=>a.resetCamera(),focus:(e,t)=>a.focus(e,t),focused:()=>a.focused(),seatAt:(e,t)=>a.seatAt?.(e,t)??null,getStats:()=>a.getStats(),dispose(){L?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
1
+ import{Ct,Gt}from"./chunk-index-pgxgq61x.js";import{h}from"./chunk-index-kankja6p.js";function H(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function x(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((r)=>{let d=new URLSearchParams(r).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(c,n,S){let r=n.variant==="compact",d=n.labels??Gt,l=new Map,E=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};E(n.seats);let m={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=r?"compact":"full";let f=document.createElement("div");f.className="rt-table-stage",o.appendChild(f);let i=null,y=!1,A=()=>!r&&(Boolean(n.listBelow)||y);c.appendChild(o);let u=new Map,g=()=>{if(!A()){i?.remove(),i=null,u.clear(),delete o.dataset.list;return}if(!i)i=document.createElement("ul"),i.className="rt-table-list",i.setAttribute("aria-label",d.table),o.appendChild(i),o.dataset.list="";for(let e of[...u.keys()])if(!l.has(e))u.delete(e);for(let e of l.values()){let t=u.get(e.id);if(!t){t=document.createElement("button"),t.type="button",t.dataset.seat=e.id;let s=e.id;t.addEventListener("click",(p)=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name,at:Ct(p,p.currentTarget)})}),u.set(e.id,t)}t.textContent=d.seat(e.name,e.state??"idle"),t.style.setProperty("--seat",e.color)}i.replaceChildren(...[...l.values()].map((e)=>{let t=document.createElement("li"),s=u.get(e.id);if(s)t.appendChild(s);return t}))};g();let w=(e)=>{y=!e,g(),n.onNames?.(e)},T=async()=>{let{createTable2D:e}=await (h("1a6atjhj"),import("./chunk-table2d-1a6atjhj.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()]}),w(!0)},C=async()=>{let{createTable3D:e}=await (h("k0ffeffj"),import("./chunk-table3d-k0ffeffj.js"));a=e(f,{...n,theme:m.t,scheme:m.s,seats:[...l.values()],onNames:w},()=>{a?.dispose(),T()})};if(r||S==="svg"||S!=="webgl"&&(x(location.search,location.hash)||!H()))await T();else try{await C()}catch{await T()}let L,M=n.onSeatMenu;if(M&&!r){let{attachSeatMenu:e}=await (h("vrpc40v9"),import("./chunk-seat-menu-vrpc40v9.js"));L=e(o,(t,s,p)=>{let b=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,v=l.get(b??a?.seatAt?.(s,p)??"");return v?{id:v.id,name:v.name}:void 0},M)}return{get kind(){return a.kind},setTheme(e,t){m={t:e,s:t},a.setTheme(e,t)},setSeats(e){E(e),g(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;g(),a.setState(e,t)},setAvatar(e,t){let s=l.get(e);if(s)s.avatarSvg=t;return a.setAvatar(e,t)},setReducedMotion:(e)=>a.setReducedMotion(e),resetCamera:()=>a.resetCamera(),focus:(e,t)=>a.focus(e,t),focused:()=>a.focused(),seatAt:(e,t)=>a.seatAt?.(e,t)??null,getStats:()=>a.getStats(),dispose(){L?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
@@ -0,0 +1 @@
1
+ import{h,s,A,t,te,g,e,n,o,Ot,d,fe,We,Ln,Xn}from"./chunk-index-kankja6p.js";import{ir,or,sr,ar}from"./chunk-index-rg9vh59e.js";import{qt}from"./chunk-index-1fn8q4ps.js";import{yi}from"./chunk-index-nrexxkar.js";var v=()=>(h("6assr93n"),import("./chunk-layout-actions-6assr93n.js")),y=(a)=>(h("2eect825"),import("./chunk-placement-items-2eect825.js")).then((r)=>r.folderMenu(a)),F=(a)=>({mode:"folder",key:a,item:(r)=>r.closest("[data-folder-block]"),root:(r)=>r.closest("[data-folder-block]")?.parentElement??null,onDrop:(r)=>{if(r.type==="folder")v().then((i)=>i.placeFolderBefore(a,r.before))},open:sr});function k(a){let{id:r,name:i}=a,m=ir().has(r),l=a.holdsActive||!m,c=A(),b=qt(()=>y(r),F(r)),N=(u)=>{y(r).then((f)=>{if(!f)return;let p=u.getBoundingClientRect();fe({...f,at:{x:p.left,y:p.bottom},via:"key",source:u})},()=>{return})};return n("section",{className:"folder","aria-label":i,"data-folder-block":"","data-key":r,"data-drop-zone":"folder","data-zone-id":r,"data-folder":r,"data-collapsed":l?void 0:"",children:[n("header",{className:"folder-head","data-folder-head":"",...b,children:[n("button",{type:"button",className:"folder-toggle","aria-expanded":l,"aria-controls":c,"aria-label":l?t("Collapse {name}",{name:i}):t("Expand {name}",{name:i}),onClick:()=>or(r),children:[e(o,{name:"chevron",size:16,className:"folder-chevron","data-open":l||void 0}),e("strong",{children:i}),e("span",{className:"meta",children:te(a.count,"{count} room","{count} rooms")}),l?null:a.stack]}),a.muted==="none"?null:e(o,{name:"bell-off",size:14,className:"muted-mark","data-partial":a.muted==="some"||void 0,role:"img","aria-hidden":!1,"aria-label":a.muted==="all"?t("Notifications are off"):t("Some notifications are off")}),l?null:a.summary,e("button",{type:"button",className:"icon-button folder-more","aria-haspopup":"menu","aria-label":t("Folder menu"),onClick:(u)=>N(u.currentTarget),children:e(o,{name:"more",size:18})})]}),e("div",{id:c,className:"folder-body",hidden:!l,children:l?a.count===0?e("p",{className:"meta folder-empty",children:t("No rooms in this folder yet.")}):a.children:null})]})}var R=4;function S(a){let r=a.rooms.slice(0,R),i=d((l)=>r.map((c)=>l.rooms[c]?.view),r.join(",")),m=a.rooms.length-r.length;return n("span",{className:"folder-stack","aria-hidden":"true",children:[i.map((l)=>l?e("span",{className:"folder-stack-item",children:e(We,{view:l,size:28})},l.key):null),m>0?n("span",{className:"folder-stack-more",children:["+",m]}):null]})}function M(a){let r=d((i)=>({waiting:a.rooms.reduce((m,l)=>m+Ot(i,l),0),typing:a.rooms.some((m)=>i.rooms[m]?.typing)}),a.rooms.join(","));return n(g,{children:[r.typing?e(Ln,{}):null,r.waiting?e(Xn,{count:r.waiting}):null]})}function w(a){return d((r)=>yi(a,(i)=>r.rooms[i]?.view?.muted===!0),a.join(","))}function Q(a){let r=a.folders.map((i)=>i.id).join(",");return s(()=>{if(a.listed)ar(r?r.split(","):[])},[a.listed,r]),e(g,{children:a.folders.map((i)=>e(C,{folder:i,...a},i.id))})}function C(a){let{folder:r}=a,i=w(r.rooms);return e(k,{id:r.id,name:r.name,count:r.rooms.length,holdsActive:a.active!==void 0&&r.rooms.includes(a.active),muted:i,summary:e(M,{rooms:r.rooms}),stack:e(S,{rooms:r.rooms}),children:a.rooms(r.rooms)})}export{Q as FolderList};
@@ -0,0 +1 @@
1
+ import{ir,rr,or,sr,ar}from"./chunk-index-rg9vh59e.js";export{rr as collapsedNow,sr as expandFolder,ar as pruneCollapsed,or as toggleCollapsed,ir as useCollapsed};
@@ -0,0 +1 @@
1
+ import{t,e,n,o,v}from"./chunk-index-kankja6p.js";import{Pn,nn}from"./chunk-index-8eexybcx.js";function l({steps:s}){return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Finish setting up")})}),e("p",{className:"meta",children:t("These steps come first. The rest of the app opens when they are done.")}),e("ul",{className:"menu",children:s.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:v(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:Pn(a)}),nn(a)?e("span",{className:"meta",children:nn(a)}):null]}),e(o,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
@@ -0,0 +1 @@
1
+ import{r,e,n}from"./chunk-index-kankja6p.js";import"./chunk-index-84wbc80d.js";import"./chunk-index-zx6yka30.js";import"./chunk-index-raf772z6.js";import{Vt}from"./chunk-index-n93wqszt.js";import{po,mo,er,Yn}from"./chunk-index-5fz5e1ct.js";import"./chunk-index-47yspxa4.js";function b(i){let{roomKey:o,members:m}=i,{line:s}=er(o),[l,a]=r(),u=mo(po(s,m),s?.id,l),t=(f)=>a({lineId:s?.id,member:f});return n("div",{className:"table-frame room-scene","data-focused":"",children:[e(Vt,{members:m,groupRoom:o,variant:"full",focus:u,onFocus:t,onSeat:t}),e(Yn,{roomKey:o,open:!0,streams:!1})]})}export{b as GroupScene};
@@ -0,0 +1 @@
1
+ import{Or,t,g,e,n,o,d,et}from"./chunk-index-kankja6p.js";import"./chunk-index-84wbc80d.js";import"./chunk-index-zx6yka30.js";import"./chunk-index-raf772z6.js";import{Vt}from"./chunk-index-n93wqszt.js";var i=(a,r)=>r?Or(a,r):a;function T(a){let r=d((c)=>c.rooms[a.roomKey]?.view),l=et();if(!r||r.kind!=="group")return null;let m=r.members??[];return n(g,{children:[n("button",{type:"button",className:"icon-button group-table-button","aria-label":t("Table"),"aria-pressed":a.scene,onClick:()=>a.onScene(!a.scene),children:[e(o,{name:"table"}),e("span",{className:"group-table-label",children:t("Table")})]}),l==="camelot"&&!a.scene?i(e("div",{className:"group-strip",children:e(Vt,{members:m,groupRoom:a.roomKey,variant:"compact"})}),a.slot):null]})}export{T as GroupTable};
@@ -0,0 +1 @@
1
+ import"./chunk-index-hczrjnky.js";
@@ -0,0 +1 @@
1
+ import{ot}from"./chunk-index-30vw4nhh.js";export{ot as HostPicture};
@@ -0,0 +1 @@
1
+ import{Dr,Ce,Ur,Vr,qr,Br,Fr,Jt,Zi,Gr,vs}from"./chunk-index-raf772z6.js";export{Gr as keepCards,Zi as keepReads,Fr as noCards,Br as noReads,vs as onFrame,Jt as seedUnread,Dr as subscribeHost,Vr as totalUnread,qr as unreadCounts,Ur as unreadOf,Ce as useHost};