pi-roundtable-web 0.26.3 → 0.27.0

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 (210) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +18 -11
  3. package/dist/chunk-account-1ecx5kt7.js +1 -0
  4. package/dist/chunk-action-menu-zh2n0ahf.js +1 -0
  5. package/dist/chunk-agent-ynm2tcbx.js +1 -0
  6. package/dist/chunk-arranged-rooms-qnz8vese.js +1 -0
  7. package/dist/chunk-bulk-actions-pr0mw0kc.js +1 -0
  8. package/dist/chunk-character-creator-caj4pmg4.js +1 -0
  9. package/dist/{chunk-codeeditor-6xavqntt.js → chunk-codeeditor-dga6s78p.js} +2 -2
  10. package/dist/chunk-confirm-g76v5d9r.js +1 -0
  11. package/dist/{chunk-connectors-7xqsg5q5.js → chunk-connectors-j79ze3j1.js} +1 -1
  12. package/dist/{chunk-conversations-zc4mv6vj.js → chunk-conversations-2farn72g.js} +1 -1
  13. package/dist/chunk-council-sheet-s9sz1bzf.js +2 -0
  14. package/dist/{chunk-drag-0mefcvp3.js → chunk-drag-45e8222r.js} +1 -1
  15. package/dist/chunk-entry-q11n47h9.js +1 -0
  16. package/dist/chunk-folder-list-4gcj7g7h.js +1 -0
  17. package/dist/chunk-folds-ten4ykfw.js +1 -0
  18. package/dist/{chunk-gate-86r8a2vf.js → chunk-gate-kcv1a4t0.js} +1 -1
  19. package/dist/chunk-group-scene-12ghcvzd.js +1 -0
  20. package/dist/chunk-group-table-t458kdgn.js +1 -0
  21. package/dist/chunk-host-icons-h1k9k96a.js +1 -0
  22. package/dist/chunk-host-picture-3p0wzn3v.js +1 -0
  23. package/dist/chunk-host-state-7mdve7cb.js +1 -0
  24. package/dist/chunk-host-ui-bdgwa6sf.js +1 -0
  25. package/dist/chunk-index-02vfshtt.js +2 -0
  26. package/dist/chunk-index-0a81da8z.js +2 -0
  27. package/dist/{chunk-index-8eexybcx.js → chunk-index-0w4bfjb5.js} +2 -2
  28. package/dist/{chunk-index-1fn8q4ps.js → chunk-index-12zyshae.js} +2 -2
  29. package/dist/chunk-index-18pgxxw3.js +2 -0
  30. package/dist/chunk-index-2e4am3hw.js +50 -0
  31. package/dist/{chunk-index-agrvqf5b.js → chunk-index-2fdns8tn.js} +2 -2
  32. package/dist/{chunk-index-84wbc80d.js → chunk-index-2t30xwed.js} +2 -2
  33. package/dist/{chunk-index-jq970hsd.js → chunk-index-31x6krbs.js} +3 -3
  34. package/dist/{chunk-index-eh0wb6g0.js → chunk-index-3d8s3565.js} +2 -2
  35. package/dist/chunk-index-5bfqek1d.js +2 -0
  36. package/dist/chunk-index-64rsz6pf.js +2 -0
  37. package/dist/chunk-index-6bkcq9ka.js +2 -0
  38. package/dist/{chunk-index-47yspxa4.js → chunk-index-8d81qy69.js} +1 -1
  39. package/dist/chunk-index-92zgb7my.js +2 -0
  40. package/dist/chunk-index-aamhjg5n.js +2 -0
  41. package/dist/{chunk-index-r1v895tj.js → chunk-index-ac1ktr56.js} +2 -2
  42. package/dist/{chunk-index-hc0dgmrs.js → chunk-index-ak6ecqy3.js} +2 -2
  43. package/dist/{chunk-index-eyc2rkq5.js → chunk-index-b73y2gc0.js} +2 -2
  44. package/dist/chunk-index-b8cpvr7y.js +2 -0
  45. package/dist/{chunk-index-3aa5czxj.js → chunk-index-bhqczxr3.js} +2 -2
  46. package/dist/{chunk-index-6c8mewwy.js → chunk-index-cbqhzf40.js} +12 -12
  47. package/dist/chunk-index-cdctnw71.js +2 -0
  48. package/dist/chunk-index-dj0tbfyb.js +2 -0
  49. package/dist/chunk-index-dnjftvtq.js +2 -0
  50. package/dist/chunk-index-e2dqjde8.js +1 -0
  51. package/dist/{chunk-index-tsxsy4qs.js → chunk-index-ebg48jgy.js} +2 -2
  52. package/dist/{chunk-index-rcxz5w5d.js → chunk-index-ek5mek4j.js} +3 -3
  53. package/dist/chunk-index-f6q0stqx.js +2 -0
  54. package/dist/{chunk-index-67p2sc14.js → chunk-index-ffbrm6tr.js} +3 -3
  55. package/dist/chunk-index-g1awv7rk.js +2 -0
  56. package/dist/chunk-index-g3wrs02w.js +1 -0
  57. package/dist/chunk-index-j0m16cj1.js +2 -0
  58. package/dist/chunk-index-j4kk1m59.js +2 -0
  59. package/dist/chunk-index-j4x9dq30.css +1 -0
  60. package/dist/{chunk-index-3wbyq10m.js → chunk-index-jgzygbt8.js} +1 -1
  61. package/dist/chunk-index-kb3w11mn.js +7 -0
  62. package/dist/{chunk-index-raf772z6.js → chunk-index-kbrg32sx.js} +2 -2
  63. package/dist/chunk-index-msqhgvfx.js +2 -0
  64. package/dist/chunk-index-pefwfm26.js +2 -0
  65. package/dist/chunk-index-pyfx77cj.js +2 -0
  66. package/dist/{chunk-index-30vw4nhh.js → chunk-index-q7g62sgm.js} +3 -3
  67. package/dist/chunk-index-qfgkfq86.js +2 -0
  68. package/dist/chunk-index-rh0x9rzf.js +2 -0
  69. package/dist/{chunk-index-m65cv329.js → chunk-index-sm7m4fej.js} +2 -2
  70. package/dist/chunk-index-sv9qpmhv.js +1 -0
  71. package/dist/chunk-index-t998yg8y.js +2 -0
  72. package/dist/{chunk-index-e90kztkx.js → chunk-index-tk4se135.js} +3 -3
  73. package/dist/chunk-index-v6smgw77.js +2 -0
  74. package/dist/chunk-index-w42rcbx1.js +2 -0
  75. package/dist/chunk-index-x4enmj72.js +2 -0
  76. package/dist/chunk-index-xq84gg8w.js +2 -0
  77. package/dist/{chunk-index-gt42wjby.js → chunk-index-xxeb2xp0.js} +3 -3
  78. package/dist/{chunk-index-hczrjnky.js → chunk-index-zyvwhxga.js} +1 -1
  79. package/dist/chunk-lang-css-y9133ktr.js +1 -0
  80. package/dist/{chunk-lang-dockerfile-tjxsnhr9.js → chunk-lang-dockerfile-cnwqn660.js} +1 -1
  81. package/dist/{chunk-lang-go-drmfa25k.js → chunk-lang-go-yy6kgsxv.js} +2 -2
  82. package/dist/chunk-lang-html-r2xmryek.js +1 -0
  83. package/dist/chunk-lang-javascript-1r6wd177.js +1 -0
  84. package/dist/{chunk-lang-json-790swysy.js → chunk-lang-json-dx56g11y.js} +1 -1
  85. package/dist/{chunk-lang-markdown-483dkxcq.js → chunk-lang-markdown-fpcf2dfq.js} +5 -5
  86. package/dist/{chunk-lang-python-v9s40bzj.js → chunk-lang-python-zzp95955.js} +2 -2
  87. package/dist/{chunk-lang-rust-z4gry1bf.js → chunk-lang-rust-214fh7sp.js} +1 -1
  88. package/dist/{chunk-lang-shell-egsvk8rj.js → chunk-lang-shell-1rpgtepw.js} +1 -1
  89. package/dist/{chunk-lang-sql-75j3denr.js → chunk-lang-sql-vvp46hpj.js} +2 -2
  90. package/dist/{chunk-lang-toml-7dbjvhex.js → chunk-lang-toml-tbj7467c.js} +1 -1
  91. package/dist/chunk-lang-typescript-y5w4tt4g.js +1 -0
  92. package/dist/{chunk-lang-xml-jg1sv4h2.js → chunk-lang-xml-tbcqmedk.js} +1 -1
  93. package/dist/{chunk-lang-yaml-g3v7s5je.js → chunk-lang-yaml-jh56t3sv.js} +1 -1
  94. package/dist/chunk-layout-actions-y73mpsh1.js +1 -0
  95. package/dist/chunk-menu-items-bza16bw6.js +2 -0
  96. package/dist/chunk-mode-toggle-nj9gnt3b.js +1 -0
  97. package/dist/chunk-note-row-6fmhrdng.js +75 -0
  98. package/dist/chunk-notes-wv0e6ssf.js +1 -0
  99. package/dist/{chunk-notice-bell-jehad6sx.js → chunk-notice-bell-9z27epd2.js} +1 -1
  100. package/dist/{chunk-notices-prqkv7ge.js → chunk-notices-fte9f196.js} +1 -1
  101. package/dist/chunk-onboarding-c5twahc3.js +1 -0
  102. package/dist/{chunk-overview-2j1s6kqg.js → chunk-overview-k4ccprax.js} +1 -1
  103. package/dist/{chunk-palette-4qt6ewem.js → chunk-palette-9rbp2fab.js} +1 -1
  104. package/dist/chunk-placement-items-me598wsb.js +1 -0
  105. package/dist/{chunk-profile-pfzyc04p.js → chunk-profile-s7r7fcvz.js} +1 -1
  106. package/dist/{chunk-prompt-history-2bcp2rky.js → chunk-prompt-history-hf296e7v.js} +1 -1
  107. package/dist/chunk-prompts-c8s0nhkm.js +1 -0
  108. package/dist/chunk-room-confirms-ga2sbvhc.js +1 -0
  109. package/dist/chunk-room-menu-7h4jym2b.js +1 -0
  110. package/dist/chunk-rooms-menu-button-pgtaanb6.js +1 -0
  111. package/dist/{chunk-schedules-64h9gfwn.js → chunk-schedules-mbnwcxpc.js} +1 -1
  112. package/dist/{chunk-seat-menu-vrpc40v9.js → chunk-seat-menu-r0k0eawr.js} +1 -1
  113. package/dist/chunk-sheet-hosts-a5dfevy9.js +1 -0
  114. package/dist/{chunk-shortcut-help-bdbkdcs9.js → chunk-shortcut-help-a6pkjcq7.js} +2 -2
  115. package/dist/{chunk-shortcuts-qft33r8t.js → chunk-shortcuts-cgt87jkz.js} +1 -1
  116. package/dist/chunk-skill-editor-67yk4x7t.js +8 -0
  117. package/dist/chunk-skills-rewemey4.js +1 -0
  118. package/dist/chunk-switcher-list-t8rbay2y.js +1 -0
  119. package/dist/{chunk-tab-dot-1p68ybf8.js → chunk-tab-dot-vr11dfrw.js} +1 -1
  120. package/dist/chunk-table-52nh0azk.js +1 -0
  121. package/dist/chunk-table2d-g57vr6h0.js +1 -0
  122. package/dist/chunk-table3d-rp0w6kt4.js +4220 -0
  123. package/dist/chunk-thread-actions-qcxt1y1g.js +1 -0
  124. package/dist/{chunk-thread-cards-t794fp4d.js → chunk-thread-cards-c2mrp2gj.js} +1 -1
  125. package/dist/chunk-thread-list-0071q455.js +217 -0
  126. package/dist/{chunk-transcript-km4e3aey.js → chunk-transcript-789yqysq.js} +1 -1
  127. package/dist/chunk-where-hmwmme9e.js +1 -0
  128. package/dist/{chunk-workspace-d064v56e.js → chunk-workspace-wr1qrtsh.js} +2 -2
  129. package/dist/chunk-zh-tw-z5p5mpph.js +1 -0
  130. package/dist/index.html +1 -1
  131. package/dist/sw.js +1 -1
  132. package/package.json +3 -3
  133. package/src/api-types.ts +51 -0
  134. package/src/app/app.ts +38 -4
  135. package/src/app/helper-routes.ts +106 -0
  136. package/src/app/rooms.ts +18 -3
  137. package/src/app/routes.ts +20 -0
  138. package/src/app/surface.ts +18 -1
  139. package/src/app/team-routes.ts +21 -1
  140. package/src/i18n/zh-tw.ts +46 -9
  141. package/dist/chunk-account-hck7mhf8.js +0 -1
  142. package/dist/chunk-action-menu-beqh40k6.js +0 -1
  143. package/dist/chunk-agent-znnth24t.js +0 -1
  144. package/dist/chunk-arranged-rooms-wfakrddk.js +0 -1
  145. package/dist/chunk-bulk-actions-c4tkvk9g.js +0 -1
  146. package/dist/chunk-character-creator-qwcsdytw.js +0 -1
  147. package/dist/chunk-confirm-z95j9jt3.js +0 -1
  148. package/dist/chunk-entry-hrt97qed.js +0 -1
  149. package/dist/chunk-folder-list-nemtqbnc.js +0 -1
  150. package/dist/chunk-folds-xpg9qcwf.js +0 -1
  151. package/dist/chunk-group-scene-g24kxz6f.js +0 -1
  152. package/dist/chunk-group-table-851jm8ef.js +0 -1
  153. package/dist/chunk-host-icons-23zhqpmc.js +0 -1
  154. package/dist/chunk-host-picture-8tnh2wam.js +0 -1
  155. package/dist/chunk-host-state-j41sp065.js +0 -1
  156. package/dist/chunk-host-ui-cje7a9t9.js +0 -1
  157. package/dist/chunk-index-3k7sdph2.js +0 -1
  158. package/dist/chunk-index-4jf4jvfd.css +0 -1
  159. package/dist/chunk-index-4s1qj9we.js +0 -2
  160. package/dist/chunk-index-5fz5e1ct.js +0 -2
  161. package/dist/chunk-index-azrnzgev.js +0 -2
  162. package/dist/chunk-index-c2ag3qw2.js +0 -2
  163. package/dist/chunk-index-efgm0066.js +0 -2
  164. package/dist/chunk-index-fe0m5mht.js +0 -2
  165. package/dist/chunk-index-hrtyanda.js +0 -2
  166. package/dist/chunk-index-j479p62w.js +0 -2
  167. package/dist/chunk-index-kankja6p.js +0 -50
  168. package/dist/chunk-index-kb44jp50.js +0 -2
  169. package/dist/chunk-index-mnwdbb4n.js +0 -2
  170. package/dist/chunk-index-n6zrc05a.js +0 -2
  171. package/dist/chunk-index-n93wqszt.js +0 -8
  172. package/dist/chunk-index-nrexxkar.js +0 -2
  173. package/dist/chunk-index-pgxgq61x.js +0 -2
  174. package/dist/chunk-index-q5vzjqr5.js +0 -2
  175. package/dist/chunk-index-qqwk157d.js +0 -2
  176. package/dist/chunk-index-r3tqhew8.js +0 -2
  177. package/dist/chunk-index-rg9vh59e.js +0 -1
  178. package/dist/chunk-index-sxq69p1f.js +0 -2
  179. package/dist/chunk-index-taq2psr6.js +0 -2
  180. package/dist/chunk-index-wc83vb0a.js +0 -2
  181. package/dist/chunk-index-xbs8q4kn.js +0 -2
  182. package/dist/chunk-index-xxbveevc.js +0 -2
  183. package/dist/chunk-index-zx6yka30.js +0 -2
  184. package/dist/chunk-lang-css-yrc25qk9.js +0 -1
  185. package/dist/chunk-lang-html-rwe8epvf.js +0 -1
  186. package/dist/chunk-lang-javascript-d6x6qjtg.js +0 -1
  187. package/dist/chunk-lang-typescript-1rv9vdcz.js +0 -1
  188. package/dist/chunk-layout-actions-6assr93n.js +0 -1
  189. package/dist/chunk-menu-items-9szcza00.js +0 -2
  190. package/dist/chunk-mode-toggle-bzbq7ycq.js +0 -1
  191. package/dist/chunk-note-row-g20h11pm.js +0 -75
  192. package/dist/chunk-notes-gc8bssxn.js +0 -1
  193. package/dist/chunk-onboarding-mdtc2mb7.js +0 -1
  194. package/dist/chunk-placement-items-2eect825.js +0 -1
  195. package/dist/chunk-prompts-052mb05y.js +0 -1
  196. package/dist/chunk-room-confirms-asvmjh5s.js +0 -1
  197. package/dist/chunk-room-menu-dm2r2hk6.js +0 -1
  198. package/dist/chunk-rooms-menu-button-32hemzxc.js +0 -1
  199. package/dist/chunk-sheet-hosts-jaqx490x.js +0 -1
  200. package/dist/chunk-skill-editor-z3dx2895.js +0 -8
  201. package/dist/chunk-skills-4jfcv39n.js +0 -1
  202. package/dist/chunk-switcher-list-xysjd4tw.js +0 -1
  203. package/dist/chunk-table-0v4q4dx3.js +0 -1
  204. package/dist/chunk-table-seats-f683hx8k.js +0 -1
  205. package/dist/chunk-table2d-1a6atjhj.js +0 -1
  206. package/dist/chunk-table3d-k0ffeffj.js +0 -4220
  207. package/dist/chunk-thread-actions-4rpfg4fq.js +0 -1
  208. package/dist/chunk-thread-list-1pcygpka.js +0 -1
  209. package/dist/chunk-where-phjwqggy.js +0 -1
  210. package/dist/chunk-zh-tw-qf18hcxc.js +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,35 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.27.0] - 2026-10-31
