@jxsuite/studio 5.7.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/chunks/{2020-cs2sb9t1.js → 2020-nkxms0ay.js} +3 -3
  2. package/dist/chunks/adapter-m948ab5f.js +4 -0
  3. package/dist/chunks/{cf-account-picker-882a7ecm.js → cf-account-picker-n8hr38v7.js} +3 -3
  4. package/dist/chunks/cf-settings-356xdtne.js +4 -0
  5. package/dist/chunks/components-yk3t844e.js +4 -0
  6. package/dist/chunks/content-source-bawmyc09.js +4 -0
  7. package/dist/chunks/{convert-to-repeater-grfep2w8.js → convert-to-repeater-7wns8kf1.js} +3 -3
  8. package/dist/chunks/editor-6sc8nacq.js +4 -0
  9. package/dist/chunks/entry-commands-8ay9fh81.js +4 -0
  10. package/dist/chunks/{extension-sections-dp8endhx.js → extension-sections-na7rj3nr.js} +3 -3
  11. package/dist/chunks/file-ops-gye0qw56.js +4 -0
  12. package/dist/chunks/files-dmc2xvcq.js +4 -0
  13. package/dist/chunks/format-host-t76b53f8.js +4 -0
  14. package/dist/chunks/fs-events-cg4tpz06.js +4 -0
  15. package/dist/chunks/git-panel-yef7bshy.js +4 -0
  16. package/dist/chunks/{grid-view-5amhg604.js → grid-view-7tt4bxw1.js} +6 -6
  17. package/dist/chunks/iframe-host-tmz30gfp.js +4 -0
  18. package/dist/chunks/{index-9ydfe04y.js → index-gybvv7a6.js} +3 -3
  19. package/dist/chunks/index-nag78a9h.js +4 -0
  20. package/dist/chunks/{javascript-d9pqgc2p.js → javascript-rnvdp3k4.js} +2 -2
  21. package/dist/chunks/{jsonMode-800yvbem.js → jsonMode-zhwsprqk.js} +5 -5
  22. package/dist/chunks/jx-validate-3gbp5nkn.js +4 -0
  23. package/dist/chunks/layers-fvz99859.js +4 -0
  24. package/dist/chunks/layers-panel-gchmbf9p.js +4 -0
  25. package/dist/chunks/lit-html-9agdspkt.js +4 -0
  26. package/dist/chunks/media-picker-rhjvyy00.js +4 -0
  27. package/dist/chunks/menu-2e4y9j7b.js +4 -0
  28. package/dist/chunks/{monaco-binding-62dtmgbf.js → monaco-binding-2jnhjjvr.js} +3 -3
  29. package/dist/chunks/monaco-buffer-rp21359g.js +4 -0
  30. package/dist/chunks/{monaco-setup-tj13ndtm.js → monaco-setup-vhh7gayr.js} +3 -3
  31. package/dist/chunks/notify-h3www560.js +4 -0
  32. package/dist/chunks/platform-hz34wcd7.js +4 -0
  33. package/dist/chunks/publish-panel-exsmjzyj.js +4 -0
  34. package/dist/chunks/quick-search-pgaqeh0m.js +4 -0
  35. package/dist/chunks/references-2cgdxnb8.js +4 -0
  36. package/dist/chunks/right-panel-jf856w5w.js +4 -0
  37. package/dist/chunks/section-registry-jnf8r5gy.js +4 -0
  38. package/dist/chunks/studio-0f55h9ye.js +5 -0
  39. package/dist/chunks/{studio-hjbg8d5y.js → studio-0sqdhnew.js} +7 -7
  40. package/dist/chunks/{studio-1wvfxkyy.js → studio-0x3jyb8r.js} +4 -4
  41. package/dist/chunks/{studio-yr04mv2j.js → studio-19x1c75w.js} +4 -4
  42. package/dist/chunks/{studio-evwgp1ym.js → studio-2sqcndak.js} +4 -4
  43. package/dist/chunks/{studio-cvbkkfqb.js → studio-3aey7dd3.js} +4 -4
  44. package/dist/chunks/{studio-888knnkc.js → studio-3bpdkq2s.js} +4 -4
  45. package/dist/chunks/{studio-ceb34dxj.js → studio-47y6fbpf.js} +4 -4
  46. package/dist/chunks/{studio-c6w3tq7t.js → studio-4m3826v2.js} +4 -4
  47. package/dist/chunks/studio-4nx2dj1g.js +4 -0
  48. package/dist/chunks/{studio-p7c1agz0.js → studio-4xv5s47r.js} +5 -5
  49. package/dist/chunks/{studio-sxc0zvpt.js → studio-5g0ag7c0.js} +3 -3
  50. package/dist/chunks/{studio-semd1s8s.js → studio-5g4t8v6w.js} +4 -4
  51. package/dist/chunks/studio-5py436sf.js +5 -0
  52. package/dist/chunks/{studio-aje966s9.js → studio-77kt594t.js} +4 -4
  53. package/dist/chunks/{studio-56z7evx4.js → studio-8f87n763.js} +6 -6
  54. package/dist/chunks/studio-8mb00b84.js +5 -0
  55. package/dist/chunks/studio-8p51gq2h.js +6 -0
  56. package/dist/chunks/studio-954ds834.js +5 -0
  57. package/dist/chunks/{studio-xta2vxp6.js → studio-9ft45c83.js} +6 -6
  58. package/dist/chunks/studio-a2138x5k.js +7 -0
  59. package/dist/chunks/studio-a9yzstqj.js +5 -0
  60. package/dist/chunks/{studio-gp02nqnw.js → studio-acdksxx6.js} +4 -4
  61. package/dist/chunks/{studio-edbtvcd1.js → studio-anyrgzvb.js} +4 -4
  62. package/dist/chunks/{studio-dkn3x3hz.js → studio-ar8jcf2y.js} +4 -4
  63. package/dist/chunks/{studio-xry7tk3z.js → studio-bmn4mn9j.js} +5 -5
  64. package/dist/chunks/{studio-03wwfvyt.js → studio-cpxkgjrj.js} +4 -4
  65. package/dist/chunks/{studio-spf2skgc.js → studio-e7xxa0sj.js} +4 -4
  66. package/dist/chunks/{studio-01qza1n3.js → studio-ecaz25vk.js} +4 -4
  67. package/dist/chunks/{studio-5e9zsamh.js → studio-fzdywr6p.js} +6 -6
  68. package/dist/chunks/{studio-65fhspdd.js → studio-g5fmf0c1.js} +4 -4
  69. package/dist/chunks/studio-g7nse7zb.js +5 -0
  70. package/dist/chunks/studio-geq1ea6k.js +14 -0
  71. package/dist/chunks/{studio-n78gjfy8.js → studio-ghkb32r8.js} +4 -4
  72. package/dist/chunks/{studio-222rqyyc.js → studio-ghrhy2y7.js} +4 -4
  73. package/dist/chunks/{studio-a7xqhc3n.js → studio-grawhey1.js} +4 -4
  74. package/dist/chunks/{studio-eh0rac07.js → studio-h0xgswew.js} +4 -4
  75. package/dist/chunks/{studio-wma2c6g8.js → studio-h9c4p2tx.js} +4 -4
  76. package/dist/chunks/studio-jyzj5cxs.js +5 -0
  77. package/dist/chunks/{studio-x92tgnee.js → studio-mgx8yhnz.js} +31 -31
  78. package/dist/chunks/{studio-0scebvb9.js → studio-mpb04y1d.js} +5 -5
  79. package/dist/chunks/{studio-xy3tv3az.js → studio-n17mty64.js} +4 -4
  80. package/dist/chunks/{studio-gfn1kpxj.js → studio-nwh2eqsk.js} +5 -5
  81. package/dist/chunks/{studio-nt06yybj.js → studio-pxg4ap1e.js} +3 -3
  82. package/dist/chunks/{studio-zpnk016a.js → studio-q1h883bt.js} +5 -5
  83. package/dist/chunks/{studio-c6zdm25z.js → studio-q4tv82h7.js} +6 -6
  84. package/dist/chunks/{studio-st75kn99.js → studio-qbj760tx.js} +5 -5
  85. package/dist/chunks/{studio-y7jehjrp.js → studio-qpqa7vk3.js} +4 -4
  86. package/dist/chunks/{studio-j6gnhvaa.js → studio-qqz8e5gk.js} +4 -4
  87. package/dist/chunks/{studio-skzanb0k.js → studio-qvasen3f.js} +4 -4
  88. package/dist/chunks/studio-rggdb3hm.js +5 -0
  89. package/dist/chunks/{studio-4xppwncr.js → studio-sghy936h.js} +3 -3
  90. package/dist/chunks/{studio-9mqfamps.js → studio-skprc6ef.js} +4 -4
  91. package/dist/chunks/{studio-1x8x26k3.js → studio-tt2nactf.js} +4 -4
  92. package/dist/chunks/{studio-54g077x3.js → studio-txjjzrsm.js} +5 -5
  93. package/dist/chunks/{studio-f195h2hq.js → studio-tyasmc39.js} +4 -4
  94. package/dist/chunks/{studio-0bbxhhce.js → studio-v2bvmbjj.js} +4 -4
  95. package/dist/chunks/{studio-pwqfmt4p.js → studio-vk9ezads.js} +4 -4
  96. package/dist/chunks/{studio-fqq890ap.js → studio-vzacdfsc.js} +3 -3
  97. package/dist/chunks/{studio-zd4kayn2.js → studio-w4c0xmrw.js} +4 -4
  98. package/dist/chunks/{studio-tw7rre6s.js → studio-wfjqhhbk.js} +4 -4
  99. package/dist/chunks/{studio-tp642n5g.js → studio-wgh5kxpj.js} +4 -4
  100. package/dist/chunks/studio-xasj0796.js +5 -0
  101. package/dist/chunks/{studio-tzegmy4w.js → studio-y78s8r2n.js} +4 -4
  102. package/dist/chunks/{studio-7pgy3xaf.js → studio-z8w183sh.js} +4 -4
  103. package/dist/chunks/{studio-01kbbqg3.js → studio-zscd9ty4.js} +124 -124
  104. package/dist/chunks/{studio-mwxgyn9h.js → studio-zxp13sss.js} +6 -6
  105. package/dist/chunks/{studio-r3kaka4d.js → studio-zygnmm01.js} +4 -4
  106. package/dist/chunks/{tsMode-k9s9fcag.js → tsMode-gr0m4dzr.js} +5 -5
  107. package/dist/chunks/workspace-m15qtcqp.js +4 -0
  108. package/dist/chunks/{ws-client-0ja08haa.js → ws-client-nf61frr1.js} +3 -3
  109. package/dist/iframe-entry.js +3 -3
  110. package/dist/manifest.json +62 -62
  111. package/dist/studio.js +83 -83
  112. package/package.json +11 -11
  113. package/src/new-project/add-repo-modal.ts +459 -59
  114. package/src/platforms/cloud.ts +95 -18
  115. package/src/publish/pages-service.ts +7 -0
  116. package/src/publish/publish-panel.ts +16 -2
  117. package/src/surfaces/add-repo.json +721 -224
  118. package/src/surfaces/add-repo.ts +196 -31
  119. package/src/types.ts +42 -3
  120. package/src/ui/schema-form.ts +6 -2
  121. package/src/utils/project-dir.ts +24 -0
  122. package/dist/chunks/adapter-y5gdq19c.js +0 -4
  123. package/dist/chunks/cf-settings-20dznc3j.js +0 -4
  124. package/dist/chunks/components-q037dya7.js +0 -4
  125. package/dist/chunks/content-source-37x3vsap.js +0 -4
  126. package/dist/chunks/editor-j5sq149q.js +0 -4
  127. package/dist/chunks/entry-commands-c5h3nqck.js +0 -4
  128. package/dist/chunks/file-ops-937cvqk6.js +0 -4
  129. package/dist/chunks/files-tznwe1p1.js +0 -4
  130. package/dist/chunks/format-host-e2pjvd25.js +0 -4
  131. package/dist/chunks/fs-events-fv64ak3s.js +0 -4
  132. package/dist/chunks/git-panel-gb713ttc.js +0 -4
  133. package/dist/chunks/iframe-host-t819mcg5.js +0 -4
  134. package/dist/chunks/index-m0x5ztax.js +0 -4
  135. package/dist/chunks/jx-validate-zc9zp77s.js +0 -4
  136. package/dist/chunks/layers-4bsr82wz.js +0 -4
  137. package/dist/chunks/layers-panel-b6shnaax.js +0 -4
  138. package/dist/chunks/lit-html-cfn61dn7.js +0 -4
  139. package/dist/chunks/media-picker-ej0kdh1j.js +0 -4
  140. package/dist/chunks/menu-rtxf9chb.js +0 -4
  141. package/dist/chunks/monaco-buffer-nn4dtx27.js +0 -4
  142. package/dist/chunks/notify-ahs57a2z.js +0 -4
  143. package/dist/chunks/platform-v9xyfkbx.js +0 -4
  144. package/dist/chunks/publish-panel-bq36xcmj.js +0 -4
  145. package/dist/chunks/quick-search-zm00h9dh.js +0 -4
  146. package/dist/chunks/references-99ws0b0m.js +0 -4
  147. package/dist/chunks/right-panel-pq2f71q3.js +0 -4
  148. package/dist/chunks/section-registry-b2yzp9sw.js +0 -4
  149. package/dist/chunks/studio-0k9mvpgj.js +0 -14
  150. package/dist/chunks/studio-1a99w39s.js +0 -5
  151. package/dist/chunks/studio-693nhyky.js +0 -5
  152. package/dist/chunks/studio-aqmph6k4.js +0 -5
  153. package/dist/chunks/studio-c9d3pxf7.js +0 -5
  154. package/dist/chunks/studio-cxt150pj.js +0 -7
  155. package/dist/chunks/studio-e6re3rk1.js +0 -5
  156. package/dist/chunks/studio-frb0qbf7.js +0 -6
  157. package/dist/chunks/studio-gh97gngt.js +0 -5
  158. package/dist/chunks/studio-nbxqcgvf.js +0 -5
  159. package/dist/chunks/studio-t1eedsyx.js +0 -4
  160. package/dist/chunks/studio-vavmwshr.js +0 -5
  161. package/dist/chunks/studio-xk0z6msk.js +0 -5
  162. package/dist/chunks/workspace-b69mgm0e.js +0 -4
