pi-roundtable-web 0.29.0 → 0.29.1

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 (219) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/chunk-account-66e6ezdq.js +1 -0
  3. package/dist/{chunk-action-menu-q5y7xpry.js → chunk-action-menu-ap5xn7bf.js} +1 -1
  4. package/dist/{chunk-agent-x74xezyt.js → chunk-agent-sapt5qhn.js} +1 -1
  5. package/dist/chunk-arranged-rooms-n6bk696f.js +1 -0
  6. package/dist/chunk-attachments-p5v9gqyt.js +102 -0
  7. package/dist/chunk-bulk-actions-aze4ewc4.js +1 -0
  8. package/dist/chunk-character-creator-m7tw20ef.js +225 -0
  9. package/dist/{chunk-codeeditor-239ss6a2.js → chunk-codeeditor-yy6pq8mv.js} +2 -2
  10. package/dist/chunk-confirm-0cajsfhk.js +1 -0
  11. package/dist/chunk-connectors-tw0tbm21.js +37 -0
  12. package/dist/chunk-conversations-wkm23m5r.js +1 -0
  13. package/dist/{chunk-council-sheet-a5e6tspr.js → chunk-council-sheet-mz7s23nq.js} +2 -2
  14. package/dist/chunk-council-view-zgvzxtgn.js +1 -0
  15. package/dist/{chunk-drag-7873fvzw.js → chunk-drag-d1bpy8w6.js} +1 -1
  16. package/dist/{chunk-entry-5zmjxadx.js → chunk-entry-7zr5b1fp.js} +1 -1
  17. package/dist/{chunk-folder-list-h9hmbm8e.js → chunk-folder-list-bs4eh3g9.js} +1 -1
  18. package/dist/chunk-folds-eez1q41c.js +1 -0
  19. package/dist/{chunk-gate-fa6za28z.js → chunk-gate-dt91egcd.js} +1 -1
  20. package/dist/chunk-host-icons-nfe2t8tk.js +1 -0
  21. package/dist/chunk-host-picture-4rtswxwa.js +1 -0
  22. package/dist/chunk-host-state-1vxzmmq6.js +1 -0
  23. package/dist/chunk-host-ui-x38bf0et.js +1 -0
  24. package/dist/{chunk-index-4re5prfp.js → chunk-index-0h99xcs3.js} +2 -2
  25. package/dist/{chunk-index-5ssncptg.js → chunk-index-1kb8tv4v.js} +2 -2
  26. package/dist/chunk-index-24cggw6k.js +50 -0
  27. package/dist/chunk-index-2g8xtwqg.js +2 -0
  28. package/dist/chunk-index-3n38xe7m.js +2 -0
  29. package/dist/{chunk-index-en5dm1zv.js → chunk-index-3tksdmx7.js} +2 -2
  30. package/dist/{chunk-index-rr73h4kc.js → chunk-index-4a1tdadd.js} +3 -3
  31. package/dist/{chunk-index-f4gqzfkv.js → chunk-index-53fwc7sc.js} +2 -2
  32. package/dist/chunk-index-55ps4x5n.js +2 -0
  33. package/dist/{chunk-index-4krm48hm.js → chunk-index-5j1v2q7w.js} +1 -1
  34. package/dist/chunk-index-5w6tb7p0.js +2 -0
  35. package/dist/{chunk-index-y6p8j3zv.js → chunk-index-6btdp13p.js} +1 -1
  36. package/dist/chunk-index-6m7dwsmv.js +1 -0
  37. package/dist/{chunk-index-7c9fn21n.js → chunk-index-6rdywten.js} +2 -2
  38. package/dist/{chunk-index-gj3n4dh5.js → chunk-index-6s2pqwna.js} +2 -2
  39. package/dist/{chunk-index-r0hk9kyd.js → chunk-index-7mrkq793.js} +2 -2
  40. package/dist/chunk-index-7xcbpeqz.js +2 -0
  41. package/dist/chunk-index-88wh5eyj.js +2 -0
  42. package/dist/{chunk-index-ntt3em2k.js → chunk-index-8pbwr3rs.js} +1 -1
  43. package/dist/{chunk-index-bjeg3e2j.js → chunk-index-8wpvj7k5.js} +2 -2
  44. package/dist/chunk-index-97dcp1vh.js +1 -0
  45. package/dist/chunk-index-a7e6rhxy.js +2 -0
  46. package/dist/{chunk-index-4eag6s50.js → chunk-index-bxf8eq1s.js} +2 -2
  47. package/dist/chunk-index-c8gm1crh.js +120 -0
  48. package/dist/{chunk-index-4jnn2g09.js → chunk-index-ce7hsda9.js} +2 -2
  49. package/dist/chunk-index-cfesmk1f.js +2 -0
  50. package/dist/{chunk-index-zdzzf3fp.js → chunk-index-cmzvq3nf.js} +1 -1
  51. package/dist/{chunk-index-35zqk1zr.js → chunk-index-d4mx2vvf.js} +2 -2
  52. package/dist/chunk-index-d74tpnkd.js +2 -0
  53. package/dist/chunk-index-d941ae7c.js +2 -0
  54. package/dist/{chunk-index-rtz4936v.js → chunk-index-dr0jr7d3.js} +3 -3
  55. package/dist/{chunk-index-pcbkp62w.js → chunk-index-en728705.js} +2 -2
  56. package/dist/chunk-index-fb3kzyyp.js +2 -0
  57. package/dist/{chunk-index-a8c0ap8g.js → chunk-index-ffnd0jcj.js} +2 -2
  58. package/dist/chunk-index-fn6305vn.js +3 -0
  59. package/dist/{chunk-index-evhaaqzk.js → chunk-index-gdh7wsd5.js} +11 -11
  60. package/dist/{chunk-index-3tjmyd1h.js → chunk-index-m76gdwnk.js} +1 -1
  61. package/dist/chunk-index-mr391t49.js +2 -0
  62. package/dist/chunk-index-n3khm9fq.js +2 -0
  63. package/dist/{chunk-index-93f3e06v.js → chunk-index-nn4w6a04.js} +2 -2
  64. package/dist/{chunk-index-hef4gwtb.js → chunk-index-nr275sa7.js} +2 -2
  65. package/dist/{chunk-index-cttrqfm8.js → chunk-index-prq011b6.js} +1 -1
  66. package/dist/{chunk-index-h2a42p6s.js → chunk-index-q4k9vk04.js} +17 -1
  67. package/dist/chunk-index-rgdaec7y.js +2 -0
  68. package/dist/chunk-index-rjs1can6.js +2 -0
  69. package/dist/chunk-index-s4a8e4qm.js +2 -0
  70. package/dist/{chunk-index-q33ppq0j.js → chunk-index-sz381vda.js} +3 -3
  71. package/dist/{chunk-index-1652v386.css → chunk-index-t7csmbpy.css} +1 -1
  72. package/dist/{chunk-index-amspdq2j.js → chunk-index-v9jqyr1f.js} +1 -1
  73. package/dist/{chunk-index-e46652wf.js → chunk-index-vpq2cj14.js} +1 -1
  74. package/dist/chunk-index-vsaggfns.js +2 -0
  75. package/dist/{chunk-index-7k5895sn.js → chunk-index-w17wgjby.js} +3 -3
  76. package/dist/{chunk-index-teyx2hz7.js → chunk-index-wgrx2ybn.js} +2 -2
  77. package/dist/chunk-index-wsv46y9p.js +2 -0
  78. package/dist/{chunk-index-v6h43553.js → chunk-index-xbj816p0.js} +2 -2
  79. package/dist/{chunk-index-aycxt14t.js → chunk-index-yr758n6t.js} +2 -2
  80. package/dist/{chunk-index-pfs6rm6w.js → chunk-index-ysv36nbk.js} +2 -2
  81. package/dist/{chunk-index-haac6nbt.js → chunk-index-ze9p4npm.js} +2 -2
  82. package/dist/chunk-index-zfdvyrjt.js +2 -0
  83. package/dist/chunk-lang-css-3h22se37.js +1 -0
  84. package/dist/{chunk-lang-dockerfile-2p7e3ssz.js → chunk-lang-dockerfile-y24eejnh.js} +1 -1
  85. package/dist/{chunk-lang-go-zxp9k517.js → chunk-lang-go-qzgv1161.js} +2 -2
  86. package/dist/chunk-lang-html-9rvrmmpg.js +1 -0
  87. package/dist/chunk-lang-javascript-4kv8s3tk.js +1 -0
  88. package/dist/{chunk-lang-json-zmym50rg.js → chunk-lang-json-99v80v88.js} +1 -1
  89. package/dist/{chunk-lang-markdown-ww2kcs85.js → chunk-lang-markdown-gn8he877.js} +4 -4
  90. package/dist/{chunk-lang-python-ng1zdtd4.js → chunk-lang-python-prsw4p4k.js} +2 -2
  91. package/dist/{chunk-lang-rust-6ynhxjdd.js → chunk-lang-rust-g6xqta16.js} +1 -1
  92. package/dist/{chunk-lang-shell-39t9bz2s.js → chunk-lang-shell-dmpnzc6w.js} +1 -1
  93. package/dist/{chunk-lang-sql-w875ejpg.js → chunk-lang-sql-wz7ca27b.js} +2 -2
  94. package/dist/{chunk-lang-toml-b8ckgkg5.js → chunk-lang-toml-160prtq4.js} +1 -1
  95. package/dist/chunk-lang-typescript-mp0yw903.js +1 -0
  96. package/dist/{chunk-lang-xml-bz91cjp1.js → chunk-lang-xml-9htkz2dd.js} +1 -1
  97. package/dist/{chunk-lang-yaml-g9zy0tdv.js → chunk-lang-yaml-08749wd5.js} +1 -1
  98. package/dist/chunk-layout-actions-tdx896xf.js +1 -0
  99. package/dist/chunk-menu-items-trhybv1g.js +1 -0
  100. package/dist/chunk-mode-toggle-4dtfphq4.js +1 -0
  101. package/dist/chunk-note-row-28e5x7n8.js +233 -0
  102. package/dist/chunk-notes-5nkayhw8.js +1 -0
  103. package/dist/chunk-notice-bell-xz8a04am.js +1 -0
  104. package/dist/{chunk-notices-mtn7pg1z.js → chunk-notices-d0cwvk27.js} +1 -1
  105. package/dist/{chunk-onboarding-f3hhxgg4.js → chunk-onboarding-zs4rtea9.js} +1 -1
  106. package/dist/{chunk-overview-qmepntrr.js → chunk-overview-9sb3ywa8.js} +1 -1
  107. package/dist/{chunk-palette-edkn1ypq.js → chunk-palette-5sfhrv4x.js} +1 -1
  108. package/dist/chunk-placement-items-e2neja55.js +1 -0
  109. package/dist/{chunk-profile-pwfq0wns.js → chunk-profile-jffhtpqf.js} +1 -1
  110. package/dist/{chunk-prompt-history-xp9hmeqt.js → chunk-prompt-history-1jz2gk3v.js} +1 -1
  111. package/dist/{chunk-prompts-a56qvytg.js → chunk-prompts-0t30ttd0.js} +1 -1
  112. package/dist/chunk-room-confirms-6595921h.js +1 -0
  113. package/dist/{chunk-room-menu-1m2c2ekt.js → chunk-room-menu-hwkjyxwe.js} +1 -1
  114. package/dist/chunk-rooms-menu-button-k0eq1tcr.js +1 -0
  115. package/dist/{chunk-schedules-kwnw7p8v.js → chunk-schedules-e12y8fw2.js} +1 -1
  116. package/dist/{chunk-seat-menu-m2n9nvv0.js → chunk-seat-menu-n2bcw0mf.js} +1 -1
  117. package/dist/chunk-sheet-hosts-myvm2vhd.js +29 -0
  118. package/dist/chunk-shortcut-help-434sqnxc.js +26 -0
  119. package/dist/chunk-shortcuts-mjxph0g7.js +1 -0
  120. package/dist/chunk-skill-editor-98492yrt.js +8 -0
  121. package/dist/chunk-skills-mfv8ppfh.js +1 -0
  122. package/dist/chunk-start-over-line-m526193z.js +16 -0
  123. package/dist/{chunk-switcher-list-ehsn2wsk.js → chunk-switcher-list-5ngjar24.js} +1 -1
  124. package/dist/{chunk-tab-dot-gkpe06q8.js → chunk-tab-dot-tzjkahj5.js} +1 -1
  125. package/dist/{chunk-table-av3kh3tt.js → chunk-table-xbtbex2z.js} +1 -1
  126. package/dist/{chunk-table2d-5x3jptp9.js → chunk-table2d-61bvrykm.js} +1 -1
  127. package/dist/{chunk-table3d-rsvajx7r.js → chunk-table3d-5a7vbgyj.js} +24 -24
  128. package/dist/chunk-thread-actions-bf6vf2mt.js +1 -0
  129. package/dist/{chunk-thread-cards-grzszfha.js → chunk-thread-cards-n0n603vf.js} +1 -1
  130. package/dist/chunk-thread-list-7bkdn51x.js +227 -0
  131. package/dist/{chunk-transcript-t5szb8r0.js → chunk-transcript-8ztrkt6g.js} +1 -1
  132. package/dist/chunk-waiting-chip-y83c90v3.js +32 -0
  133. package/dist/chunk-waiting-s273kcgz.js +1 -0
  134. package/dist/chunk-where-jr791gzj.js +1 -0
  135. package/dist/chunk-workspace-dw71mshw.js +586 -0
  136. package/dist/chunk-zh-tw-vm5d0w6j.js +1 -0
  137. package/dist/index.html +1 -1
  138. package/dist/sw.js +1 -1
  139. package/package.json +2 -2
  140. package/src/api-types.ts +12 -0
  141. package/src/app/app.ts +7 -0
  142. package/src/app/card-log.ts +10 -2
  143. package/src/app/protocol.ts +18 -0
  144. package/src/app/queued-delivery.ts +107 -0
  145. package/src/app/queued-frames.ts +115 -0
  146. package/src/app/room-log.ts +39 -7
  147. package/src/app/routes.ts +97 -5
  148. package/src/app/socket.ts +12 -2
  149. package/src/app/surface.ts +37 -6
  150. package/src/app/zip.ts +124 -0
  151. package/src/auth/sessions.ts +9 -1
  152. package/src/host/cards.ts +10 -3
  153. package/src/host/stored-json.ts +23 -0
  154. package/src/i18n/zh-tw.ts +14 -0
  155. package/src/notices/mount.ts +1 -0
  156. package/src/notices/store.ts +9 -1
  157. package/src/web-plugin.ts +4 -1
  158. package/dist/chunk-account-9616x405.js +0 -1
  159. package/dist/chunk-arranged-rooms-9prq46vh.js +0 -1
  160. package/dist/chunk-bulk-actions-5dc4m9ad.js +0 -1
  161. package/dist/chunk-character-creator-wf02eg0h.js +0 -1
  162. package/dist/chunk-confirm-bhrx9195.js +0 -1
  163. package/dist/chunk-connectors-k77pd9by.js +0 -37
  164. package/dist/chunk-conversations-ftcpaqw1.js +0 -1
  165. package/dist/chunk-council-view-6593rqbr.js +0 -1
  166. package/dist/chunk-folds-vxq86t1s.js +0 -1
  167. package/dist/chunk-host-icons-y6frbzqt.js +0 -1
  168. package/dist/chunk-host-picture-fqg55rbr.js +0 -1
  169. package/dist/chunk-host-state-65tdhkyq.js +0 -1
  170. package/dist/chunk-host-ui-233kz7qp.js +0 -1
  171. package/dist/chunk-index-2c00zf3z.js +0 -2
  172. package/dist/chunk-index-2dhrqvba.js +0 -2
  173. package/dist/chunk-index-2s4bkrz3.js +0 -2
  174. package/dist/chunk-index-2ypaqwjy.js +0 -2
  175. package/dist/chunk-index-39qq37j5.js +0 -2
  176. package/dist/chunk-index-57teqgct.js +0 -2
  177. package/dist/chunk-index-9m9v1p7s.js +0 -2
  178. package/dist/chunk-index-a8nqn3y0.js +0 -3
  179. package/dist/chunk-index-am7ghh75.js +0 -120
  180. package/dist/chunk-index-amxa2bn3.js +0 -2
  181. package/dist/chunk-index-dajanzxc.js +0 -1
  182. package/dist/chunk-index-e2eeckhh.js +0 -2
  183. package/dist/chunk-index-ek98d2rn.js +0 -2
  184. package/dist/chunk-index-gp4chnp3.js +0 -2
  185. package/dist/chunk-index-mg96sqpk.js +0 -2
  186. package/dist/chunk-index-nsya88fn.js +0 -1
  187. package/dist/chunk-index-smz90j6p.js +0 -2
  188. package/dist/chunk-index-vzqwn3wp.js +0 -2
  189. package/dist/chunk-index-wt2asefx.js +0 -50
  190. package/dist/chunk-index-x4tq9btg.js +0 -2
  191. package/dist/chunk-index-yvcdg5hh.js +0 -2
  192. package/dist/chunk-index-zeqfnkty.js +0 -2
  193. package/dist/chunk-index-zpwb8mkk.js +0 -2
  194. package/dist/chunk-lang-css-avzhvm72.js +0 -1
  195. package/dist/chunk-lang-html-red02gep.js +0 -1
  196. package/dist/chunk-lang-javascript-n33kmjcx.js +0 -1
  197. package/dist/chunk-lang-typescript-qf8acbb2.js +0 -1
  198. package/dist/chunk-layout-actions-fyzzzeyp.js +0 -1
  199. package/dist/chunk-menu-items-yvnk3vds.js +0 -1
  200. package/dist/chunk-mode-toggle-ccv271hm.js +0 -1
  201. package/dist/chunk-note-row-314py1pp.js +0 -204
  202. package/dist/chunk-notes-4rnrddzw.js +0 -1
  203. package/dist/chunk-notice-bell-z9wgamnz.js +0 -1
  204. package/dist/chunk-placement-items-trsa5t23.js +0 -1
  205. package/dist/chunk-room-confirms-gqpkz4h0.js +0 -1
  206. package/dist/chunk-rooms-menu-button-tcvda1gq.js +0 -1
  207. package/dist/chunk-sheet-hosts-pr8xktyq.js +0 -29
  208. package/dist/chunk-shortcut-help-sbvrds1m.js +0 -26
  209. package/dist/chunk-shortcuts-8705p7q3.js +0 -1
  210. package/dist/chunk-skill-editor-7xy09sq1.js +0 -8
  211. package/dist/chunk-skills-cnc25x7q.js +0 -1
  212. package/dist/chunk-start-over-line-97zdd9pb.js +0 -16
  213. package/dist/chunk-thread-actions-7xtkegwm.js +0 -1
  214. package/dist/chunk-thread-list-9bjjac3j.js +0 -217
  215. package/dist/chunk-waiting-chip-d8b6a0p8.js +0 -28
  216. package/dist/chunk-waiting-ts3kxjvv.js +0 -1
  217. package/dist/chunk-where-3d3ncsa5.js +0 -1
  218. package/dist/chunk-workspace-ct6hvn0z.js +0 -578
  219. package/dist/chunk-zh-tw-v9v1eerm.js +0 -1
