pi-roundtable-web 0.26.1 → 0.26.3

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 (212) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +25 -6
  3. package/dist/chunk-account-hck7mhf8.js +1 -0
  4. package/dist/chunk-action-menu-beqh40k6.js +1 -0
  5. package/dist/{chunk-agent-rdv7ekrt.js → chunk-agent-znnth24t.js} +1 -1
  6. package/dist/chunk-arranged-rooms-wfakrddk.js +1 -0
  7. package/dist/chunk-bulk-actions-c4tkvk9g.js +1 -0
  8. package/dist/chunk-character-creator-qwcsdytw.js +1 -0
  9. package/dist/{chunk-codeeditor-ajhgd33t.js → chunk-codeeditor-6xavqntt.js} +2 -2
  10. package/dist/chunk-confirm-z95j9jt3.js +1 -0
  11. package/dist/chunk-connectors-7xqsg5q5.js +1 -0
  12. package/dist/chunk-conversations-zc4mv6vj.js +1 -0
  13. package/dist/{chunk-drag-peyb8t0k.js → chunk-drag-0mefcvp3.js} +1 -1
  14. package/dist/chunk-entry-hrt97qed.js +1 -0
  15. package/dist/chunk-folder-list-nemtqbnc.js +1 -0
  16. package/dist/chunk-folds-xpg9qcwf.js +1 -0
  17. package/dist/chunk-gate-86r8a2vf.js +1 -0
  18. package/dist/chunk-group-scene-g24kxz6f.js +1 -0
  19. package/dist/chunk-group-table-851jm8ef.js +1 -0
  20. package/dist/chunk-host-icons-23zhqpmc.js +1 -0
  21. package/dist/chunk-host-picture-8tnh2wam.js +1 -0
  22. package/dist/chunk-host-state-j41sp065.js +1 -0
  23. package/dist/chunk-host-ui-cje7a9t9.js +1 -0
  24. package/dist/chunk-index-1fn8q4ps.js +2 -0
  25. package/dist/{chunk-index-73gh7kgr.js → chunk-index-30vw4nhh.js} +35 -3
  26. package/dist/{chunk-index-k7t14rwa.js → chunk-index-3aa5czxj.js} +2 -2
  27. package/dist/chunk-index-3k7sdph2.js +1 -0
  28. package/dist/{chunk-index-w31c4yjv.js → chunk-index-3wbyq10m.js} +2 -2
  29. package/dist/{chunk-index-vcyzwtk2.js → chunk-index-47yspxa4.js} +2 -2
  30. package/dist/chunk-index-4jf4jvfd.css +1 -0
  31. package/dist/chunk-index-4s1qj9we.js +2 -0
  32. package/dist/chunk-index-5fz5e1ct.js +2 -0
  33. package/dist/{chunk-index-5yzfrf7b.js → chunk-index-67p2sc14.js} +3 -3
  34. package/dist/{chunk-index-gyary7np.js → chunk-index-6c8mewwy.js} +12 -12
  35. package/dist/{chunk-index-yzsgsvnp.js → chunk-index-84wbc80d.js} +2 -2
  36. package/dist/{chunk-index-snzzfhk3.js → chunk-index-8eexybcx.js} +2 -2
  37. package/dist/{chunk-index-pk1yxkv4.js → chunk-index-agrvqf5b.js} +2 -2
  38. package/dist/chunk-index-azrnzgev.js +2 -0
  39. package/dist/{chunk-index-0xh24y25.js → chunk-index-c2ag3qw2.js} +2 -2
  40. package/dist/{chunk-index-kwcx62wb.js → chunk-index-e90kztkx.js} +3 -3
  41. package/dist/chunk-index-efgm0066.js +2 -0
  42. package/dist/{chunk-index-w2j3njb6.js → chunk-index-eh0wb6g0.js} +2 -2
  43. package/dist/{chunk-index-z9x4cnzf.js → chunk-index-eyc2rkq5.js} +2 -2
  44. package/dist/chunk-index-fe0m5mht.js +2 -0
  45. package/dist/{chunk-index-2yebd9tb.js → chunk-index-gt42wjby.js} +4 -4
  46. package/dist/{chunk-index-cvbdf2ca.js → chunk-index-hc0dgmrs.js} +2 -2
  47. package/dist/{chunk-index-eg55mqqe.js → chunk-index-hczrjnky.js} +1 -1
  48. package/dist/chunk-index-hrtyanda.js +2 -0
  49. package/dist/chunk-index-j479p62w.js +2 -0
  50. package/dist/chunk-index-jq970hsd.js +42 -0
  51. package/dist/chunk-index-kankja6p.js +50 -0
  52. package/dist/chunk-index-kb44jp50.js +2 -0
  53. package/dist/{chunk-index-m7fvw92f.js → chunk-index-m65cv329.js} +2 -2
  54. package/dist/chunk-index-mnwdbb4n.js +2 -0
  55. package/dist/chunk-index-n6zrc05a.js +2 -0
  56. package/dist/chunk-index-n93wqszt.js +8 -0
  57. package/dist/{chunk-index-zrvg23jd.js → chunk-index-nrexxkar.js} +2 -2
  58. package/dist/chunk-index-pgxgq61x.js +2 -0
  59. package/dist/chunk-index-q5vzjqr5.js +2 -0
  60. package/dist/chunk-index-qqwk157d.js +2 -0
  61. package/dist/{chunk-index-czdketze.js → chunk-index-r1v895tj.js} +2 -2
  62. package/dist/chunk-index-r3tqhew8.js +2 -0
  63. package/dist/chunk-index-raf772z6.js +2 -0
  64. package/dist/{chunk-index-dt9775ka.js → chunk-index-rcxz5w5d.js} +5 -5
  65. package/dist/chunk-index-rg9vh59e.js +1 -0
  66. package/dist/chunk-index-sxq69p1f.js +2 -0
  67. package/dist/chunk-index-taq2psr6.js +2 -0
  68. package/dist/{chunk-index-rmxbdmn2.js → chunk-index-tsxsy4qs.js} +2 -2
  69. package/dist/chunk-index-wc83vb0a.js +2 -0
  70. package/dist/chunk-index-xbs8q4kn.js +2 -0
  71. package/dist/chunk-index-xxbveevc.js +2 -0
  72. package/dist/{chunk-index-0fmmvgee.js → chunk-index-zx6yka30.js} +2 -2
  73. package/dist/chunk-lang-css-yrc25qk9.js +1 -0
  74. package/dist/{chunk-lang-dockerfile-k728ewsf.js → chunk-lang-dockerfile-tjxsnhr9.js} +1 -1
  75. package/dist/{chunk-lang-go-wjwgay4v.js → chunk-lang-go-drmfa25k.js} +3 -3
  76. package/dist/chunk-lang-html-rwe8epvf.js +1 -0
  77. package/dist/chunk-lang-javascript-d6x6qjtg.js +1 -0
  78. package/dist/{chunk-lang-json-7gd89mvs.js → chunk-lang-json-790swysy.js} +1 -1
  79. package/dist/{chunk-lang-markdown-b6qbe8bt.js → chunk-lang-markdown-483dkxcq.js} +5 -5
  80. package/dist/{chunk-lang-python-3v56y31b.js → chunk-lang-python-v9s40bzj.js} +2 -2
  81. package/dist/{chunk-lang-rust-kh0z74d1.js → chunk-lang-rust-z4gry1bf.js} +1 -1
  82. package/dist/{chunk-lang-shell-9zv0zvbx.js → chunk-lang-shell-egsvk8rj.js} +1 -1
  83. package/dist/{chunk-lang-sql-yw6bf3t7.js → chunk-lang-sql-75j3denr.js} +2 -2
  84. package/dist/{chunk-lang-toml-tg1r96nq.js → chunk-lang-toml-7dbjvhex.js} +1 -1
  85. package/dist/chunk-lang-typescript-1rv9vdcz.js +1 -0
  86. package/dist/{chunk-lang-xml-ev1mndd4.js → chunk-lang-xml-jg1sv4h2.js} +1 -1
  87. package/dist/{chunk-lang-yaml-fz5qpb3r.js → chunk-lang-yaml-g3v7s5je.js} +1 -1
  88. package/dist/chunk-layout-actions-6assr93n.js +1 -0
  89. package/dist/chunk-menu-items-9szcza00.js +2 -0
  90. package/dist/chunk-mode-toggle-bzbq7ycq.js +1 -0
  91. package/dist/{chunk-note-row-kd0fy7ee.js → chunk-note-row-g20h11pm.js} +2 -2
  92. package/dist/chunk-notes-gc8bssxn.js +1 -0
  93. package/dist/chunk-notice-bell-jehad6sx.js +1 -0
  94. package/dist/chunk-notices-prqkv7ge.js +1 -0
  95. package/dist/chunk-onboarding-mdtc2mb7.js +1 -0
  96. package/dist/chunk-overview-2j1s6kqg.js +1 -0
  97. package/dist/chunk-palette-4qt6ewem.js +1 -0
  98. package/dist/chunk-placement-items-2eect825.js +1 -0
  99. package/dist/chunk-profile-pfzyc04p.js +1 -0
  100. package/dist/chunk-prompt-history-2bcp2rky.js +1 -0
  101. package/dist/chunk-prompts-052mb05y.js +1 -0
  102. package/dist/chunk-room-confirms-asvmjh5s.js +1 -0
  103. package/dist/chunk-room-menu-dm2r2hk6.js +1 -0
  104. package/dist/chunk-rooms-menu-button-32hemzxc.js +1 -0
  105. package/dist/chunk-schedules-64h9gfwn.js +1 -0
  106. package/dist/{chunk-seat-menu-ys5v9abz.js → chunk-seat-menu-vrpc40v9.js} +1 -1
  107. package/dist/chunk-sheet-hosts-jaqx490x.js +1 -0
  108. package/dist/chunk-shortcut-help-bdbkdcs9.js +26 -0
  109. package/dist/chunk-shortcuts-qft33r8t.js +1 -0
  110. package/dist/chunk-skill-editor-z3dx2895.js +8 -0
  111. package/dist/chunk-skills-4jfcv39n.js +1 -0
  112. package/dist/chunk-switcher-list-xysjd4tw.js +1 -0
  113. package/dist/{chunk-tab-dot-r6brdbmw.js → chunk-tab-dot-1p68ybf8.js} +1 -1
  114. package/dist/chunk-table-0v4q4dx3.js +1 -0
  115. package/dist/chunk-table-seats-f683hx8k.js +1 -0
  116. package/dist/chunk-table2d-1a6atjhj.js +1 -0
  117. package/dist/chunk-table3d-k0ffeffj.js +4220 -0
  118. package/dist/chunk-thread-actions-4rpfg4fq.js +1 -0
  119. package/dist/chunk-thread-cards-t794fp4d.js +1 -0
  120. package/dist/chunk-thread-list-1pcygpka.js +1 -0
  121. package/dist/chunk-transcript-km4e3aey.js +1 -0
  122. package/dist/chunk-where-phjwqggy.js +1 -0
  123. package/dist/chunk-workspace-d064v56e.js +578 -0
  124. package/dist/chunk-zh-tw-qf18hcxc.js +1 -0
  125. package/dist/index.html +1 -2
  126. package/dist/sw.js +1 -1
  127. package/package.json +2 -2
  128. package/src/api-types.ts +27 -0
  129. package/src/app/api-http.ts +1 -1
  130. package/src/app/routes.ts +158 -3
  131. package/src/app/surface-threads.ts +1 -1
  132. package/src/app/surface.ts +2 -1
  133. package/src/app/threads.ts +31 -0
  134. package/src/auth/authenticator.ts +8 -1
  135. package/src/auth/sessions.ts +10 -3
  136. package/src/host/host-app.ts +15 -1
  137. package/src/host/read-all.ts +80 -0
  138. package/src/host/reads.ts +67 -0
  139. package/src/i18n/zh-tw.ts +110 -79
  140. package/src/options.ts +1 -1
  141. package/src/web-plugin.ts +12 -1
  142. package/dist/chunk-account-ghq105t4.js +0 -1
  143. package/dist/chunk-action-menu-me0g9qsc.js +0 -1
  144. package/dist/chunk-arranged-rooms-81rqhx9x.js +0 -1
  145. package/dist/chunk-character-creator-bd426yjw.js +0 -1
  146. package/dist/chunk-confirm-p3mts8mx.js +0 -1
  147. package/dist/chunk-connectors-bkv3xn83.js +0 -1
  148. package/dist/chunk-conversations-0e0vbxwr.js +0 -1
  149. package/dist/chunk-entry-mv7q8br0.js +0 -1
  150. package/dist/chunk-folder-list-era3tksh.js +0 -1
  151. package/dist/chunk-folds-hvws0bd5.js +0 -1
  152. package/dist/chunk-gate-hc7dd0fx.js +0 -1
  153. package/dist/chunk-group-scene-dkbpmbh5.js +0 -1
  154. package/dist/chunk-group-table-fqmxgdfw.js +0 -1
  155. package/dist/chunk-host-icons-4xde9ntk.js +0 -1
  156. package/dist/chunk-host-picture-014yzk20.js +0 -1
  157. package/dist/chunk-host-state-t56e5sdy.js +0 -1
  158. package/dist/chunk-host-ui-p1zy9nmp.js +0 -1
  159. package/dist/chunk-index-4t0r3t3b.js +0 -2
  160. package/dist/chunk-index-6twb7ccd.js +0 -2
  161. package/dist/chunk-index-7xffskfa.js +0 -8
  162. package/dist/chunk-index-aqw7cy5j.js +0 -1
  163. package/dist/chunk-index-b6ca02e8.js +0 -2
  164. package/dist/chunk-index-b8nvhcx5.js +0 -2
  165. package/dist/chunk-index-gr6e0hse.js +0 -2
  166. package/dist/chunk-index-j214tczc.js +0 -1
  167. package/dist/chunk-index-jd6632ef.js +0 -2
  168. package/dist/chunk-index-jw7dtshr.js +0 -2
  169. package/dist/chunk-index-mmg788a1.js +0 -2
  170. package/dist/chunk-index-mq0dacwr.js +0 -2
  171. package/dist/chunk-index-p53ak25v.js +0 -2
  172. package/dist/chunk-index-rbcz9jd4.css +0 -1
  173. package/dist/chunk-index-rnxj3z8k.js +0 -2
  174. package/dist/chunk-index-v3bmr0nw.js +0 -2
  175. package/dist/chunk-index-wrm8w165.js +0 -2
  176. package/dist/chunk-index-xh0mg9cw.js +0 -2
  177. package/dist/chunk-index-ybtvvx85.js +0 -2
  178. package/dist/chunk-index-zynq0b0w.js +0 -50
  179. package/dist/chunk-lang-css-88v3hp3d.js +0 -1
  180. package/dist/chunk-lang-html-07d47es4.js +0 -1
  181. package/dist/chunk-lang-javascript-fmhhgzwd.js +0 -1
  182. package/dist/chunk-lang-typescript-etjjvr2g.js +0 -1
  183. package/dist/chunk-layout-actions-48ecgtkg.js +0 -1
  184. package/dist/chunk-menu-items-1epy3h0t.js +0 -2
  185. package/dist/chunk-mode-toggle-fxmfxsa4.js +0 -1
  186. package/dist/chunk-notes-yb8f057c.js +0 -1
  187. package/dist/chunk-notice-bell-wr4f1rph.js +0 -1
  188. package/dist/chunk-notices-x07da5bb.js +0 -1
  189. package/dist/chunk-onboarding-csrkbh9z.js +0 -1
  190. package/dist/chunk-overview-avc2d30t.js +0 -1
  191. package/dist/chunk-palette-9nhp95bz.js +0 -1
  192. package/dist/chunk-placement-items-q694dpgk.js +0 -1
  193. package/dist/chunk-profile-6qemf3m7.js +0 -1
  194. package/dist/chunk-prompt-history-7enzp2p3.js +0 -1
  195. package/dist/chunk-prompts-nv6mrn0q.js +0 -1
  196. package/dist/chunk-room-confirms-zz7n61y7.js +0 -1
  197. package/dist/chunk-room-menu-rr6nzap1.js +0 -1
  198. package/dist/chunk-rooms-menu-button-zbtwj47d.js +0 -1
  199. package/dist/chunk-schedules-rw57nr0m.js +0 -1
  200. package/dist/chunk-sheet-hosts-jhvaacst.js +0 -1
  201. package/dist/chunk-skill-editor-sz8an8qr.js +0 -8
  202. package/dist/chunk-skills-tnr1h16h.js +0 -1
  203. package/dist/chunk-switcher-list-17enhrse.js +0 -1
  204. package/dist/chunk-table-r12cja6p.js +0 -1
  205. package/dist/chunk-table-seats-g3t392zz.js +0 -1
  206. package/dist/chunk-table2d-p3ezsdcj.js +0 -1
  207. package/dist/chunk-table3d-4x2n2b00.js +0 -4220
  208. package/dist/chunk-thread-actions-qc6ezkha.js +0 -1
  209. package/dist/chunk-transcript-n2s6dher.js +0 -1
  210. package/dist/chunk-where-f3scdydc.js +0 -1
  211. package/dist/chunk-workspace-xs023bxm.js +0 -1
  212. package/dist/chunk-zh-tw-efvmk3fd.js +0 -1
