pi-roundtable-web 0.25.0 → 0.26.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 (222) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +145 -8
  3. package/dist/account-zk4efb87.css +102 -0
  4. package/dist/chunk-account-hw49gd0d.js +1 -0
  5. package/dist/chunk-action-menu-rm5cyqkj.js +1 -0
  6. package/dist/{chunk-agent-0pm9p3nn.js → chunk-agent-b017vswv.js} +1 -1
  7. package/dist/chunk-arranged-rooms-q5v3dm1r.js +1 -0
  8. package/dist/chunk-character-creator-5dxcvd16.js +1 -0
  9. package/dist/chunk-codeeditor-pyt09fwg.js +2 -0
  10. package/dist/chunk-confirm-521yqmta.js +1 -0
  11. package/dist/{chunk-connectors-anhghy3k.js → chunk-connectors-hrm06nx8.js} +1 -1
  12. package/dist/chunk-conversations-e26rrf01.js +1 -0
  13. package/dist/{chunk-drag-q4fx9b22.js → chunk-drag-v41gx2mc.js} +1 -1
  14. package/dist/{chunk-entry-he1embgp.js → chunk-entry-jxxb3ath.js} +1 -1
  15. package/dist/{chunk-folder-list-5cp8stna.js → chunk-folder-list-b97xk12b.js} +1 -1
  16. package/dist/chunk-folds-b8q7eags.js +1 -0
  17. package/dist/chunk-gate-8k61stsc.js +1 -0
  18. package/dist/chunk-group-scene-dx6wt19m.js +1 -0
  19. package/dist/chunk-group-table-e4jr8r3a.js +1 -0
  20. package/dist/chunk-host-state-g7e7c0k5.js +1 -0
  21. package/dist/chunk-host-ui-x7k6n07v.js +939 -0
  22. package/dist/{chunk-index-bvfqjh77.js → chunk-index-014rjv9k.js} +2 -2
  23. package/dist/{chunk-index-d5abvq7v.js → chunk-index-2d0kg096.js} +2 -2
  24. package/dist/chunk-index-2qd81wbx.js +2 -0
  25. package/dist/{chunk-index-9b1kt7qw.css → chunk-index-2stynxw6.css} +1 -1
  26. package/dist/{chunk-index-gpkzhq1g.js → chunk-index-459drsft.js} +2 -2
  27. package/dist/chunk-index-4mfj596y.js +2 -0
  28. package/dist/{chunk-index-18gxy79n.js → chunk-index-66nskrdj.js} +2 -2
  29. package/dist/chunk-index-awx6nnta.js +2 -0
  30. package/dist/chunk-index-bbsytycb.js +2 -0
  31. package/dist/chunk-index-c07p8k0x.js +4 -0
  32. package/dist/chunk-index-cq1e9xdz.js +2 -0
  33. package/dist/chunk-index-d1prgfbp.js +2 -0
  34. package/dist/chunk-index-dhpt8qr9.js +2 -0
  35. package/dist/chunk-index-e5sd30xy.js +2 -0
  36. package/dist/chunk-index-g351921r.js +1 -0
  37. package/dist/chunk-index-hby0ap91.js +2 -0
  38. package/dist/chunk-index-hssjbr1k.js +2 -0
  39. package/dist/chunk-index-k2qq1gdj.js +2 -0
  40. package/dist/chunk-index-ke9ynm0n.js +2 -0
  41. package/dist/{chunk-index-s681nny9.js → chunk-index-km40bhsz.js} +2 -2
  42. package/dist/chunk-index-kpscvg85.js +2 -0
  43. package/dist/chunk-index-m0d100mg.js +2 -0
  44. package/dist/chunk-index-mb72snk9.js +2 -0
  45. package/dist/chunk-index-mjqqver5.js +4 -0
  46. package/dist/{chunk-index-zfd00hwb.js → chunk-index-nqfkwkfp.js} +2 -2
  47. package/dist/chunk-index-nwqk447w.js +2 -0
  48. package/dist/{chunk-index-wmbmmrd4.js → chunk-index-pcfhpm8v.js} +4 -4
  49. package/dist/chunk-index-q8h8xzbm.js +2 -0
  50. package/dist/chunk-index-r5vszgfs.js +2 -0
  51. package/dist/{chunk-index-27qca4mr.js → chunk-index-rhtvcbsq.js} +2 -2
  52. package/dist/chunk-index-rjv7vrwd.js +13 -0
  53. package/dist/chunk-index-v23m38p6.js +50 -0
  54. package/dist/chunk-index-va0g7d88.js +1 -0
  55. package/dist/{chunk-index-krtk6nn2.js → chunk-index-wnjp6wv0.js} +2 -2
  56. package/dist/chunk-index-xgkd15n3.js +2 -0
  57. package/dist/{chunk-index-9jqcskb4.js → chunk-index-y8rnq8zf.js} +5 -5
  58. package/dist/chunk-index-z3k18atc.js +2 -0
  59. package/dist/chunk-lang-css-6bepqpnx.js +1 -0
  60. package/dist/{chunk-lang-dockerfile-d5mzxs60.js → chunk-lang-dockerfile-hrav55t7.js} +1 -1
  61. package/dist/{chunk-lang-go-830fmhba.js → chunk-lang-go-x9ahv6e5.js} +3 -3
  62. package/dist/chunk-lang-html-8jc72zt4.js +1 -0
  63. package/dist/chunk-lang-javascript-2p2qtbnf.js +1 -0
  64. package/dist/{chunk-lang-json-5eaarz7j.js → chunk-lang-json-hsemyd0r.js} +1 -1
  65. package/dist/chunk-lang-markdown-zkwb4c9n.js +6 -0
  66. package/dist/{chunk-lang-python-fjw84w10.js → chunk-lang-python-tewx7006.js} +2 -2
  67. package/dist/{chunk-lang-rust-5rbp2zdk.js → chunk-lang-rust-0ydx84s1.js} +1 -1
  68. package/dist/{chunk-lang-shell-vzagpym3.js → chunk-lang-shell-gq1tmdz4.js} +1 -1
  69. package/dist/{chunk-lang-sql-0c2w9c2y.js → chunk-lang-sql-xt1qyycg.js} +2 -2
  70. package/dist/{chunk-lang-toml-yr9fv6eb.js → chunk-lang-toml-0hamc5fc.js} +1 -1
  71. package/dist/chunk-lang-typescript-82xf7z2e.js +1 -0
  72. package/dist/{chunk-lang-xml-eze08p42.js → chunk-lang-xml-wf6h5pt2.js} +1 -1
  73. package/dist/{chunk-lang-yaml-c4b6ft3y.js → chunk-lang-yaml-7vk521h1.js} +1 -1
  74. package/dist/chunk-layout-actions-zh7bezk7.js +1 -0
  75. package/dist/{chunk-menu-items-jrwxycr1.js → chunk-menu-items-1n9qargb.js} +2 -2
  76. package/dist/chunk-notes-t15bh04m.js +1 -0
  77. package/dist/chunk-notice-bell-w3y0h0sr.js +1 -0
  78. package/dist/chunk-notices-fa3g7qze.js +1 -0
  79. package/dist/chunk-onboarding-34v3nr17.js +1 -0
  80. package/dist/chunk-overview-km5vq375.js +1 -0
  81. package/dist/chunk-palette-a8txdgd0.js +1 -0
  82. package/dist/chunk-placement-items-wgaxsbvs.js +1 -0
  83. package/dist/chunk-profile-ypxdbsk1.js +1 -0
  84. package/dist/chunk-prompt-history-wm9dsy6s.js +1 -0
  85. package/dist/chunk-prompts-7mhhq7zs.js +1 -0
  86. package/dist/chunk-room-confirms-t11a1gsw.js +1 -0
  87. package/dist/chunk-room-menu-2tm2xtfx.js +1 -0
  88. package/dist/chunk-rooms-menu-button-wxnsxjwc.js +1 -0
  89. package/dist/chunk-schedules-2ft6xxyw.js +1 -0
  90. package/dist/{chunk-seat-menu-jv4s7hmj.js → chunk-seat-menu-d3npdtx1.js} +1 -1
  91. package/dist/chunk-sheet-hosts-vngvp7wv.js +1 -0
  92. package/dist/chunk-skill-editor-65n2hsq4.js +8 -0
  93. package/dist/chunk-skills-shkdwes8.js +1 -0
  94. package/dist/chunk-switcher-list-g6hhmr1t.js +1 -0
  95. package/dist/chunk-table-1b6bsq2y.js +1 -0
  96. package/dist/chunk-table-seats-vy1qhdks.js +1 -0
  97. package/dist/{chunk-table2d-4sje1fr0.js → chunk-table2d-n26b7gd0.js} +1 -1
  98. package/dist/{chunk-table3d-h64skazp.js → chunk-table3d-8aysyf56.js} +12 -12
  99. package/dist/chunk-transcript-355faceq.js +1 -0
  100. package/dist/chunk-where-j5qdt8a4.js +1 -0
  101. package/dist/chunk-workspace-vrbs6zx1.js +1 -0
  102. package/dist/chunk-zh-tw-zeg600bk.js +1 -0
  103. package/dist/index.html +1 -1
  104. package/dist/sw.js +1 -1
  105. package/package.json +5 -4
  106. package/src/api-types.ts +301 -4
  107. package/src/app/app.ts +196 -32
  108. package/src/app/desk.ts +47 -22
  109. package/src/app/files.ts +73 -7
  110. package/src/app/presence.ts +2 -2
  111. package/src/app/protocol.ts +63 -1
  112. package/src/app/room-log.ts +141 -14
  113. package/src/app/routes.ts +124 -26
  114. package/src/app/socket.ts +309 -77
  115. package/src/app/sockets.ts +108 -20
  116. package/src/app/surface.ts +72 -36
  117. package/src/app/uploads.ts +33 -7
  118. package/src/auth/authenticator.ts +71 -8
  119. package/src/auth/next.ts +52 -0
  120. package/src/auth/oidc-pages.ts +60 -0
  121. package/src/auth/oidc.ts +611 -0
  122. package/src/auth/sessions.ts +193 -0
  123. package/src/authz.ts +172 -0
  124. package/src/console-api.ts +122 -25
  125. package/src/console-server.ts +70 -6
  126. package/src/gate.ts +90 -0
  127. package/src/host/access.ts +161 -0
  128. package/src/host/cards.ts +99 -0
  129. package/src/host/context.ts +141 -0
  130. package/src/host/forms.ts +237 -0
  131. package/src/host/frames.ts +342 -0
  132. package/src/host/host-app.ts +176 -0
  133. package/src/host/host-context.ts +49 -0
  134. package/src/host/host-routes.ts +363 -0
  135. package/src/host/pages.ts +266 -0
  136. package/src/host/reads.ts +155 -0
  137. package/src/host/retention.ts +41 -0
  138. package/src/host/room-views.ts +137 -0
  139. package/src/host/rooms-service.ts +414 -0
  140. package/src/host/stored-json.ts +13 -0
  141. package/src/host/views.ts +103 -0
  142. package/src/i18n/zh-tw.ts +132 -0
  143. package/src/notices/api.ts +43 -0
  144. package/src/notices/mount.ts +292 -0
  145. package/src/notices/service.ts +294 -0
  146. package/src/notices/store.ts +298 -0
  147. package/src/notices/urls.ts +38 -0
  148. package/src/onboarding/api.ts +32 -0
  149. package/src/onboarding/service.ts +149 -0
  150. package/src/onboarding/steps.ts +75 -0
  151. package/src/onboarding/waivers.ts +40 -0
  152. package/src/options.ts +498 -34
  153. package/src/profile/api.ts +175 -0
  154. package/src/profile/links.ts +162 -0
  155. package/src/push/api.ts +189 -52
  156. package/src/push/dispatch.ts +156 -0
  157. package/src/push/drain.ts +139 -0
  158. package/src/push/outbox.ts +218 -0
  159. package/src/push/prefs.ts +118 -0
  160. package/src/push/sender.ts +7 -2
  161. package/src/push/triggers.ts +56 -5
  162. package/src/push/vapid.ts +19 -0
  163. package/src/push/web-push-transport.ts +106 -0
  164. package/src/push-sender/index.ts +14 -0
  165. package/src/push-sender/run.ts +118 -0
  166. package/src/push-sender/session.ts +54 -0
  167. package/src/visitors.ts +94 -6
  168. package/src/web-app.ts +674 -0
  169. package/src/web-plugin.ts +268 -26
  170. package/dist/chunk-action-menu-qe839g4b.js +0 -1
  171. package/dist/chunk-arranged-rooms-enpfswmg.js +0 -1
  172. package/dist/chunk-character-creator-6yf29xwx.js +0 -1
  173. package/dist/chunk-codeeditor-gdbdg7rp.js +0 -2
  174. package/dist/chunk-confirm-xrw7d732.js +0 -1
  175. package/dist/chunk-conversations-ry228aes.js +0 -1
  176. package/dist/chunk-folds-hff104tk.js +0 -1
  177. package/dist/chunk-group-scene-h228jdat.js +0 -1
  178. package/dist/chunk-index-0p5h2kdz.js +0 -2
  179. package/dist/chunk-index-0pt08yd9.js +0 -1
  180. package/dist/chunk-index-12bw9yj8.js +0 -2
  181. package/dist/chunk-index-2ad17eh4.js +0 -2
  182. package/dist/chunk-index-31wh5twj.js +0 -52
  183. package/dist/chunk-index-4dy94pbz.js +0 -2
  184. package/dist/chunk-index-4ecjtdy8.js +0 -13
  185. package/dist/chunk-index-4v1b7ks9.js +0 -2
  186. package/dist/chunk-index-5d8yjj4m.js +0 -2
  187. package/dist/chunk-index-89ajmxh7.js +0 -2
  188. package/dist/chunk-index-b9ny4623.js +0 -2
  189. package/dist/chunk-index-e1dr6g10.js +0 -2
  190. package/dist/chunk-index-hk3xyy20.js +0 -2
  191. package/dist/chunk-index-jm23vn03.js +0 -4
  192. package/dist/chunk-index-k7gh0jvz.js +0 -2
  193. package/dist/chunk-index-ky42ev0b.js +0 -2
  194. package/dist/chunk-index-pa2yyqh0.js +0 -2
  195. package/dist/chunk-index-pcvt668q.js +0 -2
  196. package/dist/chunk-index-pqw27eye.js +0 -1
  197. package/dist/chunk-index-ymbjrsp6.js +0 -2
  198. package/dist/chunk-lang-css-t85r8rz0.js +0 -1
  199. package/dist/chunk-lang-html-n6jparge.js +0 -1
  200. package/dist/chunk-lang-javascript-xj00cp97.js +0 -1
  201. package/dist/chunk-lang-markdown-zxx8eke8.js +0 -6
  202. package/dist/chunk-lang-typescript-8f6yywt3.js +0 -1
  203. package/dist/chunk-layout-actions-bv0chj41.js +0 -1
  204. package/dist/chunk-notes-9b7pgqfe.js +0 -1
  205. package/dist/chunk-overview-8yw71esz.js +0 -1
  206. package/dist/chunk-palette-frms7axe.js +0 -1
  207. package/dist/chunk-placement-items-fvfy9m0y.js +0 -1
  208. package/dist/chunk-prompt-history-yrqehads.js +0 -1
  209. package/dist/chunk-prompts-g6609tqx.js +0 -1
  210. package/dist/chunk-room-confirms-0a2y0925.js +0 -1
  211. package/dist/chunk-room-menu-g11q97br.js +0 -1
  212. package/dist/chunk-rooms-menu-button-h9qge48n.js +0 -1
  213. package/dist/chunk-schedules-ezmacrbj.js +0 -1
  214. package/dist/chunk-sheet-hosts-b0azyfhb.js +0 -1
  215. package/dist/chunk-skill-editor-h6k6whwg.js +0 -8
  216. package/dist/chunk-skills-gqcfhq56.js +0 -1
  217. package/dist/chunk-switcher-list-mcpamqnj.js +0 -1
  218. package/dist/chunk-table-s8cde1xz.js +0 -1
  219. package/dist/chunk-table-seats-wqkjn8bc.js +0 -1
  220. package/dist/chunk-transcript-c59c6mpm.js +0 -1
  221. package/dist/chunk-workspace-0cyspkk4.js +0 -1
  222. package/dist/chunk-zh-tw-nc93jm10.js +0 -1
