@jxsuite/studio 6.1.1 → 8.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/README.md +5 -5
- package/dist/chunks/2020-5wtzce5g.js +4 -0
- package/dist/chunks/{action-group-2mqby73c.js → action-group-4aan7g6g.js} +3 -3
- package/dist/chunks/adapter-5tphg7xe.js +4 -0
- package/dist/chunks/add-new-flow-psym14sn.js +4 -0
- package/dist/chunks/cf-account-picker-haqazq5r.js +4 -0
- package/dist/chunks/cf-settings-h2wrh6hq.js +4 -0
- package/dist/chunks/color-area-6rbra5dy.js +4 -0
- package/dist/chunks/color-field-gy56c94g.js +4 -0
- package/dist/chunks/color-m7r1vk54.js +4 -0
- package/dist/chunks/color-slider-sqqdyf6c.js +4 -0
- package/dist/chunks/combobox-72h32ejk.js +4 -0
- package/dist/chunks/components-r22xca09.js +4 -0
- package/dist/chunks/content-source-mmppmcyg.js +4 -0
- package/dist/chunks/convert-to-repeater-he70fc2b.js +4 -0
- package/dist/chunks/dialog-c4x05vyx.js +4 -0
- package/dist/chunks/editor-ccd9jwsa.js +4 -0
- package/dist/chunks/entry-commands-6qxz9e8p.js +4 -0
- package/dist/chunks/extension-sections-0egb88dm.js +4 -0
- package/dist/chunks/file-ops-qnab36ek.js +4 -0
- package/dist/chunks/files-rcn56qvm.js +4 -0
- package/dist/chunks/format-host-yxz0kjjs.js +4 -0
- package/dist/chunks/fs-events-d1qxq4z4.js +4 -0
- package/dist/chunks/grid-open-4z1g062t.js +4 -0
- package/dist/chunks/grid-view-qg1b5eqx.js +51 -0
- package/dist/chunks/icons-63bjtbs7.js +4 -0
- package/dist/chunks/iframe-entry-2zggzajv.js +5 -0
- package/dist/chunks/iframe-entry-76j8vwwx.js +5 -0
- package/dist/chunks/iframe-entry-99nr5zfb.js +5 -0
- package/dist/chunks/iframe-entry-pkgmcgp0.js +5 -0
- package/dist/chunks/iframe-host-ssv7kyj0.js +4 -0
- package/dist/chunks/{index-2veqmnhr.js → index-32eqzv1k.js} +3 -3
- package/dist/chunks/index-f0jn7nnp.js +4 -0
- package/dist/chunks/{javascript-8nbvs12s.js → javascript-pjp734q4.js} +3 -3
- package/dist/chunks/jsonMode-njkvsa02.js +13 -0
- package/dist/chunks/jx-validate-ttasrbh7.js +4 -0
- package/dist/chunks/layers-bgyr11tr.js +4 -0
- package/dist/chunks/layers-panel-7ez66zeq.js +4 -0
- package/dist/chunks/listbox-c421cf8c.js +4 -0
- package/dist/chunks/lit-html-v9gh687x.js +4 -0
- package/dist/chunks/media-library-sq468wts.js +4 -0
- package/dist/chunks/media-picker-shfe59pt.js +4 -0
- package/dist/chunks/menu-bdpzbfvs.js +4 -0
- package/dist/chunks/monaco-binding-vq1hgnn0.js +4 -0
- package/dist/chunks/monaco-buffer-3afgwvbp.js +4 -0
- package/dist/chunks/monaco-setup-xrd2cbkp.js +4 -0
- package/dist/chunks/notify-kzrjr3fv.js +4 -0
- package/dist/chunks/number-field-y62xq0ty.js +4 -0
- package/dist/chunks/parse-v77xtwv7.js +4 -0
- package/dist/chunks/platform-7v4rtd7m.js +4 -0
- package/dist/chunks/popover-b89sfej7.js +4 -0
- package/dist/chunks/publish-panel-2z9gw8ee.js +4 -0
- package/dist/chunks/publish-quick-qx2455cj.js +4 -0
- package/dist/chunks/publish-workspace-wrc1dgwx.js +4 -0
- package/dist/chunks/quick-search-n0t0eqxb.js +4 -0
- package/dist/chunks/references-9547rg5s.js +4 -0
- package/dist/chunks/right-panel-wsgnr9pn.js +4 -0
- package/dist/chunks/select-rzds841e.js +4 -0
- package/dist/chunks/source-control-kwktr9y6.js +4 -0
- package/dist/chunks/split-c9zfdgxf.js +4 -0
- package/dist/chunks/studio-03ct6yfv.js +9 -0
- package/dist/chunks/studio-07rcfje3.js +5 -0
- package/dist/chunks/studio-3e54qh39.js +7 -0
- package/dist/chunks/studio-3exxhz5g.js +5 -0
- package/dist/chunks/studio-3q40e3rj.js +5 -0
- package/dist/chunks/studio-3qeh9t0h.js +6 -0
- package/dist/chunks/studio-3qqjeep5.js +6 -0
- package/dist/chunks/studio-43sd2mam.js +4 -0
- package/dist/chunks/studio-4hp8pkyt.js +5 -0
- package/dist/chunks/studio-58xg6j2q.js +9 -0
- package/dist/chunks/studio-5g0rprdt.js +7 -0
- package/dist/chunks/studio-6m380wp7.js +5 -0
- package/dist/chunks/studio-80jyh1xh.js +4 -0
- package/dist/chunks/studio-83mk4bgg.js +9 -0
- package/dist/chunks/{studio-kggey1jt.js → studio-881z1xrx.js} +4 -4
- package/dist/chunks/studio-8m0y2qe7.js +5 -0
- package/dist/chunks/studio-8tr6cfrc.js +5 -0
- package/dist/chunks/studio-8vcvfs7r.js +6 -0
- package/dist/chunks/studio-9tmebf0s.js +5 -0
- package/dist/chunks/studio-a2bvaptz.js +5 -0
- package/dist/chunks/studio-b7y5mr30.js +5 -0
- package/dist/chunks/studio-bavb31r0.js +5 -0
- package/dist/chunks/studio-bbe4c90a.js +5 -0
- package/dist/chunks/studio-c05wdnt3.js +5 -0
- package/dist/chunks/studio-ccv2svc6.js +5 -0
- package/dist/chunks/studio-d5grtb9e.js +16 -0
- package/dist/chunks/studio-df0baea9.js +5 -0
- package/dist/chunks/studio-dgk4dqtx.js +7 -0
- package/dist/chunks/studio-e1g64q43.js +5 -0
- package/dist/chunks/studio-ed1hp6zf.js +6 -0
- package/dist/chunks/studio-ed3xx40h.js +7 -0
- package/dist/chunks/studio-f14e1zdj.js +5 -0
- package/dist/chunks/studio-fbhxxc5f.js +5 -0
- package/dist/chunks/studio-fyh0jc96.js +5 -0
- package/dist/chunks/studio-gcxk20n7.js +5 -0
- package/dist/chunks/studio-jaaz8ce9.js +5 -0
- package/dist/chunks/{studio-8grwxtqk.js → studio-jcnsdaep.js} +4 -4
- package/dist/chunks/studio-jsgf2q5k.js +7 -0
- package/dist/chunks/{studio-1q1sh2ax.js → studio-k3xxbagr.js} +3 -3
- package/dist/chunks/studio-k7evxqh4.js +5 -0
- package/dist/chunks/studio-kt3pjkwd.js +5 -0
- package/dist/chunks/studio-m8g16bgz.js +5 -0
- package/dist/chunks/studio-mn0476ag.js +5 -0
- package/dist/chunks/studio-mx1smyq0.js +5 -0
- package/dist/chunks/studio-n0c5h6mf.js +5 -0
- package/dist/chunks/{studio-rv11kfwa.js → studio-nh6d342n.js} +7 -7
- package/dist/chunks/studio-nqxqf8p2.js +4 -0
- package/dist/chunks/studio-p4nrkvqr.js +5 -0
- package/dist/chunks/{studio-h46vtzk8.js → studio-pbxa5fpc.js} +4 -4
- package/dist/chunks/studio-pgmvdv7z.js +7 -0
- package/dist/chunks/studio-ph84avkf.js +5 -0
- package/dist/chunks/{studio-wszjyh0j.js → studio-q0mvbaq6.js} +4 -4
- package/dist/chunks/studio-q0tccd43.js +5 -0
- package/dist/chunks/studio-q7rtx6zq.js +14 -0
- package/dist/chunks/{studio-pre0skq6.js → studio-qgh13jtz.js} +4 -4
- package/dist/chunks/studio-qmn1xc24.js +5 -0
- package/dist/chunks/studio-qwdqwkj0.js +5 -0
- package/dist/chunks/{studio-t6b6qe31.js → studio-r5qy30vx.js} +4 -4
- package/dist/chunks/studio-rj9eamf8.js +5 -0
- package/dist/chunks/studio-rptgsk96.js +5 -0
- package/dist/chunks/studio-rthyg42z.js +928 -0
- package/dist/chunks/studio-s19tp1xr.js +5 -0
- package/dist/chunks/studio-s32578pn.js +5 -0
- package/dist/chunks/studio-svb7yyve.js +5 -0
- package/dist/chunks/studio-syreb644.js +5 -0
- package/dist/chunks/studio-tf9jryb1.js +10 -0
- package/dist/chunks/studio-tfkznv39.js +5 -0
- package/dist/chunks/studio-tft6r105.js +5 -0
- package/dist/chunks/studio-txf2kysx.js +5 -0
- package/dist/chunks/studio-v8867ddv.js +12 -0
- package/dist/chunks/studio-vxq7fcvv.js +5 -0
- package/dist/chunks/studio-w4rz9hdk.js +5 -0
- package/dist/chunks/studio-wbcjbhy1.js +9 -0
- package/dist/chunks/studio-wc649wss.js +5 -0
- package/dist/chunks/studio-wys23mxz.js +5 -0
- package/dist/chunks/studio-x1x167jh.js +5 -0
- package/dist/chunks/studio-x9hsze61.js +5 -0
- package/dist/chunks/studio-y0n7yxea.js +9 -0
- package/dist/chunks/studio-y3ahhdpx.js +5 -0
- package/dist/chunks/studio-z97c48fk.js +5 -0
- package/dist/chunks/studio-zat62m0c.js +5 -0
- package/dist/chunks/studio-zcd2e7yz.js +5 -0
- package/dist/chunks/studio-zz9qe3rw.js +64 -0
- package/dist/chunks/swatch-group-ewh24n1f.js +4 -0
- package/dist/chunks/tabs-f5cw3tgp.js +4 -0
- package/dist/chunks/textfield-wewc8rq2.js +4 -0
- package/dist/chunks/toast-1gv0h53h.js +4 -0
- package/dist/chunks/toast-host-1yg5ar8d.js +4 -0
- package/dist/chunks/{toolbar-2nnzqhrj.js → toolbar-44cm5cta.js} +3 -3
- package/dist/chunks/tooltip-yypz28gq.js +4 -0
- package/dist/chunks/tree-9xa4hm7n.js +4 -0
- package/dist/chunks/tsMode-epyfz1hv.js +14 -0
- package/dist/chunks/workspace-dz7nxfhv.js +4 -0
- package/dist/chunks/workspace-home-xsd7hkjw.js +4 -0
- package/dist/chunks/ws-client-bv552sfx.js +4 -0
- package/dist/iframe-entry.js +20 -16
- package/dist/manifest.json +77 -63
- package/dist/studio.js +106 -107
- package/dist/workers/ts.worker.js +3 -3
- package/package.json +17 -16
- package/src/about/about-modal.ts +4 -3
- package/src/account/action-flow.ts +45 -38
- package/src/account-status.ts +7 -2
- package/src/browse/component-examples.ts +272 -0
- package/src/browse/library-commands.ts +64 -104
- package/src/browse/library-layouts.ts +270 -53
- package/src/browse/library-model.ts +194 -134
- package/src/browse/library-pane.ts +748 -440
- package/src/browse/library-preview.ts +161 -26
- package/src/browse/library-source.ts +308 -41
- package/src/browse/preview-root.ts +78 -0
- package/src/browse/preview-style.ts +155 -0
- package/src/canvas/asset-refs.ts +40 -10
- package/src/canvas/asset-resolve.ts +19 -23
- package/src/canvas/canvas-helpers.ts +7 -6
- package/src/canvas/canvas-live-render.ts +260 -77
- package/src/canvas/canvas-origin.ts +37 -12
- package/src/canvas/canvas-page-context.ts +112 -0
- package/src/canvas/canvas-patcher.ts +30 -30
- package/src/canvas/canvas-perf.ts +11 -5
- package/src/canvas/canvas-render.ts +175 -148
- package/src/canvas/canvas-surface.ts +5 -3
- package/src/canvas/canvas-utils.ts +147 -61
- package/src/canvas/dialog-path.ts +9 -4
- package/src/canvas/dialog-state.ts +1 -2
- package/src/canvas/diff-marks.ts +9 -16
- package/src/canvas/diff-toolbar.ts +8 -7
- package/src/canvas/edit-width-drag.ts +4 -1
- package/src/canvas/edit-width.ts +1 -3
- package/src/canvas/iframe-channel.ts +27 -13
- package/src/canvas/iframe-drop.ts +120 -12
- package/src/canvas/iframe-editable-root.ts +29 -16
- package/src/canvas/iframe-entry.ts +104 -75
- package/src/canvas/iframe-eval.ts +73 -49
- package/src/canvas/iframe-host.ts +269 -158
- package/src/canvas/iframe-inline-edit.ts +49 -30
- package/src/canvas/iframe-insert.ts +5 -4
- package/src/canvas/iframe-interaction.ts +30 -25
- package/src/canvas/iframe-keys.ts +11 -0
- package/src/canvas/iframe-overlay.ts +1 -1
- package/src/canvas/iframe-patch.ts +25 -21
- package/src/canvas/iframe-position.ts +12 -6
- package/src/canvas/iframe-protocol.ts +36 -21
- package/src/canvas/iframe-render.ts +84 -35
- package/src/canvas/iframe-slash.ts +24 -11
- package/src/canvas/iframe-subtree.ts +10 -3
- package/src/canvas/npm-modules.ts +22 -0
- package/src/canvas/path-mapping.ts +19 -12
- package/src/canvas/popover-path.ts +7 -3
- package/src/canvas/popover-state.ts +1 -2
- package/src/canvas/preview-navigate.ts +16 -0
- package/src/canvas/repeater-sources.ts +200 -0
- package/src/canvas/serialize-scope.ts +13 -5
- package/src/canvas/stage-scrollbar.ts +7 -2
- package/src/canvas/surface-registry.ts +27 -3
- package/src/collab/collab-commands.ts +7 -2
- package/src/collab/collab-session.ts +84 -45
- package/src/collab/collab-state.ts +4 -3
- package/src/collab/monaco-binding.ts +16 -13
- package/src/collab/monaco-cursors.ts +5 -2
- package/src/commands/app-commands.ts +16 -6
- package/src/commands/budget.ts +13 -11
- package/src/commands/command-args.ts +103 -71
- package/src/commands/context.ts +55 -28
- package/src/commands/defaults.ts +69 -45
- package/src/commands/keymap.ts +56 -43
- package/src/commands/levels.ts +14 -8
- package/src/commands/live-context.ts +9 -7
- package/src/commands/reference.ts +2 -1
- package/src/commands/registry.ts +22 -11
- package/src/commands/run-reported.ts +15 -10
- package/src/component-props.ts +46 -30
- package/src/content/collection-match.ts +11 -9
- package/src/content/collection-pages.ts +412 -0
- package/src/content/content-collections.ts +270 -0
- package/src/content/draft-state.ts +4 -3
- package/src/content/entry-commands.ts +54 -62
- package/src/content/entry-editor.ts +137 -32
- package/src/content/entry-fields.ts +25 -8
- package/src/content/entry-inspector.ts +225 -0
- package/src/content/entry-model.ts +38 -15
- package/src/content/entry-open.ts +80 -0
- package/src/content/entry-summaries.ts +440 -0
- package/src/content/file-record-ids.ts +80 -0
- package/src/content/file-records.ts +125 -0
- package/src/content/page-summaries.ts +129 -0
- package/src/content/record-entry.ts +201 -0
- package/src/content/writing-banner.ts +177 -0
- package/src/create/add-new-commands.ts +185 -0
- package/src/create/add-new-flow.ts +1116 -0
- package/src/create/add-new.ts +1014 -0
- package/src/create/element-name.ts +121 -0
- package/src/editor/canvas-context-menu.ts +1 -2
- package/src/editor/canvas-slash-bridge.ts +3 -6
- package/src/editor/content-slice.ts +16 -14
- package/src/editor/context-menu.ts +35 -22
- package/src/editor/convert-targets.ts +30 -35
- package/src/editor/convert-to-component.ts +78 -48
- package/src/editor/convert-to-repeater.ts +34 -22
- package/src/editor/editable-tags.ts +17 -2
- package/src/editor/file-drop-action.ts +29 -22
- package/src/editor/inline-edit-apply.ts +79 -17
- package/src/editor/inline-edit.ts +76 -50
- package/src/editor/inline-format.ts +59 -56
- package/src/editor/inline-link.ts +40 -15
- package/src/editor/insert-component.ts +91 -0
- package/src/editor/insert-zone-action.ts +14 -5
- package/src/editor/merge-tags.ts +58 -19
- package/src/editor/repeater-scope.ts +39 -28
- package/src/editor/shortcuts.ts +76 -42
- package/src/editor/slash-menu.ts +52 -14
- package/src/files/asset-versions.ts +4 -4
- package/src/files/components.ts +89 -20
- package/src/files/elements.ts +5 -6
- package/src/files/file-ops.ts +92 -41
- package/src/files/files.ts +248 -239
- package/src/files/fs-events.ts +18 -7
- package/src/files/media-meta.ts +97 -2
- package/src/files/media-paths.ts +3 -0
- package/src/files/media-types.ts +55 -0
- package/src/files/media-upload.ts +209 -52
- package/src/files/new-file-name.ts +156 -0
- package/src/files/serialize-document.ts +15 -5
- package/src/format/constraints.ts +1 -1
- package/src/format/convert-file.ts +27 -13
- package/src/format/format-choices.ts +2 -1
- package/src/format/format-host.ts +91 -50
- package/src/github/github-auth-status.ts +27 -3
- package/src/github/github-auth.ts +21 -11
- package/src/github/github-publish.ts +28 -23
- package/src/grid/cell-editors.ts +46 -31
- package/src/grid/cell-popovers.ts +5 -3
- package/src/grid/edit-buffer.ts +10 -9
- package/src/grid/grid-controller.ts +25 -23
- package/src/grid/grid-layout.ts +21 -5
- package/src/grid/grid-open.ts +3 -33
- package/src/grid/grid-panel.ts +65 -6
- package/src/grid/grid-reveal.ts +34 -0
- package/src/grid/grid-source.ts +9 -31
- package/src/grid/grid-view.ts +45 -23
- package/src/grid/redirects-grid.ts +14 -5
- package/src/grid/redirects.ts +16 -14
- package/src/grid/schema-columns.ts +25 -19
- package/src/grid/sources/connector-source.ts +47 -20
- package/src/grid/sources/content-source.ts +100 -31
- package/src/grid/sources/csv-file-source.ts +2 -2
- package/src/grid/tabulator-tables.d.ts +61 -34
- package/src/hosting/document.ts +2 -2
- package/src/hosting/stage.ts +7 -7
- package/src/i18n/i18n-commands.ts +3 -3
- package/src/media/media-commands.ts +181 -0
- package/src/media/media-library-model.ts +232 -0
- package/src/media/media-library.ts +1283 -0
- package/src/media/media-pane.ts +51 -20
- package/src/new-project/add-repo-modal.ts +20 -19
- package/src/new-project/import-tab.ts +10 -14
- package/src/new-project/location-fields.ts +2 -1
- package/src/new-project/new-project-modal.ts +12 -9
- package/src/packages/jxsuite-update.ts +4 -3
- package/src/packages/pull-package-sync.ts +26 -25
- package/src/page-params.ts +97 -68
- package/src/panels/activity-panel.ts +38 -14
- package/src/panels/ai-chat/attached-context.ts +13 -7
- package/src/panels/ai-chat/chat-markdown.ts +8 -8
- package/src/panels/ai-chat/chat-view.ts +80 -73
- package/src/panels/ai-chat/composer.ts +30 -33
- package/src/panels/ai-chat/sessions-view.ts +1 -2
- package/src/panels/ai-panel.ts +23 -20
- package/src/panels/block-action-bar.ts +57 -46
- package/src/panels/bottom-dock.ts +5 -3
- package/src/panels/canvas-dnd-bridge.ts +36 -26
- package/src/panels/chat-panel.ts +6 -6
- package/src/panels/collections-panel.ts +306 -0
- package/src/panels/component-preview.ts +35 -13
- package/src/panels/data-explorer.ts +63 -26
- package/src/panels/data-grid.ts +18 -11
- package/src/panels/dnd.ts +115 -138
- package/src/panels/editors.ts +52 -21
- package/src/panels/elements-panel.ts +19 -5
- package/src/panels/empty-state.ts +2 -2
- package/src/panels/events-panel.ts +84 -69
- package/src/panels/formula-workspace.ts +78 -54
- package/src/panels/frontmatter-fields.ts +33 -28
- package/src/panels/git-diff-open.ts +10 -6
- package/src/panels/head-panel.ts +488 -202
- package/src/panels/i18n-panel.ts +20 -12
- package/src/panels/imports-panel.ts +25 -47
- package/src/panels/jump-bar.ts +75 -31
- package/src/panels/layers-panel.ts +130 -101
- package/src/panels/left-panel.ts +25 -11
- package/src/panels/navigator-panels.ts +23 -11
- package/src/panels/pane-context.ts +140 -49
- package/src/panels/pane-grid.ts +55 -26
- package/src/panels/panel-registry.ts +36 -46
- package/src/panels/properties-panel.ts +182 -124
- package/src/panels/quick-search.ts +53 -31
- package/src/panels/right-panel.ts +201 -45
- package/src/panels/seo-modal.ts +54 -125
- package/src/panels/settings-menu.ts +63 -61
- package/src/panels/settings-pane.ts +268 -162
- package/src/panels/signals-panel.ts +156 -135
- package/src/panels/site-model.ts +367 -0
- package/src/panels/site-panel.ts +638 -0
- package/src/panels/statement-editor.ts +230 -140
- package/src/panels/style-panel.ts +253 -206
- package/src/panels/style-utils.ts +114 -51
- package/src/panels/stylebook-doc.ts +195 -60
- package/src/panels/stylebook-layers-panel.ts +48 -89
- package/src/panels/stylebook-panel.ts +60 -27
- package/src/panels/styles-panel.ts +327 -0
- package/src/panels/tab-drop.ts +27 -11
- package/src/panels/tab-strip.ts +143 -49
- package/src/platform-errors.ts +57 -43
- package/src/platform.ts +59 -31
- package/src/platforms/cloud.ts +373 -176
- package/src/platforms/default-platform.ts +14 -8
- package/src/platforms/devserver.ts +180 -142
- package/src/platforms/read-batcher.ts +16 -8
- package/src/project-list.ts +2 -1
- package/src/publish/deploy-checklist.ts +20 -9
- package/src/publish/pages-service.ts +66 -27
- package/src/publish/publish-changes.ts +491 -0
- package/src/publish/publish-commands.ts +88 -22
- package/src/publish/publish-ids.ts +49 -0
- package/src/publish/publish-panel.ts +10 -6
- package/src/publish/publish-quick.ts +148 -0
- package/src/publish/publish-workspace.ts +926 -0
- package/src/publish/source-control.ts +907 -0
- package/src/recent-projects.ts +15 -8
- package/src/resize-edges.ts +26 -36
- package/src/services/a11y-report.ts +26 -19
- package/src/services/agent-seed.ts +23 -11
- package/src/services/ai-ask.ts +9 -12
- package/src/services/ai-command-tools.ts +68 -62
- package/src/services/ai-import-tools.ts +80 -67
- package/src/services/ai-models.ts +17 -13
- package/src/services/ai-project-tools.ts +68 -32
- package/src/services/ai-session-store.ts +19 -10
- package/src/services/ai-system-prompt.ts +46 -20
- package/src/services/ai-tools.ts +71 -27
- package/src/services/ai-write-report.ts +20 -12
- package/src/services/ai-writes.ts +4 -4
- package/src/services/automation.ts +74 -51
- package/src/services/cem-export.ts +149 -58
- package/src/services/cf-settings.ts +4 -4
- package/src/services/clock.ts +6 -1
- package/src/services/code-services.ts +37 -31
- package/src/services/connection.ts +2 -2
- package/src/services/context-manager.ts +14 -10
- package/src/services/context-resolver.ts +20 -8
- package/src/services/data-service.ts +19 -15
- package/src/services/directory-picker.ts +20 -14
- package/src/services/document-assistant.ts +39 -19
- package/src/services/gated-registry.ts +10 -6
- package/src/services/harness/chat-reducer.ts +23 -1
- package/src/services/import-client.ts +91 -38
- package/src/services/import-seed.ts +8 -2
- package/src/services/jx-validate.ts +28 -31
- package/src/services/live-preview.ts +0 -0
- package/src/services/live-surfaces.ts +6 -3
- package/src/services/model-uri.ts +10 -2
- package/src/services/module-preloads.ts +12 -8
- package/src/services/monaco-buffer.ts +43 -24
- package/src/services/monaco-lazy.ts +7 -8
- package/src/services/monaco-setup.ts +23 -16
- package/src/services/notify.ts +44 -17
- package/src/services/popover-report.ts +25 -10
- package/src/services/preview-eval.ts +20 -8
- package/src/services/profile.ts +13 -6
- package/src/services/project-path.ts +13 -10
- package/src/services/references.ts +0 -0
- package/src/services/render-critic.ts +29 -9
- package/src/services/settings/definitions.ts +25 -14
- package/src/services/settings/kernel.ts +13 -4
- package/src/services/settings/write-queue.ts +9 -9
- package/src/services/token-lint.ts +12 -10
- package/src/services/tool-executor.ts +17 -5
- package/src/services/tool-outcomes.ts +44 -24
- package/src/services/trusted-types.ts +24 -7
- package/src/settings/contexts-section.ts +11 -8
- package/src/settings/contributed-section.ts +128 -70
- package/src/settings/css-vars-editor.ts +119 -32
- package/src/settings/defs-editor.ts +38 -35
- package/src/settings/developer-panels.ts +43 -0
- package/src/settings/extension-rows.ts +16 -8
- package/src/settings/extension-sections.ts +42 -14
- package/src/settings/extensions-section.ts +4 -1
- package/src/settings/general-settings.ts +101 -28
- package/src/settings/locales-section.ts +20 -12
- package/src/settings/preferences-dialog.ts +17 -7
- package/src/settings/preferences-keymap.ts +7 -5
- package/src/settings/preferences-sections.ts +11 -5
- package/src/settings/project-sections.ts +28 -11
- package/src/settings/schema-field-ui.ts +12 -1
- package/src/settings/section-registry.ts +116 -11
- package/src/settings/settings-dialog.ts +192 -0
- package/src/settings/settings-document.ts +186 -166
- package/src/shell/tree.ts +6 -5
- package/src/shell.ts +536 -477
- package/src/site-context.ts +101 -32
- package/src/state.ts +68 -57
- package/src/store.ts +54 -34
- package/src/studio.ts +219 -116
- package/src/style/live-preview.ts +1 -1
- package/src/style/project-styles.ts +40 -7
- package/src/style/stylebook-specimens.ts +89 -0
- package/src/style/stylebook-target.ts +26 -0
- package/src/style/tag-inheritance.ts +105 -0
- package/src/style/token-ref.ts +5 -4
- package/src/style/variables-focus.ts +61 -0
- package/src/style/variables-view.ts +235 -0
- package/src/surfaces/about.ts +18 -19
- package/src/surfaces/add-new.json +1482 -0
- package/src/surfaces/add-new.ts +325 -0
- package/src/surfaces/add-repo.ts +17 -19
- package/src/surfaces/ai-chat.ts +33 -38
- package/src/surfaces/ai-credentials-form.ts +6 -16
- package/src/surfaces/ai-managed-connect.ts +3 -4
- package/src/surfaces/ai-model-picker.ts +3 -5
- package/src/surfaces/block-action-bar.ts +22 -11
- package/src/surfaces/boot-failure.json +4 -3
- package/src/surfaces/boot-failure.ts +4 -5
- package/src/surfaces/bottom-dock.json +1 -1
- package/src/surfaces/bottom-dock.ts +9 -18
- package/src/surfaces/canvas-stage.json +30 -19
- package/src/surfaces/canvas-stage.ts +17 -16
- package/src/surfaces/cf-account-picker.ts +17 -18
- package/src/surfaces/collections-panel.json +615 -0
- package/src/surfaces/collections-panel.ts +168 -0
- package/src/surfaces/commandbar.json +241 -96
- package/src/surfaces/commandbar.ts +145 -105
- package/src/surfaces/convert-repeater.ts +17 -19
- package/src/surfaces/data-actions.ts +9 -7
- package/src/surfaces/dialog.ts +26 -28
- package/src/surfaces/diff-toolbar.ts +9 -7
- package/src/surfaces/empty-state.json +1 -1
- package/src/surfaces/empty-state.ts +7 -10
- package/src/surfaces/entry-editor.json +136 -0
- package/src/surfaces/entry-editor.ts +35 -11
- package/src/surfaces/entry-inspector.json +371 -0
- package/src/surfaces/entry-inspector.ts +143 -0
- package/src/surfaces/expression-editor.ts +11 -25
- package/src/surfaces/files-panel.ts +27 -14
- package/src/surfaces/formula-palette.ts +4 -5
- package/src/surfaces/github-auth.ts +16 -20
- package/src/surfaces/github-publish.ts +17 -22
- package/src/surfaces/grid-cell.ts +30 -31
- package/src/surfaces/grid-open.ts +10 -14
- package/src/surfaces/grid-panel.ts +13 -9
- package/src/surfaces/grid-replace.ts +13 -13
- package/src/surfaces/grid-views.ts +15 -18
- package/src/surfaces/inspector-dock.json +162 -14
- package/src/surfaces/inspector-dock.ts +59 -31
- package/src/surfaces/jump-bar.ts +5 -6
- package/src/surfaces/jxsuite-update.ts +16 -22
- package/src/surfaces/library-pane.json +670 -437
- package/src/surfaces/library-pane.ts +111 -77
- package/src/surfaces/logic-panel.ts +17 -30
- package/src/surfaces/logic-workspace.ts +13 -15
- package/src/surfaces/media-browser.json +62 -6
- package/src/surfaces/media-browser.ts +26 -11
- package/src/surfaces/media-field.json +1 -1
- package/src/surfaces/media-field.ts +4 -5
- package/src/surfaces/media-library.json +1586 -0
- package/src/surfaces/media-library.ts +282 -0
- package/src/surfaces/media-pane.ts +8 -7
- package/src/surfaces/media-pick-dialog.json +71 -0
- package/src/surfaces/media-pick-dialog.ts +132 -0
- package/src/surfaces/menu.ts +47 -23
- package/src/surfaces/navigator-dock.ts +11 -12
- package/src/surfaces/new-project.ts +27 -26
- package/src/surfaces/pane-context.json +144 -77
- package/src/surfaces/pane-context.ts +44 -25
- package/src/surfaces/pane-grid.ts +15 -10
- package/src/surfaces/panel-activity.ts +5 -6
- package/src/surfaces/panel-data.ts +3 -4
- package/src/surfaces/panel-deploy-checklist.json +12 -6
- package/src/surfaces/panel-deploy-checklist.ts +8 -7
- package/src/surfaces/panel-elements.ts +5 -7
- package/src/surfaces/panel-i18n.ts +5 -7
- package/src/surfaces/panel-imports.ts +6 -13
- package/src/surfaces/panel-outline.ts +25 -19
- package/src/surfaces/panel-page.json +72 -2
- package/src/surfaces/panel-page.ts +49 -25
- package/src/surfaces/panel-problems.ts +5 -7
- package/src/surfaces/panel-signals.json +1 -1
- package/src/surfaces/panel-signals.ts +25 -39
- package/src/surfaces/panel-stylebook-layers.json +71 -204
- package/src/surfaces/panel-stylebook-layers.ts +5 -29
- package/src/surfaces/preferences.json +120 -48
- package/src/surfaces/preferences.ts +29 -11
- package/src/surfaces/progress-modal.ts +15 -9
- package/src/surfaces/properties-panel.json +1 -1
- package/src/surfaces/properties-panel.ts +20 -42
- package/src/surfaces/publish-quick.json +428 -0
- package/src/surfaces/publish-quick.ts +165 -0
- package/src/surfaces/publish-workspace.json +2892 -0
- package/src/surfaces/publish-workspace.ts +391 -0
- package/src/surfaces/publish.ts +18 -18
- package/src/surfaces/push-plan.ts +7 -8
- package/src/surfaces/rail.json +1 -159
- package/src/surfaces/rail.ts +22 -79
- package/src/surfaces/reference-field.ts +11 -15
- package/src/surfaces/schema-builder.ts +16 -22
- package/src/surfaces/schema-form.json +10 -2
- package/src/surfaces/schema-form.ts +17 -25
- package/src/surfaces/secret-field.ts +9 -6
- package/src/surfaces/seo.json +1 -1
- package/src/surfaces/seo.ts +21 -15
- package/src/surfaces/settings-contexts.ts +9 -7
- package/src/surfaces/settings-contributed.json +5 -5
- package/src/surfaces/settings-contributed.ts +32 -12
- package/src/surfaces/settings-css-vars.json +44 -36
- package/src/surfaces/settings-css-vars.ts +82 -16
- package/src/surfaces/settings-defs.json +2 -2
- package/src/surfaces/settings-defs.ts +17 -21
- package/src/surfaces/settings-deploy.json +2 -15
- package/src/surfaces/settings-deploy.ts +9 -16
- package/src/surfaces/settings-dialog.json +51 -0
- package/src/surfaces/settings-dialog.ts +169 -0
- package/src/surfaces/settings-extensions.ts +5 -6
- package/src/surfaces/settings-head.ts +33 -39
- package/src/surfaces/settings-locales.ts +8 -20
- package/src/surfaces/settings-overview.json +3 -3
- package/src/surfaces/settings-overview.ts +14 -8
- package/src/surfaces/settings-packages.ts +8 -7
- package/src/surfaces/settings-pane.json +269 -46
- package/src/surfaces/settings-pane.ts +88 -36
- package/src/surfaces/settings-rawjson.ts +5 -6
- package/src/surfaces/shell.json +2 -1
- package/src/surfaces/shell.ts +1 -2
- package/src/surfaces/site-panel.json +1029 -0
- package/src/surfaces/site-panel.ts +233 -0
- package/src/surfaces/slash-menu.json +63 -21
- package/src/surfaces/slash-menu.ts +42 -9
- package/src/surfaces/statements.ts +13 -18
- package/src/surfaces/statusbar.ts +56 -29
- package/src/surfaces/style-panel.ts +18 -31
- package/src/surfaces/stylebook-chrome.ts +3 -5
- package/src/surfaces/styles-panel.json +735 -0
- package/src/surfaces/styles-panel.ts +195 -0
- package/src/surfaces/styles-variables.json +149 -0
- package/src/surfaces/styles-variables.ts +145 -0
- package/src/surfaces/tab-strip.json +4 -4
- package/src/surfaces/tab-strip.ts +14 -13
- package/src/surfaces/target-line.ts +6 -7
- package/src/surfaces/welcome.ts +6 -8
- package/src/surfaces/writing-banner.json +94 -0
- package/src/surfaces/writing-banner.ts +80 -0
- package/src/tabs/bare-repeaters.ts +101 -0
- package/src/tabs/patch-ops.ts +4 -3
- package/src/tabs/project-config.ts +32 -21
- package/src/tabs/selection.ts +36 -8
- package/src/tabs/tab.ts +99 -48
- package/src/tabs/transact.ts +98 -53
- package/src/types.ts +53 -43
- package/src/ui/ai-credentials-form.ts +10 -13
- package/src/ui/ai-model-picker.ts +3 -3
- package/src/ui/cf-account-picker.ts +7 -9
- package/src/ui/color-selector.ts +9 -5
- package/src/ui/dynamic-slot.ts +7 -8
- package/src/ui/expression-editor.ts +112 -105
- package/src/ui/form-controls.ts +104 -56
- package/src/ui/formula-catalog.ts +239 -230
- package/src/ui/formula-chips.ts +33 -18
- package/src/ui/layers.ts +57 -31
- package/src/ui/media-picker.ts +300 -47
- package/src/ui/popover-surface.ts +20 -12
- package/src/ui/progress-modal.ts +13 -8
- package/src/ui/regions.ts +14 -12
- package/src/ui/schema-form.ts +372 -97
- package/src/ui/surface.ts +71 -8
- package/src/ui/timing.ts +9 -0
- package/src/ui/value-source.ts +44 -31
- package/src/ui/virtual-window.ts +29 -3
- package/src/utils/base64.ts +6 -4
- package/src/utils/edit-display.ts +366 -111
- package/src/utils/element-selectors.ts +3 -2
- package/src/utils/google-fonts.ts +15 -14
- package/src/utils/inherited-style.ts +18 -20
- package/src/utils/link-target.ts +1 -1
- package/src/utils/local-day.ts +18 -0
- package/src/utils/preview-format.ts +25 -3
- package/src/utils/strip-events.ts +49 -22
- package/src/utils/studio-utils.ts +29 -14
- package/src/view.ts +2 -3
- package/src/workspace/pane-derive.ts +14 -16
- package/src/workspace/session.ts +81 -50
- package/src/workspace/tab-workspace.ts +137 -0
- package/src/workspace/workspace-back.ts +189 -0
- package/src/workspace/workspace-home.ts +133 -0
- package/src/workspace/workspace-ids.ts +129 -0
- package/src/workspace/workspace-switch.ts +372 -0
- package/src/workspace/workspace.ts +165 -47
- package/styles/shell-frame.css +30 -7
- package/styles/shell-frame.json +15 -3
- package/dist/chunks/2020-va2wwra4.js +0 -4
- package/dist/chunks/adapter-f93pafd7.js +0 -4
- package/dist/chunks/cf-account-picker-af1h381v.js +0 -4
- package/dist/chunks/cf-settings-125tdm0w.js +0 -4
- package/dist/chunks/color-area-jqhna8zy.js +0 -4
- package/dist/chunks/color-field-embq5ctg.js +0 -4
- package/dist/chunks/color-fpezvnkt.js +0 -4
- package/dist/chunks/color-slider-1qmw7wqy.js +0 -4
- package/dist/chunks/combobox-773hdzyj.js +0 -4
- package/dist/chunks/components-ax2f1fnn.js +0 -4
- package/dist/chunks/content-source-108aqtk1.js +0 -4
- package/dist/chunks/convert-to-repeater-ry5rmppr.js +0 -4
- package/dist/chunks/dialog-mtm9fq5t.js +0 -4
- package/dist/chunks/editor-pfgdmkb0.js +0 -4
- package/dist/chunks/entry-commands-t0k1q0kx.js +0 -4
- package/dist/chunks/extension-sections-6mwh2hf8.js +0 -4
- package/dist/chunks/file-ops-meej5mqf.js +0 -4
- package/dist/chunks/files-44vp8a2s.js +0 -4
- package/dist/chunks/format-host-7q1petb9.js +0 -4
- package/dist/chunks/fs-events-h2mwnxaz.js +0 -4
- package/dist/chunks/git-panel-zngbymvd.js +0 -4
- package/dist/chunks/grid-view-sx9vynsp.js +0 -51
- package/dist/chunks/icons-p44xhjf0.js +0 -4
- package/dist/chunks/iframe-entry-f7mqjwpm.js +0 -5
- package/dist/chunks/iframe-entry-haw7jkvz.js +0 -5
- package/dist/chunks/iframe-entry-z6qrytv3.js +0 -5
- package/dist/chunks/iframe-host-qk3ycq87.js +0 -4
- package/dist/chunks/index-wkyfjeqz.js +0 -4
- package/dist/chunks/jsonMode-s8kt9dsj.js +0 -13
- package/dist/chunks/jx-validate-psgd7vsx.js +0 -4
- package/dist/chunks/layers-panel-1kq2jyfk.js +0 -4
- package/dist/chunks/layers-xd92fg8d.js +0 -4
- package/dist/chunks/listbox-s8fkmnq8.js +0 -4
- package/dist/chunks/lit-html-ac4cwwr4.js +0 -4
- package/dist/chunks/media-picker-0svzkdyb.js +0 -4
- package/dist/chunks/menu-37d07z9m.js +0 -4
- package/dist/chunks/menu-5c55ea3d.js +0 -4
- package/dist/chunks/monaco-binding-z6r70pdt.js +0 -4
- package/dist/chunks/monaco-buffer-fz6gq5y7.js +0 -4
- package/dist/chunks/monaco-setup-q4axkgj7.js +0 -4
- package/dist/chunks/notify-0xgtn8q1.js +0 -4
- package/dist/chunks/number-field-gw7sq8rn.js +0 -4
- package/dist/chunks/parse-897fvqah.js +0 -4
- package/dist/chunks/platform-v1qctbe6.js +0 -4
- package/dist/chunks/popover-8htra4er.js +0 -4
- package/dist/chunks/publish-panel-ym1fmgq5.js +0 -4
- package/dist/chunks/quick-search-a54e6t5n.js +0 -4
- package/dist/chunks/references-gmqp82fs.js +0 -4
- package/dist/chunks/right-panel-v7t9awbk.js +0 -4
- package/dist/chunks/section-registry-vhyf3zsr.js +0 -4
- package/dist/chunks/select-n3v7gwas.js +0 -4
- package/dist/chunks/split-pff8f3ze.js +0 -4
- package/dist/chunks/studio-0bhx5hz6.js +0 -5
- package/dist/chunks/studio-0k1ddnyy.js +0 -6
- package/dist/chunks/studio-1b04pd0j.js +0 -64
- package/dist/chunks/studio-4dwbj6gb.js +0 -5
- package/dist/chunks/studio-4tanh828.js +0 -5
- package/dist/chunks/studio-55h4mstj.js +0 -4
- package/dist/chunks/studio-5tnvjkz4.js +0 -5
- package/dist/chunks/studio-60dqgb0c.js +0 -5
- package/dist/chunks/studio-61dp09qg.js +0 -9
- package/dist/chunks/studio-63epcrj2.js +0 -5
- package/dist/chunks/studio-74k29dy9.js +0 -5
- package/dist/chunks/studio-7vg6jcd3.js +0 -5
- package/dist/chunks/studio-7zx31knw.js +0 -9
- package/dist/chunks/studio-8bxk97km.js +0 -5
- package/dist/chunks/studio-933e30n4.js +0 -5
- package/dist/chunks/studio-98wnwhbg.js +0 -5
- package/dist/chunks/studio-9mccjwjh.js +0 -14
- package/dist/chunks/studio-a2ke1e4t.js +0 -5
- package/dist/chunks/studio-e3a2a6v3.js +0 -4
- package/dist/chunks/studio-e81q1vb9.js +0 -5
- package/dist/chunks/studio-epgrmqqm.js +0 -5
- package/dist/chunks/studio-ery42sqr.js +0 -4
- package/dist/chunks/studio-g1shz58g.js +0 -5
- package/dist/chunks/studio-gf0fz03c.js +0 -5
- package/dist/chunks/studio-gjtpe62q.js +0 -6
- package/dist/chunks/studio-gkskhg7m.js +0 -5
- package/dist/chunks/studio-gx4dnjzd.js +0 -5
- package/dist/chunks/studio-j03zga3y.js +0 -9
- package/dist/chunks/studio-jhpxeckz.js +0 -5
- package/dist/chunks/studio-k01r7ykp.js +0 -5
- package/dist/chunks/studio-kk7h30ne.js +0 -7
- package/dist/chunks/studio-kt1zqney.js +0 -5
- package/dist/chunks/studio-m3cwhvye.js +0 -5
- package/dist/chunks/studio-mcayt6hz.js +0 -5
- package/dist/chunks/studio-myjcghv3.js +0 -5
- package/dist/chunks/studio-n8bxwc3y.js +0 -4
- package/dist/chunks/studio-ngm8gvpb.js +0 -5
- package/dist/chunks/studio-nj5a01jy.js +0 -928
- package/dist/chunks/studio-pcgz8heb.js +0 -5
- package/dist/chunks/studio-qcsq0t15.js +0 -5
- package/dist/chunks/studio-qkstvve9.js +0 -5
- package/dist/chunks/studio-qv1pwd3c.js +0 -5
- package/dist/chunks/studio-rc6dvxjb.js +0 -7
- package/dist/chunks/studio-s8dmmz66.js +0 -5
- package/dist/chunks/studio-sp5xzbj4.js +0 -6
- package/dist/chunks/studio-szsjbj0g.js +0 -5
- package/dist/chunks/studio-t1xzawhr.js +0 -16
- package/dist/chunks/studio-tdcprbqb.js +0 -5
- package/dist/chunks/studio-vrmcjf9g.js +0 -7
- package/dist/chunks/studio-vyc0b4he.js +0 -10
- package/dist/chunks/studio-w0cgf6jg.js +0 -5
- package/dist/chunks/studio-w3hskzqk.js +0 -5
- package/dist/chunks/studio-xgrgcdyh.js +0 -9
- package/dist/chunks/studio-xz2yxfcb.js +0 -5
- package/dist/chunks/studio-y6n42tgs.js +0 -5
- package/dist/chunks/studio-yb560vxr.js +0 -5
- package/dist/chunks/studio-yn9f8vtx.js +0 -5
- package/dist/chunks/studio-yw05w8f0.js +0 -7
- package/dist/chunks/studio-z16sgavc.js +0 -5
- package/dist/chunks/studio-zey7zsdw.js +0 -12
- package/dist/chunks/studio-zyqn40w4.js +0 -5
- package/dist/chunks/swatch-group-8qh9a3bm.js +0 -4
- package/dist/chunks/tabs-jwthg40w.js +0 -4
- package/dist/chunks/textfield-spy3hc77.js +0 -4
- package/dist/chunks/toast-4d35zd64.js +0 -4
- package/dist/chunks/toast-host-8sjmfed3.js +0 -4
- package/dist/chunks/tooltip-fd6g9xy3.js +0 -4
- package/dist/chunks/tree-h19v1jfz.js +0 -4
- package/dist/chunks/tsMode-2frah6h1.js +0 -14
- package/dist/chunks/workspace-zt81g1ms.js +0 -4
- package/dist/chunks/ws-client-n2bh4hkf.js +0 -4
- package/src/panels/frontmatter-panel.ts +0 -701
- package/src/panels/git-panel.ts +0 -1120
- package/src/surfaces/doc-header.json +0 -776
- package/src/surfaces/doc-header.ts +0 -231
- package/src/surfaces/git-panel.json +0 -1880
- package/src/surfaces/git-panel.ts +0 -272
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
var I=()=>new Map,ae=(t)=>{let e=I();return t.forEach((n,r)=>{e.set(r,n)}),e},M=(t,e,n)=>{let r=t.get(e);if(r===void 0)t.set(e,r=n());return r},ur=(t,e)=>{let n=[];for(let[r,s]of t)n.push(e(s,r));return n},dr=(t,e)=>{for(let[n,r]of t)if(e(r,n))return!0;return!1};var j=()=>new Set;var he=(t)=>t[t.length-1];var fr=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},F=Array.from,ue=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},Rt=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1};var pr=(t,e)=>{let n=Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n};var K=Array.isArray;class de{constructor(){this._observers=I()}on(t,e){return M(this._observers,t,j).add(e),e}once(t,e){let n=(...r)=>{this.off(t,n),e(...r)};this.on(t,n)}off(t,e){let n=this._observers.get(t);if(n!==void 0){if(n.delete(e),n.size===0)this._observers.delete(t)}}emit(t,e){return F((this._observers.get(t)||I()).values()).forEach((n)=>n(...e))}destroy(){this._observers=I()}}class A0{constructor(){this._observers=I()}on(t,e){M(this._observers,t,j).add(e)}once(t,e){let n=(...r)=>{this.off(t,n),e(...r)};this.on(t,n)}off(t,e){let n=this._observers.get(t);if(n!==void 0){if(n.delete(e),n.size===0)this._observers.delete(t)}}emit(t,e){return F((this._observers.get(t)||I()).values()).forEach((n)=>n(...e))}destroy(){this._observers=I()}}var Io=Math.floor;var tt=Math.abs;var fe=(t,e)=>t<e?t:e,W=(t,e)=>t>e?t:e;var pe=(t)=>t!==0?t<0:1/t<0;var on=1,cn=2,ge=4,me=8;var ht=32,V=64,A=128;var Mt=31,$t=63,Z=127;var gr=2147483647;var{MAX_SAFE_INTEGER:ut,MIN_SAFE_INTEGER:an}=Number;var mr=Number.isInteger||((t)=>typeof t==="number"&&isFinite(t)&&Io(t)===t);var{fromCharCode:un,fromCodePoint:xi}=String,Zc=un(65535),yi=(t)=>t.toLowerCase(),bi=/^\s*/g,ki=(t)=>t.replace(bi,""),_i=/([A-Z])/g,dn=(t,e)=>ki(t.replace(_i,(n)=>`${e}${yi(n)}`));var Si=(t)=>{let e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=e.codePointAt(s);return r},pt=typeof TextEncoder<"u"?new TextEncoder:null,Ei=(t)=>pt.encode(t),xr=pt?Ei:Si;var dt=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});if(dt&&dt.decode(new Uint8Array).length===1)dt=null;var yr=(t,e)=>pr(e,()=>t).join("");class mt{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}var ha=()=>new mt;var P0=(t)=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e};var Kr=(t)=>{let e=new Uint8Array(P0(t)),n=0;for(let r=0;r<t.bufs.length;r++){let s=t.bufs[r];e.set(s,n),n+=s.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},Ii=(t,e)=>{let n=t.cbuf.length;if(n-t.cpos<e)t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(W(n,e)*2),t.cpos=0},U=(t,e)=>{let n=t.cbuf.length;if(t.cpos===n)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0;t.cbuf[t.cpos++]=e};var xe=U;var ft=(t,e)=>{while(e>Z)U(t,A|Z&e),e=Io(e/128);U(t,Z&e)},ye=(t,e)=>{let n=pe(e);if(n)e=-e;U(t,(e>$t?A:0)|(n?V:0)|$t&e),e=Io(e/64);while(e>0)U(t,(e>Z?A:0)|Z&e),e=Io(e/128)},fn=new Uint8Array(30000),Ui=fn.length/3,Ti=(t,e)=>{if(e.length<Ui){let n=pt.encodeInto(e,fn).written||0;ft(t,n);for(let r=0;r<n;r++)U(t,fn[r])}else wr(t,xr(e))},Ai=(t,e)=>{let n=unescape(encodeURIComponent(e)),r=n.length;ft(t,r);for(let s=0;s<r;s++)U(t,n.codePointAt(s))},pa=pt&&pt.encodeInto?Ti:Ai;var Ft=(t,e)=>{let n=t.cbuf.length,r=t.cpos,s=fe(n-r,e.length),i=e.length-s;if(t.cbuf.set(e.subarray(0,s),r),t.cpos+=s,i>0)t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(W(n*2,i)),t.cbuf.set(e.subarray(s)),t.cpos=i},wr=(t,e)=>{ft(t,e.byteLength),Ft(t,e)},pn=(t,e)=>{Ii(t,e);let n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},Ci=(t,e)=>pn(t,4).setFloat32(0,e,!1),Di=(t,e)=>pn(t,8).setFloat64(0,e,!1),Bi=(t,e)=>pn(t,8).setBigInt64(0,e,!1);var br=new DataView(new ArrayBuffer(4)),Oi=(t)=>(br.setFloat32(0,t),br.getFloat32(0)===t),gt=(t,e)=>{switch(typeof e){case"string":U(t,119),pa(t,e);break;case"number":if(mr(e)&&tt(e)<=gr)U(t,125),ye(t,e);else if(Oi(e))U(t,124),Ci(t,e);else U(t,123),Di(t,e);break;case"bigint":U(t,122),Bi(t,e);break;case"object":if(e===null)U(t,126);else if(K(e)){U(t,117),ft(t,e.length);for(let n=0;n<e.length;n++)gt(t,e[n])}else if(e instanceof Uint8Array)U(t,116),wr(t,e);else{U(t,118);let n=Object.keys(e);ft(t,n.length);for(let r=0;r<n.length;r++){let s=n[r];pa(t,s),gt(t,e[s])}}break;case"boolean":U(t,e?120:121);break;default:U(t,127)}};class be extends mt{constructor(t){super();this.w=t,this.s=null,this.count=0}write(t){if(this.s===t)this.count++;else{if(this.count>0)ft(this,this.count-1);this.count=1,this.w(this,t),this.s=t}}}var kr=(t)=>{if(t.count>0){if(ye(t.encoder,t.count===1?t.s:-t.s),t.count>1)ft(t.encoder,t.count-2)}};class wt{constructor(){this.encoder=new mt,this.s=0,this.count=0}write(t){if(this.s===t)this.count++;else kr(this),this.count=1,this.s=t}toUint8Array(){return kr(this),Kr(this.encoder)}}var _r=(t)=>{if(t.count>0){let e=t.diff*2+(t.count===1?0:1);if(ye(t.encoder,e),t.count>1)ft(t.encoder,t.count-2)}};class jt{constructor(){this.encoder=new mt,this.s=0,this.count=0,this.diff=0}write(t){if(this.diff===t-this.s)this.s=t,this.count++;else _r(this),this.count=1,this.diff=t-this.s,this.s=t}toUint8Array(){return _r(this),Kr(this.encoder)}}class gn{constructor(){this.sarr=[],this.s="",this.lensE=new wt}write(t){if(this.s+=t,this.s.length>19)this.sarr.push(this.s),this.s="";this.lensE.write(t.length)}toUint8Array(){let t=new mt;return this.sarr.push(this.s),this.s="",pa(t,this.sarr.join("")),Ft(t,this.lensE.toUint8Array()),Kr(t)}}var v=(t)=>Error(t),N=()=>{throw v("Method unimplemented")},B=()=>{throw v("Unexpected case")};var ke=v("Unexpected end of array"),Er=v("Integer out of Range"),vi=(t,e,n)=>{if(e<0||n<0||e+n>t.length)throw ke;return new Uint8Array(t.buffer,t.byteOffset+e,n)},Ni=(t,e,n)=>{if(e<0||n<0||e+n>t.length)throw ke;return new DataView(t.buffer,t.byteOffset+e,n)};class qt{constructor(t){this.arr=t,this.pos=0}}var fa=(t)=>new qt(t),Ir=(t)=>t.pos!==t.arr.length;var Ri=(t,e)=>{let n=vi(t.arr,t.pos,e);return t.pos+=e,n},Rr=(t)=>Ri(t,Et(t));var et=(t)=>t.arr[t.pos++];var Et=(t)=>{let e=0,n=1,r=t.arr.length;while(t.pos<r){let s=t.arr[t.pos++];if(e=e+(s&Z)*n,n*=128,s<A)return e;if(e>ut)throw Er}throw ke},_e=(t)=>{let e=t.arr[t.pos++],n=e&$t,r=64,s=(e&V)>0?-1:1;if((e&A)===0)return s*n;let i=t.arr.length;while(t.pos<i){if(e=t.arr[t.pos++],n=n+(e&Z)*r,r*=128,e<A)return s*n;if(n>ut)throw Er}throw ke};var Li=(t)=>{let e=Et(t);if(e===0)return"";else{let n=String.fromCodePoint(et(t));if(--e<100)while(e--)n+=String.fromCodePoint(et(t));else while(e>0){let r=e<1e4?e:1e4,s=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,s),e-=r}return decodeURIComponent(escape(n))}},Vi=(t)=>dt.decode(Rr(t)),ma=dt?Vi:Li;var wn=(t,e)=>{let n=Ni(t.arr,t.pos,e);return t.pos+=e,n},Mi=(t)=>wn(t,4).getFloat32(0,!1),$i=(t)=>wn(t,8).getFloat64(0,!1),Fi=(t)=>wn(t,8).getBigInt64(0,!1);var ji=[(t)=>{return},(t)=>null,_e,Mi,$i,Fi,(t)=>!1,(t)=>!0,ma,(t)=>{let e=Et(t),n={};for(let r=0;r<e;r++){let s=ma(t);n[s]=xt(t)}return n},(t)=>{let e=Et(t),n=[];for(let r=0;r<e;r++)n.push(xt(t));return n},Rr],xt=(t)=>ji[127-et(t)](t);class Se extends qt{constructor(t,e){super(t);this.reader=e,this.s=null,this.count=0}read(){if(this.count===0)if(this.s=this.reader(this),Ir(this))this.count=Et(this)+1;else this.count=-1;return this.count--,this.s}}class yt extends qt{constructor(t){super(t);this.s=0,this.count=0}read(){if(this.count===0){this.s=_e(this);let t=pe(this.s);if(this.count=1,t)this.s=-this.s,this.count=Et(this)+2}return this.count--,this.s}}class Gt extends qt{constructor(t){super(t);this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let t=_e(this),e=t&1;if(this.diff=Io(t/2),this.count=1,e)this.count=Et(this)+2}return this.s+=this.diff,this.count--,this.s}}class xn{constructor(t){this.decoder=new yt(t),this.str=ma(this.decoder),this.spos=0}read(){let t=this.spos+this.decoder.read(),e=this.str.slice(this.spos,t);return this.spos=t,e}}var Yc=crypto.subtle,Tr=crypto.getRandomValues.bind(crypto);var yn=()=>Tr(new Uint32Array(1))[0];var qi=[1e7]+-1000+-4000+-8000+-100000000000,Ar=()=>qi.replace(/[018]/g,(t)=>(t^yn()&15>>t/4).toString(16));var hd=Date.now;var bn=(t)=>new Promise(t);var nl=Promise.all.bind(Promise);var kn=(t)=>t===void 0?null:t;class Dr{constructor(){this.map=new Map}setItem(t,e){this.map.set(t,e)}getItem(t){return this.map.get(t)}}var Br=new Dr,Ji=!0;try{if(typeof localStorage<"u"&&localStorage)Br=localStorage,Ji=!1}catch(t){}var Or=Br;var nt=Symbol("Equality"),Ee=(t,e)=>t===e||!!t?.[nt]?.(e)||!1;var vr=(t)=>typeof t==="object",{assign:Nr,keys:Ki}=Object;var Lr=(t,e)=>{for(let n in t)e(t[n],n)};var zt=(t)=>Ki(t).length;var Vr=(t)=>{for(let e in t)return!1;return!0},bt=(t,e)=>{for(let n in t)if(!e(t[n],n))return!1;return!0},Ht=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Sn=(t,e)=>t===e||zt(t)===zt(e)&&bt(t,(n,r)=>(n!==void 0||Ht(e,r))&&Ee(e[r],n)),Wi=Object.freeze,En=(t)=>{for(let e in t){let n=t[e];if(typeof n==="object"||typeof n==="function")En(t[e])}return Wi(t)};var Jt=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{if(n<t.length)Jt(t,e,n+1)}};var Mr=(t)=>t;var Iu=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[nt]!=null)return t[nt](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(let n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let n of t.keys())if(!e.has(n)||!Iu(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(zt(t)!==zt(e))return!1;for(let n in t)if(!Ht(t,n)||!Iu(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Iu(t[n],e[n]))return!1;break;default:return!1}return!0},$r=(t,e)=>e.includes(t);var Pt=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";var rl=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,q,Zi=[],Xi=()=>{if(q===void 0)if(Pt){q=I();let t=process.argv,e=null;for(let n=0;n<t.length;n++){let r=t[n];if(r[0]==="-"){if(e!==null)q.set(e,"");e=r}else if(e!==null)q.set(e,r),e=null;else Zi.push(r)}if(e!==null)q.set(e,"")}else if(typeof location==="object")q=I(),(location.search||"?").slice(1).split("&").forEach((t)=>{if(t.length!==0){let[e,n]=t.split("=");q.set(`--${dn(e,"-")}`,n),q.set(`-${dn(e,"-")}`,n)}});else q=I();return q},Tn=(t)=>Xi().has(t);var Kt=(t)=>Pt?kn(process.env[t.toUpperCase().replaceAll("-","_")]):kn(Or.getItem(t));var Fr=(t)=>Tn("--"+t)||Kt(t)!==null,jr=Fr("production"),Qi=Pt&&$r(process.env.FORCE_COLOR,["true","1","2"]),qr=Qi||!Tn("--no-colors")&&!Fr("no-color")&&(!Pt||process.stdout.isTTY)&&(!Pt||Tn("--color")||Kt("COLORTERM")!==null||(Kt("TERM")||"").includes("color"));var Yi=(t)=>new Uint8Array(t);var Gr=(t)=>{let e=Yi(t.byteLength);return e.set(t),e};class zr{constructor(t,e){this.left=t,this.right=e}}var G=(t,e)=>new zr(t,e);var Cn=(t)=>t.next()>=0.5,Ie=(t,e,n)=>Io(t.next()*(n+1-e)+e);var Dn=(t,e,n)=>Io(t.next()*(n+1-e)+e);var Bn=(t,e,n)=>Dn(t,e,n);var no=(t)=>un(Bn(t,97,122)),Hr=(t,e=0,n=20)=>{let r=Bn(t,e,n),s="";for(let i=0;i<r;i++)s+=no(t);return s};var Ue=(t,e)=>e[Bn(t,0,e.length-1)];var so=Symbol("0schema");class Pr{constructor(){this._rerrs=[]}extend(t,e,n,r=null){this._rerrs.push({path:t,expected:e,has:n,message:r})}toString(){let t=[];for(let e=this._rerrs.length-1;e>0;e--){let n=this._rerrs[e];t.push(yr(" ",(this._rerrs.length-e)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return t.join(`
|
|
2
|
-
`)}}var On=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor)return!1;if(t[nt])return Ee(t,e);if(K(t))return ue(t,(n)=>Rt(e,(r)=>On(n,r)));else if(vr(t))return bt(t,(n,r)=>On(n,e[r]));return!1};class C{static _dilutes=!1;extends(t){let[e,n]=[this.shape,t.shape];if(this.constructor._dilutes)[n,e]=[e,n];return On(e,n)}equals(t){return this.constructor===t.constructor&&Iu(this.shape,t.shape)}[so](){return!0}[nt](t){return this.equals(t)}validate(t){return this.check(t)}check(t,e){N()}get nullable(){return It(this,Re)}get optional(){return new vn(this)}cast(t){return Jr(t,this),t}expect(t){return Jr(t,this),t}}class Ce extends C{constructor(t,e){super();this.shape=t,this._c=e}check(t,e=void 0){let n=t?.constructor===this.shape&&(this._c==null||this._c(t));return!n&&e?.extend(null,this.shape.name,t?.constructor.name,t?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}}var k=(t,e=null)=>new Ce(t,e),il=k(Ce);class De extends C{constructor(t){super();this.shape=t}check(t,e){let n=this.shape(t);return!n&&e?.extend(null,"custom prop",t?.constructor.name,"failed to check custom prop"),n}}var _=(t)=>new De(t),ol=k(De);class Zt extends C{constructor(t){super();this.shape=t}check(t,e){let n=this.shape.some((r)=>r===t);return!n&&e?.extend(null,this.shape.join(" | "),t.toString()),n}}var Be=(...t)=>new Zt(t),Wr=k(Zt),io=RegExp.escape||((t)=>t.replace(/[().|&,$^[\]]/g,(e)=>"\\"+e)),Zr=(t)=>{if(St.check(t))return[io(t)];if(Wr.check(t))return t.shape.map((e)=>e+"");if(ss.check(t))return["[+-]?\\d+.?\\d*"];if(is.check(t))return[".*"];if(Te.check(t))return t.shape.map(Zr).flat(1);B()};class Xr extends C{constructor(t){super();this.shape=t,this._r=new RegExp("^"+t.map(Zr).map((e)=>`(${e.join("|")})`).join("")+"$")}check(t,e){let n=this._r.exec(t)!=null;return!n&&e?.extend(null,this._r.toString(),t.toString(),"String doesn't match string template."),n}}var cl=k(Xr),oo=Symbol("optional");class vn extends C{constructor(t){super();this.shape=t}check(t,e){let n=t===void 0||this.shape.check(t);return!n&&e?.extend(null,"undefined (optional)","()"),n}get[oo](){return!0}}var co=k(vn);class Nn extends C{check(t,e){return e?.extend(null,"never",typeof t),!1}}var ll=new Nn,al=k(Nn);class Oe extends C{constructor(t,e=!1){super();this.shape=t,this._isPartial=e}static _dilutes=!0;get partial(){return new Oe(this.shape,!0)}check(t,e){if(t==null)return e?.extend(null,"object","null"),!1;return bt(this.shape,(n,r)=>{let s=this._isPartial&&!Ht(t,r)||n.check(t[r],e);return!s&&e?.extend(r.toString(),n.toString(),typeof t[r],"Object property does not match"),s})}}var lo=(t)=>new Oe(t),ao=k(Oe),ho=_((t)=>t!=null&&(t.constructor===Object||t.constructor==null));class Rn extends C{constructor(t,e){super();this.shape={keys:t,values:e}}check(t,e){return t!=null&&bt(t,(n,r)=>{let s=this.shape.keys.check(r,e);return!s&&e?.extend(r+"","Record",typeof t,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(n,e)})}}var Qr=(t,e)=>new Rn(t,e),uo=k(Rn);class Ln extends C{constructor(t){super();this.shape=t}check(t,e){return t!=null&&bt(this.shape,(n,r)=>{let s=n.check(t[r],e);return!s&&e?.extend(r.toString(),"Tuple",typeof n),s})}}var fo=(...t)=>new Ln(t),hl=k(Ln);class Vn extends C{constructor(t){super();this.shape=t.length===1?t[0]:new ve(t)}check(t,e){let n=K(t)&&ue(t,(r)=>this.shape.check(r));return!n&&e?.extend(null,"Array",""),n}}var Yr=(...t)=>new Vn(t),po=k(Vn),go=_((t)=>K(t));class Mn extends C{constructor(t,e){super();this.shape=t,this._c=e}check(t,e){let n=t instanceof this.shape&&(this._c==null||this._c(t));return!n&&e?.extend(null,this.shape.name,t?.constructor.name),n}}var mo=(t,e=null)=>new Mn(t,e),ul=k(Mn),wo=mo(C);class ts extends C{constructor(t){super();this.len=t.length-1,this.args=fo(...t.slice(-1)),this.res=t[this.len]}check(t,e){let n=t.constructor===Function&&t.length<=this.len;return!n&&e?.extend(null,"function",typeof t),n}}var xo=k(ts),yo=_((t)=>typeof t==="function");class es extends C{constructor(t){super();this.shape=t}check(t,e){let n=ue(this.shape,(r)=>r.check(t,e));return!n&&e?.extend(null,"Intersectinon",typeof t),n}}var dl=k(es,(t)=>t.shape.length>0);class ve extends C{static _dilutes=!0;constructor(t){super();this.shape=t}check(t,e){let n=Rt(this.shape,(r)=>r.check(t,e));return e?.extend(null,"Union",typeof t),n}}var It=(...t)=>t.findIndex((e)=>Te.check(e))>=0?It(...t.map((e)=>Wt(e)).map((e)=>Te.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new ve(t),Te=k(ve),ns=()=>!0,Ae=_(ns),bo=k(De,(t)=>t.shape===ns),$n=_((t)=>typeof t==="bigint"),ko=_((t)=>t===$n),rs=_((t)=>typeof t==="symbol"),fl=_((t)=>t===rs),_t=_((t)=>typeof t==="number"),ss=_((t)=>t===_t),St=_((t)=>typeof t==="string"),is=_((t)=>t===St),Ne=_((t)=>typeof t==="boolean"),_o=_((t)=>t===Ne),os=Be(void 0),pl=k(Zt,(t)=>t.shape.length===1&&t.shape[0]===void 0),gl=Be(void 0);var Re=Be(null),So=k(Zt,(t)=>t.shape.length===1&&t.shape[0]===null),ml=k(Uint8Array),wl=k(Ce,(t)=>t.shape===Uint8Array),Eo=It(_t,St,Re,os,$n,Ne,rs),xl=(()=>{let t=Yr(Ae),e=Qr(St,Ae),n=It(_t,St,Re,Ne,t,e);return t.shape=n,e.shape.values=n,n})(),Wt=(t)=>{if(wo.check(t))return t;else if(ho.check(t)){let e={};for(let n in t)e[n]=Wt(t[n]);return lo(e)}else if(go.check(t))return It(...t.map(Wt));else if(Eo.check(t))return Be(t);else if(yo.check(t))return k(t);B()},Jr=jr?()=>{}:(t,e)=>{let n=new Pr;if(!e.check(t,n))throw v(`Expected value to be of type ${e.constructor.name}.
|
|
3
|
-
${n.toString()}`)};class cs{constructor(t){this.patterns=[],this.$state=t}if(t,e){return this.patterns.push({if:Wt(t),h:e}),this}else(t){return this.if(Ae,t)}done(){return(t,e)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(t))return r.h(t,e)}throw v("Unhandled pattern")}}}var Uo=(t)=>new cs(t),ls=Uo(Ae).if(ss,(t,e)=>Ie(e,an,ut)).if(is,(t,e)=>Hr(e)).if(_o,(t,e)=>Cn(e)).if(ko,(t,e)=>BigInt(Ie(e,an,ut))).if(Te,(t,e)=>kt(e,Ue(e,t.shape))).if(ao,(t,e)=>{let n={};for(let r in t.shape){let s=t.shape[r];if(co.check(s)){if(Cn(e))continue;s=s.shape}n[r]=ls(s,e)}return n}).if(po,(t,e)=>{let n=[],r=Dn(e,0,42);for(let s=0;s<r;s++)n.push(kt(e,t.shape));return n}).if(Wr,(t,e)=>Ue(e,t.shape)).if(So,(t,e)=>null).if(xo,(t,e)=>{let n=kt(e,t.res);return()=>n}).if(bo,(t,e)=>kt(e,Ue(e,[_t,St,Re,os,$n,Ne,Yr(_t),Qr(It("a","b","c"),_t)]))).if(uo,(t,e)=>{let n={},r=Ie(e,0,3);for(let s=0;s<r;s++){let i=kt(e,t.shape.keys),o=kt(e,t.shape.values);n[i]=o}return n}).done(),kt=(t,e)=>ls(Wt(e),t);var rt=typeof document<"u"?document:{};var yl=_((t)=>t.nodeType===Bo);var bl=typeof DOMParser<"u"?new DOMParser:null;var kl=_((t)=>t.nodeType===Ao);var _l=_((t)=>t.nodeType===Co);var as=(t)=>ur(t,(e,n)=>`${n}:${e};`).join("");var{ELEMENT_NODE:Ao,TEXT_NODE:Co,CDATA_SECTION_NODE:Sl,COMMENT_NODE:El,DOCUMENT_NODE:Do,DOCUMENT_TYPE_NODE:Il,DOCUMENT_FRAGMENT_NODE:Bo}=rt,Ul=_((t)=>t.nodeType===Do);var z=Symbol;var Xt=z(),Qt=z(),Fn=z(),jn=z(),qn=z(),Yt=z(),Gn=z(),Ut=z(),zn=z(),hs=(t)=>{if(t.length===1&&t[0]?.constructor===Function)t=t[0]();let e=[],n=[],r=0;for(;r<t.length;r++){let s=t[r];if(s===void 0)break;else if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}if(r>0)n.push(e.join(""));for(;r<t.length;r++){let s=t[r];if(!(s instanceof Symbol))n.push(s)}return n};var Tl=hd();var Ro={[Xt]:G("font-weight","bold"),[Qt]:G("font-weight","normal"),[Fn]:G("color","blue"),[qn]:G("color","green"),[jn]:G("color","grey"),[Yt]:G("color","red"),[Gn]:G("color","purple"),[Ut]:G("color","orange"),[zn]:G("color","black")},Lo=(t)=>{if(t.length===1&&t[0]?.constructor===Function)t=t[0]();let e=[],n=[],r=I(),s=[],i=0;for(;i<t.length;i++){let o=t[i],c=Ro[o];if(c!==void 0)r.set(c.left,c.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){let a=as(r);if(i>0||a.length>0)e.push("%c"+o),n.push(a);else e.push(o)}else break}}if(i>0)s=n,s.unshift(e.join(""));for(;i<t.length;i++){let o=t[i];if(!(o instanceof Symbol))s.push(o)}return s},us=qr?Lo:hs,ds=(...t)=>{console.log(...us(t)),fs.forEach((e)=>e.print(t))},Hn=(...t)=>{console.warn(...us(t)),t.unshift(Ut),fs.forEach((e)=>e.print(t))};var fs=j();var gs=(t)=>({[Symbol.iterator](){return this},next:t}),ms=(t,e)=>gs(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Le=(t,e)=>gs(()=>{let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class se{constructor(t,e){this.clock=t,this.len=e}}class lt{constructor(){this.clients=new Map}}var Ct=(t,e,n)=>e.clients.forEach((r,s)=>{let i=t.doc.store.clients.get(s);if(i!=null){let o=i[i.length-1],c=o.id.clock+o.length;for(let a=0,d=r[a];a<r.length&&d.clock<c;d=r[++a])Hs(t,i,d.clock,d.len,n)}}),$o=(t,e)=>{let n=0,r=t.length-1;while(n<=r){let s=Io((n+r)/2),i=t[s],o=i.clock;if(o<=e){if(e<o+i.len)return s;n=s+1}else r=s-1}return null},ie=(t,e)=>{let n=t.clients.get(e.client);return n!==void 0&&$o(n,e.clock)!==null},Xn=(t)=>{t.clients.forEach((e)=>{e.sort((s,i)=>s.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){let s=e[r-1],i=e[n];if(s.clock+s.len>=i.clock)e[r-1]=new se(s.clock,W(s.len,i.clock+i.len-s.clock));else{if(r<n)e[r]=i;r++}}e.length=r})},Pn=(t)=>{let e=new lt;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,s)=>{if(!e.clients.has(s)){let i=r.slice();for(let o=n+1;o<t.length;o++)fr(i,t[o].clients.get(s)||[]);e.clients.set(s,i)}});return Xn(e),e},te=(t,e,n,r)=>{M(t.clients,e,()=>[]).push(new se(n,r))},Os=()=>new lt,Fo=(t)=>{let e=Os();return t.clients.forEach((n,r)=>{let s=[];for(let i=0;i<n.length;i++){let o=n[i];if(o.deleted){let c=o.id.clock,a=o.length;if(i+1<n.length)for(let d=n[i+1];i+1<n.length&&d.deleted;d=n[++i+1])a+=d.length;s.push(new se(c,a))}}if(s.length>0)e.clients.set(r,s)}),e},Bt=(t,e)=>{ft(t.restEncoder,e.clients.size),F(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),ft(t.restEncoder,n);let s=r.length;ft(t.restEncoder,s);for(let i=0;i<s;i++){let o=r[i];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},Qn=(t)=>{let e=new lt,n=Et(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();let s=Et(t.restDecoder),i=Et(t.restDecoder);if(i>0){let o=M(e.clients,s,()=>[]);for(let c=0;c<i;c++)o.push(new se(t.readDsClock(),t.readDsLen()))}}return e},ws=(t,e,n)=>{let r=new lt,s=Et(t.restDecoder);for(let i=0;i<s;i++){t.resetDsCurVal();let o=Et(t.restDecoder),c=Et(t.restDecoder),a=n.clients.get(o)||[],d=y(n,o);for(let l=0;l<c;l++){let h=t.readDsClock(),u=h+t.readDsLen();if(h<d){if(d<u)te(r,o,d,u-d);let f=H(a,h),p=a[f];if(!p.deleted&&p.id.clock<h)a.splice(f+1,0,Xe(e,p,h-p.id.clock)),f++;while(f<a.length)if(p=a[f++],p.id.clock<u){if(!p.deleted){if(u<p.id.clock+p.length)a.splice(f,0,Xe(e,p,u-p.id.clock));p.delete(e)}}else break}else te(r,o,h,u-h)}}if(r.clients.size>0){let i=new Y;return ft(i.restEncoder,0),Bt(i,r),i.toUint8Array()}return null};var vs=yn;class vc extends de{constructor({guid:t=Ar(),collectionid:e=null,gc:n=!0,gcFilter:r=()=>!0,meta:s=null,autoLoad:i=!1,shouldLoad:o=!0}={}){super();this.gc=n,this.gcFilter=r,this.clientID=vs(),this.guid=t,this.collectionid=e,this.share=new Map,this.store=new sr,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=i,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=bn((a)=>{this.on("load",()=>{this.isLoaded=!0,a(this)})});let c=()=>bn((a)=>{let d=(l)=>{if(l===void 0||l===!0)this.off("sync",d),a()};this.on("sync",d)});this.on("sync",(a)=>{if(a===!1&&this.isSynced)this.whenSynced=c();if(this.isSynced=a===void 0||a===!0,this.isSynced&&!this.isLoaded)this.emit("load",[this])}),this.whenSynced=c()}load(){let t=this._item;if(t!==null&&!this.shouldLoad)w(t.parent.doc,(e)=>{e.subdocsLoaded.add(this)},null,!0);this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(F(this.subdocs).map((t)=>t.guid))}transact(t,e=null){return w(this,t,e)}get(t,e=S){let n=M(this.share,t,()=>{let s=new e;return s._integrate(this,null),s}),r=n.constructor;if(e!==S&&r!==e)if(r===S){let s=new e;s._map=n._map,n._map.forEach((i)=>{for(;i!==null;i=i.left)i.parent=s}),s._start=n._start;for(let i=s._start;i!==null;i=i.right)i.parent=s;return s._length=n._length,this.share.set(t,s),s._integrate(this,null),s}else throw Error(`Type with the name ${t} has already been defined with a different constructor`);return n}getArray(t=""){return this.get(t,Bs)}getText(t=""){return this.get(t,ps)}getMap(t=""){return this.get(t,Zo)}getXmlElement(t=""){return this.get(t,Dt)}getXmlFragment(t=""){return this.get(t,ot)}toJSON(){let t={};return this.share.forEach((e,n)=>{t[n]=e.toJSON()}),t}destroy(){this.isDestroyed=!0,F(this.subdocs).forEach((e)=>e.destroy());let t=this._item;if(t!==null){this._item=null;let e=t.content;e.doc=new vc({guid:this.guid,...e.opts,shouldLoad:!1}),e.doc._item=t,w(t.parent.doc,(n)=>{let r=e.doc;if(!t.deleted)n.subdocsAdded.add(r);n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Yn{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return Et(this.restDecoder)}readDsLen(){return Et(this.restDecoder)}}class tr extends Yn{readLeftID(){return g(Et(this.restDecoder),Et(this.restDecoder))}readRightID(){return g(Et(this.restDecoder),Et(this.restDecoder))}readClient(){return Et(this.restDecoder)}readInfo(){return et(this.restDecoder)}readString(){return ma(this.restDecoder)}readParentInfo(){return Et(this.restDecoder)===1}readTypeRef(){return Et(this.restDecoder)}readLen(){return Et(this.restDecoder)}readAny(){return xt(this.restDecoder)}readBuf(){return Gr(Rr(this.restDecoder))}readJSON(){return JSON.parse(ma(this.restDecoder))}readKey(){return ma(this.restDecoder)}}class Ns{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Et(this.restDecoder),this.dsCurrVal}readDsLen(){let t=Et(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class it extends Ns{constructor(t){super(t);this.keys=[],Et(t),this.keyClockDecoder=new Gt(Rr(t)),this.clientDecoder=new yt(Rr(t)),this.leftClockDecoder=new Gt(Rr(t)),this.rightClockDecoder=new Gt(Rr(t)),this.infoDecoder=new Se(Rr(t),et),this.stringDecoder=new xn(Rr(t)),this.parentInfoDecoder=new Se(Rr(t),et),this.typeRefDecoder=new yt(Rr(t)),this.lenDecoder=new yt(Rr(t))}readLeftID(){return new st(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new st(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return xt(this.restDecoder)}readBuf(){return Rr(this.restDecoder)}readJSON(){return xt(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];else{let e=this.stringDecoder.read();return this.keys.push(e),e}}}class er{constructor(){this.restEncoder=ha()}toUint8Array(){return Kr(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){ft(this.restEncoder,t)}writeDsLen(t){ft(this.restEncoder,t)}}class Ot extends er{writeLeftID(t){ft(this.restEncoder,t.client),ft(this.restEncoder,t.clock)}writeRightID(t){ft(this.restEncoder,t.client),ft(this.restEncoder,t.clock)}writeClient(t){ft(this.restEncoder,t)}writeInfo(t){xe(this.restEncoder,t)}writeString(t){pa(this.restEncoder,t)}writeParentInfo(t){ft(this.restEncoder,t?1:0)}writeTypeRef(t){ft(this.restEncoder,t)}writeLen(t){ft(this.restEncoder,t)}writeAny(t){gt(this.restEncoder,t)}writeBuf(t){wr(this.restEncoder,t)}writeJSON(t){pa(this.restEncoder,JSON.stringify(t))}writeKey(t){pa(this.restEncoder,t)}}class nr{constructor(){this.restEncoder=ha(),this.dsCurrVal=0}toUint8Array(){return Kr(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){let e=t-this.dsCurrVal;this.dsCurrVal=t,ft(this.restEncoder,e)}writeDsLen(t){if(t===0)B();ft(this.restEncoder,t-1),this.dsCurrVal+=t}}class Y extends nr{constructor(){super();this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new jt,this.clientEncoder=new wt,this.leftClockEncoder=new jt,this.rightClockEncoder=new jt,this.infoEncoder=new be(xe),this.stringEncoder=new gn,this.parentInfoEncoder=new be(xe),this.typeRefEncoder=new wt,this.lenEncoder=new wt}toUint8Array(){let t=ha();return ft(t,0),wr(t,this.keyClockEncoder.toUint8Array()),wr(t,this.clientEncoder.toUint8Array()),wr(t,this.leftClockEncoder.toUint8Array()),wr(t,this.rightClockEncoder.toUint8Array()),wr(t,Kr(this.infoEncoder)),wr(t,this.stringEncoder.toUint8Array()),wr(t,Kr(this.parentInfoEncoder)),wr(t,this.typeRefEncoder.toUint8Array()),wr(t,this.lenEncoder.toUint8Array()),Ft(t,Kr(this.restEncoder)),Kr(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(t?1:0)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){gt(this.restEncoder,t)}writeBuf(t){wr(this.restEncoder,t)}writeJSON(t){gt(this.restEncoder,t)}writeKey(t){let e=this.keyMap.get(t);if(e===void 0)this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t);else this.keyClockEncoder.write(e)}}var jo=(t,e,n,r)=>{r=W(r,e[0].id.clock);let s=H(e,r);ft(t.restEncoder,e.length-s),t.writeClient(n),ft(t.restEncoder,r);let i=e[s];i.write(t,r-i.id.clock);for(let o=s+1;o<e.length;o++)e[o].write(t,0)},rr=(t,e,n)=>{let r=new Map;n.forEach((s,i)=>{if(y(e,i)>s)r.set(i,s)}),Qe(e).forEach((s,i)=>{if(!n.has(i))r.set(i,0)}),ft(t.restEncoder,r.size),F(r.entries()).sort((s,i)=>i[0]-s[0]).forEach(([s,i])=>{jo(t,e.clients.get(s),s,i)})},qo=(t,e)=>{let n=I(),r=Et(t.restDecoder);for(let s=0;s<r;s++){let i=Et(t.restDecoder),o=Array(i),c=t.readClient(),a=Et(t.restDecoder);n.set(c,{i:0,refs:o});for(let d=0;d<i;d++){let l=t.readInfo();switch(Mt&l){case 0:{let h=t.readLen();o[d]=new R(g(c,a),h),a+=h;break}case 10:{let h=Et(t.restDecoder);o[d]=new L(g(c,a),h),a+=h;break}default:{let h=(l&(V|A))===0,u=new x(g(c,a),null,(l&A)===A?t.readLeftID():null,null,(l&V)===V?t.readRightID():null,h?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,h&&(l&ht)===ht?t.readString():null,gi(t,l));o[d]=u,a+=u.length}}}}return n},Go=(t,e,n)=>{let r=[],s=F(n.keys()).sort((f,p)=>f-p);if(s.length===0)return null;let i=()=>{if(s.length===0)return null;let f=n.get(s[s.length-1]);while(f.refs.length===f.i)if(s.pop(),s.length>0)f=n.get(s[s.length-1]);else return null;return f},o=i();if(o===null)return null;let c=new sr,a=new Map,d=(f,p)=>{let m=a.get(f);if(m==null||m>p)a.set(f,p)},l=o.refs[o.i++],h=new Map,u=()=>{for(let f of r){let p=f.id.client,m=n.get(p);if(m)m.i--,c.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[];else c.clients.set(p,[f]);s=s.filter((T)=>T!==p)}r.length=0};while(!0){if(l.constructor!==L){let p=M(h,l.id.client,()=>y(e,l.id.client))-l.id.clock;if(p<0)r.push(l),d(l.id.client,l.id.clock-1),u();else{let m=l.getMissing(t,e);if(m!==null){r.push(l);let T=n.get(m)||{refs:[],i:0};if(T.refs.length===T.i)d(m,y(e,m)),u();else{l=T.refs[T.i++];continue}}else if(p===0||p<l.length)l.integrate(t,p),h.set(l.id.client,l.id.clock+l.length)}}if(r.length>0)l=r.pop();else if(o!==null&&o.i<o.refs.length)l=o.refs[o.i++];else if(o=i(),o===null)break;else l=o.refs[o.i++]}if(c.clients.size>0){let f=new Y;return rr(f,c,new Map),ft(f.restEncoder,0),{missing:a,update:f.toUint8Array()}}return null},zo=(t,e)=>rr(t,e.doc.store,e.beforeState),Ho=(t,e,n,r=new it(t))=>w(e,(s)=>{s.local=!1;let i=!1,o=s.doc,c=o.store,a=qo(r,o),d=Go(s,c,a),l=c.pendingStructs;if(l){for(let[u,f]of l.missing)if(f<y(c,u)){i=!0;break}if(d){for(let[u,f]of d.missing){let p=l.missing.get(u);if(p==null||p>f)l.missing.set(u,f)}l.update=ze([l.update,d.update])}}else c.pendingStructs=d;let h=ws(r,s,c);if(c.pendingDs){let u=new it(fa(c.pendingDs));Et(u.restDecoder);let f=ws(u,s,c);if(h&&f)c.pendingDs=ze([h,f]);else c.pendingDs=h||f}else c.pendingDs=h;if(i){let u=c.pendingStructs.update;c.pendingStructs=null,Rs(s.doc,u)}},n,!1);var Rs=(t,e,n,r=it)=>{let s=fa(e);Ho(s,t,n,new r(s))},Ik=(t,e,n)=>Rs(t,e,n,tr),Jo=(t,e,n=new Map)=>{rr(t,e.store,n),Bt(t,Fo(e.store))},Po=(t,e=new Uint8Array([0]),n=new Y)=>{let r=Ls(e);Jo(n,t,r);let s=[n.toUint8Array()];if(t.store.pendingDs)s.push(t.store.pendingDs);if(t.store.pendingStructs)s.push(lc(t.store.pendingStructs.update,e));if(s.length>1){if(n.constructor===Ot)return oc(s.map((i,o)=>o===0?i:hc(i)));else if(n.constructor===Y)return ze(s)}return s[0]},Dk=(t,e)=>Po(t,e,new Ot),Ko=(t)=>{let e=new Map,n=Et(t.restDecoder);for(let r=0;r<n;r++){let s=Et(t.restDecoder),i=Et(t.restDecoder);e.set(s,i)}return e},Ls=(t)=>Ko(new Yn(fa(t))),Vs=(t,e)=>(ft(t.restEncoder,e.size),F(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{ft(t.restEncoder,n),ft(t.restEncoder,r)}),t),Wo=(t,e)=>Vs(t,Qe(e.store)),Xo=(t,e=new nr)=>{if(t instanceof Map)Vs(e,t);else Wo(e,t);return e.toUint8Array()},Nk=(t)=>Xo(t,new er);class Ms{constructor(){this.l=[]}}var xs=()=>new Ms,ys=(t,e)=>t.l.push(e),bs=(t,e)=>{let n=t.l,r=n.length;if(t.l=n.filter((s)=>e!==s),r===t.l.length)console.error("[yjs] Tried to remove event handler that doesn't exist.")},$s=(t,e,n)=>Jt(t.l,[e,n]);class st{constructor(t,e){this.client=t,this.clock=e}}var Ve=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,g=(t,e)=>new st(t,e);var Fs=(t)=>{for(let[e,n]of t.doc.share.entries())if(n===t)return e;throw B()},Ge=(t,e)=>{while(e!==null){if(e.parent===t)return!0;e=e.parent._item}return!1};class js{constructor(t,e,n,r=0){this.type=t,this.tname=e,this.item=n,this.assoc=r}}class qs{constructor(t,e,n=0){this.type=t,this.index=e,this.assoc=n}}var Qo=(t,e,n=0)=>new qs(t,e,n),Me=(t,e,n)=>{let r=null,s=null;if(t._item===null)s=Fs(t);else r=g(t._item.id.client,t._item.id.clock);return new js(r,s,e,n)},ow=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Me(t,null,n);e--}while(r!==null){if(!r.deleted&&r.countable){if(r.length>e)return Me(t,g(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Me(t,r.lastId,n);r=r.right}return Me(t,null,n)};var Yo=(t,e)=>{let n=At(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},Hf=(t,e,n=!0)=>{let r=e.store,{item:s,type:i,tname:o,assoc:c}=t,a=null,d=0;if(s!==null){if(y(r,s.client)<=s.clock)return null;let l=n?Zn(r,s):Yo(r,s),h=l.item;if(!(h instanceof x))return null;if(a=h.parent,a._item===null||!a._item.deleted){d=h.deleted||!h.countable?0:l.diff+(c>=0?0:1);let u=h.left;while(u!==null){if(!u.deleted&&u.countable)d+=u.length;u=u.left}}}else{if(o!==null)a=e.get(o);else if(i!==null){if(y(r,i.client)<=i.clock)return null;let{item:l}=n?Zn(r,i):{item:At(r,i)};if(l instanceof x&&l.content instanceof P)a=l.content.type;else return null}else throw B();if(c>=0)d=a._length;else d=0}return Qo(a,d,t.assoc)};class Gs{constructor(t,e){this.ds=t,this.sv=e}}var tc=(t,e)=>new Gs(t,e),Ml=tc(Os(),new Map);var Tt=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!ie(e.ds,t.id),Kn=(t,e)=>{let n=M(t.meta,Kn,j),r=t.doc.store;if(!n.has(e))e.sv.forEach((s,i)=>{if(s<y(r,i))O(t,g(i,s))}),Ct(t,e.ds,(s)=>{}),n.add(e)};class sr{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}var Qe=(t)=>{let e=new Map;return t.clients.forEach((n,r)=>{let s=n[n.length-1];e.set(r,s.id.clock+s.length)}),e},y=(t,e)=>{let n=t.clients.get(e);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},zs=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{let r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw B()}n.push(e)},H=(t,e)=>{let n=0,r=t.length-1,s=t[r],i=s.id.clock;if(i===e)return r;let o=Io(e/(i+s.length-1)*r);while(n<=r){if(s=t[o],i=s.id.clock,i<=e){if(e<i+s.length)return o;n=o+1}else r=o-1;o=Io((n+r)/2)}throw B()},ec=(t,e)=>{let n=t.clients.get(e.client);return n[H(n,e.clock)]},At=ec,Wn=(t,e,n)=>{let r=H(e,n),s=e[r];if(s.id.clock<n&&s instanceof x)return e.splice(r+1,0,Xe(t,s,n-s.id.clock)),r+1;return r},O=(t,e)=>{let n=t.doc.store.clients.get(e.client);return n[Wn(t,n,e.clock)]},ks=(t,e,n)=>{let r=e.clients.get(n.client),s=H(r,n.clock),i=r[s];if(n.clock!==i.id.clock+i.length-1&&i.constructor!==R)r.splice(s+1,0,Xe(t,i,n.clock-i.id.clock+1));return i},nc=(t,e,n)=>{let r=t.clients.get(e.id.client);r[H(r,e.id.clock)]=n},Hs=(t,e,n,r,s)=>{if(r===0)return;let i=n+r,o=Wn(t,e,n),c;do{if(c=e[o++],i<c.id.clock+c.length)Wn(t,e,i);s(c)}while(o<e.length&&e[o].id.clock<i)};class Js{constructor(t,e,n){this.doc=t,this.deleteSet=new lt,this.beforeState=Qe(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=e,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}var _s=(t,e)=>{if(e.deleteSet.clients.size===0&&!dr(e.afterState,(n,r)=>e.beforeState.get(r)!==n))return!1;return Xn(e.deleteSet),zo(t,e),Bt(t,e.deleteSet),!0},Ss=(t,e,n)=>{let r=e._item;if(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)M(t.changed,e,j).add(n)},je=(t,e)=>{let n=t[e],r=t[e-1],s=e;for(;s>0;n=r,r=t[--s-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor){if(r.mergeWith(n)){if(n instanceof x&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n)n.parent._map.set(n.parentSub,r);continue}}break}let i=e-s;if(i)t.splice(e+1-i,i);return i},rc=(t,e,n)=>{for(let[r,s]of t.clients.entries()){let i=e.clients.get(r);for(let o=s.length-1;o>=0;o--){let c=s[o],a=c.clock+c.len;for(let d=H(i,c.clock),l=i[d];d<i.length&&l.id.clock<a;l=i[++d]){let h=i[d];if(c.clock+c.len<=h.id.clock)break;if(h instanceof x&&h.deleted&&!h.keep&&n(h))h.gc(e,!1)}}}},sc=(t,e)=>{t.clients.forEach((n,r)=>{let s=e.clients.get(r);for(let i=n.length-1;i>=0;i--){let o=n[i],c=fe(s.length-1,1+H(s,o.clock+o.len-1));for(let a=c,d=s[a];a>0&&d.id.clock>=o.clock;d=s[a])a-=1+je(s,a)}})};var Ps=(t,e)=>{if(e<t.length){let n=t[e],r=n.doc,s=r.store,{deleteSet:i,_mergeStructs:o}=n;try{Xn(i),n.afterState=Qe(n.doc.store),r.emit("beforeObserverCalls",[n,r]);let c=[];n.changed.forEach((a,d)=>c.push(()=>{if(d._item===null||!d._item.deleted)d._callObserver(n,a)})),c.push(()=>{n.changedParentTypes.forEach((a,d)=>{if(d._dEH.l.length>0&&(d._item===null||!d._item.deleted))c.push(()=>{a=a.filter((l)=>l.target._item===null||!l.target._item.deleted),a.forEach((l)=>{l.currentTarget=d,l._path=null}),a.sort((l,h)=>l.path.length-h.path.length),$s(d._dEH,a,n)})}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{if(n._needFormattingCleanup)kc(n)})}),Jt(c,[])}finally{if(r.gc)rc(i,s,r.gcFilter);sc(i,s),n.afterState.forEach((l,h)=>{let u=n.beforeState.get(h)||0;if(u!==l){let f=s.clients.get(h),p=W(H(f,u),1);for(let m=f.length-1;m>=p;)m-=1+je(f,m)}});for(let l=o.length-1;l>=0;l--){let{client:h,clock:u}=o[l].id,f=s.clients.get(h),p=H(f,u);if(p+1<f.length){if(je(f,p+1)>1)continue}if(p>0)je(f,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID))ds(Ut,Xt,"[yjs] ",Qt,Yt,"Changed the client-id because another client seems to be using it."),r.clientID=vs();if(r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){let l=new Ot;if(_s(l,n))r.emit("update",[l.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){let l=new Y;if(_s(l,n))r.emit("updateV2",[l.toUint8Array(),n.origin,r,n])}let{subdocsAdded:c,subdocsLoaded:a,subdocsRemoved:d}=n;if(c.size>0||d.size>0||a.size>0)c.forEach((l)=>{if(l.clientID=r.clientID,l.collectionid==null)l.collectionid=r.collectionid;r.subdocs.add(l)}),d.forEach((l)=>r.subdocs.delete(l)),r.emit("subdocs",[{loaded:a,added:c,removed:d},r,n]),d.forEach((l)=>l.destroy());if(t.length<=e+1)r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t]);else Ps(t,e+1)}}},w=(t,e,n=null,r=!0)=>{let s=t._transactionCleanups,i=!1,o=null;if(t._transaction===null){if(i=!0,t._transaction=new Js(t,n,r),s.push(t._transaction),s.length===1)t.emit("beforeAllTransactions",[t]);t.emit("beforeTransaction",[t._transaction,t])}try{o=e(t._transaction)}finally{if(i){let c=t._transaction===s[0];if(t._transaction=null,c)Ps(s,0)}}return o};class Ks{constructor(t,e){this.insertions=e,this.deletions=t,this.meta=new Map}}var Es=(t,e,n)=>{Ct(t,n.deletions,(r)=>{if(r instanceof x&&e.scope.some((s)=>s===t.doc||Ge(s,r)))ar(r,!1)})},Is=(t,e,n)=>{let r=null,{doc:s,scope:i}=t;w(s,(c)=>{while(e.length>0&&t.currStackItem===null){let a=s.store,d=e.pop(),l=new Set,h=[],u=!1;Ct(c,d.insertions,(f)=>{if(f instanceof x){if(f.redone!==null){let{item:p,diff:m}=Zn(a,f.id);if(m>0)p=O(c,g(p.id.client,p.id.clock+m));f=p}if(!f.deleted&&i.some((p)=>p===c.doc||Ge(p,f)))h.push(f)}}),Ct(c,d.deletions,(f)=>{if(f instanceof x&&i.some((p)=>p===c.doc||Ge(p,f))&&!ie(d.insertions,f.id))l.add(f)}),l.forEach((f)=>{u=pi(c,f,l,d.insertions,t.ignoreRemoteMapChanges,t)!==null||u});for(let f=h.length-1;f>=0;f--){let p=h[f];if(t.deleteFilter(p))p.delete(c),u=!0}t.currStackItem=u?d:null}c.changed.forEach((a,d)=>{if(a.has(null)&&d._searchMarker)d._searchMarker.length=0}),r=c},t);let o=t.currStackItem;if(o!=null){let c=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return o};class pI extends de{constructor(t,{captureTimeout:e=500,captureTransaction:n=(c)=>!0,deleteFilter:r=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:i=!1,doc:o=K(t)?t[0].doc:t instanceof vc?t:t.doc}={}){super();this.scope=[],this.doc=o,this.addToScope(t),this.deleteFilter=r,s.add(this),this.trackedOrigins=s,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=i,this.captureTimeout=e,this.afterTransactionHandler=(c)=>{if(!this.captureTransaction(c)||!this.scope.some((m)=>c.changedParentTypes.has(m)||m===this.doc)||!this.trackedOrigins.has(c.origin)&&(!c.origin||!this.trackedOrigins.has(c.origin.constructor)))return;let a=this.undoing,d=this.redoing,l=a?this.redoStack:this.undoStack;if(a)this.stopCapturing();else if(!d)this.clear(!1,!0);let h=new lt;c.afterState.forEach((m,T)=>{let b=c.beforeState.get(T)||0,hr=m-b;if(hr>0)te(h,T,b,hr)});let u=hd(),f=!1;if(this.lastChange>0&&u-this.lastChange<this.captureTimeout&&l.length>0&&!a&&!d){let m=l[l.length-1];m.deletions=Pn([m.deletions,c.deleteSet]),m.insertions=Pn([m.insertions,h])}else l.push(new Ks(c.deleteSet,h)),f=!0;if(!a&&!d)this.lastChange=u;Ct(c,c.deleteSet,(m)=>{if(m instanceof x&&this.scope.some((T)=>T===c.doc||Ge(T,m)))ar(m,!0)});let p=[{stackItem:l[l.length-1],origin:c.origin,type:a?"redo":"undo",changedParentTypes:c.changedParentTypes},this];if(f)this.emit("stack-item-added",p);else this.emit("stack-item-updated",p)},this.destroy=this.destroy.bind(this),this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",this.destroy)}addToScope(t){let e=new Set(this.scope);t=K(t)?t:[t],t.forEach((n)=>{if(!e.has(n)){if(e.add(n),n instanceof S?n.doc!==this.doc:n!==this.doc)Hn("[yjs#509] Not same Y.Doc");this.scope.push(n)}})}addTrackedOrigin(t){this.trackedOrigins.add(t)}removeTrackedOrigin(t){this.trackedOrigins.delete(t)}clear(t=!0,e=!0){if(t&&this.canUndo()||e&&this.canRedo())this.doc.transact((n)=>{if(t)this.undoStack.forEach((r)=>Es(n,this,r)),this.undoStack=[];if(e)this.redoStack.forEach((r)=>Es(n,this,r)),this.redoStack=[];this.emit("stack-cleared",[{undoStackCleared:t,redoStackCleared:e}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let t;try{t=Is(this,this.undoStack,"undo")}finally{this.undoing=!1}return t}redo(){this.redoing=!0;let t;try{t=Is(this,this.redoStack,"redo")}finally{this.redoing=!1}return t}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),this.doc.off("destroy",this.destroy),super.destroy()}}function*ic(t){let e=Et(t.restDecoder);for(let n=0;n<e;n++){let r=Et(t.restDecoder),s=t.readClient(),i=Et(t.restDecoder);for(let o=0;o<r;o++){let c=t.readInfo();if(c===10){let a=Et(t.restDecoder);yield new L(g(s,i),a),i+=a}else if((Mt&c)!==0){let a=(c&(V|A))===0,d=new x(g(s,i),null,(c&A)===A?t.readLeftID():null,null,(c&V)===V?t.readRightID():null,a?t.readParentInfo()?t.readString():t.readLeftID():null,a&&(c&ht)===ht?t.readString():null,gi(t,c));yield d,i+=d.length}else{let a=t.readLen();yield new R(g(s,i),a),i+=a}}}}class Ye{constructor(t,e){this.gen=ic(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===L);return this.curr}}class tn{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}var oc=(t)=>ze(t,tr,Ot);var cc=(t,e)=>{if(t.constructor===R){let{client:n,clock:r}=t.id;return new R(g(n,r+e),t.length-e)}else if(t.constructor===L){let{client:n,clock:r}=t.id;return new L(g(n,r+e),t.length-e)}else{let n=t,{client:r,clock:s}=n.id;return new x(g(r,s+e),null,g(r,s+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},ze=(t,e=it,n=Y)=>{if(t.length===1)return t[0];let r=t.map((l)=>new e(fa(l))),s=r.map((l)=>new Ye(l,!0)),i=null,o=new n,c=new tn(o);while(!0){if(s=s.filter((u)=>u.curr!==null),s.sort((u,f)=>{if(u.curr.id.client===f.curr.id.client){let p=u.curr.id.clock-f.curr.id.clock;if(p===0)return u.curr.constructor===f.curr.constructor?0:u.curr.constructor===L?1:-1;else return p}else return f.curr.id.client-u.curr.id.client}),s.length===0)break;let l=s[0],h=l.curr.id.client;if(i!==null){let u=l.curr,f=!1;while(u!==null&&u.id.clock+u.length<=i.struct.id.clock+i.struct.length&&u.id.client>=i.struct.id.client)u=l.next(),f=!0;if(u===null||u.id.client!==h||f&&u.id.clock>i.struct.id.clock+i.struct.length)continue;if(h!==i.struct.id.client)X(c,i.struct,i.offset),i={struct:u,offset:0},l.next();else if(i.struct.id.clock+i.struct.length<u.id.clock)if(i.struct.constructor===L)i.struct.length=u.id.clock+u.length-i.struct.id.clock;else{X(c,i.struct,i.offset);let p=u.id.clock-i.struct.id.clock-i.struct.length;i={struct:new L(g(h,i.struct.id.clock+i.struct.length),p),offset:0}}else{let p=i.struct.id.clock+i.struct.length-u.id.clock;if(p>0)if(i.struct.constructor===L)i.struct.length-=p;else u=cc(u,p);if(!i.struct.mergeWith(u))X(c,i.struct,i.offset),i={struct:u,offset:0},l.next()}}else i={struct:l.curr,offset:0},l.next();for(let u=l.curr;u!==null&&u.id.client===h&&u.id.clock===i.struct.id.clock+i.struct.length&&u.constructor!==L;u=l.next())X(c,i.struct,i.offset),i={struct:u,offset:0}}if(i!==null)X(c,i.struct,i.offset),i=null;ir(c);let a=r.map((l)=>Qn(l)),d=Pn(a);return Bt(o,d),o.toUint8Array()},lc=(t,e,n=it,r=Y)=>{let s=Ls(e),i=new r,o=new tn(i),c=new n(fa(t)),a=new Ye(c,!1);while(a.curr){let l=a.curr,h=l.id.client,u=s.get(h)||0;if(a.curr.constructor===L){a.next();continue}if(l.id.clock+l.length>u){X(o,l,W(u-l.id.clock,0)),a.next();while(a.curr&&a.curr.id.client===h)X(o,a.curr,0),a.next()}else while(a.curr&&a.curr.id.client===h&&a.curr.id.clock+a.curr.length<=u)a.next()}ir(o);let d=Qn(c);return Bt(i,d),i.toUint8Array()};var Ws=(t)=>{if(t.written>0)t.clientStructs.push({written:t.written,restEncoder:Kr(t.encoder.restEncoder)}),t.encoder.restEncoder=ha(),t.written=0},X=(t,e,n)=>{if(t.written>0&&t.currClient!==e.id.client)Ws(t);if(t.written===0)t.currClient=e.id.client,t.encoder.writeClient(e.id.client),ft(t.encoder.restEncoder,e.id.clock+n);e.write(t.encoder,n),t.written++},ir=(t)=>{Ws(t);let e=t.encoder.restEncoder;ft(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){let r=t.clientStructs[n];ft(e,r.written),Ft(e,r.restEncoder)}},ac=(t,e,n,r)=>{let s=new n(fa(t)),i=new Ye(s,!1),o=new r,c=new tn(o);for(let d=i.curr;d!==null;d=i.next())X(c,e(d),0);ir(c);let a=Qn(s);return Bt(o,a),o.toUint8Array()};var hc=(t)=>ac(t,Mr,it,Ot),Us="You must not compute changes after the event-handler fired.";class oe{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=uc(this.currentTarget,this.target))}deletes(t){return ie(this.transaction.deleteSet,t.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw v(Us);let t=new Map,e=this.target;this.transaction.changed.get(e).forEach((r)=>{if(r!==null){let s=e._map.get(r),i,o;if(this.adds(s)){let c=s.left;while(c!==null&&this.adds(c))c=c.left;if(this.deletes(s))if(c!==null&&this.deletes(c))i="delete",o=he(c.content.getContent());else return;else if(c!==null&&this.deletes(c))i="update",o=he(c.content.getContent());else i="add",o=void 0}else if(this.deletes(s))i="delete",o=he(s.content.getContent());else return;t.set(r,{action:i,oldValue:o})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(t===null){if(this.transaction.doc._transactionCleanups.length===0)throw v(Us);let e=this.target,n=j(),r=j(),s=[];if(t={added:n,deleted:r,delta:s,keys:this.keys},this.transaction.changed.get(e).has(null)){let o=null,c=()=>{if(o)s.push(o)};for(let a=e._start;a!==null;a=a.right)if(a.deleted){if(this.deletes(a)&&!this.adds(a)){if(o===null||o.delete===void 0)c(),o={delete:0};o.delete+=a.length,r.add(a)}}else if(this.adds(a)){if(o===null||o.insert===void 0)c(),o={insert:[]};o.insert=o.insert.concat(a.content.getContent()),n.add(a)}else{if(o===null||o.retain===void 0)c(),o={retain:0};o.retain+=a.length}if(o!==null&&o.retain===void 0)c()}this._changes=t}return t}}var uc=(t,e)=>{let n=[];while(e._item!==null&&e!==t){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,s=e._item.parent._start;while(s!==e._item&&s!==null){if(!s.deleted&&s.countable)r+=s.length;s=s.right}n.unshift(r)}e=e._item.parent}return n},D=()=>{Hn("Invalid access: Add Yjs type to a document before reading data.")},Zs=80,or=0;class Xs{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=or++}}var dc=(t)=>{t.timestamp=or++},Qs=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=or++},fc=(t,e,n)=>{if(t.length>=Zs){let r=t.reduce((s,i)=>s.timestamp<i.timestamp?s:i);return Qs(r,e,n),r}else{let r=new Xs(e,n);return t.push(r),r}},en=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;let n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,o)=>tt(e-i.index)<tt(e-o.index)?i:o),r=t._start,s=0;if(n!==null)r=n.p,s=n.index,dc(n);while(r.right!==null&&s<e){if(!r.deleted&&r.countable){if(e<s+r.length)break;s+=r.length}r=r.right}while(r.left!==null&&s>e)if(r=r.left,!r.deleted&&r.countable)s-=r.length;while(r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock)if(r=r.left,!r.deleted&&r.countable)s-=r.length;if(n!==null&&tt(n.index-s)<r.parent.length/Zs)return Qs(n,r,s),n;else return fc(t._searchMarker,r,s)},ee=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){let s=t[r];if(n>0){let i=s.p;i.marker=!1;while(i&&(i.deleted||!i.countable))if(i=i.left,i&&!i.deleted&&i.countable)s.index-=i.length;if(i===null||i.marker===!0){t.splice(r,1);continue}s.p=i,i.marker=!0}if(e<s.index||n>0&&e===s.index)s.index=W(e,s.index+n)}};var nn=(t,e,n)=>{let r=t,s=e.changedParentTypes;while(!0){if(M(s,t,()=>[]).push(n),t._item===null)break;t=t._item.parent}$s(r._eH,n,e)};class S{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=xs(),this._dEH=xs(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw N()}clone(){throw N()}_write(t){}get _first(){let t=this._start;while(t!==null&&t.deleted)t=t.right;return t}_callObserver(t,e){if(!t.local&&this._searchMarker)this._searchMarker.length=0}observe(t){ys(this._eH,t)}observeDeep(t){ys(this._dEH,t)}unobserve(t){bs(this._eH,t)}unobserveDeep(t){bs(this._dEH,t)}toJSON(){}}var Ys=(t,e,n)=>{if(t.doc??D(),e<0)e=t._length+e;if(n<0)n=t._length+n;let r=n-e,s=[],i=t._start;while(i!==null&&r>0){if(i.countable&&!i.deleted){let o=i.content.getContent();if(o.length<=e)e-=o.length;else{for(let c=e;c<o.length&&r>0;c++)s.push(o[c]),r--;e=0}}i=i.right}return s},ti=(t)=>{t.doc??D();let e=[],n=t._start;while(n!==null){if(n.countable&&!n.deleted){let r=n.content.getContent();for(let s=0;s<r.length;s++)e.push(r[s])}n=n.right}return e};var ne=(t,e)=>{let n=0,r=t._start;t.doc??D();while(r!==null){if(r.countable&&!r.deleted){let s=r.content.getContent();for(let i=0;i<s.length;i++)e(s[i],n++,t)}r=r.right}},ei=(t,e)=>{let n=[];return ne(t,(r,s)=>{n.push(e(r,s,t))}),n},pc=(t)=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){while(e!==null&&e.deleted)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}let s=n[r++];if(n.length<=r)n=null;return{done:!1,value:s}}}},ni=(t,e)=>{t.doc??D();let n=en(t,e),r=t._start;if(n!==null)r=n.p,e-=n.index;for(;r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},He=(t,e,n,r)=>{let s=n,i=t.doc,{clientID:o,store:c}=i,a=n===null?e._start:n.right,d=[],l=()=>{if(d.length>0)s=new x(g(o,y(c,o)),s,s&&s.lastId,a,a&&a.id,e,null,new ct(d)),s.integrate(t,0),d=[]};r.forEach((h)=>{if(h===null)d.push(h);else switch(h.constructor){case Number:case Object:case Boolean:case Array:case String:d.push(h);break;default:switch(l(),h.constructor){case Uint8Array:case ArrayBuffer:s=new x(g(o,y(c,o)),s,s&&s.lastId,a,a&&a.id,e,null,new ce(new Uint8Array(h))),s.integrate(t,0);break;case vc:s=new x(g(o,y(c,o)),s,s&&s.lastId,a,a&&a.id,e,null,new le(h)),s.integrate(t,0);break;default:if(h instanceof S)s=new x(g(o,y(c,o)),s,s&&s.lastId,a,a&&a.id,e,null,new P(h)),s.integrate(t,0);else throw Error("Unexpected content type in insert operation")}}}),l()},ri=()=>v("Length exceeded!"),si=(t,e,n,r)=>{if(n>e._length)throw ri();if(n===0){if(e._searchMarker)ee(e._searchMarker,n,r.length);return He(t,e,null,r)}let s=n,i=en(e,n),o=e._start;if(i!==null){if(o=i.p,n-=i.index,n===0)o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0}for(;o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){if(n<o.length)O(t,g(o.id.client,o.id.clock+n));break}n-=o.length}if(e._searchMarker)ee(e._searchMarker,s,r.length);return He(t,e,o,r)},gc=(t,e,n)=>{let s=(e._searchMarker||[]).reduce((i,o)=>o.index>i.index?o:i,{index:0,p:e._start}).p;if(s)while(s.right)s=s.right;return He(t,e,s,n)},ii=(t,e,n,r)=>{if(r===0)return;let s=n,i=r,o=en(e,n),c=e._start;if(o!==null)c=o.p,n-=o.index;for(;c!==null&&n>0;c=c.right)if(!c.deleted&&c.countable){if(n<c.length)O(t,g(c.id.client,c.id.clock+n));n-=c.length}while(r>0&&c!==null){if(!c.deleted){if(r<c.length)O(t,g(c.id.client,c.id.clock+r));c.delete(t),r-=c.length}c=c.right}if(r>0)throw ri();if(e._searchMarker)ee(e._searchMarker,s,-i+r)},Je=(t,e,n)=>{let r=e._map.get(n);if(r!==void 0)r.delete(t)},cr=(t,e,n,r)=>{let s=e._map.get(n)||null,i=t.doc,o=i.clientID,c;if(r==null)c=new ct([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new ct([r]);break;case Uint8Array:c=new ce(r);break;case vc:c=new le(r);break;default:if(r instanceof S)c=new P(r);else throw Error("Unexpected content type")}new x(g(o,y(i.store,o)),s,s&&s.lastId,null,null,e,n,c).integrate(t,0)},lr=(t,e)=>{t.doc??D();let n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},oi=(t)=>{let e={};return t.doc??D(),t._map.forEach((n,r)=>{if(!n.deleted)e[r]=n.content.getContent()[n.length-1]}),e},ci=(t,e)=>{t.doc??D();let n=t._map.get(e);return n!==void 0&&!n.deleted};var mc=(t,e)=>{let n={};return t._map.forEach((r,s)=>{let i=r;while(i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0)))i=i.left;if(i!==null&&Tt(i,e))n[s]=i.content.getContent()[i.length-1]}),n},$e=(t)=>(t.doc??D(),ms(t._map.entries(),(e)=>!e[1].deleted));class Zg extends oe{}class Bs extends S{constructor(){super();this._prelimContent=[],this._searchMarker=[]}static from(t){let e=new Bs;return e.push(t),e}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Bs}clone(){let t=new Bs;return t.insert(0,this.toArray().map((e)=>e instanceof S?e.clone():e)),t}get length(){return this.doc??D(),this._length}_callObserver(t,e){super._callObserver(t,e),nn(this,t,new Zg(this,t))}insert(t,e){if(this.doc!==null)w(this.doc,(n)=>{si(n,this,t,e)});else this._prelimContent.splice(t,0,...e)}push(t){if(this.doc!==null)w(this.doc,(e)=>{gc(e,this,t)});else this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){if(this.doc!==null)w(this.doc,(n)=>{ii(n,this,t,e)});else this._prelimContent.splice(t,e)}get(t){return ni(this,t)}toArray(){return ti(this)}slice(t=0,e=this.length){return Ys(this,t,e)}toJSON(){return this.map((t)=>t instanceof S?t.toJSON():t)}map(t){return ei(this,t)}forEach(t){ne(this,t)}[Symbol.iterator](){return pc(this)}_write(t){t.writeTypeRef($c)}}var wc=(t)=>new Bs;class sw extends oe{constructor(t,e,n){super(t,e);this.keysChanged=n}}class Zo extends S{constructor(t){super();if(this._prelimContent=null,t===void 0)this._prelimContent=new Map;else this._prelimContent=new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach((n,r)=>{this.set(r,n)}),this._prelimContent=null}_copy(){return new Zo}clone(){let t=new Zo;return this.forEach((e,n)=>{t.set(n,e instanceof S?e.clone():e)}),t}_callObserver(t,e){nn(this,t,new sw(this,t,e))}toJSON(){this.doc??D();let t={};return this._map.forEach((e,n)=>{if(!e.deleted){let r=e.content.getContent()[e.length-1];t[n]=r instanceof S?r.toJSON():r}}),t}get size(){return[...$e(this)].length}keys(){return Le($e(this),(t)=>t[0])}values(){return Le($e(this),(t)=>t[1].content.getContent()[t[1].length-1])}entries(){return Le($e(this),(t)=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??D(),this._map.forEach((e,n)=>{if(!e.deleted)t(e.content.getContent()[e.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(t){if(this.doc!==null)w(this.doc,(e)=>{Je(e,this,t)});else this._prelimContent.delete(t)}set(t,e){if(this.doc!==null)w(this.doc,(n)=>{cr(n,this,t,e)});else this._prelimContent.set(t,e);return e}get(t){return lr(this,t)}has(t){return ci(this,t)}clear(){if(this.doc!==null)w(this.doc,(t)=>{this.forEach(function(e,n,r){Je(t,r,n)})});else this._prelimContent.clear()}_write(t){t.writeTypeRef(Fc)}}var xc=(t)=>new Zo,Q=(t,e)=>t===e||typeof t==="object"&&typeof e==="object"&&t&&e&&Sn(t,e);class Pe{constructor(t,e,n,r){this.left=t,this.right=e,this.index=n,this.currentAttributes=r}forward(){if(this.right===null)B();switch(this.right.content.constructor){case E:if(!this.right.deleted)vt(this.currentAttributes,this.right.content);break;default:if(!this.right.deleted)this.index+=this.right.length;break}this.left=this.right,this.right=this.right.right}}var Ts=(t,e,n)=>{while(e.right!==null&&n>0){switch(e.right.content.constructor){case E:if(!e.right.deleted)vt(e.currentAttributes,e.right.content);break;default:if(!e.right.deleted){if(n<e.right.length)O(t,g(e.right.id.client,e.right.id.clock+n));e.index+=e.right.length,n-=e.right.length}break}e.left=e.right,e.right=e.right.right}return e},Fe=(t,e,n,r)=>{let s=new Map,i=r?en(e,n):null;if(i){let o=new Pe(i.p.left,i.p,i.index,s);return Ts(t,o,n-i.index)}else{let o=new Pe(null,e._start,0,s);return Ts(t,o,n)}},li=(t,e,n,r)=>{while(n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===E&&Q(r.get(n.right.content.key),n.right.content.value))){if(!n.right.deleted)r.delete(n.right.content.key);n.forward()}let s=t.doc,i=s.clientID;r.forEach((o,c)=>{let{left:a,right:d}=n,l=new x(g(i,y(s.store,i)),a,a&&a.lastId,d,d&&d.id,e,null,new E(c,o));l.integrate(t,0),n.right=l,n.forward()})},vt=(t,e)=>{let{key:n,value:r}=e;if(r===null)t.delete(n);else t.set(n,r)},ai=(t,e)=>{while(!0){if(t.right===null)break;else if(t.right.deleted||t.right.content.constructor===E&&Q(e[t.right.content.key]??null,t.right.content.value));else break;t.forward()}},hi=(t,e,n,r)=>{let s=t.doc,i=s.clientID,o=new Map;for(let c in r){let a=r[c],d=n.currentAttributes.get(c)??null;if(!Q(d,a)){o.set(c,d);let{left:l,right:h}=n;n.right=new x(g(i,y(s.store,i)),l,l&&l.lastId,h,h&&h.id,e,null,new E(c,a)),n.right.integrate(t,0),n.forward()}}return o},Jn=(t,e,n,r,s)=>{n.currentAttributes.forEach((u,f)=>{if(s[f]===void 0)s[f]=null});let i=t.doc,o=i.clientID;ai(n,s);let c=hi(t,e,n,s),a=r.constructor===String?new J(r):r instanceof S?new P(r):new at(r),{left:d,right:l,index:h}=n;if(e._searchMarker)ee(e._searchMarker,n.index,a.getLength());l=new x(g(o,y(i.store,o)),d,d&&d.lastId,l,l&&l.id,e,null,a),l.integrate(t,0),n.right=l,n.index=h,n.forward(),li(t,e,n,c)},As=(t,e,n,r,s)=>{let i=t.doc,o=i.clientID;ai(n,s);let c=hi(t,e,n,s);t:while(n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===E))){if(!n.right.deleted)switch(n.right.content.constructor){case E:{let{key:a,value:d}=n.right.content,l=s[a];if(l!==void 0){if(Q(l,d))c.delete(a);else{if(r===0)break t;c.set(a,d)}n.right.delete(t)}else n.currentAttributes.set(a,d);break}default:if(r<n.right.length)O(t,g(n.right.id.client,n.right.id.clock+r));r-=n.right.length;break}n.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
4
|
-
`;n.right=new x(g(o,y(i.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new J(a)),n.right.integrate(t,0),n.forward()}li(t,e,n,c)},ui=(t,e,n,r,s)=>{let i=e,o=I();while(i&&(!i.countable||i.deleted)){if(!i.deleted&&i.content.constructor===E){let d=i.content;o.set(d.key,d)}i=i.right}let c=0,a=!1;while(e!==i){if(n===e)a=!0;if(!e.deleted){let d=e.content;switch(d.constructor){case E:{let{key:l,value:h}=d,u=r.get(l)??null;if(o.get(l)!==d||u===h){if(e.delete(t),c++,!a&&(s.get(l)??null)===h&&u!==h)if(u===null)s.delete(l);else s.set(l,u)}if(!a&&!e.deleted)vt(s,d);break}}}e=e.right}return c},yc=(t,e)=>{while(e&&e.right&&(e.right.deleted||!e.right.countable))e=e.right;let n=new Set;while(e&&(e.deleted||!e.countable)){if(!e.deleted&&e.content.constructor===E){let r=e.content.key;if(n.has(r))e.delete(t);else n.add(r)}e=e.left}},bc=(t)=>{let e=0;return w(t.doc,(n)=>{let{_start:r,_start:s}=t,i=I(),o=ae(i);while(s){if(s.deleted===!1)switch(s.content.constructor){case E:vt(o,s.content);break;default:e+=ui(n,r,s,i,o),i=ae(o),r=s;break}s=s.right}}),e},kc=(t)=>{let e=new Set,n=t.doc;for(let[r,s]of t.afterState.entries()){let i=t.beforeState.get(r)||0;if(s===i)continue;Hs(t,n.store.clients.get(r),i,s,(o)=>{if(!o.deleted&&o.content.constructor===E&&o.constructor!==R)e.add(o.parent)})}w(n,(r)=>{Ct(t,t.deleteSet,(s)=>{if(s instanceof R||!s.parent._hasFormatting||e.has(s.parent))return;let i=s.parent;if(s.content.constructor===E)e.add(i);else yc(r,s)});for(let s of e)bc(s)})},Cs=(t,e,n)=>{let r=n,s=ae(e.currentAttributes),i=e.right;while(n>0&&e.right!==null){if(e.right.deleted===!1)switch(e.right.content.constructor){case P:case at:case J:if(n<e.right.length)O(t,g(e.right.id.client,e.right.id.clock+n));n-=e.right.length,e.right.delete(t);break}e.forward()}if(i)ui(t,i,e.right,s,e.currentAttributes);let o=(e.left||e.right).parent;if(o._searchMarker)ee(o._searchMarker,e.index,-r+n);return e};class aw extends oe{constructor(t,e,n){super(t,e);this.childListChanged=!1,this.keysChanged=new Set,n.forEach((r)=>{if(r===null)this.childListChanged=!0;else this.keysChanged.add(r)})}get changes(){if(this._changes===null){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(this._delta===null){let t=this.target.doc,e=[];w(t,(n)=>{let r=new Map,s=new Map,i=this.target._start,o=null,c={},a="",d=0,l=0,h=()=>{if(o!==null){let u=null;switch(o){case"delete":if(l>0)u={delete:l};l=0;break;case"insert":if(typeof a==="object"||a.length>0){if(u={insert:a},r.size>0)u.attributes={},r.forEach((f,p)=>{if(f!==null)u.attributes[p]=f})}a="";break;case"retain":if(d>0){if(u={retain:d},!Vr(c))u.attributes=Nr({},c)}d=0;break}if(u)e.push(u);o=null}};while(i!==null){switch(i.content.constructor){case P:case at:if(this.adds(i)){if(!this.deletes(i))h(),o="insert",a=i.content.getContent()[0],h()}else if(this.deletes(i)){if(o!=="delete")h(),o="delete";l+=1}else if(!i.deleted){if(o!=="retain")h(),o="retain";d+=1}break;case J:if(this.adds(i)){if(!this.deletes(i)){if(o!=="insert")h(),o="insert";a+=i.content.str}}else if(this.deletes(i)){if(o!=="delete")h(),o="delete";l+=i.length}else if(!i.deleted){if(o!=="retain")h(),o="retain";d+=i.length}break;case E:{let{key:u,value:f}=i.content;if(this.adds(i)){if(!this.deletes(i)){let p=r.get(u)??null;if(!Q(p,f)){if(o==="retain")h();if(Q(f,s.get(u)??null))delete c[u];else c[u]=f}else if(f!==null)i.delete(n)}}else if(this.deletes(i)){s.set(u,f);let p=r.get(u)??null;if(!Q(p,f)){if(o==="retain")h();c[u]=p}}else if(!i.deleted){s.set(u,f);let p=c[u];if(p!==void 0){if(!Q(p,f)){if(o==="retain")h();if(f===null)delete c[u];else c[u]=f}else if(p!==null)i.delete(n)}}if(!i.deleted){if(o==="insert")h();vt(r,i.content)}break}}i=i.right}h();while(e.length>0){let u=e[e.length-1];if(u.retain!==void 0&&u.attributes===void 0)e.pop();else break}}),this._delta=e}return this._delta}}class ps extends S{constructor(t){super();this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??D(),this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach((n)=>n())}catch(n){console.error(n)}this._pending=null}_copy(){return new ps}clone(){let t=new ps;return t.applyDelta(this.toDelta()),t}_callObserver(t,e){super._callObserver(t,e);let n=new aw(this,t,e);if(nn(this,t,n),!t.local&&this._hasFormatting)t._needFormattingCleanup=!0}toString(){this.doc??D();let t="",e=this._start;while(e!==null){if(!e.deleted&&e.countable&&e.content.constructor===J)t+=e.content.str;e=e.right}return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){if(this.doc!==null)w(this.doc,(n)=>{let r=new Pe(null,this._start,0,new Map);for(let s=0;s<t.length;s++){let i=t[s];if(i.insert!==void 0){let o=!e&&typeof i.insert==="string"&&s===t.length-1&&r.right===null&&i.insert.slice(-1)===`
|
|
5
|
-
`?i.insert.slice(0,-1):i.insert;if(typeof o!=="string"||o.length>0)Jn(n,this,r,o,i.attributes||{})}else if(i.retain!==void 0)As(n,this,r,i.retain,i.attributes||{});else if(i.delete!==void 0)Cs(n,r,i.delete)}});else this._pending.push(()=>this.applyDelta(t))}toDelta(t,e,n){this.doc??D();let r=[],s=new Map,i=this.doc,o="",c=this._start;function a(){if(o.length>0){let l={},h=!1;s.forEach((f,p)=>{h=!0,l[p]=f});let u={insert:o};if(h)u.attributes=l;r.push(u),o=""}}let d=()=>{while(c!==null){if(Tt(c,t)||e!==void 0&&Tt(c,e))switch(c.content.constructor){case J:{let l=s.get("ychange");if(t!==void 0&&!Tt(c,t)){if(l===void 0||l.user!==c.id.client||l.type!=="removed")a(),s.set("ychange",n?n("removed",c.id):{type:"removed"})}else if(e!==void 0&&!Tt(c,e)){if(l===void 0||l.user!==c.id.client||l.type!=="added")a(),s.set("ychange",n?n("added",c.id):{type:"added"})}else if(l!==void 0)a(),s.delete("ychange");o+=c.content.str;break}case P:case at:{a();let l={insert:c.content.getContent()[0]};if(s.size>0){let h={};l.attributes=h,s.forEach((u,f)=>{h[f]=u})}r.push(l);break}case E:if(Tt(c,t))a(),vt(s,c.content);break}c=c.right}a()};if(t||e)w(i,(l)=>{if(t)Kn(l,t);if(e)Kn(l,e);d()},"cleanup");else d();return r}insert(t,e,n){if(e.length<=0)return;let r=this.doc;if(r!==null)w(r,(s)=>{let i=Fe(s,this,t,!n);if(!n)n={},i.currentAttributes.forEach((o,c)=>{n[c]=o});Jn(s,this,i,e,n)});else this._pending.push(()=>this.insert(t,e,n))}insertEmbed(t,e,n){let r=this.doc;if(r!==null)w(r,(s)=>{let i=Fe(s,this,t,!n);Jn(s,this,i,e,n||{})});else this._pending.push(()=>this.insertEmbed(t,e,n||{}))}delete(t,e){if(e===0)return;let n=this.doc;if(n!==null)w(n,(r)=>{Cs(r,Fe(r,this,t,!0),e)});else this._pending.push(()=>this.delete(t,e))}format(t,e,n){if(e===0)return;let r=this.doc;if(r!==null)w(r,(s)=>{let i=Fe(s,this,t,!1);if(i.right===null)return;As(s,this,i,e,n)});else this._pending.push(()=>this.format(t,e,n))}removeAttribute(t){if(this.doc!==null)w(this.doc,(e)=>{Je(e,this,t)});else this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,e){if(this.doc!==null)w(this.doc,(n)=>{cr(n,this,t,e)});else this._pending.push(()=>this.setAttribute(t,e))}getAttribute(t){return lr(this,t)}getAttributes(){return oi(this)}_write(t){t.writeTypeRef(jc)}}var _c=(t)=>new ps;class qe{constructor(t,e=()=>!0){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??D()}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(t!==null&&(!this._firstCall||t.deleted||!this._filter(e)))do if(e=t.content.type,!t.deleted&&(e.constructor===Dt||e.constructor===ot)&&e._start!==null)t=e._start;else while(t!==null){let n=t.next;if(n!==null){t=n;break}else if(t.parent===this._root)t=null;else t=t.parent._item}while(t!==null&&(t.deleted||!this._filter(t.content.type)));if(this._firstCall=!1,t===null)return{value:void 0,done:!0};return this._currentNode=t,{value:t.content.type,done:!1}}}class ot extends S{constructor(){super();this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ot}clone(){let t=new ot;return t.insert(0,this.toArray().map((e)=>e instanceof S?e.clone():e)),t}get length(){return this.doc??D(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new qe(this,t)}querySelector(t){t=t.toUpperCase();let n=new qe(this,(r)=>r.nodeName&&r.nodeName.toUpperCase()===t).next();if(n.done)return null;else return n.value}querySelectorAll(t){return t=t.toUpperCase(),F(new qe(this,(e)=>e.nodeName&&e.nodeName.toUpperCase()===t))}_callObserver(t,e){nn(this,t,new di(this,e,t))}toString(){return ei(this,(t)=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},n){let r=t.createDocumentFragment();if(n!==void 0)n._createAssociation(r,this);return ne(this,(s)=>{r.insertBefore(s.toDOM(t,e,n),null)}),r}insert(t,e){if(this.doc!==null)w(this.doc,(n)=>{si(n,this,t,e)});else this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(this.doc!==null)w(this.doc,(n)=>{let r=t&&t instanceof S?t._item:t;He(n,this,r,e)});else{let n=this._prelimContent,r=t===null?0:n.findIndex((s)=>s===t)+1;if(r===0&&t!==null)throw v("Reference item not found");n.splice(r,0,...e)}}delete(t,e=1){if(this.doc!==null)w(this.doc,(n)=>{ii(n,this,t,e)});else this._prelimContent.splice(t,e)}toArray(){return ti(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return ni(this,t)}slice(t=0,e=this.length){return Ys(this,t,e)}forEach(t){ne(this,t)}_write(t){t.writeTypeRef(Gc)}}var Sc=(t)=>new ot;class Dt extends ot{constructor(t="UNDEFINED"){super();this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach((n,r)=>{this.setAttribute(r,n)}),this._prelimAttrs=null}_copy(){return new Dt(this.nodeName)}clone(){let t=new Dt(this.nodeName),e=this.getAttributes();return Lr(e,(n,r)=>{t.setAttribute(r,n)}),t.insert(0,this.toArray().map((n)=>n instanceof S?n.clone():n)),t}toString(){let t=this.getAttributes(),e=[],n=[];for(let o in t)n.push(o);n.sort();let r=n.length;for(let o=0;o<r;o++){let c=n[o];e.push(c+'="'+t[c]+'"')}let s=this.nodeName.toLocaleLowerCase(),i=e.length>0?" "+e.join(" "):"";return`<${s}${i}>${super.toString()}</${s}>`}removeAttribute(t){if(this.doc!==null)w(this.doc,(e)=>{Je(e,this,t)});else this._prelimAttrs.delete(t)}setAttribute(t,e){if(this.doc!==null)w(this.doc,(n)=>{cr(n,this,t,e)});else this._prelimAttrs.set(t,e)}getAttribute(t){return lr(this,t)}hasAttribute(t){return ci(this,t)}getAttributes(t){return t?mc(this,t):oi(this)}toDOM(t=document,e={},n){let r=t.createElement(this.nodeName),s=this.getAttributes();for(let i in s){let o=s[i];if(typeof o==="string")r.setAttribute(i,o)}if(ne(this,(i)=>{r.appendChild(i.toDOM(t,e,n))}),n!==void 0)n._createAssociation(r,this);return r}_write(t){t.writeTypeRef(qc),t.writeKey(this.nodeName)}}var Ec=(t)=>new Dt(t.readKey());class di extends oe{constructor(t,e,n){super(t,n);this.childListChanged=!1,this.attributesChanged=new Set,e.forEach((r)=>{if(r===null)this.childListChanged=!0;else this.attributesChanged.add(r)})}}class Ke extends Zo{constructor(t){super();this.hookName=t}_copy(){return new Ke(this.hookName)}clone(){let t=new Ke(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(t=document,e={},n){let r=e[this.hookName],s;if(r!==void 0)s=r.createDom(this);else s=document.createElement(this.hookName);if(s.setAttribute("data-yjs-hook",this.hookName),n!==void 0)n._createAssociation(s,this);return s}_write(t){t.writeTypeRef(zc),t.writeKey(this.hookName)}}var Ic=(t)=>new Ke(t.readKey());class We extends ps{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new We}clone(){let t=new We;return t.applyDelta(this.toDelta()),t}toDOM(t=document,e,n){let r=t.createTextNode(this.toString());if(n!==void 0)n._createAssociation(r,this);return r}toString(){return this.toDelta().map((t)=>{let e=[];for(let r in t.attributes){let s=[];for(let i in t.attributes[r])s.push({key:i,value:t.attributes[r][i]});s.sort((i,o)=>i.key<o.key?-1:1),e.push({nodeName:r,attrs:s})}e.sort((r,s)=>r.nodeName<s.nodeName?-1:1);let n="";for(let r=0;r<e.length;r++){let s=e[r];n+=`<${s.nodeName}`;for(let i=0;i<s.attrs.length;i++){let o=s.attrs[i];n+=` ${o.key}="${o.value}"`}n+=">"}n+=t.insert;for(let r=e.length-1;r>=0;r--)n+=`</${e[r].nodeName}>`;return n}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(Hc)}}var Uc=(t)=>new We;class rn{constructor(t,e){this.id=t,this.length=e}get deleted(){throw N()}mergeWith(t){return!1}write(t,e,n){throw N()}integrate(t,e){throw N()}}var Tc=0;class R extends rn{get deleted(){return!0}delete(){}mergeWith(t){if(this.constructor!==t.constructor)return!1;return this.length+=t.length,!0}integrate(t,e){if(e>0)this.id.clock+=e,this.length-=e;zs(t.doc.store,this)}write(t,e){t.writeInfo(Tc),t.writeLen(this.length-e)}getMissing(t,e){return null}}class ce{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ce(this.content)}splice(t){throw N()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}}var Ac=(t)=>new ce(t.readBuf());class re{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new re(this.len)}splice(t){let e=new re(this.len-t);return this.len=t,e}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){te(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}}var Cc=(t)=>new re(t.readLen()),fi=(t,e)=>new vc({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class le{constructor(t){if(t._item)console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid.");this.doc=t;let e={};if(this.opts=e,!t.gc)e.gc=!1;if(t.autoLoad)e.autoLoad=!0;if(t.meta!==null)e.meta=t.meta}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new le(fi(this.doc.guid,this.opts))}splice(t){throw N()}mergeWith(t){return!1}integrate(t,e){if(this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad)t.subdocsLoaded.add(this.doc)}delete(t){if(t.subdocsAdded.has(this.doc))t.subdocsAdded.delete(this.doc);else t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}var Dc=(t)=>new le(fi(t.readString(),t.readAny()));class at{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new at(this.embed)}splice(t){throw N()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}}var Bc=(t)=>new at(t.readJSON());class E{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new E(this.key,this.value)}splice(t){throw N()}mergeWith(t){return!1}integrate(t,e){let n=e.parent;n._searchMarker=null,n._hasFormatting=!0}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}var Oc=(t)=>new E(t.readKey(),t.readJSON());class Ze{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Ze(this.arr)}splice(t){let e=new Ze(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){let s=this.arr[r];t.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}var Nc=(t)=>{let e=t.readLen(),n=[];for(let r=0;r<e;r++){let s=t.readString();if(s==="undefined")n.push(void 0);else n.push(JSON.parse(s))}return new Ze(n)},Rc=Kt("node_env")==="development";class ct{constructor(t){this.arr=t,Rc&&En(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ct(this.arr)}splice(t){let e=new ct(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let n=this.arr.length;t.writeLen(n-e);for(let r=e;r<n;r++){let s=this.arr[r];t.writeAny(s)}}getRef(){return 8}}var Lc=(t)=>{let e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new ct(n)};class J{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new J(this.str)}splice(t){let e=new J(this.str.slice(t));this.str=this.str.slice(0,t);let n=this.str.charCodeAt(t-1);if(n>=55296&&n<=56319)this.str=this.str.slice(0,t-1)+"�",e.str="�"+e.str.slice(1);return e}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(e===0?this.str:this.str.slice(e))}getRef(){return 4}}var Vc=(t)=>new J(t.readString()),Mc=[wc,xc,_c,Ec,Sc,Ic,Uc],$c=0,Fc=1,jc=2,qc=3,Gc=4,zc=5,Hc=6;class P{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new P(this.type._copy())}splice(t){throw N()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;while(e!==null){if(!e.deleted)e.delete(t);else if(e.id.clock<(t.beforeState.get(e.id.client)||0))t._mergeStructs.push(e);e=e.right}this.type._map.forEach((n)=>{if(!n.deleted)n.delete(t);else if(n.id.clock<(t.beforeState.get(n.id.client)||0))t._mergeStructs.push(n)}),t.changed.delete(this.type)}gc(t){let e=this.type._start;while(e!==null)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach((n)=>{while(n!==null)n.gc(t,!0),n=n.left}),this.type._map=new Map}write(t,e){this.type._write(t)}getRef(){return 7}}var Jc=(t)=>new P(Mc[t.readTypeRef()](t)),Zn=(t,e)=>{let n=e,r=0,s;do{if(r>0)n=g(n.client,n.clock+r);s=At(t,n),r=n.clock-s.id.clock,n=s.redone}while(n!==null&&s instanceof x);return{item:s,diff:r}},ar=(t,e)=>{while(t!==null&&t.keep!==e)t.keep=e,t=t.parent._item},Xe=(t,e,n)=>{let{client:r,clock:s}=e.id,i=new x(g(r,s+n),e,g(r,s+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));if(e.deleted)i.markDeleted();if(e.keep)i.keep=!0;if(e.redone!==null)i.redone=g(e.redone.client,e.redone.clock+n);if(e.right=i,i.right!==null)i.right.left=i;if(t._mergeStructs.push(i),i.parentSub!==null&&i.right===null)i.parent._map.set(i.parentSub,i);return e.length=n,i},Ds=(t,e)=>Rt(t,(n)=>ie(n.deletions,e)),pi=(t,e,n,r,s,i)=>{let o=t.doc,{store:c,clientID:a}=o,d=e.redone;if(d!==null)return O(t,d);let l=e.parent._item,h=null,u;if(l!==null&&l.deleted===!0){if(l.redone===null&&(!n.has(l)||pi(t,l,n,r,s,i)===null))return null;while(l.redone!==null)l=O(t,l.redone)}let f=l===null?e.parent:l.content.type;if(e.parentSub===null){h=e.left,u=e;while(h!==null){let b=h;while(b!==null&&b.parent._item!==l)b=b.redone===null?null:O(t,b.redone);if(b!==null&&b.parent._item===l){h=b;break}h=h.left}while(u!==null){let b=u;while(b!==null&&b.parent._item!==l)b=b.redone===null?null:O(t,b.redone);if(b!==null&&b.parent._item===l){u=b;break}u=u.right}}else{if(u=null,e.right&&!s){h=e;while(h!==null&&h.right!==null&&(h.right.redone||ie(r,h.right.id)||Ds(i.undoStack,h.right.id)||Ds(i.redoStack,h.right.id))){h=h.right;while(h.redone)h=O(t,h.redone)}if(h&&h.right!==null)return null}else h=f._map.get(e.parentSub)||null;if(h!==null&&h.parent._item!==l)h=f._map.get(e.parentSub)||null}let p=y(c,a),m=g(a,p),T=new x(m,h,h&&h.lastId,u,u&&u.id,f,e.parentSub,e.content.copy());return e.redone=m,ar(T,!0),T.integrate(t,0),T};class x extends rn{constructor(t,e,n,r,s,i,o,c){super(t,c.getLength());this.origin=n,this.left=e,this.right=r,this.rightOrigin=s,this.parent=i,this.parentSub=o,this.redone=null,this.content=c,this.info=this.content.isCountable()?cn:0}set marker(t){if((this.info&me)>0!==t)this.info^=me}get marker(){return(this.info&me)>0}get keep(){return(this.info&on)>0}set keep(t){if(this.keep!==t)this.info^=on}get countable(){return(this.info&cn)>0}get deleted(){return(this.info&ge)>0}set deleted(t){if(this.deleted!==t)this.info^=ge}markDeleted(){this.info|=ge}getMissing(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=y(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=y(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===st&&this.id.client!==this.parent.client&&this.parent.clock>=y(e,this.parent.client))return this.parent.client;if(this.origin)this.left=ks(t,e,this.origin),this.origin=this.left.lastId;if(this.rightOrigin)this.right=O(t,this.rightOrigin),this.rightOrigin=this.right.id;if(this.left&&this.left.constructor===R||this.right&&this.right.constructor===R)this.parent=null;else if(!this.parent){if(this.left&&this.left.constructor===x)this.parent=this.left.parent,this.parentSub=this.left.parentSub;else if(this.right&&this.right.constructor===x)this.parent=this.right.parent,this.parentSub=this.right.parentSub}else if(this.parent.constructor===st){let n=At(e,this.parent);if(n.constructor===R)this.parent=null;else this.parent=n.content.type}return null}integrate(t,e){if(e>0)this.id.clock+=e,this.left=ks(t,t.doc.store,g(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e;if(this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let n=this.left,r;if(n!==null)r=n.right;else if(this.parentSub!==null){r=this.parent._map.get(this.parentSub)||null;while(r!==null&&r.left!==null)r=r.left}else r=this.parent._start;let s=new Set,i=new Set;while(r!==null&&r!==this.right){if(i.add(r),s.add(r),Ve(this.origin,r.origin)){if(r.id.client<this.id.client)n=r,s.clear();else if(Ve(this.rightOrigin,r.rightOrigin))break}else if(r.origin!==null&&i.has(At(t.doc.store,r.origin))){if(!s.has(At(t.doc.store,r.origin)))n=r,s.clear()}else break;r=r.right}this.left=n}if(this.left!==null){let n=this.left.right;this.right=n,this.left.right=this}else{let n;if(this.parentSub!==null){n=this.parent._map.get(this.parentSub)||null;while(n!==null&&n.left!==null)n=n.left}else n=this.parent._start,this.parent._start=this;this.right=n}if(this.right!==null)this.right.left=this;else if(this.parentSub!==null){if(this.parent._map.set(this.parentSub,this),this.left!==null)this.left.delete(t)}if(this.parentSub===null&&this.countable&&!this.deleted)this.parent._length+=this.length;if(zs(t.doc.store,this),this.content.integrate(t,this),Ss(t,this.parent,this.parentSub),this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)this.delete(t)}else new R(this.id,this.length).integrate(t,0)}get next(){let t=this.right;while(t!==null&&t.deleted)t=t.right;return t}get prev(){let t=this.left;while(t!==null&&t.deleted)t=t.left;return t}get lastId(){return this.length===1?this.id:g(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&Ve(t.origin,this.lastId)&&this.right===t&&Ve(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){let e=this.parent._searchMarker;if(e)e.forEach((n)=>{if(n.p===t){if(n.p=this,!this.deleted&&this.countable)n.index-=this.length}});if(t.keep)this.keep=!0;if(this.right=t.right,this.right!==null)this.right.left=this;return this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let e=this.parent;if(this.countable&&this.parentSub===null)e._length-=this.length;this.markDeleted(),te(t.deleteSet,this.id.client,this.id.clock,this.length),Ss(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw B();if(this.content.gc(t),e)nc(t,this,new R(this.id,this.length));else this.content=new re(this.length)}write(t,e){let n=e>0?g(this.id.client,this.id.clock+e-1):this.origin,r=this.rightOrigin,s=this.parentSub,i=this.content.getRef()&Mt|(n===null?0:A)|(r===null?0:V)|(s===null?0:ht);if(t.writeInfo(i),n!==null)t.writeLeftID(n);if(r!==null)t.writeRightID(r);if(n===null&&r===null){let o=this.parent;if(o._item!==void 0){let c=o._item;if(c===null){let a=Fs(o);t.writeParentInfo(!0),t.writeString(a)}else t.writeParentInfo(!1),t.writeLeftID(c.id)}else if(o.constructor===String)t.writeParentInfo(!0),t.writeString(o);else if(o.constructor===st)t.writeParentInfo(!1),t.writeLeftID(o);else B();if(s!==null)t.writeString(s)}this.content.write(t,e)}}var gi=(t,e)=>Pc[e&Mt](t),Pc=[()=>{B()},Cc,Nc,Ac,Vc,Bc,Oc,Jc,Lc,Dc,()=>{B()}],Kc=10;class L extends rn{get deleted(){return!0}delete(){}mergeWith(t){if(this.constructor!==t.constructor)return!1;return this.length+=t.length,!0}integrate(t,e){B()}write(t,e){t.writeInfo(Kc),ft(t.restEncoder,this.length-e)}getMissing(t,e){return null}}var mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},wi="__ $YJS$ __";if(mi[wi]===!0)console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");mi[wi]=!0;var Ok=0,Ak=1,Pk=2,Mk=3;class Bf extends Error{constructor(t){super(t);this.name="EnvelopeError"}}function M0(t){let e=ha();switch(t.type){case"doc-sync":{ft(e,Ok),pa(e,t.path),ft(e,t.epoch),wr(e,t.body);break}case"awareness":{ft(e,Ak),wr(e,t.body);break}case"doc-close":{ft(e,Pk),pa(e,t.path);break}case"control":{ft(e,Mk),pa(e,JSON.stringify(t.message));break}default:throw new Bf(`unknown-frame:${t.type}`)}return Kr(e)}function F0(t){try{let e=fa(t),n=Et(e);switch(n){case Ok:{let r=ma(e),s=Et(e);return{body:Rr(e),epoch:s,path:r,type:"doc-sync"}}case Ak:return{body:Rr(e),type:"awareness"};case Pk:return{path:ma(e),type:"doc-close"};case Mk:{let r=JSON.parse(ma(e));if(typeof r!=="object"||typeof r.type!=="string")throw new Bf("malformed-control");return{message:r,type:"control"}}default:throw new Bf(`unknown-frame-type:${n}`)}}catch(e){if(e instanceof Bf)throw e;throw new Bf(`malformed-frame: ${e instanceof Error?e.message:String(e)}`)}}
|
|
6
|
-
export{A0,Io,ha,P0,Kr,ft,pa,wr,fa,Rr,Et,ma,hd,Iu,vc,Ik,Dk,Nk,ow,Hf,pI,Zg,Bs,sw,Zo,aw,ps,Ok,Ak,Pk,Mk,Bf,M0,F0};
|
|
7
|
-
|
|
8
|
-
//# debugId=B9AEFB48F64726C964756E2164756E21
|
|
9
|
-
//# sourceMappingURL=studio-j03zga3y.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{ot,zt,T,I,Ct}from"./studio-g1shz58g.js";import{y}from"./studio-55h4mstj.js";import{p}from"./studio-xz2yxfcb.js";import{Ao}from"./studio-pcgz8heb.js";import{Ul,Hd,Oc,Ji,tl,Bd,th}from"./studio-gx4dnjzd.js";import{xb,OE,_b,PE,ME}from"./studio-4tanh828.js";import{Ac}from"./studio-74k29dy9.js";import{Uy,Ai}from"./studio-yn9f8vtx.js";import{Ie}from"./studio-0bhx5hz6.js";function wd(t){let{anchor:e,name:r,scope:i,slot:a}=t,o=document.createElement("div");o.style.pointerEvents="auto",o.setAttribute(ot,zt("popover",a)),Ct("popover").append(o);let n=new AbortController,s=null,w=null,c=!1,F=(m)=>{if(c)return;if(c=!0,n.abort(),w?.dispose(),w=null,o.remove(),m)t.onDismissed?.()},A=(async()=>{let m=await I(r,i,o,{signal:n.signal,...t.onNodeCreated?{onNodeCreated:t.onNodeCreated}:{}});if(n.signal.aborted)return;if(w=m,s=m.root,s.setAttribute(ot,zt("popover",a)),s.addEventListener("toggle",(b)=>{if(b.newState==="closed")F(!0)}),!s.hasAttribute("popover"))await new Promise((b)=>{s?.addEventListener("jx-ready",()=>b(),{once:!0})});if(n.signal.aborted)return;s.showPopover(e?{source:e}:void 0)})();return{close:()=>{if(c)return;if(s?.open)s.hidePopover();F(!1)},host:o,isOpen:()=>!c,ready:A}}var E={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaField",$description:"The media field: a thumbnail of what the value names, the value itself, and the two doors to a different one. It is a LEAF a caller interpolates — the Inspector's Content tab, the Signals panel and the grid's image-cell panel each draw an empty host and `ui/media-picker.ts` mounts this into it — so it has no chrome of its own and takes its width from whatever row it lands in. **Browse is addressed through its `part`, not through a class.** `ui/regions.ts` derives `inspector/field:<prop>/browse` by finding the Browse control inside the Inspector's own `[data-prop]` row; the handle used to be `.media-picker-browse`, and a document emits no class, so `[part=\"browse\"]` is the handle now. The four `.media-picker*` rules from `styles/overlays.css` are TRANSCRIBED here rather than shared, for the reason `doc-header.json` gives: a class a document does not emit cannot style it. `--radius` becomes `--jx-radius-sm` on the way, because a document mounted in a pane's stage is outside `<sp-theme>` and would otherwise take a fallback rather than follow the theme.",tagName:"div",attributes:{part:"media-field"},style:{$description:"The row's own layout and the four transcribed `.media-picker*` rules. Upload and Browse never shrink, so the FIELD is what yields width when the row is narrow — the buttons would otherwise collapse into unreadable stubs before the text did.",display:"flex",alignItems:"center",gap:"var(--jx-space-1)",flex:"1",minWidth:"0",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="value"]':{flex:"1",minWidth:"0"},'& [part="upload"]':{flexShrink:"0"},'& [part="browse"]':{flexShrink:"0"},'& [part="thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",border:"1px solid var(--border)",flexShrink:"0"}},children:[{tagName:"span",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/thumbState"},cases:{shown:{$description:"Decorative on purpose: the field beside it already states the path in text, so a caption here would be the same fact twice to a screen reader and nothing to anyone else.",tagName:"img",attributes:{part:"thumb",src:"${state.thumbSrc}",alt:""}}}},{tagName:"jx-textfield",attributes:{part:"value"},$props:{size:"sm",label:"${state.label}",placeholder:"/image.jpg",value:{$ref:"#/state/value"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/edit"},value:[{$ref:"event#/target/value"}]}],description:"Every keystroke, because the host debounces it: the canvas follows the typing without a document write per character."},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/warm"},value:[]}],description:"Entering the field is the earliest honest signal that a pick is coming, so the project's media are listed then rather than when Browse is pressed."}},{tagName:"jx-action-button",attributes:{part:"upload"},$props:{size:"sm",quiet:!0,icon:"upload-simple",label:"Upload media",hint:"Upload media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"browse"},$props:{size:"sm",quiet:!0,icon:"image",label:"Browse media",hint:"Browse media"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/browse"},value:[{$ref:"event#/currentTarget"}]}],description:"The button hands over ITSELF: the browser is a popover and the platform wants its invoker, both so a second press on this control toggles rather than reopens and so focus comes back here when it closes."}}]};T("media-field",E);function C(t,e){t.label=e.label,t.value=e.value,t.thumbState=e.thumbState,t.thumbSrc=e.thumbSrc}function j(t,e,r){let i=y({browse:r.browse,edit:r.edit,label:e.label,thumbSrc:e.thumbSrc,thumbState:e.thumbState,upload:r.upload,value:e.value,warm:r.warm}),a=null,o=!1;return I("media-field",i,t).then((n)=>{if(o){n.dispose();return}a=n}),{dispose(){o=!0,a?.dispose(),a=null},update:(n)=>C(i,n)}}var L={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaBrowser",$description:'The project\'s media, offered under whatever control asked for them. **Not the kit menu, and the difference is the thumbnails.** `surfaces/menu.json` is the settled answer to "a list of actions" and a `MenuRowProjection` carries a title, a chord and a gate — there is nowhere in it for a picture, nowhere for the size caption beside it, and a `jx-menu` is itself `popover=auto`, so a filter field cannot stand above one inside a panel. This is a browser: you pick an image by looking at it. **It is a `jx-popover`, so the PLATFORM owns dismissal** — light dismiss, Escape, the top layer and focus back to the invoker are the popover\'s contract, which is why nothing here binds a document listener and why the panel can paint over a modal `<dialog>` that the layer-div popover it replaces could not. The rows are plain buttons in a group, exactly as `grid-views.json`\'s saved views are: a list of buttons is reachable by Tab, and a `role="listbox"` would be a keyboard contract nothing here implements.',tagName:"jx-popover",attributes:{part:"media-browser"},$props:{label:"Project media",x:{$ref:"#/state/x"},y:{$ref:"#/state/y"}},children:[{tagName:"div",attributes:{part:"body"},style:{$description:"A search box that stays put and a list that scrolls under it. The panel itself never scrolls — `jx-popover` says why — so the box is here rather than on the host.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-2)",minWidth:"260px",maxHeight:"360px",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="rows"]':{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",minHeight:"0"},'& [part="row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",textAlign:"left",background:"none",border:"none",color:"var(--fg)",font:"inherit",padding:"var(--jx-space-1) var(--jx-space-2)",borderRadius:"var(--jx-radius-sm)",cursor:"pointer",minWidth:"0"},'& [part="row"]:hover':{background:"var(--bg-hover)"},'& [part="row"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="row-thumb"]':{width:"24px",height:"24px",objectFit:"cover",borderRadius:"var(--jx-radius-sm)",flexShrink:"0"},'& [part="row-text"]':{display:"flex",flexDirection:"column",minWidth:"0"},'& [part="row-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="row-caption"]':{color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="empty"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"},'& [part="more"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-xs)"}},children:[{tagName:"jx-textfield",attributes:{part:"filter"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search media…",autocomplete:"off",value:{$ref:"#/state/filter"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"div",attributes:{part:"rows-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/rowsState"},cases:{empty:{tagName:"p",attributes:{part:"empty"},textContent:"${state.emptyLabel}"},listed:{tagName:"div",attributes:{part:"rows"},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{$description:"One file. The row hands back the value a pick writes — the site URL — rather than an index, so the list may be filtered under it without changing what any row means.",tagName:"button",attributes:{part:"row",type:"button","data-path":"${$map.item.path}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"$map/item/path"}]}]},children:[{tagName:"span",attributes:{part:"row-thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{shown:{$description:"Decorative: the row's own text names the file. The load handler is the whole of the dimensions caption — measuring an image is a decode the `<img>` has finished by the time `load` fires, so the numbers are a read of work already done rather than a second fetch per row.",tagName:"img",attributes:{part:"row-thumb",src:"${$map.item.thumbSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}}}},{tagName:"span",attributes:{part:"row-text"},children:[{tagName:"span",attributes:{part:"row-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"row-caption-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/captionState"},cases:{shown:{tagName:"span",attributes:{part:"row-caption"},textContent:"${$map.item.caption}"}}}]}]}}]}}},{tagName:"div",attributes:{part:"more-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/moreState"},cases:{shown:{$description:'A truncated list says so. Fifty rows is the cap the list has always had; the sentence is what keeps the cap from reading as "that is all there is".',tagName:"p",attributes:{part:"more"},textContent:"${state.moreLabel}"}}}]}]};T("media-browser",L);var D="media-picker";function V(t,e){t.x=e.x,t.y=e.y,t.filter=e.filter,t.rowsState=e.rowsState,t.rows=e.rows,t.emptyLabel=e.emptyLabel,t.moreState=e.moreState,t.moreLabel=e.moreLabel}function N(t,e,r){let i=y({emptyLabel:t.emptyLabel,filter:t.filter,measure:e.measure,moreLabel:t.moreLabel,moreState:t.moreState,pick:e.pick,rows:t.rows,rowsState:t.rowsState,setFilter:e.setFilter,x:t.x,y:t.y}),a=wd({anchor:r,name:"media-browser",scope:i,slot:D,...e.dismissed?{onDismissed:e.dismissed}:{}});return a.ready.then(()=>{if(a.isOpen())a.host.querySelector('[part="filter"] [part="input"]')?.focus()}),{close:a.close,host:a.host,isOpen:a.isOpen,ready:a.ready,update:(o)=>V(i,o)}}var h=[],S=!1;async function P(t,e){let r=[];try{let i=await Ao(()=>e.listDirectory(t));OE(i);for(let a of i)if(a.type==="directory"){let o=await P(a.path,e);r.push(...o)}else{let o=Ji(a.name);if(Hd.has(o))r.push({file:a.path,isImage:Ul.has(o),name:a.name,path:Bd(a.path)})}}catch{}return r}async function g(){if(S)return;let t=p();h=await P("public",t),S=!0,Ai("leftPanel","rightPanel","frontmatterPanel")}function pS(){h=[],S=!1,PE()}var v=50,d=null,u=null,l="",M={x:0,y:0};function k(){let t=l.toLowerCase(),e=t?h.filter((a)=>a.path.toLowerCase().includes(t)||a.name.toLowerCase().includes(t)):h,i=e.slice(0,v).map((a)=>{let o=ME(xb(a.file));return{caption:o,captionState:o?"shown":"hidden",file:a.file,key:a.file,name:a.name,path:a.path,thumbSrc:a.isImage?th(a.file):"",thumbState:a.isImage?"shown":"hidden"}});return{emptyLabel:"No matches",filter:l,moreLabel:`…${e.length-v} more`,moreState:e.length>v?"shown":"hidden",rows:i,rowsState:i.length>0?"listed":"empty",x:M.x,y:M.y}}function B(){let t=d;d=null,u=null,l="",t?.close()}var x=0;function z(t,e,r){if(!_b(t,e,r)||x!==0)return;x=requestAnimationFrame(()=>{x=0,d?.update(k())})}function mI(t,e){B(),u=e;let r=Ie(t);M={x:r.left,y:r.bottom+4},d=N(k(),{dismissed:()=>{d=null,u=null,l=""},measure:z,pick:(i)=>{let a=u;B(),a?.(i)},setFilter:(i)=>{l=i,d?.update(k())}},t)}async function gI(t,e){let r=await tl([...t]),[i]=r;if(i)e(i.ref)}function bI(t){let e=document.createElement("input");e.type="file",e.multiple=!0,e.accept=Oc(),e.addEventListener("change",()=>{if(e.files?.length)gI(e.files,t)}),e.click()}var _=400,f=new WeakMap;function H(t,e){let r=Ul.has(Ji(e));return{label:t,thumbSrc:r&&e?Ac(e):"",thumbState:r&&e?"shown":"hidden",value:e}}function xd(t,e,r,i){g();let a=f.get(t);if(a){a.prop=e,a.commit=i,a.handle.update(H(e,r));return}let o={commit:i,handle:null,prop:e};o.handle=j(t,H(e,r),{browse:(n)=>{g(),mI(n,(s)=>o.commit(s))},edit:(n)=>Uy(`media:${o.prop}`,_,(s)=>o.commit(s))(n),upload:()=>bI((n)=>o.commit(n)),warm:()=>{g()}}),f.set(t,o)}function Tw(t){let e=f.get(t);if(e)f.delete(t),e.handle.dispose()}
|
|
2
|
-
export{wd,pS,mI,gI,bI,xd,Tw};
|
|
3
|
-
|
|
4
|
-
//# debugId=F5681A65C0944C7164756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-jhpxeckz.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{Ie}from"./studio-0bhx5hz6.js";var p=3;function H(e,t,n){return Math.min(n,Math.max(t,e))}function Nw(e){let t=Math.max(0,Math.trunc(e.count)),n=Math.max(1,Math.trunc(e.columns??1)),o=Math.ceil(t/n);if(!(e.rowHeight>0)||!(e.viewportHeight>0))return{end:t,padBottom:0,padTop:0,start:0,totalRows:o};let r=Math.max(0,Math.trunc(e.overscanRows??p)),i=Math.max(0,e.scrollTop),m=Math.floor(i/e.rowHeight),w=Math.ceil(e.viewportHeight/e.rowHeight)+1,l=H(m-r,0,o),a=H(m+w+r,l,o);return{end:Math.min(t,a*n),padBottom:(o-a)*e.rowHeight,padTop:l*e.rowHeight,start:Math.min(t,l*n),totalRows:o}}function M(e,t){return e.start===t.start&&e.end===t.end&&e.totalRows===t.totalRows&&e.padTop===t.padTop&&e.padBottom===t.padBottom}function v(e){let{scroller:t,list:n,count:o,rowHeight:r,columns:i,onChange:m,overscanRows:w}=e,l={end:0,padBottom:0,padTop:0,start:0,totalRows:0},a=!1;function c(){if(a)return;let d=Nw({columns:i?.()??1,count:o(),overscanRows:w??p,rowHeight:r(),scrollTop:n?g(t,n):t.scrollTop,viewportHeight:t.clientHeight}),T=!M(l,d);if(l=d,T)m(d)}t.addEventListener("scroll",c,{passive:!0});let u=0,b=()=>{if(u!==0)return;u=requestAnimationFrame(()=>{u=0,c()})},s=null;if(typeof ResizeObserver==="function"){if(s=new ResizeObserver(b),s.observe(t),n)s.observe(n)}return c(),{destroy(){if(a=!0,t.removeEventListener("scroll",c),s?.disconnect(),s=null,u!==0)cancelAnimationFrame(u),u=0},measure:c,range:()=>l}}function R(e){for(let t=e;t;t=t.parentElement){if(t.scrollHeight<=t.clientHeight)continue;let n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t}return null}function f(e){let t=h.get(e);if(t&&t.isConnected&&e.isConnected&&t.contains(e))return t;let n=R(e);if(n)h.set(e,n);else h.delete(e);return n}function g(e,t){if(e===t)return Math.max(0,e.scrollTop);return Math.max(0,Ie(e).top-Ie(t).top)}function mb(e,t){let n=e?.isConnected===!0?f(e):null;if(!n||!e){let o=Math.max(0,Math.trunc(t.count));return{end:o,padBottom:0,padTop:0,start:0,totalRows:o}}return Nw({columns:t.columns??1,count:t.count,...t.overscanRows===void 0?{}:{overscanRows:t.overscanRows},rowHeight:t.rowHeight,scrollTop:g(n,e),viewportHeight:n.clientHeight})}function x(e){let t=e.listOffset+e.index*e.rowHeight,n=t+e.rowHeight;if(t<e.scrollTop)return Math.max(0,t);if(n>e.scrollTop+e.viewportHeight)return Math.max(0,n-e.viewportHeight);return null}function gb(e,t,n){let o=e?.isConnected===!0?f(e):null;if(!o||!e||t<0||!(n>0))return!1;let{scrollTop:r}=o,i=x({index:t,listOffset:r-g(o,e),rowHeight:n,scrollTop:r,viewportHeight:o.clientHeight});if(i===null)return!1;return o.scrollTop=i,!0}function TE(e,t,n){let o=e?.querySelector(t);return o&&o.offsetHeight>0?o.offsetHeight:n}var h=new WeakMap;function bb(e,t,n){let o=f(t);if(e&&e.list===t&&e.scroller===o)return e;if(e?.window.destroy(),!o)return null;return{list:t,scroller:o,window:v({count:n.count,list:t,onChange:()=>n.onChange(),rowHeight:n.rowHeight,scroller:o})}}
|
|
2
|
-
export{Nw,mb,gb,TE,bb};
|
|
3
|
-
|
|
4
|
-
//# debugId=51E74C36C036F85564756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-k01r7ykp.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{tt}from"./studio-1q1sh2ax.js";import{te}from"./studio-ery42sqr.js";import{ne}from"./studio-9mccjwjh.js";import{T,I,sn,sl,Pn}from"./studio-g1shz58g.js";import{y,jr,C}from"./studio-55h4mstj.js";import{p,Ve}from"./studio-xz2yxfcb.js";import{Kt,Jd,rl,zp,Ys,Up,Qt,ol}from"./studio-5tnvjkz4.js";import{xa}from"./studio-yb560vxr.js";import{Ao,Rp}from"./studio-pcgz8heb.js";import{hn,Or,nh,Am,Op,Jx,ti,m,ah,Jl,nl,Mr,b1,ui,Fm,Wy}from"./studio-a2ke1e4t.js";import{Uu,sT,aT,Vs}from"./studio-t6b6qe31.js";import{St,Oo,Xo}from"./studio-w0cgf6jg.js";import{ys,mL,yL,hy,ws,py}from"./studio-t1xzawhr.js";import{ya}from"./studio-7zx31knw.js";import{Kn}from"./studio-rc6dvxjb.js";import{zl}from"./studio-e81q1vb9.js";import{xo,Ks,Js,_s}from"./studio-rv11kfwa.js";import{yb,mp,gp,Pw,IE,nm}from"./studio-myjcghv3.js";import{Oc,gy,tl}from"./studio-gx4dnjzd.js";import{YE,VS}from"./studio-vyc0b4he.js";import{oT,Do,dm,um}from"./studio-7vg6jcd3.js";import{Pt}from"./studio-h46vtzk8.js";import{mb,gb,bb}from"./studio-k01r7ykp.js";import{fs}from"./studio-gkskhg7m.js";import{ga}from"./studio-qv1pwd3c.js";import{D,Xl,vt}from"./studio-yn9f8vtx.js";import{me}from"./studio-pre0skq6.js";async function Xf(){if(yb(location.search))return!1;let e=p();if(!e.dependenciesNeedInstall||!e.installDependencies)return!1;let t=!1;try{t=await e.dependenciesNeedInstall()}catch{return!1}if(!t)return!1;let n=ya({status:"Running bun install…",title:"Installing dependencies"});try{let o=await e.installDependencies();if(o.ok)return n.done(),!0;n.fail(o.log??"bun install failed")}catch(o){n.fail(o instanceof Error?o.message:String(o))}return!1}var Be=["page","component"],Ge={components:"component",pages:"page"};function _(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ke(e){let t=_(e).toLowerCase();for(let[n,o]of Object.entries(Ge))if(t.startsWith(`${n}/`))return o;return null}function ee(e){return Be.some((t)=>e.includes(t))}function Ye(e){let t=D?.projectConfig?.layout;if(typeof t!=="string")return!1;return _(t).toLowerCase()===_(e).toLowerCase()}function ge(e){let t=[{ext:".json",label:"JSON (.json)"}];for(let n of ol(e)){let o=Ys(n,"parse");if(o&&Ys(n,"serialize"))t.push({ext:n,label:`${o.name} (${n})`})}return t}function we(){return new Set([".json",...zp().flatMap((e)=>e.extensions)])}function Lw(e){if(e===null||e===void 0||e==="")return[];let t=Ke(e);if(t===null||Ye(e)||Jx(e))return[];let n=Qt(e);if(!(n?Boolean(n.capabilities.parse)&&ee(n.documentKinds):_(e).toLowerCase().endsWith(".json")))return[];let r=[];if(n)r.push({ext:".json",label:"JSON (.json)"});for(let a of ol()){let i=Ys(a,"serialize");if(!i||i.name===n?.name||!ee(i.documentKinds)||!i.documentKinds.includes(t))continue;r.push({ext:a,label:`${i.name} (${a})`})}return r}function _E(){let e=new Set([".json"]);for(let t of zp()){if(!t.capabilities.serialize||!ee(t.documentKinds))continue;for(let n of t.extensions)e.add(n)}return[...e].toSorted()}var oe="jx-studio-recent-projects",ye="jx-studio-recent-files",ve=8,Qe=10,M=[];function V(){if(!Ve())return null;let e=p();return e.getRecentProjects&&e.saveRecentProjects?e:null}function Xe(){try{let e=localStorage.getItem(oe);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function re(){return V()?M:Xe()}function be(e){M=e;let t=V();if(t)t.saveRecentProjects(e);else try{localStorage.setItem(oe,JSON.stringify(e))}catch{}}async function SE(){let e=V();if(!e)return;try{M=await e.getRecentProjects()}catch{M=[]}}function pb(){return re().toSorted((e,t)=>t.timestamp-e.timestamp)}function fb(e,t){let n=re().filter((o)=>o.root!==t);if(n.unshift({name:e,root:t,timestamp:jr()}),n.length>ve)n.length=ve;be(n)}function Rw(e){be(re().filter((t)=>t.root!==e))}function CE(){M=[];let e=V();if(e)e.saveRecentProjects([]);else localStorage.removeItem(oe)}function xe(){try{let e=localStorage.getItem(ye);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function kE(e){let t=xe().toSorted((n,o)=>o.timestamp-n.timestamp);return e==null?t:t.filter((n)=>n.root===e)}function Qf(e){let t=xe().filter((r)=>!(r.root===e.root&&r.path===e.path));t.unshift({name:e.name,path:e.path,root:e.root,timestamp:jr()});let n=new Map,o=[];for(let r of t.toSorted((a,i)=>i.timestamp-a.timestamp)){let a=(n.get(r.root)??0)+1;if(n.set(r.root,a),a<=Qe)o.push(r)}localStorage.setItem(ye,JSON.stringify(o))}var Pe={$schema:"https://jxsuite.com/schema/v1",$id:"StudioFilesPanel",$description:'The Navigator\'s Files tree, as a Jx document over the kit. `files/files.ts` keeps every decision — which directories are listed, which entries `.gitignore` masks, which rows the window draws, what a click on a row means, what the context menu offers and what each verb does to the filesystem — and hands this document one projection: a word saying which of three things to draw, a toolbar whose state is already resolved, and rows whose every field is already a string. Nothing here asks what a file is, how tall the Navigator is, or whether a directory has been read. THE TREE IS `jx-tree`, and that is what this document no longer says: `role="tree"`, `role="treeitem"`, `aria-level`, `aria-posinset`, `aria-setsize`, the roving `tabindex` and the five arrow-key cases were each written out here and written out again in `panel-outline.json`, two copies of one keyboard contract with nothing holding them in agreement. The element owns all of it; what is left here is what this tree IS — a flat projection of rows, each already carrying its own level and set counts, because the DOM holds a WINDOW onto the model and an expanded `node_modules` is eleven rows rather than ten thousand. The window reaches the element as `padtop`/`padbottom`, and a caret move past either comes back as `move` for the flow to scroll and repaint. Four facts a row carries are bound against ONE scope field each — the current path, the selected path, the dragged path and the drop target — so moving the caret or dragging a file re-evaluates an attribute per drawn row instead of rebuilding the list under the reader\'s pointer. The pragmatic-drag-and-drop handles are an ISLAND: the document draws the rows and the tree, and the adapter attaches sources and targets to them through `onNodeCreated` (specs/studio-ui-guidelines.md §9.4).',tagName:"div",attributes:{part:"files"},style:{$description:"What the twenty `.file-tree*`, `.files-toolbar`, `.project-header` and `.project-name` rules in `styles/panels.css` said, keyed on `part` and re-pointed at the studio token layer. Three names could not come with the declarations. The five `var(--spectrum-font-size-50 | -75, …)` reads are the kit's `--jx-text-sm` and `--jx-text-md`, which are the same 11px and 12px — a `--spectrum-*` name is declared by `<sp-theme>` and by nothing else in this package, so a document that reads one is a document whose type size changes when a component it does not use is removed. The `.selected`, `.dragging`, `.drag-over` and `.drag-over-root` classes are `data-` attributes on a part, because a part is the handle now and because a state a handler adds and forgets to take off is exactly the defect a cancelled drag used to leave on screen. MOST OF THE ROW'S OWN RULES ARE GONE, and that is the point of the element rather than an omission: `jx-tree-item` declares the flex line, the one-control-height box the window reserves scroll by, the indent (`--jx-tree-indent` times one less than `level` — exactly the `8 + depth * 16` this file composed per row), the hover and focus states, the selected wash and the faded dragged row. What is left here is what is TRUE OF THIS TREE and not of trees in general: it owns its own scrollbar, a click on a row opens it, and the row a drag is over wears the drop mark this file draws.",display:"flex",flexDirection:"column",height:"100%",minHeight:"0",overflow:"hidden",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",'& [part="empty"]':{$description:"The two states that are not a tree. They are two states and not one sentence: a window with no project at all and a monorepo root that has not been pointed at a site are different situations, and only the second has anything to offer (studio-ui-guidelines.md §11).",padding:"var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)",fontSize:"var(--jx-text-md)",display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-4)"},'& [part="empty"] p':{margin:"0"},'& [part="frame"]':{display:"flex",flexDirection:"column",height:"100%",minHeight:"0"},'& [part="project-header"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)",flexShrink:"0"},'& [part="project-name"]':{fontSize:"var(--jx-text-md)",fontWeight:"600",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'& [part="toolbar"]':{display:"flex",gap:"var(--jx-space-2)",padding:"var(--jx-space-2) var(--jx-space-3)",borderBottom:"1px solid var(--border)",alignItems:"center",flexShrink:"0"},'& [part="search"]':{flex:"1",minWidth:"0"},'& [part="tree"]':{$description:"The scroller as well as the list. `ui/virtual-window.ts` walks up from the element it is given looking for the nearest thing that scrolls, and finding itself is the shortest answer — which is why the element declares no `overflow` of its own and leaves the question to the two trees that answer it differently. The colour is re-declared because `jx-tree` sets `--jx-fg` on itself, and this panel's text colour is the studio alias of it.",flex:"1",minHeight:"0",overflowY:"auto",color:"var(--fg)"},'& [part="tree"][data-drop="true"]':{background:"var(--hover-bg)"},'& [part="row"]':{$description:"What the element does not decide. A click on a row OPENS it here — a directory unfolds, a file takes a tab — so the pointer is a pointer rather than the element's default arrow; and the gap is the wider one this tree has always drawn between a 16px file glyph and its name.",gap:"var(--jx-space-3)",cursor:"pointer"},'& [part="loading-row"]':{$description:"A directory whose listing has not arrived yet. It holds the place and it is NOT a row: it is not a `jx-tree-item`, so the caret cannot land on it, the set counts do not include it and typeahead cannot match it — and it is replaced by the real rows on the repaint the listing provokes. It draws the same box by hand because it is the only line in this tree the element does not draw, and a placeholder of a different height would desynchronise the window's scroll reservation from the rows it reserves for.",display:"flex",alignItems:"center",boxSizing:"border-box",blockSize:"var(--jx-control-h)",paddingInline:"calc(var(--jx-space-3) + var(--depth, 0) * 16px) var(--jx-space-3)",color:"var(--fg-dim)",fontStyle:"italic",cursor:"default",userSelect:"none",whiteSpace:"nowrap"},'& [part="row-icon"]':{flexShrink:"0",display:"flex",alignItems:"center","--jx-icon-size":"16px"},'& [part="locale"]':{$description:"The language chip. Deliberately declares no block size, no padding and no line height: the row above is one control-height by contract, and a chip that grew the box would desynchronise the window's scroll reservation from the height it reserves by. It only ever shrinks the text. A chip, not a filter term: the search matches the file's name alone, because a query that silently also matched a language would make “why is this file here” unanswerable from what is on screen.",marginInlineStart:"auto",flexShrink:"0",fontSize:"var(--jx-text-sm)",color:"var(--fg-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxInlineSize:"6em"},'& [part="view-slot"], & [part="header-slot"], & [part="locale-slot"]':{$description:"A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",display:"contents"}},children:[{tagName:"div",attributes:{part:"view-slot",role:"none"},$switch:{$ref:"#/state/view"},cases:{none:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"No project loaded"}]},welcome:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"p",textContent:"Open a project folder to get started."},{tagName:"jx-button",attributes:{part:"open-project"},$props:{variant:"accent",size:"sm"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openProject"},value:[]}],description:"The declared `project.open` command, run through the registry — not a second opener of this surface's own. It is the one the chord, the palette and the status bar's PROJECT field already run, so a window that opens a project from here reports the outcome the same way they do (studio-ui-guidelines.md §12.5)."},children:[{tagName:"span",textContent:"Open Project"}]}]},tree:{tagName:"div",attributes:{part:"frame"},children:[{tagName:"div",attributes:{part:"header-slot",role:"none"},$switch:{$ref:"#/state/headerState"},cases:{shown:{tagName:"div",attributes:{part:"project-header"},children:[{tagName:"span",attributes:{part:"project-name",title:"${state.projectName}"},textContent:"${state.projectName}"}]}}},{tagName:"div",attributes:{part:"toolbar"},children:[{$description:"A row of quiet tools, so NOT compact. A compact group draws every member's frame and fill whatever its quiet says, which is the segmented look a choice wants and not the borderless one a toolbar wants; Spectrum's group here was `compact quiet`, a combination the kit spells as compact=false with its members' default quiet.",tagName:"jx-action-group",attributes:{part:"toolbar-actions"},$props:{compact:!1,label:"File tree actions"},children:[{tagName:"jx-action-button",attributes:{part:"new-file"},$props:{size:"sm",icon:"plus",label:"New File",hint:"New File"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/newFile"},value:[]}]}},{tagName:"jx-action-button",attributes:{part:"refresh"},$props:{size:"sm",icon:"arrows-clockwise",label:"Refresh",hint:"Refresh"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/refresh"},value:[]}],description:"The rules go with the listings. Refresh is what an author reaches for after editing a `.gitignore` by hand, and a tree that came back still hiding by the old rules would read as the button not having worked."}},{tagName:"jx-action-button",attributes:{part:"show-ignored"},$props:{size:"sm",icon:{$ref:"#/state/ignoredIcon"},label:{$ref:"#/state/ignoredLabel"},hint:{$ref:"#/state/ignoredLabel"},selected:{$ref:"#/state/ignoredSelected"}},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/toggleIgnored"},value:[]}],description:"A repaint and nothing else: the ignored entries were never dropped from the cached listings, only from the rows built out of them."}}]},{tagName:"jx-textfield",attributes:{part:"search"},$props:{label:"Filter files",placeholder:"Filter files…",size:"sm",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/search"},value:[{$ref:"event#/target/value"}]}],description:"The query matches a file's NAME and nothing else. A directory is kept whatever it says, because hiding the folder a match sits in would leave the match with nowhere to be drawn."}}]},{$description:'The `role="tree"`, and everything that used to be spelled out under it. The element writes the role, the name, the roving tab stop and every row\'s `aria-level` / `aria-posinset` / `aria-setsize`, and it owns the whole ARIA keyboard: the arrows walk the drawn rows without wrapping, `Home` and `End` reach the ends of the MODEL by way of the pads, `ArrowRight` opens a directory and steps into an open one, `ArrowLeft` closes one and otherwise steps out to its parent, `Enter` activates and a printable character is typeahead. Every chord it does not own — cut, copy, paste, delete, rename — passes straight through to the flow, which is the WCAG 2.5.7 obligation this tree carries because dragging a file is the other way to move it. What reaches this document is five events, and each of them is a decision `files.ts` already owned.',tagName:"jx-tree",attributes:{part:"tree",label:"Project files",current:"${state.currentPath}",padtop:"${state.padTop}",padbottom:"${state.padBottom}","data-drop":"${state.rootDrop || null}"},onselect:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"event#/detail/value"}]}],description:"The reader meant that row. This tree is single-select, so the element resolves every modifier to `replace` before it gets here and the detail's `mode` and `anchor` are answers to a question this tree does not ask. There is no `change` handler beside it on purpose: the element OWNS the caret and keeps it across every repaint that does not change `current`, so a second copy of it in the flow would be a variable that only ever went stale."},onactivate:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"event#/detail"}]}],description:"`Enter` or a double click. The same verb a single click reaches, by the same name."},onexpand:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/expand"},value:[{$ref:"event#/detail/value"},{$ref:"event#/detail/expanded"}]}],description:"`ArrowRight`, `ArrowLeft` or the twisty, with ONE dispatcher between them: the detail says the state the row should be PUT INTO, so the flow never has to work out which way a toggle was going."},onmove:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/move"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/key"}]}],description:"The caret has to reach a row the window did not draw. The element knows only that the pad on that side is not zero; where the row is in the model, and how far to scroll to bring it into view, is the flow's — which is why this is an event and not a `scrollIntoView`."},ontypeahead:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/typeahead"},value:[{$ref:"event#/detail/from"},{$ref:"event#/detail/char"}]}],description:"A printable character, on a windowed tree. The same hand-off as `onmove` and for a sharper reason: a move off the end of the slice announces itself, and a letter never does — the element's own search over the drawn rows always answers, and over a `node_modules` of ten thousand entries the answer is whichever of the eleven painted rows happened to start with that letter. So the element dispatches EVERY such character and the flow answers it over the model."},children:[{$prototype:"Array",items:{$ref:"#/state/rows"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"row-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/kind"},cases:{item:{tagName:"jx-tree-item",attributes:{part:"row",value:"${$map.item.path}",label:"${$map.item.name}",level:"${$map.item.level}",posinset:"${$map.item.posInSet}",setsize:"${$map.item.setSize}",expanded:"${$map.item.ariaExpanded}",selected:"${state.selectedPath === $map.item.path ? 'true' : 'false'}","data-type":"${$map.item.type}","data-dragging":"${state.dragPath === $map.item.path ? '' : null}","data-drop":"${state.dropPath === $map.item.path ? '' : null}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/path"}]}],description:"A single click OPENS the row, which is this tree's own answer and not the element's. `jx-tree` answers a click with `change` and `select`, exactly as it answers an arrow key, and a tree that opened on `select` would open every file the reader arrowed past. So the opening verb is bound here, where a click is a click; what a click MEANS — unfold this directory, take a tab for that file — stays the flow's, and Enter reaches the same verb through `activate`. It does NOT stop the event, which is the correction: the tree's delegated click is what moves the caret and the selection onto the row, so a `stopPropagation` here would leave a reader who clicked a folder with the tab stop still on whatever they had open last. The twisty stops its own click, so opening a directory from the chevron does not also activate the row."},oncontextmenu:{$prototype:"Function",body:[{preventDefault:!0},{stopPropagation:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/path"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]},children:[{tagName:"jx-icon",attributes:{slot:"icon",part:"row-icon","aria-hidden":"true"},$props:{name:{$ref:"$map/item/icon"}}},{tagName:"div",attributes:{slot:"status",part:"locale-slot",role:"none"},$switch:{$ref:"$map/item/localeState"},cases:{shown:{tagName:"span",attributes:{part:"locale"},textContent:"${$map.item.locale}"}}}]},loading:{$description:"A directory whose listing has not arrived yet. Deliberately not a `jx-tree-item`: there is no file there to select, open, rename or drag, and a row the caret could land on that answers to none of the verbs the caret offers is a stop in the walk with nothing behind it.",tagName:"div",attributes:{part:"loading-row",role:"none","data-loading":"true",style:"--depth:${$map.item.depth}"},textContent:"Loading…"}}}}]}]}}}]};T("files-panel",Pe);function Fe(e,t){e.view=t.view,e.headerState=t.headerState,e.projectName=t.projectName,e.query=t.query,e.ignoredLabel=t.ignoredLabel,e.ignoredIcon=t.ignoredIcon,e.ignoredSelected=t.ignoredSelected,e.padTop=t.padTop,e.padBottom=t.padBottom,e.rows=t.rows,e.selectedPath=t.selectedPath,e.dragPath=t.dragPath,e.dropPath=t.dropPath,e.rootDrop=t.rootDrop,e.currentPath=t.currentPath}function J(){return{currentPath:"",dragPath:"",dropPath:"",headerState:"hidden",ignoredIcon:"eye-slash",ignoredLabel:"Show ignored files",ignoredSelected:!1,padBottom:0,padTop:0,projectName:"",query:"",rootDrop:"",rows:[],selectedPath:"",view:"none"}}function et(e){let t=typeof e==="string"?void 0:e.attributes?.part;return typeof t==="string"?t:""}function nt(e){let n=e?.$map?.item;return typeof n?.path==="string"?n:null}function je(e,t,n){let o=y({...J(),...n});Fe(o,t);let r=null,a=!1,i=I("files-panel",o,e,{onNodeCreated:(s,l,c,d)=>{if(a||!(s instanceof HTMLElement))return;let F=et(c);if(F==="tree"){n.treeHost(s);return}if(F!=="row")return;let v=nt(d);if(v)n.rowHost(s,v.path,v.type)}}).then((s)=>{if(a){s.dispose();return}r=s});return{connected:()=>!a&&(r===null||r.root.parentNode===e),dispose(){a=!0,r?.dispose(),r=null},ready:i,update:(s)=>{Fe(o,s)}}}async function $r(e){if(!D)return;try{let t=p(),[n]=await Promise.all([Ao(()=>t.listDirectory(e)),sT(e)]);D.dirs.set(e,n)}catch{D.dirs.set(e,[])}}function pe(){return Oo(St.showIgnoredFiles)==="true"}function ot(e){Xo(St.showIgnoredFiles,e?"true":"")}async function fS(){try{let e=p(),t=await e.probeRootProject();if(!t)return;let{meta:n,info:o}=t;if(Jd(),Kt(),rl(e),Uu(),Rp(),Xl({dirs:new Map,expanded:new Set,isSiteProject:o.isSiteProject,name:o.isSiteProject?o.projectConfig?.name||n.name:n.name,projectConfig:(o.isSiteProject?o.projectConfig:null)||null,projectDirs:o.directories||[],projectRoot:".",root:n.root,searchQuery:"",selectedPath:null}),o.isSiteProject)nl(n.root||".",o.projectConfig||null);if(o.isSiteProject){if(fb(vt().name,n.root),await gp(),await Xf())Jd(),await Kt(),rl(e);await $r("."),await zl(),await em(),mp(n.root)}}catch{}}async function mS({renderLeftPanel:e}){try{let t=p(),n=await t.openProject();if(!n)return!1;let{config:o,handle:r}=n;if(b1({document:{children:[],tagName:"div"},id:"initial"}),oT(),Jd(),Kt(),rl(t),Uu(),Rp(),Xl({...D,dirs:new Map,expanded:new Set,isSiteProject:!0,name:o.name||r.name,projectConfig:o,projectRoot:r.root,searchQuery:"",selectedPath:null}),nl(r.root,o),await gp(),await Xf())Jd(),await Kt(),rl(t);await $r("."),await zl();let a=new Set(["pages","layouts","components","content","data","public","styles"]),i=vt().dirs.get(".")||[],s=[];for(let l of i)if(l.type==="directory"&&a.has(l.name))s.push(l.name),vt().expanded.add(l.path||l.name),await $r(l.path||l.name);return vt().projectDirs=s,nm(),py(),ws("files"),fb(vt().name,vt().projectRoot),e(),await em(),mp(vt().projectRoot),!0}catch(t){return C.error("Could not open the project.",{detail:te(t),source:"Open Project"}),!1}}async function gS(e){let t=p();if(t.createDestination!=="path")return!1;try{if(await t.activate(e),(await t.gitStatus()).isRepo)return!1;return await t.gitInit(),C.success("Initialized a git repository for this project."),!0}catch(n){return C.warn("Could not initialize a git repository — the project itself was written.",{detail:te(n),source:"Source Control"}),!1}}async function $w(){await Kt();let e=[...ol("page"),".json"],t;try{t=await p().listDirectory("pages")}catch{return null}let n=new Set(t.filter((o)=>o.type==="file").map((o)=>o.name));for(let o of e)if(n.has(`index${o}`))return`pages/index${o}`;return null}async function rt(){let e=await $w();if(e)await Ir(e)}async function em(){let e=yL(m.projectRoot);if(hy(m.projectRoot),e){if(await mL(e,{ensureSecondPane:()=>{Jl(ti)},openFile:(n,o)=>Ir(n,{focus:!1,paneId:o})})>0)return!0}return await rt(),!1}function at(e,t,n){if(t==="directory")return n?"folder-open":"folder";let o=e.split(".").pop()?.toLowerCase();switch(o){case"css":case"js":case"json":case"ts":return"file-code";case"md":return"file-text";default:return o!==void 0&&gy(o)?"image":"file"}}function bS(){return tt}function yS(e){}var it=24,u=[],A=null,L=new Map,B=null,Se=null;function ue(){for(let e of L.values())if(e.isConnected&&e.offsetHeight>0)return e.offsetHeight;return it}function st(){for(let[e,t]of L)if(!t.isConnected)L.delete(e),Oe(t)}function Re(e){let t=L.get(e);return t?.isConnected===!0?t:null}function X(e){return u.find((t)=>!t.loading&&t.path===e)}function ke(e,t,n,o){let r=vt().dirs.get(e);if(!r){$r(e).then(()=>f()),n.push({depth:t,expanded:!1,key:`loading:${e}`,loading:!0,name:"Loading…",path:e,posInSet:1,setSize:1,type:"file"});return}let a=[...r].toSorted((c,d)=>{if(c.type==="directory"&&d.type!=="directory")return-1;if(c.type!=="directory"&&d.type==="directory")return 1;return c.name.localeCompare(d.name)}),i=pe()?a:a.filter((c)=>!aT(e,c.path,c.type==="directory")),s=vt().searchQuery.toLowerCase(),l=s?i.filter((c)=>c.type==="directory"||c.name.toLowerCase().includes(s)):i;for(let[c,d]of l.entries()){let v=d.type==="directory"&&vt().expanded.has(d.path);if(n.push({depth:t,expanded:v,key:d.path,loading:!1,name:d.name,path:d.path,locale:nh(d.path,o)??void 0,posInSet:c+1,setSize:l.length,type:d.type}),v)ke(d.path,t+1,n,o)}}function Ee(e){return e===void 0?-1:u.findIndex((t)=>!t.loading&&t.path===e)}function q(e,t){for(let n=e+t;n>=0&&n<u.length;n+=t)if(!u[n].loading)return n;return-1}function lt(e){let t=u[e];if(!t)return-1;for(let n=e-1;n>=0;n--){let o=u[n];if(!o.loading&&o.depth<t.depth)return n}return-1}function ct(){if(A?.isConnected!==!0||O!=="")return;queueMicrotask(f)}function ie(){let e=A;if(e===null)return;B=bb(B,e,{count:()=>u.length,onChange:ct,rowHeight:ue})}function dt(e){let t=String(e.depth+1);if(e.loading)return{ariaExpanded:"",depth:String(e.depth),icon:"",key:e.key,kind:"loading",level:t,locale:"",localeState:"hidden",name:e.name,path:e.path,posInSet:"",setSize:"",type:e.type};return{ariaExpanded:e.type==="directory"?String(e.expanded):"",depth:String(e.depth),icon:at(e.path,e.type,e.expanded),key:e.key,kind:"item",level:t,locale:e.locale===void 0?"":hn(e.locale),localeState:e.locale===void 0?"hidden":"shown",name:e.name,path:e.path,posInSet:String(e.posInSet),setSize:String(e.setSize),type:e.type}}function pt(){if(st(),!D){u=[];let s={...J(),view:"none"};return P=s,s}if(!D.isSiteProject&&D.projectRoot==="."){u=[];let s={...J(),view:"welcome"};return P=s,s}let e=vt();u=[];let{i18n:t}=Or(e.projectConfig??{});ke(".",0,u,t);let n=mb(A,{count:u.length,rowHeight:ue()}),o=u.slice(n.start,n.end),r=(e.selectedPath!==null&&X(e.selectedPath)?e.selectedPath:"")||o.find((s)=>!s.loading)?.path||"",a=pe(),i={currentPath:r,dragPath:O,dropPath:W,headerState:e.isSiteProject?"shown":"hidden",ignoredIcon:a?"eye":"eye-slash",ignoredLabel:a?"Hide ignored files":"Show ignored files",ignoredSelected:a,padBottom:n.padBottom,padTop:n.padTop,projectName:e.projectConfig?.name||e.name,query:e.searchQuery,rootDrop:Z,rows:o.map((s)=>dt(s)),selectedPath:e.selectedPath??"",view:"tree"};return P=i,i}function se(){if(!w||!P)return;P={...P,dragPath:O,dropPath:W,rootDrop:Z},w.handle.update(P)}function f(){Se?.()}async function ut(){let e=vt();e.dirs.clear(),Uu(),await $r(".");for(let t of e.expanded)await $r(t);f()}function ft(e){let t=X(e);if(!t)return;if(t.type==="directory"){Ce(e).then(()=>f());return}Ir(e)}function ht(e,t){let n=vt();if(X(e)?.type!=="directory"||n.expanded.has(e)===t)return;if(!t){n.expanded.delete(e),f();return}Ce(e).then(()=>f())}function Te(e){if(!D||vt().selectedPath===e)return;vt().selectedPath=e,f()}function mt(e,t){let n=Ee(e),o;switch(t){case"Home":{o=q(-1,1);break}case"End":{o=q(u.length,-1);break}case"ArrowUp":{o=q(n,-1);break}case"ArrowLeft":{o=lt(n);break}case"ArrowDown":case"ArrowRight":{o=q(n,1);break}default:return}De(o)}function gt(e,t){let n=Ee(e),o=u.length;for(let r=1;r<=o;r++){let a=(n+r+o)%o,i=u[a];if(i&&!i.loading&&i.name.trim().toLowerCase().startsWith(t)){De(a);return}}}function De(e){let t=u[e];if(!t)return;if(Te(t.path),Re(t.path))return;gb(A,e,ue()),f()}async function Ce(e){let t=vt();if(t.expanded.has(e)){t.expanded.delete(e);return}if(t.expanded.add(e),!t.dirs.has(e))await $r(e)}var z=new Map,G=null,O="",K="",W="",Y=!1,Z="";function wt(e){return[...e.dataTransfer?.types??[]].includes("Files")}function Ne(e,t,n){let o=(i)=>{if(!wt(i))return;if(i.preventDefault(),i.stopPropagation(),i.dataTransfer)i.dataTransfer.dropEffect="copy";n(!0)},r=()=>n(!1),a=(i)=>{n(!1);let s=i.dataTransfer?.files;if(!s?.length)return;i.preventDefault(),i.stopPropagation(),Le(s,t,f)};return e.addEventListener("dragover",o),e.addEventListener("dragleave",r),e.addEventListener("drop",a),()=>{e.removeEventListener("dragover",o),e.removeEventListener("dragleave",r),e.removeEventListener("drop",a)}}function le(e,t){let n=e.replaceAll("\\","/"),o=t.replaceAll("\\","/");if(!n||n===o)return!1;if(n.startsWith(`${o}/`)||o.startsWith(`${n}/`))return!1;return Q(n)!==o}function ae(e,t,n){return n==="directory"&&typeof e==="string"&&le(e,t)}function N(e,t){let n=t?e:"";if(K===e&&W===n)return;K=e,W=n,Ie()}function U(e){if(Y===e)return;Y=e,Ie()}function Ie(){Z=Y&&K===""?"true":"",se()}async function Le(e,t,n){if((await tl([...e],{dir:t})).length===0)return;if(t!==".")vt().expanded.add(t);n()}function yt(e,t){let n=document.createElement("input");n.type="file",n.multiple=!0,n.accept=Oc(),n.addEventListener("change",()=>{if(n.files?.length)Le(n.files,e,t)}),n.click()}function bt(e,t,n){Oe(e),L.set(t,e);let o=[_s({element:e,getInitialData(){return{entryType:n,path:t,type:"file-tree"}},onDragStart(){O=t,se()},onDrop(){O="",N("",!1),se()}}),Ne(e,n==="directory"?t:Q(t),(r)=>{N(r?t:"",r)}),Ks({canDrop({source:r}){return r.data.type==="file-tree"},element:e,getData({source:r}){return ae(r.data.path,t,n)?{targetDir:t,type:"file-tree-target"}:{type:"file-tree-refused"}},onDrag({source:r}){N(t,ae(r.data.path,t,n))},onDragEnter({source:r}){N(t,ae(r.data.path,t,n))},onDragLeave(){N("",!1)},onDrop(){N("",!1)}})];z.set(e,xo(...o))}function Oe(e){let t=z.get(e);if(t)t(),z.delete(e)}function xt(e){if(G?.element===e)return;Ae(),A=e;let t=Ks({canDrop({source:o}){return o.data.type==="file-tree"&&le(o.data.path,".")},element:e,getData(){return{targetDir:".",type:"file-tree-target"}},onDragEnter(){U(!0)},onDragLeave(){U(!1)},onDrop(){U(!1)}}),n=Js({onDrop({source:o,location:r}){let[a]=r.current.dropTargets;if(!a)return;if(o.data.type!=="file-tree")return;if(a.data.type!=="file-tree-target")return;let i=o.data.path,s=a.data.targetDir;if(!le(i,s))return;let l=i.split("/").pop(),c=s==="."?l:`${s}/${l}`;Ft(i,c,f)}});G={cleanup:xo(t,n,Ne(e,".",U)),element:e},ie()}function Ae(){G?.cleanup(),G=null;for(let e of z.values())e();z.clear(),B?.window.destroy(),B=null,A=null,O="",K="",W="",Y=!1,Z=""}async function Ft(e,t,n){let o=p();Vs(e,t);try{let r=await o.renameFile(e,t);xa();for(let[s]of m.tabs.entries())if(s===e)Wy(e,t,t);else if(s.startsWith(`${e}/`)){let l=t+s.slice(e.length);Wy(s,l,l)}let a=Q(e),i=Q(t);if(await $r(a),i!==a)await $r(i);if(i!==".")vt().expanded.add(i);ze(r,t),n(),EE(`Moved to ${t}`,r,t)}catch(r){C.error(`Could not move ${e}.`,{detail:te(r),path:e,source:"Files"})}}function Q(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return n===-1?".":t.slice(0,n)}var H=null;function Me(){H?.close(),H=null}function jt(e){let t={};if(e.type==="directory"){let n=Op(e.path);if(n?.isSourceRoot===!0&&!n.fileBacked)t.name=n.name;return t}if(t.file=e.path,ga(e.path))t.path=e.path;if(Lw(e.path).length>0)t.source=e.path;return t}function S(e,t,n,o={}){return{destructive:!1,disabled:!1,dividerAbove:!1,id:e,run:n,title:t,...o}}function $t(e){let t=ne();if(!t)return[];let n=jt(e),o=[];for(let r of t.forPlacement("context/file")){let a=r.args;if(!(a?.required??[]).every((l)=>(l in n)))continue;let i={};for(let l of Object.keys(a?.properties??{}))if(l in n)i[l]=n[l];let s=t.disabledReason(r.id);o.push(s===void 0?S(r.id,r.title,()=>{sn(t,r.id,i,"Files")}):{destructive:!1,disabled:!0,dividerAbove:!1,id:r.id,requires:s,title:r.title})}return o}function Rt(e){let t=e.type==="directory",n=[];if(t){if(n.push(S("files.newFile","New File…",()=>{He(e.path,f)}),S("files.upload","Upload Files…",()=>{yt(e.path,f)})),e.path==="pages"||e.path.endsWith("/pages"))n.push(S("files.pagesGrid","Edit Pages in Grid",()=>{VS()}))}else n.push(S("files.open","Open",()=>{Ir(e.path)}));return n.push(...$t(e),S("files.rename","Rename…",()=>{It(e,f)},{dividerAbove:!0}),S("files.delete","Delete",()=>{Lt(e,f)},{destructive:!0})),n}function kt(e,t,n){let o=X(e);if(!o)return;Me();let r=Re(e);H=Pt({label:"File actions",onClosed:(a)=>{if(H===a)H=null},opener:r,origin:{x:t,y:n},region:"files",rows:Rt({name:o.name,path:o.path,type:o.type})})}var Et=JSON.stringify({children:[{children:[],tagName:"p"}],tagName:"div"},null,2),R="__other__";function $e(e){return e.trim().toLowerCase().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d-]/g,"")}function ce(e){let t=e.lastIndexOf(".");return t>0?e.slice(t):""}function Tt(e){return[...(e.kind==="locked"?[{ext:e.ext,label:`${Ys(e.ext)?.name??e.ext} (${e.ext})`}]:ge(e.docKind)).map((n)=>({label:n.label,value:n.ext})),{dividerBefore:!0,label:"Other…",value:R}]}function Dt(e,t,n){let o=e.kind==="choose"?e.defaultExt:e.ext;if(o!==void 0&&t.some((a)=>a.value===o))return o;let r=ce(n);if(r!==""&&t.some((a)=>a.value===r))return r;return t[0]?.value??R}async function Iw(e){let{dir:t,format:n,source:o="Files"}=e;await Kt();let r=new Set;try{let g=await p().listDirectory(t);r=new Set(g.map((h)=>h.name.toLowerCase()))}catch{}let a=n!==void 0&&n.kind!=="fixed"?n:null,i=a===null?null:Tt(a),s=a===null||i===null?"":Dt(a,i,e.suggestedName??""),l=(g,h)=>{let b=g.trim();if(n===void 0||h===R)return b;if(n.kind==="fixed"){let x=$e(b);return x===""?"":`${x}${n.ext}`}return b.toLowerCase().endsWith(h.toLowerCase())?b:`${b}${h}`},c=we(),d=(g,h)=>{let b=g.trim();if(!b)return n?.kind==="fixed"?"Enter a name.":"Enter a file name.";if(n?.kind==="fixed"&&$e(b)==="")return"Enter at least one letter or number.";let x=b.replaceAll("\\","/");if(x.startsWith("/")||x.endsWith("/"))return"Enter a name, not a path that starts or ends with a slash.";if(x.split("/").includes(".."))return"A name cannot step outside the destination folder.";if(x.includes("/")&&n!==void 0&&h!==R)return`Pick Other… to create a file in a subfolder of ${t==="."?"the project root":t}.`;let j=ce(x);if(h!==""&&h!==R&&j!==""&&j.toLowerCase()!==h.toLowerCase()&&c.has(j.toLowerCase()))return`You picked ${i?.find((Ue)=>Ue.value===h)?.label??h}; this name ends in ${j}.`;if(n?.kind==="locked"&&h===R){if(j!==""&&j.toLowerCase()!==n.ext.toLowerCase()&&c.has(j.toLowerCase()))return n.because}let he=l(g,h);return r.has(he.toLowerCase())?`${he} already exists in ${t}/.`:""},F=s,v=await Pn(e.title??"New File",{...i===null?{}:{choice:{initial:s,label:"Format",onChange:(g)=>{F=g},options:()=>i}},confirmLabel:"Create",message:t==="."?"Creating in the project root.":`Creating in ${t}/`,...e.suggestedName===void 0?{}:{placeholder:e.suggestedName},select:i===null?"stem":"all",validate:d,value:e.suggestedName??"untitled.json"});if(!v)return null;let k=l(v,F),E=t==="."?k:`${t}/${k}`;Vs(E);let fe=Qt(k),We=typeof e.content==="function"?await e.content(ce(k),k):e.content,_e=n!==void 0&&F!==R,Je=We??fe?.studio?.newFileTemplate??(fe?"":k.toLowerCase().endsWith(".json")?_e?Et:`{}
|
|
2
|
-
`:"");try{return await p().writeFile(E,Je),await $r(t),C.success(`Created ${E}`),E}catch(g){return C.error(`Could not create ${E}.`,{detail:te(g),path:E,source:o}),null}}async function He(e,t){await Kt();let n=Op(e);if(n?.unresolvedFormat!=null)C.error(`New files in ${e}/ cannot be constrained to the collection's format.`,{detail:`The "${n.name}" content type declares format "${n.unresolvedFormat}", which no installed extension provides. Install the extension that supplies it, or correct `+"the name in Project Settings › Content Types.",path:e,source:"Files"});let o=n?.ext!=null&&n.unresolvedFormat===null,r=o&&n.isSourceRoot&&n.def.schema!==void 0,a;if(r){let{createEntry:i}=await (me("t0k1q0kx"),import("./entry-commands-t0k1q0kx.js"));a=await i(n.name,{dir:e})}else a=await Iw({dir:e,format:o&&n.ext!==null?{because:`${n.name} entries are ${n.ext} files, so a document of another format here would not be one.`,ext:n.ext,kind:"locked"}:{defaultExt:".json",kind:"choose"},suggestedName:"untitled"});if(a!==null)t()}async function Ct(e,t){let n=await um(t);return Pn("Rename",{confirmLabel:"Rename",...n===void 0?{}:{message:n},select:"stem",validate:(o)=>o.trim()?"":"Enter a file name.",value:e})}function Nt(e,t){let n=t.references,o=t.tag?`; tag → <${t.tag.to}> (${t.tag.refsUpdated})`:"";if(n&&n.refsUpdated>0)return`Renamed to ${e}; updated ${n.refsUpdated} reference(s) in ${n.filesChanged} file(s)${o}`;if(o)return`Renamed to ${e}${o}`;return`Renamed to ${e}`}function EE(e,t,n){let o=t.errors??[];if(o.length===0){C.success(e);return}let r=o.length===1?"1 file":`${o.length} files`;C.warn(`${e} — references in ${r} could not be updated`,{detail:o.map((a)=>`${a.path}: ${a.error}`).join(`
|
|
3
|
-
`),path:n,source:"Files"})}function ze(e,t){for(let n of e.references?.files??[])if(n.path!==t&&m.tabs.has(n.path))fp(n.path)}function de(e){let t=e.replaceAll("\\","/");return t.includes("/")?t.slice(0,t.lastIndexOf("/")):"."}async function yI(e,t,n){xa();let o=de(e),r=de(t);if(await $r(o),r!==o)await $r(r);if(vt().selectedPath===e)vt().selectedPath=t;ze(n,t)}async function It(e,t){let n=await Ct(e.name,e.path);if(!n||n===e.name)return;let o=de(e.path),r=o==="."?n:`${o}/${n}`;Vs(e.path,r);try{let i=await p().renameFile(e.path,r);if(m.tabs.has(e.path))Wy(e.path,r,r);await yI(e.path,r,i),t(),EE(Nt(n,i),i,r)}catch(a){C.error(`Could not rename ${e.name}.`,{detail:te(a),path:e.path,source:"Files"})}}async function Lt(e,t){if(!await dm(e))return;try{let o=p();Vs(e.path),await o.deleteFile(e.path),xa();let r=e.path.replaceAll("\\","/"),a=r.includes("/")?r.slice(0,r.lastIndexOf("/")):".";if(await $r(a),vt().selectedPath===e.path)vt().selectedPath=null;t(),C.success(`Deleted ${e.name}`)}catch(o){C.error(`Could not delete ${e.name}.`,{detail:te(o),path:e.path,source:"Files"})}}function Ot(e,t){let n=t.paneId,o=ah(e);if(n!==void 0&&o){if(o.activeTabId===e&&t.focus===!1)return;Fm(e,n)}ui(e,{focus:t.focus!==!1})}async function Ir(e,t={}){let n=t.focus!==!1;for(let[r,a]of m.tabs.entries())if(a.documentPath===e){if(Ot(r,t),n)vt().selectedPath=e;return}if(Pw(e)){if(IE(e,t),n)vt().selectedPath=e;Qf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot});return}if(e.toLowerCase().endsWith(".csv")){try{if(await YE(e,t),n)vt().selectedPath=e;Qf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot})}catch(r){C.error(`Could not open ${e}.`,{detail:te(r),path:e,source:"Open File"})}return}let o=p();try{let r=await o.readFile(e);if(!r){if(await Kt(),!Qt(e)&&!e.toLowerCase().endsWith(".json"))throw Up(e);return}await Kt();let a,i,s=null,l=Qt(e);if(l){let d=await Do(e,r);({document:a}=d),{frontmatter:i}=d}else if(e.endsWith(".json"))({document:a,layout:s}=ys(r));else throw Up(e);if(Mr({id:e,documentPath:e,document:a,...i!=null&&{frontmatter:i},layout:s,sourceFormat:l?.name??null,...t.paneId!==void 0&&{paneId:t.paneId},...t.preview===!0&&{preview:!0},...t.focus===!1&&{focus:!1}}),n)vt().selectedPath=e;Qf({name:e.split("/").pop()||e,path:e,root:vt().projectRoot})}catch(r){C.error(`Could not open ${e}.`,{detail:te(r),path:e,source:"Open File"})}}async function Dw(e,t){await Ir(t,{focus:!1,paneId:e,preview:!0})}function vS(e){if(Am(e))return;for(let[,t]of m.tabs.entries())if(t.documentPath===e&&!t.doc.dirty){fp(e);return}}function wS(e){for(let t of e)fp(t,{onlyIfChanged:!0})}async function fp(e,t={}){for(let[,n]of m.tabs.entries())if(n.documentPath===e){let o=p(),r=n.doc.dirty,a=()=>!r&&n.doc.dirty||Am(e);try{let i=await o.readFile(e);if(!i)return;if(await Kt(),a())return;if(Qt(e)){let{document:s,frontmatter:l}=await Do(e,i);if(a())return;if(t.onlyIfChanged&&fs(s,n.doc.document)&&fs(l,n.doc.content.frontmatter))return;n.doc.document=s,n.doc.content.frontmatter=l}else if(e.endsWith(".json")){let s=ys(i);if(n.doc.layout=s.layout,t.onlyIfChanged&&fs(s.document,n.doc.document))return;n.doc.document=s.document}n.doc.dirty=!1}catch(i){C.error(`Could not reload ${e} after it changed on disk.`,{detail:te(i),key:`reload:${e}`,path:e,source:"Files"})}return}}function xS(){Kn({id:"files",title:"Files",level:"project",dock:"navigator",icon:"folder",render:()=>tt,afterRender:(e,t)=>{Mt(t,e.rerender)}})}var At={activate:ft,contextMenu:kt,expand:ht,move:mt,newFile:()=>{He(".",f)},openProject:()=>{sl("project.open",void 0,"Files")},refresh:()=>{ut()},rowHost:bt,search:(e)=>{vt().searchQuery=e,f()},select:Te,toggleIgnored:()=>{ot(!pe()),f()},treeHost:xt,typeahead:gt},w=null,P=null;function Mt(e,t){let n=e.querySelector(".panel-content")??e;if(Se=t,w&&(w.host!==n||!w.handle.connected()))Ht();let o=pt();if(w)w.handle.update(o);else{let r=je(n,o,At);w={handle:r,host:n},r.ready.then(ie)}queueMicrotask(ie)}function Ht(){Me(),w?.handle.dispose(),w=null,P=null,Ae(),L.clear(),u=[]}
|
|
4
|
-
export{Xf,Lw,_E,SE,pb,fb,Rw,CE,kE,Qf,$r,fS,mS,gS,$w,em,bS,yS,Iw,EE,yI,Ir,Dw,vS,wS,fp,xS};
|
|
5
|
-
|
|
6
|
-
//# debugId=145979F2FAC6871F64756E2164756E21
|
|
7
|
-
//# sourceMappingURL=studio-kk7h30ne.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{iv,rv}from"./studio-kggey1jt.js";import{$u,me}from"./studio-pre0skq6.js";var r={document:iv,project:rv},a={...r},c={document:null,project:null},u=!1;function i(n){return c[n]??=(async()=>{try{let{default:t}=await (me("va2wwra4"),import("./2020-va2wwra4.js").then((m)=>$u(m.default,1))),{default:e}=await (me("2veqmnhr"),import("./index-2veqmnhr.js").then((m)=>$u(m.default,1))),o=new t({allErrors:!0,strict:!1,allowUnionTypes:!0});return e(o),o.compile(a[n])}catch(t){if(!u)u=!0,console.error(`[jx] ${n} schema validation is unavailable — the AI assistant's schema gate is a `+"no-op for this session:",t);return null}})(),c[n]}function l(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).length>0?n:void 0}function DI(n){let t=l(n?.document)??r.document,e=l(n?.project)??r.project,o=t!==r.document||e!==r.project;if(t===a.document&&e===a.project)return o;return a.document=t,a.project=e,c.document=null,c.project=null,o}var m=["unevaluatedProperty","additionalProperty","missingProperty"];function s(n){return(n.errors||[]).map((t)=>{let e=m.find((d)=>typeof t.params?.[d]==="string"),o=e?` (${String(t.params?.[e])})`:"";return`${t.instancePath||"(root)"}: ${t.message}${o}`})}async function bp(n){let t=await i("document");if(!t||t(n))return[];return s(t)}async function NI(n){let t=await i("document");if(!t)return null;return t(n)?[]:s(t)}async function _d(n){let t=await i("project");if(!t||t(n))return[];return s(t)}
|
|
2
|
-
export{DI,bp,NI,_d};
|
|
3
|
-
|
|
4
|
-
//# debugId=6FF22FC849020E8164756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-kt1zqney.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var f=["order","widths","hidden","sort","groupBy","filter"];function c(){try{return globalThis.localStorage??null}catch{return null}}function d(t){let e=c()?.getItem("jx-grid-layout:"+t);if(!e)return null;try{let n=JSON.parse(e);return typeof n==="object"&&n!==null?n:null}catch{return null}}function a(t,e){c()?.setItem("jx-grid-layout:"+t,JSON.stringify(e))}function u(t){let e={};for(let n of f)if(t[n]!==void 0)Object.assign(e,{[n]:t[n]});return e}function v(t){return JSON.stringify(f.map((e)=>t[e]??null))}function wc(t){let e=d(t);return e?u(e):null}function ap(t,e){if(!c())return;let i=d(t)??{},o={...i,widths:{...i.widths,...e.widths}};for(let r of f)if(r!=="widths"&&e[r]!==void 0)Object.assign(o,{[r]:e[r]});a(t,o)}function Z0(t){let e=d(t);if(!e)return;a(t,{active:null,...e.views?{views:e.views}:{}})}function lp(t){let e=d(t)?.views;return Array.isArray(e)?e.filter((n)=>typeof n?.name==="string"):[]}function fw(t){return d(t)?.active??null}function tE(t){let e=d(t),n=e?.active;if(!e||!n)return!1;let i=lp(t).find((o)=>o.name===n);return i?v(u(i))!==v(u(e)):!1}function nE(t,e){let n=e.trim(),i=c();if(n===""||!i)return null;let o=d(t)??{},r={name:n,...u(o)},s=lp(t).filter((l)=>l.name!==n);return s.push(r),a(t,{...o,active:n,views:s}),r}function X0(t,e){let n=lp(t).find((r)=>r.name===e);if(!n||!c())return null;let i=d(t)??{},o=u(n);return a(t,{active:n.name,views:i.views??[],...o}),o}function Q0(t,e){let n=d(t);if(!n||!c())return!1;let i=lp(t),o=i.filter((r)=>r.name!==e);if(o.length===i.length)return!1;return a(t,{...n,active:n.active===e?null:n.active??null,views:o}),!0}function iE(t,e){if(!e)return t;let n=new Set(e.hidden),i=[];for(let r of t){if(r.field!==void 0&&n.has(r.field))continue;let s=r.field?e.widths?.[r.field]:void 0;i.push(s?{...r,width:s}:r)}if(!e.order?.length)return i;let o=new Map(e.order.map((r,s)=>[r,s]));return i.map((r,s)=>({def:r,index:s})).toSorted((r,s)=>{let l=o.get(r.def.field??"")??e.order.length+r.index,w=o.get(s.def.field??"")??e.order.length+s.index;return l-w}).map(({def:r})=>r)}
|
|
2
|
-
export{wc,ap,Z0,lp,fw,tE,nE,X0,Q0,iE};
|
|
3
|
-
|
|
4
|
-
//# debugId=5B66F6400744CFA264756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-m3cwhvye.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
function p(t){return JSON.parse(JSON.stringify(t))}function Oe(t){return t===void 0||t===null?t:p(t)}function Kd(t,e){let n=t;for(let r of e){if(n==null)return;n=n[r]}return n}function Bc(t){if(Array.isArray(t))throw TypeError("Cannot insert into a children array; parentPath must point at a node");if(!t.children)t.children=[];if(!Array.isArray(t.children))throw TypeError("Cannot insert into mapped-array children; edit the map template instead");return t.children}function Vm(t,e){switch(e.op){case"set-key":{let n=Kd(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=n;if(e.value===void 0)delete r[e.key];else r[e.key]=Oe(e.value);return}case"insert-child":{let n=Kd(t,e.parentPath);Bc(n).splice(e.index,0,Oe(e.node));return}case"remove-child":{let n=Kd(t,e.parentPath);Bc(n).splice(e.index,1);return}case"set-child":{let n=Kd(t,e.parentPath);Bc(n).splice(e.index,1,Oe(e.node));return}case"move-child":{x(e);let n=Kd(t,e.fromParentPath),r=Kd(t,e.toParentPath),o=Bc(n),a=Bc(r),[s]=o.splice(e.fromIndex,1);a.splice(e.toIndex,0,s);return}default:break}throw Error(`unknown-doc-op:${e.op}`)}function d(t,e,n,r,o){let a=t.length;if(!(a<e.length&&t.every((m,J)=>m===e[J]))||e[a]!=="children"||typeof e[a+1]!=="number")return e;let i=e[a+1];if(o?i<n:i<=n)return e;let c=[...e];return c[a+1]=i+r,c}function x(t){let e=[...t.fromParentPath,"children",t.fromIndex],n=t.toParentPath;if(n.length>=e.length&&e.every((r,o)=>r===n[o]))throw Error(`doc-op-move-into-self:${n.join("/")}`)}function h(t,e){return t<0?Math.max(e+t,0):Math.min(t,e)}function k1(t,e){switch(e.op){case"set-key":{let n=Kd(t,e.path);if(!n)throw Error(`doc-op-node-not-found:${e.path.join("/")}`);let r=Oe(n[e.key]);return r===void 0?{key:e.key,op:"set-key",path:e.path}:{key:e.key,op:"set-key",path:e.path,value:r}}case"insert-child":{let{length:n}=l(t,e.parentPath);return{index:h(e.index,n),op:"remove-child",parentPath:e.parentPath}}case"remove-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"insert-child",parentPath:e.parentPath}}case"set-child":{let n=u(t,e.parentPath,e.index);return{index:e.index,node:n,op:"set-child",parentPath:e.parentPath}}case"move-child":{x(e);let n=f(t,e.fromParentPath);P(n,e.fromParentPath,e.fromIndex);let r=l(t,e.toParentPath),o=h(e.toIndex,r.length-(r===n?1:0));return{fromIndex:o,fromParentPath:d(e.fromParentPath,e.toParentPath,e.fromIndex,-1,!1),op:"move-child",toIndex:e.fromIndex,toParentPath:d(e.toParentPath,e.fromParentPath,o,1,!0)}}default:break}throw Error(`unknown-doc-op:${e.op}`)}function f(t,e){let n=Kd(t,e);return n&&Array.isArray(n.children)?n.children:null}function P(t,e,n){if(!t||n<0||n>=t.length)throw Error(`doc-op-node-not-found:${[...e,"children",n].join("/")}`)}function u(t,e,n){let r=f(t,e);return P(r,e,n),Oe(r[n])}function l(t,e){let n=Kd(t,e);if(!n||typeof n!=="object"||Array.isArray(n))throw Error(`doc-op-node-not-found:${e.join("/")}`);if(n.children===void 0)return[];if(!Array.isArray(n.children))throw TypeError(`doc-op-mapped-children:${e.join("/")}`);return n.children}
|
|
2
|
-
export{Oe,Kd,Bc,Vm,k1};
|
|
3
|
-
|
|
4
|
-
//# debugId=8028F619D324C0B964756E2164756E21
|
|
5
|
-
//# sourceMappingURL=studio-mcayt6hz.js.map
|