@jxsuite/studio 5.7.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 (74) hide show
  1. package/dist/chunks/{cf-account-picker-882a7ecm.js → cf-account-picker-bb2yq946.js} +2 -2
  2. package/dist/chunks/content-source-t0q184js.js +4 -0
  3. package/dist/chunks/{convert-to-repeater-grfep2w8.js → convert-to-repeater-vqkt7s3s.js} +2 -2
  4. package/dist/chunks/entry-commands-fxzgcc4k.js +4 -0
  5. package/dist/chunks/{extension-sections-dp8endhx.js → extension-sections-8beq9ac3.js} +2 -2
  6. package/dist/chunks/file-ops-2n77759h.js +4 -0
  7. package/dist/chunks/files-fjy7zpxt.js +4 -0
  8. package/dist/chunks/{format-host-e2pjvd25.js → format-host-wj3mf3n8.js} +2 -2
  9. package/dist/chunks/fs-events-7kcgn4e9.js +4 -0
  10. package/dist/chunks/git-panel-7z2mpt2d.js +4 -0
  11. package/dist/chunks/{grid-view-5amhg604.js → grid-view-ca10def6.js} +2 -2
  12. package/dist/chunks/{iframe-host-t819mcg5.js → iframe-host-a0zjd6xp.js} +2 -2
  13. package/dist/chunks/{layers-4bsr82wz.js → layers-p677nrh5.js} +2 -2
  14. package/dist/chunks/layers-panel-y4w1dq90.js +4 -0
  15. package/dist/chunks/media-picker-xg7yjpz9.js +4 -0
  16. package/dist/chunks/menu-fpekzj6w.js +4 -0
  17. package/dist/chunks/publish-panel-xtbfgg2r.js +4 -0
  18. package/dist/chunks/quick-search-d3a6m7j3.js +4 -0
  19. package/dist/chunks/right-panel-31vbk5xp.js +4 -0
  20. package/dist/chunks/studio-1q6amtph.js +5 -0
  21. package/dist/chunks/{studio-56z7evx4.js → studio-3ck2a5c4.js} +2 -2
  22. package/dist/chunks/{studio-gh97gngt.js → studio-4fde4a0x.js} +2 -2
  23. package/dist/chunks/{studio-gfn1kpxj.js → studio-4jj9gme2.js} +3 -3
  24. package/dist/chunks/{studio-zpnk016a.js → studio-4m50vh74.js} +3 -3
  25. package/dist/chunks/{studio-dkn3x3hz.js → studio-4r0sjtx8.js} +2 -2
  26. package/dist/chunks/{studio-a7xqhc3n.js → studio-5d7wfmnp.js} +2 -2
  27. package/dist/chunks/{studio-ceb34dxj.js → studio-5gs9th4b.js} +2 -2
  28. package/dist/chunks/{studio-j6gnhvaa.js → studio-5vy2wfm5.js} +2 -2
  29. package/dist/chunks/{studio-spf2skgc.js → studio-7qvs7v0m.js} +2 -2
  30. package/dist/chunks/{studio-e6re3rk1.js → studio-84rtc120.js} +2 -2
  31. package/dist/chunks/{studio-nt06yybj.js → studio-8xcwewjq.js} +2 -2
  32. package/dist/chunks/{studio-cxt150pj.js → studio-aekhcdzw.js} +2 -2
  33. package/dist/chunks/{studio-222rqyyc.js → studio-bftp4n4b.js} +2 -2
  34. package/dist/chunks/{studio-xta2vxp6.js → studio-capk0583.js} +2 -2
  35. package/dist/chunks/{studio-wma2c6g8.js → studio-cbr9czkn.js} +2 -2
  36. package/dist/chunks/{studio-c9d3pxf7.js → studio-chdmwwzw.js} +2 -2
  37. package/dist/chunks/{studio-0k9mvpgj.js → studio-cp1gbff9.js} +2 -2
  38. package/dist/chunks/{studio-1x8x26k3.js → studio-cqmtbg2p.js} +2 -2
  39. package/dist/chunks/{studio-c6w3tq7t.js → studio-e47215hh.js} +2 -2
  40. package/dist/chunks/{studio-frb0qbf7.js → studio-fbx6twps.js} +2 -2
  41. package/dist/chunks/{studio-xk0z6msk.js → studio-fthwn4kf.js} +2 -2
  42. package/dist/chunks/{studio-0scebvb9.js → studio-g8dsj3d2.js} +2 -2
  43. package/dist/chunks/{studio-54g077x3.js → studio-ge5fqjth.js} +2 -2
  44. package/dist/chunks/{studio-p7c1agz0.js → studio-gjknvzam.js} +3 -3
  45. package/dist/chunks/{studio-mwxgyn9h.js → studio-hnvnfbdv.js} +3 -3
  46. package/dist/chunks/{studio-9mqfamps.js → studio-mk00zd5d.js} +2 -2
  47. package/dist/chunks/{studio-skzanb0k.js → studio-qa73881a.js} +2 -2
  48. package/dist/chunks/{studio-xry7tk3z.js → studio-rmn2dz59.js} +2 -2
  49. package/dist/chunks/{studio-eh0rac07.js → studio-rr4xkv81.js} +2 -2
  50. package/dist/chunks/{studio-f195h2hq.js → studio-tmeq6mjb.js} +2 -2
  51. package/dist/chunks/{studio-cvbkkfqb.js → studio-x5g1xk77.js} +2 -2
  52. package/dist/chunks/{studio-65fhspdd.js → studio-xg1942as.js} +2 -2
  53. package/dist/chunks/{studio-888knnkc.js → studio-xkfs0dp2.js} +2 -2
  54. package/dist/chunks/{studio-xy3tv3az.js → studio-zev8ssp1.js} +3 -3
  55. package/dist/chunks/{studio-tw7rre6s.js → studio-ztvcxm3w.js} +2 -2
  56. package/dist/chunks/{workspace-b69mgm0e.js → workspace-5vmgsagj.js} +2 -2
  57. package/dist/iframe-entry.js +3 -3
  58. package/dist/manifest.json +36 -36
  59. package/dist/studio.js +10 -10
  60. package/package.json +11 -11
  61. package/src/ui/schema-form.ts +6 -2
  62. package/dist/chunks/content-source-37x3vsap.js +0 -4
  63. package/dist/chunks/entry-commands-c5h3nqck.js +0 -4
  64. package/dist/chunks/file-ops-937cvqk6.js +0 -4
  65. package/dist/chunks/files-tznwe1p1.js +0 -4
  66. package/dist/chunks/fs-events-fv64ak3s.js +0 -4
  67. package/dist/chunks/git-panel-gb713ttc.js +0 -4
  68. package/dist/chunks/layers-panel-b6shnaax.js +0 -4
  69. package/dist/chunks/media-picker-ej0kdh1j.js +0 -4
  70. package/dist/chunks/menu-rtxf9chb.js +0 -4
  71. package/dist/chunks/publish-panel-bq36xcmj.js +0 -4
  72. package/dist/chunks/quick-search-zm00h9dh.js +0 -4
  73. package/dist/chunks/right-panel-pq2f71q3.js +0 -4
  74. package/dist/chunks/studio-693nhyky.js +0 -5