9
+
10
+ ### Added
11
+
12
+ - Temp knights in the owner app. A knight's temp knights (see the core changelog) hang under it in the room list, in the plain and the arranged list alike, each with a small face, its name and a state: a pulsing dot while it works, the card badge while it waits for you, and a dimmed "Ended" with the time once finished. They follow the knight's pin and folder and have no drag handle; the group of them is unfolded while one is at work and folded when all have ended, per device. `RoomView.helper` (`{ parent, parentName, finished? }`) marks them, on the agent view and the profile too; the round table, the council tick list, the group editor and the switcher leave them out, and their push is held back by default since their answers reach the knight's room (a card still pushes).
13
+ - **Clear finished temp knights** in the room list's menu, a folder's menu and a knight's menu, left out when nothing has ended. It archives at once, with no confirmation, through `POST api/rooms/archive-finished-helpers` (`{ rooms? }`, owner only), and the notice's Undo calls `POST api/rooms/restore-helpers` (`{ names }`) with exactly the names that were archived. A temp knight's own menu has **Archive this temp knight** the same way, and its room header reads "Temp knight · Made by <knight>" with a link to the knight. When a knight clears its own with `helper_end`, its room shows a line naming them with an Undo. The archive page lists each temp knight right after its knight.
14
+ - The round table is a council. The owners' table shows one agent group with its members (2 to 8) at the podiums and the group's room in the dialogue box, so a message sent there starts a round under the group's rules; there is no second store. A header chip (**Council: <name> ▾**) opens the council sheet: the saved councils (the groups), a tick list of the knights with a counter (**3 of 8 picked**; the ninth tick is refused), **Done** to save the ticks into the council on the table in place, and **Save as a new council** to make another group (which opens its Discord channel like every group). `#/table/<group>` is the council; without an address the table shows the council this device chose last, or the first group. With no group yet the table says *No council yet* and the sheet starts from the knights that were not muted. `FIXTURE_COUNCIL` sizes the fixture's group.
15
+ - A seat's menu (long press, right click, Menu key) has **Private chat** and **Remove from the council** (it saves the group without the knight; the last two members cannot be removed, the council is offered for archiving).
16
+ - Turn-taking in a group round. A `round` frame (and `RoomView.round` for a page that opens mid-round) tells who speaks, who is next, who has spoken, the reply count out of 8 and how the round ended. An **order strip** on top of the group's dialogue box shows the faces in that order (spoken dimmed with a check, the speaker larger, next numbered) with a chip (*Reply 3 of 8*, *Limit reached*, *Round stopped*), and says when your message waits for the next round; while it runs the seats wear the same check or ① to ⑧ before their names (`TableHandle.setMark`), the seat the round names speaks, and the camera turns to the speaker as its turn starts. The same strip is in a group room's table view.
17
+ - A hosted table (a member or an admin) has an **All rooms** button in the header that opens the room list.
18
+
19
+ ### Changed
20
+
21
+ - The core peer range moves to `>=0.27.0 <0.28.0`.
22
+ - Stop in a group room ends the whole round (see the core changelog), and its button reads **Stop the round**.
23
+ - A group holds 2 to 8 members (it was 2 to 6), on the web and on Discord. A round still holds at most 8 replies.
24
+ - A tap on a seat turns the camera to that knight and no longer opens the knight's room; the address stays as it was. Hold the seat for the private chat.
25
+ - Mute only stops push. It no longer takes a knight off the table: who sits is the council's members. Owners who used mute to thin out the table see their first group, or the empty state, after this change.
26
+ - The table seats at most 8 and never shows a "+N" podium, on the owners' table and on a hosted one (the hosted table seats the 8 newest rooms; the rest are in the room list).
27
+ - The owners' table no longer seats host rooms (a support desk's tickets, say); they are in the room list and the notices. A hosted table is unchanged otherwise.
28
+
29
+ ### Removed
30
+
31
+ - The **Who's at the table** sheet and the seat menu's **Leave the table**.
32
+
33
+ ### Fixed
34
+
35
+ - `pi-roundtable-web`: the owner app's small visual faults from the 0.26.2 pass. A popover opened near the window's right edge (the ⋯ menu on a finished thread card) is placed by its own width and keeps the edge's 8px margin, where it used to be measured while squeezed against the edge and sat about 4px from it. A thread card's time moved to its status row, so a long title keeps the whole row above it and no longer truncates beside "1 minute ago" on a phone. A thread named inside a message (the "Started …" line a dispatch posts) is a plain inline link again: it had taken the thread card's block layout, which cut the sentence into fragments in the round table's dialogue box; the box also keeps the newest words of a long line in view while it is typed out, until the person scrolls up. At phone widths every text input, textarea and select is 16px or larger, including the controls inside a label and the full-screen prompt and SKILL.md editor, so iOS no longer zooms in on focus; a test reads the page's styles and fails on any rule that sets a text control smaller.
36
+
8
37
  ## [0.26.3] - 2026-10-30
9
38
 
10
39
  ### Added
package/README.md CHANGED
@@ -30,7 +30,7 @@ Then only a person whose principal holds the owner role gets in.
30
30
 
31
31
  ## Requirements
32
32
 
33
- - Bun 1.4.4 or later, and pi-roundtable `>=0.26.0 <0.27.0` as a peer dependency.
33
+ - Bun 1.4.4 or later, and pi-roundtable `>=0.27.0 <0.28.0` as a peer dependency.
34
34
  - The host must run on the machine that holds its data directory: the console reads `<dataDir>/sessions` from disk, and the app keeps its files and keys under `<dataDir>/web/`.
