@jxsuite/studio 8.0.1 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-5wtzce5g.js → 2020-89fz3pfy.js} +3 -3
- package/dist/chunks/adapter-ay13gema.js +4 -0
- package/dist/chunks/add-new-flow-nmkqpjym.js +4 -0
- package/dist/chunks/cf-account-picker-2e06qxey.js +4 -0
- package/dist/chunks/cf-settings-5y04810c.js +4 -0
- package/dist/chunks/color-04361ttk.js +4 -0
- package/dist/chunks/{color-area-6rbra5dy.js → color-area-h8dbasp1.js} +2 -2
- package/dist/chunks/{color-field-gy56c94g.js → color-field-qv5r2b16.js} +3 -3
- package/dist/chunks/{color-slider-sqqdyf6c.js → color-slider-nz2mrzky.js} +2 -2
- package/dist/chunks/{combobox-72h32ejk.js → combobox-6hs00996.js} +2 -2
- package/dist/chunks/components-3vf75n83.js +4 -0
- package/dist/chunks/content-source-4f2raf4a.js +4 -0
- package/dist/chunks/{convert-to-repeater-he70fc2b.js → convert-to-repeater-j9hfcj4f.js} +3 -3
- package/dist/chunks/editor-645krvtz.js +4 -0
- package/dist/chunks/entry-commands-3qmv8wkr.js +4 -0
- package/dist/chunks/{extension-sections-0egb88dm.js → extension-sections-thfke054.js} +3 -3
- package/dist/chunks/file-ops-kkhp9ma7.js +4 -0
- package/dist/chunks/files-yswdhxrf.js +4 -0
- package/dist/chunks/format-host-4g8ex6bz.js +4 -0
- package/dist/chunks/fs-events-z9gpvc6t.js +4 -0
- package/dist/chunks/grid-open-fm4j183c.js +4 -0
- package/dist/chunks/{grid-view-qg1b5eqx.js → grid-view-7d2nx83y.js} +16 -15
- package/dist/chunks/{icons-63bjtbs7.js → icons-853n6qt3.js} +2 -2
- package/dist/chunks/{iframe-entry-pkgmcgp0.js → iframe-entry-2x9bn5ng.js} +4 -4
- package/dist/chunks/{iframe-entry-99nr5zfb.js → iframe-entry-42hpmwz5.js} +4 -4
- package/dist/chunks/{iframe-entry-76j8vwwx.js → iframe-entry-b5qgggyp.js} +2 -2
- package/dist/chunks/{iframe-entry-2zggzajv.js → iframe-entry-btck0e9s.js} +4 -4
- package/dist/chunks/iframe-host-q7fedsmr.js +4 -0
- package/dist/chunks/{index-32eqzv1k.js → index-jxmt7vh8.js} +3 -3
- package/dist/chunks/index-pt4wh98x.js +4 -0
- package/dist/chunks/{javascript-pjp734q4.js → javascript-vmqp56ke.js} +2 -2
- package/dist/chunks/{jsonMode-njkvsa02.js → jsonMode-n3wmpant.js} +5 -5
- package/dist/chunks/jx-validate-19y62knt.js +4 -0
- package/dist/chunks/layers-panel-1qvc83y9.js +4 -0
- package/dist/chunks/layers-qf0bc7ze.js +4 -0
- package/dist/chunks/{listbox-c421cf8c.js → listbox-7gka1h86.js} +2 -2
- package/dist/chunks/lit-html-wyqw04y2.js +4 -0
- package/dist/chunks/media-library-f9d5qcjb.js +4 -0
- package/dist/chunks/media-picker-rsb1fmk2.js +4 -0
- package/dist/chunks/{menu-bdpzbfvs.js → menu-d2jxpgma.js} +2 -2
- package/dist/chunks/{monaco-binding-vq1hgnn0.js → monaco-binding-wfhmz89d.js} +3 -3
- package/dist/chunks/monaco-buffer-ak0raadw.js +4 -0
- package/dist/chunks/{monaco-setup-xrd2cbkp.js → monaco-setup-fty7a8vg.js} +3 -3
- package/dist/chunks/notify-4qj70q0x.js +4 -0
- package/dist/chunks/parse-n8dfxnqf.js +4 -0
- package/dist/chunks/platform-ehg6t9vd.js +4 -0
- package/dist/chunks/{popover-b89sfej7.js → popover-9tf4cjrk.js} +2 -2
- package/dist/chunks/publish-panel-yhmda3cd.js +4 -0
- package/dist/chunks/{publish-quick-qx2455cj.js → publish-quick-12hh8926.js} +3 -3
- package/dist/chunks/publish-workspace-hx8qdv9p.js +4 -0
- package/dist/chunks/quick-search-r955m3q1.js +4 -0
- package/dist/chunks/references-8gxv0x7t.js +4 -0
- package/dist/chunks/right-panel-jarwqjpy.js +4 -0
- package/dist/chunks/source-control-84qt25m9.js +4 -0
- package/dist/chunks/{split-c9zfdgxf.js → split-m5rwn31z.js} +2 -2
- package/dist/chunks/studio-0nefxhar.js +7 -0
- package/dist/chunks/studio-0rg30pvs.js +5 -0
- package/dist/chunks/{studio-s32578pn.js → studio-14hh60j8.js} +4 -4
- package/dist/chunks/studio-1cfyd1ys.js +5 -0
- package/dist/chunks/studio-2bq7hheq.js +5 -0
- package/dist/chunks/{studio-zz9qe3rw.js → studio-32d8wyxq.js} +37 -37
- package/dist/chunks/studio-3hpcawh8.js +4 -0
- package/dist/chunks/{studio-svb7yyve.js → studio-4j35hgsw.js} +4 -4
- package/dist/chunks/{studio-x1x167jh.js → studio-4qg61g9j.js} +4 -4
- package/dist/chunks/studio-4rgem12q.js +5 -0
- package/dist/chunks/studio-6k9djnxw.js +5 -0
- package/dist/chunks/studio-6rbaedw2.js +9 -0
- package/dist/chunks/studio-732mw0g8.js +5 -0
- package/dist/chunks/studio-79r8msnr.js +7 -0
- package/dist/chunks/studio-7q6jdd4h.js +5 -0
- package/dist/chunks/{studio-r5qy30vx.js → studio-8hf8qcm1.js} +4 -4
- package/dist/chunks/{studio-8tr6cfrc.js → studio-8pne0rx4.js} +4 -4
- package/dist/chunks/{studio-y0n7yxea.js → studio-9179bsm7.js} +7 -7
- package/dist/chunks/{studio-pbxa5fpc.js → studio-9ff0vqff.js} +3 -3
- package/dist/chunks/studio-9gzvypw4.js +5 -0
- package/dist/chunks/studio-9ndgd55w.js +5 -0
- package/dist/chunks/studio-9ra9e7m4.js +5 -0
- package/dist/chunks/studio-a6e5fzve.js +5 -0
- package/dist/chunks/studio-a9k86nq6.js +5 -0
- package/dist/chunks/studio-ae7a69jc.js +6 -0
- package/dist/chunks/studio-aghsg0ds.js +7 -0
- package/dist/chunks/{studio-k3xxbagr.js → studio-ajw4k8hp.js} +3 -3
- package/dist/chunks/{studio-qmn1xc24.js → studio-apapy17g.js} +4 -4
- package/dist/chunks/{studio-8m0y2qe7.js → studio-by8x0jvc.js} +4 -4
- package/dist/chunks/{studio-wbcjbhy1.js → studio-c88gq88j.js} +5 -5
- package/dist/chunks/{studio-n0c5h6mf.js → studio-cg54vtet.js} +4 -4
- package/dist/chunks/studio-dvhxxxbd.js +5 -0
- package/dist/chunks/{studio-3q40e3rj.js → studio-e4rq6x0q.js} +4 -4
- package/dist/chunks/{studio-fbhxxc5f.js → studio-ekzbgnjp.js} +4 -4
- package/dist/chunks/studio-fg4fj9ec.js +10 -0
- package/dist/chunks/studio-fj6jzgxw.js +5 -0
- package/dist/chunks/{studio-nh6d342n.js → studio-g45r5vm8.js} +7 -7
- package/dist/chunks/{studio-a2bvaptz.js → studio-gczve8zf.js} +4 -4
- package/dist/chunks/studio-ge08zwpv.js +5 -0
- package/dist/chunks/studio-gk9yk8dj.js +12 -0
- package/dist/chunks/{studio-bbe4c90a.js → studio-gskkgfe3.js} +4 -4
- package/dist/chunks/{studio-83mk4bgg.js → studio-h4jbgne2.js} +8 -8
- package/dist/chunks/{studio-b7y5mr30.js → studio-hcy9zeac.js} +4 -4
- package/dist/chunks/studio-ht81xjkr.js +5 -0
- package/dist/chunks/{studio-jaaz8ce9.js → studio-jr30g4ae.js} +4 -4
- package/dist/chunks/{studio-qgh13jtz.js → studio-k5n4es74.js} +4 -4
- package/dist/chunks/{studio-ccv2svc6.js → studio-k6hbx2fc.js} +4 -4
- package/dist/chunks/{studio-9tmebf0s.js → studio-kqh7fxn6.js} +4 -4
- package/dist/chunks/{studio-q0mvbaq6.js → studio-kyw47pet.js} +4 -4
- package/dist/chunks/studio-mkw17ngg.js +5 -0
- package/dist/chunks/{studio-x9hsze61.js → studio-myb4mf0h.js} +4 -4
- package/dist/chunks/studio-n4qq1n57.js +5 -0
- package/dist/chunks/studio-nfmpmkqb.js +5 -0
- package/dist/chunks/studio-nfwacw31.js +5 -0
- package/dist/chunks/{studio-rthyg42z.js → studio-nm86874b.js} +172 -172
- package/dist/chunks/studio-nqexty8x.js +16 -0
- package/dist/chunks/studio-nr0kcqc6.js +5 -0
- package/dist/chunks/{studio-jsgf2q5k.js → studio-nvfa137z.js} +5 -5
- package/dist/chunks/studio-psh8mwnw.js +4 -0
- package/dist/chunks/studio-qd0cycm4.js +9 -0
- package/dist/chunks/{studio-tfkznv39.js → studio-qevf5z9d.js} +4 -4
- package/dist/chunks/studio-qs5fmhtj.js +14 -0
- package/dist/chunks/studio-ry4789ng.js +7 -0
- package/dist/chunks/studio-s4fq9jht.js +5 -0
- package/dist/chunks/studio-sc35ttdk.js +5 -0
- package/dist/chunks/studio-sm2f0sc6.js +6 -0
- package/dist/chunks/{studio-3qeh9t0h.js → studio-spza69tb.js} +5 -5
- package/dist/chunks/studio-t6dqnnft.js +5 -0
- package/dist/chunks/{studio-43sd2mam.js → studio-tfmhnwyr.js} +3 -3
- package/dist/chunks/studio-tn7v8gey.js +6 -0
- package/dist/chunks/{studio-tft6r105.js → studio-trcfer2b.js} +4 -4
- package/dist/chunks/studio-tyw7tk0x.js +5 -0
- package/dist/chunks/{studio-jcnsdaep.js → studio-tyzgte21.js} +4 -4
- package/dist/chunks/studio-vtey9w98.js +5 -0
- package/dist/chunks/studio-ws2r1d7e.js +5 -0
- package/dist/chunks/studio-x2trkhk5.js +5 -0
- package/dist/chunks/{studio-mn0476ag.js → studio-xzgp0cp7.js} +4 -4
- package/dist/chunks/studio-y47090vq.js +5 -0
- package/dist/chunks/{studio-5g0rprdt.js → studio-yjh9gddd.js} +5 -5
- package/dist/chunks/studio-ywf9y1e2.js +5 -0
- package/dist/chunks/{studio-k7evxqh4.js → studio-z1p91z5a.js} +4 -4
- package/dist/chunks/studio-ztppbam0.js +5 -0
- package/dist/chunks/{toast-host-1yg5ar8d.js → toast-host-g3r2s0kn.js} +2 -2
- package/dist/chunks/toast-w11qpkyz.js +4 -0
- package/dist/chunks/{tooltip-yypz28gq.js → tooltip-dj1pvgz7.js} +2 -2
- package/dist/chunks/{tree-9xa4hm7n.js → tree-j0ebwr5s.js} +2 -2
- package/dist/chunks/{tsMode-epyfz1hv.js → tsMode-byje4a01.js} +5 -5
- package/dist/chunks/workspace-7q4arnt3.js +4 -0
- package/dist/chunks/workspace-home-ge027kr6.js +4 -0
- package/dist/chunks/{ws-client-bv552sfx.js → ws-client-h09h6sqg.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +76 -76
- package/dist/studio.js +88 -88
- package/package.json +15 -16
- package/src/browse/component-examples.ts +15 -224
- package/src/browse/library-preview.ts +6 -13
- package/src/browse/preview-root.ts +7 -4
- package/src/canvas/canvas-utils.ts +18 -4
- package/src/canvas/iframe-editable-root.ts +13 -4
- package/src/canvas/iframe-entry.ts +3 -1
- package/src/canvas/iframe-interaction.ts +11 -2
- package/src/canvas/iframe-render.ts +25 -3
- package/src/canvas/preview-placeholder.ts +120 -0
- package/src/collab/collab-session.ts +6 -2
- package/src/commands/context.ts +4 -0
- package/src/commands/defaults.ts +2 -0
- package/src/commands/live-context.ts +2 -0
- package/src/editor/shortcuts.ts +3 -0
- package/src/files/files.ts +6 -3
- package/src/new-project/new-project-modal.ts +1 -4
- package/src/panels/ai-panel.ts +27 -34
- package/src/panels/component-preview.ts +5 -0
- package/src/panels/pane-context.ts +43 -18
- package/src/panels/site-model.ts +7 -19
- package/src/panels/site-panel.ts +2 -25
- package/src/panels/stylebook-doc.ts +2 -53
- package/src/platform.ts +20 -0
- package/src/platforms/devserver.ts +2 -120
- package/src/services/ai-ask.ts +29 -171
- package/src/services/ai-command-tools.ts +40 -50
- package/src/services/ai-import-tools.ts +4 -5
- package/src/services/ai-project-tools.ts +13 -3
- package/src/services/ai-tools.ts +26 -564
- package/src/services/ai-writes.ts +84 -2
- package/src/services/document-assistant.ts +29 -58
- package/src/services/harness/assistant-tools.ts +68 -0
- package/src/services/harness/interaction-store.ts +118 -0
- package/src/services/harness/studio-documents.ts +105 -0
- package/src/services/harness/turn-hooks.ts +1 -6
- package/src/services/project-adoption.ts +8 -16
- package/src/services/references.ts +0 -0
- package/src/services/tool-executor.ts +25 -22
- package/src/state.ts +3 -13
- package/src/style/stylebook-specimens.ts +11 -15
- package/src/surfaces/files-panel.json +12 -0
- package/src/surfaces/files-panel.ts +5 -2
- package/src/surfaces/pane-context.json +286 -265
- package/src/surfaces/pane-context.ts +17 -8
- package/src/surfaces/welcome.ts +4 -1
- package/src/tabs/selection.ts +14 -109
- package/src/tabs/tab.ts +15 -7
- package/src/tabs/transact.ts +316 -124
- package/src/types.ts +13 -8
- package/src/utils/geometry.ts +49 -2
- package/dist/chunks/adapter-5tphg7xe.js +0 -4
- package/dist/chunks/add-new-flow-psym14sn.js +0 -4
- package/dist/chunks/cf-account-picker-haqazq5r.js +0 -4
- package/dist/chunks/cf-settings-h2wrh6hq.js +0 -4
- package/dist/chunks/color-m7r1vk54.js +0 -4
- package/dist/chunks/components-r22xca09.js +0 -4
- package/dist/chunks/content-source-mmppmcyg.js +0 -4
- package/dist/chunks/editor-ccd9jwsa.js +0 -4
- package/dist/chunks/entry-commands-6qxz9e8p.js +0 -4
- package/dist/chunks/file-ops-qnab36ek.js +0 -4
- package/dist/chunks/files-rcn56qvm.js +0 -4
- package/dist/chunks/format-host-yxz0kjjs.js +0 -4
- package/dist/chunks/fs-events-d1qxq4z4.js +0 -4
- package/dist/chunks/grid-open-4z1g062t.js +0 -4
- package/dist/chunks/iframe-host-ssv7kyj0.js +0 -4
- package/dist/chunks/index-f0jn7nnp.js +0 -4
- package/dist/chunks/jx-validate-ttasrbh7.js +0 -4
- package/dist/chunks/layers-bgyr11tr.js +0 -4
- package/dist/chunks/layers-panel-7ez66zeq.js +0 -4
- package/dist/chunks/lit-html-v9gh687x.js +0 -4
- package/dist/chunks/media-library-sq468wts.js +0 -4
- package/dist/chunks/media-picker-shfe59pt.js +0 -4
- package/dist/chunks/monaco-buffer-3afgwvbp.js +0 -4
- package/dist/chunks/notify-kzrjr3fv.js +0 -4
- package/dist/chunks/parse-v77xtwv7.js +0 -4
- package/dist/chunks/platform-7v4rtd7m.js +0 -4
- package/dist/chunks/publish-panel-2z9gw8ee.js +0 -4
- package/dist/chunks/publish-workspace-wrc1dgwx.js +0 -4
- package/dist/chunks/quick-search-n0t0eqxb.js +0 -4
- package/dist/chunks/references-9547rg5s.js +0 -4
- package/dist/chunks/right-panel-wsgnr9pn.js +0 -4
- package/dist/chunks/source-control-kwktr9y6.js +0 -4
- package/dist/chunks/studio-03ct6yfv.js +0 -9
- package/dist/chunks/studio-07rcfje3.js +0 -5
- package/dist/chunks/studio-3e54qh39.js +0 -7
- package/dist/chunks/studio-3exxhz5g.js +0 -5
- package/dist/chunks/studio-3qqjeep5.js +0 -6
- package/dist/chunks/studio-4hp8pkyt.js +0 -5
- package/dist/chunks/studio-58xg6j2q.js +0 -9
- package/dist/chunks/studio-6m380wp7.js +0 -5
- package/dist/chunks/studio-80jyh1xh.js +0 -4
- package/dist/chunks/studio-8vcvfs7r.js +0 -6
- package/dist/chunks/studio-bavb31r0.js +0 -5
- package/dist/chunks/studio-c05wdnt3.js +0 -5
- package/dist/chunks/studio-d5grtb9e.js +0 -16
- package/dist/chunks/studio-df0baea9.js +0 -5
- package/dist/chunks/studio-dgk4dqtx.js +0 -7
- package/dist/chunks/studio-e1g64q43.js +0 -5
- package/dist/chunks/studio-ed1hp6zf.js +0 -6
- package/dist/chunks/studio-ed3xx40h.js +0 -7
- package/dist/chunks/studio-f14e1zdj.js +0 -5
- package/dist/chunks/studio-fyh0jc96.js +0 -5
- package/dist/chunks/studio-gcxk20n7.js +0 -5
- package/dist/chunks/studio-kt3pjkwd.js +0 -5
- package/dist/chunks/studio-m8g16bgz.js +0 -5
- package/dist/chunks/studio-mx1smyq0.js +0 -5
- package/dist/chunks/studio-nqxqf8p2.js +0 -4
- package/dist/chunks/studio-p4nrkvqr.js +0 -5
- package/dist/chunks/studio-pgmvdv7z.js +0 -7
- package/dist/chunks/studio-ph84avkf.js +0 -5
- package/dist/chunks/studio-q0tccd43.js +0 -5
- package/dist/chunks/studio-q7rtx6zq.js +0 -14
- package/dist/chunks/studio-qwdqwkj0.js +0 -5
- package/dist/chunks/studio-rj9eamf8.js +0 -5
- package/dist/chunks/studio-rptgsk96.js +0 -5
- package/dist/chunks/studio-s19tp1xr.js +0 -5
- package/dist/chunks/studio-syreb644.js +0 -5
- package/dist/chunks/studio-tf9jryb1.js +0 -10
- package/dist/chunks/studio-txf2kysx.js +0 -5
- package/dist/chunks/studio-v8867ddv.js +0 -12
- package/dist/chunks/studio-vxq7fcvv.js +0 -5
- package/dist/chunks/studio-w4rz9hdk.js +0 -5
- package/dist/chunks/studio-wc649wss.js +0 -5
- package/dist/chunks/studio-wys23mxz.js +0 -5
- package/dist/chunks/studio-y3ahhdpx.js +0 -5
- package/dist/chunks/studio-z97c48fk.js +0 -5
- package/dist/chunks/studio-zat62m0c.js +0 -5
- package/dist/chunks/studio-zcd2e7yz.js +0 -5
- package/dist/chunks/toast-1gv0h53h.js +0 -4
- package/dist/chunks/workspace-dz7nxfhv.js +0 -4
- package/dist/chunks/workspace-home-xsd7hkjw.js +0 -4
- package/src/services/directory-picker.ts +0 -187
- package/src/services/gated-registry.ts +0 -77
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{ge,Qs,ne,g,de,Eh,C}from"./studio-tfmhnwyr.js";import{Yd}from"./studio-4rgem12q.js";import{p}from"./studio-9ndgd55w.js";import{Wi,fn,lr}from"./studio-a6e5fzve.js";import{tI,OC,Lo,ZO,Wx,nI,iI,eM,yv}from"./studio-8pne0rx4.js";import{vv,J$,Er,S}from"./studio-9ra9e7m4.js";import{Se,oe,Tv,Lv,FC,sf,jC,ta,af,Jm,Gx}from"./studio-nfwacw31.js";import{n,Z,Ze,_,v,Go,Di,ed,cf}from"./studio-ywf9y1e2.js";import{le}from"./studio-k5n4es74.js";var we=g(new Set);function Om(e){we.add(e)}function kx(e){we.delete(e)}function wC(e){return we.has(e)}var R$=()=>({kind:"proceed"});function sv(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:d,execute:b}){let f={name:e,description:t,parameters:o,strict:r,llmStrict:i,execute:b};if(s!==void 0)f.interactive=s;if(a!==void 0)f.title=a;if(l!==void 0)f.annotations=l;if(c!==void 0)f.interaction=c;if(d!==void 0)f.settle=d;return f}function Ex(e){let t=[];return{record(o){t.push(o),e?.(o)},writes:t}}function mh(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 zt=new AbortController().signal;function Tx(e={}){let t=e.session??mh();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??zt}}function iO(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,d]of Object.entries(o)){let b=a[c];if(!b)continue;let f=b.type;if(!f)continue;let x=Ge(d);if(f==="number"||f==="integer"){if(Re(d,"number"))continue;if(Re(d,"string")){if(!Number.isNaN(Number(d)))continue;s.push(`Argument "${c}" should be a number, got non-numeric string "${d}"`);continue}s.push(`Argument "${c}" should be a number, got ${x}`);continue}if(f==="string"&&x!=="string")s.push(`Argument "${c}" should be a string, got ${x}`);else if(f==="boolean"&&x!=="boolean")s.push(`Argument "${c}" should be a boolean, got ${x}`);else if(f==="array"&&x!=="array")s.push(`Argument "${c}" should be an array, got ${x}`);else if(f==="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 Yt="The author declined this call.";function Zt(e){return JSON.parse(JSON.stringify(e))}function me(e){return e.message}var Xt=["string","number","boolean","undefined"];function Re(e,t){return typeof e===t}function Qt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ge(e){if(Array.isArray(e))return"array";return Xt.find((t)=>Re(e,t))??"object"}function en(e){if(!e)return{};let t=JSON.parse(e);if(!Qt(t)){let o=t===null?"null":Ge(t);throw TypeError(`arguments must be a JSON object, got ${o}`)}return t}async function D$(e,t,o,{approval:r=R$,response:i}={}){let s=!1,a;try{let l=en(t.argumentsText),c=e.getDefinition(t.name),d=c?tn(e,c,l,r,i):null;if(d?.status==="needs_input")return d;if(d)({result:a}=d);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:Zt(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 tn(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:nn(t.name,a,o,i),executed:!1};let d=s(o);return"refusal"in d?pe(d.refusal):{status:"needs_input",request:d}}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(Yt)}return null}function pe(e){return{status:"done",result:Fn(e),executed:!1}}function nn(e,t,o,r){try{return t(o,r)}catch(i){return Fn(`Tool "${e}" execution error: ${me(i)}`)}}var on=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 ev(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&&on.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 rn="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:rn;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 tv(e,t){let o=q(e),r=Ae(o,t);return r===-1?o.join("/"):o.filter((i,s)=>s!==r).join("/")}function Kc(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?sn(i):s;if(a===-1)return null;let l=s===-1?i:i.filter((c,d)=>d!==s);if(r===o.defaultLocale&&o.routing==="prefix-except-default")return l.join("/");return l.toSpliced(a,0,r.toLowerCase()).join("/")}function 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 sn(e){if(e[0]==="pages"&&e.length>1)return 1;if(e[0]==="content"&&e.length>2)return 2;return-1}function eO(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 A$(e,t){if(!n(t)||t==="")return e;let o=e.indexOf("#"),r=o===-1?"":e.slice(o),i=o===-1?e:e.slice(0,o),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),c=(s===-1?[]:i.slice(s+1).split("&")).filter((d)=>d!==""&&!cn(d));return c.push(`v=${encodeURIComponent(t)}`),`${a}?${c.join("&")}${r}`}function cn(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 un(e,t){if(!e||!Object.hasOwn(e,t))return;let o=e[t];return n(o)?o:void 0}function cv(e,t,o=[]){if(!e||!t)return null;let r=e.replaceAll("\\","/").replace(/^\.\//,""),i=null,s=(a,l)=>{if(r.startsWith(`${a}/`)&&(!i||a.length>i.dir.length))i={dir:a,urlPrefix:l}};for(let[a,l]of Object.entries(t)){if(!l?.source||!OC.test(a))continue;let c=mn(l.source);if(c===""||c.startsWith(".."))continue;if(c.includes(Lo)){let d=dn(r,c,a,o);if(d)s(d.dir,d.urlPrefix);continue}if(/\.[a-z0-9]+$/i.test(c))continue;s(c,`/${tI}/${a}`)}return i}function dn(e,t,o,r){let i=t.indexOf(Lo),s=t.slice(0,i),a=t.slice(i+Lo.length);if(!e.startsWith(s))return null;let l=e.slice(s.length).split("/")[0]??"";if(l===""||!OC.test(l))return null;let c=r.find((b)=>b.toLowerCase()===l.toLowerCase());if(c===void 0||!OC.test(c))return null;return{dir:`${s}${l}${a}`.replace(/\/+$/,""),urlPrefix:`/${tI}/${o}/${c}`}}function mn(e){return e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}function dv(e,t){if(!t||e==="")return null;if(t.space==="repo"){if(!t.fileBaseUrl)return null;let r=eM(e,t.documentDir,t.mounts,t.lanes);if(r===null)return null;let{suffix:i}=Wx(e);return A$(`${t.fileBaseUrl}${yv(r)}${i}`,un(t.versions,r))}let[o]=t.mounts;return o?gn(e,t.documentDir,o):null}function gn(e,t,o){if(nI(e))return null;let{path:r,suffix:i}=Wx(e),s;try{s=decodeURIComponent(r)}catch{return null}let a=iI(t,s);if(a===null)return null;let l=ZO([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 yn(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(Lo).map((i)=>ze(i)).join(o);return new RegExp(`^${r}(?:/|$)`,"i")}function hn(e,t,o){let r=bn(e,o).exec(t);if(!r)return null;return r[0].replace(/\/$/,"")}function xn(e){return G(e).replaceAll(Lo,"").length}function Wd(e,t){if(e===null||e===void 0||e==="")return null;let o=Ye(t),r=yn(o),i=G(e),s=null,a=-1;for(let[l,c]of Object.entries(Xe(o))){let{source:d}=c;if(d===void 0||d===""||et(d))continue;let b=xn(d);if(b<=a)continue;let f=hn(d,i,r);if(f===null)continue;s={def:c,dir:i,fileBacked:!1,isSourceRoot:i.length===f.length,name:l,...tt(c)},a=b}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 Wd(r.includes("/")?r.slice(0,r.lastIndexOf("/")):".",o)}function Jc(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||Jc(t)}function vO(e,t){if(e?.$label)return e.$label;if(t.includes("-"))return t.replaceAll(/(^|-)(\w)/g,(o,r,i)=>(r?" ":"")+i.toUpperCase());return Jc(t)}function Ia(e){return e==="image"||e==="uri-reference"}function gh(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(Ia(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 bh(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 hv(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 yO(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 sO(e){return e?.[0]??null}function $x(e,t){if(!t||!e)return!1;return e.some((o)=>Er(o,t))}function $a(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 aO(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)=>!ta(t,o)))}function lO(e){let t=[];for(let o of e)if(!t.some((r)=>Er(r,o)))t.push([...o]);return t}function Fm(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 bO(e){nt=e}function ot(){return nt}var X=null,Q=null,ee=null,Je=!0;function rt(){X=[],Q=[],ee=[],Je=!0}function y(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 vn=100,On=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 Sn(e,t,o,r){for(let i=t.docOps.length-1;i>=0;i--)Lv(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??be;if(r!=="remote")De(e,a);let l=$a(e.session.selection),c=e.doc.dirty;rt();let d,b=null;try{t(e)}catch(A){b={error:A}}finally{d=st()}if(b)throw Sn(e,d,l,c),b.error;let f=de(e.doc.document),x={...f},k=ot(),j=k===null?{patchable:!1,reason:"no-patch-consumer"}:d.ops.length===0?{patchable:!1,reason:"unrecorded-mutation"}:k.classify(e,d.ops);if(j.patchable)k.markConsumed(x,e);if(e.doc.document=x,j.patchable)try{k.apply(e,d.ops,d)}catch(A){k.escalate(`patch-apply-failed: ${A instanceof Error?A.message:String(A)}`,e)}if(!o){let A=a?Rn(a):null;if(A)An(A,e,d,l);else dt(e,f,d,l,i)}return e.doc.dirty=!0,at?.(e,d,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((d)=>d.forward)],l.inverseOps=[...l.inverseOps,...o.docOps.map((d)=>d.inverse)],l.selection=$a(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%On===0;if(s.push({document:c?ir(t):null,fmOps:a&&o.fmOps.length>0?o.fmOps:null,forwardOps:a?o.docOps.map((d)=>d.forward):null,inverseOps:a?o.docOps.map((d)=>d.inverse):null,coalesceKey:i,selection:$a(e.session.selection),selectionBefore:r}),s.length>vn){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??[])Lv(i,a);return i}function Vd(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 wO(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 wn=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(Lv(e.doc.document,t),Bi({forward:t,inverse:o}),t.op){case"set-key":{if(wn.has(t.key))y({key:t.key,op:"doc-meta"});else if(t.key==="style")y({op:"set-style",path:t.path});else if(t.key==="textContent")y({op:"set-text",path:t.path});else if(t.key==="attributes"||t.key==="cases"||t.key==="$props")y({op:"replace",path:t.path});else{let i=t.key.startsWith("on")&&(cf(t.value)||cf(r));y({isEvent:i,key:t.key,op:"set-prop",path:t.path})}return}case"insert-child":{y({index:t.index,op:"insert",parentPath:t.parentPath});return}case"remove-child":{y({op:"remove",path:[...t.parentPath,"children",t.index]});return}case"set-child":{y({op:"replace",path:[...t.parentPath,"children",t.index]});return}case"move-child":{y({fromPath:[...t.fromParentPath,"children",t.fromIndex],op:"move",toIndex:t.toIndex,toParentPath:t.toParentPath});break}default:break}}var V=new Map,M=new Map,be=null,ft=null;function pt(e){ft=e}function xO(e){let t=V.get(e.id);if(t)he(t);let o={owner:e,receipts:[]};return V.set(e.id,o),{owner:e,flush:()=>he(o),close:()=>{if(he(o),V.get(e.id)===o)V.delete(e.id);return[...o.receipts]}}}function H$(e,t){let o=be;be=e;try{return t()}finally{be=o}}function mt(e,t){let o=M.get(e);return o!==void 0&&(!t||o.lane.owner.id===t.id)}function _O(){for(let e of V.values())he(e)}function Rn(e){return V.get(e.id)??null}function he(e){for(let[t,o]of M)if(o.lane===e)gt(t,o)}function An(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 pv(e,t){if(t)F.set(e,t);else F.delete(e)}function SO(e){let t=F.get(e);return t?t.canUndo(e):e.history.index>0||M.has(e)}function CO(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=$a(de(r.selection))}function bt(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=$a(de(o.selectionBefore??[])),e.history.index-=1,bt(e,e.history.index)}else e.history.index-=1,yt(e,e.history.index);e.doc.dirty=!0}function kO(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=$a(de(o.selection)),e.history.index+=1,bt(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=Tv(i),a=sf(o,s.length);s.splice(a,0,structuredClone(r)),y({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 vh(e,t){let o=af(t);if(!o)return;let{index:r,parentPath:i}=o,[s]=w(e.doc.document,i).children.splice(r,1);y({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 B$(e,t){let o=af(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),y({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 jm(e,t){for(let o of Jm(t))vh(e,o)}function Mx(e,t){let o=[];for(let r of Jm(t)){let i=e.session.selection;B$(e,r);let s=Oe(e.session.selection),a=af(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 EO(e,t,o="div"){let r=af(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),y({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 Vp(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),d=oe(i,o),[b]=c.children.splice(a.fromIndex,1);if(Tv(d).splice(a.toIndex,0,b),y({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")y({op:"set-text",path:t});else if(o==="style")y({op:"set-style",path:t});else{let l=r===void 0||r===null||r===""?s:r,c=o.startsWith("on")&&cf(l);y({isEvent:c,key:o,op:"set-prop",path:t})}}function Hm(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))),y({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))),y({attr:o,op:"set-attr",path:t})}function TO(e,t,o,r,i){if(!o)return Hm(e,t,r,i);let s=w(e.doc.document,t),a=Se(s.style);if(!s.style)s.style={};let l=`@${o}`,c=ed(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))),y({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=ed(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))),y({op:"set-style",path:t})}function LO(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}`,d=ed(a.style,c),b=ed(d,r);if(s===void 0||s===""){if(delete b[i],Object.keys(b).length===0)delete d[r];if(Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Se(a.style))),y({op:"set-style",path:t})}function ht(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=ed(l,c);if(i===void 0||i==="")delete l[r],ht(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))),y({op:"set-style",path:t})}function $O(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}`,d=ed(a.style,c),b=d;for(let f of r)b=ed(b,f);if(s===void 0||s===""){if(delete b[i],ht(d,r),Object.keys(d).length===0)delete a.style[c]}else b[i]=s;if(Object.keys(a.style).length===0)delete a.style;Bi(P(t,"style",l,Se(a.style))),y({op:"set-style",path:t})}function IO(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))),y({op:"set-style",path:t})}function Ud(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))),y({key:"state",op:"doc-meta"})}function RO(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))),y({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))),y({key:"state",op:"doc-meta"})}function DO(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))),y({key:"state",op:"doc-meta"})}function Up(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))),y({op:"replace",path:t})}function NO(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))),y({op:"replace",path:t})}function AO(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))),y({op:"replace",path:t})}}function OO(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))),y({op:"replace",path:t})}function qd(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=[],Jn=50;function MO(e){return Object.assign(Ex(),{turnId:e})}function PO(e,t,o=[]){if(t.length===0)return[];let r={batches:[...o],id:e,writes:[...t]};W.push(r);while(W.length>Jn)W.shift();return r.writes}function FO(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=In(s,a);if(l)return l}for(let[s,a]of i)for(let l of a)CC(s);return[...i.keys()]}function In(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 HO(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 BO(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 Mm(e){let t=new Set,o=new Set;return vv(e,(r,i)=>{t.add(r),o.add(JSON.stringify(i))}),t.size===0?null:{fingerprints:o,pointers:t}}function oO(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}/${J$(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"],xx="design",nv=[{icon:"frame-corners",id:"design",title:"Design"},{icon:"file-text",id:"content",title:"Content"},{icon:"image",id:"media",title:"Media"},{icon:"paint-brush",id:"styles",title:"Styles"},{icon:"paper-plane-tilt",id:"publish",title:"Publish"}];function I$(e){return typeof e==="string"&&vC.some((t)=>t===e)}function iv(e){return nv.find((t)=>t.id===e)}var Me="workspace://",_x={content:"content-home",media:"media-home",publish:"publish-home"};function zp(e){return Object.hasOwn(_x,e)}function Yl(e){return`${Me}${e}`}function al(e){if(!e.startsWith(Me))return null;let t=e.slice(Me.length);return I$(t)&&zp(t)?t:null}function ov(e){let t=al(e);return t?iv(t).title:null}var kn=new Map([["design","canvas"],["edit","canvas"],["entry","entry"],["git-diff","diff"],["grid","grid"],["content-home","home"],["media-home","home"],["publish-home","home"],["media","media"],["preview","canvas"],["source","code"],["stylebook","config"],["tokens","tokens"]]),Wp={canvas:"Canvas",code:"Code",config:"Elements",diff:"Diff",entry:"Entry",grid:"Grid",home:"Home",media:"Media",none:"None",tokens:"Variables"};function Xs(e){return kn.get(e)??"canvas"}var Dn=new Map([["design","design"],["edit","edit"],["preview","preview"]]);function tO(e){return Dn.get(e)??"design"}var Sx=(e)=>e.editor.kind==="canvas",fh=(e)=>Sx(e)&&e.selection.count>0,Cx=(e)=>fh(e)&&!e.selection.isRoot;function rv(){return{project:{open:!1,isSite:!1,isRepo:!1,isMultilingual:!1},git:{ahead:0,behind:0,dirtyCount:0},workspace:{id:xx},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=rv();for(let o of Object.keys(e)){let r=e[o];if(r)Object.assign(t[o],r)}return t}var jn=["palette"],En=["caret","global"],Mn=["dock","global"],$n=["canvas","global"],Ln=["grid","global"],Nn=["code","global"],xt=["global"];function nO(e){if(e.modal.open)return jn;if(e.caret.active)return En;if(e.focus.region!=="pane")return Mn;switch(e.editor.kind){case"grid":return Ln;case"code":return Nn;case"canvas":return e.canvas.view==="preview"?xt:$n;default:return xt}}var an="project.json";function _n(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 Wn=["edit","design","preview","source","stylebook","git-diff"];function av({id:e,documentPath:t=null,fileHandle:o=null,document:r,frontmatter:i,sourceFormat:s=null,capabilities:a,openedFrom:l=null,preview:c=!1,layout:d=null,source:b=null,canvasMode:f}){let x=ge(),k=Mm(r),j=a?.modes??Bn(t,s),A=f??j.find((h)=>h!=="preview")??"edit",ce=j[0]==="preview",E={bareRepeaters:k,content:{frontmatter:i||{}},dirty:!1,document:r,handlersSource:null,layout:d,mode:Hn(t,s),source:b,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:_n(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 Bn(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 Wn}function Hn(e,t){let o=Wi(t)??fn(e);if(o)return o.studio?.documentMode?.default??"content";return"component"}function xC(e){return Xs(e.session.ui.canvasMode)}function N$(e){let t=[];for(let o of e.capabilities.modes){if(o==="preview")continue;let r=Xs(o);if(!t.includes(r))t.push(r)}return t}function rO(e,t){return e.capabilities.modes.find((o)=>o!=="preview"&&Xs(o)===t)}function Pm(e){e.scope.stop()}var Tt=new WeakMap,B=new Map;function Tn(e){let t=de(e),o=Tt.get(t);if(!o)o=g({active:!1,attachError:"",peers:[],readOnly:!1,sourceCanonical:!1,status:"unavailable"}),Tt.set(t,o);return o}function vt(e){B.set(e,(B.get(e)??0)+1)}function Ot(e){let t=B.get(e)??0;if(t<=1)B.delete(e);else B.set(e,t-1)}function lv(e){return B.has(e.replaceAll("\\","/"))}var Kn=8000,qn=800,Gn=2500,Pt=null;function zn(){return Pt??=(le("pt4wh98x"),import("./index-pt4wh98x.js")),Pt}function wt(){try{return p()}catch{return null}}var H=null;function cO(e){H=e}var Le=null;function dO(e){Le=e}var Rt=()=>{};function uO(e){Rt=e??(()=>{})}var Ne=new WeakMap;function At(e){return de(e)}function _e(e,t){return e.frontmatterMap(t)}function Yn(e){return e.synced}function D(e){return Ne.get(At(e))}function Be(e){let t=At(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 Ct=!1;function Zn(){if(Ct)return;Ct=!0,lt(Xn),pt(eo),ut((e)=>{if(D(e)?.session?.synced&&Tn(e).sourceCanonical)return Rt("Source editing in progress — structural edits are paused"),"source-canonical";return null})}function Xn(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>=Gn){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)},qn)}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 Jt(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(!Yn(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),d=a.frontmatter??{};o.doc.transact(()=>{let b=[...c.keys()];for(let f of b)if(!(f in d))c.delete(f);for(let[f,x]of Object.entries(d))if(!t.deepEqual(c.get(f),x))c.set(f,x)},t.MIRROR_ORIGIN)}function hO(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)Jt(t).then(()=>{o.releaseSourceCanonical(r.doc,o.LOCAL_ORIGIN)})},localOrigin:o.LOCAL_ORIGIN,readOnly:!t.canWrite,text:o.sourceText(r.doc)}}function uv(e){let t=Tn(e);return t.active&&t.readOnly}async function O$(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 pO(){for(let e of Ve)if(D(e)?.session?.synced)await O$(e)}var Ve=new Set;function ie(e){if(!wt()?.collab||!e.documentPath||e.documentPath===an)return;let o=Be(e);if(o.watcherInstalled)return;o.watcherInstalled=!0,Zn(),Ve.add(e),e.scope.run(()=>{ne(()=>{if(o.optedOut.value)ve(e);else He(e)}),Qs(()=>{Ve.delete(e),ve(e)})})}function M$(e,t){let o=Be(e);if(o.optedOut.value===!t)return;if(o.optedOut.value=!t,!o.watcherInstalled&&t)ie(e)}function P$(e){return D(e)?.optedOut.value!==!0}function It(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=wt();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([zn(),r.collab(o)]);if(!c){s.status="detached";return}if(t.generation!==i){c.destroy();return}let d,b=new Promise((f,x)=>{d=setTimeout(()=>x(Error("collab-sync-timeout")),Kn)});try{await Promise.race([c.whenSynced,b])}finally{clearTimeout(d)}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="",vt(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(Ot(o.path),o.mirrorTimer)clearTimeout(o.mirrorTimer);if(o.sourceParseTimer)clearTimeout(o.sourceParseTimer);for(let i of o.disposers)try{i()}catch{}pv(e,null),e.history.snapshots=[{document:ir(de(e.doc.document)),selection:$a(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 h=o.yDocToJson(r.doc),T=ir(de(e.doc.document));if(!o.deepEqual(h,T)){let J=o.diffDocs(T,h);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((h)=>{e.doc.dirty=h})),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:h})=>{h.meta.set("selection",$a(e.session.selection))},d=({stackItem:h})=>{let T=h.meta.get("selection");e.session.selection=$a(T??[])};l.on("stack-item-added",c),l.on("stack-item-popped",d),s.disposers.push(()=>{l.off("stack-item-added",c),l.off("stack-item-popped",d)}),pv(e,{canRedo:()=>l.canRedo(),canUndo:()=>l.canUndo(),redo:()=>{l.redo()},undo:()=>{l.undo()}});let b=o.structureMap(r.doc),f=(h,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;let O=o.yEventsToDocOps(h);if(O===null){$e(s);return}if(O.length===0)return;try{ke(e,O)}catch{$e(s)}};b.observeDeep(f),s.disposers.push(()=>b.unobserveDeep(f));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=(h,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,Jt(s)},600)};A.observe(ce),s.disposers.push(()=>A.unobserve(ce));let E=_e(o,r.doc),ue=(h,T)=>{if(T.origin===o.LOCAL_ORIGIN||!s.synced)return;s.applyingRemoteFrontmatter=!0;try{for(let[O,J]of h.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 h=JSON.stringify(e.doc.content.frontmatter);ne(()=>{let T=JSON.stringify(e.doc.content.frontmatter);if(T===h)return;if(h=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?$a(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 h=[];for(let[T,O]of r.awareness.getStates())if(T!==r.awareness.clientID&&O.user)h.push({clientId:T,state:O});K.peers=h};return fe(),r.awareness.on("change",fe),s.disposers.push(()=>r.awareness.off("change",fe),r.onStatus((h)=>{if(h==="offline"||h==="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 Dt(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 Qn(e,t,o){if(t[o]===void 0)return;return St(e,t,o)}function Et(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 kt(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=Et(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(!Dt(r))throw I(e,o,`expected an array of path segments (strings or numbers), got ${R(r)}`);return r}function fO(e,t,o){if(t[o]===null)return null;return _C(e,t,o)}function F$(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(!Dt(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 ui(e,t){return{description:t,enum:[...e],type:"string"}}function ll(e,t){return{description:t,get enum(){return[...e()]},type:"string"}}function j$(e,t={}){return{description:e,type:"number",...t}}function To(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 mO(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 Mt(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 $t(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 Lt(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)=>$t(s,i)))throw I(e,o,`expected ${Lt(r)}, got ${R(i)}`);return i}function Nt(e){switch(Mt(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)=>Nt(t)).join(" or ");case"typed":return Lt(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)=>$t(l,i)))continue;try{return _t(e,t,o,a)}catch(l){s.push(l)}}if(s.length===1)throw s[0];throw I(e,o,`expected ${r.map((a)=>Nt(a)).join(" or ")}, got ${R(i)}`)}function _t(e,t,o,r){switch(Mt(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")kt(e,t,o);return Rx(e,t,o,r.minimum,r.maximum)}case"number":return Et(e,t,o);case"integer":return kt(e,t,o);case"string":return St(e,t,o);case"path":return _C(e,t,o);case"path-list":return F$(e,t,o);default:return t[o]}}function gO(e,t,o){let r=t,i=r.properties??{},s=Object.keys(i),a=r.required??[],l={};for(let[c,d]of Object.entries(o)){if(d===void 0||Object.hasOwn(i,c))continue;if(r.additionalProperties===!1)throw I(e,c,`not declared — declared: ${s.join(", ")||"none"}`);l[c]=d}for(let c of s){if(o[c]===void 0&&!a.includes(c))continue;l[c]=_t(e,o,c,i[c])}return l}var lo=20,hi="primary",Bm="secondary",z$=2,m=g({activePaneId:hi,clipboard:null,closedTabs:[],componentRegistry:[],mruOrder:[],fileTree:{dirs:new Map,expanded:new Set,searchQuery:"",selectedPath:null},panes:[{activeTabId:null,derived:null,id:hi,tabOrder:[]}],projectConfig:null,projectRoot:null,styleClipboard:null,tabs:new Map,ui:{activityBar:"files"},get activeTabId(){let e=Gr();return e.derived?.kind==="lens"?pn(e.derived.sourcePaneId)?.activeTabId??null:e.activeTabId},get tabOrder(){return Gr().tabOrder}}),u=Eh(()=>m.activeTabId?m.tabs.get(m.activeTabId)??null:null);function Gr(){let{panes:e}=m;return e.find((t)=>t.id===m.activePaneId)??e[0]}function pn(e){return m.panes.find((t)=>t.id===e)}function Zl(e){return m.panes.find((t)=>t.tabOrder.includes(e))}function 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)Kt(r)}}function zm(e){return m.activePaneId===e}function EC(e){let t=e??Gr().activeTabId,o=t?m.tabs.get(t):null;if(!t||!o)return null;let r=Zl(t);if(!r)return null;let i=Xl(r.id);return Um(t),yh(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(Bm)}function Xl(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 Wm(e){if(m.panes.length<2)return;let t=e===hi?m.panes.find((s)=>s.id!==hi)?.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)yh(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 Vm(e){return e.tabOrder.length===0&&e.derived===null}var U=()=>!0;function LC(e){U=e??(()=>!0)}var Bt=null;function $C(e){Bt=e}var Ht=null;function IC(e){Ht=e}function uo(){let e=0;for(let t of m.tabs.keys())if(U(t))e+=1;return e}function Ut(e){return e.tabOrder.findLast((t)=>U(t))??null}function Um(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=Ut(o);if(o.id!==hi&&Vm(o))t.push(o.id)}for(let o of t)Wm(o)}function yh(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 Ql(e,t=null){if(m.projectRoot&&e!==m.projectRoot)kC();m.projectRoot=e,m.projectConfig=t}function qp(e){let t=u.value;return e!==null&&t!==null&&de(t)===de(e)}function Gd(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 Kt(e){if(S&&e.documentPath)S.selectedPath=e.documentPath}function RC(e){let t=pn(e);if(t)t.activeTabId=null}function ae(e,t={}){let o=m.tabs.get(e),r=Zl(e);if(!o||!r)return;if(r.activeTabId=e,t.focus===!1)return;if(m.activePaneId=r.id,!t.cycling)L(),Ke(e);Kt(o)}function _i(e){if(e.background===!0){let a=m.tabs.get(e.id);if(a)return a;let l=av({...e,preview:!1}),c=(e.paneId===void 0?void 0:pn(e.paneId))??Gr();return yh(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=av({...e,preview:o}),i=(e.paneId===void 0?void 0:pn(e.paneId))??Gr(),s;if(t)r.pinned=t.pinned,Pm(t);else{if(o){let l=Ft(i),c=l?m.tabs.get(l):null;if(c)Yd(c);DC()}let a=o?Ft(i):null;if(a)s=i.tabOrder.indexOf(a),Kd(a);yh(i,r.id,s)}return m.tabs.set(r.id,r),ae(r.id,{focus:e.focus!==!1}),ie(r),r}function Ft(e){return e.tabOrder.find((t)=>m.tabs.get(t)?.preview===!0)??null}function Yc(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)Yc(e)}function jx(e,t){let o=m.tabs.get(e),r=Zl(e);if(!o||!r)return;if(o.pinned=t,t)o.preview=!1;let i=r.tabOrder.filter((a)=>a!==e),s=i.filter((a)=>m.tabs.get(a)?.pinned===!0).length;r.tabOrder=[...i.slice(0,s),e,...i.slice(s)]}function W$(e,t){let o=m.tabs.get(e),r=Zl(e);if(!o||!r)return;r.tabOrder=qt(r,e,t)}function qt(e,t,o){let r=m.tabs.get(t);if(!r)return e.tabOrder;let i=e.tabOrder.filter((d)=>d!==t),s=i.filter((d)=>m.tabs.get(d)?.pinned===!0).length,a=r.pinned?0:s,l=r.pinned?s:i.length,c=Math.min(Math.max(o,a),l);return[...i.slice(0,c),t,...i.slice(c)]}function Kd(e){let t=m.tabs.get(e);if(!t)return;let o=Zl(e),r=o?.activeTabId===e;if(mo(t),Pm(t),m.tabs.delete(e),kx(e),Um(e),m.mruOrder=m.mruOrder.filter((l)=>l!==e),L(),o&&Vm(o))Wm(o.id);if(!r)return;let i=Gr(),s=Ht?.(i.id)??null,a=(s!==null&&i.tabOrder.includes(s)?s:null)??m.mruOrder.find((l)=>i.tabOrder.includes(l)&&U(l))??Ut(i);if(a)ae(a);else Bt?.(i.id)}function V$(){let e=[...m.tabs.values()];m.tabs.clear(),Gt(),m.mruOrder=[],L();for(let t of e)Pm(t)}function Gt(){m.panes=[{activeTabId:null,derived:null,id:hi,tabOrder:[]}],m.activePaneId=hi}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 Vt(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 U$(e){let t=[...m.tabs.keys()],o=[...m.tabs.values()],r=av(e);m.tabs.set(r.id,r),Gt(),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)Pm(i);return r}function jt(e,t={}){ae(e,t)}function fv(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=qt(r,e,o);return r}return Um(e),yh(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),Om(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(),It(r)}function q$(e,t){e.registerAll([...bo(t),...ho(t)])}function bo(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:()=>{Vt(1)}},{id:"document.previousTab",title:"Previous Tab",category:"Document",level:"document",keybinding:["ctrl+shift+tab","mod+shift+tab"],menus:["palette"],group:"2_navigate",when:(o)=>o.document.open,enablement:t,requires:"a second open document in this workspace",run:()=>{Vt(-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=u.value?.documentPath??null;if(s!==i)return`Opened "${i}", but the active document is ${s===null?"none":`"${s}"`}.`;let a=o.editor.kind==="canvas"?"on the canvas; the document tools now operate on it":`in the ${Wp[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=Xl(Gr().id);if(await e.openFile(i,{paneId:s.id}),![...m.tabs.values()].some((a)=>a.documentPath===i)){if(Vm(s)&&s.id!==hi)Wm(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:To("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)Yc(o)}}]}function ho(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(Xl(s.id).id,i)}},{id:"pane.focusPrimary",title:"Focus Primary Pane",category:"View",level:"document",keybinding:"mod+0",menus:["palette"],group:"5_pane",enablement:t,requires:"a split pane grid",undo:"none",run:()=>{kr(hi)}},{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(Bm)}},{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===hi){if(e.derived=null,!Vm(e))return}Wm(e?.id??Bm)}
|
|
2
|
+
export{bC,Pn,yx,ev,Wt,ln,go,wx,tv,Kc,eO,vC,xx,nv,I$,iv,_x,zp,Yl,al,ov,Wp,Xs,tO,Sx,fh,Cx,rv,yC,nO,Om,kx,wC,R$,sv,Fn,Ur,Ex,mh,Tx,iO,Lx,D$,Mm,oO,an,av,xC,N$,rO,Pm,Tn,lv,A$,cv,dv,Oe,sO,$x,$a,Ix,aO,lO,Fm,cO,dO,uO,hO,uv,O$,pO,M$,P$,St,Qn,Rx,Hi,Vn,_C,fO,F$,Ce,ui,ll,j$,To,Dx,mO,We,gO,bO,Bi,Wd,Un,Jc,Nx,Ax,SC,vO,Ia,gh,bh,hv,Ox,yO,ir,Y,Vd,wO,xO,H$,_O,pv,SO,CO,CC,kO,or,vh,B$,jm,Mx,EO,Vp,Qe,Hm,Cr,TO,Px,LO,Fx,$O,IO,Ud,RO,qr,DO,Up,NO,AO,OO,qd,MO,PO,FO,jO,HO,kC,BO,hi,Bm,z$,m,u,Gr,pn,Zl,kr,zm,EC,TC,Xl,Wm,Vm,LC,$C,IC,Um,yh,Ql,qp,Gd,RC,_i,Yc,DC,jx,W$,Kd,V$,U$,jt,fv,Hx,q$};
|
|
3
|
+
|
|
4
|
+
//# debugId=EF31991AE79411CA64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-ztppbam0.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{L,C,A}from"./iframe-entry-
|
|
1
|
+
import{L,C,A}from"./iframe-entry-2x9bn5ng.js";var d="jx-toast-host",E='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',i=new WeakMap,s=new WeakMap;function l(t){let e=t.currentTarget??t.target;return e instanceof Element?e.closest(d):null}function m(t){return[...t.querySelectorAll(E)].filter((e)=>e.closest("jx-toast")?.dataset.open!==void 0)}function v(t){let e=t.ownerDocument.activeElement;return e instanceof Node&&t.contains(e)}function T(t){let[e]=m(t);if(!e)return!1;let n=t.ownerDocument.activeElement;if(n instanceof HTMLElement&&!t.contains(n))i.set(t,n);return e.focus(),!0}function r(t){let e=i.get(t);if(i.delete(t),e?.isConnected===!0)return e.focus(),!0;let n=t.ownerDocument.activeElement;if(n instanceof HTMLElement&&t.contains(n))n.blur();return!1}function u(t,e){for(let n of t.querySelectorAll("jx-toast"))n.dispatchEvent(new Event(e))}function M(t,e){let n=l(e);if(n)u(n,L)}function S(t,e){let n=l(e);if(n&&!A(e))u(n,C)}function b(t,e){let n=l(e);if(!n)return;let c=n.ownerDocument.activeElement,o=e.target,a=c===null||c===n.ownerDocument.body,f=o instanceof Node&&c instanceof Node&&o.contains(c);if(a||f)r(n)}function x(t,e){let n=e.getRootNode(),c=(o)=>{if(!(o instanceof KeyboardEvent)||o.altKey||o.ctrlKey||o.metaKey)return;let a=t.hotkey??"";if(a!==""&&o.key===a){if(T(e))o.preventDefault();return}if(o.key==="Escape"&&v(e))r(e),o.preventDefault()};n.addEventListener("keydown",c),s.set(t,()=>n.removeEventListener("keydown",c))}function y(t){s.get(t)?.(),s.delete(t)}export{T as focusStack,m as focusablesIn,x as onHostMount,y as onHostUnmount,b as onStackClose,M as onStackHold,S as onStackRelease,r as returnFocus};
|
|
2
2
|
|
|
3
3
|
//# debugId=84590F1808CDB39064756E2164756E21
|
|
4
|
-
//# sourceMappingURL=toast-host-
|
|
4
|
+
//# sourceMappingURL=toast-host-g3r2s0kn.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{L,C,A,P,q,z,G,Y,X,Q}from"./iframe-entry-2x9bn5ng.js";export{L as TOAST_PAUSE,C as TOAST_RESUME,P as closeToast,Q as onToastAction,X as onToastDismiss,G as onToastHold,q as onToastMount,Y as onToastRelease,z as onToastUnmount,A as staysInside};
|
|
2
|
+
|
|
3
|
+
//# debugId=CA76A88119B868B264756E2164756E21
|
|
4
|
+
//# sourceMappingURL=toast-w11qpkyz.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p,a,f}from"./iframe-entry-
|
|
1
|
+
import{p,a,f}from"./iframe-entry-b5qgggyp.js";import{t}from"./iframe-entry-42hpmwz5.js";var j=150,R=6,h=4,w=new WeakMap,g=new WeakMap;function D(e,n){let o=g.get(e);if(!o){let l=new Set,s=(u)=>{if(!(u instanceof KeyboardEvent)||u.key!=="Escape")return;for(let c of l)c()};e.addEventListener("keydown",s,!0),o={dismiss:l,listener:s},g.set(e,o)}let{dismiss:i,listener:r}=o;return i.add(n),()=>{if(i.delete(n),i.size===0&&g.get(e)?.listener===r)e.removeEventListener("keydown",r,!0),g.delete(e)}}function G(e){try{return e.matches(":popover-open")}catch{return!1}}function U(e,n){if(n)return!1;if(!(e instanceof Element))return!0;try{return e.matches(":focus-visible")}catch{return!0}}var v=new WeakMap;function K(){return t(globalThis.HTMLButtonElement)&&"interestForElement"in HTMLButtonElement.prototype}function J(e,n){return K()&&e.id!==""&&n.getAttribute("interestfor")===e.id}function Q(e,n){a(e,n)}function V(e){f(e)}function X(e,n){if(J(e,n))return()=>{};let o=e.getRootNode(),i=null,r=null,l=!1,s=!1,u=!1,c=!1,m=!1,d=()=>{if(i!==null)clearTimeout(i),i=null;if(r!==null)clearTimeout(r),r=null},M=()=>{d(),m=!0,Q(e,n)},y=()=>{m=!1,V(e)},H=()=>{if(d(),l||s||u)return;y()},I=()=>{d();let T="delay"in e?Number(e.delay)||0:0;i=setTimeout(M,T)},S=()=>{d(),r=setTimeout(H,j)},O=()=>{l=!0,I()},A=()=>{l=!1,c=!1,S()},B=()=>{c=!0},N=()=>{c=!1},P=(T)=>{let E=U(T.target,c);if(c=!1,!E)return;u=!0,M()},q=()=>{u=!1,H()},C=()=>{s=!0,d()},z=()=>{s=!1,S()},W=()=>{if(!m&&!G(e))return;d(),y()},x=[[n,"pointerenter",O],[n,"pointerleave",A],[n,"pointerdown",B],[n,"pointerup",N],[n,"focusin",P],[n,"focusout",q],[e,"pointerenter",C],[e,"pointerleave",z]];for(let[T,E,b]of x)T.addEventListener(E,b,!0);let _=D(o,W);return()=>{d(),_();for(let[T,E,b]of x)T.removeEventListener(E,b,!0)}}function k(e,n){let o=n.getRootNode(),i=e.for??"",r=i===""?null:o.getElementById?.(i)??null;if(r)return r;let l=n.id;if(!/^[\w-]+$/.test(l))return null;return o.querySelector(`[interestfor="${l}"]`)}function L(e,n){let o=k(e,n);if(o)return o;let i=n.getRootNode(),r=n.id;if(!/^[\w-]+$/.test(r))return null;return i.querySelector(`[aria-describedby~="${r}"]`)}function Y(e,n){let o=L(e,n);if(!o)return;let i=o.getBoundingClientRect();if(i.width===0&&i.height===0)return;e.x=Math.round(i.left),e.y=Math.round(i.bottom+R),e.flipped=!1;let r=()=>{let l=n.getBoundingClientRect();if(l.width===0&&l.height===0)return;if(l.right>window.innerWidth-h)e.x=Math.max(h,Math.round(window.innerWidth-l.width-h));if(l.bottom>window.innerHeight-h)e.y=Math.max(h,Math.round(i.top-l.height-R)),e.flipped=!0};if(t(globalThis.requestAnimationFrame))requestAnimationFrame(r);else r()}function Z(e,n){v.get(e)?.();let o=L(e,n),i=()=>{if(!o||e.anchored!==!0)return;let m=n.getBoundingClientRect(),d=o.getBoundingClientRect();if(m.width===0&&m.height===0)return;e.flipped=m.bottom<=d.top};if(!o||!t(globalThis.requestAnimationFrame))return i(),()=>{};let r=null,l=()=>{r=null,i()},s=()=>{if(r===null)r=requestAnimationFrame(l)};window.addEventListener("scroll",s,{capture:!0,passive:!0}),window.addEventListener("resize",s);let u=t(globalThis.ResizeObserver)?new ResizeObserver(s):null;if(u)u.observe(n),u.observe(o);let c=()=>{if(r!==null)cancelAnimationFrame(r),r=null;if(window.removeEventListener("scroll",s,{capture:!0}),window.removeEventListener("resize",s),u?.disconnect(),v.get(e)===c)v.delete(e)};return v.set(e,c),s(),c}function te(e,n){let o=n.currentTarget;if(!(o instanceof HTMLElement))return;let i="newState"in n&&n.newState==="open",r="source"in n?n.source:null,l=r instanceof Element?r:L(e,o);if(e.anchored=i&&l!==null,!i)e.flipped=!1}function oe(e,n){let o=n.currentTarget;if(!(o instanceof HTMLElement))return;let i="newState"in n&&n.newState==="open";if(e.open=i,!i){v.get(e)?.();return}if(e.anchored===!0&&p())Z(e,o);else Y(e,o)}function ie(e,n){let o=n.currentTarget;if(!(o instanceof HTMLElement))return;let i=k(e,o);if(!i)return;w.get(e)?.dispose(),w.set(e,{dispose:X(o,i),tip:o})}function re(e){v.get(e)?.();let n=w.get(e);if(!n)return;queueMicrotask(()=>{if(w.get(e)!==n)return;if(n.tip.isConnected)return;n.dispose(),w.delete(e)})}var F=0;function le(e,n){F+=1,e.uid=`${n.localName}-${F}`}export{j as TOOLTIP_HIDE_GRACE_MS,X as bindTooltip,Z as measureAnchoredFlip,le as mintHintId,te as onTooltipBeforeToggle,ie as onTooltipReady,oe as onTooltipToggle,re as onTooltipUnmount,Y as placeTooltip,K as supportsInterestInvokers};
|
|
2
2
|
|
|
3
3
|
//# debugId=F94B5FFCE20D7B3B64756E2164756E21
|
|
4
|
-
//# sourceMappingURL=tooltip-
|
|
4
|
+
//# sourceMappingURL=tooltip-dj1pvgz7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t}from"./iframe-entry-
|
|
1
|
+
import{t}from"./iframe-entry-42hpmwz5.js";var p="jx-tree",y="jx-tree-item",L=new WeakMap,H=new WeakMap,T=new WeakMap;function b(n){let e=n.currentTarget;return e instanceof HTMLElement&&e.localName===p?e:null}function v(n,e){return e instanceof Element&&e.closest(p)===n}function h(n,e,r){let o=n[e];return o===void 0?n.getAttribute(r)??"":String(o)}function u(n){return h(n,"value","value")}function g(n){let e=Number(h(n,"level","aria-level"));return Number.isFinite(e)&&e>=1?Math.trunc(e):1}function M(n){let e=h(n,"expanded","aria-expanded");return e==="true"||e==="false"?e:""}function E(n){return n.disabled===void 0?n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true":n.disabled===!0}function N(n){let e=h(n,"label","label");return e===""?n.textContent:e}function K(n,e={}){let r=[...n.querySelectorAll(y)].filter((o)=>o.closest(p)===n);return e.includeDisabled?r:r.filter((o)=>!E(o))}function x(n){let e=K(n,{includeDisabled:!0});if(e.length===0)return;let r=String(n.current??""),o=e.filter((l)=>!E(l)),a=o.find((l)=>u(l)===r)??o[0]??null;for(let l of e)l.caret=l===a;F(n,r,a)}function P(n,e){let r=n.ownerDocument,o=r.activeElement;if(o instanceof Node&&n.contains(o))return!0;return(o===null||o===r.body)&&e.held!==null&&!e.held.isConnected}function F(n,e,r){let o=T.get(n);if(!o)return;if(!P(n,o)){T.delete(n);return}if(e===o.from||r===null||u(r)!==e)return;if(r.focus(),n.ownerDocument.activeElement===r)T.delete(n)}function W(n){if(H.has(n))return;let e=new MutationObserver(()=>{x(n)});e.observe(n,{attributeFilter:["tabindex"],attributes:!0,childList:!0,subtree:!0}),H.set(n,e)}function z(n){let e=String(n.current??""),r=L.get(n);if(r)x(r);return e}function G(n,e){let r=b(e);if(!r)return;L.set(n,r),x(r),W(r)}function j(n,e){return n.findIndex((r)=>r===e||e instanceof Node&&r.contains(e))}function f(n,e,r){n.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:r}))}function O(n,e,r){if(e.current=u(r),x(n),r.focus(),t(r.scrollIntoView))r.scrollIntoView({block:"nearest"});f(n,"change",u(r))}function S(n){return Number(n.padtop??0)>0}function D(n){return Number(n.padbottom??0)>0}function A(n,e){T.set(n,{from:String(e.current??""),held:n.ownerDocument.activeElement})}function I(n,e,r){A(n,e),f(n,"move",{from:String(e.current??""),key:r})}function R(n){return S(n)||D(n)}function V(n,e,r){A(n,e),f(n,"typeahead",{char:r,from:String(e.current??"")})}function w(n,e,r,o,a){let l=e.multiple===!0?o:"replace",d=String(e.anchor??""),i=l==="range"?d===""?a||r:d:r;e.anchor=i,f(n,"select",{anchor:i,mode:l,value:r})}function C(n){if(n.shiftKey)return"range";return n.ctrlKey||n.metaKey?"toggle":"replace"}function _(n){return n.key.length===1&&!n.ctrlKey&&!n.metaKey&&!n.altKey?n.key.toLowerCase():null}function q(n,e,r){let o=n.map((a)=>N(a).trim().toLowerCase());for(let a=1;a<=o.length;a++){let l=(e+a)%o.length;if(o[l].startsWith(r))return l}return-1}function B(n,e){let r=g(n[e]);for(let o=e-1;o>=0;o--)if(g(n[o])<r)return o;return-1}function J(n,e){let r=b(e);if(!r||!v(r,e.target))return;let o=K(r);if(o.length===0)return;let a=j(o,e.target),l=String(n.current??""),d=e.ctrlKey||e.metaKey,i=o[a],s=null;switch(e.key){case"ArrowDown":{s={key:e.key,select:!d,to:a===-1?0:a+1};break}case"ArrowUp":{s={key:e.key,select:!d,to:a===-1?o.length-1:a-1};break}case"Home":case"End":{if(e.key==="Home"?S(n):D(n)){e.preventDefault(),e.stopPropagation(),I(r,n,e.key);return}s={key:e.key,select:!0,to:e.key==="Home"?0:o.length-1};break}case"ArrowRight":{if(!i)return;let c=M(i);if(c==="")return;if(c==="false"){e.preventDefault(),e.stopPropagation(),f(r,"expand",{expanded:!0,value:u(i)});return}let m=o[a+1];if(m&&g(m)<=g(i))return;s={key:e.key,select:!0,to:a+1};break}case"ArrowLeft":{if(!i)return;if(M(i)==="true"){e.preventDefault(),e.stopPropagation(),f(r,"expand",{expanded:!1,value:u(i)});return}let c=B(o,a);if(c===-1&&g(i)===1)return;s={key:e.key,select:!0,to:c};break}case"Enter":{if(!i)return;e.preventDefault(),e.stopPropagation(),f(r,"activate",u(i));return}case" ":{if(!i)return;e.preventDefault(),e.stopPropagation(),w(r,n,u(i),n.multiple===!0?"toggle":"replace",l);return}default:{let c=_(e);if(c===null)return;if(R(n)){e.preventDefault(),e.stopPropagation(),V(r,n,c);return}let m=q(o,a,c);if(m===-1)return;s={key:e.key,select:!0,to:m}}}e.preventDefault(),e.stopPropagation();let k=o[s.to];if(!k){if(s.to<0?S(n):D(n))I(r,n,s.key);return}if(O(r,n,k),s.select)w(r,n,u(k),C(e),l)}function Q(n,e){let r=b(e);if(!r||!(e.target instanceof Element))return;let o=e.target.closest(y);if(!o||o.closest(p)!==r||E(o))return;let a=String(n.current??"");O(r,n,o),w(r,n,u(o),C(e),a)}function X(n,e){let r=b(e);if(!r||!(e.target instanceof Element))return;let o=e.target.closest(y);if(!o||o.closest(p)!==r||E(o))return;f(r,"activate",u(o))}function Y(n,e){let r=b(e);if(!r||!v(r,e.target)||!(e.target instanceof Element))return;e.stopPropagation();let o=e.target.closest(y);if(!o||E(o))return;f(r,"expand",{expanded:M(o)!=="true",value:u(o)})}export{z as applyCurrent,K as itemsOf,Q as onTreeClick,X as onTreeDblClick,J as onTreeKeydown,G as onTreeMount,Y as onTreeToggle,x as syncTree};
|
|
2
2
|
|
|
3
3
|
//# debugId=3A07049B25E0DD9964756E2164756E21
|
|
4
|
-
//# sourceMappingURL=tree-
|
|
4
|
+
//# sourceMappingURL=tree-j0ebwr5s.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{np,ga,Y0,vd,Wn,we}from"./studio-nm86874b.js";import{Kx}from"./studio-c88gq88j.js";import{vI}from"./studio-32d8wyxq.js";class z{constructor(o,e){this._modeId=o,this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){if(this._worker)this._worker.dispose(),this._worker=null;this._client=null}async _updateExtraLibs(){if(!this._worker)return;let o=++this._updateExtraLibsToken,e=await this._worker.getProxy();if(this._updateExtraLibsToken!==o)return;e.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){if(!this._client)this._client=(async()=>{if(this._worker=Kx({moduleId:"vs/language/typescript/tsWorker",createWorker:()=>new Worker(new URL("ts.worker.js",import.meta.url),{type:"module"}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync())return await this._worker.withSyncedResources(Wn.getModels().filter((o)=>o.getLanguageId()===this._modeId).map((o)=>o.uri));return await this._worker.getProxy()})();return this._client}async getLanguageServiceWorker(...o){let e=await this._getClient();if(this._worker)await this._worker.withSyncedResources(o);return e}}var i={};i["lib.d.ts"]=!0;i["lib.decorators.d.ts"]=!0;i["lib.decorators.legacy.d.ts"]=!0;i["lib.dom.asynciterable.d.ts"]=!0;i["lib.dom.d.ts"]=!0;i["lib.dom.iterable.d.ts"]=!0;i["lib.es2015.collection.d.ts"]=!0;i["lib.es2015.core.d.ts"]=!0;i["lib.es2015.d.ts"]=!0;i["lib.es2015.generator.d.ts"]=!0;i["lib.es2015.iterable.d.ts"]=!0;i["lib.es2015.promise.d.ts"]=!0;i["lib.es2015.proxy.d.ts"]=!0;i["lib.es2015.reflect.d.ts"]=!0;i["lib.es2015.symbol.d.ts"]=!0;i["lib.es2015.symbol.wellknown.d.ts"]=!0;i["lib.es2016.array.include.d.ts"]=!0;i["lib.es2016.d.ts"]=!0;i["lib.es2016.full.d.ts"]=!0;i["lib.es2016.intl.d.ts"]=!0;i["lib.es2017.arraybuffer.d.ts"]=!0;i["lib.es2017.d.ts"]=!0;i["lib.es2017.date.d.ts"]=!0;i["lib.es2017.full.d.ts"]=!0;i["lib.es2017.intl.d.ts"]=!0;i["lib.es2017.object.d.ts"]=!0;i["lib.es2017.sharedmemory.d.ts"]=!0;i["lib.es2017.string.d.ts"]=!0;i["lib.es2017.typedarrays.d.ts"]=!0;i["lib.es2018.asyncgenerator.d.ts"]=!0;i["lib.es2018.asynciterable.d.ts"]=!0;i["lib.es2018.d.ts"]=!0;i["lib.es2018.full.d.ts"]=!0;i["lib.es2018.intl.d.ts"]=!0;i["lib.es2018.promise.d.ts"]=!0;i["lib.es2018.regexp.d.ts"]=!0;i["lib.es2019.array.d.ts"]=!0;i["lib.es2019.d.ts"]=!0;i["lib.es2019.full.d.ts"]=!0;i["lib.es2019.intl.d.ts"]=!0;i["lib.es2019.object.d.ts"]=!0;i["lib.es2019.string.d.ts"]=!0;i["lib.es2019.symbol.d.ts"]=!0;i["lib.es2020.bigint.d.ts"]=!0;i["lib.es2020.d.ts"]=!0;i["lib.es2020.date.d.ts"]=!0;i["lib.es2020.full.d.ts"]=!0;i["lib.es2020.intl.d.ts"]=!0;i["lib.es2020.number.d.ts"]=!0;i["lib.es2020.promise.d.ts"]=!0;i["lib.es2020.sharedmemory.d.ts"]=!0;i["lib.es2020.string.d.ts"]=!0;i["lib.es2020.symbol.wellknown.d.ts"]=!0;i["lib.es2021.d.ts"]=!0;i["lib.es2021.full.d.ts"]=!0;i["lib.es2021.intl.d.ts"]=!0;i["lib.es2021.promise.d.ts"]=!0;i["lib.es2021.string.d.ts"]=!0;i["lib.es2021.weakref.d.ts"]=!0;i["lib.es2022.array.d.ts"]=!0;i["lib.es2022.d.ts"]=!0;i["lib.es2022.error.d.ts"]=!0;i["lib.es2022.full.d.ts"]=!0;i["lib.es2022.intl.d.ts"]=!0;i["lib.es2022.object.d.ts"]=!0;i["lib.es2022.regexp.d.ts"]=!0;i["lib.es2022.string.d.ts"]=!0;i["lib.es2023.array.d.ts"]=!0;i["lib.es2023.collection.d.ts"]=!0;i["lib.es2023.d.ts"]=!0;i["lib.es2023.full.d.ts"]=!0;i["lib.es2023.intl.d.ts"]=!0;i["lib.es2024.arraybuffer.d.ts"]=!0;i["lib.es2024.collection.d.ts"]=!0;i["lib.es2024.d.ts"]=!0;i["lib.es2024.full.d.ts"]=!0;i["lib.es2024.object.d.ts"]=!0;i["lib.es2024.promise.d.ts"]=!0;i["lib.es2024.regexp.d.ts"]=!0;i["lib.es2024.sharedmemory.d.ts"]=!0;i["lib.es2024.string.d.ts"]=!0;i["lib.es5.d.ts"]=!0;i["lib.es6.d.ts"]=!0;i["lib.esnext.array.d.ts"]=!0;i["lib.esnext.collection.d.ts"]=!0;i["lib.esnext.d.ts"]=!0;i["lib.esnext.decorators.d.ts"]=!0;i["lib.esnext.disposable.d.ts"]=!0;i["lib.esnext.error.d.ts"]=!0;i["lib.esnext.float16.d.ts"]=!0;i["lib.esnext.full.d.ts"]=!0;i["lib.esnext.intl.d.ts"]=!0;i["lib.esnext.iterator.d.ts"]=!0;i["lib.esnext.promise.d.ts"]=!0;i["lib.esnext.sharedmemory.d.ts"]=!0;i["lib.scripthost.d.ts"]=!0;i["lib.webworker.asynciterable.d.ts"]=!0;i["lib.webworker.d.ts"]=!0;i["lib.webworker.importscripts.d.ts"]=!0;i["lib.webworker.iterable.d.ts"]=!0;function M(o,e,n=0){if(typeof o==="string")return o;else if(o===void 0)return"";let c="";if(n){c+=e;for(let r=0;r<n;r++)c+=" "}if(c+=o.messageText,n++,o.next)for(let r of o.next)c+=M(r,e,n);return c}function v(o){if(o)return o.map((e)=>e.text).join("");return""}class b{constructor(o){this._worker=o}_textSpanToRange(o,e){let n=o.getPositionAt(e.start),c=o.getPositionAt(e.start+e.length),{lineNumber:r,column:s}=n,{lineNumber:d,column:t}=c;return{startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t}}}class A{constructor(o){this._worker=o,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(o){if(!o)return!1;if(o.path.indexOf("/lib.")===0)return!!i[o.path.slice(1)];return!1}getOrCreateModel(o){let e=vd.parse(o),n=Wn.getModel(e);if(n)return n;if(this.isLibFile(e)&&this._hasFetchedLibFiles)return Wn.createModel(this._libFiles[e.path.slice(1)],"typescript",e);let c=vI.getExtraLibs()[o];if(c)return Wn.createModel(c.content,"typescript",e);return null}_containsLibFile(o){for(let e of o)if(this.isLibFile(e))return!0;return!1}async fetchLibFilesIfNecessary(o){if(!this._containsLibFile(o))return;await this._fetchLibFiles()}_fetchLibFiles(){if(!this._fetchLibFilesPromise)this._fetchLibFilesPromise=this._worker().then((o)=>o.getLibFiles()).then((o)=>{this._hasFetchedLibFiles=!0,this._libFiles=o});return this._fetchLibFilesPromise}}class C extends b{constructor(o,e,n,c){super(c);this._libFiles=o,this._defaults=e,this._selector=n,this._disposables=[],this._listener=Object.create(null);let r=(t)=>{if(t.getLanguageId()!==n)return;let l=()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u){if(t.isAttachedToEditor())this._doValidate(t)}else this._doValidate(t)},p,g=t.onDidChangeContent(()=>{clearTimeout(p),p=window.setTimeout(l,500)}),m=t.onDidChangeAttached(()=>{let{onlyVisible:u}=this._defaults.getDiagnosticsOptions();if(u)if(t.isAttachedToEditor())l();else Wn.setModelMarkers(t,this._selector,[])});this._listener[t.uri.toString()]={dispose(){g.dispose(),m.dispose(),clearTimeout(p)}},l()},s=(t)=>{Wn.setModelMarkers(t,this._selector,[]);let l=t.uri.toString();if(this._listener[l])this._listener[l].dispose(),delete this._listener[l]};this._disposables.push(Wn.onDidCreateModel((t)=>r(t))),this._disposables.push(Wn.onWillDisposeModel(s)),this._disposables.push(Wn.onDidChangeModelLanguage((t)=>{s(t.model),r(t.model)})),this._disposables.push({dispose(){for(let t of Wn.getModels())s(t)}});let d=()=>{for(let t of Wn.getModels())s(t),r(t)};this._disposables.push(this._defaults.onDidChange(d)),this._disposables.push(this._defaults.onDidExtraLibsChange(d)),Wn.getModels().forEach((t)=>r(t))}dispose(){this._disposables.forEach((o)=>o&&o.dispose()),this._disposables=[]}async _doValidate(o){let e=await this._worker(o.uri);if(o.isDisposed())return;let n=[],{noSyntaxValidation:c,noSemanticValidation:r,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();if(!c)n.push(e.getSyntacticDiagnostics(o.uri.toString()));if(!r)n.push(e.getSemanticDiagnostics(o.uri.toString()));if(!s)n.push(e.getSuggestionDiagnostics(o.uri.toString()));let d=await Promise.all(n);if(!d||o.isDisposed())return;let t=d.reduce((p,g)=>g.concat(p),[]).filter((p)=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(p.code)===-1),l=t.map((p)=>p.relatedInformation||[]).reduce((p,g)=>g.concat(p),[]).map((p)=>p.file?vd.parse(p.file.fileName):null);if(await this._libFiles.fetchLibFilesIfNecessary(l),o.isDisposed())return;Wn.setModelMarkers(o,this._selector,t.map((p)=>this._convertDiagnostics(o,p)))}_convertDiagnostics(o,e){let n=e.start||0,c=e.length||1,{lineNumber:r,column:s}=o.getPositionAt(n),{lineNumber:d,column:t}=o.getPositionAt(n+c),l=[];if(e.reportsUnnecessary)l.push(Y0.Unnecessary);if(e.reportsDeprecated)l.push(Y0.Deprecated);return{severity:this._tsDiagnosticCategoryToMarkerSeverity(e.category),startLineNumber:r,startColumn:s,endLineNumber:d,endColumn:t,message:M(e.messageText,`
|
|
2
2
|
`),code:e.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(o,e.relatedInformation)}}_convertRelatedInformation(o,e){if(!e)return[];let n=[];return e.forEach((c)=>{let r=o;if(c.file)r=this._libFiles.getOrCreateModel(c.file.fileName);if(!r)return;let s=c.start||0,d=c.length||1,{lineNumber:t,column:l}=r.getPositionAt(s),{lineNumber:p,column:g}=r.getPositionAt(s+d);n.push({resource:r.uri,startLineNumber:t,startColumn:l,endLineNumber:p,endColumn:g,message:M(c.messageText,`
|
|
3
|
-
`)})}),n}_tsDiagnosticCategoryToMarkerSeverity(o){switch(o){case 1:return
|
|
3
|
+
`)})}),n}_tsDiagnosticCategoryToMarkerSeverity(o){switch(o){case 1:return ga.Error;case 3:return ga.Info;case 0:return ga.Warning;case 2:return ga.Hint}return ga.Info}}class x extends b{get triggerCharacters(){return["."]}async provideCompletionItems(o,e,n,c){let r=o.getWordUntilPosition(e),s=new np(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn),d=o.uri,t=o.getOffsetAt(e),l=await this._worker(d);if(o.isDisposed())return;let p=await l.getCompletionsAtPosition(d.toString(),t);if(!p||o.isDisposed())return;return{suggestions:p.entries.map((m)=>{let u=s;if(m.replacementSpan){let k=o.getPositionAt(m.replacementSpan.start),y=o.getPositionAt(m.replacementSpan.start+m.replacementSpan.length);u=new np(k.lineNumber,k.column,y.lineNumber,y.column)}let w=[];if(m.kindModifiers!==void 0&&m.kindModifiers.indexOf("deprecated")!==-1)w.push(we.CompletionItemTag.Deprecated);return{uri:d,position:e,offset:t,range:u,label:m.name,insertText:m.name,sortText:m.sortText,kind:x.convertKind(m.kind),tags:w}})}}async resolveCompletionItem(o,e){let n=o,{uri:c,position:r,offset:s}=n,t=await(await this._worker(c)).getCompletionEntryDetails(c.toString(),s,n.label);if(!t)return n;return{uri:c,position:r,label:t.name,kind:x.convertKind(t.kind),detail:v(t.displayParts),documentation:{value:x.createDocumentationString(t)}}}static convertKind(o){switch(o){case a.primitiveType:case a.keyword:return we.CompletionItemKind.Keyword;case a.variable:case a.localVariable:return we.CompletionItemKind.Variable;case a.memberVariable:case a.memberGetAccessor:case a.memberSetAccessor:return we.CompletionItemKind.Field;case a.function:case a.memberFunction:case a.constructSignature:case a.callSignature:case a.indexSignature:return we.CompletionItemKind.Function;case a.enum:return we.CompletionItemKind.Enum;case a.module:return we.CompletionItemKind.Module;case a.class:return we.CompletionItemKind.Class;case a.interface:return we.CompletionItemKind.Interface;case a.warning:return we.CompletionItemKind.File}return we.CompletionItemKind.Property}static createDocumentationString(o){let e=v(o.documentation);if(o.tags)for(let n of o.tags)e+=`
|
|
4
4
|
|
|
5
5
|
${R(n)}`;return e}}function R(o){let e=`*@${o.name}*`;if(o.name==="param"&&o.text){let[n,...c]=o.text;if(e+=`\`${n.text}\``,c.length>0)e+=` — ${c.map((r)=>r.text).join(" ")}`}else if(Array.isArray(o.text))e+=` — ${o.text.map((n)=>n.text).join(" ")}`;else if(o.text)e+=` — ${o.text}`;return e}class L extends b{constructor(){super(...arguments);this.signatureHelpTriggerCharacters=["(",","]}static _toSignatureHelpTriggerReason(o){switch(o.triggerKind){case we.SignatureHelpTriggerKind.TriggerCharacter:if(o.triggerCharacter)if(o.isRetrigger)return{kind:"retrigger",triggerCharacter:o.triggerCharacter};else return{kind:"characterTyped",triggerCharacter:o.triggerCharacter};else return{kind:"invoked"};case we.SignatureHelpTriggerKind.ContentChange:return o.isRetrigger?{kind:"retrigger"}:{kind:"invoked"};case we.SignatureHelpTriggerKind.Invoke:default:return{kind:"invoked"}}}async provideSignatureHelp(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getSignatureHelpItems(r.toString(),s,{triggerReason:L._toSignatureHelpTriggerReason(c)});if(!t||o.isDisposed())return;let l={activeSignature:t.selectedItemIndex,activeParameter:t.argumentIndex,signatures:[]};return t.items.forEach((p)=>{let g={label:"",parameters:[]};g.documentation={value:v(p.documentation)},g.label+=v(p.prefixDisplayParts),p.parameters.forEach((m,u,w)=>{let k=v(m.displayParts),y={label:k,documentation:{value:v(m.documentation)}};if(g.label+=k,g.parameters.push(y),u<w.length-1)g.label+=v(p.separatorDisplayParts)}),g.label+=v(p.suffixDisplayParts),l.signatures.push(g)}),{value:l,dispose(){}}}}class S extends b{async provideHover(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getQuickInfoAtPosition(c.toString(),r);if(!d||o.isDisposed())return;let t=v(d.documentation),l=d.tags?d.tags.map((g)=>R(g)).join(`
|
|
6
6
|
|
|
7
7
|
`):"",p=v(d.displayParts);return{range:this._textSpanToRange(o,d.textSpan),contents:[{value:"```typescript\n"+p+"\n```\n"},{value:t+(l?`
|
|
8
8
|
|
|
9
|
-
`+l:"")}]}}}class I extends b{async provideDocumentHighlights(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDocumentHighlights(c.toString(),r,[c.toString()]);if(!d||o.isDisposed())return;return d.flatMap((t)=>t.highlightSpans.map((l)=>({range:this._textSpanToRange(o,l.textSpan),kind:l.kind==="writtenReference"?we.DocumentHighlightKind.Write:we.DocumentHighlightKind.Text})))}}class T extends b{constructor(o,e){super(e);this._libFiles=o}async provideDefinition(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDefinitionAtPosition(c.toString(),r);if(!d||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(d.map((l)=>
|
|
9
|
+
`+l:"")}]}}}class I extends b{async provideDocumentHighlights(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDocumentHighlights(c.toString(),r,[c.toString()]);if(!d||o.isDisposed())return;return d.flatMap((t)=>t.highlightSpans.map((l)=>({range:this._textSpanToRange(o,l.textSpan),kind:l.kind==="writtenReference"?we.DocumentHighlightKind.Write:we.DocumentHighlightKind.Text})))}}class T extends b{constructor(o,e){super(e);this._libFiles=o}async provideDefinition(o,e,n){let c=o.uri,r=o.getOffsetAt(e),s=await this._worker(c);if(o.isDisposed())return;let d=await s.getDefinitionAtPosition(c.toString(),r);if(!d||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(d.map((l)=>vd.parse(l.fileName))),o.isDisposed())return;let t=[];for(let l of d){let p=this._libFiles.getOrCreateModel(l.fileName);if(p)t.push({uri:p.uri,range:this._textSpanToRange(p,l.textSpan)})}return t}}class D extends b{constructor(o,e){super(e);this._libFiles=o}async provideReferences(o,e,n,c){let r=o.uri,s=o.getOffsetAt(e),d=await this._worker(r);if(o.isDisposed())return;let t=await d.getReferencesAtPosition(r.toString(),s);if(!t||o.isDisposed())return;if(await this._libFiles.fetchLibFilesIfNecessary(t.map((p)=>vd.parse(p.fileName))),o.isDisposed())return;let l=[];for(let p of t){let g=this._libFiles.getOrCreateModel(p.fileName);if(g)l.push({uri:g.uri,range:this._textSpanToRange(g,p.textSpan)})}return l}}class j extends b{async provideDocumentSymbols(o,e){let n=o.uri,c=await this._worker(n);if(o.isDisposed())return;let r=await c.getNavigationTree(n.toString());if(!r||o.isDisposed())return;let s=(t,l)=>({name:t.text,detail:"",kind:h[t.kind]||we.SymbolKind.Variable,range:this._textSpanToRange(o,t.spans[0]),selectionRange:this._textSpanToRange(o,t.spans[0]),tags:[],children:t.childItems?.map((g)=>s(g,t.text)),containerName:l});return r.childItems?r.childItems.map((t)=>s(t)):[]}}class a{}a.unknown="";a.keyword="keyword";a.script="script";a.module="module";a.class="class";a.interface="interface";a.type="type";a.enum="enum";a.variable="var";a.localVariable="local var";a.function="function";a.localFunction="local function";a.memberFunction="method";a.memberGetAccessor="getter";a.memberSetAccessor="setter";a.memberVariable="property";a.constructorImplementation="constructor";a.callSignature="call";a.indexSignature="index";a.constructSignature="construct";a.parameter="parameter";a.typeParameter="type parameter";a.primitiveType="primitive type";a.label="label";a.alias="alias";a.const="const";a.let="let";a.warning="warning";var h=Object.create(null);h[a.module]=we.SymbolKind.Module;h[a.class]=we.SymbolKind.Class;h[a.enum]=we.SymbolKind.Enum;h[a.interface]=we.SymbolKind.Interface;h[a.memberFunction]=we.SymbolKind.Method;h[a.memberVariable]=we.SymbolKind.Property;h[a.memberGetAccessor]=we.SymbolKind.Property;h[a.memberSetAccessor]=we.SymbolKind.Property;h[a.variable]=we.SymbolKind.Variable;h[a.const]=we.SymbolKind.Variable;h[a.localVariable]=we.SymbolKind.Variable;h[a.variable]=we.SymbolKind.Variable;h[a.function]=we.SymbolKind.Function;h[a.localFunction]=we.SymbolKind.Function;class f extends b{static _convertOptions(o){return{ConvertTabsToSpaces:o.insertSpaces,TabSize:o.tabSize,IndentSize:o.tabSize,IndentStyle:2,NewLineCharacter:`
|
|
10
10
|
`,InsertSpaceAfterCommaDelimiter:!0,InsertSpaceAfterSemicolonInForStatements:!0,InsertSpaceBeforeAndAfterBinaryOperators:!0,InsertSpaceAfterKeywordsInControlFlowStatements:!0,InsertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,PlaceOpenBraceOnNewLineForControlBlocks:!1,PlaceOpenBraceOnNewLineForFunctions:!1}}_convertTextChanges(o,e){return{text:e.newText,range:this._textSpanToRange(o,e.span)}}}class q extends f{constructor(){super(...arguments);this.canFormatMultipleRanges=!1}async provideDocumentRangeFormattingEdits(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getFormattingEditsForRange(r.toString(),s,d,f._convertOptions(n));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class B extends f{get autoFormatTriggerCharacters(){return[";","}",`
|
|
11
11
|
`]}async provideOnTypeFormattingEdits(o,e,n,c,r){let s=o.uri,d=o.getOffsetAt(e),t=await this._worker(s);if(o.isDisposed())return;let l=await t.getFormattingEditsAfterKeystroke(s.toString(),d,n,f._convertOptions(c));if(!l||o.isDisposed())return;return l.map((p)=>this._convertTextChanges(o,p))}}class F extends f{async provideCodeActions(o,e,n,c){let r=o.uri,s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=f._convertOptions(o.getOptions()),l=n.markers.filter((u)=>u.code).map((u)=>u.code).map(Number),p=await this._worker(r);if(o.isDisposed())return;let g=await p.getCodeFixesAtPosition(r.toString(),s,d,l,t);if(!g||o.isDisposed())return{actions:[],dispose:()=>{}};return{actions:g.filter((u)=>u.changes.filter((w)=>w.isNewFile).length===0).map((u)=>this._tsCodeFixActionToMonacoCodeAction(o,n,u)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(o,e,n){let c=[];for(let s of n.changes)for(let d of s.textChanges)c.push({resource:o.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(o,d.span),text:d.newText}});return{title:n.description,edit:{edits:c},diagnostics:e.markers,kind:"quickfix"}}}class E extends b{constructor(o,e){super(e);this._libFiles=o}async provideRenameEdits(o,e,n,c){let r=o.uri,s=r.toString(),d=o.getOffsetAt(e),t=await this._worker(r);if(o.isDisposed())return;let l=await t.getRenameInfo(s,d,{allowRenameOfImportPath:!1});if(l.canRename===!1)return{edits:[],rejectReason:l.localizedErrorMessage};if(l.fileToRename!==void 0)throw Error("Renaming files is not supported.");let p=await t.findRenameLocations(s,d,!1,!1,!1);if(!p||o.isDisposed())return;let g=[];for(let m of p){let u=this._libFiles.getOrCreateModel(m.fileName);if(u)g.push({resource:u.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(u,m.textSpan),text:n}});else throw Error(`Unknown file ${m.fileName}.`)}return{edits:g}}}class N extends b{async provideInlayHints(o,e,n){let c=o.uri,r=c.toString(),s=o.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),d=o.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),t=await this._worker(c);if(o.isDisposed())return null;return{hints:(await t.provideInlayHints(r,s,d)).map((g)=>({...g,label:g.text,position:o.getPositionAt(g.position),kind:this._convertHintKind(g.kind)})),dispose:()=>{}}}_convertHintKind(o){switch(o){case"Parameter":return we.InlayHintKind.Parameter;case"Type":return we.InlayHintKind.Type;default:return we.InlayHintKind.Type}}}var W,H;function Ot(o){H=O(o,"typescript")}function _t(o){W=O(o,"javascript")}function Pt(){return new Promise((o,e)=>{if(!W)return e("JavaScript not registered!");o(W)})}function Vt(){return new Promise((o,e)=>{if(!H)return e("TypeScript not registered!");o(H)})}function O(o,e){let n=[],c=new z(e,o),r=(...t)=>c.getLanguageServiceWorker(...t),s=new A(r);function d(){let{modeConfiguration:t}=o;if(_(n),t.completionItems)n.push(we.registerCompletionItemProvider(e,new x(r)));if(t.signatureHelp)n.push(we.registerSignatureHelpProvider(e,new L(r)));if(t.hovers)n.push(we.registerHoverProvider(e,new S(r)));if(t.documentHighlights)n.push(we.registerDocumentHighlightProvider(e,new I(r)));if(t.definitions)n.push(we.registerDefinitionProvider(e,new T(s,r)));if(t.references)n.push(we.registerReferenceProvider(e,new D(s,r)));if(t.documentSymbols)n.push(we.registerDocumentSymbolProvider(e,new j(r)));if(t.rename)n.push(we.registerRenameProvider(e,new E(s,r)));if(t.documentRangeFormattingEdits)n.push(we.registerDocumentRangeFormattingEditProvider(e,new q(r)));if(t.onTypeFormattingEdits)n.push(we.registerOnTypeFormattingEditProvider(e,new B(r)));if(t.codeActions)n.push(we.registerCodeActionProvider(e,new F(r)));if(t.inlayHints)n.push(we.registerInlayHintsProvider(e,new N(r)));if(t.diagnostics)n.push(new C(s,o,e,r))}return d(),r}function _(o){while(o.length)o.pop().dispose()}export{b as Adapter,F as CodeActionAdaptor,T as DefinitionAdapter,C as DiagnosticsAdapter,I as DocumentHighlightAdapter,q as FormatAdapter,f as FormatHelper,B as FormatOnTypeAdapter,N as InlayHintsAdapter,a as Kind,A as LibFiles,j as OutlineAdapter,S as QuickInfoAdapter,D as ReferenceAdapter,E as RenameAdapter,L as SignatureHelpAdapter,x as SuggestAdapter,z as WorkerManager,M as flattenDiagnosticMessageText,Pt as getJavaScriptWorker,Vt as getTypeScriptWorker,_t as setupJavaScript,Ot as setupTypeScript};
|
|
12
12
|
|
|
13
|
-
//# debugId=
|
|
14
|
-
//# sourceMappingURL=tsMode-
|
|
13
|
+
//# debugId=CCCF6F6723E7E54464756E2164756E21
|
|
14
|
+
//# sourceMappingURL=tsMode-byje4a01.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{hi,Bm,z$,m,u,Gr,pn,Zl,kr,zm,EC,TC,Xl,Wm,Vm,LC,$C,IC,Um,yh,Ql,qp,Gd,RC,_i,Yc,DC,jx,W$,Kd,V$,U$,jt,fv,Hx,q$}from"./studio-ztppbam0.js";import"./studio-4rgem12q.js";import"./studio-8pne0rx4.js";import"./studio-tfmhnwyr.js";import"./studio-a6e5fzve.js";import"./studio-9ndgd55w.js";export{z$ as MAX_PANES,hi as PRIMARY_PANE,Bm as SECONDARY_PANE,jt as activateTab,Gr as activePane,u as activeTab,RC as clearPaneActiveTab,V$ as closeAllTabs,Wm as closePane,Kd as closeTab,Um as detachTab,kr as focusPane,yh as insertIntoPane,zm as isPaneFocused,qp as isTabActive,W$ as moveTab,fv as moveTabToPane,_i as openTab,TC as paneBeside,pn as paneById,Vm as paneIsEmpty,Zl as paneOfTab,DC as promoteDirtyPreviewTabs,Yc as promoteTab,Xl as receivingPane,q$ as registerTabCommands,Hx as renameTab,U$ as replaceAllTabs,IC as setCloseLanding,$C as setEmptyPaneFallback,jx as setTabPinned,LC as setTabScope,Ql as setWorkspaceProject,EC as splitRight,Gd as tabIsLive,m as workspace};
|
|
2
|
+
|
|
3
|
+
//# debugId=2109B91AF224A51E64756E2164756E21
|
|
4
|
+
//# sourceMappingURL=workspace-7q4arnt3.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{C2,n_,bk,vk,i_,Fg,yk}from"./studio-2bq7hheq.js";import"./studio-gczve8zf.js";import"./studio-a9k86nq6.js";import"./studio-aghsg0ds.js";import"./studio-ge08zwpv.js";import"./studio-6rbaedw2.js";import"./studio-nfmpmkqb.js";import"./studio-ry4789ng.js";import"./studio-s4fq9jht.js";import"./studio-n4qq1n57.js";import"./studio-1cfyd1ys.js";import"./studio-9ff0vqff.js";import"./studio-fg4fj9ec.js";import"./studio-ws2r1d7e.js";import"./studio-79r8msnr.js";import"./studio-dvhxxxbd.js";import"./studio-ae7a69jc.js";import"./studio-cg54vtet.js";import"./studio-x2trkhk5.js";import"./studio-spza69tb.js";import"./studio-4qg61g9j.js";import"./studio-kqh7fxn6.js";import"./studio-9179bsm7.js";import"./studio-0nefxhar.js";import"./studio-yjh9gddd.js";import"./studio-0rg30pvs.js";import"./studio-ekzbgnjp.js";import"./studio-nqexty8x.js";import"./studio-g45r5vm8.js";import"./studio-vtey9w98.js";import"./studio-t6dqnnft.js";import"./studio-y47090vq.js";import"./studio-14hh60j8.js";import"./studio-myb4mf0h.js";import"./studio-ajw4k8hp.js";import"./studio-qs5fmhtj.js";import"./studio-8hf8qcm1.js";import"./studio-7q6jdd4h.js";import"./studio-by8x0jvc.js";import"./studio-ztppbam0.js";import"./studio-4rgem12q.js";import"./studio-8pne0rx4.js";import"./studio-tfmhnwyr.js";import"./studio-psh8mwnw.js";import"./studio-a6e5fzve.js";import"./studio-9ndgd55w.js";import"./studio-k1wvtp03.js";export{C2 as WORKSPACE_HOME_MODE_SET,Fg as detachWorkspaceHome,n_ as isWorkspaceHomeMode,bk as openWorkspaceHome,vk as placeWorkspaceHome,yk as renderWorkspaceHome,i_ as workspaceHomeMounted};
|
|
2
|
+
|
|
3
|
+
//# debugId=E6C562BC6BE1B0EF64756E2164756E21
|
|
4
|
+
//# sourceMappingURL=workspace-home-ge027kr6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{pk,os,Ka,fk,br,_t,Ja,Bo,Ya,Xo,Dt,Za,_u,op,yd,KI,JI,YI,mk,gk}from"./studio-h4jbgne2.js";import{ky}from"./studio-kyw47pet.js";var x=30000;class I extends pk{constructor(e){super();this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let r=_u();if(this.getLocalState()!==null&&x/2<=r-this.meta.get(this.clientID).lastUpdated)this.setLocalState(this.getLocalState());let s=[];if(this.meta.forEach((o,c)=>{if(c!==this.clientID&&x<=r-o.lastUpdated&&this.states.has(c))s.push(c)}),s.length>0)L(this,s,"timeout")},os(x/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let r=this.clientID,s=this.meta.get(r),o=s===void 0?0:s.clock+1,c=this.states.get(r);if(e===null)this.states.delete(r);else this.states.set(r,e);this.meta.set(r,{clock:o,lastUpdated:_u()});let a=[],d=[],y=[],f=[];if(e===null)f.push(r);else if(c==null){if(e!=null)a.push(r)}else if(d.push(r),!op(c,e))y.push(r);if(a.length>0||y.length>0||f.length>0)this.emit("change",[{added:a,updated:y,removed:f},"local"]);this.emit("update",[{added:a,updated:d,removed:f},"local"])}setLocalStateField(e,r){let s=this.getLocalState();if(s!==null)this.setLocalState({...s,[e]:r})}getStates(){return this.states}}var L=(e,r,s)=>{let o=[];for(let c=0;c<r.length;c++){let a=r[c];if(e.states.has(a)){if(e.states.delete(a),a===e.clientID){let d=e.meta.get(a);e.meta.set(a,{clock:d.clock+1,lastUpdated:_u()})}o.push(a)}}if(o.length>0)e.emit("change",[{added:[],updated:[],removed:o},s]),e.emit("update",[{added:[],updated:[],removed:o},s])},M=(e,r,s=e.states)=>{let o=r.length,c=Ka();_t(c,o);for(let a=0;a<o;a++){let d=r[a],y=s.get(d)||null,f=e.meta.get(d).clock;_t(c,d),_t(c,f),Ja(c,JSON.stringify(y))}return br(c)};var F=(e,r,s)=>{let o=Ya(r),c=_u(),a=[],d=[],y=[],f=[],U=Dt(o);for(let b=0;b<U;b++){let h=Dt(o),g=Dt(o),S=JSON.parse(Za(o)),v=e.meta.get(h),k=e.states.get(h),w=v===void 0?0:v.clock;if(w<g||w===g&&S===null&&e.states.has(h)){if(S===null)if(h===e.clientID&&e.getLocalState()!=null)g++;else e.states.delete(h);else e.states.set(h,S);if(e.meta.set(h,{clock:g,lastUpdated:c}),v===void 0&&S!==null)a.push(h);else if(v!==void 0&&S===null)f.push(h);else if(S!==null){if(!op(S,k))y.push(h);d.push(h)}}}if(a.length>0||y.length>0||f.length>0)e.emit("change",[{added:a,updated:y,removed:f},s]);if(a.length>0||d.length>0||f.length>0)e.emit("update",[{added:a,updated:d,removed:f},s])};var W=0,D=1,R=2,j=(e,r)=>{_t(e,W);let s=YI(r);Bo(e,s)},H=(e,r,s)=>{_t(e,D),Bo(e,JI(r,s))},B=(e,r,s)=>H(r,s,Xo(e)),N=(e,r,s,o)=>{try{KI(r,Xo(e),s)}catch(c){if(o!=null)o(c);console.error("Caught error while handling a Yjs update",c)}},J=(e,r)=>{_t(e,R),Bo(e,r)},z=N,_=(e,r,s,o,c)=>{let a=Dt(e);switch(a){case W:B(e,r,s);break;case D:N(e,s,o,c);break;case R:z(e,s,o,c);break;default:throw Error("Unknown message type")}return a};var K=1;function se(e){let r=e.webSocketImpl??globalThis.WebSocket,s=e.openTimeoutMs??1e4,o=new Map,c=new Set,a=new yd,d=new I(a);d.setLocalState(null);let y=null,f=null,U="connecting",b=!1,h=(n)=>{if(U===n)return;U=n;for(let t of c)t(n)},g=(n)=>{if(y&&y.readyState===K)try{y.send(mk(n))}catch{}},S=(n)=>{g({message:{path:n,type:"open"},type:"control"})};d.on("update",(n,t)=>{if(t==="remote")return;let l=[...n.added,...n.updated,...n.removed];g({body:M(d,l),type:"awareness"})});let v=(n)=>{switch(n.type){case"hello":{let t={color:n.color,login:n.login,permission:n.permission};if(n.name!==void 0)t.name=n.name;if(n.avatarUrl!==void 0)t.avatarUrl=n.avatarUrl;f=t;return}case"opened":{let t=o.get(n.path);if(!t)return;if(t.opened&&t.epoch!==n.epoch){w(n.path,t);return}t.epoch=n.epoch,t.opened=!0,t.resolveOpen?.(!0),t.resolveOpen=null;let l=Ka();j(l,t.doc),g({body:br(l),epoch:t.epoch,path:n.path,type:"doc-sync"});return}case"doc-reset":{let t=o.get(n.path);if(t)w(n.path,t);return}case"flush-ack":{let t=o.get(n.path);if(t){for(let l of t.pendingFlush)l();t.pendingFlush.clear()}return}case"doc-dirty":{let t=o.get(n.path);if(t){t.dirty=n.dirty;for(let l of t.dirtyCbs)l(n.dirty)}return}case"error":{if(!n.path)return;let t=o.get(n.path);if(!t)return;if(n.code==="content-not-loaded"&&e.hydratePath&&!t.hydrated){t.hydrated=!0,e.hydratePath(n.path).then(()=>S(n.path),()=>{t.resolveOpen?.(!1),t.resolveOpen=null});return}if(!t.opened)t.resolveOpen?.(!1),t.resolveOpen=null;break}default:break}},k=(n,t,l)=>{let u=o.get(n);if(!u||!u.opened||u.epoch!==t)return;let i=Ya(l),m=Ka(),T=_(i,m,u.doc,"remote");if(fk(m)>0)g({body:br(m),epoch:t,path:n,type:"doc-sync"});if(T===D&&!u.synced)u.synced=!0,u.resolveSynced()},w=(n,t)=>{o.delete(n),t.resolveOpen?.(!1),t.resolveOpen=null;for(let l of t.resetCbs)l();t.doc.destroy()},P=()=>{h("connecting");let n=e.protocols,t=n===void 0||n.length===0?new r(e.url):new r(e.url,n);y=t,t.binaryType="arraybuffer",t.onopen=()=>{O.opened(),h("connected");for(let u of o.keys())S(u);if(d.getLocalState()!==null)g({body:M(d,[d.clientID]),type:"awareness"})},t.onmessage=(l)=>{let u=l.data,i=u instanceof ArrayBuffer?new Uint8Array(u):u instanceof Uint8Array?u:null;if(!i)return;let m;try{m=gk(i)}catch{return}switch(m.type){case"control":{v(m.message);return}case"doc-sync":{k(m.path,m.epoch,m.body);return}case"awareness":{F(d,m.body,"remote");break}default:break}},t.onclose=()=>{if(b)return;h("offline");for(let l of o.values())l.opened=!1;O.scheduleRetry()},t.onerror=()=>{}},A={};if(e.reconnectDelayMs!==void 0)A.baseMs=e.reconnectDelayMs;if(e.reconnectRandom!==void 0)A.random=e.reconnectRandom;let O=ky(P,A);return P(),{destroy(){if(b)return;b=!0,O.dispose(),L(d,[d.clientID],"destroy"),d.destroy(),a.destroy();for(let[n,t]of o)t.resolveOpen?.(!1),t.doc.destroy(),o.delete(n);y?.close()},async openDoc(n){if(b)return null;let t=o.get(n);if(t&&!t.handleDestroyed)return null;let l=()=>{},u=new Promise((p)=>{l=p}),i={dirty:!1,dirtyCbs:new Set,doc:new yd,epoch:0,handleDestroyed:!1,hydrated:!1,opened:!1,pendingFlush:new Set,resetCbs:new Set,resolveOpen:null,resolveSynced:l,synced:!1,whenSynced:u};if(o.set(n,i),i.doc.on("update",(p,V)=>{if(V==="remote"||!i.opened)return;let C=Ka();J(C,p),g({body:br(C),epoch:i.epoch,path:n,type:"doc-sync"})}),!await new Promise((p)=>{i.resolveOpen=p;let V=setTimeout(()=>{i.resolveOpen=null,p(!1)},s);i.resolveOpen=(C)=>{clearTimeout(V),p(C)},S(n)})){if(o.get(n)===i)o.delete(n);return i.doc.destroy(),null}return{awareness:d,destroy:()=>{if(i.handleDestroyed)return;if(i.handleDestroyed=!0,o.get(n)===i)o.delete(n),g({path:n,type:"doc-close"});i.doc.destroy()},doc:i.doc,flush:()=>new Promise((p)=>{i.pendingFlush.add(p),g({message:{path:n,type:"flush"},type:"control"})}),identity:()=>f,onDirty:(p)=>(i.dirtyCbs.add(p),p(i.dirty),()=>i.dirtyCbs.delete(p)),onReset:(p)=>(i.resetCbs.add(p),()=>i.resetCbs.delete(p)),onStatus:(p)=>(c.add(p),()=>c.delete(p)),whenSynced:i.whenSynced}},status:()=>U}}export{se as createWsCollabConnection};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
4
|
-
//# sourceMappingURL=ws-client-
|
|
3
|
+
//# debugId=02EEDDD23588711964756E2164756E21
|
|
4
|
+
//# sourceMappingURL=ws-client-h09h6sqg.js.map
|