pi-roundtable-web 0.29.2 → 0.30.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 (215) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +3 -3
  3. package/dist/chunk-account-51nmc9g6.js +1 -0
  4. package/dist/{chunk-action-menu-37zgbhje.js → chunk-action-menu-mxcvx4a1.js} +1 -1
  5. package/dist/chunk-agent-x53f7c2h.js +1 -0
  6. package/dist/chunk-arranged-rooms-1w3zqdtt.js +1 -0
  7. package/dist/{chunk-attachments-3vbj05g5.js → chunk-attachments-qbv5ar62.js} +2 -2
  8. package/dist/chunk-bulk-actions-aktwxqc9.js +1 -0
  9. package/dist/{chunk-character-creator-bg3tdc8p.js → chunk-character-creator-1mfybhjz.js} +2 -2
  10. package/dist/{chunk-codeeditor-102wa9bj.js → chunk-codeeditor-y2emmmr0.js} +2 -2
  11. package/dist/chunk-command-menu-sj2kfe4d.js +59 -0
  12. package/dist/chunk-confirm-ex5kc1st.js +1 -0
  13. package/dist/{chunk-connectors-0jzzren3.js → chunk-connectors-1nmm8yc3.js} +2 -2
  14. package/dist/{chunk-conversations-3276jq4q.js → chunk-conversations-ec3aqjxs.js} +1 -1
  15. package/dist/chunk-council-sheet-hdsg3fes.js +2 -0
  16. package/dist/chunk-council-view-sba8fs4c.js +1 -0
  17. package/dist/{chunk-drag-sw692nr3.js → chunk-drag-pkghf4ts.js} +1 -1
  18. package/dist/{chunk-entry-mb6jd983.js → chunk-entry-e24gjxtd.js} +1 -1
  19. package/dist/{chunk-folder-list-g7st6p1e.js → chunk-folder-list-kghgyc0x.js} +1 -1
  20. package/dist/chunk-folds-crd9k375.js +1 -0
  21. package/dist/chunk-gate-xay9vedw.js +1 -0
  22. package/dist/chunk-host-icons-y9hd1qqd.js +1 -0
  23. package/dist/chunk-host-picture-k16n5wm3.js +1 -0
  24. package/dist/chunk-host-state-1mbsrmhk.js +1 -0
  25. package/dist/chunk-host-ui-4pymhn6v.js +1 -0
  26. package/dist/{chunk-index-e8535c4h.js → chunk-index-0dyf2gdm.js} +2 -2
  27. package/dist/chunk-index-14cxgacv.js +2 -0
  28. package/dist/{chunk-index-edjyj761.js → chunk-index-37g8ggry.js} +1 -1
  29. package/dist/chunk-index-39gw0qhr.js +2 -0
  30. package/dist/chunk-index-4p45h04z.js +2 -0
  31. package/dist/chunk-index-5e8wn6r3.js +2 -0
  32. package/dist/chunk-index-65p4hfkr.js +2 -0
  33. package/dist/{chunk-index-6yfcfcc8.js → chunk-index-6e9nmad3.js} +1 -1
  34. package/dist/chunk-index-6f4qvp5p.js +2 -0
  35. package/dist/{chunk-index-yn1vvxj2.js → chunk-index-6hy2fabj.js} +1 -1
  36. package/dist/{chunk-index-0qzqzp6t.js → chunk-index-6j75embz.js} +2 -2
  37. package/dist/{chunk-index-1tkzdy4s.js → chunk-index-70pq2k7q.js} +2 -2
  38. package/dist/{chunk-index-7gk2sdf4.js → chunk-index-726w3145.js} +3 -3
  39. package/dist/chunk-index-86x6b7dx.js +3 -0
  40. package/dist/chunk-index-8cxmgzhy.js +2 -0
  41. package/dist/{chunk-index-gmbk3sra.js → chunk-index-93dr9fh8.js} +1 -1
  42. package/dist/chunk-index-97238pp8.js +2 -0
  43. package/dist/{chunk-index-7p31pda8.js → chunk-index-ads1abh1.js} +3 -3
  44. package/dist/{chunk-index-jrj09r5c.js → chunk-index-awc03q99.js} +2 -2
  45. package/dist/chunk-index-bh6m0bpm.js +2 -0
  46. package/dist/chunk-index-br1wechm.js +2 -0
  47. package/dist/{chunk-index-qedt9szy.js → chunk-index-c8vsw9h8.js} +2 -2
  48. package/dist/{chunk-index-mey1p7h8.js → chunk-index-cd0ymvtj.js} +2 -2
  49. package/dist/{chunk-index-50w6yq2d.js → chunk-index-e3encn5p.js} +1 -1
  50. package/dist/{chunk-index-d941ae7c.js → chunk-index-fw6kawhw.js} +2 -2
  51. package/dist/{chunk-index-6ycrvwzs.js → chunk-index-g3f1sdw0.js} +2 -2
  52. package/dist/{chunk-index-6cs1wvhy.js → chunk-index-gae833v6.js} +1 -1
  53. package/dist/{chunk-index-m8bv51r9.js → chunk-index-gc30hm37.js} +2 -2
  54. package/dist/{chunk-index-5fyqxh0r.js → chunk-index-gpaychmm.js} +2 -2
  55. package/dist/chunk-index-hk6aq03d.js +2 -0
  56. package/dist/chunk-index-k3hj2310.js +2 -0
  57. package/dist/chunk-index-maf6wr1b.js +2 -0
  58. package/dist/{chunk-index-eyythjdx.js → chunk-index-mhb8mpg3.js} +2 -2
  59. package/dist/chunk-index-n92zea3s.js +2 -0
  60. package/dist/{chunk-index-m7wzrmcd.js → chunk-index-ndhwytvz.js} +2 -2
  61. package/dist/{chunk-index-qk7rp7fk.js → chunk-index-ne8v2rxx.js} +12 -12
  62. package/dist/chunk-index-p4rc9swx.js +2 -0
  63. package/dist/chunk-index-pce4byw4.js +2 -0
  64. package/dist/{chunk-index-6nja2vd8.js → chunk-index-ptvrkv0r.js} +2 -2
  65. package/dist/{chunk-index-mzw7nmkc.js → chunk-index-pz6926p5.js} +2 -2
  66. package/dist/chunk-index-qb41kkt3.js +2 -0
  67. package/dist/{chunk-index-5x3h176v.js → chunk-index-qqaaxh63.js} +2 -2
  68. package/dist/chunk-index-qwztcbjz.js +2 -0
  69. package/dist/chunk-index-r1g24er0.js +2 -0
  70. package/dist/chunk-index-rvatmx8s.js +50 -0
  71. package/dist/{chunk-index-qq86fxda.js → chunk-index-tfgd7vr5.js} +2 -2
  72. package/dist/{chunk-index-qw9a7ken.js → chunk-index-tqrjr37v.js} +2 -2
  73. package/dist/chunk-index-tvsvtd4q.js +2 -0
  74. package/dist/chunk-index-vaxytvde.js +2 -0
  75. package/dist/{chunk-index-n2v2bz8d.js → chunk-index-ve07gdef.js} +1 -1
  76. package/dist/chunk-index-vw592m3p.js +2 -0
  77. package/dist/{chunk-index-y1xv3dxs.js → chunk-index-vwd5drzh.js} +4 -4
  78. package/dist/{chunk-index-0t68az7d.js → chunk-index-vxn4zws9.js} +3 -3
  79. package/dist/{chunk-index-6m25qpa7.js → chunk-index-wqbcade7.js} +2 -2
  80. package/dist/chunk-index-x7p6k52w.js +138 -0
  81. package/dist/{chunk-index-syxwqhry.js → chunk-index-xekytvrr.js} +1 -1
  82. package/dist/{chunk-index-6q3dx093.js → chunk-index-xkb336kq.js} +2 -2
  83. package/dist/{chunk-index-sk8cvb4e.js → chunk-index-xv3e4x0j.js} +2 -2
  84. package/dist/{chunk-index-50syrmaq.js → chunk-index-xvdna54d.js} +2 -2
  85. package/dist/chunk-index-yzd9cg0s.js +1 -0
  86. package/dist/{chunk-index-tasbd41t.js → chunk-index-zr2qwzz4.js} +2 -2
  87. package/dist/chunk-lang-css-6t2q4xw4.js +1 -0
  88. package/dist/{chunk-lang-dockerfile-e87ssppx.js → chunk-lang-dockerfile-9rc0adjw.js} +1 -1
  89. package/dist/{chunk-lang-go-kbcbn346.js → chunk-lang-go-t47kg9n0.js} +2 -2
  90. package/dist/chunk-lang-html-c6p22v5m.js +1 -0
  91. package/dist/chunk-lang-javascript-m57t19pw.js +1 -0
  92. package/dist/{chunk-lang-json-4pe1fv7e.js → chunk-lang-json-y33kawwg.js} +1 -1
  93. package/dist/{chunk-lang-markdown-67cm3tjx.js → chunk-lang-markdown-2c2sqc4z.js} +4 -4
  94. package/dist/{chunk-lang-python-mnfhcvww.js → chunk-lang-python-ymasvj52.js} +2 -2
  95. package/dist/{chunk-lang-rust-e4a9s76x.js → chunk-lang-rust-qcg53mkn.js} +1 -1
  96. package/dist/{chunk-lang-shell-43nea8tq.js → chunk-lang-shell-996wb0dk.js} +1 -1
  97. package/dist/{chunk-lang-sql-28364npv.js → chunk-lang-sql-60rh2y3y.js} +2 -2
  98. package/dist/{chunk-lang-toml-a83hr7bw.js → chunk-lang-toml-q1yzt70y.js} +1 -1
  99. package/dist/chunk-lang-typescript-7gcbrhbd.js +1 -0
  100. package/dist/{chunk-lang-xml-2hv5xc8n.js → chunk-lang-xml-k2a92cm3.js} +1 -1
  101. package/dist/{chunk-lang-yaml-vw22drt8.js → chunk-lang-yaml-qp3asq06.js} +1 -1
  102. package/dist/chunk-layout-actions-yxh77zcz.js +1 -0
  103. package/dist/chunk-mention-menu-qpksygcf.js +43 -0
  104. package/dist/chunk-menu-items-95evdhk1.js +1 -0
  105. package/dist/chunk-mode-toggle-dqwvcr2p.js +1 -0
  106. package/dist/{chunk-note-row-c0trzayj.js → chunk-note-row-ngzxbdn6.js} +4 -4
  107. package/dist/chunk-notes-9ykcajzc.js +1 -0
  108. package/dist/chunk-notice-bell-eryn2k5m.js +1 -0
  109. package/dist/{chunk-notices-gkaqncqz.js → chunk-notices-jkv1derx.js} +1 -1
  110. package/dist/{chunk-onboarding-fkq9ptcw.js → chunk-onboarding-ka11bgd0.js} +1 -1
  111. package/dist/{chunk-overview-yssxbg0d.js → chunk-overview-dgvrjwbc.js} +1 -1
  112. package/dist/{chunk-palette-w6qbr7zp.js → chunk-palette-wmvynt7n.js} +1 -1
  113. package/dist/chunk-placement-items-zyqq2mp7.js +1 -0
  114. package/dist/{chunk-profile-9sjgayrx.js → chunk-profile-sdn7bs08.js} +1 -1
  115. package/dist/chunk-prompt-history-qfnj4w2y.js +1 -0
  116. package/dist/chunk-prompts-4hdcvy6t.js +1 -0
  117. package/dist/chunk-room-confirms-b8gvak47.js +1 -0
  118. package/dist/chunk-room-menu-18mnqcja.js +1 -0
  119. package/dist/chunk-rooms-menu-button-hjg4zqjy.js +1 -0
  120. package/dist/{chunk-schedules-m9mn68gt.js → chunk-schedules-cy2dv8x0.js} +1 -1
  121. package/dist/{chunk-seat-menu-3tdcr44t.js → chunk-seat-menu-cw3z9560.js} +1 -1
  122. package/dist/chunk-section-fold-9tc2m103.js +1 -0
  123. package/dist/{chunk-settings-18qmhcyr.js → chunk-settings-rhdv64p7.js} +1 -1
  124. package/dist/chunk-sheet-hosts-hhs1e3a8.js +29 -0
  125. package/dist/chunk-shortcut-help-fv6b6ntc.js +26 -0
  126. package/dist/{chunk-shortcuts-qee393s5.js → chunk-shortcuts-sjwrv858.js} +1 -1
  127. package/dist/{chunk-skill-editor-pryntvpr.js → chunk-skill-editor-zzmv9nfq.js} +2 -2
  128. package/dist/chunk-skills-b2enxk30.js +1 -0
  129. package/dist/{chunk-start-over-line-azexcxj1.js → chunk-start-over-line-4rwasr8k.js} +2 -2
  130. package/dist/{chunk-switcher-list-6hacxjfe.js → chunk-switcher-list-dcq91xxa.js} +1 -1
  131. package/dist/{chunk-tab-dot-h0eskhrt.js → chunk-tab-dot-b3gcgcrq.js} +1 -1
  132. package/dist/chunk-table-6j64ps89.js +1 -0
  133. package/dist/{chunk-table2d-vy4w4r5k.js → chunk-table2d-k4z439nt.js} +1 -1
  134. package/dist/{chunk-table3d-0a62jerb.js → chunk-table3d-mx0afnv8.js} +23 -23
  135. package/dist/chunk-thread-actions-rs5xpf1r.js +1 -0
  136. package/dist/{chunk-thread-cards-mwxzy02t.js → chunk-thread-cards-k9m7p5fn.js} +1 -1
  137. package/dist/{chunk-thread-list-52mx2m9p.js → chunk-thread-list-zz7596zy.js} +2 -2
  138. package/dist/chunk-transcript-8yjp18cr.js +1 -0
  139. package/dist/chunk-waiting-9gshhhx0.js +1 -0
  140. package/dist/{chunk-waiting-chip-wvkbsnw5.js → chunk-waiting-chip-nr9cza2j.js} +2 -2
  141. package/dist/chunk-where-8mq8azgw.js +1 -0
  142. package/dist/{chunk-workspace-ne2nkf4h.js → chunk-workspace-hdamnf4r.js} +2 -2
  143. package/dist/chunk-zh-tw-ama40y87.js +1 -0
  144. package/dist/index.html +1 -1
  145. package/dist/sw.js +1 -1
  146. package/package.json +3 -3
  147. package/src/api-types.ts +17 -0
  148. package/src/app/app.ts +3 -0
  149. package/src/app/command-routes.ts +45 -0
  150. package/src/app/routes.ts +13 -0
  151. package/src/i18n/zh-tw.ts +8 -1
  152. package/src/web-plugin.ts +2 -0
  153. package/dist/chunk-account-dq0nhfvj.js +0 -1
  154. package/dist/chunk-agent-yqe6reej.js +0 -1
  155. package/dist/chunk-arranged-rooms-sx6xg9df.js +0 -1
  156. package/dist/chunk-bulk-actions-6pehrsgb.js +0 -1
  157. package/dist/chunk-confirm-ghxga720.js +0 -1
  158. package/dist/chunk-council-sheet-7m884s44.js +0 -2
  159. package/dist/chunk-council-view-rkzcxeg8.js +0 -1
  160. package/dist/chunk-folds-rb1b069h.js +0 -1
  161. package/dist/chunk-gate-3rxxyfev.js +0 -1
  162. package/dist/chunk-host-icons-cyj62pwp.js +0 -1
  163. package/dist/chunk-host-picture-9wnhqckv.js +0 -1
  164. package/dist/chunk-host-state-b858k3p8.js +0 -1
  165. package/dist/chunk-host-ui-j6wvj0pe.js +0 -1
  166. package/dist/chunk-index-2s48qyrs.js +0 -2
  167. package/dist/chunk-index-33cqx9v2.js +0 -2
  168. package/dist/chunk-index-36m3knsk.js +0 -2
  169. package/dist/chunk-index-91wnf1k9.js +0 -1
  170. package/dist/chunk-index-9ehqccfe.js +0 -2
  171. package/dist/chunk-index-ar1x9fhw.js +0 -2
  172. package/dist/chunk-index-axw4wkqq.js +0 -2
  173. package/dist/chunk-index-b5patef1.js +0 -2
  174. package/dist/chunk-index-dagc92hw.js +0 -2
  175. package/dist/chunk-index-ddssgba9.js +0 -2
  176. package/dist/chunk-index-dpgn7kzp.js +0 -2
  177. package/dist/chunk-index-eez0kbk4.js +0 -2
  178. package/dist/chunk-index-ekp5mmvp.js +0 -2
  179. package/dist/chunk-index-fdg2qd3f.js +0 -2
  180. package/dist/chunk-index-g0sdxjxr.js +0 -2
  181. package/dist/chunk-index-hsc9yz2x.js +0 -2
  182. package/dist/chunk-index-kvztbfqj.js +0 -2
  183. package/dist/chunk-index-nncy9wxw.js +0 -2
  184. package/dist/chunk-index-p2e7rwac.js +0 -2
  185. package/dist/chunk-index-p98tt12y.js +0 -2
  186. package/dist/chunk-index-qdtmetsy.js +0 -120
  187. package/dist/chunk-index-s356ybxk.js +0 -50
  188. package/dist/chunk-index-vxqzavgz.js +0 -2
  189. package/dist/chunk-index-x5xq9g9a.js +0 -3
  190. package/dist/chunk-index-xx0kecz9.js +0 -2
  191. package/dist/chunk-lang-css-rwkzd784.js +0 -1
  192. package/dist/chunk-lang-html-zhngbs9v.js +0 -1
  193. package/dist/chunk-lang-javascript-bk2s6a56.js +0 -1
  194. package/dist/chunk-lang-typescript-r5npc6zf.js +0 -1
  195. package/dist/chunk-layout-actions-rw5myg2t.js +0 -1
  196. package/dist/chunk-menu-items-q0hy5kzd.js +0 -1
  197. package/dist/chunk-mode-toggle-yk2t0tcy.js +0 -1
  198. package/dist/chunk-notes-0xcmm938.js +0 -1
  199. package/dist/chunk-notice-bell-f9nhxg71.js +0 -1
  200. package/dist/chunk-placement-items-wcwy91mp.js +0 -1
  201. package/dist/chunk-prompt-history-kn42sf8y.js +0 -1
  202. package/dist/chunk-prompts-824fwgvh.js +0 -1
  203. package/dist/chunk-room-confirms-hvs9tra4.js +0 -1
  204. package/dist/chunk-room-menu-pkd0487m.js +0 -1
  205. package/dist/chunk-rooms-menu-button-w5hfhsfv.js +0 -1
  206. package/dist/chunk-section-fold-g0tx68cj.js +0 -1
  207. package/dist/chunk-sheet-hosts-tsppnmvv.js +0 -29
  208. package/dist/chunk-shortcut-help-wnm0cm8n.js +0 -26
  209. package/dist/chunk-skills-sap3rysr.js +0 -1
  210. package/dist/chunk-table-jtn49c2m.js +0 -1
  211. package/dist/chunk-thread-actions-31scmndt.js +0 -1
  212. package/dist/chunk-transcript-p5q2m795.js +0 -1
  213. package/dist/chunk-waiting-s7nm3q0p.js +0 -1
  214. package/dist/chunk-where-j99f8pb8.js +0 -1
  215. package/dist/chunk-zh-tw-vm5d0w6j.js +0 -1
