@jxsuite/studio 6.1.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/dist/chunks/2020-va2wwra4.js +4 -0
  2. package/dist/chunks/adapter-f93pafd7.js +4 -0
  3. package/dist/chunks/{cf-account-picker-n8hr38v7.js → cf-account-picker-af1h381v.js} +3 -3
  4. package/dist/chunks/cf-settings-125tdm0w.js +4 -0
  5. package/dist/chunks/components-ax2f1fnn.js +4 -0
  6. package/dist/chunks/content-source-108aqtk1.js +4 -0
  7. package/dist/chunks/{convert-to-repeater-7wns8kf1.js → convert-to-repeater-ry5rmppr.js} +3 -3
  8. package/dist/chunks/editor-pfgdmkb0.js +4 -0
  9. package/dist/chunks/entry-commands-t0k1q0kx.js +4 -0
  10. package/dist/chunks/{extension-sections-na7rj3nr.js → extension-sections-6mwh2hf8.js} +3 -3
  11. package/dist/chunks/file-ops-meej5mqf.js +4 -0
  12. package/dist/chunks/files-44vp8a2s.js +4 -0
  13. package/dist/chunks/format-host-7q1petb9.js +4 -0
  14. package/dist/chunks/fs-events-h2mwnxaz.js +4 -0
  15. package/dist/chunks/git-panel-zngbymvd.js +4 -0
  16. package/dist/chunks/{grid-view-7tt4bxw1.js → grid-view-sx9vynsp.js} +15 -15
  17. package/dist/chunks/icons-p44xhjf0.js +4 -0
  18. package/dist/chunks/iframe-host-qk3ycq87.js +4 -0
  19. package/dist/chunks/{index-gybvv7a6.js → index-2veqmnhr.js} +3 -3
  20. package/dist/chunks/index-wkyfjeqz.js +4 -0
  21. package/dist/chunks/{javascript-rnvdp3k4.js → javascript-8nbvs12s.js} +3 -3
  22. package/dist/chunks/jsonMode-s8kt9dsj.js +13 -0
  23. package/dist/chunks/jx-validate-psgd7vsx.js +4 -0
  24. package/dist/chunks/layers-panel-1kq2jyfk.js +4 -0
  25. package/dist/chunks/layers-xd92fg8d.js +4 -0
  26. package/dist/chunks/lit-html-ac4cwwr4.js +4 -0
  27. package/dist/chunks/media-picker-0svzkdyb.js +4 -0
  28. package/dist/chunks/menu-5c55ea3d.js +4 -0
  29. package/dist/chunks/{monaco-binding-2jnhjjvr.js → monaco-binding-z6r70pdt.js} +3 -3
  30. package/dist/chunks/monaco-buffer-fz6gq5y7.js +4 -0
  31. package/dist/chunks/monaco-setup-q4axkgj7.js +4 -0
  32. package/dist/chunks/notify-0xgtn8q1.js +4 -0
  33. package/dist/chunks/platform-v1qctbe6.js +4 -0
  34. package/dist/chunks/publish-panel-ym1fmgq5.js +4 -0
  35. package/dist/chunks/quick-search-a54e6t5n.js +4 -0
  36. package/dist/chunks/references-gmqp82fs.js +4 -0
  37. package/dist/chunks/right-panel-v7t9awbk.js +4 -0
  38. package/dist/chunks/section-registry-vhyf3zsr.js +4 -0
  39. package/dist/chunks/studio-0bhx5hz6.js +5 -0
  40. package/dist/chunks/studio-0k1ddnyy.js +6 -0
  41. package/dist/chunks/studio-1b04pd0j.js +64 -0
  42. package/dist/chunks/{studio-5g0ag7c0.js → studio-1q1sh2ax.js} +3 -3
  43. package/dist/chunks/studio-4dwbj6gb.js +5 -0
  44. package/dist/chunks/studio-4tanh828.js +5 -0
  45. package/dist/chunks/{studio-vzacdfsc.js → studio-55h4mstj.js} +3 -3
  46. package/dist/chunks/studio-5tnvjkz4.js +5 -0
  47. package/dist/chunks/{studio-rggdb3hm.js → studio-60dqgb0c.js} +4 -4
  48. package/dist/chunks/studio-61dp09qg.js +9 -0
  49. package/dist/chunks/studio-63epcrj2.js +5 -0
  50. package/dist/chunks/studio-74k29dy9.js +5 -0
  51. package/dist/chunks/{studio-qvasen3f.js → studio-7vg6jcd3.js} +4 -4
  52. package/dist/chunks/studio-7zx31knw.js +9 -0
  53. package/dist/chunks/studio-8bxk97km.js +5 -0
  54. package/dist/chunks/{studio-anyrgzvb.js → studio-8grwxtqk.js} +4 -4
  55. package/dist/chunks/studio-933e30n4.js +5 -0
  56. package/dist/chunks/{studio-h0xgswew.js → studio-98wnwhbg.js} +4 -4
  57. package/dist/chunks/studio-9mccjwjh.js +14 -0
  58. package/dist/chunks/studio-a2ke1e4t.js +5 -0
  59. package/dist/chunks/studio-e3a2a6v3.js +4 -0
  60. package/dist/chunks/{studio-vk9ezads.js → studio-e81q1vb9.js} +4 -4
  61. package/dist/chunks/{studio-z8w183sh.js → studio-epgrmqqm.js} +4 -4
  62. package/dist/chunks/studio-g1shz58g.js +5 -0
  63. package/dist/chunks/studio-gf0fz03c.js +5 -0
  64. package/dist/chunks/studio-gjtpe62q.js +6 -0
  65. package/dist/chunks/{studio-y78s8r2n.js → studio-gkskhg7m.js} +4 -4
  66. package/dist/chunks/studio-gx4dnjzd.js +5 -0
  67. package/dist/chunks/{studio-pxg4ap1e.js → studio-h46vtzk8.js} +4 -4
  68. package/dist/chunks/studio-j03zga3y.js +9 -0
  69. package/dist/chunks/{studio-ar8jcf2y.js → studio-jhpxeckz.js} +4 -4
  70. package/dist/chunks/{studio-w4c0xmrw.js → studio-k01r7ykp.js} +4 -4
  71. package/dist/chunks/{studio-cpxkgjrj.js → studio-kggey1jt.js} +4 -4
  72. package/dist/chunks/{studio-zxp13sss.js → studio-kk7h30ne.js} +6 -6
  73. package/dist/chunks/{studio-ecaz25vk.js → studio-kt1zqney.js} +4 -4
  74. package/dist/chunks/{studio-zygnmm01.js → studio-m3cwhvye.js} +4 -4
  75. package/dist/chunks/{studio-2sqcndak.js → studio-mcayt6hz.js} +4 -4
  76. package/dist/chunks/{studio-qqz8e5gk.js → studio-myjcghv3.js} +4 -4
  77. package/dist/chunks/studio-n8bxwc3y.js +4 -0
  78. package/dist/chunks/{studio-wfjqhhbk.js → studio-ngm8gvpb.js} +4 -4
  79. package/dist/chunks/{studio-zscd9ty4.js → studio-nj5a01jy.js} +196 -196
  80. package/dist/chunks/{studio-3bpdkq2s.js → studio-pcgz8heb.js} +4 -4
  81. package/dist/chunks/{studio-v2bvmbjj.js → studio-pre0skq6.js} +4 -4
  82. package/dist/chunks/{studio-ghkb32r8.js → studio-qcsq0t15.js} +4 -4
  83. package/dist/chunks/studio-qkstvve9.js +5 -0
  84. package/dist/chunks/studio-qv1pwd3c.js +5 -0
  85. package/dist/chunks/{studio-bmn4mn9j.js → studio-rc6dvxjb.js} +5 -5
  86. package/dist/chunks/{studio-qbj760tx.js → studio-rv11kfwa.js} +7 -7
  87. package/dist/chunks/studio-s8dmmz66.js +5 -0
  88. package/dist/chunks/studio-sp5xzbj4.js +6 -0
  89. package/dist/chunks/{studio-tyasmc39.js → studio-szsjbj0g.js} +4 -4
  90. package/dist/chunks/studio-t1xzawhr.js +16 -0
  91. package/dist/chunks/{studio-skprc6ef.js → studio-t6b6qe31.js} +4 -4
  92. package/dist/chunks/{studio-ghrhy2y7.js → studio-tdcprbqb.js} +4 -4
  93. package/dist/chunks/{studio-txjjzrsm.js → studio-vrmcjf9g.js} +5 -5
  94. package/dist/chunks/studio-vyc0b4he.js +10 -0
  95. package/dist/chunks/{studio-5g4t8v6w.js → studio-w0cgf6jg.js} +4 -4
  96. package/dist/chunks/{studio-acdksxx6.js → studio-w3hskzqk.js} +4 -4
  97. package/dist/chunks/{studio-0x3jyb8r.js → studio-wszjyh0j.js} +4 -4
  98. package/dist/chunks/studio-xgrgcdyh.js +9 -0
  99. package/dist/chunks/{studio-qpqa7vk3.js → studio-xz2yxfcb.js} +4 -4
  100. package/dist/chunks/{studio-77kt594t.js → studio-y6n42tgs.js} +4 -4
  101. package/dist/chunks/{studio-19x1c75w.js → studio-yb560vxr.js} +4 -4
  102. package/dist/chunks/{studio-wgh5kxpj.js → studio-yn9f8vtx.js} +4 -4
  103. package/dist/chunks/{studio-a2138x5k.js → studio-yw05w8f0.js} +5 -5
  104. package/dist/chunks/{studio-h9c4p2tx.js → studio-z16sgavc.js} +4 -4
  105. package/dist/chunks/studio-zey7zsdw.js +12 -0
  106. package/dist/chunks/{studio-g7nse7zb.js → studio-zyqn40w4.js} +4 -4
  107. package/dist/chunks/tsMode-2frah6h1.js +14 -0
  108. package/dist/chunks/workspace-zt81g1ms.js +4 -0
  109. package/dist/chunks/ws-client-n2bh4hkf.js +4 -0
  110. package/dist/iframe-entry.js +13 -13
  111. package/dist/manifest.json +62 -62
  112. package/dist/studio.js +77 -77
  113. package/dist/workers/ts.worker.js +3 -3
  114. package/package.json +10 -10
  115. package/src/canvas/canvas-render.ts +4 -1
  116. package/src/canvas/canvas-utils.ts +73 -15
  117. package/src/canvas/iframe-host.ts +67 -21
  118. package/src/canvas/iframe-inline-edit.ts +22 -4
  119. package/src/canvas/iframe-interaction.ts +7 -1
  120. package/src/canvas/iframe-protocol.ts +3 -0
  121. package/src/canvas/iframe-render.ts +5 -2
  122. package/src/commands/defaults.ts +4 -1
  123. package/src/commands/live-context.ts +3 -1
  124. package/src/editor/shortcuts.ts +55 -27
  125. package/src/files/media-paths.ts +3 -1
  126. package/src/panels/editors.ts +3 -1
  127. package/src/panels/style-panel.ts +36 -11
  128. package/src/platforms/devserver.ts +47 -12
  129. package/src/studio.ts +14 -2
  130. package/src/surfaces/library-pane.ts +6 -0
  131. package/src/surfaces/rail.json +126 -73
  132. package/src/surfaces/rail.ts +31 -5
  133. package/src/tabs/typing.ts +31 -0
  134. package/src/utils/edit-display.ts +30 -1
  135. package/src/workspace/workspace.ts +7 -0
  136. package/dist/chunks/2020-nkxms0ay.js +0 -4
  137. package/dist/chunks/adapter-m948ab5f.js +0 -4
  138. package/dist/chunks/cf-settings-356xdtne.js +0 -4
  139. package/dist/chunks/components-yk3t844e.js +0 -4
  140. package/dist/chunks/content-source-bawmyc09.js +0 -4
  141. package/dist/chunks/editor-6sc8nacq.js +0 -4
  142. package/dist/chunks/entry-commands-8ay9fh81.js +0 -4
  143. package/dist/chunks/file-ops-gye0qw56.js +0 -4
  144. package/dist/chunks/files-dmc2xvcq.js +0 -4
  145. package/dist/chunks/format-host-t76b53f8.js +0 -4
  146. package/dist/chunks/fs-events-cg4tpz06.js +0 -4
  147. package/dist/chunks/git-panel-yef7bshy.js +0 -4
  148. package/dist/chunks/icons-qbh8akb1.js +0 -4
  149. package/dist/chunks/iframe-host-tmz30gfp.js +0 -4
  150. package/dist/chunks/index-nag78a9h.js +0 -4
  151. package/dist/chunks/jsonMode-zhwsprqk.js +0 -13
  152. package/dist/chunks/jx-validate-3gbp5nkn.js +0 -4
  153. package/dist/chunks/layers-fvz99859.js +0 -4
  154. package/dist/chunks/layers-panel-gchmbf9p.js +0 -4
  155. package/dist/chunks/lit-html-9agdspkt.js +0 -4
  156. package/dist/chunks/media-picker-rhjvyy00.js +0 -4
  157. package/dist/chunks/menu-2e4y9j7b.js +0 -4
  158. package/dist/chunks/monaco-buffer-rp21359g.js +0 -4
  159. package/dist/chunks/monaco-setup-vhh7gayr.js +0 -4
  160. package/dist/chunks/notify-h3www560.js +0 -4
  161. package/dist/chunks/platform-hz34wcd7.js +0 -4
  162. package/dist/chunks/publish-panel-exsmjzyj.js +0 -4
  163. package/dist/chunks/quick-search-pgaqeh0m.js +0 -4
  164. package/dist/chunks/references-2cgdxnb8.js +0 -4
  165. package/dist/chunks/right-panel-jf856w5w.js +0 -4
  166. package/dist/chunks/section-registry-jnf8r5gy.js +0 -4
  167. package/dist/chunks/studio-0f55h9ye.js +0 -5
  168. package/dist/chunks/studio-0sqdhnew.js +0 -12
  169. package/dist/chunks/studio-3aey7dd3.js +0 -5
  170. package/dist/chunks/studio-47y6fbpf.js +0 -5
  171. package/dist/chunks/studio-4m3826v2.js +0 -5
  172. package/dist/chunks/studio-4nx2dj1g.js +0 -4
  173. package/dist/chunks/studio-4xv5s47r.js +0 -9
  174. package/dist/chunks/studio-5py436sf.js +0 -5
  175. package/dist/chunks/studio-8f87n763.js +0 -10
  176. package/dist/chunks/studio-8mb00b84.js +0 -5
  177. package/dist/chunks/studio-8p51gq2h.js +0 -6
  178. package/dist/chunks/studio-954ds834.js +0 -5
  179. package/dist/chunks/studio-9ft45c83.js +0 -9
  180. package/dist/chunks/studio-a9yzstqj.js +0 -5
  181. package/dist/chunks/studio-e7xxa0sj.js +0 -5
  182. package/dist/chunks/studio-fzdywr6p.js +0 -9
  183. package/dist/chunks/studio-g5fmf0c1.js +0 -5
  184. package/dist/chunks/studio-geq1ea6k.js +0 -14
  185. package/dist/chunks/studio-grawhey1.js +0 -5
  186. package/dist/chunks/studio-jyzj5cxs.js +0 -5
  187. package/dist/chunks/studio-mgx8yhnz.js +0 -64
  188. package/dist/chunks/studio-mpb04y1d.js +0 -6
  189. package/dist/chunks/studio-n17mty64.js +0 -5
  190. package/dist/chunks/studio-nwh2eqsk.js +0 -6
  191. package/dist/chunks/studio-q1h883bt.js +0 -16
  192. package/dist/chunks/studio-q4tv82h7.js +0 -9
  193. package/dist/chunks/studio-sghy936h.js +0 -4
  194. package/dist/chunks/studio-tt2nactf.js +0 -5
  195. package/dist/chunks/studio-xasj0796.js +0 -5
  196. package/dist/chunks/tsMode-gr0m4dzr.js +0 -14
  197. package/dist/chunks/workspace-m15qtcqp.js +0 -4
  198. package/dist/chunks/ws-client-nf61frr1.js +0 -4
