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.
- package/CHANGELOG.md +16 -0
- package/README.md +3 -3
- package/dist/chunk-account-51nmc9g6.js +1 -0
- package/dist/{chunk-action-menu-37zgbhje.js → chunk-action-menu-mxcvx4a1.js} +1 -1
- package/dist/chunk-agent-x53f7c2h.js +1 -0
- package/dist/chunk-arranged-rooms-1w3zqdtt.js +1 -0
- package/dist/{chunk-attachments-3vbj05g5.js → chunk-attachments-qbv5ar62.js} +2 -2
- package/dist/chunk-bulk-actions-aktwxqc9.js +1 -0
- package/dist/{chunk-character-creator-bg3tdc8p.js → chunk-character-creator-1mfybhjz.js} +2 -2
- package/dist/{chunk-codeeditor-102wa9bj.js → chunk-codeeditor-y2emmmr0.js} +2 -2
- package/dist/chunk-command-menu-sj2kfe4d.js +59 -0
- package/dist/chunk-confirm-ex5kc1st.js +1 -0
- package/dist/{chunk-connectors-0jzzren3.js → chunk-connectors-1nmm8yc3.js} +2 -2
- package/dist/{chunk-conversations-3276jq4q.js → chunk-conversations-ec3aqjxs.js} +1 -1
- package/dist/chunk-council-sheet-hdsg3fes.js +2 -0
- package/dist/chunk-council-view-sba8fs4c.js +1 -0
- package/dist/{chunk-drag-sw692nr3.js → chunk-drag-pkghf4ts.js} +1 -1
- package/dist/{chunk-entry-mb6jd983.js → chunk-entry-e24gjxtd.js} +1 -1
- package/dist/{chunk-folder-list-g7st6p1e.js → chunk-folder-list-kghgyc0x.js} +1 -1
- package/dist/chunk-folds-crd9k375.js +1 -0
- package/dist/chunk-gate-xay9vedw.js +1 -0
- package/dist/chunk-host-icons-y9hd1qqd.js +1 -0
- package/dist/chunk-host-picture-k16n5wm3.js +1 -0
- package/dist/chunk-host-state-1mbsrmhk.js +1 -0
- package/dist/chunk-host-ui-4pymhn6v.js +1 -0
- package/dist/{chunk-index-e8535c4h.js → chunk-index-0dyf2gdm.js} +2 -2
- package/dist/chunk-index-14cxgacv.js +2 -0
- package/dist/{chunk-index-edjyj761.js → chunk-index-37g8ggry.js} +1 -1
- package/dist/chunk-index-39gw0qhr.js +2 -0
- package/dist/chunk-index-4p45h04z.js +2 -0
- package/dist/chunk-index-5e8wn6r3.js +2 -0
- package/dist/chunk-index-65p4hfkr.js +2 -0
- package/dist/{chunk-index-6yfcfcc8.js → chunk-index-6e9nmad3.js} +1 -1
- package/dist/chunk-index-6f4qvp5p.js +2 -0
- package/dist/{chunk-index-yn1vvxj2.js → chunk-index-6hy2fabj.js} +1 -1
- package/dist/{chunk-index-0qzqzp6t.js → chunk-index-6j75embz.js} +2 -2
- package/dist/{chunk-index-1tkzdy4s.js → chunk-index-70pq2k7q.js} +2 -2
- package/dist/{chunk-index-7gk2sdf4.js → chunk-index-726w3145.js} +3 -3
- package/dist/chunk-index-86x6b7dx.js +3 -0
- package/dist/chunk-index-8cxmgzhy.js +2 -0
- package/dist/{chunk-index-gmbk3sra.js → chunk-index-93dr9fh8.js} +1 -1
- package/dist/chunk-index-97238pp8.js +2 -0
- package/dist/{chunk-index-7p31pda8.js → chunk-index-ads1abh1.js} +3 -3
- package/dist/{chunk-index-jrj09r5c.js → chunk-index-awc03q99.js} +2 -2
- package/dist/chunk-index-bh6m0bpm.js +2 -0
- package/dist/chunk-index-br1wechm.js +2 -0
- package/dist/{chunk-index-qedt9szy.js → chunk-index-c8vsw9h8.js} +2 -2
- package/dist/{chunk-index-mey1p7h8.js → chunk-index-cd0ymvtj.js} +2 -2
- package/dist/{chunk-index-50w6yq2d.js → chunk-index-e3encn5p.js} +1 -1
- package/dist/{chunk-index-d941ae7c.js → chunk-index-fw6kawhw.js} +2 -2
- package/dist/{chunk-index-6ycrvwzs.js → chunk-index-g3f1sdw0.js} +2 -2
- package/dist/{chunk-index-6cs1wvhy.js → chunk-index-gae833v6.js} +1 -1
- package/dist/{chunk-index-m8bv51r9.js → chunk-index-gc30hm37.js} +2 -2
- package/dist/{chunk-index-5fyqxh0r.js → chunk-index-gpaychmm.js} +2 -2
- package/dist/chunk-index-hk6aq03d.js +2 -0
- package/dist/chunk-index-k3hj2310.js +2 -0
- package/dist/chunk-index-maf6wr1b.js +2 -0
- package/dist/{chunk-index-eyythjdx.js → chunk-index-mhb8mpg3.js} +2 -2
- package/dist/chunk-index-n92zea3s.js +2 -0
- package/dist/{chunk-index-m7wzrmcd.js → chunk-index-ndhwytvz.js} +2 -2
- package/dist/{chunk-index-qk7rp7fk.js → chunk-index-ne8v2rxx.js} +12 -12
- package/dist/chunk-index-p4rc9swx.js +2 -0
- package/dist/chunk-index-pce4byw4.js +2 -0
- package/dist/{chunk-index-6nja2vd8.js → chunk-index-ptvrkv0r.js} +2 -2
- package/dist/{chunk-index-mzw7nmkc.js → chunk-index-pz6926p5.js} +2 -2
- package/dist/chunk-index-qb41kkt3.js +2 -0
- package/dist/{chunk-index-5x3h176v.js → chunk-index-qqaaxh63.js} +2 -2
- package/dist/chunk-index-qwztcbjz.js +2 -0
- package/dist/chunk-index-r1g24er0.js +2 -0
- package/dist/chunk-index-rvatmx8s.js +50 -0
- package/dist/{chunk-index-qq86fxda.js → chunk-index-tfgd7vr5.js} +2 -2
- package/dist/{chunk-index-qw9a7ken.js → chunk-index-tqrjr37v.js} +2 -2
- package/dist/chunk-index-tvsvtd4q.js +2 -0
- package/dist/chunk-index-vaxytvde.js +2 -0
- package/dist/{chunk-index-n2v2bz8d.js → chunk-index-ve07gdef.js} +1 -1
- package/dist/chunk-index-vw592m3p.js +2 -0
- package/dist/{chunk-index-y1xv3dxs.js → chunk-index-vwd5drzh.js} +4 -4
- package/dist/{chunk-index-0t68az7d.js → chunk-index-vxn4zws9.js} +3 -3
- package/dist/{chunk-index-6m25qpa7.js → chunk-index-wqbcade7.js} +2 -2
- package/dist/chunk-index-x7p6k52w.js +138 -0
- package/dist/{chunk-index-syxwqhry.js → chunk-index-xekytvrr.js} +1 -1
- package/dist/{chunk-index-6q3dx093.js → chunk-index-xkb336kq.js} +2 -2
- package/dist/{chunk-index-sk8cvb4e.js → chunk-index-xv3e4x0j.js} +2 -2
- package/dist/{chunk-index-50syrmaq.js → chunk-index-xvdna54d.js} +2 -2
- package/dist/chunk-index-yzd9cg0s.js +1 -0
- package/dist/{chunk-index-tasbd41t.js → chunk-index-zr2qwzz4.js} +2 -2
- package/dist/chunk-lang-css-6t2q4xw4.js +1 -0
- package/dist/{chunk-lang-dockerfile-e87ssppx.js → chunk-lang-dockerfile-9rc0adjw.js} +1 -1
- package/dist/{chunk-lang-go-kbcbn346.js → chunk-lang-go-t47kg9n0.js} +2 -2
- package/dist/chunk-lang-html-c6p22v5m.js +1 -0
- package/dist/chunk-lang-javascript-m57t19pw.js +1 -0
- package/dist/{chunk-lang-json-4pe1fv7e.js → chunk-lang-json-y33kawwg.js} +1 -1
- package/dist/{chunk-lang-markdown-67cm3tjx.js → chunk-lang-markdown-2c2sqc4z.js} +4 -4
- package/dist/{chunk-lang-python-mnfhcvww.js → chunk-lang-python-ymasvj52.js} +2 -2
- package/dist/{chunk-lang-rust-e4a9s76x.js → chunk-lang-rust-qcg53mkn.js} +1 -1
- package/dist/{chunk-lang-shell-43nea8tq.js → chunk-lang-shell-996wb0dk.js} +1 -1
- package/dist/{chunk-lang-sql-28364npv.js → chunk-lang-sql-60rh2y3y.js} +2 -2
- package/dist/{chunk-lang-toml-a83hr7bw.js → chunk-lang-toml-q1yzt70y.js} +1 -1
- package/dist/chunk-lang-typescript-7gcbrhbd.js +1 -0
- package/dist/{chunk-lang-xml-2hv5xc8n.js → chunk-lang-xml-k2a92cm3.js} +1 -1
- package/dist/{chunk-lang-yaml-vw22drt8.js → chunk-lang-yaml-qp3asq06.js} +1 -1
- package/dist/chunk-layout-actions-yxh77zcz.js +1 -0
- package/dist/chunk-mention-menu-qpksygcf.js +43 -0
- package/dist/chunk-menu-items-95evdhk1.js +1 -0
- package/dist/chunk-mode-toggle-dqwvcr2p.js +1 -0
- package/dist/{chunk-note-row-c0trzayj.js → chunk-note-row-ngzxbdn6.js} +4 -4
- package/dist/chunk-notes-9ykcajzc.js +1 -0
- package/dist/chunk-notice-bell-eryn2k5m.js +1 -0
- package/dist/{chunk-notices-gkaqncqz.js → chunk-notices-jkv1derx.js} +1 -1
- package/dist/{chunk-onboarding-fkq9ptcw.js → chunk-onboarding-ka11bgd0.js} +1 -1
- package/dist/{chunk-overview-yssxbg0d.js → chunk-overview-dgvrjwbc.js} +1 -1
- package/dist/{chunk-palette-w6qbr7zp.js → chunk-palette-wmvynt7n.js} +1 -1
- package/dist/chunk-placement-items-zyqq2mp7.js +1 -0
- package/dist/{chunk-profile-9sjgayrx.js → chunk-profile-sdn7bs08.js} +1 -1
- package/dist/chunk-prompt-history-qfnj4w2y.js +1 -0
- package/dist/chunk-prompts-4hdcvy6t.js +1 -0
- package/dist/chunk-room-confirms-b8gvak47.js +1 -0
- package/dist/chunk-room-menu-18mnqcja.js +1 -0
- package/dist/chunk-rooms-menu-button-hjg4zqjy.js +1 -0
- package/dist/{chunk-schedules-m9mn68gt.js → chunk-schedules-cy2dv8x0.js} +1 -1
- package/dist/{chunk-seat-menu-3tdcr44t.js → chunk-seat-menu-cw3z9560.js} +1 -1
- package/dist/chunk-section-fold-9tc2m103.js +1 -0
- package/dist/{chunk-settings-18qmhcyr.js → chunk-settings-rhdv64p7.js} +1 -1
- package/dist/chunk-sheet-hosts-hhs1e3a8.js +29 -0
- package/dist/chunk-shortcut-help-fv6b6ntc.js +26 -0
- package/dist/{chunk-shortcuts-qee393s5.js → chunk-shortcuts-sjwrv858.js} +1 -1
- package/dist/{chunk-skill-editor-pryntvpr.js → chunk-skill-editor-zzmv9nfq.js} +2 -2
- package/dist/chunk-skills-b2enxk30.js +1 -0
- package/dist/{chunk-start-over-line-azexcxj1.js → chunk-start-over-line-4rwasr8k.js} +2 -2
- package/dist/{chunk-switcher-list-6hacxjfe.js → chunk-switcher-list-dcq91xxa.js} +1 -1
- package/dist/{chunk-tab-dot-h0eskhrt.js → chunk-tab-dot-b3gcgcrq.js} +1 -1
- package/dist/chunk-table-6j64ps89.js +1 -0
- package/dist/{chunk-table2d-vy4w4r5k.js → chunk-table2d-k4z439nt.js} +1 -1
- package/dist/{chunk-table3d-0a62jerb.js → chunk-table3d-mx0afnv8.js} +23 -23
- package/dist/chunk-thread-actions-rs5xpf1r.js +1 -0
- package/dist/{chunk-thread-cards-mwxzy02t.js → chunk-thread-cards-k9m7p5fn.js} +1 -1
- package/dist/{chunk-thread-list-52mx2m9p.js → chunk-thread-list-zz7596zy.js} +2 -2
- package/dist/chunk-transcript-8yjp18cr.js +1 -0
- package/dist/chunk-waiting-9gshhhx0.js +1 -0
- package/dist/{chunk-waiting-chip-wvkbsnw5.js → chunk-waiting-chip-nr9cza2j.js} +2 -2
- package/dist/chunk-where-8mq8azgw.js +1 -0
- package/dist/{chunk-workspace-ne2nkf4h.js → chunk-workspace-hdamnf4r.js} +2 -2
- package/dist/chunk-zh-tw-ama40y87.js +1 -0
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +3 -3
- package/src/api-types.ts +17 -0
- package/src/app/app.ts +3 -0
- package/src/app/command-routes.ts +45 -0
- package/src/app/routes.ts +13 -0
- package/src/i18n/zh-tw.ts +8 -1
- package/src/web-plugin.ts +2 -0
- package/dist/chunk-account-dq0nhfvj.js +0 -1
- package/dist/chunk-agent-yqe6reej.js +0 -1
- package/dist/chunk-arranged-rooms-sx6xg9df.js +0 -1
- package/dist/chunk-bulk-actions-6pehrsgb.js +0 -1
- package/dist/chunk-confirm-ghxga720.js +0 -1
- package/dist/chunk-council-sheet-7m884s44.js +0 -2
- package/dist/chunk-council-view-rkzcxeg8.js +0 -1
- package/dist/chunk-folds-rb1b069h.js +0 -1
- package/dist/chunk-gate-3rxxyfev.js +0 -1
- package/dist/chunk-host-icons-cyj62pwp.js +0 -1
- package/dist/chunk-host-picture-9wnhqckv.js +0 -1
- package/dist/chunk-host-state-b858k3p8.js +0 -1
- package/dist/chunk-host-ui-j6wvj0pe.js +0 -1
- package/dist/chunk-index-2s48qyrs.js +0 -2
- package/dist/chunk-index-33cqx9v2.js +0 -2
- package/dist/chunk-index-36m3knsk.js +0 -2
- package/dist/chunk-index-91wnf1k9.js +0 -1
- package/dist/chunk-index-9ehqccfe.js +0 -2
- package/dist/chunk-index-ar1x9fhw.js +0 -2
- package/dist/chunk-index-axw4wkqq.js +0 -2
- package/dist/chunk-index-b5patef1.js +0 -2
- package/dist/chunk-index-dagc92hw.js +0 -2
- package/dist/chunk-index-ddssgba9.js +0 -2
- package/dist/chunk-index-dpgn7kzp.js +0 -2
- package/dist/chunk-index-eez0kbk4.js +0 -2
- package/dist/chunk-index-ekp5mmvp.js +0 -2
- package/dist/chunk-index-fdg2qd3f.js +0 -2
- package/dist/chunk-index-g0sdxjxr.js +0 -2
- package/dist/chunk-index-hsc9yz2x.js +0 -2
- package/dist/chunk-index-kvztbfqj.js +0 -2
- package/dist/chunk-index-nncy9wxw.js +0 -2
- package/dist/chunk-index-p2e7rwac.js +0 -2
- package/dist/chunk-index-p98tt12y.js +0 -2
- package/dist/chunk-index-qdtmetsy.js +0 -120
- package/dist/chunk-index-s356ybxk.js +0 -50
- package/dist/chunk-index-vxqzavgz.js +0 -2
- package/dist/chunk-index-x5xq9g9a.js +0 -3
- package/dist/chunk-index-xx0kecz9.js +0 -2
- package/dist/chunk-lang-css-rwkzd784.js +0 -1
- package/dist/chunk-lang-html-zhngbs9v.js +0 -1
- package/dist/chunk-lang-javascript-bk2s6a56.js +0 -1
- package/dist/chunk-lang-typescript-r5npc6zf.js +0 -1
- package/dist/chunk-layout-actions-rw5myg2t.js +0 -1
- package/dist/chunk-menu-items-q0hy5kzd.js +0 -1
- package/dist/chunk-mode-toggle-yk2t0tcy.js +0 -1
- package/dist/chunk-notes-0xcmm938.js +0 -1
- package/dist/chunk-notice-bell-f9nhxg71.js +0 -1
- package/dist/chunk-placement-items-wcwy91mp.js +0 -1
- package/dist/chunk-prompt-history-kn42sf8y.js +0 -1
- package/dist/chunk-prompts-824fwgvh.js +0 -1
- package/dist/chunk-room-confirms-hvs9tra4.js +0 -1
- package/dist/chunk-room-menu-pkd0487m.js +0 -1
- package/dist/chunk-rooms-menu-button-w5hfhsfv.js +0 -1
- package/dist/chunk-section-fold-g0tx68cj.js +0 -1
- package/dist/chunk-sheet-hosts-tsppnmvv.js +0 -29
- package/dist/chunk-shortcut-help-wnm0cm8n.js +0 -26
- package/dist/chunk-skills-sap3rysr.js +0 -1
- package/dist/chunk-table-jtn49c2m.js +0 -1
- package/dist/chunk-thread-actions-31scmndt.js +0 -1
- package/dist/chunk-transcript-p5q2m795.js +0 -1
- package/dist/chunk-waiting-s7nm3q0p.js +0 -1
- package/dist/chunk-where-j99f8pb8.js +0 -1
- package/dist/chunk-zh-tw-vm5d0w6j.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E,
|
|
1
|
+
import{E,o,a,r,t,c,g,e,n,s,y,l,S,m,Q}from"./chunk-index-rvatmx8s.js";import{D}from"./chunk-index-gae833v6.js";import"./chunk-index-0q15ysrb.js";import{Si}from"./chunk-index-br1wechm.js";import"./chunk-index-qqaaxh63.js";import"./chunk-index-0dyf2gdm.js";import{pe}from"./chunk-index-37g8ggry.js";var T=3000;function B({profile:i}){return n("div",{className:"who",children:[i.picture?e("img",{className:"who-picture",src:`api/people/${encodeURIComponent(i.principal)}/picture`,alt:""}):e("span",{className:"who-initial","aria-hidden":"true",children:Array.from(i.name)[0]??"?"}),n("div",{className:"stack",children:[e("strong",{children:i.name}),i.tier?n("span",{className:"meta",children:[e(s,{name:"shield",size:14})," ",t(F[i.tier])]}):null]})]})}function R({link:i,labels:C,changed:u}){let[d,p]=r(),[f,k]=r(!1),[L,P]=r(),[b,w]=r(!1),N=i.pending!==void 0||d!==void 0,q=a(void 0);o(()=>{if(!N||i.linked)return;return q.current=setInterval(()=>{pe.links().then((v)=>{let I=v.links.find((A)=>A.provider===i.provider);if(I)u(I)},()=>{return})},T),()=>clearInterval(q.current)},[N,i.linked,i.provider,u]);let V=async(v)=>{k(!0),P(void 0);try{await v()}catch(I){P(l(I))}finally{k(!1)}},h=i.blockedBy.length>0;return n("li",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:i.label}),i.linked?n("span",{className:"meta",children:[e(s,{name:"check",size:14})," ",t("Linked"),i.linked.displayName?` · ${i.linked.displayName}`:""]}):i.step==="required"?e(Q,{tone:"warn",children:t("Required")}):i.step==="nudge"?e(Q,{children:t("Recommended")}):null]}),L?e(m,{message:L}):null,i.linked?i.linked.locked?e("p",{className:"meta",children:t("The server's configuration links this account.")}):n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:f,onClick:()=>w(!0),children:t("Unlink")}),e(D,{open:b,title:t("Unlink {name}?",{name:i.label}),confirmLabel:t("Unlink"),tone:"danger",onClose:()=>w(!1),onConfirm:async()=>{u(await pe.unlink(i.provider)),p(void 0)},children:e("p",{children:t("The app will no longer know this account is yours. You can link it again later.")})})]}):N?n("div",{className:"stack",children:[d?n(g,{children:[e("p",{children:d.instructions}),e("p",{className:"meta",children:t("Your code")}),e("code",{className:"link-code",children:d.code}),e("p",{className:"meta",children:t("The code works until {time}.",{time:new Date(d.expiresAt).toLocaleTimeString()})})]}):e("p",{className:"meta",children:t("A code is waiting to be used.")}),i.pending?.redeemedBy?n("p",{children:[e(s,{name:"check",size:14})," ",t("{name} used the code. Confirm that this is you.",{name:i.pending.redeemedBy.displayName})]}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:f,onClick:()=>V(async()=>{u(await pe.cancelLink(i.provider)),p(void 0)}),children:t("Cancel")}),e("button",{type:"button",disabled:f,onClick:()=>V(async()=>{let v=d?.request??i.pending?.request;if(!v)return;u(await pe.confirmLink(i.provider,v)),p(void 0)}),children:t("I did it")})]})]}):n("div",{className:"stack",children:[h?e("p",{className:"meta",children:t("Link {name} first.",{name:i.blockedBy.map((v)=>C[v]??v).join(", ")})}):null,e("div",{className:"actions",children:e("button",{type:"button",disabled:f||h,onClick:()=>V(async()=>{p(await pe.issueLink(i.provider)),u((await pe.links()).links.find((v)=>v.provider===i.provider)??i)}),children:t("Link")})})]})]})}function O(){let i=Intl.DateTimeFormat().resolvedOptions().timeZone,[C,u]=r(),[d,p]=r({start:"22:00",end:"07:00"}),[f,k]=r(!1),[L,P]=r(!1),[b,w]=r(),[N,q]=r();o(()=>{pe.pushPrefs().then((h)=>{if(u(h.quiet),h.quiet)p(h.quiet);k(!0)},()=>k(!0))},[]);let V=async(h)=>{P(!0),q(void 0),w(void 0);try{await h()}catch(v){q(l(v))}finally{P(!1)}};if(!f)return null;return n("section",{className:"card stack",children:[e("h2",{children:t("Notifications")}),e("p",{className:"meta",children:t("In your quiet hours a normal notice waits in the bell instead of ringing your phone. An urgent one still rings.")}),n("div",{className:"quiet-row",children:[n("label",{children:[t("From")," ",e("input",{type:"time",value:d.start,onChange:(h)=>p({...d,start:h.target.value})})]}),n("label",{children:[t("To")," ",e("input",{type:"time",value:d.end,onChange:(h)=>p({...d,end:h.target.value})})]}),e("span",{className:"meta",children:i})]}),N?e(m,{message:N}):null,b?e("p",{className:"meta",children:b}):null,n("div",{className:"actions",children:[C?e("button",{type:"button",className:"secondary",disabled:L,onClick:()=>V(async()=>{await pe.setPushPrefs(null),u(void 0)}),children:t("Turn off quiet hours")}):null,e("button",{type:"button",className:"secondary",disabled:L,onClick:()=>V(async()=>{await pe.pushTest(),w(t("A test notification is on its way."))}),children:t("Send a test notification")}),e("button",{type:"button",disabled:L||d.start===d.end,onClick:()=>V(async()=>{let h=await pe.setPushPrefs({...d,timeZone:i});u(h.quiet)}),children:t("Save")})]})]})}function z({profile:i,changed:C}){let[u,d]=r();if(i.sources.length===0)return null;let p=async(f)=>{d(void 0);try{C(await pe.chooseSource(f))}catch(k){d(l(k))}};return n("section",{className:"card stack",children:[e("h2",{children:t("Shown as")}),e("p",{className:"meta",children:t("The name and picture of this account are what others see in the app.")}),n("fieldset",{className:"choice",children:[e("legend",{className:"visually-hidden",children:t("Shown as")}),n("label",{children:[e("input",{type:"radio",name:"shown-as",checked:i.source===void 0,onChange:()=>p(null)}),t("Automatic")]}),i.sources.map((f)=>n("label",{children:[e("input",{type:"radio",name:"shown-as",checked:i.source===f.provider,onChange:()=>p(f.provider)}),t(f.label)]},f.provider))]}),u?e(m,{message:u}):null]})}function H(){let[i,C]=r(),[u,d]=r(),[p,f]=r(),[k,L]=r();o(()=>{y.session().then(C,(b)=>L(l(b))),pe.profile().then(d,()=>{return}),pe.links().then(f,()=>{return})},[]);let P=E((b)=>{f((w)=>w?{links:w.links.map((N)=>N.provider===b.provider?b:N)}:w),pe.profile().then(d,()=>{return})},[]);if(k)return e(m,{message:k});if(!i)return e(S,{});return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Profile")})}),n("section",{className:"card stack",children:[e("h2",{children:t("Account")}),u?e(B,{profile:u}):e("p",{className:"meta",children:t("Signed in as {name}.",{name:i.principal.name})}),e(Si,{auth:i.auth})]}),p&&p.links.length>0?n("section",{className:"stack",children:[e("h2",{children:t("Your accounts")}),e("ul",{className:"stack notices",children:p.links.map((b)=>e(R,{link:b,labels:Object.fromEntries(p.links.map((w)=>[w.provider,w.label])),changed:P},b.provider))})]}):null,u?e(z,{profile:u,changed:d}):null,i.push?e(O,{}):null]})}var F={owner:c("Owner"),admin:c("Admin"),member:c("Member")};export{H as ProfilePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o,r,t,e,n,l,S,m,k,Q,_,oe}from"./chunk-index-rvatmx8s.js";import{yt}from"./chunk-index-cd0ymvtj.js";import{A}from"./chunk-index-0dyf2gdm.js";function T(a){let{open:c,load:v}=a,{timeZone:y}=_(),[i,p]=r(),[d,g]=r(),[h,b]=r();o(()=>{if(!c)return;let s=!0;return p(void 0),g(void 0),b(void 0),v().then((f)=>s&&p(f),(f)=>s&&g(l(f))),()=>{s=!1}},[c]);let u=i?.find((s)=>s.id===h);return e(A,{open:c,title:a.title,size:"wide",onClose:a.onClose,children:n("div",{className:"stack history",children:[d?e(m,{message:d}):null,!i&&!d?e(S,{}):null,i?.length===0?e(k,{children:t("No changes have been kept yet.")}):null,i&&i.length>0?e("ul",{className:"menu",children:i.map((s)=>e("li",{children:n("button",{type:"button",className:"menu-item","aria-pressed":s.id===h,onClick:()=>b(s.id),children:[n("span",{className:"menu-text",children:[e("strong",{children:s.by}),e("span",{className:"meta",children:oe(s.at,y)})]}),s.revert?e(Q,{children:t("Back to the file version")}):null]})},s.id))}):null,u?n("section",{className:"stack","aria-label":t("This change"),children:[e(yt,{label:t("This change"),before:u.previous,after:u.text}),e("p",{className:"meta",children:t("It goes into the editor, where you read it over and save it to put it in force.")}),e("div",{className:"actions",children:e("button",{type:"button",onClick:()=>a.onUse(u.text),children:t("Use this text")})})]}):null]})})}export{T as HistorySheet};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p,T,b,E,o,R,r,t,c,g,e,n,s,fe,l,f,S,m,k,Q,_,oe}from"./chunk-index-rvatmx8s.js";import{de}from"./chunk-index-93dr9fh8.js";import{yt}from"./chunk-index-cd0ymvtj.js";import{A}from"./chunk-index-0dyf2gdm.js";var M={"Shared prompt":c("Shared prompt"),"Guest prompt":c("Guest prompt"),"The base every knight's prompt starts with, the main knight's included.":c("The base every knight's prompt starts with, the main knight's included."),"Used instead of the shared prompt when the person speaking is not the owner.":c("Used instead of the shared prompt when the person speaking is not the owner.")},C=(d)=>t(M[d]??d);var O=b(()=>(p("qfnj4w2y"),import("./chunk-prompt-history-qfnj4w2y.js")).then((d)=>({default:d.HistorySheet}))),Z=b(()=>(p("ex5kc1st"),import("./chunk-confirm-ex5kc1st.js")).then((d)=>({default:d.Confirm})));function pe(){let{timeZone:d}=_(),[N,i]=r(),[h,w]=r(),[v,x]=r(),P=E(()=>{de.prompts().then((u)=>i(u.documents),(u)=>w(l(u)))},[]);return o(P,[P]),n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Main prompts")})}),e("p",{className:"hint",children:t("The texts the main knight and the other knights start from. A text you save here replaces the one from the file from the next turn on, until you go back to the file's.")}),h?e(m,{message:h}):null,!N&&!h?e(S,{}):null,N?.length===0?e(k,{children:t("No prompts to edit.")}):null,N?.map((u)=>n("article",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:C(u.label)}),u.differs?e(Q,{tone:"warn",children:t("Differs from the file version")}):null,u.broken?e(Q,{tone:"warn",children:t("File version cannot be read")}):null]}),u.description?e("p",{children:C(u.description)}):null,u.override?e("p",{className:"hint",children:t("Set by {name}, {time}",{name:u.override.by,time:oe(u.override.at,d)})}):null,e("div",{className:"actions",children:e("button",{type:"button",onClick:()=>x(u.id),children:t("Edit")})})]},u.id)),v?e(q,{id:v,onClose:()=>{x(void 0),P()}}):null]})}function q({id:d,onClose:N}){let[i,h]=r(),[w,v]=r(""),[x,P]=r(),[u,B]=r(!1),[H,V]=r(!1),[F,D]=r(!1),[z,I]=r(!1),L=R();o(()=>{let a=!0;return de.prompt(d).then((y)=>{if(!a)return;h(y),v(y.text)},(y)=>a&&P(l(y))),()=>{a=!1}},[d]);let U=async()=>{if(!i)return;V(!0);try{let a=await de.savePrompt(d,{text:w,base:i.text});h(a),v(a.text),B(!1),f(t("Saved."))}catch(a){if(a instanceof fe&&a.status===409){let{current:y}=a.body;h(y),f(a.message,"danger")}else f(l(a),"danger")}finally{V(!1)}},G=i!==void 0&&w!==i.text;return n(A,{open:!0,title:i?C(i.label):t("Main prompts"),size:"full",onClose:N,children:[x?e(m,{message:x}):null,!i&&!x?e(S,{}):null,i?.broken?e(m,{message:t("The file version of this prompt cannot be read, so it cannot be changed here until it can: {reason}",{reason:i.broken})}):null,i&&!i.broken?n("div",{className:"stack",children:[i.differs?e("p",{className:"hint",children:e(Q,{tone:"warn",children:t("Differs from the file version")})}):null,u?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),e(yt,{label:t("Prompt"),before:i.text,after:w}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:H,onClick:()=>B(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:H,onClick:U,children:H?t("Saving…"):t("Save")})]})]}):n(g,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:L,children:t("Prompt")}),e("span",{className:"field-tools",children:n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>D(!0),children:[e(s,{name:"reset",size:16}),t("History")]})})]}),e("textarea",{id:L,className:"prompt-full",value:w,maxLength:i.maxChars,onChange:(a)=>v(a.target.value)})]}),n("div",{className:"actions",children:[i.override?e("button",{type:"button",className:"secondary",onClick:()=>I(!0),children:t("Revert to the file version")}):null,e("button",{type:"button",disabled:!G||!w.trim(),onClick:()=>B(!0),children:t("Review changes")})]})]}),F?e(T,{fallback:null,children:e(O,{open:F,title:t("History of {name}",{name:C(i.label)}),load:async()=>(await de.promptHistory(d)).versions.map((a)=>({id:a.id,text:a.text,previous:a.previous,by:a.by,at:a.at,revert:a.action==="revert"})),onUse:(a)=>{v(a),B(!1),D(!1)},onClose:()=>D(!1)})}):null,z?e(T,{fallback:null,children:e(Z,{open:z,title:t("Revert {name} to the file version?",{name:C(i.label)}),confirmLabel:t("Revert to the file version"),tone:"danger",onConfirm:async()=>{try{let a=await de.revertPrompt(d,{base:i.text});h(a),v(a.text),B(!1),f(t("Back to the file version."))}catch(a){if(!(a instanceof fe&&a.status===409))throw a;let{current:y}=a.body;h(y),f(a.message,"danger")}},onClose:()=>I(!1),children:e("p",{children:t("The text you saved is dropped and the text from the file applies from the next turn. It stays in the history, so you can bring it back.")})})}):null]}):null]})}export{pe as PromptsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Dr}from"./chunk-index-gc30hm37.js";import"./chunk-index-5e8wn6r3.js";import"./chunk-index-gae833v6.js";import"./chunk-index-0dyf2gdm.js";import"./chunk-index-maf6wr1b.js";import"./chunk-index-xkb336kq.js";import"./chunk-index-e3encn5p.js";import"./chunk-index-tvsvtd4q.js";import"./chunk-index-pce4byw4.js";import"./chunk-index-g3f1sdw0.js";export{Dr as RoomConfirmHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p,r,t,g,e,n,s,x,u,_,Ke,Xt,ye}from"./chunk-index-rvatmx8s.js";import{Ue}from"./chunk-index-maf6wr1b.js";import"./chunk-index-e3encn5p.js";import{bt}from"./chunk-index-qwztcbjz.js";import{Mt}from"./chunk-index-xekytvrr.js";import{A}from"./chunk-index-0dyf2gdm.js";import{Ht}from"./chunk-index-mhb8mpg3.js";var h="room-menu-yolo",N="room-menu-long",b="room-menu-mute";function P(a){let[l,m]=r(!1),i=_().app?.modes!==!1,f=u((o)=>o.rooms[a.room]?.view?.home===!1,a.room),c=u((o)=>o.pins.includes(a.room),a.room),d=a.mode??{yolo:!1,longRunning:!1},k=async(o)=>{m(!0),await Xt(a.room,{longRunning:o}),m(!1)};return e(A,{open:a.open,title:t("Room menu"),onClose:a.onClose,children:n("ul",{className:"menu",children:[a.readOnly?e("li",{children:a.parent?n("a",{className:"menu-item menu-link",href:x("room",a.parent),onClick:a.onClose,children:[e("span",{className:"menu-icon",children:e(s,{name:"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Open the parent room")}),e("span",{className:"meta",children:t("Reply to the knight that started this thread.")})]}),e(s,{name:"chevron",size:16})]}):e("p",{className:"meta",children:t("A thread has no settings.")})}):null,a.readOnly?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:b,children:[e("span",{className:"menu-icon",children:e(s,{name:a.muted?"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(Mt,{id:b,checked:!a.muted,label:t("Notifications"),onChange:async(o)=>{m(!0),await Ht(a.room,!o),m(!1)},busy:l})]})}),a.readOnly||!i?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:h,children:[e("span",{className:"menu-icon","data-tone":"yolo",children:e(s,{name:"bolt"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Yolo mode")}),e("span",{className:"meta",children:t("Approve held actions in this room without asking. Risky ones still ask.")})]}),e(Mt,{id:h,checked:d.yolo,label:t("Yolo mode"),onChange:(o)=>{if(o)a.onAskYolo();else m(!0),Xt(a.room,{yolo:!1}).then(()=>m(!1))},busy:l})]})}),a.readOnly||!i?null:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:N,children:[e("span",{className:"menu-icon","data-tone":"long",children:e(s,{name:"timer"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Long-running mode")}),e("span",{className:"meta",children:t("Let turns go on past their time limit, up to the host's cap. Questions still wait for you.")})]}),e(Mt,{id:N,checked:d.longRunning,label:t("Long-running mode"),onChange:k,busy:l})]})}),a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ke(a.agent)},children:[e("span",{className:"menu-icon",children:e(s,{name:"profile"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit knight")}),e("span",{className:"meta",children:t("Name, prompt, model and picture")})]}),e(s,{name:"chevron",size:16})]})}):null,a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ke(a.agent,{skills:!0})},children:[e("span",{className:"menu-icon",children:e(s,{name:"skills"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Skills")}),e("span",{className:"meta",children:t("Choose the skills this knight carries.")})]}),e(s,{name:"chevron",size:16})]})}):null,a.group?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),bt({kind:"group",name:a.group})},children:[e("span",{className:"menu-icon",children:e(s,{name:"profile"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit group")}),e("span",{className:"meta",children:t("Name, members and host")})]}),e(s,{name:"chevron",size:16})]})}):null,a.onEditCouncil?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),a.onEditCouncil?.()},children:[e("span",{className:"menu-icon",children:e(s,{name:"table"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Edit this council")}),e("span",{className:"meta",children:t("Who sits, or another council")})]}),e(s,{name:"chevron",size:16})]})}):null,a.readOnly||!f?null:n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),(p("yxh77zcz"),import("./chunk-layout-actions-yxh77zcz.js")).then((o)=>o.pinRoom(a.room,!c))},children:[e("span",{className:"menu-icon",children:e(s,{name:"pin"})}),n("span",{className:"menu-text",children:[e("strong",{children:c?t("Unpin"):t("Pin")}),e("span",{className:"meta",children:t("Keep this room at the top of the list.")})]})]})}),e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),Ue({kind:"move",room:a.room})},children:[e("span",{className:"menu-icon",children:e(s,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Move to folder…")}),e("span",{className:"meta",children:t("Put this room in a folder, or take it out.")})]}),e(s,{name:"chevron",size:16})]})})]}),a.readOnly?null:e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:a.onAskStartOver,children:[e("span",{className:"menu-icon","data-tone":"danger",children:e(s,{name:"reset"})}),n("span",{className:"menu-text",children:[e("strong",{children:t("Start over")}),e("span",{className:"meta",children:t("Archive this conversation and begin a new one. Memory stays.")})]})]})}),a.readOnly||a.coordinator?null:e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),ye({kind:"archive",room:a.room,name:a.displayName??""})},children:[e("span",{className:"menu-icon","data-tone":"danger",children:e(s,{name:"archive"})}),n("span",{className:"menu-text",children:[e("strong",{children:a.group?t("Archive group"):t("Archive knight")}),e("span",{className:"meta",children:t("It stops answering. The history is kept and it can be restored.")})]})]})})]})})}export{P as RoomMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,e,s,u}from"./chunk-index-rvatmx8s.js";import"./chunk-index-e3encn5p.js";import"./chunk-index-tfgd7vr5.js";import"./chunk-index-maf6wr1b.js";import{bi}from"./chunk-index-14cxgacv.js";import"./chunk-index-4p45h04z.js";import"./chunk-index-wqbcade7.js";function r(){if(!u((o)=>o.listed))return null;return e("button",{type:"button",className:"header-button icon-button","aria-haspopup":"menu","aria-label":t("Folders and order"),onClick:(o)=>bi(o.currentTarget),children:e(s,{name:"more",size:18})})}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,t,c,e,n,
|
|
1
|
+
import{r,t,c,e,n,s,x,y,f,S,m,k,Q,_,oe}from"./chunk-index-rvatmx8s.js";import{D}from"./chunk-index-gae833v6.js";import{ke}from"./chunk-index-65p4hfkr.js";import"./chunk-index-0dyf2gdm.js";var h={mon:c("Mon"),tue:c("Tue"),wed:c("Wed"),thu:c("Thu"),fri:c("Fri"),sat:c("Sat"),sun:c("Sun")};function w(d){if(typeof d!=="object"||d===null)return"";let o=d,i=typeof o.time==="string"?o.time:"";switch(o.kind){case"once":return t("Once on {date} at {time}",{date:String(o.date??""),time:i});case"every":return Number(o.everyDays)===1?t("Every day at {time}",{time:i}):t("Every {count} days at {time}",{count:Number(o.everyDays),time:i});case"weekly":{let l=Array.isArray(o.weekdays)?o.weekdays.map((u)=>t(h[String(u)]??String(u))).join(t(", ")):"";return t("{days} at {time}",{days:l,time:i})}default:return""}}function V(){let{timeZone:d}=_(),[o,i]=r(0),[l,u]=r(),{data:p,error:g}=ke(()=>y.schedules(),`schedules:${o}`);return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Schedules")})}),g?e(m,{message:g}):null,!p&&!g?e(S,{}):null,p&&p.schedules.length===0?e(k,{children:t("Nothing is scheduled. Ask a knight to remind you or to run something later.")}):null,e("ul",{className:"schedule-list",children:p?.schedules.map((a)=>n("li",{className:"card schedule",children:[n("div",{className:"schedule-main",children:[n("div",{className:"card-head",children:[e("strong",{children:a.title}),a.lastStatus?e(Q,{children:a.lastStatus}):null]}),n("p",{className:"meta",children:[w(a.recurrence)," ·"," ",t("next {when}",{when:oe(a.nextRun,d)})]}),e("p",{className:"schedule-prompt",children:a.prompt}),n("p",{className:"meta",children:[a.room?e("a",{href:x("room",a.room),children:a.label}):a.label," ","· ",t("set by {name}",{name:a.createdBy})]})]}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Cancel {title}",{title:a.title}),onClick:()=>u(a),children:e(s,{name:"trash"})})]},a.id))}),e(D,{open:l!==void 0,title:t("Cancel this schedule?"),confirmLabel:t("Cancel schedule"),tone:"danger",onClose:()=>u(void 0),onConfirm:async()=>{if(!l)return;await y.cancelSchedule(l.id),i((a)=>a+1),f(t("Schedule cancelled."))},children:e("p",{children:t("“{title}” will not run again. Runs that already happened stay in the conversation.",{title:l?.title??""})})})]})}export{V as SchedulesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Pn}from"./chunk-index-rvatmx8s.js";function M(t,l,d,g){let r,a=-1,i=!1,f=(e)=>e instanceof Element?e.closest("button, [data-seat]")??t:t,o=()=>{r?.cancel(),r=void 0,a=-1},p=(e)=>{if(i=!1,e.pointerType==="mouse"||!e.isPrimary)return;o();let n=l(e.target,e.clientX,e.clientY);if(!n)return;let u=f(e.target);a=e.pointerId,r=new Pn((s)=>{if(i=!0,typeof navigator.vibrate==="function")navigator.vibrate(10);d({...n,at:s,via:"hold",source:u})},g),r.begin(e.clientX,e.clientY)},m=(e)=>{if(e.pointerId===a&&r&&!i){if(!r.move(e.clientX,e.clientY))o()}},c=(e)=>{if(e.pointerId===a)o()},E=(e)=>{let n=l(e.target,e.clientX,e.clientY);if(!n)return;if(e.preventDefault(),i)return;o(),d({...n,at:{x:e.clientX,y:e.clientY},via:"contextmenu",source:f(e.target)})},v=(e)=>{if(i=!1,e.key!=="ContextMenu"&&!(e.key==="F10"&&e.shiftKey))return;let n=l(e.target,-1,-1);if(!n)return;e.preventDefault();let u=f(e.target),s=u.getBoundingClientRect();d({...n,at:{x:s.left+Math.min(s.width/2,48),y:s.top+24},via:"key",source:u})},L=(e)=>{if(!i)return;i=!1,e.preventDefault(),e.stopPropagation()};return t.addEventListener("pointerdown",p),t.addEventListener("pointermove",m),t.addEventListener("pointerup",c),t.addEventListener("pointercancel",c),t.addEventListener("contextmenu",E),t.addEventListener("keydown",v),t.addEventListener("click",L,!0),()=>{o(),t.removeEventListener("pointerdown",p),t.removeEventListener("pointermove",m),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",c),t.removeEventListener("contextmenu",E),t.removeEventListener("keydown",v),t.removeEventListener("click",L,!0)}}export{M as attachSeatMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{dr,fr}from"./chunk-index-vwd5drzh.js";import"./chunk-index-e3encn5p.js";import"./chunk-index-tfgd7vr5.js";export{dr as FoldToggle,fr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T,
|
|
1
|
+
import{T,b,E,o,r,t,c,g,e,n,s,x,u,y,l,f,_,Or,ni,Hs,ct,Be}from"./chunk-index-rvatmx8s.js";import{Si}from"./chunk-index-br1wechm.js";import{hn,ds,ki,Fn}from"./chunk-index-qqaaxh63.js";var C;if(typeof window<"u")window.addEventListener("beforeinstallprompt",(d)=>{d.preventDefault(),C=d});var A=()=>typeof matchMedia==="function"&&(matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0),z=[{value:"system",label:c("System"),icon:"system"},{value:"light",label:c("Light"),icon:"sun"},{value:"dark",label:c("Dark"),icon:"moon"}],D=[{value:"modern",label:c("Modern"),hint:c("Plain and neutral, with round avatars.")},{value:"camelot",label:c("Camelot"),hint:c("Parchment by day, night castle by night, gold rules, shield avatars and wax seals.")}];function H({enabled:d,quietHours:p}){let[m,k]=r(),[v,h]=r([]),[N,I]=r(),[w,P]=r(!1),a=E(async()=>{k(await hn()),I(await ds()),h((await y.pushDevices()).devices)},[]);if(o(()=>{if(d)a().catch(()=>k("unsupported"))},[d,a]),!d)return null;let S=async(i)=>{P(!0);try{await i()}catch(L){f(L instanceof Error&&L.message==="permission"?t("Notifications were not allowed. Allow them in the browser's site settings."):l(L),"danger")}finally{await a().catch(()=>{return}),P(!1)}};return n("section",{className:"card stack",children:[e("h2",{children:t("Notifications")}),e("p",{className:"meta",children:m==="unsupported"?t("This browser cannot get push notifications. On iPhone and iPad, install the app from Share, Add to Home Screen, and open it from there."):m==="blocked"?t("Notifications are blocked for this site. Allow them in the browser's site settings."):t("Get a notification on this device when a card waits for you or a knight reports on its own, while the app is not open.")}),p?e("p",{className:"meta",children:t("Quiet hours, {start} to {end} ({zone}): no notification for a knight's report or a notice. A card waiting for you still notifies. The server sets the hours.",{start:p.start,end:p.end,zone:p.timeZone})}):null,m==="off"||m==="on"?e("div",{className:"actions",children:e("button",{type:"button",className:m==="on"?"secondary":void 0,disabled:w,onClick:()=>S(m==="on"?Fn:ki),children:m==="on"?t("Turn off on this device"):t("Turn on for this device")})}):null,v.length>0?e("ul",{className:"stack",children:v.map((i)=>n("li",{className:"card-head",children:[n("span",{children:[i.label??t("Device"),i.id===N?` (${t("this device")})`:""]}),e("button",{type:"button",className:"secondary",disabled:w,onClick:()=>S(async()=>{if(i.id===N)await Fn();else await y.removePushDevice(i.id)}),children:t("Remove")})]},i.id))}):null]})}var M=b(()=>Be().then((d)=>({default:d.HostSettingsPages})));function X(){let{preference:d}=ni(),p=ct(),m=_(),k=m.look??"modern",v=u((a)=>a.principal),[h,N]=r(),[I,w]=r(C!==void 0);o(()=>{y.session().then(N,()=>{return});let a=()=>w(!0);return window.addEventListener("beforeinstallprompt",a),()=>window.removeEventListener("beforeinstallprompt",a)},[]);let P=A();return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Settings")})}),m.pages?.some((a)=>a.place==="settings")?e(T,{fallback:null,children:e(M,{})}):null,n("section",{className:"card stack",children:[e("h2",{children:t("Appearance")}),n("fieldset",{className:"segmented segmented-wide",children:[e("legend",{className:"visually-hidden",children:t("Color scheme")}),z.map((a)=>n("label",{"data-checked":d===a.value,children:[e("input",{type:"radio",name:"theme",checked:d===a.value,onChange:(S)=>{let i=S.target.getBoundingClientRect();Or(a.value,{x:i.left+i.width/2,y:i.top+i.height/2})}}),e(s,{name:a.icon,size:18}),t(a.label)]},a.value))]}),n("fieldset",{className:"segmented segmented-wide",children:[e("legend",{className:"visually-hidden",children:t("Look")}),D.map((a)=>n("label",{"data-checked":p===a.value,children:[e("input",{type:"radio",name:"look",checked:p===a.value,onChange:()=>Hs(a.value===k?void 0:a.value)}),n("span",{className:"look-swatch","data-swatch":a.value,"aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t(a.label)]},a.value))]}),e("p",{className:"meta",children:t(D.find((a)=>a.value===p)?.hint??"")})]}),n("section",{className:"card stack",children:[e("h2",{children:t("Install")}),P?e("p",{className:"meta",children:t("This page is installed on this device.")}):I?n(g,{children:[e("p",{className:"meta",children:t("Install it to open from your home screen or dock, in its own window.")}),e("div",{className:"actions",children:n("button",{type:"button",onClick:async()=>{await C?.prompt(),C=void 0,w(!1)},children:[e(s,{name:"download",size:16}),t("Install the app")]})})]}):e("p",{className:"meta",children:t("To install it, use your browser's Install option, or on iPhone and iPad, Share and then Add to Home Screen.")})]}),h?.prompts?n("section",{className:"card stack",children:[e("h2",{children:t("Main prompts")}),e("ul",{className:"menu",children:e("li",{children:n("a",{className:"menu-item menu-link",href:x("prompts"),children:[n("span",{className:"menu-text",children:[e("strong",{children:t("Edit the main prompts")}),e("span",{className:"meta",children:t("The texts the main knight and the other knights start from, with a diff to read before you save and a way back to the file's text.")})]}),e(s,{name:"chevron",size:16})]})})})]}):null,e(H,{enabled:h?.push===!0,quietHours:h?.quietHours}),n("section",{className:"card stack",children:[e("h2",{children:t("Account")}),e("p",{className:"meta",children:v?t("Signed in as {name}.",{name:v.name}):h?t("Signed in as {name}.",{name:h.principal.name}):""}),h?e(Si,{auth:h.auth}):null]})]})}export{X as SettingsPage};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{p,T,b,E,o,R,C,a,r,t,c,g,e,n,s,X,u,fe,y,l,f,S,m,k,_,Te,Qn,ho,Ks,ye,he,Cn,te,tt,ri}from"./chunk-index-rvatmx8s.js";import{is}from"./chunk-index-97238pp8.js";import{D}from"./chunk-index-gae833v6.js";import{no,Vs,qs,io,Fs}from"./chunk-index-6f4qvp5p.js";import{bs,Hr,vs}from"./chunk-index-k3hj2310.js";import"./chunk-index-maf6wr1b.js";import"./chunk-index-tvsvtd4q.js";import"./chunk-index-e3encn5p.js";import{Dr}from"./chunk-index-gc30hm37.js";import"./chunk-index-tfgd7vr5.js";import"./chunk-index-r1g24er0.js";import"./chunk-index-vaxytvde.js";import{Ci,Ms}from"./chunk-index-qwztcbjz.js";import{Zn}from"./chunk-index-86x6b7dx.js";import{Nn}from"./chunk-index-xvdna54d.js";import{pn,rr,Br,or}from"./chunk-index-8cxmgzhy.js";import{de}from"./chunk-index-93dr9fh8.js";import{yt}from"./chunk-index-cd0ymvtj.js";import{Zt}from"./chunk-index-ve07gdef.js";import{Mt}from"./chunk-index-xekytvrr.js";import{Ee}from"./chunk-index-xv3e4x0j.js";import{H}from"./chunk-index-5e8wn6r3.js";import{A}from"./chunk-index-0dyf2gdm.js";import"./chunk-index-39gw0qhr.js";import{Ht}from"./chunk-index-mhb8mpg3.js";import{B}from"./chunk-index-fw6kawhw.js";import"./chunk-index-4p45h04z.js";import{re,Ie}from"./chunk-index-xkb336kq.js";import"./chunk-index-wqbcade7.js";import"./chunk-index-pce4byw4.js";import"./chunk-index-g3f1sdw0.js";var je=b(()=>(p("qfnj4w2y"),import("./chunk-prompt-history-qfnj4w2y.js")).then((i)=>({default:i.HistorySheet}))),Ke=b(()=>(p("1mfybhjz"),import("./chunk-character-creator-1mfybhjz.js")).then((i)=>({default:i.CharacterCreator}))),Qe=["default","off","minimal","low","medium","high","xhigh"],Se={default:c("Default"),off:c("Off"),minimal:c("Minimal"),low:c("Low"),medium:c("Medium"),high:c("High"),xhigh:c("Very high")},Z="default",Ce=(i)=>i.model===void 0?t("Default model ({current})",{current:i.effective.model}):t("Default model (server setting)"),Ue=c("Automatic"),pe=(i)=>i==="auto"?t(Ue):t(Se[i]??i),Ne=(i)=>({displayName:i.displayName,prompt:i.prompt,model:i.model??Z,thinking:i.thinking??Z});function we(i,h){return{...h.displayName!==i.displayName?{displayName:h.displayName}:{},...h.prompt!==i.prompt?{prompt:h.prompt}:{},...h.model!==(i.model??Z)?{model:h.model}:{},...h.thinking!==(i.thinking??Z)?{thinking:h.thinking}:{}}}function Ae(){let i=Ks(),h=a(i);if(i)h.current=i;let d=h.current,N=i!==void 0;if(o(()=>{if(!N)return;let w=window.location.href,v=()=>{if(window.location.href!==w)Qn()};return window.addEventListener("popstate",v),window.addEventListener("hashchange",v),()=>{window.removeEventListener("popstate",v),window.removeEventListener("hashchange",v)}},[N]),!d)return null;return e(A,{open:i!==void 0,title:t("Edit knight"),size:"wide",onClose:Qn,children:e(qe,{name:d.name,opened:d.id},d.name)})}function qe({name:i,opened:h}){let[d,N]=r(),[w,v]=r([]),[I,W]=r(),[L,z]=r(),[G,U]=r(!1),[x,M]=r(!1),[V,j]=r(!1),[Q,Y]=r(!1),se=ri(d?.room??""),ee=a(null),ne=d!==void 0,J=u((F)=>d?F.rooms[d.room]?.view?.muted===!0:!1,d?.room??""),[ie,q]=r(!1),le=u((F)=>d?F.rooms[d.room]?.view?.coordinator===!0:!1,d?.room??""),oe=R(),ae=R(),O=R();o(()=>{if(!ne||!ho()?.look)return;ee.current?.scrollIntoView({block:"start"}),ee.current?.focus({preventScroll:!0})},[ne,h]);let P=a({});P.current={profile:d,draft:L},o(()=>{let F=!0;return Promise.all([y.agent(i),y.models()]).then(([ce,We])=>{if(!F)return;let{profile:ke,draft:ue}=P.current,_e=ke&&ue&&Object.keys(we(ke,ue)).length>0;N(ce),v(We.models),z(_e?ue:Ne(ce))},(ce)=>F&&W(l(ce))),()=>{F=!1}},[i,h]);let K=C(()=>d&&L?we(d,L):{},[d,L]);if(I)return e(m,{message:I});if(!d||!L)return e(S,{});let ve=Object.keys(K).length>0,ze=Array.from(new Set([Z,...w,L.model])),Be=Ce(d),be=async()=>{U(!0);try{let F=await y.updateAgent(i,K);N(F),z(Ne(F)),M(!1),f(t("Saved."))}catch(F){f(l(F),"danger")}finally{U(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(he,{spec:d.character,name:d.name,size:72,state:se,label:d.displayName}),n("div",{children:[e("h3",{children:d.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:d.effective.model,thinking:pe(d.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:O,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(Mt,{id:O,checked:!J,label:t("Notifications"),busy:ie,onChange:async(F)=>{q(!0),await Ht(d.room,!F),q(!1)}})]})})}),x?e(Je,{profile:d,draft:L,saving:G,onBack:()=>M(!1),onSave:be}):n("form",{className:"stack form",onSubmit:(F)=>{if(F.preventDefault(),!ve)return;if(K.prompt!==void 0)M(!0);else be()},children:[n("label",{htmlFor:ae,children:[t("Name"),e("input",{id:ae,value:L.displayName,onChange:(F)=>z({...L,displayName:F.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:oe,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>Y(!0),children:[e(s,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(Ye,{}),t("Full screen")]})]})]}),e("textarea",{id:oe,rows:8,value:L.prompt,onChange:(F)=>z({...L,prompt:F.target.value})})]}),e(Zt,{label:t("Model"),value:L.model,onChange:(F)=>z({...L,model:F}),options:ze.map((F)=>({value:F,label:F===Z?Be:F}))}),e(Zt,{label:t("Thinking level"),value:L.thinking,onChange:(F)=>z({...L,thinking:F}),options:Qe.map((F)=>({value:F,label:t(Se[F])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ve||G,children:G?t("Saving…"):K.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(Ze,{name:i,opened:h}),n("section",{className:"card stack",ref:ee,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(T,{fallback:e(S,{}),children:e(Ke,{name:d.name,displayName:d.displayName,prompt:d.prompt,character:d.character,onSaved:(F)=>N(F)})})]}),le?null:n("section",{className:"card stack",children:[e("h3",{children:t("Archive")}),e("p",{className:"meta",children:t("An archived knight 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:()=>{Qn(),ye({kind:"archive",room:d.room,name:d.displayName})},children:t("Archive {name}",{name:d.displayName})})})]}),Q?e(T,{fallback:null,children:e(je,{open:Q,title:t("History of the prompt"),load:async()=>(await de.agentPromptHistory(i)).versions.map((F)=>({id:F.id,text:F.text,previous:F.previous,by:F.by,at:F.at})),onUse:(F)=>{z({...L,prompt:F}),Y(!1)},onClose:()=>Y(!1)})}):null,e(A,{open:V,title:t("Prompt"),size:"full",onClose:()=>j(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:L.prompt,onChange:(F)=>z({...L,prompt:F.target.value})})})]})}function Ze({name:i,opened:h}){let[d,N]=r(),[w,v]=r(),[I,W]=r(),L=R(),z=a(null),G=d!==void 0;if(o(()=>{if(!G||!ho()?.skills)return;z.current?.scrollIntoView({block:"start"}),z.current?.focus({preventScroll:!0})},[G,h]),o(()=>{let M=!0;return re.skills(i).then((V)=>M&&N(V),(V)=>{if(M&&!(V instanceof fe&&V.status===404))W(l(V))}),()=>{M=!1}},[i,h]),I)return e(m,{message:I});if(!d)return null;let U=()=>re.skills(i).then(N,(M)=>{f(l(M),"danger")}),x=async(M,V)=>{v(M);try{N(await re.setSkills(i,V?{add:[M]}:{remove:[M]}))}catch(j){f(l(j),"danger")}finally{v(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),ref:z,tabIndex:-1,children:[e("h3",{children:t("Skills ({count})",{count:d.skills.filter((M)=>M.carried).length})}),e("p",{className:"meta",children:t("What the knight can load when a task calls for it. It applies from its next turn.")}),e("ul",{className:"menu",children:d.skills.map((M,V)=>{let j=`${L}-${V}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:j,children:[n("span",{className:"menu-text",children:[e("strong",{children:M.name}),e("span",{className:"meta",children:M.missing?t("Its file cannot be read."):M.builtin?t("Built in: every knight carries it."):M.description??""})]}),e(Mt,{id:j,checked:M.carried,label:M.name,busy:w===M.name,disabled:M.builtin,onChange:(Q)=>x(M.name,Q)})]})},M.name)})}),e(Xe,{name:i,view:d,onApplied:U})]})}function Xe({name:i,view:h,onApplied:d}){let[N,w]=r(),[v,I]=r(),W=R();if(o(()=>{let x=!0;return de.skillGroups().then((M)=>x&&w(M.groups),()=>{return}),()=>{x=!1}},[]),!N?.length)return null;let L=new Set(h.skills.filter((x)=>x.carried).map((x)=>x.name)),z=new Set(h.skills.filter((x)=>x.builtin).map((x)=>x.name)),G=(x)=>x.skills.filter((M)=>!L.has(M)),U=(x)=>x.skills.filter((M)=>L.has(M)&&!z.has(M));return n("div",{className:"stack skill-apply",children:[e("h4",{children:t("Skill groups")}),e("p",{className:"meta",children:t("Switching a group on switches on its skills this knight lacks; switching it off switches off its skills, built-in ones excepted.")}),e("ul",{className:"menu",children:N.map((x,M)=>{let V=G(x),j=V.length===0;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:`${W}-group-${M}`,children:[n("span",{className:"menu-text",children:[e("strong",{children:x.name}),e("span",{className:"meta",children:j?t("Carries all of it."):t("Lacks {count}: {skills}",{count:V.length,skills:V.join(", ")})})]}),e(Mt,{id:`${W}-group-${M}`,checked:j,label:t("Skill group {name}",{name:x.name}),disabled:j&&U(x).length===0,onChange:(Q)=>I({group:x,on:Q})})]})},x.name)})}),e(D,{open:v!==void 0,title:v?.on?t("Switch this skill group on?"):t("Switch this skill group off?"),confirmLabel:v?.on?t("Switch on"):t("Switch off"),tone:v?.on?"primary":"danger",onClose:()=>I(void 0),onConfirm:async()=>{if(!v)return;let{added:x,removed:M}=await de.applySkillGroup(v.group.name,i,v.on);f(x.length?t("Switched on: {skills}",{skills:x.join(", ")}):M.length?t("Switched off: {skills}",{skills:M.join(", ")}):t("Nothing changed for {name}.",{name:v.group.name})),d()},children:e("p",{children:v?v.on?t("{agent} will also carry: {skills}.",{agent:i,skills:G(v.group).join(", ")}):t("{agent} will no longer carry: {skills}.",{agent:i,skills:U(v.group).join(", ")}):null})})]})}var Ye=()=>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 Je(i){let{profile:h,draft:d}=i,N=a(null);o(()=>N.current?.focus(),[]);let w=[];if(d.displayName!==h.displayName)w.push({label:t("Name"),before:h.displayName,after:d.displayName});let v=(I)=>I===Z?Ce(h):I;if(d.model!==(h.model??Z))w.push({label:t("Model"),before:v(h.model??Z),after:v(d.model)});if(d.thinking!==(h.thinking??Z))w.push({label:t("Thinking level"),before:pe(h.thinking??Z),after:pe(d.thinking)});return n("section",{ref:N,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),w.length?e("ul",{className:"review-fields",children:w.map((I)=>n("li",{children:[e("strong",{children:I.label}),e("span",{className:"review-before",children:I.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:I.after})]},I.label))}):null,e(yt,{label:t("Prompt"),before:h.prompt,after:d.prompt}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:i.saving,onClick:i.onBack,children:t("Back to editing")}),e("button",{type:"button",disabled:i.saving,onClick:i.onSave,children:i.saving?t("Saving…"):t("Save")})]})]})}var et=300000;function xe(){let i=qs(),[h,d]=r(i);if(i&&i!==h)d(i);if(!h)return null;return e(A,{open:i!==void 0,title:t("Archived conversation"),size:"wide",onClose:Vs,children:e(nt,{room:h.room,until:h.until},`${h.room}:${h.until}`)})}function nt(i){B("archived-log",".archived-log .messages { padding: 0; }");let{timeZone:h}=_(),d=tt(),[N,w]=r(),[v,I]=r(!1),[W,L]=r(),[z,G]=r(!1),{room:U,until:x}=i;o(()=>{let V=!0;return no.page(U,x).then((j)=>{if(!V)return;w(j.messages),I(j.more)},(j)=>{if(V)L(l(j))}),()=>{V=!1}},[U,x]);let M=async()=>{let V=N?.[0];if(!V||z)return;G(!0);try{let j=await no.page(U,x,V.id);w((Q)=>[...j.messages,...Q??[]]),I(j.more)}catch(j){L(l(j))}G(!1)};if(W)return e(m,{message:W});if(!N)return e(S,{});if(N.length===0)return e(k,{children:t("The archived conversation has no messages.")});return n("div",{className:"archived-log",children:[v?e("button",{type:"button",className:"secondary older",disabled:z,onClick:M,children:z?t("Loading…"):t("Load earlier messages")}):null,e("ol",{className:"messages",children:N.map((V,j)=>{let Q=N[j-1],Y=!Q||Q.kind!==V.kind||Q.author!==V.author||Date.parse(V.at)-Date.parse(Q.at)>et;return e(Cn,{message:V,character:V.agent?d[V.agent]:void 0,header:Y,enter:!1,unread:!1,timeZone:h,quotable:!1},V.id)})})]})}function ot(i){let{message:h}=i,[d,N]=r(h.text),w=a(null);o(()=>{w.current?.focus(),w.current?.setSelectionRange(d.length,d.length)},[d.length]);let v=d.trim(),I=v===""&&h.files.length===0;return n("form",{className:"stack",onSubmit:(L)=>{if(L.preventDefault(),I)return;if(v!==h.text)bs(h,v);i.onClose()},children:[e("div",{className:"field",children:e("textarea",{ref:w,className:"queued-edit-text",rows:6,value:d,"aria-label":t("Edit"),onChange:(L)=>N(L.target.value)})}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:I,children:t("Save")})]})]})}function Me(){let i=vs(),h=a(void 0);if(i)h.current=i;let d=h.current;if(!d)return null;return e(H,{open:i!==void 0,title:t("Edit"),onClose:Hr,children:e(ot,{message:d,onClose:Hr},d.id)})}var at=`
|
|
2
|
+
.sheet:has(.select-text) {
|
|
3
|
+
-webkit-user-select: none;
|
|
4
|
+
user-select: none;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.select-text {
|
|
8
|
+
flex: 1;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: var(--space-3);
|
|
11
|
+
overflow-wrap: anywhere;
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
border: 1px solid var(--border);
|
|
14
|
+
border-radius: var(--radius-md);
|
|
15
|
+
background: var(--surface-2);
|
|
16
|
+
font: inherit;
|
|
17
|
+
line-height: 1.6;
|
|
18
|
+
-webkit-touch-callout: default;
|
|
19
|
+
-webkit-user-select: text;
|
|
20
|
+
user-select: text;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.select-text-actions {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
gap: var(--space-2);
|
|
27
|
+
margin-top: var(--space-3);
|
|
28
|
+
}
|
|
29
|
+
`;function Le(){let i=Fs(),[h,d]=r(i);if(i&&i!==h)d(i);if(!h)return null;return B("select-text",at),n(A,{open:i!==void 0,title:t("Select text"),size:"full",onClose:io,children:[e("p",{className:"hint",children:h.author}),e("pre",{className:"select-text",children:h.text}),n("div",{className:"select-text-actions",children:[e("button",{type:"button",className:"secondary",onClick:io,children:t("Close")}),e("button",{type:"button",onClick:()=>Zn(h.text),children:t("Copy all")})]})]})}function st(i){let h=i.filter((w)=>w.parent!==void 0),d=i.filter((w)=>w.parent===void 0),N=new Set(d.map((w)=>w.name));return[...d.flatMap((w)=>[w,...h.filter((v)=>v.parent===w.name)]),...h.filter((w)=>!N.has(w.parent??""))]}function De(){let[i,h]=r(),[d,N]=r(),[w,v]=r(),[I,W]=r(),L=E(async()=>{try{h((await re.archive()).entries),N(void 0)}catch(G){N(l(G))}},[]);o(()=>{L()},[L]);let z=async(G)=>{v(G.name);try{if(G.kind==="agent")await re.restoreAgent(G.name);else await re.restoreGroup(G.name);await Ie(),f(t("Restored {name}.",{name:G.displayName})),await L()}catch(U){f(l(U),"danger")}finally{v(void 0)}};if(d&&!i)return e(m,{message:d});if(!i)return e(S,{});return n("div",{className:"stack",children:[e("p",{className:"meta",children:t("Archived knights and groups no longer answer. Their history is kept until you delete them.")}),i.length===0?e(k,{children:t("Nothing is archived.")}):null,e("ul",{className:"menu",children:st(i).map((G)=>n("li",{className:"menu-item","data-helper":G.parent??void 0,style:G.parent?{paddingLeft:"var(--space-6)"}:void 0,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.parent?t("Temp knight of {name}",{name:G.parent}):G.kind==="agent"?t("Knight"):t("Group")," ","· ",G.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:w===G.name,onClick:()=>z(G),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:w===G.name,onClick:()=>W(G),children:t("Delete")})]},`${G.kind}:${G.name}`))}),e(D,{open:I!==void 0,title:t("Delete {name}?",{name:I?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>W(void 0),onConfirm:async()=>{if(!I)return;if(I.kind==="agent")await re.deleteAgent(I.name);else await re.deleteGroup(I.name);await Ie(),f(t("Deleted {name}.",{name:I.displayName})),await L()},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:I?.displayName??""})})})]})}var He=/^[a-z0-9-]{1,32}$/,Re=2,Pe=8,me="\x00";function rt(){let i=u((h)=>h.order.flatMap((d)=>{let N=h.rooms[d]?.view;return N?.kind==="agent"&&!N.helper?[`${N.name}${me}${N.displayName}`]:[]}).join(`${me}${me}`));return C(()=>i===""?[]:i.split(`${me}${me}`).map((h)=>{let[d="",N=""]=h.split(me);return{name:d,displayName:N}}),[i])}function $e(i){let h=rt(),[d,N]=r(),[w,v]=r(),[I,W]=r(""),[L,z]=r(""),[G,U]=r(!1),[x,M]=r([]),[V,j]=r(""),[Q,Y]=r(!1),[se,ee]=r(i.name===void 0),ne=R(),J=R();o(()=>{let O=i.name;if(O===void 0)return;let P=!0;return re.group(O).then((K)=>{if(!P)return;N(K),W(K.displayName),M(K.members),j(K.host),ee(!0)},(K)=>P&&v(l(K))),()=>{P=!1}},[i.name]);let ie=(O)=>h.find((P)=>P.name===O)?.displayName??O,q=x.includes(V)?V:x[0]??"",le=d===void 0?!0:I.trim()!==d.displayName||x.join(",")!==d.members.join(",")||q!==d.host,oe=I.trim()!==""&&x.length>=Re&&x.length<=Pe&&(d!==void 0||He.test(L));if(w&&!se)return e(m,{message:w});if(!se)return e(S,{});let ae=async()=>{Y(!0),v(void 0);try{if(d){await re.updateGroup(d.name,{...I.trim()!==d.displayName?{displayName:I.trim()}:{},...x.join(",")!==d.members.join(",")?{members:x}:{},...q!==d.host?{host:q}:{}}),await Ie(),f(t("Saved.")),i.onDone();return}let O=await re.createGroup({name:L,displayName:I.trim(),members:x,host:q});await Ie(),f(t("Made {name}.",{name:O.displayName})),i.onDone(),X("room",O.room)}catch(O){v(l(O))}finally{Y(!1)}};return n("form",{className:"stack form",onSubmit:(O)=>{if(O.preventDefault(),oe&&le&&!Q)ae()},children:[n("label",{htmlFor:ne,children:[t("Name"),e("input",{id:ne,value:I,autoComplete:"off",onChange:(O)=>{if(W(O.target.value),!d&&!G)z(O.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),d?null:n("label",{htmlFor:J,children:[t("Permanent name"),e("input",{id:J,value:L,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":L!==""&&!He.test(L),onChange:(O)=>{U(!0),z(O.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 8 knights. They take turns in the order picked.")}),e("ul",{className:"menu",children:h.map((O)=>{let P=x.includes(O.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:P,disabled:!P&&x.length>=Pe,onChange:()=>M(P?x.filter((K)=>K!==O.name):[...x,O.name])}),e("span",{className:"menu-text",children:e("strong",{children:O.displayName})})]})},O.name)})})]}),x.length>=Re?e(Zt,{label:t("Host"),value:q,onChange:j,options:x.map((O)=>({value:O,label:ie(O)}))}):null,w?e(m,{message:w}):null,n("div",{className:"actions",children:[d?e("button",{type:"button",className:"danger",onClick:()=>{i.onDone(),ye({kind:"archive",room:d.room,name:d.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!oe||!le||Q,children:Q?t("Saving…"):d?t("Save"):t("Make group")})]})]})}var it=b(()=>(p("1mfybhjz"),import("./chunk-character-creator-1mfybhjz.js")).then((i)=>({default:i.CharacterCreator}))),Fe=/^[a-z0-9-]{1,32}$/,ge="default";function lt(i){let h=[];for(let d of i){let N=d.indexOf("/"),w=N>0?d.slice(0,N):"",v=h.find((I)=>I.provider===w&&w!=="");if(v)v.models.push(d);else h.push({provider:w,models:[d]})}return h}var mt=(i)=>i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Ge({onDone:i}){let[h,d]=r(""),[N,w]=r(""),[v,I]=r(!1),[W,L]=r(""),[z,G]=r(ge),[U,x]=r(""),[M,V]=r(),[j,Q]=r(!1),[Y,se]=r([]),[ee,ne]=r(),[J,ie]=r(!1),q=[R(),R(),R(),R(),R()];o(()=>{let P=!0;return y.models().then((K)=>P&&se(K.models),()=>{return}),()=>{P=!1}},[]);let le=C(()=>Nn({name:N,displayName:h,prompt:W}),[N,h,W]),oe=M?.spec??le,ae=Fe.test(N)&&h.trim()!==""&&W.trim()!=="";if(j)return e(T,{fallback:e(S,{}),children:e(it,{name:N||"new",displayName:h,prompt:W,character:oe,onPick:(P,K)=>{V({input:P,spec:K}),Q(!1)},onCancel:()=>Q(!1)})});let O=async()=>{ie(!0),ne(void 0);try{let P={name:N,displayName:h.trim(),prompt:W,...z!==ge?{model:z}:{},...U.trim()?{task:U.trim()}:{},...M?{character:M.input}:{}},K=await re.createAgent(P);await Ie(),f(t("Made {name}.",{name:K.displayName})),i(),X("room",K.room)}catch(P){ne(P instanceof fe&&P.field?`${P.field}: ${l(P)}`:l(P))}finally{ie(!1)}};return n("form",{className:"stack form",onSubmit:(P)=>{if(P.preventDefault(),ae&&!J)O()},children:[n("label",{htmlFor:q[0],children:[t("Name"),e("input",{id:q[0],value:h,autoComplete:"off",onChange:(P)=>{if(d(P.target.value),!v)w(mt(P.target.value))}})]}),n("label",{htmlFor:q[1],children:[t("Permanent name"),e("input",{id:q[1],value:N,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":N!==""&&!Fe.test(N),onChange:(P)=>{I(!0),w(P.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:q[2],children:[t("Prompt"),e("textarea",{id:q[2],rows:6,value:W,onChange:(P)=>L(P.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:q[4],children:[t("Model"),n(Ee,{id:q[4],value:z,onChange:(P)=>G(P.target.value),children:[e("option",{value:ge,children:t("Default model")}),lt(Y).map((P)=>P.provider===""?P.models.map((K)=>e("option",{value:K,children:K},K)):e("optgroup",{label:P.provider,children:P.models.map((K)=>e("option",{value:K,children:K},K))},P.provider))]})]}),n("label",{htmlFor:q[3],children:[t("Opening task"),e("textarea",{id:q[3],rows:3,value:U,onChange:(P)=>x(P.target.value)}),e("span",{className:"meta",children:t("Optional. The knight starts on it as soon as it is made.")})]}),n("div",{className:"profile-head",children:[e(he,{spec:oe,name:N||"new",size:72,label:h}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:M?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>Q(!0),children:t("Choose a look")})]})]}),ee?e(m,{message:ee}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ae||J,children:J?t("Making…"):t("Make knight")})})]})}var ct=(i)=>i.kind==="new-agent"?t("New knight"):i.kind==="archive"?t("Archived"):i.name===void 0?t("New group"):t("Edit group");function Ve(){let i=Ms(),h=a(i);if(i)h.current=i;let d=h.current,N=i!==void 0;if(o(()=>{if(!N)return;let w=window.location.href,v=()=>{if(window.location.href!==w)Ci()};return window.addEventListener("popstate",v),window.addEventListener("hashchange",v),()=>{window.removeEventListener("popstate",v),window.removeEventListener("hashchange",v)}},[N]),!d)return null;return e(A,{open:i!==void 0,title:ct(d),size:"wide",onClose:Ci,children:e("div",{className:"stack agent-sheet",children:d.kind==="new-agent"?e(Ge,{onDone:Ci}):d.kind==="archive"?e(De,{}):e($e,{...d.name===void 0?{}:{name:d.name},onDone:Ci})},d.id)})}function Oe(){let i=Br(),h=a(!1);if(i)h.current=!0;return h.current?e(ut,{open:i}):null}function ut({open:i}){let h=_(),{now:d}=te(),N=u((v)=>pn(v).map(({id:I,card:W})=>{let L=v.rooms[W.room]?.view,z=L?.parent?v.rooms[L.parent]?.view:void 0;return{id:I,room:z?`${z.displayName} › ${L?.displayName??""}`:L?.displayName??W.room,title:W.frame.title,at:W.frame.at}})),w=N.length===0;return o(()=>{if(i&&w)rr()},[i,w]),e(A,{open:i&&!w,title:t("Cards waiting"),onClose:rr,children:e("ul",{className:"waiting-list",children:N.map((v)=>e("li",{children:n("button",{type:"button",onClick:()=>or(v.id),children:[e("strong",{children:v.title}),n("span",{className:"meta",children:[v.room,v.at?` · ${Te(v.at,d,h.timeZone)}`:""]})]})},v.id))})})}var dt=b(()=>(p("fv6b6ntc"),import("./chunk-shortcut-help-fv6b6ntc.js")));function pt(){let i=is(),h=a(!1);if(i)h.current=!0;if(!h.current)return null;return e(T,{fallback:null,children:e(dt,{open:i})})}function To(){return n(g,{children:[e(Dr,{}),e(Me,{}),e(Ae,{}),e(Ve,{}),e(xe,{}),e(Le,{}),e(Oe,{}),e(pt,{})]})}export{To as SheetHosts};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{t,e,n}from"./chunk-index-rvatmx8s.js";import{yi,os}from"./chunk-index-97238pp8.js";import{A}from"./chunk-index-0dyf2gdm.js";import{B}from"./chunk-index-fw6kawhw.js";var l=`
|
|
2
|
+
.shortcut-list {
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-columns: max-content minmax(0, 1fr);
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--space-3) var(--space-4);
|
|
7
|
+
margin: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.shortcut-list dt {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
gap: var(--space-1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.shortcut-list dd {
|
|
17
|
+
margin: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.shortcut-list kbd {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
min-width: 1.6rem;
|
|
23
|
+
text-align: center;
|
|
24
|
+
font-size: var(--text-sm);
|
|
25
|
+
}
|
|
26
|
+
`;function r(){let a=os(),s=a?"⌥":"Alt",o=a?"⌘":"Ctrl";return[{keys:[s,"↑"],label:t("Previous room")},{keys:[s,"↓"],label:t("Next room")},{keys:[s,"Shift","↑"],label:t("Previous room with unread messages")},{keys:[s,"Shift","↓"],label:t("Next room with unread messages")},{keys:[o,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["↑"],label:t("Edit your latest message that is still waiting, from an empty message box")},{keys:["/clear"],label:t("In a message box, start the open room over (also /new)")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:a}){return B("shortcut-help",l),e(A,{open:a,title:t("Keyboard shortcuts"),onClose:yi,children:n("div",{className:"stack",children:[e("dl",{className:"shortcut-list",children:r().map((s)=>n("div",{style:{display:"contents"},children:[e("dt",{children:s.keys.map((o)=>e("kbd",{children:o},o))}),e("dd",{children:s.label})]},s.label))}),e("p",{className:"meta",children:t("In a message box the arrow shortcuts switch rooms only when it is empty or the caret is at its very start (up) or very end (down).")})]})})}export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Kn,x,X,Me,Xe,O,Ve,_t,Ae,mo}from"./chunk-index-rvatmx8s.js";import{Er}from"./chunk-index-tfgd7vr5.js";import{Pi,Qi}from"./chunk-index-k3hj2310.js";import{ns,yi,rs}from"./chunk-index-97238pp8.js";import{ut}from"./chunk-index-g3f1sdw0.js";function y(e,t){let{collapsed:n,expanded:r,current:s}=t,o=ut(e,t.at),u=[],c=(i,f)=>{u.push({key:i,shown:f});let l=o.threads[i];if(!l)return;for(let d of l.open)u.push({key:d,shown:f});for(let d of l.closed)u.push({key:d,shown:f&&(r.has(d)||d===s)})};for(let i of o.home)c(i,!0);let a=(i,f)=>{let l=n.has(i);for(let d of f)c(d,!l||d===s||t.stays?.(d)===!0)};a(Ae("pinned"),o.pinned);for(let i of o.folders)a(i.id,i.rooms);if(o.folders.length>0)a(Ae("rest"),o.rest);else a(Ae("agents"),o.restAgents),a(Ae("groups"),o.restGroups);let{orphans:m}=o;for(let i of m.open)u.push({key:i,shown:!0});for(let i of m.closed)u.push({key:i,shown:r.has(i)||i===s});return u}function h(e,t,n,r){let s=n===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((o)=>o.key===t),s<0)return}for(let o=s+n;o>=0&&o<e.length;o+=n){let u=e[o];if(u&&r(u))return u.key}return}var S=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function g(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return S.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function E(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:o,selectionEnd:u}=e;if(o===null||u===null||o!==u)return!1;return t?o===0:o===e.value.length}if((e.textContent??"")==="")return!0;let n=window.getSelection();if(!n||n.rangeCount===0||!n.isCollapsed)return!1;let r=n.getRangeAt(0),s=document.createRange();if(s.selectNodeContents(e),t)s.setEnd(r.startContainer,r.startOffset);else s.setStart(r.endContainer,r.endOffset);return s.toString()===""}function b(){let e=Kn();if(e.pane!=="room"||e.key===void 0)return;return(O.getState().rooms[e.key]?.messages??[]).findLast(Pi)}var k=(e)=>e instanceof HTMLTextAreaElement&&e.closest(".composer")!==null&&e.value===""&&!e.readOnly;function T(e){if(e.defaultPrevented||Ve(e))return;let{key:t}=e;if(t==="Escape")return e.altKey||e.ctrlKey||e.metaKey?void 0:"escape";if(e.altKey&&!e.ctrlKey&&!e.metaKey){if(t!=="ArrowUp"&&t!=="ArrowDown")return;let n=t==="ArrowUp",r=g(e.target);if(r&&!E(r,n))return;if(e.shiftKey)return n?"previous-unread":"next-unread";return n?"previous":"next"}if(t==="ArrowUp"&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.repeat)return k(e.target)&&b()?"edit-queued":void 0;if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return g(e.target)?void 0:"help";return}function K(){let e=new Set;for(let t of document.querySelectorAll("details.thread-closed[open] [data-thread]"))if(t.dataset.thread)e.add(t.dataset.thread);return e}var p=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function w(e,t=12){let n=x("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===n);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>w(e,t-1))}function H(e,t){let n=O.getState(),r=Kn(),s=r.pane==="room"?r.key:void 0,o=y(n,{at:(a)=>Xe(n,a),collapsed:mo(),stays:(a)=>Me(n,a)>0||Er(a)>0,expanded:K(),current:s});if(r.pane==="room"&&!o.some((a)=>a.key===s))return;let c=h(o,s,e,t?(a)=>Er(a.key)>0:(a)=>a.shown);if(c===void 0)return;X("room",c),w(c)}function L(e){if(document.querySelector(".action-popover")){e.preventDefault(),_t();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&S.has(t.type))e.preventDefault(),t.blur()}function A(e,t){switch(e){case"escape":L(t);break;case"help":if(t.preventDefault(),rs())yi();else if(!p())ns();break;case"edit-queued":{if(p())break;let n=b();if(!n)break;t.preventDefault(),Qi(n);break}default:if(p())break;t.preventDefault(),H(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function V(){let e=(t)=>{let n=T(t);if(n)A(n,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{V as startShortcuts};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{p,T,
|
|
1
|
+
import{p,T,b,o,R,r,t,g,e,n,s,fe,l,f,S,m}from"./chunk-index-rvatmx8s.js";import{de}from"./chunk-index-93dr9fh8.js";import{yt}from"./chunk-index-cd0ymvtj.js";import{A}from"./chunk-index-0dyf2gdm.js";var B=b(()=>(p("qfnj4w2y"),import("./chunk-prompt-history-qfnj4w2y.js")).then((d)=>({default:d.HistorySheet}))),O=`---
|
|
2
2
|
name: my-skill
|
|
3
3
|
description: "Use when "
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# My skill
|
|
7
7
|
|
|
8
|
-
`;function _(d){let{name:u}=d,[i,w]=r(),[h,
|
|
8
|
+
`;function _(d){let{name:u}=d,[i,w]=r(),[h,v]=r(u?"":O),[y,I]=r(),[z,k]=r(!1),[C,x]=r(!1),[U,D]=r(!1),[H,N]=r(!1),L=R();o(()=>{if(!u)return;let a=!0;return de.skillDocument(u).then((c)=>{if(!a)return;w(c),v(c.text)},(c)=>a&&I(l(c))),()=>{a=!1}},[u]);let E=i?.text??"",V=h!==E,F=u!==void 0&&!i&&!y,K=async()=>{x(!0);try{if(i){let a=await de.saveSkillDocument(i.name,{text:h,baseHash:i.hash});w(a),v(a.text),k(!1),D(!1),f(t("Saved.")),d.onSaved()}else await de.createSkillDocument({text:h}),f(t("Skill created.")),d.onSaved(),d.onClose()}catch(a){if(a instanceof fe&&a.status===409){let{current:c}=a.body;w(c),D(!0)}else f(l(a),"danger")}finally{x(!1)}};return n(A,{open:!0,title:u??t("New skill"),size:"full",onClose:d.onClose,children:[y?e(m,{message:y}):null,F?e(S,{}):null,i&&!i.writable?e(m,{message:t("This skill cannot be edited here.")}):null,!F&&!y&&(!i||i.writable)?n("div",{className:"stack",children:[z?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),U?e(m,{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(yt,{label:"SKILL.md",before:E,after:h}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:C,onClick:()=>k(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:C,onClick:K,children:C?t("Saving…"):i?t("Save"):t("Create skill")})]})]}):n(g,{children:[n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:L,children:"SKILL.md"}),i?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:h,onChange:(a)=>v(a.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:!V||!h.trim(),onClick:()=>k(!0),children:t("Review changes")})})]}),H&&i?e(T,{fallback:null,children:e(B,{open:H,title:t("History of {name}",{name:i.name}),load:async()=>{let{versions:a}=await de.skillHistory(i.name);return a.map((c,M)=>({id:c.id,text:c.text,previous:a[M+1]?.text??"",by:c.by,at:c.at}))},onUse:(a)=>{v(a),k(!1),N(!1)},onClose:()=>N(!1)})}):null]}):null]})}export{_ as SkillEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p,so,T,b,o,r,t,g,e,n,s,y,l,f,S,m,k,Q,tn,$t}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{de}from"./chunk-index-93dr9fh8.js";import{H}from"./chunk-index-5e8wn6r3.js";import"./chunk-index-0dyf2gdm.js";function x({source:a}){return e("div",{className:"prose document",children:e(tn,{remarkPlugins:[$t],components:{a:({href:i,children:d})=>i&&/^https?:\/\//.test(i)?e("a",{href:i,target:"_blank",rel:"noreferrer",children:d}):e("span",{children:d}),img:({alt:i})=>e("span",{children:i}),pre:({children:i})=>e("div",{className:"code-block",children:e("pre",{children:i})}),table:({children:i})=>e("div",{className:"table-wrap",children:e("table",{children:i})})},children:a})})}function B(a){let{data:i,error:d,reload:c}=cn(()=>de.skillGroups()),[N,u]=r(),[v,V]=r(),h=()=>{c(),a.onChanged()};return n("section",{className:"stack","aria-label":t("Skill groups"),children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skill groups")}),n("button",{type:"button",className:"secondary",onClick:()=>u({group:void 0}),children:[e(s,{name:"plus",size:16}),t("New group")]})]}),e("p",{className:"hint",children:t("A group lists skills to switch on for a knight in one step, from the knight's sheet. Knights carry the skills, not the group.")}),d?e(m,{message:d}):null,!i&&!d?e(S,{}):null,i?.groups.length===0?e(k,{children:t("No skill groups.")}):null,i?.groups.map((w)=>n("article",{className:"card skill-group",children:[n("div",{className:"card-head",children:[e("strong",{children:w.name}),e("button",{type:"button",className:"secondary",onClick:()=>u({group:w}),children:t("Edit")}),e("button",{type:"button",className:"secondary",onClick:()=>V(w),children:t("Delete")})]}),e("p",{children:w.description}),n("p",{className:"hint",children:[t("Skills"),": ",w.skills.join(", ")||t("None")]})]},w.name)),e(H,{open:N!==void 0,title:N?.group?t("Edit {name}",{name:N.group.name}):t("New skill group"),onClose:()=>u(void 0),children:N?e(A,{group:N.group,catalog:a.catalog,onCancel:()=>u(void 0),onDone:()=>{u(void 0),h()}},N.group?.name??""):null}),e(D,{open:v!==void 0,title:t("Delete this skill group?"),confirmLabel:t("Delete group"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!v)return;await de.deleteSkillGroup(v.name),f(t("Deleted {name}.",{name:v.name})),h()},children:e("p",{children:t("{name} will be deleted. Its skills stay, and so does every knight that carries them.",{name:v?.name??""})})})]})}function A(a){let[i,d]=r(a.group?.name??""),[c,N]=r(a.group?.description??""),[u,v]=r(a.group?.skills??[]),[V,h]=r(),[w,G]=r(!1);return n("form",{className:"stack",onSubmit:async(E)=>{E.preventDefault(),G(!0),h(void 0);try{let L=a.group?.name;await de.saveSkillGroup(i.trim(),{description:c,skills:[...a.catalog.map((F)=>F.name).filter((F)=>u.includes(F)),...u.filter((F)=>!a.catalog.some((z)=>z.name===F))],...L?{from:L}:{}}),f(t("Saved {name}.",{name:i.trim()})),a.onDone()}catch(L){h(l(L))}finally{G(!1)}},autoComplete:"off",children:[n("label",{children:[t("Name"),e("input",{value:i,maxLength:64,placeholder:"coding",required:!0,onChange:(E)=>d(E.target.value)}),e("span",{className:"meta",children:t("Lowercase letters, digits and single hyphens, up to 64.")})]}),n("label",{children:[t("Description"),e("textarea",{value:c,maxLength:1000,rows:2,required:!0,onChange:(E)=>N(E.target.value)})]}),n("fieldset",{className:"field",children:[e("legend",{children:t("Skills")}),e("ul",{className:"menu",children:a.catalog.map((E)=>{let L=u.includes(E.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:L,onChange:()=>v(L?u.filter((F)=>F!==E.name):[...u,E.name])}),n("span",{className:"menu-text",children:[e("strong",{children:E.name}),E.description?e("span",{className:"meta",children:E.description}):null]})]})},E.name)})})]}),V?e(m,{message:V}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:w,onClick:a.onCancel,children:t("Cancel")}),e("button",{type:"submit",disabled:w,children:t("Save group")})]})]})}var I=b(()=>(p("zzmv9nfq"),import("./chunk-skill-editor-zzmv9nfq.js")).then((a)=>({default:a.SkillEditor})));function we(){let[a,i]=r(0),{data:d,error:c}=ke(()=>y.skills(),`skills:${a}`),[N,u]=r(),[v,V]=r(),[h,w]=r();o(()=>{y.session().then(u,()=>{return})},[]);let G=N?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),G?n("button",{type:"button",className:"secondary",onClick:()=>V({name:void 0}),children:[e(s,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:G?t("Registered skills and their carriers. A skill a knight wrote can be edited here; the others are read-only."):t("Registered skills and their carriers; ask a knight on Discord to edit their contents.")}),c?e(m,{message:c}):null,!d&&!c?e(S,{}):null,d?.length===0?e(k,{children:t("No skills.")}):null,d?.map((C)=>e(R,{skill:C,onEdit:G&&C.source.kind==="written"?()=>V({name:C.name}):void 0,onDelete:G&&C.source.kind==="written"?()=>w(C):void 0},`${C.name}:${a}`)),G?e(B,{catalog:d??[],onChanged:()=>i((C)=>C+1)}):null,v?e(T,{fallback:null,children:e(I,{name:v.name,onSaved:()=>i((C)=>C+1),onClose:()=>V(void 0)},v.name??"")}):null,e(D,{open:h!==void 0,title:t("Delete this skill?"),confirmLabel:t("Delete skill"),tone:"danger",onClose:()=>w(void 0),onConfirm:async()=>{if(!h)return;await de.deleteSkillDocument(h.name),i((C)=>C+1),f(t("Deleted {name}.",{name:h.name}))},children:h?e(M,{skill:h}):null})]})}function M({skill:a}){return n(g,{children:[e("p",{children:a.carriers.length?t("{name} will be deleted and taken from the knights that carry it: {carriers}.",{name:a.name,carriers:a.carriers.join(", ")}):t("{name} will be deleted. No knight carries it.",{name:a.name})}),a.groups.length?e("p",{children:t("It also leaves the skill groups {groups}.",{groups:a.groups.join(", ")})}):null,e("p",{children:t("This cannot be undone.")})]})}function O(a){switch(a.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:a.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${a.repo}:${a.path}`});default:return}}function R({skill:a,onEdit:i,onDelete:d}){let[c,N]=r(!1),[u,v]=r(),[V,h]=r(),w=a.source.kind==="builtin"?t("Built-in"):a.source.kind==="written"?t("Knight-written"):a.source.kind==="package"?a.source.package:`${a.source.repo}:${a.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.name}),e(Q,{children:w}),a.missing?e(Q,{tone:"warn",children:t("File missing")}):n(g,{children:[i?e("button",{type:"button",className:"secondary",onClick:i,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(N(!0),!u)h(void 0),y.skill(a.name).then(v).catch((G)=>h(l(G)))},children:"SKILL.md"})]}),d?e("button",{type:"button",className:"secondary",onClick:d,children:t("Delete")}):null]}),e("p",{children:a.missing??a.description}),a.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(s,{name:"lock",size:14}),e("span",{children:O(a.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",a.source.kind==="builtin"?t("All knights"):a.carriers.join(", ")||t("None")]}),a.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",a.groups.join(", ")]}):null,e(H,{open:c,title:a.name,size:"wide",onClose:()=>N(!1),children:V?e(m,{message:V}):!u?e(S,{}):e(K,{title:a.name,detail:u})})]})}function K({title:a,detail:i}){let d=i.metadata.filter((c)=>!(c.key==="name"&&c.value===a));return n("div",{className:"skill-document",children:[d.length?e("dl",{className:"skill-meta",children:d.map((c)=>n(so,{children:[e("dt",{children:c.key}),e("dd",{children:c.value})]},c.key))}):null,e(x,{source:i.body})]})}export{we as SkillsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t,g,e,n,
|
|
1
|
+
import{t,g,e,n,s,u}from"./chunk-index-rvatmx8s.js";import{Us}from"./chunk-index-6f4qvp5p.js";import{B}from"./chunk-index-fw6kawhw.js";var l=`
|
|
2
2
|
.line.start-over {
|
|
3
3
|
flex-wrap: wrap;
|
|
4
4
|
margin-top: var(--space-4);
|
|
@@ -13,4 +13,4 @@ import{t,g,e,n,o,u}from"./chunk-index-s356ybxk.js";import{sa}from"./chunk-index-
|
|
|
13
13
|
margin-top: var(--space-6);
|
|
14
14
|
font-size: var(--text-sm);
|
|
15
15
|
}
|
|
16
|
-
`;function p(a){
|
|
16
|
+
`;function p(a){B("start-over",l);let{message:o}=a,i=u((m)=>{let r=m.rooms[o.room];return r?.messages.at(-1)?.id===o.id&&r.pending.length===0&&r.live.length===0});return n(g,{children:[n("li",{className:"line start-over","data-enter":a.enter||void 0,children:[e(s,{name:"reset",size:14}),e("span",{children:t("Conversation started over")}),e("button",{type:"button",className:"link-button",onClick:()=>Us(o.room,o.id),children:t("View the archived conversation")})]}),i?e("li",{className:"line start-over-empty",children:e("span",{children:t("No messages yet. Say hello.")})}):null]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C,a,r,t,F,g,e,n,s,x,X,Me,Xe,u,Ve,rn,Mn,et,Ae,It,$e,on}from"./chunk-index-rvatmx8s.js";import{me}from"./chunk-index-tfgd7vr5.js";import{Ni}from"./chunk-index-vw592m3p.js";import"./chunk-index-e3encn5p.js";import{bn,dr}from"./chunk-index-vwd5drzh.js";import{Ai}from"./chunk-index-6j75embz.js";import{$i}from"./chunk-index-n92zea3s.js";import{Jt}from"./chunk-index-qb41kkt3.js";import{Sa}from"./chunk-index-g3f1sdw0.js";bn();var L=(o)=>o==="pinned"||o==="rest"?Ae(o):o==="waiting"||o==="home"?void 0:o;function S(){let o=u((f)=>JSON.stringify(Sa(f,(l)=>Xe(f,l),(l)=>Me(f,l)>0,!0).map((l)=>({id:l.id,...l.title===void 0?{}:{title:l.title},entries:l.keys.map((w)=>({key:w,name:f.rooms[w]?.view?.displayName??w,waiting:Me(f,w)>0}))})))),d=Ni(),p=a(o);if(!d)p.current=o;let h=p.current;return C(()=>JSON.parse(h),[h])}function K(o){let{key:d,name:p}=o.entry,h=u((c)=>c.rooms[d]),f=u((c)=>Me(c,d)),l=h?.view,w=et(l?.character),b=Jt(()=>rn(d,o.onLeave),o.liftable&&!l?.home?$i(d):void 0);if(!l)return null;return e("li",{...o.liftable&&!l.home?{"data-drop-item":"","data-key":d}:{},children:n("a",{className:"switcher-row",...b,href:x("room",d),"aria-current":d===o.current?"page":void 0,style:w,onClick:(c)=>{if(c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||c.altKey)return;c.preventDefault(),o.onPick(d)},children:[n("span",{className:"switcher-picture",children:[e($e,{view:l,size:40}),f?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:p}),h?.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(on,{room:d}),f?e("span",{className:"badge badge-warn",children:F(f,"{count} card waiting","{count} cards waiting")}):null,l.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,h?.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,h?.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 _(o){let[d,p]=r(""),h=S(),f=It(),l=me((i)=>i.unread),w=h.map((i)=>({...i,entries:i.entries.filter((m)=>Ai(d,m.name)!==void 0)})).filter((i)=>i.entries.length>0||d===""),b=w.filter((i)=>i.entries.length>0).length>1,c=w.map((i)=>{let m=L(i.id),y=b&&d===""&&m!==void 0&&i.entries.length>0&&f.has(m);return{...i,fold:m,folded:y,total:i.entries.length,entries:y?i.entries.filter((N)=>N.key===o.current||N.waiting||(l[N.key]??0)>0):i.entries}}),k=(i)=>o.close(i===o.current?void 0:()=>X("room",i)),z=h.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),v=(i)=>i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?z:i.title??t("Rooms");return n(g,{children:[n("div",{className:"switcher-search",children:[e(s,{name:"search",size:16}),e("input",{type:"search",value:d,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>p(i.target.value),onKeyDown:(i)=>{let m=c.flatMap((y)=>y.entries)[0];if(i.key==="Enter"&&m&&!Ve(i.nativeEvent))k(m.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>Mn(i.currentTarget,o.close),children:e(s,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:c.map((i)=>{let m=i.id==="waiting",y=i.id==="pinned"?"pinned":i.id==="rest"?"rest":m||i.id==="home"?void 0:"folder";return n("section",{"aria-label":m?t("Waiting for you"):v(i),...i.total===0?{"data-empty":""}:{},...y?{"data-drop-zone":y,"data-zone-id":i.id,...y==="folder"?{"data-folder":i.id}:{}}:{},children:[m?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):b||i.total===0?e("h2",{className:"switcher-heading",children:i.fold&&i.total>0?e(dr,{id:i.fold,name:v(i),open:!i.folded,controls:`switcher-body-${i.id}`,count:i.folded?i.total:void 0}):v(i)}):null,e("ul",{className:"switcher-list",id:`switcher-body-${i.id}`,children:i.entries.map((N)=>e(K,{entry:N,current:o.current,onPick:k,onLeave:o.close,liftable:!m&&i.id!=="home"},N.key))})]},i.id)})})]})}export{_ as SwitcherList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O,
|
|
1
|
+
import{O,sa,ai}from"./chunk-index-rvatmx8s.js";import{Ro,Co}from"./chunk-index-tfgd7vr5.js";import{ir,ls}from"./chunk-index-ptvrkv0r.js";import"./chunk-index-37g8ggry.js";var c=64;async function m(s){let a=new Image;a.src=s,await a.decode();let r=document.createElement("canvas");r.width=r.height=c;let t=r.getContext("2d");if(!t)throw Error("the page has no 2d canvas");t.drawImage(a,0,0,c,c);let i=c*0.175,o=c-i-2,e=i+2;return t.fillStyle="#ffffff",t.beginPath(),t.arc(o,e,i+2.5,0,Math.PI*2),t.fill(),t.fillStyle="#ef4444",t.beginPath(),t.arc(o,e,i,0,Math.PI*2),t.fill(),r.toDataURL("image/png")}var u=()=>[...document.head.querySelectorAll('link[rel~="icon"]')];function g(s){let a=new Map,r=!1,t=0,i=(e)=>{if(e.dataset.plainHref===void 0)return;if(e.setAttribute("href",e.dataset.plainHref),e.dataset.plainType)e.type=e.dataset.plainType;else e.removeAttribute("type");if(e.dataset.plainSizes)e.setAttribute("sizes",e.dataset.plainSizes);else e.removeAttribute("sizes");delete e.dataset.plainHref,delete e.dataset.plainType,delete e.dataset.plainSizes},o=async()=>{let e=++t,p=s.count()>0;if(p===r)return;if(!p){for(let n of u())i(n);r=!1;return}let l=u(),d=(l.find((n)=>n.dataset.plainHref===void 0&&n.type==="image/png")??l[0])?.href;if(!d)return;let f=a.get(d);if(!f)f=s.render(d),a.set(d,f);let b=await f.catch((n)=>{a.delete(d),console.warn("the tab icon's dot failed to draw",n);return});if(!b||e!==t)return;for(let n of u()){if(n.dataset.plainHref===void 0)n.dataset.plainHref=n.getAttribute("href")??"",n.dataset.plainType=n.type,n.dataset.plainSizes=n.getAttribute("sizes")??"";n.href=b,n.type="image/png",n.removeAttribute("sizes")}r=!0};s.subscribe(()=>void o()),o()}function T(){let s=()=>ir().badge+Co(),a=()=>sa(s());g({count:()=>ai(O.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};O.subscribe(t),ls(t),Ro(t)},render:m}),a()}export{T as startPageTabDot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qe,o,r,t,e,n,s,X,u,lt}from"./chunk-index-rvatmx8s.js";import{Ji,Un,vi,ss,dn,xi,Vn,er,Ur}from"./chunk-index-x7p6k52w.js";import"./chunk-index-qwztcbjz.js";import"./chunk-index-zr2qwzz4.js";import"./chunk-index-gpaychmm.js";import"./chunk-index-tfgd7vr5.js";import"./chunk-index-r1g24er0.js";import"./chunk-index-0dyf2gdm.js";import{xs,Mi,Ss}from"./chunk-index-39gw0qhr.js";Ji();function y(){return ss((Qe(lt)?.kinds??[]).map((a)=>a.kind)),null}function v({focus:a}){let[l,p]=r(),m=dn(void 0),i=Un(),b=i.loaded&&m.length===0;return o(()=>{if(a&&i.loaded)X("table",void 0,{replace:!0})},[a,i.loaded]),n("div",{className:"table-page",children:[n("header",{className:"page-head",children:[e("h1",{children:t("Round table")}),n("div",{className:"table-tools",children:[l?.kind==="webgl"?e("button",{type:"button",className:"icon-button","aria-label":t("Reset view"),title:t("Reset view"),onClick:()=>l.focus(null),children:e(s,{name:"reset"})}):null,e("button",{type:"button",className:"secondary",onClick:()=>X("rooms"),children:t("All rooms")})]})]}),n("div",{className:"table-frame",children:[b?n("div",{className:"table-empty-state",children:[e("strong",{children:t("The table is empty")}),e("p",{className:"meta",children:t("There are no rooms to seat yet.")})]}):e(Vn,{onHandle:p,onSeat:(f)=>{let c=m.find((d)=>d.name===f);if(c)X("room",c.key)},onFocus:(f)=>{let c=m.find((d)=>d.name===f);if(c)X("room",c.key)}}),e(y,{})]})]})}function N({named:a}){let l=Mi(),p=xs(),m=u((g)=>g.listed),i=Ss(l,p,a),b=xi(),{ask:f,sheet:c}=er(i),d=a===void 0||l.some(k(a));o(()=>{if(a!==void 0&&m&&!d)X("table",void 0,{replace:!0})},[a,m,d]);let h=n("div",{className:"table-empty-state",children:[e("strong",{children:i?t("The council is empty"):t("No council yet")}),e("p",{className:"meta",children:i?t("Every member of this council is gone. Edit who sits."):t("A council is a group of up to {max} knights who answer in turn.",{max:8})}),b.length>0?e("button",{type:"button",onClick:f,children:i?t("Edit this council"):t("Pick who sits")}):null]});if(i)return n("section",{className:"room council-page",children:[e(Ur,{roomKey:i.key,empty:h}),c]});return n("div",{className:"table-page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Round table")})}),e("div",{className:"table-frame",children:h}),c]})}var k=(a)=>(l)=>l.key===a||l.name===a;function F({focus:a}){return vi()?e(v,{focus:a}):e(N,{named:a})}export{F as TablePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Gn,Zr,Wr,Rt,mn,gn,Ti,Os}from"./chunk-index-pz6926p5.js";import"./chunk-index-r1g24er0.js";import{Et,Wt}from"./chunk-index-0xdptr30.js";var ye="http://www.w3.org/2000/svg",t=(d,s={},y)=>{let k=document.createElementNS(ye,d);for(let[S,G]of Object.entries(s))k.setAttribute(S,String(G));return y?.appendChild(k),k},ne=(d)=>{let s=/<svg[^>]*\swidth=/.test(d)?d:d.replace("<svg",'<svg width="256" height="256"');return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`},xe=0;function we(d,s){let y=s||d<=6?1:2;return{rows:y,perRow:Math.max(1,Math.ceil(d/y))}}function Ee(d,s){let y=`t2d${++xe}`,k=window.matchMedia("(prefers-reduced-motion: reduce)"),S=s.reducedMotion==="auto"||s.reducedMotion===void 0?k.matches:s.reducedMotion,G=s.labels??Wt,{theme:z,scheme:q}=s,v=[],B=new Map,A=new Map,R=new Map,N=new Map,C=s.focus??null,E=document.createElement("div");E.className="t2d";let m=t("svg",{role:"group","aria-label":G.table});if(E.appendChild(m),getComputedStyle(d).position==="static")d.style.position="relative";d.appendChild(E);function ie(e,r,a){let o=Math.max(1.6,a*0.022),u=o+Math.max(1.2,a*0.014),l=t("filter",{id:`${y}-rim`,x:"-15%",y:"-15%",width:"130%",height:"130%"},e);t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:u,result:"far"},l),t("feFlood",{"flood-color":r.ink,result:"ink"},l),t("feComposite",{in:"ink",in2:"far",operator:"in",result:"line"},l),t("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:o,result:"near"},l),t("feFlood",{"flood-color":r.paper,result:"paper"},l),t("feComposite",{in:"paper",in2:"near",operator:"in",result:"rim"},l);let c=t("feMerge",{},l);for(let b of["line","rim","SourceGraphic"])t("feMergeNode",{in:b},c)}function x(){let e=Gn(z,q);E.classList.toggle("reduced",S),E.classList.toggle("focus",C!==null),E.classList.toggle("dim",v.some((i)=>R.get(i.id)==="speaking"));let r=s.variant==="compact",a=Math.max(d.clientWidth,200),o=Math.max(d.clientHeight,r?60:200);m.setAttribute("viewBox",`0 0 ${a} ${o}`),m.replaceChildren();let u=Math.max(v.length,1),{rows:l,perRow:c}=we(u,r);t("rect",{width:a,height:o,fill:e.css.bg},m);let b=t("defs",{},m),T=a/2,O=r?o*0.82:o*0.62;if(t("ellipse",{cx:T,cy:O,rx:a*0.47,ry:r?o*0.2:o*0.34,fill:e.css.floor,stroke:e.ink,"stroke-width":2},m),!r)t("ellipse",{cx:T,cy:O,rx:a*0.3,ry:o*0.2,fill:"none",stroke:e.css.ring,"stroke-width":3,opacity:e.night?0.9:0.7},m);let I=a/c,V=r?o*0.95:o/(l+0.6),se=r?(o*0.92-6)/1.54:132,g=Math.max(46,Math.min(I*0.94,132,V*1.05,se)),h=g*0.72,n=g*1.05;ie(b,e,n),v.forEach((i,w)=>{let M=t("radialGradient",{id:`${y}-h${w}`},b);t("stop",{offset:0,"stop-color":i.color,"stop-opacity":0.95},M),t("stop",{offset:1,"stop-color":i.color,"stop-opacity":0},M)});let ae=(i)=>{if(r)return o*0.92;return l===1?o*0.62:o*(0.46+i*0.3)};if(v.forEach((i,w)=>{let M=Math.floor(w/c),le=Math.min(c,u-M*c),ce=w-M*c,de=a/le*(ce+0.5),fe=ae(M),F=R.get(i.id)??"idle",f=t("g",{class:"seat","data-seat":i.id,"data-state":F,...C===i.id?{"data-focus":""}:{},transform:`translate(${de.toFixed(1)} ${fe.toFixed(1)})`,tabindex:s.listBelow?-1:0,role:"button","aria-label":G.seat(i.name,F),color:e.css.text,...s.listBelow?{"aria-hidden":"true"}:{}},m);t("ellipse",{cx:0,cy:3,rx:g*0.55,ry:g*0.1,fill:"#000",opacity:0.35},f),t("ellipse",{class:"halo",cx:0,cy:-h-n*0.35,rx:n*0.8,ry:n*0.8,fill:`url(#${y}-h${w})`},f),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:i.color,opacity:0.2},f);let _=t("g",{class:"lift"},f),Z=B.get(i.id);if(Z){let p={x:-n/2,y:-h-n*0.78,width:n,height:n*0.88,filter:`url(#${y}-rim)`};t("image",{href:ne(Z),...p,...i.dim?{opacity:0.55}:{}},_);let oe=A.get(i.id);if(F==="speaking"&&oe&&!S){let he=t("image",{class:"talk",href:ne(oe),...p,opacity:0},_),{frames:ue,seconds:pe}=Os(w);t("animate",{attributeName:"opacity",values:ue.join(";"),dur:`${pe.toFixed(3)}s`,calcMode:"discrete",repeatCount:"indefinite"},he)}}else{t("circle",{cx:0,cy:-h-n*0.3,r:n*0.3,fill:i.color,stroke:e.ink,"stroke-width":2},_);let p=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":Rt},_);p.textContent=Array.from(i.name)[0]?.toUpperCase()??"?"}let J=h*0.22;t("path",{d:`M ${-g*0.5} ${-h} L ${g*0.5} ${-h} L ${g*0.42} 0 L ${-g*0.42} 0 Z`,fill:e.wood,stroke:e.ink,"stroke-width":2,"stroke-linejoin":"round"},f),t("rect",{x:-g*0.54,y:-h-J*0.2,width:g*1.08,height:J,rx:2,fill:e.woodLight,stroke:e.ink,"stroke-width":2},f);let L=Math.max(11,Math.min(15,g*0.14)),j=Math.min(Math.max(g*0.9,L*5.5+14),Math.max(g*0.9,i.name.length*L*0.62+18),I*0.98),me=L+8;t("rect",{class:"plate",x:-j/2,y:-h*0.78,width:j,height:me,rx:3,fill:e.gold,stroke:e.ink,"stroke-width":2},f);let ge=t("text",{x:0,y:-h*0.78+L+1.5,"text-anchor":"middle","font-size":L,"font-weight":700,"font-family":Rt,fill:e.plateInk},f),Q=N.get(i.id);ge.textContent=Wr(Q?`${Q} ${i.name}`:i.name,(j-8)/L);let ee=t("g",{class:"badge"},t("g",{transform:`translate(${n*0.4} ${-h-n*0.78})`},f)),D=F==="done",P=F==="error",U=e.gold;if(D)U=Zr.done;else if(P)U=Zr.error;t("circle",{r:n*0.15,fill:U,stroke:e.ink,"stroke-width":2},ee);let W=t("text",{x:0,y:n*0.06,"text-anchor":"middle","font-size":n*0.2,"font-weight":800,"font-family":Rt,fill:D||P?"#fff":e.ink},ee);if(W.textContent="!",D)W.textContent="✓";else if(P)W.textContent="✕";let te=t("g",{class:"orbit"},f);t("circle",{cx:n*0.4,cy:-h-n*0.5,r:n*0.05,fill:i.color},te),t("circle",{cx:-n*0.4,cy:-h-n*0.5,r:n*0.035,fill:i.color,opacity:0.6},te),f.addEventListener("click",(p)=>s.onSeatClick({id:i.id,name:i.name,at:Et(p,f)})),f.addEventListener("keydown",(p)=>{if(p.key==="Enter"||p.key===" ")p.preventDefault(),s.onSeatClick({id:i.id,name:i.name,at:Et({clientX:0,clientY:0,detail:0},f)})})}),!r){let i=Math.min(a*0.34,190),w=o-6;t("rect",{x:T-i/2,y:w-22,width:i,height:22,rx:4,fill:e.wood,stroke:e.ink,"stroke-width":2},m);let M=t("text",{x:T,y:w-7,"text-anchor":"middle","font-size":12,"font-weight":700,"font-family":Rt,fill:e.gold},m);M.textContent=Wr(s.ownerName??"You",12)}}let H=new Set,re=(e,r)=>{if(e.mode==="cut")return;let a=Gn(z,q),o=(u,l)=>{let c=setTimeout(()=>{H.delete(c),u()},l);H.add(c)};for(let u of e.joining){let l=[...m.querySelectorAll("g.seat[data-seat]")].find((c)=>c.getAttribute("data-seat")===u);if(!l)continue;l.classList.add("seat-in"),l.prepend(t("ellipse",{class:"seat-ring",rx:44,ry:12,cy:4,stroke:a.css.ring})),o(()=>{l.classList.remove("seat-in"),l.querySelector(".seat-ring")?.remove()},gn)}for(let u of e.leaving){let l=r.get(u);if(!l)continue;let c=l.cloneNode(!0);c.classList.add("seat-out");for(let b of["data-seat","tabindex","role","aria-label"])c.removeAttribute(b);c.setAttribute("aria-hidden","true");for(let[b,[T,O,I]]of[[-26,-24,20],[24,-20,22],[0,-52,24],[-4,-4,26]].entries()){let V=t("circle",{class:"puff",cx:T,cy:O,r:I,fill:a.paper,stroke:a.ink,"stroke-width":3},c);V.style.animationDelay=`${b*40}ms`}m.appendChild(c),o(()=>c.remove(),mn)}},Y=new ResizeObserver(x);Y.observe(d);let X=()=>{if(s.reducedMotion==="auto"||s.reducedMotion===void 0)K.setReducedMotion(k.matches)};k.addEventListener("change",X);let K={kind:"svg",setTheme(e,r){z=e,q=r,x()},setSeats(e){let r=v.map((o)=>o.id),a=new Map([...m.querySelectorAll("g.seat[data-seat]")].map((o)=>[o.getAttribute("data-seat")??"",o]));v=e;for(let o of e){if(R.set(o.id,o.state??"idle"),o.avatarSvg)B.set(o.id,o.avatarSvg);if(o.talkSvg)A.set(o.id,o.talkSvg);else A.delete(o.id)}if(x(),r.length>0||a.size>0)re(Ti(r,e.map((o)=>o.id),S),a)},setState(e,r){if(R.get(e)===r)return;R.set(e,r),x()},setMark(e,r){if((N.get(e)??null)===r)return;if(r===null)N.delete(e);else N.set(e,r);x()},setAvatar(e,r,a){if(B.set(e,r),a)A.set(e,a);else A.delete(e);return x(),Promise.resolve()},setReducedMotion(e){S=e,x()},resetCamera(){C=null,x(),s.onFocus?.(null)},focus(e){if(e===C)return;C=e,x()},focused:()=>C,getStats(){return{kind:"svg",fps:0,frameMs:0,frameMsMax:0,drawCalls:0,triangles:0,textures:0,geometries:0,dpr:1,lowPower:!1,reduced:S,loop:"idle",seats:v.length,renders:0}},dispose(){for(let e of H)clearTimeout(e);H.clear(),Y.disconnect(),k.removeEventListener("change",X),E.remove()}};return K.setSeats(s.seats),K}export{Ee as createTable2D};
|