@@ -0,0 +1 @@
1
+ import{Rr,Er,Cr}from"./chunk-index-xbs8q4kn.js";import"./chunk-index-xxbveevc.js";export{Er as clearAcross,Cr as clearFinished,Rr as dismissThread};
@@ -0,0 +1 @@
1
+ import{t,Se,fe,hn,Go,$n,Di}from"./chunk-index-kankja6p.js";import{Rr,Cr}from"./chunk-index-xbs8q4kn.js";import{lr}from"./chunk-index-1fn8q4ps.js";import"./chunk-index-xxbveevc.js";var E=12,R=24,y=180,L=150,C=100,w=".thread-card",h=".thread-group",g=(e)=>e instanceof Element?e.closest(w):null,B=(e)=>e.closest("li"),m=(e)=>e.dataset.closed==="",I=(e)=>new Promise((i)=>setTimeout(i,e));function X(e){return[...e.closest(h)?.querySelectorAll(`${w}[data-closed]`)??[]].flatMap((n)=>n.dataset.thread?[n.dataset.thread]:[])}function q(e){let i=B(e);if(delete e.dataset.armed,e.style.transition="",e.style.transform="",e.style.opacity="",i)i.style.transition="",i.style.height="",i.style.marginBottom="",i.style.opacity=""}async function F(e){let i=B(e);if(!i||Se())return;e.dataset.leaving="",e.style.transition=`transform ${y}ms var(--ease-out), opacity ${y}ms var(--ease-out)`,e.style.transform="translate3d(110%, 0, 0)",e.style.opacity="0",await I(y),i.style.height=`${i.offsetHeight}px`,i.getBoundingClientRect(),i.style.transition=`height ${L}ms var(--ease-out), margin-bottom ${L}ms var(--ease-out)`,i.style.height="0px",i.style.marginBottom="calc(var(--space-1) * -1)",await I(L)}function _(e){let i=[...e.closest(h)?.querySelectorAll(`${w} .thread-link`)??[]],n=e.querySelector(".thread-link"),o=n?i.indexOf(n):-1;if(document.activeElement&&!e.contains(document.activeElement))return;(i[o+1]??i[o-1]??e.closest(h)?.querySelector("summary"))?.closest("a, summary")?.focus()}async function T(e){let i=e.dataset.thread;if(!i||!m(e)||e.dataset.leaving!==void 0)return;if(_(e),await F(e),!await Rr(i))q(e);delete e.dataset.leaving}function M(e,i,n){let o=[];if(m(e))o.push({id:"clear",label:t("Clear this thread"),icon:"trash",tone:"danger",run:()=>T(e)});let l=X(e),f=e.closest(h)?.dataset.parent||void 0;if(l.length>0)o.push({id:"clear-all",label:t("Clear all finished"),icon:"trash",tone:"danger",run:()=>Cr(f,l)});fe({title:e.querySelector(".thread-title")?.textContent??"",items:o,at:i,via:n,source:e.querySelector(".thread-link")??e})}var O=(e)=>{if(e.cancelable)e.preventDefault()};function W(e,i){let n=e.at(-1);if(!n||i-n.t>C)return 0;let o=e.find((l)=>n.t-l.t<=C);if(!o||n.t<=o.t)return 0;return(n.x-o.x)/(n.t-o.t)}function z(e){let i=lr(),n,o=!1,l=()=>{n?.press.cancel(),window.removeEventListener("touchmove",O),n=void 0},f=(s)=>{if(o=!1,s.pointerType==="mouse"||!s.isPrimary)return;let r=g(s.target);if(!r||s.target.closest(".thread-more"))return;l();let a={x:s.clientX,y:s.clientY},c=new hn((d)=>{if(o=!0,typeof navigator.vibrate==="function")navigator.vibrate(10);if(n)n.state="reject";v(r),M(r,d,"hold")});c.begin(a.x,a.y),n={id:s.pointerId,card:r,origin:a,press:c,swipes:!$n(a.x,window.innerWidth),state:"wait",offset:0,samples:[{x:a.x,t:s.timeStamp}]}},v=(s)=>{if(s.dataset.leaving!==void 0)return;delete s.dataset.armed,s.style.transition=`transform ${Se()?0:y}ms var(--ease-out)`,s.style.transform=""},x=(s)=>{if(!n||n.id!==s.pointerId)return;let{card:r}=n,a=s.clientX-n.origin.x,c=s.clientY-n.origin.y;if(n.state==="wait"){n.press.move(s.clientX,s.clientY);let p=Math.abs(a);if(!n.swipes)return;if(p>=E&&p>Go*Math.abs(c)){if(n.state=a>0?"drag":"reject",n.state==="drag")n.press.cancel(),r.style.transition="none",window.addEventListener("touchmove",O,{passive:!1})}else if(Math.abs(c)>=E)n.state="reject";if(n.state!=="drag")return}if(n.state!=="drag")return;let d=Math.max(0,a-E),u=r.offsetWidth||1;if(n.offset=m(r)?Math.min(d,u):Math.min(R,d*0.3),n.samples.push({x:s.clientX,t:s.timeStamp}),r.style.transform=`translate3d(${n.offset}px, 0, 0)`,m(r))if(Di(n.offset/u,0))r.dataset.armed="";else delete r.dataset.armed},H=(s)=>{if(!n||n.id!==s.pointerId)return;let{card:r,state:a,offset:c,samples:d}=n,u=n.press.end();if(l(),u)o=!0;if(a!=="drag")return;o=!0;let p=r.offsetWidth||1,A=W(d,s.timeStamp);if(m(r)&&c>E&&Di(c/p,A))T(r);else v(r)},b=(s)=>{if(!n||n.id!==s.pointerId)return;let{card:r,state:a}=n;if(l(),a==="drag")v(r)},S=(s)=>{let r=g(s.target);if(!r)return;if(s.preventDefault(),o)return;n?.press.cancel(),M(r,{x:s.clientX,y:s.clientY},"contextmenu")},P=(s)=>{o=!1;let r=g(s.target);if(!r)return;if(s.key==="Delete"&&m(r))s.preventDefault(),T(r);else if(s.key==="ContextMenu"||s.key==="F10"&&s.shiftKey){s.preventDefault();let a=r.getBoundingClientRect();M(r,{x:a.left+Math.min(a.width/2,48),y:a.top+24},"key")}},k=(s)=>{if(!o)return;o=!1,s.preventDefault(),s.stopPropagation()},D=(s)=>{if(g(s.target))s.preventDefault()};return e.addEventListener("pointerdown",f),e.addEventListener("pointermove",x),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",b),e.addEventListener("contextmenu",S),e.addEventListener("keydown",P),e.addEventListener("click",k,!0),e.addEventListener("dragstart",D),()=>{l(),i(),e.removeEventListener("pointerdown",f),e.removeEventListener("pointermove",x),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",b),e.removeEventListener("contextmenu",S),e.removeEventListener("keydown",P),e.removeEventListener("click",k,!0),e.removeEventListener("dragstart",D)}}export{z as attachThreadCards,M as openCardMenu};
@@ -0,0 +1 @@
1
+ import{h,J,s,a,t,te,e,n,o,v,d,_,Pe,ne,Li,We,yn,Ln,Xn,Ht}from"./chunk-index-kankja6p.js";var k=J(function(i){let{view:l,parent:p}=i,u=Li(l.key),f=Boolean(l.closed);return n("li",{className:"thread-item",children:[f?n("span",{className:"thread-reveal","aria-hidden":"true",children:[e(o,{name:"trash",size:18}),t("Clear")]}):null,n("div",{className:"thread-card","data-hold":"row","data-thread":l.key,"data-closed":f?"":void 0,style:u,children:[n("a",{className:"thread-link",href:v("room",l.key),"aria-current":i.active?"page":void 0,children:[p?e(We,{view:p,size:36}):e(o,{name:"conversations",size:20,className:"thread-row-icon"}),n("span",{className:"thread-card-main",children:[n("span",{className:"thread-card-top",children:[e("strong",{className:"thread-title",children:l.displayName}),e(yn,{room:l.key}),e("span",{className:"room-row-time",children:i.at?Pe(i.at,i.now,i.timeZone):""})]}),n("span",{className:"thread-card-meta",children:[i.typing?e(Ln,{}):null,e("span",{className:f?"badge":"badge badge-accent",children:f?t("Finished"):t("In progress")}),i.waiting?e(Xn,{count:i.waiting}):null]})]})]}),f?e("button",{type:"button",className:"thread-more","aria-haspopup":"menu","aria-label":t("More actions for {name}",{name:l.displayName}),onClick:(N)=>{let g=N.currentTarget,y=g.closest(".thread-card"),r=g.getBoundingClientRect();if(y)(h("t794fp4d"),import("./chunk-thread-cards-t794fp4d.js")).then((c)=>c.openCardMenu(y,{x:r.right,y:r.bottom},"key"))},children:e(o,{name:"more",size:18})}):null]})]})});function C(m){let{now:i}=ne(),{timeZone:l}=_(),p=Ht(m.open),u=Ht(m.closed),f=d((r)=>m.parent?r.rooms[m.parent]?.view:void 0,m.parent??""),N=a(null),g=p.length+u.length>0;if(s(()=>{let r=N.current;if(!g||!r)return;let c=!1,w;return (h("t794fp4d"),import("./chunk-thread-cards-t794fp4d.js")).then((b)=>{if(!c)w=b.attachThreadCards(r)}),()=>{c=!0,w?.()}},[g]),!g)return null;let y=({key:r,...c})=>e(k,{...c,active:r===m.active,now:i,timeZone:l,parent:f},r);return n("div",{className:"thread-group",ref:N,"data-parent":m.parent,children:[p.length?e("ul",{className:"thread-list","aria-label":t("Dispatch threads"),children:p.map(y)}):null,u.length?n("div",{className:"thread-finished",children:[n("details",{className:"thread-closed",...u.some((r)=>r.key===m.active)?{open:!0}:{},children:[e("summary",{children:te(u.length,"{count} finished thread","{count} finished threads")}),e("ul",{className:"thread-list",children:u.map(y)})]}),e("button",{type:"button",className:"thread-clear",onClick:()=>(h("4rpfg4fq"),import("./chunk-thread-actions-4rpfg4fq.js")).then((r)=>r.clearFinished(m.parent,u.map((c)=>c.key))),children:t("Clear finished")})]}):null]})}export{C as default};
@@ -0,0 +1 @@
1
+ import{s,A,a,r,t,c,g,e,n,v,O,w,m,k,P,_,ie,ci}from"./chunk-index-kankja6p.js";import{ye}from"./chunk-index-wc83vb0a.js";import{Ue}from"./chunk-index-jq970hsd.js";function U({conversationKey:o}){let[p,y]=r(),u=A(),d=a(!1),{data:i,error:h}=ye(()=>O.transcript(o,p),`${o}|${p??""}`);s(()=>{if(i&&!d.current)d.current=!0,window.scrollTo(0,document.body.scrollHeight)},[i]);let N=n("a",{className:"back",href:v("conversations"),children:["← ",t("Conversations")]});if(!i)return n(g,{children:[N,h?e(m,{message:h}):e(w,{})]});let{conversation:f}=i,T=f.kind==="outside"?t("Outside AI client · {id}",{id:f.id.slice(0,8)}):ci(f);return n(g,{children:[N,n("section",{className:"stack",children:[n("div",{className:"card-head",children:[e("h2",{children:T}),f.busy>0?e(P,{tone:"busy",children:t("running")}):null]}),i.archives.length>0?n("label",{className:"inline",htmlFor:u,children:[t("Showing")," ",n(Ue,{id:u,value:p??"",onChange:(l)=>{d.current=!1,y(l.target.value||void 0)},children:[e("option",{value:"",children:t("Current conversation")}),i.archives.map((l)=>e("option",{value:l,children:t("Archived {name}",{name:l})},l))]})]}):null,h?e(m,{message:h}):null,i.truncated?e("p",{className:"hint",children:t("This conversation is longer than the console reads; the oldest entries are not shown.")}):null,i.entries.length===0?e(k,{children:t("Nothing to show.")}):null,e("ol",{className:"transcript",children:i.entries.map((l,E)=>e(b,{entry:l},E))})]})]})}function b({entry:o}){let{timeZone:p}=_(),y=o.at?ie(o.at,p):"";if(o.role==="tool")return e("li",{className:"entry entry-tool",children:n("details",{children:[n("summary",{children:[o.failed?t("Tool failed"):t("Tool result"),o.tool?` · ${o.tool}`:""]}),e("pre",{children:o.text||t("(empty)")})]})});return n("li",{className:`entry entry-${o.role}`,children:[n("div",{className:"entry-head",children:[e("span",{className:"role",children:t(S[o.role])}),e("span",{className:"meta",children:y})]}),o.text?e("p",{className:"text",children:o.text}):null,o.calls?.map((u,d)=>n("code",{className:"call",children:[u.name," ",u.preview]},d))]})}var S={user:c("User"),assistant:c("Knight"),tool:c("Tool"),compaction:c("Summary of earlier conversation")};export{U as TranscriptPage};
@@ -0,0 +1 @@
1
+ import{Tn,tr}from"./chunk-index-84wbc80d.js";export{Tn as currentQuery,tr as followUrl};
@@ -0,0 +1,578 @@
1
+ import{h,an,X,be,s,A,Fe,N,a,r,t,c,g,e,n,o,v,si,F,Ci,le,f,u,p,w,m,k,P,_,ie,Qe,Me}from"./chunk-index-kankja6p.js";import{K}from"./chunk-index-3wbyq10m.js";import{tn,Ue}from"./chunk-index-jq970hsd.js";import{de}from"./chunk-index-j479p62w.js";import{L}from"./chunk-index-47yspxa4.js";function st(i,d,l){let[y,b]=r();s(()=>{if(!i)return;let E=(x)=>x.preventDefault(),M=(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(d.current?.contains(T))return;x.preventDefault(),x.stopPropagation(),b({kind:"link",anchor:T})},R=si((x)=>b({kind:"navigate",proceed:x}));return window.addEventListener("beforeunload",E),document.addEventListener("click",M,!0),()=>{R(),window.removeEventListener("beforeunload",E),document.removeEventListener("click",M,!0)}},[i,d]);let C=X(()=>b(void 0),[]),S=X(()=>{let E=y;if(l(),b(void 0),E?.kind==="link")setTimeout(()=>E.anchor.click(),0);else if(E?.kind==="navigate")E.proceed()},[y,l]);return{leaving:y,stay:C,leave:S}}var oe=(i)=>`workspace/${encodeURIComponent(i)}`,xe=(i)=>`path=${encodeURIComponent(i)}`,Xe=(i)=>({body:JSON.stringify(i)});function Ae(i){if(!(i instanceof le)||i.status!==409)return;let d=i.body;return d?.conflict==="changed"||d?.conflict==="gone"||d?.conflict==="exists"?d:void 0}var j={roots:()=>f("workspace"),list:(i,d)=>f(`${oe(i)}/list?${xe(d)}`),file:(i,d)=>f(`${oe(i)}/file?${xe(d)}`),save:(i,d,l,y)=>f(`${oe(i)}/file?${xe(d)}`,{method:"PUT",...Xe({text:l,baseHash:y})}),create:(i,d,l,y)=>f(`${oe(i)}/new?${xe(d)}`,{method:"POST",...Xe({kind:l,...y===void 0?{}:{text:y}})}),rename:(i,d,l)=>f(`${oe(i)}/rename`,{method:"POST",...Xe({from:d,to:l})}),remove:(i,d)=>f(`${oe(i)}/entry?${xe(d)}`,{method:"DELETE"}),trash:(i)=>f(`${oe(i)}/trash`),restore:(i,d)=>f(`${oe(i)}/trash/${encodeURIComponent(d)}/restore`,{method:"POST"}),purge:(i,d)=>f(`${oe(i)}/trash/${encodeURIComponent(d)}`,{method:"DELETE"})},he=(i,d,l=!1)=>`api/${oe(i)}/raw?${xe(d)}${l?"&download=1":""}`;var Re=(i)=>i.split("/").filter(Boolean),we=(i)=>Re(i).slice(0,-1).join("/"),Ne=(i,d)=>i?`${i}/${d}`:d,Te=(i)=>`${i.root}:${i.path}${i.dir&&i.path?"/":""}`;function dt(i){if(!i)return;let d=i.indexOf(":");if(d<1)return;let l=i.slice(d+1);return{root:i.slice(0,d),path:l.replace(/\/+$/,""),dir:l===""||l.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 ve(i){let{name:d,size:l=20,className:y}=i;if(!Nt(d))return e(o,{name:d,size:l,...y?{className:y}:{}});return e("svg",{viewBox:"0 0 24 24",width:l,height:l,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...y?{className:y}:{},children:e("path",{d:ct[d]})})}function Ye(i){return n("div",{className:"ws-media-actions",children:[i.open?e("a",{className:"button-link",href:he(i.root,i.path),target:"_blank",rel:"noopener",children:t("Open")}):null,n("a",{className:"button-link",href:he(i.root,i.path,!0),download:i.name,children:[e(o,{name:"download",size:18}),t("Download")]})]})}function _e(i){let d=i.name.lastIndexOf("."),l=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(o,{name:"file",size:32})}),e("strong",{children:i.name}),e("span",{className:"meta",children:[l,Qe(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:d,root:l,path:y,name:b,bytes:C,phone:S,onFacts:E}=i,[M,R]=r(!1),[x,T]=r(!1);s(()=>(R(!1),T(!1),E(void 0),()=>E(void 0)),[l,y]);let D=he(l,y);if(M)return e(_e,{root:l,path:y,name:b,bytes:C,message:t("This browser cannot show this file.")});switch(d){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((O)=>!O),children:e("img",{src:D,alt:b,onLoad:(O)=>{let{naturalWidth:Q,naturalHeight:q}=O.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:D,title:b}),e(Ye,{root:l,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 · ",Qe(C)]}),e(Ye,{root:l,path:y,name:b,open:!0})]})});case"audio":return e("div",{className:"ws-media ws-sound",children:e("audio",{controls:!0,preload:"metadata",src:D,onError:()=>R(!0)})});case"video":return e("div",{className:"ws-media ws-film",children:e("video",{controls:!0,playsInline:!0,preload:"metadata",src:D,onLoadedMetadata:(O)=>{let{videoWidth:Q,videoHeight:q}=O.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,d){try{let l=localStorage.getItem(i);return l===null?d:JSON.parse(l)}catch{return d}}function He(i,d){try{localStorage.setItem(i,JSON.stringify(d))}catch{}}var Le=an({rev:0,bump:()=>{return}});tn("workspace",lt);var Ce=new Map,St=200;function Rt(i,d){Ce.delete(i),Ce.set(i,d);let l=Ce.keys().next().value;if(Ce.size>St&&l!==void 0)Ce.delete(l)}function gt(i,d,l=!0){let{rev:y}=be(Le),[b,C]=r(0),[S,E]=r({key:"",root:i,path:d}),M=`${i}:${d}`;if(s(()=>{let x=()=>C((T)=>T+1);return window.addEventListener("focus",x),()=>window.removeEventListener("focus",x)},[]),s(()=>{if(!l)return;let x=!0;return j.list(i,d).then((T)=>{if(Rt(M,T),x)E({key:M,root:i,path:d,data:T})},(T)=>x&&E({key:M,root:i,path:d,error:u(T)})),()=>{x=!1}},[i,d,l,y,b]),S.key===M)return{data:S.data,error:S.error,at:S};let R=Ce.get(M);if(R)return{data:R,at:{root:i,path:d}};if(S.data)return{data:S.data,at:S,pending:!0};return{}}var Ee=(i)=>v("workspace",Te(i));function et(i,d,l){let y=Ne(d,l.name);if(l.kind==="dir")return{root:i,path:y,dir:!0};if(l.kind==="file")return{root:i,path:y,dir:!1};if(l.kind==="symlink"&&l.inside)return{root:i,path:y,dir:l.target==="dir"};return}function Tt(i){let d=Re(i.path),l=a(null);return s(()=>{l.current?.scrollIntoView?.({inline:"end",block:"nearest"})},[i.path]),n("nav",{className:"ws-crumbs","aria-label":t("Path"),children:[e("a",{ref:d.length===0?l:void 0,href:Ee({root:i.root.id,path:"",dir:!0}),"aria-current":d.length===0?"page":void 0,children:Ge(i.root)}),d.map((y,b)=>{let C=d.slice(0,b+1).join("/"),S=b===d.length-1;return e("a",{ref:S?l: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:d,error:l,pending:y}=gt(i.root,i.path);if(l)return e("p",{className:"ws-tree-note",children:l});if(!d||y)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((b)=>{let C=et(i.root,i.path,b),S=Ne(i.path,b.name),E=C?.dir===!0,M=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":M,"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(ve,{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})]})]}),M?e(ht,{root:i.root,path:S,depth:i.depth+1,open:i.open,toggle:i.toggle,current:i.current}):null]},b.name)}),d.truncated?e("li",{className:"ws-tree-note",children:t("Only the first 2,000 items are listed")}):null]})}function Lt(i){let{data:d,error:l,at:y,pending:b}=gt(i.root.id,i.path),{timeZone:C}=_(),S=a(null),E=y?.root??i.root.id,M=y?.path??i.path;if(Fe(()=>{S.current?.closest(".ws-main")?.scrollTo?.(0,0)},[E,M]),l)return e(m,{message:l});if(!d)return e(w,{});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: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:d.entries.map((R)=>{let x=et(E,M,R),T=n(g,{children:[e(ve,{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:Qe(R.size),ie(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)})}),d.truncated?e("p",{className:"meta",children:t("Only the first 2,000 items are listed")}):null]})}function Wt(i){let{timeZone:d}=_(),{bump:l}=be(Le),{root:y,path:b}=i,[C,S]=r(),[E,M]=r(),[R,x]=r("read"),[T,D]=r(!1),[O,Q]=r(!1),[q,Ke]=r(()=>Je(ft,i.phone)),[We,ee]=r(!1),[Se,ke]=r(),[I,V]=r(!1),[Y,ue]=r(!1),[ze,Be]=r(!1),[me,se]=r(),[U,fe]=r(),[ye,De]=r(),pe=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||I),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&&M(u(B))),()=>{W=!1}},[y.id,b]);let je=st(T,z,()=>{let W=ae.current;if(W?.text!==void 0)H.current?.replace(W.text,W.eol);D(!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 ce=ae.current,J=H.current;if(!ce||!J||O)return;let te=B===void 0?J.snapshot():void 0,Ve=B??J.text();Q(!0);try{let ne=await j.save(y.id,b,Ve,W??ce.hash);J.markSaved(te),D(J.dirty()),se(void 0),S({...ce,hash:ne.hash,size:ne.size,mtimeMs:ne.mtimeMs,text:Ve}),p(t("Saved")),l()}catch(ne){let re=Ae(ne);if(re)fe({kind:re.conflict==="gone"?"gone":"changed",...re.current?{hash:re.current.hash}:{},text:Ve});else p(u(ne),"danger")}finally{Q(!1)}},[y.id,b,O,l]),nt=a(Pe);nt.current=Pe;let ge=X(async()=>{try{let W=await tt();if(W.text!==void 0)H.current?.replace(W.text,W.eol);D(!1),se(void 0),fe(void 0)}catch(W){p(u(W),"danger")}},[tt]),wt=a(ge);wt.current=ge;let qe=X(()=>{if(H.current?.dirty()){at(!0);return}x("read")},[]),[vt,at]=r(!1),rt=a(qe);rt.current=qe,s(()=>{if(!Oe||!pe.current)return;let W=ae.current;if(!W||W.text===void 0)return;let B=!1,ce;return (h("6xavqntt"),import("./chunk-codeeditor-6xavqntt.js")).then(async({createEditor:J})=>{if(B||!pe.current)return;let te=await J({parent:pe.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:()=>D(te.dirty()),onSave:()=>{if(Z.current==="edit"&&te.dirty())nt.current()},onEscape:()=>{if(Z.current==="edit")rt.current()}});if(B){te.destroy();return}ce=te,H.current=te,ue(!0)}).catch((J)=>{if(console.warn("the editor failed to load",J),!B)Be(!0)}),()=>{B=!0,ce?.destroy(),H.current=void 0,ue(!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),He(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 re=await j.file(y.id,b);if(re.hash!==te.hash){if(S(re),re.text!==void 0)H.current?.replace(re.text,re.eol)}se(void 0)}catch{}finally{W=!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)}},[ot,y.id,b,G]),E)return e("div",{className:"ws-file",children:e(m,{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:()=>{V(!0),x("edit")},children:t("Edit")}):null,Ie?n(g,{children:[e("button",{type:"button",disabled:O||!T,onClick:()=>void Pe(),children:t("Save")}),e("button",{type:"button",className:"secondary",onClick:qe,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:[Qe(C.size),Se?` · ${Se}`:""," ·"," ",ie(new Date(C.mtimeMs).toISOString(),d)]})]}),bt,kt]}),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 ge(),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:pe,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:O||!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:he(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),ge()},children:[e("span",{className:"menu-icon",children:e(o,{name:"refresh"})}),e("span",{className:"menu-text",children:e("strong",{children:t("Reload")})})]})})]})})}),e(de,{open:U!==void 0,title:U?.kind==="gone"?t("This file is gone"):t("This file changed while you were editing"),onClose:()=>fe(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(()=>p(t("Copied")))},children:t("Copy my text")}),U?.kind==="changed"?e("button",{type:"button",className:"secondary",onClick:()=>void ge(),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;fe(void 0),j.create(y.id,b,"file",W).then(async()=>{await ge(),l()}).catch((B)=>p(u(B),"danger"));return}De({hash:U.hash??"",text:U.text}),fe(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 ge(),p(t("Saved")),l()},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);D(!1),x("read")},children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})}),e(K,{open:je.leaving!==void 0,title:t("Unsaved changes, leave?"),confirmLabel:t("Discard"),cancelLabel:t("Keep editing"),tone:"danger",onClose:je.stay,onConfirm:async()=>je.leave(),children:e("p",{children:t("Your edits to {name} have not been saved.",{name:G})})})]})}function zt(i){let{ask:d}=i,[l,y]=r(""),[b,C]=r(),[S,E]=r(!1),M=A();s(()=>{y(d?.kind==="rename"?d.name:""),C(void 0)},[d]);let R=d?.kind==="rename"?t("Rename"):d?.kind==="dir"?t("New folder"):t("New file"),x=async(T)=>{if(T.preventDefault(),!d)return;let D=l.trim();if(!D||D.includes("/")){C(t("Use a name without slashes."));return}E(!0),C(void 0);try{if(d.kind==="rename"){let O=Ne(we(d.path),D);await j.rename(i.root.id,d.path,O),p(t("Renamed")),i.onDone()}else{let O=Ne(d.dir,D);await j.create(i.root.id,O,d.kind),p(t("Created")),i.onDone({root:i.root.id,path:O,dir:d.kind==="dir"})}}catch(O){let Q=Ae(O);C(Q?.conflict==="exists"?t("Something with that name is already there."):u(O))}finally{E(!1)}};return e(de,{open:d!==void 0,title:R,onClose:i.onClose,children:n("form",{className:"stack",onSubmit:x,children:[e("label",{htmlFor:M,children:t("Name")}),e("input",{id:M,value:l,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:(T)=>y(T.target.value)}),b?e(m,{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||!l.trim(),children:d?.kind==="rename"?t("Rename"):t("Create")})]})]})})}function Mt(i){let{bump:d,rev:l}=be(Le),[y,b]=r(),[C,S]=r(),[E,M]=r(),{timeZone:R}=_();return s(()=>{if(!i.open)return;let x=!0;return j.trash(i.root.id).then((T)=>x&&b(T.items),(T)=>x&&S(u(T))),()=>{x=!1}},[i.open,i.root.id,l]),n(de,{open:i.open,title:t("Trash"),onClose:i.onClose,children:[n("div",{className:"stack",children:[C?e(m,{message:C}):null,!y&&!C?e(w,{}):null,y?.length===0?e(k,{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(ve,{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:ie(x.deletedAt,R)})]})]}),e("button",{type:"button",className:"secondary",onClick:async()=>{try{await j.restore(i.root.id,x.id),p(t("Restored")),d()}catch(T){let D=Ae(T);p(D?D.conflict==="exists"?t("Something with that name is already there."):t("The folder it was in is gone."):u(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:()=>M(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:()=>M(void 0),onConfirm:async()=>{if(!E)return;await j.purge(i.root.id,E.id),d()},children:e("p",{children:t("“{name}” will be removed and cannot be brought back.",{name:E?.path??""})})})]})}function yn(){let i=Ci(),d=!Me("(min-width: 720px)"),[l,y]=r(0),b=X(()=>y((z)=>z+1),[]),C=N(()=>({rev:l,bump:b}),[l,b]),[S,E]=r(),[M,R]=r();s(()=>{j.roots().then((z)=>E(z.roots),(z)=>R(u(z)))},[]);let[x,T]=r(()=>Je(mt,280)),[D,O]=r(),[Q,q]=r(),[Ke,We]=r(!1),[ee,Se]=r(),ke=dt(i.key),I=S?.find((z)=>z.id===ke?.root)??(d?void 0:S?.[0]),V=I?ke&&ke.root===I.id?ke:{root:I.id,path:"",dir:!0}:void 0,Y=I?.id,ue=V?.path,ze=V?.dir,[Be,me]=r(new Set);s(()=>{if(!Y)return;me(new Set(Je(Ze(Y),[])))},[Y]);let se=X((z)=>{if(!Y)return;me((ae)=>{let Z=new Set(ae);if(Z.has(z))Z.delete(z);else Z.add(z);return He(Ze(Y),[...Z]),Z})},[Y]);if(s(()=>{if(!Y||ue===void 0||d)return;let z=Re(ze?ue:we(ue)),ae=z.map((Z,G)=>z.slice(0,G+1).join("/"));me((Z)=>{if(ae.every(($e)=>Z.has($e)))return Z;let G=new Set([...Z,...ae]);return He(Ze(Y),[...G]),G})},[Y,ue,ze,d]),M)return e(m,{message:M});if(!S)return e(w,{});if(S.length===0)return e(k,{children:t("No files yet")});if(!I||!V)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(ve,{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=V.dir?V.path:we(V.path),fe=V.path===""?{root:I.id,path:"",dir:!0}:{root:I.id,path:we(V.path),dir:!0},ye=n("header",{className:"ws-head",children:[d?e("a",{className:"icon-button","aria-label":t("Back"),href:V.path===""?v("workspace"):Ee(fe),children:e(o,{name:"back"})}):e(Ue,{chip:!0,className:"ws-root-picker","aria-label":t("Place"),value:I.id,onChange:(z)=>F("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:I,path:V.path}),I.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(ve,{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(ve,{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=V.dir?e("div",{className:"ws-dir",children:e(Lt,{root:I,path:V.path,onMenu:(z)=>O(z)})}):e(Wt,{root:I,path:V.path,phone:d},`${I.id}:${V.path}`),pe=D?et(I.id,U,D):void 0,H=D?Ne(U,D.name):"";return n(Le.Provider,{value:C,children:[n("div",{className:"ws-page ws","data-wide":!d||void 0,style:{"--ws-tree":`${x}px`},children:[ye,n("div",{className:"ws-body",children:[!d?n(g,{children:[e("aside",{className:"ws-tree","aria-label":t("Folders"),children:e(ht,{root:I.id,path:"",depth:0,open:Be,toggle:se,current:V})}),e(Dt,{width:x,onChange:(z)=>{T(z),He(mt,z)}})]}):null,e("section",{className:"ws-main",children:De})]})]}),e(L,{open:D!==void 0,title:D?.name??"",onClose:()=>O(void 0),children:n("ul",{className:"more-list",children:[pe&&!pe.dir?e("li",{children:n("a",{className:"menu-item menu-link",href:he(I.id,H,!0),download:D?.name,onClick:()=>O(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,I.writable&&D?n(g,{children:[e("li",{children:n("button",{type:"button",className:"menu-item",onClick:()=>{q({kind:"rename",path:H,name:D.name}),O(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:D.name}),O(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:I,ask:Q,onClose:()=>q(void 0),onDone:(z)=>{if(q(void 0),b(),z)F("workspace",Te(z))}}),e(Mt,{root:I,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(I.id,ee.path),p(t("Moved to the trash")),b(),!V.dir&&(V.path===ee.path||V.path.startsWith(`${ee.path}/`)))F("workspace",Te({root:I.id,path:we(V.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 M=(x)=>i.onChange(y(S+x.clientX-C)),R=()=>{E.removeEventListener("pointermove",M),E.removeEventListener("pointerup",R)};E.addEventListener("pointermove",M),E.addEventListener("pointerup",R)}})}export{yn as WorkspacePage};