@@ -1,4 +1,4 @@
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-cvbkkfqb.js";import{p}from"./studio-y7jehjrp.js";import{th}from"./studio-1x8x26k3.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]===`
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
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},
@@ -9,8 +9,8 @@ ${Ve(l,S,o,(_)=>r.has(`${c}/${_}`))}${B}]`;let E=l.map((N,_)=>{let A=`${c}/${_}`
9
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
10
  ${f(Ne)}${B}}`};return`${u(e,"",0,0,!1,0)}
11
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("e2pjvd25"),import("./format-host-e2pjvd25.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}
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
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
15
  //# debugId=F4358AED35E7AC6364756E2164756E21
16
- //# sourceMappingURL=studio-zpnk016a.js.map
16
+ //# sourceMappingURL=studio-4m50vh74.js.map
@@ -1,5 +1,5 @@
1
- import{p}from"./studio-y7jehjrp.js";import{rt,zt,T,R,Ct}from"./studio-spf2skgc.js";import{v}from"./studio-fqq890ap.js";import{Ir}from"./studio-888knnkc.js";import{Al,Ld,_c,Gi,Va,Id,Bu}from"./studio-c6w3tq7t.js";import{sb,bE,ab,yE,wE}from"./studio-xk0z6msk.js";import{Cc}from"./studio-a7xqhc3n.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()}
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
2
  export{ld,Y_,XR,QR,e$,cd,uw};
3
3
 
4
4
  //# debugId=E3994757D515F61664756E2164756E21
5
- //# sourceMappingURL=studio-dkn3x3hz.js.map
5
+ //# sourceMappingURL=studio-4r0sjtx8.js.map
@@ -1,5 +1,5 @@
1
- import{p,We}from"./studio-y7jehjrp.js";import{SI,EI,Nv,Sk,TI,Ek,LI,Ov}from"./studio-693nhyky.js";import{Rd}from"./studio-888knnkc.js";import{$o,u}from"./studio-cvbkkfqb.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}:{}}}
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
2
  export{PC,tv,nv,pm,hp,kx,FC,fm,Cc,mm};
3
3
 
4
4
  //# debugId=3B2A8E3149E8288464756E2164756E21
5
- //# sourceMappingURL=studio-a7xqhc3n.js.map
5
+ //# sourceMappingURL=studio-5d7wfmnp.js.map