@jxsuite/studio 5.6.0 → 6.0.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 (176) hide show
  1. package/dist/chunks/{2020-zvax9fmb.js → 2020-cs2sb9t1.js} +3 -3
  2. package/dist/chunks/adapter-y5gdq19c.js +4 -0
  3. package/dist/chunks/{cf-account-picker-zfycs4k2.js → cf-account-picker-bb2yq946.js} +3 -3
  4. package/dist/chunks/cf-settings-20dznc3j.js +4 -0
  5. package/dist/chunks/components-q037dya7.js +4 -0
  6. package/dist/chunks/content-source-t0q184js.js +4 -0
  7. package/dist/chunks/{convert-to-repeater-x19jr6c7.js → convert-to-repeater-vqkt7s3s.js} +3 -3
  8. package/dist/chunks/editor-j5sq149q.js +4 -0
  9. package/dist/chunks/entry-commands-fxzgcc4k.js +4 -0
  10. package/dist/chunks/{extension-sections-y90sa0n4.js → extension-sections-8beq9ac3.js} +3 -3
  11. package/dist/chunks/file-ops-2n77759h.js +4 -0
  12. package/dist/chunks/files-fjy7zpxt.js +4 -0
  13. package/dist/chunks/format-host-wj3mf3n8.js +4 -0
  14. package/dist/chunks/fs-events-7kcgn4e9.js +4 -0
  15. package/dist/chunks/git-panel-7z2mpt2d.js +4 -0
  16. package/dist/chunks/{grid-view-d9mybhn0.js → grid-view-ca10def6.js} +10 -10
  17. package/dist/chunks/iframe-host-a0zjd6xp.js +4 -0
  18. package/dist/chunks/{index-vnwy9d44.js → index-9ydfe04y.js} +3 -3
  19. package/dist/chunks/index-m0x5ztax.js +4 -0
  20. package/dist/chunks/{javascript-f0nrbdjb.js → javascript-d9pqgc2p.js} +2 -2
  21. package/dist/chunks/{jsonMode-nfa90dtf.js → jsonMode-800yvbem.js} +4 -4
  22. package/dist/chunks/jx-validate-zc9zp77s.js +4 -0
  23. package/dist/chunks/layers-p677nrh5.js +4 -0
  24. package/dist/chunks/layers-panel-y4w1dq90.js +4 -0
  25. package/dist/chunks/lit-html-cfn61dn7.js +4 -0
  26. package/dist/chunks/media-picker-xg7yjpz9.js +4 -0
  27. package/dist/chunks/menu-fpekzj6w.js +4 -0
  28. package/dist/chunks/{monaco-binding-antn79jf.js → monaco-binding-62dtmgbf.js} +3 -3
  29. package/dist/chunks/monaco-buffer-nn4dtx27.js +4 -0
  30. package/dist/chunks/{monaco-setup-k8s40vwg.js → monaco-setup-tj13ndtm.js} +3 -3
  31. package/dist/chunks/notify-ahs57a2z.js +4 -0
  32. package/dist/chunks/platform-v9xyfkbx.js +4 -0
  33. package/dist/chunks/publish-panel-xtbfgg2r.js +4 -0
  34. package/dist/chunks/quick-search-d3a6m7j3.js +4 -0
  35. package/dist/chunks/references-99ws0b0m.js +4 -0
  36. package/dist/chunks/right-panel-31vbk5xp.js +4 -0
  37. package/dist/chunks/section-registry-b2yzp9sw.js +4 -0
  38. package/dist/chunks/{studio-y17505ge.js → studio-01kbbqg3.js} +207 -207
  39. package/dist/chunks/{studio-gxna6yta.js → studio-01qza1n3.js} +4 -4
  40. package/dist/chunks/{studio-n2e133d6.js → studio-03wwfvyt.js} +4 -4
  41. package/dist/chunks/{studio-09n3fyy0.js → studio-0bbxhhce.js} +4 -4
  42. package/dist/chunks/studio-1a99w39s.js +5 -0
  43. package/dist/chunks/studio-1q6amtph.js +5 -0
  44. package/dist/chunks/{studio-eegyf5vg.js → studio-1wvfxkyy.js} +4 -4
  45. package/dist/chunks/{studio-z47mm077.js → studio-3ck2a5c4.js} +6 -6
  46. package/dist/chunks/{studio-ymsjnvp9.js → studio-4fde4a0x.js} +4 -4
  47. package/dist/chunks/{studio-je15p5v8.js → studio-4jj9gme2.js} +5 -5
  48. package/dist/chunks/{studio-w8w9frjy.js → studio-4m50vh74.js} +12 -12
  49. package/dist/chunks/{studio-891t1tv9.js → studio-4r0sjtx8.js} +4 -4
  50. package/dist/chunks/{studio-6exg5z4x.js → studio-4xppwncr.js} +3 -3
  51. package/dist/chunks/{studio-011em5cf.js → studio-5d7wfmnp.js} +4 -4
  52. package/dist/chunks/{studio-zkkdbbvd.js → studio-5e9zsamh.js} +6 -6
  53. package/dist/chunks/{studio-pvj970st.js → studio-5gs9th4b.js} +4 -4
  54. package/dist/chunks/{studio-dtmdjmqb.js → studio-5vy2wfm5.js} +4 -4
  55. package/dist/chunks/{studio-654fxcr0.js → studio-7pgy3xaf.js} +4 -4
  56. package/dist/chunks/{studio-z1vdxq0e.js → studio-7qvs7v0m.js} +4 -4
  57. package/dist/chunks/studio-84rtc120.js +5 -0
  58. package/dist/chunks/{studio-ks0ecgjx.js → studio-8xcwewjq.js} +4 -4
  59. package/dist/chunks/{studio-sadckcpp.js → studio-aekhcdzw.js} +5 -5
  60. package/dist/chunks/{studio-mf41717j.js → studio-aje966s9.js} +4 -4
  61. package/dist/chunks/studio-aqmph6k4.js +5 -0
  62. package/dist/chunks/{studio-28pz4s1k.js → studio-bftp4n4b.js} +4 -4
  63. package/dist/chunks/{studio-tzs6njnb.js → studio-c6zdm25z.js} +7 -7
  64. package/dist/chunks/{studio-sgzss898.js → studio-capk0583.js} +7 -7
  65. package/dist/chunks/{studio-805fwp9k.js → studio-cbr9czkn.js} +4 -4
  66. package/dist/chunks/{studio-1pxvgx1t.js → studio-chdmwwzw.js} +4 -4
  67. package/dist/chunks/{studio-dknr8m7b.js → studio-cp1gbff9.js} +7 -7
  68. package/dist/chunks/{studio-ft8pfpp0.js → studio-cqmtbg2p.js} +4 -4
  69. package/dist/chunks/studio-e47215hh.js +5 -0
  70. package/dist/chunks/{studio-9n2j9nqk.js → studio-edbtvcd1.js} +4 -4
  71. package/dist/chunks/{studio-mm8x32gg.js → studio-evwgp1ym.js} +4 -4
  72. package/dist/chunks/{studio-02y9cb4h.js → studio-fbx6twps.js} +5 -5
  73. package/dist/chunks/{studio-0nm2skex.js → studio-fqq890ap.js} +3 -3
  74. package/dist/chunks/studio-fthwn4kf.js +5 -0
  75. package/dist/chunks/{studio-s85vah66.js → studio-g8dsj3d2.js} +5 -5
  76. package/dist/chunks/{studio-0c3fpdqj.js → studio-ge5fqjth.js} +5 -5
  77. package/dist/chunks/{studio-ebt49j3c.js → studio-gjknvzam.js} +5 -5
  78. package/dist/chunks/{studio-zkvyd3ev.js → studio-gp02nqnw.js} +4 -4
  79. package/dist/chunks/{studio-5fc0728f.js → studio-hjbg8d5y.js} +7 -7
  80. package/dist/chunks/{studio-d007j0z3.js → studio-hnvnfbdv.js} +6 -6
  81. package/dist/chunks/{studio-b5rxwkj2.js → studio-mk00zd5d.js} +4 -4
  82. package/dist/chunks/{studio-36s6qjgq.js → studio-n78gjfy8.js} +4 -4
  83. package/dist/chunks/studio-nbxqcgvf.js +5 -0
  84. package/dist/chunks/{studio-y164brht.js → studio-pwqfmt4p.js} +4 -4
  85. package/dist/chunks/studio-qa73881a.js +5 -0
  86. package/dist/chunks/{studio-6zyt56ek.js → studio-r3kaka4d.js} +4 -4
  87. package/dist/chunks/{studio-njmg0e73.js → studio-rmn2dz59.js} +5 -5
  88. package/dist/chunks/{studio-wr0pq67n.js → studio-rr4xkv81.js} +4 -4
  89. package/dist/chunks/{studio-tj28pxa1.js → studio-semd1s8s.js} +4 -4
  90. package/dist/chunks/{studio-7w04zw8h.js → studio-st75kn99.js} +5 -5
  91. package/dist/chunks/{studio-dmymvk2j.js → studio-sxc0zvpt.js} +3 -3
  92. package/dist/chunks/studio-t1eedsyx.js +4 -0
  93. package/dist/chunks/{studio-9tkaykt5.js → studio-tmeq6mjb.js} +4 -4
  94. package/dist/chunks/{studio-153mwkyq.js → studio-tp642n5g.js} +4 -4
  95. package/dist/chunks/{studio-t0v47dpc.js → studio-tzegmy4w.js} +4 -4
  96. package/dist/chunks/studio-vavmwshr.js +5 -0
  97. package/dist/chunks/studio-x5g1xk77.js +5 -0
  98. package/dist/chunks/studio-x92tgnee.js +64 -0
  99. package/dist/chunks/{studio-4yztve2t.js → studio-xg1942as.js} +4 -4
  100. package/dist/chunks/{studio-k9pwvmz8.js → studio-xkfs0dp2.js} +4 -4
  101. package/dist/chunks/{studio-6k1eswp9.js → studio-y7jehjrp.js} +4 -4
  102. package/dist/chunks/{studio-81twpmzj.js → studio-yr04mv2j.js} +4 -4
  103. package/dist/chunks/{studio-gj4j9e7k.js → studio-zd4kayn2.js} +4 -4
  104. package/dist/chunks/{studio-jsr14n1s.js → studio-zev8ssp1.js} +4 -4
  105. package/dist/chunks/{studio-r7yeeqc4.js → studio-ztvcxm3w.js} +4 -4
  106. package/dist/chunks/{tsMode-eq26t9gs.js → tsMode-k9s9fcag.js} +4 -4
  107. package/dist/chunks/workspace-5vmgsagj.js +4 -0
  108. package/dist/chunks/{ws-client-3gxqp06s.js → ws-client-0ja08haa.js} +3 -3
  109. package/dist/iframe-entry.js +3 -3
  110. package/dist/manifest.json +62 -62
  111. package/dist/studio.js +95 -95
  112. package/package.json +12 -12
  113. package/src/canvas/stage-scrollbar.ts +7 -7
  114. package/src/files/file-ops.ts +5 -8
  115. package/src/panels/jump-bar.ts +132 -158
  116. package/src/panels/pane-context.ts +8 -8
  117. package/src/panels/pane-grid.ts +18 -26
  118. package/src/panels/style-panel.ts +2 -2
  119. package/src/services/context-manager.ts +41 -70
  120. package/src/services/document-assistant.ts +12 -3
  121. package/src/services/harness/chat-reducer.ts +115 -0
  122. package/src/services/harness/turn-hooks.ts +50 -0
  123. package/src/services/tool-executor.ts +69 -288
  124. package/src/services/tool-outcomes.ts +12 -10
  125. package/src/studio.ts +2 -5
  126. package/src/surfaces/block-action-bar.json +6 -1
  127. package/src/surfaces/jump-bar.json +9 -12
  128. package/src/surfaces/jump-bar.ts +15 -16
  129. package/src/surfaces/pane-context.json +2 -2
  130. package/src/surfaces/pane-grid.json +8 -25
  131. package/src/surfaces/pane-grid.ts +7 -8
  132. package/src/surfaces/statusbar.json +71 -3
  133. package/src/surfaces/statusbar.ts +66 -139
  134. package/src/surfaces/style-panel.json +3 -3
  135. package/src/surfaces/style-panel.ts +11 -1
  136. package/src/ui/schema-form.ts +6 -2
  137. package/dist/chunks/adapter-6zhjbpmd.js +0 -4
  138. package/dist/chunks/cf-settings-fpa485q3.js +0 -4
  139. package/dist/chunks/components-b0vh4sq8.js +0 -4
  140. package/dist/chunks/content-source-z5t0d0h9.js +0 -4
  141. package/dist/chunks/editor-7e23n4a8.js +0 -4
  142. package/dist/chunks/entry-commands-5cm6aba2.js +0 -4
  143. package/dist/chunks/file-ops-hv7gf757.js +0 -4
  144. package/dist/chunks/files-kb0epdxf.js +0 -4
  145. package/dist/chunks/format-host-eg1wy2bp.js +0 -4
  146. package/dist/chunks/fs-events-ky3vxfmh.js +0 -4
  147. package/dist/chunks/git-panel-yyg3bzp2.js +0 -4
  148. package/dist/chunks/iframe-host-9wdf0hes.js +0 -4
  149. package/dist/chunks/index-2tf0m2ne.js +0 -4
  150. package/dist/chunks/jx-validate-7w11db9v.js +0 -4
  151. package/dist/chunks/layers-7zasrpse.js +0 -4
  152. package/dist/chunks/layers-panel-9nzc4fdq.js +0 -4
  153. package/dist/chunks/lit-html-5qr7nbng.js +0 -4
  154. package/dist/chunks/media-picker-maevn9d4.js +0 -4
  155. package/dist/chunks/menu-wq6q0v3y.js +0 -4
  156. package/dist/chunks/monaco-buffer-9ry2rn5x.js +0 -4
  157. package/dist/chunks/notify-g91gjd6w.js +0 -4
  158. package/dist/chunks/platform-jdwjp2vt.js +0 -4
  159. package/dist/chunks/publish-panel-8yym447p.js +0 -4
  160. package/dist/chunks/quick-search-9bzm9kh3.js +0 -4
  161. package/dist/chunks/references-znssfqvq.js +0 -4
  162. package/dist/chunks/right-panel-czbzktm8.js +0 -4
  163. package/dist/chunks/section-registry-0rtq73qs.js +0 -4
  164. package/dist/chunks/studio-0mm38y62.js +0 -5
  165. package/dist/chunks/studio-27tc8q0h.js +0 -5
  166. package/dist/chunks/studio-7djymzt2.js +0 -5
  167. package/dist/chunks/studio-ant1zbp3.js +0 -5
  168. package/dist/chunks/studio-b29h7g7s.js +0 -5
  169. package/dist/chunks/studio-eb5sty2k.js +0 -5
  170. package/dist/chunks/studio-frv7vjhw.js +0 -5
  171. package/dist/chunks/studio-mb8jhtr4.js +0 -64
  172. package/dist/chunks/studio-nvykrgbj.js +0 -4
  173. package/dist/chunks/studio-nw4q9sdn.js +0 -5
  174. package/dist/chunks/studio-p6avneaq.js +0 -5
  175. package/dist/chunks/studio-vz7b43ng.js +0 -5
  176. package/dist/chunks/workspace-emt8454d.js +0 -4
