pi-roundtable-web 0.27.1 → 0.29.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 (257) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +25 -9
  3. package/dist/chunk-account-9616x405.js +1 -0
  4. package/dist/chunk-action-menu-q5y7xpry.js +1 -0
  5. package/dist/chunk-agent-x74xezyt.js +1 -0
  6. package/dist/chunk-arranged-rooms-9prq46vh.js +1 -0
  7. package/dist/chunk-bulk-actions-5dc4m9ad.js +1 -0
  8. package/dist/chunk-character-creator-wf02eg0h.js +1 -0
  9. package/dist/chunk-codeeditor-239ss6a2.js +2 -0
  10. package/dist/chunk-confirm-bhrx9195.js +1 -0
  11. package/dist/chunk-connectors-k77pd9by.js +37 -0
  12. package/dist/chunk-conversations-ftcpaqw1.js +1 -0
  13. package/dist/chunk-council-sheet-a5e6tspr.js +2 -0
  14. package/dist/chunk-council-view-6593rqbr.js +1 -0
  15. package/dist/chunk-drag-7873fvzw.js +1 -0
  16. package/dist/chunk-entry-5zmjxadx.js +1 -0
  17. package/dist/chunk-folder-list-h9hmbm8e.js +1 -0
  18. package/dist/chunk-folds-vxq86t1s.js +1 -0
  19. package/dist/chunk-gate-fa6za28z.js +1 -0
  20. package/dist/chunk-host-icons-y6frbzqt.js +1 -0
  21. package/dist/chunk-host-picture-fqg55rbr.js +1 -0
  22. package/dist/chunk-host-state-65tdhkyq.js +1 -0
  23. package/dist/chunk-host-ui-233kz7qp.js +1 -0
  24. package/dist/{chunk-index-j4x9dq30.css → chunk-index-1652v386.css} +1 -1
  25. package/dist/chunk-index-2c00zf3z.js +2 -0
  26. package/dist/chunk-index-2dhrqvba.js +2 -0
  27. package/dist/chunk-index-2s4bkrz3.js +2 -0
  28. package/dist/chunk-index-2ypaqwjy.js +2 -0
  29. package/dist/{chunk-index-k0z507h3.js → chunk-index-35zqk1zr.js} +2 -2
  30. package/dist/chunk-index-39qq37j5.js +2 -0
  31. package/dist/{chunk-index-j7pgphx3.js → chunk-index-3tjmyd1h.js} +2 -2
  32. package/dist/chunk-index-4eag6s50.js +2 -0
  33. package/dist/chunk-index-4jnn2g09.js +2 -0
  34. package/dist/{chunk-index-y60x5jbh.js → chunk-index-4krm48hm.js} +1 -1
  35. package/dist/{chunk-index-w42rcbx1.js → chunk-index-4re5prfp.js} +2 -2
  36. package/dist/chunk-index-57teqgct.js +2 -0
  37. package/dist/{chunk-index-3d8s3565.js → chunk-index-5ssncptg.js} +2 -2
  38. package/dist/{chunk-index-yrmqcay4.js → chunk-index-7c9fn21n.js} +2 -2
  39. package/dist/chunk-index-7k5895sn.js +14 -0
  40. package/dist/chunk-index-93f3e06v.js +2 -0
  41. package/dist/chunk-index-9m9v1p7s.js +2 -0
  42. package/dist/chunk-index-a8c0ap8g.js +2 -0
  43. package/dist/chunk-index-a8nqn3y0.js +3 -0
  44. package/dist/chunk-index-am7ghh75.js +120 -0
  45. package/dist/chunk-index-amspdq2j.js +4 -0
  46. package/dist/chunk-index-amxa2bn3.js +2 -0
  47. package/dist/{chunk-index-nsvwbjfe.js → chunk-index-aycxt14t.js} +2 -2
  48. package/dist/{chunk-index-n05yw5wd.js → chunk-index-bjeg3e2j.js} +2 -2
  49. package/dist/chunk-index-cttrqfm8.js +2 -0
  50. package/dist/chunk-index-dajanzxc.js +1 -0
  51. package/dist/chunk-index-e2eeckhh.js +2 -0
  52. package/dist/chunk-index-e46652wf.js +2 -0
  53. package/dist/chunk-index-ek98d2rn.js +2 -0
  54. package/dist/{chunk-index-f500nw4w.js → chunk-index-en5dm1zv.js} +2 -2
  55. package/dist/chunk-index-evhaaqzk.js +13 -0
  56. package/dist/chunk-index-f4gqzfkv.js +2 -0
  57. package/dist/{chunk-index-ak6ecqy3.js → chunk-index-gj3n4dh5.js} +2 -2
  58. package/dist/chunk-index-gp4chnp3.js +2 -0
  59. package/dist/{chunk-index-af4ebmkr.js → chunk-index-h2a42p6s.js} +3 -3
  60. package/dist/{chunk-index-4z4chg7v.js → chunk-index-haac6nbt.js} +2 -2
  61. package/dist/{chunk-index-3pnvpppa.js → chunk-index-hef4gwtb.js} +2 -2
  62. package/dist/chunk-index-mg96sqpk.js +2 -0
  63. package/dist/chunk-index-nsya88fn.js +1 -0
  64. package/dist/{chunk-index-ben4gv45.js → chunk-index-ntt3em2k.js} +1 -1
  65. package/dist/chunk-index-pcbkp62w.js +2 -0
  66. package/dist/chunk-index-pfs6rm6w.js +2 -0
  67. package/dist/chunk-index-pgxgq61x.js +2 -0
  68. package/dist/{chunk-index-9z13jw6q.js → chunk-index-q33ppq0j.js} +3 -3
  69. package/dist/chunk-index-r0hk9kyd.js +47 -0
  70. package/dist/{chunk-index-0ye10vk3.js → chunk-index-rr73h4kc.js} +3 -3
  71. package/dist/{chunk-index-983dmeaa.js → chunk-index-rtz4936v.js} +3 -3
  72. package/dist/chunk-index-smz90j6p.js +2 -0
  73. package/dist/chunk-index-teyx2hz7.js +2 -0
  74. package/dist/{chunk-index-sm7m4fej.js → chunk-index-v6h43553.js} +2 -2
  75. package/dist/chunk-index-vzqwn3wp.js +2 -0
  76. package/dist/chunk-index-wt2asefx.js +50 -0
  77. package/dist/chunk-index-x4tq9btg.js +2 -0
  78. package/dist/chunk-index-y6p8j3zv.js +2 -0
  79. package/dist/chunk-index-yvcdg5hh.js +2 -0
  80. package/dist/{chunk-index-afrhnrxj.js → chunk-index-zdzzf3fp.js} +2 -2
  81. package/dist/chunk-index-zeqfnkty.js +2 -0
  82. package/dist/chunk-index-zpwb8mkk.js +2 -0
  83. package/dist/chunk-lang-css-avzhvm72.js +1 -0
  84. package/dist/{chunk-lang-dockerfile-cnwqn660.js → chunk-lang-dockerfile-2p7e3ssz.js} +1 -1
  85. package/dist/{chunk-lang-go-yy6kgsxv.js → chunk-lang-go-zxp9k517.js} +3 -3
  86. package/dist/chunk-lang-html-red02gep.js +1 -0
  87. package/dist/chunk-lang-javascript-n33kmjcx.js +1 -0
  88. package/dist/chunk-lang-json-zmym50rg.js +1 -0
  89. package/dist/chunk-lang-markdown-ww2kcs85.js +6 -0
  90. package/dist/chunk-lang-python-ng1zdtd4.js +3 -0
  91. package/dist/chunk-lang-rust-6ynhxjdd.js +1 -0
  92. package/dist/{chunk-lang-shell-1rpgtepw.js → chunk-lang-shell-39t9bz2s.js} +1 -1
  93. package/dist/chunk-lang-sql-w875ejpg.js +2 -0
  94. package/dist/{chunk-lang-toml-tbj7467c.js → chunk-lang-toml-b8ckgkg5.js} +1 -1
  95. package/dist/chunk-lang-typescript-qf8acbb2.js +1 -0
  96. package/dist/chunk-lang-xml-bz91cjp1.js +1 -0
  97. package/dist/chunk-lang-yaml-g9zy0tdv.js +1 -0
  98. package/dist/chunk-layout-actions-fyzzzeyp.js +1 -0
  99. package/dist/chunk-menu-items-yvnk3vds.js +1 -0
  100. package/dist/chunk-mode-toggle-ccv271hm.js +1 -0
  101. package/dist/chunk-note-row-314py1pp.js +204 -0
  102. package/dist/chunk-notes-4rnrddzw.js +1 -0
  103. package/dist/chunk-notice-bell-z9wgamnz.js +1 -0
  104. package/dist/chunk-notices-mtn7pg1z.js +1 -0
  105. package/dist/chunk-onboarding-f3hhxgg4.js +1 -0
  106. package/dist/chunk-overview-qmepntrr.js +1 -0
  107. package/dist/chunk-palette-edkn1ypq.js +1 -0
  108. package/dist/chunk-placement-items-trsa5t23.js +1 -0
  109. package/dist/chunk-profile-pwfq0wns.js +1 -0
  110. package/dist/chunk-prompt-history-xp9hmeqt.js +1 -0
  111. package/dist/chunk-prompts-a56qvytg.js +1 -0
  112. package/dist/chunk-room-confirms-gqpkz4h0.js +1 -0
  113. package/dist/chunk-room-menu-1m2c2ekt.js +1 -0
  114. package/dist/chunk-rooms-menu-button-tcvda1gq.js +1 -0
  115. package/dist/chunk-schedules-kwnw7p8v.js +1 -0
  116. package/dist/{chunk-seat-menu-kwtjnpjj.js → chunk-seat-menu-m2n9nvv0.js} +1 -1
  117. package/dist/chunk-sheet-hosts-pr8xktyq.js +29 -0
  118. package/dist/{chunk-shortcut-help-g5cpqjjj.js → chunk-shortcut-help-sbvrds1m.js} +2 -2
  119. package/dist/chunk-shortcuts-8705p7q3.js +1 -0
  120. package/dist/chunk-skill-editor-7xy09sq1.js +8 -0
  121. package/dist/chunk-skills-cnc25x7q.js +1 -0
  122. package/dist/chunk-start-over-line-97zdd9pb.js +16 -0
  123. package/dist/chunk-switcher-list-ehsn2wsk.js +1 -0
  124. package/dist/{chunk-tab-dot-yse6wcfp.js → chunk-tab-dot-gkpe06q8.js} +1 -1
  125. package/dist/chunk-table-av3kh3tt.js +1 -0
  126. package/dist/chunk-table2d-5x3jptp9.js +1 -0
  127. package/dist/chunk-table3d-rsvajx7r.js +4220 -0
  128. package/dist/chunk-thread-actions-7xtkegwm.js +1 -0
  129. package/dist/{chunk-thread-cards-36rckyg7.js → chunk-thread-cards-grzszfha.js} +1 -1
  130. package/dist/chunk-thread-list-9bjjac3j.js +217 -0
  131. package/dist/chunk-transcript-t5szb8r0.js +1 -0
  132. package/dist/chunk-waiting-chip-d8b6a0p8.js +28 -0
  133. package/dist/chunk-waiting-ts3kxjvv.js +1 -0
  134. package/dist/chunk-where-3d3ncsa5.js +1 -0
  135. package/dist/chunk-workspace-ct6hvn0z.js +578 -0
  136. package/dist/chunk-zh-tw-v9v1eerm.js +1 -0
  137. package/dist/index.html +1 -1
  138. package/dist/sw.js +1 -1
  139. package/package.json +3 -3
  140. package/src/api-types.ts +137 -1
  141. package/src/app/app.ts +4 -7
  142. package/src/app/desk.ts +19 -4
  143. package/src/app/room-log.ts +66 -18
  144. package/src/app/rooms.ts +45 -7
  145. package/src/app/routes.ts +86 -11
  146. package/src/app/skill-doc-routes.ts +12 -2
  147. package/src/app/skill-group-routes.ts +126 -0
  148. package/src/app/surface.ts +26 -2
  149. package/src/app/team-routes.ts +3 -7
  150. package/src/authz.ts +2 -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 +137 -5
  157. package/src/push/channel.ts +1 -0
  158. package/src/web-plugin.ts +8 -1
  159. package/dist/chunk-account-83crfbn4.js +0 -1
  160. package/dist/chunk-action-menu-qw7h03x0.js +0 -1
  161. package/dist/chunk-agent-t1632ktv.js +0 -1
  162. package/dist/chunk-arranged-rooms-sb6tbsxw.js +0 -1
  163. package/dist/chunk-bulk-actions-v1g2bzk7.js +0 -1
  164. package/dist/chunk-character-creator-ye69w0kx.js +0 -1
  165. package/dist/chunk-codeeditor-5j6abj8k.js +0 -2
  166. package/dist/chunk-confirm-x8w877bz.js +0 -1
  167. package/dist/chunk-connectors-t7qbc6nk.js +0 -1
  168. package/dist/chunk-conversations-kmt6qzym.js +0 -1
  169. package/dist/chunk-council-sheet-bxvn7vza.js +0 -2
  170. package/dist/chunk-drag-03zgvd66.js +0 -1
  171. package/dist/chunk-entry-y5vwp5e5.js +0 -1
  172. package/dist/chunk-folder-list-h3vnjzpb.js +0 -1
  173. package/dist/chunk-folds-a3e22m7x.js +0 -1
  174. package/dist/chunk-gate-qzephvdv.js +0 -1
  175. package/dist/chunk-group-scene-w1ycabrm.js +0 -1
  176. package/dist/chunk-group-table-9nvmja8w.js +0 -1
  177. package/dist/chunk-host-icons-fccg3b2d.js +0 -1
  178. package/dist/chunk-host-picture-jaqz127q.js +0 -1
  179. package/dist/chunk-host-state-r01v1ywg.js +0 -1
  180. package/dist/chunk-host-ui-n54mh5af.js +0 -1
  181. package/dist/chunk-index-0a81da8z.js +0 -2
  182. package/dist/chunk-index-1kwp3spy.js +0 -2
  183. package/dist/chunk-index-47vq85ye.js +0 -2
  184. package/dist/chunk-index-5zmswz4s.js +0 -2
  185. package/dist/chunk-index-64rsz6pf.js +0 -2
  186. package/dist/chunk-index-6vcs0h0m.js +0 -2
  187. package/dist/chunk-index-6xqz6mg2.js +0 -2
  188. package/dist/chunk-index-83v0c9x6.js +0 -2
  189. package/dist/chunk-index-8xd6anam.js +0 -2
  190. package/dist/chunk-index-b73y2gc0.js +0 -47
  191. package/dist/chunk-index-bhqczxr3.js +0 -2
  192. package/dist/chunk-index-c44p8q87.js +0 -2
  193. package/dist/chunk-index-cbqhzf40.js +0 -13
  194. package/dist/chunk-index-db8zh8e6.js +0 -2
  195. package/dist/chunk-index-dvfkb699.js +0 -2
  196. package/dist/chunk-index-e02ddp46.js +0 -1
  197. package/dist/chunk-index-ebg48jgy.js +0 -2
  198. package/dist/chunk-index-ek5mek4j.js +0 -14
  199. package/dist/chunk-index-em7vndrb.js +0 -2
  200. package/dist/chunk-index-eq161yvp.js +0 -4
  201. package/dist/chunk-index-f5x2srr0.js +0 -2
  202. package/dist/chunk-index-fg42egv9.js +0 -50
  203. package/dist/chunk-index-h3v1d3nt.js +0 -2
  204. package/dist/chunk-index-kbgykazq.js +0 -2
  205. package/dist/chunk-index-n8ghdvxb.js +0 -2
  206. package/dist/chunk-index-p5jcwjx8.js +0 -2
  207. package/dist/chunk-index-qfgkfq86.js +0 -2
  208. package/dist/chunk-index-rcwdqn50.js +0 -7
  209. package/dist/chunk-index-s72hmse6.js +0 -2
  210. package/dist/chunk-index-sv9qpmhv.js +0 -1
  211. package/dist/chunk-index-x4enmj72.js +0 -2
  212. package/dist/chunk-index-xevnf9ew.js +0 -2
  213. package/dist/chunk-index-xx8jq73q.js +0 -2
  214. package/dist/chunk-index-ypkgw7gq.js +0 -2
  215. package/dist/chunk-lang-css-y9133ktr.js +0 -1
  216. package/dist/chunk-lang-html-r2xmryek.js +0 -1
  217. package/dist/chunk-lang-javascript-1r6wd177.js +0 -1
  218. package/dist/chunk-lang-json-dx56g11y.js +0 -1
  219. package/dist/chunk-lang-markdown-fpcf2dfq.js +0 -6
  220. package/dist/chunk-lang-python-zzp95955.js +0 -3
  221. package/dist/chunk-lang-rust-214fh7sp.js +0 -1
  222. package/dist/chunk-lang-sql-vvp46hpj.js +0 -2
  223. package/dist/chunk-lang-typescript-y5w4tt4g.js +0 -1
  224. package/dist/chunk-lang-xml-tbcqmedk.js +0 -1
  225. package/dist/chunk-lang-yaml-jh56t3sv.js +0 -1
  226. package/dist/chunk-layout-actions-8dzvysym.js +0 -1
  227. package/dist/chunk-menu-items-3jhya205.js +0 -2
  228. package/dist/chunk-mode-toggle-js49gvpd.js +0 -1
  229. package/dist/chunk-note-row-kv061030.js +0 -75
  230. package/dist/chunk-notes-sdkqz5hr.js +0 -1
  231. package/dist/chunk-notice-bell-r012f2zy.js +0 -1
  232. package/dist/chunk-notices-h4rk1zxc.js +0 -1
  233. package/dist/chunk-onboarding-a18cvkph.js +0 -1
  234. package/dist/chunk-overview-ynaqn4fp.js +0 -1
  235. package/dist/chunk-palette-jm79gb5q.js +0 -1
  236. package/dist/chunk-placement-items-mwm9q1zn.js +0 -1
  237. package/dist/chunk-profile-ajw6pp4r.js +0 -1
  238. package/dist/chunk-prompt-history-zcfvr3r8.js +0 -1
  239. package/dist/chunk-prompts-m5rzdk24.js +0 -1
  240. package/dist/chunk-room-confirms-ftsj15ja.js +0 -1
  241. package/dist/chunk-room-menu-b9ktw9pw.js +0 -1
  242. package/dist/chunk-rooms-menu-button-qe62t6nx.js +0 -1
  243. package/dist/chunk-schedules-t8yxnf8q.js +0 -1
  244. package/dist/chunk-sheet-hosts-yj5wszgj.js +0 -1
  245. package/dist/chunk-shortcuts-9ft5sqdw.js +0 -1
  246. package/dist/chunk-skill-editor-xdfq2708.js +0 -8
  247. package/dist/chunk-skills-9wa4mwdc.js +0 -1
  248. package/dist/chunk-switcher-list-vpg6wvtw.js +0 -1
  249. package/dist/chunk-table-1y76m54h.js +0 -1
  250. package/dist/chunk-table2d-g57vr6h0.js +0 -1
  251. package/dist/chunk-table3d-cv6069hy.js +0 -4220
  252. package/dist/chunk-thread-actions-xjhpdjk7.js +0 -1
  253. package/dist/chunk-thread-list-fd6agz77.js +0 -217
  254. package/dist/chunk-transcript-5nfn3r35.js +0 -1
  255. package/dist/chunk-where-ha8pc3cg.js +0 -1
  256. package/dist/chunk-workspace-e85twv32.js +0 -578
  257. package/dist/chunk-zh-tw-z5p5mpph.js +0 -1
