pi-roundtable-web 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +23 -7
  3. package/dist/chunk-account-678dgbww.js +1 -0
  4. package/dist/chunk-action-menu-qpp9bdxh.js +1 -0
  5. package/dist/chunk-agent-x0yvvdq2.js +1 -0
  6. package/dist/chunk-arranged-rooms-6rdkk8t1.js +1 -0
  7. package/dist/chunk-bulk-actions-zbwdaxtc.js +1 -0
  8. package/dist/chunk-character-creator-215psy17.js +1 -0
  9. package/dist/chunk-codeeditor-jgj32247.js +2 -0
  10. package/dist/chunk-confirm-2pzrt272.js +1 -0
  11. package/dist/chunk-connectors-zha2d834.js +37 -0
  12. package/dist/chunk-conversations-fb071rez.js +1 -0
  13. package/dist/chunk-council-sheet-k5fycefd.js +2 -0
  14. package/dist/chunk-drag-04qfef58.js +1 -0
  15. package/dist/chunk-entry-mws704mc.js +1 -0
  16. package/dist/chunk-folder-list-qxhmczwv.js +1 -0
  17. package/dist/chunk-folds-b7asegfs.js +1 -0
  18. package/dist/chunk-gate-vxetvn8t.js +1 -0
  19. package/dist/chunk-group-scene-63yhh1mh.js +1 -0
  20. package/dist/chunk-group-table-zy4hmgk3.js +1 -0
  21. package/dist/chunk-host-icons-tyktazzz.js +1 -0
  22. package/dist/chunk-host-picture-ebhejn2k.js +1 -0
  23. package/dist/chunk-host-state-wajep0yr.js +1 -0
  24. package/dist/chunk-host-ui-pc9r24e3.js +1 -0
  25. package/dist/chunk-index-1af8vsyb.js +2 -0
  26. package/dist/{chunk-index-g1awv7rk.js → chunk-index-20xgx0k2.js} +2 -2
  27. package/dist/chunk-index-254701sm.js +3 -0
  28. package/dist/{chunk-index-ffbrm6tr.js → chunk-index-2822z600.js} +3 -3
  29. package/dist/{chunk-index-2fdns8tn.js → chunk-index-2hvn2kte.js} +2 -2
  30. package/dist/chunk-index-2syyyjnq.js +2 -0
  31. package/dist/chunk-index-2tr41qht.js +2 -0
  32. package/dist/chunk-index-2y8r4s4f.js +2 -0
  33. package/dist/chunk-index-31m1b2f5.js +2 -0
  34. package/dist/{chunk-index-ak6ecqy3.js → chunk-index-3gfbhmpb.js} +2 -2
  35. package/dist/chunk-index-3yy10a5h.js +2 -0
  36. package/dist/{chunk-index-sm7m4fej.js → chunk-index-4t6vnwap.js} +2 -2
  37. package/dist/{chunk-index-j4x9dq30.css → chunk-index-5hbq6g2e.css} +1 -1
  38. package/dist/chunk-index-5t2jkecy.js +2 -0
  39. package/dist/chunk-index-5vatmakn.js +2 -0
  40. package/dist/{chunk-index-zyvwhxga.js → chunk-index-6cg8xp1c.js} +1 -1
  41. package/dist/chunk-index-6yra9kdq.js +2 -0
  42. package/dist/{chunk-index-ac1ktr56.js → chunk-index-7qd604rq.js} +2 -2
  43. package/dist/chunk-index-9bdstf8t.js +2 -0
  44. package/dist/chunk-index-acj4xxgq.js +100 -0
  45. package/dist/chunk-index-aexy023z.js +2 -0
  46. package/dist/chunk-index-amxa2bn3.js +2 -0
  47. package/dist/chunk-index-bef0fc2m.js +2 -0
  48. package/dist/chunk-index-c6tphrjr.js +1 -0
  49. package/dist/chunk-index-c7dbvkrq.js +2 -0
  50. package/dist/chunk-index-cn49mawx.js +50 -0
  51. package/dist/{chunk-index-3d8s3565.js → chunk-index-e2gy763y.js} +2 -2
  52. package/dist/{chunk-index-31x6krbs.js → chunk-index-e35v554x.js} +3 -3
  53. package/dist/chunk-index-fepsbhr6.js +47 -0
  54. package/dist/chunk-index-gcmmwh8t.js +2 -0
  55. package/dist/{chunk-index-kbrg32sx.js → chunk-index-gwkhs8s3.js} +2 -2
  56. package/dist/chunk-index-h2vhv4kh.js +2 -0
  57. package/dist/chunk-index-h9ccz1r3.js +2 -0
  58. package/dist/{chunk-index-0w4bfjb5.js → chunk-index-jc3r4qam.js} +2 -2
  59. package/dist/{chunk-index-8d81qy69.js → chunk-index-m81362sc.js} +2 -2
  60. package/dist/{chunk-index-xq84gg8w.js → chunk-index-n0cmnwd2.js} +2 -2
  61. package/dist/chunk-index-n0ejy0wd.js +2 -0
  62. package/dist/chunk-index-nkdg1dfz.js +7 -0
  63. package/dist/chunk-index-p7jkr7gv.js +14 -0
  64. package/dist/{chunk-index-e2dqjde8.js → chunk-index-q5fyrtx4.js} +1 -1
  65. package/dist/{chunk-index-jgzygbt8.js → chunk-index-qxynr1hf.js} +2 -2
  66. package/dist/chunk-index-r7fdgzy1.js +2 -0
  67. package/dist/chunk-index-rgf4rvns.js +4 -0
  68. package/dist/chunk-index-rsd8rftk.js +2 -0
  69. package/dist/{chunk-index-rh0x9rzf.js → chunk-index-s53bxwkk.js} +2 -2
  70. package/dist/{chunk-index-xxeb2xp0.js → chunk-index-s9p27f9b.js} +3 -3
  71. package/dist/chunk-index-sdcpf5dp.js +2 -0
  72. package/dist/chunk-index-sm7kfb07.js +2 -0
  73. package/dist/chunk-index-sw9r4aa4.js +2 -0
  74. package/dist/chunk-index-t5bmsqqd.js +1 -0
  75. package/dist/chunk-index-v8mma5np.js +2 -0
  76. package/dist/{chunk-index-q7g62sgm.js → chunk-index-v9gbt5tz.js} +3 -3
  77. package/dist/chunk-index-vsfsv8hd.js +2 -0
  78. package/dist/chunk-index-wxft0aqb.js +2 -0
  79. package/dist/chunk-index-x60n1me6.js +2 -0
  80. package/dist/chunk-index-zcfr8jdv.js +13 -0
  81. package/dist/{chunk-index-w42rcbx1.js → chunk-index-zj0gjcvr.js} +2 -2
  82. package/dist/{chunk-index-2t30xwed.js → chunk-index-zt19fdmc.js} +2 -2
  83. package/dist/chunk-index-zvvwxkev.js +2 -0
  84. package/dist/chunk-lang-css-7q1dtpgm.js +1 -0
  85. package/dist/{chunk-lang-dockerfile-cnwqn660.js → chunk-lang-dockerfile-n4bt8jbt.js} +1 -1
  86. package/dist/{chunk-lang-go-yy6kgsxv.js → chunk-lang-go-9k4y107e.js} +3 -3
  87. package/dist/chunk-lang-html-xgvba8rn.js +1 -0
  88. package/dist/chunk-lang-javascript-vgxmgd0a.js +1 -0
  89. package/dist/chunk-lang-json-hr12bzs1.js +1 -0
  90. package/dist/chunk-lang-markdown-ttzcpgkg.js +6 -0
  91. package/dist/chunk-lang-python-ntj8maem.js +3 -0
  92. package/dist/chunk-lang-rust-gv8y859d.js +1 -0
  93. package/dist/{chunk-lang-shell-1rpgtepw.js → chunk-lang-shell-5zzs09b7.js} +1 -1
  94. package/dist/chunk-lang-sql-6vmze4pg.js +2 -0
  95. package/dist/{chunk-lang-toml-tbj7467c.js → chunk-lang-toml-tt0d4rw9.js} +1 -1
  96. package/dist/chunk-lang-typescript-2v652sh5.js +1 -0
  97. package/dist/chunk-lang-xml-r2sbqnjv.js +1 -0
  98. package/dist/chunk-lang-yaml-ex31qbph.js +1 -0
  99. package/dist/chunk-layout-actions-bfqtg71d.js +1 -0
  100. package/dist/chunk-menu-items-rztgekfj.js +1 -0
  101. package/dist/chunk-mode-toggle-m5kgb7c7.js +1 -0
  102. package/dist/chunk-note-row-40ypghn9.js +204 -0
  103. package/dist/chunk-notes-a8nqffbf.js +1 -0
  104. package/dist/chunk-notice-bell-rdnfmtf2.js +1 -0
  105. package/dist/{chunk-notices-fte9f196.js → chunk-notices-tefx93s6.js} +1 -1
  106. package/dist/chunk-onboarding-wvh0s3vg.js +1 -0
  107. package/dist/chunk-overview-zrx3bpwf.js +1 -0
  108. package/dist/chunk-palette-5xtdvy9a.js +1 -0
  109. package/dist/chunk-placement-items-rgyrktvy.js +1 -0
  110. package/dist/chunk-profile-tyb48b79.js +1 -0
  111. package/dist/chunk-prompt-history-wv0vdsjv.js +1 -0
  112. package/dist/chunk-prompts-75hgb0t0.js +1 -0
  113. package/dist/chunk-room-confirms-bcvhpcry.js +1 -0
  114. package/dist/chunk-room-menu-ha1evv71.js +1 -0
  115. package/dist/chunk-rooms-menu-button-ej3a2hyc.js +1 -0
  116. package/dist/chunk-schedules-a5pewkhd.js +1 -0
  117. package/dist/{chunk-seat-menu-r0k0eawr.js → chunk-seat-menu-eh3ymmks.js} +1 -1
  118. package/dist/chunk-sheet-hosts-d5zbwbbr.js +29 -0
  119. package/dist/{chunk-shortcut-help-a6pkjcq7.js → chunk-shortcut-help-bh9ntk9s.js} +2 -2
  120. package/dist/{chunk-shortcuts-cgt87jkz.js → chunk-shortcuts-6em0atk9.js} +1 -1
  121. package/dist/chunk-skill-editor-e43mwz01.js +8 -0
  122. package/dist/chunk-skills-vp107wrp.js +1 -0
  123. package/dist/chunk-start-over-line-xd1v2p0g.js +16 -0
  124. package/dist/chunk-switcher-list-dtfh87zy.js +1 -0
  125. package/dist/{chunk-tab-dot-vr11dfrw.js → chunk-tab-dot-qd640mjr.js} +1 -1
  126. package/dist/chunk-table-svb2xhfd.js +1 -0
  127. package/dist/chunk-table2d-5nrhfwft.js +1 -0
  128. package/dist/chunk-table3d-5cb66d99.js +4220 -0
  129. package/dist/chunk-thread-actions-926eab0w.js +1 -0
  130. package/dist/{chunk-thread-cards-c2mrp2gj.js → chunk-thread-cards-kgt22sbp.js} +1 -1
  131. package/dist/chunk-thread-list-j2v1pqkz.js +217 -0
  132. package/dist/chunk-transcript-a0p3vwh6.js +1 -0
  133. package/dist/chunk-waiting-cdyz7r1g.js +1 -0
  134. package/dist/chunk-waiting-chip-58ttx9av.js +28 -0
  135. package/dist/chunk-where-9jp6g029.js +1 -0
  136. package/dist/chunk-workspace-d34njy4p.js +578 -0
  137. package/dist/chunk-zh-tw-y3jb20wc.js +1 -0
  138. package/dist/index.html +1 -1
  139. package/dist/sw.js +1 -1
  140. package/package.json +3 -3
  141. package/src/api-types.ts +98 -1
  142. package/src/app/app.ts +4 -7
  143. package/src/app/desk.ts +19 -4
  144. package/src/app/room-log.ts +66 -18
  145. package/src/app/rooms.ts +15 -5
  146. package/src/app/routes.ts +60 -9
  147. package/src/app/skill-doc-routes.ts +12 -2
  148. package/src/app/surface.ts +26 -2
  149. package/src/app/team-routes.ts +3 -7
  150. package/src/authz.ts +1 -0
  151. package/src/cleanup-api.ts +9 -2
  152. package/src/connector-manage-api.ts +257 -0
  153. package/src/console-api.ts +60 -2
  154. package/src/features.ts +91 -0
  155. package/src/host/reads.ts +10 -1
  156. package/src/i18n/zh-tw.ts +107 -4
  157. package/src/web-plugin.ts +7 -1
  158. package/dist/chunk-account-1ecx5kt7.js +0 -1
  159. package/dist/chunk-action-menu-zh2n0ahf.js +0 -1
  160. package/dist/chunk-agent-ynm2tcbx.js +0 -1
  161. package/dist/chunk-arranged-rooms-qnz8vese.js +0 -1
  162. package/dist/chunk-bulk-actions-pr0mw0kc.js +0 -1
  163. package/dist/chunk-character-creator-caj4pmg4.js +0 -1
  164. package/dist/chunk-codeeditor-dga6s78p.js +0 -2
  165. package/dist/chunk-confirm-g76v5d9r.js +0 -1
  166. package/dist/chunk-connectors-j79ze3j1.js +0 -1
  167. package/dist/chunk-conversations-2farn72g.js +0 -1
  168. package/dist/chunk-council-sheet-s9sz1bzf.js +0 -2
  169. package/dist/chunk-drag-45e8222r.js +0 -1
  170. package/dist/chunk-entry-q11n47h9.js +0 -1
  171. package/dist/chunk-folder-list-4gcj7g7h.js +0 -1
  172. package/dist/chunk-folds-ten4ykfw.js +0 -1
  173. package/dist/chunk-gate-kcv1a4t0.js +0 -1
  174. package/dist/chunk-group-scene-12ghcvzd.js +0 -1
  175. package/dist/chunk-group-table-t458kdgn.js +0 -1
  176. package/dist/chunk-host-icons-h1k9k96a.js +0 -1
  177. package/dist/chunk-host-picture-3p0wzn3v.js +0 -1
  178. package/dist/chunk-host-state-7mdve7cb.js +0 -1
  179. package/dist/chunk-host-ui-bdgwa6sf.js +0 -1
  180. package/dist/chunk-index-02vfshtt.js +0 -2
  181. package/dist/chunk-index-0a81da8z.js +0 -2
  182. package/dist/chunk-index-12zyshae.js +0 -2
  183. package/dist/chunk-index-18pgxxw3.js +0 -2
  184. package/dist/chunk-index-2e4am3hw.js +0 -50
  185. package/dist/chunk-index-5bfqek1d.js +0 -2
  186. package/dist/chunk-index-64rsz6pf.js +0 -2
  187. package/dist/chunk-index-6bkcq9ka.js +0 -2
  188. package/dist/chunk-index-92zgb7my.js +0 -2
  189. package/dist/chunk-index-aamhjg5n.js +0 -2
  190. package/dist/chunk-index-b73y2gc0.js +0 -47
  191. package/dist/chunk-index-b8cpvr7y.js +0 -2
  192. package/dist/chunk-index-bhqczxr3.js +0 -2
  193. package/dist/chunk-index-cbqhzf40.js +0 -13
  194. package/dist/chunk-index-cdctnw71.js +0 -2
  195. package/dist/chunk-index-dj0tbfyb.js +0 -2
  196. package/dist/chunk-index-dnjftvtq.js +0 -2
  197. package/dist/chunk-index-ebg48jgy.js +0 -2
  198. package/dist/chunk-index-ek5mek4j.js +0 -14
  199. package/dist/chunk-index-f6q0stqx.js +0 -2
  200. package/dist/chunk-index-g3wrs02w.js +0 -1
  201. package/dist/chunk-index-j0m16cj1.js +0 -2
  202. package/dist/chunk-index-j4kk1m59.js +0 -2
  203. package/dist/chunk-index-kb3w11mn.js +0 -7
  204. package/dist/chunk-index-msqhgvfx.js +0 -2
  205. package/dist/chunk-index-pefwfm26.js +0 -2
  206. package/dist/chunk-index-pyfx77cj.js +0 -2
  207. package/dist/chunk-index-qfgkfq86.js +0 -2
  208. package/dist/chunk-index-sv9qpmhv.js +0 -1
  209. package/dist/chunk-index-t998yg8y.js +0 -2
  210. package/dist/chunk-index-tk4se135.js +0 -4
  211. package/dist/chunk-index-v6smgw77.js +0 -2
  212. package/dist/chunk-index-x4enmj72.js +0 -2
  213. package/dist/chunk-lang-css-y9133ktr.js +0 -1
  214. package/dist/chunk-lang-html-r2xmryek.js +0 -1
  215. package/dist/chunk-lang-javascript-1r6wd177.js +0 -1
  216. package/dist/chunk-lang-json-dx56g11y.js +0 -1
  217. package/dist/chunk-lang-markdown-fpcf2dfq.js +0 -6
  218. package/dist/chunk-lang-python-zzp95955.js +0 -3
  219. package/dist/chunk-lang-rust-214fh7sp.js +0 -1
  220. package/dist/chunk-lang-sql-vvp46hpj.js +0 -2
  221. package/dist/chunk-lang-typescript-y5w4tt4g.js +0 -1
  222. package/dist/chunk-lang-xml-tbcqmedk.js +0 -1
  223. package/dist/chunk-lang-yaml-jh56t3sv.js +0 -1
  224. package/dist/chunk-layout-actions-y73mpsh1.js +0 -1
  225. package/dist/chunk-menu-items-bza16bw6.js +0 -2
  226. package/dist/chunk-mode-toggle-nj9gnt3b.js +0 -1
  227. package/dist/chunk-note-row-6fmhrdng.js +0 -75
  228. package/dist/chunk-notes-wv0e6ssf.js +0 -1
  229. package/dist/chunk-notice-bell-9z27epd2.js +0 -1
  230. package/dist/chunk-onboarding-c5twahc3.js +0 -1
  231. package/dist/chunk-overview-k4ccprax.js +0 -1
  232. package/dist/chunk-palette-9rbp2fab.js +0 -1
  233. package/dist/chunk-placement-items-me598wsb.js +0 -1
  234. package/dist/chunk-profile-s7r7fcvz.js +0 -1
  235. package/dist/chunk-prompt-history-hf296e7v.js +0 -1
  236. package/dist/chunk-prompts-c8s0nhkm.js +0 -1
  237. package/dist/chunk-room-confirms-ga2sbvhc.js +0 -1
  238. package/dist/chunk-room-menu-7h4jym2b.js +0 -1
  239. package/dist/chunk-rooms-menu-button-pgtaanb6.js +0 -1
  240. package/dist/chunk-schedules-mbnwcxpc.js +0 -1
  241. package/dist/chunk-sheet-hosts-a5dfevy9.js +0 -1
  242. package/dist/chunk-skill-editor-67yk4x7t.js +0 -8
  243. package/dist/chunk-skills-rewemey4.js +0 -1
  244. package/dist/chunk-switcher-list-t8rbay2y.js +0 -1
  245. package/dist/chunk-table-52nh0azk.js +0 -1
  246. package/dist/chunk-table2d-g57vr6h0.js +0 -1
  247. package/dist/chunk-table3d-rp0w6kt4.js +0 -4220
  248. package/dist/chunk-thread-actions-qcxt1y1g.js +0 -1
  249. package/dist/chunk-thread-list-0071q455.js +0 -217
  250. package/dist/chunk-transcript-789yqysq.js +0 -1
  251. package/dist/chunk-where-hmwmme9e.js +0 -1
  252. package/dist/chunk-workspace-wr1qrtsh.js +0 -578
  253. package/dist/chunk-zh-tw-z5p5mpph.js +0 -1