35
35
  - An agent team: `agents` in the configuration, with or without `discord`. Without Discord the host also needs a surface that hosts rooms, and this plugin is one; the start fails otherwise, naming the fix.
36
36
  - A way to authenticate the owners (see [Authentication](#authentication)): a password, Cloudflare Access or a verifier of your own in front of the listener, or `none` on a listener only the owner reaches.
@@ -153,6 +153,12 @@ Each thread is a card in that list: its title, its room's knight, a badge (in pr
153
153
 
154
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.
155
155
 
156
+ #### Temp knights
157
+
158
+ A knight's temp knights (the helpers it makes with `helper_create`, see the core guide) hang under its row like threads: a small face, the name, and a state, a pulsing dot while it works, the card badge while it waits for you, and a dimmed **Ended** with the time once it has nothing running, queued or waiting. The group of them is unfolded while one is at work and folded when all have ended, as the person last chose on this device. They follow the knight's pin and folder, have no drag handle and no seat at the round table, are left out of groups, the council tick list and the switcher, and their push is held back by default because their answers reach the knight's room (a card still pushes). A temp knight's room works like any other room: you may write to it directly, and its header reads "Temp knight · Made by <knight>" with a link to the knight.
159
+ **Clear finished temp knights** is in the room list's menu, a folder's menu and a knight's menu, and is left out when nothing has ended. It archives at once, with no confirmation, and the notice's Undo restores exactly those. A temp knight's own menu has **Archive this temp knight**, with the same notice. When a knight clears its own with `helper_end`, its room shows a line naming them with an Undo. The archive page lists each temp knight right after its knight.
160
+ The routes are `POST api/rooms/archive-finished-helpers` (body `{ "rooms": [<keys>] }` of knights' rooms, at most 500; left out, every knight's; answers `{ "archived": [{ "room", "names" }] }`) and `POST api/rooms/restore-helpers` (body `{ "names": [<names>] }`, at most 500; answers `{ "restored": [<names>] }`; a name that is not a temp knight is refused with `400` and named, and one that is no longer archived is passed over). Both are the owners', like the rest of `api/rooms`. `RoomView.helper` is `{ parent, parentName, finished? }` on a temp knight's room.
161
+
156
162
 
157
163
  ### Making and arranging agents
158
164
 
@@ -162,7 +168,7 @@ An owner changes the team from the app. Everything goes through the agent server
162
168
  - **Archive and restore.** Archive is in the agent sheet and in the ⋯ menu and long-press menu of a room (the coordinator's room has none). It asks first, naming the agent or group. An archived agent stops answering, its schedules are cancelled and it leaves its groups; its history is kept. **Archived** in the **+** menu lists what is archived with Restore and Delete. Restoring an agent does not put it back in its groups; restoring a group needs all its members active, otherwise it is refused and stays archived.
163
169
  - **Delete.** Only an archived agent or group can be deleted, from the archive, after a question that names it. Deleting frees the name, removes the agent's group cursors and detaches its skills, and clears what this app kept of the room (its messages, its cards, its mute and its modes). A Discord channel, if the agent had one, stays under Archive with its history, since Discord is never asked to delete a channel.
164
170
  - **Skills.** The agent sheet lists the host's skills (the Skills pane's catalog when the host supplies it, else the skills addon's own) with a switch each, applied as it is flipped and from the agent's next turn. Built-in skills are carried by every agent and stay on. A host without the skills addon shows nothing.
165
- - **Groups.** New group and Edit group (the group's header name, its ⋯ menu and its row menu) take a name, 2 to 6 members in the order they are picked, and the host who answers when nobody else fits; Edit sends only what changed. Archive group asks first.
171
+ - **Groups.** New group and Edit group (the group's header name, its ⋯ menu and its row menu) take a name, 2 to 8 members in the order they are picked, and the host who answers when nobody else fits; Edit sends only what changed. Archive group asks first.
166
172
 
167
173
  All of it is for owners: the owner's tier is read again on each call, a change needs the console's `Origin`, and a room or agent that does not exist is a 404. Every change tells the open pages to read the room list again.
168
174
 
@@ -236,21 +242,22 @@ Every agent is drawn as its composed character (`pi-roundtable/characters`). The
236
242
 
237
243
  ### The round table
238
244
 
239
- The `table` pane is a council hall: a ring of tall dark-wood podiums, one for each active agent whose room is not muted (the coordinator first) and one low lip at the near edge for you, under torches, banners and a stained-glass window, around a glowing rune circle. The hall is drawn in the characters' own flat, outlined style (a stepped tone gradient and a dark line round every shape, no photographic textures). Dark is the hall at night, light the same hall by day; the Modern and Camelot looks change the banners and the trim, not the hall. Each agent stands behind its podium as a waist-up standee: the character without its frame, cut out with a thin light rim, a dark line and a visible board thickness, turning to the camera within limits. A seat's state comes from the same rules as the room list (`sleepy` sits as `idle`): a thinking seat shows a "…" badge and bobs, a seat with a card waiting a gold "!", a speaking seat has a light on its podium and the concept art's three gold emphasis strokes beside its head; a change of face redraws that one picture once it has stood for 300 ms. More than twelve agents show twelve and a "+N" podium that opens the list.
245
+ The `table` pane is a council hall: a ring of tall dark-wood podiums, one for each member of the council on the table, at most eight (the coordinator first), and one low lip at the near edge for you, under torches, banners and a stained-glass window, around a glowing rune circle. The hall is drawn in the characters' own flat, outlined style (a stepped tone gradient and a dark line round every shape, no photographic textures). Dark is the hall at night, light the same hall by day; the Modern and Camelot looks change the banners and the trim, not the hall. Each agent stands behind its podium as a waist-up standee: the character without its frame, cut out with a thin light rim, a dark line and a visible board thickness, turning to the camera within limits. A seat's state comes from the same rules as the room list (`sleepy` sits as `idle`): a thinking seat shows a "…" badge and bobs, a seat with a card waiting a gold "!", a speaking seat has a light on its podium and the concept art's three gold emphasis strokes beside its head; a change of face redraws that one picture once it has stood for 300 ms. The table never shows a "+N" podium: a council has eight members at most, and an agent that is not a member is not drawn.
240
246
 
241
- If the host has kinds of room the owner may list (for example a support desk's ticket rooms), the owners' table seats those host rooms too, after the agents and newest first, by the same lists and `access` as the member table below; a tap on such a seat opens the room's own page. A host with no host room kinds seats agents only.
247
+ The table is a **council**: one agent group (the same group as the group chat, with no second store) shown with its members. Host rooms (a support desk's ticket rooms, say) are not on the owners' table; they are in the room list and the notices. Only a member's or an admin's table, below, seats host rooms.
242
248
 
243
249
  This section describes the owners' table. A member or an admin is served the table only when the host names it for their tier, and theirs seats host rooms instead of agents: see [What each tier is served](#what-each-tier-is-served).
244
250
 
245
251
  - **Cameras.** The overview stands behind your podium, raised. A drag or swipe turns it round the ring and snaps to a podium; the wheel or a pinch moves in on the podium across the ring and back out. A close-up of a speaker stands low inside the ring, tilted a little, with thin speed lines flashing for 400 ms on a new speaker. A turn follows the ring the shorter way and takes 450 to 650 ms. A swipe never starts within 32 px of the screen's edge. Under `prefers-reduced-motion` the camera cuts, with no speed lines, bob or flicker.
246
- - **Talking in the scene.** A tap on a podium (or on its name, a button over the plate) turns the camera to that agent and slides up a dialogue box on the agent's own room: a nameplate tab in the agent's color with its picture, the line being said (Markdown, typed out while it streams, a tap shows it whole), the cards waiting for an answer, and the room's own message box, with its unsent text kept per room. **Log** opens the room's whole message list as a sheet over the scene. The address is `#/table/<agent>` (the agent's name or the key of its room): Back returns to the whole ring, a link opens the scene at that agent, and an address that names nobody seated goes back to `#/table`.
252
+ - **Talking in the scene.** The dialogue box at the bottom is the council's group room: a nameplate tab in the speaker's color with their picture, the line being said (Markdown, typed out while it streams, a tap shows it whole), the cards waiting for an answer, and the room's message box, with its unsent text kept per room. A message sent there starts a round under the group's rules. A tap on a podium (or on its name, a button over the plate) turns the camera to that member until the next line comes; **Reset view** brings it back to the whole ring; holding a seat (a long press, a right click or the Menu key) opens its menu with **Private chat** (the knight's own room) and **Remove from the council**. **Log** opens the room's whole message list as a sheet over the scene. The address is `#/table/<group>` (the group's name or the key of its room): without one the table shows the council this device chose last (kept in the browser's storage), or the first group, and an address that names no group goes back to `#/table`.
247
253
  - **Names.** A seat's name is a button laid over its podium's nameplate, at least 12 px on the screen at any distance, in a font stack that carries Chinese (`system-ui`, PingFang TC, Noto Sans TC, Microsoft JhengHei); the podium's own plate is lettered the same way. The seat's full name and state are its accessible name. Where the names stand over each other (many seats on a phone) the agents are also listed as buttons under the scene.
248
- - **Phones.** Held upright, the scene fills the top 55 % and the dialogue box the rest, and the box collapses to its nameplate line; on its side the scene is whole and the box lies over its bottom third. The seats are also listed as buttons with more than ten seats.
254
+ - **Phones.** Held upright, the scene fills the top 55 % and the dialogue box the rest, and the box collapses to its nameplate line; on its side the scene is whole and the box lies over its bottom third.
249
255
  - **Fallback.** Without WebGL (or after a lost context) the same ring is drawn as SVG in the same palette, with the same standees, plates and dialogue box, never a blank pane. `?nogl` in the page address (`/console/?nogl`, or `#/table?nogl`) draws it on a browser that has WebGL, to try that path; `nogl=0` and `nogl=false` leave the choice to the browser.
250
256
  - **Performance.** The WebGL scene is a chunk of its own, fetched when the view first opens and cached by the service worker, never precached. It stops drawing while the page is hidden or the table is off screen, draws a few frames a second while nothing moves (so a torch flickers without keeping the GPU busy), and caps the pixel ratio at 2 (1.5 on phones).
251
- - **Who sits.** With many agents the table can be thinned out. **Who's at the table** (a button in the page's header) opens a sheet, a bottom sheet on a phone and a dialog elsewhere, that lists every agent with its picture and a switch; an agent switched off leaves the table, and switched on sits down again. Leaving the table *is* muting the agent's room push (the per-room mute, `PUT rooms/<key>/mute`, shared by every owner and device), so there is one switch behind the table, the agent sheet and the room menu: the table seats exactly the agents whose room is not muted, and muting a room anywhere takes its agent off the table. A seat's menu (a long press, a right click or the Menu key) and the ⋯ button of the dialogue box also offer **Leave the table**. An agent off the table stays in the rooms list with its bell-slash, and the table re-seats at once, the camera staying where it was unless it was on the agent who left, when it goes back to the whole ring (`#/table`, in place). With everyone off the table the page says so and offers the sheet. A group room's table is not affected: it seats all its members, muted or not.
257
+ - **The council.** The header's chip (**Council: <name> ▾**) opens a sheet, a bottom sheet on a phone and a dialog elsewhere. It lists the saved councils (the groups, with their members' faces; pressing one puts it on the table, with the same puff, glide and rise as a seat leaving or joining), and a tick list of every knight with a counter (**3 of 8 picked**): the ninth tick is refused and the sheet says *At most 8 knights*. Ticks keep the order they were made in, which is the group's tie order, and the host is chosen among the ticked. **Done** saves the ticks into the council on the table in place (`PATCH api/groups/<name>`); **Save as a new council** asks for a name and makes another group (`POST api/groups`), which opens its Discord channel as every group does. With no group yet the table says *No council yet* and the sheet starts from the knights that were not muted, the coordinator first, at most eight, to be named and saved. Who sits is no longer mute's say: mute only stops a room's push, stays in the knight's sheet and the room menu, and a muted knight sits when the council has it. Owners who used mute to take knights off the table see their first group (or the empty state) after this change.
252
258
  - **Leaving and joining.** An agent who leaves goes in a manga-style puff: the standee squashes a little, flat outlined clouds pop up round it and hide it, then drift up and fade with a few sparkles (about 0.7 s). The other seats then glide to their new places with the camera. An agent who sits down is called up out of a small rune circle in the hall's teal that glows on the floor at its new place; the podium rises out of it with a slight bounce, under a column of light (about 0.85 s), once the others have opened the gap. The pictures are drawn on small canvases in the hall's style and given back when the show ends. Under `prefers-reduced-motion` the picture only dips and comes back (0.16 s each way), with no smoke or rise; the 2D fallback fades the seat in over a ring and out inside a puff with CSS.
253
- - **Group rooms.** A group room's header has a "Table" button that switches the room between its list and the scene; the choice is kept per room. In the scene the whole conversation runs in the dialogue box, the camera turns to whoever replies, and it rests on the whole ring while you speak; a member that starts thinking shows its badge wherever the camera is, and a speaker change never takes the focus from your message box. Under the Camelot look a compact strip of the members stands under the header in the list, with the speaker lit.
259
+ - **Group rooms.** The same scene is a group room's: its header has a "Table" button that switches the room between its list and the scene; the choice is kept per room. In the scene the whole conversation runs in the dialogue box, the camera turns to whoever replies, and it rests on the whole ring while you speak; a member that starts thinking shows its badge wherever the camera is, and a speaker change never takes the focus from your message box. Under the Camelot look a compact strip of the members stands under the header in the list, with the speaker lit.
260
+ - **Turn-taking.** A group round is the members' answers to one message, one after another. The server tells the page where it stands in a `round` frame (`{ type: "round", room, round }`, and `RoomView.round` for a page that opens mid-round): `id` (the group message that opened it), `state`, `current`, `next` (the queue, a handoff appended), `spoken`, `replies` and `limit` (8), `ended` (`done`, `limit` or `stopped`) and `queued` (your messages waiting for the next round). An **order strip** on top of the dialogue box shows the faces in that order: those who spoke dimmed with a check, the one speaking larger, those who are next numbered, and a chip, *Reply 3 of 8*, that reads *Limit reached*, *Round stopped* or *n of 8 replies* once it ended; the strip of the last round stays until the next starts. While it runs the seats wear the same signs before their names (a check, or ① to ⑧; a round that ended leaves them bare), the seat of the member the round says speaks is lit, and the camera turns to it as soon as its turn starts, not when its line arrives; a camera you turned by hand stays until the next line or the next speaker. While a message of yours waits, the strip says so. The box's stop button reads **Stop the round**: it stops the member speaking and the ones waiting do not speak, on the web and in Discord alike.
254
261
 
255
262
  ### The files pane
256
263
 
@@ -338,7 +345,7 @@ A member's socket receives nothing from an agent room, neither as it happens nor
338
345
 
339
346
  `panes` takes a list for the owners and, with `admission: "access"`, `{ owner, admin?, member }` to choose per tier. The default gives a member `rooms` (the host's own rooms only), `conversations`, `notes`, `schedules` and `profile`, of those the host serves; an admin's list is the member's unless given. A member is never served `overview`, `workspace`, `skills` or `connectors`, and naming one for them stops the start. `table` is the one pane whose name a host may give a member or an admin (it needs that tier's `rooms` pane, and the owners' list must have it too): the default lists leave it out, so it is served only where the host names it.
340
347
 
341
- - **The round table for members and admins**: the agent rooms are the owners', so a member's or an admin's table seats none of them. It seats the host rooms of every kind they may list (`GET api/host/<kind>`, the same lists and the same kind `access` as their room list, so a room the kind does not give them is no seat), newest first, in the same ring and the same looks. No new route is added: the table asks only for those lists. A seat is lit from its room's own frames, which the page follows by `subscribe` for the seats the scene draws (at most twelve), and a follow is answered only for a room the person may read now: `activity` (thinking, working, a turn already running when they follow) and the cards are addressed to the room's readers, as they are in the room, and a room they may not read sends nothing, however they ask. A room that asks for something in the kind's list (`attention`) sits as waiting. A tap on a seat opens that room's own page, where what the person may write (a note, a turn to the agent, or nothing) and press is decided by the kind's `access` as everywhere else, so the table has no dialogue box, no seat menu and no **Who's at the table** sheet for them (those mute and arrange agent rooms, which are the owners'), and an address `#/table/<seat>` goes back to the whole ring. The "+N" podium opens the room list. The table sends the person nothing of the overview, the files pane, the skills or the presence of the team, and the owners' view is unchanged.
348
+ - **The round table for members and admins**: the agent rooms are the owners', so a member's or an admin's table seats none of them. It seats the host rooms of every kind they may list (`GET api/host/<kind>`, the same lists and the same kind `access` as their room list, so a room the kind does not give them is no seat), newest first, in the same ring and the same looks. No new route is added: the table asks only for those lists. A seat is lit from its room's own frames, which the page follows by `subscribe` for the seats the scene draws (at most eight), and a follow is answered only for a room the person may read now: `activity` (thinking, working, a turn already running when they follow) and the cards are addressed to the room's readers, as they are in the room, and a room they may not read sends nothing, however they ask. A room that asks for something in the kind's list (`attention`) sits as waiting. A tap on a seat opens that room's own page, where what the person may write (a note, a turn to the agent, or nothing) and press is decided by the kind's `access` as everywhere else, so the table has no dialogue box, no seat menu and no council sheet for them (those arrange agent groups, which are the owners'), and an address `#/table/<seat>` goes back to the whole ring. A header button, **All rooms**, opens the room list; the table never shows a "+N" podium. The table sends the person nothing of the overview, the files pane, the skills or the presence of the team, and the owners' view is unchanged.
342
349
  - **Conversations**: a member lists and reads only the private conversations the registry records as theirs, found by the registry; `exclude(key, record)` is asked on every list and every transcript read.
343
350
  - **Notes**: their own only. Asking for another person's is `403`. The pane is left out, with a warning, when the host keeps no memory (`MEMORY`); naming it with none is an error.
344
351
  - **Schedules**: their own, whichever of the 0.8 and the current id the schedule names them by; an owner sees every schedule.
@@ -884,7 +891,7 @@ The `rooms` pane's page and any client of your own talk to the host in this prot
884
891
 
885
892
  - Page to server: `hello {visible, focus?}`, `visibility`, `focus {room?}`, `send {id, room, text, uploads?}`, `stop {room}`, `approval {prompt, approved}`, `answer {prompt, answer}`, `answers {prompt, answers, note?}`, `cancel {prompt}`; for a host room also `subscribe {room}`, `unsubscribe {room}`, `act {id, room, action, card?, input?}` and `read {room, upTo}`.
886
893
  - Server to page: `ready {protocol, principal, name, uploads: {perMessage, maxBytes}}` (then every open card), `accepted`, `refused {id?, prompt?, code}` (`id` names a refused `send`, `prompt` a refused answer to a card), `message`, `progress` (only for the focused room), `activity {room, typing, stoppable, phase?, agent?, outcome?}` (`phase` is `working` during a tool call and `thinking` otherwise; `agent` names the member speaking in a group round; `outcome` is `done` or `failed` and comes only on the frame where `typing` turns false), `presence {agents: {<name>: {busy}}}` (after `ready` and when it changes; `busy` includes work in Discord channels), `edited` (a stored message changed its text, such as a thread's start line once the thread exists), `prompt`, `prompt_closed {prompt, outcome, note?, by?, answer?, closedAt?}`, `mode`, `auto_approved`, `changed`.
887
- - REST under `<mount>/api/`: `session`, `rooms`, `rooms/<key>/messages?before=&limit=` (`{messages, more, cards}`: the cards of the room that opened within the page's span, from the first message's time on, or from the beginning when `more` is false, and before the first message of the next page), `PUT rooms/<key>/mode`, `PUT rooms/<key>/mute` (body `{muted: boolean}`; the room's push is off for every owner while true; a waiting card still pushes), `PUT rooms/<key>/pin` (body `{pinned: boolean, before?: key | null}`) and `PUT rooms/<key>/folder` (body `{folder: id | null, before?: key | null}`; `before` is the room it goes before, none or an unknown room for the end; `400` for Home and a dispatch thread, `404` for an unknown room or folder), `POST folders` (body `{name}`, `201`), `PATCH folders/<id>` (body `{name?, before?: id | null}`), `DELETE folders/<id>`, `PUT folders/<id>/mute` (body `{muted: boolean}`; answers `{muted, rooms}`), all of which answer with the whole layout `{pins, folders}` (except the mute), and `GET rooms` answering `{rooms, pins, folders}`, `POST rooms/<key>/start-over`, `POST uploads`, `DELETE uploads/<id>`, `files/<id>`, `schedules` (`GET`, and `DELETE schedules/<id>`), `agents/<name>` (`GET`, `PATCH`), `GET agents/<name>/prompt-history` (`{versions}`, newest first), `GET prompts` (`{documents}`), `GET` and `PUT prompts/<id>` (body `{text, base}`; `409 {error, conflict, current}` when `base` is not the text in force), `POST prompts/<id>/revert` (body `{base}`; the same `409`), `GET prompts/<id>/history`, `GET` and `PUT skill-docs/<name>` (body `{text, baseHash}`; `409` with `current`), `POST skill-docs` (body `{text}`; `201`), `GET skill-docs/<name>/history`, `PUT agents/<name>/character` (body `{character}`, at most 4 KiB; `400 {error, field}` for a look that is not a character), `POST agents` (body `{name, displayName, prompt, model?, thinking?, task?, character?, skills?}`; `201` with the profile; `400` for what the agent server refuses, `{error, field}` for a look), `POST agents/<name>/archive`, `POST agents/<name>/restore` (the profile), `DELETE agents/<name>` (an archived agent only; `400` for an active one), `GET` and `PUT agents/<name>/skills` (`{skills: [{name, description?, source, builtin, carried, missing?}]}`; the body of `PUT` is `{add?, remove?}`, one change that an unknown or built-in name refuses whole; `404` when the host has no skills), `POST groups` (body `{name, displayName, members, host?}`; `201`), `GET`, `PATCH` (`{displayName?, members?, host?}`) and `DELETE groups/<name>`, `POST groups/<name>/archive` and `POST groups/<name>/restore`, `GET archive` (`{entries}`: the archived agents and groups), `models`, `workspace` (the [files pane](#the-files-pane)'s calls), and for push `GET push/key`, `GET`, `POST` and `DELETE push/subscriptions` and `DELETE push/subscriptions/<id>`. The agents' pictures are at `<mount>/avatars/<hash>.png`.
894
+ - REST under `<mount>/api/`: `session`, `rooms`, `rooms/<key>/messages?before=&limit=` (`{messages, more, cards}`: the cards of the room that opened within the page's span, from the first message's time on, or from the beginning when `more` is false, and before the first message of the next page), `PUT rooms/<key>/mode`, `PUT rooms/<key>/mute` (body `{muted: boolean}`; the room's push is off for every owner while true; a waiting card still pushes), `PUT rooms/<key>/pin` (body `{pinned: boolean, before?: key | null}`) and `PUT rooms/<key>/folder` (body `{folder: id | null, before?: key | null}`; `before` is the room it goes before, none or an unknown room for the end; `400` for Home and a dispatch thread, `404` for an unknown room or folder), `POST folders` (body `{name}`, `201`), `PATCH folders/<id>` (body `{name?, before?: id | null}`), `DELETE folders/<id>`, `PUT folders/<id>/mute` (body `{muted: boolean}`; answers `{muted, rooms}`), all of which answer with the whole layout `{pins, folders}` (except the mute), and `GET rooms` answering `{rooms, pins, folders}`, `POST rooms/<key>/start-over`, `POST rooms/archive-finished-helpers` and `POST rooms/restore-helpers` (see [Temp knights](#temp-knights)), `POST uploads`, `DELETE uploads/<id>`, `files/<id>`, `schedules` (`GET`, and `DELETE schedules/<id>`), `agents/<name>` (`GET`, `PATCH`), `GET agents/<name>/prompt-history` (`{versions}`, newest first), `GET prompts` (`{documents}`), `GET` and `PUT prompts/<id>` (body `{text, base}`; `409 {error, conflict, current}` when `base` is not the text in force), `POST prompts/<id>/revert` (body `{base}`; the same `409`), `GET prompts/<id>/history`, `GET` and `PUT skill-docs/<name>` (body `{text, baseHash}`; `409` with `current`), `POST skill-docs` (body `{text}`; `201`), `GET skill-docs/<name>/history`, `PUT agents/<name>/character` (body `{character}`, at most 4 KiB; `400 {error, field}` for a look that is not a character), `POST agents` (body `{name, displayName, prompt, model?, thinking?, task?, character?, skills?}`; `201` with the profile; `400` for what the agent server refuses, `{error, field}` for a look), `POST agents/<name>/archive`, `POST agents/<name>/restore` (the profile), `DELETE agents/<name>` (an archived agent only; `400` for an active one), `GET` and `PUT agents/<name>/skills` (`{skills: [{name, description?, source, builtin, carried, missing?}]}`; the body of `PUT` is `{add?, remove?}`, one change that an unknown or built-in name refuses whole; `404` when the host has no skills), `POST groups` (body `{name, displayName, members, host?}`; `201`), `GET`, `PATCH` (`{displayName?, members?, host?}`) and `DELETE groups/<name>`, `POST groups/<name>/archive` and `POST groups/<name>/restore`, `GET archive` (`{entries}`: the archived agents and groups, a temp knight's entry carrying its `parent`), `models`, `workspace` (the [files pane](#the-files-pane)'s calls), and for push `GET push/key`, `GET`, `POST` and `DELETE push/subscriptions` and `DELETE push/subscriptions/<id>`. The agents' pictures are at `<mount>/avatars/<hash>.png`.
888
895
  - Beside the API: `<mount>/manifest.webmanifest`, `<mount>/sw.js`, `<mount>/icons/<name>.png` (and `mark.svg`), `<mount>/theme-init.js`, and in password mode `<mount>/login`, `POST <mount>/auth/login` and `POST <mount>/auth/logout`.
889
896
 
890
897
  A room key from a page must be one of the app's rooms whose agent or group exists; every other key, Discord's included, is refused. Every write needs an owner, whose tier is read again, and REST writes also need the console's `Origin`. A card can be answered by any owner, except a card that is the speaker's alone, which only the speaker's principal answers. After `cardGraceSeconds` (default 120) a turn goes on without the answer and the card stays open for a day; an answer then starts a new turn in the room. The types are in `src/api-types.ts`.
@@ -929,7 +936,7 @@ The fixture host has two owners, so the Notes pane shows its principal picker.
929
936
 
930
937
  `bun run fixture:app` starts the owner app over a scratch PostgreSQL database (`ROUNDTABLE_TEST_DATABASE_URL`, whose server may create a database; the fixture makes one and drops it when it stops) with two scripted agents and a group, no Discord, and no authentication on a loopback port (4180).
931
938
  Start a message with a keyword and the agent acts it out: `approve` (a held action with details), `ask`, `quiz` (a questionnaire), `timeout` (the time-limit card), `late` (a card the turn stops waiting on), `stream` (streamed text and tool chips), `dispatch` (a coding job in a thread) or `exchange` (the agent asks the scout in a thread).
932
- `LOOK=camelot` starts the host in the Camelot look, and `FIXTURE_AGENTS` seats up to twelve agents at the round table.
939
+ `LOOK=camelot` starts the host in the Camelot look, `FIXTURE_AGENTS` gives the host up to twelve agents, and `FIXTURE_COUNCIL` makes the group `crew`, the council on the round table, up to eight members of them.
933
940
  The header of `scripts/fixture-app.ts` lists the control port that sends a message as the owner and sets a room's modes.
934
941
 
935
942
  The page is React, bundled with Bun's bundler into relative URLs, so it works under any `mountPath`.
@@ -0,0 +1 @@
1
+ import{h,Q,S,e,w}from"./chunk-index-2e4am3hw.js";var a={profile:S(()=>(h("s7r7fcvz"),import("./chunk-profile-s7r7fcvz.js")).then((o)=>({default:o.ProfilePage}))),notices:S(()=>(h("fte9f196"),import("./chunk-notices-fte9f196.js")).then((o)=>({default:o.NoticesPage}))),onboarding:S(()=>(h("c5twahc3"),import("./chunk-onboarding-c5twahc3.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};
@@ -0,0 +1 @@
1
+ import{s,Qe,a,r,m,e,n,o,St,Xo}from"./chunk-index-2e4am3hw.js";import{L}from"./chunk-index-8d81qy69.js";var x=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches,g={rtMenu:!0},H=()=>Boolean(window.history.state?.rtMenu),y=8,M=(t)=>t?.isConnected?t:null;function b(t){return t.items.map((i)=>n("button",{type:"button",role:i.checked===void 0?"menuitem":"menuitemcheckbox",...i.checked===void 0?{}:{"aria-checked":i.checked},className:"menu-item menu-link","data-tone":i.tone,onClick:()=>t.onChoose(i),children:[i.icon?e("span",{className:"menu-icon","data-tone":i.tone,children:e(o,{name:i.icon,size:18})}):null,e("span",{className:"menu-text",children:e("strong",{children:i.label})}),i.checked?e(o,{name:"check",size:18,className:"menu-check"}):null]},i.id))}function T({menu:t}){let i=a(void 0);if(t)i.current=t;let l=i.current,f=a(!1),v=a(void 0),h=t?.serial;return s(()=>{if(h===void 0)return;return window.history.pushState(g,"",window.location.href),f.current=!0,()=>{if(f.current)f.current=!1,window.history.back()}},[h]),s(()=>{let p=()=>{if(!f.current||H())return;f.current=!1,St();let E=v.current;v.current=void 0,E?.()};return window.addEventListener("popstate",p),()=>window.removeEventListener("popstate",p)},[]),e(L,{open:t!==void 0,title:l?.title??"",onClose:St,restoreFocus:()=>M(l?.source??null),children:l?e("div",{className:"menu action-items",role:"menu","aria-label":l.title,children:e(b,{items:l.items,onChoose:(p)=>{if(!f.current){St(),p.run();return}v.current=p.run,window.history.back()}})}):null})}function D({menu:t}){let i=a(null),[l,f]=r(t.at),{source:v}=t,h=(u)=>{M(v)?.focus(),St(),u?.()},p=a(h);p.current=h,Qe(()=>{let u=i.current;if(!u)return;let d={left:u.style.left,top:u.style.top};u.style.left="0px",u.style.top="0px";let c={width:u.offsetWidth,height:u.offsetHeight};u.style.left=d.left,u.style.top=d.top,f({x:Math.max(y,Math.min(t.at.x,window.innerWidth-c.width-y)),y:Math.max(y,Math.min(t.at.y,window.innerHeight-c.height-y))}),u.querySelector('[role^="menuitem"]')?.focus()},[t.serial]),s(()=>{let u=(c)=>{if(c.target instanceof Node&&i.current?.contains(c.target))return;St()},d=()=>St();return document.addEventListener("pointerdown",u,!0),document.addEventListener("wheel",u,{capture:!0,passive:!0}),document.addEventListener("touchmove",u,{capture:!0,passive:!0}),window.addEventListener("resize",d),()=>{document.removeEventListener("pointerdown",u,!0),document.removeEventListener("wheel",u,!0),document.removeEventListener("touchmove",u,!0),window.removeEventListener("resize",d)}},[]);let E=(u)=>{let d=[...i.current?.querySelectorAll('[role^="menuitem"]')??[]],c=d.indexOf(document.activeElement),w=(k)=>{u.preventDefault(),d[(k+d.length)%d.length]?.focus()};switch(u.key){case"Escape":u.preventDefault(),u.stopPropagation(),p.current();return;case"ArrowDown":return w(c+1);case"ArrowUp":return w(c<0?-1:c-1);case"Tab":return w(u.shiftKey?c<0?-1:c-1:c+1);case"Home":return w(0);case"End":return w(-1)}};return e("div",{ref:i,className:"action-popover",role:"menu","aria-label":t.title,tabIndex:-1,style:{left:`${l.x}px`,top:`${l.y}px`},onKeyDown:E,children:e(b,{items:t.items,onChoose:(u)=>h(u.run)})})}function O(){let t=Xo(),i=a(void 0);if(t&&i.current?.serial!==t.serial)i.current={serial:t.serial,sheet:x()};let l=Boolean(t&&i.current?.sheet);return n(m,{children:[e(T,{menu:l?t:void 0}),t&&!l?e(D,{menu:t},t.serial):null]})}export{O as ActionMenuHost};
@@ -0,0 +1 @@
1
+ import{s,e,D,u,w,rt}from"./chunk-index-2e4am3hw.js";function c({name:o}){let i=u((t)=>t.listed),r=u((t)=>Object.values(t.rooms).find((m)=>m.view?.kind==="agent"&&m.view.name===o)?.view?.key,o);return s(()=>{if(r)D("room",r,{replace:!0}),rt(o);else if(i)D("rooms",void 0,{replace:!0})},[r,i,o]),e("div",{className:"page",children:e(w,{})})}export{c as AgentPage};
@@ -0,0 +1 @@
1
+ import{h,Q,S,J,M,a,t,m,e,n,o,ke,u,_,k,pe,Wt,On,ne,Ji,yi,Mr,At,bi,Rr}from"./chunk-index-2e4am3hw.js";import{Ce}from"./chunk-index-j4kk1m59.js";import{si}from"./chunk-index-02vfshtt.js";import"./chunk-index-e2dqjde8.js";import"./chunk-index-kbrg32sx.js";import{Jn}from"./chunk-index-pefwfm26.js";import{ri,oi}from"./chunk-index-xxeb2xp0.js";import{Bt}from"./chunk-index-12zyshae.js";import"./chunk-index-b8cpvr7y.js";import"./chunk-index-rh0x9rzf.js";import{ot}from"./chunk-index-g1awv7rk.js";ri();var F=S(()=>(h("4gcj7g7h"),import("./chunk-folder-list-4gcj7g7h.js")).then((s)=>({default:s.FolderList}))),O=J(function(d){let{view:r}=d,p=Bt(()=>Wt(r.key),r.home?void 0:oi(r.key));return e(Mr,{...d,press:p,item:{...r.home?{}:{"data-drop-item":"","data-key":r.key},...d.arranging?{"data-arranging":""}:{}},after:d.arranging?e("button",{type:"button",className:"icon-button row-more","aria-haspopup":"menu","aria-label":t("Room menu"),onClick:(c)=>{let g=c.currentTarget;Wt(r.key).then((i)=>{if(!i)return;let y=g.getBoundingClientRect();pe({...i,at:{x:y.left,y:y.bottom},via:"key",source:g})},()=>{return})},children:e(o,{name:"more",size:18})}):null})});function L(s){let{now:d}=ne(),{timeZone:r}=k(),p=At(s.rooms);return e("ul",{className:"room-list",children:p.map(({key:c,...g})=>{let i=s.threads[c];return e(O,{...g,active:c===s.active,now:d,timeZone:r,arranging:s.arranging,...i?{threads:e(bi,{open:i.open,closed:i.closed,active:s.active,parent:c})}:{}},c)})})}function v(s){let r=At(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(L,{rooms:s.rooms,threads:s.threads,active:s.active,arranging:s.arranging})]})}function re(s){let d=Boolean(k().kinds?.length),r=u((l)=>JSON.stringify({listed:l.listed,...ot(l,(K)=>ke(l,K))})),p=si(),c=a(r);if(!p)c.current=r;let g=c.current,{listed:i,...y}=M(()=>JSON.parse(g),[g]),{home:w,pinned:z,folders:N,restAgents:P,restGroups:T,rest:A,threads:C,orphans:f}=y,R=Ji(),D=w.length+z.length+A.length===0&&N.every((l)=>l.rooms.length===0)&&f.open.length+f.closed.length===0,b={threads:C,active:s.active,arranging:R};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:(l)=>Jn(l.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:(l)=>On(l.currentTarget),children:e(o,{name:"plus"})})]})]}),R?n("div",{className:"arrange-bar",children:[n("button",{type:"button",className:"secondary",onClick:()=>Ce({kind:"new"}),children:[e(o,{name:"plus",size:16}),e("span",{children:t("Add a folder")})]}),e("button",{type:"button",onClick:()=>yi(!1),children:t("Done")})]}):null,i&&D&&!d?e(_,{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:w,...b}),e(v,{title:t("Pinned"),rooms:z,zone:{kind:"pinned",id:"pinned"},...b}),N.length>0?e("div",{className:"stack folder-list","data-folder-list":"",children:e(Q,{fallback:e("div",{className:"skeleton","aria-busy":"true"}),children:e(F,{folders:N,active:s.active,listed:i,rooms:(l)=>e(L,{rooms:l,threads:C,active:s.active,arranging:R})})})}):null,N.length>0?e(v,{title:t("Ungrouped"),rooms:A,zone:{kind:"rest",id:"rest"},...b}):n(m,{children:[e(v,{title:t("Knights"),rooms:P,zone:{kind:"rest",id:"rest-agents"},...b}),e(v,{title:t("Groups"),rooms:T,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(bi,{open:f.open,closed:f.closed,active:s.active})]}):null,e(Rr,{active:s.active})]})}export{re as ArrangedRoomsPage};
@@ -0,0 +1 @@
1
+ import{t,te,y,d,f}from"./chunk-index-2e4am3hw.js";import{nn}from"./chunk-index-kbrg32sx.js";import"./chunk-index-e2dqjde8.js";import{Sn,Lr}from"./chunk-index-6bkcq9ka.js";import{ee}from"./chunk-index-cdctnw71.js";import{Wr}from"./chunk-index-b8cpvr7y.js";import"./chunk-index-rh0x9rzf.js";var s=500,c=(n)=>{let r=[];for(let e=0;e<n.length;e+=s)r.push(n.slice(e,e+s));return r},i=()=>y.dispatch({type:"changed"});async function P(n){let r=Wr(n),e=Object.keys(r);if(e.length===0)return;let a=[];try{for(let o of c(e))a.push(...(await Sn.readAll(o)).moved)}catch(o){f(d(o),"danger"),i();return}nn(Object.fromEntries(e.map((o)=>[o,0]))),f(te(e.length,"Marked {count} room as read","Marked {count} rooms as read"),"info",a.length?{label:t("Undo"),run:()=>void m(a,r)}:void 0)}async function m(n,r){try{for(let e of c(n)){let{restored:a}=await Sn.unreadAll(e);nn(Object.fromEntries(a.map((o)=>[o,r[o]??0])))}}catch(e){f(d(e),"danger")}i()}var R=(n)=>Lr(n);async function l(n){try{await Sn.restoreHelpers(n)}catch(r){f(d(r),"danger")}i()}async function T(n){let r;try{r=(await Sn.archiveFinishedHelpers(n)).archived.flatMap((a)=>a.names)}catch(e){f(d(e),"danger"),i();return}if(i(),r.length===0)return;f(te(r.length,"Archived {count} temp knight","Archived {count} temp knights"),"info",{label:t("Undo"),run:()=>void l(r)})}async function x(n,r){try{await ee.archiveAgent(n)}catch(e){f(d(e),"danger"),i();return}i(),f(t("Archived {name}",{name:r}),"info",{label:t("Undo"),run:()=>void l([n])})}export{x as archiveHelper,R as clearAllFinished,T as clearFinishedHelpers,P as markAllRead,l as putBackHelpers};
@@ -0,0 +1 @@
1
+ import{Ze,Ht,G,vi,xn}from"./chunk-index-b73y2gc0.js";import{J,xr,s,N,M,a,r,t,c,m,e,n,di,ce,O,d,f,yn,ue,We,He}from"./chunk-index-2e4am3hw.js";import{K}from"./chunk-index-jgzygbt8.js";import{L}from"./chunk-index-8d81qy69.js";var fe={"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 b=`character.${i}.${l}`,g=t(b);if(g!==b)return g;if(i==="class")return G.classes[l]?.label??Y(l);return fe[`${i}.${l}`]??Y(l)}function Z(i){let l=`character.jobs.${i}`,b=t(l);return b!==l?b: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]}],me=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")},he={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(Ze),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(ue,{spec:l.spec,size:l.size,live:!1}),e("span",{children:l.label})]})});function ge(i,l,b){let g=JSON.stringify({...i,[l]:0});return M(()=>b.map((u)=>({...i,[l]:u})),[g,l,b])}function pe(){let i=a(null),[l,b]=r();return s(()=>{let g=i.current;if(!g)return;let u=()=>{let v=g.scrollLeft>1,w=g.scrollLeft+g.clientWidth<g.scrollWidth-1;b(v&&w?"both":w?"end":v?"start":void 0)};u(),g.addEventListener("scroll",u,{passive:!0});let p=typeof ResizeObserver>"u"?void 0:new ResizeObserver(u);return p?.observe(g),()=>{g.removeEventListener("scroll",u),p?.disconnect()}},[]),[i,l]}function ye(i){let{part:l}=i,b=ge(i.shown,l.field,l.ids),[g,u]=pe();return e("div",{className:"creator-strip",ref:g,"data-more":u,children:l.ids.map((p,v)=>e(ie,{data:{[`data-${l.field}`]:p},spec:b[v],size:44,label:S(l.field,p),pressed:i.draft[l.field]===p,onPick:()=>i.onPick(p)},p))})}function H(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 Me(i){let[l,b]=r(i.character),g=xr(l),[u,p]=r({}),[v,w]=r(!1),[R,ne]=r("idle"),[U,T]=r(),[I,_]=r(),j=He("(max-width: 719px)"),V=a(null),D=N(),oe=We(l),se=yn(),A=te(l)!==te(i.character);s(()=>b(i.character),[i.character]),s(()=>{if(!A||i.onPick)return;let o=(y)=>y.preventDefault(),h=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let E=y.target instanceof Element?y.target.closest("a"):null;if(!E||E.target||E.hasAttribute("download"))return;if(V.current?.contains(E))return;y.preventDefault(),y.stopPropagation(),T({kind:"link",anchor:E})},B=di((y)=>T({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",o),document.addEventListener("click",h,!0),()=>{B(),window.removeEventListener("beforeunload",o),document.removeEventListener("click",h,!0)}},[A,i.onPick]);let C=(o)=>{p({}),b((h)=>vi(o,h))},le=async()=>{if(i.onPick){i.onPick(W(l),l);return}w(!0),p({});try{let o=await O.setCharacter(i.name,W(l));i.onSaved?.(o),f(t("Saved."))}catch(o){let h=o instanceof ce&&o.field?o.field.split(".")[0]:void 0,B=h&&me.has(h)?h:"*";p({[B]:d(o)})}finally{w(!1)}},de=async()=>{let o=U;if(b(i.character),p({}),o?.kind==="link")setTimeout(()=>o.anchor.click(),0);else if(o?.kind==="navigate")o.proceed()},q=e(P,{field:"class",title:t("Class"),error:u.class,children:e("div",{className:"creator-grid",children:Ze.map((o)=>e(ke,{id:o,base:g,pressed:l.class===o,onPick:()=>C({class:o,colors:l.colors})},o))})}),x=n(P,{field:"colors",title:t("Colors"),error:u.colors??u.palette,children:[n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Palette")}),re.map((o)=>{let h=G.palettes[o];return e(H,{data:{"data-palette":o},label:S("palette",o),pressed:l.palette===o,background:`linear-gradient(135deg, ${h.primary} 52%, ${h.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:(h)=>C({colors:{[o]:h.target.value}})})]},o))})]}),Q=z.map((o)=>e(P,{field:o.field,title:t(o.title),error:u[o.field],children:e(ye,{part:o,draft:l,shown:g,onPick:(h)=>C({[o.field]:h})})},o.field)),X=n(m,{children:[e(P,{field:"build",title:t("Build"),error:u.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:`${D}-build`,checked:l.build===o,onChange:()=>C({build:o})}),ae(o)]},o))]})}),e(P,{field:"skin",title:t("Skin tone"),error:u.skin,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Skin tone")}),(se??G.skins).map((o,h)=>e(H,{data:{"data-skin":String(h)},label:t("Skin tone {n}",{n:h+1}),pressed:l.skin===h,background:o,onPick:()=>C({skin:h})},h))]})}),e(P,{field:"hairColor",title:t("Hair color"),error:u.hairColor,children:n("fieldset",{className:"creator-swatches",children:[e("legend",{className:"visually-hidden",children:t("Hair color")}),G.hairColors.map((o,h)=>e(H,{data:{"data-hair-color":o},label:t("Hair color {n}",{n:h+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})})]})})]}),F=[{id:"class",title:t("Class"),summary:S("class",l.class),error:u.class,node:q},{id:"colors",title:t("Colors"),summary:l.palette?S("palette",l.palette):l.colors.primary,error:u.colors??u.palette,node:x},...z.map((o,h)=>({id:o.field,title:t(o.title),summary:S(o.field,l[o.field]),error:u[o.field],node:Q[h]})),{id:"body",title:t("Body"),summary:ae(l.build),error:u.build??u.skin??u.hairColor,node:X}];return n("form",{ref:V,className:"creator",style:oe,"aria-labelledby":D,onSubmit:(o)=>{if(o.preventDefault(),(A||i.onPick)&&!v)le()},children:[e("h2",{id:D,className:"visually-hidden",children:t("Character of {name}",{name:i.displayName})}),n("div",{className:"creator-preview",children:[e(ue,{spec:l,name:i.name,state:R,size:176,label:t("{name}, {state}",{name:i.displayName,state:t(ee[R])})}),e("button",{type:"button",className:"secondary","data-action":"cycle",onClick:()=>ne((o)=>Ht[(Ht.indexOf(o)+1)%Ht.length]??"idle"),children:t("Preview states")}),e("span",{className:"meta","aria-live":"polite",children:t(ee[R])})]}),n("div",{className:"creator-body",children:[u["*"]?e("p",{className:"field-error",role:"alert","data-field":"*",children:u["*"]}):null,j?e("ul",{className:"creator-sections",children:F.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(m,{children:[q,x,Q,X]}),n("div",{className:"actions creator-actions",children:[e("button",{type:"button",className:"secondary","data-action":"suggest",onClick:()=>{p({}),b(xn({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(A)T({kind:"cancel"})},children:t("Cancel")}),e("button",{type:"submit","data-action":"save",disabled:!A&&!i.onPick||v,children:v?t("Saving…"):i.onPick?t("Use this look"):t("Save")})]})]}),e(L,{open:j&&I!==void 0,title:F.find((o)=>o.id===I)?.title??"",onClose:()=>_(void 0),children:e("div",{className:"stack",children:F.find((o)=>o.id===I)?.node})}),e(K,{open:U!==void 0,title:t("Discard your changes?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>T(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(he[i]);function ke(i){let l=i.base.colors,b=M(()=>vi({class:i.id,colors:l}),[i.id,l]);return e(ie,{data:{"data-class":i.id},spec:b,size:56,label:S("class",i.id),hint:Z(i.id),pressed:i.pressed,onPick:i.onPick})}export{Me as CharacterCreator};
@@ -1,2 +1,2 @@
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};
1
+ import{q,me,Pi,so,Qi,ft,ge,l,x,we,ze,Xt,Ie,F,se,ae,U,yt,bt,De,Oe,C,ie,Pe,b,kt,ao,lo,co,Mi,Zn,uo,fo,ho,po,T,i,A,Je,Dt,Hn,ar,Tn,Pn,Oo,yo,pt}from"./chunk-index-cbqhzf40.js";import{h}from"./chunk-index-2e4am3hw.js";var nn=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=be(e.state,n.from);return r.line?rn(e):r.block?ln(e):!1};function ve(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=ve(an,0);var on=ve(Ye,0);var ln=ve((e,t)=>Ye(e,t,cn(t)),0);function be(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 f,m;if(o-r<=2*G)f=m=e.sliceDoc(r,o);else f=e.sliceDoc(r,r+G),m=e.sliceDoc(o-G,o);let p=/^\s*/.exec(f)[0].length,E=/\s*$/.exec(m)[0].length,M=m.length-E-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-E-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)=>be(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=be(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,E=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:E,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 xe=Ie.define(),un=Ie.define(),hn=x.define(),Ze=x.define({combine(e){return yt(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=we.define({create(){return D.empty},update(e,t){let n=t.state.facet(Ze),r=t.annotation(xe);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 D(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(se.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let s=y.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 D(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&&ge.fromJSON(e.changes),[],e.mapped&&ft.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 ye(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?[y.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 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,F.mapEffects(e.effects,t),c,e.startSelection.map(s),r)}var Sn=/^(input\.type|delete)($|\.)/;class D{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 D(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 y(e.changes.compose(c.changes),nt(F.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,k));else s=Q(s,s.length,r.minDepth,e);return new D(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 D(rt(this.done,e),this.undone,t,n)}addMapping(e){return new D(ye(this.done,e),ye(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:xe.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=ye(c,o.mapped);return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:xe.of({side:e,rest:c,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}D.empty=new D(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 I(e,t){return l.create(e.ranges.map(t),e.mainIndex)}function L(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function B({state:e,dispatch:t},n){let r=I(e.selection,n);if(r.eq(e.selection,!0))return!1;return t(L(e,r)),!0}function Y(e,t){return l.cursor(t?e.to:e.from)}function lt(e,t){return B(e,(n)=>n.empty?e.moveByChar(n,t):Y(n,t))}function g(e){return e.textDirectionAt(e.state.selection.main.head)==ie.LTR}var it=(e)=>lt(e,!g(e)),st=(e)=>lt(e,g(e));function ct(e,t){return B(e,(n)=>n.empty?e.moveByGroup(n,t):Y(n,t))}var kn=(e)=>ct(e,!g(e)),vn=(e)=>ct(e,g(e));var Kr=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function bn(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=A(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(bn(e,d,o))r=d;else u=n?d.to:d.from}let s=r.type.prop(o),c,a;if(s&&(c=n?pt(e,r.from,1):pt(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 Cn=(e)=>B(e,(t)=>Z(e.state,t,!g(e))),Mn=(e)=>B(e,(t)=>Z(e.state,t,g(e)));function at(e,t){return B(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 ut=(e)=>at(e,!1),ht=(e)=>at(e,!0);function dt(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 mt(e,t){let n=dt(e),{state:r}=e,o=I(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(L(r,o),{effects:s}),!0}var Ue=(e)=>mt(e,!1),Se=(e)=>mt(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 An=(e)=>B(e,(t)=>w(e,t,!0)),Ln=(e)=>B(e,(t)=>w(e,t,!1)),Bn=(e)=>B(e,(t)=>w(e,t,!g(e))),Dn=(e)=>B(e,(t)=>w(e,t,g(e))),En=(e)=>B(e,(t)=>e.moveToLineBoundary(t,!1,!1)),wn=(e)=>B(e,(t)=>e.moveToLineBoundary(t,!0,!1));function Wn(e,t,n){let r=!1,o=I(e.selection,(s)=>{let c=pt(e,s.head,-1)||pt(e,s.head,1)||s.head>0&&pt(e,s.head-1,1)||s.head<e.doc.length&&pt(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(L(e,o)),!0}var Rn=({state:e,dispatch:t})=>Wn(e,t,!1);function v(e,t,n){let r=I(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(L(e.state,r)),!0}function gt(e,t){return v(e,t,(n)=>e.moveByChar(n,t))}var xt=(e)=>gt(e,!g(e)),St=(e)=>gt(e,g(e));function vt(e,t){return v(e,t,(n)=>e.moveByGroup(n,t))}var On=(e)=>vt(e,!g(e)),Fn=(e)=>vt(e,g(e));var In=(e)=>{let t=!g(e);return v(e,t,(n)=>Z(e.state,n,t))},Nn=(e)=>{let t=g(e);return v(e,t,(n)=>Z(e.state,n,t))};function Ct(e,t){return v(e,t,(n)=>e.moveVertically(n,t))}var Mt=(e)=>Ct(e,!1),At=(e)=>Ct(e,!0);function Lt(e,t){return v(e,t,(n)=>e.moveVertically(n,t,dt(e).height))}var _e=(e)=>Lt(e,!1),$e=(e)=>Lt(e,!0),qn=(e)=>v(e,!0,(t)=>w(e,t,!0)),Vn=(e)=>v(e,!1,(t)=>w(e,t,!1)),Gn=(e)=>{let t=!g(e);return v(e,t,(n)=>w(e,n,t))},Un=(e)=>{let t=g(e);return v(e,t,(n)=>w(e,n,t))},zn=(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)),Ke=({state:e,dispatch:t})=>(t(L(e,{anchor:0})),!0),He=({state:e,dispatch:t})=>(t(L(e,{anchor:e.doc.length})),!0),Qe=({state:e,dispatch:t})=>(t(L(e,{anchor:e.selection.main.anchor,head:0})),!0),je=({state:e,dispatch:t})=>(t(L(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Jn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),$n=({state:e,dispatch:t})=>{let n=ee(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},Kn=({state:e,dispatch:t})=>{let n=I(e.selection,(r)=>{let o=A(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(L(e,n)),!0};function Bt(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(L(n,l.create(o,o.length-1))),!0}var Qn=(e)=>Bt(e,!1),jn=(e)=>Bt(e,!0),Xn=({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(L(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 Et=(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=De(a,s.tabSize),f=d%Dt(s)||Dt(s);for(let m=0;m<f&&a[a.length-1-m]==" ";m++)o--;u=o}else if(u=me(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=me(c.text,u-c.from,!1,!1)+c.from;return u}),ke=(e)=>Et(e,!1,!0);var Tt=(e)=>Et(e,!0,!1),wt=(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=me(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)=>wt(e,!1),Yn=(e)=>wt(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:q.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:me(s.text,o-s.from,!1)+s.from,a=o==s.to?o+1:me(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 ee(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 Rt(e,t,n){if(e.readOnly)return!1;let r=[],o=[];for(let s of ee(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})=>Rt(e,t,!1),ir=({state:e,dispatch:t})=>Rt(e,t,!0);function Ot(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of ee(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})=>Ot(e,t,!1),cr=({state:e,dispatch:t})=>Ot(e,t,!0),ur=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(ee(t).map(({from:o,to:s})=>{if(o>0)o--;else if(s<t.doc.length)s++;return{from:o,to:s}})),r=I(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 hr(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=A(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 Xe=Ft(!1),fr=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&&hr(t,s);if(e)s=c=(c<=a.to?a:t.doc.lineAt(c)).to;let d=new Tn(t,{simulateBreak:s,simulateDoubleBreak:!!u}),f=ar(d,s);if(f==null)f=De(/^\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=["",Hn(t,f)];if(u)m.push(Hn(t,d.lineIndent(a.from,-1)));return{changes:{from:s,to:c,insert:q.of(m)},range:l.cursor(s+1+m[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ce(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 dr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Tn(e,{overrideIndentation:(s)=>{let c=n[s];return c==null?-1:c}}),o=Ce(e,(s,c,a)=>{let u=ar(r,s.from);if(u==null)return;if(!/\S/.test(s.text))u=0;let d=/^\s*/.exec(s.text)[0],f=Hn(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},te=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Ce(e,(n,r)=>{r.push({from:n.from,insert:e.facet(Je)})}),{userEvent:"input.indent"})),!0},It=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(Ce(e,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let s=De(o,e.tabSize),c=0,a=Hn(e,Math.max(0,s-Dt(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},mr=(e)=>(e.setTabFocusMode(),!0);var pr=[{key:"Ctrl-b",run:it,shift:xt,preventDefault:!0},{key:"Ctrl-f",run:st,shift:St},{key:"Ctrl-p",run:ut,shift:Mt},{key:"Ctrl-n",run:ht,shift:At},{key:"Ctrl-a",run:En,shift:zn},{key:"Ctrl-e",run:wn,shift:_n},{key:"Ctrl-d",run:Tt},{key:"Ctrl-h",run:ke},{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:Se}],gr=[{key:"ArrowLeft",run:it,shift:xt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:kn,shift:On,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Bn,shift:Gn,preventDefault:!0},{key:"ArrowRight",run:st,shift:St,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vn,shift:Fn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Dn,shift:Un,preventDefault:!0},{key:"ArrowUp",run:ut,shift:Mt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ke,shift:Qe},{mac:"Ctrl-ArrowUp",run:Ue,shift:_e},{key:"ArrowDown",run:ht,shift:At,preventDefault:!0},{mac:"Cmd-ArrowDown",run:He,shift:je},{mac:"Ctrl-ArrowDown",run:Se,shift:$e},{key:"PageUp",run:Ue,shift:_e},{key:"PageDown",run:Se,shift:$e},{key:"Home",run:Ln,shift:Vn,preventDefault:!0},{key:"Mod-Home",run:Ke,shift:Qe},{key:"End",run:An,shift:qn,preventDefault:!0},{key:"Mod-End",run:He,shift:je},{key:"Enter",run:Xe,shift:Xe},{key:"Mod-a",run:Jn},{key:"Backspace",run:ke,shift:ke,preventDefault:!0},{key:"Delete",run:Tt,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Wt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Yn,preventDefault:!0},{mac:"Mod-Backspace",run:tr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(pr.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),Pt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Cn,shift:In},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Mn,shift:Nn},{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:Qn},{key:"Mod-Alt-ArrowDown",run:jn},{key:"Escape",run:Xn},{key:"Mod-Enter",run:fr},{key:"Alt-l",mac:"Ctrl-l",run:$n},{key:"Mod-i",run:Kn,preventDefault:!0},{key:"Mod-[",run:It},{key:"Mod-]",run:te},{key:"Mod-Alt-\\",run:dr},{key:"Shift-Mod-k",run:ur},{key:"Shift-Mod-\\",run:Rn},{key:"Mod-/",run:nn},{key:"Alt-A",mac:"Ctrl-A",run:on},{key:"Ctrl-m",mac:"Shift-Alt-m",run:mr}].concat(gr),Nt={key:"Tab",run:te,shift:It};var qt=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(qt(c)):qt,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 Pi(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=so(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Qi(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 Ut={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Be="gm"+(/x/.unicode==null?"":"u");class Ee{constructor(e,t,n,r=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=Ut,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Te(e,t,n,r,o);this.re=new RegExp(t,Be+((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=le(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=le(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 Me=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=Me.get(e);if(!r||r.from>=n||r.to<=t){let c=new V(t,e.sliceString(t,n));return Me.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 Me.set(e,new V(s,o)),new V(t,o.slice(t-s,n-s))}}class Te{constructor(e,t,n,r,o){this.text=e,this.to=o,this.done=!1,this.value=Ut,this.matchPos=le(e,r),this.re=new RegExp(t,Be+((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=le(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")Ee.prototype[Symbol.iterator]=Te.prototype[Symbol.iterator]=function(){return this};function yr(e){try{return new RegExp(e,Be),!0}catch(t){return!1}}function le(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 xr=(e)=>{let t=fo(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}=uo(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,E=m?+m.slice(1):0,M=f?+f:u.number;if(f&&p){let pe=M/100;if(d)pe=pe*(d=="-"?-1:1)+u.number/n.doc.lines;M=Math.round(n.doc.lines*pe)}else if(f&&d)M=M*(d=="-"?-1:1)+u.number;let Ve=n.doc.line(Math.max(1,Math.min(n.doc.lines,M))),Ge=l.cursor(Ve.from+Math.max(0,Math.min(E,Ve.length)));e.dispatch({effects:[o,b.scrollIntoView(Ge.from,{y:"center"})],selection:Ge})}),!0},Sr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},zt=x.define({combine(e){return yt(e,Sr,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function _t(e){let t=[Mr,Cr];if(e)t.push(zt.of(e));return t}var kr=C.mark({class:"cm-selectionMatch"}),vr=C.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Vt(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ae.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ae.Word)}function br(e,t,n,r){return e(t.sliceDoc(n,n+1))==ae.Word&&e(t.sliceDoc(r-1,r))==ae.Word}var Cr=Pe.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(zt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return C.none;let o=r.main,s,c=null;if(o.empty){if(!t.highlightWordAroundCursor)return C.none;let u=n.wordAt(o.head);if(!u)return C.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 C.none;if(t.wholeWords){if(s=n.sliceDoc(o.from,o.to),c=n.charCategorizer(o.head),!(Vt(c,n,o.from,o.to)&&br(c,n,o.from,o.to)))return C.none}else if(s=n.sliceDoc(o.from,o.to),!s)return C.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:f,to:m}=d.value;if(!c||Vt(c,n,f,m)){if(o.empty&&f<=o.from&&m>=o.to)a.push(vr.range(f,m));else if(f>=o.to||m<=o.from)a.push(kr.range(f,m));if(a.length>t.maxMatches)return C.none}}}return C.set(a)}},{decorations:(e)=>e.decorations}),Mr=b.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Ar=({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 Lr(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 Br=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((s)=>s.from===s.to))return Ar({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=Lr(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},O=x.define({combine(e){return yt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:(t)=>new Zt(t),scrollToMatch:(t)=>b.scrollIntoView(t)})}});function Jt(e){return e?[O.of(e),Le]:Le}class We{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||yr(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 Kt(this):new $t(this)}getCursor(e,t=0,n){let r=e.doc?e:U.create({doc:e});if(n==null)n=r.doc.length;return this.regexp?N(this,r,t,n):P(this,r,t,n)}}class Re{constructor(e){this.spec=e}}function Dr(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=Er(t.doc,t.charCategorizer(t.selection.main.head));if(e.test)o=Dr(e.test,t,o);return new R(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:(s)=>s.toLowerCase(),o)}function Er(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(ce(o,n-s))!=ae.Word||t(ue(o,n-s))!=ae.Word)&&(t(ue(o,r-s))!=ae.Word||t(ce(o,r-s))!=ae.Word)}}class $t extends Re{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 Tr(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=Tr(e.test,t,o);return new Ee(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,r)}function ce(e,t){return e.slice(me(e,t,!1),t)}function ue(e,t){return e.slice(t,me(e,t))}function wr(e){return(t,n,r)=>!r[0].length||(e(ce(r.input,r.index))!=ae.Word||e(ue(r.input,r.index))!=ae.Word)&&(e(ue(r.input,r.index+r[0].length))!=ae.Word||e(ce(r.input,r.index+r[0].length))!=ae.Word)}class Kt extends Re{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=F.define(),Fe=F.define(),W=we.define({create(e){return new oe(Ae(e).create(),null)},update(e,t){for(let n of t.effects)if(n.is(J))e=new oe(n.value.create(),e.panel);else if(n.is(Fe))e=new oe(e.query,n.value?Ne:null);return e},provide:(e)=>Zn.from(e,(t)=>t.panel)});class oe{constructor(e,t){this.query=e,this.panel=t}}var Wr=C.mark({class:"cm-searchMatch"}),Rr=C.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Or=Pe.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 C.none;let{view:n}=this,r=new bt;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?Rr:Wr)})}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:[qe(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),Qt(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:[qe(e,o),c.scrollToMatch(s.main,e)],userEvent:"select.search"}),Qt(e),!0}),Fr=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}),Ir=({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},Gt=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(qe(e,c)),f.push(n.facet(O).scrollToMatch(u.main,e));return e.dispatch({changes:m,selection:u,effects:f,userEvent:"input.replace"}),!0}),Pr=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 Ne(e){return e.state.facet(O).createPanel(e)}function Ae(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 We({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 Ht(e){let t=Mi(e,Ne);return t&&t.dom.querySelector("[main-field]")}function Qt(e){let t=Ht(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=Ht(e);if(n&&n!=e.root.activeElement){let r=Ae(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(Ae(e.state,t.query.spec)):F.appendConfig.of(Le)]});return!0},jt=(e)=>{let t=e.state.field(W,!1);if(!t||!t.panel)return!1;let n=Mi(e,Ne);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:jt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ir},{key:"Mod-Alt-g",run:xr},{key:"Mod-d",run:Br,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=Oe("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=Oe("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=Oe("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Oe("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Oe("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(r,o,s){return Oe("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=Oe("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",()=>Fr(e),[S(e,"all")]),Oe("label",null,[this.caseField,S(e,"match case")]),Oe("label",null,[this.reField,S(e,"regexp")]),Oe("label",null,[this.wordField,S(e,"by word")]),...e.state.readOnly?[]:[Oe("br"),this.replaceField,n("replace",()=>Gt(e),[S(e,"replace")]),n("replaceAll",()=>Pr(e),[S(e,"replace all")])],Oe("button",{name:"close",onclick:()=>jt(e),"aria-label":S(e,"close"),type:"button"},["×"])])}commit(){let e=new We({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(ao(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(),Gt(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 ne=30,re=/[\s\.,:;?!]/;function qe(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-ne),c=Math.min(o,n+ne),a=e.state.sliceDoc(s,c);if(s!=r.from){for(let u=0;u<ne;u++)if(!re.test(a[u+1])&&re.test(a[u])){a=a.slice(u);break}}if(c!=o){for(let u=a.length-1;u>a.length-ne;u--)if(!re.test(a[u-1])&&re.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 Nr=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"}}),Le=[W,ze.low(Or),Nr];var qr=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)"}}),Vr=Pn.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=[qr,Oo(Vr)];var Gr={typescript:()=>(h("y5w4tt4g"),import("./chunk-lang-typescript-y5w4tt4g.js")),javascript:()=>(h("1r6wd177"),import("./chunk-lang-javascript-1r6wd177.js")),json:()=>(h("dx56g11y"),import("./chunk-lang-json-dx56g11y.js")),markdown:()=>(h("fpcf2dfq"),import("./chunk-lang-markdown-fpcf2dfq.js")),css:()=>(h("y9133ktr"),import("./chunk-lang-css-y9133ktr.js")),html:()=>(h("r2xmryek"),import("./chunk-lang-html-r2xmryek.js")),python:()=>(h("zzp95955"),import("./chunk-lang-python-zzp95955.js")),yaml:()=>(h("jh56t3sv"),import("./chunk-lang-yaml-jh56t3sv.js")),go:()=>(h("yy6kgsxv"),import("./chunk-lang-go-yy6kgsxv.js")),rust:()=>(h("214fh7sp"),import("./chunk-lang-rust-214fh7sp.js")),sql:()=>(h("vvp46hpj"),import("./chunk-lang-sql-vvp46hpj.js")),xml:()=>(h("tbcqmedk"),import("./chunk-lang-xml-tbcqmedk.js")),shell:()=>(h("1rpgtepw"),import("./chunk-lang-shell-1rpgtepw.js")),toml:()=>(h("tbj7467c"),import("./chunk-lang-toml-tbj7467c.js")),dockerfile:()=>(h("cnwqn660"),import("./chunk-lang-dockerfile-cnwqn660.js"))};async function tn(e){if(e==="plain")return;try{return(await Gr[e]()).language()}catch(t){console.warn("a language for the editor failed to load",t);return}}function Ur(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 Xt,n=new Xt,r=new Xt,o=await tn(e.language),s=(m)=>[U.readOnly.of(!m),b.editable.of(m)],c={editable:e.editable,wrap:e.wrap,language:o??[]},a,u=(m)=>[ho(),co(),po(),tt(),lo(),yo(),_t(),Jt({top:!0}),Je.of(" "),U.phrases.of(e.phrases),en,kt.of([{key:"Mod-s",preventDefault:!0,run:()=>(e.onSave(),!0)},{key:"Escape",run:()=>(e.onEscape(),!0)},Nt,...Yt,...ot,...Pt]),U.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=Ur(e.parent),f=new b({parent:d.parent,root:d.root,state:U.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 E=f.scrollDOM.scrollTop;f.setState(U.create({doc:m,extensions:u(p)})),a=f.state.doc,f.scrollDOM.scrollTop=E},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:()=>{te(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-jgzygbt8.js";import"./chunk-index-8d81qy69.js";export{K as Confirm};
@@ -1 +1 @@
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
+ import{t,m,e,n,O,w,g,_,P,k}from"./chunk-index-2e4am3hw.js";import{be}from"./chunk-index-5bfqek1d.js";function p(){let{connectorAdminUrl:o}=k(),{data:r,error:s}=be(()=>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(g,{message:s}):null,!r&&!s?e(w,{}):null,r?n(m,{children:[e("h3",{children:t("Upstream gateways")}),r.gateways.length===0?e(_,{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(_,{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,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
+ import{t,c,m,e,n,v,O,w,g,_,P,k,_e,re,Me,fn,mi,ne}from"./chunk-index-2e4am3hw.js";import{be}from"./chunk-index-5bfqek1d.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}=k(),{now:i}=ne(),{data:a,error:s}=be(()=>O.conversations(),"conversations"),d=a?.conversations;if(!d)return s?e(g,{message:s}):e(w,{});return n(m,{children:[s?e(g,{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(_,{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=fn(i.channel,i.id),s=mi(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")} ${re(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")," ",_e(i.lastActive,o.now,o.timeZone)," ·"," ",Me(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{Z as ConversationsPage};