superdoc 2.2.1 β 2.3.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/AGENTS.md +337 -0
- package/LICENSE +661 -0
- package/NOTICE +8 -0
- package/README.md +107 -0
- package/dist/chunks/FindReplaceSurface-BEW-1NhM.es.js +344 -0
- package/dist/chunks/FindReplaceSurface-DLxnCQOB.cjs +346 -0
- package/dist/chunks/PasswordPromptSurface-BA6HHqEa.es.js +111 -0
- package/dist/chunks/PasswordPromptSurface-DMbfDvpQ.cjs +113 -0
- package/dist/chunks/PdfViewer-CNOtyS-I.es.js +531 -0
- package/dist/chunks/PdfViewer-CoFiGAhm.cjs +535 -0
- package/dist/chunks/_plugin-vue_export-helper-BTwbGDKw.cjs +11 -0
- package/dist/chunks/_plugin-vue_export-helper-CInC0bKI.es.js +6 -0
- package/dist/chunks/blank-docx-CJAXnJKp.es.js +2 -0
- package/dist/chunks/blank-docx-DA-G-3VB.cjs +7 -0
- package/dist/chunks/constants-CY3R3_kF.es.js +3 -0
- package/dist/chunks/constants-sbCZ2O_A.cjs +14 -0
- package/dist/chunks/create-super-doc-ui-CXCqHc2m.cjs +9451 -0
- package/dist/chunks/create-super-doc-ui-fxF2Q8Ib.es.js +9188 -0
- package/dist/chunks/eventemitter3-B60Fsz-a.es.js +131 -0
- package/dist/chunks/eventemitter3-DCfwFVNn.cjs +137 -0
- package/dist/chunks/jszip-BdUBlUeG.cjs +4679 -0
- package/dist/chunks/jszip-DzmwAHr3.es.js +4650 -0
- package/dist/chunks/rolldown-runtime-BJVcqBbz.es.js +43 -0
- package/dist/chunks/rolldown-runtime-_dR15c8t.cjs +68 -0
- package/dist/chunks/uuid-B2Sqk-3p.es.js +32 -0
- package/dist/chunks/uuid-CFp0WGVU.cjs +38 -0
- package/dist/collaboration-upgrade-engine.cjs +37 -0
- package/dist/collaboration-upgrade-engine.es.js +30 -0
- package/dist/document-api/src/authorities/authorities.d.ts +29 -0
- package/dist/document-api/src/authorities/authorities.types.d.ts +113 -0
- package/dist/document-api/src/blocks/blocks.d.ts +29 -0
- package/dist/document-api/src/bookmarks/bookmarks.d.ts +15 -0
- package/dist/document-api/src/bookmarks/bookmarks.types.d.ts +82 -0
- package/dist/document-api/src/capabilities/capabilities.d.ts +82 -0
- package/dist/document-api/src/captions/captions.d.ts +17 -0
- package/dist/document-api/src/captions/captions.types.d.ts +61 -0
- package/dist/document-api/src/citations/citations.d.ts +39 -0
- package/dist/document-api/src/citations/citations.types.d.ts +151 -0
- package/dist/document-api/src/clear-content/clear-content.d.ts +25 -0
- package/dist/document-api/src/clipboard/clipboard.d.ts +11 -0
- package/dist/document-api/src/comments/comments.d.ts +222 -0
- package/dist/document-api/src/comments/comments.types.d.ts +227 -0
- package/dist/document-api/src/content-controls/content-controls.d.ts +136 -0
- package/dist/document-api/src/content-controls/content-controls.types.d.ts +453 -0
- package/dist/document-api/src/contract/command-catalog.d.ts +17 -0
- package/dist/document-api/src/contract/index.d.ts +9 -0
- package/dist/document-api/src/contract/metadata-types.d.ts +30 -0
- package/dist/document-api/src/contract/operation-definitions.d.ts +3645 -0
- package/dist/document-api/src/contract/operation-map.d.ts +5 -0
- package/dist/document-api/src/contract/operation-registry.d.ts +2002 -0
- package/dist/document-api/src/contract/reference-aliases.d.ts +19 -0
- package/dist/document-api/src/contract/reference-doc-map.d.ts +12 -0
- package/dist/document-api/src/contract/schemas.d.ts +35 -0
- package/dist/document-api/src/contract/step-op-catalog.d.ts +26 -0
- package/dist/document-api/src/contract/types.d.ts +31 -0
- package/dist/document-api/src/create/create.d.ts +27 -0
- package/dist/document-api/src/cross-refs/cross-refs.d.ts +15 -0
- package/dist/document-api/src/cross-refs/cross-refs.types.d.ts +68 -0
- package/dist/document-api/src/customXml/customXml.d.ts +19 -0
- package/dist/document-api/src/customXml/customXml.types.d.ts +148 -0
- package/dist/document-api/src/delete/delete.d.ts +20 -0
- package/dist/document-api/src/diff/diff.d.ts +14 -0
- package/dist/document-api/src/diff/diff.types.d.ts +83 -0
- package/dist/document-api/src/diff/index.d.ts +3 -0
- package/dist/document-api/src/errors.d.ts +11 -0
- package/dist/document-api/src/export/export.d.ts +10 -0
- package/dist/document-api/src/export/export.types.d.ts +40 -0
- package/dist/document-api/src/extract/extract.d.ts +15 -0
- package/dist/document-api/src/fields/fields.d.ts +15 -0
- package/dist/document-api/src/fields/fields.types.d.ts +90 -0
- package/dist/document-api/src/find/find.d.ts +52 -0
- package/dist/document-api/src/footnotes/footnotes.d.ts +17 -0
- package/dist/document-api/src/footnotes/footnotes.types.d.ts +104 -0
- package/dist/document-api/src/format/format.d.ts +92 -0
- package/dist/document-api/src/format/inline-run-patch.d.ts +138 -0
- package/dist/document-api/src/get/get.d.ts +19 -0
- package/dist/document-api/src/get-html/get-html.d.ts +27 -0
- package/dist/document-api/src/get-markdown/get-markdown.d.ts +22 -0
- package/dist/document-api/src/get-node/get-node.d.ts +46 -0
- package/dist/document-api/src/get-text/get-text.d.ts +22 -0
- package/dist/document-api/src/header-footers/header-footers.d.ts +37 -0
- package/dist/document-api/src/header-footers/header-footers.types.d.ts +116 -0
- package/dist/document-api/src/history/history.d.ts +38 -0
- package/dist/document-api/src/history/history.types.d.ts +100 -0
- package/dist/document-api/src/hyperlinks/hyperlinks.d.ts +17 -0
- package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +112 -0
- package/dist/document-api/src/images/images.d.ts +63 -0
- package/dist/document-api/src/images/images.types.d.ts +209 -0
- package/dist/document-api/src/images/z-order.d.ts +10 -0
- package/dist/document-api/src/index/index.d.ts +29 -0
- package/dist/document-api/src/index/index.types.d.ts +125 -0
- package/dist/document-api/src/index.d.ts +560 -0
- package/dist/document-api/src/info/info.d.ts +19 -0
- package/dist/document-api/src/inline-semantics/directives.d.ts +95 -0
- package/dist/document-api/src/inline-semantics/error-types.d.ts +68 -0
- package/dist/document-api/src/inline-semantics/index.d.ts +20 -0
- package/dist/document-api/src/inline-semantics/property-ids.d.ts +24 -0
- package/dist/document-api/src/inline-semantics/token-parsers.d.ts +59 -0
- package/dist/document-api/src/inline-semantics/token-sets.d.ts +34 -0
- package/dist/document-api/src/insert/insert.d.ts +65 -0
- package/dist/document-api/src/invoke/invoke.d.ts +17 -0
- package/dist/document-api/src/lists/lists.d.ts +100 -0
- package/dist/document-api/src/lists/lists.types.d.ts +499 -0
- package/dist/document-api/src/markdown-to-fragment/markdown-to-fragment.d.ts +15 -0
- package/dist/document-api/src/metadata/anchored-metadata.d.ts +33 -0
- package/dist/document-api/src/metadata/anchored-metadata.types.d.ts +175 -0
- package/dist/document-api/src/paragraphs/paragraphs.d.ts +84 -0
- package/dist/document-api/src/paragraphs/paragraphs.types.d.ts +214 -0
- package/dist/document-api/src/permission-ranges/permission-ranges.d.ts +15 -0
- package/dist/document-api/src/permission-ranges/permission-ranges.types.d.ts +49 -0
- package/dist/document-api/src/plan/plan.d.ts +73 -0
- package/dist/document-api/src/protection/protection.d.ts +11 -0
- package/dist/document-api/src/protection/protection.types.d.ts +47 -0
- package/dist/document-api/src/ranges/index.d.ts +2 -0
- package/dist/document-api/src/ranges/ranges.types.d.ts +121 -0
- package/dist/document-api/src/ranges/resolve.d.ts +2 -0
- package/dist/document-api/src/receipt-bridge.d.ts +30 -0
- package/dist/document-api/src/replace/replace.d.ts +24 -0
- package/dist/document-api/src/sections/sections.d.ts +42 -0
- package/dist/document-api/src/sections/sections.types.d.ts +236 -0
- package/dist/document-api/src/selection/selection.d.ts +23 -0
- package/dist/document-api/src/selection/selection.types.d.ts +85 -0
- package/dist/document-api/src/selection-mutation.d.ts +46 -0
- package/dist/document-api/src/styles/apply.d.ts +142 -0
- package/dist/document-api/src/styles/catalog.d.ts +154 -0
- package/dist/document-api/src/styles/index.d.ts +14 -0
- package/dist/document-api/src/styles/registry.d.ts +43 -0
- package/dist/document-api/src/styles/schema.d.ts +9 -0
- package/dist/document-api/src/styles/validation.d.ts +38 -0
- package/dist/document-api/src/tables/color-formats.d.ts +12 -0
- package/dist/document-api/src/tables/tables.d.ts +83 -0
- package/dist/document-api/src/templates/apply.d.ts +160 -0
- package/dist/document-api/src/templates/index.d.ts +7 -0
- package/dist/document-api/src/toc/toc.d.ts +25 -0
- package/dist/document-api/src/toc/toc.types.d.ts +247 -0
- package/dist/document-api/src/track-changes/track-changes.d.ts +177 -0
- package/dist/document-api/src/types/adapter-result.d.ts +10 -0
- package/dist/document-api/src/types/address.d.ts +169 -0
- package/dist/document-api/src/types/base.d.ts +89 -0
- package/dist/document-api/src/types/blocks.types.d.ts +190 -0
- package/dist/document-api/src/types/clipboard.d.ts +216 -0
- package/dist/document-api/src/types/comments.types.d.ts +17 -0
- package/dist/document-api/src/types/create.types.d.ts +56 -0
- package/dist/document-api/src/types/discovery.d.ts +99 -0
- package/dist/document-api/src/types/extract.types.d.ts +163 -0
- package/dist/document-api/src/types/fragment.d.ts +29 -0
- package/dist/document-api/src/types/index.d.ts +30 -0
- package/dist/document-api/src/types/info.types.d.ts +109 -0
- package/dist/document-api/src/types/inline.types.d.ts +28 -0
- package/dist/document-api/src/types/media.types.d.ts +72 -0
- package/dist/document-api/src/types/mutation-plan.types.d.ts +264 -0
- package/dist/document-api/src/types/node.d.ts +9 -0
- package/dist/document-api/src/types/paragraph.types.d.ts +61 -0
- package/dist/document-api/src/types/placement.d.ts +24 -0
- package/dist/document-api/src/types/query-match.types.d.ts +212 -0
- package/dist/document-api/src/types/query.d.ts +133 -0
- package/dist/document-api/src/types/receipt.d.ts +191 -0
- package/dist/document-api/src/types/references.types.d.ts +9 -0
- package/dist/document-api/src/types/sd-contract.d.ts +54 -0
- package/dist/document-api/src/types/sd-envelope.d.ts +59 -0
- package/dist/document-api/src/types/sd-nodes.d.ts +375 -0
- package/dist/document-api/src/types/sd-objects.d.ts +144 -0
- package/dist/document-api/src/types/sd-props.d.ts +240 -0
- package/dist/document-api/src/types/sd-sections.d.ts +126 -0
- package/dist/document-api/src/types/sd-styles.d.ts +36 -0
- package/dist/document-api/src/types/step-manifest.types.d.ts +30 -0
- package/dist/document-api/src/types/story.types.d.ts +123 -0
- package/dist/document-api/src/types/structural-input.d.ts +40 -0
- package/dist/document-api/src/types/structured.types.d.ts +21 -0
- package/dist/document-api/src/types/style-policy.types.d.ts +49 -0
- package/dist/document-api/src/types/table-operations.types.d.ts +618 -0
- package/dist/document-api/src/types/tables.types.d.ts +43 -0
- package/dist/document-api/src/types/toc.types.d.ts +1 -0
- package/dist/document-api/src/types/track-changes.types.d.ts +703 -0
- package/dist/document-api/src/validation/create-location-validator.d.ts +2 -0
- package/dist/document-api/src/validation/fragment-validator.d.ts +13 -0
- package/dist/document-api/src/validation/selection-target-validator.d.ts +7 -0
- package/dist/document-api/src/validation/story-validator.d.ts +12 -0
- package/dist/document-api/src/validation-primitives.d.ts +29 -0
- package/dist/document-api/src/write/locator.d.ts +24 -0
- package/dist/document-api/src/write/write.d.ts +73 -0
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/checkmark.svg +5 -0
- package/dist/images/comment-actionsButton.svg +3 -0
- package/dist/images/comment-closeButton.svg +3 -0
- package/dist/images/comment-editButton.svg +8 -0
- package/dist/images/comment-popup-editButton.svg +5 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/editor-toolbar-edit.svg +3 -0
- package/dist/images/findbarButton-next.svg +3 -0
- package/dist/images/findbarButton-previous.svg +3 -0
- package/dist/images/gv-toolbarButton-download.svg +3 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/loading.svg +1 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_info.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/pages_closeButton.svg +3 -0
- package/dist/images/pages_selected.svg +7 -0
- package/dist/images/pages_viewArrow.svg +3 -0
- package/dist/images/pages_viewButton.svg +3 -0
- package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
- package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
- package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
- package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
- package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
- package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
- package/dist/images/toolbarButton-bookmark.svg +3 -0
- package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
- package/dist/images/toolbarButton-download.svg +4 -0
- package/dist/images/toolbarButton-editorFreeText.svg +5 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-editorInk.svg +4 -0
- package/dist/images/toolbarButton-editorSignature.svg +6 -0
- package/dist/images/toolbarButton-editorStamp.svg +8 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/images/toolbarButton-openFile.svg +3 -0
- package/dist/images/toolbarButton-pageDown.svg +3 -0
- package/dist/images/toolbarButton-pageUp.svg +3 -0
- package/dist/images/toolbarButton-presentationMode.svg +3 -0
- package/dist/images/toolbarButton-print.svg +3 -0
- package/dist/images/toolbarButton-search.svg +3 -0
- package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
- package/dist/images/toolbarButton-viewAttachments.svg +3 -0
- package/dist/images/toolbarButton-viewLayers.svg +3 -0
- package/dist/images/toolbarButton-viewOutline.svg +3 -0
- package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
- package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
- package/dist/images/toolbarButton-zoomIn.svg +3 -0
- package/dist/images/toolbarButton-zoomOut.svg +3 -0
- package/dist/images/treeitem-collapsed.svg +1 -0
- package/dist/images/treeitem-expanded.svg +1 -0
- package/dist/layout-engine/contracts/src/author-colors.d.ts +56 -0
- package/dist/layout-engine/contracts/src/cell-spacing.d.ts +12 -0
- package/dist/layout-engine/contracts/src/clip-path-inset.d.ts +27 -0
- package/dist/layout-engine/contracts/src/column-layout.d.ts +79 -0
- package/dist/layout-engine/contracts/src/direction-context.d.ts +219 -0
- package/dist/layout-engine/contracts/src/drawing-taxonomy.d.ts +126 -0
- package/dist/layout-engine/contracts/src/engines/image-wrap.d.ts +54 -0
- package/dist/layout-engine/contracts/src/engines/index.d.ts +17 -0
- package/dist/layout-engine/contracts/src/engines/lists.d.ts +57 -0
- package/dist/layout-engine/contracts/src/engines/paragraph.d.ts +59 -0
- package/dist/layout-engine/contracts/src/engines/tables.d.ts +89 -0
- package/dist/layout-engine/contracts/src/engines/tabs.d.ts +117 -0
- package/dist/layout-engine/contracts/src/graphic-placement.d.ts +76 -0
- package/dist/layout-engine/contracts/src/header-footer-inheritance.d.ts +22 -0
- package/dist/layout-engine/contracts/src/header-footer-resolution.d.ts +28 -0
- package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +10 -0
- package/dist/layout-engine/contracts/src/index.d.ts +2459 -0
- package/dist/layout-engine/contracts/src/justify-utils.d.ts +98 -0
- package/dist/layout-engine/contracts/src/layout-identity.d.ts +136 -0
- package/dist/layout-engine/contracts/src/ooxml-z-index.d.ts +46 -0
- package/dist/layout-engine/contracts/src/page-number-formatting.d.ts +26 -0
- package/dist/layout-engine/contracts/src/page-ref-anchor.d.ts +2 -0
- package/dist/layout-engine/contracts/src/pm-range.d.ts +45 -0
- package/dist/layout-engine/contracts/src/resolved-layout.d.ts +541 -0
- package/dist/layout-engine/contracts/src/run-helpers.d.ts +23 -0
- package/dist/layout-engine/contracts/src/sdt-container.d.ts +13 -0
- package/dist/layout-engine/contracts/src/segment-geometry.d.ts +192 -0
- package/dist/layout-engine/contracts/src/semantic-colors.d.ts +150 -0
- package/dist/layout-engine/contracts/src/table-cell-spacing.d.ts +12 -0
- package/dist/layout-engine/contracts/src/table-column-rescale.d.ts +13 -0
- package/dist/layout-engine/contracts/src/vertical-text.d.ts +43 -0
- package/dist/layout-engine/dom-contract/src/class-names.d.ts +62 -0
- package/dist/layout-engine/dom-contract/src/data-attrs.d.ts +103 -0
- package/dist/layout-engine/dom-contract/src/index.d.ts +18 -0
- package/dist/layout-engine/dom-contract/src/selectors.d.ts +47 -0
- package/dist/layout-engine/layout-bridge/src/cache-warmer.d.ts +73 -0
- package/dist/layout-engine/layout-bridge/src/cache.d.ts +143 -0
- package/dist/layout-engine/layout-bridge/src/cacheInvalidation.d.ts +117 -0
- package/dist/layout-engine/layout-bridge/src/cursor-renderer.d.ts +201 -0
- package/dist/layout-engine/layout-bridge/src/debounced-passes.d.ts +130 -0
- package/dist/layout-engine/layout-bridge/src/diff.d.ts +36 -0
- package/dist/layout-engine/layout-bridge/src/dirty-tracker.d.ts +128 -0
- package/dist/layout-engine/layout-bridge/src/dom-mapping.d.ts +80 -0
- package/dist/layout-engine/layout-bridge/src/featureFlags.d.ts +95 -0
- package/dist/layout-engine/layout-bridge/src/field-annotation-key.d.ts +2 -0
- package/dist/layout-engine/layout-bridge/src/focus-watchdog.d.ts +170 -0
- package/dist/layout-engine/layout-bridge/src/font-metrics-cache.d.ts +164 -0
- package/dist/layout-engine/layout-bridge/src/footnote-scorer.d.ts +63 -0
- package/dist/layout-engine/layout-bridge/src/headerFooterUtils.d.ts +218 -0
- package/dist/layout-engine/layout-bridge/src/ime-handler.d.ts +81 -0
- package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +390 -0
- package/dist/layout-engine/layout-bridge/src/index.d.ts +211 -0
- package/dist/layout-engine/layout-bridge/src/instrumentation.d.ts +245 -0
- package/dist/layout-engine/layout-bridge/src/layoutHeaderFooter.d.ts +123 -0
- package/dist/layout-engine/layout-bridge/src/list-indent-utils.d.ts +205 -0
- package/dist/layout-engine/layout-bridge/src/local-paragraph-layout.d.ts +93 -0
- package/dist/layout-engine/layout-bridge/src/neutral-hit.d.ts +142 -0
- package/dist/layout-engine/layout-bridge/src/neutral-segment-geometry.d.ts +32 -0
- package/dist/layout-engine/layout-bridge/src/page-geometry-helper.d.ts +197 -0
- package/dist/layout-engine/layout-bridge/src/paragraph-hash-utils.d.ts +126 -0
- package/dist/layout-engine/layout-bridge/src/paragraph-line-cache.d.ts +152 -0
- package/dist/layout-engine/layout-bridge/src/performance-metrics.d.ts +249 -0
- package/dist/layout-engine/layout-bridge/src/pm-dom-fallback.d.ts +188 -0
- package/dist/layout-engine/layout-bridge/src/pm-position-validator.d.ts +100 -0
- package/dist/layout-engine/layout-bridge/src/position-hit.d.ts +167 -0
- package/dist/layout-engine/layout-bridge/src/remeasure.d.ts +75 -0
- package/dist/layout-engine/layout-bridge/src/resolveHeaderFooterTokens.d.ts +76 -0
- package/dist/layout-engine/layout-bridge/src/rtl-text-geometry.d.ts +34 -0
- package/dist/layout-engine/layout-bridge/src/run-visual-marks.d.ts +12 -0
- package/dist/layout-engine/layout-bridge/src/safety-net.d.ts +234 -0
- package/dist/layout-engine/layout-bridge/src/sectionAwareHeaderFooter.d.ts +15 -0
- package/dist/layout-engine/layout-bridge/src/table-handler.d.ts +86 -0
- package/dist/layout-engine/layout-bridge/src/text-boundaries.d.ts +17 -0
- package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +69 -0
- package/dist/layout-engine/layout-bridge/src/track-changes-handler.d.ts +90 -0
- package/dist/layout-engine/layout-bridge/src/tracked-changes-utils.d.ts +41 -0
- package/dist/layout-engine/layout-engine/src/anchors.d.ts +52 -0
- package/dist/layout-engine/layout-engine/src/column-balancing.d.ts +255 -0
- package/dist/layout-engine/layout-engine/src/column-utils.d.ts +1 -0
- package/dist/layout-engine/layout-engine/src/floating-objects.d.ts +60 -0
- package/dist/layout-engine/layout-engine/src/floating-table-anchor.d.ts +21 -0
- package/dist/layout-engine/layout-engine/src/index.d.ts +349 -0
- package/dist/layout-engine/layout-engine/src/layout-drawing.d.ts +60 -0
- package/dist/layout-engine/layout-engine/src/layout-image.d.ts +16 -0
- package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +101 -0
- package/dist/layout-engine/layout-engine/src/layout-table.d.ts +71 -0
- package/dist/layout-engine/layout-engine/src/layout-textbox.d.ts +4 -0
- package/dist/layout-engine/layout-engine/src/layout-utils.d.ts +104 -0
- package/dist/layout-engine/layout-engine/src/normalize-header-footer-fragments.d.ts +45 -0
- package/dist/layout-engine/layout-engine/src/pageNumbering.d.ts +73 -0
- package/dist/layout-engine/layout-engine/src/paginator.d.ts +131 -0
- package/dist/layout-engine/layout-engine/src/paragraph-layout-eligibility.d.ts +1 -0
- package/dist/layout-engine/layout-engine/src/resolvePageRefs.d.ts +31 -0
- package/dist/layout-engine/layout-engine/src/resolvePageTokens.d.ts +82 -0
- package/dist/layout-engine/layout-engine/src/section-breaks.d.ts +98 -0
- package/dist/layout-engine/layout-engine/src/section-props.d.ts +65 -0
- package/dist/layout-engine/layout-engine/src/table-cell-slice.d.ts +98 -0
- package/dist/layout-engine/painters/dom/src/_test-utils.d.ts +21 -0
- package/dist/layout-engine/painters/dom/src/chart-renderer.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/constants.d.ts +10 -0
- package/dist/layout-engine/painters/dom/src/css-token.d.ts +10 -0
- package/dist/layout-engine/painters/dom/src/features/feature-registry.d.ts +41 -0
- package/dist/layout-engine/painters/dom/src/features/inline-direction/index.d.ts +22 -0
- package/dist/layout-engine/painters/dom/src/features/inline-direction/rtl-styles.d.ts +27 -0
- package/dist/layout-engine/painters/dom/src/features/inline-direction/run-direction.d.ts +75 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/accent.d.ts +25 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/bar.d.ts +16 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/box.d.ts +38 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/delimiter.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/equation-array.d.ts +19 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/fraction.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/function.d.ts +16 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/group-character.d.ts +26 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/index.d.ts +27 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/lower-limit.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/math-run.d.ts +47 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/matrix.d.ts +23 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/nary.d.ts +23 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/phantom.d.ts +17 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/pre-sub-superscript.d.ts +25 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/radical.d.ts +14 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/sub-superscript.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/subscript.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/superscript.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/converters/upper-limit.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/features/math/index.d.ts +14 -0
- package/dist/layout-engine/painters/dom/src/features/math/omml-to-mathml.d.ts +18 -0
- package/dist/layout-engine/painters/dom/src/features/math/types.d.ts +41 -0
- package/dist/layout-engine/painters/dom/src/images/drawing-image.d.ts +5 -0
- package/dist/layout-engine/painters/dom/src/images/hyperlink.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/images/image-block.d.ts +15 -0
- package/dist/layout-engine/painters/dom/src/images/image-clip-path.d.ts +17 -0
- package/dist/layout-engine/painters/dom/src/images/image-fragment.d.ts +34 -0
- package/dist/layout-engine/painters/dom/src/images/image-selectors.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/images/types.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/index.d.ts +125 -0
- package/dist/layout-engine/painters/dom/src/page-content.d.ts +209 -0
- package/dist/layout-engine/painters/dom/src/paragraph/block-version.d.ts +8 -0
- package/dist/layout-engine/painters/dom/src/paragraph/borders/border-layer.d.ts +59 -0
- package/dist/layout-engine/painters/dom/src/paragraph/borders/group-analysis.d.ts +38 -0
- package/dist/layout-engine/painters/dom/src/paragraph/borders/index.d.ts +18 -0
- package/dist/layout-engine/painters/dom/src/paragraph/frame.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/paragraph/indentation.d.ts +25 -0
- package/dist/layout-engine/painters/dom/src/paragraph/list-marker.d.ts +51 -0
- package/dist/layout-engine/painters/dom/src/paragraph/marker-tracked-change.d.ts +34 -0
- package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphContent.d.ts +87 -0
- package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphFragment.d.ts +33 -0
- package/dist/layout-engine/painters/dom/src/paragraph/styles.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/paragraph-hash-utils.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/pm-position-validation.d.ts +149 -0
- package/dist/layout-engine/painters/dom/src/renderer.d.ts +681 -0
- package/dist/layout-engine/painters/dom/src/ruler/index.d.ts +41 -0
- package/dist/layout-engine/painters/dom/src/ruler/ruler-core.d.ts +195 -0
- package/dist/layout-engine/painters/dom/src/ruler/ruler-renderer.d.ts +97 -0
- package/dist/layout-engine/painters/dom/src/ruler/ruler-styles.d.ts +31 -0
- package/dist/layout-engine/painters/dom/src/runs/field-annotation-run.d.ts +14 -0
- package/dist/layout-engine/painters/dom/src/runs/font-synthesis.d.ts +1 -0
- package/dist/layout-engine/painters/dom/src/runs/formatting-marks.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/runs/hash.d.ts +82 -0
- package/dist/layout-engine/painters/dom/src/runs/image-run.d.ts +37 -0
- package/dist/layout-engine/painters/dom/src/runs/index.d.ts +13 -0
- package/dist/layout-engine/painters/dom/src/runs/links.d.ts +58 -0
- package/dist/layout-engine/painters/dom/src/runs/math-run.d.ts +7 -0
- package/dist/layout-engine/painters/dom/src/runs/render-line.d.ts +2 -0
- package/dist/layout-engine/painters/dom/src/runs/render-run.d.ts +12 -0
- package/dist/layout-engine/painters/dom/src/runs/tab-run.d.ts +66 -0
- package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +35 -0
- package/dist/layout-engine/painters/dom/src/runs/tracked-changes.d.ts +90 -0
- package/dist/layout-engine/painters/dom/src/runs/types.d.ts +67 -0
- package/dist/layout-engine/painters/dom/src/sdt/boundaries.d.ts +16 -0
- package/dist/layout-engine/painters/dom/src/sdt/container.d.ts +32 -0
- package/dist/layout-engine/painters/dom/src/sdt/dataset.d.ts +7 -0
- package/dist/layout-engine/painters/dom/src/sdt/inline.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/sdt/snapshot.d.ts +29 -0
- package/dist/layout-engine/painters/dom/src/styles.d.ts +71 -0
- package/dist/layout-engine/painters/dom/src/svg-utils.d.ts +101 -0
- package/dist/layout-engine/painters/dom/src/table/border-utils.d.ts +185 -0
- package/dist/layout-engine/painters/dom/src/table/grid-geometry.d.ts +69 -0
- package/dist/layout-engine/painters/dom/src/table/renderTableCell.d.ts +170 -0
- package/dist/layout-engine/painters/dom/src/table/renderTableFragment.d.ts +132 -0
- package/dist/layout-engine/painters/dom/src/table/renderTableRow.d.ts +146 -0
- package/dist/layout-engine/painters/dom/src/test-utils/normalize-line.d.ts +39 -0
- package/dist/layout-engine/painters/dom/src/utils/anchor-helpers.d.ts +3 -0
- package/dist/layout-engine/painters/dom/src/utils/apply-styles.d.ts +1 -0
- package/dist/layout-engine/painters/dom/src/utils/layout-identity.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/utils/source-anchor.d.ts +2 -0
- package/dist/layout-engine/style-engine/src/bench/resolveSdtMetadata.bench.d.ts +1 -0
- package/dist/layout-engine/style-engine/src/cascade.d.ts +43 -0
- package/dist/layout-engine/style-engine/src/index.d.ts +121 -0
- package/dist/layout-engine/style-engine/src/normalize/colors.d.ts +13 -0
- package/dist/layout-engine/style-engine/src/normalize/index.d.ts +13 -0
- package/dist/layout-engine/style-engine/src/normalize/paragraph-attrs.d.ts +3 -0
- package/dist/layout-engine/style-engine/src/normalize/run-attrs.d.ts +17 -0
- package/dist/layout-engine/style-engine/src/normalize/types.d.ts +36 -0
- package/dist/layout-engine/style-engine/src/normalize/units.d.ts +13 -0
- package/dist/layout-engine/style-engine/src/ooxml/index.d.ts +64 -0
- package/dist/layout-engine/style-engine/src/ooxml/numbering-types.d.ts +126 -0
- package/dist/layout-engine/style-engine/src/ooxml/styles-types.d.ts +363 -0
- package/dist/layout-engine/style-engine/src/ooxml/table-style-selection.d.ts +86 -0
- package/dist/layout-engine/style-engine/src/ooxml/types.d.ts +459 -0
- package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-theme.d.ts +33 -0
- package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-xml.d.ts +29 -0
- package/dist/public/ui-react.cjs +175 -0
- package/dist/public/ui-react.es.js +159 -0
- package/dist/public/ui.cjs +5 -0
- package/dist/public/ui.es.js +2 -0
- package/dist/shared/common/comments-types.d.ts +102 -0
- package/dist/shared/common/layout-constants.d.ts +7 -0
- package/dist/shared/common/list-marker-utils.d.ts +186 -0
- package/dist/shared/common/list-numbering/index.d.ts +16 -0
- package/dist/shared/font-system/src/activation.d.ts +64 -0
- package/dist/shared/font-system/src/bundled-manifest.d.ts +32 -0
- package/dist/shared/font-system/src/bundled.d.ts +41 -0
- package/dist/shared/font-system/src/document-font-options.d.ts +53 -0
- package/dist/shared/font-system/src/epoch.d.ts +6 -0
- package/dist/shared/font-system/src/font-offerings.d.ts +120 -0
- package/dist/shared/font-system/src/index.d.ts +35 -0
- package/dist/shared/font-system/src/os2.d.ts +30 -0
- package/dist/shared/font-system/src/registry.d.ts +188 -0
- package/dist/shared/font-system/src/report.d.ts +98 -0
- package/dist/shared/font-system/src/resolver.d.ts +215 -0
- package/dist/shared/font-system/src/substitution-evidence.d.ts +103 -0
- package/dist/shared/font-system/src/types.d.ts +128 -0
- package/dist/style.css +3316 -0
- package/dist/style.layered.css +3316 -0
- package/dist/superdoc/src/SuperDoc.vue.d.ts +88 -0
- package/dist/superdoc/src/cdn-entry.d.ts +2 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +62 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +26 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +19 -0
- package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +30 -0
- package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +10 -0
- package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +1 -0
- package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +6 -0
- package/dist/superdoc/src/components/CommentsLayer/comment-schemas.d.ts +18 -0
- package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +9 -0
- package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +21 -0
- package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +28 -0
- package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +7 -0
- package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +2 -0
- package/dist/superdoc/src/components/CommentsLayer/types.d.ts +3 -0
- package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +8 -0
- package/dist/superdoc/src/components/CommentsLayer/use-conversation.d.ts +22 -0
- package/dist/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts +11 -0
- package/dist/superdoc/src/components/HtmlViewer/HtmlViewer.vue.d.ts +10 -0
- package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +61 -0
- package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +21 -0
- package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +24 -0
- package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +19 -0
- package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +17 -0
- package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +18 -0
- package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +19 -0
- package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +17 -0
- package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +12 -0
- package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +19 -0
- package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +10 -0
- package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +31 -0
- package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +5 -0
- package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +32 -0
- package/dist/superdoc/src/composables/replace-continuation.d.ts +37 -0
- package/dist/superdoc/src/composables/use-ai.d.ts +10 -0
- package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +10 -0
- package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +21 -0
- package/dist/superdoc/src/composables/use-document.d.ts +34 -0
- package/dist/superdoc/src/composables/use-field.d.ts +33 -0
- package/dist/superdoc/src/composables/use-find-replace.d.ts +83 -0
- package/dist/superdoc/src/composables/use-high-contrast-mode.d.ts +4 -0
- package/dist/superdoc/src/composables/use-link-popover.d.ts +221 -0
- package/dist/superdoc/src/composables/use-password-prompt.d.ts +33 -0
- package/dist/superdoc/src/composables/use-selected-text.d.ts +16 -0
- package/dist/superdoc/src/composables/use-viewport-fit.d.ts +50 -0
- package/dist/superdoc/src/composables/useUiFontFamily.d.ts +24 -0
- package/dist/superdoc/src/core/EventEmitter.d.ts +55 -0
- package/dist/superdoc/src/core/SuperDoc.d.ts +775 -0
- package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +4 -0
- package/dist/superdoc/src/core/collaboration/collaboration.d.ts +28 -0
- package/dist/superdoc/src/core/collaboration/helpers.d.ts +8 -0
- package/dist/superdoc/src/core/collaboration/permissions.d.ts +19 -0
- package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +99 -0
- package/dist/superdoc/src/core/collaboration/room-overwrite.d.ts +22 -0
- package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +57 -0
- package/dist/superdoc/src/core/config/merge-defined.d.ts +35 -0
- package/dist/superdoc/src/core/config/normalize-interaction-config.d.ts +15 -0
- package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +23 -0
- package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +62 -0
- package/dist/superdoc/src/core/create-app.d.ts +32 -0
- package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +9 -0
- package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +117 -0
- package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -0
- package/dist/superdoc/src/core/editor-runtime/root-marker.d.ts +33 -0
- package/dist/superdoc/src/core/editor-runtime/types.d.ts +405 -0
- package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +185 -0
- package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +47 -0
- package/dist/superdoc/src/core/extensions/define.d.ts +56 -0
- package/dist/superdoc/src/core/extensions/index.d.ts +2 -0
- package/dist/superdoc/src/core/extensions/types.d.ts +519 -0
- package/dist/superdoc/src/core/helpers/export.d.ts +2 -0
- package/dist/superdoc/src/core/helpers/file.d.ts +43 -0
- package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +60 -0
- package/dist/superdoc/src/core/helpers/normalize-user.d.ts +13 -0
- package/dist/superdoc/src/core/index.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -0
- package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -0
- package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +66 -0
- package/dist/superdoc/src/core/surface-manager.d.ts +90 -0
- package/dist/superdoc/src/core/theme/create-theme.d.ts +82 -0
- package/dist/superdoc/src/core/types/index.d.ts +3006 -0
- package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +3 -0
- package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +16 -0
- package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +97 -0
- package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +247 -0
- package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +251 -0
- package/dist/superdoc/src/core/whiteboard/WhiteboardRenderer.d.ts +2 -0
- package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +1 -0
- package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -0
- package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -0
- package/dist/superdoc/src/helpers/collect-touched-tracked-change-ids.d.ts +11 -0
- package/dist/superdoc/src/helpers/comment-focus.d.ts +4 -0
- package/dist/superdoc/src/helpers/comment-small-screen.d.ts +14 -0
- package/dist/superdoc/src/helpers/deprecation.d.ts +26 -0
- package/dist/superdoc/src/helpers/floor.d.ts +1 -0
- package/dist/superdoc/src/helpers/group-changes.d.ts +1 -0
- package/dist/superdoc/src/helpers/interaction-trace.d.ts +26 -0
- package/dist/superdoc/src/helpers/selection-source.d.ts +1 -0
- package/dist/superdoc/src/helpers/transaction-touches-structural-change.d.ts +19 -0
- package/dist/superdoc/src/helpers/use-selection.d.ts +17 -0
- package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +22 -0
- package/dist/superdoc/src/helpers/v2-remote-review-hydration.d.ts +12 -0
- package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +15 -0
- package/dist/superdoc/src/helpers/v2-review-mutation-reconciler.d.ts +19 -0
- package/dist/superdoc/src/helpers/v2-review-target.d.ts +7 -0
- package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +12 -0
- package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +5 -0
- package/dist/superdoc/src/icons.d.ts +11 -0
- package/dist/superdoc/src/index.d.cts +13 -0
- package/dist/superdoc/src/index.d.ts +11 -0
- package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +21 -0
- package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +6 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +14 -0
- package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +13 -0
- package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +37 -0
- package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +12 -0
- package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +34 -0
- package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +14 -0
- package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +8 -0
- package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +6 -0
- package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +4 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +24 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +11 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +18 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +38 -0
- package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +8 -0
- package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +24 -0
- package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +102 -0
- package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +17 -0
- package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +11 -0
- package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +5 -0
- package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +5 -0
- package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +10 -0
- package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +4 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +1 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +76 -0
- package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +58 -0
- package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +8 -0
- package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +48 -0
- package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +237 -0
- package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +59 -0
- package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +63 -0
- package/dist/superdoc/src/internal/toolbar/index.d.ts +10 -0
- package/dist/superdoc/src/main.d.ts +1 -0
- package/dist/superdoc/src/public/browser-document-api.d.ts +53 -0
- package/dist/superdoc/src/public/collaboration-upgrade-engine.d.cts +26 -0
- package/dist/superdoc/src/public/collaboration-upgrade-engine.d.ts +130 -0
- package/dist/superdoc/src/public/index.d.cts +359 -0
- package/dist/superdoc/src/public/index.d.ts +179 -0
- package/dist/superdoc/src/public/ui/commands.d.ts +249 -0
- package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +18 -0
- package/dist/superdoc/src/public/ui/entity-at.d.ts +29 -0
- package/dist/superdoc/src/public/ui/equality.d.ts +10 -0
- package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +36 -0
- package/dist/superdoc/src/public/ui/react.d.ts +81 -0
- package/dist/superdoc/src/public/ui/reasons.d.ts +99 -0
- package/dist/superdoc/src/public/ui/types.d.ts +1425 -0
- package/dist/superdoc/src/public/ui-react.d.cts +20 -0
- package/dist/superdoc/src/public/ui-react.d.ts +20 -0
- package/dist/superdoc/src/public/ui.d.cts +194 -0
- package/dist/superdoc/src/public/ui.d.ts +29 -0
- package/dist/superdoc/src/stores/comments-store.d.ts +676 -0
- package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +14 -0
- package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +14 -0
- package/dist/superdoc/src/stores/hrbr-fields-store.d.ts +43 -0
- package/dist/superdoc/src/stores/superdoc-store.d.ts +2182 -0
- package/dist/superdoc.cjs +36521 -0
- package/dist/superdoc.es.js +36449 -0
- package/dist/word-layout/src/index.d.ts +64 -0
- package/dist/word-layout/src/list-marker.d.ts +68 -0
- package/dist/word-layout/src/marker-utils.d.ts +20 -0
- package/dist/word-layout/src/numbering-manager.d.ts +85 -0
- package/dist/word-layout/src/tab-layout.d.ts +193 -0
- package/dist/word-layout/src/types.d.ts +106 -0
- package/dist/word-layout/src/unit-conversions.d.ts +120 -0
- package/dist-cdn/style.layered.css +2 -0
- package/dist-cdn/superdoc.min.css +2 -0
- package/dist-cdn/superdoc.min.js +108 -0
- package/package.json +137 -24
- package/.npmignore +0 -4
- package/data.json +0 -17
- package/index.js +0 -2
- package/lib/Augmenter.js +0 -27
- package/lib/Runner.js +0 -80
- package/lib/Stopper.js +0 -71
- package/test/superdoc.js +0 -126
- package/utils/app.js +0 -18
- package/utils/server.js +0 -2
- package/web/index.js +0 -54
- package/web/public/style.css +0 -76
- package/web/views/index.ejs +0 -53
- package/web/views/layout.ejs +0 -13
- package/web/views/method.ejs +0 -59
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var SuperDoc=(function(){var VA=Object.create,Hf=Object.defineProperty,jA=Object.getOwnPropertyDescriptor,GA=Object.getOwnPropertyNames,WA=Object.getPrototypeOf,KA=Object.prototype.hasOwnProperty,_r=(e,t)=>()=>(e&&(t=e(e=0)),t),yb=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vu=(e,t)=>{let n={};for(var r in e)Hf(n,r,{get:e[r],enumerable:!0});return t&&Hf(n,Symbol.toStringTag,{value:"Module"}),n},qA=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=GA(t),i=0,s=o.length,a;i<s;i++)a=o[i],!KA.call(e,a)&&a!==n&&Hf(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=jA(t,a))||r.enumerable});return e},bb=(e,t,n)=>(n=e!=null?VA(WA(e)):{},qA(t||!e||!e.__esModule?Hf(n,"default",{value:e,enumerable:!0}):n,e)),YA=yb(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function s(u,c,d,h,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new i(d,h||u,m),g=r?r+c:c;return u._events[g]?u._events[g].fn?u._events[g]=[u._events[g],p]:u._events[g].push(p):(u._events[g]=p,u._eventsCount++),u}function a(u,c){--u._eventsCount===0?u._events=new o:delete u._events[c]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],d,h;if(this._eventsCount===0)return c;for(h in d=this._events)n.call(d,h)&&c.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},l.prototype.listeners=function(c){var d=r?r+c:c,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,p=h.length,g=new Array(p);m<p;m++)g[m]=h[m].fn;return g},l.prototype.listenerCount=function(c){var d=r?r+c:c,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,d,h,m,p,g){var k=r?r+c:c;if(!this._events[k])return!1;var w=this._events[k],S=arguments.length,y,C;if(w.fn){switch(w.once&&this.removeListener(c,w.fn,void 0,!0),S){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,d),!0;case 3:return w.fn.call(w.context,d,h),!0;case 4:return w.fn.call(w.context,d,h,m),!0;case 5:return w.fn.call(w.context,d,h,m,p),!0;case 6:return w.fn.call(w.context,d,h,m,p,g),!0}for(C=1,y=new Array(S-1);C<S;C++)y[C-1]=arguments[C];w.fn.apply(w.context,y)}else{var T=w.length,R;for(C=0;C<T;C++)switch(w[C].once&&this.removeListener(c,w[C].fn,void 0,!0),S){case 1:w[C].fn.call(w[C].context);break;case 2:w[C].fn.call(w[C].context,d);break;case 3:w[C].fn.call(w[C].context,d,h);break;case 4:w[C].fn.call(w[C].context,d,h,m);break;default:if(!y)for(R=1,y=new Array(S-1);R<S;R++)y[R-1]=arguments[R];w[C].fn.apply(w[C].context,y)}}return!0},l.prototype.on=function(c,d,h){return s(this,c,d,h,!1)},l.prototype.once=function(c,d,h){return s(this,c,d,h,!0)},l.prototype.removeListener=function(c,d,h,m){var p=r?r+c:c;if(!this._events[p])return this;if(!d)return a(this,p),this;var g=this._events[p];if(g.fn)g.fn===d&&(!m||g.once)&&(!h||g.context===h)&&a(this,p);else{for(var k=0,w=[],S=g.length;k<S;k++)(g[k].fn!==d||m&&!g[k].once||h&&g[k].context!==h)&&w.push(g[k]);w.length?this._events[p]=w.length===1?w[0]:w:a(this,p)}return this},l.prototype.removeAllListeners=function(c){var d;return c?(d=r?r+c:c,this._events[d]&&a(this,d)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),Rm=bb(YA(),1),fo=[];for(let e=0;e<256;++e)fo.push((e+256).toString(16).slice(1));function XA(e,t=0){return(fo[e[t+0]]+fo[e[t+1]]+fo[e[t+2]]+fo[e[t+3]]+"-"+fo[e[t+4]]+fo[e[t+5]]+"-"+fo[e[t+6]]+fo[e[t+7]]+"-"+fo[e[t+8]]+fo[e[t+9]]+"-"+fo[e[t+10]]+fo[e[t+11]]+fo[e[t+12]]+fo[e[t+13]]+fo[e[t+14]]+fo[e[t+15]]).toLowerCase()}var Mm,QA=new Uint8Array(16);function ZA(){if(!Mm){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Mm=crypto.getRandomValues.bind(crypto)}return Mm(QA)}var JA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wb={randomUUID:JA};function $A(e,t,n){if(wb.randomUUID&&!t&&!e)return wb.randomUUID();e=e||{};const r=e.random??e.rng?.()??ZA();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return XA(r)}var Ji=$A;function ju(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function gn(e){if(Rt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Wn(r)?eI(r):gn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Wn(e)||An(e))return e}function eI(e){const t={};return e.replace(Mb,"").split(Tb).forEach(n=>{if(n){const r=n.split(Rb);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function en(e){let t="";if(Wn(e))t=e;else if(Rt(e))for(let n=0;n<e.length;n++){const r=en(e[n]);r&&(t+=r+" ")}else if(An(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Lm(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Wn(t)&&(e.class=en(t)),n&&(e.style=gn(n)),e}function Cb(e){return!!e||e===""}function tI(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ks(e[r],t[r]);return n}function ks(e,t){if(e===t)return!0;let n=Pm(e),r=Pm(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Ko(e),r=Ko(t),n||r)return e===t;if(n=Rt(e),r=Rt(t),n||r)return n&&r?tI(e,t):!1;if(n=An(e),r=An(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e){const i=e.hasOwnProperty(o),s=t.hasOwnProperty(o);if(i&&!s||!i&&s||!ks(e[o],t[o]))return!1}}return String(e)===String(t)}function Uf(e,t){return e.findIndex(n=>ks(n,t))}function nI(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var _n,Sl,si,Dm,vc,Gu,On,Vf,_b,Tn,Rt,kl,ka,Pm,Sb,Qt,Wn,Ko,An,jf,Om,Al,kb,Wu,Ku,Aa,qu,Ab,Er,Ib,Oo,yc,bc,$r,Il,Fm,Yu,Xu,Eb,Qu,xb,Tb,Rb,Mb,Bm,Lb,rI,Nm,Nt,zm,Gf,Hm=_r((()=>{_n={},Sl=[],si=()=>{},Dm=()=>!1,vc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Gu=e=>e.startsWith("onUpdate:"),On=Object.assign,Vf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},_b=Object.prototype.hasOwnProperty,Tn=(e,t)=>_b.call(e,t),Rt=Array.isArray,kl=e=>Al(e)==="[object Map]",ka=e=>Al(e)==="[object Set]",Pm=e=>Al(e)==="[object Date]",Sb=e=>Al(e)==="[object RegExp]",Qt=e=>typeof e=="function",Wn=e=>typeof e=="string",Ko=e=>typeof e=="symbol",An=e=>e!==null&&typeof e=="object",jf=e=>(An(e)||Qt(e))&&Qt(e.then)&&Qt(e.catch),Om=Object.prototype.toString,Al=e=>Om.call(e),kb=e=>Al(e).slice(8,-1),Wu=e=>Al(e)==="[object Object]",Ku=e=>Wn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Aa=ju(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),qu=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Ab=/-\w/g,Er=qu(e=>e.replace(Ab,t=>t.slice(1).toUpperCase())),Ib=/\B([A-Z])/g,Oo=qu(e=>e.replace(Ib,"-$1").toLowerCase()),yc=qu(e=>e.charAt(0).toUpperCase()+e.slice(1)),bc=qu(e=>e?`on${yc(e)}`:""),$r=(e,t)=>!Object.is(e,t),Il=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Fm=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Yu=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Xu=e=>{const t=Wn(e)?Number(e):NaN;return isNaN(t)?e:t},Qu=()=>Eb||(Eb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),xb=ju("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"),Tb=/;(?![^(]*\))/g,Rb=/:([^]+)/,Mb=/\/\*[^]*?\*\//g,Bm="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Lb=ju(Bm),rI=ju(Bm+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Nm=e=>!!(e&&e.__v_isRef===!0),Nt=e=>Wn(e)?e:e==null?"":Rt(e)||An(e)&&(e.toString===Om||!Qt(e.toString))?Nm(e)?Nt(e.value):JSON.stringify(e,zm,2):String(e),zm=(e,t)=>Nm(t)?zm(e,t.value):kl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[Gf(r,i)+" =>"]=o,n),{})}:ka(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Gf(n))}:Ko(t)?Gf(t):An(t)&&!Rt(t)&&!Wu(t)?String(t):t,Gf=(e,t="")=>{var n;return Ko(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function Um(e){return new Qf(e)}function Vm(){return So}function Db(e,t=!1){So&&So.cleanups.push(e)}function Pb(e,t=!1){if(e.flags|=8,t){e.next=ed,ed=e;return}e.next=$u,$u=e}function jm(){Zm++}function Gm(){if(--Zm>0)return;if(ed){let t=ed;for(ed=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$u;){let t=$u;for($u=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Ob(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Fb(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Km(r),oI(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Wm(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Bb(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Bb(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===_c)||(e.globalVersion=_c,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Wm(e))))return;e.flags|=2;const t=e.dep,n=Qn,r=Si;Qn=e,Si=!0;try{Ob(e);const o=e.fn(e._value);(t.version===0||$r(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Qn=n,Si=r,Fb(e),e.flags&=-3}}function Km(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)Km(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function oI(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function iI(e,t){e.effect instanceof Cc&&(e=e.effect.fn);const n=new Cc(e);t&&On(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function sI(e){e.effect.stop()}function As(){Jm.push(Si),Si=!1}function Is(){const e=Jm.pop();Si=e===void 0?!0:e}function Nb(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Qn;Qn=void 0;try{t()}finally{Qn=n}}}function zb(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)zb(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function _o(e,t,n){if(Si&&Qn){let r=nd.get(e);r||nd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new td),o.map=r,o.key=n),o.track()}}function Es(e,t,n,r,o,i){const s=nd.get(e);if(!s){_c++;return}const a=l=>{l&&l.trigger()};if(jm(),t==="clear")s.forEach(a);else{const l=Rt(e),u=l&&Ku(n);if(l&&n==="length"){const c=Number(r);s.forEach((d,h)=>{(h==="length"||h===Sc||!Ko(h)&&h>=c)&&a(d)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(Sc)),t){case"add":l?u&&a(s.get("length")):(a(s.get(Ia)),kl(e)&&a(s.get(Jf)));break;case"delete":l||(a(s.get(Ia)),kl(e)&&a(s.get(Jf)));break;case"set":kl(e)&&a(s.get(Ia));break}}Gm()}function aI(e,t){const n=nd.get(e);return n&&n.get(t)}function wc(e){const t=pn(e);return t===e?t:(_o(t,"iterate",Sc),qo(e)?t:t.map(ki))}function Wf(e){return _o(e=pn(e),"iterate",Sc),e}function $i(e,t){return es(e)?El(_i(e)?ki(t):t):ki(t)}function qm(e,t,n){const r=Wf(e),o=r[t]();return r!==e&&!qo(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function xs(e,t,n,r,o,i){const s=Wf(e),a=s!==e&&!qo(e),l=s[t];if(l!==Xb[t]){const d=l.apply(e,i);return a?ki(d):d}let u=n;s!==e&&(a?u=function(d,h){return n.call(this,$i(e,d),h,e)}:n.length>2&&(u=function(d,h){return n.call(this,d,h,e)}));const c=l.call(s,u,r);return a&&o?o(c):c}function Hb(e,t,n,r){const o=Wf(e),i=o!==e&&!qo(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,c,d){return a&&(a=!1,u=$i(e,u)),n.call(this,u,$i(e,c),d,e)}):n.length>3&&(s=function(u,c,d){return n.call(this,u,c,d,e)}));const l=o[t](s,...r);return a?$i(e,l):l}function Ym(e,t,n){const r=pn(e);_o(r,"iterate",Sc);const o=r[t](...n);return(o===-1||o===!1)&&Ju(n[0])?(n[0]=pn(n[0]),r[t](...n)):o}function Zu(e,t,n=[]){As(),jm();const r=pn(e)[t].apply(e,n);return Gm(),Is(),r}function lI(e){Ko(e)||(e=String(e));const t=pn(this);return _o(t,"has",e),t.hasOwnProperty(e)}function cI(e,t,n){return function(...r){const o=this.__v_raw,i=pn(o),s=kl(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),c=n?$f:t?El:ki;return!t&&_o(i,"iterate",l?Jf:Ia),On(Object.create(u),{next(){const{value:d,done:h}=u.next();return h?{value:d,done:h}:{value:a?[c(d[0]),c(d[1])]:c(d),done:h}}})}}function Kf(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function uI(e,t){const n={get(r){const o=this.__v_raw,i=pn(o),s=pn(r);e||($r(r,s)&&_o(i,"get",r),_o(i,"get",s));const{has:a}=rd(i),l=t?$f:e?El:ki;if(a.call(i,r))return l(o.get(r));if(a.call(i,s))return l(o.get(s));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!e&&_o(pn(r),"iterate",Ia),r.size},has(r){const o=this.__v_raw,i=pn(o),s=pn(r);return e||($r(r,s)&&_o(i,"has",r),_o(i,"has",s)),r===s?o.has(r):o.has(r)||o.has(s)},forEach(r,o){const i=this,s=i.__v_raw,a=pn(s),l=t?$f:e?El:ki;return!e&&_o(a,"iterate",Ia),s.forEach((u,c)=>r.call(o,l(u),l(c),i))}};return On(n,e?{add:Kf("add"),set:Kf("set"),delete:Kf("delete"),clear:Kf("clear")}:{add(r){const o=pn(this),i=rd(o),s=pn(r),a=!t&&!qo(r)&&!es(r)?s:r;return i.has.call(o,a)||$r(r,a)&&i.has.call(o,r)||$r(s,a)&&i.has.call(o,s)||(o.add(a),Es(o,"add",a,a)),this},set(r,o){!t&&!qo(o)&&!es(o)&&(o=pn(o));const i=pn(this),{has:s,get:a}=rd(i);let l=s.call(i,r);l||(r=pn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?$r(o,u)&&Es(i,"set",r,o,u):Es(i,"add",r,o),this},delete(r){const o=pn(this),{has:i,get:s}=rd(o);let a=i.call(o,r);a||(r=pn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&Es(o,"delete",r,void 0,l),u},clear(){const r=pn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&Es(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=cI(r,e,t)}),n}function qf(e,t){const n=uI(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Tn(n,o)&&o in r?n:r,o,i)}function dI(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function fI(e){return e.__v_skip||!Object.isExtensible(e)?0:dI(kb(e))}function jr(e){return es(e)?e:Xf(e,!1,Zb,t2,rg)}function Ub(e){return Xf(e,!1,$b,n2,og)}function Yf(e){return Xf(e,!0,Jb,r2,ig)}function hI(e){return Xf(e,!0,e2,o2,sg)}function Xf(e,t,n,r,o){if(!An(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=fI(e);if(i===0)return e;const s=o.get(e);if(s)return s;const a=new Proxy(e,i===2?r:n);return o.set(e,a),a}function _i(e){return es(e)?_i(e.__v_raw):!!(e&&e.__v_isReactive)}function es(e){return!!(e&&e.__v_isReadonly)}function qo(e){return!!(e&&e.__v_isShallow)}function Ju(e){return e?!!e.__v_raw:!1}function pn(e){const t=e&&e.__v_raw;return t?pn(t):e}function Gr(e){return!Tn(e,"__v_skip")&&Object.isExtensible(e)&&Fm(e,"__v_skip",!0),e}function tr(e){return e?e.__v_isRef===!0:!1}function ne(e){return Vb(e,!1)}function Wr(e){return Vb(e,!0)}function Vb(e,t){return tr(e)?e:new i2(e,t)}function pI(e){e.dep&&e.dep.trigger()}function We(e){return tr(e)?e.value:e}function mI(e){return Qt(e)?e():We(e)}function Xm(e){return _i(e)?e:new Proxy(e,s2)}function jb(e){return new a2(e)}function Gb(e){const t=Rt(e)?new Array(e.length):{};for(const n in e)t[n]=Wb(e,n);return t}function Qm(e,t,n){return tr(e)?e:Qt(e)?new c2(e):An(e)&&arguments.length>1?Wb(e,t,n):ne(e)}function Wb(e,t,n){return new l2(e,t,n)}function gI(e,t,n=!1){let r,o;return Qt(e)?r=e:(r=e.get,o=e.set),new u2(r,o,n)}function vI(){return Rs}function Kb(e,t=!1,n=Rs){if(n){let r=id.get(n);r||id.set(n,r=[]),r.push(e)}}function yI(e,t,n=_n){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=C=>o?C:qo(C)||o===!1||o===0?Ts(C,1):Ts(C);let c,d,h,m,p=!1,g=!1;if(tr(e)?(d=()=>e.value,p=qo(e)):_i(e)?(d=()=>u(e),p=!0):Rt(e)?(g=!0,p=e.some(C=>_i(C)||qo(C)),d=()=>e.map(C=>{if(tr(C))return C.value;if(_i(C))return u(C);if(Qt(C))return l?l(C,2):C()})):Qt(e)?t?d=l?()=>l(e,2):e:d=()=>{if(h){As();try{h()}finally{Is()}}const C=Rs;Rs=c;try{return l?l(e,3,[m]):e(m)}finally{Rs=C}}:d=si,t&&o){const C=d,T=o===!0?1/0:o;d=()=>Ts(C(),T)}const k=Vm(),w=()=>{c.stop(),k&&k.active&&Vf(k.effects,c)};if(i&&t){const C=t;t=(...T)=>{C(...T),w()}}let S=g?new Array(e.length).fill(od):od;const y=C=>{if(!(!(c.flags&1)||!c.dirty&&!C))if(t){const T=c.run();if(o||p||(g?T.some((R,M)=>$r(R,S[M])):$r(T,S))){h&&h();const R=Rs;Rs=c;try{const M=[T,S===od?void 0:g&&S[0]===od?[]:S,m];S=T,l?l(t,3,M):t(...M)}finally{Rs=R}}}else c.run()};return a&&a(y),c=new Cc(d),c.scheduler=s?()=>s(y,!1):y,m=C=>Kb(C,!1,c),h=c.onStop=()=>{const C=id.get(c);if(C){if(l)l(C,4);else for(const T of C)T();id.delete(c)}},t?r?y(!0):S=c.run():s?s(y.bind(null,!0),!0):c.run(),w.pause=c.pause.bind(c),w.resume=c.resume.bind(c),w.stop=w,w}function Ts(e,t=1/0,n){if(t<=0||!An(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,tr(e))Ts(e.value,t,n);else if(Rt(e))for(let r=0;r<e.length;r++)Ts(e[r],t,n);else if(ka(e)||kl(e))e.forEach(r=>{Ts(r,t,n)});else if(Wu(e)){for(const r in e)Ts(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ts(e[r],t,n)}return e}var So,Qf,Qn,Zf,Cc,Zm,$u,ed,Si,Jm,_c,qb,td,nd,Ia,Jf,Sc,Yb,Xb,Qb,$m,eg,tg,ng,Zb,Jb,$b,e2,$f,rd,t2,n2,r2,o2,rg,og,ig,sg,ki,El,i2,s2,a2,l2,c2,u2,d2,f2,od,id,Rs,bI=_r((()=>{Hm(),Qf=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=So,!e&&So&&(this.index=(So.scopes||(So.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=So;try{return So=this,e()}finally{So=t}}}on(){++this._on===1&&(this.prevScope=So,So=this)}off(){this._on>0&&--this._on===0&&(So=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}},Zf=new WeakSet,Cc=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,So&&So.active&&So.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Zf.has(this)&&(Zf.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Pb(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Nb(this),Ob(this);const e=Qn,t=Si;Qn=this,Si=!0;try{return this.fn()}finally{Fb(this),Qn=e,Si=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Km(e);this.deps=this.depsTail=void 0,Nb(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Zf.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Wm(this)&&this.run()}get dirty(){return Wm(this)}},Zm=0,Si=!0,Jm=[],_c=0,qb=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},td=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Qn||!Si||Qn===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Qn)t=this.activeLink=new qb(Qn,this),Qn.deps?(t.prevDep=Qn.depsTail,Qn.depsTail.nextDep=t,Qn.depsTail=t):Qn.deps=Qn.depsTail=t,zb(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const n=t.nextDep;n.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=n),t.prevDep=Qn.depsTail,t.nextDep=void 0,Qn.depsTail.nextDep=t,Qn.depsTail=t,Qn.deps===t&&(Qn.deps=n)}return t}trigger(e){this.version++,_c++,this.notify(e)}notify(e){jm();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Gm()}}},nd=new WeakMap,Ia=Symbol(""),Jf=Symbol(""),Sc=Symbol(""),Yb={__proto__:null,[Symbol.iterator](){return qm(this,Symbol.iterator,e=>$i(this,e))},concat(...e){return wc(this).concat(...e.map(t=>Rt(t)?wc(t):t))},entries(){return qm(this,"entries",e=>(e[1]=$i(this,e[1]),e))},every(e,t){return xs(this,"every",e,t,void 0,arguments)},filter(e,t){return xs(this,"filter",e,t,n=>n.map(r=>$i(this,r)),arguments)},find(e,t){return xs(this,"find",e,t,n=>$i(this,n),arguments)},findIndex(e,t){return xs(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return xs(this,"findLast",e,t,n=>$i(this,n),arguments)},findLastIndex(e,t){return xs(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return xs(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ym(this,"includes",e)},indexOf(...e){return Ym(this,"indexOf",e)},join(e){return wc(this).join(e)},lastIndexOf(...e){return Ym(this,"lastIndexOf",e)},map(e,t){return xs(this,"map",e,t,void 0,arguments)},pop(){return Zu(this,"pop")},push(...e){return Zu(this,"push",e)},reduce(e,...t){return Hb(this,"reduce",e,t)},reduceRight(e,...t){return Hb(this,"reduceRight",e,t)},shift(){return Zu(this,"shift")},some(e,t){return xs(this,"some",e,t,void 0,arguments)},splice(...e){return Zu(this,"splice",e)},toReversed(){return wc(this).toReversed()},toSorted(e){return wc(this).toSorted(e)},toSpliced(...e){return wc(this).toSpliced(...e)},unshift(...e){return Zu(this,"unshift",e)},values(){return qm(this,"values",e=>$i(this,e))}},Xb=Array.prototype,Qb=ju("__proto__,__v_isRef,__isVue"),$m=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ko)),eg=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return o;if(t==="__v_raw")return n===(r?o?sg:ig:o?og:rg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Rt(e);if(!r){let a;if(i&&(a=Yb[t]))return a;if(t==="hasOwnProperty")return lI}const s=Reflect.get(e,t,tr(e)?e:n);if((Ko(t)?$m.has(t):Qb(t))||(r||_o(e,"get",t),o))return s;if(tr(s)){const a=i&&Ku(t)?s:s.value;return r&&An(a)?Yf(a):a}return An(s)?r?Yf(s):jr(s):s}},tg=class extends eg{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Rt(e)&&Ku(t);if(!this._isShallow){const l=es(o);if(!qo(n)&&!es(n)&&(o=pn(o),n=pn(n)),!i&&tr(o)&&!tr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:Tn(e,t),a=Reflect.set(e,t,n,tr(e)?e:r);return e===pn(r)&&(s?$r(n,o)&&Es(e,"set",t,n,o):Es(e,"add",t,n)),a}deleteProperty(e,t){const n=Tn(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&Es(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!Ko(t)||!$m.has(t))&&_o(e,"has",t),n}ownKeys(e){return _o(e,"iterate",Rt(e)?"length":Ia),Reflect.ownKeys(e)}},ng=class extends eg{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Zb=new tg,Jb=new ng,$b=new tg(!0),e2=new ng(!0),$f=e=>e,rd=e=>Reflect.getPrototypeOf(e),t2={get:qf(!1,!1)},n2={get:qf(!1,!0)},r2={get:qf(!0,!1)},o2={get:qf(!0,!0)},rg=new WeakMap,og=new WeakMap,ig=new WeakMap,sg=new WeakMap,ki=e=>An(e)?jr(e):e,El=e=>An(e)?Yf(e):e,i2=class{constructor(e,t){this.dep=new td,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:pn(e),this._value=t?e:ki(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||qo(e)||es(e);e=n?e:pn(e),$r(e,t)&&(this._rawValue=e,this._value=n?e:ki(e),this.dep.trigger())}},s2={get:(e,t,n)=>t==="__v_raw"?e:We(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return tr(o)&&!tr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},a2=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new td,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}},l2=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Ko(t)?t:String(t),this._raw=pn(e);let r=!0,o=e;if(!Rt(e)||Ko(this._key)||!Ku(this._key))do r=!Ju(o)||qo(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=We(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&tr(this._raw[this._key])){const t=this._object[this._key];if(tr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return aI(this._raw,this._key)}},c2=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}},u2=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new td(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=_c-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Qn!==this)return Pb(this,!0),!0}get value(){const e=this.dep.track();return Bb(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},d2={GET:"get",HAS:"has",ITERATE:"iterate"},f2={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},od={},id=new WeakMap,Rs=void 0}));function wI(e){Ig.push(e)}function CI(){Ig.pop()}function _I(e,t){}function kc(e,t,n,r){try{return r?e(...r):e()}catch(o){xl(o,t,n)}}function Ai(e,t,n,r){if(Qt(e)){const o=kc(e,t,n,r);return o&&jf(o)&&o.catch(i=>{xl(i,t,n)}),o}if(Rt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(Ai(e[i],t,n,r));return o}}function xl(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||_n;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let d=0;d<c.length;d++)if(c[d](e,l,u)===!1)return}a=a.parent}if(i){As(),kc(i,null,10,[e,l,u]),Is();return}}SI(e,n,o,r,s)}function SI(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function St(e){const t=vd||Eg;return e?t.then(this?e.bind(this):e):t}function kI(e){let t=Bi+1,n=Ao.length;for(;t<n;){const r=t+n>>>1,o=Ao[r],i=xc(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function ag(e){if(!(e.flags&1)){const t=xc(e),n=Ao[Ao.length-1];!n||!(e.flags&2)&&t>=xc(n)?Ao.push(e):Ao.splice(kI(t),0,e),e.flags|=1,h2()}}function h2(){vd||(vd=Eg.then(m2))}function sd(e){Rt(e)?Ml.push(...e):Os&&e.id===-1?Os.splice(Ll+1,0,e):e.flags&1||(Ml.push(e),e.flags|=1),h2()}function p2(e,t,n=Bi+1){for(;n<Ao.length;n++){const r=Ao[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Ao.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function eh(e){if(Ml.length){const t=[...new Set(Ml)].sort((n,r)=>xc(n)-xc(r));if(Ml.length=0,Os){Os.push(...t);return}for(Os=t,Ll=0;Ll<Os.length;Ll++){const n=Os[Ll];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Os=null,Ll=0}}function m2(e){try{for(Bi=0;Bi<Ao.length;Bi++){const t=Ao[Bi];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),kc(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Bi<Ao.length;Bi++){const t=Ao[Bi];t&&(t.flags&=-2)}Bi=-1,Ao.length=0,eh(e),vd=null,(Ao.length||Ml.length)&&m2(e)}}function g2(e,t){var n,r;Tc=e,Tc?(Tc.enabled=!0,yd.forEach(({event:o,args:i})=>Tc.emit(o,...i)),yd=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{g2(o,t)}),setTimeout(()=>{Tc||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,yd=[])},3e3)):yd=[]}function ad(e){const t=eo;return eo=e,bd=e&&e.type.__scopeId||null,t}function AI(e){bd=e}function II(){bd=null}function ko(e,t=eo,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&md(-1);const i=ad(t);let s;try{s=e(...o)}finally{ad(i),r._d&&md(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function Ms(e,t){if(eo===null)return e;const n=gd(eo),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=_n]=t[o];i&&(Qt(i)&&(i={mounted:i,updated:i}),i.deep&&Ts(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function ts(e,t,n,r){const o=e.dirs,i=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[r];l&&(As(),Ai(l,n,8,[e.el,a,e,t]),Is())}}function v2(e,t){if(to){let n=to.provides;const r=to.parent&&to.parent.provides;r===n&&(n=to.provides=Object.create(r)),n[e]=t}}function Ea(e,t,n=!1){const r=or();if(r||Ma){let o=Ma?Ma._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&Qt(t)?t.call(r&&r.proxy):t}}function y2(){return!!(or()||Ma)}function EI(e,t){return ld(e,null,t)}function xI(e,t){return ld(e,null,{flush:"post"})}function b2(e,t){return ld(e,null,{flush:"sync"})}function Pt(e,t,n){return ld(e,t,n)}function ld(e,t,n=_n){const{immediate:r,deep:o,flush:i,once:s}=n,a=On({},n),l=t&&r||!t&&i!=="post";let u;if(Pa){if(i==="sync"){const m=Tg();u=m.__watcherHandles||(m.__watcherHandles=[])}else if(!l){const m=()=>{};return m.stop=si,m.resume=si,m.pause=si,m}}const c=to;a.call=(m,p,g)=>Ai(m,c,p,g);let d=!1;i==="post"?a.scheduler=m=>{xr(m,c&&c.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(m,p)=>{p?m():ag(m)}),a.augmentJob=m=>{t&&(m.flags|=4),d&&(m.flags|=2,c&&(m.id=c.uid,m.i=c))};const h=yI(e,t,a);return Pa&&(u?u.push(h):l&&h()),h}function TI(e,t,n){const r=this.proxy,o=Wn(e)?e.includes(".")?w2(r,e):()=>r[e]:e.bind(r,r);let i;Qt(t)?i=t:(i=t.handler,n=t);const s=Ol(this),a=ld(o,i.bind(r),n);return s(),a}function w2(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}function th(e,t,n,{o:{insert:r},m:o},i=2){i===0&&r(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:l,children:u,props:c}=e,d=i===2;if(d&&r(s,t,n),(!d||Ta(c))&&l&16)for(let h=0;h<u.length;h++)o(u[h],t,n,2);d&&r(a,t,n)}function RI(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:c}},d){function h(k,w){let S=w;for(;S;){if(S&&S.nodeType===8){if(S.data==="teleport start anchor")t.targetStart=S;else if(S.data==="teleport anchor"){t.targetAnchor=S,k._lpa=t.targetAnchor&&s(t.targetAnchor);break}}S=s(S)}}function m(k,w){w.anchor=d(s(k),w,a(k),n,r,o,i)}const p=t.target=fh(t.props,l),g=Ta(t.props);if(p){const k=p._lpa||p.firstChild;t.shapeFlag&16&&(g?(m(e,t),h(p,k),t.targetAnchor||lg(p,t,c,u,a(e)===p?e:null)):(t.anchor=s(e),h(p,k),t.targetAnchor||lg(p,t,c,u),d(k&&s(k),t,p,n,r,o,i))),cd(t,g)}else g&&t.shapeFlag&16&&(m(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function cd(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function lg(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[Rg]=s,e&&(r(i,e,o),r(s,e,o)),s}function cg(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Rn(()=>{e.isMounted=!0}),rr(()=>{e.isUnmounting=!0}),e}function C2(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Sr){t=n;break}}return t}function _2(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Ac(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:d,onBeforeLeave:h,onLeave:m,onAfterLeave:p,onLeaveCancelled:g,onBeforeAppear:k,onAppear:w,onAfterAppear:S,onAppearCancelled:y}=t,C=String(e.key),T=_2(n,e),R=(B,z)=>{B&&Ai(B,r,9,z)},M=(B,z)=>{const X=z[1];R(B,z),Rt(B)?B.every(P=>P.length<=1)&&X():B.length<=1&&X()},H={mode:s,persisted:a,beforeEnter(B){let z=l;if(!n.isMounted)if(i)z=k||l;else return;B[Ni]&&B[Ni](!0);const X=T[C];X&&Oi(e,X)&&X.el[Ni]&&X.el[Ni](),R(z,[B])},enter(B){if(T[C]===e)return;let z=u,X=c,P=d;if(!n.isMounted)if(i)z=w||u,X=S||c,P=y||d;else return;let N=!1;B[Rc]=L=>{N||(N=!0,L?R(P,[B]):R(X,[B]),H.delayedLeave&&H.delayedLeave(),B[Rc]=void 0)};const I=B[Rc].bind(null,!1);z?M(z,[B,I]):I()},leave(B,z){const X=String(e.key);if(B[Rc]&&B[Rc](!0),n.isUnmounting)return z();R(h,[B]);let P=!1;B[Ni]=I=>{P||(P=!0,z(),I?R(g,[B]):R(p,[B]),B[Ni]=void 0,T[X]===e&&delete T[X])};const N=B[Ni].bind(null,!1);T[X]=e,m?M(m,[B,N]):N()},clone(B){const z=Ac(B,t,n,r,o);return o&&o(z),z}};return H}function ug(e){if(Mc(e))return e=ns(e),e.children=null,e}function S2(e){if(!Mc(e))return Mg(e.type)&&e.children?C2(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Qt(n.default))return n.default()}}function Ls(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ls(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function nh(e,t=!1,n){let r=[],o=0;for(let i=0;i<e.length;i++){let s=e[i];const a=n==null?s.key:String(n)+String(s.key!=null?s.key:i);s.type===qt?(s.patchFlag&128&&o++,r=r.concat(nh(s.children,t,a))):(t||s.type!==Sr)&&r.push(a!=null?ns(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function Tl(e,t){return Qt(e)?On({name:e.name},t,{setup:e}):e}function MI(){const e=or();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function dg(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function LI(e){const t=or(),n=Wr(null);if(t){const r=t.refs===_n?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function k2(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function Ic(e,t,n,r,o=!1){if(Rt(e)){e.forEach((g,k)=>Ic(g,t&&(Rt(t)?t[k]:t),n,r,o));return}if(os(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ic(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?gd(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,c=a.refs===_n?a.refs={}:a.refs,d=a.setupState,h=pn(d),m=d===_n?Dm:g=>k2(c,g)?!1:Tn(h,g),p=(g,k)=>!(k&&k2(c,k));if(u!=null&&u!==l){if(A2(t),Wn(u))c[u]=null,m(u)&&(d[u]=null);else if(tr(u)){const g=t;p(u,g.k)&&(u.value=null),g.k&&(c[g.k]=null)}}if(Qt(l))kc(l,a,12,[s,c]);else{const g=Wn(l),k=tr(l);if(g||k){const w=()=>{if(e.f){const S=g?m(l)?d[l]:c[l]:p(l)||!e.k?l.value:c[e.k];if(o)Rt(S)&&Vf(S,i);else if(Rt(S))S.includes(i)||S.push(i);else if(g)c[l]=[i],m(l)&&(d[l]=c[l]);else{const y=[i];p(l,e.k)&&(l.value=y),e.k&&(c[e.k]=y)}}else g?(c[l]=s,m(l)&&(d[l]=s)):k&&(p(l,e.k)&&(l.value=s),e.k&&(c[e.k]=s))};if(s){const S=()=>{w(),wd.delete(e)};S.id=-1,wd.set(e,S),xr(S,n)}else A2(e),w()}}}function A2(e){const t=wd.get(e);t&&(t.flags|=8,wd.delete(e))}function DI(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,c=(y,C)=>{if(!C.hasChildNodes()){n(null,y,C),eh(),C._vnode=y;return}d(C.firstChild,y,null,null,null),eh(),C._vnode=y},d=(y,C,T,R,M,H=!1)=>{H=H||!!C.dynamicChildren;const B=Pl(y)&&y.data==="[",z=()=>g(y,C,T,R,M,B),{type:X,ref:P,shapeFlag:N,patchFlag:I}=C;let L=y.nodeType;C.el=y,I===-2&&(H=!1,C.dynamicChildren=null);let Y=null;switch(X){case Fs:L!==3?C.children===""?(l(C.el=o(""),s(y),y),Y=y):Y=z():(y.data!==C.children&&(Dl(),y.data=C.children),Y=i(y));break;case Sr:S(y)?(Y=i(y),w(C.el=y.content.firstChild,y,T)):L!==8||B?Y=z():Y=i(y);break;case La:if(B&&(y=i(y),L=y.nodeType),L===1||L===3){Y=y;const te=!C.children.length;for(let le=0;le<C.staticCount;le++)te&&(C.children+=Y.nodeType===1?Y.outerHTML:Y.data),le===C.staticCount-1&&(C.anchor=Y),Y=i(Y);return B?i(Y):Y}else z();break;case qt:B?Y=p(y,C,T,R,M,H):Y=z();break;default:if(N&1)(L!==1||C.type.toLowerCase()!==y.tagName.toLowerCase())&&!S(y)?Y=z():Y=h(y,C,T,R,M,H);else if(N&6){C.slotScopeIds=M;const te=s(y);if(B?Y=k(y):Pl(y)&&y.data==="teleport start"?Y=k(y,y.data,"teleport end"):Y=i(y),t(C,te,null,T,R,Cd(te),H),os(C)&&!C.type.__asyncResolved){let le;B?(le=Wt(qt),le.anchor=Y?Y.previousSibling:te.lastChild):le=y.nodeType===3?Fi(""):Wt("div"),le.el=y,C.component.subTree=le}}else N&64?L!==8?Y=z():Y=C.type.hydrate(y,C,T,R,M,H,e,m):N&128&&(Y=C.type.hydrate(y,C,T,R,Cd(s(y)),M,H,e,d))}return P!=null&&Ic(P,null,R,C),Y},h=(y,C,T,R,M,H)=>{H=H||!!C.dynamicChildren;const{type:B,props:z,patchFlag:X,shapeFlag:P,dirs:N,transition:I}=C,L=B==="input"||B==="option";if(L||X!==-1){N&&ts(C,null,T,"created");let Y=!1;if(S(y)){Y=q2(null,I)&&T&&T.vnode.props&&T.vnode.props.appear;const le=y.content.firstChild;if(Y){const fe=le.getAttribute("class");fe&&(le.$cls=fe),I.beforeEnter(le)}w(le,y,T),C.el=y=le}if(P&16&&!(z&&(z.innerHTML||z.textContent))){let le=m(y.firstChild,C,y,T,R,M,H);for(;le;){rh(y,1)||Dl();const fe=le;le=le.nextSibling,a(fe)}}else if(P&8){let le=C.children;le[0]===`
|
|
2
|
+
`&&(y.tagName==="PRE"||y.tagName==="TEXTAREA")&&(le=le.slice(1));const{textContent:fe}=y;fe!==le&&fe!==le.replace(/\r\n|\r/g,`
|
|
3
|
+
`)&&(rh(y,0)||Dl(),y.textContent=C.children)}if(z){if(L||!H||X&48){const le=y.tagName.includes("-");for(const fe in z)(L&&(fe.endsWith("value")||fe==="indeterminate")||vc(fe)&&!Aa(fe)||fe[0]==="."||le&&!Aa(fe))&&r(y,fe,null,z[fe],void 0,T)}else if(z.onClick)r(y,"onClick",null,z.onClick,void 0,T);else if(X&4&&_i(z.style))for(const le in z.style)z.style[le]}let te;(te=z&&z.onVnodeBeforeMount)&&Xo(te,T,C),N&&ts(C,null,T,"beforeMount"),((te=z&&z.onVnodeMounted)||N||Y)&&J2(()=>{te&&Xo(te,T,C),Y&&I.enter(y),N&&ts(C,null,T,"mounted")},R)}return y.nextSibling},m=(y,C,T,R,M,H,B)=>{B=B||!!C.dynamicChildren;const z=C.children,X=z.length;for(let P=0;P<X;P++){const N=B?z[P]:z[P]=Yo(z[P]),I=N.type===Fs;y?(I&&!B&&P+1<X&&Yo(z[P+1]).type===Fs&&(l(o(y.data.slice(N.children.length)),T,i(y)),y.data=N.children),y=d(y,N,R,M,H,B)):I&&!N.children?l(N.el=o(""),T):(rh(T,1)||Dl(),n(null,N,T,null,R,M,Cd(T),H))}return y},p=(y,C,T,R,M,H)=>{const{slotScopeIds:B}=C;B&&(M=M?M.concat(B):B);const z=s(y),X=m(i(y),C,z,T,R,M,H);return X&&Pl(X)&&X.data==="]"?i(C.anchor=X):(Dl(),l(C.anchor=u("]"),z,X),X)},g=(y,C,T,R,M,H)=>{if(rh(y.parentElement,1)||Dl(),C.el=null,H){const X=k(y);for(;;){const P=i(y);if(P&&P!==X)a(P);else break}}const B=i(y),z=s(y);return a(y),n(null,C,z,B,T,R,Cd(z),M),T&&(T.vnode.el=C.el,uh(T,C.el)),B},k=(y,C="[",T="]")=>{let R=0;for(;y;)if(y=i(y),y&&Pl(y)&&(y.data===C&&R++,y.data===T)){if(R===0)return i(y);R--}return y},w=(y,C,T)=>{const R=C.parentNode;R&&R.replaceChild(y,C);let M=T;for(;M;)M.vnode.el===C&&(M.vnode.el=M.subTree.el=y),M=M.parent},S=y=>y.nodeType===1&&y.tagName==="TEMPLATE";return[c,d]}function rh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Bg);)e=e.parentElement;const n=e&&e.getAttribute(Bg);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(g1[t])}}function PI(e){const{top:t,left:n,bottom:r,right:o}=e.getBoundingClientRect(),{innerHeight:i,innerWidth:s}=window;return(t>0&&t<i||r>0&&r<i)&&(n>0&&n<s||o>0&&o<s)}function OI(e,t){if(Pl(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Pl(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function I2(e){Qt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,c,d=0;const h=()=>(d++,u=null,m()),m=()=>{let p;return u||(p=u=t().catch(g=>{if(g=g instanceof Error?g:new Error(String(g)),l)return new Promise((k,w)=>{l(g,()=>k(h()),()=>w(g),d+1)});throw g}).then(g=>p!==u&&u?u:(g&&(g.__esModule||g[Symbol.toStringTag]==="Module")&&(g=g.default),c=g,g)))};return Tl({name:"AsyncComponentWrapper",__asyncLoader:m,__asyncHydrate(p,g,k){let w=!1;(g.bu||(g.bu=[])).push(()=>w=!0);const S=()=>{w||k()},y=i?()=>{const C=i(S,T=>OI(p,T));C&&(g.bum||(g.bum=[])).push(C)}:S;c?y():m().then(()=>!g.isUnmounted&&y())},get __asyncResolved(){return c},setup(){const p=to;if(dg(p),c)return()=>oh(c,p);const g=y=>{u=null,xl(y,p,13,!r)};if(a&&p.suspense||Pa)return m().then(y=>()=>oh(y,p)).catch(y=>(g(y),()=>r?Wt(r,{error:y}):null));const k=ne(!1),w=ne(),S=ne(!!o);return o&&setTimeout(()=>{S.value=!1},o),s!=null&&setTimeout(()=>{if(!k.value&&!w.value){const y=new Error(`Async component timed out after ${s}ms.`);g(y),w.value=y}},s),m().then(()=>{k.value=!0,p.parent&&Mc(p.parent.vnode)&&p.parent.update()}).catch(y=>{g(y),w.value=y}),()=>{if(k.value&&c)return oh(c,p);if(w.value&&r)return Wt(r,{error:w.value});if(n&&!S.value)return oh(n,p)}}})}function oh(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=Wt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function ud(e,t){return Rt(e)?e.some(n=>ud(n,t)):Wn(e)?e.split(",").includes(t):Sb(e)?(e.lastIndex=0,e.test(t)):!1}function fg(e,t){E2(e,"a",t)}function hg(e,t){E2(e,"da",t)}function E2(e,t,n=to){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(sh(t,r,n),n){let o=n.parent;for(;o&&o.parent;)Mc(o.parent.vnode)&&FI(r,t,n,o),o=o.parent}}function FI(e,t,n,r){const o=sh(t,e,r,!0);Sd(()=>{Vf(r[t],o)},n)}function pg(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function ih(e){return e.shapeFlag&128?e.ssContent:e}function sh(e,t,n=to,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{As();const a=Ol(n),l=Ai(t,n,e,s);return a(),Is(),l});return r?o.unshift(i):o.push(i),i}}function x2(e,t=to){sh("ec",e,t)}function BI(e,t){return gg(mh,e,!0,t)||e}function mg(e){return Wn(e)?gg(mh,e,!1)||e:e||Vg}function T2(e){return gg(k1,e)}function gg(e,t,n=!0,r=!1){const o=eo||to;if(o){const i=o.type;if(e===mh){const a=Ag(i,!1);if(a&&(a===t||a===Er(t)||a===yc(Er(t))))return i}const s=R2(o[e]||i[e],t)||R2(o.appContext[e],t);return!s&&r?i:s}}function R2(e,t){return e&&(e[t]||e[Er(t)]||e[yc(Er(t))])}function nr(e,t,n,r){let o;const i=n&&n[r],s=Rt(e);if(s||Wn(e)){const a=s&&_i(e);let l=!1,u=!1;a&&(l=!qo(e),u=es(e),e=Wf(e)),o=new Array(e.length);for(let c=0,d=e.length;c<d;c++)o[c]=t(l?u?El(ki(e[c])):ki(e[c]):e[c],c,void 0,i&&i[c])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(An(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];o[l]=t(e[c],c,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function NI(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(Rt(r))for(let o=0;o<r.length;o++)e[r[o].name]=r[o].fn;else r&&(e[r.name]=r.key?(...o)=>{const i=r.fn(...o);return i&&(i.key=r.key),i}:r.fn)}return e}function dd(e,t,n={},r,o){if(eo.ce||eo.parent&&os(eo.parent)&&eo.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),me(),dn(qt,null,[Wt("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),me();const s=i&&vg(i(n)),a=n.key||s&&s.key,l=dn(qt,{key:(a&&!Ko(a)?a:`_${t}`)+(!s&&r?"_fb":"")},s||(r?r():[]),s&&e._===1?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function vg(e){return e.some(t=>Ds(t)?!(t.type===Sr||t.type===qt&&!vg(t.children)):!0)?e:null}function zI(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:bc(r)]=e[r];return n}function HI(){return null}function UI(){return null}function VI(e){}function jI(e){}function GI(){return null}function WI(){}function KI(e,t){return null}function qI(){return L2("useSlots").slots}function M2(){return L2("useAttrs").attrs}function L2(e){const t=or();return t.setupContext||(t.setupContext=s1(t))}function fd(e){return Rt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function YI(e,t){const n=fd(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?Rt(o)||Qt(o)?o=n[r]={type:o,default:t[r]}:o.default=t[r]:o===null&&(o=n[r]={default:t[r]}),o&&t[`__skip_${r}`]&&(o.skipFactory=!0)}return n}function XI(e,t){return!e||!t?e||t:Rt(e)&&Rt(t)?e.concat(t):On({},fd(e),fd(t))}function QI(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function ZI(e){const t=or(),n=Pa;let r=e();Oc(),n&&Pc(!1);const o=()=>{Ol(t),n&&Pc(!0)},i=()=>{or()!==t&&t.scope.off(),Oc(),n&&Pc(!1)};return jf(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function JI(e){const t=yg(e),n=e.proxy,r=e.ctx;bh=!1,t.beforeCreate&&D2(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:c,beforeMount:d,mounted:h,beforeUpdate:m,updated:p,activated:g,deactivated:k,beforeDestroy:w,beforeUnmount:S,destroyed:y,unmounted:C,render:T,renderTracked:R,renderTriggered:M,errorCaptured:H,serverPrefetch:B,expose:z,inheritAttrs:X,components:P,directives:N,filters:I}=t;if(u&&$I(u,r,null),s)for(const te in s){const le=s[te];Qt(le)&&(r[te]=le.bind(n))}if(o){const te=o.call(n,n);An(te)&&(e.data=jr(te))}if(bh=!0,i)for(const te in i){const le=i[te],fe=Ae({get:Qt(le)?le.bind(n,n):Qt(le.get)?le.get.bind(n,n):si,set:!Qt(le)&&Qt(le.set)?le.set.bind(n):si});Object.defineProperty(r,te,{enumerable:!0,configurable:!0,get:()=>fe.value,set:Ne=>fe.value=Ne})}if(a)for(const te in a)P2(a[te],r,n,te);if(l){const te=Qt(l)?l.call(n):l;Reflect.ownKeys(te).forEach(le=>{v2(le,te[le])})}c&&D2(c,e,"c");function Y(te,le){Rt(le)?le.forEach(fe=>te(fe.bind(n))):le&&te(le.bind(n))}if(Y(Ng,d),Y(Rn,h),Y(ph,m),Y(_d,p),Y(fg,g),Y(hg,k),Y(x2,H),Y(Ug,R),Y(Hg,M),Y(rr,S),Y(Sd,C),Y(zg,B),Rt(z))if(z.length){const te=e.exposed||(e.exposed={});z.forEach(le=>{Object.defineProperty(te,le,{get:()=>n[le],set:fe=>n[le]=fe,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===si&&(e.render=T),X!=null&&(e.inheritAttrs=X),P&&(e.components=P),N&&(e.directives=N),B&&dg(e)}function $I(e,t,n=si){Rt(e)&&(e=bg(e));for(const r in e){const o=e[r];let i;An(o)?"default"in o?i=Ea(o.from||r,o.default,!0):i=Ea(o.from||r):i=Ea(o),tr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function D2(e,t,n){Ai(Rt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function P2(e,t,n,r){let o=r.includes(".")?w2(n,r):()=>n[r];if(Wn(e)){const i=t[e];Qt(i)&&Pt(o,i)}else if(Qt(e))Pt(o,e.bind(n));else if(An(e))if(Rt(e))e.forEach(i=>P2(i,t,n,r));else{const i=Qt(e.handler)?e.handler.bind(n):t[e.handler];Qt(i)&&Pt(o,i,e)}}function yg(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>ah(l,u,s,!0)),ah(l,t,s)),An(t)&&i.set(t,l),l}function ah(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&ah(e,i,n,!0),o&&o.forEach(s=>ah(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=I1[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function O2(e,t){return t?e?function(){return On(Qt(e)?e.call(this,this):e,Qt(t)?t.call(this,this):t)}:t:e}function e5(e,t){return hd(bg(e),bg(t))}function bg(e){if(Rt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Fo(e,t){return e?[...new Set([].concat(e,t))]:t}function hd(e,t){return e?On(Object.create(null),e,t):t}function F2(e,t){return e?Rt(e)&&Rt(t)?[...new Set([...e,...t])]:On(Object.create(null),fd(e),fd(t??{})):t}function t5(e,t){if(!e)return t;if(!t)return e;const n=On(Object.create(null),e);for(const r in t)n[r]=Fo(e[r],t[r]);return n}function B2(){return{app:null,config:{isNativeTag:Dm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}function n5(e,t){return function(r,o=null){Qt(r)||(r=On({},r)),o!=null&&!An(o)&&(o=null);const i=B2(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:E1++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:Jg,get config(){return i.config},set config(c){},use(c,...d){return s.has(c)||(c&&Qt(c.install)?(s.add(c),c.install(u,...d)):Qt(c)&&(s.add(c),c(u,...d))),u},mixin(c){return i.mixins.includes(c)||i.mixins.push(c),u},component(c,d){return d?(i.components[c]=d,u):i.components[c]},directive(c,d){return d?(i.directives[c]=d,u):i.directives[c]},mount(c,d,h){if(!l){const m=u._ceVNode||Wt(r,o);return m.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),d&&t?t(m,c):e(m,c,h),l=!0,u._container=c,c.__vue_app__=u,gd(m.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Ai(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(c,d){return i.provides[c]=d,u},runWithContext(c){const d=Ma;Ma=u;try{return c()}finally{Ma=d}}};return u}}function r5(e,t,n=_n){const r=or(),o=Er(t),i=Oo(t),s=jg(e,o),a=jb((l,u)=>{let c,d=_n,h;return b2(()=>{const m=e[o];$r(c,m)&&(c=m,u())}),{get(){return l(),n.get?n.get(c):c},set(m){const p=n.set?n.set(m):m;if(!$r(p,c)&&!(d!==_n&&$r(m,d)))return;const g=r.vnode.props;g&&(t in g||o in g||i in g)&&(`onUpdate:${t}`in g||`onUpdate:${o}`in g||`onUpdate:${i}`in g)||(c=m,u()),r.emit(`update:${t}`,p),$r(m,p)&&$r(m,d)&&!$r(p,h)&&u(),d=m,h=p}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||_n:a,done:!1}:{done:!0}}}},a}function o5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||_n;let o=n;const i=t.startsWith("update:"),s=i&&jg(r,t.slice(7));s&&(s.trim&&(o=n.map(c=>Wn(c)?c.trim():c)),s.number&&(o=n.map(Yu)));let a,l=r[a=bc(t)]||r[a=bc(Er(t))];!l&&i&&(l=r[a=bc(Oo(t))]),l&&Ai(l,e,6,o);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Ai(u,e,6,o)}}function N2(e,t,n=!1){const r=n?x1:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Qt(e)){const l=u=>{const c=N2(u,t,!0);c&&(a=!0,On(s,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(An(e)&&r.set(e,null),null):(Rt(i)?i.forEach(l=>s[l]=null):On(s,i),An(e)&&r.set(e,s),s)}function lh(e,t){return!e||!vc(t)?!1:(t=t.slice(2).replace(/Once$/,""),Tn(e,t[0].toLowerCase()+t.slice(1))||Tn(e,Oo(t))||Tn(e,t))}function ch(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:c,props:d,data:h,setupState:m,ctx:p,inheritAttrs:g}=e,k=ad(e);let w,S;try{if(n.shapeFlag&4){const C=o||r,T=C;w=Yo(u.call(T,C,c,d,m,h,p)),S=a}else{const C=t;w=Yo(C.length>1?C(d,{attrs:a,slots:s,emit:l}):C(d,null)),S=t.props?a:T1(a)}}catch(C){Dc.length=0,xl(C,e,1),w=Wt(Sr)}let y=w;if(S&&g!==!1){const C=Object.keys(S),{shapeFlag:T}=y;C.length&&T&7&&(i&&C.some(Gu)&&(S=R1(S,i)),y=ns(y,S,!1,!0))}return n.dirs&&(y=ns(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&Ls(y,n.transition),w=y,ad(k),w}function i5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(Ds(o)){if(o.type!==Sr||o.children==="v-if"){if(n)return;n=o}}else return}return n}function s5(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?z2(r,s,u):!!s;if(l&8){const c=t.dynamicProps;for(let d=0;d<c.length;d++){const h=c[d];if(H2(s,r,h)&&!lh(u,h))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?z2(r,s,u):!0:!!s;return!1}function z2(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const i=r[o];if(H2(t,e,i)&&!lh(n,i))return!0}return!1}function H2(e,t,n){const r=e[n],o=t[n];return n==="style"&&An(r)&&An(o)?!ks(r,o):r!==o}function uh({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}function a5(e,t,n,r=!1){const o={},i=Wg();e.propsDefaults=Object.create(null),U2(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:Ub(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function l5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=pn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const c=e.vnode.dynamicProps;for(let d=0;d<c.length;d++){let h=c[d];if(lh(e.emitsOptions,h))continue;const m=t[h];if(l)if(Tn(i,h))m!==i[h]&&(i[h]=m,u=!0);else{const p=Er(h);o[p]=wg(l,a,p,m,e,!1)}else m!==i[h]&&(i[h]=m,u=!0)}}}else{U2(e,t,o,i)&&(u=!0);let c;for(const d in a)(!t||!Tn(t,d)&&((c=Oo(d))===d||!Tn(t,c)))&&(l?n&&(n[d]!==void 0||n[c]!==void 0)&&(o[d]=wg(l,a,d,void 0,e,!0)):delete o[d]);if(i!==a)for(const d in i)(!t||!Tn(t,d))&&(delete i[d],u=!0)}u&&Es(e.attrs,"set","")}function U2(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(Aa(l))continue;const u=t[l];let c;o&&Tn(o,c=Er(l))?!i||!i.includes(c)?n[c]=u:(a||(a={}))[c]=u:lh(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=pn(n),u=a||_n;for(let c=0;c<i.length;c++){const d=i[c];n[d]=wg(o,l,d,u[d],e,!Tn(u,d))}}return s}function wg(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=Tn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Qt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const c=Ol(o);r=u[n]=l.call(null,t),c()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===Oo(n))&&(r=!0))}return r}function V2(e,t,n=!1){const r=n?M1:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Qt(e)){const c=d=>{l=!0;const[h,m]=V2(d,t,!0);On(s,h),m&&a.push(...m)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!i&&!l)return An(e)&&r.set(e,Sl),Sl;if(Rt(i))for(let c=0;c<i.length;c++){const d=Er(i[c]);j2(d)&&(s[d]=_n)}else if(i)for(const c in i){const d=Er(c);if(j2(d)){const h=i[c],m=s[d]=Rt(h)||Qt(h)?{type:h}:On({},h),p=m.type;let g=!1,k=!0;if(Rt(p))for(let w=0;w<p.length;++w){const S=p[w],y=Qt(S)&&S.name;if(y==="Boolean"){g=!0;break}else y==="String"&&(k=!1)}else g=Qt(p)&&p.name==="Boolean";m[0]=g,m[1]=k,(g||Tn(m,"default"))&&a.push(d)}}const u=[s,a];return An(e)&&r.set(e,u),u}function j2(e){return e[0]!=="$"&&!Aa(e)}function FU(){}function G2(e){return K2(e)}function W2(e){return K2(e,DI)}function K2(e,t){const n=Qu();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:c,parentNode:d,nextSibling:h,setScopeId:m=si,insertStaticContent:p}=e,g=(J,_,$,F=null,j=null,V=null,G=void 0,Z=null,W=!!_.dynamicChildren)=>{if(J===_)return;J&&!Oi(J,_)&&(F=Ge(J),ge(J,j,V,!0),J=null),_.patchFlag===-2&&(W=!1,_.dynamicChildren=null);const{type:K,ref:ue,shapeFlag:we}=_;switch(K){case Fs:k(J,_,$,F);break;case Sr:w(J,_,$,F);break;case La:J==null&&S(_,$,F,G);break;case qt:P(J,_,$,F,j,V,G,Z,W);break;default:we&1?T(J,_,$,F,j,V,G,Z,W):we&6?N(J,_,$,F,j,V,G,Z,W):(we&64||we&128)&&K.process(J,_,$,F,j,V,G,Z,W,be)}ue!=null&&j?Ic(ue,J&&J.ref,V,_||J,!_):ue==null&&J&&J.ref!=null&&Ic(J.ref,null,V,J,!0)},k=(J,_,$,F)=>{if(J==null)r(_.el=a(_.children),$,F);else{const j=_.el=J.el;_.children!==J.children&&u(j,_.children)}},w=(J,_,$,F)=>{J==null?r(_.el=l(_.children||""),$,F):_.el=J.el},S=(J,_,$,F)=>{[J.el,J.anchor]=p(J.children,_,$,F,J.el,J.anchor)},y=({el:J,anchor:_},$,F)=>{let j;for(;J&&J!==_;)j=h(J),r(J,$,F),J=j;r(_,$,F)},C=({el:J,anchor:_})=>{let $;for(;J&&J!==_;)$=h(J),o(J),J=$;o(_)},T=(J,_,$,F,j,V,G,Z,W)=>{if(_.type==="svg"?G="svg":_.type==="math"&&(G="mathml"),J==null)R(_,$,F,j,V,G,Z,W);else{const K=J.el&&J.el._isVueCE?J.el:null;try{K&&K._beginPatch(),B(J,_,j,V,G,Z,W)}finally{K&&K._endPatch()}}},R=(J,_,$,F,j,V,G,Z)=>{let W,K;const{props:ue,shapeFlag:we,transition:Ce,dirs:xe}=J;if(W=J.el=s(J.type,V,ue&&ue.is,ue),we&8?c(W,J.children):we&16&&H(J.children,W,null,F,j,Cg(J,V),G,Z),xe&&ts(J,null,F,"created"),M(W,J,J.scopeId,G,F),ue){for(const tt in ue)tt!=="value"&&!Aa(tt)&&i(W,tt,null,ue[tt],V,F);"value"in ue&&i(W,"value",null,ue.value,V),(K=ue.onVnodeBeforeMount)&&Xo(K,F,J)}xe&&ts(J,null,F,"beforeMount");const ot=q2(j,Ce);ot&&Ce.beforeEnter(W),r(W,_,$),((K=ue&&ue.onVnodeMounted)||ot||xe)&&xr(()=>{K&&Xo(K,F,J),ot&&Ce.enter(W),xe&&ts(J,null,F,"mounted")},j)},M=(J,_,$,F,j)=>{if($&&m(J,$),F)for(let V=0;V<F.length;V++)m(J,F[V]);if(j){let V=j.subTree;if(_===V||kd(V.type)&&(V.ssContent===_||V.ssFallback===_)){const G=j.vnode;M(J,G,G.scopeId,G.slotScopeIds,j.parent)}}},H=(J,_,$,F,j,V,G,Z,W=0)=>{for(let K=W;K<J.length;K++)g(null,J[K]=Z?Ps(J[K]):Yo(J[K]),_,$,F,j,V,G,Z)},B=(J,_,$,F,j,V,G)=>{const Z=_.el=J.el;let{patchFlag:W,dynamicChildren:K,dirs:ue}=_;W|=J.patchFlag&16;const we=J.props||_n,Ce=_.props||_n;let xe;if($&&Rl($,!1),(xe=Ce.onVnodeBeforeUpdate)&&Xo(xe,$,_,J),ue&&ts(_,J,$,"beforeUpdate"),$&&Rl($,!0),(we.innerHTML&&Ce.innerHTML==null||we.textContent&&Ce.textContent==null)&&c(Z,""),K?z(J.dynamicChildren,K,Z,$,F,Cg(_,j),V):G||le(J,_,Z,null,$,F,Cg(_,j),V,!1),W>0){if(W&16)X(Z,we,Ce,$,j);else if(W&2&&we.class!==Ce.class&&i(Z,"class",null,Ce.class,j),W&4&&i(Z,"style",we.style,Ce.style,j),W&8){const ot=_.dynamicProps;for(let tt=0;tt<ot.length;tt++){const Ct=ot[tt],Kt=we[Ct],pt=Ce[Ct];(pt!==Kt||Ct==="value")&&i(Z,Ct,Kt,pt,j,$)}}W&1&&J.children!==_.children&&c(Z,_.children)}else!G&&K==null&&X(Z,we,Ce,$,j);((xe=Ce.onVnodeUpdated)||ue)&&xr(()=>{xe&&Xo(xe,$,_,J),ue&&ts(_,J,$,"updated")},F)},z=(J,_,$,F,j,V,G)=>{for(let Z=0;Z<_.length;Z++){const W=J[Z],K=_[Z];g(W,K,W.el&&(W.type===qt||!Oi(W,K)||W.shapeFlag&198)?d(W.el):$,null,F,j,V,G,!0)}},X=(J,_,$,F,j)=>{if(_!==$){if(_!==_n)for(const V in _)!Aa(V)&&!(V in $)&&i(J,V,_[V],null,j,F);for(const V in $){if(Aa(V))continue;const G=$[V],Z=_[V];G!==Z&&V!=="value"&&i(J,V,Z,G,j,F)}"value"in $&&i(J,"value",_.value,$.value,j)}},P=(J,_,$,F,j,V,G,Z,W)=>{const K=_.el=J?J.el:a(""),ue=_.anchor=J?J.anchor:a("");let{patchFlag:we,dynamicChildren:Ce,slotScopeIds:xe}=_;xe&&(Z=Z?Z.concat(xe):xe),J==null?(r(K,$,F),r(ue,$,F),H(_.children||[],$,ue,j,V,G,Z,W)):we>0&&we&64&&Ce&&J.dynamicChildren&&J.dynamicChildren.length===Ce.length?(z(J.dynamicChildren,Ce,$,j,V,G,Z),(_.key!=null||j&&_===j.subTree)&&_g(J,_,!0)):le(J,_,$,ue,j,V,G,Z,W)},N=(J,_,$,F,j,V,G,Z,W)=>{_.slotScopeIds=Z,J==null?_.shapeFlag&512?j.ctx.activate(_,$,F,G,W):I(_,$,F,j,V,G,W):L(J,_,W)},I=(J,_,$,F,j,V,G)=>{const Z=J.component=n1(J,F,j);if(Mc(J)&&(Z.ctx.renderer=be),o1(Z,!1,G),Z.asyncDep){if(j&&j.registerDep(Z,Y,G),!J.el){const W=Z.subTree=Wt(Sr);w(null,W,_,$),J.placeholder=W.el}}else Y(Z,J,_,$,j,V,G)},L=(J,_,$)=>{const F=_.component=J.component;if(s5(J,_,$))if(F.asyncDep&&!F.asyncResolved){te(F,_,$);return}else F.next=_,F.update();else _.el=J.el,F.vnode=_},Y=(J,_,$,F,j,V,G)=>{const Z=()=>{if(J.isMounted){let{next:we,bu:Ce,u:xe,parent:ot,vnode:tt}=J;{const zt=Y2(J);if(zt){we&&(we.el=tt.el,te(J,we,G)),zt.asyncDep.then(()=>{xr(()=>{J.isUnmounted||K()},j)});return}}let Ct=we,Kt;Rl(J,!1),we?(we.el=tt.el,te(J,we,G)):we=tt,Ce&&Il(Ce),(Kt=we.props&&we.props.onVnodeBeforeUpdate)&&Xo(Kt,ot,we,tt),Rl(J,!0);const pt=ch(J),Mt=J.subTree;J.subTree=pt,g(Mt,pt,d(Mt.el),Ge(Mt),J,j,V),we.el=pt.el,Ct===null&&uh(J,pt.el),xe&&xr(xe,j),(Kt=we.props&&we.props.onVnodeUpdated)&&xr(()=>Xo(Kt,ot,we,tt),j)}else{let we;const{el:Ce,props:xe}=_,{bm:ot,m:tt,parent:Ct,root:Kt,type:pt}=J,Mt=os(_);if(Rl(J,!1),ot&&Il(ot),!Mt&&(we=xe&&xe.onVnodeBeforeMount)&&Xo(we,Ct,_),Rl(J,!0),Ce&&Le){const zt=()=>{J.subTree=ch(J),Le(Ce,J.subTree,J,j,null)};Mt&&pt.__asyncHydrate?pt.__asyncHydrate(Ce,J,zt):zt()}else{Kt.ce&&Kt.ce._hasShadowRoot()&&Kt.ce._injectChildStyle(pt,J.parent?J.parent.type:void 0);const zt=J.subTree=ch(J);g(null,zt,$,F,J,j,V),_.el=zt.el}if(tt&&xr(tt,j),!Mt&&(we=xe&&xe.onVnodeMounted)){const zt=_;xr(()=>Xo(we,Ct,zt),j)}(_.shapeFlag&256||Ct&&os(Ct.vnode)&&Ct.vnode.shapeFlag&256)&&J.a&&xr(J.a,j),J.isMounted=!0,_=$=F=null}};J.scope.on();const W=J.effect=new Cc(Z);J.scope.off();const K=J.update=W.run.bind(W),ue=J.job=W.runIfDirty.bind(W);ue.i=J,ue.id=J.uid,W.scheduler=()=>ag(ue),Rl(J,!0),K()},te=(J,_,$)=>{_.component=J;const F=J.vnode.props;J.vnode=_,J.next=null,l5(J,_.props,F,$),P1(J,_.children,$),As(),p2(J),Is()},le=(J,_,$,F,j,V,G,Z,W=!1)=>{const K=J&&J.children,ue=J?J.shapeFlag:0,we=_.children,{patchFlag:Ce,shapeFlag:xe}=_;if(Ce>0){if(Ce&128){Ne(K,we,$,F,j,V,G,Z,W);return}else if(Ce&256){fe(K,we,$,F,j,V,G,Z,W);return}}xe&8?(ue&16&&Te(K,j,V),we!==K&&c($,we)):ue&16?xe&16?Ne(K,we,$,F,j,V,G,Z,W):Te(K,j,V,!0):(ue&8&&c($,""),xe&16&&H(we,$,F,j,V,G,Z,W))},fe=(J,_,$,F,j,V,G,Z,W)=>{J=J||Sl,_=_||Sl;const K=J.length,ue=_.length,we=Math.min(K,ue);let Ce;for(Ce=0;Ce<we;Ce++){const xe=_[Ce]=W?Ps(_[Ce]):Yo(_[Ce]);g(J[Ce],xe,$,null,j,V,G,Z,W)}K>ue?Te(J,j,V,!0,!1,we):H(_,$,F,j,V,G,Z,W,we)},Ne=(J,_,$,F,j,V,G,Z,W)=>{let K=0;const ue=_.length;let we=J.length-1,Ce=ue-1;for(;K<=we&&K<=Ce;){const xe=J[K],ot=_[K]=W?Ps(_[K]):Yo(_[K]);if(Oi(xe,ot))g(xe,ot,$,null,j,V,G,Z,W);else break;K++}for(;K<=we&&K<=Ce;){const xe=J[we],ot=_[Ce]=W?Ps(_[Ce]):Yo(_[Ce]);if(Oi(xe,ot))g(xe,ot,$,null,j,V,G,Z,W);else break;we--,Ce--}if(K>we){if(K<=Ce){const xe=Ce+1,ot=xe<ue?_[xe].el:F;for(;K<=Ce;)g(null,_[K]=W?Ps(_[K]):Yo(_[K]),$,ot,j,V,G,Z,W),K++}}else if(K>Ce)for(;K<=we;)ge(J[K],j,V,!0),K++;else{const xe=K,ot=K,tt=new Map;for(K=ot;K<=Ce;K++){const Ht=_[K]=W?Ps(_[K]):Yo(_[K]);Ht.key!=null&&tt.set(Ht.key,K)}let Ct,Kt=0;const pt=Ce-ot+1;let Mt=!1,zt=0;const ln=new Array(pt);for(K=0;K<pt;K++)ln[K]=0;for(K=xe;K<=we;K++){const Ht=J[K];if(Kt>=pt){ge(Ht,j,V,!0);continue}let Ke;if(Ht.key!=null)Ke=tt.get(Ht.key);else for(Ct=ot;Ct<=Ce;Ct++)if(ln[Ct-ot]===0&&Oi(Ht,_[Ct])){Ke=Ct;break}Ke===void 0?ge(Ht,j,V,!0):(ln[Ke-ot]=K+1,Ke>=zt?zt=Ke:Mt=!0,g(Ht,_[Ke],$,null,j,V,G,Z,W),Kt++)}const $n=Mt?c5(ln):Sl;for(Ct=$n.length-1,K=pt-1;K>=0;K--){const Ht=ot+K,Ke=_[Ht],kt=_[Ht+1],Ut=Ht+1<ue?kt.el||X2(kt):F;ln[K]===0?g(null,Ke,$,Ut,j,V,G,Z,W):Mt&&(Ct<0||K!==$n[Ct]?he(Ke,$,Ut,2):Ct--)}}},he=(J,_,$,F,j=null)=>{const{el:V,type:G,transition:Z,children:W,shapeFlag:K}=J;if(K&6){he(J.component.subTree,_,$,F);return}if(K&128){J.suspense.move(_,$,F);return}if(K&64){G.move(J,_,$,be);return}if(G===qt){r(V,_,$);for(let ue=0;ue<W.length;ue++)he(W[ue],_,$,F);r(J.anchor,_,$);return}if(G===La){y(J,_,$);return}if(F!==2&&K&1&&Z)if(F===0)Z.beforeEnter(V),r(V,_,$),xr(()=>Z.enter(V),j);else{const{leave:ue,delayLeave:we,afterLeave:Ce}=Z,xe=()=>{J.ctx.isUnmounted?o(V):r(V,_,$)},ot=()=>{V._isLeaving&&V[Ni](!0),ue(V,()=>{xe(),Ce&&Ce()})};we?we(V,xe,ot):ot()}else r(V,_,$)},ge=(J,_,$,F=!1,j=!1)=>{const{type:V,props:G,ref:Z,children:W,dynamicChildren:K,shapeFlag:ue,patchFlag:we,dirs:Ce,cacheIndex:xe,memo:ot}=J;if(we===-2&&(j=!1),Z!=null&&(As(),Ic(Z,null,$,J,!0),Is()),xe!=null&&(_.renderCache[xe]=void 0),ue&256){_.ctx.deactivate(J);return}const tt=ue&1&&Ce,Ct=!os(J);let Kt;if(Ct&&(Kt=G&&G.onVnodeBeforeUnmount)&&Xo(Kt,_,J),ue&6)oe(J.component,$,F);else{if(ue&128){J.suspense.unmount($,F);return}tt&&ts(J,null,_,"beforeUnmount"),ue&64?J.type.remove(J,_,$,be,F):K&&!K.hasOnce&&(V!==qt||we>0&&we&64)?Te(K,_,$,!1,!0):(V===qt&&we&384||!j&&ue&16)&&Te(W,_,$),F&&ae(J)}const pt=ot!=null&&xe==null;(Ct&&(Kt=G&&G.onVnodeUnmounted)||tt||pt)&&xr(()=>{Kt&&Xo(Kt,_,J),tt&&ts(J,null,_,"unmounted"),pt&&(J.el=null)},$)},ae=J=>{const{type:_,el:$,anchor:F,transition:j}=J;if(_===qt){_e($,F);return}if(_===La){C(J);return}const V=()=>{o($),j&&!j.persisted&&j.afterLeave&&j.afterLeave()};if(J.shapeFlag&1&&j&&!j.persisted){const{leave:G,delayLeave:Z}=j,W=()=>G($,V);Z?Z(J.el,V,W):W()}else V()},_e=(J,_)=>{let $;for(;J!==_;)$=h(J),o(J),J=$;o(_)},oe=(J,_,$)=>{const{bum:F,scope:j,job:V,subTree:G,um:Z,m:W,a:K}=J;dh(W),dh(K),F&&Il(F),j.stop(),V&&(V.flags|=8,ge(G,J,_,$)),Z&&xr(Z,_),xr(()=>{J.isUnmounted=!0},_)},Te=(J,_,$,F=!1,j=!1,V=0)=>{for(let G=V;G<J.length;G++)ge(J[G],_,$,F,j)},Ge=J=>{if(J.shapeFlag&6)return Ge(J.component.subTree);if(J.shapeFlag&128)return J.suspense.next();const _=h(J.anchor||J.el),$=_&&_[Rg];return $?h($):_};let Je=!1;const _t=(J,_,$)=>{let F;J==null?_._vnode&&(ge(_._vnode,null,null,!0),F=_._vnode.component):g(_._vnode||null,J,_,null,null,null,$),_._vnode=J,Je||(Je=!0,p2(F),eh(),Je=!1)},be={p:g,um:ge,m:he,r:ae,mt:I,mc:H,pc:le,pbc:z,n:Ge,o:e};let Ve,Le;return t&&([Ve,Le]=t(be)),{render:_t,hydrate:Ve,createApp:n5(_t,Ve)}}function Cg({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Rl({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function q2(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function _g(e,t,n=!1){const r=e.children,o=t.children;if(Rt(r)&&Rt(o))for(let i=0;i<r.length;i++){const s=r[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=Ps(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&_g(s,a)),a.type===Fs&&(a.patchFlag===-1&&(a=o[i]=Ps(a)),a.el=s.el),a.type===Sr&&!a.el&&(a.el=s.el)}}function c5(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<u?i=a+1:s=a;u<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}function Y2(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Y2(t)}function dh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function X2(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?X2(t.subTree):null}function pd(e,t){const n=e.props&&e.props[t];Qt(n)&&n()}function u5(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:c}}=l,d=c("div"),h=e.suspense=Q2(e,o,r,t,d,n,i,s,a,l);u(null,h.pendingBranch=e.ssContent,d,null,r,h,i,s),h.deps>0?(pd(e,"onPending"),pd(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),Ec(h,e.ssFallback)):h.resolve(!1,!0)}function d5(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:c}}){const d=t.suspense=e.suspense;d.vnode=t,t.el=e.el;const h=t.ssContent,m=t.ssFallback,{activeBranch:p,pendingBranch:g,isInFallback:k,isHydrating:w}=d;if(g)d.pendingBranch=h,Oi(g,h)?(l(g,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0?d.resolve():k&&(w||(l(p,m,n,r,o,null,i,s,a),Ec(d,m)))):(d.pendingId=_h++,w?(d.isHydrating=!1,d.activeBranch=g):u(g,o,d),d.deps=0,d.effects.length=0,d.hiddenContainer=c("div"),k?(l(null,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0?d.resolve():(l(p,m,n,r,o,null,i,s,a),Ec(d,m))):p&&Oi(p,h)?(l(p,h,n,r,o,d,i,s,a),d.resolve(!0)):(l(null,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0&&d.resolve()));else if(p&&Oi(p,h))l(p,h,n,r,o,d,i,s,a),Ec(d,h);else if(pd(t,"onPending"),d.pendingBranch=h,h.shapeFlag&512?d.pendingId=h.component.suspenseId:d.pendingId=_h++,l(null,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0)d.resolve();else{const{timeout:S,pendingId:y}=d;S>0?setTimeout(()=>{d.pendingId===y&&d.fallback(m)},S):S===0&&d.fallback(m)}}function Q2(e,t,n,r,o,i,s,a,l,u,c=!1){const{p:d,m:h,um:m,n:p,o:{parentNode:g,remove:k}}=u;let w;const S=p5(e);S&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const y=e.props?Xu(e.props.timeout):void 0,C=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:_h++,timeout:typeof y=="number"?y:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!c,isHydrating:c,isUnmounted:!1,effects:[],resolve(R=!1,M=!1){const{vnode:H,activeBranch:B,pendingBranch:z,pendingId:X,effects:P,parentComponent:N,container:I,isInFallback:L}=T;let Y=!1;T.isHydrating?T.isHydrating=!1:R||(Y=B&&z.transition&&z.transition.mode==="out-in",Y&&(B.transition.afterLeave=()=>{X===T.pendingId&&(h(z,I,i===C?p(B):i,0),sd(P),L&&H.ssFallback&&(H.ssFallback.el=null))}),B&&!T.isFallbackMountPending&&(g(B.el)===I&&(i=p(B)),m(B,N,T,!0),!Y&&L&&H.ssFallback&&xr(()=>H.ssFallback.el=null,T)),Y||h(z,I,i,0)),T.isFallbackMountPending=!1,Ec(T,z),T.pendingBranch=null,T.isInFallback=!1;let te=T.parent,le=!1;for(;te;){if(te.pendingBranch){te.effects.push(...P),le=!0;break}te=te.parent}!le&&!Y&&sd(P),T.effects=[],S&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!M&&t.resolve()),pd(H,"onResolve")},fallback(R){if(!T.pendingBranch)return;const{vnode:M,activeBranch:H,parentComponent:B,container:z,namespace:X}=T;pd(M,"onFallback");const P=p(H),N=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(d(null,R,z,P,B,null,X,a,l),Ec(T,R))},I=R.transition&&R.transition.mode==="out-in";I&&(T.isFallbackMountPending=!0,H.transition.afterLeave=N),T.isInFallback=!0,m(H,B,null,!0),I||N()},move(R,M,H){T.activeBranch&&h(T.activeBranch,R,M,H),T.container=R},next(){return T.activeBranch&&p(T.activeBranch)},registerDep(R,M,H){const B=!!T.pendingBranch;B&&T.deps++;const z=R.vnode.el;R.asyncDep.catch(X=>{xl(X,R,0)}).then(X=>{if(R.isUnmounted||T.isUnmounted||T.pendingId!==R.suspenseId)return;Oc(),R.asyncResolved=!0;const{vnode:P}=R;kg(R,X,!1),z&&(P.el=z);const N=!z&&R.subTree.el;M(R,P,g(z||R.subTree.el),z?null:p(R.subTree),T,s,H),N&&(P.placeholder=null,k(N)),uh(R,P.el),B&&--T.deps===0&&T.resolve()})},unmount(R,M){T.isUnmounted=!0,T.activeBranch&&m(T.activeBranch,n,R,M),T.pendingBranch&&m(T.pendingBranch,n,R,M)}};return T}function f5(e,t,n,r,o,i,s,a,l){const u=t.suspense=Q2(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),c=l(e,u.pendingBranch=t.ssContent,n,u,i,s);return u.deps===0&&u.resolve(!1,!0),c}function h5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=Z2(r?n.default:n),e.ssFallback=r?Z2(n.fallback):Wt(Sr)}function Z2(e){let t;if(Qt(e)){const n=Da&&e._c;n&&(e._d=!1,me()),e=e(),n&&(e._d=!0,t=ho,$2())}return Rt(e)&&(e=i5(e)),e=Yo(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function J2(e,t){t&&t.pendingBranch?Rt(e)?t.effects.push(...e):t.effects.push(e):sd(e)}function Ec(e,t){e.activeBranch=t;const{vnode:n,parentComponent:r}=e;let o=t.el;for(;!o&&t.component;)t=t.component.subTree,o=t.el;n.el=o,r&&r.subTree===n&&(r.vnode.el=o,uh(r,o))}function p5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function me(e=!1){Dc.push(ho=e?null:[])}function $2(){Dc.pop(),ho=Dc[Dc.length-1]||null}function md(e,t=!1){Da+=e,e<0&&ho&&t&&(ho.hasOnce=!0)}function e1(e){return e.dynamicChildren=Da>0?ho||Sl:null,$2(),Da>0&&ho&&ho.push(e),e}function ke(e,t,n,r,o,i){return e1(Me(e,t,n,r,o,i,!0))}function dn(e,t,n,r,o){return e1(Wt(e,t,n,r,o,!0))}function Ds(e){return e?e.__v_isVNode===!0:!1}function Oi(e,t){return e.type===t.type&&e.key===t.key}function m5(e){}function Me(e,t=null,n=null,r=0,o=null,i=e===qt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Qg(t),ref:t&&Ad(t),scopeId:bd,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:eo};return a?(Sg(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Wn(n)?8:16),Da>0&&!s&&ho&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ho.push(l),l}function g5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Vg)&&(e=Sr),Ds(e)){const a=ns(e,t,!0);return n&&Sg(a,n),Da>0&&!i&&ho&&(a.shapeFlag&6?ho[ho.indexOf(e)]=a:ho.push(a)),a.patchFlag=-2,a}if(w5(e)&&(e=e.__vccOpts),t){t=t1(t);let{class:a,style:l}=t;a&&!Wn(a)&&(t.class=en(a)),An(l)&&(Ju(l)&&!Rt(l)&&(l=On({},l)),t.style=gn(l))}const s=Wn(e)?1:kd(e)?128:Mg(e)?64:An(e)?4:Qt(e)?2:0;return Me(e,t,n,r,o,s,i,!0)}function t1(e){return e?Ju(e)||Kg(e)?On({},e):e:null}function ns(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?rs(o||{},t):o,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Qg(u),ref:t&&t.ref?n&&i?Rt(i)?i.concat(Ad(t)):[i,Ad(t)]:Ad(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==qt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ns(e.ssContent),ssFallback:e.ssFallback&&ns(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ls(c,l.clone(c)),c}function Fi(e=" ",t=0){return Wt(Fs,null,e,t)}function v5(e,t){const n=Wt(La,null,e);return n.staticCount=t,n}function ut(e="",t=!1){return t?(me(),dn(Sr,null,e)):Wt(Sr,null,e)}function Yo(e){return e==null||typeof e=="boolean"?Wt(Sr):Rt(e)?Wt(qt,null,e.slice()):Ds(e)?Ps(e):Wt(Fs,null,String(e))}function Ps(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ns(e)}function Sg(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Rt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Sg(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Kg(t)?t._ctx=eo:o===3&&eo&&(eo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Qt(t)?(t={default:t,_ctx:eo},n=32):(t=String(t),r&64?(n=16,t=[Fi(t)]):n=8);e.children=t,e.shapeFlag|=n}function rs(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=en([t.class,r.class]));else if(o==="style")t.style=gn([t.style,r.style]);else if(vc(o)){const i=t[o],s=r[o];s&&i!==s&&!(Rt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Gu(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function Xo(e,t,n,r=null){Ai(e,t,7,[n,r])}function n1(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||F1,i={uid:B1++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Qf(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:V2(r,o),emitsOptions:N2(r,o),emit:null,emitted:null,propsDefaults:_n,inheritAttrs:r.inheritAttrs,ctx:_n,data:_n,props:_n,attrs:_n,slots:_n,refs:_n,setupState:_n,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=o5.bind(null,i),e.ce&&e.ce(i),i}function r1(e){return e.vnode.shapeFlag&4}function o1(e,t=!1,n=!1){t&&Pc(t);const{props:r,children:o}=e.vnode,i=r1(e);a5(e,r,i,t),D1(e,o,n||t);const s=i?y5(e,t):void 0;return t&&Pc(!1),s}function y5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,yh);const{setup:r}=n;if(r){As();const o=e.setupContext=r.length>1?s1(e):null,i=Ol(e),s=kc(r,e,0,[e.props,o]),a=jf(s);if(Is(),i(),(a||e.sp)&&!os(e)&&dg(e),a){if(s.then(Oc,Oc),t)return s.then(l=>{kg(e,l,t)}).catch(l=>{xl(l,e,0)});e.asyncDep=s}else kg(e,s,t)}else i1(e,t)}function kg(e,t,n){Qt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:An(t)&&(e.setupState=Xm(t)),i1(e,n)}function b5(e){kh=e,Zg=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,A1))}}function i1(e,t,n){const r=e.type;if(!e.render){if(!t&&kh&&!r.render){const o=r.template||yg(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=On(On({isCustomElement:i,delimiters:a},s),l);r.render=kh(o,u)}}e.render=r.render||si,Zg&&Zg(e)}{const o=Ol(e);As();try{JI(e)}finally{Is(),o()}}}function s1(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,z1),slots:e.slots,emit:e.emit,expose:t}}function gd(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Xm(Gr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Lc)return Lc[n](e)},has(t,n){return n in t||n in Lc}})):e.proxy}function Ag(e,t=!0){return Qt(e)?e.displayName||e.name:e.name||t&&e.__name}function w5(e){return Qt(e)&&"__vccOpts"in e}function Dr(e,t,n){try{md(-1);const r=arguments.length;return r===2?An(t)&&!Rt(t)?Ds(t)?Wt(e,null,[t]):Wt(e,t):Wt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ds(n)&&(n=[n]),Wt(e,t,n))}finally{md(1)}}function C5(){return;function e(t,n,r){const o=t[r];if(Rt(o)&&o.includes(n)||An(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function _5(e,t,n,r){const o=n[r];if(o&&a1(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function a1(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if($r(n[r],t[r]))return!1;return Da>0&&ho&&ho.push(e),!0}var Ig,l1,c1,Ao,Bi,Ml,Os,Ll,Eg,vd,xc,Tc,yd,eo,bd,u1,xg,Tg,xa,Rg,Mg,Ta,d1,Lg,Dg,fh,f1,Ra,Ni,Rc,ai,hh,Pg,h1,Og,wd,Fg,Dl,p1,m1,Cd,Pl,Bg,g1,v1,y1,b1,w1,C1,_1,os,Mc,S1,is,Ng,Rn,ph,_d,rr,Sd,zg,Hg,Ug,mh,k1,Vg,gh,Lc,vh,yh,A1,bh,I1,E1,Ma,jg,x1,T1,R1,Gg,Wg,Kg,M1,wh,Ch,L1,qg,Yg,Xg,D1,P1,xr,kd,_h,O1,qt,Fs,Sr,La,Dc,ho,Da,Qg,Ad,Wt,F1,B1,to,or,Sh,Pc,Ol,Oc,Pa,kh,Zg,N1,z1,Ae,Jg,H1,U1,V1,j1,G1,S5,k5,A5,W1=_r((()=>{bI(),Hm(),Ig=[],l1={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},c1={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"},Ao=[],Bi=-1,Ml=[],Os=null,Ll=0,Eg=Promise.resolve(),vd=null,xc=e=>e.id==null?e.flags&2?-1:1/0:e.id,yd=[],eo=null,bd=null,u1=e=>ko,xg=Symbol.for("v-scx"),Tg=()=>{{const e=Ea(xg);return e}},xa=new WeakMap,Rg=Symbol("_vte"),Mg=e=>e.__isTeleport,Ta=e=>e&&(e.disabled||e.disabled===""),d1=e=>e&&(e.defer||e.defer===""),Lg=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Dg=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,fh=(e,t)=>{const n=e&&e.to;return Wn(n)?t?t(n):null:n},f1={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:c,pc:d,pbc:h,o:{insert:m,querySelector:p,createText:g,createComment:k}}=u,w=Ta(t.props);let{dynamicChildren:S}=t;const y=(R,M,H)=>{R.shapeFlag&16&&c(R.children,M,H,o,i,s,a,l)},C=(R=t)=>{const M=Ta(R.props),H=R.target=fh(R.props,p),B=lg(H,R,g,m);H&&(s!=="svg"&&Lg(H)?s="svg":s!=="mathml"&&Dg(H)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(H),M||(y(R,H,B),cd(R,!1)))},T=R=>{const M=()=>{xa.get(R)===M&&(xa.delete(R),Ta(R.props)&&(y(R,n,R.anchor),cd(R,!0)),C(R))};xa.set(R,M),xr(M,i)};if(e==null){const R=t.el=g(""),M=t.anchor=g("");if(m(R,n,r),m(M,n,r),d1(t.props)||i&&i.pendingBranch){T(t);return}w&&(y(t,n,M),cd(t,!0)),C()}else{t.el=e.el;const R=t.anchor=e.anchor,M=xa.get(e);if(M){M.flags|=8,xa.delete(e),T(t);return}t.targetStart=e.targetStart;const H=t.target=e.target,B=t.targetAnchor=e.targetAnchor,z=Ta(e.props),X=z?n:H,P=z?R:B;if(s==="svg"||Lg(H)?s="svg":(s==="mathml"||Dg(H))&&(s="mathml"),S?(h(e.dynamicChildren,S,X,o,i,s,a),_g(e,t,!0)):l||d(e,t,X,P,o,i,s,a,!1),w)z?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):th(t,n,R,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const N=t.target=fh(t.props,p);N&&th(t,N,null,u,0)}else z&&th(t,H,B,u,1);cd(t,w)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:c,target:d,props:h}=e;let m=i||!Ta(h);const p=xa.get(e);if(p&&(p.flags|=8,xa.delete(e),m=!1),d&&(o(u),o(c)),i&&o(l),s&16)for(let g=0;g<a.length;g++){const k=a[g];r(k,t,n,m,!!k.dynamicChildren)}},move:th,hydrate:RI},Ra=f1,Ni=Symbol("_leaveCb"),Rc=Symbol("_enterCb"),ai=[Function,Array],hh={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ai,onEnter:ai,onAfterEnter:ai,onEnterCancelled:ai,onBeforeLeave:ai,onLeave:ai,onAfterLeave:ai,onLeaveCancelled:ai,onBeforeAppear:ai,onAppear:ai,onAfterAppear:ai,onAppearCancelled:ai},Pg=e=>{const t=e.subTree;return t.component?Pg(t.component):t},h1={name:"BaseTransition",props:hh,setup(e,{slots:t}){const n=or(),r=cg();return()=>{const o=t.default&&nh(t.default(),!0);if(!o||!o.length)return;const i=C2(o),s=pn(e),{mode:a}=s;if(r.isLeaving)return ug(i);const l=S2(i);if(!l)return ug(i);let u=Ac(l,s,r,n,d=>u=d);l.type!==Sr&&Ls(l,u);let c=n.subTree&&S2(n.subTree);if(c&&c.type!==Sr&&!Oi(c,l)&&Pg(n).type!==Sr){let d=Ac(c,s,r,n);if(Ls(c,d),a==="out-in"&&l.type!==Sr)return r.isLeaving=!0,d.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,c=void 0},ug(i);a==="in-out"&&l.type!==Sr?d.delayLeave=(h,m,p)=>{const g=_2(r,c);g[String(c.key)]=c,h[Ni]=()=>{m(),h[Ni]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{p(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return i}}},Og=h1,wd=new WeakMap,Fg=!1,Dl=()=>{Fg||(console.error("Hydration completed but contains mismatches."),Fg=!0)},p1=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",m1=e=>e.namespaceURI.includes("MathML"),Cd=e=>{if(e.nodeType===1){if(p1(e))return"svg";if(m1(e))return"mathml"}},Pl=e=>e.nodeType===8,Bg="data-allow-mismatch",g1={0:"text",1:"children",2:"class",3:"style",4:"attribute"},v1=Qu().requestIdleCallback||(e=>setTimeout(e,1)),y1=Qu().cancelIdleCallback||(e=>clearTimeout(e)),b1=(e=1e4)=>t=>{const n=v1(t,{timeout:e});return()=>y1(n)},w1=e=>(t,n)=>{const r=new IntersectionObserver(o=>{for(const i of o)if(i.isIntersecting){r.disconnect(),t();break}},e);return n(o=>{if(o instanceof Element){if(PI(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},C1=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},_1=(e=[])=>(t,n)=>{Wn(e)&&(e=[e]);let r=!1;const o=s=>{r||(r=!0,i(),t(),s.target.dispatchEvent(new s.constructor(s.type,s)))},i=()=>{n(s=>{for(const a of e)s.removeEventListener(a,o)})};return n(s=>{for(const a of e)s.addEventListener(a,o,{once:!0})}),i},os=e=>!!e.type.__asyncLoader,Mc=e=>e.type.__isKeepAlive,S1={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=or(),r=n.ctx;if(!r.renderer)return()=>{const S=t.default&&t.default();return S&&S.length===1?S[0]:S};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:c,o:{createElement:d}}}=r,h=d("div");r.activate=(S,y,C,T,R)=>{const M=S.component;u(S,y,C,0,a),l(M.vnode,S,y,C,M,a,T,S.slotScopeIds,R),xr(()=>{M.isDeactivated=!1,M.a&&Il(M.a);const H=S.props&&S.props.onVnodeMounted;H&&Xo(H,M.parent,S)},a)},r.deactivate=S=>{const y=S.component;dh(y.m),dh(y.a),u(S,h,null,1,a),xr(()=>{y.da&&Il(y.da);const C=S.props&&S.props.onVnodeUnmounted;C&&Xo(C,y.parent,S),y.isDeactivated=!0},a)};function m(S){pg(S),c(S,n,a,!0)}function p(S){o.forEach((y,C)=>{const T=Ag(os(y)?y.type.__asyncResolved||{}:y.type);T&&!S(T)&&g(C)})}function g(S){const y=o.get(S);y&&(!s||!Oi(y,s))?m(y):s&&pg(s),o.delete(S),i.delete(S)}Pt(()=>[e.include,e.exclude],([S,y])=>{S&&p(C=>ud(S,C)),y&&p(C=>!ud(y,C))},{flush:"post",deep:!0});let k=null;const w=()=>{k!=null&&(kd(n.subTree.type)?xr(()=>{o.set(k,ih(n.subTree))},n.subTree.suspense):o.set(k,ih(n.subTree)))};return Rn(w),_d(w),rr(()=>{o.forEach(S=>{const{subTree:y,suspense:C}=n,T=ih(y);if(S.type===T.type&&S.key===T.key){pg(T);const R=T.component.da;R&&xr(R,C);return}m(S)})}),()=>{if(k=null,!t.default)return s=null;const S=t.default(),y=S[0];if(S.length>1)return s=null,S;if(!Ds(y)||!(y.shapeFlag&4)&&!(y.shapeFlag&128))return s=null,y;let C=ih(y);if(C.type===Sr)return s=null,C;const T=C.type,R=Ag(os(C)?C.type.__asyncResolved||{}:T),{include:M,exclude:H,max:B}=e;if(M&&(!R||!ud(M,R))||H&&R&&ud(H,R))return C.shapeFlag&=-257,s=C,y;const z=C.key==null?T:C.key,X=o.get(z);return C.el&&(C=ns(C),y.shapeFlag&128&&(y.ssContent=C)),k=z,X?(C.el=X.el,C.component=X.component,C.transition&&Ls(C,C.transition),C.shapeFlag|=512,i.delete(z),i.add(z)):(i.add(z),B&&i.size>parseInt(B,10)&&g(i.values().next().value)),C.shapeFlag|=256,s=C,kd(y.type)?y:C}}},is=e=>(t,n=to)=>{(!Pa||e==="sp")&&sh(e,(...r)=>t(...r),n)},Ng=is("bm"),Rn=is("m"),ph=is("bu"),_d=is("u"),rr=is("bum"),Sd=is("um"),zg=is("sp"),Hg=is("rtg"),Ug=is("rtc"),mh="components",k1="directives",Vg=Symbol.for("v-ndc"),gh=e=>e?r1(e)?gd(e):gh(e.parent):null,Lc=On(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>gh(e.parent),$root:e=>gh(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>yg(e),$forceUpdate:e=>e.f||(e.f=()=>{ag(e.update)}),$nextTick:e=>e.n||(e.n=St.bind(e.proxy)),$watch:e=>TI.bind(e)}),vh=(e,t)=>e!==_n&&!e.__isScriptSetup&&Tn(e,t),yh={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if(t[0]!=="$"){const h=s[t];if(h!==void 0)switch(h){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(vh(r,t))return s[t]=1,r[t];if(o!==_n&&Tn(o,t))return s[t]=2,o[t];if(Tn(i,t))return s[t]=3,i[t];if(n!==_n&&Tn(n,t))return s[t]=4,n[t];bh&&(s[t]=0)}}const u=Lc[t];let c,d;if(u)return t==="$attrs"&&_o(e.attrs,"get",""),u(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==_n&&Tn(n,t))return s[t]=4,n[t];if(d=l.config.globalProperties,Tn(d,t))return d[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return vh(o,t)?(o[t]=n,!0):r!==_n&&Tn(r,t)?(r[t]=n,!0):Tn(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:i,type:s}},a){let l;return!!(n[a]||e!==_n&&a[0]!=="$"&&Tn(e,a)||vh(t,a)||Tn(i,a)||Tn(r,a)||Tn(Lc,a)||Tn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Tn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},A1=On({},yh,{get(e,t){if(t!==Symbol.unscopables)return yh.get(e,t,e)},has(e,t){return t[0]!=="_"&&!xb(t)}}),bh=!0,I1={data:O2,props:F2,emits:F2,methods:hd,computed:hd,beforeCreate:Fo,created:Fo,beforeMount:Fo,mounted:Fo,beforeUpdate:Fo,updated:Fo,beforeDestroy:Fo,beforeUnmount:Fo,destroyed:Fo,unmounted:Fo,activated:Fo,deactivated:Fo,errorCaptured:Fo,serverPrefetch:Fo,components:hd,directives:hd,watch:t5,provide:O2,inject:e5},E1=0,Ma=null,jg=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Er(t)}Modifiers`]||e[`${Oo(t)}Modifiers`],x1=new WeakMap,T1=e=>{let t;for(const n in e)(n==="class"||n==="style"||vc(n))&&((t||(t={}))[n]=e[n]);return t},R1=(e,t)=>{const n={};for(const r in e)(!Gu(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},Gg={},Wg=()=>Object.create(Gg),Kg=e=>Object.getPrototypeOf(e)===Gg,M1=new WeakMap,wh=e=>e==="_"||e==="_ctx"||e==="$stable",Ch=e=>Rt(e)?e.map(Yo):[Yo(e)],L1=(e,t,n)=>{if(t._n)return t;const r=ko((...o)=>Ch(t(...o)),n);return r._c=!1,r},qg=(e,t,n)=>{const r=e._ctx;for(const o in e){if(wh(o))continue;const i=e[o];if(Qt(i))t[o]=L1(o,i,r);else if(i!=null){const s=Ch(i);t[o]=()=>s}}},Yg=(e,t)=>{const n=Ch(t);e.slots.default=()=>n},Xg=(e,t,n)=>{for(const r in t)(n||!wh(r))&&(e[r]=t[r])},D1=(e,t,n)=>{const r=e.slots=Wg();if(e.vnode.shapeFlag&32){const o=t._;o?(Xg(r,t,n),n&&Fm(r,"_",o,!0)):qg(t,r)}else t&&Yg(e,t)},P1=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=_n;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Xg(o,t,n):(i=!t.$stable,qg(t,o)),s=t}else t&&(Yg(e,t),s={default:1});if(i)for(const a in o)!wh(a)&&s[a]==null&&delete o[a]},xr=J2,kd=e=>e.__isSuspense,_h=0,O1={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)u5(t,n,r,o,i,s,a,l,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}d5(e,t,n,r,o,s,a,l,u)}},hydrate:f5,normalize:h5},qt=Symbol.for("v-fgt"),Fs=Symbol.for("v-txt"),Sr=Symbol.for("v-cmt"),La=Symbol.for("v-stc"),Dc=[],ho=null,Da=1,Qg=({key:e})=>e??null,Ad=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Wn(e)||tr(e)||Qt(e)?{i:eo,r:e,k:t,f:!!n}:e:null),Wt=g5,F1=B2(),B1=0,to=null,or=()=>to||eo;{const e=Qu(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};Sh=t("__VUE_INSTANCE_SETTERS__",n=>to=n),Pc=t("__VUE_SSR_SETTERS__",n=>Pa=n)}Ol=e=>{const t=to;return Sh(e),e.scope.on(),()=>{e.scope.off(),Sh(t)}},Oc=()=>{to&&to.scope.off(),Sh(null)},Pa=!1,N1=()=>!kh,z1={get(e,t){return _o(e,"get",""),e[t]}},Ae=(e,t)=>gI(e,t,Pa),Jg="3.5.32",H1=si,U1=c1,V1=Tc,j1=g2,G1={createComponentInstance:n1,setupComponent:o1,renderComponentRoot:ch,setCurrentRenderingInstance:ad,isVNode:Ds,normalizeVNode:Yo,getComponentPublicInstance:gd,ensureValidVNode:vg,pushWarningContext:wI,popWarningContext:CI},S5=null,k5=null,A5=null}));function K1(e){const t={};for(const P in e)P in sv||(t[P]=e[P]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:c=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=e,p=I5(o),g=p&&p[0],k=p&&p[1],{onBeforeEnter:w,onEnter:S,onEnterCancelled:y,onLeave:C,onLeaveCancelled:T,onBeforeAppear:R=w,onAppear:M=S,onAppearCancelled:H=y}=t,B=(P,N,I,L)=>{P._enterCancelled=L,Oa(P,N?c:a),Oa(P,N?u:s),I&&I()},z=(P,N)=>{P._isLeaving=!1,Oa(P,d),Oa(P,m),Oa(P,h),N&&N()},X=P=>(N,I)=>{const L=P?M:S,Y=()=>B(N,P,I);Fa(L,[N,Y]),q1(()=>{Oa(N,P?l:i),ss(N,P?c:a),lv(L)||Y1(N,r,g,Y)})};return On(t,{onBeforeEnter(P){Fa(w,[P]),ss(P,i),ss(P,s)},onBeforeAppear(P){Fa(R,[P]),ss(P,l),ss(P,u)},onEnter:X(!1),onAppear:X(!0),onLeave(P,N){P._isLeaving=!0;const I=()=>z(P,N);ss(P,d),P._enterCancelled?(ss(P,h),ev(P)):(ev(P),ss(P,h)),q1(()=>{P._isLeaving&&(Oa(P,d),ss(P,m),lv(C)||Y1(P,r,k,I))}),Fa(C,[P,I])},onEnterCancelled(P){B(P,!1,void 0,!0),Fa(y,[P])},onAppearCancelled(P){B(P,!0,void 0,!0),Fa(H,[P])},onLeaveCancelled(P){z(P),Fa(T,[P])}})}function I5(e){if(e==null)return null;if(An(e))return[$g(e.enter),$g(e.leave)];{const t=$g(e);return[t,t]}}function $g(e){return Xu(e)}function ss(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Fl]||(e[Fl]=new Set)).add(t)}function Oa(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Fl];n&&(n.delete(t),n.size||(e[Fl]=void 0))}function q1(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function Y1(e,t,n,r){const o=e._endId=++gw,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=X1(e,t);if(!s)return r();const u=s+"end";let c=0;const d=()=>{e.removeEventListener(u,h),i()},h=m=>{m.target===e&&++c>=l&&d()};setTimeout(()=>{c<l&&d()},a+1),e.addEventListener(u,h)}function X1(e,t){const n=window.getComputedStyle(e),r=p=>(n[p]||"").split(", "),o=r(`${Ns}Delay`),i=r(`${Ns}Duration`),s=Q1(o,i),a=r(`${Bc}Delay`),l=r(`${Bc}Duration`),u=Q1(a,l);let c=null,d=0,h=0;t===Ns?s>0&&(c=Ns,d=s,h=i.length):t===Bc?u>0&&(c=Bc,d=u,h=l.length):(d=Math.max(s,u),c=d>0?s>u?Ns:Bc:null,h=c?c===Ns?i.length:l.length:0);const m=c===Ns&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ns}Property`).toString());return{type:c,timeout:d,propCount:h,hasTransform:m}}function Q1(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Z1(n)+Z1(e[r])))}function Z1(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ev(e){return(e?e.ownerDocument:document).body.offsetHeight}function E5(e,t,n){const r=e[Fl];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Id(e,t){e.style.display=t?e[Ed]:"none",e[cv]=!t}function x5(){uv.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function T5(e){const t=or();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Ah(i,o))},r=()=>{const o=e(t.proxy);t.ce?Ah(t.ce,o):tv(t.subTree,o),n(o)};ph(()=>{sd(r)}),Rn(()=>{Pt(r,si,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),Sd(()=>o.disconnect())})}function tv(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{tv(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Ah(e.el,t);else if(e.type===qt)e.children.forEach(n=>tv(n,t));else if(e.type===La){let{el:n,anchor:r}=e;for(;n&&(Ah(n,t),n!==r);)n=n.nextSibling}}function Ah(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=nI(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[dv]=r}}function R5(e,t,n){const r=e.style,o=Wn(n);let i=!1;if(n&&!o){if(t)if(Wn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&Ih(r,a,"")}else for(const s in t)n[s]==null&&Ih(r,s,"");for(const s in n)s==="display"&&(i=!0),Ih(r,s,n[s])}else if(o){if(t!==n){const s=r[dv];s&&(n+=";"+s),r.cssText=n,i=vw.test(n)}}else t&&e.removeAttribute("style");Ed in e&&(e[Ed]=i?r.display:"",e[cv]&&(r.display="none"))}function Ih(e,t,n){if(Rt(n))n.forEach(r=>Ih(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=M5(e,t);fv.test(n)?e.setProperty(Oo(r),n.replace(fv,""),"important"):e[r]=n}}function M5(e,t){const n=Rh[t];if(n)return n;let r=Er(t);if(r!=="filter"&&r in e)return Rh[t]=r;r=yc(r);for(let o=0;o<hv.length;o++){const i=hv[o]+r;if(i in e)return Rh[t]=i}return t}function J1(e,t,n,r,o,i=Lb(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(pv,t.slice(6,t.length)):e.setAttributeNS(pv,t,n):n==null||i&&!Cb(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Ko(n)?String(n):n)}function $1(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?rv(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Cb(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function Bs(e,t,n,r){e.addEventListener(t,n,r)}function L5(e,t,n,r){e.removeEventListener(t,n,r)}function D5(e,t,n,r,o=null){const i=e[mv]||(e[mv]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=P5(t);r?Bs(e,a,i[t]=O5(r,o),l):s&&(L5(e,a,s,l),i[t]=void 0)}}function P5(e){let t;if(gv.test(e)){t={};let n;for(;n=e.match(gv);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Oo(e.slice(2)),t]}function O5(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Ai(F5(r,n.value),t,5,[r])};return n.value=e,n.attached=bw(),n}function F5(e,t){if(Rt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}function B5(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&vv(t)&&Qt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return vv(t)&&Wn(n)?!1:t in e}function N5(e,t){const n=e._def.props;if(!n)return!1;const r=Er(t);return Array.isArray(n)?n.some(o=>Er(o)===r):Object.keys(n).some(o=>Er(o)===r)}function ew(e,t,n){let r=Tl(e,t);Wu(r)&&(r=On({},r,t));class o extends wv{constructor(s){super(r,s,n)}}return o.def=r,o}function tw(e){const t=or(),n=t&&t.ce;return n||null}function z5(){const e=tw();return e&&e.shadowRoot}function H5(e="$style"){{const t=or();if(!t)return _n;const n=t.type.__cssModules;if(!n)return _n;const r=n[e];return r||_n}}function U5(e){const t=e.el;t[xd]&&t[xd](),t[Sv]&&t[Sv]()}function V5(e){_v.set(e,nw(e.el))}function j5(e){const t=Cv.get(e),n=_v.get(e),r=t.left-n.left,o=t.top-n.top;if(r||o){const i=e.el,s=i.style,a=i.getBoundingClientRect();let l=1,u=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(u=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/u}px)`,s.transitionDuration="0s",e}}function nw(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function G5(e,t,n){const r=e.cloneNode(),o=e[Fl];o&&o.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),n.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(r);const{hasTransform:s}=X1(r);return i.removeChild(r),s}function W5(e){e.target.composing=!0}function rw(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function ow(e,t,n){return t&&(e=e.trim()),n&&(e=Yu(e)),e}function iw(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Rt(t))o=Uf(t,r.props.value)>-1;else if(ka(t))o=t.has(r.props.value);else{if(t===n)return;o=ks(t,aw(e,!0))}e.checked!==o&&(e.checked=o)}function sw(e,t){const n=e.multiple,r=Rt(t);if(!(n&&!r&&!ka(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Fc(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=Uf(t,a)>-1}else s.selected=t.has(a);else if(ks(Fc(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Fc(e){return"_value"in e?e._value:e.value}function aw(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function lw(e,t){switch(e){case"SELECT":return kv;case"TEXTAREA":return Ii;default:switch(t){case"checkbox":return Lh;case"radio":return Dh;default:return Ii}}}function Eh(e,t,n,r,o){const i=lw(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function K5(){Ii.getSSRProps=({value:e})=>({value:e}),Dh.getSSRProps=({value:e},t)=>{if(t.props&&ks(t.props.value,e))return{checked:!0}},Lh.getSSRProps=({value:e},t)=>{if(Rt(e)){if(t.props&&Uf(e,t.props.value)>-1)return{checked:!0}}else if(ka(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Av.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=lw(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function cw(){return Td||(Td=G2(Iv))}function uw(){return Td=Ev?Td:W2(Iv),Ev=!0,Td}function dw(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function fw(e){return Wn(e)?document.querySelector(e):e}var xh,nv,rv,hw,pw,as,ov,iv,Ns,Bc,Fl,sv,av,mw,Th,Fa,lv,gw,Ed,cv,uv,dv,vw,fv,hv,Rh,pv,mv,gv,Mh,yw,bw,vv,yv,bv,ww,Cw,wv,Cv,_v,xd,Sv,_w,Sw,zs,li,Ii,Lh,Dh,kv,Av,kw,Aw,Jt,Iw,Qo,Iv,Td,Ev,xv,Ew,Bl,Tv,Rv,xw,q5=_r((()=>{if(W1(),W1(),Hm(),xh=void 0,nv=typeof window<"u"&&window.trustedTypes,nv)try{xh=nv.createPolicy("vue",{createHTML:e=>e})}catch{}rv=xh?e=>xh.createHTML(e):e=>e,hw="http://www.w3.org/2000/svg",pw="http://www.w3.org/1998/Math/MathML",as=typeof document<"u"?document:null,ov=as&&as.createElement("template"),iv={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?as.createElementNS(hw,e):t==="mathml"?as.createElementNS(pw,e):n?as.createElement(e,{is:n}):as.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>as.createTextNode(e),createComment:e=>as.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>as.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,i){const s=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===i||!(o=o.nextSibling)););else{ov.innerHTML=rv(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=ov.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ns="transition",Bc="animation",Fl=Symbol("_vtc"),sv={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},av=On({},hh,sv),mw=e=>(e.displayName="Transition",e.props=av,e),Th=mw((e,{slots:t})=>Dr(Og,K1(e),t)),Fa=(e,t=[])=>{Rt(e)?e.forEach(n=>n(...t)):e&&e(...t)},lv=e=>e?Rt(e)?e.some(t=>t.length>1):e.length>1:!1,gw=0,Ed=Symbol("_vod"),cv=Symbol("_vsh"),uv={name:"show",beforeMount(e,{value:t},{transition:n}){e[Ed]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Id(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Id(e,!0),r.enter(e)):r.leave(e,()=>{Id(e,!1)}):Id(e,t))},beforeUnmount(e,{value:t}){Id(e,t)}},dv=Symbol(""),vw=/(?:^|;)\s*display\s*:/,fv=/\s*!important$/,hv=["Webkit","Moz","ms"],Rh={},pv="http://www.w3.org/1999/xlink",mv=Symbol("_vei"),gv=/(?:Once|Passive|Capture)$/,Mh=0,yw=Promise.resolve(),bw=()=>Mh||(yw.then(()=>Mh=0),Mh=Date.now()),vv=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,yv=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?E5(e,r,s):t==="style"?R5(e,n,r):vc(t)?Gu(t)||D5(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):B5(e,t,r,s))?($1(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&J1(e,t,r,s,i,t!=="value")):e._isVueCE&&(N5(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Wn(r)))?$1(e,Er(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),J1(e,t,r,s))},bv={},ww=((e,t)=>ew(e,t,Tv)),Cw=typeof HTMLElement<"u"?HTMLElement:class{},wv=class MA extends Cw{constructor(t,n={},r=Bl){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&r!==Bl?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(On({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof MA){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,St(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,o=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:s}=r;let a;if(i&&!Rt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=Xu(this._props[l])),(a||(a=Object.create(null)))[Er(l)]=!0)}this._numberProps=a,this._resolveProps(r),this.shadowRoot&&this._applyStyles(s),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)Tn(this,r)||Object.defineProperty(this,r,{get:()=>We(n[r])})}_resolveProps(t){const{props:n}=t,r=Rt(n)?n:Object.keys(n||{});for(const o of Object.keys(this))o[0]!=="_"&&r.includes(o)&&this._setProp(o,this[o]);for(const o of r.map(Er))Object.defineProperty(this,o,{get(){return this._getProp(o)},set(i){this._setProp(o,i,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):bv;const o=Er(t);n&&this._numberProps&&this._numberProps[o]&&(r=Xu(r)),this._setProp(o,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,o=!1){if(n!==this._props[t]&&(this._dirty=!0,n===bv?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),o&&this._instance&&this._update(),r)){const i=this._ob;i&&(this._processMutations(i.takeRecords()),i.disconnect()),n===!0?this.setAttribute(Oo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Oo(t),n+""):n||this.removeAttribute(Oo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),xv(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=Wt(this._def,On(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const o=(i,s)=>{this.dispatchEvent(new CustomEvent(i,Wu(s[0])?On({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Oo(i)!==i&&o(Oo(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",c=document.createTreeWalker(l,1);l.setAttribute(u,"");let d;for(;d=c.nextNode();)d.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},Cv=new WeakMap,_v=new WeakMap,xd=Symbol("_moveCb"),Sv=Symbol("_enterCb"),_w=e=>(delete e.props.mode,e),Sw=_w({name:"TransitionGroup",props:On({},av,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=or(),r=cg();let o,i;return _d(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!G5(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(U5),o.forEach(V5);const a=o.filter(j5);ev(n.vnode.el),a.forEach(l=>{const u=l.el,c=u.style;ss(u,s),c.transform=c.webkitTransform=c.transitionDuration="";const d=u[xd]=h=>{h&&h.target!==u||(!h||h.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",d),u[xd]=null,Oa(u,s))};u.addEventListener("transitionend",d)}),o=[]}),()=>{const s=pn(e),a=K1(s);let l=s.tag||qt;if(o=[],i)for(let u=0;u<i.length;u++){const c=i[u];c.el&&c.el instanceof Element&&(o.push(c),Ls(c,Ac(c,a,r,n)),Cv.set(c,nw(c.el)))}i=t.default?nh(t.default()):[];for(let u=0;u<i.length;u++){const c=i[u];c.key!=null&&Ls(c,Ac(c,a,r,n))}return Wt(l,null,i)}}}),zs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Rt(t)?n=>Il(t,n):t},li=Symbol("_assign"),Ii={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[li]=zs(o);const i=r||o.props&&o.props.type==="number";Bs(e,t?"change":"input",s=>{s.target.composing||e[li](ow(e.value,n,i))}),(n||i)&&Bs(e,"change",()=>{e.value=ow(e.value,n,i)}),t||(Bs(e,"compositionstart",W5),Bs(e,"compositionend",rw),Bs(e,"change",rw))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[li]=zs(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Yu(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Lh={deep:!0,created(e,t,n){e[li]=zs(n),Bs(e,"change",()=>{const r=e._modelValue,o=Fc(e),i=e.checked,s=e[li];if(Rt(r)){const a=Uf(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const u=[...r];u.splice(a,1),s(u)}}else if(ka(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(aw(e,i))})},mounted:iw,beforeUpdate(e,t,n){e[li]=zs(n),iw(e,t,n)}},Dh={created(e,{value:t},n){e.checked=ks(t,n.props.value),e[li]=zs(n),Bs(e,"change",()=>{e[li](Fc(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[li]=zs(r),t!==n&&(e.checked=ks(t,r.props.value))}},kv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=ka(t);Bs(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?Yu(Fc(s)):Fc(s));e[li](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,St(()=>{e._assigning=!1})}),e[li]=zs(r)},mounted(e,{value:t}){sw(e,t)},beforeUpdate(e,t,n){e[li]=zs(n)},updated(e,{value:t}){e._assigning||sw(e,t)}},Av={created(e,t,n){Eh(e,t,n,null,"created")},mounted(e,t,n){Eh(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){Eh(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){Eh(e,t,n,r,"updated")}},kw=["ctrl","shift","alt","meta"],Aw={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>kw.some(n=>e[`${n}Key`]&&!t.includes(n))},Jt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...i)=>{for(let s=0;s<t.length;s++){const a=Aw[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},Iw={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Qo=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Oo(o.key);if(t.some(s=>s===i||Iw[s]===i))return e(o)}))},Iv=On({patchProp:yv},iv),Ev=!1,xv=((...e)=>{cw().render(...e)}),Ew=((...e)=>{uw().hydrate(...e)}),Bl=((...e)=>{const t=cw().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=fw(r);if(!o)return;const i=t._component;!Qt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,dw(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),Tv=((...e)=>{const t=uw().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=fw(r);if(o)return n(o,!0,dw(o))},t}),Rv=!1,xw=()=>{Rv||(Rv=!0,K5(),x5())}})),Y5=Vu({BaseTransition:()=>Og,BaseTransitionPropsValidators:()=>hh,Comment:()=>Sr,DeprecationTypes:()=>null,EffectScope:()=>Qf,ErrorCodes:()=>l1,ErrorTypeStrings:()=>U1,Fragment:()=>qt,KeepAlive:()=>S1,ReactiveEffect:()=>Cc,Static:()=>La,Suspense:()=>O1,Teleport:()=>Ra,Text:()=>Fs,TrackOpTypes:()=>d2,Transition:()=>Th,TransitionGroup:()=>Sw,TriggerOpTypes:()=>f2,VueElement:()=>wv,assertNumber:()=>_I,callWithAsyncErrorHandling:()=>Ai,callWithErrorHandling:()=>kc,camelize:()=>Er,capitalize:()=>yc,cloneVNode:()=>ns,compatUtils:()=>null,compile:()=>Tw,computed:()=>Ae,createApp:()=>Bl,createBlock:()=>dn,createCommentVNode:()=>ut,createElementBlock:()=>ke,createElementVNode:()=>Me,createHydrationRenderer:()=>W2,createPropsRestProxy:()=>QI,createRenderer:()=>G2,createSSRApp:()=>Tv,createSlots:()=>NI,createStaticVNode:()=>v5,createTextVNode:()=>Fi,createVNode:()=>Wt,customRef:()=>jb,defineAsyncComponent:()=>I2,defineComponent:()=>Tl,defineCustomElement:()=>ew,defineEmits:()=>UI,defineExpose:()=>VI,defineModel:()=>WI,defineOptions:()=>jI,defineProps:()=>HI,defineSSRCustomElement:()=>ww,defineSlots:()=>GI,devtools:()=>V1,effect:()=>iI,effectScope:()=>Um,getCurrentInstance:()=>or,getCurrentScope:()=>Vm,getCurrentWatcher:()=>vI,getTransitionRawChildren:()=>nh,guardReactiveProps:()=>t1,h:()=>Dr,handleError:()=>xl,hasInjectionContext:()=>y2,hydrate:()=>Ew,hydrateOnIdle:()=>b1,hydrateOnInteraction:()=>_1,hydrateOnMediaQuery:()=>C1,hydrateOnVisible:()=>w1,initCustomFormatter:()=>C5,initDirectivesForSSR:()=>xw,inject:()=>Ea,isMemoSame:()=>a1,isProxy:()=>Ju,isReactive:()=>_i,isReadonly:()=>es,isRef:()=>tr,isRuntimeOnly:()=>N1,isShallow:()=>qo,isVNode:()=>Ds,markRaw:()=>Gr,mergeDefaults:()=>YI,mergeModels:()=>XI,mergeProps:()=>rs,nextTick:()=>St,nodeOps:()=>iv,normalizeClass:()=>en,normalizeProps:()=>Lm,normalizeStyle:()=>gn,onActivated:()=>fg,onBeforeMount:()=>Ng,onBeforeUnmount:()=>rr,onBeforeUpdate:()=>ph,onDeactivated:()=>hg,onErrorCaptured:()=>x2,onMounted:()=>Rn,onRenderTracked:()=>Ug,onRenderTriggered:()=>Hg,onScopeDispose:()=>Db,onServerPrefetch:()=>zg,onUnmounted:()=>Sd,onUpdated:()=>_d,onWatcherCleanup:()=>Kb,openBlock:()=>me,patchProp:()=>yv,popScopeId:()=>II,provide:()=>v2,proxyRefs:()=>Xm,pushScopeId:()=>AI,queuePostFlushCb:()=>sd,reactive:()=>jr,readonly:()=>Yf,ref:()=>ne,registerRuntimeCompiler:()=>b5,render:()=>xv,renderList:()=>nr,renderSlot:()=>dd,resolveComponent:()=>BI,resolveDirective:()=>T2,resolveDynamicComponent:()=>mg,resolveFilter:()=>null,resolveTransitionHooks:()=>Ac,setBlockTracking:()=>md,setDevtoolsHook:()=>j1,setTransitionHooks:()=>Ls,shallowReactive:()=>Ub,shallowReadonly:()=>hI,shallowRef:()=>Wr,ssrContextKey:()=>xg,ssrUtils:()=>G1,stop:()=>sI,toDisplayString:()=>Nt,toHandlerKey:()=>bc,toHandlers:()=>zI,toRaw:()=>pn,toRef:()=>Qm,toRefs:()=>Gb,toValue:()=>mI,transformVNodeArgs:()=>m5,triggerRef:()=>pI,unref:()=>We,useAttrs:()=>M2,useCssModule:()=>H5,useCssVars:()=>T5,useHost:()=>tw,useId:()=>MI,useModel:()=>r5,useSSRContext:()=>Tg,useShadowRoot:()=>z5,useSlots:()=>qI,useTemplateRef:()=>LI,useTransitionState:()=>cg,vModelCheckbox:()=>Lh,vModelDynamic:()=>Av,vModelRadio:()=>Dh,vModelSelect:()=>kv,vModelText:()=>Ii,vShow:()=>uv,version:()=>Jg,warn:()=>H1,watch:()=>Pt,watchEffect:()=>EI,watchPostEffect:()=>xI,watchSyncEffect:()=>b2,withAsyncContext:()=>ZI,withCtx:()=>ko,withDefaults:()=>KI,withDirectives:()=>Ms,withKeys:()=>Qo,withMemo:()=>_5,withModifiers:()=>Jt,withScopeId:()=>u1},1),Tw,It=_r((()=>{q5(),Tw=()=>{}})),X5=yb(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,c){if(!o[u]){if(!r[u]){var d=typeof require=="function"&&require;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var m=o[u]={exports:{}};r[u][0].call(m.exports,function(p){var g=r[u][1][p];return s(g||p)},m,m.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,c,d,h,m,p,g,k=[],w=0,S=l.length,y=S,C=i.getTypeOf(l)!=="string";w<l.length;)y=S-w,d=C?(u=l[w++],c=w<S?l[w++]:0,w<S?l[w++]:0):(u=l.charCodeAt(w++),c=w<S?l.charCodeAt(w++):0,w<S?l.charCodeAt(w++):0),h=u>>2,m=(3&u)<<4|c>>4,p=1<y?(15&c)<<2|d>>6:64,g=2<y?63&d:64,k.push(a.charAt(h)+a.charAt(m)+a.charAt(p)+a.charAt(g));return k.join("")},o.decode=function(l){var u,c,d,h,m,p,g=0,k=0,w="data:";if(l.substr(0,w.length)===w)throw new Error("Invalid base64 input, it looks like a data url.");var S,y=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&y--,l.charAt(l.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=s.uint8array?new Uint8Array(0|y):new Array(0|y);g<l.length;)u=a.indexOf(l.charAt(g++))<<2|(h=a.indexOf(l.charAt(g++)))>>4,c=(15&h)<<4|(m=a.indexOf(l.charAt(g++)))>>2,d=(3&m)<<6|(p=a.indexOf(l.charAt(g++))),S[k++]=u,m!==64&&(S[k++]=c),p!==64&&(S[k++]=d);return S}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(c,d,h,m,p){this.compressedSize=c,this.uncompressedSize=d,this.crc32=h,this.compression=m,this.compressedContent=p}u.prototype={getContentWorker:function(){var c=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,h){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,c,d,h){var m=s,p=h+d;u^=-1;for(var g=h;g<p;g++)u=u>>>8^m[255&(u^c[g])];return-1^u})(0|l,a,a.length,0):(function(u,c,d,h){var m=s,p=h+d;u^=-1;for(var g=h;g<p;g++)u=u>>>8^m[255&(u^c.charCodeAt(g))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function c(d,h){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=h,this.meta={}}o.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(h){d.push({data:h,meta:d.meta})}},o.compressWorker=function(d){return new c("Deflate",d)},o.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(m,p){var g,k="";for(g=0;g<p;g++)k+=String.fromCharCode(255&m),m>>>=8;return k}function s(m,p,g,k,w,S){var y,C,T=m.file,R=m.compression,M=S!==u.utf8encode,H=a.transformTo("string",S(T.name)),B=a.transformTo("string",u.utf8encode(T.name)),z=T.comment,X=a.transformTo("string",S(z)),P=a.transformTo("string",u.utf8encode(z)),N=B.length!==T.name.length,I=P.length!==z.length,L="",Y="",te="",le=T.dir,fe=T.date,Ne={crc32:0,compressedSize:0,uncompressedSize:0};p&&!g||(Ne.crc32=m.crc32,Ne.compressedSize=m.compressedSize,Ne.uncompressedSize=m.uncompressedSize);var he=0;p&&(he|=8),M||!N&&!I||(he|=2048);var ge=0,ae=0;le&&(ge|=16),w==="UNIX"?(ae=798,ge|=(function(oe,Te){var Ge=oe;return oe||(Ge=Te?16893:33204),(65535&Ge)<<16})(T.unixPermissions,le)):(ae=20,ge|=(function(oe){return 63&(oe||0)})(T.dosPermissions)),y=fe.getUTCHours(),y<<=6,y|=fe.getUTCMinutes(),y<<=5,y|=fe.getUTCSeconds()/2,C=fe.getUTCFullYear()-1980,C<<=4,C|=fe.getUTCMonth()+1,C<<=5,C|=fe.getUTCDate(),N&&(Y=i(1,1)+i(c(H),4)+B,L+="up"+i(Y.length,2)+Y),I&&(te=i(1,1)+i(c(X),4)+P,L+="uc"+i(te.length,2)+te);var _e="";return _e+=`
|
|
4
|
+
\0`,_e+=i(he,2),_e+=R.magic,_e+=i(y,2),_e+=i(C,2),_e+=i(Ne.crc32,4),_e+=i(Ne.compressedSize,4),_e+=i(Ne.uncompressedSize,4),_e+=i(H.length,2),_e+=i(L.length,2),{fileRecord:d.LOCAL_FILE_HEADER+_e+H+L,dirRecord:d.CENTRAL_FILE_HEADER+i(ae,2)+_e+i(X.length,2)+"\0\0\0\0"+i(ge,4)+i(k,4)+H+L+X}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),c=n("../crc32"),d=n("../signature");function h(m,p,g,k){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=g,this.encodeFileName=k,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(m){var p=m.meta.percent||0,g=this.entriesCount,k=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,l.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:g?(p+100*(g-k-1))/g:100}}))},h.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var p=this.streamFiles&&!m.file.dir;if(p){var g=s(m,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(m){this.accumulate=!1;var p=this.streamFiles&&!m.file.dir,g=s(m,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),p)this.push({data:(function(k){return d.DATA_DESCRIPTOR+i(k.crc32,4)+i(k.compressedSize,4)+i(k.uncompressedSize,4)})(m),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var m=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var g=this.bytesWritten-m,k=(function(w,S,y,C,T){var R=a.transformTo("string",T(C));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(S,4)+i(y,4)+i(R.length,2)+R})(this.dirRecords.length,g,m,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(m){this._sources.push(m);var p=this;return m.on("data",function(g){p.processChunk(g)}),m.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),m.on("error",function(g){p.error(g)}),this},h.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(m){var p=this._sources;if(!l.prototype.error.call(this,m))return!1;for(var g=0;g<p.length;g++)try{p[g].error(m)}catch{}return!0},h.prototype.lock=function(){l.prototype.lock.call(this);for(var m=this._sources,p=0;p<m.length;p++)m[p].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var c=new s(l.streamFiles,u,l.platform,l.encodeFileName),d=0;try{a.forEach(function(h,m){d++;var p=(function(S,y){var C=S||y,T=i[C];if(!T)throw new Error(C+" is not a valid compression method !");return T})(m.options.compression,l.compression),g=m.options.compressionOptions||l.compressionOptions||{},k=m.dir,w=m.date;m._compressWorker(p,g).withStreamInfo("file",{name:h,dir:k,date:w,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(c)}),c.entriesCount=d}catch(h){c.error(h)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),c=n("./nodejsUtils");function d(h){return new s.Promise(function(m,p){var g=h.decompressed.getContentWorker().pipe(new u);g.on("error",function(k){p(k)}).on("end",function(){g.streamInfo.crc32!==h.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}r.exports=function(h,m){var p=this;return m=i.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(h)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",h,!0,m.optimizedBinaryString,m.base64).then(function(g){var k=new l(m);return k.load(g),k}).then(function(g){var k=[s.Promise.resolve(g)],w=g.files;if(m.checkCRC32)for(var S=0;S<w.length;S++)k.push(d(w[S]));return s.Promise.all(k)}).then(function(g){for(var k=g.shift(),w=k.files,S=0;S<w.length;S++){var y=w[S],C=y.fileNameStr,T=i.resolve(y.fileNameStr);p.file(T,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:m.createFolders}),y.dir||(p.file(T).unsafeOriginalName=C)}return k.zipComment.length&&(p.comment=k.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(c){u.push({data:c,meta:{percent:0}})}).on("error",function(c){u.isPaused?this.generatedError=c:u.error(c)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var c=this;a.on("data",function(d,h){c.push(d)||c._helper.pause(),u&&u(h)}).on("error",function(d){c.emit("error",d)}).on("end",function(){c.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(C,T,R){var M,H=a.getTypeOf(T),B=a.extend(R||{},c);B.date=B.date||new Date,B.compression!==null&&(B.compression=B.compression.toUpperCase()),typeof B.unixPermissions=="string"&&(B.unixPermissions=parseInt(B.unixPermissions,8)),B.unixPermissions&&16384&B.unixPermissions&&(B.dir=!0),B.dosPermissions&&16&B.dosPermissions&&(B.dir=!0),B.dir&&(C=w(C)),B.createFolders&&(M=k(C))&&S.call(this,M,!0);var z=H==="string"&&B.binary===!1&&B.base64===!1;R&&R.binary!==void 0||(B.binary=!z),(T instanceof d&&T.uncompressedSize===0||B.dir||!T||T.length===0)&&(B.base64=!1,B.binary=!0,T="",B.compression="STORE",H="string");var X=null;X=T instanceof d||T instanceof l?T:p.isNode&&p.isStream(T)?new g(C,T):a.prepareContent(C,T,B.binary,B.optimizedBinaryString,B.base64);var P=new h(C,X,B);this.files[C]=P}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),c=n("./defaults"),d=n("./compressedObject"),h=n("./zipObject"),m=n("./generate"),p=n("./nodejsUtils"),g=n("./nodejs/NodejsStreamInputAdapter"),k=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var T=C.lastIndexOf("/");return 0<T?C.substring(0,T):""},w=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},S=function(C,T){return T=T!==void 0?T:c.createFolders,C=w(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:T}),this.files[C]};function y(C){return Object.prototype.toString.call(C)==="[object RegExp]"}r.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var T,R,M;for(T in this.files)M=this.files[T],(R=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&C(R,M)},filter:function(C){var T=[];return this.forEach(function(R,M){C(R,M)&&T.push(M)}),T},file:function(C,T,R){if(arguments.length!==1)return C=this.root+C,i.call(this,C,T,R),this;if(y(C)){var M=C;return this.filter(function(B,z){return!z.dir&&M.test(B)})}var H=this.files[this.root+C];return H&&!H.dir?H:null},folder:function(C){if(!C)return this;if(y(C))return this.filter(function(H,B){return B.dir&&C.test(H)});var T=this.root+C,R=S.call(this,T),M=this.clone();return M.root=R.name,M},remove:function(C){C=this.root+C;var T=this.files[C];if(T||(C.slice(-1)!=="/"&&(C+="/"),T=this.files[C]),T&&!T.dir)delete this.files[C];else for(var R=this.filter(function(H,B){return B.name.slice(0,C.length)===C}),M=0;M<R.length;M++)delete this.files[R[M].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var T,R={};try{if((R=a.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=R.type.toLowerCase(),R.compression=R.compression.toUpperCase(),R.type==="binarystring"&&(R.type="string"),!R.type)throw new Error("No output type specified.");a.checkSupport(R.type),R.platform!=="darwin"&&R.platform!=="freebsd"&&R.platform!=="linux"&&R.platform!=="sunos"||(R.platform="UNIX"),R.platform==="win32"&&(R.platform="DOS");var M=R.comment||this.comment||"";T=m.generateWorker(this,R,M)}catch(H){(T=new l("error")).error(H)}return new u(T,R.type||"string",R.mimeType)},generateAsync:function(C,T){return this.generateInternalStream(C).accumulate(T)},generateNodeStream:function(C,T){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(T)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),c=a.charCodeAt(2),d=a.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===l&&this.data[h+1]===u&&this.data[h+2]===c&&this.data[h+3]===d)return h-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),c=a.charCodeAt(2),d=a.charCodeAt(3),h=this.readData(4);return l===h[0]&&u===h[1]&&c===h[2]&&d===h[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),c=n("./Uint8ArrayReader");r.exports=function(d){var h=i.getTypeOf(d);return i.checkSupport(h),h!=="string"||s.uint8array?h==="nodebuffer"?new u(d):s.uint8array?new c(i.transformTo("uint8array",d)):new a(i.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=i.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),c=n("../external"),d=null;if(u.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(p,g){return new c.Promise(function(k,w){var S=[],y=p._internalType,C=p._outputType,T=p._mimeType;p.on("data",function(R,M){S.push(R),g&&g(M)}).on("error",function(R){S=[],w(R)}).on("end",function(){try{k((function(R,M,H){switch(R){case"blob":return i.newBlob(i.transformTo("arraybuffer",M),H);case"base64":return l.encode(M);default:return i.transformTo(R,M)}})(C,(function(R,M){var H,B=0,z=null,X=0;for(H=0;H<M.length;H++)X+=M[H].length;switch(R){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(z=new Uint8Array(X),H=0;H<M.length;H++)z.set(M[H],B),B+=M[H].length;return z;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+R+"'")}})(y,S),T))}catch(R){w(R)}S=[]}).resume()})}function m(p,g,k){var w=g;switch(g){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=g,this._mimeType=k,i.checkSupport(w),this._worker=p.pipe(new s(w)),p.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}m.prototype={accumulate:function(p){return h(this,p)},on:function(p,g){var k=this;return p==="data"?this._worker.on(p,function(w){g.call(k,w.data,w.meta)}):this._worker.on(p,function(){i.delay(g,arguments,k)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},p)}},r.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}o.utf8encode=function(m){return s.nodebuffer?a.newBufferFrom(m,"utf-8"):(function(p){var g,k,w,S,y,C=p.length,T=0;for(S=0;S<C;S++)(64512&(k=p.charCodeAt(S)))==55296&&S+1<C&&(64512&(w=p.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(w-56320),S++),T+=k<128?1:k<2048?2:k<65536?3:4;for(g=s.uint8array?new Uint8Array(T):new Array(T),S=y=0;y<T;S++)(64512&(k=p.charCodeAt(S)))==55296&&S+1<C&&(64512&(w=p.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(w-56320),S++),k<128?g[y++]=k:(k<2048?g[y++]=192|k>>>6:(k<65536?g[y++]=224|k>>>12:(g[y++]=240|k>>>18,g[y++]=128|k>>>12&63),g[y++]=128|k>>>6&63),g[y++]=128|63&k);return g})(m)},o.utf8decode=function(m){return s.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):(function(p){var g,k,w,S,y=p.length,C=new Array(2*y);for(g=k=0;g<y;)if((w=p[g++])<128)C[k++]=w;else if(4<(S=u[w]))C[k++]=65533,g+=S-1;else{for(w&=S===2?31:S===3?15:7;1<S&&g<y;)w=w<<6|63&p[g++],S--;1<S?C[k++]=65533:w<65536?C[k++]=w:(w-=65536,C[k++]=55296|w>>10&1023,C[k++]=56320|1023&w)}return C.length!==k&&(C.subarray?C=C.subarray(0,k):C.length=k),i.applyFromCharCode(C)})(m=i.transformTo(s.uint8array?"uint8array":"array",m))},i.inherits(d,l),d.prototype.processChunk=function(m){var p=i.transformTo(s.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var g=p;(p=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),p.set(g,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var k=(function(S,y){var C;for((y=y||S.length)>S.length&&(y=S.length),C=y-1;0<=C&&(192&S[C])==128;)C--;return C<0||C===0?y:C+u[S[C]]>y?C:y})(p),w=p;k!==p.length&&(s.uint8array?(w=p.subarray(0,k),this.leftOver=p.subarray(k,p.length)):(w=p.slice(0,k),this.leftOver=p.slice(k,p.length))),this.push({data:o.utf8decode(w),meta:m.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,i.inherits(h,l),h.prototype.processChunk=function(m){this.push({data:o.utf8encode(m.data),meta:m.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(g){return g}function c(g,k){for(var w=0;w<g.length;++w)k[w]=255&g.charCodeAt(w);return k}n("setimmediate"),o.newBlob=function(g,k){o.checkSupport("blob");try{return new Blob([g],{type:k})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(g),w.getBlob(k)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(g,k,w){var S=[],y=0,C=g.length;if(C<=w)return String.fromCharCode.apply(null,g);for(;y<C;)k==="array"||k==="nodebuffer"?S.push(String.fromCharCode.apply(null,g.slice(y,Math.min(y+w,C)))):S.push(String.fromCharCode.apply(null,g.subarray(y,Math.min(y+w,C)))),y+=w;return S.join("")},stringifyByChar:function(g){for(var k="",w=0;w<g.length;w++)k+=String.fromCharCode(g[w]);return k},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function h(g){var k=65536,w=o.getTypeOf(g),S=!0;if(w==="uint8array"?S=d.applyCanBeUsed.uint8array:w==="nodebuffer"&&(S=d.applyCanBeUsed.nodebuffer),S)for(;1<k;)try{return d.stringifyByChunk(g,w,k)}catch{k=Math.floor(k/2)}return d.stringifyByChar(g)}function m(g,k){for(var w=0;w<g.length;w++)k[w]=g[w];return k}o.applyFromCharCode=h;var p={};p.string={string:u,array:function(g){return c(g,new Array(g.length))},arraybuffer:function(g){return p.string.uint8array(g).buffer},uint8array:function(g){return c(g,new Uint8Array(g.length))},nodebuffer:function(g){return c(g,a.allocBuffer(g.length))}},p.array={string:h,array:u,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return a.newBufferFrom(g)}},p.arraybuffer={string:function(g){return h(new Uint8Array(g))},array:function(g){return m(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:u,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return a.newBufferFrom(new Uint8Array(g))}},p.uint8array={string:h,array:function(g){return m(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:u,nodebuffer:function(g){return a.newBufferFrom(g)}},p.nodebuffer={string:h,array:function(g){return m(g,new Array(g.length))},arraybuffer:function(g){return p.nodebuffer.uint8array(g).buffer},uint8array:function(g){return m(g,new Uint8Array(g.length))},nodebuffer:u},o.transformTo=function(g,k){return k=k||"",g?(o.checkSupport(g),p[o.getTypeOf(k)][g](k)):k},o.resolve=function(g){for(var k=g.split("/"),w=[],S=0;S<k.length;S++){var y=k[S];y==="."||y===""&&S!==0&&S!==k.length-1||(y===".."?w.pop():w.push(y))}return w.join("/")},o.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(g)?"nodebuffer":i.uint8array&&g instanceof Uint8Array?"uint8array":i.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(g){if(!i[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(g){var k,w,S="";for(w=0;w<(g||"").length;w++)S+="\\x"+((k=g.charCodeAt(w))<16?"0":"")+k.toString(16).toUpperCase();return S},o.delay=function(g,k,w){setImmediate(function(){g.apply(w||null,k||[])})},o.inherits=function(g,k){function w(){}w.prototype=k.prototype,g.prototype=new w},o.extend=function(){var g,k,w={};for(g=0;g<arguments.length;g++)for(k in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],k)&&w[k]===void 0&&(w[k]=arguments[g][k]);return w},o.prepareContent=function(g,k,w,S,y){return l.Promise.resolve(k).then(function(C){return i.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,R){var M=new FileReader;M.onload=function(H){T(H.target.result)},M.onerror=function(H){R(H.target.error)},M.readAsArrayBuffer(C)}):C}).then(function(C){var T=o.getTypeOf(C);return T?(T==="arraybuffer"?C=o.transformTo("uint8array",C):T==="string"&&(y?C=s.decode(C):w&&S!==!0&&(C=(function(R){return c(R,i.uint8array?new Uint8Array(R.length):new Array(R.length))})(C))),C):l.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function c(d){this.files=[],this.loadOptions=d}c.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(h)+", expected "+s.pretty(d)+")")}},isSignature:function(d,h){var m=this.reader.index;this.reader.setIndex(d);var p=this.reader.readString(4)===h;return this.reader.setIndex(m),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",m=s.transformTo(h,d);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,h,m,p=this.zip64EndOfCentralSize-44;0<p;)d=this.reader.readInt(2),h=this.reader.readInt(4),m=this.reader.readData(h),this.zip64ExtensibleData[d]={id:d,length:h,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,h;for(d=0;d<this.files.length;d++)h=this.files[d],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var h=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var p=h-m;if(0<p)this.isSignature(h,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(d){this.reader=i(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),c=n("./compressions"),d=n("./support");function h(m,p){this.options=m,this.loadOptions=p}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var p,g;if(m.skip(22),this.fileNameLength=m.readInt(2),g=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=(function(k){for(var w in c)if(Object.prototype.hasOwnProperty.call(c,w)&&c[w].magic===k)return c[w];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var p=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(p),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var p,g,k,w=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<w;)p=m.readInt(2),g=m.readInt(2),k=m.readData(g),this.extraFields[p]={id:p,length:g,value:k};m.setIndex(w)},handleUTF8:function(){var m=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var g=s.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var k=this.findExtraFieldUnicodeComment();if(k!==null)this.fileCommentStr=k;else{var w=s.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var p=i(m.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var p=i(m.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(m.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(p,g,k){this.name=p,this.dir=k.dir,this.date=k.date,this.comment=k.comment,this.unixPermissions=k.unixPermissions,this.dosPermissions=k.dosPermissions,this._data=g,this._dataBinary=k.binary,this.options={compression:k.compression,compressionOptions:k.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),c=n("./stream/GenericWorker");i.prototype={internalStream:function(p){var g=null,k="string";try{if(!p)throw new Error("No output type specified.");var w=(k=p.toLowerCase())==="string"||k==="text";k!=="binarystring"&&k!=="text"||(k="string"),g=this._decompressWorker();var S=!this._dataBinary;S&&!w&&(g=g.pipe(new l.Utf8EncodeWorker)),!S&&w&&(g=g.pipe(new l.Utf8DecodeWorker))}catch(y){(g=new c("error")).error(y)}return new s(g,k,"")},async:function(p,g){return this.internalStream(p).accumulate(g)},nodeStream:function(p,g){return this.internalStream(p||"nodebuffer").toNodejsStream(g)},_compressWorker:function(p,g){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var k=this._decompressWorker();return this._dataBinary||(k=k.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(k,p,g)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<d.length;m++)i.prototype[d[m]]=h;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,c=new l(p),d=i.document.createTextNode("");c.observe(d,{characterData:!0}),s=function(){d.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var g=i.document.createElement("script");g.onreadystatechange=function(){p(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},i.document.documentElement.appendChild(g)}:function(){setTimeout(p,0)};else{var h=new i.MessageChannel;h.port1.onmessage=p,s=function(){h.port2.postMessage(0)}}var m=[];function p(){var g,k;a=!0;for(var w=m.length;w;){for(k=m,m=[],g=-1;++g<w;)k[g]();w=m.length}a=!1}r.exports=function(g){m.push(g)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function d(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,w!==s&&g(this,w)}function h(w,S,y){this.promise=w,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function m(w,S,y){i(function(){var C;try{C=S(y)}catch(T){return a.reject(w,T)}C===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,C)})}function p(w){var S=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof S=="function")return function(){S.apply(w,arguments)}}function g(w,S){var y=!1;function C(M){y||(y=!0,a.reject(w,M))}function T(M){y||(y=!0,a.resolve(w,M))}var R=k(function(){S(T,C)});R.status==="error"&&C(R.value)}function k(w,S){var y={};try{y.value=w(S),y.status="success"}catch(C){y.status="error",y.value=C}return y}(r.exports=d).prototype.finally=function(w){if(typeof w!="function")return this;var S=this.constructor;return this.then(function(y){return S.resolve(w()).then(function(){return y})},function(y){return S.resolve(w()).then(function(){throw y})})},d.prototype.catch=function(w){return this.then(null,w)},d.prototype.then=function(w,S){if(typeof w!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var y=new this.constructor(s);return this.state!==c?m(y,this.state===u?w:S,this.outcome):this.queue.push(new h(y,w,S)),y},h.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},h.prototype.otherCallFulfilled=function(w){m(this.promise,this.onFulfilled,w)},h.prototype.callRejected=function(w){a.reject(this.promise,w)},h.prototype.otherCallRejected=function(w){m(this.promise,this.onRejected,w)},a.resolve=function(w,S){var y=k(p,S);if(y.status==="error")return a.reject(w,y.value);var C=y.value;if(C)g(w,C);else{w.state=u,w.outcome=S;for(var T=-1,R=w.queue.length;++T<R;)w.queue[T].callFulfilled(S)}return w},a.reject=function(w,S){w.state=l,w.outcome=S;for(var y=-1,C=w.queue.length;++y<C;)w.queue[y].callRejected(S);return w},d.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},d.reject=function(w){var S=new this(s);return a.reject(S,w)},d.all=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,C=!1;if(!y)return this.resolve([]);for(var T=new Array(y),R=0,M=-1,H=new this(s);++M<y;)B(w[M],M);return H;function B(z,X){S.resolve(z).then(function(P){T[X]=P,++R!==y||C||(C=!0,a.resolve(H,T))},function(P){C||(C=!0,a.reject(H,P))})}},d.race=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,C=!1;if(!y)return this.resolve([]);for(var T=-1,R=new this(s);++T<y;)M=w[T],S.resolve(M).then(function(H){C||(C=!0,a.resolve(R,H))},function(H){C||(C=!0,a.reject(R,H))});var M;return R}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),c=Object.prototype.toString,d=0,h=-1,m=0,p=8;function g(w){if(!(this instanceof g))return new g(w);this.options=s.assign({level:h,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},w||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(y!==d)throw new Error(l[y]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var C;if(C=typeof S.dictionary=="string"?a.string2buf(S.dictionary):c.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(y=i.deflateSetDictionary(this.strm,C))!==d)throw new Error(l[y]);this._dict_set=!0}}function k(w,S){var y=new g(S);if(y.push(w,!0),y.err)throw y.msg||l[y.err];return y.result}g.prototype.push=function(w,S){var y,C,T=this.strm,R=this.options.chunkSize;if(this.ended)return!1;C=S===~~S?S:S===!0?4:0,typeof w=="string"?T.input=a.string2buf(w):c.call(w)==="[object ArrayBuffer]"?T.input=new Uint8Array(w):T.input=w,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(R),T.next_out=0,T.avail_out=R),(y=i.deflate(T,C))!==1&&y!==d)return this.onEnd(y),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&y!==1);return C===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===d):C!==2||(this.onEnd(d),!(T.avail_out=0))},g.prototype.onData=function(w){this.chunks.push(w)},g.prototype.onEnd=function(w){w===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=g,o.deflate=k,o.deflateRaw=function(w,S){return(S=S||{}).raw=!0,k(w,S)},o.gzip=function(w,S){return(S=S||{}).gzip=!0,k(w,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),c=n("./zlib/zstream"),d=n("./zlib/gzheader"),h=Object.prototype.toString;function m(g){if(!(this instanceof m))return new m(g);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},g||{});var k=this.options;k.raw&&0<=k.windowBits&&k.windowBits<16&&(k.windowBits=-k.windowBits,k.windowBits===0&&(k.windowBits=-15)),!(0<=k.windowBits&&k.windowBits<16)||g&&g.windowBits||(k.windowBits+=32),15<k.windowBits&&k.windowBits<48&&(15&k.windowBits)==0&&(k.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,k.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new d,i.inflateGetHeader(this.strm,this.header)}function p(g,k){var w=new m(k);if(w.push(g,!0),w.err)throw w.msg||u[w.err];return w.result}m.prototype.push=function(g,k){var w,S,y,C,T,R,M=this.strm,H=this.options.chunkSize,B=this.options.dictionary,z=!1;if(this.ended)return!1;S=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof g=="string"?M.input=a.binstring2buf(g):h.call(g)==="[object ArrayBuffer]"?M.input=new Uint8Array(g):M.input=g,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new s.Buf8(H),M.next_out=0,M.avail_out=H),(w=i.inflate(M,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&B&&(R=typeof B=="string"?a.string2buf(B):h.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,w=i.inflateSetDictionary(this.strm,R)),w===l.Z_BUF_ERROR&&z===!0&&(w=l.Z_OK,z=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&w!==l.Z_STREAM_END&&(M.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(M.output,M.next_out),C=M.next_out-y,T=a.buf2string(M.output,y),M.next_out=C,M.avail_out=H-C,C&&s.arraySet(M.output,M.output,y,C,0),this.onData(T)):this.onData(s.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(z=!0)}while((0<M.avail_in||M.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(M.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Inflate=m,o.inflate=p,o.inflateRaw=function(g,k){return(k=k||{}).raw=!0,p(g,k)},o.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var c=u.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(l[d]=c[d])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,c,d,h){if(u.subarray&&l.subarray)l.set(u.subarray(c,c+d),h);else for(var m=0;m<d;m++)l[h+m]=u[c+m]},flattenChunks:function(l){var u,c,d,h,m,p;for(u=d=0,c=l.length;u<c;u++)d+=l[u].length;for(p=new Uint8Array(d),u=h=0,c=l.length;u<c;u++)m=l[u],p.set(m,h),h+=m.length;return p}},a={arraySet:function(l,u,c,d,h){for(var m=0;m<d;m++)l[h+m]=u[c+m]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function c(d,h){if(h<65537&&(d.subarray&&a||!d.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(d,h));for(var m="",p=0;p<h;p++)m+=String.fromCharCode(d[p]);return m}l[254]=l[254]=1,o.string2buf=function(d){var h,m,p,g,k,w=d.length,S=0;for(g=0;g<w;g++)(64512&(m=d.charCodeAt(g)))==55296&&g+1<w&&(64512&(p=d.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),g++),S+=m<128?1:m<2048?2:m<65536?3:4;for(h=new i.Buf8(S),g=k=0;k<S;g++)(64512&(m=d.charCodeAt(g)))==55296&&g+1<w&&(64512&(p=d.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),g++),m<128?h[k++]=m:(m<2048?h[k++]=192|m>>>6:(m<65536?h[k++]=224|m>>>12:(h[k++]=240|m>>>18,h[k++]=128|m>>>12&63),h[k++]=128|m>>>6&63),h[k++]=128|63&m);return h},o.buf2binstring=function(d){return c(d,d.length)},o.binstring2buf=function(d){for(var h=new i.Buf8(d.length),m=0,p=h.length;m<p;m++)h[m]=d.charCodeAt(m);return h},o.buf2string=function(d,h){var m,p,g,k,w=h||d.length,S=new Array(2*w);for(m=p=0;m<w;)if((g=d[m++])<128)S[p++]=g;else if(4<(k=l[g]))S[p++]=65533,m+=k-1;else{for(g&=k===2?31:k===3?15:7;1<k&&m<w;)g=g<<6|63&d[m++],k--;1<k?S[p++]=65533:g<65536?S[p++]=g:(g-=65536,S[p++]=55296|g>>10&1023,S[p++]=56320|1023&g)}return c(S,p)},o.utf8border=function(d,h){var m;for((h=h||d.length)>d.length&&(h=d.length),m=h-1;0<=m&&(192&d[m])==128;)m--;return m<0||m===0?h:m+l[d[m]]>h?m:h}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,c=i>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;c=c+(u=u+s[l++]|0)|0,--d;);u%=65521,c%=65521}return u|c<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var c=i,d=u+l;s^=-1;for(var h=u;h<d;h++)s=s>>>8^c[255&(s^a[h])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),c=n("./messages"),d=0,h=4,m=0,p=-2,g=-1,k=4,w=2,S=8,y=9,C=286,T=30,R=19,M=2*C+1,H=15,B=3,z=258,X=z+B+1,P=42,N=113,I=1,L=2,Y=3,te=4;function le(_,$){return _.msg=c[$],$}function fe(_){return(_<<1)-(4<_?9:0)}function Ne(_){for(var $=_.length;0<=--$;)_[$]=0}function he(_){var $=_.state,F=$.pending;F>_.avail_out&&(F=_.avail_out),F!==0&&(s.arraySet(_.output,$.pending_buf,$.pending_out,F,_.next_out),_.next_out+=F,$.pending_out+=F,_.total_out+=F,_.avail_out-=F,$.pending-=F,$.pending===0&&($.pending_out=0))}function ge(_,$){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,$),_.block_start=_.strstart,he(_.strm)}function ae(_,$){_.pending_buf[_.pending++]=$}function _e(_,$){_.pending_buf[_.pending++]=$>>>8&255,_.pending_buf[_.pending++]=255&$}function oe(_,$){var F,j,V=_.max_chain_length,G=_.strstart,Z=_.prev_length,W=_.nice_match,K=_.strstart>_.w_size-X?_.strstart-(_.w_size-X):0,ue=_.window,we=_.w_mask,Ce=_.prev,xe=_.strstart+z,ot=ue[G+Z-1],tt=ue[G+Z];_.prev_length>=_.good_match&&(V>>=2),W>_.lookahead&&(W=_.lookahead);do if(ue[(F=$)+Z]===tt&&ue[F+Z-1]===ot&&ue[F]===ue[G]&&ue[++F]===ue[G+1]){G+=2,F++;do;while(ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&ue[++G]===ue[++F]&&G<xe);if(j=z-(xe-G),G=xe-z,Z<j){if(_.match_start=$,W<=(Z=j))break;ot=ue[G+Z-1],tt=ue[G+Z]}}while(($=Ce[$&we])>K&&--V!=0);return Z<=_.lookahead?Z:_.lookahead}function Te(_){var $,F,j,V,G,Z,W,K,ue,we,Ce=_.w_size;do{if(V=_.window_size-_.lookahead-_.strstart,_.strstart>=Ce+(Ce-X)){for(s.arraySet(_.window,_.window,Ce,Ce,0),_.match_start-=Ce,_.strstart-=Ce,_.block_start-=Ce,$=F=_.hash_size;j=_.head[--$],_.head[$]=Ce<=j?j-Ce:0,--F;);for($=F=Ce;j=_.prev[--$],_.prev[$]=Ce<=j?j-Ce:0,--F;);V+=Ce}if(_.strm.avail_in===0)break;if(Z=_.strm,W=_.window,K=_.strstart+_.lookahead,ue=V,we=void 0,we=Z.avail_in,ue<we&&(we=ue),F=we===0?0:(Z.avail_in-=we,s.arraySet(W,Z.input,Z.next_in,we,K),Z.state.wrap===1?Z.adler=l(Z.adler,W,we,K):Z.state.wrap===2&&(Z.adler=u(Z.adler,W,we,K)),Z.next_in+=we,Z.total_in+=we,we),_.lookahead+=F,_.lookahead+_.insert>=B)for(G=_.strstart-_.insert,_.ins_h=_.window[G],_.ins_h=(_.ins_h<<_.hash_shift^_.window[G+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[G+B-1])&_.hash_mask,_.prev[G&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=G,G++,_.insert--,!(_.lookahead+_.insert<B)););}while(_.lookahead<X&&_.strm.avail_in!==0)}function Ge(_,$){for(var F,j;;){if(_.lookahead<X){if(Te(_),_.lookahead<X&&$===d)return I;if(_.lookahead===0)break}if(F=0,_.lookahead>=B&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+B-1])&_.hash_mask,F=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),F!==0&&_.strstart-F<=_.w_size-X&&(_.match_length=oe(_,F)),_.match_length>=B)if(j=a._tr_tally(_,_.strstart-_.match_start,_.match_length-B),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=B){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+B-1])&_.hash_mask,F=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else j=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(j&&(ge(_,!1),_.strm.avail_out===0))return I}return _.insert=_.strstart<B-1?_.strstart:B-1,$===h?(ge(_,!0),_.strm.avail_out===0?Y:te):_.last_lit&&(ge(_,!1),_.strm.avail_out===0)?I:L}function Je(_,$){for(var F,j,V;;){if(_.lookahead<X){if(Te(_),_.lookahead<X&&$===d)return I;if(_.lookahead===0)break}if(F=0,_.lookahead>=B&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+B-1])&_.hash_mask,F=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=B-1,F!==0&&_.prev_length<_.max_lazy_match&&_.strstart-F<=_.w_size-X&&(_.match_length=oe(_,F),_.match_length<=5&&(_.strategy===1||_.match_length===B&&4096<_.strstart-_.match_start)&&(_.match_length=B-1)),_.prev_length>=B&&_.match_length<=_.prev_length){for(V=_.strstart+_.lookahead-B,j=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-B),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=V&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+B-1])&_.hash_mask,F=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=B-1,_.strstart++,j&&(ge(_,!1),_.strm.avail_out===0))return I}else if(_.match_available){if((j=a._tr_tally(_,0,_.window[_.strstart-1]))&&ge(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return I}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(j=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<B-1?_.strstart:B-1,$===h?(ge(_,!0),_.strm.avail_out===0?Y:te):_.last_lit&&(ge(_,!1),_.strm.avail_out===0)?I:L}function _t(_,$,F,j,V){this.good_length=_,this.max_lazy=$,this.nice_length=F,this.max_chain=j,this.func=V}function be(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*M),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*R+1)),Ne(this.dyn_ltree),Ne(this.dyn_dtree),Ne(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(H+1),this.heap=new s.Buf16(2*C+1),Ne(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*C+1),Ne(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ve(_){var $;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=w,($=_.state).pending=0,$.pending_out=0,$.wrap<0&&($.wrap=-$.wrap),$.status=$.wrap?P:N,_.adler=$.wrap===2?0:1,$.last_flush=d,a._tr_init($),m):le(_,p)}function Le(_){var $=Ve(_);return $===m&&(function(F){F.window_size=2*F.w_size,Ne(F.head),F.max_lazy_match=i[F.level].max_lazy,F.good_match=i[F.level].good_length,F.nice_match=i[F.level].nice_length,F.max_chain_length=i[F.level].max_chain,F.strstart=0,F.block_start=0,F.lookahead=0,F.insert=0,F.match_length=F.prev_length=B-1,F.match_available=0,F.ins_h=0})(_.state),$}function J(_,$,F,j,V,G){if(!_)return p;var Z=1;if($===g&&($=6),j<0?(Z=0,j=-j):15<j&&(Z=2,j-=16),V<1||y<V||F!==S||j<8||15<j||$<0||9<$||G<0||k<G)return le(_,p);j===8&&(j=9);var W=new be;return(_.state=W).strm=_,W.wrap=Z,W.gzhead=null,W.w_bits=j,W.w_size=1<<W.w_bits,W.w_mask=W.w_size-1,W.hash_bits=V+7,W.hash_size=1<<W.hash_bits,W.hash_mask=W.hash_size-1,W.hash_shift=~~((W.hash_bits+B-1)/B),W.window=new s.Buf8(2*W.w_size),W.head=new s.Buf16(W.hash_size),W.prev=new s.Buf16(W.w_size),W.lit_bufsize=1<<V+6,W.pending_buf_size=4*W.lit_bufsize,W.pending_buf=new s.Buf8(W.pending_buf_size),W.d_buf=1*W.lit_bufsize,W.l_buf=3*W.lit_bufsize,W.level=$,W.strategy=G,W.method=F,Le(_)}i=[new _t(0,0,0,0,function(_,$){var F=65535;for(F>_.pending_buf_size-5&&(F=_.pending_buf_size-5);;){if(_.lookahead<=1){if(Te(_),_.lookahead===0&&$===d)return I;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var j=_.block_start+F;if((_.strstart===0||_.strstart>=j)&&(_.lookahead=_.strstart-j,_.strstart=j,ge(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-X&&(ge(_,!1),_.strm.avail_out===0))return I}return _.insert=0,$===h?(ge(_,!0),_.strm.avail_out===0?Y:te):(_.strstart>_.block_start&&(ge(_,!1),_.strm.avail_out),I)}),new _t(4,4,8,4,Ge),new _t(4,5,16,8,Ge),new _t(4,6,32,32,Ge),new _t(4,4,16,16,Je),new _t(8,16,32,32,Je),new _t(8,16,128,128,Je),new _t(8,32,128,256,Je),new _t(32,128,258,1024,Je),new _t(32,258,258,4096,Je)],o.deflateInit=function(_,$){return J(_,$,S,15,8,0)},o.deflateInit2=J,o.deflateReset=Le,o.deflateResetKeep=Ve,o.deflateSetHeader=function(_,$){return _&&_.state?_.state.wrap!==2?p:(_.state.gzhead=$,m):p},o.deflate=function(_,$){var F,j,V,G;if(!_||!_.state||5<$||$<0)return _?le(_,p):p;if(j=_.state,!_.output||!_.input&&_.avail_in!==0||j.status===666&&$!==h)return le(_,_.avail_out===0?-5:p);if(j.strm=_,F=j.last_flush,j.last_flush=$,j.status===P)if(j.wrap===2)_.adler=0,ae(j,31),ae(j,139),ae(j,8),j.gzhead?(ae(j,(j.gzhead.text?1:0)+(j.gzhead.hcrc?2:0)+(j.gzhead.extra?4:0)+(j.gzhead.name?8:0)+(j.gzhead.comment?16:0)),ae(j,255&j.gzhead.time),ae(j,j.gzhead.time>>8&255),ae(j,j.gzhead.time>>16&255),ae(j,j.gzhead.time>>24&255),ae(j,j.level===9?2:2<=j.strategy||j.level<2?4:0),ae(j,255&j.gzhead.os),j.gzhead.extra&&j.gzhead.extra.length&&(ae(j,255&j.gzhead.extra.length),ae(j,j.gzhead.extra.length>>8&255)),j.gzhead.hcrc&&(_.adler=u(_.adler,j.pending_buf,j.pending,0)),j.gzindex=0,j.status=69):(ae(j,0),ae(j,0),ae(j,0),ae(j,0),ae(j,0),ae(j,j.level===9?2:2<=j.strategy||j.level<2?4:0),ae(j,3),j.status=N);else{var Z=S+(j.w_bits-8<<4)<<8;Z|=(2<=j.strategy||j.level<2?0:j.level<6?1:j.level===6?2:3)<<6,j.strstart!==0&&(Z|=32),Z+=31-Z%31,j.status=N,_e(j,Z),j.strstart!==0&&(_e(j,_.adler>>>16),_e(j,65535&_.adler)),_.adler=1}if(j.status===69)if(j.gzhead.extra){for(V=j.pending;j.gzindex<(65535&j.gzhead.extra.length)&&(j.pending!==j.pending_buf_size||(j.gzhead.hcrc&&j.pending>V&&(_.adler=u(_.adler,j.pending_buf,j.pending-V,V)),he(_),V=j.pending,j.pending!==j.pending_buf_size));)ae(j,255&j.gzhead.extra[j.gzindex]),j.gzindex++;j.gzhead.hcrc&&j.pending>V&&(_.adler=u(_.adler,j.pending_buf,j.pending-V,V)),j.gzindex===j.gzhead.extra.length&&(j.gzindex=0,j.status=73)}else j.status=73;if(j.status===73)if(j.gzhead.name){V=j.pending;do{if(j.pending===j.pending_buf_size&&(j.gzhead.hcrc&&j.pending>V&&(_.adler=u(_.adler,j.pending_buf,j.pending-V,V)),he(_),V=j.pending,j.pending===j.pending_buf_size)){G=1;break}G=j.gzindex<j.gzhead.name.length?255&j.gzhead.name.charCodeAt(j.gzindex++):0,ae(j,G)}while(G!==0);j.gzhead.hcrc&&j.pending>V&&(_.adler=u(_.adler,j.pending_buf,j.pending-V,V)),G===0&&(j.gzindex=0,j.status=91)}else j.status=91;if(j.status===91)if(j.gzhead.comment){V=j.pending;do{if(j.pending===j.pending_buf_size&&(j.gzhead.hcrc&&j.pending>V&&(_.adler=u(_.adler,j.pending_buf,j.pending-V,V)),he(_),V=j.pending,j.pending===j.pending_buf_size)){G=1;break}G=j.gzindex<j.gzhead.comment.length?255&j.gzhead.comment.charCodeAt(j.gzindex++):0,ae(j,G)}while(G!==0);j.gzhead.hcrc&&j.pending>V&&(_.adler=u(_.adler,j.pending_buf,j.pending-V,V)),G===0&&(j.status=103)}else j.status=103;if(j.status===103&&(j.gzhead.hcrc?(j.pending+2>j.pending_buf_size&&he(_),j.pending+2<=j.pending_buf_size&&(ae(j,255&_.adler),ae(j,_.adler>>8&255),_.adler=0,j.status=N)):j.status=N),j.pending!==0){if(he(_),_.avail_out===0)return j.last_flush=-1,m}else if(_.avail_in===0&&fe($)<=fe(F)&&$!==h)return le(_,-5);if(j.status===666&&_.avail_in!==0)return le(_,-5);if(_.avail_in!==0||j.lookahead!==0||$!==d&&j.status!==666){var W=j.strategy===2?(function(K,ue){for(var we;;){if(K.lookahead===0&&(Te(K),K.lookahead===0)){if(ue===d)return I;break}if(K.match_length=0,we=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,we&&(ge(K,!1),K.strm.avail_out===0))return I}return K.insert=0,ue===h?(ge(K,!0),K.strm.avail_out===0?Y:te):K.last_lit&&(ge(K,!1),K.strm.avail_out===0)?I:L})(j,$):j.strategy===3?(function(K,ue){for(var we,Ce,xe,ot,tt=K.window;;){if(K.lookahead<=z){if(Te(K),K.lookahead<=z&&ue===d)return I;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=B&&0<K.strstart&&(Ce=tt[xe=K.strstart-1])===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]){ot=K.strstart+z;do;while(Ce===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]&&Ce===tt[++xe]&&xe<ot);K.match_length=z-(ot-xe),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=B?(we=a._tr_tally(K,1,K.match_length-B),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(we=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),we&&(ge(K,!1),K.strm.avail_out===0))return I}return K.insert=0,ue===h?(ge(K,!0),K.strm.avail_out===0?Y:te):K.last_lit&&(ge(K,!1),K.strm.avail_out===0)?I:L})(j,$):i[j.level].func(j,$);if(W!==Y&&W!==te||(j.status=666),W===I||W===Y)return _.avail_out===0&&(j.last_flush=-1),m;if(W===L&&($===1?a._tr_align(j):$!==5&&(a._tr_stored_block(j,0,0,!1),$===3&&(Ne(j.head),j.lookahead===0&&(j.strstart=0,j.block_start=0,j.insert=0))),he(_),_.avail_out===0))return j.last_flush=-1,m}return $!==h?m:j.wrap<=0?1:(j.wrap===2?(ae(j,255&_.adler),ae(j,_.adler>>8&255),ae(j,_.adler>>16&255),ae(j,_.adler>>24&255),ae(j,255&_.total_in),ae(j,_.total_in>>8&255),ae(j,_.total_in>>16&255),ae(j,_.total_in>>24&255)):(_e(j,_.adler>>>16),_e(j,65535&_.adler)),he(_),0<j.wrap&&(j.wrap=-j.wrap),j.pending!==0?m:1)},o.deflateEnd=function(_){var $;return _&&_.state?($=_.state.status)!==P&&$!==69&&$!==73&&$!==91&&$!==103&&$!==N&&$!==666?le(_,p):(_.state=null,$===N?le(_,-3):m):p},o.deflateSetDictionary=function(_,$){var F,j,V,G,Z,W,K,ue,we=$.length;if(!_||!_.state||(G=(F=_.state).wrap)===2||G===1&&F.status!==P||F.lookahead)return p;for(G===1&&(_.adler=l(_.adler,$,we,0)),F.wrap=0,we>=F.w_size&&(G===0&&(Ne(F.head),F.strstart=0,F.block_start=0,F.insert=0),ue=new s.Buf8(F.w_size),s.arraySet(ue,$,we-F.w_size,F.w_size,0),$=ue,we=F.w_size),Z=_.avail_in,W=_.next_in,K=_.input,_.avail_in=we,_.next_in=0,_.input=$,Te(F);F.lookahead>=B;){for(j=F.strstart,V=F.lookahead-(B-1);F.ins_h=(F.ins_h<<F.hash_shift^F.window[j+B-1])&F.hash_mask,F.prev[j&F.w_mask]=F.head[F.ins_h],F.head[F.ins_h]=j,j++,--V;);F.strstart=j,F.lookahead=B-1,Te(F)}return F.strstart+=F.lookahead,F.block_start=F.strstart,F.insert=F.lookahead,F.lookahead=0,F.match_length=F.prev_length=B-1,F.match_available=0,_.next_in=W,_.input=K,_.avail_in=Z,F.wrap=G,m},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,c,d,h,m,p,g,k,w,S,y,C,T,R,M,H,B,z,X,P,N,I=i.input,L;u=l+(i.avail_in-5),c=i.next_out,L=i.output,d=c-(s-i.avail_out),h=c+(i.avail_out-257),m=a.dmax,p=a.wsize,g=a.whave,k=a.wnext,w=a.window,S=a.hold,y=a.bits,C=a.lencode,T=a.distcode,R=(1<<a.lenbits)-1,M=(1<<a.distbits)-1;e:do{y<15&&(S+=I[l++]<<y,y+=8,S+=I[l++]<<y,y+=8),H=C[S&R];t:for(;;){if(S>>>=B=H>>>24,y-=B,(B=H>>>16&255)===0)L[c++]=65535&H;else{if(!(16&B)){if((64&B)==0){H=C[(65535&H)+(S&(1<<B)-1)];continue t}if(32&B){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}z=65535&H,(B&=15)&&(y<B&&(S+=I[l++]<<y,y+=8),z+=S&(1<<B)-1,S>>>=B,y-=B),y<15&&(S+=I[l++]<<y,y+=8,S+=I[l++]<<y,y+=8),H=T[S&M];n:for(;;){if(S>>>=B=H>>>24,y-=B,!(16&(B=H>>>16&255))){if((64&B)==0){H=T[(65535&H)+(S&(1<<B)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(X=65535&H,y<(B&=15)&&(S+=I[l++]<<y,(y+=8)<B&&(S+=I[l++]<<y,y+=8)),m<(X+=S&(1<<B)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=B,y-=B,(B=c-d)<X){if(g<(B=X-B)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(N=w,(P=0)===k){if(P+=p-B,B<z){for(z-=B;L[c++]=w[P++],--B;);P=c-X,N=L}}else if(k<B){if(P+=p+k-B,(B-=k)<z){for(z-=B;L[c++]=w[P++],--B;);if(P=0,k<z){for(z-=B=k;L[c++]=w[P++],--B;);P=c-X,N=L}}}else if(P+=k-B,B<z){for(z-=B;L[c++]=w[P++],--B;);P=c-X,N=L}for(;2<z;)L[c++]=N[P++],L[c++]=N[P++],L[c++]=N[P++],z-=3;z&&(L[c++]=N[P++],1<z&&(L[c++]=N[P++]))}else{for(P=c-X;L[c++]=L[P++],L[c++]=L[P++],L[c++]=L[P++],2<(z-=3););z&&(L[c++]=L[P++],1<z&&(L[c++]=L[P++]))}break}}break}}while(l<u&&c<h);l-=z=y>>3,S&=(1<<(y-=z<<3))-1,i.next_in=l,i.next_out=c,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=c<h?h-c+257:257-(c-h),a.hold=S,a.bits=y}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),c=1,d=2,h=0,m=-2,p=1,g=852,k=592;function w(P){return(P>>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(P){var N;return P&&P.state?(N=P.state,P.total_in=P.total_out=N.total=0,P.msg="",N.wrap&&(P.adler=1&N.wrap),N.mode=p,N.last=0,N.havedict=0,N.dmax=32768,N.head=null,N.hold=0,N.bits=0,N.lencode=N.lendyn=new i.Buf32(g),N.distcode=N.distdyn=new i.Buf32(k),N.sane=1,N.back=-1,h):m}function C(P){var N;return P&&P.state?((N=P.state).wsize=0,N.whave=0,N.wnext=0,y(P)):m}function T(P,N){var I,L;return P&&P.state?(L=P.state,N<0?(I=0,N=-N):(I=1+(N>>4),N<48&&(N&=15)),N&&(N<8||15<N)?m:(L.window!==null&&L.wbits!==N&&(L.window=null),L.wrap=I,L.wbits=N,C(P))):m}function R(P,N){var I,L;return P?(L=new S,(P.state=L).window=null,(I=T(P,N))!==h&&(P.state=null),I):m}var M,H,B=!0;function z(P){if(B){var N;for(M=new i.Buf32(512),H=new i.Buf32(32),N=0;N<144;)P.lens[N++]=8;for(;N<256;)P.lens[N++]=9;for(;N<280;)P.lens[N++]=7;for(;N<288;)P.lens[N++]=8;for(u(c,P.lens,0,288,M,0,P.work,{bits:9}),N=0;N<32;)P.lens[N++]=5;u(d,P.lens,0,32,H,0,P.work,{bits:5}),B=!1}P.lencode=M,P.lenbits=9,P.distcode=H,P.distbits=5}function X(P,N,I,L){var Y,te=P.state;return te.window===null&&(te.wsize=1<<te.wbits,te.wnext=0,te.whave=0,te.window=new i.Buf8(te.wsize)),L>=te.wsize?(i.arraySet(te.window,N,I-te.wsize,te.wsize,0),te.wnext=0,te.whave=te.wsize):(L<(Y=te.wsize-te.wnext)&&(Y=L),i.arraySet(te.window,N,I-L,Y,te.wnext),(L-=Y)?(i.arraySet(te.window,N,I-L,L,0),te.wnext=L,te.whave=te.wsize):(te.wnext+=Y,te.wnext===te.wsize&&(te.wnext=0),te.whave<te.wsize&&(te.whave+=Y))),0}o.inflateReset=C,o.inflateReset2=T,o.inflateResetKeep=y,o.inflateInit=function(P){return R(P,15)},o.inflateInit2=R,o.inflate=function(P,N){var I,L,Y,te,le,fe,Ne,he,ge,ae,_e,oe,Te,Ge,Je,_t,be,Ve,Le,J,_,$,F,j,V=0,G=new i.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!P||!P.state||!P.output||!P.input&&P.avail_in!==0)return m;(I=P.state).mode===12&&(I.mode=13),le=P.next_out,Y=P.output,Ne=P.avail_out,te=P.next_in,L=P.input,fe=P.avail_in,he=I.hold,ge=I.bits,ae=fe,_e=Ne,$=h;e:for(;;)switch(I.mode){case p:if(I.wrap===0){I.mode=13;break}for(;ge<16;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(2&I.wrap&&he===35615){G[I.check=0]=255&he,G[1]=he>>>8&255,I.check=a(I.check,G,2,0),ge=he=0,I.mode=2;break}if(I.flags=0,I.head&&(I.head.done=!1),!(1&I.wrap)||(((255&he)<<8)+(he>>8))%31){P.msg="incorrect header check",I.mode=30;break}if((15&he)!=8){P.msg="unknown compression method",I.mode=30;break}if(ge-=4,_=8+(15&(he>>>=4)),I.wbits===0)I.wbits=_;else if(_>I.wbits){P.msg="invalid window size",I.mode=30;break}I.dmax=1<<_,P.adler=I.check=1,I.mode=512&he?10:12,ge=he=0;break;case 2:for(;ge<16;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(I.flags=he,(255&I.flags)!=8){P.msg="unknown compression method",I.mode=30;break}if(57344&I.flags){P.msg="unknown header flags set",I.mode=30;break}I.head&&(I.head.text=he>>8&1),512&I.flags&&(G[0]=255&he,G[1]=he>>>8&255,I.check=a(I.check,G,2,0)),ge=he=0,I.mode=3;case 3:for(;ge<32;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}I.head&&(I.head.time=he),512&I.flags&&(G[0]=255&he,G[1]=he>>>8&255,G[2]=he>>>16&255,G[3]=he>>>24&255,I.check=a(I.check,G,4,0)),ge=he=0,I.mode=4;case 4:for(;ge<16;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}I.head&&(I.head.xflags=255&he,I.head.os=he>>8),512&I.flags&&(G[0]=255&he,G[1]=he>>>8&255,I.check=a(I.check,G,2,0)),ge=he=0,I.mode=5;case 5:if(1024&I.flags){for(;ge<16;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}I.length=he,I.head&&(I.head.extra_len=he),512&I.flags&&(G[0]=255&he,G[1]=he>>>8&255,I.check=a(I.check,G,2,0)),ge=he=0}else I.head&&(I.head.extra=null);I.mode=6;case 6:if(1024&I.flags&&(fe<(oe=I.length)&&(oe=fe),oe&&(I.head&&(_=I.head.extra_len-I.length,I.head.extra||(I.head.extra=new Array(I.head.extra_len)),i.arraySet(I.head.extra,L,te,oe,_)),512&I.flags&&(I.check=a(I.check,L,oe,te)),fe-=oe,te+=oe,I.length-=oe),I.length))break e;I.length=0,I.mode=7;case 7:if(2048&I.flags){if(fe===0)break e;for(oe=0;_=L[te+oe++],I.head&&_&&I.length<65536&&(I.head.name+=String.fromCharCode(_)),_&&oe<fe;);if(512&I.flags&&(I.check=a(I.check,L,oe,te)),fe-=oe,te+=oe,_)break e}else I.head&&(I.head.name=null);I.length=0,I.mode=8;case 8:if(4096&I.flags){if(fe===0)break e;for(oe=0;_=L[te+oe++],I.head&&_&&I.length<65536&&(I.head.comment+=String.fromCharCode(_)),_&&oe<fe;);if(512&I.flags&&(I.check=a(I.check,L,oe,te)),fe-=oe,te+=oe,_)break e}else I.head&&(I.head.comment=null);I.mode=9;case 9:if(512&I.flags){for(;ge<16;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(he!==(65535&I.check)){P.msg="header crc mismatch",I.mode=30;break}ge=he=0}I.head&&(I.head.hcrc=I.flags>>9&1,I.head.done=!0),P.adler=I.check=0,I.mode=12;break;case 10:for(;ge<32;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}P.adler=I.check=w(he),ge=he=0,I.mode=11;case 11:if(I.havedict===0)return P.next_out=le,P.avail_out=Ne,P.next_in=te,P.avail_in=fe,I.hold=he,I.bits=ge,2;P.adler=I.check=1,I.mode=12;case 12:if(N===5||N===6)break e;case 13:if(I.last){he>>>=7&ge,ge-=7&ge,I.mode=27;break}for(;ge<3;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}switch(I.last=1&he,ge-=1,3&(he>>>=1)){case 0:I.mode=14;break;case 1:if(z(I),I.mode=20,N!==6)break;he>>>=2,ge-=2;break e;case 2:I.mode=17;break;case 3:P.msg="invalid block type",I.mode=30}he>>>=2,ge-=2;break;case 14:for(he>>>=7&ge,ge-=7≥ge<32;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if((65535&he)!=(he>>>16^65535)){P.msg="invalid stored block lengths",I.mode=30;break}if(I.length=65535&he,ge=he=0,I.mode=15,N===6)break e;case 15:I.mode=16;case 16:if(oe=I.length){if(fe<oe&&(oe=fe),Ne<oe&&(oe=Ne),oe===0)break e;i.arraySet(Y,L,te,oe,le),fe-=oe,te+=oe,Ne-=oe,le+=oe,I.length-=oe;break}I.mode=12;break;case 17:for(;ge<14;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(I.nlen=257+(31&he),he>>>=5,ge-=5,I.ndist=1+(31&he),he>>>=5,ge-=5,I.ncode=4+(15&he),he>>>=4,ge-=4,286<I.nlen||30<I.ndist){P.msg="too many length or distance symbols",I.mode=30;break}I.have=0,I.mode=18;case 18:for(;I.have<I.ncode;){for(;ge<3;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}I.lens[Z[I.have++]]=7&he,he>>>=3,ge-=3}for(;I.have<19;)I.lens[Z[I.have++]]=0;if(I.lencode=I.lendyn,I.lenbits=7,F={bits:I.lenbits},$=u(0,I.lens,0,19,I.lencode,0,I.work,F),I.lenbits=F.bits,$){P.msg="invalid code lengths set",I.mode=30;break}I.have=0,I.mode=19;case 19:for(;I.have<I.nlen+I.ndist;){for(;_t=(V=I.lencode[he&(1<<I.lenbits)-1])>>>16&255,be=65535&V,!((Je=V>>>24)<=ge);){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(be<16)he>>>=Je,ge-=Je,I.lens[I.have++]=be;else{if(be===16){for(j=Je+2;ge<j;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(he>>>=Je,ge-=Je,I.have===0){P.msg="invalid bit length repeat",I.mode=30;break}_=I.lens[I.have-1],oe=3+(3&he),he>>>=2,ge-=2}else if(be===17){for(j=Je+3;ge<j;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}ge-=Je,_=0,oe=3+(7&(he>>>=Je)),he>>>=3,ge-=3}else{for(j=Je+7;ge<j;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}ge-=Je,_=0,oe=11+(127&(he>>>=Je)),he>>>=7,ge-=7}if(I.have+oe>I.nlen+I.ndist){P.msg="invalid bit length repeat",I.mode=30;break}for(;oe--;)I.lens[I.have++]=_}}if(I.mode===30)break;if(I.lens[256]===0){P.msg="invalid code -- missing end-of-block",I.mode=30;break}if(I.lenbits=9,F={bits:I.lenbits},$=u(c,I.lens,0,I.nlen,I.lencode,0,I.work,F),I.lenbits=F.bits,$){P.msg="invalid literal/lengths set",I.mode=30;break}if(I.distbits=6,I.distcode=I.distdyn,F={bits:I.distbits},$=u(d,I.lens,I.nlen,I.ndist,I.distcode,0,I.work,F),I.distbits=F.bits,$){P.msg="invalid distances set",I.mode=30;break}if(I.mode=20,N===6)break e;case 20:I.mode=21;case 21:if(6<=fe&&258<=Ne){P.next_out=le,P.avail_out=Ne,P.next_in=te,P.avail_in=fe,I.hold=he,I.bits=ge,l(P,_e),le=P.next_out,Y=P.output,Ne=P.avail_out,te=P.next_in,L=P.input,fe=P.avail_in,he=I.hold,ge=I.bits,I.mode===12&&(I.back=-1);break}for(I.back=0;_t=(V=I.lencode[he&(1<<I.lenbits)-1])>>>16&255,be=65535&V,!((Je=V>>>24)<=ge);){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(_t&&(240&_t)==0){for(Ve=Je,Le=_t,J=be;_t=(V=I.lencode[J+((he&(1<<Ve+Le)-1)>>Ve)])>>>16&255,be=65535&V,!(Ve+(Je=V>>>24)<=ge);){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}he>>>=Ve,ge-=Ve,I.back+=Ve}if(he>>>=Je,ge-=Je,I.back+=Je,I.length=be,_t===0){I.mode=26;break}if(32&_t){I.back=-1,I.mode=12;break}if(64&_t){P.msg="invalid literal/length code",I.mode=30;break}I.extra=15&_t,I.mode=22;case 22:if(I.extra){for(j=I.extra;ge<j;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}I.length+=he&(1<<I.extra)-1,he>>>=I.extra,ge-=I.extra,I.back+=I.extra}I.was=I.length,I.mode=23;case 23:for(;_t=(V=I.distcode[he&(1<<I.distbits)-1])>>>16&255,be=65535&V,!((Je=V>>>24)<=ge);){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if((240&_t)==0){for(Ve=Je,Le=_t,J=be;_t=(V=I.distcode[J+((he&(1<<Ve+Le)-1)>>Ve)])>>>16&255,be=65535&V,!(Ve+(Je=V>>>24)<=ge);){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}he>>>=Ve,ge-=Ve,I.back+=Ve}if(he>>>=Je,ge-=Je,I.back+=Je,64&_t){P.msg="invalid distance code",I.mode=30;break}I.offset=be,I.extra=15&_t,I.mode=24;case 24:if(I.extra){for(j=I.extra;ge<j;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}I.offset+=he&(1<<I.extra)-1,he>>>=I.extra,ge-=I.extra,I.back+=I.extra}if(I.offset>I.dmax){P.msg="invalid distance too far back",I.mode=30;break}I.mode=25;case 25:if(Ne===0)break e;if(oe=_e-Ne,I.offset>oe){if((oe=I.offset-oe)>I.whave&&I.sane){P.msg="invalid distance too far back",I.mode=30;break}Te=oe>I.wnext?(oe-=I.wnext,I.wsize-oe):I.wnext-oe,oe>I.length&&(oe=I.length),Ge=I.window}else Ge=Y,Te=le-I.offset,oe=I.length;for(Ne<oe&&(oe=Ne),Ne-=oe,I.length-=oe;Y[le++]=Ge[Te++],--oe;);I.length===0&&(I.mode=21);break;case 26:if(Ne===0)break e;Y[le++]=I.length,Ne--,I.mode=21;break;case 27:if(I.wrap){for(;ge<32;){if(fe===0)break e;fe--,he|=L[te++]<<ge,ge+=8}if(_e-=Ne,P.total_out+=_e,I.total+=_e,_e&&(P.adler=I.check=I.flags?a(I.check,Y,_e,le-_e):s(I.check,Y,_e,le-_e)),_e=Ne,(I.flags?he:w(he))!==I.check){P.msg="incorrect data check",I.mode=30;break}ge=he=0}I.mode=28;case 28:if(I.wrap&&I.flags){for(;ge<32;){if(fe===0)break e;fe--,he+=L[te++]<<ge,ge+=8}if(he!==(4294967295&I.total)){P.msg="incorrect length check",I.mode=30;break}ge=he=0}I.mode=29;case 29:$=1;break e;case 30:$=-3;break e;case 31:return-4;default:return m}return P.next_out=le,P.avail_out=Ne,P.next_in=te,P.avail_in=fe,I.hold=he,I.bits=ge,(I.wsize||_e!==P.avail_out&&I.mode<30&&(I.mode<27||N!==4))&&X(P,P.output,P.next_out,_e-P.avail_out)?(I.mode=31,-4):(ae-=P.avail_in,_e-=P.avail_out,P.total_in+=ae,P.total_out+=_e,I.total+=_e,I.wrap&&_e&&(P.adler=I.check=I.flags?a(I.check,Y,_e,P.next_out-_e):s(I.check,Y,_e,P.next_out-_e)),P.data_type=I.bits+(I.last?64:0)+(I.mode===12?128:0)+(I.mode===20||I.mode===15?256:0),(ae==0&&_e===0||N===4)&&$===h&&($=-5),$)},o.inflateEnd=function(P){if(!P||!P.state)return m;var N=P.state;return N.window&&(N.window=null),P.state=null,h},o.inflateGetHeader=function(P,N){var I;return P&&P.state?(2&(I=P.state).wrap)==0?m:((I.head=N).done=!1,h):m},o.inflateSetDictionary=function(P,N){var I,L=N.length;return P&&P.state?(I=P.state).wrap!==0&&I.mode!==11?m:I.mode===11&&s(1,N,L,0)!==I.check?-3:X(P,N,L,L)?(I.mode=31,-4):(I.havedict=1,h):m},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(c,d,h,m,p,g,k,w){var S,y,C,T,R,M,H,B,z,X=w.bits,P=0,N=0,I=0,L=0,Y=0,te=0,le=0,fe=0,Ne=0,he=0,ge=null,ae=0,_e=new i.Buf16(16),oe=new i.Buf16(16),Te=null,Ge=0;for(P=0;P<=15;P++)_e[P]=0;for(N=0;N<m;N++)_e[d[h+N]]++;for(Y=X,L=15;1<=L&&_e[L]===0;L--);if(L<Y&&(Y=L),L===0)return p[g++]=20971520,p[g++]=20971520,w.bits=1,0;for(I=1;I<L&&_e[I]===0;I++);for(Y<I&&(Y=I),P=fe=1;P<=15;P++)if(fe<<=1,(fe-=_e[P])<0)return-1;if(0<fe&&(c===0||L!==1))return-1;for(oe[1]=0,P=1;P<15;P++)oe[P+1]=oe[P]+_e[P];for(N=0;N<m;N++)d[h+N]!==0&&(k[oe[d[h+N]]++]=N);if(M=c===0?(ge=Te=k,19):c===1?(ge=s,ae-=257,Te=a,Ge-=257,256):(ge=l,Te=u,-1),P=I,R=g,le=N=he=0,C=-1,T=(Ne=1<<(te=Y))-1,c===1&&852<Ne||c===2&&592<Ne)return 1;for(;;){for(H=P-le,z=k[N]<M?(B=0,k[N]):k[N]>M?(B=Te[Ge+k[N]],ge[ae+k[N]]):(B=96,0),S=1<<P-le,I=y=1<<te;p[R+(he>>le)+(y-=S)]=H<<24|B<<16|z|0,y!==0;);for(S=1<<P-1;he&S;)S>>=1;if(S!==0?(he&=S-1,he+=S):he=0,N++,--_e[P]==0){if(P===L)break;P=d[h+k[N]]}if(Y<P&&(he&T)!==C){for(le===0&&(le=Y),R+=I,fe=1<<(te=P-le);te+le<L&&!((fe-=_e[te+le])<=0);)te++,fe<<=1;if(Ne+=1<<te,c===1&&852<Ne||c===2&&592<Ne)return 1;p[C=he&T]=Y<<24|te<<16|R-g|0}}return he!==0&&(p[R+he]=P-le<<24|4194304),w.bits=Y,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(V){for(var G=V.length;0<=--G;)V[G]=0}var u=0,c=29,d=256,h=d+1+c,m=30,p=19,g=2*h+1,k=15,w=16,S=7,y=256,C=16,T=17,R=18,M=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],H=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=new Array(2*(h+2));l(X);var P=new Array(2*m);l(P);var N=new Array(512);l(N);var I=new Array(256);l(I);var L=new Array(c);l(L);var Y,te,le,fe=new Array(m);function Ne(V,G,Z,W,K){this.static_tree=V,this.extra_bits=G,this.extra_base=Z,this.elems=W,this.max_length=K,this.has_stree=V&&V.length}function he(V,G){this.dyn_tree=V,this.max_code=0,this.stat_desc=G}function ge(V){return V<256?N[V]:N[256+(V>>>7)]}function ae(V,G){V.pending_buf[V.pending++]=255&G,V.pending_buf[V.pending++]=G>>>8&255}function _e(V,G,Z){V.bi_valid>w-Z?(V.bi_buf|=G<<V.bi_valid&65535,ae(V,V.bi_buf),V.bi_buf=G>>w-V.bi_valid,V.bi_valid+=Z-w):(V.bi_buf|=G<<V.bi_valid&65535,V.bi_valid+=Z)}function oe(V,G,Z){_e(V,Z[2*G],Z[2*G+1])}function Te(V,G){for(var Z=0;Z|=1&V,V>>>=1,Z<<=1,0<--G;);return Z>>>1}function Ge(V,G,Z){var W,K,ue=new Array(k+1),we=0;for(W=1;W<=k;W++)ue[W]=we=we+Z[W-1]<<1;for(K=0;K<=G;K++){var Ce=V[2*K+1];Ce!==0&&(V[2*K]=Te(ue[Ce]++,Ce))}}function Je(V){var G;for(G=0;G<h;G++)V.dyn_ltree[2*G]=0;for(G=0;G<m;G++)V.dyn_dtree[2*G]=0;for(G=0;G<p;G++)V.bl_tree[2*G]=0;V.dyn_ltree[2*y]=1,V.opt_len=V.static_len=0,V.last_lit=V.matches=0}function _t(V){8<V.bi_valid?ae(V,V.bi_buf):0<V.bi_valid&&(V.pending_buf[V.pending++]=V.bi_buf),V.bi_buf=0,V.bi_valid=0}function be(V,G,Z,W){var K=2*G,ue=2*Z;return V[K]<V[ue]||V[K]===V[ue]&&W[G]<=W[Z]}function Ve(V,G,Z){for(var W=V.heap[Z],K=Z<<1;K<=V.heap_len&&(K<V.heap_len&&be(G,V.heap[K+1],V.heap[K],V.depth)&&K++,!be(G,W,V.heap[K],V.depth));)V.heap[Z]=V.heap[K],Z=K,K<<=1;V.heap[Z]=W}function Le(V,G,Z){var W,K,ue,we,Ce=0;if(V.last_lit!==0)for(;W=V.pending_buf[V.d_buf+2*Ce]<<8|V.pending_buf[V.d_buf+2*Ce+1],K=V.pending_buf[V.l_buf+Ce],Ce++,W===0?oe(V,K,G):(oe(V,(ue=I[K])+d+1,G),(we=M[ue])!==0&&_e(V,K-=L[ue],we),oe(V,ue=ge(--W),Z),(we=H[ue])!==0&&_e(V,W-=fe[ue],we)),Ce<V.last_lit;);oe(V,y,G)}function J(V,G){var Z,W,K,ue=G.dyn_tree,we=G.stat_desc.static_tree,Ce=G.stat_desc.has_stree,xe=G.stat_desc.elems,ot=-1;for(V.heap_len=0,V.heap_max=g,Z=0;Z<xe;Z++)ue[2*Z]!==0?(V.heap[++V.heap_len]=ot=Z,V.depth[Z]=0):ue[2*Z+1]=0;for(;V.heap_len<2;)ue[2*(K=V.heap[++V.heap_len]=ot<2?++ot:0)]=1,V.depth[K]=0,V.opt_len--,Ce&&(V.static_len-=we[2*K+1]);for(G.max_code=ot,Z=V.heap_len>>1;1<=Z;Z--)Ve(V,ue,Z);for(K=xe;Z=V.heap[1],V.heap[1]=V.heap[V.heap_len--],Ve(V,ue,1),W=V.heap[1],V.heap[--V.heap_max]=Z,V.heap[--V.heap_max]=W,ue[2*K]=ue[2*Z]+ue[2*W],V.depth[K]=(V.depth[Z]>=V.depth[W]?V.depth[Z]:V.depth[W])+1,ue[2*Z+1]=ue[2*W+1]=K,V.heap[1]=K++,Ve(V,ue,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],(function(tt,Ct){var Kt,pt,Mt,zt,ln,$n,Ht=Ct.dyn_tree,Ke=Ct.max_code,kt=Ct.stat_desc.static_tree,Ut=Ct.stat_desc.has_stree,Ft=Ct.stat_desc.extra_bits,Ot=Ct.stat_desc.extra_base,hn=Ct.stat_desc.max_length,yn=0;for(zt=0;zt<=k;zt++)tt.bl_count[zt]=0;for(Ht[2*tt.heap[tt.heap_max]+1]=0,Kt=tt.heap_max+1;Kt<g;Kt++)hn<(zt=Ht[2*Ht[2*(pt=tt.heap[Kt])+1]+1]+1)&&(zt=hn,yn++),Ht[2*pt+1]=zt,Ke<pt||(tt.bl_count[zt]++,ln=0,Ot<=pt&&(ln=Ft[pt-Ot]),$n=Ht[2*pt],tt.opt_len+=$n*(zt+ln),Ut&&(tt.static_len+=$n*(kt[2*pt+1]+ln)));if(yn!==0){do{for(zt=hn-1;tt.bl_count[zt]===0;)zt--;tt.bl_count[zt]--,tt.bl_count[zt+1]+=2,tt.bl_count[hn]--,yn-=2}while(0<yn);for(zt=hn;zt!==0;zt--)for(pt=tt.bl_count[zt];pt!==0;)Ke<(Mt=tt.heap[--Kt])||(Ht[2*Mt+1]!==zt&&(tt.opt_len+=(zt-Ht[2*Mt+1])*Ht[2*Mt],Ht[2*Mt+1]=zt),pt--)}})(V,G),Ge(ue,ot,V.bl_count)}function _(V,G,Z){var W,K,ue=-1,we=G[1],Ce=0,xe=7,ot=4;for(we===0&&(xe=138,ot=3),G[2*(Z+1)+1]=65535,W=0;W<=Z;W++)K=we,we=G[2*(W+1)+1],++Ce<xe&&K===we||(Ce<ot?V.bl_tree[2*K]+=Ce:K!==0?(K!==ue&&V.bl_tree[2*K]++,V.bl_tree[2*C]++):Ce<=10?V.bl_tree[2*T]++:V.bl_tree[2*R]++,ue=K,ot=(Ce=0)===we?(xe=138,3):K===we?(xe=6,3):(xe=7,4))}function $(V,G,Z){var W,K,ue=-1,we=G[1],Ce=0,xe=7,ot=4;for(we===0&&(xe=138,ot=3),W=0;W<=Z;W++)if(K=we,we=G[2*(W+1)+1],!(++Ce<xe&&K===we)){if(Ce<ot)for(;oe(V,K,V.bl_tree),--Ce!=0;);else K!==0?(K!==ue&&(oe(V,K,V.bl_tree),Ce--),oe(V,C,V.bl_tree),_e(V,Ce-3,2)):Ce<=10?(oe(V,T,V.bl_tree),_e(V,Ce-3,3)):(oe(V,R,V.bl_tree),_e(V,Ce-11,7));ue=K,ot=(Ce=0)===we?(xe=138,3):K===we?(xe=6,3):(xe=7,4)}}l(fe);var F=!1;function j(V,G,Z,W){_e(V,(u<<1)+(W?1:0),3),(function(K,ue,we,Ce){_t(K),Ce&&(ae(K,we),ae(K,~we)),i.arraySet(K.pending_buf,K.window,ue,we,K.pending),K.pending+=we})(V,G,Z,!0)}o._tr_init=function(V){F||((function(){var G,Z,W,K,ue,we=new Array(k+1);for(K=W=0;K<c-1;K++)for(L[K]=W,G=0;G<1<<M[K];G++)I[W++]=K;for(I[W-1]=K,K=ue=0;K<16;K++)for(fe[K]=ue,G=0;G<1<<H[K];G++)N[ue++]=K;for(ue>>=7;K<m;K++)for(fe[K]=ue<<7,G=0;G<1<<H[K]-7;G++)N[256+ue++]=K;for(Z=0;Z<=k;Z++)we[Z]=0;for(G=0;G<=143;)X[2*G+1]=8,G++,we[8]++;for(;G<=255;)X[2*G+1]=9,G++,we[9]++;for(;G<=279;)X[2*G+1]=7,G++,we[7]++;for(;G<=287;)X[2*G+1]=8,G++,we[8]++;for(Ge(X,h+1,we),G=0;G<m;G++)P[2*G+1]=5,P[2*G]=Te(G,5);Y=new Ne(X,M,d+1,h,k),te=new Ne(P,H,0,m,k),le=new Ne(new Array(0),B,0,p,S)})(),F=!0),V.l_desc=new he(V.dyn_ltree,Y),V.d_desc=new he(V.dyn_dtree,te),V.bl_desc=new he(V.bl_tree,le),V.bi_buf=0,V.bi_valid=0,Je(V)},o._tr_stored_block=j,o._tr_flush_block=function(V,G,Z,W){var K,ue,we=0;0<V.level?(V.strm.data_type===2&&(V.strm.data_type=(function(Ce){var xe,ot=4093624447;for(xe=0;xe<=31;xe++,ot>>>=1)if(1&ot&&Ce.dyn_ltree[2*xe]!==0)return s;if(Ce.dyn_ltree[18]!==0||Ce.dyn_ltree[20]!==0||Ce.dyn_ltree[26]!==0)return a;for(xe=32;xe<d;xe++)if(Ce.dyn_ltree[2*xe]!==0)return a;return s})(V)),J(V,V.l_desc),J(V,V.d_desc),we=(function(Ce){var xe;for(_(Ce,Ce.dyn_ltree,Ce.l_desc.max_code),_(Ce,Ce.dyn_dtree,Ce.d_desc.max_code),J(Ce,Ce.bl_desc),xe=p-1;3<=xe&&Ce.bl_tree[2*z[xe]+1]===0;xe--);return Ce.opt_len+=3*(xe+1)+5+5+4,xe})(V),K=V.opt_len+3+7>>>3,(ue=V.static_len+3+7>>>3)<=K&&(K=ue)):K=ue=Z+5,Z+4<=K&&G!==-1?j(V,G,Z,W):V.strategy===4||ue===K?(_e(V,2+(W?1:0),3),Le(V,X,P)):(_e(V,4+(W?1:0),3),(function(Ce,xe,ot,tt){var Ct;for(_e(Ce,xe-257,5),_e(Ce,ot-1,5),_e(Ce,tt-4,4),Ct=0;Ct<tt;Ct++)_e(Ce,Ce.bl_tree[2*z[Ct]+1],3);$(Ce,Ce.dyn_ltree,xe-1),$(Ce,Ce.dyn_dtree,ot-1)})(V,V.l_desc.max_code+1,V.d_desc.max_code+1,we+1),Le(V,V.dyn_ltree,V.dyn_dtree)),Je(V),W&&_t(V)},o._tr_tally=function(V,G,Z){return V.pending_buf[V.d_buf+2*V.last_lit]=G>>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&G,V.pending_buf[V.l_buf+V.last_lit]=255&Z,V.last_lit++,G===0?V.dyn_ltree[2*Z]++:(V.matches++,G--,V.dyn_ltree[2*(I[Z]+d+1)]++,V.dyn_dtree[2*ge(G)]++),V.last_lit===V.lit_bufsize-1},o._tr_align=function(V){_e(V,2,3),oe(V,y,X),(function(G){G.bi_valid===16?(ae(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)})(V)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,c,d,h=1,m={},p=!1,g=s.document,k=Object.getPrototypeOf&&Object.getPrototypeOf(s);k=k&&k.setTimeout?k:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){S(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,T=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=T,C}})()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",y,!1):s.attachEvent("onmessage",y),function(C){s.postMessage(d+C,"*")}):s.MessageChannel?((c=new MessageChannel).port1.onmessage=function(C){S(C.data)},function(C){c.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var T=g.createElement("script");T.onreadystatechange=function(){S(C),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(C){setTimeout(S,0,C)},k.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var T=new Array(arguments.length-1),R=0;R<T.length;R++)T[R]=arguments[R+1];return m[h]={callback:C,args:T},l(h),h++},k.clearImmediate=w}function w(C){delete m[C]}function S(C){if(p)setTimeout(S,0,C);else{var T=m[C];if(T){p=!0;try{(function(R){var M=R.callback,H=R.args;switch(H.length){case 0:M();break;case 1:M(H[0]);break;case 2:M(H[0],H[1]);break;case 3:M(H[0],H[1],H[2]);break;default:M.apply(a,H)}})(T)}finally{w(C),p=!1}}}}function y(C){C.source===s&&typeof C.data=="string"&&C.data.indexOf(d)===0&&S(+C.data.slice(d.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}));const Tr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Nl="application/pdf",Ph="text/html",Q5={docx:Tr,pdf:Nl,html:Ph},Oh={RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"};var Z5=bb(X5(),1);It();const J5=e=>typeof e!="string"?"":e.trim(),Mv=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Rw=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Rd=e=>{const t=e??{},n=J5(t.id),r=Mv(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},Mw=({current:e,other:t})=>{const n=Rd(e),r=Rd(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Nc=({actor:e,fallbackKey:t=""})=>{const n=Rd(e);if(n.hasId)return`id:${n.id}`;if(n.hasEmail)return`email:${n.email}`;const r=typeof t=="number"?String(t):typeof t=="string"?t.trim():"";return r?`fallback:${r}`:""};function $5(e){return typeof e.captureStackTrace=="function"}var Fh=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",$5(Error)&&Error.captureStackTrace(this,this.constructor)}},e6=class extends Fh{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},t6=class extends Fh{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}};const Lv=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new e6(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new t6(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Fh?r:new Fh("Failed to create file object",r)}};function n6(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,s=r[o]||0;if(i>s)return 1;if(i<s)return-1}return 0}var Bh=new WeakMap;function Lw(e){return e.ownerDocument??document}function Dw(e,t){const n=Bh.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Bh.delete(t))}function Pw(e,t){const n=Lw(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&Dw(e,e.__clickOutsideDocument);let r=Bh.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Bh.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Dv={mounted(e,t){Pw(e,t)},updated(e,t){Pw(e,t)},unmounted(e){Dw(e,e.__clickOutsideDocument??Lw(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function r6(e){return e[1].user!==void 0}const o6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(r6).filter(([r,o])=>{const i=Nc({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Nc({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},i6=e=>{for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e};It();var BU=!1;function NU(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}var Ow,Md=e=>Ow=e,Fw=Symbol();function Pv(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Ld;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Ld||(Ld={}));var s6=typeof window<"u",Bw=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function a6(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function Ov(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){l6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function Nw(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Nh(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}var zh=typeof navigator=="object"?navigator:{userAgent:""},zw=/Macintosh/.test(zh.userAgent)&&/AppleWebKit/.test(zh.userAgent)&&!/Safari/.test(zh.userAgent),l6=s6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!zw?c6:"msSaveOrOpenBlob"in zh?u6:d6:()=>{};function c6(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?Nw(r.href)?Ov(e,t,n):(r.target="_blank",Nh(r)):Nh(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Nh(r)},0))}function u6(e,t="download",n){if(typeof e=="string")if(Nw(e))Ov(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Nh(r)})}else navigator.msSaveOrOpenBlob(a6(e,n),t)}function d6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Ov(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(Bw.HTMLElement))||"safari"in Bw,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||zw)&&typeof FileReader<"u"){const a=new FileReader;a.onloadend=function(){let l=a.result;if(typeof l!="string")throw r=null,new Error("Wrong reader.result type");l=s?l:l.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=l:location.assign(l),r=null},a.readAsDataURL(e)}else{const a=URL.createObjectURL(e);r?r.location.assign(a):location.href=a,r=null,setTimeout(function(){URL.revokeObjectURL(a)},4e4)}}var{assign:zU}=Object;function f6(){const e=Um(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Gr({install(i){Md(o),o._a=i,i.provide(Fw,o),i.config.globalProperties.$pinia=o,r.forEach(s=>n.push(s)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var Hw=()=>{};function Uw(e,t,n,r=Hw){e.push(t);const o=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),r())};return!n&&Vm()&&Db(o),o}function zc(e,...t){e.slice().forEach(n=>{n(...t)})}var h6=e=>e(),Vw=Symbol(),Fv=Symbol();function Bv(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];Pv(o)&&Pv(r)&&e.hasOwnProperty(n)&&!tr(r)&&!_i(r)?e[n]=Bv(o,r):e[n]=r}return e}var p6=Symbol();function m6(e){return!Pv(e)||!e.hasOwnProperty(p6)}var{assign:Ba}=Object;function g6(e){return!!(tr(e)&&e.effect)}function v6(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){return a||(n.state.value[e]=o?o():{}),Ba(Gb(n.state.value[e]),i,Object.keys(s||{}).reduce((c,d)=>(c[d]=Gr(Ae(()=>{Md(n);const h=n._s.get(e);return s[d].call(h,h)})),c),{}))}return l=jw(e,u,t,n,r,!0),l}function jw(e,t,n={},r,o,i){let s;const a=Ba({actions:{}},n),l={deep:!0};let u,c,d=[],h=[],m;const p=r.state.value[e];!i&&!p&&(r.state.value[e]={});let g;function k(M){let H;u=c=!1,typeof M=="function"?(M(r.state.value[e]),H={type:Ld.patchFunction,storeId:e,events:m}):(Bv(r.state.value[e],M),H={type:Ld.patchObject,payload:M,storeId:e,events:m});const B=g=Symbol();St().then(()=>{g===B&&(u=!0)}),c=!0,zc(d,H,r.state.value[e])}const w=i?function(){const{state:H}=n,B=H?H():{};this.$patch(z=>{Ba(z,B)})}:Hw;function S(){s.stop(),d=[],h=[],r._s.delete(e)}const y=(M,H="")=>{if(Vw in M)return M[Fv]=H,M;const B=function(){Md(r);const z=Array.from(arguments),X=[],P=[];function N(Y){X.push(Y)}function I(Y){P.push(Y)}zc(h,{args:z,name:B[Fv],store:T,after:N,onError:I});let L;try{L=M.apply(this&&this.$id===e?this:T,z)}catch(Y){throw zc(P,Y),Y}return L instanceof Promise?L.then(Y=>(zc(X,Y),Y)).catch(Y=>(zc(P,Y),Promise.reject(Y))):(zc(X,L),L)};return B[Vw]=!0,B[Fv]=H,B},C={_p:r,$id:e,$onAction:Uw.bind(null,h),$patch:k,$reset:w,$subscribe(M,H={}){const B=Uw(d,M,H.detached,()=>z()),z=s.run(()=>Pt(()=>r.state.value[e],X=>{(H.flush==="sync"?c:u)&&M({storeId:e,type:Ld.direct,events:m},X)},Ba({},l,H)));return B},$dispose:S},T=jr(C);r._s.set(e,T);const R=(r._a&&r._a.runWithContext||h6)(()=>r._e.run(()=>(s=Um()).run(()=>t({action:y}))));for(const M in R){const H=R[M];if(tr(H)&&!g6(H)||_i(H))i||(p&&m6(H)&&(tr(H)?H.value=p[M]:Bv(H,p[M])),r.state.value[e][M]=H);else if(typeof H=="function"){const B=y(H,M);R[M]=B,a.actions[M]=H}}return Ba(T,R),Ba(pn(T),R),Object.defineProperty(T,"$state",{get:()=>r.state.value[e],set:M=>{k(H=>{Ba(H,M)})}}),r._p.forEach(M=>{Ba(T,s.run(()=>M({store:T,app:r._a,pinia:r,options:a})))}),p&&i&&n.hydrate&&n.hydrate(T.$state,p),u=!0,c=!0,T}function Gw(e,t,n){let r,o;const i=typeof t=="function";typeof e=="string"?(r=e,o=i?n:t):(o=e,r=e.id);function s(a,l){const u=y2();return a=a||(u?Ea(Fw,null):null),a&&Md(a),a=Ow,a._s.has(r)||(i?jw(r,t,o,a):v6(r,o,a)),a._s.get(r)}return s.$id=r,s}function Hs(e){{const t=pn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ae({get:()=>e[r],set(i){e[r]=i}}):(tr(o)||_i(o))&&(n[r]=Qm(e,r))}return n}}const Dd=e=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const t=e.name||"document";return new File([e],t,{type:e.type})}return e}return e.originFileObj?Dd(e.originFileObj):e.file?Dd(e.file):e.raw?Dd(e.raw):null};var Ww=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Tr:t.endsWith(".pdf")?Nl:t.endsWith(".html")||t.endsWith(".htm")?Ph:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""};const Pd=e=>{const t=Dd(e);if(t){const n=t.name||e&&e.name||"document";return{type:t.type||Ww(n)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:t,name:n}}if(e&&typeof e=="object"&&"data"in e){const n=Dd(e.data);if(n){const r=e.type||n.type||Ww(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";return{...e,type:r,data:n,name:e.name||n.name||"document"}}}return e};It();function y6(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?jr({...t}):ne(t),i=ne(null);return Pt(o,(a,l)=>{i.value={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r}}),{value:o}}function b6(e){const t=ne(e.itemid),n=ne(e.itemicon),r=ne(e.itemiconpack),o=ne(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=y6(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),c=e,d=jr({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),h=ne(e.logicrules),m=ne(!1),p=jr({}),g={SELECT:C6,IMAGEINPUT:w6,CHECKBOXINPUT:_6};return l.value in g&&Object.assign(p,g[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:ne(e.itemformat),logicRules:h,hidden:m,originalJSON:c,fieldStyle:d,valueGetter:e.valueGetter,...p}}function w6(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function C6(e){return{options:ne(e.itemoptions)}}function _6(e){const t=ne(e.itemoptions);return t.value&&(t.value=t.value.map(n=>({label:n.itemdisplaylabel,value:n.itemlinkvalue,checked:n.ischecked,id:n.itemid,annotationId:n.annotationId}))),{options:t}}const ls=()=>new Map,Nv=e=>{const t=ls();return e.forEach((n,r)=>{t.set(r,n)}),t},Hc=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},S6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},k6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Uc=()=>new Set,zv=e=>e[e.length-1],Vc=Array.from,Hv=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Kw=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},A6=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Od=Array.isArray;var I6=class{constructor(){this._observers=ls()}on(e,t){return Hc(this._observers,e,Uc).add(t),t}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Vc((this._observers.get(e)||ls()).values()).forEach(n=>n(...t))}destroy(){this._observers=ls()}};const Us=Math.floor,Hh=Math.abs,qw=(e,t)=>e<t?e:t,jc=(e,t)=>e>t?e:t,HU=Number.isNaN,E6=e=>e!==0?e<0:1/e<0,UU=1,VU=2,jU=4,GU=8,WU=32,KU=64,qU=128,x6=1<<17,T6=1<<18,R6=1<<19,M6=1<<20,L6=1<<21,D6=1<<22,P6=1<<23,O6=1<<24,F6=1<<25,B6=1<<26,N6=1<<27,z6=1<<28,H6=1<<29,U6=1<<30,YU=1<<31,XU=31,QU=63,ZU=127,JU=x6-1,$U=T6-1,eV=R6-1,tV=M6-1,nV=L6-1,rV=D6-1,oV=P6-1,iV=O6-1,sV=F6-1,aV=B6-1,lV=N6-1,cV=z6-1,uV=H6-1,dV=U6-1,V6=2147483647,j6=4294967295,Yw=Number.MAX_SAFE_INTEGER,Xw=Number.MIN_SAFE_INTEGER,fV=1<<31,hV=V6,pV=j6,G6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Us(e)===e),mV=Number.isNaN,gV=Number.parseInt,Qw=String.fromCharCode,vV=String.fromCodePoint,yV=Qw(65535);var W6=e=>e.toLowerCase(),K6=/^\s*/g;const q6=e=>e.replace(K6,"");var Y6=/([A-Z])/g;const Zw=(e,t)=>q6(e.replace(Y6,n=>`${t}${W6(n)}`)),X6=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Fd=typeof TextEncoder<"u"?new TextEncoder:null,Q6=Fd?e=>Fd.encode(e):X6;let Uv=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Uv&&Uv.decode(new Uint8Array).length===1&&(Uv=null);const Z6=(e,t)=>A6(t,()=>e).join("");var Bd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const Vv=()=>new Bd,J6=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Vs=e=>{const t=new Uint8Array(J6(e));let n=0;for(let r=0;r<e.bufs.length;r++){const o=e.bufs[r];t.set(o,n),n+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},$6=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(jc(n,t)*2),e.cpos=0)},no=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},jv=no,Kn=(e,t)=>{for(;t>127;)no(e,128|127&t),t=Us(t/128);no(e,127&t)},Gv=(e,t)=>{const n=E6(t);for(n&&(t=-t),no(e,(t>63?128:0)|(n?64:0)|63&t),t=Us(t/64);t>0;)no(e,(t>127?128:0)|127&t),t=Us(t/128)};var Wv=new Uint8Array(3e4),eE=Wv.length/3;const tE=(e,t)=>{if(t.length<eE){const n=Fd.encodeInto(t,Wv).written||0;Kn(e,n);for(let r=0;r<n;r++)no(e,Wv[r])}else ci(e,Q6(t))},nE=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Kn(e,r);for(let o=0;o<r;o++)no(e,n.codePointAt(o))},Gc=Fd&&Fd.encodeInto?tE:nE,Kv=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=qw(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(jc(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},ci=(e,t)=>{Kn(e,t.byteLength),Kv(e,t)},qv=(e,t)=>{$6(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},rE=(e,t)=>qv(e,4).setFloat32(0,t,!1),oE=(e,t)=>qv(e,8).setFloat64(0,t,!1),iE=(e,t)=>qv(e,8).setBigInt64(0,t,!1);var Jw=new DataView(new ArrayBuffer(4)),sE=e=>(Jw.setFloat32(0,e),Jw.getFloat32(0)===e);const Nd=(e,t)=>{switch(typeof t){case"string":no(e,119),Gc(e,t);break;case"number":G6(t)&&Hh(t)<=2147483647?(no(e,125),Gv(e,t)):sE(t)?(no(e,124),rE(e,t)):(no(e,123),oE(e,t));break;case"bigint":no(e,122),iE(e,t);break;case"object":if(t===null)no(e,126);else if(Od(t)){no(e,117),Kn(e,t.length);for(let n=0;n<t.length;n++)Nd(e,t[n])}else if(t instanceof Uint8Array)no(e,116),ci(e,t);else{no(e,118);const n=Object.keys(t);Kn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Gc(e,o),Nd(e,t[o])}}break;case"boolean":no(e,t?120:121);break;default:no(e,127)}};var $w=class extends Bd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Kn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},e3=e=>{e.count>0&&(Gv(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Kn(e.encoder,e.count-2))},Uh=class{constructor(){this.encoder=new Bd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(e3(this),this.count=1,this.s=e)}toUint8Array(){return e3(this),Vs(this.encoder)}},t3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Gv(e.encoder,t),e.count>1&&Kn(e.encoder,e.count-2)}},Yv=class{constructor(){this.encoder=new Bd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(t3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return t3(this),Vs(this.encoder)}},aE=class{constructor(){this.sarr=[],this.s="",this.lensE=new Uh}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Bd;return this.sarr.push(this.s),this.s="",Gc(e,this.sarr.join("")),Kv(e,this.lensE.toUint8Array()),Vs(e)}};const Na=e=>new Error(e),zi=()=>{throw Na("Method unimplemented")},js=()=>{throw Na("Unexpected case")},wV=crypto.subtle,lE=crypto.getRandomValues.bind(crypto),n3=()=>lE(new Uint32Array(1))[0];var cE="10000000-1000-4000-8000-100000000000";const uE=()=>cE.replace(/[018]/g,e=>(e^n3()&15>>e/4).toString(16)),dE=Date.now,r3=e=>new Promise(e),CV=Promise.all.bind(Promise),o3=e=>e===void 0?null:e;var fE=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},i3=new fE,hE=!0;try{typeof localStorage<"u"&&localStorage&&(i3=localStorage,hE=!1)}catch{}const pE=i3,zd=Symbol("Equality"),s3=(e,t)=>e===t||!!e?.[zd]?.(t)||!1,mE=e=>typeof e=="object",gE=Object.assign,vE=Object.keys,yE=(e,t)=>{for(const n in e)t(e[n],n)},Vh=e=>vE(e).length,bE=e=>{for(const t in e)return!1;return!0},Hd=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},Xv=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),wE=(e,t)=>e===t||Vh(e)===Vh(t)&&Hd(e,(n,r)=>(n!==void 0||Xv(t,r))&&s3(t[r],n)),CE=Object.freeze,a3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&a3(e[t])}return CE(e)},Qv=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Qv(e,t,n+1)}},jh=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[zd]!=null)return e[zd](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!jh(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Vh(e)!==Vh(t))return!1;for(const n in e)if(!Xv(e,n)||!jh(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!jh(e[n],t[n]))return!1;break;default:return!1}return!0},_E=(e,t)=>t.includes(e),_V=Od,Ud=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",SV=typeof navigator<"u"?/Mac/.test(navigator.platform):!1;var cs,SE=[],kE=()=>{if(cs===void 0)if(Ud){cs=ls();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&cs.set(t,""),t=r):t!==null?(cs.set(t,r),t=null):SE.push(r)}t!==null&&cs.set(t,"")}else typeof location=="object"?(cs=ls(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");cs.set(`--${Zw(t,"-")}`,n),cs.set(`-${Zw(t,"-")}`,n)}})):cs=ls();return cs};const Zv=e=>kE().has(e),Gh=e=>o3(Ud?process.env[e.toUpperCase().replaceAll("-","_")]:pE.getItem(e)),l3=e=>Zv("--"+e)||Gh(e)!==null,AE=l3("production");var IE=Ud&&_E(process.env.FORCE_COLOR,["true","1","2"]);const EE=IE||!Zv("--no-colors")&&!l3("no-color")&&(!Ud||process.stdout.isTTY)&&(!Ud||Zv("--color")||Gh("COLORTERM")!==null||(Gh("TERM")||"").includes("color"));var xE=class{constructor(e,t){this.left=e,this.right=t}};const Gs=(e,t)=>new xE(e,t),c3=e=>e.next()>=.5,Jv=(e,t,n)=>Us(e.next()*(n+1-t)+t),u3=(e,t,n)=>Us(e.next()*(n+1-t)+t),$v=(e,t,n)=>u3(e,t,n),TE=e=>Qw($v(e,97,122)),RE=(e,t=0,n=20)=>{const r=$v(e,t,n);let o="";for(let i=0;i<r;i++)o+=TE(e);return o},ey=(e,t)=>t[$v(e,0,t.length-1)];var ME=Symbol("0schema"),LE=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const n=this._rerrs[t];e.push(Z6(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
|
+
`)}},ty=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[zd]?s3(e,t):Od(e)?Hv(e,n=>Kw(t,r=>ty(n,r))):mE(e)?Hd(e,(n,r)=>ty(n,t[r])):!1,Bo=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),ty(t,n)}equals(e){return this.constructor===e.constructor&&jh(this.shape,e.shape)}[ME](){return!0}[zd](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){zi()}get nullable(){return Wc(this,Qh)}get optional(){return new h3(this)}cast(e){return E3(e,this),e}expect(e){return E3(e,this),e}},ny=class extends Bo{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}};const Pr=(e,t=null)=>new ny(e,t),kV=Pr(ny);var ry=class extends Bo{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape(e);return!n&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}};const ro=e=>new ry(e),AV=Pr(ry);var Wh=class extends Bo{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape.some(r=>r===e);return!n&&t?.extend(null,this.shape.join(" | "),e.toString()),n}};const Kh=(...e)=>new Wh(e),d3=Pr(Wh);var DE=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),f3=e=>{if(qc.check(e))return[DE(e)];if(d3.check(e))return e.shape.map(t=>t+"");if(k3.check(e))return["[+-]?\\d+.?\\d*"];if(A3.check(e))return[".*"];if(qh.check(e))return e.shape.map(f3).flat(1);js()},PE=class extends Bo{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(f3).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),n}};const IV=Pr(PE);var OE=Symbol("optional"),h3=class extends Bo{constructor(e){super(),this.shape=e}check(e,t){const n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,"undefined (optional)","()"),n}get[OE](){return!0}};const FE=Pr(h3);var p3=class extends Bo{check(e,t){return t?.extend(null,"never",typeof e),!1}};const EV=new p3,xV=Pr(p3);var m3=class LA extends Bo{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new LA(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Hd(this.shape,(r,o)=>{const i=this._isPartial&&!Xv(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}};const BE=e=>new m3(e),NE=Pr(m3),zE=ro(e=>e!=null&&(e.constructor===Object||e.constructor==null));var g3=class extends Bo{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Hd(e,(n,r)=>{const o=this.shape.keys.check(r,t);return!o&&t?.extend(r+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(n,t)})}};const v3=(e,t)=>new g3(e,t),HE=Pr(g3);var y3=class extends Bo{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Hd(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}};const UE=(...e)=>new y3(e),TV=Pr(y3);var b3=class extends Bo{constructor(e){super(),this.shape=e.length===1?e[0]:new oy(e)}check(e,t){const n=Od(e)&&Hv(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}};const w3=(...e)=>new b3(e),VE=Pr(b3),jE=ro(e=>Od(e));var C3=class extends Bo{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}};const GE=(e,t=null)=>new C3(e,t),RV=Pr(C3),WE=GE(Bo);var KE=class extends Bo{constructor(e){super(),this.len=e.length-1,this.args=UE(...e.slice(-1)),this.res=e[this.len]}check(e,t){const n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,"function",typeof e),n}};const qE=Pr(KE),YE=ro(e=>typeof e=="function");var XE=class extends Bo{constructor(e){super(),this.shape=e}check(e,t){const n=Hv(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}};const MV=Pr(XE,e=>e.shape.length>0);var oy=class extends Bo{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=Kw(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}};const Wc=(...e)=>e.findIndex(t=>qh.check(t))>=0?Wc(...e.map(t=>Vd(t)).map(t=>qh.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new oy(e),qh=Pr(oy);var _3=()=>!0;const Yh=ro(_3),QE=Pr(ry,e=>e.shape===_3),iy=ro(e=>typeof e=="bigint"),ZE=ro(e=>e===iy),S3=ro(e=>typeof e=="symbol"),LV=ro(e=>e===S3),Kc=ro(e=>typeof e=="number"),k3=ro(e=>e===Kc),qc=ro(e=>typeof e=="string"),A3=ro(e=>e===qc),Xh=ro(e=>typeof e=="boolean"),JE=ro(e=>e===Xh),I3=Kh(void 0),DV=Pr(Wh,e=>e.shape.length===1&&e.shape[0]===void 0),PV=Kh(void 0),Qh=Kh(null),$E=Pr(Wh,e=>e.shape.length===1&&e.shape[0]===null),OV=Pr(Uint8Array),FV=Pr(ny,e=>e.shape===Uint8Array),ex=Wc(Kc,qc,Qh,I3,iy,Xh,S3),BV=(()=>{const e=w3(Yh),t=v3(qc,Yh),n=Wc(Kc,qc,Qh,Xh,e,t);return e.shape=n,t.shape.values=n,n})(),Vd=e=>{if(WE.check(e))return e;if(zE.check(e)){const t={};for(const n in e)t[n]=Vd(e[n]);return BE(t)}else{if(jE.check(e))return Wc(...e.map(Vd));if(ex.check(e))return Kh(e);if(YE.check(e))return Pr(e)}js()},E3=AE?()=>{}:(e,t)=>{const n=new LE;if(!t.check(e,n))throw Na(`Expected value to be of type ${t.constructor.name}.
|
|
6
|
+
${n.toString()}`)};var tx=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Vd(e),h:t}),this}else(e){return this.if(Yh,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){const r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw Na("Unhandled pattern")}}},x3=(e=>new tx(e))(Yh).if(k3,(e,t)=>Jv(t,Xw,Yw)).if(A3,(e,t)=>RE(t)).if(JE,(e,t)=>c3(t)).if(ZE,(e,t)=>BigInt(Jv(t,Xw,Yw))).if(qh,(e,t)=>Yc(t,ey(t,e.shape))).if(NE,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(FE.check(o)){if(c3(t))continue;o=o.shape}n[r]=x3(o,t)}return n}).if(VE,(e,t)=>{const n=[],r=u3(t,0,42);for(let o=0;o<r;o++)n.push(Yc(t,e.shape));return n}).if(d3,(e,t)=>ey(t,e.shape)).if($E,(e,t)=>null).if(qE,(e,t)=>{const n=Yc(t,e.res);return()=>n}).if(QE,(e,t)=>Yc(t,ey(t,[Kc,qc,Qh,I3,iy,Xh,w3(Kc),v3(Wc("a","b","c"),Kc)]))).if(HE,(e,t)=>{const n={},r=Jv(t,0,3);for(let o=0;o<r;o++){const i=Yc(t,e.shape.keys);n[i]=Yc(t,e.shape.values)}return n}).done();const Yc=(e,t)=>x3(Vd(t),e),zl=typeof document<"u"?document:{},zV=ro(e=>e.nodeType===sx),HV=typeof DOMParser<"u"?new DOMParser:null,UV=ro(e=>e.nodeType===rx),VV=ro(e=>e.nodeType===ox),nx=e=>S6(e,(t,n)=>`${n}:${t};`).join(""),rx=zl.ELEMENT_NODE,ox=zl.TEXT_NODE,jV=zl.CDATA_SECTION_NODE,GV=zl.COMMENT_NODE,ix=zl.DOCUMENT_NODE,WV=zl.DOCUMENT_TYPE_NODE,sx=zl.DOCUMENT_FRAGMENT_NODE,KV=ro(e=>e.nodeType===ix),Ws=Symbol,T3=Ws(),R3=Ws(),ax=Ws(),lx=Ws(),cx=Ws(),M3=Ws(),ux=Ws(),sy=Ws(),dx=Ws(),fx=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const o=e[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const o=e[r];o instanceof Symbol||n.push(o)}return n};var qV=dE(),hx={[T3]:Gs("font-weight","bold"),[R3]:Gs("font-weight","normal"),[ax]:Gs("color","blue"),[cx]:Gs("color","green"),[lx]:Gs("color","grey"),[M3]:Gs("color","red"),[ux]:Gs("color","purple"),[sy]:Gs("color","orange"),[dx]:Gs("color","black")},px=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=ls();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=hx[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=nx(r);i>0||l.length>0?(t.push("%c"+s),n.push(l)):t.push(s)}else break}}for(i>0&&(o=n,o.unshift(t.join("")));i<e.length;i++){const s=e[i];s instanceof Symbol||o.push(s)}return o},L3=EE?px:fx;const mx=(...e)=>{console.log(...L3(e)),D3.forEach(t=>t.print(e))},gx=(...e)=>{console.warn(...L3(e)),e.unshift(sy),D3.forEach(t=>t.print(e))},D3=Uc(),P3=e=>({[Symbol.iterator](){return this},next:e}),vx=(e,t)=>P3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),ay=(e,t)=>P3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});var O3=class{constructor(e,t){this.clock=e,this.len=t}},F3=class{constructor(){this.clients=new Map}},B3=(e,t,n)=>t.clients.forEach((r,o)=>{const i=e.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])Y3(e,i,u.clock,u.len,n)}}),yx=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=Us((n+r)/2),i=e[o],s=i.clock;if(s<=t){if(t<s+i.len)return o;n=o+1}else r=o-1}return null},N3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&yx(n,t.clock)!==null},z3=e=>{e.clients.forEach(t=>{t.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const o=t[r-1],i=t[n];o.clock+o.len>=i.clock?t[r-1]=new O3(o.clock,jc(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},H3=(e,t,n,r)=>{Hc(e.clients,t,()=>[]).push(new O3(n,r))},bx=()=>new F3,wx=(e,t)=>{Kn(e.restEncoder,t.clients.size),Vc(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),Kn(e.restEncoder,n);const o=r.length;Kn(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},U3=n3,ly=class DA extends I6{constructor({guid:t=uE(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=U3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Lx,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=r3(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>r3(u=>{const c=d=>{(d===void 0||d===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&ir(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Vc(this.subdocs).map(t=>t.guid))}transact(t,n=null){return ir(this,t,n)}get(t,n=po){const r=Hc(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==po&&o!==n)if(o===po){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,Kx)}getText(t=""){return this.get(t,Jx)}getMap(t=""){return this.get(t,gy)}getXmlElement(t=""){return this.get(t,vC)}getXmlFragment(t=""){return this.get(t,wy)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Vc(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new DA({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,ir(t.parent.doc,r=>{const o=n.doc;t.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},Cx=class{constructor(){this.restEncoder=Vv()}toUint8Array(){return Vs(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Kn(this.restEncoder,e)}writeDsLen(e){Kn(this.restEncoder,e)}},_x=class extends Cx{writeLeftID(e){Kn(this.restEncoder,e.client),Kn(this.restEncoder,e.clock)}writeRightID(e){Kn(this.restEncoder,e.client),Kn(this.restEncoder,e.clock)}writeClient(e){Kn(this.restEncoder,e)}writeInfo(e){jv(this.restEncoder,e)}writeString(e){Gc(this.restEncoder,e)}writeParentInfo(e){Kn(this.restEncoder,e?1:0)}writeTypeRef(e){Kn(this.restEncoder,e)}writeLen(e){Kn(this.restEncoder,e)}writeAny(e){Nd(this.restEncoder,e)}writeBuf(e){ci(this.restEncoder,e)}writeJSON(e){Gc(this.restEncoder,JSON.stringify(e))}writeKey(e){Gc(this.restEncoder,e)}},Sx=class{constructor(){this.restEncoder=Vv(),this.dsCurrVal=0}toUint8Array(){return Vs(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Kn(this.restEncoder,t)}writeDsLen(e){e===0&&js(),Kn(this.restEncoder,e-1),this.dsCurrVal+=e}},kx=class extends Sx{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Yv,this.clientEncoder=new Uh,this.leftClockEncoder=new Yv,this.rightClockEncoder=new Yv,this.infoEncoder=new $w(jv),this.stringEncoder=new aE,this.parentInfoEncoder=new $w(jv),this.typeRefEncoder=new Uh,this.lenEncoder=new Uh}toUint8Array(){const e=Vv();return Kn(e,0),ci(e,this.keyClockEncoder.toUint8Array()),ci(e,this.clientEncoder.toUint8Array()),ci(e,this.leftClockEncoder.toUint8Array()),ci(e,this.rightClockEncoder.toUint8Array()),ci(e,Vs(this.infoEncoder)),ci(e,this.stringEncoder.toUint8Array()),ci(e,Vs(this.parentInfoEncoder)),ci(e,this.typeRefEncoder.toUint8Array()),ci(e,this.lenEncoder.toUint8Array()),Kv(e,Vs(this.restEncoder)),Vs(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Nd(this.restEncoder,e)}writeBuf(e){ci(this.restEncoder,e)}writeJSON(e){Nd(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},Ax=(e,t,n,r)=>{r=jc(r,t[0].id.clock);const o=Ks(t,r);Kn(e.restEncoder,t.length-o),e.writeClient(n),Kn(e.restEncoder,r);const i=t[o];i.write(e,r-i.id.clock);for(let s=o+1;s<t.length;s++)t[s].write(e,0)},Ix=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{Zo(t,i)>o&&r.set(i,o)}),uy(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Kn(e.restEncoder,r.size),Vc(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{Ax(e,t.clients.get(o),o,i)})},Ex=(e,t)=>Ix(e,t.doc.store,t.beforeState),xx=class{constructor(){this.l=[]}},V3=()=>new xx,j3=(e,t)=>e.l.push(t),G3=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(o=>t!==o),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},W3=(e,t,n)=>Qv(e.l,[t,n]),Zh=class{constructor(e,t){this.client=e,this.clock=t}},Jh=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,kr=(e,t)=>new Zh(e,t),Tx=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw js()},Rx=class{constructor(e,t){this.ds=e,this.sv=t}},Mx=(e,t)=>new Rx(e,t),YV=Mx(bx(),new Map),Xc=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!N3(t.ds,e.id),cy=(e,t)=>{const n=Hc(e.meta,cy,Uc),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<Zo(r,i)&&za(e,kr(i,o))}),B3(e,t.ds,o=>{}),n.add(t))},Lx=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},uy=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const o=n[n.length-1];t.set(r,o.id.clock+o.length)}),t},Zo=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},K3=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw js()}n.push(t)},Ks=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=Us(t/(i+o.length-1)*r);for(;n<=r;){if(o=e[s],i=o.id.clock,i<=t){if(t<i+o.length)return s;n=s+1}else r=s-1;s=Us((n+r)/2)}throw js()},Dx=(e,t)=>{const n=e.clients.get(t.client);return n[Ks(n,t.clock)]},dy=Dx,fy=(e,t,n)=>{const r=Ks(t,n),o=t[r];return o.id.clock<n&&o instanceof ui?(t.splice(r+1,0,CC(e,o,n-o.id.clock)),r+1):r},za=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[fy(e,n,t.clock)]},q3=(e,t,n)=>{const r=t.clients.get(n.client),o=Ks(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Ua&&r.splice(o+1,0,CC(e,i,n.clock-i.id.clock+1)),i},Px=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Ks(r,t.id.clock)]=n},Y3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=fy(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&fy(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},Ox=class{constructor(e,t,n){this.doc=e,this.deleteSet=new F3,this.beforeState=uy(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},X3=(e,t)=>t.deleteSet.clients.size===0&&!k6(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(z3(t.deleteSet),Ex(e,t),wx(e,t.deleteSet),!0),Q3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Hc(e.changed,t,Uc).add(n)},$h=(e,t)=>{let n=e[t],r=e[t-1],o=t;for(;o>0;n=r,r=e[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof ui&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=t-o;return i&&e.splice(t+1-i,i),i},Fx=(e,t,n)=>{for(const[r,o]of e.clients.entries()){const i=t.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let u=Ks(i,a.clock),c=i[u];u<i.length&&c.id.clock<l;c=i[++u]){const d=i[u];if(a.clock+a.len<=d.id.clock)break;d instanceof ui&&d.deleted&&!d.keep&&n(d)&&d.gc(t,!1)}}}},Bx=(e,t)=>{e.clients.forEach((n,r)=>{const o=t.clients.get(r);for(let i=n.length-1;i>=0;i--){const s=n[i],a=qw(o.length-1,1+Ks(o,s.clock+s.len-1));for(let l=a,u=o[l];l>0&&u.id.clock>=s.clock;u=o[l])l-=1+$h(o,l)}})},Z3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{z3(i),n.afterState=uy(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,d)=>c.path.length-d.path.length),a.push(()=>{W3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&Qx(n)})}),Qv(a,[])}finally{r.gc&&Fx(i,o,r.gcFilter),Bx(i,o),n.afterState.forEach((c,d)=>{const h=n.beforeState.get(d)||0;if(h!==c){const m=o.clients.get(d),p=jc(Ks(m,h),1);for(let g=m.length-1;g>=p;)g-=1+$h(m,g)}});for(let c=s.length-1;c>=0;c--){const{client:d,clock:h}=s[c].id,m=o.clients.get(d),p=Ks(m,h);p+1<m.length&&$h(m,p+1)>1||p>0&&$h(m,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(mx(sy,T3,"[yjs] ",R3,M3,"Changed the client-id because another client seems to be using it."),r.clientID=U3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new _x;X3(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new kx;X3(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):Z3(e,t+1)}}},ir=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new Ox(e,n,r),o.push(e._transaction),o.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction)}finally{if(i){const a=e._transaction===o[0];e._transaction=null,a&&Z3(o,0)}}return s},J3="You must not compute changes after the event-handler fired.",ep=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Nx(this.currentTarget,this.target))}deletes(e){return N3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Na(J3);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){const r=t._map.get(n);let o,i;if(this.adds(r)){let s=r.left;for(;s!==null&&this.adds(s);)s=s.left;if(this.deletes(r))if(s!==null&&this.deletes(s))o="delete",i=zv(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=zv(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=zv(r.content.getContent());else return;e.set(n,{action:o,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Na(J3);const t=this.target,n=Uc(),r=Uc(),o=[];if(e={added:n,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null;const s=()=>{i&&o.push(i)};for(let a=t._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((i===null||i.delete===void 0)&&(s(),i={delete:0}),i.delete+=a.length,r.add(a)):this.adds(a)?((i===null||i.insert===void 0)&&(s(),i={insert:[]}),i.insert=i.insert.concat(a.content.getContent()),n.add(a)):((i===null||i.retain===void 0)&&(s(),i={retain:0}),i.retain+=a.length);i!==null&&i.retain===void 0&&s()}this._changes=e}return e}},Nx=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,o=t._item.parent._start;for(;o!==t._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}t=t._item.parent}return n},Io=()=>{gx("Invalid access: Add Yjs type to a document before reading data.")},$3=80,hy=0,zx=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=hy++}},Hx=e=>{e.timestamp=hy++},eC=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=hy++},Ux=(e,t,n)=>{if(e.length>=$3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return eC(r,t,n),r}else{const r=new zx(t,n);return e.push(r),r}},tp=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,s)=>Hh(t-i.index)<Hh(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,Hx(n));r.right!==null&&o<t;){if(!r.deleted&&r.countable){if(t<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>t;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);return n!==null&&Hh(n.index-o)<r.parent.length/$3?(eC(n,r,o),n):Ux(e._searchMarker,r,o)},jd=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const o=e[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){e.splice(r,1);continue}o.p=i,i.marker=!0}(t<o.index||n>0&&t===o.index)&&(o.index=jc(t,o.index+n))}},np=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;Hc(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;W3(r._eH,n,t)},po=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=V3(),this._dEH=V3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw zi()}clone(){throw zi()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){j3(this._eH,e)}observeDeep(e){j3(this._dEH,e)}unobserve(e){G3(this._eH,e)}unobserveDeep(e){G3(this._dEH,e)}toJSON(){}},tC=(e,t,n)=>{e.doc??Io(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const o=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)o.push(s[a]),r--;t=0}}i=i.right}return o},nC=e=>{e.doc??Io();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)t.push(r[o])}n=n.right}return t},Gd=(e,t)=>{let n=0,r=e._start;for(e.doc??Io();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)t(o[i],n++,e)}r=r.right}},rC=(e,t)=>{const n=[];return Gd(e,(r,o)=>{n.push(t(r,o,e))}),n},Vx=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},oC=(e,t)=>{e.doc??Io();const n=tp(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},rp=(e,t,n,r)=>{let o=n;const i=e.doc,s=i.clientID,a=i.store,l=n===null?t._start:n.right;let u=[];const c=()=>{u.length>0&&(o=new ui(kr(s,Zo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Cy(u)),o.integrate(e,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(c(),d.constructor){case Uint8Array:case ArrayBuffer:o=new ui(kr(s,Zo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new bC(new Uint8Array(d))),o.integrate(e,0);break;case ly:o=new ui(kr(s,Zo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new wC(d)),o.integrate(e,0);break;default:if(d instanceof po)o=new ui(kr(s,Zo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Jc(d)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},iC=()=>Na("Length exceeded!"),sC=(e,t,n,r)=>{if(n>t._length)throw iC();if(n===0)return t._searchMarker&&jd(t._searchMarker,n,r.length),rp(e,t,null,r);const o=n,i=tp(t,n);let s=t._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&za(e,kr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&jd(t._searchMarker,o,r.length),rp(e,t,s,r)},jx=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((o,i)=>i.index>o.index?i:o,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return rp(e,t,r,n)},aC=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=tp(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&za(e,kr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&za(e,kr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw iC();t._searchMarker&&jd(t._searchMarker,o,-i+r)},op=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},py=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new Cy([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new Cy([r]);break;case Uint8Array:a=new bC(r);break;case ly:a=new wC(r);break;default:if(r instanceof po)a=new Jc(r);else throw new Error("Unexpected content type")}new ui(kr(s,Zo(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},my=(e,t)=>{e.doc??Io();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},lC=e=>{const t={};return e.doc??Io(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},cC=(e,t)=>{e.doc??Io();const n=e._map.get(t);return n!==void 0&&!n.deleted},Gx=(e,t)=>{const n={};return e._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Xc(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},ip=e=>(e.doc??Io(),vx(e._map.entries(),t=>!t[1].deleted)),Wx=class extends ep{},Kx=class Tm extends po{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Tm;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Tm}clone(){const t=new Tm;return t.insert(0,this.toArray().map(n=>n instanceof po?n.clone():n)),t}get length(){return this.doc??Io(),this._length}_callObserver(t,n){super._callObserver(t,n),np(this,t,new Wx(this,t))}insert(t,n){this.doc!==null?ir(this.doc,r=>{sC(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?ir(this.doc,n=>{jx(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?ir(this.doc,r=>{aC(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return oC(this,t)}toArray(){return nC(this)}slice(t=0,n=this.length){return tC(this,t,n)}toJSON(){return this.map(t=>t instanceof po?t.toJSON():t)}map(t){return rC(this,t)}forEach(t){Gd(this,t)}[Symbol.iterator](){return Vx(this)}_write(t){t.writeTypeRef(o8)}},qx=class extends ep{constructor(e,t,n){super(e,t),this.keysChanged=n}},gy=class ub extends po{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new ub}clone(){const t=new ub;return this.forEach((n,r)=>{t.set(r,n instanceof po?n.clone():n)}),t}_callObserver(t,n){np(this,t,new qx(this,t,n))}toJSON(){this.doc??Io();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof po?o.toJSON():o}}),t}get size(){return[...ip(this)].length}keys(){return ay(ip(this),t=>t[0])}values(){return ay(ip(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return ay(ip(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Io(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?ir(this.doc,n=>{op(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?ir(this.doc,r=>{py(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return my(this,t)}has(t){return cC(this,t)}clear(){this.doc!==null?ir(this.doc,t=>{this.forEach(function(n,r,o){op(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(i8)}},Ha=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&wE(e,t),vy=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&js(),this.right.content.constructor===Eo?this.right.deleted||Qc(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},uC=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===Eo?t.right.deleted||Qc(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&za(e,kr(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},sp=(e,t,n,r)=>{const o=new Map,i=r?tp(t,n):null;return i?uC(e,new vy(i.p.left,i.p,i.index,o),n-i.index):uC(e,new vy(null,t._start,0,o),n)},dC=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Eo&&Ha(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=e.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,u=n.right,c=new ui(kr(i,Zo(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new Eo(a,s));c.integrate(e,0),n.right=c,n.forward()})},Qc=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},fC=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Eo&&Ha(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},hC=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!Ha(u,l)){s.set(a,u);const{left:c,right:d}=n;n.right=new ui(kr(i,Zo(o.store,i)),c,c&&c.lastId,d,d&&d.id,t,null,new Eo(a,l)),n.right.integrate(e,0),n.forward()}}return s},yy=(e,t,n,r,o)=>{n.currentAttributes.forEach((h,m)=>{o[m]===void 0&&(o[m]=null)});const i=e.doc,s=i.clientID;fC(n,o);const a=hC(e,t,n,o),l=r.constructor===String?new Zc(r):r instanceof po?new Jc(r):new ap(r);let{left:u,right:c,index:d}=n;t._searchMarker&&jd(t._searchMarker,n.index,l.getLength()),c=new ui(kr(s,Zo(i.store,s)),u,u&&u.lastId,c,c&&c.id,t,null,l),c.integrate(e,0),n.right=c,n.index=d,n.forward(),dC(e,t,n,a)},pC=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;fC(n,o);const a=hC(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Eo));){if(!n.right.deleted)switch(n.right.content.constructor){case Eo:{const{key:l,value:u}=n.right.content,c=o[l];if(c!==void 0){if(Ha(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&za(e,kr(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
7
|
+
`;n.right=new ui(kr(s,Zo(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Zc(l)),n.right.integrate(e,0),n.forward()}dC(e,t,n,a)},mC=(e,t,n,r,o)=>{let i=t;const s=ls();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Eo){const u=i.content;s.set(u.key,u)}i=i.right}let a=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const u=t.content;if(u.constructor===Eo){const{key:c,value:d}=u,h=r.get(c)??null;(s.get(c)!==u||h===d)&&(t.delete(e),a++,!l&&(o.get(c)??null)===d&&h!==d&&(h===null?o.delete(c):o.set(c,h))),!l&&!t.deleted&&Qc(o,u)}}t=t.right}return a},Yx=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Eo){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},Xx=e=>{let t=0;return ir(e.doc,n=>{let r=e._start,o=e._start,i=ls();const s=Nv(i);for(;o;)o.deleted===!1&&(o.content.constructor===Eo?Qc(s,o.content):(t+=mC(n,r,o,i,s),i=Nv(s),r=o)),o=o.right}),t},Qx=e=>{const t=new Set,n=e.doc;for(const[r,o]of e.afterState.entries()){const i=e.beforeState.get(r)||0;o!==i&&Y3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===Eo&&s.constructor!==Ua&&t.add(s.parent)})}ir(n,r=>{B3(e,e.deleteSet,o=>{if(o instanceof Ua||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===Eo?t.add(i):Yx(r,o)});for(const o of t)Xx(o)})},gC=(e,t,n)=>{const r=n,o=Nv(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Jc:case ap:case Zc:n<t.right.length&&za(e,kr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&mC(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&jd(s._searchMarker,t.index,-r+n),t},Zx=class extends ep{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];ir(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,c=0;const d=()=>{if(s!==null){let h=null;switch(s){case"delete":c>0&&(h={delete:c}),c=0;break;case"insert":(typeof l=="object"||l.length>0)&&(h={insert:l},r.size>0&&(h.attributes={},r.forEach((m,p)=>{m!==null&&(h.attributes[p]=m)}))),l="";break;case"retain":u>0&&(h={retain:u},bE(a)||(h.attributes=gE({},a))),u=0;break}h&&t.push(h),s=null}};for(;i!==null;){switch(i.content.constructor){case Jc:case ap:this.adds(i)?this.deletes(i)||(d(),s="insert",l=i.content.getContent()[0],d()):this.deletes(i)?(s!=="delete"&&(d(),s="delete"),c+=1):i.deleted||(s!=="retain"&&(d(),s="retain"),u+=1);break;case Zc:this.adds(i)?this.deletes(i)||(s!=="insert"&&(d(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(d(),s="delete"),c+=i.length):i.deleted||(s!=="retain"&&(d(),s="retain"),u+=i.length);break;case Eo:{const{key:h,value:m}=i.content;if(this.adds(i))this.deletes(i)||(Ha(r.get(h)??null,m)?m!==null&&i.delete(n):(s==="retain"&&d(),Ha(m,o.get(h)??null)?delete a[h]:a[h]=m));else if(this.deletes(i)){o.set(h,m);const p=r.get(h)??null;Ha(p,m)||(s==="retain"&&d(),a[h]=p)}else if(!i.deleted){o.set(h,m);const p=a[h];p!==void 0&&(Ha(p,m)?p!==null&&i.delete(n):(s==="retain"&&d(),m===null?delete a[h]:a[h]=m))}i.deleted||(s==="insert"&&d(),Qc(r,i.content));break}}i=i.right}for(d();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},Jx=class db extends po{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Io(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new db}clone(){const t=new db;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new Zx(this,t,n);np(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??Io();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Zc&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?ir(this.doc,r=>{const o=new vy(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const s=t[i];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&i===t.length-1&&o.right===null&&s.insert.slice(-1)===`
|
|
8
|
+
`?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&yy(r,this,o,a,s.attributes||{})}else s.retain!==void 0?pC(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&gC(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??Io();const o=[],i=new Map,s=this.doc;let a="",l=this._start;function u(){if(a.length>0){const d={};let h=!1;i.forEach((p,g)=>{h=!0,d[g]=p});const m={insert:a};h&&(m.attributes=d),o.push(m),a=""}}const c=()=>{for(;l!==null;){if(Xc(l,t)||n!==void 0&&Xc(l,n))switch(l.content.constructor){case Zc:{const d=i.get("ychange");t!==void 0&&!Xc(l,t)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(u(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Xc(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(u(),i.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(u(),i.delete("ychange")),a+=l.content.str;break}case Jc:case ap:{u();const d={insert:l.content.getContent()[0]};if(i.size>0){const h={};d.attributes=h,i.forEach((m,p)=>{h[p]=m})}o.push(d);break}case Eo:Xc(l,t)&&(u(),Qc(i,l.content));break}l=l.right}u()};return t||n?ir(s,d=>{t&&cy(d,t),n&&cy(d,n),c()},"cleanup"):c(),o}insert(t,n,r){if(n.length<=0)return;const o=this.doc;o!==null?ir(o,i=>{const s=sp(i,this,t,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),yy(i,this,s,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const o=this.doc;o!==null?ir(o,i=>{const s=sp(i,this,t,!r);yy(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?ir(r,o=>{gC(o,sp(o,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const o=this.doc;o!==null?ir(o,i=>{const s=sp(i,this,t,!1);s.right!==null&&pC(i,this,s,n,r)}):this._pending.push(()=>this.format(t,n,r))}removeAttribute(t){this.doc!==null?ir(this.doc,n=>{op(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?ir(this.doc,r=>{py(r,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return my(this,t)}getAttributes(){return lC(this)}_write(t){t.writeTypeRef(s8)}},by=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Io()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===vC||t.constructor===wy)&&t._start!==null)e=t._start;else for(;e!==null;){const n=e.next;if(n!==null){e=n;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},wy=class fb extends po{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new fb}clone(){const t=new fb;return t.insert(0,this.toArray().map(n=>n instanceof po?n.clone():n)),t}get length(){return this.doc??Io(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new by(this,t)}querySelector(t){t=t.toUpperCase();const n=new by(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return n.done?null:n.value}querySelectorAll(t){return t=t.toUpperCase(),Vc(new by(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){np(this,t,new $x(this,n,t))}toString(){return rC(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const o=t.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),Gd(this,i=>{o.insertBefore(i.toDOM(t,n,r),null)}),o}insert(t,n){this.doc!==null?ir(this.doc,r=>{sC(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)ir(this.doc,r=>{const o=t&&t instanceof po?t._item:t;rp(r,this,o,n)});else{const r=this._prelimContent,o=t===null?0:r.findIndex(i=>i===t)+1;if(o===0&&t!==null)throw Na("Reference item not found");r.splice(o,0,...n)}}delete(t,n=1){this.doc!==null?ir(this.doc,r=>{aC(r,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return nC(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return oC(this,t)}slice(t=0,n=this.length){return tC(this,t,n)}forEach(t){Gd(this,t)}_write(t){t.writeTypeRef(l8)}},vC=class hb extends wy{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new hb(this.nodeName)}clone(){const t=new hb(this.nodeName),n=this.getAttributes();return yE(n,(r,o)=>{t.setAttribute(o,r)}),t.insert(0,this.toArray().map(r=>r instanceof po?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const s in t)r.push(s);r.sort();const o=r.length;for(let s=0;s<o;s++){const a=r[s];n.push(a+'="'+t[a]+'"')}const i=this.nodeName.toLocaleLowerCase();return`<${i}${n.length>0?" "+n.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?ir(this.doc,n=>{op(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?ir(this.doc,r=>{py(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return my(this,t)}hasAttribute(t){return cC(this,t)}getAttributes(t){return t?Gx(this,t):lC(this)}toDOM(t=document,n={},r){const o=t.createElement(this.nodeName),i=this.getAttributes();for(const s in i){const a=i[s];typeof a=="string"&&o.setAttribute(s,a)}return Gd(this,s=>{o.appendChild(s.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(t){t.writeTypeRef(a8),t.writeKey(this.nodeName)}},$x=class extends ep{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}},yC=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw zi()}mergeWith(e){return!1}write(e,t,n){throw zi()}integrate(e,t){throw zi()}},e8=0,Ua=class extends yC{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),K3(e.doc.store,this)}write(e,t){e.writeInfo(e8),e.writeLen(this.length-t)}getMissing(e,t){return null}},bC=class PA{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new PA(this.content)}splice(t){throw zi()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}},t8=class pb{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new pb(this.len)}splice(t){const n=new pb(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){H3(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}},n8=(e,t)=>new ly({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),wC=class OA{constructor(t){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;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new OA(n8(this.doc.guid,this.opts))}splice(t){throw zi()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},ap=class FA{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new FA(this.embed)}splice(t){throw zi()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}},Eo=class BA{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new BA(this.key,this.value)}splice(t){throw zi()}mergeWith(t){return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},r8=Gh("node_env")==="development",Cy=class mb{constructor(t){this.arr=t,r8&&a3(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new mb(this.arr)}splice(t){const n=new mb(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let o=n;o<r;o++){const i=this.arr[o];t.writeAny(i)}}getRef(){return 8}},Zc=class gb{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new gb(this.str)}splice(t){const n=new gb(this.str.slice(t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"οΏ½",n.str="οΏ½"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}},o8=0,i8=1,s8=2,a8=3,l8=4,Jc=class NA{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new NA(this.type._copy())}splice(t){throw zi()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}},CC=(e,t,n)=>{const{client:r,clock:o}=t.id,i=new ui(kr(r,o+n),t,kr(r,o+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=kr(t.redone.client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},ui=class vb extends yC{constructor(t,n,r,o,i,s,a,l){super(t,l.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Zo(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Zo(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Zh&&this.id.client!==this.parent.client&&this.parent.clock>=Zo(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=q3(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=za(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Ua||this.right&&this.right.constructor===Ua)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===vb?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===vb&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Zh){const r=dy(n,this.parent);r.constructor===Ua?this.parent=null:this.parent=r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=q3(t,t.doc.store,kr(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;const i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),Jh(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(Jh(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(dy(t.doc.store,o.origin)))i.has(dy(t.doc.store,o.origin))||(r=o,i.clear());else break;o=o.right}this.left=r}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),K3(t.doc.store,this),this.content.integrate(t,this),Q3(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new Ua(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:kr(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&Jh(t.origin,this.lastId)&&this.right===t&&Jh(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)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),H3(t.deleteSet,this.id.client,this.id.clock,this.length),Q3(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw js();this.content.gc(t),n?Px(t,this,new Ua(this.id,this.length)):this.content=new t8(this.length)}write(t,n){const r=n>0?kr(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&31|(r===null?0:128)|(o===null?0:64)|(i===null?0:32);if(t.writeInfo(s),r!==null&&t.writeLeftID(r),o!==null&&t.writeRightID(o),r===null&&o===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=Tx(a);t.writeParentInfo(!0),t.writeString(u)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else a.constructor===String?(t.writeParentInfo(!0),t.writeString(a)):a.constructor===Zh?(t.writeParentInfo(!1),t.writeLeftID(a)):js();i!==null&&t.writeString(i)}this.content.write(t,n)}},_C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},SC="__ $YJS$ __";_C[SC]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),_C[SC]=!0;var c8=Math.floor,u8=(e,t)=>e<t?e:t,d8=(e,t)=>e>t?e:t,f8=128,_y=127,XV=Number.MAX_SAFE_INTEGER,h8=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Wd=typeof TextEncoder<"u"?new TextEncoder:null,p8=e=>Wd.encode(e),m8=Wd?p8:h8,Sy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Sy&&Sy.decode(new Uint8Array).length===1&&(Sy=null);var lp=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},ky=(e,t)=>{for(;t>_y;)lp(e,f8|_y&t),t=c8(t/128);lp(e,_y&t)},Ay=new Uint8Array(3e4),g8=Ay.length/3,v8=(e,t)=>{if(t.length<g8){const n=Wd.encodeInto(t,Ay).written||0;ky(e,n);for(let r=0;r<n;r++)lp(e,Ay[r])}else w8(e,m8(t))},y8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;ky(e,r);for(let o=0;o<r;o++)lp(e,n.codePointAt(o))},QV=Wd&&Wd.encodeInto?v8:y8,b8=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=u8(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(d8(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},w8=(e,t)=>{ky(e,t.byteLength),b8(e,t)},kC=e=>new Error(e),ZV=kC("Unexpected end of array"),JV=kC("Integer out of Range"),AC;(function(e){e[e.Token=0]="Token",e[e.PermissionDenied=1]="PermissionDenied",e[e.Authenticated=2]="Authenticated"})(AC||(AC={}));var IC;(function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"})(IC||(IC={}));var Iy=()=>new Map,$V=Array.from,ej=String.fromCharCode,C8=e=>e.toLowerCase(),_8=/^\s*/g,S8=e=>e.replace(_8,""),k8=/([A-Z])/g,EC=(e,t)=>S8(e.replace(k8,n=>`${t}${C8(n)}`)),A8=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Kd=typeof TextEncoder<"u"?new TextEncoder:null,I8=e=>Kd.encode(e),E8=Kd?I8:A8,Ey=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ey&&Ey.decode(new Uint8Array).length===1&&(Ey=null);var xC=e=>e===void 0?null:e,x8=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},TC=new x8,T8=!0;try{typeof localStorage<"u"&&localStorage&&(TC=localStorage,T8=!1)}catch{}var R8=TC,M8=(e,t)=>t.includes(e),qd=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";typeof navigator<"u"&&/Mac/.test(navigator.platform);var us,L8=()=>{if(us===void 0)if(qd){us=Iy();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&us.set(t,""),t=r):t!==null&&(us.set(t,r),t=null)}t!==null&&us.set(t,"")}else typeof location=="object"?(us=Iy(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");us.set(`--${EC(t,"-")}`,n),us.set(`-${EC(t,"-")}`,n)}})):us=Iy();return us},xy=e=>L8().has(e),Ty=e=>xC(qd?process.env[e.toUpperCase()]:R8.getItem(e)),D8=e=>xy("--"+e)||Ty(e)!==null;D8("production");var RC=qd&&M8(process.env.FORCE_COLOR,["true","1","2"]);!xy("no-colors")&&(!qd||process.stdout.isTTY||RC)&&(!qd||xy("color")||RC||Ty("COLORTERM")!==null||(Ty("TERM")||"").includes("color"));var P8=Math.floor,O8=(e,t)=>e<t?e:t,F8=(e,t)=>e>t?e:t,B8=128,Ry=127,tj=Number.MAX_SAFE_INTEGER,cp=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},My=(e,t)=>{for(;t>Ry;)cp(e,B8|Ry&t),t=P8(t/128);cp(e,Ry&t)},Ly=new Uint8Array(3e4),N8=Ly.length/3,z8=(e,t)=>{if(t.length<N8){const n=Kd.encodeInto(t,Ly).written||0;My(e,n);for(let r=0;r<n;r++)cp(e,Ly[r])}else V8(e,E8(t))},H8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;My(e,r);for(let o=0;o<r;o++)cp(e,n.codePointAt(o))},nj=Kd&&Kd.encodeInto?z8:H8,U8=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=O8(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(F8(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},V8=(e,t)=>{My(e,t.byteLength),U8(e,t)},MC=e=>new Error(e),rj=MC("Unexpected end of array"),oj=MC("Integer out of Range"),ij=Date.now,LC;(function(e){e[e.Sync=0]="Sync",e[e.Awareness=1]="Awareness",e[e.Auth=2]="Auth",e[e.QueryAwareness=3]="QueryAwareness",e[e.Stateless=5]="Stateless",e[e.CLOSE=7]="CLOSE",e[e.SyncStatus=8]="SyncStatus"})(LC||(LC={}));var DC;(function(e){e.Connecting="connecting",e.Connected="connected",e.Disconnected="disconnected"})(DC||(DC={}));var sj=crypto.getRandomValues.bind(crypto);function j8(e,{changes:t={},states:n}){const{added:r=[],removed:o=[]}=t,i={states:o6(e,n),added:r,removed:o,superdoc:e};e.emit("awareness-update",i)}function G8(e,t,n){const r=e.awareness;if(!r)return console.warn("[superdoc] External provider missing awareness property"),()=>{};n&&r.setLocalStateField&&r.setLocalStateField("user",n);const o=(i={})=>{j8(t,{changes:i,states:r.getStates()})};return r.on("change",o),()=>{typeof r.off=="function"&&r.off("change",o)}}const W8=(e,t,n,r)=>{const{comment:o}=n,i=new gy(Object.entries(o));t.transact(()=>{e.push([i])},{user:r})},PC=(e,t,n,r)=>{const{comment:o}=n,i=new gy(Object.entries(o)),s=OC(e,o);s!==-1&&t.transact(()=>{e.delete(s,1),e.insert(s,[i])},{user:r})},K8=(e,t,n,r)=>{const{comment:o}=n,i=OC(e,o);i!==-1&&t.transact(()=>{e.delete(i,1)},{user:r})},OC=(e,t)=>e.toJSON().findIndex(n=>n.commentId===t.commentId);var q8=e=>e?.activeEditor?.editorVersion===2||e?.editorVersion===2,FC=e=>{const t=e?.commentId??e?.importedId;return t==null?null:String(t)},Y8=(e,t)=>{if(!q8(e))return[];const n=e?.commentsStore?.commentsList;if(!Array.isArray(n)||!n.length)return[];const r=new Set(t.map(FC).filter(Boolean));return n.filter(o=>{if(o?.trackedChange!==!0)return!1;const i=FC(o);return!i||!r.has(i)})};const BC=e=>{if(!e?.ydoc||!e?.commentsStore)return!1;const t=e.ydoc.getArray("comments").toJSON(),n=new Map,r=[];return t.forEach(o=>{const i=o?.importedId??o?.commentId;if(i){if(n.has(i)){const s=n.get(i),a=o?.commentId;s&&a&&s!==a&&console.warn(`[SuperDoc] Duplicate collaboration comment key "${i}" detected with conflicting commentId values. Keeping first entry and dropping duplicate.`,{key:i,keptCommentId:s,droppedCommentId:a});return}if(n.set(i,o?.commentId),!o?.commentId){r.push({...o,commentId:i});return}r.push(o)}}),e.commentsStore.commentsList=[...r.map(o=>qs(o)),...Y8(e,r)],e.provider?.synced&&(e.commentsStore.hasSyncedCollaborationComments=!0),!0},X8=e=>{if(!e.config.modules.comments||!e.provider)return;if(e._commentsCollabInitialized){BC(e);return}e._commentsCollabInitialized=!0;const t=e.ydoc.getArray("comments"),n=()=>BC(e),r=()=>{if(n()||setTimeout(n,0),e.commentsStore){const o=e.commentsStore.commentsParentElement,i=e.commentsStore.editorCommentIds;e.commentsStore.handleEditorLocationsUpdate(o,i),e.commentsStore.hasSyncedCollaborationComments=!0}e.provider.off("synced",r)};e.provider.on("synced",r),n()||setTimeout(n,0),t.observe(o=>{if(!e.commentsStore)return;const i=e.config.user,{user:s={}}=o?.transaction?.origin||{};Mw({current:i,other:s})||n()})},Hl=(e,t)=>{if(!e.isCollaborative||!e.config.modules.comments)return;const n=e.ydoc.getArray("comments"),r=e.config.user;switch(t.type){case"add":W8(n,e.ydoc,t,r);break;case"update":PC(n,e.ydoc,t,r);break;case"resolved":PC(n,e.ydoc,t,r);break;case"deleted":K8(n,e.ydoc,t,r);break}};It();function Yd(e){const t=ne(e.documentId),n=ne(e.page),r=jr(e.selectionBounds||{}),o=ne(e.source),i=()=>`${t.value}-page-${n.value}`;return{documentId:t,page:n,selectionBounds:r,source:o,getValues:()=>({documentId:t.value,page:n.value,selectionBounds:pn(r),source:o.value}),getContainerId:i,getContainerLocation:l=>{if(!l)return{top:0,left:0};const u=l.getBoundingClientRect(),c=document.getElementById(i());let d={top:0,left:0};return c&&(d=c.getBoundingClientRect()),{top:Number((d.top-u.top).toFixed(3)),left:Number((d.left-u.left).toFixed(3))}}}}const $c="document-editor";It();const NC=Symbol("comment-reconciliation");var zC=e=>[e?.commentId,e?.importedId].filter(t=>t!=null).map(t=>String(t)),Dy=()=>({ok:!1,reason:"read-only-document"}),Py=e=>e?.commentsStore?.getConfig?.readOnly===!0||e?.config?.modules?.comments?.readOnly===!0;function Q8(e,t){const n=e?.commentsStore;if(!n)return[];const r=n.commentsList,o=Array.isArray(r)?r:r?.value??[],i=new Set(zC(t)),s=[];let a=!0;for(;a;){a=!1;for(const l of o){if(!l)continue;const u=zC(l);u.some(c=>i.has(c))||[l.parentCommentId,l.threadingParentCommentId].filter(c=>c!=null).map(c=>String(c)).some(c=>i.has(c))&&(s.push(l),u.forEach(c=>i.add(c)),a=!0)}}return s}function qs(e){const t=ne(e.uid),n=e.commentId||Ji(),r=e.importedId,o=e.parentCommentId,i=e.trackedChangeParentId,s=ne(e.trackedChangeThreadParentId),a=e.fileId,l=e.fileType,u=e.createdAtVersionNumber,c=ne(e.isInternal!==void 0?e.isInternal:!0),d=ne([]),h=ne(null),m=ne(e.isFocused||!1),p=ne(e.creatorId??null),g=ne(e.creatorEmail??null),k=ne(e.creatorName??null),w=ne(e.creatorImage??null),S=ne(e.createdTime||Date.now()),y=ne(e.importedAuthor||null),C=ne(e.docxCommentJSON||null),T=e.origin,R=e.threadingMethod,M=e.threadingStyleOverride,H=e.threadingParentCommentId,B=e.originalXmlStructure,z=ne(e.commentText||""),X=e.selection?Yd(e.selection):Yd({documentId:a,page:1,selectionBounds:{}}),P=e.selection?.selectionBounds?{...e.selection.selectionBounds}:{top:0,left:0,right:0,bottom:0},N=ne(e.trackedChange),I=ne(e.trackedChangeType||null),L=ne(e.trackedChangeText||null),Y=ne(e.trackedChangeDisplayType||null),te=ne(e.semanticColorKey||null),le=ne(e.semanticColor||null),fe=ne(e.trackedChangeStory||null),Ne=ne(e.trackedChangeStoryKind||null),he=ne(e.trackedChangeStoryLabel||""),ge=ne(e.trackedChangeAnchorKey||null),ae=ne(e.trackedChangeCanonicalId||null),_e=ne(e.trackedChangePositionAliases||[]),oe=ne(e.deletedText||null),Te=ne(e.trackedChangeLabel||null),Ge=ne(e.trackedChangeDetailLines||null),Je=ne(e.trackedChangeImagePreview||null),_t=ne(e.resolvedTime||null),be=ne(e.resolvedById||null),Ve=ne(e.resolvedByEmail||null),Le=ne(e.resolvedByName||null),J=ne(e.trackedChangeDecision||null),_=({id:ue,email:we,name:Ce,superdoc:xe,decision:ot,reconciliationToken:tt})=>{const Ct=tt===NC;if(Py(xe)&&!Ct)return Dy();if(_t.value)return;_t.value=Date.now(),be.value=ue??null,Ve.value=we,Le.value=Ce,(ot==="accept"||ot==="reject")&&(J.value=ot),W(xe,{type:Oh.RESOLVED,comment:K()});const Kt=xe.activeEditor?.commands;if(N.value){Kt?.resolveComment({commentId:n,importedId:r});return}const pt=Q8(xe,{commentId:n,importedId:r});pt.length&&typeof Kt?.resolveCommentThread=="function"?Kt.resolveCommentThread({comments:[{commentId:n,importedId:r,preserveAnchor:!0},...pt.map(Mt=>({commentId:Mt.commentId,importedId:Mt.importedId,preserveAnchor:!1}))]}):Kt?.resolveComment({commentId:n,importedId:r})},$=({isInternal:ue,superdoc:we})=>{if(Py(we))return Dy();const Ce=c.value;if(Ce===ue)return;c.value=ue,W(we,{type:Oh.UPDATE,changes:[{key:"isInternal",value:ue,previousValue:Ce}],comment:K()});const xe=we.activeEditor;xe&&xe.commands.setCommentInternal({commentId:n,importedId:r,isInternal:ue})},F=ue=>{const{activeEditor:we}=ue;we?.commands.setActiveComment({commentId:n,importedId:r})},j=({text:ue,superdoc:we,suppressUpdate:Ce})=>{if(!Ce&&Py(we))return Dy();z.value=ue,d.value=V(ue),!Ce&&W(we,{type:Oh.UPDATE,changes:[{key:"text",value:ue}],comment:K()})},V=ue=>{const we=[...new DOMParser().parseFromString(ue,"text/html").querySelectorAll('span[data-type="mention"]')],Ce=[];return we.forEach(xe=>{Ce.some(ot=>{const tt=ot.email===xe.getAttribute("email"),Ct=ot.name===xe.getAttribute("name");return tt&&Ct})||Ce.push({name:xe.getAttribute("name"),email:xe.getAttribute("email")})}),Ce},G=(ue,we)=>{X.source=$c;const Ce=we?.getBoundingClientRect()?.top;X.selectionBounds={top:ue.top-Ce,left:ue.left,right:ue.right,bottom:ue.bottom-Ce}},Z=()=>y.value?{name:y.value.name||"(Imported)",email:y.value.email}:{id:p.value,name:k.value,email:g.value,image:w.value},W=(ue,we)=>{ue.emit("comments-update",we),Hl(ue,we)},K=()=>({uid:t.value,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s.value,fileId:a,fileType:l,mentions:d.value.map(ue=>({...ue,name:ue.name?ue.name:ue.email})),createdAtVersionNumber:u,creatorId:p.value,creatorEmail:g.value,creatorName:k.value,creatorImage:w.value,createdTime:S.value,importedAuthor:y.value,docxCommentJSON:C.value,isInternal:c.value,commentText:z.value,selection:X?X.getValues():null,trackedChange:N.value,trackedChangeText:L.value,trackedChangeType:I.value,trackedChangeDisplayType:Y.value,semanticColorKey:te.value,semanticColor:le.value,trackedChangeStory:fe.value,trackedChangeStoryKind:Ne.value,trackedChangeStoryLabel:he.value,trackedChangeAnchorKey:ge.value,trackedChangeCanonicalId:ae.value,trackedChangePositionAliases:_e.value,trackedChangeDecision:J.value,trackedChangeLabel:Te.value,trackedChangeDetailLines:Ge.value,trackedChangeImagePreview:Je.value,deletedText:oe.value,resolvedTime:_t.value,resolvedById:be.value,resolvedByEmail:Ve.value,resolvedByName:Le.value,origin:T,threadingMethod:R,threadingStyleOverride:M,threadingParentCommentId:H,originalXmlStructure:B});return jr({uid:t,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s,fileId:a,fileType:l,mentions:d,commentElement:h,isFocused:m,creatorId:p,creatorEmail:g,creatorName:k,creatorImage:w,createdTime:S,isInternal:c,commentText:z,selection:X,floatingPosition:P,trackedChange:N,deletedText:oe,trackedChangeType:I,trackedChangeText:L,trackedChangeDisplayType:Y,semanticColorKey:te,semanticColor:le,trackedChangeStory:fe,trackedChangeStoryKind:Ne,trackedChangeStoryLabel:he,trackedChangeAnchorKey:ge,trackedChangeCanonicalId:ae,trackedChangePositionAliases:_e,trackedChangeDecision:J,trackedChangeLabel:Te,trackedChangeDetailLines:Ge,trackedChangeImagePreview:Je,resolvedTime:_t,resolvedById:be,resolvedByEmail:Ve,resolvedByName:Le,importedAuthor:y,docxCommentJSON:C,origin:T,threadingMethod:R,threadingStyleOverride:M,threadingParentCommentId:H,originalXmlStructure:B,setText:j,getValues:K,resolveComment:_,setIsInternal:$,setActive:F,updatePosition:G,getCommentUser:Z})}It();function Z8(e,t){const n=e.id,r=X(e),o=e.data,i=t,s=e.state,a=e.role,l=e.html,u=e.markdown,c=e.password,d=ne(0),h=ne(null),m=ne([]),p=ne(!1),g=ne(t.rulers),k=Wr(e.ydoc),w=Wr(e.provider),S=Wr(e.socket),y=ne(e.isNewFile),C=Wr(e.v2Collaboration||null),T=Wr(null),R=ae=>T.value=ae,M=()=>T.value,H=Wr(null),B=ae=>H.value=ae,z=()=>H.value;function X({type:ae,data:_e}){if(_e?.type)return _e.type;if(ae)return Q5[ae]||ae;throw new Error("Document type not specified")}const P=()=>{le.value=te.value,te.value=[]},N=()=>{te.value=le.value,console.debug("[superdoc] Restored comments:",te.value)},I=ne(e.fields||[]),L=ne(e.fields?.map(ae=>b6(ae))||[]),Y=ne(e.annotations||[]),te=ne(Ne()),le=ne(te.value),fe=ne(e.commentThreadingProfile||null);function Ne(){return i.modules.comments?e.conversations?.map(ae=>qs(ae))||[]:[]}return{id:n,data:o,html:l,markdown:u,password:c,type:r,config:i,state:s,role:a,core:ne(null),editorMountNonce:d,ydoc:k,provider:w,socket:S,isNewFile:y,v2Collaboration:C,container:h,pageContainers:m,isReady:p,rulers:g,rawFields:I,fields:L,annotations:Y,conversations:te,commentThreadingProfile:fe,setEditor:R,getEditor:M,setDocumentRuntime:B,getDocumentRuntime:z,removeComments:P,restoreComments:N,removeConversation:ae=>{const _e=te.value.findIndex(oe=>oe.conversationId===ae);_e>-1&&te.value.splice(_e,1)}}}var HC="data:application/octet-stream;base64,UEsDBBQAAAAIAAAAIQAykW9XXgEAAKUFAAATABwAW0NvbnRlbnRfVHlwZXNdLnhtbFVUCQADMNDOEjDQzhJ1eAsAAQT1AQAABBQAAAC1lMtqwzAQRfeF/oPRNthKuiilxMmij2UbaPoBijRORPVCmrz+vuM4NaWkMeSxMcgz994zQsxwvLEmW0FM2ruSDYo+y8BJr7Sbl+xz+po/sCyhcEoY76BkW0hsPLq9GU63AVJGapdKtkAMj5wnuQArUuEDOKpUPlqBdIxzHoT8EnPgd/3+PZfeITjMsfZgo+EzVGJpMHvZ0O+GJIJJLHtqGuuskokQjJYCqc5XTv1JyfcJBSl3PWmhQ+pRA+MHE+rK/wF73TtdTdQKsomI+CYsdfG1j4orL5eWlMVxmwOcvqq0hFZfu4XoJaREd25N0Vas0K7XxeGWdgaRlJcHaa07IRJuDaTLEzS+3fGASIJrAOydOxHWMPu4GsUv806QinKnYmbg8hitdScE0hqA5js4m2NncyySOifRh0RrJZ4w9s/eqNU5DRwgoj7+6tpEsj57PqhXkgJ1IJvvluzoG1BLAwQKAAAAAACTZE1bAAAAAAAAAAAAAAAACQAcAGRvY1Byb3BzL1VUCQADhhztaIcc7Wh1eAsAAQT1AQAABBQAAABQSwMEFAAAAAgAAAAhACEYr1llAQAAxQIAABAAHABkb2NQcm9wcy9hcHAueG1sVVQJAAMw0M4SMNDOEnV4CwABBPUBAAAEFAAAAJ1STU/DMAy9I/Efqt63dBwmNHlBaAhx4GPSCpyjxG0j0iRKson9e5wVSoEbOdnP9st7TuDqvTfFAUPUzq7LxbwqC7TSKW3bdflc384uyyImYZUwzuK6PGIsr/j5GWyD8xiSxlgQhY3rskvJrxiLssNexDmVLVUaF3qRKA0tc02jJd44ue/RJnZRVUuG7wmtQjXzI2E5MK4O6b+kysmsL77UR098HGrsvREJ+WOeNHPlUg9sRKF2SZha98grgscEtqLFyBfAhgBeXVAx9wwBbDoRhEy0vwxOMrj23mgpEu2VP2gZXHRNKp5OYos8DWzaAmRgh3IfdDpmqmkK99ri6YIhIFVBtEH47gROMthJYXBD1nkjTERg3wBsXO+FJTo2RsT3Fp997W7yFj5HfoITi686dTsvJP4yO8FhRygqUj8KGAG4o8cIJrPTrG1RffX8LeT1vQy/ki+W84rOaV9fGLkevwv/AFBLAwQUAAAACAAAACEACvOn+GYBAADtAgAAEQAcAGRvY1Byb3BzL2NvcmUueG1sVVQJAAMw0M4SMNDOEnV4CwABBPUBAAAEFAAAAJ2SXU+DMBSG7038D6T3UGBqDAGWTLMrZ0yc0XhX27Otjn6k7cb27y0wmMRdeXc+nvP29G3z6UFUwR6M5UoWKIliFICkinG5LtDbch7eo8A6IhmplIQCHcGiaXl9lVOdUWXgxSgNxnGwgVeSNqO6QBvndIaxpRsQxEaekL65UkYQ51OzxprQLVkDTuP4DgtwhBFHcCMY6kERnSQZHST1zlStAKMYKhAgncVJlOAz68AIe3Gg7fwiBXdHDRfRvjnQB8sHsK7rqJ60qN8/wR+Lp9f2qiGXjVcUUJkzmjnuKihzfA59ZHdf30BdVx4SH1MDxClTPnO6DWZgJKlapq83jm/hWCvDrJ8eZR5jYKnh2vl37LRHBU9XxLqFf9gVBzY7jo/5224mDOx58y/KtCWGND+Z3K0GLPDmZJ2Vfed98vC4nKMyjdObMEnD5G6Zpll8m8XxZ7PdaP4sKE4L/FuxF+gMGn/Q8gdQSwMECgAAAAAAk2RNWwAAAAAAAAAAAAAAAAYAHABfcmVscy9VVAkAA4Yc7WiHHO1odXgLAAEE9QEAAAQUAAAAUEsDBBQAAAAIAAAAIQAekRq36QAAAE4CAAALABwAX3JlbHMvLnJlbHNVVAkAAzDQzhIw0M4SdXgLAAEE9QEAAAQUAAAArZLBasMwDEDvg/2D0b1R2sEYo04vY9DbGNkHCFtJTBPb2GrX/v082NgCXelhR8vS05PQenOcRnXglF3wGpZVDYq9Cdb5XsNb+7x4AJWFvKUxeNZw4gyb5vZm/cojSSnKg4tZFYrPGgaR+IiYzcAT5SpE9uWnC2kiKc/UYySzo55xVdf3mH4zoJkx1dZqSFt7B6o9Rb6GHbrOGX4KZj+xlzMtkI/C3rJdxFTqk7gyjWop9SwabDAvJZyRYqwKGvC80ep6o7+nxYmFLAmhCYkv+3xmXBJa/ueK5hk/Nu8hWbRf4W8bnF1B8wFQSwMECgAAAAAAk2RNWwAAAAAAAAAAAAAAAAUAHAB3b3JkL1VUCQADhhztaIcc7Wh1eAsAAQT1AQAABBQAAABQSwMEFAAAAAgAoWRNW+xw0GIQAgAAtAcAABIAHAB3b3JkL2ZvbnRUYWJsZS54bWxVVAkAA54c7WieHO1odXgLAAEE9QEAAAQUAAAAvZPBbqMwEIbvlfoOlu8NhpA0RSFV222kvexh1T6AY0ywFtvI44Tk7dcYiBSyuy3tqiCEGf75mPnHLO8PskR7bkBoleJwQjDiiulMqG2KX1/WNwuMwFKV0VIrnuIjB3y/ur5a1kmulQXk8hUkkqW4sLZKggBYwSWFia64ci9zbSS17tFsA0nNr111w7SsqBUbUQp7DCJC5vj6CrmjZZn3oHSeC8a/abaTXFkPCQwvHVYrKEQFZ8j6Pcham6wymnEA170sW6ikQp2zwviCJgUzGnRuJ663rjbPc4yQ+JUsB5TZOEr0Z8qc8cM40KIDBS7zAiaycbD5CSayIexjZQ0p2W4UJ5r2FTW3Jn0IhMxmxThmP8GgyaWWFhSKCywf1+/sxDxKNwgkWfJ9q7Shm9KR3CZDbosgD0btZJobaieO+j6Qdwiv2mK6nxLViaLSUV6E5IB+8Br91JKqXtZJK6o08NCp97RMMWkanZMpmZHYXZFbxTg4T2EFNcDtKYUMBTmVojz2743/6kBSCcuKXrGnRjQdD0Ugtk6ygw1J8TMhJHper3EbCVP85CK3i9ljF4maSvxx10WmpwhpIsxz/GPYcpjnnDT915dB6+Bf/HzSOyO4aRx908tb59+d97TxMv60l1Jn3PzbzFwcePYRJ+PpVzv54MZevunho9uPsfewPT/rIdQC4P/sx4evdrFfwuo3UEsDBBQAAAAIAAAAIQCWFrgr1QIAAIgLAAARABwAd29yZC9kb2N1bWVudC54bWxVVAkAAzDQzhIw0M4SdXgLAAEE9QEAAAQUAAAApZZbb9sgFMffJ+07WH5v8S1OYjWttGab+jCpWrcPQIDEqAYsILd9+h3s+LJ5qxz3CXPg/PjDORxz93AShXdg2nAlV354G/gek0RRLncr/+ePLzcL3zMWS4oLJdnKPzPjP9x//HB3zKgie8Gk9QAhTXYsycrPrS0zhAzJmcDmVnCilVFbe0uUQGq75YSho9IURUEYVF+lVoQZA+s9YnnAxr/gyGkcjWp8BGcHTBDJsbbs1DHCqyEztESLISiaAIIdRuEQFV+NSpFTNQAlk0CgakCaTSP9Y3PpNFI0JM2nkeIhaTGNNEgnMUxwVTIJg1ulBbbQ1TsksH7dlzcALrHlG15wewZmkDYYzOXrBEXg1RJETK8mzJFQlBUxbShq5e+1zC7+N62/k57V/pem9WDFuGVhuSViJ1sY2/jqMWdXu68vhaU6NaRZAeeopMl52VYHMZUGg3kDObx1AAdR+G1lC0detf+VtnUdhg44Rv4ldqKolb9NDIMR0XSI1mOMhD/XbJQIyOBu4UlH0zvccGTxaQDRAJASNvJn0TAWFwYi3e12HD7yWjWctOVw2uNME9MD0P1ViChudLjGufdYhlqaX4drYoScL7Y4xybvE9l1G5y1uLPonXe5e9+l+qrVvuxo/H20p668HuV1GwzSvyNYmveJeclxCVVXkOxpJ5XGmwIUwVXz4LZ4VQS8Ol1d49U3wGti7VUJ5Lmq5d/DO22j6Nm1JQwkWYk1foI0T8JlmqTz0K+s8Jezzhoks+VivpyBNYM3If0OJkiveD3/1JqetTPGYZA8fm6Na7bF+8IOpz/3JiMnwzBin/VYfiV89/ILBqFihVGUBG4iJHQ4W8A3qid8w45oFRTWMKmnaL7LbdfdKGuV6PoF2/ZGc4Ypg3XnUdXdKmV73d3eVt3LckQVBqymxITVcyozvIe/aheSrOCSPXNLQGWcVqOo2Xf1WUcEdU/o+99QSwMEFAAAAAgAAAAhAMrnZYorBAAAvgwAABEAHAB3b3JkL3NldHRpbmdzLnhtbFVUCQADMNDOEjDQzhJ1eAsAAQT1AQAABBQAAAC1V22PmzgQ/n7S/QfE58uG1ySLmq3yervV5lqVre6zAZNYa2Nkm03T0/33GwwO9BZVSav9hJln5pnxeGYM795/ZdR6wUISXsxt98axLVykPCPFfm5/edqOZrYlFSoyRHmB5/YJS/v93e+/vTtGEisFatICikJGLJ3bB6XKaDyW6QEzJG94iQsAcy4YUvAq9mOGxHNVjlLOSqRIQihRp7HnOBO7peFzuxJF1FKMGEkFlzxXtUnE85ykuH0YC3GJ38ZkzdOK4UJpj2OBKcTAC3kgpTRs7GfZADwYkpcfbeKFUaN3dJ0LtnvkIjtbXBJebVAKnmIp4YAYNQGSonMcvCI6+74B3+0WNRWYu45e9SMPryPwXhFMUvz1Oo5ZyzEGyz4Pya7jmZx5SNbj+blgegRZdRWF55s46kdt3uOSmcoO19GZMxrXtkihA5KHPiO+boPhme7EunxLekkFNtAjSQQSp375sTR62BdcoIRCOFCGFlSSpaOzmqOsH1ZTHZbJg6WTa9/B1PnGObOOUYlFCq0HI8tz7HENQMHzPFZIAVEkS0ypnmEpxQj8HqO9QAymj5FomwznqKLqCSWx4iUovSDY3tRQpgckUKqwiEuUAtuKF0pwavQy/hdXK5hkAhqttdBzrVvFzYwEiwIx2PB3c2/HM1xHVgly+cnYxrsb9l3+3xGHmS5Ihp/qRMfqRPEWgo/JN7wosg+VVAQY9fT7hQh+FAAuas8foTSeTiXeYqQqSNMbOdMnsaWk3BEhuHgoMqiNN3NG8hwLcECg1nZQPkTwo87zPUYZXKVv5LeS+G9Qhs70n6Asn5dcKc7uT+UBcv1rJ6nrfdwvX/ggyKRZfOZcnVVhbPnr6bKJtEYvQXzXCVabQWTibN1hm0XgO/4gsnLXbjCMhLPlaggJboOJuxhCJqG3CcIhZLH0Zv5sCFku3Wk4iKxW/srfDiIbZz28n83Km04HY9vees7tpj2d9kxYVH9qfBJmVTe2xRqLFWKJIMja1R8j41ojEc9LUhg8wTClcR+Jq8SAo1EDSIYo3UKJGcBp5BmR5Rrnek13SOw73lZDDEphyn44c9VTG4s/Ba/KBj0KVDYNa1TcIGgtSaEeCTNyWSWxsSrgXulBVZF9fBE6T116jpGCBtCD7xHpRtK6uBh9idtGoyKumwTvUFk2vZbs3blNyf6g3Lo9FLxl8M2qX5K912KexrwG0y8orXcG2u2ik3lG1tPzjczvZIGRBZ0sNLKwk02MbFLLDjBdBVx1z9D2ZlnLc04pP+LsvsNficwlmBI48fjEku5uu2kwSiTMoRKuQcWFwf7QmBtEGU8f6vs6aOT+YhGuF860gUN9fSo9qiC1n3G+RBJnLWZMw8b0n8nEmbjuajYKZpvb0WYaBKOZu7wdTafO1PW3rufPnH/bPjA/Hnf/AVBLAwQUAAAACAAAACEA24Vsw30EAACXHQAAEgAcAHdvcmQvbnVtYmVyaW5nLnhtbFVUCQADMNDOEjDQzhJ1eAsAAQT1AQAABBQAAADNmc1u4zYQx+8F+g6CgB4Tifq2sM4iySZFFttF0U3RMy3RlhB+CBRlx9d9mT5CH2tfoaRkyXLkxJIctz4pJjk/zQxnyL+dDx+fCdaWiOcpo1MdXJq6hmjE4pQupvqfj/cXga7lAtIYYkbRVF+jXP949fNPH1YhLcgMcblQkwyah6ssmuqJEFloGHmUIALzS5JGnOVsLi4jRgw2n6cRMlaMx4ZlArP8K+MsQnkuObeQLmGub3DRcz9azOFKGiugY0QJ5AI9bxlgMMQ1JkbQBVkjQDJCC3RR9mCUZyivOiBnFEh61SG540h7gvPGkawuyR9HsrukYBypU06kW+AsQ1ROzhknUMiPfGEQyJ+K7EKCMyjSWYpTsZZM06sxMKVPIzySVg2B2PFggm8QFiNsxzWFTfWC03Bjf9HYK9fDyn7zaCwQ7vda+bqJgZ4FzkVty/vkrjL/xKKCICrKrBkcYZlHRvMkzZrTgYylycmkhizfSsCSYL052UDPVnvtaPtUbcMW2Mf9zd4RXHn+NhGYPXZTIRqLPi7svrP2hMgK3r54VGpayQU9D58aYHUAXoR6XhY1I9gwjGjb3YqT9myrmuM1nDRuccY50wLExSCEZdd+qIcyb7HyWMTJMFy9R4ayhQImME/aRDQsQLfBrUkr39niuKb6lbMi29LS42gP2+N1RYcFaHovdzDLj3PmWwIzeeqSKHxYUMbhDEuPZKtpslu0cge0qlzVQ6s6QKv3WisLSFOnln4lhRqc5YLDSHwtiLbz6UFWuxR8khlyJFUeV4OVprueC8RvOIJPaomi0Fy9LVxCeQUAD1jejenrhpohBRbpF7RE+HGdoXpNsp7xNP5NzWE1V60VJMP1Chfc3Tp3ZlDN4KWaSOWjcioUGZb3remYE9M0QelD6WPjRGUnZeg9aQZnBcZINMRHeQfVUz++/9OMf47qUYzmm+XZ71w9UqrCVMNT3bdKTxJIF6Ugtj1TrTWaxXzzuGdU5Cq5eZTKOvy2JjOGS9NrmbedgZRKcIzmUGZmAyspRunYy0yATibsckTeZ/JSXCK14ujMsKF5AY4zLjG3rOAp4tpXtGpl58VolHcXDsua1cma+/5Z+/H976F5s4A3Lm9/ydXqO1neytru2LAE2Xsa7AQJGtxwVhD83x3nnGXHyTycdce5Z9pxjj3yCH/vjvPOtONcc+RR/n4d559lx7n+yLP6P+q44Ew7znNGHuHHd5yxo24PSl8wRvq6gW8C++b6OOl7d+c5wL91+kjf+57bGKMoJRDv3cdfwOU7a9+echVMRhYlZivEvyAh92J/RNbgiA6p1p5aEtwcE9IfjEC6PyJ7X0Q8XSQDBCUIeoTUVX/3I0N6s+acwTt0SP71VGynKzp3cEiHhFtPOXWyovOGF11HU/Uquq4AOknR+YN36JAC6ilaTld0wfCQDmiXnoriZEU3GV50HVnxStF1NQAt737auvPVD2dhXJQ/q5WDMlTHn3jWy5/LHpprv34X3cO09jGdwHWB7wDwOhO0mUbrH6pX/wJQSwMEFAAAAAgAAAAhAL5+dmJWAQAA0AMAABQAHAB3b3JkL3dlYlNldHRpbmdzLnhtbFVUCQADMNDOEjDQzhJ1eAsAAQT1AQAABBQAAACd01FvwiAQAOD3JfsPhHelumlMYzVZFpe9LEu2/QAKV0sGXAO46n79aLWuiy92T0DLfbnjYLneG02+wHmFNqOTcUIJWIFS2W1GP943owUlPnAruUYLGT2Ap+vV7c2yTmvI3yCEuNOTqFifGpHRMoQqZcyLEgz3Y6zAxp8FOsNDXLotM9x97qqRQFPxoHKlVTiwaZLM6Ylx1yhYFErAI4qdARvaeOZARxGtL1XlO62+RqvRycqhAO9jPUYfPcOVPTOT+wvIKOHQYxHGsZhTRi0VwydJOzP6F5gNA6YXwFzAfpixOBksRvYdJYc587OjZM/5XzI9QO4GEdO7Lo9maMJ7lpdBlsO4rkesieWBl9yXfRGGFTg7cwfTnLcR6fPWouO5jlK8QSReAtLC5NiFZiDHxpKuBNKeC13FJ4ZVUEZ9wwbdg8Pag2PNZ6411q8vT3HB/rzD1Q9QSwMEFAAAAAgAAAAhAD+v4WZfDwAADaYAAA8AHAB3b3JkL3N0eWxlcy54bWxVVAkAAzDQzhIw0M4SdXgLAAEE9QEAAAQUAAAA3Z1tc9s2Esff38x9B45e9V6ksp5lT92O7STnzCWpWzvX1xAJWaj5oCOpOO6nPwB8EKUlKC64UdRMZlqL4v4I4L+7xIIU+dMvXwLf+czjREThZW/w41nP4aEbeSJ8vOx9enj7at5zkpSFHvOjkF/2XnjS++Xnf/7jp+eLJH3xeeJIQJhcBO5lb5Wm64t+P3FXPGDJj9Gah/LLZRQHLJUf48d+wOKnzfqVGwVrloqF8EX60h+enU17OSZuQ4mWS+Hy15G7CXiYavt+zH1JjMJkJdZJQXtuQ3uOYm8dRy5PEtnpwM94ARNhiRmMASgQbhwl0TL9UXYmb5FGSfPBmf4r8LeACQ4wBICpy7/gGPOc0ZeWVY7wcJxpyRFehWPXmArA26AQw1HRDvU/ZV5hJV7qrXC4QqO+smUpW7FkVSVyXAcnJe4lUOMduBfvHsMoZgtfkqQHOdIJHA12MhXU/5xMWKfogqPHpfezjC4vcl/zJdv4aaI+xndx/jH/pP/3NgrTxHm+YIkrxGXvKhZMDvHzBWdJepUI9iBbLg8fCNmS26swEerLlfqjsrObXPYeRCBD+SN/dn6PAhY6P1xH3otzc/+vXl8d6InHodzzM/Mve8NsU/JXuWFcbLlJ9rf5LHwstvHw1af7ausqmxbCk01i8av7K204GF/44pGlm1g2S33ShCwRxd6N7Db/km5k++XO/Xw8+vujtC4/ZXvtDalMGDJ93GdZTH7Ll+8j94l796n84rJ31ss2fnp3F4solpnqsnd+nm+854G4FZ7Hw8qO4Up4/I8VDz8l3Ntu/+2tzjb5BjfahPLv0WyqZfYT780Xl69V7pLfhkzp9VEZaG02Yntwbf6/AjbIB7jOfsWZSuDOYB9xjkYMlUVS6W09c7PX9wH6QKNjHWh8rANNjnWg6bEONDvWgebHOtD51z6QCD2Z3wf1hwHUQxxDNKI5hmBDcwyxhOYYQgXNMUQCmmNwdDTH4MdojsFNEZw0ck1eWHH2kcHbm7mHzxF23MOnBDvu4TOAHfdwwrfjHs7vdtzD6dyOezh723EPJ2s8N5tqOe9kmIVp5yhbRlEaRil31PS0M42FkqWrWhqeOunxmKSTBJgss+Un4s40l+nPhz1k0u18nqqCzomWzlI8quKkc8N5+Jn70Zo7zPMkjxAYc1k+GUbExqdjvuQxD11O6dh0UF+E3Ak3wYLAN9fskYzFQ494+AoiSVIoHZpt0pUKEkHg1AFz44hgzsLI8sN7kXQfKwVxrje+z4lYH2lcTLO61wYa07000JjulYHGdC8MKppRDVFOIxqpnEY0YDmNaNwy/6Qat5xGNG45jWjcclr3cXsQqc/3Zx2D9mt3N36UUCS8e/EY6vXTzqR8zdS5YzF7jNl65ahl54MzLfRx9JLzA8U5rSRRzeu1i6hVZxFuug/oDo0quEoeUXiVPKIAK3ndQ+yDnCarCdotTT1zv1mktUHbviq4Z/4mm9B2jzaWdvewbQC8FXFCFgb1WAIP/qims7dEU71tK7s3bMvqHlb7WYm0eTmSoJV+5D7RpOHblzWPZVn21Jn0NvL96Jl7dMT7NI4yX6uG/HDYOuTfBOsVS0QCEO1P9cUdDM4Htu7coTufiZBGtzevAiZ8h24Gcfvw4b3zEK1VmakGhgZ4HaVpFJAx85XAH/7gi3/RNPBKFsHhC1Fvr4iWhzTsRhCcZDJS5BGR5DRThILkHKp5/+Evi4jFHg3tLubZTUMpJyLes2DtU8WWzIvPMv8QzIY0778sFmpdiCqoHkhglWXDZLP4k7vdU93HyCFZGfp1k+r1Rz3V7X61dwfXfZqwg+s+RdBqytOD8l+Czu7gund2B0fV2RufJYkwXkK15lF1t+BR97d78ZfzIj+KlxufbgALINkIFkCyIYz8TRAmlD3WPMIOax51fwldRvMIluQ079+x8MjE0DAqJTSMSgYNo9JAw0gF6H6HTgXW/TadCqz7vToZjGgKUIFR+Rnp6Z/oKk8FRuVnGkblZxpG5WcaRuVno9cOXy7lJJjuFFNBUvlcBUl3oglTHqyjmMUvRMg3Pn9kBAukGe0ujpbq1yRRmN3ETTGd3SxSysl2hqMS+Q++IGuaYlG2i2BFlPl+FBGtrW1PONpy9961Q2b65xydm3DnM5evIt/jsaFPjfXy/Zq5Ai6dtr9Y8l48rlLnflWu9lcx07ODlkXBvmN2+IB1Yz4dNl5m8sQmKBoKf0wxHbU3HgLj8WHj7Uxix3LS0hIec3rYcjtL3rGctbSEx5y3tBwBy6Z4eM3ip1pHmDX5T1njGZxv1nhhvjCuPWyTI5WWdS44a/KinVBxrlxXXS2A6rSLGbN9u+Ax22OiyEzBhJOZ0jquzIimAPudfxZJ7Rr1gevf5d0TIO+PW2fO3zZRCi5TD9v/qOudnDiFCXdqOaP2F652sox5HFunGzOidd4xI1onIDOiVSYymqNSkpnSOjeZEa2TlBmBzlbwjIDLVtAel62gvU22ghSbbNVhFmBGtJ4OmBHoQIUIdKB2mCmYEahABeZWgQop6ECFCHSgQgQ6UOEEDBeo0B4XqNDeJlAhxSZQIQUdqBCBDlSIQAcqRKADFSLQgWo5tzeaWwUqpKADFSLQgQoR6EAddwxUaI8LVGhvE6iQYhOokIIOVIhABypEoAMVItCBChHoQIUIVKACc6tAhRR0oEIEOlAhAh2ok46BCu1xgQrtbQIVUmwCFVLQgQoR6ECFCHSgQgQ6UCECHagQgQpUYG4VqJCCDlSIQAcqRKADddoxUKE9LlChvU2gQopNoEIKOlAhAh2oEIEOVIhABypEoAMVIlCBCsytAhVS0IEKEehAhYgm/8wvUZpusx/gVz2Nd+wjfueTNer36k+5d9ZQ26OKVplZ7X+LcB1FT07tDw9Ho/YQsfBFpJeoDZfVq9wZ+sLnrzfNv/Bp8RiPtl3Jfwuhr5kC+LitJVhTGTe5fNUSFHnjJk+vWoJZ57gp+1YtwWlw3JR0dVwWN6XI0xEwbkozFeOBwbwpW1fM4RA35eiKIRzhpsxcMYQD3JSPK4YTRyXnfetJy3GalveXAkKTO1YIMzOhyS2hVsa1/daimQlt1TMT2spoJqD0NGLwwppRaIXNKDupYZhhpbYPVDMBKzUkWEkNMPZSQ5S11BBlJzVMjFipIQErtX1yNhOspAYYe6khylpqiLKTGp7KsFJDAlZqSMBK3fGEbMTYSw1R1lJDlJ3UcHKHlRoSsFJDAlZqSLCSGmDspYYoa6khyk5qUCWjpYYErNSQgJUaEqykBhh7qSHKWmqIapJar6LYV0sVc9wkrGKIOyFXDHHJuWJoUS1VrC2rpQrBslqCWtlVS1XR7Kqlqnp21VJVRrtqCehpVy3VCmtXLdUqbFctmaXGVUt1UtsHql21VCc1rloySo2rlhqlxlVLjVLjqiWz1LhqqU5qXLVUJ7V9crarloxS46qlRqlx1VKj1LhqySw1rlqqkxpXLdVJjauW6qTueEK2q5YapcZVS41S46ols9S4aqlOaly1VCc1rlqqkxpXLRmlxlVLjVLjqqVGqXHVkllqXLVUJzWuWqqTGlct1UmNq5aMUuOqpUapcdVSo9S4aumDNBEEj4C6D1icOnTPi7tlySpl3R9O+CmMeRL5n7nn0Hb1PaqX/eed118ptn6dn9w/lWOmnoBe+bmSlz0BNgfqHd955WuqlLFqiZO/5yvfrBucX67NjqgNDxyqhOfXigcAv325lT7Cgsle/RrWHTxUD0as2a4cotheHOZmxeLs262rFvuc7/fl+SJO1Avcsq/Pzoaj0evZdbbXOns12xPn64/y+P3ig9SHJ/pTkv2AVpov1DPF5AiMpvq3V2yZ8viyN8+jNsqe2vT+s18eKZcuP0btW+CKV76xPyuvfNt/H5z68k2+TX2vXwlXa+kmaWXztfBE1jhXRXnZrrfj2VT7ht5ZZ4DLHtPxv92sbkpR9xm8zQjbF8gVF5urL5AbF30tXu1m4zxDo/MMKZ1n2MJ5tmGZ7bcTlF/ZvQYt3WvwfbrXaAjdK9vW0b1GRvcaUbrX6Dtxr2Gzex1yomO4ynAOXSXb1tFVxkZXGVO6yvjEXWVe9ZSx0VNGX8dTRPbfm4TEbzp6xMToERNKj5h8Hx4xPs3c0dEHpkYfmFL6wPTEfcAs++ToiWByrv7tO4F609LWBR6EeoPv1ZTAA2ZGD5hResDsb+sB0yME/pE1nxs1n1NqPj8pzaGys6PH9nCm/rXR+TXFnO/cqPM5pc7nJ67z/AgRTK+sKweVufkD1Q3rX/mLkcon++jXIu1rbnh7kkGvQTu9zO1O1SpsQ5v1Km3jwl3+sHaTQ7X2qHThZ1LLP96FyqGe83fYZy31vrBeseMN9/0PLNs7Wpt39fkyzb4dnM1rvl9kr4Qw2sf62oER0N9tTL/shHm8s5dE5j9qMa6T6keGweHOHiXWcaRb+rC7SeTQ6OXe/fbtrIHut/K2WG51tnlmL3HVxoEpXQ0OpCpz8vle1qO6LHciJR02SjokknSIO/t8/wp3WXFEKjxqVHhEpPDoayn8d1/0Q6o1blRrTKTW+NTUOvbCG1KVSaMqEyJVJqemysnpMG3UYUqkw/TUdDjqahRSklmjJDMiSWanJslpiTBvFGFOJML81EQ46koOUpLzRknOiSQ5PzVJvslyWvZgi/2xzrZSrKNpUtMi2iAv2FBrZNtF7r0L4656fcWXdMP8/En6jctjxyyBtk3W3XpV9PuJx+XgbifLZXqcwunzhDgRbiWqdYOu4VbxJbP6p1m2Hl+z+iAtX6K9L1D5BUWoFrDGaB1YRGu4CbI/hA/vhyq/BDE9mB64Je+bTECAVwwm36Lm3RHL5BZdQ3fXvczecOJzxq8sWX3MZq8B2Fcm20oRrZrUFKpDmztrD92ANige3venW3BUEcvj2khtmGSOz9S/NhpS18PbgasVp2vMVBQ2a3IwYI46cvUOrC6fbN+rsT9We6/dOOTRcChGYwv3FPpSl7pQpZ6R12LO19Jdyk7nD44rn2a3323wuDuco9R4BOqEetg7jnifVT4W9Ylu920oFAmverimvDeyKSjW117lAqneL5GelL9X+y91j5yTZUeuJ61OPuyW6+PlpdSvfKT+tmeHfhgxKjJ7NcbmU90afWU3+0SS/L/peijwo0bX7Xo62AmSAx57cnHfmCO3z9Y0DeB2j65Zsrjmh8qSi+yo+WglMqn4N2xNM3ZgSjmpH9Hir+Tn/wNQSwMECgAAAAAAk2RNWwAAAAAAAAAAAAAAAAsAHAB3b3JkL3RoZW1lL1VUCQADhhztaIcc7Wh1eAsAAQT1AQAABBQAAABQSwMEFAAAAAgAAAAhAGeA/LSbBgAAzSAAABUAHAB3b3JkL3RoZW1lL3RoZW1lMS54bWxVVAkAAzDQzhIw0M4SdXgLAAEE9QEAAAQUAAAA7VlPb9s2FL8P2HcgdHf1x5IsBXUL/23XJm3RpB16ZGRaYkyJAkknMYoCQ3vaZcCAbthlwG47DMMKrMCKXfZhCrTYug8xSnZs0abatE23AksMxCL5e48/vvf4+ExdvHycEnCIGMc0axv2BcsAKIvoCGdx27izN2wEBuACZiNIaIbaxgxx4/KlTz+5CLdEglIEpHzGt2DbSITIt0yTR7Ib8gs0R5kcG1OWQiGbLDZHDB5JvSkxHcvyzRTizAAZTKXam+MxjhDYK1Qal06UD4j8lwledESE7UbljFWJEjua2MUXn/EeYeAQkrYh5xnRoz10LAxAIBdyoG1Y5Z9hXrpoLoWIqJGtyA3Lv4XcQmA0cUo5Fu8vBa2BE7j2Ur8z17+JGwTFZ6mvBMAokiu1N7C251uBs8BWQPNHje6wZTdVfEV/c1N/6HcdV8E3V3h3c43DcND3FLy7wnsb+I7ldMOmgvdWeH8D7w46LWeg4EtQQnA22UT7rSDwF+glZEzJVS089H2r1V/AVyizEl1z+UzUxVoKDygbSkDpXChwBsQsR2MYSVwnF5SDPuY5gTMD5DCjXHZbjm3LwHMtZ/kpLQ63EKxIz7sivtFV8AE8YjgXbeOa1GpUIC+ePXv+8Onzh789f/To+cNfwDaOE6GRuwqzuCr36sev//7+C/DXrz+8evyNHs+r+Jc/f/ny9z9ep14otL598vLpkxffffXnT4818A6D+1X4Hk4RBzfQEbhNU7lAzQRon72dxF4CcVWik8UcZrCQ0aAHIlHQN2aQQA2ui1Q73mUyXeiAV6YHCuHdhE0F1gCvJ6kC3KGUdCnTrul6MVfVCtMs1k/OplXcbQgPdXP31rw8mOYy7rFOZS9BCs1bRLocxihDAhRjdIKQRuwexopdd3DEKKdjAe5h0IVYa5I9vC/0QldxKv0y0xGU/lZss3MXdCnRqe+jQxUp9wYkOpWIKGa8AqcCplrGMCVV5DYUiY7k7oxFisG5kJ6OEaFgMEKc62RusplC9zqUeUvr9h0yS1UkE3iiQ25DSqvIPp30EpjmWs44S6rYz/hEhigEt6jQkqDqDina0g8wq3X3XYzE2+3tOzIN6QOkGJky3ZZAVN2PMzKGSKe8w1IlxXYY1kZHdxorob2NEIFHcIQQuPOZDk9zqid9LZFZ5SrS2eYaVGO1aGeIy1qpKG40jsVcCdldFNMaPjuztcQzg1kKWZ3mGxM1ZAb7TG5GXbySaKKkUsyKTasncZOn8FRabyVQCauizfXxOmPZ2+4xKXPwDjLorWVkYj+1bfYgQfqA2YMYbOvSrRSZ6kWK7VSKTbVyY3XTrtxgrhU9Kc7eUAH9N5XPB6t5zr7aqUso6zVOHW69sulRNsIff2HTh9PsFpJnyXldc17X/B/rmrr9fF7NnFcz59XMv1bNrAoYs3rZU2pJa29+xpiQXTEjaJuXpQ+Xe380lJ1loxRaXjTliXxcTKfgYgbLZ8Co+ByLZDeBuZzGLmeI+UJ1zEFOuSyfjFrdZfE1TXfoaHGPZ5/cbUoBKFb9lrfsl6WamPf6rdVF6FJ92Yp5lYBXKj09icpkKommhkSreToStnVWLEINi8B+HQuz4hV5OAFYXIt77pyRDDcZ0qPCT3P5E++euafrjKku29EsL3TPzNMKiUq4qSQqYZjIw2O9+4x9HYZ6VztaGq3gQ/ja3MwNJFNb4EjuuaYn1UQwbxtj+bNJPqa51MeLTAVJnLWNSCwM/S6ZJWdc9CFP5rByaL7+FAvEAMGpjPWqG0i24mY7LevjJRdaH5/lzHUno/EYRaKmZ9WUY3Ml2tH3BBcNOpWkd5PREdgnU3YbSkN5Lbsw4AhzsbTmCLNKcK+suJauFltReQO02qKQ5AlcnCjVZD6Hl89LOpV1lEzXV2XqTLgfD8/i1H2z0FrSrDlAWrVZ7MMd8hVWTT0rT5vrwsB6/Snx/gdChVqgp9bUU6s7O86wIKhM59fYzan15nueButRa1bqyrK18XKb7h/IyO/LanVKBJ9fkB3L8rt38lpyngnK3pPscizAlOG2cd/yOm7P8XoNK/AGDbfpWo3A6zQbHc9r2gPPtvpd54E0ikhS25vPPZQ/9sls8e6+7N94f5+elNoXIpqatKyDzVK4fH9vO/Xv7wGWlrnvO8OwGXb9RtjsDBtuvxs0wp7fbfT9Xqs/7Pe8IBw+MMBhCXY7zZ7rD4KGb/d6Dde3CvpB2Gi5jtNxW51g4HYeLGwtV37yfWLektelfwBQSwMECgAAAAAAk2RNWwAAAAAAAAAAAAAAAAsAHAB3b3JkL19yZWxzL1VUCQADhhztaIcc7Wh1eAsAAQT1AQAABBQAAABQSwMEFAAAAAgAAAAhALO+ix3+AAAAtgMAABwAHAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzVVQJAAMw0M4SiBztaHV4CwABBPUBAAAEFAAAAK2TzWrDMBCE74W+g9h7LTttQwmRcymBXFv3AWR7/UP1Y6RNWr99RUoShwbTg44zYme+hdV6860VO6DzvTUCsiQFhqaydW9aAR/F9uEFmCdpaqmsQQEjetjk93frN1SSwpDv+sGzkGK8gI5oWHHuqw619Ikd0ISXxjotKUjX8kFWn7JFvkjTJXfTDMivMtmuFuB29SOwYhzwP9m2afoKX22112joRgX3SBQ28yFTuhZJwMlJQhbw2wiLqAg0KpwCHPVcfRaz3ux1iS5sfCE4W3MQy5gQFGbxAnCUv2Y2x/Ack6GxhgpZqgnH2ZqDeIoJ8YXl+5+TnJgnEH712/IfUEsBAh4DFAAAAAgAAAAhADKRb1deAQAApQUAABMAGAAAAAAAAQAAAKSBAAAAAFtDb250ZW50X1R5cGVzXS54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMKAAAAAACTZE1bAAAAAAAAAAAAAAAACQAYAAAAAAAAABAA7UGrAQAAZG9jUHJvcHMvVVQFAAOGHO1odXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgAAAAhACEYr1llAQAAxQIAABAAGAAAAAAAAQAAAKSB7gEAAGRvY1Byb3BzL2FwcC54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMUAAAACAAAACEACvOn+GYBAADtAgAAEQAYAAAAAAABAAAApIGdAwAAZG9jUHJvcHMvY29yZS54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMKAAAAAACTZE1bAAAAAAAAAAAAAAAABgAYAAAAAAAAABAA7UFOBQAAX3JlbHMvVVQFAAOGHO1odXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgAAAAhAB6RGrfpAAAATgIAAAsAGAAAAAAAAQAAAKSBjgUAAF9yZWxzLy5yZWxzVVQFAAMw0M4SdXgLAAEE9QEAAAQUAAAAUEsBAh4DCgAAAAAAk2RNWwAAAAAAAAAAAAAAAAUAGAAAAAAAAAAQAO1BvAYAAHdvcmQvVVQFAAOGHO1odXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgAoWRNW+xw0GIQAgAAtAcAABIAGAAAAAAAAQAAAKSB+wYAAHdvcmQvZm9udFRhYmxlLnhtbFVUBQADnhztaHV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAAAAIQCWFrgr1QIAAIgLAAARABgAAAAAAAEAAACkgVcJAAB3b3JkL2RvY3VtZW50LnhtbFVUBQADMNDOEnV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAAAAIQDK52WKKwQAAL4MAAARABgAAAAAAAEAAACkgXcMAAB3b3JkL3NldHRpbmdzLnhtbFVUBQADMNDOEnV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAAAAIQDbhWzDfQQAAJcdAAASABgAAAAAAAEAAACkge0QAAB3b3JkL251bWJlcmluZy54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMUAAAACAAAACEAvn52YlYBAADQAwAAFAAYAAAAAAABAAAApIG2FQAAd29yZC93ZWJTZXR0aW5ncy54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMUAAAACAAAACEAP6/hZl8PAAANpgAADwAYAAAAAAABAAAApIFaFwAAd29yZC9zdHlsZXMueG1sVVQFAAMw0M4SdXgLAAEE9QEAAAQUAAAAUEsBAh4DCgAAAAAAk2RNWwAAAAAAAAAAAAAAAAsAGAAAAAAAAAAQAO1BAicAAHdvcmQvdGhlbWUvVVQFAAOGHO1odXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgAAAAhAGeA/LSbBgAAzSAAABUAGAAAAAAAAQAAAKSBRycAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFVUBQADMNDOEnV4CwABBPUBAAAEFAAAAFBLAQIeAwoAAAAAAJNkTVsAAAAAAAAAAAAAAAALABgAAAAAAAAAEADtQTEuAAB3b3JkL19yZWxzL1VUBQADhhztaHV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAAAAIQCzvosd/gAAALYDAAAcABgAAAAAAAEAAACkgXYuAAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzVVQFAAMw0M4SdXgLAAEE9QEAAAQUAAAAUEsFBgAAAAARABEAqQUAAMovAAAAAA==";It();var UC="in";const eu=Gw("superdoc",()=>{const e=ne(null);let t=null;const n=Xs(),r=ne([]),o=ne([]),i=jr({}),s=ne([]),a=ne(100),l=ne("manual"),u=ne(UC),c=ne(null),d=ne(!1),h=ne(!1),m=ne([]),p=jr({name:null,email:null}),g=jr({}),k=ne(null),w=ne({left:0,top:0,width:0,height:0,source:null}),S=()=>{r.value=[],o.value=[],Object.assign(i,{}),s.value=[],d.value=!1,p.name=null,p.email=null,Object.assign(g,{}),k.value=null,u.value=UC},y=jr({scrollTop:0,scrollLeft:0}),C=L=>{t=typeof L=="function"?L:null},T=L=>{const Y=t||e.value?.onException;typeof Y=="function"&&Y(L)},R=async L=>{if(S(),e.value=L,L.zoom?.initial!==void 0){const Ne=L.zoom.initial;typeof Ne=="number"&&Number.isFinite(Ne)&&Ne>0?a.value=Ne:console.warn("[SuperDoc] zoom.initial expects a positive number representing percentage")}if(L.zoom?.mode!==void 0){const Ne=L.zoom.mode;Ne==="manual"||Ne==="fit-width"?l.value=Ne:console.warn("[SuperDoc] zoom.mode expects 'manual' or 'fit-width'")}if(L.measurementUnit!==void 0){const Ne=L.measurementUnit;Ne==="in"||Ne==="cm"?u.value=Ne:console.warn("[SuperDoc] measurementUnit expects 'in' or 'cm'")}const{documents:Y,modules:te,user:le,users:fe}=L;if(s.value=fe||[],Object.assign(p,le),Object.assign(g,te),Object.prototype.hasOwnProperty.call(g,"comments")||(g.comments={}),!Y?.length&&!L.modules.collaboration){const Ne=await Lv(HC,"blank.docx",Tr),he={id:Ji(),type:Tr,data:Ne,name:"blank.docx",isNewFile:!0};L.html&&(he.html=L.html),L.markdown&&(he.markdown=L.markdown),Y.push(he)}await M(Y),d.value=!0},M=async(L=[])=>{if(!L)return[];for(let Y of L){if(!Y){T({error:new Error("Received empty document entry during initialization."),stage:"document-init",document:Y}),console.warn("[superdoc] Skipping empty document entry.");continue}try{let te=await B(Y);if(!te){T({error:new Error("Document could not be initialized with the provided configuration."),stage:"document-init",document:Y}),console.warn("[superdoc] Skipping document due to invalid configuration:",Y);continue}const le=Z8(te,e.value);r.value.push(le)}catch(te){T({error:te,stage:"document-init",document:Y}),console.warn("[superdoc] Error initializing document:",Y,"with error:",te,"Skipping document.")}}},H=(L,Y,te)=>new File([L],Y,{type:te}),B=async L=>{if(L=Pd(L),e.value?.html&&(L.html=e.value.html),!L.data&&L.url&&!L.type&&(L.type=Tr),e.value?.modules.collaboration&&!L.isNewFile)return{...L,data:null,url:null};if(L.data instanceof File){let Y=L.name;const te=L.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":L.type==="application/pdf"?".pdf":".bin";if(Y?Y.includes(".")||(Y=`${Y}${te}`):Y=`document${te}`,L.data.name!==Y){const le=H(L.data,Y,L.data.type||L.type);return{...L,name:Y,data:le}}return L.name?L:{...L,name:Y}}else if(L.data instanceof Blob){let Y=L.name;Y||(Y=`document${L.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":L.type==="application/pdf"?".pdf":".bin"}`);const te=H(L.data,Y,L.data.type||L.type);return{...L,data:te}}else{if(L.data)return L;if(L.url&&L.type){L.type.toLowerCase()==="docx"?L.type=Tr:L.type.toLowerCase()==="pdf"&&(L.type=Nl);try{const Y=await Lv(L.url,L.name||"document",L.type);return{...L,data:Y}}catch(Y){const te=Y instanceof Error?Y.message:String(Y);throw console.debug("[SuperDoc] Failed to fetch document from URL:",te),Y}}}return null},z=Ae(()=>{for(let L of r.value.filter(Y=>Y.type==="pdf"))if(!L.isReady)return!1;return!0}),X=L=>r.value.find(Y=>Y.id===L);return{commentsStore:n,documents:r,documentBounds:o,pages:i,documentUsers:s,users:m,activeZoom:a,zoomMode:l,measurementUnit:u,viewportMetrics:c,documentScroll:y,isInternal:h,selectionPosition:w,activeSelection:k,isReady:d,user:p,modules:g,areDocumentsReady:z,init:R,setExceptionHandler:C,reset:S,handlePageReady:(L,Y,te)=>{i[L]||(i[L]=[]),i[L].push({page:Y,containerBounds:te});const le=X(L);le&&le.pageContainers.push({page:Y,containerBounds:te})},getDocument:X,removeDocument:L=>{const Y=L!=null?String(L):null;if(!Y)return null;const te=r.value.findIndex(Ne=>String(Ne?.id??"")===Y);if(te===-1)return null;n.removeCommentsForDocument?.(Y),k.value?.documentId!=null&&String(k.value.documentId)===Y&&(k.value=null,w.value={left:0,top:0,width:0,height:0,source:null}),delete i[Y];const[le]=r.value.splice(te,1),fe=e.value?.documents;if(Array.isArray(fe)){const Ne=fe.findIndex(he=>String(he?.id??"")===Y);Ne!==-1&&fe.splice(Ne,1)}return le??null},getPageBounds:(L,Y)=>{const te=i[L];if(!te)return;const le=te.find(Ne=>Ne.page==Y);if(!le||!le.container)return;const{height:fe}=le.container.getBoundingClientRect();return{top:fe*(Y-1)}}}}),J8=e=>{const t={trackInsert:"insertedMark",trackDelete:"deletionMark",trackFormat:"formatMark"},n=new Map;for(const o of e){const i=o.mark.attrs.id;n.has(i)||n.set(i,[]),n.get(i).push(o)}const r=[];for(const[,o]of n){if(o.length===1){const s=o[0],a=t[s.mark.type.name];r.push({from:s.from,to:s.to,[a]:s});continue}const i=new Set;for(let s=0;s<o.length;s++){if(i.has(s))continue;const a=o[s],l=t[a.mark.type.name],u=o[s+1];if(u&&!i.has(s+1)&&a.to===u.from&&a.mark.type.name!==u.mark.type.name){const d=t[u.mark.type.name];r.push({from:a.from,to:u.to,[l]:a,[d]:u}),i.add(s),i.add(s+1);continue}let c=!1;for(let d=s+1;d<o.length;d++){if(i.has(d))continue;const h=o[d];if(a.mark.type.name!==h.mark.type.name){const m=t[h.mark.type.name];r.push({from:Math.min(a.from,h.from),to:Math.max(a.to,h.to),[l]:a,[m]:h}),i.add(s),i.add(d),c=!0;break}}c||(r.push({from:a.from,to:a.to,[l]:a}),i.add(s))}}return r};var $8="headerFooterPart",Oy=e=>Number.isFinite(e)?Number(e):null,eT=(e,t)=>`${e}::page:${t}`,tT=(e,t)=>{const n=String(e),r=String(t);return n===r||n.startsWith("tc::")&&n.endsWith(`::${r}`)},nT=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.forEach(i=>{[i?.left,i?.top,i?.right,i?.bottom].every(Number.isFinite)&&(t=Math.min(t,i.left),n=Math.min(n,i.top),r=Math.max(r,i.right),o=Math.max(o,i.bottom))}),[t,n,r,o].every(Number.isFinite)?{left:t,top:n,right:r,bottom:o,width:r-t,height:o-n}:null},VC=e=>{const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{const r=Oy(n?.pageIndex);if(r==null)return;const o=t.get(r);if(o){o.push(n);return}t.set(r,[n])}),[...t.entries()].sort((n,r)=>n[0]-r[0]).map(([n,r])=>({pageIndex:n,rects:r}))},rT=(e,t)=>!e?.trackedChange||e?.trackedChangeStory?.storyType!==$8?!1:VC(t?.rects).length>1,oT=e=>{const t=Number(e?.selection?.page);return!Number.isInteger(t)||t<1?null:t-1},iT=({id:e,threadId:t,comment:n,positionKey:r,positionEntry:o})=>{const i=Oy(o?.pageIndex),s=n?.trackedChange?null:oT(n);return{id:e,threadId:t,comment:n,positionKey:r,positionEntry:o??null,pageIndex:i??s,isPrimary:!0}},sT=({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:r})=>{const o=VC(n?.rects);if(o.length<2)return[];const i=o.map(({pageIndex:l,rects:u})=>{const c=nT(u);return c?{pageIndex:l,rects:u,bounds:c}:null}).filter(Boolean);if(i.length<2)return[];const s=Oy(n?.pageIndex),a=i.some(({pageIndex:l})=>l===s)?s:i[0]?.pageIndex??null;return i.map(({pageIndex:l,rects:u,bounds:c})=>{const d=l===a;return{id:d?r:eT(r,l),threadId:e?.commentId??t,comment:e,positionKey:t,pageIndex:l,isPrimary:d,positionEntry:{...n,pageIndex:l,rects:u,bounds:c}}})};const aT=({comment:e,positionKey:t,positionEntry:n,fallbackId:r})=>{const o=e?.trackedChange&&t&&r&&Array.isArray(e?.trackedChangePositionAliases)&&e.trackedChangePositionAliases.some(a=>tT(t,a)),i=e?.trackedChange&&e?.trackedChangeCanonicalId&&t&&r&&String(t)!==String(r),s=o||i?r:t??r;if(!s)return[];if(rT(e,n)&&t){const a=sT({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:s});if(a.length>0)return a}return[iT({id:s,threadId:e?.commentId??r,comment:e,positionKey:t,positionEntry:n})]};It();var jC=()=>import("@superdoc/docx-engine"),tu=null,up=null;function lT(e){if(typeof e!="function")throw new TypeError("SuperDoc: the DOCX Engine loader must be a function");if(tu)throw new Error("SuperDoc: the DOCX Engine loader cannot change after loading has started");jC=e}async function cT(){if(!tu){const e=Promise.resolve().then(()=>jC()).then(t=>{const n=t&&typeof t=="object"&&"createSuperDocV2Integration"in t?t.createSuperDocV2Integration:null;if(typeof n!="function")throw new TypeError("SuperDoc: the DOCX Engine module does not export createSuperDocV2Integration");up=n});tu=e,e.catch(()=>{tu===e&&(tu=null,up=null)})}await tu}async function uT(){try{await cT()}catch(e){console.error("[SuperDoc] DOCX Engine failed to load; using the stub.",e)}}const aj=1;var dT="tc-comment:",fT="tc::body::";function GC(e){if(!e||typeof e!="object")return!1;const t=e.id??e.commentId;return typeof t!="string"?!1:t.startsWith(dT)}function dp(e){if(!e||e.trackedChange!==!0)return!1;const t=e.trackedChangeAnchorKey;return typeof t=="string"&&t.startsWith(fT)}function hT(){return{publish(){},recollect(){},reset(){},getLastEpoch(){return null},getLastPayload(){return null}}}function pT(){return{setContext(){},onRenderReadiness(){},reset(){},getDiagnostics(){return null}}}var mT=Tl({name:"SuperDocV2IntegrationMissing",emits:["v2-editor-failed"],setup(e,{emit:t}){return Rn(()=>{t("v2-editor-failed",{reason:"v2-integration-unavailable",detail:"SuperDoc: the DOCX Engine runtime could not be constructed in this environment."})}),()=>Dr("div",{class:"superdoc-v2-integration-missing"})}});function Fy(){return{version:1,capabilities:null,EditorComponent:mT,RulerComponent:null,createGeometryPublisher:hT,createReviewHydrationController:pT,isSyntheticTrackedChangeCommentLaneItem:GC,isV2SyntheticTrackedChangeRow:dp}}function gT(){if(!up)return Fy();try{const e=Fy(),t=up();return!t||typeof t!="object"||!t.EditorComponent?e:{version:typeof t.version=="number"?t.version:e.version,capabilities:t.capabilities??e.capabilities,EditorComponent:t.EditorComponent,RulerComponent:t.RulerComponent??e.RulerComponent,createGeometryPublisher:t.createGeometryPublisher??e.createGeometryPublisher,createReviewHydrationController:t.createReviewHydrationController??e.createReviewHydrationController,isSyntheticTrackedChangeCommentLaneItem:t.isSyntheticTrackedChangeCommentLaneItem??e.isSyntheticTrackedChangeCommentLaneItem,isV2SyntheticTrackedChangeRow:t.isV2SyntheticTrackedChangeRow??e.isV2SyntheticTrackedChangeRow}}catch(e){return console.error("[SuperDoc] DOCX Engine integration failed to construct; using the stub.",e),Fy()}}function vT(){return gT()}function WC(){try{const e=globalThis.__superdocInteractionTrace;return e&&typeof e=="object"?e:null}catch{return null}}function KC(e,t,n=void 0){try{const r=WC();return!r||typeof r.startSpan!="function"?null:r.startSpan(e,t,n)}catch{return null}}function Xd(e,t=void 0){if(e)try{const n=WC();if(!n||typeof n.endSpan!="function")return;n.endSpan(e,t)}catch{}}function nu(e,t,n,r){const o=KC(e,t,n);if(!o)return r();try{const i=r();return i&&typeof i.then=="function"?i.then(s=>(Xd(o),s)).catch(s=>{throw Xd(o,{error:s instanceof Error?s.message:String(s)}),s}):(Xd(o),i)}catch(i){throw Xd(o,{error:i instanceof Error?i.message:String(i)}),i}}const yT=e=>!!e?.trackedChangeLink||!!e?.trackedChangeType||!!e?.trackedChangeDisplayType||!!e?.trackedChangeText||!!e?.deletedText||e?.trackedChange===!0,fp=e=>e?.trackedChangeThreadParentId!=null?e.trackedChangeThreadParentId:e?.trackedChangeParentId!=null&&yT(e)?e.trackedChangeParentId:null,bT=(e,t=new Map)=>{const n=new Map,r=new Map,o=new Map,i=new Map,s=(l,u,c)=>{const d=l.get(u);d?d.push(c):l.set(u,[c])};e.forEach((l,u)=>{i.set(l,u),s(o,l.commentId,l),new Set([l.parentCommentId,l.threadingParentCommentId].filter(d=>d!=null).map(d=>String(d))).forEach(d=>s(n,d,l));const c=fp(l);c!=null&&!l.parentCommentId&&s(r,String(c),l)});const a=new Map;for(const l of e){if(!l?.trackedChange||l.commentId==null)continue;const u=l.commentId,c=new Set([u]),d=[],h=typeof u=="string"?[...n.get(u)??[],...r.get(u)??[]]:[];for(const k of h){const w=k.commentId;w===u||c.has(w)||(c.add(w),d.push(w))}for(let k=0;k<d.length;k+=1){const w=d[k];for(const S of typeof w=="string"?n.get(w)??[]:[]){const y=S.commentId;c.has(y)||(c.add(y),d.push(y))}}const m=[...c].flatMap(k=>o.get(k)??[]).sort((k,w)=>(i.get(k)??0)-(i.get(w)??0));m.sort((k,w)=>k===l?-1:w===l?1:Number(k.createdTime)-Number(w.createdTime));const p=t.get(u),g=p?.length===m.length&&m.every((k,w)=>p[w]===k)?p:m;a.set(u,g)}return a},wT=(e,t=new Map)=>{const n=new Map;for(const o of e){const i=new Set([o.parentCommentId,o.threadingParentCommentId,o.trackedChangeParentId,o.trackedChangeThreadParentId].filter(s=>s!=null).map(s=>String(s)));for(const s of i){const a=n.get(s);a?a.push(o):n.set(s,[o])}}const r=new Map;for(const[o,i]of n){const s=t.get(o);r.set(o,s?.length===i.length&&i.every((a,l)=>s[l]===a)?s:i)}return r};It();var qC=class{constructor(){throw new Error("SuperDoc v2 beta: v1 editor-backed comment import paths are not available.")}},Ys={getTrackChanges:()=>[],enumerateStructuralRowChanges:()=>[]},CT=Symbol("comments-plugin-disabled"),YC=()=>[],By=()=>null,ru=()=>null,XC=()=>null,QC=({storyKey:e,rawId:t})=>`tc::${e}::${t}`,_T=/<br(?:\s[^>]*)?\s*\/?>/gi,ST=/<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi,kT=/<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi,AT=/<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g,IT=/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g,ET={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"'},ZC=(e,t)=>{if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Object.is(e[o],t[o]))},xT=e=>{if(!Array.isArray(e))return null;const t=e.filter(n=>n&&typeof n=="object").map(n=>({excerpt:typeof n.excerpt=="string"?n.excerpt:"",label:typeof n.label=="string"?n.label:""}));return t.length>0?t:null},TT=(e,t)=>e===t?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>ZC(n,t[r])),RT=e=>{if(!e||typeof e!="object")return null;const t=typeof e.src=="string"?e.src:null;if(!t||!t.startsWith("data:image/"))return null;const n=typeof e.contentType=="string"&&e.contentType.startsWith("image/")?e.contentType:null,r=typeof e.role=="string"?e.role:null,o=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:null,i=typeof e.height=="number"&&Number.isFinite(e.height)&&e.height>0?e.height:null,s=typeof e.alt=="string"&&e.alt.length>0?e.alt:"Tracked image preview";return{src:t,...n?{contentType:n}:{},...r?{role:r}:{},...o?{width:o}:{},...i?{height:i}:{},alt:s}},MT=e=>{const t=String(e).toLowerCase(),n=ET[t];if(n!==void 0)return n;const r=t.startsWith("#x")?16:t.startsWith("#")?10:null;if(!r)return null;const o=t.startsWith("#x")?t.slice(2):t.slice(1),i=Number.parseInt(o,r);if(!Number.isFinite(i))return null;try{return String.fromCodePoint(i)}catch{return null}},LT=e=>e.replace(IT,(t,n)=>MT(n)??t),Ny=e=>{const t=String(e??"");return!t||t==="<p></p>"?"":LT(t.replace(_T,`
|
|
9
|
+
`).replace(kT,`
|
|
10
|
+
`).replace(ST,"").replace(AT,"")).replace(/\n{3,}/g,`
|
|
11
|
+
|
|
12
|
+
`).replace(/^\n+/,"").replace(/\n+$/,"")};const Xs=Gw("comments",()=>{const e={kind:"story",storyType:"body"},t=x=>{if(!x?.trackedChange)return!1;const D=x?.trackedChangeStory?.storyType;return D==null||D==="body"?!0:x?.trackedChangeAnchorKey?.startsWith?.("tc::body::")===!0},n=x=>x==null?null:QC({storyKey:"body",rawId:String(x)}),r=x=>{if(!x)return null;const D=x.sourceId?String(x.sourceId):"";return D?`word:structural:${D}`:x.id?String(x.id):null},o=eu(),i=jr({name:"comments",readOnly:!1,allowResolve:!0,showResolved:!1}),s=()=>({ok:!1,reason:"read-only-document"}),a=()=>({ok:!1,reason:"resolve-disabled"}),l=()=>i.allowResolve===!1,u=()=>i.readOnly===!0,c=jr({documentMode:"editing",commentsVisible:!1,trackChangesVisible:!1}),d=!1,h={},m=new WeakMap,p=new Map;let g=0;const k=()=>typeof window>"u"?!1:"__labsSuperDocV2PreviewDebug"in window,w=(x,D=null)=>{if(k()){if(D!==null){console.debug("[SuperDoc][comments-store]",x,D);return}console.debug("[SuperDoc][comments-store]",x)}},S=Oh,y=ne(!1),C=ne(!1),T=ne(null),R=ne(!1),M=ne(null),H=ne(null),B=ne(null),z=ne([]),X=ne([]),P=new Set([]),N=ne(!0),I=ne(""),L=ne([]);let Y=new Map;const te=Ae(()=>{const x=bT(L.value,Y);return Y=x,x}),le=x=>{const D=x?.commentId??null;return(D!=null?te.value.get(D):null)??[x].filter(Boolean)};let fe=new Map;const Ne=Ae(()=>{const x=wT(L.value,fe);return fe=x,x}),he=ne(!1),ge=ne([]),ae=ne({}),_e=ne(!1),oe=ne(0),Te=ne([]),Ge=ne([]),Je=ne(!1),_t=ne(!1),be=ne([]),Ve=ne(null),Le=ne(null),J=ne(null),_=ne(null),$=Wr(null),F=Ae(()=>c.documentMode==="viewing"),j=Ae(()=>F.value?c.commentsVisible||c.trackChangesVisible:!0),V=Wr(null),G=x=>{V.value=x??null},Z=x=>{const D=x?.activeEditor?.v2Comments??null;return D||V.value},W=x=>x?.activeEditor?.editorVersion===2||V.value!==null,K=Wr(null),ue=x=>{K.value=x??null},we=x=>{const D=x?.activeEditor?.v2TrackedChanges??null;return D||K.value},Ce=(x={})=>{const D={...i,...x};Object.assign(i,D),N.value=i.suppressInternalExternal||!1,x.comments&&x.comments.length&&(L.value=x.comments?.map(ee=>qs(ee))||[])},xe=x=>x==null?null:String(x),ot=x=>Array.isArray(x)?[...new Set(x.map(D=>xe(D)).filter(Boolean))]:[],tt=x=>{if(!x?.trackedChange)return null;const D=xe(x.trackedChangeAnchorKey);if(D?.startsWith("tc::")){const ie=D.indexOf("::",4);if(ie>4)return D.slice(4,ie)}const ee=x.trackedChangeStory;switch(ee?.storyType){case"body":return"body";case"headerFooterPart":return ee.refId?`hf:${ee.refId}`:null;case"footnote":return ee.noteId?`fn:${ee.noteId}`:null;case"endnote":return ee.noteId?`en:${ee.noteId}`:null;case"textbox":return ee.textboxId?`textbox:${ee.textboxId}`:null;default:return null}},Ct=x=>x?.startsWith("hf:part:")?`hf:${x.slice(8)}`:x?.startsWith("headerFooterPart:")?`hf:${x.slice(17)}`:x,Kt=(x,D)=>{const ee=Ct(tt(D)),ie=Ct(xe(x?.storyKey));return!ee||!ie||ie===ee},pt=x=>{const D=xe(x);return D?D.startsWith("imported:")?D:`imported:${D}`:null},Mt=x=>{const D=xe(x);if(!D)return{key:null,entry:null};const ee=ae.value||{};if(ee[D]!==void 0)return{key:D,entry:ee[D]};for(const[ie,se]of Object.entries(ee)){const de=xe(se?.key),pe=xe(se?.threadId);if(de===D||pe===D)return{key:ie,entry:se}}return{key:null,entry:null}},zt=(x,D)=>{if(!x||!D)return!1;const ee=Math.max(Number(x.left),Number(D.left)),ie=Math.min(Number(x.right),Number(D.right)),se=Math.max(Number(x.top),Number(D.top)),de=Math.min(Number(x.bottom),Number(D.bottom));return[ee,ie,se,de].every(Number.isFinite)&&ie>ee&&de>se},ln=(x,D)=>{if(!x||!D||x.kind!=="trackedChange"||D.kind!=="trackedChange"||x.storyKey&&D.storyKey&&x.storyKey!==D.storyKey)return!1;const ee=Number(x.pageIndex),ie=Number(D.pageIndex);if(Number.isFinite(ee)&&Number.isFinite(ie)&&ee!==ie)return!1;if(zt(x.bounds,D.bounds))return!0;const se=Number(x.start),de=Number(x.end),pe=Number(D.start),ve=Number(D.end);return[se,de,pe,ve].every(Number.isFinite)&&se===pe&&de===ve},$n=x=>{const{entry:D}=Mt(x);if(!D)return null;const ee=L.value.filter(ie=>ie?.trackedChange?Ot(ie).some(se=>{const{entry:de}=Mt(se);return ln(D,de)}):!1);return ee.length===1?ee[0]:null},Ht=x=>x==null?null:L.value.find(D=>D.commentId==x||D.importedId==x||D.trackedChangeAnchorKey==x||D?.trackedChange&&pt(D.importedId)==x)||$n(x),Ke=x=>x?.parentCommentId?Ht(x.parentCommentId):x,kt=x=>x?.trackedChangeThreadParentId?x.trackedChangeThreadParentId:dp(x)&&x?.trackedChange===!0?null:fp(x),Ut=x=>{const D=kt(x);return D?!!Ht(D)?.trackedChange:!1},Ft=x=>{if(!x)return null;const D=ae.value||{};if(typeof x=="string"){if(D[x])return x;const pe=Ht(x);if(!pe)return x;const ve=pe.commentId??null,qe=pe.importedId??null,Xe=pe.trackedChange?pt(qe):null,et=pe.trackedChangeAnchorKey??null;return et&&D[et]?et:ve&&D[ve]?ve:qe&&D[qe]?qe:Xe&&D[Xe]?Xe:et??ve??Xe??qe??null}const ee=x.commentId??null,ie=x.importedId??null,se=x.trackedChange?pt(ie):null,de=x.trackedChangeAnchorKey??null;return de&&D[de]?de:ee&&D[ee]?ee:ie&&D[ie]?ie:se&&D[se]?se:de??ee??se??ie??null},Ot=x=>{if(x==null)return[];const D=typeof x=="object"?null:x,ee=typeof x=="object"?x:Ht(x),ie=ee?.trackedChange?ot(ee?.trackedChangePositionAliases):[],se=Ct(tt(ee)),de=new Set;return[D,Ft(ee),ee?.trackedChangeAnchorKey,ee?.commentId,ee?.importedId,ee?.trackedChange?pt(ee?.importedId):null,...ie.flatMap(pe=>[se&&!pe.startsWith("tc::")?QC({storyKey:se,rawId:pe}):null,pe])].map(pe=>xe(pe)).filter(pe=>!pe||de.has(pe)?!1:(de.add(pe),!0))},hn=(x,D)=>{const ee=ae.value||{},ie=typeof x=="object"?x:Ht(x),se=new Set;for(const de of[D,...Ot(x)].map(pe=>xe(pe)).filter(Boolean)){if(se.has(de))continue;se.add(de);const pe=ee[de];if(pe!==void 0&&Kt(pe,ie))return{key:de,entry:pe}}return{key:null,entry:null}},yn=x=>{x&&((x.resolvedTime!=null||x.resolvedById!=null||x.resolvedByEmail!=null||x.resolvedByName!=null)&&m.set(x,{resolvedTime:x.resolvedTime??null,resolvedById:x.resolvedById??null,resolvedByEmail:x.resolvedByEmail??null,resolvedByName:x.resolvedByName??null,trackedChangeDecision:x.trackedChangeDecision??null}),x.resolvedTime=null,x.resolvedById=null,x.resolvedByEmail=null,x.resolvedByName=null,x.trackedChangeDecision=null)},De=x=>{if(!x)return!1;const D=m.get(x);return D?(x.resolvedTime=D.resolvedTime??Date.now(),x.resolvedById=D.resolvedById??null,x.resolvedByEmail=D.resolvedByEmail??null,x.resolvedByName=D.resolvedByName??null,x.trackedChangeDecision=D.trackedChangeDecision??null,!0):!1},Oe=x=>typeof x?.getValues=="function"?x.getValues():{...x},Qe=x=>{const D=x?.selection?.source;return D==null?!0:D===$c},nt=x=>!!x?.trackedChange||!!kt(x),Dt=({documentId:x,editor:D}={})=>{if(!D?.state||!L.value?.length)return 0;const ee=ae.value||{};if(!Object.keys(ee).length)return 0;const ie=it=>it.find(on=>ee[on]!==void 0)??null,se=new Set,de=new Map;if(L.value.forEach(it=>{if(!it?.trackedChange)return;if(x){const Dn=it?.fileId??null;if(Dn&&Dn!==x)return}const on=Ot(it),nn=ie(on);nn&&(se.add(nn),de.set(nn,new Set(on)))}),!se.size)return 0;const pe=new Set(Ys.getTrackChanges(D.state).map(({mark:it})=>it?.attrs?.id).filter(it=>it!=null).map(it=>String(it))),ve=typeof ru=="function"?ru(D):null;let qe=[];try{qe=ve?.getAll?.()??[]}catch{}const Xe=new Set(qe.map(it=>it?.anchorKey).filter(it=>typeof it=="string"&&it.length>0)),et=new Set(Array.from(se).filter(it=>{const on=de.get(it)??new Set([it]);return Array.from(on).some(nn=>Xe.has(nn))?!1:!Array.from(on).some(nn=>pe.has(nn))}));if(!et.size)return 0;const st=new Set;et.forEach(it=>{(de.get(it)??new Set([it])).forEach(on=>st.add(on))});const yt=new Set(et);L.value.forEach(it=>{const on=ie(Ot(it));on&&[kt(it),it?.threadingParentCommentId,it?.parentCommentId].map(nn=>xe(nn)).filter(Boolean).some(nn=>st.has(nn))&&yt.add(on)});const gt={...ee};if(yt.forEach(it=>{delete gt[it]}),ae.value=gt,M.value!==void 0&&M.value!==null){const it=Ht(M.value),on=new Set(Ot(it??M.value)),nn=[kt(it),it?.threadingParentCommentId,it?.parentCommentId].map(Dn=>xe(Dn)).filter(Boolean);(Array.from(on).some(Dn=>st.has(Dn))||nn.some(Dn=>st.has(Dn)))&&Br()}return yt.size},Et=x=>{const D=x?.state?.doc;if(!D||typeof D.descendants!="function")return null;const ee=new Set,ie=new Set;return D.descendants(se=>{se.marks?.filter(ve=>ve?.type?.name==="commentMark").forEach(ve=>{[ve.attrs?.commentId,ve.attrs?.importedId].map(qe=>xe(qe)).filter(Boolean).forEach(qe=>ee.add(qe))});const de=se.type?.name;if(de!=="commentRangeStart"&&de!=="commentRangeEnd")return;const pe=xe(se.attrs?.["w:id"]);pe&&ie.add(pe)}),{liveMarkIds:ee,resolvedAnchorIds:ie}},Yt=()=>{const x=o.documents;if(!Array.isArray(x))return null;for(const D of x){const ee=typeof D?.getEditor=="function"?D.getEditor():null;if(ee?.state?.doc)return ee}return null},xt=({editor:x}={})=>{if(V.value)return 0;const D=Et(x??Yt()),ee=ae.value||{},ie=new Set(Object.keys(ee));if(!D&&!ie.size)return 0;let se=0;return L.value.forEach(de=>{if(!Qe(de)||nt(de))return;if(D){const ve=Ot(de),qe=ve.some(et=>D.liveMarkIds.has(et)),Xe=ve.some(et=>D.resolvedAnchorIds.has(et));if(qe&&de.resolvedTime!=null){yn(de),se+=1;return}!qe&&Xe&&de.resolvedTime==null&&De(de)&&(se+=1);return}const{key:pe}=hn(de);pe&&ie.has(String(pe))&&de.resolvedTime!=null&&(yn(de),se+=1)}),se};Pt(ae,()=>{xt()}),Pt(L,()=>{xt()},{deep:!1});const Un=x=>{if(!x)return null;const D=x.start??x.pos??x.from,ee=x.end??x.to??D;return!Number.isFinite(D)||!Number.isFinite(ee)?null:{start:D,end:ee}},so=x=>hn(x).entry??null,zo=(x,D={})=>{const ee=typeof x=="object"?x:Ht(x);if(!ee)return null;const ie=Un(hn(x).entry??null);if(!ie)return null;const se=o.getDocument(ee.fileId)?.getEditor?.()?.state?.doc;if(!se?.textBetween)return null;const de=D.separator??" ",pe=se.textBetween(ie.start,ie.end,de,de);return D.trim===!1?pe:pe?.trim()},rn=(x,D={})=>{const ee=so(x);return ee?{position:ee,anchoredText:zo(x,D)}:null},Vn=x=>{if(!F.value)return!0;const D=Ke(x);return!D&&x?.parentCommentId?!1:D?.trackedChange||kt(x)?c.trackChangesVisible:c.commentsVisible},lr=(x,D)=>{const ee=x?.activeEditor,ie=Z(x);if(D==null){if(Br(),ie){ie.setActiveComment(null);return}ee?.commands?.setActiveComment({commentId:null});return}const se=Ht(D);if(se){if(M.value=se.commentId,Df(se.commentId),ie){ie.setActiveComment(se.commentId);return}ee?.commands?.setActiveComment({commentId:M.value})}},yr=({superdoc:x,params:D,broadcastChanges:ee=!0,documentState:ie=void 0})=>{const se=KC("store.trackedChanges.handleUpdate","store-reconciliation",{event:D?.event??null,changeId:D?.changeId??null,documentId:D?.documentId??null});try{const{event:de,changeId:pe,trackedChangeText:ve,trackedChangeType:qe,trackedChangeDisplayType:Xe,semanticColorKey:et,semanticColor:st,deletedText:yt,trackedChangeLabel:gt,trackedChangeDetailLines:it,trackedChangeImagePreview:on,authorId:nn,authorEmail:Dn,authorImage:Fn,date:jn,author:yo,importedAuthor:er,documentId:En,coords:ur,trackedChangeStory:mt,trackedChangeStoryKind:Lt,trackedChangeStoryLabel:Pn,trackedChangeAnchorKey:Nr,trackedChangeCanonicalId:wr,trackedChangePositionAliases:vl,importedId:yl}=D,zr=pe!=null?String(pe):null,ti=wr!=null?String(wr):null,Li=Object.prototype.hasOwnProperty.call(D,"trackedChangePositionAliases"),wi=Li?ot(vl):void 0,ma=Object.prototype.hasOwnProperty.call(D,"importedId"),Mr=ma?yl!=null?String(yl):null:void 0,ws=En!=null?String(En):null;if(!(Xe==="tableInsert"||Xe==="tableDelete")&&zr){const Zt=ws??(x?.activeEditor?.options?.documentId!=null?String(x.activeEditor.options.documentId):null),Mn=Zt?o.getDocument(Zt)?.getEditor?.():null,zn=ie!==void 0?ie:Mn?.state??x?.activeEditor?.state??null;if(zn){const{ranges:Go,ids:lo}=ha(zn),Qr=Ys.getTrackChanges(zn,zr),bl=Go.length>0&&Qr.length>0&&gl(Qr,Go),wl=Qr.length===0&&lo.has(zr);if(bl||wl){Lo({suppressedIds:new Set([zr]),activeDocumentId:Zt,superdoc:x,broadcastChanges:ee});return}}}const Di=mt!==void 0||Lt!==void 0||Pn!==void 0||Nr!==void 0,Cs=Di?mt??null:e,Pi=Di?Lt??null:"body",ao=Di&&Pn!==void 0?Pn:"",Po=Nr!==void 0?Nr??null:Di?null:n(zr),cc=typeof gt=="string"&>.length>0?gt:null,ga=xT(it),uc=RT(on),bt=cr({documentId:En,commentId:pe,trackedChange:!0,trackedChangeText:ve,trackedChangeType:qe,trackedChangeDisplayType:Xe,semanticColorKey:et,semanticColor:st,deletedText:yt,trackedChangeLabel:cc,trackedChangeDetailLines:ga,trackedChangeImagePreview:uc,createdTime:jn,creatorId:nn??null,creatorName:yo,creatorEmail:Dn,creatorImage:Fn,isInternal:!1,importedAuthor:er,...ma?{importedId:Mr}:{},trackedChangeStory:Cs,trackedChangeStoryKind:Pi,trackedChangeStoryLabel:ao,trackedChangeAnchorKey:Po,trackedChangeCanonicalId:ti,...Li?{trackedChangePositionAliases:wi}:{},selection:{source:$c,selectionBounds:ur}}),va=()=>{const Zt=Po!=null?String(Po):null;if(!zr)return null;const Mn=zn=>{if(!zn)return!1;const Go=zn.trackedChangeAnchorKey!=null?String(zn.trackedChangeAnchorKey):null,lo=zn.commentId!=null?String(zn.commentId):null,Qr=zn.importedId!=null?String(zn.importedId):null,bl=zn.trackedChangeCanonicalId!=null?String(zn.trackedChangeCanonicalId):null,wl=ti&&ti!==zr||bl&&bl!==lo;return lo===zr||!wl&&(Qr===zr||Mr!==void 0&&Mr!=null&&Qr===Mr)?!0:wl?!1:Zt&&Go?Go===Zt:!1};return ws?L.value.find(zn=>Mn(zn)&&Do(zn,ws)):L.value.find(Mn)},jt=Zt=>{ee&&(Hl(x,Zt),nl(pe,Zt,x))},_s=(Zt,Mn,zn)=>Zt?.[Mn]==null&&zn==null||!Zt||ZC(Zt[Mn],zn)?!1:(Zt[Mn]=zn,!0),Pu=Zt=>{if(!Zt)return!1;let Mn=!1;return Cs!=null&&(Mn=_s(Zt,"trackedChangeStory",Cs)||Mn),Pi!=null&&(Mn=_s(Zt,"trackedChangeStoryKind",Pi)||Mn),ao!==void 0&&ao!==""&&(Mn=_s(Zt,"trackedChangeStoryLabel",ao)||Mn),Po!=null&&(Mn=_s(Zt,"trackedChangeAnchorKey",Po)||Mn),Mn},Ou=Zt=>{const Mn={trackedChangeText:ve??null,trackedChangeType:qe??null,trackedChangeDisplayType:Xe??null,semanticColorKey:et??null,semanticColor:st??null,deletedText:yt??null,trackedChangeLabel:cc,trackedChangeImagePreview:uc,trackedChangeCanonicalId:ti,creatorId:nn??null,creatorName:yo??null,creatorEmail:Dn??null,creatorImage:Fn??null,createdTime:jn??null};ma&&(Mn.importedId=Mr),Li&&(Mn.trackedChangePositionAliases=wi);let zn=!1;for(const[Go,lo]of Object.entries(Mn))zn=_s(Zt,Go,lo)||zn;return Zt&&!(Zt.trackedChangeDetailLines==null&&ga==null)&&!TT(Zt.trackedChangeDetailLines,ga)&&(Zt.trackedChangeDetailLines=ga,zn=!0),Pu(Zt)||zn},Fu=Zt=>{const Mn=!!(Zt.resolvedTime||Zt.resolvedById||Zt.resolvedByEmail||Zt.resolvedByName);return Mn&&yn(Zt),Ou(Zt)||Mn};if(de==="add"){const Zt=va();if(Zt){if(!Fu(Zt))return;jt({type:S.UPDATE,comment:Oe(Zt)});return}Vo({superdoc:x,comment:bt,broadcastChanges:ee})}else if(de==="update"){const Zt=va();if(!Zt||!Fu(Zt))return;jt({type:S.UPDATE,comment:Oe(Zt)})}else if(de==="resolve"){const Zt=va(),Mn={id:D.resolvedById??x?.user?.id??null,email:D.resolvedByEmail??x?.user?.email??null,name:D.resolvedByName??x?.user?.name??null,decision:D.decision??null,superdoc:x};Zt&&!Zt.resolvedTime&&Zt.resolveComment({...Mn,reconciliationToken:NC})}}finally{Xd(se)}},To=(x=[])=>({insertedMark:x.find(({mark:D})=>D?.type?.name==="trackInsert")?.mark??null,deletionMark:x.find(({mark:D})=>D?.type?.name==="trackDelete")?.mark??null,formatMark:x.find(({mark:D})=>D?.type?.name==="trackFormat")?.mark??null}),$t=({superdoc:x,editor:D,changeIds:ee,broadcastChanges:ie=!0})=>{if(!x||!D?.state||!Array.isArray(ee)||!ee.length)return;const se=D?.options?.documentId!=null?String(D.options.documentId):null;if(se)for(const de of new Set(ee.map(pe=>pe!=null?String(pe):null).filter(Boolean))){const pe=Ys.getTrackChanges(D.state,de);if(!pe.length)continue;const ve=By({event:"update",marks:To(pe),nodes:[],newEditorState:D.state,documentId:se,trackedChangesForId:pe});ve&&(ve.trackedChangeStory=e,ve.trackedChangeStoryKind="body",ve.trackedChangeStoryLabel="",ve.trackedChangeAnchorKey=n(ve.changeId??de),yr({superdoc:x,params:ve,broadcastChanges:ie}))}},cn=(x=null,D=null,ee=null)=>{const ie=Number.isFinite(x);Ve.value=ie?x:null,Le.value=ie&&D!=null?String(D):null;const se=ee??D;J.value=ie&&se!=null?String(se):null},Fr=()=>{const x=Ve.value;return Number.isFinite(x)?x:null},go=()=>{Ve.value=null,Le.value=null,J.value=null},nl=(x,D,ee,ie=1e3)=>{h[x]&&clearTimeout(h[x]),h[x]=setTimeout(()=>{ee&&ee.emit("comments-update",D),delete h[x]},ie)},sa=(x,D)=>{if(D?.source!=="document-editor")return null;const ee=D?.documentId??null,ie=x?.activeEditor?.options?.documentId??null;if(!ee||!ie||ee!==ie)return null;let se;try{se=x?.activeEditor?.doc?.selection?.current}catch{return null}if(typeof se!="function")return null;try{return se()}catch{return null}},rl=(x,D=null)=>{const ee=Z(x),ie=sa(x,o.activeSelection),se={type:S.PENDING,pendingSelection:ie};if(x.emit("comments-update",se),ee){const pe=ee.getCapabilityState?.();return pe&&pe.canWrite===!1?{ok:!1,reason:pe.reason}:Promise.resolve(ee.captureCurrentSelection?.()).then(ve=>{if(!ve?.ok)return{ok:!1,reason:ve?.reason??"editing-range-required",detail:ve?.detail};$.value=ve.target??null;const qe=ee.documentId??x?.activeEditor?.options?.documentId??null;return _.value=cr({selection:{source:$c,documentId:qe,page:1,selectionBounds:{}},documentId:qe,parentCommentId:null}),x.config.isInternal||(_.value.isInternal=!1),cn(D,"pending"),Qi(null),M.value=_.value.commentId,{ok:!0}}).catch(ve=>({ok:!1,reason:"selection-capture-failed",detail:ve?.message??String(ve)}))}const de={...o.activeSelection};return de.selectionBounds={...de.selectionBounds},o.selectionPosition?.source&&o.selectionPosition.source!=="pdf"&&(o.selectionPosition.source=null),_.value=cr({selection:de,documentId:de.documentId,parentCommentId:null}),x.config.isInternal||(_.value.isInternal=!1),x.activeEditor?.commands&&x.activeEditor.commands.insertComment({..._.value.getValues(),commentId:"pending",skipEmit:!0}),_.value.selection.source==="document-editor"&&o.selectionPosition&&(o.selectionPosition.source=$c),cn(D,"pending"),Qi(null),M.value=_.value.commentId,{ok:!0}},gs=x=>{const D=hn(x).entry;return D?Number.isFinite(D.start)?D.start:Number.isFinite(D.pos)?D.pos:Number.isFinite(D.from)?D.from:Number.isFinite(D.to)?D.to:Number.isFinite(D.pageIndex)&&Number.isFinite(D?.bounds?.top)?D.pageIndex*1e6+D.bounds.top:null:null},Ho=(x,D)=>(x.createdTime??0)-(D.createdTime??0),$o=(x,D)=>{const ee=gs(x),ie=gs(D),se=Number.isFinite(ee),de=Number.isFinite(ie);return se&&de&&ee!==ie?ee-ie:se&&!de?-1:!se&&de?1:Ho(x,D)},hi=x=>{const D=[],ee=[],ie=new Map;return L.value.forEach(se=>{if(!Vn(se))return;const de=Ut(se)?kt(se):null,pe=se.parentCommentId||de;se.resolvedTime?ee.push(se):!pe&&!se.resolvedTime?D.push({...se}):pe&&(ie.has(pe)||ie.set(pe,[]),ie.get(pe).push(se))}),{parentComments:D.sort(x),resolvedComments:ee.sort(x)}},qr=Ae(()=>hi(Ho)),Ee=Ae(()=>qr.value?.parentComments.some(x=>x.trackedChange&&!x.resolvedTime)??!1),Fe=Ae(()=>hi($o)),ft=x=>P.includes(x),lt=Ae(()=>o.documents),Cn=Ae(()=>i),bn=(x,D)=>{const ee=x.getContainerLocation(D);return{top:ee.top+x.selectionBounds.top,left:ee.left+x.selectionBounds.left}},cr=({selection:x,documentId:D,parentCommentId:ee,...ie})=>Uo({selection:x,documentId:D,parentCommentId:ee,...ie}),Uo=({selection:x,documentId:D,parentCommentId:ee,...ie})=>{let se;return D?se=o.getDocument(D):x&&(se=o.getDocument(x.documentId)),se||(se=o.documents[0]),qs({fileId:se.id,fileType:se.type,parentCommentId:ee,creatorId:o.user.id,creatorEmail:o.user.email,creatorName:o.user.name,creatorImage:o.user.image,commentText:I.value,selection:x,...ie})},pi=x=>{const D=!!_.value;I.value="",_.value=null,$.value=null,o.selectionPosition=null,D&&Br(),!W(x)&&x?.activeEditor?.commands?.removeComment({commentId:"pending"})},Ti=({superdoc:x,comment:D,skipEditorUpdate:ee=!1,broadcastChanges:ie=!0,isHydration:se=!1})=>{if(u()&&!se)return s();const de=!ee&&!se?Z(x):null;if(de&&!D.trackedChange){const Xe=Ny(_.value?I.value:D.commentText),et=_.value?$.value:null,st=D.parentCommentId?String(D.parentCommentId):(_.value,null);return(async()=>{try{return await(st?de.reply({parentCommentId:st,text:Xe}):de.commitPendingComment({text:Xe,target:et}))}catch(yt){return{ok:!1,reason:"adapter-threw",detail:yt?.message??String(yt)}}})().then(yt=>{if(!Mo(de))return{ok:!1,reason:"adapter-stale"};if(!yt?.ok)return ie&&x.emit("comments-update",{type:S.PENDING,rejected:!0,reason:yt?.reason??"v2-create-failed",...yt?.committed?{committed:!0}:{}}),yt;const gt=Ki({superdoc:x,adapter:de,documentId:de.documentId,items:yt.items});return _.value&&pi(x),ie&&x.emit("comments-update",{type:S.ADD,comment:gt?.added?.getValues?.()??null}),{ok:!0,comment:gt?.added??null}})}let pe=L.value.find(Xe=>Xe.commentId===M.value);pe||(pe=D);const ve=qs(D.getValues());_.value?ve.setText({text:I.value,suppressUpdate:!0}):ve.setText({text:D.commentText,suppressUpdate:!0}),ve.selection.source=_.value?.selection?.source??ve.selection.source,pe&&(ve.isInternal=pe.isInternal),x.config.isInternal||(ve.isInternal=!1),L.value.push(ve),pi(x),!ee&&!D.trackedChange&&x.activeEditor?.commands&&!D.parentCommentId&&x.activeEditor.commands.insertComment({...ve.getValues(),skipEmit:!0});const qe={type:S.ADD,comment:ve.getValues()};return ie&&(Hl(x,qe),x.emit("comments-update",qe)),{ok:!0,comment:ve}},ol=({superdoc:x,comment:D,skipEditorUpdate:ee=!1,broadcastChanges:ie=!0})=>Ti({superdoc:x,comment:D,skipEditorUpdate:ee,broadcastChanges:ie}),Vo=({superdoc:x,comment:D,skipEditorUpdate:ee=!1,broadcastChanges:ie=!0})=>Ti({superdoc:x,comment:D,skipEditorUpdate:ee,broadcastChanges:ie,isHydration:!0}),mi=({commentId:x,superdoc:D})=>{if(u())return Promise.resolve(s());const ee=L.value.findIndex(et=>et.commentId===x),ie=L.value[ee];if(!ie)return Promise.resolve({ok:!1,reason:"comment-not-found"});const{commentId:se,importedId:de}=ie,{fileId:pe}=ie,ve=Z(D);if(ve&&!ie.trackedChange)return(async()=>{try{return await ve.delete({commentId:se})}catch(et){return{ok:!1,reason:"adapter-threw",detail:et?.message??String(et)}}})().then(et=>Mo(ve)?et?.ok?(Ki({superdoc:D,adapter:ve,documentId:ve.documentId??pe,items:et.items}),D.emit("comments-update",{type:S.DELETED,comment:ie.getValues(),changes:[{key:"deleted",commentId:se,fileId:pe}]}),{ok:!0}):(D.emit("comments-update",{type:S.DELETED,rejected:!0,comment:ie.getValues(),reason:et?.reason??"v2-delete-failed",...et?.committed?{committed:!0}:{}}),et):{ok:!1,reason:"adapter-stale"});D.activeEditor?.commands?.removeComment({commentId:se,importedId:de}),L.value.splice(ee,1);const qe=L.value.filter(et=>et.parentCommentId===se).map(et=>et.commentId||et.importedId);L.value=L.value.filter(et=>!qe.includes(et.commentId)),(M.value===se||qe.includes(M.value))&&Br();const Xe={type:S.DELETED,comment:ie.getValues(),changes:[{key:"deleted",commentId:se,fileId:pe}]};return D.emit("comments-update",Xe),Hl(D,Xe),Promise.resolve({ok:!0})},gi=async({superdoc:x,adapter:D,fileId:ee,operation:ie,eventType:se,rejectionFallbackReason:de,rejectionEventExtras:pe={},validateOutcome:ve,successEventBuilder:qe})=>{let Xe;try{Xe=await ie()}catch(gt){Xe={ok:!1,reason:"adapter-threw",detail:gt?.message??String(gt)}}if(!Mo(D))return{ok:!1,reason:"adapter-stale"};if(!Xe?.ok){const gt={type:se,rejected:!0,reason:Xe?.reason??de,...Xe?.committed?{committed:!0}:{},...Xe?.code!==void 0?{code:Xe.code}:{},...Xe?.detail!==void 0?{detail:Xe.detail}:{},...pe};return x?.emit?.("comments-update",gt),Xe}const et=ve?.({outcome:Xe});if(et?.ok===!1){const gt={ok:!1,committed:et.committed??!0,reason:et.reason??de,...et.code!==void 0?{code:et.code}:{},...et.detail!==void 0?{detail:et.detail}:{}},it={type:se,rejected:!0,reason:gt.reason,...gt.committed?{committed:!0}:{},...gt.code!==void 0?{code:gt.code}:{},...gt.detail!==void 0?{detail:gt.detail}:{},...pe};return x?.emit?.("comments-update",it),gt}const st=Ki({superdoc:x,adapter:D,documentId:D.documentId??ee,items:Xe.items??[]}),yt=qe?.({outcome:Xe,reconciled:st})??null;return yt&&x?.emit?.("comments-update",yt),{ok:!0,items:Xe.items??[],reconciled:st}},vo=({outcome:x,adapter:D,fileId:ee})=>(x.items??[]).map(ie=>D.mapV2CommentToUseCommentInput(ie,{fileId:ee,fileType:null})).filter(Boolean),Yr=x=>{const D=x?.commentId??x?.importedId;return D!=null?String(D):null},vi=x=>x?.parentCommentId!=null?String(x.parentCommentId):null,Ro=({outcome:x,adapter:D,fileId:ee,commentId:ie,expectedResolved:se,operation:de})=>{const pe=ie!=null?String(ie):null,ve=vo({outcome:x,adapter:D,fileId:ee}),qe=ve.find(it=>Yr(it)===pe)??null,Xe=qe?.parentCommentId?ve.find(it=>Yr(it)===vi(qe))??null:qe,et=Yr(Xe);if(!Xe||!et)return{ok:!1,reason:`v2-${de}-refresh-missing`,detail:`comment ${pe} was absent from the refreshed v2 comment list after ${de}`};const st=[Xe,...ve.filter(it=>vi(it)===et)],yt=it=>!!it?.resolvedTime;if(st.filter(it=>yt(it)!==se).length===0)return{ok:!0};const gt=yt(Xe);return st.some(it=>yt(it)!==gt)?{ok:!1,reason:`v2-${de}-refresh-split-thread`,detail:{rootId:et,expected:se?"resolved":"open",observed:st.map(it=>({commentId:Yr(it),parentCommentId:vi(it),status:yt(it)?"resolved":"open"}))}}:{ok:!1,reason:se?`v2-${de}-refresh-still-open`:`v2-${de}-refresh-still-resolved`,detail:`comment ${et} remained ${gt?"resolved":"open"} after ${de}`}},Yn=async({superdoc:x,parentCommentId:D,text:ee}={})=>{if(u())return s();const ie=Z(x);if(!ie)return{ok:!1,reason:"v2-comments-adapter-missing"};const se=D!=null?String(D):null;if(!se)return{ok:!1,reason:"parent-comment-id-missing"};const de=Ny(ee);if(de.length===0)return{ok:!1,reason:"comment-text-empty"};const pe=L.value.find(ve=>String(ve.commentId)===se);return gi({superdoc:x,adapter:ie,fileId:pe?.fileId??ie.documentId??null,operation:()=>ie.reply({parentCommentId:se,text:de}),eventType:S.ADD,rejectionFallbackReason:"v2-reply-failed",rejectionEventExtras:pe?{comment:Oe(pe)}:{},successEventBuilder:({reconciled:ve})=>({type:S.ADD,comment:ve?.added?.getValues?.()??null})})},il=async({superdoc:x,commentId:D,text:ee}={})=>{if(u())return s();const ie=Z(x);if(!ie)return{ok:!1,reason:"v2-comments-adapter-missing"};const se=D!=null?String(D):null;if(!se)return{ok:!1,reason:"comment-id-missing"};const de=Ny(ee);if(de.length===0)return{ok:!1,reason:"comment-text-empty"};const pe=L.value.find(ve=>String(ve.commentId)===se);return gi({superdoc:x,adapter:ie,fileId:pe?.fileId??ie.documentId??null,operation:()=>ie.edit({commentId:se,text:de}),eventType:S.UPDATE,rejectionFallbackReason:"v2-edit-failed",rejectionEventExtras:pe?{comment:Oe(pe),changes:[{key:"text",value:de}]}:{},successEventBuilder:()=>{const ve=L.value.find(qe=>String(qe.commentId)===se)??pe;return ve?{type:S.UPDATE,comment:Oe(ve),changes:[{key:"text",value:ve.commentText??de}]}:null}})},If=async({superdoc:x,commentId:D}={})=>{if(u())return s();if(l())return a();const ee=Z(x);if(!ee)return{ok:!1,reason:"v2-comments-adapter-missing"};const ie=D!=null?String(D):null;if(!ie)return{ok:!1,reason:"comment-id-missing"};const se=L.value.find(ve=>String(ve.commentId)===ie),de=se?.fileId??ee.documentId??null,pe=await gi({superdoc:x,adapter:ee,fileId:de,operation:()=>ee.resolve({commentId:ie}),eventType:S.RESOLVED,rejectionFallbackReason:"v2-resolve-failed",rejectionEventExtras:se?{comment:Oe(se)}:{},validateOutcome:({outcome:ve})=>Ro({outcome:ve,adapter:ee,fileId:de,commentId:ie,expectedResolved:!0,operation:"resolve"}),successEventBuilder:()=>{const ve=L.value.find(qe=>String(qe.commentId)===ie)??se;return ve?{type:S.RESOLVED,comment:Oe(ve)}:null}});if(pe?.ok){const qe=!!L.value.find(et=>String(et.commentId)===ie)?.resolvedTime,Xe=M.value!=null?String(M.value):null;qe&&Xe===ie&&Br()}return pe},aa=async({superdoc:x,commentId:D}={})=>{if(u())return s();if(l())return a();const ee=Z(x);if(!ee)return{ok:!1,reason:"v2-comments-adapter-missing"};const ie=D!=null?String(D):null;if(!ie)return{ok:!1,reason:"comment-id-missing"};const se=L.value.find(pe=>String(pe.commentId)===ie),de=se?.fileId??ee.documentId??null;return gi({superdoc:x,adapter:ee,fileId:de,operation:()=>ee.reopen({commentId:ie}),eventType:S.UPDATE,rejectionFallbackReason:"v2-reopen-failed",rejectionEventExtras:se?{comment:Oe(se),changes:[{key:"resolvedTime",value:null}]}:{},validateOutcome:({outcome:pe})=>Ro({outcome:pe,adapter:ee,fileId:de,commentId:ie,expectedResolved:!1,operation:"reopen"}),successEventBuilder:()=>{const pe=L.value.find(ve=>String(ve.commentId)===ie);return!pe||pe.resolvedTime?null:{type:S.UPDATE,comment:Oe(pe),changes:[{key:"resolvedTime",value:null}]}}})},Mo=x=>x?V.value===x:!1,Xr=x=>x?K.value===x:!1,sl=async({superdoc:x,adapter:D,documentId:ee}={})=>nu("store.comments.hydrateFromV2","comments-list",{documentId:ee??null},async()=>{const ie=D??Z(x);if(!ie||typeof ie.refresh!="function")return{ok:!1,reason:"adapter-missing"};let se;try{se=await ie.refresh()}catch(de){return{ok:!1,reason:"adapter-threw",detail:de?.message??String(de)}}return Mo(ie)?se?.ok?(Ki({superdoc:x,adapter:ie,documentId:ee,items:se.items??[]}),{ok:!0,items:se.items??[]}):se:{ok:!1,reason:"adapter-stale"}}),Ki=({superdoc:x,adapter:D,documentId:ee,items:ie}={})=>nu("store.comments.reconcile","store-reconciliation",{documentId:ee??null,itemCount:Array.isArray(ie)?ie.length:null},()=>{if(!D||!Array.isArray(ie))return{added:null};if(!Mo(D))return{added:null,dropped:"adapter-stale"};const se=ee??D.documentId??null,de=se!=null?String(se):null,pe=(se?o.getDocument(se):null)?.type??null,ve=mt=>typeof mt!="string"?!0:mt.replace(/<[^>]*>/g,"").replace(/ /gi," ").trim().length===0,qe=mt=>!mt||mt.trackedChange===!0||!mt.trackedChangeThreadParentId||mt.parentCommentId?!1:ve(mt.commentText),Xe=M.value!=null?String(M.value):null,et=Xe?L.value.find(mt=>String(mt.commentId)===Xe)??null:null,st=et!=null&&_.value!=null&&(et===_.value||_.value.commentId!=null&&String(et.commentId??"")===String(_.value.commentId)),yt=et!=null&&!st&&et.trackedChange!==!0&&!dp(et)&&(de==null||et.fileId==null||String(et.fileId)===de),gt=new Map,it=new Map,on=[];for(const mt of ie){if(GC(mt))continue;const Lt=D.mapV2CommentToUseCommentInput(mt,{fileId:se,fileType:pe});if(Lt){if(qe(Lt)){it.set(String(Lt.commentId),String(Lt.trackedChangeThreadParentId)),w("hydrate:drop-v2-sidecar-comment",{commentId:Lt.commentId??null,importedId:Lt.importedId??null,parentCommentId:Lt.parentCommentId??null,trackedChangeParentId:Lt.trackedChangeParentId??null,trackedChangeThreadParentId:Lt.trackedChangeThreadParentId??null,trackedChangeSide:Lt.trackedChangeSide??null,commentText:Lt.commentText??null});continue}on.push(Lt)}}for(const mt of on){const Lt=mt.parentCommentId!=null?String(mt.parentCommentId):null,Pn=Lt?it.get(Lt):null;Pn&&(mt.threadingParentCommentId=Pn,mt.trackedChangeThreadParentId==null&&(mt.trackedChangeThreadParentId=Pn));const Nr=mt.commentId!=null?String(mt.commentId):null;Nr&>.set(Nr,mt)}const nn=mt=>{if(de==null)return!0;const Lt=mt?.fileId!=null?String(mt.fileId):null;return Lt==null?!0:Lt===de},Dn=_.value?.commentId!=null?String(_.value.commentId):null,Fn=mt=>!mt||!_.value?!1:mt===_.value||Dn!=null&&String(mt.commentId??"")===Dn,jn=mt=>!mt||Fn(mt)||mt.trackedChange===!0||dp(mt)?!1:mt.commentId!=null,yo=(mt,Lt)=>{mt.commentText=Lt.commentText??mt.commentText,mt.isInternal=typeof Lt.isInternal=="boolean"?Lt.isInternal:mt.isInternal,typeof Lt.resolvedTime=="number"?(mt.resolvedTime=Lt.resolvedTimeWasSynthesized===!0&&typeof mt.resolvedTime=="number"?mt.resolvedTime:Lt.resolvedTime,mt.resolvedByEmail=Lt.resolvedByEmail??null,mt.resolvedByName=Lt.resolvedByName??null):(mt.resolvedTime=null,mt.resolvedByEmail=null,mt.resolvedByName=null),Lt.parentCommentId!==void 0?mt.parentCommentId=Lt.parentCommentId:delete mt.parentCommentId,Lt.trackedChangeParentId!==void 0?mt.trackedChangeParentId=Lt.trackedChangeParentId:delete mt.trackedChangeParentId,Lt.trackedChangeThreadParentId!==void 0?mt.trackedChangeThreadParentId=Lt.trackedChangeThreadParentId:mt.trackedChangeThreadParentId=void 0,Lt.trackedChangeSide!==void 0?mt.trackedChangeSide=Lt.trackedChangeSide:delete mt.trackedChangeSide,Lt.threadingParentCommentId!==void 0?mt.threadingParentCommentId=Lt.threadingParentCommentId:delete mt.threadingParentCommentId},er=[],En=new Set,ur=[];for(const mt of L.value){if(!jn(mt)||!nn(mt)){er.push(mt);continue}const Lt=String(mt.commentId),Pn=gt.get(Lt);Pn&&(yo(mt,Pn),En.add(Lt),er.push(mt))}for(const[mt,Lt]of gt.entries()){if(En.has(mt))continue;const Pn=qs(Lt);er.push(Pn),ur.push(Pn)}return L.value=er,yt&&Xe&&!er.some(mt=>String(mt.commentId)===Xe)&&Br(),{added:ur[ur.length-1]??null}}),al=x=>{pi(x)},br=x=>typeof x!="string"?null:x.replace(/\s*\(imported\)\s*$/u,"").trim()||null,yi=x=>{if(!x)return null;try{if(x.isDestroyed===!0)return null;const D=x.view;if(!D||D.isDestroyed===!0||D.destroyed===!0)return null;const ee=D.state;return ee?{view:D,state:ee}:null}catch{return null}},yu=x=>x!=null&&String(x).length>0?String(x):null,bi=x=>{const D=yu(x),ee=D?[[D,p.get(D)]]:Array.from(p.entries());let ie=0;for(const[se,de]of ee)de&&(p.delete(se),de.timeoutHandle!==null&&de.timeoutHandle!==void 0&&clearTimeout(de.timeoutHandle),ie+=1);return ie},Ri=x=>{const D=yi(x);if(!D)return null;let ee=[];try{ee=Ys.getTrackChanges(D.state)??[]}catch{return null}const ie=Ys?.enumerateStructuralRowChanges;let se=[];if(typeof ie=="function")try{se=ie(D.state)??[]}catch{se=[]}let de=[];if(typeof ru=="function")try{de=ru(x)?.getAll?.()??[]}catch{de=[]}return{...D,trackedChanges:ee,structuralChanges:se,storySnapshots:de}},la=(x,D,ee=null)=>{if(!x||!D)return!1;const ie=ee??Ri(x);return ie?(_u(x,D,ie.trackedChanges,{editorState:ie.state,editorView:ie.view}),da({superdoc:D,editor:x,snapshots:ie.storySnapshots,documentState:ie.state,resolveFromEditor:!1}),Iu({superdoc:D,editor:x,structuralChanges:ie.structuralChanges}),!0):!1},ll=x=>{if(!x||p.get(x.documentId)!==x)return!1;try{const D=x.editor?.options?.documentId;if(D!=null&&String(D)!==x.documentId)return!1;const ee=o.getDocument(x.documentId);if(!ee||ee.getEditor?.()!==x.editor)return!1}catch{return!1}return!0},bu=x=>{if(!ll(x))return p.get(x?.documentId)===x&&p.delete(x.documentId),!1;const D=Ri(x.editor);if(!D||!ll(x))return p.get(x.documentId)===x&&p.delete(x.documentId),!1;try{return la(x.editor,x.superdoc,D)}finally{p.get(x.documentId)===x&&p.delete(x.documentId)}},cl=({editor:x,superdoc:D,documentId:ee,defer:ie=!0})=>{const se=yu(ee);if(!se||!x||!D)return!1;bi(se);const de={documentId:se,editor:x,superdoc:D,generation:++g,timeoutHandle:null};return p.set(se,de),ie?(de.timeoutHandle=setTimeout(()=>{de.timeoutHandle=null,bu(de)},0),!0):bu(de)};function wu(x){const D=x!=null?String(x):null;if(!D)return;bi(D);const ee=L.value.filter(de=>dl(de,D,{allowSingleDocumentMismatch:!0}));if(!ee.length)return;const ie=new Set;if(ee.forEach(de=>{Ot(de).forEach(pe=>ie.add(pe))}),L.value=L.value.filter(de=>!ee.includes(de)),ie.size){const de={...ae.value||{}};ie.forEach(pe=>{delete de[pe]}),ae.value=de}const se=M.value!=null?String(M.value):null;se&&ie.has(se)&&Br()}function Cu(x){wu(x)}const ca=async({superdoc:x,editor:D,comments:ee,documentId:ie,replacedFile:se=!1})=>{const de=o.getDocument(ie);if(de?.commentThreadingProfile&&(de.commentThreadingProfile.value=D?.converter?.commentThreadingProfile||null),se&&Cu(ie),ee.forEach(pe=>{const ve=Array.isArray(pe.elements)?pe.elements:[],qe=Du(ve);if(!qe&&!pe.trackedChange)return;const Xe=br(pe.creatorName),et=Xe?`${Xe} (imported)`:null;Vo({superdoc:x,comment:qs({fileId:ie,fileType:de.type,docxCommentJSON:ve.length?ve:null,commentId:pe.commentId,isInternal:!1,parentCommentId:pe.parentCommentId,trackedChangeParentId:pe.trackedChangeParentId,trackedChangeThreadParentId:pe.trackedChangeThreadParentId,creatorId:null,creatorName:Xe,createdTime:pe.createdTime,creatorEmail:pe.creatorEmail,importedAuthor:{...et?{name:et}:{},email:pe.creatorEmail},commentText:qe,resolvedTime:pe.isDone?Date.now():null,resolvedById:null,resolvedByEmail:pe.isDone?pe.creatorEmail:null,resolvedByName:pe.isDone?et||"(Imported)":null,trackedChange:pe.trackedChange||!1,trackedChangeText:pe.trackedChangeText,trackedChangeType:pe.trackedChangeType,trackedChangeDisplayType:pe.trackedChangeDisplayType,deletedText:pe.trackedDeletedText,origin:pe.origin||"word",threadingMethod:pe.threadingMethod,threadingStyleOverride:pe.threadingStyleOverride,threadingParentCommentId:pe.threadingParentCommentId,originalXmlStructure:pe.originalXmlStructure})})}),se){cl({editor:D,superdoc:x,documentId:ie,defer:!1});return}cl({editor:D,superdoc:x,documentId:ie})},_u=(x,D,ee=null,ie={})=>{const{reopenResolved:se=!1,refreshExisting:de=!1,broadcastChanges:pe=!0,editorState:ve=null,editorView:qe=null}=ie,Xe=ve?{state:ve,view:qe}:yi(x);if(!Xe?.state)return;const et=Xe.state,st=ee??Ys.getTrackChanges(et),yt=J8(st),gt=x?.options?.documentId!=null?String(x.options.documentId):null;if(!gt)return;const it=new Set,on=new Map;L.value.forEach(er=>{if(!er?.trackedChange||!Do(er,gt)||!t(er))return;const En=[er.commentId,er.importedId].map(ur=>ur!=null?String(ur):null).filter(Boolean);if(er.resolvedTime){se||En.forEach(ur=>it.add(ur));return}En.forEach(ur=>{on.set(ur,er),de||it.add(ur)})});const nn=new Map;for(const er of st){const En=er.mark.attrs.id;nn.has(En)||nn.set(En,[]),nn.get(En).push(er)}const Dn=gt,Fn=new Set;yt.forEach(({insertedMark:er,deletionMark:En,formatMark:ur})=>{const mt=er?.mark.attrs.id||En?.mark.attrs.id||ur?.mark.attrs.id;if(mt==null)return;const Lt=String(mt);if(Fn.has(Lt)||(Fn.add(Lt),!de&&it.has(Lt)))return;const Pn=on.get(Lt),Nr={...er&&{insertedMark:er.mark},...En&&{deletionMark:En.mark},...ur&&{formatMark:ur.mark}},wr=By({event:Pn?"update":"add",marks:Nr,nodes:[],newEditorState:et,documentId:Dn,trackedChangesForId:nn.get(mt)||[]});if(wr){const vl=n(wr.changeId??mt);wr.trackedChangeStory=e,wr.trackedChangeStoryKind="body",wr.trackedChangeStoryLabel="",wr.trackedChangeAnchorKey=vl,yr({superdoc:D,params:wr,broadcastChanges:pe,documentState:et}),Pn||(it.add(Lt),wr.changeId!=null&&it.add(String(wr.changeId)),wr.importedId!=null&&it.add(String(wr.importedId)))}});const jn=Xe.view;try{if(!jn||x.view!==jn||jn.isDestroyed===!0||jn.destroyed===!0)return}catch{return}const{tr:yo}=et;yo.setMeta(CT,{type:"force"}),jn.dispatch(yo)},Lo=({suppressedIds:x,activeDocumentId:D,superdoc:ee=null,broadcastChanges:ie=!0})=>{if(!(x instanceof Set)||!x.size||!D)return;const se=[];if(L.value=L.value.filter(ve=>{if(!ve?.trackedChange||!t(ve)||Mu(ve)||!Do(ve,D))return!0;const qe=ve.commentId!=null?String(ve.commentId):null,Xe=ve.importedId!=null?String(ve.importedId):null;return qe&&x.has(qe)||Xe&&x.has(Xe)?(se.push(ve),!1):!0}),!se.length)return;const de=new Set;se.forEach(ve=>{ve.commentId!=null&&de.add(String(ve.commentId)),ve.importedId!=null&&de.add(String(ve.importedId));const qe=Oe(ve),Xe={type:S.DELETED,comment:qe,changes:[{key:"deleted",commentId:qe.commentId,fileId:qe.fileId}]};ie&&(Hl(ee,Xe),ee?.emit?.("comments-update",Xe))});const pe=M.value!=null?String(M.value):null;pe&&de.has(pe)&&Br()},ul=x=>x?x.fileId!=null?String(x.fileId):x.documentId!=null?String(x.documentId):x.selection?.documentId!=null?String(x.selection.documentId):null:null,Ef=()=>{const x=Array.isArray(o.documents)?o.documents:o.documents?.value;return Array.isArray(x)?x:[]},vs=()=>{const x=Ef();return x.length!==1?null:x[0]?.id!=null?String(x[0].id):null},dl=(x,D,ee={})=>{const{allowSingleDocumentMismatch:ie=!1}=ee;if(!D)return!1;const se=ul(x);if(se){if(se===D)return!0;const de=vs();return ie&&de===D}return vs()===D},Do=(x,D)=>dl(x,D,{allowSingleDocumentMismatch:!0}),qi=x=>{const D=typeof x=="string"?x.toLowerCase():"";return D?D==="insert"||D==="insertion"||D==="trackinsert"||D==="tableinsert"||D==="paragraphsplit"?"insertion":D==="delete"||D==="deletion"||D==="trackdelete"||D==="tabledelete"?"deletion":D:null},Su=({comment:x,decision:D}={})=>{const ee=D==="accept"||D==="reject"?D:null;if(!ee)return!1;const ie=qi(x?.trackedChangeDisplayType)??qi(x?.trackedChangeType);return ee==="accept"&&ie==="insertion"||ee==="reject"&&ie==="deletion"},ku=(x,D,ee,ie=null,{broadcastChanges:se=!0}={})=>nu("store.trackedChanges.pruneStaleComments","store-reconciliation",{activeDocumentId:ee??null,liveIdCount:x instanceof Set?x.size:null,liveAnchorKeyCount:D instanceof Set?D.size:null},()=>{if(!(x instanceof Set)||!ee)return;const de=new Set,pe=[],ve=[...L.value];if(L.value=L.value.filter(st=>{if(!st?.trackedChange||!Do(st,ee))return!0;const yt=st.commentId!=null?String(st.commentId):null,gt=st.importedId!=null?String(st.importedId):null,it=st.trackedChangeAnchorKey!=null?String(st.trackedChangeAnchorKey):null,on=!!(yt&&x.has(yt)),nn=!!(gt&&x.has(gt)),Dn=!!(it&&D?.has(it));if(!yt&&!gt&&!it||on||nn||Dn||st.resolvedTime)return!0;const Fn=m.get(st);return Fn?(st.resolvedTime=Fn.resolvedTime??Date.now(),st.resolvedById=Fn.resolvedById??null,st.resolvedByEmail=Fn.resolvedByEmail??null,st.resolvedByName=Fn.resolvedByName??null,st.trackedChangeDecision=Fn.trackedChangeDecision??null,pe.push(st),!0):(yt&&de.add(yt),gt&&de.add(gt),!1)}),pe.forEach(st=>{const yt=Oe(st),gt={type:S.UPDATE,comment:yt};se&&(Hl(ie,gt),ie?.emit?.("comments-update",gt))}),!de.size)return;let qe=!0;for(;qe;)qe=!1,L.value=L.value.filter(st=>{if(!Do(st,ee))return!0;const yt=st.parentCommentId!=null?String(st.parentCommentId):null,gt=kt(st)!=null?String(kt(st)):null;if(!(yt&&de.has(yt)||gt&&de.has(gt))||st.resolvedTime)return!0;const it=st.commentId!=null?String(st.commentId):null,on=st.importedId!=null?String(st.importedId):null;return it&&de.add(it),on&&de.add(on),qe=!0,!1});ve.filter(st=>{if(!Do(st,ee))return!1;const yt=st.commentId!=null?String(st.commentId):null,gt=st.importedId!=null?String(st.importedId):null;return yt&&de.has(yt)||gt&&de.has(gt)}).forEach(st=>{const yt=Oe(st),gt={type:S.DELETED,comment:yt,changes:[{key:"deleted",commentId:yt.commentId,fileId:yt.fileId}]};se&&(Hl(ie,gt),ie?.emit?.("comments-update",gt))});const Xe=M.value!=null?String(M.value):null,et=ve.some(st=>{const yt=st.commentId!=null?String(st.commentId):null,gt=st.importedId!=null?String(st.importedId):null;return Do(st,ee)&&(yt&&yt===Xe||gt&>===Xe)});Xe&&de.has(Xe)&&et&&Br()}),jo=({superdoc:x,comment:D,decision:ee}={})=>{if(!D?.trackedChange||Su({comment:D,decision:ee}))return 0;const ie=ys(D);if(!ie.size)return 0;const se={email:x?.user?.email??null,name:x?.user?.name??null,superdoc:x};let de=0;return fl(D).forEach(pe=>{!pe||pe===D||pe.resolvedTime||[kt(pe),pe.threadingParentCommentId,pe.parentCommentId].map(ve=>xe(ve)).filter(Boolean).some(ve=>ie.has(ve))&&typeof pe.resolveComment=="function"&&(pe.resolveComment(se),de+=1)}),de},ys=x=>{const D=new Set(Ot(x));x?.trackedChangeCanonicalId!=null&&D.add(String(x.trackedChangeCanonicalId));const ee=x?.trackedChangeAnchorKey!=null?String(x.trackedChangeAnchorKey):null;if(ee&&(D.add(ee),ee.startsWith("tc::"))){const ie=ee.slice(ee.lastIndexOf("::")+2);ie&&D.add(ie)}return D},fl=x=>{const D=[],ee=new Set;for(const ie of ys(x))for(const se of Ne.value.get(String(ie))??[])ee.has(se)||(ee.add(se),D.push(se));return D},tc=x=>{const D=x&&typeof x=="object"?x:null;if(!D?.success)return new Set;const ee=new Set,ie=se=>{const de=se&&typeof se=="object"?se:null;de?.kind!=="entity"||de.entityType!=="trackedChange"||de.entityId!=null&&String(de.entityId).length>0&&ee.add(String(de.entityId))};return Array.isArray(D.removed)&&D.removed.forEach(ie),Array.isArray(D.invalidatedRefs)&&D.invalidatedRefs.forEach(ie),ee},ua=x=>{const D=new Set;return x?.decidedId!=null&&String(x.decidedId).length>0&&D.add(String(x.decidedId)),Array.isArray(x?.decidedIds)&&x.decidedIds.forEach(ee=>{ee!=null&&String(ee).length>0&&D.add(String(ee))}),tc(x?.receipt).forEach(ee=>D.add(ee)),D},Yi=({comment:x,decision:D}={})=>{if(!x?.trackedChange||!Su({comment:x,decision:D}))return 0;const ee=ys(x);if(!ee.size)return 0;let ie=0;return fl(x).forEach(se=>{if(!se||se===x)return;const de=xe(se.trackedChangeParentId),pe=xe(se.trackedChangeThreadParentId),ve=xe(se.threadingParentCommentId),qe=xe(se.parentCommentId);(de&&ee.has(de)||pe&&ee.has(pe)||ve&&ee.has(ve)||qe&&ee.has(qe))&&(delete se.trackedChangeParentId,se.trackedChangeThreadParentId=void 0,delete se.trackedChangeSide,delete se.threadingParentCommentId,qe&&ee.has(qe)&&delete se.parentCommentId,ie+=1)}),ie},hl=({superdoc:x,comment:D,decidedId:ee,decidedIds:ie,documentId:se}={})=>{const de=new Set((Array.isArray(ie)||ie instanceof Set?Array.from(ie):[ee]).map(yt=>xe(yt)).filter(Boolean)),pe=xe(se);if(!de.size||!pe)return{removed:!1,removedIds:new Set};const ve=new Set;let qe=!1;const Xe=D?L.value.indexOf(D):-1,et=D?.trackedChange?ys(D):new Set;if(Xe>=0&&Do(D,pe)&&Array.from(de).some(yt=>et.has(yt))?(et.forEach(yt=>ve.add(yt)),L.value.splice(Xe,1),qe=!0):L.value=L.value.filter(yt=>{if(!yt?.trackedChange||!Do(yt,pe))return!0;const gt=ys(yt);return Array.from(de).some(it=>gt.has(it))?(qe=!0,gt.forEach(it=>ve.add(it)),!1):!0}),!qe)return{removed:!1,removedIds:ve};const st=M.value!=null?String(M.value):null;return st&&ve.has(st)&&Br(),{removed:!0,removedIds:ve}},Au=(x,D)=>{if(!(!D||typeof x?.clearActiveTrackedChangeTargetIfMatches!="function"))try{x.clearActiveTrackedChangeTargetIfMatches(D)}catch{}},nc=async({superdoc:x,receipt:D}={})=>{const ee=x?.activeEditor?.documentMutationReadiness;if(!(D?.success!==!0||typeof D?.txId!="string"||!D.txId||typeof ee?.whenPainted!="function"))try{await ee.whenPainted(D);const ie=globalThis.requestAnimationFrame;typeof ie=="function"&&await new Promise(se=>{let de=!1;const pe=()=>{de||(de=!0,clearTimeout(ve),se())},ve=setTimeout(pe,250);ie(()=>ie(()=>setTimeout(pe,0)))})}catch{}},xf=({superdoc:x,comment:D,decision:ee})=>{if(u())return{ok:!1,reason:"read-only-document"};if(!D?.trackedChange)return{ok:!1};const ie=we(x);if(ie){if(ee!=="accept"&&ee!=="reject")return Promise.resolve({ok:!1,reason:"decision-invalid"});const et=D?.trackedChangeCanonicalId!=null?String(D.trackedChangeCanonicalId):D?.commentId!=null?String(D.commentId):D?.trackedChangeAnchorKey?.startsWith?.("tc::body::")?D.trackedChangeAnchorKey.slice(10):null,st=et!=null&&String(M.value??"")===et;return nu("store.trackedChanges.sidebarDecision","command",{decision:ee,decidedId:et},()=>(async()=>{try{return await(ee==="accept"?ie.accept(D):ie.reject(D))}catch(yt){return{ok:!1,reason:"adapter-threw",detail:yt?.message??String(yt)}}})().then(async yt=>{if(!Xr(ie))return{ok:!1,reason:"adapter-stale"};if(!yt?.ok)return{ok:!1,reason:yt?.reason,detail:yt?.detail};const gt=ua(yt),it=yt?.documentId??ie.documentId??x?.activeEditor?.documentId??x?.activeEditor?.options?.documentId??null,on=async()=>{let nn;try{nn=await ie.listTrackedChanges({mode:"all",refreshReason:"post-decision-blocking",blocking:!0})}catch(jn){return{ok:!1,committed:!0,reason:"relist-after-commit-failed",detail:jn?.message??String(jn)}}if(!Xr(ie))return{ok:!1,committed:!0,reason:"adapter-stale"};if(!nn?.ok)return{ok:!1,committed:!0,reason:"relist-after-commit-failed",detail:nn?.reason??nn?.detail??null};jo({superdoc:x,comment:D,decision:ee}),Yi({comment:D,decision:ee}),bs({superdoc:x,adapter:ie,documentId:it,items:nn.items??[],pruneStale:nn.complete===!0&&nn.sourceCoverageComplete===!0});const Dn=new Set((nn.items??[]).map(jn=>jn&&jn.id!=null?String(jn.id):null).filter(Boolean));et!=null&&Dn.has(et)||(st&&Br(),Au(ie,et));const Fn=Z(x);if(Fn&&typeof Fn.refresh=="function"&&Mo(Fn)){let jn;try{jn=await Fn.refresh()}catch(yo){return{ok:!1,committed:!0,reason:"comments-relist-after-tracked-decision-failed",detail:yo?.message??String(yo)}}if(!Mo(Fn))return{ok:!1,committed:!0,reason:"comments-adapter-stale"};if(!jn?.ok)return{ok:!1,committed:!0,reason:"comments-relist-after-tracked-decision-failed",detail:jn?.reason??jn?.detail??null};Ki({superdoc:x,adapter:Fn,documentId:Fn.documentId??it,items:jn.items??[]})}return{ok:!0,success:!0}};return!gt.size||!it?on():(gt.forEach(nn=>Au(ie,nn)),await nc({superdoc:x,receipt:yt.receipt}),jo({superdoc:x,comment:D,decision:ee}),Yi({comment:D,decision:ee}),hl({superdoc:x,comment:D,decidedIds:gt,documentId:it}),st&&Br(),{ok:!0,success:!0})}))}const se=x?.activeEditor;if(!se)return{ok:!1};const de=D.commentId??D.importedId;if(!de)return{ok:!1};const pe=D.trackedChangeStory??void 0,ve=typeof se.doc=="object"?se.doc:null;if(ve?.trackChanges?.decide)try{const et=pe?{id:de,story:pe}:{id:de};return Promise.resolve(ve.trackChanges.decide({decision:ee,target:et})).then(st=>({ok:!0,success:!!st?.success}))}catch(et){if(pe)return{ok:!1,error:et}}const qe=ee==="accept"?"acceptTrackedChangeById":"rejectTrackedChangeById",Xe=se.commands?.[qe];return typeof Xe!="function"?{ok:!1}:{ok:!0,success:!!Xe(de)}},Tf=async({superdoc:x,adapter:D,documentId:ee,trackedChangesListMode:ie="all",refreshReason:se,blocking:de}={})=>nu("store.trackedChanges.hydrateFromV2","tracked-change-list",{documentId:ee??null,trackedChangesListMode:ie,refreshReason:se??null,blocking:de??null},async()=>{const pe=D??we(x);if(!pe||typeof pe.listTrackedChanges!="function")return{ok:!1,reason:"adapter-missing"};let ve;try{const et={mode:ie};se!=null&&(et.refreshReason=se),typeof de=="boolean"&&(et.blocking=de),ve=await pe.listTrackedChanges(et)}catch(et){return{ok:!1,reason:"adapter-threw",detail:et?.message??String(et)}}if(!Xr(pe))return{ok:!1,reason:"adapter-stale"};if(!ve?.ok)return ve;const qe=!(ie==="startup-page"||ie==="interaction-prime"||ie==="visible-window")&&ve.visibleWindowSource==null&&ve.complete===!0&&ve.sourceCoverageComplete===!0;bs({superdoc:x,adapter:pe,documentId:ee,items:ve.items??[],pruneStale:qe});const Xe={ok:!0,items:ve.items??[]};return typeof ve.complete=="boolean"&&(Xe.complete=ve.complete),typeof ve.sourceCoverageComplete=="boolean"&&(Xe.sourceCoverageComplete=ve.sourceCoverageComplete),ve.visibleWindowSource!=null&&(Xe.visibleWindowSource=ve.visibleWindowSource),ve.visibleWindowFallbackReason!=null&&(Xe.visibleWindowFallbackReason=ve.visibleWindowFallbackReason),typeof ve.visibleTrackedChangeExpectedRows=="number"&&(Xe.visibleTrackedChangeExpectedRows=ve.visibleTrackedChangeExpectedRows),typeof ve.visibleTrackedChangeObservedRows=="number"&&(Xe.visibleTrackedChangeObservedRows=ve.visibleTrackedChangeObservedRows),typeof ve.refreshReason=="string"&&(Xe.refreshReason=ve.refreshReason),typeof ve.blocking=="boolean"&&(Xe.blocking=ve.blocking),typeof ve.pageCount=="number"&&(Xe.pageCount=ve.pageCount),typeof ve.totalItems=="number"&&(Xe.totalItems=ve.totalItems),typeof ve.coalesced=="boolean"&&(Xe.coalesced=ve.coalesced),Xe}),rc=async({superdoc:x,adapter:D,documentId:ee,upsertIds:ie=[],removedIds:se=[]}={})=>{const de=D??we(x);if(!de)return{ok:!1,reason:"adapter-missing"};if(!Xr(de))return{ok:!1,reason:"adapter-stale"};const pe=ee??de.documentId??x?.activeEditor?.documentId??null,ve=new Set(Array.from(se??[]).map(gt=>xe(gt)).filter(Boolean)),qe=[...new Set(Array.from(ie??[]).map(gt=>xe(gt)).filter(Boolean))];if(ve.size>0&&qe.length===0&&pe!=null&&hl({superdoc:x,decidedIds:ve,documentId:pe}),qe.length===0)return{ok:!0,items:[],resolvedIds:[],unresolvedIds:[]};if(typeof de.getTrackedChange!="function")return{ok:!1,reason:"adapter-get-missing"};const Xe=await Promise.all(qe.map(async gt=>{try{return{id:gt,result:await de.getTrackedChange(gt)}}catch(it){return{id:gt,result:{ok:!1,reason:"adapter-threw",detail:it?.message??String(it)}}}}));if(!Xr(de))return{ok:!1,reason:"adapter-stale"};const et=[],st=[],yt=[];for(const{id:gt,result:it}of Xe){const on=it?.ok&&Array.isArray(it.items)?it.items.filter(nn=>xe(nn?.id??nn?.changeId??nn?.address?.entityId)===gt):[];on.length>0?(et.push(gt),yt.push(...on)):st.push(gt)}return yt.length>0&&bs({superdoc:x,adapter:de,documentId:pe,items:yt,pruneStale:!1}),{ok:st.length===0,items:yt,resolvedIds:et,unresolvedIds:st,failures:Xe.map(({result:gt})=>gt).filter(gt=>!gt?.ok)}},bs=({superdoc:x,adapter:D,documentId:ee,items:ie,pruneStale:se=!0}={})=>nu("store.trackedChanges.reconcile","store-reconciliation",{documentId:ee??null,itemCount:Array.isArray(ie)?ie.length:null,pruneStale:se},()=>{if(!D||!Array.isArray(ie)||!Xr(D))return;const de=ee??D.documentId??x?.activeEditor?.documentId??null,pe=new Set,ve=new Set;for(const qe of ie){const Xe=D.mapV2TrackedChangeToCommentParams(qe);if(Xe){if(Xe.event==="omit"){Xe.changeId!=null&&ve.add(String(Xe.changeId));continue}de&&Xe.documentId==null&&(Xe.documentId=de),Xe.changeId!=null&&ve.add(String(Xe.changeId)),Xe.trackedChangeAnchorKey!=null&&pe.add(String(Xe.trackedChangeAnchorKey)),yr({superdoc:x,params:Xe,broadcastChanges:!1})}}!de||!se||ku(ve,pe,String(de),x,{broadcastChanges:!1})}),pl=({superdoc:x,editor:D,broadcastChanges:ee=!0})=>{if(!x||!D)return;const ie=D?.options?.documentId!=null?String(D.options.documentId):null;if(!ie)return;const se=Ri(D);if(!se)return;const de=se.trackedChanges,pe=new Set;de.forEach(qe=>{const Xe=qe?.mark?.attrs?.id;Xe!=null&&pe.add(String(Xe))});const ve=se.storySnapshots;ku(pe,new Set(ve.map(qe=>qe?.anchorKey).filter(qe=>typeof qe=="string"&&qe.length>0)),ie,x,{broadcastChanges:ee}),_u(D,x,de,{reopenResolved:!0,refreshExisting:!0,broadcastChanges:ee,editorState:se.state,editorView:se.view}),da({superdoc:x,editor:D,broadcastChanges:ee,snapshots:ve,documentState:se.state}),Iu({superdoc:x,editor:D,broadcastChanges:ee,structuralChanges:se.structuralChanges})},Iu=({superdoc:x,editor:D,broadcastChanges:ee=!0,structuralChanges:ie=null})=>{const se=D?.options?.documentId!=null?String(D.options.documentId):null;if(!se)return;const de=Ys?.enumerateStructuralRowChanges;if(typeof de!="function")return;let pe=ie;if(!Array.isArray(pe)){const ve=yi(D);if(!ve)return;try{pe=de(ve.state)??[]}catch{pe=[]}}for(const ve of pe){if(!ve?.decidable||!ve?.wholeTable)continue;const qe=r(ve);if(!qe)continue;const Xe=n(qe),et=ve.subtype==="table-insert"?"tableInsert":"tableDelete",st=ve.side==="insertion"?"trackInsert":"trackDelete",yt=String(qe),gt=Xe!=null?String(Xe):null;yr({superdoc:x,params:{event:L.value.find(it=>{if(!it?.trackedChange||!Do(it,se))return!1;const on=it.trackedChangeAnchorKey!=null?String(it.trackedChangeAnchorKey):null;if(gt&&on)return on===gt;const nn=it.commentId!=null?String(it.commentId):null,Dn=it.importedId!=null?String(it.importedId):null;return nn===yt||Dn===yt})?"update":"add",changeId:qe,trackedChangeText:"",trackedChangeType:st,trackedChangeDisplayType:et,deletedText:null,authorId:null,authorEmail:ve.authorEmail||null,authorImage:ve.authorImage||null,date:ve.date||null,author:ve.author||null,importedAuthor:ve.importedAuthor?{name:ve.importedAuthor}:null,semanticColorKey:ve.semanticColorKey??null,semanticColor:ve.semanticColor??null,documentId:se,coords:null,trackedChangeStory:e,trackedChangeStoryKind:"body",trackedChangeStoryLabel:"",trackedChangeAnchorKey:Xe},broadcastChanges:ee})}},da=({superdoc:x,editor:D,broadcastChanges:ee=!0,snapshots:ie=null,documentState:se=void 0,resolveFromEditor:de=!0})=>{const pe=D?.options?.documentId!=null?String(D.options.documentId):null;if(!pe)return;let ve=ie;if(!Array.isArray(ve)){if(typeof ru!="function"||!yi(D))return;let qe=null;try{qe=ru(D)}catch{return}if(!qe)return;try{ve=qe.getAll()}catch{return}}for(const qe of ve)qe.storyKind!=="body"&&xu({superdoc:x,editor:D,snapshot:qe,documentId:pe,broadcastChanges:ee,documentState:se,resolveFromEditor:de})},ml=x=>x?.type!=="structural"?x?.type??null:x?.subtype==="table-delete"?"tableDelete":"tableInsert",Eu=x=>x?.type!=="structural"?x?.type??null:x?.subtype==="table-delete"?"trackDelete":"trackInsert",oc=x=>x?x.type==="delete"?!0:x.type==="structural"&&x.subtype==="table-delete":!1,Mi=({editor:x,snapshot:D,documentId:ee,event:ie,resolveFromEditor:se=!0})=>{const de=Eu(D),pe=ml(D),ve={event:ie,changeId:D.runtimeRef.rawId,trackedChangeText:oc(D)?"":D.excerpt??"",trackedChangeType:de,trackedChangeDisplayType:pe,semanticColorKey:D.semanticColorKey??null,semanticColor:D.semanticColor??null,deletedText:oc(D)?D.excerpt??"":null,authorId:D.authorId,authorEmail:D.authorEmail,authorImage:D.authorImage,date:D.date,author:D.author,documentId:ee,coords:null,trackedChangeStory:D.story,trackedChangeStoryKind:D.storyKind,trackedChangeStoryLabel:D.storyLabel,trackedChangeAnchorKey:D.anchorKey};if(!se||typeof XC!="function")return ve;let qe=null;try{qe=XC(x,{kind:"entity",entityType:"trackedChange",entityId:D.runtimeRef.rawId,story:D.story})}catch{qe=null}const Xe=qe?.editor?.state??null;if(!Xe)return ve;let et=[];try{et=Ys.getTrackChanges(Xe,qe.change.rawId)??[]}catch{et=[]}const st=By({event:ie,marks:To(et),nodes:[],newEditorState:Xe,documentId:ee,trackedChangesForId:et});return st?(st.semanticColorKey==null&&D.semanticColorKey!=null&&(st.semanticColorKey=D.semanticColorKey),st.semanticColor==null&&D.semanticColor!=null&&(st.semanticColor=D.semanticColor),st.trackedChangeStory=D.story,st.trackedChangeStoryKind=D.storyKind,st.trackedChangeStoryLabel=D.storyLabel,st.trackedChangeAnchorKey=D.anchorKey,st):ve},xu=({superdoc:x,editor:D,snapshot:ee,documentId:ie,broadcastChanges:se,documentState:de,resolveFromEditor:pe})=>{if(!ee?.runtimeRef?.rawId)return;const ve=L.value.find(qe=>{if(!qe?.trackedChange)return!1;const Xe=qe.trackedChangeAnchorKey!=null?String(qe.trackedChangeAnchorKey):null;return Xe&&ee.anchorKey?Xe===ee.anchorKey:Xe||ee.anchorKey?!1:qe.commentId===ee.runtimeRef.rawId||qe.importedId===ee.runtimeRef.rawId});yr({superdoc:x,params:Mi({editor:D,snapshot:ee,documentId:ie,event:ve?"update":"add",resolveFromEditor:pe}),broadcastChanges:se,documentState:de}),ve&&(ve.trackedChangeStory=ee.story,ve.trackedChangeStoryKind=ee.storyKind,ve.trackedChangeStoryLabel=ee.storyLabel,ve.trackedChangeAnchorKey=ee.anchorKey)},Xi=x=>x?(Array.isArray(x)?x:[x]).filter(Boolean):[],Rf=()=>{const x=[];return L.value.forEach(D=>{const ee=D.getValues(),ie=ee.commentText,se=Xi(ee.docxCommentJSON),de=se.length?se:Tu(ie);x.push({...ee,commentJSON:de})}),x},Tu=x=>{const D=new qC({mode:"text",isHeadless:!0,content:x,extensions:YC()}).getJSON();return Array.isArray(D?.content)?D.content.filter(Boolean):[]},ic=x=>{if(x==null)return;const D={};Object.entries(x).forEach(([ie,se])=>{D[ie]=se;const de=se?.kind==="trackedChange"&&se?.storyKey==="body"&&se?.threadId!=null?String(se.threadId):null;de&&D[de]===void 0&&(D[de]=se);const pe=typeof se?.key=="string"?se.key:null;pe&&D[pe]===void 0&&(D[pe]=se)});const ee=ie=>{const se=[ie?.trackedChangeAnchorKey,ie?.commentId,ie?.importedId,pt(ie?.importedId)].map(de=>xe(de)).filter(Boolean);for(const de of se){const pe=D[de];if(pe!==void 0)return{entry:pe,aliasIds:se}}return{entry:null,aliasIds:se}};L.value.forEach(ie=>{if(!ie?.trackedChange)return;const{entry:se,aliasIds:de}=ee(ie);se&&de.forEach(pe=>{D[pe]===void 0&&(D[pe]=se)})}),ae.value=D},Ru=()=>{ae.value={}},Mu=x=>{if(!x?.trackedChange)return!1;const D=x?.trackedChangeDisplayType;return D==="tableInsert"||D==="tableDelete"?!0:[x?.commentId,x?.importedId,x?.trackedChangeAnchorKey].map(ee=>ee!=null?String(ee):"").filter(Boolean).some(ee=>ee.includes("word:structural:"))},fa=new WeakMap,ha=x=>{if(!x)return{ranges:[],ids:new Set};const D=fa.get(x);if(D)return D;const ee=[],ie=new Set,se=ve=>{ve!=null&&ve!==""&&ie.add(String(ve))},de=Ys?.enumerateStructuralRowChanges;if(typeof de=="function"){let ve=[];try{ve=de(x)??[]}catch{ve=[]}for(const qe of ve){if(!qe?.decidable||!qe?.wholeTable)continue;const Xe=Number(qe.tableFrom),et=Number(qe.tableTo);Number.isFinite(Xe)&&Number.isFinite(et)&&ee.push({from:Xe,to:et}),se(qe.id),se(qe.revisionId),se(qe.revisionGroupId),se(qe.sourceId);for(const st of qe.rows||[]){const yt=st?.node?.attrs?.trackChange;se(yt?.id),se(yt?.sourceId)}}}const pe={ranges:ee,ids:ie};return fa.set(x,pe),pe},Lu=x=>{const D=o.getDocument(x)?.getEditor?.();return ha(D?.state).ranges},gl=(x,D)=>!D?.length||!x?.length?!1:x.every(ee=>{const ie=Number(ee?.from),se=Number(ee?.to);return!Number.isFinite(ie)||!Number.isFinite(se)?!1:D.some(de=>ie>=de.from&&se<=de.to)}),Mf=x=>{if(!x?.trackedChange||Mu(x))return!1;const D=Lu(x?.fileId);if(!D.length)return!1;const ee=hn(x).entry,ie=Un(ee);return ie?D.some(se=>ie.start>=se.from&&ie.end<=se.to):!1},sc=Ae(()=>qr.value?.parentComments.filter(x=>!x.resolvedTime).filter(x=>!Qe(x)||nt(x)?!0:!!hn(x).entry).filter(x=>!Mf(x))),ac=Ae(()=>sc.value.flatMap(x=>{const{key:D,entry:ee}=hn(x);return aT({comment:x,positionKey:D,positionEntry:ee,fallbackId:xe(x?.commentId)??Ot(x)[0]??null})})),ei=x=>x==null?null:String(x),Qi=(x=null)=>{H.value=ei(x)},Br=()=>{M.value=null,Qi(null)},Lf=(x,D)=>x==null||D==null?!1:ac.value.some(ee=>String(ee.id)===String(x)&&String(ee.comment?.commentId??ee.threadId??"")===String(D)),Df=x=>{Lf(H.value,x)||Qi(null)},pa=({documentMode:x,commentsVisible:D,trackChangesVisible:ee}={})=>{typeof x=="string"&&(c.documentMode=x),typeof D=="boolean"&&(c.commentsVisible=D),typeof ee=="boolean"&&(c.trackChangesVisible=ee)},lc=x=>{if(Array.isArray(x))return x.map(pe=>lc(pe)).flat().filter(Boolean);if(!x||typeof x!="object")return x;const D=pe=>{if(!pe)return pe;const ve={...pe};return delete ve.fontSize,delete ve.fontFamily,delete ve.eastAsiaFontFamily,Object.keys(ve).length?ve:void 0},ee=pe=>{if(!pe)return pe;const ve=typeof pe.type=="string"?pe.type:pe.type?.name,qe=pe?.attrs?{...pe.attrs}:void 0;return ve==="textStyle"&&qe?{...pe,attrs:D(qe)}:{...pe,attrs:qe}},ie=pe=>Array.isArray(pe)?pe.filter(Boolean).map(ve=>ee(ve)):void 0,se=pe=>pe&&typeof pe=="object"?{...pe}:void 0;if(!Array.isArray(x.content))return{type:x.type,...x.text!==void 0?{text:x.text}:{},...x.attrs?{attrs:se(x.attrs)}:{},...x.marks?{marks:ie(x.marks)}:{}};const de=x.content.map(pe=>lc(pe)).flat().filter(Boolean);return x.type==="run"?de:{type:x.type,...x.attrs?{attrs:se(x.attrs)}:{},...x.marks?{marks:ie(x.marks)}:{},content:de}},Du=x=>{const D=Array.isArray(x)?x:x?[x]:[];if(D.some(ee=>ee?.content?.length))try{const ee=lc(D),ie=Array.isArray(ee)?ee:ee?[ee]:[];return ie.length?new qC({mode:"text",isHeadless:!0,content:{type:"doc",content:ie},loadFromSchema:!0,extensions:YC()}).getHTML():null}catch(ee){console.warn("Failed to convert comment",ee);return}};return{COMMENT_EVENTS:S,isDebugging:d,hasInitializedComments:y,hasSyncedCollaborationComments:C,editingCommentId:B,activeComment:M,activeFloatingCommentInstanceId:H,commentDialogs:z,overlappingComments:X,overlappedIds:P,suppressInternalExternal:N,pendingComment:_,currentCommentText:I,commentsList:L,isCommentsListVisible:he,generalCommentIds:be,editorCommentIds:ge,commentsParentElement:T,editorCommentPositions:ae,hasInitializedLocations:R,isCommentHighlighted:_e,floatingCommentsOffset:oe,sortedConversations:Te,visibleConversations:Ge,skipSelectionUpdate:Je,isFloatingCommentsReady:_t,instantSidebarAlignmentTargetY:Ve,instantSidebarAlignmentThreadId:Le,instantSidebarAlignmentInstanceId:J,getConfig:Cn,documentsWithConverations:lt,getGroupedComments:qr,hasOpenTrackedChanges:Ee,getCommentsByPosition:Fe,getFloatingComments:sc,getFloatingCommentInstances:ac,getCommentAliasIds:Ot,getTrackedChangeThread:le,getCommentPositionKey:Ft,getCommentPosition:so,getCommentAnchoredText:zo,getCommentAnchorData:rn,resolveCommentPositionEntry:hn,getCommentDocumentId:ul,belongsToDocument:dl,viewingVisibility:c,isViewingMode:F,shouldRenderReviewInViewing:j,init:Ce,setViewingVisibility:pa,getComment:Ht,setActiveComment:lr,getCommentLocation:bn,hasOverlapId:ft,getPendingComment:cr,showAddComment:rl,addComment:ol,addHydratedComment:Vo,cancelComment:al,deleteComment:mi,removePendingComment:pi,cancelImportedTrackedChangeBootstrap:bi,removeCommentsForDocument:wu,processLoadedDocxComments:ca,translateCommentsForExport:Rf,handleEditorLocationsUpdate:ic,clearEditorCommentPositions:Ru,handleTrackedChangeUpdate:yr,refreshTrackedChangeCommentsByIds:$t,syncResolvedCommentsWithDocument:xt,syncTrackedChangePositionsWithDocument:Dt,setActiveFloatingCommentInstance:Qi,requestInstantSidebarAlignment:cn,peekInstantSidebarAlignment:Fr,clearInstantSidebarAlignment:go,syncTrackedChangeComments:pl,decideTrackedChangeFromSidebar:xf,v2CommentsAdapter:V,setV2CommentsAdapter:G,getV2CommentsAdapter:Z,hydrateCommentsFromV2:sl,reconcileCommentsFromV2:Ki,isV2EditorActive:W,replyCommentV2:Yn,editCommentV2:il,resolveCommentV2:If,reopenCommentV2:aa,v2TrackedChangesAdapter:K,setV2TrackedChangesAdapter:ue,getV2TrackedChangesAdapter:we,hydrateTrackedChangesFromV2:Tf,reconcileTrackedChangeMutationFromV2:rc,reconcileTrackedChangesFromV2:bs}});var JC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4c0 0 0 0 0 0s0 0 0 0s0 0 0 0c0 0 0 0 0 0l.3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',$C='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"/></svg>',DT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304l91.4 0C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7L29.7 512C13.3 512 0 498.7 0 482.3zM625 177L497 305c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L591 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>',PT='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M144 0a80 80 0 1 1 0 160A80 80 0 1 1 144 0zM512 0a80 80 0 1 1 0 160A80 80 0 1 1 512 0zM0 298.7C0 239.8 47.8 192 106.7 192l42.7 0c15.9 0 31 3.5 44.6 9.7c-1.3 7.2-1.9 14.7-1.9 22.3c0 38.2 16.8 72.5 43.3 96c-.2 0-.4 0-.7 0L21.3 320C9.6 320 0 310.4 0 298.7zM405.3 320c-.2 0-.4 0-.7 0c26.6-23.5 43.3-57.8 43.3-96c0-7.6-.7-15-1.9-22.3c13.6-6.3 28.7-9.7 44.6-9.7l42.7 0C592.2 192 640 239.8 640 298.7c0 11.8-9.6 21.3-21.3 21.3l-213.3 0zM224 224a96 96 0 1 1 192 0 96 96 0 1 1 -192 0zM128 485.3C128 411.7 187.7 352 261.3 352l117.3 0C452.3 352 512 411.7 512 485.3c0 14.7-11.9 26.7-26.7 26.7l-330.7 0c-14.7 0-26.7-11.9-26.7-26.7z"/></svg>',zy='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>',e_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>',t_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/></svg>',n_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"/></svg>';const Qs={comment:JC,caretDown:$C,internal:DT,external:PT,markDone:zy,acceptChange:zy,rejectChange:e_,overflow:t_,reopen:n_};var OT=.38,FT=".superdoc-comment-highlight",BT=e=>{if(typeof e?.getBoundingClientRect!="function")return!1;const t=e.getBoundingClientRect();return!Number.isFinite(t.top)||!Number.isFinite(t.bottom)?!1:t.bottom>0&&t.top<window.innerHeight},NT=e=>e?e.split(",").map(t=>t.trim()).filter(Boolean):[],zT=e=>{const t=[];return e?(e.split(",").forEach(n=>{const r=n.indexOf("=");r<=0||t.push(n.slice(0,r),n.slice(r+1))}),t.filter(Boolean)):t};const HT=()=>Math.round(window.innerHeight*OT),r_=(e,t)=>{const n=t?.bounds?.top;if(!Number.isFinite(n)||typeof e?.getBoundingClientRect!="function")return null;const r=e.getBoundingClientRect().top+n;return r<0||r>=window.innerHeight?null:r},UT=e=>{if(typeof document>"u")return null;const t=new Set((e??[]).map(o=>String(o)).filter(Boolean));if(t.size===0)return null;let n=null;const r=document.querySelectorAll(FT);for(const o of r){const i=new Set([...NT(o.getAttribute("data-comment-ids")),...zT(o.getAttribute("data-comment-imported-ids"))]);if(![...t].some(a=>i.has(a))||!BT(o))continue;const s=o.getBoundingClientRect().top;Number.isFinite(s)&&(n=n==null?s:Math.min(n,s))}return n},VT=(e,t,n,r)=>{if(!e||!Number.isFinite(r))return null;const o=s=>{if(!s)return null;const a=e.getReachableThreadAnchorClientY(s,r);return Number.isFinite(a)&&e.scrollThreadAnchorToClientY(s,r,{behavior:"auto"})?a:null},i=o(t);return Number.isFinite(i)?i:!n||n===t?null:o(n)};It();const jT="Arial, Helvetica, sans-serif";function Hy(){const e=or();return{uiFontFamily:Ae(()=>{const t=e?.proxy?.$superdoc?.config?.uiDisplayFallbackFont;return typeof t=="string"&&t.trim()?t.trim():jT})}}var fn,mn=_r((()=>{fn=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n}}));It(),mn();var GT={class:"comments-dropdown"},WT=["onClick"],KT={key:0,class:"comments-dropdown__option-icon"},qT=["innerHTML"],YT={class:"comments-dropdown__option-label"},XT={__name:"CommentsDropdown",props:{options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,o=ne(!1),i=ne(null),s=ne(null),a=ne({top:"0px",left:"0px"}),l=Ae(()=>({...n.contentStyle,position:"fixed",top:a.value.top,left:a.value.left,zIndex:1200})),u=C=>{n.disabled&&C||(o.value=C)},c=()=>{n.disabled||u(!o.value)},d=()=>{o.value&&u(!1)},h=()=>{if(!i.value)return;const C=i.value.getBoundingClientRect(),T=s.value?.offsetWidth??0,R=window.innerWidth||document.documentElement.clientWidth||0,M=8;let H=C.left;const B=Math.max(M,R-T-M);H=Math.min(Math.max(M,H),B),a.value={top:`${C.bottom+4}px`,left:`${H}px`}},m=C=>{C.stopPropagation(),c()},p=C=>{C?.disabled||(r("select",C?.key,C),d())},g=C=>!!C?.iconString||!!C?.icon,k=C=>C?.iconString?C.iconString:typeof C?.icon=="function"?C.icon(C):C?.icon||null,w=Tl({name:"CommentsDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(C){return()=>k(C.option)}}),S=C=>{if(!o.value)return;const T=C.target;if(!(T instanceof Element))return;const R=i.value?.contains(T),M=s.value?.contains(T);R||M||d()},y=C=>{C.key==="Escape"&&d()};return Pt(o,async C=>{C&&(await St(),h())}),Pt(o,C=>{C?(document.addEventListener("pointerdown",S,!0),document.addEventListener("keydown",y,!0),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0)):(document.removeEventListener("pointerdown",S,!0),document.removeEventListener("keydown",y,!0),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0))}),rr(()=>{document.removeEventListener("pointerdown",S,!0),document.removeEventListener("keydown",y,!0),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}),(C,T)=>(me(),ke("div",GT,[Me("div",{ref_key:"triggerRef",ref:i,class:"comments-dropdown__trigger",onClick:m},[dd(C.$slots,"default",{},void 0,!0)],512),(me(),dn(Ra,{to:"body"},[o.value?(me(),ke("div",{key:0,ref_key:"menuRef",ref:s,class:"comments-dropdown__menu",style:gn(l.value)},[(me(!0),ke(qt,null,nr(e.options,R=>(me(),ke("div",{key:R.key,class:en(["comments-dropdown__option",{"sd-disabled":R.disabled}]),onClick:M=>p(R)},[g(R)?(me(),ke("span",KT,[R.iconString?(me(),ke("span",{key:0,innerHTML:R.iconString},null,8,qT)):(me(),dn(We(w),{key:1,option:R},null,8,["option"]))])):ut("",!0),Me("span",YT,Nt(R.label),1)],10,WT))),128))],4)):ut("",!0)]))]))}},o_=fn(XT,[["__scopeId","data-v-7eced80a"]]);It(),mn();var QT={class:"sd-comment-option"},ZT=["innerHTML"],JT={class:"sd-option-state"},$T=["innerHTML"],e7={__name:"InternalDropdown",props:{state:{type:String,required:!1},isDisabled:{type:Boolean,default:!1}},emits:["select"],setup(e,{emit:t}){const n=t,r=e,{uiFontFamily:o}=Hy(),i=[{label:"Internal",key:"internal",iconString:Qs.internal,backgroundColor:"var(--sd-ui-comments-internal-bg, #CDE6E6)"},{label:"External",key:"external",iconString:Qs.external,backgroundColor:"var(--sd-ui-comments-external-bg, #F5CFDA)"}],s=Ae(()=>i.find(d=>d.key===u.value)?.label),a=Ae(()=>{if(!r.state)return{};const d=i.find(m=>m.key===u.value);if(!d)return{};const h={backgroundColor:d.backgroundColor};return r.isDisabled&&(h.opacity=.5,h.cursor="default"),h}),l=(d,h=!1)=>{u.value=d,c.value=i.find(m=>m.key===d)?.iconString,!h&&n("select",d)},u=ne(r.state),c=ne(null);return Pt(()=>r.state,d=>{l(d)}),Rn(()=>{l(r.state,!0)}),(d,h)=>(me(),ke("div",{class:"sd-internal-dropdown",style:gn(a.value),"data-sd-part":"dropdown-trigger"},[Wt(o_,{options:i,onSelect:h[0]||(h[0]=m=>l(m)),disabled:e.isDisabled,"content-style":{fontFamily:We(o)}},{default:ko(()=>[Me("div",QT,[Me("div",{class:"sd-active-icon",innerHTML:c.value},null,8,ZT),Me("div",JT,Nt(s.value),1),Me("div",{class:"sd-dropdown-caret",innerHTML:We(Qs).caretDown},null,8,$T)])]),_:1},8,["disabled","content-style"])],4))}},i_=fn(e7,[["__scopeId","data-v-138d641e"]]);function t7(e){const t=new Date(e),n=t.getHours(),r=t.getMinutes(),o=n>=12?"PM":"AM",i=n%12||12,s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],a=t.getDate();return`${`${i}:${r.toString().padStart(2,"0")}${o}`} ${s} ${a}`}const oo=Object.freeze({RESOLVE_OWN:"RESOLVE_OWN",RESOLVE_OTHER:"RESOLVE_OTHER",REJECT_OWN:"REJECT_OWN",REJECT_OTHER:"REJECT_OTHER",COMMENTS_OVERFLOW_OWN:"COMMENTS_OVERFLOW",COMMENTS_OVERFLOW_OTHER:"COMMENTS_OVERFLOW_OTHER",COMMENTS_DELETE_OWN:"COMMENTS_DELETE_OWN",COMMENTS_DELETE_OTHER:"COMMENTS_DELETE_OTHER",UPLOAD_VERSION:"UPLOAD_VERSION",VERSION_HISTORY:"VERSION_HISTORY"});var pr=Object.freeze({EDITOR:"editor",SUGGESTER:"suggester",VIEWER:"viewer"}),n7=Object.freeze({[oo.RESOLVE_OWN]:{internal:[pr.EDITOR],external:[pr.EDITOR]},[oo.RESOLVE_OTHER]:{internal:[pr.EDITOR],external:[pr.EDITOR]},[oo.REJECT_OWN]:{internal:[pr.EDITOR,pr.SUGGESTER],external:[pr.EDITOR,pr.SUGGESTER]},[oo.REJECT_OTHER]:{internal:[pr.EDITOR],external:[pr.EDITOR]},[oo.COMMENTS_OVERFLOW_OWN]:{internal:[pr.EDITOR,pr.SUGGESTER],external:[pr.EDITOR,pr.SUGGESTER]},[oo.COMMENTS_OVERFLOW_OTHER]:{internal:[pr.EDITOR],external:[pr.EDITOR]},[oo.COMMENTS_DELETE_OWN]:{internal:[pr.EDITOR,pr.SUGGESTER],external:[pr.EDITOR,pr.SUGGESTER]},[oo.COMMENTS_DELETE_OTHER]:{internal:[pr.EDITOR],external:[pr.EDITOR]},[oo.UPLOAD_VERSION]:{internal:[pr.EDITOR],external:[]},[oo.VERSION_HISTORY]:{internal:[pr.EDITOR],external:[]}}),r7=(e={})=>{if(typeof e.permissionResolver=="function")return e.permissionResolver;if(e.superdoc?.config?.modules?.comments?.permissionResolver){const t=e.superdoc.config.modules.comments.permissionResolver;if(typeof t=="function")return t}return typeof e.superdoc?.config?.permissionResolver=="function"?e.superdoc.config.permissionResolver:null},o7=(e,t,n)=>{const r=n?"internal":"external";return n7[e]?.[r]?.includes(t)??!1};const Zs=(e,t,n,r={})=>{const o=o7(e,t,n),i=r7(r);if(typeof i!="function")return o;const s=i({permission:e,role:t,isInternal:n,defaultDecision:o,comment:r.comment??null,currentUser:r.currentUser??r.superdoc?.config?.user??null,superdoc:r.superdoc??null,trackedChange:r.trackedChange??null});return typeof s=="boolean"?s:o};It(),mn();var i7={class:"user-container"},s7=["src"],a7={key:1,class:"user-bg"},l7={__name:"Avatar",props:{user:{type:Object,required:!0}},setup(e){const t=(n,r)=>{if(!(!n&&!r)){if(n){const o=n.trim().split(/\s+/).filter(i=>/^[a-zA-Z]/.test(i));if(o.length>=2)return(o[0][0]+o[o.length-1][0]).toUpperCase();if(o.length===1)return o[0][0].toUpperCase()}return r?.substring(0,1)?.toUpperCase()||null}};return(n,r)=>(me(),ke("div",i7,[e.user.image?(me(),ke("img",{key:0,class:"user-bg",src:e.user.image.startsWith("http")?e.user.image:`data:image/png;base64,${e.user.image}`},null,8,s7)):(me(),ke("span",a7,Nt(t(e.user.name,e.user.email)),1))]))}},s_=fn(l7,[["__scopeId","data-v-c95b2073"]]);It(),mn();var c7={class:"card-section comment-header"},u7={class:"comment-header-left"},d7={class:"user-info"},f7={class:"user-name"},h7={key:0,class:"imported-tag"},p7={key:0,class:"user-timestamp"},m7=["data-disabled-reason","aria-disabled","innerHTML"],g7=["data-disabled-reason","aria-disabled","innerHTML"],v7=["data-disabled-reason","aria-disabled","innerHTML"],y7={class:"overflow-menu__icon"},b7=["innerHTML"],w7={__name:"CommentHeader",props:{timestamp:{type:Number,required:!1},config:{type:Object,required:!0},comment:{type:Object,required:!1},isPendingInput:{type:Boolean,required:!1,default:!1},isActive:{type:Boolean,default:!1},resolveDisabledReason:{type:String,default:null},rejectDisabledReason:{type:String,default:null},reopenDisabledReason:{type:String,default:null},reopenSupported:{type:Boolean,default:!1},writeDisabledReason:{type:String,default:null}},emits:["resolve","reject","reopen","overflow-select"],setup(e,{emit:t}){const n=t,r=Xs(),o=e,{proxy:i}=or(),s=i.$superdoc.config.role,a=i.$superdoc.config.isInternal,l=z=>{const X=i.$superdoc.config.user,P={id:z?.creatorId,email:z?.creatorEmail};if(Mw({current:X,other:P}))return!0;const N=Rd(X),I=Rd(P);if(N.hasId||N.hasEmail||I.hasId||I.hasEmail||z?.origin!=null||z?.importedAuthor?.name)return!1;const L=Rw(X?.name),Y=Rw(z?.creatorName);return!!(L&&Y&&L===Y)},u=Ae(()=>l(o.comment)),c=Ae(()=>fp(o.comment)),{uiFontFamily:d}=Hy(),h=Object.freeze({edit:{label:"Edit",key:"edit"},delete:{label:"Delete",key:"delete"}}),m=Ae(()=>o.config.readOnly!==!0),p=Ae(()=>!(!m.value||!o.comment||o.comment.resolvedTime||r.pendingComment||o.isPendingInput)),g=Ae(()=>{if(!p.value||!o.comment.trackedChange&&o.config.allowResolve===!1||o.comment.parentCommentId||c.value)return!1;const z={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return u.value||o.comment.trackedChange?Zs(oo.RESOLVE_OWN,s,a,z):Zs(oo.RESOLVE_OTHER,s,a,z)}),k=Ae(()=>{if(!p.value||!o.comment.trackedChange)return!1;const z={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return u.value||o.comment.trackedChange?Zs(oo.REJECT_OWN,s,a,z):Zs(oo.REJECT_OTHER,s,a,z)}),w=Ae(()=>{if(!m.value||o.config.allowResolve===!1||!o.reopenSupported||!o.comment||!o.comment.resolvedTime||r.pendingComment||o.isPendingInput||o.comment.parentCommentId||c.value||o.comment.trackedChange)return!1;const z={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return u.value?Zs(oo.RESOLVE_OWN,s,a,z):Zs(oo.RESOLVE_OTHER,s,a,z)}),S=Ae(()=>!(!p.value||o.comment.trackedChange||o.isPendingInput||y.value.length===0)),y=Ae(()=>{if(!m.value)return[];if(!p.value)return[];if(o.writeDisabledReason)return[];const z=[],X=new Set;l(o.comment)&&X.add("edit");const P=l(o.comment),N={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return(P&&Zs(oo.COMMENTS_DELETE_OWN,s,a,N)||!P&&Zs(oo.COMMENTS_DELETE_OTHER,s,a,N))&&X.add("delete"),X.forEach(I=>z.push(h[I])),z}),C=()=>{m.value&&(!o.comment?.trackedChange&&o.config.allowResolve===!1||o.resolveDisabledReason||n("resolve"))},T=()=>{m.value&&(o.rejectDisabledReason||n("reject"))},R=()=>{!m.value||o.config.allowResolve===!1||o.reopenDisabledReason||n("reopen")},M=z=>{m.value&&n("overflow-select",z)},H=Ae(()=>!(!(o.comment.origin!=null||o.comment.importedAuthor?.name)||l(o.comment))),B=Ae(()=>{if(o.isPendingInput)return i.$superdoc.config.user;const z=o.comment.getCommentUser();if(z?.name){const X=z.name.replace(/\s*\(imported\)\s*/gi,"").trim();if(X)return{...z,name:X}}return z});return(z,X)=>(me(),ke("div",c7,[Me("div",u7,[Wt(s_,{user:B.value,class:"avatar"},null,8,["user"]),Me("div",d7,[Me("div",f7,[Fi(Nt(B.value.name),1),H.value?(me(),ke("span",h7,"IMPORTED")):ut("",!0)]),o.comment.createdTime?(me(),ke("div",p7,Nt(We(t7)(o.comment.createdTime)),1)):ut("",!0)])]),Me("div",{class:en(["overflow-menu",{"is-visible":o.isActive}])},[g.value?(me(),ke("div",{key:0,class:en(["overflow-menu__icon",{"sd-is-disabled":!!e.resolveDisabledReason}]),"data-comment-action":"resolve","data-disabled-reason":e.resolveDisabledReason||null,"aria-disabled":!!e.resolveDisabledReason,innerHTML:We(Qs).markDone,onClick:Jt(C,["stop","prevent"])},null,10,m7)):ut("",!0),k.value?(me(),ke("div",{key:1,class:en(["overflow-menu__icon",{"sd-is-disabled":!!e.rejectDisabledReason}]),"data-comment-action":"reject","data-disabled-reason":e.rejectDisabledReason||null,"aria-disabled":!!e.rejectDisabledReason,innerHTML:We(Qs).rejectChange,onClick:Jt(T,["stop","prevent"])},null,10,g7)):ut("",!0),w.value?(me(),ke("div",{key:2,class:en(["overflow-menu__icon overflow-menu__icon--reopen",{"sd-is-disabled":!!e.reopenDisabledReason}]),"data-disabled-reason":e.reopenDisabledReason||null,"data-comment-reopen":!0,"aria-disabled":!!e.reopenDisabledReason,title:"Reopen comment",innerHTML:We(Qs).reopen,onClick:Jt(R,["stop","prevent"])},null,10,v7)):ut("",!0),S.value?(me(),dn(o_,{key:3,"data-comment-action":"overflow",options:y.value,onSelect:M,"content-style":{fontFamily:We(d)}},{default:ko(()=>[Me("div",y7,[Me("div",{class:"overflow-icon",innerHTML:We(Qs).overflow},null,8,b7)])]),_:1},8,["options","content-style"])):ut("",!0)],2)]))}},Uy=fn(w7,[["__scopeId","data-v-ca6050aa"]]);It(),mn();var C7={class:"input-section"},Vy=28,a_=132,_7={__name:"CommentInput",props:{users:{type:Array,required:!1,default:()=>[]},config:{type:Object,required:!0},isFocused:{type:Boolean,default:!1},includeHeader:{type:Boolean,default:!0},comment:{type:Object,required:!1}},emits:["focus"],setup(e,{expose:t,emit:n}){const r=n,{currentCommentText:o}=Hs(Xs()),i=ne(null),s=p=>r("focus",p),a=()=>{i.value?.focus?.()},l=()=>{const p=i.value;if(!p)return;p.style.height=`${Vy}px`;const g=p.scrollHeight||Vy,k=Math.min(Math.max(g,Vy),a_);p.style.height=`${k}px`,p.style.overflowY=g>a_?"auto":"hidden"},u=()=>{St(l)},c=p=>String(p??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),d=p=>{const g=String(p??"");if(!g||g==="<p></p>")return"";if(typeof document>"u")return g.replace(/<br\s*\/?>/gi,`
|
|
13
|
+
`).replace(/<[^>]+>/g,"");const k=document.createElement("div");return k.innerHTML=g,k.innerText||k.textContent||""},h=p=>{const g=String(p??"").replace(/\r\n/g,`
|
|
14
|
+
`).trim();return g?g.split(/\n{2,}/).map(k=>`<p>${c(k).replace(/\n/g,"<br>")}</p>`).join(""):"<p></p>"},m=Ae({get:()=>d(o.value),set:p=>{o.value=h(p)}});return Rn(u),Pt(o,u),t({focus:a}),(p,g)=>(me(),ke("div",C7,[e.includeHeader?(me(),dn(Uy,{key:0,config:e.config,comment:e.comment,"is-pending-input":!0},null,8,["config","comment"])):ut("",!0),Me("div",{class:en(["comment-entry",{"sd-input-active":e.isFocused}])},[Ms(Me("textarea",{ref_key:"inputRef",ref:i,class:"superdoc-field",placeholder:"Add a comment","onUpdate:modelValue":g[0]||(g[0]=k=>m.value=k),rows:"1",onInput:l,onFocus:g[1]||(g[1]=k=>s(!0)),onBlur:g[2]||(g[2]=k=>s(!1))},null,544),[[Ii,m.value]])],2)]))}},jy=fn(_7,[["__scopeId","data-v-cc54b489"]]);It(),mn();var S7=["data-comment-instance-id","data-comment-thread-id","data-comment-position-key","data-comment-page-index"],k7={key:0,class:"existing-internal-input"},A7={class:"new-comment-input-wrapper"},I7={class:"reply-actions"},E7=["disabled"],x7={key:0,class:"resolved-badge"},T7=["innerHTML"],R7={key:1,class:"existing-internal-input"},M7={key:0,class:"card-section comment-body"},L7=["data-track-change-semantic-color-key"],D7={key:0},P7={class:"change-type tracked-change-label"},O7={key:0,class:"tracked-change-detail-lines"},F7={key:0,class:"tracked-change-text"},B7={key:1,class:"change-type"},N7={class:"change-type"},z7={key:1},H7={class:"tracked-change-text is-inserted"},U7={key:2},V7={class:"tracked-change-text is-inserted"},j7={key:3},G7={key:4},W7={key:5},K7={key:6},q7={class:"tracked-change-text"},Y7={key:7},X7={class:"tracked-change-text is-deleted"},Q7={class:"tracked-change-text is-inserted"},Z7={key:8},J7={class:"tracked-change-text is-deleted"},$7={key:9},eR={class:"tracked-change-text is-inserted"},tR=["data-track-change-image-preview-role"],nR=["src","alt"],rR={key:1,class:"card-section comment-body"},oR=["innerHTML"],iR={key:1,class:"comment"},sR={key:2,class:"reply-expanded"},aR={class:"reply-input-wrapper"},lR={class:"reply-actions"},cR=["onClick"],uR=["onClick","disabled","data-disabled-reason"],dR={class:"collapsed-avatars"},fR={key:3,class:"comment-separator"},hR={key:2,class:"tracked-change-decision-alert",role:"alert"},pR={class:"tracked-change-decision-alert__message"},mR=["disabled","data-disabled-reason"],gR={key:1,class:"reply-expanded"},vR={class:"reply-input-wrapper"},yR={class:"reply-actions"},bR=["disabled","data-disabled-reason"],hp=3,l_=90,wR={__name:"CommentDialog",props:{comment:{type:Object,required:!0},autoFocus:{type:Boolean,default:!1},parent:{type:Object,required:!1},floatingInstanceId:{type:String,default:null},floatingPageIndex:{type:Number,default:null},floatingPositionEntry:{type:Object,default:null},isFloatingInstanceActive:{type:Boolean,default:void 0}},emits:["click-outside","ready","dialog-exit","resize"],setup(e,{emit:t}){const n=t,r=e,{proxy:o}=or(),i=eu(),s=Xs(),{addComment:a,cancelComment:l,deleteComment:u,getCommentAliasIds:c,removePendingComment:d,getCommentDocumentId:h,requestInstantSidebarAlignment:m,resolveCommentPositionEntry:p,clearInstantSidebarAlignment:g,setActiveFloatingCommentInstance:k}=s,{suppressInternalExternal:w,getConfig:S,activeComment:y,activeFloatingCommentInstanceId:C,floatingCommentsOffset:T,pendingComment:R,currentCommentText:M,isDebugging:H,editingCommentId:B,editorCommentPositions:z,isCommentHighlighted:X}=Hs(s),P=ne(!0),N=ne(null),I=ne(new Map),L=ne(null),Y=[[0,0],[-hp,0],[hp,0],[0,-hp],[0,hp]],te=Ee=>{const Fe=typeof Ee?.width=="number"&&Number.isFinite(Ee.width)?Ee.width:null,ft=typeof Ee?.height=="number"&&Number.isFinite(Ee.height)?Ee.height:null;if(!Fe||!ft||Fe<=0||ft<=0)return{};const lt=Math.min(l_/Fe,l_/ft,1);return{width:`${Math.max(1,Math.round(Fe*lt))}px`,height:`${Math.max(1,Math.round(ft*lt))}px`}},le=[".comments-dropdown__option-label",".comments-dropdown__menu",".comments-dropdown__option",".comments-dropdown__option-icon",".comments-dropdown__trigger",".superdoc-comment-highlight",".sd-editor-comment-highlight",".sd-editor-tracked-change-highlight","[data-track-change-id]",".track-insert",".track-insert-dec",".track-delete",".track-delete-dec",".track-format",".track-format-dec"].join(","),fe=Ee=>Fe=>{Ee&&(Fe?(I.value.set(Ee,Fe),B.value===Ee&&St(()=>{ge(Ee)})):I.value.delete(Ee))},Ne=(Ee,Fe,ft)=>{const lt=Ee?.getBoundingClientRect?.();return!lt||![lt.left,lt.top,lt.right,lt.bottom].every(Number.isFinite)||lt.width<=0||lt.height<=0?!1:Y.some(([Cn,bn])=>{const cr=Fe+Cn,Uo=ft+bn;return cr>=lt.left&&cr<=lt.right&&Uo>=lt.top&&Uo<=lt.bottom})},he=(Ee,Fe)=>{if(!Number.isFinite(Ee)||!Number.isFinite(Fe))return null;const ft=document.querySelectorAll(le);for(const lt of ft)if(lt instanceof HTMLElement&&Ne(lt,Ee,Fe))return lt;return null},ge=Ee=>{I.value.get(Ee)?.focus?.()},ae=ne(null),_e=Ee=>Ee.resolvedTime?Ee.commentId:Ee.importedId||Ee.commentId,oe=Ee=>Ee?Ee.trackedChange&&Ee.importedId!=null?String(Ee.importedId):Ee.commentId!=null?String(Ee.commentId):null:null,Te=(Ee,Fe)=>{const ft=Ee?.bounds?.[Fe];return Number.isFinite(ft)?ft:null},Ge=(Ee,Fe)=>{if(!Ee||!Fe||Ee.pageIndex!==Fe.pageIndex)return!1;const ft=Te(Ee,"top"),lt=Te(Fe,"top");return ft!=null&<!=null&&Math.abs(ft-lt)<.5},Je=(Ee,Fe)=>{const ft=Te(Ee,"left"),lt=Te(Fe,"left"),Cn=Te(Ee,"right"),bn=Te(Fe,"right");return[ft,lt,Cn,bn].some(cr=>cr==null)?!1:lt<Cn&&ft<bn},_t=(Ee,Fe)=>{const ft=Ee?.start,lt=Ee?.end,Cn=Fe?.start,bn=Fe?.end;return[ft,lt,Cn,bn].every(Number.isFinite)?Cn<=lt&&ft<=bn:!1},be=(Ee,Fe)=>!Ee||!Fe||Ee.kind&&Fe.kind&&Ee.kind!==Fe.kind||Ee.storyKey&&Fe.storyKey&&Ee.storyKey!==Fe.storyKey?!1:Fe.start===Ee.start&&Fe.end===Ee.end?!0:Ge(Ee,Fe)&&Je(Ee,Fe)&&_t(Ee,Fe),Ve=Ee=>{const Fe=new Set(c(Ee)),{key:ft,entry:lt}=p(Ee);return ft&&Fe.add(ft),lt?(Object.entries(z.value??{}).forEach(([Cn,bn])=>{be(lt,bn)&&Fe.add(Cn)}),[...Fe]):[...Fe]},Le=(Ee,Fe,ft=24)=>{if(!Number.isFinite(Fe)||typeof Ee?.getBoundingClientRect!="function")return!1;const lt=Ee.getBoundingClientRect().top;return Number.isFinite(lt)&&Math.abs(lt-Fe)<=ft},J=Ae(()=>r.floatingInstanceId??r.comment.commentId??null),_=Ae(()=>typeof r.isFloatingInstanceActive=="boolean"?r.isFloatingInstanceActive:y.value!==r.comment.commentId?!1:r.floatingInstanceId==null?!0:C.value===r.floatingInstanceId),$=Ae(()=>r.comment.resolvedTime?r.comment.trackedChange?r.comment.trackedChangeDecision==="reject"?"Rejected":"Accepted":"Resolved":null),F=Ae(()=>R.value&&R.value.commentId===r.comment.commentId),j=Ae(()=>Ee=>{const Fe=$n.value;return V.value&&Ee===Fe.length-1?!0:Fe.length>1&&Ee!==Fe.length-1}),V=Ae(()=>!S.readOnly&&_.value&&!r.comment.resolvedTime&&!Ot.value),G=()=>({ok:!1,reason:"read-only-document"}),Z=()=>S.value?.readOnly===!0,W=ne(!1),K=ne(!1),ue=()=>{if(Z())return G();if(xt.value)return{ok:!1,reason:Yt.value?.reason??"v2-write-unavailable"};W.value=!0,St(()=>{N.value?.focus?.(),n("resize")})},we=Ae(()=>{const Ee=r.comment;return Ee.trackedChange?s.getTrackedChangeThread(Ee):s.commentsList.filter(Fe=>{const ft=Fe.parentCommentId===Ee.commentId,lt=Fe.commentId===Ee.commentId;return ft||lt}).sort((Fe,ft)=>Fe.commentId===Ee.commentId?-1:ft.commentId===Ee.commentId?1:Fe.createdTime-ft.createdTime)}),Ce=ne(!1),xe=ne(null),ot=ne(!1),tt=Ae(()=>!Ce.value),Ct=()=>{Ce.value=!Ce.value,St(()=>n("resize"))},Kt=()=>{if(Ce.value)return;const Ee=xe.value;if(!Ee){ot.value=!1;return}ot.value=Ee.scrollHeight>Ee.clientHeight+1};Pt(xe,()=>{St(Kt)});const pt=()=>B.value?we.value.some(Ee=>Ee.commentId===B.value):!1;Pt(_,Ee=>{Ee||((W.value||pt())&&(M.value="",B.value=null),Ce.value=!1,Mt.value=!1,W.value=!1,St(()=>n("resize")))});const Mt=ne(!1),zt=Ae(()=>we.value.slice(1)),ln=Ae(()=>Mt.value?!1:zt.value.length>=2),$n=Ae(()=>ln.value?[we.value[0],zt.value[zt.value.length-1]].filter(Boolean):we.value),Ht=Ae(()=>ln.value?zt.value.length-1:0),Ke=Ae(()=>{if(!ln.value)return[];const Ee=zt.value.slice(0,-1),Fe=new Set;return Ee.map(ft=>typeof ft.getCommentUser=="function"?ft.getCommentUser():{name:ft.creatorName,email:ft.creatorEmail||ft.email}).filter(ft=>{if(!ft)return!1;const lt=ft.email||ft.name;return Fe.has(lt)?!1:(Fe.add(lt),!0)}).slice(0,3)}),kt=()=>{Mt.value=!0,De(),St(()=>n("resize"))},Ut=Ae(()=>r.comment.resolvedTime?!0:S.value.readOnly),Ft=Ae(()=>Ee=>_.value&&B.value===Ee.commentId),Ot=Ae(()=>!B.value||!_.value?!1:we.value.some(Ee=>Ee.commentId===B.value)),hn=Ae(()=>S.value.readOnly||!o.$superdoc.config.isInternal||nt.value?!1:!w.value&&!r.comment.trackedChange),yn=Ae(()=>M.value&&M.value!=="<p></p>"),De=async()=>{const Ee=o.$superdoc.activeEditor,Fe=Ee?.editorVersion===2?Ee?.v2Comments??null:null,ft=!!r.comment?.trackedChange,lt=HT(),Cn=r.floatingInstanceId!=null,bn=ae.value?.getBoundingClientRect?.().top,cr=!r.comment.resolvedTime&&(y.value!==r.comment.commentId||Cn&&J.value!==C.value);let Uo=lt;if(Fe){const pi=Ee?.editorVersion===2&&ft?Ee?.v2TrackedChanges??null:null,Ti=await(pi?pi.focusTrackedChange(r.comment):Fe.focusComment(r.comment));return Ti?.ok?(r.comment.resolvedTime||(y.value=r.comment.commentId,r.floatingInstanceId&&k(r.floatingInstanceId)),cr&&!Cn?m(lt,r.comment.commentId,r.floatingInstanceId??null):cr&&Number.isFinite(bn)?m(bn,r.comment.commentId,r.floatingInstanceId):g(),Ti):(g(),Ti)}if(Ee){const{entry:pi}=p(r.comment),Ti=r.floatingPositionEntry??pi,ol=Number.isFinite(r.floatingPageIndex)&&r.comment?.trackedChangeStory?.storyType==="headerFooterPart",Vo=r_(r.parent,Ti),mi=ol?null:UT(Ve(r.comment)),gi=Number.isFinite(mi)?mi:Vo,vo=Le(ae.value,gi),Yr=_e(r.comment),vi=null;let Ro=null;if(ft)if(r.comment.trackedChangeStory&&(r.comment.trackedChangeStory,{...Number.isFinite(r.floatingPageIndex)?{pageIndex:r.floatingPageIndex}:{}}),r.comment.resolvedTime)Ee.commands?.setCursorById(Yr);else{const Yn=r.comment.commentId;Ee.commands?.setCursorById(Yr,{activeCommentId:Yn})||Ee.commands?.setActiveComment({commentId:Yn})}else{if(r.comment.resolvedTime)Ee.commands?.setCursorById(Yr);else{const il=r.comment.commentId;Ee.commands?.setCursorById(Yr,{activeCommentId:il})||Ee.commands?.setActiveComment({commentId:il})}const Yn=r.comment.commentId;Ro=vo?null:VT(vi,Yr,Yn,lt)}Number.isFinite(mi)?Uo=mi:Number.isFinite(Vo)?Uo=Vo:Number.isFinite(Ro)&&(Uo=Ro)}cr&&!Cn?r.floatingInstanceId?m(Uo,r.comment.commentId,r.floatingInstanceId):m(Uo,r.comment.commentId):g(),r.comment.resolvedTime||(y.value=r.comment.commentId,r.floatingInstanceId&&k(r.floatingInstanceId))},Oe=Ee=>{const Fe=Ee.target instanceof Element?Ee.target:Ee.target?.parentElement,ft=document.elementFromPoint(Ee.clientX,Ee.clientY);if(!(Fe?.closest?.(le)||ft?.closest?.(le)||he(Ee.clientX,Ee.clientY)||X.value)&&!(Ee.target.closest?.(".comments-dialog")&&!ae.value?.contains(Ee.target))){if(F.value){l(o.$superdoc);return}_.value&&(T.value=0,n("dialog-exit"),y.value=null,s.setActiveComment(o.$superdoc,y.value),X.value=!1)}},Qe=async()=>{if(Z())return G();if(xt.value)return{ok:!1,reason:Yt.value?.reason??"v2-write-unavailable"};if(nt.value&&Dt.value&&!F.value){if(K.value)return{ok:!1,reason:"reply-submit-in-flight"};K.value=!0;try{const ft=await s.replyCommentV2({superdoc:o.$superdoc,parentCommentId:oe(r.comment),text:M.value});return ft?.ok?(W.value=!1,M.value="",St(()=>n("resize")),ft):(St(()=>n("resize")),ft)}finally{K.value=!1}}const Ee={documentId:r.comment.fileId,isInternal:R.value?R.value.isInternal:P.value,parentCommentId:R.value?null:r.comment.commentId};R.value&&(Ee.selection=R.value.selection.getValues());const Fe=s.getPendingComment(Ee);!R.value&&M.value&&Fe.setText({text:M.value,suppressUpdate:!0}),Promise.resolve(a({superdoc:o.$superdoc,comment:Fe})).finally(()=>{W.value=!1,St(()=>n("resize"))})},nt=Ae(()=>o.$superdoc?.activeEditor?.editorVersion===2),Dt=Ae(()=>nt.value?o.$superdoc?.activeEditor?.v2Comments??null:null),Et=Ae(()=>nt.value?o.$superdoc?.activeEditor?.v2TrackedChanges??null:null),Yt=Ae(()=>{if(!Dt.value)return null;const Ee=s.viewingVisibility.documentMode,Fe=Dt.value.getCapabilityState?.()??null;return Ee==="viewing"?{...Fe??{},canWrite:!1,reason:"review-surface-read-only"}:Fe}),xt=Ae(()=>{if(!nt.value)return!1;const Ee=Yt.value;return Ee?Ee.canWrite===!1:!1}),Un=Ae(()=>K.value?"reply-submit-in-flight":xt.value?Yt.value?.reason??"v2-write-unavailable":null),so=Ae(()=>{if(!Et.value)return null;const Ee=s.viewingVisibility.documentMode,Fe=Et.value.getCapabilityState?.()??null;return Ee==="viewing"&&Fe?.canDecide!==!1?{canDecide:!1,reason:"review-surface-read-only"}:Fe}),zo=Ee=>{if(nt.value&&Ee?.trackedChange){if(!Et.value)return"v2-tracked-change-adapter-missing";const Fe=so.value;return Fe&&Fe.canDecide===!1?Fe.reason??"v2-tracked-change-unavailable":null}return xt.value?Yt.value?.reason??"v2-write-unavailable":null},rn=Ee=>{if(nt.value&&Ee?.trackedChange){if(!Et.value)return"v2-tracked-change-adapter-missing";const Fe=so.value;return Fe&&Fe.canDecide===!1?Fe.reason??"v2-tracked-change-unavailable":null}return xt.value?Yt.value?.reason??"v2-write-unavailable":null},Vn=()=>nt.value?Dt.value?S.value?.readOnly?"read-only-document":xt.value?Yt.value?.reason??"v2-write-unavailable":null:"v2-comments-adapter-missing":null,lr=Ae(()=>!nt.value||!xt.value?null:Yt.value?.reason??"v2-write-unavailable"),yr=(Ee,Fe)=>{L.value={decision:Ee,reason:Fe?.reason??null},St(()=>n("resize"))},To=()=>{L.value&&(L.value=null,St(()=>n("resize")))},$t=Ae(()=>{const Ee=L.value;if(!Ee)return null;const Fe=Ee.decision==="reject"?"reject":"accept";return Ee.reason==="stale-catalog"?`Couldn't ${Fe} this change because the review list is stale.`:`Couldn't ${Fe} this change.`}),cn=()=>{const Ee=L.value;if(Ee){if(L.value=null,Ee.decision==="reject"){Fr();return}go()}},Fr=async()=>{if(Z())return G();const Ee=o.$superdoc.config.onTrackedChangeBubbleReject;if(r.comment.trackedChange){if(nt.value){const ft=await s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"reject"});if(!ft?.ok||ft.success===!1){yr("reject",ft);return}To(),typeof Ee=="function"&&Ee(r.comment,o.$superdoc.activeEditor),St(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.({preventScroll:!0})});return}let Fe=!0;if(typeof Ee=="function")Ee(r.comment,o.$superdoc.activeEditor);else{const ft=s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"reject"});Fe=!!ft?.ok&&ft.success!==!1}Fe&&r.comment.resolveComment({id:i.user.id,email:i.user.email,name:i.user.name,superdoc:o.$superdoc,decision:"reject"})}else if(nt.value&&Dt.value){if(!(await s.deleteComment({superdoc:o.$superdoc,commentId:r.comment.commentId}))?.ok)return}else s.deleteComment({superdoc:o.$superdoc,commentId:r.comment.commentId});St(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.()})},go=async()=>{if(Z())return G();if(!r.comment.trackedChange&&S.value?.allowResolve===!1)return{ok:!1,reason:"resolve-disabled"};const Ee=o.$superdoc.config.onTrackedChangeBubbleAccept;if(r.comment.trackedChange&&nt.value){const ft=await s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"accept"});if(!ft?.ok||ft.success===!1){yr("accept",ft);return}To(),typeof Ee=="function"&&Ee(r.comment,o.$superdoc.activeEditor),St(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.({preventScroll:!0})});return}let Fe=!0;if(r.comment.trackedChange&&typeof Ee=="function")Ee(r.comment,o.$superdoc.activeEditor);else if(r.comment.trackedChange){const ft=s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"accept"});Fe=!!ft?.ok&&ft.success!==!1}else if(nt.value&&Dt.value){if(!(await s.resolveCommentV2({superdoc:o.$superdoc,commentId:r.comment.commentId}))?.ok)return}else r.comment.resolveComment({id:i.user.id,email:i.user.email,name:i.user.name,superdoc:o.$superdoc});r.comment.trackedChange&&!nt.value&&Fe&&r.comment.resolveComment({id:i.user.id,email:i.user.email,name:i.user.name,superdoc:o.$superdoc,decision:"accept"}),St(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.()})},nl=async()=>{if(Z())return G();if(S.value?.allowResolve===!1)return{ok:!1,reason:"resolve-disabled"};!nt.value||!Dt.value||(await s.reopenCommentV2({superdoc:o.$superdoc,commentId:r.comment.commentId}))?.ok&&St(()=>{s.lastUpdate=new Date,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.()})},sa=(Ee,Fe)=>{if(Z())return G();switch(Ee){case"edit":M.value=Fe?.commentText?.value??Fe?.commentText??"",y.value=r.comment.commentId,r.floatingInstanceId&&k(r.floatingInstanceId),B.value=Fe.commentId,s.setActiveComment(o.$superdoc,y.value),St(()=>{ge(Fe.commentId)});break;case"delete":u({superdoc:o.$superdoc,commentId:Fe.commentId});break}},rl=async Ee=>{if(Z())return G();if(nt.value&&Dt.value){const Fe=await s.editCommentV2({superdoc:o.$superdoc,commentId:Ee.commentId,text:M.value});return Fe?.ok&&(B.value=null,d(o.$superdoc)),Fe}B.value=null,Ee.setText({text:M.value,superdoc:o.$superdoc}),d(o.$superdoc)},gs=Ee=>{if(Z())return G();const Fe=!!R.value,ft=Ee.toLowerCase()==="internal";Fe?R.value.isInternal=ft:r.comment.setIsInternal({isInternal:ft,superdoc:o.$superdoc})},Ho=Ae(()=>{const Ee={};return(_.value||F.value||Ot.value)&&(Ee.zIndex=50),Ee}),$o=Ee=>typeof Ee=="string"?new Date(Ee).getTime():Ee,hi=Ee=>{B.value=null,W.value=!1,l(o.$superdoc)},qr=Ae(()=>{const Ee=o.$superdoc.users;return r.comment.isInternal===!0?Ee.filter(Fe=>Fe.access?.role==="internal"):Ee});return Rn(()=>{r.autoFocus&&St(()=>De()),F.value&&St(()=>{N.value?.focus?.()}),St(()=>{n("ready",{commentId:r.floatingInstanceId??(r.comment.importedId!==void 0?r.comment.importedId:r.comment.commentId),elementRef:ae}),Kt()})}),Pt(V,Ee=>{Ee&&St(()=>{N.value?.focus?.()})},{immediate:!0}),Pt(B,Ee=>{if(!Ee||!_.value)return;const Fe=we.value.find(ft=>ft.commentId===Ee);!Fe||Fe.trackedChange||St(()=>{ge(Ee)})}),Pt(()=>S.value?.readOnly===!0,Ee=>{Ee&&(W.value=!1,we.value.some(Fe=>Fe.commentId===B.value)&&(B.value=null),F.value&&l(o.$superdoc),St(()=>n("resize")))},{immediate:!0}),Pt(xt,Ee=>{Ee&&(W.value=!1,St(()=>n("resize")))}),(Ee,Fe)=>{const ft=T2("click-outside");return Ms((me(),ke("div",{class:en(["comments-dialog",{"is-active":_.value||F.value,"is-resolved":r.comment.resolvedTime}]),onClick:Jt(De,["stop","prevent"]),style:gn(Ho.value),ref_key:"commentDialogElement",ref:ae,role:"dialog","data-sd-part":"comment-thread","data-editor-ui-surface":"","data-comment-instance-id":r.floatingInstanceId??"","data-comment-thread-id":r.comment.commentId??"","data-comment-position-key":r.comment.trackedChangeAnchorKey??"","data-comment-page-index":Number.isFinite(r.floatingPageIndex)?r.floatingPageIndex:""},[F.value?(me(),ke(qt,{key:0},[hn.value?(me(),ke("div",k7,[Wt(i_,{onClick:Fe[0]||(Fe[0]=Jt(()=>{},["stop","prevent"])),class:"sd-internal-dropdown","is-disabled":!1,state:We(R).isInternal?"internal":"external",onSelect:gs},null,8,["state"])])):ut("",!0),Wt(Uy,{config:We(S),comment:r.comment,"is-pending-input":!0},null,8,["config","comment"]),Me("div",A7,[Wt(jy,{ref_key:"commentInput",ref:N,users:qr.value,config:We(S),comment:r.comment,"include-header":!1},null,8,["users","config","comment"])]),Me("div",I7,[Me("button",{class:"sd-button reply-btn-cancel",onClick:Jt(hi,["stop","prevent"])},"Cancel"),Me("button",{class:en(["sd-button primary reply-btn-primary",{"sd-is-disabled":!yn.value}]),onClick:Jt(Qe,["stop","prevent"]),disabled:!yn.value}," Comment ",10,E7)])],64)):(me(),ke(qt,{key:1},[$.value?(me(),ke("div",x7,[Me("span",{class:"resolved-badge__icon",innerHTML:We(Qs).markDone},null,8,T7),Fi(" "+Nt($.value),1)])):ut("",!0),hn.value?(me(),ke("div",R7,[Wt(i_,{onClick:Fe[1]||(Fe[1]=Jt(()=>{},["stop","prevent"])),class:"sd-internal-dropdown","is-disabled":Ut.value,state:e.comment.isInternal?"internal":"external",onSelect:gs},null,8,["is-disabled","state"])])):ut("",!0),(me(!0),ke(qt,null,nr($n.value,(lt,Cn)=>(me(),ke("div",{key:lt.commentId,class:"conversation-item"},[Wt(Uy,{config:We(S),timestamp:$o(lt.createdTime),comment:lt,"is-active":_.value,"resolve-disabled-reason":zo(lt),"reject-disabled-reason":rn(lt),"reopen-supported":nt.value&&!!Dt.value,"reopen-disabled-reason":Vn(),"write-disabled-reason":lr.value,onResolve:go,onReject:Fr,onReopen:nl,onOverflowSelect:bn=>sa(bn,lt)},null,8,["config","timestamp","comment","is-active","resolve-disabled-reason","reject-disabled-reason","reopen-supported","reopen-disabled-reason","write-disabled-reason","onOverflowSelect"]),lt.trackedChange?(me(),ke("div",M7,[Me("div",{class:en(["tracked-change",{"is-truncated":tt.value&&Cn===0}]),"data-track-change-semantic-color-key":lt.semanticColorKey??void 0,ref_for:!0,ref:Cn===0?bn=>xe.value=bn:void 0},[lt.trackedChangeLabel?(me(),ke("div",D7,[Me("span",P7,Nt(lt.trackedChangeLabel),1),lt.trackedChangeDetailLines&<.trackedChangeDetailLines.length?(me(),ke("div",O7,[(me(!0),ke(qt,null,nr(lt.trackedChangeDetailLines,(bn,cr)=>(me(),ke("div",{key:cr,class:"tracked-change-detail-line"},[bn.excerpt?(me(),ke("span",F7,'"'+Nt(bn.excerpt)+'"',1)):ut("",!0),bn.excerpt?(me(),ke("span",B7," β ")):ut("",!0),Me("span",N7,Nt(bn.label),1)]))),128))])):ut("",!0)])):lt.trackedChangeDisplayType==="hyperlinkAdded"?(me(),ke("div",z7,[Fe[2]||(Fe[2]=Me("span",{class:"change-type"},"Added hyperlink ",-1)),Me("span",H7,'"'+Nt(lt.trackedChangeText)+'"',1)])):lt.trackedChangeDisplayType==="hyperlinkModified"?(me(),ke("div",U7,[Fe[3]||(Fe[3]=Me("span",{class:"change-type"},"Changed hyperlink to ",-1)),Me("span",V7,'"'+Nt(lt.trackedChangeText)+'"',1)])):lt.trackedChangeDisplayType==="paragraphSplit"?(me(),ke("div",j7,[...Fe[4]||(Fe[4]=[Me("span",{class:"change-type"},"Added new line",-1)])])):lt.trackedChangeDisplayType==="tableInsert"?(me(),ke("div",G7,[...Fe[5]||(Fe[5]=[Me("span",{class:"change-type"},"Added table",-1)])])):lt.trackedChangeDisplayType==="tableDelete"?(me(),ke("div",W7,[...Fe[6]||(Fe[6]=[Me("span",{class:"change-type"},"Deleted table",-1)])])):lt.trackedChangeType==="trackFormat"?(me(),ke("div",K7,[Fe[7]||(Fe[7]=Me("span",{class:"change-type"},"Format: ",-1)),Me("span",q7,Nt(lt.trackedChangeText),1)])):lt.trackedChangeType==="both"?(me(),ke("div",Y7,[Fe[8]||(Fe[8]=Me("span",{class:"change-type"},"Replaced ",-1)),Me("span",X7,'"'+Nt(lt.deletedText)+'"',1),Fe[9]||(Fe[9]=Me("span",{class:"change-type"}," with ",-1)),Me("span",Q7,'"'+Nt(lt.trackedChangeText)+'"',1)])):lt.deletedText?(me(),ke("div",Z7,[Fe[10]||(Fe[10]=Me("span",{class:"change-type"},"Deleted ",-1)),Me("span",J7,'"'+Nt(lt.deletedText)+'"',1)])):lt.trackedChangeText?(me(),ke("div",$7,[Fe[11]||(Fe[11]=Me("span",{class:"change-type"},"Added ",-1)),Me("span",eR,'"'+Nt(lt.trackedChangeText)+'"',1)])):ut("",!0),lt.trackedChangeImagePreview?.src?(me(),ke("div",{key:10,class:"tracked-change-image-preview","data-track-change-image-preview-role":lt.trackedChangeImagePreview.role??void 0},[Me("img",{class:"tracked-change-image-preview__image",src:lt.trackedChangeImagePreview.src,alt:lt.trackedChangeImagePreview.alt||"Tracked image preview",style:gn(te(lt.trackedChangeImagePreview)),loading:"lazy",decoding:"async"},null,12,nR)],8,tR)):ut("",!0)],10,L7),tt.value&&ot.value&&Cn===0?(me(),ke("div",{key:0,class:"show-more-toggle",onClick:Jt(Ct,["stop","prevent"])}," Show more ")):ut("",!0),Ce.value&&ot.value&&Cn===0?(me(),ke("div",{key:1,class:"show-more-toggle",onClick:Jt(Ct,["stop","prevent"])}," Show less ")):ut("",!0)])):ut("",!0),lt.trackedChange?ut("",!0):(me(),ke("div",rR,[!We(H)&&!Ft.value(lt)?(me(),ke("div",{key:0,class:en(["comment",{"is-truncated":tt.value&&Cn===0}]),ref_for:!0,ref:Cn===0?bn=>xe.value=bn:void 0,innerHTML:lt.commentText},null,10,oR)):We(H)&&!Ft.value(lt)?(me(),ke("div",iR,Nt(We(z)[lt.importedId!==void 0?lt.importedId:lt.commentId]?.bounds),1)):(me(),ke("div",sR,[Me("div",aR,[Wt(jy,{ref_for:!0,ref:fe(lt.commentId),users:qr.value,config:We(S),"include-header":!1,comment:lt},null,8,["users","config","comment"])]),Me("div",lR,[Me("button",{class:"sd-button reply-btn-cancel",onClick:Jt(bn=>hi(lt),["stop","prevent"])},"Cancel",8,cR),Me("button",{class:en(["sd-button primary reply-btn-primary",{"sd-is-disabled":!yn.value||xt.value}]),onClick:Jt(bn=>rl(lt),["stop","prevent"]),disabled:!yn.value||xt.value,"data-disabled-reason":xt.value?Yt.value?.reason??null:null}," Update ",10,uR)])])),tt.value&&ot.value&&Cn===0&&!Ft.value(lt)?(me(),ke("div",{key:3,class:"show-more-toggle",onClick:Jt(Ct,["stop","prevent"])}," Show more ")):ut("",!0),Ce.value&&ot.value&&Cn===0&&!Ft.value(lt)?(me(),ke("div",{key:4,class:"show-more-toggle",onClick:Jt(Ct,["stop","prevent"])}," Show less ")):ut("",!0)])),ln.value&&Cn===0?(me(),ke(qt,{key:2},[Fe[12]||(Fe[12]=Me("div",{class:"comment-separator"},null,-1)),Me("div",{class:"collapsed-replies",onClick:Jt(kt,["stop","prevent"])},[Me("div",dR,[(me(!0),ke(qt,null,nr(Ke.value,bn=>(me(),dn(s_,{key:bn.email||bn.name,user:bn,class:"mini-avatar"},null,8,["user"]))),128))]),Me("span",null,Nt(Ht.value)+" more "+Nt(Ht.value===1?"reply":"replies"),1)])],64)):ut("",!0),j.value(Cn)?(me(),ke("div",fR)):ut("",!0)]))),128)),L.value?(me(),ke("div",hR,[Me("span",pR,Nt($t.value),1),Me("button",{type:"button",class:"sd-button tracked-change-decision-alert__retry",onClick:Jt(cn,["stop","prevent"])}," Retry ")])):ut("",!0),V.value&&!We(S).readOnly?(me(),ke(qt,{key:3},[W.value?(me(),ke("div",gR,[Me("div",vR,[Wt(jy,{ref_key:"commentInput",ref:N,users:qr.value,config:We(S),comment:r.comment,"include-header":!1},null,8,["users","config","comment"])]),Me("div",yR,[Me("button",{class:"sd-button reply-btn-cancel",onClick:Jt(hi,["stop","prevent"])},"Cancel"),Me("button",{class:en(["sd-button primary reply-btn-primary",{"sd-is-disabled":!yn.value||xt.value||K.value}]),onClick:Jt(Qe,["stop","prevent"]),disabled:!yn.value||xt.value||K.value,"data-disabled-reason":Un.value}," Reply ",10,bR)])])):(me(),ke("button",{key:0,type:"button",class:en(["reply-pill",{"sd-is-disabled":xt.value}]),onClick:Jt(ue,["stop","prevent"]),disabled:xt.value,"data-disabled-reason":xt.value?Yt.value?.reason??null:null}," Reply or add others with @ ",10,mR))],64)):ut("",!0)],64))],14,S7)),[[ft,Oe]])}}},pp=fn(wR,[["__scopeId","data-v-387d6ba0"]]);It(),mn();var CR={class:"comments-list"},_R={key:0},SR=["data-comment-instance-id","data-comment-thread-id","data-comment-position-key","data-comment-page-index"],kR={key:1},AR="headerFooterPart",IR={__name:"commentsList",props:{showMainComments:{type:Boolean,default:!0},showResolvedComments:{type:Boolean,default:!0}},setup(e){const t=e,n=Xs(),r=Qm(n,"isCommentsListVisible"),o=Ae(()=>n.getGroupedComments),i=Ae(()=>n.getFloatingCommentInstances),{activeComment:s,activeFloatingCommentInstanceId:a}=Hs(n),l=m=>{const p=i.value.filter(g=>g?.comment?.commentId===m?.commentId);return p.length<2?[]:m?.trackedChange?m?.trackedChangeStory?.storyType!==AR?[]:p:[]},u=m=>!m?.comment?.commentId||s.value!==m.comment.commentId?!1:a.value==null?m.isPrimary===!0:String(a.value)===String(m.id),c=m=>{const p=l(m);return p.length?p.map(g=>({id:g.id,comment:m,floatingInstanceId:String(g.id),floatingPageIndex:g.pageIndex,floatingPositionEntry:g.positionEntry??null,isFloatingInstanceActive:u(g)})):[{id:m.commentId,comment:m,floatingInstanceId:null,floatingPageIndex:null,floatingPositionEntry:null,isFloatingInstanceActive:void 0}]},d=Ae(()=>o.value.parentComments.flatMap(m=>c(m))),h=Ae(()=>t.showResolvedComments&&o.value?.resolvedComments?.length>0);return Rn(()=>{r.value=!0}),rr(()=>{r.value=!1}),(m,p)=>(me(),ke("div",CR,[e.showMainComments?(me(),ke("div",_R,[(me(!0),ke(qt,null,nr(d.value,g=>(me(),ke("div",{key:g.id,class:"comment-item","data-comment-instance-id":g.floatingInstanceId??"","data-comment-thread-id":g.comment.commentId??"","data-comment-position-key":g.comment.trackedChangeAnchorKey??"","data-comment-page-index":Number.isFinite(g.floatingPageIndex)?g.floatingPageIndex:""},[Wt(pp,{comment:g.comment,"floating-instance-id":g.floatingInstanceId,"floating-page-index":g.floatingPageIndex,"floating-position-entry":g.floatingPositionEntry,"is-floating-instance-active":g.isFloatingInstanceActive},null,8,["comment","floating-instance-id","floating-page-index","floating-position-entry","is-floating-instance-active"])],8,SR))),128))])):ut("",!0),h.value?(me(),ke("div",kR,[p[0]||(p[0]=Me("div",{class:"comment-title"},"Resolved",-1)),(me(!0),ke(qt,null,nr(o.value.resolvedComments,g=>(me(),ke("div",{key:g.commentId,class:"comment-item"},[Wt(pp,{comment:g},null,8,["comment"])]))),128))])):ut("",!0)]))}},ER=fn(IR,[["__scopeId","data-v-e89dbc33"]]);It();var xR=class extends Rm.default{element;config={comments:[],element:null,commentsStore:null};constructor(e,t){super(),this.config={...this.config,...e},this.element=this.config.element,this.app=null,this.superdoc=t,this.open()}createVueApp(){this.app=Bl(ER);const e=this.superdoc?.app?._context?.provides;e&&this.app?._context?.provides&&Object.setPrototypeOf(this.app._context.provides,e),this.superdoc?.pinia&&(Md(this.superdoc.pinia),this.app.use(this.superdoc.pinia),this.app.config.globalProperties.$pinia=this.superdoc.pinia),this.app.directive("click-outside",Dv),this.app.config.globalProperties.$superdoc=this.superdoc,!this.element&&this.config.selector&&(this.element=document.getElementById(this.config.selector)),this.container=this.app.mount(this.element)}close(){this.app&&(this.app.unmount(),this.app=null,this.container=null,this.element=null)}open(){this.app||this.createVueApp()}},TR,Va,Gy=_r((()=>{TR=2,Va=96/72}));It(),Gy();var RR=96,MR=".superdoc__right-sidebar",LR=".sd-pdf-viewer-page";const Wy=Object.freeze({min:10,max:100,padding:0}),c_=e=>{const t=e&&typeof e=="object"?e:{},n=(s,a)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:a,r=n(t.min,Wy.min),o=n(t.max,Wy.max),i=typeof t.padding=="number"&&Number.isFinite(t.padding)&&t.padding>=0?t.padding:Wy.padding;return{min:Math.min(r,o),max:Math.max(r,o),padding:i}},u_=(e,t)=>!(e>0)||!(t>0)?null:Math.round(e/t*100),DR=(e,t,n)=>{const r=u_(e-n.padding,t);return r===null?null:Math.max(1,Math.round(Math.min(n.max,Math.max(n.min,r))))},PR=(e,t,n)=>e>0?Number.isFinite(t)&&t>0?e/t*Va:n>0?e/n:e:null;function OR({getSuperdoc:e,superdocContainerWidth:t,isReady:n,activeZoom:r,zoomMode:o,viewportMetrics:i,showCommentsSidebar:s,rightSidebarRef:a,superdocRoot:l,documents:u}){const c=C=>{if(!C)return null;let T=0;try{const H=C.getPages?.();if(Array.isArray(H))for(const B of H){const z=B?.size?.w;typeof z=="number"&&Number.isFinite(z)&&z>T&&(T=z)}}catch{T=0}if(T>0)return T;let R=null;try{R=C.getPageStyles?.()??null}catch{R=null}const M=R?.pageSize?.width;return typeof M=="number"&&Number.isFinite(M)&&M>0?M*RR:null},d=()=>{if(!(u?.value??[]).some(R=>R?.type==="application/pdf"))return null;const C=l.value;if(!C?.querySelectorAll)return null;let T=0;for(const R of C.querySelectorAll(LR)){const M=Number(R.clientWidth)||Number(R.getBoundingClientRect?.().width)||0;let H=NaN;typeof window<"u"&&typeof window.getComputedStyle=="function"&&(H=Number.parseFloat(window.getComputedStyle(R).getPropertyValue("--scale-factor")));const B=(r.value??100)/100,z=PR(M,H,B);z!==null&&z>T&&(T=z)}return T>0?T:null},h=()=>{const C=e();if(!C)return null;const T=[],R=u?.value??[];for(const H of R){if(H?.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")continue;const B=c(H.getEditor?.());B!==null&&T.push(B)}if(T.length===0){const H=c(C.activeEditor);H!==null&&T.push(H)}const M=d();if(M!==null&&T.push(M),T.length>0)return Math.max(...T);if(C.activeEditor){const H=l.value?.querySelector?.(".superdoc__document"),B=Number(H?.clientWidth)||Number(H?.getBoundingClientRect?.().width)||0;if(B>0){const z=(r.value??100)/100;return z>0?B/z:B}}return null},m=()=>{if(!s?.value)return 0;const C=a?.value??l.value?.querySelector?.(MR),T=Number(C?.offsetWidth)||Number(C?.getBoundingClientRect?.().width)||0;return T>0?T:0},p=(C,T)=>{const R=c_(C.config?.zoom?.fitWidth),M=DR(T.availableWidth,T.documentWidth,R);M!==null&&M!==r.value&&(r.value=M,C.emit("zoomChange",{zoom:M,mode:"fit-width"}))},g=()=>{const C=e();if(!C)return;const T=t.value;if(!(T>0)||!n.value)return;const R=h();if(R===null)return;const M=T-m(),H=u_(M,R);if(H===null)return;const B=Object.freeze({availableWidth:M,documentWidth:R,fitZoom:H}),z=i.value;(!z||z.availableWidth!==M||z.documentWidth!==R||z.fitZoom!==H)&&(i.value=B),(!z||z.fitZoom!==H||Math.round(z.documentWidth)!==Math.round(R))&&C.emit("viewport-change",B),o.value==="fit-width"&&p(C,B)};Pt(t,()=>{St(()=>g())}),Pt(n,C=>{C&&g()}),Pt(o,C=>{C==="fit-width"&&g()}),s&&Pt(s,()=>{St(()=>g())});const k=()=>{St(()=>g())},w=()=>{St(()=>g())},S=()=>{St(()=>g())},y=e();return y?.on?.("editorCreate",k),y?.on?.("pagination-update",w),y?.on?.("pdf:document-ready",S),rr(()=>{y?.off?.("editorCreate",k),y?.off?.("pagination-update",w),y?.off?.("pdf:document-ready",S)}),{evaluateViewport:g}}const FR=e=>!!e?.trackedChange,BR=e=>e,NR=(e,t,n,r=e)=>!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)?!1:(Number.isFinite(r)?r:e)<t||e>n,zR=({comment:e,anchorTop:t,anchorBottom:n,viewportTop:r,viewportBottom:o})=>FR(e)&&NR(t,r,o,n),HR=({comment:e,anchorTop:t,anchorBottom:n,cardHeight:r,viewportTop:o,viewportBottom:i})=>!zR({comment:e,anchorTop:t,anchorBottom:n,viewportTop:o,viewportBottom:i})||!Number.isFinite(r)?null:(Number.isFinite(n)?n:t)<o?Math.min(t,o-r-1):t,UR=({id:e,visibleIds:t,activeCommentInstanceId:n})=>e?!!(e==="pending"||n!=null&&String(e)===String(n)||t?.has?.(e)):!1,d_=({previousIds:e,currentIds:t,removedId:n})=>{if(!Array.isArray(e)||!(t instanceof Set)||!n)return null;const r=e.indexOf(n);if(r<0)return null;for(let o=r+1;o<e.length;o+=1){const i=e[o];if(t.has(i))return i}for(let o=r-1;o>=0;o-=1){const i=e[o];if(t.has(i))return i}return null};It(),mn();var VR=["data-comment-id","data-comment-instance-id","data-comment-thread-id","data-comment-position-key","data-comment-page-index"],Ul={},jR={__name:"FloatingComments",props:{currentDocument:{type:Object,required:!0},parent:{type:Object,required:!0}},setup(e){const r=(De,Oe,Qe)=>{if(Oe>=0){De[Oe].top=De[Oe].anchorTop;let nt=De[Oe].top+De[Oe].height+Qe;for(let Et=Oe+1;Et<De.length;Et++)De[Et].top=Math.max(De[Et].anchorTop,nt),nt=De[Et].top+De[Et].height+Qe;nt=De[Oe].top-Qe;for(let Et=Oe-1;Et>=0;Et--){const Yt=nt-De[Et].height;De[Et].top=Math.min(De[Et].anchorTop,Yt),nt=De[Et].top-Qe}const Dt=Math.min(...De.map(Et=>Et.top));if(Dt<0){const Et=Math.abs(Dt);for(const Yt of De)Yt.top+=Et}}else for(let nt=1;nt<De.length;nt++){const Dt=De[nt-1],Et=Dt.top+Dt.height+Qe;De[nt].top<Et&&(De[nt].top=Et)}},o=e,i=eu(),s=Xs(),{clearInstantSidebarAlignment:a}=s,{activeComment:l,activeFloatingCommentInstanceId:u,editorCommentPositions:c,pendingComment:d,editingCommentId:h,instantSidebarAlignmentTargetY:m,instantSidebarAlignmentThreadId:p,instantSidebarAlignmentInstanceId:g}=Hs(s),{activeZoom:k}=Hs(i),w=Ae(()=>{const De=s.getFloatingCommentInstances;if(!Array.isArray(De))return[];const Oe=o.currentDocument?.id;return Oe==null?De:De.filter(Qe=>s.belongsToDocument(Qe.comment,String(Oe),{allowSingleDocumentMismatch:!0}))}),S=ne(null),y=ne(0),C=ne(0),T=ne(!1),R=ne(null),M=ne(0),H=De=>{const Oe=d.value?.commentId;return Oe?typeof De=="object"?De?.commentId===Oe:De===Oe||De==="pending":!1},B=De=>De?.commentId??De?.importedId??null,z=Ae(()=>{const De=new Map,Oe=new Map;for(const Qe of w.value){Qe?.id!=null&&De.set(String(Qe.id),Qe);const nt=B(Qe?.comment);if(nt==null)continue;const Dt=String(nt),Et=Oe.get(Dt)??[];Et.push(Qe),Oe.set(Dt,Et)}return{byId:De,byThreadId:Oe}}),X=(De,Oe=null)=>{if(De==null)return null;const Qe=String(De),nt=z.value.byThreadId.get(Qe)??[];if(!nt.length)return null;if(Oe!=null){const Dt=nt.find(Et=>String(Et.id)===String(Oe));if(Dt)return Dt.id}return nt.find(Dt=>Dt.isPrimary)?.id??nt[0]?.id??null},P=Ae(()=>l.value?X(l.value,u.value):null),N=De=>{if(typeof De=="number")return Number.isFinite(De)?De:null;if(typeof De!="string"||De.trim()==="")return null;const Oe=Number(De);return Number.isFinite(Oe)?Oe:null},I=ne({...Ul}),L=ne(new Set),Y=ne({});let te=null;const le=new Set;let fe=null;const Ne=()=>{fe==null&&(fe=requestAnimationFrame(()=>{fe=null,M.value+=1}))},he=De=>{if(o.currentDocument.type==="application/pdf"){const Oe=(k.value??100)/100,Qe=N(De?.comment?.selection?.selectionBounds?.top);return Qe==null?null:Qe*Oe}return De?.positionEntry?.bounds?.top},ge=(De,Oe)=>{if(o.currentDocument.type==="application/pdf"){const nt=(k.value??100)/100,Dt=N(De?.comment?.selection?.selectionBounds?.bottom);return Dt!=null?Dt*nt:Oe}const Qe=De?.positionEntry?.bounds?.bottom;return Number.isFinite(Qe)?Qe:Oe},ae=Ae(()=>{const De=[];for(const Oe of w.value){const Qe=Oe?.id,nt=B(Oe?.comment),Dt=he(Oe);if(Qe==null||nt==null||!Number.isFinite(Dt))continue;const Et=BR(Dt,Oe.comment);De.push({id:Qe,threadId:nt,instance:Oe,top:Et,anchorBottom:ge(Oe,Et)})}return De}),_e=()=>{const De=c.value.pending;if(typeof De?.bounds?.top=="number"&&!isNaN(De.bounds.top))return De.bounds.top;const Oe=o.currentDocument.type==="application/pdf"?(k.value??100)/100:1,Qe=N(d.value?.selection?.selectionBounds?.top);return Qe==null?null:Qe*Oe},oe=De=>UR({id:De?.id,visibleIds:L.value,activeCommentInstanceId:P.value,comment:De?.commentRef}),Te=()=>{const De=S.value;if(!De)return null;const Oe=De.getBoundingClientRect();if(!Number.isFinite(Oe.top)||!Number.isFinite(window.innerHeight))return null;let Qe=0,nt=window.innerHeight;for(let Et=De.parentElement;Et;Et=Et.parentElement){const Yt=window.getComputedStyle(Et).overflowY;if(!["auto","scroll","hidden","clip"].includes(Yt))continue;const xt=Et.getBoundingClientRect();!Number.isFinite(xt.top)||!Number.isFinite(xt.bottom)||(Qe=Math.max(Qe,xt.top),nt=Math.min(nt,xt.bottom))}if(nt<=Qe)return null;const Dt=o.parent?.getBoundingClientRect?.();if(Dt&&Number.isFinite(Dt.top)&&Number.isFinite(Dt.bottom)){const Et=Math.max(Qe,Dt.top),Yt=Math.min(nt,Dt.bottom);Yt>Et&&(Qe=Et,nt=Yt)}return{top:Qe-Oe.top,bottom:nt-Oe.top}},Ge=Ae(()=>p.value?X(p.value,g.value):null),Je=Ae(()=>{M.value;const De=ae.value,Oe=d.value&&d.value.fileId===o.currentDocument.id;if(!De.length&&!w.value.length&&!Oe)return[];const Qe=[],nt=Te()??{top:0,bottom:Math.max(0,o.parent?.clientHeight||window.innerHeight||0)},Dt=nt.top-600,Et=nt.bottom+600,Yt=Oe?"pending":P.value,xt=new Set,Un=({id:rn,threadId:Vn,instance:lr,top:yr,anchorBottom:To,hasAnchorGeometry:$t})=>{const cn=String(rn);xt.has(cn)||(xt.add(cn),Qe.push({id:rn,threadId:Vn,pageIndex:lr?.pageIndex??null,anchorTop:yr,anchorBottom:To,hasAnchorGeometry:$t,top:yr,height:I.value[rn]||110,commentRef:lr.comment,instanceRef:lr}))};for(const rn of De){const{id:Vn,threadId:lr,instance:yr,top:To,anchorBottom:$t}=rn,cn=Yt!=null&&String(Vn)===String(Yt),Fr=h.value!=null&&String(lr)===String(h.value);!cn&&!Fr&&($t<Dt||To>Et)||Un({id:Vn,threadId:lr,instance:yr,top:To,anchorBottom:$t,hasAnchorGeometry:!0})}const so=[];if(Yt&&Yt!=="pending"){const rn=z.value.byId.get(String(Yt));rn&&so.push(rn)}if(h.value!=null){const rn=z.value.byThreadId.get(String(h.value))??[],Vn=rn.find(lr=>lr.isPrimary)??rn[0];Vn&&so.push(Vn)}for(const rn of so){const Vn=rn.id,lr=B(rn.comment);Vn==null||lr==null||xt.has(String(Vn))||Un({id:Vn,threadId:lr,instance:rn,top:nt.top,anchorBottom:nt.top,hasAnchorGeometry:!1})}if(Oe){const rn=_e();typeof rn=="number"&&!isNaN(rn)&&Qe.push({id:"pending",anchorTop:rn,anchorBottom:rn,hasAnchorGeometry:!0,top:rn,height:I.value.pending||110,commentRef:d.value})}Qe.sort((rn,Vn)=>rn.anchorTop-Vn.anchorTop);const zo=[];for(const rn of Qe){const Vn=rn.hasAnchorGeometry?HR({comment:rn.commentRef,anchorTop:rn.anchorTop,anchorBottom:rn.anchorBottom,cardHeight:rn.height,viewportTop:nt.top,viewportBottom:nt.bottom}):null;Vn==null?zo.push(rn):rn.top=Vn}return r(zo,Yt?zo.findIndex(rn=>rn.id===Yt):-1,15),Qe}),_t=Ae(()=>(M.value,Math.max(0,o.parent?.clientHeight||0,o.parent?.scrollHeight||0))),be=()=>{te&&te.disconnect(),te=new IntersectionObserver(De=>{const Oe=new Set(L.value);for(const Qe of De){const nt=Qe.target.dataset.commentId;nt&&(Qe.isIntersecting?Oe.add(nt):Oe.delete(nt))}L.value=Oe},{rootMargin:"600px 0px 600px 0px"})},Ve=()=>{if(!te)return;const De=new Set;for(const Oe of Je.value){const Qe=Y.value[Oe.id];Qe&&(De.add(Qe),le.has(Qe)||(te.observe(Qe),le.add(Qe)))}for(const Oe of le)De.has(Oe)||(te.unobserve(Oe),le.delete(Oe))},Le=(De,Oe)=>{Oe<=0||Oe===I.value[De]||(Ul[De]=Oe,I.value={...I.value,[De]:Oe})},J=De=>{if(!De)return;const{elementRef:Oe,commentId:Qe}=De;Oe&&St(()=>{const nt=Oe.value?.getBoundingClientRect();!nt||nt.height<=0||Qe&&Le(Qe,nt.height)})},_=De=>{const Oe=De?.id;Oe&&St(()=>{const Qe=Y.value[Oe];if(!Qe)return;const nt=Qe.querySelector(".comments-dialog");if(!nt)return;Le(Oe,nt.getBoundingClientRect().height);const Dt=Oe===P.value,Et=Oe==="pending",Yt=!!h.value&&!!l.value&&De?.threadId!=null&&String(De.threadId)===String(l.value);!Dt&&!Et&&!Yt||(pt(Je.value.map(xt=>xt.id)),ln(()=>Je.value.map(xt=>xt.id)))})},$=De=>{!De&&R.value!=null||(T.value=De)},F=(De,Oe,Qe)=>{if(!Number.isFinite(Oe)){Qe?.(!1);return}const nt=Y.value[De];if(!nt){Qe?.(!1);return}const Dt=nt.getBoundingClientRect().top;C.value+=Oe-Dt,Qe?.(!0)},j=(De,Oe)=>{if(Oe)Y.value[De]=Oe,te&&!le.has(Oe)&&(te.observe(Oe),le.add(Oe));else{const Qe=Y.value[De];Qe&&te&&(te.unobserve(Qe),le.delete(Qe)),delete Y.value[De]}};let V=[],G=null,Z=[],W=null,K=!1,ue=0,we=null,Ce=null,xe=null,ot=null;const tt=()=>{xe=null,ot=null,R.value=null,$(!1)},Ct=De=>{if(!xe)return;const Oe=(De?.target instanceof Element?De.target:null)?.closest?.("[data-comment-action]"),Qe=Oe?.getAttribute?.("data-comment-action");(Qe==="resolve"||Qe==="reject")&&S.value?.contains?.(Oe)||tt()},Kt=()=>{V.forEach(clearTimeout),V=[]},pt=De=>{for(const Oe of De.filter(Boolean)){const Qe=Y.value[Oe];if(!Qe)continue;const nt=Qe.querySelector(".comments-dialog");nt&&Le(Oe,nt.getBoundingClientRect().height)}},Mt=50,zt=350,ln=De=>{Kt();const Oe=typeof De=="function"?De:()=>De;V.push(setTimeout(()=>pt(Oe()),Mt)),V.push(setTimeout(()=>pt(Oe()),zt))},$n=()=>{a(),requestAnimationFrame(()=>{$(!1)})},Ht=(De,Oe)=>{!De||!Number.isFinite(Oe)||($(!0),St(()=>{pt([De]),F(De,Oe,()=>{$n()})}))},Ke=()=>{W=null,ue+=1,we!=null&&(cancelAnimationFrame(we),we=null),$(!1)},kt=()=>{if(!W||K)return;K=!0;const De=ue;we!=null&&(cancelAnimationFrame(we),we=null),$(!0),St(()=>{if(K=!1,De!==ue){kt();return}const{key:Oe,targetClientY:Qe}=W;pt([Oe]),F(Oe,Qe,nt=>{if(De===ue){if(!nt){$(!1);return}we=requestAnimationFrame(()=>{we=null,De===ue&&$(!1)})}})})},Ut=(De,Oe)=>{const Qe=d_({previousIds:Z,currentIds:Oe,removedId:De}),nt=(Qe?Y.value[Qe]:null)?.getBoundingClientRect?.().top;return!Qe||!Number.isFinite(nt)?(Ke(),!1):(W={key:Qe,targetClientY:nt},ue+=1,kt(),!0)},Ft=De=>{const Oe=De?.target?.closest?.("[data-comment-action]"),Qe=Oe?.getAttribute?.("data-comment-action");if(Qe!=="resolve"&&Qe!=="reject"||(tt(),Oe.getAttribute?.("aria-disabled")==="true"))return;const nt=Oe.closest?.("[data-comment-id]")?.getAttribute?.("data-comment-id");if(!nt||String(P.value??"")===String(nt))return;const Dt=Je.value.filter(xt=>xt.commentRef?.trackedChange).map((xt,Un)=>({id:xt.id,index:Un,top:xt.top})).filter(xt=>Number.isFinite(xt.top)).sort((xt,Un)=>xt.top-Un.top||xt.index-Un.index).map(xt=>xt.id),Et=d_({previousIds:Dt,currentIds:new Set(Dt),removedId:nt}),Yt=(Et?Y.value[Et]:null)?.getBoundingClientRect?.().top;!Et||!Number.isFinite(Yt)||(xe={removedKey:nt,targetKey:Et,targetClientY:Yt,applied:!1},ot=nt,R.value=Et,$(!0))};Pt(P,(De,Oe)=>{if(Kt(),!(xe!=null&&ot!=null&&[De,Oe].some(Dt=>Dt!=null&&String(Dt)===String(ot)))){if(ot=null,De)tt(),Ke();else if(Oe){const Dt=new Set(Je.value.map(Et=>Et.id));Dt.has(Oe)?Ke():Ut(Oe,Dt)}}const Qe=[De,Oe],nt=De&&De===Ge.value&&Number.isFinite(m.value);St(()=>{if(nt){pt(Qe);return}ln(Qe)})}),Pt([P,Ge,m],([De,Oe,Qe])=>{!De||!Oe||De!==Oe||!Number.isFinite(Qe)||Ht(De,Qe)}),Pt(h,()=>{Kt(),St(()=>{ln(()=>Je.value.map(De=>De.id))})}),Pt(l,()=>{if(G&&clearTimeout(G),!l.value){if(a(),W){kt();return}$(!1),C.value=0;return}if(!(H(l.value)?d.value:s.getComment(l.value)))return;const De=H(l.value)?"pending":P.value;if(De){if(De===Ge.value&&Number.isFinite(m.value)){$(!0);return}St(()=>{G=setTimeout(()=>{const Qe=Y.value[De];if(!Qe)return;const nt=o.parent?.getBoundingClientRect?.();if(!nt)return;const Dt=Je.value.find(Un=>Un.id===De),Et=De==="pending"?_e():Dt?.anchorTop;if(typeof Et!="number"||isNaN(Et))return;const Yt=Qe.getBoundingClientRect().top,xt=nt.top+Et;C.value+=xt-Yt},400)})}}),Pt(k,()=>{if(o.currentDocument.type==="application/pdf"){for(const De in Ul)delete Ul[De];I.value={},y.value+=1}});let Ot=new Set,hn=null,yn=null;return Pt(Je,De=>{const Oe=P.value?De.find($t=>$t.id===P.value):null,Qe=typeof Oe?.anchorTop=="number"&&Number.isFinite(Oe.anchorTop)?Oe.anchorTop:null,nt=Qe!=null&&hn!=null&&Math.abs(Qe-hn)>1,Dt=typeof Oe?.top=="number"&&Number.isFinite(Oe.top)?Oe.top:null,Et=Dt!=null&&yn!=null&&Math.abs(Dt-yn)>1;nt&&C.value!==0&&!Number.isFinite(m.value)?(C.value=0,$(!1)):Et&&C.value!==0&&!Number.isFinite(m.value)&&!W&&($(!0),C.value+=yn-Dt,Ce!=null&&cancelAnimationFrame(Ce),Ce=requestAnimationFrame(()=>{Ce=null,!W&&!Number.isFinite(m.value)&&$(!1)})),hn=Qe,yn=Dt;const Yt=De.map($t=>$t.id),xt=new Set(Yt);if(xe&&!xe.applied&&!xt.has(xe.removedKey)){const{targetKey:$t,targetClientY:cn}=xe;xe.applied=!0,xt.has($t)&&Number.isFinite(cn)?(W={key:$t,targetClientY:cn},ue+=1,kt()):tt()}if(xe?.applied&&!xt.has(xe.targetKey)&&tt(),W&&!xt.has(W.key)){const $t=W.key;Ut($t,xt)||($(!1),C.value=0)}const Un=new Set(L.value);let so=!1,zo=-1/0,rn=1/0;const Vn=S.value;if(Vn){const $t=Vn.getBoundingClientRect();zo=-$t.top-600,rn=-$t.top+window.innerHeight+600}const lr=new Map(De.map($t=>[$t.id,$t]));for(const $t of xt)if(!Un.has($t)){const cn=lr.get($t);(!cn||cn.top>=zo&&cn.top<=rn)&&(Un.add($t),so=!0)}for(const $t of Un)xt.has($t)||(Un.delete($t),so=!0);so&&(L.value=Un);for(const $t of Ot)xt.has($t)||delete Ul[$t];const yr=Ot.size!==xt.size||[...Ot].some($t=>!xt.has($t)),To=Z.length!==Yt.length||Z.some(($t,cn)=>$t!==Yt[cn]);if(yr){const $t={};for(const cn of xt)Ul[cn]&&($t[cn]=Ul[cn]);I.value=$t,St(()=>{for(const cn of De){const Fr=Y.value[cn.id];if(!Fr)continue;const go=Fr.querySelector(".comments-dialog");go&&Le(cn.id,go.getBoundingClientRect().height)}})}W&&(yr||To)&&kt(),Ot=xt,St(()=>{Z=Yt,Ve()})}),Rn(()=>{be(),o.parent?.addEventListener?.("scroll",Ne,{passive:!0}),window.addEventListener("resize",Ne,{passive:!0}),document.addEventListener("pointerdown",Ct,!0),St(Ve)}),rr(()=>{Kt(),G&&clearTimeout(G),tt(),Ke(),Ce!=null&&(cancelAnimationFrame(Ce),Ce=null),o.parent?.removeEventListener?.("scroll",Ne),window.removeEventListener("resize",Ne),document.removeEventListener("pointerdown",Ct,!0),fe!=null&&(cancelAnimationFrame(fe),fe=null),te&&(te.disconnect(),te=null,le.clear())}),(De,Oe)=>(me(),ke("div",{class:"section-wrapper",ref_key:"floatingCommentsContainer",ref:S,onClickCapture:Ft,style:gn({minHeight:_t.value+"px",transition:T.value?"none":void 0})},[Me("div",{class:"sidebar-container",style:gn({transform:`translateY(${C.value}px)`,transition:T.value?"none":void 0})},[(me(!0),ke(qt,null,nr(Je.value,Qe=>(me(),ke("div",{key:Qe.id,ref_for:!0,ref:nt=>j(Qe.id,nt),"data-comment-id":Qe.id,"data-comment-instance-id":Qe.id,"data-comment-thread-id":Qe.threadId,"data-comment-position-key":Qe.instanceRef?.positionKey??"","data-comment-page-index":Qe.pageIndex??"",class:en([{"is-direct-decision-continuity-target":Qe.id===R.value},"comment-placeholder"]),style:gn({top:Qe.top+"px",height:Qe.height+"px",transition:T.value?"none":void 0})},[oe(Qe)?(me(),dn(pp,{key:Qe.id+y.value,onReady:J,onResize:nt=>_(Qe),class:"floating-comment",parent:e.parent,comment:Qe.commentRef,"floating-instance-id":Qe.id,"floating-page-index":Qe.pageIndex,"floating-position-entry":Qe.instanceRef?.positionEntry??null,"is-floating-instance-active":Qe.id===P.value},null,8,["onResize","parent","comment","floating-instance-id","floating-page-index","floating-position-entry","is-floating-instance-active"])):ut("",!0)],14,VR))),128))],4)],36))}},GR=fn(jR,[["__scopeId","data-v-b5be33eb"]]);It(),mn();var WR={class:"superdoc__pdf-comments-layer pdf-comments-layer","aria-hidden":"false"},KR=["data-id","data-comment-id","data-page-number","onClick","onKeydown"],qR="pdf",YR="#078383",XR="#B1124B",QR={__name:"PdfCommentsLayer",emits:["anchor-activate"],setup(e,{emit:t}){const n=t,r=Xs(),o=eu(),{activeComment:i}=Hs(r),{documents:s,activeZoom:a}=Hs(o),{proxy:l}=or(),u=y=>typeof y=="number"?Number.isFinite(y):typeof y=="string"&&y.trim()!==""?Number.isFinite(Number(y)):!1,c=y=>!!y&&u(y.top)&&u(y.left)&&u(y.right)&&u(y.bottom),d=Ae(()=>{const y=Array.isArray(s.value)?s.value:[];return new Set(y.filter(C=>C?.type===Nl).map(C=>String(C.id)))}),h=y=>{const C=y?.fileId??y?.documentId??y?.selection?.documentId;return C!=null?String(C):null},m=y=>{const C=y?.commentId??y?.importedId;return C!=null&&String(C)!==""?String(C):null},p=y=>{const C=d.value;if(!C.size)return!1;const T=h(y);return T?C.has(T):C.size===1},g=y=>{const C=Math.min(Number(y.top),Number(y.bottom)),T=Math.max(Number(y.top),Number(y.bottom));return{top:C,left:Math.min(Number(y.left),Number(y.right)),right:Math.max(Number(y.left),Number(y.right)),bottom:T}},k=Ae(()=>{const y=r.getFloatingComments;return Array.isArray(y)?y.filter(C=>C?.selection?.source===qR).filter(C=>!C.resolvedTime).filter(C=>m(C)!==null).filter(C=>c(C.selection?.selectionBounds)).filter(C=>p(C)).map(C=>{const T=m(C),R=g(C.selection.selectionBounds);return{commentId:T,page:C.selection?.page??null,isInternal:C.isInternal!==!1,bounds:R}}):[]}),w=y=>{const C=(a.value??100)/100,{top:T,left:R,right:M,bottom:H}=y.bounds,B=i.value===y.commentId,z=(y.isInternal?YR:XR)+(B?"66":"33");return{position:"absolute",top:T*C+"px",left:R*C+"px",width:(M-R)*C+"px",height:(H-T)*C+"px",backgroundColor:z}},S=y=>{r.setActiveComment(l.$superdoc,y.commentId),n("anchor-activate",y.commentId)};return(y,C)=>(me(),ke("div",WR,[(me(!0),ke(qt,null,nr(k.value,T=>(me(),ke("div",{key:T.commentId,class:"sd-comment-anchor sd-highlight",role:"button",tabindex:"0","data-id":T.commentId,"data-comment-id":T.commentId,"data-page-number":T.page,style:gn(w(T)),onClick:Jt(R=>S(T),["stop","prevent"]),onKeydown:[Qo(Jt(R=>S(T),["stop","prevent"]),["enter"]),Qo(Jt(R=>S(T),["stop","prevent"]),["space"])]},null,44,KR))),128))]))}},ZR=fn(QR,[["__scopeId","data-v-b5ad4c58"]]);It();const JR=({proxy:e,layers:t,documents:n,modules:r})=>{const o=Ae(()=>{const z=r.value?.whiteboard??r.whiteboard;return z===!1||z==null?null:z}),i=e?.$superdoc?.whiteboard,s=Wr([]),a=jr({}),l=jr({}),u=ne(!1),c=ne(0),d=ne(0),h=ne(1),m=ne(o.value?.enabled??!1),p=()=>{if(u.value)return;c.value+=1;const z=d.value||s.value.length;z&&c.value>=z&&(u.value=!0,e?.$superdoc?.emit("whiteboard:ready",{whiteboard:i}))},g=z=>{if(!z)return;const X=n.value?.[0];X&&X.type==="application/pdf"&&k(z)},k=z=>{const{pageIndex:X,width:P,height:N,originalWidth:I,originalHeight:L}=z,Y={width:P,height:N,originalWidth:I,originalHeight:L};i?.setPageSize(X,Y),a[X]=Y;const te=i?.getPage(X);te&&te.setSize(Y),i&&(s.value=i.getPages().sort((le,fe)=>le.pageIndex-fe.pageIndex).map(le=>Gr(le)),d.value=s.value.length),St(()=>{H(),p()})},w=z=>{e?.$superdoc?.emit("whiteboard:change",z)},S=z=>{z.forEach(X=>{const P=a[X.pageIndex];P&&X.setSize(P)}),s.value=z.map(X=>Gr(X)),d.value=s.value.length,St(()=>H())},y=z=>{m.value=z,e?.$superdoc?.emit("whiteboard:enabled",z)},C=z=>{h.value=z},T=z=>{e?.$superdoc?.emit("whiteboard:tool",z)},R=()=>{const z=n.value?.[0];z&&z.type==="application/pdf"&&M({doc:z})},M=({doc:z})=>{s.value.forEach(X=>{const P=`${z.id}-page-${X.pageIndex+1}`,N=document.querySelector(`[data-page-id="${P}"]`);if(!N)return;const I=N.getBoundingClientRect(),L=a[X.pageIndex]||{},Y=L.originalWidth??X.size?.originalWidth??I.width,te=L.originalHeight??X.size?.originalHeight??I.height,le={width:I.width,height:I.height,originalWidth:Y,originalHeight:te};a[X.pageIndex]=le,X.setSize(le)})},H=()=>{const z=t.value?.getBoundingClientRect?.();if(!z)return;const X=n.value?.[0];X&&X.type==="application/pdf"&&B({doc:X,layerBounds:z})},B=({doc:z,layerBounds:X})=>{s.value.forEach(P=>{const N=`${z.id}-page-${P.pageIndex+1}`,I=document.querySelector(`[data-page-id="${N}"]`);if(!I)return;const L=I.getBoundingClientRect();l[P.pageIndex]={top:L.top-X.top,left:L.left-X.left}})};return i&&(i.on("change",w),i.on("setData",S),i.on("enabled",y),i.on("opacity",C),i.on("tool",T)),rr(()=>{i&&(i.off("change",w),i.off("setData",S),i.off("opacity",C),i.off("enabled",y),i.off("tool",T))}),{whiteboard:i,whiteboardModuleConfig:o,whiteboardPages:s,whiteboardPageSizes:a,whiteboardPageOffsets:l,whiteboardEnabled:m,whiteboardOpacity:h,whiteboardReady:u,handleWhiteboardPageReady:g,updateWhiteboardPageSizes:R,updateWhiteboardPageOffsets:H}};It(),mn();var $R=["data-page-index"],e9={__name:"WhiteboardPage",props:{whiteboard:{type:Object,required:!0},page:{type:Object,required:!0},pageSize:{type:Object,default:null},pageOffset:{type:Object,default:null},enabled:{type:Boolean,default:!0}},setup(e){const t=e,n=ne(null),r=()=>{const u=n.value;!u||!t.page||(t.page.mount(u),t.pageSize&&t.page.resize(t.pageSize.width,t.pageSize.height))},o=u=>{if(!t.page||!u?.dataTransfer||!t.enabled||t.whiteboard.getTool()!=="select")return;u.preventDefault(),u.stopPropagation();const c=n.value;if(!c)return;const d=c.getBoundingClientRect(),h=u.clientX-d.left,m=u.clientY-d.top,p=t.pageSize?.width,g=t.pageSize?.originalWidth??p,k=Number.isFinite(p)&&Number.isFinite(g)&&g?p/g:1;i(u,h,m,k)||s(u,h,m,k)||a(u,h,m)||l(u,h,m)},i=(u,c,d,h)=>{const m=u.dataTransfer.getData("application/sticker");if(!m)return!1;const p=(t.whiteboard.getType("stickers")||[]).find(g=>g.id===m);return p?.src?(t.page.addImage({stickerId:p.id,x:c,y:d,src:p.src,width:Number.isFinite(p.width)?p.width*h:p.width,height:Number.isFinite(p.height)?p.height*h:p.height,type:"sticker"}),!0):!1},s=(u,c,d,h)=>{const m=Array.from(u.dataTransfer.files||[]).find(g=>g.type.startsWith("image/"));if(!m)return!1;const p=new FileReader;return p.onload=()=>{typeof p.result=="string"&&t.page.addImage({x:c,y:d,src:p.result,type:"image"})},p.readAsDataURL(m),!0},a=(u,c,d)=>{const h=u.dataTransfer.getData("application/comment");if(!h)return!1;const m=(t.whiteboard.getType("comments")||[]).find(p=>p.id===h);return m?.text?(t.page.addText({x:c,y:d,content:m.text}),!0):!1},l=(u,c,d)=>{const h=u.dataTransfer.getData("text/plain");return h?(t.page.addText({x:c,y:d,content:h}),!0):!1};return Pt(()=>[t.page,t.pageSize?.width,t.pageSize?.height],()=>{St(r)}),Rn(()=>{r()}),rr(()=>{t.page?.destroy()}),(u,c)=>(me(),ke("div",{ref_key:"containerRef",ref:n,class:"whiteboard-page","data-page-index":e.page.pageIndex,onDragover:c[0]||(c[0]=Jt(()=>{},["prevent"])),onDrop:Jt(o,["prevent"]),style:gn({width:(e.pageSize?.width??e.page.size?.width)+"px",height:(e.pageSize?.height??e.page.size?.height)+"px",transform:`translate(${e.pageOffset?.left??0}px, ${e.pageOffset?.top??0}px)`})},null,44,$R))}},t9=fn(e9,[["__scopeId","data-v-c876c9b5"]]);It(),mn();var n9={__name:"WhiteboardLayer",props:{whiteboard:{type:Object,required:!0},pages:{type:Array,default:()=>[]},pageSizes:{type:Object,default:()=>({})},pageOffsets:{type:Object,default:()=>({})},enabled:{type:Boolean,default:!0},interactive:{type:Boolean,default:null},opacity:{type:Number,default:1}},setup(e){const t=e,n=Ae(()=>t.interactive==null?t.enabled:t.interactive);return(r,o)=>(me(),ke("div",{class:"whiteboard-layer","aria-hidden":"true",style:gn({opacity:e.opacity,pointerEvents:n.value?"auto":"none"})},[(me(!0),ke(qt,null,nr(e.pages,i=>(me(),dn(t9,{key:i.pageIndex,page:i,"page-size":e.pageSizes?.[i.pageIndex],"page-offset":e.pageOffsets?.[i.pageIndex],whiteboard:e.whiteboard,enabled:e.enabled},null,8,["page","page-size","page-offset","whiteboard","enabled"]))),128))],4))}},r9=fn(n9,[["__scopeId","data-v-54546c3d"]]);function o9(e){const t=e?.directionContext?.inlineDirection;if(t!=null)return t;const n=e?.paragraphProperties?.rightToLeft;if(n===!0)return"rtl";if(n===!1)return"ltr"}var f_=["#1f6feb","#d1242f","#8250df","#bf3989","#1a7f37","#9a6700","#bc4c00","#0969da","#cf222e","#6639ba","#116329","#7d4e00"];const i9=e=>e?`${typeof e.name=="string"?e.name:""} ${typeof e.email=="string"?e.email:""}`:"";var s9=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0};const a9=e=>f_[s9(i9(e))%f_.length];var Qd=e=>typeof e=="string"&&e.length>0;const l9=e=>{if(!e||e.enabled===!1)return;const t=e.overrides&&typeof e.overrides=="object"?e.overrides:void 0,n=typeof e.resolve=="function"?e.resolve:void 0;return r=>{const o=r??{};if(t){if(Qd(o.email)&&Qd(t[o.email]))return t[o.email];if(Qd(o.name)&&Qd(t[o.name]))return t[o.name]}if(n)try{const i=n(o);if(Qd(i))return i}catch{}return a9(o)}},c9=["insertion","deletion","move","move-from","move-to","table-cell-insertion","table-cell-deletion","cell-merge","cell-split","image-insertion","image-deletion","image-property-change"];var lj=new Set(c9);const mr={externalImageDeferred:"render.media.external-image-deferred",missingRelationship:"render.drawing.missing-relationship",missingMediaPart:"render.media.missing-part",unsupportedRelationshipType:"render.drawing.unsupported-relationship-type",unsupportedMime:"render.media.unsupported-mime",imageTooLarge:"render.media.image-too-large",unsafeSvg:"render.media.unsafe-svg",unsupportedFormat:"render.media.unsupported-format",embeddedObjectNotSupported:"render.embedded-object-not-supported",unsupportedObject:"render.drawing.unsupported-object",vmlUnsupported:"render.drawing.vml-unsupported",vmlImageUnsupported:"render.drawing.vml-image-unsupported",unsupportedGeometryCommand:"render.drawing.unsupported-geometry-command",anchorUnsupported:"render.drawing.anchor-unsupported",wrapUnsupported:"render.drawing.wrap-unsupported",altContentNoSupportedChoice:"render.drawing.altcontent-no-supported-choice",groupChildUnsupported:"render.drawing.group-child-unsupported"},cj={"render.media.missing-relationship":mr.missingRelationship,"render.media.wrong-relationship-type":mr.unsupportedRelationshipType,"render.media.unsupported-target":mr.unsupportedRelationshipType,"render.media.invalid-image-size":mr.imageTooLarge,"render.media-resolver-unavailable":mr.missingMediaPart,"render.chart-not-supported":mr.unsupportedObject,"render.textbox.vml-unsupported":mr.vmlUnsupported},u9={inlineBitmap:{family:"inlineBitmap",support:"supported",description:"wp:inline pic:pic with internal media and browser-safe MIME (PNG/JPEG; WebP/SVG once the host media resolver lands).",contract:"ImageRun"},anchoredBitmap:{family:"anchoredBitmap",support:"supported",description:"wp:anchor bitmap with anchor/wrap expressible by ImageAnchor/ImageWrap. Never silently inlined.",contract:"ImageBlock"},imageChildInGroup:{family:"imageChildInGroup",support:"supported",description:"Bitmap child of a supported DrawingML group/drawing wrapper. Supported only when the parent is.",contract:"ImageDrawing"},vectorShape:{family:"vectorShape",support:"supported",description:"Block/floating DrawingML preset/custom shape with the supported geometry/style subset.",contract:"DrawingBlock",drawingKind:"vectorShape"},shapeGroup:{family:"shapeGroup",support:"supported",description:"DrawingML group whose rendered children are supported vector/image children.",contract:"DrawingBlock",drawingKind:"shapeGroup"},chart:{family:"chart",support:"supported",description:"DrawingML chart projected into a ChartDrawing with parsed cached chart XML data. Complete Word chart fidelity remains deferred to chartFidelity.",contract:"DrawingBlock",drawingKind:"chart"},alternateContent:{family:"alternateContent",support:"supported",description:"mc:AlternateContent traversal/select policy. Selected Choice/Fallback maps to its family contract; unselected branches preserved for save/reopen.",contract:"selected-choice"},externalImage:{family:"externalImage",support:"fail-closed",description:'External image relationship (r:link / TargetMode="External"). Not fetched.',contract:"none",diagnostic:mr.externalImageDeferred},missingRelationship:{family:"missingRelationship",support:"fail-closed",description:"Drawing references a relationship id absent from the owner part .rels.",contract:"none",diagnostic:mr.missingRelationship},missingMediaPart:{family:"missingMediaPart",support:"fail-closed",description:"Relationship resolves but the target media part bytes are missing or empty.",contract:"none",diagnostic:mr.missingMediaPart},wrongRelationshipType:{family:"wrongRelationshipType",support:"fail-closed",description:"Relationship exists but is not an image relationship type.",contract:"none",diagnostic:mr.unsupportedRelationshipType},unsupportedMime:{family:"unsupportedMime",support:"fail-closed",description:"Media MIME outside the supported allowlist (incl. GIF/BMP/ICO).",contract:"none",diagnostic:mr.unsupportedMime},oversizedMediaPart:{family:"oversizedMediaPart",support:"fail-closed",description:"Media part exceeds the host byte-size policy before bytes are materialized.",contract:"none",diagnostic:mr.imageTooLarge},unsafeSvg:{family:"unsafeSvg",support:"fail-closed",description:"SVG content rejected by the SVG safety policy.",contract:"none",diagnostic:mr.unsafeSvg},metafileOrTiff:{family:"metafileOrTiff",support:"fail-closed",description:"EMF/WMF/TIFF and other non-browser-native formats with no approved conversion path.",contract:"none",diagnostic:mr.unsupportedFormat},embeddedObject:{family:"embeddedObject",support:"fail-closed",description:"OLE / ActiveX / embedded package object.",contract:"none",diagnostic:mr.embeddedObjectNotSupported},smartArtOrDiagram:{family:"smartArtOrDiagram",support:"fail-closed",description:"SmartArt / diagram / unknown external graphic-data object.",contract:"none",diagnostic:mr.unsupportedObject},vml:{family:"vml",support:"fail-closed",description:"VML structure outside any supported image-like subset (default fail-closed policy).",contract:"none",diagnostic:mr.vmlUnsupported},vmlImageLike:{family:"vmlImageLike",support:"fail-closed",description:"Simple VML image references (v:imagedata) / watermark image metadata. Fail-closed unless a later change promotes a named subset with deterministic fixtures and exact oracles.",contract:"none",diagnostic:mr.vmlImageUnsupported},unsupportedGeometryCommand:{family:"unsupportedGeometryCommand",support:"fail-closed",description:"Custom geometry command the extractor does not implement, e.g. arcTo.",contract:"none",diagnostic:mr.unsupportedGeometryCommand},unsupportedAnchorFields:{family:"unsupportedAnchorFields",support:"fail-closed",description:"Anchor fields required for honest placement are unsupported (char-relative, alignment modes, etc.).",contract:"none",diagnostic:mr.anchorUnsupported},unsupportedWrapFields:{family:"unsupportedWrapFields",support:"fail-closed",description:"Wrap fields required for honest placement are unsupported (arbitrary wrap polygons, etc.).",contract:"none",diagnostic:mr.wrapUnsupported},alternateContentNoSupportedChoice:{family:"alternateContentNoSupportedChoice",support:"fail-closed",description:"mc:AlternateContent with no supported choice and no usable fallback.",contract:"none",diagnostic:mr.altContentNoSupportedChoice},groupChildUnsupported:{family:"groupChildUnsupported",support:"fail-closed",description:"Unsupported child inside an otherwise-supported group. Supported siblings are not dropped.",contract:"none",diagnostic:mr.groupChildUnsupported},objectEditing:{family:"objectEditing",support:"deferred",description:"Editing/mutation of anchored/vector objects.",contract:"none"},customWrapPolygon:{family:"customWrapPolygon",support:"deferred",description:"Full Word-compatible text wrapping for arbitrary custom wrap polygons.",contract:"none"},chartFidelity:{family:"chartFidelity",support:"deferred",description:"Complete chart fidelity (a dedicated chart effort owns the parsed subset).",contract:"none"},vmlFidelity:{family:"vmlFidelity",support:"deferred",description:"Complete VML fidelity.",contract:"none"},decorativeAccessibilityUi:{family:"decorativeAccessibilityUi",support:"deferred",description:"Full accessibility UI for decorative image semantics beyond preserving source data.",contract:"none"}},uj=Object.keys(u9),dj=Object.freeze(["multiple-sections","furniture-page-tokens","non-balanceable-multi-column-sections","body-anchored-objects","footnotes","page-references","keep-constraints","tables","furniture-anchored-objects"]);It(),mn();var d9={class:"superdoc-html-viewer"},f9={class:"superdoc-html-viewer__document"},h9=["innerHTML"],p9={__name:"HtmlViewer",props:{fileSource:{type:[File,Blob],required:!0},documentId:{type:String,required:!0}},emits:["ready","selection-change"],setup(e,{emit:t}){const n=e,r=ne(""),o=t,i=()=>{const l=window.getSelection();console.debug("selection from html viewer",l),o("selection-change",l)},s=l=>new Promise((u,c)=>{const d=new FileReader;d.onload=h=>{const m=h.target.result;u(m)},d.onerror=h=>c(h),d.readAsText(l)}),a=async()=>{try{r.value=await s(n.fileSource),o("ready",n.documentId)}catch(l){o("error",l),console.error("Error loading document",l)}};return Rn(()=>{a()}),(l,u)=>(me(),ke("div",d9,[Me("div",f9,[Me("div",{class:"superdoc-html-viewer__content",innerHTML:r.value,onMouseup:i},null,40,h9)])]))}},m9=fn(p9,[["__scopeId","data-v-da3494ba"]]);const g9=(e,t,n=()=>!0)=>{const r=new Set(t.map(String)),o=new Set;e.forEach(s=>{if(!n(s))return;const a=s.commentId!=null?String(s.commentId):null,l=s.importedId!=null?String(s.importedId):null;!(a&&r.has(a))&&!(l&&r.has(l))||(a&&o.add(a),l&&o.add(l))});let i=!0;for(;i;)i=!1,e.forEach(s=>{if(!n(s))return;const a=s.commentId!=null?String(s.commentId):null,l=s.importedId!=null?String(s.importedId):null,u=s.parentCommentId!=null?String(s.parentCommentId):null,c=fp(s),d=c!=null?String(c):null,h=a&&o.has(a)||l&&o.has(l),m=u&&o.has(u)||d&&o.has(d);if(!h&&!m)return;const p=o.size;a&&o.add(a),l&&o.add(l),o.size>p&&(i=!0)});return o};It();var h_=ne(!1);function Hi(){return{isHighContrastMode:h_,setHighContrastMode:t=>{h_.value=t}}}const fj="[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor",hj=320,pj=24,mj=816,gj=250,vj="sidebar",p_=new Set(["auto","sidebar","inline"]);function v9(e){if(!e||e===!1||typeof e!="object")return e;const t={...e},n=t.displayMode;p_.has(n)||delete t.displayMode;const r=t.compactBreakpointPx;typeof r=="number"&&Number.isFinite(r)&&r>=0||delete t.compactBreakpointPx;const o=t.compactMeasurementSelector;return typeof o=="string"&&o.trim().length>0?t.compactMeasurementSelector=o.trim():delete t.compactMeasurementSelector,t}It();var y9=".superdoc__document",b9=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0,w9=e=>e+320+24;function C9({commentsModuleConfig:e,superdocRoot:t,layers:n}){const r=ne(0),o=ne(!1);let i=null,s=null;const a=m=>{if(!(m instanceof HTMLElement)||(typeof window<"u"?window.getComputedStyle(m):null)?.display==="contents")return!1;const p=Number(m.clientWidth??0),g=Number(m.getBoundingClientRect?.().width??0);return Number.isFinite(p)&&p>0||Number.isFinite(g)&&g>0},l=()=>{const m=t.value,p=e.value?.compactMeasurementSelector;if(typeof p=="string"&&p.trim().length>0&&typeof document<"u"){const k=document.querySelector(p.trim());if(a(k))return k}let g=m?.parentElement??null;for(;g;){if(a(g))return g;g=g.parentElement}return a(m)||m instanceof HTMLElement?m:null},u=()=>{const m=typeof window<"u"?window.ResizeObserver:void 0;if(typeof m>"u")return;const p=l();p!==s&&(i&&(i.disconnect(),i=null),s=p,s&&(i=new m(()=>{h()}),i.observe(s)))},c=()=>{u();const m=Number(s?.clientWidth??0);if(Number.isFinite(m)&&m>0)return m;const p=Number(s?.getBoundingClientRect?.().width??0);return Number.isFinite(p)&&p>0?p:0},d=()=>{const m=t.value?.querySelector?.(y9),p=n.value,g=Number(m?.clientWidth??m?.getBoundingClientRect?.().width??0);if(Number.isFinite(g)&&g>0)return g;const k=Number(p?.clientWidth??p?.getBoundingClientRect?.().width??0);return Number.isFinite(k)&&k>0?k:816},h=()=>{const m=c(),p=e.value,g=p?.displayMode??"sidebar";if(g==="sidebar"){r.value=m,o.value=!1;return}if(g==="inline"){r.value=m,o.value=!0;return}if(!(Number.isFinite(m)&&m>0))return;r.value=m;const k=p?.compactBreakpointPx;if(b9(k)){o.value=m<k;return}o.value=m<w9(d())};return rr(()=>{i&&(i.disconnect(),i=null),s=null}),{superdocContainerWidth:r,isCompactCommentsMode:o,recalculateCompactCommentsMode:h,ensureCompactMeasurementObserver:u}}It();var m_=320,ja=12,_9=220,S9=16,k9=500,g_=".superdoc-comment-highlight[data-comment-ids]",v_="data-comment-ids",A9=".sd-comment-anchor",Ky=(e,t,n)=>Math.min(Math.max(e,t),n),ds=e=>Number(e),Ui=e=>Number.isFinite(e),qy=e=>e?.commentId??e?.importedId??null,y_=e=>String(e||"").split(",").map(t=>t.trim()).filter(Boolean),I9=e=>{const t=e?.value;if(!t)return null;const n=ds(t.ts);if(!Ui(n)||Date.now()-n>k9)return null;const r=ds(t.x),o=ds(t.anchorRect?.bottom),i=Ui(o)?o:ds(t.y);return!Ui(r)||!Ui(i)?null:{x:r,y:i}},E9=({rootEl:e,comment:t,pendingComment:n})=>{if(n?.value&&t?.commentId===n.value?.commentId){const a=e.querySelectorAll(g_);for(const l of a)if(y_(l.getAttribute(v_)).includes("pending")&&typeof l.getBoundingClientRect=="function")return l.getBoundingClientRect()}const r=qy(t);if(!r)return null;const o=String(r),i=e.querySelectorAll(g_);for(const a of i)if(y_(a.getAttribute(v_)).includes(o)&&typeof a.getBoundingClientRect=="function")return a.getBoundingClientRect();const s=e.querySelector(`[data-track-change-id="${o}"]`);return s&&typeof s.getBoundingClientRect=="function"?s.getBoundingClientRect():null},x9=(e,t)=>{const{entry:n}=e(qy(t)),r=ds(n?.bounds?.bottom);return Ui(r)?r:ds(n?.bounds?.top)},T9=({selectionPosition:e,comment:t,pendingComment:n})=>e.value?.source==="pdf"||t?.selection?.source==="pdf"||n.value?.selection?.source==="pdf",R9=({rootEl:e,layersRect:t,comment:n})=>{const r=qy(n);if(r==null)return NaN;const o=e.querySelector(`${A9}[data-id="${String(r)}"]`);return!o||typeof o.getBoundingClientRect!="function"?NaN:ds(o.getBoundingClientRect().bottom)-ds(t.top)},M9=({comment:e,pendingComment:t,selectionPosition:n,activeZoom:r})=>{if(!t.value||e?.commentId!==t.value?.commentId)return NaN;const o=ds(n.value?.bottom);if(Ui(o))return o*(n.value?.source==="pdf"?(r.value??100)/100:1);const i=ds(n.value?.top);return Ui(i)?i*(n.value?.source==="pdf"?(r.value??100)/100:1):NaN},L9=({top:e,left:t})=>({top:`${Math.round(e)}px`,left:`${Math.round(t)}px`,right:"auto"}),D9=({rootRect:e,layersRect:t,anchorBottom:n,anchorClientX:r=NaN})=>{const o=Ky(t.top-e.top+n+S9,ja,Math.max(ja,e.height-_9)),i=Math.max(ja,e.width-m_-ja);let s;if(Ui(r))s=Ky(r-e.left+ja,ja,i);else{const a=e.width-(t.left-e.left+t.width)+ja;s=Ky(e.width-a-m_,ja,i)}return{top:o,left:s}};function P9({activeComment:e,pendingComment:t,activeCompactComment:n,showCommentsSidebar:r,selectionPosition:o,activeZoom:i,superdocRoot:s,layers:a,documents:l,resolveCommentPositionEntry:u,clearActiveComment:c,clearPendingComment:d}){const h={top:"12px",right:"12px"},m=ne(0),p=ne({x:null,y:null,ts:0,anchorRect:null});let g=null,k=null;const w=()=>{p.value={x:null,y:null,ts:0,anchorRect:null}},S=(R,M,H)=>{if(!l.value?.some(z=>z.type==="application/pdf"))return!1;const B=R.querySelector(".superdoc__compact-comment-popover");return!n.value||!B||B.contains(M)||H?!1:(t.value&&d(),c(),w(),!0)},y=R=>{const M=s.value;if(!M||!a.value?.contains(R.target))return;const H=(typeof document.elementsFromPoint=="function"?document.elementsFromPoint(R.clientX,R.clientY):[]).find(z=>z?.nodeType===1&&M.contains(z)&&z.closest("[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor"))?.closest("[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor")??(R.target?.nodeType===1?R.target.closest("[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor"):null);if(S(M,R.target,H)||R.button!==0||R.pointerType!=="mouse")return;const B=H&&typeof H.getBoundingClientRect=="function"?H.getBoundingClientRect():null;B&&(p.value={x:R.clientX,y:B.bottom,ts:Date.now(),anchorRect:{left:B.left,right:B.right,top:B.top,bottom:B.bottom}})},C=Ae(()=>{m.value;const R=n.value;if(!R)return h;const M=s.value,H=a.value;if(!M||!H)return h;const B=M.getBoundingClientRect(),z=H.getBoundingClientRect(),X=I9(p),P=X?null:E9({rootEl:M,comment:R,pendingComment:t});let N=NaN,I=NaN;return X?(N=X.y-z.top,I=X.x):P?(N=P.bottom-z.top,I=P.left):N=x9(u,R),!Ui(N)&&T9({selectionPosition:o,comment:R,pendingComment:t})&&(N=R9({rootEl:M,layersRect:z,comment:R})),Ui(N)||(N=M9({comment:R,pendingComment:t,selectionPosition:o,activeZoom:i})),Ui(N)?L9(D9({rootRect:B,layersRect:z,anchorBottom:N,anchorClientX:I})):h});return Pt([e,t,o,i,r,p],()=>{const R=typeof window<"u"?window.requestAnimationFrame:null,M=typeof window<"u"?window.cancelAnimationFrame:null;g!=null&&M?.(g),R&&(g=R(()=>{m.value+=1,g=null}))},{deep:!1}),Pt(n,(R,M)=>{if(!M&&R){const H=document.activeElement;H instanceof HTMLElement&&(k=H)}},{deep:!1}),Pt(t,(R,M)=>{!M&&R&&w()}),Rn(()=>{document.addEventListener("pointerdown",y,!0)}),rr(()=>{document.removeEventListener("pointerdown",y,!0);const R=typeof window<"u"?window.cancelAnimationFrame:null;g!=null&&(R?.(g),g=null),k=null}),{compactCommentPopoverStyle:C,closeCompactCommentPopover:()=>{n.value&&(t.value&&d(),c(),k&&typeof k.focus=="function"&&k.focus(),k=null)},resetClickAnchor:w}}function b_(e){if(e?.type!=="mutation:committed")return null;const t=e.origin==="history"?e.result:e.receipt;if(!t||typeof t!="object")return null;const n=new Set,r=new Set,o=(i,s)=>{i?.kind!=="entity"||i.entityType!=="trackedChange"||typeof i.entityId=="string"&&i.entityId.length>0&&s.add(i.entityId)};if(Array.isArray(t.inserted)&&t.inserted.forEach(i=>o(i,n)),Array.isArray(t.updated)&&t.updated.forEach(i=>o(i,n)),Array.isArray(t.trackedChangeRefs)&&t.trackedChangeRefs.forEach(i=>o(i,n)),Array.isArray(t.removed)&&t.removed.forEach(i=>o(i,r)),Array.isArray(t.invalidatedRefs)&&t.invalidatedRefs.forEach(i=>o(i,r)),Array.isArray(t.remappedRefs))for(const i of t.remappedRefs)o(i?.from,r),o(i?.to,n);for(const i of r)n.delete(i);return n.size===0&&r.size===0?null:{upsertIds:n,removedIds:r,reconcileMode:e.origin==="history"?"authoritative":"targeted"}}var Zd=e=>new Set(Array.from(e??[]).filter(t=>typeof t=="string"&&t.length>0)),O9=e=>typeof e?.id=="string"&&e.id.length>0?e.id:typeof e?.changeId=="string"&&e.changeId.length>0?e.changeId:typeof e?.address?.entityId=="string"&&e.address.entityId.length>0?e.address.entityId:null,F9=(e,t)=>e?.adapter===t?.adapter&&e?.documentId===t?.documentId&&e?.editor===t?.editor&&e?.reconcileToken===t?.reconcileToken;function w_({getContext:e,reconcile:t,hydrate:n,onReconciled:r}){const o=new Map;let i=0,s=0,a=null,l=!1;const u=(R,M)=>s===R&&F9(M,e()),c=(R,M)=>{const H=new Set;for(const B of R)o.get(B)===M.get(B)&&(o.delete(B),H.add(B));return H},d=R=>new Map([...o].filter(([,M])=>M.ready===!0&&M.reconcileMode===R)),h=()=>{let R=!1;for(const M of o.values())M.gate!=="render"||M.ready||(M.ready=!0,R=!0);return R},m=R=>{let M=!1;for(const H of o.values())H.version>R||H.ready||(H.ready=!0,M=!0);return M},p=async(R,M,H,B=!1)=>{if(!(!B&&M.size===0||typeof r!="function"))try{await r(R,M,H)}catch{}},g=R=>Zd(R?.resolvedIds??(R?.items??[]).map(O9).filter(Boolean)),k=async(R,M,H)=>{const B=await t(R,{upsertIds:new Set(M.keys()),removedIds:new Set,reconcileMode:"targeted"});if(!u(H,R)||(await p(R,c(g(B),M),B),new Set([...M].filter(([X,P])=>o.get(X)===P).map(([X])=>X)).size===0))return;const z=await n(R,{trackedChangesListMode:"interaction-prime",refreshReason:"mutation-render-reconcile",blocking:!1});u(H,R)&&await p(R,c(g(z),M),z)},w=async(R,M,H)=>{const B=await n(R,{trackedChangesListMode:"all",refreshReason:"mutation-history-render-reconcile",blocking:!0});if(!u(H,R)||![...M].some(([I,L])=>o.get(I)===L))return;const z=B?.ok===!0,X=z&&B?.complete===!0&&B?.sourceCoverageComplete===!0,P=z?g(B):new Set,N=X?c(new Set(M.keys()),M):new Set;await p(R,X?N:P,{...B,reconcileMode:"authoritative"},!0)},S=()=>{if(a)return a;const R=d("targeted"),M=d("authoritative");if(R.size===0&&M.size===0)return null;const H=e();if(!H?.adapter)return null;l=!1;const B=s;return a=Promise.resolve().then(async()=>{M.size>0&&await w(H,M,B).catch(()=>{}),R.size>0&&await k(H,R,B).catch(()=>{})}).catch(()=>{}).finally(()=>{a=null,l&&S()}),a},y=(R,M)=>{if(!R)return;const H=R.reconcileMode==="authoritative"?"authoritative":"targeted",B=Zd(R.removedIds);for(const X of B){const P=o.get(X);P?.reconcileMode==="authoritative"?o.set(X,{...P,version:++i,gate:M,ready:!1}):o.delete(X)}const z=e();if(B.size>0&&z?.adapter)try{Promise.resolve(t(z,{upsertIds:new Set,removedIds:B})).catch(()=>{})}catch{}for(const X of Zd(R.upsertIds))if(!B.has(X)){const P=o.get(X);o.set(X,{version:++i,gate:M,ready:!1,reconcileMode:H==="authoritative"||P?.reconcileMode==="authoritative"?"authoritative":"targeted"})}},C=R=>y(R,"render");return{enqueue:C,enqueueAfterPaint(R,M){if(!R||typeof M!="function"){C(R);return}y(R,"exact-paint");const H=e();if(!H?.adapter)return;const B=s,z=i,X=new Set([...Zd(R.upsertIds),...Zd(R.removedIds)]),P=new Map([...X].flatMap(N=>{const I=o.get(N);return I?[[N,I]]:[]}));Promise.resolve().then(()=>M()).then(()=>{if(!u(B,H))return;let N=h();m(z)&&(N=!0);for(const[I,L]of P)o.get(I)===L&&(L.ready||(N=!0),L.ready=!0);a&&(N||z>0)&&(l=!0),S()}).catch(()=>{if(u(B,H))for(const[N,I]of P)o.get(N)===I&&(I.gate="render")})},onRender:(R=!1)=>{const M=h();a&&(M||R)&&(l=!0),S()},reset(){s+=1,o.clear(),l=!1},getPendingIds(){return new Set(o.keys())}}}function B9(e,t){if(!e||typeof e.entityId!="string"||e.entityType!=="comment"&&e.entityType!=="trackedChange")return null;const n=typeof t=="function"?t(e.entityId):null,r=n?.commentId??n?.importedId??e.entityId;return r!=null?String(r):null}var N9=new Set(["insert-text","replace-text","plain-text-paste","delete-backward","delete-forward","text.insert","text.replace","text.pastePlain","text.deleteBackward","text.deleteForward","structural.enter","structural:enter-split-paragraph","structural:enter-insert-paragraph-before","structural:enter-insert-paragraph-after","structural:shift-enter-line-break","structural:backspace-boundary-merge-with-previous","structural:delete-boundary-merge-with-next","backspace:boundary-merge-with-previous","backspace:list-remove","backspace:list-outdent"]);const C_=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:N9.has(e.editableCommandKind);function __(e){return e==null?null:String(e)}function z9({hydrate:e,getActiveDocumentId:t,debounceMs:n=250,ceilingMs:r=1e3,now:o=()=>Date.now(),setTimer:i=(a,l)=>setTimeout(a,l),clearTimer:s=a=>clearTimeout(a)}){let a=null,l=null,u=null;const c=m=>__(t())===m,d=()=>{a!=null&&s(a),a=null,l=null,u=null};return{schedule:m=>{const p=__(m);if(!c(p))return!1;u!==p&&d();const g=o();u=p,l??=g,a!=null&&s(a);const k=Math.max(0,r-(g-l));return a=i(()=>{const w=u;a=null,l=null,u=null,c(w)&&e()},Math.min(n,k)),!0},clear:d}}var H9="no-author-configured";const U9="author-required",S_="This edit needs an author identity. Set `user.name` in your SuperDoc configuration and reopen the document to make tracked or revision-overlapping edits.";function k_(e){return typeof e=="string"&&e.includes(H9)}function V9(e){if(!e||e.type!=="mutation:rejected")return!1;if(e.failureSource==="receipt"){const t=e.failure;return t?t.code==="PRECONDITION_FAILED"&&k_(t.message):!1}return e.failureSource==="shell"?e.reason==="author-required"?!0:e.reason==="PRECONDITION_FAILED"&&k_(e.message):!1}function j9(){const e=new Set,t=n=>typeof n=="string"&&n.length>0?n:"__default__";return{shouldNotify(n,r){if(!V9(r))return!1;const o=t(n);return e.has(o)?!1:(e.add(o),!0)},clear(n){e.delete(t(n))}}}const G9=e=>!!(e?.anchor&&e?.focus&&(e.anchor.blockId!==e.focus.blockId||e.anchor.blockOffset!==e.focus.blockOffset)),W9=(e,t)=>{if(!e||e.rangeCount<1||e.isCollapsed||!t)return!1;const n=e.getRangeAt(0);return!t.contains(n.startContainer)&&!t.contains(n.endContainer)},K9=(e,t)=>e!=="editing"&&e!=="suggesting"?!1:G9(t);var q9=_r((()=>{})),Y9=Vu({default:()=>O_},1),A_,I_,E_,x_,T_,R_,M_,L_,D_,P_,O_,X9=_r((()=>{It(),q9(),mn(),A_=["onKeydown"],I_=["id"],E_={class:"sd-password-prompt__description"},x_={class:"sd-password-prompt__field"},T_=["placeholder","disabled","aria-label"],R_={key:0,class:"sd-password-prompt__error",role:"alert"},M_={class:"sd-password-prompt__actions"},L_=["disabled"],D_=["disabled"],P_={__name:"PasswordPromptSurface",props:{surfaceId:{type:String,default:""},mode:{type:String,default:"dialog"},request:{type:Object,default:()=>({})},resolve:{type:Function,default:()=>{}},close:{type:Function,default:()=>{}},passwordPrompt:{type:Object,required:!0}},setup(e){const t=e,n=ne(""),r=ne(!1),o=ne(t.passwordPrompt.errorCode==="DOCX_PASSWORD_INVALID"),i=ne(o.value?t.passwordPrompt.texts.invalidMessage:""),s=Ae(()=>o.value?t.passwordPrompt.texts.invalidTitle:t.passwordPrompt.texts.title),a=Ae(()=>n.value.length>0&&!r.value);async function l(){if(!a.value)return;r.value=!0,i.value="";const c=await t.passwordPrompt.attemptPassword(n.value);if(c.success){t.resolve({password:n.value});return}r.value=!1,n.value="",c.errorCode==="DOCX_PASSWORD_INVALID"?(o.value=!0,i.value=t.passwordPrompt.texts.invalidMessage):c.errorCode==="timeout"?i.value=t.passwordPrompt.texts.timeoutMessage:i.value=t.passwordPrompt.texts.genericErrorMessage}function u(){t.close("user-cancelled")}return(c,d)=>(me(),ke("div",{class:"sd-password-prompt",onKeydown:Qo(Jt(l,["prevent"]),["enter"])},[Me("h3",{id:`sd-password-prompt-heading-${e.surfaceId}`,class:"sd-password-prompt__heading"},Nt(s.value),9,I_),Me("p",E_,Nt(e.passwordPrompt.texts.description),1),Me("div",x_,[Ms(Me("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>n.value=h),type:"password",class:"sd-password-prompt__input",placeholder:e.passwordPrompt.texts.placeholder,disabled:r.value,autocomplete:"current-password","aria-label":e.passwordPrompt.texts.inputAriaLabel},null,8,T_),[[Ii,n.value]])]),i.value?(me(),ke("p",R_,Nt(i.value),1)):ut("",!0),Me("div",M_,[Me("button",{type:"button",class:"sd-password-prompt__btn sd-password-prompt__btn--cancel",disabled:r.value,onClick:u},Nt(e.passwordPrompt.texts.cancelLabel),9,L_),Me("button",{type:"button",class:"sd-password-prompt__btn sd-password-prompt__btn--submit",disabled:!a.value,onClick:l},Nt(r.value?e.passwordPrompt.texts.busyLabel:e.passwordPrompt.texts.submitLabel),9,D_)])],40,A_))}},O_=fn(P_,[["__scopeId","data-v-ecf7f6fb"]])}));It();var Q9=["DOCX_PASSWORD_REQUIRED","DOCX_PASSWORD_INVALID"],Z9=3e4,Ei={title:"Password Required",invalidTitle:"Incorrect Password",description:"This document is password protected. Enter the password to open it.",placeholder:"Enter password",inputAriaLabel:"Document password",submitLabel:"Open",cancelLabel:"Cancel",busyLabel:"Decryptingβ¦",invalidMessage:"Incorrect password. Please try again.",timeoutMessage:"Timed out while decrypting. Please try again.",genericErrorMessage:"Unable to decrypt this document."};function J9({getSurfaceManager:e,getPasswordPromptConfig:t,onUnhandled:n}){const r=[],o=Wr(null),i=new Map;let s=!1;function a(p,g,k){if(!p||!Q9.includes(g)||t()===!1||!e())return!1;const w=i.get(p.id);if(w)return clearTimeout(w.timer),w.resolve({success:!1,errorCode:g}),i.delete(p.id),!0;const S=r.find(y=>y.doc.id===p.id);return S?(S.errorCode=g,S.originalException=k,!0):(o.value?.doc.id===p.id||(r.push({doc:p,errorCode:g,originalException:k}),c()),!0)}function l(p){if(!p)return;const g=i.get(p.id);g&&(clearTimeout(g.timer),g.resolve({success:!0}),i.delete(p.id))}function u(){s=!0;for(const[,p]of i)clearTimeout(p.timer),p.resolve({success:!1,errorCode:"destroyed"});i.clear(),r.length=0,o.value=null}function c(){if(s||o.value||r.length===0)return;const p=r.shift();p&&d(p).catch(g=>{o.value=null,console.error("[SuperDoc] Password prompt error:",g),n?.(p.doc,p.errorCode,p.originalException),c()})}async function d({doc:p,errorCode:g,originalException:k}){const w=e();if(!w||s)return;const S=h(),y=M=>(p.password=M,p.editorMountNonce++,new Promise(H=>{const B=setTimeout(()=>{i.delete(p.id),H({success:!1,errorCode:"timeout"})},Z9);i.set(p.id,{resolve:H,timer:B})})),C={documentId:p.id,errorCode:g,texts:S.texts,attemptPassword:y},T=m(S,{documentId:p.id,errorCode:g,texts:S.texts});if(T.suppressed){n?.(p,g,k),c();return}o.value={doc:p,surfaceHandle:null};let R;if(T.component)R=w.open({mode:"dialog",closeOnBackdrop:!1,ariaLabel:S.texts.title,component:Gr(T.component),props:{...T.props,passwordPrompt:C}});else if(T.render){const M=T.render;R=w.open({mode:"dialog",closeOnBackdrop:!1,ariaLabel:S.texts.title,render:H=>M({container:H.container,passwordPrompt:C,resolve:H.resolve,close:H.close,surfaceId:H.surfaceId,mode:H.mode})})}else{const M=(await Promise.resolve().then(()=>(X9(),Y9))).default,H=`password-prompt-${p.id}`;R=w.open({id:H,mode:"dialog",closeOnBackdrop:!1,ariaLabelledBy:`sd-password-prompt-heading-${H}`,component:Gr(M),props:{passwordPrompt:C}})}o.value={doc:p,surfaceHandle:R},await R.result,o.value=null,c()}function h(){const p=t();if(p===!1)return{enabled:!1,texts:Ei};const g=typeof p=="object"&&p!==null?p:{};if(g.component!=null&&typeof g.render=="function")throw new Error('modules.surfaces.passwordPrompt cannot provide both "component" and "render". Use one or the other.');return{enabled:!0,texts:{title:g.title??Ei.title,invalidTitle:g.invalidTitle??Ei.invalidTitle,description:g.description??Ei.description,placeholder:g.placeholder??Ei.placeholder,inputAriaLabel:g.inputAriaLabel??Ei.inputAriaLabel,submitLabel:g.submitLabel??Ei.submitLabel,cancelLabel:g.cancelLabel??Ei.cancelLabel,busyLabel:g.busyLabel??Ei.busyLabel,invalidMessage:g.invalidMessage??Ei.invalidMessage,timeoutMessage:g.timeoutMessage??Ei.timeoutMessage,genericErrorMessage:g.genericErrorMessage??Ei.genericErrorMessage},component:g.component,props:g.props,render:g.render,resolver:g.resolver}}function m(p,g){if(typeof p.resolver=="function"){const k=p.resolver(g);if(k!=null&&k.type!=="default"){if(k.type==="none")return{suppressed:!0};if(k.type==="custom")return{component:k.component,props:k.props};if(k.type==="external")return{render:k.render}}}return p.component!=null?{component:p.component,props:p.props}:typeof p.render=="function"?{render:p.render}:{builtin:!0}}return{handleEncryptionError:a,handleEditorReady:l,destroy:u}}function F_(e,{getCurrentSession:t,applySlice:n,onSettled:r}){return()=>{if(e===t())try{n(e.getSnapshot())}catch{}r()}}var $9=_r((()=>{})),eM=Vu({default:()=>iS},1),B_,N_,z_,H_,U_,V_,j_,G_,W_,K_,q_,Y_,X_,Q_,Z_,J_,$_,eS,tS,nS,rS,oS,iS,tM=_r((()=>{It(),$9(),mn(),B_=["onKeydown"],N_={class:"sd-find-replace__row"},z_=["title","aria-label","aria-expanded"],H_=["value","placeholder","aria-label"],U_={key:0,class:"sd-find-replace__count"},V_=["title","aria-label","aria-pressed"],j_=["title","aria-label","aria-pressed"],G_=["title","aria-label","aria-pressed"],W_={class:"sd-find-replace__nav"},K_=["disabled","title","aria-label"],q_=["disabled","title","aria-label"],Y_=["title","aria-label"],X_={key:0,class:"sd-find-replace__row"},Q_={class:"sd-find-replace__field"},Z_=["value","placeholder","aria-label"],J_={class:"sd-find-replace__nav sd-find-replace__nav--actions"},$_=["disabled","title"],eS=["disabled","title"],tS={key:1,class:"sd-find-replace__error",role:"alert"},nS={key:0,class:"sd-find-replace__row-indent","aria-hidden":"true"},rS={class:"sd-find-replace__error-text"},oS={__name:"FindReplaceSurface",props:{surfaceId:{type:String,default:""},mode:{type:String,default:"floating"},request:{type:Object,default:()=>({})},resolve:{type:Function,default:()=>{}},close:{type:Function,default:()=>{}},findReplace:{type:Object,required:!0}},setup(e){const t=e,n=ne(null),r=Ae(()=>{const p=t.findReplace;return!!(!p.hasMatches?.value||p.replacePending?.value===!0||p.canReplace&&p.canReplace.value===!1)}),o=Ae(()=>t.findReplace.ignoreDiacriticsSupported?.value!==!1),i=Ae(()=>t.findReplace.replaceEnabled&&t.findReplace.replaceCanMutate?.value!==!1),s=Ae(()=>t.findReplace.regexSupported?.value===!0),a=Ae(()=>t.findReplace.searchError?.value??null);function l(p){p.key==="Enter"&&!p.shiftKey?(p.preventDefault(),u()):p.key==="Enter"&&p.shiftKey&&(p.preventDefault(),c())}function u(){t.findReplace.goNext(),m()}function c(){t.findReplace.goPrev(),m()}function d(){t.findReplace.close("user-closed")}function h(p){const g=[];let k=p?.parentElement??null;for(;k;){const S=k.ownerDocument?.defaultView?.getComputedStyle?.(k);if(S){const y=`${S.overflowY} ${S.overflowX}`;(y.includes("auto")||y.includes("scroll"))&&g.push(k)}k=k.parentElement}const w=p?.ownerDocument?.scrollingElement;return w&&!g.includes(w)&&g.push(w),g}function m(){const p=n.value;if(!p)return;const g=h(p).map(k=>({el:k,top:k.scrollTop,left:k.scrollLeft}));p.focus({preventScroll:!0});for(const{el:k,top:w,left:S}of g)k.scrollTop!==w&&(k.scrollTop=w),k.scrollLeft!==S&&(k.scrollLeft=S)}return Rn(()=>{n.value?.focus(),t.findReplace.registerFocusFn(m)}),(p,g)=>(me(),ke("div",{class:"sd-find-replace",onKeydown:Qo(Jt(d,["stop"]),["esc"])},[Me("div",N_,[i.value?(me(),ke("button",{key:0,type:"button",class:en(["sd-find-replace__btn sd-find-replace__btn--expander",{"sd-find-replace__btn--expander-open":e.findReplace.showReplace.value}]),title:e.findReplace.texts.toggleReplaceLabel,"aria-label":e.findReplace.texts.toggleReplaceAriaLabel,"aria-expanded":e.findReplace.showReplace.value?"true":"false",onClick:g[0]||(g[0]=k=>e.findReplace.showReplace.value=!e.findReplace.showReplace.value)},[...g[14]||(g[14]=[Me("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},[Me("path",{d:"M6 3.5 10.5 8 6 12.5",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],10,z_)):ut("",!0),Me("div",{class:en(["sd-find-replace__field",{"sd-find-replace__field--error":a.value}])},[g[15]||(g[15]=Me("svg",{class:"sd-find-replace__search-icon",viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},[Me("path",{d:"M7 1a6 6 0 1 0 3.7 10.7l3.3 3.3 1-1-3.3-3.3A6 6 0 0 0 7 1Zm0 1.5a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Z",fill:"currentColor"})],-1)),Me("input",{ref_key:"findInputRef",ref:n,value:e.findReplace.findQuery.value,onInput:g[1]||(g[1]=k=>e.findReplace.findQuery.value=k.target.value),type:"text",class:"sd-find-replace__input sd-find-replace__input--search","data-sd-autofocus":"",placeholder:e.findReplace.texts.findPlaceholder,"aria-label":e.findReplace.texts.findAriaLabel,onKeydown:l},null,40,H_),e.findReplace.findQuery.value&&!a.value?(me(),ke("span",U_,Nt(e.findReplace.matchLabel.value),1)):ut("",!0),Me("button",{type:"button",class:en(["sd-find-replace__btn sd-find-replace__btn--toggle",{"sd-find-replace__btn--active":e.findReplace.caseSensitive.value}]),title:e.findReplace.texts.matchCaseAriaLabel,"aria-label":e.findReplace.texts.matchCaseAriaLabel,"aria-pressed":e.findReplace.caseSensitive.value?"true":"false",onMousedown:g[2]||(g[2]=Jt(()=>{},["prevent"])),onClick:g[3]||(g[3]=k=>e.findReplace.caseSensitive.value=!e.findReplace.caseSensitive.value)},Nt(e.findReplace.texts.matchCaseLabel),43,V_),o.value?(me(),ke("button",{key:1,type:"button",class:en(["sd-find-replace__btn sd-find-replace__btn--toggle",{"sd-find-replace__btn--active":e.findReplace.ignoreDiacritics.value}]),title:e.findReplace.texts.ignoreDiacriticsAriaLabel,"aria-label":e.findReplace.texts.ignoreDiacriticsAriaLabel,"aria-pressed":e.findReplace.ignoreDiacritics.value?"true":"false",onMousedown:g[4]||(g[4]=Jt(()=>{},["prevent"])),onClick:g[5]||(g[5]=k=>e.findReplace.ignoreDiacritics.value=!e.findReplace.ignoreDiacritics.value)},Nt(e.findReplace.texts.ignoreDiacriticsLabel),43,j_)):ut("",!0),s.value?(me(),ke("button",{key:2,type:"button",class:en(["sd-find-replace__btn sd-find-replace__btn--toggle",{"sd-find-replace__btn--active":e.findReplace.regex.value}]),title:e.findReplace.texts.regexAriaLabel,"aria-label":e.findReplace.texts.regexAriaLabel,"aria-pressed":e.findReplace.regex.value?"true":"false",onMousedown:g[6]||(g[6]=Jt(()=>{},["prevent"])),onClick:g[7]||(g[7]=k=>e.findReplace.regex.value=!e.findReplace.regex.value)},Nt(e.findReplace.texts.regexLabel),43,G_)):ut("",!0)],2),Me("div",W_,[Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--icon",disabled:!e.findReplace.hasMatches.value,title:e.findReplace.texts.previousMatchLabel,"aria-label":e.findReplace.texts.previousMatchAriaLabel,onClick:g[8]||(g[8]=k=>c())},[...g[16]||(g[16]=[Me("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[Me("path",{d:"M10 3.5 5.5 8 10 12.5",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,K_),Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--icon",disabled:!e.findReplace.hasMatches.value,title:e.findReplace.texts.nextMatchLabel,"aria-label":e.findReplace.texts.nextMatchAriaLabel,onClick:g[9]||(g[9]=k=>u())},[...g[17]||(g[17]=[Me("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[Me("path",{d:"M6 3.5 10.5 8 6 12.5",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,q_),g[19]||(g[19]=Me("span",{class:"sd-find-replace__divider","aria-hidden":"true"},null,-1)),Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--icon",title:e.findReplace.texts.closeLabel,"aria-label":e.findReplace.texts.closeAriaLabel,onClick:d},[...g[18]||(g[18]=[Me("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[Me("path",{d:"m4.5 4.5 7 7m0-7-7 7",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],8,Y_)])]),e.findReplace.showReplace.value&&i.value?(me(),ke("div",X_,[g[20]||(g[20]=Me("span",{class:"sd-find-replace__row-indent","aria-hidden":"true"},null,-1)),Me("div",Q_,[Me("input",{value:e.findReplace.replaceText.value,onInput:g[10]||(g[10]=k=>e.findReplace.replaceText.value=k.target.value),type:"text",class:"sd-find-replace__input",placeholder:e.findReplace.texts.replacePlaceholder,"aria-label":e.findReplace.texts.replaceAriaLabel,onKeydown:g[11]||(g[11]=Qo(Jt(k=>e.findReplace.replaceCurrent(),["prevent"]),["enter"]))},null,40,Z_)]),Me("div",J_,[Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--action",disabled:r.value,title:e.findReplace.texts.replaceLabel,onClick:g[12]||(g[12]=k=>e.findReplace.replaceCurrent())},Nt(e.findReplace.texts.replaceLabel),9,$_),Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--action",disabled:r.value,title:e.findReplace.texts.replaceAllLabel,onClick:g[13]||(g[13]=k=>e.findReplace.replaceAll())},Nt(e.findReplace.texts.replaceAllLabel),9,eS)])])):ut("",!0),a.value?(me(),ke("div",tS,[i.value?(me(),ke("span",nS)):ut("",!0),Me("span",rS,Nt(a.value),1)])):ut("",!0)],40,B_))}},iS=fn(oS,[["__scopeId","data-v-fed15bd3"]])}));It();var sr={findPlaceholder:"Find",findAriaLabel:"Find text",replacePlaceholder:"Replace",replaceAriaLabel:"Replace text",noResultsLabel:"No results",previousMatchLabel:"Previous match (Shift+Enter)",previousMatchAriaLabel:"Previous match",nextMatchLabel:"Next match (Enter)",nextMatchAriaLabel:"Next match",closeLabel:"Close (Escape)",closeAriaLabel:"Close find and replace",replaceLabel:"Replace",replaceAllLabel:"All",toggleReplaceLabel:"Toggle replace",toggleReplaceAriaLabel:"Toggle replace",matchCaseLabel:"Aa",matchCaseAriaLabel:"Match case",regexLabel:".*",regexAriaLabel:"Use regular expression",invalidPatternLabel:"Invalid pattern",ignoreDiacriticsLabel:"Γ€β‘a",ignoreDiacriticsAriaLabel:"Ignore diacritics"};function nM(e){if(!e)return null;const t=e.extensionStorage,n=e.storage,r=t?.Search??n?.Search;if(r?.searchIndex||r?.searchResults)return r;const o=e.extensionStorage??e.storage;if(o)for(const i of Object.keys(o)){const s=o[i];if(s&&typeof s=="object"&&"searchIndex"in s&&"searchResults"in s)return s}return null}function rM({getSurfaceManager:e,getActiveEditor:t,activeEditorRef:n,getFindReplaceConfig:r,getSuperDocUI:o}){let i=null,s=null,a=null,l=!1,u=!1;const c=ne(!1);let d=null;const h=ne(""),m=ne(""),p=ne(!1),g=ne(!1),k=ne(!1),w=ne(!1),S=ne(0),y=ne(-1),C=ne(!0),T=ne(!1),R=ne(!0),M=ne(!1),H=ne(null);let B=sr;const z=Ae(()=>h.value?S.value===0?B.noResultsLabel:`${y.value+1} of ${S.value}`:""),X=Ae(()=>S.value>0),P=Ae(()=>X.value&&!T.value&&C.value);let N=null,I=null;function L(G){return typeof G?.commands?.setSearchSession=="function"}function Y(){try{const G=(typeof o=="function"?o():null)?.search;return G&&typeof G.search=="function"?G:null}catch{return null}}function te(G){G&&(S.value=typeof G.total=="number"?G.total:0,y.value=typeof G.activeIndex=="number"?G.activeIndex:-1,C.value=G.canReplace===!0,H.value=G.reason==="search-invalid-pattern"?B.invalidPatternLabel:null)}function le(){if(a){fe();return}if(s){if(!h.value){try{s.commands.clearSearchSession()}catch{}S.value=0,y.value=-1;return}try{const G=s.commands.setSearchSession(h.value,{caseSensitive:p.value,ignoreDiacritics:g.value,highlight:!0,searchModel:be().includeDeletedText?"raw":"visible"});S.value=G.matches.length,y.value=G.activeMatchIndex}catch{}}}function fe(){const G=a;if(G){if(!h.value){try{G.clear()}catch{}S.value=0,y.value=-1,H.value=null;return}try{te(G.search(h.value,{caseSensitive:p.value,includeDeletedText:be().includeDeletedText===!0,regex:k.value}))}catch{}}}function Ne(){N&&clearTimeout(N),N=setTimeout(le,150)}Pt(h,()=>{c.value&&Ne()}),Pt(p,()=>{c.value&&le()}),Pt(g,()=>{c.value&&le()}),Pt(k,()=>{c.value&&le()});let he=!0;function ge(){if(X.value){if(a){try{a.next(),te(a.getSnapshot())}catch{}return}if(s)try{y.value=s.commands.nextSearchMatch().activeMatchIndex}catch{}}}function ae(){if(X.value){if(a){try{a.previous(),te(a.getSnapshot())}catch{}return}if(s)try{y.value=s.commands.previousSearchMatch().activeMatchIndex}catch{}}}function _e(){if(he&&!T.value&&X.value){if(a){if(!C.value)return;const G=a;T.value=!0;const Z=F_(G,{getCurrentSession:()=>a,applySlice:te,onSettled:()=>{T.value=!1}});let W=null;try{W=G.replace(m.value)}catch{}W&&typeof W.then=="function"?Promise.resolve(W).then(Z,Z):Z();return}if(s)try{const G=s.commands.replaceSearchMatch(m.value);S.value=G.matches.length,y.value=G.activeMatchIndex}catch{}}}function oe(){if(he&&!T.value&&X.value){if(a){if(!C.value)return;const G=a;T.value=!0;const Z=F_(G,{getCurrentSession:()=>a,applySlice:te,onSettled:()=>{T.value=!1}});let W=null;try{W=G.replaceAll(m.value)}catch{}W&&typeof W.then=="function"?Promise.resolve(W).then(Z,Z):Z();return}if(s)try{s.commands.replaceAllSearchMatches(m.value),S.value=0,y.value=-1}catch{}}}function Te(){if(a){try{te(a.getSnapshot())}catch{}return}const G=nM(s);if(!G)return;const Z=G.searchResults,W=Array.isArray(Z)?Z.length:0,K=G.activeMatchIndex??-1;W!==S.value&&(S.value=W),K!==y.value&&(y.value=K)}function Ge(){Je(),I=setInterval(Te,200)}function Je(){N&&clearTimeout(N),N=null,I&&clearInterval(I),I=null}function _t(){h.value="",m.value="",p.value=!1,g.value=!1,k.value=!1,H.value=null,w.value=!1,S.value=0,y.value=-1,C.value=!0,T.value=!1}function be(){const G=typeof r=="function"?r():void 0;if(G===!1||G==null)return{enabled:!1,texts:sr,replaceEnabled:!0};if(G===!0)return{enabled:!0,texts:sr,replaceEnabled:!0};const Z=typeof G=="object"?G:{};if(Z.component!=null&&typeof Z.render=="function")throw new Error('modules.surfaces.findReplace cannot provide both "component" and "render". Use one or the other.');return{enabled:!0,texts:{findPlaceholder:Z.findPlaceholder??sr.findPlaceholder,findAriaLabel:Z.findAriaLabel??sr.findAriaLabel,replacePlaceholder:Z.replacePlaceholder??sr.replacePlaceholder,replaceAriaLabel:Z.replaceAriaLabel??sr.replaceAriaLabel,noResultsLabel:Z.noResultsLabel??sr.noResultsLabel,previousMatchLabel:Z.previousMatchLabel??sr.previousMatchLabel,previousMatchAriaLabel:Z.previousMatchAriaLabel??sr.previousMatchAriaLabel,nextMatchLabel:Z.nextMatchLabel??sr.nextMatchLabel,nextMatchAriaLabel:Z.nextMatchAriaLabel??sr.nextMatchAriaLabel,closeLabel:Z.closeLabel??sr.closeLabel,closeAriaLabel:Z.closeAriaLabel??sr.closeAriaLabel,replaceLabel:Z.replaceLabel??sr.replaceLabel,replaceAllLabel:Z.replaceAllLabel??sr.replaceAllLabel,toggleReplaceLabel:Z.toggleReplaceLabel??sr.toggleReplaceLabel,toggleReplaceAriaLabel:Z.toggleReplaceAriaLabel??sr.toggleReplaceAriaLabel,matchCaseLabel:Z.matchCaseLabel??sr.matchCaseLabel,matchCaseAriaLabel:Z.matchCaseAriaLabel??sr.matchCaseAriaLabel,regexLabel:Z.regexLabel??sr.regexLabel,regexAriaLabel:Z.regexAriaLabel??sr.regexAriaLabel,invalidPatternLabel:Z.invalidPatternLabel??sr.invalidPatternLabel,ignoreDiacriticsLabel:Z.ignoreDiacriticsLabel??sr.ignoreDiacriticsLabel,ignoreDiacriticsAriaLabel:Z.ignoreDiacriticsAriaLabel??sr.ignoreDiacriticsAriaLabel},replaceEnabled:Z.replaceEnabled??!0,includeDeletedText:Z.includeDeletedText??!1,component:Z.component,props:Z.props,render:Z.render,resolver:Z.resolver,floating:Z.floating&&typeof Z.floating=="object"?Z.floating:void 0}}function Ve(G,Z){if(typeof G.resolver=="function"){const W=G.resolver(Z);if(W!=null&&W.type!=="default"){if(W.type==="none")return{suppressed:!0};if(W.type==="custom")return{component:W.component,props:W.props};if(W.type==="external")return{render:W.render}}}return G.component!=null?{component:G.component,props:G.props}:typeof G.render=="function"?{render:G.render}:{builtin:!0}}function Le(G,Z){return{findQuery:h,replaceText:m,caseSensitive:p,ignoreDiacritics:g,regex:k,showReplace:w,matchCount:S,activeMatchIndex:y,matchLabel:z,hasMatches:X,canReplace:P,replaceCanMutate:C,replacePending:T,ignoreDiacriticsSupported:R,regexSupported:M,searchError:H,replaceEnabled:G.replaceEnabled??!0,texts:G.texts,goNext:ge,goPrev:ae,replaceCurrent:_e,replaceAll:oe,registerFocusFn:W=>{d=W},close:W=>Z(W)}}function J(G){return{get findQuery(){return G.findQuery.value},set findQuery(Z){G.findQuery.value=Z},get replaceText(){return G.replaceText.value},set replaceText(Z){G.replaceText.value=Z},get caseSensitive(){return G.caseSensitive.value},set caseSensitive(Z){G.caseSensitive.value=Z},get ignoreDiacritics(){return G.ignoreDiacritics.value},set ignoreDiacritics(Z){G.ignoreDiacritics.value=Z},get regex(){return G.regex.value},set regex(Z){G.regex.value=Z},get regexSupported(){return G.regexSupported.value},get searchError(){return G.searchError.value},get replaceCanMutate(){return G.replaceCanMutate.value},get showReplace(){return G.showReplace.value},set showReplace(Z){G.showReplace.value=Z},get matchCount(){return G.matchCount.value},get activeMatchIndex(){return G.activeMatchIndex.value},get matchLabel(){return G.matchLabel.value},get hasMatches(){return G.hasMatches.value},get canReplace(){return G.canReplace.value},get replacePending(){return G.replacePending.value},get ignoreDiacriticsSupported(){return G.ignoreDiacriticsSupported.value},replaceEnabled:G.replaceEnabled,texts:G.texts,goNext:G.goNext,goPrev:G.goPrev,replaceCurrent:G.replaceCurrent,replaceAll:G.replaceAll,registerFocusFn:G.registerFocusFn,close:G.close}}function _(G){if(G){if(typeof G?.commands?.clearSearchSession=="function"){try{G.commands.clearSearchSession()}catch{}return}if(a&&G===s)try{a.clear()}catch{}}}function $(){try{if(l||!e()||!t())return!1;if(i&&c.value)return!0;const G=be();if(!G.enabled||Ve(G,{texts:G.texts,replaceEnabled:G.replaceEnabled??!0}).suppressed)return!1;if(!L(t())){const Z=Y();if(!Z)return!1;try{if(Z.getSnapshot?.().available!==!0)return!1}catch{return!1}}return!0}catch{return!1}}async function F(){if(l)return;const G=e();if(G){if(i&&c.value){d?.();return}if(!u){u=!0;try{const Z=t();if(!Z){u=!1;return}const W=be();if(!W.enabled){u=!1;return}const K=Ve(W,{texts:W.texts,replaceEnabled:W.replaceEnabled??!0});if(K.suppressed){u=!1;return}_t(),B=W.texts,he=W.replaceEnabled??!0;const ue={placement:"top-right",autoFocus:!0,width:420,...W.floating??{}};if(s&&s!==Z&&_(s),s=Z,a=L(Z)?null:Y(),R.value=!a,M.value=!!a,a)try{te(a.getSnapshot())}catch{}d=null;let we=()=>{};const Ce=Le(W,tt=>we(tt));let xe;if(K.component)xe=G.open({mode:"floating",ariaLabel:W.texts.findAriaLabel,closeOnEscape:!0,floating:ue,component:Gr(K.component),props:{...K.props,findReplace:Ce}});else if(K.render){const tt=K.render;xe=G.open({mode:"floating",ariaLabel:W.texts.findAriaLabel,closeOnEscape:!0,floating:ue,render:Ct=>tt({container:Ct.container,findReplace:J(Ce),resolve:Ct.resolve,close:Ct.close,surfaceId:Ct.surfaceId,mode:Ct.mode})})}else{let tt;try{tt=(await Promise.resolve().then(()=>(tM(),eM))).default}catch{u=!1;return}if(l||i&&c.value){u=!1;return}const Ct=t()||Z;s!==Ct&&(_(s),s=Ct,a=L(Ct)?null:Y(),R.value=!a),xe=G.open({mode:"floating",ariaLabel:W.texts.findAriaLabel,component:Gr(tt),closeOnEscape:!0,floating:ue,props:{findReplace:Ce}})}we=tt=>xe.close(tt??"programmatic"),i=xe,c.value=!0,u=!1,Ge();const ot=xe.id;xe.result.then(()=>{i?.id===ot?(Je(),_(s),i=null,c.value=!1,d=null):_(Z!==s?Z:null)})}catch(Z){throw u=!1,Z}}}}function j(){i&&i.close("programmatic")}n&&Pt(n,(G,Z)=>{!c.value||!i||G!==Z&&(_(Z),j())});function V(){l=!0,Je(),j(),s=null,a=null,d=null}return{open:F,close:j,isOpen:c,wouldOpen:$,destroy:V}}var Jd=null;function Yy(e){e!=null&&(Jd=e)}function oM(e){Jd===e&&(Jd=null)}function iM(e){return Jd===null||Jd===e}function sM(e,{focusInside:t,owner:n}){if(e.defaultPrevented)return!1;if(t)return!0;const r=document.activeElement;return(!r||r===document.body||r===document.documentElement)&&iM(n)}var aM=/^(https?|mailto|tel):/i,lM=/^(javascript|data|vbscript):/i,cM=/^[a-z][a-z0-9+.-]*:/i;function uM(e){if(typeof e!="string")return null;const t=e.trim();return t?t.startsWith("#")?{href:t}:lM.test(t)?null:cM.test(t)?aM.test(t)?{href:t}:null:{href:t}:null}var dM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"/></svg>',fM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"/></svg>',hM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"/></svg>',sS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M40 48C26.7 48 16 58.7 16 72l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24L40 48zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM16 232l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24l-48 0c-13.3 0-24 10.7-24 24zM40 368c-13.3 0-24 10.7-24 24l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24l-48 0z"/></svg>',pM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc. (bullet shapes modified)--><path fill-rule="evenodd" d="M192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 48 A48 48 0 1 0 64 144 A48 48 0 1 0 64 48 Z M64 68 A28 28 0 1 1 64 124 A28 28 0 1 1 64 68 Z M64 208 A48 48 0 1 0 64 304 A48 48 0 1 0 64 208 Z M64 228 A28 28 0 1 1 64 284 A28 28 0 1 1 64 228 Z M64 368 A48 48 0 1 0 64 464 A48 48 0 1 0 64 368 Z M64 388 A28 28 0 1 1 64 444 A28 28 0 1 1 64 388 Z"/></svg>
|
|
15
|
+
`,mM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc. (bullet shapes modified)--><path d="M192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM16 48 L112 48 L112 144 L16 144 Z M16 208 L112 208 L112 304 L16 304 Z M16 368 L112 368 L112 464 L16 464 Z"/></svg>
|
|
16
|
+
`,gM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>',vM=`<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
17
|
+
<g clip-path="url(#clip0_0_1)">
|
|
18
|
+
<path d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z" fill="currentColor"/>
|
|
19
|
+
<path d="M131.823 9.18182V111H110.296V29.6151H109.7L86.3828 44.2315V25.1406L111.589 9.18182H131.823ZM163.132 112.293C159.85 112.293 157.033 111.133 154.68 108.812C152.36 106.459 151.2 103.642 151.2 100.361C151.2 97.1127 152.36 94.3286 154.68 92.0085C157.033 89.6884 159.85 88.5284 163.132 88.5284C166.314 88.5284 169.098 89.6884 171.484 92.0085C173.87 94.3286 175.064 97.1127 175.064 100.361C175.064 102.548 174.5 104.554 173.373 106.376C172.279 108.166 170.838 109.608 169.048 110.702C167.258 111.762 165.286 112.293 163.132 112.293Z" fill="currentColor"/>
|
|
20
|
+
<path d="M62.37 284V268.489L98.6129 234.93C101.695 231.947 104.281 229.263 106.369 226.876C108.49 224.49 110.097 222.153 111.191 219.866C112.285 217.546 112.832 215.044 112.832 212.359C112.832 209.376 112.152 206.808 110.793 204.653C109.434 202.466 107.578 200.792 105.225 199.632C102.872 198.439 100.204 197.842 97.2209 197.842C94.1054 197.842 91.3875 198.472 89.0675 199.732C86.7474 200.991 84.9576 202.797 83.6982 205.151C82.4387 207.504 81.8089 210.304 81.8089 213.553H61.3757C61.3757 206.891 62.8838 201.107 65.8999 196.202C68.916 191.296 73.1418 187.501 78.5774 184.817C84.013 182.132 90.2772 180.79 97.37 180.79C104.662 180.79 111.009 182.082 116.411 184.668C121.847 187.22 126.073 190.766 129.089 195.307C132.105 199.848 133.613 205.051 133.613 210.918C133.613 214.762 132.851 218.557 131.326 222.303C129.835 226.048 127.166 230.207 123.322 234.781C119.477 239.322 114.058 244.774 107.065 251.138L92.1996 265.705V266.401H134.955V284H62.37ZM163.132 285.293C159.85 285.293 157.033 284.133 154.68 281.812C152.36 279.459 151.2 276.642 151.2 273.361C151.2 270.113 152.36 267.329 154.68 265.009C157.033 262.688 159.85 261.528 163.132 261.528C166.314 261.528 169.098 262.688 171.484 265.009C173.87 267.329 175.064 270.113 175.064 273.361C175.064 275.548 174.5 277.554 173.373 279.376C172.279 281.166 170.838 282.608 169.048 283.702C167.258 284.762 165.286 285.293 163.132 285.293Z" fill="currentColor"/>
|
|
21
|
+
<path d="M98.7745 451.392C91.3503 451.392 84.738 450.116 78.9379 447.564C73.1708 444.979 68.6135 441.432 65.266 436.925C61.9516 432.384 60.2447 427.147 60.1452 421.214H81.8214C81.954 423.7 82.766 425.888 84.2575 427.777C85.7821 429.633 87.8039 431.075 90.3228 432.102C92.8417 433.13 95.6755 433.643 98.8242 433.643C102.105 433.643 105.006 433.063 107.525 431.903C110.043 430.743 112.016 429.136 113.441 427.081C114.866 425.026 115.578 422.656 115.578 419.972C115.578 417.254 114.816 414.851 113.292 412.763C111.8 410.642 109.646 408.984 106.828 407.791C104.044 406.598 100.73 406.001 96.8853 406.001H87.3896V390.192H96.8853C100.133 390.192 103 389.628 105.486 388.501C108.005 387.375 109.961 385.817 111.353 383.828C112.745 381.806 113.441 379.453 113.441 376.768C113.441 374.216 112.828 371.979 111.601 370.057C110.408 368.101 108.718 366.577 106.53 365.483C104.376 364.389 101.857 363.842 98.9734 363.842C96.0567 363.842 93.3886 364.373 90.9691 365.433C88.5496 366.461 86.6107 367.936 85.1523 369.858C83.694 371.78 82.9151 374.034 82.8157 376.619H62.1836C62.283 370.753 63.9568 365.582 67.2049 361.108C70.453 356.634 74.828 353.137 80.3299 350.618C85.8649 348.066 92.1126 346.79 99.0728 346.79C106.099 346.79 112.248 348.066 117.517 350.618C122.787 353.17 126.881 356.617 129.797 360.959C132.747 365.268 134.205 370.107 134.172 375.476C134.205 381.177 132.432 385.933 128.853 389.744C125.306 393.556 120.683 395.975 114.982 397.003V397.798C122.472 398.759 128.173 401.361 132.084 405.604C136.028 409.813 137.984 415.083 137.951 421.413C137.984 427.214 136.31 432.367 132.929 436.875C129.582 441.383 124.958 444.929 119.059 447.514C113.159 450.099 106.398 451.392 98.7745 451.392ZM163.132 451.293C159.85 451.293 157.033 450.133 154.68 447.812C152.36 445.459 151.2 442.642 151.2 439.361C151.2 436.113 152.36 433.329 154.68 431.009C157.033 428.688 159.85 427.528 163.132 427.528C166.314 427.528 169.098 428.688 171.484 431.009C173.87 433.329 175.064 436.113 175.064 439.361C175.064 441.548 174.5 443.554 173.373 445.376C172.279 447.166 170.838 448.608 169.048 449.702C167.258 450.762 165.286 451.293 163.132 451.293Z" fill="currentColor"/>
|
|
22
|
+
</g>
|
|
23
|
+
<defs>
|
|
24
|
+
<clipPath id="clip0_0_1">
|
|
25
|
+
<rect width="512" height="512" fill="white"/>
|
|
26
|
+
</clipPath>
|
|
27
|
+
</defs>
|
|
28
|
+
</svg>
|
|
29
|
+
`,yM=`<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
+
<g clip-path="url(#clip0_1_12)">
|
|
31
|
+
<path d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z" fill="currentColor"/>
|
|
32
|
+
<path d="M119.768 25.1818V127H98.2415V45.6151H97.6449L74.3281 60.2315V41.1406L99.5341 25.1818H119.768ZM179.863 76.0909C179.863 88.4536 178.205 99.822 174.891 110.196C171.61 120.57 166.572 130.182 159.777 139.031H139.543C142.128 135.75 144.531 131.74 146.752 127C148.972 122.26 150.911 117.09 152.569 111.489C154.226 105.854 155.518 100.021 156.446 93.9886C157.374 87.9564 157.838 81.9905 157.838 76.0909C157.838 68.2358 157.026 60.3144 155.402 52.3267C153.811 44.3059 151.624 36.8816 148.84 30.054C146.089 23.1932 142.99 17.5753 139.543 13.2003H159.777C166.572 22.0497 171.61 31.6615 174.891 42.0355C178.205 52.4096 179.863 63.7614 179.863 76.0909Z" fill="currentColor"/>
|
|
33
|
+
<path d="M55.7841 300V284.489L92.027 250.93C95.1094 247.947 97.6946 245.263 99.7827 242.876C101.904 240.49 103.511 238.153 104.605 235.866C105.699 233.546 106.246 231.044 106.246 228.359C106.246 225.376 105.566 222.808 104.207 220.653C102.848 218.466 100.992 216.792 98.6392 215.632C96.286 214.439 93.6179 213.842 90.6349 213.842C87.5194 213.842 84.8016 214.472 82.4815 215.732C80.1615 216.991 78.3717 218.797 77.1122 221.151C75.8527 223.504 75.223 226.304 75.223 229.553H54.7898C54.7898 222.891 56.2978 217.107 59.3139 212.202C62.33 207.296 66.5559 203.501 71.9915 200.817C77.4271 198.132 83.6913 196.79 90.7841 196.79C98.0758 196.79 104.423 198.082 109.825 200.668C115.261 203.22 119.487 206.766 122.503 211.307C125.519 215.848 127.027 221.051 127.027 226.918C127.027 230.762 126.265 234.557 124.74 238.303C123.249 242.048 120.58 246.207 116.736 250.781C112.891 255.322 107.472 260.774 100.479 267.138L85.6136 281.705V282.401H128.369V300H55.7841ZM179.863 249.091C179.863 261.454 178.205 272.822 174.891 283.196C171.61 293.57 166.572 303.182 159.777 312.031H139.543C142.128 308.75 144.531 304.74 146.752 300C148.972 295.26 150.911 290.09 152.569 284.489C154.226 278.854 155.518 273.021 156.446 266.989C157.374 260.956 157.838 254.991 157.838 249.091C157.838 241.236 157.026 233.314 155.402 225.327C153.811 217.306 151.624 209.882 148.84 203.054C146.089 196.193 142.99 190.575 139.543 186.2H159.777C166.572 195.05 171.61 204.661 174.891 215.036C178.205 225.41 179.863 236.761 179.863 249.091Z" fill="currentColor"/>
|
|
34
|
+
<path d="M89.3175 473.392C81.8932 473.392 75.281 472.116 69.4808 469.564C63.7138 466.979 59.1565 463.432 55.8089 458.925C52.4946 454.384 50.7876 449.147 50.6882 443.214H72.3643C72.4969 445.7 73.3089 447.888 74.8004 449.777C76.325 451.633 78.3468 453.075 80.8658 454.102C83.3847 455.13 86.2185 455.643 89.3672 455.643C92.6484 455.643 95.5485 455.063 98.0675 453.903C100.586 452.743 102.558 451.136 103.984 449.081C105.409 447.026 106.121 444.656 106.121 441.972C106.121 439.254 105.359 436.851 103.835 434.763C102.343 432.642 100.189 430.984 97.3715 429.791C94.5874 428.598 91.273 428.001 87.4283 428.001H77.9325V412.192H87.4283C90.6764 412.192 93.5433 411.628 96.0291 410.501C98.5481 409.375 100.504 407.817 101.896 405.828C103.288 403.806 103.984 401.453 103.984 398.768C103.984 396.216 103.371 393.979 102.144 392.057C100.951 390.101 99.2607 388.577 97.0732 387.483C94.9188 386.389 92.3999 385.842 89.5163 385.842C86.5997 385.842 83.9316 386.373 81.5121 387.433C79.0926 388.461 77.1536 389.936 75.6953 391.858C74.237 393.78 73.4581 396.034 73.3587 398.619H52.7266C52.826 392.753 54.4998 387.582 57.7479 383.108C60.996 378.634 65.371 375.137 70.8729 372.618C76.4079 370.066 82.6555 368.79 89.6158 368.79C96.6423 368.79 102.79 370.066 108.06 372.618C113.33 375.17 117.424 378.617 120.34 382.959C123.29 387.268 124.748 392.107 124.715 397.476C124.748 403.177 122.975 407.933 119.396 411.744C115.849 415.556 111.226 417.975 105.525 419.003V419.798C113.015 420.759 118.716 423.361 122.627 427.604C126.571 431.813 128.527 437.083 128.494 443.413C128.527 449.214 126.853 454.367 123.472 458.875C120.125 463.383 115.501 466.929 109.602 469.514C103.702 472.099 96.9406 473.392 89.3175 473.392ZM179.863 421.091C179.863 433.454 178.205 444.822 174.891 455.196C171.61 465.57 166.572 475.182 159.777 484.031H139.543C142.128 480.75 144.531 476.74 146.752 472C148.972 467.26 150.911 462.09 152.569 456.489C154.226 450.854 155.518 445.021 156.446 438.989C157.374 432.956 157.838 426.991 157.838 421.091C157.838 413.236 157.026 405.314 155.402 397.327C153.811 389.306 151.624 381.882 148.84 375.054C146.089 368.193 142.99 362.575 139.543 358.2H159.777C166.572 367.05 171.61 376.661 174.891 387.036C178.205 397.41 179.863 408.761 179.863 421.091Z" fill="currentColor"/>
|
|
35
|
+
</g>
|
|
36
|
+
<defs>
|
|
37
|
+
<clipPath id="clip0_1_12">
|
|
38
|
+
<rect width="512" height="512" fill="white"/>
|
|
39
|
+
</clipPath>
|
|
40
|
+
</defs>
|
|
41
|
+
</svg>
|
|
42
|
+
`,bM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
43
|
+
<path fill="currentColor" d="M260 54c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L260 54zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0z"/>
|
|
44
|
+
<text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="86" dominant-baseline="central">I.</text>
|
|
45
|
+
<text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="256" dominant-baseline="central">II.</text>
|
|
46
|
+
<text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="426" dominant-baseline="central">III.</text>
|
|
47
|
+
</svg>
|
|
48
|
+
`,wM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
49
|
+
<path fill="currentColor" d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z"/>
|
|
50
|
+
<text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="86" dominant-baseline="central">i.</text>
|
|
51
|
+
<text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="256" dominant-baseline="central">ii.</text>
|
|
52
|
+
<text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="426" dominant-baseline="central">iii.</text>
|
|
53
|
+
</svg>
|
|
54
|
+
`,CM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
55
|
+
<path fill="currentColor" d="M260 54c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L260 54zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0z"/>
|
|
56
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="86" dominant-baseline="central">A.</text>
|
|
57
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="256" dominant-baseline="central">B.</text>
|
|
58
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="426" dominant-baseline="central">C.</text>
|
|
59
|
+
</svg>
|
|
60
|
+
`,_M=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
61
|
+
<path fill="currentColor" d="M260 54c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L260 54zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0z"/>
|
|
62
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="86" dominant-baseline="central">A)</text>
|
|
63
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="256" dominant-baseline="central">B)</text>
|
|
64
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="426" dominant-baseline="central">C)</text>
|
|
65
|
+
</svg>
|
|
66
|
+
`,SM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
67
|
+
<path fill="currentColor" d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z"/>
|
|
68
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="74" dominant-baseline="central">a.</text>
|
|
69
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="244" dominant-baseline="central">b.</text>
|
|
70
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="414" dominant-baseline="central">c.</text>
|
|
71
|
+
</svg>
|
|
72
|
+
`,kM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
73
|
+
<path fill="currentColor" d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z"/>
|
|
74
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="74" dominant-baseline="central">a)</text>
|
|
75
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="244" dominant-baseline="central">b)</text>
|
|
76
|
+
<text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="414" dominant-baseline="central">c)</text>
|
|
77
|
+
</svg>
|
|
78
|
+
`,AM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',aS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"/></svg>',IM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"/></svg>',EM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"/></svg>',xM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"/></svg>',TM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M448 64c0-17.7-14.3-32-32-32L32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32zm0 256c0-17.7-14.3-32-32-32L32 288c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 192c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32zM448 448c0-17.7-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32z"/></svg>',RM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3L0 176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"/></svg>',MM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM.2 268.6c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6l0 158.6c0 13.3-15.3 20.8-25.8 12.6L.2 268.6z"/></svg>',LM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0L352 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64L64 192c-35.3 0-64-28.7-64-64L0 64zM160 352c0-17.7 14.3-32 32-32l0-16c0-44.2 35.8-80 80-80l144 0c17.7 0 32-14.3 32-32l0-32 0-90.5c37.3 13.2 64 48.7 64 90.5l0 32c0 53-43 96-96 96l-144 0c-8.8 0-16 7.2-16 16l0 16c17.7 0 32 14.3 32 32l0 128c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32-14.3-32-32l0-128z"/></svg>',DM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96 503 96 497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32L376.1 32l-.3 0L204.5 32c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96l116.7 0L301.3 210.8l-94.5-74.1zM243.3 416L192 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-42.2 0 17.6-62.1L272.9 311 243.3 416z"/></svg>',PM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"/></svg>',OM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 0c17.7 0 32 14.3 32 32l0 32 128 0 0-32c0-17.7 14.3-32 32-32s32 14.3 32 32l0 32 48 0c26.5 0 48 21.5 48 48l0 48L0 160l0-48C0 85.5 21.5 64 48 64l48 0 0-32c0-17.7 14.3-32 32-32zM0 192l448 0 0 272c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 192zM329 305c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-95 95-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L329 305z"/></svg>',FM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 0c17.7 0 32 14.3 32 32l0 32 128 0 0-32c0-17.7 14.3-32 32-32s32 14.3 32 32l0 32 48 0c26.5 0 48 21.5 48 48l0 48L0 160l0-48C0 85.5 21.5 64 48 64l48 0 0-32c0-17.7 14.3-32 32-32zM0 192l448 0 0 272c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 192zM305 305c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-47 47-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l47 47-47 47c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l47-47 47 47c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-47-47 47-47z"/></svg>',BM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M152.1 38.2c9.9 8.9 10.7 24 1.8 33.9l-72 80c-4.4 4.9-10.6 7.8-17.2 7.9s-12.9-2.4-17.6-7L7 113C-2.3 103.6-2.3 88.4 7 79s24.6-9.4 33.9 0l22.1 22.1 55.1-61.2c8.9-9.9 24-10.7 33.9-1.8zm0 160c9.9 8.9 10.7 24 1.8 33.9l-72 80c-4.4 4.9-10.6 7.8-17.2 7.9s-12.9-2.4-17.6-7L7 273c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l22.1 22.1 55.1-61.2c8.9-9.9 24-10.7 33.9-1.8zM224 96c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zm0 160c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zM160 416c0-17.7 14.3-32 32-32l288 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-288 0c-17.7 0-32-14.3-32-32zM48 368a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"/></svg>',lS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512l293.1 0c-3.1-8.8-3.7-18.4-1.4-27.8l15-60.1c2.8-11.3 8.6-21.5 16.8-29.7l40.3-40.3c-32.1-31-75.7-50.1-123.9-50.1l-91.4 0zm435.5-68.3c-15.6-15.6-40.9-15.6-56.6 0l-29.4 29.4 71 71 29.4-29.4c15.6-15.6 15.6-40.9 0-56.6l-14.4-14.4zM375.9 417c-4.1 4.1-7 9.2-8.4 14.9l-15 60.1c-1.4 5.5 .2 11.2 4.2 15.2s9.7 5.6 15.2 4.2l60.1-15c5.6-1.4 10.8-4.3 14.9-8.4L576.1 358.7l-71-71L375.9 417z"/></svg>',cS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z"/></svg>',NM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 288c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128z"/></svg>',zM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416 32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-1.8 0 18-48 159.6 0 18 48-1.8 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-25.8 0L254 52.8zM279.8 304l-111.6 0L224 155.1 279.8 304z"/></svg>',HM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 0C28.7 0 0 28.7 0 64L0 320l384 0 0-160-128 0c-17.7 0-32-14.3-32-32L224 0 64 0zM256 0l0 128 128 0L256 0zM0 416l64 0 0-64L0 352l0 64zm288 32l-80 0 0 64 80 0 0-64zm-112 0l-80 0 0 64 80 0 0-64zM64 448L0 448c0 35.3 28.7 64 64 64l0-64zm256 0l0 64c35.3 0 64-28.7 64-64l-64 0zm64-32l0-64-64 0 0 64 64 0z"/></svg>',UM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/></svg>',VM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-128c0-17.7-14.3-32-32-32L352 0zM80 32C35.8 32 0 67.8 0 112L0 432c0 44.2 35.8 80 80 80l320 0c44.2 0 80-35.8 80-80l0-112c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 112c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-320c0-8.8 7.2-16 16-16l112 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 32z"/></svg>',jM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"/></svg>',GM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M177.9 494.1c-18.7 18.7-49.1 18.7-67.9 0L17.9 401.9c-18.7-18.7-18.7-49.1 0-67.9l50.7-50.7 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 41.4-41.4 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 41.4-41.4 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 41.4-41.4 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 50.7-50.7c18.7-18.7 49.1-18.7 67.9 0l92.1 92.1c18.7 18.7 18.7 49.1 0 67.9L177.9 494.1z"/></svg>',WM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M339.3 367.1c27.3-3.9 51.9-19.4 67.2-42.9L568.2 74.1c12.6-19.5 9.4-45.3-7.6-61.2S517.7-4.4 499.1 9.6L262.4 187.2c-24 18-38.2 46.1-38.4 76.1L339.3 367.1zm-19.6 25.4l-116-104.4C143.9 290.3 96 339.6 96 400c0 3.9 .2 7.8 .6 11.6C98.4 429.1 86.4 448 68.8 448L64 448c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0c61.9 0 112-50.1 112-112c0-2.5-.1-5-.2-7.5z"/></svg>',KM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M315 315l158.4-215L444.1 70.6 229 229 315 315zm-187 5s0 0 0 0l0-71.7c0-15.3 7.2-29.6 19.5-38.6L420.6 8.4C428 2.9 437 0 446.2 0c11.4 0 22.4 4.5 30.5 12.6l54.8 54.8c8.1 8.1 12.6 19 12.6 30.5c0 9.2-2.9 18.2-8.4 25.6L334.4 396.5c-9 12.3-23.4 19.5-38.6 19.5L224 416l-25.4 25.4c-12.5 12.5-32.8 12.5-45.3 0l-50.7-50.7c-12.5-12.5-12.5-32.8 0-45.3L128 320zM7 466.3l63-63 70.6 70.6-31 31c-4.5 4.5-10.6 7-17 7L24 512c-13.3 0-24-10.7-24-24l0-4.7c0-6.4 2.5-12.5 7-17z"/></svg>
|
|
79
|
+
`,qM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M224 96l16-32 32-16-32-16-16-32-16 32-32 16 32 16 16 32zM80 160l26.7-53.3L160 80l-53.3-26.7L80 0 53.3 53.3 0 80l53.3 26.7L80 160zm352 128l-26.7 53.3L352 368l53.3 26.7L432 448l26.7-53.3L512 368l-53.3-26.7L432 288zm70.6-193.8L417.8 9.4C411.5 3.1 403.3 0 395.2 0c-8.2 0-16.4 3.1-22.6 9.4L9.4 372.5c-12.5 12.5-12.5 32.8 0 45.3l84.9 84.9c6.3 6.3 14.4 9.4 22.6 9.4 8.2 0 16.4-3.1 22.6-9.4l363.1-363.2c12.5-12.5 12.5-32.8 0-45.2zM359.5 203.5l-50.9-50.9 86.6-86.6 50.9 50.9-86.6 86.6z"/></svg>',YM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"/></svg>',XM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm64 64l0 256 160 0 0-256L64 160zm384 0l-160 0 0 256 160 0 0-256z"/></svg>',QM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M406.6 374.6l96-96c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 224l-293.5 0 41.4-41.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 288l293.5 0-41.4 41.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/></svg>',ZM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M256 0c17.7 0 32 14.3 32 32l0 32 32 0c12.9 0 24.6 7.8 29.6 19.8s2.2 25.7-6.9 34.9l-64 64c-12.5 12.5-32.8 12.5-45.3 0l-64-64c-9.2-9.2-11.9-22.9-6.9-34.9s16.6-19.8 29.6-19.8l32 0 0-32c0-17.7 14.3-32 32-32zM169.4 393.4l64-64c12.5-12.5 32.8-12.5 45.3 0l64 64c9.2 9.2 11.9 22.9 6.9 34.9s-16.6 19.8-29.6 19.8l-32 0 0 32c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-32-32 0c-12.9 0-24.6-7.8-29.6-19.8s-2.2-25.7 6.9-34.9zM32 224l32 0 0-32c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l64 64c12.5 12.5 12.5 32.8 0 45.3l-64 64c-9.2 9.2-22.9 11.9-34.9 6.9s-19.8-16.6-19.8-29.6l0-32-32 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm297.4 54.6c-12.5-12.5-12.5-32.8 0-45.3l64-64c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 32 32 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-32 0 0 32c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-64-64zM256 224a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',mp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"/></svg>',Xy='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M135.2 17.7C140.6 6.8 151.7 0 163.8 0L284.2 0c12.1 0 23.2 6.8 28.6 17.7L320 32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 7.2-14.3zM32 128l384 0 0 320c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-320zm96 64c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16z"/></svg>',JM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M352 320c88.4 0 160-71.6 160-160c0-15.3-2.2-30.1-6.2-44.2c-3.1-10.8-16.4-13.2-24.3-5.3l-76.8 76.8c-3 3-7.1 4.7-11.3 4.7L336 192c-8.8 0-16-7.2-16-16l0-57.4c0-4.2 1.7-8.3 4.7-11.3l76.8-76.8c7.9-7.9 5.4-21.2-5.3-24.3C382.1 2.2 367.3 0 352 0C263.6 0 192 71.6 192 160c0 19.1 3.4 37.5 9.5 54.5L19.9 396.1C7.2 408.8 0 426.1 0 444.1C0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9L297.5 310.5c17 6.2 35.4 9.5 54.5 9.5zM80 408a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"/></svg>',$M='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M32 480a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm96-64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0-384a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0 256a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM320 416a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0-320a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM224 480a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0-448a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0 256a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM416 416a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0-384a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM32 96a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM416 224a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM32 288a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm192 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm192 64a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM32 320a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM416 192a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM32 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm192 64a32 32 0 1 1 0-64 32 32 0 1 1 0 64z"/></svg>',eL=`<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="3 4 18 16"><path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 10V5m0 0L4 7m2-2 2 2m-2 7v5m0 0 2-2m-2 2-2-2m8-10h8m0 5h-8m0 5h8"></path></svg>
|
|
80
|
+
`,tL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>
|
|
81
|
+
`,nL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M278.1 256L444.5 89.6c4.7-4.7 4.7-12.3 0-17-32.8-32.8-86-32.8-118.8 0L210.2 188.1l-24.9-24.9c4.3-10.9 6.7-22.8 6.7-35.3 0-53-43-96-96-96S0 75 0 128s43 96 96 96c4.5 0 9-.3 13.4-.9L142.3 256l-32.9 32.9c-4.4-.6-8.8-.9-13.4-.9-53 0-96 43-96 96s43 96 96 96 96-43 96-96c0-12.5-2.4-24.3-6.7-35.3l24.9-24.9L325.7 439.4c32.8 32.8 86 32.8 118.8 0 4.7-4.7 4.7-12.3 0-17L278.1 256zM96 160c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32zm0 256c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32z"/></svg>',rL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 448v40c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V120c0-13.3 10.7-24 24-24h72v296c0 30.9 25.1 56 56 56h168zm0-344V0H152c-13.3 0-24 10.7-24 24v368c0 13.3 10.7 24 24 24h272c13.3 0 24-10.7 24-24V128H344c-13.2 0-24-10.8-24-24zm121-31L375 7A24 24 0 0 0 358.1 0H352v96h96v-6.1a24 24 0 0 0 -7-17z"/></svg>',oL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 184c0-30.9 25.1-56 56-56h136V56c0-13.3-10.7-24-24-24h-80.6C204.3 12.9 183.6 0 160 0s-44.3 12.9-55.4 32H24C10.7 32 0 42.7 0 56v336c0 13.3 10.7 24 24 24h104V184zm32-144c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm184 248h104v200c0 13.3-10.7 24-24 24H184c-13.3 0-24-10.7-24-24V184c0-13.3 10.7-24 24-24h136v104c0 13.2 10.8 24 24 24zm104-38.1V256h-96v-96h6.1a24 24 0 0 1 17 7l65.9 65.9a24 24 0 0 1 7 17z"/></svg>',iL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"/></svg>
|
|
82
|
+
`,sL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><text x="12" y="18" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="20" font-weight="700" fill="currentColor">ΒΆ</text></svg>
|
|
83
|
+
`,aL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="96 96 448 448"><!--!Font Awesome Free v7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M96 160C96 124.7 124.7 96 160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM160 160L160 224L224 224L224 160L160 160zM480 160L288 160L288 224L480 224L480 160zM160 288L160 352L224 352L224 288L160 288zM480 288L288 288L288 352L480 352L480 288zM160 416L160 480L224 480L224 416L160 416zM480 416L288 416L288 480L480 480L480 416z"></path></svg>
|
|
84
|
+
`,lL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm12 8l-4-4v3H5v2h12v3l4-4z"/></svg>
|
|
85
|
+
`,cL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zm-2 7v-3l-4 4 4 4v-3h12v-2H8z"/></svg>
|
|
86
|
+
`;const Zn={undo:n_,redo:PM,bold:dM,italic:fM,underline:hM,color:zM,link:aS,image:AM,tableOfContents:aL,alignLeft:IM,alignRight:xM,alignCenter:EM,alignJustify:TM,bulletList:sS,bulletListDisc:sS,bulletListCircle:pM,bulletListSquare:mM,numberedList:gM,numberedListDecimal:vM,numberedListDecimalParen:yM,numberedListUpperRoman:bM,numberedListLowerRoman:wM,numberedListUpperAlpha:CM,numberedListUpperAlphaParen:_M,numberedListLowerAlpha:SM,numberedListLowerAlphaParen:kM,indentLeft:MM,indentRight:RM,directionLtr:lL,directionRtl:cL,pageBreak:HM,copyFormat:LM,clearFormatting:DM,trackChanges:BM,trackChangesFinal:NM,trackChangesOriginal:cS,trackChangesAccept:OM,trackChangesReject:FM,documentMode:lS,documentEditingMode:lS,documentSuggestingMode:JC,documentViewingMode:cS,colorOption:UM,colorOptionCheck:zy,linkInput:aS,removeLink:e_,openLink:VM,overflow:t_,dropdownCaretUp:jM,dropdownCaretDown:$C,ruler:GM,paintbrush:WM,highlight:KM,ai:qM,table:YM,tableActions:XM,splitCell:QM,mergeCells:ZM,addRowBefore:mp,addRowAfter:mp,addColumnBefore:mp,addColumnAfter:mp,deleteRow:Xy,deleteColumn:Xy,deleteTable:Xy,deleteBorders:$M,fixTables:JM,lineHeight:eL,search:tL,cut:nL,copy:rL,paste:oL,strikethrough:iL,formattingMarks:sL};It(),mn();var uL={key:0,class:"link-title"},dL={key:1,class:"link-title"},fL={key:2,class:"link-title"},hL={key:3,class:"link-title"},pL={key:4,class:"link-input-wrapper"},mL={class:"input-row text-input-row"},gL=["readonly","onKeydown"],vL={class:"input-row url-input-row"},yL=["innerHTML"],bL=["readonly","onKeydown"],wL=["innerHTML"],CL={key:0,class:"input-row link-buttons"},_L=["innerHTML"],SL={key:5,class:"input-row go-to-anchor clickable"},kL={__name:"LinkInput",props:{showInput:{type:Boolean,default:!0},showLink:{type:Boolean,default:!0},goToAnchor:{type:Function,default:()=>{}},ui:{type:Object,default:null},linkItem:{type:Object,default:null},closePopover:{type:Function,default:()=>{}},href:{type:String,default:null},target:{type:String,default:null},rel:{type:String,default:null},tooltip:{type:String,default:null},clickedElement:{type:Object,default:null},hyperlinkTarget:{type:Object,default:null},hyperlinkText:{type:String,default:null},textTarget:{type:Object,default:null},restoreSelection:{type:Function,default:()=>{}},documentMode:{type:String,default:null}},setup(e){const t=e,{isHighContrastMode:n}=Hi(),r=ne(!1),o=()=>{if(typeof t.hyperlinkText=="string"&&t.hyperlinkText)return t.hyperlinkText;const H=t.ui?.selection?.getSnapshot?.();if(typeof H?.quotedText=="string"&&H.quotedText)return H.quotedText;const B=t.clickedElement?.innerText??t.clickedElement?.textContent;return typeof B=="string"?B:""},i=()=>{if(typeof t.href=="string"&&t.href)return t.href;const H=t.ui?.toolbar?.getSnapshot?.()?.commands?.link?.value;if(typeof H=="string"&&H)return H;const B=t.linkItem?.attributes?.value?.href;return typeof B=="string"?B:""},s=()=>t.documentMode??t.ui?.document?.getSnapshot?.()?.mode??null,a=ne(""),l=ne(""),u=ne(!1),c=/^[a-z][a-z0-9+.-]*:/i,d=Ae(()=>{const H=l.value.trim();return H?H.startsWith("#")||c.test(H)?H:"https://"+H:""}),h=Ae(()=>d.value?uM(d.value):null),m=Ae(()=>h.value!==null),p=ne(!1),g=Ae(()=>!u.value&&p.value),k=Ae(()=>!m.value),w=Ae(()=>s()==="viewing"),S=()=>{const H=h.value?.href;H&&window.open(H,"_blank","noopener")},y=()=>{const H=document.querySelector(".link-input-ctn input");H&&H.focus()};Rn(()=>{a.value=o(),l.value=i(),p.value=!!l.value,u.value=l.value.startsWith("#"),t.showInput&&!w.value&&y()});const C=H=>{const B=t.ui;return B?.commands?.execute?(t.restoreSelection?.(),B.commands.execute("link",H)):!1},T=()=>{if(w.value)return;if(!l.value){C({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover();return}if(!m.value){r.value=!0;return}const H=h.value?.href;if(!H){r.value=!0;return}const B={href:H,currentText:o(),hyperlinkTarget:t.hyperlinkTarget,textTarget:t.textTarget};a.value?B.text=a.value:g.value||(B.text=H),C(B),t.closePopover()},R=()=>{C({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover()},M=H=>{t.goToAnchor&&t.goToAnchor(H)};return(H,B)=>(me(),ke("div",{class:en(["link-input-ctn",{"high-contrast":We(n)}])},[u.value?(me(),ke("div",uL,"Page anchor")):w.value?(me(),ke("div",dL,"Link details")):g.value?(me(),ke("div",fL,"Edit link")):(me(),ke("div",hL,"Add link")),e.showInput&&!u.value?(me(),ke("div",pL,[Me("div",mL,[B[4]||(B[4]=Me("div",{class:"input-icon text-input-icon"},"T",-1)),Ms(Me("input",{type:"text",name:"text",placeholder:"Text","onUpdate:modelValue":B[0]||(B[0]=z=>a.value=z),readonly:w.value,onKeydown:Qo(Jt(T,["stop","prevent"]),["enter"])},null,40,gL),[[Ii,a.value]])]),Me("div",vL,[Me("div",{class:"input-icon",innerHTML:We(Zn).linkInput},null,8,yL),Ms(Me("input",{type:"text",name:"link",placeholder:"Type or paste a link",class:en({"sd-error":r.value}),"onUpdate:modelValue":B[1]||(B[1]=z=>l.value=z),readonly:w.value,onKeydown:[Qo(Jt(T,["stop","prevent"]),["enter"]),B[2]||(B[2]=z=>r.value=!1)]},null,42,bL),[[Ii,l.value]]),Me("div",{class:en(["open-link-icon",{"sd-disabled":!m.value}]),innerHTML:We(Zn).openLink,onClick:S,"data-item":"btn-link-open"},null,10,wL)]),w.value?ut("",!0):(me(),ke("div",CL,[g.value?(me(),ke("button",{key:0,class:"remove-btn",onClick:R,"data-item":"btn-link-remove"},[Me("div",{class:"remove-btn__icon",innerHTML:We(Zn).removeLink},null,8,_L),B[5]||(B[5]=Fi(" Remove ",-1))])):ut("",!0),Me("button",{class:en(["sd-submit-btn",{"disable-btn":k.value}]),onClick:T,"data-item":"btn-link-apply"}," Apply ",2)]))])):u.value?(me(),ke("div",SL,[Me("a",{onClick:B[3]||(B[3]=Jt(z=>M(l.value),["stop","prevent"]))},"Go to "+Nt(l.value.startsWith("#_")?l.value.substring(2):l.value),1)])):ut("",!0)],2))}},uS=fn(kL,[["__scopeId","data-v-3e4bd44e"]]);function AL(e){let t=e;for(;t;){const n=window.getComputedStyle(t).overflowY;if(/(auto|scroll)/.test(n)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return document.scrollingElement||document.documentElement}function $d(e,t={behavior:"smooth",block:"start"}){if(!e)return;const n=AL(e),r=n.getBoundingClientRect(),o=e.getBoundingClientRect().top-r.top+n.scrollTop,i=window.getComputedStyle(n).scrollPaddingTop?.trim(),s=i?.endsWith("px")?Number(i.slice(0,-2)):0,a=Number.isFinite(s)&&s>=0?s:0;n.scrollTo({top:t.block==="start"?o-a:o-n.clientHeight+e.offsetHeight,behavior:t.behavior})}It();var IL="link-popover",EL=500,xL=e=>!!(e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"),TL=e=>!!(e&&typeof e=="object"&&!Array.isArray(e));function RL(e){return TL(e)?e.type==="default"||e.type==="none"?!0:e.type==="custom"?e.component!=null:e.type==="external"?typeof e.render=="function":!1:!1}function dS(e){return e instanceof Error?e:new Error(String(e))}function ML(e){return typeof e!="string"?"":e.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(t=>t==="noopener"||t==="noreferrer").filter((t,n,r)=>r.indexOf(t)===n).join(",")}function LL(e,t){const n=ML(e);if(t!=="_blank")return n;const r=n?n.split(","):[];return r.includes("noopener")||r.unshift("noopener"),r.join(",")}function fS(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):String(e).replace(/['"\\]/g,"\\$&")}function DL(e){const t=e?.dataset?.sourceAnchor;if(typeof t!="string")return null;try{const n=JSON.parse(t)?.sourceRef?.xpathLikePath,r=typeof n=="string"?n.match(/w:p\[ordinal=(\d+)\]/):null;return r?Number(r[1]):null}catch{return null}}function PL(e,t){const n=DL(e),r=t?.blocks?.list?.()?.blocks,o=Array.isArray(r)?r.find(i=>i.ordinal===n):null;return typeof o?.nodeId=="string"?o.nodeId:e?.dataset?.blockId}function hS(e,t){const n=e?.closest?.("[data-block-id][data-pm-start]"),r=PL(n,t);if(!r||!n||!e?.ownerDocument)return null;const o=Number(e?.dataset?.pmStart),i=Number(e?.dataset?.pmEnd);if(Number.isFinite(o)&&Number.isFinite(i)&&i>o){const m=Number(n?.dataset?.pmStart),p=Number.isFinite(m)&&o>=m,g=p?o-m:o,k=p?i-m:i;return g<0||k<=g?null:{kind:"selection",start:{kind:"text",blockId:r,offset:g},end:{kind:"text",blockId:r,offset:k}}}const s=e.ownerDocument.defaultView,a=s?.NodeFilter,l=s?.Node;if(!a||!l)return null;let u=0;const c=e.ownerDocument.createTreeWalker(n,a.SHOW_ELEMENT|a.SHOW_TEXT);let d=c.nextNode();for(;d&&d!==e;)d.nodeType===l.TEXT_NODE&&!e.contains(d)&&(u+=d.textContent?.length??0),d=c.nextNode();if(d!==e)return null;const h=u+(e.textContent?.length??0);return h<=u?null:{kind:"selection",start:{kind:"text",blockId:r,offset:u},end:{kind:"text",blockId:r,offset:h}}}function Qy(e){if(typeof e!="string")return"";try{return new URL(e,window.location.href).href}catch{return e}}function Zy(e){return typeof e?.externalTarget=="string"&&e.externalTarget?e.externalTarget:typeof e?.anchor=="string"&&e.anchor?`#${e.anchor}`:""}function pS(e){const t=e?.anchor?.start,n=e?.anchor?.end;return typeof t?.blockId!="string"||typeof t?.offset!="number"||typeof n?.blockId!="string"||typeof n?.offset!="number"||t.blockId!==n.blockId?null:{kind:"selection",start:{kind:"text",blockId:t.blockId,offset:t.offset},end:{kind:"text",blockId:n.blockId,offset:n.offset}}}function OL(e,t){const n=pS(t);return n?n.start.blockId===e?.start?.blockId&&n.start.offset===e?.start?.offset&&n.end.blockId===e?.end?.blockId&&n.end.offset===e?.end?.offset:!1}function FL(e,t,n){if(typeof t!="string"||!t)return null;const r=e?.query?.match?.({select:{type:"text",pattern:t,caseSensitive:!0},require:"any"}),o=(Array.isArray(r?.items)?r.items:[]).map(s=>s?.target).filter(s=>s?.kind==="selection"&&!!s?.start?.blockId&&!!s?.end?.blockId),i=typeof n=="string"?o.filter(s=>s.start.blockId===n&&s.end.blockId===n):o;return i.length===1?i[0]:typeof n=="string"?null:o.length===1?o[0]:null}function BL(e){return!!(e&&typeof e.closest=="function"&&e.closest(".superdoc-toc-entry"))}function NL({getSurfaceManager:e,getActiveEditor:t,getUi:n,getResolver:r,getLayerElement:o,emitException:i}){let s=null,a=null,l=0;function u(){l+=1}function c(N,I){if(!N||!s||s.handle!==N)return;const L=s;L.unbindPointerDown?.();const Y=L.element.ownerDocument?.defaultView?.Node,te=Y!=null&&L.pointerDownTarget instanceof Y&&L.element.contains(L.pointerDownTarget);I?.status==="closed"&&I.reason===void 0&&te&&(a={href:L.href,element:L.element,closedAt:Date.now()}),s=null}function d(N="closed"){u();const I=s;s=null,a=null,I?.unbindPointerDown?.(),I?.handle?.close?.(N)}function h(N){return{id:IL,mode:"floating",closeOnEscape:!0,floating:{top:N.position.top,left:N.position.left,autoFocus:!0,closeOnOutsidePointerDown:!0,width:"auto"}}}function m(N,I){const L={href:N.href,element:N.element,handle:I,pointerDownTarget:null,unbindPointerDown:null},Y=N.element.ownerDocument,te=le=>{L.pointerDownTarget=le.target??null};Y.addEventListener("pointerdown",te,!0),L.unbindPointerDown=()=>Y.removeEventListener("pointerdown",te,!0),s=L,a=null,I.result?.then?.(le=>c(I,le),()=>c(I))}function p(N,I){return N?.querySelector?.(`a[name='${I}'], [data-bookmark-marker='start'][data-bookmark-name='${I}']`)??null}function g(N,I){if(!N)return null;const L=fS(I);return N.querySelector(`[data-source-node-id='${L}']`)??N.querySelector(`[data-layout-paraid='${L}']`)??N.querySelector(`[data-block-id$='/${L}']`)??N.querySelector(`[data-layout-block-ref$='/${L}']`)??null}function k(N,I=30){return new Promise(L=>{const Y=typeof window<"u"?window.requestAnimationFrame:null;let te=0;const le=()=>{const fe=N();if(fe||te>=I||typeof Y!="function"){L(fe??null);return}te+=1,Y(le)};le()})}async function w(N){const I=t()?.authoring?.setSelectionTarget;if(typeof I!="function")return;const L={kind:"story",storyType:"body"},Y={kind:"text",blockId:N,offset:0,story:L},te={kind:"selection",start:Y,end:Y,story:L};try{await Promise.resolve(I({target:te,collapse:"start",focus:!0}))}catch{}}async function S(N,{placeCaret:I=!1}={}){if(typeof N!="string"||!N.startsWith("#"))return;const L=N.slice(1),Y=fS(L),te=p(n()?.viewport?.getHost?.()??null,Y);if(te){$d(te);return}const le=t()?.doc;let fe=null;try{fe=await Promise.resolve(le?.bookmarks?.get?.({target:{kind:"entity",entityType:"bookmark",name:L}})),fe??=null}catch{fe=null}const Ne=fe?.address?.story;if(Ne&&Ne.storyType!=="body")return;const he=fe?.range?.from?.blockId;if(typeof he!="string")return;I&&await w(he);const ge=g(n()?.viewport?.getHost?.()??null,he);if(ge){$d(ge);return}const ae=t()?.pageMetrics,_e=ae?.revealBodyTarget;let oe;try{oe=await _e?.({paraId:he})}catch{oe=void 0}if(oe?.status==="revealed"){const be=g(n()?.viewport?.getHost?.()??null,he);be&&$d(be);return}if(_e&&oe?.reason!=="editing-not-mounted")return;const Te=ae?.pageIndexForBodyTarget,Ge=ae?.scrollToPage,Je=Te?.({paraId:he});if(typeof Je!="number"||!Ge?.(Je))return;const _t=await k(()=>g(n()?.viewport?.getHost?.()??null,he));_t&&$d(_t)}async function y(N){const I=N.editor?.doc;let L;try{L=await Promise.resolve(I?.hyperlinks?.list?.())}catch{return null}const Y=Array.isArray(L?.stories)?L.stories:[],te=N.element?.dataset?.linkRid,le=N.element?.textContent??"",fe=Qy(N.href),Ne=hS(N.element,I);for(const he of Y){const ge=Array.isArray(he?.hyperlinks)?he.hyperlinks:[],ae=async F=>{if(!F?.hyperlinkNodeId||!he?.storyId||F.address)return F;try{const j=await Promise.resolve(I?.hyperlinks?.get?.({storyId:he.storyId,hyperlinkNodeId:F.hyperlinkNodeId}));return j?.success&&j.hyperlink?j.hyperlink:F}catch{return F}},_e=async F=>{if(!Ne)return null;const j=(await Promise.all(F.map(ae))).filter(V=>OL(Ne,V.address));return j.length===1?j[0]:null},oe=te?ge.filter(F=>F.rId===te):[],Te=oe.filter(F=>F.text===le),Ge=ge.filter(F=>Qy(Zy(F))===fe&&F.text===le),Je=ge.filter(F=>F.text===le),_t=ge.filter(F=>{const j=Qy(Zy(F));return le&&j===fe&&F.text?.includes?.(le)}),be=Te.length===1?Te[0]:null,Ve=Ge.length===1?Ge[0]:null,Le=Je.length===1?Je[0]:null,J=_t.length===1?_t[0]:null,_=oe.length===1?oe[0]:null,$=be??await _e(Te)??Ve??await _e(Ge)??Le??await _e(Je)??J??await _e(_t)??_??await _e(oe);if($?.hyperlinkNodeId&&he?.storyId){const F=await ae($),j=pS(F.address);return{storyId:he.storyId,hyperlinkNodeId:F.hyperlinkNodeId,href:Zy(F),text:F.text,targetKind:F.targetKind,textTarget:j??FL(I,F.text,Ne?.start?.blockId)}}}return null}function C(N){if(!a)return!1;const I=a.element===N.element&&a.href===N.href,L=Date.now()-a.closedAt<=EL;return!I||!L?!1:(a=null,!0)}function T(N,I){const L=e();if(!L?.open)return;const Y=l;queueMicrotask(()=>{Y===l&&m(N,L.open(I))})}function R(N){if(d("replace"),N.isAnchorLink&&BL(N.element)){S(N.href,{placeCaret:N.documentMode!=="viewing"});return}if(N.documentMode==="viewing"){if(N.isAnchorLink)S(N.href);else if(N.href){const le=N.target||"_self",fe=LL(N.rel,le);fe?window.open(N.href,le,fe):window.open(N.href,le)}return}const I=()=>d("closed"),L=le=>{I(),S(le,{placeCaret:!0})},Y=l,te=le=>{Y===l&&T(N,{...h(N),component:Gr(uS),props:{href:le?.href||N.href,target:N.target,rel:N.rel,tooltip:N.tooltip,clickedElement:N.element,hyperlinkTarget:le,hyperlinkText:le?.text,textTarget:le?.textTarget??hS(N.element,N.editor?.doc),documentMode:N.documentMode,ui:n(),closePopover:I,goToAnchor:L}})};y(N).then(te,()=>te(null))}function M(N,I){d("replace");const L=()=>d("closed");T(N,{...h(N),component:Gr(I.component),props:{...I.props,editor:N.editor,href:N.href,closePopover:L}})}function H(N,I){d("replace");const L=I.render;T(N,{...h(N),render:Y=>{try{return L({container:Y.container,closePopover:()=>Y.close("closed"),editor:N.editor,href:N.href})}catch(te){i({error:dS(te),source:"linkPopoverExternalRender"}),Y.close("external-error");const le=l;queueMicrotask(()=>{le===l&&R(N)});return}}})}function B(N){const I=o()?.getBoundingClientRect?.(),L=typeof I?.left=="number"?I.left:0,Y=typeof I?.top=="number"?I.top:0;return{editor:t(),href:N.href,target:N.target,rel:N.rel,tooltip:N.tooltip,element:N.element,clientX:N.clientX,clientY:N.clientY,isAnchorLink:N.href.startsWith("#"),documentMode:N.documentMode,position:{left:`${Math.max(0,N.clientX-L)}px`,top:`${Math.max(0,N.clientY-Y)}px`},closePopover:()=>d("closed")}}function z(N){const I=r();if(typeof I!="function")return{type:"default"};try{const L=I(N);return xL(L)?(i({error:new Error("modules.links.popoverResolver must return synchronously."),source:"linkPopoverResolver"}),{type:"default"}):L==null?{type:"default"}:RL(L)?L:(i({error:new Error("modules.links.popoverResolver returned an invalid resolution."),source:"linkPopoverResolver"}),{type:"default"})}catch(L){return i({error:dS(L),source:"linkPopoverResolver"}),{type:"default"}}}function X(N){if(!N?.element||typeof N.href!="string")return;if(u(),s&&s.element===N.element&&s.href===N.href){d("toggle");return}if(C(N))return;const I=B(N),L=z(I);if(L.type==="none"){d("none");return}if(L.type==="custom"){M(I,L);return}if(L.type==="external"){H(I,L);return}R(I)}function P(){d("destroyed")}return{handleLinkClick:X,closeCurrentPopover:d,destroy:P}}var zL=Object.freeze({editorVersion:2,commands:null,state:null,view:null}),HL=["text.insert","text.replace","text.deleteBackward","text.deleteForward","text.paste","history.undo","history.redo","structural.splitBlock","structural.indent","structural.outdent"],mS=["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit","trackedChanges.accept","trackedChanges.reject","trackedChanges.acceptAll","trackedChanges.rejectAll"],UL=["trackedChanges.setAuthoringMode"];function ef(e){return e.state!=="ready"?e.state:e.documentMode==="viewing"?"review-ready":"editing-ready"}function gp(e){return e==="review-ready"||e==="editing-ready"}function gS(e){switch(e){case"text.insert":return"text.insert";case"text.replace":return"text.replace";case"text.deleteBackward":return"text.deleteBackward";case"text.deleteForward":return"text.deleteForward";case"text.paste":return"text.pastePlain";case"history.undo":return"history.undo";case"history.redo":return"history.redo";case"structural.splitBlock":return"structural.enter";case"structural.indent":return"structural.listIndent";case"structural.outdent":return"structural.listOutdent";default:return null}}function vS(e){switch(e){case"comments.create":return"comments.createFromSelection";case"comments.resolve":return"review.commentResolve";case"comments.reopen":return"review.commentReopen";case"comments.delete":return"review.commentDelete";case"comments.reply":return"review.commentReply";case"comments.edit":return"review.commentEdit";case"trackedChanges.accept":case"trackedChanges.reject":return"review.trackedChangeDecide";case"trackedChanges.acceptAll":return"trackedChanges.acceptAll";case"trackedChanges.rejectAll":return"trackedChanges.rejectAll";default:return null}}function yS(e,t){return e.editableSubset.commands.find(n=>n.command===t)??null}function VL(e){return e?.status==="supported"||e?.enabled===!0}function jL(e){return e?.rejectionCode??e?.reason??null}function GL(e){return e?.detail??void 0}function vp(e,t){return VL(yS(e,t))}function bS(e,t){const n=yS(e,t),r=jL(n);return r?{reason:CS(r),detail:GL(n)}:e.documentMode==="viewing"?{reason:"document-readonly",detail:"review-surface-read-only"}:{reason:"command-unsupported",detail:`unsupported:${t}`}}function wS(e,t){const n=t?.reason;return e==="history.undo"?n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-undo":n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-redo"}function CS(e){switch(e){case"host-saving":return"host-saving";case"document-readonly":return"document-readonly";case"selection-invalidated":case"review-target-invalidated":return"selection-invalidated";case"review-command-unavailable":return"review-command-unavailable";case"review-surface-read-only":return"document-readonly";case"editing-selection-required":return"selection-unsupported";case"format-target-unsupported":case"selection-target-unsupported":case"input-target-unsupported":case"composition-target-unsupported":case"enter-context-unsupported":case"boundary-merge-unsupported":case"tracked-structural-edit-unsupported":case"comment-anchor-create-unsupported":case"comment-anchor-move-unsupported":return"target-unsupported";case"unsupported-command":return"command-unsupported";case"editing-mount-required":case"host-not-ready":case"host-disposed":return"runtime-not-ready";default:return"command-failed"}}function WL(e){const{id:t,documentId:n,root:r,host:o,getLegacyEditorProjection:i,onUnregister:s}=e;let a=o.getSnapshot(),l=!1,u=!1,c=null,d=0,h=0,m=null,p=null,g=null,k=null;const w=new Map,S=new Set;function y(ae){for(const _e of Array.from(S))try{_e(ae)}catch{}}function C(){d+=1,w.clear()}function T(ae){const _e=`v2-runtime-pos-${h++}`;return w.set(_e,ae),{runtimeId:t,tokenId:_e,revision:d}}function R(ae){return ae.runtimeId!==t?{ok:!1,reason:"wrong-runtime-token"}:ae.revision!==d||!w.has(ae.tokenId)?{ok:!1,reason:"stale-position-token"}:{ok:!0}}function M(){return o.getHandles().editing?.selection??null}function H(){const ae=M()?.getSnapshot()??null;return ae?{isRange:ae.anchor!==ae.focus,isEmpty:ae.anchor===ae.focus,text:"",anchor:T(ae.anchor),focus:T(ae.focus)}:null}function B(){const ae=M();ae!==k&&(m?.(),m=null,k=ae,ae&&(m=ae.subscribe(_e=>{C(),y({type:"selection-change",selection:_e?{isRange:_e.anchor!==_e.focus,isEmpty:_e.anchor===_e.focus,text:"",anchor:T(_e.anchor),focus:T(_e.focus)}:{isRange:!1,isEmpty:!0,text:""}})})))}function z(){const ae=o.getDocumentFacade?.()??null;return ae?.available===!0?ae.doc:null}function X(){const ae=z();return!!(ae?.comments&&ae.trackChanges)}function P(ae){if(!gp(ef(ae)))return[];const _e=HL.filter(Te=>{const Ge=gS(Te);return Ge!==null&&vp(ae,Ge)}),oe=X()?mS.filter(Te=>{const Ge=vS(Te);return Ge!==null&&vp(ae,Ge)}):[];return[..._e,...oe,...UL]}function N(ae=a){const _e=ef(ae),oe=_e!=="disposed",Te=P(ae);return{lifecycle:{canFocus:oe,canDispose:!0},selection:{canReadSelectedText:!0,canReadSelectionSnapshot:!0,canMintPositionTokens:!0},commands:{canDispatch:gp(_e)&&Te.length>0,supportedCommands:Te},layout:{supported:!0,hasSyncSnapshot:!0},zoom:{supported:!0,min:25,max:400},navigation:{supported:!1,targets:[]},persistence:{canSave:!0,canExportDocx:!0},comments:{supported:!0,canMutate:ae.commentCommandsReason!=="author-required"&&["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit"].some(Ge=>Te.includes(Ge))},trackedChanges:{supported:!0,canDecide:Te.includes("trackedChanges.accept")||Te.includes("trackedChanges.reject"),canToggleAuthoring:gp(_e)}}}function I(){const ae=o.getPageMetricsSnapshot();return{pageCount:ae.pages.length,currentPage:1,zoom:ae.zoom.percent}}function L(ae=a){return{id:t,kind:"v2",documentId:n,state:ef(ae),documentMode:ae.documentMode,reason:ae.reason,capabilities:N(ae)}}function Y(ae){return ae?.success===!0?(C(),{status:"committed",receipt:ae}):ae&&"failure"in ae?{status:"receipt-failure",failure:ae.failure}:{status:"rejected",reason:"command-failed"}}function te(ae,_e){return _e?_e.noop===!0?{status:"history-noop",reason:wS(ae,_e),result:_e}:(C(),{status:"history-committed",result:_e}):{status:"rejected",reason:"command-failed"}}async function le(ae){const _e=vS(ae.kind);if(_e&&!vp(a,_e)){const Ge=bS(a,_e);return{status:"rejected",reason:Ge.reason,detail:Ge.detail}}const oe=gS(ae.kind);if((ae.kind==="history.undo"||ae.kind==="history.redo")&&oe&&!vp(a,oe)){const Ge=bS(a,oe);return{status:"rejected",reason:Ge.reason,detail:Ge.detail}}const Te=z();if(!Te)return mS.includes(ae.kind)?{status:"rejected",reason:"review-command-unavailable"}:null;try{switch(ae.kind){case"comments.create":{const Ge=await Te.selection?.current?.(),Je=Ge?.empty===!1?Ge.target:void 0;return Y(await Te.comments?.create?.({text:ae.text,...Je?{target:Je}:{}}))}case"comments.resolve":return Y(await Te.comments?.patch?.({commentId:ae.commentId,status:"resolved"}));case"comments.reopen":return Y(await Te.comments?.patch?.({commentId:ae.commentId,status:"active"}));case"comments.delete":return Y(await Te.comments?.delete?.({commentId:ae.commentId}));case"comments.reply":return Y(await Te.comments?.create?.({parentCommentId:ae.parentCommentId,text:ae.text}));case"comments.edit":return Y(await Te.comments?.patch?.({commentId:ae.commentId,text:ae.text}));case"trackedChanges.accept":return Y(await Te.trackChanges?.decide?.({decision:"accept",target:{kind:"id",id:ae.id}}));case"trackedChanges.reject":return Y(await Te.trackChanges?.decide?.({decision:"reject",target:{kind:"id",id:ae.id}}));case"trackedChanges.acceptAll":return Y(await Te.trackChanges?.decide?.({decision:"accept",target:{kind:"all"}}));case"trackedChanges.rejectAll":return Y(await Te.trackChanges?.decide?.({decision:"reject",target:{kind:"all"}}));case"history.undo":return te("history.undo",await Te.history?.undo?.());case"history.redo":return te("history.redo",await Te.history?.redo?.());default:return null}}catch(Ge){return{status:"rejected",reason:"command-failed",detail:Ge instanceof Error?Ge.message:String(Ge)}}}function fe(ae){a=ae,C(),B(),y({type:"state-change",state:ef(ae)}),y({type:"capabilities-change",capabilities:N(ae)}),ae.state==="disposed"&&!l&&(l=!0,p?.(),g?.(),m?.(),m=null,y({type:"disposed"}),S.clear(),u||(u=!0,s?.(t)))}p=o.subscribe(fe),g=o.subscribePageMetrics?.(()=>{y({type:"layout-change",layout:I()})})??null,B();async function Ne(ae){const _e=ef(a);if(_e==="disposed")return{status:"rejected",reason:"runtime-not-ready"};if(_e==="saving")return{status:"rejected",reason:"host-saving"};if(!gp(_e))return{status:"rejected",reason:"runtime-not-ready"};const oe="at"in ae?ae.at:"range"in ae?ae.range:void 0;if(oe){const _t=R(oe);return _t.ok?{status:"rejected",reason:"target-unsupported",detail:"positioned dispatch is deferred until the shared runtime can target host selections explicitly"}:{status:"rejected",reason:_t.reason}}if(ae.kind==="trackedChanges.setAuthoringMode")return o.setDocumentMode(ae.mode==="tracked"?"suggesting":"editing"),C(),{status:"committed"};const Te=await le(ae);if(Te)return Te;let Ge=null;switch(ae.kind){case"text.insert":Ge={kind:"text.insert",text:ae.text};break;case"text.replace":Ge={kind:"text.replace",text:ae.text};break;case"text.deleteBackward":Ge={kind:"text.deleteBackward"};break;case"text.deleteForward":Ge={kind:"text.deleteForward"};break;case"text.paste":Ge={kind:"text.pastePlain",text:ae.text};break;case"history.undo":Ge={kind:"history.undo"};break;case"history.redo":Ge={kind:"history.redo"};break;case"structural.splitBlock":Ge={kind:"structural.enter"};break;case"structural.indent":Ge={kind:"structural.listIndent"};break;case"structural.outdent":Ge={kind:"structural.listOutdent"};break;default:return{status:"rejected",reason:"command-unsupported",detail:ae.kind}}const Je=await o.dispatch(Ge);switch(Je.status){case"committed":return C(),{status:"committed",receipt:Je.receipt};case"history-committed":return C(),{status:"history-committed",result:Je.result};case"history-noop":return{status:"history-noop",reason:wS(ae.kind,Je.result),result:Je.result};case"receipt-failure":return{status:"receipt-failure",failure:Je.failure};case"rejected":return{status:"rejected",reason:CS(Je.rejection.code),detail:Je.rejection.detail}}}async function he(ae){if(l||a.state==="disposed")return!1;const _e=c?.focus;return _e&&typeof _e.focus=="function"?await _e.focus({restoreSelection:ae?.restoreSelection,preventScroll:ae?.preventScroll})!==!1:typeof r.focus=="function"?(r.focus({preventScroll:ae?.preventScroll}),!0):!1}async function ge(){l||(await o.dispose(),l||(l=!0,p?.(),g?.(),m?.(),m=null,y({type:"disposed"}),S.clear(),u||(u=!0,s?.(t))))}return{runtime:{id:t,kind:"v2",documentId:n,root:r,getCapabilities:()=>N(),getSnapshot:()=>L(),setDocumentMode(ae){o.setDocumentMode(ae)},getDocumentMode:()=>o.getDocumentMode(),getLegacyEditorProjection:()=>i?.()??zL,focus:he,dispose:ge,dispatch:Ne,getSelectedText:()=>"",getSelectionSnapshot:H,getToolbarState(){return{activeMarks:[],disabled:["formatting.applyMark","formatting.applyParagraph"]}},getLayoutSnapshot:I,save:()=>o.save(),exportDocx:ae=>o.save({format:"docx",commentExportMode:ae?.commentsType==="clean"?"strip":"preserve"}),async setZoom(ae){const _e=o.setZoom(ae);return _e.status==="ok"?{status:"committed"}:{status:"rejected",reason:_e.reason==="host-disposed"?"runtime-not-ready":"target-unsupported",detail:_e.reason}},async reveal(ae){if(ae.kind==="position"){const _e=R(ae.position);if(!_e.ok)return{status:"rejected",reason:_e.reason}}return{status:"rejected",reason:"capability-unsupported",detail:`${ae.kind} reveal is not exposed through the shared runtime yet`}},subscribe(ae){return S.add(ae),()=>{S.delete(ae)}}},attachMountHandle(ae){c=ae,B()}}}var _S=".superdoc-toolbar";function KL(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]}function qL(e){if(e&&typeof e=="object"){const t=e;return t.target??t.address??t.handle??e}return e}function yp(e){return typeof e=="function"}function SS(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function bp(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function YL(e){return bp(e)&&e.kind==="text"&&Array.isArray(e.segments)&&e.segments.length>0}function XL(e){return bp(e)&&e.kind==="story"&&(e.storyType==="headerFooterSlot"||e.storyType==="headerFooterPart")}function QL(e){if(!yp(e.selection?.current))return{handled:!1,reason:"page-field-selection-unavailable"};let t;try{t=e.selection.current({includeText:!1})}catch{return{handled:!1,reason:"page-field-selection-unavailable"}}return SS(t)?{handled:!1,reason:"page-field-selection-async"}:!bp(t)||!YL(t.target)?{handled:!1,reason:"page-field-selection-unavailable"}:XL(t.target.story)?{handled:!0,target:t.target}:{handled:!1,reason:"page-field-context-unavailable"}}function Jy(e,t){return!yp(e)||!yp(t)?!1:(Promise.resolve().then(()=>e()).then(n=>{for(const r of KL(n))try{Promise.resolve(t({target:qL(r)})).catch(()=>{})}catch{}}).catch(()=>{}),!0)}function ZL(e){return{focusToolbar:()=>{const o=e.resolveToolbarElement();if(!o)return{handled:!1,reason:"no-toolbar"};const i=typeof o.matches=="function"&&o.matches(_S)?o:o.querySelector?.(_S)??o;return i?(i.hasAttribute("tabindex")||i.setAttribute("tabindex","0"),typeof i.focus!="function"?{handled:!1,reason:"no-toolbar"}:(i.focus(),!0)):{handled:!1,reason:"no-toolbar"}},updateFields:()=>{const o=e.getDocumentApi();if(!o)return{handled:!1,reason:"document-api-unavailable"};let i=Jy(o.toc?.list,o.toc?.update);return i=Jy(o.fields?.list,o.fields?.rebuild)||i,i=Jy(o.index?.list,o.index?.rebuild)||i,i?!0:{handled:!1,reason:"field-update-workflow-unavailable"}},insertPageField:o=>{const i=e.getDocumentApi();if(!i)return{handled:!1,reason:"document-api-unavailable"};if(!yp(i.fields?.insert))return{handled:!1,reason:"page-field-insert-unavailable"};const s=QL(i);if(!s.handled||!s.target)return{handled:!1,reason:s.reason??"page-field-context-unavailable"};const a=o==="page"?"PAGE":"NUMPAGES";try{const l=i.fields.insert({at:s.target,instruction:a,mode:"raw"});if(SS(l))l.catch(()=>{});else if(bp(l)&&l.success===!1)return{handled:!1,reason:"page-field-insert-failed"}}catch{return{handled:!1,reason:"page-field-insert-failed"}}return!0}}}const wp="data-superdoc-runtime-id";function JL(e,t){e.setAttribute(wp,t)}function kS(e){e.removeAttribute(wp)}function AS(e){if(typeof e!="string"||e.length===0)return"<none>";try{const t=new URL(e);t.search="",t.hash="",t.username="",t.password="";const n=e.includes("?")?"?<redacted>":"";return`${t.toString().replace(/\?$/,"")}${n}`}catch{const t=e.replace(/\/\/[^/@]+@/,"//"),n=t.search(/[?#]/);return n===-1?t:`${t.slice(0,n)}?<redacted>`}}function Cp(e){return typeof e=="string"&&e.length>0?e:null}function $L(e){if(typeof e!="string"||e.length===0)return null;try{const t=new URL(e);return t.protocol==="ws:"||t.protocol==="wss:"?e:null}catch{return null}}function eD(e,t){if(typeof e!="string")return null;const n=e.trim();if(n.length===0)return null;try{const r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?n:null}catch{if(typeof t!="string"||t.trim().length===0)return null;try{const r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?r.href:null}catch{return null}}}function tD(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function IS(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function ES(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function nD(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function rD(e){if(!e||typeof e!="object")return null;const t=typeof e.providerType=="string"?e.providerType.toLowerCase():"";return t==="hocuspocus"?"hocuspocus":t==="liveblocks"?"liveblocks":t==="superdoc"?"superdoc":e.ydoc!=null||e.provider!=null?"external-ydoc-provider":null}function xS(e,t){const n=Cp(t.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:`SuperDoc v2 collaboration requires a non-empty v2Collaboration.documentId for the "${e}" provider.`};const r=t.url??t.serverUrl,o=$L(r);if(!o)return{ok:!1,reason:"invalid-server-url",message:`SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${e}" provider (received: ${AS(r)}).`};const i=tD(t.params),s=e==="hocuspocus"?Cp(t.token):null,a=IS(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:ES()}function oD(e,t){const n=Cp(e.documentId??e.roomId);if(!n)return{ok:!1,reason:"invalid-document-id",message:'SuperDoc v2 collaboration requires a non-empty v2Collaboration.documentId (or roomId) for the "liveblocks" provider.'};const r=Cp(e.publicApiKey),o=IS(e.roomMode);if(!o)return ES();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=eD(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function TS(e){const{v2Collaboration:t,legacyCollaboration:n,documentType:r,documentCount:o,authEndpointBaseUrl:i}=e;if(typeof o=="number"&&o>1)return{ok:!1,reason:"unsupported-multi-document",message:`SuperDoc v2 collaboration supports exactly one document per room; received ${o}.`};if(r!=null&&r!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return{ok:!1,reason:"unsupported-document-type",message:"SuperDoc v2 collaboration supports DOCX documents only."};if(!(t!=null&&typeof t=="object")){const l=rD(n);if(l){const u=l==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",c=AS(n?.url);return{ok:!1,reason:u,message:l==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a v2Collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${l}" through the legacy modules.collaboration block (server: ${c}). Configure it as a v2Collaboration target ({ providerType: "${l}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a v2Collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=t;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a v2Collaboration target ({ providerType, documentId, url | publicApiKey | authEndpoint }) instead."};const a=nD(s);return a===null||a==="y-websocket"?xS("y-websocket",s):a==="hocuspocus"?xS("hocuspocus",s):a==="liveblocks"?oD(s,i):{ok:!1,reason:"unsupported-provider-family",message:`SuperDoc v2 collaboration does not support the "${a}" provider family. Supported families are y-websocket, hocuspocus, and liveblocks.`}}It(),mn();var iD={__name:"SurfaceExternalMount",props:{surfaceId:{type:String,required:!0},mode:{type:String,required:!0},request:{type:Object,required:!0},render:{type:Function,required:!0},resolve:{type:Function,required:!0},close:{type:Function,required:!0}},setup(e){const t=e,n=ne(null);let r=null;function o(){i(),!(!n.value||!t.render)&&(r=t.render({container:n.value,surfaceId:t.surfaceId,mode:t.mode,request:t.request,resolve:t.resolve,close:t.close})?.destroy??null)}function i(){typeof r=="function"&&r(),r=null,n.value&&(n.value.innerHTML="")}return Rn(o),rr(i),Pt(()=>t.surfaceId,()=>{o()}),(s,a)=>(me(),ke("div",{ref_key:"container",ref:n,class:"sd-surface-external-mount"},null,512))}},RS=fn(iD,[["__scopeId","data-v-b2412c5d"]]);const $y=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");It(),mn();var sD=["aria-labelledby","aria-label"],aD=["id"],lD={class:"sd-surface-dialog__content"},cD={__name:"SurfaceDialog",props:{surface:{type:Object,required:!0},scrollLockTarget:{type:Object,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,o=ne(null),i=Ae(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=Ae(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=Ae(()=>s.value?void 0:n.surface.request.ariaLabel);let l=null;function u(T){if(!o.value)return;const R=o.value.querySelectorAll($y);if(R.length===0)return;const M=R[0],H=R[R.length-1];T.shiftKey&&document.activeElement===M?(T.preventDefault(),H.focus()):!T.shiftKey&&document.activeElement===H&&(T.preventDefault(),M.focus())}function c(){if(!o.value)return;const T=o.value.querySelector($y);T?T.focus():o.value.focus()}let d=null,h="";function m(){if(n.scrollLockTarget)d=n.scrollLockTarget;else{const T=o.value?.closest(".superdoc");d=T?.querySelector(".superdoc__layers")??T}d&&(h=d.style.overflow,d.style.overflow="hidden")}function p(){d&&(d.style.overflow=h,d=null,h="")}function g(T){if(T.key==="Tab"){u(T);return}T.key==="Escape"&&n.surface.request.closeOnEscape!==!1&&(T.stopPropagation(),r("close"))}function k(T){T.target===T.currentTarget&&n.surface.request.closeOnBackdrop!==!1&&r("close")}const w=Ae(()=>({surfaceId:n.surface.id,mode:"dialog",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),S=Ae(()=>({...n.surface.props??{},...w.value})),y=Ae(()=>{const T=n.surface.request.dialog?.maxWidth;if(T!=null)return typeof T=="number"?`${T}px`:T}),C=Ae(()=>{const T={};return y.value&&(T["max-width"]=y.value),T});return Rn(async()=>{l=document.activeElement,m(),await St(),c()}),Pt(()=>n.scrollLockTarget,(T,R)=>{T!==R&&(p(),m())}),rr(()=>{p(),l&&typeof l.focus=="function"&&l.focus(),l=null}),(T,R)=>(me(),ke("div",{class:"sd-surface-dialog-backdrop",onMousedown:Jt(k,["self"]),onKeydown:g},[Me("div",{ref_key:"dialogRef",ref:o,class:"sd-surface-dialog",style:gn(C.value),role:"dialog","aria-modal":"true","aria-labelledby":s.value,"aria-label":a.value,tabindex:"-1"},[e.surface.request.title?(me(),ke("div",{key:0,id:i.value,class:"sd-surface-dialog__title"},Nt(e.surface.request.title),9,aD)):ut("",!0),Me("div",lD,[e.surface.render?(me(),dn(RS,{key:0,"surface-id":e.surface.id,mode:"dialog",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(me(),dn(mg(e.surface.component),Lm(rs({key:1},S.value)),null,16)):ut("",!0)])],12,sD)],32))}},uD=fn(cD,[["__scopeId","data-v-20bf8e4b"]]);It(),mn();var dD=["aria-labelledby","aria-label"],fD=["id"],hD={class:"sd-surface-floating__content"},pD={__name:"SurfaceFloating",props:{surface:{type:Object,required:!0}},setup(e,{expose:t}){const n=e,r=ne(null);t({rootEl:r});const o=ne({}),i=Ae(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=Ae(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=Ae(()=>s.value?void 0:n.surface.request.ariaLabel),l=Ae(()=>n.surface.request.floating??{}),u=Ae(()=>{const y=l.value;return y.top!=null||y.right!=null||y.bottom!=null||y.left!=null}),c=Ae(()=>{const y=["sd-surface-floating"];if(!u.value){const C=l.value.placement??"top-right";y.push(`sd-surface-floating--${C}`)}return y});function d(y){if(y!=null)return typeof y=="number"?`${y}px`:y}const h=Ae(()=>{const y=l.value,C={};return y.top!=null&&(C.top=d(y.top)),y.right!=null&&(C.right=d(y.right)),y.bottom!=null&&(C.bottom=d(y.bottom)),y.left!=null&&(C.left=d(y.left)),y.width!=null&&(C.width=d(y.width)),y.maxWidth!=null&&(C["max-width"]=d(y.maxWidth)),y.maxHeight!=null&&(C["max-height"]=d(y.maxHeight)),{...C,...o.value}});async function m(){if(o.value={},!u.value)return;await St(),await new Promise(z=>requestAnimationFrame(z));const y=r.value,C=y?.parentElement;if(!y||!C)return;const T=8,R=y.getBoundingClientRect(),M=C.getBoundingClientRect(),H={},B=l.value;if(B.left!=null&&B.right==null){const z=R.left-M.left,X=Math.max(T,M.width-R.width-T),P=Math.min(Math.max(z,T),X);P!==z&&(H.left=`${P}px`)}if(B.top!=null&&B.bottom==null){const z=R.top-M.top,X=Math.max(T,M.height-R.height-T),P=Math.min(Math.max(z,T),X);P!==z&&(H.top=`${P}px`)}o.value=H}Pt(l,m,{deep:!0});const p=Ae(()=>({surfaceId:n.surface.id,mode:"floating",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),g=Ae(()=>({...n.surface.props??{},...p.value}));let k=null,w=!1,S=null;return Rn(async()=>{if(m(),window.addEventListener("resize",m),typeof ResizeObserver<"u"&&r.value?.parentElement&&(S=new ResizeObserver(m),S.observe(r.value.parentElement),S.observe(r.value)),l.value.autoFocus===!1||(await St(),!r.value))return;const y=r.value.querySelector("[data-sd-autofocus]")??r.value.querySelector($y);y&&(k=document.activeElement,y.focus(),w=!0)}),rr(()=>{window.removeEventListener("resize",m),S?.disconnect(),S=null,w&&k&&typeof k.focus=="function"&&k.focus(),k=null,w=!1}),(y,C)=>(me(),ke("div",{ref_key:"floatingRef",ref:r,class:en(c.value),style:gn(h.value),role:"dialog","aria-labelledby":s.value,"aria-label":a.value,"data-editor-ui-surface":""},[e.surface.request.title?(me(),ke("div",{key:0,id:i.value,class:"sd-surface-floating__title"},Nt(e.surface.request.title),9,fD)):ut("",!0),Me("div",hD,[e.surface.render?(me(),dn(RS,{key:0,"surface-id":e.surface.id,mode:"floating",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(me(),dn(mg(e.surface.component),Lm(rs({key:1},g.value)),null,16)):ut("",!0)])],14,dD))}},mD=fn(pD,[["__scopeId","data-v-cd2be5db"]]);It(),mn();var gD={__name:"SurfaceHost",props:{geometryTarget:{type:Object,default:null}},setup(e){const t=e,n=Ea("surfaceManager",null),r=Ae(()=>n?.activeDialog.value??null),o=Ae(()=>n?.activeFloating.value??null),i=Ae(()=>r.value!=null||o.value!=null),s=ne(null),a=ne(null),l=ne({}),u=new Set(["hidden","scroll","auto","clip"]);function c(N){const I=[];let L=N.parentElement;for(;L;){const Y=getComputedStyle(L);(u.has(Y.overflowX)||u.has(Y.overflowY))&&I.push(L),L=L.parentElement}return I}function d(N,I){let L=0,Y=0,te=window.innerWidth,le=window.innerHeight;for(const Ne of I){const he=Ne.getBoundingClientRect(),ge=getComputedStyle(Ne);u.has(ge.overflowX)&&(Y=Math.max(Y,he.left),te=Math.min(te,he.right)),u.has(ge.overflowY)&&(L=Math.max(L,he.top),le=Math.min(le,he.bottom))}const fe=N.getBoundingClientRect();return L=Math.max(L,fe.top),Y=Math.max(Y,fe.left),te=Math.min(te,fe.right),le=Math.min(le,fe.bottom),{top:L,left:Y,width:Math.max(te-Y,0),height:Math.max(le-L,0)}}let h=null,m=[],p=0,g=null;function k(){if(!h)return;const{top:N,left:I,width:L,height:Y}=d(h,m);l.value={position:"fixed",top:`${N}px`,left:`${I}px`,width:`${L}px`,height:`${Y}px`}}function w(){p||(p=requestAnimationFrame(()=>{p=0,k()}))}function S(){if(h=t.geometryTarget??null,!!h){m=c(h),k(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),g=new ResizeObserver(w),g.observe(h);for(const N of m)g.observe(N)}}function y(){p&&(cancelAnimationFrame(p),p=0),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w),g&&(g.disconnect(),g=null),h=null,m=[]}Pt(i,N=>{N?S():y()}),Pt(()=>t.geometryTarget,N=>{N&&i.value&&!h&&S()}),Rn(()=>{i.value&&S()});function C(N){const I=o.value;!I||I.settled||r.value||N.key==="Escape"&&I.request.closeOnEscape!==!1&&(N.stopPropagation(),n.close(I.id))}let T=!1;function R(){T||(document.addEventListener("keydown",C,!0),T=!0)}function M(){T&&(document.removeEventListener("keydown",C,!0),T=!1)}function H(N){const I=o.value;if(!I||I.settled||r.value)return;const L=a.value?.rootEl;L&&!L.contains(N.target)&&n.close(I.id)}let B=!1;function z(){B||(document.addEventListener("pointerdown",H,!0),B=!0)}function X(){B&&(document.removeEventListener("pointerdown",H,!0),B=!1)}Pt(o,N=>{N&&!N.settled?(R(),N.request.floating?.closeOnOutsidePointerDown?z():X()):(M(),X())},{immediate:!0}),rr(()=>{y(),M(),X()});function P(){const N=r.value;N&&!N.settled&&n.close(N.id)}return(N,I)=>(me(),dn(Ra,{to:"body"},[i.value?(me(),ke("div",{key:0,ref_key:"hostRef",ref:s,class:"sd-surface-host",style:gn(l.value)},[o.value?(me(),dn(mD,{key:o.value.id,surface:o.value,ref_key:"floatingRef",ref:a},null,8,["surface"])):ut("",!0),r.value?(me(),dn(uD,{key:r.value.id,surface:r.value,"scroll-lock-target":We(h),onClose:P},null,8,["surface","scroll-lock-target"])):ut("",!0)],4)):ut("",!0)]))}},vD=fn(gD,[["__scopeId","data-v-c6a3b75f"]]),e0,yD=_r((()=>{e0=(e,t)=>{const n=10**(t||0);return Math.floor(e*n)/n}})),MS,bD=_r((()=>{MS=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=o=>t(o.target.result),r.onerror=n,r.readAsDataURL(e)})})),LS,wD=_r((()=>{LS=(e,t)=>{const n=t-e;return Array.from({length:n},(r,o)=>e+o)}}));function CD(e){return`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${e}/pdf.worker.min.mjs`}var DS,PS,OS,FS,_D=_r((()=>{wD(),DS=e=>({adapter:"pdfjs",...e}),PS=class zA{constructor(){if(Object.getPrototypeOf(this).constructor===zA)throw new Error("Abstract class should not be instantiated")}},OS=class extends PS{constructor(e){super(),this.pdfLib=e.pdfLib,this.workerSrc=e.workerSrc,e.setWorker&&(this.workerSrc?this.pdfLib.GlobalWorkerOptions.workerSrc=e.workerSrc:this.pdfLib.GlobalWorkerOptions.workerSrc=CD(this.pdfLib.version))}async getDocument(e){return await this.pdfLib.getDocument(e).promise}async getPages(e,t,n){const r=LS(t,n+1).map(o=>e.getPage(o));return await Promise.all(r)}},FS=class{static create(e){const t={pdfjs:()=>new OS(e),default:()=>{throw new Error("Unsupported adapter")}};return(t[e.adapter]??t.default)()}}})),SD=_r((()=>{})),kD=_r((()=>{})),BS,NS,zS,HS,AD=_r((()=>{It(),Gy(),SD(),kD(),mn(),BS=["data-page-id","data-page-number"],NS={class:"sd-pdf-viewer-page__canvas-wrapper"},zS={__name:"PdfViewerPage",props:{config:{type:Object,required:!0},page:{type:Object,required:!0},pages:{type:Array,required:!0},scale:{type:Number,required:!0},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number,default:2},documentEl:{type:[Object],default:null}},emits:["page-rendered","page-error","text-layer-rendered","text-layer-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=e,o=Wr(null),i=ne(null),s=ne(null),a=ne(null);let l;const u=Ae(()=>r.pages.findIndex(z=>z.pageId===r.page.pageId)),c=Ae(()=>u.value===-1?0:u.value+1);function d(z){const X=window.getSelection();if(!X||X.rangeCount===0)return null;const P=X.getRangeAt(0).getClientRects();if(!P.length)return null;const N=z.getBoundingClientRect(),I=r.scale??1,L=P[0];let Y={top:L.top,left:L.left,bottom:L.bottom,right:L.right};for(let te=1;te<P.length;te+=1){const le=P[te];le.width===0||le.height===0||(Y.top=Math.min(Y.top,le.top),Y.left=Math.min(Y.left,le.left),Y.bottom=Math.max(Y.bottom,le.bottom),Y.right=Math.max(Y.right,le.right))}return{top:(Y.top-N.top)/I+z.scrollTop,left:(Y.left-N.left)/I+z.scrollLeft,bottom:(Y.bottom-N.top)/I+z.scrollTop,right:(Y.right-N.left)/I+z.scrollLeft}}const h=Ae(()=>{let{width:z,height:X}=o.value;return[z,X]=[z,X].map(P=>Math.ceil(P)),{width:z,height:X}}),m=Ae(()=>{const{width:z,height:X}=h.value;return{width:z,height:X}}),p=Ae(()=>{const{width:z,height:X}=w();return{"--scale-factor":`${y()}`,width:`calc(var(--scale-factor) * ${z}px)`,height:`calc(var(--scale-factor) * ${X}px)`}});function g(){const z=window.getSelection();if(!z||z.toString().length===0)return;const X=d(r.documentEl?.value??r.documentEl??i.value);X&&n("selection-raw",{selectionBounds:X,documentId:r.page.documentId,page:c.value,source:"pdf"})}function k(z){z?.target&&z.target.tagName!=="SPAN"&&n("bypass-selection",z)}function w(){const z=Va*r.outputScale;let{width:X,height:P}=o.value;return X=X/z,P=P/z,[X,P]=[X,P].map(N=>Math.ceil(N)),{width:X,height:P}}function S(){const{width:z,height:X}=w(),P=y();return{width:z*P,height:X*P}}function y(){return(r.scale??1)*Va}function C(){const{pdfjsPage:z}=r.page;o.value=z.getViewport({scale:Va*r.outputScale})}async function T(){if(l)return;const z=s.value;if(!z||!o.value)return;const X={canvasContext:z.getContext("2d"),viewport:o.value};try{const{pdfjsPage:P}=r.page;l=P.render(X),await l.promise;const N=S(),I=w();n("page-rendered",{page:r.page,documentId:r.page.documentId,pageIndex:u.value,pageNumber:c.value,width:N.width,height:N.height,originalWidth:I.width*Va,originalHeight:I.height*Va})}catch{B(),n("page-error",r.page)}}async function R(){if(!r.hasTextLayer)return;const z=a.value;if(!z)return;z.innerHTML="";const X=r.config?.pdfLib?.TextLayer;if(X)try{const P=(r.scale??1)*Va,N=r.page.pdfjsPage.getViewport({scale:P});await new X({textContentSource:await r.page.pdfjsPage.getTextContent(),container:z,viewport:N}).render(),n("text-layer-rendered",r.page)}catch(P){n("text-layer-error",r.page),console.error(P)}}async function M(){await T(),await R()}function H(z){z?.pdfjsPage&&z.pdfjsPage.cleanup(),B()}function B(){l&&(l.cancel(),l=null)}return Pt(()=>r.scale,()=>{R()}),C(),Rn(()=>{M()}),rr(()=>{H(r.page)}),(z,X)=>(me(),ke("div",{class:"sd-pdf-viewer-page","data-page-id":e.page.pageId,"data-page-number":c.value,style:gn(p.value),"data-pdf-page":"",ref_key:"pageRef",ref:i,onMousedown:k,onMouseup:g},[Me("div",NS,[Me("canvas",rs({class:"sd-pdf-viewer-page__canvas"},m.value,{ref_key:"canvasRef",ref:s}),null,16)]),e.hasTextLayer?(me(),ke("div",{key:0,class:"sd-pdf-viewer-page__text-layer",ref_key:"textLayerRef",ref:a},null,512)):ut("",!0)],44,BS))}},HS=fn(zS,[["__scopeId","data-v-d7a9857d"]])})),ID=_r((()=>{})),US,VS,ED=_r((()=>{It(),AD(),ID(),mn(),US={__name:"PdfViewerDocument",props:{config:{type:Object,required:!0},pdf:{type:Object},pages:{type:Array,required:!0},scale:{type:Number},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number}},emits:["page-focus","page-rendered","page-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=ne(null),o=ne(null);function i(u){n("page-rendered",u)}function s(u){n("page-error",u)}function a(u){n("selection-raw",u)}function l(u){n("bypass-selection",u)}return(u,c)=>(me(),ke("div",{class:"sd-pdf-viewer-document",ref_key:"documentRef",ref:r},[Me("div",{class:"sd-pdf-viewer-document__wrapper",ref_key:"documentWrapper",ref:o},[(me(!0),ke(qt,null,nr(e.pages,d=>(me(),dn(HS,rs({key:d.pageId},{ref_for:!0},{page:d,pages:e.pages,scale:e.scale,config:e.config,hasTextLayer:e.hasTextLayer,outputScale:e.outputScale,documentEl:r.value},{onPageRendered:i,onPageError:s,onSelectionRaw:a,onBypassSelection:l}),null,16))),128))],512)],512))}},VS=fn(US,[["__scopeId","data-v-2152178b"]])})),xD=_r((()=>{})),TD=Vu({default:()=>WS},1),jS,GS,WS,RD=_r((()=>{It(),yD(),bD(),Gy(),_D(),ED(),xD(),mn(),jS={class:"sd-pdf-viewer__main"},GS={__name:"PdfViewer",props:{config:{type:Object,required:!0},file:{type:Object,required:!0},fileId:{type:String},initialScale:{type:Number,default:1}},emits:["page-rendered","pages-loaded","document-loaded","document-ready","document-error","selection-raw","bypass-selection"],setup(e,{expose:t,emit:n}){const r=n,o=e,i=DS({pdfLib:Gr(o.config.pdfLib),workerSrc:o.config.workerSrc,setWorker:o.config.setWorker}),s=FS.create(i),a=ne(null),l=ne(null),u=ne(null),c=ne([]),d=ne(typeof o.initialScale=="number"&&Number.isFinite(o.initialScale)&&o.initialScale>0?e0(o.initialScale,2):1),h=ne(0),m=ne(0),p=Ae(()=>o.config?.textLayer===!0),g=Ae(()=>o.config?.outputScale??2);function k(X){const P=X?.page;P&&(P.pageIsRendered=!0),y(),r("page-rendered",X)}function w(X){r("selection-raw",X)}function S(X){r("bypass-selection",X)}function y(){h.value<=0||(m.value+=1,m.value>=h.value&&r("document-ready",{documentId:u.value?.documentId,viewerContainer:a.value}))}function C(X){c.value=X,h.value=X.length,m.value=0}function T(X){d.value=e0(X,2)}t({updateScale:T});async function R(X){if(X)try{const P=await MS(X);u.value={documentId:o.fileId||B("document"),pdfjsDocument:Gr(await s.getDocument(P))},r("document-loaded",X)}catch(P){r("document-error",P),console.error(P)}}async function M(){if(!u.value)return;const{pdfjsDocument:X}=u.value,P=1,N=X.numPages;try{const I=await s.getPages(X,P,N),L=te=>({documentId:u.value.documentId,pageId:z(u.value.documentId,te.pageNumber),pageNumber:te.pageNumber,pageIsRendered:!1,pdfjsPage:Gr(te)}),Y=I.map(L);C(Y),r("pages-loaded",Y)}catch(I){r("document-error",I),console.error(I)}}function H(){c.value=[],d.value=1}function B(X){return`pdf-${X.replace(/\W/g,"")}-${Math.random().toString(36).slice(2)}-${Date.now()}`}function z(X,P){return`${X}-page-${P}`}return Pt(()=>o.file,X=>{R(X)},{immediate:!0}),Pt(u,(X,P)=>{X&&(P&&H(),M())}),(X,P)=>(me(),ke("div",{class:"sd-pdf-viewer",ref_key:"rootRef",ref:a},[Me("div",jS,[Wt(VS,rs({pdf:u.value,pages:c.value,scale:d.value,config:e.config,hasTextLayer:p.value,outputScale:g.value},{onPageRendered:k,onSelectionRaw:w,onBypassSelection:S,ref_key:"documentRef",ref:l}),null,16)])],512))}},WS=fn(GS,[["__scopeId","data-v-05c9d9b5"]])}));It(),mn();var MD={key:0,class:"sd-visually-hidden",role:"status","aria-live":"assertive","data-superdoc-v2-author-required":""},LD=["innerHTML"],DD={class:"superdoc__document document"},PD={class:"floating-comments"},OD=!1,FD=3,t0=6500,n0=8e3,BD={__name:"SuperDoc",emits:["selection-update"],setup(e,{emit:t}){const n=I2(()=>Promise.resolve().then(()=>(RD(),TD))),r=O=>O.password??F.$superdoc.config.password,o=O=>{const q=O?.v2Collaboration,Se=q&&typeof q=="object"&&"value"in q?q.value:q;if(Se==null)return{state:"absent"};const Pe=TS({v2Collaboration:Se,documentType:O?.type??null,documentCount:a.value.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!Pe.ok)return{state:"invalid",failure:{code:Pe.reason==="invalid-room-mode"?"collaboration-open-intent-invalid":"collaboration-config-invalid",message:`SuperDoc rejected the v2 collaboration configuration (${Pe.reason}).`}};const{providerFamily:ht,...sn}=Pe.target;return{state:"valid",config:{providerType:ht,...sn}}},i=eu(),s=Xs(),{documents:a,isReady:l,areDocumentsReady:u,selectionPosition:c,activeSelection:d,activeZoom:h,zoomMode:m,measurementUnit:p,viewportMetrics:g}=Hs(i),{handlePageReady:k,modules:w,user:S,getDocument:y}=i,C=Ea("surfaceManager",null),T=J9({getSurfaceManager:()=>C,getPasswordPromptConfig:()=>F.$superdoc?.config?.modules?.surfaces?.passwordPrompt,onUnhandled:(O,q,Se)=>{F.$superdoc?.emit("exception",{error:Se?.error??new Error(`Password prompt unhandled: ${q}`),editor:Se?.editor??null,code:q,documentId:O?.id})}}),{getConfig:R,documentsWithConverations:M,commentsList:H,pendingComment:B,activeComment:z,skipSelectionUpdate:X,commentsByDocument:P,isCommentsListVisible:N,isFloatingCommentsReady:I,generalCommentIds:L,hasSyncedCollaborationComments:Y,editorCommentPositions:te,hasInitializedLocations:le,isCommentHighlighted:fe,hasOpenTrackedChanges:Ne}=Hs(s),{showAddComment:he,handleEditorLocationsUpdate:ge,handleTrackedChangeUpdate:ae,refreshTrackedChangeCommentsByIds:_e,syncTrackedChangePositionsWithDocument:oe,syncTrackedChangeComments:Te,addComment:Ge,addHydratedComment:Je,getComment:_t,resolveCommentPositionEntry:be,belongsToDocument:Ve,COMMENT_EVENTS:Le,requestInstantSidebarAlignment:J,peekInstantSidebarAlignment:_,clearInstantSidebarAlignment:$}=s,{proxy:F}=or();s.proxy=F;const j=vT(F.$superdoc.config),V=Gr(j.EditorComponent),G=j.RulerComponent?Gr(j.RulerComponent):null,Z=Ae(()=>{const O=We(s.getFloatingComments);return Array.isArray(O)?O:[]}),{isHighContrastMode:W}=Hi(),{uiFontFamily:K}=Hy(),ue=()=>s.viewingVisibility.documentMode==="viewing",we=()=>!!F?.$superdoc?.config?.allowSelectionInViewMode,Ce=Ae(()=>ue()&&s.viewingVisibility.commentsVisible===!0),xe=Ae(()=>F?.$superdoc?.uiConfig?.search?.enabled===!0);Ae(()=>ue()&&s.viewingVisibility.trackChangesVisible===!0);const ot=Ae(()=>s.shouldRenderReviewInViewing),tt=Ae(()=>F.$superdoc.config.proofing!==void 0?F.$superdoc.config.proofing:F.$superdoc.config.layoutEngineOptions?.proofing),Ct=Ae(()=>{const O=w.comments;return O===!1||O==null?null:O}),Kt=Ae(()=>{const O={"--sd-ui-font-family":K.value},q=F.$superdoc.config.modules?.comments;if(!q||q===!1)return O;q.highlightHoverColor&&(O["--sd-comments-highlight-hover"]=q.highlightHoverColor);const Se={...q.trackChangeHighlightColors||{},...q.trackChangeActiveHighlightColors||{}};return Se.insertBorder&&(O["--sd-tracked-changes-insert-border"]=Se.insertBorder),Se.insertBackground&&(O["--sd-tracked-changes-insert-background"]=Se.insertBackground),Se.deleteBorder&&(O["--sd-tracked-changes-delete-border"]=Se.deleteBorder),Se.deleteBackground&&(O["--sd-tracked-changes-delete-background"]=Se.deleteBackground),Se.formatBorder&&(O["--sd-tracked-changes-format-border"]=Se.formatBorder),O}),pt=ne(null),Mt=ne(null),zt=ne(null),ln=ne(null),$n=ne(!1),Ht=jr({top:null,right:"-25px",zIndex:101}),{superdocContainerWidth:Ke,isCompactCommentsMode:kt,recalculateCompactCommentsMode:Ut,ensureCompactMeasurementObserver:Ft}=C9({commentsModuleConfig:Ct,superdocRoot:pt,layers:Mt}),Ot=Ae(()=>!0),hn=Wr(null),yn=ne(!1),De=ne(null);let Oe=0;const Qe=Ae(()=>F.$superdoc.activeEditor),nt=()=>F.$superdoc?.ui??null,Dt=Object.freeze({enabled:!1,active:!1,supported:!1}),Et=rM({getSurfaceManager:()=>C,getActiveEditor:()=>F.$superdoc?.activeEditor,activeEditorRef:Qe,getFindReplaceConfig:()=>F.$superdoc?.config?.modules?.surfaces?.findReplace,getSuperDocUI:nt}),xt=NL({getSurfaceManager:()=>C||(typeof F.$superdoc?.openSurface!="function"?null:{open:O=>F.$superdoc.openSurface(O)}),getActiveEditor:()=>F.$superdoc?.activeEditor,getUi:nt,getResolver:()=>F.$superdoc?.uiConfig?.linkPopover?.suppressed?()=>({type:"none"}):F.$superdoc?.config?.modules?.links?.popoverResolver,getLayerElement:()=>Mt.value,emitException:O=>{F.$superdoc?.emit("exception",{...O,editor:F.$superdoc?.activeEditor??null})}}),Un=F.$superdoc.config.modules?.pdf||{},so=()=>{$n.value&&($n.value=!1,Te({superdoc:F.$superdoc,editor:F.$superdoc?.activeEditor}))},zo=()=>{$n.value=!0,St(()=>{so()})},rn=(O,q)=>{const Se=y(O);Se.isReady=!0,Se.container=q,u.value&&(F.$superdoc.config.collaboration||(l.value=!0)),_s(),I.value=!0,le.value=!0,F.$superdoc.broadcastPdfDocumentReady()},Vn=()=>{if(!c.value||!Mt.value)return null;const O=c.value.source==="pdf"?(h.value??100)/100:1,q=Number(c.value.top);return Number.isFinite(q)?Mt.value.getBoundingClientRect().top+q*O:null},lr=async()=>{if((await he(F.$superdoc,Vn()))?.ok===!1||!Ot.value)return;const O=Cu();O&&_u(O)},yr=async O=>{const q={comments:()=>lr()};O in q&&await q[O](d.value,c.value),d.value=null,Ht.top=null},To=()=>Ht.top=null,$t=new Map,cn=new Map,Fr=new Map,go=new Map;let nl=0;const sa=O=>{const q=Fr.get(O);if(q){Fr.delete(O);try{q.unbind?.()}catch(Se){console.warn("[SuperDoc] v2 command-shortcut unbind failed",Se)}}},rl=()=>{const O=F.$superdoc?.toolbar;return!O||typeof O.getToolbarItemByName!="function"?null:()=>{const q=O.getToolbarItemByName("link");!q||q.disabled?.value===!0||(q.expand&&typeof q.expand=="object"&&"value"in q.expand&&(q.expand.value=!0),O.updateToolbarState?.())}},gs=({documentId:O,bindEditShortcuts:q})=>{if(!O||(sa(O),typeof q!="function"))return;const Se=rl(),Pe=q({commandRoute:{executeAsync:(ht,sn)=>{const un=nt();return un?un.commands.executeAsync(ht,sn):Promise.resolve(OD)},getState:ht=>nt()?.commands.get(ht).getState()??Dt},...Se?{openLinkWorkflow:Se}:{}});Fr.set(O,{unbind:Pe})},Ho=O=>{const q=go.get(O);if(q){go.delete(O);try{q.unbind?.()}catch(Se){console.warn("[SuperDoc] v2 session-shortcut unbind failed",Se)}}},$o=({documentId:O,bindSessionShortcuts:q,documentApi:Se})=>{if(!O||(Ho(O),typeof q!="function"))return;const Pe=q({routes:ZL({resolveToolbarElement:()=>F.$superdoc?.toolbar?.toolbarContainer??null,getDocumentApi:()=>Se??null}),isMutationAllowed:()=>!ue()});go.set(O,{unbind:Pe})},hi=(O,q)=>{O?.id&&(q?$t.set(O.id,q):$t.delete(O.id))},qr=O=>{sa(O),Ho(O);const q=cn.get(O);if(!q)return;F.$superdoc.unregisterEditorRuntime(q.runtimeId),cn.delete(O);const Se=$t.get(O);Se&&kS(Se)},Ee=({documentId:O,host:q,mount:Se,facade:Pe})=>{const ht=$t.get(O);if(!ht)return console.warn("[SuperDoc] v2 runtime host root unavailable; skipping runtime registration for",O),!1;cn.has(O)&&qr(O);const sn=`v2:${O}:${++nl}`,un=WL({id:sn,documentId:O,root:ht,host:q,getLegacyEditorProjection:()=>Pe,onUnregister:dr=>{F.$superdoc.unregisterEditorRuntime(dr);const Bn=cn.get(O);Bn&&Bn.runtimeId===dr&&cn.delete(O);const fr=$t.get(O);fr&&kS(fr)}});return un.attachMountHandle(Se??null),JL(ht,sn),F.$superdoc.registerEditorRuntime(un.runtime),cn.set(O,{runtimeId:sn,adapter:un}),F.$superdoc.setActiveRuntime(sn,"v2-editor-ready"),!0},Fe=j.createReviewHydrationController({hydrateComments:O=>s.hydrateCommentsFromV2?.(O),hydrateTrackedChanges:O=>s.hydrateTrackedChangesFromV2?.(O)}),ft=ne({}),lt=j9(),Cn=ne({}),bn=Ae(()=>Object.values(Cn.value)[0]??null),cr=O=>typeof O=="string"&&O.length>0?`document:${O}`:"document:default",Uo=O=>{const q=cr(O);if(lt.clear(q),!Cn.value[q])return;const Se={...Cn.value};delete Se[q],Cn.value=Se},pi=(O,q)=>{const Se=cr(O);lt.shouldNotify(Se,q)&&(Cn.value={...Cn.value,[Se]:S_},F.$superdoc.emit("exception",{error:new Error(S_),code:U9,editor:null,...typeof O=="string"&&O.length>0?{documentId:O}:{},...q.failureSource==="receipt"&&q.failure?{receipt:q.failure}:{}}))},Ti=(O,q)=>{O&&(ft.value={...ft.value,[O]:q})},ol=O=>{if(!O||!ft.value[O])return;const q={...ft.value};delete q[O],ft.value=q},Vo=(O=null)=>{const q=F.$superdoc?.activeEditor,Se=O??q?.documentId??q?.options?.documentId??null;if(!Se){q?.editorVersion===2&&F.$superdoc.setActiveEditor(null);return}if(O&&q?.editorVersion===2){const sn=q.documentId??q.options?.documentId??null;if(sn&&sn!==O)return}const Pe=Se?y(Se):null;Pe&&(Pe.isReady=!1,typeof Pe.setEditor=="function"&&Pe.setEditor(null));const ht=cn.has(Se);qr(Se),!ht&&q?.editorVersion===2&&(q.documentId??q.options?.documentId??null)===Se&&F.$superdoc.setActiveEditor(null)},mi=O=>{const q=typeof O?.getExtensionManager=="function"?O.getExtensionManager():null;if(!q)return null;const Se=q.commands;return{commands:{execute:(Pe,ht)=>Se.execute(Pe,ht),getState:Pe=>{const ht=Se.get(Pe);return ht?{enabled:!(ht.getState()??{}).disabled,reason:null}:null},list:()=>Se.list().map(Pe=>{const ht=Pe.getState()??{};return ht.label?{id:Pe.id,label:ht.label}:{id:Pe.id}})},diagnostics:{getSnapshot:()=>q.diagnostics()}}},gi=O=>{if(!O)return;ol(O.documentId??null),Uo(O.documentId??null);const{host:q,mount:Se,documentId:Pe,capabilities:ht,editCommands:sn,bindEditShortcuts:un,bindSessionShortcuts:dr,commentsAdapter:Bn,trackedChangesAdapter:fr,documentApi:kn,documentMutationReadiness:bo,documentApiUnavailableReason:Hr,pageMetrics:ya,pageLayout:hr,pageFurniture:ni,presence:Cl,lock:_l,fonts:$0,replaceFile:dc}=O,co=async(At={})=>{if(!q||typeof q.save!="function")throw new Error("v2-editor: save unavailable");return q.save(At)},eb=async(At={})=>{const Gt=await co({format:"docx",commentExportMode:At?.commentsType==="clean"?"strip":"preserve"});return new Blob([Gt],{type:Tr})},ba=async At=>{if(typeof dc!="function")throw new Error("v2-editor: replaceFile unavailable");return dc(At)},Pf=(At={})=>Se?.focus&&typeof Se.focus.focus=="function"?Se.focus.focus(At):!1,Xn=(At,Gt=void 0)=>{const vn={ok:!1,reason:At};return Gt&&(vn.detail=Gt),vn},Of=At=>Array.isArray(At?.items)?At.items:[],sm=At=>{const Gt=Number(At);return Number.isFinite(Gt)&&Gt>0?Math.floor(Gt):0},am=async({text:At,occurrence:Gt=0}={})=>{if(typeof At!="string"||At.length===0)return Xn("invalid-text","text must be a non-empty string");if(!kn?.query||typeof kn.query.match!="function")return Xn("query-unavailable","activeEditor.doc.query.match is not available");const vn=sm(Gt),Cr=await kn.query.match({select:{type:"text",pattern:At},limit:vn+1}),Ur=Of(Cr),uo=Ur[vn]??null;return uo?.target?{ok:!0,item:uo,target:uo.target,ref:typeof uo?.handle?.ref=="string"?uo.handle.ref:null,text:At,occurrence:vn,total:Number.isFinite(Number(Cr?.total))?Number(Cr.total):Ur.length}:Xn("text-not-found",`text not found: ${At}`)},tb=(At,Gt)=>{if(!At||typeof At!="object"||At.kind!=="selection"||Gt!=="start"&&Gt!=="end")return At;const vn=Gt==="start"?At.start:At.end;return vn?{kind:"selection",start:vn,end:vn,...At.story?{story:At.story}:{}}:At},lm=async({target:At,collapse:Gt=null,focus:vn=!0}={})=>{if(!At||typeof At!="object")return Xn("invalid-target","target must be a SelectionTarget object");const Cr=tb(At,Gt),Ur=(q?.getHandles?.()?.editing??null)?.selectionTargets??null;if(typeof Ur?.apply!="function")return Xn("selection-target-unavailable","editing.selectionTargets.apply is not available");let uo;try{uo=Ur.apply(Cr)}catch(Ci){return Xn("selection-target-threw",Ci instanceof Error?Ci.message:String(Ci))}return uo?.ok?(vn!==!1&&await Promise.resolve(Pf()),{ok:!0,mode:uo.mode??"range"}):Xn(uo?.reason??"selection-target-rejected",uo?.detail)},cm=()=>F.$superdoc.config.documentMode==="suggesting"?"tracked":"direct",um=()=>{const At=(q?.getHandles?.()?.editing??null)?.selection??null;if(typeof At?.toSelectionTarget!="function")return Xn("selection-target-unavailable","editing.selection.toSelectionTarget is not available");const Gt=At.toSelectionTarget();if(!Gt||Gt.kind==="rejected"){const vn=Gt?.rejection??{};return Xn(vn.reason??vn.code??"selection-target-rejected",vn.detail)}return!Gt.target||typeof Gt.target!="object"?Xn("selection-target-rejected","selection target was not produced"):{ok:!0,target:Gt.target,mode:Gt.mode??"range",story:Gt.story}},fc=(At,Gt)=>{const vn=At?.failure??At;return Xn(vn?.code??At?.reason??Gt,vn?.message??vn?.detail??At?.detail)},dm={focusEditable:Pf,readBlocks:(At={includeText:!0})=>kn?.blocks?.list?.(At),setSelectionTarget:(At={})=>lm(At),setSelectionByText:async(At={})=>{const Gt=await am(At);if(!Gt.ok)return Gt;const vn=await lm({target:Gt.target,collapse:At?.collapse??null,focus:At?.focus});return vn.ok?{ok:!0,mode:vn.mode,text:Gt.text,occurrence:Gt.occurrence,target:Gt.target}:vn},replaceTextByText:async({findText:At,replacement:Gt,occurrence:vn=0,mode:Cr="direct"}={})=>{if(typeof Gt!="string")return Xn("invalid-replacement","replacement must be a string");if(!kn?.text||typeof kn.text.replace!="function")return Xn("text-replace-unavailable","activeEditor.doc.text.replace is not available");const Ur=await am({text:At,occurrence:vn});if(!Ur.ok)return Ur;const uo=Ur.ref?{ref:Ur.ref,text:Gt,mode:Cr}:{target:Ur.target,text:Gt,mode:Cr},Ci=await kn.text.replace(uo);return Ci?.ok===!1?Xn(Ci.reason??"text-replace-failed",Ci.detail):(await Promise.resolve(bo?.whenPainted?.(Ci)),{ok:!0,receipt:Ci,text:Gt,replacedText:At,occurrence:sm(vn)})},replaceSelection:async({target:At,replacement:Gt="",mode:vn="direct"}={})=>{if(!At||typeof At!="object")return Xn("invalid-target","target must be a SelectionTarget object");if(typeof Gt!="string")return Xn("invalid-replacement","replacement must be a string");if(!kn?.text||typeof kn.text.replace!="function")return Xn("text-replace-unavailable","activeEditor.doc.text.replace is not available");const Cr=await kn.text.replace({target:At,text:Gt,mode:vn});return Cr?.ok===!1?Xn(Cr.reason??"text-replace-failed",Cr.detail):(await Promise.resolve(bo?.whenPainted?.(Cr)),{ok:!0,receipt:Cr,text:Gt})},serializeSelectionToClipboard:async({includeHtml:At=!0}={})=>{if(!kn?.clipboard||typeof kn.clipboard.serializeSelection!="function")return Xn("clipboard-serialize-unavailable","activeEditor.doc.clipboard.serializeSelection is not available");const Gt=um();if(!Gt.ok)return Gt;let vn;try{vn=await kn.clipboard.serializeSelection({target:Gt.target,includeHtml:At!==!1})}catch(Cr){return Xn("clipboard-serialize-threw",Cr instanceof Error?Cr.message:String(Cr))}return vn?.payload?{ok:!0,payload:vn.payload,plan:vn.plan,target:Gt.target,mode:Gt.mode}:Xn("clipboard-serialize-failed","clipboard serialization did not return a payload")},pasteClipboardPayload:async({payload:At,target:Gt=null,mode:vn=cm(),fallback:Cr=void 0}={})=>{if(!At||typeof At!="object")return Xn("invalid-clipboard-payload","payload must be a ClipboardPayload object");if(!kn?.clipboard||typeof kn.clipboard.insert!="function")return Xn("clipboard-insert-unavailable","activeEditor.doc.clipboard.insert is not available");let Ur=Gt,uo=null;if(!Ur){const wa=um();if(!wa.ok)return wa;Ur=wa.target,uo=wa.mode}if(!Ur||typeof Ur!="object")return Xn("invalid-target","target must be a SelectionTarget or ClipboardTarget object");const Ci={payload:At,target:Ur,changeMode:vn==="tracked"?"tracked":"direct",...Cr!==void 0?{fallback:Cr}:{}},ri=await kn.clipboard.insert(Ci);return!ri||ri.success===!1||ri.ok===!1?fc(ri,"clipboard-insert-failed"):(await Promise.resolve(bo?.whenPainted?.(ri)),{ok:!0,receipt:ri,target:Ur,mode:uo})},pastePlainText:async({text:At,target:Gt=null,mode:vn=cm()}={})=>typeof At!="string"?Xn("invalid-text","text must be a string"):dm.pasteClipboardPayload({payload:{source:"api",items:[{type:"text/plain",kind:"string",data:At}]},target:Gt,mode:vn})},hc={editorVersion:2,documentId:Pe,host:q,mount:Se,options:{documentId:Pe,documentMode:F.$superdoc.config.documentMode},capabilities:ht??q?.getCapabilities?.()??null,save:co,exportDocx:eb,replaceFile:ba,doc:kn??null,documentMutationReadiness:bo??null,documentApiUnavailableReason:Hr??null,focus:Pf,authoring:dm,editCommands:sn??null,v2Comments:Bn??null,v2TrackedChanges:fr??null,pageMetrics:ya??null,pageLayout:hr??null,pageFurniture:ni??null,presence:Cl??null,lock:_l??null,reviewHydration:{getDiagnostics:()=>Fe.getDiagnostics()},extensions:mi(q),fonts:$0??q?.getFontRuntime?.()??null,commands:null,state:null,view:null},pc=y(Pe);pc&&(pc.isReady=!0,typeof pc.setEditor=="function"&&pc.setEditor(hc)),Ee({documentId:Pe,host:q,mount:Se,facade:hc})||F.$superdoc.setActiveEditor(hc),F.$superdoc.broadcastEditorCreate(hc),gs({documentId:Pe,bindEditShortcuts:un}),$o({documentId:Pe,bindSessionShortcuts:dr,documentApi:kn}),o(y(Pe)).state==="valid"&&xu({editor:hc}),ya&&hr&&(Li.value=!0);const Ff=F.$superdoc.config.modules?.comments!==!1;if(Bn&&Ff&&s.setV2CommentsAdapter?.(Bn),fr&&Ff&&s.setV2TrackedChangesAdapter?.(fr),Ff&&(Bn||fr)){Fe.setContext({superdoc:F.$superdoc,documentId:Pe,commentsAdapter:Bn??null,trackedChangesAdapter:fr??null});try{const At=q?.getRenderReadinessSnapshot?.();At&&Fe.onRenderReadiness(At)}catch(At){console.warn("[SuperDoc][v2] initial render-readiness snapshot failed",At)}}u.value&&!F.$superdoc.config.collaboration&&(l.value=!0),I.value=!0,le.value=!0},vo=ne(!1),Yr=Wr(null);let vi=0,Ro=0,Yn=0;const il=({editor:O,sourceEditor:q,surface:Se="body",headerId:Pe=null,sectionType:ht=null}={})=>{const sn=F.$superdoc?.activeEditor??null,un=O??q??sn??void 0;return{editor:un,sourceEditor:q??un,surface:Se,headerId:Pe,sectionType:ht}},If=(O={})=>{F.$superdoc.emit("editor-update",il(O))},aa=()=>{vi&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(vi),Ro&&clearTimeout(Ro),vi=0,Ro=0},Mo=(O=FD)=>{aa();const q=()=>{vi=0,Ro=0,ca(),vo.value&&ei.value&&!c.value&&O>0&&Mo(O-1)};if(typeof requestAnimationFrame=="function"){vi=requestAnimationFrame(q);return}Ro=setTimeout(q,0)},Xr=()=>{Yn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Yn),Yn=0},sl=()=>{vo.value=!1,Yr.value=null,aa(),ca()},Ki=(O,q)=>{if(!O||O.rangeCount<1||O.isCollapsed||!q)return!1;const Se=O.getRangeAt(0);return q.contains(Se.startContainer)&&q.contains(Se.endContainer)},al=()=>{if(Yn=0,!Ot.value)return;let O=null;try{O=F.$superdoc?.activeEditor?.host?.getHandles?.()??null}catch{O=null}const q=F.$superdoc?.config?.documentMode;if(q==="editing"||q==="suggesting"){const sn=O?.editing?.selection?.getSnapshot?.()??null;if(K9(q,sn)){const un=bi();if(W9(window.getSelection?.()??null,un)){sl();return}vo.value=!0,Yr.value=sn,Mo();return}}else if(q!=="viewing"){sl();return}const Se=bi(),Pe=window.getSelection?.()??null;if(!Ki(Pe,Se)){sl();return}const ht=O?.editing?.selectionTargets?.applyDomSelection?.(Pe);if(!ht?.ok||ht.mode!=="range"){sl();return}vo.value=!0,Yr.value=O?.editing?.selection?.getSnapshot?.()??null,Mo()},br=()=>{if(Ot.value){if(Xr(),typeof requestAnimationFrame!="function"){al();return}Yn=requestAnimationFrame(al)}},yi=()=>{br()},yu=({hasRangeSelection:O,snapshot:q}={})=>{if(vo.value=O===!0,Yr.value=O===!0?q??null:null,vo.value){Mo();return}aa(),ca()},bi=()=>hn.value?.mountContainer??F.$superdoc?.activeEditor?.mount?.container??null,Ri=O=>{const q=String(O);return globalThis.CSS?.escape?globalThis.CSS.escape(q):q.replace(/["\\]/g,"\\$&")},la=()=>{const O=Yr.value,q=bi();if(!O||!q?.querySelector)return null;const Se=O.anchor??null,Pe=[Se?.fragmentId,Se?.blockId,Se?.position?.anchor?.nativeId].filter(ht=>ht!=null&&ht!=="");for(const ht of Pe){const sn=Ri(ht),un=q.querySelector(`[data-source-node-id="${sn}"]`)??q.querySelector(`[data-layout-block-ref="${sn}"]`)??q.querySelector(`[data-layout-fragment-id="${sn}"]`);if(un instanceof HTMLElement)return un}return null};function ll(O=null){const q=window.getSelection?.();if(!q||q.rangeCount<1||q.isCollapsed)return null;const Se=q.getRangeAt(0);if(!Se)return null;if(O){const{startContainer:Pe,endContainer:ht}=Se;if(!O.contains(Pe)||!O.contains(ht))return null}try{const Pe=Se.getBoundingClientRect();return!Pe||Pe.width<=0&&Pe.height<=0?null:Pe}catch{return null}}const bu=O=>{if(!O||!Mt.value)return null;const q=Mt.value.getBoundingClientRect();return{top:O.top-q.top,left:O.left-q.left,right:O.right-q.left,bottom:O.bottom-q.top,width:O.width,height:O.height}},cl=O=>{let q=O;for(;q&&q.nodeType===1;){const Se=q.dataset?.pageIndex;if(Se!=null&&Se!==""){const Pe=Number(Se);if(Number.isFinite(Pe))return Pe}q=q.parentElement}return null},wu=()=>{if(!vo.value||!ei.value)return null;const O=bu(ll(bi()))??Cu()?.bounds??null;if(!O)return null;const q=F.$superdoc?.activeEditor?.options?.documentId??F.$superdoc?.activeEditor?.documentId;if(!q)return null;const Se=cl(la());return Yd({selectionBounds:O,page:Se!=null?Se+1:1,documentId:q,source:$c})},Cu=()=>{if(!Mt.value)return null;const O=la();if(!O)return null;const q=O.getBoundingClientRect();if(!q||q.width<=0&&q.height<=0)return null;const Se=Mt.value.getBoundingClientRect(),Pe={top:q.top-Se.top,left:q.left-Se.left,right:q.right-Se.left,bottom:q.bottom-Se.top,width:q.width,height:q.height},ht=cl(O);return{threadId:"pending",key:"pending",kind:"pending",storyKey:"body",bounds:Pe,...ht!=null?{pageIndex:ht}:{},...De.value!=null?{generation:De.value}:{}}},ca=()=>{if(!Ot.value)return;if(!vo.value){d.value=null,Pn();return}const O=wu();if(!O){d.value=null,Pn();return}Lt(O)},_u=O=>{O&&ge({...te.value??{},pending:O})},Lo=j.createGeometryPublisher({getLayersContainer:()=>Mt.value??null,isCommentsEnabled:()=>ot.value,publishPositions:O=>ge(O),clearPositions:()=>{s.clearEditorCommentPositions?.()},readCurrentPositions:()=>te.value??{},setGeometryAvailable:O=>{yn.value=!!O,O&&(De.value=Lo.getLastEpoch())}}),ul=O=>{if(hn.value=O,Oe&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Oe),typeof requestAnimationFrame!="function"){Lo.publish(hn.value);return}Oe=requestAnimationFrame(()=>{Oe=0,Lo.publish(hn.value)})},Ef=O=>{O&&(ul(O),vo.value&&Mo())},vs=O=>{const q=O?.snapshot??O??null;q&&Fe.onRenderReadiness(q)},dl=Wr(null),Do=new Map;let qi=null;const Su=O=>{if(!O?.snapshot)return;tc.onRender();const q=O.snapshot,Se=O.stage;if(typeof HTMLElement<"u"&&Se instanceof HTMLElement){qi=Se;const ht=Se.dataset?.superdocV2DocumentId;ht&&Do.set(ht,Se)}dl.value=q;const Pe=Array.isArray(q.pages)?q.pages.length:0;F.$superdoc.emit("pagination-update",{totalPages:Pe,superdoc:F.$superdoc}),St(()=>{ao(),cc()})},ku=O=>{xt.destroy(),Xr(),aa(),Oe&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Oe),Oe=0,hn.value=null,De.value=null,yn.value=!1,Lo.reset(),vo.value=!1,Yr.value=null,d.value=null,Pn(),dl.value=null;const q=O?.documentId==null?null:String(O.documentId);s.cancelImportedTrackedChangeBootstrap?.(q??void 0),q&&Do.delete(q),qi&&(q==null||qi.dataset?.superdocV2DocumentId===q)&&(qi=null),Fe.reset("render-cleared"),tc.reset(),hl(),nc.clear(),s.setV2CommentsAdapter?.(null),s.setV2TrackedChangesAdapter?.(null),s.clearEditorCommentPositions?.(),Vo(O?.documentId??null),Po(),Mr.value={},Li.value=!1};let jo=0;const ys=()=>{const O=F.$superdoc?.activeEditor?.v2Comments??null;O&&s.hydrateCommentsFromV2?.({superdoc:F.$superdoc,adapter:O,documentId:F.$superdoc?.activeEditor?.documentId??null})},fl=(O={})=>{ys();const q=F.$superdoc?.activeEditor?.v2TrackedChanges??null;q&&s.hydrateTrackedChangesFromV2?.({superdoc:F.$superdoc,adapter:q,documentId:F.$superdoc?.activeEditor?.documentId??null,...O})},tc=w_({getContext:()=>{const O=F.$superdoc?.activeEditor??null,q=O?.v2TrackedChanges??null;return q?{superdoc:F.$superdoc,adapter:q,documentId:O.documentId??null}:null},reconcile:(O,q)=>s.reconcileTrackedChangeMutationFromV2?.({superdoc:O.superdoc,adapter:O.adapter,documentId:O.documentId,...q}),hydrate:(O,q)=>s.hydrateTrackedChangesFromV2?.({superdoc:O.superdoc,adapter:O.adapter,documentId:O.documentId,...q}),onReconciled:()=>Lo.recollect()});let ua=0,Yi=0;const hl=()=>{jo&&typeof clearTimeout=="function"&&clearTimeout(jo),jo=0,ua=0,Yi=0},Au=()=>{ua=Date.now(),Yi||(Yi=ua),jo&&typeof clearTimeout=="function"&&clearTimeout(jo);const O=()=>{jo=0;const Se=Date.now()-ua,Pe=Date.now()-Yi;if(Se<t0&&Pe<n0){const ht=t0-Se,sn=n0-Pe;jo=setTimeout(O,Math.min(ht,sn));return}Yi=0,fl()},q=Math.max(0,n0-(Date.now()-Yi));jo=setTimeout(O,Math.min(t0,q))},nc=z9({hydrate:()=>fl(),getActiveDocumentId:()=>{const O=F.$superdoc?.activeEditor??null;return O?.documentId??O?.options?.documentId??null}}),xf=(O,q)=>{if(!q)return;const Se=O?.id??null;if(q.type==="reviewTarget:changed"){sc(q.next);return}if(q.type==="collaboration:remote-changed"){nc.schedule(Se);return}if(q.type==="source:complete"){F.$superdoc.broadcastSourceComplete();return}if(q.type==="source:signals-complete"){F.$superdoc.broadcastSourceSignalsComplete();return}if(q.type==="mutation:rejected"){pi(Se,q);return}if(q.type==="mutation:committed"&&(Uo(Se),If()),q.type!=="mutation:committed")return;const Pe=b_(q),ht=(F.$superdoc?.activeEditor??null)?.documentMutationReadiness??null,sn=q.origin==="history"?null:q.receipt,un=Pe&&typeof sn?.txId=="string"&&sn.txId.length>0&&typeof ht?.whenPainted=="function";if(tc.enqueueAfterPaint(Pe,un?()=>ht.whenPainted.call(ht,sn):null),Pe?.reconcileMode==="authoritative"&&Pe.upsertIds.size>0){ys();return}if(C_(q)){Au();return}Pe?.removedIds.size>0&&Pe.upsertIds.size===0||fl()},Tf=O=>{xt.handleLinkClick(O)},rc=()=>{if(Ot.value&&Lo.getLastPayload()){if(Oe&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Oe),typeof requestAnimationFrame!="function"){Lo.recollect();return}Oe=requestAnimationFrame(()=>{Oe=0,Lo.recollect()})}},bs=()=>{if(!Ot.value)return;try{Fe.hydrateNow("document-mode-change")}catch(q){console.warn("[SuperDoc][v2] document-mode-change rehydrate failed",q)}const O=()=>{Ot.value&&(ot.value?hn.value?ul(hn.value):rc():(s.clearEditorCommentPositions?.(),yn.value=!1))};St(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>O()):O()})},pl=O=>{switch(O){case"editing-mount-required":return"SuperDoc could not load the document editor because the page did not provide a mount container.";case"source-load-failed":return"SuperDoc could not load the document editor because the document source could not be prepared.";case"unsupported-cdn-v2-editor":return"SuperDoc could not load the document editor because this build does not include the V2 runtime.";case"v2-integration-unavailable":return"SuperDoc could not load the document editor because the bundled V2 runtime is unavailable in this environment.";case"worker-init-failed":return"SuperDoc could not load the document editor because the browser worker failed to start.";case"input-too-large-for-inline-review":return"SuperDoc could not load the document editor because this document is too large to open without the browser worker.";case"collaboration-unsupported-huge-document":return"SuperDoc could not load the document editor because large documents cannot be opened with collaboration enabled yet.";case"collaboration-v1-config-unsupported":return"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead.";case"collaboration-room-format-unsupported":return"SuperDoc v2 cannot open this collaboration state because it is not stored in the SuperDoc v2 room format. No changes were made.";case"collaboration-room-format-conflict":return"SuperDoc v2 found conflicting room formats in one collaboration document. No changes were made.";case"collaboration-room-corrupt":return"SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";case"collaboration-v2-room-missing":return'SuperDoc v2 could not find a committed v2 collaboration room. No changes were made. Use roomMode: "create" only when creating a new room.';case"collaboration-v2-room-already-exists":return'SuperDoc v2 was asked to create a collaboration room that already exists. Use roomMode: "join" to open it.';case"collaboration-v2-room-initializing":return"The SuperDoc v2 collaboration room is still initializing. Join mode did not modify it.";case"collaboration-open-intent-invalid":return"SuperDoc v2 received an invalid collaboration room mode. No provider was connected.";case"collaboration-config-invalid":return"SuperDoc v2 received an invalid collaboration configuration. No provider was connected.";default:return"SuperDoc could not load the document editor."}},Iu=O=>typeof O=="string"&&O.trim().length>0?O.trim():null,da=O=>{Vo(O?.documentId??null);const q=typeof O?.reason=="string"&&O.reason.length>0?O.reason:"open-failed",Se=Iu(O?.detail),Pe=typeof O?.documentId=="string"&&O.documentId.length>0?O.documentId:null,ht=pl(q),sn=O?.workerFailure&&typeof O.workerFailure=="object"?O.workerFailure:null;Ti(Pe,{reason:q,message:ht,detail:Se,...sn?{workerFailure:sn}:{}});const un={...Se?{detail:Se}:{},...Pe?{documentId:Pe}:{},...sn?{workerFailure:sn}:{},reason:q};q==="collaboration-v1-config-unsupported"||q==="collaboration-room-format-unsupported"||q==="collaboration-room-format-conflict"||q==="collaboration-room-corrupt"||q==="collaboration-v2-room-missing"||q==="collaboration-v2-room-already-exists"||q==="collaboration-v2-room-initializing"||q==="collaboration-open-intent-invalid"||q==="collaboration-config-invalid"?console.warn(`[SuperDoc] ${ht}`,un):console.error(`[SuperDoc] ${ht}`,un),F.$superdoc.emit("exception",{error:new Error(ht),code:q,...Pe?{documentId:Pe}:{},editor:null})},ml=(O,q)=>{F.$superdoc?.activateRuntimeFromEventTarget?.(O.target,q)},Eu=O=>ml(O,"focusin"),oc=O=>ml(O,"pointerdown"),Mi=O=>ml(O,"mousedown"),xu=({editor:O})=>{F.$superdoc.emit("collaboration-ready",{editor:O}),St(()=>{l.value=!0;const q=new URLSearchParams(window.location.search).get("commentId");q&&et(q)})};let Xi=0;const Rf=()=>{Xi=Date.now()+250},Tu=()=>Date.now()<Xi,ic=O=>{const q=pt.value;q&&(!(O.target instanceof Node)||!q.contains(O.target)||(Mt.value?.contains(O.target)&&(s.setActiveComment(F.$superdoc,null),s.removePendingComment(F.$superdoc),qe()),Rf()))},Ru=O=>{const q=F.$superdoc.listeners?.("fonts-resolved")?.length>0?F.$superdoc.listeners("fonts-resolved")[0]:null,Se=F.$superdoc.config.useLayoutEngine!==!1,Pe=O.isNewFile,ht=F.$superdoc.config?.benchmarkExecutionMode,sn=F.$superdoc.config?.benchmarkTraceEnabled===!0,un=o(O),dr=un.state==="valid"?un.config:null,Bn=F.$superdoc.config.v2CollaborationPreflightFailure??(un.state==="invalid"?un.failure:null);return{isDebug:F.$superdoc.config.isDebug||!1,documentId:O.id,user:F.$superdoc.user,users:F.$superdoc.users,colors:F.$superdoc.colors,role:F.$superdoc.config.role,html:O.html,markdown:O.markdown,documentMode:F.$superdoc.config.documentMode,...ht?{benchmarkExecutionMode:ht}:{},...sn?{benchmarkTraceEnabled:!0}:{},allowSelectionInViewMode:F.$superdoc.config.allowSelectionInViewMode,rulers:O.rulers,rulerContainer:F.$superdoc.config.rulerContainer,isInternal:F.$superdoc.config.isInternal,annotations:F.$superdoc.config.annotations,isCommentsEnabled:!!Ct.value,isAiEnabled:F.$superdoc.config.modules?.ai,contextMenuConfig:(F.$superdoc.config.modules?.slashMenu&&!F.$superdoc.config.modules?.contextMenu&&console.warn("[SuperDoc] modules.slashMenu is deprecated. Use modules.contextMenu instead."),F.$superdoc.config.modules?.contextMenu??F.$superdoc.config.modules?.slashMenu),slashMenuConfig:F.$superdoc.config.modules?.contextMenu??F.$superdoc.config.modules?.slashMenu,comments:{highlightColors:Ct.value?.highlightColors,highlightOpacity:Ct.value?.highlightOpacity},trackedChanges:F.$superdoc.config.modules?.trackChanges,experimental:F.$superdoc.config.experimental,...dr?{v2Collaboration:dr}:{},...Bn?{collaborationPreflightFailure:Bn}:{},onCollaborationReady:xu,onCommentsUpdate:ac,onFontsResolved:q,onPageCountKnown:F.$superdoc.config.onPageCountKnown??null,fontAssets:F.$superdoc.config.fonts,proofing:tt.value,isNewFile:Pe,password:r(O),handleImageUpload:F.$superdoc.config.handleImageUpload,externalExtensions:F.$superdoc.config.editorExtensions||[],extensions:F.$superdoc.config.extensions||[],suppressDefaultDocxStyles:F.$superdoc.config.suppressDefaultDocxStyles,disableContextMenu:!F.$superdoc.uiConfig.contextMenu.enabled||F.$superdoc.config.disableContextMenu===!0,jsonOverride:F.$superdoc.config.jsonOverride,viewOptions:F.$superdoc.config.viewOptions,contained:F.$superdoc.config.contained,linkPopoverResolver:F.$superdoc.uiConfig.linkPopover.enabled?F.$superdoc.config.modules?.links?.popoverResolver:void 0,layoutEngineOptions:Se?{...F.$superdoc.config.layoutEngineOptions||{},proofing:tt.value,debugLabel:F.$superdoc.config.layoutEngineOptions?.debugLabel??O.name??O.id,zoom:(h.value??100)/100,emitCommentPositionsInViewing:ue()&&ot.value,enableCommentsInViewing:Ce.value,contentControlsChrome:F.$superdoc.uiConfig.contentControls.enabled?F.$superdoc.uiConfig.contentControls.options.chrome??(F.$superdoc.config.modules?.contentControls?.chrome==="none"?void 0:F.$superdoc.config.modules?.contentControls?.chrome):"none",resolveTrackedChangeColor:l9(F.$superdoc.config.modules?.trackChanges?.authorColors)}:void 0,permissionResolver:(fr={})=>F.$superdoc.canPerformPermission({role:F.$superdoc.config.role,isInternal:F.$superdoc.config.isInternal,...fr}),licenseKey:F.$superdoc.config.licenseKey,telemetry:F.$superdoc.config.telemetry?.enabled?{enabled:!0,endpoint:F.$superdoc.config.telemetry?.endpoint,metadata:F.$superdoc.config.telemetry?.metadata,licenseKey:F.$superdoc.config.telemetry?.licenseKey}:null}},Mu=new Set(["commentText","isInternal","parentCommentId","trackedChangeParentId","trackedChangeThreadParentId","threadingParentCommentId","trackedChange","trackedChangeType","trackedChangeText","trackedChangeDisplayType","semanticColorKey","semanticColor","trackedChangeStory","trackedChangeStoryKind","trackedChangeStoryLabel","trackedChangeAnchorKey","trackedChangeLabel","trackedChangeDetailLines","deletedText","resolvedTime","resolvedById","resolvedByEmail","resolvedByName","importedAuthor","docxCommentJSON"]),fa=(O,q={})=>{if(!(!O||q.isDone===void 0)&&!(q.resolvedTime!=null||q.resolvedById!=null||q.resolvedByEmail!=null||q.resolvedByName!=null)){if(q.isDone){O.resolvedTime=O.resolvedTime||Date.now(),O.resolvedById=O.resolvedById||q.creatorId||null,O.resolvedByEmail=O.resolvedByEmail||q.creatorEmail||null,O.resolvedByName=O.resolvedByName||q.creatorName||null;return}O.resolvedTime=null,O.resolvedById=null,O.resolvedByEmail=null,O.resolvedByName=null}},ha=(O,q,Se)=>{!O||!q||(Array.isArray(q.elements)&&(O.docxCommentJSON=q.elements),Object.entries(q).forEach(([Pe,ht])=>{ht!==void 0&&Pe!=="text"&&Pe!=="elements"&&Mu.has(Pe)&&(O[Pe]=ht)}),Se!==void 0&&(O.commentText=Se),fa(O,q))},Lu=(O={})=>{const q={...O};return!q.commentText&&q.text&&(q.commentText=q.text),!q.docxCommentJSON&&Array.isArray(q.elements)&&(q.docxCommentJSON=q.elements),fa(q,q),q},gl=O=>{if(Number.isFinite(_()))return;if(O==null){$();return}const q=Mt.value,{key:Se,entry:Pe}=be(O),ht=r_(q,Pe);if(Number.isFinite(ht)){J(ht,O,Se??O);return}$()},Mf=O=>O==null||z.value==null?!1:String(z.value)===String(O),sc=O=>{if(O?.origin!=="document"||Tu())return;const q=B9(O,_t);q&&(gl(q),z.value=q,fe.value=!0,setTimeout(()=>{fe.value=!1},0))},ac=(O={})=>{let{activeCommentId:q,type:Se,comment:Pe}=O,ht=Object.prototype.hasOwnProperty.call(O,"activeCommentId");const sn=dr=>{const Bn=[dr?.importedId,dr?.commentId].filter(Boolean).map(fr=>String(fr));return[...new Set(Bn)]},un=dr=>{const Bn=[dr?.importedId,dr?.commentId].filter(Boolean).map(kn=>String(kn)),fr=F.$superdoc?.activeEditor?.options?.documentId!=null?String(F.$superdoc.activeEditor.options.documentId):null;for(const kn of Bn){const bo=H.value.find(Hr=>{const ya=Hr?.commentId!=null?String(Hr.commentId):null,hr=Hr?.importedId!=null?String(Hr.importedId):null;return ya===kn||hr===kn?!fr||typeof Ve!="function"?!0:Ve(Hr,fr):!1});if(bo){const Hr=bo?.commentId??bo?.importedId??kn;return{id:Hr!=null?String(Hr):null,existingComment:bo}}}return{id:Bn[0]||null,existingComment:null}};if(Se==="replayCompleted"&&zo(),Le?.ADD&&Se===Le.ADD&&Pe){Pe=Lu(Pe);const dr=F.$superdoc?.user;dr&&(Pe.creatorId||(Pe.creatorId=dr.id),Pe.creatorName||(Pe.creatorName=dr.name),Pe.creatorEmail||(Pe.creatorEmail=dr.email)),Pe.createdTime||(Pe.createdTime=Date.now());const Bn=Pe.documentId||a.value?.[0]?.id;!Pe.documentId&&Bn&&(Pe.documentId=Bn),!Pe.fileId&&Bn&&(Pe.fileId=Bn);const{id:fr,existingComment:kn}=un(Pe);if(fr&&!kn){const bo=qs(Pe);Je({superdoc:F.$superdoc,comment:bo,skipEditorUpdate:!0})}}if(Le?.UPDATE&&Se===Le.UPDATE&&Pe){const{id:dr,existingComment:Bn}=un(Pe);if(dr){const fr=Pe.commentText||Pe.text;if(Bn)ha(Bn,Pe,fr);else{const kn=qs(Lu(Pe));Je({superdoc:F.$superdoc,comment:kn,skipEditorUpdate:!0})}}}if(Le?.DELETED&&Se===Le.DELETED&&Pe){const dr=sn(Pe);if(dr.length){const Bn=F.$superdoc?.activeEditor?.options?.documentId!=null?String(F.$superdoc.activeEditor.options.documentId):null,fr=bo=>!Bn||typeof Ve!="function"?!0:Ve(bo,Bn),kn=g9(H.value,dr,fr);if(kn.size){const bo=[...H.value];H.value=H.value.filter(ni=>{if(!fr(ni))return!0;const Cl=ni.commentId!=null?String(ni.commentId):null,_l=ni.importedId!=null?String(ni.importedId):null;return!(Cl&&kn.has(Cl)||_l&&kn.has(_l))});const Hr=z.value!=null?String(z.value):null,ya=Hr!=null?bo.find(ni=>{const Cl=ni.commentId!=null?String(ni.commentId):null,_l=ni.importedId!=null?String(ni.importedId):null;return Cl===Hr||_l===Hr}):null,hr=ya?fr(ya):!1;Hr&&kn.has(Hr)&&hr&&(q=null,ht=!0)}}}Se==="trackedChange"&&ae({superdoc:F.$superdoc,params:O}),ht&&q!=null&&Tu()&&(ht=!1),ht&&(q==null||!Mf(q))&&gl(q),St(()=>{B.value||(ht&&s.setActiveComment(F.$superdoc,q),ht&&(fe.value=!0,setTimeout(()=>{fe.value=!1},0)))}),typeof F.$superdoc.config.onCommentsUpdate=="function"&&F.$superdoc.config.onCommentsUpdate(O)},ei=Ae(()=>!!Ct.value),Qi=Ae(()=>Array.isArray(a.value)?a.value.filter(O=>O?.type===Nl):[]),Br=Ae(()=>Qi.value.length>0),Lf=Ae(()=>Br.value&&ei.value),Df=Ae(()=>new Set(Qi.value.map(O=>String(O.id)))),pa=O=>typeof O=="number"?Number.isFinite(O):typeof O=="string"&&O.trim()!==""?Number.isFinite(Number(O)):!1,lc=O=>{const q=O?.selection?.selectionBounds;return!!q&&pa(q.top)&&pa(q.left)&&pa(q.right)&&pa(q.bottom)},Du=O=>{const q=O?.fileId??O?.documentId??O?.selection?.documentId;return q!=null?String(q):null},x=O=>{const q=Df.value;if(!q.size)return!1;const Se=Du(O);return Se?q.has(Se):q.size===1},D=O=>O?.selection?.source==="pdf"&&lc(O)&&x(O),ee=Ae(()=>{if(!Br.value)return!1;const O=Z.value.some(Se=>D(Se)),q=D(B.value);return O||q}),ie=Ae(()=>{const O=Ct.value?.displayMode??"sidebar";return!p_.has(O)||O==="sidebar"?!0:O==="inline"?!1:O!=="auto"?!0:!kt.value}),se=Ae(()=>Ot.value&&!yn.value&&!ee.value||!ot.value||!ie.value?!1:B.value||(Z.value.length>0||Ne.value)&&l.value&&Mt.value&&ei.value&&!N.value),de=Ae(()=>{if(se.value||!ei.value)return null;if(B.value)return B.value;if(!z.value)return null;const O=_t(z.value)??null;return Ot.value&&ie.value&&O?.trackedChange&&!ee.value?null:O}),{compactCommentPopoverStyle:pe,closeCompactCommentPopover:ve,resetClickAnchor:qe}=P9({activeComment:z,pendingComment:B,activeCompactComment:de,showCommentsSidebar:se,superdocRoot:pt,layers:Mt,documents:a,resolveCommentPositionEntry:be,selectionPosition:c,activeZoom:h,clearActiveComment:()=>s.setActiveComment(F.$superdoc,null),clearPendingComment:()=>s.removePendingComment(F.$superdoc)}),Xe=Ae(()=>ei.value?c.value&&Ht.top&&!R.value?.readOnly:!1);Ae(()=>ei.value?!R.value?.readOnly&&c.value:!1),Pt(se,O=>{F.$superdoc.broadcastSidebarToggle(O)}),OR({getSuperdoc:()=>F.$superdoc,superdocContainerWidth:Ke,isReady:l,activeZoom:h,zoomMode:m,viewportMetrics:g,showCommentsSidebar:se,rightSidebarRef:zt,superdocRoot:pt,documents:a});const et=O=>{F.$superdoc.scrollToComment(O)},st=()=>{rc()};Rn(()=>{document.addEventListener("contextmenu",ic,!0),document.addEventListener("keydown",yo,!0),F.$superdoc?.on?.("search:open",Fn),Yy(on),pt.value?.addEventListener("pointerdown",Dn,!0),pt.value?.addEventListener("focusin",Dn,!0),typeof window<"u"&&(window.addEventListener("scroll",st,!0),window.addEventListener("resize",st,!0)),document.addEventListener("focusin",Eu,!0),document.addEventListener("pointerdown",oc,!0),document.addEventListener("mousedown",Mi,!0),document.addEventListener("pointerup",yi,!0),document.addEventListener("mouseup",yi,!0),document.addEventListener("selectionchange",yi),F.$superdoc?.on?.("document-mode-change",bs),Ut(),Ft()}),Pt(ot,O=>{Ot.value&&(O?hn.value&&ul(hn.value):(s.clearEditorCommentPositions?.(),yn.value=!1))}),Pt(Mt,()=>{rc()});function yt(O){return(O.metaKey||O.ctrlKey)&&!O.altKey&&O.key?.toLowerCase?.()==="f"}function gt(O){return(O.metaKey||O.ctrlKey)&&O.shiftKey&&!O.altKey&&(O.code==="Digit8"||O.key==="8"||O.key==="*")}function it(){const O=pt.value,q=document.activeElement;if(!(q instanceof Node))return!1;if(O?.contains(q))return!0;const Se=F.$superdoc?.activeEditor?.view?.dom;return Se instanceof Node&&(q===Se||Se.contains?.(q))}const on={};function nn(O){yt(O)&&xe.value&&sM(O,{focusInside:it(),owner:on})&&Et.wouldOpen()&&(O.preventDefault(),O.stopPropagation(),Yy(on),Et.open())}function Dn(){Yy(on)}function Fn(){xe.value&&Et.open()}function jn(O){gt(O)&&(Ot.value||it()&&(O.preventDefault(),O.stopPropagation(),F.$superdoc.toggleFormattingMarks?.()))}function yo(O){if(O.key==="Escape"&&de.value){O.preventDefault(),O.stopPropagation(),ve();return}nn(O),!O.defaultPrevented&&jn(O)}function er(O){nn(O),!O.defaultPrevented&&jn(O)}rr(()=>{s.cancelImportedTrackedChangeBootstrap?.(),T.destroy(),Et.destroy(),xt.destroy(),Xr(),aa();for(const O of Array.from(cn.keys()))qr(O);for(const O of Array.from(Fr.keys()))sa(O);for(const O of Array.from(go.keys()))Ho(O);cn.clear(),$t.clear(),document.removeEventListener("contextmenu",ic,!0),document.removeEventListener("keydown",yo,!0),F.$superdoc?.off?.("search:open",Fn),pt.value?.removeEventListener("pointerdown",Dn,!0),pt.value?.removeEventListener("focusin",Dn,!0),oM(on),typeof window<"u"&&(window.removeEventListener("scroll",st,!0),window.removeEventListener("resize",st,!0)),Oe&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(Oe),Oe=0),hl(),nc.clear(),document.removeEventListener("focusin",Eu,!0),document.removeEventListener("pointerdown",oc,!0),document.removeEventListener("mousedown",Mi,!0),document.removeEventListener("pointerup",yi,!0),document.removeEventListener("mouseup",yi,!0),document.removeEventListener("selectionchange",yi),F.$superdoc?.off?.("document-mode-change",bs)});const En=ne(null),ur=ne(!1),mt=Ae(()=>{if(!c.value||c.value.source==="document-editor")return{x:null,y:null};const O=c.value.source==="pdf"?(h.value??100)/100:1,q=c.value.top*O,Se=c.value.left*O,Pe=c.value.right*O,ht=c.value.bottom*O;return{zIndex:500,borderRadius:"4px",top:q+"px",left:Se+"px",height:Math.abs(q-ht)+"px",width:Math.abs(Se-Pe)+"px"}}),Lt=O=>{if(ue()&&!we()){Pn();return}if(!O.selectionBounds||!ei.value)return;Pn();const q=window.matchMedia("(max-width: 768px)").matches;if(Nr({startX:O.selectionBounds.left,startY:O.selectionBounds.top,x:O.selectionBounds.right,y:O.selectionBounds.bottom,source:O.source}),!c.value)return;const Se=Math.abs(c.value.left-c.value.right)>5,Pe=Math.abs(c.value.top-c.value.bottom)>5;if(!Se||!Pe){En.value?.style&&(En.value.style.pointerEvents="none"),Pn();return}d.value=O;const ht=O.source==="pdf"||O.source?.value==="pdf"?(h.value??100)/100:1;Ht.top=O.selectionBounds.top*ht+"px",Ht.right=q?"0":"-25px"},Pn=()=>{c.value=null,Ht.top=null},Nr=({startX:O,startY:q,x:Se,y:Pe,source:ht,page:sn})=>{if(!(typeof O=="number"||typeof q=="number")&&!(typeof Se=="number"||typeof Pe=="number")){Pn();return}if(!c.value){if(q==null||O==null)return;c.value={top:q,left:O,right:O,bottom:q,startX:O,startY:q,source:ht,page:sn??null}}typeof O=="number"&&(c.value.startX=O),typeof q=="number"&&(c.value.startY=q),typeof Pe=="number"&&(Pe<c.value.startY?c.value.top=Pe:c.value.bottom=Pe),typeof Se=="number"&&(Se<c.value.startX?c.value.left=Se:c.value.right=Se)},wr=O=>{const q=O?.clientX,Se=O?.clientY;if(typeof q!="number"||typeof Se!="number")return null;const Pe=document.elementsFromPoint(q,Se).find(ht=>ht?.dataset?.pdfPage!=null);if(Pe){const ht=Number(Pe.dataset?.pageNumber);return Number.isFinite(ht)?ht:null}return null},vl=O=>{Pn(),En.value.style.pointerEvents="auto",St(()=>{ur.value=!0,En.value.style.pointerEvents="none";const q=wr(O);if(En.value.style.pointerEvents="auto",!q){ur.value=!1,En.value.style.pointerEvents="none";return}const Se=En.value.getBoundingClientRect(),Pe=h.value/100;Nr({startX:(O.clientX-Se.left)/Pe,startY:(O.clientY-Se.top)/Pe,page:q,source:"pdf"}),En.value.addEventListener("mousemove",yl)})},yl=O=>{if(!ur.value)return;const q=En.value.getBoundingClientRect(),Se=h.value/100;Nr({x:(O.clientX-q.left)/Se,y:(O.clientY-q.top)/Se})},zr=O=>{if(!ur.value||(En.value.removeEventListener("mousemove",yl),!c.value))return;const q=c.value.page??wr(O);Lt(Yd({selectionBounds:{top:c.value.top,left:c.value.left,right:c.value.right,bottom:c.value.bottom},page:q??1,documentId:a.value[0].id,source:"pdf"})),En.value.style.pointerEvents="none"},ti=Ae(()=>{if(!F.$superdoc.uiConfig.comments.enabled)return!1;const O=F.$superdoc.config.modules?.comments;return!O||O===!1?!1:!O.readOnly}),Li=ne(!1),wi=O=>O&&typeof O=="object"&&"value"in O?O.value:O,ma=O=>{if(!Ot.value||!O||O.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||F.$superdoc.config.viewOptions?.layout==="web"||F.$superdoc.uiConfig.ruler.suppressed||!wi(O.rulers)||!Li.value)return!1;const q=F.$superdoc?.activeEditor;if(!q||q.editorVersion!==2)return!1;const Se=wi(O.id),Pe=q.documentId??q.options?.documentId??null;return Se&&Pe&&Se!==Pe?!1:!!(q.pageMetrics&&q.pageLayout)},Mr=ne({});let ws=null,Di=null;const Cs=()=>{const O=F.$superdoc?.config?.rulerContainer;return O?typeof O=="string"?(typeof document<"u"?document:globalThis.document)?.querySelector(O)??null:typeof HTMLElement<"u"&&O instanceof HTMLElement?O:null:null},Pi=()=>{const O=F.$superdoc?.activeEditor?.documentId??F.$superdoc?.activeEditor?.options?.documentId??null,q=O==null?qi:Do.get(String(O))??null;return q?.isConnected?(Array.from(q.children).find(Se=>Se.dataset?.v2PaintWrapper==="true")??q).getBoundingClientRect():null},ao=()=>{if(!Ot.value){Mr.value={};return}const O=Cs();if(!O){Mr.value={};return}const q=Pi();if(!q){Mr.value={};return}const Se=O.getBoundingClientRect(),Pe=Math.max(0,q.left-Se.left),ht=Math.max(0,Se.right-q.right);Mr.value={paddingLeft:`${Pe}px`,paddingRight:`${ht}px`}},Po=()=>{try{ws?.disconnect()}catch{}ws=null;try{Di?.disconnect()}catch{}Di=null},cc=()=>{if(Po(),typeof ResizeObserver>"u")return;const O=Mt.value,q=Cs();O&&(ws=new ResizeObserver(()=>ao()),ws.observe(O)),q&&(Di=new ResizeObserver(()=>ao()),Di.observe(q))},ga=(O,q)=>{!O||!q||(O.documentMarginsLastChange=q.pageMargins??null,F.$superdoc.emit("page-margins-change",{documentId:O.id,editorVersion:2,sectionId:q.sectionId,sectionIndex:q.sectionIndex,side:q.side,value:q.value,pageMargins:q.pageMargins}))},uc=O=>{ei.value&&(Pn(),ur.value=!0,vl(O))},bt=({selectionBounds:O,documentId:q,page:Se})=>{!O||!q||Lt(Yd({selectionBounds:O,documentId:q,page:Se,source:"pdf"}))},va=O=>{Mt.value?.querySelectorAll(".superdoc__sub-document")?.forEach(q=>{q.querySelector(".sd-pdf-viewer")||(O===1?(q.style.transformOrigin="",q.style.transform="",q.style.width=""):(q.style.transformOrigin="top left",q.style.transform=`scale(${O})`,q.style.width=`${100/O}%`))})};let jt=!1;const _s=()=>{if(jt||F.$superdoc.config.useLayoutEngine!==!1)return;const O=(h.value??100)/100;O!==1&&(jt=!0,St(()=>va(O)))};Pt(()=>h.value,O=>{const q=(O??100)/100,Se=O??100,Pe=F.$superdoc?.activeEditor?.pageMetrics??null;if(Ot.value&&F.$superdoc?.activeEditor?.editorVersion===2&&Pe?.setZoom)try{Pe.setZoom(Se)}catch(ht){console.warn("[SuperDoc][v2] setZoom failed",ht)}else jt=!0,va(q);wl()?.updateScale(q),St(()=>{Qr(),bl()})}),Pt(Z,()=>{le.value||(le.value=!0)});const{whiteboardModuleConfig:Pu,whiteboard:Ou,whiteboardPages:Fu,whiteboardPageSizes:Zt,whiteboardPageOffsets:Mn,whiteboardEnabled:zn,whiteboardOpacity:Go,handleWhiteboardPageReady:lo,updateWhiteboardPageSizes:Qr,updateWhiteboardPageOffsets:bl}=JR({proxy:F,layers:Mt,documents:a,modules:w}),wl=()=>Array.isArray(ln.value)?ln.value[0]:ln.value,Z0=Ae(()=>Br.value&&!!Pu.value),J0=Ae(()=>zn.value);return(O,q)=>(me(),ke("div",{ref_key:"superdocRoot",ref:pt,class:en(["superdoc",{"superdoc--with-sidebar":se.value,"superdoc--web-layout":We(F).$superdoc.config.viewOptions?.layout==="web","superdoc--contained":We(F).$superdoc.config.contained,"high-contrast":We(W)}]),style:gn(Kt.value),onKeydown:er},[bn.value?(me(),ke("p",MD,Nt(bn.value),1)):ut("",!0),Me("div",{class:"superdoc__layers layers",ref_key:"layers",ref:Mt,role:"group"},[Xe.value?(me(),ke("div",{key:0,class:"superdoc__tools tools",style:gn(Ht)},[Me("div",{class:"tools-item","data-id":"is-tool",onMousedown:q[0]||(q[0]=Jt(Se=>yr("comments"),["stop","prevent"]))},[Me("div",{class:"superdoc__tools-icon",innerHTML:We(Qs).comment},null,8,LD)],32)],4)):ut("",!0),Me("div",DD,[ei.value?(me(),ke("div",{key:0,class:"superdoc__selection-layer selection-layer",onMousedown:vl,onMouseup:zr,ref_key:"selectionLayer",ref:En},[We(c)&&ti.value?(me(),ke("div",{key:0,style:gn(mt.value),class:"superdoc__temp-selection temp-selection sd-highlight sd-initial-highlight"},null,4)):ut("",!0)],544)):ut("",!0),(me(!0),ke(qt,null,nr(We(a),Se=>(me(),ke("div",{class:"superdoc__sub-document sub-document",key:`${Se.id}:${Se.editorMountNonce}`,ref_for:!0,ref:Pe=>hi(Se,Pe)},[Se.type===We("application/pdf")?(me(),dn(We(n),{key:0,file:Se.data,"file-id":Se.id,"initial-scale":(We(h)??100)/100,config:We(Un),onSelectionRaw:bt,onBypassSelection:uc,onPageRendered:We(lo),onDocumentReady:q[1]||(q[1]=({documentId:Pe,viewerContainer:ht})=>rn(Pe,ht)),ref_for:!0,ref_key:"pdfViewerRef",ref:ln},null,8,["file","file-id","initial-scale","config","onPageRendered"])):ut("",!0),Se.type===We("application/vnd.openxmlformats-officedocument.wordprocessingml.document")&&We(G)&&ma(Se)?(me(),ke(qt,{key:1},[We(F).$superdoc.config.rulerContainer?(me(),dn(Ra,{key:0,to:We(F).$superdoc.config.rulerContainer},[Me("div",{class:"v2-ruler-host",style:gn(Mr.value)},[Wt(We(G),{"page-layout":We(F).$superdoc.activeEditor.pageLayout,"measurement-unit":We(p),onPageMarginsChange:Pe=>ga(Se,Pe)},null,8,["page-layout","measurement-unit","onPageMarginsChange"])],4)],8,["to"])):(me(),ke("div",{key:1,class:"v2-ruler-host",style:gn(Mr.value)},[Wt(We(G),{"page-layout":We(F).$superdoc.activeEditor.pageLayout,"measurement-unit":We(p),onPageMarginsChange:Pe=>ga(Se,Pe)},null,8,["page-layout","measurement-unit","onPageMarginsChange"])],4))],64)):ut("",!0),Se.type===We("application/vnd.openxmlformats-officedocument.wordprocessingml.document")?(me(),dn(We(V),{key:2,"file-source":Se.data,"document-id":Se.id,options:Ru(Se),"measurement-unit":We(p),onV2EditorReady:gi,onV2EditorFailed:da,onV2Render:Ef,onV2RenderCleared:ku,onV2RenderReadiness:vs,onV2SelectionChanged:yu,onV2HostEvent:Pe=>xf(Se,Pe),onV2LinkClick:Tf,onV2PageMetrics:Su},null,8,["file-source","document-id","options","measurement-unit","onV2HostEvent"])):ut("",!0),Se.type===We("text/html")?(me(),dn(m9,{key:3,onReady:q[2]||(q[2]=Pe=>rn(Pe,null)),onSelectionChange:Lt,"file-source":Se.data,"document-id":Se.id},null,8,["file-source","document-id"])):ut("",!0)]))),128)),Z0.value?(me(),dn(r9,{key:1,class:"superdoc__whiteboard-layer",whiteboard:We(Ou),pages:We(Fu),"page-sizes":We(Zt),"page-offsets":We(Mn),enabled:We(zn),interactive:J0.value,opacity:We(Go)},null,8,["whiteboard","pages","page-sizes","page-offsets","enabled","interactive","opacity"])):ut("",!0),Lf.value?(me(),dn(ZR,{key:2,onAnchorActivate:To})):ut("",!0)])],512),se.value?(me(),ke("div",{key:1,ref_key:"rightSidebarRef",ref:zt,class:"superdoc__right-sidebar right-sidebar"},[Me("div",PD,[We(le)&&(Z.value.length>0||We(B))?(me(!0),ke(qt,{key:0},nr(We(M),Se=>(me(),dn(GR,{parent:Mt.value,"current-document":Se},null,8,["parent","current-document"]))),256)):ut("",!0)])],512)):ut("",!0),de.value?(me(),ke("div",{key:2,class:"superdoc__compact-comment-popover",style:gn(We(pe))},[Wt(pp,{comment:de.value,parent:Mt.value},null,8,["comment","parent"])],4)):ut("",!0),Wt(vD,{"geometry-target":Mt.value},null,8,["geometry-target"])],38))}},ND=fn(BD,[["__scopeId","data-v-2a7bfa95"]]);It();var KS="devtools-plugin:setup",qS="dev.esm.pinia",an={disabledAppRefCounts:new Map,hook:null,originalHookEmit:null,isHookPropertyPatched:!1,originalHookPropertyDescriptor:null,hookPropertyValue:void 0,isQueuePropertyPatched:!1,originalQueuePropertyDescriptor:null,queuePropertyValue:void 0,queue:null,originalQueuePush:null},YS=(e,t)=>e===KS&&t?.id===qS&&t?.app&&an.disabledAppRefCounts.has(t.app),zD=e=>Array.isArray(e)&&YS(KS,e[0]),HD=e=>{if(an.isQueuePropertyPatched){an.queuePropertyValue=e;return}globalThis.__VUE_DEVTOOLS_PLUGINS__=e},UD=e=>{const t=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(Array.isArray(t))for(let n=t.length-1;n>=0;n--){const[r]=t[n];r?.id===qS&&r?.app===e&&t.splice(n,1)}},XS=()=>{const{queue:e,originalQueuePush:t}=an;e&&typeof t=="function"&&(e.push=t),an.queue=null,an.originalQueuePush=null},QS=()=>{const{hook:e,originalHookEmit:t}=an;e&&typeof t=="function"&&(e.emit=t),an.hook=null,an.originalHookEmit=null},tf=()=>{const e=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(e==null){HD([]),tf();return}if(!Array.isArray(e))return;const t=e;if(an.queue===t)return;XS();const n=t.push;typeof n=="function"&&(an.queue=t,an.originalQueuePush=n,t.push=function(...o){const i=o.filter(s=>!zD(s));return i.length===0?this.length:n.apply(this,i)})},VD=()=>{if(an.isQueuePropertyPatched){tf();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_PLUGINS__");if(e?.configurable===!1){tf();return}an.originalQueuePropertyDescriptor=e??null,an.queuePropertyValue=globalThis.__VUE_DEVTOOLS_PLUGINS__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return an.queuePropertyValue},set(t){an.queuePropertyValue=t,tf()}}),an.isQueuePropertyPatched=!0,tf()},jD=()=>{if(!an.isQueuePropertyPatched)return;const{queuePropertyValue:e,originalQueuePropertyDescriptor:t}=an;delete globalThis.__VUE_DEVTOOLS_PLUGINS__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_PLUGINS__=e),an.isQueuePropertyPatched=!1,an.originalQueuePropertyDescriptor=null,an.queuePropertyValue=void 0},_p=()=>{const e=globalThis?.__VUE_DEVTOOLS_GLOBAL_HOOK__;if(!e||typeof e.emit!="function"||an.hook===e)return;QS();const t=e.emit;an.hook=e,an.originalHookEmit=t,e.emit=function(r,...o){const[i]=o;if(!YS(r,i))return t.call(this,r,...o)}},GD=()=>{if(an.isHookPropertyPatched){_p();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__");if(e?.configurable===!1){_p();return}an.originalHookPropertyDescriptor=e??null,an.hookPropertyValue=globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return an.hookPropertyValue},set(t){an.hookPropertyValue=t,_p()}}),an.isHookPropertyPatched=!0,_p()},WD=()=>{if(!an.isHookPropertyPatched)return;const{hookPropertyValue:e,originalHookPropertyDescriptor:t}=an;delete globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__=e),an.isHookPropertyPatched=!1,an.originalHookPropertyDescriptor=null,an.hookPropertyValue=void 0},KD=()=>{an.disabledAppRefCounts.size>0||(QS(),WD(),XS(),jD())},qD=(e,t)=>{if(!t)return()=>{};const n=an.disabledAppRefCounts.get(e)??0;return an.disabledAppRefCounts.set(e,n+1),GD(),VD(),()=>{const r=an.disabledAppRefCounts.get(e);r&&(r===1?an.disabledAppRefCounts.delete(e):an.disabledAppRefCounts.set(e,r-1),KD())}};const YD=({disablePiniaDevtools:e=!1}={})=>{const t=Bl(ND),n=f6(),r=qD(t,e);let o,i,s;try{t.use(n),e&&UD(t),t.directive("click-outside",Dv),o=eu(),i=Xs(),s=Hi()}catch(a){throw r(),a}if(typeof t.unmount=="function"){const a=t.unmount.bind(t);t.unmount=(...l)=>(r(),a(...l))}return{app:t,pinia:n,superdocStore:o,commentsStore:i,highContrastModeStore:s}};var XD={docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pdf:"application/pdf",zip:"application/zip",html:"text/html",txt:"text/plain;charset=utf-8",json:"application/json"},QD=e=>!e||typeof e.toLowerCase!="function"?"application/octet-stream":XD[e.toLowerCase()]||"application/octet-stream",ZD=(e,t)=>{if(e instanceof Blob)return e;const n=QD(t);if(e instanceof ArrayBuffer)return new Blob([e],{type:n});if(ArrayBuffer.isView(e)){const{buffer:r,byteOffset:o,byteLength:i}=e,s=r.slice(o,o+i);return new Blob([s],{type:n})}if(typeof e=="string")return new Blob([e],{type:n});throw e==null?new TypeError("createDownload requires a Blob, ArrayBuffer, or ArrayBufferView."):new TypeError(`Cannot create download from value of type ${typeof e}`)};const ZS=(e,t,n)=>{const r=ZD(e,n);if(typeof URL>"u"||typeof URL.createObjectURL!="function"||typeof document>"u"||typeof document.createElement!="function")return r;const o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${t}.${n}`;const s=document.body&&typeof document.body.appendChild=="function";return s&&document.body.appendChild(i),i.click(),s&&document.body.removeChild(i),typeof URL.revokeObjectURL=="function"&&setTimeout(()=>URL.revokeObjectURL(o),0),r},JS=e=>{const t=e.toLowerCase();return t.endsWith(".docx")?e.slice(0,-5):t.endsWith(".pdf")?e.slice(0,-4):e};var JD=class{#t=new Map;#n=1;idFor(e){const t=this.#t.get(e);if(t!==void 0)return t;const n=this.#n++;return this.#t.set(e,n),n}has(e){return this.#t.has(e)}};function $D(e){const t=typeof e.email=="string"&&e.email.length>0?e.email:null;return t?`email:${t}`:`label:${e.actorLabel}`}function eP(e,t){const n=e.displayName??null,r=e.email??null,o={clientId:t};return n&&(o.name=n),r&&(o.email=r),typeof e.color=="string"&&e.color.length>0&&(o.color=e.color),o}function tP(e){const t={clientId:0};e?.id!=null&&(t.id=e.id),e?.name!=null&&(t.name=e.name),e?.email!=null&&(t.email=e.email);const n=e?.color;return typeof n=="string"&&n.length>0&&(t.color=n),t}function nP(e){const t=new JD;let n=new Set;return{registry:t,next(r){const o=[],i=new Set,s=new Set;for(const u of r.remoteActors){const c=$D(u);if(s.has(c))continue;s.add(c);const d=t.idFor(c);i.add(d),o.push(eP(u,d))}const a=[];for(const u of i)n.has(u)||a.push(u);const l=[];for(const u of n)i.has(u)||l.push(u);return n=i,{states:[tP(e()),...o],added:a,removed:l}}}}var rP=class{#t=new Map;on(e,t){const n=this.#t.get(e);n?n.push(t):this.#t.set(e,[t])}emit(e,...t){const n=this.#t.get(e);if(n)for(const r of n)r.apply(this,t)}off(e,t){const n=this.#t.get(e);n&&(t?this.#t.set(e,n.filter(r=>r!==t)):this.#t.delete(e))}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};this.on(e,n)}removeAllListeners(){this.#t=new Map}};function oP(e){return e.flatMap(t=>[t[0],t[1]])}function $S(e="id"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function e4(e={}){const{value:t="",left:n,top:r,width:o,height:i,fontSize:s=16,fontFamily:a="Arial, sans-serif",color:l="#000",background:u="transparent",resize:c="none"}=e,d=document.createElement("textarea");d.value=t;const h=d.style;return h.position="absolute",n!=null&&(h.left=`${n}px`),r!=null&&(h.top=`${r}px`),o!=null&&(h.width=typeof o=="number"?`${o}px`:o),i!=null&&(h.height=typeof i=="number"?`${i}px`:i),h.minWidth=120,h.fontSize=typeof s=="number"?`${s}px`:s,h.fontFamily=a,h.color=l,h.background=u,h.border="2px solid #3c97fe80",h.padding="2px 4px",h.margin="0",h.zIndex="1000",h.overflow="hidden",h.resize=c,h.outline="none",d}var Sp=18,iP=class{pageIndex=null;strokes=[];text=[];images=[];size=null;originalSize=null;#t=null;#n=null;#e=null;#i=null;#s=null;#a=null;#u=new Set;#d=!1;#l=null;#f=[];#m=null;#o="select";#r=!1;#p=null;#y="#2293fb";#w=5;#_=null;#S=null;constructor(e){this.#E(e)}#E(e){this.#t=e.Renderer,this.#r=e.enabled,this.pageIndex=e.pageIndex,this.#_=e.onChange,this.#S=e.onToolChange}#x(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{xN:e/n,yN:t/r}}#M(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{x:e*n,y:t*r}}#c(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{wN:e/n,hN:t/r}}#L(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{width:e*n,height:t*r}}#T(e){const{width:t=1,height:n=1}=this.size||{};return{points:(Array.isArray(e.pointsN)?e.pointsN:[]).map(r=>[r[0]*t,r[1]*n]),strokeWidth:Number.isFinite(e.widthN)?e.widthN*((t+n)/2):this.#w}}#D(e){const{width:t=1,height:n=1}=this.size||{};return{pointsN:(Array.isArray(e.points)?e.points:[]).map(r=>[r[0]/t,r[1]/n]),widthN:Number.isFinite(e.width)?e.width/((t+n)/2):void 0}}#k(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,fontSize:Number.isFinite(e.fontSizeN)?e.fontSizeN*n:Sp}}#g(e){const{width:t=1,height:n=1}=this.size||{},r=this.originalSize?.height??n;return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,fontSizeN:Number.isFinite(e.fontSize)?e.fontSize/r:Sp/r}}#j(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,height:Number.isFinite(e.heightN)?e.heightN*n:void 0}}#G(e){const{width:t=1,height:n=1}=this.size||{};return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,heightN:Number.isFinite(e.height)?e.height/n:null}}#P(){const e=this.size?.width,t=this.originalSize?.width??e;return!Number.isFinite(e)||!Number.isFinite(t)||!t?1:e/t}#O(){!this.#n||!this.#e||(this.#n.on("mousedown touchstart",e=>{this.#Y(e)}),this.#n.on("mousemove touchmove",e=>{this.#X(e)}),this.#n.on("mouseup touchend",e=>{this.#I(e)}),this.#n.on("click tap",e=>{this.#R(e)}),window.addEventListener("keydown",this.#q))}setTool(e){this.#o=e,this.#C(),this.#A(),this.render()}getTool(){return this.#o}setEnabled(e){this.#r=!!e,this.#C(),this.#A(),this.render()}isEnabled(){return this.#r}setSize(e){if(!e)return;const{width:t,height:n,originalWidth:r,originalHeight:o}=e;this.size={width:t,height:n},this.originalSize={width:r??null,height:o??null}}resize(e,t){this.#n&&(this.#n.size({width:e,height:t}),this.#F(),this.render())}mount(e){if(!e||this.#n&&this.#a===e)return;this.#n&&this.destroy();const t=this.size?.width||e.clientWidth||1,n=this.size?.height||e.clientHeight||1;this.#a=e,this.#n=new this.#t.Stage({container:e,width:t,height:n}),this.#e=new this.#t.Layer,this.#i=new this.#t.Layer,this.#n.add(this.#e),this.#n.add(this.#i),this.#F(),this.#C(),this.#O(),this.render()}render(){this.#e&&(this.#s&&(this.#s.destroy(),this.#s=null),this.#e.find(".wb-text").forEach(e=>e.destroy()),this.#i.destroyChildren(),this.renderStrokes(),this.renderText(),this.renderImages(),this.#e.batchDraw(),this.#i.batchDraw())}#F(){const e=Math.min(window.devicePixelRatio||1,1.5);this.#e?.getCanvas&&this.#e.getCanvas().setPixelRatio(e),this.#i?.getCanvas&&this.#i.getCanvas().setPixelRatio(e)}#C(){if(!this.#i)return;const e=this.#o==="draw"||this.#o==="erase",t=!!(this.#r&&e);this.#i.listening(t)}renderStrokes(){this.strokes.forEach(e=>{const{points:t,strokeWidth:n}=this.#T(e),r=new this.#t.Line({points:oP(t),stroke:e.color||this.#y,strokeWidth:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:e.type==="erase"?"destination-out":"source-over"});r.name("wb-stroke"),this.#i.add(r)})}renderText(){this.text.forEach(e=>{const{x:t,y:n,width:r,fontSize:o}=this.#k(e),i=new this.#t.Text({x:t,y:n,text:e.content,fontSize:o,fontFamily:"Arial, sans-serif",fill:"#2293fb",draggable:this.#o==="select",width:r});i.name("wb-text"),i._whiteboardId=e.id,this.#W(i,e),this.#e.add(i)})}#W(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#r||(n.cancelBubble=!0,this.#B(e))}),e.on("dragend",()=>{const{xN:n,yN:r}=this.#g({x:e.x(),y:e.y(),fontSize:t.fontSizeN?t.fontSizeN*(this.size?.height||1):Sp,width:t.widthN?t.widthN*(this.size?.width||1):null});t.xN=n,t.yN=r,this.#v()}),e.on("transform",()=>{e.scaleY(1),e.setAttrs({width:e.width()*e.scaleX(),scaleX:1})}),e.on("transformend",()=>{e.setAttrs({width:Math.max(1,e.width()*e.scaleX()),scaleX:1,scaleY:1});const n=e.width(),r=this.size?.width||1;t.widthN=n/r,t.xN=e.x()/r,t.yN=e.y()/(this.size?.height||1),this.#v()}),e.on("dblclick dbltap",n=>{this.#o!=="select"||!this.#r||(n.cancelBubble=!0,this.#z(e,t))})}renderImages(){const e=this.#e?.find(".wb-image")??[],t=new Map;e.forEach(o=>{t.set(o._whiteboardId,o)});const n=new Set(this.images.map(o=>o.id));e.forEach(o=>{n.has(o._whiteboardId)||o.destroy()});const r=(o,i)=>{const{x:s,y:a,width:l,height:u}=this.#j(o),c=t.get(o.id);if(c){Number.isFinite(s)&&c.x(s),Number.isFinite(a)&&c.y(a),Number.isFinite(l)&&c.width(l),Number.isFinite(u)&&c.height(u),c.draggable(this.#o==="select");return}if(this.#u.has(o.id))return;this.#u.add(o.id);const d=new window.Image;d.crossOrigin="Anonymous",d.onload=()=>{if(t.get(o.id)){this.#u.delete(o.id);return}if(!this.#e){this.#u.delete(o.id);return}const h=new this.#t.Image({x:s,y:a,image:d,width:l??d.width,height:u??d.height,draggable:this.#o==="select"});h.name(i),h._whiteboardId=o.id,this.#K(h,o),this.#e.add(h),this.#e.batchDraw(),this.#u.delete(o.id)},d.onerror=()=>{this.#u.delete(o.id)},d.src=o.src};this.images.forEach(o=>r(o,"wb-image"))}#K(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#r||(n.cancelBubble=!0,this.#B(e))}),e.on("dragend",()=>{const n=this.size?.width||1,r=this.size?.height||1;t.xN=e.x()/n,t.yN=e.y()/r,this.#v()}),e.on("transformend",()=>{const n=e.scaleX(),r=e.scaleY(),o=Math.max(1,e.width()*n),i=Math.max(1,e.height()*r);e.scale({x:1,y:1}),e.width(o),e.height(i);const s=this.size?.width||1,a=this.size?.height||1;t.widthN=o/s,t.heightN=i/a,t.xN=e.x()/s,t.yN=e.y()/a,this.#v()})}destroy(){this.#n&&this.#n.destroy(),this.#n=null,this.#e=null,this.#i=null,this.#a=null,this.#d=!1,this.#l=null,this.#f=[],this.#p=null,this.#s=null,window.removeEventListener("keydown",this.#q)}toJSON(){return{strokes:this.strokes,text:this.text,images:this.images}}applyData(e={}){const t=Array.isArray(e.strokes)?e.strokes:[],n=Array.isArray(e.text)?e.text:[],r=Array.isArray(e.images)?e.images:[];this.strokes=t,this.text=n,this.images=r,this.render()}#v(){this.#_&&this.#_()}addStroke(e){if(!e||!Array.isArray(e.points))return;const{pointsN:t,widthN:n}=this.#D(e);this.strokes.push({pointsN:t,widthN:n,color:e.color,type:e.type})}addText(e){if(!e||typeof e.content!="string")return;const{xN:t,yN:n,widthN:r,fontSizeN:o}=this.#g(e);this.text.push({id:e.id??$S("text"),xN:t,yN:n,content:e.content,fontSizeN:o,widthN:r}),this.render(),this.#v()}addImage(e){if(!e||!e.src)return;const{xN:t,yN:n,widthN:r,heightN:o}=this.#G(e),i={id:e.id??$S("image"),stickerId:e.stickerId??(e.type==="sticker"?e.id??null:null),xN:t,yN:n,src:e.src,widthN:r,heightN:o,type:e.type??"image"};this.images.push(i),this.render(),this.#v()}#A(){this.#s&&(this.#s.destroy(),this.#s=null,this.#p=null,this.#e?.batchDraw())}#B(e){if(!this.#e)return;this.#p=e;const t=e.name&&e.name()==="wb-text",n=t?["middle-left","middle-right"]:["top-left","top-right","bottom-left","bottom-right"],r=(o,i)=>i.width<20?o:t?{...i,height:o.height,y:o.y}:i.height<20?o:i;this.#s?(this.#s.nodes([e]),this.#s.enabledAnchors(n),this.#s.boundBoxFunc(r)):(this.#s=new this.#t.Transformer({nodes:[e],enabledAnchors:n,rotateEnabled:!1,keepRatio:!1,boundBoxFunc:r}),this.#e.add(this.#s)),this.#e.batchDraw()}#h(){if(!this.#p)return;const e=this.#p,t=e.name&&e.name(),n={"wb-text":()=>{const r=e._whiteboardId;this.text=this.text.filter(o=>o.id!==r)},"wb-image":()=>{const r=e._whiteboardId;this.images=this.images.filter(o=>o.id!==r)}}[t];n&&n(),e.destroy(),this.#A(),this.render()}#q=e=>{if(!this.#p||!this.#r||this.#o!=="select")return;const t=e.target?.tagName;t==="INPUT"||t==="TEXTAREA"||(e.key==="Backspace"||e.key==="Delete")&&(e.preventDefault(),this.#h(),this.#v())};#R(e){if(!this.#r||!this.#n)return;const t={text:()=>{const n=this.#n.getPointerPosition();n&&this.#N(n.x,n.y)},select:()=>{e?.target===this.#n&&this.#A()}}[this.#o];t&&t()}#Y(){if(!this.#r||this.#o!=="draw"&&this.#o!=="erase")return;this.#d=!0;const e=this.#n.getPointerPosition();if(!e)return;const t=this.#o==="erase",n=this.#w*this.#P();this.#f=[e.x,e.y],this.#l=new this.#t.Line({points:this.#f,stroke:this.#y,strokeWidth:t?n*3:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:t?"destination-out":"source-over"}),this.#m=n,this.#i.add(this.#l)}#X(){if(!this.#r||this.#o!=="draw"&&this.#o!=="erase"||!this.#d||!this.#l)return;const e=this.#n.getPointerPosition();e&&(this.#f.push(e.x,e.y),this.#l.points(this.#f),this.#i.batchDraw())}#I(){if(!this.#r||this.#o!=="draw"&&this.#o!=="erase"||!this.#d||!this.#l)return;this.#d=!1;const e=[];for(let r=0;r<this.#f.length;r+=2)e.push([this.#f[r],this.#f[r+1]]);const t=this.#o==="erase",n=this.#m??this.#w;this.addStroke({points:e,color:this.#y,width:t?n*3:n,type:t?"erase":"draw"}),this.#v(),this.#l=null,this.#f=[],this.#m=null}#N(e,t){if(!this.#a)return;const n=Sp*this.#P(),r=e4({left:e,top:t,height:Math.ceil(n*1.4),background:"transparent",fontSize:n,color:"#2293fb"});this.#a.append(r),r.focus(),r.select();let o=!1;const i=()=>{if(o)return;o=!0;const s=r.value.trim();s&&(this.addText({x:e,y:t,content:s}),this.#o==="text"&&this.#S&&this.#S("select")),r.parentNode===this.#a&&this.#a.removeChild(r)};r.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i()),s.key==="Escape"&&(s.preventDefault(),i())}),r.addEventListener("blur",i)}#z(e,t){if(!this.#a||!this.#n)return;this.#A();const n=e.position(),r=e4({value:e.text(),left:n.x,top:n.y,width:Math.max(e.width(),120),height:Math.max(e.height(),24),fontSize:e.fontSize(),fontFamily:e.fontFamily(),color:e.fill?e.fill():"#2293fb",background:"white",resize:"both"});this.#a.appendChild(r),r.focus(),r.select();let o=!1;const i=()=>{if(o)return;o=!0;const s=r.value.trim();s&&(e.text(s),t.content=s,this.#e.batchDraw(),this.#v()),r.parentNode&&r.parentNode.removeChild(r)};r.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i()),s.key==="Escape"&&(s.preventDefault(),i())}),r.addEventListener("blur",i)}},sP=class extends rP{#t=null;#n=null;#e=new Map;#i=new Map;#s="select";#a=!1;#u=1;#d=null;#l=null;#f=null;constructor(e={}){super(),this.#m(e)}#m(e){this.#t=e.Renderer,this.#n=e.superdoc,this.#a=e.enabled,this.#d=e.onChange,this.#l=e.onSetData,this.#f=e.onEnabledChange}register(e,t){this.#i.set(e,t)}getType(e){return this.#i.get(e)}setTool(e){this.#s=e,this.#e.forEach(t=>t.setTool(e)),this.emit("tool",e)}getTool(){return this.#s}setEnabled(e){this.#a=e,this.#e.forEach(t=>t.setEnabled(this.#a)),this.emit("enabled",this.#a),this.#f&&this.#f(this.#a)}isEnabled(){return this.#a}setOpacity(e){const t=e;this.#u=Number.isFinite(t)?Math.min(1,Math.max(0,t)):1,this.emit("opacity",this.#u)}getOpacity(){return this.#u}getPages(){return Array.from(this.#e.values())}rerender(){this.#e.forEach(e=>e.render())}setPageSize(e,t){this.#o(e).setSize(t)}#o(e){const t=this.#e.get(e);if(t)return t;const n=new iP({Renderer:this.#t,enabled:this.#a,pageIndex:e,onChange:()=>{this.#r()},onToolChange:r=>{this.setTool(r)}});return n.setTool(this.#s),n.setEnabled(this.#a),this.#e.set(e,n),n}getPage(e){return this.#e.get(e)}getWhiteboardData(){const e={},t={};for(const n of this.#e.values())e[n.pageIndex]=n.toJSON(),n.size&&(t[n.pageIndex]={width:n.size.width,height:n.size.height,originalWidth:n.originalSize?.width??null,originalHeight:n.originalSize?.height??null});return{pages:e,meta:{pageSizes:t},version:1}}setWhiteboardData(e){this.#e.clear();const t=e?.pages||{};Object.keys(t).forEach(n=>{const r=Number(n),o=Number.isNaN(r)?n:r;this.#o(o).applyData(t[n])}),this.emit("setData",this.getPages()),this.#l&&this.#l(this.getPages()),this.#r()}#r(){const e=this.getWhiteboardData();this.emit("change",e),this.#d&&this.#d(e)}},aP=Math.PI/180;function lP(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Vl=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},vt={_global:Vl,version:"10.2.5",isBrowser:lP(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return vt.angleDeg?e*aP:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return vt.DD.isDragging},isTransforming(){var e,t;return(t=(e=vt.Transformer)===null||e===void 0?void 0:e.isTransforming())!==null&&t!==void 0?t:!1},isDragReady(){return!!vt.DD.node},releaseCanvasOnDestroy:!0,document:Vl.document,_injectGlobal(e){typeof Vl.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),Vl.Konva=e}},vr=e=>{vt[e.prototype.getClassName()]=e};vt._injectGlobal(vt);var cP=`Konva.js unsupported environment.
|
|
87
|
+
|
|
88
|
+
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
89
|
+
|
|
90
|
+
To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
|
|
91
|
+
|
|
92
|
+
bash: npm install canvas
|
|
93
|
+
js: import "konva/canvas-backend";
|
|
94
|
+
|
|
95
|
+
or
|
|
96
|
+
|
|
97
|
+
bash: npm install skia-canvas
|
|
98
|
+
js: import "konva/skia-backend";
|
|
99
|
+
`,t4=()=>{if(typeof document>"u")throw new Error(cP)},Vi=class HA{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new HA(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const n=this.m;return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]}}translate(t,n){return this.m[4]+=this.m[0]*t+this.m[2]*n,this.m[5]+=this.m[1]*t+this.m[3]*n,this}scale(t,n){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=n,this.m[3]*=n,this}rotate(t){const n=Math.cos(t),r=Math.sin(t),o=this.m[0]*n+this.m[2]*r,i=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,a=this.m[1]*-r+this.m[3]*n;return this.m[0]=o,this.m[1]=i,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,n){const r=this.m[0]+this.m[2]*n,o=this.m[1]+this.m[3]*n,i=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=s,this}multiply(t){const n=this.m[0]*t.m[0]+this.m[2]*t.m[1],r=this.m[1]*t.m[0]+this.m[3]*t.m[1],o=this.m[0]*t.m[2]+this.m[2]*t.m[3],i=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*t,r=-this.m[1]*t,o=-this.m[2]*t,i=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const t=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],i=this.m[4],s=this.m[5],a=t*o-n*r,l={x:i,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||n!=0){const u=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/u):-Math.acos(t/u),l.scaleX=u,l.scaleY=a/u,l.skewX=(t*r+n*o)/a,l.skewY=0}else if(r!=0||o!=0){const u=Math.sqrt(r*r+o*o);l.rotation=Math.PI/2-(o>0?Math.acos(-r/u):-Math.acos(r/u)),l.scaleX=a/u,l.scaleY=u,l.skewX=0,l.skewY=(t*r+n*o)/a}return l.rotation=Ie._getRotation(l.rotation),l}},uP="[object Array]",dP="[object Number]",fP="[object String]",hP="[object Boolean]",pP=Math.PI/180,mP=180/Math.PI,nf="#",gP="",vP="0",yP="Konva warning: ",n4="Konva error: ",bP="rgb(",r0={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},wP=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,kp=[],rf=null,CP=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)};const Ie={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===uP},_isNumber(e){return Object.prototype.toString.call(e)===dP&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===fP},_isBoolean(e){return Object.prototype.toString.call(e)===hP},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!="string")return!1;const t=e[0];return t==="#"||t==="."||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){kp.push(e),kp.length===1&&CP(function(){const t=kp;kp=[],t.forEach(function(n){n()})})},createCanvasElement(){t4();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return t4(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Ie.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(nf,gP);const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=vP+e;return nf+e},isCanvasFarblingActive(){if(rf!==null)return rf;if(typeof document>"u")return rf=!1,!1;const e=this.createCanvasElement();e.width=10,e.height=10;const t=e.getContext("2d",{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle="#282828",t.fillRect(0,0,10,10);const n=t.getImageData(0,0,10,10).data;let r=!1;for(let o=0;o<100;o++)if(n[o*4]!==40||n[o*4+1]!==40||n[o*4+2]!==40||n[o*4+3]!==255){r=!0;break}return rf=r,this.releaseCanvas(e),rf},getHitColor(){const e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),nf+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return nf+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in r0?(t=r0[e],{r:t[0],g:t[1],b:t[2]}):e[0]===nf?this._hexToRgb(e.substring(1)):e.substr(0,4)===bP?(t=wP.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e=e||"black",Ie._namedColorToRBA(e)||Ie._hex3ColorToRGBA(e)||Ie._hex4ColorToRGBA(e)||Ie._hex6ColorToRGBA(e)||Ie._hex8ColorToRGBA(e)||Ie._rgbColorToRGBA(e)||Ie._rgbaColorToRGBA(e)||Ie._hslColorToRGBA(e)},_namedColorToRBA(e){const t=r0[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];const t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];const t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let s,a,l;if(o===0)return l=i*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};i<.5?s=i*(1+o):s=i+o-i*o;const u=2*i-s,c=[0,0,0];for(let d=0;d<3;d++)a=r+1/3*-(d-1),a<0&&a++,a>1&&a--,6*a<1?l=u+(s-u)*6*a:2*a<1?l=s:3*a<2?l=u+(s-u)*(2/3-a)*6:l=u,c[d]=l*255;return{r:Math.round(c[0]),g:Math.round(c[1]),b:Math.round(c[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){const t={};for(const n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*pP},radToDeg(e){return e*mP},_degToRad(e){return Ie.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Ie.degToRad(e)},_radToDeg(e){return Ie.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Ie.radToDeg(e)},_getRotation(e){return vt.angleDeg?Ie.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(n4+e)},error(e){console.error(n4+e)},warn(e){vt.showWarnings&&console.warn(yP+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,o,i){let s,a,l;const u=(e-n)*(e-n)+(t-r)*(t-r);if(u==0)s=e,a=t,l=(o-n)*(o-n)+(i-r)*(i-r);else{const c=((o-e)*(n-e)+(i-t)*(r-t))/u;c<0?(s=e,a=t,l=(e-o)*(e-o)+(t-i)*(t-i)):c>1?(s=n,a=r,l=(n-o)*(n-o)+(r-i)*(r-i)):(s=e+c*(n-e),a=t+c*(r-t),l=(s-o)*(s-o)+(a-i)*(a-i))}return[s,a,l]},_getProjectionToLine(e,t,n){const r=Ie.cloneObject(e);let o=Number.MAX_VALUE;return t.forEach(function(i,s){if(!n&&s===t.length-1)return;const a=t[(s+1)%t.length],l=Ie._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],c=l[1],d=l[2];d<o&&(r.x=u,r.y=c,o=d)}),r},_prepareArrayForTween(e,t,n){const r=[],o=[];if(e.length>t.length){const s=t;t=e,e=s}for(let s=0;s<e.length;s+=2)r.push({x:e[s],y:e[s+1]});for(let s=0;s<t.length;s+=2)o.push({x:t[s],y:t[s+1]});const i=[];return o.forEach(function(s){const a=Ie._getProjectionToLine(s,r,n);i.push(a.x),i.push(a.y)}),i},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(const n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]=="object"){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||Ie._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Ie._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(const n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){vt.releaseCanvasOnDestroy&&e.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let o=t<0?t:0,i=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,a=0,l=0,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},c={x:l.x-a.x,y:l.y-a.y},d=Math.hypot(u.x,u.y),h=Math.hypot(c.x,c.y);let m;typeof o=="number"?m=o:m=i<o.length?o[i]:0,m=r*Math.cos(Math.PI/n)*Math.min(1,m/r*2);const p={x:u.x/d,y:u.y/d},g={x:c.x/h,y:c.y/h},k={x:a.x-p.x*m,y:a.y-p.y*m},w={x:a.x+g.x*m,y:a.y+g.y*m};i===0?e.moveTo(k.x,k.y):e.lineTo(k.x,k.y),e.arcTo(a.x,a.y,w.x,w.y,m)}}};function _P(e){const t=[],n=e.length,r=Ie;for(let o=0;o<n;o++){let i=e[o];r._isNumber(i)?i=Math.round(i*1e3)/1e3:r._isString(i)||(i=i+""),t.push(i)}return t}var r4=",",SP="(",kP=")",AP="([",IP="])",EP=";",xP="()",TP="=",o4=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],RP=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],MP=100,Ap=null;function i4(){if(Ap!==null)return Ap;try{const e=Ie.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(Ap=!1,!1)}catch{return Ap=!1,!1}}var Ip=class{constructor(e){this.canvas=e,vt.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,o="",i,s,a,l;for(i=0;i<r;i++)s=n[i],a=s.method,a?(l=s.args,o+=a,e?o+=xP:Ie._isArray(l[0])?o+=AP+l.join(r4)+IP:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=SP+l.join(r4)+kP)):(o+=s.property,e||(o+=TP+s.val)),o+=EP;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=MP&&t.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();t!==1&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}_applyMiterLimit(e){const t=e.attrs.miterLimit;t!=null&&this.setAttr("miterLimit",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,s,a,l){const u=arguments,c=this._context;u.length===3?c.drawImage(e,t,n):u.length===5?c.drawImage(e,t,n,r,o):u.length===9&&c.drawImage(e,t,n,r,o,i,s,a,l)}ellipse(e,t,n,r,o,i,s,a){this._context.ellipse(e,t,n,r,o,i,s,a)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,o){this._context.roundRect(e,t,n,r,o)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=o4.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=_P(Array.prototype.slice.call(arguments,0)),l=a.apply(e,arguments),e._trace({method:s,args:o}),l}};for(r=0;r<t;r++)i(o4[r]);e.setAttr=function(){n.apply(e,arguments);const s=arguments[0];let a=arguments[1];(s==="shadowOffsetX"||s==="shadowOffsetY"||s==="shadowBlur")&&(a=a/this.canvas.getPixelRatio()),e._trace({property:s,val:a})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||t==="source-over"||this.setAttr("globalCompositeOperation",t)}};RP.forEach(function(e){Object.defineProperty(Ip.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var LP=class extends Ip{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:t})}_fillColor(e){const t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&n==="color"){this._fillColor(e);return}const r=e.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&n==="linear-gradient"){this._fillLinearGradient(e);return}const i=e.getFillRadialGradientColorStops();if(i&&n==="radial-gradient"){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):o?this._fillLinearGradient(e):i&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let i=0;i<r.length;i+=2)o.addColorStop(r[i],r[i+1]);this.setAttr("strokeStyle",o)}}_stroke(e){const t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();const r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r;const o=(t=e.getShadowRGBA())!==null&&t!==void 0?t:"black",i=(n=e.getShadowBlur())!==null&&n!==void 0?n:5,s=(r=e.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},a=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),u=a.x*l,c=a.y*l;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",i*Math.min(Math.abs(u),Math.abs(c))),this.setAttr("shadowOffsetX",s.x*u),this.setAttr("shadowOffsetY",s.y*c)}},DP=class extends Ip{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const t=e.getStrokeScaleEnabled();if(!t){this.save();const o=this.getCanvas().getPixelRatio();this.setTransform(o,0,0,o,0,0)}this._applyLineCap(e);const n=e.hitStrokeWidth(),r=n==="auto"?e.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},Ep;function PP(){if(Ep)return Ep;const e=Ie.createCanvasElement(),t=e.getContext("2d");return Ep=(function(){return(vt._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Ie.releaseCanvas(e),Ep}var o0=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1,this.pixelRatio=(e||{}).pixelRatio||vt.pixelRatio||PP(),this._canvas=Ie.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(r){return Ie.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},Ga=class extends o0{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new LP(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},i0=class extends o0{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new DP(this),this.setSize(e.width,e.height)}};const In={get isDragging(){let e=!1;return In._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return In._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];In._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=Ie._getFirstPointerId(e));const s=i._changedPointerPositions.find(a=>a.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){const a=o.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<a||(o.startDrag({evt:e}),!o.isDragging()))return}o._setDragPosition(e,n),t.push(o)}}),t.forEach(n=>{n.getStage()&&n.fire("dragmove",{type:"dragmove",target:n,evt:e},!0)})},_endDragBefore(e){const t=[];In._dragElements.forEach(n=>{const{node:r}=n,o=r.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(s=>s.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(In.justDragged=!0,vt._mouseListenClick=!1,vt._touchListenClick=!1,vt._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof vt.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){In._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&In._dragElements.delete(n)})}};vt.isBrowser&&(window.addEventListener("mouseup",In._endDragBefore,!0),window.addEventListener("touchend",In._endDragBefore,!0),window.addEventListener("touchcancel",In._endDragBefore,!0),window.addEventListener("mousemove",In._drag),window.addEventListener("touchmove",In._drag),window.addEventListener("mouseup",In._endDragAfter,!1),window.addEventListener("touchend",In._endDragAfter,!1),window.addEventListener("touchcancel",In._endDragAfter,!1));function Wa(e){return Ie._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Ie._isBoolean(e)?e:Object.prototype.toString.call(e)}function s4(e){return e>255?255:e<0?0:Math.round(e)}function dt(){if(vt.isUnminified)return function(e,t){return Ie._isNumber(e)||Ie.warn(Wa(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function xp(e){if(vt.isUnminified)return function(t,n){let r=Ie._isNumber(t),o=Ie._isArray(t)&&t.length==e;return!r&&!o&&Ie.warn(Wa(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function s0(){if(vt.isUnminified)return function(e,t){return Ie._isNumber(e)||e==="auto"||Ie.warn(Wa(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function jl(){if(vt.isUnminified)return function(e,t){return Ie._isString(e)||Ie.warn(Wa(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function a4(){if(vt.isUnminified)return function(e,t){const n=Ie._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Ie.warn(Wa(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function OP(){if(vt.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Ie._isArray(e)?e.forEach(function(r){Ie._isNumber(r)||Ie.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Ie.warn(Wa(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function ji(){if(vt.isUnminified)return function(e,t){return e===!0||e===!1||Ie.warn(Wa(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function FP(e){if(vt.isUnminified)return function(t,n){return t==null||Ie.isObject(t)||Ie.warn(Wa(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var of="get",sf="set";const ce={addGetterSetter(e,t,n,r,o){ce.addGetter(e,t,n),ce.addSetter(e,t,r,o),ce.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=of+Ie._capitalize(t);e.prototype[r]=e.prototype[r]||function(){const o=this.attrs[t];return o===void 0?n:o}},addSetter(e,t,n,r){const o=sf+Ie._capitalize(t);e.prototype[o]||ce.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=sf+Ie._capitalize(t);e.prototype[o]=function(i){return n&&i!==void 0&&i!==null&&(i=n.call(this,i,t)),this._setAttr(t,i),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,o){const i=n.length,s=Ie._capitalize,a=of+s(t),l=sf+s(t);e.prototype[a]=function(){const c={};for(let d=0;d<i;d++){const h=n[d];c[h]=this.getAttr(t+s(h))}return c};const u=FP(n);e.prototype[l]=function(c){const d=this.attrs[t];r&&(c=r.call(this,c,t)),u&&u.call(this,c,t);for(const h in c)c.hasOwnProperty(h)&&this._setAttr(t+s(h),c[h]);return c||n.forEach(h=>{this._setAttr(t+s(h),void 0)}),this._fireChangeEvent(t,d,c),o&&o.call(this),this},ce.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Ie._capitalize(t),r=sf+n,o=of+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){Ie.error("Adding deprecated "+t);const o=of+Ie._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Ie.error(i);const s=this.attrs[t];return s===void 0?n:s},ce.addSetter(e,t,r,function(){Ie.error(i)}),ce.addOverloadedGetterSetter(e,t)},backCompat(e,t){Ie.each(t,function(n,r){const o=e.prototype[r],i=of+Ie._capitalize(n),s=sf+Ie._capitalize(n);function a(){o.apply(this,arguments),Ie.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}e.prototype[n]=a,e.prototype[i]=a,e.prototype[s]=a})},afterSetFilter(){this._filterUpToDate=!1}};function BP(e){const t=/(\w+)\(([^)]+)\)/g;let n;for(;(n=t.exec(e))!==null;){const[,r,o]=n;switch(r){case"blur":{const i=parseFloat(o.replace("px",""));return function(s){this.blurRadius(i*.5);const a=vt.Filters;a&&a.Blur&&a.Blur.call(this,s)}}case"brightness":{const i=o.includes("%")?parseFloat(o)/100:parseFloat(o);return function(s){this.brightness(i);const a=vt.Filters;a&&a.Brightness&&a.Brightness.call(this,s)}}case"contrast":{const i=parseFloat(o);return function(s){const a=100*(Math.sqrt(i)-1);this.contrast(a);const l=vt.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=vt.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=vt.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=vt.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:Ie.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Tp="absoluteOpacity",l4="allEventListeners",Js="absoluteTransform",c4="absoluteScale",Gl="canvas",NP="Change",zP="children",HP="konva",a0="listening",UP="mouseenter",VP="mouseleave",jP="pointerenter",GP="pointerleave",WP="touchenter",KP="touchleave",u4="set",d4="Shape",Rp=" ",f4="stage",Ka="transform",qP="Stage",l0="visible",YP=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Rp),XP=1,wt=class zf{constructor(t){this._id=XP++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===Ka||t===Js)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){let r=this._cache.get(t);return(r===void 0||(t===Ka||t===Js)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const o=n.map(i=>i+"Change.konva").join(Rp);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Gl)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Js&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Gl)){const{scene:t,filter:n,hit:r}=this._cache.get(Gl);Ie.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(Gl)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const n=t||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let o=Math.ceil(n.width||r.width),i=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!o||!i){Ie.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const h=Math.abs(Math.round(r.x)-a)>.5?1:0,m=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+h,i+=u*2+m,a-=u,l-=u;const p=new Ga({pixelRatio:s,width:o,height:i}),g=new Ga({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),k=new i0({pixelRatio:d,width:o,height:i}),w=p.getContext(),S=k.getContext(),y=new Ga({width:p.width/p.pixelRatio+Math.abs(a),height:p.height/p.pixelRatio+Math.abs(l),pixelRatio:p.pixelRatio}),C=y.getContext();return k.isCache=!0,p.isCache=!0,this._cache.delete(Gl),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(p.getContext()._context.imageSmoothingEnabled=!1,g.getContext()._context.imageSmoothingEnabled=!1),w.save(),S.save(),C.save(),w.translate(-a,-l),S.translate(-a,-l),C.translate(-a,-l),y.x=a,y.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Tp),this._clearSelfAndDescendantCache(c4),this.drawScene(p,this,y),this.drawHit(k,this),this._isUnderCache=!1,w.restore(),S.restore(),c&&(w.save(),w.beginPath(),w.rect(0,0,o,i),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),Ie.releaseCanvas(y._canvas),this._cache.set(Gl,{scene:p,filter:g,hit:k,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Gl)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){const r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let o=1/0,i=1/0,s=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(u){const c=l.point(u);o===void 0&&(o=s=c.x,i=a=c.y),o=Math.min(o,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:o,y:i,width:s-o,height:a-i}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),o=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/o,r.height/o),t.restore()}_drawCachedHitCanvas(t){const n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),n=this._getCanvasCache(),r=n.scene,o=n.filter,i=o.getContext(),s,a,l,u;if(!t||t.length===0)return r;if(this._filterUpToDate)return o;let c=!0;for(let h=0;h<t.length;h++)if(typeof t[h]=="string"&&i4(),typeof t[h]!="string"||!i4()){c=!1;break}const d=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),c){const h=t.join(" ");return i.save(),i.setAttr("filter",h),i.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=BP(u)),u.call(this,a),i.putImageData(a,0,0)}catch(h){Ie.error("Unable to apply filter. "+h.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,o}on(...t){const n=t[0],r=t[1];if(t[2],this._cache&&this._cache.delete(l4),t.length===3)return this._delegate.apply(this,t);const o=n.split(Rp);for(let i=0;i<o.length;i++){const s=o[i].split("."),a=s[0],l=s[1]||"";this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:l,handler:r})}return this}off(t,n){let r=(t||"").split(Rp),o=r.length,i,s,a,l,u,c;if(this._cache&&this._cache.delete(l4),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<o;i++)if(a=r[i],l=a.split("."),u=l[0],c=l[1],u)this.eventListeners[u]&&this._off(u,c,n);else for(s in this.eventListeners)this._off(s,c,n);return this}dispatchEvent(t){const n={target:this,type:t.type,evt:t};return this.fire(t.type,n),this}addEventListener(t,n){return this.on(t,function(r){n.call(this,r.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,n,r){const o=this;return this.on(t,function(i){const s=i.target.findAncestors(n,!0,o);for(let a=0;a<s.length;a++)i=Ie.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),In._dragElements.delete(this._id),In._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&In._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Js),this._clearSelfAndDescendantCache(Tp),this._clearSelfAndDescendantCache(c4),this._clearSelfAndDescendantCache(f4),this._clearSelfAndDescendantCache(l0),this._clearSelfAndDescendantCache(a0)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){const n="get"+Ie._capitalize(t);return Ie._isFunction(this[n])?this[n]():this.attrs[t]}getAncestors(){let t=this.getParent(),n=[];for(;t;)n.push(t),t=t.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let n,r;if(!t)return this;for(n in t)n!==zP&&(r=u4+Ie._capitalize(n),Ie._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(a0,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(l0,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);const r=this.getLayer();let o=!1;In._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!vt.hitOnDragEnabled&&(o||vt.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t=this.getDepth(),n=this,r=0,o,i,s,a;function l(c){for(o=[],i=c.length,s=0;s<i;s++)a=c[s],r++,a.nodeType!==d4&&(o=o.concat(a.getChildren().slice())),a._id===n._id&&(s=i);o.length>0&&o[0].getDepth()<=t&&l(o)}const u=this.getStage();return n.nodeType!==qP&&u&&l(u.getChildren()),r}getDepth(){let t=0,n=this.parent;for(;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Ka),this._clearSelfAndDescendantCache(Js)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const n=t.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);const o=this.getAbsoluteTransform(t).getMatrix(),i=new Vi,s=this.offset();return i.m=o.slice(),i.translate(s.x,s.y),i.getTranslation()}setAbsolutePosition(t){const{x:n,y:r,...o}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(Ka);const i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(t.x,t.y),t={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(o),this.setPosition({x:t.x,y:t.y}),this._clearCache(Ka),this._clearSelfAndDescendantCache(Js),this}_setTransform(t){let n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let n=t.x,r=t.y,o=this.x(),i=this.y();return n!==void 0&&(o+=n),r!==void 0&&(i+=r),this.setPosition({x:o,y:i}),this}_eachAncestorReverse(t,n){let r=[],o=this.getParent(),i,s;if(!(n&&n._id===this._id)){for(r.unshift(this);o&&(!n||o._id!==n._id);)r.unshift(o),o=o.parent;for(i=r.length,s=0;s<i;s++)t(r[s])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Ie.warn("Node has no parent. moveToTop function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Ie.warn("Node has no parent. moveUp function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Ie.warn("Node has no parent. moveDown function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Ie.warn("Node has no parent. moveToBottom function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Ie.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Ie.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Tp,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t=this.getAttrs(),n,r,o,i,s;const a={attrs:{},className:this.getClassName()};for(n in t)r=t[n],s=Ie.isObject(r)&&!Ie._isPlainObject(r)&&!Ie._isArray(r),!s&&(o=typeof this[n]=="function"&&this[n],delete t[n],i=o?o.call(this):null,t[n]=r,i!==r&&(a.attrs[n]=r));return Ie._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){const o=[];n&&this._isMatch(t)&&o.push(this);let i=this.parent;for(;i;){if(i===r)return o;i._isMatch(t)&&o.push(i),i=i.parent}return o}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);let n=t.replace(/ /g,"").split(","),r=n.length,o,i;for(o=0;o<r;o++)if(i=n[o],Ie.isValidSelector(i)||(Ie.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Ie.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Ie.warn("Konva is awesome, right?")),i.charAt(0)==="#"){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)==="."){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(f4,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,n={},r){return n.target=n.target||this,r?this._fireAndBubble(t,n):this._fire(t,n),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(Js,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new Vi,this._eachAncestorReverse(function(r){const o=r.transformsEnabled();o==="all"?n.multiply(r.getTransform()):o==="position"&&n.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),n;{n=this._cache.get(Js)||new Vi,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const r=this.transformsEnabled();if(r==="all")n.multiply(this.getTransform());else if(r==="position"){const o=this.attrs.x||0,i=this.attrs.y||0,s=this.attrs.offsetX||0,a=this.attrs.offsetY||0;n.translate(o-s,i-a)}return n.dirty=!1,n}}getAbsoluteScale(t){let n=this;for(;n;)n._isUnderCache&&(t=n),n=n.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Ka,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(Ka)||new Vi;r.reset();const o=this.x(),i=this.y(),s=vt.getAngle(this.rotation()),a=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,h=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(u!==0||c!==0)&&r.skew(u,c),(a!==1||l!==1)&&r.scale(a,l),(d!==0||h!==0)&&r.translate(-1*d,-1*h),r.dirty=!1,r}clone(t){let n=Ie.cloneObject(this.attrs),r,o,i,s,a;for(r in t)n[r]=t[r];const l=new this.constructor(n);for(r in this.eventListeners)for(o=this.eventListeners[r],i=o.length,s=0;s<i;s++)a=o[s],a.name.indexOf(HP)<0&&(l.eventListeners[r]||(l.eventListeners[r]=[]),l.eventListeners[r].push(a));return l}_toKonvaCanvas(t){t=t||{};const n=this.getClientRect(),r=this.getStage(),o=t.x!==void 0?t.x:Math.floor(n.x),i=t.y!==void 0?t.y:Math.floor(n.y),s=t.pixelRatio||1,a=new Ga({width:t.width||Math.ceil(n.width)||(r?r.width():0),height:t.height||Math.ceil(n.height)||(r?r.height():0),pixelRatio:s}),l=a.getContext(),u=new Ga({width:a.width/a.pixelRatio+Math.abs(o),height:a.height/a.pixelRatio+Math.abs(i),pixelRatio:a.pixelRatio});return t.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(o||i)&&l.translate(-1*o,-1*i),this.drawScene(a,void 0,u),l.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};const n=t.mimeType||null,r=t.quality||null,o=this._toKonvaCanvas(t).toDataURL(n,r);return t.callback&&t.callback(o),o}toImage(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,Ie._urlToImage(this.toDataURL(t),function(i){n(i),o?.(i)})}catch(o){r(o)}})}toBlob(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,this.toCanvas(t).toBlob(i=>{n(i),o?.(i)},t?.mimeType,t?.quality)}catch(o){r(o)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():vt.dragDistance}_off(t,n,r){let o=this.eventListeners[t],i,s,a;for(i=0;i<o.length;i++)if(s=o[i].name,a=o[i].handler,(s!=="konva"||n==="konva")&&(!n||s===n)&&(!r||r===a)){if(o.splice(i,1),o.length===0){delete this.eventListeners[t];break}i--}}_fireChangeEvent(t,n,r){this._fire(t+NP,{oldVal:n,newVal:r})}addName(t){if(!this.hasName(t)){const n=this.name(),r=n?n+" "+t:t;this.name(r)}return this}hasName(t){if(!t)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(t)!==-1:!1}removeName(t){const n=(this.name()||"").split(/\s/g),r=n.indexOf(t);return r!==-1&&(n.splice(r,1),this.name(n.join(" "))),this}setAttr(t,n){const r=this[u4+Ie._capitalize(t)];return Ie._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(vt.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!Ie.isObject(n)||(n==null?delete this.attrs[t]:this.attrs[t]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(t,r,n),this._requestDraw())}_setComponentAttr(t,n,r){let o;r!==void 0&&(o=this.attrs[t],o||(this.attrs[t]=this.getAttr(t)),this.attrs[t][n]=r,this._fireChangeEvent(t,o,r))}_fireAndBubble(t,n,r){n&&this.nodeType===d4&&(n.target=this);const o=[UP,VP,jP,GP,WP,KP];if(!(o.indexOf(t)!==-1&&(r&&(this===r||this.isAncestorOf&&this.isAncestorOf(r))||this.nodeType==="Stage"&&!r))){this._fire(t,n);const i=o.indexOf(t)!==-1&&r&&r.isAncestorOf&&r.isAncestorOf(this)&&!r.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!i&&(r&&r.parent?this._fireAndBubble.call(this.parent,t,n,r):this._fireAndBubble.call(this.parent,t,n))}}_getProtoListeners(t){var n,r;const{nodeType:o}=this,i=zf.protoListenerMap.get(o)||{};let s=i?.[t];if(s===void 0){s=[];let a=Object.getPrototypeOf(this);for(;a;){const l=(r=(n=a.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];s.push(...l),a=Object.getPrototypeOf(a)}i[t]=s,zf.protoListenerMap.set(o,i)}return s}_fire(t,n){n=n||{},n.currentTarget=this,n.type=t;const r=this._getProtoListeners(t);if(r){const i=r.slice();for(let s=0;s<i.length;s++)i[s].handler.call(this,n)}const o=this.eventListeners[t];if(o){const i=o.slice(),s=i.length;for(let l=0;l<i.length;l++)i[l].handler.call(this,n);const a=this.eventListeners[t];if(a)for(let l=s;l<a.length;l++)a[l].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const n=t?t.pointerId:void 0,r=this.getStage(),o=this.getAbsolutePosition();if(!r)return;const i=r._getPointerById(n)||r._changedPointerPositions[0]||o;In._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-o.x,y:i.y-o.y},dragStatus:"ready",pointerId:n,startEvent:t})}startDrag(t,n=!0){In._dragElements.has(this._id)||this._createDragElement(t);const r=In._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:r.startEvent&&r.startEvent.evt||t&&t.evt},n)}_setDragPosition(t,n){const r=this.getStage()._getPointerById(n.pointerId);if(!r)return;let o={x:r.x-n.offset.x,y:r.y-n.offset.y};const i=this.dragBoundFunc();if(i!==void 0){const s=i.call(this,o,t);s?o=s:Ie.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==o.x||this._lastPos.y!==o.y)&&(this.setAbsolutePosition(o),this._requestDraw()),this._lastPos=o}stopDrag(t){const n=In._dragElements.get(this._id);n&&(n.dragStatus="stopped"),In._endDragBefore(t),In._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=In._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(t.evt.button===void 0||vt.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;In._dragElements.forEach(r=>{this.isAncestorOf(r.node)&&(n=!0)}),n||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=In._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&In._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Ie.haveIntersection(r,this.getClientRect())}static create(t,n){return Ie._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=zf.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),vt[r]||(Ie.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=vt[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(zf._createNode(o[a]));return i}};wt.protoListenerMap=new Map,wt.prototype.nodeType="Node",wt.prototype._attrsAffectingSize=[],wt.prototype.eventListeners={},wt.prototype.on(YP,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Ka),this._clearSelfAndDescendantCache(Js)}),wt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(l0)}),wt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(a0)}),wt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Tp)});var qn=ce.addGetterSetter;qn(wt,"zIndex"),qn(wt,"absolutePosition"),qn(wt,"position"),qn(wt,"x",0,dt()),qn(wt,"y",0,dt()),qn(wt,"globalCompositeOperation","source-over",jl()),qn(wt,"opacity",1,dt()),qn(wt,"name","",jl()),qn(wt,"id","",jl()),qn(wt,"rotation",0,dt()),ce.addComponentsGetterSetter(wt,"scale",["x","y"]),qn(wt,"scaleX",1,dt()),qn(wt,"scaleY",1,dt()),ce.addComponentsGetterSetter(wt,"skew",["x","y"]),qn(wt,"skewX",0,dt()),qn(wt,"skewY",0,dt()),ce.addComponentsGetterSetter(wt,"offset",["x","y"]),qn(wt,"offsetX",0,dt()),qn(wt,"offsetY",0,dt()),qn(wt,"dragDistance",void 0,dt()),qn(wt,"width",0,dt()),qn(wt,"height",0,dt()),qn(wt,"listening",!0,ji()),qn(wt,"preventDefault",!0,ji()),qn(wt,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),qn(wt,"visible",!0,ji()),qn(wt,"transformsEnabled","all",jl()),qn(wt,"size"),qn(wt,"dragBoundFunc"),qn(wt,"draggable",!1,ji()),ce.backCompat(wt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var di=class extends wt{constructor(){super(...arguments),this.children=[]}getChildren(e){const t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let n=0;n<e.length;n++)this.add(e[n]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){const n=[];return this._descendants(r=>{const o=r._isMatch(e);return o&&n.push(r),!!(o&&t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){const e=wt.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){const t=wt.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,c=n===this;if(u){i.save();const h=this.getAbsoluteTransform(n);let m=h.getMatrix();i.transform(m[0],m[1],m[2],m[3],m[4],m[5]),i.beginPath();let p;if(l)p=l.call(this,i,this);else{const g=this.clipX(),k=this.clipY();i.rect(g||0,k||0,s,a)}i.clip.apply(i,p),m=h.copy().invert().getMatrix(),i.transform(m[0],m[1],m[2],m[3],m[4],m[5])}const d=!c&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";d&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(h){h[e](t,n,r)}),d&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(h){if(!h.visible())return;const m=h.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});m.width===0&&m.height===0||(o===void 0?(o=m.x,i=m.y,s=m.x+m.width,a=m.y+m.height):(o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x+m.width),a=Math.max(a,m.y+m.height)))});const c=this.find("Shape");let d=!1;for(let h=0;h<c.length;h++)if(c[h]._isVisible(this)){d=!0;break}return d&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};ce.addComponentsGetterSetter(di,"clip",["x","y","width","height"]),ce.addGetterSetter(di,"clipX",void 0,dt()),ce.addGetterSetter(di,"clipY",void 0,dt()),ce.addGetterSetter(di,"clipWidth",void 0,dt()),ce.addGetterSetter(di,"clipHeight",void 0,dt()),ce.addGetterSetter(di,"clipFunc");var af=new Map,h4=vt._global.PointerEvent!==void 0;function c0(e){return af.get(e)}function u0(e){return{evt:e,pointerId:e.pointerId}}function p4(e,t){return af.get(e)===t}function m4(e,t){lf(e),t.getStage()&&(af.set(e,t),h4&&t._fire("gotpointercapture",u0(new PointerEvent("gotpointercapture"))))}function lf(e,t){const n=af.get(e);if(!n)return;const r=n.getStage();r&&r.content,af.delete(e),h4&&n._fire("lostpointercapture",u0(new PointerEvent("lostpointercapture")))}var QP="Stage",ZP="string",g4="px",JP="mouseout",v4="mouseleave",y4="mouseover",b4="mouseenter",w4="mousemove",C4="mousedown",_4="mouseup",cf="pointermove",uf="pointerdown",ou="pointerup",df="pointercancel",$P="lostpointercapture",Mp="pointerout",ff="pointerleave",Lp="pointerover",Dp="pointerenter",d0="contextmenu",S4="touchstart",k4="touchend",A4="touchmove",I4="touchcancel",f0="wheel",eO=5,tO=[[b4,"_pointerenter"],[C4,"_pointerdown"],[w4,"_pointermove"],[_4,"_pointerup"],[v4,"_pointerleave"],[S4,"_pointerdown"],[A4,"_pointermove"],[k4,"_pointerup"],[I4,"_pointercancel"],[y4,"_pointerover"],[f0,"_wheel"],[d0,"_contextmenu"],[uf,"_pointerdown"],[cf,"_pointermove"],[ou,"_pointerup"],[df,"_pointercancel"],[ff,"_pointerleave"],[$P,"_lostpointercapture"]],h0={mouse:{[Mp]:JP,[ff]:v4,[Lp]:y4,[Dp]:b4,[cf]:w4,[uf]:C4,[ou]:_4,[df]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Mp]:"touchout",[ff]:"touchleave",[Lp]:"touchover",[Dp]:"touchenter",[cf]:A4,[uf]:S4,[ou]:k4,[df]:I4,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Mp]:Mp,[ff]:ff,[Lp]:Lp,[Dp]:Dp,[cf]:cf,[uf]:uf,[ou]:ou,[df]:df,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},hf=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",iu=e=>{const t=hf(e);if(t==="pointer")return vt.pointerEventsEnabled&&h0.pointer;if(t==="touch")return h0.touch;if(t==="mouse")return h0.mouse};function E4(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Ie.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var nO="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";const pf=[];var Pp=class extends di{constructor(e){super(E4(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),pf.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{E4(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Ie.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===ZP){let t;if(e.charAt(0)==="."){const n=e.slice(1);e=document.getElementsByClassName(n)[0]}else e.charAt(0)!=="#"?t=e:t=e.slice(1),e=document.getElementById(t);if(!e)throw"Can not find container in document with id "+t}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),di.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Ie._isInDocument(e)&&this.container().removeChild(e);const t=pf.indexOf(this);return t>-1&&pf.splice(t,1),Ie.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(Ie.warn(nO),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const t=new Ga({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(o){if(!o.isVisible())return;const i=o._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}),t}getIntersection(e){if(!e)return null;const t=this.children,n=t.length-1;for(let r=n;r>=0;r--){const o=t[r].getIntersection(e);if(o)return o}return null}_resizeDOM(){const e=this.width(),t=this.height();this.content&&(this.content.style.width=e+g4,this.content.style.height=t+g4),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}super.add(e);const n=this.children.length;return n>eO&&Ie.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),vt.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return p4(e,this)}setPointerCapture(e){m4(e,this)}releaseCapture(e){lf(e,this)}getLayers(){return this.children}_bindContentEvents(){vt.isBrowser&&tO.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=iu(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=iu(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=iu(e.type),n=hf(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(vt.isDragging()||vt.isTransforming())||vt.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const t=iu(e.type),n=hf(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(In.justDragged=!1,vt["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}vt.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const s=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const t=iu(e.type),n=hf(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(vt.isDragging()&&In.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(vt.isDragging()||vt.isTransforming())||vt.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=c0(a.id)||this.getIntersection(a),u=a.id,c={evt:e,pointerId:u},d=s!==l;if(d&&s&&(s._fireAndBubble(t.pointerout,{...c},l),s._fireAndBubble(t.pointerleave,{...c},l)),l){if(o[l._id])return;o[l._id]=!0}l&&l.isListening()?(i=!0,d&&(l._fireAndBubble(t.pointerover,{...c},s),l._fireAndBubble(t.pointerenter,{...c},s),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...c})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=iu(e.type),n=hf(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"],i={};let s=!1;this._changedPointerPositions.forEach(a=>{const l=c0(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const u=a.id,c={evt:e,pointerId:u};let d=!1;vt["_"+n+"InDblClickWindow"]?(d=!0,clearTimeout(this[n+"DblTimeout"])):In.justDragged||(vt["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){vt["_"+n+"InDblClickWindow"]=!1},vt.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...c}),vt["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...c}),d&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,{...c}))):(this[n+"ClickEndShape"]=null,s||(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),vt["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),vt["_"+n+"ListenClick"]=!1,e.cancelable&&n!=="touch"&&n!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(d0,{evt:e}):this._fire(d0,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(f0,{evt:e}):this._fire(f0,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=c0(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(ou,u0(e)),lf(e.pointerId)}_lostpointercapture(e){lf(e.pointerId)}setPointersPositions(e){const t=this._getContentPosition();let n=null,r=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,o=>{this._pointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,o=>{this._changedPointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})})):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:Ie._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Ie._getFirstPointerId(e)}])}_setPointerPosition(e){Ie.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ga({width:this.width(),height:this.height()}),this.bufferHitCanvas=new i0({pixelRatio:1,width:this.width(),height:this.height()}),!vt.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return Ie.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};Pp.prototype.nodeType=QP,vr(Pp),ce.addGetterSetter(Pp,"container"),vt.isBrowser&&document.addEventListener("visibilitychange",()=>{pf.forEach(e=>{e.batchDraw()})});var x4="hasShadow",T4="shadowRGBA",R4="patternImage",M4="linearGradient",L4="radialGradient",Op;function p0(){return Op||(Op=Ie.createCanvasElement().getContext("2d"),Op)}const mf={};function rO(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function oO(e){e.stroke()}function iO(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function sO(e){e.stroke()}function aO(){this._clearCache(x4)}function lO(){this._clearCache(T4)}function cO(){this._clearCache(R4)}function uO(){this._clearCache(M4)}function dO(){this._clearCache(L4)}var ct=class extends wt{constructor(e){super(e);let t,n=0;for(;t=Ie.getHitColor(),!(t&&!(t in mf));)if(n++,n>=1e4){Ie.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),t=Ie.getRandomColor();break}this.colorKey=t,mf[t]=this}getContext(){return Ie.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Ie.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(x4,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(R4,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=p0().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Vi;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(vt.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r=typeof DOMMatrix>"u"?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(M4,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=p0(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}_getRadialGradient(){return this._getCache(L4,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=p0(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),o=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}getShadowRGBA(){return this._getCache(T4,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Ie.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return wt.prototype.destroy.call(this),delete mf[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!(!((t=this.attrs.perfectDrawEnabled)!==null&&t!==void 0)||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=this.getAbsoluteOpacity()!==1;if(n&&r&&o)return!0;const i=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(n&&r&&i&&s)}setStrokeHitEnabled(e){Ie.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),c=u?this.shadowOffsetX():0,d=u?this.shadowOffsetY():0,h=a+Math.abs(c),m=l+Math.abs(d),p=u&&this.shadowBlur()||0,g={width:h+p*2,height:m+p*2,x:-(s/2+p)+Math.min(c,0)+i.x,y:-(s/2+p)+Math.min(d,0)+i.y};return r?g:this._transformedRect(g,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const u=t===this;if(!this.isVisible()&&!u)return this;if(i){o.save();const c=this.getAbsoluteTransform(t).getMatrix();return o.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()){l=this.getStage();const c=n||l.bufferCanvas,d=c.getContext();n?(d.save(),d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height),d.restore()):d.clear(),d.save(),d._applyLineJoin(this),d._applyMiterLimit(this);const h=this.getAbsoluteTransform(t).getMatrix();d.transform(h[0],h[1],h[2],h[3],h[4],h[5]),s.call(this,d,this),d.restore();const m=c.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(c._canvas,c.x||0,c.y||0,c.width/m,c.height/m)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const c=this.getAbsoluteTransform(t).getMatrix();o.transform(c[0],c[1],c[2],c[3],c[4],c[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||Ie.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();const u=this.getAbsoluteTransform(t).getMatrix();return i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!s)return this;if(i.save(),i._applyLineJoin(this),i._applyMiterLimit(this),this!==t){const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,o=r.getContext(),i=r.getWidth(),s=r.getHeight();o.clear(),o.drawImage(n._canvas,0,0,i,s);try{const a=o.getImageData(0,0,i,s),l=a.data,u=l.length,c=Ie._hexToRgb(this.colorKey);for(let d=0;d<u;d+=4)l[d+3]>e?(l[d]=c.r,l[d+1]=c.g,l[d+2]=c.b,l[d+3]=255):l[d+3]=0;o.putImageData(a,0,0)}catch(a){Ie.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return p4(e,this)}setPointerCapture(e){m4(e,this)}releaseCapture(e){lf(e,this)}};ct.prototype._fillFunc=rO,ct.prototype._strokeFunc=oO,ct.prototype._fillFuncHit=iO,ct.prototype._strokeFuncHit=sO,ct.prototype._centroid=!1,ct.prototype.nodeType="Shape",vr(ct),ct.prototype.eventListeners={},ct.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",aO),ct.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",lO),ct.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",cO),ct.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",uO),ct.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",dO),ce.addGetterSetter(ct,"stroke",void 0,a4()),ce.addGetterSetter(ct,"strokeWidth",2,dt()),ce.addGetterSetter(ct,"fillAfterStrokeEnabled",!1),ce.addGetterSetter(ct,"hitStrokeWidth","auto",s0()),ce.addGetterSetter(ct,"strokeHitEnabled",!0,ji()),ce.addGetterSetter(ct,"perfectDrawEnabled",!0,ji()),ce.addGetterSetter(ct,"shadowForStrokeEnabled",!0,ji()),ce.addGetterSetter(ct,"lineJoin"),ce.addGetterSetter(ct,"lineCap"),ce.addGetterSetter(ct,"miterLimit"),ce.addGetterSetter(ct,"sceneFunc"),ce.addGetterSetter(ct,"hitFunc"),ce.addGetterSetter(ct,"dash"),ce.addGetterSetter(ct,"dashOffset",0,dt()),ce.addGetterSetter(ct,"shadowColor",void 0,jl()),ce.addGetterSetter(ct,"shadowBlur",0,dt()),ce.addGetterSetter(ct,"shadowOpacity",1,dt()),ce.addComponentsGetterSetter(ct,"shadowOffset",["x","y"]),ce.addGetterSetter(ct,"shadowOffsetX",0,dt()),ce.addGetterSetter(ct,"shadowOffsetY",0,dt()),ce.addGetterSetter(ct,"fillPatternImage"),ce.addGetterSetter(ct,"fill",void 0,a4()),ce.addGetterSetter(ct,"fillPatternX",0,dt()),ce.addGetterSetter(ct,"fillPatternY",0,dt()),ce.addGetterSetter(ct,"fillLinearGradientColorStops"),ce.addGetterSetter(ct,"strokeLinearGradientColorStops"),ce.addGetterSetter(ct,"fillRadialGradientStartRadius",0),ce.addGetterSetter(ct,"fillRadialGradientEndRadius",0),ce.addGetterSetter(ct,"fillRadialGradientColorStops"),ce.addGetterSetter(ct,"fillPatternRepeat","repeat"),ce.addGetterSetter(ct,"fillEnabled",!0),ce.addGetterSetter(ct,"strokeEnabled",!0),ce.addGetterSetter(ct,"shadowEnabled",!0),ce.addGetterSetter(ct,"dashEnabled",!0),ce.addGetterSetter(ct,"strokeScaleEnabled",!0),ce.addGetterSetter(ct,"fillPriority","color"),ce.addComponentsGetterSetter(ct,"fillPatternOffset",["x","y"]),ce.addGetterSetter(ct,"fillPatternOffsetX",0,dt()),ce.addGetterSetter(ct,"fillPatternOffsetY",0,dt()),ce.addComponentsGetterSetter(ct,"fillPatternScale",["x","y"]),ce.addGetterSetter(ct,"fillPatternScaleX",1,dt()),ce.addGetterSetter(ct,"fillPatternScaleY",1,dt()),ce.addComponentsGetterSetter(ct,"fillLinearGradientStartPoint",["x","y"]),ce.addComponentsGetterSetter(ct,"strokeLinearGradientStartPoint",["x","y"]),ce.addGetterSetter(ct,"fillLinearGradientStartPointX",0),ce.addGetterSetter(ct,"strokeLinearGradientStartPointX",0),ce.addGetterSetter(ct,"fillLinearGradientStartPointY",0),ce.addGetterSetter(ct,"strokeLinearGradientStartPointY",0),ce.addComponentsGetterSetter(ct,"fillLinearGradientEndPoint",["x","y"]),ce.addComponentsGetterSetter(ct,"strokeLinearGradientEndPoint",["x","y"]),ce.addGetterSetter(ct,"fillLinearGradientEndPointX",0),ce.addGetterSetter(ct,"strokeLinearGradientEndPointX",0),ce.addGetterSetter(ct,"fillLinearGradientEndPointY",0),ce.addGetterSetter(ct,"strokeLinearGradientEndPointY",0),ce.addComponentsGetterSetter(ct,"fillRadialGradientStartPoint",["x","y"]),ce.addGetterSetter(ct,"fillRadialGradientStartPointX",0),ce.addGetterSetter(ct,"fillRadialGradientStartPointY",0),ce.addComponentsGetterSetter(ct,"fillRadialGradientEndPoint",["x","y"]),ce.addGetterSetter(ct,"fillRadialGradientEndPointX",0),ce.addGetterSetter(ct,"fillRadialGradientEndPointY",0),ce.addGetterSetter(ct,"fillPatternRotation",0),ce.addGetterSetter(ct,"fillRule",void 0,jl()),ce.backCompat(ct,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var fO="beforeDraw",hO="draw",D4=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],pO=D4.length,Wl=class extends di{constructor(e){super(e),this.canvas=new Ga,this.hitCanvas=new i0({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){wt.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!wt.prototype.moveUp.call(this))return!1;const e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(wt.prototype.moveDown.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(wt.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return wt.prototype.remove.call(this),e&&e.parentNode&&Ie._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Ie.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),wt.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Ie.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Ie.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Ie.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<pO;r++){const o=D4[r],i=this._getIntersection({x:e.x+o.x*t,y:e.y+o.y*t}),s=i.shape;if(s)return s;if(n=!!i.antialiased,!i.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){const o=mf[Ie.getHitColorKey(n[0],n[1],n[2])];return o?{shape:o}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas();return this._fire(fO,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),di.prototype.drawScene.call(this,o,t,n),this._fire(hO,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),di.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Ie.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Ie.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Ie.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Wl.prototype.nodeType="Layer",vr(Wl),ce.addGetterSetter(Wl,"imageSmoothingEnabled",!0),ce.addGetterSetter(Wl,"clearBeforeDraw",!0),ce.addGetterSetter(Wl,"hitGraphEnabled",!0,ji());var m0=class extends Wl{constructor(e){super(e),this.listening(!1),Ie.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};m0.prototype.nodeType="FastLayer",vr(m0);var su=class extends di{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Ie.throw("You may only add groups and shapes to groups.")}};su.prototype.nodeType="Group",vr(su);var g0=(function(){return Vl.performance&&Vl.performance.now?function(){return Vl.performance.now()}:function(){return new Date().getTime()}})(),au=class Uu{constructor(t,n){this.id=Uu.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:g0(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){let n=[];return t&&(n=Array.isArray(t)?t:[t]),this.layers=n,this}getLayers(){return this.layers}addLayer(t){const n=this.layers,r=n.length;for(let o=0;o<r;o++)if(n[o]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=Uu.animations,n=t.length;for(let r=0;r<n;r++)if(t[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=g0(),Uu._addAnimation(this),this}stop(){return Uu._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const n=t.id,r=this.animations,o=r.length;for(let i=0;i<o;i++)if(r[i].id===n){this.animations.splice(i,1);break}}static _runFrames(){const t={},n=this.animations;for(let r=0;r<n.length;r++){const o=n[r],i=o.layers,s=o.func;o._updateFrameObject(g0());const a=i.length;let l;if(s?l=s.call(o,o.frame)!==!1:l=!0,!!l)for(let u=0;u<a;u++){const c=i[u];c._id!==void 0&&(t[c._id]=c)}}for(const r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=Uu;t.animations.length?(t._runFrames(),Ie.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Ie.requestAnimFrame(this._animationLoop))}};au.animations=[],au.animIdCounter=0,au.animRunning=!1;var mO={node:1,duration:1,easing:1,onFinish:1,yoyo:1},gO=1,P4=2,O4=3,F4=["fill","stroke","shadowColor"],vO=0,yO=class{constructor(e,t,n,r,o,i,s){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=i,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=o-this.begin,this.pause()}fire(e){const t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=P4,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=O4,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===P4?this.setTime(e):this.state===O4&&this.setTime(this.duration-e)}pause(){this.state=gO,this.fire("onPause")}getTimer(){return new Date().getTime()}},Fp=class Ir{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||gf.Linear,s=!!t.yoyo;let a,l;typeof t.duration>"u"?a=.3:t.duration===0?a=.001:a=t.duration,this.node=r,this._id=vO++;const u=r.getLayer()||(r instanceof vt.Stage?r.getLayers():null);u||Ie.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new au(function(){n.tween.onEnterFrame()},u),this.tween=new yO(l,function(c){n._tweenFunc(c)},i,0,1,a*1e3,s),this._addListeners(),Ir.attrs[o]||(Ir.attrs[o]={}),Ir.attrs[o][this._id]||(Ir.attrs[o][this._id]={}),Ir.tweens[o]||(Ir.tweens[o]={});for(l in t)mO[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){const r=this.node,o=r._id;let i,s,a,l,u;const c=Ir.tweens[o][t];c&&delete Ir.attrs[o][c][t];let d=r.getAttr(t);if(Ie._isArray(n))if(i=[],s=Math.max(n.length,d.length),t==="points"&&n.length!==d.length&&(n.length>d.length?(l=d,d=Ie._prepareArrayForTween(d,n,r.closed())):(a=n,n=Ie._prepareArrayForTween(n,d,r.closed()))),t.indexOf("fill")===0)for(let h=0;h<s;h++)if(h%2===0)i.push(n[h]-d[h]);else{const m=Ie.colorToRGBA(d[h]);u=Ie.colorToRGBA(n[h]),d[h]=m,i.push({r:u.r-m.r,g:u.g-m.g,b:u.b-m.b,a:u.a-m.a})}else for(let h=0;h<s;h++)i.push(n[h]-d[h]);else F4.indexOf(t)!==-1?(d=Ie.colorToRGBA(d),u=Ie.colorToRGBA(n),i={r:u.r-d.r,g:u.g-d.g,b:u.b-d.b,a:u.a-d.a}):i=n-d;Ir.attrs[o][this._id][t]={start:d,diff:i,end:n,trueEnd:a,trueStart:l},Ir.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Ir.attrs[n._id][this._id];let o,i,s,a,l,u,c,d;for(o in r){if(i=r[o],s=i.start,a=i.diff,d=i.end,Ie._isArray(s))if(l=[],c=Math.max(s.length,d.length),o.indexOf("fill")===0)for(u=0;u<c;u++)u%2===0?l.push((s[u]||0)+a[u]*t):l.push("rgba("+Math.round(s[u].r+a[u].r*t)+","+Math.round(s[u].g+a[u].g*t)+","+Math.round(s[u].b+a[u].b*t)+","+(s[u].a+a[u].a*t)+")");else for(u=0;u<c;u++)l.push((s[u]||0)+a[u]*t);else F4.indexOf(o)!==-1?l="rgba("+Math.round(s.r+a.r*t)+","+Math.round(s.g+a.g*t)+","+Math.round(s.b+a.b*t)+","+(s.a+a.a*t)+")":l=s+a*t;n.setAttr(o,l)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,n=Ir.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,n=Ir.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,n=this._id,r=Ir.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Ir.tweens[t][o];delete Ir.attrs[t][n],Ir.tweens[t]&&(Object.keys(Ir.tweens[t]).length===0&&delete Ir.tweens[t],Object.keys(Ir.attrs[t]).length===0&&delete Ir.attrs[t])}};Fp.attrs={},Fp.tweens={},wt.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Fp(e).play()};const gf={BackEaseIn(e,t,n,r){return n*(e/=r)*e*((1.70158+1)*e-1.70158)+t},BackEaseOut(e,t,n,r){return n*((e=e/r-1)*e*((1.70158+1)*e+1.70158)+1)+t},BackEaseInOut(e,t,n,r){let o=1.70158;return(e/=r/2)<1?n/2*(e*e*(((o*=1.525)+1)*e-o))+t:n/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),-(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t)},ElasticEaseOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),o*Math.pow(2,-10*e)*Math.sin((e*r-s)*(2*Math.PI)/i)+n+t)},ElasticEaseInOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r/2)===2?t+n:(i||(i=r*(.3*1.5)),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),e<1?-.5*(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t:o*Math.pow(2,-10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-gf.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?gf.BounceEaseIn(e*2,0,n,r)*.5+t:gf.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},B4=Ie._assign(vt,{Util:Ie,Transform:Vi,Node:wt,Container:di,Stage:Pp,stages:pf,Layer:Wl,FastLayer:m0,Group:su,DD:In,Shape:ct,shapes:mf,Animation:au,Tween:Fp,Easings:gf,Context:Ip,Canvas:o0});var $s=class extends ct{_sceneFunc(e){const t=vt.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=vt.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=1,s=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=o*(o>0?e:t),u=i*(i>0?t:e),c=s*(s>0?e:t),d=a*(a>0?t:e);return{x:l,y:n?-1*d:c,width:u-l,height:d-c}}};$s.prototype._centroid=!0,$s.prototype.className="Arc",$s.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],vr($s),ce.addGetterSetter($s,"innerRadius",0,dt()),ce.addGetterSetter($s,"outerRadius",0,dt()),ce.addGetterSetter($s,"angle",0,dt()),ce.addGetterSetter($s,"clockwise",!1,ji());function v0(e,t,n,r,o,i,s){const a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),u=s*a/(a+l),c=s*l/(a+l);return[n-u*(o-e),r-u*(i-t),n+c*(o-e),r+c*(i-t)]}function N4(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=v0(e[o-2],e[o-1],e[o],e[o+1],e[o+2],e[o+3],t);isNaN(i[0])||(r.push(i[0]),r.push(i[1]),r.push(e[o]),r.push(e[o+1]),r.push(i[2]),r.push(i[3]))}return r}function bO(e){const t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(const r of t){const o=-3*r[0]+9*r[1]-9*r[2]+3*r[3];if(o!==0){const i=6*r[0]-12*r[1]+6*r[2],s=-3*r[0]+3*r[1],a=i*i-4*o*s;if(a>=0){const l=Math.sqrt(a);n.push((-i+l)/(2*o)),n.push((-i-l)/(2*o))}}}return n.filter(r=>r>0&&r<1).flatMap(r=>t.map(o=>{const i=1-r;return i*i*i*o[0]+3*i*i*r*o[1]+3*i*r*r*o[2]+r*r*r*o[3]}))}var ea=class extends ct{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const t=this.points(),n=t.length,r=this.tension(),o=this.closed(),i=this.bezier();if(!n)return;let s=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){const a=this.getTensionPoints(),l=a.length;for(s=o?0:4,o||e.quadraticCurveTo(a[0],a[1],a[2],a[3]);s<l-2;)e.bezierCurveTo(a[s++],a[s++],a[s++],a[s++],a[s++],a[s++]);o||e.quadraticCurveTo(a[l-2],a[l-1],t[n-2],t[n-1])}else if(i)for(s=2;s<n;)e.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);else for(s=2;s<n;s+=2)e.lineTo(t[s],t[s+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():N4(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=v0(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=v0(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=N4(e,n);return[r[2],r[3]].concat(i).concat([o[0],o[1],e[t-2],e[t-1],o[2],o[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...bO(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let t=e[0],n=e[0],r=e[1],o=e[1],i,s;for(let a=0;a<e.length/2;a++)i=e[a*2],s=e[a*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);return{x:t,y:r,width:n-t,height:o-r}}};ea.prototype.className="Line",ea.prototype._attrsAffectingSize=["points","bezier","tension"],vr(ea),ce.addGetterSetter(ea,"closed",!1),ce.addGetterSetter(ea,"bezier",!1),ce.addGetterSetter(ea,"tension",0,dt()),ce.addGetterSetter(ea,"points",[],OP());const wO=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],CO=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],_O=[[1],[1,1],[1,2,1],[1,3,3,1]],z4=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*wO[20][a]+s,r+=CO[20][a]*SO(e,t,o);return s*r},H4=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const c=l/(2*a),d=u/a,h=n+c,m=d-c*c,p=h*h+m>0?Math.sqrt(h*h+m):0,g=c*c+m>0?Math.sqrt(c*c+m):0,k=c+Math.sqrt(c*c+m)!==0?m*Math.log(Math.abs((h+p)/(c+g))):0;return Math.sqrt(a)/2*(h*p-c*g+k)};function SO(e,t,n){const r=y0(1,n,e),o=y0(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var y0=(e,t,n)=>{const r=n.length-1;let o,i;if(r===0)return 0;if(e===0){i=0;for(let s=0;s<=r;s++)i+=_O[r][s]*Math.pow(1-t,r-s)*Math.pow(t,s)*n[s];return i}else{o=new Array(r);for(let s=0;s<r;s++)o[s]=r*(n[s+1]-n[s]);return y0(e-1,t,o)}};const U4=(e,t,n)=>{let r=1,o=e/t,i=(e-n(o))/t,s=0;for(;r>.001;){const a=n(o+i),l=Math.abs(e-a)/t;if(l<r)r=l,o+=i;else{const u=n(o-i),c=Math.abs(e-u)/t;c<r?(r=c,o-=i):i/=2}if(s++,s>500)break}return o};var xi=class ii extends ct{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ii.parsePathData(this.data()),this.pathLength=ii.getPathLength(this.dataArray)}_sceneFunc(t){const n=this.dataArray;t.beginPath();let r=!1;for(let o=0;o<n.length;o++){const i=n[o].command,s=n[o].points;switch(i){case"L":t.lineTo(s[0],s[1]);break;case"M":t.moveTo(s[0],s[1]);break;case"C":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"Q":t.quadraticCurveTo(s[0],s[1],s[2],s[3]);break;case"A":const a=s[0],l=s[1],u=s[2],c=s[3],d=s[4],h=s[5],m=s[6],p=s[7],g=u>c?u:c,k=u>c?1:u/c,w=u>c?c/u:1;t.translate(a,l),t.rotate(m),t.scale(k,w),t.arc(0,0,g,d,d+h,1-p),t.scale(1/k,1/w),t.rotate(-m),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],c=l.points[5],d=l.points[4]+c;let h=Math.PI/180;if(Math.abs(u-d)<h&&(h=Math.abs(u-d)),c<0)for(let m=u-h;m>d;m-=h){const p=ii.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(p.x,p.y)}else for(let m=u+h;m<d;m+=h){const p=ii.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(p.x,p.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const c=ii.getPointOnCubicBezier(u,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(c.x,c.y)}else t=t.concat(l.points)});let n=t[0],r=t[0],o=t[1],i=t[1],s,a;for(let l=0;l<t.length/2;l++)s=t[l*2],a=t[l*2+1],isNaN(s)||(n=Math.min(n,s),r=Math.max(r,s)),isNaN(a)||(o=Math.min(o,a),i=Math.max(i,a));return{x:n,y:o,width:r-n,height:i-o}}getLength(){return this.pathLength}getPointAtLength(t){return ii.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,n,r,o){return Math.sqrt((r-t)*(r-t)+(o-n)*(o-n))}static getPathLength(t){let n=0;for(let r=0;r<t.length;++r)n+=t[r].pathLength;return n}static getPointAtLengthOfDataArray(t,n){let r,o=0,i=n.length;if(!i)return null;for(;o<i&&t>n[o].pathLength;)t-=n[o].pathLength,++o;if(o===i)return r=n[o-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[o].command==="M"?(r=n[o].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[o].start.x,y:n[o].start.y};const s=n[o],a=s.points;switch(s.command){case"L":return ii.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return ii.getPointOnCubicBezier(U4(t,ii.getPathLength(n),g=>z4([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],g)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return ii.getPointOnQuadraticBezier(U4(t,ii.getPathLength(n),g=>H4([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],g)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],u=a[1],c=a[2],d=a[3],h=a[5],m=a[6];let p=a[4];return p+=h*t/s.pathLength,ii.getPointOnEllipticalArc(l,u,c,d,p,m)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),c=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),d=u*c;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+c,y:a+d};const h=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),m=n+h*(o-n),p=r+h*(i-r),g=this.getLineLength(s,a,m,p),k=Math.sqrt(t*t-g*g),w=Math.sqrt(k*k/(1+u*u))*(o<n?-1:1),S=u*w;return{x:m+w,y:p+S}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function c(p){return p*p*p}function d(p){return 3*p*p*(1-p)}function h(p){return 3*p*(1-p)*(1-p)}function m(p){return(1-p)*(1-p)*(1-p)}return{x:l*c(t)+s*d(t)+o*h(t)+n*m(t),y:u*c(t)+a*d(t)+i*h(t)+r*m(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(d){return d*d}function u(d){return 2*d*(1-d)}function c(d){return(1-d)*(1-d)}return{x:s*l(t)+o*u(t)+n*c(t),y:a*l(t)+i*u(t)+r*c(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let d=0;d<r.length;d++)n=n.replace(new RegExp(r[d],"g"),"|"+r[d]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let c;for(let d=1;d<o.length;d++){let h=o[d],m=h.charAt(0);for(h=h.slice(1),s.length=0;c=u.exec(h);)s.push(c[0]);let p=[],g=m==="A"||m==="a"?0:-1;for(let k=0,w=s.length;k<w;k++){const S=s[k];if(S==="00"){p.push(0,0),g>=0&&(g+=2,g>=7&&(g-=7));continue}if(g>=0){if(g===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(S)){p.push(parseInt(S[0],10)),p.push(parseInt(S[1],10)),p.push(parseFloat(S.slice(2))),g+=3,g>=7&&(g-=7);continue}if(S==="11"||S==="10"||S==="01"){p.push(parseInt(S[0],10)),p.push(parseInt(S[1],10)),g+=2,g>=7&&(g-=7);continue}if(S==="0"||S==="1"){p.push(parseInt(S,10)),g+=1,g>=7&&(g-=7);continue}}else if(g===4){if(/^[01]\d+(?:\.\d+)?$/.test(S)){p.push(parseInt(S[0],10)),p.push(parseFloat(S.slice(1))),g+=2,g>=7&&(g-=7);continue}if(S==="0"||S==="1"){p.push(parseInt(S,10)),g+=1,g>=7&&(g-=7);continue}}const y=parseFloat(S);isNaN(y)?p.push(0):p.push(y),g+=1,g>=7&&(g-=7)}else{const y=parseFloat(S);isNaN(y)?p.push(0):p.push(y)}}for(;p.length>0&&!isNaN(p[0]);){let k="",w=[];const S=a,y=l;let C,T,R,M,H,B,z,X,P,N;switch(m){case"l":a+=p.shift(),l+=p.shift(),k="L",w.push(a,l);break;case"L":a=p.shift(),l=p.shift(),w.push(a,l);break;case"m":const I=p.shift(),L=p.shift();if(a+=I,l+=L,k="M",i.length>2&&i[i.length-1].command==="z"){for(let Y=i.length-2;Y>=0;Y--)if(i[Y].command==="M"){a=i[Y].points[0]+I,l=i[Y].points[1]+L;break}}w.push(a,l),m="l";break;case"M":a=p.shift(),l=p.shift(),k="M",w.push(a,l),m="L";break;case"h":a+=p.shift(),k="L",w.push(a,l);break;case"H":a=p.shift(),k="L",w.push(a,l);break;case"v":l+=p.shift(),k="L",w.push(a,l);break;case"V":l=p.shift(),k="L",w.push(a,l);break;case"C":w.push(p.shift(),p.shift(),p.shift(),p.shift()),a=p.shift(),l=p.shift(),w.push(a,l);break;case"c":w.push(a+p.shift(),l+p.shift(),a+p.shift(),l+p.shift()),a+=p.shift(),l+=p.shift(),k="C",w.push(a,l);break;case"S":T=a,R=l,C=i[i.length-1],C.command==="C"&&(T=a+(a-C.points[2]),R=l+(l-C.points[3])),w.push(T,R,p.shift(),p.shift()),a=p.shift(),l=p.shift(),k="C",w.push(a,l);break;case"s":T=a,R=l,C=i[i.length-1],C.command==="C"&&(T=a+(a-C.points[2]),R=l+(l-C.points[3])),w.push(T,R,a+p.shift(),l+p.shift()),a+=p.shift(),l+=p.shift(),k="C",w.push(a,l);break;case"Q":w.push(p.shift(),p.shift()),a=p.shift(),l=p.shift(),w.push(a,l);break;case"q":w.push(a+p.shift(),l+p.shift()),a+=p.shift(),l+=p.shift(),k="Q",w.push(a,l);break;case"T":T=a,R=l,C=i[i.length-1],C.command==="Q"&&(T=a+(a-C.points[0]),R=l+(l-C.points[1])),a=p.shift(),l=p.shift(),k="Q",w.push(T,R,a,l);break;case"t":T=a,R=l,C=i[i.length-1],C.command==="Q"&&(T=a+(a-C.points[0]),R=l+(l-C.points[1])),a+=p.shift(),l+=p.shift(),k="Q",w.push(T,R,a,l);break;case"A":M=p.shift(),H=p.shift(),B=p.shift(),z=p.shift(),X=p.shift(),P=a,N=l,a=p.shift(),l=p.shift(),k="A",w=this.convertEndpointToCenterParameterization(P,N,a,l,z,X,M,H,B);break;case"a":M=p.shift(),H=p.shift(),B=p.shift(),z=p.shift(),X=p.shift(),P=a,N=l,a+=p.shift(),l+=p.shift(),k="A",w=this.convertEndpointToCenterParameterization(P,N,a,l,z,X,M,H,B);break}i.push({command:k||m,points:w,start:{x:S,y},pathLength:this.calcLength(S,y,k||m,w)})}(m==="z"||m==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=ii;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return z4([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return H4([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const c=o[4],d=o[5],h=o[4]+d;let m=Math.PI/180;if(Math.abs(c-h)<m&&(m=Math.abs(c-h)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],c,0),d<0)for(l=c-m;l>h;l-=m)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+m;l<h;l+=m)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],h,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const c=u*(Math.PI/180),d=Math.cos(c)*(t-r)/2+Math.sin(c)*(n-o)/2,h=-1*Math.sin(c)*(t-r)/2+Math.cos(c)*(n-o)/2,m=d*d/(a*a)+h*h/(l*l);m>1&&(a*=Math.sqrt(m),l*=Math.sqrt(m));let p=Math.sqrt((a*a*(l*l)-a*a*(h*h)-l*l*(d*d))/(a*a*(h*h)+l*l*(d*d)));i===s&&(p*=-1),isNaN(p)&&(p=0);const g=p*a*h/l,k=p*-l*d/a,w=(t+r)/2+Math.cos(c)*g-Math.sin(c)*k,S=(n+o)/2+Math.sin(c)*g+Math.cos(c)*k,y=function(z){return Math.sqrt(z[0]*z[0]+z[1]*z[1])},C=function(z,X){return(z[0]*X[0]+z[1]*X[1])/(y(z)*y(X))},T=function(z,X){return(z[0]*X[1]<z[1]*X[0]?-1:1)*Math.acos(C(z,X))},R=T([1,0],[(d-g)/a,(h-k)/l]),M=[(d-g)/a,(h-k)/l],H=[(-1*d-g)/a,(-1*h-k)/l];let B=T(M,H);return C(M,H)<=-1&&(B=Math.PI),C(M,H)>=1&&(B=0),s===0&&B>0&&(B=B-2*Math.PI),s===1&&B<0&&(B=B+2*Math.PI),[w,S,a,l,R,B,c,s]}};xi.prototype.className="Path",xi.prototype._attrsAffectingSize=["data"],vr(xi),ce.addGetterSetter(xi,"data");var Kl=class extends ea{_sceneFunc(e){super._sceneFunc(e);const t=Math.PI*2,n=this.points();let r=n;const o=this.tension()!==0&&n.length>4;o&&(r=this.getTensionPoints());const i=this.pointerLength(),s=n.length;let a,l;if(o){const d=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],h=xi.calcLength(r[r.length-4],r[r.length-3],"C",d),m=xi.getPointOnQuadraticBezier(Math.min(1,1-i/h),d[0],d[1],d[2],d[3],d[4],d[5]);a=n[s-2]-m.x,l=n[s-1]-m.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,c=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,c/2),e.lineTo(-i,-c/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,c/2),e.lineTo(-i,-c/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Kl.prototype.className="Arrow",vr(Kl),ce.addGetterSetter(Kl,"pointerLength",10,dt()),ce.addGetterSetter(Kl,"pointerWidth",10,dt()),ce.addGetterSetter(Kl,"pointerAtBeginning",!1),ce.addGetterSetter(Kl,"pointerAtEnding",!0);var lu=class extends ct{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};lu.prototype._centroid=!0,lu.prototype.className="Circle",lu.prototype._attrsAffectingSize=["radius"],vr(lu),ce.addGetterSetter(lu,"radius",0,dt());var qa=class extends ct{_sceneFunc(e){const t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};qa.prototype.className="Ellipse",qa.prototype._centroid=!0,qa.prototype._attrsAffectingSize=["radiusX","radiusY"],vr(qa),ce.addComponentsGetterSetter(qa,"radius",["x","y"]),ce.addGetterSetter(qa,"radiusX",0,dt()),ce.addGetterSetter(qa,"radiusY",0,dt());var Gi=class UA extends ct{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",this._loadListener)}_removeImageLoad(t){t&&t.removeEventListener&&t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const t=!!this.cornerRadius(),n=this.hasShadow();return t&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),o=this.cornerRadius(),i=this.attrs.image;let s;if(i){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[i,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[i,0,0,n,r]}(this.hasFill()||this.hasStroke()||o)&&(t.beginPath(),o?Ie.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),i&&(o&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){const n=this.width(),r=this.height(),o=this.cornerRadius();t.beginPath(),o?Ie.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n,r;return(r=(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&r!==void 0?r:0}getHeight(){var t,n,r;return(r=(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&r!==void 0?r:0}static fromURL(t,n,r=null){const o=Ie.createImageElement();o.onload=function(){n(new UA({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};Gi.prototype.className="Image",Gi.prototype._attrsAffectingSize=["image"],vr(Gi),ce.addGetterSetter(Gi,"cornerRadius",0,xp(4)),ce.addGetterSetter(Gi,"image"),ce.addComponentsGetterSetter(Gi,"crop",["x","y","width","height"]),ce.addGetterSetter(Gi,"cropX",0,dt()),ce.addGetterSetter(Gi,"cropY",0,dt()),ce.addGetterSetter(Gi,"cropWidth",0,dt()),ce.addGetterSetter(Gi,"cropHeight",0,dt());var V4=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],kO="Change.konva",AO="none",b0="up",w0="right",C0="down",_0="left",IO=V4.length,S0=class extends su{constructor(e){super(e),this.on("add.konva",function(t){this._addListeners(t.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let t=this,n;const r=function(){t._sync()};for(n=0;n<IO;n++)e.on(V4[n]+kO,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,o,i,s,a,l;if(e&&t){switch(n=e.width(),r=e.height(),o=t.pointerDirection(),i=t.pointerWidth(),l=t.pointerHeight(),s=0,a=0,o){case b0:s=n/2,a=-1*l;break;case w0:s=n+i,a=r/2;break;case C0:s=n/2,a=r+l;break;case _0:s=-1*i,a=r/2;break}t.setAttrs({x:-1*s,y:-1*a,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*a})}}};S0.prototype.className="Label",vr(S0);var ql=class extends ct{_sceneFunc(e){const t=this.width(),n=this.height(),r=this.pointerDirection(),o=this.pointerWidth(),i=this.pointerHeight(),s=this.cornerRadius();let a=0,l=0,u=0,c=0;typeof s=="number"?a=l=u=c=Math.min(s,t/2,n/2):(a=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),c=Math.min(s[2]||0,t/2,n/2),u=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(a,0),r===b0&&(e.lineTo((t-o)/2,0),e.lineTo(t/2,-1*i),e.lineTo((t+o)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,Math.PI*3/2,0,!1),r===w0&&(e.lineTo(t,(n-i)/2),e.lineTo(t+o,n/2),e.lineTo(t,(n+i)/2)),e.lineTo(t,n-c),e.arc(t-c,n-c,c,0,Math.PI/2,!1),r===C0&&(e.lineTo((t+o)/2,n),e.lineTo(t/2,n+i),e.lineTo((t-o)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===_0&&(e.lineTo(0,(n+i)/2),e.lineTo(-1*o,n/2),e.lineTo(0,(n-i)/2)),e.lineTo(0,a),e.arc(a,a,a,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),o=this.pointerDirection(),i=this.width(),s=this.height();return o===b0?(t-=r,s+=r):o===C0?s+=r:o===_0?(e-=n*1.5,i+=n):o===w0&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};ql.prototype.className="Tag",vr(ql),ce.addGetterSetter(ql,"pointerDirection",AO),ce.addGetterSetter(ql,"pointerWidth",0,dt()),ce.addGetterSetter(ql,"pointerHeight",0,dt()),ce.addGetterSetter(ql,"cornerRadius",0,xp(4));var vf=class extends ct{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Ie.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};vf.prototype.className="Rect",vr(vf),ce.addGetterSetter(vf,"cornerRadius",0,xp(4));var Ya=class extends ct{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Ie.drawRoundedPolygonPath(e,t,r,n,o);else{e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();let t=e[0].x,n=e[0].x,r=e[0].y,o=e[0].y;return e.forEach(i=>{t=Math.min(t,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),o=Math.max(o,i.y)}),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};Ya.prototype.className="RegularPolygon",Ya.prototype._centroid=!0,Ya.prototype._attrsAffectingSize=["radius"],vr(Ya),ce.addGetterSetter(Ya,"radius",0,dt()),ce.addGetterSetter(Ya,"sides",0,dt()),ce.addGetterSetter(Ya,"cornerRadius",0,xp(4));var j4=Math.PI*2,Yl=class extends ct{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,j4,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),j4,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};Yl.prototype.className="Ring",Yl.prototype._centroid=!0,Yl.prototype._attrsAffectingSize=["innerRadius","outerRadius"],vr(Yl),ce.addGetterSetter(Yl,"innerRadius",0,dt()),ce.addGetterSetter(Yl,"outerRadius",0,dt());var fs=class extends ct{constructor(e){super(e),this._updated=!0,this.anim=new au(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+0],a=o[r+1],l=o[r+2],u=o[r+3],c=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),c)if(i){const d=i[t],h=n*2;e.drawImage(c,s,a,l,u,d[h+0],d[h+1],l,u)}else e.drawImage(c,s,a,l,u,0,0,l,u)}_hitFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+2],a=o[r+3];if(e.beginPath(),i){const l=i[t],u=n*2;e.rect(l[u+0],l[u+1],s,a)}else e.rect(0,0,s,a);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};fs.prototype.className="Sprite",vr(fs),ce.addGetterSetter(fs,"animation"),ce.addGetterSetter(fs,"animations"),ce.addGetterSetter(fs,"frameOffsets"),ce.addGetterSetter(fs,"image"),ce.addGetterSetter(fs,"frameIndex",0,dt()),ce.addGetterSetter(fs,"frameRate",17,dt()),ce.backCompat(fs,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Xa=class extends ct{_sceneFunc(e){const t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let o=1;o<r*2;o++){const i=o%2===0?n:t,s=i*Math.sin(o*Math.PI/r),a=-1*i*Math.cos(o*Math.PI/r);e.lineTo(s,a)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};Xa.prototype.className="Star",Xa.prototype._centroid=!0,Xa.prototype._attrsAffectingSize=["innerRadius","outerRadius"],vr(Xa),ce.addGetterSetter(Xa,"numPoints",5,dt()),ce.addGetterSetter(Xa,"innerRadius",0,dt()),ce.addGetterSetter(Xa,"outerRadius",0,dt());function Qa(e){return[...e].reduce((t,n,r,o)=>{if(/\p{Emoji}/u.test(n)){const i=o[r+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(t.push(n+i),o[r+1]=""):t.push(n)}else/\p{Regional_Indicator}{2}/u.test(n+(o[r+1]||""))?t.push(n+o[r+1]):r>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(n)?t[t.length-1]+=n:n&&t.push(n);return t},[])}var cu="auto",EO="center",G4="inherit",yf="justify",xO="Change.konva",W4="2d",K4="-",q4="left",TO="text",RO="Text",MO="top",LO="bottom",Y4="middle",X4="normal",DO="px ",Bp=" ",PO="right",Q4="rtl",OO="word",FO="char",Z4="none",k0="β¦",J4=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],BO=J4.length,bf=null;function NO(){if(bf!==null)return bf;bf=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(W4);if(t){t.globalAlpha=0,t.shadowColor="black",t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle="black",t.font="10px Arial",t.fillText("X",0,10);const n=t.getImageData(0,0,10,10).data;for(let r=3;r<n.length;r+=4)if(n[r]>0){bf=!0;break}}}catch{}return bf}function zO(e){return e.split(",").map(t=>{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Np;function A0(){return Np||(Np=Ie.createCanvasElement().getContext(W4),Np)}function HO(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function UO(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function VO(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var Jn=class extends ct{constructor(e){super(VO(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<BO;t++)this.on(J4[t]+xO,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),c=0,d=this.align(),h=this.getWidth(),m=this.letterSpacing(),p=this.charRenderFunc(),g=this.fill(),k=this.textDecoration(),w=this.underlineOffset(),S=k.indexOf("underline")!==-1,y=k.indexOf("line-through")!==-1,C;u=u===G4?e.direction:u;let T=a/2,R=Y4;if(!vt.legacyTextRendering){const M=this.measureSize("M");R="alphabetic",T=(((t=M.fontBoundingBoxAscent)!==null&&t!==void 0?t:M.actualBoundingBoxAscent)-((n=M.fontBoundingBoxDescent)!==null&&n!==void 0?n:M.actualBoundingBoxDescent))/2+a/2}for(u===Q4&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",R),e.setAttr("textAlign",q4),l===Y4?c=(this.getHeight()-o*a-i*2)/2:l===LO&&(c=this.getHeight()-o*a-i*2),e.translate(i,c+i),C=0;C<o;C++){let M=0,H=0;const B=r[C],z=B.text,X=B.width,P=B.lastInParagraph;if(e.save(),d===PO?M+=h-X-i*2:d===EO&&(M+=(h-X-i*2)/2),S){e.save(),e.beginPath();const I=w??(vt.legacyTextRendering?Math.round(s/2):Math.round(s/4)),L=M,Y=T+H+I;e.moveTo(L,Y);const te=d===yf&&!P?h-i*2:X;e.lineTo(L+Math.round(te),Y),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||g,e.stroke(),e.restore()}const N=M;if(u!==Q4&&(m!==0||d===yf||p)){const I=z.split(" ").length-1,L=Qa(z);for(let Y=0;Y<L.length;Y++){const te=L[Y];if(te===" "&&!P&&d===yf&&(M+=(h-i*2-X)/I),this._partialTextX=M,this._partialTextY=T+H,this._partialText=te,p){e.save();const le=r.slice(0,C).reduce((fe,Ne)=>fe+Qa(Ne.text).length,0);p({char:te,index:Y+le,x:M,y:T+H,lineIndex:C,column:Y,isLastInLine:P,width:this.measureSize(te).width,context:e})}e.fillStrokeShape(this),p&&e.restore(),M+=this.measureSize(te).width+m}}else m!==0&&e.setAttr("letterSpacing",`${m}px`),this._partialTextX=M,this._partialTextY=T+H,this._partialText=z,e.fillStrokeShape(this);if(y){e.save(),e.beginPath();const I=vt.legacyTextRendering?0:-Math.round(s/4),L=N;e.moveTo(L,T+H+I);const Y=d===yf&&!P?h-i*2:X;e.lineTo(L+Math.round(Y),T+H+I),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||g,e.stroke(),e.restore()}e.restore(),o>1&&(T+=a)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=Ie._isString(e)?e:e==null?"":e+"";return this._setAttr(TO,t),this}getWidth(){return this.attrs.width===cu||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===cu||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Ie.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,r,o,i,s,a,l,u,c,d;let h=A0(),m=this.fontSize(),p;h.save(),h.font=this._getContextFont(),p=h.measureText(e),h.restore();const g=m/100;return{actualBoundingBoxAscent:(t=p.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*g,actualBoundingBoxDescent:(n=p.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=p.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*g,actualBoundingBoxRight:(o=p.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*g,alphabeticBaseline:(i=p.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=p.emHeightAscent)!==null&&s!==void 0?s:100*g,emHeightDescent:(a=p.emHeightDescent)!==null&&a!==void 0?a:-20*g,fontBoundingBoxAscent:(l=p.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*g,fontBoundingBoxDescent:(u=p.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*g,hangingBaseline:(c=p.hangingBaseline)!==null&&c!==void 0?c:72.80000305175781*g,ideographicBaseline:(d=p.ideographicBaseline)!==null&&d!==void 0?d:-21*g,width:p.width,height:m}}_getContextFont(){return this.fontStyle()+Bp+this.fontVariant()+Bp+(this.fontSize()+DO)+zO(this.fontFamily())}_addTextLine(e){this.align()===yf&&(e=e.trim());const t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){const t=this.letterSpacing(),n=e.length;return A0().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
|
|
100
|
+
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,s=o!==cu&&o!==void 0,a=i!==cu&&i!==void 0,l=this.padding(),u=o-l*2,c=i-l*2,d=0,h=this.wrap(),m=h!==FO&&h!==Z4,p=this.ellipsis();this.textArr=[],A0().font=this._getContextFont();const g=p?this._getTextWidth(k0):0;for(let k=0,w=e.length;k<w;++k){let S=e[k],y=this._getTextWidth(S);if(s&&y>u)for(;S.length>0;){let C=0,T=Qa(S).length,R="",M=0;for(;C<T;){const H=C+T>>>1,B=Qa(S).slice(0,H+1).join(""),z=this._getTextWidth(B);(p&&a&&d+r>c?z+g:z)<=u?(C=H+1,R=B,M=z):T=H}if(R){if(m){const H=Qa(S),B=Qa(R),z=H[B.length],X=z===Bp||z===K4;let P;if(X&&M<=u)P=B.length;else{const N=B.lastIndexOf(Bp),I=B.lastIndexOf(K4);P=Math.max(N,I)+1}P>0&&(C=P,R=H.slice(0,C).join(""),M=this._getTextWidth(R))}if(R=R.trimRight(),this._addTextLine(R),n=Math.max(n,M),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if(S=Qa(S).slice(C).join("").trimLeft(),S.length>0&&(y=this._getTextWidth(S),y<=u)){this._addTextLine(S),d+=r,n=Math.max(n,y);break}}else break}else this._addTextLine(S),d+=r,n=Math.max(n,y),this._shouldHandleEllipsis(d)&&k<w-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&d+r>c)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==cu&&r!==void 0,i=r-this.padding()*2;return this.wrap()===Z4||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==cu&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),o=this.textArr[this.textArr.length-1];!o||!r||(t&&(this._getTextWidth(o.text+k0)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+k0))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&NO()?!0:super._useBufferCanvas()}};Jn.prototype._fillFunc=HO,Jn.prototype._strokeFunc=UO,Jn.prototype.className=RO,Jn.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],vr(Jn),ce.overWriteSetter(Jn,"width",s0()),ce.overWriteSetter(Jn,"height",s0()),ce.addGetterSetter(Jn,"direction",G4),ce.addGetterSetter(Jn,"fontFamily","Arial"),ce.addGetterSetter(Jn,"fontSize",12,dt()),ce.addGetterSetter(Jn,"fontStyle",X4),ce.addGetterSetter(Jn,"fontVariant",X4),ce.addGetterSetter(Jn,"padding",0,dt()),ce.addGetterSetter(Jn,"align",q4),ce.addGetterSetter(Jn,"verticalAlign",MO),ce.addGetterSetter(Jn,"lineHeight",1,dt()),ce.addGetterSetter(Jn,"wrap",OO),ce.addGetterSetter(Jn,"ellipsis",!1,ji()),ce.addGetterSetter(Jn,"letterSpacing",0,dt()),ce.addGetterSetter(Jn,"text","",jl()),ce.addGetterSetter(Jn,"textDecoration",""),ce.addGetterSetter(Jn,"underlineOffset",void 0,dt()),ce.addGetterSetter(Jn,"charRenderFunc",void 0);var jO="",$4="normal";function ek(e){e.fillText(this.partialText,0,0)}function tk(e){e.strokeText(this.partialText,0,0)}var Kr=class extends ct{constructor(e){super(e),this.dummyCanvas=Ie.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return xi.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:xi.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=xi.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const t=this.textDecoration(),n=this.fill(),r=this.fontSize(),o=this.glyphInfo,i=t.indexOf("underline")!==-1,s=t.indexOf("line-through")!==-1;i&&e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),this.partialText=o[a].text,e.fillStrokeShape(this),i&&(a===0&&e.moveTo(0,r/2+1),e.lineTo(o[a].width,r/2+1)),e.restore()}if(i&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),s){e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),a===0&&e.moveTo(0,0),e.lineTo(o[a].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const t=this.glyphInfo;if(t.length>=1){const n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){const r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Ie.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Jn.prototype.setText.call(this,e)}_getContextFont(){return Jn.prototype._getContextFont.call(this)}_getTextSize(e){const t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();const n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=Qa(this.text()),t=[];let n=0;for(let h=0;h<e.length;h++)t.push({char:e[h],width:this._getTextSize(e[h]).width}),n+=t[h].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let c=0;s==="center"&&(c=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(c=Math.max(0,this.pathLength-u));let d=c;for(let h=0;h<t.length;h++){const m=this._getPointAtLength(d);if(!m)return;const p=t[h].char;let g=t[h].width+i;if(p===" "&&s==="justify"){const R=this.text().split(" ").length-1;g+=(this.pathLength-u)/R}const k=d+g,w=this._getPointAtLength(k>this.pathLength&&k-this.pathLength<=l?this.pathLength:k);if(!w)return;const S=xi.getLineLength(m.x,m.y,w.x,w.y);let y=0;if(a)try{y=a(t[h-1].char,p)*this.fontSize()}catch{y=0}m.x+=y,w.x+=y,this.textWidth+=y;const C=xi.getPointOnLine(y+S/2,m.x,m.y,w.x,w.y),T=Math.atan2(w.y-m.y,w.x-m.x);this.glyphInfo.push({transposeX:C.x,transposeY:C.y,text:e[h],rotation:T,p0:m,p1:w,width:S}),d+=g}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return Ie.releaseCanvas(this.dummyCanvas),super.destroy()}};Kr.prototype._fillFunc=ek,Kr.prototype._strokeFunc=tk,Kr.prototype._fillFuncHit=ek,Kr.prototype._strokeFuncHit=tk,Kr.prototype.className="TextPath",Kr.prototype._attrsAffectingSize=["text","fontSize","data"],vr(Kr),ce.addGetterSetter(Kr,"data"),ce.addGetterSetter(Kr,"fontFamily","Arial"),ce.addGetterSetter(Kr,"fontSize",12,dt()),ce.addGetterSetter(Kr,"fontStyle",$4),ce.addGetterSetter(Kr,"align","left"),ce.addGetterSetter(Kr,"letterSpacing",0,dt()),ce.addGetterSetter(Kr,"textBaseline","middle"),ce.addGetterSetter(Kr,"fontVariant",$4),ce.addGetterSetter(Kr,"text",jO),ce.addGetterSetter(Kr,"textDecoration",""),ce.addGetterSetter(Kr,"kerningFunc",void 0);var nk="tr-konva",GO=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${nk}`).join(" "),rk="nodesRect",WO=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],KO={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},qO="ontouchstart"in vt._global;function YO(e,t,n){if(e==="rotater")return n;t+=Ie.degToRad(KO[e]||0);const r=(Ie.radToDeg(t)%360+360)%360;return Ie._inRange(r,337.5,360)||Ie._inRange(r,0,22.5)?"ns-resize":Ie._inRange(r,22.5,67.5)?"nesw-resize":Ie._inRange(r,67.5,112.5)?"ew-resize":Ie._inRange(r,112.5,157.5)?"nwse-resize":Ie._inRange(r,157.5,202.5)?"ns-resize":Ie._inRange(r,202.5,247.5)?"nesw-resize":Ie._inRange(r,247.5,292.5)?"ew-resize":Ie._inRange(r,292.5,337.5)?"nwse-resize":(Ie.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var zp=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],ok=1e8;function XO(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function ik(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:o}}function QO(e,t){return ik(e,t,XO(e))}function ZO(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=vt.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var I0=0,Sn=class extends su{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(GO,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Ie.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return nk+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e=e.filter(t=>t.isAncestorOf(this)?(Ie.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0),e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(t=>{const n=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(t._attrsAffectingSize.length){const r=t._attrsAffectingSize.map(o=>o+"Change."+this._getEventNamespace()).join(" ");t.on(r,n)}t.on(WO.map(r=>r+`.${this._getEventNamespace()}`).join(" "),n),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,n),this._proxyDrag(t)}),this._resetTransformCache(),this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach(s=>{if(s===e||s.isDragging())return;const a=s.getAbsolutePosition();s.setAbsolutePosition({x:a.x+o,y:a.y+i}),s.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(rk),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(rk,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){const r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),s=r.x*o.x-e.offsetX()*o.x,a=r.y*o.y-e.offsetY()*o.y,l=(vt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return ik({x:i.x+s*Math.cos(l)+a*Math.sin(-l),y:i.y+a*Math.cos(l)+s*Math.sin(l),width:r.width*o.x,height:r.height*o.y,rotation:l},-vt.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-ok,y:-ok,width:0,height:0,rotation:0};const e=[];this.nodes().map(a=>{const l=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),u=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}],c=a.getAbsoluteTransform();u.forEach(function(d){const h=c.point(d);e.push(h)})});const t=new Vi;t.rotate(-vt.getAngle(this.rotation()));let n=1/0,r=1/0,o=-1/0,i=-1/0;e.forEach(function(a){const l=t.point(a);n===void 0&&(n=o=l.x,r=i=l.y),n=Math.min(n,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),i=Math.max(i,l.y)}),t.invert();const s=t.point({x:n,y:r});return{x:s.x,y:s.y,width:o-n,height:i-r,rotation:vt.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),zp.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new vf({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:qO?10:"auto"}),n=this;t.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),t.on("dragstart",r=>{t.stopDrag(),r.cancelBubble=!0}),t.on("dragend",r=>{r.cancelBubble=!0}),t.on("mouseenter",()=>{const r=YO(e,vt.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0}),t.on("mouseout",()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(t)}_createBack(){const e=new ct({name:"back",width:0,height:0,sceneFunc(t,n){const r=n.getParent(),o=r.padding(),i=n.width(),s=n.height();if(t.beginPath(),t.rect(-o,-o,i+o*2,s+o*2),r.rotateEnabled()&&r.rotateLineVisible()){const a=r.rotateAnchorAngle(),l=r.rotateAnchorOffset(),u=Ie.degToRad(a),c=Math.sin(u),d=-Math.cos(u),h=i/2,m=s/2;let p=1/0;d<0?p=Math.min(p,-m/d):d>0&&(p=Math.min(p,(s-m)/d)),c<0?p=Math.min(p,-h/c):c>0&&(p=Math.min(p,(i-h)/c));const g=h+c*p,k=m+d*p,w=Ie._sign(s),S=g+c*l*w,y=k+d*l*w;t.moveTo(g,k),t.lineTo(S,y)}t.fillStrokeShape(n)},hitFunc:(t,n)=>{if(!this.shouldOverdrawWholeArea())return;const r=this.padding();t.beginPath(),t.rect(-r,-r,n.width()+r*2,n.height()+r*2),t.fillStrokeShape(n)}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const i=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-i.x,y:s.y-i.y},I0++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(a=>{a._fire("transformstart",{evt:e.evt,target:a})})}_handleMouseMove(e){let t,n,r;const o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const s=i.getPointerPosition();let a={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(l,a,e)),o.setAbsolutePosition(a);const u=o.getAbsolutePosition();if(l.x===u.x&&l.y===u.y)return;if(this._movingAnchorName==="rotater"){const w=this._getNodeRect();t=o.x()-w.width/2,n=-o.y()+w.height/2;const S=vt.getAngle(this.rotateAnchorAngle());let y=Math.atan2(-n,t)+Math.PI/2-S;w.height<0&&(y-=Math.PI);const C=vt.getAngle(this.rotation())+y,T=vt.getAngle(this.rotationSnapTolerance()),R=QO(w,ZO(this.rotationSnaps(),C,T)-w.rotation);this._fitNodesInto(R,e);return}const c=this.shiftBehavior();let d;c==="inverted"?d=this.keepRatio()&&!e.shiftKey:c==="none"?d=this.keepRatio():d=this.keepRatio()||e.shiftKey;let h=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(d){const w=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(w.y-o.y(),2));const S=this.findOne(".top-left").x()>w.x?-1:1,y=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,this.findOne(".top-left").x(w.x-t),this.findOne(".top-left").y(w.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(d){const w=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(w.y-o.y(),2));const S=this.findOne(".top-right").x()<w.x?-1:1,y=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var m=o.position();this.findOne(".top-left").y(m.y),this.findOne(".bottom-right").x(m.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(d){const w=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(o.y()-w.y,2));const S=w.x<o.x()?-1:1,y=o.y()<w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,o.x(w.x-t),o.y(w.y+n)}m=o.position(),this.findOne(".top-left").x(m.x),this.findOne(".bottom-right").y(m.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(d){const w=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(o.y()-w.y,2));const S=this.findOne(".bottom-right").x()<w.x?-1:1,y=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,this.findOne(".bottom-right").x(w.x+t),this.findOne(".bottom-right").y(w.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(h=this.centeredScaling()||e.altKey,h){const w=this.findOne(".top-left"),S=this.findOne(".bottom-right"),y=w.x(),C=w.y(),T=this.getWidth()-S.x(),R=this.getHeight()-S.y();S.move({x:-y,y:-C}),w.move({x:T,y:R})}const p=this.findOne(".top-left").getAbsolutePosition();t=p.x,n=p.y;const g=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),k=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:g,height:k,rotation:vt.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();I0--,this._fire("transformend",{evt:e,target:n}),(t=this.getLayer())===null||t===void 0||t.batchDraw(),n&&this._nodes.forEach(r=>{var o;r._fire("transformend",{evt:e,target:r}),(o=r.getLayer())===null||o===void 0||o.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){const n=this._getNodeRect(),r=1;if(Ie._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Ie._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new Vi;if(o.rotate(vt.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=o.point({x:-this.padding()*2,y:0});e.x+=d.x,e.y+=d.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=o.point({x:0,y:-this.padding()*2});e.x+=d.x,e.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(n,e);d?e=d:Ie.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new Vi;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new Vi,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const c=a.multiply(s.invert());this._nodes.forEach(d=>{var h;if(!d.getStage())return;const m=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const g=new Vi;g.multiply(m.copy().invert()).multiply(c).multiply(m).multiply(p);const k=g.decompose();d.setAttrs(k),(h=d.getLayer())===null||h===void 0||h.batchDraw()}),this.rotation(Ie._getRotation(e.rotation)),this._nodes.forEach(d=>{this._fire("transform",{evt:t,target:d}),d._fire("transform",{evt:t,target:d})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;const t=this._getNodeRect();this.rotation(Ie._getRotation(t.rotation));const n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),s=this.padding(),a=this.anchorSize(),l=this.find("._anchor");l.forEach(T=>{T.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+s,offsetY:a/2+s,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:a/2+s,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:a/2-s,offsetY:a/2+s,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:a/2+s,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:a/2-s,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:a/2+s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:a/2-s,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:a/2-s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-right")>=0});const u=this.rotateAnchorAngle(),c=this.rotateAnchorOffset(),d=Ie.degToRad(u),h=Math.sin(d),m=-Math.cos(d),p=n/2,g=r/2;let k=1/0;m<0?k=Math.min(k,-g/m):m>0&&(k=Math.min(k,(r-g)/m)),h<0?k=Math.min(k,-p/h):h>0&&(k=Math.min(k,(n-p)/h));const w=p+h*k,S=g+m*k,y=Ie._sign(r);this._batchChangeChild(".rotater",{x:w+h*c*y,y:S+m*c*y-s*m,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(T=>T.draggable()),x:0,y:0});const C=this.anchorStyleFunc();C&&l.forEach(T=>{C(T)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),su.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(Ie.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return wt.prototype.toObject.call(this)}clone(e){return wt.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Sn.isTransforming=()=>I0>0;function JO(e){return e instanceof Array||Ie.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){zp.indexOf(t)===-1&&Ie.warn("Unknown anchor name: "+t+". Available names are: "+zp.join(", "))}),e||[]}Sn.prototype.className="Transformer",vr(Sn),ce.addGetterSetter(Sn,"enabledAnchors",zp,JO),ce.addGetterSetter(Sn,"flipEnabled",!0,ji()),ce.addGetterSetter(Sn,"resizeEnabled",!0),ce.addGetterSetter(Sn,"anchorSize",10,dt()),ce.addGetterSetter(Sn,"rotateEnabled",!0),ce.addGetterSetter(Sn,"rotateLineVisible",!0),ce.addGetterSetter(Sn,"rotationSnaps",[]),ce.addGetterSetter(Sn,"rotateAnchorOffset",50,dt()),ce.addGetterSetter(Sn,"rotateAnchorAngle",0,dt()),ce.addGetterSetter(Sn,"rotateAnchorCursor","crosshair"),ce.addGetterSetter(Sn,"rotationSnapTolerance",5,dt()),ce.addGetterSetter(Sn,"borderEnabled",!0),ce.addGetterSetter(Sn,"anchorStroke","rgb(0, 161, 255)"),ce.addGetterSetter(Sn,"anchorStrokeWidth",1,dt()),ce.addGetterSetter(Sn,"anchorFill","white"),ce.addGetterSetter(Sn,"anchorCornerRadius",0,dt()),ce.addGetterSetter(Sn,"borderStroke","rgb(0, 161, 255)"),ce.addGetterSetter(Sn,"borderStrokeWidth",1,dt()),ce.addGetterSetter(Sn,"borderDash"),ce.addGetterSetter(Sn,"keepRatio",!0),ce.addGetterSetter(Sn,"shiftBehavior","default"),ce.addGetterSetter(Sn,"centeredScaling",!1),ce.addGetterSetter(Sn,"ignoreStroke",!1),ce.addGetterSetter(Sn,"padding",0,dt()),ce.addGetterSetter(Sn,"nodes"),ce.addGetterSetter(Sn,"node"),ce.addGetterSetter(Sn,"boundBoxFunc"),ce.addGetterSetter(Sn,"anchorDragBoundFunc"),ce.addGetterSetter(Sn,"anchorStyleFunc"),ce.addGetterSetter(Sn,"shouldOverdrawWholeArea",!1),ce.addGetterSetter(Sn,"useSingleNodeRotation",!0),ce.backCompat(Sn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var ta=class extends ct{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,vt.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};ta.prototype.className="Wedge",ta.prototype._centroid=!0,ta.prototype._attrsAffectingSize=["radius"],vr(ta),ce.addGetterSetter(ta,"radius",0,dt()),ce.addGetterSetter(ta,"angle",0,dt()),ce.addGetterSetter(ta,"clockwise",!1),ce.backCompat(ta,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function sk(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var $O=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],eF=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function tF(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,c,d,h,m,p,g,k,w,S,y,C,T,R,M,H;const B=t+t+1,z=r-1,X=o-1,P=t+1,N=P*(P+1)/2,I=new sk,L=$O[t],Y=eF[t];let te=null,le=I,fe=null,Ne=null;for(let he=1;he<B;he++)le=le.next=new sk,he===P&&(te=le);le.next=I,a=s=0;for(let he=0;he<o;he++){k=w=S=y=l=u=c=d=0,h=P*(C=n[s]),m=P*(T=n[s+1]),p=P*(R=n[s+2]),g=P*(M=n[s+3]),l+=N*C,u+=N*T,c+=N*R,d+=N*M,le=I;for(let ge=0;ge<P;ge++)le.r=C,le.g=T,le.b=R,le.a=M,le=le.next;for(let ge=1;ge<P;ge++)i=s+((z<ge?z:ge)<<2),l+=(le.r=C=n[i])*(H=P-ge),u+=(le.g=T=n[i+1])*H,c+=(le.b=R=n[i+2])*H,d+=(le.a=M=n[i+3])*H,k+=C,w+=T,S+=R,y+=M,le=le.next;fe=I,Ne=te;for(let ge=0;ge<r;ge++)n[s+3]=M=d*L>>Y,M!==0?(M=255/M,n[s]=(l*L>>Y)*M,n[s+1]=(u*L>>Y)*M,n[s+2]=(c*L>>Y)*M):n[s]=n[s+1]=n[s+2]=0,l-=h,u-=m,c-=p,d-=g,h-=fe.r,m-=fe.g,p-=fe.b,g-=fe.a,i=a+((i=ge+t+1)<z?i:z)<<2,k+=fe.r=n[i],w+=fe.g=n[i+1],S+=fe.b=n[i+2],y+=fe.a=n[i+3],l+=k,u+=w,c+=S,d+=y,fe=fe.next,h+=C=Ne.r,m+=T=Ne.g,p+=R=Ne.b,g+=M=Ne.a,k-=C,w-=T,S-=R,y-=M,Ne=Ne.next,s+=4;a+=r}for(let he=0;he<r;he++){w=S=y=k=u=c=d=l=0,s=he<<2,h=P*(C=n[s]),m=P*(T=n[s+1]),p=P*(R=n[s+2]),g=P*(M=n[s+3]),l+=N*C,u+=N*T,c+=N*R,d+=N*M,le=I;for(let ae=0;ae<P;ae++)le.r=C,le.g=T,le.b=R,le.a=M,le=le.next;let ge=r;for(let ae=1;ae<=t;ae++)s=ge+he<<2,l+=(le.r=C=n[s])*(H=P-ae),u+=(le.g=T=n[s+1])*H,c+=(le.b=R=n[s+2])*H,d+=(le.a=M=n[s+3])*H,k+=C,w+=T,S+=R,y+=M,le=le.next,ae<X&&(ge+=r);s=he,fe=I,Ne=te;for(let ae=0;ae<o;ae++)i=s<<2,n[i+3]=M=d*L>>Y,M>0?(M=255/M,n[i]=(l*L>>Y)*M,n[i+1]=(u*L>>Y)*M,n[i+2]=(c*L>>Y)*M):n[i]=n[i+1]=n[i+2]=0,l-=h,u-=m,c-=p,d-=g,h-=fe.r,m-=fe.g,p-=fe.b,g-=fe.a,i=he+((i=ae+P)<X?i:X)*r<<2,l+=k+=fe.r=n[i],u+=w+=fe.g=n[i+1],c+=S+=fe.b=n[i+2],d+=y+=fe.a=n[i+3],fe=fe.next,h+=C=Ne.r,m+=T=Ne.g,p+=R=Ne.b,g+=M=Ne.a,k-=C,w-=T,S-=R,y-=M,Ne=Ne.next,s+=r}}const nF=function(t){const n=Math.round(this.blurRadius());n>0&&tF(t,n)};ce.addGetterSetter(wt,"blurRadius",0,dt(),ce.afterSetFilter);const rF=function(e){const t=this.brightness()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]+=t,n[o+1]+=t,n[o+2]+=t};ce.addGetterSetter(wt,"brightness",0,dt(),ce.afterSetFilter);const oF=function(e){const t=this.brightness(),n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]=Math.min(255,n[o]*t),n[o+1]=Math.min(255,n[o+1]*t),n[o+2]=Math.min(255,n[o+2]*t)},iF=function(e){const t=Math.pow((this.contrast()+100)/100,2),n=e.data,r=n.length;let o=150,i=150,s=150;for(let a=0;a<r;a+=4)o=n[a],i=n[a+1],s=n[a+2],o/=255,o-=.5,o*=t,o+=.5,o*=255,i/=255,i-=.5,i*=t,i+=.5,i*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,o=o<0?0:o>255?255:o,i=i<0?0:i>255?255:i,s=s<0?0:s>255?255:s,n[a]=o,n[a+1]=i,n[a+2]=s};ce.addGetterSetter(wt,"contrast",0,dt(),ce.afterSetFilter);const sF=function(e){var t,n,r,o,i,s,a,l,u;const c=e.data,d=e.width,h=e.height,m=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),p=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),g=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,k=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),w=m*10,S=p*255,y=g*Math.PI/180,C=Math.cos(y),T=Math.sin(y),R=128/1020*w,M=new Uint8ClampedArray(c),H=new Float32Array(d*h);for(let N=0,I=0;I<c.length;I+=4,N++)H[N]=.2126*M[I]+.7152*M[I+1]+.0722*M[I+2];const B=[-1,0,1,-2,0,2,-1,0,1],z=[-1,-2,-1,0,0,0,1,2,1],X=[-d-1,-d,-d+1,-1,0,1,d-1,d,d+1],P=N=>N<0?0:N>255?255:N;for(let N=1;N<h-1;N++)for(let I=1;I<d-1;I++){const L=N*d+I;let Y=0,te=0;Y+=H[L+X[0]]*B[0],te+=H[L+X[0]]*z[0],Y+=H[L+X[1]]*B[1],te+=H[L+X[1]]*z[1],Y+=H[L+X[2]]*B[2],te+=H[L+X[2]]*z[2],Y+=H[L+X[3]]*B[3],te+=H[L+X[3]]*z[3],Y+=H[L+X[5]]*B[5],te+=H[L+X[5]]*z[5],Y+=H[L+X[6]]*B[6],te+=H[L+X[6]]*z[6],Y+=H[L+X[7]]*B[7],te+=H[L+X[7]]*z[7],Y+=H[L+X[8]]*B[8],te+=H[L+X[8]]*z[8];const le=P(S+(C*Y+T*te)*R),fe=L*4;if(k){const Ne=le-S;c[fe]=P(M[fe]+Ne),c[fe+1]=P(M[fe+1]+Ne),c[fe+2]=P(M[fe+2]+Ne),c[fe+3]=M[fe+3]}else c[fe]=c[fe+1]=c[fe+2]=le,c[fe+3]=M[fe+3]}for(let N=0;N<d;N++){let I=N*4,L=((h-1)*d+N)*4;c[I]=M[I],c[I+1]=M[I+1],c[I+2]=M[I+2],c[I+3]=M[I+3],c[L]=M[L],c[L+1]=M[L+1],c[L+2]=M[L+2],c[L+3]=M[L+3]}for(let N=1;N<h-1;N++){let I=N*d*4,L=(N*d+(d-1))*4;c[I]=M[I],c[I+1]=M[I+1],c[I+2]=M[I+2],c[I+3]=M[I+3],c[L]=M[L],c[L+1]=M[L+1],c[L+2]=M[L+2],c[L+3]=M[L+3]}return e};ce.addGetterSetter(wt,"embossStrength",.5,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"embossWhiteLevel",.5,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"embossDirection","top-left",void 0,ce.afterSetFilter),ce.addGetterSetter(wt,"embossBlend",!1,void 0,ce.afterSetFilter);function E0(e,t,n,r,o){const i=n-t,s=o-r;if(i===0)return r+s/2;if(s===0)return r;let a=(e-t)/i;return a=s*a+r,a}const aF=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,u=t[2],c=u,d;const h=this.enhance();if(h===0)return;for(let y=0;y<n;y+=4)i=t[y+0],i<r?r=i:i>o&&(o=i),l=t[y+1],l<s?s=l:l>a&&(a=l),d=t[y+2],d<u?u=d:d>c&&(c=d);o===r&&(o=255,r=0),a===s&&(a=255,s=0),c===u&&(c=255,u=0);let m,p,g,k,w,S;if(h>0)m=o+h*(255-o),p=r-h*(r-0),g=a+h*(255-a),k=s-h*(s-0),w=c+h*(255-c),S=u-h*(u-0);else{const y=(o+r)*.5;m=o+h*(o-y),p=r+h*(r-y);const C=(a+s)*.5;g=a+h*(a-C),k=s+h*(s-C);const T=(c+u)*.5;w=c+h*(c-T),S=u+h*(u-T)}for(let y=0;y<n;y+=4)t[y+0]=E0(t[y+0],r,o,p,m),t[y+1]=E0(t[y+1],s,a,k,g),t[y+2]=E0(t[y+2],u,c,S,w)};ce.addGetterSetter(wt,"enhance",0,dt(),ce.afterSetFilter);const lF=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=.34*t[r]+.5*t[r+1]+.16*t[r+2];t[r]=o,t[r+1]=o,t[r+2]=o}};ce.addGetterSetter(wt,"hue",0,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"saturation",0,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"luminance",0,dt(),ce.afterSetFilter);const cF=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,c=.587*r-.587*a+.33*l,d=.114*r-.114*a-.497*l,h=.299*r-.299*a-.328*l,m=.587*r+.413*a+.035*l,p=.114*r-.114*a+.293*l,g=.299*r-.3*a+1.25*l,k=.587*r-.586*a-1.05*l,w=.114*r+.886*a-.2*l;let S,y,C,T;for(let R=0;R<n;R+=4)S=t[R+0],y=t[R+1],C=t[R+2],T=t[R+3],t[R+0]=u*S+c*y+d*C+s,t[R+1]=h*S+m*y+p*C+s,t[R+2]=g*S+k*y+w*C+s,t[R+3]=T},uF=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,c=.114*r-.114*s-.497*a,d=.299*r-.299*s-.328*a,h=.587*r+.413*s+.035*a,m=.114*r-.114*s+.293*a,p=.299*r-.3*s+1.25*a,g=.587*r-.586*s-1.05*a,k=.114*r+.886*s-.2*a;for(let w=0;w<n;w+=4){const S=t[w+0],y=t[w+1],C=t[w+2],T=t[w+3];t[w+0]=l*S+u*y+c*C,t[w+1]=d*S+h*y+m*C,t[w+2]=p*S+g*y+k*C,t[w+3]=T}};ce.addGetterSetter(wt,"hue",0,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"saturation",0,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"value",0,dt(),ce.afterSetFilter);const dF=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4)t[r]=255-t[r],t[r+1]=255-t[r+1],t[r+2]=255-t[r+2]};var fF=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),c=i-a,d=s-l;const h=Math.sqrt(c*c+d*d);u=h>u?h:u;const m=s,p=i,g=360/p*Math.PI/180;for(let k=0;k<p;k+=1){const w=Math.sin(k*g),S=Math.cos(k*g);for(let y=0;y<m;y+=1){c=Math.floor(a+u*y/m*S),d=Math.floor(l+u*y/m*w);let C=(d*i+c)*4;const T=r[C+0],R=r[C+1],M=r[C+2],H=r[C+3];C=(k+y*i)*4,o[C+0]=T,o[C+1]=R,o[C+2]=M,o[C+3]=H}}},hF=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),c=i-a,d=s-l;const h=Math.sqrt(c*c+d*d);u=h>u?h:u;const m=s,p=i,g=n.polarRotation||0;let k,w;for(c=0;c<i;c+=1)for(d=0;d<s;d+=1){const S=c-a,y=d-l,C=Math.sqrt(S*S+y*y)*m/u;let T=(Math.atan2(y,S)*180/Math.PI+360+g)%360;T=T*p/360,k=Math.floor(T),w=Math.floor(C);let R=(w*i+k)*4;const M=r[R+0],H=r[R+1],B=r[R+2],z=r[R+3];R=(d*i+c)*4,o[R+0]=M,o[R+1]=H,o[R+2]=B,o[R+3]=z}};const pF=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,c,d,h,m=Math.round(this.kaleidoscopePower());const p=Math.round(this.kaleidoscopeAngle()),g=Math.floor(t*(p%360)/360);if(m<1)return;const k=Ie.createCanvasElement();k.width=t,k.height=n;const w=k.getContext("2d").getImageData(0,0,t,n);Ie.releaseCanvas(k),fF(e,w,{polarCenterX:t/2,polarCenterY:n/2});let S=t/Math.pow(2,m);for(;S<=8;)S=S*2,m-=1;S=Math.ceil(S);let y=S,C=0,T=y,R=1;for(g+S>t&&(C=y,T=0,R=-1),o=0;o<n;o+=1)for(r=C;r!==T;r+=R)i=Math.round(r+g)%t,d=(t*o+i)*4,a=w.data[d+0],l=w.data[d+1],u=w.data[d+2],c=w.data[d+3],h=(t*o+r)*4,w.data[h+0]=a,w.data[h+1]=l,w.data[h+2]=u,w.data[h+3]=c;for(o=0;o<n;o+=1)for(y=Math.floor(S),s=0;s<m;s+=1){for(r=0;r<y+1;r+=1)d=(t*o+r)*4,a=w.data[d+0],l=w.data[d+1],u=w.data[d+2],c=w.data[d+3],h=(t*o+y*2-r-1)*4,w.data[h+0]=a,w.data[h+1]=l,w.data[h+2]=u,w.data[h+3]=c;y*=2}hF(w,e,{polarRotation:0})};ce.addGetterSetter(wt,"kaleidoscopePower",2,dt(),ce.afterSetFilter),ce.addGetterSetter(wt,"kaleidoscopeAngle",0,dt(),ce.afterSetFilter);function Hp(e,t,n){let r=(n*e.width+t)*4;const o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function wf(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}function mF(e){const t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function gF(e,t){const n=Hp(e,0,0),r=Hp(e,e.width-1,0),o=Hp(e,0,e.height-1),i=Hp(e,e.width-1,e.height-1),s=t||10;if(wf(n,r)<s&&wf(r,i)<s&&wf(i,o)<s&&wf(o,n)<s){const a=mF([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=wf(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function vF(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function yF(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let c=0;for(let d=0;d<o;d++)for(let h=0;h<o;h++){const m=a+d-i,p=l+h-i;if(m>=0&&m<n&&p>=0&&p<t){const g=m*t+p,k=r[d*o+h];c+=e[g]*k}}s[u]=c===2040?255:0}return s}function bF(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let c=0;for(let d=0;d<o;d++)for(let h=0;h<o;h++){const m=a+d-i,p=l+h-i;if(m>=0&&m<n&&p>=0&&p<t){const g=m*t+p,k=r[d*o+h];c+=e[g]*k}}s[u]=c>=1020?255:0}return s}function wF(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let c=0;for(let d=0;d<o;d++)for(let h=0;h<o;h++){const m=a+d-i,p=l+h-i;if(m>=0&&m<n&&p>=0&&p<t){const g=m*t+p,k=r[d*o+h];c+=e[g]*k}}s[u]=c}return s}const CF=function(e){let t=gF(e,this.threshold());return t&&(t=yF(t,e.width,e.height),t=bF(t,e.width,e.height),t=wF(t,e.width,e.height),vF(e,t)),e};ce.addGetterSetter(wt,"threshold",0,dt(),ce.afterSetFilter);const _F=function(e){const t=this.noise()*255,n=e.data,r=n.length,o=t/2;for(let i=0;i<r;i+=4)n[i+0]+=o-2*o*Math.random(),n[i+1]+=o-2*o*Math.random(),n[i+2]+=o-2*o*Math.random()};ce.addGetterSetter(wt,"noise",.2,dt(),ce.afterSetFilter);const SF=function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,o=Math.ceil(n/t),i=Math.ceil(r/t),s=e.data;if(t<=0){Ie.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,c=0,d=0,h=0;const m=a*t,p=m+t,g=l*t,k=g+t;let w=0;for(let S=m;S<p;S+=1)if(!(S>=n))for(let y=g;y<k;y+=1){if(y>=r)continue;const C=(n*y+S)*4;u+=s[C+0],c+=s[C+1],d+=s[C+2],h+=s[C+3],w+=1}u=u/w,c=c/w,d=d/w,h=h/w;for(let S=m;S<p;S+=1)if(!(S>=n))for(let y=g;y<k;y+=1){if(y>=r)continue;const C=(n*y+S)*4;s[C+0]=u,s[C+1]=c,s[C+2]=d,s[C+3]=h}}};ce.addGetterSetter(wt,"pixelSize",8,dt(),ce.afterSetFilter);const kF=function(e){const t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,o=255/t;for(let i=0;i<r;i+=1)n[i]=Math.floor(n[i]/o)*o};ce.addGetterSetter(wt,"levels",.5,dt(),ce.afterSetFilter);const AF=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue();for(let s=0;s<n;s+=4){const a=(.34*t[s]+.5*t[s+1]+.16*t[s+2])/255;t[s]=a*r,t[s+1]=a*o,t[s+2]=a*i,t[s+3]=t[s+3]}};ce.addGetterSetter(wt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"blue",0,s4,ce.afterSetFilter);const IF=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue(),s=this.alpha();for(let a=0;a<n;a+=4){const l=1-s;t[a]=r*s+t[a]*l,t[a+1]=o*s+t[a+1]*l,t[a+2]=i*s+t[a+2]*l}};ce.addGetterSetter(wt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"blue",0,s4,ce.afterSetFilter),ce.addGetterSetter(wt,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});const EF=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=t[r+0],i=t[r+1],s=t[r+2];t[r+0]=Math.min(255,o*.393+i*.769+s*.189),t[r+1]=Math.min(255,o*.349+i*.686+s*.168),t[r+2]=Math.min(255,o*.272+i*.534+s*.131)}},xF=function(e){const n=e.data;for(let r=0;r<n.length;r+=4){const o=n[r],i=n[r+1],s=n[r+2];.2126*o+.7152*i+.0722*s>=128&&(n[r]=255-o,n[r+1]=255-i,n[r+2]=255-s)}return e},TF=function(e){const t=this.threshold()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=1)n[o]=n[o]<t?0:255};ce.addGetterSetter(wt,"threshold",.5,dt(),ce.afterSetFilter);var RF=B4.Util._assign(B4,{Arc:$s,Arrow:Kl,Circle:lu,Ellipse:qa,Image:Gi,Label:S0,Tag:ql,Line:ea,Path:xi,Rect:vf,RegularPolygon:Ya,Ring:Yl,Sprite:fs,Star:Xa,Text:Jn,TextPath:Kr,Transformer:Sn,Wedge:ta,Filters:{Blur:nF,Brightness:oF,Brighten:rF,Contrast:iF,Emboss:sF,Enhance:aF,Grayscale:lF,HSL:cF,HSV:uF,Invert:dF,Kaleidoscope:pF,Mask:CF,Noise:_F,Pixelate:SF,Posterize:kF,RGB:AF,RGBA:IF,Sepia:EF,Solarize:xF,Threshold:TF}});It();var MF=["dialog","floating"],ak=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function LF(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!MF.includes(e.mode))throw new Error(`SurfaceManager: mode must be "dialog" or "floating", got "${e.mode}".`);const t="kind"in e&&e.kind!=null,n="component"in e&&e.component!=null,r="render"in e&&typeof e.render=="function";if(n&&r)throw new Error('SurfaceManager: request cannot provide both "component" and "render". Use one or the other.');if(!t&&!n&&!r)throw new Error('SurfaceManager: request must provide "kind" (intent-based) or "component"/"render" (direct-render).');if(e.mode==="floating"&&e.floating?.placement!=null&&!ak.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${ak.join(", ")}, got "${e.floating.placement}".`)}var DF=class{activeDialog=Wr(null);activeFloating=Wr(null);#t=!1;#n=1;#e;constructor({getModuleConfig:e}){this.#e=e}open(e){if(this.#t)return this.#l(e);LF(e);const t=this.#u(e),{component:n,props:r,render:o}=this.#d(t);let i,s=!1;const a=new Promise(m=>{i=p=>s?!1:(s=!0,m(p),!0)});let l;const u=m=>{i({status:"submitted",data:m})&&this.#s(l)},c=m=>{i({status:"closed",reason:m})&&this.#s(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:c,settle:m=>i(m),get settled(){return s}};const d=t.mode==="dialog"?"activeDialog":"activeFloating",h=this[d].value;return h&&!h.settled&&h.settle({status:"replaced",replacedBy:t.id}),this[d].value=l,{id:t.id,mode:t.mode,close:m=>this.#i(l,m),result:a}}close(e,t){if(e!=null){const o=this.#a(e);o&&this.#i(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#i(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#i(r,t)}settleAll(e){for(const t of[this.activeDialog,this.activeFloating]){const n=t.value;n&&!n.settled&&n.settle(e),t.value=null}}destroy(){this.#t=!0,this.settleAll({status:"destroyed"})}#i(e,t){e.settled||(e.settle({status:"closed",reason:t}),this.#s(e))}#s(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#a(e){return this.activeDialog.value?.id===e?this.activeDialog.value:this.activeFloating.value?.id===e?this.activeFloating.value:null}#u(e){const t=e.id??`surface-${this.#n++}`,n=this.#e()??{},r=e.mode==="dialog"?n.dialog:n.floating,o=e.mode==="dialog"?{maxWidth:r?.maxWidth,...e.dialog}:e.dialog,i=e.mode==="floating"?{placement:r?.placement??"top-right",width:r?.width,maxWidth:r?.maxWidth,maxHeight:r?.maxHeight,autoFocus:r?.autoFocus??!0,closeOnOutsidePointerDown:r?.closeOnOutsidePointerDown??!1,...e.floating}:e.floating;return{...e,id:t,closeOnEscape:e.closeOnEscape??r?.closeOnEscape??!0,closeOnBackdrop:e.mode==="dialog"?e.closeOnBackdrop??r?.closeOnBackdrop??!0:!1,dialog:o,floating:i}}#d(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#e()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#l(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},PF="https://docs.superdoc.dev/guides/migration/document-api",lk=new Set;function OF(e,t){lk.has(e)||(lk.add(e),console.warn(t))}var FF={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},ck=Symbol.for("superdoc:rawEditor"),uk=new WeakMap;function dk(e){return!e||e[ck]?e:new Proxy(e,{get(t,n){if(n===ck)return t;const r=FF[n];r&&OF(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${PF}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=uk.get(t);return i||(i=new Map,uk.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var fk=["review","original","final","off"],BF=["paired","independent"],hk=Symbol.for("@superdoc/trackChanges:normalized"),pk=new Set;function mk(e,t){pk.has(e)||(pk.add(e),console.warn(`[SuperDoc] ${e} is deprecated β use ${t} instead.`))}function gk(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function NF(e,t,n){return typeof e=="string"&&fk.includes(e)?e:typeof t=="string"&&fk.includes(t)?t:n}function zF(e){return typeof e=="string"&&BF.includes(e)?e:null}function Xl(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function HF(e){const t=e[hk]===!0;Xl(e.modules)||(e.modules={});const n=Xl(e.modules.trackChanges),r=Xl(e.trackChanges),o=Xl(e.layoutEngineOptions?.trackedChanges);t||(r&&mk("config.trackChanges","config.modules.trackChanges"),o&&mk("config.layoutEngineOptions.trackedChanges","config.modules.trackChanges"));const i=gk(n?.visible,r?.visible,!1),s=gk(n?.enabled,o?.enabled,!0),a=zF(n?.replacements)??"paired",l=Xl(n?.authorColors)?n.authorColors:void 0,u=Xl(n?.semanticColors)?n.semanticColors:void 0,c=e.documentMode==="viewing"?i?"review":"original":"review",d=NF(n?.mode,o?.mode,c),h={visible:i,mode:d,enabled:s,replacements:a};return l&&(h.authorColors=l),u&&(h.semanticColors=u),e.modules.trackChanges=h,e.trackChanges={visible:i},Xl(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:d,enabled:s},Object.defineProperty(e,hk,{value:!0,writable:!0,configurable:!0,enumerable:!1}),h}const x0=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function UF(e){return!e||typeof e!="object"?{...x0}:{...x0,...e}}function Cf(...e){const t={};for(const n of e)if(!(typeof n!="object"||n===null))for(const[r,o]of Object.entries(n))o!==void 0&&(t[r]=o);return t}function vk(...e){for(const t of e)if(t!==void 0)return t}var yk=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),VF=Object.freeze(["left","center","right"]),bj=Object.freeze(Object.keys(yk)),Up=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function bk(e,t){const n=e?.[t];return n===!1?!1:n===void 0?yk[t]:!0}function jF(e,t){const n=e?.[t];return Up(n)?n:{}}function wk(e={}){const t=e.ui,n=t===!1,r=Up(t)?t:void 0,o=w=>!n&&bk(r,w),i=w=>n?!1:r?.[w]===void 0?void 0:bk(r,w),s=w=>n?{}:jF(r,w),a=n||i("ruler")===!1,l=s("toolbar"),u=e.modules?.toolbar,c=Up(u)?u:{},d=[l.groups,c.groups],h=d.find(Up),m=vk(d.find(Array.isArray),c.toolbarGroups,e.toolbarGroups),p=Array.isArray(m)?m:null,g=(w,S)=>Object.prototype.hasOwnProperty.call(w,S),k=h&&p?Object.fromEntries([...p.filter(w=>g(h,w)),...Object.keys(h).filter(w=>!VF.includes(w))].map(w=>[w,h[w]])):h;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:vk(l.container,c.selector,e.toolbar)??null,options:n?{}:{...Cf(c,l),groups:k,toolbarGroups:m,icons:Cf(e.toolbarIcons,c.icons,l.icons),texts:Cf(e.toolbarTexts,c.texts,l.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:s("comments")},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:s("contextMenu")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:s("search")},linkPopover:{enabled:i("linkPopover")??(!n&&!!e.modules?.links?.popoverResolver),suppressed:n||i("linkPopover")===!1,options:s("linkPopover")},ruler:{enabled:i("ruler")??(!n&&!!e.rulers),suppressed:a,container:a?null:s("ruler").container??e.rulerContainer??null},contentControls:{enabled:i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),options:s("contentControls")}}}var T0=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Ck(e={}){const t=T0(e.interaction)?e.interaction:{},n=T0(t.comments)?t.comments:{},r=T0(e.modules?.comments)?e.modules.comments:{};return{comments:{readOnly:(n.readOnly??r.readOnly??!1)===!0,allowResolve:(n.allowResolve??r.allowResolve??!0)!==!1}}}var _k=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Sk(e={}){const t=_k(e.surfaces)?e.surfaces:{},n=_k(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:Cf(n.dialog,t.dialog),floating:Cf(n.floating,t.floating)}}var GF=class{#t=new Map;#n=new Map;#e=null;#i=new Set;register(e){if(this.#t.has(e.id))throw new Error(`EditorRuntimeRegistry: duplicate runtime id "${e.id}"`);const t=e.root,n=t?this.#n.get(t):void 0;if(n!==void 0&&n!==e.id)throw new Error(`EditorRuntimeRegistry: root element already registered to runtime "${n}"`);this.#t.set(e.id,e),t&&this.#n.set(t,e.id)}unregister(e){const t=this.#t.get(e);return t?(this.#t.delete(e),t.root&&this.#n.delete(t.root),this.#e===e&&(this.#e=null,this.#s({previousRuntimeId:e,nextRuntimeId:null,reason:"active-runtime-unregistered",legacyEditorProjection:null})),!0):!1}get(e){return this.#t.get(e)??null}getAll(){return Array.from(this.#t.values())}getAllByDocumentId(e){const t=[];for(const n of this.#t.values())n.documentId===e&&t.push(n);return t}getActive(){return this.#e===null?null:this.#t.get(this.#e)}getActiveId(){return this.#e}setActive(e,t){if(e!==null&&!this.#t.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#e)return;const n=this.#e;this.#e=e;let r=null;e!==null&&(r=this.#t.get(e).getLegacyEditorProjection?.()??null),this.#s({previousRuntimeId:n,nextRuntimeId:e,reason:t,legacyEditorProjection:r})}resolveFromEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;if(!t)return null;const n=t.closest(`[${wp}]`);if(!n)return null;const r=n.getAttribute(wp),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#i.add(e),()=>{this.#i.delete(e)}}clear(){this.#t.clear(),this.#n.clear(),this.#e=null,this.#i.clear()}#s(e){for(const t of Array.from(this.#i))try{t(e)}catch{}}};const at={notReady:"not-ready",documentApiUnavailable:"document-api-unavailable",documentReadonly:"document-readonly",selectionRequired:"selection-required",rangeSelectionRequired:"range-selection-required",contextUnavailable:"context-unavailable",geometryUnavailable:"geometry-unavailable",targetUnresolved:"target-unresolved",targetNotVisible:"target-not-visible",commandUnsupported:"command-unsupported",commandDeferred:"command-deferred",tableContextUnavailable:"table-context-unavailable",operationUnavailable:"operation-unavailable",bulkDecisionsDisabled:"bulk-decisions-disabled",hostCapabilityUnavailable:"host-capability-unavailable",historyEmpty:"history-empty",searchUnavailable:"search-unavailable",searchInvalidPattern:"search-invalid-pattern",replaceUnsupported:"replace-unsupported",contentControlLocked:"content-control-locked"},kk={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikethrough",fontFamily:"font-family",fontSize:"font-size",setFontFamily:"setFontFamily",setFontSize:"setFontSize",undo:"undo",redo:"redo",acceptChange:"acceptChange",rejectChange:"rejectChange",acceptAllChanges:"acceptAllChanges",rejectAllChanges:"rejectAllChanges",bulletList:"bullet-list",numberedList:"numbered-list"};function Ak(e){const t=n=>typeof n=="string"?n.replace(/\s*pt$/i,"").trim():n;if(typeof e=="string")return t(e);if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return e}function WF(e){const t=(n,r)=>!r&&n>0&&n<=5?n*100:n;if(typeof e=="string"){const n=e.includes("%"),r=Number.parseFloat(e.replace("%","").trim());return Number.isFinite(r)?t(r,n):e}return typeof e=="number"&&Number.isFinite(e)?t(e,!1):e}function KF(e){const t=e&&typeof e=="object"&&"value"in e?e.value:e;if(t==="in"||t==="cm")return t;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="in"||n==="inch"||n==="inches")return"in";if(n==="cm"||n==="centimeter"||n==="centimeters"||n==="centimetre"||n==="centimetres")return"cm"}return t}function Ik(e){const t=n=>{if(n===null)return null;if(typeof n!="string")return n;const r=n.trim();return r===""?n:/^#[0-9a-fA-F]{6}$/.test(r)?r:/^[0-9a-fA-F]{6}$/.test(r)?`#${r}`:r};if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return t(e)}function R0(e,t){if(e&&typeof e=="object"){const n=e;for(const r of t)if(r in n)return n[r]}return e}function qF(e){const t=R0(e,["alignment","value"]);if(typeof t!="string")return t;const n=t.trim().toLowerCase();return n==="justified"||n==="both"?"justify":n}function YF(e){const t=R0(e,["line","lineHeight","value"]),n=typeof t=="number"?t:typeof t=="string"?Number.parseFloat(t.trim()):NaN;return!Number.isFinite(n)||n<=0?t:n<=10?Math.round(n*240):Math.round(n)}function XF(e){if(e&&typeof e=="object"&&"role"in e)return e;const t=R0(e,["styleId","value","style"]);return typeof t=="string"?t.trim():t}function QF(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){const t=e.mode;if(typeof t=="string")return t}return e}var ZF=at.commandUnsupported,hs=at.tableContextUnavailable;const Ek=[{id:"bold",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.bold",activeMark:"bold",inline:{key:"bold",kind:"toggle"}},{id:"italic",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.italic",activeMark:"italic",inline:{key:"italic",kind:"toggle"}},{id:"underline",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.underline",activeMark:"underline",inline:{key:"underline",kind:"toggle"}},{id:"strikethrough",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.strikethrough",activeMark:"strikethrough",inline:{key:"strike",kind:"toggle"}},{id:"font-family",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliases:["setFontFamily"],inline:{key:"fontFamily",kind:"value-string"}},{id:"font-size",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliases:["setFontSize"],normalizePayload:Ak,inline:{key:"fontSize",kind:"value-number"}},{id:"setFontFamily",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliasOf:"font-family",inline:{key:"fontFamily",kind:"value-string"}},{id:"setFontSize",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliasOf:"font-size",normalizePayload:Ak,inline:{key:"fontSize",kind:"value-number"}},{id:"undo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.undo"},{id:"redo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.redo"},{id:"acceptChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliases:["track-changes-accept-selection"]},{id:"rejectChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliases:["track-changes-reject-selection"]},{id:"acceptAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"all"}},{id:"rejectAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"all"}},{id:"track-changes-accept-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliasOf:"acceptChange"},{id:"track-changes-reject-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliasOf:"rejectChange"},{id:"zoom",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoom",valueFrom:"zoom",normalizePayload:WF},{id:"zoom-fit-width",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoomMode",fixedArg:"fit-width",valueFrom:"zoom"},{id:"document-mode",family:"document",disposition:"routed",mutates:!1,instanceRoute:"setDocumentMode",valueFrom:"documentMode",normalizePayload:QF},{id:"measurement-unit",family:"measurement",disposition:"routed",mutates:!1,instanceRoute:"setMeasurementUnit",valueFrom:"measurementUnit",normalizePayload:KF},{id:"text-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.color",inline:{key:"color",kind:"value-string"},normalizePayload:Ik},{id:"highlight-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.highlight",inline:{key:"highlight",kind:"value-string"},normalizePayload:Ik},{id:"link",family:"links",disposition:"routed",mutates:!0,docRoute:"hyperlinks.wrap",activeMark:"link",link:{kind:"link"}},{id:"text-align",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setAlignment",blockParagraph:{kind:"alignment"},normalizePayload:qF},{id:"line-height",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setSpacing",blockParagraph:{kind:"spacing-line"},normalizePayload:YF},{id:"linked-style",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"styles.paragraph.setStyle",blockParagraph:{kind:"style"},normalizePayload:XF},{id:"bullet-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"bullet"}},{id:"numbered-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"ordered"}},{id:"indent-increase",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.indent",list:{mode:"indent"}},{id:"indent-decrease",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.outdent",list:{mode:"outdent"}},{id:"direction-ltr",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"ltr"}},{id:"direction-rtl",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"rtl"}},{id:"clear-formatting",family:"formatting",disposition:"routed",mutates:!0,docRoute:"format.apply",inline:{key:"*",kind:"clear"}},{id:"image",family:"media",disposition:"routed",mutates:!0,docRoute:"create.image",create:{kind:"image"}},{id:"table-of-contents-insert",family:"TOC",disposition:"routed",mutates:!0,docRoute:"create.tableOfContents",create:{kind:"toc"}},{id:"table-insert",family:"tables",disposition:"routed",mutates:!0,docRoute:"create.table",create:{kind:"table"}},{id:"table-add-row-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-before",op:"insertRow"},reason:hs},{id:"table-add-row-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-after",op:"insertRow"},reason:hs},{id:"table-delete-row",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteRow",table:{action:"delete-row",op:"deleteRow"},reason:hs},{id:"table-add-column-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-before",op:"insertColumn"},reason:hs},{id:"table-add-column-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-after",op:"insertColumn"},reason:hs},{id:"table-delete-column",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteColumn",table:{action:"delete-column",op:"deleteColumn"},reason:hs},{id:"table-delete",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.delete",table:{action:"delete-table",op:"delete"},reason:hs},{id:"table-merge-cells",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.mergeCells",table:{action:"merge-cells",op:"mergeCells"},reason:hs},{id:"table-split-cell",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.splitCell",table:{action:"split-cell",op:"splitCell",requiresCell:!0},reason:hs},{id:"table-remove-borders",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.setBorders",table:{action:"remove-borders",op:"setBorders"},reason:hs},{id:"ruler",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleRuler",valueFrom:"ruler"},{id:"formatting-marks",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleFormattingMarks",valueFrom:"formattingMarks"},{id:"copy-format",family:"formatting",disposition:"routed",mutates:!1},{id:"table-fix",family:"tables",disposition:"unsupported",mutates:!0,reason:ZF}];var JF=new Map(Ek.map(e=>[e.id,e]));const $F=Ek.map(e=>e.id);function uu(e){return JF.get(e)??null}var eB=["table-add-row-before","table-add-row-after","table-delete-row","table-add-column-before","table-add-column-after","table-delete-column","table-delete","table-merge-cells","table-split-cell","table-remove-borders"];const xk=[{name:"bold",commandId:"bold",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"italic",commandId:"italic",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"underline",commandId:"underline",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"strike",commandId:"strikethrough",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"clearFormatting",commandId:"clear-formatting",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"copyFormat",commandId:"copy-format",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontFamily",commandId:"font-family",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontSize",commandId:"font-size",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"color",commandId:"text-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"highlight",commandId:"highlight-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"textAlign",commandId:"text-align",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"list",commandId:"bullet-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"numberedlist",commandId:"numbered-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentleft",commandId:"indent-decrease",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentright",commandId:"indent-increase",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"lineHeight",commandId:"line-height",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"linkedStyles",commandId:"linked-style",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"link",commandId:"link",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"image",commandId:"image",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"table",commandId:"table-insert",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"tableActions",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",memberCommandIds:eB,note:"table editing dropdown is shell chrome; its member commands are controller-routed through the shared table-context facade (ui.tables / host.getTableContext()) and fail closed with table-context-unavailable when the caret is not in a table"},{name:"undo",commandId:"undo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"redo",commandId:"redo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"search",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"right",note:"built-in search button; opens the shared find/replace surface (the same one Cmd/Ctrl+F opens) by emitting a `search:open` event on the SuperDoc instance, which the shell handles. The surface reads/drives the controller search surface (ui.search), backed by the single V2 host search session (host.search) which owns query, navigation, reveal, and replace. Find/navigation are always available when the host exposes search; replace/replaceAll mutate through the host session and fail closed (document-readonly) in viewing/read-only mode. If a runtime cannot expose search, the surface fails closed with search-unavailable"},{name:"zoom",commandId:"zoom",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"measurementUnit",commandId:"measurement-unit",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"ruler",commandId:null,instanceMethod:"toggleRuler",disposition:"host-routed",group:"right",note:"built-in shell toggles ruler visibility through the public SuperDoc.toggleRuler() instance method; the controller also routes the ruler command through it so custom UIs drive the same chrome (active state from config.rulers)"},{name:"formattingMarks",commandId:null,instanceMethod:"toggleFormattingMarks",disposition:"host-routed",group:"right",note:"built-in shell toggles nonprinting marks through the public SuperDoc.toggleFormattingMarks()/setShowFormattingMarks() instance methods (not a controller command)"},{name:"documentMode",commandId:"document-mode",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"acceptTrackedChangeBySelection",commandId:"track-changes-accept-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"rejectTrackedChangeOnSelection",commandId:"track-changes-reject-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"customButtons",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",note:"consumer-defined buttons the rendered shell owns; their execution context surface is phase 2"}];var Tk=new Map(xk.map(e=>[e.name,e]));const wj=xk.map(e=>e.name);function M0(e){return Tk.get(e)??null}function tB(e){const t=Tk.get(e);return t?.disposition==="controller-routed"?t.commandId:null}const nB=".png,.jpg,.jpeg,image/png,image/jpeg";var Rk=new Set(["image/png","image/jpeg","image/jpg"]),rB=/\.(png|jpe?g)$/i;function oB(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?Rk.has(t):rB.test(String(e.name??""))}function Mk(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(iB(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function iB(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(Rk.has(r))return e;const o=String(t?.name??""),i=/\.jpe?g$/i.test(o)?"image/jpeg":/\.png$/i.test(o)?"image/png":null;return i?`data:${i};base64,${e.slice(n[0].length)}`:e}async function sB(e,t){if(typeof t=="function"){const n=await t(e);if(typeof n!="string"||n.trim()==="")throw new Error("handleImageUpload returned an empty result");return n.startsWith("data:")?n:aB(n,e)}return Mk(e)}async function aB(e,t){const n=await fetch(e);if(!n.ok)throw new Error(`image fetch failed: ${n.status}`);const r=await n.blob(),o=(/\.(?:png|jpe?g)(?:$|[?#])/i.test(e)?e.split(/[?#]/)[0]:"")||t?.name||"";return Mk(o?Object.assign(r,{name:o}):r)}function lB({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=nB,r.hidden=!0,r.tabIndex=-1,r.setAttribute("data-superdoc-image-picker","true"),r.setAttribute("aria-hidden","true"),r.addEventListener("change",()=>{const o=r.files&&r.files[0];if(r.value="",!!o){if(!oB(o)){n?.(new Error(`unsupported image type: ${o.type||o.name}`));return}try{const i=t?.(o);i&&typeof i.then=="function"&&i.catch(s=>n?.(s))}catch(i){n?.(i)}}}),e.body?.appendChild(r),{input:r,open(){r.click()},destroy(){r.remove()}}}var cB=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},uB=(e,t,n)=>{let r,o,i,s=0;n||(n={});const a=()=>{s=n.leading===!1?0:Date.now(),r=null,i=e(...o),r||(o=null)},l=(...u)=>{const c=Date.now();!s&&n.leading===!1&&(s=c);const d=t-(c-s);return o=u,d<=0||d>t?(r&&(clearTimeout(r),r=null),s=c,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,d)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};It(),mn();var dB={class:"sd-toolbar-icon"},fB=["innerHTML"],hB={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=Ae(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=Ae(()=>["color","highlight"].includes(t.name));return(o,i)=>(me(),ke("div",dB,[Me("div",{class:en(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,fB),r.value?(me(),ke("div",{key:0,class:"color-bar",style:gn(n.value)},null,4)):ut("",!0)]))}},Lk=fn(hB,[["__scopeId","data-v-d7d79424"]]);It(),mn();var pB=["role","aria-label"],mB=["data-item"],gB=["data-item"],vB={key:1,class:"sd-button-label"},yB=["data-item","aria-label"],bB=["innerHTML"],wB={key:2},CB=["onKeydown","id"],_B=["placeholder","onKeydown","id","data-item"],SB=["data-item","innerHTML"],kB={"aria-live":"polite",class:"sd-visually-hidden"},AB={__name:"ToolbarButton",props:{iconColor:{type:String,default:null},active:{type:Boolean,default:!1},isNarrow:{type:Boolean,default:!1},isWide:{type:Boolean,default:!1},toolbarItem:{type:Object,required:!0},defaultLabel:{type:String,default:null},isOverflowItem:{type:Boolean,default:!1},allowEnterPropagation:{type:Boolean,default:!1}},emits:["buttonClick","textSubmit","mainClick"],setup(e,{emit:t}){const n=t,{proxy:r}=or(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:c,hasCaret:d,splitButton:h,disabled:m,expand:p,inlineTextInputVisible:g,hasInlineTextInput:k,minWidth:w,style:S,attributes:y}=o.toolbarItem,C=Ae(()=>!!h?.value&&!!d?.value),T=Ae(()=>i?.value??""),R=ne(""),M=ne(null),{isHighContrastMode:H}=Hi();Pt(()=>l?.value,_e=>{document.activeElement!==M.value&&(R.value=_e==null?"":String(_e))},{immediate:!0});const B=()=>{k&&St(()=>{M.value?.focus(),M.value?.select()}),n("buttonClick")},z=_e=>{m?.value||(_e?.stopPropagation(),n("mainClick"))},X=()=>{C.value||B()},P=_e=>{if(C.value){z(_e);return}B()},N=_e=>{o.allowEnterPropagation||_e.stopPropagation(),P(_e)},I=_e=>{const oe=o.toolbarItem?.nestedOptions?.value??[],Te=_e.trim();if(!Te)return"";const Ge=oe.find(Je=>typeof Je?.label=="string"&&Je.label.toLowerCase()===Te.toLowerCase());return Ge?.label?Ge.label:oe.find(Je=>typeof Je?.label=="string"&&Je.label.toLowerCase().startsWith(Te.toLowerCase()))?.label??Te},L=()=>{const _e=String(R.value??"").trim();let oe=_e;if(T.value==="fontSize"){const Te=Number.parseFloat(_e);oe=_e.match(/^\d+(\.5)?$/)?_e:Number.isFinite(Te)?Math.floor(Te).toString():""}else T.value==="fontFamily"&&(oe=I(_e));return oe?(n("textSubmit",oe),R.value=oe,!0):!1},Y=_e=>{const oe=_e?.currentTarget;oe instanceof HTMLInputElement&&(oe.focus({preventScroll:!0}),oe.select())},te=_e=>{requestAnimationFrame(()=>{const oe=document.getElementById(`inlineTextInput-${_e}`);oe instanceof HTMLInputElement&&(oe.focus({preventScroll:!0}),oe.select())})},le=()=>{const _e=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return _e instanceof HTMLElement?(_e.focus({preventScroll:!0}),!0):!1},fe=()=>{const _e=r?.$toolbar?.pendingSelectionCapture,oe=()=>{_e&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(_e)};if(le()){oe();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),oe())},Ne=()=>{L()&&fe()},he=_e=>{if(L(),_e.shiftKey){T.value==="fontSize"&&(_e.preventDefault(),St(()=>te("fontFamily")));return}if(_e.preventDefault(),T.value==="fontFamily"){St(()=>te("fontSize"));return}T.value==="fontSize"&&St(fe)},ge=Ae(()=>S.value?S.value:{minWidth:o.minWidth}),ae=Ae(()=>p?.value?Zn.dropdownCaretUp:Zn.dropdownCaretDown);return(_e,oe)=>(me(),ke("div",{class:en(["sd-toolbar-item",We(y).className]),style:gn(ge.value),role:e.isOverflowItem?"menuitem":"button","aria-label":We(y).ariaLabel,"data-sd-part":"toolbar-item",onClick:X,onKeydown:oe[9]||(oe[9]=Qo(Te=>N(Te),["enter"])),tabindex:"0"},[Me("div",{class:en(["sd-toolbar-button",{"sd-active":We(s),"sd-disabled":We(m),narrow:e.isNarrow,wide:e.isWide,split:C.value,"has-inline-text-input":We(k),"high-contrast":We(H)}]),"data-item":`btn-${We(i)||""}`},[C.value?(me(),ke("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${We(i)||""}-main`,onClick:oe[0]||(oe[0]=Te=>z(Te))},[We(a)?(me(),dn(Lk,{key:0,color:We(c),class:"sd-toolbar-icon",icon:We(a),name:We(i)},null,8,["color","icon","name"])):ut("",!0),We(l)&&!We(u)&&!We(g)?(me(),ke("div",vB,Nt(We(l)),1)):ut("",!0)],8,gB)):ut("",!0),C.value?(me(),ke("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${We(i)||""}-caret`,"aria-label":`${We(y).ariaLabel} options`,role:"button"},[Me("div",{class:"sd-dropdown-caret",innerHTML:ae.value,style:gn({opacity:We(m)?.6:1})},null,12,bB)],8,yB)):(me(),ke(qt,{key:2},[We(a)?(me(),dn(Lk,{key:0,color:We(c),class:"sd-toolbar-icon",icon:We(a),name:We(i)},null,8,["color","icon","name"])):ut("",!0),We(l)&&!We(u)&&(!We(g)||T.value==="fontFamily")?(me(),ke("div",{key:1,class:en(["sd-button-label",{"sd-visually-hidden":We(g)&&T.value==="fontFamily"}])},Nt(We(l)),3)):ut("",!0),We(g)?(me(),ke("span",wB,[We(i)==="fontSize"?Ms((me(),ke("input",{key:0,"onUpdate:modelValue":oe[1]||(oe[1]=Te=>R.value=Te),onKeydown:[Qo(Jt(Ne,["stop","prevent"]),["enter"]),oe[2]||(oe[2]=Qo(Te=>he(Te),["tab"]))],onClick:oe[3]||(oe[3]=Jt(Te=>Y(Te),["stop"])),onFocus:oe[4]||(oe[4]=Te=>Y(Te)),type:"text",class:en(["button-text-input button-text-input--font-size",{"high-contrast":We(H)}]),id:"inlineTextInput-"+We(i),autocomplete:"off",ref_key:"inlineInput",ref:M},null,42,CB)),[[Ii,R.value]]):Ms((me(),ke("input",{key:1,"onUpdate:modelValue":oe[5]||(oe[5]=Te=>R.value=Te),placeholder:We(l),onKeydown:[Qo(Jt(Ne,["stop","prevent"]),["enter"]),oe[6]||(oe[6]=Qo(Te=>he(Te),["tab"]))],onClick:oe[7]||(oe[7]=Jt(Te=>Y(Te),["stop"])),onFocus:oe[8]||(oe[8]=Te=>Y(Te)),type:"text",class:en(["button-text-input",{"button-text-input--font-family":T.value==="fontFamily","high-contrast":We(H)}]),id:"inlineTextInput-"+We(i),"data-item":T.value==="fontFamily"?`btn-${We(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:M},null,42,_B)),[[Ii,R.value]])])):ut("",!0),We(d)?(me(),ke("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${We(i)||""}-toggle`,innerHTML:ae.value,style:gn({opacity:We(m)?.6:1})},null,12,SB)):ut("",!0)],64)),Me("div",kB,Nt(`${We(y).ariaLabel} ${We(s)?"selected":"unset"}`),1)],10,mB)],46,pB))}},L0=fn(AB,[["__scopeId","data-v-dbdea151"]]);It(),mn();var IB={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},EB={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=Hi(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(me(),ke("div",IB,[Me("div",{class:"separator-inner",style:gn({backgroundColor:r()})},null,4)]))}},xB=fn(EB,[["__scopeId","data-v-cb82253a"]]);It(),mn();var TB={class:"overflow-menu"},RB={class:"overflow-menu-trigger"},MB={key:0,class:"overflow-menu_items",role:"group"},LB={__name:"OverflowMenu",props:{toolbarItem:{type:Object,required:!0},overflowItems:{type:Array,required:!0}},emits:["buttonClick","close"],setup(e,{emit:t}){const{proxy:n}=or(),r=t,o=e,i=Ae(()=>o.toolbarItem.expand.value),s=ne(!1),a=Ae(()=>({...o.toolbarItem,active:i.value})),l=()=>{r("buttonClick",o.toolbarItem)},u=({item:d,argument:h})=>{n.$toolbar.emitCommand({item:d,argument:h})},c=d=>{d.key==="Escape"&&i.value&&!s.value&&(d.preventDefault(),r("close"))};return Rn(()=>{document.addEventListener("keydown",c,!0)}),rr(()=>{document.removeEventListener("keydown",c,!0)}),(d,h)=>(me(),ke("div",TB,[Me("div",RB,[Wt(L0,{"toolbar-item":a.value,onButtonClick:l},null,8,["toolbar-item"])]),i.value?(me(),ke("div",MB,[Wt(Wp,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"from-overflow":"",onCommand:u,onDropdownUpdateShow:h[0]||(h[0]=m=>s.value=m)},null,8,["toolbar-items"])])):ut("",!0)]))}},DB=fn(LB,[["__scopeId","data-v-504ecd05"]]);It(),mn();var PB={class:"toolbar-dropdown"},OB=["onClick"],FB={key:0,class:"toolbar-dropdown-option__icon"},BB={class:"toolbar-dropdown-option__label"},Vp='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',NB={__name:"ToolbarDropdown",props:{options:{type:Array,default:()=>[]},show:{type:Boolean,required:!0},placement:{type:String,default:"bottom-start"},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})},menuProps:{type:Function,default:null},nodeProps:{type:Function,default:null}},emits:["update:show","select"],setup(e,{emit:t}){const n=e,r=t,o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px",maxHeight:"none"}),a=ne([]),l=ne(-1),u=Ae(()=>!!n.show),c=Ae(()=>n.options.some(oe=>oe?.type==="render")),d=Ae(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),h=Ae(()=>{const{class:oe,style:Te,...Ge}=d.value;return Ge}),m=Ae(()=>{const oe=d.value.class,Te=n.options.length>0&&n.options.every(Ge=>Ge&&Ge.type==="render");return["toolbar-dropdown-menu",oe,{"toolbar-dropdown-menu--render-only":Te}]}),p=Ae(()=>{const oe=d.value.style||{};return{...n.contentStyle,...oe}}),g=Ae(()=>({...p.value,position:"fixed",top:s.value.top,left:s.value.left,maxHeight:s.value.maxHeight,zIndex:2e3})),k=oe=>{r("update:show",oe)},w=()=>{u.value&&k(!1)},S=()=>{if(!o.value)return;const oe=o.value.getBoundingClientRect(),Te=i.value,Ge=Te?.offsetWidth??0,Je=Te?.scrollHeight??Te?.offsetHeight??0,_t=window.innerWidth||document.documentElement.clientWidth||0,be=window.innerHeight||document.documentElement.clientHeight||0,Ve=8,Le=4,J=oe.bottom+Le,_=oe.top-Le,$=Math.max(0,be-J-Ve),F=Math.max(0,_-Ve),j=$<Je&&F>$,V=j?F:$,G=Je?Math.min(Je,V):V,Z=j?Math.max(Ve,_-G):J;let W=oe.left;n.placement==="bottom-end"&&(W=oe.right-Ge);const K=Math.max(Ve,_t-Ge-Ve);W=Math.min(Math.max(Ve,W),K),s.value={top:`${Z}px`,left:`${W}px`,maxHeight:`${V}px`}},y=()=>{n.disabled||k(!u.value)},C=oe=>typeof n.nodeProps!="function"?{}:n.nodeProps(oe)||{},T=oe=>{oe?.disabled||oe?.type!=="render"&&(r("select",oe?.key,oe),w())},R=oe=>oe?.type==="render",M=oe=>!oe?.disabled&&oe?.type!=="render",H=oe=>typeof oe?.icon=="function"||!!oe?.icon,B=oe=>typeof oe?.icon=="function"?oe.icon(oe):oe?.icon||null,z=oe=>oe?typeof oe=="string"?oe.split(/\s+/).includes("sd-selected"):Array.isArray(oe)?oe.some(z):typeof oe=="object"?!!oe["sd-selected"]:!1:!1,X=oe=>z(oe?.props?.class)||z(oe?.class),P=()=>n.options.map((oe,Te)=>M(oe)?Te:-1).filter(oe=>oe>=0),N=()=>{const oe=n.options.findIndex(Te=>M(Te)&&X(Te));return oe>=0?oe:P()[0]??-1},I=(oe,Te)=>{if(!oe){delete a.value[Te];return}a.value[Te]=oe},L=()=>{a.value.forEach((Te,Ge)=>{Te&&Te.setAttribute("tabindex",Ge===l.value?"0":"-1")});const oe=a.value[l.value];oe&&typeof oe.focus=="function"&&(oe.focus(),oe.scrollIntoView?.({block:"nearest",inline:"nearest"}))},Y=oe=>{const Te=P();if(!Te.length){l.value=-1;return}const Ge=Te.indexOf(l.value);if(Ge<0){l.value=oe>0?Te[0]:Te[Te.length-1];return}l.value=Te[(Ge+oe+Te.length)%Te.length]},te=()=>{let oe=n.options[l.value];if(!M(oe)){const Te=P()[0];oe=Te===void 0?null:n.options[Te]}oe&&T(oe)},le=Tl({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(oe){return()=>typeof oe.option.render!="function"?null:oe.option.render()}}),fe=Tl({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(oe){return()=>B(oe.option)}}),Ne=oe=>{if(!u.value)return;const Te=oe.target;if(!(Te instanceof Element))return;const Ge=o.value?.contains(Te),Je=i.value?.contains(Te);Ge||Je||w()},he=ne(null),ge=()=>{const oe=o.value,Te=document.activeElement;if(oe&&Te instanceof HTMLElement&&oe.contains(Te)){he.value=Te;return}he.value=oe?.matches?.(Vp)?oe:oe?.querySelector(Vp)},ae=()=>{const oe=he.value;if(oe instanceof HTMLElement&&document.contains(oe)){oe.focus();return}const Te=o.value;if(!Te)return;const Ge=Te.matches?.(Vp)?Te:Te.querySelector(Vp);if(Ge instanceof HTMLElement){Ge.focus();return}Te.setAttribute("tabindex","-1"),Te.focus()},_e=oe=>{if(!u.value)return;const{key:Te}=oe;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(Te)){if(Te==="Escape"){oe.preventDefault(),w(),St(()=>{requestAnimationFrame(ae)});return}if(!c.value){if(oe.preventDefault(),Te==="ArrowDown"){Y(1),L();return}if(Te==="ArrowUp"){Y(-1),L();return}Te==="Enter"&&te()}}};return Pt(u,async oe=>{if(!oe){l.value=-1,a.value=[];return}ge(),await St(),S(),!c.value&&(l.value=N(),await St(),L())},{immediate:!0}),Pt(u,oe=>{oe?(document.addEventListener("pointerdown",Ne,!0),document.addEventListener("keydown",_e,!0),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0)):(document.removeEventListener("pointerdown",Ne,!0),document.removeEventListener("keydown",_e,!0),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0))},{immediate:!0}),rr(()=>{document.removeEventListener("pointerdown",Ne,!0),document.removeEventListener("keydown",_e,!0),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}),(oe,Te)=>(me(),ke("div",PB,[Me("div",{ref_key:"triggerRef",ref:o,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:y},[dd(oe.$slots,"trigger",{},void 0,!0)],512),(me(),dn(Ra,{to:"body"},[Wt(Th,{name:"fade-in-scale-up-transition"},{default:ko(()=>[u.value?(me(),ke("div",rs({key:0,ref_key:"menuRef",ref:i,"data-sd-part":"dropdown-menu",class:m.value,style:g.value},h.value),[(me(!0),ke(qt,null,nr(e.options,(Ge,Je)=>(me(),ke("div",rs({key:Ge.key,ref_for:!0,ref:_t=>I(_t,Je),class:["toolbar-dropdown-option",[Ge.class,Ge.props?.class,{"sd-disabled":Ge.disabled,"sd-render":R(Ge)}]],tabindex:"-1",onClick:_t=>T(Ge)},{ref_for:!0},{...Ge.props,...C(Ge)}),[R(Ge)?(me(),dn(We(le),{key:0,option:Ge},null,8,["option"])):(me(),ke(qt,{key:1},[H(Ge)?(me(),ke("span",FB,[Wt(We(fe),{option:Ge},null,8,["option"])])):ut("",!0),Me("span",BB,Nt(Ge.label),1)],64))],16,OB))),128))],16)):ut("",!0)]),_:1})]))]))}},zB=fn(NB,[["__scopeId","data-v-fef410f7"]]),Dk=e=>String(e??"").trim().toLowerCase();const jp=(e,t)=>{const n=Dk(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(Dk(t[r]).startsWith(n))return r;return-1},HB=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=jp(r,t),i=o>=0?String(t[o]??""):"";return n&&o>=0&&i.length>r.length?{matchIndex:o,display:i,selectionStart:r.length,selectionEnd:i.length}:{matchIndex:o,display:r,selectionStart:r.length,selectionEnd:r.length}};var UB=e=>{let t=String(e??"").trim();for(;t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"));)t=t.slice(1,-1).trim();return t},VB=e=>e<=31||e===127,jB=e=>e===32||e===160||e===65279,GB=e=>Array.from(String(e)).filter(t=>!VB(t.charCodeAt(0))).join(""),WB=e=>{let t="",n=!1;for(const r of String(e)){if(jB(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t};const KB=e=>WB(UB(GB(String(e??"").split(",")[0]??""))).trim();var qB=1,YB=1638;const XB=e=>{const t=String(e??"").replace(/[^0-9.-]/g,""),n=Number.parseFloat(t);if(!Number.isFinite(n))return"";const r=Math.round(n*2)/2;return r<qB?"":String(Math.min(r,YB))};It(),mn();var QB=["data-item"],ZB=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],JB=["data-item","aria-label","disabled"],$B=["innerHTML"],eN=["id","aria-label"],tN=["id","aria-selected","aria-label","onMousedown","onMouseenter"],nN={class:"toolbar-dropdown-option__label"},rN={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},oN={__name:"ToolbarComboBox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},showPreview:{type:Boolean,default:!1},normalizeValue:{type:Function,default:e=>String(e??"").trim()}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t,{isHighContrastMode:o}=Hi(),i=ne(null),s=ne(null),a=ne(null),l=ne([]),u=ne(!1),c=ne(!1),d=ne(-1),h=ne(""),m=ne(""),p=ne(!1),g=ne({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),k=Ae(()=>n.item.nestedOptions?.value??[]),w=Ae(()=>k.value.map(W=>String(W?.label??""))),S=Ae(()=>String(n.item.label?.value??"")),y=Ae(()=>!!n.item.disabled?.value),C=Ae(()=>String(n.item.name?.value??"")),T=Ae(()=>n.item.attributes?.value?.ariaLabel??"Font family"),R=Ae(()=>u.value?m.value:S.value),M=Ae(()=>`sd-${C.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),H=W=>`${M.value}-option-${W}`,B=Ae(()=>c.value&&d.value>=0?H(d.value):void 0),z=Ae(()=>c.value?Zn.dropdownCaretUp:Zn.dropdownCaretDown),X=W=>{const K=String(W??"").trim().toLowerCase();return k.value.find(ue=>String(ue?.label??"").trim().toLowerCase()===K)?.props?.style?.fontFamily||W||n.uiFontFamily},P=Ae(()=>n.showPreview?{fontFamily:X(u.value?m.value:S.value)}:{fontFamily:n.uiFontFamily}),N=()=>{const W=n.item.selectedValue?.value;if(W){const K=k.value.findIndex(ue=>ue?.key===W);if(K>=0)return K}return w.value.findIndex(K=>K.toLowerCase()===S.value.toLowerCase())},I=(W,K)=>{const ue=i.value;if(!(!ue||typeof ue.setSelectionRange!="function"))try{ue.setSelectionRange(W,K)}catch{}},L=()=>{l.value[d.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},Y=()=>{l.value[d.value]?.focus?.()},te=()=>{const W=s.value;if(!W)return;const K=W.getBoundingClientRect(),ue=a.value,we=ue?.scrollHeight??ue?.offsetHeight??0,Ce=window.innerHeight||document.documentElement.clientHeight||0,xe=window.innerWidth||document.documentElement.clientWidth||0,ot=8,tt=4,Ct=K.bottom+tt,Kt=K.top-tt,pt=Math.max(0,Ce-Ct-ot),Mt=Math.max(0,Kt-ot),zt=pt<we&&Mt>pt,ln=zt?Mt:pt,$n=we?Math.min(we,ln):ln,Ht=zt?Math.max(ot,Kt-$n):Ct,Ke=Math.min(Math.max(ot,K.left),Math.max(ot,xe-K.width-ot));g.value={top:`${Ht}px`,left:`${Ke}px`,minWidth:`${K.width}px`,maxHeight:`${ln}px`}},le=Ae(()=>({position:"fixed",top:g.value.top,left:g.value.left,minWidth:g.value.minWidth,maxHeight:g.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),fe=W=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=W)},Ne=(W,{focusInput:K=!1,focusOption:ue=!1}={})=>{if(y.value||!k.value.length){fe(!1);return}c.value=!0,fe(!0),d.value=W??-1,K&&(u.value=!0,m.value=S.value,i.value?.focus()),St(()=>{te(),L(),ue&&Y()})},he=({syncItem:W=!0}={})=>{c.value=!1,d.value=-1,W&&fe(!1)},ge=()=>{he(),u.value=!1,h.value="",m.value=S.value},ae=()=>{y.value||(c.value||r("item-clicked"),u.value=!0,h.value="",m.value=S.value,St(()=>I(0,m.value.length)))},_e=W=>{if(y.value)return;const K=document.activeElement===i.value;if(r("item-clicked"),u.value=!0,K||(h.value="",m.value=S.value,W.preventDefault(),i.value?.focus({preventScroll:!0}),I(0,S.value.length)),!c.value){const ue=N();Ne(ue>=0?ue:0)}},oe=W=>{const K=W.relatedTarget;K instanceof Node&&s.value?.contains(K)||K instanceof Node&&a.value?.contains(K)||ge()},Te=W=>{if(p.value)return;const K=W.target,ue=K.value,we=typeof K.selectionStart=="number"?K.selectionStart:ue.length,Ce=typeof K.selectionEnd=="number"?K.selectionEnd:we,xe=typeof W.inputType=="string"&&W.inputType.startsWith("delete"),ot=we===ue.length&&Ce===ue.length;h.value=ue;const tt=HB(ue,w.value,{autocomplete:!xe&&ot});m.value=tt.display,K.value=tt.display,tt.display===ue&&!ot?I(we,Ce):I(tt.selectionStart,tt.selectionEnd),c.value&&(d.value=tt.matchIndex,St(L))},Ge=W=>{p.value=!1,Te(W)},Je=W=>{if(!k.value.length)return;const K=k.value.length;d.value=((d.value<0?W>0?-1:0:d.value)+W+K)%K,St(L)},_t=(W,K)=>{r("item-clicked"),r("command",{item:n.item,argument:W,option:K}),K&&(n.item.selectedValue.value=K.key)},be=W=>{W&&(_t(W.label,W),u.value=!1,h.value="",m.value=W.label,he())},Ve=()=>{if(c.value&&d.value>=0)return be(k.value[d.value]),!0;const W=jp(h.value,w.value);if(W>=0)return be(k.value[W]),!0;const K=n.normalizeValue(h.value);return K?(_t(K,null),u.value=!1,h.value="",m.value=K,he(),!0):!1},Le=W=>{if(!(W.isComposing||p.value||W.keyCode===229)&&!(W.ctrlKey||W.metaKey||W.altKey))switch(W.key){case"ArrowDown":if(W.preventDefault(),c.value)Y();else{const K=jp(h.value,w.value),ue=K>=0?K:N();Ne(ue>=0?ue:0,{focusOption:!0})}break;case"ArrowUp":if(W.preventDefault(),c.value)Y();else{const K=jp(h.value,w.value),ue=K>=0?K:N();Ne(ue>=0?ue:k.value.length-1,{focusOption:!0})}break;case"Enter":W.preventDefault(),Ve()&&r("editor-handoff"),i.value?.blur();break;case"Tab":W.preventDefault(),Ve(),he(),i.value?.blur(),r("tab-out",W);break;case"Escape":W.preventDefault(),ge(),St(()=>i.value?.focus());break;default:break}},J=W=>{if(W.preventDefault(),!y.value)if(r("item-clicked"),c.value)he(),i.value?.focus();else{const K=N();Ne(K>=0?K:0,{focusOption:!0})}},_=(W,K)=>{W.preventDefault(),be(K),r("editor-handoff"),i.value?.blur()},$=W=>{d.value=W},F=W=>{if(!(W.ctrlKey||W.metaKey||W.altKey))switch(W.key){case"ArrowDown":W.preventDefault(),Je(1),Y();break;case"ArrowUp":W.preventDefault(),Je(-1),Y();break;case"Enter":W.preventDefault(),d.value>=0&&(be(k.value[d.value]),r("editor-handoff"));break;case"Escape":W.preventDefault(),ge(),St(()=>i.value?.focus());break;case"Tab":W.preventDefault(),d.value>=0?be(k.value[d.value]):he(),r("tab-out",{shiftKey:W.shiftKey,target:i.value});break;default:break}},j=W=>{if(!c.value)return;const K=W.target;K instanceof Element&&(s.value?.contains(K)||a.value?.contains(K)||ge())};Pt(c,W=>{W?(document.addEventListener("pointerdown",j,!0),window.addEventListener("resize",te),window.addEventListener("scroll",te,!0)):(document.removeEventListener("pointerdown",j,!0),window.removeEventListener("resize",te),window.removeEventListener("scroll",te,!0),l.value=[])},{immediate:!0}),rr(()=>{document.removeEventListener("pointerdown",j,!0),window.removeEventListener("resize",te),window.removeEventListener("scroll",te,!0)});const V=(W,K)=>{if(!W){delete l.value[K];return}l.value[K]=W},G=W=>W===d.value,Z=W=>W?.key&&W.key===n.item.selectedValue?.value;return Pt(S,W=>{u.value||(m.value=W)}),Pt(()=>!!n.item.expand?.value,W=>{if(W&&!c.value){const K=N();Ne(K>=0?K:0,{focusInput:!0});return}!W&&c.value&&he({syncItem:!1})}),(W,K)=>(me(),ke("div",{ref_key:"rootRef",ref:s,class:en(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":y.value,"high-contrast":We(o)}]),style:gn(n.item.style?.value),"data-item":`btn-${C.value}`},[Me("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:_e},[Me("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${C.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:R.value,style:gn(P.value),disabled:y.value,"aria-label":T.value,"aria-expanded":c.value?"true":"false","aria-controls":M.value,"aria-activedescendant":B.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${C.value}-input`,onFocus:ae,onBlur:oe,onInput:Te,onKeydown:Le,onCompositionstart:K[0]||(K[0]=ue=>p.value=!0),onCompositionend:Ge},null,44,ZB)],32),Me("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${C.value}-toggle`,tabindex:"-1","aria-label":`${T.value} options`,disabled:y.value,onMousedown:J},[Me("span",{class:"sd-dropdown-caret",innerHTML:z.value},null,8,$B)],40,JB),(me(),dn(Ra,{to:"body"},[c.value?(me(),ke("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:M.value,"aria-label":T.value,class:en(["sd-font-combobox__listbox",{"high-contrast":We(o)}]),style:gn(le.value)},[(me(!0),ke(qt,null,nr(k.value,(ue,we)=>(me(),ke("div",rs({key:ue.key,ref_for:!0,ref:Ce=>V(Ce,we),id:H(we),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":G(we),"sd-selected":Z(ue)}],"aria-selected":Z(ue)?"true":"false","aria-label":`${T.value} - ${ue.label}`},{ref_for:!0},ue.props,{onMousedown:Ce=>_(Ce,ue),onMouseenter:Ce=>$(we),onKeydown:F}),[Me("span",nN,Nt(ue.label),1)],16,tN))),128))],14,eN)):ut("",!0)])),Me("span",rN,Nt(S.value),1)],14,QB))}},Pk=fn(oN,[["__scopeId","data-v-99070b63"]]);It();var iN={__name:"FontFamilyCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(me(),dn(Pk,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":We(KB),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}},sN=iN;It();var aN={__name:"FontSizeCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(me(),dn(Pk,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":We(XB),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}},lN=aN;It(),mn();var cN=2500,uN=Object.assign({inheritAttrs:!1},{__name:"SdTooltip",props:{trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},setup(e){const t=e,n=M2(),r=ne(!1),o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px"});let a=null,l=null,u=null;const c=Ae(()=>["sd-tooltip-content",n.class]),d=Ae(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),h=()=>{a&&(window.clearTimeout(a),a=null)},m=()=>{l&&(window.clearTimeout(l),l=null)},p=()=>{u&&(window.clearTimeout(u),u=null)},g=()=>{p(),u=window.setTimeout(()=>{u=null,S()},cN)},k=()=>{if(!o.value||!i.value)return;const z=o.value.getBoundingClientRect(),X=i.value.offsetWidth,P=i.value.offsetHeight,N=window.innerWidth||document.documentElement.clientWidth||0,I=8;let L=z.left+z.width/2-X/2;L=Math.max(I,Math.min(L,N-X-I)),s.value={top:`${z.top-P-10}px`,left:`${L}px`}},w=async()=>{t.disabled||(h(),m(),!r.value&&(r.value=!0,g(),await St(),k()))},S=()=>{m(),h(),p(),r.value&&(r.value=!1)},y=()=>{if(h(),m(),!r.value){if(t.delay===0){w();return}l=window.setTimeout(()=>{l=null,w()},t.delay)}},C=()=>{if(m(),h(),!!r.value){if(t.duration===0){S();return}a=window.setTimeout(()=>{a=null,S()},t.duration)}},T=()=>{t.trigger==="hover"&&y()},R=()=>{t.trigger==="hover"&&C()},M=()=>{m(),h()},H=()=>{C()},B=z=>{z.key==="Escape"&&S()};return Pt(()=>t.disabled,z=>{z&&S()}),Pt(r,z=>{z?(window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),document.addEventListener("keydown",B,!0)):(window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0),document.removeEventListener("keydown",B,!0))}),rr(()=>{m(),h(),p(),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0),document.removeEventListener("keydown",B,!0)}),(z,X)=>(me(),ke(qt,null,[Me("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:T,onMouseleave:R,onFocusin:T,onFocusout:R},[dd(z.$slots,"trigger",{},void 0,!0)],544),(me(),dn(Ra,{to:"body"},[Wt(Th,{name:"fade-in-scale-up-transition"},{default:ko(()=>[r.value&&!e.disabled?(me(),ke("div",{key:0,ref_key:"contentRef",ref:i,class:en(c.value),style:gn(d.value),onMouseenter:M,onMouseleave:H},[X[0]||(X[0]=Me("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),dd(z.$slots,"default",{},void 0,!0)],38)):ut("",!0)]),_:3})]))],64))}}),Gp=fn(uN,[["__scopeId","data-v-2a872eae"]]);It(),mn();var dN=["onKeydown","tabindex","data-item-id"],fN={key:0},hN={key:0},pN={key:0},mN={key:0},gN={key:0},vN={__name:"ButtonGroup",props:{toolbarItems:{type:Array,required:!0},overflowItems:{type:Array,default:()=>[]},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},position:{type:String,default:"left"},fromOverflow:{type:Boolean,default:!1},compactSideGroups:{type:Boolean,default:!1}},emits:["command","item-clicked","dropdown-update-show"],setup(e,{emit:t}){const n=t,{proxy:r}=or(),o=ne([]),i=ne(null),s=e,a=ne(null),{isHighContrastMode:l}=Hi(),u=window.matchMedia("(max-width: 768px)").matches,c=Ae(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:u?0:1,justifyContent:"center"}),d=be=>be.type==="button",h=be=>be.type==="dropdown",m=be=>be.type==="dropdown"&&be.name?.value==="fontFamily",p=be=>be.type==="dropdown"&&be.name?.value==="fontSize",g=be=>be.type==="separator",k=be=>be.type==="overflow",w=be=>!!be.nestedOptions?.value?.length,S=be=>{if(!be)return!1;const Ve=be.expand;return typeof Ve=="object"&&Ve!==null&&"value"in Ve?!!Ve.value:!!Ve},y=(be,Ve)=>{be?.expand&&(be.expand.value=Ve)},C=(be,Ve=void 0)=>{if(be.disabled.value)return;if(k(be)){const J=!S(be);J&&M(),y(be,J),a.value=J?be:null,n("item-clicked");return}if(h(be))return;a.value&&h(a.value)&&S(a.value)&&M(),n("item-clicked");const Le=Ve!==void 0?Ve:be.argument?.value;n("command",Le===void 0?{item:be}:{item:be,argument:Le})},T=(be,Ve)=>{be.disabled.value||(a.value=null,n("command",{item:be,argument:Ve}))},R=be=>{if(be.disabled.value)return;M();const Ve=be.splitButtonCommand,Le=be.command,J=Ve||Le;if(!J)return;const _={...be,command:J};n("item-clicked"),n("command",{item:_})},M=()=>{const be=r?.$toolbar?.toolbarItems||[],Ve=r?.$toolbar?.overflowItems||[],Le=[...be,...Ve];(Le.length?Le:s.toolbarItems).forEach(J=>{const _=k(J)&&!s.fromOverflow;(h(J)||_)&&y(J,!1)}),a.value=null},H=(be,Ve)=>{M(),n("command",{item:be,argument:be.dropdownValueKey.value?Ve[be.dropdownValueKey.value]:Ve.label,option:Ve}),be.selectedValue.value=Ve.key},B=be=>{n("command",be)},z=()=>{M(),n("item-clicked")},X=()=>{const be=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return be instanceof HTMLElement?(be.focus({preventScroll:!0}),!0):!1},P=()=>{const be=r?.$toolbar?.pendingSelectionCapture,Ve=()=>{be&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(be)};if(X()){Ve();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ve())},N=be=>!(be instanceof HTMLElement)||be.classList.contains("sd-disabled")?null:be.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||be.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),I=(be,Ve)=>{const Le=be?.target?.closest?.(".sd-toolbar-item-ctn");if(!(Le instanceof HTMLElement))return!1;let J=Ve>0?Le.nextElementSibling:Le.previousElementSibling;for(;J;){const _=N(J);if(_ instanceof HTMLElement)return Le.setAttribute("tabindex","-1"),J.setAttribute("tabindex","0"),_.focus(),!0;J=Ve>0?J.nextElementSibling:J.previousElementSibling}return!1},L=be=>{M(),I(be,be?.shiftKey?-1:1)||P()},Y=be=>{if(M(),be?.shiftKey){I(be,-1)||P();return}P()},te=()=>{P()},le=be=>be.nestedOptions?.value?.length?be.nestedOptions.value.map(Ve=>{const Le=Ve?.type!=="render"&&be.selectedValue.value===Ve.key;return{...Ve,props:{...Ve.props,class:Le?"sd-selected":""}}}):[],fe=(be,Ve)=>({role:"menuitem",ariaLabel:`${Ve.attributes.value.ariaLabel} - ${be.label}`}),Ne=be=>{const Ve=be.target,Le=be.target.closest(".sd-toolbar-item-ctn").nextElementSibling;Le&&(Ve.setAttribute("tabindex","-1"),Le.setAttribute("tabindex","0"),Le.focus())},he=be=>{const Ve=be.target,Le=be.target.closest(".sd-toolbar-item-ctn").previousElementSibling;Le&&(Ve.setAttribute("tabindex","-1"),Le.setAttribute("tabindex","0"),Le.focus())},ge=be=>{const Ve=be.target.closest(".button-group").nextElementSibling;if(Ve)Ve.setAttribute("tabindex","0"),Ve.focus();else{const Le=document.querySelector(".ProseMirror");Le&&Le.focus()}},ae=be=>{const Ve=be.target.closest(".button-group").previousElementSibling;Ve&&(Ve.setAttribute("tabindex","0"),Ve.focus())},_e=be=>{if(!be.disabled.value){if(h(be)){Ge(!S(be),be);return}C(be)}},oe=(be,Ve)=>{const Le=be.target.nodeName==="INPUT"||be.target.nodeName==="TEXTAREA",J=Ve.name.value==="fontSize"||Ve.name.value==="fontFamily";if(!(Le&&J)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(be.key))switch(be.preventDefault(),be.key){case"Enter":case" ":case"Spacebar":_e(Ve);break;case"Escape":M();break;case"ArrowRight":M(),Ne(be);break;case"ArrowLeft":M(),he(be);break;case"Tab":be.shiftKey?ae(be):ge(be);break;default:break}},Te=be=>{const Ve=o.value.find(Le=>!Le.classList.contains("sd-disabled"));Ve&&(Ve.setAttribute("tabindex","0"),Ve.focus())},Ge=(be,Ve)=>{if(n("item-clicked"),!be){M(),n("dropdown-update-show",!1);return}M(),a.value=Ve,y(Ve,!0),n("dropdown-update-show",!0)},Je=be=>{if(!a.value)return;const Ve=be.target;Ve instanceof Element&&(Ve.closest(".sd-toolbar-dropdown-menu")||i.value?.contains(Ve)||M())};return Pt(()=>S(a.value),be=>{be?document.addEventListener("pointerdown",Je,!0):document.removeEventListener("pointerdown",Je,!0)},{immediate:!0}),rr(()=>{document.removeEventListener("pointerdown",Je,!0)}),(be,Ve)=>(me(),ke("div",{style:gn(c.value),class:"button-group",role:"group",onFocus:Te,ref_key:"buttonGroupRef",ref:i},[(me(!0),ke(qt,null,nr(e.toolbarItems,(Le,J)=>(me(),ke("div",{key:Le.id.value,class:en([{narrow:Le.isNarrow.value,wide:Le.isWide.value,"sd-disabled":Le.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:_=>oe(_,Le),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:J===0?0:-1,"data-item-id":Le.id.value},[g(Le)?(me(),dn(xB,{key:0,style:{width:"20px"}})):ut("",!0),m(Le)&&w(Le)?(me(),dn(Gp,{key:1,trigger:"hover",disabled:!Le.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ko(()=>[Wt(sN,{item:Le,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:B,onItemClicked:z,onTabOut:Ve[0]||(Ve[0]=_=>L(_)),onEditorHandoff:te},null,8,["item","ui-font-family"])]),default:ko(()=>[Me("div",null,[Fi(Nt(Le.tooltip)+" ",1),Le.disabled.value?(me(),ke("span",fN,"(disabled)")):ut("",!0)])]),_:2},1032,["disabled","content-style"])):p(Le)&&w(Le)?(me(),dn(Gp,{key:2,trigger:"hover",disabled:!Le.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ko(()=>[Wt(lN,{item:Le,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:B,onItemClicked:z,onTabOut:Ve[1]||(Ve[1]=_=>Y(_)),onEditorHandoff:te},null,8,["item","ui-font-family"])]),default:ko(()=>[Me("div",null,[Fi(Nt(Le.tooltip)+" ",1),Le.disabled.value?(me(),ke("span",hN,"(disabled)")):ut("",!0)])]),_:2},1032,["disabled","content-style"])):h(Le)&&Le.nestedOptions?.value?.length?(me(),dn(zB,{key:3,options:le(Le),disabled:Le.disabled.value,show:S(Le),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(_,$)=>H(Le,$),"onUpdate:show":_=>Ge(_,Le),style:gn(Le.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":We(l)}]}),"node-props":_=>fe(_,Le)},{trigger:ko(()=>[Wt(Gp,{trigger:"hover",disabled:!Le.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ko(()=>[Wt(L0,{"toolbar-item":Le,disabled:Le.disabled.value,"allow-enter-propagation":!0,onTextSubmit:_=>T(Le,_),onMainClick:_=>R(Le)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:ko(()=>[Me("div",null,[Fi(Nt(Le.tooltip)+" ",1),Le.disabled.value?(me(),ke("span",pN,"(disabled)")):ut("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):d(Le)?(me(),dn(Gp,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:ko(()=>[Wt(L0,{"toolbar-item":Le,"is-overflow-item":e.fromOverflow,onTextSubmit:_=>T(Le,_),onButtonClick:_=>C(Le)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:ko(()=>[Le.tooltip?(me(),ke("div",mN,[Fi(Nt(Le.tooltip)+" ",1),Le.disabled.value?(me(),ke("span",gN,"(disabled)")):ut("",!0)])):ut("",!0)]),_:2},1032,["content-style"])):ut("",!0),k(Le)&&e.overflowItems.length?(me(),dn(DB,{key:5,"toolbar-item":Le,onButtonClick:_=>C(Le),"overflow-items":e.overflowItems,onClose:M},null,8,["toolbar-item","onButtonClick","overflow-items"])):ut("",!0)],42,dN))),128))],36))}},Wp=fn(vN,[["__scopeId","data-v-590293ab"]]),yN=[["Arial","sans-serif"],["Arial Black","sans-serif"],["Arial Narrow","sans-serif"],["Baskerville Old Face","serif"],["Bookman Old Style","serif"],["Brush Script MT","cursive"],["Calibri","sans-serif"],["Century","serif"],["Century Gothic","sans-serif"],["Comic Sans MS","sans-serif"],["Cooper Black","serif"],["Courier New","monospace"],["Garamond","serif"],["Georgia","serif"],["Gill Sans MT Condensed","sans-serif"],["Helvetica","sans-serif"],["Lucida Console","monospace"],["Segoe UI","sans-serif"],["Tahoma","sans-serif"],["Times New Roman","serif"],["Trebuchet MS","sans-serif"],["Verdana","sans-serif"]];const bN=yN.map(([e,t])=>({label:e,key:e,fontWeight:400,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function wN(e){if(e?.length)return e.map(t=>({label:t.label,key:t.value,fontWeight:400,props:{style:{fontFamily:t.previewFamily||t.label},"data-item":"btn-fontFamily-option"}}))}const CN=[{label:"8",key:"8pt",props:{"data-item":"btn-fontSize-option"}},{label:"9",key:"9pt",props:{"data-item":"btn-fontSize-option"}},{label:"10",key:"10pt",props:{"data-item":"btn-fontSize-option"}},{label:"11",key:"11pt",props:{"data-item":"btn-fontSize-option"}},{label:"12",key:"12pt",props:{"data-item":"btn-fontSize-option"}},{label:"14",key:"14pt",props:{"data-item":"btn-fontSize-option"}},{label:"18",key:"18pt",props:{"data-item":"btn-fontSize-option"}},{label:"24",key:"24pt",props:{"data-item":"btn-fontSize-option"}},{label:"30",key:"30pt",props:{"data-item":"btn-fontSize-option"}},{label:"36",key:"36pt",props:{"data-item":"btn-fontSize-option"}},{label:"48",key:"48pt",props:{"data-item":"btn-fontSize-option"}},{label:"60",key:"60pt",props:{"data-item":"btn-fontSize-option"}},{label:"72",key:"72pt",props:{"data-item":"btn-fontSize-option"}},{label:"96",key:"96pt",props:{"data-item":"btn-fontSize-option"}}],_f={sm:768,md:1024,lg:1280,xl:1410},D0={undo:"undo",redo:"redo",bold:"bold",italic:"italic",underline:"underline",strike:"strikethrough",acceptTrackedChangeBySelection:"track-changes-accept-selection",rejectTrackedChangeOnSelection:"track-changes-reject-selection",ruler:"ruler",formattingMarks:"formatting-marks",zoom:"zoom",measurementUnit:"measurement-unit",documentMode:"document-mode",link:"link",fontFamily:"font-family",fontSize:"font-size",list:"bullet-list",numberedlist:"numbered-list",table:"table-insert",image:"image",tableOfContents:"table-of-contents-insert",color:"text-color",highlight:"highlight-color",textAlign:"text-align",lineHeight:"line-height",linkedStyles:"linked-style",indentleft:"indent-decrease",indentright:"indent-increase",directionLtr:"direction-ltr",directionRtl:"direction-rtl",clearFormatting:"clear-formatting",copyFormat:"copy-format"},Ok={addRowBefore:"table-add-row-before",addRowAfter:"table-add-row-after",deleteRow:"table-delete-row",addColumnBefore:"table-add-column-before",addColumnAfter:"table-add-column-after",deleteColumn:"table-delete-column",deleteTable:"table-delete",deleteCellAndTableBorders:"table-remove-borders",mergeCells:"table-merge-cells",splitCell:"table-split-cell",fixTables:"table-fix"},Fk=Object.values(Ok),Cj=[...new Set([...Object.values(D0),...Fk])];var _N=new Set(["link"]);const _j=new Set(Object.keys(D0).filter(e=>!_N.has(e)));It(),mn();var SN="Arial, Helvetica, sans-serif",kN={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=or();let r=ne(1);const o=ne(0),i=ne(!1);let s=null,a=null;const l=Ae(()=>{const H=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof H=="string"&&H.trim()?H.trim():SN}),u=n.$toolbar.config?.toolbarGroups?.includes("left"),c=n.$toolbar.config?.toolbarGroups?.includes("right"),d=n.$toolbar.config?.toolbarButtonsExclude||[],h=H=>(o.value,n.$toolbar.getToolbarItemByGroup(H).filter(B=>!d.includes(B.name.value))),m=()=>{i.value=n.$toolbar.getAvailableWidth()<=_f.lg},g=uB(async()=>{await n.$toolbar.onToolbarResize(),m(),r.value+=1},300),k=()=>{r.value+=1},w=()=>{o.value+=1};function S(){window.removeEventListener("resize",g),n.$toolbar.off?.("toolbar-items-changed",k),n.$toolbar.off?.("toolbar-state-change",w),s?.disconnect(),s=null}function y(){S(),window.addEventListener("resize",g),n.$toolbar.on?.("toolbar-items-changed",k),n.$toolbar.on?.("toolbar-state-change",w),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(s=new ResizeObserver(()=>{g()}),s.observe(n.$toolbar.toolbarContainer)),m()}Rn(y),fg(y),hg(S),rr(S);const C=()=>{if(!n.$toolbar.activeEditor){a=null,n.$toolbar.pendingSelectionCapture=null;return}a=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=a},T=({item:H,argument:B,option:z})=>{R(),n.$toolbar.emitCommand({item:H,argument:B,option:z})},R=()=>{const H=n.$toolbar.activeEditor;if(!H)return;const B=n.$toolbar.pendingSelectionCapture??a;if(B&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(B);return}H.commands?.restoreSelection?.()},M=H=>{C(),!H.target.closest('input, textarea, [contenteditable="true"]')&&H.preventDefault()};return(H,B)=>(me(),ke("div",{class:"superdoc-toolbar",key:We(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:M},[We(u)?(me(),dn(Wp,{key:0,tabindex:"0","toolbar-items":h("left"),"overflow-items":We(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"left",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):ut("",!0),Wt(Wp,{tabindex:"0","toolbar-items":h("center"),"overflow-items":We(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"center",onCommand:T},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),We(c)?(me(),dn(Wp,{key:1,tabindex:"0","toolbar-items":h("right"),"overflow-items":We(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"right",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):ut("",!0)],32))}},AN=fn(kN,[["__scopeId","data-v-55b5af7a"]]);const IN=e=>{if(!e)return e;const t=e.props?.style?.fontFamily??e.label??e.key;return{...e,props:{...e.props,style:{...e.props?.style,fontFamily:t},"data-item":e.props?.["data-item"]??"btn-fontFamily-option"}}};It();const wn=e=>{if(!["button","options","separator","dropdown","overflow"].includes(e.type))throw new Error("Invalid toolbar item type - "+e.type);if(e.type==="button"&&!e.defaultLabel&&!e.icon)throw new Error("Toolbar button item needs either icon or label - "+e.name);if(!e.name)throw new Error("Invalid toolbar item name - "+e.name);const t=ne(Ji()),n=e.type,r=ne(e.name),o=e.command,i=e.noArgumentCommand,s=ne(e.icon),a=ne(e.group||"center"),l=ne(e.allowWithoutEditor),u=ne(e.attributes||{}),c=e.disabled||!1,d=ne(e.disabled),h=ne(!1),m=ne(!1),p=ne(e.style),g=ne(e.isNarrow),k=ne(e.isWide),w=ne(e.minWidth),S=ne(e.suppressActiveHighlight||!1),y=ne(e.argument),C=ne(null),T=ne(null),R=ne(e.iconColor),M=ne(e.hasCaret),H=ne(!!e.splitButton),B=e.splitButtonCommand,z=!!e.restoreEditorFocus,X=ne(e.dropdownStyles),P=ne(e.tooltip),N=ne(e.tooltipVisible),I=ne(e.tooltipTimeout),L=ne(e.defaultLabel),Y=ne(e.label),te=ne(e.hideLabel),le=ne(e.inlineTextInputVisible),fe=ne(e.hasInlineTextInput),Ne=ne(e.markName),he=ne(e.labelAttr),ge=ne(e.selectedValue),ae=ne(e.dropdownValueKey),_e=ne(e.inputRef||null),oe=ne([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);oe.value?.push(...e.options)}const Te=(_={},...$)=>{be(_,...$),!S.value&&(h.value=!0)},Ge=()=>{Ve(),h.value=!1},Je=_=>{d.value=_},_t=()=>{d.value=c},be=e.onActivate||(()=>null),Ve=e.onDeactivate||(()=>null),Le=()=>{const _={};return Object.keys(J).forEach($=>{J[$].value!==void 0&&(_[$]=J[$].value)}),_},J={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:P,group:a,attributes:u,disabled:d,active:h,expand:m,nestedOptions:oe,style:p,isNarrow:g,isWide:k,minWidth:w,argument:y,parentItem:T,iconColor:R,hasCaret:M,splitButton:H,splitButtonCommand:B,dropdownStyles:X,tooltipVisible:N,tooltipTimeout:I,defaultLabel:L,label:Y,hideLabel:te,inlineTextInputVisible:le,hasInlineTextInput:fe,restoreEditorFocus:z,markName:Ne,labelAttr:he,childItem:C,allowWithoutEditor:l,dropdownValueKey:ae,selectedValue:ge,inputRef:_e};return{...J,unref:Le,activate:Te,deactivate:Ge,setDisabled:Je,resetDisabled:_t,onActivate:be,onDeactivate:Ve}};It(),mn();var EN=["onClick","innerHTML","aria-label","onKeydown"],xN={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Hi(),r=t,o=ne([]),i=[{key:"left",ariaLabel:"Align left",icon:Zn.alignLeft},{key:"center",ariaLabel:"Align center",icon:Zn.alignCenter},{key:"right",ariaLabel:"Align right",icon:Zn.alignRight},{key:"justify",ariaLabel:"Justify",icon:Zn.alignJustify}],s=c=>{r("select",c)},a=c=>{if(c===o.value.length-1)return;const d=o.value[c+1];d&&(d.setAttribute("tabindex","0"),d.focus())},l=c=>{if(c===0)return;const d=o.value[c-1];d&&(d.setAttribute("tabindex","0"),d.focus())},u=(c,d)=>{switch(c.key){case"ArrowLeft":l(d);break;case"ArrowRight":a(d);break;case"Enter":s(i[d].key);break;default:break}};return Rn(()=>{const c=o.value[0];c&&(c.setAttribute("tabindex","0"),c.focus())}),(c,d)=>(me(),ke("div",{class:en(["alignment-buttons",{"high-contrast":We(n)}])},[(me(),ke(qt,null,nr(i,(h,m)=>Me("div",{key:h.key,class:"sd-button-icon",onClick:p=>s(h.key),innerHTML:h.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":h.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:Jt(p=>u(p,m),["prevent"])},null,40,EN)),64))],2))}},TN=fn(xN,[["__scopeId","data-v-13e5f7a4"]]);It(),mn();var RN=["onClick","innerHTML","aria-label","onKeydown"],MN={__name:"StyleButtonsList",props:{buttons:{type:Array,required:!0},selectedStyle:{type:String,default:null},iconSize:{type:Number,default:25}},emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Hi(),r=t,o=e,i=ne([]),s=Ae(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=d=>{r("select",d)},l=d=>{if(d===i.value.length-1)return;const h=i.value[d+1];h&&(h.setAttribute("tabindex","0"),h.focus())},u=d=>{if(d===0)return;const h=i.value[d-1];h&&(h.setAttribute("tabindex","0"),h.focus())},c=(d,h)=>{switch(d.key){case"ArrowLeft":u(h);break;case"ArrowRight":l(h);break;case"Enter":a(o.buttons[h].key);break;default:break}};return Rn(()=>{const d=i.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,h)=>(me(),ke("div",{class:en(["style-buttons-list",{"high-contrast":We(n)}])},[(me(!0),ke(qt,null,nr(o.buttons,(m,p)=>(me(),ke("div",{key:m.key,class:en(["sd-button-icon",{"sd-selected":o.selectedStyle===m.key}]),style:gn(s.value),onClick:g=>a(m.key),innerHTML:m.icon,role:"menuitem","aria-label":m.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:Jt(g=>c(g,p),["prevent"])},null,46,RN))),128))],2))}},Bk=fn(MN,[["__scopeId","data-v-44f37ff6"]]);const LN=[{key:"disc",icon:Zn.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:Zn.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:Zn.bulletListSquare,ariaLabel:"Opaque square"}],DN=[{key:"decimal",icon:Zn.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:Zn.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:Zn.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:Zn.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:Zn.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:Zn.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:Zn.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:Zn.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];It(),mn();var PN=["onClick","onKeydown"],ON={class:"document-mode-column icon-column"},FN=["innerHTML"],BN={class:"document-mode-column text-column"},NN={class:"document-mode-type"},zN={class:"document-mode-description"},HN={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),{isHighContrastMode:o}=Hi(),i=e,s=c=>{n("select",c)},a=c=>{if(c===r.value.length-1)return;const d=r.value[c+1];d&&(d.setAttribute("tabindex","0"),d.focus())},l=c=>{if(c===0)return;const d=r.value[c-1];d&&(d.setAttribute("tabindex","0"),d.focus())},u=(c,d)=>{switch(c.key){case"ArrowDown":a(d);break;case"ArrowUp":l(d);break;case"Enter":s(i.options[d]);break;default:break}};return Rn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(c,d)=>(me(),ke("div",{class:en(["document-mode",{"high-contrast":We(o)}])},[(me(!0),ke(qt,null,nr(e.options,(h,m)=>(me(),ke("div",{class:en(["sd-option-item",{"sd-disabled":h.disabled}]),onClick:p=>s(h),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:Jt(p=>u(p,m),["prevent"])},[Me("div",ON,[Me("div",{class:"icon-column__icon",innerHTML:h.icon},null,8,FN)]),Me("div",BN,[Me("div",NN,Nt(h.label),1),Me("div",zN,Nt(h.description),1)])],42,PN))),256))],2))}},UN=fn(HN,[["__scopeId","data-v-bee14d7a"]]);It(),mn();var VN={class:"linked-style-buttons","data-editor-ui-surface":""},jN=["onClick","onKeydown","aria-label"],GN={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),o=e,i=d=>{n("select",d)},s=d=>{if(d===r.value.length-1)return;const h=r.value[d+1];h.setAttribute("tabindex","0"),h.focus()},a=d=>{if(d===0)return;const h=r.value[d-1];h.setAttribute("tabindex","0"),h.focus()},l=(d,h,m)=>{switch(d.key){case"ArrowDown":s(h);break;case"ArrowUp":a(h);break;case"Enter":d.preventDefault(),i(m);break;default:break}},u=d=>d?.name??d?.id??"",c=d=>{const h=d?.preview?.css;return h&&typeof h=="object"?h:void 0};return Rn(()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())}),(d,h)=>(me(),ke("div",VN,[(me(!0),ke(qt,null,nr(o.styles,(m,p)=>(me(),ke("div",{key:m.id??p,class:en(["style-item",{selected:e.selectedOption===m.id}]),onClick:g=>i(m),onKeydown:g=>l(g,p,m),"aria-label":`Linked style - ${m.id??u(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[Me("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:gn(c(m))},Nt(u(m)),5)],42,jN))),128))]))}},WN=fn(GN,[["__scopeId","data-v-43b5dcca"]]);It(),mn();var KN=["placeholder"],qN={class:"sd-ai-writer__footer"},YN={key:0,class:"sd-ai-writer__error",role:"alert"},XN=["disabled"],QN="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",ZN="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",JN={__name:"AIWriter",props:{selectedText:{type:String,default:""},target:{type:Object,default:null},doc:{type:Object,default:null},apiKey:{type:String,default:""},endpoint:{type:String,default:""},restoreSelection:{type:Function,default:null},handleClose:{type:Function,required:!0}},setup(e){const t=e,n=ne(""),r=ne(!1),o=ne(""),i=ne(null),s=Ae(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=Ae(()=>n.value.trim().length>0&&!r.value);Rn(()=>{St(()=>{i.value?.focus()})});function l(p){if(typeof p=="string")return p;if(!p||typeof p!="object")return"";const g=p.custom_prompt;if(Array.isArray(g)){const k=g[0];if(k&&typeof k.value=="string")return k.value}return g&&typeof g=="object"&&typeof g.value=="string"?g.value:typeof p.value=="string"?p.value:typeof p.text=="string"?p.text:""}async function u(p){const g={"Content-Type":"application/json"};t.apiKey&&(g["x-api-key"]=t.apiKey);const k=t.selectedText.trim(),w=k?`Rewrite the following text: "${k}" using these instructions: ${p}`:`Generate text based on the following prompt: ${p}`,S=await fetch(t.endpoint||QN,{method:"POST",headers:g,body:JSON.stringify({stream:!1,context:ZN,insights:[{type:"custom_prompt",name:k?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!S.ok){const C=await S.text().catch(()=>"");throw new Error(C||`AI request failed with ${S.status}`)}const y=l((S.headers.get("content-type")||"").includes("application/json")?await S.json():await S.text()).trim();if(!y)throw new Error("AI returned no text.");return y}function c(p){return!p||typeof p!="object"?!0:!(p.success===!1||p.ok===!1)}function d(p){const g=t.doc;if(!g)throw new Error("Document API is unavailable.");t.restoreSelection?.();let k=null,w=!1;if(t.selectedText&&t.target&&typeof g.replace=="function"?(k=g.replace({target:t.target,text:p}),w=!0):t.target&&typeof g.insert=="function"?(k=g.insert({target:t.target,value:p,type:"text"}),w=!0):typeof g.insert=="function"&&(k=g.insert({value:p,type:"text"}),w=!0),!w)throw new Error("Document text insertion is unavailable.");if(!c(k))throw new Error("Unable to insert generated text.")}async function h(){if(a.value){o.value="",r.value=!0;try{d(await u(n.value.trim())),t.handleClose()}catch(p){o.value=p instanceof Error?p.message:String(p)}finally{r.value=!1}}}function m(p){p.key!=="Enter"||p.shiftKey||(p.preventDefault(),h())}return(p,g)=>(me(),ke("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:Jt(h,["prevent"])},[Ms(Me("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":g[0]||(g[0]=k=>n.value=k),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:m},null,40,KN),[[Ii,n.value]]),Me("div",qN,[o.value?(me(),ke("p",YN,Nt(o.value),1)):ut("",!0),Me("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Nt(r.value?"Generating":"Generate"),9,XN)])],32))}},$N=fn(JN,[["__scopeId","data-v-67f6c6f7"]]);It(),mn();var ez=["aria-label","onClick","onKeydown"],tz=["innerHTML"],nz=["innerHTML"],Kp=7,rz={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=Ae(()=>p=>r.activeColor.value?r.activeColor.value.toUpperCase()===p.value:!1),i=(p,g)=>g===5||["#FFFFFF","#FAFF09"].includes(p)?{color:"#000"}:{color:"#FFF"},s=p=>{n("select",p.value)},a=ne([]),l=ne([]);Rn(()=>{if(!r.icons.every(g=>Array.isArray(g)))throw new Error("icon props must be 2d array");const p=l.value[0];p&&(p.setAttribute("tabindex","0"),p.focus({preventScroll:!0}))});const u=(p,g)=>{const k=Kp*p+g+1,w=l.value[k];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},c=(p,g)=>{const k=Kp*p+g-1,w=l.value[k];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(p,g)=>{const k=g+Kp*(p+1),w=l.value[k];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},h=(p,g)=>{const k=g+Kp*(p-1),w=l.value[k];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},m=(p,g,k,w)=>{switch(p.key){case"ArrowRight":u(g,k);break;case"ArrowLeft":c(g,k);break;case"ArrowDown":d(g,k);break;case"ArrowUp":h(g,k);break;case"Enter":s(w);break;case"Escape":n("clickoutside");break;default:break}};return(p,g)=>(me(!0),ke(qt,null,nr(e.icons,(k,w)=>(me(),ke("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(me(!0),ke(qt,null,nr(k,(S,y)=>(me(),ke("div",{class:"sd-option",key:y,"aria-label":S.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:Jt(C=>s(S),["stop","prevent"]),onKeydown:Jt(C=>m(C,w,y,S),["prevent"])},[Me("div",{class:"sd-option__icon",innerHTML:S.icon,style:gn(S.style)},null,12,tz),o.value(S)?(me(),ke("div",{key:0,class:"sd-option__check",innerHTML:We(Zn).colorOptionCheck,style:gn(i(S.value,y))},null,12,nz)):ut("",!0)],40,ez))),128))]))),128))}},Nk=fn(rz,[["__scopeId","data-v-05eb02fc"]]),oz=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>
|
|
101
|
+
`;It(),mn();var iz={class:"options-grid-wrap"},sz=["innerHTML"],az={class:"option-grid-ctn"},lz={__name:"IconGrid",props:{icons:{type:Array,required:!0},customIcons:{type:Array,required:!1},activeColor:{type:Object,required:!1},hasNoneIcon:{type:Boolean,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=o=>{n("select",o)};return(o,i)=>(me(),ke("div",iz,[e.hasNoneIcon?(me(),ke("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[Me("span",{innerHTML:We(oz),class:"none-icon"},null,8,sz),i[1]||(i[1]=Fi(" None ",-1))])):ut("",!0),Me("div",az,[Wt(Nk,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(me(),ke(qt,{key:0},[i[2]||(i[2]=Me("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),Wt(Nk,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):ut("",!0)])]))}},cz=fn(lz,[["__scopeId","data-v-52b0283a"]]);const P0=(e,t=null)=>{if(typeof t?.focus=="function"){t.focus();return}const n=e?.superdoc?.focus??e?.activeEditor?.focus;if(typeof n=="function"){n.call(e?.superdoc??e?.activeEditor,{preventScroll:!0});return}const r=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');r instanceof HTMLElement&&r.focus({preventScroll:!0})};It();var uz=e=>{e.expand.value=!1};const Vt=(e,t=null)=>({label:t,icon:Zn.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),O0=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),uz(t),P0(e)};return Dr("div",{},[Dr(cz,{icons:dz,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},dz=[[Vt("#111111","black"),Vt("#333333","dark gray"),Vt("#5C5C5C","medium gray"),Vt("#858585","light gray"),Vt("#ADADAD","very light gray"),Vt("#D6D6D6","transparent gray"),Vt("#FFFFFF","white")],[Vt("#860028","dark red"),Vt("#D2003F","red"),Vt("#DB3365","coral red"),Vt("#E4668C","light red"),Vt("#ED99B2","pale pink"),Vt("#F6CCD9","transparent pink"),Vt("#FF004D","bright pink")],[Vt("#83015E","dark purple"),Vt("#CD0194","purple"),Vt("#D734A9","orchid"),Vt("#E167BF","light purple"),Vt("#EB99D4","lavender"),Vt("#F5CCEA","transparent pink"),Vt("#FF00A8","neon pink")],[Vt("#8E220A","maroon"),Vt("#DD340F","red-orange"),Vt("#E45C3F","burnt orange"),Vt("#EB856F","peach"),Vt("#F1AE9F","pale peach"),Vt("#F8D6CF","transparent peach"),Vt("#FF7A00","orange")],[Vt("#947D02","olive"),Vt("#E7C302","mustard yellow"),Vt("#ECCF35","yellow"),Vt("#F1DB67","light yellow"),Vt("#F5E79A","very pale yellow"),Vt("#FAF3CC","transparent yellow"),Vt("#FAFF09","neon yellow")],[Vt("#055432","forest green"),Vt("#07834F","green"),Vt("#399C72","medium green"),Vt("#6AB595","light green"),Vt("#9CCDB9","mint"),Vt("#CDE6DC","transparent mint"),Vt("#05F38F","bright teal")],[Vt("#063E7E","navy blue"),Vt("#0A60C5","blue"),Vt("#3B80D1","sky blue"),Vt("#6CA0DC","cornflower blue"),Vt("#9DBFE8","light blue"),Vt("#CEDFF3","very light blue"),Vt("#21c8ce","cyan")],[Vt("#3E027A","deep purple"),Vt("#6103BF","indigo"),Vt("#8136CC","violet"),Vt("#A068D9","lavender pink"),Vt("#C09AE6","light lilac"),Vt("#DFCDF2","transparent lilac"),Vt("#A91DFF","neon purple")]];It(),mn();var fz=["data-cols","data-rows","onKeydown","onClick"],hz=["aria-valuetext"],qp=5,pz={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=ne(0),o=ne(0),{isHighContrastMode:i}=Hi(),s=ne([]),a=d=>{let h=d.target;h.dataset.grid||l([...h.parentElement.querySelectorAll("[data-item]")],parseInt(h.dataset.cols,10),parseInt(h.dataset.rows,10))},l=(d,h,m)=>{o.value=h,r.value=m;for(let p=0;p<d.length;p++){let g=d[p],k=parseInt(g.dataset.cols,10),w=parseInt(g.dataset.rows,10);k<=h&&w<=m?g.classList.add("sd-selected"):g.classList.remove("sd-selected")}},u=({cols:d,rows:h})=>{n("select",{cols:d,rows:h})},c=(d,h,m)=>{let p=h-1,g=m-1;switch(d.key){case"ArrowRight":{if(p>=4)return;const k=g*qp;s.value[k+p+1].setAttribute("tabindex","0"),s.value[k+p+1].focus(),l(s.value,h+1,m);break}case"ArrowLeft":{if(p<=0)return;const k=g*qp;s.value[k+p-1].setAttribute("tabindex","0"),s.value[k+p-1].focus(),l(s.value,h-1,m);break}case"ArrowDown":{if(g>=4)return;const k=(g+1)*qp;s.value[k+p].setAttribute("tabindex","0"),s.value[k+p].focus(),l(s.value,h,m+1);break}case"ArrowUp":{if(g<=0)return;const k=(g-1)*qp;s.value[k+p].setAttribute("tabindex","0"),s.value[k+p].focus(),l(s.value,h,m-1);break}case"Enter":u({cols:h,rows:m});break;default:break}};return Rn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(d,h)=>(me(),ke("div",{class:en(["toolbar-table-grid-wrapper",{"high-contrast":We(i)}])},[Me("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(me(),ke(qt,null,nr(5,m=>(me(),ke(qt,{key:m},[(me(),ke(qt,null,nr(5,p=>Me("div",{class:"toolbar-table-grid__item",key:`${m}_${p}`,"data-cols":p,"data-rows":m,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:Jt(g=>c(g,p,m),["prevent"]),onClick:Jt(g=>u({cols:p,rows:m}),["stop","prevent"])},null,40,fz)),64))],64))),64))],32),Me("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Nt(r.value)+" x "+Nt(o.value),9,hz)],2))}},mz=fn(pz,[["__scopeId","data-v-b87d6ca2"]]);It(),mn();var gz={class:"toolbar-table-actions"},vz=["onClick","data-item","ariaLabel"],yz={class:"toolbar-table-actions__icon"},bz=["innerHTML"],wz={class:"toolbar-table-actions__label"},Cz={__name:"TableActions",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=o=>{n("select",{command:o.command})};return(o,i)=>(me(),ke("div",gz,[(me(!0),ke(qt,null,nr(e.options,s=>(me(),ke("div",{class:en(["toolbar-table-actions__item",{"toolbar-table-actions__item--border":s.bottomBorder}]),onClick:a=>r(s),"data-item":s.props?.["data-item"]||"",ariaLabel:s.props?.ariaLabel,role:"menuitem"},[Me("div",yz,[Me("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,bz)]),Me("div",wz,Nt(s.label),1)],10,vz))),256))]))}},_z=fn(Cz,[["__scopeId","data-v-0cdad084"]]),Sz=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
|
|
102
|
+
`;It();var ps=e=>{e.expand.value=!1};function F0(e,t){const n={...e??{}};return t?n.href=t:delete n.href,n}function zk(e){const t=Array.isArray(e?.segments)?e.segments:[];if(e?.kind!=="text"||!t.length)return null;const n=t[0],r=t[t.length-1];if(!n?.blockId||!r?.blockId||!n.range||!r.range)return null;const o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start??0,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end??0,...o?{story:o}:{}},...o?{story:o}:{}}}function kz(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function Hk(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function Az(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function Iz(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}const Ez=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1}={})=>{const l=wn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),u=(r??bN).map(IN),c=wn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:u,onActivate:({fontFamily:Ke}={},kt=!1)=>{if(kt){c.label.value="",c.selectedValue.value="";return}if(!Ke)return;Ke=Ke.split(",")[0],c.label.value=Ke;const Ut=u.find(Ot=>Ot.label===c.defaultLabel.value),Ft=u.find(Ot=>Ot.label===Ke);Ft?c.selectedValue.value=Ft.key:Ut?c.selectedValue.value=Ut.key:c.selectedValue.value=""},onDeactivate:()=>{c.label.value=c.defaultLabel.value;const Ke=u.find(kt=>kt.label===c.defaultLabel.value);Ke?c.selectedValue.value=Ke.key:c.selectedValue.value=""}}),d=wn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>h(d)}]});function h(Ke){const kt=Hk(e),Ut=kt?.selectionTarget??zk(kt?.target),Ft=kt?.empty?"":kz(kt),Ot=Iz(e),hn=()=>ps(Ke),yn=()=>{const De=e.pendingSelectionCapture;De&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(De)};return Dr("div",{},[Dr($N,{handleClose:hn,selectedText:Ft,target:Ut,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Ot?.apiKey||e.config?.aiApiKey||"",endpoint:Ot?.endpoint||e.config?.aiEndpoint||"",restoreSelection:yn})])}const m=CN,p=wn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:m,onActivate:({fontSize:Ke},kt=!1)=>{if(kt){p.label.value="",p.selectedValue.value="";return}const Ut=m.find(yn=>yn.label===String(p.defaultLabel.value));if(!Ke){p.label.value=p.defaultLabel.value,Ut?p.selectedValue.value=Ut.key:p.selectedValue.value="";return}let Ft=cB(Ke,12);Ft<8&&(Ft=8),Ft>96&&(Ft=96);let Ot=String(Ft);const hn=m.find(yn=>yn.label===Ot||yn.key===Ot);hn?p.selectedValue.value=hn.key:p.selectedValue.value="",p.label.value=Ot},onDeactivate:()=>{p.label.value=p.defaultLabel.value;const Ke=m.find(kt=>kt.label===String(p.defaultLabel.value));Ke?p.selectedValue.value=Ke.key:p.selectedValue.value=""}}),g=wn({type:"separator",name:"separator",isNarrow:!0}),k=wn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),w=wn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),S=wn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),y=wn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>O0(e,y,[],!0)}],onActivate:({color:Ke})=>{y.iconColor.value=Ke||""},onDeactivate:()=>y.iconColor.value=""}),C=wn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>O0(e,C)}],onActivate:({color:Ke})=>{C.iconColor.value=Ke},onDeactivate:()=>C.iconColor.value="#000"}),T=wn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),R=wn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>M(R)}],onActivate:({href:Ke})=>{R.attributes.value=F0(R.attributes.value,Ke)},onDeactivate:()=>{R.attributes.value=F0(R.attributes.value,null),R.expand.value=!1}});function M(Ke){const kt=Hk(e),Ut=kt?.selectionTarget??zk(kt?.target),Ft=()=>{const Ot=e.pendingSelectionCapture;Ot&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Ot)};return Dr("div",{},[Dr(uS,{ui:e.ui,linkItem:Ke,textTarget:Ut,restoreSelection:Ft,closePopover:()=>ps(Ke),goToAnchor:()=>{ps(Ke);const Ot=Ke.attributes.value?.href;if(!Ot)return;const hn=Ot.slice(1),yn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${hn}']`);yn&&$d(yn)}})])}const H=wn({type:"options",name:"linkInput",command:"toggleLink",active:!1});R.childItem=H,H.parentItem=R;const B=wn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),z=wn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),X=wn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>P(X)}]});function P(Ke){return Dr("div",{},[Dr(mz,{onSelect:Ut=>{e.emitCommand({item:Ke,argument:Ut}),ps(Ke),P0(e)}})])}const N=wn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>L(N)}]}),I=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function L(Ke){return Dr(_z,{options:I,onSelect:kt=>{ps(Ke);const{command:Ut}=kt;e.emitCommand({item:Ke,argument:{command:Ut}})}})}const Y=wn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>Dr("div",{},[Dr(TN,{onSelect:kt=>{ps(Y);const Ut={...Y,command:"setTextAlign"};Ut.command="setTextAlign",e.emitCommand({item:Ut,argument:kt}),te(Y,kt)}})]),key:"alignment"}],onActivate:({textAlign:Ke})=>{te(Y,Ke)},onDeactivate:()=>{te(Y,"left")}}),te=(Ke,kt)=>{let Ut=kt==="both"?"justify":kt,Ft={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Ot=Ft[Ut]??Ft.left;Ke.icon.value=Ot},le=wn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const Ke=kt=>{ps(le);const Ut={...le,command:"toggleBulletListStyle"};e.emitCommand({item:Ut,argument:kt})};return Dr(Bk,{buttons:LN,iconSize:25,selectedStyle:le.selectedValue.value,onSelect:Ke})}}]}),fe=wn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const Ke=kt=>{ps(fe);const Ut={...fe,command:"toggleOrderedListStyle"};e.emitCommand({item:Ut,argument:kt})};return Dr(Bk,{buttons:DN,iconSize:30,selectedStyle:fe.selectedValue.value,onSelect:Ke})}}]}),Ne=wn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),he=wn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),ge=wn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),ae=wn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:Ke})=>{Ke&&(ae.label.value=Ke)}}),_e=wn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:Ke})=>{Ke&&(_e.label.value=Ke)}}),oe=wn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Te=wn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),Ge=wn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),Je=wn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),_t=wn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),be=wn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),Ve=(Ke,kt)=>Ke==="editor"?kt:Ke==="suggester"?kt.filter(Ut=>Ut.value==="suggesting"):kt.filter(Ut=>Ut.value==="viewing"),Le=Ke=>Ke==="editor"?"Editing":Ke==="suggester"?"Suggesting":"Viewing",J=wn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:Le(s),label:Le(s),hasCaret:s==="editor",isWide:!0,style:{display:"flex",justifyContent:"flex-end"},inlineTextInputVisible:!1,hasInlineTextInput:!1,group:"right",disabled:s!=="editor",attributes:{dropdownPosition:"right",className:"sd-toolbar-item--doc-mode",ariaLabel:"Document mode"},options:[{type:"render",render:()=>$(J)}]}),_=[{label:n.documentEditingMode,value:"editing",icon:t.documentEditingMode,description:n.documentEditingModeDescription},{label:n.documentSuggestingMode,value:"suggesting",icon:t.documentSuggestingMode,description:n.documentSuggestingModeDescription},{label:n.documentViewingMode,value:"viewing",icon:t.documentViewingMode,description:n.documentViewingModeDescription}];function $(Ke){return Dr(UN,{options:Ve(s,_),onSelect:kt=>{const Ut=e.superdoc?.activeEditor??e.activeEditor;ps(Ke);const{label:Ft,icon:Ot,value:hn}=kt;J.label.value=Ft,J.icon.value=Ot,e.emitCommand({item:J,argument:hn}),P0(e,Ut)}})}const F=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),j=["search","ruler","undo","overflow","documentMode"],V=wn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),G=wn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Z=wn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const Ke=Ut=>{ps(Z);const Ft=typeof Ut=="string"?Ut:Ut?.id??null;if(!Ft)return;const Ot={...Z,command:"setLinkedStyle"};e.emitCommand({item:Ot,argument:Ft})},kt=e.getActiveLinkedStyleId?.()??null;return Dr("div",{},[Dr(WN,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Ke,selectedOption:kt})])}}],onActivate:({styleId:Ke,styleName:kt})=>{const Ut=kt||Ke;Z.label.value=Ke&&Ke!=="Normal"?String(Ut):n.formatText,Z.disabled.value=!1},onDeactivate:()=>{Z.disabled.value=!0,Z.label.value=n.formatText}}),W=(Ke,kt)=>{if(kt.value==Ke)return Dr("div",{innerHTML:Sz,class:"dropdown-select-icon"})},K=wn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(Ke=>({label:Ke.toFixed(2),key:Ke,icon:()=>W(Ke,K.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),ue=20,we=32,Ce=j.reduce((Ke,kt)=>Ke+(F.get(kt)||F.get("default")),0),xe=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ot=["zoom","fontFamily","fontSize","redo"],tt=i<=_f.lg,Ct=e.config?.showFormattingMarksButton===!0,Kt=e.config?.showTableOfContentsButton===!0;tt&&(J.attributes.value={...J.attributes.value,className:`${J.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),tt&&(Z.attributes.value={...Z.attributes.value,className:`${Z.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let pt=[oe,Te,Ge,Je,T,ae,c,g,p,g,l,k,w,S,C,y,g,R,B,...Kt?[z]:[],X,N,g,Y,le,fe,Ne,he,K,g,Z,g,V,_e,...Ct?[G]:[],be,_t,...Az(e)?[d]:[],ge,J];if(i<=_f.md&&o&&(pt=pt.filter(Ke=>Ke.type!=="separator")),e.config.mode!=="docx"){const Ke=pt.findIndex(Ut=>Ut.name.value==="linkedStyles");pt.splice(Ke-1,2);const kt=["ruler","zoom","undo","redo"];pt=pt.filter(Ut=>!kt.includes(Ut.name.value))}const Mt=[];a||(s==="viewer"&&Mt.push(Ge,Je),pt=pt.filter(Ke=>!Mt.includes(Ke)));const zt=Ke=>j.includes(Ke.name.value),ln=[],$n=[];let Ht=we+Ce;return pt.forEach(Ke=>{const kt=F.get(Ke.name.value)||F.get("default");if(i<_f.xl+ue&&xe.includes(Ke.name.value)&&o){if(ln.push(Ke),Ke.name.value==="linkedStyles"){const Ut=pt.findIndex(Ft=>Ft.name.value==="linkedStyles");pt.splice(Ut+1,1)}return}if(i<_f.sm&&ot.includes(Ke.name.value)&&o){ln.push(Ke);return}if(zt(Ke)){$n.push(Ke),Ht+=kt;return}Ht<i||!o?($n.push(Ke),Ht+=kt):ln.push(Ke)}),{defaultItems:$n,overflowItems:ln.filter(Ke=>Ke.type!=="separator")}},Uk={bold:"Bold",fontFamily:"Font family",ai:"AI text generation",fontSize:"Font size",italic:"Italic",underline:"Underline",highlight:"Highlight color",strikethrough:"Strikethrough",color:"Text color",search:"Search",link:"Link",image:"Image",tableOfContents:"Table of contents",table:"Insert table",tableActions:"Table options",addRowBefore:"Insert row above",addRowAfter:"Insert row below",addColumnBefore:"Insert column left",addColumnAfter:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",removeBorders:"Remove borders",mergeCells:"Merge cells",splitCell:"Split cell",fixTables:"Fix tables",textAlign:"Alignment",bulletList:"Bullet list",numberedList:"Numbered list",indentLeft:"Left indent",indentRight:"Right indent",directionLtr:"Left-to-right",directionRtl:"Right-to-left",zoom:"Zoom",measurementUnit:"Measurement unit",undo:"Undo",redo:"Redo",trackChanges:"Track Changes",trackChangesAccept:"Accept changes under selection",trackChangesReject:"Reject changes under selection",trackChangesOriginal:"Toggle Show Original",trackChangesFinal:"Toggle Show Final",clearFormatting:"Clear formatting",copyFormat:"Format painter",lineHeight:"Line height",formatText:"Format text",ruler:"Show or hide ruler",formattingMarks:"Show or hide formatting marks",pageBreak:"Insert page break",documentEditingMode:"Editing",documentSuggestingMode:"Suggesting",documentViewingMode:"Viewing",documentEditingModeDescription:"Edit document directly",documentSuggestingModeDescription:"Edits become suggestions",documentViewingModeDescription:"View clean version of document only",linkedStyles:"Linked styles"},xz=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;It();function Vk(e){return tB(e)??D0[e]??null}function Yp(e,t,n,r={}){if(!e?.commands||!t||typeof e.commands.has=="function"&&!e.commands.has(t))return!1;const o=typeof e.commands.executeAsync=="function"?e.commands.executeAsync:e.commands.execute;if(typeof o!="function")return!1;const i=n===void 0?o.call(e.commands,t):o.call(e.commands,t,n);return i&&typeof i.then=="function"&&Promise.resolve(i).then(()=>r.onSettled?.(),s=>{r.onError?.(s),r.onSettled?.()}),!0}var Tz=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),Rz=new Set(["list","numberedlist"]);function Mz(e,t){if(e==="fontFamily"||e==="fontSize"||Rz.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!Tz.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function jk(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function Lz(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var Dz=class extends Rm.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...Zn},texts:{...Uk},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1};toolbarItems=[];overflowItems=[];#t=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...Zn,...e.icons},this.config.texts={...Uk,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=xz(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#e(),this.#u(),this.#l(),this.#s(),this._lastFontOptionsSignature=this.#o(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Bl(AN),this.app.directive("click-outside",Dv),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#e(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#D():this.#k()}))}#i(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#k();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#s(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#m()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#a(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#u(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#d(e){return e||wN(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#l(){const e=this.getAvailableWidth(),t=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,{defaultItems:n,overflowItems:r}=Ez({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#d(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev}),o=this.config.customButtons||[],i=o.map(l=>this.#f(l));o.length&&n.push(...i);let s=[...n.map(l=>l.name.value),...r.map(l=>l.name.value)];if(t){const l=Object.values(this.config.groups).flatMap(d=>d),u=new Set(Object.keys(this.config.groups)),c=i.filter(d=>u.has(d.group?.value||"center")).map(d=>d.name.value);s=[...new Set([...l,...c])]}const a=n.filter(l=>s.includes(l.name.value)).filter(l=>!this.config.excludeItems.includes(l.name.value));if(t)for(const[l,u]of Object.entries(this.config.groups))for(const c of a)u.includes(c.name.value)&&(c.group.value=l);this.toolbarItems=a,this.overflowItems=r.filter(l=>s.includes(l.name.value))}#f(e){const t=wn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};return n({...i,item:t,argument:s.argument,option:s.option})}});this._customCommandRegs.set(r,o)}}return t}#m(){this.#l(),this.emit("toolbar-items-changed")}#o(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#r().find(t=>t.name.value===e)}#r(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.ui?.styles?.getQuickGallery?.()??[]}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#m()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#l(),this.updateToolbarState()};#p(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#y(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#w(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#_(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>O0(this,e,[],!0)};e.nestedOptions.value=[t]}#S(e){return!!e?.active&&e?.value==null}#E(e){return!!e&&e.disabled===!1&&e.value==null}#x(e){const t=e.name.value;if(t==="tableActions"){const i=Fk.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(!1),!0;if(M0(t)?.disposition==="host-routed")return e.setDisabled(!this.#y(t)),this.#p(t)?e.activate():e.deactivate(),!0;const n=Vk(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];Mz(t,r)?e.setDisabled(!1):e.setDisabled(!!r?.disabled);const o={textAlign:()=>{r?.value?e.activate({textAlign:r.value}):e.deactivate()},lineHeight:()=>{e.selectedValue.value=r?.value!=null?r.value:""},zoom:()=>{if(r?.value!=null){const i=typeof r.value=="number"?`${r.value}%`:String(r.value);e.onActivate({zoom:i})}},measurementUnit:()=>{r?.value!=null&&e.onActivate({measurementUnit:String(r.value)})},documentMode:()=>{this.#w()},link:()=>{e.active.value=!!r?.active,e.attributes.value=F0(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#E(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#S(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#w(),this.#_();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#M(),this.#r().forEach(n=>{n.allowWithoutEditor?.value&&this.#x(n)})):this.#r().forEach(n=>{n.resetDisabled(),this.#x(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#M(){this.#r().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#c(e,t){const n=this.superdoc;if(e==="ruler")return typeof n?.toggleRuler=="function"?(n.toggleRuler(),!0):!1;if(e==="formattingMarks"){if(typeof t=="boolean"&&typeof n?.setShowFormattingMarks=="function")return n.setShowFormattingMarks(t),!0;if(typeof n?.toggleFormattingMarks=="function")return n.toggleFormattingMarks(),!0}return!1}#L(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#g(i,n)};if(n==="image"&&t==null)return this.#T();if(n==="tableActions"){const i=Ok[t?.command];return i?Yp(this.ui,i,void 0,r):!1}if(M0(n)?.disposition==="unsupported")return!0;const o=Vk(n);return o?Yp(this.ui,o,t,r):!1}#T(){return this.snapshot?.commands?.image?.disabled||(this.#t||(this.#t=lB({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await sB(e,this.superdoc?.config?.handleImageUpload);Yp(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#g(n,"image")})},onError:e=>this.#g(e,"image")})),this.#t.open()),!0}#D(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{jk(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!jk(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}Lz(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#k(){this.#n&&(this.#n(),this.#n=null)}#g(e,t){const n=e instanceof Error?e:new Error(String(e));this.emit("exception",{error:n,originalError:e,itemName:t??null,editor:this.superdoc?.activeEditor??this.activeEditor??null})}emitCommand({item:e,argument:t,option:n}){const r=e?.name?.value,{command:o}=e,i=t!=null;if(!(e?.type==="dropdown"&&!i&&(o==="setFontFamily"||o==="setFontSize"))){if(r==="search"){this.superdoc?.emit?.("search:open");return}try{if(M0(r)?.disposition==="host-routed"){this.#c(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;this._customCommandRegs.has(s)&&this.ui?.commands?.execute?this.ui.commands.execute(s,{argument:t,option:n}):o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc}),this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Yp(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#g(s,r)}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#L(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#g(s,r)}}}destroy(){this.#k(),this.#t?.destroy(),this.#t=null,this.#a(),this.#i(),this.app?.unmount(),this.app=null,this.toolbar=null}};function Pz(e){return new Dz(e)}function Oz(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function Fz(e){if(!e||typeof e!="object")return{};const t={};e.fonts&&(t.rFonts={ascii:e.fonts.ascii,hAnsi:e.fonts.hAnsi,eastAsia:e.fonts.eastAsia,cs:e.fonts.cs,asciiTheme:e.fonts.asciiTheme,hAnsiTheme:e.fonts.hAnsiTheme,eastAsiaTheme:e.fonts.eastAsiaTheme,csTheme:e.fonts.csTheme,hint:e.fonts.hint}),e.fontFamily!=null&&(t.fontFamily=e.fontFamily),e.lang&&(t.lang={val:e.lang.val,eastAsia:e.lang.eastAsia,bidi:e.lang.bidi}),e.fontSize!=null&&(t.fontSize=e.fontSize),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs);const n=Xp(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=Nz(e.shading);r&&(t.shading=r),e.cs!=null&&(t.cs=e.cs),e.rtl!=null&&(t.rtl=e.rtl),e.bold!=null&&(t.bold=e.bold),e.boldCs!=null&&(t.bCs=e.boldCs),e.italic!=null&&(t.italic=e.italic),e.italicCs!=null&&(t.iCs=e.italicCs);const o=Bz(e.underline);o!==void 0&&(t.underline=o),e.strikethrough!=null&&(t.strike=e.strikethrough),e.doubleStrikethrough!=null&&(t.dstrike=e.doubleStrikethrough),e.caps!=null&&(t.caps=e.caps),e.smallCaps!=null&&(t.smallCaps=e.smallCaps),e.outline!=null&&(t.outline=e.outline),e.shadow!=null&&(t.shadow=e.shadow),e.emboss!=null&&(t.emboss=e.emboss),e.imprint!=null&&(t.imprint=e.imprint),e.verticalAlign!=null&&(t.vertAlign=e.verticalAlign),e.characterSpacing!=null&&(t.letterSpacing=e.characterSpacing),e.characterScale!=null&&(t.charScale=e.characterScale),e.kern!=null&&(t.kerning=e.kern),e.baselineShift!=null&&(t.position=e.baselineShift),e.fitTextWidth!=null&&(t.fitText={val:e.fitTextWidth}),e.vanish!=null&&(t.vanish=e.vanish),e.webHidden!=null&&(t.webHidden=e.webHidden),e.specVanish!=null&&(t.specVanish=e.specVanish);const i=zz(e.border);return i&&(t.border=i),t}function Xp(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function Bz(e){if(e==null)return;const t={};return e.style!=null&&(t.style=e.style),e.color?.model==="rgb"&&(t.color=e.color.value),e.color?.model==="theme"&&(t.themeColor=e.color.theme),Object.keys(t).length>0?t:!0}function Nz(e){if(!e)return;const t={},n=Xp(e.fill);n!=null&&(t.fill=n);const r=Xp(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function zz(e){if(!e)return;const t={};e.style!=null&&(t.val=e.style),e.width!=null&&(t.sz=e.width),e.space!=null&&(t.space=e.space);const n=Xp(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function Ql(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}function Gk(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Hz(e){const t=[],n=o=>{o&&!t.includes(o)&&t.push(o)};n(e.getAttribute("data-track-change-preferred-target-id"));const r=e.getAttribute("data-track-change-ids");if(r)for(const o of Gk(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function Wk(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=Hz(s),l=a.length>0?s.getAttribute("data-story-key"):null;for(const m of a){const p=`trackedChange:${m}`;if(!r.has(p)){r.add(p);const g={type:"trackedChange",id:m};l&&(g.storyKey=l),n.push(g),o.push(g)}}const u=s.getAttribute("data-layout-story");if(u&&o.length>0){for(const m of o)m.story=u;o=[]}const c=s.getAttribute("data-comment-ids");if(c)for(const m of Gk(c)){const p=`comment:${m}`;r.has(p)||(r.add(p),n.push({type:"comment",id:m}))}const d=s.getAttribute("data-sdt-type"),h=s.getAttribute("data-sdt-id");if(h&&d==="structuredContent"){const m=`contentControl:${h}`;if(!r.has(m)){r.add(m);const p=s.getAttribute("data-sdt-scope"),g=s.getAttribute("data-sdt-tag"),k={type:"contentControl",id:h};(p==="block"||p==="inline")&&(k.scope=p),g&&(k.tag=g),n.push(k)}}if(t&&i===t)break;i=i.parentElement}return n}const B0={PAGE:"superdoc-page",FRAGMENT:"superdoc-fragment",LINE:"superdoc-line",INLINE_SDT_WRAPPER:"superdoc-structured-content-inline",INLINE_SDT_LABEL:"superdoc-structured-content-inline__label",BLOCK_SDT:"superdoc-structured-content-block",BLOCK_SDT_LABEL:"superdoc-structured-content__label",TABLE_FRAGMENT:"superdoc-table-fragment",DOCUMENT_SECTION:"superdoc-document-section",SDT_GROUP_HOVER:"sdt-group-hover",TOC_ENTRY:"superdoc-toc-entry",TOC_GROUP_HOVER:"toc-group-hover",IMAGE_FRAGMENT:"superdoc-image-fragment",INLINE_IMAGE:"superdoc-inline-image",LIST_MARKER:"superdoc-list-marker",INLINE_IMAGE_CLIP_WRAPPER:"superdoc-inline-image-clip-wrapper",ANNOTATION:"annotation",ANNOTATION_CONTENT:"annotation-content",ANNOTATION_CARET_ANCHOR:"annotation-caret-anchor"},Sj=[B0.INLINE_SDT_LABEL,B0.BLOCK_SDT_LABEL],Kk={PM_START:"data-pm-start",PM_END:"data-pm-end",LAYOUT_EPOCH:"data-layout-epoch",TABLE_BOUNDARIES:"data-table-boundaries",SDT_ID:"data-sdt-id",SDT_TYPE:"data-sdt-type",FIELD_ID:"data-field-id",FIELD_TYPE:"data-field-type",DRAGGABLE:"data-draggable",DISPLAY_LABEL:"data-display-label",VARIANT:"data-variant",TYPE:"data-type",LAYOUT_BOUNDARY_SCHEMA:"data-layout-boundary-schema",LAYOUT_FRAGMENT_ID:"data-layout-fragment-id",LAYOUT_STORY:"data-layout-story",LAYOUT_BLOCK_REF:"data-layout-block-ref"},Uz=e=>{if(!e)return{kind:"unknown"};if(e==="body")return{kind:"body"};const t=e.indexOf(":"),n=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);switch(n){case"body":case"header":case"footer":case"footnote":case"endnote":case"textbox":return r?{kind:n,id:r}:{kind:n};default:return{kind:"unknown"}}},kj=`.${B0.BLOCK_SDT}[${Kk.SDT_ID}]`,Aj=`[${Kk.DRAGGABLE}="true"]`;var io=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Za=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),du=()=>({oneOf:[{type:"number"},{type:"null"}]}),fu=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),Vz={type:"object",properties:{style:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},themeColor:{oneOf:[{type:"string",minLength:1},{type:"null"}]}},additionalProperties:!1,minProperties:1},jz={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},Gz=()=>({oneOf:[{type:"boolean"},{type:"null"},Vz]}),Wz=()=>({oneOf:[{type:"array",items:jz,minItems:1},{type:"null"}]});function Qp(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function Kz(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var N0=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:Qp(n),schema:io()}),Zl=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:Qp("textStyle",o??e),schema:r}),Ln=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:Kz(o??e),schema:r});const Zp=[N0("bold","w:b","bold"),N0("italic","w:i","italic"),N0("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:Qp("underline"),schema:Gz()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:Qp("highlight"),schema:Za()},Zl("color","string","w:color",Za()),Zl("fontSize","number","w:sz",du()),Zl("fontFamily","string","w:rFonts",Za()),Zl("letterSpacing","number","w:spacing",du()),Zl("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Zl("position","number","w:position",du()),Ln("dstrike","boolean","w:dstrike",io()),Ln("smallCaps","boolean","w:smallCaps",io()),Zl("caps","boolean","w:caps",io(),"textTransform"),Ln("shading","object","w:shd",fu({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Ln("border","object","w:bdr",fu({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},sz:{oneOf:[{type:"number"},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},space:{oneOf:[{type:"number"},{type:"null"}]}}),"borders"),Ln("outline","boolean","w:outline",io()),Ln("shadow","boolean","w:shadow",io()),Ln("emboss","boolean","w:emboss",io()),Ln("imprint","boolean","w:imprint",io()),Ln("charScale","number","w:w",du(),"w"),Ln("kerning","number","w:kern",du(),"kern"),Ln("vanish","boolean","w:vanish",io()),Ln("webHidden","boolean","w:webHidden",io()),Ln("specVanish","boolean","w:specVanish",io()),Ln("rtl","boolean","w:rtl",io()),Ln("cs","boolean","w:cs",io()),Ln("bCs","boolean","w:bCs",io(),"boldCs"),Ln("iCs","boolean","w:iCs",io(),"italicCs"),Ln("eastAsianLayout","object","w:eastAsianLayout",fu({id:{oneOf:[{type:"string",minLength:1},{type:"null"}]},combine:{oneOf:[{type:"boolean"},{type:"null"}]},combineBrackets:{oneOf:[{type:"string",minLength:1},{type:"null"}]},vert:{oneOf:[{type:"boolean"},{type:"null"}]},vertCompress:{oneOf:[{type:"boolean"},{type:"null"}]}})),Ln("em","string","w:em",Za()),Ln("fitText","object","w:fitText",fu({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Ln("snapToGrid","boolean","w:snapToGrid",io()),Ln("lang","object","w:lang",fu({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Ln("oMath","boolean","w:oMath",io()),Ln("rStyle","string","w:rStyle",Za(),"styleId"),Ln("rFonts","object","w:rFonts",fu({ascii:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsi:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},cs:{oneOf:[{type:"string",minLength:1},{type:"null"}]},asciiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsiaTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},csTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hint:{oneOf:[{type:"string",minLength:1},{type:"null"}]}}),"fontFamily"),Ln("fontSizeCs","number","w:szCs",du()),Ln("ligatures","string","w14:ligatures",Za()),Ln("numForm","string","w14:numForm",Za()),Ln("numSpacing","string","w14:numSpacing",Za()),Ln("stylisticSets","array","w14:stylisticSets",Wz()),Ln("contextualAlternates","boolean","w14:cntxtAlts",io())],Ij=new Set(Zp.map(e=>e.key)),qz=Object.fromEntries(Zp.map(e=>[e.key,e])),Ej={mark:Zp.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Zp.filter(e=>e.storage==="runAttribute").map(e=>e.key)};var Yz=new Set(Object.values(at));function z0(e,t){return typeof e=="string"&&Yz.has(e)?e:t}function qk(e){if(e&&typeof e=="object"&&e.ok===!1){const t=e.reason;return t==="host-not-ready"||t==="host-disposed"||t==="editing-mount-required"?{ok:!1,reason:at.notReady}:{ok:!1,reason:z0(t,at.targetUnresolved)}}return{ok:!0}}var Xz=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],Qz={[kk.bulletList]:"bullet",[kk.numberedList]:"ordered"};function Yk(e){return Qz[e]??null}var Zz={disc:"disc",circle:"circle",square:"square",decimal:"decimal","decimal-paren":"decimalParenthesis","upper-roman":"upperRoman","lower-roman":"lowerRoman","upper-alpha":"upperLetter","upper-alpha-paren":"upperLetterParenthesis","lower-alpha":"lowerLetter","lower-alpha-paren":"lowerLetterParenthesis"};function Jz(e){const t=Zz[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var $z={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""};const eH=[{key:"contentControls",match:"exact",note:"full-document SDT catalog parse (the measured during-load cliff)"},{key:"contentControls:inRange:",match:"prefix",note:"same adapter load() as the catalog, issued per settled selection"},{key:"hyperlinks:",match:"prefix",note:"per-block hyperlink list over the loading story"},{key:"styles:catalog:",match:"prefix",note:"WordStyleModel recompile from package bytes"},{key:"comments",match:"exact",note:"audited: full comments list; stale-served during load"},{key:"trackChanges",match:"exact",note:"audited: body tracked-changes list; stale-served during load"},{key:"trackChanges:all",match:"exact",note:"audited: all-story tracked-changes list; consumers already fail closed on non-ready"},{key:"tables",match:"exact",note:"reserved: full tables catalog"},{key:"sections",match:"exact",note:"reserved: full sections list"}];var tH=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function nH(e){return eH.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var Xk={ready:0,stale:1,pending:2};function hu(...e){let t="ready";for(const n of e)Xk[n]>Xk[t]&&(t=n);return t}function Tt(e,t){if(typeof e!="function")return t;try{const n=e();return n===void 0?t:n}catch{return t}}function Or(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function gr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function ar(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function Sf(e,t){return{success:!1,failure:{code:"PARTIAL_LINK_EDIT",message:"Hyperlink target was updated, but display text replacement failed."},applied:{href:!0,text:!1},hyperlinkResult:e,textResult:t}}function H0(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function xo(e){if(!e||typeof e!="object")return"story:body";const t=e,n=typeof t.storyType=="string"?t.storyType:"body";switch(n){case"body":return"story:body";case"headerFooterPart":return`story:headerFooterPart:${typeof t.refId=="string"?t.refId:""}`;case"headerFooterSlot":return JSON.stringify({storyType:n,section:t.section??null,headerFooterKind:t.headerFooterKind??null,variant:t.variant??null,resolution:t.resolution??"effective",onWrite:t.onWrite??"materializeIfInherited"});case"footnote":return`story:footnote:${typeof t.noteId=="string"?t.noteId:""}`;case"endnote":return`story:endnote:${typeof t.noteId=="string"?t.noteId:""}`;case"textbox":return`story:textbox:${typeof t.textboxId=="string"?t.textboxId:""}`;default:return JSON.stringify(t)}}function Jp(e){if(!e||typeof e!="object")return null;const t=e,n=t.address&&typeof t.address=="object"?t.address:null;if(n?.story&&typeof n.story=="object")return n.story;if(t.storyLocator&&typeof t.storyLocator=="object")return t.storyLocator;if(t.trackedChangeStory&&typeof t.trackedChangeStory=="object")return t.trackedChangeStory;const r=H0(e);if(!r||typeof r!="object")return null;const o=r;if(o.story&&typeof o.story=="object")return o.story;const i=o.address&&typeof o.address=="object"?o.address:null;return i?.story&&typeof i.story=="object"?i.story:null}function Ja(e,t,n){return Hn(e)!==t?!1:n?xo(Jp(e))===xo(n):!0}function Qk(e){const t=Jp(e);if(!(!t||xo(t)===xo(null)))return t}function rH(e){if(typeof e!="string"||e.length===0)return;const t=Uz(e);switch(t.kind){case"body":return;case"footnote":return t.id?{kind:"story",storyType:"footnote",noteId:t.id}:void 0;case"endnote":return t.id?{kind:"story",storyType:"endnote",noteId:t.id}:void 0;case"header":case"footer":return t.id?{kind:"story",storyType:"headerFooterPart",refId:t.id}:void 0;default:return}}function oH(e){if(!(typeof e!="string"||e.length===0||e==="body")){if(e.startsWith("hf:part:")){const t=e.slice(8);return t?{kind:"story",storyType:"headerFooterPart",refId:t}:void 0}if(e.startsWith("fn:")){const t=e.slice(3);return t?{kind:"story",storyType:"footnote",noteId:t}:void 0}if(e.startsWith("en:")){const t=e.slice(3);return t?{kind:"story",storyType:"endnote",noteId:t}:void 0}}}function U0(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function $p(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function iH(e){if(!e||typeof e!="object")return null;const t=e;if(t.kind!=="selection")return e;const n=t.start;return!n||typeof n!="object"?null:{...t,end:n}}function Hn(e){if(!e||typeof e!="object")return null;const t=e,n=t.id??t.commentId??t.changeId;return typeof n=="string"&&n.length>0?n:null}function sH(e){if(!e||typeof e!="object")return null;const t=e,n=t.anchor,r=t.focus,o=n?.visualCaret,i=r?.visualCaret,s=o?.trackChangeId,a=i?.trackChangeId;return typeof s=="string"&&s.length>0&&s===a?s:null}var Zk=new WeakMap;function aH(e){const t=[],n=i=>{typeof i=="string"&&i.length>0&&!t.includes(i)&&t.push(i)},r=i=>{if(!i||typeof i!="object")return;const s=i,a=s.sourceIds;if(a&&typeof a=="object"&&(n(a.wordIdInsert),n(a.wordIdDelete),Array.isArray(a.wordIdOther)))for(const d of a.wordIdOther)n(d);const l=s.wordRevisionIds;l&&typeof l=="object"&&(n(l.insert),n(l.delete),n(l.format));const u=s.replacement;if(u&&typeof u=="object")for(const d of[u.inserted,u.deleted])d&&typeof d=="object"&&(n(d.id),n(d.wordId));const c=s.move;if(c&&typeof c=="object")for(const d of[c.source,c.destination])d&&typeof d=="object"&&(n(d.id),n(d.wordId))};r(e);const o=e?.change;return o&&o!==e&&r(o),t}function em(e){const t=Zk.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=Hn(i);if(s){n.add(s);for(const a of aH(i)){r.has(a)||r.set(a,s);const l=`imported:${a}`;r.has(l)||r.set(l,s)}}}const o={toPublicId(i){if(n.has(i))return i;const s=r.get(i);return s!=null&&n.has(s)?s:null},aliasesFor(i){const s=[i];for(const[a,l]of r)l===i&&!s.includes(a)&&s.push(a);return s}};return Zk.set(e,o),o}var Jk=new WeakMap;function $k(e,t){const n=xo(t);let r=Jk.get(e);r||(r=new Map,Jk.set(e,r));const o=r.get(n);if(o)return o;const i=em(e.filter(s=>xo(Jp(s))===n));return r.set(n,i),i}function lH(e,t){const n=e.find(r=>Hn(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??Hn(n)??t:null}function cH(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,u=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:u??l}}const n=e.target,r=n&&Array.isArray(n.segments)?n.segments:[],o=r[0]?.blockId,i=r[r.length-1]?.blockId;return typeof o=="string"?{startBlockId:o,endBlockId:typeof i=="string"?i:o}:null}function Rr(e){const t=[],n=s=>{typeof s=="string"&&s.length>0&&!t.includes(s)&&t.push(s)},r=e.target,o=r&&Array.isArray(r.segments)?r.segments:[];for(const s of o)n(s?.blockId);const i=e.selectionTarget;return i&&(n(i.start?.blockId),n(i.end?.blockId)),t}var uH=64;function Jl(e){return e.length<=uH}function na(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:{kind:"story",storyType:"body"}}function mo(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function ra(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function eA(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var tA=720;function ms(e){return Math.round(e*20)}function pu(e){return typeof e=="number"&&Number.isFinite(e)}function dH(e){if(!e||typeof e!="object")return null;const t=e.node;if(!t||typeof t!="object")return null;const n=t.kind==="heading"?t.heading??null:t.kind==="paragraph"?t.paragraph??null:null;if(!n)return null;const r=n.resolved,o=n.props,i=r?.indent??o?.indent;if(!i||typeof i!="object")return null;const s=pu(i.left)?ms(i.left):pu(i.start)?ms(i.start):void 0,a=pu(i.right)?ms(i.right):pu(i.end)?ms(i.end):void 0,l=pu(i.firstLine)?ms(i.firstLine):void 0,u=pu(i.hanging)?ms(i.hanging):void 0;return s==null&&a==null&&l==null&&u==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...u!=null?{hanging:u}:{}}}function V0(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=t?.story,o=[];for(const i of n){if(!i||typeof i.blockId!="string")continue;const s=i.range;!s||typeof s.start!="number"||typeof s.end!="number"||s.start===s.end||o.push({kind:"text",blockId:i.blockId,range:{start:s.start,end:s.end},...r?{story:r}:{}})}return o}function fH(e){if(!e||typeof e!="object")return[];const t=e,n=t.story,r=[];if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const o=t.range;return typeof o.start=="number"&&typeof o.end=="number"&&o.start!==o.end&&r.push({kind:"text",blockId:t.blockId,range:{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)},...n?{story:n}:{}}),r}if(t.kind==="text"&&Array.isArray(t.segments)){for(const o of t.segments){const i=o?.range;typeof o?.blockId=="string"&&typeof i?.start=="number"&&typeof i?.end=="number"&&i.start!==i.end&&r.push({kind:"text",blockId:o.blockId,range:{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)},...n?{story:n}:{}})}return r}if(t.kind==="selection"){const o=t.start,i=t.end,s=typeof o?.blockId=="string"&&i?.blockId===o.blockId?o.blockId:null;o?.kind==="text"&&i?.kind==="text"&&s&&typeof o.offset=="number"&&typeof i.offset=="number"&&o.offset!==i.offset&&r.push({kind:"text",blockId:s,range:{start:Math.min(o.offset,i.offset),end:Math.max(o.offset,i.offset)},...t.story??o.story?{story:t.story??o.story}:{}})}return r}function kf(e){if(!e||typeof e!="object")return null;const t=e,n=t.story;if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const r=t.range;if(typeof r.start=="number"&&typeof r.end=="number"&&r.start===r.end)return{kind:"text",blockId:t.blockId,range:{start:r.start,end:r.end},...n?{story:n}:{}}}if(t.kind==="text"&&Array.isArray(t.segments)){const r=t.segments[0],o=r?.range;if(typeof r?.blockId=="string"&&typeof o?.start=="number"&&typeof o?.end=="number"&&o.start===o.end)return{kind:"text",blockId:r.blockId,range:{start:o.start,end:o.end},...n?{story:n}:{}}}if(t.kind==="selection"){const r=t.start,o=t.end,i=typeof r?.blockId=="string"&&o?.blockId===r.blockId?r.blockId:null;if(r?.kind==="text"&&o?.kind==="text"&&i&&typeof r.offset=="number"&&typeof o.offset=="number"&&r.offset===o.offset)return{kind:"text",blockId:i,range:{start:r.offset,end:r.offset},...t.story??r.story?{story:t.story??r.story}:{}}}return null}function $a(e){return kf(e.target)??kf(e.selectionTarget)}var nA=["fontFamily","fontSize","color","highlight"],hH={undo:"history.undo",redo:"history.redo"},Af=["bold","italic","underline","strikethrough"];function j0(e){return nA.includes(e)}function mu(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,u,c)=>{typeof l!="string"||typeof u!="number"||typeof c!="number"||r.push({blockId:l,start:Math.min(u,c),end:Math.max(u,c)})};for(const l of n){const u=l?.range;o(l?.blockId,u?.start,u?.end)}if(r.length>0)return r;const i=e.selectionTarget,s=i?.start,a=i?.end;return!s||!a||s.blockId!==a.blockId||o(s.blockId,s.offset,a.offset),r}function oa(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:void 0}function pH(e){const t=oa(e);if(!t||typeof t!="object")return"body";const n=t;return JSON.stringify({storyType:typeof n.storyType=="string"?n.storyType:"body",refId:typeof n.refId=="string"?n.refId:null,noteId:typeof n.noteId=="string"?n.noteId:null,textboxId:typeof n.textboxId=="string"?n.textboxId:null})}function ia(e){const t=mu(e);return t.length===0?null:[pH(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function rA(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:Ql({selectionTarget:t})}function mH(e,t){if(e==="fontSize"){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)&&r>0?String(r):null}if(typeof t!="string")return null;const n=t.trim();return n.length===0?null:e==="color"||e==="highlight"?n.toUpperCase():n}function gH(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function vH(e){if(!e)return[];const t=Array.isArray(e.blocks)?e.blocks:[],n=[];for(const r of t){const o=r?.range,i=r?.blockId;typeof i!="string"||typeof o?.start!="number"||typeof o?.end!="number"||n.push({blockId:i,start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)})}return n}function yH(e,t){return e.length!==t.length?!1:e.every((n,r)=>{const o=t[r];return o?.blockId===n.blockId&&o?.start===n.start&&o?.end===n.end})}function oA(e,t){const n=mu(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>yH(n,vH(i)));if(o)return o;if(n.length===1){const i=r.find(s=>{const a=s?.address;return a?.kind==="block"&&a.nodeId===n[0].blockId});if(i)return i}return r[0]??null}function bH(e,t){const n=t==="fontSize"?e?.fontSizePt??e?.fontSize:t==="highlight"?e?.highlight??e?.backgroundColor:e?.[t];if(typeof n=="number")return Number.isFinite(n)?String(n):void 0;if(typeof n!="string")return;const r=n.trim();if(r.length!==0)return t==="color"||t==="highlight"?r.toUpperCase():r}function G0(e){if(typeof e!="string")return;const t=e.split(",")[0]?.trim().replace(/^['"]+|['"]+$/g,"").trim();if(!t)return;const n=t.toLowerCase();if(!(n==="serif"||n==="sans-serif"||n==="monospace"||n==="cursive"||n==="fantasy"))return t}function wH(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return;const t=Math.round(e*.75*2)/2;if(!(t<=0))return String(t)}function CH(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function iA(e,t){if(!e)return{};const n=new Map;for(const i of mu(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of nA){const s=new Map;let a=!1,l=!1;for(const u of r){const c=typeof u?.blockId=="string"?u.blockId:null;if(!c)continue;const d=n.get(c);if(!d?.length)continue;const h=Array.isArray(u?.runs)?u.runs:[];for(const m of h){const p=m?.range,g=typeof p?.start=="number"?p.start:null,k=typeof p?.end=="number"?p.end:null;if(g==null||k==null||!d.some(y=>gH(y,{start:g,end:k})))continue;a=!0;const w=bH(m?.styles,i);if(w===void 0){l=!0;continue}const S=CH(i,w);if(s.has(S)||s.set(S,w),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function W0(e,t){const n=Rr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:mo(n)}:{kind:"documentEnd"}}function tn(e,t){const n=e.supported??t!=="unsupported",r=e.enabled??(e.disabled!==void 0?!e.disabled:n);return{enabled:r,disabled:!r,active:e.active??!1,supported:n,value:e.value,source:t,reason:r?void 0:e.reason}}function $l(e){if(!e||typeof e!="object")return null;const t=e,n=t.change,r=n&&typeof n=="object"?n:t;return{...t,id:t.id??r.id,change:r}}function tm(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function el(e){if(Or(e))return!0;if(e===!1)return!1;if(e===!0||e==null||typeof e!="object")return!0;const t=e;return"success"in t||"failure"in t||"effects"in t?e:t.status!=="rejected"}function nm(e){return!!e&&typeof e=="object"&&e.success===!0}function No(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function gu(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function K0(e){const t=[],n=r=>{if(!r||typeof r!="object")return;const o=r;if(Array.isArray(o.runs)&&t.push(o),Array.isArray(o.rows))for(const i of o.rows){const s=i?.cells;if(Array.isArray(s))for(const a of s){const l=a;if(Array.isArray(l?.blocks))for(const u of l.blocks)n(u);l?.paragraph&&n(l.paragraph)}}};if(Array.isArray(e))for(const r of e)n(r);return t}function ec(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function fi(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!No(i)&&n===null&&(n=i),nm(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function _H(e){const t=e?.anchor,n=t?.start,r=t?.end;return typeof n?.blockId!="string"||typeof r?.blockId!="string"||n.blockId!==r.blockId||typeof n.offset!="number"||typeof r.offset!="number"?null:{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.offset},end:{kind:"text",blockId:r.blockId,offset:r.offset}}}function SH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function rm(e){return uu(e)?.trackDecision??null}function kH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function tl(e){return{found:!1,success:!1,rects:[],reason:e}}function AH(e,t){if(!t||typeof t.getBoundingClientRect!="function"||e.rects.length===0)return e;let n;try{const o=t.getBoundingClientRect();n={left:o.left,top:o.top}}catch{return e}const r=e.rects.map(o=>({...o,left:o.left-n.left,right:o.right-n.left,top:o.top-n.top,bottom:o.bottom-n.top}));return{...e,rects:r,rect:r[0]}}function IH(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.blockId!="string"||!t.range||typeof t.range!="object")return!1;const n=t.range;return Number.isInteger(n.start)&&Number.isInteger(n.end)&&n.start>=0&&n.start<=n.end}function sA(e){if(!e||e.kind!=="text"||!Array.isArray(e.segments)||e.segments.length===0)return null;const t=Array.from(e.segments);if(!t.every(IH))return null;const n=t[0],r=t[t.length-1],o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end,...o?{story:o}:{}},...o?{story:o}:{}}}function EH(e){return e.selectionTarget?e.selectionTarget:sA(e.target)}function vu(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=sA(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function q0(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var Y0={bold:null,italic:null,underline:null,strike:null,color:null,highlight:null,fontFamily:null,fontSize:null,vertAlign:null,smallCaps:null,caps:null,letterSpacing:null,dstrike:null},xH=Object.fromEntries(Object.entries(Y0).filter(([e])=>qz[e]?.tracked===!0));function TH(e,t,n,r){switch(e.kind){case"toggle":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return typeof o=="boolean"||o===null?{target:t,value:o}:{target:t,value:!r}}case"value-string":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return o===null?{target:t,value:null}:typeof o!="string"||o.trim()===""?null:{target:t,value:o}}case"value-number":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n,i=typeof o=="number"?o:Number(o);return!Number.isFinite(i)||i<=0?null:{target:t,value:i}}case"clear":return{target:t,inline:{...Y0}};default:return null}}function RH(e){const t=o=>{if(!o||typeof o!="object")return null;const i=o,s=i.rowIndex,a=i.columnIndex;return typeof s!="number"||!Number.isInteger(s)||typeof a!="number"||!Number.isInteger(a)?null:{rowIndex:s,columnIndex:a}};if(!e)return null;const n=t(e.start),r=t(e.end);return!n||!r?null:{start:n,end:r}}function MH(e,t){const{tableNodeId:n,rowIndex:r,columnIndex:o,cellNodeId:i,mergeRange:s}=t;switch(e){case"insert-row-before":return{nodeId:n,rowIndex:r,position:"above"};case"insert-row-after":return{nodeId:n,rowIndex:r,position:"below"};case"delete-row":return{nodeId:n,rowIndex:r};case"insert-column-before":return{nodeId:n,columnIndex:o,position:"left"};case"insert-column-after":return{nodeId:n,columnIndex:o,position:"right"};case"delete-column":return{nodeId:n,columnIndex:o};case"delete-table":return{nodeId:n};case"merge-cells":{const a=s??{start:{rowIndex:r,columnIndex:o},end:{rowIndex:r,columnIndex:o}};return{nodeId:n,start:a.start,end:a.end}}case"split-cell":return i?{nodeId:i,rows:1,columns:2}:null;case"remove-borders":return{nodeId:n,mode:"applyTo",applyTo:"all",border:null};default:return null}}function LH(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,u=!1,c=Promise.resolve(),d=null,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},m=0;const p=new Set;let g={},k="",w=null;const S=()=>{const f=t?.activeEditor;return f&&typeof f=="object"?f:null},y=()=>{const f=S()?.doc;return f&&typeof f=="object"?f:null},C=()=>{const f=S()?.v2TrackedChanges;return f&&typeof f=="object"?f:null},T=()=>{const f=S()?.host;return f&&typeof f=="object"?f:null},R=f=>{if(f.storyType!=="headerFooterPart"||typeof f.refId!="string")return null;const v=S(),b=T(),A=v?.pageLayout??b?.pageLayout;if(!A||typeof A!="object")return null;const E=A.getActiveRulerContext,U=b?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof U!="function")return null;const Q=Tt(()=>E.call(A),null);if(!Q||typeof Q.pageIndex!="number")return null;for(const re of["header","footer"]){const ye=Tt(()=>U.call(b,{pageIndex:Q.pageIndex,kind:re}),null);if(!(ye?.status!=="ready"||ye.refId!==f.refId||typeof ye.sectionId!="string"||!["default","first","even"].includes(String(ye.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:ye.sectionId},headerFooterKind:re,variant:ye.slotVariant}}return null},M=()=>{const f=T(),v=f?.getPendingInlineFormat;if(typeof v!="function")return null;const b=Tt(()=>v.call(f),null);return b&&typeof b=="object"?b:null},H=f=>{const v=q0(f);if(!v)return null;const b=M();if(!b||!(v in b))return null;const A=b[v];return f.inline?.kind==="toggle"?A===!0:A!=null&&A!==""},B=f=>{const v=q0(f);if(!v)return;const b=M();if(!b||!(v in b))return;const A=b[v];if(typeof A=="string"&&A!=="")return A;if(typeof A=="number"&&Number.isFinite(A))return String(A)},z=(f,v)=>{const b=T(),A=b?.setPendingInlineFormat;typeof A=="function"&&Tt(()=>A.call(b,f,v),void 0)},X=f=>{const v=T(),b=v?.clearPendingInlineFormat;typeof b=="function"&&Tt(()=>b.call(v,f),void 0)},P=new Set(["bold","italic","underline","strikethrough"]),N=f=>{const v=M();if(!v)return;const b=Array.isArray(f.activeMarks)?f.activeMarks:[];let A=null;for(const E of Object.keys(v)){const U=v[E];let Q;if(P.has(E))Q=b.includes(E)===(U===!0);else if(j0(E)){if(U==null)continue;A||(A=pl(f)),Q=A[E]===U}else Q=!1;Q&&X(E)}},I=()=>{const f=S()?.editCommands;return f&&typeof f=="object"?f:null},L=f=>{const v=I();if(!v||typeof v.getSnapshot!="function")return null;const b=Tt(()=>v.getSnapshot(),null)?.commands?.[f];return b&&typeof b=="object"?b:null},Y=()=>L("lists.apply"),te=f=>{const v=f?.value?.seed;return v==="bullet"||v==="ordered"?v:null},le=f=>{const v=hH[f];return v?L(v):null},fe=()=>{const f=T();if(!f||typeof f.getTableContext!="function")return null;const v=Tt(()=>f.getTableContext(),null);return v&&typeof v=="object"?v:null},Ne=()=>{const f=fe();if(!f||f.inTable!==!0)return null;const v=f.table,b=typeof v?.nodeId=="string"&&v.nodeId.length>0?v.nodeId:null;if(!b)return null;const A=f.row,E=f.column,U=f.cell,Q=typeof A?.index=="number"&&Number.isInteger(A.index)?A.index:null,re=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(Q==null||re==null)return null;const ye=typeof U?.nodeId=="string"&&U.nodeId.length>0?U.nodeId:null,Re=f.cellRange;return{tableNodeId:b,rowIndex:Q,columnIndex:re,cellNodeId:ye,mergeRange:RH(Re)}},he=new Map;let ge=null,ae=null,_e=0,oe=0;const Te=(f,v)=>f===v?!0:!f||!v?!1:f.id===v.id&&f.paintedEntityId===v.paintedEntityId&&xo(f.story)===xo(v.story),Ge=f=>{const v=T();if(typeof v?.getHandles!="function")return;const b=Tt(()=>v.getHandles(),null),A=b?.review;if(A){if(f){if(typeof A.setActiveReviewTarget!="function")return;const E=b?.layout;Tt(()=>A.setActiveReviewTarget({entityType:"trackedChange",entityId:f.id,...f.paintedEntityId?{paintedEntityId:f.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:f.story??{kind:"story",storyType:"body"}}),null);return}typeof A.getActiveReviewTarget!="function"||typeof A.clearActiveReviewTarget!="function"||Tt(()=>A.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Tt(()=>A.clearActiveReviewTarget(),void 0)}},Je=(f,v)=>{ae=f,_e+=1,v?.invalidateQueuedNavigation!==!1&&(oe+=1)},_t=new Set;let be=!1,Ve=null;const Le=new Map,J=new Set;let _=null,$=null,F=!1,j=null,V=0,G=null,Z=null,W=null;const K=()=>{if(F||be)return;F=!0;const f=()=>{F=!1,be||jt()};typeof queueMicrotask=="function"?queueMicrotask(f):Promise.resolve().then(f)},ue=250,we=5e3,Ce=f=>{be||j&&V<=f||(j&&clearTimeout(j),V=f,j=setTimeout(()=>{j=null,V=0,be||jt()},Math.max(0,f-Date.now())))},xe=new WeakMap;let ot=0;const tt=f=>{if(!f)return"none";let v=xe.get(f);return v==null&&(v=ot+=1,xe.set(f,v)),`e${v}`};let Ct=0,Kt={},pt=null,Mt=null,zt=0;const ln=()=>{Mt&&clearTimeout(Mt),Mt=null,zt=0};let $n=f=>{},Ht=null,Ke=new Set,kt=0,Ut=null;const Ft=()=>`${tt(S())}|m${Ct}`,Ot=()=>{Ht=null,Ke=new Set},hn=f=>{for(const v of["trackChanges","trackChanges:all"]){const b=Le.get(v);if(!b?.hasSettled||!Array.isArray(b.value))continue;const A=b.value.filter(E=>{const U=Hn(E);return!U||!f.has(U)});A.length!==b.value.length&&Le.set(v,{...b,value:A})}},yn=f=>{const v=()=>{if(!be)for(const U of[..._t])U(bt)},b=gu(f)?f:null,A=S()?.documentMutationReadiness,E=()=>{const U=globalThis.requestAnimationFrame;return typeof U!="function"?Promise.resolve():new Promise(Q=>{let re=!1;const ye=()=>{re||(re=!0,clearTimeout(Re),Q())},Re=setTimeout(ye,250);U(()=>U(()=>setTimeout(ye,0)))})};if(b?.success===!0&&typeof b.txId=="string"&&b.txId.length>0&&typeof A?.whenPainted=="function")try{Promise.resolve(A.whenPainted.call(A,b)).then(E,()=>{}).then(v,v);return}catch{}v()},De=(f,v)=>{const b=bt.trackChanges,A=b.items.filter(Q=>{const re=Hn(Q);return!re||!f.has(re)});if(A.length===b.items.length)return;ae&&f.has(ae.id)&&Je(null);const E=new Set;for(const Q of A){const re=tm(Q),ye=Q,Re=re.author??re.authorEmail??ye.author??ye.authorEmail;typeof Re=="string"&&E.add(Re)}const U=b.items.length-A.length;bt={...bt,trackChanges:{...b,items:A,total:Math.max(A.length,b.total-U),activeId:b.activeId&&f.has(b.activeId)?null:b.activeId,authors:[...E]}},yn(v)},Oe=(f,v)=>{if(f.size===0)return;const b=Ft(),A=Ht===b?Ke:new Set,E=new Set([...f].filter(U=>!A.has(U)));E.size!==0&&(Ht=b,Ke=new Set([...A,...E]),hn(Ke),De(E,v))},Qe=f=>Ht===f&&Ke.size>0?Ke:null,nt=(f,v=[])=>{const b=f.map($l).filter(E=>E!=null&&Hn(E)!=null);if(b.length===0)return;const A=v.map($l).map(E=>E==null?null:Hn(E)).filter(E=>E!=null);for(const E of["trackChanges","trackChanges:all"]){const U=Le.get(E),Q=U?.hasSettled&&Array.isArray(U.value)?[...U.value]:[],re=new Set;let ye=!1;for(const Re of b){const ze=Hn(Re);if(!ze)continue;const Ye=Q.findIndex(Be=>Hn(Be)===ze);if(Ye<0)Q.push(Re),re.add(ze);else{const Be=Q[Ye];Q[Ye]=gu(Be)?{...Be,...Re}:Re}ye=!0}if(E==="trackChanges"&&re.size>0&&A.length>0){const Re=new Set(A.filter(Be=>re.has(Be))),ze=new Map(Q.filter(Be=>Re.has(Hn(Be)??"")).map(Be=>[Hn(Be),Be])),Ye=Q.filter(Be=>!Re.has(Hn(Be)??""));for(const[Be,Ze]of A.entries()){if(!Re.has(Ze))continue;const He=ze.get(Ze);if(!He)continue;const Ue=A.slice(Be+1).map(rt=>Ye.findIndex($e=>Hn($e)===rt)).find(rt=>rt>=0);if(Ue!=null){Ye.splice(Ue,0,He);continue}const je=A.slice(0,Be).reverse().map(rt=>Ye.findIndex($e=>Hn($e)===rt)).find(rt=>rt>=0);Ye.splice(je==null?Ye.length:je+1,0,He)}Q.splice(0,Q.length,...Ye)}ye&&Le.set(E,{token:U?.token??null,value:Q,hasSettled:!0,inflightToken:null})}},Dt=f=>{const v=Ft(),b=Qe(v),A=f.map($l).filter(E=>{if(E==null)return!1;const U=Hn(E);return U!=null&&!b?.has(U)});for(const E of["trackChanges","trackChanges:all"])Le.set(E,{token:v,value:[...A],hasSettled:!0,inflightToken:null})},Et=async(f,v)=>{try{const b=f.v2TrackedChanges?.listTrackedChanges;if(typeof b=="function"){const U=await Promise.resolve(b.call(f.v2TrackedChanges,{mode:v.trackedChangesListMode,refreshReason:v.refreshReason,blocking:v.blocking,...v.targetIds?.length?{targetIds:v.targetIds}:{}})),Q=v.trackedChangesListMode==="all"&&v.refreshReason==="mutation-history-render-reconcile"?U?.ok===!0:U?.ok!==!1;return{ok:Q,items:Q&&Array.isArray(U?.items)?U.items:[],...typeof U?.complete=="boolean"?{complete:U.complete}:{},...typeof U?.sourceCoverageComplete=="boolean"?{sourceCoverageComplete:U.sourceCoverageComplete}:{}}}const A=f.docTrackChanges?.list;if(typeof A!="function")return{ok:!1,items:[]};const E=await Promise.resolve(A.call(f.docTrackChanges));return{ok:!0,items:Array.isArray(E?.items)?E.items:[]}}catch(b){return{ok:!1,items:[],failures:[b]}}},Yt=w_({getContext:()=>{const f=S();if(!f)return null;const v=C(),b=y()?.trackChanges??null,A=v??b;if(!A)return null;const E=f.documentId??v?.documentId;return{editor:f,adapter:A,documentId:E==null?null:String(E),reconcileToken:Kt,v2TrackedChanges:v,docTrackChanges:b}},reconcile:async(f,v)=>{v.removedIds.size>0&&Oe(new Set(v.removedIds));const b=[...new Set(v.upsertIds)];if(b.length===0)return{ok:!0,items:[],resolvedIds:[],unresolvedIds:[]};const A=Le.get("trackChanges"),E=A?.hasSettled&&Array.isArray(A.value)?A.value:null,U=new Set(E?E.map(Hn).filter(je=>je!=null):[]),Q=E?.length===0&&Vn()==="complete",re=new Set(b.filter(je=>!U.has(je))),ye=f.v2TrackedChanges?.getTrackedChange,Re=f.docTrackChanges?.get;if(typeof ye!="function"&&typeof Re!="function")return{ok:!1,items:[],resolvedIds:[],unresolvedIds:b};const ze=await Promise.all(b.map(async je=>{try{if(typeof ye=="function"){const $e=await Promise.resolve(ye.call(f.v2TrackedChanges,je));return{id:je,ok:$e?.ok!==!1,items:$e?.ok!==!1&&Array.isArray($e?.items)?$e.items:[],result:$e}}const rt=await Promise.resolve(Re.call(f.docTrackChanges,{id:je}));return{id:je,ok:!0,items:rt&&typeof rt=="object"?[rt]:[],result:rt}}catch(rt){return{id:je,ok:!1,items:[],result:rt}}})),Ye=[],Be=[],Ze=[];for(const je of ze){const rt=je.items.filter($e=>{const Bt=$l($e);return Bt!=null&&Hn(Bt)===je.id});je.ok&&rt.length>0?(Ye.push(...rt),Be.push(je.id)):Ze.push(je.id)}let He;const Ue=Be.filter(je=>re.has(je));if(Ue.length>0&&!Q){const je=await Et(f,{trackedChangesListMode:"interaction-prime",refreshReason:"mutation-render-reconcile",blocking:!1,targetIds:Ue});je.ok&&(He=je.items)}return{ok:Ze.length===0,items:Ye,orderedItems:He,resolvedIds:Be,unresolvedIds:Ze,failures:ze.filter(je=>!je.ok).map(je=>je.result)}},hydrate:Et,onReconciled:(f,v,b)=>{if(b?.reconcileMode==="authoritative"){if(f.reconcileToken!==Kt)return;b.ok===!0&&b.complete===!0&&b.sourceCoverageComplete===!0?(ln(),Dt(b.items??[]),pt=null):b.ok===!0?(ln(),nt(b.items??[])):$n(f.reconcileToken),jt();return}nt((b?.items??[]).filter(A=>{const E=$l(A),U=E==null?null:Hn(E);return U!=null&&v.has(U)}),b?.orderedItems??b?.items??[]),jt()}});$n=f=>{if(be||Mt)return;const v=Math.min(ue*2**zt,we);zt+=1,Mt=setTimeout(()=>{Mt=null,!(be||pt===null||f!==Kt)&&Yt.onRender(!0)},v)};const xt=()=>`${Ft()}|m${br()}|s${kt}`,Un=f=>JSON.stringify({t:f.target??null,s:f.selectionTarget??null}),so=["contentControls:inRange:","query:","effInline:"],zo=120,rn=180,Vn=()=>{const f=T(),v=f?.getDocumentLoadingSnapshot;if(typeof v!="function")return"unknown";const b=Tt(()=>v.call(f),null)?.sourceStage;return b==="opening"||b==="ready-window"||b==="source-loading"?"loading":b==="source-complete"||b==="source-failed"||b==="source-cancelled"?"complete":"unknown"},lr=new Map,yr=f=>{const v=Ft();lr.get(f)!==v&&(lr.set(f,v),K())},To=()=>{const f=Le.get("comments");return f?.hasSettled?Array.isArray(f.value)&&f.value.length>0:f?.inflightToken!=null},$t=(f,v)=>lr.get(f)===v,cn=f=>{yr("contentControls")},Fr=()=>{const f=Le.get("trackChanges");f?.hasSettled||f?.inflightToken!=null||yr("trackChanges")},go=6500,nl=8e3,sa=250;let rl=0,gs=0,Ho=!1,$o=0,hi=!1,qr=null;const Ee=()=>{if(be||qr)return;const f=$o||Date.now(),v=()=>{if(qr=null,be)return;const b=Date.now()-rl,A=bn()||b<go;if(A&&Date.now()-f<nl){qr=setTimeout(v,sa);return}Ho=!1,hi=A;try{jt()}finally{hi=!1,$o=0}};qr=setTimeout(v,0)};let Fe=null,ft=null;const lt=()=>{const f=T();if(!f||Fe===f)return;ft&&(ft(),ft=null),Fe=f;const v=f.subscribeDocumentLoading;if(typeof v!="function"){Fe=null,cr(go);return}try{const b=U=>{const Q=U?.sourceStage;(Q==="source-complete"||Q==="source-failed"||Q==="source-cancelled")&&Ee()},A=v.call(f,b);typeof A=="function"&&(ft=A);const E=f.getDocumentLoadingSnapshot;typeof E=="function"&&b(Tt(()=>E.call(f),null))}catch{Fe=null,cr(go)}},Cn=()=>{const f=S()?.host,v=f?.getForegroundMutationState;if(typeof v!="function")return null;const b=Tt(()=>v.call(f),null);return{active:typeof b?.active=="number"?b.active:0,pending:typeof b?.pending=="number"?b.pending:0}},bn=()=>{const f=Cn();return!!(f&&(f.active>0||f.pending>0))},cr=(f=zo)=>{be||G||(G=setTimeout(()=>{if(G=null,be)return;if(Z&&bn()){cr(),jt();return}const v=Z;Z=null,v===xt()&&Ro("selection",v,cl,Ri),jt()},f))},Uo=(f,v)=>{if(!Cn())return!1;const b=`${f}\0${v}`;return J.has(b)?!1:(J.add(b),cr(rn),!0)},pi=f=>{if(_==null||f===_)return $?.timer&&clearTimeout($.timer),$=null,_=f,!1;if($?.key===f)return $.ready?($=null,_=f,!1):!0;$?.timer&&clearTimeout($.timer);const v={key:f,ready:!1,timer:null};return v.timer=setTimeout(()=>{be||$!==v||(v.timer=null,v.ready=!0,jt())},rn),$=v,!0},Ti=f=>C_(f),ol=()=>{Xr(),jt()};let Vo=null,mi=!1,gi=0;const vo=()=>{Vo=null,mi=!1,gi+=1},Yr=()=>{const f=S(),v=f?.documentMutationReadiness;if(!f||typeof v?.whenPainted!="function"||(Vo={editor:f,readiness:v,afterEpoch:typeof v.getRenderEpoch=="function"?Tt(()=>v.getRenderEpoch.call(v),null):null},mi))return;mi=!0;const b=gi;(async()=>{for(;!be&&b===gi;){const E=Vo;if(Vo=null,!E){mi=!1;return}let U=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),U=!0}catch{}if(be||b!==gi)return;if(S()!==E.editor){vo();return}U&&ol()}})()},vi=()=>{W&&clearTimeout(W),W=setTimeout(()=>{W=null,be||ol()},500)},Ro=(f,v,b,A)=>{let E;try{E=b()}catch{E=void 0}if(!Or(E)){const re={token:v,value:A(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return Le.set(f,re),re}const U=Le.get(f),Q=U?.failedToken===v;return Le.set(f,{token:U?.token??null,value:U?.value??null,hasSettled:U?.hasSettled??!1,inflightToken:v,failedToken:Q?v:null,failureCount:Q?U.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(re=>{const ye=Le.get(f);!ye||ye.inflightToken!==v||(Le.set(f,{token:v,value:A(re),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0}),K())},()=>{const re=Le.get(f);if(!re||re.inflightToken!==v)return;const ye=re.failedToken===v?(re.failureCount??0)+1:1,Re=Math.min(we,ue*2**Math.min(ye-1,8)),ze=Date.now()+Re;Le.set(f,{...re,inflightToken:null,failedToken:v,failureCount:ye,retryAtMs:ze}),Ce(ze)}),null},Yn=(f,v,b,A)=>{const E=Le.get(f);if(E&&E.token===v&&E.hasSettled)return{value:E.value,status:"ready"};if(nH(f)&&!$t(f,v)){if(Vn()==="loading")return Ho=!0,lt(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Ho&&!hi)return Ee(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!hi){const Q=Date.now();if(Q-gs<go&&(!$o||Q-$o<nl))return $o||($o=Q),Ho=!0,Ee(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};$o=0}}if(bn())return cr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===v&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return Ce(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&f.startsWith("effInline:")&&pi(f))return{value:null,status:"pending"};if(!E&&Uo(f,v))return{value:null,status:"pending"};if(!E||E.inflightToken!==v){const Q=Ro(f,v,b,A);if(Q)return{value:Q.value,status:"ready"}}const U=Le.get(f);return U?.hasSettled?{value:U.value,status:"stale"}:{value:null,status:"pending"}},il=f=>{for(const v of Le.keys())f(v)&&Le.delete(v)},If=f=>{const v=Un(f),b=rA(f);return new Set([`contentControls:inRange:${v}`,`query:${v}`,...b?[`effInline:${b}`]:[]])},aa=f=>{const v=If(f);il(b=>so.some(A=>b.startsWith(A))&&!v.has(b));for(const b of J){const A=b.split("\0",1)[0];so.some(E=>A.startsWith(E))&&!v.has(A)&&J.delete(b)}},Mo=()=>{const f=S();f!==Ut&&(vo(),Yt.reset(),Kt={},Ut=f,Le.clear(),pt=null,ln(),j&&clearTimeout(j),j=null,V=0,$?.timer&&clearTimeout($.timer),$=null,_=null,w=null,o=null,Z=null,J.clear(),lr.clear(),Ho=!1,$o=0,ft&&ft(),ft=null,Fe=null,Ot())},Xr=()=>{const f=pt!==null;Ct+=1,f&&(pt=Ft()),Ot()},sl=f=>{if(typeof f!="string"||f.length===0)return ar("insertText requires a non-empty string.","INVALID_INPUT");if(br()==="viewing")return ar("The document is read-only.","DOCUMENT_READONLY");const v=y(),b=v?.insert;if(!v||typeof b!="function")return ar("insert is unavailable.");const A=v.selection?.current;if(typeof A!="function")return ar("selection.current is unavailable.");const E=Q=>{const re=Q&&typeof Q=="object"?Q:null,ye=re?.selectionTarget??re?.target??null;return!ye||typeof ye!="object"?ar("insertText requires a live selection target.","PRECONDITION_FAILED"):Tt(()=>ba(b.call(v,{type:"text",value:f,target:ye}),ar("insert failed.")),ar("insert failed."))};let U;try{U=A.call(v.selection)}catch{return ar("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Or(U)?Promise.resolve(U).then(E,()=>ar("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(U)},Ki=(f,v)=>({payload:f,state:bt,editor:S(),superdoc:t,context:v,ui:Ve,execute:(b,A)=>ri(b,A),executeAsync:(b,A)=>fm(b,A),doc:y(),selection:bt.selection,documentMode:br(),insertText:sl}),al=f=>f==="editing"||f==="suggesting"||f==="viewing"?f:null,br=()=>{const f=S(),v=t&&typeof t=="object"?t:null,b=al(v?.config?.documentMode),A=al(Tt(typeof v?.getActiveRuntime=="function"?()=>{const U=v.getActiveRuntime();return typeof U?.getSnapshot=="function"?U.getSnapshot():null}:void 0,null)?.documentMode),E=al(f?.options?.documentMode);return b&&A&&b!==A?b:A??b??E},yi=()=>{const f=t&&typeof t=="object"?t:null,v=f?.interactionConfig?.comments;if(v&&typeof v.readOnly=="boolean")return v.readOnly===!0;const b=f?.config?.modules?.comments;return!!b&&typeof b=="object"&&b.readOnly===!0},yu=()=>{const f=t&&typeof t=="object"?t:null,v=f?.interactionConfig?.comments;if(v&&typeof v.allowResolve=="boolean")return v.allowResolve===!1;const b=f?.config?.modules?.comments;return!!b&&typeof b=="object"&&b.allowResolve===!1},bi=()=>br()==="viewing"||yi(),Ri=f=>f&&typeof f=="object"?f:null,la=(f,v)=>{if(!f)return{...$z,status:v};const b=f.target??null,A=typeof f.text=="string"?f.text:"";return{status:v,empty:f.empty===!0,target:b,selectionTarget:f.selectionTarget??null,activeMarks:Array.isArray(f.activeMarks)?f.activeMarks:[],activeCommentIds:Array.isArray(f.activeCommentIds)?f.activeCommentIds:[],activeChangeIds:Array.isArray(f.activeChangeIds)?f.activeChangeIds:[],quotedText:A}},ll=()=>{const f=y()?.selection;return Yn("selection",xt(),()=>f?.current?f.current({includeText:!0}):void 0,Ri)},bu=()=>{const{value:f,status:v}=ll();return la(f,v)},cl=()=>{const f=y()?.selection;return f?.current?f.current({includeText:!0}):void 0},wu=f=>{if(f.empty!==!0)return!1;const v=f.selectionTarget,b=v?.start,A=v?.end;return b?.kind==="text"&&A?.kind==="text"&&typeof b.blockId=="string"&&b.blockId===A.blockId&&typeof b.offset=="number"&&b.offset===A.offset},Cu=f=>{const v=T(),b=v?.readLiveSelectionSyncSnapshot;if(typeof b!="function")return;const A=Ri(Tt(()=>b.call(v),null));if(!A||!wu(A))return;const E=xt(),U=Cn(),Q=!!(U&&(U.active>0||U.pending>0));if(Q)Z=E,cr();else if(Z=null,Ro("selection",E,cl,Ri))return;const re=Le.get("selection"),ye=Array.isArray(A.activeMarks)&&A.activeMarks.length>0?A.activeMarks:Array.isArray(bt.selection.activeMarks)?bt.selection.activeMarks:[],Re=Array.isArray(A.activeCommentIds)?A.activeCommentIds:[],ze=sH(f),Ye=$a(bt.selection),Be=kf(A.selectionTarget)??kf(A.target),Ze=Ye?.range,He=Be?.range,Ue=!!(U&&U.active>0&&Ye&&Be&&Ye.blockId===Be.blockId&&xo(Ye.story)===xo(Be.story)&&typeof Ze?.start=="number"&&typeof He?.start=="number"&&Math.abs(He.start-Ze.start)<=2),je=ze!=null||Ue?bt.selection.activeChangeIds.filter($e=>ze==null||em(bt.trackChanges.items).aliasesFor($e).includes(ze)):[],rt=Array.isArray(A.activeChangeIds)&&A.activeChangeIds.length>0?A.activeChangeIds:je;Le.set("selection",{token:E,value:{...A,activeMarks:ye,activeCommentIds:Re,activeChangeIds:rt},hasSettled:!0,inflightToken:Q?null:re?.inflightToken??null})},ca=async(f=0)=>{const v=y()?.selection,b=v?.current,A=xt();if(typeof b!="function")return Le.set("selection",{token:A,value:null,hasSettled:!0,inflightToken:null}),jt(),bt.selection;let E;try{E=b.call(v,{includeText:!0}),Or(E)&&(E=await Promise.resolve(E))}catch{E=null}return be?la(null,"pending"):xt()!==A?f<1?ca(f+1):bt.selection:(Le.set("selection",{token:A,value:Ri(E),hasSettled:!0,inflightToken:null}),jt(),bt.selection)},_u=f=>{const v=y()?.comments,{value:b,status:A}=Yn("comments",Ft(),()=>v?.list?v.list():void 0,re=>re&&Array.isArray(re.items)?re.items:[]),E=b??[],U=f.activeCommentIds;ge&&!E.some(re=>Hn(re)===ge)&&(ge=null);const Q=ge??U[0]??null;return{status:hu(A,f.status),listStatus:A,items:E,total:E.length,activeIds:U,activeId:Q}},Lo=()=>{const f=y()?.trackChanges,v=Ft(),b=Le.get("trackChanges:all"),{value:A,status:E}=pt===v?{value:b?.hasSettled?b.value:null,status:b?.hasSettled?"stale":"pending"}:Yn("trackChanges:all",v,()=>f?.list?f.list({in:"all"}):void 0,U=>(U&&Array.isArray(U.items)?U.items:[]).map($l).filter(Q=>Q!=null));return E==="ready"?A:null},ul=f=>{const v=y()?.trackChanges,b=C(),A=typeof b?.listTrackedChanges=="function"?b.listTrackedChanges:null,E=Ft(),U=Qe(E),Q=Le.get("trackChanges"),{value:re,status:ye}=pt===E?{value:Q?.hasSettled?Q.value:null,status:Q?.hasSettled?"stale":"pending"}:Yn("trackChanges",E,()=>A?A.call(b):v?.list?v.list():void 0,Ue=>Ue&&Array.isArray(Ue.items)?Ue.items.filter(je=>!A||xo(Jp(je))==="story:body"):[]),Re=(re??[]).map($l).filter(Ue=>Ue!=null).filter(Ue=>{const je=Hn(Ue);return!je||!U?.has(je)}),ze=new Set;for(const Ue of Re){const je=tm(Ue),rt=Ue,$e=je.author??je.authorEmail??rt.author??rt.authorEmail;typeof $e=="string"&&ze.add($e)}const Ye=v?.list?Lo():null,Be=ae;Be&&(Be.story?Ye&&!Ye.some(Ue=>Ja(Ue,Be.id,Be.story))&&Je(null):Re.some(Ue=>Hn(Ue)===Be.id)||Je(null));const Ze=U?f.activeChangeIds.filter(Ue=>!U.has(Ue)):f.activeChangeIds,He=ae?.id??Ze[0]??null;return{status:hu(ye,f.status),items:Re,total:Re.length,activeId:He,authors:[...ze]}},Ef=f=>{const v=y()?.contentControls,{value:b,status:A}=Yn("contentControls",Ft(),()=>v?.list?v.list():void 0,re=>re&&Array.isArray(re.items)?re.items:[]),E=b??[],{ids:U,status:Q}=dl(v,f);return{status:hu(A,Q,f.status),items:E,total:E.length,activeId:U[0]??null,activeIds:U}},vs=(f,v)=>{if(!f||typeof f.listInRange!="function")return{lockModesById:new Map,status:"ready"};const b=cH(v);if(!b)return{lockModesById:new Map,status:"ready"};const{value:A,status:E}=Yn(`contentControls:inRange:${Un(v)}`,Ft(),()=>f.listInRange(b),re=>re&&Array.isArray(re.items)?re.items:[]),U=A??[],Q=new Map;for(const re of U)typeof re?.id=="string"&&Q.set(re.id,typeof re.lockMode=="string"?re.lockMode:"unlocked");return{lockModesById:Q,status:E}},dl=(f,v)=>{const{lockModesById:b,status:A}=vs(f,v);return{ids:[...b.keys()],status:A}},Do=()=>{const f=t?.fonts;return{options:BH(OH(Tt(f?.getDocumentFontOptions?()=>f.getDocumentFontOptions():void 0,[])),FH(Tt(f?.getFontFamilyOptions?()=>f.getFontFamilyOptions():void 0,[]))),sizeOptions:NH}},qi=()=>{const f=Tt(t?.getZoomState?()=>t.getZoomState():void 0,null),v=typeof f?.value=="number"?f.value:100,b=f?.mode;return{mode:b==="manual"||b==="fit-width"?b:b==="fixed"?"manual":null,value:v,min:typeof f?.min=="number"?f.min:10,max:typeof f?.max=="number"?f.max:100}},Su=()=>Tt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",ku=()=>{const f=S();return{ready:f!=null,mode:br(),dirty:f?!!f.isDirty:!1}},jo=f=>{const v=f.quotedText;if(typeof v!="string"||v.length===0)return null;const b=mu(f);if(b.length===0||!Jl(b.map(U=>U.blockId)))return null;const A=f.target,E=b.length===1?mo(b[0].blockId,A?.story):void 0;return{select:{type:"text",pattern:v,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},ys=f=>{const v=y()?.query;if(typeof v?.match!="function")return null;const b=jo(f);if(!b)return null;const{value:A}=Yn(`query:${Un(f)}`,Ft(),()=>v.match(b),E=>E&&typeof E=="object"?E:null);return oA(A,f)},fl=f=>{const v=T(),b=new Set(Rr(f));if(b.size===0)return{};const A=v?.readMountedProjectionBlocksByIds,E=v?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof E!="function")return{};const U=Tt(()=>{if(typeof A!="function")return E.call(v);const Ue=oa(f);return Ue?A.call(v,[...b],Ue):A.call(v,[...b])},null);if(!Array.isArray(U))return{};const Q=K0(U),re=Ue=>{const je={},rt=G0(Ue.fontFamily);rt&&(je.fontFamily=rt);const $e=wH(Ue.fontSize);return $e&&(je.fontSize=$e),typeof Ue.color=="string"&&Ue.color.trim()!==""&&(je.color=Ue.color.trim().toUpperCase()),typeof Ue.highlight=="string"&&Ue.highlight.trim()!==""&&(je.highlight=Ue.highlight.trim().toUpperCase()),je},ye=$a(f),Re=ye&&typeof ye.range?.start=="number"?ye.range.start:null;if(ye&&Re!==null&&b.has(ye.blockId)){const Ue=Q.find(rt=>ec(rt,ye.blockId)),je=Ue&&Array.isArray(Ue.runs)?Ue.runs:null;if(je&&je.length>0&&je.every(rt=>rt?.kind==="text"||rt?.kind==="tab")){let rt=0,$e=null;for(const Bt of je){const Xt=typeof Bt.text=="string"?Bt.text.length:0;if(Re>=rt&&Re<rt+Xt){$e=Bt;break}rt+=Xt}if(!$e){for(let Bt=je.length-1;Bt>=0&&!$e;Bt-=1)je[Bt]?.kind==="text"&&($e=je[Bt]);$e??=je[je.length-1]??null}return $e?re($e):{}}}const ze=mu(f);if(ze.length>0){const Ue=new Set,je=new Set;let rt=!1,$e=!0;for(const Bt of ze){const Xt=Q.find(Jr=>ec(Jr,Bt.blockId));if(!Xt)return{};const Nn=Array.isArray(Xt.runs)?Xt.runs:[];if(Nn.length===0)continue;if(!Nn.every(Jr=>Jr?.kind==="text"||Jr?.kind==="tab")){$e=!1;break}let Gn=0;for(const Jr of Nn){const Vr=typeof Jr.text=="string"?Jr.text.length:0,Lr=Gn,Ar=Gn+Vr;if(Lr<Bt.end&&Ar>Bt.start){rt=!0;const Wo=re(Jr);Wo.fontFamily&&Ue.add(Wo.fontFamily),Wo.fontSize&&je.add(Wo.fontSize)}Gn=Ar}}if($e&&rt){const Bt={};return Ue.size===1&&(Bt.fontFamily=[...Ue][0]),je.size===1&&(Bt.fontSize=[...je][0]),Bt}}const Ye=new Set,Be=new Set;let Ze=!1;for(const Ue of Q){if(![...b].some(rt=>ec(Ue,rt)))continue;const je=Array.isArray(Ue.runs)?Ue.runs:[];for(const rt of je){if(rt?.kind!=="text")continue;Ze=!0;const $e=re(rt);$e.fontFamily&&Ye.add($e.fontFamily),$e.fontSize&&Be.add($e.fontSize)}}if(!Ze)return{};const He={};return Ye.size===1&&(He.fontFamily=[...Ye][0]),Be.size===1&&(He.fontSize=[...Be][0]),He},tc=f=>{const v=T(),b=new Set(Rr(f));if(b.size===0)return{};const A=v?.readMountedProjectionBlocksByIds,E=v?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof E!="function")return{};const U=Tt(()=>{if(typeof A!="function")return E.call(v);const He=oa(f);return He?A.call(v,[...b],He):A.call(v,[...b])},null);if(!Array.isArray(U))return{};const Q=K0(U),re=He=>({bold:He.bold===!0,italic:He.italic===!0,underline:He.underline!=null,strikethrough:He.strike===!0}),ye=He=>{const Ue={};for(const je of Af){const rt=He[je];rt.size===1&&(Ue[je]=[...rt][0])}return Ue},Re=$a(f),ze=Re&&typeof Re.range?.start=="number"?Re.range.start:null;if(Re&&ze!==null&&b.has(Re.blockId)){const He=Q.find(je=>ec(je,Re.blockId)),Ue=He&&Array.isArray(He.runs)?He.runs:null;if(Ue&&Ue.length>0&&Ue.every(je=>je?.kind==="text"||je?.kind==="tab")){let je=0,rt=null;for(const $e of Ue){const Bt=typeof $e.text=="string"?$e.text.length:0;if(ze>=je&&ze<je+Bt){rt=$e;break}je+=Bt}if(!rt){for(let $e=Ue.length-1;$e>=0&&!rt;$e-=1)Ue[$e]?.kind==="text"&&(rt=Ue[$e]);rt??=Ue[Ue.length-1]??null}return rt?re(rt):{}}}const Ye=mu(f);if(Ye.length>0){const He={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ue=!1,je=!0;for(const rt of Ye){const $e=Q.find(Nn=>ec(Nn,rt.blockId));if(!$e)return{};const Bt=Array.isArray($e.runs)?$e.runs:[];if(Bt.length===0)continue;if(!Bt.every(Nn=>Nn?.kind==="text"||Nn?.kind==="tab")){je=!1;break}let Xt=0;for(const Nn of Bt){const Gn=typeof Nn.text=="string"?Nn.text.length:0,Jr=Xt,Vr=Xt+Gn;if(Jr<rt.end&&Vr>rt.start){Ue=!0;const Lr=re(Nn);for(const Ar of Af)He[Ar].add(Lr[Ar])}Xt=Vr}}if(je&&Ue)return ye(He)}const Be={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ze=!1;for(const He of Q){if(![...b].some(je=>ec(He,je)))continue;const Ue=Array.isArray(He.runs)?He.runs:[];for(const je of Ue){if(je?.kind!=="text")continue;Ze=!0;const rt=re(je);for(const $e of Af)Be[$e].add(rt[$e])}}return Ze?ye(Be):{}},ua=(f,v)=>{if(v.fontFamily!==void 0&&v.fontSize!==void 0&&v.color!==void 0&&v.highlight!==void 0)return{values:v,effectiveUniformityStatus:"ready"};const b=fl(f),A={...b.fontFamily!==void 0?{fontFamily:b.fontFamily}:{},...b.fontSize!==void 0?{fontSize:b.fontSize}:{},...b.color!==void 0?{color:b.color}:{},...b.highlight!==void 0?{highlight:b.highlight}:{},...v};if(!f.empty&&(A.fontFamily===void 0||A.fontSize===void 0)){const E=Au(f);return E.values&&(A.fontFamily===void 0&&E.values.fontFamily!==void 0&&(A.fontFamily=E.values.fontFamily),A.fontSize===void 0&&E.values.fontSize!==void 0&&(A.fontSize=E.values.fontSize)),{values:A,effectiveUniformityStatus:E.status}}return{values:A,effectiveUniformityStatus:"ready"}},Yi=["fontFamily","fontSize","bold","italic","underline","strikethrough"],hl=f=>{const v=f.selectionTarget;if(!v)return{value:null,status:"ready"};const b=gr(y(),"format.readEffectiveInlineUniformity");return b?Yn(`effInline:${rA(f)??Un(f)}`,Ft(),()=>b({target:v,offsetSpace:"selection",keys:Yi}),A=>A&&typeof A=="object"?A:null):{value:null,status:"ready"}},Au=f=>{const{value:v,status:b}=hl(f);if(!v||v.success!==!0)return{values:null,status:b};const A=v.values,E=U=>{const Q=A?.[U];if(!(!Q||Q.state!=="uniform"||typeof Q.value!="string"))return U==="fontFamily"?G0(Q.value):Q.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:b}},nc=f=>{const{value:v,status:b}=hl(f);if(!v||v.success!==!0)return{values:null,status:b};const A=v.values,E={};for(const U of Af){const Q=A?.[U];Q?.state==="uniform"&&(Q.value==="true"||Q.value==="false")&&(E[U]=Q.value==="true")}return{values:E,status:b}},xf=(f,v)=>{const b=f.activeMark;if(!b||!Af.includes(b))return null;const A=b,E=tc(v)[A];if(E!==void 0)return E;const{values:U}=nc(v),Q=U?.[A];return Q!==void 0?Q:null},Tf=async f=>{const v=f.selectionTarget;if(!v)return null;const b=gr(y(),"format.readEffectiveInlineUniformity");if(!b)return null;try{const A=await Promise.resolve(b({target:v,offsetSpace:"selection"}));return A&&typeof A=="object"&&A.success===!0?A:null}catch{return null}},rc=(f,v,b)=>{const A=b.values;for(const E of["fontFamily","fontSize"]){if(v[E]!==void 0)continue;const U=A?.[E];U?.state==="uniform"&&typeof U.value=="string"?f[E]=E==="fontFamily"?G0(U.value):U.value:delete f[E]}},bs=f=>ua(f,iA(ys(f),f)),pl=f=>bs(f).values,Iu=async f=>{const v=y()?.query,b=jo(f);if(typeof v?.match!="function"||!b)return pl(f);try{const A=await Promise.resolve(v.match(b)),E=iA(oA(A&&typeof A=="object"?A:null,f),f),U=ua(f,E);if(U.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const Q=await Tf(f);Q&&rc(U.values,E,Q)}return U.values}catch{return pl(f)}},da=async f=>{const v=y();if(v)return typeof v.getNode=="function"?await Promise.resolve(v.getNode(f)):await Promise.resolve(v.getNodeById?.({nodeId:f.nodeId,nodeType:f.nodeType}))},ml=f=>{const v=y()?.query;if(typeof v?.match!="function")return"ready";const b=jo(f);if(!b)return"ready";const{status:A}=Yn(`query:${Un(f)}`,Ft(),()=>v.match(b),E=>E&&typeof E=="object"?E:null);return A},Eu=f=>{const v=bs(f),b=v.values;if(f.empty)return v;const A=ia(f);return A?f.status==="ready"&&ml(f)==="ready"&&v.effectiveUniformityStatus==="ready"?(w={key:A,values:b},v):w&&w.key===A?{...v,values:{...w.values,...b}}:v:v},oc=f=>{const v=y(),b=Eu(f),A=b.values;f.status==="ready"&&!f.empty&&ml(f)==="ready"&&b.effectiveUniformityStatus==="ready"&&(g=A,k=`${Ql(f)}:${Ft()}`);const E=v?.contentControls,{lockModesById:U}=vs(E,f),Q={};for(const re of it())Q[re]=Ru(re,v,f,A,U);return Q},Mi=f=>f?at.operationUnavailable:S()?at.documentApiUnavailable:at.notReady,xu=f=>f==="contentLocked"||f==="sdtContentLocked",Xi=f=>{for(const v of f.values())if(xu(v))return at.contentControlLocked},Rf=(f,v,b,A,E)=>{if(!v)return f.scope==="all"?at.bulkDecisionsDisabled:Mi(E);if(b)return at.documentReadonly;if(f.scope!=="all"&&A.activeChangeIds.length===0)return at.selectionRequired},Tu=f=>{const v=T(),b=Tt(typeof v?.getCapabilities=="function"?()=>v.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(b))return b.find(A=>A?.command===f||A?.id===f)??null;if(b&&typeof b=="object"){const A=b[f];return A&&typeof A=="object"?A:null}return null},ic=(f,v)=>{if(f.scope!=="all"||typeof v?.[`${f.kind}All`]=="function")return;const b=Tu(`trackedChanges.${f.kind}All`);if(!(b&&(b.status==="supported"||b.enabled===!0)))return at.bulkDecisionsDisabled},Ru=(f,v,b,A,E=new Map)=>{if(he.has(f))return tn({supported:!0,enabled:!0,...Tt(he.get(f).getState?()=>he.get(f).getState(Ki(void 0)):void 0,{})},"custom");const U=br()==="viewing",Q=Yk(f);if(Q&&typeof I()?.lists?.apply=="function"){const Ze=Y(),He=typeof Ze?.shippedStatus=="string"?Ze.shippedStatus:null,Ue=He!=="not-shipped"&&He!=="disabled";return tn({enabled:Ue&&(typeof Ze?.enabled=="boolean"?Ze.enabled:!0),active:(Ue?te(Ze):null)===Q,supported:Ue,value:Ze?.value},"builtin")}const re=rm(f);if(re){const Ze=v?.trackChanges,He=typeof Ze?.decide=="function"||typeof Ze?.[re.kind]=="function",Ue=typeof Ze?.decide=="function"||typeof Ze?.[`${re.kind}All`]=="function",je=re.scope==="all"?Ue:He,rt=ic(re,Ze)??Rf(re,je,bi(),b,v);return tn({enabled:rt==null,active:!1,supported:je,reason:rt},"builtin")}if(f==="copy-format")return br()==="viewing"?tn({supported:!0,enabled:!1,active:!1},"builtin"):S()?tn({supported:!0,enabled:!0,active:h.mode!=="idle"},"builtin"):tn({supported:!0,enabled:!1,active:!1,reason:at.notReady},"builtin");const ye=uu(f);if(!ye)return tn({enabled:!1,active:!1,supported:!1,reason:at.commandUnsupported},"unsupported");if(ye.disposition!=="routed")return tn({enabled:!1,active:!1,supported:!1,reason:ye.reason??at.commandUnsupported},ye.disposition==="unsupported"?"unsupported":"builtin");if(ye.instanceRoute)return Xe(ye);if(ye.table)return st(ye,v,U);if(ye.inline?.kind==="clear"){if(ye.mutates&&U)return tn({enabled:!1,active:!1,supported:!0,reason:at.documentReadonly},"builtin");const Ze=Xi(E);if(Ze)return tn({enabled:!1,active:!1,supported:!0,reason:Ze},"builtin");const He=Rr(b).length>0||vu(b)!=null;return tn({enabled:He,active:!1,supported:!0,reason:He?void 0:at.selectionRequired},"builtin")}const Re=ye.docRoute;if(!Re)return tn({enabled:!1,active:!1,supported:!1,reason:at.commandUnsupported},"unsupported");if(gr(v,Re)==null)return tn({enabled:!1,active:!1,supported:!1,reason:Mi(v)},"builtin");const ze=le(f);if(ze){const Ze=ze.shippedStatus,He=Ze!=="not-shipped"&&Ze!=="disabled",Ue=typeof ze.enabled=="boolean"?ze.enabled:!0,je=f==="undo"||f==="redo",rt=je&&ze.historyResolved===!1,$e=je&&He&&Ue===!1&&ze.reason===null&&!rt,Bt=ze.reason===void 0?void 0:$e?at.historyEmpty:rt?at.notReady:z0(ze.reason,at.commandUnsupported);return ye.mutates&&U?tn({enabled:!1,active:!1,supported:He,reason:at.documentReadonly},"builtin"):tn({enabled:He&&Ue,active:!1,supported:He,reason:Bt},"builtin")}const Ye=ha(ye,v,b),Be=Lu(ye,v,b,A);if(ye.list?.mode==="indent"||ye.list?.mode==="outdent")return pe(ye,v,U,b,Ye,Be);if(ye.list?.mode==="toggle-seed")return ve(ye,v,U,b,Ye,Be);if(ye.mutates&&U)return tn({enabled:!1,active:Ye,supported:!0,value:Be,reason:at.documentReadonly},"builtin");if(ye.inline&&!vu(b)){const Ze=Xi(E);return tn(Ze?{enabled:!1,active:Ye,supported:!0,value:Be,reason:Ze}:Rr(b).length>0&&typeof T()?.setPendingInlineFormat=="function"?{enabled:!0,active:Ye,supported:!0,value:Be}:{enabled:!1,active:Ye,supported:!0,value:Be,reason:at.rangeSelectionRequired},"builtin")}if((ye.blockParagraph||ye.list)&&Rr(b).length===0)return tn({enabled:!1,active:Ye,supported:!0,value:Be,reason:at.selectionRequired},"builtin");if(ye.link&&!Ye&&V0(b).length===0&&!$a(b))return tn({enabled:!1,active:Ye,supported:!0,reason:at.rangeSelectionRequired},"builtin");if(ye.inline){const Ze=Xi(E);if(Ze)return tn({enabled:!1,active:Ye,supported:!0,value:Be,reason:Ze},"builtin")}return tn({enabled:!0,active:Ye,supported:!0,value:Be},"builtin")};function Mu(f,v){const b=f.address?.anchor,A=b?.start,E=b?.end,U=typeof A?.blockId=="string"?A.blockId:null,Q=typeof E?.blockId=="string"?E.blockId:null;if(!U||!Q)return!1;const re=typeof A?.offset=="number"?A.offset:null,ye=typeof E?.offset=="number"?E.offset:null;if(re==null||ye==null)return!1;const Re=v.target,ze=Re&&Array.isArray(Re.segments)?Re.segments:[];for(const Ye of ze){const Be=typeof Ye?.blockId=="string"?Ye.blockId:null;if(!Be)continue;const Ze=Ye.range,He=typeof Ze?.start=="number"?Ze.start:null,Ue=typeof Ze?.end=="number"?Ze.end:null;if(!(He==null||Ue==null)){if(U!==Q){if(Be===U&&Ue>re||Be===Q&&He<ye)return!0;continue}if(Be===U){if(He===Ue){if(He>=re&&He<=ye)return!0;continue}if(Math.max(He,re)<Math.min(Ue,ye))return!0}}}return!1}const fa=(f,v)=>{const b=f?.hyperlinks;if(!b||typeof b.list!="function")return null;const A=Rr(v);if(!Jl(A))return null;for(const E of A){const U={kind:"block",nodeType:"paragraph",nodeId:E},{value:Q}=Yn(`hyperlinks:${E}`,Ft(),()=>b.list({within:U}),ye=>ye&&typeof ye=="object"?ye:null),re=(Q&&Array.isArray(Q.items)?Q.items:[]).find(ye=>Mu(ye,v));if(re)return re}return null},ha=(f,v,b)=>{if(f.link)return fa(v,b)!=null;if(f.list?.mode==="toggle-seed"&&f.list.seed)return ei(v,b)===f.list.seed;const A=H(f);if(A!==null)return A;const E=r.get(f.id),U=ia(b);if(U&&E?.selectionSignature===U)return E.active;const Q=xf(f,b);return Q!==null?Q:zH(f,b)},Lu=(f,v,b,A)=>{if(f.inline&&j0(f.inline.key)){const E=B(f);if(E!==void 0)return E;const U=A[f.inline.key];if(U!==void 0)return U;const Q=ia(b),re=Q?n.get(f.inline.key):void 0;if(Q&&re?.selectionSignature===Q)return re.value}if(f.id==="linked-style"){const{style:E}=yo(b,Fn().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(f.id==="text-align")return x(v,b);if(f.id==="link")return qe(v,b)??void 0},gl=(f,v,b)=>{const A=f?.lists;if(!A)return{value:null,status:"ready"};const E=b.storyType==="body",U=typeof A.getStateInStory=="function"?()=>A.getStateInStory({target:ra(v),story:b}):E&&typeof A.getState=="function"?()=>A.getState({target:ra(v)}):null;if(!U)return{value:null,status:"ready"};const{value:Q,status:re}=Yn(`lists:${xo(b)}:${v}`,Ft(),U,ye=>ye&&typeof ye=="object"?ye:null);return{value:Q?.success===!0?Q:null,status:re}},Mf=(f,v,b)=>gl(f,v,b).value,sc=(f,v,b)=>{const A=Mf(f,v,b);return!A||A.isListItem!==!0?null:A.seed==="bullet"||A.seed==="ordered"?A.seed:null},ac=(f,v,b)=>{const A=gl(f,v,b),E=A.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:A.status}},ei=(f,v)=>{const b=Rr(v);if(b.length===0||!Jl(b))return null;const A=na(v),E=sc(f,b[0],A);if(E!=="bullet"&&E!=="ordered")return null;for(const U of b.slice(1))if(sc(f,U,A)!==E)return null;return E},Qi=(f,v,b)=>{if(!f)return{value:null,status:"ready",refreshing:!1};const A=xo(b),E=A==="story:body";if(E&&typeof f.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof f.getNode!="function")return{value:null,status:"ready",refreshing:!1};const U=`node:${A}:${v}`,Q=Ft(),re=Yn(U,Q,()=>E?f.getNodeById({nodeId:v,nodeType:"paragraph"}):f.getNode(mo(v,b)),Re=>Re&&typeof Re=="object"?Re:null),ye=Le.get(U);return{...re,refreshing:re.status==="stale"&&ye?.inflightToken===Q&&ye.failedToken!==Q}},Br=f=>f==="left"||f==="center"||f==="right"||f==="justify"?f:void 0,Lf=f=>f==="start"||f==="end"||f==="distributed"||f==="numTab"||f==="lowKashida"||f==="mediumKashida"||f==="highKashida"||f==="thaiDistribute",Df=(f,v)=>{const b=T(),A=b?.readMountedProjectionBlocksByIds;if(typeof A!="function")return null;const E=oa(f),U=Tt(()=>E?A.call(b,[...v],E):A.call(b,[...v]),null);if(!Array.isArray(U))return new Map;const Q=K0(U),re=new Map;for(const ye of v){const Re=Q.find(Ze=>ec(Ze,ye));if(!Re)continue;const ze=Re.attrs,Ye=Br(ze?.alignment),Be=o9(ze);re.set(ye,Ye??(Be==="rtl"?"right":"left"))}return re},pa=(f,v,b,A)=>{const{value:E,status:U,refreshing:Q}=Qi(f,v,b),re=A?.get(v);if(U==="pending")return re?{status:"uniform",value:re}:{status:"pending"};if(U==="stale"&&!Q)return{status:"pending"};if(U==="stale"&&re)return{status:"uniform",value:re};if(U==="stale"&&A&&!re)return{status:"unavailable"};if(!E)return{status:"unavailable"};const ye=E.node;if(!ye)return{status:"unavailable"};const Re=ye.kind;if(Re!=="paragraph"&&Re!=="heading")return{status:"unavailable"};const ze=ye[Re];if(!ze||typeof ze!="object")return{status:"unavailable"};const Ye=ze.props?.alignment;if(Ye==null)return re?{status:"uniform",value:re}:{status:"unavailable"};const Be=Br(Ye);return Be?{status:"uniform",value:Be}:Lf(Ye)&&re?{status:"uniform",value:re}:{status:"unavailable"}},lc=(f,v)=>{const b=Rr(v);if(b.length===0||!Jl(b))return{status:"unavailable"};const A=na(v),E=Df(v,b),U=pa(f,b[0],A,E);if(U.status!=="uniform")return U;for(const Q of b.slice(1)){const re=pa(f,Q,A,E);if(re.status!=="uniform")return re;if(re.value!==U.value)return{status:"mixed"}}return U},Du=f=>{const v=Rr(f);return v.length===0?null:`${xo(na(f))}:${v.join(",")}`},x=(f,v)=>{const b=lc(f,v),A=b.status==="uniform"?b.value:void 0,E=o;if(!E)return A;const U=Du(v);return U&&U!==E.selectionSignature?(o=null,A):!U||!E.settled?E.value:b.status!=="pending"?(o=null,A):E.value},D=(f,v)=>{const b=Br(v),A=Du(f),E=Rr(f);if(!b||!A||E.length===0)return null;const U=++i;return o={selectionSignature:A,value:b,generation:U,settled:!1,canReconcile:Jl(E)},jt(),U},ee=(f,v)=>{if(f==null)return;const b=o;if(!(!b||b.generation!==f)){if(!No(v)){o=null;return}if(!b.canReconcile){o=null;return}b.settled=!0}},ie=async(f,v,b)=>{const A=f?.lists;if(!A)return null;try{const E=b.storyType==="body",U=typeof A.getStateInStory=="function"?await A.getStateInStory({target:ra(v),story:b}):E&&typeof A.getState=="function"?await A.getState({target:ra(v)}):null,Q=U&&typeof U=="object"?U:null;return!Q||Q.success!==!0||typeof Q.isListItem!="boolean"?null:Q.isListItem}catch{return null}},se=(f,v,b)=>{const A={resolved:!1,seed:null},E=f?.lists;if(!E)return A;const U=b.storyType==="body",Q=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:ra(v),story:b}):U&&typeof E.getState=="function"?()=>E.getState({target:ra(v)}):null;if(!Q)return A;const re=ye=>{const Re=ye&&typeof ye=="object"?ye:null;return!Re||Re.success!==!0||typeof Re.isListItem!="boolean"?A:{resolved:!0,seed:Re.isListItem===!0&&(Re.seed==="bullet"||Re.seed==="ordered")?Re.seed:null}};try{const ye=Q();return Or(ye)?Promise.resolve(ye).then(re,()=>A):re(ye)}catch{return A}},de=async(f,v,b)=>{if(!f)return null;try{const A=!b||b.storyType==="body",E=b&&typeof f.getNode=="function"?await f.getNode(mo(v,b)):A&&typeof f.getNodeById=="function"?await f.getNodeById({nodeId:v,nodeType:"paragraph"}):null;return dH(E&&typeof E=="object"?E:null)}catch{return null}},pe=(f,v,b,A,E,U)=>{if(f.mutates&&b)return tn({enabled:!1,active:E,supported:!0,value:U,reason:at.documentReadonly},"builtin");const Q=Rr(A);if(Q.length===0)return tn({enabled:!1,active:E,supported:!0,value:U,reason:at.selectionRequired},"builtin");const re=f.docRoute?gr(v,f.docRoute):null,ye=gr(v,"format.paragraph.setIndentation"),Re=gr(v,"format.paragraph.clearIndentation"),ze=f.list?.mode,Ye=ze==="indent"?ye!=null:ye!=null||Re!=null,Be=na(A);let Ze=null;if(Be.storyType!=="body"){Ze=[];for(const He of Q){const{value:Ue,status:je}=ac(v,He,Be);if(Ue===null)return je!=="ready"&&(re!=null||Ye)?tn({enabled:!0,active:E,supported:!0,value:U},"builtin"):tn({enabled:!1,active:E,supported:!1,value:U,reason:Mi(v)},"builtin");Ze.push(Ue)}}if(Ze?.some(He=>He===!0)){const He=ze==="indent"?"lists.indentRange":"lists.outdentRange",Ue=br()!=="suggesting"&&Ze.every(rt=>rt===!0)&&gr(v,He)!=null,je=ze==="outdent"&&gr(v,"lists.outdentInStory")!=null;if(!Ue&&!je)return tn({enabled:!1,active:E,supported:!1,value:U,reason:Mi(v)},"builtin")}for(const[He,Ue]of Q.entries()){const je=Ze?{value:Ze[He]??null,status:"ready"}:ac(v,Ue,Be),rt=je.value;if(rt===!0){if(re!=null)return tn({enabled:!0,active:E,supported:!0,value:U},"builtin");continue}if(rt===!1&&Ye){if(Be.storyType!=="body"&&typeof v?.getNode!="function")continue;return tn({enabled:!0,active:E,supported:!0,value:U},"builtin")}if(rt===null)return je.status!=="ready"&&(re!=null||Ye)?tn({enabled:!0,active:E,supported:!0,value:U},"builtin"):tn({enabled:!1,active:E,supported:!1,value:U,reason:Mi(v)},"builtin")}return tn({enabled:!1,active:E,supported:!1,value:U,reason:Mi(v)},"builtin")},ve=(f,v,b,A,E,U)=>{if(f.mutates&&b)return tn({enabled:!1,active:E,supported:!0,value:U,reason:at.documentReadonly},"builtin");const Q=Rr(A);if(Q.length===0)return tn({enabled:!1,active:E,supported:!0,value:U,reason:at.selectionRequired},"builtin");const re=na(A),ye=v?.lists;if(!(typeof ye?.getStateInStory=="function"||re.storyType==="body"&&typeof ye?.getState=="function"))return tn({enabled:!1,active:E,supported:!1,value:U,reason:at.operationUnavailable},"builtin");if(!Jl(Q))return tn(re.storyType==="body"&&gr(v,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:U}:{enabled:!1,active:E,supported:!1,value:U,reason:at.operationUnavailable},"builtin");const Re=Q.map(Ze=>gl(v,Ze,re));if(Re.some(({status:Ze})=>Ze!=="ready"))return tn({enabled:!0,active:E,supported:!0,value:U},"builtin");if(Re.some(({value:Ze})=>Ze===null))return tn({enabled:!1,active:E,supported:!1,value:U,reason:at.operationUnavailable},"builtin");const ze=f.list?.seed,Ye=Re.every(({value:Ze})=>Ze?.isListItem===!0&&Ze.seed===ze);if(re.storyType==="body")return tn(!Ye||gr(v,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:U}:{enabled:!1,active:E,supported:!1,value:U,reason:at.operationUnavailable},"builtin");const Be=gr(v,"lists.removeInStory");return tn(Ye&&Be?{enabled:!0,active:E,supported:!0,value:U}:{enabled:!1,active:E,supported:!1,value:U,reason:at.operationUnavailable},"builtin")},qe=(f,v)=>{const b=fa(f,v)?.properties?.href;return typeof b=="string"?b:null},Xe=f=>{if(!S())return tn({enabled:!1,active:!1,supported:!1,reason:at.notReady},"builtin");const v=f.instanceRoute;return typeof t?.[v]!="function"?tn({enabled:!1,active:!1,supported:!1,reason:at.operationUnavailable},"builtin"):tn({enabled:!0,active:et(f),supported:!0,value:yt(f)},"builtin")},et=f=>{const v=t?.config??void 0;return f.valueFrom==="ruler"?!!v?.rulers:f.valueFrom==="formattingMarks"?!!v?.layoutEngineOptions?.showFormattingMarks:!1},st=(f,v,b)=>{if(b)return tn({enabled:!1,active:!1,supported:!0,reason:at.documentReadonly},"builtin");const A=Ne();return A!=null&&(!f.table.requiresCell||A.cellNodeId!=null)?(f.docRoute?gr(v,f.docRoute):null)==null?tn({enabled:!1,active:!1,supported:!1,reason:Mi(v)},"builtin"):tn({enabled:!0,active:!1,supported:!0},"builtin"):tn({enabled:!1,active:!1,supported:!0,reason:at.tableContextUnavailable},"builtin")},yt=f=>{if(f.valueFrom==="zoom")return qi().value;if(f.valueFrom==="documentMode")return br();if(f.valueFrom==="measurementUnit")return Su();if(f.valueFrom==="ruler"||f.valueFrom==="formattingMarks")return et(f)},gt=(f,v)=>f.id==="zoom"?typeof v=="number"&&Number.isFinite(v)&&v>0:f.id==="document-mode"?v==="editing"||v==="suggesting"||v==="viewing":f.id==="measurement-unit"?v==="in"||v==="cm":!0,it=()=>[...new Set([...$F,...he.keys()])],on="Normal",nn={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},Dn=f=>{const v=y()?.styles;return!v||typeof v.getCatalog!="function"?{value:null,status:"ready"}:Yn(`styles:catalog:${JSON.stringify(f??{})}`,Ft(),()=>v.getCatalog(f),b=>b&&typeof b=="object"?b:null)},Fn=()=>{const f=Dn({includePreview:!0});if(!f.value)return{cache:null,status:f.status};const v=Dn({view:"quickGallery",includePreview:!0}),b=v.value?v.value.items:f.value.styles.filter(E=>E.visibility.quickGallery),A=new Map;for(const E of f.value.styles)A.set(E.id,E);return{cache:{full:f.value,quickGallery:b,byId:A},status:hu(f.status,v.status)}},jn=(f,v,b)=>{const{value:A,status:E}=Qi(f,v,b);if(!A)return{ok:!1,styleRef:null,status:E};const U=A.node;if(!U||typeof U!="object")return{ok:!1,styleRef:null,status:E};const Q=U.kind,re=typeof Q=="string"?U[Q]:void 0,ye=re&&typeof re=="object"?re.styleRef:void 0;return{ok:!0,styleRef:typeof ye=="string"&&ye.length>0?ye:null,status:E}},yo=(f,v)=>{const b=[],A=y();if(!A)return b.push({severity:"warning",code:"active-style-unavailable",message:"Active paragraph style is unavailable: the Document API is not reachable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:b},status:"ready"};const E=Rr(f);if(E.length===0)return b.push({severity:"info",code:"active-style-no-selection",message:"No paragraph block is resolvable from the current selection; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:b},status:"ready"};if(!Jl(E))return b.push({severity:"info",code:"active-style-selection-too-large",message:"Active paragraph style is unavailable for a large multi-paragraph selection."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:b},status:"ready"};const U=v?.full.defaults.paragraphStyleId??(v?on:null),Q=new Set;let re=0,ye=0,Re=0,ze="ready";const Ye=na(f);for(const He of E){const Ue=jn(A,He,Ye);if(ze=hu(ze,Ue.status),!Ue.ok){ye+=1;continue}if(!Ue.styleRef&&!U){Re+=1;continue}const je=Ue.styleRef??U;if(!je){Re+=1;continue}re+=1,Q.add(je)}if(re===0){const He=Re>0&&ye===0;return b.push({severity:"warning",code:He?"active-style-default-unavailable":"active-style-read-failed",message:He?"Selected paragraphs have no explicit style and the style catalogue is unavailable, so the document default cannot be resolved.":"Could not read the paragraph style of any selected block; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:b},status:ze}}const Be=ye+Re;if(Be>0)return b.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${re} of ${re+Be} selected blocks; ${Be} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:b},status:ze};if(Q.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:b},status:ze};const Ze=[...Q][0];return{style:{styleId:Ze,styleName:v?.byId.get(Ze)?.name??null,mixed:!1,diagnostics:b},status:ze}},er=f=>{if(!S())return nn;const{cache:v,status:b}=Fn(),{style:A,status:E}=yo(f,v);let U;return v?U=A.diagnostics.length===0?v.full.diagnostics:[...v.full.diagnostics,...A.diagnostics]:U=[{severity:"warning",code:"catalog-unavailable",message:"The style catalogue is unavailable: the Document API styles surface is not reachable (e.g. viewing mode or a worker-backed editor)."},...A.diagnostics],{ready:!0,status:hu(b,E,f.status),catalogRevision:v?.full.revision??null,quickGallery:v?.quickGallery??[],activeParagraphStyleId:A.styleId,activeParagraphStyleName:A.styleName,mixedSelection:A.mixed,sourceStatus:v?.full.sourceStatus??null,diagnostics:U}},En=()=>{const f=br(),v=bu();v.status==="ready"&&aa(v),N(v);const b=ia(v);for(const[A,E]of r)(!b||E.selectionSignature!==b||E.settled&&v.status==="ready")&&r.delete(A);return{ready:S()!=null,documentMode:f,document:ku(),selection:v,toolbar:{context:f,commands:oc(v),copyFormatActive:h.mode!=="idle"},comments:_u(v),trackChanges:ul(v),contentControls:Ef(v),zoom:qi(),fonts:Do(),styles:er(v)}},ur=f=>{const v=ia(f);v&&a&&v!==a&&(n.clear(),r.clear()),v&&(a=v)};let mt=null,Lt=null,Pn=null,Nr=null,wr=!1;const vl=()=>{if(be||wr)return;wr=!0;const f=()=>{wr&&(wr=!1,!be&&jt())};typeof queueMicrotask=="function"?queueMicrotask(f):Promise.resolve().then(f)},yl=()=>{const f=I();if(f!==Pn&&(Nr&&(Nr(),Nr=null),Pn=f,!(!f||typeof f.subscribe!="function")))try{const v=f.subscribe(()=>vl());typeof v=="function"&&(Nr=v)}catch{Pn=null}};let zr=null,ti=null,Li=null,wi=null,ma=null,Mr=null;const ws=()=>{const f=S()?.host,v=Tt(f?.getHandles?()=>f.getHandles():void 0,null)?.editing?.selection;return v&&typeof v.subscribe=="function"?v:null},Di=()=>{const f=ws();if(f!==mt&&(Lt&&(Lt(),Lt=null),mt=f,!!f))try{const v=f.subscribe(b=>{kt+=1,Cu(b),jt()});typeof v=="function"&&(Lt=v)}catch{mt=null}},Cs=()=>{const f=S()?.host,v=Tt(f?.getHandles?()=>f.getHandles():void 0,null)?.review;return v&&typeof v.subscribe=="function"?v:null},Pi=f=>f?typeof f.getActiveReviewTarget=="function"?Tt(()=>f.getActiveReviewTarget(),null):typeof f.getSnapshot=="function"?Tt(()=>f.getSnapshot(),null)?.activeReviewTarget??null:null:null;let ao=0;const Po=(f,v)=>{const b=(v&&typeof v=="object"?v:null)?.lastInteractionRejection;if(ao>0&&f==null&&b&&typeof b=="object"&&b.code==="review-target-invalidated"&&b.detail==="not-painted")return!1;const A=f&&typeof f=="object"?f:null;let E=null;if(A?.entityType==="trackedChange"&&typeof A.entityId=="string"&&A.entityId.length>0){const U=A.story&&xo(A.story)!==xo(null)?A.story:void 0;E={id:A.entityId,...U?{story:U}:{},...typeof A.paintedEntityId=="string"&&A.paintedEntityId.length>0?{paintedEntityId:A.paintedEntityId}:{}}}return Te(ae,E)?!1:(Je(E),!0)},cc=()=>{const f=Cs();if(f===zr)return;if(ti&&(ti(),ti=null),zr=f,!f){Po(null);return}let v=!0;try{const b=f.subscribe(A=>{const E=A&&typeof A=="object"?A:null;!Po(E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:Pi(f),A)||v||jt()});typeof b=="function"&&(ti=b),Po(Pi(f))}catch{zr=null}finally{v=!1}},ga=()=>{if(mt||br()!=="viewing")return null;const f=S()?.mount?.container,v=(f&&typeof f=="object"&&"ownerDocument"in f?f.ownerDocument??null:null)??globalThis.document??null;return v&&typeof v.addEventListener=="function"?v:null},uc=()=>{const f=ga();if(f===ma||(Mr&&(Mr(),Mr=null),ma=f,!f))return;const v=()=>{kt+=1,jt()};f.addEventListener("selectionchange",v),f.addEventListener("pointerup",v,!0),f.addEventListener("mouseup",v,!0),Mr=()=>{f.removeEventListener("selectionchange",v),f.removeEventListener("pointerup",v,!0),f.removeEventListener("mouseup",v,!0)}};Mo(),Po(Pi(Cs()));let bt=En();a=ia(bt.selection);const va=()=>{const f=S()?.host?.events,v=f&&typeof f.subscribe=="function"?f:null;if(v!==Li&&(wi&&(wi(),wi=null),Li=v,!!v))try{const b=v.subscribe(A=>{const E=A?.type;if(E==="source:complete"||E==="source:signals-complete"){pt!==null&&(ln(),Yt.onRender(!0));return}if((E==="mutation:committed"||E==="collaboration:remote-changed")&&(rl=Date.now()),E==="mutation:committed"&&(ln(),Kt={}),E==="mutation:committed"||E==="save:completed"||E==="collaboration:remote-changed"){const U=E==="mutation:committed"?b_(A):null,Q=E==="mutation:committed"&&Yt.getPendingIds().size>0;U?.removedIds.size&&Oe(new Set(U.removedIds),A.receipt);const re=U?.reconcileMode==="authoritative"&&U.upsertIds.size>0;if(re&&(Xr(),ln(),pt=Ft(),jt()),U?.upsertIds.size||Q){const Ye=A.origin==="history"?null:A.receipt,Be=S()?.documentMutationReadiness,Ze=typeof Ye?.txId=="string"&&Ye.txId.length>0&&typeof Be?.whenPainted=="function",He=A.origin==="history"&&typeof Be?.getRenderEpoch=="function"?Tt(()=>Be.getRenderEpoch.call(Be),null):null,Ue=A.origin==="history"&&typeof Be?.whenPainted=="function",je={upsertIds:U?.upsertIds??new Set,removedIds:new Set,reconcileMode:U?.reconcileMode==="authoritative"?"authoritative":"targeted"};Ze?Yt.enqueueAfterPaint(je,()=>Be.whenPainted.call(Be,Ye)):Ue?Yt.enqueueAfterPaint(je,()=>Be.whenPainted.call(Be,typeof He=="number"?{afterEpoch:He}:void 0)):(Yt.enqueue(je),Yt.onRender(Q))}if(re)return;const ye=E==="mutation:committed"&&Ti(A)||E==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0;if(ye&&(gs=Date.now()),E==="mutation:committed"&&ye){vi();return}if(U?.removedIds.size&&U.upsertIds.size===0)return;(E==="collaboration:remote-changed"||E==="mutation:committed"&&!ye)&&Yr();const Re=E==="collaboration:remote-changed"&&Array.isArray(A.changedPartUris)&&A.changedPartUris.some(Ye=>typeof Ye=="string"&&tH.has(Ye)),ze=E==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0&&To();Re&&!ye&&(Ho=!0),Xr(),(Re||ze)&&yr("comments"),jt()}});typeof b=="function"&&(wi=b)}catch{Li=null}},jt=()=>{if(be)return;wr=!1,Mo(),Di(),yl(),cc(),uc(),va();const f=En();ur(f.selection),bt=f;for(const v of[..._t])v(bt)},_s=[],Pu=[],Ou=f=>{for(const v of f)try{v()}catch{}},Fu=()=>Ou(_s),Zt=()=>Ou(Pu),Mn=[];((f,v)=>{if(!(!f||typeof f.on!="function"))for(const b of v){const A=b==="active-editor-change"?()=>{Fu(),Zt(),jt()}:b==="document-replaced"?E=>{const U=E&&typeof E=="object"?E:null,Q=U?.editor,re=U?.host,ye=!!Q&&Q===S(),Re=!!re&&re===T();!ye&&!Re||(Zt(),Le.clear(),Xr(),jt())}:()=>jt();try{f.on(b,A),Mn.push(()=>{try{typeof f.off=="function"&&f.off(b,A)}catch{}})}catch{}}})(t,Xz),Di(),yl(),cc(),uc(),va();const Go=(f,v=Oz)=>({get:()=>f(bt),subscribe:b=>{let A=f(bt);const E=U=>{const Q=f(U);v(A,Q)||(A=Q,b(Q))};return _t.add(E),()=>_t.delete(E)}}),lo=f=>Go(f),Qr=f=>{const v=b=>{const A=U=>{try{b(U)}catch{}},E=f.subscribe(A);return A(f.get()),E};return{get:()=>f.get(),getSnapshot:()=>f.get(),observe:v,subscribe:b=>v(A=>b({snapshot:A}))}};function bl(f){return f&&typeof f=="object"&&typeof f.id=="string"?String(f.id):null}function wl(f){if(f.empty)return null;const v=f.selectionTarget,b=v?.start,A=v?.end;if(v?.kind!=="selection"||b?.kind!=="text"||A?.kind!=="text"||typeof b.blockId!="string"||b.blockId!==A.blockId||!Number.isInteger(b.offset)||!Number.isInteger(A.offset)||b.offset<0||A.offset<0||b.offset===A.offset)return null;const E=Math.min(b.offset,A.offset),U=Math.max(b.offset,A.offset),Q=oa(f);return{kind:"range",coordinateSpace:v.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...Q?{story:Q}:{},segments:[{blockId:b.blockId,range:{start:E,end:U}}]}}}function Z0(){const f=bt.selection.activeChangeIds[0];if(!f)return"unavailable";const v=Lo();if(!v)return"unavailable";const b=oa(bt.selection),A=v.find(Q=>Ja(Q,f,b));if(!A)return"unavailable";const E=tm(A).type,U=tm(A).grouping;return E==="replacement"&&U==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&U==="standalone"?"range":"id"}function J0(f,v){if(f.scope==="all")return{target:{scope:"all"},changeId:null};if(typeof v=="string"&&v.length>0)return{target:{kind:"id",id:v},changeId:v};if(v&&typeof v=="object"){const A=v;if(A.target&&typeof A.target=="object")return{target:A.target,changeId:bl(A.target)};const E=typeof A.changeId=="string"?A.changeId:A.id;if(typeof E=="string"&&E.length>0)return{target:{kind:"id",id:E},changeId:E}}const b=bt.selection.activeChangeIds[0];return b?{target:{kind:"id",id:b},changeId:b}:null}function O(f,v){if(f.scope==="id"&&v==null){if(bt.selection.activeChangeIds.length>1)return Nu(f.kind,{kind:"ids",ids:bt.selection.activeChangeIds},null);if(bt.selection.activeChangeIds.length===1&&!bt.selection.empty&&bt.selection.selectionTarget){const A=Z0();if(A==="unavailable")return!1;if(A==="range"){const E=wl(bt.selection);return E?Nu(f.kind,E,null):!1}}}const b=J0(f,v);return b?Nu(f.kind,b.target,b.changeId):!1}function q(f,v){const b=I()?.lists,A=b?.apply;if(typeof A!="function")return!1;const{behavior:E,preset:U,continuity:Q}=typeof v=="string"?Jz(v):v&&typeof v=="object"?v:{},re={kind:f,behavior:E??"toggle"};U!==void 0&&(re.preset=U),Q!==void 0&&(re.continuity=Q);try{return co(A.call(b,re))}catch{return!1}}let Se=Promise.resolve(!1),Pe=null,ht=Promise.resolve(!1);const sn=async f=>{if(!nm(f))return f;const v=S()?.documentMutationReadiness,b=v?.whenPainted;if(typeof b!="function")return f;const A=typeof f.txId=="string"?f.txId:void 0;try{await b.call(v,A?{txId:A}:void 0)}catch{}return f},un=f=>{if(Or(f)){const b=Promise.resolve(f);return{immediate:!0,committed:b.then(A=>el(A),()=>!1),settled:b.then(A=>sn(el(A)),()=>!1)}}const v=el(f);return{immediate:v,committed:Promise.resolve(v),settled:sn(v)}},dr=()=>{const f=s.shift();if(!f){u=!1,d?.(),d=null;return}try{f.resolve(be?!1:f.mutate())}catch{f.resolve(!1)}},Bn=()=>{let f=!1;return()=>{f||(f=!0,dr())}},fr=(f,v)=>{if(!u){u=!0,c=new Promise(U=>{d=U});try{return{result:v(),release:Bn()}}catch(U){throw u=!1,d?.(),d=null,U}}const b=s.find(U=>U.key===f);if(b)return b.mutate=v,{result:b.result,release:()=>{}};let A;const E=new Promise(U=>{A=U});return s.push({key:f,mutate:v,result:E,resolve:A}),{result:E,release:Bn()}},kn=new Set(["create.tableOfContents"]),bo=f=>ar(`Tracked authoring is not supported for ${f}.`),Hr=f=>{if(br()==="suggesting")return kn.has(f)?bo(f):{changeMode:"tracked"}},ya=()=>br()==="suggesting"?xH:Y0,hr=(f,v,b)=>{const A=Hr(f);return A&&A.success===!1?A:A?v(b,A):v(b)},ni=(f,v,b,A)=>{const E=f.inline;if(!E)return;const U=el(A);if(U===!1||typeof U=="object"&&U&&U.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!j0(E.key))return;const Q=ia(v);if(!Q)return;const re=mH(E.key,b.value);if(re==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:Q,value:re})},Cl=(f,v,b,A)=>!f.inline||f.inline.kind==="toggle"?A:Or(A)?Promise.resolve(A).then(E=>(ni(f,v,b,E),E)):A,_l=(f,v,b,A)=>{if(f.inline?.kind!=="toggle"||!No(el(A))||typeof b.value!="boolean"&&b.value!==null)return null;const E=ia(v);if(!E)return null;const U=++l;return r.set(f.id,{selectionSignature:E,active:b.value===!0,generation:U,settled:!1}),jt(),U},$0=(f,v,b)=>{if(v==null)return;const A=r.get(f.id);if(!(!A||A.generation!==v)){if(!No(b)){r.delete(f.id);return}A.settled=!0}},dc=(f,v)=>f.then(b=>(v?.(b),Xr(),jt(),b),()=>(v?.(!1),Xr(),jt(),!1)),co=(f,v)=>{const b=Pe;if(Pe=null,b)return Se=dc(b,v),el(f);if(Or(f))return Se=dc(un(f).settled,v),!0;const A=el(f);return nm(A)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Se=dc(sn(A),v),A):(v?.(A),Se=Promise.resolve(A),Xr(),jt(),A)},eb=(f,v)=>!f||typeof f!="object"?v:f,ba=(f,v=ar("Document API operation failed."))=>{if(Or(f))return Promise.resolve(f).then(A=>ba(A,v),()=>v);const b=eb(f,v);return Xr(),nm(b)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(dc(sn(b)),jt(),b):(jt(),b)},Pf=(f,v,b,A)=>{const E=[],U=[];for(const Q of b){const re=A(Q);if(re)try{const ye=un(hr(f,v,re));E.push(ye.immediate),U.push(ye.settled)}catch{E.push(!1),U.push(Promise.resolve(!1))}}return Pe=U.length?Promise.all(U).then(Q=>fi(Q)):null,fi(E)},Xn=(f,v,b,A)=>{const E=[],U=[];for(const Q of b){const re=A(Q);if(re)try{const ye=un(hr(f,v,re));E.push(ye.immediate),U.push(ye.settled)}catch{E.push(!1),U.push(Promise.resolve(!1))}}return Pe=U.length?Promise.all(U).then(Q=>fi(Q)):null,fi(E)},Of=(f,v,b,A=bt.selection)=>{const E=Hr(f);return E&&E.success===!1?E:A.selectionTarget?v(b,{...E??{},offsetSpace:"selection"}):E?v(b,E):v(b)},sm=(f,v,b,A)=>{const E=mo(v,A);switch(f.kind){case"alignment":{const U=b;return U!=="left"&&U!=="center"&&U!=="right"&&U!=="justify"?null:{target:E,alignment:U}}case"spacing-line":{const U=typeof b=="number"?b:Number(b);return!Number.isFinite(U)||U<=0?null:{target:E,line:U,lineRule:"auto"}}case"style":if(b&&typeof b=="object"){const U=b.role;if(U&&typeof U=="object")return{target:E,role:U}}return typeof b!="string"||b.trim()===""?null:{target:E,styleId:b};case"direction":{const U=f.fixedValue;return U!=="ltr"&&U!=="rtl"?null:{target:E,direction:U}}default:return null}},am=(f,v)=>{const b=f.inline,A=q0(f),E=T();if(!b||typeof E?.setPendingInlineFormat!="function")return!1;if(b.kind==="clear")return X(),!0;if(!A)return!1;let U;if(b.kind==="toggle")U=!ha(f,y(),bt.selection);else{const Q=v&&typeof v=="object"&&"value"in v?v.value:v;if(b.kind==="value-number"){const re=typeof Q=="number"?Q:Number(Q);U=Number.isFinite(re)&&re>0?re:null}else U=typeof Q=="string"&&Q.trim()!==""?Q:null;if(U===null)return z(A,null),!0}return z(A,U),!0},tb=()=>{const f=y(),{lockModesById:v}=vs(f?.contentControls,bt.selection);if(Xi(v))return!1;const b=[],A=[],E=Ze=>{const He=un(Ze);b.push(He.immediate),A.push(He.settled)},U=(Ze,He,Ue)=>{try{E(Ue?Ze(He,Ue):Ze(He))}catch{b.push(!1),A.push(Promise.resolve(!1))}},Q=Fn().cache?.full.defaults.paragraphStyleId??on,re=vu(bt.selection);if(re){const Ze=gr(f,"format.apply");if(Ze)try{E(Of("format.apply",Ze,{target:re,inline:{...ya()}}))}catch{b.push(!1),A.push(Promise.resolve(!1))}}const ye=gr(f,"format.paragraph.resetDirectFormatting"),Re=gr(f,"styles.paragraph.setStyleRef"),ze=oa(bt.selection),Ye=!ze||ze.storyType==="body",Be=gr(f,Ye?"lists.remove":"lists.removeInStory");for(const Ze of Rr(bt.selection)){const He=mo(Ze,ze);if(ye&&U(ye,{target:He}),Be)try{const Ue=ra(Ze),je=un(Be(Ye?{target:Ue}:{target:Ue,story:ze}));A.push(je.settled.then(rt=>No(rt)?rt:!0))}catch{}Re&&U(Re,{target:He,styleId:Q})}if(!re&&br()!=="suggesting"){const Ze=gr(f,"format.paragraph.setMarkRunProps");if(Ze)for(const He of Rr(bt.selection))U(Ze,{target:mo(He,ze),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return Pe=A.length?Promise.all(A).then(Ze=>fi(Ze)):null,fi(b.length?b:[!1])},lm=(f,v,b)=>{const A=Rr(bt.selection);if(A.length===0)return!1;const E=oa(bt.selection);return Pf(f.docRoute,v,A,U=>sm(f.blockParagraph,U,b,E))},cm=(f,v,b)=>{const A=y(),E=gr(A,"format.paragraph.setIndentation"),U=gr(A,"format.paragraph.clearIndentation"),Q=f.list?.mode,re=na(bt.selection),ye=oa(bt.selection),Re=async ze=>{const Ye=await ie(A,ze,re);if(Ye===!0)return{kind:"list",routeToCall:f.docRoute,opToCall:v,input:{target:eA(ze)}};if(Ye===null||ye&&ye.storyType!=="body"&&typeof A?.getNode!="function")return null;const Be=await de(A,ze,ye),Ze={};if(Be?.right!=null&&(Ze.right=Be.right),Be?.firstLine!=null&&(Ze.firstLine=Be.firstLine),Be?.hanging!=null&&(Ze.hanging=Be.hanging),Q==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:mo(ze,ye),left:Math.max(0,Be?.left??0)+tA,...Ze}}:null;const He=Math.max(0,(Be?.left??0)-tA);return He>0&&(Ze.left=He),Object.keys(Ze).length===0?U?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:U,input:{target:mo(ze,ye)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:mo(ze,ye),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:mo(ze,ye),...Ze}}:null};return Pe=(async()=>{const ze=await Promise.all(b.map(He=>Re(He).catch(()=>null)));if(ze.length===b.length&&ze.every(He=>He?.kind==="list")&&br()!=="suggesting"){const He=Q==="indent"?"lists.indentRange":"lists.outdentRange",Ue=gr(A,He);if(Ue)try{return await un(hr(He,Ue,{paraIds:b,story:re})).settled}catch{return!1}}const Ye=re.storyType!=="body"&&ze.some(He=>He?.kind==="list"),Be=Ye&&Q==="outdent"?gr(A,"lists.outdentInStory"):null;if(Ye&&!Be)return!1;const Ze=ze.map(He=>{if(!He)return Promise.resolve(!1);try{return He.kind==="list"&&Be?un(hr("lists.outdentInStory",Be,{target:He.input.target,story:re})).settled:un(hr(He.routeToCall,He.opToCall,He.input)).settled}catch{return Promise.resolve(!1)}});return fi(await Promise.all(Ze))})(),!0},um=(f,v)=>{const b=f.list,A=y(),E=Rr(bt.selection);if(E.length===0)return!1;const U=na(bt.selection),Q=U.storyType==="body";if(b.mode==="indent"||b.mode==="outdent")return cm(f,v,E);const re=b.seed,ye=Ye=>{if(Ye.some(rt=>!rt.resolved))return{immediate:!1,settled:null};const Be=Ye.every(rt=>rt.seed===re);if(!Be&&!Q)return{immediate:!1,settled:null};const Ze=Be?Q?"lists.remove":"lists.removeInStory":f.docRoute,He=Be?gr(A,Ze):v;if(!He)return{immediate:!1,settled:null};const Ue=[],je=[];return E.forEach((rt,$e)=>{if(!Be&&Ye[$e]?.seed===re)return;const Bt=Be?{target:ra(rt),...Q?{}:{story:U}}:{target:ra(rt),seed:re};try{const Xt=un(hr(Ze,He,Bt));Ue.push(Xt.immediate),je.push(Xt.settled)}catch{Ue.push(!1),je.push(Promise.resolve(!1))}}),{immediate:fi(Ue),settled:je.length?Promise.all(je).then(rt=>fi(rt)):null}},Re=E.map(Ye=>se(A,Ye,U));if(Re.some(Or))return Pe=Promise.all(Re).then(async Ye=>{const Be=ye(Ye);return Be.settled?await Be.settled:Be.immediate}),!0;const ze=ye(Re);return Pe=ze.settled,ze.immediate};function fc(f){return f&&typeof f=="object"?f:{}}function dm(f){if(typeof f=="string")return f;const v=fc(f);if(Object.prototype.hasOwnProperty.call(v,"href"))return v.href;if(Object.prototype.hasOwnProperty.call(v,"value"))return v.value}function hc(f,v){const b=fc(f).text;return typeof b=="string"&&b.trim()!==""?b:v}function pc(f){const v=fc(f),b=v.capture&&typeof v.capture=="object"?v.capture:null;return v.target??b?.target??b?.selectionTarget??v.selectionTarget??v.textTarget??null}const Ff=f=>{const v=y(),b=v?.hyperlinks;if(!b)return!1;const A=fc(f),E=dm(f),U=pc(f),Q=typeof A.text=="string"?A.text:void 0,re=typeof A.currentText=="string"?A.currentText:void 0,ye=gu(A.hyperlinkTarget)?A.hyperlinkTarget:null,Re=gu(A.textTarget)?A.textTarget:null,ze=fa(v,bt.selection),Ye=typeof ye?.storyId=="string"&&typeof ye?.hyperlinkNodeId=="string";if(Ye&&E===null){const Be=b.remove;if(typeof Be!="function")return!1;try{return hr("hyperlinks.remove",Be,{storyId:ye.storyId,hyperlinkNodeId:ye.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(ze&&E===null){const Be=b.remove;if(typeof Be!="function")return!1;try{return hr("hyperlinks.remove",Be,{target:ze.address,mode:"unwrap"})}catch{return!1}}if((ze||ye)&&typeof E=="string"&&E.trim()!==""){const Be=b.patch,Ze=b.updateTarget;if(!(!Ye&&ze&&typeof Be=="function")&&!(Ye&&typeof Ze=="function"))return!1;const He=typeof Q=="string"&&Q!==(Ye?re:ze?.text??re),Ue=v?.text?.replace,je=He?Ye?Re:_H(ze?.address):null,rt=He&&!!je&&typeof Ue=="function";if(He&&!rt)return!1;const $e=[],Bt=[];let Xt=null,Nn=null,Gn=null,Jr=!1;try{if(Ye){if(typeof Ze!="function")return!1;const Vr=hr("hyperlinks.updateTarget",Ze,{storyId:ye.storyId,hyperlinkNodeId:ye.hyperlinkNodeId,newTarget:SH(E)});Jr=Or(Vr);const Lr=un(Vr);if(!No(Lr.immediate))return!1;$e.push(Lr.immediate),Bt.push(Lr.settled),Xt=Lr.immediate,Nn=Lr.committed,Gn=Lr.settled}else if(ze){if(typeof Be!="function")return!1;const Vr=hr("hyperlinks.patch",Be,{target:ze.address,patch:{href:E}});Jr=Or(Vr);const Lr=un(Vr);if(!No(Lr.immediate))return!1;$e.push(Lr.immediate),Bt.push(Lr.settled),Xt=Lr.immediate,Nn=Lr.committed,Gn=Lr.settled}}catch{return!1}if(rt){const Vr=(Ar,Wo)=>No(Wo)?fi([Ar,Wo]):No(Ar)?Sf(Ar,Wo):Wo,Lr=Ar=>{if(!No(Ar))return Ar;try{const Wo=un(hr("text.replace",Ue,{target:je,text:Q}));return No(Wo.immediate)?Promise.all([Gn??Promise.resolve(Ar),Wo.settled]).then(([cb,OU])=>Vr(cb,OU)):Sf(Ar,Wo.immediate)}catch{return Sf(Ar,!1)}};if(Jr)return Pe=(Nn??Promise.resolve(Xt??!1)).then(Lr),fi($e);try{const Ar=un(hr("text.replace",Ue,{target:je,text:Q}));if(!No(Ar.immediate))return Xt?Sf(Xt,Ar.immediate):Ar.immediate;$e.push(Ar.immediate),Bt.push(Ar.settled),Pe=Promise.all([Gn??Promise.resolve(Xt??!1),Ar.settled]).then(([Wo,cb])=>Vr(Wo,cb))}catch{return Xt?Sf(Xt,!1):!1}}return!rt&&Bt.length>0&&(Pe=Promise.all(Bt).then(Vr=>fi(Vr))),fi($e)}if(typeof E=="string"&&E.trim()!==""){const Be=E.trim(),Ze=b.wrap,He=fH(U),Ue=He.length>0?He:V0(bt.selection);if(Ue.length>0){if(typeof Ze!="function")return!1;try{return Xn("hyperlinks.wrap",Ze,Ue,Bt=>({target:Bt,link:{destination:{href:Be}}}))}catch{return!1}}const je=b.insert,rt=hc(f,Be);if(typeof je!="function"||rt.trim()==="")return!1;const $e=kf(U)??$a(bt.selection);if(!$e)return!1;try{return hr("hyperlinks.insert",je,{target:$e,text:rt,link:{destination:{href:Be}}})}catch{return!1}}return!1},At=(f,v,b)=>{const A=f.create.kind,E=b&&typeof b=="object"?b:{};if(A==="table"){const Q=Number(E.rows??E.rowCount),re=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(Q)||Q<1||!Number.isInteger(re)||re<1)return!1;const ye=$a(bt.selection),Re=ye&&typeof ye.blockId=="string"?{kind:"inParagraph",target:mo(ye.blockId),offset:ye.range?.start??0}:W0(bt.selection,"nodeId");try{return hr(f.docRoute,v,{rows:Q,columns:re,at:Re})}catch{return!1}}if(A==="image"){const Q=E.src??E.value;if(typeof Q!="string"||Q.trim()==="")return!1;const re=$a(bt.selection),ye=na(bt.selection),Re=ye.storyType==="body"?null:ye;let ze;re&&typeof re.blockId=="string"?ze={kind:"inParagraph",target:mo(re.blockId,Re),offset:re.range?.start??0}:(ze=W0(bt.selection,"target"),Re&&ze.kind==="after"&&(ze={...ze,target:{...ze.target,story:Re}}));const Ye={src:Q,at:ze};Re&&(Ye.in=ze.kind==="inParagraph"?R(Re)??Re:Re),typeof E.alt=="string"&&(Ye.alt=E.alt),typeof E.title=="string"&&(Ye.title=E.title),E.size&&typeof E.size=="object"&&(Ye.size=E.size);try{return hr(f.docRoute,v,Ye)}catch{return!1}}const U={at:W0(bt.selection,"target")};typeof E.instruction=="string"&&(U.instruction=E.instruction),E.config&&typeof E.config=="object"&&(U.config=E.config);try{return hr(f.docRoute,v,U)}catch{return!1}},Gt=(f,v)=>{const b=f.table,A=Ne();if(!A||b.requiresCell&&!A.cellNodeId)return!1;const E=MH(b.action,A);if(!E)return!1;try{if(b.action==="insert-row-before"||b.action==="insert-row-after"){const U=T(),Q=(typeof U?.getHandles=="function"?U.getHandles():null)?.editing?.tables;if(typeof Q?.insertRow!="function")return!1;const re=Hr(f.docRoute);return re&&re.success===!1?re:re?Q.insertRow(E,re):Q.insertRow(E)}return hr(f.docRoute,v,E)}catch{return!1}},vn=f=>!f||f.disposition!=="routed"?!1:!!(f.inline||f.blockParagraph||f.list||f.link||f.create),Cr=f=>{const v=fc(f);return!!(pc(f)||gu(v.hyperlinkTarget)||gu(v.textTarget))},Ur=(f,v,b)=>bt.selection.status!=="ready"?!1:rm(f)?.scope==="id"||!v||v.disposition!=="routed"?!0:v.inline?.kind==="clear"?Rr(bt.selection).length>0||vu(bt.selection)!=null:v.inline?vu(bt.selection)!=null||Rr(bt.selection).length>0:v.blockParagraph||v.list?Rr(bt.selection).length>0:v.link?Cr(b)||V0(bt.selection).length>0||$a(bt.selection)!=null||ha(v,y(),bt.selection):!0,uo=(f,v)=>{const b=rm(f),A=uu(f);return b?.scope!=="id"&&!vn(A)?!1:!Ur(f,A,v)},Ci=(f,v)=>uo(f,v)?ca().then(()=>{}):null,ri=(f,v,b)=>{if(Pe=null,Se=Promise.resolve(!1),be)return!1;const A=he.get(f);if(A)try{return co(A.execute(Ki(v,b)))}catch{return!1}const E=Yk(f);if(E&&typeof I()?.lists?.apply=="function")return q(E,v);const U=rm(f);if(U)return O(U,v);if(f==="copy-format")return co(sU());const Q=uu(f);if(!Q||Q.disposition!=="routed")return!1;const re=Q.normalizePayload?Q.normalizePayload(v):v;if(Q.instanceRoute){if(!S()||!gt(Q,re))return!1;const Ye=t?.[Q.instanceRoute];if(typeof Ye!="function")return!1;try{const Be=Q.fixedArg!==void 0?Q.fixedArg:re;return co(Ye.call(t,Be))}catch{return!1}}if(Q.inline?.kind==="clear")return Q.mutates&&br()==="viewing"?!1:co(tb());const ye=Q.docRoute;if(!ye||Q.mutates&&br()==="viewing")return!1;const Re=y(),ze=gr(Re,ye);if(!ze)return!1;if(Q.inline){const{lockModesById:Ye}=vs(Re?.contentControls,bt.selection);if(Xi(Ye))return!1;const Be=vu(bt.selection);if(!Be)return bt.selection.empty===!1?co(!1):co(am(Q,re));const Ze=ha(Q,Re,bt.selection),He=TH(Q.inline,Be,re,Ze);if(!He)return!1;let Ue=null;try{const je=S(),rt=br(),$e=()=>S()!==je||y()!==Re||br()!==rt?!1:Of(ye,ze,He),Bt=ia(bt.selection)??Ql(bt.selection),Xt=Q.inline.kind==="toggle"?fr(`${Q.id}:${Bt}`,$e):null;Ue=Xt?.release??null;const Nn=Xt?Xt.result:$e(),Gn=_l(Q,bt.selection,He,Nn),Jr=co(Cl(Q,bt.selection,He,Nn),Vr=>{$0(Q,Gn,Vr),Ue?.(),Ue=null});return Q.inline.kind==="toggle"&&(ht=Se),Jr}catch{return Ue?.(),!1}}if(Q.blockParagraph){const Ye=lm(Q,ze,re),Be=Q.blockParagraph.kind==="alignment"&&No(Ye)?D(bt.selection,re):null;return co(Ye,Ze=>{ee(Be,Ze)})}if(Q.list)return co(um(Q,ze));if(Q.link)return co(Ff(re));if(Q.create)return co(At(Q,ze,re));if(Q.table)return co(Gt(Q,ze));try{return co(Q.mutates?hr(ye,ze,re):ze(re))}catch{return!1}},wa=()=>{m+=1,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:h.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const f of p)f("idle");jt()},sU=async()=>{const f=["bold","italic","underline","strikethrough"].filter(ze=>bt.toolbar.commands[ze]?.active===!0),v=await ht;await c;const b=No(v)?f:[],A=500,E=Date.now();if(h.mode!=="idle"){if(h.mode==="armed"&&E-h.lastClickAt<A){h={...h,mode:"persistent",lastClickAt:E};for(const ze of p)ze("persistent");return jt(),!0}return wa(),!1}const U=E-h.lastClickAt<A,Q=++m;h={...h,lastClickAt:E};const re=await ca(),ye=`${Ql(re)}:${Ft()}`,Re=await aU(null,re,ye&&ye===k?g:void 0,b);if(Q!==m)return!0;h={...h,mode:U?"persistent":"armed",snapshot:Re,sourceSelectionKey:Ql(re),lastClickAt:E};for(const ze of p)ze(h.mode);return jt(),!0},aU=async(f,v,b,A=[])=>{const E=v?.target??f?.target;if(!E||E.kind!=="text")return null;const U=Array.isArray(E.segments)?E.segments:[];if(U.length===0)return null;const Q=y();if(!Q)return null;const re=E.story;let ye=null;for(const He of U){const Ue=(await da(mo(He.blockId,re)))?.node??null;if(!Ue)continue;const je=nb(Ue),rt=lU(Array.isArray(je?.inlines)?je.inlines:[],He.range);ye?ye=fA(ye,rt):ye=rt}const Re=ye?Fz(ye):{},ze={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Ye=new Set([...v?.activeMarks??(Array.isArray(f?.activeMarks)?f.activeMarks:[]),...A]);for(const[He,Ue]of Object.entries(ze))Ye.has(He)&&(Re[Ue]=!0);const Be=b??await Iu(v??la(f,"ready"));if(Be.fontFamily&&(Re.fontFamily=Be.fontFamily),Be.color&&(Re.color=Be.color),Be.highlight&&(Re.highlight=Be.highlight),Be.fontSize){const He=Number.parseFloat(Be.fontSize);Number.isNaN(He)||(Re.fontSize=He)}let Ze=null;if(U.length===1){const He=U[0],Ue=(await da(mo(He.blockId,re)))?.node??null;Ue&&nb(Ue)&&(Ze=await cU(Ue,He.blockId,Q,re))}return{story:re??null,inline:Re,paragraph:Ze}},nb=f=>f?f.kind==="paragraph"?f.paragraph??null:f.kind==="heading"?f.heading??null:null:null,lU=(f,v)=>{const b=Q=>{const re=Q.run;return typeof re?.text=="string"?re.text:""},A=Q=>Q.run?.props;if(v.start===v.end){let Q=0;for(const re of f){const ye=b(re),Re=Q,ze=Q+ye.length;if(Q=ze,v.start>=Re&&v.start<=ze){const Ye=A(re);return Ye?{...Ye}:{}}}return{}}let E=0;const U=[];for(const Q of f){const re=b(Q),ye=E,Re=E+re.length;if(E=Re,Re<=v.start||ye>=v.end)continue;const ze=A(Q);ze&&U.push(ze)}return U.length===0?{}:U.length===1?{...U[0]}:fA(U[0],...U.slice(1))},fA=(f,...v)=>{const b={...f};for(const A of v)for(const E of Object.keys(b)){if(!(E in A)){delete b[E];continue}const U=b[E],Q=A[E];(typeof U!=typeof Q||JSON.stringify(U)!==JSON.stringify(Q))&&delete b[E]}return b},cU=async(f,v,b,A)=>{const E=nb(f),U=E.props??{},Q=E.styleRef??null,re=U.alignment??null,ye=U.spacing??null,Re=U.indent??null,ze=Re?{...Re.left!=null?{left:Re.left}:{},...Re.right!=null?{right:Re.right}:{},...Re.firstLine!=null?{firstLine:Re.firstLine}:{},...Re.hanging!=null?{hanging:Re.hanging}:{}}:null,Ye=U.markRunProps??null,Be=U.numbering?.numId,Ze=typeof Be=="string"?parseInt(Be,10):typeof Be=="number"?Be:NaN,He=U.numbering?.level,Ue=isNaN(Ze)?null:{numId:Ze,...He!=null?{level:He}:{}};let je=null;if(Ue&&typeof b.lists?.getState=="function")try{const rt=await b.lists.getState({target:mo(v,A)});rt&&typeof b.lists?.getStyle=="function"&&(je=await b.lists.getStyle(rt)??null)}catch{}return{styleId:Q,alignment:re,spacing:ye,indentation:ze,markRunProps:Ye,numbering:Ue,listStyle:je}},hA=async()=>{if(h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;const f=y()?.selection,v=async()=>Ri(typeof f?.current=="function"?await Promise.resolve(f.current({includeText:!0})):ll().value),b=()=>new Promise(Q=>setTimeout(Q,16)),A=8;let E=null,U="";for(let Q=0;Q<A;Q+=1){if(Q>0&&await b(),h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;if(E=await v(),!(!E||E.empty)&&(U=Ql(E),U!==h.sourceSelectionKey))break}if(E&&!E.empty&&U!==h.sourceSelectionKey){await pA(E);return}if(h.snapshot?.paragraph){const Q=await v();if(!Q||Ql(Q)===h.sourceSelectionKey)return;await pA(Q)}},pA=async f=>{const v=h.snapshot;if(!v){h.mode==="armed"&&wa();return}const b=y();if(!b)return;const A=la(f,"ready"),{lockModesById:E}=vs(b.contentControls,A);if(Xi(E)){jt();return}const U=f.target,Q=f.selectionTarget;if(f.empty!==!0&&Object.keys(v.inline).length>0){const re=gr(b,"format.apply");if(re&&Q)try{if(!No(el(await Promise.resolve(Of("format.apply",re,{target:Q,inline:v.inline},f))))){jt();return}}catch{jt();return}}if(v.paragraph){const re=Array.isArray(U?.segments)?U.segments:[],ye=U?.story;for(const Re of re){const ze=mo(Re.blockId,ye),Ye=await da(ze),Be=Ye?.node??null,Ze=Ye?.address??null;if(!Be)continue;const He={kind:"block",nodeType:Ze?.nodeType??Be.kind??"paragraph",nodeId:Re.blockId,...ye&&typeof ye=="object"?{story:ye}:{}},{styleId:Ue,alignment:je,spacing:rt,indentation:$e,markRunProps:Bt,numbering:Xt,listStyle:Nn}=v.paragraph;if(Ue&&await b.styles?.paragraph?.setStyle?.({target:He,styleId:Ue}),je&&await b.format?.paragraph?.setAlignment?.({target:He,alignment:je}),rt){const Gn=rt,Jr=Gn.lineRule??"auto",Vr=new Set(["auto","exact","atLeast"]).has(Jr)?Jr:"auto",Lr={...Gn.before!=null?{before:Math.round(Gn.before*20)}:{},...Gn.after!=null?{after:Math.round(Gn.after*20)}:{},...Gn.line!=null?{line:Math.round(Vr==="auto"?Gn.line*240:Gn.line*20),lineRule:Vr}:{}};await b.format?.paragraph?.setSpacing?.({target:He,...Lr})}if($e){const Gn={...$e.left!=null?{left:ms($e.left)}:{},...$e.right!=null?{right:ms($e.right)}:{},...$e.firstLine!=null?{firstLine:ms($e.firstLine)}:{},...$e.hanging!=null?{hanging:ms($e.hanging)}:{}};await b.format?.paragraph?.setIndentation?.({target:He,...Gn})}Bt&&await b.format?.paragraph?.setMarkRunProps?.({target:He,markRunProps:Bt}),Xt&&await b.format?.paragraph?.setNumbering?.({target:He,...Xt}),Nn&&((await da(ze))?.address?.nodeType==="listItem"?await b.lists?.applyStyle?.({target:eA(Re.blockId,ye),style:Nn}):Xt&&await b.format?.paragraph?.setNumbering?.({target:He,...Xt}))}}h.mode==="armed"&&wa(),jt()},fm=(f,v,b)=>{const A=Ci(f,v),E=A?A.then(()=>(ri(f,v,b),Se)):(ri(f,v,b),Se);return uu(f)?.inline?.kind==="toggle"&&(ht=E),E},mA=f=>({id:f,getState:()=>bt.toolbar.commands[f]??Ru(f,y(),bt.selection,pl(bt.selection)),observe:v=>Go(b=>b.toolbar.commands[f]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:at.commandUnsupported}).subscribe(v),execute:v=>ri(f,v),executeAsync:v=>fm(f,v)}),uU=f=>{he.set(f.id,f),jt();const v=()=>{he.delete(f.id),jt()};return Object.assign(v,{handle:mA(f.id),unregister:v})},hm=lo(f=>f.selection),pm=Qr(hm),gA=()=>{const f=T();if(typeof f?.getHandles!="function")return{reason:at.hostCapabilityUnavailable};let v=null;try{v=f.getHandles()}catch(A){const E=A?.reason;return{reason:E==="host-not-ready"||E==="host-disposed"||E==="editing-mount-required"?at.notReady:at.hostCapabilityUnavailable}}const b=v?.editing?.selectionTargets;return typeof b?.apply!="function"?{reason:at.hostCapabilityUnavailable}:{helper:b}},vA={get:pm.get,getSnapshot:pm.getSnapshot,subscribe:pm.subscribe,observe:pm.observe,current:()=>ll().value,capture:()=>{const f=hm.get();return f.empty||!f.target&&!f.selectionTarget?null:{...f,capturedAt:Date.now()}},restore:f=>{const v=E=>(jt(),{...E,success:E.ok});if(!f||typeof f!="object")return v({ok:!1,reason:at.targetUnresolved});if(!S())return v({ok:!1,reason:at.notReady});const b=EH(f);if(!b)return v({ok:!1,reason:at.targetUnresolved});const A=gA();if(!("helper"in A))return v({ok:!1,reason:A.reason});try{return v(qk(A.helper.apply(b)))}catch{return v({ok:!1,reason:at.hostCapabilityUnavailable})}},apply:f=>{if(!S())return{ok:!1,reason:at.notReady};const v=gA();if(!("helper"in v))return{ok:!1,reason:v.reason};try{const b=v.helper.apply(f);return jt(),qk(b)}catch{return{ok:!1,reason:at.hostCapabilityUnavailable}}},getAnchorRect:f=>{const v=T();if(typeof v?.getSelectionAnchorRect=="function"){const b=Tt(()=>v.getSelectionAnchorRect(f),null);return b&&typeof b=="object"&&(Number(b.width)>0||Number(b.height)>0)?b:null}return null},getRects:f=>{const v=hm.get(),b=v.selectionTarget??v.target;if(v.empty||!b)return[];const A=km.getRect({target:b,relativeTo:f?.relativeTo});return A.found?A.rects:[]}},dU={get ids(){return it()},has:f=>uu(f)!=null||he.has(f),get:f=>mA(f),execute:ri,executeAsync:fm,register:uU,getContextMenuItems:f=>{const v=[];for(const b of he.values()){const A=b.contextMenu;A&&Tt(A.when?()=>A.when(f):void 0,!0)&&v.push({id:b.id,label:A.label,group:A.group,order:A.order,invoke:()=>ri(b.id,void 0,f)})}return v.sort((b,A)=>(b.order??0)-(A.order??0)||b.label.localeCompare(A.label))}},rb=Qr(lo(f=>f.toolbar)),fU={get:rb.get,getSnapshot:()=>bt.toolbar,subscribe:rb.subscribe,observe:rb.observe,execute:ri,executeAsync:fm},mc=async(f,v)=>{if(!S())return{success:!1,ok:!1,reason:at.notReady};if(!f)return{success:!1,ok:!1,reason:at.targetUnresolved};const b=T(),A=b?.scrollTargetIntoView;if(typeof A!="function")return{success:!1,ok:!1,reason:at.hostCapabilityUnavailable};try{const E=await Promise.resolve(A.call(b,{target:f,block:v?.block??"center",behavior:v?.behavior??"smooth"}));return E&&typeof E=="object"&&E.success===!1?{success:!1,ok:!1,reason:z0(E.reason,at.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:at.hostCapabilityUnavailable}}},mm=async(f,v,b,A)=>{const E=f==="trackChanges"?A?.story:void 0,U=ze=>{if(!E||!ze||typeof ze!="object")return ze;const Ye=ze,Be=Ye.address&&typeof Ye.address=="object"?Ye.address:null;return Ye.story||Be?.story?ze:{...Ye,story:E}},Q=H0(b.find(ze=>Ja(ze,v,E)));if(Q)return U(Q);const re=y()?.[f],ye=f==="comments"?{commentId:v}:{id:v,...E?{story:E}:{}},Re=re?.get;if(typeof Re!="function")return null;try{return U(H0(await Promise.resolve(Re.call(re,ye))))}catch{return null}};function yA(f,v){if(bi())return ar("Comments are read-only.","DOCUMENT_READONLY");if(yu())return ar("Resolving comments is disabled.","DOCUMENT_READONLY");const b=y()?.comments,A=b?.patch;if(typeof A!="function")return ar("comments.patch is unavailable.");const E=ar("comments.patch failed.");return Tt(()=>ba(A.call(b,{commentId:f,status:v}),E),E)}const gm=()=>bi()?ar("Comments are read-only.","DOCUMENT_READONLY"):null,bA=(f,v)=>{const b=v&&typeof v=="object"?v:null;let A=Array.from(f);b?.includeResolved===!1&&(A=A.filter(ye=>ye.status!=="resolved"));const E=Number(b?.offset),U=Number.isInteger(E)&&E>0?E:0,Q=Number(b?.limit),re=Number.isInteger(Q)&&Q>=0?U+Q:void 0;return A.slice(U,re)},Bu=lo(f=>f.comments),vm=Qr(Bu),hU={get:vm.get,getSnapshot:vm.getSnapshot,subscribe:vm.subscribe,observe:vm.observe,list:f=>{const v=Bu.get();if(v.status!=="pending")return bA(v.items,f);const b=y()?.comments,A=Tt(b?.list?()=>b.list(f):void 0,null);return Or(A)?[]:bA(Array.isArray(A?.items)?A.items:[],f)},getById:f=>{const v=Bu.get().items.find(E=>Hn(E)===f)??null;if(v)return v;const b=y()?.comments,A=Tt(b?.get?()=>b.get({commentId:f}):void 0,null);return Or(A)?null:A},createFromCapture:(f,v)=>{const b=gm();if(b)return b;const A=y()?.comments,E=A?.create;if(typeof E!="function")return ar("comments.create is unavailable.");const U=ar("comments.create failed.");return Tt(()=>ba(E.call(A,{target:f.target??f.selectionTarget,text:v.text}),U),U)},createFromSelection:f=>{const v=gm();if(v)return v;const b=y()?.comments,A=b?.create;if(typeof A!="function")return ar("comments.create is unavailable.");const E=hm.get(),U=E.target??E.selectionTarget;if(E.empty||!U)return ar("A range selection is required to comment.","NO_SELECTION");const Q=ar("comments.create failed.");return Tt(()=>ba(A.call(b,{target:U,text:f.text}),Q),Q)},reply:(f,v)=>{const b=gm();if(b)return b;const A=y()?.comments,E=A?.reply??A?.create;if(typeof E!="function")return ar("comments.reply is unavailable.");const U=ar("comments.reply failed.");return Tt(()=>ba(E===A?.reply?E.call(A,{parentCommentId:f,text:v.text}):E.call(A,{parentCommentId:f,text:v.text}),U),U)},resolve:f=>yA(f,"resolved"),reopen:f=>yA(f,"active"),delete:f=>{const v=gm();if(v)return v;const b=y()?.comments,A=b?.delete??b?.remove;if(typeof A!="function")return ar("comments.delete is unavailable.");const E=ar("comments.delete failed.");return Tt(()=>ba(A.call(b,{commentId:f}),E),E)},setActive:f=>{if(f==null)return ge=null,jt(),!0;if(!S())return!1;const v=Bu.get();if(v.listStatus!=="ready")return!1;const b=lH(v.items,f);return!b||!v.items.some(A=>Hn(A)===b)?!1:(ge=b,jt(),!0)},scrollTo:async f=>{if(!y())return{success:!1,ok:!1,reason:S()?at.documentApiUnavailable:at.notReady};const v=await mm("comments",f,Bu.get().items);return v?mc(v):{success:!1,ok:!1,reason:at.targetUnresolved}}},Ca=lo(f=>f.trackChanges),ob=(f,v)=>{const b=Ca.get().items.filter(Re=>Hn(Re)!==null);if(b.length===0)return null;const A=bt.trackChanges.activeId,E=ae?.id===A?ae.story:void 0;let U=A?b.findIndex(Re=>Ja(Re,A,E)):-1;U===-1&&A&&E&&(U=b.findIndex(Re=>Ja(Re,A)));const Q=b[U===-1?f>0?0:b.length-1:(U+f+b.length)%b.length],re=Hn(Q),ye=Qk(Q);return Je(ye?{id:re,story:ye}:{id:re},v),jt(),re};let wA=Promise.resolve();const pU=f=>{const v=oe;return wA.catch(()=>{}).then(()=>mU(f,v))},mU=async(f,v)=>{if(oe!==v)return{success:!1};const b=ae,A=ob(f,{invalidateQueuedNavigation:!1});if(A==null)return{success:!1};const E=ae,U=_e,Q=()=>ae===E&&_e===U,re=()=>{Q()&&(Je(b,{invalidateQueuedNavigation:!1}),jt())},ye=await mm("trackChanges",A,Ca.get().items,E?.story?{story:E.story}:void 0);if(!Q())return{success:!1};if(!ye)return re(),{success:!1};ao+=1;try{const Re=await mc(ye,{behavior:"auto"});return Q()?(!Re.ok&&Re.reason!==at.targetNotVisible?(re(),Ge(b)):Ge(E),{success:Re.ok}):{success:!1}}finally{ao=Math.max(0,ao-1),ao===0&&(Q()?zr&&Po(Pi(zr)):Ge(ae))}},CA=f=>{const v=pU(f);return wA=v.then(()=>{},()=>{}),v},ym=Qr(Ca),gU={get:()=>(Fr(),ym.get()),getSnapshot:()=>(Fr(),ym.getSnapshot()),subscribe:f=>(Fr(),ym.subscribe(f)),observe:f=>(Fr(),ym.observe(f)),list:()=>(Fr(),Ca.get().items),accept:f=>_A("accept",f),reject:f=>_A("reject",f),acceptAll:()=>Nu("accept",{scope:"all"},null),rejectAll:()=>Nu("reject",{scope:"all"},null),next:()=>ob(1),previous:()=>ob(-1),navigateNext:()=>CA(1),navigatePrevious:()=>CA(-1),getAt:f=>{if(!f||typeof f!="object"||typeof f.x!="number"||typeof f.y!="number")return null;const v=sb(f);if(v.length===0)return null;const b=Ca.get().items;let A;for(const E of v){if(E.type!=="trackedChange")continue;let U;if(E.story){if(A===void 0&&(A=Lo()),!A)continue;U=A}else U=b;const Q=U.find(re=>Ja(re,E.id,E.story));if(Q)return E.story?{id:Q.id,item:Q,story:E.story}:{id:Q.id,item:Q}}return null},setActive:f=>{if(f==null)return Je(null),Ge(null),jt(),!0;if(!S())return!1;const v=typeof f=="string"?{id:f}:{id:f.id,story:f.story};if(typeof v.id!="string"||v.id.length===0)return!1;const b=v.id;if(v.story){const A=Lo();if(!A)return!1;const E=$k(A,v.story).toPublicId(v.id)??v.id;if(!A.some(U=>Ja(U,E,v.story)))return!1;v.id=E}else{const A=Ca.get().items,E=em(A).toPublicId(v.id)??v.id;if(!A.some(U=>Hn(U)===E))return!1;v.id=E}return b!==v.id&&(v.paintedEntityId=b),Je(v),Ge(v),jt(),!0},scrollTo:async f=>{if(!y())return{success:!1,ok:!1,reason:S()?at.documentApiUnavailable:at.notReady};const v=Ca.get().items,b=Qk(v.find(ze=>Hn(ze)===f)),A=await mm("trackChanges",f,v,b?{story:b}:void 0);if(!A)return{success:!1,ok:!1,reason:at.targetUnresolved};const E=ae,U=b?{id:f,story:b}:{id:f};Je(U),jt();const Q=ae,re=_e,ye=()=>ae===Q&&_e===re,Re=()=>{ye()&&(Je(E,{invalidateQueuedNavigation:!1}),jt())};ao+=1;try{const ze=await mc(A,{behavior:"auto"});return ye()?(!ze.ok&&ze.reason!==at.targetNotVisible?(Re(),Ge(E)):Ge(U),ze):{success:!1,ok:!1}}finally{ao=Math.max(0,ao-1),ao===0&&(ye()?zr&&Po(Pi(zr)):Ge(ae))}}},_A=(f,v)=>{const{id:b,story:A}=typeof v=="string"?{id:v,story:void 0}:v;return Nu(f,{kind:"id",id:b,...A?{story:A}:{}},b,A)},Nu=(f,v,b,A)=>{try{return co(vU(f,v,b,A))}catch{return!1}},vU=(f,v,b,A)=>{if(bi())return!1;const E=y()?.trackChanges,U=v.scope==="all",Q=v.kind==="range",re=v.kind==="ids";if(ic({kind:f,scope:U?"all":"id"},E))return!1;const ye=U?`${f}All`:f,Re=!Q&&!re&&!A&&E&&typeof E[ye]=="function"?E[ye]:null,ze=E&&typeof E.decide=="function"?E.decide:null;return!Re&&!ze?!1:Re?Re.call(E,b??{}):ze.call(E,{decision:f,target:v})},ib=lo(f=>f.contentControls),Bf=f=>ib.get().items.find(v=>v?.id===f)??null,bm=Qr(ib),yU=(f=>{if(f===void 0)return bm.get();const v=$p(f);return v?Bf(v):null}),bU={get:(f=>(f!==void 0&&cn("api"),yU(f))),getSnapshot:bm.getSnapshot,subscribe:bm.subscribe,observe:bm.observe,list:()=>(cn("api"),ib.get().items),getById:f=>(cn("api"),Bf(f)),getRect:f=>{const v=$p(f);if(!v)return tl("unresolved");cn("panel");const b=Bf(v);if(!b)return tl("unresolved");const A=U0(b);return A?km.getRect({target:A}):tl("unavailable")},scrollIntoView:async f=>{const v=$p(f);if(!v)return{success:!1};cn("panel");const b=Bf(v);if(!b)return{success:!1};const A=U0(b);return A?{success:(await mc(A,{block:f.block,behavior:f.behavior})).ok}:{success:!1}},focus:async f=>{const v=$p(f);if(!v)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};cn("panel");const b=Bf(v);if(!b)return{success:!1,reason:"not-found"};const A=U0(b);if(!A)return{success:!1,reason:"not-reachable"};if(!(await mc(A,{block:f.block,behavior:f.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=iH(A);if(!E)return{success:!1,reason:"not-reachable"};const U=vA.apply(E);return!U.ok&&U.reason!==at.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:{success:!0}}},wm=Qr(lo(f=>f.fonts)),wU={get:wm.get,getSnapshot:wm.getSnapshot,subscribe:wm.subscribe,observe:wm.observe,getFamilyOptions:()=>bt.fonts.options,getSizeOptions:()=>bt.fonts.sizeOptions},Cm=Qr(lo(f=>f.zoom)),CU={get:Cm.get,getSnapshot:Cm.getSnapshot,subscribe:Cm.subscribe,observe:Cm.observe,set:f=>{if(typeof t?.setZoom=="function")try{t.setZoom(f),jt()}catch{}},setMode:f=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(f),jt()}catch{}}},_m=Qr(lo(f=>f.document)),_U={get:_m.get,getSnapshot:_m.getSnapshot,subscribe:_m.subscribe,observe:_m.observe,setMode:f=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(f),jt()}catch{}},export:f=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(f))}catch{return}},getText:()=>{const f=y(),v=Tt(f?.getText?()=>f.getText({}):void 0,null);return typeof v=="string"?v:v&&typeof v=="object"&&typeof v.text=="string"?v.text:null},replaceFile:f=>{const v=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof v=="function")try{return Promise.resolve(v.call(t,f))}catch{return}}},SA=()=>{if(typeof HTMLElement>"u")return null;const f=S()?.mount?.container;if(f instanceof HTMLElement)return f;const v=t?.element;return v instanceof HTMLElement?v:null},SU=(f,v)=>{if(typeof f!="number"||typeof v!="number"||!Number.isFinite(f)||!Number.isFinite(v))return[];const b=globalThis.document;if(!b||typeof b.elementFromPoint!="function")return[];const A=SA();if(!A)return[];const E=b.elementFromPoint(f,v);if(!E||!A.contains(E))return[];const U=[E],Q=$e=>{$e&&A.contains($e)&&!U.includes($e)&&U.push($e)},re=b.elementsFromPoint;if(typeof re=="function"){let $e=[];try{$e=re.call(b,f,v)??[]}catch{$e=[]}for(const Bt of $e)Q(Bt)}const ye=[],Re=$e=>{$e&&A.contains($e)&&!ye.includes($e)&&!U.includes($e)&&ye.push($e)},ze=$e=>{const Bt=$e.getBoundingClientRect;if(typeof Bt!="function")return!1;let Xt;try{Xt=Bt.call($e)}catch{return!1}return Xt!=null&&f>=Xt.left&&f<=Xt.right&&v>=Xt.top&&v<=Xt.bottom};for(const $e of U){const Bt=$e.querySelectorAll;if(typeof Bt!="function")continue;let Xt;try{Xt=Bt.call($e,"[data-track-change-marker]")}catch{continue}for(let Nn=0;Nn<Xt.length;Nn+=1)ze(Xt[Nn])&&Re(Xt[Nn])}ye.reverse();const Ye=[...ye,...U],Be=Wk(Ye[0],A);for(let $e=1;$e<Ye.length;$e+=1)for(const Bt of Wk(Ye[$e],A))Be.push(Bt);if(Be.length===0)return Be;const Ze=Ca.get().items,He=em(Ze);let Ue;const je=new Set,rt=[];for(const $e of Be){if($e.type!=="trackedChange"){const Gn=`${$e.type}:${$e.id}`;if(je.has(Gn))continue;je.add(Gn),rt.push($e);continue}const Bt=oH($e.storyKey)??rH($e.story);let Xt;if(Bt){if(Ue===void 0&&(Ue=Lo()),!Ue||(Xt=$k(Ue,Bt).toPublicId($e.id),!Xt||!Ue.some(Gn=>Ja(Gn,Xt,Bt))))continue}else if(Xt=He.toPublicId($e.id),!Xt)continue;const Nn=`trackedChange:${Xt}`;je.has(Nn)||(je.add(Nn),rt.push(Bt?{type:"trackedChange",id:Xt,story:Bt}:{type:"trackedChange",id:Xt}))}return rt};function sb(f,v){return typeof f=="object"?SU(f?.x,f?.y):null}const zu=new Set;let ab=!1;const kA=f=>{const v=T();if(typeof v?.observeGeometry!="function")return;let b=!1;const A=Tt(()=>{const E=v.observeGeometry(()=>f.schedule());return b=!0,E},null);f.detach=typeof A=="function"?A:null,f.boundHost=b?v:null},Sm=f=>{if(f.detach){try{f.detach()}catch{}f.detach=null}f.boundHost=null},AA=()=>{if(ab=!1,!(be||T()))for(const f of zu)Sm(f)},kU=()=>{if(!ab){if(ab=!0,typeof queueMicrotask=="function"){queueMicrotask(AA);return}Promise.resolve().then(AA)}},AU=()=>{const f=T();if(!f){kU();return}for(const v of zu)v.boundHost&&v.boundHost===f||(Sm(v),kA(v),v.schedule())};_s.push(AU);const km={getRect:f=>{const v=T(),b=v?.getTargetRects;if(typeof b=="function"){const A=Tt(()=>b.call(v,{target:f.target}),null);return A&&typeof A=="object"?A.success===!0&&Array.isArray(A.rects)?AH(kH(A.rects.filter(E=>E!=null&&typeof E=="object")),f.relativeTo):tl(typeof A.reason=="string"?A.reason:"unresolved"):tl("unresolved")}return tl("unavailable")},observe:f=>{const v=[];let b=0;const A=typeof requestAnimationFrame=="function",E=()=>{if(!A){f();return}b||(b=requestAnimationFrame(()=>{b=0,f()}))},U=Go(re=>({ready:re.ready,selection:re.selection,zoom:re.zoom}));v.push(U.subscribe(()=>E()));const Q={schedule:E,detach:null,boundHost:null};return kA(Q),zu.add(Q),()=>{zu.delete(Q),Sm(Q),b&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(b);for(const re of v.splice(0))try{re()}catch{}}},getHost:()=>SA(),entityAt:sb,contextAt:f=>{const v=!!f&&typeof f.x=="number"&&typeof f.y=="number",b=v?f.x:0,A=v?f.y:0;return{point:{x:b,y:A},entities:v?sb({x:b,y:A}):[],selection:bt.selection,position:null,insideSelection:!1}},scrollIntoView:async f=>{const v=f?.target;if(!v)return{success:!1};let b=null;if(v.kind==="entity"){const A=v.entityType==="comment"?"comments":"trackChanges",E=A==="comments"?Bu.get().items:Ca.get().items,U=v.entityType==="trackedChange"&&v.story?{story:v.story}:void 0;b=await mm(A,v.entityId,E,U)}else{const A=v,E=v,U=Array.isArray(A.segments)&&A.segments.length>0?A.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(U){const Q=v.story;b={kind:"text",segments:U,...Q?{story:Q}:{}}}}return b?{success:(await mc(b,{block:f.block??"center",behavior:f.behavior??"smooth"})).ok}:{success:!1}}},IA=f=>{const v=(f&&typeof f=="object"?f:null)?.target;return v&&typeof v=="object"?v:null},EA=f=>`metadata:resolve:${f}`,IU=f=>{const v=y()?.metadata;if(!v||typeof v.resolve!="function")return null;const{value:b}=Yn(EA(f),Ft(),()=>v.resolve({id:f}),IA);return b},EU=async f=>{const v=y()?.metadata;if(!v||typeof v.resolve!="function")return null;try{const b=Ft(),A=await Promise.resolve(v.resolve({id:f}));if(b!==Ft())return null;const E=IA(A);return Le.set(EA(f),{token:b,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},xU={getRect:f=>{const v=y()?.metadata;if(!v||typeof v.resolve!="function")return tl("unavailable");const b=IU(f.id);return b?km.getRect({target:b}):tl("unresolved")},scrollIntoView:async f=>{const v=await EU(f.id);return v?{success:(await mc(v,{block:f.block,behavior:f.behavior})).ok}:{success:!1}}},TU={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},RU={getContext:()=>{const f=Ne();if(!f)return{...TU};const v=fe()?.table;return{inTable:!0,tableNodeId:f.tableNodeId,rowIndex:f.rowIndex,columnIndex:f.columnIndex,cellNodeId:f.cellNodeId,rows:typeof v?.rows=="number"?v.rows:null,columns:typeof v?.columns=="number"?v.columns:null}},isInTable:()=>Ne()!=null},Am={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeDeletedText:!1,regex:!1,canReplace:!1,reason:at.searchUnavailable};let xn={...Am};const Im=new Set,_a=()=>{const f=T()?.search;return f&&typeof f=="object"?f:null},Ss=()=>{const f=I()?.search;return f&&typeof f=="object"?f:null},Nf=()=>{const f=_a();if(f&&typeof f.setSession=="function")return!0;const v=Ss();return!!v&&typeof v.query=="function"&&typeof v.getState=="function"},Zi=()=>{for(const f of[...Im])try{f(xn)}catch{}},oi=f=>(xn={...xn,...f},Zi(),xn);let Zr=0,gc=null;const xA=()=>{const f=gc;gc=null,f&&Tt(()=>(f(),null),null)},MU=()=>{Zr+=1,xA();const f=Nf();xn={...Am,available:f,reason:f?void 0:at.searchUnavailable},Zi()};Pu.push(MU);const LU=f=>{if(!f)return!1;const v=f.queryError;if(v&&typeof v=="object"&&v.code==="invalid-pattern")return!0;const b=f.rejection;return f.status==="rejected"&&!!b&&typeof b=="object"&&b.code==="invalid-pattern"},lb=(f,v=!1)=>{const b=f&&typeof f=="object"?f:null;if(!b)return null;const A=Array.isArray(b.matches)?b.matches:[],E=typeof b.total=="number"&&Number.isFinite(b.total)?b.total:A.length,U=typeof b.activeMatchIndex=="number"?b.activeMatchIndex:typeof b.activeIndex=="number"?b.activeIndex:-1;return{...typeof b.query=="string"?{query:b.query}:{},total:E,activeIndex:U,canReplace:b.canReplace===!0||v,...b.includeDeletedText===!0?{includeDeletedText:!0}:{},...b.regex===!0?{regex:!0}:{},...LU(b)?{invalidPattern:!0}:{}}},wo=()=>{const f=L("find.replace"),v=L("find.replaceAll");return f?.enabled===!0||v?.enabled===!0},Co=(f,v=!1)=>{const b=lb(f,v);if(!b){oi({total:0,activeIndex:-1,canReplace:!1,reason:void 0});return}oi({...b.query!==void 0?{query:b.query}:{},total:b.total,activeIndex:b.activeIndex,canReplace:b.canReplace,...b.includeDeletedText!==void 0?{includeDeletedText:b.includeDeletedText}:{},...b.regex!==void 0?{regex:b.regex}:{},reason:b.invalidPattern?at.searchInvalidPattern:void 0})},Sa=()=>{const f=_a();if(f&&typeof f.getState!="function")return xn={...xn,available:Nf(),reason:Nf()?void 0:at.searchUnavailable},xn;if(!f){const b=Ss();if(b&&typeof b.getState=="function"){const A=lb(Tt(()=>b.getState(),null),wo());if(A)return xn={...xn,...A.query!==void 0?{query:A.query}:{},total:A.total,activeIndex:A.activeIndex,canReplace:A.canReplace,available:!0,reason:A.invalidPattern?at.searchInvalidPattern:void 0,open:xn.open||!!A.query},xn}return xn={...Am,query:xn.query,caseSensitive:xn.caseSensitive,includeDeletedText:xn.includeDeletedText},xn}const v=lb(Tt(()=>f.getState(),null));return v&&(xn={...xn,...v.query!==void 0?{query:v.query}:{},total:v.total,activeIndex:v.activeIndex,canReplace:v.canReplace,...v.includeDeletedText!==void 0?{includeDeletedText:v.includeDeletedText}:{},...v.regex!==void 0?{regex:v.regex}:{},available:!0,reason:v.invalidPattern?at.searchInvalidPattern:void 0,open:xn.open||!!v.query}),xn},Hu=f=>{const v=f&&typeof f=="object"?f:null;if(v?.status==="committed")return{ok:!0};if(v?.status==="rejected"&&v.reason==="read-only")return{ok:!1,reason:at.documentReadonly};const b=v?.rejection;return v?.status==="rejected"&&b&&typeof b=="object"&&b.code==="read-only-document"?{ok:!1,reason:at.documentReadonly}:{ok:!1,reason:at.operationUnavailable}},Em=Qr({get:()=>Sa(),subscribe:f=>(Im.add(f),()=>Im.delete(f))}),DU={get:Em.get,getSnapshot:Em.getSnapshot,subscribe:Em.subscribe,observe:Em.observe,open:()=>Nf()?(oi({available:!0,open:!0,reason:void 0}),{ok:!0}):(oi({available:!1,open:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}),close:()=>{if(Zr+=1,gc)xA();else{const f=_a();if(f&&typeof f.clear=="function")Tt(()=>f.clear(),null);else{const v=Ss();v&&typeof v.query=="function"&&Tt(()=>v.query({query:""}),null)}}xn={...Am,available:Nf(),reason:void 0},xn.available||(xn.reason=at.searchUnavailable),Zi()},search:(f,v)=>{const b=_a(),A=!!v?.caseSensitive,E=v?.includeDeletedText===!0,U=v?.regex===!0,Q=++Zr;if(!b||typeof b.setSession!="function"){const re=Ss();if(re&&typeof re.query=="function"&&typeof re.getState=="function"){oi({query:f,caseSensitive:A,includeDeletedText:E,regex:U,available:!0,open:!0,reason:void 0}),gc=()=>{re.query({query:""})};const ye=Tt(()=>re.query({query:f,caseSensitive:A,includeDeletedText:E,regex:U}),null);return Or(ye)?Promise.resolve(ye).then(Re=>{Q===Zr&&Co(Re,wo())},()=>{Q===Zr&&oi({available:!1,reason:at.searchUnavailable})}):Co(ye,wo()),Co(Tt(()=>re.getState(),null),wo()),xn}return oi({query:f,total:0,activeIndex:-1,available:!1,caseSensitive:A,includeDeletedText:E,regex:U,reason:at.searchUnavailable})}if(oi({query:f,caseSensitive:A,includeDeletedText:E,regex:U,available:!0,open:!0,reason:void 0}),gc=()=>{typeof b.clear=="function"&&b.clear()},Co(Tt(()=>b.setSession(f,{caseSensitive:A,includeDeletedText:E,...U?{regex:!0}:{},highlight:!0}),null)),f.length>0&&xn.total===0&&xn.reason!==at.searchInvalidPattern){const re=Ss();if(re&&typeof re.query=="function"&&typeof re.getState=="function"){const ye=gc;gc=()=>{ye?.(),re.query({query:""})};const Re=Tt(()=>re.query({query:f,caseSensitive:A,includeDeletedText:E,regex:U}),null);Or(Re)?Promise.resolve(Re).then(ze=>{Q===Zr&&Co(ze,wo())},()=>{Q===Zr&&oi({available:!1,reason:at.searchUnavailable})}):Co(Re,wo()),Co(Tt(()=>re.getState(),null),wo())}}return xn},next:()=>{const f=_a();if(!f||typeof f.next!="function"){const v=Ss();if(!v||typeof v.next!="function"||typeof v.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(xn.total===0)return{ok:!1,reason:at.operationUnavailable};const b=Tt(()=>v.next(),null);if(Or(b)){const A=Zr;Promise.resolve(b).then(E=>{A===Zr&&Co(E,wo())}).catch(()=>{A===Zr&&oi({available:!1,reason:at.searchUnavailable})})}else Co(b,wo());return Co(Tt(()=>v.getState(),null),wo()),{ok:!0}}return xn.total===0?{ok:!1,reason:at.operationUnavailable}:(Co(Tt(()=>f.next(),null)),{ok:!0})},previous:()=>{const f=_a();if(!f||typeof f.previous!="function"){const v=Ss();if(!v||typeof v.previous!="function"||typeof v.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(xn.total===0)return{ok:!1,reason:at.operationUnavailable};const b=Tt(()=>v.previous(),null);if(Or(b)){const A=Zr;Promise.resolve(b).then(E=>{A===Zr&&Co(E,wo())}).catch(()=>{A===Zr&&oi({available:!1,reason:at.searchUnavailable})})}else Co(b,wo());return Co(Tt(()=>v.getState(),null),wo()),{ok:!0}}return xn.total===0?{ok:!1,reason:at.operationUnavailable}:(Co(Tt(()=>f.previous(),null)),{ok:!0})},clear:()=>{Zr+=1;const f=_a();if(f&&typeof f.clear=="function"&&Tt(()=>f.clear(),null),!f||typeof f.clear!="function"){const v=Ss();v&&typeof v.query=="function"&&Tt(()=>v.query({query:""}),null)}oi({query:"",total:0,activeIndex:-1,canReplace:!1})},replace:f=>{const v=_a();if(!v){const A=Ss();if(!A||typeof A.replace!="function"||typeof A.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(!wo())return{ok:!1,reason:at.operationUnavailable};const E=Tt(()=>A.replace({replacement:typeof f=="string"?f:""}),null);if(Or(E)){const U=Zr;Sa(),Zi();const Q=()=>U===Zr;return Promise.resolve(E).then(re=>(Q()&&(Co(re,wo()),Sa(),Zi()),Hu(re)),()=>(Q()&&oi({available:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}))}return Sa(),Zi(),Hu(E)}if(typeof v.replaceCurrent!="function")return{ok:!1,reason:at.operationUnavailable};const b=Tt(()=>v.replaceCurrent(typeof f=="string"?f:""),null);return Sa(),Zi(),Hu(b)},replaceAll:f=>{const v=_a();if(!v){const A=Ss();if(!A||typeof A.replaceAll!="function"||typeof A.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(!wo())return{ok:!1,reason:at.operationUnavailable};const E=Tt(()=>A.replaceAll({replacement:typeof f=="string"?f:""}),null);if(Or(E)){const U=Zr;Sa(),Zi();const Q=()=>U===Zr;return Promise.resolve(E).then(re=>(Q()&&(Co(re,wo()),Sa(),Zi()),Hu(re)),()=>(Q()&&oi({available:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}))}return Sa(),Zi(),Hu(E)}if(typeof v.replaceAll!="function")return{ok:!1,reason:at.operationUnavailable};const b=Tt(()=>v.replaceAll(typeof f=="string"?f:""),null);return Sa(),Zi(),Hu(b)}},TA=lo(f=>f.styles),xm=Qr(TA),PU={get:xm.get,getSnapshot:xm.getSnapshot,subscribe:xm.subscribe,observe:xm.observe,getCatalog:f=>Dn(f).value,getQuickGallery:()=>TA.get().quickGallery,getActiveParagraphStyle:()=>yo(bt.selection,Fn().cache).style},RA={select:Go,get state(){return bt},selection:vA,commands:dU,toolbar:fU,comments:hU,trackChanges:gU,contentControls:bU,fonts:wU,zoom:CU,document:_U,viewport:km,metadata:xU,tables:RU,search:DU,styles:PU,formatPainter:{setPointerSelecting(f){be||(h={...h,pointerSelecting:f})},notifyPointerUp(){be||(h={...h,pointerSelecting:!1},hA())},setKeyboardSelecting(f){be||(h={...h,keyboardSelecting:f})},notifyKeyUp(){be||(h={...h,keyboardSelecting:!1},hA())},cancel(){be||wa()},onModeChange(f){return be?()=>{}:(p.add(f),()=>p.delete(f))}},createScope:()=>{const f=[];return{select:(v,b)=>{const A=Go(v,b);return{get:A.get,subscribe:E=>{const U=A.subscribe(E);return f.push(U),U}}},dispose:()=>{for(const v of f.splice(0))v()}}},destroy:()=>{if(!be){be=!0,Yt.reset(),ln(),G&&(clearTimeout(G),G=null),j&&(clearTimeout(j),j=null,V=0),$?.timer&&(clearTimeout($.timer),$.timer=null),$=null,W&&(clearTimeout(W),W=null),qr&&(clearTimeout(qr),qr=null),ft&&ft(),ft=null,Fe=null,lr.clear(),J.clear();for(const f of Mn.splice(0))f();Lt&&Lt(),Lt=null,mt=null,Nr&&Nr(),Nr=null,Pn=null,ti&&ti(),ti=null,zr=null,wi&&wi(),wi=null,Li=null,Mr&&Mr(),Mr=null,ma=null;for(const f of zu)Sm(f);zu.clear(),_t.clear(),Im.clear(),m+=1,p.clear(),Zr+=1,he.clear()}}};return Ve=RA,RA}var DH=[{value:"Arial",label:"Arial",previewFamily:"Arial, sans-serif"},{value:"Calibri",label:"Calibri",previewFamily:"Calibri, sans-serif"},{value:"Courier New",label:"Courier New",previewFamily:'"Courier New", monospace'},{value:"Georgia",label:"Georgia",previewFamily:"Georgia, serif"},{value:"Times New Roman",label:"Times New Roman",previewFamily:'"Times New Roman", serif'},{value:"Verdana",label:"Verdana",previewFamily:"Verdana, sans-serif"}];function PH(e){const t=e.trim(),n=t[0];if(n==='"'||n==="'"){const o=t.indexOf(n,1);if(o>0)return t.slice(1,o).trim()}const r=t.indexOf(",");return(r===-1?t:t.slice(0,r)).trim().replace(/^["']|["']$/g,"")}function OH(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.logicalFamily=="string"?PH(r.logicalFamily):"";if(!o)continue;const i=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:o,previewFamily:i})}return t}function FH(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.value=="string"?r.value.trim():"";if(!o)continue;const i=typeof r.label=="string"&&r.label.trim()?r.label.trim():o,s=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:i,previewFamily:s})}return t}function BH(e,t=[]){const n=[],r=new Set,o=s=>{const a=String(s.value).trim().toLowerCase();!a||r.has(a)||(r.add(a),n.push(s))};for(const s of e)o(s);const i=t.length?t:DH;for(const s of i)o(s);return n}var NH=[{value:"8",label:"8"},{value:"9",label:"9"},{value:"10",label:"10"},{value:"11",label:"11"},{value:"12",label:"12"},{value:"14",label:"14"},{value:"16",label:"16"},{value:"18",label:"18"},{value:"24",label:"24"},{value:"36",label:"36"}];function zH(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}It();var HH=Object.freeze(["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F1948A","#82E0AA","#F8C471","#AED6F1","#D7BDE2","#A3E4D7","#F0B27A","#AEB6BF","#E74C3C","#2ECC71","#3498DB","#E67E22","#1ABC9C","#9B59B6","#34495E","#F39C12"]);async function UH(e,t){const n=new Z5.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function X0(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function aA(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function VH(e,t){if(!e)return()=>{};if(X0(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{aA(e),s()},l=u=>{u!==!1&&(u===!0||X0(e))&&(aA(e),s())};return n("synced",a),n("sync",l),X0(e)&&s(),i}function Jo(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function jH(e){const t=e&&typeof e=="object"?e.code:null;return t==="comment-export-missing-story-reference"||t==="v2-worker-comment-export-mode-unsupported"}function lA(e){return typeof e=="string"&&e.length>0?e:null}function Q0(e){return e?Jo(e)?lA(e.documentId??e.options?.documentId??null):lA(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function GH(e){if(!e||Jo(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Wi(e){if(!e)return null;if(Jo(e))return e.fonts??null;const t=GH(e);return t?{getReport:()=>t.getFontReport?.()??[],getMissingFonts:()=>t.getMissingFonts?.()??[],getDocumentFonts:()=>[...new Set((t.getFontReport?.()??[]).map(n=>n.logicalFamily))],getDocumentFontOptions:()=>t.getDocumentFontOptions?.()??[],getFontFamilyOptions:()=>t.getFontFamilyOptions?.()??[],getLastFontsChangedPayload:()=>t.getLastFontsChangedPayload?.()??null,map:n=>t.mapFonts(n),unmap:n=>t.unmapFonts(n),add:n=>t.addFonts(Array.isArray(n)?n:[n]),preload:n=>t.preloadFonts(n)}:null}var om=class extends Rm.default{static{this.allowedTypes=[Tr,Nl,Ph]}#t=!1;#n=!1;#e=null;#i=null;#s=null;#a=null;#u=null;#d=null;#l=wk({});get uiConfig(){return this.#l}#f=Ck({});get interactionConfig(){return this.#f}#m=Sk({});get surfacesConfig(){return this.#m}#o;#r=new GF;#p=null;#y=!1;constructor(e){if(super(),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",document:{},documents:[],editorExtensions:[],colors:[],users:[],user:{...x0},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#o=new DF({getModuleConfig:()=>this.#m}),this.#w(e,t)}async#w(e,t){this.config={...this.config,...e},!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),HF(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(n&&this.config.useLayoutEngine&&!r&&(console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine."),this.config.useLayoutEngine=!1),!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#ve(),this.config.user=UF(this.config.user),this.config.layoutEngineOptions.virtualization||(this.config.layoutEngineOptions.virtualization={enabled:!0,window:5,overscan:1}),this.config.modules=this.config.modules||{},Object.prototype.hasOwnProperty.call(this.config.modules,"comments")||(this.config.modules.comments={}),this.config.modules.comments=v9(this.config.modules.comments),this.#l=wk(this.config),this.#f=Ck(this.config),this.#m=Sk(this.config),this.config.disableContextMenu=!this.#l.contextMenu.enabled,this.#l.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#l.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&Object.assign(i,this.#f.comments)}if(this.config.colors=i6(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.3.0",this.#b("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Ji(),this.colors=this.config.colors??[],this.#x(),await uT(),this.#t)return;if(await this.#T(this.config.modules),this.#t){this.#le();return}this.config.cspNonce&&this.#E(),this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#p||(this.#p=this.#r.subscribe(i=>{this.#be(i.nextRuntimeId,i.legacyEditorProjection)})),this.isLocked=this.config.isLocked||!1,this.lockedBy=this.config.lockedBy||null;const o=document.createElement("div");o.style.display="contents",t.appendChild(o),this.#u=o,this.#L(),this.#S(),this.#we(),this.#_()}#_(){if(this.#M(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#u)}#S(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new sP({Renderer:RF,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#h("requiredNumberOfEditors").documents.filter(e=>e.type===Tr).length}get ui(){return this.#d||(this.#d=LH({superdoc:this}),this.#t&&this.#d.destroy()),this.#d}get state(){return{documents:this.#h("state").documents,users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#E(){const e=this.config.cspNonce,t=document.createElement;document.createElement=function(n){const r=t.call(this,n);return n.toLowerCase()==="style"&&r.setAttribute("nonce",e),r}}#x(){const e=this.config.document,t=!!e&&typeof e=="object"&&Object.keys(e)?.length,n=!!e&&typeof e=="string"&&e.length>0,r=!!e&&typeof File=="function"&&e instanceof File,o=!!e&&e instanceof Blob&&!(e instanceof File),i=this.config.documents&&this.config.documents?.length;if(t&&i&&console.warn("π¦ [superdoc] You can only provide one of document or documents"),t){const s=Pd(this.config.document);this.config.documents=[{id:Ji(),...s}]}else if(n)this.config.documents=[{id:Ji(),type:Tr,url:this.config.document,name:"document.docx"}];else if(r){const s=Pd(this.config.document);this.config.documents=[{id:Ji(),...s}]}else if(o){const s=Pd(this.config.document);this.config.documents=[{id:Ji(),...s}]}Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(s=>{const a=Pd(s);if(!a||typeof a!="object")return a;const l=typeof a=="object"&&"id"in a&&a.id||s&&typeof s=="object"&&"id"in s&&s.id;return{...a,id:l||Ji()}}))}#M(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=YD({disablePiniaDevtools:!!this.config.disablePiniaDevtools});this.app=e,this.pinia=t,this.app.config.globalProperties.$config=this.config,this.app.config.globalProperties.$documentMode=this.config.documentMode,this.app.config.globalProperties.$superdoc=this,this.app.provide("surfaceManager",this.#o),this.superdocStore=n,this.commentsStore=r,this.highContrastModeStore=o,typeof this.superdocStore.setExceptionHandler=="function"&&this.superdocStore.setExceptionHandler(s=>this.emit("exception",s)),this.superdocStore.init(this.config);const i=this.config.modules.comments;this.commentsStore.init(i||{}),this.isCollaborative&&X8(this),this.#ae()}#c(e,t){t&&this.on(e,t)}#L(){this.#c("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#c("editorCreate",this.config.onEditorCreate),this.#c("editorDestroy",this.config.onEditorDestroy),this.#c("source:complete",this.config.onSourceComplete),this.#c("source:signals-complete",this.config.onSourceSignalsComplete),this.#c("ready",this.config.onReady),this.#c("comments-update",this.config.onCommentsUpdate),this.#c("content-control:active-change",this.config.onContentControlActiveChange),this.#c("content-control:click",this.config.onContentControlClick),this.#c("awareness-update",this.config.onAwarenessUpdate),this.#c("locked",this.config.onLocked),this.#c("pdf:document-ready",this.config.onPdfDocumentReady),this.#c("sidebar-toggle",this.config.onSidebarToggle),this.#c("collaboration-ready",this.config.onCollaborationReady),this.on("collaboration-ready",e=>this.#j(e?.editor??null)),this.#c("editor-update",this.config.onEditorUpdate),this.on("content-error",this.onContentError),this.#c("exception",this.config.onException),this.#c("list-definitions-change",this.config.onListDefinitionsChange),this.#c("pagination-update",this.config.onPaginationUpdate),this.#c("fonts-resolved",this.config.onFontsResolved),this.#c("fonts-changed",this.config.onFontsChanged),this.#c("zoomChange",this.config.onZoomChange),this.#c("viewport-change",this.config.onViewportChange)}async#T({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Ji(),type:Tr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#D(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Gr(e),this.provider=Gr(t),this.#W();const n=this.config;this._cleanupAwareness=G8(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#k(){this.#a=null,this.#g(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#g(){if(this.#i){try{this.#i()}catch{}this.#i=null}if(this.#s){try{this.#s()}catch{}this.#s=null}}#j(e){this.#g(),Jo(e)&&(this.#G(e),this.#P(e))}#G(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=nP(()=>this.user),r=o=>{if(this.#t)return;const i=n.next(o);this.emit("awareness-update",{...i,superdoc:this})};try{const o=t.getSnapshot?.();o&&r(o),this.#i=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#P(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#t||this.#C(!!r.isLocked,this.#O(r.lockedBy??null))};try{if(this.#a&&typeof t.setLocked=="function"){const o=this.#a;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#a=null}const r=t.getSnapshot?.();r&&n(r),this.#s=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#O(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#F(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#C(e,t){this.isLocked===e&&this.#F(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#b("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#W(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:HH,n=e.id||e.email||e.name||"";let r=5381;for(let o=0;o<n.length;o++)r=(r<<5)+r^n.charCodeAt(o);e.color=t[Math.abs(r)%t.length]}async upgradeToCollaboration(e){const{target:t,mountedDocumentId:n}=this.#he(e);this.#n=!0;try{const r=await this.#de(),o=this.#v(),i=this.#K();this.#B();let s=null;try{this.#a=i,s=this.#fe(n);const a=this.#ce(t,r);await s,this.#ue(a,t),this.#a=null}catch(a){if(s&&this.#e){const l=this.#e;this.#e=null,l(),await s.catch(()=>{})}throw this.#A(o),a}}finally{this.#e=null,this.#n=!1}}#K(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#v(){const e=this.config.documents.find(r=>r.type===Tr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?pn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#X(n),storeData:t?.data}}#A(e){this.#a=null;const t=this.config.documents.find(n=>n.type===Tr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#I(e.storeDoc,e.storeV2Collaboration),this.#N(e.storeDoc))}#B(){if(this.#t)throw new Error("SuperDoc: instance was destroyed during upgrade")}#h(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.superdocStore}#q(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#R(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Y(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=pn(r);o.ydoc&&typeof o.ydoc=="object"&&"value"in o.ydoc&&(o.ydoc.value=e),o.provider&&typeof o.provider=="object"&&"value"in o.provider&&(o.provider.value=t)}}#X(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#I(e,t){const n=pn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#N(e){const t=pn(e).editorMountNonce;if(t&&typeof t=="object"&&"value"in t&&typeof t.value=="number"){t.value+=1;return}const n=e;n.editorMountNonce=(typeof n.editorMountNonce=="number"?n.editorMountNonce:0)+1}#z(e){return e.providerFamily==="liveblocks"?{providerType:"liveblocks",documentId:e.documentId,roomMode:e.roomMode,...e.publicApiKey?{publicApiKey:e.publicApiKey}:{},...e.authEndpoint?{authEndpoint:e.authEndpoint}:{}}:e.providerFamily==="hocuspocus"?{providerType:"hocuspocus",documentId:e.documentId,roomMode:e.roomMode,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{},...e.token?{token:e.token}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}#ce(e,t){const n=this.config.documents.find(i=>i.type===Tr),r=this.#h("upgradeToCollaboration").documents.find(i=>i.id===n.id);if(!r)throw new Error("SuperDoc: source document store entry is not available for upgrade");const o=this.#z({...e,roomMode:"create"});return n.data=t,n.v2Collaboration=o,r.data=t,this.#I(r,o),this.isCollaborative=!0,this.readyEditors=0,this.#N(r),{configDoc:n,storeDoc:r}}#ue(e,t){const n=this.#z({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#I(e.storeDoc,n)}async#de(){const e=this.activeEditor;if(Jo(e)&&typeof e.save=="function"){const r=await e.save();return this.#Q(r)}const t=this.config.documents.find(r=>r.type===Tr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(n instanceof Uint8Array||n instanceof ArrayBuffer)return this.#Q(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#Q(e){if(e instanceof Blob)return e;if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),new Blob([t],{type:Tr})}if(e instanceof ArrayBuffer)return new Blob([e],{type:Tr});throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#$(e,t){const n=Q0(e),r=(n?this.config.documents.find(a=>a.id===n):null)??this.config.documents.find(a=>a.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document");if(!r)return;const o=this.#Q(t),i=r.v2Collaboration&&typeof r.v2Collaboration=="object"&&r.v2Collaboration.roomMode==="create"?{...r.v2Collaboration,roomMode:"join"}:null;r.data=o,i&&(r.v2Collaboration=i);const s=this.superdocStore?.documents.find(a=>a.id===r.id)??null;s&&(s.data=o,i&&this.#I(s,i))}#ke(){const e=this.superdocStore?.documents;if(!e?.length)throw new Error("SuperDoc: no store documents available for upgrade");const t=e[0].getDocumentRuntime?.()||e[0].getEditor?.();if(!t?.attachCollaboration)throw new Error("SuperDoc: editor does not support attachCollaboration");return t}#Ae(){this.#k(),this.#Y(null,null)}#Ie(e){const n=e.editor??e;return n.options?.collaborationIsReady?Promise.resolve():new Promise(r=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(s),typeof n.off=="function"&&n.off("collaborationReady",a))},s=setTimeout(()=>{i(),console.warn("[SuperDoc] collaborationReady did not fire within 10 s after collaboration attach. Continuing β collaboration is active but cursor/presence setup may be delayed."),r(void 0)},1e4),a=()=>{i(),r(void 0)};this.#e=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#fe(e){return new Promise((n,r)=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(a),this.off("collaboration-ready",s))},s=l=>{const u=l?.editor;Jo(u)&&Q0(u)===e&&(!u.presence&&!u.lock||(i(),n()))},a=setTimeout(()=>{i(),r(new Error(`SuperDoc: v2 collaboration runtime did not become ready within 20000 ms for mounted document "${e}".`))},2e4);this.on("collaboration-ready",s),this.#e=()=>{i(),r(new Error("SuperDoc: instance was destroyed during upgrade"))}})}#Ee(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=VH(e,()=>{i||(a(),n())}),i||(o=setTimeout(()=>{a(),r(new Error("SuperDoc: collaboration provider did not sync within 10000 ms. The provider exposes on/off but never emitted sync(true) or synced."))},1e4)),this.#e=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#he(e){if(this.#t)throw new Error("SuperDoc: cannot upgrade a destroyed instance");if(this.#n)throw new Error("SuperDoc: upgrade already in progress");if(this.isCollaborative)throw new Error("SuperDoc: instance is already collaborative");const t=this.config,n=t.documents.filter(l=>l.type===Tr);if(n.length===0)throw new Error("SuperDoc: no DOCX document found for upgrade");if(n.length>1)throw new Error("SuperDoc: upgradeToCollaboration() only supports a single DOCX document");if(t.documents.length!==n.length)throw new Error("SuperDoc: upgradeToCollaboration() only supports single-DOCX instances");if(!Jo(this.#me()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0],o=r.id;if(typeof o!="string"||o.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");const i=t.modules?.collaboration,s=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:i?{...i}:null,a=TS({v2Collaboration:e.v2Collaboration??this.#pe(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,legacyCollaboration:s,documentType:Tr,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!a.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${a.reason}: ${a.message}`);return{target:a.target,mountedDocumentId:o}}#pe(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#me(){const e=this.config.documents.find(n=>n.type===Tr),t=this.#h("upgradeToCollaboration").documents.find(n=>n.id===e.id)?.getEditor?.();if(!t)throw new Error("SuperDoc: source editor not yet created β wait for the ready event before upgrading");return t}addSharedUser(e){this.#R("addSharedUser");const t=Nc({actor:e});t&&this.users.some(n=>Nc({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#R("removeSharedUser");const t=typeof e=="string"?Mv(e):"",n=typeof e=="string"?`email:${t}`:Nc({actor:e});this.users=this.users.filter(r=>{const o=Nc({actor:r});return n?o!==n:t?Mv(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#h("onContentError").documents.find(i=>i.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"";this.config.onContentError?.({error:e,editor:t,documentId:o,file:r?.data})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:dk(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#ge(e),this.emit("editorCreate",{editor:dk(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#ee=new WeakSet;#ge(e){if(!e||typeof e.on!="function"||this.#ee.has(e))return;this.#ee.add(e),e.on("fonts-changed",n=>{this.#te(e)&&this.#H(n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#te(e)&&this.#H(t)}#te(e){return!this.activeEditor||e===this.activeEditor}#ne=null;#H(e){this.#ne=e,this.emit("fonts-changed",e)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#ve(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is a legacy ProseMirror concept and is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`; legacy ProseMirror extensions (Node.create, Mark.create, addPmPlugins, custom schema) do not run in v2.")}#b(...e){(console.debug?console.debug:console.log)("π¦ π¦ΈββοΈ [superdoc]",...e)}#Z=null;get fonts(){return this.#Z||(this.#Z={getReport:()=>Wi(this.activeEditor)?.getReport()??[],getMissingFonts:()=>Wi(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>Wi(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>Wi(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>Wi(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?Wi(t)?.getLastFontsChangedPayload?.()??null:this.#ne??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{const t=Wi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=Wi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=Wi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=Wi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#Z}#U(){const e=this.activeEditor!==null;this.#re(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#V=null;#re(){if(this.#V){try{this.#V()}catch{}this.#V=null}}#ye(e){this.#re();const t=Wi(e);if(!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#H(n),this.#V=t.onChanged(r=>this.#H(r))}#be(e,t){this.#y=!0;try{if(e===null){this.#U();return}this.#r.get(e)?.kind==="v2"&&Jo(t)?this.#oe(t):this.#U()}finally{this.#y=!1}}#oe(e){if(Jo(e)){!this.#y&&this.#r.getActive()&&this.#r.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#ye(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#U()}setActiveEditor(e){this.#oe(e)}getV2FeatureMatrix(){return[{feature:"source.docx-bytes",status:"supported",reason:"SuperDoc normalizes File/Blob/ArrayBuffer/Uint8Array DOCX inputs for the separate DOCX Engine dependency"},{feature:"source.url",status:"supported",reason:"shell-owned source normalization resolves URL-backed DOCX inputs before opening the injected v2 editor"},{feature:"source.blank",status:"supported",reason:"shell-owned blank-document seeding resolves to DOCX bytes before mounting the injected v2 editor"},{feature:"execution.browser-worker",status:"supported",reason:"the shipped public v2 shell opens DOCX documents through the browser-worker path by default when collaboration is not active"},{feature:"distribution.cdn-iife",status:"supported",reason:"the CDN/IIFE distribution ships the public bundle plus the emitted v2 browser-worker asset and opens DOCX documents through the worker-backed v2 runtime"},{feature:"docx.open-render",status:"supported",reason:"superdoc@2 opens and renders DOCX documents through its DOCX Engine dependency"},{feature:"docx.review-handles",status:"supported",reason:"Comment/tracked-change list + decide via v2 host handles"},{feature:"shell.toolbar",status:"supported",reason:"new SuperDoc({ toolbar }) mounts the rendered built-in toolbar shell and the superdoc.toolbar handle, both backed by the V2 command controller and the internal compatibility catalog. Explicit item-level limits stay fail-closed in the shared command matrix (for example search replace and copyFormat)."},{feature:"shell.rich-formatting",status:"supported",reason:"Rich inline, paragraph, and list formatting route through the V2 command controller and public Document API (format.* / styles.* / lists.*): bold, italic, underline, strikethrough, font family/size, text/highlight color, alignment, line spacing, linked styles, bullet/numbered lists, indent, and clear formatting."},{feature:"shell.comments-sidebar",status:"supported",reason:"ui-phase3-002: v2 comments adapter routes create/reply/edit/resolve/delete through V2EditorHost.dispatch"},{feature:"shell.comments-sidebar.reopen",status:"supported",reason:'ui-phase3-002: v2 comments sidebar reopens resolved threads through the v2 comments adapter (activeEditor.doc.comments.patch({ status: "active" }))'},{feature:"shell.tracked-change-sidebar",status:"supported",reason:"SD-3722: v2 tracked-change adapter lists and decides exact body, header/footer-part, and note targets"},{feature:"shell.tracked-change-sidebar.bulk",status:"not-shipped",reason:"bulk-tracked-change-decisions-omitted: acceptAll/rejectAll are matrix-disabled by default in the v2 host"},{feature:"shell.tracked-change-sidebar.non-body",status:"supported",reason:"SD-3722: public v2 shell hydrates and targets header/footer-part and note tracked changes"},{feature:"shell.comments-sidebar.persistence",status:"supported",reason:"ui-phase3-004: comment create/reply/edit/resolve/delete persist through SuperDoc.export() β re-mount via the v2 host save bridge"},{feature:"shell.tracked-change-sidebar.persistence",status:"supported",reason:"ui-phase3-004: tracked-change accept/reject persist through SuperDoc.export() β re-mount via the v2 host save bridge"},{feature:"shell.comments-sidebar.author-required",status:"supported",reason:"ui-phase3-004: v2 comments adapter surfaces commentCommandsReason=author-required from the host capability matrix; write controls disable and forced dispatch reports ok:false"},{feature:"shell.find-replace",status:"supported",reason:"Ctrl/Cmd+F opens the SuperDoc find/replace surface in v2; find/navigation/replace/replaceAll route through the single host search session (host.search) via ui.search, with replace failing closed in viewing/read-only mode"},{feature:"shell.ai-writer",status:"supported",reason:"built-in toolbar renders the modules.ai-gated AI writer and applies generated text through the public Document API facade"},{feature:"shell.collaboration",status:"supported",reason:"v2 single-doc y-websocket collaboration is wired through document.v2Collaboration, including collaboration-ready, awareness-update, and locked event bridges; arbitrary external { ydoc, provider } adapters remain unsupported"},{feature:"shell.context-menu",status:"not-shipped",reason:"context-menu-omitted: public v2 shell disables the legacy context menu"},{feature:"shell.page-metrics",status:"supported",reason:"ui-phase4-001: v2 page metrics snapshot (editorVersion: 2, documentId, renderEpoch, layoutGeneration, zoom, pages[], capabilities) available via superdoc.activeEditor.pageMetrics.{ getSnapshot, subscribe, setZoom, scrollToPage, revealBodyTarget, pageIndexForBodyTarget }"},{feature:"shell.zoom",status:"supported",reason:"ui-phase4-001: SuperDoc.setZoom routes to V2EditorHost.setZoom in v2 mode; single CSS-transform wrapper applies scale to the painted document, page metrics viewport coords scale with the same zoom value"},{feature:"shell.ruler-page-margins",status:"supported",reason:"ui-phase4-002: v2 ruler renders against the V2PageMetricsSnapshot and dispatches margin drags through a narrow v2 page-layout bridge (`activeEditor.pageLayout.setMargins(...)`) backed by `doc.sections.setPageMargins(...)`. The v2 page metrics snapshot now reports `capabilities.marginEdit = { supported: true }`"},{feature:"shell.custom-extensions",status:"supported",reason:"superdoc@2 supports customer extensions through `extensions` + `defineSuperDocExtension`; command execution and diagnostics are exposed through the narrow `activeEditor.extensions` facet. Legacy ProseMirror `editorExtensions` are ignored in v2."},{feature:"pdf.viewer",status:"supported",reason:"editorVersion ignored for PDF documents"},{feature:"html.viewer",status:"supported",reason:"editorVersion ignored for HTML documents"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#r.register(e)}unregisterEditorRuntime(e){return this.#r.unregister(e)}getActiveRuntime(){return this.#r.getActive()}setActiveRuntime(e,t){this.#r.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#r.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#r.resolveFromEventTarget(e);return n?(this.#r.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#h("toggleRuler");this.config.rulers=!this.config.rulers,e.documents.forEach(t=>{t.rulers=this.config.rulers}),this.toolbar?.updateToolbarState?.()}canPerformPermission({permission:e,role:t=this.config.role,isInternal:n=this.config.isInternal,comment:r=null,trackedChange:o=null}={}){if(!e)return!1;let i=r??o?.comment??null;const s=o?.commentId||o?.id;if(!i&&s&&this.commentsStore?.getComment){const a=this.commentsStore.getComment(s),l=a?.getValues;i=typeof l=="function"?l.call(a):a}return Zs(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#we(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#l.toolbar;this.toolbarElement=n.container??void 0;const r=this.config.ui,o=typeof r=="object"&&r!==null&&r.toolbar!==void 0;if(!(n.enabled&&(n.container||e===!0||e!=null&&typeof e=="object"||o))){this.toolbar=null;return}try{this.toolbar=Pz({...t,...n.options,selector:this.toolbarElement,superdoc:this,editor:this.activeEditor,role:this.config.role,isDev:this.isDev,documentMode:this.config.documentMode,groups:n.options.groups,toolbarGroups:n.options.toolbarGroups,icons:n.options.icons,texts:n.options.texts,uiDisplayFallbackFont:this.config.uiDisplayFallbackFont})}catch(i){console.warn("[SuperDoc] built-in toolbar mount failed",i),this.toolbar=null}}addCommentsList(e){!this.config?.modules?.comments||this.config.role==="viewer"||(e&&(this.config.modules.comments.element=e),this.commentsList=new xR(this.config.modules?.comments,this),this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!0}))}removeCommentsList(){this.commentsList&&(this.commentsList.close(),this.commentsList=null,this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!1}))}scrollToComment(e,t={}){if(!this.config?.modules?.comments||!e||typeof e!="string")return!1;const n=this.element||document,r=globalThis.CSS?.escape?globalThis.CSS.escape(e):e.replace(/"/g,'\\"'),o=n.querySelector(`[data-comment-ids*="${r}"]`);if(!o)return!1;const{behavior:i="smooth",block:s="start"}=t??{};return o.scrollIntoView({behavior:i,block:s}),this.commentsStore?.setActiveComment?.(this,e),!0}async navigateTo(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.navigateTo?n.navigateTo(e):!1}async scrollToElement(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.scrollToElement?n.scrollToElement(e):!1}setDisableContextMenu(e=!0){if(!e&&this.#l.contextMenu.suppressed)return;const t=!!e;this.config.disableContextMenu!==t&&(this.config.disableContextMenu=t,this.superdocStore?.documents?.forEach(n=>{const r=n.getDocumentRuntime?.();r?.setContextMenuDisabled&&r.setContextMenuDisabled(t);const o=n.getEditor?.();o?.setOptions&&o.setOptions({disableContextMenu:t})}))}setShowBookmarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showBookmarks!==t&&(n.showBookmarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowBookmarks?.(t)}))}setShowFormattingMarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showFormattingMarks!==t&&(n.showFormattingMarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowFormattingMarks?.(t)}),this.emit("formatting-marks-change",{showFormattingMarks:t,superdoc:this}),this.toolbar?.updateToolbarState?.())}toggleFormattingMarks(){const e=!!this.config.layoutEngineOptions?.showFormattingMarks;this.setShowFormattingMarks(!e)}setDocumentMode(e){if(!e)return;this.#R("setDocumentMode"),e=e.toLowerCase(),this.config.documentMode=e,this.#ae();const t={viewing:()=>this.#se(),editing:()=>this.#Ce(),suggesting:()=>this.#ie()};t[e]&&(t[e](),this.emit("document-mode-change",{documentMode:e}))}#J(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#r.getAllByDocumentId(n);if(i.length>0){for(const s of i)s.setDocumentMode(t);return}}const r=typeof e.getDocumentRuntime=="function"?e.getDocumentRuntime():null;if(typeof r?.setDocumentMode=="function"){r.setDocumentMode(t);return}const o=typeof e.getEditor=="function"?e.getEditor():null;o&&typeof o.setDocumentMode=="function"&&o.setDocumentMode(t)}setTrackedChangesPreferences(e){const t=e&&Object.keys(e).length?{...e}:void 0;this.config.layoutEngineOptions||(this.config.layoutEngineOptions={}),this.config.layoutEngineOptions.trackedChanges=t,this.superdocStore?.documents?.forEach(n=>{const r=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;r?.setTrackedChangesOverrides&&r.setTrackedChangesOverrides(t)})}#Ce(){if(this.config.role!=="editor")return this.#ie();const e=this.#h("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.setTrackedChangesPreferences({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#J(t,"editing")})}#ie(){if(!["editor","suggester"].includes(this.config.role??""))return this.#se();const e=this.#h("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.setTrackedChangesPreferences({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#J(t,"suggesting")})}#se(){const e=this.#h("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const t=this.config.comments?.visible===!0,n=this.config.trackChanges?.visible===!0;this.setTrackedChangesPreferences(n?{mode:"review",enabled:!0}:{mode:"original",enabled:!0}),!t&&!n&&this.commentsStore?.clearEditorCommentPositions?.(),e.documents.forEach(r=>{t||n?r.restoreComments?.():r.removeComments?.(),this.#J(r,"viewing")})}#ae(){const e=this.config.comments?.visible===!0,t=this.config.trackChanges?.visible===!0,n=this.config.documentMode==="viewing",r=e||t;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:e,trackChangesVisible:t});const o=this.superdocStore?.documents;Array.isArray(o)&&o.length>0&&o.forEach(i=>{const s=typeof i.getDocumentRuntime=="function"?i.getDocumentRuntime():null;s?.setViewingCommentOptions&&s.setViewingCommentOptions({emitCommentPositionsInViewing:n&&r,enableCommentsInViewing:n&&e})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}this.superdocStore.zoomMode!==e&&(this.superdocStore.zoomMode=e,this.emit("zoomChange",{zoom:this.getZoom(),mode:e}))}getZoomState(){const e=c_(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,min:e.min,max:e.max}}getViewportMetrics(){return this.superdocStore?.viewportMetrics??null}getMeasurementUnit(){return this.superdocStore?.measurementUnit??"in"}setMeasurementUnit(e){if(e!=="in"&&e!=="cm"){console.warn("[SuperDoc] setMeasurementUnit expects 'in' or 'cm'");return}if(!this.superdocStore){console.warn("[SuperDoc] setMeasurementUnit called before initialization; use config.measurementUnit for the starting unit");return}this.superdocStore.measurementUnit!==e&&(this.superdocStore.measurementUnit=e,this.emit("measurement-unit-change",{unit:e}))}setLocked(e=!0){const t=this.activeEditor;if(Jo(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#C(!!n.isLocked,this.#O(n.lockedBy??null));return}this.config.documents.forEach(n=>{const r=n.ydoc;if(!r)return;const o=r.getMap("meta");r.transact(()=>{o.set("locked",e),e?o.set("lockedBy",this.user):o.delete("lockedBy")})}),this.#C(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#h("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#C(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){const l=JS(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),c=[...r],d=[...o];if(e.includes("docx")&&u.forEach(m=>{c.push(m),d.push(`${l}.docx`)}),c.length===1)return s?ZS(c[0],l,e[0]):c[0];const h=await UH(c,d);return s?ZS(h,l,"zip"):h}async replaceFile(e){const t=this.activeEditor;if(Jo(t)&&typeof t.replaceFile=="function"){const r=await t.replaceFile(e),o=r&&typeof r=="object"?r.state:null;return(o===null||o==="review-ready"||o==="editing-ready")&&(this.#$(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}const n=t&&!Jo(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0;return(o==null||o==="review-ready"||o==="editing-ready")&&(this.#$(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,fieldsHighlightColor:n}={}){const r=this.config?.modules?.comments!==!1;let o,i=!1;const s=()=>(i||(i=!0,e==="clean"?o=[]:r&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(o=this.commentsStore.translateCommentsForExport(),Array.isArray(o)||(o=[]))),o),a=new WeakSet,l=u=>{"editor"in u&&u.error&&typeof u.error=="object"&&a.add(u.error)};this.on("exception",l);try{const u=this.#h("exportEditorsToDOCX").documents.map(async c=>{if(!c||c.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const d=typeof c.getEditor=="function"?c.getEditor():null,h=()=>!c.data||c.data.type&&c.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:c.data;if(!d||typeof d.exportDocx!="function")return h();const m=d.editorVersion===2;try{const p=await d.exportDocx(m?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(p)return p}catch(p){if((!p||typeof p!="object"||!a.has(p))&&this.emit("exception",{error:p,document:c}),m&&(e==="clean"||jH(p)))throw p}return h()});return(await Promise.all(u)).filter(c=>c!=null)}finally{this.off("exception",l)}}async#_e(){this.#b("π¦ [superdoc] Triggering collaboration saves");const e=this.#h("save");return new Promise(t=>{e.documents.forEach((n,r)=>{if(this.#b(`Before reset - Doc ${r}: pending = ${this.pendingCollaborationSaves}`),this.pendingCollaborationSaves=0,n.ydoc){this.pendingCollaborationSaves++,this.#b(`After increment - Doc ${r}: pending = ${this.pendingCollaborationSaves}`);const o=n.ydoc.getMap("meta");o.observe(i=>{i.changes.keys.has("immediate-save-finished")&&(this.pendingCollaborationSaves--,this.pendingCollaborationSaves<=0&&t())}),o.set("immediate-save",!0)}}),this.#b(`FINAL pending = ${this.pendingCollaborationSaves}, but we have ${e.documents.filter(n=>n.ydoc).length} docs!`)})}async save(){const e=[this.#_e()];this.#b("π¦ [superdoc] Saving superdoc"),await Promise.all(e),this.#b("π¦ [superdoc] Save complete")}#Se(e,t){const n=e.provider;n&&n!==this.provider&&!t.some(o=>o.provider===n)&&(n.disconnect?.(),n.destroy?.());const r=e.ydoc;r&&r!==this.ydoc&&!t.some(o=>o.ydoc===r)&&r.destroy?.()}#le(){this.#a=null,this.#g(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null);const e=this.config;e.socket?.cancelWebsocketRetry?.(),e.socket?.disconnect(),e.socket?.destroy(),this.ydoc?.destroy(),this.provider?.disconnect?.(),this.provider?.destroy?.(),e.documents.forEach(t=>{t.provider?.disconnect?.(),t.provider?.destroy?.(),t.ydoc?.destroy()})}openSurface(e){return this.#o.open(e)}closeSurface(e){this.#o.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#h("removeDocument"),r=this.activeEditor,o=Q0(r);for(const s of this.#r.getAllByDocumentId(t))this.#r.unregister(s.id);o===t&&r!==null&&this.#U();const i=n.removeDocument(t);return i?(this.#Se(i,n.documents),await St(),!0):!1}destroy(){this.#t=!0,this.#e&&(this.#e(),this.#e=null),this.#o&&this.#o.destroy(),this.toolbar?.destroy?.(),this.app&&(this.#b("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#d?.destroy(),this.#le(),this.#p?.(),this.#p=null,this.#r.clear(),this.#u&&(this.#u.remove(),this.#u=null)}focus(e={}){const t=this.getActiveRuntime();if(t?.getCapabilities().lifecycle.canFocus){t.focus(e).catch(n=>{console.warn("[SuperDoc] active editor runtime focus failed",n)});return}this.activeEditor?Jo(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#h("focus").documents.find(n=>{const r=n.getEditor?.();return r?(Jo(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};It();const cA="__SUPERDOC_V2_BROWSER_RUNTIME__";function WH(e=globalThis){const t=e[cA];return t&&typeof t=="object"?t:null}function KH(e={},t=globalThis){const n=WH(t)??{},r={...n,...e,vue:e.vue??n.vue??Y5};return t[cA]=r,r}KH();var qH={action:"--sd-ui-action",actionHover:"--sd-ui-action-hover",actionText:"--sd-ui-action-text",bg:"--sd-ui-bg",hoverBg:"--sd-ui-hover-bg",activeBg:"--sd-ui-active-bg",disabledBg:"--sd-ui-disabled-bg",text:"--sd-ui-text",textMuted:"--sd-ui-text-muted",textDisabled:"--sd-ui-text-disabled",border:"--sd-ui-border"},YH=0;function uA(e){const{name:t,font:n,radius:r,shadow:o,colors:i,vars:s}=e,a=`sd-theme-${(t?t.replace(/[^a-zA-Z0-9-_]/g,"-"):null)||`custom-${++YH}`}`,l=[];if(i)for(const[u,c]of Object.entries(i)){if(c==null)continue;const d=qH[u];d&&l.push(` ${d}: ${c};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,c]of Object.entries(s))c!=null&&l.push(` ${u}: ${c};`);return{className:a,css:l.length>0?`.${a} {
|
|
106
|
+
${l.join(`
|
|
107
|
+
`)}
|
|
108
|
+
}`:""}}function XH(e,t){if(typeof document>"u"||!t)return;let n=document.querySelector(`[data-sd-theme="${e}"]`);n||(n=document.createElement("style"),n.setAttribute("data-sd-theme",e),document.head.appendChild(n)),n.textContent=t}function QH(e){const{className:t,css:n}=uA(e);return XH(t,n),t}function ZH(e){return uA(e)}function JH(e){if(!e||typeof e!="object")throw new Error("defineSuperDocExtension requires an extension object.");if(typeof e.id!="string"||e.id.length===0)throw new Error("defineSuperDocExtension requires a non-empty string `id`.");if(typeof e.activate!="function")throw new Error(`defineSuperDocExtension("${e.id}") requires an \`activate(ctx)\` function.`);if(e.storage!==void 0&&typeof e.storage!="function")throw new Error(`defineSuperDocExtension("${e.id}") \`storage\` must be a function returning the initial storage object.`);return e}var $H=Vu({BlankDOCX:()=>HC,DOCX:()=>Tr,HTML:()=>Ph,PDF:()=>Nl,SuperDoc:()=>om,buildTheme:()=>ZH,compareVersions:()=>n6,createTheme:()=>QH,defineSuperDocExtension:()=>JH,getFileObject:()=>Lv},1),eU="SUPERDOC_ENGINE_CDN_BASE_URL",dA=Symbol.for("superdoc.docx-engine.cdn-load-state"),im="superdocDocxEngineStatus";function tU(e,t,n=null){const r=e?.[eU],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return nU(o);if(!t)throw new Error("SuperDoc: the CDN build is missing its exact DOCX Engine version");return`https://cdn.jsdelivr.net/npm/@superdoc/docx-engine@${t}`}function nU(e){const t=e.trim().replace(/\/+$/,""),n=t.match(/^([a-z][a-z\d+.-]*):/iu)?.[1]?.toLowerCase();if(n&&n!=="http"&&n!=="https")throw new TypeError(`SuperDoc: unsupported DOCX Engine CDN URL scheme ${n}:`);return t}function rU({engineVersion:e,buildBaseUrl:t}){lT(()=>{const n=tU(globalThis,e,t),r=globalThis[dA],o=r instanceof Map?r:new Map;if(globalThis[dA]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),oU(`${n}/dist-cdn/style.css`)]).then(([s])=>s);o.set(n,i),i.catch(()=>{o.get(n)===i&&o.delete(n)})}return o.get(n)})}function oU(e){if(typeof document>"u")return Promise.resolve();const t=new URL(e,document.baseURI).href,n=Array.from(document.querySelectorAll('link[rel~="stylesheet"]')).find(o=>o.href===t);if(n?.sheet||n?.dataset[im]==="loaded")return Promise.resolve();const r=n?.dataset[im]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(m,p)=>{a||(a=!0,l?.disconnect(),s.dataset[im]=m,p())},c=()=>u("loaded",o),d=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),h=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",c,{once:!0}),s.addEventListener("error",d,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(h),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[im]="loading",document.head.appendChild(s))})}rU({engineVersion:"0.2.0",buildBaseUrl:null});for(const[e,t]of Object.entries($H))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(om,e)||(om[e]=t);var iU=om;return iU})();
|