@@ -1,7 +1,7 @@
1
- import{tt}from"./studio-sxc0zvpt.js";import{te}from"./studio-ery42sqr.js";import{ne}from"./studio-0k9mvpgj.js";import{T,R,on,Rc,Nn}from"./studio-spf2skgc.js";import{v,Mo,k}from"./studio-fqq890ap.js";import{p,We}from"./studio-y7jehjrp.js";import{qt,Md,Ga,Tp,Vs,Lp,Zt,Ka}from"./studio-1x8x26k3.js";import{ua}from"./studio-yr04mv2j.js";import{Ir,pp}from"./studio-888knnkc.js";import{dn,$o,zu,wm,bp,Ax,Qn,m,Gu,Pl,Ua,No,ek,ci,Cm,Sv}from"./studio-cvbkkfqb.js";import{$u,WE,VE,Ps}from"./studio-9mqfamps.js";import{_t,Lr,qr}from"./studio-semd1s8s.js";import{hs,XT,tL,Yb,fs,Zb}from"./studio-zpnk016a.js";import{la}from"./studio-xta2vxp6.js";import{qn}from"./studio-xry7tk3z.js";import{Dl}from"./studio-pwqfmt4p.js";import{gr,zs,Ws,gs}from"./studio-st75kn99.js";import{ib,tp,np,ww,fE,Bf}from"./studio-j6gnhvaa.js";import{_c,ev,Va}from"./studio-c6w3tq7t.js";import{AE,E1}from"./studio-56z7evx4.js";import{zE,Er,Jf,Yf}from"./studio-skzanb0k.js";import{Nt}from"./studio-nt06yybj.js";import{eb,tb,nb}from"./studio-zd4kayn2.js";import{ls}from"./studio-tzegmy4w.js";import{sa}from"./studio-e6re3rk1.js";import{D,Hl,vt}from"./studio-tp642n5g.js";import{me}from"./studio-0bbxhhce.js";async function Pf(){if(ib(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 Ka(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",...Tp().flatMap((e)=>e.extensions)])}function hw(e){if(e===null||e===void 0||e==="")return[];let t=Ke(e);if(t===null||Ye(e)||Ax(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 Ka()){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 rE(){let e=new Set([".json"]);for(let t of Tp()){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 sE(){let e=V();if(!e)return;try{M=await e.getRecentProjects()}catch{M=[]}}function Xg(){return re().toSorted((e,t)=>t.timestamp-e.timestamp)}function Qg(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 pw(e){be(re().filter((t)=>t.root!==e))}function aE(){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 lE(e){let t=xe().toSorted((n,o)=>o.timestamp-n.timestamp);return e==null?t:t.filter((n)=>n.root===e)}function Ff(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)),WE(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 Z_(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:n,info:o}=t;if(Md(),qt(),Ga(e),$u(),pp(),Hl({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)Ua(n.root||".",o.projectConfig||null);if(o.isSiteProject){if(Qg(vt().name,n.root),await np(),await Pf())Md(),await qt(),Ga(e);await To("."),await Dl(),await jf(),tp(n.root)}}catch{}}async function X_({renderLeftPanel:e}){try{let t=p(),n=await t.openProject();if(!n)return!1;let{config:o,handle:r}=n;if(ek({document:{children:[],tagName:"div"},id:"initial"}),zE(),Md(),qt(),Ga(t),$u(),pp(),Hl({...D,dirs:new Map,expanded:new Set,isSiteProject:!0,name:o.name||r.name,projectConfig:o,projectRoot:r.root,searchQuery:"",selectedPath:null}),Ua(r.root,o),await np(),await Pf())Md(),await qt(),Ga(t);await To("."),await Dl();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,Bf(),Zb(),fs("files"),Qg(vt().name,vt().projectRoot),e(),await jf(),tp(vt().projectRoot),!0}catch(t){return k.error("Could not open the project.",{detail:te(t),source:"Open Project"}),!1}}async function Q_(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 fw(){await qt();let e=[...Ka("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 fw();if(e)await Lo(e)}async function jf(){let e=tL(m.projectRoot);if(Yb(m.projectRoot),e){if(await XT(e,{ensureSecondPane:()=>{Pl(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&&ev(o)?"image":"file"}}function e1(){return tt}function t1(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)=>!VE(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:zu(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=nb(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=eb(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(),$u(),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;tb(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 Va([...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=_c(),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)Sv(e,t,t);else if(s.startsWith(`${e}/`)){let l=t+s.slice(e.length);Sv(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(),cE(`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=bp(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(hw(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",()=>{E1()}))}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 mw(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=bp(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("c5h3nqck"),import("./entry-commands-c5h3nqck.js"));a=await i(n.name,{dir:e})}else a=await mw({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 Yf(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 cE(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))ep(n.path)}function de(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function t$(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))Sv(e.path,r,r);await t$(e.path,r,i),t(),cE(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 Jf(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=Gu(e);if(n!==void 0&&o){if(o.activeTabId===e&&t.focus===!1)return;Cm(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(ww(e)){if(fE(e,t),n)vt().selectedPath=e;Ff({name:e.split("/").pop()||e,path:e,root:vt().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await AE(e,t),n)vt().selectedPath=e;Ff({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 Lp(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 Lp(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;Ff({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 gw(e,t){await Lo(t,{focus:!1,paneId:e,preview:!0})}function n1(e){if(wm(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){ep(e);return}}function i1(e){for(let t of e)ep(t,{onlyIfChanged:!0})}async function ep(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||wm(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 o1(){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:()=>{Rc("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{Pf,hw,rE,sE,Xg,Qg,pw,aE,lE,Ff,To,Z_,X_,Q_,fw,jf,e1,t1,mw,cE,t$,Lo,gw,n1,i1,ep,o1};
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};
5
5
 
6
- //# debugId=8017D335DAC27AE964756E2164756E21
7
- //# sourceMappingURL=studio-mwxgyn9h.js.map
6
+ //# debugId=720B46F05E704E2364756E2164756E21
7
+ //# sourceMappingURL=studio-zxp13sss.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 lc(t){let e=d(t);return e?u(e):null}function Gh(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 N_(t){let e=d(t);if(!e)return;a(t,{active:null,...e.views?{views:e.views}:{}})}function Kh(t){let e=d(t)?.views;return Array.isArray(e)?e.filter((n)=>typeof n?.name==="string"):[]}function Xy(t){return d(t)?.active??null}function FS(t){let e=d(t),n=e?.active;if(!e||!n)return!1;let i=Kh(t).find((o)=>o.name===n);return i?v(u(i))!==v(u(e)):!1}function jS(t,e){let n=e.trim(),i=c();if(n===""||!i)return null;let o=d(t)??{},r={name:n,...u(o)},s=Kh(t).filter((l)=>l.name!==n);return s.push(r),a(t,{...o,active:n,views:s}),r}function O_(t,e){let n=Kh(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 M_(t,e){let n=d(t);if(!n||!c())return!1;let i=Kh(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 HS(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{lc,Gh,N_,Kh,Xy,FS,jS,O_,M_,HS};
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};
3
3
 
4
- //# debugId=8C0EADE89BE50BF064756E2164756E21
5
- //# sourceMappingURL=studio-r3kaka4d.js.map
4
+ //# debugId=3FED613AF75201E464756E2164756E21
5
+ //# sourceMappingURL=studio-zygnmm01.js.map
@@ -1,14 +1,14 @@
1
- import{gu,Ns,jy,sc,Tn,pe}from"./studio-01kbbqg3.js";import{jv}from"./studio-5e9zsamh.js";import{Fk}from"./studio-x92tgnee.js";class z{constructor(o,e){this._modeId=o,this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){if(this._worker)this._worker.dispose(),this._worker=null;this._client=null}async _updateExtraLibs(){if(!this._worker)return;let o=++this._updateExtraLibsToken,e=await this._worker.getProxy();if(this._updateExtraLibsToken!==o)return;e.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){if(!this._client)this._client=(async()=>{if(this._worker=jv({moduleId:"vs/language/typescript/tsWorker",createWorker:()=>new Worker(new URL("ts.worker.js",import.meta.url),{type:"module"}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync())return await this._worker.withSyncedResources(Tn.getModels().filter((o)=>o.getLanguageId()===this._modeId).map((o)=>o.uri));return await this._worker.getProxy()})();return this._client}async getLanguageServiceWorker(...o){let e=await this._getClient();if(this._worker)await this._worker.withSyncedResources(o);return e}}var i={};i["lib.d.ts"]=!0;i["lib.decorators.d.ts"]=!0;i["lib.decorators.legacy.d.ts"]=!0;i["lib.dom.asynciterable.d.ts"]=!0;i["lib.dom.d.ts"]=!0;i["lib.dom.iterable.d.ts"]=!0;i["lib.es2015.collection.d.ts"]=!0;i["lib.es2015.core.d.ts"]=!0;i["lib.es2015.d.ts"]=!0;i["lib.es2015.generator.d.ts"]=!0;i["lib.es2015.iterable.d.ts"]=!0;i["lib.es2015.promise.d.ts"]=!0;i["lib.es2015.proxy.d.ts"]=!0;i["lib.es2015.reflect.d.ts"]=!0;i["lib.es2015.symbol.d.ts"]=!0;i["lib.es2015.symbol.wellknown.d.ts"]=!0;i["lib.es2016.array.include.d.ts"]=!0;i["lib.es2016.d.ts"]=!0;i["lib.es2016.full.d.ts"]=!0;i["lib.es2016.intl.d.ts"]=!0;i["lib.es2017.arraybuffer.d.ts"]=!0;i["lib.es2017.d.ts"]=!0;i["lib.es2017.date.d.ts"]=!0;i["lib.es2017.full.d.ts"]=!0;i["lib.es2017.intl.d.ts"]=!0;i["lib.es2017.object.d.ts"]=!0;i["lib.es2017.sharedmemory.d.ts"]=!0;i["lib.es2017.string.d.ts"]=!0;i["lib.es2017.typedarrays.d.ts"]=!0;i["lib.es2018.asyncgenerator.d.ts"]=!0;i["lib.es2018.asynciterable.d.ts"]=!0;i["lib.es2018.d.ts"]=!0;i["lib.es2018.full.d.ts"]=!0;i["lib.es2018.intl.d.ts"]=!0;i["lib.es2018.promise.d.ts"]=!0;i["lib.es2018.regexp.d.ts"]=!0;i["lib.es2019.array.d.ts"]=!0;i["lib.es2019.d.ts"]=!0;i["lib.es2019.full.d.ts"]=!0;i["lib.es2019.intl.d.ts"]=!0;i["lib.es2019.object.d.ts"]=!0;i["lib.es2019.string.d.ts"]=!0;i["lib.es2019.symbol.d.ts"]=!0;i["lib.es2020.bigint.d.ts"]=!0;i["lib.es2020.d.ts"]=!0;i["lib.es2020.date.d.ts"]=!0;i["lib.es2020.full.d.ts"]=!0;i["lib.es2020.intl.d.ts"]=!0;i["lib.es2020.number.d.ts"]=!0;i["lib.es2020.promise.d.ts"]=!0;i["lib.es2020.sharedmemory.d.ts"]=!0;i["lib.es2020.string.d.ts"]=!0;i["lib.es2020.symbol.wellknown.d.ts"]=!0;i["lib.es2021.d.ts"]=!0;i["lib.es2021.full.d.ts"]=!0;i["lib.es2021.intl.d.ts"]=!0;i["lib.es2021.promise.d.ts"]=!0;i["lib.es2021.string.d.ts"]=!0;i["lib.es2021.weakref.d.ts"]=!0;i["lib.es2022.array.d.ts"]=!0;i["lib.es2022.d.ts"]=!0;i["lib.es2022.error.d.ts"]=!0;i["lib.es2022.full.d.ts"]=!0;i["lib.es2022.intl.d.ts"]=!0;i["lib.es2022.object.d.ts"]=!0;i["lib.es2022.regexp.d.ts"]=!0;i["lib.es2022.string.d.ts"]=!0;i["lib.es2023.array.d.ts"]=!0;i["lib.es2023.collection.d.ts"]=!0;i["lib.es2023.d.ts"]=!0;i["lib.es2023.full.d.ts"]=!0;i["lib.es2023.intl.d.ts"]=!0;i["lib.es2024.arraybuffer.d.ts"]=!0;i["lib.es2024.collection.d.ts"]=!0;i["lib.es2024.d.ts"]=!0;i["lib.es2024.full.d.ts"]=!0;i["lib.es2024.object.d.ts"]=!0;i["lib.es2024.promise.d.ts"]=!0;i["lib.es2024.regexp.d.ts"]=!0;i["lib.es2024.sharedmemory.d.ts"]=!0;i["lib.es2024.string.d.ts"]=!0;i["lib.es5.d.ts"]=!0;i["lib.es6.d.ts"]=!0;i["lib.esnext.array.d.ts"]=!0;i["lib.esnext.collection.d.ts"]=!0;i["lib.esnext.d.ts"]=!0;i["lib.esnext.decorators.d.ts"]=!0;i["lib.esnext.disposable.d.ts"]=!0;i["lib.esnext.error.d.ts"]=!0;i["lib.esnext.float16.d.ts"]=!0;i["lib.esnext.full.d.ts"]=!0;i["lib.esnext.intl.d.ts"]=!0;i["lib.esnext.iterator.d.ts"]=!0;i["lib.esnext.promise.d.ts"]=!0;i["lib.esnext.sharedmemory.d.ts"]=!0;i["lib.scripthost.d.ts"]=!0;i["lib.webworker.asynciterable.d.ts"]=!0;i["lib.webworker.d.ts"]=!0;i["lib.webworker.importscripts.d.ts"]=!0;i["lib.webworker.iterable.d.ts"]=!0;function M(o,e,n=0){if(typeof o==="string")return o;else if(o===void 0)return"";let c="";if(n){c+=e;for(let r=0;r<n;r++)c+=" "}if(c+=o.messageText,n++,o.next)for(let r of o.next)c+=M(r,e,n);return c}function v(o){if(o)return o.map((e)=>e.text).join("");return""}class b{constructor(o){this._worker=o}_textSpanToRange(o,e){let n=o.getPositionAt(e.start),c=o.getPositionAt(e.start+e.length),{lineNumber:r,column:s}=n,{lineNumber:d,column:t}=c;return{startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t}}}class A{constructor(o){this._worker=o,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(o){if(!o)return!1;if(o.path.indexOf("/lib.")===0)return!!i[o.path.slice(1)];return!1}getOrCreateModel(o){let e=sc.parse(o),n=Tn.getModel(e);if(n)return n;if(this.isLibFile(e)&&this._hasFetchedLibFiles)return Tn.createModel(this._libFiles[e.path.slice(1)],"typescript",e);let c=Fk.getExtraLibs()[o];if(c)return Tn.createModel(c.content,"typescript",e);return null}_containsLibFile(o){for(let e of o)if(this.isLibFile(e))return!0;return!1}async fetchLibFilesIfNecessary(o){if(!this._containsLibFile(o))return;await this._fetchLibFiles()}_fetchLibFiles(){if(!this._fetchLibFilesPromise)this._fetchLibFilesPromise=this._worker().then((o)=>o.getLibFiles()).then((o)=>{this._hasFetchedLibFiles=!0,this._libFiles=o});return this._fetchLibFilesPromise}}class C extends b{constructor(o,e,n,c){super(c);this._libFiles=o,this._defaults=e,this._selector=n,this._disposables=[],this._listener=Object.create(null);let r=(t)=>{if(t.getLanguageId()!==n)return;let l=()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u){if(t.isAttachedToEditor())this._doValidate(t)}else this._doValidate(t)},p,g=t.onDidChangeContent(()=>{clearTimeout(p),p=window.setTimeout(l,500)}),m=t.onDidChangeAttached(()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u)if(t.isAttachedToEditor())l();else Tn.setModelMarkers(t,this._selector,[])});this._listener[t.uri.toString()]={dispose(){g.dispose(),m.dispose(),clearTimeout(p)}},l()},s=(t)=>{Tn.setModelMarkers(t,this._selector,[]);let l=t.uri.toString();if(this._listener[l])this._listener[l].dispose(),delete this._listener[l]};this._disposables.push(Tn.onDidCreateModel((t)=>r(t))),this._disposables.push(Tn.onWillDisposeModel(s)),this._disposables.push(Tn.onDidChangeModelLanguage((t)=>{s(t.model),r(t.model)})),this._disposables.push({dispose(){for(let t of Tn.getModels())s(t)}});let d=()=>{for(let t of Tn.getModels())s(t),r(t)};this._disposables.push(this._defaults.onDidChange(d)),this._disposables.push(this._defaults.onDidExtraLibsChange(d)),Tn.getModels().forEach((t)=>r(t))}dispose(){this._disposables.forEach((o)=>o&&o.dispose()),this._disposables=[]}async _doValidate(o){let e=await this._worker(o.uri);if(o.isDisposed())return;let n=[],{noSyntaxValidation:c,noSemanticValidation:r,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();if(!c)n.push(e.getSyntacticDiagnostics(o.uri.toString()));if(!r)n.push(e.getSemanticDiagnostics(o.uri.toString()));if(!s)n.push(e.getSuggestionDiagnostics(o.uri.toString()));let d=await Promise.all(n);if(!d||o.isDisposed())return;let t=d.reduce((p,g)=>g.concat(p),[]).filter((p)=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(p.code)===-1),l=t.map((p)=>p.relatedInformation||[]).reduce((p,g)=>g.concat(p),[]).map((p)=>p.file?sc.parse(p.file.fileName):null);if(await this._libFiles.fetchLibFilesIfNecessary(l),o.isDisposed())return;Tn.setModelMarkers(o,this._selector,t.map((p)=>this._convertDiagnostics(o,p)))}_convertDiagnostics(o,e){let n=e.start||0,c=e.length||1,{lineNumber:r,column:s}=o.getPositionAt(n),{lineNumber:d,column:t}=o.getPositionAt(n+c),l=[];if(e.reportsUnnecessary)l.push(jy.Unnecessary);if(e.reportsDeprecated)l.push(jy.Deprecated);return{severity:this._tsDiagnosticCategoryToMarkerSeverity(e.category),startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t,message:M(e.messageText,`
1
+ import{bu,Ns,Hy,ac,Tn,pe}from"./studio-zscd9ty4.js";import{Hv}from"./studio-fzdywr6p.js";import{Hk}from"./studio-mgx8yhnz.js";class z{constructor(o,e){this._modeId=o,this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){if(this._worker)this._worker.dispose(),this._worker=null;this._client=null}async _updateExtraLibs(){if(!this._worker)return;let o=++this._updateExtraLibsToken,e=await this._worker.getProxy();if(this._updateExtraLibsToken!==o)return;e.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){if(!this._client)this._client=(async()=>{if(this._worker=Hv({moduleId:"vs/language/typescript/tsWorker",createWorker:()=>new Worker(new URL("ts.worker.js",import.meta.url),{type:"module"}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync())return await this._worker.withSyncedResources(Tn.getModels().filter((o)=>o.getLanguageId()===this._modeId).map((o)=>o.uri));return await this._worker.getProxy()})();return this._client}async getLanguageServiceWorker(...o){let e=await this._getClient();if(this._worker)await this._worker.withSyncedResources(o);return e}}var i={};i["lib.d.ts"]=!0;i["lib.decorators.d.ts"]=!0;i["lib.decorators.legacy.d.ts"]=!0;i["lib.dom.asynciterable.d.ts"]=!0;i["lib.dom.d.ts"]=!0;i["lib.dom.iterable.d.ts"]=!0;i["lib.es2015.collection.d.ts"]=!0;i["lib.es2015.core.d.ts"]=!0;i["lib.es2015.d.ts"]=!0;i["lib.es2015.generator.d.ts"]=!0;i["lib.es2015.iterable.d.ts"]=!0;i["lib.es2015.promise.d.ts"]=!0;i["lib.es2015.proxy.d.ts"]=!0;i["lib.es2015.reflect.d.ts"]=!0;i["lib.es2015.symbol.d.ts"]=!0;i["lib.es2015.symbol.wellknown.d.ts"]=!0;i["lib.es2016.array.include.d.ts"]=!0;i["lib.es2016.d.ts"]=!0;i["lib.es2016.full.d.ts"]=!0;i["lib.es2016.intl.d.ts"]=!0;i["lib.es2017.arraybuffer.d.ts"]=!0;i["lib.es2017.d.ts"]=!0;i["lib.es2017.date.d.ts"]=!0;i["lib.es2017.full.d.ts"]=!0;i["lib.es2017.intl.d.ts"]=!0;i["lib.es2017.object.d.ts"]=!0;i["lib.es2017.sharedmemory.d.ts"]=!0;i["lib.es2017.string.d.ts"]=!0;i["lib.es2017.typedarrays.d.ts"]=!0;i["lib.es2018.asyncgenerator.d.ts"]=!0;i["lib.es2018.asynciterable.d.ts"]=!0;i["lib.es2018.d.ts"]=!0;i["lib.es2018.full.d.ts"]=!0;i["lib.es2018.intl.d.ts"]=!0;i["lib.es2018.promise.d.ts"]=!0;i["lib.es2018.regexp.d.ts"]=!0;i["lib.es2019.array.d.ts"]=!0;i["lib.es2019.d.ts"]=!0;i["lib.es2019.full.d.ts"]=!0;i["lib.es2019.intl.d.ts"]=!0;i["lib.es2019.object.d.ts"]=!0;i["lib.es2019.string.d.ts"]=!0;i["lib.es2019.symbol.d.ts"]=!0;i["lib.es2020.bigint.d.ts"]=!0;i["lib.es2020.d.ts"]=!0;i["lib.es2020.date.d.ts"]=!0;i["lib.es2020.full.d.ts"]=!0;i["lib.es2020.intl.d.ts"]=!0;i["lib.es2020.number.d.ts"]=!0;i["lib.es2020.promise.d.ts"]=!0;i["lib.es2020.sharedmemory.d.ts"]=!0;i["lib.es2020.string.d.ts"]=!0;i["lib.es2020.symbol.wellknown.d.ts"]=!0;i["lib.es2021.d.ts"]=!0;i["lib.es2021.full.d.ts"]=!0;i["lib.es2021.intl.d.ts"]=!0;i["lib.es2021.promise.d.ts"]=!0;i["lib.es2021.string.d.ts"]=!0;i["lib.es2021.weakref.d.ts"]=!0;i["lib.es2022.array.d.ts"]=!0;i["lib.es2022.d.ts"]=!0;i["lib.es2022.error.d.ts"]=!0;i["lib.es2022.full.d.ts"]=!0;i["lib.es2022.intl.d.ts"]=!0;i["lib.es2022.object.d.ts"]=!0;i["lib.es2022.regexp.d.ts"]=!0;i["lib.es2022.string.d.ts"]=!0;i["lib.es2023.array.d.ts"]=!0;i["lib.es2023.collection.d.ts"]=!0;i["lib.es2023.d.ts"]=!0;i["lib.es2023.full.d.ts"]=!0;i["lib.es2023.intl.d.ts"]=!0;i["lib.es2024.arraybuffer.d.ts"]=!0;i["lib.es2024.collection.d.ts"]=!0;i["lib.es2024.d.ts"]=!0;i["lib.es2024.full.d.ts"]=!0;i["lib.es2024.object.d.ts"]=!0;i["lib.es2024.promise.d.ts"]=!0;i["lib.es2024.regexp.d.ts"]=!0;i["lib.es2024.sharedmemory.d.ts"]=!0;i["lib.es2024.string.d.ts"]=!0;i["lib.es5.d.ts"]=!0;i["lib.es6.d.ts"]=!0;i["lib.esnext.array.d.ts"]=!0;i["lib.esnext.collection.d.ts"]=!0;i["lib.esnext.d.ts"]=!0;i["lib.esnext.decorators.d.ts"]=!0;i["lib.esnext.disposable.d.ts"]=!0;i["lib.esnext.error.d.ts"]=!0;i["lib.esnext.float16.d.ts"]=!0;i["lib.esnext.full.d.ts"]=!0;i["lib.esnext.intl.d.ts"]=!0;i["lib.esnext.iterator.d.ts"]=!0;i["lib.esnext.promise.d.ts"]=!0;i["lib.esnext.sharedmemory.d.ts"]=!0;i["lib.scripthost.d.ts"]=!0;i["lib.webworker.asynciterable.d.ts"]=!0;i["lib.webworker.d.ts"]=!0;i["lib.webworker.importscripts.d.ts"]=!0;i["lib.webworker.iterable.d.ts"]=!0;function M(o,e,n=0){if(typeof o==="string")return o;else if(o===void 0)return"";let c="";if(n){c+=e;for(let r=0;r<n;r++)c+=" "}if(c+=o.messageText,n++,o.next)for(let r of o.next)c+=M(r,e,n);return c}function v(o){if(o)return o.map((e)=>e.text).join("");return""}class b{constructor(o){this._worker=o}_textSpanToRange(o,e){let n=o.getPositionAt(e.start),c=o.getPositionAt(e.start+e.length),{lineNumber:r,column:s}=n,{lineNumber:d,column:t}=c;return{startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t}}}class A{constructor(o){this._worker=o,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(o){if(!o)return!1;if(o.path.indexOf("/lib.")===0)return!!i[o.path.slice(1)];return!1}getOrCreateModel(o){let e=ac.parse(o),n=Tn.getModel(e);if(n)return n;if(this.isLibFile(e)&&this._hasFetchedLibFiles)return Tn.createModel(this._libFiles[e.path.slice(1)],"typescript",e);let c=Hk.getExtraLibs()[o];if(c)return Tn.createModel(c.content,"typescript",e);return null}_containsLibFile(o){for(let e of o)if(this.isLibFile(e))return!0;return!1}async fetchLibFilesIfNecessary(o){if(!this._containsLibFile(o))return;await this._fetchLibFiles()}_fetchLibFiles(){if(!this._fetchLibFilesPromise)this._fetchLibFilesPromise=this._worker().then((o)=>o.getLibFiles()).then((o)=>{this._hasFetchedLibFiles=!0,this._libFiles=o});return this._fetchLibFilesPromise}}class C extends b{constructor(o,e,n,c){super(c);this._libFiles=o,this._defaults=e,this._selector=n,this._disposables=[],this._listener=Object.create(null);let r=(t)=>{if(t.getLanguageId()!==n)return;let l=()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u){if(t.isAttachedToEditor())this._doValidate(t)}else this._doValidate(t)},p,g=t.onDidChangeContent(()=>{clearTimeout(p),p=window.setTimeout(l,500)}),m=t.onDidChangeAttached(()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u)if(t.isAttachedToEditor())l();else Tn.setModelMarkers(t,this._selector,[])});this._listener[t.uri.toString()]={dispose(){g.dispose(),m.dispose(),clearTimeout(p)}},l()},s=(t)=>{Tn.setModelMarkers(t,this._selector,[]);let l=t.uri.toString();if(this._listener[l])this._listener[l].dispose(),delete this._listener[l]};this._disposables.push(Tn.onDidCreateModel((t)=>r(t))),this._disposables.push(Tn.onWillDisposeModel(s)),this._disposables.push(Tn.onDidChangeModelLanguage((t)=>{s(t.model),r(t.model)})),this._disposables.push({dispose(){for(let t of Tn.getModels())s(t)}});let d=()=>{for(let t of Tn.getModels())s(t),r(t)};this._disposables.push(this._defaults.onDidChange(d)),this._disposables.push(this._defaults.onDidExtraLibsChange(d)),Tn.getModels().forEach((t)=>r(t))}dispose(){this._disposables.forEach((o)=>o&&o.dispose()),this._disposables=[]}async _doValidate(o){let e=await this._worker(o.uri);if(o.isDisposed())return;let n=[],{noSyntaxValidation:c,noSemanticValidation:r,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();if(!c)n.push(e.getSyntacticDiagnostics(o.uri.toString()));if(!r)n.push(e.getSemanticDiagnostics(o.uri.toString()));if(!s)n.push(e.getSuggestionDiagnostics(o.uri.toString()));let d=await Promise.all(n);if(!d||o.isDisposed())return;let t=d.reduce((p,g)=>g.concat(p),[]).filter((p)=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(p.code)===-1),l=t.map((p)=>p.relatedInformation||[]).reduce((p,g)=>g.concat(p),[]).map((p)=>p.file?ac.parse(p.file.fileName):null);if(await this._libFiles.fetchLibFilesIfNecessary(l),o.isDisposed())return;Tn.setModelMarkers(o,this._selector,t.map((p)=>this._convertDiagnostics(o,p)))}_convertDiagnostics(o,e){let n=e.start||0,c=e.length||1,{lineNumber:r,column:s}=o.getPositionAt(n),{lineNumber:d,column:t}=o.getPositionAt(n+c),l=[];if(e.reportsUnnecessary)l.push(Hy.Unnecessary);if(e.reportsDeprecated)l.push(Hy.Deprecated);return{severity:this._tsDiagnosticCategoryToMarkerSeverity(e.category),startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t,message:M(e.messageText,`
2
2
  `),code:e.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(o,e.relatedInformation)}}_convertRelatedInformation(o,e){if(!e)return[];let n=[];return e.forEach((c)=>{let r=o;if(c.file)r=this._libFiles.getOrCreateModel(c.file.fileName);if(!r)return;let s=c.start||0,d=c.length||1,{lineNumber:t,column:l}=r.getPositionAt(s),{lineNumber:p,column:g}=r.getPositionAt(s+d);n.push({resource:r.uri,startLineNumber:t,startColumn:l,endLineNumber:p,endColumn:g,message:M(c.messageText,`
3
- `)})}),n}_tsDiagnosticCategoryToMarkerSeverity(o){switch(o){case 1:return Ns.Error;case 3:return Ns.Info;case 0:return Ns.Warning;case 2:return Ns.Hint}return Ns.Info}}class x extends b{get triggerCharacters(){return["."]}async provideCompletionItems(o,e,n,c){let r=o.getWordUntilPosition(e),s=new gu(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn),d=o.uri,t=o.getOffsetAt(e),l=await this._worker(d);if(o.isDisposed())return;let p=await l.getCompletionsAtPosition(d.toString(),t);if(!p||o.isDisposed())return;return{suggestions:p.entries.map((m)=>{let u=s;if(m.replacementSpan){let k=o.getPositionAt(m.replacementSpan.start),y=o.getPositionAt(m.replacementSpan.start+m.replacementSpan.length);u=new gu(k.lineNumber,k.column,y.lineNumber,y.column)}let w=[];if(m.kindModifiers!==void 0&&m.kindModifiers.indexOf("deprecated")!==-1)w.push(pe.CompletionItemTag.Deprecated);return{uri:d,position:e,offset:t,range:u,label:m.name,insertText:m.name,sortText:m.sortText,kind:x.convertKind(m.kind),tags:w}})}}async resolveCompletionItem(o,e){let n=o,{uri:c,position:r,offset:s}=n,t=await(await this._worker(c)).getCompletionEntryDetails(c.toString(),s,n.label);if(!t)return n;return{uri:c,position:r,label:t.name,kind:x.convertKind(t.kind),detail:v(t.displayParts),documentation:{value:x.createDocumentationString(t)}}}static convertKind(o){switch(o){case a.primitiveType:case a.keyword:return pe.CompletionItemKind.Keyword;case a.variable:case a.localVariable:return pe.CompletionItemKind.Variable;case a.memberVariable:case a.memberGetAccessor:case a.memberSetAccessor:return pe.CompletionItemKind.Field;case a.function:case a.memberFunction:case a.constructSignature:case a.callSignature:case a.indexSignature:return pe.CompletionItemKind.Function;case a.enum:return pe.CompletionItemKind.Enum;case a.module:return pe.CompletionItemKind.Module;case a.class:return pe.CompletionItemKind.Class;case a.interface:return pe.CompletionItemKind.Interface;case a.warning:return pe.CompletionItemKind.File}return pe.CompletionItemKind.Property}static createDocumentationString(o){let e=v(o.documentation);if(o.tags)for(let n of o.tags)e+=`
3
+ `)})}),n}_tsDiagnosticCategoryToMarkerSeverity(o){switch(o){case 1:return Ns.Error;case 3:return Ns.Info;case 0:return Ns.Warning;case 2:return Ns.Hint}return Ns.Info}}class x extends b{get triggerCharacters(){return["."]}async provideCompletionItems(o,e,n,c){let r=o.getWordUntilPosition(e),s=new bu(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn),d=o.uri,t=o.getOffsetAt(e),l=await this._worker(d);if(o.isDisposed())return;let p=await l.getCompletionsAtPosition(d.toString(),t);if(!p||o.isDisposed())return;return{suggestions:p.entries.map((m)=>{let u=s;if(m.replacementSpan){let k=o.getPositionAt(m.replacementSpan.start),y=o.getPositionAt(m.replacementSpan.start+m.replacementSpan.length);u=new bu(k.lineNumber,k.column,y.lineNumber,y.column)}let w=[];if(m.kindModifiers!==void 0&&m.kindModifiers.indexOf("deprecated")!==-1)w.push(pe.CompletionItemTag.Deprecated);return{uri:d,position:e,offset:t,range:u,label:m.name,insertText:m.name,sortText:m.sortText,kind:x.convertKind(m.kind),tags:w}})}}async resolveCompletionItem(o,e){let n=o,{uri:c,position:r,offset:s}=n,t=await(await this._worker(c)).getCompletionEntryDetails(c.toString(),s,n.label);if(!t)return n;return{uri:c,position:r,label:t.name,kind:x.convertKind(t.kind),detail:v(t.displayParts),documentation:{value:x.createDocumentationString(t)}}}static convertKind(o){switch(o){case a.primitiveType:case a.keyword:return pe.CompletionItemKind.Keyword;case a.variable:case a.localVariable:return pe.CompletionItemKind.Variable;case a.memberVariable:case a.memberGetAccessor:case a.memberSetAccessor:return pe.CompletionItemKind.Field;case a.function:case a.memberFunction:case a.constructSignature:case a.callSignature:case a.indexSignature:return pe.CompletionItemKind.Function;case a.enum:return pe.CompletionItemKind.Enum;case a.module:return pe.CompletionItemKind.Module;case a.class:return pe.CompletionItemKind.Class;case a.interface:return pe.CompletionItemKind.Interface;case a.warning:return pe.CompletionItemKind.File}return pe.CompletionItemKind.Property}static createDocumentationString(o){let e=v(o.documentation);if(o.tags)for(let n of o.tags)e+=`
4
4
 
5
5
  ${R(n)}`;return e}}function R(o){let e=`*@${o.name}*`;if(o.name==="param"&&o.text){let[n,...c]=o.text;if(e+=`\`${n.text}\``,c.length>0)e+=` — ${c.map((r)=>r.text).join(" ")}`}else if(Array.isArray(o.text))e+=` — ${o.text.map((n)=>n.text).join(" ")}`;else if(o.text)e+=` — ${o.text}`;return e}class L extends b{constructor(){super(...arguments);this.signatureHelpTriggerCharacters=["(",","]}static _toSignatureHelpTriggerReason(o){switch(o.triggerKind){case pe.SignatureHelpTriggerKind.TriggerCharacter:if(o.triggerCharacter)if(o.isRetrigger)return{kind:"retrigger",triggerCharacter:o.triggerCharacter};else return{kind:"characterTyped",triggerCharacter:o.triggerCharacter};else return{kind:"invoked"};case pe.SignatureHelpTriggerKind.ContentChange:return o.isRetrigger?{kind:"retrigger"}:{kind:"invoked"};case pe.SignatureHelpTriggerKind.Invoke:default:return{kind:"invoked"}}}async provideSignatureHelp(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getSignatureHelpItems(r.toString(),s,{triggerReason:L._toSignatureHelpTriggerReason(c)});if(!t||o.isDisposed())return;let l={activeSignature:t.selectedItemIndex,activeParameter:t.argumentIndex,signatures:[]};return t.items.forEach((p)=>{let g={label:"",parameters:[]};g.documentation={value:v(p.documentation)},g.label+=v(p.prefixDisplayParts),p.parameters.forEach((m,u,w)=>{let k=v(m.displayParts),y={label:k,documentation:{value:v(m.documentation)}};if(g.label+=k,g.parameters.push(y),u<w.length-1)g.label+=v(p.separatorDisplayParts)}),g.label+=v(p.suffixDisplayParts),l.signatures.push(g)}),{value:l,dispose(){}}}}class S extends b{async provideHover(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getQuickInfoAtPosition(c.toString(),r);if(!d||o.isDisposed())return;let t=v(d.documentation),l=d.tags?d.tags.map((g)=>R(g)).join(`
6
6
 
7
7
  `):"",p=v(d.displayParts);return{range:this._textSpanToRange(o,d.textSpan),contents:[{value:"```typescript\n"+p+"\n```\n"},{value:t+(l?`
8
8
 
9
- `+l:"")}]}}}class I extends b{async provideDocumentHighlights(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDocumentHighlights(c.toString(),r,[c.toString()]);if(!d||o.isDisposed())return;return d.flatMap((t)=>t.highlightSpans.map((l)=>({range:this._textSpanToRange(o,l.textSpan),kind:l.kind==="writtenReference"?pe.DocumentHighlightKind.Write:pe.DocumentHighlightKind.Text})))}}class T extends b{constructor(o,e){super(e);this._libFiles=o}async provideDefinition(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDefinitionAtPosition(c.toString(),r);if(!d||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(d.map((l)=>sc.parse(l.fileName))),o.isDisposed())return;let t=[];for(let l of d){let p=this._libFiles.getOrCreateModel(l.fileName);if(p)t.push({uri:p.uri,range:this._textSpanToRange(p,l.textSpan)})}return t}}class D extends b{constructor(o,e){super(e);this._libFiles=o}async provideReferences(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getReferencesAtPosition(r.toString(),s);if(!t||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(t.map((p)=>sc.parse(p.fileName))),o.isDisposed())return;let l=[];for(let p of t){let g=this._libFiles.getOrCreateModel(p.fileName);if(g)l.push({uri:g.uri,range:this._textSpanToRange(g,p.textSpan)})}return l}}class j extends b{async provideDocumentSymbols(o,e){let n=o.uri,c=await this._worker(n);if(o.isDisposed())return;let r=await c.getNavigationTree(n.toString());if(!r||o.isDisposed())return;let s=(t,l)=>({name:t.text,detail:"",kind:h[t.kind]||pe.SymbolKind.Variable,range:this._textSpanToRange(o,t.spans[0]),selectionRange:this._textSpanToRange(o,t.spans[0]),tags:[],children:t.childItems?.map((g)=>s(g,t.text)),containerName:l});return r.childItems?r.childItems.map((t)=>s(t)):[]}}class a{}a.unknown="";a.keyword="keyword";a.script="script";a.module="module";a.class="class";a.interface="interface";a.type="type";a.enum="enum";a.variable="var";a.localVariable="local var";a.function="function";a.localFunction="local function";a.memberFunction="method";a.memberGetAccessor="getter";a.memberSetAccessor="setter";a.memberVariable="property";a.constructorImplementation="constructor";a.callSignature="call";a.indexSignature="index";a.constructSignature="construct";a.parameter="parameter";a.typeParameter="type parameter";a.primitiveType="primitive type";a.label="label";a.alias="alias";a.const="const";a.let="let";a.warning="warning";var h=Object.create(null);h[a.module]=pe.SymbolKind.Module;h[a.class]=pe.SymbolKind.Class;h[a.enum]=pe.SymbolKind.Enum;h[a.interface]=pe.SymbolKind.Interface;h[a.memberFunction]=pe.SymbolKind.Method;h[a.memberVariable]=pe.SymbolKind.Property;h[a.memberGetAccessor]=pe.SymbolKind.Property;h[a.memberSetAccessor]=pe.SymbolKind.Property;h[a.variable]=pe.SymbolKind.Variable;h[a.const]=pe.SymbolKind.Variable;h[a.localVariable]=pe.SymbolKind.Variable;h[a.variable]=pe.SymbolKind.Variable;h[a.function]=pe.SymbolKind.Function;h[a.localFunction]=pe.SymbolKind.Function;class f extends b{static _convertOptions(o){return{ConvertTabsToSpaces:o.insertSpaces,TabSize:o.tabSize,IndentSize:o.tabSize,IndentStyle:2,NewLineCharacter:`
9
+ `+l:"")}]}}}class I extends b{async provideDocumentHighlights(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDocumentHighlights(c.toString(),r,[c.toString()]);if(!d||o.isDisposed())return;return d.flatMap((t)=>t.highlightSpans.map((l)=>({range:this._textSpanToRange(o,l.textSpan),kind:l.kind==="writtenReference"?pe.DocumentHighlightKind.Write:pe.DocumentHighlightKind.Text})))}}class T extends b{constructor(o,e){super(e);this._libFiles=o}async provideDefinition(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDefinitionAtPosition(c.toString(),r);if(!d||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(d.map((l)=>ac.parse(l.fileName))),o.isDisposed())return;let t=[];for(let l of d){let p=this._libFiles.getOrCreateModel(l.fileName);if(p)t.push({uri:p.uri,range:this._textSpanToRange(p,l.textSpan)})}return t}}class D extends b{constructor(o,e){super(e);this._libFiles=o}async provideReferences(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getReferencesAtPosition(r.toString(),s);if(!t||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(t.map((p)=>ac.parse(p.fileName))),o.isDisposed())return;let l=[];for(let p of t){let g=this._libFiles.getOrCreateModel(p.fileName);if(g)l.push({uri:g.uri,range:this._textSpanToRange(g,p.textSpan)})}return l}}class j extends b{async provideDocumentSymbols(o,e){let n=o.uri,c=await this._worker(n);if(o.isDisposed())return;let r=await c.getNavigationTree(n.toString());if(!r||o.isDisposed())return;let s=(t,l)=>({name:t.text,detail:"",kind:h[t.kind]||pe.SymbolKind.Variable,range:this._textSpanToRange(o,t.spans[0]),selectionRange:this._textSpanToRange(o,t.spans[0]),tags:[],children:t.childItems?.map((g)=>s(g,t.text)),containerName:l});return r.childItems?r.childItems.map((t)=>s(t)):[]}}class a{}a.unknown="";a.keyword="keyword";a.script="script";a.module="module";a.class="class";a.interface="interface";a.type="type";a.enum="enum";a.variable="var";a.localVariable="local var";a.function="function";a.localFunction="local function";a.memberFunction="method";a.memberGetAccessor="getter";a.memberSetAccessor="setter";a.memberVariable="property";a.constructorImplementation="constructor";a.callSignature="call";a.indexSignature="index";a.constructSignature="construct";a.parameter="parameter";a.typeParameter="type parameter";a.primitiveType="primitive type";a.label="label";a.alias="alias";a.const="const";a.let="let";a.warning="warning";var h=Object.create(null);h[a.module]=pe.SymbolKind.Module;h[a.class]=pe.SymbolKind.Class;h[a.enum]=pe.SymbolKind.Enum;h[a.interface]=pe.SymbolKind.Interface;h[a.memberFunction]=pe.SymbolKind.Method;h[a.memberVariable]=pe.SymbolKind.Property;h[a.memberGetAccessor]=pe.SymbolKind.Property;h[a.memberSetAccessor]=pe.SymbolKind.Property;h[a.variable]=pe.SymbolKind.Variable;h[a.const]=pe.SymbolKind.Variable;h[a.localVariable]=pe.SymbolKind.Variable;h[a.variable]=pe.SymbolKind.Variable;h[a.function]=pe.SymbolKind.Function;h[a.localFunction]=pe.SymbolKind.Function;class f extends b{static _convertOptions(o){return{ConvertTabsToSpaces:o.insertSpaces,TabSize:o.tabSize,IndentSize:o.tabSize,IndentStyle:2,NewLineCharacter:`
10
10
  `,InsertSpaceAfterCommaDelimiter:!0,InsertSpaceAfterSemicolonInForStatements:!0,InsertSpaceBeforeAndAfterBinaryOperators:!0,InsertSpaceAfterKeywordsInControlFlowStatements:!0,InsertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,PlaceOpenBraceOnNewLineForControlBlocks:!1,PlaceOpenBraceOnNewLineForFunctions:!1}}_convertTextChanges(o,e){return{text:e.newText,range:this._textSpanToRange(o,e.span)}}}class q extends f{constructor(){super(...arguments);this.canFormatMultipleRanges=!1}async provideDocumentRangeFormattingEdits(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getFormattingEditsForRange(r.toString(),s,d,f._convertOptions(n));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class B extends f{get autoFormatTriggerCharacters(){return[";","}",`
11
11
  `]}async provideOnTypeFormattingEdits(o,e,n,c,r){let s=o.uri,d=o.getOffsetAt(e),t=await this._worker(s);if(o.isDisposed())return;let l=await t.getFormattingEditsAfterKeystroke(s.toString(),d,n,f._convertOptions(c));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class F extends f{async provideCodeActions(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=f._convertOptions(o.getOptions()),l=n.markers.filter((u)=>u.code).map((u)=>u.code).map(Number),p=await this._worker(r);if(o.isDisposed())return;let g=await p.getCodeFixesAtPosition(r.toString(),s,d,l,t);if(!g||o.isDisposed())return{actions:[],dispose:()=>{}};return{actions:g.filter((u)=>u.changes.filter((w)=>w.isNewFile).length===0).map((u)=>this._tsCodeFixActionToMonacoCodeAction(o,n,u)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(o,e,n){let c=[];for(let s of n.changes)for(let d of s.textChanges)c.push({resource:o.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(o,d.span),text:d.newText}});return{title:n.description,edit:{edits:c},diagnostics:e.markers,kind:"quickfix"}}}class E extends b{constructor(o,e){super(e);this._libFiles=o}async provideRenameEdits(o,e,n,c){let r=o.uri,s=r.toString(),d=o.getOffsetAt(e),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getRenameInfo(s,d,{allowRenameOfImportPath:!1});if(l.canRename===!1)return{edits:[],rejectReason:l.localizedErrorMessage};if(l.fileToRename!==void 0)throw Error("Renaming files is not supported.");let p=await t.findRenameLocations(s,d,!1,!1,!1);if(!p||o.isDisposed())return;let g=[];for(let m of p){let u=this._libFiles.getOrCreateModel(m.fileName);if(u)g.push({resource:u.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(u,m.textSpan),text:n}});else throw Error(`Unknown file ${m.fileName}.`)}return{edits:g}}}class N extends b{async provideInlayHints(o,e,n){let c=o.uri,r=c.toString(),s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(c);if(o.isDisposed())return null;return{hints:(await t.provideInlayHints(r,s,d)).map((g)=>({...g,label:g.text,position:o.getPositionAt(g.position),kind:this._convertHintKind(g.kind)})),dispose:()=>{}}}_convertHintKind(o){switch(o){case"Parameter":return pe.InlayHintKind.Parameter;case"Type":return pe.InlayHintKind.Type;default:return pe.InlayHintKind.Type}}}var W,H;function Ot(o){H=O(o,"typescript")}function _t(o){W=O(o,"javascript")}function Pt(){return new Promise((o,e)=>{if(!W)return e("JavaScript not registered!");o(W)})}function Vt(){return new Promise((o,e)=>{if(!H)return e("TypeScript not registered!");o(H)})}function O(o,e){let n=[],c=new z(e,o),r=(...t)=>c.getLanguageServiceWorker(...t),s=new A(r);function d(){let{modeConfiguration:t}=o;if(_(n),t.completionItems)n.push(pe.registerCompletionItemProvider(e,new x(r)));if(t.signatureHelp)n.push(pe.registerSignatureHelpProvider(e,new L(r)));if(t.hovers)n.push(pe.registerHoverProvider(e,new S(r)));if(t.documentHighlights)n.push(pe.registerDocumentHighlightProvider(e,new I(r)));if(t.definitions)n.push(pe.registerDefinitionProvider(e,new T(s,r)));if(t.references)n.push(pe.registerReferenceProvider(e,new D(s,r)));if(t.documentSymbols)n.push(pe.registerDocumentSymbolProvider(e,new j(r)));if(t.rename)n.push(pe.registerRenameProvider(e,new E(s,r)));if(t.documentRangeFormattingEdits)n.push(pe.registerDocumentRangeFormattingEditProvider(e,new q(r)));if(t.onTypeFormattingEdits)n.push(pe.registerOnTypeFormattingEditProvider(e,new B(r)));if(t.codeActions)n.push(pe.registerCodeActionProvider(e,new F(r)));if(t.inlayHints)n.push(pe.registerInlayHintsProvider(e,new N(r)));if(t.diagnostics)n.push(new C(s,o,e,r))}return d(),r}function _(o){while(o.length)o.pop().dispose()}export{b as Adapter,F as CodeActionAdaptor,T as DefinitionAdapter,C as DiagnosticsAdapter,I as DocumentHighlightAdapter,q as FormatAdapter,f as FormatHelper,B as FormatOnTypeAdapter,N as InlayHintsAdapter,a as Kind,A as LibFiles,j as OutlineAdapter,S as QuickInfoAdapter,D as ReferenceAdapter,E as RenameAdapter,L as SignatureHelpAdapter,x as SuggestAdapter,z as WorkerManager,M as flattenDiagnosticMessageText,Pt as getJavaScriptWorker,Vt as getTypeScriptWorker,_t as setupJavaScript,Ot as setupTypeScript};
12
12
 
13
- //# debugId=EE4336E500CF28AB64756E2164756E21
14
- //# sourceMappingURL=tsMode-k9s9fcag.js.map
13
+ //# debugId=D807A88CE23FC92D64756E2164756E21
14
+ //# sourceMappingURL=tsMode-gr0m4dzr.js.map
@@ -0,0 +1,4 @@
1
+ import{Qn,yp,QC,m,u,Rr,Hn,Ku,$r,wp,Mx,Px,Fl,xp,_p,Cp,Ju,qa,kp,Ec,No,jl,Fx,Sv,ek,jx,tk,nk,ci,km,Ev,ik}from"./studio-3aey7dd3.js";import"./studio-z8w183sh.js";import"./studio-tt2nactf.js";import"./studio-qpqa7vk3.js";import"./studio-vzacdfsc.js";export{QC as MAX_PANES,Qn as PRIMARY_PANE,yp as SECONDARY_PANE,ci as activateTab,Rr as activePane,u as activeTab,tk as closeAllTabs,xp as closePane,jx as closeTab,Cp as detachTab,$r as focusPane,Ju as insertIntoPane,wp as isPaneFocused,kp as isTabActive,ek as moveTab,km as moveTabToPane,No as openTab,Px as paneBeside,Hn as paneById,_p as paneIsEmpty,Ku as paneOfTab,Fx as promoteDirtyPreviewTabs,jl as promoteTab,Fl as receivingPane,ik as registerTabCommands,Ev as renameTab,nk as replaceAllTabs,Sv as setTabPinned,qa as setWorkspaceProject,Mx as splitRight,Ec as tabIsLive,m as workspace};
2
+
3
+ //# debugId=504DB0D9E92890A064756E2164756E21
4
+ //# sourceMappingURL=workspace-m15qtcqp.js.map
@@ -1,4 +1,4 @@
1
- import{ac,fS,mS,gS,kf,y_,Sf,Uy,w_,x_}from"./studio-c6zdm25z.js";import{zg}from"./studio-1wvfxkyy.js";var O=Math.floor;var Q=(t,e)=>t<e?t:e,tt=(t,e)=>t>e?t:e;var F=128;var w=127;var{MAX_SAFE_INTEGER:rt,MIN_SAFE_INTEGER:ne}=Number;var nt=()=>new Set;var st=Array.from;var{fromCharCode:Dt,fromCodePoint:se}=String,ie=Dt(65535);var Et=(t)=>{let e=unescape(encodeURIComponent(t)),o=e.length,r=new Uint8Array(o);for(let i=0;i<o;i++)r[i]=e.codePointAt(i);return r},B=typeof TextEncoder<"u"?new TextEncoder:null,Ot=(t)=>B.encode(t),it=B?Ot:Et;var U=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});if(U&&U.decode(new Uint8Array).length===1)U=null;class at{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var lt=()=>new at;var _t=(t)=>{let e=t.cpos;for(let o=0;o<t.bufs.length;o++)e+=t.bufs[o].length;return e};var pt=(t)=>{let e=new Uint8Array(_t(t)),o=0;for(let r=0;r<t.bufs.length;r++){let i=t.bufs[r];e.set(i,o),o+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),o),e};var V=(t,e)=>{let o=t.cbuf.length;if(t.cpos===o)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(o*2),t.cpos=0;t.cbuf[t.cpos++]=e};var b=(t,e)=>{while(e>w)V(t,F|w&e),e=O(e/128);V(t,w&e)};var q=new Uint8Array(30000),Nt=q.length/3,Mt=(t,e)=>{if(e.length<Nt){let o=B.encodeInto(e,q).written||0;b(t,o);for(let r=0;r<o;r++)V(t,q[r])}else C(t,it(e))},Lt=(t,e)=>{let o=unescape(encodeURIComponent(e)),r=o.length;b(t,r);for(let i=0;i<r;i++)V(t,o.codePointAt(i))},ut=B&&B.encodeInto?Mt:Lt;var Rt=(t,e)=>{let o=t.cbuf.length,r=t.cpos,i=Q(o-r,e.length),c=e.length-i;if(t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,c>0)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(tt(o*2,c)),t.cbuf.set(e.subarray(i)),t.cpos=c},C=(t,e)=>{b(t,e.byteLength),Rt(t,e)};var ue=new DataView(new ArrayBuffer(4));var j=(t)=>Error(t);var qt=j("Unexpected end of array"),jt=j("Integer out of Range");class dt{constructor(t){this.arr=t,this.pos=0}}var yt=(t)=>new dt(t);var zt=(t,e)=>{let o=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,o},_=(t)=>zt(t,I(t));var ht=(t)=>t.arr[t.pos++];var I=(t)=>{let e=0,o=1,r=t.arr.length;while(t.pos<r){let i=t.arr[t.pos++];if(e=e+(i&w)*o,o*=128,i<F)return e;if(e>rt)throw jt}throw qt};var Yt=(t)=>{let e=I(t);if(e===0)return"";else{let o=String.fromCodePoint(ht(t));if(--e<100)while(e--)o+=String.fromCodePoint(ht(t));else while(e>0){let r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,o+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(o))}},Wt=(t)=>U.decode(_(t)),xt=U?Wt:Yt;var D=Date.now;var N=()=>new Map;var mt=(t,e,o)=>{let r=t.get(e);if(r===void 0)t.set(e,r=o());return r};class z{constructor(){this._observers=N()}on(t,e){mt(this._observers,t,nt).add(e)}once(t,e){let o=(...r)=>{this.off(t,o),e(...r)};this.on(t,o)}off(t,e){let o=this._observers.get(t);if(o!==void 0){if(o.delete(e),o.size===0)this._observers.delete(t)}}emit(t,e){return st((this._observers.get(t)||N()).values()).forEach((o)=>o(...e))}destroy(){this._observers=N()}}var Y=Symbol("Equality");var Zt=Object.keys;var W=(t)=>Zt(t).length;var bt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var v=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Y]!=null)return t[Y](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;break}case Set:{if(t.size!==e.size)return!1;for(let o of t)if(!e.has(o))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let o of t.keys())if(!e.has(o)||!v(t.get(o),e.get(o)))return!1;break}case void 0:case Object:if(W(t)!==W(e))return!1;for(let o in t)if(!bt(t,o)||!v(t[o],e[o]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!v(t[o],e[o]))return!1;break;default:return!1}return!0};var H=30000;class G extends z{constructor(t){super();this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=D();if(this.getLocalState()!==null&&H/2<=e-this.meta.get(this.clientID).lastUpdated)this.setLocalState(this.getLocalState());let o=[];if(this.meta.forEach((r,i)=>{if(i!==this.clientID&&H<=e-r.lastUpdated&&this.states.has(i))o.push(i)}),o.length>0)X(this,o,"timeout")},O(H/10)),t.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){let e=this.clientID,o=this.meta.get(e),r=o===void 0?0:o.clock+1,i=this.states.get(e);if(t===null)this.states.delete(e);else this.states.set(e,t);this.meta.set(e,{clock:r,lastUpdated:D()});let c=[],l=[],h=[],d=[];if(t===null)d.push(e);else if(i==null){if(t!=null)c.push(e)}else if(l.push(e),!v(i,t))h.push(e);if(c.length>0||h.length>0||d.length>0)this.emit("change",[{added:c,updated:h,removed:d},"local"]);this.emit("update",[{added:c,updated:l,removed:d},"local"])}setLocalStateField(t,e){let o=this.getLocalState();if(o!==null)this.setLocalState({...o,[t]:e})}getStates(){return this.states}}var X=(t,e,o)=>{let r=[];for(let i=0;i<e.length;i++){let c=e[i];if(t.states.has(c)){if(t.states.delete(c),c===t.clientID){let l=t.meta.get(c);t.meta.set(c,{clock:l.clock+1,lastUpdated:D()})}r.push(c)}}if(r.length>0)t.emit("change",[{added:[],updated:[],removed:r},o]),t.emit("update",[{added:[],updated:[],removed:r},o])},Z=(t,e,o=t.states)=>{let r=e.length,i=lt();b(i,r);for(let c=0;c<r;c++){let l=e[c],h=o.get(l)||null,d=t.meta.get(l).clock;b(i,l),b(i,d),ut(i,JSON.stringify(h))}return pt(i)};var It=(t,e,o)=>{let r=yt(e),i=D(),c=[],l=[],h=[],d=[],A=I(r);for(let S=0;S<A;S++){let y=I(r),x=I(r),m=JSON.parse(xt(r)),T=t.meta.get(y),L=t.states.get(y),k=T===void 0?0:T.clock;if(k<x||k===x&&m===null&&t.states.has(y)){if(m===null)if(y===t.clientID&&t.getLocalState()!=null)x++;else t.states.delete(y);else t.states.set(y,m);if(t.meta.set(y,{clock:x,lastUpdated:i}),T===void 0&&m!==null)c.push(y);else if(T!==void 0&&m===null)d.push(y);else if(m!==null){if(!v(m,L))h.push(y);l.push(y)}}}if(c.length>0||h.length>0||d.length>0)t.emit("change",[{added:c,updated:h,removed:d},o]);if(c.length>0||l.length>0||d.length>0)t.emit("update",[{added:c,updated:l,removed:d},o])};var St=0,M=1,Tt=2,wt=(t,e)=>{b(t,St);let o=gS(e);C(t,o)},Qt=(t,e,o)=>{b(t,M),C(t,mS(e,o))},te=(t,e,o)=>Qt(e,o,_(t)),Ut=(t,e,o,r)=>{try{fS(e,_(t),o)}catch(i){if(r!=null)r(i);console.error("Caught error while handling a Yjs update",i)}},Bt=(t,e)=>{b(t,Tt),C(t,e)},ee=Ut,vt=(t,e,o,r,i)=>{let c=I(t);switch(c){case St:te(t,e,o);break;case M:Ut(t,o,r,i);break;case Tt:ee(t,o,r,i);break;default:throw Error("Unknown message type")}return c};var re=1;function Te(t){let e=t.webSocketImpl??globalThis.WebSocket,o=t.openTimeoutMs??1e4,r=new Map,i=new Set,c=new ac,l=new G(c);l.setLocalState(null);let h=null,d=null,A="connecting",S=!1,y=(n)=>{if(A===n)return;A=n;for(let s of i)s(n)},x=(n)=>{if(h&&h.readyState===re)try{h.send(w_(n))}catch{}},m=(n)=>{x({message:{path:n,type:"open"},type:"control"})};l.on("update",(n,s)=>{if(s==="remote")return;let p=[...n.added,...n.updated,...n.removed];x({body:Z(l,p),type:"awareness"})});let T=(n)=>{switch(n.type){case"hello":{d={color:n.color,login:n.login,permission:n.permission,...n.name===void 0?{}:{name:n.name},...n.avatarUrl===void 0?{}:{avatarUrl:n.avatarUrl}};return}case"opened":{let s=r.get(n.path);if(!s)return;if(s.opened&&s.epoch!==n.epoch){k(n.path,s);return}s.epoch=n.epoch,s.opened=!0,s.resolveOpen?.(!0),s.resolveOpen=null;let p=kf();wt(p,s.doc),x({body:Sf(p),epoch:s.epoch,path:n.path,type:"doc-sync"});return}case"doc-reset":{let s=r.get(n.path);if(s)k(n.path,s);return}case"flush-ack":{let s=r.get(n.path);if(s){for(let p of s.pendingFlush)p();s.pendingFlush.clear()}return}case"doc-dirty":{let s=r.get(n.path);if(s){s.dirty=n.dirty;for(let p of s.dirtyCbs)p(n.dirty)}return}case"error":{if(!n.path)return;let s=r.get(n.path);if(!s)return;if(n.code==="content-not-loaded"&&t.hydratePath&&!s.hydrated){s.hydrated=!0,t.hydratePath(n.path).then(()=>m(n.path),()=>{s.resolveOpen?.(!1),s.resolveOpen=null});return}if(!s.opened)s.resolveOpen?.(!1),s.resolveOpen=null;break}default:break}},L=(n,s,p)=>{let f=r.get(n);if(!f||!f.opened||f.epoch!==s)return;let a=Uy(p),g=kf(),K=vt(a,g,f.doc,"remote");if(y_(g)>0)x({body:Sf(g),epoch:s,path:n,type:"doc-sync"});if(K===M&&!f.synced)f.synced=!0,f.resolveSynced()},k=(n,s)=>{r.delete(n),s.resolveOpen?.(!1),s.resolveOpen=null;for(let p of s.resetCbs)p();s.doc.destroy()},J=()=>{y("connecting");let n=t.protocols,s=n===void 0||n.length===0?new e(t.url):new e(t.url,n);h=s,s.binaryType="arraybuffer",s.onopen=()=>{R.opened(),y("connected");for(let f of r.keys())m(f);if(l.getLocalState()!==null)x({body:Z(l,[l.clientID]),type:"awareness"})},s.onmessage=(p)=>{let f=p.data,a=f instanceof ArrayBuffer?new Uint8Array(f):f instanceof Uint8Array?f:null;if(!a)return;let g;try{g=x_(a)}catch{return}switch(g.type){case"control":{T(g.message);return}case"doc-sync":{L(g.path,g.epoch,g.body);return}case"awareness":{It(l,g.body,"remote");break}default:break}},s.onclose=()=>{if(S)return;y("offline");for(let p of r.values())p.opened=!1;R.scheduleRetry()},s.onerror=()=>{}},R=zg(J,{...t.reconnectDelayMs===void 0?{}:{baseMs:t.reconnectDelayMs},...t.reconnectRandom===void 0?{}:{random:t.reconnectRandom}});return J(),{destroy(){if(S)return;S=!0,R.dispose(),X(l,[l.clientID],"destroy"),l.destroy(),c.destroy();for(let[n,s]of r)s.resolveOpen?.(!1),s.doc.destroy(),r.delete(n);h?.close()},async openDoc(n){if(S)return null;let s=r.get(n);if(s&&!s.handleDestroyed)return null;let p=()=>{},f=new Promise((u)=>{p=u}),a={dirty:!1,dirtyCbs:new Set,doc:new ac,epoch:0,handleDestroyed:!1,hydrated:!1,opened:!1,pendingFlush:new Set,resetCbs:new Set,resolveOpen:null,resolveSynced:p,synced:!1,whenSynced:f};if(r.set(n,a),a.doc.on("update",(u,P)=>{if(P==="remote"||!a.opened)return;let E=kf();Bt(E,u),x({body:Sf(E),epoch:a.epoch,path:n,type:"doc-sync"})}),!await new Promise((u)=>{a.resolveOpen=u;let P=setTimeout(()=>{a.resolveOpen=null,u(!1)},o);a.resolveOpen=(E)=>{clearTimeout(P),u(E)},m(n)})){if(r.get(n)===a)r.delete(n);return a.doc.destroy(),null}return{awareness:l,destroy:()=>{if(a.handleDestroyed)return;if(a.handleDestroyed=!0,r.get(n)===a)r.delete(n),x({path:n,type:"doc-close"});a.doc.destroy()},doc:a.doc,flush:()=>new Promise((u)=>{a.pendingFlush.add(u),x({message:{path:n,type:"flush"},type:"control"})}),identity:()=>d,onDirty:(u)=>(a.dirtyCbs.add(u),u(a.dirty),()=>a.dirtyCbs.delete(u)),onReset:(u)=>(a.resetCbs.add(u),()=>a.resetCbs.delete(u)),onStatus:(u)=>(i.add(u),()=>i.delete(u)),whenSynced:a.whenSynced}},status:()=>A}}export{Te as createWsCollabConnection};
1
+ import{lc,gS,bS,vS,Sf,x_,Ef,qy,__,C_}from"./studio-q4tv82h7.js";import{Wg}from"./studio-0x3jyb8r.js";var O=Math.floor;var Q=(t,e)=>t<e?t:e,tt=(t,e)=>t>e?t:e;var F=128;var w=127;var{MAX_SAFE_INTEGER:rt,MIN_SAFE_INTEGER:ne}=Number;var nt=()=>new Set;var st=Array.from;var{fromCharCode:Dt,fromCodePoint:se}=String,ie=Dt(65535);var Et=(t)=>{let e=unescape(encodeURIComponent(t)),o=e.length,r=new Uint8Array(o);for(let i=0;i<o;i++)r[i]=e.codePointAt(i);return r},B=typeof TextEncoder<"u"?new TextEncoder:null,Ot=(t)=>B.encode(t),it=B?Ot:Et;var U=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});if(U&&U.decode(new Uint8Array).length===1)U=null;class at{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var lt=()=>new at;var _t=(t)=>{let e=t.cpos;for(let o=0;o<t.bufs.length;o++)e+=t.bufs[o].length;return e};var pt=(t)=>{let e=new Uint8Array(_t(t)),o=0;for(let r=0;r<t.bufs.length;r++){let i=t.bufs[r];e.set(i,o),o+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),o),e};var V=(t,e)=>{let o=t.cbuf.length;if(t.cpos===o)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(o*2),t.cpos=0;t.cbuf[t.cpos++]=e};var b=(t,e)=>{while(e>w)V(t,F|w&e),e=O(e/128);V(t,w&e)};var q=new Uint8Array(30000),Nt=q.length/3,Mt=(t,e)=>{if(e.length<Nt){let o=B.encodeInto(e,q).written||0;b(t,o);for(let r=0;r<o;r++)V(t,q[r])}else C(t,it(e))},Lt=(t,e)=>{let o=unescape(encodeURIComponent(e)),r=o.length;b(t,r);for(let i=0;i<r;i++)V(t,o.codePointAt(i))},ut=B&&B.encodeInto?Mt:Lt;var Rt=(t,e)=>{let o=t.cbuf.length,r=t.cpos,i=Q(o-r,e.length),c=e.length-i;if(t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,c>0)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(tt(o*2,c)),t.cbuf.set(e.subarray(i)),t.cpos=c},C=(t,e)=>{b(t,e.byteLength),Rt(t,e)};var ue=new DataView(new ArrayBuffer(4));var j=(t)=>Error(t);var qt=j("Unexpected end of array"),jt=j("Integer out of Range");class dt{constructor(t){this.arr=t,this.pos=0}}var yt=(t)=>new dt(t);var zt=(t,e)=>{let o=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,o},_=(t)=>zt(t,I(t));var ht=(t)=>t.arr[t.pos++];var I=(t)=>{let e=0,o=1,r=t.arr.length;while(t.pos<r){let i=t.arr[t.pos++];if(e=e+(i&w)*o,o*=128,i<F)return e;if(e>rt)throw jt}throw qt};var Yt=(t)=>{let e=I(t);if(e===0)return"";else{let o=String.fromCodePoint(ht(t));if(--e<100)while(e--)o+=String.fromCodePoint(ht(t));else while(e>0){let r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,o+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(o))}},Wt=(t)=>U.decode(_(t)),xt=U?Wt:Yt;var D=Date.now;var N=()=>new Map;var mt=(t,e,o)=>{let r=t.get(e);if(r===void 0)t.set(e,r=o());return r};class z{constructor(){this._observers=N()}on(t,e){mt(this._observers,t,nt).add(e)}once(t,e){let o=(...r)=>{this.off(t,o),e(...r)};this.on(t,o)}off(t,e){let o=this._observers.get(t);if(o!==void 0){if(o.delete(e),o.size===0)this._observers.delete(t)}}emit(t,e){return st((this._observers.get(t)||N()).values()).forEach((o)=>o(...e))}destroy(){this._observers=N()}}var Y=Symbol("Equality");var Zt=Object.keys;var W=(t)=>Zt(t).length;var bt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var v=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Y]!=null)return t[Y](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;break}case Set:{if(t.size!==e.size)return!1;for(let o of t)if(!e.has(o))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let o of t.keys())if(!e.has(o)||!v(t.get(o),e.get(o)))return!1;break}case void 0:case Object:if(W(t)!==W(e))return!1;for(let o in t)if(!bt(t,o)||!v(t[o],e[o]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!v(t[o],e[o]))return!1;break;default:return!1}return!0};var H=30000;class G extends z{constructor(t){super();this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=D();if(this.getLocalState()!==null&&H/2<=e-this.meta.get(this.clientID).lastUpdated)this.setLocalState(this.getLocalState());let o=[];if(this.meta.forEach((r,i)=>{if(i!==this.clientID&&H<=e-r.lastUpdated&&this.states.has(i))o.push(i)}),o.length>0)X(this,o,"timeout")},O(H/10)),t.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){let e=this.clientID,o=this.meta.get(e),r=o===void 0?0:o.clock+1,i=this.states.get(e);if(t===null)this.states.delete(e);else this.states.set(e,t);this.meta.set(e,{clock:r,lastUpdated:D()});let c=[],l=[],h=[],d=[];if(t===null)d.push(e);else if(i==null){if(t!=null)c.push(e)}else if(l.push(e),!v(i,t))h.push(e);if(c.length>0||h.length>0||d.length>0)this.emit("change",[{added:c,updated:h,removed:d},"local"]);this.emit("update",[{added:c,updated:l,removed:d},"local"])}setLocalStateField(t,e){let o=this.getLocalState();if(o!==null)this.setLocalState({...o,[t]:e})}getStates(){return this.states}}var X=(t,e,o)=>{let r=[];for(let i=0;i<e.length;i++){let c=e[i];if(t.states.has(c)){if(t.states.delete(c),c===t.clientID){let l=t.meta.get(c);t.meta.set(c,{clock:l.clock+1,lastUpdated:D()})}r.push(c)}}if(r.length>0)t.emit("change",[{added:[],updated:[],removed:r},o]),t.emit("update",[{added:[],updated:[],removed:r},o])},Z=(t,e,o=t.states)=>{let r=e.length,i=lt();b(i,r);for(let c=0;c<r;c++){let l=e[c],h=o.get(l)||null,d=t.meta.get(l).clock;b(i,l),b(i,d),ut(i,JSON.stringify(h))}return pt(i)};var It=(t,e,o)=>{let r=yt(e),i=D(),c=[],l=[],h=[],d=[],A=I(r);for(let S=0;S<A;S++){let y=I(r),x=I(r),m=JSON.parse(xt(r)),T=t.meta.get(y),L=t.states.get(y),k=T===void 0?0:T.clock;if(k<x||k===x&&m===null&&t.states.has(y)){if(m===null)if(y===t.clientID&&t.getLocalState()!=null)x++;else t.states.delete(y);else t.states.set(y,m);if(t.meta.set(y,{clock:x,lastUpdated:i}),T===void 0&&m!==null)c.push(y);else if(T!==void 0&&m===null)d.push(y);else if(m!==null){if(!v(m,L))h.push(y);l.push(y)}}}if(c.length>0||h.length>0||d.length>0)t.emit("change",[{added:c,updated:h,removed:d},o]);if(c.length>0||l.length>0||d.length>0)t.emit("update",[{added:c,updated:l,removed:d},o])};var St=0,M=1,Tt=2,wt=(t,e)=>{b(t,St);let o=vS(e);C(t,o)},Qt=(t,e,o)=>{b(t,M),C(t,bS(e,o))},te=(t,e,o)=>Qt(e,o,_(t)),Ut=(t,e,o,r)=>{try{gS(e,_(t),o)}catch(i){if(r!=null)r(i);console.error("Caught error while handling a Yjs update",i)}},Bt=(t,e)=>{b(t,Tt),C(t,e)},ee=Ut,vt=(t,e,o,r,i)=>{let c=I(t);switch(c){case St:te(t,e,o);break;case M:Ut(t,o,r,i);break;case Tt:ee(t,o,r,i);break;default:throw Error("Unknown message type")}return c};var re=1;function Te(t){let e=t.webSocketImpl??globalThis.WebSocket,o=t.openTimeoutMs??1e4,r=new Map,i=new Set,c=new lc,l=new G(c);l.setLocalState(null);let h=null,d=null,A="connecting",S=!1,y=(n)=>{if(A===n)return;A=n;for(let s of i)s(n)},x=(n)=>{if(h&&h.readyState===re)try{h.send(__(n))}catch{}},m=(n)=>{x({message:{path:n,type:"open"},type:"control"})};l.on("update",(n,s)=>{if(s==="remote")return;let p=[...n.added,...n.updated,...n.removed];x({body:Z(l,p),type:"awareness"})});let T=(n)=>{switch(n.type){case"hello":{d={color:n.color,login:n.login,permission:n.permission,...n.name===void 0?{}:{name:n.name},...n.avatarUrl===void 0?{}:{avatarUrl:n.avatarUrl}};return}case"opened":{let s=r.get(n.path);if(!s)return;if(s.opened&&s.epoch!==n.epoch){k(n.path,s);return}s.epoch=n.epoch,s.opened=!0,s.resolveOpen?.(!0),s.resolveOpen=null;let p=Sf();wt(p,s.doc),x({body:Ef(p),epoch:s.epoch,path:n.path,type:"doc-sync"});return}case"doc-reset":{let s=r.get(n.path);if(s)k(n.path,s);return}case"flush-ack":{let s=r.get(n.path);if(s){for(let p of s.pendingFlush)p();s.pendingFlush.clear()}return}case"doc-dirty":{let s=r.get(n.path);if(s){s.dirty=n.dirty;for(let p of s.dirtyCbs)p(n.dirty)}return}case"error":{if(!n.path)return;let s=r.get(n.path);if(!s)return;if(n.code==="content-not-loaded"&&t.hydratePath&&!s.hydrated){s.hydrated=!0,t.hydratePath(n.path).then(()=>m(n.path),()=>{s.resolveOpen?.(!1),s.resolveOpen=null});return}if(!s.opened)s.resolveOpen?.(!1),s.resolveOpen=null;break}default:break}},L=(n,s,p)=>{let f=r.get(n);if(!f||!f.opened||f.epoch!==s)return;let a=qy(p),g=Sf(),K=vt(a,g,f.doc,"remote");if(x_(g)>0)x({body:Ef(g),epoch:s,path:n,type:"doc-sync"});if(K===M&&!f.synced)f.synced=!0,f.resolveSynced()},k=(n,s)=>{r.delete(n),s.resolveOpen?.(!1),s.resolveOpen=null;for(let p of s.resetCbs)p();s.doc.destroy()},J=()=>{y("connecting");let n=t.protocols,s=n===void 0||n.length===0?new e(t.url):new e(t.url,n);h=s,s.binaryType="arraybuffer",s.onopen=()=>{R.opened(),y("connected");for(let f of r.keys())m(f);if(l.getLocalState()!==null)x({body:Z(l,[l.clientID]),type:"awareness"})},s.onmessage=(p)=>{let f=p.data,a=f instanceof ArrayBuffer?new Uint8Array(f):f instanceof Uint8Array?f:null;if(!a)return;let g;try{g=C_(a)}catch{return}switch(g.type){case"control":{T(g.message);return}case"doc-sync":{L(g.path,g.epoch,g.body);return}case"awareness":{It(l,g.body,"remote");break}default:break}},s.onclose=()=>{if(S)return;y("offline");for(let p of r.values())p.opened=!1;R.scheduleRetry()},s.onerror=()=>{}},R=Wg(J,{...t.reconnectDelayMs===void 0?{}:{baseMs:t.reconnectDelayMs},...t.reconnectRandom===void 0?{}:{random:t.reconnectRandom}});return J(),{destroy(){if(S)return;S=!0,R.dispose(),X(l,[l.clientID],"destroy"),l.destroy(),c.destroy();for(let[n,s]of r)s.resolveOpen?.(!1),s.doc.destroy(),r.delete(n);h?.close()},async openDoc(n){if(S)return null;let s=r.get(n);if(s&&!s.handleDestroyed)return null;let p=()=>{},f=new Promise((u)=>{p=u}),a={dirty:!1,dirtyCbs:new Set,doc:new lc,epoch:0,handleDestroyed:!1,hydrated:!1,opened:!1,pendingFlush:new Set,resetCbs:new Set,resolveOpen:null,resolveSynced:p,synced:!1,whenSynced:f};if(r.set(n,a),a.doc.on("update",(u,P)=>{if(P==="remote"||!a.opened)return;let E=Sf();Bt(E,u),x({body:Ef(E),epoch:a.epoch,path:n,type:"doc-sync"})}),!await new Promise((u)=>{a.resolveOpen=u;let P=setTimeout(()=>{a.resolveOpen=null,u(!1)},o);a.resolveOpen=(E)=>{clearTimeout(P),u(E)},m(n)})){if(r.get(n)===a)r.delete(n);return a.doc.destroy(),null}return{awareness:l,destroy:()=>{if(a.handleDestroyed)return;if(a.handleDestroyed=!0,r.get(n)===a)r.delete(n),x({path:n,type:"doc-close"});a.doc.destroy()},doc:a.doc,flush:()=>new Promise((u)=>{a.pendingFlush.add(u),x({message:{path:n,type:"flush"},type:"control"})}),identity:()=>d,onDirty:(u)=>(a.dirtyCbs.add(u),u(a.dirty),()=>a.dirtyCbs.delete(u)),onReset:(u)=>(a.resetCbs.add(u),()=>a.resetCbs.delete(u)),onStatus:(u)=>(i.add(u),()=>i.delete(u)),whenSynced:a.whenSynced}},status:()=>A}}export{Te as createWsCollabConnection};
2
2
 
3
- //# debugId=37B8910A9080C27064756E2164756E21
4
- //# sourceMappingURL=ws-client-0ja08haa.js.map
3
+ //# debugId=95EE9FB6414001CC64756E2164756E21
4
+ //# sourceMappingURL=ws-client-nf61frr1.js.map