@@ -0,0 +1 @@
1
+ import{O,C,S,X,a,D,A,o,r,t,c,p,e,n,s,K,d,oe,y,u,m,v,h,_,Jt,Kr,Jr,Me,Fn,ns,de,yn}from"./chunk-index-v23m38p6.js";import{H}from"./chunk-index-e5sd30xy.js";import"./chunk-index-nwqk447w.js";import"./chunk-index-z3k18atc.js";import{be,dt,Mi}from"./chunk-index-kpscvg85.js";import{sn}from"./chunk-index-66nskrdj.js";import{Qe,et}from"./chunk-index-c07p8k0x.js";import"./chunk-index-r5vszgfs.js";import{nt}from"./chunk-index-rhtvcbsq.js";import{I}from"./chunk-index-awx6nnta.js";import{Ge}from"./chunk-index-bbsytycb.js";import"./chunk-index-459drsft.js";function ie(l){return n("fieldset",{className:"field",children:[e("legend",{children:l.label}),e("div",{className:"option-chips",children:l.options.map((f)=>e("button",{type:"button","aria-pressed":f.value===l.value,className:"option-chip",onClick:()=>l.onChange(f.value),children:f.label},f.value))})]})}var Fe=S(()=>(O("wm9dsy6s"),import("./chunk-prompt-history-wm9dsy6s.js")).then((l)=>({default:l.HistorySheet}))),Re=S(()=>(O("5dxcvd16"),import("./chunk-character-creator-5dxcvd16.js")).then((l)=>({default:l.CharacterCreator}))),Te=["default","off","minimal","low","medium","high","xhigh"],ve={default:c("Follow the assistant (automatic)"),off:c("Off"),minimal:c("Minimal"),low:c("Low"),medium:c("Medium"),high:c("High"),xhigh:c("Very high")},B="default",me=(l)=>t(ve[l]??l),he=(l)=>({displayName:l.displayName,prompt:l.prompt,model:l.model??B,thinking:l.thinking??B});function ge(l,f){return{...f.displayName!==l.displayName?{displayName:f.displayName}:{},...f.prompt!==l.prompt?{prompt:f.prompt}:{},...f.model!==(l.model??B)?{model:f.model}:{},...f.thinking!==(l.thinking??B)?{thinking:f.thinking}:{}}}function ye(){let l=Jr(),f=o(l);if(l)f.current=l;let i=f.current,w=l!==void 0;if(a(()=>{if(!w)return;let P=window.location.href,L=()=>{if(window.location.href!==P)Jt()};return window.addEventListener("popstate",L),window.addEventListener("hashchange",L),()=>{window.removeEventListener("popstate",L),window.removeEventListener("hashchange",L)}},[w]),!i)return null;return e(I,{open:l!==void 0,title:t("Edit agent"),size:"wide",onClose:Jt,children:e(xe,{name:i.name,opened:i.id},i.name)})}function xe({name:l,opened:f}){let[i,w]=r(),[P,L]=r([]),[k,z]=r(),[E,x]=r(),[g,T]=r(!1),[R,G]=r(!1),[ee,Q]=r(!1),[U,q]=r(!1),te=yn(i?.room??""),W=o(null),Y=i!==void 0,j=d((N)=>i?N.rooms[i.room]?.view?.muted===!0:!1,i?.room??""),[ae,V]=r(!1),ne=d((N)=>i?N.rooms[i.room]?.view?.coordinator===!0:!1,i?.room??""),J=D(),Z=D(),M=D();a(()=>{if(!Y||!Kr()?.look)return;W.current?.scrollIntoView({block:"start"}),W.current?.focus({preventScroll:!0})},[Y,f]);let b=o({});b.current={profile:i,draft:E},a(()=>{let N=!0;return Promise.all([y.agent(l),y.models()]).then(([re,De])=>{if(!N)return;let{profile:fe,draft:le}=b.current,Pe=fe&&le&&Object.keys(ge(fe,le)).length>0;w(re),L(De.models),x(Pe?le:he(re))},(re)=>N&&z(u(re))),()=>{N=!1}},[l,f]);let F=A(()=>i&&E?ge(i,E):{},[i,E]);if(k)return e(h,{message:k});if(!i||!E)return e(v,{});let pe=Object.keys(F).length>0,Ie=Array.from(new Set([B,...P,E.model])),ue=async()=>{T(!0);try{let N=await y.updateAgent(l,F);w(N),x(he(N)),G(!1),m(t("Saved."))}catch(N){m(u(N),"danger")}finally{T(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(de,{spec:i.character,name:i.name,size:72,state:te,label:i.displayName}),n("div",{children:[e("h3",{children:i.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:i.effective.model,thinking:me(i.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:M,children:[e("span",{className:"menu-icon",children:e(s,{name:j?"bell-off":"bell"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Notifications")}),e("span",{className:"meta",children:t("Push this room's posts to every owner's devices. A card that waits for you is always pushed.")})]}),e(nt,{id:M,checked:!j,label:t("Notifications"),busy:ae,onChange:async(N)=>{V(!0),await Ge(i.room,!N),V(!1)}})]})})}),R?e($e,{profile:i,draft:E,saving:g,onBack:()=>G(!1),onSave:ue}):n("form",{className:"stack form",onSubmit:(N)=>{if(N.preventDefault(),!pe)return;if(F.prompt!==void 0)G(!0);else ue()},children:[n("label",{htmlFor:Z,children:[t("Name"),e("input",{id:Z,value:E.displayName,onChange:(N)=>x({...E,displayName:N.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:J,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>q(!0),children:[e(s,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>Q(!0),children:[e(Oe,{}),t("Full screen")]})]})]}),e("textarea",{id:J,rows:8,value:E.prompt,onChange:(N)=>x({...E,prompt:N.target.value})})]}),e(ie,{label:t("Model"),value:E.model,onChange:(N)=>x({...E,model:N}),options:Ie.map((N)=>({value:N,label:N===B?t("Follow the assistant"):N}))}),e(ie,{label:t("Thinking level"),value:E.thinking,onChange:(N)=>x({...E,thinking:N}),options:Te.map((N)=>({value:N,label:t(ve[N])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!pe||g,children:g?t("Saving…"):F.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(He,{name:l,opened:f}),n("section",{className:"card stack",ref:W,tabIndex:-1,children:[e("h3",{children:t("Look")}),e("p",{className:"meta",children:t("Class, colors and parts. The picture here, in the rooms and in Discord all follow it.")}),e(C,{fallback:e(v,{}),children:e(Re,{name:i.name,displayName:i.displayName,prompt:i.prompt,character:i.character,onSaved:(N)=>w(N)})})]}),ne?null:n("section",{className:"card stack",children:[e("h3",{children:t("Archive")}),e("p",{className:"meta",children:t("An archived agent stops answering and its schedules are cancelled. Its history is kept, and you can restore it from Archived.")}),e("div",{className:"actions",children:e("button",{type:"button",className:"danger",onClick:()=>{Jt(),Me({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive {name}",{name:i.displayName})})})]}),U?e(C,{fallback:null,children:e(Fe,{open:U,title:t("History of the prompt"),load:async()=>(await Qe.agentPromptHistory(l)).versions.map((N)=>({id:N.id,text:N.text,previous:N.previous,by:N.by,at:N.at})),onUse:(N)=>{x({...E,prompt:N}),q(!1)},onClose:()=>q(!1)})}):null,e(I,{open:ee,title:t("Prompt"),size:"full",onClose:()=>Q(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:E.prompt,onChange:(N)=>x({...E,prompt:N.target.value})})})]})}function He({name:l,opened:f}){let[i,w]=r(),[P,L]=r(),[k,z]=r(),E=D();if(a(()=>{let g=!0;return be.skills(l).then((T)=>g&&w(T),(T)=>{if(g&&!(T instanceof oe&&T.status===404))z(u(T))}),()=>{g=!1}},[l,f]),k)return e(h,{message:k});if(!i)return null;let x=async(g,T)=>{L(g);try{w(await be.setSkills(l,T?{add:[g]}:{remove:[g]}))}catch(R){m(u(R),"danger")}finally{L(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),children:[e("h3",{children:t("Skills")}),e("p",{className:"meta",children:t("What the agent can load when a task calls for it. It applies from its next turn.")}),e("ul",{className:"menu",children:i.skills.map((g,T)=>{let R=`${E}-${T}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:R,children:[n("span",{className:"menu-text",children:[e("strong",{children:g.name}),e("span",{className:"meta",children:g.missing?t("Its file cannot be read."):g.builtin?t("Built in: every agent carries it."):g.description??""})]}),e(nt,{id:R,checked:g.carried,label:g.name,busy:P===g.name,disabled:g.builtin,onChange:(G)=>x(g.name,G)})]})},g.name)})})]})}var Oe=()=>e("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e("path",{d:"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"})});function $e(l){let{profile:f,draft:i}=l,w=o(null);a(()=>w.current?.focus(),[]);let P=[];if(i.displayName!==f.displayName)P.push({label:t("Name"),before:f.displayName,after:i.displayName});let L=(k)=>k===B?t("Follow the assistant"):k;if(i.model!==(f.model??B))P.push({label:t("Model"),before:L(f.model??B),after:L(i.model)});if(i.thinking!==(f.thinking??B))P.push({label:t("Thinking level"),before:me(f.thinking??B),after:me(i.thinking)});return n("section",{ref:w,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),P.length?e("ul",{className:"review-fields",children:P.map((k)=>n("li",{children:[e("strong",{children:k.label}),e("span",{className:"review-before",children:k.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:k.after})]},k.label))}):null,e(et,{label:t("Prompt"),before:f.prompt,after:i.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:l.saving,onClick:l.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:l.saving,onClick:l.onSave,children:l.saving?t("Saving…"):t("Save")})]})]})}function Ne(){let[l,f]=r(),[i,w]=r(),[P,L]=r(),[k,z]=r(),E=X(async()=>{try{f((await be.archive()).entries),w(void 0)}catch(g){w(u(g))}},[]);a(()=>{E()},[E]);let x=async(g)=>{L(g.name);try{if(g.kind==="agent")await be.restoreAgent(g.name);else await be.restoreGroup(g.name);await dt(),m(t("Restored {name}.",{name:g.displayName})),await E()}catch(T){m(u(T),"danger")}finally{L(void 0)}};if(i&&!l)return e(h,{message:i});if(!l)return e(v,{});return n("div",{className:"stack",children:[e("p",{className:"meta",children:t("Archived agents and groups no longer answer. Their history is kept until you delete them.")}),l.length===0?e(_,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:l.map((g)=>n("li",{className:"menu-item",children:[e("span",{className:"menu-icon",children:e(s,{name:g.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:g.displayName}),n("span",{className:"meta",children:[g.kind==="agent"?t("Agent"):t("Group")," ·"," ",g.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:P===g.name,onClick:()=>x(g),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:P===g.name,onClick:()=>z(g),children:t("Delete")})]},`${g.kind}:${g.name}`))}),e(H,{open:k!==void 0,title:t("Delete {name}?",{name:k?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>z(void 0),onConfirm:async()=>{if(!k)return;if(k.kind==="agent")await be.deleteAgent(k.name);else await be.deleteGroup(k.name);await dt(),m(t("Deleted {name}.",{name:k.displayName})),await E()},children:e("p",{children:t("{name} and its messages in this app are deleted for good, and the name can be used again. This cannot be undone.",{name:k?.displayName??""})})})]})}var we=/^[a-z0-9-]{1,32}$/,ke=2,Ce=6,se="\x00";function Ve(){let l=d((f)=>f.order.flatMap((i)=>{let w=f.rooms[i]?.view;return w?.kind==="agent"?[`${w.name}${se}${w.displayName}`]:[]}).join(`${se}${se}`));return A(()=>l===""?[]:l.split(`${se}${se}`).map((f)=>{let[i="",w=""]=f.split(se);return{name:i,displayName:w}}),[l])}function Se(l){let f=Ve(),[i,w]=r(),[P,L]=r(),[k,z]=r(""),[E,x]=r(""),[g,T]=r(!1),[R,G]=r([]),[ee,Q]=r(""),[U,q]=r(!1),[te,W]=r(l.name===void 0),Y=D(),j=D();a(()=>{let M=l.name;if(M===void 0)return;let b=!0;return be.group(M).then((F)=>{if(!b)return;w(F),z(F.displayName),G(F.members),Q(F.host),W(!0)},(F)=>b&&L(u(F))),()=>{b=!1}},[l.name]);let ae=(M)=>f.find((b)=>b.name===M)?.displayName??M,V=R.includes(ee)?ee:R[0]??"",ne=i===void 0?!0:k.trim()!==i.displayName||R.join(",")!==i.members.join(",")||V!==i.host,J=k.trim()!==""&&R.length>=ke&&R.length<=Ce&&(i!==void 0||we.test(E));if(P&&!te)return e(h,{message:P});if(!te)return e(v,{});let Z=async()=>{q(!0),L(void 0);try{if(i){await be.updateGroup(i.name,{...k.trim()!==i.displayName?{displayName:k.trim()}:{},...R.join(",")!==i.members.join(",")?{members:R}:{},...V!==i.host?{host:V}:{}}),await dt(),m(t("Saved.")),l.onDone();return}let M=await be.createGroup({name:E,displayName:k.trim(),members:R,host:V});await dt(),m(t("Made {name}.",{name:M.displayName})),l.onDone(),K("room",M.room)}catch(M){L(u(M))}finally{q(!1)}};return n("form",{className:"stack form",onSubmit:(M)=>{if(M.preventDefault(),J&&ne&&!U)Z()},children:[n("label",{htmlFor:Y,children:[t("Name"),e("input",{id:Y,value:k,autoComplete:"off",onChange:(M)=>{if(z(M.target.value),!i&&!g)x(M.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),i?null:n("label",{htmlFor:j,children:[t("Permanent name"),e("input",{id:j,value:E,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":E!==""&&!we.test(E),onChange:(M)=>{T(!0),x(M.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Members")}),e("span",{className:"meta",children:t("Pick 2 to 6 agents. They take turns in the order picked.")}),e("ul",{className:"menu",children:f.map((M)=>{let b=R.includes(M.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:b,disabled:!b&&R.length>=Ce,onChange:()=>G(b?R.filter((F)=>F!==M.name):[...R,M.name])}),e("span",{className:"menu-text",children:e("strong",{children:M.displayName})})]})},M.name)})})]}),R.length>=ke?e(ie,{label:t("Host"),value:V,onChange:Q,options:R.map((M)=>({value:M,label:ae(M)}))}):null,P?e(h,{message:P}):null,n("div",{className:"actions",children:[i?e("button",{type:"button",className:"danger",onClick:()=>{l.onDone(),Me({kind:"archive",room:i.room,name:i.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!J||!ne||U,children:U?t("Saving…"):i?t("Save"):t("Make group")})]})]})}var ze=S(()=>(O("5dxcvd16"),import("./chunk-character-creator-5dxcvd16.js")).then((l)=>({default:l.CharacterCreator}))),Ae=/^[a-z0-9-]{1,32}$/,ce="default";function Be(l){let f=[];for(let i of l){let w=i.indexOf("/"),P=w>0?i.slice(0,w):"",L=f.find((k)=>k.provider===P&&P!=="");if(L)L.models.push(i);else f.push({provider:P,models:[i]})}return f}var Ke=(l)=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Ee({onDone:l}){let[f,i]=r(""),[w,P]=r(""),[L,k]=r(!1),[z,E]=r(""),[x,g]=r(ce),[T,R]=r(""),[G,ee]=r(),[Q,U]=r(!1),[q,te]=r([]),[W,Y]=r(),[j,ae]=r(!1),V=[D(),D(),D(),D(),D()];a(()=>{let b=!0;return y.models().then((F)=>b&&te(F.models),()=>{return}),()=>{b=!1}},[]);let ne=A(()=>sn({name:w,displayName:f,prompt:z}),[w,f,z]),J=G?.spec??ne,Z=Ae.test(w)&&f.trim()!==""&&z.trim()!=="";if(Q)return e(C,{fallback:e(v,{}),children:e(ze,{name:w||"new",displayName:f,prompt:z,character:J,onPick:(b,F)=>{ee({input:b,spec:F}),U(!1)},onCancel:()=>U(!1)})});let M=async()=>{ae(!0),Y(void 0);try{let b={name:w,displayName:f.trim(),prompt:z,...x!==ce?{model:x}:{},...T.trim()?{task:T.trim()}:{},...G?{character:G.input}:{}},F=await be.createAgent(b);await dt(),m(t("Made {name}.",{name:F.displayName})),l(),K("room",F.room)}catch(b){Y(b instanceof oe&&b.field?`${b.field}: ${u(b)}`:u(b))}finally{ae(!1)}};return n("form",{className:"stack form",onSubmit:(b)=>{if(b.preventDefault(),Z&&!j)M()},children:[n("label",{htmlFor:V[0],children:[t("Name"),e("input",{id:V[0],value:f,autoComplete:"off",onChange:(b)=>{if(i(b.target.value),!L)P(Ke(b.target.value))}})]}),n("label",{htmlFor:V[1],children:[t("Permanent name"),e("input",{id:V[1],value:w,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":w!==""&&!Ae.test(w),onChange:(b)=>{k(!0),P(b.target.value)}}),e("span",{className:"meta",children:t("Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.")})]}),n("label",{htmlFor:V[2],children:[t("Prompt"),e("textarea",{id:V[2],rows:6,value:z,onChange:(b)=>E(b.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:V[4],children:[t("Model"),n("select",{id:V[4],value:x,onChange:(b)=>g(b.target.value),children:[e("option",{value:ce,children:t("Follow the assistant")}),Be(q).map((b)=>b.provider===""?b.models.map((F)=>e("option",{value:F,children:F},F)):e("optgroup",{label:b.provider,children:b.models.map((F)=>e("option",{value:F,children:F},F))},b.provider))]})]}),n("label",{htmlFor:V[3],children:[t("Opening task"),e("textarea",{id:V[3],rows:3,value:T,onChange:(b)=>R(b.target.value)}),e("span",{className:"meta",children:t("Optional. The agent starts on it as soon as it is made.")})]}),n("div",{className:"profile-head",children:[e(de,{spec:J,name:w||"new",size:72,label:f}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:G?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>U(!0),children:t("Choose a look")})]})]}),W?e(h,{message:W}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!Z||j,children:j?t("Making…"):t("Make agent")})})]})}var Ue=(l)=>l.kind==="new-agent"?t("New agent"):l.kind==="archive"?t("Archived"):l.name===void 0?t("New group"):t("Edit group");function Le(){let l=ns(),f=o(l);if(l)f.current=l;let i=f.current,w=l!==void 0;if(a(()=>{if(!w)return;let P=window.location.href,L=()=>{if(window.location.href!==P)Fn()};return window.addEventListener("popstate",L),window.addEventListener("hashchange",L),()=>{window.removeEventListener("popstate",L),window.removeEventListener("hashchange",L)}},[w]),!i)return null;return e(I,{open:l!==void 0,title:Ue(i),size:"wide",onClose:Fn,children:e("div",{className:"stack agent-sheet",children:i.kind==="new-agent"?e(Ee,{onDone:Fn}):i.kind==="archive"?e(Ne,{}):e(Se,{...i.name===void 0?{}:{name:i.name},onDone:Fn})},i.id)})}function ma(){return n(p,{children:[e(Mi,{}),e(ye,{}),e(Le,{})]})}export{ma as SheetHosts};
@@ -0,0 +1,8 @@
1
+ import{O,C,S,a,D,r,t,p,e,n,s,oe,u,m,v,h}from"./chunk-index-v23m38p6.js";import{Qe,et}from"./chunk-index-c07p8k0x.js";import{I}from"./chunk-index-awx6nnta.js";var M=S(()=>(O("wm9dsy6s"),import("./chunk-prompt-history-wm9dsy6s.js")).then((c)=>({default:c.HistorySheet}))),B=`---
2
+ name: my-skill
3
+ description: "Use when "
4
+ ---
5
+
6
+ # My skill
7
+
8
+ `;function _(c){let{name:d}=c,[l,k]=r(),[f,b]=r(d?"":B),[g,R]=r(),[z,y]=r(!1),[w,x]=r(!1),[A,H]=r(!1),[T,N]=r(!1),L=D();a(()=>{if(!d)return;let i=!0;return Qe.skillDocument(d).then((o)=>{if(!i)return;k(o),b(o.text)},(o)=>i&&R(u(o))),()=>{i=!1}},[d]);let E=l?.text??"",U=f!==E,F=d!==void 0&&!l&&!g,V=async()=>{x(!0);try{if(l){let i=await Qe.saveSkillDocument(l.name,{text:f,baseHash:l.hash});k(i),b(i.text),y(!1),H(!1),m(t("Saved.")),c.onSaved()}else await Qe.createSkillDocument({text:f}),m(t("Skill created.")),c.onSaved(),c.onClose()}catch(i){if(i instanceof oe&&i.status===409){let{current:o}=i.body;k(o),H(!0)}else m(u(i),"danger")}finally{x(!1)}};return n(I,{open:!0,title:d??t("New skill"),size:"full",onClose:c.onClose,children:[g?e(h,{message:g}):null,F?e(v,{}):null,l&&!l.writable?e(h,{message:t("This skill cannot be edited here.")}):null,!F&&!g&&(!l||l.writable)?n("div",{className:"stack",children:[z?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),A?e(h,{message:t("This skill changed while you were editing it. The changes below are against the version there now; save again to replace it, or go back to edit.")}):null,e(et,{label:"SKILL.md",before:E,after:f}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:w,onClick:()=>y(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:w,onClick:V,children:w?t("Saving…"):l?t("Save"):t("Create skill")})]})]}):n(p,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:L,children:"SKILL.md"}),l?e("span",{className:"field-tools",children:n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>N(!0),children:[e(s,{name:"reset",size:16}),t("History")]})}):null]}),e("textarea",{id:L,className:"prompt-full",spellCheck:!1,value:f,onChange:(i)=>b(i.target.value)}),e("p",{className:"meta",children:t("Frontmatter holds the name, which cannot change, and a description that starts with “Use when”. The rest is the skill.")})]}),e("div",{className:"actions",children:e("button",{type:"button",disabled:!U||!f.trim(),onClick:()=>y(!0),children:t("Review changes")})})]}),T&&l?e(C,{fallback:null,children:e(M,{open:T,title:t("History of {name}",{name:l.name}),load:async()=>{let{versions:i}=await Qe.skillHistory(l.name);return i.map((o,K)=>({id:o.id,text:o.text,previous:i[K+1]?.text??"",by:o.by,at:o.at}))},onUse:(i)=>{b(i),y(!1),N(!1)},onClose:()=>N(!1)})}):null]}):null]})}export{_ as SkillEditor};
@@ -0,0 +1 @@
1
+ import{O,zi,C,S,a,r,t,p,e,n,s,y,u,v,h,_,P,Nt,vt}from"./chunk-index-v23m38p6.js";import{Oe}from"./chunk-index-xgkd15n3.js";import{ue}from"./chunk-index-r5vszgfs.js";import"./chunk-index-awx6nnta.js";function b({source:i}){return e("div",{className:"prose document",children:e(Nt,{remarkPlugins:[vt],components:{a:({href:o,children:d})=>o&&/^https?:\/\//.test(o)?e("a",{href:o,target:"_blank",rel:"noreferrer",children:d}):e("span",{children:d}),img:({alt:o})=>e("span",{children:o}),pre:({children:o})=>e("div",{className:"code-block",children:e("pre",{children:o})}),table:({children:o})=>e("div",{className:"table-wrap",children:e("table",{children:o})})},children:i})})}var N=S(()=>(O("65n2hsq4"),import("./chunk-skill-editor-65n2hsq4.js")).then((i)=>({default:i.SkillEditor})));function q(){let[i,o]=r(0),{data:d,error:l}=Oe(()=>y.skills(),`skills:${i}`),[k,w]=r(),[m,g]=r();a(()=>{y.session().then(w,()=>{return})},[]);let f=k?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),f?n("button",{type:"button",className:"secondary",onClick:()=>g({name:void 0}),children:[e(s,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:f?t("Registered skills and their carriers. A skill an agent wrote can be edited here; the others are read-only."):t("Registered skills and their carriers; ask an agent on Discord to edit their contents.")}),l?e(h,{message:l}):null,!d&&!l?e(v,{}):null,d?.length===0?e(_,{children:t("No skills.")}):null,d?.map((c)=>e(D,{skill:c,onEdit:f&&c.source.kind==="written"?()=>g({name:c.name}):void 0},`${c.name}:${i}`)),m?e(C,{fallback:null,children:e(N,{name:m.name,onSaved:()=>o((c)=>c+1),onClose:()=>g(void 0)},m.name??"")}):null]})}function E(i){switch(i.kind){case"builtin":return t("Built in with the release; it changes with the release.");case"package":return t("From the package {package}; it changes when the package is upgraded.",{package:i.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${i.repo}:${i.path}`});default:return}}function D({skill:i,onEdit:o}){let[d,l]=r(!1),[k,w]=r(),[m,g]=r(),f=i.source.kind==="builtin"?t("Built-in"):i.source.kind==="written"?t("Assistant-written"):i.source.kind==="package"?i.source.package:`${i.source.repo}:${i.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(P,{children:f}),i.missing?e(P,{tone:"warn",children:t("File missing")}):n(p,{children:[o?e("button",{type:"button",className:"secondary",onClick:o,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(l(!0),!k)g(void 0),y.skill(i.name).then(w).catch((c)=>g(u(c)))},children:"SKILL.md"})]})]}),e("p",{children:i.missing??i.description}),i.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(s,{name:"lock",size:14}),e("span",{children:E(i.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",i.source.kind==="builtin"?t("All agents"):i.carriers.join(", ")||t("None")]}),i.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",i.groups.join(", ")]}):null,e(ue,{open:d,title:i.name,size:"wide",onClose:()=>l(!1),children:m?e(h,{message:m}):!k?e(v,{}):e(V,{title:i.name,detail:k})})]})}function V({title:i,detail:o}){let d=o.metadata.filter((l)=>!(l.key==="name"&&l.value===i));return n("div",{className:"skill-document",children:[d.length?e("dl",{className:"skill-meta",children:d.map((l)=>n(zi,{children:[e("dt",{children:l.key}),e("dd",{children:l.value})]},l.key))}):null,e(b,{source:o.body})]})}export{q as SkillsPage};
@@ -0,0 +1 @@
1
+ import{A,o,r,t,ve,p,e,n,s,x,K,st,d,Yt,Lt,en,ze,rn,pi}from"./chunk-index-v23m38p6.js";import{Cn,An,$n,Rt}from"./chunk-index-pcfhpm8v.js";import{Nn}from"./chunk-index-014rjv9k.js";import{ls,_t}from"./chunk-index-459drsft.js";Cn();function v(){let l=d((c)=>JSON.stringify(ls(c,(a)=>_t(c,a),(a)=>st(c,a)>0,!0).map((a)=>({id:a.id,...a.title===void 0?{}:{title:a.title},entries:a.keys.map((u)=>({key:u,name:c.rooms[u]?.view?.displayName??u,waiting:st(c,u)>0}))})))),m=$n(),y=o(l);if(!m)y.current=l;let f=y.current;return A(()=>JSON.parse(f),[f])}function b(l){let{key:m,name:y}=l.entry,f=d((i)=>i.rooms[m]),c=d((i)=>st(i,m)),a=f?.view,u=ze(a?.character),g=Rt(()=>Lt(m,l.onLeave),l.liftable&&!a?.home?An(m):void 0);if(!a)return null;return e("li",{...l.liftable&&!a.home?{"data-drop-item":"","data-key":m}:{},children:n("a",{className:"switcher-row",...g,href:x("room",m),"aria-current":m===l.current?"page":void 0,style:u,onClick:(i)=>{if(i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;i.preventDefault(),l.onPick(m)},children:[n("span",{className:"switcher-picture",children:[e(rn,{view:a,size:40}),c?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:y}),f?.typing?n("span",{className:"switcher-working",children:[n("span",{className:"typing","aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t("Working")]}):null]}),e(pi,{room:m}),c?e("span",{className:"badge badge-warn",children:ve(c,"{count} card waiting","{count} cards waiting")}):null,a.muted?n("span",{className:"switcher-mode","data-mode":"muted",title:t("Notifications are off"),children:[e(s,{name:"bell-off",size:14}),e("span",{className:"visually-hidden",children:t("Notifications are off")})]}):null,f?.mode.yolo?n("span",{className:"switcher-mode","data-mode":"yolo",title:t("Yolo"),children:[e(s,{name:"bolt",size:14}),e("span",{className:"visually-hidden",children:t("Yolo")})]}):null,f?.mode.longRunning?n("span",{className:"switcher-mode","data-mode":"long",title:t("Long-running"),children:[e(s,{name:"timer",size:14}),e("span",{className:"visually-hidden",children:t("Long-running")})]}):null]})})}function Y(l){let[m,y]=r(""),f=v(),c=f.map((i)=>({...i,entries:i.entries.filter((h)=>Nn(m,h.name)!==void 0)})).filter((i)=>i.entries.length>0||m===""),a=(i)=>l.close(i===l.current?void 0:()=>K("room",i)),u=f.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),g=c.filter((i)=>i.entries.length>0).length>1;return n(p,{children:[n("div",{className:"switcher-search",children:[e(s,{name:"search",size:16}),e("input",{type:"search",value:m,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>y(i.target.value),onKeyDown:(i)=>{let h=c.flatMap((w)=>w.entries)[0];if(i.key==="Enter"&&h&&!Yt(i.nativeEvent))a(h.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>en(i.currentTarget,l.close),children:e(s,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:c.map((i)=>{let h=i.id==="waiting",w=i.id==="pinned"?"pinned":i.id==="rest"?"rest":h||i.id==="home"?void 0:"folder";return n("section",{"aria-label":h?t("Waiting for you"):i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?u:i.title??t("Rooms"),...i.entries.length===0?{"data-empty":""}:{},...w?{"data-drop-zone":w,"data-zone-id":i.id,...w==="folder"?{"data-folder":i.id}:{}}:{},children:[h?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):g||i.entries.length===0?e("h2",{className:"switcher-heading",children:i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?u:i.title}):null,e("ul",{className:"switcher-list",children:i.entries.map((N)=>e(b,{entry:N,current:l.current,onPick:a,onLeave:l.close,liftable:!h&&i.id!=="home"},N.key))})]},i.id)})})]})}export{Y as SwitcherList};
@@ -0,0 +1 @@
1
+ import{O,C,S,a,r,t,e,n,rt,K,d,ge,is}from"./chunk-index-v23m38p6.js";import{si,zn,$t}from"./chunk-index-mjqqver5.js";import{Br,Xn}from"./chunk-index-d1prgfbp.js";import"./chunk-index-awx6nnta.js";var A=S(()=>(O("vy1qhdks"),import("./chunk-table-seats-vy1qhdks.js")).then((s)=>({default:s.TableSeatsSheet}))),E=300;function H(s){let[c,u]=r(!1);return a(()=>{if(!s){u(!1);return}if(rt()){u(!0);return}let i=setTimeout(()=>u(!0),E);return()=>clearTimeout(i)},[s]),c}function v(s,c,u,i){is(s).then((f)=>{if(f)ge({...f,at:c,via:u,source:i})},()=>{return})}function _({focus:s}){let[c,u]=r(),i=si(void 0),f=zn(),[k,g]=r(!1),[T,M]=r(!1),h=d((o)=>o.listed),l=Br(s,i),p=i.find((o)=>o.name===l);a(()=>{if(s&&h&&l===null)K("table",void 0,{replace:!0})},[s,h,l]);let R=H(l!==null),b=(o)=>{if(o===l)return;K("table",o??void 0,{replace:l!==null})},y=()=>{M(!0),g(!0)},N=i.length===0&&f.length>0;return n("div",{className:"table-page","data-focused":l!==null||void 0,children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[c?.kind==="webgl"?e("button",{type:"button",className:"secondary",onClick:()=>b(null),children:t("Reset view")}):null,f.length>0?e("button",{type:"button",className:"secondary","aria-haspopup":"dialog",onClick:y,children:t("Who's at the table")}):null]})]}),n("div",{className:"table-frame","data-focused":l!==null||void 0,children:[N?n("div",{className:"table-empty-state",children:[e("strong",{children:t("The table is empty")}),e("p",{className:"meta",children:t("Every agent has left the table. Choose who sits down.")}),e("button",{type:"button",onClick:y,children:t("Who's at the table")})]}):e($t,{onHandle:u,focus:l,onFocus:b,onSeat:b,onSeatMenu:(o)=>{let m=i.find((w)=>w.name===o.id);if(m)v(m.key,o.at,o.via,o.source)}}),p?e(Xn,{roomKey:p.key,open:R,onBack:()=>b(null),onMenu:(o)=>{let m=o.getBoundingClientRect();v(p.key,{x:m.left,y:m.bottom},"key",o)}},p.key):null]}),T?e(C,{fallback:null,children:e(A,{open:k,onClose:()=>g(!1)})}):null]})}export{_ as TablePage};
@@ -0,0 +1 @@
1
+ import{D,r,t,e,n,rn}from"./chunk-index-v23m38p6.js";import{zn}from"./chunk-index-mjqqver5.js";import{nt}from"./chunk-index-rhtvcbsq.js";import{I}from"./chunk-index-awx6nnta.js";import{Ge}from"./chunk-index-bbsytycb.js";function u({view:s}){let o=D(),[a,m]=r(!1),l=s.muted===!0;return e("li",{children:n("label",{className:"menu-item menu-toggle seat-row",htmlFor:o,children:[e(rn,{view:s,size:40}),n("span",{className:"menu-text",children:[e("strong",{children:s.displayName}),l?e("span",{className:"meta",children:t("Off the table")}):null]}),e(nt,{id:o,checked:!l,label:s.displayName,busy:a,onChange:async(i)=>{m(!0),await Ge(s.key,!i),m(!1)}})]})})}function g(s){let o=zn();return e(I,{open:s.open,title:t("Who's at the table"),onClose:s.onClose,children:n("div",{className:"stack table-seats",children:[e("p",{className:"meta",children:t("An agent who leaves the table is muted: its room stops pushing to you. A card that waits for you is always pushed.")}),e("ul",{className:"menu",children:o.map((a)=>e(u,{view:a},a.key))})]})})}export{g as TableSeatsSheet};
@@ -1 +1 @@
1
- import{tn,Ti,Pi,ft,qt,Ft,Rn}from"./chunk-index-d5abvq7v.js";import{Mt}from"./chunk-index-2ad17eh4.js";var le="http://www.w3.org/2000/svg",t=(d,i={},p)=>{let y=document.createElementNS(le,d);for(let[v,R]of Object.entries(i))y.setAttribute(v,String(R));return p?.appendChild(y),y},ce=(d)=>{let i=/<svg[^>]*\swidth=/.test(d)?d:d.replace("<svg",'<svg width="256" height="256"');return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`},de=0;function fe(d,i){let p=i||d<=6?1:2;return{rows:p,perRow:Math.max(1,Math.ceil(d/p))}}function ye(d,i){let p=`t2d${++de}`,y=window.matchMedia("(prefers-reduced-motion: reduce)"),v=i.reducedMotion==="auto"||i.reducedMotion===void 0?y.matches:i.reducedMotion,R=i.labels??Mt,{theme:O,scheme:I}=i,S=[],_=new Map,L=new Map,E=i.focus??null,M=document.createElement("div");M.className="t2d";let f=t("svg",{role:"group","aria-label":R.table});if(M.appendChild(f),getComputedStyle(d).position==="static")d.style.position="relative";d.appendChild(M);function X(e,s,c){let o=Math.max(1.6,c*0.022),g=o+Math.max(1.2,c*0.014),a=t("filter",{id:`${p}-rim`,x:"-15%",y:"-15%",width:"130%",height:"130%"},e);t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:g,result:"far"},a),t("feFlood",{"flood-color":s.ink,result:"ink"},a),t("feComposite",{in:"ink",in2:"far",operator:"in",result:"line"},a),t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:o,result:"near"},a),t("feFlood",{"flood-color":s.paper,result:"paper"},a),t("feComposite",{in:"paper",in2:"near",operator:"in",result:"rim"},a);let l=t("feMerge",{},a);for(let w of["line","rim","SourceGraphic"])t("feMergeNode",{in:w},l)}function x(){let e=tn(O,I);M.classList.toggle("reduced",v),M.classList.toggle("focus",E!==null),M.classList.toggle("dim",S.some((r)=>L.get(r.id)==="speaking"));let s=i.variant==="compact",c=Math.max(d.clientWidth,200),o=Math.max(d.clientHeight,s?60:200);f.setAttribute("viewBox",`0 0 ${c} ${o}`),f.replaceChildren();let g=Math.max(S.length,1),{rows:a,perRow:l}=fe(g,s);t("rect",{width:c,height:o,fill:e.css.bg},f);let w=t("defs",{},f),T=c/2,N=s?o*0.82:o*0.62;if(t("ellipse",{cx:T,cy:N,rx:c*0.47,ry:s?o*0.2:o*0.34,fill:e.css.floor,stroke:e.ink,"stroke-width":2},f),!s)t("ellipse",{cx:T,cy:N,rx:c*0.3,ry:o*0.2,fill:"none",stroke:e.css.ring,"stroke-width":3,opacity:e.night?0.9:0.7},f);let F=c/l,q=s?o*0.95:o/(a+0.6),m=Math.max(46,Math.min(F*0.94,132,q*1.05)),h=m*0.72,n=m*1.05;X(w,e,n),S.forEach((r,b)=>{let k=t("radialGradient",{id:`${p}-h${b}`},w);t("stop",{offset:0,"stop-color":r.color,"stop-opacity":0.95},k),t("stop",{offset:1,"stop-color":r.color,"stop-opacity":0},k)});let te=(r)=>{if(s)return o*0.92;return a===1?o*0.62:o*(0.46+r*0.3)};if(S.forEach((r,b)=>{let k=Math.floor(b/l),oe=Math.min(l,g-k*l),ne=b-k*l,re=c/oe*(ne+0.5),ie=te(k),H=L.get(r.id)??"idle",u=t("g",{class:"seat","data-seat":r.id,"data-state":H,...E===r.id?{"data-focus":""}:{},transform:`translate(${re.toFixed(1)} ${ie.toFixed(1)})`,tabindex:i.listBelow?-1:0,role:"button","aria-label":R.seat(r.name,H),color:e.css.text,...i.listBelow?{"aria-hidden":"true"}:{}},f);t("ellipse",{cx:0,cy:3,rx:m*0.55,ry:m*0.1,fill:"#000",opacity:0.35},u),t("ellipse",{class:"halo",cx:0,cy:-h-n*0.35,rx:n*0.8,ry:n*0.8,fill:`url(#${p}-h${b})`},u),t("polygon",{class:"beam",points:`${-n*0.12},${-n*2.1} ${n*0.12},${-n*2.1} ${n*0.5},0 ${-n*0.5},0`,fill:r.color,opacity:0.2},u);let B=t("g",{class:"lift"},u),Y=_.get(r.id);if(Y)t("image",{href:ce(Y),x:-n/2,y:-h-n*0.78,width:n,height:n*0.88,filter:`url(#${p}-rim)`,...r.dim?{opacity:0.55}:{}},B);else{t("circle",{cx:0,cy:-h-n*0.3,r:n*0.3,fill:r.color,stroke:e.ink,"stroke-width":2},B);let A=t("text",{x:0,y:-h-n*0.3+n*0.1,"text-anchor":"middle","font-size":n*0.3,"font-weight":700,fill:"#fff","font-family":ft},B);A.textContent=Array.from(r.name)[0]?.toUpperCase()??"?"}let Z=h*0.22;t("path",{d:`M ${-m*0.5} ${-h} L ${m*0.5} ${-h} L ${m*0.42} 0 L ${-m*0.42} 0 Z`,fill:e.wood,stroke:e.ink,"stroke-width":2,"stroke-linejoin":"round"},u),t("rect",{x:-m*0.54,y:-h-Z*0.2,width:m*1.08,height:Z,rx:2,fill:e.woodLight,stroke:e.ink,"stroke-width":2},u);let C=Math.max(11,Math.min(15,m*0.14)),K=Math.min(Math.max(m*0.9,C*5.5+14),Math.max(m*0.9,r.name.length*C*0.62+18),F*0.98),se=C+8;t("rect",{class:"plate",x:-K/2,y:-h*0.78,width:K,height:se,rx:3,fill:e.gold,stroke:e.ink,"stroke-width":2},u);let ae=t("text",{x:0,y:-h*0.78+C+1.5,"text-anchor":"middle","font-size":C,"font-weight":700,"font-family":ft,fill:e.plateInk},u);ae.textContent=Pi(r.name,(K-8)/C);let J=t("g",{class:"badge"},t("g",{transform:`translate(${n*0.4} ${-h-n*0.78})`},u)),V=H==="done",D=H==="error",P=e.gold;if(V)P=Ti.done;else if(D)P=Ti.error;t("circle",{r:n*0.15,fill:P,stroke:e.ink,"stroke-width":2},J);let U=t("text",{x:0,y:n*0.06,"text-anchor":"middle","font-size":n*0.2,"font-weight":800,"font-family":ft,fill:V||D?"#fff":e.ink},J);if(U.textContent="!",V)U.textContent="✓";else if(D)U.textContent="✕";let Q=t("g",{class:"orbit"},u);t("circle",{cx:n*0.4,cy:-h-n*0.5,r:n*0.05,fill:r.color},Q),t("circle",{cx:-n*0.4,cy:-h-n*0.5,r:n*0.035,fill:r.color,opacity:0.6},Q),u.addEventListener("click",()=>i.onSeatClick({id:r.id,name:r.name})),u.addEventListener("keydown",(A)=>{if(A.key==="Enter"||A.key===" ")A.preventDefault(),i.onSeatClick({id:r.id,name:r.name})})}),!s){let r=Math.min(c*0.34,190),b=o-6;t("rect",{x:T-r/2,y:b-22,width:r,height:22,rx:4,fill:e.wood,stroke:e.ink,"stroke-width":2},f);let k=t("text",{x:T,y:b-7,"text-anchor":"middle","font-size":12,"font-weight":700,"font-family":ft,fill:e.gold},f);k.textContent=Pi(i.ownerName??"You",12)}}let G=new Set,ee=(e,s)=>{if(e.mode==="cut")return;let c=tn(O,I),o=(g,a)=>{let l=setTimeout(()=>{G.delete(l),g()},a);G.add(l)};for(let g of e.joining){let a=[...f.querySelectorAll("g.seat[data-seat]")].find((l)=>l.getAttribute("data-seat")===g);if(!a)continue;a.classList.add("seat-in"),a.prepend(t("ellipse",{class:"seat-ring",rx:44,ry:12,cy:4,stroke:c.css.ring})),o(()=>{a.classList.remove("seat-in"),a.querySelector(".seat-ring")?.remove()},Ft)}for(let g of e.leaving){let a=s.get(g);if(!a)continue;let l=a.cloneNode(!0);l.classList.add("seat-out");for(let w of["data-seat","tabindex","role","aria-label"])l.removeAttribute(w);l.setAttribute("aria-hidden","true");for(let[w,[T,N,F]]of[[-26,-24,20],[24,-20,22],[0,-52,24],[-4,-4,26]].entries()){let q=t("circle",{class:"puff",cx:T,cy:N,r:F,fill:c.paper,stroke:c.ink,"stroke-width":3},l);q.style.animationDelay=`${w*40}ms`}f.appendChild(l),o(()=>l.remove(),qt)}},W=new ResizeObserver(x);W.observe(d);let j=()=>{if(i.reducedMotion==="auto"||i.reducedMotion===void 0)z.setReducedMotion(y.matches)};y.addEventListener("change",j);let z={kind:"svg",setTheme(e,s){O=e,I=s,x()},setSeats(e){let s=S.map((o)=>o.id),c=new Map([...f.querySelectorAll("g.seat[data-seat]")].map((o)=>[o.getAttribute("data-seat")??"",o]));S=e;for(let o of e)if(L.set(o.id,o.state??"idle"),o.avatarSvg)_.set(o.id,o.avatarSvg);if(x(),s.length>0||c.size>0)ee(Rn(s,e.map((o)=>o.id),v),c)},setState(e,s){if(L.get(e)===s)return;L.set(e,s),x()},setAvatar(e,s){return _.set(e,s),x(),Promise.resolve()},setReducedMotion(e){v=e,x()},resetCamera(){E=null,x(),i.onFocus?.(null)},focus(e){if(e===E)return;E=e,x()},focused:()=>E,getStats(){return{kind:"svg",fps:0,frameMs:0,frameMsMax:0,drawCalls:0,triangles:0,textures:0,geometries:0,dpr:1,lowPower:!1,reduced:v,loop:"idle",seats:S.length,renders:0}},dispose(){for(let e of G)clearTimeout(e);G.clear(),W.disconnect(),y.removeEventListener("change",j),M.remove()}};return z.setSeats(i.seats),z}export{ye as createTable2D};
1
+ import{fn,Ci,Ai,gt,qt,Bt,Ln}from"./chunk-index-2d0kg096.js";import{At}from"./chunk-index-k2qq1gdj.js";var le="http://www.w3.org/2000/svg",t=(d,i={},p)=>{let y=document.createElementNS(le,d);for(let[v,R]of Object.entries(i))y.setAttribute(v,String(R));return p?.appendChild(y),y},ce=(d)=>{let i=/<svg[^>]*\swidth=/.test(d)?d:d.replace("<svg",'<svg width="256" height="256"');return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`},de=0;function fe(d,i){let p=i||d<=6?1:2;return{rows:p,perRow:Math.max(1,Math.ceil(d/p))}}function ye(d,i){let p=`t2d${++de}`,y=window.matchMedia("(prefers-reduced-motion: reduce)"),v=i.reducedMotion==="auto"||i.reducedMotion===void 0?y.matches:i.reducedMotion,R=i.labels??At,{theme:O,scheme:I}=i,S=[],_=new Map,L=new Map,E=i.focus??null,M=document.createElement("div");M.className="t2d";let f=t("svg",{role:"group","aria-label":R.table});if(M.appendChild(f),getComputedStyle(d).position==="static")d.style.position="relative";d.appendChild(M);function X(e,s,c){let o=Math.max(1.6,c*0.022),g=o+Math.max(1.2,c*0.014),a=t("filter",{id:`${p}-rim`,x:"-15%",y:"-15%",width:"130%",height:"130%"},e);t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:g,result:"far"},a),t("feFlood",{"flood-color":s.ink,result:"ink"},a),t("feComposite",{in:"ink",in2:"far",operator:"in",result:"line"},a),t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:o,result:"near"},a),t("feFlood",{"flood-color":s.paper,result:"paper"},a),t("feComposite",{in:"paper",in2:"near",operator:"in",result:"rim"},a);let l=t("feMerge",{},a);for(let w of["line","rim","SourceGraphic"])t("feMergeNode",{in:w},l)}function x(){let e=fn(O,I);M.classList.toggle("reduced",v),M.classList.toggle("focus",E!==null),M.classList.toggle("dim",S.some((r)=>L.get(r.id)==="speaking"));let s=i.variant==="compact",c=Math.max(d.clientWidth,200),o=Math.max(d.clientHeight,s?60:200);f.setAttribute("viewBox",`0 0 ${c} ${o}`),f.replaceChildren();let g=Math.max(S.length,1),{rows:a,perRow:l}=fe(g,s);t("rect",{width:c,height:o,fill:e.css.bg},f);let w=t("defs",{},f),T=c/2,N=s?o*0.82:o*0.62;if(t("ellipse",{cx:T,cy:N,rx:c*0.47,ry:s?o*0.2:o*0.34,fill:e.css.floor,stroke:e.ink,"stroke-width":2},f),!s)t("ellipse",{cx:T,cy:N,rx:c*0.3,ry:o*0.2,fill:"none",stroke:e.css.ring,"stroke-width":3,opacity:e.night?0.9:0.7},f);let F=c/l,q=s?o*0.95:o/(a+0.6),m=Math.max(46,Math.min(F*0.94,132,q*1.05)),h=m*0.72,n=m*1.05;X(w,e,n),S.forEach((r,b)=>{let k=t("radialGradient",{id:`${p}-h${b}`},w);t("stop",{offset:0,"stop-color":r.color,"stop-opacity":0.95},k),t("stop",{offset:1,"stop-color":r.color,"stop-opacity":0},k)});let te=(r)=>{if(s)return o*0.92;return a===1?o*0.62:o*(0.46+r*0.3)};if(S.forEach((r,b)=>{let k=Math.floor(b/l),oe=Math.min(l,g-k*l),ne=b-k*l,re=c/oe*(ne+0.5),ie=te(k),H=L.get(r.id)??"idle",u=t("g",{class:"seat","data-seat":r.id,"data-state":H,...E===r.id?{"data-focus":""}:{},transform:`translate(${re.toFixed(1)} ${ie.toFixed(1)})`,tabindex:i.listBelow?-1:0,role:"button","aria-label":R.seat(r.name,H),color:e.css.text,...i.listBelow?{"aria-hidden":"true"}:{}},f);t("ellipse",{cx:0,cy:3,rx:m*0.55,ry:m*0.1,fill:"#000",opacity:0.35},u),t("ellipse",{class:"halo",cx:0,cy:-h-n*0.35,rx:n*0.8,ry:n*0.8,fill:`url(#${p}-h${b})`},u),t("polygon",{class:"beam",points:`${-n*0.12},${-n*2.1} ${n*0.12},${-n*2.1} ${n*0.5},0 ${-n*0.5},0`,fill:r.color,opacity:0.2},u);let B=t("g",{class:"lift"},u),Y=_.get(r.id);if(Y)t("image",{href:ce(Y),x:-n/2,y:-h-n*0.78,width:n,height:n*0.88,filter:`url(#${p}-rim)`,...r.dim?{opacity:0.55}:{}},B);else{t("circle",{cx:0,cy:-h-n*0.3,r:n*0.3,fill:r.color,stroke:e.ink,"stroke-width":2},B);let A=t("text",{x:0,y:-h-n*0.3+n*0.1,"text-anchor":"middle","font-size":n*0.3,"font-weight":700,fill:"#fff","font-family":gt},B);A.textContent=Array.from(r.name)[0]?.toUpperCase()??"?"}let Z=h*0.22;t("path",{d:`M ${-m*0.5} ${-h} L ${m*0.5} ${-h} L ${m*0.42} 0 L ${-m*0.42} 0 Z`,fill:e.wood,stroke:e.ink,"stroke-width":2,"stroke-linejoin":"round"},u),t("rect",{x:-m*0.54,y:-h-Z*0.2,width:m*1.08,height:Z,rx:2,fill:e.woodLight,stroke:e.ink,"stroke-width":2},u);let C=Math.max(11,Math.min(15,m*0.14)),K=Math.min(Math.max(m*0.9,C*5.5+14),Math.max(m*0.9,r.name.length*C*0.62+18),F*0.98),se=C+8;t("rect",{class:"plate",x:-K/2,y:-h*0.78,width:K,height:se,rx:3,fill:e.gold,stroke:e.ink,"stroke-width":2},u);let ae=t("text",{x:0,y:-h*0.78+C+1.5,"text-anchor":"middle","font-size":C,"font-weight":700,"font-family":gt,fill:e.plateInk},u);ae.textContent=Ai(r.name,(K-8)/C);let J=t("g",{class:"badge"},t("g",{transform:`translate(${n*0.4} ${-h-n*0.78})`},u)),V=H==="done",D=H==="error",P=e.gold;if(V)P=Ci.done;else if(D)P=Ci.error;t("circle",{r:n*0.15,fill:P,stroke:e.ink,"stroke-width":2},J);let U=t("text",{x:0,y:n*0.06,"text-anchor":"middle","font-size":n*0.2,"font-weight":800,"font-family":gt,fill:V||D?"#fff":e.ink},J);if(U.textContent="!",V)U.textContent="✓";else if(D)U.textContent="✕";let Q=t("g",{class:"orbit"},u);t("circle",{cx:n*0.4,cy:-h-n*0.5,r:n*0.05,fill:r.color},Q),t("circle",{cx:-n*0.4,cy:-h-n*0.5,r:n*0.035,fill:r.color,opacity:0.6},Q),u.addEventListener("click",()=>i.onSeatClick({id:r.id,name:r.name})),u.addEventListener("keydown",(A)=>{if(A.key==="Enter"||A.key===" ")A.preventDefault(),i.onSeatClick({id:r.id,name:r.name})})}),!s){let r=Math.min(c*0.34,190),b=o-6;t("rect",{x:T-r/2,y:b-22,width:r,height:22,rx:4,fill:e.wood,stroke:e.ink,"stroke-width":2},f);let k=t("text",{x:T,y:b-7,"text-anchor":"middle","font-size":12,"font-weight":700,"font-family":gt,fill:e.gold},f);k.textContent=Ai(i.ownerName??"You",12)}}let G=new Set,ee=(e,s)=>{if(e.mode==="cut")return;let c=fn(O,I),o=(g,a)=>{let l=setTimeout(()=>{G.delete(l),g()},a);G.add(l)};for(let g of e.joining){let a=[...f.querySelectorAll("g.seat[data-seat]")].find((l)=>l.getAttribute("data-seat")===g);if(!a)continue;a.classList.add("seat-in"),a.prepend(t("ellipse",{class:"seat-ring",rx:44,ry:12,cy:4,stroke:c.css.ring})),o(()=>{a.classList.remove("seat-in"),a.querySelector(".seat-ring")?.remove()},Bt)}for(let g of e.leaving){let a=s.get(g);if(!a)continue;let l=a.cloneNode(!0);l.classList.add("seat-out");for(let w of["data-seat","tabindex","role","aria-label"])l.removeAttribute(w);l.setAttribute("aria-hidden","true");for(let[w,[T,N,F]]of[[-26,-24,20],[24,-20,22],[0,-52,24],[-4,-4,26]].entries()){let q=t("circle",{class:"puff",cx:T,cy:N,r:F,fill:c.paper,stroke:c.ink,"stroke-width":3},l);q.style.animationDelay=`${w*40}ms`}f.appendChild(l),o(()=>l.remove(),qt)}},W=new ResizeObserver(x);W.observe(d);let j=()=>{if(i.reducedMotion==="auto"||i.reducedMotion===void 0)z.setReducedMotion(y.matches)};y.addEventListener("change",j);let z={kind:"svg",setTheme(e,s){O=e,I=s,x()},setSeats(e){let s=S.map((o)=>o.id),c=new Map([...f.querySelectorAll("g.seat[data-seat]")].map((o)=>[o.getAttribute("data-seat")??"",o]));S=e;for(let o of e)if(L.set(o.id,o.state??"idle"),o.avatarSvg)_.set(o.id,o.avatarSvg);if(x(),s.length>0||c.size>0)ee(Ln(s,e.map((o)=>o.id),v),c)},setState(e,s){if(L.get(e)===s)return;L.set(e,s),x()},setAvatar(e,s){return _.set(e,s),x(),Promise.resolve()},setReducedMotion(e){v=e,x()},resetCamera(){E=null,x(),i.onFocus?.(null)},focus(e){if(e===E)return;E=e,x()},focused:()=>E,getStats(){return{kind:"svg",fps:0,frameMs:0,frameMsMax:0,drawCalls:0,triangles:0,textures:0,geometries:0,dpr:1,lowPower:!1,reduced:v,loop:"idle",seats:S.length,renders:0}},dispose(){for(let e of G)clearTimeout(e);G.clear(),W.disconnect(),y.removeEventListener("change",j),M.remove()}};return z.setSeats(i.seats),z}export{ye as createTable2D};