@@ -1,16 +1,16 @@
1
- import{ge,Q,v,re,PI,S}from"./studio-0nm2skex.js";import{rv,Do,ai,cv,mp,q,ot,yi,li,ke,Ao,ro,je,An,yp,g,Rr,Ua}from"./studio-27tc8q0h.js";import{p}from"./studio-6k1eswp9.js";import{th}from"./studio-ft8pfpp0.js";import{_t,Lr,Ur}from"./studio-tj28pxa1.js";import{te}from"./studio-ery42sqr.js";import{D,Hl,vt}from"./studio-153mwkyq.js";import{me}from"./studio-09n3fyy0.js";function G(e){return e.replaceAll("~","~0").replaceAll("/","~1")}var Me=100;function H(e){let t={blankAfter:new Set,escaped:new Map,inline:new Map},o=0,n=()=>{let a=0;while(o<e.length&&(e[o]===" "||e[o]==="\t"||e[o]==="\r"||e[o]===`
1
+ import{ge,Q,v,re,$I,k}from"./studio-fqq890ap.js";import{iv,$o,ai,cv,fp,q,ot,yi,li,Se,Do,oo,He,Qn,vp,m,$r,Ua}from"./studio-x5g1xk77.js";import{p}from"./studio-y7jehjrp.js";import{th}from"./studio-cqmtbg2p.js";import{_t,Lr,qr}from"./studio-semd1s8s.js";import{te}from"./studio-ery42sqr.js";import{D,Hl,vt}from"./studio-tp642n5g.js";import{me}from"./studio-0bbxhhce.js";function G(e){return e.replaceAll("~","~0").replaceAll("/","~1")}var Oe=100;function H(e){let t={blankAfter:new Set,escaped:new Map,inline:new Map},o=0,n=()=>{let a=0;while(o<e.length&&(e[o]===" "||e[o]==="\t"||e[o]==="\r"||e[o]===`
2
2
  `)){if(e[o]===`
3
3
  `)a+=1;o+=1}return a},r=()=>{let a=o,f=new Set;o+=1;while(o<e.length&&e[o]!=='"')if(e[o]==="\\")if(e[o+1]==="u"){let u=Number.parseInt(e.slice(o+2,o+6),16);if(u>=128)f.add(u);o+=6}else o+=2;else o+=1;return o+=1,{escaped:f,raw:e.slice(a,o)}},i=(a,f)=>{let u=n();if(e[o]===f)return o+=1,!0;if(o+=1,u+=n(),u>=2)t.blankAfter.add(a);return!1},s=(a)=>{n();let f=e[o];if(f==="{"){o+=1;let u=n()>0;if(e[o]==="}"){o+=1;return}t.inline.set(a,!u);while(o<e.length){let l=JSON.parse(r().raw);n(),o+=1;let c=`${a}/${G(l)}`;if(s(c),i(c,"}"))return}}else if(f==="["){if(o+=1,n(),e[o]==="]"){o+=1;return}for(let u=0;o<e.length;u+=1){let l=`${a}/${u}`;if(s(l),i(l,"]"))return}}else if(f==='"'){let{escaped:u}=r();if(u.size>0)t.escaped.set(a,u)}else while(o<e.length&&!`,]} \r
4
- `.includes(e[o]))o+=1};return s(""),t}function hs(e){return{document:JSON.parse(e),layout:H(e)}}var Je=/[^\u0020-\u007E]/,ze=/^[\p{Mn}\p{Me}\p{Cf}]$/u,Fe=/^\p{Emoji_Presentation}$/u;function Be(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=12871&&e!==12351||e>=12880&&e<=19903||e>=19968&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=110593||e>=127488&&e<=127569||e>=131072&&e<=262141)}function ae(e){if(!Je.test(e))return e.length;let t=0;for(let o of e){if(ze.test(o))continue;t+=Be(o.codePointAt(0))||Fe.test(o)?2:1}return t}function Ue(e){return e===void 0||typeof e==="function"||typeof e==="symbol"}function V(e){return Object.entries(e).filter(([,t])=>!Ue(t))}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ge(e){if(e.length<2)return!1;let t=Array.isArray(e[0])?"array":M(e[0])?"object":null;if(t===null)return!1;return e.every((o)=>t==="array"?Array.isArray(o)&&o.length>1:M(o)&&V(o).length>1)}function Ve(e){return e.length>1&&e.every((t)=>typeof t==="number")}function le(e,t){let o=JSON.stringify(e)??"null";return t===void 0?o:o.replaceAll(/[\u0080-\uFFFF]/g,(n)=>{let r=n.codePointAt(0);return t.has(r)?`\\u${r.toString(16).padStart(4,"0")}`:n})}function pr(e,t,o=Me){let n=t?.inline??new Map,r=t?.blankAfter??new Set,i=t?.escaped??new Map,s=(l,c)=>n.get(l)??c,a=(l,c,d)=>{if(Array.isArray(l)){if(l.length===0)return"[]";if(Ge(l))return null;let m=[];for(let[b,h]of l.entries()){let w=`${c}/${b}`,x=r.has(w)?null:a(h,w,d);if(x===null)return null;m.push(x)}return`[${m.join(", ")}]`}if(M(l)){let m=V(l);if(m.length===0)return"{}";if(!s(c,d))return null;let b=[];for(let[h,w]of m){let x=`${c}/${G(h)}`,P=r.has(x)?null:a(w,x,!0);if(P===null)return null;b.push(`${JSON.stringify(h)}: ${P}`)}return`{ ${b.join(", ")} }`}return le(l,i.get(c))},f=(l)=>l.map(({path:c,text:d},m)=>m===l.length-1?d:`${d},
4
+ `.includes(e[o]))o+=1};return s(""),t}function hs(e){return{document:JSON.parse(e),layout:H(e)}}var Me=/[^\u0020-\u007E]/,Je=/^[\p{Mn}\p{Me}\p{Cf}]$/u,ze=/^\p{Emoji_Presentation}$/u;function Fe(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=12871&&e!==12351||e>=12880&&e<=19903||e>=19968&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=110593||e>=127488&&e<=127569||e>=131072&&e<=262141)}function ae(e){if(!Me.test(e))return e.length;let t=0;for(let o of e){if(Je.test(o))continue;t+=Fe(o.codePointAt(0))||ze.test(o)?2:1}return t}function Be(e){return e===void 0||typeof e==="function"||typeof e==="symbol"}function V(e){return Object.entries(e).filter(([,t])=>!Be(t))}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ue(e){if(e.length<2)return!1;let t=Array.isArray(e[0])?"array":M(e[0])?"object":null;if(t===null)return!1;return e.every((o)=>t==="array"?Array.isArray(o)&&o.length>1:M(o)&&V(o).length>1)}function Ge(e){return e.length>1&&e.every((t)=>typeof t==="number")}function le(e,t){let o=JSON.stringify(e)??"null";return t===void 0?o:o.replaceAll(/[\u0080-\uFFFF]/g,(n)=>{let r=n.codePointAt(0);return t.has(r)?`\\u${r.toString(16).padStart(4,"0")}`:n})}function pr(e,t,o=Oe){let n=t?.inline??new Map,r=t?.blankAfter??new Set,i=t?.escaped??new Map,s=(l,c)=>n.get(l)??c,a=(l,c,d)=>{if(Array.isArray(l)){if(l.length===0)return"[]";if(Ue(l))return null;let g=[];for(let[b,h]of l.entries()){let w=`${c}/${b}`,x=r.has(w)?null:a(h,w,d);if(x===null)return null;g.push(x)}return`[${g.join(", ")}]`}if(M(l)){let g=V(l);if(g.length===0)return"{}";if(!s(c,d))return null;let b=[];for(let[h,w]of g){let x=`${c}/${G(h)}`,S=r.has(x)?null:a(w,x,!0);if(S===null)return null;b.push(`${JSON.stringify(h)}: ${S}`)}return`{ ${b.join(", ")} }`}return le(l,i.get(c))},f=(l)=>l.map(({path:c,text:d},g)=>g===l.length-1?d:`${d},
5
5
  ${r.has(c)?`
6
- `:""}`).join(""),u=(l,c,d,m,b,h)=>{let w=a(l,c,b),x=Array.isArray(l)||M(l);if(w!==null&&(!x||m+ae(w)+h<=o))return w;let P=" ".repeat(d+2),B=`
7
- ${" ".repeat(d)}`;if(Array.isArray(l)){if(Ve(l))return`[
8
- ${He(l,P,o,(_)=>r.has(`${c}/${_}`))}${B}]`;let E=l.map((N,_)=>{let A=`${c}/${_}`,O=_===l.length-1,U=u(N,A,d+2,P.length,b,O?0:1);return{path:A,text:`${P}${U}`}});return`[
9
- ${f(E)}${B}]`}let se=V(l),Ne=s(c,b),$e=se.map(([E,N],_)=>{let A=`${c}/${G(E)}`,O=`${JSON.stringify(E)}: `,U=_===se.length-1,De=P.length+ae(O),Oe=u(N,A,d+2,De,Ne,U?0:1);return{path:A,text:`${P}${O}${Oe}`}});return`{
10
- ${f($e)}${B}}`};return`${u(e,"",0,0,!1,0)}
11
- `}function He(e,t,o,n){let r=[],i="";for(let[s,a]of e.entries()){let f=`${le(a)}${s===e.length-1?"":","}`;if(i==="")i=`${t}${f}`;else if(i.length+1+f.length<=o)i=`${i} ${f}`;else r.push(i),i=`${t}${f}`;if(n(s)&&s<e.length-1)r.push(i,""),i=""}return r.push(i),r.join(`
12
- `)}var ce=new Set([An,yp]),Ze=new Set(["auto","light","dark"]);function qe(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function ue(){let e={},t=[];for(let o of g.panes){if(o.derived)continue;let n=[];for(let i of o.tabOrder){let s=g.tabs.get(i);if(!s?.documentPath)continue;n.push(s.documentPath),e[s.documentPath]=qe(s)}if(n.length===0)continue;let r=o.activeTabId?g.tabs.get(o.activeTabId):null;t.push({activeFile:r?.documentPath??null,files:n,id:o.id})}return{focusedPane:g.activePaneId,panes:t,ui:e}}function We(e){if(typeof e!=="object"||e===null)return{};let t=e,o={};if(typeof t.canvasMode==="string")o.canvasMode=t.canvasMode;if(typeof t.preview==="boolean")o.preview=t.preview;if(typeof t.zoom==="number"&&Number.isFinite(t.zoom))o.zoom=t.zoom;if(typeof t.editZoom==="number"&&Number.isFinite(t.editZoom))o.editZoom=t.editZoom;if(t.activeMedia===null||typeof t.activeMedia==="string")o.activeMedia=t.activeMedia;if(typeof t.previewColorScheme==="string"&&Ze.has(t.previewColorScheme))o.previewColorScheme=t.previewColorScheme;if(t.previewLocale===null||rv(t.previewLocale))o.previewLocale=t.previewLocale;if(typeof t.showLayout==="boolean")o.showLayout=t.showLayout;return o}function fe(e){if(typeof e!=="object"||e===null)return null;let t=e;if(!Array.isArray(t.panes))return null;let o=[];for(let r of t.panes){if(typeof r!=="object"||r===null)continue;let i=r;if(typeof i.id!=="string"||!ce.has(i.id))continue;let s=Array.isArray(i.files)?i.files.filter((a)=>typeof a==="string"&&a!==""):[];if(s.length===0)continue;o.push({activeFile:typeof i.activeFile==="string"&&s.includes(i.activeFile)?i.activeFile:null,files:s,id:i.id})}if(o.length===0)return null;let n={};if(typeof t.ui==="object"&&t.ui!==null)for(let[r,i]of Object.entries(t.ui))n[r]=We(i);return{focusedPane:typeof t.focusedPane==="string"&&ce.has(t.focusedPane)?t.focusedPane:An,panes:o,ui:n}}async function sL(e,t){let o=0;if(e.panes.some((n)=>n.id===yp))t.ensureSecondPane();for(let n of e.panes)for(let r of n.files){try{await t.openFile(r,n.id)}catch{}if([...g.tabs.values()].some((i)=>i.documentPath===r))o+=1}if(o===0)return 0;for(let n of g.tabs.values()){let r=n.documentPath?e.ui[n.documentPath]:void 0;if(!r)continue;let{ui:i}=n.session;if(r.canvasMode&&n.capabilities.modes.includes(r.canvasMode))i.canvasMode=r.canvasMode;if(r.preview!==void 0)i.preview=r.preview;if(r.zoom!==void 0)i.zoom=r.zoom;if(r.editZoom!==void 0)i.editZoom=r.editZoom;if(r.activeMedia!==void 0)i.activeMedia=r.activeMedia;if(r.previewColorScheme!==void 0)i.previewColorScheme=r.previewColorScheme;if(r.previewLocale!==void 0)i.previewLocale=r.previewLocale;if(r.showLayout!==void 0)i.showLayout=r.showLayout}for(let n of e.panes){let r=g.panes.find((s)=>s.id===n.id);if(!r||!n.activeFile)continue;let i=r.tabOrder.find((s)=>g.tabs.get(s)?.documentPath===n.activeFile);if(i)r.activeTabId=i}if(g.panes.some((n)=>n.id===e.focusedPane))Rr(e.focusedPane);return o}var pe={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},Ke="default",Ye=/^jx[-._:]/;function Xe(e){return Ye.test(e)}function Qe(){let e=globalThis.localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let n=e.key(o);if(n&&Xe(n))t.push(n)}for(let o of t)e.removeItem(o)}catch{}return t}function et(e){let t=pe[e];if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${Object.keys(pe).join(", ")}`);if(t.reset==="app-state")Qe();return t}var J=null;function de(e){if(J)return J;let t=new URLSearchParams(e??globalThis.location?.search??""),o=et(t.get("profile")??Ke),n=t.get("clock");return J={clock:n===null?null:PI(n),profile:o},J}var W=["files","search","git","i18n","layers","page","data","packages","insert"],tt={blocks:"insert",head:"page",imports:"packages",state:"data"},ye="layers";function ee(e){return typeof e==="string"&&W.includes(e)}function vx(e,t){if(!ee(e))throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return e}function be(e){if(typeof e!=="string")return null;let t=tt[e];if(t)return t;return ee(e)?e:null}var K=["properties","style","events","assistant"],Kb="properties";function yx(e){return typeof e==="string"&&K.includes(e)}var Jb=["problems","logic","activity"],wx="problems";function Yb(e){return typeof e==="string"&&Jb.includes(e)}var Zb=["light","dark"],he="jx-studio-panel-widths",ve="jx-studio-project::",nt="dark";function rt(e){return typeof e==="string"&&Zb.includes(e)}function it(){let e=Lr(_t.theme);return rt(e)?e:nt}var kd=["left","right","bottom"],R={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},aL={bottom:R.bottom.size,left:R.left.size,right:R.right.size},st={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},at={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},OC=0.5,xx=0.2,_x=0.8;function lt(e){return typeof e==="number"&&e>=xx&&e<=_x?e:OC}function lL(e){y.paneSplit=Math.min(_x,Math.max(xx,e))}function ct(){try{return JSON.parse(localStorage.getItem(he)||"{}")}catch{return{}}}function we(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null,subTab:"changes"}}function Se(){return{customizedOnly:!1,filter:"",selection:null,tab:"elements"}}function Pe(){return[{bottomTab:"problems",docks:{bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!0,size:280}},id:"write",inspectorTab:"properties",name:"Write",navigatorPanel:"files"},{bottomTab:"problems",docks:{bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:320}},id:"design",inspectorTab:"style",name:"Design",navigatorPanel:"layers"},{bottomTab:"logic",docks:{bottom:{collapsed:!0,size:260},left:{collapsed:!1,size:280},right:{collapsed:!1,size:300}},id:"build",inspectorTab:"events",name:"Build",navigatorPanel:"data"},{bottomTab:"activity",docks:{bottom:{collapsed:!1,size:240},left:{collapsed:!1,size:300},right:{collapsed:!0,size:280}},id:"ship",inspectorTab:"properties",name:"Ship",navigatorPanel:"git"}]}var z="design";function ut(){let e=ct(),t={};for(let o of kd){let n=e[o],r=e[`${o}Collapsed`];t[o]={collapsed:typeof r==="boolean"?r:R[o].collapsed,size:typeof n==="number"&&n>0?n:R[o].size}}return{bottomTab:Yb(e.bottomTab)?e.bottomTab:wx,docks:t,focusRegion:"pane",paneSplit:lt(e.paneSplit),git:we(),layout:z,layoutSelection:null,layouts:Pe(),leftTab:be(e.leftTab)??ye,settingsTab:"stylebook",stylebook:Se(),theme:it()}}de();var y=v(ut());function Ed(){try{localStorage.setItem(he,JSON.stringify({bottom:y.docks.bottom.size,bottomCollapsed:y.docks.bottom.collapsed,bottomTab:y.bottomTab,left:y.docks.left.size,leftCollapsed:y.docks.left.collapsed,leftTab:y.leftTab,paneSplit:y.paneSplit,right:y.docks.right.size,rightCollapsed:y.docks.right.collapsed}))}catch{}}var Y;function ft(e){if(typeof e!=="object"||e===null)return!1;let t=e;return typeof t.id==="string"&&t.id!==""&&typeof t.name==="string"&&ee(t.navigatorPanel)&&yx(t.inspectorTab)&&Yb(t.bottomTab)&&kd.every((o)=>typeof t.docks?.[o]?.size==="number")}function oe(e){if(!e)return{};try{return JSON.parse(localStorage.getItem(`${ve}${e}`)||"{}")}catch{return{}}}function pt(e){let t={activeLayout:null,layouts:Pe()};if(!e)return t;let o=oe(e),n=Array.isArray(o.layouts)?o.layouts.filter(ft):[];if(n.length===0)return t;return{activeLayout:typeof o.activeLayout==="string"?o.activeLayout:null,layouts:n}}function cL(e){return fe(oe(e).session)}var ne=null;function Xb(e){ne=e}function dL(){C()}function C(){let e=g.projectRoot;if(!e)return;try{localStorage.setItem(`${ve}${e}`,JSON.stringify({activeLayout:y.layout,layouts:y.layouts,session:e===ne?ue():oe(e).session}))}catch{}}function dt(e){if(e===Y)return;Y=e;let{activeLayout:t,layouts:o}=pt(e);y.layouts=o;let n=(r)=>r!==null&&o.some((i)=>i.id===r);y.layout=n(t)?t:n(y.layout)?y.layout:n(z)?z:o[0]?.id??z}function xe(e){return y.layouts.find((t)=>t.id===e)}function mt(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")||"layout"}function Te(e,t){let o=xe(e);if(!o)throw RangeError(`no layout named "${e}" — this project has: ${y.layouts.map((n)=>n.id).join(", ")}`);y.layout=o.id,y.leftTab=o.navigatorPanel,y.bottomTab=o.bottomTab;for(let n of kd)y.docks[n].collapsed=o.docks[n].collapsed,y.docks[n].size=o.docks[n].size;t.setInspectorTab(o.inspectorTab),Ed(),C()}function gt(e,t){let o=e.trim(),n=mt(o),r={};for(let a of kd)r[a]={collapsed:y.docks[a].collapsed,size:y.docks[a].size};let i={bottomTab:Yb(y.bottomTab)?y.bottomTab:wx,docks:r,id:n,inspectorTab:t.inspectorTab(),name:o||n,navigatorPanel:be(y.leftTab)??ye},s=y.layouts.findIndex((a)=>a.id===n);if(s===-1)y.layouts.push(i);else y.layouts.splice(s,1,i);return y.layout=n,C(),i}function yt(e,t){let o=xe(e),n=t.trim();if(!o||!n)return;o.name=n,C()}function bt(e){if(y.layouts.length<2)return;let t=y.layouts.findIndex((o)=>o.id===e);if(t===-1)return;if(y.layouts.splice(t,1),y.layout===e)y.layout=y.layouts[0].id;C()}function ht(e){Te(y.layout,e)}function dp(e=y.theme){return e==="light"?"vs":"vs-dark"}function wt(){document.documentElement.dataset.theme=y.theme,th()?.editor.setTheme(dp())}function St(){let e=document.documentElement;for(let o of kd)e.style.setProperty(st[o],`${y.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of kd)t.classList.toggle(at[o],y.docks[o].collapsed)}var Z=null,X=[];function pm(e){if(!X.includes(e))X.push(e)}function uL(){if(Z)return;for(let e of X)e.mount();Z=ge(),Z.run(()=>{Q(()=>{St()}),Q(()=>{wt()}),Q(()=>{dt(g.projectRoot)}),Q(()=>{let e=g.projectRoot;g.activePaneId;for(let t of g.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)C()})})}function fr(e,t){if(y.docks[e].collapsed===t){Ed();return}y.docks[e].collapsed=t,Ed()}function Pt(e){fr(e,!y.docks[e].collapsed)}function hL(e,t){y.docks[e].size=t}function fs(e){y.leftTab=e,fr("left",!1),Ed()}function Td(e){y.bottomTab=e,fr("bottom",!1),Ed()}function MC(e){if(y.theme===e)return;y.theme=e,Ur(_t.theme,e)}function pL(e){if(e===y.leftTab&&!y.docks.left.collapsed){fr("left",!0);return}fs(e)}function PC(e){y.layoutSelection=e}function Qb(){Object.assign(y.git,we()),Object.assign(y.stylebook,Se()),y.settingsTab="stylebook",y.layoutSelection=null,ne=null,Y=void 0}var I=(e)=>e.project.open;function kt(e){return[{args:ke({tab:Ao(W,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:I,run:(t,o)=>{let n=li("view.setActivity",o,"tab",W);if(e.panelAvailable&&!e.panelAvailable(n))throw RangeError(`command "view.setActivity" argument "tab": "${n}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);fs(n)},title:"Show Navigator Panel"},{args:ke({tab:Ao(K,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(li("view.setRightTab",o,"tab",K))},title:"Show Inspector Tab"},{args:ke({open:ro("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{fr("left",!yi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:ke({open:ro("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{fr("right",!yi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:ke({open:ro("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{fr("bottom",!yi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{Pt("bottom")},title:"Toggle Bottom Dock"},{args:ke({tab:Ao(Jb,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let n=li("view.setBottomTab",o,"tab",Jb);if(e.panelAvailable&&!e.panelAvailable(n))throw RangeError(`command "view.setBottomTab" argument "tab": "${n}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);Td(n)},title:"Show Bottom Dock Tab"},{args:ke({open:ro("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(yi("view.setAssistant",o,"open")){fr("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(Kb)},title:"Show Assistant"},{args:ke({layout:je("The layout's id — one of this project's saved layouts.")}),category:"View",id:"view.setLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{Te(ot("view.setLayout",o,"layout"),e)},title:"Switch Layout"},{args:ke({name:je("What to call this arrangement. An existing name is overwritten.")}),category:"View",id:"view.saveLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{gt(ot("view.saveLayout",o,"name"),e)},title:"Save Layout"},{args:ke({layout:je("The layout's id."),name:je("Its new name. The id, and every reference to it, is unchanged.")}),category:"View",id:"view.renameLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{yt(ot("view.renameLayout",o,"layout"),ot("view.renameLayout",o,"name"))},title:"Rename Layout"},{args:ke({layout:je("The layout's id. The last remaining layout is kept.")}),category:"View",id:"view.deleteLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{bt(ot("view.deleteLayout",o,"layout"))},title:"Delete Layout"},{category:"View",id:"view.resetLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:()=>{ht(e)},title:"Reset Layout"},{args:ke({color:Ao(Zb,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{MC(li("view.setTheme",o,"color",Zb))},title:"Set Theme"}]}function fL(e,t){e.registerAll(kt(t))}function Fu(e){return pr(e,xt())}var k=null,L=null,j=null,T=null;function xt(){return Ce()?.doc.layout??T}var ie=null;function Ce(){let e=g.tabs.get(ai);return e?re(e):null}function Tt(){if(L)mp(L),L=null;k=null,j=null,T=null,ie=null}function Le(){return ie??=(async()=>{try{let e=await p().readFile(ai),{document:t,layout:o}=hs(e);T=o,j=Fu(t)}catch{j=null}})(),ie}async function NC(e){if(await Le(),e.doc.layout===null&&T!==null)e.doc.layout=T}function It(e){let t=vt();if(t.projectConfig===e)return;Hl({...t,projectConfig:e}),Ua(g.projectRoot,e)}function Ct(){let e=vt()?.projectConfig;return e?re(e):null}function Ae(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function _e(e){return k=e,e.scope.run(()=>{Q(()=>{let t=e.doc.document;if(k!==e||!vt())return;It(re(t))})}),e}function Re(){let e=vt(),t=Ce();if(k&&(k!==(t??L)||re(k.doc.document)!==e.projectConfig))Tt();if(k)return k;if(t)return _e(t);return L=cv({document:e.projectConfig??{},documentPath:ai,id:ai}),_e(L)}function Ie(e){return JSON.stringify(e.extensions??null)}async function Lt(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (me("eg1wy2bp"),import("./format-host-eg1wy2bp.js"));o(),e(),t(p())}async function Sd(e){let t=Ct(),o=Re();await NC(o);let n=re(o.doc.document),r=Fu(n),i=t&&t!==n&&Fu(t)!==r?t:null;if(i&&o.doc.dirty){let d=Error(`${ai} has unsaved changes in its editor tab`);return S.error(`Could not save ${ai} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${ai}`,path:ai,source:"Settings"}),{error:d,ok:!1}}let s=i??n,a=e?{...s,...e}:s,f=Fu(a);if(!i&&!o.doc.dirty&&f===j)return{ok:!0};let u=Ie(n);q(o,(d)=>{let m=d.doc.document;if(i)Ae(m,i);for(let[b,h]of Object.entries(e??{}))m[b]=h});let l=re(o.doc.document),c=Fu(l);try{await p().writeFile(ai,c)}catch(d){return S.error(`Could not save ${ai} — ${te(d)}`,{key:`save:${ai}`,path:ai,source:"Settings"}),{error:d,ok:!1}}if(j=c,o.doc.dirty=!1,Ie(l)!==u)await Lt();return{ok:!0}}async function nL(e,t){if(!vt()){Ua(g.projectRoot,e);return}let o=Re();q(o,(n)=>Ae(n.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await Le(),T=H(t),o.doc.layout=T,j=Fu(e)}function Ai(e){let t=D?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function Ko(e){let t=D?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[n,r]of Object.entries(e))o[n]=typeof r==="object"&&r!==null&&typeof o[n]==="object"&&o[n]!==null?{...o[n],...r}:r;return o}function iL(e){let t=D?.projectConfig?.imports;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function qb(e){let t=D?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,n=[];for(let r of[...t,...e]){let i=typeof r==="string"?r:r?.$ref;if(i&&!o.has(i))o.add(i),n.push(r)}return n}function oL(e){let t=D?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,n=[];for(let r of[...t,...e]){let i=String(r?.attributes?.href||r?.attributes?.src||"")||JSON.stringify(r);if(!o.has(i))o.add(i),n.push(r)}return n}function ps(){let e=D?.projectConfig;return e?Do(e).i18n:null}var F=new Map;function bx(){F.clear()}function $l(e){if(e===!1)return null;let t=D?.projectConfig?.defaults?.layout;return e||t||null}async function Gb(e){let t=e.replace(/^\.\//,"");if(F.has(t))return structuredClone(F.get(t));try{let n=await p().readFile(t),r=JSON.parse(n);return F.set(t,r),structuredClone(r)}catch{return null}}function rL(e,t){let o=t.children??[],n=Array.isArray(o)?o:[],r=new Map,i=[];for(let s of n){let a=typeof s==="object"?s.attributes?.slot:void 0;if(typeof s==="object"&&typeof a==="string"&&a){if(!r.has(a))r.set(a,[]);r.get(a).push(s)}else i.push(s)}if(Ee(e,r,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Ee(e,t,o){if(!e||typeof e!=="object")return;if(!Array.isArray(e.children))return;let n=[];for(let r of e.children)if(r&&typeof r==="object"&&r.tagName==="slot"){let i=r.attributes?.name;if(typeof i==="string"&&i&&t.has(i))n.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)n.push(...o);else if(Array.isArray(r.children))n.push(...r.children)}else{if(typeof r!=="string")Ee(r,t,o);n.push(r)}e.children=n}async function zi(e){let t=await Sd(e);if(!t.ok)throw t.error}
13
- export{hs,pr,Fu,NC,Sd,nL,Ai,Ko,iL,qb,oL,ps,bx,$l,Gb,rL,zi,sL,vx,Kb,yx,Jb,wx,Yb,Zb,kd,aL,OC,xx,_x,lL,y,Ed,cL,Xb,dL,dp,pm,uL,fr,hL,fs,Td,MC,pL,PC,Qb,fL};
6
+ `:""}`).join(""),u=(l,c,d,g,b,h)=>{let w=a(l,c,b),x=Array.isArray(l)||M(l);if(w!==null&&(!x||g+ae(w)+h<=o))return w;let S=" ".repeat(d+2),B=`
7
+ ${" ".repeat(d)}`;if(Array.isArray(l)){if(Ge(l))return`[
8
+ ${Ve(l,S,o,(_)=>r.has(`${c}/${_}`))}${B}]`;let E=l.map((N,_)=>{let A=`${c}/${_}`,O=_===l.length-1,U=u(N,A,d+2,S.length,b,O?0:1);return{path:A,text:`${S}${U}`}});return`[
9
+ ${f(E)}${B}]`}let se=V(l),Ee=s(c,b),Ne=se.map(([E,N],_)=>{let A=`${c}/${G(E)}`,O=`${JSON.stringify(E)}: `,U=_===se.length-1,$e=S.length+ae(O),De=u(N,A,d+2,$e,Ee,U?0:1);return{path:A,text:`${S}${O}${De}`}});return`{
10
+ ${f(Ne)}${B}}`};return`${u(e,"",0,0,!1,0)}
11
+ `}function Ve(e,t,o,n){let r=[],i="";for(let[s,a]of e.entries()){let f=`${le(a)}${s===e.length-1?"":","}`;if(i==="")i=`${t}${f}`;else if(i.length+1+f.length<=o)i=`${i} ${f}`;else r.push(i),i=`${t}${f}`;if(n(s)&&s<e.length-1)r.push(i,""),i=""}return r.push(i),r.join(`
12
+ `)}var ce=new Set([Qn,vp]),Ze=new Set(["auto","light","dark"]);function qe(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function ue(){let e={},t=[];for(let o of m.panes){if(o.derived)continue;let n=[];for(let i of o.tabOrder){let s=m.tabs.get(i);if(!s?.documentPath)continue;n.push(s.documentPath),e[s.documentPath]=qe(s)}if(n.length===0)continue;let r=o.activeTabId?m.tabs.get(o.activeTabId):null;t.push({activeFile:r?.documentPath??null,files:n,id:o.id})}return{focusedPane:m.activePaneId,panes:t,ui:e}}function We(e){if(typeof e!=="object"||e===null)return{};let t=e,o={};if(typeof t.canvasMode==="string")o.canvasMode=t.canvasMode;if(typeof t.preview==="boolean")o.preview=t.preview;if(typeof t.zoom==="number"&&Number.isFinite(t.zoom))o.zoom=t.zoom;if(typeof t.editZoom==="number"&&Number.isFinite(t.editZoom))o.editZoom=t.editZoom;if(t.activeMedia===null||typeof t.activeMedia==="string")o.activeMedia=t.activeMedia;if(typeof t.previewColorScheme==="string"&&Ze.has(t.previewColorScheme))o.previewColorScheme=t.previewColorScheme;if(t.previewLocale===null||iv(t.previewLocale))o.previewLocale=t.previewLocale;if(typeof t.showLayout==="boolean")o.showLayout=t.showLayout;return o}function fe(e){if(typeof e!=="object"||e===null)return null;let t=e;if(!Array.isArray(t.panes))return null;let o=[];for(let r of t.panes){if(typeof r!=="object"||r===null)continue;let i=r;if(typeof i.id!=="string"||!ce.has(i.id))continue;let s=Array.isArray(i.files)?i.files.filter((a)=>typeof a==="string"&&a!==""):[];if(s.length===0)continue;o.push({activeFile:typeof i.activeFile==="string"&&s.includes(i.activeFile)?i.activeFile:null,files:s,id:i.id})}if(o.length===0)return null;let n={};if(typeof t.ui==="object"&&t.ui!==null)for(let[r,i]of Object.entries(t.ui))n[r]=We(i);return{focusedPane:typeof t.focusedPane==="string"&&ce.has(t.focusedPane)?t.focusedPane:Qn,panes:o,ui:n}}async function XT(e,t){let o=0;if(e.panes.some((n)=>n.id===vp))t.ensureSecondPane();for(let n of e.panes)for(let r of n.files){try{await t.openFile(r,n.id)}catch{}if([...m.tabs.values()].some((i)=>i.documentPath===r))o+=1}if(o===0)return 0;for(let n of m.tabs.values()){let r=n.documentPath?e.ui[n.documentPath]:void 0;if(!r)continue;let{ui:i}=n.session;if(r.canvasMode&&n.capabilities.modes.includes(r.canvasMode))i.canvasMode=r.canvasMode;if(r.preview!==void 0)i.preview=r.preview;if(r.zoom!==void 0)i.zoom=r.zoom;if(r.editZoom!==void 0)i.editZoom=r.editZoom;if(r.activeMedia!==void 0)i.activeMedia=r.activeMedia;if(r.previewColorScheme!==void 0)i.previewColorScheme=r.previewColorScheme;if(r.previewLocale!==void 0)i.previewLocale=r.previewLocale;if(r.showLayout!==void 0)i.showLayout=r.showLayout}for(let n of e.panes){let r=m.panes.find((s)=>s.id===n.id);if(!r||!n.activeFile)continue;let i=r.tabOrder.find((s)=>m.tabs.get(s)?.documentPath===n.activeFile);if(i)r.activeTabId=i}if(m.panes.some((n)=>n.id===e.focusedPane))$r(e.focusedPane);return o}var pe={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},Ke="default",Ye=/^jx[-._:]/;function Xe(e){return Ye.test(e)}function Qe(){let e=globalThis.localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let n=e.key(o);if(n&&Xe(n))t.push(n)}for(let o of t)e.removeItem(o)}catch{}return t}function et(e){let t=pe[e];if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${Object.keys(pe).join(", ")}`);if(t.reset==="app-state")Qe();return t}var J=null;function de(e){if(J)return J;let t=new URLSearchParams(e??globalThis.location?.search??""),o=et(t.get("profile")??Ke),n=t.get("clock");return J={clock:n===null?null:$I(n),profile:o},J}var W=["files","search","git","i18n","layers","page","data","packages","insert"],tt={blocks:"insert",head:"page",imports:"packages",state:"data"},ye="layers";function ee(e){return typeof e==="string"&&W.includes(e)}function vx(e,t){if(!ee(e))throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return e}function be(e){if(typeof e!=="string")return null;let t=tt[e];if(t)return t;return ee(e)?e:null}var K=["properties","style","events","assistant"],qb="properties";function yx(e){return typeof e==="string"&&K.includes(e)}var Gb=["problems","logic","activity"],wx="problems";function Kb(e){return typeof e==="string"&&Gb.includes(e)}var Jb=["light","dark"],he="jx-studio-panel-widths",ve="jx-studio-project::",nt="dark";function rt(e){return typeof e==="string"&&Jb.includes(e)}function it(){let e=Lr(_t.theme);return rt(e)?e:nt}var Sd=["left","right","bottom"],R={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},QT={bottom:R.bottom.size,left:R.left.size,right:R.right.size},st={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},at={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},AC=0.5,xx=0.2,_x=0.8;function lt(e){return typeof e==="number"&&e>=xx&&e<=_x?e:AC}function eL(e){y.paneSplit=Math.min(_x,Math.max(xx,e))}function ct(){try{return JSON.parse(localStorage.getItem(he)||"{}")}catch{return{}}}function we(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null,subTab:"changes"}}function Pe(){return{customizedOnly:!1,filter:"",selection:null,tab:"elements"}}function ke(){return[{bottomTab:"problems",docks:{bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!0,size:280}},id:"write",inspectorTab:"properties",name:"Write",navigatorPanel:"files"},{bottomTab:"problems",docks:{bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:320}},id:"design",inspectorTab:"style",name:"Design",navigatorPanel:"layers"},{bottomTab:"logic",docks:{bottom:{collapsed:!0,size:260},left:{collapsed:!1,size:280},right:{collapsed:!1,size:300}},id:"build",inspectorTab:"events",name:"Build",navigatorPanel:"data"},{bottomTab:"activity",docks:{bottom:{collapsed:!1,size:240},left:{collapsed:!1,size:300},right:{collapsed:!0,size:280}},id:"ship",inspectorTab:"properties",name:"Ship",navigatorPanel:"git"}]}var z="design";function ut(){let e=ct(),t={};for(let o of Sd){let n=e[o],r=e[`${o}Collapsed`];t[o]={collapsed:typeof r==="boolean"?r:R[o].collapsed,size:typeof n==="number"&&n>0?n:R[o].size}}return{bottomTab:Kb(e.bottomTab)?e.bottomTab:wx,docks:t,focusRegion:"pane",paneSplit:lt(e.paneSplit),git:we(),layout:z,layoutSelection:null,layouts:ke(),leftTab:be(e.leftTab)??ye,settingsTab:"stylebook",stylebook:Pe(),theme:it()}}de();var y=v(ut());function Ed(){try{localStorage.setItem(he,JSON.stringify({bottom:y.docks.bottom.size,bottomCollapsed:y.docks.bottom.collapsed,bottomTab:y.bottomTab,left:y.docks.left.size,leftCollapsed:y.docks.left.collapsed,leftTab:y.leftTab,paneSplit:y.paneSplit,right:y.docks.right.size,rightCollapsed:y.docks.right.collapsed}))}catch{}}var Y;function ft(e){if(typeof e!=="object"||e===null)return!1;let t=e;return typeof t.id==="string"&&t.id!==""&&typeof t.name==="string"&&ee(t.navigatorPanel)&&yx(t.inspectorTab)&&Kb(t.bottomTab)&&Sd.every((o)=>typeof t.docks?.[o]?.size==="number")}function oe(e){if(!e)return{};try{return JSON.parse(localStorage.getItem(`${ve}${e}`)||"{}")}catch{return{}}}function pt(e){let t={activeLayout:null,layouts:ke()};if(!e)return t;let o=oe(e),n=Array.isArray(o.layouts)?o.layouts.filter(ft):[];if(n.length===0)return t;return{activeLayout:typeof o.activeLayout==="string"?o.activeLayout:null,layouts:n}}function tL(e){return fe(oe(e).session)}var ne=null;function Yb(e){ne=e}function nL(){C()}function C(){let e=m.projectRoot;if(!e)return;try{localStorage.setItem(`${ve}${e}`,JSON.stringify({activeLayout:y.layout,layouts:y.layouts,session:e===ne?ue():oe(e).session}))}catch{}}function dt(e){if(e===Y)return;Y=e;let{activeLayout:t,layouts:o}=pt(e);y.layouts=o;let n=(r)=>r!==null&&o.some((i)=>i.id===r);y.layout=n(t)?t:n(y.layout)?y.layout:n(z)?z:o[0]?.id??z}function xe(e){return y.layouts.find((t)=>t.id===e)}function mt(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")||"layout"}function Te(e,t){let o=xe(e);if(!o)throw RangeError(`no layout named "${e}" — this project has: ${y.layouts.map((n)=>n.id).join(", ")}`);y.layout=o.id,y.leftTab=o.navigatorPanel,y.bottomTab=o.bottomTab;for(let n of Sd)y.docks[n].collapsed=o.docks[n].collapsed,y.docks[n].size=o.docks[n].size;t.setInspectorTab(o.inspectorTab),Ed(),C()}function gt(e,t){let o=e.trim(),n=mt(o),r={};for(let a of Sd)r[a]={collapsed:y.docks[a].collapsed,size:y.docks[a].size};let i={bottomTab:Kb(y.bottomTab)?y.bottomTab:wx,docks:r,id:n,inspectorTab:t.inspectorTab(),name:o||n,navigatorPanel:be(y.leftTab)??ye},s=y.layouts.findIndex((a)=>a.id===n);if(s===-1)y.layouts.push(i);else y.layouts.splice(s,1,i);return y.layout=n,C(),i}function yt(e,t){let o=xe(e),n=t.trim();if(!o||!n)return;o.name=n,C()}function bt(e){if(y.layouts.length<2)return;let t=y.layouts.findIndex((o)=>o.id===e);if(t===-1)return;if(y.layouts.splice(t,1),y.layout===e)y.layout=y.layouts[0].id;C()}function ht(e){Te(y.layout,e)}function dp(e=y.theme){return e==="light"?"vs":"vs-dark"}function wt(){document.documentElement.dataset.theme=y.theme,th()?.editor.setTheme(dp())}function St(){let e=document.documentElement;for(let o of Sd)e.style.setProperty(st[o],`${y.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of Sd)t.classList.toggle(at[o],y.docks[o].collapsed)}var Z=null,X=[];function dm(e){if(!X.includes(e))X.push(e)}function iL(){if(Z)return;for(let e of X)e.mount();Z=ge(),Z.run(()=>{Q(()=>{St()}),Q(()=>{wt()}),Q(()=>{dt(m.projectRoot)}),Q(()=>{let e=m.projectRoot;m.activePaneId;for(let t of m.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)C()})})}function fr(e,t){if(y.docks[e].collapsed===t){Ed();return}y.docks[e].collapsed=t,Ed()}function Pt(e){fr(e,!y.docks[e].collapsed)}function oL(e,t){y.docks[e].size=t}function fs(e){y.leftTab=e,fr("left",!1),Ed()}function Td(e){y.bottomTab=e,fr("bottom",!1),Ed()}function NC(e){if(y.theme===e)return;y.theme=e,qr(_t.theme,e)}function rL(e){if(e===y.leftTab&&!y.docks.left.collapsed){fr("left",!0);return}fs(e)}function OC(e){y.layoutSelection=e}function Zb(){Object.assign(y.git,we()),Object.assign(y.stylebook,Pe()),y.settingsTab="stylebook",y.layoutSelection=null,ne=null,Y=void 0}var I=(e)=>e.project.open;function kt(e){return[{args:Se({tab:Do(W,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:I,run:(t,o)=>{let n=li("view.setActivity",o,"tab",W);if(e.panelAvailable&&!e.panelAvailable(n))throw RangeError(`command "view.setActivity" argument "tab": "${n}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);fs(n)},title:"Show Navigator Panel"},{args:Se({tab:Do(K,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(li("view.setRightTab",o,"tab",K))},title:"Show Inspector Tab"},{args:Se({open:oo("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{fr("left",!yi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:Se({open:oo("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{fr("right",!yi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:Se({open:oo("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{fr("bottom",!yi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{Pt("bottom")},title:"Toggle Bottom Dock"},{args:Se({tab:Do(Gb,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let n=li("view.setBottomTab",o,"tab",Gb);if(e.panelAvailable&&!e.panelAvailable(n))throw RangeError(`command "view.setBottomTab" argument "tab": "${n}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);Td(n)},title:"Show Bottom Dock Tab"},{args:Se({open:oo("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(yi("view.setAssistant",o,"open")){fr("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(qb)},title:"Show Assistant"},{args:Se({layout:He("The layout's id — one of this project's saved layouts.")}),category:"View",id:"view.setLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{Te(ot("view.setLayout",o,"layout"),e)},title:"Switch Layout"},{args:Se({name:He("What to call this arrangement. An existing name is overwritten.")}),category:"View",id:"view.saveLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{gt(ot("view.saveLayout",o,"name"),e)},title:"Save Layout"},{args:Se({layout:He("The layout's id."),name:He("Its new name. The id, and every reference to it, is unchanged.")}),category:"View",id:"view.renameLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{yt(ot("view.renameLayout",o,"layout"),ot("view.renameLayout",o,"name"))},title:"Rename Layout"},{args:Se({layout:He("The layout's id. The last remaining layout is kept.")}),category:"View",id:"view.deleteLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:(t,o)=>{bt(ot("view.deleteLayout",o,"layout"))},title:"Delete Layout"},{category:"View",id:"view.resetLayout",level:"application",menus:["palette"],group:"4_layouts",requires:"an open project",when:I,run:()=>{ht(e)},title:"Reset Layout"},{args:Se({color:Do(Jb,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{NC(li("view.setTheme",o,"color",Jb))},title:"Set Theme"}]}function sL(e,t){e.registerAll(kt(t))}function ju(e){return pr(e,xt())}var P=null,L=null,j=null,T=null;function xt(){return Ce()?.doc.layout??T}var ie=null;function Ce(){let e=m.tabs.get(ai);return e?re(e):null}function Tt(){if(L)fp(L),L=null;P=null,j=null,T=null,ie=null}function Le(){return ie??=(async()=>{try{let e=await p().readFile(ai),{document:t,layout:o}=hs(e);T=o,j=ju(t)}catch{j=null}})(),ie}async function DC(e){if(await Le(),e.doc.layout===null&&T!==null)e.doc.layout=T}function It(e){let t=vt();if(t.projectConfig===e)return;Hl({...t,projectConfig:e}),Ua(m.projectRoot,e)}function Ct(){let e=vt()?.projectConfig;return e?re(e):null}function je(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function _e(e){return P=e,e.scope.run(()=>{Q(()=>{let t=e.doc.document;if(P!==e||!vt())return;It(re(t))})}),e}function Ae(){let e=vt(),t=Ce();if(P&&(P!==(t??L)||re(P.doc.document)!==e.projectConfig))Tt();if(P)return P;if(t)return _e(t);return L=cv({document:e.projectConfig??{},documentPath:ai,id:ai}),_e(L)}function Ie(e){return JSON.stringify(e.extensions??null)}async function Lt(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (me("wj3mf3n8"),import("./format-host-wj3mf3n8.js"));o(),e(),t(p())}async function kd(e){let t=Ct(),o=Ae();await DC(o);let n=re(o.doc.document),r=ju(n),i=t&&t!==n&&ju(t)!==r?t:null;if(i&&o.doc.dirty){let d=Error(`${ai} has unsaved changes in its editor tab`);return k.error(`Could not save ${ai} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${ai}`,path:ai,source:"Settings"}),{error:d,ok:!1}}let s=i??n,a=e?{...s,...e}:s,f=ju(a);if(!i&&!o.doc.dirty&&f===j)return{ok:!0};let u=Ie(n);q(o,(d)=>{let g=d.doc.document;if(i)je(g,i);for(let[b,h]of Object.entries(e??{}))g[b]=h});let l=re(o.doc.document),c=ju(l);try{await p().writeFile(ai,c)}catch(d){return k.error(`Could not save ${ai} — ${te(d)}`,{key:`save:${ai}`,path:ai,source:"Settings"}),{error:d,ok:!1}}if(j=c,o.doc.dirty=!1,Ie(l)!==u)await Lt();return{ok:!0}}async function KT(e,t){if(!vt()){Ua(m.projectRoot,e);return}let o=Ae();q(o,(n)=>je(n.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await Le(),T=H(t),o.doc.layout=T,j=ju(e)}function Di(e){let t=D?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function qo(e){let t=D?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[n,r]of Object.entries(e))o[n]=typeof r==="object"&&r!==null&&typeof o[n]==="object"&&o[n]!==null?{...o[n],...r}:r;return o}function JT(e){let t=D?.projectConfig?.imports;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function Vb(e){let t=D?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,n=[];for(let r of[...t,...e]){let i=typeof r==="string"?r:r?.$ref;if(i&&!o.has(i))o.add(i),n.push(r)}return n}function YT(e){let t=D?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,n=[];for(let r of[...t,...e]){let i=String(r?.attributes?.href||r?.attributes?.src||"")||JSON.stringify(r);if(!o.has(i))o.add(i),n.push(r)}return n}function ps(){let e=D?.projectConfig;return e?$o(e).i18n:null}var F=new Map;function bx(){F.clear()}function $l(e){if(e===!1)return null;let t=D?.projectConfig?.defaults?.layout;return e||t||null}async function Ub(e){let t=e.replace(/^\.\//,"");if(F.has(t))return structuredClone(F.get(t));try{let n=await p().readFile(t),r=JSON.parse(n);return F.set(t,r),structuredClone(r)}catch{return null}}function ZT(e,t){let o=t.children??[],n=Array.isArray(o)?o:[],r=new Map,i=[];for(let s of n){let a=typeof s==="object"?s.attributes?.slot:void 0;if(typeof s==="object"&&typeof a==="string"&&a){if(!r.has(a))r.set(a,[]);r.get(a).push(s)}else i.push(s)}if(Re(e,r,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Re(e,t,o){if(!e||typeof e!=="object")return;if(!Array.isArray(e.children))return;let n=[];for(let r of e.children)if(r&&typeof r==="object"&&r.tagName==="slot"){let i=r.attributes?.name;if(typeof i==="string"&&i&&t.has(i))n.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)n.push(...o);else if(Array.isArray(r.children))n.push(...r.children)}else{if(typeof r!=="string")Re(r,t,o);n.push(r)}e.children=n}async function Bi(e){let t=await kd(e);if(!t.ok)throw t.error}
13
+ export{hs,pr,ju,DC,kd,KT,Di,qo,JT,Vb,YT,ps,bx,$l,Ub,ZT,Bi,XT,vx,qb,yx,Gb,wx,Kb,Jb,Sd,QT,AC,xx,_x,eL,y,Ed,tL,Yb,nL,dp,dm,iL,fr,oL,fs,Td,NC,rL,OC,Zb,sL};
14
14
 
15
- //# debugId=3B66721F3F35E49D64756E2164756E21
16
- //# sourceMappingURL=studio-w8w9frjy.js.map
15
+ //# debugId=F4358AED35E7AC6364756E2164756E21
16
+ //# sourceMappingURL=studio-4m50vh74.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-6k1eswp9.js";import{rt,zt,T,R,Ct}from"./studio-z1vdxq0e.js";import{v}from"./studio-0nm2skex.js";import{Ir}from"./studio-k9pwvmz8.js";import{Al,Ld,_c,Gi,Va,Id,Hu}from"./studio-ant1zbp3.js";import{lb,wE,cb,_E,CE}from"./studio-0mm38y62.js";import{Cc}from"./studio-011em5cf.js";import{Ev,Ni}from"./studio-153mwkyq.js";import{He}from"./studio-nw4q9sdn.js";var E={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, for the reason `doc-header.json` gives: a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",E);function O(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function j(t,e,r){let i=v({browse:r.browse,edit:r.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:r.upload,value:e.value,warm:r.warm}),a=null,o=!1;return R("media-field",i,t).then((n)=>{if(o){n.dispose();return}a=n}),{dispose(){o=!0,a?.dispose(),a=null},update:(n)=>O(i,n)}}function ld(t){let{anchor:e,name:r,scope:i,slot:a}=t,o=document.createElement("div");o.style.pointerEvents="auto",o.setAttribute(rt,zt("popover",a)),Ct("popover").append(o);let n=new AbortController,s=null,w=null,c=!1,F=(m)=>{if(c)return;if(c=!0,n.abort(),w?.dispose(),w=null,o.remove(),m)t.onDismissed?.()},A=(async()=>{let m=await R(r,i,o,{signal:n.signal,...t.onNodeCreated?{onNodeCreated:t.onNodeCreated}:{}});if(n.signal.aborted)return;if(w=m,s=m.root,s.setAttribute(rt,zt("popover",a)),s.addEventListener("toggle",(b)=>{if(b.newState==="closed")F(!0)}),!s.hasAttribute("popover"))await new Promise((b)=>{s?.addEventListener("jx-ready",()=>b(),{once:!0})});if(n.signal.aborted)return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();F(!1)},host:o,isOpen:()=>!c,ready:A}}var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so. Fifty rows is the cap the list has always had; the sentence is what keeps the cap from reading as "that is all there is".',tagName:"p",attributes:{part:"more"},textContent:"${state.moreLabel}"}}}]}]};T("media-browser",L);var D="media-picker";function V(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel}function N(t,e,r){let i=v({emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,x:t.x,y:t.y}),a=ld({anchor:r,name:"media-browser",scope:i,slot:D,...e.dismissed?{onDismissed:e.dismissed}:{}});return a.ready.then(()=>{if(a.isOpen())a.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:a.close,host:a.host,isOpen:a.isOpen,ready:a.ready,update:(o)=>V(i,o)}}var h=[],S=!1;async function P(t,e){let r=[];try{let i=await Ir(()=>e.listDirectory(t));wE(i);for(let a of i)if(a.type==="directory"){let o=await P(a.path,e);r.push(...o)}else{let o=Gi(a.name);if(Ld.has(o))r.push({file:a.path,isImage:Al.has(o),name:a.name,path:Id(a.path)})}}catch{}return r}async function g(){if(S)return;let t=p();h=await P("public",t),S=!0,Ni("leftPanel","rightPanel","frontmatterPanel")}function Z_(){h=[],S=!1,_E()}var y=50,d=null,u=null,l="",M={x:0,y:0};function k(){let t=l.toLowerCase(),e=t?h.filter((a)=>a.path.toLowerCase().includes(t)||a.name.toLowerCase().includes(t)):h,i=e.slice(0,y).map((a)=>{let o=CE(lb(a.file));return{caption:o,captionState:o?"shown":"hidden",file:a.file,key:a.file,name:a.name,path:a.path,thumbSrc:a.isImage?Hu(a.file):"",thumbState:a.isImage?"shown":"hidden"}});return{emptyLabel:"No matches",filter:l,moreLabel:`…${e.length-y} more`,moreState:e.length>y?"shown":"hidden",rows:i,rowsState:i.length>0?"listed":"empty",x:M.x,y:M.y}}function B(){let t=d;d=null,u=null,l="",t?.close()}var x=0;function z(t,e,r){if(!cb(t,e,r)||x!==0)return;x=requestAnimationFrame(()=>{x=0,d?.update(k())})}function o$(t,e){B(),u=e;let r=He(t);M={x:r.left,y:r.bottom+4},d=N(k(),{dismissed:()=>{d=null,u=null,l=""},measure:z,pick:(i)=>{let a=u;B(),a?.(i)},setFilter:(i)=>{l=i,d?.update(k())}},t)}async function r$(t,e){let r=await Va([...t]),[i]=r;if(i)e(i.ref)}function s$(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=_c(),e.addEventListener("change",()=>{if(e.files?.length)r$(e.files,t)}),e.click()}var _=400,f=new WeakMap;function H(t,e){let r=Al.has(Gi(e));return{label:t,thumbSrc:r&&e?Cc(e):"",thumbState:r&&e?"shown":"hidden",value:e}}function cd(t,e,r,i){g();let a=f.get(t);if(a){a.prop=e,a.commit=i,a.handle.update(H(e,r));return}let o={commit:i,handle:null,prop:e};o.handle=j(t,H(e,r),{browse:(n)=>{g(),o$(n,(s)=>o.commit(s))},edit:(n)=>Ev(`media:${o.prop}`,_,(s)=>o.commit(s))(n),upload:()=>s$((n)=>o.commit(n)),warm:()=>{g()}}),f.set(t,o)}function dw(t){let e=f.get(t);if(e)f.delete(t),e.handle.dispose()}
2
- export{ld,Z_,o$,r$,s$,cd,dw};
1
+ import{p}from"./studio-y7jehjrp.js";import{rt,zt,T,R,Ct}from"./studio-7qvs7v0m.js";import{v}from"./studio-fqq890ap.js";import{Ir}from"./studio-xkfs0dp2.js";import{Al,Ld,_c,Gi,Va,Id,Bu}from"./studio-e47215hh.js";import{sb,bE,ab,yE,wE}from"./studio-fthwn4kf.js";import{Cc}from"./studio-5d7wfmnp.js";import{Tv,Ai}from"./studio-tp642n5g.js";import{Oe}from"./studio-vavmwshr.js";var E={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, for the reason `doc-header.json` gives: a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",E);function O(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function j(t,e,r){let i=v({browse:r.browse,edit:r.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:r.upload,value:e.value,warm:r.warm}),a=null,o=!1;return R("media-field",i,t).then((n)=>{if(o){n.dispose();return}a=n}),{dispose(){o=!0,a?.dispose(),a=null},update:(n)=>O(i,n)}}function ld(t){let{anchor:e,name:r,scope:i,slot:a}=t,o=document.createElement("div");o.style.pointerEvents="auto",o.setAttribute(rt,zt("popover",a)),Ct("popover").append(o);let n=new AbortController,s=null,w=null,c=!1,F=(m)=>{if(c)return;if(c=!0,n.abort(),w?.dispose(),w=null,o.remove(),m)t.onDismissed?.()},A=(async()=>{let m=await R(r,i,o,{signal:n.signal,...t.onNodeCreated?{onNodeCreated:t.onNodeCreated}:{}});if(n.signal.aborted)return;if(w=m,s=m.root,s.setAttribute(rt,zt("popover",a)),s.addEventListener("toggle",(b)=>{if(b.newState==="closed")F(!0)}),!s.hasAttribute("popover"))await new Promise((b)=>{s?.addEventListener("jx-ready",()=>b(),{once:!0})});if(n.signal.aborted)return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();F(!1)},host:o,isOpen:()=>!c,ready:A}}var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so. Fifty rows is the cap the list has always had; the sentence is what keeps the cap from reading as "that is all there is".',tagName:"p",attributes:{part:"more"},textContent:"${state.moreLabel}"}}}]}]};T("media-browser",L);var D="media-picker";function V(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel}function N(t,e,r){let i=v({emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,x:t.x,y:t.y}),a=ld({anchor:r,name:"media-browser",scope:i,slot:D,...e.dismissed?{onDismissed:e.dismissed}:{}});return a.ready.then(()=>{if(a.isOpen())a.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:a.close,host:a.host,isOpen:a.isOpen,ready:a.ready,update:(o)=>V(i,o)}}var h=[],S=!1;async function P(t,e){let r=[];try{let i=await Ir(()=>e.listDirectory(t));bE(i);for(let a of i)if(a.type==="directory"){let o=await P(a.path,e);r.push(...o)}else{let o=Gi(a.name);if(Ld.has(o))r.push({file:a.path,isImage:Al.has(o),name:a.name,path:Id(a.path)})}}catch{}return r}async function g(){if(S)return;let t=p();h=await P("public",t),S=!0,Ai("leftPanel","rightPanel","frontmatterPanel")}function Y_(){h=[],S=!1,yE()}var y=50,d=null,u=null,l="",M={x:0,y:0};function k(){let t=l.toLowerCase(),e=t?h.filter((a)=>a.path.toLowerCase().includes(t)||a.name.toLowerCase().includes(t)):h,i=e.slice(0,y).map((a)=>{let o=wE(sb(a.file));return{caption:o,captionState:o?"shown":"hidden",file:a.file,key:a.file,name:a.name,path:a.path,thumbSrc:a.isImage?Bu(a.file):"",thumbState:a.isImage?"shown":"hidden"}});return{emptyLabel:"No matches",filter:l,moreLabel:`…${e.length-y} more`,moreState:e.length>y?"shown":"hidden",rows:i,rowsState:i.length>0?"listed":"empty",x:M.x,y:M.y}}function B(){let t=d;d=null,u=null,l="",t?.close()}var x=0;function z(t,e,r){if(!ab(t,e,r)||x!==0)return;x=requestAnimationFrame(()=>{x=0,d?.update(k())})}function XR(t,e){B(),u=e;let r=Oe(t);M={x:r.left,y:r.bottom+4},d=N(k(),{dismissed:()=>{d=null,u=null,l=""},measure:z,pick:(i)=>{let a=u;B(),a?.(i)},setFilter:(i)=>{l=i,d?.update(k())}},t)}async function QR(t,e){let r=await Va([...t]),[i]=r;if(i)e(i.ref)}function e$(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=_c(),e.addEventListener("change",()=>{if(e.files?.length)QR(e.files,t)}),e.click()}var _=400,f=new WeakMap;function H(t,e){let r=Al.has(Gi(e));return{label:t,thumbSrc:r&&e?Cc(e):"",thumbState:r&&e?"shown":"hidden",value:e}}function cd(t,e,r,i){g();let a=f.get(t);if(a){a.prop=e,a.commit=i,a.handle.update(H(e,r));return}let o={commit:i,handle:null,prop:e};o.handle=j(t,H(e,r),{browse:(n)=>{g(),XR(n,(s)=>o.commit(s))},edit:(n)=>Tv(`media:${o.prop}`,_,(s)=>o.commit(s))(n),upload:()=>e$((n)=>o.commit(n)),warm:()=>{g()}}),f.set(t,o)}function uw(t){let e=f.get(t);if(e)f.delete(t),e.handle.dispose()}
2
+ export{ld,Y_,XR,QR,e$,cd,uw};
3
3
 
4
- //# debugId=397225503335C77564756E2164756E21
5
- //# sourceMappingURL=studio-891t1tv9.js.map
4
+ //# debugId=E3994757D515F61664756E2164756E21
5
+ //# sourceMappingURL=studio-4r0sjtx8.js.map
@@ -1,4 +1,4 @@
1
- import{Fg,Ns,zy,Vr,Wy,as}from"./studio-tzs6njnb.js";var ck="meta",dk="frontmatter",uk="structure",hk="source",pk=2;function Xc(t){return t.getMap(ck)}function fk(t){return t.getMap(dk)}function Sf(t){return t.getMap(uk)}function mk(t){return t.getText(hk)}function f(t){return JSON.parse(JSON.stringify(t))}function h(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var y=new Set(["textContent"]),m=new Set(["style","attributes","$props"]);function g(t,e){let n=t.toString();if(n===e)return!1;let r=0,o=Math.min(n.length,e.length);while(r<o&&n[r]===e[r])r+=1;let i=n.length,a=e.length;while(i>r&&a>r&&n[i-1]===e[a-1])i-=1,a-=1;if(i>r)t.delete(r,i-r);if(a>r)t.insert(r,e.slice(r,a));return!0}function l(t){let e=new Vr;for(let[n,r]of Object.entries(t)){if(r===void 0)continue;e.set(n,h(r)?l(r):f(r))}return e}function Y(t,e){for(let n of[...t.keys()])if(!(n in e)||e[n]===void 0)t.delete(n);for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=t.get(n);if(h(r))if(o instanceof Vr)Y(o,r);else t.set(n,l(r));else if(!b(o,r))t.set(n,f(r))}}function b(t,e){if(t===e)return!0;if(t instanceof Vr||t instanceof Ns||t instanceof as)return!1;return JSON.stringify(t??null)===JSON.stringify(e??null)}function p(t){return typeof t==="string"?new as(t):gk(t)}function Wh(t){let e=new Ns;return e.insert(0,t.map((n)=>p(n))),e}function gk(t){if(!h(t))throw TypeError("collab-schema: a document node must be a plain object");let e=new Vr;for(let[n,r]of Object.entries(t)){if(r===void 0)continue;if(n==="children"&&Array.isArray(r))e.set(n,Wh(r));else if(y.has(n)&&typeof r==="string")e.set(n,new as(r));else if(m.has(n)&&h(r))e.set(n,l(r));else e.set(n,f(r))}return e}function Qc(t){if(t instanceof Vr){let e={};for(let[n,r]of t.entries())e[n]=Qc(r);return e}if(t instanceof Ns)return t.toArray().map((e)=>Qc(e));if(t instanceof as)return t.toString();return t}function WR(t){return Qc(Sf(t))}function Hy(t,e){let n=Sf(t);for(let r of e)if(n instanceof Vr)n=n.get(String(r));else if(n instanceof Ns){let o=typeof r==="number"?r:Number(r);if(!Number.isInteger(o)||o<0||o>=n.length)return;n=n.get(o)}else return;return n}function g_(t,e,n){let r=mk(t);if(r.toString()===e)return!1;return t.transact(()=>{g(r,e)},n),!0}function VR(t,e,n={}){let r=Xc(t);if(r.get("structureSeeded")===!0)return!1;return t.transact(()=>{let o=Sf(t);for(let[a,s]of Object.entries(e)){if(s===void 0)continue;if(a==="children"&&Array.isArray(s))o.set(a,Wh(s));else o.set(a,f(s))}let i=fk(t);for(let[a,s]of Object.entries(n.frontmatter??{}))if(s!==void 0)i.set(a,f(s));r.set("schemaVersion",pk),r.set("canonical","structure"),r.set("canonicalRev",0),r.set("sourceFormat",n.sourceFormat??null),r.set("structureSeeded",!0)},n.origin),!0}var UR="jx-local",qR="jx-mirror",GR="jx-seed";class ed extends Error{constructor(t){super(`collab-path-unresolved:${t.join("/")}`);this.name="CollabPathError"}}function w(t,e){let n=Hy(t,e);if(!(n instanceof Vr))throw new ed(e);return n}function d(t,e,n){let r=w(t,e),o=r.get("children");if(o instanceof Ns)return o;if(n&&o===void 0){let i=new Ns;return r.set("children",i),i}throw new ed([...e,"children"])}function R(t){return JSON.parse(JSON.stringify(t))}function P(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function M(t,e,n){let r=t.get(e);if(e==="children"&&Array.isArray(n)){t.set(e,Wh(n));return}if(y.has(e)&&typeof n==="string"){if(r instanceof as)g(r,n);else t.set(e,new as(n));return}if(m.has(e)&&P(n)){if(r instanceof Vr)Y(r,n);else t.set(e,l(n));return}t.set(e,R(n))}function D(t,e){switch(e.op){case"set-key":{let n=w(t,e.path);if(e.value===void 0)n.delete(e.key);else M(n,e.key,e.value);return}case"insert-child":{let n=d(t,e.parentPath,!0);if(e.index<0||e.index>n.length)throw new ed([...e.parentPath,"children",e.index]);n.insert(e.index,[p(e.node)]);return}case"remove-child":{let n=d(t,e.parentPath,!1);if(e.index<0||e.index>=n.length)throw new ed([...e.parentPath,"children",e.index]);n.delete(e.index,1);return}case"set-child":{let n=d(t,e.parentPath,!1);if(e.index<0||e.index>=n.length)throw new ed([...e.parentPath,"children",e.index]);let r=n.get(e.index);if(r instanceof as&&typeof e.node==="string"){g(r,e.node);return}n.delete(e.index,1),n.insert(e.index,[p(e.node)]);return}case"move-child":{let n=d(t,e.fromParentPath,!1),r=d(t,e.toParentPath,!0);if(e.fromIndex<0||e.fromIndex>=n.length)throw new ed([...e.fromParentPath,"children",e.fromIndex]);let o=Qc(n.get(e.fromIndex));if(n.delete(e.fromIndex,1),e.toIndex<0||e.toIndex>r.length)throw new ed([...e.toParentPath,"children",e.toIndex]);r.insert(e.toIndex,[p(o)]);return}default:throw Error(`unknown-doc-op:${e.op}`)}}function KR(t,e,n){t.transact(()=>{for(let r of e)D(t,r)},n)}function C(t){for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=="string")continue;if(m.has(n))return{key:n,nodePath:t.slice(0,e)};if(y.has(n))return{key:n,nodePath:t.slice(0,e)}}return null}function J(t){return t.every((e)=>typeof e==="string"||typeof e==="number")}function JR(t){if(t.length===0)return[];let e=t.map((o)=>o.path);if(!e.every((o)=>J(o)))return null;for(let o=0;o<e.length;o++)for(let i=0;i<e.length;i++){if(o===i)continue;let a=e[o],s=e[i];if(a.length<=s.length&&a.every((c,u)=>c===s[u]))return null}if(t.filter((o)=>o instanceof Fg).length>1)return null;let r=[];for(let o of t){let i=o.path,a=C(i);if(a){let{doc:s}=o.target;if(!s)return null;let c=Hy(s,[...a.nodePath,a.key]);if(c===void 0)return null;r.push({key:a.key,op:"set-key",path:a.nodePath,value:Qc(c)});continue}if(o instanceof Wy){let s=i.at(-1);if(i.at(-2)==="children"&&typeof s==="number"){r.push({index:s,node:o.target.toString(),op:"set-child",parentPath:i.slice(0,-2)});continue}return null}if(o instanceof zy){let s=o.target;for(let[c,u]of o.changes.keys)if(u.action==="delete")r.push({key:c,op:"set-key",path:i});else r.push({key:c,op:"set-key",path:i,value:Qc(s.get(c))})}else if(o instanceof Fg){if(i.at(-1)!=="children")return null;let s=i.slice(0,-1),c=0;for(let u of o.changes.delta)if(u.retain!==void 0)c+=u.retain;else if(u.delete!==void 0)for(let x=0;x<u.delete;x++)r.push({index:c,op:"remove-child",parentPath:s});else if(u.insert!==void 0){let x=Array.isArray(u.insert)?u.insert:[u.insert];for(let O of x)r.push({index:c,node:Qc(O),op:"insert-child",parentPath:s}),c+=1}}else return null}return r}function YR(t,e,n){t.transact(()=>{let r=Sf(t),o=e,i=[...r.keys()];for(let s of i)if(!(s in o)||o[s]===void 0)r.delete(s);for(let[s,c]of Object.entries(o)){if(c===void 0)continue;if(s==="children"&&Array.isArray(c))r.set(s,Wh(c));else r.set(s,JSON.parse(JSON.stringify(c)))}let a=Xc(t);a.set("canonicalRev",Number(a.get("canonicalRev")??0)+1)},n)}function b_(t){return Xc(t).get("canonical")==="source"?"source":"structure"}function v_(t){return Number(Xc(t).get("canonicalRev")??0)}function ZR(t,e,n){if(b_(t)==="source")return!1;return t.transact(()=>{g_(t,e,n);let r=Xc(t);r.set("canonical","source"),r.set("canonicalRev",v_(t)+1)},n),!0}function XR(t,e){if(b_(t)!=="source")return!1;return t.transact(()=>{let n=Xc(t);n.set("canonical","structure"),n.set("canonicalRev",v_(t)+1)},e),!0}function QR(t,e,n){let r=[];for(let[o,i]of t.getStates()){let a=i;if(o!==n&&a.mode==="source"&&a.focusedPath===e)r.push(o)}return r}function e$(t,e){let n=t.clientID,r=t.getStates().get(n);if(r?.mode!=="source"||r.focusedPath!==e)return!1;let o=n;for(let[i,a]of t.getStates()){let s=a;if(s.mode==="source"&&s.focusedPath===e&&s.canWrite!==!1&&i<o)o=i}return o===n}var y_=["#4f9cf9","#e5484d","#30a46c","#f5a524","#8e4ec6","#00a2c7","#e93d82","#a8845c"];function t$(t){let e=5381;for(let r=0;r<t.length;r++)e=Math.imul(e,33)+(t.codePointAt(r)??0);let n=Math.abs(e)%y_.length;return y_[n]}export{ck,dk,uk,hk,pk,Xc,fk,Sf,mk,Wh,gk,Qc,WR,Hy,g_,VR,UR,qR,GR,ed,KR,JR,YR,b_,v_,ZR,XR,QR,e$,y_,t$};
1
+ import{Mg,Os,Wy,Ur,Vy,as}from"./studio-c6zdm25z.js";var sS="meta",aS="frontmatter",lS="structure",cS="source",dS=2;function Xc(t){return t.getMap(sS)}function uS(t){return t.getMap(aS)}function _f(t){return t.getMap(lS)}function hS(t){return t.getText(cS)}function f(t){return JSON.parse(JSON.stringify(t))}function h(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var y=new Set(["textContent"]),m=new Set(["style","attributes","$props"]);function g(t,e){let n=t.toString();if(n===e)return!1;let r=0,o=Math.min(n.length,e.length);while(r<o&&n[r]===e[r])r+=1;let i=n.length,a=e.length;while(i>r&&a>r&&n[i-1]===e[a-1])i-=1,a-=1;if(i>r)t.delete(r,i-r);if(a>r)t.insert(r,e.slice(r,a));return!0}function l(t){let e=new Ur;for(let[n,r]of Object.entries(t)){if(r===void 0)continue;e.set(n,h(r)?l(r):f(r))}return e}function Y(t,e){for(let n of[...t.keys()])if(!(n in e)||e[n]===void 0)t.delete(n);for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=t.get(n);if(h(r))if(o instanceof Ur)Y(o,r);else t.set(n,l(r));else if(!b(o,r))t.set(n,f(r))}}function b(t,e){if(t===e)return!0;if(t instanceof Ur||t instanceof Os||t instanceof as)return!1;return JSON.stringify(t??null)===JSON.stringify(e??null)}function p(t){return typeof t==="string"?new as(t):pS(t)}function Wh(t){let e=new Os;return e.insert(0,t.map((n)=>p(n))),e}function pS(t){if(!h(t))throw TypeError("collab-schema: a document node must be a plain object");let e=new Ur;for(let[n,r]of Object.entries(t)){if(r===void 0)continue;if(n==="children"&&Array.isArray(r))e.set(n,Wh(r));else if(y.has(n)&&typeof r==="string")e.set(n,new as(r));else if(m.has(n)&&h(r))e.set(n,l(r));else e.set(n,f(r))}return e}function Qc(t){if(t instanceof Ur){let e={};for(let[n,r]of t.entries())e[n]=Qc(r);return e}if(t instanceof Os)return t.toArray().map((e)=>Qc(e));if(t instanceof as)return t.toString();return t}function PR(t){return Qc(_f(t))}function By(t,e){let n=_f(t);for(let r of e)if(n instanceof Ur)n=n.get(String(r));else if(n instanceof Os){let o=typeof r==="number"?r:Number(r);if(!Number.isInteger(o)||o<0||o>=n.length)return;n=n.get(o)}else return;return n}function m_(t,e,n){let r=hS(t);if(r.toString()===e)return!1;return t.transact(()=>{g(r,e)},n),!0}function FR(t,e,n={}){let r=Xc(t);if(r.get("structureSeeded")===!0)return!1;return t.transact(()=>{let o=_f(t);for(let[a,s]of Object.entries(e)){if(s===void 0)continue;if(a==="children"&&Array.isArray(s))o.set(a,Wh(s));else o.set(a,f(s))}let i=uS(t);for(let[a,s]of Object.entries(n.frontmatter??{}))if(s!==void 0)i.set(a,f(s));r.set("schemaVersion",dS),r.set("canonical","structure"),r.set("canonicalRev",0),r.set("sourceFormat",n.sourceFormat??null),r.set("structureSeeded",!0)},n.origin),!0}var jR="jx-local",HR="jx-mirror",BR="jx-seed";class ed extends Error{constructor(t){super(`collab-path-unresolved:${t.join("/")}`);this.name="CollabPathError"}}function w(t,e){let n=By(t,e);if(!(n instanceof Ur))throw new ed(e);return n}function d(t,e,n){let r=w(t,e),o=r.get("children");if(o instanceof Os)return o;if(n&&o===void 0){let i=new Os;return r.set("children",i),i}throw new ed([...e,"children"])}function R(t){return JSON.parse(JSON.stringify(t))}function P(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function M(t,e,n){let r=t.get(e);if(e==="children"&&Array.isArray(n)){t.set(e,Wh(n));return}if(y.has(e)&&typeof n==="string"){if(r instanceof as)g(r,n);else t.set(e,new as(n));return}if(m.has(e)&&P(n)){if(r instanceof Ur)Y(r,n);else t.set(e,l(n));return}t.set(e,R(n))}function D(t,e){switch(e.op){case"set-key":{let n=w(t,e.path);if(e.value===void 0)n.delete(e.key);else M(n,e.key,e.value);return}case"insert-child":{let n=d(t,e.parentPath,!0);if(e.index<0||e.index>n.length)throw new ed([...e.parentPath,"children",e.index]);n.insert(e.index,[p(e.node)]);return}case"remove-child":{let n=d(t,e.parentPath,!1);if(e.index<0||e.index>=n.length)throw new ed([...e.parentPath,"children",e.index]);n.delete(e.index,1);return}case"set-child":{let n=d(t,e.parentPath,!1);if(e.index<0||e.index>=n.length)throw new ed([...e.parentPath,"children",e.index]);let r=n.get(e.index);if(r instanceof as&&typeof e.node==="string"){g(r,e.node);return}n.delete(e.index,1),n.insert(e.index,[p(e.node)]);return}case"move-child":{let n=d(t,e.fromParentPath,!1),r=d(t,e.toParentPath,!0);if(e.fromIndex<0||e.fromIndex>=n.length)throw new ed([...e.fromParentPath,"children",e.fromIndex]);let o=Qc(n.get(e.fromIndex));if(n.delete(e.fromIndex,1),e.toIndex<0||e.toIndex>r.length)throw new ed([...e.toParentPath,"children",e.toIndex]);r.insert(e.toIndex,[p(o)]);return}default:throw Error(`unknown-doc-op:${e.op}`)}}function zR(t,e,n){t.transact(()=>{for(let r of e)D(t,r)},n)}function C(t){for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=="string")continue;if(m.has(n))return{key:n,nodePath:t.slice(0,e)};if(y.has(n))return{key:n,nodePath:t.slice(0,e)}}return null}function J(t){return t.every((e)=>typeof e==="string"||typeof e==="number")}function WR(t){if(t.length===0)return[];let e=t.map((o)=>o.path);if(!e.every((o)=>J(o)))return null;for(let o=0;o<e.length;o++)for(let i=0;i<e.length;i++){if(o===i)continue;let a=e[o],s=e[i];if(a.length<=s.length&&a.every((c,u)=>c===s[u]))return null}if(t.filter((o)=>o instanceof Mg).length>1)return null;let r=[];for(let o of t){let i=o.path,a=C(i);if(a){let{doc:s}=o.target;if(!s)return null;let c=By(s,[...a.nodePath,a.key]);if(c===void 0)return null;r.push({key:a.key,op:"set-key",path:a.nodePath,value:Qc(c)});continue}if(o instanceof Vy){let s=i.at(-1);if(i.at(-2)==="children"&&typeof s==="number"){r.push({index:s,node:o.target.toString(),op:"set-child",parentPath:i.slice(0,-2)});continue}return null}if(o instanceof Wy){let s=o.target;for(let[c,u]of o.changes.keys)if(u.action==="delete")r.push({key:c,op:"set-key",path:i});else r.push({key:c,op:"set-key",path:i,value:Qc(s.get(c))})}else if(o instanceof Mg){if(i.at(-1)!=="children")return null;let s=i.slice(0,-1),c=0;for(let u of o.changes.delta)if(u.retain!==void 0)c+=u.retain;else if(u.delete!==void 0)for(let x=0;x<u.delete;x++)r.push({index:c,op:"remove-child",parentPath:s});else if(u.insert!==void 0){let x=Array.isArray(u.insert)?u.insert:[u.insert];for(let O of x)r.push({index:c,node:Qc(O),op:"insert-child",parentPath:s}),c+=1}}else return null}return r}function VR(t,e,n){t.transact(()=>{let r=_f(t),o=e,i=[...r.keys()];for(let s of i)if(!(s in o)||o[s]===void 0)r.delete(s);for(let[s,c]of Object.entries(o)){if(c===void 0)continue;if(s==="children"&&Array.isArray(c))r.set(s,Wh(c));else r.set(s,JSON.parse(JSON.stringify(c)))}let a=Xc(t);a.set("canonicalRev",Number(a.get("canonicalRev")??0)+1)},n)}function g_(t){return Xc(t).get("canonical")==="source"?"source":"structure"}function b_(t){return Number(Xc(t).get("canonicalRev")??0)}function UR(t,e,n){if(g_(t)==="source")return!1;return t.transact(()=>{m_(t,e,n);let r=Xc(t);r.set("canonical","source"),r.set("canonicalRev",b_(t)+1)},n),!0}function qR(t,e){if(g_(t)!=="source")return!1;return t.transact(()=>{let n=Xc(t);n.set("canonical","structure"),n.set("canonicalRev",b_(t)+1)},e),!0}function GR(t,e,n){let r=[];for(let[o,i]of t.getStates()){let a=i;if(o!==n&&a.mode==="source"&&a.focusedPath===e)r.push(o)}return r}function KR(t,e){let n=t.clientID,r=t.getStates().get(n);if(r?.mode!=="source"||r.focusedPath!==e)return!1;let o=n;for(let[i,a]of t.getStates()){let s=a;if(s.mode==="source"&&s.focusedPath===e&&s.canWrite!==!1&&i<o)o=i}return o===n}var v_=["#4f9cf9","#e5484d","#30a46c","#f5a524","#8e4ec6","#00a2c7","#e93d82","#a8845c"];function JR(t){let e=5381;for(let r=0;r<t.length;r++)e=Math.imul(e,33)+(t.codePointAt(r)??0);let n=Math.abs(e)%v_.length;return v_[n]}export{sS,aS,lS,cS,dS,Xc,uS,_f,hS,Wh,pS,Qc,PR,By,m_,FR,jR,HR,BR,ed,zR,WR,VR,g_,b_,UR,qR,GR,KR,v_,JR};
2
2
 
3
- //# debugId=A73E7CFFC32FEE4B64756E2164756E21
4
- //# sourceMappingURL=studio-6exg5z4x.js.map
3
+ //# debugId=15ADD5B2190E687964756E2164756E21
4
+ //# sourceMappingURL=studio-4xppwncr.js.map
@@ -1,5 +1,5 @@
1
- import{p,We}from"./studio-6k1eswp9.js";import{$I,DI,Av,LS,AI,IS,NI,Nv}from"./studio-b29h7g7s.js";import{Rd}from"./studio-k9pwvmz8.js";import{Do,u}from"./studio-27tc8q0h.js";import{D}from"./studio-153mwkyq.js";function gm(){let t=We()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function hp(t){let n=gm(),e=We()?p().documentBaseUrl:void 0;if(e){let s=e.endsWith("/")?e:`${e}/`;return new URL(s,`${n}/`).href}let r=t||"";return`${n}/${r?`${r}/`:""}`}function Sx(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let n=gm();if((n.startsWith("http:")||n.startsWith("https:"))&&n!==location.origin)return`${n}/${t.replace(/^\.?\//,"")}`;return t}var a=/^[\w.~-]+$/,g="content",d="{locale}";function jC(t,n){if(typeof n!=="string"||n==="")return t;let e=t.indexOf("#"),r=e===-1?"":t.slice(e),s=e===-1?t:t.slice(0,e),o=s.indexOf("?"),i=o===-1?s:s.slice(0,o),c=(o===-1?[]:s.slice(o+1).split("&")).filter((f)=>f!==""&&!A(f));return c.push(`v=${encodeURIComponent(n)}`),`${i}?${c.join("&")}${r}`}function A(t){let n=t.indexOf("="),e=n===-1?t:t.slice(0,n);if(e==="v")return!0;if(!e.includes("%"))return!1;try{return decodeURIComponent(e)==="v"}catch{return!1}}function x(t,n){if(!t||!Object.hasOwn(t,n))return;let e=t[n];return typeof e==="string"?e:void 0}function iv(t,n,e=[]){if(!t||!n)return null;let r=t.replaceAll("\\","/").replace(/^\.\//,""),s=null,o=(i,l)=>{if(r.startsWith(`${i}/`)&&(!s||i.length>s.dir.length))s={dir:i,urlPrefix:l}};for(let[i,l]of Object.entries(n)){if(!l?.source||!a.test(i))continue;let c=R(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(d)){let f=y(r,c,i,e);if(f)o(f.dir,f.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;o(c,`/${g}/${i}`)}return s}function y(t,n,e,r){let s=n.indexOf(d),o=n.slice(0,s),i=n.slice(s+d.length);if(!t.startsWith(o))return null;let l=t.slice(o.length).split("/")[0]??"";if(l===""||!a.test(l))return null;let c=r.find((h)=>h.toLowerCase()===l.toLowerCase());if(c===void 0||!a.test(c))return null;return{dir:`${o}${l}${i}`.replace(/\/+$/,""),urlPrefix:`/${g}/${e}/${c}`}}function R(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function ov(t,n){if(!n||t==="")return null;if(n.space==="repo"){if(!n.fileBaseUrl)return null;let r=NI(t,n.documentDir,n.mounts,n.lanes);if(r===null)return null;let{suffix:s}=Av(t);return jC(`${n.fileBaseUrl}${Nv(r)}${s}`,x(n.versions,r))}let[e]=n.mounts;return e?m(t,n.documentDir,e):null}function m(t,n,e){if(LS(t))return null;let{path:r,suffix:s}=Av(t),o;try{o=decodeURIComponent(r)}catch{return null}let i=IS(n,o);if(i===null)return null;let l=$I([e],i);if(!l)return null;return`${l}${s}`}function HC(){return Do(D?.projectConfig??{}).i18n?.locales??[]}function bm(t,n){let e=n?.space??"site",r=iv(t,D?.projectConfig?.content,HC());if(e==="site"&&!r)return null;return{documentDir:AI(t??""),...n?.fileBaseUrl===void 0?{}:{fileBaseUrl:n.fileBaseUrl},lanes:DI,mounts:r?[r]:[],space:e}}function Cc(t){if(!t)return t;let n=bm(u.value?.documentPath,vm()),e=n&&{...n,versions:Rd()};return Sx(ov(t,e)??t)}function vm(){return{fileBaseUrl:hp(D?.projectRoot),...We()?{space:p().assetSpace}:{}}}
2
- export{jC,iv,ov,gm,hp,Sx,HC,bm,Cc,vm};
1
+ import{p,We}from"./studio-y7jehjrp.js";import{SI,EI,Nv,Sk,TI,Ek,LI,Ov}from"./studio-1q6amtph.js";import{Rd}from"./studio-xkfs0dp2.js";import{$o,u}from"./studio-x5g1xk77.js";import{D}from"./studio-tp642n5g.js";function pm(){let t=We()?p().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function hp(t){let n=pm(),e=We()?p().documentBaseUrl:void 0;if(e){let s=e.endsWith("/")?e:`${e}/`;return new URL(s,`${n}/`).href}let r=t||"";return`${n}/${r?`${r}/`:""}`}function kx(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let n=pm();if((n.startsWith("http:")||n.startsWith("https:"))&&n!==location.origin)return`${n}/${t.replace(/^\.?\//,"")}`;return t}var a=/^[\w.~-]+$/,g="content",d="{locale}";function PC(t,n){if(typeof n!=="string"||n==="")return t;let e=t.indexOf("#"),r=e===-1?"":t.slice(e),s=e===-1?t:t.slice(0,e),o=s.indexOf("?"),i=o===-1?s:s.slice(0,o),c=(o===-1?[]:s.slice(o+1).split("&")).filter((f)=>f!==""&&!A(f));return c.push(`v=${encodeURIComponent(n)}`),`${i}?${c.join("&")}${r}`}function A(t){let n=t.indexOf("="),e=n===-1?t:t.slice(0,n);if(e==="v")return!0;if(!e.includes("%"))return!1;try{return decodeURIComponent(e)==="v"}catch{return!1}}function x(t,n){if(!t||!Object.hasOwn(t,n))return;let e=t[n];return typeof e==="string"?e:void 0}function tv(t,n,e=[]){if(!t||!n)return null;let r=t.replaceAll("\\","/").replace(/^\.\//,""),s=null,o=(i,l)=>{if(r.startsWith(`${i}/`)&&(!s||i.length>s.dir.length))s={dir:i,urlPrefix:l}};for(let[i,l]of Object.entries(n)){if(!l?.source||!a.test(i))continue;let c=R(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(d)){let f=y(r,c,i,e);if(f)o(f.dir,f.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;o(c,`/${g}/${i}`)}return s}function y(t,n,e,r){let s=n.indexOf(d),o=n.slice(0,s),i=n.slice(s+d.length);if(!t.startsWith(o))return null;let l=t.slice(o.length).split("/")[0]??"";if(l===""||!a.test(l))return null;let c=r.find((h)=>h.toLowerCase()===l.toLowerCase());if(c===void 0||!a.test(c))return null;return{dir:`${o}${l}${i}`.replace(/\/+$/,""),urlPrefix:`/${g}/${e}/${c}`}}function R(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function nv(t,n){if(!n||t==="")return null;if(n.space==="repo"){if(!n.fileBaseUrl)return null;let r=LI(t,n.documentDir,n.mounts,n.lanes);if(r===null)return null;let{suffix:s}=Nv(t);return PC(`${n.fileBaseUrl}${Ov(r)}${s}`,x(n.versions,r))}let[e]=n.mounts;return e?m(t,n.documentDir,e):null}function m(t,n,e){if(Sk(t))return null;let{path:r,suffix:s}=Nv(t),o;try{o=decodeURIComponent(r)}catch{return null}let i=Ek(n,o);if(i===null)return null;let l=SI([e],i);if(!l)return null;return`${l}${s}`}function FC(){return $o(D?.projectConfig??{}).i18n?.locales??[]}function fm(t,n){let e=n?.space??"site",r=tv(t,D?.projectConfig?.content,FC());if(e==="site"&&!r)return null;return{documentDir:TI(t??""),...n?.fileBaseUrl===void 0?{}:{fileBaseUrl:n.fileBaseUrl},lanes:EI,mounts:r?[r]:[],space:e}}function Cc(t){if(!t)return t;let n=fm(u.value?.documentPath,mm()),e=n&&{...n,versions:Rd()};return kx(nv(t,e)??t)}function mm(){return{fileBaseUrl:hp(D?.projectRoot),...We()?{space:p().assetSpace}:{}}}
2
+ export{PC,tv,nv,pm,hp,kx,FC,fm,Cc,mm};
3
3
 
4
- //# debugId=85A7805083290D9E64756E2164756E21
5
- //# sourceMappingURL=studio-011em5cf.js.map
4
+ //# debugId=3B2A8E3149E8288464756E2164756E21
5
+ //# sourceMappingURL=studio-5d7wfmnp.js.map