@jxsuite/studio 5.5.0 → 5.6.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.
- package/LICENSE +1 -1
- package/dist/chunks/{2020-g8mwpbkq.js → 2020-zvax9fmb.js} +3 -3
- package/dist/chunks/adapter-6zhjbpmd.js +4 -0
- package/dist/chunks/cf-account-picker-zfycs4k2.js +4 -0
- package/dist/chunks/cf-settings-fpa485q3.js +4 -0
- package/dist/chunks/components-b0vh4sq8.js +4 -0
- package/dist/chunks/content-source-z5t0d0h9.js +4 -0
- package/dist/chunks/convert-to-repeater-x19jr6c7.js +4 -0
- package/dist/chunks/editor-7e23n4a8.js +4 -0
- package/dist/chunks/entry-commands-5cm6aba2.js +4 -0
- package/dist/chunks/extension-sections-y90sa0n4.js +4 -0
- package/dist/chunks/file-ops-hv7gf757.js +4 -0
- package/dist/chunks/files-kb0epdxf.js +4 -0
- package/dist/chunks/format-host-eg1wy2bp.js +4 -0
- package/dist/chunks/fs-events-ky3vxfmh.js +4 -0
- package/dist/chunks/git-panel-yyg3bzp2.js +4 -0
- package/dist/chunks/grid-view-5mqv1cbd.css +1 -0
- package/dist/chunks/grid-view-d9mybhn0.js +51 -0
- package/dist/chunks/iframe-host-9wdf0hes.js +4 -0
- package/dist/chunks/index-2tf0m2ne.js +4 -0
- package/dist/chunks/{index-arg188jq.js → index-vnwy9d44.js} +3 -3
- package/dist/chunks/{javascript-zcdmye2k.js → javascript-f0nrbdjb.js} +2 -2
- package/dist/chunks/{jsonMode-6x5e1nbf.js → jsonMode-nfa90dtf.js} +5 -5
- package/dist/chunks/jx-validate-7w11db9v.js +4 -0
- package/dist/chunks/layers-7zasrpse.js +4 -0
- package/dist/chunks/layers-panel-9nzc4fdq.js +4 -0
- package/dist/chunks/lit-html-5qr7nbng.js +4 -0
- package/dist/chunks/media-picker-maevn9d4.js +4 -0
- package/dist/chunks/menu-wq6q0v3y.js +4 -0
- package/dist/chunks/{monaco-binding-4az2kh5p.js → monaco-binding-antn79jf.js} +3 -3
- package/dist/chunks/monaco-buffer-9ry2rn5x.js +4 -0
- package/dist/chunks/{monaco-setup-d7mwkcx3.js → monaco-setup-k8s40vwg.js} +3 -3
- package/dist/chunks/notify-g91gjd6w.js +4 -0
- package/dist/chunks/platform-jdwjp2vt.js +4 -0
- package/dist/chunks/publish-panel-8yym447p.js +4 -0
- package/dist/chunks/quick-search-9bzm9kh3.js +4 -0
- package/dist/chunks/references-znssfqvq.js +4 -0
- package/dist/chunks/right-panel-czbzktm8.js +4 -0
- package/dist/chunks/section-registry-0rtq73qs.js +4 -0
- package/dist/chunks/studio-011em5cf.js +5 -0
- package/dist/chunks/studio-02y9cb4h.js +6 -0
- package/dist/chunks/{studio-7gqyhjns.js → studio-09n3fyy0.js} +4 -4
- package/dist/chunks/{studio-xcng8nx7.js → studio-0c3fpdqj.js} +5 -5
- package/dist/chunks/studio-0mm38y62.js +5 -0
- package/dist/chunks/studio-0nm2skex.js +4 -0
- package/dist/chunks/{studio-73czgk6a.js → studio-153mwkyq.js} +4 -4
- package/dist/chunks/{studio-f8jyp45j.js → studio-1pxvgx1t.js} +4 -4
- package/dist/chunks/studio-27tc8q0h.js +5 -0
- package/dist/chunks/studio-28pz4s1k.js +5 -0
- package/dist/chunks/{studio-x5esgzct.js → studio-36s6qjgq.js} +4 -4
- package/dist/chunks/studio-4yztve2t.js +5 -0
- package/dist/chunks/{studio-x9sagq2d.js → studio-5fc0728f.js} +7 -7
- package/dist/chunks/{studio-7jazdy6y.js → studio-654fxcr0.js} +4 -4
- package/dist/chunks/studio-6exg5z4x.js +4 -0
- package/dist/chunks/studio-6k1eswp9.js +5 -0
- package/dist/chunks/{studio-5wfrgee9.js → studio-6zyt56ek.js} +4 -4
- package/dist/chunks/studio-7djymzt2.js +5 -0
- package/dist/chunks/{studio-b4epb26c.js → studio-7w04zw8h.js} +7 -7
- package/dist/chunks/studio-805fwp9k.js +5 -0
- package/dist/chunks/{studio-k1eaqyzm.js → studio-81twpmzj.js} +4 -4
- package/dist/chunks/studio-891t1tv9.js +5 -0
- package/dist/chunks/{studio-5n1km79v.js → studio-9n2j9nqk.js} +4 -4
- package/dist/chunks/{studio-he2fhrgp.js → studio-9tkaykt5.js} +4 -4
- package/dist/chunks/studio-ant1zbp3.js +5 -0
- package/dist/chunks/studio-b29h7g7s.js +5 -0
- package/dist/chunks/studio-b5rxwkj2.js +5 -0
- package/dist/chunks/studio-d007j0z3.js +7 -0
- package/dist/chunks/studio-dknr8m7b.js +14 -0
- package/dist/chunks/{studio-eq27rrr0.js → studio-dmymvk2j.js} +3 -3
- package/dist/chunks/studio-dtmdjmqb.js +5 -0
- package/dist/chunks/studio-eb5sty2k.js +5 -0
- package/dist/chunks/{studio-hc9q4j24.js → studio-ebt49j3c.js} +5 -5
- package/dist/chunks/studio-eegyf5vg.js +5 -0
- package/dist/chunks/studio-frv7vjhw.js +5 -0
- package/dist/chunks/studio-ft8pfpp0.js +5 -0
- package/dist/chunks/{studio-mhhc9btt.js → studio-gj4j9e7k.js} +4 -4
- package/dist/chunks/{studio-hf4qdjc8.js → studio-gxna6yta.js} +4 -4
- package/dist/chunks/studio-je15p5v8.js +6 -0
- package/dist/chunks/{studio-21enxdr8.js → studio-jsr14n1s.js} +4 -4
- package/dist/chunks/studio-k9pwvmz8.js +5 -0
- package/dist/chunks/{studio-p1eggxcf.js → studio-ks0ecgjx.js} +3 -3
- package/dist/chunks/studio-mb8jhtr4.js +64 -0
- package/dist/chunks/studio-mf41717j.js +5 -0
- package/dist/chunks/{studio-625ezz59.js → studio-mm8x32gg.js} +4 -4
- package/dist/chunks/{studio-pkkw32j0.js → studio-n2e133d6.js} +4 -4
- package/dist/chunks/{studio-c4pnt1c6.js → studio-njmg0e73.js} +5 -5
- package/dist/chunks/studio-nvykrgbj.js +4 -0
- package/dist/chunks/studio-nw4q9sdn.js +5 -0
- package/dist/chunks/studio-p6avneaq.js +5 -0
- package/dist/chunks/studio-pvj970st.js +5 -0
- package/dist/chunks/studio-r7yeeqc4.js +5 -0
- package/dist/chunks/studio-s85vah66.js +6 -0
- package/dist/chunks/studio-sadckcpp.js +7 -0
- package/dist/chunks/studio-sgzss898.js +9 -0
- package/dist/chunks/{studio-7by9a93k.js → studio-t0v47dpc.js} +4 -4
- package/dist/chunks/{studio-jnb285we.js → studio-tj28pxa1.js} +4 -4
- package/dist/chunks/{studio-6j2jn55a.js → studio-tzs6njnb.js} +8 -8
- package/dist/chunks/studio-vz7b43ng.js +5 -0
- package/dist/chunks/studio-w8w9frjy.js +16 -0
- package/dist/chunks/{studio-xc8ebsts.js → studio-wr0pq67n.js} +4 -4
- package/dist/chunks/{studio-8r4y2x0z.js → studio-y164brht.js} +4 -4
- package/dist/chunks/studio-y17505ge.js +928 -0
- package/dist/chunks/studio-ymsjnvp9.js +5 -0
- package/dist/chunks/studio-z1vdxq0e.js +5 -0
- package/dist/chunks/studio-z47mm077.js +10 -0
- package/dist/chunks/studio-zkkdbbvd.js +9 -0
- package/dist/chunks/{studio-awqghqxv.js → studio-zkvyd3ev.js} +4 -4
- package/dist/chunks/{tsMode-rtwt7w1a.js → tsMode-eq26t9gs.js} +5 -5
- package/dist/chunks/workspace-emt8454d.js +4 -0
- package/dist/chunks/ws-client-3gxqp06s.js +4 -0
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +62 -59
- package/dist/studio.css +1 -1
- package/dist/studio.js +115 -117
- package/package.json +5 -5
- package/src/account/action-flow.ts +294 -0
- package/src/account/action-required.ts +68 -0
- package/src/account-status.ts +29 -1
- package/src/browse/library-model.ts +3 -1
- package/src/browse/library-preview.ts +6 -2
- package/src/canvas/asset-refs.ts +3 -1
- package/src/canvas/asset-resolve.ts +79 -1
- package/src/canvas/iframe-entry.ts +38 -1
- package/src/canvas/iframe-host.ts +85 -0
- package/src/canvas/iframe-protocol.ts +13 -0
- package/src/files/asset-versions.ts +294 -0
- package/src/files/files.ts +61 -9
- package/src/files/fs-events.ts +279 -28
- package/src/files/media-meta.ts +2 -1
- package/src/files/media-paths.ts +5 -2
- package/src/files/media-upload.ts +5 -1
- package/src/new-project/add-repo-modal.ts +12 -1
- package/src/new-project/new-project-modal.ts +12 -1
- package/src/panels/git-panel.ts +25 -2
- package/src/platform-errors.ts +61 -1
- package/src/platforms/cloud.ts +389 -50
- package/src/platforms/devserver.ts +17 -1
- package/src/publish/pages-service.ts +17 -7
- package/src/services/ai-models.ts +30 -6
- package/src/services/ai-system-prompt.ts +81 -51
- package/src/settings/preferences-accounts.ts +42 -3
- package/src/settings/preferences-dialog.ts +8 -1
- package/src/studio.ts +18 -1
- package/src/surfaces/dialog.ts +5 -0
- package/src/surfaces/welcome.json +86 -1
- package/src/surfaces/welcome.ts +61 -2
- package/src/types.ts +84 -2
- package/src/ui/ai-managed-connect.ts +41 -4
- package/src/ui/media-picker.ts +2 -1
- package/dist/chunks/adapter-bsbs78x9.js +0 -4
- package/dist/chunks/cf-account-picker-gnm7xeqb.js +0 -4
- package/dist/chunks/cf-settings-9y6jyscp.js +0 -4
- package/dist/chunks/components-s51h3b7c.js +0 -4
- package/dist/chunks/content-source-ty3be0qg.js +0 -4
- package/dist/chunks/convert-to-repeater-c3e7q61z.js +0 -4
- package/dist/chunks/editor-t002b41m.js +0 -4
- package/dist/chunks/entry-commands-sb72e9gy.js +0 -4
- package/dist/chunks/extension-sections-ktn2ntnj.js +0 -4
- package/dist/chunks/file-ops-78zeytkm.js +0 -4
- package/dist/chunks/files-gatzrz8v.js +0 -4
- package/dist/chunks/format-host-r59b1651.js +0 -4
- package/dist/chunks/fs-events-f8h91ndt.js +0 -4
- package/dist/chunks/git-panel-y12zf7nj.js +0 -4
- package/dist/chunks/grid-view-rfd8b2pg.js +0 -51
- package/dist/chunks/grid-view-tafenfm2.css +0 -1
- package/dist/chunks/iframe-host-vsrsj20g.js +0 -4
- package/dist/chunks/index-5aghyrfh.js +0 -4
- package/dist/chunks/jx-validate-653krkrf.js +0 -4
- package/dist/chunks/layers-32p8gtae.js +0 -4
- package/dist/chunks/layers-panel-rs58m105.js +0 -4
- package/dist/chunks/lit-html-54bmkwz3.js +0 -4
- package/dist/chunks/media-picker-5bb04wct.js +0 -4
- package/dist/chunks/menu-cbha7w2e.js +0 -4
- package/dist/chunks/monaco-buffer-9vbbyfr1.js +0 -4
- package/dist/chunks/notify-dc1nz5ar.js +0 -4
- package/dist/chunks/platform-2m49s1zf.js +0 -4
- package/dist/chunks/publish-panel-nx3ycmma.js +0 -4
- package/dist/chunks/quick-search-yzrzh9x3.js +0 -4
- package/dist/chunks/references-vx7mbj9f.js +0 -4
- package/dist/chunks/right-panel-7jzpbxja.js +0 -4
- package/dist/chunks/section-registry-gjryse41.js +0 -4
- package/dist/chunks/studio-3znfhcxg.js +0 -5
- package/dist/chunks/studio-58qam27v.js +0 -4
- package/dist/chunks/studio-6j59fwaw.js +0 -5
- package/dist/chunks/studio-7z69g1gx.js +0 -5
- package/dist/chunks/studio-93j3v6zx.js +0 -5
- package/dist/chunks/studio-9gf6v8zy.js +0 -5
- package/dist/chunks/studio-9rhmettf.js +0 -4
- package/dist/chunks/studio-ac5aq677.js +0 -10
- package/dist/chunks/studio-as65vbns.js +0 -5
- package/dist/chunks/studio-bkv0sga4.js +0 -6
- package/dist/chunks/studio-bttmqef4.js +0 -5
- package/dist/chunks/studio-c3y9d41k.js +0 -5
- package/dist/chunks/studio-ccegp7gz.js +0 -9
- package/dist/chunks/studio-chxabn98.js +0 -6
- package/dist/chunks/studio-cktcdsxz.js +0 -16
- package/dist/chunks/studio-cnspfke5.js +0 -5
- package/dist/chunks/studio-de3p1ktm.js +0 -5
- package/dist/chunks/studio-fsbcn530.js +0 -928
- package/dist/chunks/studio-gftga7a3.js +0 -64
- package/dist/chunks/studio-hf1rpcq0.js +0 -4
- package/dist/chunks/studio-hz02hq70.js +0 -5
- package/dist/chunks/studio-jsv3s3s1.js +0 -5
- package/dist/chunks/studio-ks7cksh0.js +0 -5
- package/dist/chunks/studio-nptx0dbs.js +0 -5
- package/dist/chunks/studio-pg0z7k98.js +0 -5
- package/dist/chunks/studio-pve0b2f2.js +0 -5
- package/dist/chunks/studio-q7zmjv3b.js +0 -6
- package/dist/chunks/studio-rpmvw7kj.js +0 -5
- package/dist/chunks/studio-rwhss52s.js +0 -5
- package/dist/chunks/studio-sbg3g3h0.js +0 -5
- package/dist/chunks/studio-sq1bn60g.js +0 -14
- package/dist/chunks/studio-vwz7rma2.js +0 -5
- package/dist/chunks/studio-wa55e8gf.js +0 -5
- package/dist/chunks/studio-x0mzdha2.js +0 -5
- package/dist/chunks/studio-xrgpakvc.js +0 -9
- package/dist/chunks/studio-xt3djk1w.js +0 -7
- package/dist/chunks/studio-yh3nggx1.js +0 -7
- package/dist/chunks/studio-zmecp6hq.js +0 -5
- package/dist/chunks/workspace-g6dvaete.js +0 -4
- package/dist/chunks/ws-client-shf41j5p.js +0 -4
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var e=new Map,r=new Set;function o(){for(let t of r)t()}function Na(){o()}function ib(t){return r.add(t),()=>{r.delete(t)}}function rs(t){e.set(t.key,t),o()}function i1(t){if(e.delete(t))o()}function jf(){return[...e.values()].toSorted((t,s)=>t.order-s.order)}function gw(){return jf().map((t)=>t.key)}function bw(t){return e.get(t)}var i=null,n="overview";function ob(){if(i!==null&&e.has(i))return n=i,i=null,n;if(e.has(n))return n;return gw()[0]??n}function rb(t){if(e.has(t))n=t,i=null;else i=t;o()}export{Na,ib,rs,i1,jf,gw,bw,ob,rb};
|
|
2
|
-
|
|
3
|
-
//# debugId=3DD29E57FCA5F6EB64756E2164756E21
|
|
4
|
-
//# sourceMappingURL=studio-hf1rpcq0.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{f}from"./studio-jsv3s3s1.js";import{v}from"./studio-9rhmettf.js";import{g}from"./studio-ks7cksh0.js";import{qt,yi,Zt,Wa,Lr,Hs}from"./studio-de3p1ktm.js";import{Ds,hc}from"./studio-rwhss52s.js";import{ss,ub,hb,Oa,kr}from"./studio-6j59fwaw.js";import{D}from"./studio-73czgk6a.js";import{me}from"./studio-7gqyhjns.js";var uc="draft",lb="Marked a draft. Studio filters drafts out of its own lists; the build does not exclude them yet.";function _u(e){return e?.[uc]===!0}function N(e){return e?.properties?.[uc]?.type==="boolean"}function zf(e,t){return N(e)||_u(t)}var E=v({includeDrafts:!1});function G(){return E.includeDrafts}function xE(e){E.includeDrafts=e}function K(e,t,r){return r?e:e.filter((o)=>!_u(t(o)))}var b="__path";function cb(e){let r=(D?.projectConfig?.content??{})[e];if(!r?.source)return null;let o=r.source.replace(/^\.\//,"").replace(/\/$/,""),u=r.format==="json"?".json":yi(r.format)?.extensions[0]??Lr()?.extensions[0]??".json";return{def:r,dir:o,ext:u,name:e}}function Ew(){let e=D?.projectConfig?.content??{};return Object.entries(e).filter(([,t])=>{let r=t.source?.replace(/^\.\//,"")??"";return r!==""&&!/\.[a-z0-9]+$/i.test(r)}).map(([t,r])=>({dir:r.source.replace(/^\.\//,"").replace(/\/$/,""),name:t}))}async function P(e,t){let r=f(),o=[],u=async(x)=>{let w;try{w=await r.listDirectory(x)}catch{return}for(let C of w)if(C.type==="directory")await u(C.path);else if(t.some((k)=>C.path.endsWith(k)))o.push(C.path)};return await u(e),o.toSorted()}async function d1(e){await qt().catch(()=>{});let t=cb(e);if(!t)return[];return(await P(t.dir,[t.ext])).map((o)=>{let u=o.split("/").pop()??o;return u.slice(0,u.length-t.ext.length)})}async function V(e,t,r){let o=Array.from({length:e.length}),u=0,x=Array.from({length:Math.min(t,e.length)},async()=>{while(u<e.length){let w=u;u+=1,o[w]=await r(e[w])}});return await Promise.all(x),o}function T(e){if(e===null||e===void 0)return null;if(typeof e==="string"||typeof e==="number"||typeof e==="boolean")return e;if(Array.isArray(e)&&e.every((t)=>typeof t!=="object"||t===null))return e.map(String);return JSON.stringify(e)}function I(e){for(let t of g.tabs.values())if(t.documentPath===e)return t;return null}function W(e,t){return e.every((r)=>{let o=r[t];return o===null||o===void 0||typeof o!=="string"?!0:!o.startsWith("{")&&!o.startsWith("[")})}var j=new WeakSet;async function u1(){let e=[];for(let t of g.tabs.values()){let r=Oa(t);if(r&&j.has(r.source))e.push(r.load())}await Promise.all(e)}function A(e){let t=M(e);if(e.drafts)j.add(t);return t}function M(e){let t=new Map,r=null,o=null,u=(l=!1)=>{if(!l&&r)return r;return r=(async()=>{await qt().catch(()=>{});let c=f(),a=await e.list();t.clear(),o=null;let d=await V(a,32,async(n)=>{try{let i=await c.readFile(n),s=await kr(n,i);return{document:s.document,formatName:s.format.name,frontmatter:s.frontmatter??{},rawText:i}}catch{return null}});for(let[n,i]of a.entries()){let s=d[n];if(s)t.set(i,s)}})(),r},x=()=>{if(o)return o;let l={editable:!1,field:b,insertOnly:!0,kind:"string",pk:!0,required:!0,title:"Path",widthHint:220},c=ub(e.schema()),a=new Set([b,...c.map((i)=>i.field)]),d=[...t.values()].map((i)=>{let s={};for(let[m,p]of Object.entries(i.frontmatter))if(!a.has(m)&&!m.startsWith("$"))s[m]=T(p);return s}),n=hb(d);for(let i of n)i.editable=i.kind!=="text"||W(d,i.field);if(e.priorityFields?.length){let i=(s)=>{let m=e.priorityFields.indexOf(s.field);return m===-1?e.priorityFields.length:m};n.sort((s,m)=>i(s)-i(m))}return o=C([l,...c,...n]),o},w=()=>{if(!e.drafts)return!1;let l=e.schema();return zf(l)||[...t.values()].some((c)=>zf(l,c.frontmatter))},C=(l)=>{let c=l.findIndex((d)=>d.field===uc);if(c<1||!w())return l;let a=l.filter((d)=>d.field!==uc);return[a[0],l[c],...a.slice(1)]},k=(l,c)=>{let a={[b]:l};for(let d of x()){if(d.field===b)continue;a[d.field]=T(c.frontmatter[d.field])}return{cells:a,fingerprint:c.rawText,key:l}},O=async(l,c,a)=>{let d=f(),n={...c.frontmatter};for(let p of a)if(p.value===null)delete n[p.field];else n[p.field]=p.value;let i=c.document,s={...n,...i,children:i.children??[]},m=await Hs(c.formatName,s,{mode:"roundtrip"});Ds(l),await d.writeFile(l,m),t.set(l,{...c,frontmatter:n,rawText:m})};return{backingPaths:()=>new Map([...t.keys()].map((l)=>[l,l])),capabilities:{delete:!0,insert:!0,remotePaging:!1,remoteSort:!1},async columns(){return await u(),x()},async commit(l){await u();let c=f(),a={cells:[],deletes:[],inserts:[]},d=new Map;for(let n of l.cells){let i=d.get(n.rowKey)??[];i.push({field:n.field,value:n.value}),d.set(n.rowKey,i)}for(let[n,i]of d){let s=(h,F,R)=>{for(let S of i)a.cells.push({error:F,field:S.field,ok:h,rowKey:n,stale:R})},m=t.get(n);if(!m){s(!1,"Entry no longer loaded — refresh the grid");continue}let p=I(n);if(p?.doc.dirty){s(!1,"Open in a tab with unsaved changes — save or close it first");continue}let y=null;try{y=await c.readFile(n)}catch{y=null}if(y!==m.rawText&&!hc(n)){s(!1,"File changed on disk — refresh to reload",!0);continue}try{if(await O(n,m,i),s(!0),p){let{reloadFileInTab:h}=await (me("gatzrz8v"),import("./files-gatzrz8v.js"));h(n)}}catch(h){s(!1,h instanceof Error?h.message:String(h))}}for(let n of l.inserts){let i=n.cells[b];if(typeof i!=="string"||i.trim()===""){a.inserts.push({error:"Path is required",ok:!1,tempKey:n.tempKey});continue}let s=e.resolveInsertPath(i),m=t.has(s);if(!m)try{await c.readFile(s),m=!0}catch{m=!1}if(m){a.inserts.push({error:`${s} already exists`,ok:!1,tempKey:n.tempKey});continue}let p=e.insertFormatName(s);if(!p){a.inserts.push({error:`No format can serialize ${s}`,ok:!1,tempKey:n.tempKey});continue}try{let y={};for(let[R,S]of Object.entries(n.cells))if(R!==b&&S!==null)y[R]=S;let h=await Hs(p,{...y,children:[]},{frontmatter:Object.keys(y).length>0,mode:"roundtrip"});Ds(s),await c.writeFile(s,h);let F=await kr(s,h);t.set(s,{document:F.document,formatName:F.format.name,frontmatter:F.frontmatter??{},rawText:h}),a.inserts.push({newKey:s,ok:!0,tempKey:n.tempKey})}catch(y){a.inserts.push({error:y instanceof Error?y.message:String(y),ok:!1,tempKey:n.tempKey})}}for(let n of l.deletes){if(I(n.rowKey)){a.deletes.push({error:"Open in a tab — close it first",ok:!1,rowKey:n.rowKey});continue}try{Ds(n.rowKey),await c.deleteFile(n.rowKey),t.delete(n.rowKey),a.deletes.push({ok:!0,rowKey:n.rowKey})}catch(i){a.deletes.push({error:i instanceof Error?i.message:String(i),ok:!1,rowKey:n.rowKey})}}return a},id:e.id,label:e.label,async refresh(){await u(!0)},async rows(){await u();let c=(e.drafts?K([...t.entries()],([,a])=>a.frontmatter,G()):[...t.entries()]).map(([a,d])=>k(a,d));return{rows:c,total:c.length}}}}function h1(e){let t=()=>{let r=cb(e);if(!r)throw Error(`No content collection named "${e}" in project.json`);return r};return A({drafts:!0,id:ss({kind:"collection",name:e}),insertFormatName:(r)=>{let o=t();return(o.def.format?yi(o.def.format)?.name:void 0)??Zt(r)?.name??Lr()?.name??null},label:e,list:()=>{let r=t();return P(r.dir,[r.ext])},resolveInsertPath:(r)=>{let o=t(),u=r.trim().replace(/^\.\//,"").replace(/^\//,"");if(!u.includes("/"))u=`${o.dir}/${u}`;if(!u.endsWith(o.ext))u=`${u}${o.ext}`;return u},schema:()=>t().def.schema})}function p1(){let e=()=>{let t=Wa("page").filter((r)=>r!==".json");return t.length>0?t:[".md"]};return A({id:ss({kind:"pages"}),insertFormatName:(t)=>Zt(t)?.name??null,label:"Pages",list:()=>P("pages",e()),priorityFields:["title","description"],resolveInsertPath:(t)=>{let r=t.trim().replace(/^\.\//,"").replace(/^\//,"");if(!r.startsWith("pages/"))r=`pages/${r}`;if(!e().some((o)=>r.endsWith(o)))r=`${r}${e()[0]}`;return r},schema:()=>null})}
|
|
2
|
-
export{uc,lb,_u,zf,xE,cb,Ew,d1,u1,h1,p1};
|
|
3
|
-
|
|
4
|
-
//# debugId=D6B3814EB0A51E4364756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-hz02hq70.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var i=globalThis;function HC(n){i.__jxPlatform=n}function Sm(){return i.__jxLauncher}var e=new Map;function BC(){let n=[];for(let[r,a]of e)for(let t=0;t<a;t++)n.push(r);return n}function d(n){e.set(n,(e.get(n)??0)+1)}function m(n){let r=(e.get(n)??1)-1;if(r>0)e.set(n,r);else e.delete(n)}function h(n){let r=new Map;return new Proxy(n,{get(a,t){let o=Reflect.get(a,t);if(typeof o!=="function"||typeof t!=="string")return o;let l=r.get(t);if(l&&l.raw===o)return l.wrapper;let c=t,g=(...w)=>{let u=o.apply(a,w);if(typeof u?.then!=="function")return u;d(c);let p=()=>{m(c)};return u.then(p,p),u};return r.set(t,{raw:o,wrapper:g}),g}})}var s=null;function f(){let n=i.__jxPlatform;if(!n)throw Error("No platform registered. Call registerPlatform() before starting Studio.");if(s?.raw!==n)s={raw:n,wrapped:h(n)};return s.wrapped}function et(){return i.__jxPlatform!=null}
|
|
2
|
-
export{HC,Sm,BC,f,et};
|
|
3
|
-
|
|
4
|
-
//# debugId=FB0682646CEADCA564756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-jsv3s3s1.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{ge,Ka,ee,v,re,Od,S}from"./studio-9rhmettf.js";import{mp}from"./studio-7jazdy6y.js";import{f}from"./studio-jsv3s3s1.js";import{yi,Zt,Lr}from"./studio-de3p1ktm.js";import{K,wm,ht,_n,Zo,Ba,D}from"./studio-73czgk6a.js";import{Ae,Sc,xm,PC}from"./studio-625ezz59.js";import{ha,Xu,Qu}from"./studio-as65vbns.js";import{me}from"./studio-7gqyhjns.js";function um(e,t){return{success:!0,data:e,summary:t}}function io(e){return{success:!1,error:e}}function Gi({name:e,description:t,parameters:n,strict:o=!0,llmStrict:r=!1,interactive:i,execute:s}){return{name:e,description:t,parameters:n,strict:o,llmStrict:r,...i===void 0?{}:{interactive:i},execute:s}}function se(e){let t=[];return{record(n){t.push(n),e?.(n)},writes:t}}function op(e=null,t={}){let n=new Map(Object.entries(t));return{sessionId:e,get:(o)=>n.get(o),set:(o,r)=>{n.set(o,r)},toJSON:()=>Object.fromEntries(n)}}var wt=new AbortController().signal;function Jb(e={}){let t=e.session??op();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??se(),progress:e.progress??(()=>{}),session:t,signal:e.signal??wt}}function GT(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let n=()=>{t.abort(e.reason)};return e.addEventListener("abort",n,{once:!0}),{release:()=>{e.removeEventListener("abort",n)},signal:t.signal}}function gC(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>({type:"function",function:{name:t.name,description:t.description,parameters:t.parameters,...t.llmStrict===!0?{strict:!0}:{}}}))},getDefinition(t){return e.get(t)},validate(t,n){let o=e.get(t);if(!o)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!o.strict)return{valid:!0};let r=o.parameters;if(!r||!r.properties)return{valid:!0};let i=[],s=r.properties,a=r.required||[],l=n;for(let c of a)if(!(c in n)||l[c]===void 0||l[c]===null)i.push(`Missing required argument: "${c}"`);for(let[c,d]of Object.entries(l)){let m=s[c];if(!m)continue;let y=m.type;if(!y)continue;let b=Array.isArray(d)?"array":typeof d;if(y==="number"||y==="integer"){if(b==="number")continue;if(b==="string"){if(!Number.isNaN(Number(d)))continue;i.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}i.push(`Argument "${c}" should be a number, got ${b}`);continue}if(y==="string"&&b!=="string")i.push(`Argument "${c}" should be a string, got ${b}`);else if(y==="boolean"&&b!=="boolean")i.push(`Argument "${c}" should be a boolean, got ${b}`);else if(y==="array"&&b!=="array")i.push(`Argument "${c}" should be an array, got ${b}`);else if(y==="object"&&b!=="object")i.push(`Argument "${c}" should be an object, got ${b}`)}return i.length>0?{valid:!1,errors:i}:{valid:!0}},async execute(t,n,o=Jb()){let r=e.get(t);if(!r)return io(`Unknown tool: "${t}"`);let i=this.validate(t,n);if(!i.valid)return io(`Validation failed: ${(i.errors||[]).join("; ")}`);try{return await r.execute(n,o)}catch(s){return io(`Tool "${t}" execution error: ${s.message}`)}}}}var F=[],St=50;function KT(e){return Object.assign(se(),{turnId:e})}function JT(e,t){if(t.length===0)return[];let n={id:e,writes:[...t]};F.push(n);while(F.length>St)F.shift();return n.writes}function ax(e){return F.find((t)=>t.id===e)?.writes??[]}function YT(e){let t=e.filter((a)=>a.ok),n=new Set(t.map((a)=>a.path)),o=e.length-t.length;if(n.size===0)return o>0?`${o} change${o===1?"":"s"} failed`:"";let r=`Changed ${n.size} file${n.size===1?"":"s"}`,i=new Set(t.filter((a)=>a.disk).map((a)=>a.path)),s=[r];if(i.size>0)s.push(`${i.size} written to disk — undo cannot reach ${i.size===1?"it":"them"}`);if(o>0)s.push(`${o} failed`);return s.join(" · ")}function lx(){F.splice(0)}function bC(e,t){let n=null;for(let o=e.length-1;o>=0;o--){let r=e[o];if(r.id===t)return n;let i=r.role==="assistant"&&(r.content||(r.toolCalls?.length??0)>0);if(n===null&&i)n=r.id}return t===void 0?n:null}var Ct=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),rx="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Ko(e){if(typeof e!=="string"||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function qb(e){return Ko(e)!==null}function WT(e){let t=Ko(e);if(t===null)return"ltr";let n=new Intl.Locale(t),o=n.script??n.maximize().script;return o!==void 0&&Ct.has(o)?"rtl":"ltr"}function un(e){let t=Ko(e);if(t===null)return typeof e==="string"?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var Rt="prefix-except-default";function $o(e){let t=e.i18n,n=[];if(!t||typeof t!=="object")return{errors:n,i18n:null};let o=Array.isArray(t.locales)?t.locales:[],r=[];for(let a of o){let l=Ko(a);if(l===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!r.includes(l))r.push(l)}let i=Ko(t.defaultLocale)??r[0]??null;if(t.defaultLocale!==void 0&&Ko(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!r.includes(i))r.unshift(i);let s=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Rt;return{errors:n,i18n:{defaultLocale:i,locales:r,routing:s}}}function Ou(e,t){let n=ae(W(e),t);if(n===-1||t===null)return null;return Ko(W(e)[n])}function VT(e,t){let n=Ou(e,t);if(n!==null||t===null||t.routing!=="prefix-except-default")return n;return W(e)[0]==="pages"?t.defaultLocale:null}function mC(e,t){let n=W(e),o=ae(n,t);return o===-1?n.join("/"):n.filter((r,i)=>i!==o).join("/")}function Mu(e,t,n){if(n===null)return null;let o=Ko(t);if(o===null||!n.locales.includes(o))return null;let r=W(e),i=ae(r,n),s=i===-1?At(r):i;if(s===-1)return null;let a=i===-1?r:r.filter((l,c)=>c!==i);if(o===n.defaultLocale&&n.routing==="prefix-except-default")return a.join("/");return a.toSpliced(s,0,o.toLowerCase()).join("/")}function W(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function ae(e,t){if(t===null)return-1;return e.findIndex((n)=>{let o=Ko(n);return o!==null&&t.locales.includes(o)})}function At(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}var hx="{locale}";function Je(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function B(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ie(e){return e??D?.projectConfig??null}function De(e){return e?.content??{}}function kt(e){let t=$o(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function Le(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Me(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:Lr()?.extensions[0]??".json",unresolvedFormat:null};let t=yi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function Jt(e,t){let n=t===null?"[^/]+":`(?:${t.map((r)=>Je(r)).join("|")})`,o=B(e).split(hx).map((r)=>Je(r)).join(n);return new RegExp(`^${o}(?:/|$)`,"i")}function jt(e,t,n){let o=Jt(e,n).exec(t);if(!o)return null;return o[0].replace(/\/$/,"")}function It(e){return B(e).replaceAll(hx,"").length}function lp(e,t){if(e===null||e===void 0||e==="")return null;let n=Ie(t),o=kt(n),r=B(e),i=null,s=-1;for(let[a,l]of Object.entries(De(n))){let{source:c}=l;if(c===void 0||c===""||Le(c))continue;let d=It(c);if(d<=s)continue;let m=jt(c,r,o);if(m===null)continue;i={def:l,dir:r,fileBacked:!1,isSourceRoot:r.length===m.length,name:a,...Me(l)},s=d}return i}function px(e,t){if(e===null||e===void 0||e==="")return null;let n=Ie(t),o=B(e),r=o.toLowerCase();for(let[i,s]of Object.entries(De(n))){let{source:a}=s;if(a===void 0||a===""||!Le(a))continue;let l=B(a).toLowerCase();if(r===l||r.endsWith(`/${l}`))return{def:s,dir:o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:i,...Me(s)}}return lp(o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",n)}function $l(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function lv(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,n)=>n?n.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function cv(e){return e.replaceAll(/(^|-)(\w)/g,(t,n,o)=>(n?" ":"")+o.toUpperCase())}function fx(e,t){return e?.$label||$l(t)}function wL(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(n,o,r)=>(o?" ":"")+r.toUpperCase());return $l(t)}function ca(e){return e==="image"||e==="uri-reference"}function kd(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(ca(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function Hu(e,t){if(!e||!t?.content)return null;let n=px(e,t);if(!n||!n.def.schema)return null;if(!n.fileBacked){let o=n.ext??Lr()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(o.toLowerCase()))return null}return{name:n.name,schema:n.def.schema}}function pm(e,t){let n=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!n)return"";return`${t}${n}`}function dv(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(n)=>n.toUpperCase())||e}function xL(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((r)=>r[1])};return{kind:"text"}}function Ao(e){return JSON.parse(JSON.stringify(e))}function Te(e){return e&&e.length>0?e.at(-1):null}function QT(e){return e&&e.length>0?e[0]:null}function Zb(e,t){if(!t||!e)return!1;return e.some((n)=>Zo(n,t))}function us(e){return L(e)}function L(e){let t=[];for(let n of e)t.push([...n]);return t}function Xb(e,t){if(Zb(e,t))return L(e.filter((n)=>!Zo(n,t)));return[...L(e),[...t]]}function eL(e,t,n){let o=e.findIndex((s)=>Zo(s,n)),r=t?e.findIndex((s)=>Zo(s,t)):-1;if(o===-1||r===-1)return[[...n]];let i=r<=o?e.slice(r,o+1):e.slice(o,r+1).toReversed();return L(i)}function Ee(e,t){return L(e.filter((n)=>!Ba(t,n)))}function Dt(e,t){let n=Math.min(e.length,t.length);for(let o=0;o<n;o++){let r=e[o],i=t[o];if(r===i)continue;if(typeof r==="number"&&typeof i==="number")return r-i;return String(r)<String(i)?-1:1}return e.length-t.length}function Lt(e){return L(e.filter((t)=>!e.some((n)=>!Zo(n,t)&&Ba(n,t))))}function Il(e){return e.at(-2)==="children"&&typeof e.at(-1)==="number"}function Qb(e){return Lt(e).filter((t)=>Il(t)).toSorted((t,n)=>Dt(n,t))}function tL(e){let t=[];for(let n of e)if(!t.some((o)=>Zo(o,n)))t.push([...n]);return t}function sp(e){if(e.length===0)return{mixed:!1,value:void 0};let t=e[0],n=JSON.stringify(t??null);for(let o=1;o<e.length;o++)if(JSON.stringify(e[o]??null)!==n)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var $e=null;function nL(e){$e=e}function Ne(){return $e}var V=null,U=null,G=null,le=!0;function _e(){V=[],U=[],G=[],le=!0}function p(e){if(V)V.push(e)}function bi(e){if(U)U.push(e)}function Fe(e){if(G)G.push(e)}function We(){let e={docOps:U??[],fmOps:G??[],invertible:le,ops:V??[]};return V=null,U=null,G=null,le=!0,e}var Be=100,Mt=20;function H(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function P(e,t,n,o){return{forward:{key:t,op:"set-key",path:e,value:o},inverse:{key:t,op:"set-key",path:e,value:n}}}function Et(e,t,n,o,r){let i=e.length;if(!(i<t.length&&e.every((c,d)=>c===t[d]))||t[i]!=="children"||typeof t[i+1]!=="number")return t;let a=t[i+1];if(r?a<n:a<=n)return t;let l=[...t];return l[i+1]=a+o,l}var Ve=null;function Ke(e){Ve=e}var Ge=null;function He(e){Ge=e}function $t(e,t,n,o){for(let r=t.docOps.length-1;r>=0;r--)xm(e.doc.document,re(t.docOps[r].inverse));for(let r=t.fmOps.length-1;r>=0;r--){let i=t.fmOps[r];fe(e,i.field,i.before)}e.doc.document={...re(e.doc.document)},e.session.selection=n,e.doc.dirty=o}function q(e,t,{skipHistory:n=!1,origin:o="user",coalesceKey:r=null}={}){if(!e)return!1;if(o!=="remote"&&Ge?.(e,o))return!1;let i=us(e.session.selection),s=e.doc.dirty;_e();let a,l=null;try{t(e)}catch(b){l={error:b}}finally{a=We()}if(l)throw $t(e,a,i,s),l.error;let c=re(e.doc.document),d={...c},m=Ne(),y=m===null?{patchable:!1,reason:"no-patch-consumer"}:a.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:m.classify(e,a.ops);if(y.patchable)m.markConsumed(d,e);if(e.doc.document=d,y.patchable)try{m.apply(e,a.ops,a)}catch(b){m.escalate(`patch-apply-failed: ${b instanceof Error?b.message:String(b)}`,e)}if(!n&&!M)Nt(e,c,a,i,r);return e.doc.dirty=!0,Ve?.(e,a,o),!0}function Nt(e,t,n,o,r=null){let i=e.history.snapshots.slice(0,e.history.index+1),s=H()&&n.invertible&&(n.docOps.length>0||n.fmOps.length>0),a=i.at(-1);if(r&&s&&a&&a.coalesceKey===r&&a.inverseOps){if(a.forwardOps=[...a.forwardOps??[],...n.docOps.map((c)=>c.forward)],a.inverseOps=[...a.inverseOps,...n.docOps.map((c)=>c.inverse)],a.selection=us(e.session.selection),a.document)a.document=Ao(t);e.history.snapshots=i,e.history.index=i.length-1;return}let l=!s||i.length%Mt===0;if(i.push({document:l?Ao(t):null,fmOps:s&&n.fmOps.length>0?n.fmOps:null,forwardOps:s?n.docOps.map((c)=>c.forward):null,inverseOps:s?n.docOps.map((c)=>c.inverse):null,coalesceKey:r,selection:us(e.session.selection),selectionBefore:o}),i.length>Be){if(!i[1].document)i[1].document=ce(i,1);i.shift()}e.history.snapshots=i,e.history.index=i.length-1}function ce(e,t){let n=t;while(n>=0&&!e[n].document)n-=1;if(n<0)throw Error("history-missing-checkpoint");let o=Ao(e[n].document);for(let r=n+1;r<=t;r++)for(let i of e[r].forwardOps??[])xm(o,i);return o}function Ns(e,t,n){return q(e,(o)=>t(o.doc.document),n)}function ue(e,t){q(e,(n)=>{for(let o of t)de(n,o)},{origin:"remote",skipHistory:!0})}var _t=new Set(["state","$media","$head","$elements","imports","$layout"]);function de(e,t){let n=t.op==="set-key"?K(e.doc.document,t.path)?.[t.key]:null;switch(xm(e.doc.document,t),bi({forward:t,inverse:t}),t.op){case"set-key":{if(_t.has(t.key))p({key:t.key,op:"doc-meta"});else if(t.key==="style")p({op:"set-style",path:t.path});else if(t.key==="textContent")p({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")p({op:"replace",path:t.path});else{let o=t.key.startsWith("on")&&(Qu(t.value)||Qu(n));p({isEvent:o,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{p({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{p({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{p({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{p({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var M=null,qe=null;function ze(e){qe=e}function ev(e){M=e}function tv(){let e=M;if(e&&!j.has(e)){let t=re(e.doc.document),n={document:Ao(t),selection:us(e.session.selection)},o=e.history.snapshots.slice(0,e.history.index+1);if(o.push(n),o.length>Be)o.shift();e.history.snapshots=o,e.history.index=o.length-1}if(M=null,e)qe?.(e)}function cx(){return M!==null}function iL(){return M}var j=new WeakMap;function hm(e,t){if(t)j.set(e,t);else j.delete(e)}function oL(e){let t=j.get(e);return t?t.canUndo(e):e.history.index>0}function rL(e){let t=j.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function Ye(e,t){let{snapshots:n}=e.history;e.doc.document=ce(n,t);let o=n[t];e.session.selection=us(re(o.selection))}function Ze(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let n=JSON.stringify(ce(e.history.snapshots,t)),o=JSON.stringify(Ao(re(e.doc.document)));if(n!==o)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function dx(e){let t=j.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let n=e.history.snapshots[e.history.index],o=H()?n.inverseOps:null,r=H()?n.fmOps:null;if(o&&o.length>0||r&&r.length>0){if(!q(e,(s)=>{if(o)for(let a=o.length-1;a>=0;a--)de(s,re(o[a]));if(r)for(let a=r.length-1;a>=0;a--){let l=re(r[a]);fe(s,l.field,l.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=us(re(n.selectionBefore??[])),e.history.index-=1,Ze(e,e.history.index)}else e.history.index-=1,Ye(e,e.history.index);e.doc.dirty=!0}function sL(e){let t=j.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let n=e.history.snapshots[e.history.index+1],o=H()?n.forwardOps:null,r=H()?n.fmOps:null;if(o&&o.length>0||r&&r.length>0){if(!q(e,(s)=>{if(o)for(let a of o)de(s,re(a));if(r)for(let a of r){let l=re(a);fe(s,l.field,l.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=us(re(n.selection)),e.history.index+=1,Ze(e,e.history.index)}else e.history.index+=1,Ye(e,e.history.index);e.doc.dirty=!0}function Ki(e,t,n,o){let r=K(e.doc.document,t);if(!r)return;Sc(r).splice(n,0,structuredClone(o)),p({index:n,op:"insert",parentPath:t}),bi({forward:{index:n,node:Ae(o),op:"insert-child",parentPath:t},inverse:{index:n,op:"remove-child",parentPath:t}})}function Fu(e,t){if(!t||!Il(t))return;let n=ht(t),o=_n(t),[r]=K(e.doc.document,n).children.splice(o,1);p({op:"remove",path:t}),bi({forward:{index:o,op:"remove-child",parentPath:n},inverse:{index:o,node:Ae(r),op:"insert-child",parentPath:n}}),e.session.selection=Ee(e.session.selection,t)}function yC(e,t){if(!t||!Il(t))return;let n=K(e.doc.document,t);if(!n)return;let o=ht(t),r=_n(t),i=structuredClone(re(n));K(e.doc.document,o).children.splice(r+1,0,i),p({index:r+1,op:"insert",parentPath:o}),bi({forward:{index:r+1,node:Ae(i),op:"insert-child",parentPath:o},inverse:{index:r+1,op:"remove-child",parentPath:o}}),e.session.selection=[[...o,"children",r+1]]}function ap(e,t){for(let n of Qb(t))Fu(e,n)}function nv(e,t){let n=[];for(let o of Qb(t)){let r=e.session.selection;yC(e,o);let i=Te(e.session.selection);if(!i||e.session.selection===r)continue;let s=ht(i),a=_n(i);n=n.map((l)=>Et(s,l,a,1,!0)),n.unshift(i)}if(n.length>0)e.session.selection=n}function aL(e,t,n="div"){if(!t||!Il(t))return;let o=K(e.doc.document,t);if(!o)return;let r=ht(t),i=_n(t),s={children:[structuredClone(re(o))],tagName:n},a=Ae(o);K(e.doc.document,r).children.splice(i,1,s),p({op:"replace",path:t}),bi({forward:{index:i,node:Ae(s),op:"set-child",parentPath:r},inverse:{index:i,node:a,op:"set-child",parentPath:r}}),e.session.selection=[[...r,"children",i]]}function aa(e,t,n,o){let r=e.doc.document,i=ht(t),s=_n(t);if(!i||typeof s!=="number")return;let a=K(r,i),l=K(r,n);if(!a||!Array.isArray(a.children)||!l)return;if(a.children[s]===void 0)return;let c=o;if(a===l&&s<o)c-=1;let d={fromIndex:s,fromParentPath:i,op:"move-child",toIndex:c,toParentPath:n},m=PC(r,d),[y]=a.children.splice(s,1);if(Sc(l).splice(c,0,y),p({fromPath:t,op:"move",toIndex:c,toParentPath:n}),bi({forward:d,inverse:m}),Zo(Te(e.session.selection),t)){let b=o;if(i.length===n.length&&i.every((_,I)=>_===n[I])&&s<o)b=o-1;e.session.selection=[[...n,"children",b]]}}function Ue(e,t,n,o){let r=K(e.doc.document,t);if(!r)return;let i=r[n],s=Ae(i);if(o===void 0||o===null||o==="")delete r[n];else r[n]=o;if(bi(P(t,n,s,Ae(r[n]))),n==="textContent")p({op:"set-text",path:t});else if(n==="style")p({op:"set-style",path:t});else{let a=o===void 0||o===null||o===""?i:o,l=n.startsWith("on")&&Qu(a);p({isEvent:l,key:n,op:"set-prop",path:t})}}function yc(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.style);if(!r.style)r.style={};if(o===void 0||o==="")delete r.style[n];else r.style[n]=o;if(Object.keys(r.style).length===0)delete r.style;bi(P(t,"style",i,Ae(r.style))),p({op:"set-style",path:t})}function Jo(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.attributes);if(!r.attributes)r.attributes={};if(o===void 0||o==="")delete r.attributes[n];else r.attributes[n]=o;if(Object.keys(r.attributes).length===0)delete r.attributes;bi(P(t,"attributes",i,Ae(r.attributes))),p({attr:n,op:"set-attr",path:t})}function lL(e,t,n,o,r){if(!n)return yc(e,t,o,r);let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=`@${n}`,l=Xu(i.style,a);if(r===void 0||r===""){if(delete l[o],Object.keys(l).length===0)delete i.style[a]}else l[o]=r;if(Object.keys(i.style).length===0)delete i.style;bi(P(t,"style",s,Ae(i.style))),p({op:"set-style",path:t})}function iv(e,t,n,o,r){let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=Xu(i.style,n);if(r===void 0||r===""){if(delete a[o],Object.keys(a).length===0)delete i.style[n]}else a[o]=r;if(Object.keys(i.style).length===0)delete i.style;bi(P(t,"style",s,Ae(i.style))),p({op:"set-style",path:t})}function cL(e,t,n,o,r,i){let s=K(e.doc.document,t),a=Ae(s.style);if(!s.style)s.style={};let l=`@${n}`,c=Xu(s.style,l),d=Xu(c,o);if(i===void 0||i===""){if(delete d[r],Object.keys(d).length===0)delete c[o];if(Object.keys(c).length===0)delete s.style[l]}else d[r]=i;if(Object.keys(s.style).length===0)delete s.style;bi(P(t,"style",a,Ae(s.style))),p({op:"set-style",path:t})}function Xe(e,t){let n=[e];for(let o of t){let r=ha(n.at(-1),o);if(!r)break;n.push(r)}for(let o=n.length-2;o>=0;o--){let r=n[o],i=t[o],s=ha(r,i);if(s&&Object.keys(s).length===0)delete r[i]}}function ov(e,t,n,o,r){let i=K(e.doc.document,t),s=Ae(i.style);if(!i.style)i.style={};let a=i.style;for(let l of n)a=Xu(a,l);if(r===void 0||r==="")delete a[o],Xe(i.style,n);else a[o]=r;if(Object.keys(i.style).length===0)delete i.style;bi(P(t,"style",s,Ae(i.style))),p({op:"set-style",path:t})}function dL(e,t,n,o,r,i){let s=K(e.doc.document,t),a=Ae(s.style);if(!s.style)s.style={};let l=`@${n}`,c=Xu(s.style,l),d=c;for(let m of o)d=Xu(d,m);if(i===void 0||i===""){if(delete d[r],Xe(c,o),Object.keys(c).length===0)delete s.style[l]}else d[r]=i;if(Object.keys(s.style).length===0)delete s.style;bi(P(t,"style",a,Ae(s.style))),p({op:"set-style",path:t})}function uL(e,t,n){let o=K(e.doc.document,t),r=Ae(o.style);if(n&&Object.keys(n).length>0)o.style=n;else delete o.style;bi(P(t,"style",r,Ae(o.style))),p({op:"set-style",path:t})}function Os(e,t,n){let o=e.doc.document,r=Ae(o.state);if(!o.state)o.state={};o.state[t]=n,bi(P([],"state",r,Ae(o.state))),p({key:"state",op:"doc-meta"})}function rv(e,t){let n=e.doc.document;if(n.state){let o=Ae(n.state);if(delete n.state[t],Object.keys(n.state).length===0)delete n.state;bi(P([],"state",o,Ae(n.state))),p({key:"state",op:"doc-meta"})}}function fr(e,t,n){let o=e.doc.document,r=Ae(o.state);if(!o.state)o.state={};let i=o.state[t],s=i==null?{}:typeof i!=="object"||Array.isArray(i)?{default:i}:i;o.state[t]=s,Object.assign(s,n);for(let a of Object.keys(s))if(s[a]===void 0||s[a]===null)delete s[a];bi(P([],"state",r,Ae(o.state))),p({key:"state",op:"doc-meta"})}function hL(e,t,n){let o=e.doc.document;if(!o.state||!o.state[t])return;let r=Ae(o.state);o.state[n]=o.state[t],delete o.state[t],bi(P([],"state",r,Ae(o.state))),p({key:"state",op:"doc-meta"})}function ju(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.$props);if(!r.$props)r.$props={};if(o===void 0||o===null||o==="")delete r.$props[n];else r.$props[n]=o;if(Object.keys(r.$props).length===0)delete r.$props;bi(P(t,"$props",i,Ae(r.$props))),p({op:"replace",path:t})}function pL(e,t,n,o){let r=K(e.doc.document,t),i=Ae(r.cases);if(!r.cases)r.cases={};r.cases[n]=o||{tagName:"div",textContent:n},bi(P(t,"cases",i,Ae(r.cases))),p({op:"replace",path:t})}function fL(e,t,n){let o=K(e.doc.document,t);if(o.cases){let r=Ae(o.cases);delete o.cases[n],bi(P(t,"cases",r,Ae(o.cases))),p({op:"replace",path:t})}}function mL(e,t,n,o){let r=K(e.doc.document,t);if(!r.cases||!r.cases[n])return;let i=Ae(r.cases);r.cases[o]=r.cases[n],delete r.cases[n],bi(P(t,"cases",i,Ae(r.cases))),p({op:"replace",path:t})}function Rl(e,t,n){let o=e.doc.content.frontmatter,r=Object.hasOwn(o,t)?Ae(o[t]):void 0,i=n===void 0||n===null||n==="";if(i)delete o[t];else o[t]=n;let s=i?void 0:Ae(n);Fe({after:s,before:r,field:t}),e.doc.dirty=!0}function fe(e,t,n){if(n===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=n}var Ft={design:"canvas",edit:"canvas",entry:"entry","git-diff":"diff",grid:"grid",manage:"library",media:"media",preview:"canvas",settings:"config",source:"code",stylebook:"config"},Pu={canvas:"Canvas",code:"Code",config:"Project Styles",diff:"Diff",entry:"Entry",grid:"Grid",media:"Media",library:"Library",none:"None"};function sa(e){return Ft[e]??"canvas"}var Wt={design:"design",edit:"edit",preview:"preview"};function UT(e){return Wt[e]??"design"}var Gb=(e)=>e.editor.kind==="canvas",Sd=(e)=>Gb(e)&&e.selection.count>0,Kb=(e)=>Sd(e)&&!e.selection.isRoot;function dm(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1}}}function sx(e={}){let t=dm();for(let n of Object.keys(e)){let o=e[n];if(o)Object.assign(t[n],o)}return t}var Bt=["palette"],Vt=["caret","global"],Kt=["dock","global"],Ut=["canvas","global"],Gt=["grid","global"],Ht=["code","global"],Qe=["global"];function qT(e){if(e.modal.open)return Bt;if(e.caret.active)return Vt;if(e.focus.region!=="pane")return Kt;switch(e.editor.kind){case"grid":return Gt;case"code":return Ht;case"canvas":return e.canvas.view==="preview"?Qe:Ut;default:return Qe}}var ai="project.json";function qt(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var zt=["edit","design","preview","source","stylebook","git-diff"];function Yb({id:e,documentPath:t=null,fileHandle:n=null,document:o,frontmatter:r,sourceFormat:i=null,capabilities:s,openedFrom:a=null,preview:l=!1,layout:c=null}){let d=ge();wm(o);let m=s?.modes??Yt(t,i),y=m.find((I)=>I!=="preview")??"edit",b=m[0]==="preview";return d.run(()=>({capabilities:{modes:m},doc:v({content:{frontmatter:r||{}},dirty:!1,document:o,handlersSource:null,layout:c,mode:Xt(t,i),sourceFormat:i}),documentPath:t,fileHandle:n,history:v({index:0,snapshots:[{document:structuredClone(o),selection:[]}]}),id:e,pinned:!1,preview:l,scope:d,session:v({canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:a,selection:[],ui:qt(y,b)})}))}function Yt(e,t){if(e===ai)return["stylebook","source"];let n=yi(t)??Zt(e);if(n)return n.studio?.modes??["edit","design","preview","source"];return zt}function Xt(e,t){let n=yi(t)??Zt(e);if(n)return n.studio?.documentMode?.default??"content";return"component"}function vC(e){return sa(e.session.ui.canvasMode)}function ZT(e){let t=[];for(let n of e.capabilities.modes){if(n==="preview")continue;let o=sa(n);if(!t.includes(o))t.push(o)}return t}function XT(e,t){return e.capabilities.modes.find((n)=>n!=="preview"&&sa(n)===t)}function rp(e){e.scope.stop()}var et=new WeakMap,E=new Map;function on(e){let t=re(e),n=et.get(t);if(!n)n=v({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),et.set(t,n);return n}function tt(e){E.set(e,(E.get(e)??0)+1)}function nt(e){let t=E.get(e)??0;if(t<=1)E.delete(e);else E.set(e,t-1)}function gL(e){return E.has(e.replaceAll("\\","/"))}var Qt=8000,en=800,tn=2500,rt=null;function nn(){return rt??=(me("5aghyrfh"),import("./index-5aghyrfh.js")),rt}function st(){try{return f()}catch{return null}}var N=null;function _L(e){N=e}var be=null;function CL(e){be=e}var at=()=>{};function SL(e){at=e??(()=>{})}var ye=new WeakMap;function lt(e){return re(e)}function R(e){return ye.get(lt(e))}function ve(e){let t=lt(e),n=ye.get(t);if(!n)n={attaching:null,generation:0,optedOut:v({value:!1}),session:null,watcherInstalled:!1},ye.set(t,n);return n}var it=!1;function rn(){if(it)return;it=!0,Ke(sn),ze(an),He((e)=>{if(R(e)?.session?.synced&&on(e).sourceCanonical)return at("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function sn(e,t,n){let o=R(e)?.session;if(!o||!o.synced)return;if(o.lastSeenRef=re(e.doc.document),n==="remote"){Q(o);return}if(o.canWrite)ln(o,t),Q(o)}function an(e){let t=R(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:n,batchNeedsDiff:o}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),o)z(t);else if(n.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,n,t.collab.LOCAL_ORIGIN)}catch{z(t)}t.undoManager?.stopCapturing()}function ln(e,t){let n=t.docOps.map((o)=>o.forward);if(cx()){if(e.batchOps??=[],n.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...n);return}if(n.length===0){z(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,n,e.collab.LOCAL_ORIGIN)}catch{z(e)}}function z(e){let{collab:t,handle:n,tab:o}=e,r=t.yDocToJson(n.doc),i=Ao(re(o.doc.document)),s=t.diffDocs(r,i);if(s===null)t.replaceYStructure(n.doc,i,t.LOCAL_ORIGIN);else if(s.length>0)try{t.applyDocOpsToY(n.doc,s,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(n.doc,i,t.LOCAL_ORIGIN)}}function pe(e){let t=e.collab.yDocToJson(e.handle.doc);q(e.tab,(n)=>{let o=n.doc.document;for(let r of Object.keys(o))if(!(r in t))delete o[r];Object.assign(o,t)},{origin:"remote",skipHistory:!0})}function cn(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,n=t.clientID;for(let[o,r]of t.getStates())if(r.canWrite!==!1&&o<n)n=o;return n===e.handle.awareness.clientID}function Q(e){if(!N||!cn(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=tn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,he(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),he(e)},en)}async function he(e){if(!N||!e.synced)return;try{let t=await N(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function ct(e){if(!be||!e.synced||!e.canWrite)return;let{collab:t,handle:n,tab:o}=e,r=t.canonicalRevOf(n.doc),i=t.sourceText(n.doc).toString(),s;try{s=await be(o,i)}catch{return}if(!e.synced||t.canonicalRevOf(n.doc)!==r)return;let a=t.diffDocs(t.yDocToJson(n.doc),s.document);if(a===null)t.replaceYStructure(n.doc,s.document,t.MIRROR_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(n.doc,a,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(n.doc,s.document,t.MIRROR_ORIGIN)}let l=t.frontmatterMap(n.doc),c=s.frontmatter??{};n.doc.transact(()=>{let d=[...l.keys()];for(let m of d)if(!(m in c))l.delete(m);for(let[m,y]of Object.entries(c))if(!t.deepEqual(l.get(m),y))l.set(m,y)},t.MIRROR_ORIGIN)}function kL(e){let t=R(e)?.session;if(!t?.synced)return null;let{collab:n,handle:o}=t,r=null,i=()=>r!==null&&t.sourceLockOwner===r;return{awareness:o.awareness,enter:async()=>{r={},t.sourceLockOwner=r;let s=o.awareness.getLocalState();if(s)o.awareness.setLocalState({...s,mode:"source"});if(!t.canWrite)return;let a=null;if(N)try{a=await N(e)}catch{a=null}if(!i())return;n.acquireSourceCanonical(o.doc,a??n.sourceText(o.doc).toString(),n.LOCAL_ORIGIN)},leave:()=>{if(!i()){r=null;return}r=null,t.sourceLockOwner=null;let s=o.awareness.getLocalState();if(s)o.awareness.setLocalState({...s,mode:"structure"});if(!t.canWrite)return;if(n.otherSourceEditors(o.awareness,t.path,o.awareness.clientID).filter((l)=>o.awareness.getStates().get(l)?.canWrite!==!1).length===0)ct(t).then(()=>{n.releaseSourceCanonical(o.doc,n.LOCAL_ORIGIN)})},localOrigin:n.LOCAL_ORIGIN,readOnly:!t.canWrite,text:n.sourceText(o.doc)}}function fm(e){let t=on(e);return t.active&&t.readOnly}async function _C(e){let t=R(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await he(t),await t.handle.flush(),!0}async function CC(){for(let e of xe)if(R(e)?.session?.synced)await _C(e)}var xe=new Set;function Y(e){if(!st()?.collab||!e.documentPath||e.documentPath===ai)return;let n=ve(e);if(n.watcherInstalled)return;n.watcherInstalled=!0,rn(),xe.add(e),e.scope.run(()=>{ee(()=>{if(n.optedOut.value)te(e);else Pe(e)}),Ka(()=>{xe.delete(e),te(e)})})}function SC(e,t){let n=ve(e);if(n.optedOut.value===!t)return;if(n.optedOut.value=!t,!n.watcherInstalled&&t)Y(e)}function kC(e){return R(e)?.optedOut.value!==!0}function ut(e){if(!R(e)?.watcherInstalled){Y(e);return}te(e),Pe(e)}async function Pe(e){let t=ve(e);if(t.session||t.attaching)return;let{documentPath:n}=e,o=st();if(!n||!o?.collab){on(e).status="unavailable";return}let{generation:r}=t,i=on(e);i.status="connecting",i.attachError="";let s=(async()=>{try{let[a,l]=await Promise.all([nn(),o.collab(n)]);if(!l){i.status="detached";return}if(t.generation!==r){l.destroy();return}let c=null,d=new Promise((m,y)=>{c=setTimeout(()=>y(Error("collab-sync-timeout")),Qt)});try{await Promise.race([l.whenSynced,d])}finally{if(c)clearTimeout(c)}if(t.generation!==r){l.destroy();return}t.session=dn(e,n,a,l),i.active=!0,i.status="synced",i.readOnly=!t.session.canWrite,i.attachError="",tt(n)}catch(a){i.status="failed",i.active=!1,i.attachError=a instanceof Error?a.message:String(a),S.warn(`Live collaboration is not available for "${n}" — ${i.attachError}`,{key:`collab:${n}`,path:n,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=s,await s}function te(e){let t=R(e);if(!t)return;t.generation+=1;let{session:n}=t;t.session=null;let o=on(e);if(o.active=!1,o.status="detached",o.attachError="",o.peers=[],!n)return;if(nt(n.path),n.mirrorTimer)clearTimeout(n.mirrorTimer);if(n.sourceParseTimer)clearTimeout(n.sourceParseTimer);for(let r of n.disposers)try{r()}catch{}hm(e,null),e.history.snapshots=[{document:Ao(re(e.doc.document)),selection:us(e.session.selection)}],e.history.index=0,n.undoManager?.destroy(),n.handle.destroy()}function dn(e,t,n,o){let r=o.identity(),i={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:r?r.permission!=="read":!0,collab:n,disposers:[],handle:o,lastSeenRef:re(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(n.metaMap(o.doc).get("structureSeeded")===!0){let h=n.yDocToJson(o.doc),x=Ao(re(e.doc.document));if(!n.deepEqual(h,x)){let w=n.diffDocs(x,h);if(w===null)i.synced=!0,pe(i),i.synced=!1;else if(w.length>0)ue(e,w)}i.applyingRemoteFrontmatter=!0;let T=n.frontmatterMap(o.doc);for(let[w,J]of T.entries())e.doc.content.frontmatter[w]=J;i.applyingRemoteFrontmatter=!1}else if(i.canWrite)n.seedStructure(o.doc,Ao(re(e.doc.document)),{frontmatter:Ao(re(e.doc.content.frontmatter)),origin:n.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});i.lastSeenRef=re(e.doc.document),i.disposers.push(o.onDirty((h)=>{e.doc.dirty=h})),o.awareness.setLocalState({canWrite:i.canWrite,focusedPath:t,structuralSelection:null,user:r?{avatarUrl:r.avatarUrl,color:r.color,login:r.login,name:r.name}:{color:n.colorForKey(String(o.awareness.clientID)),login:`guest-${o.awareness.clientID%1000}`}});let a=new n.UndoManager([n.structureMap(o.doc),n.frontmatterMap(o.doc)],{trackedOrigins:new Set([n.LOCAL_ORIGIN])});i.undoManager=a;let l=({stackItem:h})=>{h.meta.set("selection",us(e.session.selection))},c=({stackItem:h})=>{let x=h.meta.get("selection");e.session.selection=us(x??[])};a.on("stack-item-added",l),a.on("stack-item-popped",c),i.disposers.push(()=>{a.off("stack-item-added",l),a.off("stack-item-popped",c)}),hm(e,{canRedo:()=>a.canRedo(),canUndo:()=>a.canUndo(),redo:()=>{a.redo()},undo:()=>{a.undo()}});let d=n.structureMap(o.doc),m=(h,x)=>{if(x.origin===n.LOCAL_ORIGIN||!i.synced)return;let T=n.yEventsToDocOps(h);if(T===null){pe(i);return}if(T.length===0)return;try{ue(e,T)}catch{pe(i)}};d.observeDeep(m),i.disposers.push(()=>d.unobserveDeep(m));let y=on(e);y.sourceCanonical=n.canonicalOf(o.doc)==="source";let b=n.metaMap(o.doc),_=()=>{y.sourceCanonical=n.canonicalOf(o.doc)==="source"};b.observe(_),i.disposers.push(()=>b.unobserve(_));let I=n.sourceText(o.doc),Se=(h,x)=>{if(x.origin===n.MIRROR_ORIGIN||!i.synced)return;if(n.canonicalOf(o.doc)!=="source")return;if(!n.isSourceReconciler(o.awareness,i.path))return;if(i.sourceParseTimer)clearTimeout(i.sourceParseTimer);i.sourceParseTimer=setTimeout(()=>{i.sourceParseTimer=null,ct(i)},600)};I.observe(Se),i.disposers.push(()=>I.unobserve(Se));let k=n.frontmatterMap(o.doc),Ce=(h,x)=>{if(x.origin===n.LOCAL_ORIGIN||!i.synced)return;i.applyingRemoteFrontmatter=!0;try{for(let[T,w]of h.changes.keys)if(w.action==="delete")delete e.doc.content.frontmatter[T];else e.doc.content.frontmatter[T]=k.get(T)}finally{i.applyingRemoteFrontmatter=!1}};k.observe(Ce),i.disposers.push(()=>k.unobserve(Ce)),e.scope.run(()=>{let h=JSON.stringify(e.doc.content.frontmatter);ee(()=>{let x=JSON.stringify(e.doc.content.frontmatter);if(x===h)return;if(h=x,i.applyingRemoteFrontmatter||!i.synced||!i.canWrite)return;let T=JSON.parse(x);o.doc.transact(()=>{let w=[...k.keys()];for(let J of w)if(!(J in T))k.delete(J);for(let[J,Re]of Object.entries(T))if(!n.deepEqual(k.get(J),Re))k.set(J,Re)},n.LOCAL_ORIGIN),Q(i)}),ee(()=>{let x=e.session.selection.length>0?us(e.session.selection):null,T=o.awareness.getLocalState();if(T)o.awareness.setLocalState({...T,structuralSelection:x})}),ee(()=>{let x=re(e.doc.document);queueMicrotask(()=>{if(R(e)?.session!==i||!i.synced||!i.canWrite)return;let w=re(e.doc.document);if(w!==x||w===i.lastSeenRef)return;i.lastSeenRef=w,z(i),Q(i)})})});let oe=on(e),ie=()=>{let h=[];for(let[x,T]of o.awareness.getStates())if(x!==o.awareness.clientID&&T.user)h.push({clientId:x,state:T});oe.peers=h};return ie(),o.awareness.on("change",ie),i.disposers.push(()=>o.awareness.off("change",ie),o.onStatus((h)=>{if(h==="offline"||h==="connecting")oe.status="offline";else if(i.synced)oe.status="synced"}),o.onReset(()=>{te(e),Pe(e)})),i.synced=!0,i}function C(e,t,n){return RangeError(`command "${e}" argument "${t}": ${n}`)}function O(e){if(e===void 0)return"missing";return typeof e==="string"?`"${e}"`:`${typeof e} ${JSON.stringify(e)}`}function ot(e,t,n){let o=t[n];if(typeof o!=="string"||o==="")throw C(e,n,`expected a non-empty string, got ${O(o)}`);return o}function Yo(e,t,n){if(t[n]===void 0)return;return ot(e,t,n)}function ft(e,t,n){let o=t[n];if(typeof o!=="number"||!Number.isFinite(o))throw C(e,n,`expected a finite number, got ${O(o)}`);return o}function dt(e,t,n){let o=t[n];if(typeof o!=="number"||!Number.isInteger(o))throw C(e,n,`expected an integer, got ${O(o)}`);return o}function sv(e,t,n,o,r){let i=ft(e,t,n);if(i<o||i>r)throw C(e,n,`${i} is outside the supported range ${o}–${r}`);return i}function vi(e,t,n){let o=t[n];if(typeof o!=="boolean")throw C(e,n,`expected a boolean, got ${O(o)}`);return o}function li(e,t,n,o){let r=t[n];if(typeof r!=="string"||!o.includes(r))throw C(e,n,`${O(r)} is not declared — declared: ${o.join(", ")||"none"}`);return r}function ux(e,t,n){let o=t[n];if(!Array.isArray(o)||!o.every((r)=>typeof r==="string"||typeof r==="number"))throw C(e,n,`expected an array of path segments (strings or numbers), got ${O(o)}`);return o}function bL(e,t,n){if(t[n]===null)return null;return ux(e,t,n)}function wC(e,t,n){let o=t[n];if(!Array.isArray(o))throw C(e,n,`expected an array of document paths, got ${O(o)}`);return o.map((r,i)=>{if(!Array.isArray(r)||!r.every((s)=>typeof s==="string"||typeof s==="number"))throw C(e,n,`entry ${i} is not a document path — expected an array of segments, got ${O(r)}`);return r})}function ke(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function Do(e,t){return{description:t,enum:[...e],type:"string"}}function la(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function xC(e,t={}){return{description:e,type:"number",...t}}function oo(e){return{description:e,type:"boolean"}}function av(e,t=!1){let n={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[n,{type:"null"}]}:{description:e,...n}}function vL(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function je(e){return{description:e,type:"string"}}function fn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Oe(e){return Array.isArray(e)?e:[e]}function pt(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let n=t.items?.type;if(Array.isArray(n))return fn(n)?"path":"pass-through";return n==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function mt(e,t){switch(e){case"null":return t===null;case"boolean":return typeof t==="boolean";case"string":return typeof t==="string";case"number":return typeof t==="number"&&Number.isFinite(t);case"integer":return typeof t==="number"&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return typeof t==="object"&&t!==null&&!Array.isArray(t);default:break}return!1}function gt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function pn(e,t,n,o){let r=t[n];if(!o.some((i)=>mt(i,r)))throw C(e,n,`expected ${gt(o)}, got ${O(r)}`);return r}function bt(e){switch(pt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>O(t)).join(" | ")}`;case"const":return`the constant ${O(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>bt(t)).join(" or ");case"typed":return gt(Oe(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function mn(e,t,n,o){let r=t[n],i=[];for(let s of o){if(s.type!==void 0&&!Oe(s.type).some((a)=>mt(a,r)))continue;try{return yt(e,t,n,s)}catch(a){i.push(a)}}if(i.length===1)throw i[0];throw C(e,n,`expected ${o.map((s)=>bt(s)).join(" or ")}, got ${O(r)}`)}function yt(e,t,n,o){switch(pt(o)){case"enum":return li(e,t,n,o.enum??[]);case"const":{let r=t[n];if(r!==o.const)throw C(e,n,`expected the constant ${O(o.const)}, got ${O(r)}`);return r}case"one-of":return mn(e,t,n,o.oneOf??[]);case"typed":return pn(e,t,n,Oe(o.type??[]));case"boolean":return vi(e,t,n);case"bounded-number":{if(o.type==="integer")dt(e,t,n);return sv(e,t,n,o.minimum,o.maximum)}case"number":return ft(e,t,n);case"integer":return dt(e,t,n);case"string":return ot(e,t,n);case"path":return ux(e,t,n);case"path-list":return wC(e,t,n);default:return t[n]}}function yL(e,t,n){let o=t,r=o.properties??{},i=Object.keys(r),s=o.required??[],a={};for(let[l,c]of Object.entries(n)){if(c===void 0||Object.hasOwn(r,l))continue;if(o.additionalProperties===!1)throw C(e,l,`not declared — declared: ${i.join(", ")||"none"}`);a[l]=c}for(let l of i){if(n[l]===void 0&&!s.includes(l))continue;a[l]=yt(e,n,l,r[l])}return a}var gn=20,An="primary",cp="secondary",EC=2,g=v({activePaneId:An,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:An,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Ms();return e.derived?.kind==="lens"?Bn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Ms().tabOrder}}),u=Od(()=>g.activeTabId?g.tabs.get(g.activeTabId)??null:null);function Ms(){let{panes:e}=g;return e.find((t)=>t.id===g.activePaneId)??e[0]}function Bn(e){return g.panes.find((t)=>t.id===e)}function Bu(e){return g.panes.find((t)=>t.tabOrder.includes(e))}function Tr(e){let t=Bn(e);if(!t||t.id===g.activePaneId)return;g.activePaneId=t.id,A();let{activeTabId:n}=t;if(n){we(n);let o=g.tabs.get(n);if(o)Tt(o)}}function dp(e){return g.activePaneId===e}function mx(e){let t=e??Ms().activeTabId,n=t?g.tabs.get(t):null;if(!t||!n)return null;let o=Bu(t);if(!o)return null;let r=Dl(o.id);return pp(t),zu(r,t),r.activeTabId=t,g.activePaneId=r.id,A(),we(t),r}function gx(e){return g.panes.find((t)=>t.id!==e)??bn(cp)}function Dl(e){let t=gx(e);if(t.derived)t.derived=null;return t}function bn(e){let t=Bn(e);if(t)return t;return g.panes=[...g.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],Bn(e)}function up(e){if(g.panes.length<2)return;let t=e===An?g.panes.find((r)=>r.id!==An)?.id:e,n=t===void 0?void 0:Bn(t),o=g.panes.find((r)=>r.id!==t);if(!n||!o)return;for(let r of n.tabOrder)zu(o,r);if(o.activeTabId=g.activePaneId===n.id?n.activeTabId??o.activeTabId:o.activeTabId??n.activeTabId,g.activePaneId=o.id,o.derived?.sourcePaneId===n.id)o.derived=null;g.panes=g.panes.filter((r)=>r.id!==n.id),A()}function hp(e){return e.tabOrder.length===0&&e.derived===null}function pp(e){let t=[];for(let n of g.panes){if(!n.tabOrder.includes(e))continue;if(n.tabOrder=n.tabOrder.filter((o)=>o!==e),n.activeTabId===e)n.activeTabId=n.tabOrder.at(-1)??null;if(n.id!==An&&hp(n))t.push(n.id)}for(let n of t)up(n)}function zu(e,t,n){if(e.tabOrder.includes(t))return;let o=n??hn(e,t);e.tabOrder=[...e.tabOrder.slice(0,o),t,...e.tabOrder.slice(o)]}function yn(e){let t=0;for(let n of e.tabOrder){if(g.tabs.get(n)?.pinned!==!0)break;t+=1}return t}function hn(e,t){return g.tabs.get(t)?.pinned===!0?yn(e):e.tabOrder.length}function Ha(e,t=null){if(g.projectRoot&&e!==g.projectRoot)lx();g.projectRoot=e,g.projectConfig=t}function fp(e){let t=u.value;return e!==null&&t!==null&&re(t)===re(e)}function wc(e){if(!e)return!1;let t=g.tabs.get(e.id);return t!==void 0&&re(t)===re(e)}function we(e){g.mruOrder=[e,...g.mruOrder.filter((t)=>t!==e)]}var ne=null,Z=0;function A(){ne=null,Z=0}function Tt(e){if(D&&e.documentPath)D.selectedPath=e.documentPath}function X(e,t={}){let n=g.tabs.get(e),o=Bu(e);if(!n||!o)return;if(o.activeTabId=e,t.focus===!1)return;if(g.activePaneId=o.id,!t.cycling)A(),we(e);Tt(n)}function No(e){let t=g.tabs.get(e.id),n=e.preview===!0&&t?.pinned!==!0,o=Yb({...e,preview:n}),r=(e.paneId===void 0?void 0:Bn(e.paneId))??Ms(),i;if(t)o.pinned=t.pinned,rp(t);else{if(n){let a=xt(r),l=a?g.tabs.get(a):null;if(l)mp(l);bx()}let s=n?xt(r):null;if(s)i=r.tabOrder.indexOf(s),vx(s);zu(r,o.id,i)}return g.tabs.set(o.id,o),X(o.id,{focus:e.focus!==!1}),Y(o),o}function xt(e){return e.tabOrder.find((t)=>g.tabs.get(t)?.preview===!0)??null}function Al(e){let t=g.tabs.get(e);if(t?.preview===!0)t.preview=!1}function bx(){for(let[e,t]of g.tabs)if(t.preview&&t.doc.dirty)Al(e)}function uv(e,t){let n=g.tabs.get(e),o=Bu(e);if(!n||!o)return;if(n.pinned=t,t)n.preview=!1;let r=o.tabOrder.filter((s)=>s!==e),i=r.filter((s)=>g.tabs.get(s)?.pinned===!0).length;o.tabOrder=[...r.slice(0,i),e,...r.slice(i)]}function TC(e,t){let n=g.tabs.get(e),o=Bu(e);if(!n||!o)return;o.tabOrder=Pt(o,e,t)}function Pt(e,t,n){let o=g.tabs.get(t);if(!o)return e.tabOrder;let r=e.tabOrder.filter((c)=>c!==t),i=r.filter((c)=>g.tabs.get(c)?.pinned===!0).length,s=o.pinned?0:i,a=o.pinned?i:r.length,l=Math.min(Math.max(n,s),a);return[...r.slice(0,l),t,...r.slice(l)]}function vx(e){let t=g.tabs.get(e);if(!t)return;let n=Bu(e),o=n?.activeTabId===e;if(xn(t),rp(t),g.tabs.delete(e),pp(e),g.mruOrder=g.mruOrder.filter((s)=>s!==e),A(),n&&hp(n))up(n.id);if(!o)return;let r=Ms(),i=g.mruOrder.find((s)=>r.tabOrder.includes(s))??r.tabOrder.at(-1)??null;if(i)X(i)}function LC(){let e=[...g.tabs.values()];g.tabs.clear(),Ot(),g.mruOrder=[],A();for(let t of e)rp(t)}function Ot(){g.panes=[{activeTabId:null,derived:null,id:An,tabOrder:[]}],g.activePaneId=An}function xn(e){if(!e.documentPath)return;let t=e.documentPath;g.closedTabs=[{documentPath:t},...g.closedTabs.filter((n)=>n.documentPath!==t)].slice(0,gn)}function vn(){let[e]=g.closedTabs;if(!e)return;return g.closedTabs=g.closedTabs.slice(1),e.documentPath}function vt(e){if(!ne)ne=g.mruOrder.filter((o)=>g.tabs.has(o)),Z=0;let t=ne;if(t.length<2)return;Z=((Z+e)%t.length+t.length)%t.length;let n=t[Z];return X(n,{cycling:!0}),n}function IC(e){let t=[...g.tabs.keys()],n=[...g.tabs.values()],o=Yb(e);g.tabs.set(o.id,o),Ot(),g.panes[0].tabOrder=[o.id],g.mruOrder=[],A(),X(o.id),Y(o);for(let r of t){if(r===o.id)continue;g.tabs.delete(r)}for(let r of n)rp(r);return o}function ci(e,t={}){X(e,t)}function mm(e,t,n){let o=Bn(t);if(!o||!g.tabs.has(e))return null;if(o.tabOrder.includes(e)){if(n!==void 0)o.tabOrder=Pt(o,e,n);return o}return pp(e),zu(o,e,n),o}function hv(e,t,n){let o=g.tabs.get(e);if(!o)return;o.id=t,o.documentPath=n,g.tabs.delete(e),g.tabs.set(t,o);for(let r of g.panes)if(r.tabOrder=r.tabOrder.map((i)=>i===e?t:i),r.activeTabId===e)r.activeTabId=t;g.mruOrder=g.mruOrder.map((r)=>r===e?t:r),A(),ut(o)}function RC(e,t){e.registerAll([...Tn(t),...Pn(t)])}function Tn(e){let t=()=>g.tabs.size>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(n)=>n.document.open,enablement:t,requires:"a second open document",run:()=>{vt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(n)=>n.document.open,enablement:t,requires:"a second open document",run:()=>{vt(-1)}},{args:ke({path:je('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(n)=>n.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:n,args:o})=>{let r=ot("document.open",o,"path"),i=u.value?.documentPath??null;if(i!==r)return`Opened "${r}", but the active document is ${i===null?"none":`"${i}"`}.`;let s=n.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Pu[n.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${r}" is the active document, ${s}.`}},run:async(n,o)=>{let r=ot("document.open",o,"path");if(await e.openFile(r),![...g.tabs.values()].some((i)=>i.documentPath===r))throw RangeError(`command "document.open" argument "path": "${r}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:ke({file:je('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(n)=>n.project.open,requires:"an open project",undo:"none",run:async(n,o)=>{let r=ot("document.openToSide",o,"file"),i=Dl(Ms().id);if(await e.openFile(r,{paneId:i.id}),![...g.tabs.values()].some((s)=>s.documentPath===r)){if(hp(i)&&i.id!==An)up(i.id);throw RangeError(`command "document.openToSide" argument "file": "${r}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>g.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let n=vn();if(n)await e.openFile(n)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(n)=>n.document.open,requires:"an open document",run:()=>{let n=g.activeTabId,o=n?g.tabs.get(n):null;if(n&&o)uv(n,!o.pinned)}},{args:ke({pinned:oo("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(n)=>n.document.open,requires:"an open document",run:(n,o)=>{let r=g.activeTabId;if(r&&g.tabs.get(r))uv(r,vi("document.setPinned",o,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(n)=>n.document.open,enablement:()=>{let n=g.activeTabId;return n!==null&&g.tabs.get(n)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let n=g.activeTabId;if(n)Al(n)}}]}function Pn(e){let t=()=>g.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(n)=>n.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{mx()}},{args:ke({path:je("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(n)=>n.document.open,enablement:()=>g.activeTabId!==null,requires:"an open document",undo:"none",run:async(n,o)=>{let r=ot("pane.compareWith",o,"path"),i=Ms();if((i.activeTabId?g.tabs.get(i.activeTabId):null)?.documentPath===r)throw RangeError(`command "pane.compareWith" argument "path": "${r}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(Dl(i.id).id,r)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{Tr(An)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{Tr(cp)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:On}]}function On(){let e=g.panes.find((t)=>t.derived!==null);if(e?.id===An){if(e.derived=null,!hp(e))return}up(e?.id??cp)}
|
|
2
|
-
export{rx,Ko,qb,WT,un,$o,Ou,VT,mC,Mu,Pu,sa,UT,Gb,Sd,Kb,dm,sx,qT,um,io,Gi,op,Jb,GT,gC,KT,JT,ax,YT,lx,bC,ai,Yb,vC,ZT,XT,rp,Te,QT,Zb,us,Xb,eL,Il,Qb,tL,sp,nL,bi,q,Ns,ev,tv,cx,iL,hm,oL,rL,dx,sL,Ki,Fu,yC,ap,nv,aL,aa,Ue,yc,Jo,lL,iv,cL,ov,dL,uL,Os,rv,fr,hL,ju,pL,fL,mL,Rl,on,gL,ot,Yo,sv,vi,li,ux,bL,wC,ke,Do,la,xC,oo,av,vL,je,yL,hx,lp,px,$l,lv,cv,fx,wL,ca,kd,Hu,pm,dv,xL,Ao,_L,CL,SL,kL,fm,_C,CC,SC,kC,An,cp,EC,g,u,Ms,Bn,Bu,Tr,dp,mx,gx,Dl,up,hp,pp,zu,Ha,fp,wc,No,Al,bx,uv,TC,vx,LC,IC,ci,mm,hv,RC};
|
|
3
|
-
|
|
4
|
-
//# debugId=36980CC89A5D8D0E64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-ks7cksh0.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{f,et}from"./studio-jsv3s3s1.js";import{VL,UL,yv,JC,qL,YC,GL,wv}from"./studio-sq1bn60g.js";import{$o,u}from"./studio-ks7cksh0.js";import{D}from"./studio-73czgk6a.js";function am(){let t=et()?f().canvasUrl:void 0;if(t)return new URL(t,location.href).origin;return location.origin}function ip(t){let e=am(),n=et()?f().documentBaseUrl:void 0;if(n){let o=n.endsWith("/")?n:`${n}/`;return new URL(o,`${e}/`).href}let r=t||"";return`${e}/${r?`${r}/`:""}`}function ox(t){if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http")||t.startsWith("views://"))return t;let e=am();if((e.startsWith("http:")||e.startsWith("https:"))&&e!==location.origin)return`${e}/${t.replace(/^\.?\//,"")}`;return t}var p=/^[\w.~-]+$/,m="content",d="{locale}";function Vb(t,e,n=[]){if(!t||!e)return null;let r=t.replaceAll("\\","/").replace(/^\.\//,""),o=null,c=(s,i)=>{if(r.startsWith(`${s}/`)&&(!o||s.length>o.dir.length))o={dir:s,urlPrefix:i}};for(let[s,i]of Object.entries(e)){if(!i?.source||!p.test(s))continue;let l=x(i.source);if(l===""||l.startsWith(".."))continue;if(l.includes(d)){let a=A(r,l,s,n);if(a)c(a.dir,a.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(l))continue;c(l,`/${m}/${s}`)}return o}function A(t,e,n,r){let o=e.indexOf(d),c=e.slice(0,o),s=e.slice(o+d.length);if(!t.startsWith(c))return null;let i=t.slice(c.length).split("/")[0]??"";if(i===""||!p.test(i))return null;let l=r.find((h)=>h.toLowerCase()===i.toLowerCase());if(l===void 0||!p.test(l))return null;return{dir:`${c}${i}${s}`.replace(/\/+$/,""),urlPrefix:`/${m}/${n}/${l}`}}function x(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ub(t,e){if(!e||t==="")return null;if(e.space==="repo"){if(!e.fileBaseUrl)return null;let r=GL(t,e.documentDir,e.mounts,e.lanes);if(r===null)return null;let{suffix:o}=yv(t);return`${e.fileBaseUrl}${wv(r)}${o}`}let[n]=e.mounts;return n?g(t,e.documentDir,n):null}function g(t,e,n){if(JC(t))return null;let{path:r,suffix:o}=yv(t),c;try{c=decodeURIComponent(r)}catch{return null}let s=YC(e,c);if(s===null)return null;let i=VL([n],s);if(!i)return null;return`${i}${o}`}function fC(){return $o(D?.projectConfig??{}).i18n?.locales??[]}function lm(t,e){let n=e?.space??"site",r=Vb(t,D?.projectConfig?.content,fC());if(n==="site"&&!r)return null;return{documentDir:qL(t??""),...e?.fileBaseUrl===void 0?{}:{fileBaseUrl:e.fileBaseUrl},lanes:UL,mounts:r?[r]:[],space:n}}function vc(t){if(!t)return t;let e=lm(u.value?.documentPath,cm());return ox(Ub(t,e)??t)}function cm(){return{fileBaseUrl:ip(D?.projectRoot),...et()?{space:f().assetSpace}:{}}}
|
|
2
|
-
export{Vb,Ub,am,ip,ox,fC,lm,vc,cm};
|
|
3
|
-
|
|
4
|
-
//# debugId=2E0A0FD212189BD964756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-nptx0dbs.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{K_,J_,Y_}from"./studio-xcng8nx7.js";import{f,et}from"./studio-jsv3s3s1.js";import{Sf,m_,g_}from"./studio-7z69g1gx.js";import{Ag,ta,bk,Rs,$a}from"./studio-pve0b2f2.js";import{me}from"./studio-7gqyhjns.js";var o="checking",c=null;function Dg(){return et()&&Boolean(f().cfConnect)}async function xf(){if(!Dg())return;c??=(async()=>{try{o=await f().cfConnection?.()??null}catch{o=null}c=null,Hh()})(),await c}function ck(){if(Dg()&&o==="checking"&&!c)xf()}function dk(){o="checking",c=null}async function s(){let n=await f().cfConnect?.();if(n?.status==="connected"&&!n.connection.accountId){let{openCfAccountPicker:e}=await (me("gnm7xeqb"),import("./cf-account-picker-gnm7xeqb.js"));await e()}Rs(),await xf()}function d(){let n={id:"disconnect",label:"Disconnect",run:async()=>{await f().cfDisconnect?.(),Rs(),await xf()},variant:"negative"},e=(i)=>({id:i==="Connect"?"connect":"reconnect",label:i,run:s,variant:"accent"}),t={id:"cloudflare",label:"Cloudflare",revoke:()=>{}};if(o==="checking")return{...t,actions:[],connected:!1,detail:"Checking your connection…"};if(!o?.connected)return{...t,actions:[e("Connect")],connected:!1,detail:"Not connected. Connecting publishes this site and runs the assistant on Workers AI."};let r=()=>{n.run()};if(o.needsReconnect)return{...t,actions:[e("Reconnect"),n],connected:!0,detail:"Connection expired. Reconnect to keep publishing and the assistant working.",revoke:r};if(o.needsAccount||!o.accountId)return{...t,actions:[{id:"choose-account",label:"Choose account",run:async()=>{let{openCfAccountPicker:i}=await (me("gnm7xeqb"),import("./cf-account-picker-gnm7xeqb.js"));if(await i())Rs(),await xf()},variant:"accent"},n],connected:!0,detail:"Connected, but no account is chosen yet — publishing and the assistant need one.",revoke:r};return{...t,actions:[n],connected:!0,detail:`Connected — ${o.accountName??o.accountId}.`,revoke:r}}function l(){let n=Sf(),e=m_();return{connected:Boolean(n),detail:n?`Connected${e?` — account ${e}`:""}.`:"Not connected. Publishing will ask when it needs it.",id:"cloudflare",label:"Cloudflare",revoke:g_}}function u_(){let n=K_(),e=$a(),t=ta();return[{id:"github",label:"GitHub",detail:n?J_()==="desktop"?"Signed in — the token is in this app's config folder, readable only by you.":"Signed in — a device-flow token is stored in this browser.":"Not signed in. Cloning and pushing will ask when they need it.",connected:Boolean(n),revoke:Y_},{id:"ai",label:"AI provider",detail:Ag()?`Key stored. Model ${e}${t?` via ${t}`:""}.`:"No key stored. The Assistant section is where one is entered.",connected:Ag(),revoke:bk},Dg()?d():l()]}function uk(n){let e=u_().find((t)=>t.id===n);if(!e)return!1;return e.revoke(),Hh(),!0}var a=new Set;function hk(n){return a.add(n),()=>{a.delete(n)}}function Hh(){for(let n of a)n()}
|
|
2
|
-
export{Dg,xf,ck,dk,u_,uk,hk,Hh};
|
|
3
|
-
|
|
4
|
-
//# debugId=C7C8501F7AC17EF864756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-pg0z7k98.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{f}from"./studio-jsv3s3s1.js";import{_t,Er,OT,Bb,zb,zr,PT,Au}from"./studio-jnb285we.js";function ic(){return Er(_t.aiOpenAiKey)}function pk(e){zr(_t.aiOpenAiKey,e||"")}function Ag(){return OT(_t.aiOpenAiKey)}function ta(){return Er(_t.aiBaseUrl)}function Ng(){return Er(_t.aiModel)}function fk(e){zr(_t.aiModel,e||"")}function mk(e){PT([[_t.aiOpenAiKey,e.apiKey],[_t.aiBaseUrl,e.baseUrl],[_t.aiModel,e.model]])}function gk(e){return!Bh(_t.aiOpenAiKey,e.apiKey,ic())||!Bh(_t.aiBaseUrl,e.baseUrl,ta())||!Bh(_t.aiModel,e.model,Ng())}function Bh(e,t,o){return zb(e,t)===zb(e,o)}function bk(){Au([_t.aiOpenAiKey,_t.aiBaseUrl,_t.aiModel])}function Py(){return{apiKey:ic(),baseUrl:ta()}}function b(e){return`${e.apiKey}\x00${e.baseUrl}`}var n=null,s="",c=!1,l=!1,g="",x,y="",A=null,m=new Set,w=600000,a=0,M=!1;function Rs(){n=null,s="",c=!1,l=!1,g="",x=void 0,y="",A=null,a=0}var U=new Set([_t.aiOpenAiKey.key,_t.aiBaseUrl.key,_t.cfToken.key,_t.cfAccountId.key]);Bb((e)=>{if(e.some((t)=>U.has(t)))Rs()});function h_(e){return n&&s===b(e)?n:null}function h(e){return n?.find((t)=>t.id===e)}function p_(e){return h(e)?.toolSupport}function vk(e){return h(e)?.contextWindow}function Og(e){if(e)m.add(e);A??=pu({force:!0}).catch(()=>{}).then(()=>{a=Date.now();for(let t of m)t()})}function C(){if(!l||a===0||Date.now()-a<w)return!1;return A=null,a=0,Og(),!0}function O(){if(typeof window>"u"||M)return;M=!0,window.addEventListener("focus",()=>{C()})}O();function _f(){return Ag()||Fy()}function Fy(){return c}function yk(){return l}function Cf(){return x}function wk(){return y}function E(){return g}function $a(){return Ng()||E()||_t.aiModel.default}function R(e,t){let o;try{o=new URL(e,"http://jx.invalid")}catch{return e}return o.pathname=o.pathname.replace(/[^/]*$/,t),/^https?:/i.test(e)?o.href:`${o.pathname}${o.search}`}async function pu(e={}){let t=e.credentials??Py(),o=b(t);if(n&&s===o&&!e.force)return n;let S=f(),K=await Promise.resolve(S.aiChatUrl()),P=R(K,"models"),d={};if(t.apiKey)d["X-Api-Key"]=t.apiKey;if(t.baseUrl)d["X-Api-Base-URL"]=t.baseUrl;let u=await fetch(P,{headers:d});if(!u.ok)throw Error(`HTTP ${u.status}`);let r=await u.json();return c=r.configured===!0,l=r.managed===!0,g=r.defaultModel??"",x=r.code,y=r.upstreamError!==void 0?r.upstreamMessage??"":"",n=(r.models||[]).map((i)=>{let p={id:i.id,name:i.name||i.id};if(typeof i.contextWindow==="number")p.contextWindow=i.contextWindow;if(typeof i.toolSupport==="boolean")p.toolSupport=i.toolSupport;return p}),s=o,n}
|
|
2
|
-
export{ic,pk,Ag,ta,Ng,fk,mk,gk,Bh,bk,Py,Rs,h_,p_,vk,Og,_f,Fy,yk,Cf,wk,$a,pu};
|
|
3
|
-
|
|
4
|
-
//# debugId=6CA8F41149310DCC64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-pve0b2f2.js.map
|