@@ -1,4 +1,4 @@
1
- import{s,r,t,g,e,n,h,y,l,f,x,m,k,P,_,oe}from"./chunk-index-s356ybxk.js";import{D}from"./chunk-index-6cs1wvhy.js";import{un}from"./chunk-index-eez0kbk4.js";import{Se}from"./chunk-index-b5patef1.js";import{Ee}from"./chunk-index-sk8cvb4e.js";import{H}from"./chunk-index-9ehqccfe.js";import"./chunk-index-e8535c4h.js";import{Y}from"./chunk-index-d941ae7c.js";var T=(a,o)=>({method:a,body:JSON.stringify(o)}),U=encodeURIComponent,L={list:()=>h("connectors/managed"),add:(a)=>h("connectors/managed",T("POST",a)),describe:(a,o)=>h(`connectors/managed/${U(a)}`,T("PATCH",{description:o})),remove:(a)=>h(`connectors/managed/${U(a)}`,{method:"DELETE"}),grants:()=>h("connectors/grants"),channels:()=>h("connectors/grants/channels"),authorize:(a)=>h("connectors/grants",T("POST",a)),describeGrant:(a,o,i)=>h(`connectors/grants/${U(a)}/${U(o)}`,T("PATCH",i)),revoke:(a,o)=>h(`connectors/grants/${U(a)}/${U(o)}`,{method:"DELETE"}),rotate:(a)=>h(`connectors/grants/${U(a)}/rotate`,{method:"POST"})};var F={name:"",url:"",description:"",header:"",token:""};function J(a){let[o,i]=r(F),[d,b]=r(),[v,C]=r(!1),p=(c)=>(R)=>i((E)=>({...E,[c]:R}));return n("form",{className:"stack",onSubmit:async(c)=>{c.preventDefault(),C(!0),b(void 0);try{let{connector:R,skipped:E}=await L.add({name:o.name,url:o.url,description:o.description,...o.header.trim()?{header:o.header}:{},...o.token?{token:o.token}:{}});i(F),f(E.length?t("Added {name}. Left out tools whose names are too long: {tools}",{name:R.name,tools:E.join(", ")}):t("Added {name}.",{name:R.name})),a.onDone()}catch(R){b(l(R))}finally{C(!1)}},autoComplete:"off",children:[n("label",{children:[t("Name"),e("input",{value:o.name,maxLength:12,placeholder:"notion",required:!0,onChange:(c)=>p("name")(c.target.value)}),e("span",{className:"meta",children:t("Lowercase letters, digits and -, up to 12; it becomes the prefix of its tool names.")})]}),n("label",{children:[t("MCP URL"),e("input",{type:"url",value:o.url,maxLength:500,placeholder:"https://mcp.example.com/mcp",required:!0,onChange:(c)=>p("url")(c.target.value)}),e("span",{className:"meta",children:t("A Streamable HTTP endpoint; one ending in /sse uses SSE. A credential may be part of the URL.")})]}),n("label",{children:[t("Purpose"),e("textarea",{value:o.description,maxLength:1000,rows:3,required:!0,onChange:(c)=>p("description")(c.target.value)}),e("span",{className:"meta",children:t("The knights decide from this text when to use the connector.")})]}),n("div",{className:"form-row",children:[n("label",{children:[t("Header name (optional)"),e("input",{value:o.header,maxLength:100,placeholder:"X-API-Key",onChange:(c)=>p("header")(c.target.value)}),e("span",{className:"meta",children:t("Leave empty to send Authorization: Bearer <token>.")})]}),n("label",{children:[t("Token (optional)"),e("input",{type:"password",value:o.token,maxLength:4000,autoComplete:"new-password",onChange:(c)=>p("token")(c.target.value)}),e("span",{className:"meta",children:t("Stored encrypted by the gateway and never shown again; leave empty if the credential is in the URL.")})]})]}),d?e(m,{message:d}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:v,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:v,children:t("Add connector")})]})]})}function K(a){let[o,i]=r(a.connector.description),[d,b]=r(),[v,C]=r(!1);return n("form",{className:"stack",onSubmit:async(w)=>{w.preventDefault(),C(!0),b(void 0);try{await L.describe(a.connector.name,o),f(t("Purpose updated.")),a.onDone()}catch(c){b(l(c))}finally{C(!1)}},children:[n("label",{children:[t("Purpose"),e("textarea",{value:o,maxLength:1000,rows:4,required:!0,onChange:(w)=>i(w.target.value)}),e("span",{className:"meta",children:t("From the next message on, the knights follow the new purpose.")})]}),d?e(m,{message:d}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:v,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:v,children:t("Save")})]})]})}function G(){let{data:a,error:o,reload:i}=un(()=>L.list()),[d,b]=r(!1),[v,C]=r(),[p,w]=r();return n("section",{className:"stack","aria-labelledby":"connectors-mine",children:[n("div",{className:"card-head",children:[e("h3",{id:"connectors-mine",children:t("MCP connectors")}),e("button",{type:"button",onClick:()=>b(!0),children:t("Add connector")})]}),o?e(m,{message:o}):null,!a&&!o?e(x,{}):null,a?.length===0?e(k,{children:t("No connectors yet.")}):null,a?.map((c)=>n("article",{className:"card connector-card",children:[n("div",{className:"card-head",children:[e("strong",{children:c.name}),c.tools===void 0?e(P,{tone:"warn",children:t("Tools unreadable")}):e(P,{children:t("{count} tools",{count:c.tools})})]}),e("p",{className:"meta connector-url",children:c.displayUrl??t("(the URL cannot be parsed)")}),e("p",{children:c.description}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>C(c),children:t("Edit purpose")}),e("button",{type:"button",className:"danger",onClick:()=>w(c),children:t("Remove")})]})]},c.name)),e(H,{open:d,title:t("Add an MCP connector"),onClose:()=>b(!1),children:d?e(J,{onCancel:()=>b(!1),onDone:()=>{b(!1),i()}}):null}),e(H,{open:v!==void 0,title:t("Edit purpose of {name}",{name:v?.name??""}),onClose:()=>C(void 0),children:v?e(K,{connector:v,onCancel:()=>C(void 0),onDone:()=>{C(void 0),i()}},v.name):null}),e(D,{open:p!==void 0,title:t("Remove connector"),confirmLabel:t("Remove"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!p)return;await L.remove(p.name),f(t("Removed {name}.",{name:p.name})),i()},children:e("p",{children:t("Remove {name} and its token? From the next message on, the knights no longer use it.",{name:p?.name??""})})})]})}var V=" new",X=(a,o)=>a.map((i)=>o.find((d)=>d.id===i)?.label??i).join(", ");function Z(a){return e(H,{open:a.shown!==void 0,title:t("MCP URL of {bundle}",{bundle:a.shown?.bundle??""}),onClose:a.onClose,children:n("div",{className:"stack",children:[e("p",{children:t("This URL is the access credential and is shown only this once. Add a remote MCP server in the AI client and paste it; no separate token is needed.")}),e("input",{readOnly:!0,"aria-label":t("MCP URL"),className:"mcp-url",value:a.shown?.url??"",onFocus:(o)=>o.target.select()}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>{navigator.clipboard?.writeText(a.shown?.url??"").then(()=>f(t("Copied")))},children:t("Copy")}),e("button",{type:"button",onClick:a.onClose,children:t("Done")})]})]})})}function Q(a){return n("fieldset",{className:"field",children:[e("legend",{children:t("Allowed operations")}),e("ul",{className:"menu",children:a.operations.map((o)=>{let i=a.chosen.includes(o.id);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:i,onChange:()=>a.onChange(i?a.chosen.filter((d)=>d!==o.id):[...a.chosen,o.id])}),e("span",{className:"menu-text",children:e("strong",{children:o.label})})]})},o.id)})})]})}function ee(a){let{view:o}=a,[i,d]=r(),[b,v]=r(o.bundles[0]?.name??V),[C,p]=r(""),[w,c]=r(""),[R,E]=r([]),[M,N]=r(""),[A,j]=r(""),[I,B]=r(),[O,z]=r(!1);return s(()=>{L.channels().then((u)=>{d(u),c((S)=>S||u[0]?.id||"")},(u)=>B(l(u)))},[]),n("form",{className:"stack",onSubmit:async(u)=>{u.preventDefault(),z(!0),B(void 0);try{let S=await L.authorize({bundle:b===V?C:b,channelId:w,operations:R,...M.trim()?{displayName:M}:{},...A.trim()?{description:A}:{}});f(t("Authorized the channel in {bundle}.",{bundle:S.bundle})),a.onDone(S.url?{bundle:S.bundle,url:S.url}:void 0)}catch(S){B(l(S))}finally{z(!1)}},children:[n("label",{htmlFor:"mcp-bundle",children:[t("Bundle"),n(Ee,{id:"mcp-bundle",value:b,onChange:(u)=>v(u.target.value),children:[o.bundles.map((u)=>e("option",{value:u.name,children:u.name},u.name)),e("option",{value:V,children:t("New bundle…")})]})]}),b===V?n("label",{children:[t("New bundle name"),e("input",{value:C,maxLength:80,required:!0,onChange:(u)=>p(u.target.value)}),e("span",{className:"meta",children:t("Channels in one bundle share one MCP URL.")})]}):null,n("label",{htmlFor:"mcp-channel",children:[t("Channel"),i===void 0&&!I?e(x,{}):e(Ee,{id:"mcp-channel",value:w,required:!0,onChange:(u)=>c(u.target.value),children:(i??[]).map((u)=>e("option",{value:u.id,children:`${u.guild} › #${u.name}`},u.id))})]}),e(Q,{operations:o.operations,chosen:R,onChange:E}),n("label",{children:[t("Name outside AI clients see (optional)"),e("input",{value:M,maxLength:100,onChange:(u)=>N(u.target.value)})]}),n("label",{children:[t("Purpose (optional)"),e("textarea",{value:A,maxLength:1000,rows:2,onChange:(u)=>j(u.target.value)})]}),I?e(m,{message:I}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:O,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:O||!w||R.length===0,children:t("Authorize")})]})]})}function ne(a){let{bundle:o,grant:i}=a.target,[d,b]=r(i.displayName),[v,C]=r(i.description),[p,w]=r(),[c,R]=r(!1);return n("form",{className:"stack",onSubmit:async(M)=>{M.preventDefault(),R(!0),w(void 0);try{await L.describeGrant(o,i.channelId,{displayName:d,description:v}),f(t("Updated what outside AI clients see.")),a.onDone()}catch(N){w(l(N))}finally{R(!1)}},children:[n("label",{children:[t("Name outside AI clients see"),e("input",{value:d,maxLength:100,required:!0,onChange:(M)=>b(M.target.value)})]}),n("label",{children:[t("Purpose"),e("textarea",{value:v,maxLength:1000,rows:3,onChange:(M)=>C(M.target.value)}),e("span",{className:"meta",children:t("The channel's name and topic on Discord stay as they are.")})]}),p?e(m,{message:p}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:c,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:c,children:t("Save")})]})]})}function te(a){let{grant:o}=a,{timeZone:i}=_();return n("li",{className:"grant",children:[n("div",{className:"card-head",children:[e("strong",{children:o.displayName}),o.visible?null:e(P,{tone:"warn",children:t("Not visible now")})]}),e("p",{className:"meta",children:`${o.guildName} › #${o.channelName}`}),e("p",{children:o.description||t("No purpose set.")}),e("p",{className:"meta",children:t("Allowed: {operations}",{operations:X(o.operations,a.operations)})}),o.audit.length?n("details",{children:[e("summary",{children:t("Recent activity")}),e("ul",{className:"audit",children:o.audit.map((d)=>n("li",{children:[e("time",{dateTime:d.at,children:oe(d.at,i)})," ",e("code",{children:d.tool})," ",d.status]},`${d.at}-${d.tool}`))})]}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:a.onDescribe,children:t("Rename / purpose")}),e("button",{type:"button",className:"danger",onClick:a.onRevoke,children:t("Revoke")})]})]})}function q(){let{data:a,error:o,reload:i}=un(()=>L.grants()),[d,b]=r(!1),[v,C]=r(),[p,w]=r(),[c,R]=r(),[E,M]=r();return n("section",{className:"stack","aria-labelledby":"mcp-grants",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h3",{id:"mcp-grants",children:t("MCP authorizations")}),e("p",{className:"hint",children:t("Which channels outside AI clients may use through each bundle's MCP URL, and with which operations.")})]}),e("button",{type:"button",disabled:!a,onClick:()=>b(!0),children:t("Authorize a channel")})]}),o?e(m,{message:o}):null,!a&&!o?e(x,{}):null,a?.bundles.length===0?e(k,{children:t("There are no authorizations yet.")}):null,a?.bundles.map((N)=>n("article",{className:"card bundle-card",children:[n("div",{className:"card-head",children:[e("strong",{children:N.name}),e("button",{type:"button",className:"secondary",onClick:()=>R(N.name),children:t("New URL")})]}),N.grants.length===0?e(k,{children:t("No channels")}):null,e("ul",{className:"grants",children:N.grants.map((A)=>e(te,{bundle:N.name,grant:A,operations:a.operations,onDescribe:()=>C({bundle:N.name,grant:A}),onRevoke:()=>w({bundle:N.name,grant:A})},A.channelId))})]},N.name)),e(H,{open:d,title:t("Authorize a channel"),onClose:()=>b(!1),children:d&&a?e(ee,{view:a,onCancel:()=>b(!1),onDone:(N)=>{if(b(!1),N)M(N);i()}}):null}),e(H,{open:v!==void 0,title:t("What outside AI clients see"),onClose:()=>C(void 0),children:v?e(ne,{target:v,onCancel:()=>C(void 0),onDone:()=>{C(void 0),i()}},`${v.bundle}/${v.grant.channelId}`):null}),e(D,{open:p!==void 0,title:t("Revoke the channel"),confirmLabel:t("Revoke"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!p)return;await L.revoke(p.bundle,p.grant.channelId),f(t("Revoked.")),i()},children:e("p",{children:t("Remove {channel} from bundle {bundle}? Its other channels and its URL keep working; operations already sent are not undone.",{channel:p?.grant.displayName??"",bundle:p?.bundle??""})})}),e(D,{open:c!==void 0,title:t("Replace the MCP URL"),confirmLabel:t("Replace URL"),tone:"danger",onClose:()=>R(void 0),onConfirm:async()=>{if(!c)return;let{bundle:N,url:A}=await L.rotate(c);if(A)M({bundle:N,url:A});i()},children:e("p",{children:t("Replace the URL of bundle {bundle}? The old URL stops working at once; every channel setting stays.",{bundle:c??""})})}),e(Z,{...E?{shown:E}:{},onClose:()=>M(void 0)})]})}var ae=`
1
+ import{o,r,t,g,e,n,h,y,l,f,S,m,k,Q,_,oe}from"./chunk-index-rvatmx8s.js";import{D}from"./chunk-index-gae833v6.js";import{cn}from"./chunk-index-p4rc9swx.js";import{ke}from"./chunk-index-65p4hfkr.js";import{Ee}from"./chunk-index-xv3e4x0j.js";import{H}from"./chunk-index-5e8wn6r3.js";import"./chunk-index-0dyf2gdm.js";import{B}from"./chunk-index-fw6kawhw.js";var P=(a,s)=>({method:a,body:JSON.stringify(s)}),U=encodeURIComponent,L={list:()=>h("connectors/managed"),add:(a)=>h("connectors/managed",P("POST",a)),describe:(a,s)=>h(`connectors/managed/${U(a)}`,P("PATCH",{description:s})),remove:(a)=>h(`connectors/managed/${U(a)}`,{method:"DELETE"}),grants:()=>h("connectors/grants"),channels:()=>h("connectors/grants/channels"),authorize:(a)=>h("connectors/grants",P("POST",a)),describeGrant:(a,s,i)=>h(`connectors/grants/${U(a)}/${U(s)}`,P("PATCH",i)),revoke:(a,s)=>h(`connectors/grants/${U(a)}/${U(s)}`,{method:"DELETE"}),rotate:(a)=>h(`connectors/grants/${U(a)}/rotate`,{method:"POST"})};var F={name:"",url:"",description:"",header:"",token:""};function j(a){let[s,i]=r(F),[d,b]=r(),[v,C]=r(!1),p=(c)=>(R)=>i((E)=>({...E,[c]:R}));return n("form",{className:"stack",onSubmit:async(c)=>{c.preventDefault(),C(!0),b(void 0);try{let{connector:R,skipped:E}=await L.add({name:s.name,url:s.url,description:s.description,...s.header.trim()?{header:s.header}:{},...s.token?{token:s.token}:{}});i(F),f(E.length?t("Added {name}. Left out tools whose names are too long: {tools}",{name:R.name,tools:E.join(", ")}):t("Added {name}.",{name:R.name})),a.onDone()}catch(R){b(l(R))}finally{C(!1)}},autoComplete:"off",children:[n("label",{children:[t("Name"),e("input",{value:s.name,maxLength:12,placeholder:"notion",required:!0,onChange:(c)=>p("name")(c.target.value)}),e("span",{className:"meta",children:t("Lowercase letters, digits and -, up to 12; it becomes the prefix of its tool names.")})]}),n("label",{children:[t("MCP URL"),e("input",{type:"url",value:s.url,maxLength:500,placeholder:"https://mcp.example.com/mcp",required:!0,onChange:(c)=>p("url")(c.target.value)}),e("span",{className:"meta",children:t("A Streamable HTTP endpoint; one ending in /sse uses SSE. A credential may be part of the URL.")})]}),n("label",{children:[t("Purpose"),e("textarea",{value:s.description,maxLength:1000,rows:3,required:!0,onChange:(c)=>p("description")(c.target.value)}),e("span",{className:"meta",children:t("The knights decide from this text when to use the connector.")})]}),n("div",{className:"form-row",children:[n("label",{children:[t("Header name (optional)"),e("input",{value:s.header,maxLength:100,placeholder:"X-API-Key",onChange:(c)=>p("header")(c.target.value)}),e("span",{className:"meta",children:t("Leave empty to send Authorization: Bearer <token>.")})]}),n("label",{children:[t("Token (optional)"),e("input",{type:"password",value:s.token,maxLength:4000,autoComplete:"new-password",onChange:(c)=>p("token")(c.target.value)}),e("span",{className:"meta",children:t("Stored encrypted by the gateway and never shown again; leave empty if the credential is in the URL.")})]})]}),d?e(m,{message:d}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:v,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:v,children:t("Add connector")})]})]})}function J(a){let[s,i]=r(a.connector.description),[d,b]=r(),[v,C]=r(!1);return n("form",{className:"stack",onSubmit:async(w)=>{w.preventDefault(),C(!0),b(void 0);try{await L.describe(a.connector.name,s),f(t("Purpose updated.")),a.onDone()}catch(c){b(l(c))}finally{C(!1)}},children:[n("label",{children:[t("Purpose"),e("textarea",{value:s,maxLength:1000,rows:4,required:!0,onChange:(w)=>i(w.target.value)}),e("span",{className:"meta",children:t("From the next message on, the knights follow the new purpose.")})]}),d?e(m,{message:d}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:v,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:v,children:t("Save")})]})]})}function G(){let{data:a,error:s,reload:i}=cn(()=>L.list()),[d,b]=r(!1),[v,C]=r(),[p,w]=r();return n("section",{className:"stack","aria-labelledby":"connectors-mine",children:[n("div",{className:"card-head",children:[e("h3",{id:"connectors-mine",children:t("MCP connectors")}),e("button",{type:"button",onClick:()=>b(!0),children:t("Add connector")})]}),s?e(m,{message:s}):null,!a&&!s?e(S,{}):null,a?.length===0?e(k,{children:t("No connectors yet.")}):null,a?.map((c)=>n("article",{className:"card connector-card",children:[n("div",{className:"card-head",children:[e("strong",{children:c.name}),c.tools===void 0?e(Q,{tone:"warn",children:t("Tools unreadable")}):e(Q,{children:t("{count} tools",{count:c.tools})})]}),e("p",{className:"meta connector-url",children:c.displayUrl??t("(the URL cannot be parsed)")}),e("p",{children:c.description}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>C(c),children:t("Edit purpose")}),e("button",{type:"button",className:"danger",onClick:()=>w(c),children:t("Remove")})]})]},c.name)),e(H,{open:d,title:t("Add an MCP connector"),onClose:()=>b(!1),children:d?e(j,{onCancel:()=>b(!1),onDone:()=>{b(!1),i()}}):null}),e(H,{open:v!==void 0,title:t("Edit purpose of {name}",{name:v?.name??""}),onClose:()=>C(void 0),children:v?e(J,{connector:v,onCancel:()=>C(void 0),onDone:()=>{C(void 0),i()}},v.name):null}),e(D,{open:p!==void 0,title:t("Remove connector"),confirmLabel:t("Remove"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!p)return;await L.remove(p.name),f(t("Removed {name}.",{name:p.name})),i()},children:e("p",{children:t("Remove {name} and its token? From the next message on, the knights no longer use it.",{name:p?.name??""})})})]})}var T=" new",K=(a,s)=>a.map((i)=>s.find((d)=>d.id===i)?.label??i).join(", ");function X(a){return e(H,{open:a.shown!==void 0,title:t("MCP URL of {bundle}",{bundle:a.shown?.bundle??""}),onClose:a.onClose,children:n("div",{className:"stack",children:[e("p",{children:t("This URL is the access credential and is shown only this once. Add a remote MCP server in the AI client and paste it; no separate token is needed.")}),e("input",{readOnly:!0,"aria-label":t("MCP URL"),className:"mcp-url",value:a.shown?.url??"",onFocus:(s)=>s.target.select()}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>{navigator.clipboard?.writeText(a.shown?.url??"").then(()=>f(t("Copied")))},children:t("Copy")}),e("button",{type:"button",onClick:a.onClose,children:t("Done")})]})]})})}function Z(a){return n("fieldset",{className:"field",children:[e("legend",{children:t("Allowed operations")}),e("ul",{className:"menu",children:a.operations.map((s)=>{let i=a.chosen.includes(s.id);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:i,onChange:()=>a.onChange(i?a.chosen.filter((d)=>d!==s.id):[...a.chosen,s.id])}),e("span",{className:"menu-text",children:e("strong",{children:s.label})})]})},s.id)})})]})}function ee(a){let{view:s}=a,[i,d]=r(),[b,v]=r(s.bundles[0]?.name??T),[C,p]=r(""),[w,c]=r(""),[R,E]=r([]),[M,N]=r(""),[A,Y]=r(""),[V,I]=r(),[O,z]=r(!1);return o(()=>{L.channels().then((u)=>{d(u),c((x)=>x||u[0]?.id||"")},(u)=>I(l(u)))},[]),n("form",{className:"stack",onSubmit:async(u)=>{u.preventDefault(),z(!0),I(void 0);try{let x=await L.authorize({bundle:b===T?C:b,channelId:w,operations:R,...M.trim()?{displayName:M}:{},...A.trim()?{description:A}:{}});f(t("Authorized the channel in {bundle}.",{bundle:x.bundle})),a.onDone(x.url?{bundle:x.bundle,url:x.url}:void 0)}catch(x){I(l(x))}finally{z(!1)}},children:[n("label",{htmlFor:"mcp-bundle",children:[t("Bundle"),n(Ee,{id:"mcp-bundle",value:b,onChange:(u)=>v(u.target.value),children:[s.bundles.map((u)=>e("option",{value:u.name,children:u.name},u.name)),e("option",{value:T,children:t("New bundle…")})]})]}),b===T?n("label",{children:[t("New bundle name"),e("input",{value:C,maxLength:80,required:!0,onChange:(u)=>p(u.target.value)}),e("span",{className:"meta",children:t("Channels in one bundle share one MCP URL.")})]}):null,n("label",{htmlFor:"mcp-channel",children:[t("Channel"),i===void 0&&!V?e(S,{}):e(Ee,{id:"mcp-channel",value:w,required:!0,onChange:(u)=>c(u.target.value),children:(i??[]).map((u)=>e("option",{value:u.id,children:`${u.guild} › #${u.name}`},u.id))})]}),e(Z,{operations:s.operations,chosen:R,onChange:E}),n("label",{children:[t("Name outside AI clients see (optional)"),e("input",{value:M,maxLength:100,onChange:(u)=>N(u.target.value)})]}),n("label",{children:[t("Purpose (optional)"),e("textarea",{value:A,maxLength:1000,rows:2,onChange:(u)=>Y(u.target.value)})]}),V?e(m,{message:V}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:O,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:O||!w||R.length===0,children:t("Authorize")})]})]})}function ne(a){let{bundle:s,grant:i}=a.target,[d,b]=r(i.displayName),[v,C]=r(i.description),[p,w]=r(),[c,R]=r(!1);return n("form",{className:"stack",onSubmit:async(M)=>{M.preventDefault(),R(!0),w(void 0);try{await L.describeGrant(s,i.channelId,{displayName:d,description:v}),f(t("Updated what outside AI clients see.")),a.onDone()}catch(N){w(l(N))}finally{R(!1)}},children:[n("label",{children:[t("Name outside AI clients see"),e("input",{value:d,maxLength:100,required:!0,onChange:(M)=>b(M.target.value)})]}),n("label",{children:[t("Purpose"),e("textarea",{value:v,maxLength:1000,rows:3,onChange:(M)=>C(M.target.value)}),e("span",{className:"meta",children:t("The channel's name and topic on Discord stay as they are.")})]}),p?e(m,{message:p}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:c,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:c,children:t("Save")})]})]})}function te(a){let{grant:s}=a,{timeZone:i}=_();return n("li",{className:"grant",children:[n("div",{className:"card-head",children:[e("strong",{children:s.displayName}),s.visible?null:e(Q,{tone:"warn",children:t("Not visible now")})]}),e("p",{className:"meta",children:`${s.guildName} › #${s.channelName}`}),e("p",{children:s.description||t("No purpose set.")}),e("p",{className:"meta",children:t("Allowed: {operations}",{operations:K(s.operations,a.operations)})}),s.audit.length?n("details",{children:[e("summary",{children:t("Recent activity")}),e("ul",{className:"audit",children:s.audit.map((d)=>n("li",{children:[e("time",{dateTime:d.at,children:oe(d.at,i)})," ",e("code",{children:d.tool})," ",d.status]},`${d.at}-${d.tool}`))})]}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:a.onDescribe,children:t("Rename / purpose")}),e("button",{type:"button",className:"danger",onClick:a.onRevoke,children:t("Revoke")})]})]})}function q(){let{data:a,error:s,reload:i}=cn(()=>L.grants()),[d,b]=r(!1),[v,C]=r(),[p,w]=r(),[c,R]=r(),[E,M]=r();return n("section",{className:"stack","aria-labelledby":"mcp-grants",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h3",{id:"mcp-grants",children:t("MCP authorizations")}),e("p",{className:"hint",children:t("Which channels outside AI clients may use through each bundle's MCP URL, and with which operations.")})]}),e("button",{type:"button",disabled:!a,onClick:()=>b(!0),children:t("Authorize a channel")})]}),s?e(m,{message:s}):null,!a&&!s?e(S,{}):null,a?.bundles.length===0?e(k,{children:t("There are no authorizations yet.")}):null,a?.bundles.map((N)=>n("article",{className:"card bundle-card",children:[n("div",{className:"card-head",children:[e("strong",{children:N.name}),e("button",{type:"button",className:"secondary",onClick:()=>R(N.name),children:t("New URL")})]}),N.grants.length===0?e(k,{children:t("No channels")}):null,e("ul",{className:"grants",children:N.grants.map((A)=>e(te,{bundle:N.name,grant:A,operations:a.operations,onDescribe:()=>C({bundle:N.name,grant:A}),onRevoke:()=>w({bundle:N.name,grant:A})},A.channelId))})]},N.name)),e(H,{open:d,title:t("Authorize a channel"),onClose:()=>b(!1),children:d&&a?e(ee,{view:a,onCancel:()=>b(!1),onDone:(N)=>{if(b(!1),N)M(N);i()}}):null}),e(H,{open:v!==void 0,title:t("What outside AI clients see"),onClose:()=>C(void 0),children:v?e(ne,{target:v,onCancel:()=>C(void 0),onDone:()=>{C(void 0),i()}},`${v.bundle}/${v.grant.channelId}`):null}),e(D,{open:p!==void 0,title:t("Revoke the channel"),confirmLabel:t("Revoke"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!p)return;await L.revoke(p.bundle,p.grant.channelId),f(t("Revoked.")),i()},children:e("p",{children:t("Remove {channel} from bundle {bundle}? Its other channels and its URL keep working; operations already sent are not undone.",{channel:p?.grant.displayName??"",bundle:p?.bundle??""})})}),e(D,{open:c!==void 0,title:t("Replace the MCP URL"),confirmLabel:t("Replace URL"),tone:"danger",onClose:()=>R(void 0),onConfirm:async()=>{if(!c)return;let{bundle:N,url:A}=await L.rotate(c);if(A)M({bundle:N,url:A});i()},children:e("p",{children:t("Replace the URL of bundle {bundle}? The old URL stops working at once; every channel setting stays.",{bundle:c??""})})}),e(X,{...E?{shown:E}:{},onClose:()=>M(void 0)})]})}var ae=`
2
2
  /* The Connectors page's management: an address never breaks the layout, a bundle's channels sit as rows. */
3
3
  .connector-url,
4
4
  .connectors-page .grant .meta {
@@ -34,4 +34,4 @@ import{s,r,t,g,e,n,h,y,l,f,x,m,k,P,_,oe}from"./chunk-index-s356ybxk.js";import{D
34
34
  .mcp-url {
35
35
  font-family: var(--font-mono);
36
36
  }
37
- `,W=()=>Y("connectors",ae);function _e(){W();let{connectorAdminUrl:a,connectorParts:o}=_(),i=o??{gateways:!0};return n("section",{className:"stack connectors-page",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Connectors")}),a?e("a",{href:a,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the knights.")}),i.manage?e(G,{}):null,i.grants?e(q,{}):null,i.gateways?e(se,{}):null]})}function se(){let{data:a,error:o}=Se(()=>y.connectors(),"connectors");return n("section",{className:"stack",children:[o?e(m,{message:o}):null,!a&&!o?e(x,{}):null,a?n(g,{children:[e("h3",{children:t("Upstream gateways")}),a.gateways.length===0?e(k,{children:t("No gateways.")}):null,a.gateways.map((i)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(P,{children:i.enabled?t("Enabled"):t("Disabled")}),e(P,{tone:i.reachable?"plain":"warn",children:i.reachable?t("Reachable"):t("Unreachable")}),e(P,{children:t("{count} tools",{count:i.tools})})]})},i.name)),e("h3",{children:t("Virtual servers")}),a.servers.length===0?e(k,{children:t("No virtual servers.")}):null,a.servers.map((i)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(P,{children:t("{count} tools",{count:i.tools.length})})]}),n("p",{children:[t("Used by"),": ",i.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:i.tools.map((d)=>e("li",{children:d},d))})]})]},i.name))]}):null]})}export{_e as ConnectorsPage};
37
+ `,W=()=>B("connectors",ae);function _e(){W();let{connectorAdminUrl:a,connectorParts:s}=_(),i=s??{gateways:!0};return n("section",{className:"stack connectors-page",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Connectors")}),a?e("a",{href:a,target:"_blank",rel:"noreferrer",children:t("Open connector admin")}):null]}),e("p",{className:"hint",children:t("Upstream MCP gateways and virtual servers used by the knights.")}),i.manage?e(G,{}):null,i.grants?e(q,{}):null,i.gateways?e(se,{}):null]})}function se(){let{data:a,error:s}=ke(()=>y.connectors(),"connectors");return n("section",{className:"stack",children:[s?e(m,{message:s}):null,!a&&!s?e(S,{}):null,a?n(g,{children:[e("h3",{children:t("Upstream gateways")}),a.gateways.length===0?e(k,{children:t("No gateways.")}):null,a.gateways.map((i)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(Q,{children:i.enabled?t("Enabled"):t("Disabled")}),e(Q,{tone:i.reachable?"plain":"warn",children:i.reachable?t("Reachable"):t("Unreachable")}),e(Q,{children:t("{count} tools",{count:i.tools})})]})},i.name)),e("h3",{children:t("Virtual servers")}),a.servers.length===0?e(k,{children:t("No virtual servers.")}):null,a.servers.map((i)=>n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(Q,{children:t("{count} tools",{count:i.tools.length})})]}),n("p",{children:[t("Used by"),": ",i.usedBy.join(", ")||t("None")]}),n("details",{children:[e("summary",{children:t("Tool list")}),e("ul",{children:i.tools.map((d)=>e("li",{children:d},d))})]})]},i.name))]}):null]})}export{_e as ConnectorsPage};
@@ -1 +1 @@
1
- import{t,c,g,e,n,S,y,x,m,k,P,_,ke,oe,Me,vn,Ci,te}from"./chunk-index-s356ybxk.js";import{Se}from"./chunk-index-b5patef1.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 T(){let{timeZone:o}=_(),{now:i}=te(),{data:a,error:s}=Se(()=>y.conversations(),"conversations"),d=a?.conversations;if(!d)return s?e(m,{message:s}):e(x,{});return n(g,{children:[s?e(m,{message:s}):null,u.map((r)=>{let h=d.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),h.length===0?e(k,{children:t("None stored.")}):null,h.map((l)=>e(v,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function v(o){let{item:i}=o,a=vn(i.channel,i.id),s=Ci(i);return n("a",{className:"card card-link",href:S("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")} ${oe(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")," ",ke(i.lastActive,o.now,o.timeZone)," ·"," ",Me(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{T as ConversationsPage};
1
+ import{t,c,g,e,n,x,y,S,m,k,Q,_,Te,oe,Pe,wn,Di,te}from"./chunk-index-rvatmx8s.js";import{ke}from"./chunk-index-65p4hfkr.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 T(){let{timeZone:o}=_(),{now:i}=te(),{data:a,error:s}=ke(()=>y.conversations(),"conversations"),d=a?.conversations;if(!d)return s?e(m,{message:s}):e(S,{});return n(g,{children:[s?e(m,{message:s}):null,u.map((r)=>{let h=d.filter((l)=>l.kind===r.kind);return n("section",{className:"stack",children:[e("h2",{children:t(r.title)}),e("p",{className:"hint",children:t(r.note)}),h.length===0?e(k,{children:t("None stored.")}):null,h.map((l)=>e(v,{item:l,now:i,timeZone:o},l.key))]},r.kind)})]})}function v(o){let{item:i}=o,a=wn(i.channel,i.id),s=Di(i);return n("a",{className:"card card-link",href:x("conversations",i.key),children:[n("div",{className:"card-head",children:[e("strong",{children:s}),i.busy>0?e(Q,{tone:"busy",children:t("running")}):null,i.liveBytes===0?e(Q,{children:t("archived only")}):null]}),n("p",{className:"meta",children:[(i.kind==="outside"||i.kind==="plugin")&&i.startedAt?`${t("Started")} ${oe(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")," ",Te(i.lastActive,o.now,o.timeZone)," ·"," ",Pe(i.liveBytes)," ·"," ",t("{count} archived",{count:i.archives})]})]})}export{T as ConversationsPage};
@@ -0,0 +1,2 @@
1
+ import{o,R,C,r,t,g,e,n,X,l,f,m,$e}from"./chunk-index-rvatmx8s.js";import"./chunk-index-r1g24er0.js";import"./chunk-index-zr2qwzz4.js";import"./chunk-index-gpaychmm.js";import"./chunk-index-tfgd7vr5.js";import{xi}from"./chunk-index-x7p6k52w.js";import{Zt}from"./chunk-index-ve07gdef.js";import{A}from"./chunk-index-0dyf2gdm.js";import{Yt,Wn,Kr,Mi,ws,ks,_s,Ts,Ps}from"./chunk-index-39gw0qhr.js";import{re,Ie}from"./chunk-index-xkb336kq.js";var Q=(a)=>X("table",a.name,{replace:!0});function W(a){let{view:i}=a;return e("li",{children:n("button",{type:"button",className:"menu-item council-row","aria-current":a.current||void 0,onClick:a.onPick,children:[e($e,{view:i,size:40}),n("span",{className:"menu-text",children:[e("strong",{children:i.displayName}),e("span",{className:"meta",children:t("{count} knights",{count:i.members?.length??0})})]})]})})}function Y(a){let{council:i}=a,w=Mi(),d=xi(),[v,M]=r([]),[y,O]=r(),[D,S]=r(""),[I,j]=r(!1),[P,z]=r(""),[b,k]=r(!1),[E,G]=r(),F=R(),x=i?.name,H=i?.members?.join(`
2
+ `);o(()=>{if(!a.open)return;if(G(void 0),j(i===void 0),z(""),k(!1),O(void 0),S(""),M(i?[...i.members??[]]:ws(d)),!x)return;let s=!0;return re.group(x).then((c)=>{if(!s)return;O(c),S(c.host)},()=>{return}),()=>{s=!1}},[a.open,x,H]);let L=C(()=>new Set(d.map((s)=>s.name)),[d]),U=d.find((s)=>s.home)?.name,u=_s(v,(s)=>L.has(s)),h=Ts(u,D||void 0,U),_=(s)=>d.find((c)=>c.name===s)?.displayName??s,T=u.length>=Yt,N=u.length>=Wn,q=i===void 0||u.join(",")!==(i.members??[]).join(",")||y!==void 0&&h!==y.host,B=async(s)=>{k(!0),G(void 0);try{await s(),await Ie()}catch(c){return G(l(c)),k(!1),!1}return k(!1),!0},J=async()=>{if(!i)return;if(!await B(async()=>{await re.updateGroup(i.name,{...u.join(",")!==(i.members??[]).join(",")?{members:u}:{},...y&&h!==y.host?{host:h}:{}})}))return;f(t("Saved.")),a.onClose()},K=async()=>{let s=P.trim();if(s==="")return;let c=new Set([...d.map((V)=>V.name),...w.map((V)=>V.name)]),p;if(!await B(async()=>{p=await re.createGroup({name:Ps(s,c),displayName:s,members:u,host:h})})||!p)return;Kr(p.room),a.go({key:p.room,name:p.name}),f(t("Made {name}.",{name:p.displayName})),a.onClose()};return n("div",{className:"stack council-sheet",children:[w.length>0?n("section",{className:"stack","aria-label":t("Councils"),children:[e("h3",{children:t("Councils")}),e("ul",{className:"menu",children:w.map((s)=>e(W,{view:s,current:s.key===i?.key,onPick:()=>{Kr(s.key),a.go(s),a.onClose()}},s.key))})]}):null,n("fieldset",{className:"field council-pick",children:[e("legend",{children:i?t("Edit this council"):t("Pick who sits")}),n("span",{className:"meta council-count","aria-live":"polite",children:[t("{count} of {max} picked",{count:u.length,max:Yt}),T?` · ${t("At most {max} knights",{max:Yt})}`:""]}),e("ul",{className:"menu",children:d.map((s)=>{let c=v.includes(s.name);return e("li",{children:n("label",{className:"menu-item menu-toggle seat-row",children:[e("input",{type:"checkbox",checked:c,disabled:!c&&T,onChange:()=>M(ks(v,s.name,Yt))}),e($e,{view:s,size:32}),e("span",{className:"menu-text",children:e("strong",{children:s.displayName})})]})},s.key)})})]}),N?e(Zt,{label:t("Host"),value:h,onChange:S,options:u.map((s)=>({value:s,label:_(s)}))}):e("span",{className:"meta",children:t("A council needs at least {min} knights.",{min:Wn})}),I?n("label",{htmlFor:F,children:[t("Council name"),e("input",{id:F,value:P,autoComplete:"off",onChange:(s)=>z(s.target.value)})]}):null,E?e(m,{message:E}):null,e("div",{className:"actions",children:i&&!I?n(g,{children:[e("button",{type:"button",className:"secondary",disabled:!N||b,onClick:()=>j(!0),children:t("Save as a new council")}),e("button",{type:"button",disabled:!N||!q||b,onClick:J,children:b?t("Saving…"):t("Done")})]}):e("button",{type:"button",disabled:!N||P.trim()===""||b,onClick:K,children:b?t("Saving…"):i?t("Save as a new council"):t("Make council")})})]})}function fe(a){return e(A,{open:a.open,title:t("Council"),onClose:a.onClose,size:"default",children:e(Y,{open:a.open,council:a.council,onClose:a.onClose,go:a.go??Q})})}export{fe as CouncilSheet};
@@ -0,0 +1 @@
1
+ import{er,Ur}from"./chunk-index-x7p6k52w.js";import"./chunk-index-gpaychmm.js";import"./chunk-index-zr2qwzz4.js";import"./chunk-index-0dyf2gdm.js";import"./chunk-index-qwztcbjz.js";import"./chunk-index-r1g24er0.js";import"./chunk-index-tfgd7vr5.js";export{Ur as CouncilView,er as useCouncilSheet};
@@ -1 +1 @@
1
- import{eo}from"./chunk-index-s356ybxk.js";import{qr}from"./chunk-index-p98tt12y.js";import{As,Ns,vo,xo,Ls,Xs}from"./chunk-index-ar1x9fhw.js";var re=eo,ie=(s)=>{for(let n=s;n;n=n.parentElement){let{overflowY:a}=getComputedStyle(n);if((a==="auto"||a==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function de(s){let{item:n,root:a,key:f,mode:C}=s,m=ie(a),O=m===document.scrollingElement||m===document.documentElement,A=()=>O?0:m.getBoundingClientRect().top,j=()=>O?window.innerHeight:m.clientHeight,x=(e)=>e-A()+m.scrollTop,c=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},u=document.createElement("div");u.className="drop-line",u.setAttribute("aria-hidden","true");let z=[],P=[],v=[],g=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...a.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{G()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},G=()=>{if(C==="room"){P=[...a.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:T}=c(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+T,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...c(o)})):[]}});return}v=[...a.querySelectorAll(":scope > [data-folder-block]")],g=v.map((t)=>({key:t.dataset.key??"",...c(t)})),R=v.map((t)=>({key:t.dataset.key??"",...c(t.querySelector("[data-folder-head]")??t)}));let e=c(a);B={top:e.top,bottom:e.top+e.height}};qr(!0);let J=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),a.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-J;if(F)m.scrollTop+=F;D();let Q=x(s.y),I={x:0,y:s.y},Z=!1,p=0,h,d,q={type:"cancel"};try{n.setPointerCapture(s.pointerId)}catch{}let _=()=>{p=0;let e=x(I.y),t=e-Q;if(Math.abs(t)>re)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=As(z,f,e);q=o?{type:"room",drop:o}:{type:"cancel"};let H=o?z.indexOf(o.zone):-1;r=P[H];let y=r?.contains(n)??!1,E=o?.zone.kind!=="rest";if(!E&&y)r=void 0;let i=o&&E?o.zone.items:[],M=y?[...r.querySelectorAll("[data-drop-item]")]:[],U=i.findIndex((l)=>l.key===f),ee=o?xo(i.map((l)=>l.key),f,o.before):0,te=i.length>1?Math.max(0,(i[1]?.top??0)-(i[0]?.top??0)-(i[0]?.height??0)):0,X=y&&U>=0?vo(i,U,ee,te):[];for(let l of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))l.style.removeProperty("transform");if(M.forEach((l,k)=>{if(X[k])l.style.transform=`translate3d(0, ${X[k]}px, 0)`}),r&&o&&!y&&E){let l=o.before===null?void 0:o.zone.items.find((ne)=>ne.key===o.before),k=c(r).top,oe=l?l.top-k:o.zone.items.length?c(r).height:0;u.style.top=`${oe}px`,r.append(u)}else u.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let l=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{s.open(l),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),w()}))},Xs)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=Ns(R,B,f,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let H=g.findIndex((i)=>i.key===f),y=o?xo(g.map((i)=>i.key),f,o.before):H,E=vo(g,H,y,12);v.forEach((i,M)=>{if(i!==n)i.style.transform=E[M]?`translate3d(0, ${E[M]}px, 0)`:""})}if(r!==h)h?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),h=r;let T=Ls(I.y,A(),A()+j());if(T)m.scrollTop+=T,w()},w=()=>{if(!p)p=requestAnimationFrame(_)},L=(e)=>{W(),s.done(e)},S=(e)=>e.pointerId===s.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},w()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),p)cancelAnimationFrame(p),_();L(Z?q:{type:"tap"})},V=(e)=>{if(S(e))L({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),L({type:"cancel"})},b=(e)=>e.preventDefault();function W(){if(qr(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",b,!0),window.removeEventListener("contextmenu",b,!0),p)cancelAnimationFrame(p);if(d)clearTimeout(d.timer);h?.removeAttribute("data-drop-target"),u.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),a.removeAttribute("data-reordering");for(let e of a.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(s.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",b,{capture:!0,passive:!1}),window.addEventListener("contextmenu",b,!0),w(),()=>L({type:"cancel"})}export{de as lift};
1
+ import{fo}from"./chunk-index-rvatmx8s.js";import{oo}from"./chunk-index-vw592m3p.js";import{da,ha,Do,Uo,pa,ma}from"./chunk-index-bh6m0bpm.js";var re=fo,ie=(s)=>{for(let n=s;n;n=n.parentElement){let{overflowY:a}=getComputedStyle(n);if((a==="auto"||a==="scroll")&&n.scrollHeight>n.clientHeight)return n}return document.scrollingElement??document.documentElement};function de(s){let{item:n,root:a,key:f,mode:C}=s,m=ie(a),O=m===document.scrollingElement||m===document.documentElement,A=()=>O?0:m.getBoundingClientRect().top,j=()=>O?window.innerHeight:m.clientHeight,x=(e)=>e-A()+m.scrollTop,c=(e)=>{let t=e.getBoundingClientRect();return{top:x(t.top),height:t.height}},u=document.createElement("div");u.className="drop-line",u.setAttribute("aria-hidden","true");let z=[],P=[],v=[],g=[],R=[],B={top:0,bottom:0},D=()=>{let e=[...a.querySelectorAll("[data-drop-item], [data-folder-block]")].map((t)=>[t,t.style.transform]);for(let[t]of e)t.style.removeProperty("transform");try{G()}finally{for(let[t,r]of e)if(r)t.style.transform=r}},G=()=>{if(C==="room"){P=[...a.querySelectorAll("[data-drop-zone]")],z=P.map((t)=>{let{top:r,height:T}=c(t);return{id:t.dataset.zoneId??"",kind:t.dataset.dropZone,...t.dataset.folder?{folder:t.dataset.folder}:{},top:r,bottom:r+T,items:t.dataset.collapsed===void 0?[...t.querySelectorAll("[data-drop-item]")].map((o)=>({key:o.dataset.key??"",...c(o)})):[]}});return}v=[...a.querySelectorAll(":scope > [data-folder-block]")],g=v.map((t)=>({key:t.dataset.key??"",...c(t)})),R=v.map((t)=>({key:t.dataset.key??"",...c(t.querySelector("[data-folder-head]")??t)}));let e=c(a);B={top:e.top,bottom:e.top+e.height}};oo(!0);let J=n.getBoundingClientRect().top;n.setAttribute("data-lifted",""),a.setAttribute("data-reordering","");let F=n.getBoundingClientRect().top-J;if(F)m.scrollTop+=F;D();let Q=x(s.y),I={x:0,y:s.y},Z=!1,p=0,h,d,q={type:"cancel"};try{n.setPointerCapture(s.pointerId)}catch{}let _=()=>{p=0;let e=x(I.y),t=e-Q;if(Math.abs(t)>re)Z=!0;n.style.transform=`translate3d(0, ${t}px, 0)`;let r;if(C==="room"){let o=da(z,f,e);q=o?{type:"room",drop:o}:{type:"cancel"};let H=o?z.indexOf(o.zone):-1;r=P[H];let y=r?.contains(n)??!1,E=o?.zone.kind!=="rest";if(!E&&y)r=void 0;let i=o&&E?o.zone.items:[],M=y?[...r.querySelectorAll("[data-drop-item]")]:[],U=i.findIndex((l)=>l.key===f),ee=o?Uo(i.map((l)=>l.key),f,o.before):0,te=i.length>1?Math.max(0,(i[1]?.top??0)-(i[0]?.top??0)-(i[0]?.height??0)):0,X=y&&U>=0?Do(i,U,ee,te):[];for(let l of document.querySelectorAll("[data-drop-item]:not([data-lifted])"))l.style.removeProperty("transform");if(M.forEach((l,k)=>{if(X[k])l.style.transform=`translate3d(0, ${X[k]}px, 0)`}),r&&o&&!y&&E){let l=o.before===null?void 0:o.zone.items.find((ne)=>ne.key===o.before),k=c(r).top,oe=l?l.top-k:o.zone.items.length?c(r).height:0;u.style.top=`${oe}px`,r.append(u)}else u.remove();if(o?.zone.kind==="folder"&&o.zone.items.length===0&&r?.dataset.collapsed!==void 0){if(d?.zone!==o.zone.id){if(d)clearTimeout(d.timer);let l=o.zone.folder??"";d={zone:o.zone.id,timer:setTimeout(()=>{s.open(l),requestAnimationFrame(()=>requestAnimationFrame(()=>{D(),w()}))},ma)}}}else if(d)clearTimeout(d.timer),d=void 0}else{let o=ha(R,B,f,e);q=o?{type:"folder",before:o.before}:{type:"cancel"};let H=g.findIndex((i)=>i.key===f),y=o?Uo(g.map((i)=>i.key),f,o.before):H,E=Do(g,H,y,12);v.forEach((i,M)=>{if(i!==n)i.style.transform=E[M]?`translate3d(0, ${E[M]}px, 0)`:""})}if(r!==h)h?.removeAttribute("data-drop-target"),r?.setAttribute("data-drop-target",""),h=r;let T=pa(I.y,A(),A()+j());if(T)m.scrollTop+=T,w()},w=()=>{if(!p)p=requestAnimationFrame(_)},L=(e)=>{W(),s.done(e)},S=(e)=>e.pointerId===s.pointerId,K=(e)=>{if(!S(e))return;e.stopPropagation(),e.preventDefault(),I={x:e.clientX,y:e.clientY},w()},N=(e)=>{if(!S(e))return;if(e.stopPropagation(),p)cancelAnimationFrame(p),_();L(Z?q:{type:"tap"})},V=(e)=>{if(S(e))L({type:"cancel"})},Y=(e)=>{if(e.key!=="Escape")return;e.preventDefault(),e.stopPropagation(),L({type:"cancel"})},b=(e)=>e.preventDefault();function W(){if(oo(!1),window.removeEventListener("pointermove",K,!0),window.removeEventListener("pointerup",N,!0),window.removeEventListener("pointercancel",V,!0),window.removeEventListener("keydown",Y,!0),window.removeEventListener("touchmove",b,!0),window.removeEventListener("contextmenu",b,!0),p)cancelAnimationFrame(p);if(d)clearTimeout(d.timer);h?.removeAttribute("data-drop-target"),u.remove(),n.removeAttribute("data-lifted"),n.style.removeProperty("transform"),a.removeAttribute("data-reordering");for(let e of a.querySelectorAll("[data-drop-item], [data-folder-block]"))e.style.removeProperty("transform");try{n.releasePointerCapture(s.pointerId)}catch{}}return window.addEventListener("pointermove",K,!0),window.addEventListener("pointerup",N,!0),window.addEventListener("pointercancel",V,!0),window.addEventListener("keydown",Y,!0),window.addEventListener("touchmove",b,{capture:!0,passive:!1}),window.addEventListener("contextmenu",b,!0),w(),()=>L({type:"cancel"})}export{de as lift};
@@ -1 +1 @@
1
- import{Et,Wt}from"./chunk-index-0xdptr30.js";import{p}from"./chunk-index-s356ybxk.js";function H(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function x(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((m)=>{let d=new URLSearchParams(m).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(c,n,T){let m=n.variant==="compact",d=n.labels??Wt,l=new Map,E=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};E(n.seats);let f={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=m?"compact":"full";let g=document.createElement("div");g.className="rt-table-stage",o.appendChild(g);let r=null,y=!1,A=()=>!m&&(Boolean(n.listBelow)||y);c.appendChild(o);let u=new Map,S=()=>{if(!A()){r?.remove(),r=null,u.clear(),delete o.dataset.list;return}if(!r)r=document.createElement("ul"),r.className="rt-table-list",r.setAttribute("aria-label",d.table),o.appendChild(r),o.dataset.list="";for(let e of[...u.keys()])if(!l.has(e))u.delete(e);for(let e of l.values()){let t=u.get(e.id);if(!t){t=document.createElement("button"),t.type="button",t.dataset.seat=e.id;let s=e.id;t.addEventListener("click",(i)=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name,at:Et(i,i.currentTarget)})}),u.set(e.id,t)}t.textContent=d.seat(e.name,e.state??"idle"),t.style.setProperty("--seat",e.color)}r.replaceChildren(...[...l.values()].map((e)=>{let t=document.createElement("li"),s=u.get(e.id);if(s)t.appendChild(s);return t}))};S();let w=(e)=>{y=!e,S(),n.onNames?.(e)},v=async()=>{let{createTable2D:e}=await (p("vy4w4r5k"),import("./chunk-table2d-vy4w4r5k.js"));a=e(g,{...n,theme:f.t,scheme:f.s,seats:[...l.values()]}),w(!0)},C=async()=>{let{createTable3D:e}=await (p("0a62jerb"),import("./chunk-table3d-0a62jerb.js"));a=e(g,{...n,theme:f.t,scheme:f.s,seats:[...l.values()],onNames:w},()=>{a?.dispose(),v()})};if(m||T==="svg"||T!=="webgl"&&(x(location.search,location.hash)||!H()))await v();else try{await C()}catch{await v()}let M,L=n.onSeatMenu;if(L){let{attachSeatMenu:e}=await (p("3tdcr44t"),import("./chunk-seat-menu-3tdcr44t.js"));M=e(o,(t,s,i)=>{let b=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,h=l.get(b??a?.seatAt?.(s,i)??"");return h?{id:h.id,name:h.name}:void 0},L)}return{get kind(){return a.kind},setTheme(e,t){f={t:e,s:t},a.setTheme(e,t)},setSeats(e){E(e),S(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;S(),a.setState(e,t)},setMark:(e,t)=>a.setMark(e,t),setAvatar(e,t,s){let i=l.get(e);if(i)if(i.avatarSvg=t,s===void 0)delete i.talkSvg;else i.talkSvg=s;return a.setAvatar(e,t,s)},setReducedMotion:(e)=>a.setReducedMotion(e),resetCamera:()=>a.resetCamera(),focus:(e,t)=>a.focus(e,t),focused:()=>a.focused(),seatAt:(e,t)=>a.seatAt?.(e,t)??null,getStats:()=>a.getStats(),dispose(){M?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
1
+ import{Et,Wt}from"./chunk-index-0xdptr30.js";import{p}from"./chunk-index-rvatmx8s.js";function H(){try{let c=document.createElement("canvas");return!!(c.getContext("webgl2")||c.getContext("webgl"))}catch{return!1}}function x(c,n){return[c,n.includes("?")?n.slice(n.indexOf("?")):""].some((m)=>{let d=new URLSearchParams(m).get("nogl");return d!==null&&d!=="0"&&d!=="false"})}async function I(c,n,T){let m=n.variant==="compact",d=n.labels??Wt,l=new Map,E=(e)=>{l.clear();for(let t of e)l.set(t.id,{...t})};E(n.seats);let f={t:n.theme,s:n.scheme},a=null,o=document.createElement("div");o.className="rt-table",o.dataset.variant=m?"compact":"full";let g=document.createElement("div");g.className="rt-table-stage",o.appendChild(g);let r=null,y=!1,A=()=>!m&&(Boolean(n.listBelow)||y);c.appendChild(o);let u=new Map,S=()=>{if(!A()){r?.remove(),r=null,u.clear(),delete o.dataset.list;return}if(!r)r=document.createElement("ul"),r.className="rt-table-list",r.setAttribute("aria-label",d.table),o.appendChild(r),o.dataset.list="";for(let e of[...u.keys()])if(!l.has(e))u.delete(e);for(let e of l.values()){let t=u.get(e.id);if(!t){t=document.createElement("button"),t.type="button",t.dataset.seat=e.id;let s=e.id;t.addEventListener("click",(i)=>{let b=l.get(s);if(b)n.onSeatClick({id:b.id,name:b.name,at:Et(i,i.currentTarget)})}),u.set(e.id,t)}t.textContent=d.seat(e.name,e.state??"idle"),t.style.setProperty("--seat",e.color)}r.replaceChildren(...[...l.values()].map((e)=>{let t=document.createElement("li"),s=u.get(e.id);if(s)t.appendChild(s);return t}))};S();let w=(e)=>{y=!e,S(),n.onNames?.(e)},v=async()=>{let{createTable2D:e}=await (p("k4z439nt"),import("./chunk-table2d-k4z439nt.js"));a=e(g,{...n,theme:f.t,scheme:f.s,seats:[...l.values()]}),w(!0)},C=async()=>{let{createTable3D:e}=await (p("mx0afnv8"),import("./chunk-table3d-mx0afnv8.js"));a=e(g,{...n,theme:f.t,scheme:f.s,seats:[...l.values()],onNames:w},()=>{a?.dispose(),v()})};if(m||T==="svg"||T!=="webgl"&&(x(location.search,location.hash)||!H()))await v();else try{await C()}catch{await v()}let M,L=n.onSeatMenu;if(L){let{attachSeatMenu:e}=await (p("cw3z9560"),import("./chunk-seat-menu-cw3z9560.js"));M=e(o,(t,s,i)=>{let b=t instanceof Element?t.closest("[data-seat]")?.dataset.seat:void 0,h=l.get(b??a?.seatAt?.(s,i)??"");return h?{id:h.id,name:h.name}:void 0},L)}return{get kind(){return a.kind},setTheme(e,t){f={t:e,s:t},a.setTheme(e,t)},setSeats(e){E(e),S(),a.setSeats(e)},setState(e,t){let s=l.get(e);if(s)s.state=t;S(),a.setState(e,t)},setMark:(e,t)=>a.setMark(e,t),setAvatar(e,t,s){let i=l.get(e);if(i)if(i.avatarSvg=t,s===void 0)delete i.talkSvg;else i.talkSvg=s;return a.setAvatar(e,t,s)},setReducedMotion:(e)=>a.setReducedMotion(e),resetCamera:()=>a.resetCamera(),focus:(e,t)=>a.focus(e,t),focused:()=>a.focused(),seatAt:(e,t)=>a.seatAt?.(e,t)??null,getStats:()=>a.getStats(),dispose(){M?.(),a?.dispose(),o.remove()}}}export{I as mountRoundTable};
@@ -1 +1 @@
1
- import{p,s,A,t,B,g,e,n,o,Qe,u,Oe,zt,Kn,ro,oo,qe,ei,Rn}from"./chunk-index-s356ybxk.js";import"./chunk-index-qq86fxda.js";import"./chunk-index-50w6yq2d.js";import{nr}from"./chunk-index-y1xv3dxs.js";import{Yt}from"./chunk-index-ddssgba9.js";import{Fi}from"./chunk-index-6ycrvwzs.js";var N=()=>(p("rw5myg2t"),import("./chunk-layout-actions-rw5myg2t.js")),b=(a)=>(p("wcwy91mp"),import("./chunk-placement-items-wcwy91mp.js")).then((r)=>r.folderMenu(a)),F=(a)=>({mode:"folder",key:a,item:(r)=>r.closest("[data-folder-block]"),root:(r)=>r.closest("[data-folder-block]")?.parentElement??null,onDrop:(r)=>{if(r.type==="folder")N().then((l)=>l.placeFolderBefore(a,r.before))},open:ro});function k(a){let{id:r,name:l}=a,i=!a.folded,d=A(),m=Yt(()=>b(r),F(r)),f=(c)=>{b(r).then((y)=>{if(!y)return;let h=c.getBoundingClientRect();Oe({...y,at:{x:h.left,y:h.bottom},via:"key",source:c})},()=>{return})};return n("section",{className:"folder","aria-label":l,"data-folder-block":"","data-key":r,"data-drop-zone":"folder","data-zone-id":r,"data-folder":r,"data-collapsed":i?void 0:"",children:[n("header",{className:"folder-head","data-folder-head":"",...m,children:[n("button",{type:"button",className:"folder-toggle","aria-expanded":i,"aria-controls":d,"aria-label":i?t("Collapse {name}",{name:l}):t("Expand {name}",{name:l}),onClick:()=>Kn(r),children:[e(o,{name:"chevron",size:16,className:"folder-chevron","data-open":i||void 0}),e("strong",{children:l}),e("span",{className:"meta",children:B(a.count,"{count} room","{count} rooms")}),i?null:a.stack]}),a.muted==="none"?null:e(o,{name:"bell-off",size:14,className:"muted-mark","data-partial":a.muted==="some"||void 0,role:"img","aria-hidden":!1,"aria-label":a.muted==="all"?t("Notifications are off"):t("Some notifications are off")}),i?null:a.summary,e("button",{type:"button",className:"icon-button folder-more","aria-haspopup":"menu","aria-label":t("Folder menu"),onClick:(c)=>f(c.currentTarget),children:e(o,{name:"more",size:18})})]}),e("div",{id:d,className:"folder-body",hidden:!i&&a.shown===0,children:i&&a.count===0?e("p",{className:"meta folder-empty",children:t("No rooms in this folder yet.")}):a.shown>0?a.children:null})]})}var w=4;function S(a){let r=a.rooms.slice(0,w),l=u((d)=>r.map((m)=>d.rooms[m]?.view),r.join(",")),i=a.rooms.length-r.length;return n("span",{className:"folder-stack","aria-hidden":"true",children:[l.map((d)=>d?e("span",{className:"folder-stack-item",children:e(qe,{view:d,size:28})},d.key):null),i>0?n("span",{className:"folder-stack-more",children:["+",i]}):null]})}function v(a){let r=u((l)=>({waiting:a.rooms.reduce((i,d)=>i+Qe(l,d),0),typing:a.rooms.some((i)=>l.rooms[i]?.typing)}),a.rooms.join(","));return n(g,{children:[r.typing?e(ei,{}):null,r.waiting?e(Rn,{count:r.waiting}):null]})}function R(a){return u((r)=>Fi(a,(l)=>r.rooms[l]?.view?.muted===!0),a.join(","))}function U(a){let r=a.folders.map((l)=>l.id).join(",");return s(()=>{if(a.listed)oo(r?r.split(","):[])},[a.listed,r]),e(g,{children:a.folders.map((l)=>e(M,{folder:l,...a},l.id))})}function M(a){let{folder:r}=a,l=R(r.rooms),i=zt().has(r.id),d=nr(r.rooms,a.active),m=i?d:r.rooms,f=i?r.rooms.filter((c)=>!d.includes(c)):[];return e(k,{id:r.id,name:r.name,count:r.rooms.length,folded:i,shown:m.length,muted:l,summary:e(v,{rooms:f}),stack:f.length>0?e(S,{rooms:f}):null,children:a.rooms(m)})}export{U as FolderList};
1
+ import{p,o,R,t,F,g,e,n,s,Me,u,Oe,It,oi,go,Oo,$e,li,$n}from"./chunk-index-rvatmx8s.js";import"./chunk-index-tfgd7vr5.js";import"./chunk-index-e3encn5p.js";import{ur}from"./chunk-index-vwd5drzh.js";import{Jt}from"./chunk-index-qb41kkt3.js";import{Wi}from"./chunk-index-g3f1sdw0.js";var N=()=>(p("yxh77zcz"),import("./chunk-layout-actions-yxh77zcz.js")),b=(a)=>(p("zyqq2mp7"),import("./chunk-placement-items-zyqq2mp7.js")).then((r)=>r.folderMenu(a)),w=(a)=>({mode:"folder",key:a,item:(r)=>r.closest("[data-folder-block]"),root:(r)=>r.closest("[data-folder-block]")?.parentElement??null,onDrop:(r)=>{if(r.type==="folder")N().then((l)=>l.placeFolderBefore(a,r.before))},open:go});function k(a){let{id:r,name:l}=a,i=!a.folded,d=R(),m=Jt(()=>b(r),w(r)),f=(c)=>{b(r).then((y)=>{if(!y)return;let h=c.getBoundingClientRect();Oe({...y,at:{x:h.left,y:h.bottom},via:"key",source:c})},()=>{return})};return n("section",{className:"folder","aria-label":l,"data-folder-block":"","data-key":r,"data-drop-zone":"folder","data-zone-id":r,"data-folder":r,"data-collapsed":i?void 0:"",children:[n("header",{className:"folder-head","data-folder-head":"",...m,children:[n("button",{type:"button",className:"folder-toggle","aria-expanded":i,"aria-controls":d,"aria-label":i?t("Collapse {name}",{name:l}):t("Expand {name}",{name:l}),onClick:()=>oi(r),children:[e(s,{name:"chevron",size:16,className:"folder-chevron","data-open":i||void 0}),e("strong",{children:l}),e("span",{className:"meta",children:F(a.count,"{count} room","{count} rooms")}),i?null:a.stack]}),a.muted==="none"?null:e(s,{name:"bell-off",size:14,className:"muted-mark","data-partial":a.muted==="some"||void 0,role:"img","aria-hidden":!1,"aria-label":a.muted==="all"?t("Notifications are off"):t("Some notifications are off")}),i?null:a.summary,e("button",{type:"button",className:"icon-button folder-more","aria-haspopup":"menu","aria-label":t("Folder menu"),onClick:(c)=>f(c.currentTarget),children:e(s,{name:"more",size:18})})]}),e("div",{id:d,className:"folder-body",hidden:!i&&a.shown===0,children:i&&a.count===0?e("p",{className:"meta folder-empty",children:t("No rooms in this folder yet.")}):a.shown>0?a.children:null})]})}var S=4;function v(a){let r=a.rooms.slice(0,S),l=u((d)=>r.map((m)=>d.rooms[m]?.view),r.join(",")),i=a.rooms.length-r.length;return n("span",{className:"folder-stack","aria-hidden":"true",children:[l.map((d)=>d?e("span",{className:"folder-stack-item",children:e($e,{view:d,size:28})},d.key):null),i>0?n("span",{className:"folder-stack-more",children:["+",i]}):null]})}function M(a){let r=u((l)=>({waiting:a.rooms.reduce((i,d)=>i+Me(l,d),0),typing:a.rooms.some((i)=>l.rooms[i]?.typing)}),a.rooms.join(","));return n(g,{children:[r.typing?e(li,{}):null,r.waiting?e($n,{count:r.waiting}):null]})}function C(a){return u((r)=>Wi(a,(l)=>r.rooms[l]?.view?.muted===!0),a.join(","))}function U(a){let r=a.folders.map((l)=>l.id).join(",");return o(()=>{if(a.listed)Oo(r?r.split(","):[])},[a.listed,r]),e(g,{children:a.folders.map((l)=>e(B,{folder:l,...a},l.id))})}function B(a){let{folder:r}=a,l=C(r.rooms),i=It().has(r.id),d=ur(r.rooms,a.active),m=i?d:r.rooms,f=i?r.rooms.filter((c)=>!d.includes(c)):[];return e(k,{id:r.id,name:r.name,count:r.rooms.length,folded:i,shown:m.length,muted:l,summary:e(M,{rooms:f}),stack:f.length>0?e(v,{rooms:f}):null,children:a.rooms(m)})}export{U as FolderList};
@@ -0,0 +1 @@
1
+ import{Ae,It,mo,oi,go,Oo}from"./chunk-index-rvatmx8s.js";export{mo as collapsedNow,go as expandFolder,Oo as pruneCollapsed,Ae as sectionFold,oi as toggleCollapsed,It as useCollapsed};
@@ -0,0 +1 @@
1
+ import{t,e,n,s,x}from"./chunk-index-rvatmx8s.js";import{Bn,fn}from"./chunk-index-70pq2k7q.js";function l({steps:p}){return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Finish setting up")})}),e("p",{className:"meta",children:t("These steps come first. The rest of the app opens when they are done.")}),e("ul",{className:"menu",children:p.map((a)=>e("li",{children:n("a",{className:"menu-item menu-link",href:x(a.open.page),children:[n("span",{className:"menu-text",children:[e("strong",{children:Bn(a)}),fn(a)?e("span",{className:"meta",children:fn(a)}):null]}),e(s,{name:"chevron",size:16})]})},a.id))})]})}export{l as GatePage};
@@ -0,0 +1 @@
1
+ import"./chunk-index-6hy2fabj.js";
@@ -0,0 +1 @@
1
+ import{st}from"./chunk-index-ads1abh1.js";export{st as HostPicture};
@@ -0,0 +1 @@
1
+ import{Ro,me,Er,Co,Eo,Ao,$o,an,Ar,No,Da}from"./chunk-index-tfgd7vr5.js";export{No as keepCards,Ar as keepReads,$o as noCards,Ao as noReads,Da as onFrame,an as seedUnread,Ro as subscribeHost,Co as totalUnread,Eo as unreadCounts,Er as unreadOf,me as useHost};
@@ -0,0 +1 @@
1
+ import{ee,E,o,R,Se,C,a,r,t,F,g,e,n,s,x,xn,O,u,fe,l,f,S,m,k,Q,tn,ei,$t,_,co,Te,nn,kn,Nt,_n,Re,Tn,zt,po,te,En,kr,_r,oa,Tr,ze}from"./chunk-index-rvatmx8s.js";import{qn}from"./chunk-index-zr2qwzz4.js";import{tr,as,He,nr}from"./chunk-index-gpaychmm.js";import{D}from"./chunk-index-gae833v6.js";import{me,Ao,$o,an,Ar,No}from"./chunk-index-tfgd7vr5.js";import{ot,st}from"./chunk-index-ads1abh1.js";import{Vr}from"./chunk-index-726w3145.js";import"./chunk-index-6hy2fabj.js";import{Ee}from"./chunk-index-xv3e4x0j.js";import{H}from"./chunk-index-5e8wn6r3.js";import"./chunk-index-0dyf2gdm.js";function Ke(c){let i={};for(let d of c)if(d.type==="multiselect")i[d.name]=[...Oe(d.initial)];else i[d.name]=Oe(d.initial)[0]??"";return i}var Oe=(c)=>c===void 0?[]:typeof c==="string"?[c]:[...c];function et(c,i){let d={};for(let p of c){let y=i[p.name];if(y===void 0||y===""||y.length===0)continue;d[p.name]=y}return d}function tt(c){let{field:i,value:d}=c,[p,y]=r(""),w=i.search?i.options.filter((h)=>h.label.toLowerCase().includes(p.trim().toLowerCase())):i.options,N=i.search?e("input",{type:"search",value:p,placeholder:t("Search…"),"aria-label":t("Search {name}",{name:i.label}),onChange:(h)=>y(h.target.value)}):null;if(i.type==="select")return n(g,{children:[N,n(Ee,{id:c.id,value:String(d),required:i.required===!0,"aria-describedby":c.described,...i.search?{size:6}:{},onChange:(h)=>c.onChange(h.target.value),children:[i.required?null:e("option",{value:"",children:t("None")}),w.map((h)=>e("option",{value:h.value,children:h.label},h.value))]})]});let b=new Set(Array.isArray(d)?d:[]);return n(g,{children:[N,e("fieldset",{"aria-describedby":c.described,children:w.map((h)=>n("label",{children:[e("input",{type:"checkbox",checked:b.has(h.value),onChange:(T)=>{let v=new Set(b);if(T.target.checked)v.add(h.value);else v.delete(h.value);c.onChange(i.options.filter((P)=>v.has(P.value)).map((P)=>P.value))}}),h.label]},h.value))})]})}function nt(c){let{field:i,value:d}=c,p=R(),y="hint"in i?i.hint:void 0,w=c.error||y?`${p}-note`:void 0,N;if("options"in i)N=e(tt,{field:i,id:p,value:d,described:w,onChange:c.onChange});else if(i.type==="textarea")N=e("textarea",{id:p,rows:5,value:String(d),maxLength:i.max??8000,required:i.required===!0,"aria-describedby":w,onChange:(b)=>c.onChange(b.target.value)});else N=e("input",{id:p,type:i.type==="url"?"url":"text",value:String(d),maxLength:i.max??500,required:i.required===!0,"aria-describedby":w,onChange:(b)=>c.onChange(b.target.value)});return n("div",{className:"host-field",children:[i.type==="multiselect"?e("span",{className:"field-label",children:i.label}):e("label",{htmlFor:p,children:i.label}),N,c.error||y?e("span",{id:`${p}-note`,className:c.error?"field-error":"hint",role:c.error?"alert":void 0,children:c.error??y}):null]})}function pe(c){let{spec:i}=c,[d,p]=r(()=>Ke(i.fields)),[y,w]=r(!1),[N,b]=r();return n("form",{className:"host-form",onSubmit:async(T)=>{if(T.preventDefault(),y)return;w(!0),b(void 0);try{b(await c.onSubmit(et(i.fields,d)))}catch(v){b({error:l(v)})}finally{w(!1)}},children:[i.fields.map((T)=>e(nt,{field:T,value:d[T.name]??"",error:N?.field===T.name?N.error:void 0,onChange:(v)=>p((P)=>({...P,[T.name]:v}))},T.name)),N&&!i.fields.some((T)=>T.name===N.field)?e(m,{message:N.error}):null,n("div",{className:"actions",children:[c.onCancel?e("button",{type:"button",className:"secondary",disabled:y,onClick:c.onCancel,children:t("Cancel")}):null,e("button",{type:"submit",disabled:y,children:i.submit})]})]})}function rt(c){if(!c.ok)return{error:tr(c.error),...c.field?{field:c.field}:{}};if(c.notice)f(c.notice);if(c.open)nr(c.open);return}function oe(c){let[i,d]=r(),[p,y]=r(!1),w=async(b,h)=>rt(await c.run(b,h)),N=async(b)=>{if(b.form||b.confirm){d(b);return}y(!0);try{let h=await w(b,{});if(h)f(h.error,"danger")}catch(h){f(l(h),"danger")}finally{y(!1)}};if(c.actions.length===0)return null;return n("div",{className:c.className??"host-actions",children:[c.actions.map((b)=>e("button",{type:"button",className:b.style==="danger"?"danger":b.style==="secondary"?"secondary":"",disabled:p,onClick:()=>N(b),children:b.label},b.id)),i?.form?e(H,{open:!0,title:i.form.title,onClose:()=>d(void 0),children:e(pe,{spec:i.form,onCancel:()=>d(void 0),onSubmit:async(b)=>{let h=await w(i,b);if(!h)d(void 0);return h}})}):i?e(D,{open:!0,title:i.label,confirmLabel:i.label,tone:i.style==="danger"?"danger":"primary",onConfirm:async()=>{let b=await w(i,{});if(b)throw Error(b.error)},onClose:()=>d(void 0),children:e("p",{children:i.confirm})}):null]})}var _e=/^file:([A-Za-z0-9_-]{1,64})$/;function qe(c){let i=URL.parse(c,document.baseURI);return i!==null&&i.origin===window.location.origin}function it({id:c,alt:i}){return e("img",{className:"file-image",src:`api/files/${encodeURIComponent(c)}`,alt:i,loading:"lazy",decoding:"async",onError:(d)=>{let p=document.createElement("span");p.textContent=i||t("Image"),d.currentTarget.replaceWith(p)}})}var re=ee(function({source:i}){return e("div",{className:"prose",children:e(tn,{remarkPlugins:[$t],urlTransform:(d)=>_e.test(d)?d:ei(d),components:{a:({href:d,children:p})=>d&&/^https?:\/\//.test(d)&&!qe(d)?e("a",{href:d,target:"_blank",rel:"noreferrer noopener",children:p}):d&&qe(d)?e("a",{href:d,children:p}):e("span",{children:p}),img:({src:d,alt:p})=>{let y=typeof d==="string"?_e.exec(d):null;return y?.[1]?e(it,{id:y[1],alt:p??""}):e("span",{children:p})},pre:co,table:({children:d})=>e("div",{className:"table-wrap",children:e("table",{children:d})})},children:i})})});function at(c){switch(c??"open"){case"working":return t("Working…");case"done":return t("Done");case"superseded":return t("Replaced");case"expired":return t("Expired");default:return""}}var Ne=(c)=>(c.state??"open")==="open";function ae(c){let{card:i}=c,d=at(i.state);return n("article",{className:"host-card","data-tone":i.tone??"note","data-state":i.state??"open",children:[n("header",{children:[e("h3",{children:i.title}),d?e(Q,{tone:i.state==="working"?"busy":"plain",children:d}):null]}),i.body?e(re,{source:i.body}):null,i.links?.length?e("div",{className:"host-card-links",children:i.links.map((p)=>e("a",{href:p.url,...p.url.startsWith("/")?{}:{target:"_blank",rel:"noreferrer noopener"},children:p.label},`${p.url}`))}):null,Ne(i)&&i.buttons?.length?e(oe,{actions:i.buttons,run:c.run}):null]})}ot();function lt(){let[c,i]=r(()=>qn().toString());return o(()=>{let d=()=>i(qn().toString());return window.addEventListener("popstate",d),window.addEventListener("hashchange",d),()=>{window.removeEventListener("popstate",d),window.removeEventListener("hashchange",d)}},[]),c}function ct(c){if(!c.ok)return{error:tr(c.error),...c.field?{field:c.field}:{}};if(c.notice)f(c.notice);if(c.open)nr(c.open);return}function dt(c){let{section:i}=c;switch(i.kind){case"markdown":return e(re,{source:i.text});case"card":return e(ae,{card:i.card,run:c.run});case"form":return n("section",{className:"stack",children:[e("h2",{className:"section-title",children:i.form.title}),e(pe,{spec:i.form,onSubmit:(d)=>c.submit(i.action,d)})]});case"list":return n("section",{className:"stack",children:[i.title?e("h2",{className:"section-title",children:i.title}):null,i.rows.length===0?e(k,{children:t("Nothing here.")}):null,e("ul",{className:"host-list",children:mt(i.rows).map(([d,p])=>n("li",{children:[p.attention?e("span",{className:"attention-dot",role:"img","aria-label":t("Needs attention")}):null,n("div",{className:"host-list-main",children:[p.open?e("a",{href:p.open,...p.open.startsWith("/")?{}:{target:"_blank",rel:"noreferrer noopener"},children:p.title}):e("strong",{children:p.title}),p.subtitle?e("span",{children:p.subtitle}):null]}),p.actions?.length?e(oe,{actions:p.actions,run:c.run}):null]},d))})]})}}function ut({routeKey:c}){let i=c??"",d=lt(),p=me((v)=>v.pages[i]??0),[y,w]=r(0),[N,b]=r({});o(()=>{let v=!0;return He.page(i,Object.fromEntries(new URLSearchParams(d))).then((P)=>v&&b({page:P}),(P)=>{if(!v)return;let q=P instanceof fe&&P.status===404;b((z)=>({...q||!z.page?{}:{page:z.page},error:l(P),gone:q}))}),()=>{v=!1}},[i,d,p,y]);let h=async(v,P)=>{let q=await He.pageAct(i,{action:v,input:P}),z=ct(q);if(!z)w((V)=>V+1);return z},T=async(v,P)=>{let q=await He.pageAct(i,{action:v.id,input:P});if(q.ok)w((z)=>z+1);return q};if(N.gone)return e("div",{className:"page",children:e(k,{children:t("This page is not available.")})});if(!N.page)return e("div",{className:"page",children:N.error?e(m,{message:N.error}):e(S,{})});return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:N.page.title})}),N.error?e(m,{message:N.error}):null,N.page.sections.map((v,P)=>e(dt,{section:v,run:T,submit:h},P))]})}function mt(c){let i=new Map;return c.map((d)=>{let p=i.get(d.title)??0;return i.set(d.title,p+1),[`${d.title}:${p}`,d]})}function De(c){let i=me((T)=>T.cards[c.room]??$o),d=Re("(min-width: 720px) and (min-height: 760px)"),[p,y]=r();if(i.length===0)return null;let w=i.filter((T)=>Ne(T)||T.state==="working"),N=i.filter((T)=>!w.includes(T)),b=p??(d&&w.length>0),h=w[0];return n("div",{className:"host-cards","data-open":b||void 0,children:[n("button",{type:"button",className:"host-cards-toggle","aria-expanded":b,onClick:()=>y(!b),children:[e(s,{name:"chevron",size:14}),h?n("span",{children:[e("strong",{children:F(w.length,"{count} card waiting","{count} cards waiting")}),`: ${h.title}`]}):e("span",{children:t("Earlier cards ({count})",{count:N.length})})]}),b?n("div",{className:"host-cards-body",children:[w.map((T)=>e(ae,{card:T,run:c.run(T.id)},T.id)),N.length?n("details",{className:"host-cards-older",children:[e("summary",{children:t("Earlier cards ({count})",{count:N.length})}),N.map((T)=>e(ae,{card:T,run:c.run(T.id)},T.id))]}):null]}):null]})}var ft=/https?:\/\/[^\s<>"']+/g,pt=/[.,;:!?)\]}\u3001\u3002\uff0c\uff1b\uff1a\uff01\uff1f\uff09\u300d\u300f]+$/;function gt(c){let i=c.replace(pt,""),d=URL.parse(i);return d&&(d.protocol==="https:"||d.protocol==="http:")?i:""}function Ue({text:c}){let i=[],d=0;for(let p of c.matchAll(ft)){let y=gt(p[0]);if(y==="")continue;let w=p.index;if(w>d)i.push(c.slice(d,w));i.push(e("a",{href:y,target:"_blank",rel:"noreferrer noopener",children:y},`${w}`)),d=w+y.length}if(d<c.length)i.push(c.slice(d));return e("span",{className:"plain",children:i})}var $e=ee(function(i){let{message:d}=i,p=d.authorKind??"external";if(p==="notice")return n("li",{className:"host-notice","data-mid":d.id,"data-highlight":i.highlighted||void 0,"data-enter":i.enter||void 0,children:[e(s,{name:"bell",size:14}),e(re,{source:d.text}),e("time",{dateTime:d.at,children:nn(d.at,i.timeZone)})]});let y=p==="member"&&d.principalId!==void 0&&d.principalId===i.me;return n("li",{className:"message","data-mid":d.id,"data-author":p,"data-mine":y||void 0,"data-header":i.header||void 0,"data-enter":i.enter||void 0,"data-unread":i.unread||void 0,"data-highlight":i.highlighted||void 0,children:[y?null:e("span",{className:"message-avatar",children:i.header?e(st,{picture:d.picture,name:d.author}):null}),n("div",{className:"message-main",children:[i.header?n("div",{className:"message-meta",children:[e("strong",{children:d.author}),d.authorLabel?e("span",{className:"label-chip",children:d.authorLabel}):null,e("time",{dateTime:d.at,children:nn(d.at,i.timeZone)})]}):null,n("div",{className:"bubble",children:[e(po,{files:d.files}),d.text?p==="assistant"?e(re,{source:d.text}):e(Ue,{text:d.text}):null,e(zt,{files:d.files,message:d}),d.expiredFiles?e("p",{className:"message-expired",children:F(d.expiredFiles,"{count} file was removed","{count} files were removed")}):null]}),d.edited?e("span",{className:"message-edited",children:t("edited")}):null]})]})});var ht=1500,bt=96,ge=new Set,Ae=new Map;function yt(c){if(document.visibilityState!=="visible")return!1;return!c||c.scrollHeight-c.scrollTop-c.clientHeight<bt}function Be(c){if(!(c instanceof Element))return;let i=c.closest("[data-unread][data-mid]");return i?Number(i.dataset.mid):void 0}function Ge(c){let{room:i,scroller:d,messages:p,began:y,enterAfter:w,me:N,shared:b}=c,h=a({seen:void 0,watched:new Set}),[,T]=r(0),v=Ae.get(i)??ge;if(w!==void 0&&p){let M=h.current;M.seen??=w;let I=yt(d.current),W=M.seen;for(let L of p){if(L.id<=M.seen)continue;if(I)M.watched.add(L.id);W=Math.max(W,L.id)}M.seen=W}let P=C(()=>{if(y===void 0||w===void 0||!p)return ge;let M=new Set;for(let I of p){if(I.id===0||I.id<=y)continue;if(I.kind==="system"||I.note)continue;if(I.authorKind==="notice")continue;if(I.principalId===void 0?I.kind==="owner"&&!b:I.principalId===N)continue;if(h.current.watched.has(I.id)||v.has(I.id))continue;M.add(I.id)}return M.size===0?ge:M},[p,y,w,N,b,v]),q=E((M)=>{let I=Ae.get(i)??ge;if(I.has(M))return;Ae.set(i,new Set(I).add(M)),T((W)=>W+1)},[i]),z=P.size>0;o(()=>{let M=d.current;if(!M||!z)return;let I=(L)=>{if(L.pointerType==="touch")return;let G=Be(L.target);if(G!==void 0)q(G)},W=(L)=>{let G=Be(L.target);if(G!==void 0)q(G)};return M.addEventListener("pointerover",I,{passive:!0}),M.addEventListener("focusin",W,{passive:!0}),M.addEventListener("click",W,{passive:!0}),()=>{M.removeEventListener("pointerover",I),M.removeEventListener("focusin",W),M.removeEventListener("click",W)}},[d,q,z]);let V=a(new Map),B=[...P].join(",");return o(()=>{let M=d.current,I=V.current;for(let[Z,Y]of I)if(!P.has(Z))clearTimeout(Y),I.delete(Z);if(!M||!z||typeof IntersectionObserver!=="function"||!matchMedia("(pointer: coarse)").matches)return;let W=(Z)=>{let Y=I.get(Z);if(Y===void 0)return;clearTimeout(Y),I.delete(Z)},L=new IntersectionObserver((Z)=>{for(let Y of Z){let ne=Number(Y.target.dataset.mid),le=Y.rootBounds;if(!(Y.isIntersecting&&(Y.intersectionRatio>=0.5||le!==null&&Y.intersectionRect.height>=le.height*0.5))){W(ne);continue}if(I.has(ne))continue;I.set(ne,setTimeout(()=>{if(I.delete(ne),document.visibilityState==="visible")q(ne)},ht))}},{root:M,threshold:[0,0.25,0.5,0.75,1]}),G=[...M.querySelectorAll("[data-unread][data-mid]")];for(let Z of G)L.observe(Z);let j=()=>{if(document.visibilityState!=="visible")return;for(let Z of G)L.unobserve(Z),L.observe(Z)};return document.addEventListener("visibilitychange",j),()=>{document.removeEventListener("visibilitychange",j),L.disconnect()}},[d,q,z,B]),o(()=>{let M=V.current;return()=>{for(let I of M.values())clearTimeout(I);M.clear()}},[]),P}ot();var vt=3;function wt({marks:c}){let[i,d]=r(!1);return n("li",{className:"seen",children:[n("button",{type:"button",className:"seen-toggle","aria-expanded":i,onClick:()=>d((p)=>!p),children:[c.slice(0,vt).map((p)=>e(st,{picture:{principal:p.principal},name:p.name,size:16},p.principal)),e("span",{children:t("Seen by {count}",{count:c.length})})]}),i?e("span",{className:"seen-names",children:c.map((p)=>p.name).join(t(", "))}):null]})}function kt(c,i){let d=ze(),p=u((y)=>y.connects);o(()=>{let y=i.current;if(!y)return;let w=0,N=0,b,h,T=()=>{if(h=void 0,document.visibilityState!=="visible")return;let q=y.getBoundingClientRect(),z=0;for(let B of y.querySelectorAll("[data-mid]")){let M=B.getBoundingClientRect();if(M.bottom>q.top&&M.top<q.bottom-4)z=Math.max(z,Number(B.dataset.mid))}if(z<=w)return;let V=N+1000-Date.now();if(V>0){clearTimeout(b),b=setTimeout(v,V);return}if(d.send({type:"read",room:c,upTo:z}))w=z,N=Date.now()},v=()=>{if(h===void 0)h=requestAnimationFrame(T)};y.addEventListener("scroll",v,{passive:!0}),document.addEventListener("visibilitychange",v),window.addEventListener("resize",v);let P=new MutationObserver(v);return P.observe(y,{childList:!0,subtree:!0}),v(),()=>{if(y.removeEventListener("scroll",v),document.removeEventListener("visibilitychange",v),window.removeEventListener("resize",v),P.disconnect(),clearTimeout(b),h!==void 0)cancelAnimationFrame(h)}},[d,c,i,p])}function he(c){let{roomKey:i}=c;kt(i,c.scroller);let d=u((v)=>v.principal?.id),p=u((v)=>v.rooms[i]?.messages),y=me((v)=>v.reads[i]??Ao),w=me((v)=>v.cursor[i]),N=a(void 0);if(N.current===void 0&&w!==void 0)N.current=w;let b=u((v)=>v.rooms[i]?.view?.notes===!0),h=Ge({room:i,scroller:c.scroller,messages:p,began:N.current,enterAfter:c.enterAfter,me:d,shared:c.host===!0||b}),T=C(()=>{let P=(p??[]).filter((V)=>V.kind!=="system"),q=N.current===void 0?void 0:P.find((V)=>V.id>(N.current??0)&&(V.principalId===void 0||V.principalId!==d))?.id,z=new Map;for(let V of y){if(V.principal===d)continue;let B=P.findLast((M)=>M.id<=V.upTo);if(B)z.set(B.id,[...z.get(B.id)??[],V])}return{before:(V)=>V.id===q?e("li",{className:"new-divider",children:e("span",{children:t("New messages")})}):null,after:(V)=>{let B=z.get(V.id);return B?e(wt,{marks:B}):null},unread:(V)=>h.has(V.id),...c.host?{message:(V,B)=>V.kind==="system"&&V.authorKind===void 0?void 0:e($e,{message:V,header:B.header,enter:B.enter,unread:B.unread,timeZone:B.timeZone,me:d,highlighted:c.highlight===V.id})}:{}}},[p,y,d,c.host,c.highlight,h]);return e(En,{roomKey:i,enterAfter:c.enterAfter,quotable:c.quotable,decor:T})}ot();var Ht=20,Rt=2600,We;function St(c,i,d){let p=u((b)=>b.connects),y=me((b)=>b.rooms[c]??0),[w,N]=r({view:void 0,error:void 0,gone:!1});return o(()=>{let b=!0;return He.open(i,d).then((h)=>{if(!b)return;O.dispatch({type:"history_loaded",room:c,messages:h.messages,more:h.more,older:!1}),Ar(c,h.reads,h.cursor),No(c,h.cards),N({view:h,error:void 0,gone:!1})},(h)=>{if(!b)return;let T=h instanceof fe&&h.status===404;N((v)=>({view:T?void 0:v.view,error:l(h),gone:T}))}),()=>{b=!1}},[c,i,d,p,y]),w}function At(c){let{header:i}=c;return n(g,{children:[i.banner?e("p",{className:"host-banner","data-tone":i.banner.tone,role:"status",children:i.banner.text}):null,i.fields.length?e("dl",{className:"host-head-fields",children:i.fields.map((d)=>n("div",{children:[e("dt",{children:d.label}),e("dd",{children:d.link?e("a",{href:d.link,...d.link.startsWith("/")?{}:{target:"_blank",rel:"noreferrer noopener"},children:d.value}):d.value})]},`${d.label}:${d.value}`))}):null,e(oe,{className:"host-actions bar",actions:i.actions,run:c.run})]})}function Et({roomKey:c}){let i=ze(),d=as(c),p=d?.kind??"",y=d?.id??"",{view:w,error:N,gone:b}=St(c,p,y),h=u((A)=>A.rooms[c]),T=u((A)=>A.limits),v=u((A)=>A.connects),P=u((A)=>A.connection==="open"),q=a(null),z=a(null),{away:V,onScroll:B,onGrow:M,toEnd:I}=Tr(q),[W,L]=r(!1),[G,j]=r(),[Z,Y]=r(We),[ne,le]=r(!1),[Le,Me]=r(),ye=a(void 0),se=a(void 0),J=w!==void 0,ce=kr(!Re("(min-width: 1024px)"));if(o(()=>{if(!d||b||!J)return;return i.send({type:"subscribe",room:c}),i.focus(c),()=>{i.focus(void 0),i.send({type:"unsubscribe",room:c})}},[i,c,v,b,J]),J&&ye.current===void 0)ye.current=h?.messages.at(-1)?.id??0;Se(()=>{if(J)I(!1)},[J]),Se(()=>{let A=q.current;if(A&&se.current!==void 0)A.scrollTop+=A.scrollHeight-se.current,se.current=void 0},[h?.messages[0]?.id]),o(()=>{let A=z.current;if(!A||typeof ResizeObserver>"u")return;let U=new ResizeObserver(M);return U.observe(A),()=>U.disconnect()},[M]);let ve=E(async()=>{let A=O.getState().rooms[c]?.messages[0];if(!A)return!1;let U=await He.older(p,y,A.id,xn);return O.dispatch({type:"history_loaded",room:c,messages:U.messages,more:U.more,older:!0}),Ar(c,U.reads,void 0),U.more},[c,p,y]),de=a(void 0);o(()=>{let A=()=>{let U=Number(qn().get("message"));de.current=Number.isSafeInteger(U)&&U>0?U:void 0};return A(),window.addEventListener("popstate",A),()=>window.removeEventListener("popstate",A)},[]);let we=h?.messages[0]?.id,Fe=h?.more===!0;o(()=>{let A=de.current,U=q.current;if(!J||A===void 0||!U)return;let X=U.querySelector(`[data-mid="${A}"]`);if(X){de.current=void 0,X.scrollIntoView({block:"center"}),Me(A),requestAnimationFrame(()=>U.dispatchEvent(new Event("scroll"))),setTimeout(()=>Me(void 0),Rt);return}if(we!==void 0&&A<we&&Fe){let ie=0;(async()=>{if(ie+=1,!await ve().catch(()=>!1)||ie>=Ht)de.current=void 0})()}},[J,we,Fe,h?.messages.length,ve]);let xe=(A,U={},X)=>He.act(p,y,{action:A.id,...X===void 0?{}:{card:X},input:U}),Ye=(A,U)=>xe(A,U),Je=(A)=>(U,X)=>xe(U,X,A);if(b||!J&&!N&&!d)return e("section",{className:"room",children:n("div",{className:"page",children:[e(k,{children:t("This room is not available.")}),e("a",{className:"back",href:x("rooms"),children:t("Back to rooms")})]})});let K=w?.access.send??[],ke=K.length>1,Ie=ke&&ne,Ve=Z&&K.includes(Z)?Z:K.includes("turn")?"turn":K[0],Pe=Ie||Ve==="turn",Xe=Pe?w?.wording?.turn?.placeholder??t("Ask AI…"):w?.wording?.note?.placeholder??t("Write an internal note…"),ue=w?.header.title??c,je=h?.messages??[];return n("section",{className:"room",...ce.surface,onDragOver:(A)=>{if(K.length&&A.dataTransfer.types.includes("Files"))A.preventDefault()},onDrop:(A)=>{if(!K.length||!A.dataTransfer.files.length)return;A.preventDefault(),j([...A.dataTransfer.files])},children:[n("header",{className:"room-head",children:[e("a",{className:"icon-button room-back",href:x("rooms"),"aria-label":t("Back to rooms"),children:e(s,{name:"back"})}),e(_n,{open:ce.enabled?ce.show:void 0,children:e(st,{name:ue,size:40})}),n("div",{className:"room-title",children:[e("h1",{children:ue}),e("span",{className:"room-status","data-working":h?.typing||void 0,children:h?.typing?t("Working…"):t("Host room")})]})]}),!P?n("div",{className:"offline-banner",role:"status",children:[e("span",{className:"spinner","aria-hidden":"true"}),t("Reconnecting… messages wait here until it is back.")]}):null,w?e(At,{header:w.header,run:Ye}):null,e("div",{className:"room-scroll",ref:q,onScroll:B,children:n("div",{className:"room-content",ref:z,children:[N?e(m,{message:N}):null,!J&&!N?e(S,{}):null,h?.more?e("button",{type:"button",className:"secondary older",disabled:W,onClick:async()=>{L(!0),se.current=q.current?.scrollHeight;try{await ve()}catch(A){se.current=void 0,f(l(A),"danger")}finally{L(!1)}},children:W?t("Loading…"):t("Load earlier messages")}):null,J&&je.length===0?e(k,{children:t("No messages yet.")}):null,e(he,{roomKey:c,enterAfter:ye.current,quotable:!1,scroller:q,host:!0,highlight:Le}),h?.typing?e(Tn,{name:ue,progress:h.progress}):null]})}),V?n("button",{type:"button",className:"to-end",onClick:()=>I(!0),children:[e(s,{name:"send",size:16,style:{transform:"rotate(180deg)"}}),t("Latest")]}):null,w?e(De,{room:c,run:Je}):null,w&&K.length===0?e("p",{className:"room-note",children:t("You can read this room but not write in it.")}):null,w&&K.length>0?e(g,{children:e(Nt,{draftKey:c,name:ue,placeholder:Xe,commands:oa,onAddressed:le,...ke?{above:e(Vr,{on:Pe,label:w?.wording?.turn?.label??t("@AI"),...Ie?{locked:t("The message starts with @AI, so the knight answers.")}:{},onChange:(A)=>{let U=A?"turn":"note";We=U,Y(U)}})}:{},limits:T,stoppable:Boolean(h?.stoppable),onSend:(A,U,X)=>{if(ke&&X){let ie=kn(A);i.say(c,ie===""&&U.length===0?A:ie,U,"turn")}else i.say(c,A,U,Ve);I(!0)},onStop:()=>i.send({type:"stop",room:c}),...G?{incoming:G,onIncomingTaken:()=>j(void 0)}:{}},c)}):null,e(_r,{...ce.drawer,current:c})]})}ot();function be({room:c}){let i=me((d)=>d.unread[c]??0);if(i<=0)return null;return e("span",{className:"unread-mark",role:"img","aria-label":F(i,"{count} unread message","{count} unread messages"),children:i>99?"99+":i})}ot();var Ct=6,Lt=250;function Ce(c){let{kind:i}=c,{timeZone:d}=_(),{now:p}=te(),y=u((L)=>L.connects),w=me((L)=>L.lists[i]??0),[N,b]=r(""),[h,T]=r(""),[v,P]=r(),[q,z]=r(),[V,B]=r(),[M,I]=r(!1);o(()=>{let L=setTimeout(()=>T(N.trim()),Lt);return()=>clearTimeout(L)},[N]),o(()=>{let L=!0;return He.list(i,h||void 0).then((G)=>{if(!L)return;an(Object.fromEntries(G.rooms.map((j)=>[j.key,j.unread??0]))),P(G.rooms),z(G.cursor),B(void 0)},(G)=>L&&B(l(G))),()=>{L=!1}},[i,h,y,w]);let W=async()=>{if(!q||M)return;I(!0);try{let L=await He.list(i,h||void 0,q);an(Object.fromEntries(L.rooms.map((G)=>[G.key,G.unread??0]))),P((G)=>[...G??[],...L.rooms]),z(L.cursor)}catch(L){B(l(L))}finally{I(!1)}};return n("section",{className:"stack",children:[n("h2",{className:"section-title",children:[c.icon?e(s,{name:c.icon,size:14,className:"section-icon"}):null,c.label]}),v&&(v.length>=Ct||h||N)?e("input",{type:"search",className:"kind-filter",value:N,placeholder:t("Search {name}",{name:c.label}),"aria-label":t("Search {name}",{name:c.label}),onChange:(L)=>b(L.target.value)}):null,V?e(m,{message:V}):null,!v&&!V?n("div",{className:"stack","aria-busy":"true",children:[e("div",{className:"skeleton"}),e("div",{className:"skeleton"})]}):null,v&&v.length===0?e(k,{children:h?t("Nothing matches."):t("No rooms yet.")}):null,v&&v.length>0?e("ul",{className:"room-list",children:v.map((L)=>e("li",{children:n("a",{className:"room-row",href:x("room",L.key),"aria-current":L.key===c.active?"page":void 0,children:[n("span",{className:"kind-row-picture",children:[e(st,{picture:L.picture,name:L.title,size:44}),L.attention?e("span",{className:"attention-dot",role:"img","aria-label":t("Needs attention")}):null]}),n("span",{className:"room-row-main",children:[n("span",{className:"room-row-top",children:[e("strong",{children:L.title}),e(be,{room:L.key}),e("span",{className:"room-row-time",children:L.lastAt?Te(L.lastAt,p,d):""})]}),e("span",{className:"room-row-preview",children:e("span",{children:L.subtitle??""})})]}),e(s,{name:"chevron",size:16,className:"room-row-chevron"})]})},L.key))}):null,q?e("button",{type:"button",className:"secondary",disabled:M,onClick:W,children:M?t("Loading…"):t("Show more")}):null]})}function Ze(c){return c.kinds.map((i)=>e(Ce,{kind:i.kind,label:i.label,...i.icon?{icon:i.icon}:{},active:c.active},i.kind))}function Qe(){let c=(_().pages??[]).filter((i)=>i.place==="settings");if(c.length===0)return null;return n("section",{className:"card stack",children:[e("h2",{children:t("More settings")}),c.map((i)=>n("a",{className:"menu-item menu-link",href:x("p",i.id),children:[e("span",{className:"menu-text",children:e("strong",{children:i.label})}),e(s,{name:"chevron",size:16})]},i.id))]})}export{Ze as HostKinds,ut as HostPage,Et as HostRoomPage,Qe as HostSettingsPages,he as ReadLog,be as UnreadMark};
@@ -1,2 +1,2 @@
1
- import{E,s,a,t,e,n,o,we}from"./chunk-index-s356ybxk.js";var T=96,N=0.6,w=220,D=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches;function C(i){let u=a(null),g=a(void 0),{open:h,onClose:P}=i,b=a(i.restoreFocus);b.current=i.restoreFocus;let m=a(!1),p=a(!1),M=E(()=>{let r=u.current;if(r?.open)r.close();if(b.current?.()?.focus(),m.current=!1,p.current)p.current=!1;else P()},[P]),d=E(()=>{let r=u.current;if(!r||m.current)return;if(m.current=!0,we()){M();return}r.dataset.state="closing",r.style.removeProperty("transform"),setTimeout(M,w)},[M]);s(()=>{let r=u.current;if(!r)return;if(h&&!r.open)r.dataset.state="opening",r.showModal(),requestAnimationFrame(()=>requestAnimationFrame(()=>{r.dataset.state="open"}));if(!h&&r.open&&!m.current)p.current=!0,d()},[h,d]);let v=(r)=>{if(!D())return;if(r.target instanceof Element&&r.target.closest("button, a"))return;g.current={y:r.clientY,at:r.timeStamp,dy:0},r.currentTarget.setPointerCapture(r.pointerId);let c=u.current;if(c)c.dataset.dragging="true"},S=(r)=>{let c=g.current,l=u.current;if(!c||!l)return;let f=Math.max(0,r.clientY-c.y);c.dy=f,l.style.transform=`translate3d(0, ${f}px, 0)`,l.style.setProperty("--sheet-progress",String(1-Math.min(1,f/400)))},y=(r)=>{let c=g.current,l=u.current;if(g.current=void 0,!c||!l)return;delete l.dataset.dragging;let f=c.dy/Math.max(1,r.timeStamp-c.at);if(c.dy>T||f>N){d();return}l.style.removeProperty("transform"),l.style.removeProperty("--sheet-progress")};return n("dialog",{ref:u,className:i.variant==="palette"?"sheet palette":i.size==="wide"?"sheet wide":i.size==="full"?"sheet full":"sheet","aria-label":i.title,onCancel:(r)=>{if(r.target!==r.currentTarget)return;r.preventDefault(),d()},onClick:(r)=>{if(r.target===r.currentTarget)d()},onClose:(r)=>{if(r.target!==r.currentTarget)return;if(!m.current)P()},children:[e("div",{className:"sheet-grab",onPointerDown:v,onPointerMove:S,onPointerUp:y,onPointerCancel:y,children:e("span",{className:"sheet-handle"})}),i.variant==="palette"?null:n("div",{className:"sheet-head",onPointerDown:v,onPointerMove:S,onPointerUp:y,onPointerCancel:y,children:[e("h2",{title:i.title,children:i.title}),e("button",{type:"button",className:"icon-button","aria-label":t("Close"),onClick:d,children:e(o,{name:"close"})})]}),e("div",{className:"sheet-body",children:h?i.children:null})]})}
2
- export{C};
1
+ import{E,o,a,t,e,n,s,_e}from"./chunk-index-rvatmx8s.js";var S=96,T=0.6,N=220,w=()=>typeof matchMedia==="function"&&matchMedia("(max-width: 719px)").matches;function A(i){let u=a(null),g=a(void 0),{open:h,onClose:P}=i,b=a(i.restoreFocus);b.current=i.restoreFocus;let m=a(!1),p=a(!1),M=E(()=>{let r=u.current;if(r?.open)r.close();if(b.current?.()?.focus(),m.current=!1,p.current)p.current=!1;else P()},[P]),d=E(()=>{let r=u.current;if(!r||m.current)return;if(m.current=!0,_e()){M();return}r.dataset.state="closing",r.style.removeProperty("transform"),setTimeout(M,N)},[M]);o(()=>{let r=u.current;if(!r)return;if(h&&!r.open)r.dataset.state="opening",r.showModal(),requestAnimationFrame(()=>requestAnimationFrame(()=>{r.dataset.state="open"}));if(!h&&r.open&&!m.current)p.current=!0,d()},[h,d]);let v=(r)=>{if(!w())return;if(r.target instanceof Element&&r.target.closest("button, a"))return;g.current={y:r.clientY,at:r.timeStamp,dy:0},r.currentTarget.setPointerCapture(r.pointerId);let c=u.current;if(c)c.dataset.dragging="true"},C=(r)=>{let c=g.current,l=u.current;if(!c||!l)return;let f=Math.max(0,r.clientY-c.y);c.dy=f,l.style.transform=`translate3d(0, ${f}px, 0)`,l.style.setProperty("--sheet-progress",String(1-Math.min(1,f/400)))},y=(r)=>{let c=g.current,l=u.current;if(g.current=void 0,!c||!l)return;delete l.dataset.dragging;let f=c.dy/Math.max(1,r.timeStamp-c.at);if(c.dy>S||f>T){d();return}l.style.removeProperty("transform"),l.style.removeProperty("--sheet-progress")};return n("dialog",{ref:u,className:i.variant==="palette"?"sheet palette":i.size==="wide"?"sheet wide":i.size==="full"?"sheet full":"sheet","aria-label":i.title,onCancel:(r)=>{if(r.target!==r.currentTarget)return;r.preventDefault(),d()},onClick:(r)=>{if(r.target===r.currentTarget)d()},onClose:(r)=>{if(r.target!==r.currentTarget)return;if(!m.current)P()},children:[e("div",{className:"sheet-grab",onPointerDown:v,onPointerMove:C,onPointerUp:y,onPointerCancel:y,children:e("span",{className:"sheet-handle"})}),i.variant==="palette"?null:n("div",{className:"sheet-head",onPointerDown:v,onPointerMove:C,onPointerUp:y,onPointerCancel:y,children:[e("h2",{title:i.title,children:i.title}),e("button",{type:"button",className:"icon-button","aria-label":t("Close"),onClick:d,children:e(s,{name:"close"})})]}),e("div",{className:"sheet-body",children:h?i.children:null})]})}
2
+ export{A};
@@ -0,0 +1,2 @@
1
+ import{t,Oe,aa,qi}from"./chunk-index-rvatmx8s.js";import{Ue}from"./chunk-index-maf6wr1b.js";import{Gi}from"./chunk-index-4p45h04z.js";function bi(e){let r=e.getBoundingClientRect(),o=aa();Oe({title:t("Rooms"),items:[...Gi(),{id:"new-folder",label:t("Add a folder"),icon:"plus",run:()=>Ue({kind:"new"})},{id:"arrange",label:o?t("Done"):t("Arrange"),icon:o?"check":"list",run:()=>qi(!o)}],at:{x:r.left,y:r.bottom},via:"key",source:e})}
2
+ export{bi};
@@ -1,2 +1,2 @@
1
- import{h}from"./chunk-index-s356ybxk.js";var pe={pushTest:()=>h("push/test",{method:"POST"}),pushPrefs:()=>h("push/prefs"),setPushPrefs:(e)=>h("push/prefs",{method:"PUT",body:JSON.stringify({quiet:e})}),notices:()=>h("notices"),ackNotice:(e)=>h(`notices/${encodeURIComponent(e)}/ack`,{method:"POST"}),onboarding:()=>h("onboarding"),waive:(e)=>h(`onboarding/${encodeURIComponent(e)}/waive`,{method:"POST"}),profile:()=>h("profile"),chooseSource:(e)=>h("profile/source",{method:"PUT",body:JSON.stringify({provider:e})}),links:()=>h("links"),issueLink:(e)=>h(`links/${encodeURIComponent(e)}/issue`,{method:"POST"}),confirmLink:(e,i)=>h(`links/${encodeURIComponent(e)}/confirm`,{method:"POST",body:JSON.stringify({request:i})}),cancelLink:(e)=>h(`links/${encodeURIComponent(e)}/cancel`,{method:"POST"}),unlink:(e)=>h(`links/${encodeURIComponent(e)}`,{method:"DELETE"})};
1
+ import{h}from"./chunk-index-rvatmx8s.js";var pe={pushTest:()=>h("push/test",{method:"POST"}),pushPrefs:()=>h("push/prefs"),setPushPrefs:(e)=>h("push/prefs",{method:"PUT",body:JSON.stringify({quiet:e})}),notices:()=>h("notices"),ackNotice:(e)=>h(`notices/${encodeURIComponent(e)}/ack`,{method:"POST"}),onboarding:()=>h("onboarding"),waive:(e)=>h(`onboarding/${encodeURIComponent(e)}/waive`,{method:"POST"}),profile:()=>h("profile"),chooseSource:(e)=>h("profile/source",{method:"PUT",body:JSON.stringify({provider:e})}),links:()=>h("links"),issueLink:(e)=>h(`links/${encodeURIComponent(e)}/issue`,{method:"POST"}),confirmLink:(e,i)=>h(`links/${encodeURIComponent(e)}/confirm`,{method:"POST",body:JSON.stringify({request:i})}),cancelLink:(e)=>h(`links/${encodeURIComponent(e)}/cancel`,{method:"POST"}),unlink:(e)=>h(`links/${encodeURIComponent(e)}`,{method:"DELETE"})};
2
2
  export{pe};
@@ -0,0 +1,2 @@
1
+ import{at,u}from"./chunk-index-rvatmx8s.js";import{On}from"./chunk-index-r1g24er0.js";var Yt=On,Wn=2,l="rt-table-council",i,s=!1,f=new Set;function c(){try{return globalThis.localStorage?.getItem(l)??void 0}catch{return}}function g(){if(!s)i=c(),s=!0;return i}function Kr(n){i=n,s=!0;try{globalThis.localStorage?.setItem(l,n)}catch{}for(let e of f)e()}var a=(n)=>(f.add(n),()=>f.delete(n)),xs=()=>at(a,g,()=>{return});function Mi(){return u((n)=>n.order.map((e)=>n.rooms[e]?.view).filter((e)=>e!==void 0&&e.kind==="group"),"councils")}function Ss(n,e,r){let t=(o)=>o===void 0?void 0:n.find((d)=>d.key===o||d.name===o);return t(r)??t(e)??n[0]}function ws(n){return[...n].filter((e)=>e.muted!==!0&&!e.helper).sort((e,r)=>Number(r.home)-Number(e.home)).slice(0,Yt).map((e)=>e.name)}function ks(n,e,r=Yt){if(n.includes(e))return n.filter((t)=>t!==e);return n.length>=r?[...n]:[...n,e]}function _s(n,e){return n.filter(e).slice(0,Yt)}function Ts(n,e,r){if(e!==void 0&&n.includes(e))return e;if(r!==void 0&&n.includes(r))return r;return n[0]??""}function Ps(n,e){let r=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,28)||"council";if(!e.has(r))return r;for(let t=2;;t+=1){let o=`${r}-${t}`;if(!e.has(o))return o}}
2
+ export{Yt,Wn,Kr,xs,Mi,Ss,ws,ks,_s,Ts,Ps};
@@ -0,0 +1,2 @@
1
+ import{p,t}from"./chunk-index-rvatmx8s.js";import{Eo}from"./chunk-index-tfgd7vr5.js";import{Zi,la,ca}from"./chunk-index-wqbcade7.js";function Qo(e){let n=Eo();if(!e)return n;let r=new Set([...e,...la(e)]);return Object.fromEntries(Object.entries(n).filter(([s])=>r.has(s)))}var i=()=>(p("aktwxqc9"),import("./chunk-bulk-actions-aktwxqc9.js"));function Gi(e){let n=[];if(Object.keys(Qo(e)).length>0)n.push({id:"read-all",label:t("Mark all as read"),icon:"check",run:()=>{i().then((r)=>r.markAllRead(e))}});if(Zi(e).size>0)n.push({id:"clear-finished",label:t("Clear all finished threads"),icon:"trash",tone:"danger",run:()=>{i().then((r)=>r.clearAllFinished(e))}});return n.push(...Mo(e)),n}function Mo(e){if(ca(e).size===0)return[];return[{id:"clear-helpers",label:t("Clear finished temp knights"),icon:"trash",tone:"danger",run:()=>{i().then((n)=>n.clearFinishedHelpers(e))}}]}
2
+ export{Qo,Gi,Mo};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-index-rvatmx8s.js";import{A}from"./chunk-index-0dyf2gdm.js";function H(t){return e(A,{open:t.open,title:t.title,onClose:t.onClose,...t.size&&t.size!=="default"?{size:t.size}:{},children:t.children})}
2
+ export{H};
@@ -0,0 +1,2 @@
1
+ import{o,r,l,te}from"./chunk-index-rvatmx8s.js";function ke(f,e){let{version:u}=te(),[t,a]=r({data:void 0,error:void 0,subject:e});return o(()=>{let n=!0;return f().then((d)=>{if(n)a({data:d,error:void 0,subject:e})},(d)=>{if(n)a((i)=>({data:i.subject===e?i.data:void 0,error:l(d),subject:e}))}),()=>{n=!1}},[e,u]),t.subject===e?{data:t.data,error:t.error}:{data:void 0,error:void 0}}
2
+ export{ke};
@@ -1,2 +1,2 @@
1
- import{Yo,Q,ue,St,N,V,Pt}from"./chunk-index-qk7rp7fk.js";class P{constructor(t,e,s,i,h,r,n,o,l,f=0,a){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=l,this.lookAhead=f,this.parent=a}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new P(t,[],e,s,s,0,[],0,i?new w(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n)this.score+=n;if(s==0){if(i<h.minRepeatTerm&&this.reducePos<this.pos)this.reducePos=this.pos;if(this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm)this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0);this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),l=o?this.stack[o-2]:this.p.ranges[0].from;if(i<h.minRepeatTerm&&l==this.reducePos&&this.reducePos<this.pos)this.reducePos=this.pos;let f=this.reducePos-l;if(f>=2000&&!((e=this.p.parser.nodeSet.types[i])===null||e===void 0?void 0:e.isAnonymous)){if(l==this.p.lastBigReductionStart)this.p.bigReductionCount++,this.p.lastBigReductionSize=f;else if(this.p.lastBigReductionSize<f)this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=f}let a=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-a;if(i<h.minRepeatTerm||t&131072){let u=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,u,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let u=this.stack[o-3];this.state=h.getGoto(u,i,!0)}while(this.stack.length>o)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n){while(r>0&&this.buffer[r-2]>s)if(this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4)i-=4}}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);if(!n&&(i>s||e<=r.maxNode))this.reducePos=i;if(this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode)this.buffer.push(e,s,i,4)}else if(this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode)this.buffer.push(e,s,i,4)}apply(t,e,s,i){if(t&65536)this.reduce(t);else this.shift(t,e,s,i)}useNode(t,e,s){let i=this.p.reused.length-1;if(i<0||this.p.reused[i]!=t)this.p.reused.push(t),i++;let h=this.reducePos=this.pos=s+t.length;if(this.pushState(e,s),this.buffer.push(i,s,h,-1),this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;if(e&&t.buffer[e-4]==0)e-=4;while(e>0&&t.buffer[e-2]>t.reducePos)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;while(t&&i==t.bufferBase)t=t.parent;return new P(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;if(s)this.storeNode(t,this.pos,e,4);this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new I(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)if((r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t))i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];if(!i.some((n,o)=>o&1&&n==r))i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(e.includes(i))return;return e.push(i),t.allActions(i,(r)=>{if(r&393216);else if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,l=this.stack.length-n*3;if(l>=0&&t.getGoto(this.stack[l],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2))if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-3)this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-4)this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new w(this.curContext.tracker,t);if(e.hash!=this.curContext.hash)this.emitContext();this.curContext=e}}setLookAhead(t){if(t<=this.lookAhead)return!1;return this.emitLookAhead(),this.lookAhead=t,!0}close(){if(this.curContext&&this.curContext.tracker.strict)this.emitContext();if(this.lookAhead>0)this.emitLookAhead()}}class w{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class I{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;if(s==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0),this.base+=3}else this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class S{constructor(t,e,s){if(this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0)this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new S(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;if(t!=null)this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){if(this.index-=4,this.pos-=4,this.index==0)this.maybeNext()}fork(){return new S(this.stack,this.pos,this.index)}}function x(t,e=Uint16Array){if(typeof t!="string")return t;let s=null;for(let i=0,h=0;i<t.length;){let r=0;for(;;){let n=t.charCodeAt(i++),o=!1;if(n==126){r=65535;break}if(n>=92)n--;if(n>=34)n--;let l=n-32;if(l>=46)l-=46,o=!0;if(r+=l,o)break;r*=46}if(s)s[h++]=r;else s=new e(r)}return s}class b{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}var y=new b;class D{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=y,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;while(h<s.from){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}while(e<0?h>s.to:h>=s.to){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;while(n.to<=s)n=this.ranges[++r];if(this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to)this.chunk2=this.chunk2.slice(0,n.to-s);i=this.chunk2.charCodeAt(0)}}if(s>=this.token.lookAhead)this.token.lookAhead=s+1;return i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){if(this.getChunk(),this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){this.chunkOff+=t;while(this.pos+t>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}if(this.pos+=t,this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e)this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1;else this.token=y;if(this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;while(t<this.range.from)this.range=this.ranges[--this.rangeIndex];while(t>=this.range.to)this.range=this.ranges[++this.rangeIndex];if(t>=this.chunkPos&&t<this.chunkPos+this.chunk.length)this.chunkOff=t-this.chunkPos;else this.chunk="",this.chunkOff=0;this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;if(i.to>t)s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;B(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class pt{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(B(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(!h)i++;if(r==null)break;t.reset(r,t.token)}if(i)t.reset(s,t.token),t.acceptToken(this.elseToken,i)}}pt.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class L{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function B(t,e,s,i,h,r){let n=0,o=1<<i,{dialect:l}=s.p.parser;t:for(;;){if((o&t[n])==0)break;let f=t[n+1];for(let c=n+3;c<f;c+=2)if((t[c+1]&o)>0){let g=t[c];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||G(g,e.token.value,h,r))){e.acceptToken(g);break}}let a=e.next,d=0,u=t[n+2];if(e.next<0&&u>d&&t[f+u*3-3]==65535){n=t[f+u*3-1];continue t}for(;d<u;){let c=d+u>>1,g=f+c+(c<<1),U=t[g],_=t[g+1]||65536;if(a<U)u=c;else if(a>=_)d=c+1;else{n=t[g+2],e.advance();continue t}}break}}function R(t,e,s){for(let i=e,h;(h=t[i])!=65535;i++)if(h==s)return i-e;return-1}function G(t,e,s,i){let h=R(s,i,e);return h<0||R(s,i,t)<h}var p=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),v=null;function T(t,e,s){let i=t.cursor(N.IncludeAnonymous);i.moveTo(e);for(;;)if(!(s<0?i.childBefore(e):i.childAfter(e)))for(;;){if((s<0?i.to<e:i.from>e)&&!i.type.isError)return s<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(s<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return s<0?0:t.length}}class O{constructor(t,e){this.fragments=t,this.minRepeat=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){this.safeFrom=t.openStart?T(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?T(t.tree,t.to+t.offset,-1)-t.offset:t.to;while(this.trees.length)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;while(this.fragment&&this.safeTo<=t)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof V){let n=r>this.lastRepeatPos&&h.type.id>=this.minRepeat;if(r==t||n){let o=r+h.length,l;if(r>=this.safeFrom&&o<=this.safeTo&&(!(l=h.prop(Q.lookAhead))||o+l<this.fragment.to)){if(n)this.lastRepeat=h,this.lastRepeatPos=r;if(r==t)return h}else if(r==t)return null}if(this.index[e]++,r+h.length>=Math.max(this.safeFrom,t))this.trees.push(h),this.start.push(r),this.index.push(0)}else this.index[e]++,this.nextStart=r+h.length}}}class F{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((s)=>new b)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let l=0;l<h.length;l++){if((1<<l&r)==0)continue;let f=h[l],a=this.tokens[l];if(s&&!f.fallback)continue;if(f.contextual||a.start!=t.pos||a.mask!=r||a.context!=n)this.updateCachedToken(a,f,t),a.mask=r,a.context=n;if(a.lookAhead>a.end+25)o=Math.max(a.lookAhead,o);if(a.value!=0){let d=e;if(a.extended>-1)e=this.addActions(t,a.extended,a.end,e);if(e=this.addActions(t,a.value,a.end,e),!f.extend){if(s=a,e>d)break}}}while(this.actions.length>e)this.actions.pop();if(o)t.setLookAhead(o);if(!s&&t.pos==this.stream.end)s=new b,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e);return this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new b,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){if((n&1)==0)t.value=n>>1;else t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let l=r.stateSlot(h,o?2:1);;l+=3){if(n[l]==65535)if(n[l+1]==1)l=k(n,l+2);else{if(i==0&&n[l+1]==2)i=this.putAction(k(n,l+2),e,s,i);break}if(n[l]==e)i=this.putAction(k(n,l+1),e,s,i)}return i}}class M{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new D(e,i),this.tokens=new F(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[P.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new O(s,t.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;while(r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else if(this.advanceStack(n,s,t))continue;else{if(!i)i=[],h=[];i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}break}}if(!s.length){let r=i&&H(i);if(r){if(p)console.log("Finish with "+this.stackID(r));return this.stackToTree(r)}if(this.parser.strict){if(p&&i)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw SyntaxError("No parse at "+e)}if(!this.recovering)this.recovering=5}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r){if(p)console.log("Force-finish "+this.stackID(r));return this.stackToTree(r.forceAll())}}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r){s.sort((n,o)=>o.score-n.score);while(s.length>r)s.pop()}if(s.some((n)=>n.reducePos>e))this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let l=s[o];if(n.sameState(l)||n.buffer.length>500&&l.buffer.length>500)if((n.score-l.score||n.buffer.length-l.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}if(s.length>12)s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)if(s[r].pos<this.minStackPos)this.minStackPos=s[r].pos;return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=t}tryReuse(t,e,s,i){if(!s)return null;let h=t.curContext&&t.curContext.tracker.strict,r=h?t.curContext.hash:0;for(;s;){let n=this.parser.nodeSet.types[s.type.id]!=s.type?-1:this.parser.getGoto(t.state,s.type.id);if(n>-1&&s.length&&(!h||(s.prop(Q.contextHash)||0)==r))return t.useNode(s,n,e),s;if(s.children.length==0||s.positions[0]>0)break;let o=s.children[0];if(o instanceof V&&(!i||o.type.id>=this.parser.minRepeatTerm))s=o;else break}return null}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=p?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.reducePos<i&&t.buffer.length&&t.buffer[t.buffer.length-2]<=t.reducePos&&this.fragments.lastRepeatPos==t.reducePos&&this.tryReuse(t,t.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(t,i,this.fragments.nodeAt(i),!1);if(l){if(p)console.log(r+this.stackID(t)+` (via reuse of ${h.getName(l.type.id)})`);return!0}}let n=h.stateSlot(t.state,4);if(n>0){if(t.reduce(n),p)console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`);return!0}if(t.stack.length>=8400)while(t.stack.length>6000&&t.forceReduce());let o=this.tokens.getActions(t);for(let l=0;l<o.length;){let f=o[l++],a=o[l++],d=o[l++],u=l==o.length||!s,c=u?t:t.split(),g=this.tokens.mainToken;if(c.apply(f,a,g?g.start:c.pos,d),p)console.log(r+this.stackID(c)+` (via ${(f&65536)==0?"shift":`reduce of ${h.getName(f&65535)}`} for ${h.getName(a)} @ ${i}${c==t?"":", split"})`);if(u)return!0;else if(c.pos>i)e.push(c);else s.push(c)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return C(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],l=e[(r<<1)+1],f=p?this.stackID(n)+" -> ":"";if(n.deadEnd){if(h)continue;if(h=!0,n.restart(),p)console.log(f+this.stackID(n)+" (restarted)");if(this.advanceFully(n,s))continue}let a=n.split(),d=f;for(let u=0;u<10&&a.forceReduce();u++){if(p)console.log(d+this.stackID(a)+" (via force-reduce)");if(this.advanceFully(a,s))break;if(p)d=this.stackID(a)+" -> "}for(let u of n.recoverByInsert(o)){if(p)console.log(f+this.stackID(u)+" (via recover-insert)");this.advanceFully(u,s)}if(this.stream.end>n.pos){if(l==n.pos)l++,o=0;if(n.recoverByDelete(o,l),p)console.log(f+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`);C(n,s)}else if(!i||i.score<a.score)i=a}return i}stackToTree(t){return t.close(),V.build({buffer:S.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(v||(v=new WeakMap)).get(t);if(!e)v.set(t,e=String.fromCodePoint(this.nextStackID++));return e+t}}function C(t,e){for(let s=0;s<e.length;s++){let i=e[s];if(i.pos==t.pos&&i.sameState(t)){if(e[s].score<t.score)e[s]=t;return}}e.push(t)}class E{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}var A=(t)=>t;class Ce{constructor(t){this.start=t.start,this.shift=t.shift||A,this.reduce=t.reduce||A,this.reuse=t.reuse||A,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class j extends Pt{constructor(t){super();if(this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map((n)=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,l){i[n].push([o,o.deserialize(String(l))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];if(typeof o=="string")o=Q[o];for(let l=1;l<n.length;){let f=n[l++];if(f>=0)h(f,o,n[l++]);else{let a=n[l+-f];for(let d=-f;d>0;d--)h(n[l++],o,a);l++}}}if(this.nodeSet=new St(e.map((n,o)=>ue.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources)this.nodeSet=this.nodeSet.extend(...t.propSources);this.strict=!1,this.bufferLength=Yo;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(z),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map((n)=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new M(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let l=h+(r>>1);h<l;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else if(s[h+1]==2)return k(s,h+2);else break;if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,(s)=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];if(!e.some((h,r)=>r&1&&h==i))e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(j.prototype),this);if(t.props)e.nodeSet=this.nodeSet.extend(...t.props);if(t.top){let s=this.topRules[t.top];if(!s)throw RangeError(`Invalid top rule name ${t.top}`);e.top=s}if(t.tokenizers)e.tokenizers=this.tokenizers.map((s)=>{let i=t.tokenizers.find((h)=>h.from==s);return i?i.to:s});if(t.specializers)e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find((n)=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=z(r),r});if(t.contextTracker)e.context=t.contextTracker;if(t.dialect)e.dialect=this.parseDialect(t.dialect);if(t.strict!=null)e.strict=t.strict;if(t.wrap)e.wrappers=e.wrappers.concat(t.wrap);if(t.bufferLength!=null)e.bufferLength=t.bufferLength;return e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);if(r>=0)s[r]=!0}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new E(t,s,i)}static deserialize(t){return new j(t)}}function k(t,e){return t[e]|t[e+1]<<16}function H(t){let e=null;for(let s of t){let i=s.p.stoppedAt;if((s.pos==s.p.stream.end||i!=null&&s.pos>i)&&s.p.parser.stateFlag(s.state,2)&&(!e||e.score<s.score))e=s}return e}function z(t){if(t.external){let e=t.extend?1:0;return(s,i)=>t.external(s,i)<<1|e}return t.get}
1
+ import{Ko,M,ue,wt,N,V,Pt}from"./chunk-index-ne8v2rxx.js";class P{constructor(t,e,s,i,h,r,n,o,l,f=0,a){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=l,this.lookAhead=f,this.parent=a}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new P(t,[],e,s,s,0,[],0,i?new w(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n)this.score+=n;if(s==0){if(i<h.minRepeatTerm&&this.reducePos<this.pos)this.reducePos=this.pos;if(this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm)this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0);this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),l=o?this.stack[o-2]:this.p.ranges[0].from;if(i<h.minRepeatTerm&&l==this.reducePos&&this.reducePos<this.pos)this.reducePos=this.pos;let f=this.reducePos-l;if(f>=2000&&!((e=this.p.parser.nodeSet.types[i])===null||e===void 0?void 0:e.isAnonymous)){if(l==this.p.lastBigReductionStart)this.p.bigReductionCount++,this.p.lastBigReductionSize=f;else if(this.p.lastBigReductionSize<f)this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=f}let a=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-a;if(i<h.minRepeatTerm||t&131072){let u=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,u,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let u=this.stack[o-3];this.state=h.getGoto(u,i,!0)}while(this.stack.length>o)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n){while(r>0&&this.buffer[r-2]>s)if(this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4)i-=4}}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);if(!n&&(i>s||e<=r.maxNode))this.reducePos=i;if(this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode)this.buffer.push(e,s,i,4)}else if(this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode)this.buffer.push(e,s,i,4)}apply(t,e,s,i){if(t&65536)this.reduce(t);else this.shift(t,e,s,i)}useNode(t,e,s){let i=this.p.reused.length-1;if(i<0||this.p.reused[i]!=t)this.p.reused.push(t),i++;let h=this.reducePos=this.pos=s+t.length;if(this.pushState(e,s),this.buffer.push(i,s,h,-1),this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;if(e&&t.buffer[e-4]==0)e-=4;while(e>0&&t.buffer[e-2]>t.reducePos)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;while(t&&i==t.bufferBase)t=t.parent;return new P(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;if(s)this.storeNode(t,this.pos,e,4);this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new I(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)if((r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t))i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];if(!i.some((n,o)=>o&1&&n==r))i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(e.includes(i))return;return e.push(i),t.allActions(i,(r)=>{if(r&393216);else if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,l=this.stack.length-n*3;if(l>=0&&t.getGoto(this.stack[l],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2))if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){if(this.curContext)this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-3)this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let t=this.buffer.length-1;if(t<0||this.buffer[t]!=-4)this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new w(this.curContext.tracker,t);if(e.hash!=this.curContext.hash)this.emitContext();this.curContext=e}}setLookAhead(t){if(t<=this.lookAhead)return!1;return this.emitLookAhead(),this.lookAhead=t,!0}close(){if(this.curContext&&this.curContext.tracker.strict)this.emitContext();if(this.lookAhead>0)this.emitLookAhead()}}class w{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class I{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;if(s==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0),this.base+=3}else this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class S{constructor(t,e,s){if(this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0)this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new S(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;if(t!=null)this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){if(this.index-=4,this.pos-=4,this.index==0)this.maybeNext()}fork(){return new S(this.stack,this.pos,this.index)}}function x(t,e=Uint16Array){if(typeof t!="string")return t;let s=null;for(let i=0,h=0;i<t.length;){let r=0;for(;;){let n=t.charCodeAt(i++),o=!1;if(n==126){r=65535;break}if(n>=92)n--;if(n>=34)n--;let l=n-32;if(l>=46)l-=46,o=!0;if(r+=l,o)break;r*=46}if(s)s[h++]=r;else s=new e(r)}return s}class b{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}var y=new b;class D{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=y,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;while(h<s.from){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}while(e<0?h>s.to:h>=s.to){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;while(n.to<=s)n=this.ranges[++r];if(this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to)this.chunk2=this.chunk2.slice(0,n.to-s);i=this.chunk2.charCodeAt(0)}}if(s>=this.token.lookAhead)this.token.lookAhead=s+1;return i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){if(this.getChunk(),this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){this.chunkOff+=t;while(this.pos+t>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}if(this.pos+=t,this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e)this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1;else this.token=y;if(this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;while(t<this.range.from)this.range=this.ranges[--this.rangeIndex];while(t>=this.range.to)this.range=this.ranges[++this.rangeIndex];if(t>=this.chunkPos&&t<this.chunkPos+this.chunk.length)this.chunkOff=t-this.chunkPos;else this.chunk="",this.chunkOff=0;this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;if(i.to>t)s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;B(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class pt{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(B(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(!h)i++;if(r==null)break;t.reset(r,t.token)}if(i)t.reset(s,t.token),t.acceptToken(this.elseToken,i)}}pt.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class L{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function B(t,e,s,i,h,r){let n=0,o=1<<i,{dialect:l}=s.p.parser;t:for(;;){if((o&t[n])==0)break;let f=t[n+1];for(let c=n+3;c<f;c+=2)if((t[c+1]&o)>0){let g=t[c];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||H(g,e.token.value,h,r))){e.acceptToken(g);break}}let a=e.next,d=0,u=t[n+2];if(e.next<0&&u>d&&t[f+u*3-3]==65535){n=t[f+u*3-1];continue t}for(;d<u;){let c=d+u>>1,g=f+c+(c<<1),_=t[g],G=t[g+1]||65536;if(a<_)u=c;else if(a>=G)d=c+1;else{n=t[g+2],e.advance();continue t}}break}}function R(t,e,s){for(let i=e,h;(h=t[i])!=65535;i++)if(h==s)return i-e;return-1}function H(t,e,s,i){let h=R(s,i,e);return h<0||R(s,i,t)<h}var p=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),v=null;function T(t,e,s){let i=t.cursor(N.IncludeAnonymous);i.moveTo(e);for(;;)if(!(s<0?i.childBefore(e):i.childAfter(e)))for(;;){if((s<0?i.to<e:i.from>e)&&!i.type.isError)return s<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(s<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return s<0?0:t.length}}class O{constructor(t,e){this.fragments=t,this.minRepeat=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){this.safeFrom=t.openStart?T(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?T(t.tree,t.to+t.offset,-1)-t.offset:t.to;while(this.trees.length)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;while(this.fragment&&this.safeTo<=t)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof V){let n=r>this.lastRepeatPos&&h.type.id>=this.minRepeat;if(r==t||n){let o=r+h.length,l;if(r>=this.safeFrom&&o<=this.safeTo&&(!(l=h.prop(M.lookAhead))||o+l<this.fragment.to)){if(n)this.lastRepeat=h,this.lastRepeatPos=r;if(r==t)return h}else if(r==t)return null}if(this.index[e]++,r+h.length>=Math.max(this.safeFrom,t))this.trees.push(h),this.start.push(r),this.index.push(0)}else this.index[e]++,this.nextStart=r+h.length}}}class F{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((s)=>new b)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let l=0;l<h.length;l++){if((1<<l&r)==0)continue;let f=h[l],a=this.tokens[l];if(s&&!f.fallback)continue;if(f.contextual||a.start!=t.pos||a.mask!=r||a.context!=n)this.updateCachedToken(a,f,t),a.mask=r,a.context=n;if(a.lookAhead>a.end+25)o=Math.max(a.lookAhead,o);if(a.value!=0){let d=e;if(a.extended>-1)e=this.addActions(t,a.extended,a.end,e);if(e=this.addActions(t,a.value,a.end,e),!f.extend){if(s=a,e>d)break}}}while(this.actions.length>e)this.actions.pop();if(o)t.setLookAhead(o);if(!s&&t.pos==this.stream.end)s=new b,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e);return this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new b,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){if((n&1)==0)t.value=n>>1;else t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let l=r.stateSlot(h,o?2:1);;l+=3){if(n[l]==65535)if(n[l+1]==1)l=k(n,l+2);else{if(i==0&&n[l+1]==2)i=this.putAction(k(n,l+2),e,s,i);break}if(n[l]==e)i=this.putAction(k(n,l+1),e,s,i)}return i}}class E{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new D(e,i),this.tokens=new F(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[P.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new O(s,t.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;while(r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else if(this.advanceStack(n,s,t))continue;else{if(!i)i=[],h=[];i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}break}}if(!s.length){let r=i&&W(i);if(r){if(p)console.log("Finish with "+this.stackID(r));return this.stackToTree(r)}if(this.parser.strict){if(p&&i)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw SyntaxError("No parse at "+e)}if(!this.recovering)this.recovering=5}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r){if(p)console.log("Force-finish "+this.stackID(r));return this.stackToTree(r.forceAll())}}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r){s.sort((n,o)=>o.score-n.score);while(s.length>r)s.pop()}if(s.some((n)=>n.reducePos>e))this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let l=s[o];if(n.sameState(l)||n.buffer.length>500&&l.buffer.length>500)if((n.score-l.score||n.buffer.length-l.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}if(s.length>12)s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)if(s[r].pos<this.minStackPos)this.minStackPos=s[r].pos;return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=t}tryReuse(t,e,s,i){if(!s)return null;let h=t.curContext&&t.curContext.tracker.strict,r=h?t.curContext.hash:0;for(;s;){let n=this.parser.nodeSet.types[s.type.id]!=s.type?-1:this.parser.getGoto(t.state,s.type.id);if(n>-1&&s.length&&(!h||(s.prop(M.contextHash)||0)==r))return t.useNode(s,n,e),s;if(s.children.length==0||s.positions[0]>0)break;let o=s.children[0];if(o instanceof V&&(!i||o.type.id>=this.parser.minRepeatTerm))s=o;else break}return null}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=p?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let l=t.reducePos<i&&t.buffer.length&&t.buffer[t.buffer.length-2]<=t.reducePos&&this.fragments.lastRepeatPos==t.reducePos&&this.tryReuse(t,t.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(t,i,this.fragments.nodeAt(i),!1);if(l){if(p)console.log(r+this.stackID(t)+` (via reuse of ${h.getName(l.type.id)})`);return!0}}let n=h.stateSlot(t.state,4);if(n>0){if(t.reduce(n),p)console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`);return!0}if(t.stack.length>=8400)while(t.stack.length>6000&&t.forceReduce());let o=this.tokens.getActions(t);for(let l=0;l<o.length;){let f=o[l++],a=o[l++],d=o[l++],u=l==o.length||!s,c=u?t:t.split(),g=this.tokens.mainToken;if(c.apply(f,a,g?g.start:c.pos,d),p)console.log(r+this.stackID(c)+` (via ${(f&65536)==0?"shift":`reduce of ${h.getName(f&65535)}`} for ${h.getName(a)} @ ${i}${c==t?"":", split"})`);if(u)return!0;else if(c.pos>i)e.push(c);else s.push(c)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return C(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],l=e[(r<<1)+1],f=p?this.stackID(n)+" -> ":"";if(n.deadEnd){if(h)continue;if(h=!0,n.restart(),p)console.log(f+this.stackID(n)+" (restarted)");if(this.advanceFully(n,s))continue}let a=n.split(),d=f;for(let u=0;u<10&&a.forceReduce();u++){if(p)console.log(d+this.stackID(a)+" (via force-reduce)");if(this.advanceFully(a,s))break;if(p)d=this.stackID(a)+" -> "}for(let u of n.recoverByInsert(o)){if(p)console.log(f+this.stackID(u)+" (via recover-insert)");this.advanceFully(u,s)}if(this.stream.end>n.pos){if(l==n.pos)l++,o=0;if(n.recoverByDelete(o,l),p)console.log(f+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`);C(n,s)}else if(!i||i.score<a.score)i=a}return i}stackToTree(t){return t.close(),V.build({buffer:S.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(v||(v=new WeakMap)).get(t);if(!e)v.set(t,e=String.fromCodePoint(this.nextStackID++));return e+t}}function C(t,e){for(let s=0;s<e.length;s++){let i=e[s];if(i.pos==t.pos&&i.sameState(t)){if(e[s].score<t.score)e[s]=t;return}}e.push(t)}class U{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}var A=(t)=>t;class Ce{constructor(t){this.start=t.start,this.shift=t.shift||A,this.reduce=t.reduce||A,this.reuse=t.reuse||A,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class j extends Pt{constructor(t){super();if(this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map((n)=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,l){i[n].push([o,o.deserialize(String(l))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];if(typeof o=="string")o=M[o];for(let l=1;l<n.length;){let f=n[l++];if(f>=0)h(f,o,n[l++]);else{let a=n[l+-f];for(let d=-f;d>0;d--)h(n[l++],o,a);l++}}}if(this.nodeSet=new wt(e.map((n,o)=>ue.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources)this.nodeSet=this.nodeSet.extend(...t.propSources);this.strict=!1,this.bufferLength=Ko;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(z),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map((n)=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new E(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let l=h+(r>>1);h<l;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else if(s[h+1]==2)return k(s,h+2);else break;if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,(s)=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];if(!e.some((h,r)=>r&1&&h==i))e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(j.prototype),this);if(t.props)e.nodeSet=this.nodeSet.extend(...t.props);if(t.top){let s=this.topRules[t.top];if(!s)throw RangeError(`Invalid top rule name ${t.top}`);e.top=s}if(t.tokenizers)e.tokenizers=this.tokenizers.map((s)=>{let i=t.tokenizers.find((h)=>h.from==s);return i?i.to:s});if(t.specializers)e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find((n)=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=z(r),r});if(t.contextTracker)e.context=t.contextTracker;if(t.dialect)e.dialect=this.parseDialect(t.dialect);if(t.strict!=null)e.strict=t.strict;if(t.wrap)e.wrappers=e.wrappers.concat(t.wrap);if(t.bufferLength!=null)e.bufferLength=t.bufferLength;return e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);if(r>=0)s[r]=!0}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new U(t,s,i)}static deserialize(t){return new j(t)}}function k(t,e){return t[e]|t[e+1]<<16}function W(t){let e=null;for(let s of t){let i=s.p.stoppedAt;if((s.pos==s.p.stream.end||i!=null&&s.pos>i)&&s.p.parser.stateFlag(s.state,2)&&(!e||e.score<s.score))e=s}return e}function z(t){if(t.external){let e=t.extend?1:0;return(s,i)=>t.external(s,i)<<1|e}return t.get}
2
2
  export{pt,L,Ce,j};
@@ -0,0 +1,2 @@
1
+ import{P,h}from"./chunk-index-rvatmx8s.js";var no={page:(e,t,o,c=50)=>h(`rooms/${encodeURIComponent(e)}/messages?archive=${t}&limit=${c}${o===void 0?"":`&before=${o}`}`)},n,{emit:r,use:s}=P();function Us(e,t){n={room:e,until:t},r()}function Vs(){if(!n)return;n=void 0,r()}var qs=()=>s(()=>n),i;function Bs(e,t){i={author:e,text:t},r()}function io(){if(!i)return;i=void 0,r()}var Fs=()=>s(()=>i);
2
+ export{no,Us,Vs,qs,Bs,io,Fs};
@@ -1 +1 @@
1
- import{Pi}from"./chunk-index-s356ybxk.js";var M={chat:"M21 12a8 8 0 0 1-11.6 7.1L4 20.5l1.4-4.7A8 8 0 1 1 21 12Z",link:"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3A4 4 0 0 0 11 18.7l1-1",activity:"M3 12h4l3-8 4 16 3-8h4",users:"M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14a6.5 6.5 0 0 1 3.5 6",megaphone:"M4 10v4h3l8 4V6L7 10H4ZM18 9a4 4 0 0 1 0 6M7 14l1 6h3l-1-5",qr:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h2v2h-2zM18 14h2v2M14 18h2M18 18h2v2h-2z"};Pi(M);
1
+ import{Li}from"./chunk-index-rvatmx8s.js";var M={chat:"M21 12a8 8 0 0 1-11.6 7.1L4 20.5l1.4-4.7A8 8 0 1 1 21 12Z",link:"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3A4 4 0 0 0 11 18.7l1-1",activity:"M3 12h4l3-8 4 16 3-8h4",users:"M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14a6.5 6.5 0 0 1 3.5 6",megaphone:"M4 10v4h3l8 4V6L7 10H4ZM18 9a4 4 0 0 1 0 6M7 14l1 6h3l-1-5",qr:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h2v2h-2zM18 14h2v2M14 18h2M18 18h2v2h-2z"};Li(M);
@@ -1,2 +1,2 @@
1
- function ki(c,a){let o=c.toLowerCase().replace(/\s+/g,"");if(o==="")return 0;let n=a.toLowerCase(),s=0,t=0,r=0;for(let f of o){let e=n.indexOf(f,t);if(e<0)return;let i=e===0||/[\s\-_./:]/.test(n[e-1]??"");r=e===t?r+1:0,s+=1+(i?4:0)+r*2-Math.min(e-t,6)*0.2,t=e+1}return s-n.length*0.02}
2
- export{ki};
1
+ function Ai(c,a){let o=c.toLowerCase().replace(/\s+/g,"");if(o==="")return 0;let n=a.toLowerCase(),s=0,t=0,r=0;for(let f of o){let e=n.indexOf(f,t);if(e<0)return;let i=e===0||/[\s\-_./:]/.test(n[e-1]??"");r=e===t?r+1:0,s+=1+(i?4:0)+r*2-Math.min(e-t,6)*0.2,t=e+1}return s-n.length*0.02}
2
+ export{Ai};
@@ -1,2 +1,2 @@
1
- import{t}from"./chunk-index-s356ybxk.js";function Un(e){if(e.builtin==="link")return t("Link your {name} account",{name:e.label});if(e.builtin==="push")return t("Turn on notifications");return e.label}function dn(e){if(e.help)return e.help;if(e.builtin==="link")return t("Prove which account is yours, so the app knows who you are there.");if(e.builtin==="push")return t("So that you hear when something needs you, even when the app is closed.");return""}
2
- export{Un,dn};
1
+ import{t}from"./chunk-index-rvatmx8s.js";function Bn(e){if(e.builtin==="link")return t("Link your {name} account",{name:e.label});if(e.builtin==="push")return t("Turn on notifications");return e.label}function fn(e){if(e.help)return e.help;if(e.builtin==="link")return t("Prove which account is yours, so the app knows who you are there.");if(e.builtin==="push")return t("So that you hear when something needs you, even when the app is closed.");return""}
2
+ export{Bn,fn};
@@ -1,4 +1,4 @@
1
- import{e,n}from"./chunk-index-s356ybxk.js";var r=!1;function a(){if(r||typeof document>"u")return;if(r=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let o=new CSSStyleSheet;o.replaceSync(`
1
+ import{e,n}from"./chunk-index-rvatmx8s.js";var r=!1;function a(){if(r||typeof document>"u")return;if(r=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let o=new CSSStyleSheet;o.replaceSync(`
2
2
  /* One choice of how to write, in the composer's column over the bar, wherever the pane is wide. */
3
3
  .mode-toggle {
4
4
  display: inline-flex;
@@ -134,5 +134,5 @@ import{e,n}from"./chunk-index-s356ybxk.js";var r=!1;function a(){if(r||typeof do
134
134
  background: var(--bg);
135
135
  transform: translateX(0.9rem);
136
136
  }
137
- `,document.head.append(t)}a();function Br(t){return n("button",{type:"button",role:"switch","aria-checked":t.on,className:"mode-toggle",disabled:t.locked!==void 0,title:t.locked,onClick:()=>t.onChange(!t.on),children:[e("span",{className:"mode-toggle-track","aria-hidden":"true"}),t.label]})}
138
- export{Br};
137
+ `,document.head.append(t)}a();function Vr(t){return n("button",{type:"button",role:"switch","aria-checked":t.on,className:"mode-toggle",disabled:t.locked!==void 0,title:t.locked,onClick:()=>t.onChange(!t.on),children:[e("span",{className:"mode-toggle-track","aria-hidden":"true"}),t.label]})}
138
+ export{Vr};
@@ -0,0 +1,3 @@
1
+ import{p,t,X,en,O,l,f,Ws,Oe,Ke,Xt,ye}from"./chunk-index-rvatmx8s.js";import{Bs}from"./chunk-index-6f4qvp5p.js";import{jr}from"./chunk-index-vaxytvde.js";import{Pi,ys,Qi}from"./chunk-index-k3hj2310.js";import{bt}from"./chunk-index-qwztcbjz.js";import{Wn}from"./chunk-index-39gw0qhr.js";import{Ht}from"./chunk-index-mhb8mpg3.js";import{Mo}from"./chunk-index-4p45h04z.js";import{re,Ie}from"./chunk-index-xkb336kq.js";var m=(e)=>e();async function Zn(e){try{await navigator.clipboard.writeText(e),f(t("Copied"))}catch{f(t("Could not copy."),"danger")}}async function s(e){try{await navigator.share(e)}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;f(t("Could not share."),"danger")}}var v=()=>(p("aktwxqc9"),import("./chunk-bulk-actions-aktwxqc9.js")),h=()=>typeof navigator.share==="function";function Ea(e,o=m){let i=O.getState().rooms[e],n=i?.view;if(!n||n.kind==="thread")return;let c=i.mode,a=n.home||n.helper?[]:jr(e,o);if(n.kind==="agent"){let r=n.name;a.push({id:"edit",label:t("Edit knight"),icon:"profile",run:()=>o(()=>Ke(r))},{id:"look",label:t("Change look"),icon:"sparkle",run:()=>o(()=>Ke(r,{look:!0}))},{id:"skills",label:t("Skills"),icon:"skills",run:()=>o(()=>Ke(r,{skills:!0}))})}if(n.kind==="group"){let r=n.name;a.push({id:"edit-group",label:t("Edit group"),icon:"profile",run:()=>o(()=>bt({kind:"group",name:r}))})}if(n.kind==="agent")a.push(...Mo([e]));if(!n.helper)a.push({id:"notifications",label:t("Notifications"),icon:n.muted?"bell-off":"bell",checked:!n.muted,run:async()=>{let r=n.muted!==!0;if(!await Ht(e,r))return;f(r?t("Notifications are off for {name}",{name:n.displayName}):t("Notifications are on for {name}",{name:n.displayName}))}});if(!n.readOnly)a.push({id:"yolo",label:t("Yolo mode"),icon:"bolt",tone:"yolo",checked:c.yolo,run:()=>{if(c.yolo)return Xt(e,{yolo:!1});ye({kind:"yolo",room:e,name:n.displayName})}},{id:"long",label:t("Long-running mode"),icon:"timer",tone:"long",checked:c.longRunning,run:()=>Xt(e,{longRunning:!c.longRunning})},{id:"start-over",label:t("Start over"),icon:"reset",tone:"danger",run:()=>ye({kind:"start-over",room:e,name:n.displayName})});if(n.helper){let{name:r,displayName:g}=n;a.push({id:"archive-helper",label:t("Archive this temp knight"),icon:"archive",tone:"danger",run:()=>v().then((b)=>b.archiveHelper(r,g))})}else if(!n.readOnly&&!n.coordinator)a.push({id:"archive",label:n.kind==="group"?t("Archive group"):t("Archive knight"),icon:"archive",tone:"danger",run:()=>ye({kind:"archive",room:e,name:n.displayName})});return{title:n.displayName,items:a}}function wa(e=m){return{title:t("Add"),items:[{id:"new-agent",label:t("New knight"),icon:"profile",run:()=>e(()=>bt({kind:"new-agent"}))},{id:"new-group",label:t("New group"),icon:"rooms",run:()=>e(()=>bt({kind:"group"}))},{id:"archive-list",label:t("Archived"),icon:"archive",run:()=>e(()=>bt({kind:"archive"}))}]}}function Aa(e,o){let i=e.getBoundingClientRect();Oe({...wa(o),at:{x:i.left,y:i.bottom},via:"key",source:e})}function $a(e,o){let{rooms:i}=O.getState(),n=i[e]?.view,c=i[o]?.view;if(n?.kind!=="agent"||c?.kind!=="group")return;return{title:n.displayName,items:[{id:"chat",label:t("Private chat"),icon:"conversations",run:()=>X("room",e)},{id:"leave",label:t("Remove from the council"),icon:"close",run:()=>y(c,n)}]}}async function y(e,o){let i=(e.members??[]).filter((n)=>n!==o.name);if(i.length<Wn){ye({kind:"archive",room:e.key,name:e.displayName});return}try{let n=await re.group(e.name);await re.updateGroup(e.name,{members:i,...n.host===o.name?{host:i[0]??""}:{}}),await Ie(),f(t("{name} left the council",{name:o.displayName}))}catch(n){f(l(n),"danger")}}function u(e,o){let i=e.querySelector(".bubble > .prose");if(!i)return o;return(i.innerText||i.textContent||o).trim()}function w(e){let o=window.getSelection();if(!o||o.isCollapsed)return"";return(o.anchorNode&&e.contains(o.anchorNode)?o.toString():"").trim()}function Na(e,o,i){let n=Pi(e)?[{id:"edit-queued",label:t("Edit"),icon:"notes",run:()=>Qi(e)},{id:"cancel-queued",label:t("Cancel"),icon:"close",tone:"danger",run:()=>ys(e)}]:[];if(n.push({id:"copy",label:t("Copy"),icon:"copy",run:()=>Zn(w(o)||u(o,e.text))},{id:"copy-markdown",label:t("Copy as Markdown"),icon:"notes",run:()=>Zn(e.text)}),i)n.push({id:"quote",label:t("Quote reply"),icon:"conversations",run:()=>Ws(e.room,e.text)});if(n.push({id:"select",label:t("Select text"),icon:"list",run:()=>Bs(e.author,e.text)}),h())n.push({id:"share",label:t("Share"),icon:"send",run:()=>s({text:u(o,e.text)})});return{title:e.author,items:n}}function La(e,o){return{title:o,items:[{id:"profile",label:t("Knight profile"),icon:"profile",run:()=>Ke(e)}]}}var d=(e)=>[e.header?`${e.header}: ${e.question}`:e.question,...e.options.map((o)=>o.description?`- ${o.label}: ${o.description}`:`- ${o.label}`)];function ka(e){let o=[e.title];switch(e.kind){case"approval":{o.push("",e.message);let{approval:i}=e;if(i){if(o.push("",`${t("Tool")}: ${i.tool}`,`${t("Action")}: ${i.action}`),Object.keys(i.input).length)o.push(JSON.stringify(i.input,null,2));for(let n of i.files??[])o.push(n.path)}break}case"ask":o.push("",...d({question:e.question,options:e.options,multi:e.multi,allowOther:e.allowOther}));break;case"questionnaire":for(let i of e.questions)o.push("",...d(i));break}return o.join(`
2
+ `)}function Xa(e){return{title:e.title,items:[{id:"copy-details",label:t("Copy details"),icon:"copy",run:()=>Zn(ka(e))}]}}function k(e){let o=document.createElement("a");o.href=en(e),o.download=e.name,o.hidden=!0,document.body.append(o),o.click(),o.remove()}async function M(e){let o=new URL(en(e),window.location.href).href;if(typeof navigator.canShare==="function")try{let i=await fetch(o);if(i.ok){let n=new File([await i.blob()],e.name,{type:e.type});if(navigator.canShare({files:[n]})){await s({files:[n],title:e.name});return}}}catch{}await s({title:e.name,url:o})}function za(e){let o=[{id:"download",label:t("Download"),icon:"download",run:()=>k(e)}];if(h())o.push({id:"share",label:t("Share"),icon:"send",run:()=>M(e)});return{title:e.name,items:o}}
3
+ export{Zn,Ea,wa,Aa,$a,Na,La,ka,Xa,za};
@@ -0,0 +1,2 @@
1
+ import{_e,X,O,P}from"./chunk-index-rvatmx8s.js";var{emit:i,use:s}=P(),o=!1,n;function pn(t){return t.cardOrder.flatMap((e)=>{let r=t.cards[e];return r&&!r.outcome?[{id:e,card:r}]:[]})}function Ca(){let t=pn(O.getState()),[e]=t;if(t.length===1&&e)or(e.id);else if(t.length>1)o=!0,i()}function rr(){if(!o)return;o=!1,i()}var Br=()=>s(()=>o);function or(t){let e=O.getState().cards[t];if(!e)return;o=!1,n=t,i(),X("room",e.room)}var Fr=()=>s(()=>n);function Gr(t){if(n!==t)return;n=void 0,i()}var _i=(t,e)=>[...t?.querySelectorAll("[data-card]")??[]].find((r)=>r.dataset.card===e),c=1600;function sr(t,e){let r=_i(t,e);if(!r)return!1;r.scrollIntoView?.({block:"center",behavior:_e()?"auto":"smooth"});let a=r.querySelector(".prompt")??r;return a.tabIndex=-1,a.focus({preventScroll:!0}),r.dataset.lit="",setTimeout(()=>delete r.dataset.lit,c),!0}
2
+ export{pn,Ca,rr,Br,or,Fr,Gr,_i,sr};
@@ -1,2 +1,2 @@
1
- import{h}from"./chunk-index-s356ybxk.js";var t=(i,l,o)=>h(i,{method:l,...o===void 0?{}:{body:JSON.stringify(o)}}),r=(i)=>encodeURIComponent(i),de={agentPromptHistory:(i)=>h(`agents/${r(i)}/prompt-history`),prompts:()=>h("prompts"),prompt:(i)=>h(`prompts/${r(i)}`),savePrompt:(i,l)=>t(`prompts/${r(i)}`,"PUT",l),revertPrompt:(i,l)=>t(`prompts/${r(i)}/revert`,"POST",l),promptHistory:(i)=>h(`prompts/${r(i)}/history`),skillDocument:(i)=>h(`skill-docs/${r(i)}`),saveSkillDocument:(i,l)=>t(`skill-docs/${r(i)}`,"PUT",l),createSkillDocument:(i)=>t("skill-docs","POST",i),deleteSkillDocument:(i)=>t(`skill-docs/${r(i)}`,"DELETE"),skillHistory:(i)=>h(`skill-docs/${r(i)}/history`),skillGroups:()=>h("skill-groups"),saveSkillGroup:(i,l)=>t(`skill-groups/${r(i)}`,"PUT",l),deleteSkillGroup:(i)=>t(`skill-groups/${r(i)}`,"DELETE"),applySkillGroup:(i,l,o=!0)=>t(`skill-groups/${r(i)}/apply`,"POST",{agent:l,on:o})};
1
+ import{h}from"./chunk-index-rvatmx8s.js";var t=(i,l,o)=>h(i,{method:l,...o===void 0?{}:{body:JSON.stringify(o)}}),r=(i)=>encodeURIComponent(i),de={agentPromptHistory:(i)=>h(`agents/${r(i)}/prompt-history`),prompts:()=>h("prompts"),prompt:(i)=>h(`prompts/${r(i)}`),savePrompt:(i,l)=>t(`prompts/${r(i)}`,"PUT",l),revertPrompt:(i,l)=>t(`prompts/${r(i)}/revert`,"POST",l),promptHistory:(i)=>h(`prompts/${r(i)}/history`),skillDocument:(i)=>h(`skill-docs/${r(i)}`),saveSkillDocument:(i,l)=>t(`skill-docs/${r(i)}`,"PUT",l),createSkillDocument:(i)=>t("skill-docs","POST",i),deleteSkillDocument:(i)=>t(`skill-docs/${r(i)}`,"DELETE"),skillHistory:(i)=>h(`skill-docs/${r(i)}/history`),skillGroups:()=>h("skill-groups"),saveSkillGroup:(i,l)=>t(`skill-groups/${r(i)}`,"PUT",l),deleteSkillGroup:(i)=>t(`skill-groups/${r(i)}`,"DELETE"),applySkillGroup:(i,l,o=!0)=>t(`skill-groups/${r(i)}/apply`,"POST",{agent:l,on:o})};
2
2
  export{de};
@@ -0,0 +1,2 @@
1
+ import{P}from"./chunk-index-rvatmx8s.js";var o=!1,{emit:e,use:t}=P();function ns(){if(o)return;o=!0,e()}function yi(){if(!o)return;o=!1,e()}var is=()=>t(()=>o),rs=()=>o,os=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);
2
+ export{ns,yi,is,rs,os};