@@ -1,578 +0,0 @@
1
- import{h,cn,X,ve,s,N,Qe,M,a,r,t,c,m,e,n,o,v,di,D,Di,ce,p,d,f,w,g,_,P,k,re,Me,He}from"./chunk-index-fg42egv9.js";import{K}from"./chunk-index-p5jcwjx8.js";import{on,qe}from"./chunk-index-983dmeaa.js";import{he}from"./chunk-index-s72hmse6.js";import{L}from"./chunk-index-afrhnrxj.js";function st(i,l,u){let[y,b]=r();s(()=>{if(!i)return;let E=(x)=>x.preventDefault(),O=(x)=>{if(x.button!==0||x.metaKey||x.ctrlKey||x.shiftKey||x.altKey)return;let T=x.target instanceof Element?x.target.closest("a"):null;if(!T||T.target||T.hasAttribute("download"))return;if(l.current?.contains(T))return;x.preventDefault(),x.stopPropagation(),b({kind:"link",anchor:T})},R=di((x)=>b({kind:"navigate",proceed:x}));return window.addEventListener("beforeunload",E),document.addEventListener("click",O,!0),()=>{R(),window.removeEventListener("beforeunload",E),document.removeEventListener("click",O,!0)}},[i,l]);let C=X(()=>b(void 0),[]),S=X(()=>{let E=y;if(u(),b(void 0),E?.kind==="link")setTimeout(()=>E.anchor.click(),0);else if(E?.kind==="navigate")E.proceed()},[y,u]);return{leaving:y,stay:C,leave:S}}var ie=(i)=>`workspace/${encodeURIComponent(i)}`,xe=(i)=>`path=${encodeURIComponent(i)}`,Xe=(i)=>({body:JSON.stringify(i)});function Ve(i){if(!(i instanceof ce)||i.status!==409)return;let l=i.body;return l?.conflict==="changed"||l?.conflict==="gone"||l?.conflict==="exists"?l:void 0}var j={roots:()=>p("workspace"),list:(i,l)=>p(`${ie(i)}/list?${xe(l)}`),file:(i,l)=>p(`${ie(i)}/file?${xe(l)}`),save:(i,l,u,y)=>p(`${ie(i)}/file?${xe(l)}`,{method:"PUT",...Xe({text:u,baseHash:y})}),create:(i,l,u,y)=>p(`${ie(i)}/new?${xe(l)}`,{method:"POST",...Xe({kind:u,...y===void 0?{}:{text:y}})}),rename:(i,l,u)=>p(`${ie(i)}/rename`,{method:"POST",...Xe({from:l,to:u})}),remove:(i,l)=>p(`${ie(i)}/entry?${xe(l)}`,{method:"DELETE"}),trash:(i)=>p(`${ie(i)}/trash`),restore:(i,l)=>p(`${ie(i)}/trash/${encodeURIComponent(l)}/restore`,{method:"POST"}),purge:(i,l)=>p(`${ie(i)}/trash/${encodeURIComponent(l)}`,{method:"DELETE"})},ge=(i,l,u=!1)=>`api/${ie(i)}/raw?${xe(l)}${u?"&download=1":""}`;var Re=(i)=>i.split("/").filter(Boolean),we=(i)=>Re(i).slice(0,-1).join("/"),Ne=(i,l)=>i?`${i}/${l}`:l,Te=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function dt(i){if(!i)return;let l=i.indexOf(":");if(l<1)return;let u=i.slice(l+1);return{root:i.slice(0,l),path:u.replace(/\/+$/,""),dir:u===""||u.endsWith("/")}}var lt=`/*
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 ct={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"},Nt=(i)=>(i in ct);function be(i){let{name:l,size:u=20,className:y}=i;if(!Nt(l))return e(o,{name:l,size:u,...y?{className:y}:{}});return e("svg",{viewBox:"0 0 24 24",width:u,height:u,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...y?{className:y}:{},children:e("path",{d:ct[l]})})}function Ye(i){return n("div",{className:"ws-media-actions",children:[i.open?e("a",{className:"button-link",href:ge(i.root,i.path),target:"_blank",rel:"noopener",children:t("Open")}):null,n("a",{className:"button-link",href:ge(i.root,i.path,!0),download:i.name,children:[e(o,{name:"download",size:18}),t("Download")]})]})}function _e(i){let l=i.name.lastIndexOf("."),u=l>0?i.name.slice(l+1).toUpperCase():"";return n("div",{className:"card ws-card",children:[e("span",{className:"ws-card-icon","aria-hidden":"true",children:e(o,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[u,Me(i.bytes)].filter(Boolean).join(" · ")}),e("p",{children:i.message}),e(Ye,{root:i.root,path:i.path,name:i.name})]})}var Ct=(i)=>!i&&navigator.pdfViewerEnabled!==!1;function ut(i){let{media:l,root:u,path:y,name:b,bytes:C,phone:S,onFacts:E}=i,[O,R]=r(!1),[x,T]=r(!1);s(()=>(R(!1),T(!1),E(void 0),()=>E(void 0)),[u,y]);let I=ge(u,y);if(O)return e(_e,{root:u,path:y,name:b,bytes:C,message:t("This browser cannot show this file.")});switch(l){case"image":return e("div",{className:"ws-media ws-image","data-actual":x||void 0,children:e("button",{type:"button",className:"ws-image-toggle","aria-label":x?t("Fit to window"):t("Show at full size"),title:x?t("Fit to window"):t("Show at full size"),onClick:()=>T((F)=>!F),children:e("img",{src:I,alt:b,onLoad:(F)=>{let{naturalWidth:Q,naturalHeight:q}=F.currentTarget;E(Q>0?`${Q} × ${q}`:void 0)},onError:()=>R(!0)})})});case"pdf":return Ct(S)?n("div",{className:"ws-media ws-pdf-frame",children:[e("iframe",{className:"ws-pdf",src:I,title:b}),e(Ye,{root:u,path:y,name:b,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(o,{name:"file",size:32})}),e("strong",{children:b}),n("span",{className:"meta",children:["PDF · ",Me(C)]}),e(Ye,{root:u,path:y,name:b,open:!0})]})});case"audio":return e("div",{className:"ws-media ws-sound",children:e("audio",{controls:!0,preload:"metadata",src:I,onError:()=>R(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:I,onLoadedMetadata:(F)=>{let{videoWidth:Q,videoHeight:q}=F.currentTarget;E(Q>0?`${Q} × ${q}`:void 0)},onError:()=>R(!0)})})}}var Et={"read-only-root":c("this place is read-only"),"git-dir":c("inside .git"),trash:c("in the trash"),symlink:c("a link"),binary:c("binary file"),"too-large":c("too large"),"not-utf8":c("not UTF-8")};function Ge(i){if(i.id==="agents")return t("Knights' workspace");if(i.id==="scratch")return t("Scratch");return i.label}var pt=new Set([".git","node_modules"]),Ze=(i)=>`roundtable.workspace.open.${i}`,mt="roundtable.workspace.tree",ft="roundtable.workspace.wrap";function Je(i,l){try{let u=localStorage.getItem(i);return u===null?l:JSON.parse(u)}catch{return l}}function Ae(i,l){try{localStorage.setItem(i,JSON.stringify(l))}catch{}}var Le=cn({rev:0,bump:()=>{return}});on("workspace",lt);var Ce=new Map,St=200;function Rt(i,l){Ce.delete(i),Ce.set(i,l);let u=Ce.keys().next().value;if(Ce.size>St&&u!==void 0)Ce.delete(u)}function gt(i,l,u=!0){let{rev:y}=ve(Le),[b,C]=r(0),[S,E]=r({key:"",root:i,path:l}),O=`${i}:${l}`;if(s(()=>{let x=()=>C((T)=>T+1);return window.addEventListener("focus",x),()=>window.removeEventListener("focus",x)},[]),s(()=>{if(!u)return;let x=!0;return j.list(i,l).then((T)=>{if(Rt(O,T),x)E({key:O,root:i,path:l,data:T})},(T)=>x&&E({key:O,root:i,path:l,error:d(T)})),()=>{x=!1}},[i,l,u,y,b]),S.key===O)return{data:S.data,error:S.error,at:S};let R=Ce.get(O);if(R)return{data:R,at:{root:i,path:l}};if(S.data)return{data:S.data,at:S,pending:!0};return{}}var Ee=(i)=>v("workspace",Te(i));function et(i,l,u){let y=Ne(l,u.name);if(u.kind==="dir")return{root:i,path:y,dir:!0};if(u.kind==="file")return{root:i,path:y,dir:!1};if(u.kind==="symlink"&&u.inside)return{root:i,path:y,dir:u.target==="dir"};return}function Tt(i){let l=Re(i.path),u=a(null);return s(()=>{u.current?.scrollIntoView?.({inline:"end",block:"nearest"})},[i.path]),n("nav",{className:"ws-crumbs","aria-label":t("Path"),children:[e("a",{ref:l.length===0?u:void 0,href:Ee({root:i.root.id,path:"",dir:!0}),"aria-current":l.length===0?"page":void 0,children:Ge(i.root)}),l.map((y,b)=>{let C=l.slice(0,b+1).join("/"),S=b===l.length-1;return e("a",{ref:S?u:void 0,href:Ee({root:i.root.id,path:C,dir:!0}),"aria-current":S?"page":void 0,children:y},C)})]})}function ht(i){let{data:l,error:u,pending:y}=gt(i.root,i.path);if(u)return e("p",{className:"ws-tree-note",children:u});if(!l||y)return e("p",{className:"ws-tree-note",children:"…"});if(l.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:[l.entries.map((b)=>{let C=et(i.root,i.path,b),S=Ne(i.path,b.name),E=C?.dir===!0,O=E&&i.open.has(S),R=i.current?.root===i.root&&i.current.path===S&&i.current.dir===E;return n("li",{children:[n("div",{className:"ws-tree-row","data-selected":R||void 0,"data-quiet":pt.has(b.name)||void 0,style:{paddingLeft:`${0.25+i.depth*0.875}rem`},children:[E?e("button",{type:"button",className:"ws-twist","aria-expanded":O,"aria-label":t("Show or hide {name}",{name:b.name}),onClick:()=>i.toggle(S),children:e(o,{name:"chevron",size:14})}):e("span",{className:"ws-twist"}),C?n("a",{href:Ee(C),title:b.name,children:[e(be,{name:E?"folder":"file",size:15}),e("span",{className:"ws-tree-label",children:b.name})]}):n("span",{className:"ws-tree-off",title:b.inside===!1?t("Outside the workspace"):"",children:[e(o,{name:"file",size:15}),e("span",{className:"ws-tree-label",children:b.name})]})]}),O?e(ht,{root:i.root,path:S,depth:i.depth+1,open:i.open,toggle:i.toggle,current:i.current}):null]},b.name)}),l.truncated?e("li",{className:"ws-tree-note",children:t("Only the first 2,000 items are listed")}):null]})}function Lt(i){let{data:l,error:u,at:y,pending:b}=gt(i.root.id,i.path),{timeZone:C}=k(),S=a(null),E=y?.root??i.root.id,O=y?.path??i.path;if(Qe(()=>{S.current?.closest(".ws-main")?.scrollTo?.(0,0)},[E,O]),u)return e(g,{message:u});if(!l)return e(w,{});if(l.missing)return e(_,{children:t("No files yet")});if(l.entries.length===0)return e(_,{children:t("This folder is empty")});return n("div",{ref:S,className:"ws-listing","data-pending":b||void 0,"aria-busy":b||void 0,inert:b||void 0,children:[e("ul",{className:"ws-rows",children:l.entries.map((R)=>{let x=et(E,O,R),T=n(m,{children:[e(be,{name:x?.dir?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:R.name}),e("span",{className:"meta",children:R.kind==="symlink"&&R.inside===!1?t("Outside the workspace"):R.kind==="other"?t("Not a regular file"):[x?.dir?void 0:Me(R.size),re(new Date(R.mtimeMs).toISOString(),C)].filter(Boolean).join(" · ")})]})]});return n("li",{className:"ws-row","data-quiet":pt.has(R.name)||void 0,children:[x?e("a",{className:"ws-row-link",href:Ee(x),children:T}):e("span",{className:"ws-row-link","data-off":!0,children:T}),i.root.writable||x?e("button",{type:"button",className:"icon-button","aria-label":t("Actions for {name}",{name:R.name}),onClick:()=>i.onMenu(R),children:e(o,{name:"menu"})}):null]},R.name)})}),l.truncated?e("p",{className:"meta",children:t("Only the first 2,000 items are listed")}):null]})}function Wt(i){let{timeZone:l}=k(),{bump:u}=ve(Le),{root:y,path:b}=i,[C,S]=r(),[E,O]=r(),[R,x]=r("read"),[T,I]=r(!1),[F,Q]=r(!1),[q,Ke]=r(()=>Je(ft,i.phone)),[We,ee]=r(!1),[Se,ke]=r(),[V,A]=r(!1),[Y,le]=r(!1),[ze,Ue]=r(!1),[ue,se]=r(),[U,me]=r(),[ye,De]=r(),fe=a(null),H=a(void 0),z=a(null),ae=a(C);ae.current=C;let Z=a(R);Z.current=R;let G=Re(b).at(-1)??b,$e=C?.text!==void 0,Oe=$e&&(C?.media===void 0||V),tt=X(async()=>{let W=await j.file(y.id,b);return S(W),W},[y.id,b]);s(()=>{let W=!0;return j.file(y.id,b).then((B)=>W&&S(B),(B)=>W&&O(d(B))),()=>{W=!1}},[y.id,b]);let Be=st(T,z,()=>{let W=ae.current;if(W?.text!==void 0)H.current?.replace(W.text,W.eol);I(!1),x("read")});s(()=>{if(!T)return;let W=document.title;return document.title=`• ${W}`,()=>{document.title=W}},[T]);let Pe=X(async(W,B)=>{let de=ae.current,J=H.current;if(!de||!J||F)return;let te=B===void 0?J.snapshot():void 0,Fe=B??J.text();Q(!0);try{let ne=await j.save(y.id,b,Fe,W??de.hash);J.markSaved(te),I(J.dirty()),se(void 0),S({...de,hash:ne.hash,size:ne.size,mtimeMs:ne.mtimeMs,text:Fe}),f(t("Saved")),u()}catch(ne){let oe=Ve(ne);if(oe)me({kind:oe.conflict==="gone"?"gone":"changed",...oe.current?{hash:oe.current.hash}:{},text:Fe});else f(d(ne),"danger")}finally{Q(!1)}},[y.id,b,F,u]),nt=a(Pe);nt.current=Pe;let pe=X(async()=>{try{let W=await tt();if(W.text!==void 0)H.current?.replace(W.text,W.eol);I(!1),se(void 0),me(void 0)}catch(W){f(d(W),"danger")}},[tt]),wt=a(pe);wt.current=pe;let je=X(()=>{if(H.current?.dirty()){at(!0);return}x("read")},[]),[vt,at]=r(!1),rt=a(je);rt.current=je,s(()=>{if(!Oe||!fe.current)return;let W=ae.current;if(!W||W.text===void 0)return;let B=!1,de;return (h("5j6abj8k"),import("./chunk-codeeditor-5j6abj8k.js")).then(async({createEditor:J})=>{if(B||!fe.current)return;let te=await J({parent:fe.current,text:W.text??"",eol:W.eol,language:W.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:()=>I(te.dirty()),onSave:()=>{if(Z.current==="edit"&&te.dirty())nt.current()},onEscape:()=>{if(Z.current==="edit")rt.current()}});if(B){te.destroy();return}de=te,H.current=te,le(!0)}).catch((J)=>{if(console.warn("the editor failed to load",J),!B)Ue(!0)}),()=>{B=!0,de?.destroy(),H.current=void 0,le(!1)}},[Oe,y.id,b]),s(()=>{if(!Y)return;let W=R==="edit"&&C?.editable===!0;if(H.current?.setEditable(W),W)H.current?.focus()},[R,Y,C?.editable]),s(()=>{if(!Y)return;H.current?.setWrap(q),Ae(ft,q)},[q,Y]);let ot=C!==void 0;if(s(()=>{if(!ot)return;let W=!1,B=async()=>{if(W||document.visibilityState==="hidden")return;let te=ae.current;if(!te)return;W=!0;try{let ne=(await j.list(y.id,we(b))).entries.find((yt)=>yt.name===G);if(!ne){se("gone");return}if(ne.kind==="symlink")return;if(ne.size===te.size&&ne.mtimeMs===te.mtimeMs)return;if(Z.current==="edit"&&H.current?.dirty()){se("changed");return}let oe=await j.file(y.id,b);if(oe.hash!==te.hash){if(S(oe),oe.text!==void 0)H.current?.replace(oe.text,oe.eol)}se(void 0)}catch{}finally{W=!1}},de=setInterval(()=>void B(),5000),J=()=>void B();return window.addEventListener("focus",J),document.addEventListener("visibilitychange",J),()=>{clearInterval(de),window.removeEventListener("focus",J),document.removeEventListener("visibilitychange",J)}},[ot,y.id,b,G]),E)return e("div",{className:"ws-file",children:e(g,{message:E})});if(!C)return e("div",{className:"ws-file",children:e(w,{})});let it=C.reason,bt=!C.editable?e(P,{tone:"warn",children:t("Read only: {reason}",{reason:it?t(Et[it]):""})}):null,Ie=R==="edit",kt=n("div",{className:"ws-actions",children:[C.editable&&!Ie?e("button",{type:"button",onClick:()=>{A(!0),x("edit")},children:t("Edit")}):null,Ie?n(m,{children:[e("button",{type:"button",disabled:F||!T,onClick:()=>void Pe(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:je,children:t("Cancel")})]}):null,e("button",{type:"button",className:"icon-button","aria-label":t("File menu"),onClick:()=>ee(!0),children:e(o,{name:"menu"})})]});return n("div",{className:"ws-file",ref:z,children:[n("header",{className:"ws-file-head",children:[n("div",{className:"ws-file-title",children:[n("strong",{children:[T?"• ":"",G]}),n("span",{className:"meta",children:[Me(C.size),Se?` · ${Se}`:""," ·"," ",re(new Date(C.mtimeMs).toISOString(),l)]})]}),bt,kt]}),ue?n("div",{className:"ws-banner",role:"status",children:[e("span",{className:"ws-banner-text",children:ue==="gone"?t("This file is gone"):t("A knight is changing this file")}),ue==="changed"?n(m,{children:[e("button",{type:"button",className:"secondary",onClick:()=>void pe(),children:t("Reload (discard my edits)")}),e("button",{type:"button",className:"secondary",onClick:()=>se(void 0),children:t("Keep editing")})]}):null]}):null,e("div",{className:"ws-view",children:C.media&&!Oe?e(ut,{media:C.media,root:y.id,path:b,name:G,bytes:C.size,phone:i.phone,onFacts:ke}):Oe?e("div",{ref:fe,className:"ws-editor","data-editing":Ie||void 0,children:!Y?e("pre",{className:"ws-plain","aria-busy":!ze,children:C.text}):null}):e(_e,{root:y.id,path:b,name:G,bytes:C.size,message:C.tooLarge?t("This file is too large to show here."):t("This file is not text, so it cannot be shown here.")})}),i.phone&&Ie?n("div",{className:"ws-editbar",role:"toolbar","aria-label":t("Editing"),children:[e("button",{type:"button",disabled:F||!T,onClick:()=>void Pe(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.undo(),children:t("Undo")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.redo(),children:t("Redo")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.find(),children:t("Find")}),e("button",{type:"button",className:"secondary",onClick:()=>H.current?.tab(),children:t("Tab")})]}):null,e(L,{open:We,title:G,onClose:()=>ee(!1),children:e("div",{className:"stack",children:n("ul",{className:"more-list",children:[$e?e("li",{children:e("button",{type:"button",className:"menu-item",onClick:()=>{Ke((W)=>!W),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:ge(y.id,b,!0),download:G,onClick:()=>ee(!1),children:[e("span",{className:"menu-icon",children:e(o,{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),pe()},children:[e("span",{className:"menu-icon",children:e(o,{name:"refresh"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Reload")})})]})})]})})}),e(he,{open:U!==void 0,title:U?.kind==="gone"?t("This file is gone"):t("This file changed while you were editing"),onClose:()=>me(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 pe(),children:t("Reload (discard my edits)")}):null,e("button",{type:"button",className:"danger",onClick:()=>{if(!U)return;if(U.kind==="gone"){let W=U.text;me(void 0),j.create(y.id,b,"file",W).then(async()=>{await pe(),u()}).catch((B)=>f(d(B),"danger"));return}De({hash:U.hash??"",text:U.text}),me(void 0)},children:U?.kind==="gone"?t("Save mine as a new file"):t("Save mine anyway")})]})]})}),e(K,{open:ye!==void 0,title:t("Replace the knight's changes?"),confirmLabel:t("Save mine anyway"),tone:"danger",onClose:()=>De(void 0),onConfirm:async()=>{if(!ye)return;await j.save(y.id,b,ye.text,ye.hash),await pe(),f(t("Saved")),u()},children:e("p",{children:t("The file has been changed since you opened it. Saving yours writes over those changes.")})}),e(K,{open:vt,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:()=>at(!1),onConfirm:async()=>{if(C.text!==void 0)H.current?.replace(C.text,C.eol);I(!1),x("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})}),e(K,{open:Be.leaving!==void 0,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:Be.stay,onConfirm:async()=>Be.leave(),children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})})]})}function zt(i){let{ask:l}=i,[u,y]=r(""),[b,C]=r(),[S,E]=r(!1),O=N();s(()=>{y(l?.kind==="rename"?l.name:""),C(void 0)},[l]);let R=l?.kind==="rename"?t("Rename"):l?.kind==="dir"?t("New folder"):t("New file"),x=async(T)=>{if(T.preventDefault(),!l)return;let I=u.trim();if(!I||I.includes("/")){C(t("Use a name without slashes."));return}E(!0),C(void 0);try{if(l.kind==="rename"){let F=Ne(we(l.path),I);await j.rename(i.root.id,l.path,F),f(t("Renamed")),i.onDone()}else{let F=Ne(l.dir,I);await j.create(i.root.id,F,l.kind),f(t("Created")),i.onDone({root:i.root.id,path:F,dir:l.kind==="dir"})}}catch(F){let Q=Ve(F);C(Q?.conflict==="exists"?t("Something with that name is already there."):d(F))}finally{E(!1)}};return e(he,{open:l!==void 0,title:R,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:x,children:[e("label",{htmlFor:O,children:t("Name")}),e("input",{id:O,value:u,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(T)=>y(T.target.value)}),b?e(g,{message:b}):null,n("div",{className:"actions",children:[e("button",{type:"button",className:"secondary",onClick:i.onClose,children:t("Cancel")}),e("button",{type:"submit",disabled:S||!u.trim(),children:l?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Mt(i){let{bump:l,rev:u}=ve(Le),[y,b]=r(),[C,S]=r(),[E,O]=r(),{timeZone:R}=k();return s(()=>{if(!i.open)return;let x=!0;return j.trash(i.root.id).then((T)=>x&&b(T.items),(T)=>x&&S(d(T))),()=>{x=!1}},[i.open,i.root.id,u]),n(he,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[C?e(g,{message:C}):null,!y&&!C?e(w,{}):null,y?.length===0?e(_,{children:t("The trash is empty")}):null,e("ul",{className:"ws-rows",children:y?.map((x)=>n("li",{className:"ws-row",children:[n("span",{className:"ws-row-link","data-off":!0,children:[e(be,{name:x.kind==="dir"?"folder":"file",size:20,className:"ws-row-icon"}),n("span",{className:"ws-row-main",children:[e("strong",{children:x.path}),e("span",{className:"meta",children:re(x.deletedAt,R)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await j.restore(i.root.id,x.id),f(t("Restored")),l()}catch(T){let I=Ve(T);f(I?I.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):d(T),"danger")}},children:t("Restore")}),e("button",{type:"button",className:"icon-button danger-icon","aria-label":t("Delete {name} for good",{name:x.name}),onClick:()=>O(x),children:e(o,{name:"trash"})})]},x.id))})]}),e(K,{open:E!==void 0,title:t("Delete for good?"),confirmLabel:t("Delete for good"),tone:"danger",onClose:()=>O(void 0),onConfirm:async()=>{if(!E)return;await j.purge(i.root.id,E.id),l()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:E?.path??""})})})]})}function yn(){let i=Di(),l=!He("(min-width: 720px)"),[u,y]=r(0),b=X(()=>y((z)=>z+1),[]),C=M(()=>({rev:u,bump:b}),[u,b]),[S,E]=r(),[O,R]=r();s(()=>{j.roots().then((z)=>E(z.roots),(z)=>R(d(z)))},[]);let[x,T]=r(()=>Je(mt,280)),[I,F]=r(),[Q,q]=r(),[Ke,We]=r(!1),[ee,Se]=r(),ke=dt(i.key),V=S?.find((z)=>z.id===ke?.root)??(l?void 0:S?.[0]),A=V?ke&&ke.root===V.id?ke:{root:V.id,path:"",dir:!0}:void 0,Y=V?.id,le=A?.path,ze=A?.dir,[Ue,ue]=r(new Set);s(()=>{if(!Y)return;ue(new Set(Je(Ze(Y),[])))},[Y]);let se=X((z)=>{if(!Y)return;ue((ae)=>{let Z=new Set(ae);if(Z.has(z))Z.delete(z);else Z.add(z);return Ae(Ze(Y),[...Z]),Z})},[Y]);if(s(()=>{if(!Y||le===void 0||l)return;let z=Re(ze?le:we(le)),ae=z.map((Z,G)=>z.slice(0,G+1).join("/"));ue((Z)=>{if(ae.every(($e)=>Z.has($e)))return Z;let G=new Set([...Z,...ae]);return Ae(Ze(Y),[...G]),G})},[Y,le,ze,l]),O)return e(g,{message:O});if(!S)return e(w,{});if(S.length===0)return e(_,{children:t("No files yet")});if(!V||!A)return e(Le.Provider,{value:C,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:S.map((z)=>e("li",{children:n("a",{className:"menu-item menu-link",href:Ee({root:z.id,path:"",dir:!0}),children:[e("span",{className:"menu-icon",children:e(be,{name:"folder"})}),n("span",{className:"menu-text",children:[e("strong",{children:Ge(z)}),z.writable?null:e("span",{className:"meta",children:t("Read only")})]}),e(o,{name:"chevron",size:16})]})},z.id))})]})});let U=A.dir?A.path:we(A.path),me=A.path===""?{root:V.id,path:"",dir:!0}:{root:V.id,path:we(A.path),dir:!0},ye=n("header",{className:"ws-head",children:[l?e("a",{className:"icon-button","aria-label":t("Back"),href:A.path===""?v("workspace"):Ee(me),children:e(o,{name:"back"})}):e(qe,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:V.id,onChange:(z)=>D("workspace",Te({root:z.target.value,path:"",dir:!0})),children:S.map((z)=>e("option",{value:z.id,children:Ge(z)},z.id))}),e(Tt,{root:V,path:A.path}),V.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:()=>We(!0),children:e(o,{name:"trash"})})]}):null]}),De=A.dir?e("div",{className:"ws-dir",children:e(Lt,{root:V,path:A.path,onMenu:(z)=>F(z)})}):e(Wt,{root:V,path:A.path,phone:l},`${V.id}:${A.path}`),fe=I?et(V.id,U,I):void 0,H=I?Ne(U,I.name):"";return n(Le.Provider,{value:C,children:[n("div",{className:"ws-page ws","data-wide":!l||void 0,style:{"--ws-tree":`${x}px`},children:[ye,n("div",{className:"ws-body",children:[!l?n(m,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(ht,{root:V.id,path:"",depth:0,open:Ue,toggle:se,current:A})}),e(Dt,{width:x,onChange:(z)=>{T(z),Ae(mt,z)}})]}):null,e("section",{className:"ws-main",children:De})]})]}),e(L,{open:I!==void 0,title:I?.name??"",onClose:()=>F(void 0),children:n("ul",{className:"more-list",children:[fe&&!fe.dir?e("li",{children:n("a",{className:"menu-item menu-link",href:ge(V.id,H,!0),download:I?.name,onClick:()=>F(void 0),children:[e("span",{className:"menu-icon",children:e(o,{name:"download"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Download")})})]})}):null,V.writable&&I?n(m,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{q({kind:"rename",path:H,name:I.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(o,{name:"notes"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Rename")})})]})}),e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{Se({path:H,name:I.name}),F(void 0)},children:[e("span",{className:"menu-icon",children:e(o,{name:"trash"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Delete")})})]})})]}):null]})}),e(zt,{root:V,ask:Q,onClose:()=>q(void 0),onDone:(z)=>{if(q(void 0),b(),z)D("workspace",Te(z))}}),e(Mt,{root:V,open:Ke,onClose:()=>We(!1)}),e(K,{open:ee!==void 0,title:t("Move to the trash?"),confirmLabel:t("Delete"),tone:"danger",onClose:()=>Se(void 0),onConfirm:async()=>{if(!ee)return;if(await j.remove(V.id,ee.path),f(t("Moved to the trash")),b(),!A.dir&&(A.path===ee.path||A.path.startsWith(`${ee.path}/`)))D("workspace",Te({root:V.id,path:we(A.path),dir:!0}))},children:e("p",{children:t("“{name}” goes to the trash, where you can bring it back.",{name:ee?.name??""})})})]})}function Dt(i){let y=(b)=>Math.min(560,Math.max(180,b));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:(b)=>{if(b.key==="ArrowLeft")i.onChange(y(i.width-16));if(b.key==="ArrowRight")i.onChange(y(i.width+16))},onPointerDown:(b)=>{let C=b.clientX,S=i.width,E=b.currentTarget;E.setPointerCapture(b.pointerId);let O=(x)=>i.onChange(y(S+x.clientX-C)),R=()=>{E.removeEventListener("pointermove",O),E.removeEventListener("pointerup",R)};E.addEventListener("pointermove",O),E.addEventListener("pointerup",R)}})}export{yn as WorkspacePage};