@@ -1,7 +1,7 @@
1
- import{tt}from"./studio-5g0ag7c0.js";import{te}from"./studio-ery42sqr.js";import{ne}from"./studio-geq1ea6k.js";import{T,R,on,$c,Nn}from"./studio-e7xxa0sj.js";import{v,Mo,k}from"./studio-vzacdfsc.js";import{p,We}from"./studio-qpqa7vk3.js";import{qt,Pd,Ka,Lp,Vs,Ip,Zt,Ja}from"./studio-tt2nactf.js";import{ua}from"./studio-19x1c75w.js";import{Ir,fp}from"./studio-3bpdkq2s.js";import{dn,$o,Wu,xm,vp,Nx,Qn,m,Ku,Fl,qa,No,nk,ci,km,Ev}from"./studio-3aey7dd3.js";import{Du,UE,qE,Ps}from"./studio-skprc6ef.js";import{_t,Lr,qr}from"./studio-5g4t8v6w.js";import{hs,eL,iL,Zb,fs,Xb}from"./studio-q1h883bt.js";import{la}from"./studio-9ft45c83.js";import{qn}from"./studio-bmn4mn9j.js";import{Al}from"./studio-vk9ezads.js";import{gr,zs,Ws,gs}from"./studio-qbj760tx.js";import{ob,np,ip,xw,gE,zf}from"./studio-qqz8e5gk.js";import{Cc,tv,Ua}from"./studio-4m3826v2.js";import{OE,L1}from"./studio-8f87n763.js";import{VE,Er,Yf,Zf}from"./studio-qvasen3f.js";import{Nt}from"./studio-pxg4ap1e.js";import{tb,nb,ib}from"./studio-w4c0xmrw.js";import{ls}from"./studio-y78s8r2n.js";import{sa}from"./studio-jyzj5cxs.js";import{D,Bl,vt}from"./studio-wgh5kxpj.js";import{me}from"./studio-v2bvmbjj.js";async function Ff(){if(ob(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let n=la({status:"Running bun install…",title:"Installing dependencies"});try{let o=await e.installDependencies();if(o.ok)return n.done(),!0;n.fail(o.log??"bun install failed")}catch(o){n.fail(o instanceof Error?o.message:String(o))}return!1}var Be=["page","component"],Ge={components:"component",pages:"page"};function _(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ke(e){let t=_(e).toLowerCase();for(let[n,o]of Object.entries(Ge))if(t.startsWith(`${n}/`))return o;return null}function ee(e){return Be.some((t)=>e.includes(t))}function Ye(e){let t=D?.projectConfig?.layout;if(typeof t!=="string")return!1;return _(t).toLowerCase()===_(e).toLowerCase()}function ge(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let n of Ja(e)){let o=Vs(n,"parse");if(o&&Vs(n,"serialize"))t.push({ext:n,label:`${o.name} (${n})`})}return t}function we(){return new Set([".json",...Lp().flatMap((e)=>e.extensions)])}function pw(e){if(e===null||e===void 0||e==="")return[];let t=Ke(e);if(t===null||Ye(e)||Nx(e))return[];let n=Zt(e);if(!(n?Boolean(n.capabilities.parse)&&ee(n.documentKinds):_(e).toLowerCase().endsWith(".json")))return[];let r=[];if(n)r.push({ext:".json",label:"JSON (.json)"});for(let a of Ja()){let i=Vs(a,"serialize");if(!i||i.name===n?.name||!ee(i.documentKinds)||!i.documentKinds.includes(t))continue;r.push({ext:a,label:`${i.name} (${a})`})}return r}function aE(){let e=new Set([".json"]);for(let t of Lp()){if(!t.capabilities.serialize||!ee(t.documentKinds))continue;for(let n of t.extensions)e.add(n)}return[...e].toSorted()}var oe="jx-studio-recent-projects",ye="jx-studio-recent-files",ve=8,Qe=10,M=[];function V(){if(!We())return null;let e=p();return e.getRecentProjects&&e.saveRecentProjects?e:null}function Xe(){try{let e=localStorage.getItem(oe);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function re(){return V()?M:Xe()}function be(e){M=e;let t=V();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(oe,JSON.stringify(e))}catch{}}async function lE(){let e=V();if(!e)return;try{M=await e.getRecentProjects()}catch{M=[]}}function Qg(){return re().toSorted((e,t)=>t.timestamp-e.timestamp)}function eb(e,t){let n=re().filter((o)=>o.root!==t);if(n.unshift({name:e,root:t,timestamp:Mo()}),n.length>ve)n.length=ve;be(n)}function fw(e){be(re().filter((t)=>t.root!==e))}function cE(){M=[];let e=V();if(e)e.saveRecentProjects([]);else localStorage.removeItem(oe)}function xe(){try{let e=localStorage.getItem(ye);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function dE(e){let t=xe().toSorted((n,o)=>o.timestamp-n.timestamp);return e==null?t:t.filter((n)=>n.root===e)}function jf(e){let t=xe().filter((r)=>!(r.root===e.root&&r.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:Mo()});let n=new Map,o=[];for(let r of t.toSorted((a,i)=>i.timestamp-a.timestamp)){let a=(n.get(r.root)??0)+1;if(n.set(r.root,a),a<=Qe)o.push(r)}localStorage.setItem(ye,JSON.stringify(o))}var Pe={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",Pe);function Fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function J(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function et(e){let t=typeof e==="string"?void 0:e.attributes?.part;return typeof t==="string"?t:""}function nt(e){let n=e?.$map?.item;return typeof n?.path==="string"?n:null}function je(e,t,n){let o=v({...J(),...n});Fe(o,t);let r=null,a=!1,i=R("files-panel",o,e,{onNodeCreated:(s,l,c,d)=>{if(a||!(s instanceof HTMLElement))return;let F=et(c);if(F==="tree"){n.treeHost(s);return}if(F!=="row")return;let y=nt(d);if(y)n.rowHost(s,y.path,y.type)}}).then((s)=>{if(a){s.dispose();return}r=s});return{connected:()=>!a&&(r===null||r.root.parentNode===e),dispose(){a=!0,r?.dispose(),r=null},ready:i,update:(s)=>{Fe(o,s)}}}async function To(e){if(!D)return;try{let t=p(),[n]=await Promise.all([Ir(()=>t.listDirectory(e)),UE(e)]);D.dirs.set(e,n)}catch{D.dirs.set(e,[])}}function pe(){return Lr(_t.showIgnoredFiles)==="true"}function ot(e){qr(_t.showIgnoredFiles,e?"true":"")}async function Q_(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:n,info:o}=t;if(Pd(),qt(),Ka(e),Du(),fp(),Bl({dirs:new Map,expanded:new Set,isSiteProject:o.isSiteProject,name:o.isSiteProject?o.projectConfig?.name||n.name:n.name,projectConfig:(o.isSiteProject?o.projectConfig:null)||null,projectDirs:o.directories||[],projectRoot:".",root:n.root,searchQuery:"",selectedPath:null}),o.isSiteProject)qa(n.root||".",o.projectConfig||null);if(o.isSiteProject){if(eb(vt().name,n.root),await ip(),await Ff())Pd(),await qt(),Ka(e);await To("."),await Al(),await Hf(),np(n.root)}}catch{}}async function e1({renderLeftPanel:e}){try{let t=p(),n=await t.openProject();if(!n)return!1;let{config:o,handle:r}=n;if(nk({document:{children:[],tagName:"div"},id:"initial"}),VE(),Pd(),qt(),Ka(t),Du(),fp(),Bl({...D,dirs:new Map,expanded:new Set,isSiteProject:!0,name:o.name||r.name,projectConfig:o,projectRoot:r.root,searchQuery:"",selectedPath:null}),qa(r.root,o),await ip(),await Ff())Pd(),await qt(),Ka(t);await To("."),await Al();let a=new Set(["pages","layouts","components","content","data","public","styles"]),i=vt().dirs.get(".")||[],s=[];for(let l of i)if(l.type==="directory"&&a.has(l.name))s.push(l.name),vt().expanded.add(l.path||l.name),await To(l.path||l.name);return vt().projectDirs=s,zf(),Xb(),fs("files"),eb(vt().name,vt().projectRoot),e(),await Hf(),np(vt().projectRoot),!0}catch(t){return k.error("Could not open the project.",{detail:te(t),source:"Open Project"}),!1}}async function t1(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),k.success("Initialized a git repository for this project."),!0}catch(n){return k.warn("Could not initialize a git repository — the project itself was written.",{detail:te(n),source:"Source Control"}),!1}}async function mw(){await qt();let e=[...Ja("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let n=new Set(t.filter((o)=>o.type==="file").map((o)=>o.name));for(let o of e)if(n.has(`index${o}`))return`pages/index${o}`;return null}async function rt(){let e=await mw();if(e)await Lo(e)}async function Hf(){let e=iL(m.projectRoot);if(Zb(m.projectRoot),e){if(await eL(e,{ensureSecondPane:()=>{Fl(Qn)},openFile:(n,o)=>Lo(n,{focus:!1,paneId:o})})>0)return!0}return await rt(),!1}function at(e,t,n){if(t==="directory")return n?"folder-open":"folder";let o=e.split(".").pop()?.toLowerCase();switch(o){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return o!==void 0&&tv(o)?"image":"file"}}function n1(){return tt}function i1(e){}var it=24,u=[],A=null,L=new Map,B=null,Se=null;function ue(){for(let e of L.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return it}function st(){for(let[e,t]of L)if(!t.isConnected)L.delete(e),Oe(t)}function Re(e){let t=L.get(e);return t?.isConnected===!0?t:null}function X(e){return u.find((t)=>!t.loading&&t.path===e)}function ke(e,t,n,o){let r=vt().dirs.get(e);if(!r){To(e).then(()=>f()),n.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let a=[...r].toSorted((c,d)=>{if(c.type==="directory"&&d.type!=="directory")return-1;if(c.type!=="directory"&&d.type==="directory")return 1;return c.name.localeCompare(d.name)}),i=pe()?a:a.filter((c)=>!qE(e,c.path,c.type==="directory")),s=vt().searchQuery.toLowerCase(),l=s?i.filter((c)=>c.type==="directory"||c.name.toLowerCase().includes(s)):i;for(let[c,d]of l.entries()){let y=d.type==="directory"&&vt().expanded.has(d.path);if(n.push({depth:t,expanded:y,key:d.path,loading:!1,name:d.name,path:d.path,locale:Wu(d.path,o)??void 0,posInSet:c+1,setSize:l.length,type:d.type}),y)ke(d.path,t+1,n,o)}}function Ee(e){return e===void 0?-1:u.findIndex((t)=>!t.loading&&t.path===e)}function q(e,t){for(let n=e+t;n>=0&&n<u.length;n+=t)if(!u[n].loading)return n;return-1}function lt(e){let t=u[e];if(!t)return-1;for(let n=e-1;n>=0;n--){let o=u[n];if(!o.loading&&o.depth<t.depth)return n}return-1}function ct(){if(A?.isConnected!==!0||O!=="")return;queueMicrotask(f)}function ie(){let e=A;if(e===null)return;B=ib(B,e,{count:()=>u.length,onChange:ct,rowHeight:ue})}function dt(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:at(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":dn(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function pt(){if(st(),!D){u=[];let s={...J(),view:"none"};return P=s,s}if(!D.isSiteProject&&D.projectRoot==="."){u=[];let s={...J(),view:"welcome"};return P=s,s}let e=vt();u=[];let{i18n:t}=$o(e.projectConfig??{});ke(".",0,u,t);let n=tb(A,{count:u.length,rowHeight:ue()}),o=u.slice(n.start,n.end),r=(e.selectedPath!==null&&X(e.selectedPath)?e.selectedPath:"")||o.find((s)=>!s.loading)?.path||"",a=pe(),i={currentPath:r,dragPath:O,dropPath:W,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:a?"eye":"eye-slash",ignoredLabel:a?"Hide ignored files":"Show ignored files",ignoredSelected:a,padBottom:n.padBottom,padTop:n.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:Z,rows:o.map((s)=>dt(s)),selectedPath:e.selectedPath??"",view:"tree"};return P=i,i}function se(){if(!w||!P)return;P={...P,dragPath:O,dropPath:W,rootDrop:Z},w.handle.update(P)}function f(){Se?.()}async function ut(){let e=vt();e.dirs.clear(),Du(),await To(".");for(let t of e.expanded)await To(t);f()}function ft(e){let t=X(e);if(!t)return;if(t.type==="directory"){Ce(e).then(()=>f());return}Lo(e)}function ht(e,t){let n=vt();if(X(e)?.type!=="directory"||n.expanded.has(e)===t)return;if(!t){n.expanded.delete(e),f();return}Ce(e).then(()=>f())}function Te(e){if(!D||vt().selectedPath===e)return;vt().selectedPath=e,f()}function mt(e,t){let n=Ee(e),o;switch(t){case"Home":{o=q(-1,1);break}case"End":{o=q(u.length,-1);break}case"ArrowUp":{o=q(n,-1);break}case"ArrowLeft":{o=lt(n);break}case"ArrowDown":case"ArrowRight":{o=q(n,1);break}default:return}De(o)}function gt(e,t){let n=Ee(e),o=u.length;for(let r=1;r<=o;r++){let a=(n+r+o)%o,i=u[a];if(i&&!i.loading&&i.name.trim().toLowerCase().startsWith(t)){De(a);return}}}function De(e){let t=u[e];if(!t)return;if(Te(t.path),Re(t.path))return;nb(A,e,ue()),f()}async function Ce(e){let t=vt();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await To(e)}var z=new Map,G=null,O="",K="",W="",Y=!1,Z="";function wt(e){return[...e.dataTransfer?.types??[]].includes("Files")}function Ne(e,t,n){let o=(i)=>{if(!wt(i))return;if(i.preventDefault(),i.stopPropagation(),i.dataTransfer)i.dataTransfer.dropEffect="copy";n(!0)},r=()=>n(!1),a=(i)=>{n(!1);let s=i.dataTransfer?.files;if(!s?.length)return;i.preventDefault(),i.stopPropagation(),Le(s,t,f)};return e.addEventListener("dragover",o),e.addEventListener("dragleave",r),e.addEventListener("drop",a),()=>{e.removeEventListener("dragover",o),e.removeEventListener("dragleave",r),e.removeEventListener("drop",a)}}function le(e,t){let n=e.replaceAll("\\","/"),o=t.replaceAll("\\","/");if(!n||n===o)return!1;if(n.startsWith(`${o}/`)||o.startsWith(`${n}/`))return!1;return Q(n)!==o}function ae(e,t,n){return n==="directory"&&typeof e==="string"&&le(e,t)}function I(e,t){let n=t?e:"";if(K===e&&W===n)return;K=e,W=n,Ie()}function U(e){if(Y===e)return;Y=e,Ie()}function Ie(){Z=Y&&K===""?"true":"",se()}async function Le(e,t,n){if((await Ua([...e],{dir:t})).length===0)return;if(t!==".")vt().expanded.add(t);n()}function yt(e,t){let n=document.createElement("input");n.type="file",n.multiple=!0,n.accept=Cc(),n.addEventListener("change",()=>{if(n.files?.length)Le(n.files,e,t)}),n.click()}function bt(e,t,n){Oe(e),L.set(t,e);let o=[gs({element:e,getInitialData(){return{entryType:n,path:t,type:"file-tree"}},onDragStart(){O=t,se()},onDrop(){O="",I("",!1),se()}}),Ne(e,n==="directory"?t:Q(t),(r)=>{I(r?t:"",r)}),zs({canDrop({source:r}){return r.data.type==="file-tree"},element:e,getData({source:r}){return ae(r.data.path,t,n)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:r}){I(t,ae(r.data.path,t,n))},onDragEnter({source:r}){I(t,ae(r.data.path,t,n))},onDragLeave(){I("",!1)},onDrop(){I("",!1)}})];z.set(e,gr(...o))}function Oe(e){let t=z.get(e);if(t)t(),z.delete(e)}function xt(e){if(G?.element===e)return;Ae(),A=e;let t=zs({canDrop({source:o}){return o.data.type==="file-tree"&&le(o.data.path,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){U(!0)},onDragLeave(){U(!1)},onDrop(){U(!1)}}),n=Ws({onDrop({source:o,location:r}){let[a]=r.current.dropTargets;if(!a)return;if(o.data.type!=="file-tree")return;if(a.data.type!=="file-tree-target")return;let i=o.data.path,s=a.data.targetDir;if(!le(i,s))return;let l=i.split("/").pop(),c=s==="."?l:`${s}/${l}`;Pt(i,c,f)}});G={cleanup:gr(t,n,Ne(e,".",U)),element:e},ie()}function Ae(){G?.cleanup(),G=null;for(let e of z.values())e();z.clear(),B?.window.destroy(),B=null,A=null,O="",K="",W="",Y=!1,Z=""}async function Pt(e,t,n){let o=p();Ps(e,t);try{let r=await o.renameFile(e,t);ua();for(let[s]of m.tabs.entries())if(s===e)Ev(e,t,t);else if(s.startsWith(`${e}/`)){let l=t+s.slice(e.length);Ev(s,l,l)}let a=Q(e),i=Q(t);if(await To(a),i!==a)await To(i);if(i!==".")vt().expanded.add(i);ze(r,t),n(),uE(`Moved to ${t}`,r,t)}catch(r){k.error(`Could not move ${e}.`,{detail:te(r),path:e,source:"Files"})}}function Q(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return n===-1?".":t.slice(0,n)}var H=null;function Me(){H?.close(),H=null}function Ft(e){let t={};if(e.type==="directory"){let n=vp(e.path);if(n?.isSourceRoot===!0&&!n.fileBacked)t.name=n.name;return t}if(t.file=e.path,sa(e.path))t.path=e.path;if(pw(e.path).length>0)t.source=e.path;return t}function S(e,t,n,o={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:n,title:t,...o}}function jt(e){let t=ne();if(!t)return[];let n=Ft(e),o=[];for(let r of t.forPlacement("context/file")){let a=r.args;if(!(a?.required??[]).every((l)=>(l in n)))continue;let i={};for(let l of Object.keys(a?.properties??{}))if(l in n)i[l]=n[l];let s=t.disabledReason(r.id);o.push(s===void 0?S(r.id,r.title,()=>{on(t,r.id,i,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:r.id,requires:s,title:r.title})}return o}function $t(e){let t=e.type==="directory",n=[];if(t){if(n.push(S("files.newFile","New File…",()=>{He(e.path,f)}),S("files.upload","Upload Files…",()=>{yt(e.path,f)})),e.path==="pages"||e.path.endsWith("/pages"))n.push(S("files.pagesGrid","Edit Pages in Grid",()=>{L1()}))}else n.push(S("files.open","Open",()=>{Lo(e.path)}));return n.push(...jt(e),S("files.rename","Rename…",()=>{Ct(e,f)},{dividerAbove:!0}),S("files.delete","Delete",()=>{It(e,f)},{destructive:!0})),n}function St(e,t,n){let o=X(e);if(!o)return;Me();let r=Re(e);H=Nt({label:"File actions",onClosed:(a)=>{if(H===a)H=null},opener:r,origin:{x:t,y:n},region:"files",rows:$t({name:o.name,path:o.path,type:o.type})})}var Rt=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2),E="__other__";function $e(e){return e.trim().toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d-]/g,"")}function ce(e){let t=e.lastIndexOf(".");return t>0?e.slice(t):""}function kt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Vs(e.ext)?.name??e.ext} (${e.ext})`}]:ge(e.docKind)).map((n)=>({label:n.label,value:n.ext})),{dividerBefore:!0,label:"Other…",value:E}]}function Et(e,t,n){let o=e.kind==="choose"?e.defaultExt:e.ext;if(o!==void 0&&t.some((a)=>a.value===o))return o;let r=ce(n);if(r!==""&&t.some((a)=>a.value===r))return r;return t[0]?.value??E}async function gw(e){let{dir:t,format:n,source:o="Files"}=e;await qt();let r=new Set;try{let g=await p().listDirectory(t);r=new Set(g.map((h)=>h.name.toLowerCase()))}catch{}let a=n!==void 0&&n.kind!=="fixed"?n:null,i=a===null?null:kt(a),s=a===null||i===null?"":Et(a,i,e.suggestedName??""),l=(g,h)=>{let b=g.trim();if(n===void 0||h===E)return b;if(n.kind==="fixed"){let x=$e(b);return x===""?"":`${x}${n.ext}`}return b.toLowerCase().endsWith(h.toLowerCase())?b:`${b}${h}`},c=we(),d=(g,h)=>{let b=g.trim();if(!b)return n?.kind==="fixed"?"Enter a name.":"Enter a file name.";if(n?.kind==="fixed"&&$e(b)==="")return"Enter at least one letter or number.";let x=b.replaceAll("\\","/");if(x.startsWith("/")||x.endsWith("/"))return"Enter a name, not a path that starts or ends with a slash.";if(x.split("/").includes(".."))return"A name cannot step outside the destination folder.";if(x.includes("/")&&n!==void 0&&h!==E)return`Pick Other… to create a file in a subfolder of ${t==="."?"the project root":t}.`;let j=ce(x);if(h!==""&&h!==E&&j!==""&&j.toLowerCase()!==h.toLowerCase()&&c.has(j.toLowerCase()))return`You picked ${i?.find((Ue)=>Ue.value===h)?.label??h}; this name ends in ${j}.`;if(n?.kind==="locked"&&h===E){if(j!==""&&j.toLowerCase()!==n.ext.toLowerCase()&&c.has(j.toLowerCase()))return n.because}let he=l(g,h);return r.has(he.toLowerCase())?`${he} already exists in ${t}/.`:""},F=s,y=await Nn(e.title??"New File",{...i===null?{}:{choice:{initial:s,label:"Format",onChange:(g)=>{F=g},options:()=>i}},confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,...e.suggestedName===void 0?{}:{placeholder:e.suggestedName},select:i===null?"stem":"all",validate:d,value:e.suggestedName??"untitled.json"});if(!y)return null;let C=l(y,F),N=t==="."?C:`${t}/${C}`;Ps(N);let fe=Zt(C),_e=typeof e.content==="function"?await e.content(ce(C),C):e.content,Ve=n!==void 0&&F!==E,Je=_e??fe?.studio?.newFileTemplate??(fe?"":C.toLowerCase().endsWith(".json")?Ve?Rt:`{}
2
- `:"");try{return await p().writeFile(N,Je),await To(t),k.success(`Created ${N}`),N}catch(g){return k.error(`Could not create ${N}.`,{detail:te(g),path:N,source:o}),null}}async function He(e,t){await qt();let n=vp(e);if(n?.unresolvedFormat!=null)k.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${n.name}" content type declares format "${n.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let o=n?.ext!=null&&n.unresolvedFormat===null,r=o&&n.isSourceRoot&&n.def.schema!==void 0,a;if(r){let{createEntry:i}=await (me("8ay9fh81"),import("./entry-commands-8ay9fh81.js"));a=await i(n.name,{dir:e})}else a=await gw({dir:e,format:o&&n.ext!==null?{because:`${n.name} entries are ${n.ext} files, so a document of another format here would not be one.`,ext:n.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(a!==null)t()}async function Tt(e,t){let n=await Zf(t);return Nn("Rename",{confirmLabel:"Rename",...n===void 0?{}:{message:n},select:"stem",validate:(o)=>o.trim()?"":"Enter a file name.",value:e})}function Dt(e,t){let n=t.references,o=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(n&&n.refsUpdated>0)return`Renamed to ${e}; updated ${n.refsUpdated} reference(s) in ${n.filesChanged} file(s)${o}`;if(o)return`Renamed to ${e}${o}`;return`Renamed to ${e}`}function uE(e,t,n){let o=t.errors??[];if(o.length===0){k.success(e);return}let r=o.length===1?"1 file":`${o.length} files`;k.warn(`${e} — references in ${r} could not be updated`,{detail:o.map((a)=>`${a.path}: ${a.error}`).join(`
3
- `),path:n,source:"Files"})}function ze(e,t){for(let n of e.references?.files??[])if(n.path!==t&&m.tabs.has(n.path))tp(n.path)}function de(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function i$(e,t,n){ua();let o=de(e),r=de(t);if(await To(o),r!==o)await To(r);if(vt().selectedPath===e)vt().selectedPath=t;ze(n,t)}async function Ct(e,t){let n=await Tt(e.name,e.path);if(!n||n===e.name)return;let o=de(e.path),r=o==="."?n:`${o}/${n}`;Ps(e.path,r);try{let i=await p().renameFile(e.path,r);if(m.tabs.has(e.path))Ev(e.path,r,r);await i$(e.path,r,i),t(),uE(Dt(n,i),i,r)}catch(a){k.error(`Could not rename ${e.name}.`,{detail:te(a),path:e.path,source:"Files"})}}async function It(e,t){if(!await Yf(e))return;try{let o=p();Ps(e.path),await o.deleteFile(e.path),ua();let r=e.path.replaceAll("\\","/"),a=r.includes("/")?r.slice(0,r.lastIndexOf("/")):".";if(await To(a),vt().selectedPath===e.path)vt().selectedPath=null;t(),k.success(`Deleted ${e.name}`)}catch(o){k.error(`Could not delete ${e.name}.`,{detail:te(o),path:e.path,source:"Files"})}}function Lt(e,t){let n=t.paneId,o=Ku(e);if(n!==void 0&&o){if(o.activeTabId===e&&t.focus===!1)return;km(e,n)}ci(e,{focus:t.focus!==!1})}async function Lo(e,t={}){let n=t.focus!==!1;for(let[r,a]of m.tabs.entries())if(a.documentPath===e){if(Lt(r,t),n)vt().selectedPath=e;return}if(xw(e)){if(gE(e,t),n)vt().selectedPath=e;jf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await OE(e,t),n)vt().selectedPath=e;jf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot})}catch(r){k.error(`Could not open ${e}.`,{detail:te(r),path:e,source:"Open File"})}return}let o=p();try{let r=await o.readFile(e);if(!r){if(await qt(),!Zt(e)&&!e.toLowerCase().endsWith(".json"))throw Ip(e);return}await qt();let a,i,s=null,l=Zt(e);if(l){let d=await Er(e,r);({document:a}=d),{frontmatter:i}=d}else if(e.endsWith(".json"))({document:a,layout:s}=hs(r));else throw Ip(e);if(No({id:e,documentPath:e,document:a,...i!=null&&{frontmatter:i},layout:s,sourceFormat:l?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1}}),n)vt().selectedPath=e;jf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot})}catch(r){k.error(`Could not open ${e}.`,{detail:te(r),path:e,source:"Open File"})}}async function bw(e,t){await Lo(t,{focus:!1,paneId:e,preview:!0})}function o1(e){if(xm(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){tp(e);return}}function r1(e){for(let t of e)tp(t,{onlyIfChanged:!0})}async function tp(e,t={}){for(let[,n]of m.tabs.entries())if(n.documentPath===e){let o=p(),r=n.doc.dirty,a=()=>!r&&n.doc.dirty||xm(e);try{let i=await o.readFile(e);if(!i)return;if(await qt(),a())return;if(Zt(e)){let{document:s,frontmatter:l}=await Er(e,i);if(a())return;if(t.onlyIfChanged&&ls(s,n.doc.document)&&ls(l,n.doc.content.frontmatter))return;n.doc.document=s,n.doc.content.frontmatter=l}else if(e.endsWith(".json")){let s=hs(i);if(n.doc.layout=s.layout,t.onlyIfChanged&&ls(s.document,n.doc.document))return;n.doc.document=s.document}n.doc.dirty=!1}catch(i){k.error(`Could not reload ${e} after it changed on disk.`,{detail:te(i),key:`reload:${e}`,path:e,source:"Files"})}return}}function s1(){qn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",render:()=>tt,afterRender:(e,t)=>{At(t,e.rerender)}})}var Ot={activate:ft,contextMenu:St,expand:ht,move:mt,newFile:()=>{He(".",f)},openProject:()=>{$c("project.open",void 0,"Files")},refresh:()=>{ut()},rowHost:bt,search:(e)=>{vt().searchQuery=e,f()},select:Te,toggleIgnored:()=>{ot(!pe()),f()},treeHost:xt,typeahead:gt},w=null,P=null;function At(e,t){let n=e.querySelector(".panel-content")??e;if(Se=t,w&&(w.host!==n||!w.handle.connected()))Mt();let o=pt();if(w)w.handle.update(o);else{let r=je(n,o,Ot);w={handle:r,host:n},r.ready.then(ie)}queueMicrotask(ie)}function Mt(){Me(),w?.handle.dispose(),w=null,P=null,Ae(),L.clear(),u=[]}
4
- export{Ff,pw,aE,lE,Qg,eb,fw,cE,dE,jf,To,Q_,e1,t1,mw,Hf,n1,i1,gw,uE,i$,Lo,bw,o1,r1,tp,s1};
1
+ import{tt}from"./studio-1q1sh2ax.js";import{te}from"./studio-ery42sqr.js";import{ne}from"./studio-9mccjwjh.js";import{T,I,sn,sl,Pn}from"./studio-g1shz58g.js";import{y,jr,C}from"./studio-55h4mstj.js";import{p,Ve}from"./studio-xz2yxfcb.js";import{Kt,Jd,rl,zp,Ys,Up,Qt,ol}from"./studio-5tnvjkz4.js";import{xa}from"./studio-yb560vxr.js";import{Ao,Rp}from"./studio-pcgz8heb.js";import{hn,Or,nh,Am,Op,Jx,ti,m,ah,Jl,nl,Mr,b1,ui,Fm,Wy}from"./studio-a2ke1e4t.js";import{Uu,sT,aT,Vs}from"./studio-t6b6qe31.js";import{St,Oo,Xo}from"./studio-w0cgf6jg.js";import{ys,mL,yL,hy,ws,py}from"./studio-t1xzawhr.js";import{ya}from"./studio-7zx31knw.js";import{Kn}from"./studio-rc6dvxjb.js";import{zl}from"./studio-e81q1vb9.js";import{xo,Ks,Js,_s}from"./studio-rv11kfwa.js";import{yb,mp,gp,Pw,IE,nm}from"./studio-myjcghv3.js";import{Oc,gy,tl}from"./studio-gx4dnjzd.js";import{YE,VS}from"./studio-vyc0b4he.js";import{oT,Do,dm,um}from"./studio-7vg6jcd3.js";import{Pt}from"./studio-h46vtzk8.js";import{mb,gb,bb}from"./studio-k01r7ykp.js";import{fs}from"./studio-gkskhg7m.js";import{ga}from"./studio-qv1pwd3c.js";import{D,Xl,vt}from"./studio-yn9f8vtx.js";import{me}from"./studio-pre0skq6.js";async function Xf(){if(yb(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let n=ya({status:"Running bun install…",title:"Installing dependencies"});try{let o=await e.installDependencies();if(o.ok)return n.done(),!0;n.fail(o.log??"bun install failed")}catch(o){n.fail(o instanceof Error?o.message:String(o))}return!1}var Be=["page","component"],Ge={components:"component",pages:"page"};function _(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ke(e){let t=_(e).toLowerCase();for(let[n,o]of Object.entries(Ge))if(t.startsWith(`${n}/`))return o;return null}function ee(e){return Be.some((t)=>e.includes(t))}function Ye(e){let t=D?.projectConfig?.layout;if(typeof t!=="string")return!1;return _(t).toLowerCase()===_(e).toLowerCase()}function ge(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let n of ol(e)){let o=Ys(n,"parse");if(o&&Ys(n,"serialize"))t.push({ext:n,label:`${o.name} (${n})`})}return t}function we(){return new Set([".json",...zp().flatMap((e)=>e.extensions)])}function Lw(e){if(e===null||e===void 0||e==="")return[];let t=Ke(e);if(t===null||Ye(e)||Jx(e))return[];let n=Qt(e);if(!(n?Boolean(n.capabilities.parse)&&ee(n.documentKinds):_(e).toLowerCase().endsWith(".json")))return[];let r=[];if(n)r.push({ext:".json",label:"JSON (.json)"});for(let a of ol()){let i=Ys(a,"serialize");if(!i||i.name===n?.name||!ee(i.documentKinds)||!i.documentKinds.includes(t))continue;r.push({ext:a,label:`${i.name} (${a})`})}return r}function _E(){let e=new Set([".json"]);for(let t of zp()){if(!t.capabilities.serialize||!ee(t.documentKinds))continue;for(let n of t.extensions)e.add(n)}return[...e].toSorted()}var oe="jx-studio-recent-projects",ye="jx-studio-recent-files",ve=8,Qe=10,M=[];function V(){if(!Ve())return null;let e=p();return e.getRecentProjects&&e.saveRecentProjects?e:null}function Xe(){try{let e=localStorage.getItem(oe);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function re(){return V()?M:Xe()}function be(e){M=e;let t=V();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(oe,JSON.stringify(e))}catch{}}async function SE(){let e=V();if(!e)return;try{M=await e.getRecentProjects()}catch{M=[]}}function pb(){return re().toSorted((e,t)=>t.timestamp-e.timestamp)}function fb(e,t){let n=re().filter((o)=>o.root!==t);if(n.unshift({name:e,root:t,timestamp:jr()}),n.length>ve)n.length=ve;be(n)}function Rw(e){be(re().filter((t)=>t.root!==e))}function CE(){M=[];let e=V();if(e)e.saveRecentProjects([]);else localStorage.removeItem(oe)}function xe(){try{let e=localStorage.getItem(ye);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function kE(e){let t=xe().toSorted((n,o)=>o.timestamp-n.timestamp);return e==null?t:t.filter((n)=>n.root===e)}function Qf(e){let t=xe().filter((r)=>!(r.root===e.root&&r.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:jr()});let n=new Map,o=[];for(let r of t.toSorted((a,i)=>i.timestamp-a.timestamp)){let a=(n.get(r.root)??0)+1;if(n.set(r.root,a),a<=Qe)o.push(r)}localStorage.setItem(ye,JSON.stringify(o))}var Pe={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",Pe);function Fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function J(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function et(e){let t=typeof e==="string"?void 0:e.attributes?.part;return typeof t==="string"?t:""}function nt(e){let n=e?.$map?.item;return typeof n?.path==="string"?n:null}function je(e,t,n){let o=y({...J(),...n});Fe(o,t);let r=null,a=!1,i=I("files-panel",o,e,{onNodeCreated:(s,l,c,d)=>{if(a||!(s instanceof HTMLElement))return;let F=et(c);if(F==="tree"){n.treeHost(s);return}if(F!=="row")return;let v=nt(d);if(v)n.rowHost(s,v.path,v.type)}}).then((s)=>{if(a){s.dispose();return}r=s});return{connected:()=>!a&&(r===null||r.root.parentNode===e),dispose(){a=!0,r?.dispose(),r=null},ready:i,update:(s)=>{Fe(o,s)}}}async function $r(e){if(!D)return;try{let t=p(),[n]=await Promise.all([Ao(()=>t.listDirectory(e)),sT(e)]);D.dirs.set(e,n)}catch{D.dirs.set(e,[])}}function pe(){return Oo(St.showIgnoredFiles)==="true"}function ot(e){Xo(St.showIgnoredFiles,e?"true":"")}async function fS(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:n,info:o}=t;if(Jd(),Kt(),rl(e),Uu(),Rp(),Xl({dirs:new Map,expanded:new Set,isSiteProject:o.isSiteProject,name:o.isSiteProject?o.projectConfig?.name||n.name:n.name,projectConfig:(o.isSiteProject?o.projectConfig:null)||null,projectDirs:o.directories||[],projectRoot:".",root:n.root,searchQuery:"",selectedPath:null}),o.isSiteProject)nl(n.root||".",o.projectConfig||null);if(o.isSiteProject){if(fb(vt().name,n.root),await gp(),await Xf())Jd(),await Kt(),rl(e);await $r("."),await zl(),await em(),mp(n.root)}}catch{}}async function mS({renderLeftPanel:e}){try{let t=p(),n=await t.openProject();if(!n)return!1;let{config:o,handle:r}=n;if(b1({document:{children:[],tagName:"div"},id:"initial"}),oT(),Jd(),Kt(),rl(t),Uu(),Rp(),Xl({...D,dirs:new Map,expanded:new Set,isSiteProject:!0,name:o.name||r.name,projectConfig:o,projectRoot:r.root,searchQuery:"",selectedPath:null}),nl(r.root,o),await gp(),await Xf())Jd(),await Kt(),rl(t);await $r("."),await zl();let a=new Set(["pages","layouts","components","content","data","public","styles"]),i=vt().dirs.get(".")||[],s=[];for(let l of i)if(l.type==="directory"&&a.has(l.name))s.push(l.name),vt().expanded.add(l.path||l.name),await $r(l.path||l.name);return vt().projectDirs=s,nm(),py(),ws("files"),fb(vt().name,vt().projectRoot),e(),await em(),mp(vt().projectRoot),!0}catch(t){return C.error("Could not open the project.",{detail:te(t),source:"Open Project"}),!1}}async function gS(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(n){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:te(n),source:"Source Control"}),!1}}async function $w(){await Kt();let e=[...ol("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let n=new Set(t.filter((o)=>o.type==="file").map((o)=>o.name));for(let o of e)if(n.has(`index${o}`))return`pages/index${o}`;return null}async function rt(){let e=await $w();if(e)await Ir(e)}async function em(){let e=yL(m.projectRoot);if(hy(m.projectRoot),e){if(await mL(e,{ensureSecondPane:()=>{Jl(ti)},openFile:(n,o)=>Ir(n,{focus:!1,paneId:o})})>0)return!0}return await rt(),!1}function at(e,t,n){if(t==="directory")return n?"folder-open":"folder";let o=e.split(".").pop()?.toLowerCase();switch(o){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return o!==void 0&&gy(o)?"image":"file"}}function bS(){return tt}function yS(e){}var it=24,u=[],A=null,L=new Map,B=null,Se=null;function ue(){for(let e of L.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return it}function st(){for(let[e,t]of L)if(!t.isConnected)L.delete(e),Oe(t)}function Re(e){let t=L.get(e);return t?.isConnected===!0?t:null}function X(e){return u.find((t)=>!t.loading&&t.path===e)}function ke(e,t,n,o){let r=vt().dirs.get(e);if(!r){$r(e).then(()=>f()),n.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let a=[...r].toSorted((c,d)=>{if(c.type==="directory"&&d.type!=="directory")return-1;if(c.type!=="directory"&&d.type==="directory")return 1;return c.name.localeCompare(d.name)}),i=pe()?a:a.filter((c)=>!aT(e,c.path,c.type==="directory")),s=vt().searchQuery.toLowerCase(),l=s?i.filter((c)=>c.type==="directory"||c.name.toLowerCase().includes(s)):i;for(let[c,d]of l.entries()){let v=d.type==="directory"&&vt().expanded.has(d.path);if(n.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:nh(d.path,o)??void 0,posInSet:c+1,setSize:l.length,type:d.type}),v)ke(d.path,t+1,n,o)}}function Ee(e){return e===void 0?-1:u.findIndex((t)=>!t.loading&&t.path===e)}function q(e,t){for(let n=e+t;n>=0&&n<u.length;n+=t)if(!u[n].loading)return n;return-1}function lt(e){let t=u[e];if(!t)return-1;for(let n=e-1;n>=0;n--){let o=u[n];if(!o.loading&&o.depth<t.depth)return n}return-1}function ct(){if(A?.isConnected!==!0||O!=="")return;queueMicrotask(f)}function ie(){let e=A;if(e===null)return;B=bb(B,e,{count:()=>u.length,onChange:ct,rowHeight:ue})}function dt(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:at(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":hn(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function pt(){if(st(),!D){u=[];let s={...J(),view:"none"};return P=s,s}if(!D.isSiteProject&&D.projectRoot==="."){u=[];let s={...J(),view:"welcome"};return P=s,s}let e=vt();u=[];let{i18n:t}=Or(e.projectConfig??{});ke(".",0,u,t);let n=mb(A,{count:u.length,rowHeight:ue()}),o=u.slice(n.start,n.end),r=(e.selectedPath!==null&&X(e.selectedPath)?e.selectedPath:"")||o.find((s)=>!s.loading)?.path||"",a=pe(),i={currentPath:r,dragPath:O,dropPath:W,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:a?"eye":"eye-slash",ignoredLabel:a?"Hide ignored files":"Show ignored files",ignoredSelected:a,padBottom:n.padBottom,padTop:n.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:Z,rows:o.map((s)=>dt(s)),selectedPath:e.selectedPath??"",view:"tree"};return P=i,i}function se(){if(!w||!P)return;P={...P,dragPath:O,dropPath:W,rootDrop:Z},w.handle.update(P)}function f(){Se?.()}async function ut(){let e=vt();e.dirs.clear(),Uu(),await $r(".");for(let t of e.expanded)await $r(t);f()}function ft(e){let t=X(e);if(!t)return;if(t.type==="directory"){Ce(e).then(()=>f());return}Ir(e)}function ht(e,t){let n=vt();if(X(e)?.type!=="directory"||n.expanded.has(e)===t)return;if(!t){n.expanded.delete(e),f();return}Ce(e).then(()=>f())}function Te(e){if(!D||vt().selectedPath===e)return;vt().selectedPath=e,f()}function mt(e,t){let n=Ee(e),o;switch(t){case"Home":{o=q(-1,1);break}case"End":{o=q(u.length,-1);break}case"ArrowUp":{o=q(n,-1);break}case"ArrowLeft":{o=lt(n);break}case"ArrowDown":case"ArrowRight":{o=q(n,1);break}default:return}De(o)}function gt(e,t){let n=Ee(e),o=u.length;for(let r=1;r<=o;r++){let a=(n+r+o)%o,i=u[a];if(i&&!i.loading&&i.name.trim().toLowerCase().startsWith(t)){De(a);return}}}function De(e){let t=u[e];if(!t)return;if(Te(t.path),Re(t.path))return;gb(A,e,ue()),f()}async function Ce(e){let t=vt();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await $r(e)}var z=new Map,G=null,O="",K="",W="",Y=!1,Z="";function wt(e){return[...e.dataTransfer?.types??[]].includes("Files")}function Ne(e,t,n){let o=(i)=>{if(!wt(i))return;if(i.preventDefault(),i.stopPropagation(),i.dataTransfer)i.dataTransfer.dropEffect="copy";n(!0)},r=()=>n(!1),a=(i)=>{n(!1);let s=i.dataTransfer?.files;if(!s?.length)return;i.preventDefault(),i.stopPropagation(),Le(s,t,f)};return e.addEventListener("dragover",o),e.addEventListener("dragleave",r),e.addEventListener("drop",a),()=>{e.removeEventListener("dragover",o),e.removeEventListener("dragleave",r),e.removeEventListener("drop",a)}}function le(e,t){let n=e.replaceAll("\\","/"),o=t.replaceAll("\\","/");if(!n||n===o)return!1;if(n.startsWith(`${o}/`)||o.startsWith(`${n}/`))return!1;return Q(n)!==o}function ae(e,t,n){return n==="directory"&&typeof e==="string"&&le(e,t)}function N(e,t){let n=t?e:"";if(K===e&&W===n)return;K=e,W=n,Ie()}function U(e){if(Y===e)return;Y=e,Ie()}function Ie(){Z=Y&&K===""?"true":"",se()}async function Le(e,t,n){if((await tl([...e],{dir:t})).length===0)return;if(t!==".")vt().expanded.add(t);n()}function yt(e,t){let n=document.createElement("input");n.type="file",n.multiple=!0,n.accept=Oc(),n.addEventListener("change",()=>{if(n.files?.length)Le(n.files,e,t)}),n.click()}function bt(e,t,n){Oe(e),L.set(t,e);let o=[_s({element:e,getInitialData(){return{entryType:n,path:t,type:"file-tree"}},onDragStart(){O=t,se()},onDrop(){O="",N("",!1),se()}}),Ne(e,n==="directory"?t:Q(t),(r)=>{N(r?t:"",r)}),Ks({canDrop({source:r}){return r.data.type==="file-tree"},element:e,getData({source:r}){return ae(r.data.path,t,n)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:r}){N(t,ae(r.data.path,t,n))},onDragEnter({source:r}){N(t,ae(r.data.path,t,n))},onDragLeave(){N("",!1)},onDrop(){N("",!1)}})];z.set(e,xo(...o))}function Oe(e){let t=z.get(e);if(t)t(),z.delete(e)}function xt(e){if(G?.element===e)return;Ae(),A=e;let t=Ks({canDrop({source:o}){return o.data.type==="file-tree"&&le(o.data.path,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){U(!0)},onDragLeave(){U(!1)},onDrop(){U(!1)}}),n=Js({onDrop({source:o,location:r}){let[a]=r.current.dropTargets;if(!a)return;if(o.data.type!=="file-tree")return;if(a.data.type!=="file-tree-target")return;let i=o.data.path,s=a.data.targetDir;if(!le(i,s))return;let l=i.split("/").pop(),c=s==="."?l:`${s}/${l}`;Ft(i,c,f)}});G={cleanup:xo(t,n,Ne(e,".",U)),element:e},ie()}function Ae(){G?.cleanup(),G=null;for(let e of z.values())e();z.clear(),B?.window.destroy(),B=null,A=null,O="",K="",W="",Y=!1,Z=""}async function Ft(e,t,n){let o=p();Vs(e,t);try{let r=await o.renameFile(e,t);xa();for(let[s]of m.tabs.entries())if(s===e)Wy(e,t,t);else if(s.startsWith(`${e}/`)){let l=t+s.slice(e.length);Wy(s,l,l)}let a=Q(e),i=Q(t);if(await $r(a),i!==a)await $r(i);if(i!==".")vt().expanded.add(i);ze(r,t),n(),EE(`Moved to ${t}`,r,t)}catch(r){C.error(`Could not move ${e}.`,{detail:te(r),path:e,source:"Files"})}}function Q(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return n===-1?".":t.slice(0,n)}var H=null;function Me(){H?.close(),H=null}function jt(e){let t={};if(e.type==="directory"){let n=Op(e.path);if(n?.isSourceRoot===!0&&!n.fileBacked)t.name=n.name;return t}if(t.file=e.path,ga(e.path))t.path=e.path;if(Lw(e.path).length>0)t.source=e.path;return t}function S(e,t,n,o={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:n,title:t,...o}}function $t(e){let t=ne();if(!t)return[];let n=jt(e),o=[];for(let r of t.forPlacement("context/file")){let a=r.args;if(!(a?.required??[]).every((l)=>(l in n)))continue;let i={};for(let l of Object.keys(a?.properties??{}))if(l in n)i[l]=n[l];let s=t.disabledReason(r.id);o.push(s===void 0?S(r.id,r.title,()=>{sn(t,r.id,i,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:r.id,requires:s,title:r.title})}return o}function Rt(e){let t=e.type==="directory",n=[];if(t){if(n.push(S("files.newFile","New File…",()=>{He(e.path,f)}),S("files.upload","Upload Files…",()=>{yt(e.path,f)})),e.path==="pages"||e.path.endsWith("/pages"))n.push(S("files.pagesGrid","Edit Pages in Grid",()=>{VS()}))}else n.push(S("files.open","Open",()=>{Ir(e.path)}));return n.push(...$t(e),S("files.rename","Rename…",()=>{It(e,f)},{dividerAbove:!0}),S("files.delete","Delete",()=>{Lt(e,f)},{destructive:!0})),n}function kt(e,t,n){let o=X(e);if(!o)return;Me();let r=Re(e);H=Pt({label:"File actions",onClosed:(a)=>{if(H===a)H=null},opener:r,origin:{x:t,y:n},region:"files",rows:Rt({name:o.name,path:o.path,type:o.type})})}var Et=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2),R="__other__";function $e(e){return e.trim().toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d-]/g,"")}function ce(e){let t=e.lastIndexOf(".");return t>0?e.slice(t):""}function Tt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Ys(e.ext)?.name??e.ext} (${e.ext})`}]:ge(e.docKind)).map((n)=>({label:n.label,value:n.ext})),{dividerBefore:!0,label:"Other…",value:R}]}function Dt(e,t,n){let o=e.kind==="choose"?e.defaultExt:e.ext;if(o!==void 0&&t.some((a)=>a.value===o))return o;let r=ce(n);if(r!==""&&t.some((a)=>a.value===r))return r;return t[0]?.value??R}async function Iw(e){let{dir:t,format:n,source:o="Files"}=e;await Kt();let r=new Set;try{let g=await p().listDirectory(t);r=new Set(g.map((h)=>h.name.toLowerCase()))}catch{}let a=n!==void 0&&n.kind!=="fixed"?n:null,i=a===null?null:Tt(a),s=a===null||i===null?"":Dt(a,i,e.suggestedName??""),l=(g,h)=>{let b=g.trim();if(n===void 0||h===R)return b;if(n.kind==="fixed"){let x=$e(b);return x===""?"":`${x}${n.ext}`}return b.toLowerCase().endsWith(h.toLowerCase())?b:`${b}${h}`},c=we(),d=(g,h)=>{let b=g.trim();if(!b)return n?.kind==="fixed"?"Enter a name.":"Enter a file name.";if(n?.kind==="fixed"&&$e(b)==="")return"Enter at least one letter or number.";let x=b.replaceAll("\\","/");if(x.startsWith("/")||x.endsWith("/"))return"Enter a name, not a path that starts or ends with a slash.";if(x.split("/").includes(".."))return"A name cannot step outside the destination folder.";if(x.includes("/")&&n!==void 0&&h!==R)return`Pick Other… to create a file in a subfolder of ${t==="."?"the project root":t}.`;let j=ce(x);if(h!==""&&h!==R&&j!==""&&j.toLowerCase()!==h.toLowerCase()&&c.has(j.toLowerCase()))return`You picked ${i?.find((Ue)=>Ue.value===h)?.label??h}; this name ends in ${j}.`;if(n?.kind==="locked"&&h===R){if(j!==""&&j.toLowerCase()!==n.ext.toLowerCase()&&c.has(j.toLowerCase()))return n.because}let he=l(g,h);return r.has(he.toLowerCase())?`${he} already exists in ${t}/.`:""},F=s,v=await Pn(e.title??"New File",{...i===null?{}:{choice:{initial:s,label:"Format",onChange:(g)=>{F=g},options:()=>i}},confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,...e.suggestedName===void 0?{}:{placeholder:e.suggestedName},select:i===null?"stem":"all",validate:d,value:e.suggestedName??"untitled.json"});if(!v)return null;let k=l(v,F),E=t==="."?k:`${t}/${k}`;Vs(E);let fe=Qt(k),We=typeof e.content==="function"?await e.content(ce(k),k):e.content,_e=n!==void 0&&F!==R,Je=We??fe?.studio?.newFileTemplate??(fe?"":k.toLowerCase().endsWith(".json")?_e?Et:`{}
2
+ `:"");try{return await p().writeFile(E,Je),await $r(t),C.success(`Created ${E}`),E}catch(g){return C.error(`Could not create ${E}.`,{detail:te(g),path:E,source:o}),null}}async function He(e,t){await Kt();let n=Op(e);if(n?.unresolvedFormat!=null)C.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${n.name}" content type declares format "${n.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let o=n?.ext!=null&&n.unresolvedFormat===null,r=o&&n.isSourceRoot&&n.def.schema!==void 0,a;if(r){let{createEntry:i}=await (me("t0k1q0kx"),import("./entry-commands-t0k1q0kx.js"));a=await i(n.name,{dir:e})}else a=await Iw({dir:e,format:o&&n.ext!==null?{because:`${n.name} entries are ${n.ext} files, so a document of another format here would not be one.`,ext:n.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(a!==null)t()}async function Ct(e,t){let n=await um(t);return Pn("Rename",{confirmLabel:"Rename",...n===void 0?{}:{message:n},select:"stem",validate:(o)=>o.trim()?"":"Enter a file name.",value:e})}function Nt(e,t){let n=t.references,o=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(n&&n.refsUpdated>0)return`Renamed to ${e}; updated ${n.refsUpdated} reference(s) in ${n.filesChanged} file(s)${o}`;if(o)return`Renamed to ${e}${o}`;return`Renamed to ${e}`}function EE(e,t,n){let o=t.errors??[];if(o.length===0){C.success(e);return}let r=o.length===1?"1 file":`${o.length} files`;C.warn(`${e} — references in ${r} could not be updated`,{detail:o.map((a)=>`${a.path}: ${a.error}`).join(`
3
+ `),path:n,source:"Files"})}function ze(e,t){for(let n of e.references?.files??[])if(n.path!==t&&m.tabs.has(n.path))fp(n.path)}function de(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function yI(e,t,n){xa();let o=de(e),r=de(t);if(await $r(o),r!==o)await $r(r);if(vt().selectedPath===e)vt().selectedPath=t;ze(n,t)}async function It(e,t){let n=await Ct(e.name,e.path);if(!n||n===e.name)return;let o=de(e.path),r=o==="."?n:`${o}/${n}`;Vs(e.path,r);try{let i=await p().renameFile(e.path,r);if(m.tabs.has(e.path))Wy(e.path,r,r);await yI(e.path,r,i),t(),EE(Nt(n,i),i,r)}catch(a){C.error(`Could not rename ${e.name}.`,{detail:te(a),path:e.path,source:"Files"})}}async function Lt(e,t){if(!await dm(e))return;try{let o=p();Vs(e.path),await o.deleteFile(e.path),xa();let r=e.path.replaceAll("\\","/"),a=r.includes("/")?r.slice(0,r.lastIndexOf("/")):".";if(await $r(a),vt().selectedPath===e.path)vt().selectedPath=null;t(),C.success(`Deleted ${e.name}`)}catch(o){C.error(`Could not delete ${e.name}.`,{detail:te(o),path:e.path,source:"Files"})}}function Ot(e,t){let n=t.paneId,o=ah(e);if(n!==void 0&&o){if(o.activeTabId===e&&t.focus===!1)return;Fm(e,n)}ui(e,{focus:t.focus!==!1})}async function Ir(e,t={}){let n=t.focus!==!1;for(let[r,a]of m.tabs.entries())if(a.documentPath===e){if(Ot(r,t),n)vt().selectedPath=e;return}if(Pw(e)){if(IE(e,t),n)vt().selectedPath=e;Qf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await YE(e,t),n)vt().selectedPath=e;Qf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot})}catch(r){C.error(`Could not open ${e}.`,{detail:te(r),path:e,source:"Open File"})}return}let o=p();try{let r=await o.readFile(e);if(!r){if(await Kt(),!Qt(e)&&!e.toLowerCase().endsWith(".json"))throw Up(e);return}await Kt();let a,i,s=null,l=Qt(e);if(l){let d=await Do(e,r);({document:a}=d),{frontmatter:i}=d}else if(e.endsWith(".json"))({document:a,layout:s}=ys(r));else throw Up(e);if(Mr({id:e,documentPath:e,document:a,...i!=null&&{frontmatter:i},layout:s,sourceFormat:l?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1}}),n)vt().selectedPath=e;Qf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot})}catch(r){C.error(`Could not open ${e}.`,{detail:te(r),path:e,source:"Open File"})}}async function Dw(e,t){await Ir(t,{focus:!1,paneId:e,preview:!0})}function vS(e){if(Am(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){fp(e);return}}function wS(e){for(let t of e)fp(t,{onlyIfChanged:!0})}async function fp(e,t={}){for(let[,n]of m.tabs.entries())if(n.documentPath===e){let o=p(),r=n.doc.dirty,a=()=>!r&&n.doc.dirty||Am(e);try{let i=await o.readFile(e);if(!i)return;if(await Kt(),a())return;if(Qt(e)){let{document:s,frontmatter:l}=await Do(e,i);if(a())return;if(t.onlyIfChanged&&fs(s,n.doc.document)&&fs(l,n.doc.content.frontmatter))return;n.doc.document=s,n.doc.content.frontmatter=l}else if(e.endsWith(".json")){let s=ys(i);if(n.doc.layout=s.layout,t.onlyIfChanged&&fs(s.document,n.doc.document))return;n.doc.document=s.document}n.doc.dirty=!1}catch(i){C.error(`Could not reload ${e} after it changed on disk.`,{detail:te(i),key:`reload:${e}`,path:e,source:"Files"})}return}}function xS(){Kn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",render:()=>tt,afterRender:(e,t)=>{Mt(t,e.rerender)}})}var At={activate:ft,contextMenu:kt,expand:ht,move:mt,newFile:()=>{He(".",f)},openProject:()=>{sl("project.open",void 0,"Files")},refresh:()=>{ut()},rowHost:bt,search:(e)=>{vt().searchQuery=e,f()},select:Te,toggleIgnored:()=>{ot(!pe()),f()},treeHost:xt,typeahead:gt},w=null,P=null;function Mt(e,t){let n=e.querySelector(".panel-content")??e;if(Se=t,w&&(w.host!==n||!w.handle.connected()))Ht();let o=pt();if(w)w.handle.update(o);else{let r=je(n,o,At);w={handle:r,host:n},r.ready.then(ie)}queueMicrotask(ie)}function Ht(){Me(),w?.handle.dispose(),w=null,P=null,Ae(),L.clear(),u=[]}
4
+ export{Xf,Lw,_E,SE,pb,fb,Rw,CE,kE,Qf,$r,fS,mS,gS,$w,em,bS,yS,Iw,EE,yI,Ir,Dw,vS,wS,fp,xS};
5
5
 
6
- //# debugId=720B46F05E704E2364756E2164756E21
7
- //# sourceMappingURL=studio-zxp13sss.js.map
6
+ //# debugId=145979F2FAC6871F64756E2164756E21
7
+ //# sourceMappingURL=studio-kk7h30ne.js.map
@@ -1,5 +1,5 @@
1
- import{Bv,zv}from"./studio-cpxkgjrj.js";import{vu,me}from"./studio-v2bvmbjj.js";var r={document:Bv,project:zv},a={...r},c={document:null,project:null},u=!1;function i(n){return c[n]??=(async()=>{try{let{default:t}=await (me("nkxms0ay"),import("./2020-nkxms0ay.js").then((m)=>vu(m.default,1))),{default:e}=await (me("gybvv7a6"),import("./index-gybvv7a6.js").then((m)=>vu(m.default,1))),o=new t({allErrors:!0,strict:!1,allowUnionTypes:!0});return e(o),o.compile(a[n])}catch(t){if(!u)u=!0,console.error(`[jx] ${n} schema validation is unavailable — the AI assistant's schema gate is a `+"no-op for this session:",t);return null}})(),c[n]}function l(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).length>0?n:void 0}function b$(n){let t=l(n?.document)??r.document,e=l(n?.project)??r.project,o=t!==r.document||e!==r.project;if(t===a.document&&e===a.project)return o;return a.document=t,a.project=e,c.document=null,c.project=null,o}var m=["unevaluatedProperty","additionalProperty","missingProperty"];function s(n){return(n.errors||[]).map((t)=>{let e=m.find((d)=>typeof t.params?.[d]==="string"),o=e?` (${String(t.params?.[e])})`:"";return`${t.instancePath||"(root)"}: ${t.message}${o}`})}async function op(n){let t=await i("document");if(!t||t(n))return[];return s(t)}async function v$(n){let t=await i("document");if(!t)return null;return t(n)?[]:s(t)}async function ud(n){let t=await i("project");if(!t||t(n))return[];return s(t)}
2
- export{b$,op,v$,ud};
1
+ import{iv,rv}from"./studio-kggey1jt.js";import{$u,me}from"./studio-pre0skq6.js";var r={document:iv,project:rv},a={...r},c={document:null,project:null},u=!1;function i(n){return c[n]??=(async()=>{try{let{default:t}=await (me("va2wwra4"),import("./2020-va2wwra4.js").then((m)=>$u(m.default,1))),{default:e}=await (me("2veqmnhr"),import("./index-2veqmnhr.js").then((m)=>$u(m.default,1))),o=new t({allErrors:!0,strict:!1,allowUnionTypes:!0});return e(o),o.compile(a[n])}catch(t){if(!u)u=!0,console.error(`[jx] ${n} schema validation is unavailable — the AI assistant's schema gate is a `+"no-op for this session:",t);return null}})(),c[n]}function l(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).length>0?n:void 0}function DI(n){let t=l(n?.document)??r.document,e=l(n?.project)??r.project,o=t!==r.document||e!==r.project;if(t===a.document&&e===a.project)return o;return a.document=t,a.project=e,c.document=null,c.project=null,o}var m=["unevaluatedProperty","additionalProperty","missingProperty"];function s(n){return(n.errors||[]).map((t)=>{let e=m.find((d)=>typeof t.params?.[d]==="string"),o=e?` (${String(t.params?.[e])})`:"";return`${t.instancePath||"(root)"}: ${t.message}${o}`})}async function bp(n){let t=await i("document");if(!t||t(n))return[];return s(t)}async function NI(n){let t=await i("document");if(!t)return null;return t(n)?[]:s(t)}async function _d(n){let t=await i("project");if(!t||t(n))return[];return s(t)}
2
+ export{DI,bp,NI,_d};
3
3
 
4
- //# debugId=8F98FF90BD71CC4264756E2164756E21
5
- //# sourceMappingURL=studio-ecaz25vk.js.map
4
+ //# debugId=6FF22FC849020E8164756E2164756E21
5
+ //# sourceMappingURL=studio-kt1zqney.js.map
@@ -1,5 +1,5 @@
1
- var f=["order","widths","hidden","sort","groupBy","filter"];function c(){try{return globalThis.localStorage??null}catch{return null}}function d(t){let e=c()?.getItem("jx-grid-layout:"+t);if(!e)return null;try{let n=JSON.parse(e);return typeof n==="object"&&n!==null?n:null}catch{return null}}function a(t,e){c()?.setItem("jx-grid-layout:"+t,JSON.stringify(e))}function u(t){let e={};for(let n of f)if(t[n]!==void 0)Object.assign(e,{[n]:t[n]});return e}function v(t){return JSON.stringify(f.map((e)=>t[e]??null))}function cc(t){let e=d(t);return e?u(e):null}function Kh(t,e){if(!c())return;let i=d(t)??{},o={...i,widths:{...i.widths,...e.widths}};for(let r of f)if(r!=="widths"&&e[r]!==void 0)Object.assign(o,{[r]:e[r]});a(t,o)}function M_(t){let e=d(t);if(!e)return;a(t,{active:null,...e.views?{views:e.views}:{}})}function Jh(t){let e=d(t)?.views;return Array.isArray(e)?e.filter((n)=>typeof n?.name==="string"):[]}function Qy(t){return d(t)?.active??null}function HS(t){let e=d(t),n=e?.active;if(!e||!n)return!1;let i=Jh(t).find((o)=>o.name===n);return i?v(u(i))!==v(u(e)):!1}function BS(t,e){let n=e.trim(),i=c();if(n===""||!i)return null;let o=d(t)??{},r={name:n,...u(o)},s=Jh(t).filter((l)=>l.name!==n);return s.push(r),a(t,{...o,active:n,views:s}),r}function P_(t,e){let n=Jh(t).find((r)=>r.name===e);if(!n||!c())return null;let i=d(t)??{},o=u(n);return a(t,{active:n.name,views:i.views??[],...o}),o}function F_(t,e){let n=d(t);if(!n||!c())return!1;let i=Jh(t),o=i.filter((r)=>r.name!==e);if(o.length===i.length)return!1;return a(t,{...n,active:n.active===e?null:n.active??null,views:o}),!0}function zS(t,e){if(!e)return t;let n=new Set(e.hidden),i=[];for(let r of t){if(r.field!==void 0&&n.has(r.field))continue;let s=r.field?e.widths?.[r.field]:void 0;i.push(s?{...r,width:s}:r)}if(!e.order?.length)return i;let o=new Map(e.order.map((r,s)=>[r,s]));return i.map((r,s)=>({def:r,index:s})).toSorted((r,s)=>{let l=o.get(r.def.field??"")??e.order.length+r.index,w=o.get(s.def.field??"")??e.order.length+s.index;return l-w}).map(({def:r})=>r)}
2
- export{cc,Kh,M_,Jh,Qy,HS,BS,P_,F_,zS};
1
+ var f=["order","widths","hidden","sort","groupBy","filter"];function c(){try{return globalThis.localStorage??null}catch{return null}}function d(t){let e=c()?.getItem("jx-grid-layout:"+t);if(!e)return null;try{let n=JSON.parse(e);return typeof n==="object"&&n!==null?n:null}catch{return null}}function a(t,e){c()?.setItem("jx-grid-layout:"+t,JSON.stringify(e))}function u(t){let e={};for(let n of f)if(t[n]!==void 0)Object.assign(e,{[n]:t[n]});return e}function v(t){return JSON.stringify(f.map((e)=>t[e]??null))}function wc(t){let e=d(t);return e?u(e):null}function ap(t,e){if(!c())return;let i=d(t)??{},o={...i,widths:{...i.widths,...e.widths}};for(let r of f)if(r!=="widths"&&e[r]!==void 0)Object.assign(o,{[r]:e[r]});a(t,o)}function Z0(t){let e=d(t);if(!e)return;a(t,{active:null,...e.views?{views:e.views}:{}})}function lp(t){let e=d(t)?.views;return Array.isArray(e)?e.filter((n)=>typeof n?.name==="string"):[]}function fw(t){return d(t)?.active??null}function tE(t){let e=d(t),n=e?.active;if(!e||!n)return!1;let i=lp(t).find((o)=>o.name===n);return i?v(u(i))!==v(u(e)):!1}function nE(t,e){let n=e.trim(),i=c();if(n===""||!i)return null;let o=d(t)??{},r={name:n,...u(o)},s=lp(t).filter((l)=>l.name!==n);return s.push(r),a(t,{...o,active:n,views:s}),r}function X0(t,e){let n=lp(t).find((r)=>r.name===e);if(!n||!c())return null;let i=d(t)??{},o=u(n);return a(t,{active:n.name,views:i.views??[],...o}),o}function Q0(t,e){let n=d(t);if(!n||!c())return!1;let i=lp(t),o=i.filter((r)=>r.name!==e);if(o.length===i.length)return!1;return a(t,{...n,active:n.active===e?null:n.active??null,views:o}),!0}function iE(t,e){if(!e)return t;let n=new Set(e.hidden),i=[];for(let r of t){if(r.field!==void 0&&n.has(r.field))continue;let s=r.field?e.widths?.[r.field]:void 0;i.push(s?{...r,width:s}:r)}if(!e.order?.length)return i;let o=new Map(e.order.map((r,s)=>[r,s]));return i.map((r,s)=>({def:r,index:s})).toSorted((r,s)=>{let l=o.get(r.def.field??"")??e.order.length+r.index,w=o.get(s.def.field??"")??e.order.length+s.index;return l-w}).map(({def:r})=>r)}
2
+ export{wc,ap,Z0,lp,fw,tE,nE,X0,Q0,iE};
3
3
 
4
- //# debugId=3FED613AF75201E464756E2164756E21
5
- //# sourceMappingURL=studio-zygnmm01.js.map
4
+ //# debugId=5B66F6400744CFA264756E2164756E21
5
+ //# sourceMappingURL=studio-m3cwhvye.js.map
@@ -1,5 +1,5 @@
1
- function p(t){return JSON.parse(JSON.stringify(t))}function Ae(t){return t===void 0||t===null?t:p(t)}function Md(t,e){let n=t;for(let r of e){if(n==null)return;n=n[r]}return n}function Rc(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function Rm(t,e){switch(e.op){case"set-key":{let n=Md(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=n;if(e.value===void 0)delete r[e.key];else r[e.key]=Ae(e.value);return}case"insert-child":{let n=Md(t,e.parentPath);Rc(n).splice(e.index,0,Ae(e.node));return}case"remove-child":{let n=Md(t,e.parentPath);Rc(n).splice(e.index,1);return}case"set-child":{let n=Md(t,e.parentPath);Rc(n).splice(e.index,1,Ae(e.node));return}case"move-child":{x(e);let n=Md(t,e.fromParentPath),r=Md(t,e.toParentPath),o=Rc(n),a=Rc(r),[s]=o.splice(e.fromIndex,1);a.splice(e.toIndex,0,s);return}default:break}throw Error(`unknown-doc-op:${e.op}`)}function d(t,e,n,r,o){let a=t.length;if(!(a<e.length&&t.every((m,J)=>m===e[J]))||e[a]!=="children"||typeof e[a+1]!=="number")return e;let i=e[a+1];if(o?i<n:i<=n)return e;let c=[...e];return c[a+1]=i+r,c}function x(t){let e=[...t.fromParentPath,"children",t.fromIndex],n=t.toParentPath;if(n.length>=e.length&&e.every((r,o)=>r===n[o]))throw Error(`doc-op-move-into-self:${n.join("/")}`)}function h(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function dk(t,e){switch(e.op){case"set-key":{let n=Md(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=Ae(n[e.key]);return r===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:r}}case"insert-child":{let{length:n}=l(t,e.parentPath);return{index:h(e.index,n),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"set-child",parentPath:e.parentPath}}case"move-child":{x(e);let n=f(t,e.fromParentPath);P(n,e.fromParentPath,e.fromIndex);let r=l(t,e.toParentPath),o=h(e.toIndex,r.length-(r===n?1:0));return{fromIndex:o,fromParentPath:d(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:d(e.toParentPath,e.fromParentPath,o,1,!0)}}default:break}throw Error(`unknown-doc-op:${e.op}`)}function f(t,e){let n=Md(t,e);return n&&Array.isArray(n.children)?n.children:null}function P(t,e,n){if(!t||n<0||n>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",n].join("/")}`)}function u(t,e,n){let r=f(t,e);return P(r,e,n),Ae(r[n])}function l(t,e){let n=Md(t,e);if(!n||typeof n!=="object"||Array.isArray(n))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(n.children===void 0)return[];if(!Array.isArray(n.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return n.children}
2
- export{Ae,Md,Rc,Rm,dk};
1
+ function p(t){return JSON.parse(JSON.stringify(t))}function Oe(t){return t===void 0||t===null?t:p(t)}function Kd(t,e){let n=t;for(let r of e){if(n==null)return;n=n[r]}return n}function Bc(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function Vm(t,e){switch(e.op){case"set-key":{let n=Kd(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=n;if(e.value===void 0)delete r[e.key];else r[e.key]=Oe(e.value);return}case"insert-child":{let n=Kd(t,e.parentPath);Bc(n).splice(e.index,0,Oe(e.node));return}case"remove-child":{let n=Kd(t,e.parentPath);Bc(n).splice(e.index,1);return}case"set-child":{let n=Kd(t,e.parentPath);Bc(n).splice(e.index,1,Oe(e.node));return}case"move-child":{x(e);let n=Kd(t,e.fromParentPath),r=Kd(t,e.toParentPath),o=Bc(n),a=Bc(r),[s]=o.splice(e.fromIndex,1);a.splice(e.toIndex,0,s);return}default:break}throw Error(`unknown-doc-op:${e.op}`)}function d(t,e,n,r,o){let a=t.length;if(!(a<e.length&&t.every((m,J)=>m===e[J]))||e[a]!=="children"||typeof e[a+1]!=="number")return e;let i=e[a+1];if(o?i<n:i<=n)return e;let c=[...e];return c[a+1]=i+r,c}function x(t){let e=[...t.fromParentPath,"children",t.fromIndex],n=t.toParentPath;if(n.length>=e.length&&e.every((r,o)=>r===n[o]))throw Error(`doc-op-move-into-self:${n.join("/")}`)}function h(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function k1(t,e){switch(e.op){case"set-key":{let n=Kd(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=Oe(n[e.key]);return r===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:r}}case"insert-child":{let{length:n}=l(t,e.parentPath);return{index:h(e.index,n),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"set-child",parentPath:e.parentPath}}case"move-child":{x(e);let n=f(t,e.fromParentPath);P(n,e.fromParentPath,e.fromIndex);let r=l(t,e.toParentPath),o=h(e.toIndex,r.length-(r===n?1:0));return{fromIndex:o,fromParentPath:d(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:d(e.toParentPath,e.fromParentPath,o,1,!0)}}default:break}throw Error(`unknown-doc-op:${e.op}`)}function f(t,e){let n=Kd(t,e);return n&&Array.isArray(n.children)?n.children:null}function P(t,e,n){if(!t||n<0||n>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",n].join("/")}`)}function u(t,e,n){let r=f(t,e);return P(r,e,n),Oe(r[n])}function l(t,e){let n=Kd(t,e);if(!n||typeof n!=="object"||Array.isArray(n))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(n.children===void 0)return[];if(!Array.isArray(n.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return n.children}
2
+ export{Oe,Kd,Bc,Vm,k1};
3
3
 
4
- //# debugId=EE44201EF4CB98F864756E2164756E21
5
- //# sourceMappingURL=studio-2sqcndak.js.map
4
+ //# debugId=8028F619D324C0B964756E2164756E21
5
+ //# sourceMappingURL=studio-mcayt6hz.js.map