@jxsuite/studio 10.0.0 → 10.2.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-j56903f1.js → 2020-bx702wqa.js} +3 -3
- package/dist/chunks/adapter-pp011m5x.js +4 -0
- package/dist/chunks/add-new-flow-ecqmzz76.js +4 -0
- package/dist/chunks/cf-account-picker-c07znkqt.js +4 -0
- package/dist/chunks/cf-settings-0v2bmqy0.js +4 -0
- package/dist/chunks/components-yn0dn2pq.js +4 -0
- package/dist/chunks/content-source-g0j41yy6.js +4 -0
- package/dist/chunks/{convert-to-repeater-fhdwyg14.js → convert-to-repeater-sbjk7tgn.js} +3 -3
- package/dist/chunks/editor-xz02jeh1.js +4 -0
- package/dist/chunks/entry-commands-kmt02crp.js +4 -0
- package/dist/chunks/extension-sections-0rprf12d.js +4 -0
- package/dist/chunks/file-ops-mexj5qed.js +4 -0
- package/dist/chunks/files-b2tcppdd.js +4 -0
- package/dist/chunks/format-host-btsevv0c.js +4 -0
- package/dist/chunks/fs-events-r0apejva.js +4 -0
- package/dist/chunks/grid-open-n2a8xkht.js +4 -0
- package/dist/chunks/{grid-view-ka55z38f.js → grid-view-tghcwrrt.js} +12 -12
- package/dist/chunks/iframe-host-gx0ypyh3.js +4 -0
- package/dist/chunks/index-bs4k9tr6.js +4 -0
- package/dist/chunks/{index-qb98xhse.js → index-vr006kbt.js} +3 -3
- package/dist/chunks/{javascript-ces13wny.js → javascript-z1g3s9fd.js} +2 -2
- package/dist/chunks/{jsonMode-6md16d4v.js → jsonMode-7szwg8c4.js} +5 -5
- package/dist/chunks/jx-validate-ymf10teh.js +4 -0
- package/dist/chunks/layers-p9nfya38.js +4 -0
- package/dist/chunks/layers-panel-tt1hzhhf.js +4 -0
- package/dist/chunks/lit-html-x18n2sfz.js +4 -0
- package/dist/chunks/media-library-0n45gv8r.js +4 -0
- package/dist/chunks/media-picker-s09at95z.js +4 -0
- package/dist/chunks/{monaco-binding-p8j80s4w.js → monaco-binding-v42w9c1v.js} +3 -3
- package/dist/chunks/monaco-buffer-een2ea0v.js +4 -0
- package/dist/chunks/{monaco-setup-wasktzfg.js → monaco-setup-7bffxd6v.js} +3 -3
- package/dist/chunks/notify-qwb8radt.js +4 -0
- package/dist/chunks/parse-v77xtwv7.js +4 -0
- package/dist/chunks/platform-8jnez0wr.js +4 -0
- package/dist/chunks/publish-panel-aysnj611.js +4 -0
- package/dist/chunks/{publish-quick-vr695j26.js → publish-quick-kpbqs9mz.js} +3 -3
- package/dist/chunks/publish-workspace-nd0a8q99.js +4 -0
- package/dist/chunks/quick-search-vg0jkhk2.js +4 -0
- package/dist/chunks/references-a7v6a0e2.js +4 -0
- package/dist/chunks/right-panel-cvk1vxx5.js +4 -0
- package/dist/chunks/source-control-fsqzc6he.js +4 -0
- package/dist/chunks/studio-05jfwbmf.js +5 -0
- package/dist/chunks/{studio-hy4ye0dx.js → studio-0q5jwddh.js} +7 -7
- package/dist/chunks/{studio-jttyqrmh.js → studio-0w2dr0q8.js} +4 -4
- package/dist/chunks/{studio-xkxetm65.js → studio-1tzpds97.js} +5 -5
- package/dist/chunks/{studio-m48v13s3.js → studio-216b27sv.js} +3 -3
- package/dist/chunks/studio-2ejhqns4.js +5 -0
- package/dist/chunks/studio-2r90cts3.js +16 -0
- package/dist/chunks/{studio-h310mbqm.js → studio-399a25za.js} +4 -4
- package/dist/chunks/studio-399xknkb.js +6 -0
- package/dist/chunks/{studio-wxhy1yh7.js → studio-43y04qck.js} +4 -4
- package/dist/chunks/{studio-06j4en5h.js → studio-4g8yb6jn.js} +2 -2
- package/dist/chunks/{studio-jw0q5j6k.js → studio-4jhw38b2.js} +4 -4
- package/dist/chunks/{studio-3v5cagy9.js → studio-4ncmwqw5.js} +4 -4
- package/dist/chunks/studio-5atwjgkj.js +7 -0
- package/dist/chunks/{studio-gr36vnte.js → studio-5frqk7c0.js} +4 -4
- package/dist/chunks/{studio-9dz76yqc.js → studio-646nn2ys.js} +5 -5
- package/dist/chunks/{studio-tj2s0tks.js → studio-6cwj6xrx.js} +4 -4
- package/dist/chunks/studio-6hzdjfv0.js +5 -0
- package/dist/chunks/{studio-hcsba201.js → studio-71m92v9s.js} +7 -7
- package/dist/chunks/{studio-3c8pp7pb.js → studio-75kcdbsk.js} +4 -4
- package/dist/chunks/{studio-gwrhcrss.js → studio-78pywnp2.js} +5 -5
- package/dist/chunks/{studio-9cxmp61c.js → studio-86r8hp7r.js} +5 -5
- package/dist/chunks/studio-886t6ztg.js +5 -0
- package/dist/chunks/studio-8wnvtr4z.js +5 -0
- package/dist/chunks/studio-8z66jk4z.js +5 -0
- package/dist/chunks/{studio-ajw4k8hp.js → studio-9rbe2xpw.js} +3 -3
- package/dist/chunks/{studio-y26hx9re.js → studio-awxwjawq.js} +4 -4
- package/dist/chunks/studio-b2qpt0xy.js +14 -0
- package/dist/chunks/{studio-dx73md4n.js → studio-bvs9kpst.js} +7 -7
- package/dist/chunks/studio-c71806xz.js +7 -0
- package/dist/chunks/{studio-7dzyz9n8.js → studio-cbwks69x.js} +144 -144
- package/dist/chunks/studio-cg1bfyhf.js +9 -0
- package/dist/chunks/studio-cg710sk9.js +5 -0
- package/dist/chunks/studio-cw0wb9qk.js +7 -0
- package/dist/chunks/studio-cyheys7k.js +5 -0
- package/dist/chunks/studio-ea5m9kg5.js +5 -0
- package/dist/chunks/{studio-ry81j4q1.js → studio-ea74s8c1.js} +4 -4
- package/dist/chunks/{studio-xdpz9rpe.js → studio-efdxjwyp.js} +34 -34
- package/dist/chunks/{studio-agyvzfm4.js → studio-egmw2837.js} +4 -4
- package/dist/chunks/{studio-5tzgq6fx.js → studio-er5f383a.js} +4 -4
- package/dist/chunks/studio-f746039f.js +5 -0
- package/dist/chunks/studio-fmdymd9v.js +5 -0
- package/dist/chunks/studio-gcm12z00.js +6 -0
- package/dist/chunks/{studio-vswcpzk7.js → studio-gj98m8gy.js} +5 -5
- package/dist/chunks/{studio-yg3djpnm.js → studio-hasbgjah.js} +4 -4
- package/dist/chunks/studio-hhp4x8xf.js +6 -0
- package/dist/chunks/{studio-3w35qvay.js → studio-hz5n7x27.js} +4 -4
- package/dist/chunks/{studio-7xag4na8.js → studio-j3d2fjqz.js} +4 -4
- package/dist/chunks/studio-jeraxdgv.js +7 -0
- package/dist/chunks/studio-jvgek9xt.js +5 -0
- package/dist/chunks/studio-jws1a87n.js +5 -0
- package/dist/chunks/studio-k2sz13zg.js +5 -0
- package/dist/chunks/studio-k3m4jkdk.js +5 -0
- package/dist/chunks/{studio-r17asgs0.js → studio-kg1abnz0.js} +4 -4
- package/dist/chunks/{studio-s0fg2wav.js → studio-kg5ya5r2.js} +4 -4
- package/dist/chunks/studio-khwbgrtg.js +5 -0
- package/dist/chunks/studio-mx6wzh25.js +5 -0
- package/dist/chunks/studio-mxs3ar9t.js +5 -0
- package/dist/chunks/studio-nm4szey4.js +5 -0
- package/dist/chunks/studio-nqxqf8p2.js +4 -0
- package/dist/chunks/{studio-h5tpz5ke.js → studio-pjtntksy.js} +4 -4
- package/dist/chunks/studio-qh8berdz.js +5 -0
- package/dist/chunks/studio-qn7z4krm.js +5 -0
- package/dist/chunks/studio-qyed0ah6.js +5 -0
- package/dist/chunks/{studio-x97ay0v4.js → studio-r4bcdwhq.js} +4 -4
- package/dist/chunks/{studio-wxdcd42g.js → studio-r7pf0rkv.js} +6 -6
- package/dist/chunks/studio-rtfnhrdg.js +5 -0
- package/dist/chunks/{studio-fy7jzj9j.js → studio-rzqaz21g.js} +4 -4
- package/dist/chunks/studio-s5tzw84t.js +5 -0
- package/dist/chunks/{studio-1e8dw2w2.js → studio-sevbc3xv.js} +4 -4
- package/dist/chunks/{studio-ewarnzm4.js → studio-sxdb9h3q.js} +6 -6
- package/dist/chunks/studio-t51y8v1d.js +5 -0
- package/dist/chunks/{studio-k3bcy02e.js → studio-t98vq4r6.js} +4 -4
- package/dist/chunks/studio-th7z3fg7.js +5 -0
- package/dist/chunks/studio-tsxpqvh0.js +6 -0
- package/dist/chunks/{studio-396srjbk.js → studio-v1yascv2.js} +4 -4
- package/dist/chunks/{studio-ekgtrndg.js → studio-wc6za3zs.js} +4 -4
- package/dist/chunks/{studio-ndskgqef.js → studio-wxq6v5sv.js} +4 -4
- package/dist/chunks/{studio-4kzbrr5t.js → studio-y60sts62.js} +3 -3
- package/dist/chunks/studio-ybnwymxw.js +5 -0
- package/dist/chunks/studio-zndrqawb.js +5 -0
- package/dist/chunks/studio-zwaxn5s2.js +5 -0
- package/dist/chunks/{tsMode-h6tkz0ea.js → tsMode-f54j66ym.js} +5 -5
- package/dist/chunks/workspace-home-x1787wpv.js +4 -0
- package/dist/chunks/workspace-zpe1np43.js +4 -0
- package/dist/chunks/{ws-client-e951my95.js → ws-client-e8kj684q.js} +3 -3
- package/dist/manifest.json +76 -75
- package/dist/studio.js +83 -81
- package/package.json +4 -4
- package/src/browse/library-model.ts +56 -23
- package/src/commands/context.ts +1 -0
- package/src/editor/shortcuts.ts +3 -0
- package/src/panels/data-grid.ts +0 -4
- package/src/panels/settings-menu.ts +3 -3
- package/src/panels/settings-pane.ts +42 -56
- package/src/platform-errors.ts +17 -1
- package/src/platforms/cloud.ts +14 -0
- package/src/publish/publish-changes.ts +136 -4
- package/src/services/ai-import-tools.ts +6 -3
- package/src/services/ai-models.ts +65 -11
- package/src/services/ai-settings.ts +45 -5
- package/src/services/document-assistant.ts +5 -2
- package/src/services/settings/definitions.ts +19 -0
- package/src/settings/contributed-section.ts +16 -7
- package/src/settings/css-vars-editor.ts +4 -4
- package/src/settings/general-settings.ts +1 -4
- package/src/settings/preferences-accounts.ts +2 -2
- package/src/settings/preferences-dialog.ts +4 -2
- package/src/settings/project-sections.ts +1 -1
- package/src/settings/section-registry.ts +5 -4
- package/src/settings/settings-document.ts +33 -24
- package/src/settings/settings-workspace.ts +205 -0
- package/src/shell.ts +31 -6
- package/src/surfaces/ai-credentials-form.json +59 -5
- package/src/surfaces/ai-credentials-form.ts +15 -2
- package/src/surfaces/commandbar.ts +7 -3
- package/src/surfaces/settings-contributed.json +4 -4
- package/src/surfaces/settings-contributed.ts +2 -2
- package/src/surfaces/settings-pane.json +262 -180
- package/src/surfaces/settings-pane.ts +63 -14
- package/src/types.ts +14 -0
- package/src/ui/ai-credentials-form.ts +128 -11
- package/src/ui/regions.ts +5 -5
- package/src/workspace/tab-workspace.ts +3 -2
- package/src/workspace/workspace-home.ts +18 -4
- package/src/workspace/workspace-ids.ts +40 -7
- package/dist/chunks/adapter-wc5zvg9a.js +0 -4
- package/dist/chunks/add-new-flow-snx1s4b0.js +0 -4
- package/dist/chunks/cf-account-picker-xyqw0jex.js +0 -4
- package/dist/chunks/cf-settings-hp1pjm0n.js +0 -4
- package/dist/chunks/components-nkwphrx3.js +0 -4
- package/dist/chunks/content-source-6a253wmk.js +0 -4
- package/dist/chunks/editor-wqrc68ca.js +0 -4
- package/dist/chunks/entry-commands-nef0wrmp.js +0 -4
- package/dist/chunks/extension-sections-8ez2rrk8.js +0 -4
- package/dist/chunks/file-ops-y3w71k1n.js +0 -4
- package/dist/chunks/files-de90apn9.js +0 -4
- package/dist/chunks/format-host-zfjz4rzm.js +0 -4
- package/dist/chunks/fs-events-77c0mr0x.js +0 -4
- package/dist/chunks/grid-open-4n4fjfpf.js +0 -4
- package/dist/chunks/iframe-host-na2mywz4.js +0 -4
- package/dist/chunks/index-ewmgdb7c.js +0 -4
- package/dist/chunks/jx-validate-b309c020.js +0 -4
- package/dist/chunks/layers-8rn8y6qv.js +0 -4
- package/dist/chunks/layers-panel-eyah7h9z.js +0 -4
- package/dist/chunks/lit-html-wyqw04y2.js +0 -4
- package/dist/chunks/media-library-gs3np47y.js +0 -4
- package/dist/chunks/media-picker-tt7dk4tb.js +0 -4
- package/dist/chunks/monaco-buffer-wsf6cmnq.js +0 -4
- package/dist/chunks/notify-qwst108r.js +0 -4
- package/dist/chunks/parse-n8dfxnqf.js +0 -4
- package/dist/chunks/platform-c16mqvmp.js +0 -4
- package/dist/chunks/publish-panel-d34bhvwj.js +0 -4
- package/dist/chunks/publish-workspace-2yr60mt4.js +0 -4
- package/dist/chunks/quick-search-e6xsdv0d.js +0 -4
- package/dist/chunks/references-gsj6trdv.js +0 -4
- package/dist/chunks/right-panel-33jv1knc.js +0 -4
- package/dist/chunks/source-control-bj9bejjv.js +0 -4
- package/dist/chunks/studio-03mqh8ax.js +0 -5
- package/dist/chunks/studio-0ydxv2mr.js +0 -7
- package/dist/chunks/studio-2hsqbq7b.js +0 -7
- package/dist/chunks/studio-2j86y34y.js +0 -6
- package/dist/chunks/studio-2ks6ka4g.js +0 -5
- package/dist/chunks/studio-34jrz12k.js +0 -5
- package/dist/chunks/studio-35vrtpdq.js +0 -5
- package/dist/chunks/studio-38g0jdz7.js +0 -5
- package/dist/chunks/studio-3zge48z4.js +0 -7
- package/dist/chunks/studio-45gyxpcq.js +0 -5
- package/dist/chunks/studio-5wzdy1jc.js +0 -16
- package/dist/chunks/studio-732mw0g8.js +0 -5
- package/dist/chunks/studio-771k2n12.js +0 -5
- package/dist/chunks/studio-88bmt9rh.js +0 -5
- package/dist/chunks/studio-c1pxszat.js +0 -5
- package/dist/chunks/studio-cpkamjdn.js +0 -14
- package/dist/chunks/studio-d038kqbs.js +0 -5
- package/dist/chunks/studio-d83m0wyq.js +0 -5
- package/dist/chunks/studio-dbxv7w4s.js +0 -5
- package/dist/chunks/studio-de1s2x9v.js +0 -5
- package/dist/chunks/studio-epenqmvk.js +0 -7
- package/dist/chunks/studio-et2q4s8n.js +0 -5
- package/dist/chunks/studio-h7weqf2q.js +0 -5
- package/dist/chunks/studio-hwejq03c.js +0 -5
- package/dist/chunks/studio-k3a8rp3d.js +0 -5
- package/dist/chunks/studio-p1n2xjda.js +0 -5
- package/dist/chunks/studio-pgm83a2f.js +0 -6
- package/dist/chunks/studio-pqqq6v85.js +0 -5
- package/dist/chunks/studio-psh8mwnw.js +0 -4
- package/dist/chunks/studio-rzg8hnkf.js +0 -5
- package/dist/chunks/studio-tyw7tk0x.js +0 -5
- package/dist/chunks/studio-v9ywz2se.js +0 -6
- package/dist/chunks/studio-vzgmyt0v.js +0 -5
- package/dist/chunks/studio-x08a3m0a.js +0 -5
- package/dist/chunks/studio-x3mjr5cc.js +0 -5
- package/dist/chunks/studio-xh683qzy.js +0 -5
- package/dist/chunks/studio-yx8hzqja.js +0 -5
- package/dist/chunks/studio-zg16eeq1.js +0 -5
- package/dist/chunks/studio-zgx7svjd.js +0 -9
- package/dist/chunks/studio-zkq3r91p.js +0 -5
- package/dist/chunks/workspace-home-zkkrxq3r.js +0 -4
- package/dist/chunks/workspace-tdqqjqaa.js +0 -4
- package/src/settings/settings-dialog.ts +0 -192
- package/src/surfaces/settings-dialog.json +0 -51
- package/src/surfaces/settings-dialog.ts +0 -169
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{p,_e}from"./studio-03mqh8ax.js";import{Pn,tv,Vt,ln,go,wx,tO,Tn,Oe,$a,Ix,St,Rx,Hi,Vn,Ce,ui,j$,To,We,Un,Y,or,vh,Vp,Qe,Up,hi,m,u,pn,kr,qp}from"./studio-vzgmyt0v.js";import{ge,ne,de,C}from"./studio-4kzbrr5t.js";import{st,bo,Gp,Zc}from"./studio-x08a3m0a.js";import{Qc,Wi}from"./studio-3w35qvay.js";import{YS,Ne,Fc,jc}from"./studio-1e8dw2w2.js";import{L$,ph}from"./studio-k3bcy02e.js";import{He,cx,Js,nn,rh,Md,zb,sh}from"./studio-x3mjr5cc.js";import{Fp,jd,Yb,Gc,Ts,Eo,Ls,Ea,Hp,Jl,Zb,GA,_r,oo,uh,Xb,ae}from"./studio-cpkamjdn.js";import{ol,zr,qs,Gs,Wr}from"./studio-ewarnzm4.js";import{to,XN,HL,Xw,Qw,Es,Ip,il,ex,BL,h,YL}from"./studio-5wzdy1jc.js";import{rr,Ut,zi,Er,S,_h,Xp,Sh,xn}from"./studio-45gyxpcq.js";import{oe,ta}from"./studio-ekgtrndg.js";import{Zx}from"./studio-5tzgq6fx.js";import{n,Z,Q,_,v,Me,Go,Gn,it,td}from"./studio-zkq3r91p.js";import{le}from"./studio-7xag4na8.js";var at="jx:canvas";function Qt(e){let{target:t,source:o,targetOrigin:r,acceptOrigin:i,token:a}=e,l=new Set,s=(c)=>{if(i!=="*"&&c.origin!==i)return;let d=c.data;if(!_(d)||!(at in d)||d[at]!==a)return;let f="payload"in d?d.payload:void 0;for(let g of l)g(f)};return o.addEventListener("message",s),{dispose(){l.clear(),o.removeEventListener("message",s)},onMessage(c){return l.add(c),()=>l.delete(c)},post(c){t.postMessage({[at]:a,payload:c},r)}}}var lt=null;function en(){return lt}function Eb(e){if(lt){lt(e);return}window.open(e,"_blank","noopener,noreferrer")}function vr(){return bo(m.activePaneId)}function vt(e){let t=pn(e),o=t?.derived,r=o?.kind==="lens"?pn(o.sourcePaneId)?.activeTabId:t?.activeTabId;return r?m.tabs.get(r)??null:null}function Hr(e){return pn(e)?.derived??null}function kS(e){if(!e)return[];let t=[];for(let o of m.panes)if(vt(o.id)?.id===e.id)t.push(bo(o.id));return t}function W(e){for(let t of Gp()){let o=t.panels.find((r)=>r.canvas===e);if(o)return{panel:o,surface:t}}return null}function tn(e){let t=e.canvas,o=t?W(t):null;return o?vt(o.surface.paneId):null}function Nc(e){let t=e?.session.ui,o=t?.canvasMode??"design";return t?.preview&&(o==="edit"||o==="design")?"preview":o}function Wo(e){let t=Hr(e);if(t?.kind==="lens"){let o=t.mode;return vt(e)?.session.ui?.preview&&(o==="edit"||o==="design")?"preview":o}return Nc(vt(e))}function tl(e){let t=Hr(e);if(t?.kind==="lens"&&t.preset==="breakpoint")return t.media;return vt(e)?.session.ui.activeMedia??null}function ct(e){return Zc(e)?.paneId??hi}function ce(e){return vt(ct(e))}function Se(e,t,o,r=null,i=null,a=[]){if(!e.state)e.state={};let l={};if(i!==null)l.defaultLocale=i.defaultLocale,l.locales=i.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...l,...t.state};let s=(n(e.$lang)?e.$lang:void 0)??tO(o.urlPattern,i)??t.defaults?.lang,c=a.map((f)=>({code:f.locale,current:f.urlPattern===o.urlPattern,dir:tv(f.locale),label:Vt(f.locale),url:f.urlPattern})),d={params:o._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:o.urlPattern};if(c.length>0)d.alternates=c;if(s!==void 0)d.dir=tv(s),d.locale=s;if(e.state.$page=d,t.state){for(let[f,g]of Object.entries(t.state))if(f!=="$site"&&f!=="$page"&&!(f in e.state))e.state[f]=g}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[f,g]of Object.entries(t.imports))if(!(f in e.imports))e.imports[f]=r&&(g.startsWith("./")||g.startsWith("../"))?r(g,o):g}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let f=new Set,g=[];for(let y of[...t.$elements,...e.$elements]){let b=n(y)?y:_(y)?y.$ref:void 0;if(b&&!f.has(b))f.add(b),g.push(y)}e.$elements=g}return e}var Ar=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;function on(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function yr(e){let t=on(e),o=t.slice(t.lastIndexOf("/")+1),r=o.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(o.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let i=[],a=!1,l=!1,s=t.replaceAll(Ar,(c,d,f)=>{if(a=!0,d)return l=!0,i.push(d),"*";return i.push(f),`:${f}`});return{isCatchAll:l,isDynamic:a,params:i,urlPattern:s}}function Ju(e){if(!e)return"/";return yr(e).urlPattern}function Ac(e){if(!e)return[];return yr(e).params}function Yu(e,t){let o=on(e).split("/");if(!o.every((l)=>l!==""&&l[0]!=="_"))return!1;if(t===void 0)return!0;let r=o.at(-1)??"",i=r.lastIndexOf("."),a=i>0?r.slice(i).toLowerCase():"";return a!==""&&new Set(t).has(a)}function ES(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var $r=new Set(["img","video","source","iframe","audio"]),rn="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ut="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%3E%3Crect%20width='32'%20height='32'%20fill='%23d0d0d0'/%3E%3C/svg%3E";function yN(e,t){e.addEventListener("error",(o)=>{let{target:r}=o;if(r instanceof HTMLImageElement&&r.getAttribute("src")!==ut)r.setAttribute("src",ut),r.removeAttribute("srcset"),r.dataset.placeholder=""},{capture:!0,signal:t})}var Ir=/(src|poster|image|bg|background|icon|logo|photo|avatar|thumbnail|cover|banner)$/i;function an(e){return Ir.test(e)}var Dr=/(?<![\w$.])(?:item|index|\$map)\b/u;function B(e){if(n(e))return e.includes("${")&&Dr.test(e);return Gn(e)&&n(e.$ref)&&/^(?:#\/)?\$map\//u.test(e.$ref)}function we(e,t){if(e==="href"||e==="action")return"";if(an(e))return ut;if(n(t))return dt(t);return Gn(t)&&n(t.$ref)?fn(t.$ref):""}var Jr=new Set(["p","h1","h2","h3","h4","h5","h6","blockquote","li","dt","dd","th","td","span","strong","em","small","mark","code","abbr","q","sub","sup","time","a","button","label","legend","caption","summary","pre","option"]),Lr=new Set(["div","section","article","aside","header","footer","main","nav","figure","figcaption","details","fieldset","form","ul","ol","dl","table"]);var jr=["width","height","inlineSize","blockSize"];function Fr(e){let{style:t}=e;if(!_(t))return!1;return jr.some((o)=>{let r=t[o],i=Z(r)?String(r):n(r)?r.trim():"";return i!==""&&i!=="auto"})}function Vr(e){if(!e.tagName||e.textContent||e.innerHTML)return null;if(e.$__layout)return null;if(Array.isArray(e.children)&&e.children.length>0)return null;if(Fr(e))return null;if(Jr.has(it(e.tagName)))return"empty-text-placeholder";if(Lr.has(it(e.tagName)))return"empty-container-placeholder";return null}function dt(e){return e.replaceAll(/\$\{([^}]+)\}/g,"❪ $1 ❫")}function qr(e,t){let o=e.map;return{children:_(o)?[F(o,Kr(e.items,t))]:[],className:"repeater-perimeter",tagName:"div"}}function sn(e){return JSON.stringify(e)}function cn(e){let t=e.startsWith("#/")?e.slice(2):e,[o,...r]=t.split("/"),i=o==="state"||o==="$map"?o:null;if(i===null)return null;let a=r.map((l)=>l.replaceAll("~1","/").replaceAll("~0","~"));return i+a.map((l)=>`?.[${sn(l)}]`).join("")}function pt(e,t){if(t===null)return`(${e})`;return`((r) => ((item, index, $map) => (${e}))(r, 0, { index: 0, item: r }))(${t})`}function Kr(e,t){if(Array.isArray(e))return`${sn(e)}[0]`;if(Me(e)){let r=cn(e.$ref);return r===null?null:`${pt(r,t)}?.[0]`}let o=n(e)?un(e):[];if(n(e)&&o.length===1&&Ur(e,o[0]))return`${pt(o[0].expr,t)}?.[0]`;return null}function Ur(e,t){return t.start===0&&t.end===e.length-1}function un(e){let t=[],o=e.indexOf("${");while(o!==-1){let r=0,i=-1;for(let a=o+1;a<e.length;a+=1)if(e[a]==="{")r+=1;else if(e[a]==="}"){if(r-=1,r===0){i=a;break}}if(i===-1)break;t.push({end:i,expr:e.slice(o+2,i),start:o}),o=e.indexOf("${",i+1)}return t}function dn(e,t=null){let o=un(e);if(o.length===0)return e;let r="",i=0;for(let{start:a,end:l,expr:s}of o)r+=e.slice(i,a),r+=`\${(() => { try { return ${pt(s,t)}; } catch { return ""; } })()}`,i=l+1;return r+e.slice(i)}function Gr(e,t){let o=e.startsWith("#/")?e.slice(2):e;if(o!=="$map"&&!o.startsWith("$map/"))return{$ref:e};let r=cn(e);return t===null||r===null?void 0:dn(`\${${r}}`,t)}function fn(e){return`{${e.startsWith("#/state/")?e.slice(8):e}}`}function ft(e,t=null){return F(e,t)}function F(e,t){if(Array.isArray(e))return e.map((s)=>F(s,t));if(!Gn(e))return e;if(e.$prototype==="Array")return qr(e,t);let o=e,r={},i=!1,a=n(o.tagName)&&$r.has(o.tagName);if(a){let{attributes:s,src:c}=o,d=s?.src,f=o.poster,g=s?.poster;if(!(c&&c!==""||d&&d!=="")&&!(f&&f!==""||g&&g!==""))i=!0}for(let[s,c]of Object.entries(o))if(s==="state"||s==="$media"||s==="$elements")r[s]=c;else if(s==="$props"&&_h(c)){let d={};for(let[f,g]of Object.entries(c))if(!B(g))d[f]=g;else if(n(g))d[f]=an(f)||f==="href"||f==="action"?we(f,g):dn(g,t);else if(Me(g)){let y=Gr(g.$ref,t);if(y!==void 0)d[f]=y}else d[f]=g;r[s]=d}else if(s==="children")if(Array.isArray(c))r.children=c.map((d)=>F(d,t));else if(Gn(c)&&c.$prototype==="Array")r.children=[F(c,t)];else r.children=F(c,t);else if(s==="cases"&&o.$switch&&_h(c)){let[d]=Object.entries(c);if(d){let[,f]=d;r.children=_h(f)&&!(Gn(f)&&f.$ref)?[F(f,t)]:[{style:{background:"color-mix(in srgb, var(--danger) 8%, transparent)",border:"1px dashed color-mix(in srgb, var(--danger) 40%, transparent)",borderRadius:"4px",color:"var(--danger)",fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:"11px",fontStyle:"italic",padding:"6px 10px"},tagName:"div",textContent:`[$switch: ${Object.keys(c).join(" | ")}]`}]}}else if(s==="attributes"&&a&&_h(c)){let d={};for(let[f,g]of Object.entries(c))if((f==="src"||f==="poster")&&(g===""||g==null||B(g)))i=!0,d[f]=rn;else d[f]=B(g)?we(f,g):g;r.attributes=d}else if(s==="attributes"&&_h(c)){let d={};for(let[f,g]of Object.entries(c))d[f]=B(g)?we(f,g):g;r.attributes=d}else if(s==="style")if(_h(c)){let d={};for(let[f,g]of Object.entries(c))if(!B(g))d[f]=g;r.style=d}else r.style=c;else if(s==="$switch"&&n(c)&&c.includes("${"))r[s]=dt(c);else if(s==="textContent"&&n(c)&&c.includes("${"))r[s]=dt(c);else if(s==="textContent"&&Gn(c)&&c.$ref)r[s]=fn(c.$ref);else if(a&&(s==="src"||s==="poster"))if(c===""||c==null||B(c))i=!0,r[s]=rn;else r[s]=c;else if(B(c))r[s]=we(s,c);else if(n(c)||Gn(c)&&c.$ref)r[s]=c;else r[s]=F(c,t);let l=Vr(r);if(l)r.className=r.className?`${r.className} ${l}`:l;if(i){let s=n(r.className)?r.className:"";if(!s.includes("empty-media-placeholder"))r.className=s?`${s} empty-media-placeholder`:"empty-media-placeholder"}return r}function TS(e){let t=e.document?.$paths,o=e.frontmatter?.$paths;return t??o??null}var Te=new Map;function wN(){Te.clear()}function xN(e,t){if(!t)return Promise.resolve({});let o=`${e??""}::${JSON.stringify(t)}`,r=Te.get(o);if(!r)r=Zr(t).catch((i)=>(Te.delete(o),console.warn("page-params: failed to enumerate $paths values:",i),{})),Te.set(o,r);return r}async function Zr(e){if(Array.isArray(e)){let t={};for(let o of e)for(let[r,i]of Object.entries(o))Ee(t,r,i);return t}if("contentType"in e&&n(e.contentType)&&e.contentType){let t=e.param??"slug",o=e.field??"id",r=await Xr(e.contentType),i={[t]:[]};if(!Array.isArray(r))return i;let a=r;for(let l of a)Ee(i,t,o==="id"?l.id:l.data?.[o]??l.id);return i}if("values"in e&&Array.isArray(e.values)){let t=e.param??"value",o={[t]:[]};for(let r of e.values)Ee(o,t,r);return o}if("$ref"in e&&n(e.$ref)&&e.$ref){let t=e.param??"id",o=e.field??"id",r=await p().readFile(e.$ref.replace(/^\.\//,"")),i=JSON.parse(r),a={[t]:[]};if(!Array.isArray(i))return a;for(let l of i)Ee(a,t,v(l)?l[o]??l.id??l:l);return a}return{}}async function Yr(){let e=await Qc();for(let t of e){let o=t.classes?.find((r)=>r.name==="ContentCollection");if(o)return o.path}return"@jxsuite/parser/ContentCollection.class.json"}async function Xr(e){let t={$prototype:"ContentCollection",$src:await Yr(),contentType:e},o=p();if(o.resolveClass)return o.resolveClass(t);return fetch("/__jx_resolve__",{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}).then((r)=>{if(!r.ok)throw Error(`Class resolution failed: ${r.status}`);return r.json()})}function Ee(e,t,o){if(o===null||o===void 0||o==="")return;let r=String(o);e[t]??=[];let i=e[t];if(!i.includes(r))i.push(r)}function mn(e,t,o){if(Object.keys(t).length===0)return e;let r=yn(e,t);return r.state??={},r.state.$page={params:{...t},title:n(r.title)?r.title:"",url:Ju(o)},r}function gn(e){if(!e)return[];return Object.keys(e).filter((t)=>{let o=e[t];return v(o)&&n(o.$prototype)&&n(o.$src)&&JSON.stringify(o).includes('"#/$params/')})}async function hn(e,t,o){if(t.length===0)return;let r=p(),{resolveClass:i}=r;if(!i)return;let{state:a}=e;if(!a)return;await Promise.all(t.map(async(l)=>{let s=a[l];if(!v(s))return;let c={...s};if(o)c.$base=o;try{a[l]=await i.call(r,c)}catch(d){console.warn(`page-params: failed to resolve state.${l} for preview:`,d)}}))}function vn(e,t){let o=Qr(e,t);if(o!==null)return o;if(Array.isArray(e))return e.map((r)=>vn(r,t));return v(e)?yn(e,t):e}function yn(e,t){let o={};for(let[r,i]of Object.entries(e))o[r]=vn(i,t);return o}function Qr(e,t){if(!Me(e)||!e.$ref.startsWith("#/$params/"))return null;return t[e.$ref.slice(10)]??null}function LS(e){let t=e?.tagName;return n(t)&&t.includes("-")}function ei(e){return _(e)&&!Array.isArray(e)}function bn(e){if(e===void 0)return null;if(ei(e)){if(e.$expression||e.$compute||e.$prototype||e.$handler)return null;return"default"in e||"type"in e?"signal":"literal"}return n(e)&&e.includes("${")?null:"literal"}function _N(e){let t=e?.state??{},o=[];for(let[r,i]of Object.entries(t)){if(td(r))continue;let a=bn(i);if(!a)continue;let l=a==="signal"?i.default:i;o.push({name:r,value:l})}return o}function Cn(e,t){let o={...e.state},r=!1;for(let[i,a]of Object.entries(t)){let l=o[i],s=bn(l);if(!s)continue;o[i]=s==="signal"?{...l,default:a}:a,r=!0}if(!r)return e;return{...e,state:o}}var ti=new Set(["data","media","metadata","news","series","species"]),ni=new Set(["archive","catalog","catalogue","collection","directory","faq","gallery","inventory","library","menu","portfolio","showcase"]);function $S(e){return e.replaceAll(/[_-]+/g," ").replaceAll(/([a-z\d])([A-Z])/g,"$1 $2").trim().replaceAll(/\s+/g," ").toLowerCase()}function Zu(e){let t=/[_-]|[a-z\d][A-Z]/.test(e)?$S(e):e,o=t.lastIndexOf(" "),r=t.slice(o+1);if(ni.has(r.toLowerCase()))return`${t} item`;return`${t.slice(0,o+1)}${oi(r)}`}function oi(e){if(ti.has(e.toLowerCase()))return e;if(/[^aeiou]ies$/.test(e))return`${e.slice(0,-3)}y`;if(/(?:ss|x|ch|sh|z)es$/.test(e))return e.slice(0,-2);if(/(?:us|is|ss)$/.test(e))return e;if(e.endsWith("s"))return e.slice(0,-1);return e}function Tb(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Lb(e){return(e.replaceAll("\\","/").split("/").pop()??e).replace(/\.[^.]+$/,"").replaceAll(/[-_]+/g," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())}var di="pages";function mt(){return S?.projectConfig?.content??{}}function Sn(e){return e!==void 0&&/\.[\da-z]+$/i.test(e.replace(/\/+$/,""))}var ri={fileBacked:!1,item:"page",key:di,kind:"pages",title:"Pages"};function wm(){let e=Object.entries(mt()).map(([t,o])=>({fileBacked:Sn(o.source),item:Zu(t),key:t,kind:"collection",title:Tb($S(t))}));return[ri,...e]}function YT(){return wm().map((e)=>e.key)}function Fw(e){let t=mt()[e]?.source;return t!==void 0&&Sn(t)?t.replace(/^\.\//,""):null}function SN(e){return mt()[e]?.schema??null}function Wl(e){return wm().find((t)=>t.key===e)??null}function Vl(e){if(!e)return null;let t=e.replaceAll("\\","/").replace(/^\.\//,"");if(Js.has(nn(t)))return null;if(t.startsWith("pages/"))return Yu(t)?di:null;return Un(t)?.name??null}function Xu(e){if(!e)return!1;let t=Un(e);if(!t||t.fileBacked)return!1;let o=nn(e);return o!==".json"&&o!==".csv"}function CN(e,t){if(e===void 0||t)return{entries:!0,pages:!0,scan:!0};let o=e.map((r)=>r.replaceAll("\\","/").replace(/^\.\//,""));return{entries:o.some((r)=>{let i=Vl(r);return i!==null&&i!==di}),pages:o.some((r)=>r.startsWith("pages/")),scan:!1}}function ii(e,t,o){let r=e?.state??t?.state,i=`#/$params/${o}`;for(let a of Object.values(v(r)?r:{})){if(!v(a)||a.$prototype!=="ContentEntry")continue;let{contentType:l,id:s}=a;if(v(s)&&s.$ref===i&&n(l)&&l!=="")return l}return null}function IS(e,t){let o=TS({document:e,frontmatter:t}),r=null,i=null,a=null,l=null;if(o&&!Array.isArray(o)&&"contentType"in o){let d=o.contentType;r=n(d)&&d!==""?d:null;let f="param"in o?o.param:void 0;i=n(f)&&f!==""?f:null;let g="field"in o?o.field:void 0;a=n(g)&&g!==""&&g!=="id"?g:null}else if(o&&!Array.isArray(o)&&"values"in o){let d="param"in o?o.param:void 0,f=n(d)&&d!==""?d:null;r=f===null?null:ii(e,t,f),i=r===null?null:f;let g=o.values;l=r!==null&&Array.isArray(g)?g.flatMap((y)=>{let b=ht(y);return b===null?[]:[b]}):null}let s=e?.$layout??t?.$layout,c=n(s)||s===!1?s:void 0;return{contentType:r,field:a,layout:c,param:i,...l!==null&&{values:l}}}async function ZT(e){let t={contentType:null,field:null,layout:void 0,param:null};try{let o=await p().readFile(e);if(e.endsWith(".json"))return IS(JSON.parse(o),null);let{parseSourceForPath:r}=await (le("y3w71k1n"),import("./file-ops-y3w71k1n.js")),i=await r(e,o);return IS(i.document,i.frontmatter)}catch{return t}}var V=null,ue=null,gt=0,Re=new Set;async function wn(e,t){let o;try{o=await p().listDirectory(e)}catch{return}await Promise.all(o.map(async(r)=>{if(r.type==="directory")await wn(r.path,t);else t.push(r.path)}))}async function ai(){let e=[];await wn("pages",e);let t=e.filter((a)=>a.includes("[")&&Yu(a)).toSorted(),o=await Promise.all(t.map(async(a)=>[a,await ZT(a)])),{i18n:r}=ln(S?.projectConfig??{}),i=new Map;for(let[a,l]of o)if(l.contentType){let s={field:l.field,layout:l.layout,locale:wx(a,r),param:l.param,path:a,pattern:yr(a).urlPattern,...l.values&&{values:l.values}};i.set(l.contentType,[...i.get(l.contentType)??[],s])}return i}function yt(){if(V)return Promise.resolve(V);if(!_e()||!S)return Promise.resolve(new Map);if(!ue){let e=gt;ue=ai().then((t)=>{if(e===gt){V=t,ue=null;for(let o of Re)o()}return t})}return ue}function En(e,t){if(!e||e.length===0)return null;let o=Pn(t),r=ln(S?.projectConfig??{}).i18n?.defaultLocale??null;return(o===null?void 0:e.find((i)=>i.locale===o))??(r===null?void 0:e.find((i)=>i.locale===r))??e.find((i)=>i.locale===null)??e[0]}function Oc(e){if(!e)return null;return go(e,ln(S?.projectConfig??{}).i18n)}function Qu(e,t){if(!V){yt();return}return En(V.get(e),t)}function kN(e){if(!V){yt();return}return V.get(e)??[]}async function Ae(e,t){let o=await yt();return En(o.get(e),t)}function $b(){gt+=1,V=null,ue=null}function Cp(e){return Re.add(e),()=>{Re.delete(e)}}function ht(e){if(n(e)&&e!=="")return e;return Z(e)&&Number.isFinite(e)?String(e):null}function RS(e,t,o){if(!e)return null;let r=t.split("/").pop()??t,i=r.lastIndexOf("."),a=i>0?r.slice(0,i):r,l=e.field===null?null:ht(o?.[e.field]),s=t.endsWith(".json")?ht(o?.id):null,c=l??s??a;if(e.values&&!e.values.includes(c))return null;if(e.param)return e.pattern.replace(`:${e.param}`,c);return e.pattern.replace(/:[A-Za-z_]\w*/,c)}function DS(e,t){if(e===!1)return null;if(n(e)&&e!=="")return e;if(t?.layout===!1)return null;if(n(t?.layout)&&t.layout!=="")return t.layout;return S?.projectConfig?.defaults?.layout??null}function EN(){$b(),Re.clear()}function si(e,t){let o=t.split("/"),r={};for(let[i,a]of e.split("/").entries()){let l=o[i];if(a.startsWith(":")&&l!==void 0)r[a.slice(1)]=l}return r}async function li(e){let{documentPath:t,fields:o,isEntry:r,params:i}=e;if(!r)return{_pathParams:{...i},sourcePath:t,urlPattern:Ju(t)};let a=Un(t),l=a?await Ae(a.name,Oc(t)):null,s=RS(l,t,o);if(!l||s===null)return{_pathParams:{},sourcePath:t,urlPattern:l?.pattern??"/"};return{_pathParams:si(l.pattern,s),sourcePath:l.path,urlPattern:s}}async function Mn(e,t){if(!t)return null;let o=await li(e),r=e.fields?.title,i=n(e.title)?e.title:n(r)?r:null,a={state:{}};if(i!==null)a.title=i;if(n(e.lang))a.$lang=e.lang;let l=Se(a,t,o,null,ln(t).i18n),{$page:s,$site:c}=l.state??{};return s===void 0||c===void 0?null:{$page:s,$site:c}}var $e=new Map;function NS(){$e=new Map}function ci(e){if(!e.startsWith("#/state/"))return null;let[t]=e.slice(8).split("/");return t?t.replaceAll("~1","/").replaceAll("~0","~"):null}function xt(e){if(n(e))return e.includes("${");if(Array.isArray(e))return e.some((t)=>xt(t));return v(e)&&Object.values(e).some((t)=>xt(t))}function Nn(e,t){if(n(e.$src))return e.$src;return n(e.$prototype)&&Object.hasOwn(t,e.$prototype)?t[e.$prototype]??null:null}function bt(e,t={}){return v(e)&&n(e.$prototype)&&Nn(e,t)!==null&&!xt(e)}function On(e,t){return Object.entries(e.state??{}).filter(([,o])=>v(o)&&!n(o.$src)&&bt(o,t)).map(([o])=>o)}function Rn(e){let t=new Set,o=(i)=>{if(Array.isArray(i)){for(let a of i)o(a);return}if(!Gn(i))return;if(i.$prototype==="Array"&&Me(i.items)){let a=ci(i.items.$ref);if(a)t.add(a)}o(i.map),o(i.children);for(let a of Object.values(i.cases??{}))o(a)};o(e.children);let r=e.state??{};return[...t].filter((i)=>bt(r[i]))}function pi(e,t){return console.warn(`canvas: could not resolve state.${e} before the render:`,t),null}async function An(e,t,o,r={}){let i=p(),{resolveClass:a}=i,l=e.state;if(t.length===0||!a||!l)return e;let s={...l};return await Promise.all(t.map(async(c)=>{let d=s[c];if(!bt(d,r))return;let f={...d,$src:Nn(d,r)};if(o)f.$base=o;let g=JSON.stringify(f),y=$e.get(g);if(!y)y=a.call(i,f).then((T)=>T??null,(T)=>($e.delete(g),pi(c,T))),$e.set(g,y);let b=await y;if(b!==null)s[c]=b})),{...e,state:s}}function $n(e,t=[]){if(!_(e))return null;if(Array.isArray(e.children)){let o=e.children.findIndex((r)=>_(r)&&!r.$__layout);if(o!==-1)return{offset:o,prefix:[...t,"children"]};for(let r=0;r<e.children.length;r++){let i=e.children[r];if(_(i)&&i.$__layout){let a=$n(i,[...t,"children",r]);if(a)return a}}}return null}function Ct(e,t,o=[]){if(!_(e))return;if(e.$__layout={file:t,path:o},Array.isArray(e.children))for(let[r,i]of e.children.entries()){if(n(i))continue;Ct(i,t,[...o,"children",r])}if(Array.isArray(e.$elements)){for(let[r,i]of e.$elements.entries())if(!n(i))Ct(i,t,[...o,"$elements",r])}}async function In(e,t=new Set){let o=e.replace(/^\.\//,"");if(t.has(o))return null;t.add(o);let r=await ex(e);if(!r)return null;Ct(r,o);let i=r.$layout;if(!n(i)||!i)return r;let a=await In(i,t);if(!a)return r;let l=BL(a,r);return delete l.$layout,l}function fi(e,t){for(let o of e??[]){if(!_(o)||!n(o.$ref)||!/^\.\.?\//.test(o.$ref))continue;let r=o.$__layout;if(!v(r)||!n(r.file))continue;let i=new URL(o.$ref,`jx-project:/${r.file}`).pathname.replace(/^\//,"");o.$ref=jc(t,i)}}function Dn(e,t){if(e.$layout!==void 0)return e.$layout;let o=t?.doc.content.frontmatter.$layout;return n(o)||o===!1?o:void 0}async function mi(e,t,o){let r=Dn(e,t),i=o?Un(o):null,a=i?await Ae(i.name,Oc(o)):null;return DS(r,a)}async function kn(e,t,o=null){let r={documentPath:t?.documentPath,mode:t?.doc.mode},i=o??Nc(t),a=i==="preview"?structuredClone(de(e)):ft(Xp(e)),l=!1,s=r.documentPath&&S?.isSiteProject&&(r.documentPath.startsWith("pages/")||r.documentPath.startsWith("./pages/")),c=!s&&Boolean(S?.isSiteProject)&&Xu(r.documentPath),d=null,f=0;if((s||c)&&t?.session.ui.showLayout!==!1){let w=c?await mi(e,t,r.documentPath):il(Dn(e,t));if(w){let M=await In(w);if(M){let D=i==="preview"?structuredClone(de(e)):a,P=BL(M,D);if(a=i==="preview"?P:ft(Xp(P)),l=!0,r.documentPath)fi(a.$elements,r.documentPath);let O=$n(P);d=O?.prefix??null,f=O?.offset??0}}}let g=S?.projectConfig;if(s&&g){if(a={...a,state:{...a.state}},a.imports)a.imports={...a.imports};Se(a,g,{urlPattern:Ju(r.documentPath)})}let y=Md(S?.projectRoot),b=r.documentPath?new URL(r.documentPath,y).href:void 0,T=zb(r.documentPath,sh());if(s&&t){let{previewParams:w}=t.session.ui;if(Object.keys(w).length>0){let M=gn(e.state??null);a=mn(a,w,r.documentPath),await hn(a,M,b)}}if((s||c)&&r.documentPath){let w=await Mn({documentPath:r.documentPath,fields:c?t?.doc.content.frontmatter??null:null,isEntry:c,lang:e.$lang,params:t?.session.ui.previewParams??{},title:e.title},S?.projectConfig);if(w)a={...a,state:{...a.state,...w}}}let k=await Qc(),I=HL(k),J=On(a,I);if(i!=="preview")J.push(...Rn(e));if(a=await An(a,[...new Set(J)],b,I),!s&&t&&LS(a)){let{previewProps:w}=t.session.ui;if(w&&Object.keys(w).length>0)a=Cn(a,w)}let te=new Set;if(i!=="preview")(function w(M,D){if(!_(M))return;if(M.$prototype==="Array"){te.add(D.join("/"));let P=M.map;if(_(P))w(P,[...D,"map"]);return}if(Array.isArray(M.children))for(let[P,O]of M.children.entries()){if(n(O))continue;w(O,[...D,"children",P])}else if(Go(M.children))w(M.children,[...D,"children"]);if(M.$switch&&M.cases)for(let[P,O]of Object.entries(M.cases))w(O,[...D,"cases",P])})(e,[]);let ot=r.documentPath!=null&&(r.documentPath.startsWith("layouts/")||r.documentPath.startsWith("./layouts/")),Pe=Xw(a.$elements);if((r.mode==="content"||l||ot)&&Ne.length>0){let w=new Set(Pe.map((P)=>_(P)?P.$ref:P)),M=new Map(Ne.map((P)=>[P.tagName,P])),D=YS(a);if(a.tagName)D.add(it(a.tagName));for(let P of D)for(let O of M.get(P)?.uses??[])D.add(O);for(let P of D){let O=M.get(P);if(O&&O.source!=="npm"&&O.path){let rt=jc(r.documentPath??null,O.path);if(!w.has(rt))Pe.push({$ref:rt}),w.add(rt)}}}if(Pe.length>0)a.$elements=Pe;return a.imports=XN(a.imports,k),a.$media=to(a.$media),a.$head=Qw(a.$head),{assets:T,docBase:b,mapperCtx:{arrayPaths:[...te],canvasMode:i,layoutWrapped:l,pageContentOffset:f,pageContentPrefix:d},renderDoc:a,siteStyle:S?.projectConfig?.style??null}}var gi=128,XT="fullRender",TN="mountCanvas",LN="patchBatch",Ln="prepareRender",Vo={derivedResolves:0,derivedRetargets:0,escalations:0,fullRenders:0,hostRenderPosts:0,lastEscalationReason:"",lastFullRenderMs:0,p95FullRenderMs:0,panelRenders:0,patchedOps:0,renderPreparations:0,skippedFullRenders:0,timings:{}};globalThis.__jxCanvasPerf=Vo;var Jn=new Map;function _n(){try{return typeof localStorage<"u"&&Boolean(localStorage.getItem("jx-canvas-debug"))}catch{return!1}}function Hn(){return typeof performance<"u"&&Q(performance.now)?performance.now():0}function jn(e,t){if(_n())console.debug(`[jx-canvas] ${e}`,t??"")}function jw(e){Vo.escalations+=1,Vo.lastEscalationReason=e,jn("escalation",e)}function vi(e){if(e.length===0)return 0;let t=e.toSorted((r,i)=>r-i),o=Math.min(t.length-1,Math.ceil(t.length*0.95)-1);return t[Math.max(0,o)]??0}function yi(e,t){let o=Number.isFinite(t)&&t>0?t:0,r=Jn.get(e);if(!r)r=[],Jn.set(e,r);if(r.push(o),r.length>gi)r.shift();let i=Vo.timings[e],a={count:(i?.count??0)+1,lastMs:o,maxMs:Math.max(i?.maxMs??0,o),p95Ms:vi(r),totalMs:(i?.totalMs??0)+o};if(Vo.timings[e]=a,e===XT)Vo.lastFullRenderMs=a.lastMs,Vo.p95FullRenderMs=a.p95Ms;jn(`span:${e}`,`${o.toFixed(2)}ms`)}function Fn(e){let t=Hn(),o=_n(),r=`jx-${e}-start`;if(o)try{performance.mark(r)}catch{}let i=!1;return()=>{if(i)return Vo.timings[e]?.lastMs??0;i=!0;let a=Hn()-t;if(o)try{performance.measure(`jx-${e}`,r),performance.clearMarks(r)}catch{}return yi(e,a),a}}function AS(e,t){let o=Fn(e);try{return t()}finally{o()}}async function OS(e,t){let o=Fn(e);try{return await t()}finally{o()}}function ji(e){if(e==="--")return"Base";return e.replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(t)=>t.toUpperCase())||e}var qn=new Set(["script","style","link","iframe","object","embed"]);function eh(e){let t={tagName:e};if(/^h[1-6]$/.test(e))t.textContent="Heading";else if(e==="p")t.textContent="Paragraph text";else if(e==="span"||e==="strong"||e==="em"||e==="small"||e==="mark"||e==="code"||e==="abbr"||e==="q"||e==="sub"||e==="sup"||e==="time")t.textContent="Text";else if(e==="a")t.textContent="Link",t.attributes={href:"#"};else if(e==="button")t.textContent="Button";else if(e==="label")t.textContent="Label";else if(e==="legend")t.textContent="Legend";else if(e==="caption")t.textContent="Caption";else if(e==="summary")t.textContent="Summary";else if(e==="li"||e==="dt"||e==="dd"||e==="th"||e==="td"||e==="option")t.textContent="Item";else if(e==="blockquote")t.textContent="Quote";else if(e==="pre")t.textContent="Preformatted text";else if(e==="input")t.attributes={placeholder:"Enter text...",type:"text"};else if(e==="img")t.attributes={alt:"Image"};else if(e==="iframe")t.attributes={src:""};else if(e==="slot")t.children=[{tagName:"p",textContent:"Slot content"}];else if(e==="select")t.children=[{tagName:"option",textContent:"Option 1"}];else if(e==="ul"||e==="ol")t.children=[{tagName:"li",textContent:"Item"}];else if(e==="dl")t.children=[{tagName:"dt",textContent:"Term"},{tagName:"dd",textContent:"Definition"}];else if(e==="table")t.children=[{children:[{children:[{tagName:"th",textContent:"Header"}],tagName:"tr"}],tagName:"thead"},{children:[{children:[{tagName:"td",textContent:"Cell"}],tagName:"tr"}],tagName:"tbody"}];else if(e==="details")t.children=[{tagName:"summary",textContent:"Summary"},{tagName:"p",textContent:"Detail content"}];return t}function Pt(e){return _(e)&&n(e.$ref)?e.$ref:null}function Ie(e){if(e.source!=="npm"||!e.package)return null;return e.modulePath?`${e.package}/${e.modulePath}`:e.package}function xi(e,t){let o=Ie(e);if(o)return o;return e.path?{$ref:jc(t,e.path)}:null}function QT(e,t,o){let r=Ie(t);if(r)return e.some((a)=>n(a)&&(a===r||a===t.package));if(!t.path)return!1;let i=re(jc(o,t.path));return e.some((a)=>{let l=Pt(a);return l!==null&&re(l)===i})}function re(e){return e.replace(/^(?:\.\/)+/,"")}function Ib(e,t,o){let r=xi(t,o);if(!r)return[...e];let a=Ie(t)&&t.modulePath?e.filter((l)=>l!==t.package):[...e];return QT(a,t,o)?a:[...a,r]}function eL(e,t,o){let r=Ie(t);if(r)return e.filter((a)=>!(n(a)&&(a===r||a===t.package)));if(!t.path)return[...e];let i=re(jc(o,t.path));return e.filter((a)=>{let l=Pt(a);return l===null||re(l)!==i})}function $N(e,t){return e.filter((o)=>!n(o)||!(o===t||o.startsWith(`${t}/`)))}function IN(e,t){let o=re(t);return e.filter((r)=>{let i=Pt(r);return i===null||re(i)!==o})}var bi="Components";function kp(e,t){let o=Ci(e,t);if(o)Qe(e,[],"$elements",o)}function Ci(e,t){if(!n(t)||!t.includes("-"))return null;let o=Ne.find((a)=>a.tagName===t);if(!o)return null;let r=e.doc.document.$elements??[],i=Ib(r,o,e.documentPath??null);return i.length===r.length?null:i}function MS(e){let t=Ne.find((o)=>o.tagName===e);return t?Fc(t):null}function RN(){return Ne.map((e)=>({component:!0,description:(e.source==="npm"?e.package:e.path)??"",group:bi,label:`<${e.tagName}>`,tag:e.tagName}))}function z(e){if(!e)return[];if(Array.isArray(e.children))return e.children;return n(e.textContent)&&e.textContent.length>0?[e.textContent]:[]}function pe(e){let t=0;for(let o of e)t+=n(o)?o.length:pe(z(o));return t}function wt(e,t,o){let r=[],i=0;for(let a of e){if(i>=o)break;if(n(a)){let d=i+a.length;if(d>t){let f=a.slice(Math.max(0,t-i),Math.max(0,Math.min(o,d)-i));if(f)r.push(f)}i=d;continue}let l=z(a),s=pe(l),c=i+s;if(s===0){if(i>=t&&i<o)r.push({...a})}else if(c>t){let d=wt(l,Math.max(0,t-i),Math.min(o,c)-i);if(d.length>0)r.push(Pi(a,d))}i=c}return r}function Pi(e,t){let{children:o,textContent:r,...i}=e;if(t.length===0)return{...i,textContent:""};if(t.length===1&&n(t[0]))return{...i,textContent:t[0]};return{...i,children:t}}function Wn(e){let t=[];for(let o of e){if(n(o)){if(o.length===0)continue;let r=t.at(-1);if(n(r)){t[t.length-1]=r+o;continue}}t.push(o)}return t}function Bn(e,t,o,r,i=""){return Wn([...wt(e,0,t),...i?[i]:[],...wt(o,r,pe(o))])}function Et(e){let t=Wn(e);if(t.length===0)return{textContent:""};if(t.length===1&&n(t[0]))return{textContent:t[0]};return{children:t}}function zn(e){if(!e)return!0;if(e.textContent!=null&&e.textContent.trim()==="")return!0;let t=e.children;if(!t)return!1;if(t.length===0)return!0;let[o]=t;if(t.length===1&&n(o)&&o.trim()==="")return!0;return t.length===1&&_(o)&&o.tagName==="br"}function Tt(e){return{index:zi(e),parentPath:Ut(e)}}function Kn(e,t,o,r,i={}){if(!e)return;let a=oe(e.doc.document,t);if(o){if(a&&JSON.stringify(a.children)===JSON.stringify(o))return;Y(e,(l)=>{if(a?.textContent!=null)Qe(l,t,"textContent");Qe(l,t,"children",o)},{coalesceKey:i.coalesceKey??null})}else if(r!=null){if(a&&a.textContent===r&&!a.children)return;Y(e,(l)=>{if(a?.children)Qe(l,t,"children");Qe(l,t,"textContent",r)},{coalesceKey:i.coalesceKey??null})}}function Zn(e,t,o,r){if(!e)return!1;let i=oe(e.doc.document,t);if(!i)return!1;if(`${i.$props?.[o]??""}`===r)return!1;return Y(e,(l)=>{Up(l,t,o,r)}),!0}function Yn(e,t,o){if(!e)return null;let r=oe(e.doc.document,t),i=oe(e.doc.document,o);if(!r||!i)return null;if(ta(t,o)||ta(o,t))return null;let a=z(i),l=z(r),s=pe(a),c=Et([...a,...l]);return Y(e,(d)=>{if(c.children){if(i.textContent!=null)Qe(d,o,"textContent");Qe(d,o,"children",c.children)}else{if(i.children)Qe(d,o,"children");Qe(d,o,"textContent",c.textContent??"")}if(vh(d,t),Xn(d,Ut(t)),qp(e))d.session.selection=[o]}),{offset:s,path:o}}function Xn(e,t){let o=t;while(o.length>0){let r=oe(e.doc.document,o),i=r?.children;if(!r||!Array.isArray(i)||i.length>0)return;let a=Ut(o);if(vh(e,o),!a)return;o=a}}function Qn(e,t,o,r){let{parentPath:i,index:a}=Tt(t),l=[...i,"children",a+1];if(!e)return l;let s={tagName:"p"};if(r.textContent!=null)s.textContent=r.textContent;else if(r.children)s.children=r.children;else s.textContent="";return Y(e,(c)=>{if(o.textContent!=null)Qe(c,t,"children"),Qe(c,t,"textContent",o.textContent);else if(o.children)Qe(c,t,"textContent"),Qe(c,t,"children",o.children);if(or(c,i,a+1,s),qp(e))c.session.selection=[l]}),l}function Si(e,t,o,r){let{parentPath:i,index:a}=Tt(t),l=zn(r),s=l?a:a+1,c=[...i,"children",s];if(!e)return c;return Y(e,(d)=>{if(l)vh(d,t);else if(r?.children)Qe(d,t,"textContent"),Qe(d,t,"children",r.children);else if(r?.textContent!=null)Qe(d,t,"children"),Qe(d,t,"textContent",r.textContent);if(or(d,i,s,o),kp(d,o.tagName),qp(e))d.session.selection=[c]}),c}function eo(e,t,o,r){let i=o.component===!0?MS(o.tag):null;if(i)return Si(e,t,i,r);if(zn(r)){if(!e)return t;return Y(e,(d)=>{Qe(d,t,"tagName",o.tag),Qe(d,t,"children");let f=eh(o.tag);if(f.textContent&&f.textContent!=="Paragraph text")Qe(d,t,"textContent",f.textContent);else Qe(d,t,"textContent");if(qp(e))d.session.selection=[t]}),t}let{parentPath:a,index:l}=Tt(t),s=[...a,"children",l+1];if(!e)return s;let c=eh(o.tag);return Y(e,(d)=>{if(r?.children)Qe(d,t,"textContent"),Qe(d,t,"children",r.children);else if(r?.textContent!=null)Qe(d,t,"children"),Qe(d,t,"textContent",r.textContent);if(or(d,a,l+1,structuredClone(c)),qp(e))d.session.selection=[s]}),s}function no(e,t,o,r,i){if(!e)return null;let a=oe(e.doc.document,t.path),l=oe(e.doc.document,o.path);if(!a||!l)return null;if(ta(t.path,o.path)||ta(o.path,t.path))return null;let s=Et(Bn(z(a),t.offset,z(l),o.offset,i)),c=[...r,o.path].toSorted(wi);return Y(e,(d)=>{if(s.children){if(a.textContent!=null)Qe(d,t.path,"textContent");Qe(d,t.path,"children",s.children)}else{if(a.children)Qe(d,t.path,"children");Qe(d,t.path,"textContent",s.textContent??"")}for(let f of c)if(oe(d.doc.document,f))vh(d,f),Xn(d,Ut(f));if(qp(e))d.session.selection=[t.path]}),{offset:t.offset+i.length,path:t.path}}function wi(e,t){let o=Math.min(e.length,t.length);for(let r=0;r<o;r++){let i=e[r],a=t[r];if(i===a)continue;if(Z(i)&&Z(a))return a-i;return String(a).localeCompare(String(i))}return t.length-e.length}function R(e,t=1){return{height:e.height*t,left:e.x*t,top:e.y*t,width:e.width*t}}function DN(e,t,o=1){return{x:(e.x-t.left)/o,y:(e.y-t.top)/o}}function De(e,t){if(!t){e.style.display="none";return}e.style.display="block",e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`}function ro(e=document){let t=e.createElement("div");t.className="jx-canvas-iframe-overlay",t.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:2";let o=e.createElement("div");o.className="overlay-box overlay-selection",o.style.display="none";let r=e.createElement("div");r.className="overlay-label",r.style.display="none",o.append(r);let i=e.createElement("div");i.className="overlay-box overlay-hover",i.style.display="none";let a=e.createElement("div");a.className="canvas-drop-indicator",a.style.display="none";let l=e.createElement("button");l.className="insertion-helper",l.textContent="+",l.style.pointerEvents="auto",l.style.display="none";let s=e.createElement("div");s.className="canvas-replace-target",s.style.display="none";let c=e.createElement("div");c.className="overlay-presence-group";let d=e.createElement("div");return d.className="overlay-coselection-group",t.append(i,o,d,a,s,l,c),{dispose:()=>t.remove(),insertButton:l,root:t,setDropIndicator:(f,g="inside")=>Ti(a,f,g),setHover:(f)=>De(i,f),setInsertZone:(f,g="center")=>Ei(l,f,g),setReplaceTarget:(f)=>De(s,f),setSuppressed:(f)=>{t.style.display=f?"none":""},setCoSelection:(f)=>{d.replaceChildren();for(let g of f){let y=e.createElement("div");y.className="overlay-box overlay-selection overlay-coselection",De(y,g),d.append(y)}},setPresence:(f)=>{c.replaceChildren();for(let g of f){let y=e.createElement("div");y.className="overlay-box overlay-presence",y.style.cssText=`position:absolute;display:block;pointer-events:none;outline:1.5px solid ${g.color};outline-offset:1px;left:${g.placement.left}px;top:${g.placement.top}px;width:${g.placement.width}px;height:${g.placement.height}px`;let b=e.createElement("div");b.className="overlay-presence-tag",b.textContent=g.label,b.style.cssText=`position:absolute;top:-18px;left:-2px;padding:1px 5px;border-radius:3px;font:10px/1.4 sans-serif;color:#fff;white-space:nowrap;background:${g.color}`,y.append(b),c.append(y)}},setSelection:(f,g=null)=>{if(De(o,f),f&&g)r.textContent=g,r.style.display="block";else r.style.display="none"}}}function Ei(e,t,o){if(!t){e.style.display="none",e.classList.remove("visible");return}e.dataset.edge=o,e.classList.add("visible"),e.style.display="grid",e.style.left=`${t.left+t.width/2}px`,e.style.top=`${t.top+t.height/2}px`,e.style.translate="-50% -50%"}function Ti(e,t,o){if(!t){e.style.display="none";return}if(e.style.display="block",e.style.left=`${t.left}px`,e.style.width=`${t.width}px`,o==="inside"){e.className="canvas-drop-indicator inside",e.style.top=`${t.top}px`,e.style.height=`${t.height}px`;return}e.className="canvas-drop-indicator line",e.style.height="",e.style.top=`${o==="top"?t.top:t.top+t.height}px`}function Mc(e){return JSON.stringify(e)}var PS={$id:"elements-meta",title:"HTML Element Metadata",description:"Inline scoping and inline toolbar action metadata for HTML elements.",$convertGroups:{text:["p","h1","h2","h3","h4","h5","h6","blockquote"],container:["div","section","article","aside","main","header","footer","nav","search"],list:["ul","ol"]},$defs:{p:{$convertTo:"text",$convertToWhenEmpty:["text","container"],$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"u",label:"Underline",command:"underline"},{tag:"del",label:"Strikethrough",command:"strikethrough"},{tag:"sup",label:"Superscript",command:"superscript"},{tag:"sub",label:"Subscript",command:"subscript"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h1:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"},{tag:"a",label:"Link",command:"link"}]},h2:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h3:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h4:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h5:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},h6:{$convertTo:"text",$inlineChildren:["em","strong","code","a","span","br","b","i","u","sub","sup"],$inlineActions:"h1"},li:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},td:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},th:{$inlineChildren:["em","strong","del","code","a","span","br","b","i","u","sub","sup","s"],$inlineActions:"p"},blockquote:{$convertTo:"text",$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},figcaption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},caption:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},summary:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dt:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},dd:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},label:{$inlineChildren:["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"],$inlineActions:"p"},a:{$inlineChildren:["em","strong","code","span","br","b","i","u","sub","sup"],$inlineActions:[{tag:"strong",label:"Bold",command:"bold"},{tag:"em",label:"Italic",command:"italic"},{tag:"code",label:"Code",command:"code"}]},span:{$inlineChildren:["em","strong","del","code","a","br","b","i","u","sub","sup","s"],$inlineActions:"p"},div:{$convertTo:"container",$convertToWhenEmpty:["container","text"],$inlineChildren:[]},section:{$convertTo:"container",$inlineChildren:[]},article:{$convertTo:"container",$inlineChildren:[]},nav:{$convertTo:"container",$inlineChildren:[]},main:{$convertTo:"container",$inlineChildren:[]},header:{$convertTo:"container",$inlineChildren:[]},footer:{$convertTo:"container",$inlineChildren:[]},aside:{$convertTo:"container",$inlineChildren:[]},ul:{$convertTo:"list",$inlineChildren:[]},ol:{$convertTo:"list",$inlineChildren:[]},pre:{$inlineChildren:["code"]},table:{$inlineChildren:[]},thead:{$inlineChildren:[]},tbody:{$inlineChildren:[]},tr:{$inlineChildren:[]}}};var xm=PS.$defs,Oi=new Set(["pre"]),pc=new Set(Object.entries(xm).filter(([e,t])=>!Oi.has(e)&&(t.$inlineChildren?.length??0)>0).map(([e])=>e));var io=new Set(["em","strong","del","code","a","span","br","img","b","i","u","sub","sup","s"]);function Mt(e,t){if(!t)return io.has(e);let o=xm[t];if(!o||!o.$inlineChildren)return!1;return o.$inlineChildren.includes(e)}function NN(e){let t=xm[e];if(!t)return null;let o=t.$inlineActions;if(n(o))o=xm[o]?.$inlineActions??void 0;if(!Array.isArray(o))return null;return o}var Ri=null;function Hw(e,t){if(!_(e))return!1;let o=(it(e.tagName)||"div").toLowerCase();if(t){let r=(it(t.tagName)||"div").toLowerCase();return Mt(o,r)}return io.has(o)}function AN(){return Ri!==null}function ke(e){return!e||e==="base"?null:e}function Bw(e){let t=e.panels;if(t.length===0)return null;if(t.length===1)return t[0];let o=tl(e.paneId);for(let r of t){if(o===null&&r.mediaName==="base")return r;if(r.mediaName===o)return r}return t[0]}function ao(){return Bw(vr())}function ON(e,t){if(!e)return t;let o=t;for(let r=Ut(o);r;r=Ut(o)){let i=oe(e,o),a=oe(e,r);if(!i||!a)break;let l=(it(i.tagName)||"div").toLowerCase(),s=(it(a.tagName)||"div").toLowerCase();if(!Mt(l,s))break;o=r}return o}function zw(e){return Fp(e)!==null}function Ep(e){return Fp(e)}function Br(e){if(!e)return{baseWidth:320,featureQueries:[],sizeBreakpoints:[]};let t=[],o=[],r=320;for(let[i,a]of Object.entries(e)){if(i==="--"){let c=String(a).match(/^(\d+)\s*px$/);r=c?Number(c[1]):320;continue}let l=a.match(/min-width:\s*([\d.]+)px/),s=a.match(/max-width:\s*([\d.]+)px/);if(l)o.push({name:i,query:a,type:"min",width:Number(l[1])});else if(s)o.push({name:i,query:a,type:"max",width:Number(s[1])});else t.push({name:i,query:a})}return o.sort((i,a)=>i.type==="min"?i.width-a.width:a.width-i.width),{baseWidth:r,featureQueries:t,sizeBreakpoints:o}}function Ai(e,t){let o=new Set;for(let r of e)if(r.type==="min"&&t>=r.width)o.add(r.name);else if(r.type==="max"&&t<=r.width)o.add(r.name);return o}function so(e,t){let o=Ai(e,t),r=null;for(let i of e){if(!o.has(i.name))continue;let a=Math.abs(i.width-t);if(r===null){r=i;continue}let l=Math.abs(r.width-t);if(a<l||a===l&&i.width<r.width)r=i}return r?.name??null}function MN(e,t,o=8){let r=null;for(let i of t){let a=Math.abs(i-e);if(a>o)continue;if(r===null||a<Math.abs(r-e))r=i}return r??e}var _m=240,PN=8,FN=16,Je=new Map;function Nt(e){return Br(to(e.doc.document.$media))}function FS(e){let{baseWidth:t,sizeBreakpoints:o}=Nt(e),r=e.session.ui.activeMedia;return o.find((i)=>i.name===r)?.width??t}function $i(e,t){let o=Je.get(e);if(!o)return null;if(!t||o.tabId!==t.id||o.media!==t.session.ui.activeMedia)return Je.delete(e),null;return o.width}function jN(e,t){let o=t?FS(t):0;return $i(e.paneId,t)??o}function jS(e){Je.delete(e)}function HN(e){let{baseWidth:t,sizeBreakpoints:o}=Nt(e);return[t,...o.map((r)=>r.width)]}function HS(e,t,o){let{sizeBreakpoints:r}=Nt(t),i=so(r,o);return t.session.ui.activeMedia=i,Je.set(e,{media:i,tabId:t.id,width:o}),i}var Ot={invokerTags:Xb,popoverTags:uh};function tL(e,t){if(!e||!t)return null;for(let o=t.length;o>=0;o-=1){let r=t.slice(0,o),i=oe(e,r);if(_(i)&&Ea(i,Ot))return r}return null}function lo(e,t){let o=e.doc.document;if(!o)return null;if(t){let r=oe(o,t);return _(r)&&Ea(r,Ot)?t:null}return tL(o,Oe(e.session.selection))}function co(){let e=u.value?.doc.document;return e?GA(e,Ot):!1}var po=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],Rt=new Set(["show-modal","close","request-close"]),At=new Set(["toggle-popover","show-popover","hide-popover"]),Ii=["any","closerequest","none"],Di=new Set(po),ki=new Set(Ii),Ji=new Set(["button"]);function H(e){return Eo(e)==="dialog"}function uo(e){return e.startsWith("--")}function Li(e){let t=[];for(let{node:o}of Jl(e)){let r=Hp(o);if(H(o)&&r!==null&&!t.includes(r))t.push(r)}return t}function fo(e){for(let{node:t}of Jl(e))if(H(t))return!0;return!1}function _i(e){let t=e.oncommand;return t!==void 0&&t!==null}function Fi(e,t){for(let{node:o}of Jl(e)){if(o===e)continue;let r=Eo(o);if(r==="button"){let i=Ts(o,"command"),a=Ts(o,"commandfor");if(i!==null&&(i==="close"||i==="request-close")&&(a===null||a===t))return!0}if(r==="form"&&Ts(o,"method")?.toLowerCase()==="dialog")return!0}return!1}function vN(e,t){let o=[...Jl(e,[],null,t)],r=Li(e),i=Zb(e,t),a=r.length>0||i.length>0,l=new Map,s=new Map;for(let{node:d}of o){let f=Hp(d);if(f!==null&&!l.has(f))l.set(f,d);if(Eo(d)==="button"){let g=Ts(d,"commandfor"),y=Ts(d,"command");if(g!==null){let b=s.get(g)??new Set;b.add(y??""),s.set(g,b)}}}let c=[];for(let{node:d,path:f}of o)if(c.push(...Vi(d,f,l,r,i,a,t)),H(d))c.push(...qi(d,f,s));return c}function Vi(e,t,o,r,i,a,l){let s=[],c=Eo(e),d=l?.invokerTags?.has(c)??!1,f=Ts(e,"command"),g=Ts(e,"commandfor");if(!(f!==null||g!==null||("command"in Gc(e))||("commandfor"in Gc(e))))return s;let b=Ls(e,"the element");if(!Ji.has(c)&&!d)return s.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${oo}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),s;if(f!==null&&!Di.has(f)&&!uo(f))return s.push({detail:`\`command\` is an enumerated attribute taking ${po.map((T)=>`\`${T}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${oo}`,message:`${b} declares command="${f}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),s;if(g!==null){let T=o.get(g),k=r.includes(g),I=i.includes(g);if(!T&&a){let J=[...r,...i].map((te)=>`"${te}"`).join(", ");return s.push({detail:`No element in this document has the id "${g}". The dialogs and popovers here are: ${J}. A commandfor that names nothing does nothing, silently. ${oo}`,message:`commandfor="${g}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),s}if(f!==null&&T){if(Rt.has(f)&&!H(T))s.push({detail:`\`${f}\` acts on a <dialog>, and "${g}" is ${I?"a popover":`a <${Eo(T)||"element"}>`}. The click is ignored. ${I?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${oo}`,message:`${b} sends ${f} to "${g}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(At.has(f)&&!Ea(T,l))s.push({detail:`\`${f}\` acts on a popover, and "${g}" is ${k?"a dialog":`a <${Eo(T)||"element"}>`} that declares no \`popover\`. The click is ignored. ${k?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${oo}`,message:`${b} sends ${f} to "${g}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(uo(f)&&!_i(T))s.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${g}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${oo}`,message:`${b} sends ${f} to "${g}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return s}function qi(e,t,o){let r=[],i=Ls(e,"the dialog"),a=Hp(e),{style:l}=e,s=Ts(e,"closedby");if(s!==null&&!ki.has(s))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${oo}`,message:`${i} declares closedby="${s}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(_r(l,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${oo}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=a===null?void 0:o.get(a),d=Ts(e,"open")!==null||Gc(e).open===!0||e.open===!0;if(a!==null&&!c?.has("show-modal")&&!d)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${oo}`,message:`${i} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&s==="none"&&!Fi(e,a))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${oo}`,message:`${i} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}function nL(e,t){if(!e||!t)return null;for(let o=t.length;o>=0;o-=1){let r=t.slice(0,o),i=oe(e,r);if(_(i)&&H(i))return r}return null}function BS(e,t){let o=e.doc.document;if(!o)return null;if(t){let r=oe(o,t);return _(r)&&H(r)?t:null}return nL(o,Oe(e.session.selection))}function mo(){let e=u.value?.doc.document;return e?fo(e):!1}function G(e){return vt(e.paneId)}function fe(e){let t=Hr(e.paneId);if(t?.kind==="lens")return t.zoom;return G(e)?.session.ui.zoom??1}function Sm(e=vr()){return fe(e)}function Le(e,t){let o=Hr(e.paneId);if(o?.kind==="lens"){o.zoom=t;return}let r=G(e);if(r)r.session.ui.zoom=t}function Bi(e){return Boolean(e.canvas&&e.viewport)}function Tp(e,t,o,r=null){let a={_width:r||null,canvas:null,element:null,mediaName:e||"",ready:!1,renderScope:null,scrollContainer:null,viewport:null},l=[];if(r&&!o)l.push(`--panel-viewport-w:${r}px`);if(r)l.push(`--panel-canvas-w:${r}px`);return{item:{fullWidth:o,header:t?"shown":"hidden",key:e??"",label:t??"",mediaAttr:e,widthVars:l.join(";")},panel:a}}function BN(e,t){for(let{item:o,panel:r}of e){let i=(a)=>t.panelNode(o.key,a);r.element=i("panel"),r.viewport=i("panel-viewport"),r.canvas=i("panel-canvas")}}function zN(e,t){let o=e.find((i)=>i.item.key===t);if(!o)return;let r=tn(o.panel);if(r)r.session.ui.activeMedia=ke(o.item.mediaAttr)}function kt(e){if(!e.panzoomWrap)return;let t=e.wrap.clientWidth,o=e.panzoomWrap.scrollWidth,r=fe(e),i=t-o*r;e.panX=i>=0?i/2:16,e.panY=0}function Ww(e){if(e.centerObserver)e.centerObserver.disconnect(),e.centerObserver=null;if(!e.panzoomWrap)return;e.needsCenter=!0,e.centerObserver=new ResizeObserver(()=>{if(!e.needsCenter){e.centerObserver?.disconnect(),e.centerObserver=null;return}kt(e),Us(e)}),e.centerObserver.observe(e.panzoomWrap),kt(e)}function Us(e){if(!e.panzoomWrap)return;let t=fe(e);e.panzoomWrap.style.transform=`translate(${e.panX}px, ${e.panY}px) scale(${t})`,xn("overlays")}var Jt=0.25,Ht=3;function yo(e){return Math.min(Ht,Math.max(Jt,e))}function Ki(e,t,o){let r=e.wrap.querySelector('[part="edit-canvas"]'),i=e.panels[0]?.canvas;if(!r||!i)return null;let a=e.wrap.querySelector('[part="edit-column"]'),l=a?He(a).width:0,s=t&&l>0?l/t:1,c=o;if(c===null){let d=He(r);c=d.top+d.height/2}return{layoutY:Math.max(0,(c-He(i).top)/s),scroller:r,zoom:s}}function th(e=vr(),t=null){if(Wo(e.paneId)!=="edit")return;let[o]=e.panels;if(!o||!Bi(o))return;let r=o.canvas,i=r.querySelector("iframe"),a=G(e)?.session.ui.editZoom??1,l=Ki(e,o._width??null,t);if(a===1){if(o._width=null,r.style.width="",r.style.transform="",r.style.transformOrigin="",i)i.style.width="100%";o.viewport.style.height=""}else{let s=e.wrap.querySelector('[part="edit-column"]');if(!s)return;let c=He(s).width;if(c<=0)return;let d=c/a;if(o._width=d,r.style.width=`${d}px`,r.style.transform=`scale(${a})`,r.style.transformOrigin="top left",i)i.style.width=`${d}px`,o.viewport.style.height=`${i.offsetHeight*a}px`}if(l)l.scroller.scrollTop+=l.layoutY*(a-l.zoom);xn("overlays")}function Lp(e,t=vr()){let o=G(t);if(!o)return;o.session.ui.editZoom=yo(e),th(t)}var $t=new Map,It=new Map;function WN(e,t=vr(),o=null){let r=G(t);if(!r)return;if(r.session.ui.editZoom=yo(e),It.set(t.paneId,o),$t.has(t.paneId))return;$t.set(t.paneId,requestAnimationFrame(()=>{$t.delete(t.paneId);let i=It.get(t.paneId)??null;It.delete(t.paneId),th(t,i)}))}function Ui(e){let t=getComputedStyle(e).getPropertyValue("--boards-inset").trim(),o=Number(t.replace(/px$/,""));return Number.isFinite(o)?o:0}function xo(e,t,o){if(!e.panzoomWrap)return;let r=e.wrap.clientWidth,i=e.wrap.clientHeight-Ui(e.panzoomWrap),a=24,l=32,s=0,{panels:c}=e;for(let ot of c)s+=ot._width||800;s+=a*Math.max(0,c.length-1)+l;let d=fe(e),y=He(e.panzoomWrap).height/d+l,b=r/s,T=i/y,k=t==="width"?b:Math.min(b,T),I=Math.min(o,Math.max(K,k));Le(e,I);let J=s*I,te=y*I;e.panX=Math.max(0,(r-J)/2),e.panY=Math.max(0,(i-te)/2),Us(e)}function VN({maxZoom:e=U,surface:t=vr()}={}){je("page",t),xo(t,"page",e)}var K=0.05,U=5;function Co(e){return Math.min(U,Math.max(K,e))}var Gi="page",Lt=["width","page","none"];function Zi(e,t,o){let r=t[o];if(Yi(r))return r;if(Z(r)&&r>=K&&r<=U)return r;throw RangeError(`command "${e}" argument "${o}": expected ${Lt.map((i)=>`"${i}"`).join(" | ")} or a number in [${K}, ${U}], got ${JSON.stringify(r)}`)}function Yi(e){return n(e)&&Lt.includes(e)}var Po=new Map;function So(e){let t=G(e);if(!t)return null;let o=Hr(e.paneId)?.kind==="lens"?`::${e.paneId}`:"";return`${t.id}::${t.documentPath??""}${o}`}function je(e,t){let o=So(t);if(o)Po.set(o,e)}function zS(e=vr()){let t=So(e);return(t===null?void 0:Po.get(t))??Gi}function wo(e,t=vr()){let o=e??zS(t);if(o==="none"){Us(t);return}if(Z(o)){Le(t,Co(o)),Us(t);return}xo(t,o,1)}function iL(e,t=vr()){je(e,t),wo(e,t)}function Cm(e,t=vr(),o=null){if(!G(t))return;let i=Co(e),a=i/fe(t);if(je(i,t),t.panzoomWrap&&a!==1){let l=He(t.panzoomWrap),s=He(t.wrap),c=o?.clientX??s.left+s.width/2,d=o?.clientY??s.top+s.height/2;t.panX+=(c-l.left)*(1-a),t.panY+=(d-l.top)*(1-a),t.needsCenter=!1}Le(t,i),Us(t)}function WS(e){if(e.wrap.clientWidth<=0){Us(e);return}wo(zS(e),e)}function UN(e=vr()){if(je(1,e),!e.panzoomWrap)return;Le(e,1),kt(e),Us(e)}function Mo(e,t){let o=He(No(e)??e.wrap),r=t.top+t.height/2-o.top;return o.height/2-r}function No(e){return Bw(e)?.scrollContainer??null}function Xi(e,t,o){let r=No(e);if(!r){Ro(e,t);return}let i=r.scrollTop-t;if(o){r.scrollTo({behavior:"smooth",top:i});return}r.scrollTop=i}function VS(e,t=vr()){Xi(t,Mo(t,e),!1)}function Oo(e,t=vr()){let o=He(t.wrap);if(e.top>=o.top&&e.top+e.height<=o.top+o.height)return;let r=Mo(t,e),i=Math.max(t.panY,0)-t.panY,a=Math.min(r,i);if(a!==0)t.needsCenter=!1,Ro(t,a)}function Ro(e,t){let o=e.panY,r=o+t,i=performance.now(),a=250,l=(s)=>{let c=Math.min((s-i)/250,1),d=c*(2-c);if(e.panY=o+(r-o)*d,Us(e),c<1)requestAnimationFrame(l)};requestAnimationFrame(l)}var Qi=["edit","design","preview","source","stylebook","tokens","grid","git-diff"],Dt=Qi.filter((e)=>e!=="git-diff"),Fe=new Set(["edit","design"]);function ea(e){return Fe.has(e)}var oL=["edit","design","preview"];function na(e){return oL.filter((t)=>e.capabilities.modes.includes(t))}function qN(e){return na(e).filter((t)=>t!=="preview")}function rL(e){let t=e.session.ui.canvasMode;return ea(t)?t:null}function sL(e){return{available:e.capabilities.modes.includes("preview")&&Fe.has(e.session.ui.canvasMode),on:e.session.ui.preview===!0}}function aL(e,t,o){if(t==="preview"){if(Fe.has(e.session.ui.canvasMode))e.session.ui.preview=!0;return}if(e.session.ui.preview=!1,e.session.ui.canvasMode!==t)o(e,t)}var ho=new Set(["design","stylebook","git-diff"]),A=(e)=>e.document.open,vo=["auto","light","dark"];function oa(e){function t(l){let s=u.value;if(!s)throw RangeError(`command "${l}" needs an open document; no tab is active`);return s}function o(l,s){let{pane:c}=s;if(c===void 0)return t(l);let d=St(l,s,"pane"),f=vt(d);if(!f)throw RangeError(`command "${l}" argument "pane": "${d}" has no open document`);return f}let r={pane:We("Which pane to render this way. Defaults to the focused one.")};function i(l){e.renderPane(a(l))}function a(l){let{pane:s}=l;return n(s)?s:m.activePaneId}return[{args:Ce({mode:ui(Dt,"The canvas mode to switch the active pane to.")}),category:"View",id:"canvas.setMode",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,aiTool:{description:"Switch the active document's editor mode. edit and design put its element tree on the canvas, where the document tools work; preview renders it as a visitor sees it; source shows the JSON; stylebook, tokens and grid open other editors. Use it to return a document to edit or design when the tree tools are refused.",name:"set_canvas_mode",report:({after:l,args:s})=>{let c=Vn("canvas.setMode",s,"mode",Dt),d=l.editor.kind==="canvas"?"the document tools address its element tree":"the tree-editing tools are unavailable until it returns to edit or design";return`The active document is in ${c} mode; ${d}.`}},run:(l,s)=>{let c=Vn("canvas.setMode",s,"mode",Dt),d=t("canvas.setMode"),{modes:f}=d.capabilities;if(!f.includes(c))throw RangeError(`command "canvas.setMode" argument "mode": "${c}" is not a mode this document `+`supports — it declares: ${f.join(", ")}`);if(c==="preview"){let g=d.session.ui.canvasMode;if(!Fe.has(g))throw RangeError(`command "canvas.setMode" argument "mode": "preview" composes with the edit and design base modes; this pane is in "${g}"`);d.session.ui.preview=!0;return}d.session.ui.preview=!1,e.setCanvasMode(d,c)},title:"Set Canvas Mode"},{args:Ce({zoom:j$("Pan-zoom scale, 1 = 100%.",{maximum:U,minimum:K})}),category:"View",id:"canvas.setZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:A,enablement:()=>ho.has(e.getCanvasMode()),run:(l,s)=>{t("canvas.setZoom"),Cm(Rx("canvas.setZoom",s,"zoom",K,U))},title:"Set Zoom"},{args:Ce({fit:{description:'How the document is framed: "width" | "page" | "none", or a numeric pan-zoom scale.',oneOf:[{enum:[...Lt],type:"string"},{maximum:U,minimum:K,type:"number"}]}}),category:"View",id:"canvas.setFit",level:"document",menus:["palette"],group:"3_canvas",requires:"a document on the pan-zoom surface",when:A,enablement:()=>ho.has(e.getCanvasMode()),run:(l,s)=>{t("canvas.setFit"),iL(Zi("canvas.setFit",s,"fit"))},title:"Set Fit"},{args:Ce({zoom:j$("Edit-mode content zoom, 1 = 100%.",{maximum:Ht,minimum:Jt})}),category:"View",id:"canvas.setEditZoom",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:A,enablement:()=>e.getCanvasMode()==="edit",run:(l,s)=>{t("canvas.setEditZoom"),Lp(Rx("canvas.setEditZoom",s,"zoom",Jt,Ht))},title:"Set Edit Zoom"},{args:{additionalProperties:!1,properties:{...r,width:{description:"How wide the Edit column should render, in CSS pixels, or null to go back to the chosen breakpoint's own width.",type:["number","null"]}},required:["width"],type:"object"},category:"View",id:"canvas.setEditWidth",level:"document",menus:["palette"],group:"3_canvas",requires:"a document in edit mode",when:A,enablement:()=>e.getCanvasMode()==="edit",run:(l,s)=>{let c=o("canvas.setEditWidth",s),{width:d}=s;if(d===null){jS(a(s)),i(s);return}HS(a(s),c,Rx("canvas.setEditWidth",s,"width",_m,1e4)),i(s)},title:"Set Edit Width"},{args:{additionalProperties:!1,properties:{...r,media:{description:"A breakpoint key the document renders under, or null for the base rendering.",type:["string","null"]}},required:["media"],type:"object"},category:"View",id:"canvas.setBreakpoint",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{let c=o("canvas.setBreakpoint",s),{media:d}=s;if(d!==null&&!n(d))throw RangeError('command "canvas.setBreakpoint" argument "media": expected a breakpoint key or null');let f=Object.keys(to(c.doc.document.$media));if(d!==null&&!f.includes(d))throw RangeError(`command "canvas.setBreakpoint" argument "media": "${d}" is not a breakpoint this `+`document defines — it defines: ${f.length>0?f.join(", "):"nothing"}`);c.session.ui.activeMedia=d,i(s)},title:"Set Breakpoint"},{args:Ce({...r,scheme:ui(vo,"Which color scheme the canvas renders in.")},["scheme"]),category:"View",id:"canvas.setColorScheme",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{let c=o("canvas.setColorScheme",s);c.session.ui.previewColorScheme=Vn("canvas.setColorScheme",s,"scheme",vo),i(s)},title:"Set Color Scheme"},{args:Ce({...r,locale:We("BCP 47 tag this pane renders as.")},["locale"]),category:"View",id:"i18n.switchLocale",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document in a project that declares more than one locale",when:(l)=>l.document.open&&l.project.isMultilingual,run:(l,s)=>{let c=o("i18n.switchLocale",s),d=St("i18n.switchLocale",s,"locale"),f=Es();if(f===null||!f.locales.includes(d))throw RangeError(`command "i18n.switchLocale" argument "locale": "${d}" is not a locale this `+`project declares — it declares: ${f===null?"nothing":f.locales.join(", ")}`);c.session.ui.previewLocale=d,i(s)},title:"Set Rendering Language"},{args:Ce({...r,visible:To("True to draw the page's layout elements, false to hide them.")},["visible"]),category:"View",id:"canvas.setLayoutVisible",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{let c=o("canvas.setLayoutVisible",s);c.session.ui.showLayout=Hi("canvas.setLayoutVisible",s,"visible"),i(s)},title:"Show Layout Elements"},{args:Ce({...r,open:To("True to draw the popover open, false to close it."),path:{description:"Document path of the popover. Defaults to the popover the selection is in or at.",items:{type:["string","number"]},type:"array"}},[]),category:"View",enablement:()=>co(),group:"3_canvas",id:"canvas.setPopoverOpen",level:"document",menus:["palette"],requires:"a popover in the open document",run:(l,s)=>{let c=o("canvas.setPopoverOpen",s),d=s.path,f=s.open===void 0?!0:Hi("canvas.setPopoverOpen",s,"open");if(!f&&d===void 0){e.setOpenPopover(c,null);return}let g=lo(c,d);if(g===null)throw RangeError('command "canvas.setPopoverOpen" argument "path": names no popover in this document — '+"a popover is an element with a `popover` attribute, and <dialog> is not one");e.setOpenPopover(c,f?g:null)},title:"Show Popover",when:A},{args:Ce({...r,open:To("True to draw the dialog open, false to close it."),path:{description:"Document path of the dialog. Defaults to the dialog the selection is in or at.",items:{type:["string","number"]},type:"array"}},[]),category:"View",enablement:()=>mo(),group:"3_canvas",id:"canvas.setDialogOpen",level:"document",menus:["palette"],requires:"a dialog in the open document",run:(l,s)=>{let c=o("canvas.setDialogOpen",s),d=s.path,f=s.open===void 0?!0:Hi("canvas.setDialogOpen",s,"open");if(!f&&d===void 0){e.setOpenDialog(c,null);return}let g=BS(c,d);if(g===null)throw RangeError('command "canvas.setDialogOpen" argument "path": names no dialog in this document — '+"a dialog is a <dialog> element, and a popover is not one");e.setOpenDialog(c,f?g:null)},title:"Show Dialog",when:A},{args:{additionalProperties:!1,properties:{...r,open:{default:!0,description:"True to open the resolving-with popover, false to close it.",type:"boolean"}},required:[],type:"object"},category:"View",id:"canvas.setResolvingOpen",level:"document",menus:["palette"],group:"3_canvas",requires:"an open document",when:A,run:(l,s)=>{o("canvas.setResolvingOpen",s);let{open:c,pane:d}=s;e.setResolvingOpen(n(d)?d:m.activePaneId,c===void 0||Hi("canvas.setResolvingOpen",s,"open"))},title:"Show Resolving Values"},{args:{additionalProperties:!1,properties:{...r,name:We("The prop's name, as the component's state declares it."),value:{description:"The test value — any JSON. Null clears it and the prop returns to its default.",type:["string","number","boolean","array","object","null"]}},required:["name"],type:"object"},category:"View",id:"canvas.setTestProp",level:"document",menus:["palette"],group:"3_canvas",requires:"an open component document",when:A,run:(l,s)=>{let c=o("canvas.setTestProp",s),d=St("canvas.setTestProp",s,"name"),f=Object.keys(c.doc.document.state??{});if(!f.includes(d))throw RangeError(`command "canvas.setTestProp" argument "name": "${d}" is not a prop this component `+`declares — it declares: ${f.length>0?f.join(", "):"nothing"}`);let{value:g}=s,y={...c.session.ui.previewProps};if(g===null||g===void 0)delete y[d];else y[d]=g;c.session.ui.previewProps=Object.keys(y).length>0?y:null,i(s)},title:"Set Test Value"},{args:{additionalProperties:!1,properties:{...r,name:We("The route parameter's name, without brackets."),value:We("The value to preview the route with. Empty clears it.")},required:["name","value"],type:"object"},category:"View",id:"canvas.setRouteParam",level:"document",menus:["palette"],group:"3_canvas",requires:"an open page with a dynamic route",when:A,run:(l,s)=>{let c=o("canvas.setRouteParam",s),d=St("canvas.setRouteParam",s,"name"),f=Ac(c.documentPath);if(!f.includes(d))throw RangeError(`command "canvas.setRouteParam" argument "name": "${d}" is not a parameter of this `+`route — it has: ${f.length>0?f.join(", "):"none"}`);c.session.ui.previewParams={...c.session.ui.previewParams,[d]:St("canvas.setRouteParam",s,"value")},i(s)},title:"Set Route Parameter"}]}function GN(e,t){e.registerAll(oa(t))}function Vw(e=vr()){let t=tl(e.paneId),o=e.panels;for(let r of o){let i=r.element?.querySelector('[part="panel-header"]');if(i){let a=t===null&&r.mediaName==="base"||t===r.mediaName;i.toggleAttribute("data-active",a)}}}var L=null;function ra(e){if(L?.isConnected)return L;let t=e.createElement("div");return t.className="jx-drag-ghost",t.style.cssText="position:fixed;left:0;top:0;z-index:9999;pointer-events:none;display:none;padding:2px 8px;border-radius:4px;font-size:12px;line-height:1.4;white-space:nowrap;background:var(--accent,#3b82f6);color:var(--accent-fg,#fff);box-shadow:0 2px 8px rgba(0,0,0,0.25);transform:translate(8px,8px)",e.body.append(t),L=t,t}function lL(e,t,o,r=document){let i=ra(r);i.textContent=e,i.style.left=`${t}px`,i.style.top=`${o}px`,i.style.display="block"}function US(e,t){if(!L||L.style.display==="none")return;L.style.left=`${e}px`,L.style.top=`${t}px`}function nh(){if(L)L.style.display="none"}var Ao=function(){if(typeof window>"u")return null;var e=new Image;return e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",e}();function nl(e){var t=e.nativeSetDragImage;if(t&&Ao)t(Ao,0,0)}function $o(e,t){if(e==null)return{};var o={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;o[r]=e[r]}return o}function Io(e,t){if(e==null)return{};var o,r,i=$o(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)===-1&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}function Ve(e,t){var o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;return o.every(function(i){return Object.is(e[i],t[i])})}function Do(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ve,t=null;return function(o){if(t&&e(t.value,o))return t.value;return t={value:o},t.value}}var ia=["block"];function ko(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function Jo(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?ko(Object(o),!0).forEach(function(r){ol(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ko(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function aa(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function _t(e){var{client:t,borderBox:o}=e,r=o.height/4;if(t.y<=o.top+r)return"reorder-above";if(t.y>=o.bottom-r)return"reorder-below";return"make-child"}function sa(e){var{element:t,input:o,currentLevel:r,indentPerLevel:i,mode:a}=e,l={x:o.clientX,y:o.clientY},s=t.getBoundingClientRect();if(a==="standard"){var c=_t({borderBox:s,client:l});return{type:c,indentPerLevel:i,currentLevel:r}}var d=aa(s);if(a==="expanded"){var f=_t({borderBox:s,client:l});return{type:f==="reorder-above"?f:"make-child",indentPerLevel:i,currentLevel:r}}var g=i*r;if(l.x<s.left+g){if(l.y<d.y)return{type:"reorder-above",indentPerLevel:i,currentLevel:r};var y=(l.x-s.left)/i,b=Math.max(Math.floor(y),0);return{type:"reparent",desiredLevel:b,indentPerLevel:i,currentLevel:r}}return{type:_t({borderBox:s,client:l}),indentPerLevel:i,currentLevel:r}}function Ho(e,t){if(e.type!==t.type)return!1;if(e.type==="instruction-blocked"&&t.type==="instruction-blocked")return Ho(e.desired,t.desired);return Ve(e,t)}var la=Do(Ho);function ca(e){var{desired:t,block:o}=e;if(o!==null&&o!==void 0&&o.includes(t.type)&&t.type!=="instruction-blocked"){var r={type:"instruction-blocked",desired:t};return r}return t}function Uw(e,t){var o=t.block,r=Io(t,ia),i=sa(r),a=ca({desired:i,block:o}),l=la(a);return Jo(Jo({},e),{},ol({},qe,l))}function $p(e){var t;return(t=e[qe])!==null&&t!==void 0?t:null}var qe=Symbol("tree-item-instruction");var Lo=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="320" height="180" fill="#808080" fill-opacity="0.16"/><g fill="#808080" fill-opacity="0.38"><circle cx="118" cy="64" r="14"/><path d="M60 140l52-50 34 30 38-46 76 66z"/></g></svg>')}`;function ua(e){let t=e.getAttribute("src")?.trim()??"",o=e.getAttribute("srcset")?.trim()??"";if(t!==""||o!=="")return!1;return!(e.parentElement?.localName==="picture"?e.parentElement:null)?.querySelector("source[srcset]:not([srcset=''])")}function jt(e){if(ua(e))e.setAttribute("data-jx-image-placeholder",""),e.setAttribute("src",Lo);else if(e.hasAttribute("data-jx-image-placeholder")&&e.getAttribute("src")!==Lo)e.removeAttribute("data-jx-image-placeholder")}function jo(e){return e.localName==="img"}function _o(e){if(e.nodeType!==e.ELEMENT_NODE||!("querySelectorAll"in e))return[];let t=e,o=[...t.querySelectorAll("img")];return jo(t)?[t,...o]:o}function Fo(e){for(let r of _o(e))jt(r);let o=new(e.ownerDocument.defaultView?.MutationObserver??MutationObserver)((r)=>{for(let i of r){if(i.type==="attributes"){let{target:a}=i;if(a.nodeType===a.ELEMENT_NODE&&"localName"in a){let l=a;if(jo(l))jt(l)}continue}for(let a of i.addedNodes)for(let l of _o(a))jt(l)}});return o.observe(e,{attributeFilter:["src","srcset"],attributes:!0,childList:!0,subtree:!0}),()=>o.disconnect()}async function qw(e,t=new Map){jd(!0);try{if(!await da(e))return qo(e.tagName);let o=document.createElement(e.tagName);for(let i of e.props||[])if(i.default!==void 0&&i.default!=="false"&&i.default!=="''"){let a=String(i.default).replaceAll(/^'|'$/g,"");o.setAttribute(i.name,a)}let r=o;for(let[i,a]of t)r[i]=a;return Fo(o),o}catch(o){return console.warn("Component preview failed:",e.tagName,o),qo(e.tagName)}}async function da(e){if(e.source==="npm")return Boolean(customElements.get(e.tagName));if(e.path&&!e.path.endsWith(".json"))return!1;let t=S?.projectRoot;return await Yb(`${location.origin}/${t?`${t}/`:""}${e.path}`),!0}function qo(e){let t=document.createElement("div");return t.style.cssText="padding:12px;border:1px dashed var(--border);border-radius:var(--radius);color:var(--fg-dim)",t.textContent=`<${e}>`,t}var pa='[part="outline"]',Ft='[part="row"]',fa='[part="verbs"]',Be=null;function KN(){if(Be!==null)cancelAnimationFrame(Be);for(let e of st.dndCleanups)e();st.dndCleanups=[],Be=requestAnimationFrame(()=>{Be=null;let e=Sh?.querySelector(pa);if(!e)return;for(let o of e.querySelectorAll("[data-dnd-row]")){let r=o.dataset.value.split("/").map((c)=>/^\d+$/.test(c)?Math.trunc(Number(c)):c),i=Math.trunc(Number(o.dataset.dndDepth))||0,a=Object.hasOwn(o.dataset,"dndVoid"),l=Object.hasOwn(o.dataset,"dndExpanded"),s=zr(Wr({canDrag({element:c,input:d}){if(cx(d.clientX,d.clientY)?.closest(fa))return!1;return!0},element:o,getInitialData(){return{path:r,type:"tree-node"}},onGenerateDragPreview({nativeSetDragImage:c}){nl({nativeSetDragImage:c})},onDragStart(){if(o.dataset.dragging="",st.layerDragSourceHeight=o.offsetHeight,l)ma(o,e)},onDrop(){if(delete o.dataset.dragging,l)xn("leftPanel")}}),qs({element:o,canDrop({source:c}){let d=c.data.path;if(Array.isArray(d)&&ta(d,r))return!1;return!0},getData({input:c,element:d}){return Uw({path:r},{block:a?["make-child"]:[],currentLevel:i,element:d,indentPerLevel:16,input:c,mode:l?"expanded":"standard"})},onDragEnter({self:c}){Bo(o,c.data,e)},onDrag({self:c}){Bo(o,c.data,e)},onDrop(){me(e)}}));st.dndCleanups.push(s)}let t=Gs({onDrop({source:o,location:r}){me(e);let[i]=r.current.dropTargets;if(!i)return;let a=$p(i.data);if(!a||a.type==="instruction-blocked")return;let l=o.data,s=i.data.path;if(!Array.isArray(s))return;let c=l.type==="tree-node"&&o.element,d=c&&Object.hasOwn(c.dataset,"dndExpanded");if(Rb(u.value,a,l,s),d){let f=u.value,g=Oe(f?.session.selection);if(g)st._layersCollapsed||=new Set,st._layersCollapsed.add(g.join("/"))}},onDropTargetChange({location:o}){let[r]=o.current.dropTargets;if(r&&!$p(r.data))me(e)}});st.dndCleanups.push(t)})}function JN(){requestAnimationFrame(()=>{let e=Sh?.querySelector(".components-section");if(!e)return;for(let t of e.querySelectorAll("[data-component-tag]")){let o=t.dataset.componentTag;if(!o)continue;let r=Ne.find((s)=>s.tagName===o);if(!r)continue;let i=t.querySelector(".element-card-preview");if(i&&!i.querySelector(o))qw(r).then((s)=>{i.textContent="",i.append(s)});let a=Fc(r),l=Wr({element:t,getInitialData(){return{fragment:structuredClone(a),type:"block"}},onGenerateDragPreview({nativeSetDragImage:s}){nl({nativeSetDragImage:s})}});st.dndCleanups.push(l)}})}function YN(){requestAnimationFrame(()=>{let e=Sh?.querySelector('[part="content"]');if(!e)return;for(let t of e.querySelectorAll("[data-block-tag]")){let o=t.dataset.blockTag,r=t.querySelector(".element-card-preview");if(r&&!r.firstChild){let l=document.createElement(qn.has(o)?"span":o);l.textContent=o,r.append(l)}let i=eh(o),a=Wr({element:t,getInitialData(){return{fragment:structuredClone(i),type:"block"}},onGenerateDragPreview({nativeSetDragImage:l}){nl({nativeSetDragImage:l})}});st.dndCleanups.push(a)}})}function ma(e,t){let o=`${e.dataset.value}/`,r=t.querySelectorAll(Ft);for(let i of r)if(i.dataset.value?.startsWith(o))i.style.display="none"}function Bo(e,t,o){let r=$p(t);if(st._currentDropTargetRow&&st._currentDropTargetRow!==e)delete st._currentDropTargetRow.dataset.drop;if(!r||r.type==="instruction-blocked"){me(o);return}if(r.type==="make-child"){me(o),e.dataset.drop="",st._currentDropTargetRow=e;return}delete e.dataset.drop,st._currentDropTargetRow=e;let i=[...o.querySelectorAll(Ft)],a=i.indexOf(e),l=st.layerDragSourceHeight;for(let[s,c]of i.entries()){if(c.dataset.dragging!==void 0)continue;if(r.type==="reorder-above")c.style.transform=s>=a?`translateY(${l}px)`:"";else c.style.transform=s>a?`translateY(${l}px)`:""}}function me(e){if(st._currentDropTargetRow)delete st._currentDropTargetRow.dataset.drop,st._currentDropTargetRow=null;let t=e.querySelectorAll(Ft);for(let o of t)o.style.transform="",o.style.display=""}function zo(e,t,o){if(t==="make-child")return{index:rr(oe(e,o)).length,parent:o};let r=Ut(o),i=zi(o);if(!r||!Z(i))return;if(t==="reorder-above")return{index:i,parent:r};if(t==="reorder-below")return{index:i+1,parent:r};return null}function Rb(e,t,o,r){if(!e)return;if(o.type==="tree-node"){let i=o.path,a=zo(e.doc.document,t.type,r);if(a)Y(e,(l)=>Vp(l,i,a.parent,a.index))}else if(o.type==="block"){let i=zo(e.doc.document,t.type,r);if(i===void 0)return;let a=o.fragment;if(i)Y(e,(l)=>{or(l,i.parent,i.index,structuredClone(a)),kp(l,a.tagName),l.session.selection=[[...i.parent,"children",i.index]]})}}function Ko(e){let t={};for(let[o,r]of Object.entries(e?.nesting??{}))if(o!=="_root")t[o]=r?.inline===!0;for(let o of e?.inline??[])t[o]=!1;return t}function j(e){return JSON.parse(JSON.stringify(e))}var Xe=new WeakMap,x=new Set,ee=0,ve=new Map,lr=-1,cr=0,ga=600;function cL(e){return lr===e&&Date.now()-cr<=ga}var Uo=0,ur=new Set;function ha(e,t){let o;try{o=new URL(e,t.iframe.src||rh())}catch{return}if(!["http:","https:","mailto:","tel:"].includes(o.protocol))return;let r=o.href,i=en();if(i){i(r);return}window.open(r,"_blank","noopener,noreferrer")}function dL(e){ur.add(e)}function va(e){return ur.delete(e)}var q=new Map,ie=new Map,ye=new Map,ya=300;function uL(e,t,o,r=ya){let i=null;for(let s of x){if(!s.iframe.isConnected){x.delete(s);continue}if(s.ready&&!s.stylebook&&e!==null&&s.tabId===e){i=s;break}}if(!i)return Promise.resolve(null);Uo+=1;let a=Uo,l=j(t);return i.channel.post({contextPath:o?[...o]:null,exprs:l,gen:i.lastRenderedGen,kind:"evalExpr",reqId:a}),new Promise((s)=>{let c=setTimeout(()=>{q.delete(a),ie.delete(a),s(null)},r);ie.set(a,i),q.set(a,(d)=>{clearTimeout(c),ie.delete(a),s(d)})})}var Zo=0,se=new Map,xa=250;function hL(e,t=xa){let o=[];for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&!r.stylebook&&e!==null&&r.tabId===e)o.push(r)}if(o.length===0)return Promise.resolve();return new Promise((r)=>{let i=o.length,a=setTimeout(()=>{for(let c of s)se.delete(c),ye.delete(c);r()},t),l=()=>{if(i-=1,i===0)clearTimeout(a),r()},s=[];for(let c of o){Zo+=1;let d=Zo;s.push(d),se.set(d,l),ye.set(d,c),c.channel.post({kind:"flushEdits",reqId:d})}})}function qS(e){return Xe.get(e)??null}function Db(e){for(let t of x){if(!t.iframe.isConnected)continue;let o=He(t.iframe);if(e.x>=o.left&&e.x<=o.right&&e.y>=o.top&&e.y<=o.bottom)return t}return null}function Nb(e,t,o){ee+=1,ve.set(ee,o);let r=t.type==="tree-node"?{path:[...t.path],type:"tree-node"}:{type:t.type};return e.channel.post({dragSeq:ee,gen:e.lastRenderedGen,kind:"dragStart",src:r}),ee}function GS(){return ee}function Ul(e){let t=He(e.iframe),o=e.iframe.clientWidth>0?t.width/e.iframe.clientWidth:1;return{rect:t,scale:o}}function dr(e){if(e.stylebook)return"stylebook";return e.tabId??"unbound"}function pL(){let e=[];for(let t of x){if(!t.iframe.isConnected){x.delete(t);continue}let o=`canvas[${dr(t)}]`;if(!t.ready){e.push(`${o}: frame has not handshaked`);continue}let r=[...t.pendingTabIds.keys()];if(r.length>0)e.push(`${o}: gen ${r.join(", ")} unacked`);if(t.pendingPatches>0)e.push(`${o}: ${t.pendingPatches} unacked patch(es)`);if(t.pendingMeasures.size>0)e.push(`${o}: ${t.pendingMeasures.size} measure(s) in flight`);let{idle:i}=t;if(!i){e.push(`${o}: no quiescence report yet`);continue}if(i.gen!==t.lastRenderedGen)e.push(`${o}: quiescence is for gen ${i.gen}, DOM is gen ${t.lastRenderedGen}`);if(!i.fonts)e.push(`${o}: fonts still loading`);if(i.animations>0)e.push(`${o}: ${i.animations} running animation(s)`);if(i.images>0)e.push(`${o}: ${i.images} pending image retry(ies)`)}if(q.size>0)e.push(`canvas: ${q.size} expression eval(s) in flight`);return e}var ba=500,Ca=2,Pa=40;function pr(){let e=u.value?.id??null,t=null;for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(!o.ready||o.stylebook)continue;if(o.tabId===e)return o;t??=o}return t}function fr(e,t){let{rect:o,scale:r}=Ul(e),i=o.left+t.x*r,a=o.top+t.y*r,l=t.width*r,s=t.height*r;return{height:s,left:i,top:a,width:l,x:i+l/2,y:a+s/2}}function xe(e,t){return new Promise((o)=>{e.measureSeq+=1;let r=e.measureSeq,i=setTimeout(()=>{e.pendingMeasures.delete(r),o(null)},ba);e.pendingMeasures.set(r,(a)=>{clearTimeout(i);let[l]=a;o(l?fr(e,l.rect):null)}),e.channel.post({kind:"measure",paths:[[...t]],reqId:r})})}function fL(e){let t=qS(e),o=t?.lastHover;if(!t||!o)return null;return{settle:async()=>(await xe(t,o.path))?.top??null,top:fr(t,o.rect).top}}function mL(e){let t=pr();return t?xe(t,e):Promise.resolve(null)}function Sa(e){return new Promise((t)=>{let o=Number.NaN,r=0,i=0,a=()=>{let{top:l}=He(e.iframe);if(r=l===o?r+1:0,o=l,i+=1,r>=Ca||i>=Pa){t();return}requestAnimationFrame(a)};requestAnimationFrame(a)})}async function Ab(e){let t=pr();return t?H2(t,e):null}async function H2(e,t){let o=await xe(e,t);if(!o)return null;let r=W(e.canvasEl)?.surface;return VS({height:o.height,top:o.top},r),await Sa(e),xe(e,t)}function sP(e,t){let o=qS(e);return o?xe(o,t):Promise.resolve(null)}function wa(e){let t=e.canvasEl.parentElement;if(!t)return;let o=/scale\(([\d.]+)\)/.exec(e.canvasEl.style.transform),r=o?Number(o[1]):1;t.style.height=r===1?"":`${e.iframe.offsetHeight*r}px`}function mr(e){if(e.preview){e.iframe.style.height="100%",e.iframe.style.minHeight="0px";return}if(e.contentHeight===null)return;e.iframe.style.height=`${e.contentHeight}px`,e.iframe.style.minHeight=e.contentFragment?"0px":"480px",wa(e)}function Kt(e,t){if(e.preview=t,e.overlay.setSuppressed(t),t)e.pendingEnterEdit=null;mr(e)}function gL(e,t){Kt(Zt(e),t)}function Pc(e,t){if(!e.iframe.isConnected)return;e.channel.post(t)}function Gw(e){ve.delete(e)}function Kw(e){e.overlay.setDropIndicator(null)}var gr=null;function bL(e){gr=e}var Ta=300,hr=null;function vL(e){hr=e}var Gt=null;function yL(e){Gt=e}function Ma(e,t,o){if((t?Na(t.tagName):!1)&&t){e.overlay.setDropIndicator(null),e.overlay.setReplaceTarget(R(t.rect));return}e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(o?R(o.referenceRect):null,o?.edge)}function Yo(e){e.overlay.setReplaceTarget(null),e.overlay.setDropIndicator(null)}function Na(e){return e==="img"||e==="video"||e==="source"}function Oa(e,t){if(e.dataset.jxGutterDrop==="1")return;e.dataset.jxGutterDrop="1",e.addEventListener("dragover",(o)=>{if(![...o.dataTransfer?.types??[]].includes("Files"))return;if(o.preventDefault(),o.dataTransfer)o.dataTransfer.dropEffect="copy"}),e.addEventListener("drop",(o)=>{let r=o.dataTransfer?.files,i=t();if(!r?.length||!i||i.stylebook)return;o.preventDefault(),Gt?.(E(i),[...r],null,null)})}var Ue=null;function wL(e){Ue=e}var Ge=null;function xL(e){Ge=e}var xr=null;function _L(e){xr=e}function Xo(e,t){let o=[...t];for(;;){let r=e.get(Mc(o));if(r)return r;if(o.length<2)return null;o=o.slice(0,-2)}}var N=null;function SL(){let e=N;return Boolean(e?.editing&&e.iframe.isConnected)}var Ze=null;function CL(e){Ze=e}var zt=null;function kL(e){zt=e}var Qo=null,br=null;function EL(e){br=e}function TL(e,t){for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(o.ready&&o.tabId===e.id&&!o.preview)o.popoverOpen=t,o.channel.post({kind:"setPopoverOpen",path:t})}}function LL(e,t){for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(o.ready&&o.tabId===e.id&&!o.preview)o.dialogOpen=t,o.channel.post({kind:"setDialogOpen",path:t})}}function KS(e,t){let o=0;for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&r.tabId===t){let i=W(r.canvasEl)?.surface;if(!i){jw("host-stage-unresolved");continue}let a=i.renderGeneration,l=et?.host===r?et.paths:void 0;tt(r),r.channel.post(l?{echoPaths:l,forwardOps:e,gen:a,kind:"patch"}:{forwardOps:e,gen:a,kind:"patch"}),r.pendingPatches+=1,o+=1}}return o}var et=null,Ra=0;function er(e,t,o){et={host:e,paths:t};try{o()}finally{et=null}}var qt=null,Wt=null;function Aa(e,t,o){return!e&&t===o}function Ia(e,t){let o=E(e);if(!o)return;let r=oe(o.doc.document,t);if(!r)return;KS([{key:"$props",op:"set-key",path:t,value:r.$props}],o.id)}function E(e){return e.tabId?m.tabs.get(e.tabId)??null:null}function $L(e){return E(e)}function ze(e){let t=W(e.canvasEl)?.surface.paneId;if(t)kr(t)}var Da=Object.freeze([]);function ka(){let e=new Map;for(let t of m.panes){let o=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!o)continue;let r=o.session.selection;r.map((i)=>i.join("/")).join("|"),e.set(o.id,r)}return e}function Ja(){if(Qo)return;let e=ge(!0);e.run(()=>{ne(()=>{let t=ka();h.stylebook.selection;for(let o of x)nt(o,(o.tabId?t.get(o.tabId):null)??Da)})}),Qo={stop:()=>e.stop()}}function tt(e){if(!e.ready)return;let t=ph();if(t===e.postedVersions)return;if(e.postedVersions===null&&Object.keys(t).length===0){e.postedVersions=t;return}e.postedVersions=t,e.channel.post({kind:"assetVersions",versions:t})}var tr=!1,Bt=!1;function Ha(){if(tr)return;tr=!0,ge(!0).run(()=>{ne(()=>{if(L$.value,Bt)return;Bt=!0,queueMicrotask(()=>{Bt=!1,La()})})})}function La(){for(let e of x){if(!e.iframe.isConnected){x.delete(e);continue}tt(e)}}var nr=!1,Ke=null;function _a(){if(nr)return;nr=!0,ge(!0).run(()=>{ne(()=>{for(let t of m.panes){let o=t.activeTabId?m.tabs.get(t.activeTabId):null;if(!o)continue;let{peers:r}=Tn(o);r.map((i)=>JSON.stringify(i.state.structuralSelection??null)).join("|")}if(Ke)clearTimeout(Ke);Ke=setTimeout(()=>{Ke=null;for(let t of x)Cr(t)},100)})})}function Cr(e){if(e.stylebook||!e.ready||!e.iframe.isConnected)return;let t=E(e),o=t?Tn(t).peers:[];e.presenceMeta.clear();let r=[];for(let i of o){let{structuralSelection:a}=i.state;if(!a||i.state.focusedPath!==t?.documentPath)continue;for(let l of a){let s=[...l];r.push(s),e.presenceMeta.set(JSON.stringify(s),{color:i.state.user.color,label:i.state.user.name??i.state.user.login})}}if(r.length===0){e.presenceReqId=-1,e.overlay.setPresence([]);return}e.measureSeq+=1,e.presenceReqId=e.measureSeq,e.channel.post({kind:"measure",paths:r,reqId:e.presenceReqId})}function nt(e,t){if(e.stylebook){ja(e);return}let o=Oe(t);if(e.selectionPath=o,e.selectionPaths=t,!e.iframe.isConnected){x.delete(e);return}if(!o){e.selReqId=-1,e.coSelectionKeys.clear(),e.overlay.setSelection(null),e.overlay.setCoSelection([]);return}if(!e.ready)return;let r=$a(t.slice(0,-1));e.coSelectionKeys=new Set(r.map((i)=>JSON.stringify(i))),e.measureSeq+=1,e.selReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o],...r],reqId:e.selReqId})}function ja(e){if(!e.iframe.isConnected){x.delete(e);return}let t=h.stylebook.selection,o=t?e.stylebook?.tagToCardPath.get(t):void 0;if(!t||!o){e.selReqId=-1,e.overlay.setSelection(null);return}if(!e.ready)return;e.measureSeq+=1,e.selReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o]],reqId:e.selReqId})}function ir(){return Zx("../canvas.html")}function Pr(e){e.channel.dispose();for(let[t,o]of q)if(ie.get(t)===e)q.delete(t),ie.delete(t),o(null);for(let[t,o]of se)if(ye.get(t)===e)se.delete(t),ye.delete(t),o();for(let[,t]of e.pendingMeasures)t([]);if(e.pendingMeasures.clear(),e.pendingTabIds.clear(),be(e),N===e)N=null;e.overlay.root.remove(),e.iframe.remove(),Xe.delete(e.canvasEl),x.delete(e)}function Fa(){if(!_e())return ir();return p().canvasUrl||ir()}function Ob(e){let t=0;for(let o of new Set(x))if(e.contains(o.canvasEl))Pr(o),t+=1;return t}function Zt(e){let t=Fa(),o=Xe.get(e);if(o){if(o.canvasUrl===t)return o;Pr(o)}let r=location.origin,i=crypto.randomUUID(),a=new URL(t,location.href).origin,l=document.createElement("iframe");l.className="jx-canvas-iframe",l.title="Canvas — live page render",l.style.cssText="width:100%;min-height:480px;height:100%;border:0;display:block;background:#fff";let s=new URL(t,location.href);if(s.searchParams.set("token",i),location.protocol==="http:"||location.protocol==="https:")s.searchParams.set("parentOrigin",r);if(l.src=a===r?`${s.pathname}${s.search}`:s.href,!e.style.position)e.style.position="relative";let c=ro(document);e.replaceChildren(l,c.root),Oa(e,()=>qS(e));let d=Qt({acceptOrigin:a,source:window,target:{postMessage:(g,y)=>l.contentWindow?.postMessage(g,y)},targetOrigin:a,token:i}),f={canvasEl:e,canvasUrl:t,channel:d,contentFragment:!1,contentHeight:null,hiddenPaths:new Set,popoverOpen:null,dialogOpen:null,editing:!1,editingProp:null,iframe:l,insertHideTimer:null,insertHover:!1,coSelectionKeys:new Set,insertZone:null,lastRenderedGen:-1,lastHover:null,lastSelectionRect:null,lastSnapshotSeq:0,measureSeq:0,overlay:c,panReqId:-1,pending:null,postedVersions:null,idle:null,pendingEnterEdit:null,pendingMeasures:new Map,pendingPatches:0,pendingTabIds:new Map,presenceMeta:new Map,presenceReqId:-1,preview:!1,ready:!1,selectionPath:null,selectionPaths:[],selReqId:-1,snapshot:null,stylebook:null,tabId:null};return c.insertButton.addEventListener("click",(g)=>Wa(f,g)),c.insertButton.addEventListener("mouseenter",()=>{f.insertHover=!0,be(f)}),c.insertButton.addEventListener("mouseleave",()=>{f.insertHover=!1,wr(f)}),d.onMessage((g)=>za(f,g)),Xe.set(e,f),x.add(f),Ja(),_a(),Ha(),f}function Va(e,t){be(e),e.insertZone=t,e.overlay.setInsertZone(R(t.rect),t.edge)}function Sr(e){be(e),e.insertZone=null,e.insertHover=!1,e.overlay.setInsertZone(null)}function qa(e){let t=e.overlay.insertButton;return e.insertHover||t.matches(":hover")}function wr(e){be(e),e.insertHideTimer=setTimeout(()=>{if(e.insertHideTimer=null,qa(e))return;Sr(e)},Ta)}function be(e){if(e.insertHideTimer!==null)clearTimeout(e.insertHideTimer),e.insertHideTimer=null}function Wa(e,t){t.stopPropagation(),t.preventDefault();let o=e.insertZone;if(!o)return;hr?.(e.overlay.insertButton,o)}var Ba=new Set(["contextMenu","dragOver","dropResult","editCommit","editCommitProp","editInput","editInsert","editMerge","editRangeReplace","editSplit","editStart","fileDragOver","fileDrop","hit","hover","insertZones","layoutHit","nativeDragEnter"]);function za(e,t){if(e.preview&&Ba.has(t.kind))return;switch(t.kind){case"ready":{e.ready=!0;let o=Yt?.();if(o)e.channel.post({chords:o.chords,kind:"keymap",mac:o.mac});if(e.postedVersions=null,tt(e),e.pending)e.channel.post(e.pending),e.pending=null;nt(e,e.selectionPaths);return}case"paneFocus":{ze(e),zt?.();return}case"popoverTargetClick":{let o=E(e);if(!o||e.preview)return;let r=JSON.stringify(o.session.ui.openPopover)===JSON.stringify(t.targetPath),i=t.action==="show"||t.action==="toggle"&&!r;if(i||r)ae()?.run("canvas.setPopoverOpen",{open:i,path:t.targetPath});return}case"commandTargetClick":{let o=E(e);if(!o||e.preview)return;let r=(a)=>JSON.stringify(a)===JSON.stringify(t.targetPath),i=oe(o.doc.document,t.targetPath);if(!Gn(i))return;if(At.has(t.command)){if(!Ea(i))return;let a=t.command==="show-popover"||t.command==="toggle-popover"&&!r(o.session.ui.openPopover);if(a||r(o.session.ui.openPopover))ae()?.run("canvas.setPopoverOpen",{open:a,path:t.targetPath})}else if(Rt.has(t.command)){if(!H(i))return;let a=t.command==="show-modal";if(a||r(o.session.ui.openDialog))ae()?.run("canvas.setDialogOpen",{open:a,path:t.targetPath})}return}case"hit":{ze(e),zt?.(),YL(null);let o=null,r=W(e.canvasEl)?.panel;if(r?.mediaName&&!r.mediaName.startsWith("git-diff")){o=ke(r.mediaName);let a=E(e);if(a)a.session.ui.activeMedia=o}if(Ge?.dismiss(),e.stylebook){let a=Xo(e.stylebook.pathToTag,t.hit.path);if(xr?.(a,o),a){let l=R(t.hit.rect);e.overlay.setSelection(l,`<${a}>`),e.lastSelectionRect=l}else e.overlay.setSelection(null);return}e.selectionPath=t.hit.path,e.selectionPaths=[t.hit.path];let i=E(e);if(i)i.session.selection=t.additive?Ix(i.session.selection,t.hit.path):[t.hit.path];{let a=R(t.hit.rect);e.overlay.setSelection(a),e.lastSelectionRect=a}return}case"layoutHit":{if(e.stylebook)return;ze(e),Ge?.dismiss(),YL(t.hit),e.selectionPath=null,e.selectionPaths=[];let o=E(e);if(o)o.session.selection=[];let r=R(t.hit.rect);e.overlay.setSelection(r,`LAYOUT · ${t.hit.layoutFile}`),e.lastSelectionRect=r,xn("rightPanel");return}case"hover":{if(e.stylebook){let o=t.hit?Xo(e.stylebook.pathToTag,t.hit.path):null,r=h.stylebook.selection;if(t.hit&&o&&o!==r)e.overlay.setHover(R(t.hit.rect));else e.overlay.setHover(null);return}e.lastHover=t.hit,Za(e,t.hit);return}case"insertZones":{if(e.stylebook)return;let o=t.zones?.[0]??null;if(o)Va(e,o);else wr(e);return}case"geometry":{let o=e.pendingMeasures.get(t.reqId);if(o){e.pendingMeasures.delete(t.reqId),o(t.hits);return}if(t.reqId===e.presenceReqId){e.presenceReqId=-1;let r=[];for(let i of t.hits){let a=e.presenceMeta.get(JSON.stringify(i.path));if(a)r.push({...a,placement:R(i.rect)})}e.overlay.setPresence(r);return}if(t.reqId===e.panReqId){e.panReqId=-1;let[r]=t.hits;if(r){let{rect:i,scale:a}=Ul(e);Oo({height:r.rect.height*a,top:r.rect.y*a+i.top})}return}if(t.reqId===e.selReqId){let r=JSON.stringify(e.selectionPath),i=[],a=null;if(e.stylebook){let[s]=t.hits;a=s?R(s.rect):null}else for(let s of t.hits){let c=JSON.stringify(s.path);if(c===r)a=R(s.rect);else if(e.coSelectionKeys.has(c))i.push(R(s.rect))}let l=e.stylebook?h.stylebook.selection:null;e.overlay.setSelection(a,l?`<${l}>`:null),e.overlay.setCoSelection(i),e.lastSelectionRect=a,e.hiddenPaths=new Set((t.hidden??[]).map((s)=>JSON.stringify(s)))}return}case"evalResult":{let o=q.get(t.reqId);if(!o)return;q.delete(t.reqId),ie.delete(t.reqId),o(t.gen===e.lastRenderedGen?t.results:null);return}case"renderComplete":{if(e.pendingTabIds.has(t.gen))e.tabId=e.pendingTabIds.get(t.gen)??null;for(let o of e.pendingTabIds.keys())if(o<=t.gen)e.pendingTabIds.delete(o);ar(e,t.gen);return}case"patchComplete":{e.pendingPatches=Math.max(0,e.pendingPatches-1),ar(e,t.gen);return}case"idle":{e.idle={animations:t.animations,fonts:t.fonts,gen:t.gen,images:t.images};return}case"renderError":{e.pendingTabIds.delete(t.gen);let o=E(e);if(o)o.session.canvas.refreshing=!1,xn("leftPanel");C.error("The page could not be rendered.",{detail:t.message,key:`canvas.render:${dr(e)}`,source:"Canvas"});return}case"dataScope":{if(t.gen!==e.lastRenderedGen)return;let o=E(e);if(o)o.session.canvas.scope=t.scope,o.session.canvas.refreshing=!1;xn("leftPanel");return}case"contentHeight":{e.contentHeight=t.height,e.contentFragment=t.fragment,mr(e);return}case"dragOver":{if(t.dragSeq!==ee)return;if(t.cursor)lr=t.dragSeq,cr=Date.now();if(t.gen!==e.lastRenderedGen)return;if(t.preview)e.overlay.setDropIndicator(R(t.preview.referenceRect),t.preview.edge);else e.overlay.setDropIndicator(null);if(t.cursor){let o=Ul(e);US(t.cursor.x*o.scale+o.rect.left,t.cursor.y*o.scale+o.rect.top)}return}case"nativeDragEnter":{if(e.stylebook)return;gr?.(e);return}case"dragEnd":{e.overlay.setDropIndicator(null),nh(),ve.delete(t.dragSeq);return}case"dropResult":{if(t.dragSeq!==ee||t.gen!==e.lastRenderedGen)return;if(t.instruction&&t.targetPath){let o=ve.get(t.dragSeq);if(o)Rb(E(e),{type:t.instruction},o,t.targetPath)}ve.delete(t.dragSeq),e.overlay.setDropIndicator(null),nh();return}case"fileDragOver":{if(e.stylebook)return;Ma(e,t.hit,t.preview);return}case"fileDragLeave":{Yo(e);return}case"fileDrop":{if(Yo(e),e.stylebook)return;Gt?.(E(e),t.files,t.hit,t.preview);return}case"patchError":{e.pendingPatches=Math.max(0,e.pendingPatches-1);let o=W(e.canvasEl)?.surface;if(o)br?.(o.paneId);return}case"forwardKey":{Ga(t.event);return}case"forwardWheel":{Ua(e,t);return}case"editStart":{if(N&&N!==e)N.editing=!1,N.editingProp=null,N.snapshot=null;if(N=e,t.prop!==void 0&&Wt===Mc(t.path))he(e,t.path,void 0,t.prop);Wt=null,Ra+=1,e.editing=!0,e.editingProp=t.prop??null,e.snapshot=null,e.lastSnapshotSeq=0,Ze?.();return}case"selectionChanged":{if(t.seq<=e.lastSnapshotSeq)return;if(e.lastSnapshotSeq=t.seq,e.snapshot=t,!e.editing)e.editing=!0,N=e;Ze?.();return}case"flushComplete":{let o=se.get(t.reqId);if(o)se.delete(t.reqId),ye.delete(t.reqId),o();return}case"editInput":{let o=E(e);if(o)o.doc.dirty=!0;return}case"editCommit":{let o=()=>Kn(E(e),t.path,t.children,t.textContent);if(t.inPlace)er(e,[t.path],o);else o();return}case"editCommitProp":{let o=()=>Zn(E(e),t.path,t.prop,t.value);if(t.inPlace){er(e,[t.path],o),qt=Mc(t.path);return}let r=o();if(Aa(r,qt,Mc(t.path)))Ia(e,t.path);qt=null,Wt=r?Mc(t.path):null;return}case"editMerge":{let o=Yn(E(e),t.fromPath,t.intoPath);if(o)he(e,o.path,o.offset);return}case"editRangeReplace":{let o=no(E(e),t.from,t.to,t.between,t.text);if(o)he(e,o.path,o.offset);return}case"editSplit":{he(e,Qn(E(e),t.path,t.before,t.after));return}case"editInsert":{he(e,eo(E(e),t.path,t.cmd,t.commitData));return}case"slashShow":{let{rect:o,scale:r}=Ul(e),i=t.rect.x*r+o.left,a=t.rect.y*r+o.top,l={filter:t.filter,onDismiss:()=>e.channel.post({kind:"slashDismissed"}),onSelect:(s)=>e.channel.post({cmd:{...s},kind:"slashSelect"}),rect:{bottom:a+t.rect.height*r,height:t.rect.height*r,left:i,top:a,width:t.rect.width*r}};if(t.showFilter===!0)l.showFilter=!0;Ue?.show(l);return}case"slashNav":{Ue?.nav(t.key);return}case"slashDismiss":{Ue?.dismiss();return}case"previewNavigate":{ha(t.href,e);return}case"contextMenu":{if(e.stylebook)return;ze(e);let{rect:o,scale:r}=Ul(e);Ge?.show({clientX:t.x*r+o.left,clientY:t.y*r+o.top,path:t.path?[...t.path]:null});return}case"editEnd":{if(!e.editing)return;if(e.editing=!1,e.editingProp=null,e.snapshot=null,N===e)N=null;Ze?.();break}default:break}}function ar(e,t){if(e.lastRenderedGen=t,nt(e,e.selectionPaths),Cr(e),Sr(e),es(e),e.pendingEnterEdit&&t>=e.pendingEnterEdit.minGen){let{offset:o,path:r,prop:i}=e.pendingEnterEdit;if(e.pendingEnterEdit=null,e.tabId!==null&&e.tabId===ce(e.canvasEl)?.id)Ka(e,r,o,i)}}function he(e,t,o,r){let i={minGen:e.lastRenderedGen,path:[...t]};if(o!==void 0)i.offset=o;if(r!==void 0)i.prop=r;e.pendingEnterEdit=i}function Ka(e,t,o,r){let i={kind:"enterEdit",path:[...t]};if(o!==void 0)i.offset=o;if(r!==void 0)i.prop=r;e.channel.post(i)}function Ua(e,t){let{rect:o,scale:r}=Ul(e),i=Zc(e.canvasEl)?.wrap;if(!i)return;i.dispatchEvent(new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:o.left+t.x*r,clientY:o.top+t.y*r,ctrlKey:t.ctrlKey,deltaX:t.deltaX,deltaY:t.deltaY,metaKey:t.metaKey,shiftKey:t.shiftKey}))}function Ga(e){document.dispatchEvent(new KeyboardEvent("keydown",{altKey:e.altKey,bubbles:!0,cancelable:!0,code:e.code,ctrlKey:e.ctrlKey,key:e.key,metaKey:e.metaKey,shiftKey:e.shiftKey}))}function Za(e,t){if(!t||Er(t.path,e.selectionPath)){e.overlay.setHover(null);return}e.overlay.setHover(R(t.rect))}var Ya=4,X=new Map;function Xa(e){let t=X.get(e);if(t)return X.delete(e),X.set(e,t),t;let o=new Map;X.set(e,o);for(let r of X.keys()){if(X.size<=Ya)break;X.delete(r)}return o}function Qa(e,t,o,r,i,a=null){let l=Xa(e),s=r?.id??null,c=l.get(t);if(c&&c.tabId===o&&c.viewTabId===s&&c.mode===a)return c.payload;let d=va(i),f=OS(Ln,async()=>{Vo.renderPreparations+=1;let g=await kn(t,r,a),y=j(g.renderDoc),b=j(t),T=o?m.tabs.get(o)??null:null,k=Wi(T?.doc.sourceFormat)?.studio?.elements,I=k?Ko(k):void 0,J={assets:g.assets,doc:y,docBase:g.docBase??`${rh()}/`,mapperCtx:g.mapperCtx,mode:g.mapperCtx.canvasMode,shadowDoc:b,siteStyle:g.siteStyle};if(I)J.editableTags=I;if(d)J.allowAutoRequests=!0;return J});return l.set(t,{mode:a,payload:f,tabId:o,viewTabId:s}),f}async function IL(e,t,o,r,i=null,a=ce(o),l=null,s=null){let c=Zt(o);c.pendingTabIds.set(e,i),c.stylebook=null,c.iframe.style.width=r?`${r}px`:"100%";let f={...await Qa(e,t,i,a,ct(o),l),colorScheme:Mr(a),gen:e,kind:"render",locale:Or(a),popoverOpen:a?.session.ui.openPopover??null,dialogOpen:a?.session.ui.openDialog??null};if(s)f.diffMarks=s;c.popoverOpen=f.popoverOpen??null,c.dialogOpen=f.dialogOpen??null,Kt(c,f.mode==="preview"),Tr(c,f)}function Tr(e,t){if(Vo.hostRenderPosts+=1,e.ready){tt(e),e.channel.post(t);return}let o=e.pending;if(o?.kind==="render"&&o.gen>t.gen){e.pendingTabIds.delete(t.gen);return}e.pending=t}function RL(e,t,o,r){let i=Zt(o);i.pendingTabIds.set(e,null),i.stylebook={pathToTag:t.pathToTag,tagToCardPath:t.tagToCardPath},Kt(i,!1),i.pendingEnterEdit=null,i.iframe.style.width=r?`${r}px`:"100%";let a=j(t.doc),l=j(t.doc),s={assets:null,colorScheme:Mr(ce(o)),locale:Or(ce(o)),doc:a,docBase:`${rh()}/`,gen:e,kind:"render",mapperCtx:{arrayPaths:[],canvasMode:"stylebook",layoutWrapped:!1,pageContentOffset:null,pageContentPrefix:null},mode:"stylebook",shadowDoc:l,siteStyle:null};Tr(i,s)}function Mr(e){let t=e?.session.ui.previewColorScheme;return t==="light"||t==="dark"?t:null}function DL(e,t){for(let o of x){if(!o.iframe.isConnected){x.delete(o);continue}if(t&&!t.contains(o.iframe))continue;if(o.ready)o.channel.post({kind:"setColorScheme",scheme:e})}}function Nr(e){return e===null?null:{dir:tv(e),locale:e}}function Or(e){return Nr(e?Ip(e.session.ui.previewLocale,e.documentPath):null)}function NL(e,t){let o=tv(e);for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(t&&!t.contains(r.iframe))continue;if(r.ready)r.channel.post({dir:o,kind:"setLocale",locale:e});else if(r.pending?.kind==="render")r.pending={...r.pending,locale:Nr(e)}}}function AL(e,t){let o=j(e),r=0;for(let i of x){if(!i.iframe.isConnected){x.delete(i);continue}if(i.ready)i.channel.post({base:t,doc:o,kind:"redefineElement"}),r+=1}return r}function OL(){let e=S?.projectConfig;if(!e)return;let t=j(e.style??null),o=j(e.$media??{});for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&!r.stylebook)r.channel.post({kind:"siteStyleUpdate",media:o,siteStyle:t})}}function Jw(e){let t=0,o=j(e);for(let r of x){if(!r.iframe.isConnected){x.delete(r);continue}if(r.ready&&r.stylebook)r.channel.post({gen:r.lastRenderedGen,kind:"styleUpdate",style:o}),t+=1,nt(r,r.selectionPaths)}return t}var Ye=null;function Rr(e,t){if(!e?.stylebook||!e.ready)return!1;let o=e.stylebook.tagToCardPath.get(t);if(!o)return!1;return e.measureSeq+=1,e.panReqId=e.measureSeq,e.channel.post({kind:"measure",paths:[[...o]],reqId:e.panReqId}),!0}function ML(e){Ye=Rr(Xt(),e)?null:e}function es(e){let t=Ye;if(t===null||!e.stylebook)return;if(h.stylebook.selection!==t){Ye=null;return}if(e===Xt()&&Rr(e,t))Ye=null}function ql(){let e=N;if(!e||!e.iframe.isConnected)return{editing:!1,editingProp:null,snapshot:null};return{editing:e.editing,editingProp:e.editingProp,snapshot:e.snapshot}}var Yt=null;function PL(e,t){Yt=e,t?.(()=>sr()),sr()}function sr(){let e=Yt?.();if(!e)return;for(let t of x){if(!t.iframe.isConnected){x.delete(t);continue}if(t.ready)t.channel.post({chords:e.chords,kind:"keymap",mac:e.mac})}}function ih(e){let t=N;if(!t||!t.ready)return;t.channel.post({intent:e,kind:"applyFormat"})}function FL(){let e=N;if(!e||!e.ready)return;e.channel.post({kind:"openSlash"})}function Yw(){let e=N;if(e?.editing&&e.ready&&e.iframe.isConnected)e.channel.post({kind:"endEdit"})}function Xt(){let e=ao();return e?qS(e.canvas):null}function JS(){let e=N,t=e??Xt();if(!t)return null;let{rect:o,scale:r}=Ul(t);if(t.lastSelectionRect)return{height:t.lastSelectionRect.height*r,left:t.lastSelectionRect.left*r+o.left,top:t.lastSelectionRect.top*r+o.top,width:t.lastSelectionRect.width*r};let i=t===e?t.snapshot?.rect:null;if(i)return{height:i.height*r,left:i.x*r+o.left,top:i.y*r+o.top,width:i.width*r};return null}
|
|
2
|
-
export{vN,Eb,vr,vt,Hr,kS,Nc,Wo,tl,yr,Ju,Ac,Yu,ES,yN,TS,wN,xN,LS,_N,$S,Zu,Tb,Lb,di,wm,YT,Fw,SN,Wl,Vl,Xu,CN,IS,ZT,Oc,Qu,kN,$b,Cp,RS,DS,EN,NS,XT,TN,LN,Vo,jw,AS,OS,ji,eh,QT,Ib,eL,$N,IN,kp,MS,RN,DN,Mc,PS,xm,NN,Hw,AN,Bw,ON,zw,Ep,Br,MN,_m,PN,FN,FS,jN,jS,HN,HS,tL,nL,BS,Sm,Tp,BN,zN,Ww,Us,th,Lp,WN,VN,zS,iL,Cm,WS,UN,VS,oL,qN,rL,sL,aL,GN,Vw,lL,US,nh,nl,Uw,$p,qw,KN,JN,YN,Rb,cL,dL,uL,hL,qS,Db,Nb,GS,Ul,pL,fL,mL,Ab,H2,sP,gL,Pc,Gw,Kw,bL,vL,yL,wL,xL,_L,SL,CL,kL,EL,TL,LL,KS,$L,Ob,IL,RL,DL,NL,AL,OL,Jw,ML,ql,PL,ih,FL,Yw,JS};
|
|
3
|
-
|
|
4
|
-
//# debugId=C58D1FBA6B0CFD7F64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-pqqq6v85.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{Ht,Wi,fn,lr,Aa}from"./studio-3w35qvay.js";import{C}from"./studio-4kzbrr5t.js";import{Pn,Kc,St,Hi,Ce,To,We,Wd,u}from"./studio-vzgmyt0v.js";import{Lo}from"./studio-ry81j4q1.js";import{te}from"./studio-psh8mwnw.js";import{lm}from"./studio-zg16eeq1.js";import{_a}from"./studio-34jrz12k.js";import{WD,tT}from"./studio-wxdcd42g.js";import{Co}from"./studio-5wzdy1jc.js";import{yr,Zu}from"./studio-pqqq6v85.js";import{lw,lb}from"./studio-jw0q5j6k.js";import{ab}from"./studio-zgx7svjd.js";import{Ml}from"./studio-dbxv7w4s.js";import{ya,Ic,GE}from"./studio-d038kqbs.js";import{as,fb}from"./studio-s0fg2wav.js";import{v}from"./studio-zkq3r91p.js";import{le}from"./studio-7xag4na8.js";var nb=["page","collection","template","component","media","entry"],nw={collection:{cta:"Create collection",hint:"Posts, products, team… with a page each",icon:"stack",id:"collection",label:"Collection",nameLabel:"Collection name",placeholder:"Recipes"},component:{cta:"Create component",hint:"A reusable block for any page",icon:"cube",id:"component",label:"Component",nameLabel:"Component name",placeholder:"Pricing table"},entry:{cta:"Create entry",hint:"A new item in a collection",icon:"file-text",id:"entry",label:"Entry",nameLabel:"Entry name",placeholder:"My first post"},media:{cta:"Upload",hint:"Images, video, documents",icon:"image",id:"media",label:"Media",nameLabel:"",placeholder:""},page:{cta:"Create page",hint:"A new URL on your site",icon:"file",id:"page",label:"Page",nameLabel:"Page name",placeholder:"Pricing"},template:{cta:"Create template",hint:"Shared frame that pages sit inside",icon:"frame-corners",id:"template",label:"Template",nameLabel:"Template name",placeholder:"Landing"}},Hs="blank",$c="article",P_="selection",sm="copy",iw=["title","image","richText","date","tags","number","link"],F_={date:{key:"date",label:"Date",schema:{format:"date",type:"string"}},image:{key:"cover",label:"Image",schema:{format:"image",type:"string"}},link:{key:"link",label:"Link",schema:{format:"uri",type:"string"}},number:{key:"number",label:"Number",schema:{type:"number"}},richText:{key:null,label:"Rich text",schema:null},tags:{key:"tags",label:"Tags",schema:{items:{type:"string"},type:"array"}},title:{key:"title",label:"Title",schema:{type:"string"}}},hE=["title","image","richText"];function p(e,n){return e==="."||e===""?n:`${e}/${n}`}function Qa(e){return e.replace(/^\.\//,"")}function j_(e,n){let t=n.defaultLayout;if(e===Hs||e==="")return t?!1:void 0;if(t&&Qa(t)===Qa(e))return;return e}function Mu(e){let n=e.defaultLayout;if(n)return e.layouts.find((r)=>Qa(r.ref)===Qa(n))?.ref??n;return e.layouts[0]?.ref??Hs}function H_(e,n){let t=Pn(n??"");if(t!==null){let r=e.layouts.find((o)=>Qa(o.ref).replace(/\.json$/i,"").split("/").some((l)=>Pn(l)===t));if(r)return r.ref}return Mu(e)}function R(e){return e.trim().replaceAll("\\","/").split("/").map((n)=>as(n)).filter((n)=>n!=="")}function I(e){let n={};for(let r of iw){let o=F_[r];if(e.includes(r)&&o.key!==null&&o.schema!==null)n[o.key]={...o.schema}}let t={properties:n,type:"object"};if(e.includes("title"))t.required=["title"];return t}function cD(e,n){let t=e?.properties??{};return iw.filter((r)=>{let{key:o}=F_[r];return o===null?n:Object.hasOwn(t,o)})}function w(e,n){let t=GE(e.schema);if(n!==void 0&&n!==""&&e.schema?.properties?.title!==void 0)t.title=n;if(e.ext===".json"||e.formatName===null)return{doc:t,format:null};return{doc:{...t,children:[]},format:e.formatName,frontmatter:Object.keys(t).length>0}}function pE(e,n,t,r){let o=[];if(n.includes("title"))o.push({tagName:"h1",textContent:"${state.entry.data.title}"});if(n.includes("image"))o.push({attributes:{alt:n.includes("title")?"${state.entry.data.title}":"",loading:"lazy",src:"${state.entry.data.cover}"},tagName:"img"});if(n.includes("richText")&&r.contentFormat!==null)o.push({children:"${state.entry.$children}",tagName:"div"});let i={};if(t!==void 0)i.$layout=t;return i.$paths={contentType:e,field:"id",param:"slug"},i.title=n.includes("title")?"${state.entry.data.title}":Zu(e),i.state={entry:{$prototype:"ContentEntry",$src:"@jxsuite/parser/ContentEntry.class.json",contentType:e,field:"id",id:{$ref:"#/$params/slug"}}},i.tagName="article",i.children=o,i}function am(e,n){let t=n.i18n??null,r=Pn(e);return t!==null&&r!==null&&t.locales.includes(r)?r:null}function ib(e){return e.dir.includes(Lo)}function _(e,n){return e.localeDirs?.[n]??e.dir.replace(Lo,n.toLowerCase())}function E(e,n,t){let r=t.i18n??null;if(n===null||r===null)return e;return Kc(e,n,{...r,locales:[...r.locales]})??e}function J(e){let n=e.lastIndexOf("/");return n===-1?[".",e]:[e.slice(0,n),e.slice(n+1)]}function W(e,n,t){if(n.startFrom===sm&&n.copyOf!==void 0){let r=t.componentDocs?.get(n.copyOf);if(r){let o=JSON.parse(JSON.stringify(r));return delete o.$id,o.tagName=e,o}}return{children:[],tagName:e}}function B(e,n,t){let r=n.startFrom??Mu(t),o=r===$c&&t.article!==null?t.article:null,i=o?.ext??".json",l=n.url===void 0?[as(e)].filter((m)=>m!==""):R(n.url),a=l.length===0?n.url===void 0?"":"index":l.at(-1),s=["pages",...l.slice(0,-1)].join("/"),c=a===""?"":`${a}${i}`,f=am(n.locale,t),d=c===""?p(s,c):E(p(s,c),f,t),b=c===""?s:J(d)[0],g=e.trim(),y;if(o)y={doc:{children:[{tagName:"h1",textContent:g}],title:g},format:o.name,frontmatter:!0};else{let m={},h=j_(r===$c?Hs:r,t);if(h!==void 0)m.$layout=h;m.title=g,m.tagName="main",m.children=[{tagName:"h1",textContent:g}],y={doc:m,format:null}}let N=c===""?"":yr(d).urlPattern;return{content:y,dir:b,ext:i,extraWrites:[],fileName:c,kind:"page",path:d,route:N,saved:c===""?"":`Saved as ${d} · opens at ${N}`}}function K(e,n,t){let r=as(e),o=n.fields??hE,i=t.i18n??null,l=i!==null&&n.localized!==!1,a=`content/${r}`,s=l?`${a}/${i.defaultLocale.toLowerCase()}`:a,c=t.contentFormat,f=c?.ext??".json",d=Zu(r),b=r===""?"":`first-${d.replaceAll(" ","-")}${f}`,g=I(o),y=structuredClone(g),N={format:c?.name??"json",schema:v(y)?y:{},source:l?`./${a}/${Lo}`:`./${a}`},m=w({ext:f,formatName:c?.name??null,schema:g},`First ${d}`),h=[],k,L="";if(n.ownPage!==!1&&r!==""){let j=n.pageTemplate??Mu(t),D=l?[i.defaultLocale,...i.locales.filter((x)=>x!==i.defaultLocale)]:[null],T=[];for(let x of D){let O=E(`pages/${r}/[slug].json`,x,t),A=x===null||j!==Mu(t)?j:H_(t,x);k??=yr(O).urlPattern,h.push({body:{doc:pE(r,o,j_(A,t),t),format:null},path:O}),T.push(O)}L=T.length===1?`, and ${T[0]} at ${k}`:`, and a page in each language (${T.join(", ")})`}let P={config:{entry:N,name:r},content:m,dir:s,ext:f,extraWrites:h,fileName:b,kind:"collection",path:p(s,b),saved:r===""?"":l?`Adds a “${r}” collection to project.json with one folder per language under ${a}/, a first entry in ${s}/${L}.`:`Adds a “${r}” collection to project.json, a ${s}/ folder with a first entry${L}.`};if(k!==void 0)P.route=k;return P}function M(e,n){let t=as(e),r=t===""?"":`${t}.json`,o=p("layouts",r),i={},l=n.startFrom??"";if(l!==""&&l!==Hs)i.$layout=l;return i.tagName="div",i.children=[{children:[{tagName:"slot"}],tagName:"main"}],{content:{doc:i,format:null},dir:"layouts",ext:".json",extraWrites:[],fileName:r,kind:"template",path:o,saved:r===""?"":`Saved as ${o} with one slot.`}}function z(e,n,t){let r=lb(e),o=r===""?"":`${r}.json`,i=p("components",o);return{content:{doc:W(r,n,t),format:null},dir:"components",ext:".json",extraWrites:[],fileName:o,kind:"component",path:i,saved:o===""?"":`Saved as ${i} with tag <${r}>.`,tag:r}}function U(e,n,t){let r=t.collections.find((d)=>d.name===n.collection)??null,o=as(e),i=r?.ext??".json",l=am(n.locale,t),a=r!==null&&ib(r)&&l===null,s=r===null?"content":ib(r)&&l!==null?_(r,l):r.dir,c=o===""||r===null||a?"":`${o}${i}`,f=p(s,c);return{content:r?w(r,e.trim()):{doc:{},format:null},dir:s,ext:i,extraWrites:[],fileName:c,kind:"entry",path:f,saved:c===""?"":`Saved as ${f} in ${r.name}.`}}function fE(e,n,t,r){switch(e){case"page":return B(n,t,r);case"collection":return K(n,t,r);case"template":return M(n,t);case"component":return z(n,t,r);case"entry":return U(n,t,r);default:{let o=t.files??0;return{content:{doc:{},format:null},dir:_a,ext:"",extraWrites:[],fileName:"",kind:e,path:_a,saved:o===0?`Saved under ${_a}/. No folder to choose.`:`${o===1?"1 file":`${o} files`} will be saved under ${_a}/.`}}}}function q(e,n){let t=e.lastIndexOf("/"),r=t===-1?".":e.slice(0,t),o=n(r);return fb(e.slice(t+1),"",{dir:r,taken:o??new Set})}function S(e){if(e.kind!=="page"||e.fileName==="")return[];let n=e.fileName.slice(0,e.fileName.length-e.ext.length);if(n!=="index")return[{dir:e.dir,stem:n},{dir:p(e.dir,n),stem:"index"}];let t=e.dir.lastIndexOf("/");if(t===-1)return[{dir:e.dir,stem:n}];return[{dir:e.dir,stem:n},{dir:e.dir.slice(0,t),stem:e.dir.slice(t+1)}]}function V(e,n){let t=e.fileName.toLowerCase();for(let{dir:r,stem:o}of S(e)){let i=`${o.toLowerCase()}.`;for(let l of n(r)??[])if(l.startsWith(i)&&!(r===e.dir&&l===t))return p(r,l)}return null}function H(e){return fb(e,"",{choice:{ext:"",kind:"fixed"},dir:".",taken:new Set})}function mE(e,n,t,r,o){if(e.kind==="media")return(t.files??0)===0?"Drop files here, or browse for them.":"";let i=H(n);if(i!=="")return i;switch(e.kind){case"page":{if(t.url!==void 0){if(t.url.replaceAll("\\","/").split("/").includes(".."))return"A URL cannot step outside the site.";if(!t.url.trim().startsWith("/"))return"A URL starts with a slash, such as /pricing."}let a=V(e,o);if(a!==null)return`${a} already opens at ${e.route??"/"}.`;break}case"component":{let a=e.tag??"",s=lw(a);if(s!=="")return s;if(r.componentTags.includes(a))return`A component named <${a}> already exists.`;if(t.startFrom===P_&&r.hasSelection!==!0)return"Select an element on the canvas to make a component from it.";if(t.startFrom===sm&&(t.copyOf===void 0||r.componentDocs?.get(t.copyOf)===void 0))return"Choose the component to copy.";break}case"collection":{let a=e.config?.name??"";if(r.declaredContent.includes(a))return`A collection named “${a}” already exists.`;if(o("content")?.has(a)===!0)return`content/${a}/ already exists.`;break}case"entry":{let a=r.collections.find((s)=>s.name===t.collection);if(!a)return"Choose the collection this entry belongs to.";if(ib(a)&&am(t.locale,r)===null)return`Choose the language this ${Zu(a.name)} is written in.`;break}default:break}let l=[...e.kind==="collection"?[]:[e.path],...e.extraWrites.map((a)=>a.path)];for(let a of l){let s=q(a,o);if(s!=="")return s}return""}function gE(e){let n=new Set,t=(r)=>{let o=r.lastIndexOf("/");n.add(o===-1?".":r.slice(0,o))};if(e.kind==="media")return[];if(e.kind==="collection")n.add("content");else if(e.fileName!=="")t(e.path);for(let r of e.extraWrites)t(r.path);for(let{dir:r}of S(e))n.add(r);return[...n]}function dD(e){let n=(r)=>r==="."?0:r.split("/").length,t=new Map;for(let r of e){let o=n(r);t.set(o,[...t.get(o)??[],r])}return[...t.entries()].toSorted(([r],[o])=>r-o).map(([,r])=>r)}function uD(e,n){if(e===".")return!1;let t=e.lastIndexOf("/"),r=n.get(t===-1?".":e.slice(0,t));return r!==void 0&&!r.has(e.slice(t+1).toLowerCase())}function B_(e){if(e.ext===".json")return null;return(e.def.format?Wi(e.def.format)?.name:void 0)??fn(`untitled${e.ext}`)?.name??lr()?.name??null}async function G(e){let n=w({ext:e.ext,formatName:B_(e),schema:e.schema});if(n.format===null)return Co(n.doc,null);return Aa(n.format,n.doc,{frontmatter:n.frontmatter??!1,mode:"roundtrip"})}async function Z2(e,n={}){let t=ya(e);if(!t)return C.error(`No content collection named "${e}" to create an entry in.`,{detail:"A collection needs a `content` entry in project.json whose `source` is a directory. A collection whose source names a single file (a CSV catalogue) has rows, not entry files.",source:"Content"}),null;await Ht().catch(()=>{});let r;try{r=await G(t)}catch(s){return C.error(`Could not prepare a new ${t.name} entry.`,{detail:te(s),path:t.dir,source:"Content"}),null}let o=n.dir,i=o!==void 0&&Wd(o)?.name===t.name?o:t.dir;if(i.includes(Lo))return C.error(`"${t.name}" is a localized collection.`,{detail:`Its entries live in one directory per language (${t.dir}). Open the folder for the language you are writing in and create the entry there.`,path:t.dir,source:"Content"}),null;let{createFileIn:l}=await (le("de90apn9"),import("./files-de90apn9.js")),a=await l({content:r,dir:i,format:{ext:t.ext,kind:"fixed"},source:"Content",suggestedName:"untitled",title:`New ${t.name} entry`});if(a===null)return null;return lm(t.name),await Ml(a),a}function F(){let e=u.value;return e&&Ic(e.documentPath)?e:null}function Y(){return[{args:Ce({path:We("Project-relative path of the entry file to open.")}),category:"File",id:"content.openEntry",level:"project",menus:["context/file","palette"],group:"1_file",requires:"an open project",when:(e)=>e.project.open,run:async(e,n)=>{await Ml(St("content.openEntry",n,"path"))},title:"Open Entry"},{args:Ce({draft:To("True marks the open entry a draft; false marks it published. Written as a `draft` field on the entry.")}),category:"Document",id:"content.setDraft",level:"document",menus:["context/tab","palette"],group:"3_document",requires:"a content entry open",when:(e)=>e.document.open,enablement:()=>F()!==null,undo:"document",run:(e,n)=>{let t=F();if(!t)throw Error("content.setDraft: the active document is not a content entry");ab(t,Hi("content.setDraft",n,"draft"))},title:"Set Draft"},{args:Ce({include:To("True lists entries marked `draft: true` alongside the rest.")}),category:"View",id:"content.setIncludeDrafts",level:"project",menus:["palette"],group:"2_view",requires:"an open project",when:(e)=>e.project.open,run:async(e,n)=>{WD(Hi("content.setIncludeDrafts",n,"include")),await tT()},title:"Include Drafts"}]}function bE(e){e.registerAll(Y())}
|
|
2
|
-
export{nb,nw,Hs,$c,P_,sm,iw,F_,hE,Qa,j_,Mu,H_,cD,pE,am,ib,fE,mE,gE,dD,uD,B_,Z2,bE};
|
|
3
|
-
|
|
4
|
-
//# debugId=A865AAF439BEFE2764756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-rzg8hnkf.js.map
|