@@ -1,578 +0,0 @@
1
- import{p,dn,E,ke,o,L,Ne,C,a,r,t,u,g,e,n,s,x,vi,X,Hi,fe,h,l,f,v,m,k,T,_,re,Le,Ce}from"./chunk-index-wt2asefx.js";import{D}from"./chunk-index-y6p8j3zv.js";import{Te}from"./chunk-index-rtz4936v.js";import{ne}from"./chunk-index-57teqgct.js";import{se}from"./chunk-index-amxa2bn3.js";import{R}from"./chunk-index-zdzzf3fp.js";function dt(i,d,c){let[b,w]=r();o(()=>{if(!i)return;let S=(y)=>y.preventDefault(),I=(y)=>{if(y.button!==0||y.metaKey||y.ctrlKey||y.shiftKey||y.altKey)return;let M=y.target instanceof Element?y.target.closest("a"):null;if(!M||M.target||M.hasAttribute("download"))return;if(d.current?.contains(M))return;y.preventDefault(),y.stopPropagation(),w({kind:"link",anchor:M})},z=vi((y)=>w({kind:"navigate",proceed:y}));return window.addEventListener("beforeunload",S),document.addEventListener("click",I,!0),()=>{z(),window.removeEventListener("beforeunload",S),document.removeEventListener("click",I,!0)}},[i,d]);let N=E(()=>w(void 0),[]),W=E(()=>{let S=b;if(c(),w(void 0),S?.kind==="link")setTimeout(()=>S.anchor.click(),0);else if(S?.kind==="navigate")S.proceed()},[b,c]);return{leaving:b,stay:N,leave:W}}var de=(i)=>`workspace/${encodeURIComponent(i)}`,Ee=(i)=>`path=${encodeURIComponent(i)}`,_e=(i)=>({body:JSON.stringify(i)});function Ue(i){if(!(i instanceof fe)||i.status!==409)return;let d=i.body;return d?.conflict==="changed"||d?.conflict==="gone"||d?.conflict==="exists"?d:void 0}var j={roots:()=>h("workspace"),list:(i,d)=>h(`${de(i)}/list?${Ee(d)}`),file:(i,d)=>h(`${de(i)}/file?${Ee(d)}`),save:(i,d,c,b)=>h(`${de(i)}/file?${Ee(d)}`,{method:"PUT",..._e({text:c,baseHash:b})}),create:(i,d,c,b)=>h(`${de(i)}/new?${Ee(d)}`,{method:"POST",..._e({kind:c,...b===void 0?{}:{text:b}})}),rename:(i,d,c)=>h(`${de(i)}/rename`,{method:"POST",..._e({from:d,to:c})}),remove:(i,d)=>h(`${de(i)}/entry?${Ee(d)}`,{method:"DELETE"}),trash:(i)=>h(`${de(i)}/trash`),restore:(i,d)=>h(`${de(i)}/trash/${encodeURIComponent(d)}/restore`,{method:"POST"}),purge:(i,d)=>h(`${de(i)}/trash/${encodeURIComponent(d)}`,{method:"DELETE"})},we=(i,d,c=!1)=>`api/${de(i)}/raw?${Ee(d)}${c?"&download=1":""}`;var Me=(i)=>i.split("/").filter(Boolean),ve=(i)=>Me(i).slice(0,-1).join("/"),Se=(i,d)=>i?`${i}/${d}`:d,De=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function lt(i){if(!i)return;let d=i.indexOf(":");if(d<1)return;let c=i.slice(d+1);return{root:i.slice(0,d),path:c.replace(/\/+$/,""),dir:c===""||c.endsWith("/")}}var ct=`/*
2
- * The files pane: roots, a tree, breadcrumbs, a folder's rows, and a file in the editor. Colors
3
- * are the page's tokens and the --code-* set (tokens.css, styles/camelot.css), so a look or a
4
- * light/dark switch recolors it with nothing rebuilt. Only transform and opacity ever move.
5
- */
6
-
7
- .ws-page {
8
- display: flex;
9
- flex-direction: column;
10
- min-height: 0;
11
- flex: 1;
12
- }
13
-
14
- .ws {
15
- height: 100%;
16
- }
17
-
18
- /* ── Header and breadcrumbs ─────────────────────────────────────────────────────────────────────── */
19
-
20
- .ws-head {
21
- display: flex;
22
- align-items: center;
23
- gap: var(--space-2);
24
- min-height: var(--touch);
25
- padding: var(--space-1) var(--space-3);
26
- border-bottom: 1px solid var(--border);
27
- background: var(--surface);
28
- }
29
-
30
- .ws-root-picker {
31
- width: auto;
32
- min-width: 9rem;
33
- max-width: 14rem;
34
- flex: none;
35
- }
36
-
37
- .ws-crumbs {
38
- flex: 1;
39
- min-width: 0;
40
- display: flex;
41
- align-items: center;
42
- gap: var(--space-1);
43
- overflow-x: auto;
44
- scrollbar-width: none;
45
- white-space: nowrap;
46
- font-size: var(--text-sm);
47
- -webkit-overflow-scrolling: touch;
48
- }
49
-
50
- .ws-crumbs::-webkit-scrollbar {
51
- display: none;
52
- }
53
-
54
- .ws-crumbs a {
55
- flex: none;
56
- display: inline-flex;
57
- align-items: center;
58
- min-height: 2rem;
59
- padding: 0 var(--space-3);
60
- border-radius: var(--radius-full);
61
- background: var(--surface-2);
62
- color: var(--text);
63
- text-decoration: none;
64
- max-width: 14rem;
65
- overflow: hidden;
66
- text-overflow: ellipsis;
67
- }
68
-
69
- .ws-crumbs a[aria-current="page"] {
70
- background: var(--accent-soft);
71
- color: var(--accent-ink);
72
- font-weight: var(--weight-medium);
73
- }
74
-
75
- .ws-crumbs a:hover {
76
- background: var(--surface-3);
77
- }
78
-
79
- .ws-crumbs a + a::before {
80
- content: "/";
81
- margin-right: var(--space-2);
82
- color: var(--muted);
83
- }
84
-
85
- .ws-head-actions {
86
- flex: none;
87
- display: flex;
88
- gap: 0;
89
- }
90
-
91
- /* ── Body: tree and main ────────────────────────────────────────────────────────────────────────── */
92
-
93
- .ws-body {
94
- flex: 1;
95
- min-height: 0;
96
- display: flex;
97
- }
98
-
99
- .ws-main {
100
- flex: 1;
101
- min-width: 0;
102
- min-height: 0;
103
- display: flex;
104
- flex-direction: column;
105
- overflow: auto;
106
- }
107
-
108
- .ws-tree {
109
- flex: none;
110
- width: var(--ws-tree, 280px);
111
- overflow: auto;
112
- padding: var(--space-2) 0;
113
- border-right: 1px solid var(--border);
114
- background: var(--surface);
115
- font-size: var(--text-sm);
116
- }
117
-
118
- .ws-resizer {
119
- flex: none;
120
- width: 6px;
121
- margin-left: -3px;
122
- margin-right: -3px;
123
- z-index: 1;
124
- cursor: col-resize;
125
- touch-action: none;
126
- }
127
-
128
- .ws-resizer:hover,
129
- .ws-resizer:focus-visible {
130
- background: var(--accent-soft);
131
- outline: none;
132
- }
133
-
134
- .ws-tree-list {
135
- list-style: none;
136
- margin: 0;
137
- padding: 0;
138
- }
139
-
140
- .ws-tree-row {
141
- display: flex;
142
- align-items: center;
143
- min-height: 1.875rem;
144
- padding-right: var(--space-2);
145
- }
146
-
147
- .ws-tree-row a,
148
- .ws-tree-off {
149
- flex: 1;
150
- min-width: 0;
151
- display: flex;
152
- align-items: center;
153
- gap: var(--space-2);
154
- min-height: 1.75rem;
155
- padding: 0 var(--space-2);
156
- border-radius: var(--radius-sm);
157
- color: var(--text);
158
- text-decoration: none;
159
- }
160
-
161
- .ws-tree-label {
162
- overflow: hidden;
163
- text-overflow: ellipsis;
164
- white-space: nowrap;
165
- }
166
-
167
- .ws-tree-row a:hover {
168
- background: var(--surface-2);
169
- }
170
-
171
- .ws-tree-row[data-selected] a {
172
- background: var(--accent-soft);
173
- color: var(--accent-ink);
174
- }
175
-
176
- .ws-tree-row[data-quiet] {
177
- opacity: 0.6;
178
- }
179
-
180
- .ws-tree-off {
181
- color: var(--muted);
182
- cursor: not-allowed;
183
- }
184
-
185
- .ws-tree-note {
186
- margin: 0;
187
- padding: var(--space-1) var(--space-3);
188
- color: var(--muted);
189
- font-size: var(--text-xs);
190
- }
191
-
192
- .ws-twist {
193
- flex: none;
194
- display: inline-grid;
195
- place-items: center;
196
- width: 1.5rem;
197
- min-width: 1.5rem;
198
- height: 1.5rem;
199
- min-height: 1.5rem;
200
- padding: 0;
201
- border: none;
202
- background: transparent;
203
- color: var(--muted);
204
- }
205
-
206
- .ws-twist svg {
207
- transition: transform var(--dur-fast) var(--ease-out);
208
- }
209
-
210
- .ws-twist[aria-expanded="true"] svg {
211
- transform: rotate(90deg);
212
- }
213
-
214
- /* ── A folder ───────────────────────────────────────────────────────────────────────────────────── */
215
-
216
- .ws-dir {
217
- padding: var(--space-2) var(--space-3)
218
- calc(var(--space-6) + var(--safe-bottom));
219
- display: flex;
220
- flex-direction: column;
221
- gap: var(--space-3);
222
- }
223
-
224
- /* The folder on show: while the next one is fetched it stays, dimmed after a beat, so a quick switch shows no change at all. */
225
- .ws-listing {
226
- display: flex;
227
- flex-direction: column;
228
- gap: var(--space-3);
229
- transition: opacity var(--dur-fast) var(--ease-out) 150ms;
230
- }
231
-
232
- .ws-listing[data-pending] {
233
- opacity: 0.55;
234
- }
235
-
236
- .ws-rows {
237
- list-style: none;
238
- margin: 0;
239
- padding: 0;
240
- display: flex;
241
- flex-direction: column;
242
- }
243
-
244
- .ws-row {
245
- display: flex;
246
- align-items: center;
247
- border-bottom: 1px solid var(--border);
248
- }
249
-
250
- .ws-row[data-quiet] {
251
- opacity: 0.6;
252
- }
253
-
254
- .ws-row-link {
255
- flex: 1;
256
- min-width: 0;
257
- display: flex;
258
- align-items: center;
259
- gap: var(--space-3);
260
- min-height: 3rem;
261
- padding: var(--space-2) var(--space-1);
262
- color: var(--text);
263
- text-decoration: none;
264
- }
265
-
266
- .ws-row-link[data-off] {
267
- color: var(--muted);
268
- }
269
-
270
- a.ws-row-link:hover {
271
- background: var(--surface-2);
272
- }
273
-
274
- .ws-row-icon {
275
- flex: none;
276
- color: var(--muted);
277
- }
278
-
279
- .ws-row-main {
280
- min-width: 0;
281
- display: flex;
282
- flex-direction: column;
283
- }
284
-
285
- .ws-row-main strong {
286
- overflow: hidden;
287
- text-overflow: ellipsis;
288
- white-space: nowrap;
289
- font-weight: var(--weight-medium);
290
- }
291
-
292
- /* ── A file ─────────────────────────────────────────────────────────────────────────────────────── */
293
-
294
- .ws-file {
295
- flex: 1;
296
- min-height: 0;
297
- min-width: 0;
298
- display: flex;
299
- flex-direction: column;
300
- }
301
-
302
- .ws-file-head {
303
- flex: none;
304
- display: flex;
305
- align-items: center;
306
- gap: var(--space-3);
307
- flex-wrap: wrap;
308
- padding: var(--space-2) var(--space-3);
309
- border-bottom: 1px solid var(--border);
310
- background: var(--surface);
311
- }
312
-
313
- .ws-file-title {
314
- flex: 1;
315
- min-width: 8rem;
316
- display: flex;
317
- flex-direction: column;
318
- }
319
-
320
- .ws-file-title strong {
321
- overflow: hidden;
322
- text-overflow: ellipsis;
323
- white-space: nowrap;
324
- }
325
-
326
- .ws-actions {
327
- flex: none;
328
- display: flex;
329
- align-items: center;
330
- gap: var(--space-2);
331
- }
332
-
333
- .ws-banner {
334
- flex: none;
335
- display: flex;
336
- align-items: center;
337
- gap: var(--space-2);
338
- flex-wrap: wrap;
339
- padding: var(--space-2) var(--space-3);
340
- background: var(--warn-soft);
341
- color: var(--warn);
342
- border-bottom: 1px solid var(--warn);
343
- font-size: var(--text-sm);
344
- }
345
-
346
- .ws-banner-text {
347
- flex: 1;
348
- min-width: 10rem;
349
- }
350
-
351
- .ws-view {
352
- flex: 1;
353
- min-height: 0;
354
- display: flex;
355
- flex-direction: column;
356
- background: var(--code-bg);
357
- }
358
-
359
- .ws-editor {
360
- flex: 1;
361
- min-height: 0;
362
- display: flex;
363
- flex-direction: column;
364
- background: var(--code-bg);
365
- }
366
-
367
- .ws-editor .cm-editor {
368
- flex: 1;
369
- min-height: 0;
370
- }
371
-
372
- /* Editor font is 16px on a phone so a focus does not zoom the page; 13px beside a mouse. */
373
- .ws-editor {
374
- --code-size: 16px;
375
- }
376
-
377
- @media (min-width: 720px) {
378
- .ws-editor {
379
- --code-size: 13px;
380
- }
381
- }
382
-
383
- /* Before the editor's code has arrived, and where it cannot load, the text is shown plainly. */
384
- .ws-plain {
385
- flex: 1;
386
- margin: 0;
387
- padding: var(--space-3);
388
- overflow: auto;
389
- font-family: var(--font-mono);
390
- font-size: var(--code-size);
391
- line-height: 1.55;
392
- color: var(--code-fg);
393
- tab-size: 2;
394
- }
395
-
396
- .ws-media {
397
- flex: 1;
398
- min-height: 0;
399
- display: flex;
400
- flex-direction: column;
401
- }
402
-
403
- .ws-image {
404
- display: grid;
405
- place-items: center;
406
- padding: var(--space-4);
407
- overflow: auto;
408
- background-color: var(--surface-2);
409
- background-image:
410
- linear-gradient(
411
- 45deg,
412
- var(--surface-3, var(--border)) 25%,
413
- transparent 25%,
414
- transparent 75%,
415
- var(--surface-3, var(--border)) 75%
416
- ),
417
- linear-gradient(
418
- 45deg,
419
- var(--surface-3, var(--border)) 25%,
420
- transparent 25%,
421
- transparent 75%,
422
- var(--surface-3, var(--border)) 75%
423
- );
424
- background-size: 16px 16px;
425
- background-position:
426
- 0 0,
427
- 8px 8px;
428
- }
429
-
430
- .ws-image-toggle {
431
- display: grid;
432
- place-items: center;
433
- max-width: 100%;
434
- max-height: 100%;
435
- padding: 0;
436
- border: 0;
437
- background: none;
438
- cursor: zoom-in;
439
- }
440
-
441
- .ws-image[data-actual] .ws-image-toggle {
442
- max-width: none;
443
- max-height: none;
444
- cursor: zoom-out;
445
- }
446
-
447
- .ws-image img {
448
- max-width: 100%;
449
- max-height: 100%;
450
- object-fit: contain;
451
- }
452
-
453
- .ws-image[data-actual] img {
454
- max-width: none;
455
- max-height: none;
456
- }
457
-
458
- .ws-pdf-frame {
459
- gap: var(--space-2);
460
- }
461
-
462
- .ws-pdf {
463
- flex: 1;
464
- min-height: 0;
465
- width: 100%;
466
- border: 0;
467
- background: var(--surface-2);
468
- }
469
-
470
- .ws-media-actions {
471
- display: flex;
472
- flex-wrap: wrap;
473
- gap: var(--space-3);
474
- padding: var(--space-2) var(--space-4);
475
- }
476
-
477
- .ws-sound,
478
- .ws-film {
479
- align-items: center;
480
- justify-content: center;
481
- padding: var(--space-4);
482
- background: var(--surface-2);
483
- }
484
-
485
- .ws-sound audio,
486
- .ws-film video {
487
- width: 100%;
488
- max-height: 100%;
489
- }
490
-
491
- .ws-card-icon {
492
- color: var(--muted, inherit);
493
- }
494
-
495
- .ws-card {
496
- margin: var(--space-4);
497
- display: flex;
498
- flex-direction: column;
499
- align-items: flex-start;
500
- gap: var(--space-3);
501
- }
502
-
503
- .ws-card p {
504
- margin: 0;
505
- }
506
-
507
- .button-link {
508
- display: inline-flex;
509
- align-items: center;
510
- gap: var(--space-2);
511
- min-height: 2.5rem;
512
- padding: 0 var(--space-4);
513
- border-radius: var(--radius);
514
- background: var(--accent);
515
- color: var(--on-accent);
516
- text-decoration: none;
517
- font-weight: var(--weight-medium);
518
- }
519
-
520
- /* The bar of the phone's editor: above the keyboard, whose height the layout already follows. */
521
- .ws-editbar {
522
- flex: none;
523
- display: flex;
524
- gap: var(--space-2);
525
- overflow-x: auto;
526
- padding: var(--space-2) var(--space-3)
527
- calc(var(--space-2) + var(--safe-bottom));
528
- border-top: 1px solid var(--border);
529
- background: var(--surface);
530
- }
531
-
532
- .ws-editbar button {
533
- flex: none;
534
- min-height: var(--touch);
535
- min-width: var(--touch);
536
- }
537
-
538
- /* ── Looks ──────────────────────────────────────────────────────────────────────────────────────── */
539
-
540
- [data-look="camelot"] .ws-head,
541
- [data-look="camelot"] .ws-file-head {
542
- border-bottom-color: var(--gold-soft);
543
- box-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 38%, transparent);
544
- }
545
-
546
- [data-look="camelot"] .ws-tree {
547
- background: var(--surface);
548
- border-right-color: var(--gold-soft);
549
- }
550
-
551
- [data-look="camelot"] .ws-tree-row[data-selected] a {
552
- background: var(--gold-wash);
553
- color: var(--accent-ink);
554
- }
555
-
556
- /* Rune bullets for the folders of the Camelot tree. */
557
- [data-look="camelot"] .ws-tree-row a svg,
558
- [data-look="camelot"] .ws-row-icon {
559
- color: var(--gold);
560
- }
561
-
562
- [data-look="camelot"] .ws-view {
563
- margin: var(--space-2) var(--space-3) var(--space-3);
564
- border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--border));
565
- border-radius: var(--radius);
566
- overflow: hidden;
567
- }
568
-
569
- [data-look="camelot"] .ws-crumbs a[aria-current="page"] {
570
- background: var(--gold-wash);
571
- }
572
-
573
- @media (prefers-reduced-motion: reduce) {
574
- .ws-twist svg {
575
- transition: none;
576
- }
577
- }
578
- `;var ut={folder:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z","folder-plus":"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7ZM12 10v6M9 13h6","file-plus":"M6 3h9l4 4v14H6zM14 3v5h5M12 12v6M9 15h6"},Ct=(i)=>(i in ut);function be(i){let{name:d,size:c=20,className:b}=i;if(!Ct(d))return e(s,{name:d,size:c,...b?{className:b}:{}});return e("svg",{viewBox:"0 0 24 24",width:c,height:c,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...b?{className:b}:{},children:e("path",{d:ut[d]})})}function Ze(i){return n("div",{className:"ws-media-actions",children:[i.open?e("a",{className:"button-link",href:we(i.root,i.path),target:"_blank",rel:"noopener",children:t("Open")}):null,n("a",{className:"button-link",href:we(i.root,i.path,!0),download:i.name,children:[e(s,{name:"download",size:18}),t("Download")]})]})}function Ge(i){let d=i.name.lastIndexOf("."),c=d>0?i.name.slice(d+1).toUpperCase():"";return n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(s,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[c,Le(i.bytes)].filter(Boolean).join(" · ")}),e("p",{children:i.message}),e(Ze,{root:i.root,path:i.path,name:i.name})]})}var Et=(i)=>!i&&navigator.pdfViewerEnabled!==!1;function mt(i){let{media:d,root:c,path:b,name:w,bytes:N,phone:W,onFacts:S}=i,[I,z]=r(!1),[y,M]=r(!1);o(()=>(z(!1),M(!1),S(void 0),()=>S(void 0)),[c,b]);let F=we(c,b);if(I)return e(Ge,{root:c,path:b,name:w,bytes:N,message:t("This browser cannot show this file.")});switch(d){case"image":return e("div",{className:"ws-media ws-image","data-actual":y||void 0,children:e("button",{type:"button",className:"ws-image-toggle","aria-label":y?t("Fit to window"):t("Show at full size"),title:y?t("Fit to window"):t("Show at full size"),onClick:()=>M((V)=>!V),children:e("img",{src:F,alt:w,onLoad:(V)=>{let{naturalWidth:Q,naturalHeight:q}=V.currentTarget;S(Q>0?`${Q} × ${q}`:void 0)},onError:()=>z(!0)})})});case"pdf":return Et(W)?n("div",{className:"ws-media ws-pdf-frame",children:[e("iframe",{className:"ws-pdf",src:F,title:w}),e(Ze,{root:c,path:b,name:w,open:!0})]}):e("div",{className:"ws-media",children:n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(s,{name:"file",size:32})}),e("strong",{children:w}),n("span",{className:"meta",children:["PDF · ",Le(N)]}),e(Ze,{root:c,path:b,name:w,open:!0})]})});case"audio":return e("div",{className:"ws-media ws-sound",children:e("audio",{controls:!0,preload:"metadata",src:F,onError:()=>z(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:F,onLoadedMetadata:(V)=>{let{videoWidth:Q,videoHeight:q}=V.currentTarget;S(Q>0?`${Q} × ${q}`:void 0)},onError:()=>z(!0)})})}}var St={"read-only-root":u("this place is read-only"),"git-dir":u("inside .git"),trash:u("in the trash"),symlink:u("a link"),binary:u("binary file"),"too-large":u("too large"),"not-utf8":u("not UTF-8")};function Qe(i){if(i.id==="agents")return t("Knights' workspace");if(i.id==="scratch")return t("Scratch");return i.label}var gt=new Set([".git","node_modules"]),Je=(i)=>`roundtable.workspace.open.${i}`,ft="roundtable.workspace.tree",pt="roundtable.workspace.wrap";function et(i,d){try{let c=localStorage.getItem(i);return c===null?d:JSON.parse(c)}catch{return d}}function Be(i,d){try{localStorage.setItem(i,JSON.stringify(d))}catch{}}var $e=dn({rev:0,bump:()=>{return}});se("workspace",ct);var Re=new Map,Rt=200;function Tt(i,d){Re.delete(i),Re.set(i,d);let c=Re.keys().next().value;if(Re.size>Rt&&c!==void 0)Re.delete(c)}function ht(i,d,c=!0){let{rev:b}=ke($e),[w,N]=r(0),[W,S]=r({key:"",root:i,path:d}),I=`${i}:${d}`;if(o(()=>{let y=()=>N((M)=>M+1);return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[]),o(()=>{if(!c)return;let y=!0;return j.list(i,d).then((M)=>{if(Tt(I,M),y)S({key:I,root:i,path:d,data:M})},(M)=>y&&S({key:I,root:i,path:d,error:l(M)})),()=>{y=!1}},[i,d,c,b,w]),W.key===I)return{data:W.data,error:W.error,at:W};let z=Re.get(I);if(z)return{data:z,at:{root:i,path:d}};if(W.data)return{data:W.data,at:W,pending:!0};return{}}var We=(i)=>x("workspace",De(i));function tt(i,d,c){let b=Se(d,c.name);if(c.kind==="dir")return{root:i,path:b,dir:!0};if(c.kind==="file")return{root:i,path:b,dir:!1};if(c.kind==="symlink"&&c.inside)return{root:i,path:b,dir:c.target==="dir"};return}function Lt(i){let d=Me(i.path),c=a(null);return o(()=>{c.current?.scrollIntoView?.({inline:"end",block:"nearest"})},[i.path]),n("nav",{className:"ws-crumbs","aria-label":t("Path"),children:[e("a",{ref:d.length===0?c:void 0,href:We({root:i.root.id,path:"",dir:!0}),"aria-current":d.length===0?"page":void 0,children:Qe(i.root)}),d.map((b,w)=>{let N=d.slice(0,w+1).join("/"),W=w===d.length-1;return e("a",{ref:W?c:void 0,href:We({root:i.root.id,path:N,dir:!0}),"aria-current":W?"page":void 0,children:b},N)})]})}function wt(i){let{data:d,error:c,pending:b}=ht(i.root,i.path);if(c)return e("p",{className:"ws-tree-note",children:c});if(!d||b)return e("p",{className:"ws-tree-note",children:"…"});if(d.entries.length===0)return e("p",{className:"ws-tree-note",children:t("This folder is empty")});return n("ul",{className:"ws-tree-list","data-depth":i.depth,children:[d.entries.map((w)=>{let N=tt(i.root,i.path,w),W=Se(i.path,w.name),S=N?.dir===!0,I=S&&i.open.has(W),z=i.current?.root===i.root&&i.current.path===W&&i.current.dir===S;return n("li",{children:[n("div",{className:"ws-tree-row","data-selected":z||void 0,"data-quiet":gt.has(w.name)||void 0,style:{paddingLeft:`${0.25+i.depth*0.875}rem`},children:[S?e("button",{type:"button",className:"ws-twist","aria-expanded":I,"aria-label":t("Show or hide {name}",{name:w.name}),onClick:()=>i.toggle(W),children:e(s,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),N?n("a",{href:We(N),title:w.name,children:[e(be,{name:S?"folder":"file",size:15}),e("span",{className:"ws-tree-label",children:w.name})]}):n("span",{className:"ws-tree-off",title:w.inside===!1?t("Outside the workspace"):"",children:[e(s,{name:"file",size:15}),e("span",{className:"ws-tree-label",children:w.name})]})]}),I?e(wt,{root:i.root,path:W,depth:i.depth+1,open:i.open,toggle:i.toggle,current:i.current}):null]},w.name)}),d.truncated?e("li",{className:"ws-tree-note",children:t("Only the first 2,000 items are listed")}):null]})}function Wt(i){let{data:d,error:c,at:b,pending:w}=ht(i.root.id,i.path),{timeZone:N}=_(),W=a(null),S=b?.root??i.root.id,I=b?.path??i.path;if(Ne(()=>{W.current?.closest(".ws-main")?.scrollTo?.(0,0)},[S,I]),c)return e(m,{message:c});if(!d)return e(v,{});if(d.missing)return e(k,{children:t("No files yet")});if(d.entries.length===0)return e(k,{children:t("This folder is empty")});return n("div",{ref:W,className:"ws-listing","data-pending":w||void 0,"aria-busy":w||void 0,inert:w||void 0,children:[e("ul",{className:"ws-rows",children:d.entries.map((z)=>{let y=tt(S,I,z),M=n(g,{children:[e(be,{name:y?.dir?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:z.name}),e("span",{className:"meta",children:z.kind==="symlink"&&z.inside===!1?t("Outside the workspace"):z.kind==="other"?t("Not a regular file"):[y?.dir?void 0:Le(z.size),re(new Date(z.mtimeMs).toISOString(),N)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":gt.has(z.name)||void 0,children:[y?e("a",{className:"ws-row-link",href:We(y),children:M}):e("span",{className:"ws-row-link","data-off":!0,children:M}),i.root.writable||y?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:z.name}),onClick:()=>i.onMenu(z),children:e(s,{name:"menu"})}):null]},z.name)})}),d.truncated?e("p",{className:"meta",children:t("Only the first 2,000 items are listed")}):null]})}function zt(i){let{timeZone:d}=_(),{bump:c}=ke($e),{root:b,path:w}=i,[N,W]=r(),[S,I]=r(),[z,y]=r("read"),[M,F]=r(!1),[V,Q]=r(!1),[q,je]=r(()=>et(pt,i.phone)),[Oe,ee]=r(!1),[ze,ye]=r(),[A,H]=r(!1),[Y,ue]=r(!1),[Pe,qe]=r(!1),[me,le]=r(),[U,pe]=r(),[xe,Ie]=r(),ge=a(null),K=a(void 0),P=a(null),oe=a(N);oe.current=N;let Z=a(z);Z.current=z;let G=Me(w).at(-1)??w,Fe=N?.text!==void 0,Ve=Fe&&(N?.media===void 0||A),nt=E(async()=>{let O=await j.file(b.id,w);return W(O),O},[b.id,w]);o(()=>{let O=!0;return j.file(b.id,w).then((B)=>O&&W(B),(B)=>O&&I(l(B))),()=>{O=!1}},[b.id,w]);let Xe=dt(M,P,()=>{let O=oe.current;if(O?.text!==void 0)K.current?.replace(O.text,O.eol);F(!1),y("read")});o(()=>{if(!M)return;let O=document.title;return document.title=`• ${O}`,()=>{document.title=O}},[M]);let Ae=E(async(O,B)=>{let ce=oe.current,J=K.current;if(!ce||!J||V)return;let te=B===void 0?J.snapshot():void 0,Ke=B??J.text();Q(!0);try{let ae=await j.save(b.id,w,Ke,O??ce.hash);J.markSaved(te),F(J.dirty()),le(void 0),W({...ce,hash:ae.hash,size:ae.size,mtimeMs:ae.mtimeMs,text:Ke}),f(t("Saved")),c()}catch(ae){let ie=Ue(ae);if(ie)pe({kind:ie.conflict==="gone"?"gone":"changed",...ie.current?{hash:ie.current.hash}:{},text:Ke});else f(l(ae),"danger")}finally{Q(!1)}},[b.id,w,V,c]),at=a(Ae);at.current=Ae;let he=E(async()=>{try{let O=await nt();if(O.text!==void 0)K.current?.replace(O.text,O.eol);F(!1),le(void 0),pe(void 0)}catch(O){f(l(O),"danger")}},[nt]),vt=a(he);vt.current=he;let Ye=E(()=>{if(K.current?.dirty()){rt(!0);return}y("read")},[]),[bt,rt]=r(!1),ot=a(Ye);ot.current=Ye,o(()=>{if(!Ve||!ge.current)return;let O=oe.current;if(!O||O.text===void 0)return;let B=!1,ce;return (p("239ss6a2"),import("./chunk-codeeditor-239ss6a2.js")).then(async({createEditor:J})=>{if(B||!ge.current)return;let te=await J({parent:ge.current,text:O.text??"",eol:O.eol,language:O.language,editable:!1,wrap:q,phrases:{Find:t("Find"),Replace:t("Replace"),next:t("next"),previous:t("previous"),all:t("all"),"match case":t("match case"),regexp:t("regexp"),"by word":t("by word"),replace:t("replace"),"replace all":t("replace all"),close:t("close")},onChange:()=>F(te.dirty()),onSave:()=>{if(Z.current==="edit"&&te.dirty())at.current()},onEscape:()=>{if(Z.current==="edit")ot.current()}});if(B){te.destroy();return}ce=te,K.current=te,ue(!0)}).catch((J)=>{if(console.warn("the editor failed to load",J),!B)qe(!0)}),()=>{B=!0,ce?.destroy(),K.current=void 0,ue(!1)}},[Ve,b.id,w]),o(()=>{if(!Y)return;let O=z==="edit"&&N?.editable===!0;if(K.current?.setEditable(O),O)K.current?.focus()},[z,Y,N?.editable]),o(()=>{if(!Y)return;K.current?.setWrap(q),Be(pt,q)},[q,Y]);let it=N!==void 0;if(o(()=>{if(!it)return;let O=!1,B=async()=>{if(O||document.visibilityState==="hidden")return;let te=oe.current;if(!te)return;O=!0;try{let ae=(await j.list(b.id,ve(w))).entries.find((xt)=>xt.name===G);if(!ae){le("gone");return}if(ae.kind==="symlink")return;if(ae.size===te.size&&ae.mtimeMs===te.mtimeMs)return;if(Z.current==="edit"&&K.current?.dirty()){le("changed");return}let ie=await j.file(b.id,w);if(ie.hash!==te.hash){if(W(ie),ie.text!==void 0)K.current?.replace(ie.text,ie.eol)}le(void 0)}catch{}finally{O=!1}},ce=setInterval(()=>void B(),5000),J=()=>void B();return window.addEventListener("focus",J),document.addEventListener("visibilitychange",J),()=>{clearInterval(ce),window.removeEventListener("focus",J),document.removeEventListener("visibilitychange",J)}},[it,b.id,w,G]),S)return e("div",{className:"ws-file",children:e(m,{message:S})});if(!N)return e("div",{className:"ws-file",children:e(v,{})});let st=N.reason,kt=!N.editable?e(T,{tone:"warn",children:t("Read only: {reason}",{reason:st?t(St[st]):""})}):null,He=z==="edit",yt=n("div",{className:"ws-actions",children:[N.editable&&!He?e("button",{type:"button",onClick:()=>{H(!0),y("edit")},children:t("Edit")}):null,He?n(g,{children:[e("button",{type:"button",disabled:V||!M,onClick:()=>void Ae(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:Ye,children:t("Cancel")})]}):null,e("button",{type:"button",className:"icon-button","aria-label":t("File menu"),onClick:()=>ee(!0),children:e(s,{name:"menu"})})]});return n("div",{className:"ws-file",ref:P,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[M?"• ":"",G]}),n("span",{className:"meta",children:[Le(N.size),ze?` · ${ze}`:""," ·"," ",re(new Date(N.mtimeMs).toISOString(),d)]})]}),kt,yt]}),me?n("div",{className:"ws-banner",role:"status",children:[e("span",{className:"ws-banner-text",children:me==="gone"?t("This file is gone"):t("A knight is changing this file")}),me==="changed"?n(g,{children:[e("button",{type:"button",className:"secondary",onClick:()=>void he(),children:t("Reload (discard my edits)")}),e("button",{type:"button",className:"secondary",onClick:()=>le(void 0),children:t("Keep editing")})]}):null]}):null,e("div",{className:"ws-view",children:N.media&&!Ve?e(mt,{media:N.media,root:b.id,path:w,name:G,bytes:N.size,phone:i.phone,onFacts:ye}):Ve?e("div",{ref:ge,className:"ws-editor","data-editing":He||void 0,children:!Y?e("pre",{className:"ws-plain","aria-busy":!Pe,children:N.text}):null}):e(Ge,{root:b.id,path:w,name:G,bytes:N.size,message:N.tooLarge?t("This file is too large to show here."):t("This file is not text, so it cannot be shown here.")})}),i.phone&&He?n("div",{className:"ws-editbar",role:"toolbar","aria-label":t("Editing"),children:[e("button",{type:"button",disabled:V||!M,onClick:()=>void Ae(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.undo(),children:t("Undo")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.redo(),children:t("Redo")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.find(),children:t("Find")}),e("button",{type:"button",className:"secondary",onClick:()=>K.current?.tab(),children:t("Tab")})]}):null,e(R,{open:Oe,title:G,onClose:()=>ee(!1),children:e("div",{className:"stack",children:n("ul",{className:"more-list",children:[Fe?e("li",{children:e("button",{type:"button",className:"menu-item",onClick:()=>{je((O)=>!O),ee(!1)},children:e("span",{className:"menu-text",children:e("strong",{children:q?t("Do not wrap lines"):t("Wrap lines")})})})}):null,e("li",{children:n("a",{className:"menu-item menu-link",href:we(b.id,w,!0),download:G,onClick:()=>ee(!1),children:[e("span",{className:"menu-icon",children:e(s,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{ee(!1),he()},children:[e("span",{className:"menu-icon",children:e(s,{name:"refresh"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Reload")})})]})})]})})}),e(ne,{open:U!==void 0,title:U?.kind==="gone"?t("This file is gone"):t("This file changed while you were editing"),onClose:()=>pe(void 0),children:n("div",{className:"stack",children:[e("p",{children:U?.kind==="gone"?t("Someone deleted it. Your text has not been saved."):t("Your text has not been saved. What should happen to it?")}),n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:()=>{navigator.clipboard?.writeText(U?.text??"").then(()=>f(t("Copied")))},children:t("Copy my text")}),U?.kind==="changed"?e("button",{type:"button",className:"secondary",onClick:()=>void he(),children:t("Reload (discard my edits)")}):null,e("button",{type:"button",className:"danger",onClick:()=>{if(!U)return;if(U.kind==="gone"){let O=U.text;pe(void 0),j.create(b.id,w,"file",O).then(async()=>{await he(),c()}).catch((B)=>f(l(B),"danger"));return}Ie({hash:U.hash??"",text:U.text}),pe(void 0)},children:U?.kind==="gone"?t("Save mine as a new file"):t("Save mine anyway")})]})]})}),e(D,{open:xe!==void 0,title:t("Replace the knight's changes?"),confirmLabel:t("Save mine anyway"),tone:"danger",onClose:()=>Ie(void 0),onConfirm:async()=>{if(!xe)return;await j.save(b.id,w,xe.text,xe.hash),await he(),f(t("Saved")),c()},children:e("p",{children:t("The file has been changed since you opened it. Saving yours writes over those changes.")})}),e(D,{open:bt,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>rt(!1),onConfirm:async()=>{if(N.text!==void 0)K.current?.replace(N.text,N.eol);F(!1),y("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})}),e(D,{open:Xe.leaving!==void 0,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:Xe.stay,onConfirm:async()=>Xe.leave(),children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})})]})}function Mt(i){let{ask:d}=i,[c,b]=r(""),[w,N]=r(),[W,S]=r(!1),I=L();o(()=>{b(d?.kind==="rename"?d.name:""),N(void 0)},[d]);let z=d?.kind==="rename"?t("Rename"):d?.kind==="dir"?t("New folder"):t("New file"),y=async(M)=>{if(M.preventDefault(),!d)return;let F=c.trim();if(!F||F.includes("/")){N(t("Use a name without slashes."));return}S(!0),N(void 0);try{if(d.kind==="rename"){let V=Se(ve(d.path),F);await j.rename(i.root.id,d.path,V),f(t("Renamed")),i.onDone()}else{let V=Se(d.dir,F);await j.create(i.root.id,V,d.kind),f(t("Created")),i.onDone({root:i.root.id,path:V,dir:d.kind==="dir"})}}catch(V){let Q=Ue(V);N(Q?.conflict==="exists"?t("Something with that name is already there."):l(V))}finally{S(!1)}};return e(ne,{open:d!==void 0,title:z,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:y,children:[e("label",{htmlFor:I,children:t("Name")}),e("input",{id:I,value:c,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(M)=>b(M.target.value)}),w?e(m,{message:w}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:W||!c.trim(),children:d?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Dt(i){let{bump:d,rev:c}=ke($e),[b,w]=r(),[N,W]=r(),[S,I]=r(),{timeZone:z}=_();return o(()=>{if(!i.open)return;let y=!0;return j.trash(i.root.id).then((M)=>y&&w(M.items),(M)=>y&&W(l(M))),()=>{y=!1}},[i.open,i.root.id,c]),n(ne,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[N?e(m,{message:N}):null,!b&&!N?e(v,{}):null,b?.length===0?e(k,{children:t("The trash is empty")}):null,e("ul",{className:"ws-rows",children:b?.map((y)=>n("li",{className:"ws-row",children:[n("span",{className:"ws-row-link","data-off":!0,children:[e(be,{name:y.kind==="dir"?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:y.path}),e("span",{className:"meta",children:re(y.deletedAt,z)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await j.restore(i.root.id,y.id),f(t("Restored")),d()}catch(M){let F=Ue(M);f(F?F.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):l(M),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:y.name}),onClick:()=>I(y),children:e(s,{name:"trash"})})]},y.id))})]}),e(D,{open:S!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>I(void 0),onConfirm:async()=>{if(!S)return;await j.purge(i.root.id,S.id),d()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:S?.path??""})})})]})}function yn(){let i=Hi(),d=!Ce("(min-width: 720px)"),[c,b]=r(0),w=E(()=>b((P)=>P+1),[]),N=C(()=>({rev:c,bump:w}),[c,w]),[W,S]=r(),[I,z]=r();o(()=>{j.roots().then((P)=>S(P.roots),(P)=>z(l(P)))},[]);let[y,M]=r(()=>et(ft,280)),[F,V]=r(),[Q,q]=r(),[je,Oe]=r(!1),[ee,ze]=r(),ye=lt(i.key),A=W?.find((P)=>P.id===ye?.root)??(d?void 0:W?.[0]),H=A?ye&&ye.root===A.id?ye:{root:A.id,path:"",dir:!0}:void 0,Y=A?.id,ue=H?.path,Pe=H?.dir,[qe,me]=r(new Set);o(()=>{if(!Y)return;me(new Set(et(Je(Y),[])))},[Y]);let le=E((P)=>{if(!Y)return;me((oe)=>{let Z=new Set(oe);if(Z.has(P))Z.delete(P);else Z.add(P);return Be(Je(Y),[...Z]),Z})},[Y]);if(o(()=>{if(!Y||ue===void 0||d)return;let P=Me(Pe?ue:ve(ue)),oe=P.map((Z,G)=>P.slice(0,G+1).join("/"));me((Z)=>{if(oe.every((Fe)=>Z.has(Fe)))return Z;let G=new Set([...Z,...oe]);return Be(Je(Y),[...G]),G})},[Y,ue,Pe,d]),I)return e(m,{message:I});if(!W)return e(v,{});if(W.length===0)return e(k,{children:t("No files yet")});if(!A||!H)return e($e.Provider,{value:N,children:n("div",{className:"page ws-page",children:[e("header",{className:"page-head",children:e("h1",{children:t("Files")})}),e("ul",{className:"more-list",children:W.map((P)=>e("li",{children:n("a",{className:"menu-item menu-link",href:We({root:P.id,path:"",dir:!0}),children:[e("span",{className:"menu-icon",children:e(be,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:Qe(P)}),P.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(s,{name:"chevron",size:16})]})},P.id))})]})});let U=H.dir?H.path:ve(H.path),pe=H.path===""?{root:A.id,path:"",dir:!0}:{root:A.id,path:ve(H.path),dir:!0},xe=n("header",{className:"ws-head",children:[d?e("a",{className:"icon-button","aria-label":t("Back"),href:H.path===""?x("workspace"):We(pe),children:e(s,{name:"back"})}):e(Te,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:A.id,onChange:(P)=>X("workspace",De({root:P.target.value,path:"",dir:!0})),children:W.map((P)=>e("option",{value:P.id,children:Qe(P)},P.id))}),e(Lt,{root:A,path:H.path}),A.writable?n("div",{className:"ws-head-actions",children:[e("button",{type:"button",className:"icon-button","aria-label":t("New file"),title:t("New file"),onClick:()=>q({kind:"file",dir:U}),children:e(be,{name:"file-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("New folder"),title:t("New folder"),onClick:()=>q({kind:"dir",dir:U}),children:e(be,{name:"folder-plus"})}),e("button",{type:"button",className:"icon-button","aria-label":t("Trash"),title:t("Trash"),onClick:()=>Oe(!0),children:e(s,{name:"trash"})})]}):null]}),Ie=H.dir?e("div",{className:"ws-dir",children:e(Wt,{root:A,path:H.path,onMenu:(P)=>V(P)})}):e(zt,{root:A,path:H.path,phone:d},`${A.id}:${H.path}`),ge=F?tt(A.id,U,F):void 0,K=F?Se(U,F.name):"";return n($e.Provider,{value:N,children:[n("div",{className:"ws-page ws","data-wide":!d||void 0,style:{"--ws-tree":`${y}px`},children:[xe,n("div",{className:"ws-body",children:[!d?n(g,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(wt,{root:A.id,path:"",depth:0,open:qe,toggle:le,current:H})}),e($t,{width:y,onChange:(P)=>{M(P),Be(ft,P)}})]}):null,e("section",{className:"ws-main",children:Ie})]})]}),e(R,{open:F!==void 0,title:F?.name??"",onClose:()=>V(void 0),children:n("ul",{className:"more-list",children:[ge&&!ge.dir?e("li",{children:n("a",{className:"menu-item menu-link",href:we(A.id,K,!0),download:F?.name,onClick:()=>V(void 0),children:[e("span",{className:"menu-icon",children:e(s,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}):null,A.writable&&F?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{q({kind:"rename",path:K,name:F.name}),V(void 0)},children:[e("span",{className:"menu-icon",children:e(s,{name:"notes"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Rename")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{ze({path:K,name:F.name}),V(void 0)},children:[e("span",{className:"menu-icon",children:e(s,{name:"trash"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Delete")})})]})})]}):null]})}),e(Mt,{root:A,ask:Q,onClose:()=>q(void 0),onDone:(P)=>{if(q(void 0),w(),P)X("workspace",De(P))}}),e(Dt,{root:A,open:je,onClose:()=>Oe(!1)}),e(D,{open:ee!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>ze(void 0),onConfirm:async()=>{if(!ee)return;if(await j.remove(A.id,ee.path),f(t("Moved to the trash")),w(),!H.dir&&(H.path===ee.path||H.path.startsWith(`${ee.path}/`)))X("workspace",De({root:A.id,path:ve(H.path),dir:!0}))},children:e("p",{children:t("“{name}” goes to the trash, where you can bring it back.",{name:ee?.name??""})})})]})}function $t(i){let b=(w)=>Math.min(560,Math.max(180,w));return e("div",{className:"ws-resizer",role:"separator","aria-orientation":"vertical","aria-valuenow":i.width,"aria-valuemin":180,"aria-valuemax":560,"aria-label":t("Resize the folder list"),tabIndex:0,onKeyDown:(w)=>{if(w.key==="ArrowLeft")i.onChange(b(i.width-16));if(w.key==="ArrowRight")i.onChange(b(i.width+16))},onPointerDown:(w)=>{let N=w.clientX,W=i.width,S=w.currentTarget;S.setPointerCapture(w.pointerId);let I=(y)=>i.onChange(b(W+y.clientX-N)),z=()=>{S.removeEventListener("pointermove",I),S.removeEventListener("pointerup",z)};S.addEventListener("pointermove",I),S.addEventListener("pointerup",z)}})}export{yn as WorkspacePage};