@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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{p,_e}from"./studio-jws1a87n.js";import{rt,Eo,jA,Ap,fx,xr,BA,Op}from"./studio-th7z3fg7.js";import{C}from"./studio-y60sts62.js";import{Zs,dt}from"./studio-0w2dr0q8.js";import{n,Z,Ze,ee,v}from"./studio-8z66jk4z.js";var u=null;async function jd(){if(!_e()||!ee(p().getAccountStatus)){u=null;return}try{u=await p().getAccountStatus?.()??null}catch{u=null}}function sC(){return u}function aC(){return u!==null&&u.installations.length===0&&Boolean(u.appInstallUrl)}function _A(){if(u===null)return null;let e=u.installations.flatMap((r)=>r.manageUrl?[{account:r.account??`Installation ${r.id}`,url:r.manageUrl}]:[]);if(e.length===0&&!u.appInstallUrl)return null;let t={manage:e};if(u.appInstallUrl)t.installUrl=u.appInstallUrl;return t}function SA(){return u?.entries??[]}function s$(){return(u?.notices??[]).filter((e)=>e.display!=="toast")}var X=new Set;function Y(){let e=(u?.notices??[]).filter((t)=>t.display==="toast"&&!X.has(t.id));for(let t of e)X.add(t.id);return e}var Q="https://jxsuite.com/problems/";function N(e){return typeof e==="string"}function fe(e){return typeof e==="object"&&e!==null}function qb(e){if(!N(e)||!e.startsWith("https://jxsuite.com/problems/"))return null;let t=e.slice(29);return t===""?null:t}function nr(e){if(N(e))return e.trim()===""?null:e;if(!fe(e))return null;for(let t of[e.detail,e.error,e.title])if(N(t)&&t.trim()!=="")return t;return null}function ll(e,t){return nr(e)??(t===void 0?"Request failed":`Request failed (${t})`)}var m=(e,t,r,i)=>{let s={status:t,title:r,type:`${Q}${e}`};if(i!==void 0)s.extensions=i;return s},Ne={invalidRequest:m("invalid-request",400,"The request was malformed or incomplete"),notFound:m("not-found",404,"The requested resource does not exist"),methodNotAllowed:m("method-not-allowed",405,"That method is not allowed on this route"),conflict:m("conflict",409,"The request conflicts with the current state",["conflicts"]),payloadTooLarge:m("payload-too-large",413,"The request body is too large"),unauthorized:m("unauthorized",401,"Credentials are missing or not accepted"),forbidden:m("forbidden",403,"The request was refused"),needsInstallationAccess:m("needs-installation-access",403,"The GitHub App is not installed for that account",["installUrl"]),pathOutsideProject:m("path-outside-project",403,"The path resolves outside the active project"),actionRequired:m("action-required",403,"An action is required first",["actions","heading","retry"]),noActiveProject:m("no-active-project",409,"No project is active on this backend"),capabilityUnavailable:m("capability-unavailable",501,"This backend does not provide that capability"),upstreamFailure:m("upstream-failure",502,"An upstream service failed",["upstream"]),internalError:m("internal-error",500,"The backend failed to complete the request")};var o=(e,t,r,i)=>{let s={method:e,path:t,optional:i!==void 0,summary:r};if(i!==void 0)s.degradation=i;return s},Fe={activate:o("POST","/__studio/activate","Bind the backend to a project root"),project:o("GET","/__studio/project","Root project metadata {name, root}"),projectInfo:o("GET","/__studio/project-info","Probe a directory: {isSiteProject, projectConfig?, directories?}"),resolveSite:o("GET","/__studio/resolve-site","Resolve the owning site of a file path {sitePath, projectConfig?, fileRelPath?}"),sites:o("GET","/__studio/sites","Enumerate site projects [{config, path}] (backs listProjects)","The welcome screen's Projects catalogue stays hidden."),createProject:o("POST","/__studio/create-project","Scaffold a project at a caller-chosen destination → {root, config}"),starters:o("GET","/__studio/starters","Starter templates (StarterInfo[])","The New Project picker offers only blank/templates."),importSite:o("POST","/__studio/import-site","Clone a live website into a project; streams NDJSON progress","The New Project Import tab is unavailable."),files:o("GET","/__studio/files","List a directory (DirEntry[]) in stable path order; an entry may carry an opaque content `version` the backend vouches for; with ?glob=<pattern>, search matching files project-wide"),fileRead:o("GET","/__studio/file","Read a file's text content"),filesRead:o("POST","/__studio/files/read","Read many files' text content {paths} → ReadFilesResult {files: [path, {content} | "+"{error: {status, code?, message}}][], omitted}. At most READ_FILES_MAX_PATHS (200) paths and a backend byte budget per call: the excess is listed in `omitted` (never a 400) and the first path is always answered. Per-path errors: 404 missing/deleted, 415 binary, 413 too large, 502 upstream. Allowed for read-only sessions; keeps fileRead's server-side effects","Adapters fall back to one fileRead per path."),fileWrite:o("PUT","/__studio/file","Write a file's text content"),fileDelete:o("DELETE","/__studio/file","Delete a file"),fileUpload:o("POST","/__studio/file/upload","Upload binary content to a path → UploadResult {path, size?}. `path` is the answer, not an "+"echo: a store that de-duplicates, suffixes, or normalizes names reports what it really wrote"),fileBytes:o("GET","/__studio/file/bytes","A project file's raw bytes, undecoded — the read side of `fileUpload`, for a caller that must "+"not go through UTF-8","Studio can only read a project file as text, so any surface that must decode one stays hidden."),documentRaw:o("GET","/__studio/raw/","A project file as its own bytes, at its own URL — the mount a canvas renders against when "+"the editor origin does not serve the site's URL space. The project-relative path is appended to this prefix","The canvas cannot address project files by URL, so a host whose origin does not serve the site URL space renders no component $refs and no images."),fileRename:o("POST","/__studio/file/rename","Rename/move (+ refactor report). `from`/`to` are server-root-relative; every path in the "+"report is relative to the active project (specs/server.md §4.1)"),references:o("GET","/__studio/references","Where a file or a component tag is used (?path=&tag=, at least one) → ReferencesResult "+"{files, filesReferencing, refsTotal} — the read side of the rename refactor's own walker, "+"cached until the backend's watcher sees the tree move (backs findReferences). `?path=` is server-root-relative and every path in the answer is relative to the active project; a "+"target outside that project is a 400, never a zero-result 200 (specs/server.md §4.1)",'Usage counts are hidden: no "Used on N pages" in the inspector, no Selection: Find Usages, and delete/rename confirmations state no reference count.'),locate:o("POST","/__studio/locate","Find a file by name → {path | null}"),collab:o("GET","/__studio/collab","Realtime co-editing: a WebSocket upgrade speaking the @jxsuite/collab wire envelope (one socket per project, documents multiplexed by path; y-protocols sync + project-level "+"awareness in lib0 binary frames — see @jxsuite/collab/envelope for the frame layout and "+"the docEpoch/doc-reset lifecycle). A plain GET (no Upgrade) answers {collab, protocols, version} as the capability probe, and `protocols` is the subprotocol negotiation: the client offers one of them as Sec-WebSocket-Protocol and the server echoes it, or the "+"client offers none when the server advertises none, because RFC 6455 §4.1 fails a "+"connection whose offer went unechoed.","Realtime co-editing is unavailable; Studio edits solo with file-level saves"),components:o("GET","/__studio/components","Discover components (ComponentMeta[])"),cem:o("GET","/__studio/cem","Custom-elements manifest of an npm dependency","Dependency components lose prop/slot metadata."),formats:o("GET","/__studio/formats","The project's format registry entries plus a sibling `extensions` array — per enabled "+"extension its manifest identity and project-section contributions (ExtensionsInfo[]; backs listFormats and listExtensions).","Only .json documents open (backs listFormats); descriptor-contributed settings sections do not appear."),extensionCatalog:o("GET","/__studio/catalog","Extensions this backend can OFFER (ExtensionCatalogEntry[]) — the shipped first-party "+"catalogue plus any package in the project's own dependencies exporting a jx-extension.json, each marked with whether the host resolves it without a project install and whether the project has it installed. A capability rather than a constant: a Worker ships a fixed set "+"of extension packages (specs/extensions.md §5.5). Backs listExtensionCatalog.","The Extensions section offers no catalogue; adding an extension stays a typed package name."),projectSchemas:o("GET","/__studio/project-schemas","The project's generated entry documents (project.schema.json / document.schema.json), "+"PRE-BUNDLED into self-contained schemas — {project, document} (backs fetchProjectSchemas). "+"Regenerated on demand when missing or older than project.json.","The JSON editor falls back to the bundled core schemas (extension sections get no editor validation/completion)."),format:o("POST","/__studio/format","Dispatch a format capability {format, action: parse|serialize, source?|doc?}","Non-JSON documents cannot be parsed/serialized (backs formatAction)."),pluginSchema:o("GET","/__studio/plugin-schema","Extract a $studio schema from a class source","Plugin property panels fall back to generic JSON editing."),codeFormat:o("POST","/__studio/code/format","Format posted source {code, path?} → {code, errors}","Code editors skip format-on-open/save (codeService returns null)."),codeMinify:o("POST","/__studio/code/minify","Minify posted source {code} → {code}","Compiled-output minification is skipped."),codeLint:o("POST","/__studio/code/lint","Lint posted source {code, path?} → {diagnostics}","Code editors show no lint markers."),buildSite:o("POST","/__studio/build","Build or render the site → {routes, files, errors, mode?, url}","Build Site reports that this target cannot build."),previewSite:o("POST","/__studio/preview","Preview the working tree at a route → {routes, files, errors, mode, url, reused}","Open in Browser falls back to buildSite."),previewOverlay:o("POST","/__studio/preview/overlay","Publish (POST) or retract (DELETE) a document's unsaved bytes → 204","A live preview shows the last saved state instead of the editor's."),packages:o("GET","/__studio/packages","List dependencies (PackageInfo[])"),packagesAdd:o("POST","/__studio/packages/add","Add a registry dependency, writing package.json and package-lock.json together"),packagesRemove:o("POST","/__studio/packages/remove","Remove a dependency, writing package.json and package-lock.json together"),packagesInstall:o("POST","/__studio/packages/install","Install the declared dependencies (npm's installer, writing package-lock.json)","Install/reinstall affordances are hidden; add, remove and version updates still work where the backend serves them (a cloud session updates the lockfile without installing)."),packagesNeedsInstall:o("GET","/__studio/packages/needs-install","Whether node_modules is stale","The install-on-open prompt never shows."),packagesVersions:o("GET","/__studio/packages/versions","Newest published version of each dependency (PackageVersionInfo[])","The Latest column stays empty and the update affordances are hidden."),packagesSetVersions:o("POST","/__studio/packages/set-versions","Rewrite dependency ranges and install (lockfile-only where nothing installs)","Bulk version updates are hidden."),gitStatus:o("GET","/__studio/git/status","Working-tree status (GitStatusResult)"),gitBranches:o("GET","/__studio/git/branches","Branch list (GitBranchesResult)"),gitLog:o("GET","/__studio/git/log","Recent commits (GitLogEntry[])"),gitStage:o("POST","/__studio/git/stage","Stage files"),gitUnstage:o("POST","/__studio/git/unstage","Unstage files"),gitCommit:o("POST","/__studio/git/commit","Commit staged (else all dirty) files"),gitPush:o("POST","/__studio/git/push","Push (cloud: sync check — commits land on push)"),gitPull:o("POST","/__studio/git/pull","Pull/fast-forward; 409 {conflicts} on overlap"),gitFetch:o("POST","/__studio/git/fetch","Refresh remote tracking state"),gitCheckout:o("POST","/__studio/git/checkout","Switch branches"),gitCreateBranch:o("POST","/__studio/git/create-branch","Create a branch"),gitCommitBranch:o("POST","/__studio/git/commit-branch","Commit the change set as a NEW branch off the session's base, then take it out of this one "+"→ GitCommitBranchResult; 409 branch_exists","A publish the remote conflicts with reports the conflict alone, and Send for review stays refused on a branch whose every commit is live."),gitDiff:o("GET","/__studio/git/diff","Unified diff of dirty files (or one path)"),gitShow:o("GET","/__studio/git/show","File content at a ref"),gitDiscard:o("POST","/__studio/git/discard","Discard working changes"),gitInit:o("POST","/__studio/git/init","Initialize a repository"),gitAddRemote:o("POST","/__studio/git/add-remote","Add a remote"),gitClone:o("POST","/__studio/git/clone","Clone a repository","The welcome screen hides Clone Git Repository."),gitPr:o("POST","/__studio/git/pr","Open a pull request → PullRequestInfo","Studio falls back to a direct GitHub API call with the user's token."),dataConnections:o("GET","/__studio/data/connections","Connector connections with configured/missingSecrets/isDefault state, reachable table names, and registry-descriptor provider metadata (DataConnectionsResponse; backs dataConnections)","The connections settings section shows no status, and data-domain actions stay hidden."),dataConnectionTest:o("POST","/__studio/data/connections/test","Probe a connection {connection} → DataConnectionTestResult (backs dataConnectionTest)","The Test Connection action is hidden."),dataPush:o("POST","/__studio/data/push","Additive schema push {connection?, dryRun?} → DataPushResult (plan of DataPushStep[], "+"applied, warnings/errors; backs dataPush)","The Push Schema action is hidden; schemas deploy via `jx db push` instead."),dataRows:o("GET","/__studio/data/rows","Page a table (DataRowsQuery params) → DataRowsResult {rows, total, columns} (backs dataRows)","The data grid is unavailable."),dataInsertRow:o("POST","/__studio/data/rows","Insert a row {table, connection?, values} → {row} (backs dataInsertRow)","The data grid hides its add-row footer."),dataUpdateRow:o("PUT","/__studio/data/rows","Update a row keyed on its primary key {table, connection?, pk, set} → {row} (backs "+"dataUpdateRow)","Data grid cells are read-only."),dataDeleteRow:o("DELETE","/__studio/data/rows","Delete a row (?table=&pk=&connection=) → {ok} (backs dataDeleteRow)","The data grid hides row deletion."),secretsList:o("GET","/__studio/secrets","Configured secret env-var NAMES, never values (SecretsListResponse; backs listSecrets)","Secret fields cannot show set/unset state."),secretsSet:o("PUT","/__studio/secrets","Write/remove secrets in the backend store (.dev.vars locally) {set?, remove?} → names "+"(backs setSecrets)","The secret form control renders disabled; secrets are edited in .dev.vars by hand."),aiChat:o("POST","/__studio/ai/chat","StreamEvent SSE chat proxy {messages, tools, systemPrompt, model}"),aiModels:o("GET","/__studio/ai/models","Model catalogue (AiModelsResponse)"),cfProxy:o("POST","/__studio/cf/proxy","Allowlisted Cloudflare API passthrough {path, method?, body?} (backs cfApi)","The Publish panel explains the git-push publishing path instead.")};var a$=200,l$=100,c$=12;var me=new Set(["reload","repeat","none"]);function Np(e){if(!Array.isArray(e))return[];return e.flatMap((r)=>{if(!v(r))return[];let{href:i,id:s,label:d,primary:l}=r;if(!n(s)||!s||!n(d)||!d)return[];let g={id:s,label:d};if(n(i)&&i)g.href=i;if(l===!0)g.primary=!0;return[g]})}function te(e){return n(e)&&me.has(e)}function d$(e){return te(e)?e:void 0}function ge(e){return e.replaceAll("_","-")}function P(e){if(!v(e))return{};let{actions:t,code:r,conflicts:i,heading:s,installUrl:d,retry:l,type:g}=e,a={},c=qb(g)??(n(r)?ge(r):null);if(c!==null)a.code=c;if(n(d))a.installUrl=d;if(t!==void 0)a.actions=Np(t);if(n(s)&&s)a.heading=s;if(te(l))a.retry=l;if(Array.isArray(i))a.conflicts=i.filter((b)=>n(b));return a}function CA(e){let t=P(e);return(t.code==="pull-conflict"||t.code==="conflict")&&t.conflicts?t.conflicts:null}function kA(e){let t=P(e);return t.code==="needs-installation-access"&&t.installUrl?t.installUrl:null}function EA(e){return P(e).code==="action-required"}var B="X-Jx-Ai-Session";var F="X-Api-Provider";function oe(e){return typeof e==="string"}function ye(e){return oe(e)&&e!==""}function w(e){return typeof e==="object"&&e!==null}function be(e){return Array.isArray(e)}function xe(e,t){if(!e)return t;let r;try{r=JSON.parse(e)}catch{return e}if(w(r)){if("error"in r){let{error:i}=r;if(oe(i))return i;if(w(i)&&"message"in i&&Boolean(i.message))return String(i.message)}if("errors"in r&&be(r.errors)){let[i]=r.errors;if(w(i)&&"message"in i&&Boolean(i.message))return String(i.message)}}return e}function Se(e){let t;try{t=JSON.parse(e)}catch{return""}return w(t)&&"code"in t&&ye(t.code)?t.code:""}function ne(e,t){let r=t;if(r.name==="AbortError")return{type:"done",stopReason:"cancelled"};return{type:"error",message:`${e}: ${r.message}`}}function Ae(e){return typeof e==="function"}function u$({chatUrl:e,model:t="gpt-4o",apiKey:r,baseUrl:i,provider:s,sessionId:d}){let l=null;async function*g(a,c,b,A){let S={"Content-Type":"application/json"};if(r)S["X-Api-Key"]=r;if(i)S["X-Api-Base-URL"]=i;if(s&&s!=="openai-compat")S[F]=s;if(d)S[B]=d;l??=Promise.resolve(Ae(e)?e():e);let x;try{x=await l}catch(h){if(A.aborted){yield{type:"done",stopReason:"cancelled"};return}throw h}if(A.aborted){yield{type:"done",stopReason:"cancelled"};return}let f;try{f=await fetch(x,{method:"POST",headers:S,body:JSON.stringify({messages:a,tools:c,systemPrompt:b,model:t}),signal:A})}catch(h){yield ne("Network error",h);return}if(!f.ok){let h="";try{h=await f.text()}catch{}let T=xe(h,f.statusText),M=Se(h);yield{type:"error",message:T,code:M||String(f.status)};return}let y=f.body?.getReader();if(!y){yield{type:"error",message:"No response body"};return}let ue=new TextDecoder,U="";try{for(let h=await y.read();!h.done;h=await y.read()){U+=ue.decode(h.value,{stream:!0});let T=U.split(`
|
|
2
|
+
`);U=T.pop()||"";for(let M of T){let L=M.trim();if(!L||!L.startsWith("data: "))continue;let pe=L.slice(6),E;try{E=JSON.parse(pe)}catch{continue}if(yield E,E.type==="done"||E.type==="error")return}}}catch(h){y.cancel(),yield ne("Stream error",h)}}return{streamChat:g}}function sh(){return Eo(rt.aiOpenAiKey)}function TA(e){xr(rt.aiOpenAiKey,e||"")}function dx(){return jA(rt.aiOpenAiKey)}function cl(){return Eo(rt.aiBaseUrl)}function Ca(){return Eo(rt.aiProvider)==="anthropic"?"anthropic":"openai-compat"}function LA(){return Ca()==="openai-compat"?sh():""}function ux(){return Eo(rt.aiModel)}function $A(e){xr(rt.aiModel,e||"")}function G(e){return e==="anthropic"?"anthropic":""}function IA(e){BA([[rt.aiOpenAiKey,e.apiKey],[rt.aiBaseUrl,e.baseUrl],[rt.aiModel,e.model],[rt.aiProvider,G(e.provider)]])}function RA(e){return!Im(rt.aiOpenAiKey,e.apiKey,sh())||!Im(rt.aiBaseUrl,e.baseUrl,cl())||!Im(rt.aiModel,e.model,ux())||G(e.provider)!==G(Ca())}function Im(e,t,r){return fx(e,t)===fx(e,r)}function DA(){Op([rt.aiOpenAiKey,rt.aiBaseUrl,rt.aiModel,rt.aiProvider])}var Pe="claude-opus-5-5";function lC(){return{apiKey:sh(),baseUrl:cl(),provider:Ca()}}function se(e){let t=e.provider??"openai-compat";return`${e.apiKey}\x00${e.baseUrl}\x00${t}`}var _=null,O="",q=!1,j=!1,J="",H,V="",k=null,K=["openai-compat"],W=null,re=new Set,Re=600000,R=0,ie=!1;function ds(){_=null,O="",q=!1,j=!1,J="",H=void 0,V="",k=null,K=["openai-compat"],W=null,R=0}var ve=new Set([rt.aiOpenAiKey.key,rt.aiBaseUrl.key,rt.aiProvider.key,rt.cfToken.key,rt.cfAccountId.key]);Ap((e)=>{if(e.some((t)=>ve.has(t)))ds()});function h$(e){return _&&O===se(e)?_:null}function ae(e){return _?.find((t)=>t.id===e)}function p$(e){return ae(e)?.toolSupport}function NA(e){return ae(e)?.contextWindow}function hx(e){if(e)re.add(e);W??=ah({force:!0}).catch(()=>{}).then(()=>{R=Date.now();for(let t of re)t()})}function Te(){if(!j||R===0||Date.now()-R<Re)return!1;return W=null,R=0,hx(),!0}function Ee(){if(typeof window>"u"||ie)return;ie=!0,window.addEventListener("focus",()=>{Te()})}Ee();function Gb(){return dx()||cC()}function cC(){return q}function AA(){return j}function Rm(){return H}function OA(){return V}function dC(){return k}function MA(){return K}function we(){return J}function Zl(){let e=Ca()==="anthropic"?Pe:rt.aiModel.default;return ux()||we()||e}function Oe(e,t){let r;try{r=new URL(e,"http://jx.invalid")}catch{return e}return r.pathname=r.pathname.replace(/[^/]*$/,t),/^https?:/i.test(e)?r.href:`${r.pathname}${r.search}`}function ke(e){if(e===void 0)return["openai-compat"];return e.filter((t)=>["anthropic","openai-compat"].includes(t))}async function ah(e={}){let t=e.credentials??lC(),r=se(t);if(_&&O===r&&!e.force)return _;let i=p(),s=await Promise.resolve(i.aiChatUrl()),d=Oe(s,"models"),l={};if(t.apiKey)l["X-Api-Key"]=t.apiKey;if(t.baseUrl)l["X-Api-Base-URL"]=t.baseUrl;if(t.provider==="anthropic")l[F]=t.provider;let g=await fetch(d,{headers:l});if(!g.ok)throw Error(`HTTP ${g.status}`);let a=await g.json();if(q=a.configured===!0,j=a.managed===!0,J=a.defaultModel??"",H=a.code,V=a.upstreamError!==void 0?a.upstreamMessage??"":"",k=null,K=ke(a.providers),a.code==="action_required"){let c={actions:Np(a.actions)};if(n(a.detail)&&a.detail)c.detail=a.detail;k=c}return _=(a.models||[]).map((c)=>{let b={id:c.id,name:c.name||c.id};if(Z(c.contextWindow))b.contextWindow=c.contextWindow;if(Ze(c.toolSupport))b.toolSupport=c.toolSupport;return b}),O=r,_}var I=new Set,z=null;function PA(e){if(I.size===0){z=e;return}for(let t of I)t(e)}function ce(e){I.add(e);let t=z;if(z=null,t)e(t);return()=>{I.delete(e)}}function uC(){return _e()&&ee(p().performAction)}function f$(e){let t=e.find((i)=>i.primary)??e[0];if(!t)return null;let r=e.find((i)=>i!==t);return r?{lead:t,other:r}:{lead:t}}var D=null,le=!1;function hC(e){let t=f$(e.actions);if(!uC()||!t)return Promise.resolve(!1);return D??=Ce(e,t).finally(()=>{D=null}),D}async function Dm(e){let t=P(e);if(t.code!=="action-required"||!t.actions?.length)return!1;return hC({actions:t.actions,detail:e instanceof Error?e.message:void 0,heading:t.heading,retry:t.retry})}async function de(){ds(),await jd(),m$()}function Ce(e,t){let r=e.detail??"This needs one more step first.";return new Promise((i)=>{let s="offer",d=(x)=>{if(s==="done")return;s="done",S.close(),i(x)},l=(x)=>{s="offer",S.update({cancelLabel:"Not now",confirmLabel:t.lead.label,message:x,secondaryLabel:t.other?.label??""})},g=async(x)=>{let f;try{f=await x}catch(y){if(s==="waiting")l(y instanceof Error?y.message:String(y));return}if(f?.status==="done"){await de(),d(!0);return}if(s!=="waiting"||!f||f.status==="redirect")return;jd(),l(r)},a=(x)=>{if(s!=="offer")return;s="waiting";let f;try{f=p().performAction(x)}catch(y){l(y instanceof Error?y.message:String(y));return}S.update({cancelLabel:"Cancel",confirmLabel:"Waiting…",message:"Finish in the window that opened. This closes by itself once it is done.",secondaryLabel:""}),g(f)},{lead:c,other:b}=t,A={cancelLabel:"Not now",confirmLabel:c.label,headline:e.heading??"One more step",layer:dt("dialog"),message:r,onCancel:()=>{le=!0,d(!1)},onClosed:()=>{d(!1)},onConfirm:()=>{a(c)},region:"account/action"};if(b)A.onSecondary=()=>{a(b)},A.secondaryLabel=b.label;let S=Zs(A)})}function je(e){if(e==="reload")location.reload();else if(e==="repeat")C.info("Done. Run that again now.",{key:"account.action.retry",source:"Account"})}function FA(){return ce((e)=>{if(le||D)return;hC(e).then((t)=>{if(t)je(e.retry)})})}async function px(e){if(!uC())return!1;let t=p().performAction(e),r;try{r=await t}catch(i){return C.error(i instanceof Error?i.message:String(i),{key:"account.action",source:"Account",tier:"toast"}),!1}if(r?.status==="done")return await de(),!0;if(r?.status!=="redirect")await jd();return!1}function m$(){for(let e of Y()){let t={key:`account.notice.${e.id}`,source:"Account"};if(e.level==="warning")C.warn(e.message,t);else C.info(e.message,t)}}
|
|
3
|
+
export{jd,sC,aC,_A,SA,s$,qb,nr,ll,a$,l$,c$,Np,d$,CA,kA,EA,u$,sh,TA,dx,cl,Ca,LA,ux,$A,IA,RA,Im,DA,lC,ds,h$,p$,NA,hx,Gb,cC,AA,Rm,OA,dC,MA,Zl,ah,PA,uC,f$,hC,Dm,FA,px,m$};
|
|
4
|
+
|
|
5
|
+
//# debugId=584DA92FF104B84864756E2164756E21
|
|
6
|
+
//# sourceMappingURL=studio-hhp4x8xf.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
2
|
-
export{
|
|
1
|
+
import{p}from"./studio-jws1a87n.js";import{n}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var a=null,P=null,F=null,g=!1;function S(t){return F=t,g=!0,a?E():Promise.resolve()}async function E(){if(!g)return;g=!1;try{let{applyProjectSchemas:t}=await (le("7bffxd6v"),import("./monaco-setup-7bffxd6v.js"));t(F)}catch{}}function Zm(){if(a)return Promise.resolve(a);return P??=(async()=>{let[t]=await Promise.all([(le("xz02jeh1"),import("./editor-xz02jeh1.js")),(le("7bffxd6v"),import("./monaco-setup-7bffxd6v.js"))]);return a=t,await E(),a})(),P}function rf(){return a}function Cv(t,o,e){if(!t?.isConnected||o)return!1;return e()}var i=[],d=null;function Ft(){if(!d)d=(async()=>{try{i=await p().listFormats?.()??[]}catch{i=[]}return i})();return d}function $h(){d=null,i=[],f=null,c=[],x=null,l=[]}var c=[],f=null;function td(){if(!f)f=(async()=>{try{c=await p().listExtensions?.()??[]}catch{c=[]}return c})();return f}function kv(){return c}var l=[],x=null;function w(){if(!x)x=(async()=>{try{l=await p().listExtensionCatalog?.()??[]}catch{l=[]}return l})();return x}function Ux(){return l}async function j(t){let o=null;try{o=await t.fetchProjectSchemas?.()??null}catch{}S(o),await (le("ymf10teh"),import("./jx-validate-ymf10teh.js")).then(({applyProjectSchemas:e})=>e(o)).catch(()=>!1)}function tc(t){j(t),w(),(le("0rprf12d"),import("./extension-sections-0rprf12d.js")).then(({syncExtensionSettingsSections:o})=>o()).catch(()=>{})}function Qd(){return i}function Ma(t,o){let e=t.startsWith(".")?t.toLowerCase():`.${t.toLowerCase()}`;return i.find((r)=>r.extensions.includes(e)&&(!o||r.capabilities[o]))}function Wi(t){if(!t)return;return i.find((o)=>o.name===t)}function sf(t){return Error(`No format class imported for "${t}" — add one to project.json imports `+`(e.g. "Markdown": "@jxsuite/parser/Markdown.class.json") and make sure the project's dependencies are installed`)}function fn(t){if(!t)return;let o=t.lastIndexOf(".");if(o===-1)return;return Ma(t.slice(o))}function fl(t){let o=new Set;for(let e of i){if(t&&!e.documentKinds.includes(t))continue;for(let r of e.extensions)o.add(r)}return o.delete(".json"),[...o]}async function Ev(){return await Ft(),[".json",...fl("page")]}function lr(){return i.find((t)=>t.capabilities.serialize&&t.documentKinds.includes("content"))}async function M(t){let o=p();if(!o.formatAction)throw Error("Platform does not support format actions");return o.formatAction(t)}async function lI(t,o,e){return await M({action:"parse",format:t,options:e,source:o})}async function Pa(t,o,e){return await M({action:"serialize",doc:o,format:t,options:e})}function cI(t,o){let e=t?.studio?.documentMode,r=e?.componentWhen;if(r?.frontmatterKey){let s=o[r.frontmatterKey],u=r.matches?new RegExp(r.matches):/./;if(n(s)&&u.test(s))return{document:o,frontmatter:{},mode:"component"}}if(e?.default==="component")return{document:o,frontmatter:{},mode:"component"};let m=o.children??[];if(Array.isArray(m)&&m.length===0)m.push({children:[],tagName:"p"});let b=new Set(["state","imports"]),h={children:m},y={};for(let[s,u]of Object.entries(o)){if(s==="children")continue;if(b.has(s))h[s]=u;else y[s]=u}return{document:h,frontmatter:y,mode:"content"}}
|
|
2
|
+
export{Zm,rf,Cv,Ft,$h,td,kv,Ux,tc,Qd,Ma,Wi,sf,fn,fl,Ev,lr,lI,Pa,cI};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=04C1045F0EDA71D164756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-hz5n7x27.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var s=Object.create;var{getPrototypeOf:t,defineProperty:n,getOwnPropertyNames:u}=Object;var q=Object.prototype.hasOwnProperty;function v(a){return this[a]}var w,x,
|
|
2
|
-
export{
|
|
1
|
+
var s=Object.create;var{getPrototypeOf:t,defineProperty:n,getOwnPropertyNames:u}=Object;var q=Object.prototype.hasOwnProperty;function v(a){return this[a]}var w,x,op=(a,b,c)=>{var i=a!=null&&typeof a==="object";if(i){var f=b?w??=new WeakMap:x??=new WeakMap,d=f.get(a);if(d)return d}c=a!=null?s(t(a)):{};let g=b||!a||!a.__esModule||!q.call(a,"default")?n(c,"default",{value:a,enumerable:!0}):c;if(a&&typeof a==="object"||typeof a==="function"){for(let e of u(a))if(!q.call(g,e))n(g,e,{get:v.bind(a,e),enumerable:!0})}if(i)f.set(a,g);return g};var pe=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var y=(a)=>a;function z(a,b){this[a]=y.bind(null,b)}var eo=(a,b)=>{for(var c in b)n(a,c,{get:b[c],enumerable:!0,configurable:!0,set:z.bind(b,c)})};var r,o,m,le=(a,b)=>{for(var[c,i,f]of r||[])for(var d=[a],g=globalThis,e=g.document,p,k,l,h,j;k=d.pop();)if(!o[k]&&(l=i[k])){o[k]=1;for(h=1;h<l.length;h++)d.push(f[l[h]]);if(!b&&k!==a&&(p=e&&e.head)){if(m===void 0)m=(h=e.querySelector("meta[property=csp-nonce]"))&&(h.nonce||h.getAttribute("nonce"))||"";if(j=e.createElement("link"),j.rel="modulepreload",j.crossOrigin="",m)j.nonce=m;j.href=new g.URL(l[0],c),p.appendChild(j)}}},iP=(a,b,c,i)=>{for(var f={},d=0;d<b.length;d++)f[b[d]]=c[d];(r||=[]).push([a,f,b]),o||={},le(b[i],1)};
|
|
2
|
+
export{op,pe,eo,le,iP};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=B8E63D94823DC59564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-j3d2fjqz.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{p,_e}from"./studio-jws1a87n.js";import{Cs}from"./studio-r7pf0rkv.js";import{Q}from"./studio-nqxqf8p2.js";import{ge,ne,g,C}from"./studio-y60sts62.js";import{Qn,L,R,nt,ei}from"./studio-0w2dr0q8.js";import{Wt,ln,go,ov}from"./studio-k2sz13zg.js";import{Us}from"./studio-0q5jwddh.js";import{Bt}from"./studio-r4bcdwhq.js";import{Sr}from"./studio-mx6wzh25.js";import{Dp}from"./studio-8wnvtr4z.js";import{tr}from"./studio-f746039f.js";import{yr,Ju,ES,CN,Ib,hi,Fw,LN,ql,IS,Xu,IN,kp}from"./studio-rtfnhrdg.js";import{Cb,kb}from"./studio-qyed0ah6.js";import{xi}from"./studio-c71806xz.js";import{pp,V_,_E,ab,SE,ow,rw,vD,kE,hm,sw,xD,EE,lb,_D,SD,CD,kD,ED,TE,TD}from"./studio-cg1bfyhf.js";import{jl}from"./studio-khwbgrtg.js";import{eS}from"./studio-mxs3ar9t.js";import{wa}from"./studio-2ejhqns4.js";import{eN,Sw,Cw,vp}from"./studio-399xknkb.js";import{_p}from"./studio-s5tzw84t.js";import{S,xn}from"./studio-cg710sk9.js";import{n,ee,_,v}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";function te(e){return{contentType:null,draft:!1,layout:void 0,path:e}}function ue(e,t,a){let{contentType:r,layout:o}=IS(t,a),i=a?.[Cs]===!0||t?.[Cs]===!0;return{contentType:r,draft:i,layout:o,path:e}}async function De(e){try{let t=await p().readFile(e);if(e.endsWith(".json")){let o=JSON.parse(t);return _(o)&&!Array.isArray(o)?ue(e,o,null):te(e)}let{parseSourceForPath:a}=await (le("mexj5qed"),import("./file-ops-mexj5qed.js")),r=await a(e,t);return ue(e,r.document,r.frontmatter)}catch{return te(e)}}var Ie=300,q=null,V=null,ae=0,re=new Set;function me(e){let t=e.join(`
|
|
2
|
+
`);if(q?.key===t)return q.pages;if(!_e())return new Map(e.map((a)=>[a,te(a)]));if(V?.key!==t){let a=ae,r=Promise.all(e.slice(0,Ie).map((o)=>De(o))).then((o)=>{if(a!==ae||V?.read!==r)return;V=null,q={key:t,pages:new Map(o.map((i)=>[i.path,i]))};for(let i of re)i()});V={key:t,read:r}}return null}function Xg(){ae+=1,q=null,V=null}function fe(e){return re.add(e),()=>{re.delete(e)}}function Vy(e){return e?"true":"false"}function XR(e){return e.trim().toLowerCase()}function Qg(e,...t){return e===""||t.some((a)=>a.toLowerCase().includes(e))}function kd(e){let t=e.replaceAll(/[-_]+/g," ").trim();return t===""?e:t.charAt(0).toUpperCase()+t.slice(1)}function ie(e){let t=kd(e);if(/ies$/i.test(t))return`${t.slice(0,-3)}y`;if(/[^s]s$/i.test(t))return t.slice(0,-1);return t}function oe(e){let t=e.slice(e.lastIndexOf("/")+1),a=t.lastIndexOf(".");return a>0?t.slice(0,a):t}function Y(e,t,a){let r=go(t,a);return r===null?e:`${e} (${r})`}function U(e,t,a=null){if(go(t,a)!==null){let c=ov(t,a);return Y(U(yr(c),c),t,a)}if(e.urlPattern==="/")return"Home";let r=e.urlPattern.split("/").filter((c)=>c!==""),o=(c)=>c==="*"||c.startsWith(":"),i=r.at(-1)??oe(t);if(!o(i))return kd(i);let l=r.findLast((c)=>!o(c));return kd(l??oe(t).replaceAll(/[[\].]/g,""))}function QR(e,t,a,r={}){let o=r.i18n??null,i=e.flatMap((u)=>Ju(u.path,r.extensions)?[{fact:u,route:yr(u.path)}]:[]).toSorted((u,m)=>ES(u.route,m.route)||u.fact.path.localeCompare(m.fact.path)),l=[],c=(u,m,f,x)=>({detail:m.urlPattern,key:u.path,kind:f,label:x,path:u.path,selected:Vy(u.path===a)}),d=new Map;for(let u of i){let m=u.fact.contentType;if(m!==null&&t.has(m))d.set(m,[...d.get(m)??[],u])}let s=new Set;for(let{fact:u,route:m}of i){let f=u.contentType,x=f===null?void 0:d.get(f);if(f===null||x===void 0){l.push(c(u,m,"page",U(m,u.path,o)));continue}if(s.has(f))continue;s.add(f),l.push({detail:Ve(t.get(f)??null),key:`collection:${f}`,kind:"collection",label:kd(f),path:"",selected:"false"});let H=`${ie(f)} page`;for(let O of x){let N=Y(H,O.fact.path,o);l.push(c(O.fact,O.route,"entry-page",N))}}return l}function Ve(e){if(e===null)return"";return`${e} ${e===1?"entry":"entries"}`}function eD(e,t){if(t==="")return[...e];let a=[],r=null,o=!1;for(let i of e){if(i.kind==="collection"){if(r=i,o=Qg(t,i.label),o)a.push(i);continue}if(i.kind==="page")r=null;if(i.kind==="entry-page"&&o||Qg(t,i.label,i.detail,i.path)){if(r&&!o)a.push(r),o=!0;a.push(i)}}return a}function Jk(e,t,a,r=null){return e.filter((o)=>o.endsWith(".json")).toSorted((o,i)=>o.localeCompare(i)).flatMap((o)=>{let i=kd(oe(o));if(!Qg(a,i,o))return[];return[{detail:o===r?"default layout":"",key:o,label:i,path:o,selected:Vy(o===t)}]})}var ze='img:not([src]), img[src=""] { visibility: hidden; }',he=new WeakMap;function Be(e){let t=he.get(e);if(t)return t;let a=e.defaultView?.CSSStyleSheet;if(!ee(a))return null;let r=new a;return r.replaceSync(ze),he.set(e,r),r}function Uy(e,t){let a=e.shadowRoot??e.attachShadow({mode:"open"}),r=Be(e.ownerDocument);a.adoptedStyleSheets=[...eN(),...e.ownerDocument.adoptedStyleSheets,...r?[r]:[]],a.replaceChildren(t)}function qy(e){return e.shadowRoot?.firstElementChild??null}function z(e,t){if(e===void 0||e.trim()==="")return[];if(!t)return[e];return e.split(",").map((a)=>a.trim()).filter((a)=>a!=="")}var We=12;function be(e,t,a){let r=e.find((o)=>t.has(o.name));if(r)return{...r,order:t.get(r.name)};for(let o of e){if(o.measure)continue;let i=a.flatMap((c)=>z(c?.fields?.[o.name],o.list)),l=new Set(i).size;if(l>=2&&l<i.length&&l<=We)return{...o,order:[]}}return null}function T(e){return(t)=>e.get(t.path)}var we=T(new Map),de={board:{itemWidth:0,rowHeight:0,windowed:!1},calendar:{itemWidth:0,rowHeight:0,windowed:!1},cards:{itemWidth:200,rowHeight:194,windowed:!0},table:{itemWidth:0,rowHeight:32,windowed:!0}},He=60,se=25;function ve(e,t){let a=de[e];if(a.itemWidth<=0||t<=0)return 1;return Math.max(1,Math.floor(t/a.itemWidth))}function Ge(e){if(e===void 0||!Number.isFinite(e))return"";if(e<1024)return`${e} B`;let t=["KB","MB","GB"],a=e/1024,r=0;while(a>=1024&&r<t.length-1)a/=1024,r+=1;return`${a<10?a.toFixed(1):Math.round(a)} ${t[r]}`}function qe(e){return e?_p(new Date(e)):""}function Ye(e,t,a){switch(t){case"date":return a?.date??"";case"status":return a?.status??"";case"template":return a?.template??"";case"title":return a?.title??e.name;case"locale":return e.locale?Wt(e.locale):"";case"modified":return qe(e.modified);case"name":return e.name;case"path":return e.record?.source??e.path;case"size":return Ge(e.size);case"type":return e.type;case"url":return e.collection===hi?yr(e.path).urlPattern:"";default:{let r=kD(t);return r===null?"":a?.fields?.[r]??""}}}function xe(e,t,a,r){let o=Dp(e.ext),i=r?.thumb??"";return{art:o||i!==""?"image":a&&e.collection!==null&&!e.record?"doc":"glyph",cells:t.map((l)=>({field:l.field,text:Ye(e,l.field,r)})),meta:e.type,name:r?.title??e.name,path:e.path,src:o?tr(e.path):i}}function ce(e,t){return{art:"glyph",cells:[],meta:e.type,name:t?.title??e.name,path:e.path,src:""}}function $e(e,t=we){let{days:a,undated:r}=SD(e,(c)=>t(c)?.date||EE(c)),o=a.slice(0,He),i=a.length-o.length,l=o.map((c)=>({count:"",files:c.files.map((d)=>ce(d,t(d))),id:c.date,note:"",noteState:"hidden",title:c.date,undated:"false"}));if(r.length>0)l.push({count:"",files:r.slice(0,se).map((c)=>ce(c,t(c))),id:"__undated",note:`${r.length} file${r.length===1?"":"s"} with no dated name and no modification time.`,noteState:"shown",title:"No date",undated:"true"});return{groups:l,truncated:i>0?`${i} older ${i===1?"day is":"days are"} not shown — filter, or switch to Table.`:""}}var ye=["Draft","Published"];function Ue(e,t){let a=new Map;for(let o of e){let i=t(o)?.status||"No status",l=a.get(i);if(l)l.push(o);else a.set(i,[o])}let r=(o)=>{let i=ye.indexOf(o);return i===-1?ye.length:i};return[...a.entries()].map(([o,i])=>({files:i,group:o})).toSorted((o,i)=>r(o.group)-r(i.group)||o.group.localeCompare(i.group))}function Je(e,t,a){let r=`No ${a.title.toLowerCase()}`,o=new Map;for(let l of e){let c=z(t(l)?.fields?.[a.name],a.list);for(let d of c.length===0?[r]:new Set(c)){let s=o.get(d);if(s)s.push(l);else o.set(d,[l])}}let i=(l)=>{if(l===r)return Number.MAX_SAFE_INTEGER;let c=a.order.indexOf(l);return c===-1?a.order.length:c};return[...o.entries()].map(([l,c])=>({files:c,group:l})).toSorted((l,c)=>i(l.group)-i(c.group)||l.group.localeCompare(c.group))}function Se(e,t=we,a=null){return(e.some((i)=>(t(i)?.status??"")!=="")?Ue(e,t):a?Je(e,t,a):CD(e)).map((i)=>{let l=i.files.length-se;return{count:String(i.files.length),files:i.files.slice(0,se).map((c)=>ce(c,t(c))),id:i.group,note:l>0?`${l} more — switch to Table to see them.`:"",noteState:l>0?"shown":"hidden",title:i.group,undated:"false"}})}var Le={$schema:"https://jxsuite.com/schema/v1",$id:"StudioLibraryPane",$description:"The Content home (studio.md §22.5): one collection, browsed, as a Jx document over the kit. The adapter (`browse/library-pane.ts`) keeps every decision — which collection is shown, which of its files the filter kept, which of them the window renders, where the collection is published, and what a row's context menu offers — and hands this document one projection: a discriminant naming which of eight things to draw, the view switch already marked, a header line that is one of four states, and rows that are already strings. Nothing here asks what a file is, how big the viewport is, or whether the scan finished. The eight cases of `view` are the four honest empty states the Manage view collapsed into “No files found” — a scan still running, a scan that could not finish, a collection with nothing in it, and a filter that matched nothing — followed by the four views, so “what is on screen” has exactly one source. A card's live preview is an ISLAND: the document renders `doc-preview` and nothing inside it, and the adapter fills it through `onNodeCreated` when the card comes into view.",tagName:"div",attributes:{part:"library","data-jx-region":"${state.region}"},style:{$description:"What the fifty-two `.library*` rules in `styles/overlays.css` said, keyed on `part` and re-pointed at the studio token layer. Every one of them was this surface's alone, so the block goes with the conversion rather than being copied. Three sets of names could not come with the declarations. Ten `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px: a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, and `styles/spectrum.css` is deleted whole with the last Spectrum component, so a document that reads one is a document whose colours change when a component it does not use is removed. `--spectrum-gray-100` and `--spectrum-gray-200` are the studio's own `--bg-input` and `--hover-bg`; `--spectrum-blue-600` — the card's hover border and the drop outline — is `--accent`, which is what a Spectrum blue was standing in for; and `--spectrum-orange-100`, the incomplete-scan banner's ground, is mixed from `--warning` so the banner follows the chrome theme instead of being a dark-only hex. Nine names that were handles rather than styling stop being names at all: `.library-grid-cards`, `.library-grid-media`, `.library-day-undated`, `.library-drop-active`, `.library-upload-input` and the four `data-field` widths are `data-` attributes on a part here, because a part is the handle now.",display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="banner-slot"], & [part="locale-slot"], & [part="filter-slot"], & [part="fields-slot"], & [part="new-slot"], & [part="page-slot"], & [part="view-slot"], & [part="art-slot"], & [part="note-slot"], & [part="truncated-slot"]':{$description:"A `$switch` renders its own container, and none of these six is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"},'& [part="head"]':{$description:"The collection's title over its toolbar: the Content-Collection and Content-Pages boards' heading row. It does not scroll with the list.",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4) var(--jx-space-5) var(--jx-space-3)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="heading"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="subtitle"]':{margin:"0",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="subtitle"]:empty':{$description:"Only Pages carries a line under its title; a collection's own line is the header bar below the toolbar.",display:"none"},'& [part="toolbar"]':{$description:"It wraps rather than scrolls: the view switch, the search, the language facet, Fields and New are all equally reachable, and a toolbar that hid half of them behind an overflow would put the collection's own state somewhere the reader has to go looking for it.",display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"0",flexShrink:"0",flexWrap:"wrap"},'& [part="search"]':{width:"220px"},'& [part="locale"]':{$description:"Narrow on purpose: it holds one language name, and the toolbar wraps before it grows.",width:"160px"},'& [part="filter"]':{$description:"Narrow like the language facet: it holds one value of one field.",width:"160px"},'& [part="spacer"]':{flex:"1"},'& [part="layouts"]':{flexShrink:"0"},'& [part="banner"]':{$description:"The banner an INCOMPLETE listing carries. The Problem in the dock is the durable record; this is the same fact on the surface it is about, because a reader looking at a short list needs to know it is short for a reason without going anywhere to find out.",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--jx-space-4)",padding:"var(--jx-space-3) var(--jx-space-5)",background:"color-mix(in srgb, var(--warning) 18%, var(--bg-panel))",borderBottom:"1px solid var(--border)",color:"var(--fg)",fontSize:"var(--jx-text-md)"},'& [part="body"]':{flex:"1",minHeight:"0",overflow:"auto",position:"relative"},'& [part="empty"]':{padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)"},'& [part="empty"] p':{margin:"0"},'& [part="empty-detail"]':{fontSize:"var(--jx-text-md)",color:"var(--fg-dim)"},'& [part="truncated"]':{$description:"What a capped layout did not draw, stated. A grouped list cannot window — a window over one either breaks the groups or needs variable-height measurement — so Calendar and Board cap instead, and a layout that truncated in silence would be the same class of lie as “No files found”.",margin:"var(--jx-space-3) 0 0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="grid"]':{$description:"Cards and Media, the two windowed grids. The item sizes here are the ones `library-layouts.ts`'s LAYOUT_METRICS counts rows in; change one and change both.",display:"grid",gap:"var(--jx-space-4)",padding:"var(--jx-space-4) var(--jx-space-5)",alignItems:"start"},'& [part="grid"][data-layout="cards"]':{gridTemplateColumns:"repeat(auto-fill, minmax(188px, 1fr))"},'& [part="card"], & [part="tile"]':{cursor:"pointer",overflow:"hidden",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)"},'& [part="card"]:hover, & [part="tile"]:hover':{borderColor:"var(--accent)"},'& [part="card-art"], & [part="tile-art"]':{aspectRatio:"4 / 3",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:"var(--bg-input)",pointerEvents:"none"},'& [part="file-glyph"]':{"--jx-icon-size":"32px",color:"var(--fg-dim)"},'& [part="doc-preview"]':{$description:"The island. The document renders this box and nothing inside it; the adapter mounts a real runtime render of the file into a shadow root of the island's own when the card comes into view (`mountPreview` in `browse/library-preview.ts`, which keeps the document's ids out of Studio's), and the zoom is what makes a page-sized document readable as a thumbnail without rendering it at thumbnail size: the render is laid out in a box two and a half times as wide and drawn at 0.4. It is `inert`, so a page's own links and buttons are neither focusable nor named inside the card.",width:"100%",height:"100%",zoom:"0.4",overflow:"hidden"},'& [part="thumb"]':{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},'& [part="card-label"], & [part="tile-label"]':{padding:"6px var(--jx-space-3) 0",fontSize:"var(--jx-text-md)",color:"var(--fg)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},'& [part="card-meta"]':{padding:"0 var(--jx-space-3) 6px",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="table"]':{$description:"A windowed list rather than a table component: the rows have to be sliceable, and every table widget wants the whole set.",display:"flex",flexDirection:"column",minWidth:"min-content",padding:"0 var(--jx-space-5) var(--jx-space-5)"},'& [part="table-head"], & [part="table-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",height:"32px",borderBottom:"1px solid var(--border)"},'& [part="table-head"]':{position:"sticky",top:"0",zIndex:"1",background:"var(--bg-panel)",fontWeight:"600",fontSize:"var(--jx-text-md)"},'& [part="table-row"]':{cursor:"pointer"},'& [part="table-row"]:hover':{background:"var(--hover-bg)"},'& [part="cell"]':{$description:"Every column keeps a floor: with a collection's six field columns beside the file facts, a cell that may shrink to nothing is a column of ellipses. When the floors outgrow the pane, the table scrolls sideways instead. Each cell's text is kept out of its intrinsic width (`contain: inline-size`), so the table's `min-content` is the sum of those floors rather than of every full title.",flex:"1",minWidth:"80px",contain:"inline-size",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-md)"},'& [part="cell"][data-field="name"], & [part="cell"][data-field="title"]':{$description:"What a row is called keeps a readable width however many field columns stand beside it.",flex:"3",minWidth:"220px",fontWeight:"500"},'& [part="cell"][data-field="path"]':{flex:"2",color:"var(--fg-dim)",fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="cell"][data-field="size"], & [part="cell"][data-field="modified"]':{flex:"0 0 96px"},'& [part="cell"][data-field="locale"]':{$description:"Fixed, like size and modified: a language name is short and never earns width from Name. Without this it inherits the `flex: 1` above and the Name column loses a quarter of itself in every multilingual project.",flex:"0 0 90px",color:"var(--fg-dim)"},'& [part="calendar"]':{padding:"var(--jx-space-4) var(--jx-space-5)"},'& [part="day"]':{marginBottom:"var(--jx-space-5)"},'& [part="day-date"]':{margin:"0 0 var(--jx-space-2)",fontSize:"var(--jx-text-md)",fontWeight:"600",color:"var(--fg)"},'& [part="day"][data-undated="true"] [part="day-date"]':{$description:"A file with no dated name and no modification time is set apart rather than parked on today. A calendar that invents dates is worse than one that says which files it could not place.",color:"var(--fg-dim)"},'& [part="note"]':{margin:"0 0 var(--jx-space-2)",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)"},'& [part="board"]':{display:"flex",gap:"var(--jx-space-4)",padding:"var(--jx-space-4) var(--jx-space-5)",alignItems:"flex-start",overflowX:"auto"},'& [part="column"]':{flex:"0 0 220px",border:"1px solid var(--border)",borderRadius:"var(--radius)",padding:"var(--jx-space-3)",background:"var(--bg-panel)"},'& [part="column-title"]':{margin:"0 0 6px",fontSize:"var(--jx-text-md)",fontWeight:"600",display:"flex",justifyContent:"space-between"},'& [part="count"]':{color:"var(--fg-dim)",fontWeight:"400"},'& [part="list"]':{listStyle:"none",margin:"0",padding:"0"},'& [part="list-item"]':{padding:"3px var(--jx-space-2)",borderRadius:"var(--radius)",cursor:"pointer",fontSize:"var(--jx-text-md)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},'& [part="list-item"]:hover':{background:"var(--hover-bg)"},'& [part="page-line"]':{$description:"One line saying where the collection's entries are published, the Content-Collection board's bar under the toolbar. Its action is quiet: it opens another workspace, and it must not compete with New.",display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-5)",background:"var(--bg-panel)",borderBottom:"1px solid var(--border)",fontSize:"var(--jx-text-md)",color:"var(--fg-dim)",flexShrink:"0"},'& [part="page-pattern"]':{fontFamily:"var(--font-mono)",fontSize:"var(--jx-text-sm)",color:"var(--fg)"},'& [part="design-page"], & [part="add-page"]':{marginLeft:"auto"},'& [part="card"]:focus-visible, & [part="table-row"]:focus-visible, & [part="list-item"]:focus-visible':{$description:"Rows and cards open on Enter or Space as well as a click, so the keyboard reaches an entry; the ring says which one it is on.",outline:"var(--jx-focus-ring)",outlineOffset:"-2px"}},children:[{tagName:"div",attributes:{part:"head"},children:[{tagName:"div",attributes:{part:"heading"},children:[{tagName:"h2",attributes:{part:"title"},textContent:"${state.title}"},{tagName:"p",attributes:{part:"subtitle"},textContent:"${state.subtitle}"}]},{tagName:"div",attributes:{part:"toolbar"},children:[{tagName:"jx-action-group",attributes:{part:"layouts"},$props:{selects:"single",compact:!0,label:"View"},children:[{$prototype:"Array",items:{$ref:"#/state/layouts"},key:{$ref:"$map/item/key"},map:{tagName:"jx-action-button",attributes:{part:"layout","data-layout":"${$map.item.key}"},$props:{size:"sm",hint:"${$map.item.label}",checked:{$ref:"$map/item/checked"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLayout"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",textContent:"${$map.item.label}"}]}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"${state.searchLabel}",placeholder:"${state.searchLabel}…",size:"sm",value:{$ref:"#/state/query"},type:"search"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"locale-slot",role:"none"},$switch:{$ref:"#/state/localeState"},cases:{shown:{tagName:"jx-select",attributes:{part:"locale"},$props:{label:"Language",size:"sm",options:{$ref:"#/state/localeOptions"},value:{$ref:"#/state/localeValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setLocale"},value:[{$ref:"event#/target/value"}]}],description:"The facet's options come from ALL scanned files, never from the filtered ones: a picker whose choices collapse to the choice just made cannot be used to make another."}}}},{tagName:"div",attributes:{part:"filter-slot",role:"none"},$switch:{$ref:"#/state/filterState"},cases:{shown:{$description:"The Filter: one value of what groups the entries, their status or the field the Board groups by, so it offers exactly the Board's columns.",tagName:"jx-select",attributes:{part:"filter"},$props:{label:"Filter",size:"sm",options:{$ref:"#/state/filterOptions"},value:{$ref:"#/state/filterValue"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}}}},{tagName:"span",attributes:{part:"spacer"}},{tagName:"div",attributes:{part:"grid-slot",role:"none"},$switch:{$ref:"#/state/fieldsState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"edit-grid"},$props:{size:"sm",icon:"rows",hint:"Edit every entry of this collection in a grid"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openGrid"},value:[]}],description:"The collection's grid (`collection.editInGrid { name }`): the one visible door to it, since the palette cannot prompt for a free-text name."},children:[{tagName:"span",textContent:"Edit in grid"}]}}},{tagName:"div",attributes:{part:"fields-slot",role:"none"},$switch:{$ref:"#/state/fieldsState"},cases:{shown:{tagName:"jx-action-button",attributes:{part:"fields"},$props:{size:"sm",icon:"sliders-horizontal",hint:"Edit this collection's fields in Project Settings",haspopup:"dialog"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFields"},value:[]}],description:'Project Settings › Content types, on this collection (`settings.open { section: "content", entry }`).'},children:[{tagName:"span",textContent:"Fields"}]}}},{tagName:"div",attributes:{part:"new-slot",role:"none"},$switch:{$ref:"#/state/newState"},cases:{shown:{tagName:"jx-button",attributes:{part:"new"},$props:{size:"sm",variant:"accent"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openNew"},value:[]}],description:"Creation is somebody else's flow: `file.new` opens Add new on this collection's kind, a page for Pages and an entry for a collection."},children:[{tagName:"span",textContent:"${state.newLabel}"}]}}}]}]},{$description:"The header line: where this collection's entries are published, derived from the page whose `$paths.contentType` names it. Pages draw nothing here.",tagName:"div",attributes:{part:"page-slot",role:"none"},$switch:{$ref:"#/state/page/state"},cases:{loading:{tagName:"div",attributes:{part:"page-line"},children:[{tagName:"span",attributes:{part:"page-text"},textContent:"${state.page.text}"}]},page:{tagName:"div",attributes:{part:"page-line","data-state":"page"},children:[{tagName:"span",attributes:{part:"page-text"},textContent:"${state.page.text}"},{tagName:"code",attributes:{part:"page-pattern"},textContent:"${state.page.pattern}"},{tagName:"span",attributes:{part:"page-template"},textContent:"${state.page.template}"},{tagName:"jx-action-button",attributes:{part:"design-page"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/designPage"},value:[]}],description:"Opening the page is activating it, which enters Design (studio.md §22.1)."},children:[{tagName:"span",textContent:"${state.page.designLabel}"}]}]},none:{tagName:"div",attributes:{part:"page-line","data-state":"none"},children:[{tagName:"span",attributes:{part:"page-text"},textContent:"${state.page.text}"},{tagName:"jx-action-button",attributes:{part:"add-page"},$props:{size:"sm",quiet:!0},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/addPage"},value:[]}],description:"Writes the collection's page exactly as Add new's own-page option does."},children:[{tagName:"span",textContent:"Add one"}]}]}}},{tagName:"div",attributes:{part:"banner-slot",role:"none"},$switch:{$ref:"#/state/bannerState"},cases:{shown:{tagName:"div",attributes:{part:"banner",role:"status"},children:[{tagName:"span",textContent:"${state.bannerText}"},{tagName:"jx-button",attributes:{part:"retry"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"}}]},children:[{tagName:"span",textContent:"Retry"}]}]}}},{tagName:"div",attributes:{part:"body"},onscroll:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/scrolled"}}],description:"The rendered item count is proportional to the VIEWPORT, not to the project: a scroll recomputes the window from the box the adapter measures here, and never re-reads the scan."},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{loading:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Scanning the project…"}]},incomplete:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Nothing to show, and the scan did not finish."},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"jx-button",attributes:{part:"retry"},$props:{size:"sm",variant:"primary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/retry"}}]},children:[{tagName:"span",textContent:"Retry"}]}]},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"${state.emptyMessage}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",children:[{tagName:"span",textContent:"${state.emptyMessage}"},{tagName:"span",attributes:{part:"empty-detail"},textContent:" ${state.emptyDetail}"}]},{tagName:"jx-button",attributes:{part:"reset"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"}}],description:"Both facets in one clause and one button, so a reader who filtered twice is told about both rather than sent to clear one and find the list still empty."},children:[{tagName:"span",textContent:"Clear filters"}]}]},cards:{tagName:"div",attributes:{part:"grid","data-layout":"cards",style:"${state.pad}"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/path"},map:{tagName:"div",attributes:{part:"card","data-path":"${$map.item.path}",tabindex:"0",role:"button"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"div",attributes:{part:"card-art"},children:[{tagName:"div",attributes:{part:"art-slot",role:"none"},$switch:{$ref:"$map/item/art"},cases:{image:{tagName:"img",attributes:{part:"thumb",loading:"lazy",src:"${$map.item.src}",alt:""}},doc:{tagName:"div",attributes:{part:"doc-preview","data-path":"${$map.item.path}",inert:""}},glyph:{tagName:"jx-icon",attributes:{part:"file-glyph"},$props:{name:"file-text"}}}}]},{tagName:"div",attributes:{part:"card-label",title:"${$map.item.path}"},textContent:"${$map.item.name}"},{tagName:"div",attributes:{part:"card-meta"},textContent:"${$map.item.meta}"}]}}]},table:{tagName:"div",attributes:{part:"table",role:"table","aria-label":"${state.title}"},children:[{tagName:"div",attributes:{part:"table-head",role:"row"},children:[{$prototype:"Array",items:{$ref:"#/state/columns"},key:{$ref:"$map/item/field"},map:{tagName:"div",attributes:{part:"cell",role:"columnheader","data-field":"${$map.item.field}"},textContent:"${$map.item.title}"}}]},{tagName:"div",attributes:{part:"pad",style:"${state.padTop}"}},{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/path"},map:{tagName:"div",attributes:{part:"table-row",role:"row","data-path":"${$map.item.path}",tabindex:"0"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{$prototype:"Array",items:{$ref:"$map/item/cells"},key:{$ref:"$map/item/field"},map:{tagName:"div",attributes:{part:"cell",role:"cell","data-field":"${$map.item.field}"},textContent:"${$map.item.text}"}}]}},{tagName:"div",attributes:{part:"pad",style:"${state.padBottom}"}}]},calendar:{tagName:"div",attributes:{part:"calendar"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"section",attributes:{part:"day","data-undated":"${$map.item.undated}"},children:[{tagName:"h3",attributes:{part:"day-date"},textContent:"${$map.item.title}"},{tagName:"div",attributes:{part:"note-slot",role:"none"},$switch:{$ref:"$map/item/noteState"},cases:{shown:{tagName:"p",attributes:{part:"note"},textContent:"${$map.item.note}"}}},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/files"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"list-item","data-path":"${$map.item.path}",title:"${$map.item.path}",tabindex:"0"},textContent:"${$map.item.name}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}}]}]}},{tagName:"div",attributes:{part:"truncated-slot",role:"none"},$switch:{$ref:"#/state/truncatedState"},cases:{shown:{tagName:"p",attributes:{part:"truncated"},textContent:"${state.truncated}"}}}]},board:{tagName:"div",attributes:{part:"board"},children:[{$prototype:"Array",items:{$ref:"#/state/groups"},key:{$ref:"$map/item/id"},map:{tagName:"section",attributes:{part:"column"},children:[{tagName:"h3",attributes:{part:"column-title"},children:[{tagName:"span",textContent:"${$map.item.title}"},{tagName:"span",attributes:{part:"count"},textContent:"${$map.item.count}"}]},{tagName:"ul",attributes:{part:"list"},children:[{$prototype:"Array",items:{$ref:"$map/item/files"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"list-item","data-path":"${$map.item.path}",title:"${$map.item.path}",tabindex:"0"},textContent:"${$map.item.name}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]," ":[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/openFile"},value:[{$ref:"$map/item/path"}]}]}}]},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}}]},{tagName:"div",attributes:{part:"note-slot",role:"none"},$switch:{$ref:"$map/item/noteState"},cases:{shown:{tagName:"p",attributes:{part:"truncated"},textContent:"${$map.item.note}"}}}]}}]}}}]}]};L("library-pane",Le);function Fe(e,t){e.region=t.region,e.view=t.view,e.title=t.title,e.subtitle=t.subtitle,e.searchLabel=t.searchLabel,e.newLabel=t.newLabel,e.newState=t.newState,e.fieldsState=t.fieldsState,e.page=t.page,e.layouts=t.layouts,e.filterState=t.filterState,e.filterOptions=t.filterOptions,e.filterValue=t.filterValue,e.localeState=t.localeState,e.localeOptions=t.localeOptions,e.localeValue=t.localeValue,e.query=t.query,e.bannerState=t.bannerState,e.bannerText=t.bannerText,e.emptyMessage=t.emptyMessage,e.emptyDetail=t.emptyDetail,e.pad=t.pad,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.columns=t.columns,e.groups=t.groups,e.truncated=t.truncated,e.truncatedState=t.truncatedState}function Xe(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Qe(e){let t=e?.$map,a=v(t)?t.item:void 0,r=v(a)?a.path:void 0;return n(r)?r:""}function Ce(e,t,a){e.replaceChildren();let r=new AbortController;CN(e,r.signal);let o=g({addPage:a.addPage,bannerState:"hidden",bannerText:"",columns:[],contextMenu:a.contextMenu,designPage:a.designPage,emptyDetail:"",emptyMessage:"",fieldsState:"hidden",groups:[],layouts:[],filterOptions:[],filterState:"hidden",filterValue:"",localeOptions:[],localeState:"hidden",localeValue:"",newLabel:"",newState:"hidden",openFields:a.openFields,openGrid:a.openGrid,openFile:a.openFile,openNew:a.openNew,pad:"",padBottom:"",padTop:"",previewSlot:a.previewSlot,query:"",region:"",reset:a.reset,retry:a.retry,page:{designLabel:"",pattern:"",state:"hidden",template:"",text:""},rows:[],scrolled:a.scrolled,scroller:a.scroller,search:a.search,searchLabel:"",setLayout:a.setLayout,setFilter:a.setFilter,setLocale:a.setLocale,subtitle:"",title:"",truncated:"",truncatedState:"hidden",view:"loading"});Fe(o,t);let i=null,l=!1,c=R("library-pane",o,e,{onNodeCreated:(d,s,u,m)=>{let f=Xe(u);if(f===""||!(d instanceof HTMLElement))return;if(f==="body"){a.scroller(d);return}if(f==="doc-preview"){let x=Qe(m);if(x)a.previewSlot(d,x)}}}).then((d)=>{let s=d.root;if(l)return d.dispose(),s;return i=d,s});return{attached:()=>{if(l)return!1;let d=i?.root;return d===void 0?!0:d instanceof HTMLElement&&e.contains(d)},dispose(){l=!0,r.abort(),i?.dispose(),i=null},ready:c,update:(d)=>Fe(o,d)}}var Ze="table",y=g({collection:hi,loading:!1,revision:0,views:{}});function tl(e=Ru()){let t=y.views[e];if(t)return t;let a={filter:"",layout:Ze,locale:"",query:""};return y.views[e]=a,y.views[e]??a}function j(){return ql(y.collection)??{fileBacked:!1,item:"page",key:hi,kind:"pages",title:"Pages"}}function Ru(){return j().key}var M=null,A=!1;function P(){if(M?.stale()===!0){M=null,A=!1;for(let e of E.values())e.cache.clear()}return M??=TD(),M}function w(){y.revision+=1}function tD(e){y.collection=e,tl(e),w(),xn("leftPanel")}function Yk(e,t=Ru()){tl(t).layout=e,w()}function $_(e,t=Ru()){tl(t).query=e,w()}function et(e,t=Ru()){tl(t).filter=e,w()}function I_(e,t=Ru()){tl(t).locale=e,w()}function Ed(){M=null,A=!1;for(let e of E.values())e.cache.clear();w()}function Zk(){let e=P();if(!A&&!y.loading)I();if(!e.scanned())return null;let t=new Map;for(let a of e.files())if(a.collection!==null)t.set(a.collection,(t.get(a.collection)??0)+1);return t}var tt=600,ke="content.scan",F="Content";async function I(){let e=P();A=!0,y.loading=!0,w();let t={handle:null},a=setTimeout(()=>{t.handle=Us({source:F,status:"Reading the project's directories…",title:"Scan project files"})},tt);try{await e.rows();let r=e.failures();if(r.length>0){let o=r.map((l)=>`${l.dir} — ${l.error}`).join(`
|
|
3
|
+
`),i=`Could not read ${r.length} project ${r.length===1?"directory":"directories"} — this list is incomplete.`;C.error(i,{action:"content.refresh",detail:o,key:ke,path:r[0].dir,source:F,tier:"problem"}),t.handle?.setStatus(i)}t.handle?.done(`${e.files().length} file(s)`)}catch(r){if(t.handle)t.handle.fail("Could not scan the project's files.");else C.error("Could not scan the project's files.",{action:"content.refresh",detail:Q(r),key:ke,source:F,tier:"problem"})}finally{clearTimeout(a),y.loading=!1,w(),xn("leftPanel")}}async function Xk(){M=null,A=!1;for(let e of E.values())e.cache.clear();await I()}var E=new Map;function W(e){return E.get(e)??null}function Qk(e,t){let a=W(e);return a!==null&&a.tabId===t.id&&a.wrap.isConnected&&a.surface.attached()}function eE(e){let t=E.get(e);if(!t)return;if(t.settleTimer!==null)clearTimeout(t.settleTimer),t.settleTimer=null;t.unlisten(),t.observer.destroy(),t.cache.clear(),t.slots.clear(),t.pendingPaths.clear(),t.scope.stop(),t.surface.dispose(),E.delete(e)}function at(e,t,a){let r=de[t],o=e?.scroller??null;if(!r.windowed||!o)return{end:a,padBottom:0,padTop:0,start:0,totalRows:a};return eS({columns:ve(t,o.clientWidth),count:a,rowHeight:r.rowHeight,scrollTop:o.scrollTop,viewportHeight:o.clientHeight})}async function rt(e,t){e.pendingPaths.add(t);try{let a=await Cw(t,e.cache);if(!a||W(e.paneId)!==e)return;let r=e.slots.get(t);if(r?.isConnected&&!qy(r))Uy(r,a)}finally{e.pendingPaths.delete(t)}}function Te(e,t,a){let r=e.cache.get(a);if(qy(t))return;if(r){Uy(t,r);return}if(e.pendingPaths.has(a))return;e.pending.set(t,a),e.observer.observe(t)}function ot(e,t,a){e.slots.set(a,t),Te(e,t,a)}function it(e){if(e.settleTimer!==null)return;e.settleTimer=setTimeout(()=>{if(e.settleTimer=null,W(e.paneId)!==e)return;e.observer.releaseDetached();let t=xD.has(tl().layout);for(let[a,r]of e.slots){if(!r.isConnected){e.slots.delete(a);continue}if(t)Te(e,r,a)}},0)}function je(e){if(e.record)vD(e.record.source,e.record.row);else if(e.collection===null||e.collection===hi)xi(e.path);else jl(e.path)}var B=null;function lt(){B?.close(),B=null}function Re(e){return P().files().find((t)=>t.path===e)??null}function st(e,t,a){let r=Re(e);if(!r||r.record)return;lt();let o=(i,l,c,d={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:i,run:c,title:l,...d});B=Bt({label:"File actions",onClosed:(i)=>{if(B===i)B=null},origin:{x:t,y:a},region:"content",rows:[o("open","Open",()=>{je(r)}),o("rename","Rename…",()=>{ct(r)},{dividerAbove:!0}),o("duplicate","Duplicate",()=>{dt(r)}),o("delete","Delete",()=>{pt(r)},{destructive:!0,dividerAbove:!0})]})}async function ct(e){let t=await kb(e.path),a={confirmLabel:"Rename",select:"stem",validate:(c)=>c.trim()?"":"Enter a file name.",value:e.name};if(t!==void 0)a.message=t;let r=await ei("Rename",a);if(!r||r===e.name)return;let o=e.path.replaceAll("\\","/"),i=o.includes("/")?o.slice(0,o.lastIndexOf("/")):".",l=i==="."?r:`${i}/${r}`;try{await p().renameFile(e.path,l),Sr(),Ed(),await I(),C.success(`Renamed to ${r}`)}catch(c){C.error(`Could not rename ${e.name}.`,{detail:Q(c),path:e.path,source:F})}}async function dt(e){let t=e.path.replaceAll("\\","/"),a=t.includes("/")?t.slice(0,t.lastIndexOf("/")):".",o=`${e.name.replace(/(\.[^.]+)$/,"")}-copy${e.ext||""}`,i=a==="."?o:`${a}/${o}`;try{let l=p(),c=await l.readFile(e.path);await l.writeFile(i,c),Ed(),await I(),C.success(`Duplicated as ${o}`)}catch(l){C.error(`Could not duplicate ${e.name}.`,{detail:Q(l),path:e.path,source:F})}}async function pt(e){if(!await Cb(e))return;try{await p().deleteFile(e.path),Sr(),Ed(),await I(),C.success(`Deleted ${e.name}`)}catch(a){C.error(`Could not delete ${e.name}.`,{detail:Q(a),path:e.path,source:F})}}function Pe(e,t){if(e.layout===!1)return"with no template";let a=e.layout??t;return a?`using ${Ib(a)}`:"with no template"}function ut(e,t,a,r=[]){let o={designLabel:"",pattern:"",state:"hidden",template:"",text:""};if(e.kind==="pages")return o;if(t===void 0)return{...o,state:"loading",text:"Finding where these entries are published…"};if(t===null)return{...o,state:"none",text:"Entries have no page of their own"};let i=lb(),l=(d)=>{let s=d===null?-1:i.indexOf(d);return s===-1?i.length:s},c=r.filter((d)=>d.locale!==null).toSorted((d,s)=>l(d.locale)-l(s.locale));if(c.length>1){let d=new Set(c.map((s)=>Pe(s,a)));return{designLabel:`Design the ${e.item} page`,pattern:c.map((s)=>`${s.pattern} (${s.locale})`).join(", "),state:"page",template:d.size===1?[...d][0]:"using a template per language",text:`Each ${e.item} has a page in each language at`}}return{designLabel:`Design the ${e.item} page`,pattern:t.pattern,state:"page",template:Pe(t,a),text:`Each ${e.item} has a page at`}}function mt(e){let t=Xu(e,tl(e).locale);if(t)xi(t.path)}async function ft(e){let{addCollectionPage:t}=await (le("ecqmzz76"),import("./add-new-flow-ecqmzz76.js"));await t(e)}function gt(e,t,a){return{checked:a?"true":"false",key:e,label:t}}function ht(e,t){let a=`${t.locale===""?"":` in ${Wt(t.locale)}`}${t.filter===""?"":` filtered to ${t.filter}`}`,r=t.query.trim();return`No ${e.kind==="pages"?"pages":e.title.toLowerCase()} match${r?` “${r}”`:""}${a}.`}function yt(e,t,a,r){if(a>0)return t;if(y.loading||!e.scanned())return"loading";if(e.failures().length>0)return"incomplete";return r===0?"empty":"nomatch"}function R_(e){return P().files().filter((t)=>t.collection===e).map((t)=>t.path)}function bt(e,t){if(e.kind==="pages")return P().scanned()?wt(t==="table"):T(new Map);if(e.fileBacked){let o=Me(e.key),i=P().files().filter((l)=>l.collection===e.key&&l.record);return T(new Map(i.map((l)=>{let{fields:c}=l.record,d=V_(o,c),s=d===null?"":ab(c[d]??""),u=SE(l.record.source,c,o);return[l.path,{date:s,fields:c,status:"",thumb:u,title:l.name}]})))}if(!P().scanned())return T(new Map);let a=ow(e.key,R_(e.key)),r=new Map((a??[]).map((o)=>[o.path,{date:o.date,fields:o.fields,status:o.status,thumb:o.thumb,title:o.title}]));return T(r)}function wt(e){let t=R_(hi),a=e?me(t):null,r=new Set(Object.keys(S?.projectConfig?.content??{})),o=Ee(),{i18n:i}=ln(S?.projectConfig??{}),l=[...a?.values()??[]].some((d)=>d.draft),c=new Map(t.map((d)=>{let s=a?.get(d),u=s?.contentType??null,m=s===void 0?void 0:s.layout??o??!1;return[d,{date:"",status:s===void 0||!l?"":s.draft?"Draft":"Published",template:m===void 0?"":m===!1?"None":Ib(m),title:u!==null&&r.has(u)?Y(`${ie(u)} page`,d,i):U(yr(d),d,i)}]}));return T(c)}function vt(e){return e.map((t)=>({file:t,route:yr(t.path)})).toSorted((t,a)=>ES(t.route,a.route)||t.file.path.localeCompare(a.file.path)).map(({file:t})=>t)}function Me(e){return wa(e)?.schema??LN(e)}function xt(e){let t=new Set,a=pp(e),r=_E(e);for(let o of[a,r])if(o!==null)t.add(o);return t}function $t(e){let t=new Map;for(let[a,r]of Object.entries(e?.properties??{}))if(Array.isArray(r.enum))t.set(a,r.enum.filter((o)=>n(o)));return t}function St(e,t){let a=[...new Set(e.flatMap((i)=>i?.status?[i.status]:[]))];if(a.length>0)return{matches:(i,l)=>(i?.status??"")===l,title:"Status",values:a.toSorted((i,l)=>i==="Draft"?-1:l==="Draft"?1:i.localeCompare(l))};if(!t)return null;let r=new Set(e.flatMap((i)=>z(i?.fields?.[t.name],t.list))),o=t.order.length>0?[...t.order,...[...r].filter((i)=>!t.order.includes(i)).toSorted()]:[...r].toSorted((i,l)=>i.localeCompare(l));return{matches:(i,l)=>z(i?.fields?.[t.name],t.list).includes(l),title:t.title,values:o}}function Ne(e,t){let a=P(),r=j(),o=tl(r.key),{layout:i}=o,l=kE(a.files(),{collection:r.key,query:""}),c=bt(r,i),d=l.map((h)=>c(h)),s=r.kind==="collection"?Me(r.key):null,u=ED(s,xt(s)),m=be(u,$t(s),d),f=r.kind==="collection"?St(d,m):null,x=f!==null&&f.values.includes(o.filter)?o.filter:"",H=kE(a.files(),{collection:r.key,locale:o.locale,query:o.query}),O=f===null||x===""?H:H.filter((h)=>f.matches(c(h),x)),N=r.kind==="pages"?vt(O):O,J=l.length,b=yt(a,i,N.length,J),D=at(e,i,N.length),Ae=N.slice(D.start,D.end),k=a.failures(),K=_D(l),pe=TE(r.key,{date:_E(s)!==null||d.some((h)=>(h?.date??"")!==""),fields:u,locale:K.length>1,status:d.some((h)=>(h?.status??"")!=="")}),Oe=b==="cards",X=b==="calendar"?$e(N,c):{groups:[],truncated:""},G=r.kind==="pages",Z=G?"pages":r.title.toLowerCase();return{bannerState:k.length>0?"shown":"hidden",bannerText:k.length===0?"":`This list is incomplete — ${k.length} ${k.length===1?"directory":"directories"} could not be read (${k[0].dir}${k.length>1?", …":""}).`,columns:b==="table"?pe.map((h)=>({field:h.field,title:h.title})):[],emptyDetail:b==="incomplete"?`${k.length} ${k.length===1?"directory":"directories"} could not be read, so this is not the same as an empty collection.`:b==="nomatch"?`${J} ${J===1?r.item:Z} in all.`:b==="empty"?`New ${r.item} adds the first one.`:"",emptyMessage:b==="nomatch"?ht(r,o):b==="empty"?`No ${Z} yet.`:"",fieldsState:r.kind==="collection"?"shown":"hidden",groups:b==="board"?Se(N,c,m):X.groups,layouts:hm.map((h)=>gt(h,sw[h],i===h)),localeOptions:[{label:"All languages",value:"all"},...K.map((h)=>({label:Wt(h),value:h}))],filterOptions:f===null?[]:[{label:`Any ${f.title.toLowerCase()}`,value:"all"},...f.values.map((h)=>({label:h,value:h}))],filterState:f!==null&&f.values.length>1?"shown":"hidden",filterValue:x===""?"all":x,localeState:K.length<2?"hidden":"shown",localeValue:o.locale===""?"all":o.locale,newLabel:`New ${r.item}`,newState:r.fileBacked?"hidden":"shown",pad:`padding-top:calc(var(--jx-space-4) + ${D.padTop}px);padding-bottom:calc(var(--jx-space-4) + ${D.padBottom}px)`,padBottom:`height:${D.padBottom}px`,padTop:`height:${D.padTop}px`,page:ut(r,G?null:Xu(r.key,o.locale),Ee(),G||o.locale!==""?[]:IN(r.key)??[]),query:o.query,region:Qn(t,"content"),rows:b==="cards"||b==="table"?Ae.map((h)=>xe(h,b==="table"?pe:[],Oe,c(h))):[],searchLabel:`Search ${Z}`,subtitle:G?"Every URL on your site.":"",title:r.title,truncated:X.truncated,truncatedState:X.truncated===""?"hidden":"shown",view:b}}function Ee(){return S?.projectConfig?.defaults?.layout??null}function nD(e,t){let{paneId:a,wrap:r}=e;if(Qk(a,t))return;eE(a);let o=null,i=vp((s)=>{let u=o;if(!u)return;let m=u.pending.get(s);if(m!==void 0)u.pending.delete(s),rt(u,m)}),l=()=>{if(o!==null&&W(a)===o)o.surface.update(Ne(o,a)),it(o)},c=Ce(r,Ne(null,a),{addPage:()=>{ft(j().key)},contextMenu:(s,u,m)=>st(s,u,m),designPage:()=>{mt(j().key)},openFields:()=>{nt("settings.open",{entry:j().key,section:"content"},F)},openGrid:()=>{let s=j(),u=s.fileBacked?Fw(s.key):null;if(u){xi(u);return}nt("collection.editInGrid",{name:s.key},F)},openFile:(s)=>{je(Re(s)??{collection:Ru(),path:s})},openNew:()=>{let s=j(),{locale:u}=tl(s.key),m=s.kind==="pages"?{kind:"page"}:{collection:s.key,kind:"entry"};if(u!=="")m.locale=u;nt("file.new",m,F)},previewSlot:(s,u)=>{if(o)ot(o,s,u)},reset:()=>{$_(""),I_("")},retry:()=>{Xk()},scrolled:()=>w(),scroller:(s)=>{if(o)o.scroller=s},search:(s)=>$_(s),setLayout:(s)=>Yk(s),setFilter:(s)=>et(s==="all"?"":s),setLocale:(s)=>I_(s==="all"?"":s)}),d=ge();o={cache:Sw(),observer:i,paneId:a,pending:new WeakMap,pendingPaths:new Set,scope:d,scroller:null,settleTimer:null,slots:new Map,surface:c,tabId:t.id,unlisten:(()=>{let s=kp(()=>w()),u=rw(()=>w()),m=fe(()=>w());return()=>{s(),u(),m()}})(),wrap:r},E.set(a,o),d.run(()=>{ne(()=>{if(W(a)!==o)return;y.revision,y.collection,y.loading;let s=tl(Ru());if(s.layout,s.query,s.locale,l(),!A&&!y.loading)I()})})}function iD(){y.collection=hi,y.views={},y.loading=!1,M=null,A=!1,w()}
|
|
4
|
+
export{Xg,Vy,XR,Qg,kd,QR,eD,Jk,Uy,qy,tl,Ru,tD,Yk,$_,I_,Ed,Zk,Xk,Qk,eE,R_,nD,iD};
|
|
5
|
+
|
|
6
|
+
//# debugId=39DFB52A8E5567BF64756E2164756E21
|
|
7
|
+
//# sourceMappingURL=studio-jeraxdgv.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{Ft,Wi,fn,lr,Pa}from"./studio-hz5n7x27.js";import{C}from"./studio-y60sts62.js";import{Pn,Yc,St,Hi,Ce,Lo,We,Vd,h}from"./studio-k2sz13zg.js";import{$o}from"./studio-ea74s8c1.js";import{Q}from"./studio-nqxqf8p2.js";import{dm}from"./studio-qh8berdz.js";import{_a}from"./studio-f746039f.js";import{KD,oT}from"./studio-r7pf0rkv.js";import{Co}from"./studio-2r90cts3.js";import{yr,Yu}from"./studio-rtfnhrdg.js";import{lw,db}from"./studio-4jhw38b2.js";import{cb}from"./studio-cg1bfyhf.js";import{jl}from"./studio-khwbgrtg.js";import{wa,Dc,YE}from"./studio-2ejhqns4.js";import{as,gb}from"./studio-kg5ya5r2.js";import{v}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var ob=["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"}},Bs="blank",Rc="article",P_="selection",lm="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"}}},mE=["title","image","richText"];function f(e,n){return e==="."||e===""?n:`${e}/${n}`}function nl(e){return e.replace(/^\.\//,"")}function j_(e,n){let t=n.defaultLayout;if(e===Bs||e==="")return t?!1:void 0;if(t&&nl(t)===nl(e))return;return e}function Ou(e){let n=e.defaultLayout;if(n)return e.layouts.find((r)=>nl(r.ref)===nl(n))?.ref??n;return e.layouts[0]?.ref??Bs}function H_(e,n){let t=Pn(n??"");if(t!==null){let r=e.layouts.find((o)=>nl(o.ref).replace(/\.json$/i,"").split("/").some((l)=>Pn(l)===t));if(r)return r.ref}return Ou(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 fD(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=YE(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 gE(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}":Yu(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 cm(e,n){let t=n.i18n??null,r=Pn(e);return t!==null&&r!==null&&t.locales.includes(r)?r:null}function rb(e){return e.dir.includes($o)}function _(e,n){return e.localeDirs?.[n]??e.dir.replace($o,n.toLowerCase())}function E(e,n,t){let r=t.i18n??null;if(n===null||r===null)return e;return Yc(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===lm&&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??Ou(t),o=r===Rc&&t.article!==null?t.article:null,i=o?.ext??".json",l=n.url===void 0?[as(e)].filter((u)=>u!==""):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}`,m=cm(n.locale,t),d=c===""?f(s,c):E(f(s,c),m,t),b=c===""?s:J(d)[0],p=e.trim(),g;if(o)g={doc:{children:[{tagName:"h1",textContent:p}],title:p},format:o.name,frontmatter:!0};else{let u={},y=j_(r===Rc?Bs:r,t);if(y!==void 0)u.$layout=y;u.title=p,u.tagName="main",u.children=[{tagName:"h1",textContent:p}],g={doc:u,format:null}}let N=c===""?"":yr(d).urlPattern;return{content:g,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??mE,i=t.i18n??null,l=i!==null&&n.localized!==!1,a=`content/${r}`,s=l?`${a}/${i.defaultLocale.toLowerCase()}`:a,c=t.contentFormat,m=c?.ext??".json",d=Yu(r),b=r===""?"":`first-${d.replaceAll(" ","-")}${m}`,p=I(o),g=structuredClone(p),N={format:c?.name??"json",schema:v(g)?g:{},source:l?`./${a}/${$o}`:`./${a}`},u=w({ext:m,formatName:c?.name??null,schema:p},`First ${d}`),y=[],k,L="";if(n.ownPage!==!1&&r!==""){let j=n.pageTemplate??Ou(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!==Ou(t)?j:H_(t,x);k??=yr(O).urlPattern,y.push({body:{doc:gE(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:u,dir:s,ext:m,extraWrites:y,fileName:b,kind:"collection",path:f(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=f("layouts",r),i={},l=n.startFrom??"";if(l!==""&&l!==Bs)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=db(e),o=r===""?"":`${r}.json`,i=f("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=cm(n.locale,t),a=r!==null&&rb(r)&&l===null,s=r===null?"content":rb(r)&&l!==null?_(r,l):r.dir,c=o===""||r===null||a?"":`${o}${i}`,m=f(s,c);return{content:r?w(r,e.trim()):{doc:{},format:null},dir:s,ext:i,extraWrites:[],fileName:c,kind:"entry",path:m,saved:c===""?"":`Saved as ${m} in ${r.name}.`}}function bE(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 gb(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:f(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 f(r,l)}return null}function H(e){return gb(e,"",{choice:{ext:"",kind:"fixed"},dir:".",taken:new Set})}function vE(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===lm&&(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(rb(a)&&cm(t.locale,r)===null)return`Choose the language this ${Yu(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 yE(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 mD(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 gD(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 Pa(n.format,n.doc,{frontmatter:n.frontmatter??!1,mode:"roundtrip"})}async function sP(e,n={}){let t=wa(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 Ft().catch(()=>{});let r;try{r=await G(t)}catch(s){return C.error(`Could not prepare a new ${t.name} entry.`,{detail:Q(s),path:t.dir,source:"Content"}),null}let o=n.dir,i=o!==void 0&&Vd(o)?.name===t.name?o:t.dir;if(i.includes($o))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("b2tcppdd"),import("./files-b2tcppdd.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 dm(t.name),await jl(a),a}function F(){let e=h.value;return e&&Dc(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 jl(St("content.openEntry",n,"path"))},title:"Open Entry"},{args:Ce({draft:Lo("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");cb(t,Hi("content.setDraft",n,"draft"))},title:"Set Draft"},{args:Ce({include:Lo("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)=>{KD(Hi("content.setIncludeDrafts",n,"include")),await oT()},title:"Include Drafts"}]}function wE(e){e.registerAll(Y())}
|
|
2
|
+
export{ob,nw,Bs,Rc,P_,lm,iw,F_,mE,nl,j_,Ou,H_,fD,gE,cm,rb,bE,vE,yE,mD,gD,B_,sP,wE};
|
|
3
|
+
|
|
4
|
+
//# debugId=F4CFF0B20B54429B64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-jvgek9xt.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n,ee,_}from"./studio-8z66jk4z.js";function af(r){if(!r)return!1;if(ee(r.openProject))return!0;return r.openProjectPicker==="repo-list"&&ee(r.listRepos)&&ee(r.importProject)}function dI(r){globalThis.__jxPlatform=r}function Tv(){return globalThis.__jxLauncher}var a=new Map;function uI(){let r=[];for(let[o,i]of a)for(let t=0;t<i;t++)r.push(o);return r}function s(r){a.set(r,(a.get(r)??0)+1)}function c(r){let o=(a.get(r)??1)-1;if(o>0)a.set(r,o);else a.delete(r)}function g(r){return(_(r)||ee(r))&&"then"in r&&ee(r.then)}function d(r,o,i){return(...t)=>{let e=o.apply(i,t);if(!g(e))return e;s(r);let u=()=>{c(r)};return e.then(u,u),e}}function P(r){let o=new Map;return new Proxy(r,{get(i,t){let e=i[t];if(!ee(e)||!n(t))return e;let u=o.get(t);if(u&&u.raw===e)return u.wrapper;let f=d(t,e,i);return o.set(t,{raw:e,wrapper:f}),f}})}var l=null;function p(){let r=globalThis.__jxPlatform;if(!r)throw Error("No platform registered. Call registerPlatform() before starting Studio.");if(l?.raw!==r)l={raw:r,wrapped:P(r)};return l.wrapped}function _e(){return globalThis.__jxPlatform!=null}
|
|
2
|
+
export{af,dI,Tv,uI,p,_e};
|
|
3
|
+
|
|
4
|
+
//# debugId=373B40B4D224BF9D64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-jws1a87n.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{ge,ea,ne,g,de,Th,C}from"./studio-y60sts62.js";import{Zd}from"./studio-qn7z4krm.js";import{p}from"./studio-jws1a87n.js";import{Wi,fn,lr}from"./studio-hz5n7x27.js";import{rI,OC,$o,aM,Wx,sI,aI,dM,wv}from"./studio-ea74s8c1.js";import{yv,Q$,Er,S}from"./studio-cg710sk9.js";import{Se,oe,Lv,$v,FC,lf,jC,na,cf,Xm,Gx}from"./studio-wc6za3zs.js";import{n,Z,Ze,_,v,Go,Di,nd,uf}from"./studio-8z66jk4z.js";import{le}from"./studio-j3d2fjqz.js";var we=g(new Set);function Fm(e){we.add(e)}function kx(e){we.delete(e)}function wC(e){return we.has(e)}var O$=()=>({kind:"proceed"});function av(e,t){return{success:!0,data:e,summary:t}}function Fn(e){return{success:!1,error:e}}function Ur({name:e,description:t,parameters:o,strict:r=!0,llmStrict:i=!1,interactive:s,title:a,annotations:l,interaction:c,settle:u,execute:y}){let d={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:y};if(s!==void 0)d.interactive=s;if(a!==void 0)d.title=a;if(l!==void 0)d.annotations=l;if(c!==void 0)d.interaction=c;if(u!==void 0)d.settle=u;return d}function Ex(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function gh(e=null,t={}){let o=new Map(Object.entries(t));return{sessionId:e,get:(r)=>o.get(r),set:(r,i)=>{o.set(r,i)},toJSON:()=>Object.fromEntries(o)}}var Yt=new AbortController().signal;function Tx(e={}){let t=e.session??gh();return{actor:e.actor??{id:`assistant:${t.sessionId??"local"}:`,kind:"assistant",sessionId:t.sessionId,turnId:""},callId:e.callId??"",ledger:e.ledger??Ex(),progress:e.progress??(()=>{}),session:t,signal:e.signal??Yt}}function pO(e){let t=new AbortController;if(e.aborted)return t.abort(e.reason),{release:()=>{},signal:t.signal};let o=()=>{t.abort(e.reason)};return e.addEventListener("abort",o,{once:!0}),{release:()=>{e.removeEventListener("abort",o)},signal:t.signal}}function Lx(){let e=new Map;return{register(t){if(e.has(t.name))console.warn(`Tool "${t.name}" is being re-registered.`);e.set(t.name,t)},list(){return[...e.values()]},listForLLM(){return[...e.values()].map((t)=>{let o={name:t.name,description:t.description,parameters:t.parameters};if(t.llmStrict===!0)o.strict=!0;return{type:"function",function:o}})},getDefinition(t){return e.get(t)},validate(t,o){let r=e.get(t);if(!r)return{valid:!1,errors:[`Unknown tool: "${t}"`]};if(!r.strict)return{valid:!0};let i=r.parameters;if(!i.properties)return{valid:!0};let s=[],a=i.properties,l=i.required||[];for(let c of l)if(!(c in o)||o[c]===void 0||o[c]===null)s.push(`Missing required argument: "${c}"`);for(let[c,u]of Object.entries(o)){let y=a[c];if(!y)continue;let d=y.type;if(!d)continue;let x=Ge(u);if(d==="number"||d==="integer"){if(Re(u,"number"))continue;if(Re(u,"string")){if(!Number.isNaN(Number(u)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${u}"`);continue}s.push(`Argument "${c}" should be a number, got ${x}`);continue}if(d==="string"&&x!=="string")s.push(`Argument "${c}" should be a string, got ${x}`);else if(d==="boolean"&&x!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${x}`);else if(d==="array"&&x!=="array")s.push(`Argument "${c}" should be an array, got ${x}`);else if(d==="object"&&x!=="object")s.push(`Argument "${c}" should be an object, got ${x}`)}return s.length>0?{valid:!1,errors:s}:{valid:!0}},async execute(t,o,r=Tx()){let i=e.get(t);if(!i)return Fn(`Unknown tool: "${t}"`);let s=this.validate(t,o);if(!s.valid)return Fn(`Validation failed: ${(s.errors||[]).join("; ")}`);try{return await i.execute(o,r)}catch(a){return Fn(`Tool "${t}" execution error: ${me(a)}`)}}}}var Zt="The author declined this call.";function Xt(e){return JSON.parse(JSON.stringify(e))}function me(e){return e.message}var Qt=["string","number","boolean","undefined"];function Re(e,t){return typeof e===t}function en(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ge(e){if(Array.isArray(e))return"array";return Qt.find((t)=>Re(e,t))??"object"}function tn(e){if(!e)return{};let t=JSON.parse(e);if(!en(t)){let o=t===null?"null":Ge(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function M$(e,t,o,{approval:r=O$,response:i}={}){let s=!1,a;try{let l=tn(t.argumentsText),c=e.getDefinition(t.name),u=c?nn(e,c,l,r,i):null;if(u?.status==="needs_input")return u;if(u)({result:a}=u);else s=!0,a=await e.execute(t.name,l,o)}catch(l){a=Fn(`Failed to parse arguments: ${me(l)}`)}try{return{status:"done",result:Xt(a),executed:s}}catch(l){let c=me(l);return{status:"done",result:Fn(`Tool "${t.name}" returned a result that cannot be serialized: ${c}`),executed:s}}}function nn(e,t,o,r,i){let{interaction:s,settle:a}=t;if(s&&a){let c=e.validate(t.name,o);if(!c.valid)return pe(`Validation failed: ${(c.errors||[]).join("; ")}`);if(i)return{status:"done",result:on(t.name,a,o,i),executed:!1};let u=s(o);return"refusal"in u?pe(u.refusal):{status:"needs_input",request:u}}let l=r(t,o);if(l.kind==="deny")return pe(l.message);if(l.kind==="confirm"){if(!i)return{status:"needs_input",request:{kind:"approval",reason:l.reason,summary:l.summary,title:t.title??t.name,tool:t.name}};if(i.kind!=="approval"||!i.approved)return pe(Zt)}return null}function pe(e){return{status:"done",result:Fn(e),executed:!1}}function on(e,t,o,r){try{return t(o,r)}catch(i){return Fn(`Tool "${e}" execution error: ${me(i)}`)}}var rn=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"]),bC="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$";function Pn(e){if(!n(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function yx(e){return Pn(e)!==null}function iv(e){let t=Pn(e);if(t===null)return"ltr";let o=new Intl.Locale(t),r=o.script??o.maximize().script;return r!==void 0&&rn.has(r)?"rtl":"ltr"}function Wt(e){let t=Pn(e);if(t===null)return n(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}var sn="prefix-except-default";function ln(e){let t=e.i18n,o=[];if(!_(t))return{errors:o,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],i=[];for(let l of r){let c=Pn(l);if(c===null){o.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!i.includes(c))i.push(c)}let s=Pn(t.defaultLocale)??i[0]??null;if(t.defaultLocale!==void 0&&Pn(t.defaultLocale)===null)o.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(s===null)return o.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:o,i18n:null};if(!i.includes(s))i.unshift(s);let a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:sn;return{errors:o,i18n:{defaultLocale:s,locales:i,routing:a}}}function go(e,t){let o=Ae(q(e),t);if(o===-1||t===null)return null;return Pn(q(e)[o])}function wx(e,t){let o=go(e,t);if(o!==null||t===null||t.routing!=="prefix-except-default")return o;return q(e)[0]==="pages"?t.defaultLocale:null}function ov(e,t){let o=q(e),r=Ae(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Yc(e,t,o){if(o===null)return null;let r=Pn(t);if(r===null||!o.locales.includes(r))return null;let i=q(e),s=Ae(i,o),a=s===-1?cn(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,u)=>u!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function q(e){return e.replace(/^\.\//,"").split("/").filter(Boolean)}function Ae(e,t){if(t===null)return-1;return e.findIndex((o)=>{let r=Pn(o);return r!==null&&t.locales.includes(r)})}function cn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function dO(e,t){if(t===null)return null;let o=e.split("/").find(Boolean);if(o===void 0)return t.defaultLocale;let r=Pn(o);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function F$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((u)=>u!==""&&!un(u));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function un(e){let t=e.indexOf("="),o=t===-1?e:e.slice(0,t);if(o==="v")return!0;if(!o.includes("%"))return!1;try{return decodeURIComponent(o)==="v"}catch{return!1}}function dn(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function dv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!OC.test(a))continue;let c=gn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes($o)){let u=mn(r,c,a,o);if(u)s(u.dir,u.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${rI}/${a}`)}return i}function mn(e,t,o,r){let i=t.indexOf($o),s=t.slice(0,i),a=t.slice(i+$o.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!OC.test(l))return null;let c=r.find((y)=>y.toLowerCase()===l.toLowerCase());if(c===void 0||!OC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${rI}/${o}/${c}`}}function gn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function uv(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=dM(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=Wx(e);return F$(`${t.fileBaseUrl}${wv(r)}${i}`,dn(t.versions,r))}let[o]=t.mounts;return o?yn(e,t.documentDir,o):null}function yn(e,t,o){if(sI(e))return null;let{path:r,suffix:i}=Wx(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=aI(t,s);if(a===null)return null;let l=aM([o],a);if(!l)return null;return`${l}${i}`}function ze(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}function G(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ye(e){return e??S?.projectConfig??null}function Xe(e){return e?.content??{}}function hn(e){let t=ln(e??{}).i18n?.locales??[];return t.length>0?[...t]:null}function et(e){if(e.endsWith("/"))return!1;let t=e.slice(e.lastIndexOf("/")+1);return/\.[a-z\d]+$/i.test(t)}function tt(e){if(e.format==="json")return{ext:".json",unresolvedFormat:null};if(e.format===void 0||e.format==="")return{ext:lr()?.extensions[0]??".json",unresolvedFormat:null};let t=Wi(e.format);return t?.extensions[0]===void 0?{ext:null,unresolvedFormat:e.format}:{ext:t.extensions[0],unresolvedFormat:null}}function bn(e,t){let o=t===null?"[^/]+":`(?:${t.map((i)=>ze(i)).join("|")})`,r=G(e).split($o).map((i)=>ze(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function xn(e,t,o){let r=bn(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function vn(e){return G(e).replaceAll($o,"").length}function Vd(e,t){if(e===null||e===void 0||e==="")return null;let o=Ye(t),r=hn(o),i=G(e),s=null,a=-1;for(let[l,c]of Object.entries(Xe(o))){let{source:u}=c;if(u===void 0||u===""||et(u))continue;let y=vn(u);if(y<=a)continue;let d=xn(u,i,r);if(d===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===d.length,name:l,...tt(c)},a=y}return s}function Un(e,t){if(e===null||e===void 0||e==="")return null;let o=Ye(t),r=G(e),i=r.toLowerCase();for(let[s,a]of Object.entries(Xe(o))){let{source:l}=a;if(l===void 0||l===""||!et(l))continue;let c=G(l).toLowerCase();if(i===c||i.endsWith(`/${c}`))return{def:a,dir:r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",fileBacked:!0,isSourceRoot:!1,name:s,...tt(a)}}return Vd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function Zc(e){return e.replaceAll(/([A-Z])/g," $1").replace(/^./,(t)=>t.toUpperCase())}function Nx(e){return e.replaceAll(/[^a-zA-Z0-9]+(.)?/g,(t,o)=>o?o.toUpperCase():"").replace(/^[A-Z]/,(t)=>t.toLowerCase())}function Ax(e){return e.replaceAll(/(^|-)(\w)/g,(t,o,r)=>(o?" ":"")+r.toUpperCase())}function SC(e,t){return e?.$label||Zc(t)}function LO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return Zc(t)}function Da(e){return e==="image"||e==="uri-reference"}function bh(e){if(e.$shorthand===!0)return"shorthand";if(e.$input==="button-group")return"button-group";if(e.$input==="media")return"media";if(e.format==="color")return"color";if(Da(e.format))return"media";if(e.$units!==void 0)return"number-unit";if(e.type==="number")return"number";if(Array.isArray(e.enum))return"select";if(Array.isArray(e.examples)||Array.isArray(e.presets))return"combobox";return"text"}function vh(e,t){if(!e||!t?.content)return null;let o=Un(e,t);if(!o||!o.def.schema)return null;if(!o.fileBacked){let r=o.ext??lr()?.extensions[0]??".json";if(!e.toLowerCase().endsWith(r.toLowerCase()))return null}return{name:o.name,schema:o.def.schema}}function pv(e,t){let o=e.trim().toLowerCase().replaceAll(/[^a-z0-9\s-]/g,"").replaceAll(/\s+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");if(!o)return"";return`${t}${o}`}function Ox(e,t){return e.replace(new RegExp(`^${t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}`),"").replace(/^--/,"").replaceAll("-"," ").replaceAll(/\b\w/g,(o)=>o.toUpperCase())||e}function $O(e){if(!e)return{kind:"text"};let t=e.trim().replaceAll(/\s*\|\s*undefined\b/g,"").trim();if(t==="boolean")return{kind:"boolean"};if(t==="number")return{kind:"number"};if(t.match(/^'[^']*'(\s*\|\s*'[^']*')+$/))return{kind:"combobox",options:[...t.matchAll(/'([^']*)'/g)].map((i)=>i[1])};return{kind:"text"}}function ir(e){return JSON.parse(JSON.stringify(e))}function Oe(e){return e?.at(-1)??null}function gO(e){return e?.[0]??null}function $x(e,t){if(!t||!e)return!1;return e.some((o)=>Er(o,t))}function Ra(e){return z(e)}function z(e){let t=[];for(let o of e)t.push([...o]);return t}function Ix(e,t){if($x(e,t))return z(e.filter((o)=>!Er(o,t)));return[...z(e),[...t]]}function bO(e,t,o){let r=e.findIndex((a)=>Er(a,o)),i=t?e.findIndex((a)=>Er(a,t)):-1;if(r===-1||i===-1)return[[...o]];let s=i<=r?e.slice(i,r+1):e.slice(r,i+1).toReversed();return z(s)}function ye(e,t){return z(e.filter((o)=>!na(t,o)))}function vO(e){let t=[];for(let o of e)if(!t.some((r)=>Er(r,o)))t.push([...o]);return t}function Bm(e){if(e.length===0)return{mixed:!1,value:void 0};let[t]=e,o=JSON.stringify(t??null);for(let r=1;r<e.length;r++)if(JSON.stringify(e[r]??null)!==o)return{mixed:!0,value:void 0};return{mixed:!1,value:t}}var nt=null;function TO(e){nt=e}function ot(){return nt}var X=null,Q=null,ee=null,Je=!0;function rt(){X=[],Q=[],ee=[],Je=!0}function f(e){if(X)X.push(e)}function Bi(e){if(Q)Q.push(e)}function it(e){if(ee)ee.push(e)}function st(){let e={docOps:Q??[],fmOps:ee??[],invertible:Je,ops:X??[]};return X=null,Q=null,ee=null,Je=!0,e}var On=100,Sn=20;function te(){try{return typeof localStorage>"u"||!localStorage.getItem("jx-legacy-history")}catch{return!0}}function w(e,t){let o=oe(e,t);if(!o)throw TypeError(`No node at path [${t.join(", ")}]`);return o}function P(e,t,o,r){return{forward:{key:t,op:"set-key",path:e,value:r},inverse:{key:t,op:"set-key",path:e,value:o}}}var at=null;function lt(e){at=e}var ct=null;function ut(e){ct=e}function wn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)$v(e.doc.document,de(t.docOps[i].inverse));for(let i=t.fmOps.length-1;i>=0;i--){let s=t.fmOps[i];je(e,s.field,s.before)}e.doc.document={...de(e.doc.document)},e.session.selection=o,e.doc.dirty=r}function Y(e,t,{skipHistory:o=!1,origin:r="user",coalesceKey:i=null,actor:s=null}={}){if(!e)return!1;if(r!=="remote"&&ct?.(e,r))return!1;let a=s??he;if(r!=="remote")De(e,a);let l=Ra(e.session.selection),c=e.doc.dirty;rt();let u,y=null;try{t(e)}catch(A){y={error:A}}finally{u=st()}if(y)throw wn(e,u,l,c),y.error;let d=de(e.doc.document),x={...d},k=ot(),j=k===null?{patchable:!1,reason:"no-patch-consumer"}:u.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:k.classify(e,u.ops);if(j.patchable)k.markConsumed(x,e);if(e.doc.document=x,j.patchable)try{k.apply(e,u.ops,u)}catch(A){k.escalate(`patch-apply-failed: ${A instanceof Error?A.message:String(A)}`,e)}if(!o){let A=a?An(a):null;if(A)Jn(A,e,u,l);else dt(e,d,u,l,i)}return e.doc.dirty=!0,at?.(e,u,r),!0}function dt(e,t,o,r,i=null){let s=e.history.snapshots.slice(0,e.history.index+1),a=te()&&o.invertible&&(o.docOps.length>0||o.fmOps.length>0),l=s.at(-1);if(i&&a&&l&&l.coalesceKey===i&&l.inverseOps){if(l.forwardOps=[...l.forwardOps??[],...o.docOps.map((u)=>u.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((u)=>u.inverse)],l.selection=Ra(e.session.selection),l.document)l.document=ir(t);e.history.snapshots=s,e.history.index=s.length-1;return}let c=!a||s.length%Sn===0;if(s.push({document:c?ir(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((u)=>u.forward):null,inverseOps:a?o.docOps.map((u)=>u.inverse):null,coalesceKey:i,selection:Ra(e.session.selection),selectionBefore:r}),s.length>On){if(!s[1].document)s[1].document=Ie(s,1);s.shift()}e.history.snapshots=s,e.history.index=s.length-1}function Ie(e,t){let o=t;while(o>=0&&!e[o].document)o-=1;let r=o<0?null:e[o].document;if(!r)throw Error("history-missing-checkpoint");let i=ir(r);for(let s=o+1;s<=t;s++)for(let a of e[s].forwardOps??[])$v(i,a);return i}function Ud(e,t,o){return Y(e,(r)=>t(r.doc.document),o)}function ke(e,t){Y(e,(o)=>{for(let r of t)xe(o,r)},{origin:"remote",skipHistory:!0})}function IO(e,t,{actor:o=null,selection:r={kind:"keep"}}={}){if(t.length===0)return"unchanged";return Y(e,(s)=>{for(let a of t)xe(s,a,jC(de(s.doc.document),a));Cn(s,r)},{actor:o})?"applied":"refused"}function Cn(e,t){if(t.kind==="prune")for(let o of t.under)e.session.selection=ye(e.session.selection,o);else if(t.kind==="follow"&&Er(Oe(e.session.selection),t.from))e.session.selection=[[...t.to]]}var Rn=new Set(["state","$media","$head","$elements","imports","$layout"]);function xe(e,t,o=t){let r=null;if(t.op==="set-key")r=oe(e.doc.document,t.path)?.[t.key];switch($v(e.doc.document,t),Bi({forward:t,inverse:o}),t.op){case"set-key":{if(Rn.has(t.key))f({key:t.key,op:"doc-meta"});else if(t.key==="style")f({op:"set-style",path:t.path});else if(t.key==="textContent")f({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")f({op:"replace",path:t.path});else{let i=t.key.startsWith("on")&&(uf(t.value)||uf(r));f({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{f({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{f({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{f({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{f({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var V=new Map,M=new Map,he=null,ft=null;function pt(e){ft=e}function RO(e){let t=V.get(e.id);if(t)be(t);let o={owner:e,receipts:[]};return V.set(e.id,o),{owner:e,flush:()=>be(o),close:()=>{if(be(o),V.get(e.id)===o)V.delete(e.id);return[...o.receipts]}}}function V$(e,t){let o=he;he=e;try{return t()}finally{he=o}}function mt(e,t){let o=M.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function DO(){for(let e of V.values())be(e)}function An(e){return V.get(e.id)??null}function be(e){for(let[t,o]of M)if(o.lane===e)gt(t,o)}function Jn(e,t,o,r){let i=M.get(t);if(!i)i={docOps:[],fmOps:[],invertible:!0,lane:e,selectionBefore:r},M.set(t,i);if(i.docOps.push(...o.docOps),i.fmOps.push(...o.fmOps),!o.invertible||o.docOps.length===0&&o.fmOps.length===0)i.invertible=!1}function De(e,t){let o=M.get(e);if(o&&o.lane.owner.id!==t?.id)gt(e,o)}function gt(e,t){M.delete(e);let{owner:o}=t.lane,r=o.turnId??"";if(F.has(e))t.lane.receipts.push({entry:null,tab:e,turnId:r});else{let i={docOps:t.docOps,fmOps:t.fmOps,invertible:t.invertible,ops:[]};dt(e,de(e.doc.document),i,t.selectionBefore);let s=e.history.snapshots[e.history.index];if(s.actor=o.id,o.turnId!==void 0)s.turnId=o.turnId;t.lane.receipts.push({entry:s,tab:e,turnId:r})}ft?.(e)}var F=new WeakMap;function fv(e,t){if(t)F.set(e,t);else F.delete(e)}function NO(e){let t=F.get(e);return t?t.canUndo(e):e.history.index>0||M.has(e)}function AO(e){let t=F.get(e);return t?t.canRedo(e):!M.has(e)&&e.history.index<e.history.snapshots.length-1}function yt(e,t){let{snapshots:o}=e.history;e.doc.document=Ie(o,t);let r=o[t];e.session.selection=Ra(de(r.selection))}function ht(e,t){try{if(typeof localStorage>"u"||!localStorage.getItem("jx-canvas-debug"))return}catch{return}let o=JSON.stringify(Ie(e.history.snapshots,t)),r=JSON.stringify(ir(de(e.doc.document)));if(o!==r)console.error("jx history: ops-based undo/redo diverged from checkpoint replay",{index:t})}function CC(e){De(e,null);let t=F.get(e);if(t){t.undo(e);return}if(e.history.index<=0)return;let o=e.history.snapshots[e.history.index],r=te()?o.inverseOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l=r.length-1;l>=0;l--)xe(a,de(r[l]));if(i)for(let l=i.length-1;l>=0;l--){let c=de(i[l]);je(a,c.field,c.before)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ra(de(o.selectionBefore??[])),e.history.index-=1,ht(e,e.history.index)}else e.history.index-=1,yt(e,e.history.index);e.doc.dirty=!0}function OO(e){De(e,null);let t=F.get(e);if(t){t.redo(e);return}if(e.history.index>=e.history.snapshots.length-1)return;let o=e.history.snapshots[e.history.index+1],r=te()?o.forwardOps:null,i=te()?o.fmOps:null;if(r&&r.length>0||i&&i.length>0){if(!Y(e,(a)=>{if(r)for(let l of r)xe(a,de(l));if(i)for(let l of i){let c=de(l);je(a,c.field,c.after)}},{origin:"history",skipHistory:!0}))return;e.session.selection=Ra(de(o.selection)),e.history.index+=1,ht(e,e.history.index)}else e.history.index+=1,yt(e,e.history.index);e.doc.dirty=!0}function or(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=Lv(i),a=lf(o,s.length);s.splice(a,0,structuredClone(r)),f({index:a,op:"insert",parentPath:t}),Bi({forward:{index:a,node:Se(r),op:"insert-child",parentPath:t},inverse:{index:a,op:"remove-child",parentPath:t}})}function yh(e,t){let o=cf(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=w(e.doc.document,i).children.splice(r,1);f({op:"remove",path:t}),Bi({forward:{index:r,op:"remove-child",parentPath:i},inverse:{index:r,node:Se(s),op:"insert-child",parentPath:i}}),e.session.selection=ye(e.session.selection,t)}function U$(e,t){let o=cf(t);if(!o)return;let r=oe(e.doc.document,t);if(!r)return;let{index:i,parentPath:s}=o,a=structuredClone(de(r));w(e.doc.document,s).children.splice(i+1,0,a),f({index:i+1,op:"insert",parentPath:s}),Bi({forward:{index:i+1,node:Se(a),op:"insert-child",parentPath:s},inverse:{index:i+1,op:"remove-child",parentPath:s}}),e.session.selection=[[...s,"children",i+1]]}function zm(e,t){for(let o of Xm(t))yh(e,o)}function Mx(e,t){let o=[];for(let r of Xm(t)){let i=e.session.selection;U$(e,r);let s=Oe(e.session.selection),a=cf(s);if(!s||!a||e.session.selection===i)continue;o=o.map((l)=>FC(a.parentPath,l,a.index,1,!0)),o.unshift(s)}if(o.length>0)e.session.selection=o}function MO(e,t,o="div"){let r=cf(t);if(!r)return;let i=oe(e.doc.document,t);if(!i)return;let{index:s,parentPath:a}=r,l={children:[structuredClone(de(i))],tagName:o},c=Se(i);w(e.doc.document,a).children.splice(s,1,l),f({op:"replace",path:t}),Bi({forward:{index:s,node:Se(l),op:"set-child",parentPath:a},inverse:{index:s,node:c,op:"set-child",parentPath:a}}),e.session.selection=[[...a,"children",s]]}function qp(e,t,o,r){let i=e.doc.document,s=Gx(i,t,o,r);if(!s)return;let{forward:a,inverse:l}=s,c=oe(i,a.fromParentPath),u=oe(i,o),[y]=c.children.splice(a.fromIndex,1);if(Lv(u).splice(a.toIndex,0,y),f({fromPath:t,op:"move",toIndex:a.toIndex,toParentPath:o}),Bi({forward:a,inverse:l}),Er(Oe(e.session.selection),t))e.session.selection=[[...l.fromParentPath,"children",l.fromIndex]]}function Qe(e,t,o,r){let i=oe(e.doc.document,t);if(!i)return;let s=i[o],a=Se(s);if(r===void 0||r===null||r==="")delete i[o];else i[o]=r;if(Bi(P(t,o,a,Se(i[o]))),o==="children")e.session.selection=ye(e.session.selection,[...t,"children"]);if(o==="textContent")f({op:"set-text",path:t});else if(o==="style")f({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&uf(l);f({isEvent:c,key:o,op:"set-prop",path:t})}}function Wm(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.style);if(!i.style)i.style={};if(r===void 0||r==="")delete i.style[o];else i.style[o]=r;if(Object.keys(i.style).length===0)delete i.style;Bi(P(t,"style",s,Se(i.style))),f({op:"set-style",path:t})}function Cr(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.attributes);if(!i.attributes)i.attributes={};if(r===void 0||r==="")delete i.attributes[o];else i.attributes[o]=r;if(Object.keys(i.attributes).length===0)delete i.attributes;Bi(P(t,"attributes",s,Se(i.attributes))),f({attr:o,op:"set-attr",path:t})}function PO(e,t,o,r,i){if(!o)return Wm(e,t,r,i);let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=`@${o}`,c=nd(s.style,l);if(i===void 0||i===""){if(delete c[r],Object.keys(c).length===0)delete s.style[l]}else c[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Se(s.style))),f({op:"set-style",path:t})}function Px(e,t,o,r,i){let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=nd(s.style,o);if(i===void 0||i===""){if(delete l[r],Object.keys(l).length===0)delete s.style[o]}else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Se(s.style))),f({op:"set-style",path:t})}function FO(e,t,o,r,i,s){let a=w(e.doc.document,t),l=Se(a.style);if(!a.style)a.style={};let c=`@${o}`,u=nd(a.style,c),y=nd(u,r);if(s===void 0||s===""){if(delete y[i],Object.keys(y).length===0)delete u[r];if(Object.keys(u).length===0)delete a.style[c]}else y[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Se(a.style))),f({op:"set-style",path:t})}function bt(e,t){let o=[e];for(let r of t){let i=Di(o.at(-1),r);if(!i)break;o.push(i)}for(let r=o.length-2;r>=0;r--){let i=o[r],s=t[r],a=Di(i,s);if(a&&Object.keys(a).length===0)delete i[s]}}function Fx(e,t,o,r,i){let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=s.style;for(let c of o)l=nd(l,c);if(i===void 0||i==="")delete l[r],bt(s.style,o);else l[r]=i;if(Object.keys(s.style).length===0)delete s.style;Bi(P(t,"style",a,Se(s.style))),f({op:"set-style",path:t})}function jO(e,t,o,r,i,s){let a=w(e.doc.document,t),l=Se(a.style);if(!a.style)a.style={};let c=`@${o}`,u=nd(a.style,c),y=u;for(let d of r)y=nd(y,d);if(s===void 0||s===""){if(delete y[i],bt(u,r),Object.keys(u).length===0)delete a.style[c]}else y[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Se(a.style))),f({op:"set-style",path:t})}function HO(e,t,o){let r=w(e.doc.document,t),i=Se(r.style);if(o&&Object.keys(o).length>0)r.style=o;else delete r.style;Bi(P(t,"style",i,Se(r.style))),f({op:"set-style",path:t})}function qd(e,t,o){let r=e.doc.document,i=Se(r.state);if(!r.state)r.state={};r.state[t]=o,Bi(P([],"state",i,Se(r.state))),f({key:"state",op:"doc-meta"})}function BO(e,t){let o=e.doc.document;if(o.state){let r=Se(o.state);if(delete o.state[t],Object.keys(o.state).length===0)delete o.state;Bi(P([],"state",r,Se(o.state))),f({key:"state",op:"doc-meta"})}}function qr(e,t,o){let r=e.doc.document,i=Se(r.state);if(!r.state)r.state={};let s=r.state[t],a=s==null?{}:!_(s)||Array.isArray(s)?{default:s}:s;r.state[t]=a,Object.assign(a,o);for(let l of Object.keys(a))if(a[l]===void 0||a[l]===null)delete a[l];Bi(P([],"state",i,Se(r.state))),f({key:"state",op:"doc-meta"})}function zO(e,t,o){let r=e.doc.document;if(!r.state||!r.state[t])return;let i=Se(r.state);r.state[o]=r.state[t],delete r.state[t],Bi(P([],"state",i,Se(r.state))),f({key:"state",op:"doc-meta"})}function Gp(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.$props);if(!i.$props)i.$props={};if(r===void 0||r===null||r==="")delete i.$props[o];else i.$props[o]=r;if(Object.keys(i.$props).length===0)delete i.$props;Bi(P(t,"$props",s,Se(i.$props))),f({op:"replace",path:t})}function WO(e,t,o,r){let i=w(e.doc.document,t),s=Se(i.cases);if(!i.cases)i.cases={};i.cases[o]=r||{tagName:"div",textContent:o},Bi(P(t,"cases",s,Se(i.cases))),f({op:"replace",path:t})}function VO(e,t,o){let r=w(e.doc.document,t);if(r.cases){let i=Se(r.cases);delete r.cases[o],Bi(P(t,"cases",i,Se(r.cases))),f({op:"replace",path:t})}}function UO(e,t,o,r){let i=w(e.doc.document,t);if(!i.cases||!i.cases[o])return;let s=Se(i.cases);i.cases[r]=i.cases[o],delete i.cases[o],Bi(P(t,"cases",s,Se(i.cases))),f({op:"replace",path:t})}function Gd(e,t,o){let r=e.doc.content.frontmatter,i=Object.hasOwn(r,t)?Se(r[t]):void 0,s=o===void 0||o===null||o==="";if(s)delete r[t];else r[t]=o;let a=s?void 0:Se(o);it({after:a,before:i,field:t}),e.doc.dirty=!0}function je(e,t,o){if(o===void 0)delete e.doc.content.frontmatter[t];else e.doc.content.frontmatter[t]=o}var W=[],In=50;function qO(e){return Object.assign(Ex(),{turnId:e})}function GO(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};W.push(r);while(W.length>In)W.shift();return r.writes}function KO(e){return W.find((t)=>t.id===e)?.writes??[]}function JO(e){let t=W.find((s)=>s.id===e),o="There is no longer a record of what that turn changed.";if(!t)return"There is no longer a record of what that turn changed.";let r=t.writes.filter((s)=>s.disk).map((s)=>s.path);if(r.length>0)return`Cannot restore: ${r.join(", ")} ${r.length===1?"was":"were"} written straight to disk, which undo cannot reach.`;if(t.batches.length===0)return"There is no longer a record of what that turn changed.";let i=new Map;for(let s of t.batches)i.set(s.tab,[...i.get(s.tab)??[],s]);for(let[s,a]of i){let l=kn(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)CC(s);return[...i.keys()]}function kn(e,t){let o=e.documentPath??"(untitled)";if(e.scope.active===!1)return`Cannot restore: ${o} was closed after that turn.`;if(t.some((l)=>l.entry===null))return`Cannot restore: ${o} is shared live, and Restore cannot check its undo history. Undo it in the document instead.`;let{index:r,snapshots:i}=e.history,s=i.slice(r-t.length+1,r+1);if(r-t.length>=0&&t.every((l,c)=>s[c]===l.entry))return null;return i.indexOf(t.at(-1).entry)>r?`Cannot restore: that turn's change to ${o} was already undone.`:`Cannot restore: ${o} has edits made since that turn began, which Restore would undo too.`}function YO(e){let t=e.filter((l)=>l.ok),o=new Set(t.map((l)=>l.path)),r=e.length-t.length;if(o.size===0)return r>0?`${r} change${r===1?"":"s"} failed`:"";let i=`Changed ${o.size} file${o.size===1?"":"s"}`,s=new Set(t.flatMap((l)=>l.disk?[l.path]:[])),a=[i];if(s.size>0)a.push(`${s.size} written to disk — undo cannot reach ${s.size===1?"it":"them"}`);if(r>0)a.push(`${r} failed`);return a.join(" · ")}function kC(){W.splice(0)}function ZO(e,t){let o=null;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.id===t)return o;let s=i.role==="assistant"&&(i.content||(i.toolCalls?.length??0)>0);if(o===null&&s)o=i.id}return t===void 0?o:null}function jm(e){let t=new Set,o=new Set;return yv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function fO(e,t){if(!t)return e;return Ee(e,"",t)}function Ee(e,t,o){if(Array.isArray(e)){let i=null;for(let[s,a]of e.entries()){let l=Ee(a,`${t}/${s}`,o);if(l!==a)i??=[...e],i[s]=l}return i??e}if(!v(e))return e;let r=null;for(let[i,s]of Object.entries(e)){let a=Ee(s,`${t}/${Q$(i)}`,o);if(i==="children"&&Array.isArray(a)&&a.length===1){let[l]=a;if(Go(l)&&(o.pointers.has(t)||o.fingerprints.has(JSON.stringify(l))))a=l}if(a!==s)r??={...e},r[i]=a}return r??e}var vC=["design","content","media","styles","publish","settings"],Wp="design",xt=[{icon:"frame-corners",id:"design",switcher:!0,title:"Design"},{icon:"file-text",id:"content",switcher:!0,title:"Content"},{icon:"image",id:"media",switcher:!0,title:"Media"},{icon:"paint-brush",id:"styles",switcher:!0,title:"Styles"},{icon:"paper-plane-tilt",id:"publish",switcher:!0,title:"Publish"},{icon:"gear-six",id:"settings",switcher:!1,title:"Project settings"}],xx=xt.filter((e)=>e.switcher);function A$(e){return typeof e==="string"&&vC.some((t)=>t===e)}function fh(e){return xt.find((t)=>t.id===e)}var Me="workspace://",_x={content:"content-home",media:"media-home",publish:"publish-home",settings:"settings-home"};function Vp(e){return Object.hasOwn(_x,e)}function Ia(e){return`${Me}${e}`}function dl(e){if(!e.startsWith(Me))return null;let t=e.slice(Me.length);return A$(t)&&Vp(t)?t:null}function rv(e){let t=dl(e);return t?fh(t).title:null}var Dn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["settings-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Up={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Qs(e){return Dn.get(e)??"canvas"}var jn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function uO(e){return jn.get(e)??"design"}var Sx=(e)=>e.editor.kind==="canvas",mh=(e)=>Sx(e)&&e.selection.count>0,Cx=(e)=>mh(e)&&!e.selection.isRoot;function sv(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:Wp},document:{open:!1,dirty:!1,mode:"",canUndo:!1,canRedo:!1},editor:{kind:"none"},canvas:{view:"design"},pane:{count:1,derived:!1},selection:{count:0,paths:[],kind:"",isRoot:!1,isComponentInstance:!1,isLayoutNode:!1,isRepeater:!1},caret:{active:!1,inCanvas:!1},focus:{region:"pane"},modal:{open:!1},collab:{attached:!1,readOnly:!1,sourceCanonical:!1},ai:{configured:!1,streaming:!1,waiting:!1},capability:{gitClone:!1,importSite:!1,openProjectInNewWindow:!1,openProject:!1,dataRows:!1,windowControls:!1,findReferences:!1,readFileBytes:!1,publish:!1}}}function yC(e={}){let t=sv();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var En=["palette"],Mn=["caret","global"],$n=["dock","global"],Ln=["canvas","global"],Nn=["grid","global"],_n=["code","global"],Tt=["global"];function hO(e){if(e.modal.open)return En;if(e.caret.active)return Mn;if(e.focus.region!=="pane")return $n;switch(e.editor.kind){case"grid":return Nn;case"code":return _n;case"canvas":return e.canvas.view==="preview"?Tt:Ln;default:return Tt}}var an="project.json";function Wn(e,t=!1){return{activeMedia:null,activeSelector:null,openPopover:null,openDialog:null,canvasMode:e,editZoom:1,editingFormula:null,editingFunction:null,featureToggles:{},inspectorSections:{},pendingInlineEdit:null,preview:t,previewColorScheme:"auto",previewLocale:null,previewParams:{},previewProps:null,rightTab:"page",elementTab:"properties",showLayout:!0,styleFilter:"",styleSections:{},dataRows:{},dataLimits:{},styleShorthands:{},zoom:1}}var Bn=["edit","design","preview","source","stylebook","git-diff"];function lv({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:u=null,source:y=null,canvasMode:d}){let x=ge(),k=jm(r),j=a?.modes??Hn(t,s),A=d??j.find((b)=>b!=="preview")??"edit",ce=j[0]==="preview",E={bareRepeaters:k,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:u,mode:Kn(t,s),source:y,sourceFormat:s},ue={index:0,snapshots:[{document:structuredClone(r),selection:[]}]},K={canvas:{refreshing:!1,error:null,livePreviews:null,pendingInlineEdit:null,scope:null,status:"idle"},clipboard:null,hover:null,openedFrom:l,selection:[],ui:Wn(A,ce)};return x.run(()=>({capabilities:{modes:j},doc:g(E),documentPath:t,fileHandle:o,history:g(ue),id:e,pinned:!1,preview:c,scope:x,session:g(K)}))}function Hn(e,t){if(e===an)return["stylebook","tokens","source"];let o=Wi(t)??fn(e);if(o)return o.studio?.modes??["edit","design","preview","source"];return Bn}function Kn(e,t){let o=Wi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function xC(e){return Qs(e.session.ui.canvasMode)}function P$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Qs(o);if(!t.includes(r))t.push(r)}return t}function mO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Qs(o)===t)}function Hm(e){e.scope.stop()}var vt=new WeakMap,B=new Map;function Tn(e){let t=de(e),o=vt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),vt.set(t,o);return o}function Ot(e){B.set(e,(B.get(e)??0)+1)}function wt(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function cv(e){return B.has(e.replaceAll("\\","/"))}var qn=8000,Gn=800,zn=2500,Ct=null;function Yn(){return Ct??=(le("bs4k9tr6"),import("./index-bs4k9tr6.js")),Ct}function At(){try{return p()}catch{return null}}var H=null;function yO(e){H=e}var Le=null;function wO(e){Le=e}var Jt=()=>{};function xO(e){Jt=e??(()=>{})}var Ne=new WeakMap;function It(e){return de(e)}function _e(e,t){return e.frontmatterMap(t)}function Zn(e){return e.synced}function D(e){return Ne.get(It(e))}function Be(e){let t=It(e),o=Ne.get(t);if(!o)o={attaching:null,generation:0,optedOut:g({value:!1}),session:null,watcherInstalled:!1},Ne.set(t,o);return o}var Rt=!1;function Xn(){if(Rt)return;Rt=!0,lt(Qn),pt(eo),ut((e)=>{if(D(e)?.session?.synced&&Tn(e).sourceCanonical)return Jt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function Qn(e,t,o){let r=D(e)?.session;if(!r||!r.synced)return;if(r.lastSeenRef=de(e.doc.document),o==="remote"){Te(r);return}if(r.canWrite)to(r,t),Te(r)}function eo(e){let t=D(e)?.session;if(!t?.synced||t.batchOps===null)return;let{batchOps:o,batchNeedsDiff:r}=t;if(t.batchOps=null,t.batchNeedsDiff=!1,!t.canWrite)return;if(t.undoManager?.stopCapturing(),r)re(t);else if(o.length>0)try{t.collab.applyDocOpsToY(t.handle.doc,o,t.collab.LOCAL_ORIGIN)}catch{re(t)}t.undoManager?.stopCapturing()}function to(e,t){let o=t.docOps.map((r)=>r.forward);if(mt(e.tab)){if(e.batchOps??=[],o.length===0)e.batchNeedsDiff=!0;else e.batchOps.push(...o);return}if(o.length===0){re(e);return}try{e.collab.applyDocOpsToY(e.handle.doc,o,e.collab.LOCAL_ORIGIN)}catch{re(e)}}function re(e){let{collab:t,handle:o,tab:r}=e,i=t.yDocToJson(o.doc),s=ir(de(r.doc.document)),a=t.diffDocs(i,s);if(a===null)t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN);else if(a.length>0)try{t.applyDocOpsToY(o.doc,a,t.LOCAL_ORIGIN)}catch{t.replaceYStructure(o.doc,s,t.LOCAL_ORIGIN)}}function $e(e){let t=e.collab.yDocToJson(e.handle.doc);Y(e.tab,(o)=>{let r=o.doc.document;for(let i of Object.keys(r))if(!(i in t))delete r[i];Object.assign(r,t)},{origin:"remote",skipHistory:!0})}function no(e){if(!e.canWrite)return!1;let{awareness:t}=e.handle,o=t.clientID;for(let[r,i]of t.getStates())if(i.canWrite!==!1&&r<o)o=r;return o===e.handle.awareness.clientID}function Te(e){if(!H||!no(e))return;if(e.collab.canonicalOf(e.handle.doc)==="source")return;let t=Date.now();if(e.lastMirrorAt??=t,t-e.lastMirrorAt>=zn){if(e.mirrorTimer)clearTimeout(e.mirrorTimer),e.mirrorTimer=null;e.lastMirrorAt=t,Fe(e);return}if(e.mirrorTimer)clearTimeout(e.mirrorTimer);e.mirrorTimer=setTimeout(()=>{e.mirrorTimer=null,e.lastMirrorAt=Date.now(),Fe(e)},Gn)}async function Fe(e){if(!H||!e.synced)return;try{let t=await H(e.tab);e.collab.updateSourceText(e.handle.doc,t,e.collab.MIRROR_ORIGIN)}catch{}}async function kt(e){if(!Le||!e.synced||!e.canWrite)return;let{collab:t,handle:o,tab:r}=e,i=t.canonicalRevOf(o.doc),s=t.sourceText(o.doc).toString(),a;try{a=await Le(r,s)}catch{return}if(!Zn(e)||t.canonicalRevOf(o.doc)!==i)return;let l=t.diffDocs(t.yDocToJson(o.doc),a.document);if(l===null)t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN);else if(l.length>0)try{t.applyDocOpsToY(o.doc,l,t.MIRROR_ORIGIN)}catch{t.replaceYStructure(o.doc,a.document,t.MIRROR_ORIGIN)}let c=_e(t,o.doc),u=a.frontmatter??{};o.doc.transact(()=>{let y=[...c.keys()];for(let d of y)if(!(d in u))c.delete(d);for(let[d,x]of Object.entries(u))if(!t.deepEqual(c.get(d),x))c.set(d,x)},t.MIRROR_ORIGIN)}function _O(e){let t=D(e)?.session;if(!t?.synced)return null;let{collab:o,handle:r}=t,i=null,s=()=>i!==null&&t.sourceLockOwner===i;return{awareness:r.awareness,enter:async()=>{i={},t.sourceLockOwner=i;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"source"});if(!t.canWrite)return;let l=null;if(H)try{l=await H(e)}catch{l=null}if(!s())return;o.acquireSourceCanonical(r.doc,l??o.sourceText(r.doc).toString(),o.LOCAL_ORIGIN)},leave:()=>{if(!s()){i=null;return}i=null,t.sourceLockOwner=null;let a=r.awareness.getLocalState();if(a)r.awareness.setLocalState({...a,mode:"structure"});if(!t.canWrite)return;if(o.otherSourceEditors(r.awareness,t.path,r.awareness.clientID).filter((c)=>r.awareness.getStates().get(c)?.canWrite!==!1).length===0)kt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function hv(e){let t=Tn(e);return t.active&&t.readOnly}async function j$(e){let t=D(e)?.session;if(!t?.synced||!t.canWrite)return!1;if(t.mirrorTimer)clearTimeout(t.mirrorTimer),t.mirrorTimer=null;return await Fe(t),await t.handle.flush(),!0}async function SO(){for(let e of Ve)if(D(e)?.session?.synced)await j$(e)}var Ve=new Set;function ie(e){if(!At()?.collab||!e.documentPath||e.documentPath===an)return;let o=Be(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,Xn(),Ve.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)ve(e);else He(e)}),ea(()=>{Ve.delete(e),ve(e)})})}function H$(e,t){let o=Be(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function B$(e){return D(e)?.optedOut.value!==!0}function Dt(e){if(!D(e)?.watcherInstalled){ie(e);return}ve(e),He(e)}async function He(e){let t=Be(e);if(t.session||t.attaching)return;let{documentPath:o}=e,r=At();if(!o||!r?.collab){Tn(e).status="unavailable";return}let{generation:i}=t,s=Tn(e);s.status="connecting",s.attachError="";let a=(async()=>{try{let[l,c]=await Promise.all([Yn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let u,y=new Promise((d,x)=>{u=setTimeout(()=>x(Error("collab-sync-timeout")),qn)});try{await Promise.race([c.whenSynced,y])}finally{clearTimeout(u)}if(t.generation!==i){c.destroy();return}t.session=oo(e,o,l,c),s.active=!0,s.status="synced",s.readOnly=!t.session.canWrite,s.attachError="",Ot(o)}catch(l){s.status="failed",s.active=!1,s.attachError=l instanceof Error?l.message:String(l),C.warn(`Live collaboration is not available for "${o}" — ${s.attachError}`,{key:`collab:${o}`,path:o,source:"Collaboration"})}finally{t.attaching=null}})();t.attaching=a,await a}function ve(e){let t=D(e);if(!t)return;t.generation+=1;let{session:o}=t;t.session=null;let r=Tn(e);if(r.active=!1,r.status="detached",r.attachError="",r.peers=[],!o)return;if(wt(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}fv(e,null),e.history.snapshots=[{document:ir(de(e.doc.document)),selection:Ra(e.session.selection)}],e.history.index=0,o.undoManager?.destroy(),o.handle.destroy()}function oo(e,t,o,r){let i=r.identity(),s={applyingRemoteFrontmatter:!1,batchNeedsDiff:!1,batchOps:null,canWrite:i?i.permission!=="read":!0,collab:o,disposers:[],handle:r,lastSeenRef:de(e.doc.document),mirrorTimer:null,path:t,sourceLockOwner:null,sourceParseTimer:null,synced:!1,tab:e,undoManager:null};if(o.metaMap(r.doc).get("structureSeeded")===!0){let b=o.yDocToJson(r.doc),T=ir(de(e.doc.document));if(!o.deepEqual(b,T)){let J=o.diffDocs(T,b);if(J===null)s.synced=!0,$e(s),s.synced=!1;else if(J.length>0)ke(e,J)}s.applyingRemoteFrontmatter=!0;let O=_e(o,r.doc);for(let[J,N]of O.entries())e.doc.content.frontmatter[J]=N;s.applyingRemoteFrontmatter=!1}else if(s.canWrite)o.seedStructure(r.doc,ir(de(e.doc.document)),{frontmatter:ir(de(e.doc.content.frontmatter)),origin:o.SEED_ORIGIN,sourceFormat:e.doc.sourceFormat});s.lastSeenRef=de(e.doc.document),s.disposers.push(r.onDirty((b)=>{e.doc.dirty=b})),r.awareness.setLocalState({canWrite:s.canWrite,focusedPath:t,structuralSelection:null,user:i?{avatarUrl:i.avatarUrl,color:i.color,login:i.login,name:i.name}:{color:o.colorForKey(String(r.awareness.clientID)),login:`guest-${r.awareness.clientID%1000}`}});let l=new o.UndoManager([o.structureMap(r.doc),o.frontmatterMap(r.doc)],{trackedOrigins:new Set([o.LOCAL_ORIGIN])});s.undoManager=l;let c=({stackItem:b})=>{b.meta.set("selection",Ra(e.session.selection))},u=({stackItem:b})=>{let T=b.meta.get("selection");e.session.selection=Ra(T??[])};l.on("stack-item-added",c),l.on("stack-item-popped",u),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",u)}),fv(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let y=o.structureMap(r.doc),d=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;let O=o.yEventsToDocOps(b);if(O===null){$e(s);return}if(O.length===0)return;try{ke(e,O)}catch{$e(s)}};y.observeDeep(d),s.disposers.push(()=>y.unobserveDeep(d));let x=Tn(e);x.sourceCanonical=o.canonicalOf(r.doc)==="source";let k=o.metaMap(r.doc),j=()=>{x.sourceCanonical=o.canonicalOf(r.doc)==="source"};k.observe(j),s.disposers.push(()=>k.unobserve(j));let A=o.sourceText(r.doc),ce=(b,T)=>{if(T.origin===o.MIRROR_ORIGIN||!s.synced)return;if(o.canonicalOf(r.doc)!=="source")return;if(!o.isSourceReconciler(r.awareness,s.path))return;if(s.sourceParseTimer)clearTimeout(s.sourceParseTimer);s.sourceParseTimer=setTimeout(()=>{s.sourceParseTimer=null,kt(s)},600)};A.observe(ce),s.disposers.push(()=>A.unobserve(ce));let E=_e(o,r.doc),ue=(b,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[O,J]of b.changes.keys)if(J.action==="delete")delete e.doc.content.frontmatter[O];else e.doc.content.frontmatter[O]=E.get(O)}finally{s.applyingRemoteFrontmatter=!1}};E.observe(ue),s.disposers.push(()=>E.unobserve(ue)),e.scope.run(()=>{let b=JSON.stringify(e.doc.content.frontmatter);ne(()=>{let T=JSON.stringify(e.doc.content.frontmatter);if(T===b)return;if(b=T,s.applyingRemoteFrontmatter||!s.synced||!s.canWrite)return;let O=JSON.parse(T);r.doc.transact(()=>{let J=[...E.keys()];for(let N of J)if(!(N in O))E.delete(N);for(let[N,qe]of Object.entries(O))if(!o.deepEqual(E.get(N),qe))E.set(N,qe)},o.LOCAL_ORIGIN),Te(s)}),ne(()=>{let T=e.session.selection.length>0?Ra(e.session.selection):null,O=r.awareness.getLocalState();if(O)r.awareness.setLocalState({...O,structuralSelection:T})}),ne(()=>{let T=de(e.doc.document);queueMicrotask(()=>{if(D(e)?.session!==s||!s.synced||!s.canWrite)return;let J=de(e.doc.document);if(J!==T||J===s.lastSeenRef)return;s.lastSeenRef=J,re(s),Te(s)})})});let K=Tn(e),fe=()=>{let b=[];for(let[T,O]of r.awareness.getStates())if(T!==r.awareness.clientID&&O.user)b.push({clientId:T,state:O});K.peers=b};return fe(),r.awareness.on("change",fe),s.disposers.push(()=>r.awareness.off("change",fe),r.onStatus((b)=>{if(b==="offline"||b==="connecting")K.status="offline";else if(s.synced)K.status="synced"}),r.onReset(()=>{ve(e),He(e)})),s.synced=!0,s}function I(e,t,o){return RangeError(`command "${e}" argument "${t}": ${o}`)}function ro(e){if(Z(e))return"number";if(Ze(e))return"boolean";return n(e)?"string":"object"}function R(e){if(e===void 0)return"missing";return n(e)?`"${e}"`:`${ro(e)} ${JSON.stringify(e)}`}function Et(e){return Array.isArray(e)&&e.every((t)=>n(t)||Z(t))}function St(e,t,o){let r=t[o];if(!n(r)||r==="")throw I(e,o,`expected a non-empty string, got ${R(r)}`);return r}function ti(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Mt(e,t,o){let r=t[o];if(!Z(r)||!Number.isFinite(r))throw I(e,o,`expected a finite number, got ${R(r)}`);return r}function jt(e,t,o){let r=t[o];if(!Z(r)||!Number.isInteger(r))throw I(e,o,`expected an integer, got ${R(r)}`);return r}function Rx(e,t,o,r,i){let s=Mt(e,t,o);if(s<r||s>i)throw I(e,o,`${s} is outside the supported range ${r}–${i}`);return s}function Hi(e,t,o){let r=t[o];if(!Ze(r))throw I(e,o,`expected a boolean, got ${R(r)}`);return r}function Vn(e,t,o,r){let i=t[o],s=n(i)?r.find((a)=>a===i):void 0;if(s===void 0)throw I(e,o,`${R(i)} is not declared — declared: ${r.join(", ")||"none"}`);return s}function _C(e,t,o){let r=t[o];if(!Et(r))throw I(e,o,`expected an array of path segments (strings or numbers), got ${R(r)}`);return r}function CO(e,t,o){if(t[o]===null)return null;return _C(e,t,o)}function z$(e,t,o){let r=t[o];if(!Array.isArray(r))throw I(e,o,`expected an array of document paths, got ${R(r)}`);return r.map((i,s)=>{if(!Et(i))throw I(e,o,`entry ${s} is not a document path — expected an array of segments, got ${R(i)}`);return i})}function Ce(e,t=Object.keys(e)){return{additionalProperties:!1,properties:e,required:[...t],type:"object"}}function pi(e,t){return{description:t,enum:[...e],type:"string"}}function ul(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function W$(e,t={}){return{description:e,type:"number",...t}}function Lo(e){return{description:e,type:"boolean"}}function Dx(e,t=!1){let o={items:{type:["string","number"]},type:"array"};return t?{description:e,oneOf:[o,{type:"null"}]}:{description:e,...o}}function kO(e){return{description:e,items:{items:{type:["string","number"]},type:"array"},type:"array"}}function We(e){return{description:e,type:"string"}}function io(e){return e.length===2&&e.includes("string")&&e.includes("number")}function Ue(e){return n(e)?[e]:e}function $t(e){let t=e;if("enum"in t)return"enum";if("const"in t)return"const";if(Array.isArray(t.oneOf))return"one-of";if(Array.isArray(t.type))return"typed";switch(t.type){case"boolean":return"boolean";case"number":case"integer":{if(t.minimum!==void 0&&t.maximum!==void 0)return"bounded-number";return t.type==="integer"?"integer":"number"}case"string":return"string";case"array":{let o=t.items?.type;if(Array.isArray(o))return io(o)?"path":"pass-through";return o==="array"?"path-list":"pass-through"}case"null":case"object":return"typed";default:break}return"pass-through"}function Lt(e,t){switch(e){case"null":return t===null;case"boolean":return Ze(t);case"string":return n(t);case"number":return Z(t)&&Number.isFinite(t);case"integer":return Z(t)&&Number.isInteger(t);case"array":return Array.isArray(t);case"object":return _(t)&&!Array.isArray(t);default:break}return!1}function Nt(e){if(e.length<=1)return e.join("");return`${e.slice(0,-1).join(", ")} or ${e.at(-1)}`}function so(e,t,o,r){let i=t[o];if(i===void 0||!r.some((s)=>Lt(s,i)))throw I(e,o,`expected ${Nt(r)}, got ${R(i)}`);return i}function _t(e){switch($t(e)){case"enum":return`one of ${(e.enum??[]).map((t)=>R(t)).join(" | ")}`;case"const":return`the constant ${R(e.const)}`;case"one-of":return(e.oneOf??[]).map((t)=>_t(t)).join(" or ");case"typed":return Nt(Ue(e.type??[]));case"boolean":return"a boolean";case"bounded-number":return`a number from ${e.minimum} to ${e.maximum}`;case"number":return"a finite number";case"integer":return"an integer";case"string":return"a non-empty string";case"path":return"a document path";case"path-list":return"a list of document paths";default:return"anything"}}function ao(e,t,o,r){let i=t[o],s=[];for(let a of r){if(a.type!==void 0&&!Ue(a.type).some((l)=>Lt(l,i)))continue;try{return Ft(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw I(e,o,`expected ${r.map((a)=>_t(a)).join(" or ")}, got ${R(i)}`)}function Ft(e,t,o,r){switch($t(r)){case"enum":return Vn(e,t,o,r.enum??[]);case"const":{let i=t[o];if(i!==r.const)throw I(e,o,`expected the constant ${R(r.const)}, got ${R(i)}`);return i}case"one-of":return ao(e,t,o,r.oneOf??[]);case"typed":return so(e,t,o,Ue(r.type??[]));case"boolean":return Hi(e,t,o);case"bounded-number":{if(r.type==="integer")jt(e,t,o);return Rx(e,t,o,r.minimum,r.maximum)}case"number":return Mt(e,t,o);case"integer":return jt(e,t,o);case"string":return St(e,t,o);case"path":return _C(e,t,o);case"path-list":return z$(e,t,o);default:return t[o]}}function EO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,u]of Object.entries(o)){if(u===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw I(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=u}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=Ft(e,o,c,i[c])}return l}var lo=20,fi="primary",Vm="secondary",q$=2,m=g({activePaneId:fi,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Gr();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Gr().tabOrder}}),h=Th(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Gr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function pn(e){return m.panes.find((t)=>t.id===e)}function Na(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function kr(e){let t=pn(e);if(!t||t.id===m.activePaneId)return;m.activePaneId=t.id,L();let{activeTabId:o}=t;if(o){Ke(o);let r=m.tabs.get(o);if(r)qt(r)}}function Um(e){return m.activePaneId===e}function EC(e){let t=e??Gr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Na(t);if(!r)return null;let i=Ql(r.id);return Km(t),wh(i,t),i.activeTabId=t,m.activePaneId=i.id,L(),Ke(t),i}function TC(e){return m.panes.find((t)=>t.id!==e)??co(Vm)}function Ql(e){let t=TC(e);if(t.derived)t.derived=null;return t}function co(e){let t=pn(e);if(t)return t;return m.panes=[...m.panes,{activeTabId:null,derived:null,id:e,tabOrder:[]}],pn(e)}function qm(e){if(m.panes.length<2)return;let t=e===fi?m.panes.find((s)=>s.id!==fi)?.id:e,o=t===void 0?void 0:pn(t),r=m.panes.find((s)=>s.id!==t);if(!o||!r)return;for(let s of o.tabOrder)wh(r,s);let i=o.activeTabId!==null&&U(o.activeTabId)?o.activeTabId:null;if(r.activeTabId=m.activePaneId===o.id?i??r.activeTabId??o.activeTabId:r.activeTabId??o.activeTabId,m.activePaneId=r.id,r.derived?.sourcePaneId===o.id)r.derived=null;m.panes=m.panes.filter((s)=>s.id!==o.id),L()}function Gm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function LC(e){U=e??(()=>!0)}var Ht=null;function $C(e){Ht=e}var Ut=null;function IC(e){Ut=e}function uo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Kt(e){return e.tabOrder.findLast((t)=>U(t))??null}function Km(e){let t=[];for(let o of m.panes){if(!o.tabOrder.includes(e))continue;if(o.tabOrder=o.tabOrder.filter((r)=>r!==e),o.activeTabId===e)o.activeTabId=Kt(o);if(o.id!==fi&&Gm(o))t.push(o.id)}for(let o of t)qm(o)}function wh(e,t,o){if(e.tabOrder.includes(t))return;let r=o??po(e,t);e.tabOrder=[...e.tabOrder.slice(0,r),t,...e.tabOrder.slice(r)]}function fo(e){let t=0;for(let o of e.tabOrder){if(m.tabs.get(o)?.pinned!==!0)break;t+=1}return t}function po(e,t){return m.tabs.get(t)?.pinned===!0?fo(e):e.tabOrder.length}function ec(e,t=null){if(m.projectRoot&&e!==m.projectRoot)kC();m.projectRoot=e,m.projectConfig=t}function Kp(e){let t=h.value;return e!==null&&t!==null&&de(t)===de(e)}function Kd(e){if(!e)return!1;let t=m.tabs.get(e.id);return t!==void 0&&de(t)===de(e)}function Ke(e){m.mruOrder=[e,...m.mruOrder.filter((t)=>t!==e)]}var Pe=null,se=0;function L(){Pe=null,se=0}function qt(e){if(S&&e.documentPath)S.selectedPath=e.documentPath}function RC(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Na(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)L(),Ke(e);qt(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=lv({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??Gr();return wh(c,l.id),m.tabs.set(l.id,l),l}let t=m.tabs.get(e.id),o=e.preview===!0&&t?.pinned!==!0,r=lv({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??Gr(),s;if(t)r.pinned=t.pinned,Hm(t);else{if(o){let l=Vt(i),c=l?m.tabs.get(l):null;if(c)Zd(c);DC()}let a=o?Vt(i):null;if(a)s=i.tabOrder.indexOf(a),Jd(a);wh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Vt(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function Xc(e){let t=m.tabs.get(e);if(t?.preview===!0)t.preview=!1}function DC(){for(let[e,t]of m.tabs)if(t.preview&&t.doc.dirty)Xc(e)}function jx(e,t){let o=m.tabs.get(e),r=Na(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function G$(e,t){let o=m.tabs.get(e),r=Na(e);if(!o||!r)return;r.tabOrder=Gt(r,e,t)}function Gt(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((u)=>u!==t),s=i.filter((u)=>m.tabs.get(u)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Jd(e){let t=m.tabs.get(e);if(!t)return;let o=Na(e),r=o?.activeTabId===e;if(mo(t),Hm(t),m.tabs.delete(e),kx(e),Km(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),L(),o&&Gm(o))qm(o.id);if(!r)return;let i=Gr(),s=Ut?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Kt(i);if(a)ae(a);else Ht?.(i.id)}function K$(){let e=[...m.tabs.values()];m.tabs.clear(),zt(),m.mruOrder=[],L();for(let t of e)Hm(t)}function zt(){m.panes=[{activeTabId:null,derived:null,id:fi,tabOrder:[]}],m.activePaneId=fi}function mo(e){if(!e.documentPath)return;let t=e.documentPath;m.closedTabs=[{documentPath:t},...m.closedTabs.filter((o)=>o.documentPath!==t)].slice(0,lo)}function yo(){let[e]=m.closedTabs;if(!e)return;return m.closedTabs=m.closedTabs.slice(1),e.documentPath}function Bt(e){if(!Pe)Pe=m.mruOrder.filter((r)=>m.tabs.has(r)&&U(r)),se=0;let t=Pe;if(t.length<2)return;se=((se+e)%t.length+t.length)%t.length;let o=t[se];return ae(o,{cycling:!0}),o}function J$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=lv(e);m.tabs.set(r.id,r),zt(),m.panes[0].tabOrder=[r.id],m.mruOrder=[],L(),ae(r.id),ie(r);for(let i of t){if(i===r.id)continue;m.tabs.delete(i)}for(let i of o)Hm(i);return r}function Pt(e,t={}){ae(e,t)}function mv(e,t,o){let r=pn(t);if(!r||!m.tabs.has(e))return null;if(r.tabOrder.includes(e)){if(o!==void 0)r.tabOrder=Gt(r,e,o);return r}return Km(e),wh(r,e,o),r}function Hx(e,t,o){let r=m.tabs.get(e);if(!r)return;if(r.id=t,r.documentPath=o,wC(e))kx(e),Fm(t);m.tabs.delete(e),m.tabs.set(t,r);for(let i of m.panes)if(i.tabOrder=i.tabOrder.map((s)=>s===e?t:s),i.activeTabId===e)i.activeTabId=t;m.mruOrder=m.mruOrder.map((i)=>i===e?t:i),L(),Dt(r)}function Y$(e,t){e.registerAll([...ho(t),...bo(t)])}function ho(e){let t=()=>uo()>1;return[{id:"document.nextTab",title:"Next Tab",category:"Document",level:"document",keybinding:["ctrl+tab","mod+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Bt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Bt(-1)}},{args:Ce({path:We('Project-relative path of the file to open, e.g. "pages/about.json" or "components/nav-bar.json". It must exist.')}),id:"document.open",title:"Open Document",category:"Document",level:"project",menus:["palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",aiTool:{description:"Open a project file as the active document; the document tools then operate on it. Use it when the user should SEE the page, or for iterative visual refinement after creating a page or component.",name:"open_document",report:({after:o,args:r})=>{let i=St("document.open",r,"path"),s=h.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Up[o.editor.kind]} editor, which is not an element tree the document tools can edit`;return`"${i}" is the active document, ${a}.`}},run:async(o,r)=>{let i=St("document.open",r,"path");if(await e.openFile(i),![...m.tabs.values()].some((s)=>s.documentPath===i))throw RangeError(`command "document.open" argument "path": "${i}" could not be opened — it does `+"not exist, or no editor claims its format. Problems has the reason.")}},{args:Ce({file:We('Project-relative path of the file to open in the other pane, e.g. "pages/about.json". It must exist.')}),id:"document.openToSide",title:"Open to the Side",category:"Document",level:"project",menus:["context/file","palette"],group:"1_file",when:(o)=>o.project.open,requires:"an open project",undo:"none",run:async(o,r)=>{let i=St("document.openToSide",r,"file"),s=Ql(Gr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(Gm(s)&&s.id!==fi)qm(s.id);throw RangeError(`command "document.openToSide" argument "file": "${i}" could not be opened — it `+"does not exist, or no editor claims its format. Problems has the reason.")}}},{id:"document.reopenClosed",title:"Reopen Closed Document",category:"Document",level:"document",keybinding:"mod+shift+t",menus:["context/tab","palette"],group:"1_file",enablement:()=>m.closedTabs.length>0,requires:"a document closed in this session",run:async()=>{let o=yo();if(o)await e.openFile(o)}},{id:"document.togglePinned",title:"Pin / Unpin Document",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:()=>{let o=m.activeTabId,r=o?m.tabs.get(o):null;if(o&&r)jx(o,!r.pinned)}},{args:Ce({pinned:Lo("True to pin the active document's tab, false to unpin it.")}),id:"document.setPinned",title:"Set Document Pinned",category:"Document",level:"document",menus:["palette"],group:"1_file",when:(o)=>o.document.open,requires:"an open document",run:(o,r)=>{let i=m.activeTabId;if(i&&m.tabs.get(i))jx(i,Hi("document.setPinned",r,"pinned"))}},{id:"document.keepOpen",title:"Keep Document Open",category:"Document",level:"document",menus:["context/tab","palette"],group:"1_file",when:(o)=>o.document.open,enablement:()=>{let o=m.activeTabId;return o!==null&&m.tabs.get(o)?.preview===!0},requires:"a preview document — one opened by a single click",run:()=>{let o=m.activeTabId;if(o)Xc(o)}}]}function bo(e){let t=()=>m.panes.length>1;return[{id:"pane.splitRight",title:"Split Right",category:"View",level:"document",keybinding:"mod+\\",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:()=>{EC()}},{args:Ce({path:We("Project-relative path of the document to open beside this one.")}),id:"pane.compareWith",title:"Compare With…",category:"View",level:"document",menus:["context/pane","context/tab","palette"],group:"5_pane",when:(o)=>o.document.open,enablement:()=>m.activeTabId!==null,requires:"an open document",undo:"none",run:async(o,r)=>{let i=St("pane.compareWith",r,"path"),s=Gr();if((s.activeTabId?m.tabs.get(s.activeTabId):null)?.documentPath===i)throw RangeError(`command "pane.compareWith" argument "path": "${i}" is the document this pane is `+"already showing — name a different one");await e.openFileInPane(Ql(s.id).id,i)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{kr(fi)}},{id:"pane.focusSecondary",title:"Focus Side Pane",category:"View",level:"document",keybinding:"mod+alt+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{kr(Vm)}},{id:"pane.unsplit",title:"Close Side Pane",category:"View",level:"document",menus:["context/pane","palette"],group:"5_pane",enablement:t,requires:"a second pane",undo:"none",run:xo}]}function xo(){let e=m.panes.find((t)=>t.derived!==null);if(e?.id===fi){if(e.derived=null,!Gm(e))return}qm(e?.id??Vm)}
|
|
2
|
+
export{bC,Pn,yx,iv,Wt,ln,go,wx,ov,Yc,dO,vC,Wp,xx,A$,fh,_x,Vp,Ia,dl,rv,Up,Qs,uO,Sx,mh,Cx,sv,yC,hO,Fm,kx,wC,O$,av,Fn,Ur,Ex,gh,Tx,pO,Lx,M$,jm,fO,an,lv,xC,P$,mO,Hm,Tn,cv,F$,dv,uv,Oe,gO,$x,Ra,Ix,bO,vO,Bm,yO,wO,xO,_O,hv,j$,SO,H$,B$,St,ti,Rx,Hi,Vn,_C,CO,z$,Ce,pi,ul,W$,Lo,Dx,kO,We,EO,TO,Bi,Vd,Un,Zc,Nx,Ax,SC,LO,Da,bh,vh,pv,Ox,$O,ir,Y,Ud,IO,RO,V$,DO,fv,NO,AO,CC,OO,or,yh,U$,zm,Mx,MO,qp,Qe,Wm,Cr,PO,Px,FO,Fx,jO,HO,qd,BO,qr,zO,Gp,WO,VO,UO,Gd,qO,GO,KO,JO,YO,kC,ZO,fi,Vm,q$,m,h,Gr,pn,Na,kr,Um,EC,TC,Ql,qm,Gm,LC,$C,IC,Km,wh,ec,Kp,Kd,RC,_i,Xc,DC,jx,G$,Jd,K$,J$,Pt,mv,Hx,Y$};
|
|
3
|
+
|
|
4
|
+
//# debugId=623CA1FAFE36CF0264756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-k2sz13zg.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{_x,Ia,dl,m,_i,Pt}from"./studio-k2sz13zg.js";import{fS,_w,RT}from"./studio-ea5m9kg5.js";import{Qk,eE,nD}from"./studio-jeraxdgv.js";import{o_,r_,_k}from"./studio-6cwj6xrx.js";import{Uk,qk,UR}from"./studio-nm4szey4.js";var n={children:[],tagName:"div"},A2=new Set(Object.values(_x));function n_(e){return A2.has(e)}function bk(e){let r=Ia(e),o=m.tabs.get(r);if(o)return Pt(r),o;return _i({capabilities:{modes:[_x[e]]},document:structuredClone(n),documentPath:null,id:r})}function vk(e,r){_i({background:!0,capabilities:{modes:[_x[e]]},document:structuredClone(n),documentPath:null,id:Ia(e),paneId:r})}function i_(e,r){let o=dl(r.id);if(o==="media")return fS(e,r);if(o==="content")return Qk(e,r);if(o==="settings")return Uk(e,r);return o_(e,r)}function Bg(e){_w(e),eE(e),r_(e),qk(e)}function yk(e,r){let{paneId:o}=e;if(i_(o,r))return;Bg(o);let t=dl(r.id);if(t==="media"){RT(e,r);return}if(t==="content"){nD(e,r);return}if(t==="settings"){UR(e,r);return}_k(e,r)}
|
|
2
|
+
export{A2,n_,bk,vk,i_,Bg,yk};
|
|
3
|
+
|
|
4
|
+
//# debugId=3599BF3258AEC1FC64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-k3m4jkdk.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var s=new Set(["project.schema.json","document.schema.json"]);function
|
|
2
|
-
export{
|
|
1
|
+
var s=new Set(["project.schema.json","document.schema.json"]);function hI(e){return s.has(e)?`file:///.jx/generated/${e}`:`file:///${e}`}function fM(e,r){return{head:`file:///.jx/diff/${e}/head/${r}`,work:`file:///.jx/diff/${e}/work/${r}`}}function mM(e){switch(e.slice(e.lastIndexOf(".")+1).toLowerCase()){case"cjs":case"js":case"mjs":return"javascript";case"css":return"css";case"htm":case"html":return"html";case"json":return"json";case"md":return"markdown";case"cts":case"mts":case"ts":return"typescript";case"yaml":case"yml":return"yaml";default:return"plaintext"}}
|
|
2
|
+
export{hI,fM,mM};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=48ABDCD1004FF54A64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-kg1abnz0.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var tS="__other__";function as(n){return n.trim().toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d-]/g,"")}function
|
|
2
|
-
export{tS,as,
|
|
1
|
+
var tS="__other__";function as(n){return n.trim().toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d-]/g,"")}function ZE(n){let e=n.lastIndexOf(".");return e>0?n.slice(e):""}function XE(n,e,i){let t=n.trim();if(i===void 0||e==="__other__")return t;if(i.kind==="fixed"){let o=as(t);return o===""?"":`${o}${i.ext}`}return t.toLowerCase().endsWith(e.toLowerCase())?t:`${t}${e}`}function gb(n,e,i){let{choice:t,dir:o,known:l=new Set,rows:f=null,taken:u}=i,a=n.trim();if(!a)return t?.kind==="fixed"?"Enter a name.":"Enter a file name.";if(t?.kind==="fixed"&&as(a)==="")return"Enter at least one letter or number.";let s=a.replaceAll("\\","/");if(s.startsWith("/")||s.endsWith("/"))return"Enter a name, not a path that starts or ends with a slash.";if(s.split("/").includes(".."))return"A name cannot step outside the destination folder.";if(s.includes("/")&&t!==void 0&&e!=="__other__")return`Pick Other… to create a file in a subfolder of ${o==="."?"the project root":o}.`;let r=ZE(s);if(e!==""&&e!=="__other__"&&r!==""&&r.toLowerCase()!==e.toLowerCase()&&l.has(r.toLowerCase()))return`You picked ${f?.find((g)=>g.value===e)?.label??e}; this name ends in ${r}.`;if(t?.kind==="locked"&&e==="__other__"){if(r!==""&&r.toLowerCase()!==t.ext.toLowerCase()&&l.has(r.toLowerCase()))return t.because}let d=XE(n,e,t);return u.has(d.toLowerCase())?`${d} already exists in ${o}/.`:""}
|
|
2
|
+
export{tS,as,ZE,XE,gb};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=EAD3F8EADE61306E64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-kg5ya5r2.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{Un,m,Pt}from"./studio-k2sz13zg.js";import{ID}from"./studio-cg1bfyhf.js";import{Zu}from"./studio-rtfnhrdg.js";import{le}from"./studio-j3d2fjqz.js";var e="edit",a=new Set(["edit","design"]);function r(t){for(let i of m.tabs.values())if(i.documentPath===t)return i;return null}async function jl(t){if(!Zu(t)){let o=Un(t);if(o&&!o.fileBacked)return ID(t);let{openFileInTab:s}=await (le("b2tcppdd"),import("./files-b2tcppdd.js"));return await s(t),r(t)}let{openFileInTab:i}=await (le("b2tcppdd"),import("./files-b2tcppdd.js"));await i(t);let n=r(t);if(!n)return null;if(!a.has(n.session.ui.canvasMode)&&n.capabilities.modes.includes(e))n.session.ui.canvasMode=e,n.session.ui.preview=!1;return Pt(n.id),n}
|
|
2
|
+
export{jl};
|
|
3
|
+
|
|
4
|
+
//# debugId=FBE616D1FC85E80864756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-khwbgrtg.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{p,_e}from"./studio-jws1a87n.js";import{Q}from"./studio-nqxqf8p2.js";import{ee}from"./studio-8z66jk4z.js";function hh(){return _e()&&ee(p().findReferences)}function u(e){return`${e.path??""}\x00${e.tagName??""}`}var i=new Map,o=new Map;function zd(e){if(!hh())return{status:"unsupported"};return i.get(u(e))??(o.has(u(e))?{status:"pending"}:null)}async function $a(e){if(!hh())return{status:"unsupported"};if(!e.path&&!e.tagName)return{status:"failed",message:"no target to look for"};let t=u(e),s=i.get(t);if(s)return s;let r=o.get(t);if(r)return r;let n={};if(e.path!==void 0)n.path=e.path;if(e.tagName!==void 0)n.tagName=e.tagName;let a=(async()=>{try{return{result:await p().findReferences(n),status:"ready"}}catch(c){return{message:Q(c),status:"failed"}}})();o.set(t,a);let d=f,l=await a;if(o.get(t)===a)o.delete(t);if(d!==f)return l;return i.set(t,l),l}function $$(e){return i.delete(u(e)),$a(e)}var f=0,g=new Set;function Sr(){f+=1,i.clear(),o.clear();for(let e of g)e()}function I$(e){return g.add(e),()=>{g.delete(e)}}function h(e){let t=0;for(let s of e.files)if(s.path.startsWith("pages/"))t+=1;return{others:e.files.length-t,pages:t}}function tv(e){let{others:t,pages:s}=h(e);if(s===0&&t===0)return"Not used yet";let r=t===1?"file":"files";if(s===0)return`Used in ${t} ${r}`;let n=`Used on ${s} page${s===1?"":"s"}`;return t===0?n:`${n} and ${t} other ${r}`}function R$(e,t){if(e.status==="unsupported")return null;if(e.status==="pending")return"Counting references…";if(e.status==="failed")return`References could not be counted (${e.message}) — this may break more than it appears to.`;let{files:s,refsTotal:r}=e.result;if(s.length===0)return t==="delete"?"Nothing else in this project refers to it.":"Nothing else in this project refers to it, so nothing needs updating.";let n=`${r} reference${r===1?"":"s"} in ${s.length} file${s.length===1?"":"s"}`,a=e.result.errors.length>0?" (at least — some documents could not be read)":"";if(t==="delete")return`${n}${a} will break. Those files stay on disk; the references in them stop resolving.`;if(t==="convert")return`${n}${a} will be updated automatically to point at the new file.`;return`${n}${a} will be updated automatically. Nothing else changes.`}function nv(e){return e.files.toSorted((t,s)=>s.count-t.count||t.path.localeCompare(s.path))}
|
|
2
|
+
export{hh,zd,$a,$$,Sr,I$,tv,R$,nv};
|
|
3
|
+
|
|
4
|
+
//# debugId=664F4791B8608E0364756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-mx6wzh25.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{He}from"./studio-8wnvtr4z.js";import{ee}from"./studio-8z66jk4z.js";var f=3;function p(e,t,n){return Math.min(n,Math.max(t,e))}function eS(e){let t=Math.max(0,Math.trunc(e.count)),n=Math.max(1,Math.trunc(e.columns??1)),o=Math.ceil(t/n);if(!(e.rowHeight>0)||!(e.viewportHeight>0))return{end:t,padBottom:0,padTop:0,start:0,totalRows:o};let r=Math.max(0,Math.trunc(e.overscanRows??f)),i=Math.max(0,e.scrollTop),m=Math.floor(i/e.rowHeight),w=Math.ceil(e.viewportHeight/e.rowHeight)+1,l=p(m-r,0,o),a=p(m+w+r,l,o);return{end:Math.min(t,a*n),padBottom:(o-a)*e.rowHeight,padTop:l*e.rowHeight,start:Math.min(t,l*n),totalRows:o}}function M(e,t){return e.start===t.start&&e.end===t.end&&e.totalRows===t.totalRows&&e.padTop===t.padTop&&e.padBottom===t.padBottom}function R(e){let{scroller:t,list:n,count:o,rowHeight:r,columns:i,onChange:m,overscanRows:w}=e,l={end:0,padBottom:0,padTop:0,start:0,totalRows:0},a=!1;function c(){if(a)return;let d=eS({columns:i?.()??1,count:o(),overscanRows:w??f,rowHeight:r(),scrollTop:n?H(t,n):t.scrollTop,viewportHeight:t.clientHeight}),b=!M(l,d);if(l=d,b)m(d)}t.addEventListener("scroll",c,{passive:!0});let u=0,T=()=>{if(u!==0)return;u=requestAnimationFrame(()=>{u=0,c()})},s=null;if(ee(globalThis.ResizeObserver)){if(s=new ResizeObserver(T),s.observe(t),n)s.observe(n)}return c(),{destroy(){if(a=!0,t.removeEventListener("scroll",c),s?.disconnect(),s=null,u!==0)cancelAnimationFrame(u),u=0},measure:c,range:()=>l}}function v(e){for(let t=e;t;t=t.parentElement){if(t.scrollHeight<=t.clientHeight)continue;let n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t}return null}function g(e){let t=h.get(e);if(t&&t.isConnected&&e.isConnected&&t.contains(e))return t;let n=L(e)??v(e);if(n)h.set(e,n);else h.delete(e);return n}var x="data-jx-scroller";function L(e){return e.isConnected?e.closest(`[${x}]`):null}function H(e,t){if(e===t)return Math.max(0,e.scrollTop);return Math.max(0,He(e).top-He(t).top)}function mw(e,t){let n=e?.isConnected===!0?g(e):null;if(!n||!e){let o=Math.max(0,Math.trunc(t.count));return{end:o,padBottom:0,padTop:0,start:0,totalRows:o}}return eS({columns:t.columns??1,count:t.count,overscanRows:t.overscanRows??f,rowHeight:t.rowHeight,scrollTop:H(n,e),viewportHeight:n.clientHeight})}function W(e){let t=e.listOffset+e.index*e.rowHeight,n=t+e.rowHeight;if(t<e.scrollTop)return Math.max(0,t);if(n>e.scrollTop+e.viewportHeight)return Math.max(0,n-e.viewportHeight);return null}function gw(e,t,n){let o=e?.isConnected===!0?g(e):null;if(!o||!e||t<0||!(n>0))return!1;let{scrollTop:r}=o,i=W({index:t,listOffset:r-H(o,e),rowHeight:n,scrollTop:r,viewportHeight:o.clientHeight});if(i===null)return!1;return o.scrollTop=i,!0}function zD(e,t,n){let o=e?.querySelector(t);return o&&o.offsetHeight>0?o.offsetHeight:n}var h=new WeakMap;function bw(e,t,n){let o=g(t);if(e&&e.list===t&&e.scroller===o)return e;if(e?.window.destroy(),!o)return null;return{list:t,scroller:o,window:R({count:n.count,list:t,onChange:()=>n.onChange(),rowHeight:n.rowHeight,scroller:o})}}
|
|
2
|
+
export{eS,mw,gw,zD,bw};
|
|
3
|
+
|
|
4
|
+
//# debugId=1115D00536CEDE4C64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-mxs3ar9t.js.map
|