@jxsuite/studio 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-5wtzce5g.js → 2020-dg097k3e.js} +3 -3
- package/dist/chunks/adapter-tck81zft.js +4 -0
- package/dist/chunks/{add-new-flow-psym14sn.js → add-new-flow-a1w0bnm6.js} +3 -3
- package/dist/chunks/{cf-account-picker-haqazq5r.js → cf-account-picker-ce3kp3x1.js} +3 -3
- package/dist/chunks/cf-settings-7ye6x7g2.js +4 -0
- package/dist/chunks/color-4gj49xq6.js +4 -0
- package/dist/chunks/{color-area-6rbra5dy.js → color-area-vh9cew51.js} +2 -2
- package/dist/chunks/{color-field-gy56c94g.js → color-field-e78f16bs.js} +3 -3
- package/dist/chunks/{color-slider-sqqdyf6c.js → color-slider-fg4yhvk6.js} +2 -2
- package/dist/chunks/{combobox-72h32ejk.js → combobox-6hs00996.js} +2 -2
- package/dist/chunks/components-qce0v93f.js +4 -0
- package/dist/chunks/content-source-jjx8kgzr.js +4 -0
- package/dist/chunks/{convert-to-repeater-he70fc2b.js → convert-to-repeater-grnmea6c.js} +3 -3
- package/dist/chunks/editor-bkja5dbv.js +4 -0
- package/dist/chunks/entry-commands-1wh0btvg.js +4 -0
- package/dist/chunks/{extension-sections-0egb88dm.js → extension-sections-rp7fkega.js} +3 -3
- package/dist/chunks/file-ops-6pe4z7an.js +4 -0
- package/dist/chunks/files-ybpp3j38.js +4 -0
- package/dist/chunks/format-host-3mtbhxk1.js +4 -0
- package/dist/chunks/fs-events-xfanfxds.js +4 -0
- package/dist/chunks/grid-open-dg5qmnaj.js +4 -0
- package/dist/chunks/{grid-view-qg1b5eqx.js → grid-view-x26rfpz1.js} +16 -15
- package/dist/chunks/{icons-63bjtbs7.js → icons-853n6qt3.js} +2 -2
- package/dist/chunks/{iframe-entry-2zggzajv.js → iframe-entry-02wzcyvy.js} +4 -4
- package/dist/chunks/{iframe-entry-99nr5zfb.js → iframe-entry-42hpmwz5.js} +4 -4
- package/dist/chunks/{iframe-entry-76j8vwwx.js → iframe-entry-b5qgggyp.js} +2 -2
- package/dist/chunks/iframe-host-j2bk2xkc.js +4 -0
- package/dist/chunks/{index-32eqzv1k.js → index-203h71wy.js} +3 -3
- package/dist/chunks/index-fkrm7pdk.js +4 -0
- package/dist/chunks/{javascript-pjp734q4.js → javascript-ww5pv5ae.js} +2 -2
- package/dist/chunks/{jsonMode-njkvsa02.js → jsonMode-vwbdwwq3.js} +6 -6
- package/dist/chunks/jx-validate-w7v32f6a.js +4 -0
- package/dist/chunks/layers-g7j732cm.js +4 -0
- package/dist/chunks/layers-panel-gjrsxcck.js +4 -0
- package/dist/chunks/{listbox-c421cf8c.js → listbox-7gka1h86.js} +2 -2
- package/dist/chunks/lit-html-jdfz9rhc.js +4 -0
- package/dist/chunks/media-library-9j0v4wmk.js +4 -0
- package/dist/chunks/media-picker-cpyyt2m0.js +4 -0
- package/dist/chunks/{menu-bdpzbfvs.js → menu-d2jxpgma.js} +2 -2
- package/dist/chunks/{monaco-binding-vq1hgnn0.js → monaco-binding-63tqze27.js} +3 -3
- package/dist/chunks/monaco-buffer-9wcme176.js +4 -0
- package/dist/chunks/{monaco-setup-xrd2cbkp.js → monaco-setup-zyyynnj8.js} +3 -3
- package/dist/chunks/notify-rahnnnv4.js +4 -0
- package/dist/chunks/platform-b2aqv7v5.js +4 -0
- package/dist/chunks/{popover-b89sfej7.js → popover-9tf4cjrk.js} +2 -2
- package/dist/chunks/publish-panel-4yk2461b.js +4 -0
- package/dist/chunks/{publish-quick-qx2455cj.js → publish-quick-ajzdhhs6.js} +3 -3
- package/dist/chunks/publish-workspace-mxestzcf.js +4 -0
- package/dist/chunks/quick-search-9g6z65b0.js +4 -0
- package/dist/chunks/references-c26enpxs.js +4 -0
- package/dist/chunks/right-panel-9d0e0yg7.js +4 -0
- package/dist/chunks/source-control-xyn3a8ds.js +4 -0
- package/dist/chunks/{split-c9zfdgxf.js → split-m5rwn31z.js} +2 -2
- package/dist/chunks/{studio-x9hsze61.js → studio-02phtmqn.js} +4 -4
- package/dist/chunks/{studio-4hp8pkyt.js → studio-0khd0xdw.js} +4 -4
- package/dist/chunks/studio-1fvzq9vs.js +5 -0
- package/dist/chunks/studio-1gdfsr49.js +12 -0
- package/dist/chunks/{studio-3q40e3rj.js → studio-1meqbxns.js} +4 -4
- package/dist/chunks/{studio-q0tccd43.js → studio-1yhz0s8p.js} +4 -4
- package/dist/chunks/studio-25a5by3h.js +5 -0
- package/dist/chunks/{studio-k3xxbagr.js → studio-2b8443ms.js} +3 -3
- package/dist/chunks/{studio-3qqjeep5.js → studio-2c2mjyzj.js} +5 -5
- package/dist/chunks/studio-2dtc90zs.js +10 -0
- package/dist/chunks/{studio-9tmebf0s.js → studio-332hesdk.js} +4 -4
- package/dist/chunks/{studio-03ct6yfv.js → studio-3pndhat0.js} +8 -8
- package/dist/chunks/{studio-s32578pn.js → studio-3q6n9qvq.js} +4 -4
- package/dist/chunks/studio-4dsdnan2.js +9 -0
- package/dist/chunks/{studio-ed1hp6zf.js → studio-4fjqdzrb.js} +5 -5
- package/dist/chunks/{studio-jcnsdaep.js → studio-533py3yy.js} +4 -4
- package/dist/chunks/studio-5abge3wy.js +5 -0
- package/dist/chunks/{studio-8tr6cfrc.js → studio-6vrxzkba.js} +4 -4
- package/dist/chunks/{studio-jaaz8ce9.js → studio-73wz63nn.js} +4 -4
- package/dist/chunks/{studio-bavb31r0.js → studio-74nzv280.js} +4 -4
- package/dist/chunks/{studio-q7rtx6zq.js → studio-7cg75gtj.js} +7 -7
- package/dist/chunks/studio-89cwmnae.js +5 -0
- package/dist/chunks/studio-8m1t83kn.js +7 -0
- package/dist/chunks/{studio-q0mvbaq6.js → studio-8nyw10dp.js} +4 -4
- package/dist/chunks/{studio-83mk4bgg.js → studio-94ppxeqy.js} +8 -8
- package/dist/chunks/{studio-qmn1xc24.js → studio-957jg8g3.js} +4 -4
- package/dist/chunks/{studio-r5qy30vx.js → studio-9wyqyfqy.js} +4 -4
- package/dist/chunks/studio-a3evp7f6.js +6 -0
- package/dist/chunks/{studio-n0c5h6mf.js → studio-a6x058ew.js} +4 -4
- package/dist/chunks/studio-ana67wax.js +5 -0
- package/dist/chunks/studio-b4xhpcwy.js +4 -0
- package/dist/chunks/studio-bf0rgyf7.js +5 -0
- package/dist/chunks/{studio-x1x167jh.js → studio-bqgs90r8.js} +4 -4
- package/dist/chunks/{studio-qwdqwkj0.js → studio-c4rcaftm.js} +4 -4
- package/dist/chunks/{studio-mn0476ag.js → studio-c5dj3dzk.js} +4 -4
- package/dist/chunks/studio-cgjt1zce.js +5 -0
- package/dist/chunks/{studio-bbe4c90a.js → studio-cpdzrdgp.js} +4 -4
- package/dist/chunks/studio-cq87hree.js +5 -0
- package/dist/chunks/studio-d140sy8e.js +5 -0
- package/dist/chunks/{studio-jsgf2q5k.js → studio-dmn7gpba.js} +5 -5
- package/dist/chunks/studio-e8pzjjhf.js +5 -0
- package/dist/chunks/{studio-dgk4dqtx.js → studio-f8kz3krj.js} +5 -5
- package/dist/chunks/{studio-qgh13jtz.js → studio-fqs1a22a.js} +4 -4
- package/dist/chunks/{studio-syreb644.js → studio-fw3jp9m7.js} +4 -4
- package/dist/chunks/{studio-ed3xx40h.js → studio-g6ysm05p.js} +6 -6
- package/dist/chunks/studio-gmhd0j3f.js +5 -0
- package/dist/chunks/{studio-p4nrkvqr.js → studio-gqpty626.js} +4 -4
- package/dist/chunks/{studio-kt3pjkwd.js → studio-grp684wx.js} +4 -4
- package/dist/chunks/{studio-df0baea9.js → studio-h98520qr.js} +4 -4
- package/dist/chunks/{studio-8m0y2qe7.js → studio-hnx1h1pr.js} +4 -4
- package/dist/chunks/studio-hvxt8z79.js +5 -0
- package/dist/chunks/{studio-43sd2mam.js → studio-hw60n5dh.js} +3 -3
- package/dist/chunks/{studio-wbcjbhy1.js → studio-hxq1ebp0.js} +6 -6
- package/dist/chunks/{studio-wys23mxz.js → studio-j4e627w1.js} +4 -4
- package/dist/chunks/{studio-ccv2svc6.js → studio-j5jqvyn3.js} +4 -4
- package/dist/chunks/{studio-881z1xrx.js → studio-jqrg9xxg.js} +4 -4
- package/dist/chunks/{studio-b7y5mr30.js → studio-kdseew9m.js} +4 -4
- package/dist/chunks/studio-kt2j51sa.js +5 -0
- package/dist/chunks/{studio-d5grtb9e.js → studio-m4w6sygj.js} +9 -9
- package/dist/chunks/{studio-zz9qe3rw.js → studio-mmqr9awv.js} +37 -37
- package/dist/chunks/{studio-5g0rprdt.js → studio-nm9qev4p.js} +5 -5
- package/dist/chunks/{studio-tft6r105.js → studio-nsv7g1qn.js} +4 -4
- package/dist/chunks/{studio-3e54qh39.js → studio-p89w12s2.js} +5 -5
- package/dist/chunks/{studio-y3ahhdpx.js → studio-pbagym4j.js} +4 -4
- package/dist/chunks/{studio-w4rz9hdk.js → studio-pr23qhrw.js} +4 -4
- package/dist/chunks/{studio-6m380wp7.js → studio-r4ya3sb2.js} +4 -4
- package/dist/chunks/studio-rdnezzkd.js +6 -0
- package/dist/chunks/{studio-f14e1zdj.js → studio-rm9m3z60.js} +4 -4
- package/dist/chunks/studio-tpmnbgmt.js +5 -0
- package/dist/chunks/studio-ttxhq5yt.js +5 -0
- package/dist/chunks/{studio-nh6d342n.js → studio-txkx6586.js} +6 -6
- package/dist/chunks/{studio-a2bvaptz.js → studio-v0gsjav0.js} +4 -4
- package/dist/chunks/{studio-fbhxxc5f.js → studio-v2ek69cb.js} +4 -4
- package/dist/chunks/{studio-y0n7yxea.js → studio-wcakp5bt.js} +7 -7
- package/dist/chunks/{studio-k7evxqh4.js → studio-x3ge4rts.js} +4 -4
- package/dist/chunks/{studio-pbxa5fpc.js → studio-xddgbwhe.js} +3 -3
- package/dist/chunks/{studio-c05wdnt3.js → studio-y1x65h5r.js} +4 -4
- package/dist/chunks/{studio-rthyg42z.js → studio-z42kysg7.js} +169 -169
- package/dist/chunks/studio-zf188hnd.js +5 -0
- package/dist/chunks/{studio-tfkznv39.js → studio-zht0x0v3.js} +4 -4
- package/dist/chunks/{studio-svb7yyve.js → studio-zm7dnr9g.js} +4 -4
- package/dist/chunks/{tooltip-yypz28gq.js → tooltip-dj1pvgz7.js} +2 -2
- package/dist/chunks/{tree-9xa4hm7n.js → tree-j0ebwr5s.js} +2 -2
- package/dist/chunks/{tsMode-epyfz1hv.js → tsMode-vra2hh7y.js} +5 -5
- package/dist/chunks/workspace-3nt93k48.js +4 -0
- package/dist/chunks/workspace-home-zbgyqqws.js +4 -0
- package/dist/chunks/{ws-client-bv552sfx.js → ws-client-72x5n99j.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +75 -75
- package/dist/studio.js +80 -80
- package/package.json +11 -11
- package/src/browse/component-examples.ts +15 -224
- package/src/browse/library-preview.ts +6 -13
- package/src/browse/preview-root.ts +7 -4
- package/src/canvas/canvas-utils.ts +18 -4
- package/src/canvas/iframe-editable-root.ts +13 -4
- package/src/canvas/iframe-entry.ts +3 -1
- package/src/canvas/iframe-interaction.ts +11 -2
- package/src/canvas/iframe-render.ts +25 -3
- package/src/canvas/preview-placeholder.ts +120 -0
- package/src/editor/shortcuts.ts +3 -0
- package/src/panels/component-preview.ts +5 -0
- package/src/panels/pane-context.ts +43 -18
- package/src/panels/site-model.ts +7 -19
- package/src/panels/site-panel.ts +2 -25
- package/src/panels/stylebook-doc.ts +2 -53
- package/src/services/references.ts +0 -0
- package/src/style/stylebook-specimens.ts +11 -15
- package/src/surfaces/pane-context.json +286 -265
- package/src/surfaces/pane-context.ts +17 -8
- package/src/tabs/tab.ts +5 -6
- package/src/utils/geometry.ts +49 -2
- package/dist/chunks/adapter-5tphg7xe.js +0 -4
- package/dist/chunks/cf-settings-h2wrh6hq.js +0 -4
- package/dist/chunks/color-m7r1vk54.js +0 -4
- package/dist/chunks/components-r22xca09.js +0 -4
- package/dist/chunks/content-source-mmppmcyg.js +0 -4
- package/dist/chunks/editor-ccd9jwsa.js +0 -4
- package/dist/chunks/entry-commands-6qxz9e8p.js +0 -4
- package/dist/chunks/file-ops-qnab36ek.js +0 -4
- package/dist/chunks/files-rcn56qvm.js +0 -4
- package/dist/chunks/format-host-yxz0kjjs.js +0 -4
- package/dist/chunks/fs-events-d1qxq4z4.js +0 -4
- package/dist/chunks/grid-open-4z1g062t.js +0 -4
- package/dist/chunks/iframe-host-ssv7kyj0.js +0 -4
- package/dist/chunks/index-f0jn7nnp.js +0 -4
- package/dist/chunks/jx-validate-ttasrbh7.js +0 -4
- package/dist/chunks/layers-bgyr11tr.js +0 -4
- package/dist/chunks/layers-panel-7ez66zeq.js +0 -4
- package/dist/chunks/lit-html-v9gh687x.js +0 -4
- package/dist/chunks/media-library-sq468wts.js +0 -4
- package/dist/chunks/media-picker-shfe59pt.js +0 -4
- package/dist/chunks/monaco-buffer-3afgwvbp.js +0 -4
- package/dist/chunks/notify-kzrjr3fv.js +0 -4
- package/dist/chunks/platform-7v4rtd7m.js +0 -4
- package/dist/chunks/publish-panel-2z9gw8ee.js +0 -4
- package/dist/chunks/publish-workspace-wrc1dgwx.js +0 -4
- package/dist/chunks/quick-search-n0t0eqxb.js +0 -4
- package/dist/chunks/references-9547rg5s.js +0 -4
- package/dist/chunks/right-panel-wsgnr9pn.js +0 -4
- package/dist/chunks/source-control-kwktr9y6.js +0 -4
- package/dist/chunks/studio-07rcfje3.js +0 -5
- package/dist/chunks/studio-3exxhz5g.js +0 -5
- package/dist/chunks/studio-3qeh9t0h.js +0 -6
- package/dist/chunks/studio-58xg6j2q.js +0 -9
- package/dist/chunks/studio-80jyh1xh.js +0 -4
- package/dist/chunks/studio-8vcvfs7r.js +0 -6
- package/dist/chunks/studio-fyh0jc96.js +0 -5
- package/dist/chunks/studio-gcxk20n7.js +0 -5
- package/dist/chunks/studio-m8g16bgz.js +0 -5
- package/dist/chunks/studio-mx1smyq0.js +0 -5
- package/dist/chunks/studio-pgmvdv7z.js +0 -7
- package/dist/chunks/studio-ph84avkf.js +0 -5
- package/dist/chunks/studio-rj9eamf8.js +0 -5
- package/dist/chunks/studio-rptgsk96.js +0 -5
- package/dist/chunks/studio-s19tp1xr.js +0 -5
- package/dist/chunks/studio-tf9jryb1.js +0 -10
- package/dist/chunks/studio-txf2kysx.js +0 -5
- package/dist/chunks/studio-v8867ddv.js +0 -12
- package/dist/chunks/studio-vxq7fcvv.js +0 -5
- package/dist/chunks/studio-wc649wss.js +0 -5
- package/dist/chunks/studio-z97c48fk.js +0 -5
- package/dist/chunks/studio-zat62m0c.js +0 -5
- package/dist/chunks/studio-zcd2e7yz.js +0 -5
- package/dist/chunks/workspace-dz7nxfhv.js +0 -4
- package/dist/chunks/workspace-home-xsd7hkjw.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{ge,ta,ne,g,he,Th,C}from"./studio-43sd2mam.js";import{Qd}from"./studio-kt3pjkwd.js";import{p}from"./studio-w4rz9hdk.js";import{Wi,cn,ur}from"./studio-z97c48fk.js";import{iI,BC,Io,JO,Ux,oI,rI,XO,wv}from"./studio-8tr6cfrc.js";import{bv,Y$,At,hi,$r,nc,x}from"./studio-gcxk20n7.js";import{$e,oe,vv,yv,nI}from"./studio-p4nrkvqr.js";import{n,Z,Xe,S,v,Yo,Ni,rd,rf}from"./studio-vxq7fcvv.js";import{le}from"./studio-qgh13jtz.js";var be=g(new Set);function Nm(e){be.add(e)}function Cx(e){be.delete(e)}function CC(e){return be.has(e)}function rv(e,t){return{success:!0,data:e,summary:t}}function ho(e){return{success:!1,error:e}}function bo({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,execute:a}){let l={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:a};if(s!==void 0)l.interactive=s;return l}function kx(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function gh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var Kt=new AbortController().signal;function Ex(e={}){let t=e.session??gh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??kx(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Kt}}function rO(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function A$(){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)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,d]of Object.entries(o)){let b=a[c];if(!b)continue;let y=b.type;if(!y)continue;let h=Ke(d);if(y==="number"||y==="integer"){if(xe(d,"number"))continue;if(xe(d,"string")){if(!Number.isNaN(Number(d)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}s.push(`Argument "${c}" should be a number, got ${h}`);continue}if(y==="string"&&h!=="string")s.push(`Argument "${c}" should be a string, got ${h}`);else if(y==="boolean"&&h!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${h}`);else if(y==="array"&&h!=="array")s.push(`Argument "${c}" should be an array, got ${h}`);else if(y==="object"&&h!=="object")s.push(`Argument "${c}" should be an object, got ${h}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=Ex()){let i=e.get(t);if(!i)return ho(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return ho(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return ho(`Tool "${t}" execution error: ${ye(a)}`)}}}}function Ut(e){return JSON.parse(JSON.stringify(e))}function ye(e){return e.message}var Ht=["string","number","boolean","undefined"];function xe(e,t){return typeof e===t}function Gt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ke(e){if(Array.isArray(e))return"array";return Ht.find((t)=>xe(e,t))??"object"}function zt(e){if(!e)return{};let t=JSON.parse(e);if(!Gt(t)){let o=t===null?"null":Ke(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function sO(e,t,o){let r=!1,i;try{let s=zt(t.argumentsText);r=!0,i=await e.execute(t.name,s,o)}catch(s){i=ho(`Failed to parse arguments: ${ye(s)}`)}try{return{status:"done",result:Ut(i),executed:r}}catch(s){let a=ye(s);return{status:"done",result:ho(`Tool "${t.name}" returned a result that cannot be serialized: ${a}`),executed:r}}}var G=[],Yt=50;function aO(e){return Object.assign(kx(),{turnId:e})}function lO(e,t){if(t.length===0)return[];let o={id:e,writes:[...t]};G.push(o);while(G.length>Yt)G.shift();return o.writes}function kC(e){return G.find((t)=>t.id===e)?.writes??[]}function cO(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function EC(){G.splice(0)}function dO(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}var qt=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"]),xC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Fn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function vx(e){return Fn(e)!==null}function Qb(e){let t=Fn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&qt.has(r)?"rtl":"ltr"}function Vt(e){let t=Fn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var Zt="prefix-except-default";function Qt(e){let t=e.i18n,o=[];if(!S(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=Fn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=Fn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&Fn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Zt;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function Hi(e,t){let o=Te(z(e),t);if(o===-1||t===null)return null;return Fn(z(e)[o])}function yx(e,t){let o=Hi(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return z(e)[0]==="pages"?t.defaultLocale:null}function ev(e,t){let o=z(e),r=Te(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Xc(e,t,o){if(o===null)return null;let r=Fn(t);if(r===null||!o.locales.includes(r))return null;let i=z(e),s=Te(i,o),a=s===-1?Xt(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,d)=>d!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function z(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Te(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=Fn(o);return r!==null&&t.locales.includes(r)})}function Xt(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function nO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=Fn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function P$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((d)=>d!==""&&!en(d));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function en(e){let t=e.indexOf("="),o=t===-1?e:e.slice(0,t);if(o==="v")return!0;if(!o.includes("%"))return!1;try{return decodeURIComponent(o)==="v"}catch{return!1}}function tn(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function cv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!BC.test(a))continue;let c=on(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Io)){let d=nn(r,c,a,o);if(d)s(d.dir,d.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${iI}/${a}`)}return i}function nn(e,t,o,r){let i=t.indexOf(Io),s=t.slice(0,i),a=t.slice(i+Io.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!BC.test(l))return null;let c=r.find((b)=>b.toLowerCase()===l.toLowerCase());if(c===void 0||!BC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${iI}/${o}/${c}`}}function on(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function dv(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=XO(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=Ux(e);return P$(`${t.fileBaseUrl}${wv(r)}${i}`,tn(t.versions,r))}let[o]=t.mounts;return o?rn(e,t.documentDir,o):null}function rn(e,t,o){if(oI(e))return null;let{path:r,suffix:i}=Ux(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=rI(t,s);if(a===null)return null;let l=JO([o],a);if(!l)return null;return`${l}${i}`}function Ue(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function q(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function He(e){return e??x?.projectConfig??null}function Ge(e){return e?.content??{}}function sn(e){let t=Qt(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function ze(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Ye(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:ur()?.extensions[0]??".json",unresolvedFormat:null};let t=Wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function an(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>Ue(i)).join("|")})`,r=q(e).split(Io).map((i)=>Ue(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function un(e,t,o){let r=an(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function dn(e){return q(e).replaceAll(Io,"").length}function Jd(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=sn(o),i=q(e),s=null,a=-1;for(let[l,c]of Object.entries(Ge(o))){let{source:d}=c;if(d===void 0||d===""||ze(d))continue;let b=dn(d);if(b<=a)continue;let y=un(d,i,r);if(y===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===y.length,name:l,...Ye(c)},a=b}return s}function Un(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=q(e),i=r.toLowerCase();for(let[s,a]of Object.entries(Ge(o))){let{source:l}=a;if(l===void 0||l===""||!ze(l))continue;let c=q(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...Ye(a)}}return Jd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function ed(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Fx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function jx(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function RC(e,t){return e?.$label||ed(t)}function NO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return ed(t)}function Ra(e){return e==="image"||e==="uri-reference"}function vh(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(Ra(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 yh(e,t){if(!e||!t?.content)return null;let o=Un(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??ur()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function uv(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function Hx(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function AO(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((i)=>i[1])};return{kind:"text"}}function Jo(e){return JSON.parse(JSON.stringify(e))}function Me(e){return e?.at(-1)??null}function pO(e){return e?.[0]??null}function Tx(e,t){if(!t||!e)return!1;return e.some((o)=>$r(o,t))}function ea(e){return _(e)}function _(e){let t=[];for(let o of e)t.push([...o]);return t}function Lx(e,t){if(Tx(e,t))return _(e.filter((o)=>!$r(o,t)));return[..._(e),[...t]]}function fO(e,t,o){let r=e.findIndex((a)=>$r(a,o)),i=t?e.findIndex((a)=>$r(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return _(s)}function qe(e,t){return _(e.filter((o)=>!nc(t,o)))}function pn(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],s=t[r];if(i===s)continue;if(Z(i)&&Z(s))return i-s;return String(i)<String(s)?-1:1}return e.length-t.length}function mn(e){return _(e.filter((t)=>!e.some((o)=>!$r(o,t)&&nc(o,t))))}function Mm(e){return V(e)!==null}function V(e){let t=e?.at(-1);return e&&e.at(-2)==="children"&&Z(t)?{index:t,parentPath:e.slice(0,-2)}:null}function $x(e){return mn(e).filter((t)=>Mm(t)).toSorted((t,o)=>pn(o,t))}function mO(e){let t=[];for(let o of e)if(!t.some((r)=>$r(r,o)))t.push([...o]);return t}function Pm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var Ze=null;function gO(e){Ze=e}function Qe(){return Ze}var X=null,Q=null,ee=null,ve=!0;function et(){X=[],Q=[],ee=[],ve=!0}function f(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function tt(e){if(ee)ee.push(e)}function nt(){let e={docOps:Q??[],fmOps:ee??[],invertible:ve,ops:X??[]};return X=null,Q=null,ee=null,ve=!0,e}var ot=100,gn=20;function te(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function R(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function w(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}function bn(e,t,o,r,i){let s=e.length,a=s<t.length&&e.every((d,b)=>d===t[b]),l=t[s+1];if(!a||t[s]!=="children"||!Z(l))return t;if(i?l<o:l<=o)return t;let c=[...t];return c[s+1]=l+r,c}var rt=null;function it(e){rt=e}var st=null;function at(e){st=e}function yn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)yv(e.doc.document,he(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];we(e,s.field,s.before)}e.doc.document={...he(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Y(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null}={}){if(!e)return!1;if(r!=="remote"&&st?.(e,r))return!1;let s=ea(e.session.selection),a=e.doc.dirty;et();let l,c=null;try{t(e)}catch(J){c={error:J}}finally{l=nt()}if(c)throw yn(e,l,s,a),c.error;let d=he(e.doc.document),b={...d},y=Qe(),h=y===null?{patchable:!1,reason:"no-patch-consumer"}:l.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:y.classify(e,l.ops);if(h.patchable)y.markConsumed(b,e);if(e.doc.document=b,h.patchable)try{y.apply(e,l.ops,l)}catch(J){y.escalate(`patch-apply-failed: ${J instanceof Error?J.message:String(J)}`,e)}if(!o&&!W)hn(e,d,l,s,i);return e.doc.dirty=!0,rt?.(e,l,r),!0}function hn(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=te()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((d)=>d.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((d)=>d.inverse)],l.selection=ea(e.session.selection),l.document)l.document=Jo(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%gn===0;if(s.push({document:c?Jo(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((d)=>d.forward):null,inverseOps:a?o.docOps.map((d)=>d.inverse):null,coalesceKey:i,selection:ea(e.session.selection),selectionBefore:r}),s.length>ot){if(!s[1].document)s[1].document=Oe(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function Oe(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=Jo(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])yv(i,a);return i}function qd(e,t,o){return Y(e,(r)=>t(r.doc.document),o)}function Pe(e,t){Y(e,(o)=>{for(let r of t)Ce(o,r)},{origin:"remote",skipHistory:!0})}var xn=new Set(["state","$media","$head","$elements","imports","$layout"]);function Ce(e,t){let o=null;if(t.op==="set-key")o=oe(e.doc.document,t.path)?.[t.key];switch(yv(e.doc.document,t),Bi({forward:t,inverse:t}),t.op){case"set-key":{if(xn.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let r=t.key.startsWith("on")&&(rf(t.value)||rf(o));f({isEvent:r,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var W=null,lt=null;function ct(e){lt=e}function Ix(e){W=e}function Rx(){let e=W;if(e&&!L.has(e)){let t=he(e.doc.document),o={document:Jo(t),selection:ea(e.session.selection)},r=e.history.snapshots.slice(0,e.history.index+1);if(r.push(o),r.length>ot)r.shift();e.history.snapshots=r,e.history.index=r.length-1}if(W=null,e)lt?.(e)}function LC(){return W!==null}function bO(){return W}var L=new WeakMap;function av(e,t){if(t)L.set(e,t);else L.delete(e)}function vO(e){let t=L.get(e);return t?t.canUndo(e):e.history.index>0}function yO(e){let t=L.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function ut(e,t){let{snapshots:o}=e.history;e.doc.document=Oe(o,t);let r=o[t];e.session.selection=ea(he(r.selection))}function dt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(Oe(e.history.snapshots,t)),r=JSON.stringify(Jo(he(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function $C(e){let t=L.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=te()?o.inverseOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)Ce(a,he(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=he(i[l]);we(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ea(he(o.selectionBefore??[])),e.history.index-=1,dt(e,e.history.index)}else e.history.index-=1,ut(e,e.history.index);e.doc.dirty=!0}function wO(e){let t=L.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=te()?o.forwardOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l of r)Ce(a,he(l));if(i)for(let l of i){let c=he(l);we(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=ea(he(o.selection)),e.history.index+=1,dt(e,e.history.index)}else e.history.index+=1,ut(e,e.history.index);e.doc.dirty=!0}function Lo(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;vv(i).splice(o,0,structuredClone(r)),f({index:o,op:"insert",parentPath:t}),Bi({forward:{index:o,node:$e(r),op:"insert-child",parentPath:t},inverse:{index:o,op:"remove-child",parentPath:t}})}function bh(e,t){let o=V(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=R(e.doc.document,i).children.splice(r,1);f({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:$e(s),op:"insert-child",parentPath:i}}),e.session.selection=qe(e.session.selection,t)}function M$(e,t){let o=V(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(he(r));R(e.doc.document,s).children.splice(i+1,0,a),f({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:$e(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function Fm(e,t){for(let o of $x(t))bh(e,o)}function Dx(e,t){let o=[];for(let r of $x(t)){let i=e.session.selection;M$(e,r);let s=Me(e.session.selection),a=V(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>bn(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function xO(e,t,o="div"){let r=V(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(he(i))],tagName:o},c=$e(i);R(e.doc.document,a).children.splice(s,1,l),f({op:"replace",path:t}),Bi({forward:{index:s,node:$e(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Qc(e,t,o,r){let i=e.doc.document,s=At(t),a=hi(t);if(!s||!Z(a))return;let l=oe(i,s),c=oe(i,o);if(!l||!Array.isArray(l.children)||!c)return;if(l.children[a]===void 0)return;let d=r;if(l===c&&a<r)d-=1;let b={fromIndex:a,fromParentPath:s,op:"move-child",toIndex:d,toParentPath:o},y=nI(i,b),[h]=l.children.splice(a,1);if(vv(c).splice(d,0,h),f({fromPath:t,op:"move",toIndex:d,toParentPath:o}),Bi({forward:b,inverse:y}),$r(Me(e.session.selection),t)){let J=r;if(s.length===o.length&&s.every((E,F)=>E===o[F])&&a<r)J=r-1;e.session.selection=[[...o,"children",J]]}}function Ve(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=$e(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(w(t,o,a,$e(i[o]))),o==="textContent")f({op:"set-text",path:t});else if(o==="style")f({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&rf(l);f({isEvent:c,key:o,op:"set-prop",path:t})}}function Gd(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Bi(w(t,"style",s,$e(i.style))),f({op:"set-style",path:t})}function Tr(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Bi(w(t,"attributes",s,$e(i.attributes))),f({attr:o,op:"set-attr",path:t})}function _O(e,t,o,r,i){if(!o)return Gd(e,t,r,i);let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=`@${o}`,c=rd(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function Nx(e,t,o,r,i){let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=rd(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function SO(e,t,o,r,i,s){let a=R(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=rd(a.style,c),b=rd(d,r);if(s===void 0||s===""){if(delete b[i],Object.keys(b).length===0)delete d[r];if(Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(w(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function ft(e,t){let o=[e];for(let r of t){let i=Ni(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Ni(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function Ax(e,t,o,r,i){let s=R(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=rd(l,c);if(i===void 0||i==="")delete l[r],ft(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(w(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function CO(e,t,o,r,i,s){let a=R(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=rd(a.style,c),b=d;for(let y of r)b=rd(b,y);if(s===void 0||s===""){if(delete b[i],ft(d,r),Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(w(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function kO(e,t,o){let r=R(e.doc.document,t),i=$e(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(w(t,"style",i,$e(r.style))),f({op:"set-style",path:t})}function Ia(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Ox(e,t){let o=e.doc.document;if(o.state){let r=$e(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(w([],"state",r,$e(o.state))),f({key:"state",op:"doc-meta"})}}function Gr(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!S(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function EO(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=$e(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(w([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Vp(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Bi(w(t,"$props",s,$e(i.$props))),f({op:"replace",path:t})}function TO(e,t,o,r){let i=R(e.doc.document,t),s=$e(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(w(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function LO(e,t,o){let r=R(e.doc.document,t);if(r.cases){let i=$e(r.cases);delete r.cases[o],Bi(w(t,"cases",i,$e(r.cases))),f({op:"replace",path:t})}}function $O(e,t,o,r){let i=R(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=$e(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(w(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function Kd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?$e(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:$e(o);tt({after:a,before:i,field:t}),e.doc.dirty=!0}function we(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}function Am(e){let t=new Set,o=new Set;return bv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function uO(e,t){if(!t)return e;return Re(e,"",t)}function Re(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Re(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Re(s,`${t}/${Y$(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Yo(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var _C=["design","content","media","styles","publish"],wx="design",tv=[{icon:"frame-corners",id:"design",title:"Design"},{icon:"file-text",id:"content",title:"Content"},{icon:"image",id:"media",title:"Media"},{icon:"paint-brush",id:"styles",title:"Styles"},{icon:"paper-plane-tilt",id:"publish",title:"Publish"}];function N$(e){return typeof e==="string"&&_C.some((t)=>t===e)}function nv(e){return tv.find((t)=>t.id===e)}var Ae="workspace://",xx={content:"content-home",media:"media-home",publish:"publish-home"};function Wp(e){return Object.hasOwn(xx,e)}function Xl(e){return`${Ae}${e}`}function ll(e){if(!e.startsWith(Ae))return null;let t=e.slice(Ae.length);return N$(t)&&Wp(t)?t:null}function iv(e){let t=ll(e);return t?nv(t).title:null}var Tn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Dm={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Tn.get(e)??"canvas"}var vn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function iO(e){return vn.get(e)??"design"}var _x=(e)=>e.editor.kind==="canvas",mh=(e)=>_x(e)&&e.selection.count>0,Sx=(e)=>mh(e)&&!e.selection.isRoot;function ov(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:wx},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,publish:!1}}}function SC(e={}){let t=ov();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var On=["palette"],Pn=["caret","global"],Sn=["dock","global"],Cn=["canvas","global"],wn=["grid","global"],Rn=["code","global"],pt=["global"];function oO(e){if(e.modal.open)return On;if(e.caret.active)return Pn;if(e.focus.region!=="pane")return Sn;switch(e.editor.kind){case"grid":return wn;case"code":return Rn;case"canvas":return e.canvas.view==="preview"?pt:Cn;default:return pt}}var ln="project.json";function An(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:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Jn=["edit","design","preview","source","stylebook","git-diff"];function sv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:d=null,source:b=null,canvasMode:y}){let h=ge(),J=Am(r),E=a?.modes??In(t,s),F=y??E.find((T)=>T!=="preview")??"edit",ce=E[0]==="preview",j={bareRepeaters:J,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:d,mode:kn(t,s),source:b,sourceFormat:s},ue={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},H={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:An(F,ce)};return h.run(()=>({capabilities:{modes:E},doc:g(j),documentPath:t,fileHandle:o,history:g(ue),id:e,pinned:!1,preview:c,scope:h,session:g(H)}))}function In(e,t){if(e===ln)return["stylebook","tokens","source"];let o=Wi(t)??cn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Jn}function kn(e,t){let o=Wi(t)??cn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function TC(e){return Qs(e.session.ui.canvasMode)}function O$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Qs(o);if(!t.includes(r))t.push(r)}return t}function hO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Om(e){e.scope.stop()}var mt=new WeakMap,B=new Map;function Ln(e){let t=he(e),o=mt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),mt.set(t,o);return o}function gt(e){B.set(e,(B.get(e)??0)+1)}function bt(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function lv(e){return B.has(e.replaceAll("\\","/"))}var Dn=8000,jn=800,En=2500,yt=null;function Mn(){return yt??=(le("f0jn7nnp"),import("./index-f0jn7nnp.js")),yt}function xt(){try{return p()}catch{return null}}var K=null;function OO(e){K=e}var Ie=null;function MO(e){Ie=e}var Tt=()=>{};function PO(e){Tt=e??(()=>{})}var ke=new WeakMap;function vt(e){return he(e)}function De(e,t){return e.frontmatterMap(t)}function Nn(e){return e.synced}function D(e){return ke.get(vt(e))}function Ne(e){let t=vt(e),o=ke.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},ke.set(t,o);return o}var ht=!1;function $n(){if(ht)return;ht=!0,it(_n),ct(Wn),at((e)=>{if(D(e)?.session?.synced&&Ln(e).sourceCanonical)return Tt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function _n(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=he(e.doc.document),o==="remote"){fe(r);return}if(r.canWrite)Bn(r,t),fe(r)}function Wn(e){let t=D(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function Bn(e,t){let o=t.docOps.map((r)=>r.forward);if(LC()){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=Jo(he(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function Je(e){let t=e.collab.yDocToJson(e.handle.doc);Y(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function Kn(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function fe(e){if(!K||!Kn(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=En){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,je(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),je(e)},jn)}async function je(e){if(!K||!e.synced)return;try{let t=await K(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function Ot(e){if(!Ie||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Ie(r,s)}catch{return}if(!Nn(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=De(t,o.doc),d=a.frontmatter??{};o.doc.transact(()=>{let b=[...c.keys()];for(let y of b)if(!(y in d))c.delete(y);for(let[y,h]of Object.entries(d))if(!t.deepEqual(c.get(y),h))c.set(y,h)},t.MIRROR_ORIGIN)}function FO(e){let t=D(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(K)try{l=await K(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)Ot(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function hv(e){let t=Ln(e);return t.active&&t.readOnly}async function H$(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await je(t),await t.handle.flush(),!0}async function jO(){for(let e of Ee)if(D(e)?.session?.synced)await H$(e)}var Ee=new Set;function ie(e){if(!xt()?.collab||!e.documentPath||e.documentPath===ln)return;let o=Ne(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,$n(),Ee.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)pe(e);else Le(e)}),ta(()=>{Ee.delete(e),pe(e)})})}function B$(e,t){let o=Ne(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function z$(e){return D(e)?.optedOut.value!==!0}function Pt(e){if(!D(e)?.watcherInstalled){ie(e);return}pe(e),Le(e)}async function Le(e){let t=Ne(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=xt();if(!o||!r?.collab){Ln(e).status="unavailable";return}let{generation:i}=t,s=Ln(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Mn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let d,b=new Promise((y,h)=>{d=setTimeout(()=>h(Error("collab-sync-timeout")),Dn)});try{await Promise.race([c.whenSynced,b])}finally{clearTimeout(d)}if(t.generation!==i){c.destroy();return}t.session=Hn(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",gt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),C.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function pe(e){let t=D(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=Ln(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(bt(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}av(e,null),e.history.snapshots=[{document:Jo(he(e.doc.document)),selection:ea(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function Hn(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:he(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let T=o.yDocToJson(r.doc),O=Jo(he(e.doc.document));if(!o.deepEqual(T,O)){let I=o.diffDocs(O,T);if(I===null)s.synced=!0,Je(s),s.synced=!1;else if(I.length>0)Pe(e,I)}s.applyingRemoteFrontmatter=!0;let P=De(o,r.doc);for(let[I,N]of P.entries())e.doc.content.frontmatter[I]=N;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,Jo(he(e.doc.document)),{frontmatter:Jo(he(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=he(e.doc.document),s.disposers.push(r.onDirty((T)=>{e.doc.dirty=T})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:T})=>{T.meta.set("selection",ea(e.session.selection))},d=({stackItem:T})=>{let O=T.meta.get("selection");e.session.selection=ea(O??[])};l.on("stack-item-added",c),l.on("stack-item-popped",d),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",d)}),av(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let b=o.structureMap(r.doc),y=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;let P=o.yEventsToDocOps(T);if(P===null){Je(s);return}if(P.length===0)return;try{Pe(e,P)}catch{Je(s)}};b.observeDeep(y),s.disposers.push(()=>b.unobserveDeep(y));let h=Ln(e);h.sourceCanonical=o.canonicalOf(r.doc)==="source";let J=o.metaMap(r.doc),E=()=>{h.sourceCanonical=o.canonicalOf(r.doc)==="source"};J.observe(E),s.disposers.push(()=>J.unobserve(E));let F=o.sourceText(r.doc),ce=(T,O)=>{if(O.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,Ot(s)},600)};F.observe(ce),s.disposers.push(()=>F.unobserve(ce));let j=De(o,r.doc),ue=(T,O)=>{if(O.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[P,I]of T.changes.keys)if(I.action==="delete")delete e.doc.content.frontmatter[P];else e.doc.content.frontmatter[P]=j.get(P)}finally{s.applyingRemoteFrontmatter=!1}};j.observe(ue),s.disposers.push(()=>j.unobserve(ue)),e.scope.run(()=>{let T=JSON.stringify(e.doc.content.frontmatter);ne(()=>{let O=JSON.stringify(e.doc.content.frontmatter);if(O===T)return;if(T=O,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let P=JSON.parse(O);r.doc.transact(()=>{let I=[...j.keys()];for(let N of I)if(!(N in P))j.delete(N);for(let[N,Be]of Object.entries(P))if(!o.deepEqual(j.get(N),Be))j.set(N,Be)},o.LOCAL_ORIGIN),fe(s)}),ne(()=>{let O=e.session.selection.length>0?ea(e.session.selection):null,P=r.awareness.getLocalState();if(P)r.awareness.setLocalState({...P,structuralSelection:O})}),ne(()=>{let O=he(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let I=he(e.doc.document);if(I!==O||I===s.lastSeenRef)return;s.lastSeenRef=I,re(s),fe(s)})})});let H=Ln(e),de=()=>{let T=[];for(let[O,P]of r.awareness.getStates())if(O!==r.awareness.clientID&&P.user)T.push({clientId:O,state:P});H.peers=T};return de(),r.awareness.on("change",de),s.disposers.push(()=>r.awareness.off("change",de),r.onStatus((T)=>{if(T==="offline"||T==="connecting")H.status="offline";else if(s.synced)H.status="synced"}),r.onReset(()=>{pe(e),Le(e)})),s.synced=!0,s}function k(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function Gn(e){if(Z(e))return"number";if(Xe(e))return"boolean";return n(e)?"string":"object"}function A(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${Gn(e)} ${JSON.stringify(e)}`}function wt(e){return Array.isArray(e)&&e.every((t)=>n(t)||Z(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw k(e,o,`expected a non-empty string, got ${A(r)}`);return r}function Xn(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Rt(e,t,o){let r=t[o];if(!Z(r)||!Number.isFinite(r))throw k(e,o,`expected a finite number, got ${A(r)}`);return r}function Ct(e,t,o){let r=t[o];if(!Z(r)||!Number.isInteger(r))throw k(e,o,`expected an integer, got ${A(r)}`);return r}function Mx(e,t,o,r,i){let s=Rt(e,t,o);if(s<r||s>i)throw k(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function zi(e,t,o){let r=t[o];if(!Xe(r))throw k(e,o,`expected a boolean, got ${A(r)}`);return r}function Vn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw k(e,o,`${A(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function IC(e,t,o){let r=t[o];if(!wt(r))throw k(e,o,`expected an array of path segments (strings or numbers), got ${A(r)}`);return r}function IO(e,t,o){if(t[o]===null)return null;return IC(e,t,o)}function F$(e,t,o){let r=t[o];if(!Array.isArray(r))throw k(e,o,`expected an array of document paths, got ${A(r)}`);return r.map((i,s)=>{if(!wt(i))throw k(e,o,`entry ${s} is not a document path — expected an array of segments, got ${A(i)}`);return i})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function di(e,t){return{description:t,enum:[...e],type:"string"}}function cl(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function j$(e,t={}){return{description:e,type:"number",...t}}function $o(e){return{description:e,type:"boolean"}}function Px(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function RO(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function We(e){return{description:e,type:"string"}}function zn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Fe(e){return n(e)?[e]:e}function Jt(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 o=t.items?.type;if(Array.isArray(o))return zn(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function It(e,t){switch(e){case"null":return t===null;case"boolean":return Xe(t);case"string":return n(t);case"number":return Z(t)&&Number.isFinite(t);case"integer":return Z(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return S(t)&&!Array.isArray(t);default:break}return!1}function kt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function Yn(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>It(s,i)))throw k(e,o,`expected ${kt(r)}, got ${A(i)}`);return i}function Dt(e){switch(Jt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>A(t)).join(" | ")}`;case"const":return`the constant ${A(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>Dt(t)).join(" or ");case"typed":return kt(Fe(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 qn(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Fe(a.type).some((l)=>It(l,i)))continue;try{return jt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw k(e,o,`expected ${r.map((a)=>Dt(a)).join(" or ")}, got ${A(i)}`)}function jt(e,t,o,r){switch(Jt(r)){case"enum":return Vn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw k(e,o,`expected the constant ${A(r.const)}, got ${A(i)}`);return i}case"one-of":return qn(e,t,o,r.oneOf??[]);case"typed":return Yn(e,t,o,Fe(r.type??[]));case"boolean":return zi(e,t,o);case"bounded-number":{if(r.type==="integer")Ct(e,t,o);return Mx(e,t,o,r.minimum,r.maximum)}case"number":return Rt(e,t,o);case"integer":return Ct(e,t,o);case"string":return St(e,t,o);case"path":return IC(e,t,o);case"path-list":return F$(e,t,o);default:return t[o]}}function DO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,d]of Object.entries(o)){if(d===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw k(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=d}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=jt(e,o,c,i[c])}return l}var Zn=20,ui="primary",jm="secondary",W$=2,m=g({activePaneId:ui,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Kr();return e.derived?.kind==="lens"?fn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Kr().tabOrder}}),u=Th(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Kr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function fn(e){return m.panes.find((t)=>t.id===e)}function Ql(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function Lr(e){let t=fn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,M();let{activeTabId:o}=t;if(o){_e(o);let r=m.tabs.get(o);if(r)Ft(r)}}function Hm(e){return m.activePaneId===e}function DC(e){let t=e??Kr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Ql(t);if(!r)return null;let i=ec(r.id);return Wm(t),wh(i,t),i.activeTabId=t,m.activePaneId=i.id,M(),_e(t),i}function NC(e){return m.panes.find((t)=>t.id!==e)??Qn(jm)}function ec(e){let t=NC(e);if(t.derived)t.derived=null;return t}function Qn(e){let t=fn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],fn(e)}function Bm(e){if(m.panes.length<2)return;let t=e===ui?m.panes.find((s)=>s.id!==ui)?.id:e,o=t===void 0?void 0:fn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)wh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),M()}function zm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function AC(e){U=e??(()=>!0)}var Nt=null;function OC(e){Nt=e}var $t=null;function MC(e){$t=e}function eo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Lt(e){return e.tabOrder.findLast((t)=>U(t))??null}function Wm(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Lt(o);if(o.id!==ui&&zm(o))t.push(o.id)}for(let o of t)Bm(o)}function wh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??no(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function to(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function no(e,t){return m.tabs.get(t)?.pinned===!0?to(e):e.tabOrder.length}function tc(e,t=null){if(m.projectRoot&&e!==m.projectRoot)EC();m.projectRoot=e,m.projectConfig=t}function Up(e){let t=u.value;return e!==null&&t!==null&&he(t)===he(e)}function Yd(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&he(t)===he(e)}function _e(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var me=null,se=0;function M(){me=null,se=0}function Ft(e){if(x&&e.documentPath)x.selectedPath=e.documentPath}function PC(e){let t=fn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)M(),_e(e);Ft(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=sv({...e,preview:!1}),c=(e.paneId===void 0?void 0:fn(e.paneId))??Kr();return wh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=sv({...e,preview:o}),i=(e.paneId===void 0?void 0:fn(e.paneId))??Kr(),s;if(t)r.pinned=t.pinned,Om(t);else{if(o){let l=Et(i),c=l?m.tabs.get(l):null;if(c)Qd(c);FC()}let a=o?Et(i):null;if(a)s=i.tabOrder.indexOf(a),Zd(a);wh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Et(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function td(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function FC(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)td(e)}function Bx(e,t){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function V$(e,t){let o=m.tabs.get(e),r=Ql(e);if(!o||!r)return;r.tabOrder=_t(r,e,t)}function _t(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((d)=>d!==t),s=i.filter((d)=>m.tabs.get(d)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Zd(e){let t=m.tabs.get(e);if(!t)return;let o=Ql(e),r=o?.activeTabId===e;if(oo(t),Om(t),m.tabs.delete(e),Cx(e),Wm(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),M(),o&&zm(o))Bm(o.id);if(!r)return;let i=Kr(),s=$t?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Lt(i);if(a)ae(a);else Nt?.(i.id)}function U$(){let e=[...m.tabs.values()];m.tabs.clear(),Wt(),m.mruOrder=[],M();for(let t of e)Om(t)}function Wt(){m.panes=[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],m.activePaneId=ui}function oo(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,Zn)}function ro(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Mt(e){if(!me)me=m.mruOrder.filter((r)=>m.tabs.has(r)&&U(r)),se=0;let t=me;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function q$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=sv(e);m.tabs.set(r.id,r),Wt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],M(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Om(i);return r}function Bt(e,t={}){ae(e,t)}function pv(e,t,o){let r=fn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=_t(r,e,o);return r}return Wm(e),wh(r,e,o),r}function zx(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,CC(e))Cx(e),Nm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),M(),Pt(r)}function G$(e,t){e.registerAll([...io(t),...so(t)])}function io(e){let t=()=>eo()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Mt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Mt(-1)}},{args:Se({path:We('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:(o)=>o.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:o,args:r})=>{let i=St("document.open",r,"path"),s=u.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Dm[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...m.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:We('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:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=ec(Kr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(zm(s)&&s.id!==ui)Bm(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" 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:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=ro();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)Bx(o,!r.pinned)}},{args:Se({pinned:$o("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:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=m.activeTabId;if(i&&m.tabs.get(i))Bx(i,zi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)td(o)}}]}function so(e){let t=()=>m.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:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{DC()}},{args:Se({path:We("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:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Kr();if((s.activeTabId?m.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(ec(s.id).id,i)}},{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:()=>{Lr(ui)}},{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:()=>{Lr(jm)}},{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:ao}]}function ao(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===ui){if(e.derived=null,!zm(e))return}Bm(e?.id??jm)}
|
|
2
|
-
export{
|
|
1
|
+
import{ge,ea,ne,g,he,Th,C}from"./studio-hw60n5dh.js";import{Xd}from"./studio-grp684wx.js";import{p}from"./studio-pr23qhrw.js";import{zi,fn,cr}from"./studio-tpmnbgmt.js";import{X$,OC,Io,VO,zx,Q$,eI,GO,bv}from"./studio-6vrxzkba.js";import{fv,U$,At,hi,Tr,ec,S}from"./studio-ana67wax.js";import{$e,oe,mv,gv,Z$}from"./studio-gqpty626.js";import{n,Z,Xe,_,v,Yo,Di,nd,sf}from"./studio-kt2j51sa.js";import{le}from"./studio-fqs1a22a.js";var be=g(new Set);function Dm(e){be.add(e)}function xx(e){be.delete(e)}function vC(e){return be.has(e)}function nv(e,t){return{success:!0,data:e,summary:t}}function uo(e){return{success:!1,error:e}}function bo({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,execute:a}){let l={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:a};if(s!==void 0)l.interactive=s;return l}function _x(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function gh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var Bt=new AbortController().signal;function Sx(e={}){let t=e.session??gh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??_x(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Bt}}function eO(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function $$(){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)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,d]of Object.entries(o)){let b=a[c];if(!b)continue;let y=b.type;if(!y)continue;let h=Ke(d);if(y==="number"||y==="integer"){if(xe(d,"number"))continue;if(xe(d,"string")){if(!Number.isNaN(Number(d)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}s.push(`Argument "${c}" should be a number, got ${h}`);continue}if(y==="string"&&h!=="string")s.push(`Argument "${c}" should be a string, got ${h}`);else if(y==="boolean"&&h!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${h}`);else if(y==="array"&&h!=="array")s.push(`Argument "${c}" should be an array, got ${h}`);else if(y==="object"&&h!=="object")s.push(`Argument "${c}" should be an object, got ${h}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=Sx()){let i=e.get(t);if(!i)return uo(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return uo(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return uo(`Tool "${t}" execution error: ${ye(a)}`)}}}}function Kt(e){return JSON.parse(JSON.stringify(e))}function ye(e){return e.message}var Ut=["string","number","boolean","undefined"];function xe(e,t){return typeof e===t}function Gt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ke(e){if(Array.isArray(e))return"array";return Ut.find((t)=>xe(e,t))??"object"}function zt(e){if(!e)return{};let t=JSON.parse(e);if(!Gt(t)){let o=t===null?"null":Ke(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function tO(e,t,o){let r=!1,i;try{let s=zt(t.argumentsText);r=!0,i=await e.execute(t.name,s,o)}catch(s){i=uo(`Failed to parse arguments: ${ye(s)}`)}try{return{status:"done",result:Kt(i),executed:r}}catch(s){let a=ye(s);return{status:"done",result:uo(`Tool "${t.name}" returned a result that cannot be serialized: ${a}`),executed:r}}}var G=[],Yt=50;function nO(e){return Object.assign(_x(),{turnId:e})}function iO(e,t){if(t.length===0)return[];let o={id:e,writes:[...t]};G.push(o);while(G.length>Yt)G.shift();return o.writes}function yC(e){return G.find((t)=>t.id===e)?.writes??[]}function oO(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function wC(){G.splice(0)}function rO(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}var qt=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"]),mC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Pn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function mx(e){return Pn(e)!==null}function Yb(e){let t=Pn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&qt.has(r)?"rtl":"ltr"}function Vt(e){let t=Pn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var Zt="prefix-except-default";function ln(e){let t=e.i18n,o=[];if(!_(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=Pn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=Pn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&Pn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Zt;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function go(e,t){let o=Te(z(e),t);if(o===-1||t===null)return null;return Pn(z(e)[o])}function gx(e,t){let o=go(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return z(e)[0]==="pages"?t.defaultLocale:null}function Zb(e,t){let o=z(e),r=Te(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Jc(e,t,o){if(o===null)return null;let r=Pn(t);if(r===null||!o.locales.includes(r))return null;let i=z(e),s=Te(i,o),a=s===-1?Xt(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,d)=>d!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function z(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Te(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=Pn(o);return r!==null&&t.locales.includes(r)})}function Xt(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function ZA(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=Pn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function D$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((d)=>d!==""&&!Qt(d));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function Qt(e){let t=e.indexOf("="),o=t===-1?e:e.slice(0,t);if(o==="v")return!0;if(!o.includes("%"))return!1;try{return decodeURIComponent(o)==="v"}catch{return!1}}function en(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function sv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!OC.test(a))continue;let c=nn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Io)){let d=tn(r,c,a,o);if(d)s(d.dir,d.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${X$}/${a}`)}return i}function tn(e,t,o,r){let i=t.indexOf(Io),s=t.slice(0,i),a=t.slice(i+Io.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!OC.test(l))return null;let c=r.find((b)=>b.toLowerCase()===l.toLowerCase());if(c===void 0||!OC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${X$}/${o}/${c}`}}function nn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function av(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=GO(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=zx(e);return D$(`${t.fileBaseUrl}${bv(r)}${i}`,en(t.versions,r))}let[o]=t.mounts;return o?on(e,t.documentDir,o):null}function on(e,t,o){if(Q$(e))return null;let{path:r,suffix:i}=zx(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=eI(t,s);if(a===null)return null;let l=VO([o],a);if(!l)return null;return`${l}${i}`}function Ue(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function q(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function He(e){return e??S?.projectConfig??null}function Ge(e){return e?.content??{}}function rn(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function ze(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function Ye(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:cr()?.extensions[0]??".json",unresolvedFormat:null};let t=zi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function sn(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>Ue(i)).join("|")})`,r=q(e).split(Io).map((i)=>Ue(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function cn(e,t,o){let r=sn(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function un(e){return q(e).replaceAll(Io,"").length}function Kd(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=rn(o),i=q(e),s=null,a=-1;for(let[l,c]of Object.entries(Ge(o))){let{source:d}=c;if(d===void 0||d===""||ze(d))continue;let b=un(d);if(b<=a)continue;let y=cn(d,i,r);if(y===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===y.length,name:l,...Ye(c)},a=b}return s}function Vn(e,t){if(e===null||e===void 0||e==="")return null;let o=He(t),r=q(e),i=r.toLowerCase();for(let[s,a]of Object.entries(Ge(o))){let{source:l}=a;if(l===void 0||l===""||!ze(l))continue;let c=q(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...Ye(a)}}return Kd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function Zc(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Ox(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function Mx(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function kC(e,t){return e?.$label||Zc(t)}function LO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return Zc(t)}function Ra(e){return e==="image"||e==="uri-reference"}function vh(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(Ra(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 yh(e,t){if(!e||!t?.content)return null;let o=Vn(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??cr()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function lv(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function Px(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function $O(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((i)=>i[1])};return{kind:"text"}}function Jo(e){return JSON.parse(JSON.stringify(e))}function Me(e){return e?.at(-1)??null}function lO(e){return e?.[0]??null}function Cx(e,t){if(!t||!e)return!1;return e.some((o)=>Tr(o,t))}function Qs(e){return F(e)}function F(e){let t=[];for(let o of e)t.push([...o]);return t}function kx(e,t){if(Cx(e,t))return F(e.filter((o)=>!Tr(o,t)));return[...F(e),[...t]]}function cO(e,t,o){let r=e.findIndex((a)=>Tr(a,o)),i=t?e.findIndex((a)=>Tr(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return F(s)}function qe(e,t){return F(e.filter((o)=>!ec(t,o)))}function dn(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],s=t[r];if(i===s)continue;if(Z(i)&&Z(s))return i-s;return String(i)<String(s)?-1:1}return e.length-t.length}function mn(e){return F(e.filter((t)=>!e.some((o)=>!Tr(o,t)&&ec(o,t))))}function Om(e){return V(e)!==null}function V(e){let t=e?.at(-1);return e&&e.at(-2)==="children"&&Z(t)?{index:t,parentPath:e.slice(0,-2)}:null}function Ex(e){return mn(e).filter((t)=>Om(t)).toSorted((t,o)=>dn(o,t))}function dO(e){let t=[];for(let o of e)if(!t.some((r)=>Tr(r,o)))t.push([...o]);return t}function Mm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var Ze=null;function uO(e){Ze=e}function Qe(){return Ze}var X=null,Q=null,ee=null,ve=!0;function et(){X=[],Q=[],ee=[],ve=!0}function f(e){if(X)X.push(e)}function Hi(e){if(Q)Q.push(e)}function tt(e){if(ee)ee.push(e)}function nt(){let e={docOps:Q??[],fmOps:ee??[],invertible:ve,ops:X??[]};return X=null,Q=null,ee=null,ve=!0,e}var ot=100,gn=20;function te(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function w(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function P(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}function bn(e,t,o,r,i){let s=e.length,a=s<t.length&&e.every((d,b)=>d===t[b]),l=t[s+1];if(!a||t[s]!=="children"||!Z(l))return t;if(i?l<o:l<=o)return t;let c=[...t];return c[s+1]=l+r,c}var rt=null;function it(e){rt=e}var st=null;function at(e){st=e}function yn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)gv(e.doc.document,he(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];we(e,s.field,s.before)}e.doc.document={...he(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Y(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null}={}){if(!e)return!1;if(r!=="remote"&&st?.(e,r))return!1;let s=Qs(e.session.selection),a=e.doc.dirty;et();let l,c=null;try{t(e)}catch(A){c={error:A}}finally{l=nt()}if(c)throw yn(e,l,s,a),c.error;let d=he(e.doc.document),b={...d},y=Qe(),h=y===null?{patchable:!1,reason:"no-patch-consumer"}:l.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:y.classify(e,l.ops);if(h.patchable)y.markConsumed(b,e);if(e.doc.document=b,h.patchable)try{y.apply(e,l.ops,l)}catch(A){y.escalate(`patch-apply-failed: ${A instanceof Error?A.message:String(A)}`,e)}if(!o&&!W)hn(e,d,l,s,i);return e.doc.dirty=!0,rt?.(e,l,r),!0}function hn(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=te()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((d)=>d.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((d)=>d.inverse)],l.selection=Qs(e.session.selection),l.document)l.document=Jo(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%gn===0;if(s.push({document:c?Jo(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((d)=>d.forward):null,inverseOps:a?o.docOps.map((d)=>d.inverse):null,coalesceKey:i,selection:Qs(e.session.selection),selectionBefore:r}),s.length>ot){if(!s[1].document)s[1].document=Oe(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function Oe(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=Jo(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])gv(i,a);return i}function Ud(e,t,o){return Y(e,(r)=>t(r.doc.document),o)}function Pe(e,t){Y(e,(o)=>{for(let r of t)Ce(o,r)},{origin:"remote",skipHistory:!0})}var xn=new Set(["state","$media","$head","$elements","imports","$layout"]);function Ce(e,t){let o=null;if(t.op==="set-key")o=oe(e.doc.document,t.path)?.[t.key];switch(gv(e.doc.document,t),Hi({forward:t,inverse:t}),t.op){case"set-key":{if(xn.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let r=t.key.startsWith("on")&&(sf(t.value)||sf(o));f({isEvent:r,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var W=null,lt=null;function ct(e){lt=e}function Tx(e){W=e}function Lx(){let e=W;if(e&&!N.has(e)){let t=he(e.doc.document),o={document:Jo(t),selection:Qs(e.session.selection)},r=e.history.snapshots.slice(0,e.history.index+1);if(r.push(o),r.length>ot)r.shift();e.history.snapshots=r,e.history.index=r.length-1}if(W=null,e)lt?.(e)}function _C(){return W!==null}function hO(){return W}var N=new WeakMap;function ov(e,t){if(t)N.set(e,t);else N.delete(e)}function pO(e){let t=N.get(e);return t?t.canUndo(e):e.history.index>0}function fO(e){let t=N.get(e);return t?t.canRedo(e):e.history.index<e.history.snapshots.length-1}function ut(e,t){let{snapshots:o}=e.history;e.doc.document=Oe(o,t);let r=o[t];e.session.selection=Qs(he(r.selection))}function dt(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(Oe(e.history.snapshots,t)),r=JSON.stringify(Jo(he(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function SC(e){let t=N.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=te()?o.inverseOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)Ce(a,he(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=he(i[l]);we(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Qs(he(o.selectionBefore??[])),e.history.index-=1,dt(e,e.history.index)}else e.history.index-=1,ut(e,e.history.index);e.doc.dirty=!0}function mO(e){let t=N.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=te()?o.forwardOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l of r)Ce(a,he(l));if(i)for(let l of i){let c=he(l);we(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Qs(he(o.selection)),e.history.index+=1,dt(e,e.history.index)}else e.history.index+=1,ut(e,e.history.index);e.doc.dirty=!0}function Lo(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;mv(i).splice(o,0,structuredClone(r)),f({index:o,op:"insert",parentPath:t}),Hi({forward:{index:o,node:$e(r),op:"insert-child",parentPath:t},inverse:{index:o,op:"remove-child",parentPath:t}})}function bh(e,t){let o=V(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=w(e.doc.document,i).children.splice(r,1);f({op:"remove",path:t}),Hi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:$e(s),op:"insert-child",parentPath:i}}),e.session.selection=qe(e.session.selection,t)}function R$(e,t){let o=V(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(he(r));w(e.doc.document,s).children.splice(i+1,0,a),f({index:i+1,op:"insert",parentPath:s}),Hi({forward:{index:i+1,node:$e(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function Pm(e,t){for(let o of Ex(t))bh(e,o)}function $x(e,t){let o=[];for(let r of Ex(t)){let i=e.session.selection;R$(e,r);let s=Me(e.session.selection),a=V(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>bn(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function gO(e,t,o="div"){let r=V(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(he(i))],tagName:o},c=$e(i);w(e.doc.document,a).children.splice(s,1,l),f({op:"replace",path:t}),Hi({forward:{index:s,node:$e(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function Yc(e,t,o,r){let i=e.doc.document,s=At(t),a=hi(t);if(!s||!Z(a))return;let l=oe(i,s),c=oe(i,o);if(!l||!Array.isArray(l.children)||!c)return;if(l.children[a]===void 0)return;let d=r;if(l===c&&a<r)d-=1;let b={fromIndex:a,fromParentPath:s,op:"move-child",toIndex:d,toParentPath:o},y=Z$(i,b),[h]=l.children.splice(a,1);if(mv(c).splice(d,0,h),f({fromPath:t,op:"move",toIndex:d,toParentPath:o}),Hi({forward:b,inverse:y}),Tr(Me(e.session.selection),t)){let A=r;if(s.length===o.length&&s.every((j,L)=>j===o[L])&&a<r)A=r-1;e.session.selection=[[...o,"children",A]]}}function Ve(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=$e(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Hi(P(t,o,a,$e(i[o]))),o==="textContent")f({op:"set-text",path:t});else if(o==="style")f({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&sf(l);f({isEvent:c,key:o,op:"set-prop",path:t})}}function qd(e,t,o,r){let i=w(e.doc.document,t),s=$e(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Hi(P(t,"style",s,$e(i.style))),f({op:"set-style",path:t})}function kr(e,t,o,r){let i=w(e.doc.document,t),s=$e(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Hi(P(t,"attributes",s,$e(i.attributes))),f({attr:o,op:"set-attr",path:t})}function bO(e,t,o,r,i){if(!o)return qd(e,t,r,i);let s=w(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=`@${o}`,c=nd(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Hi(P(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function Ix(e,t,o,r,i){let s=w(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=nd(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Hi(P(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function vO(e,t,o,r,i,s){let a=w(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=nd(a.style,c),b=nd(d,r);if(s===void 0||s===""){if(delete b[i],Object.keys(b).length===0)delete d[r];if(Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Hi(P(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function ft(e,t){let o=[e];for(let r of t){let i=Di(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Di(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function Rx(e,t,o,r,i){let s=w(e.doc.document,t),a=$e(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=nd(l,c);if(i===void 0||i==="")delete l[r],ft(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Hi(P(t,"style",a,$e(s.style))),f({op:"set-style",path:t})}function yO(e,t,o,r,i,s){let a=w(e.doc.document,t),l=$e(a.style);if(!a.style)a.style={};let c=`@${o}`,d=nd(a.style,c),b=d;for(let y of r)b=nd(b,y);if(s===void 0||s===""){if(delete b[i],ft(d,r),Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Hi(P(t,"style",l,$e(a.style))),f({op:"set-style",path:t})}function wO(e,t,o){let r=w(e.doc.document,t),i=$e(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Hi(P(t,"style",i,$e(r.style))),f({op:"set-style",path:t})}function Ia(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};r.state[t]=o,Hi(P([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Dx(e,t){let o=e.doc.document;if(o.state){let r=$e(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Hi(P([],"state",r,$e(o.state))),f({key:"state",op:"doc-meta"})}}function qr(e,t,o){let r=e.doc.document,i=$e(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!_(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Hi(P([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function xO(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=$e(r.state);r.state[o]=r.state[t],delete r.state[t],Hi(P([],"state",i,$e(r.state))),f({key:"state",op:"doc-meta"})}function Up(e,t,o,r){let i=w(e.doc.document,t),s=$e(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Hi(P(t,"$props",s,$e(i.$props))),f({op:"replace",path:t})}function _O(e,t,o,r){let i=w(e.doc.document,t),s=$e(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Hi(P(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function SO(e,t,o){let r=w(e.doc.document,t);if(r.cases){let i=$e(r.cases);delete r.cases[o],Hi(P(t,"cases",i,$e(r.cases))),f({op:"replace",path:t})}}function CO(e,t,o,r){let i=w(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=$e(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Hi(P(t,"cases",s,$e(i.cases))),f({op:"replace",path:t})}function Gd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?$e(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:$e(o);tt({after:a,before:i,field:t}),e.doc.dirty=!0}function we(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}function Nm(e){let t=new Set,o=new Set;return fv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function sO(e,t){if(!t)return e;return Re(e,"",t)}function Re(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Re(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Re(s,`${t}/${U$(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Yo(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var gC=["design","content","media","styles","publish"],bx="design",Xb=[{icon:"frame-corners",id:"design",title:"Design"},{icon:"file-text",id:"content",title:"Content"},{icon:"image",id:"media",title:"Media"},{icon:"paint-brush",id:"styles",title:"Styles"},{icon:"paper-plane-tilt",id:"publish",title:"Publish"}];function L$(e){return typeof e==="string"&&gC.some((t)=>t===e)}function Qb(e){return Xb.find((t)=>t.id===e)}var Ae="workspace://",vx={content:"content-home",media:"media-home",publish:"publish-home"};function Wp(e){return Object.hasOwn(vx,e)}function Yl(e){return`${Ae}${e}`}function al(e){if(!e.startsWith(Ae))return null;let t=e.slice(Ae.length);return L$(t)&&Wp(t)?t:null}function ev(e){let t=al(e);return t?Qb(t).title:null}var vn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Vp={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Xs(e){return vn.get(e)??"canvas"}var On=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function XA(e){return On.get(e)??"design"}var yx=(e)=>e.editor.kind==="canvas",mh=(e)=>yx(e)&&e.selection.count>0,wx=(e)=>mh(e)&&!e.selection.isRoot;function tv(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:bx},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,publish:!1}}}function bC(e={}){let t=tv();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var Sn=["palette"],Cn=["caret","global"],wn=["dock","global"],Rn=["canvas","global"],An=["grid","global"],Jn=["code","global"],pt=["global"];function QA(e){if(e.modal.open)return Sn;if(e.caret.active)return Cn;if(e.focus.region!=="pane")return wn;switch(e.editor.kind){case"grid":return An;case"code":return Jn;case"canvas":return e.canvas.view==="preview"?pt:Rn;default:return pt}}var an="project.json";function In(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:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var kn=["edit","design","preview","source","stylebook","git-diff"];function iv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:d=null,source:b=null,canvasMode:y}){let h=ge(),A=Nm(r),j=a?.modes??Dn(t,s),L=y??j.find((x)=>x!=="preview")??"edit",ce=j[0]==="preview",D={bareRepeaters:A,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:d,mode:jn(t,s),source:b,sourceFormat:s},ue={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},H={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:In(L,ce)};return h.run(()=>({capabilities:{modes:j},doc:g(D),documentPath:t,fileHandle:o,history:g(ue),id:e,pinned:!1,preview:c,scope:h,session:g(H)}))}function Dn(e,t){if(e===an)return["stylebook","tokens","source"];let o=zi(t)??fn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return kn}function jn(e,t){let o=zi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function xC(e){return Xs(e.session.ui.canvasMode)}function I$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Xs(o);if(!t.includes(r))t.push(r)}return t}function aO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Xs(o)===t)}function Am(e){e.scope.stop()}var mt=new WeakMap,B=new Map;function Tn(e){let t=he(e),o=mt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),mt.set(t,o);return o}function gt(e){B.set(e,(B.get(e)??0)+1)}function bt(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function rv(e){return B.has(e.replaceAll("\\","/"))}var En=8000,Mn=800,Nn=2500,yt=null;function $n(){return yt??=(le("fkrm7pdk"),import("./index-fkrm7pdk.js")),yt}function xt(){try{return p()}catch{return null}}var K=null;function IO(e){K=e}var Ie=null;function RO(e){Ie=e}var Tt=()=>{};function DO(e){Tt=e??(()=>{})}var ke=new WeakMap;function vt(e){return he(e)}function De(e,t){return e.frontmatterMap(t)}function Ln(e){return e.synced}function k(e){return ke.get(vt(e))}function Ne(e){let t=vt(e),o=ke.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},ke.set(t,o);return o}var ht=!1;function Fn(){if(ht)return;ht=!0,it(_n),ct(Bn),at((e)=>{if(k(e)?.session?.synced&&Tn(e).sourceCanonical)return Tt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function _n(e,t,o){let r=k(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=he(e.doc.document),o==="remote"){fe(r);return}if(r.canWrite)Kn(r,t),fe(r)}function Bn(e){let t=k(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function Kn(e,t){let o=t.docOps.map((r)=>r.forward);if(_C()){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=Jo(he(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function Je(e){let t=e.collab.yDocToJson(e.handle.doc);Y(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function Un(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function fe(e){if(!K||!Un(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=Nn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,je(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),je(e)},Mn)}async function je(e){if(!K||!e.synced)return;try{let t=await K(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function Ot(e){if(!Ie||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Ie(r,s)}catch{return}if(!Ln(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=De(t,o.doc),d=a.frontmatter??{};o.doc.transact(()=>{let b=[...c.keys()];for(let y of b)if(!(y in d))c.delete(y);for(let[y,h]of Object.entries(d))if(!t.deepEqual(c.get(y),h))c.set(y,h)},t.MIRROR_ORIGIN)}function NO(e){let t=k(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(K)try{l=await K(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)Ot(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function cv(e){let t=Tn(e);return t.active&&t.readOnly}async function O$(e){let t=k(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await je(t),await t.handle.flush(),!0}async function AO(){for(let e of Ee)if(k(e)?.session?.synced)await O$(e)}var Ee=new Set;function ie(e){if(!xt()?.collab||!e.documentPath||e.documentPath===an)return;let o=Ne(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,Fn(),Ee.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)pe(e);else Le(e)}),ea(()=>{Ee.delete(e),pe(e)})})}function M$(e,t){let o=Ne(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function P$(e){return k(e)?.optedOut.value!==!0}function Pt(e){if(!k(e)?.watcherInstalled){ie(e);return}pe(e),Le(e)}async function Le(e){let t=Ne(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=xt();if(!o||!r?.collab){Tn(e).status="unavailable";return}let{generation:i}=t,s=Tn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([$n(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let d,b=new Promise((y,h)=>{d=setTimeout(()=>h(Error("collab-sync-timeout")),En)});try{await Promise.race([c.whenSynced,b])}finally{clearTimeout(d)}if(t.generation!==i){c.destroy();return}t.session=Hn(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",gt(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),C.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function pe(e){let t=k(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=Tn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(bt(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}ov(e,null),e.history.snapshots=[{document:Jo(he(e.doc.document)),selection:Qs(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function Hn(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:he(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let x=o.yDocToJson(r.doc),T=Jo(he(e.doc.document));if(!o.deepEqual(x,T)){let J=o.diffDocs(T,x);if(J===null)s.synced=!0,Je(s),s.synced=!1;else if(J.length>0)Pe(e,J)}s.applyingRemoteFrontmatter=!0;let O=De(o,r.doc);for(let[J,M]of O.entries())e.doc.content.frontmatter[J]=M;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,Jo(he(e.doc.document)),{frontmatter:Jo(he(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=he(e.doc.document),s.disposers.push(r.onDirty((x)=>{e.doc.dirty=x})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:x})=>{x.meta.set("selection",Qs(e.session.selection))},d=({stackItem:x})=>{let T=x.meta.get("selection");e.session.selection=Qs(T??[])};l.on("stack-item-added",c),l.on("stack-item-popped",d),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",d)}),ov(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let b=o.structureMap(r.doc),y=(x,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;let O=o.yEventsToDocOps(x);if(O===null){Je(s);return}if(O.length===0)return;try{Pe(e,O)}catch{Je(s)}};b.observeDeep(y),s.disposers.push(()=>b.unobserveDeep(y));let h=Tn(e);h.sourceCanonical=o.canonicalOf(r.doc)==="source";let A=o.metaMap(r.doc),j=()=>{h.sourceCanonical=o.canonicalOf(r.doc)==="source"};A.observe(j),s.disposers.push(()=>A.unobserve(j));let L=o.sourceText(r.doc),ce=(x,T)=>{if(T.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,Ot(s)},600)};L.observe(ce),s.disposers.push(()=>L.unobserve(ce));let D=De(o,r.doc),ue=(x,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[O,J]of x.changes.keys)if(J.action==="delete")delete e.doc.content.frontmatter[O];else e.doc.content.frontmatter[O]=D.get(O)}finally{s.applyingRemoteFrontmatter=!1}};D.observe(ue),s.disposers.push(()=>D.unobserve(ue)),e.scope.run(()=>{let x=JSON.stringify(e.doc.content.frontmatter);ne(()=>{let T=JSON.stringify(e.doc.content.frontmatter);if(T===x)return;if(x=T,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let O=JSON.parse(T);r.doc.transact(()=>{let J=[...D.keys()];for(let M of J)if(!(M in O))D.delete(M);for(let[M,Be]of Object.entries(O))if(!o.deepEqual(D.get(M),Be))D.set(M,Be)},o.LOCAL_ORIGIN),fe(s)}),ne(()=>{let T=e.session.selection.length>0?Qs(e.session.selection):null,O=r.awareness.getLocalState();if(O)r.awareness.setLocalState({...O,structuralSelection:T})}),ne(()=>{let T=he(e.doc.document);queueMicrotask(()=>{if(k(e)?.session!==s||!s.synced||!s.canWrite)return;let J=he(e.doc.document);if(J!==T||J===s.lastSeenRef)return;s.lastSeenRef=J,re(s),fe(s)})})});let H=Tn(e),de=()=>{let x=[];for(let[T,O]of r.awareness.getStates())if(T!==r.awareness.clientID&&O.user)x.push({clientId:T,state:O});H.peers=x};return de(),r.awareness.on("change",de),s.disposers.push(()=>r.awareness.off("change",de),r.onStatus((x)=>{if(x==="offline"||x==="connecting")H.status="offline";else if(s.synced)H.status="synced"}),r.onReset(()=>{pe(e),Le(e)})),s.synced=!0,s}function I(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function Gn(e){if(Z(e))return"number";if(Xe(e))return"boolean";return n(e)?"string":"object"}function R(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${Gn(e)} ${JSON.stringify(e)}`}function wt(e){return Array.isArray(e)&&e.every((t)=>n(t)||Z(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw I(e,o,`expected a non-empty string, got ${R(r)}`);return r}function Xn(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Rt(e,t,o){let r=t[o];if(!Z(r)||!Number.isFinite(r))throw I(e,o,`expected a finite number, got ${R(r)}`);return r}function Ct(e,t,o){let r=t[o];if(!Z(r)||!Number.isInteger(r))throw I(e,o,`expected an integer, got ${R(r)}`);return r}function Nx(e,t,o,r,i){let s=Rt(e,t,o);if(s<r||s>i)throw I(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function Bi(e,t,o){let r=t[o];if(!Xe(r))throw I(e,o,`expected a boolean, got ${R(r)}`);return r}function Wn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw I(e,o,`${R(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function CC(e,t,o){let r=t[o];if(!wt(r))throw I(e,o,`expected an array of path segments (strings or numbers), got ${R(r)}`);return r}function kO(e,t,o){if(t[o]===null)return null;return CC(e,t,o)}function N$(e,t,o){let r=t[o];if(!Array.isArray(r))throw I(e,o,`expected an array of document paths, got ${R(r)}`);return r.map((i,s)=>{if(!wt(i))throw I(e,o,`entry ${s} is not a document path — expected an array of segments, got ${R(i)}`);return i})}function Se(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function di(e,t){return{description:t,enum:[...e],type:"string"}}function ll(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function A$(e,t={}){return{description:e,type:"number",...t}}function $o(e){return{description:e,type:"boolean"}}function Ax(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function EO(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function We(e){return{description:e,type:"string"}}function zn(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Fe(e){return n(e)?[e]:e}function Jt(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 o=t.items?.type;if(Array.isArray(o))return zn(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function It(e,t){switch(e){case"null":return t===null;case"boolean":return Xe(t);case"string":return n(t);case"number":return Z(t)&&Number.isFinite(t);case"integer":return Z(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return _(t)&&!Array.isArray(t);default:break}return!1}function kt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function Yn(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>It(s,i)))throw I(e,o,`expected ${kt(r)}, got ${R(i)}`);return i}function Dt(e){switch(Jt(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>R(t)).join(" | ")}`;case"const":return`the constant ${R(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>Dt(t)).join(" or ");case"typed":return kt(Fe(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 qn(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Fe(a.type).some((l)=>It(l,i)))continue;try{return jt(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw I(e,o,`expected ${r.map((a)=>Dt(a)).join(" or ")}, got ${R(i)}`)}function jt(e,t,o,r){switch(Jt(r)){case"enum":return Wn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw I(e,o,`expected the constant ${R(r.const)}, got ${R(i)}`);return i}case"one-of":return qn(e,t,o,r.oneOf??[]);case"typed":return Yn(e,t,o,Fe(r.type??[]));case"boolean":return Bi(e,t,o);case"bounded-number":{if(r.type==="integer")Ct(e,t,o);return Nx(e,t,o,r.minimum,r.maximum)}case"number":return Rt(e,t,o);case"integer":return Ct(e,t,o);case"string":return St(e,t,o);case"path":return CC(e,t,o);case"path-list":return N$(e,t,o);default:return t[o]}}function TO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,d]of Object.entries(o)){if(d===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw I(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=d}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=jt(e,o,c,i[c])}return l}var Zn=20,ui="primary",Fm="secondary",F$=2,m=g({activePaneId:ui,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Gr();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Gr().tabOrder}}),u=Th(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Gr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function pn(e){return m.panes.find((t)=>t.id===e)}function Zl(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function Er(e){let t=pn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,E();let{activeTabId:o}=t;if(o){_e(o);let r=m.tabs.get(o);if(r)Ft(r)}}function jm(e){return m.activePaneId===e}function EC(e){let t=e??Gr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Zl(t);if(!r)return null;let i=Xl(r.id);return zm(t),wh(i,t),i.activeTabId=t,m.activePaneId=i.id,E(),_e(t),i}function TC(e){return m.panes.find((t)=>t.id!==e)??Qn(Fm)}function Xl(e){let t=TC(e);if(t.derived)t.derived=null;return t}function Qn(e){let t=pn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function Hm(e){if(m.panes.length<2)return;let t=e===ui?m.panes.find((s)=>s.id!==ui)?.id:e,o=t===void 0?void 0:pn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)wh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),E()}function Bm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function LC(e){U=e??(()=>!0)}var Nt=null;function $C(e){Nt=e}var $t=null;function IC(e){$t=e}function eo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Lt(e){return e.tabOrder.findLast((t)=>U(t))??null}function zm(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Lt(o);if(o.id!==ui&&Bm(o))t.push(o.id)}for(let o of t)Hm(o)}function wh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??no(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function to(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function no(e,t){return m.tabs.get(t)?.pinned===!0?to(e):e.tabOrder.length}function Ql(e,t=null){if(m.projectRoot&&e!==m.projectRoot)wC();m.projectRoot=e,m.projectConfig=t}function qp(e){let t=u.value;return e!==null&&t!==null&&he(t)===he(e)}function Jd(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&he(t)===he(e)}function _e(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var me=null,se=0;function E(){me=null,se=0}function Ft(e){if(S&&e.documentPath)S.selectedPath=e.documentPath}function RC(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Zl(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)E(),_e(e);Ft(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=iv({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??Gr();return wh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=iv({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??Gr(),s;if(t)r.pinned=t.pinned,Am(t);else{if(o){let l=Et(i),c=l?m.tabs.get(l):null;if(c)Xd(c);DC()}let a=o?Et(i):null;if(a)s=i.tabOrder.indexOf(a),Yd(a);wh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Et(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function Xc(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function DC(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)Xc(e)}function Fx(e,t){let o=m.tabs.get(e),r=Zl(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function j$(e,t){let o=m.tabs.get(e),r=Zl(e);if(!o||!r)return;r.tabOrder=_t(r,e,t)}function _t(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((d)=>d!==t),s=i.filter((d)=>m.tabs.get(d)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Yd(e){let t=m.tabs.get(e);if(!t)return;let o=Zl(e),r=o?.activeTabId===e;if(oo(t),Am(t),m.tabs.delete(e),xx(e),zm(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),E(),o&&Bm(o))Hm(o.id);if(!r)return;let i=Gr(),s=$t?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Lt(i);if(a)ae(a);else Nt?.(i.id)}function H$(){let e=[...m.tabs.values()];m.tabs.clear(),Wt(),m.mruOrder=[],E();for(let t of e)Am(t)}function Wt(){m.panes=[{activeTabId:null,derived:null,id:ui,tabOrder:[]}],m.activePaneId=ui}function oo(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,Zn)}function ro(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Mt(e){if(!me)me=m.mruOrder.filter((r)=>m.tabs.has(r)&&U(r)),se=0;let t=me;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function B$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=iv(e);m.tabs.set(r.id,r),Wt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],E(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Am(i);return r}function Ht(e,t={}){ae(e,t)}function dv(e,t,o){let r=pn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=_t(r,e,o);return r}return zm(e),wh(r,e,o),r}function jx(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,vC(e))xx(e),Dm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),E(),Pt(r)}function z$(e,t){e.registerAll([...io(t),...so(t)])}function io(e){let t=()=>eo()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Mt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Mt(-1)}},{args:Se({path:We('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:(o)=>o.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:o,args:r})=>{let i=St("document.open",r,"path"),s=u.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Vp[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...m.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Se({file:We('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:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=Xl(Gr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(Bm(s)&&s.id!==ui)Hm(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" 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:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=ro();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)Fx(o,!r.pinned)}},{args:Se({pinned:$o("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:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=m.activeTabId;if(i&&m.tabs.get(i))Fx(i,Bi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)Xc(o)}}]}function so(e){let t=()=>m.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:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{EC()}},{args:Se({path:We("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:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Gr();if((s.activeTabId?m.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(Xl(s.id).id,i)}},{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:()=>{Er(ui)}},{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:()=>{Er(Fm)}},{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:ao}]}function ao(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===ui){if(e.derived=null,!Bm(e))return}Hm(e?.id??Fm)}
|
|
2
|
+
export{mC,Pn,mx,Yb,Vt,ln,go,gx,Zb,Jc,ZA,gC,bx,Xb,L$,Qb,vx,Wp,Yl,al,ev,Vp,Xs,XA,yx,mh,wx,tv,bC,QA,Dm,xx,vC,nv,uo,bo,_x,gh,Sx,eO,$$,tO,nO,iO,yC,oO,wC,rO,Nm,sO,an,iv,xC,I$,aO,Am,Me,lO,Cx,Qs,kx,cO,Om,Ex,dO,Mm,uO,Hi,Y,Ud,Tx,Lx,_C,hO,ov,pO,fO,SC,mO,Lo,bh,R$,Pm,$x,gO,Yc,Ve,qd,kr,bO,Ix,vO,Rx,yO,wO,Ia,Dx,qr,xO,Up,_O,SO,CO,Gd,Tn,rv,D$,sv,av,St,Xn,Nx,Bi,Wn,CC,kO,N$,Se,di,ll,A$,$o,Ax,EO,We,TO,Kd,Vn,Zc,Ox,Mx,kC,LO,Ra,vh,yh,lv,Px,$O,Jo,IO,RO,DO,NO,cv,O$,AO,M$,P$,ui,Fm,F$,m,u,Gr,pn,Zl,Er,jm,EC,TC,Xl,Hm,Bm,LC,$C,IC,zm,wh,Ql,qp,Jd,RC,_i,Xc,DC,Fx,j$,Yd,H$,B$,Ht,dv,jx,z$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=324F44DC8B3C1D5D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-y1x65h5r.js.map
|