@@ -0,0 +1,204 @@
1
+ import{p,j,r,t,g,e,n,s,yi,l,Ye,Yt,$t}from"./chunk-index-cn49mawx.js";import{ct}from"./chunk-index-v9gbt5tz.js";var f=!1;function h(){if(f||typeof document>"u")return;if(f=!0,typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype)try{let a=new CSSStyleSheet;a.replaceSync(`
2
+ /* A note is the room's people talking among themselves: a plain, dashed card, never the accent bubble of a message to the agent. */
3
+ .message[data-note] .bubble,
4
+ .message[data-note][data-mine] .bubble {
5
+ border: 1px dashed var(--control-border);
6
+ background: var(--surface-3);
7
+ color: var(--text);
8
+ box-shadow: none;
9
+ }
10
+
11
+ .message[data-note][data-mine] .bubble a,
12
+ .message[data-note][data-mine] .bubble code {
13
+ color: var(--accent);
14
+ }
15
+
16
+ .message[data-note][data-mine] .prose code,
17
+ .message[data-note][data-mine] .prose blockquote {
18
+ background: var(--surface);
19
+ }
20
+
21
+ .message[data-note][data-mine] .code-block pre {
22
+ background: var(--surface);
23
+ border-color: var(--border);
24
+ }
25
+
26
+ .message[data-note][data-mine] .file-chip {
27
+ color: var(--text);
28
+ }
29
+
30
+ .note-chip {
31
+ padding: 0 var(--space-2);
32
+ border-radius: var(--radius-full);
33
+ background: var(--surface-3);
34
+ color: var(--muted);
35
+ font-size: var(--text-xs);
36
+ font-weight: var(--weight-medium);
37
+ }
38
+
39
+ /* A message between agents: one quiet line in the room's flow that opens to the whole text. */
40
+ .line.intercom {
41
+ justify-content: flex-start;
42
+ }
43
+
44
+ .intercom-card {
45
+ max-width: 100%;
46
+ min-width: 0;
47
+ padding: var(--space-1) var(--space-3);
48
+ border: 1px solid var(--border);
49
+ border-radius: var(--radius);
50
+ background: var(--surface-2);
51
+ }
52
+
53
+ .intercom-card > summary,
54
+ div.intercom-card {
55
+ display: flex;
56
+ gap: var(--space-2);
57
+ min-width: 0;
58
+ list-style: none;
59
+ }
60
+
61
+ .intercom-card > summary {
62
+ cursor: pointer;
63
+ }
64
+
65
+ .intercom-card > summary::-webkit-details-marker {
66
+ display: none;
67
+ }
68
+
69
+ .intercom-card > summary::after {
70
+ content: "▸";
71
+ margin-left: auto;
72
+ }
73
+
74
+ .intercom-card[open] > summary::after {
75
+ content: "▾";
76
+ }
77
+
78
+ .intercom-card > summary:hover {
79
+ color: var(--text);
80
+ }
81
+
82
+ .intercom-heading {
83
+ flex: none;
84
+ font-weight: var(--weight-medium);
85
+ }
86
+
87
+ .line[data-intercom="failed"] .intercom-heading {
88
+ color: var(--danger);
89
+ }
90
+
91
+ .intercom-summary {
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ }
96
+
97
+ .intercom-body {
98
+ margin-top: var(--space-2);
99
+ color: var(--text);
100
+ font-size: var(--text-sm);
101
+ }
102
+ `),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a];return}catch{}let i=document.createElement("style");i.textContent=`
103
+ /* A note is the room's people talking among themselves: a plain, dashed card, never the accent bubble of a message to the agent. */
104
+ .message[data-note] .bubble,
105
+ .message[data-note][data-mine] .bubble {
106
+ border: 1px dashed var(--control-border);
107
+ background: var(--surface-3);
108
+ color: var(--text);
109
+ box-shadow: none;
110
+ }
111
+
112
+ .message[data-note][data-mine] .bubble a,
113
+ .message[data-note][data-mine] .bubble code {
114
+ color: var(--accent);
115
+ }
116
+
117
+ .message[data-note][data-mine] .prose code,
118
+ .message[data-note][data-mine] .prose blockquote {
119
+ background: var(--surface);
120
+ }
121
+
122
+ .message[data-note][data-mine] .code-block pre {
123
+ background: var(--surface);
124
+ border-color: var(--border);
125
+ }
126
+
127
+ .message[data-note][data-mine] .file-chip {
128
+ color: var(--text);
129
+ }
130
+
131
+ .note-chip {
132
+ padding: 0 var(--space-2);
133
+ border-radius: var(--radius-full);
134
+ background: var(--surface-3);
135
+ color: var(--muted);
136
+ font-size: var(--text-xs);
137
+ font-weight: var(--weight-medium);
138
+ }
139
+
140
+ /* A message between agents: one quiet line in the room's flow that opens to the whole text. */
141
+ .line.intercom {
142
+ justify-content: flex-start;
143
+ }
144
+
145
+ .intercom-card {
146
+ max-width: 100%;
147
+ min-width: 0;
148
+ padding: var(--space-1) var(--space-3);
149
+ border: 1px solid var(--border);
150
+ border-radius: var(--radius);
151
+ background: var(--surface-2);
152
+ }
153
+
154
+ .intercom-card > summary,
155
+ div.intercom-card {
156
+ display: flex;
157
+ gap: var(--space-2);
158
+ min-width: 0;
159
+ list-style: none;
160
+ }
161
+
162
+ .intercom-card > summary {
163
+ cursor: pointer;
164
+ }
165
+
166
+ .intercom-card > summary::-webkit-details-marker {
167
+ display: none;
168
+ }
169
+
170
+ .intercom-card > summary::after {
171
+ content: "▸";
172
+ margin-left: auto;
173
+ }
174
+
175
+ .intercom-card[open] > summary::after {
176
+ content: "▾";
177
+ }
178
+
179
+ .intercom-card > summary:hover {
180
+ color: var(--text);
181
+ }
182
+
183
+ .intercom-heading {
184
+ flex: none;
185
+ font-weight: var(--weight-medium);
186
+ }
187
+
188
+ .line[data-intercom="failed"] .intercom-heading {
189
+ color: var(--danger);
190
+ }
191
+
192
+ .intercom-summary {
193
+ overflow: hidden;
194
+ text-overflow: ellipsis;
195
+ white-space: nowrap;
196
+ }
197
+
198
+ .intercom-body {
199
+ margin-top: var(--space-2);
200
+ color: var(--text);
201
+ font-size: var(--text-sm);
202
+ }
203
+ `,document.head.append(i)}function N(i){if(!i.startsWith(yi))return[];try{let a=JSON.parse(i.slice(yi.length));return Array.isArray(a)?a.flatMap((o)=>typeof o?.name==="string"&&typeof o?.displayName==="string"?[{name:o.name,displayName:o.displayName}]:[]):[]}catch{return[]}}function y(i){let a=N(i.message.text),o=l((c)=>c.rooms[i.message.room]?.view?.displayName??""),[m,d]=r(!1),u={name:o,count:a.length,names:a.map((c)=>c.displayName).join(", ")};return n("li",{className:"line","data-enter":i.enter||void 0,children:[e(s,{name:"archive",size:14}),e("span",{children:a.length===1?t("{name} archived {count} temp knight: {names}",u):t("{name} archived {count} temp knights: {names}",u)}),e("button",{type:"button",className:"secondary compact",disabled:m,onClick:()=>{d(!0),(p("zbwdaxtc"),import("./chunk-bulk-actions-zbwdaxtc.js")).then((c)=>c.putBackHelpers(a.map((b)=>b.name)))},children:t("Undo")})]})}var S=120;function w(i,a=S){let m=(i.split(`
204
+ `).map((c)=>c.trim()).find((c)=>c!=="")??"").replace(/^#{1,6}\s+/,"");if(m.length<=a)return m;let d=m.charCodeAt(a-2),u=d>=55296&&d<=56319?a-2:a-1;return`${m.slice(0,u)}…`}function x(i){let a=i.peer.displayName;if(i.kind==="sent")return t("→ To {name}",{name:a});if(i.kind==="answered")return t("← From {name}",{name:a});return t("No answer from {name}",{name:a})}var v=j(function(a){let{message:o}=a,m=w(o.text),d=n(g,{children:[e("span",{className:"intercom-heading",children:x(o.intercom)}),m?e("span",{className:"intercom-summary",children:m}):null]});return e("li",{className:"line intercom","data-mid":o.id,"data-intercom":o.intercom.kind,"data-enter":a.enter||void 0,children:m===o.text.trim()?e("div",{className:"intercom-card",children:d}):n("details",{className:"intercom-card",children:[e("summary",{children:d}),e("div",{className:"intercom-body",children:e(Ye,{source:o.text})})]})})});h();var k=j(function(a){let{message:o}=a,m=l((u)=>u.principal?.id),d=o.principalId!==void 0&&o.principalId===m;return n("li",{className:"message","data-mid":o.id,"data-note":!0,"data-mine":d||void 0,"data-header":!0,"data-enter":a.enter||void 0,children:[d?null:e("span",{className:"message-avatar",children:e(ct,{picture:o.principalId===void 0?void 0:{principal:o.principalId},name:o.author})}),n("div",{className:"message-main",children:[n("div",{className:"message-meta",children:[e("strong",{children:o.author}),e("span",{className:"note-chip",children:t("Internal note")}),e("time",{dateTime:o.at,children:Yt(o.at,a.timeZone)})]}),n("div",{className:"bubble",children:[o.text?e(Ye,{source:o.text}):null,e($t,{files:o.files})]})]})]})});function R(i){let{intercom:a}=i.message;if(a)return e(v,{message:{...i.message,intercom:a},enter:i.enter});return i.message.kind==="system"?e(y,{message:i.message,enter:i.enter}):e(k,{...i})}export{R as default};
@@ -0,0 +1 @@
1
+ import{A,o,z,a,r,t,u,e,n,y,d,v,m,k,T,_,ts,J}from"./chunk-index-cn49mawx.js";import{ve}from"./chunk-index-gcmmwh8t.js";import{Te}from"./chunk-index-e35v554x.js";import{ie}from"./chunk-index-sw9r4aa4.js";import"./chunk-index-m81362sc.js";var F=[{kind:"core",label:u("Core"),hint:u("Carried into every turn.")},{kind:"note",label:u("Note"),hint:u("Searched when a knight needs them.")},{kind:"event",label:u("Events"),hint:u("Carried into every turn until their date.")}],B=300;function ae(){let{timeZone:p}=_(),{version:s}=J(),[c,l]=r("core"),[g,D]=r(""),[h,S]=r(),[f,L]=r(),[N,w]=r(),[E,x]=r(),[C,W]=r(),P=ve(()=>y.principals(),"principals").data,V=a(0),K=A(async(i)=>{let b=++V.current;try{let I=await y.notes(i.trim(),C);if(b!==V.current)return;S(I),L(void 0)}catch(I){if(b===V.current)L(d(I))}},[C]);o(()=>{let i=setTimeout(()=>void K(g),B);return()=>clearTimeout(i)},[g,K,s]);let R=(h??[]).filter((i)=>i.kind===c).sort((i,b)=>c==="event"?(i.eventDate??"").localeCompare(b.eventDate??""):i.id-b.id),q=ts(p);return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[n("div",{children:[e("h2",{children:t("Notes")}),e("p",{className:"hint",children:t("What a knight remembers. A change applies from the next turn.")})]}),e("button",{type:"button",onClick:()=>w({draft:{kind:c,fact:"",eventDate:""}}),children:t("Add")})]}),P&&P.principals.length>1?e(H,{people:P,shown:C,choose:(i)=>{S(void 0),W(i)}}):null,n("div",{className:"toolbar",children:[e("div",{className:"tabs",role:"tablist",children:F.map((i)=>n("button",{type:"button",role:"tab","aria-selected":c===i.kind,onClick:()=>l(i.kind),children:[t(i.label),h?` ${h.filter((b)=>b.kind===i.kind).length}`:""]},i.kind))}),e("input",{type:"search",placeholder:t("Search (words separated by spaces)"),"aria-label":t("Search notes"),value:g,onChange:(i)=>D(i.target.value)})]}),e("p",{className:"hint",children:t(F.find((i)=>i.kind===c)?.hint??"")}),f?e(m,{message:f}):null,!h?e(v,{}):R.length===0?e(k,{children:g?t("No matching notes."):t("Nothing of this kind yet.")}):R.map((i)=>e("article",{className:"card",children:n("div",{className:"card-head",children:[n("div",{children:[i.eventDate?n("p",{className:"meta",children:[i.eventDate," ",i.eventDate<q?e(T,{children:t("past")}):null]}):null,e("p",{className:"text",children:i.fact})]}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>w({note:i,draft:{kind:i.kind,fact:i.fact,eventDate:i.eventDate??""}}),children:t("Edit")}),e("button",{type:"button",className:"danger",onClick:()=>x(i),children:t("Delete")})]})]})},i.id)),e(ie,{open:N!==void 0,title:N?.note?t("Edit note"):t("Add note"),onClose:()=>w(void 0),children:N?e(M,{initial:N.draft,save:async(i)=>{if(N.note)await y.updateNote(N.note.id,i,C);else await y.addNote(i,C);w((b)=>b===N?void 0:b),await K(g)},cancel:()=>w(void 0)}):null}),e(ie,{open:E!==void 0,title:t("Delete this note?"),onClose:()=>x(void 0),children:E?e(O,{text:E.fact,run:async()=>{await y.deleteNote(E.id,C),x((i)=>i===E?void 0:i),await K(g)},cancel:()=>x(void 0)}):null})]})}function H(p){let{people:s}=p,c=z();return n("label",{className:"inline",htmlFor:c,children:[t("Whose notes")," ",e(Te,{id:c,value:p.shown??s.self,onChange:(l)=>p.choose(l.target.value===s.self?void 0:l.target.value),children:s.principals.map((l)=>e("option",{value:l.id,children:l.id===s.self?t("{name} (you)",{name:l.name}):l.disabled?t("{name} (disabled)",{name:l.name}):l.name},l.id))})]})}function M(p){let[s,c]=r(p.initial),[l,g]=r(!1),[D,h]=r(),S=async()=>{g(!0),h(void 0);try{await p.save({kind:s.kind,fact:s.fact,...s.kind==="event"&&s.eventDate?{eventDate:s.eventDate}:{}})}catch(f){h(d(f)),g(!1)}};return n("form",{className:"stack",onSubmit:(f)=>{f.preventDefault(),S()},children:[n("fieldset",{children:[e("legend",{children:t("Kind")}),e("div",{className:"tabs",children:F.map((f)=>e("button",{type:"button","aria-pressed":s.kind===f.kind,onClick:()=>c({...s,kind:f.kind}),children:t(f.label)},f.kind))})]}),s.kind==="event"?n("label",{children:[t("Date"),e("input",{type:"date",value:s.eventDate,onChange:(f)=>c({...s,eventDate:f.target.value})})]}):null,n("label",{children:[t("Text"),e("textarea",{rows:4,value:s.fact,onChange:(f)=>c({...s,fact:f.target.value})})]}),D?e(m,{message:D}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:p.cancel,children:t("Cancel")}),e("button",{type:"submit",disabled:l,children:l?t("Saving…"):t("Save")})]})]})}function O(p){let[s,c]=r(!1),[l,g]=r();return n("div",{className:"stack",children:[e("p",{className:"text",children:p.text}),l?e(m,{message:l}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:p.cancel,children:t("Cancel")}),e("button",{type:"button",className:"danger",disabled:s,onClick:()=>{c(!0),p.run().catch((D)=>{g(d(D)),c(!1)})},children:s?t("Deleting…"):t("Delete")})]})]})}export{ae as NotesPage};
@@ -0,0 +1 @@
1
+ import"./chunk-index-0q15ysrb.js";import{t,e,n,s,x}from"./chunk-index-cn49mawx.js";import{hi}from"./chunk-index-7qd604rq.js";import"./chunk-index-rsd8rftk.js";function r({current:a}){let{badge:o}=hi();return n("a",{className:"icon-button bell",href:x("notices"),"aria-current":a?"page":void 0,"aria-label":o>0?t("Notices, {count} waiting",{count:o}):t("Notices"),children:[e(s,{name:"bell"}),o>0?e("span",{className:"bell-count","aria-hidden":"true",children:o>99?"99+":o}):null]})}export{r as default};
@@ -1 +1 @@
1
- import{s,r,t,e,n,o,d,g,_,P}from"./chunk-index-2e4am3hw.js";import"./chunk-index-0q15ysrb.js";import{ni,Qo,Mo}from"./chunk-index-ac1ktr56.js";import"./chunk-index-msqhgvfx.js";function p(a,u){let i=Math.max(0,Math.round((u-Date.parse(a))/60000));if(i<1)return t("just now");if(i<60)return t("{count} min ago",{count:i});let c=Math.round(i/60);if(c<24)return t("{count} h ago",{count:c});return t("{count} d ago",{count:Math.round(c/24)})}function f({notice:a}){let[u,i]=r(!1),[c,l]=r();return n("li",{className:"card stack notice","data-urgent":a.urgency==="high"||void 0,children:[n("div",{className:"card-head",children:[e("strong",{children:a.title}),a.urgency==="high"?e(P,{tone:"warn",children:t("Urgent")}):null]}),a.body?e("p",{children:a.body}):null,e("p",{className:"meta",children:p(a.raisedAt,Date.now())}),c?e(g,{message:c}):null,n("div",{className:"actions",children:[a.open?e("a",{className:"button",href:Mo(a.open),children:t("Open")}):null,a.ackable?a.acked?n("span",{className:"meta",children:[e(o,{name:"check",size:14})," ",t("Handled")]}):e("button",{type:"button",className:"secondary",disabled:u,onClick:async()=>{i(!0),l(void 0);try{await Qo(a.tag)}catch(m){l(d(m))}finally{i(!1)}},children:t("Handled")}):null]})]})}function E(){let{notices:a,known:u}=ni(),[,i]=r(0);return s(()=>{let c=setInterval(()=>i((l)=>l+1),60000);return()=>clearInterval(c)},[]),n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Notices")})}),a.length===0?e(_,{children:u?t("Nothing needs you."):t("Loading…")}):e("ul",{className:"stack notices",children:a.map((c)=>e(f,{notice:c},c.tag))})]})}export{E as NoticesPage};
1
+ import{o,r,t,e,n,s,d,m,k,T}from"./chunk-index-cn49mawx.js";import"./chunk-index-0q15ysrb.js";import{hi,Ko,Jo}from"./chunk-index-7qd604rq.js";import"./chunk-index-rsd8rftk.js";function g(a,u){let i=Math.max(0,Math.round((u-Date.parse(a))/60000));if(i<1)return t("just now");if(i<60)return t("{count} min ago",{count:i});let c=Math.round(i/60);if(c<24)return t("{count} h ago",{count:c});return t("{count} d ago",{count:Math.round(c/24)})}function f({notice:a}){let[u,i]=r(!1),[c,l]=r();return n("li",{className:"card stack notice","data-urgent":a.urgency==="high"||void 0,children:[n("div",{className:"card-head",children:[e("strong",{children:a.title}),a.urgency==="high"?e(T,{tone:"warn",children:t("Urgent")}):null]}),a.body?e("p",{children:a.body}):null,e("p",{className:"meta",children:g(a.raisedAt,Date.now())}),c?e(m,{message:c}):null,n("div",{className:"actions",children:[a.open?e("a",{className:"button",href:Jo(a.open),children:t("Open")}):null,a.ackable?a.acked?n("span",{className:"meta",children:[e(s,{name:"check",size:14})," ",t("Handled")]}):e("button",{type:"button",className:"secondary",disabled:u,onClick:async()=>{i(!0),l(void 0);try{await Ko(a.tag)}catch(p){l(d(p))}finally{i(!1)}},children:t("Handled")}):null]})]})}function M(){let{notices:a,known:u}=hi(),[,i]=r(0);return o(()=>{let c=setInterval(()=>i((l)=>l+1),60000);return()=>clearInterval(c)},[]),n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Notices")})}),a.length===0?e(k,{children:u?t("Nothing needs you."):t("Loading…")}):e("ul",{className:"stack notices",children:a.map((c)=>e(f,{notice:c},c.tag))})]})}export{M as NoticesPage};
@@ -0,0 +1 @@
1
+ import{A,o,a,r,t,g,e,n,s,x,d,v,m,Un,rr}from"./chunk-index-cn49mawx.js";import{q}from"./chunk-index-qxynr1hf.js";import"./chunk-index-0q15ysrb.js";import{Nn,un}from"./chunk-index-jc3r4qam.js";import"./chunk-index-m81362sc.js";import{he}from"./chunk-index-rsd8rftk.js";var _=90000,C=2000,V=()=>typeof matchMedia==="function"&&(matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0),F=()=>/iPhone|iPad/.test(navigator.userAgent);function z({step:i,view:w,refresh:p}){let[c,u]=r(),[l,h]=r(i.done?"arrived":"idle"),[k,b]=r(),[S,y]=r(!1),[I,T]=r(!1),N=a(void 0);o(()=>(Un().then(u,()=>u("unsupported")),()=>clearTimeout(N.current)),[]),o(()=>{if(i.done)h("arrived")},[i.done]);let L=A((f)=>{let P=async()=>{if((await p())?.steps.find((M)=>M.id===i.id)?.done){h("arrived");return}if(Date.now()-f>_){h("late");return}N.current=setTimeout(P,C)};N.current=setTimeout(P,C)},[p,i.id]),D=async()=>{y(!0),b(void 0),h("sending");try{await he.pushTest(),h("waiting"),L(Date.now())}catch(f){h("idle"),b(d(f))}finally{y(!1)}},E=async()=>{y(!0),b(void 0);try{await rr(),u(await Un()),await p()}catch(f){b(f instanceof Error&&f.message==="permission"?t("Notifications were not allowed. Allow them in the browser's site settings."):d(f)),u(await Un().catch(()=>"unsupported"))}finally{y(!1)}},O=c==="unsupported"&&F()&&!V();return n("section",{className:"card stack","aria-labelledby":`step-${i.id}`,children:[n("div",{className:"card-head",children:[e("h2",{id:`step-${i.id}`,children:Nn(i)}),i.done?n("span",{className:"meta",children:[e(s,{name:"check",size:14})," ",t("Done")]}):null]}),e("p",{className:"meta",children:un(i)}),n("ol",{className:"steps",children:[n("li",{"data-done":c==="on"||O===!1||void 0,children:[e("strong",{children:t("Put the app on your phone")}),e("span",{className:"meta",children:O?t("On iPhone and iPad, open this page in Safari, tap Share, then Add to Home Screen, and open the app from there."):V()?t("This page is installed on this device."):t("On a phone, add it to the home screen from the browser's menu so notifications reach you when it is closed.")})]}),n("li",{"data-done":c==="on"||void 0,children:[e("strong",{children:t("Allow notifications")}),c==="blocked"?e("span",{className:"meta",children:t("Notifications are blocked for this site. Allow them in the browser's site settings.")}):c==="unsupported"?e("span",{className:"meta",children:t("This browser cannot get push notifications.")}):c==="on"?e("span",{className:"meta",children:t("Allowed on this device.")}):e("button",{type:"button",disabled:S||c===void 0,onClick:E,children:t("Allow notifications")})]}),n("li",{"data-done":i.done||void 0,children:[e("strong",{children:t("Send a test")}),l==="arrived"?e("span",{className:"meta",children:t("It arrived. Notifications work on this device.")}):n(g,{children:[e("button",{type:"button",className:"secondary",disabled:S||c!=="on"||l==="waiting",onClick:D,children:l==="waiting"?t("Waiting for it…"):t("Send a test notification")}),l==="late"?e("span",{className:"meta",children:t("It has not arrived. Check that notifications are allowed for this app, then send another.")}):null]})]})]}),k?e(m,{message:k}):null,i.waiver&&!i.done&&!i.waived?n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>T(!0),children:t(i.waiver.label)}),e(q,{open:I,title:t(i.waiver.label),confirmLabel:t("Skip"),onClose:()=>T(!1),onConfirm:async()=>{await he.waive(i.id),await p()},children:e("p",{children:t(i.waiver.confirm)})})]}):null,w.push.devices>0&&!i.done?e("p",{className:"meta",children:t("{count} device(s) will get notifications.",{count:w.push.devices})}):null]})}function j(){let[i,w]=r(),[p,c]=r(),u=A(async()=>{try{let l=await he.onboarding();return w(l),l}catch(l){c(d(l));return}},[]);if(o(()=>{u()},[u]),p&&!i)return e(m,{message:p});if(!i)return e(v,{});return n("div",{className:"page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Finish setting up")})}),i.steps.map((l)=>l.builtin==="push"?e(z,{step:l,view:i,refresh:u},l.id):n("section",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:Nn(l)}),l.done||l.waived?n("span",{className:"meta",children:[e(s,{name:"check",size:14})," ",l.done?t("Done"):t("Skipped")]}):e("a",{className:"button-link",href:x(l.open.page),children:t("Open")})]}),e("p",{className:"meta",children:un(l)})]},l.id)),i.steps.length===0?e("p",{className:"empty",children:t("There is nothing left to set up.")}):null]})}export{j as OnboardingPage};
@@ -0,0 +1 @@
1
+ import{r,t,u,g,e,n,x,y,d,v,m,k,T,_,xe,re,Ne,Wi,mn,bi,J}from"./chunk-index-cn49mawx.js";import{ve}from"./chunk-index-gcmmwh8t.js";import{ie}from"./chunk-index-sw9r4aa4.js";import"./chunk-index-m81362sc.js";function f(a){let{cleanup:i}=_(),[c,p]=r(),[l,o]=r(!1),[h,s]=r();if(!i)return null;let b=()=>{if(!l)p(void 0),s(void 0)};return n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>p("start-over"),children:t("Start over")}),a.deletable?e("button",{type:"button",className:"danger",onClick:()=>p("delete"),children:t("Delete")}):null,n(ie,{open:c!==void 0,title:c==="delete"?t("Permanently delete {name}?",{name:a.title}):t("Start over {name}?",{name:a.title}),onClose:b,children:[e("p",{children:c==="delete"?t("The live conversation and all archives will be permanently deleted. Memory and schedules are preserved."):t("The current conversation will be archived; the next message starts a new one. Long-term memory is preserved. Active turns finish first.")}),h?e(m,{message:h}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:l,onClick:b,children:t("Cancel")}),e("button",{type:"button",className:c==="delete"?"danger":"",disabled:l,onClick:async()=>{if(!c)return;o(!0),s(void 0);try{if(c==="delete")await y.deleteConversation(a.channel);else await y.startOver(a.channel);p(void 0),a.refresh()}catch(I){s(d(I))}finally{o(!1)}},children:l?c==="delete"?t("Deleting…"):a.busy?t("Waiting for this turn…"):t("Starting over…"):c==="delete"?t("Delete permanently"):t("Start over")})]})]})]})}function Q(){let a=_(),{now:i}=J(),[c,p]=r(0),l=()=>p((s)=>s+1),{data:o,error:h}=ve(()=>y.overview(),`overview:${c}`);if(!o)return h?e(m,{message:h}):e(v,{});return n(g,{children:[h?e(m,{message:h}):null,n("section",{className:"stack",children:[e("h2",{children:t("Bot server")}),e("p",{className:"hint",children:t("Knight and group status; starting over archives the conversation and preserves memory.")}),o.agents.length+o.groups.length===0?e(k,{children:t("No knights.")}):null,o.agents.map((s)=>e(A,{agent:s,groups:o.groups,agents:o.agents,guildId:o.guildId,now:i,refresh:l},s.name)),o.groups.map((s)=>e(C,{group:s,guildId:o.guildId,now:i,timeZone:a.timeZone,refresh:l},s.name))]}),n("section",{className:"stack",children:[e("h2",{children:t("My workspaces")}),e("p",{className:"hint",children:t("Direct messages and channels where you mention a knight. Start over archives; delete removes every archive permanently.")}),o.workspaces?.length?o.workspaces.map((s)=>e(N,{conversation:s,schedules:s.schedules,now:i,refresh:l},s.key)):e(k,{children:t("No workspaces.")})]}),n("section",{className:"stack",children:[e("h2",{children:t("Outside AI client conversations")}),e("p",{className:"hint",children:t("Conversations opened through remote MCP; after deletion the session ID cannot be resumed.")}),o.outside?.length?o.outside.map((s)=>e(N,{conversation:s,now:i,refresh:l},s.key)):e(k,{children:t("No outside AI client conversations.")})]}),n("section",{className:"stack",children:[e("h2",{children:t("Party channels")}),e("p",{className:"hint",children:t("Starting over stops the container and archives role conversations; each speaker's memory is preserved.")}),o.party?.length?o.party.map((s)=>e(B,{party:s,now:i,refresh:l},s.key)):e(k,{children:t("No party channels.")})]})]})}function w({busy:a}){return e(T,{tone:a?"busy":"plain",children:a===0?t("idle"):a===1?t("Working"):t("Working, {count} waiting",{count:a-1})})}function C(a){let{group:i,now:c,timeZone:p}=a;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[i.channelId?e("a",{href:bi(i.channelId,a.guildId),target:"_blank",rel:"noreferrer",children:i.displayName}):e("strong",{children:i.displayName}),e(T,{children:t("Group")}),e(w,{busy:i.busy})]}),e("p",{children:t("Members: {members} | Host: {host}",{members:i.members.join(", "),host:i.host})}),n("p",{className:"hint",children:[t("Last active")," ",xe(i.lastActive,c,p)]}),i.room||i.channelId?e(f,{channel:i.room??`discord:${i.channelId}`,title:i.displayName,busy:i.busy>0,refresh:a.refresh}):null]})}function A(a){let{agent:i}=a,{timeZone:c,panes:p}=_(),l=a.groups.find((s)=>s.channelId===i.workingIn),o=a.agents.find((s)=>s.channelId===i.workingIn),h=!i.workingIn?void 0:i.workingIn===i.channelId?t("Working in own channel"):l?t("Working in group {name}",{name:l.displayName}):o?t("Replying in {name}'s channel",{name:o.displayName}):t("Replying in another channel");return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.channelId?e("a",{href:bi(i.channelId,a.guildId),target:"_blank",rel:"noreferrer",children:i.displayName}):i.displayName}),e(T,{children:"agent"}),i.workingIn?e(w,{busy:1+i.waiting}):i.waiting>0?e(T,{tone:"busy",children:t("{count} waiting",{count:i.waiting})}):e(T,{children:t("idle")})]}),h?e("p",{children:h}):null,n("dl",{className:"facts",children:[n("div",{children:[e("dt",{children:t("Model")}),n("dd",{children:[i.model," · thinking ",i.thinking]})]}),n("div",{children:[e("dt",{children:t("Context")}),e("dd",{children:i.context?i.context.tokens===null?t("Just compacted (limit {limit})",{limit:Wi(i.context.contextWindow)}):`${Wi(i.context.tokens)} / ${Wi(i.context.contextWindow)} (${Math.round(i.context.tokens/i.context.contextWindow*100)}%)`:"—"})]}),n("div",{children:[e("dt",{children:t("Schedules")}),e("dd",{children:i.schedules})]}),n("div",{children:[e("dt",{children:t("Last active")}),e("dd",{children:xe(i.lastActive,a.now,c)})]})]}),i.room||i.channelId?e(f,{channel:i.room??`discord:${i.channelId}`,title:i.displayName,busy:!!i.workingIn||i.waiting>0,refresh:a.refresh}):null,i.channelId&&p.includes("conversations")?e("a",{href:x("conversations",`discord:${i.channelId}`),children:t("transcript")}):null]})}function N({conversation:a,schedules:i,now:c,refresh:p}){let{timeZone:l,panes:o}=_(),{title:h,detail:s}=a.kind==="outside"?{title:a.firstMessage||t("(No messages)"),detail:a.id}:mn(a.channel,a.id);return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.channel&&a.channel.kind!=="gone"?e("a",{href:bi(a.id,a.channel.kind==="guild"?a.channel.guildId:void 0),target:"_blank",rel:"noreferrer",children:h}):h}),e(w,{busy:a.busy})]}),s?e("p",{className:"hint",children:s}):null,e("p",{children:a.liveBytes>0?t("Conversation {size} · Archives {count}",{size:Ne(a.liveBytes),count:a.archives}):t("No live conversation · Archives {count}",{count:a.archives})}),a.startedAt?n("p",{children:[t("Started")," ",re(a.startedAt,l)]}):null,n("p",{className:"hint",children:[i!==void 0?`${t("Schedules")} ${i} · `:"",t("Last active")," ",xe(a.lastActive,c,l)]}),e(f,{channel:a.key,title:h,busy:a.busy>0,deletable:!0,refresh:p}),o.includes("conversations")?e("a",{href:x("conversations",a.key),children:t("transcript")}):null]})}function B({party:a,now:i,refresh:c}){let{timeZone:p}=_(),{title:l,detail:o}=mn(a.channel,a.channelId),h={running:u("Container running"),stopped:u("Container stopped"),missing:u("No container yet"),unknown:u("Container status unknown")};return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:a.channel.kind!=="gone"?e("a",{href:bi(a.channelId,a.channel.kind==="guild"?a.channel.guildId:void 0),target:"_blank",rel:"noreferrer",children:l}):l}),e(T,{children:a.profile}),e(T,{children:t(h[a.container])}),e(w,{busy:a.busy})]}),o?e("p",{className:"hint",children:o}):null,e("p",{children:t("Enabled by {name} at {time}",{name:a.enabledBy,time:re(a.enabledAt,p)})}),n("p",{className:"hint",children:[t("Last active")," ",xe(a.lastActive,i,p)]}),e(f,{channel:a.key,title:l,busy:a.busy>0,refresh:c})]})}export{Q as OverviewPage};
@@ -0,0 +1 @@
1
+ import{o,C,a,r,t,e,n,s,x,I,l,ot,fe}from"./chunk-index-cn49mawx.js";import{ci}from"./chunk-index-3gfbhmpb.js";import{R}from"./chunk-index-m81362sc.js";function T(p){let[f,v]=r(""),[u,h]=r(0),g=a(null),b=l((c)=>c.order.flatMap((i)=>{let m=c.rooms[i]?.view;return m?[{key:i,name:m.displayName,agent:m.name,character:m.character,kind:m.kind}]:[]})),d=C(()=>[...b.map((i)=>({id:i.key,label:i.name,hint:i.kind==="agent"?t("Knight"):i.kind==="group"?t("Group"):t("Thread"),room:!0,...i.kind==="agent"?{avatar:{name:i.agent,character:i.character}}:{icon:"conversations"},go:()=>I("room",i.key)})),...p.pages.map((i)=>({id:i.pane,label:i.label,hint:t("Page"),icon:i.icon,go:()=>I(i.pane)}))].flatMap((i)=>{let m=ci(f,i.label);return m===void 0?[]:[{target:i,score:m}]}).sort((i,m)=>m.score-i.score).map((i)=>i.target).slice(0,12),[b,p.pages,f]);o(()=>h(0),[f]),o(()=>{if(p.open)v(""),requestAnimationFrame(()=>g.current?.focus())},[p.open]);let y=(c)=>{if(!c)return;p.onClose(),c.go()};return e(R,{open:p.open,title:t("Find a room"),onClose:p.onClose,variant:"palette",children:n("div",{className:"palette-box",children:[n("div",{className:"palette-input",children:[e(s,{name:"search",size:18}),e("input",{ref:g,value:f,placeholder:t("Find a room or page"),"aria-label":t("Find a room or page"),role:"combobox","aria-expanded":"true","aria-controls":"palette-list","aria-activedescendant":d[u]?`palette-${u}`:void 0,onChange:(c)=>v(c.target.value),onKeyDown:(c)=>{if(ot(c.nativeEvent))return;if(c.key==="ArrowDown")c.preventDefault(),h((i)=>Math.min(d.length-1,i+1));else if(c.key==="ArrowUp")c.preventDefault(),h((i)=>Math.max(0,i-1));else if(c.key==="Enter")c.preventDefault(),y(d[u])}}),e("kbd",{children:"Esc"})]}),n("ul",{className:"palette-list",children:[d.length===0?e("li",{className:"palette-empty",children:t("Nothing matches.")}):null,d.map((c,i)=>e("li",{"data-active":i===u||void 0,children:n("a",{href:c.room?x("room",c.id):x(c.id),onClick:(m)=>{m.preventDefault(),y(c)},onMouseMove:()=>h(i),"aria-current":i===u?"true":void 0,children:[c.avatar?e(fe,{spec:c.avatar.character,name:c.avatar.name,size:28,live:!1}):e("span",{className:"palette-icon",children:e(s,{name:c.icon??"list",size:16})}),e("span",{className:"palette-label",children:c.label}),e("span",{className:"meta",children:c.hint})]})},c.id))]})]})})}export{T as Palette};
@@ -0,0 +1 @@
1
+ import{ro,ga}from"./chunk-index-sm7kfb07.js";import"./chunk-index-6yra9kdq.js";import"./chunk-index-vsfsv8hd.js";import"./chunk-index-q5fyrtx4.js";import"./chunk-index-s53bxwkk.js";import"./chunk-index-gwkhs8s3.js";import"./chunk-index-bef0fc2m.js";import"./chunk-index-20xgx0k2.js";export{ga as folderMenu,ro as placementItems};
@@ -0,0 +1 @@
1
+ import{A,o,a,r,t,u,g,e,n,s,y,d,v,m,T,or}from"./chunk-index-cn49mawx.js";import{q}from"./chunk-index-qxynr1hf.js";import"./chunk-index-0q15ysrb.js";import"./chunk-index-m81362sc.js";import{he}from"./chunk-index-rsd8rftk.js";var E=3000;function O({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(D[i.tier])]}):null]})]})}function z({link:i,labels:P,changed:l}){let[c,p]=r(),[f,N]=r(!1),[C,V]=r(),[w,k]=r(!1),L=i.pending!==void 0||c!==void 0,I=a(void 0);o(()=>{if(!L||i.linked)return;return I.current=setInterval(()=>{he.links().then((b)=>{let B=b.links.find((R)=>R.provider===i.provider);if(B)l(B)},()=>{return})},E),()=>clearInterval(I.current)},[L,i.linked,i.provider,l]);let S=async(b)=>{N(!0),V(void 0);try{await b()}catch(B){V(d(B))}finally{N(!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(T,{tone:"warn",children:t("Required")}):i.step==="nudge"?e(T,{children:t("Recommended")}):null]}),C?e(m,{message:C}):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:()=>k(!0),children:t("Unlink")}),e(q,{open:w,title:t("Unlink {name}?",{name:i.label}),confirmLabel:t("Unlink"),tone:"danger",onClose:()=>k(!1),onConfirm:async()=>{l(await he.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.")})})]}):L?n("div",{className:"stack",children:[c?n(g,{children:[e("p",{children:c.instructions}),e("p",{className:"meta",children:t("Your code")}),e("code",{className:"link-code",children:c.code}),e("p",{className:"meta",children:t("The code works until {time}.",{time:new Date(c.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:()=>S(async()=>{l(await he.cancelLink(i.provider)),p(void 0)}),children:t("Cancel")}),e("button",{type:"button",disabled:f,onClick:()=>S(async()=>{let b=c?.request??i.pending?.request;if(!b)return;l(await he.confirmLink(i.provider,b)),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((b)=>P[b]??b).join(", ")})}):null,e("div",{className:"actions",children:e("button",{type:"button",disabled:f||h,onClick:()=>S(async()=>{p(await he.issueLink(i.provider)),l((await he.links()).links.find((b)=>b.provider===i.provider)??i)}),children:t("Link")})})]})]})}function F(){let i=Intl.DateTimeFormat().resolvedOptions().timeZone,[P,l]=r(),[c,p]=r({start:"22:00",end:"07:00"}),[f,N]=r(!1),[C,V]=r(!1),[w,k]=r(),[L,I]=r();o(()=>{he.pushPrefs().then((h)=>{if(l(h.quiet),h.quiet)p(h.quiet);N(!0)},()=>N(!0))},[]);let S=async(h)=>{V(!0),I(void 0),k(void 0);try{await h()}catch(b){I(d(b))}finally{V(!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:c.start,onChange:(h)=>p({...c,start:h.target.value})})]}),n("label",{children:[t("To")," ",e("input",{type:"time",value:c.end,onChange:(h)=>p({...c,end:h.target.value})})]}),e("span",{className:"meta",children:i})]}),L?e(m,{message:L}):null,w?e("p",{className:"meta",children:w}):null,n("div",{className:"actions",children:[P?e("button",{type:"button",className:"secondary",disabled:C,onClick:()=>S(async()=>{await he.setPushPrefs(null),l(void 0)}),children:t("Turn off quiet hours")}):null,e("button",{type:"button",className:"secondary",disabled:C,onClick:()=>S(async()=>{await he.pushTest(),k(t("A test notification is on its way."))}),children:t("Send a test notification")}),e("button",{type:"button",disabled:C||c.start===c.end,onClick:()=>S(async()=>{let h=await he.setPushPrefs({...c,timeZone:i});l(h.quiet)}),children:t("Save")})]})]})}function U({profile:i,changed:P}){let[l,c]=r();if(i.sources.length===0)return null;let p=async(f)=>{c(void 0);try{P(await he.chooseSource(f))}catch(N){c(d(N))}};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))]}),l?e(m,{message:l}):null]})}function H(){let[i,P]=r(),[l,c]=r(),[p,f]=r(),[N,C]=r();o(()=>{y.session().then(P,(w)=>C(d(w))),he.profile().then(c,()=>{return}),he.links().then(f,()=>{return})},[]);let V=A((w)=>{f((k)=>k?{links:k.links.map((L)=>L.provider===w.provider?w:L)}:k),he.profile().then(c,()=>{return})},[]);if(N)return e(m,{message:N});if(!i)return e(v,{});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")}),l?e(O,{profile:l}):e("p",{className:"meta",children:t("Signed in as {name}.",{name:i.principal.name})}),e(or,{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((w)=>e(z,{link:w,labels:Object.fromEntries(p.links.map((k)=>[k.provider,k.label])),changed:V},w.provider))})]}):null,l?e(U,{profile:l,changed:c}):null,i.push?e(F,{}):null]})}var D={owner:u("Owner"),admin:u("Admin"),member:u("Member")};export{H as ProfilePage};
@@ -0,0 +1 @@
1
+ import{o,r,t,e,n,d,v,m,k,T,_,re}from"./chunk-index-cn49mawx.js";import{Ot}from"./chunk-index-rgf4rvns.js";import{R}from"./chunk-index-m81362sc.js";function U(a){let{open:u,load:y}=a,{timeZone:N}=_(),[i,p]=r(),[c,g]=r(),[h,b]=r();o(()=>{if(!u)return;let s=!0;return p(void 0),g(void 0),b(void 0),y().then((f)=>s&&p(f),(f)=>s&&g(d(f))),()=>{s=!1}},[u]);let l=i?.find((s)=>s.id===h);return e(R,{open:u,title:a.title,size:"wide",onClose:a.onClose,children:n("div",{className:"stack history",children:[c?e(m,{message:c}):null,!i&&!c?e(v,{}):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:re(s.at,N)})]}),s.revert?e(T,{children:t("Back to the file version")}):null]})},s.id))}):null,l?n("section",{className:"stack","aria-label":t("This change"),children:[e(Ot,{label:t("This change"),before:l.previous,after:l.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(l.text),children:t("Use this text")})})]}):null]})})}export{U as HistorySheet};
@@ -0,0 +1 @@
1
+ import{p,Q,S,A,o,z,r,t,u,g,e,n,s,de,d,f,v,m,k,T,_,re}from"./chunk-index-cn49mawx.js";import{_e}from"./chunk-index-zvvwxkev.js";import{Ot}from"./chunk-index-rgf4rvns.js";import{R}from"./chunk-index-m81362sc.js";var M={"Shared prompt":u("Shared prompt"),"Guest prompt":u("Guest prompt"),"The base every knight's prompt starts with, the main knight's included.":u("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.":u("Used instead of the shared prompt when the person speaking is not the owner.")},C=(l)=>t(M[l]??l);var O=S(()=>(p("wv0vdsjv"),import("./chunk-prompt-history-wv0vdsjv.js")).then((l)=>({default:l.HistorySheet}))),Z=S(()=>(p("2pzrt272"),import("./chunk-confirm-2pzrt272.js")).then((l)=>({default:l.Confirm})));function pe(){let{timeZone:l}=_(),[N,i]=r(),[h,w]=r(),[b,x]=r(),P=A(()=>{_e.prompts().then((c)=>i(c.documents),(c)=>w(d(c)))},[]);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(v,{}):null,N?.length===0?e(k,{children:t("No prompts to edit.")}):null,N?.map((c)=>n("article",{className:"card stack",children:[n("div",{className:"card-head",children:[e("strong",{children:C(c.label)}),c.differs?e(T,{tone:"warn",children:t("Differs from the file version")}):null,c.broken?e(T,{tone:"warn",children:t("File version cannot be read")}):null]}),c.description?e("p",{children:C(c.description)}):null,c.override?e("p",{className:"hint",children:t("Set by {name}, {time}",{name:c.override.by,time:re(c.override.at,l)})}):null,e("div",{className:"actions",children:e("button",{type:"button",onClick:()=>x(c.id),children:t("Edit")})})]},c.id)),b?e(q,{id:b,onClose:()=>{x(void 0),P()}}):null]})}function q({id:l,onClose:N}){let[i,h]=r(),[w,b]=r(""),[x,P]=r(),[c,E]=r(!1),[B,D]=r(!1),[V,H]=r(!1),[F,I]=r(!1),L=z();o(()=>{let a=!0;return _e.prompt(l).then((y)=>{if(!a)return;h(y),b(y.text)},(y)=>a&&P(d(y))),()=>{a=!1}},[l]);let U=async()=>{if(!i)return;D(!0);try{let a=await _e.savePrompt(l,{text:w,base:i.text});h(a),b(a.text),E(!1),f(t("Saved."))}catch(a){if(a instanceof de&&a.status===409){let{current:y}=a.body;h(y),f(a.message,"danger")}else f(d(a),"danger")}finally{D(!1)}},G=i!==void 0&&w!==i.text;return n(R,{open:!0,title:i?C(i.label):t("Main prompts"),size:"full",onClose:N,children:[x?e(m,{message:x}):null,!i&&!x?e(v,{}):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(T,{tone:"warn",children:t("Differs from the file version")})}):null,c?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),e(Ot,{label:t("Prompt"),before:i.text,after:w}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",disabled:B,onClick:()=>E(!1),children:t("Back to editing")}),e("button",{type:"button",disabled:B,onClick:U,children:B?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:()=>H(!0),children:[e(s,{name:"reset",size:16}),t("History")]})})]}),e("textarea",{id:L,className:"prompt-full",value:w,maxLength:i.maxChars,onChange:(a)=>b(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:()=>E(!0),children:t("Review changes")})]})]}),V?e(Q,{fallback:null,children:e(O,{open:V,title:t("History of {name}",{name:C(i.label)}),load:async()=>(await _e.promptHistory(l)).versions.map((a)=>({id:a.id,text:a.text,previous:a.previous,by:a.by,at:a.at,revert:a.action==="revert"})),onUse:(a)=>{b(a),E(!1),H(!1)},onClose:()=>H(!1)})}):null,F?e(Q,{fallback:null,children:e(Z,{open:F,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 _e.revertPrompt(l,{base:i.text});h(a),b(a.text),E(!1),f(t("Back to the file version."))}catch(a){if(!(a instanceof de&&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{gr}from"./chunk-index-v8mma5np.js";import"./chunk-index-sw9r4aa4.js";import"./chunk-index-qxynr1hf.js";import"./chunk-index-m81362sc.js";import"./chunk-index-n0ejy0wd.js";import"./chunk-index-6yra9kdq.js";import"./chunk-index-c7dbvkrq.js";import"./chunk-index-q5fyrtx4.js";import"./chunk-index-bef0fc2m.js";import"./chunk-index-20xgx0k2.js";export{gr as RoomConfirmHost};
@@ -0,0 +1 @@
1
+ import{p,r,t,g,e,n,s,x,l,_,He,At,Le,_t}from"./chunk-index-cn49mawx.js";import{ze}from"./chunk-index-6yra9kdq.js";import"./chunk-index-q5fyrtx4.js";import{Ft}from"./chunk-index-2hvn2kte.js";import{R}from"./chunk-index-m81362sc.js";import{tn}from"./chunk-index-aexy023z.js";var h="room-menu-yolo",N="room-menu-long",b="room-menu-mute";function P(a){let[i,m]=r(!1),u=_().app?.modes!==!1,f=l((o)=>o.rooms[a.room]?.view?.home===!1,a.room),c=l((o)=>o.pins.includes(a.room),a.room),d=a.mode??{yolo:!1,longRunning:!1},k=async(o)=>{m(!0),await At(a.room,{longRunning:o}),m(!1)};return e(R,{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(Ft,{id:b,checked:!a.muted,label:t("Notifications"),onChange:async(o)=>{m(!0),await tn(a.room,!o),m(!1)},busy:i})]})}),a.readOnly||!u?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(Ft,{id:h,checked:d.yolo,label:t("Yolo mode"),onChange:(o)=>{if(o)a.onAskYolo();else m(!0),At(a.room,{yolo:!1}).then(()=>m(!1))},busy:i})]})}),a.readOnly||!u?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(Ft,{id:N,checked:d.longRunning,label:t("Long-running mode"),onChange:k,busy:i})]})}),a.agent?e("li",{children:n("button",{type:"button",className:"menu-item menu-link","aria-haspopup":"dialog",onClick:()=>{a.onClose(),He(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(),He(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(),_t({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.readOnly||!f?null:n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item menu-link",onClick:()=>{a.onClose(),(p("bfqtg71d"),import("./chunk-layout-actions-bfqtg71d.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(),ze({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(),Le({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,l}from"./chunk-index-cn49mawx.js";import"./chunk-index-q5fyrtx4.js";import"./chunk-index-gwkhs8s3.js";import"./chunk-index-6yra9kdq.js";import{si}from"./chunk-index-31m1b2f5.js";import"./chunk-index-vsfsv8hd.js";import"./chunk-index-s53bxwkk.js";function r(){if(!l((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)=>si(o.currentTarget),children:e(s,{name:"more",size:18})})}export{r as default};
@@ -0,0 +1 @@
1
+ import{r,t,u,e,n,s,x,y,f,v,m,k,T,_,re}from"./chunk-index-cn49mawx.js";import{q}from"./chunk-index-qxynr1hf.js";import{ve}from"./chunk-index-gcmmwh8t.js";import"./chunk-index-m81362sc.js";var h={mon:u("Mon"),tue:u("Tue"),wed:u("Wed"),thu:u("Thu"),fri:u("Fri"),sat:u("Sat"),sun:u("Sun")};function w(c){if(typeof c!=="object"||c===null)return"";let o=c,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((d)=>t(h[String(d)]??String(d))).join(t(", ")):"";return t("{days} at {time}",{days:l,time:i})}default:return""}}function V(){let{timeZone:c}=_(),[o,i]=r(0),[l,d]=r(),{data:p,error:g}=ve(()=>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(v,{}):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(T,{children:a.lastStatus}):null]}),n("p",{className:"meta",children:[w(a.recurrence)," ·"," ",t("next {when}",{when:re(a.nextRun,c)})]}),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:()=>d(a),children:e(s,{name:"trash"})})]},a.id))}),e(q,{open:l!==void 0,title:t("Cancel this schedule?"),confirmLabel:t("Cancel schedule"),tone:"danger",onClose:()=>d(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{mn}from"./chunk-index-2e4am3hw.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 mn((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};
1
+ import{On}from"./chunk-index-cn49mawx.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 On((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,29 @@
1
+ import{p,Q,S,A,o,z,C,a,r,t,u,g,e,n,s,I,l,de,y,d,f,v,m,k,_,xe,yn,Dr,is,Le,Si,ss,fe,ji,J,Xe,In}from"./chunk-index-cn49mawx.js";import{Lo}from"./chunk-index-5vatmakn.js";import{lo,Xs,zs,co,Ds}from"./chunk-index-wxft0aqb.js";import{q}from"./chunk-index-qxynr1hf.js";import"./chunk-index-6yra9kdq.js";import"./chunk-index-n0ejy0wd.js";import"./chunk-index-q5fyrtx4.js";import{gr}from"./chunk-index-v8mma5np.js";import"./chunk-index-gwkhs8s3.js";import"./chunk-index-r7fdgzy1.js";import"./chunk-index-sm7kfb07.js";import{Bn}from"./chunk-index-254701sm.js";import{wn}from"./chunk-index-fepsbhr6.js";import{cn,qi,Rr,Bi}from"./chunk-index-h2vhv4kh.js";import{qt}from"./chunk-index-n0cmnwd2.js";import{_e}from"./chunk-index-zvvwxkev.js";import{Ot}from"./chunk-index-rgf4rvns.js";import{Ft}from"./chunk-index-2hvn2kte.js";import{Te}from"./chunk-index-e35v554x.js";import"./chunk-index-sw9r4aa4.js";import{se}from"./chunk-index-amxa2bn3.js";import{R}from"./chunk-index-m81362sc.js";import"./chunk-index-9bdstf8t.js";import{tn}from"./chunk-index-aexy023z.js";import{ne,Ee}from"./chunk-index-c7dbvkrq.js";import"./chunk-index-vsfsv8hd.js";import"./chunk-index-s53bxwkk.js";import"./chunk-index-bef0fc2m.js";import"./chunk-index-20xgx0k2.js";var Be=S(()=>(p("wv0vdsjv"),import("./chunk-prompt-history-wv0vdsjv.js")).then((i)=>({default:i.HistorySheet}))),We=S(()=>(p("215psy17"),import("./chunk-character-creator-215psy17.js")).then((i)=>({default:i.CharacterCreator}))),Ke=["default","off","minimal","low","medium","high","xhigh"],Ne={default:u("Default"),off:u("Off"),minimal:u("Minimal"),low:u("Low"),medium:u("Medium"),high:u("High"),xhigh:u("Very high")},Z="default",ke=(i)=>i.model===void 0?t("Default model ({current})",{current:i.effective.model}):t("Default model (server setting)"),Ue=u("Automatic"),pe=(i)=>i==="auto"?t(Ue):t(Ne[i]??i),be=(i)=>({displayName:i.displayName,prompt:i.prompt,model:i.model??Z,thinking:i.thinking??Z});function ye(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 we(){let i=is(),h=a(i);if(i)h.current=i;let c=h.current,b=i!==void 0;if(o(()=>{if(!b)return;let N=window.location.href,w=()=>{if(window.location.href!==N)yn()};return window.addEventListener("popstate",w),window.addEventListener("hashchange",w),()=>{window.removeEventListener("popstate",w),window.removeEventListener("hashchange",w)}},[b]),!c)return null;return e(R,{open:i!==void 0,title:t("Edit knight"),size:"wide",onClose:yn,children:e(qe,{name:c.name,opened:c.id},c.name)})}function qe({name:i,opened:h}){let[c,b]=r(),[N,w]=r([]),[T,V]=r(),[L,P]=r(),[D,U]=r(!1),[M,G]=r(!1),[O,B]=r(!1),[K,j]=r(!1),oe=In(c?.room??""),Y=a(null),ee=c!==void 0,X=l((x)=>c?x.rooms[c.room]?.view?.muted===!0:!1,c?.room??""),[re,W]=r(!1),ie=l((x)=>c?x.rooms[c.room]?.view?.coordinator===!0:!1,c?.room??""),te=z(),ae=z(),H=z();o(()=>{if(!ee||!Dr()?.look)return;Y.current?.scrollIntoView({block:"start"}),Y.current?.focus({preventScroll:!0})},[ee,h]);let E=a({});E.current={profile:c,draft:L},o(()=>{let x=!0;return Promise.all([y.agent(i),y.models()]).then(([me,Ve])=>{if(!x)return;let{profile:ve,draft:ce}=E.current,Ge=ve&&ce&&Object.keys(ye(ve,ce)).length>0;b(me),w(Ve.models),P(Ge?ce:be(me))},(me)=>x&&V(d(me))),()=>{x=!1}},[i,h]);let F=C(()=>c&&L?ye(c,L):{},[c,L]);if(T)return e(m,{message:T});if(!c||!L)return e(v,{});let he=Object.keys(F).length>0,Oe=Array.from(new Set([Z,...N,L.model])),ze=ke(c),ge=async()=>{U(!0);try{let x=await y.updateAgent(i,F);b(x),P(be(x)),G(!1),f(t("Saved."))}catch(x){f(d(x),"danger")}finally{U(!1)}};return n("div",{className:"stack agent-sheet",children:[n("header",{className:"profile-head",children:[e(fe,{spec:c.character,name:c.name,size:72,state:oe,label:c.displayName}),n("div",{children:[e("h3",{children:c.displayName}),e("p",{className:"meta",children:t("Runs on {model}, thinking {thinking}",{model:c.effective.model,thinking:pe(c.effective.thinking)})})]})]}),e("ul",{className:"menu",children:e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:H,children:[e("span",{className:"menu-icon",children:e(s,{name:X?"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(Ft,{id:H,checked:!X,label:t("Notifications"),busy:re,onChange:async(x)=>{W(!0),await tn(c.room,!x),W(!1)}})]})})}),M?e(Ye,{profile:c,draft:L,saving:D,onBack:()=>G(!1),onSave:ge}):n("form",{className:"stack form",onSubmit:(x)=>{if(x.preventDefault(),!he)return;if(F.prompt!==void 0)G(!0);else ge()},children:[n("label",{htmlFor:ae,children:[t("Name"),e("input",{id:ae,value:L.displayName,onChange:(x)=>P({...L,displayName:x.target.value})})]}),n("div",{className:"field",children:[n("div",{className:"field-head",children:[e("label",{htmlFor:te,children:t("Prompt")}),n("span",{className:"field-tools",children:[n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>j(!0),children:[e(s,{name:"reset",size:16}),t("History")]}),n("button",{type:"button",className:"secondary compact","aria-haspopup":"dialog",onClick:()=>B(!0),children:[e(je,{}),t("Full screen")]})]})]}),e("textarea",{id:te,rows:8,value:L.prompt,onChange:(x)=>P({...L,prompt:x.target.value})})]}),e(qt,{label:t("Model"),value:L.model,onChange:(x)=>P({...L,model:x}),options:Oe.map((x)=>({value:x,label:x===Z?ze:x}))}),e(qt,{label:t("Thinking level"),value:L.thinking,onChange:(x)=>P({...L,thinking:x}),options:Ke.map((x)=>({value:x,label:t(Ne[x])}))}),e("div",{className:"actions",children:e("button",{type:"submit",disabled:!he||D,children:D?t("Saving…"):F.prompt!==void 0?t("Review changes"):t("Save")})})]}),e(Ze,{name:i,opened:h}),n("section",{className:"card stack",ref:Y,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(Q,{fallback:e(v,{}),children:e(We,{name:c.name,displayName:c.displayName,prompt:c.prompt,character:c.character,onSaved:(x)=>b(x)})})]}),ie?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:()=>{yn(),Le({kind:"archive",room:c.room,name:c.displayName})},children:t("Archive {name}",{name:c.displayName})})})]}),K?e(Q,{fallback:null,children:e(Be,{open:K,title:t("History of the prompt"),load:async()=>(await _e.agentPromptHistory(i)).versions.map((x)=>({id:x.id,text:x.text,previous:x.previous,by:x.by,at:x.at})),onUse:(x)=>{P({...L,prompt:x}),j(!1)},onClose:()=>j(!1)})}):null,e(R,{open:O,title:t("Prompt"),size:"full",onClose:()=>B(!1),children:e("textarea",{className:"prompt-full","aria-label":t("Prompt"),value:L.prompt,onChange:(x)=>P({...L,prompt:x.target.value})})})]})}function Ze({name:i,opened:h}){let[c,b]=r(),[N,w]=r(),[T,V]=r(),L=z(),P=a(null),D=c!==void 0;if(o(()=>{if(!D||!Dr()?.skills)return;P.current?.scrollIntoView({block:"start"}),P.current?.focus({preventScroll:!0})},[D,h]),o(()=>{let M=!0;return ne.skills(i).then((G)=>M&&b(G),(G)=>{if(M&&!(G instanceof de&&G.status===404))V(d(G))}),()=>{M=!1}},[i,h]),T)return e(m,{message:T});if(!c)return null;let U=async(M,G)=>{w(M);try{b(await ne.setSkills(i,G?{add:[M]}:{remove:[M]}))}catch(O){f(d(O),"danger")}finally{w(void 0)}};return n("section",{className:"card stack","aria-label":t("Skills"),ref:P,tabIndex:-1,children:[e("h3",{children:t("Skills ({count})",{count:c.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:c.skills.map((M,G)=>{let O=`${L}-${G}`;return e("li",{children:n("label",{className:"menu-item menu-toggle",htmlFor:O,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(Ft,{id:O,checked:M.carried,label:M.name,busy:N===M.name,disabled:M.builtin,onChange:(B)=>U(M.name,B)})]})},M.name)})})]})}var je=()=>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 Ye(i){let{profile:h,draft:c}=i,b=a(null);o(()=>b.current?.focus(),[]);let N=[];if(c.displayName!==h.displayName)N.push({label:t("Name"),before:h.displayName,after:c.displayName});let w=(T)=>T===Z?ke(h):T;if(c.model!==(h.model??Z))N.push({label:t("Model"),before:w(h.model??Z),after:w(c.model)});if(c.thinking!==(h.thinking??Z))N.push({label:t("Thinking level"),before:pe(h.thinking??Z),after:pe(c.thinking)});return n("section",{ref:b,className:"stack review",tabIndex:-1,"aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),N.length?e("ul",{className:"review-fields",children:N.map((T)=>n("li",{children:[e("strong",{children:T.label}),e("span",{className:"review-before",children:T.before}),e("span",{"aria-hidden":"true",children:"→"}),e("span",{className:"review-after",children:T.after})]},T.label))}):null,e(Ot,{label:t("Prompt"),before:h.prompt,after:c.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 Je=300000;function Se(){let i=zs(),[h,c]=r(i);if(i&&i!==h)c(i);if(!h)return null;return e(R,{open:i!==void 0,title:t("Archived conversation"),size:"wide",onClose:Xs,children:e(Qe,{room:h.room,until:h.until},`${h.room}:${h.until}`)})}function Qe(i){se("archived-log",".archived-log .messages { padding: 0; }");let{timeZone:h}=_(),c=Xe(),[b,N]=r(),[w,T]=r(!1),[V,L]=r(),[P,D]=r(!1),{room:U,until:M}=i;o(()=>{let O=!0;return lo.page(U,M).then((B)=>{if(!O)return;N(B.messages),T(B.more)},(B)=>{if(O)L(d(B))}),()=>{O=!1}},[U,M]);let G=async()=>{let O=b?.[0];if(!O||P)return;D(!0);try{let B=await lo.page(U,M,O.id);N((K)=>[...B.messages,...K??[]]),T(B.more)}catch(B){L(d(B))}D(!1)};if(V)return e(m,{message:V});if(!b)return e(v,{});if(b.length===0)return e(k,{children:t("The archived conversation has no messages.")});return n("div",{className:"archived-log",children:[w?e("button",{type:"button",className:"secondary older",disabled:P,onClick:G,children:P?t("Loading…"):t("Load earlier messages")}):null,e("ol",{className:"messages",children:b.map((O,B)=>{let K=b[B-1],j=!K||K.kind!==O.kind||K.author!==O.author||Date.parse(O.at)-Date.parse(K.at)>Je;return e(ji,{message:O,character:O.agent?c[O.agent]:void 0,header:j,enter:!1,unread:!1,timeZone:h,quotable:!1},O.id)})})]})}var et=`
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 Ce(){let i=Ds(),[h,c]=r(i);if(i&&i!==h)c(i);if(!h)return null;return se("select-text",et),n(R,{open:i!==void 0,title:t("Select text"),size:"full",onClose:co,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:co,children:t("Close")}),e("button",{type:"button",onClick:()=>Bn(h.text),children:t("Copy all")})]})]})}function tt(i){let h=i.filter((N)=>N.parent!==void 0),c=i.filter((N)=>N.parent===void 0),b=new Set(c.map((N)=>N.name));return[...c.flatMap((N)=>[N,...h.filter((w)=>w.parent===N.name)]),...h.filter((N)=>!b.has(N.parent??""))]}function Ae(){let[i,h]=r(),[c,b]=r(),[N,w]=r(),[T,V]=r(),L=A(async()=>{try{h((await ne.archive()).entries),b(void 0)}catch(D){b(d(D))}},[]);o(()=>{L()},[L]);let P=async(D)=>{w(D.name);try{if(D.kind==="agent")await ne.restoreAgent(D.name);else await ne.restoreGroup(D.name);await Ee(),f(t("Restored {name}.",{name:D.displayName})),await L()}catch(U){f(d(U),"danger")}finally{w(void 0)}};if(c&&!i)return e(m,{message:c});if(!i)return e(v,{});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:tt(i).map((D)=>n("li",{className:"menu-item","data-helper":D.parent??void 0,style:D.parent?{paddingLeft:"var(--space-6)"}:void 0,children:[e("span",{className:"menu-icon",children:e(s,{name:D.kind==="agent"?"profile":"rooms"})}),n("span",{className:"menu-text",children:[e("strong",{children:D.displayName}),n("span",{className:"meta",children:[D.parent?t("Temp knight of {name}",{name:D.parent}):D.kind==="agent"?t("Knight"):t("Group")," ","· ",D.name]})]}),e("button",{type:"button",className:"secondary compact",disabled:N===D.name,onClick:()=>P(D),children:t("Restore")}),e("button",{type:"button",className:"compact danger",disabled:N===D.name,onClick:()=>V(D),children:t("Delete")})]},`${D.kind}:${D.name}`))}),e(q,{open:T!==void 0,title:t("Delete {name}?",{name:T?.displayName??""}),confirmLabel:t("Delete"),tone:"danger",onClose:()=>V(void 0),onConfirm:async()=>{if(!T)return;if(T.kind==="agent")await ne.deleteAgent(T.name);else await ne.deleteGroup(T.name);await Ee(),f(t("Deleted {name}.",{name:T.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:T?.displayName??""})})})]})}var Me=/^[a-z0-9-]{1,32}$/,De=2,Ie=8,le="\x00";function at(){let i=l((h)=>h.order.flatMap((c)=>{let b=h.rooms[c]?.view;return b?.kind==="agent"&&!b.helper?[`${b.name}${le}${b.displayName}`]:[]}).join(`${le}${le}`));return C(()=>i===""?[]:i.split(`${le}${le}`).map((h)=>{let[c="",b=""]=h.split(le);return{name:c,displayName:b}}),[i])}function He(i){let h=at(),[c,b]=r(),[N,w]=r(),[T,V]=r(""),[L,P]=r(""),[D,U]=r(!1),[M,G]=r([]),[O,B]=r(""),[K,j]=r(!1),[oe,Y]=r(i.name===void 0),ee=z(),X=z();o(()=>{let H=i.name;if(H===void 0)return;let E=!0;return ne.group(H).then((F)=>{if(!E)return;b(F),V(F.displayName),G(F.members),B(F.host),Y(!0)},(F)=>E&&w(d(F))),()=>{E=!1}},[i.name]);let re=(H)=>h.find((E)=>E.name===H)?.displayName??H,W=M.includes(O)?O:M[0]??"",ie=c===void 0?!0:T.trim()!==c.displayName||M.join(",")!==c.members.join(",")||W!==c.host,te=T.trim()!==""&&M.length>=De&&M.length<=Ie&&(c!==void 0||Me.test(L));if(N&&!oe)return e(m,{message:N});if(!oe)return e(v,{});let ae=async()=>{j(!0),w(void 0);try{if(c){await ne.updateGroup(c.name,{...T.trim()!==c.displayName?{displayName:T.trim()}:{},...M.join(",")!==c.members.join(",")?{members:M}:{},...W!==c.host?{host:W}:{}}),await Ee(),f(t("Saved.")),i.onDone();return}let H=await ne.createGroup({name:L,displayName:T.trim(),members:M,host:W});await Ee(),f(t("Made {name}.",{name:H.displayName})),i.onDone(),I("room",H.room)}catch(H){w(d(H))}finally{j(!1)}};return n("form",{className:"stack form",onSubmit:(H)=>{if(H.preventDefault(),te&&ie&&!K)ae()},children:[n("label",{htmlFor:ee,children:[t("Name"),e("input",{id:ee,value:T,autoComplete:"off",onChange:(H)=>{if(V(H.target.value),!c&&!D)P(H.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32))}})]}),c?null:n("label",{htmlFor:X,children:[t("Permanent name"),e("input",{id:X,value:L,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":L!==""&&!Me.test(L),onChange:(H)=>{U(!0),P(H.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((H)=>{let E=M.includes(H.name);return e("li",{children:n("label",{className:"menu-item menu-toggle",children:[e("input",{type:"checkbox",checked:E,disabled:!E&&M.length>=Ie,onChange:()=>G(E?M.filter((F)=>F!==H.name):[...M,H.name])}),e("span",{className:"menu-text",children:e("strong",{children:H.displayName})})]})},H.name)})})]}),M.length>=De?e(qt,{label:t("Host"),value:W,onChange:B,options:M.map((H)=>({value:H,label:re(H)}))}):null,N?e(m,{message:N}):null,n("div",{className:"actions",children:[c?e("button",{type:"button",className:"danger",onClick:()=>{i.onDone(),Le({kind:"archive",room:c.room,name:c.displayName})},children:t("Archive group")}):null,e("button",{type:"submit",disabled:!te||!ie||K,children:K?t("Saving…"):c?t("Save"):t("Make group")})]})]})}var nt=S(()=>(p("215psy17"),import("./chunk-character-creator-215psy17.js")).then((i)=>({default:i.CharacterCreator}))),Pe=/^[a-z0-9-]{1,32}$/,ue="default";function ot(i){let h=[];for(let c of i){let b=c.indexOf("/"),N=b>0?c.slice(0,b):"",w=h.find((T)=>T.provider===N&&N!=="");if(w)w.models.push(c);else h.push({provider:N,models:[c]})}return h}var st=(i)=>i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32);function Re({onDone:i}){let[h,c]=r(""),[b,N]=r(""),[w,T]=r(!1),[V,L]=r(""),[P,D]=r(ue),[U,M]=r(""),[G,O]=r(),[B,K]=r(!1),[j,oe]=r([]),[Y,ee]=r(),[X,re]=r(!1),W=[z(),z(),z(),z(),z()];o(()=>{let E=!0;return y.models().then((F)=>E&&oe(F.models),()=>{return}),()=>{E=!1}},[]);let ie=C(()=>wn({name:b,displayName:h,prompt:V}),[b,h,V]),te=G?.spec??ie,ae=Pe.test(b)&&h.trim()!==""&&V.trim()!=="";if(B)return e(Q,{fallback:e(v,{}),children:e(nt,{name:b||"new",displayName:h,prompt:V,character:te,onPick:(E,F)=>{O({input:E,spec:F}),K(!1)},onCancel:()=>K(!1)})});let H=async()=>{re(!0),ee(void 0);try{let E={name:b,displayName:h.trim(),prompt:V,...P!==ue?{model:P}:{},...U.trim()?{task:U.trim()}:{},...G?{character:G.input}:{}},F=await ne.createAgent(E);await Ee(),f(t("Made {name}.",{name:F.displayName})),i(),I("room",F.room)}catch(E){ee(E instanceof de&&E.field?`${E.field}: ${d(E)}`:d(E))}finally{re(!1)}};return n("form",{className:"stack form",onSubmit:(E)=>{if(E.preventDefault(),ae&&!X)H()},children:[n("label",{htmlFor:W[0],children:[t("Name"),e("input",{id:W[0],value:h,autoComplete:"off",onChange:(E)=>{if(c(E.target.value),!w)N(st(E.target.value))}})]}),n("label",{htmlFor:W[1],children:[t("Permanent name"),e("input",{id:W[1],value:b,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,"aria-invalid":b!==""&&!Pe.test(b),onChange:(E)=>{T(!0),N(E.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:W[2],children:[t("Prompt"),e("textarea",{id:W[2],rows:6,value:V,onChange:(E)=>L(E.target.value)}),e("span",{className:"meta",children:t("Its job, its sources, its limits and how it reports.")})]}),n("label",{htmlFor:W[4],children:[t("Model"),n(Te,{id:W[4],value:P,onChange:(E)=>D(E.target.value),children:[e("option",{value:ue,children:t("Default model")}),ot(j).map((E)=>E.provider===""?E.models.map((F)=>e("option",{value:F,children:F},F)):e("optgroup",{label:E.provider,children:E.models.map((F)=>e("option",{value:F,children:F},F))},E.provider))]})]}),n("label",{htmlFor:W[3],children:[t("Opening task"),e("textarea",{id:W[3],rows:3,value:U,onChange:(E)=>M(E.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(fe,{spec:te,name:b||"new",size:72,label:h}),n("div",{children:[e("strong",{children:t("Look")}),e("span",{className:"meta",children:G?t("Your look"):t("Suggested from its role")}),e("button",{type:"button",className:"secondary compact",onClick:()=>K(!0),children:t("Choose a look")})]})]}),Y?e(m,{message:Y}):null,e("div",{className:"actions",children:e("button",{type:"submit",disabled:!ae||X,children:X?t("Making…"):t("Make knight")})})]})}var rt=(i)=>i.kind==="new-agent"?t("New knight"):i.kind==="archive"?t("Archived"):i.name===void 0?t("New group"):t("Edit group");function Fe(){let i=ss(),h=a(i);if(i)h.current=i;let c=h.current,b=i!==void 0;if(o(()=>{if(!b)return;let N=window.location.href,w=()=>{if(window.location.href!==N)Si()};return window.addEventListener("popstate",w),window.addEventListener("hashchange",w),()=>{window.removeEventListener("popstate",w),window.removeEventListener("hashchange",w)}},[b]),!c)return null;return e(R,{open:i!==void 0,title:rt(c),size:"wide",onClose:Si,children:e("div",{className:"stack agent-sheet",children:c.kind==="new-agent"?e(Re,{onDone:Si}):c.kind==="archive"?e(Ae,{}):e(He,{...c.name===void 0?{}:{name:c.name},onDone:Si})},c.id)})}function $e(){let i=Rr(),h=a(!1);if(i)h.current=!0;return h.current?e(it,{open:i}):null}function it({open:i}){let h=_(),{now:c}=J(),b=l((w)=>cn(w).map(({id:T,card:V})=>{let L=w.rooms[V.room]?.view,P=L?.parent?w.rooms[L.parent]?.view:void 0;return{id:T,room:P?`${P.displayName} › ${L?.displayName??""}`:L?.displayName??V.room,title:V.frame.title,at:V.frame.at}})),N=b.length===0;return o(()=>{if(i&&N)qi()},[i,N]),e(R,{open:i&&!N,title:t("Cards waiting"),onClose:qi,children:e("ul",{className:"waiting-list",children:b.map((w)=>e("li",{children:n("button",{type:"button",onClick:()=>Bi(w.id),children:[e("strong",{children:w.title}),n("span",{className:"meta",children:[w.room,w.at?` · ${xe(w.at,c,h.timeZone)}`:""]})]})},w.id))})})}var lt=S(()=>(p("bh9ntk9s"),import("./chunk-shortcut-help-bh9ntk9s.js")));function mt(){let i=Lo(),h=a(!1);if(i)h.current=!0;if(!h.current)return null;return e(Q,{fallback:null,children:e(lt,{open:i})})}function ln(){return n(g,{children:[e(gr,{}),e(we,{}),e(Fe,{}),e(Se,{}),e(Ce,{}),e($e,{}),e(mt,{})]})}export{ln as SheetHosts};
@@ -1,4 +1,4 @@
1
- import{t,e,n}from"./chunk-index-2e4am3hw.js";import{Kn,So}from"./chunk-index-dj0tbfyb.js";import{on}from"./chunk-index-31x6krbs.js";import{L}from"./chunk-index-8d81qy69.js";var l=`
1
+ import{t,e,n}from"./chunk-index-cn49mawx.js";import{ii,zo}from"./chunk-index-5vatmakn.js";import{se}from"./chunk-index-amxa2bn3.js";import{R}from"./chunk-index-m81362sc.js";var l=`
2
2
  .shortcut-list {
3
3
  display: grid;
4
4
  grid-template-columns: max-content minmax(0, 1fr);
@@ -23,4 +23,4 @@ import{t,e,n}from"./chunk-index-2e4am3hw.js";import{Kn,So}from"./chunk-index-dj0
23
23
  text-align: center;
24
24
  font-size: var(--text-sm);
25
25
  }
26
- `;function r(){let o=So(),s=o?"⌥":"Alt",a=o?"⌘":"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:[a,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:o}){return on("shortcut-help",l),e(L,{open:o,title:t("Keyboard shortcuts"),onClose:Kn,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((a)=>e("kbd",{children:a},a))}),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};
26
+ `;function r(){let o=zo(),s=o?"⌥":"Alt",a=o?"⌘":"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:[a,"K"],label:t("Find a room")},{keys:["Esc"],label:t("Close the open menu or sheet, or leave the message box")},{keys:["?"],label:t("Show these shortcuts")}]}function i({open:o}){return se("shortcut-help",l),e(R,{open:o,title:t("Keyboard shortcuts"),onClose:ii,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((a)=>e("kbd",{children:a},a))}),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{ui,v,D,ke,y,nt,St}from"./chunk-index-2e4am3hw.js";import{fr}from"./chunk-index-g3wrs02w.js";import{jr}from"./chunk-index-kbrg32sx.js";import{bo,Kn,xo}from"./chunk-index-dj0tbfyb.js";import{ot}from"./chunk-index-g1awv7rk.js";function m(e,t){let{collapsed:o,expanded:r,current:s}=t,n=ot(e,t.at),a=[],c=(i,d)=>{a.push({key:i,shown:d});let f=n.threads[i];if(!f)return;for(let l of f.open)a.push({key:l,shown:d});for(let l of f.closed)a.push({key:l,shown:d&&(r.has(l)||l===s)})};for(let i of n.home)c(i,!0);for(let i of n.pinned)c(i,!0);for(let i of n.folders){let d=!o.has(i.id)||s!==void 0&&i.rooms.includes(s);for(let f of i.rooms)c(f,d)}let u=n.folders.length>0?n.rest:[...n.restAgents,...n.restGroups];for(let i of u)c(i,!0);let{orphans:p}=n;for(let i of p.open)a.push({key:i,shown:!0});for(let i of p.closed)a.push({key:i,shown:r.has(i)||i===s});return a}function h(e,t,o,r){let s=o===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((n)=>n.key===t),s<0)return}for(let n=s+o;n>=0&&n<e.length;n+=o){let a=e[n];if(a&&r(a))return a.key}return}var w=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function S(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return w.has(e.type)?e:void 0;return e.closest('[contenteditable]:not([contenteditable="false"])')?e:void 0}function b(e,t){if(e instanceof HTMLSelectElement)return!1;if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){if(e.value==="")return!0;let{selectionStart:n,selectionEnd:a}=e;if(n===null||a===null||n!==a)return!1;return t?n===0:n===e.value.length}if((e.textContent??"")==="")return!0;let o=window.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;let r=o.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 k(e){if(e.defaultPrevented||nt(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 o=t==="ArrowUp",r=S(e.target);if(r&&!b(r,o))return;if(e.shiftKey)return o?"previous-unread":"next-unread";return o?"previous":"next"}if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return S(e.target)?void 0:"help";return}function x(){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 g=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function E(e,t=12){let o=v("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===o);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>E(e,t-1))}function T(e,t){let o=y.getState(),r=ui(),s=r.pane==="room"?r.key:void 0,n=m(o,{at:(u)=>ke(o,u),collapsed:fr(),expanded:x(),current:s});if(r.pane==="room"&&!n.some((u)=>u.key===s))return;let c=h(n,s,e,t?(u)=>jr(u.key)>0:(u)=>u.shown);if(c===void 0)return;D("room",c),E(c)}function H(e){if(document.querySelector(".action-popover")){e.preventDefault(),St();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&w.has(t.type))e.preventDefault(),t.blur()}function K(e,t){switch(e){case"escape":H(t);break;case"help":if(t.preventDefault(),xo())Kn();else if(!g())bo();break;default:if(g())break;t.preventDefault(),T(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function P(){let e=(t)=>{let o=k(t);if(o)K(o,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{P as startShortcuts};
1
+ import{gi,x,I,Re,O,ot,kt}from"./chunk-index-cn49mawx.js";import{br}from"./chunk-index-t5bmsqqd.js";import{po}from"./chunk-index-gwkhs8s3.js";import{No,ii,Xo}from"./chunk-index-5vatmakn.js";import{at}from"./chunk-index-20xgx0k2.js";function m(e,t){let{collapsed:o,expanded:r,current:s}=t,n=at(e,t.at),a=[],c=(i,d)=>{a.push({key:i,shown:d});let f=n.threads[i];if(!f)return;for(let l of f.open)a.push({key:l,shown:d});for(let l of f.closed)a.push({key:l,shown:d&&(r.has(l)||l===s)})};for(let i of n.home)c(i,!0);for(let i of n.pinned)c(i,!0);for(let i of n.folders){let d=!o.has(i.id)||s!==void 0&&i.rooms.includes(s);for(let f of i.rooms)c(f,d)}let u=n.folders.length>0?n.rest:[...n.restAgents,...n.restGroups];for(let i of u)c(i,!0);let{orphans:p}=n;for(let i of p.open)a.push({key:i,shown:!0});for(let i of p.closed)a.push({key:i,shown:r.has(i)||i===s});return a}function y(e,t,o,r){let s=o===1?-1:e.length;if(t!==void 0){if(s=e.findIndex((n)=>n.key===t),s<0)return}for(let n=s+o;n>=0&&n<e.length;n+=o){let a=e[n];if(a&&r(a))return a.key}return}var g=new Set(["","text","search","url","tel","email","password","number","date","datetime-local","month","time","week"]);function h(e){if(!(e instanceof HTMLElement))return;if(e instanceof HTMLTextAreaElement)return e;if(e instanceof HTMLSelectElement)return e;if(e instanceof HTMLInputElement)return g.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:n,selectionEnd:a}=e;if(n===null||a===null||n!==a)return!1;return t?n===0:n===e.value.length}if((e.textContent??"")==="")return!0;let o=window.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;let r=o.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(e){if(e.defaultPrevented||ot(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 o=t==="ArrowUp",r=h(e.target);if(r&&!E(r,o))return;if(e.shiftKey)return o?"previous-unread":"next-unread";return o?"previous":"next"}if(t==="?"&&!e.ctrlKey&&!e.metaKey&&!e.repeat)return h(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 S=()=>document.querySelector('dialog[open], .action-popover, .switcher:not([data-state="closed"])')!==null;function w(e,t=12){let o=x("room",e),r=[...document.querySelectorAll('.room-row[aria-current="page"], .thread-link[aria-current="page"]')].find((s)=>s.getAttribute("href")===o);if(r)r.scrollIntoView?.({block:"nearest"});else if(t>0)requestAnimationFrame(()=>w(e,t-1))}function T(e,t){let o=O.getState(),r=gi(),s=r.pane==="room"?r.key:void 0,n=m(o,{at:(u)=>Re(o,u),collapsed:br(),expanded:k(),current:s});if(r.pane==="room"&&!n.some((u)=>u.key===s))return;let c=y(n,s,e,t?(u)=>po(u.key)>0:(u)=>u.shown);if(c===void 0)return;I("room",c),w(c)}function v(e){if(document.querySelector(".action-popover")){e.preventDefault(),kt();return}if(document.querySelector("dialog[open]"))return;let t=document.activeElement;if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&g.has(t.type))e.preventDefault(),t.blur()}function H(e,t){switch(e){case"escape":v(t);break;case"help":if(t.preventDefault(),Xo())ii();else if(!S())No();break;default:if(S())break;t.preventDefault(),T(e.startsWith("previous")?-1:1,e.endsWith("unread"))}}function P(){let e=(t)=>{let o=b(t);if(o)H(o,t)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}export{P as startShortcuts};
@@ -0,0 +1,8 @@
1
+ import{p,Q,S,o,z,r,t,g,e,n,s,de,d,f,v,m}from"./chunk-index-cn49mawx.js";import{_e}from"./chunk-index-zvvwxkev.js";import{Ot}from"./chunk-index-rgf4rvns.js";import{R}from"./chunk-index-m81362sc.js";var M=S(()=>(p("wv0vdsjv"),import("./chunk-prompt-history-wv0vdsjv.js")).then((c)=>({default:c.HistorySheet}))),B=`---
2
+ name: my-skill
3
+ description: "Use when "
4
+ ---
5
+
6
+ # My skill
7
+
8
+ `;function _(c){let{name:u}=c,[i,w]=r(),[h,b]=r(u?"":B),[y,F]=r(),[I,k]=r(!1),[C,x]=r(!1),[A,D]=r(!1),[H,N]=r(!1),T=z();o(()=>{if(!u)return;let a=!0;return _e.skillDocument(u).then((l)=>{if(!a)return;w(l),b(l.text)},(l)=>a&&F(d(l))),()=>{a=!1}},[u]);let L=i?.text??"",U=h!==L,E=u!==void 0&&!i&&!y,V=async()=>{x(!0);try{if(i){let a=await _e.saveSkillDocument(i.name,{text:h,baseHash:i.hash});w(a),b(a.text),k(!1),D(!1),f(t("Saved.")),c.onSaved()}else await _e.createSkillDocument({text:h}),f(t("Skill created.")),c.onSaved(),c.onClose()}catch(a){if(a instanceof de&&a.status===409){let{current:l}=a.body;w(l),D(!0)}else f(d(a),"danger")}finally{x(!1)}};return n(R,{open:!0,title:u??t("New skill"),size:"full",onClose:c.onClose,children:[y?e(m,{message:y}):null,E?e(v,{}):null,i&&!i.writable?e(m,{message:t("This skill cannot be edited here.")}):null,!E&&!y&&(!i||i.writable)?n("div",{className:"stack",children:[I?n("section",{className:"stack review","aria-label":t("Review changes"),children:[e("h3",{children:t("Review changes")}),A?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(Ot,{label:"SKILL.md",before:L,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:V,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:T,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:T,className:"prompt-full",spellCheck:!1,value:h,onChange:(a)=>b(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:!U||!h.trim(),onClick:()=>k(!0),children:t("Review changes")})})]}),H&&i?e(Q,{fallback:null,children:e(M,{open:H,title:t("History of {name}",{name:i.name}),load:async()=>{let{versions:a}=await _e.skillHistory(i.name);return a.map((l,K)=>({id:l.id,text:l.text,previous:a[K+1]?.text??"",by:l.by,at:l.at}))},onUse:(a)=>{b(a),k(!1),N(!1)},onClose:()=>N(!1)})}):null]}):null]})}export{_ as SkillEditor};
@@ -0,0 +1 @@
1
+ import{p,Ar,Q,S,o,r,t,g,e,n,s,y,d,f,v,m,k,T,Wt,Et}from"./chunk-index-cn49mawx.js";import{q}from"./chunk-index-qxynr1hf.js";import{ve}from"./chunk-index-gcmmwh8t.js";import{_e}from"./chunk-index-zvvwxkev.js";import{ie}from"./chunk-index-sw9r4aa4.js";import"./chunk-index-m81362sc.js";function V({source:i}){return e("div",{className:"prose document",children:e(Wt,{remarkPlugins:[Et],components:{a:({href:a,children:l})=>a&&/^https?:\/\//.test(a)?e("a",{href:a,target:"_blank",rel:"noreferrer",children:l}):e("span",{children:l}),img:({alt:a})=>e("span",{children:a}),pre:({children:a})=>e("div",{className:"code-block",children:e("pre",{children:a})}),table:({children:a})=>e("div",{className:"table-wrap",children:e("table",{children:a})})},children:i})})}var F=S(()=>(p("e43mwz01"),import("./chunk-skill-editor-e43mwz01.js")).then((i)=>({default:i.SkillEditor})));function Y(){let[i,a]=r(0),{data:l,error:c}=ve(()=>y.skills(),`skills:${i}`),[E,N]=r(),[D,w]=r(),[h,C]=r();o(()=>{y.session().then(N,()=>{return})},[]);let b=E?.skillEdit===!0;return n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:t("Skills")}),b?n("button",{type:"button",className:"secondary",onClick:()=>w({name:void 0}),children:[e(s,{name:"plus",size:16}),t("New skill")]}):null]}),e("p",{className:"hint",children:b?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,!l&&!c?e(v,{}):null,l?.length===0?e(k,{children:t("No skills.")}):null,l?.map((u)=>e(z,{skill:u,onEdit:b&&u.source.kind==="written"?()=>w({name:u.name}):void 0,onDelete:b&&u.source.kind==="written"?()=>C(u):void 0},`${u.name}:${i}`)),D?e(Q,{fallback:null,children:e(F,{name:D.name,onSaved:()=>a((u)=>u+1),onClose:()=>w(void 0)},D.name??"")}):null,e(q,{open:h!==void 0,title:t("Delete this skill?"),confirmLabel:t("Delete skill"),tone:"danger",onClose:()=>C(void 0),onConfirm:async()=>{if(!h)return;await _e.deleteSkillDocument(h.name),a((u)=>u+1),f(t("Deleted {name}.",{name:h.name}))},children:h?e(B,{skill:h}):null})]})}function B({skill:i}){return n(g,{children:[e("p",{children:i.carriers.length?t("{name} will be deleted and taken from the knights that carry it: {carriers}.",{name:i.name,carriers:i.carriers.join(", ")}):t("{name} will be deleted. No knight carries it.",{name:i.name})}),i.groups.length?e("p",{children:t("It also leaves the skill groups {groups}.",{groups:i.groups.join(", ")})}):null,e("p",{children:t("This cannot be undone.")})]})}function L(i){switch(i.kind){case"builtin":return t("Built in with the release; it changes with the release.");case"package":return t("From the package {package}; it changes when the package is upgraded.",{package:i.package});case"linked":return t("Linked from {repo}; change it in its repository.",{repo:`${i.repo}:${i.path}`});default:return}}function z({skill:i,onEdit:a,onDelete:l}){let[c,E]=r(!1),[N,D]=r(),[w,h]=r(),C=i.source.kind==="builtin"?t("Built-in"):i.source.kind==="written"?t("Knight-written"):i.source.kind==="package"?i.source.package:`${i.source.repo}:${i.source.path}`;return n("article",{className:"card",children:[n("div",{className:"card-head",children:[e("strong",{children:i.name}),e(T,{children:C}),i.missing?e(T,{tone:"warn",children:t("File missing")}):n(g,{children:[a?e("button",{type:"button",className:"secondary",onClick:a,children:t("Edit")}):null,e("button",{type:"button",className:"secondary",onClick:()=>{if(E(!0),!N)h(void 0),y.skill(i.name).then(D).catch((b)=>h(d(b)))},children:"SKILL.md"})]}),l?e("button",{type:"button",className:"secondary",onClick:l,children:t("Delete")}):null]}),e("p",{children:i.missing??i.description}),i.source.kind!=="written"?n("p",{className:"hint skill-lock",children:[e(s,{name:"lock",size:14}),e("span",{children:L(i.source)})]}):null,n("p",{className:"hint",children:[t("Carriers"),":"," ",i.source.kind==="builtin"?t("All knights"):i.carriers.join(", ")||t("None")]}),i.groups.length?n("p",{className:"hint",children:[t("Groups"),": ",i.groups.join(", ")]}):null,e(ie,{open:c,title:i.name,size:"wide",onClose:()=>E(!1),children:w?e(m,{message:w}):!N?e(v,{}):e(M,{title:i.name,detail:N})})]})}function M({title:i,detail:a}){let l=a.metadata.filter((c)=>!(c.key==="name"&&c.value===i));return n("div",{className:"skill-document",children:[l.length?e("dl",{className:"skill-meta",children:l.map((c)=>n(Ar,{children:[e("dt",{children:c.key}),e("dd",{children:c.value})]},c.key))}):null,e(V,{source:a.body})]})}export{Y as SkillsPage};
@@ -0,0 +1,16 @@
1
+ import{t,g,e,n,s,l}from"./chunk-index-cn49mawx.js";import{Ls}from"./chunk-index-wxft0aqb.js";import{se}from"./chunk-index-amxa2bn3.js";var p=`
2
+ .line.start-over {
3
+ flex-wrap: wrap;
4
+ margin-top: var(--space-4);
5
+ }
6
+
7
+ .line.start-over .link-button {
8
+ min-height: 1.75rem;
9
+ font-size: inherit;
10
+ }
11
+
12
+ .start-over-empty {
13
+ margin-top: var(--space-6);
14
+ font-size: var(--text-sm);
15
+ }
16
+ `;function c(a){se("start-over",p);let{message:o}=a,i=l((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:()=>Ls(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{c as default};
@@ -0,0 +1 @@
1
+ import{C,a,r,t,K,g,e,n,s,x,I,Je,Re,l,ot,Ht,bn,et,Ue,jt}from"./chunk-index-cn49mawx.js";import{ui}from"./chunk-index-sdcpf5dp.js";import{ai,li}from"./chunk-index-s9p27f9b.js";import{ci}from"./chunk-index-3gfbhmpb.js";import{Gt}from"./chunk-index-2tr41qht.js";import{Ys}from"./chunk-index-20xgx0k2.js";ai();function v(){let d=l((c)=>JSON.stringify(Ys(c,(o)=>Re(c,o),(o)=>Je(c,o)>0,!0).map((o)=>({id:o.id,...o.title===void 0?{}:{title:o.title},entries:o.keys.map((u)=>({key:u,name:c.rooms[u]?.view?.displayName??u,waiting:Je(c,u)>0}))})))),m=ui(),p=a(d);if(!m)p.current=d;let f=p.current;return C(()=>JSON.parse(f),[f])}function b(d){let{key:m,name:p}=d.entry,f=l((i)=>i.rooms[m]),c=l((i)=>Je(i,m)),o=f?.view,u=et(o?.character),w=Gt(()=>Ht(m,d.onLeave),d.liftable&&!o?.home?li(m):void 0);if(!o)return null;return e("li",{...d.liftable&&!o.home?{"data-drop-item":"","data-key":m}:{},children:n("a",{className:"switcher-row",...w,href:x("room",m),"aria-current":m===d.current?"page":void 0,style:u,onClick:(i)=>{if(i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;i.preventDefault(),d.onPick(m)},children:[n("span",{className:"switcher-picture",children:[e(Ue,{view:o,size:40}),c?e("span",{className:"switcher-dot","aria-hidden":"true"}):null]}),n("span",{className:"switcher-name",children:[e("strong",{children:p}),f?.typing?n("span",{className:"switcher-working",children:[n("span",{className:"typing","aria-hidden":"true",children:[e("i",{}),e("i",{}),e("i",{})]}),t("Working")]}):null]}),e(jt,{room:m}),c?e("span",{className:"badge badge-warn",children:K(c,"{count} card waiting","{count} cards waiting")}):null,o.muted?n("span",{className:"switcher-mode","data-mode":"muted",title:t("Notifications are off"),children:[e(s,{name:"bell-off",size:14}),e("span",{className:"visually-hidden",children:t("Notifications are off")})]}):null,f?.mode.yolo?n("span",{className:"switcher-mode","data-mode":"yolo",title:t("Yolo"),children:[e(s,{name:"bolt",size:14}),e("span",{className:"visually-hidden",children:t("Yolo")})]}):null,f?.mode.longRunning?n("span",{className:"switcher-mode","data-mode":"long",title:t("Long-running"),children:[e(s,{name:"timer",size:14}),e("span",{className:"visually-hidden",children:t("Long-running")})]}):null]})})}function U(d){let[m,p]=r(""),f=v(),c=f.map((i)=>({...i,entries:i.entries.filter((h)=>ci(m,h.name)!==void 0)})).filter((i)=>i.entries.length>0||m===""),o=(i)=>d.close(i===d.current?void 0:()=>I("room",i)),u=f.some((i)=>i.id!=="waiting"&&i.id!=="home"&&i.id!=="rest"&&(i.id!=="pinned"||i.entries.length>0))?t("Ungrouped"):t("Rooms"),w=c.filter((i)=>i.entries.length>0).length>1;return n(g,{children:[n("div",{className:"switcher-search",children:[e(s,{name:"search",size:16}),e("input",{type:"search",value:m,placeholder:t("Find a room"),"aria-label":t("Find a room"),enterKeyHint:"go",autoComplete:"off",onChange:(i)=>p(i.target.value),onKeyDown:(i)=>{let h=c.flatMap((y)=>y.entries)[0];if(i.key==="Enter"&&h&&!ot(i.nativeEvent))o(h.key)}}),e("button",{type:"button",className:"icon-button switcher-add","aria-label":t("Add"),"aria-haspopup":"menu",onClick:(i)=>bn(i.currentTarget,d.close),children:e(s,{name:"plus"})})]}),e("div",{className:"switcher-scroll","data-drop-root":"",children:c.map((i)=>{let h=i.id==="waiting",y=i.id==="pinned"?"pinned":i.id==="rest"?"rest":h||i.id==="home"?void 0:"folder";return n("section",{"aria-label":h?t("Waiting for you"):i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?u:i.title??t("Rooms"),...i.entries.length===0?{"data-empty":""}:{},...y?{"data-drop-zone":y,"data-zone-id":i.id,...y==="folder"?{"data-folder":i.id}:{}}:{},children:[h?e("h2",{className:"switcher-heading","data-waiting":"",children:t("Waiting for you")}):w||i.entries.length===0?e("h2",{className:"switcher-heading",children:i.id==="home"?t("Home"):i.id==="pinned"?t("Pinned"):i.id==="rest"?u:i.title}):null,e("ul",{className:"switcher-list",children:i.entries.map((N)=>e(b,{entry:N,current:d.current,onPick:o,onLeave:d.close,liftable:!h&&i.id!=="home"},N.key))})]},i.id)})})]})}export{U as SwitcherList};
@@ -1 +1 @@
1
- import{y,Go,Ki}from"./chunk-index-2e4am3hw.js";import{Hr,Kr}from"./chunk-index-kbrg32sx.js";import{Xi,Po}from"./chunk-index-ac1ktr56.js";import"./chunk-index-msqhgvfx.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 H(){let s=()=>Xi().badge+Kr(),a=()=>Go(s());g({count:()=>Ki(y.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};y.subscribe(t),Po(t),Hr(t)},render:m}),a()}export{H as startPageTabDot};
1
+ import{O,cs,Dn}from"./chunk-index-cn49mawx.js";import{ho,mo}from"./chunk-index-gwkhs8s3.js";import{Gi,jo}from"./chunk-index-7qd604rq.js";import"./chunk-index-rsd8rftk.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=()=>Gi().badge+mo(),a=()=>cs(s());g({count:()=>Dn(O.getState())+s(),subscribe:(r)=>{let t=()=>{a(),r()};O.subscribe(t),jo(t),ho(t)},render:m}),a()}export{T as startPageTabDot};