@heartlandone/vega 2.81.0 → 2.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-25e1bfac.js → app-globals-40b1b1b2.js} +7 -7
- package/dist/cjs/{aria-dialog-focusable-trap-slimmer-ced9566d.js → aria-dialog-focusable-trap-slimmer-5507f917.js} +1 -1
- package/dist/cjs/{child-nodes-event-prevent-slimmer-dd0bb8b6.js → child-nodes-event-prevent-slimmer-9b7095a4.js} +1 -1
- package/dist/cjs/{code-block-24b3d0e7.js → code-block-b1f8aded.js} +3 -3
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-bd662b32.js → component-value-history-controller-slimmer.abstract-99fbd1f2.js} +4 -4
- package/dist/cjs/{content-state-0f26036c.js → content-state-648652b4.js} +3 -3
- package/dist/cjs/{dark-mode-style-controller-3a04af3d.js → dark-mode-style-controller-bd765afb.js} +2 -322
- package/dist/cjs/{date-required-rule-4377217a.js → date-required-rule-6addf5dd.js} +1 -1
- package/dist/cjs/{design-token-40276b11.js → design-token-93070bb8.js} +6 -130
- package/dist/cjs/drop-file-accept-filter-slimmer-cd619cc7.js +64 -0
- package/dist/cjs/{dto-renderer-manager-ae5fcbba.js → dto-renderer-manager-7eb5c5ce.js} +42 -2
- package/dist/cjs/{element-appender-slimmer-be1b4d57.js → element-appender-slimmer-52c2b455.js} +87 -11
- package/dist/cjs/{event-emit-slimmer-bee6b676.js → event-emit-slimmer-bcb458b2.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-982dbfe4.js → form-field-controller-slimmer-0f3a028e.js} +3 -3
- package/dist/cjs/{image-annotation-action-e0df5a20.js → image-annotation-action-0339e983.js} +3 -3
- package/dist/cjs/index-58ea899e.js +4 -0
- package/dist/cjs/index.cjs.js +19 -17
- package/dist/cjs/{inject-keyboard-manager-12b65e98.js → inject-keyboard-manager-2d9c4f92.js} +1 -1
- package/dist/cjs/{internal-translation-controller-9f58a4e4.js → internal-translation-controller-fb1532f4.js} +3 -0
- package/dist/cjs/{internal-vega-event-manager-cc0f511c.js → internal-vega-event-manager-fef893bf.js} +1 -0
- package/dist/cjs/{keyboard-manager-c89a66d3.js → keyboard-manager-5ed6c472.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-93fcbf46.js → keyboard-manager-slimmer-879ff4f3.js} +1 -1
- package/dist/cjs/loader.cjs.js +14 -13
- package/dist/cjs/{month-view-generator-0d25e950.js → month-view-generator-d262e6ce.js} +1 -1
- package/dist/cjs/{public-rules-652ec269.js → public-rules-bce88d4e.js} +10 -9
- package/dist/cjs/{range-cdd61881.js → range-5bd6d72b.js} +1 -1
- package/dist/cjs/{responsive-format-facade-9cae7f27.js → responsive-format-facade-2cab7344.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-4b919054.js → rich-text-editor-required-rule-e8a922be.js} +1 -1
- package/dist/cjs/{split-cell-operation-3596f738.js → split-cell-operation-bb388de6.js} +4 -4
- package/dist/cjs/state-border-formatter-4e5e4ed0.js +133 -0
- package/dist/cjs/{string-format-strategy.abstract-ebdb2573.js → string-format-strategy.abstract-9a35e3b4.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-9b6a8399.js → string-input-formatter-slimmer-1018ddec.js} +3 -3
- package/dist/cjs/{string-mask-strategy-6cc9f391.js → string-mask-strategy-3aa17744.js} +2 -2
- package/dist/cjs/{style-formatter-18289c4d.js → style-formatter-2226c869.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-39bfcfe3.js → sub-state-notify-slimmer-b33171b0.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-e5b50cbf.js → sub-state-observer-slimmer-b8f6f27b.js} +1 -1
- package/dist/cjs/{time-required-rule-3517beff.js → time-required-rule-970dfdca.js} +1 -1
- package/dist/cjs/tinycolor-polyfill-502efaa8.js +325 -0
- package/dist/cjs/{token-extension-addc97c1.js → token-extension-361273fb.js} +85 -28
- package/dist/cjs/{translation-slimmer-c069ca84.js → translation-slimmer-d0c77ad2.js} +1 -1
- package/dist/cjs/{type-guard-362d7da3.js → type-guard-3ec852d7.js} +28 -1
- package/dist/cjs/{valid-credit-card-number-rule-1d8bf49c.js → valid-credit-card-number-rule-99d1bb34.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +7 -6
- package/dist/cjs/vega-app-footer.cjs.entry.js +2 -1
- package/dist/cjs/vega-app-header-button.cjs.entry.js +8 -7
- package/dist/cjs/vega-banner.cjs.entry.js +15 -4
- package/dist/cjs/vega-box.cjs.entry.js +6 -5
- package/dist/cjs/vega-brand-logo.cjs.entry.js +2 -1
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-circle.cjs.entry.js +9 -8
- package/dist/cjs/vega-button-group_2.cjs.entry.js +102 -13
- package/dist/cjs/vega-button-link.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-calendar_4.cjs.entry.js +10 -10
- package/dist/cjs/vega-card.cjs.entry.js +5 -4
- package/dist/cjs/vega-carousel.cjs.entry.js +5 -5
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +44 -11
- package/dist/cjs/vega-chip.cjs.entry.js +8 -7
- package/dist/cjs/vega-code-block.cjs.entry.js +14 -13
- package/dist/cjs/vega-color-picker.cjs.entry.js +26 -8
- package/dist/cjs/vega-color-swatch.cjs.entry.js +245 -0
- package/dist/cjs/vega-combo-box.cjs.entry.js +10 -10
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +20 -20
- package/dist/cjs/vega-dialog_2.cjs.entry.js +80 -247
- package/dist/cjs/vega-divider.cjs.entry.js +5 -4
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +33 -15
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +40 -90
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -4
- package/dist/cjs/vega-flex.cjs.entry.js +6 -5
- package/dist/cjs/vega-font.cjs.entry.js +5 -4
- package/dist/cjs/vega-form.cjs.entry.js +9 -9
- package/dist/cjs/vega-grid.cjs.entry.js +5 -4
- package/dist/cjs/vega-icon.cjs.entry.js +5 -4
- package/dist/cjs/vega-image-uploader.cjs.entry.js +78 -13
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +11 -11
- package/dist/cjs/vega-input-numeric.cjs.entry.js +11 -11
- package/dist/cjs/vega-input-passcode.cjs.entry.js +10 -10
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +9 -9
- package/dist/cjs/vega-input-range.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-select.cjs.entry.js +50 -15
- package/dist/cjs/vega-input.cjs.entry.js +11 -11
- package/dist/cjs/{vega-internal-event-id-a1837fa2.js → vega-internal-event-id-87014e4f.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +2 -2
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +14 -12
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination.cjs.entry.js +9 -9
- package/dist/cjs/vega-popover_2.cjs.entry.js +12 -11
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +34 -11
- package/dist/cjs/vega-radio_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +11 -10
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +75 -29
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +13 -12
- package/dist/cjs/vega-segment-control.cjs.entry.js +2 -2
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-signature-capture.cjs.entry.js +11 -10
- package/dist/cjs/vega-stepper.cjs.entry.js +9 -9
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_11.cjs.entry.js +434 -287
- package/dist/cjs/vega-text.cjs.entry.js +16 -2
- package/dist/cjs/vega-textarea.cjs.entry.js +7 -7
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +14 -14
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +6 -6
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +9 -8
- package/dist/cjs/vega.cjs.js +14 -13
- package/dist/cjs/{wait-for-component-did-render-b6d12d51.js → wait-for-component-did-render-16863a21.js} +1 -1
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/vega-banner/slimmers/renderers/vega-banner-renderer.js +11 -2
- package/dist/collection/components/vega-banner/vega-banner.js +3 -1
- package/dist/collection/components/vega-button/vega-button.css +4 -0
- package/dist/collection/components/vega-button-group/slimmers/controllers/vega-button-group-all-items-disabled-controller.js +64 -0
- package/dist/collection/components/vega-button-group/vega-button-group-item/slimmers/controllers/vega-button-group-item-sub-state-controller.js +7 -0
- package/dist/collection/components/vega-button-group/vega-button-group-item/slimmers/renderers/vega-button-group-item-renderer.js +6 -2
- package/dist/collection/components/vega-button-group/vega-button-group-item/vega-button-group-item.js +4 -2
- package/dist/collection/components/vega-button-group/vega-button-group.js +20 -1
- package/dist/collection/components/vega-checkbox/vega-checkbox.css +19 -14
- package/dist/collection/components/vega-checkbox/vega-checkbox.js +57 -3
- package/dist/collection/components/vega-color-picker/vega-color-picker.css +0 -1
- package/dist/collection/components/vega-color-picker/vega-color-picker.js +40 -1
- package/dist/collection/components/vega-color-swatch/slimmers/renderers/vega-color-swatch-renderer.js +127 -0
- package/dist/collection/components/vega-color-swatch/vega-color-swatch.css +155 -0
- package/dist/collection/components/vega-color-swatch/vega-color-swatch.js +314 -0
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/slimmers/controllers/vega-dropdown-item-state-controller.js +7 -0
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.js +5 -1
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/vega-dropdown-item.js +2 -1
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +38 -0
- package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +2 -2
- package/dist/collection/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-default-content-renderer.js +45 -1
- package/dist/collection/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-preview-content-renderer.js +16 -1
- package/dist/collection/components/vega-image-uploader/vega-image-uploader.js +5 -0
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +17 -4
- package/dist/collection/components/vega-input-select/vega-input-select.js +76 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-backdrop-controller.js +9 -3
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.js +0 -4
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-nested-modal-controller.js +17 -2
- package/dist/collection/components/vega-modal/slimmers/renderers/vega-modal-renderer.js +28 -28
- package/dist/collection/components/vega-modal/vega-modal.css +2 -2
- package/dist/collection/components/vega-modal/vega-modal.js +0 -5
- package/dist/collection/components/vega-pagination/internal/vega-pagination-go-to.js +1 -1
- package/dist/collection/components/vega-pagination/vega-pagination-page-selector-mobile/slimmers/renderers/page-selector-mobile-renderer.js +1 -1
- package/dist/collection/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-step-controller.js +10 -2
- package/dist/collection/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.js +1 -1
- package/dist/collection/components/vega-progress-tracker/vega-progress-tracker.js +39 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +28 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js +24 -6
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.js +23 -8
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/extension-controller.js +18 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +8 -3
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +47 -0
- package/dist/collection/components/vega-stepper/vega-stepper.css +12 -0
- package/dist/collection/components/vega-stepper/vega-stepper.js +2 -1
- package/dist/collection/components/vega-table/slimmers/controllers/vega-table-render-input-controller.js +25 -2
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-pinned-renderer.js +28 -1
- package/dist/collection/components/vega-table/vega-table-cell/vega-table-cell.js +12 -10
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.js +14 -12
- package/dist/collection/components/vega-table/vega-table-head-row/slimmers/renderers/vega-table-head-row-renderer.js +5 -4
- package/dist/collection/components/vega-table/vega-table-head-row/vega-table-head-row.js +8 -1
- package/dist/collection/components/vega-text/slimmers/renderers/vega-text-tooltip-renderer.js +16 -2
- package/dist/collection/components/vega-text/vega-text.js +1 -1
- package/dist/collection/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.js +1 -0
- package/dist/collection/components/vega-tooltip/vega-tooltip-content-box/vega-tooltip-content-box.css +1 -0
- package/dist/collection/components/vega-tooltip/vega-tooltip-content-box/vega-tooltip-content-box.js +1 -1
- package/dist/collection/components/vega-tooltip/vega-tooltip.js +1 -1
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/rte-manager/dto-renderer-manager.js +42 -2
- package/dist/collection/{components/vega-file-uploader/slimmers/controllers/vega-file-uploader-drop-file-filter-controller.js → helpers/slimmers/drop-file-accept-filter-slimmer.js} +13 -5
- package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/third-party-dialog-wrapper.js +73 -0
- package/dist/collection/helpers/slimmers/element-appender/element-appender-container-controller.js +6 -0
- package/dist/collection/helpers/slimmers/vega-table-child-render-input-consumer-slimmer.js +96 -0
- package/dist/collection/helpers/translation/locales/en.js +3 -0
- package/dist/collection/types/type-guard.js +26 -0
- package/dist/esm/{app-globals-80a7d395.js → app-globals-f67d0eaf.js} +7 -7
- package/dist/esm/{aria-dialog-focusable-trap-slimmer-cc6a8c3e.js → aria-dialog-focusable-trap-slimmer-853a91de.js} +1 -1
- package/dist/esm/{child-nodes-event-prevent-slimmer-2ecc3e1f.js → child-nodes-event-prevent-slimmer-9c24d4fc.js} +1 -1
- package/dist/esm/{code-block-cd913077.js → code-block-b8be290a.js} +3 -3
- package/dist/esm/{component-value-history-controller-slimmer.abstract-e595761d.js → component-value-history-controller-slimmer.abstract-10ccf8e6.js} +4 -4
- package/dist/esm/{content-state-89f8eecb.js → content-state-72b513d1.js} +3 -3
- package/dist/esm/{dark-mode-style-controller-82e5c1c6.js → dark-mode-style-controller-e9a6b097.js} +1 -321
- package/dist/esm/{date-required-rule-2b08f32c.js → date-required-rule-891a6a57.js} +1 -1
- package/dist/esm/{design-token-7566d54c.js → design-token-59d07aa2.js} +6 -130
- package/dist/esm/drop-file-accept-filter-slimmer-ad759e4a.js +62 -0
- package/dist/esm/{dto-renderer-manager-12bc9121.js → dto-renderer-manager-abc7eb5f.js} +42 -2
- package/dist/esm/{element-appender-slimmer-df2a2da2.js → element-appender-slimmer-29c94a18.js} +87 -11
- package/dist/esm/{event-emit-slimmer-9abc9241.js → event-emit-slimmer-32da9d90.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-40fcb5c2.js → form-field-controller-slimmer-899864a8.js} +3 -3
- package/dist/esm/{image-annotation-action-6048d32e.js → image-annotation-action-ebd6c421.js} +3 -3
- package/dist/esm/index-090d31ca.js +4 -0
- package/dist/esm/index.js +19 -17
- package/dist/esm/{inject-keyboard-manager-c6557f50.js → inject-keyboard-manager-dc1d7135.js} +1 -1
- package/dist/esm/{internal-translation-controller-b08aa9ab.js → internal-translation-controller-4fb104b2.js} +3 -0
- package/dist/esm/{internal-vega-event-manager-59f5bd47.js → internal-vega-event-manager-8a657bac.js} +1 -0
- package/dist/esm/{keyboard-manager-c7b125d7.js → keyboard-manager-6ea9968b.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-6109039b.js → keyboard-manager-slimmer-7eed4734.js} +1 -1
- package/dist/esm/loader.js +14 -13
- package/dist/esm/{month-view-generator-139ace5a.js → month-view-generator-aaa27fce.js} +1 -1
- package/dist/esm/{public-rules-e42bce9d.js → public-rules-f2005e11.js} +10 -9
- package/dist/esm/{range-b76edec7.js → range-ed532278.js} +1 -1
- package/dist/esm/{responsive-format-facade-151dbd10.js → responsive-format-facade-e9926018.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-1fc7c040.js → rich-text-editor-required-rule-b559cf1a.js} +1 -1
- package/dist/esm/{split-cell-operation-548ea374.js → split-cell-operation-5587f594.js} +4 -4
- package/dist/esm/state-border-formatter-be51463d.js +129 -0
- package/dist/esm/{string-format-strategy.abstract-6488031a.js → string-format-strategy.abstract-0157b3c5.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-625e17a2.js → string-input-formatter-slimmer-33ed3478.js} +3 -3
- package/dist/esm/{string-mask-strategy-a165d316.js → string-mask-strategy-b58891b5.js} +2 -2
- package/dist/esm/{style-formatter-280757ae.js → style-formatter-9662ae88.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-6c972bb4.js → sub-state-notify-slimmer-1f907173.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-53643b5c.js → sub-state-observer-slimmer-090c500a.js} +1 -1
- package/dist/esm/{time-required-rule-3f5a8822.js → time-required-rule-a9dc8473.js} +1 -1
- package/dist/esm/tinycolor-polyfill-7be0eb93.js +322 -0
- package/dist/esm/{token-extension-5ee7a3f1.js → token-extension-0710dbc5.js} +85 -28
- package/dist/esm/{translation-slimmer-35b1d0fa.js → translation-slimmer-4faae5a3.js} +1 -1
- package/dist/esm/{type-guard-f6c9c89d.js → type-guard-152070e9.js} +28 -2
- package/dist/esm/{valid-credit-card-number-rule-3bf19ad6.js → valid-credit-card-number-rule-a7907cb7.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +7 -6
- package/dist/esm/vega-app-footer.entry.js +2 -1
- package/dist/esm/vega-app-header-button.entry.js +8 -7
- package/dist/esm/vega-banner.entry.js +15 -4
- package/dist/esm/vega-box.entry.js +6 -5
- package/dist/esm/vega-brand-logo.entry.js +2 -1
- package/dist/esm/vega-breadcrumb.entry.js +3 -3
- package/dist/esm/vega-button-circle.entry.js +9 -8
- package/dist/esm/vega-button-group_2.entry.js +102 -13
- package/dist/esm/vega-button-link.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +8 -8
- package/dist/esm/vega-calendar_4.entry.js +10 -10
- package/dist/esm/vega-card.entry.js +5 -4
- package/dist/esm/vega-carousel.entry.js +5 -5
- package/dist/esm/vega-checkbox_2.entry.js +44 -11
- package/dist/esm/vega-chip.entry.js +8 -7
- package/dist/esm/vega-code-block.entry.js +14 -13
- package/dist/esm/vega-color-picker.entry.js +26 -8
- package/dist/esm/vega-color-swatch.entry.js +241 -0
- package/dist/esm/vega-combo-box.entry.js +10 -10
- package/dist/esm/vega-date-picker_2.entry.js +20 -20
- package/dist/esm/vega-dialog_2.entry.js +80 -247
- package/dist/esm/vega-divider.entry.js +5 -4
- package/dist/esm/vega-dropdown_5.entry.js +33 -15
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +40 -90
- package/dist/esm/vega-flag-icon.entry.js +5 -4
- package/dist/esm/vega-flex.entry.js +6 -5
- package/dist/esm/vega-font.entry.js +5 -4
- package/dist/esm/vega-form.entry.js +9 -9
- package/dist/esm/vega-grid.entry.js +5 -4
- package/dist/esm/vega-icon.entry.js +5 -4
- package/dist/esm/vega-image-uploader.entry.js +78 -13
- package/dist/esm/vega-input-credit-card.entry.js +11 -11
- package/dist/esm/vega-input-numeric.entry.js +11 -11
- package/dist/esm/vega-input-passcode.entry.js +10 -10
- package/dist/esm/vega-input-phone-number.entry.js +9 -9
- package/dist/esm/vega-input-range.entry.js +8 -8
- package/dist/esm/vega-input-select.entry.js +50 -15
- package/dist/esm/vega-input.entry.js +11 -11
- package/dist/esm/{vega-internal-event-id-70bd893d.js → vega-internal-event-id-194bac82.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +2 -2
- package/dist/esm/vega-left-nav_5.entry.js +14 -12
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +3 -3
- package/dist/esm/vega-pagination.entry.js +9 -9
- package/dist/esm/vega-popover_2.entry.js +12 -11
- package/dist/esm/vega-progress-tracker_2.entry.js +34 -11
- package/dist/esm/vega-radio_2.entry.js +10 -10
- package/dist/esm/vega-rich-text-content.entry.js +11 -10
- package/dist/esm/vega-rich-text-editor_4.entry.js +75 -29
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +13 -12
- package/dist/esm/vega-segment-control.entry.js +2 -2
- package/dist/esm/vega-selection-chip_2.entry.js +10 -10
- package/dist/esm/vega-selection-tile_2.entry.js +8 -8
- package/dist/esm/vega-sidenav_3.entry.js +8 -8
- package/dist/esm/vega-signature-capture.entry.js +11 -10
- package/dist/esm/vega-stepper.entry.js +9 -9
- package/dist/esm/vega-tab-group_2.entry.js +3 -3
- package/dist/esm/vega-table_11.entry.js +434 -287
- package/dist/esm/vega-text.entry.js +16 -2
- package/dist/esm/vega-textarea.entry.js +7 -7
- package/dist/esm/vega-time-picker_2.entry.js +14 -14
- package/dist/esm/vega-toggle-switch.entry.js +6 -6
- package/dist/esm/vega-tooltip_2.entry.js +9 -8
- package/dist/esm/vega.js +14 -13
- package/dist/esm/{wait-for-component-did-render-6980a1a6.js → wait-for-component-did-render-30cde59c.js} +1 -1
- package/dist/sri/vega-sri-manifest.json +367 -351
- package/dist/types/components/vega-banner/slimmers/renderers/vega-banner-renderer.d.ts +6 -0
- package/dist/types/components/vega-banner/vega-banner.d.ts +2 -0
- package/dist/types/components/vega-button-group/slimmers/controllers/vega-button-group-all-items-disabled-controller.d.ts +21 -0
- package/dist/types/components/vega-button-group/vega-button-group-item/slimmers/controllers/vega-button-group-item-sub-state-controller.d.ts +1 -0
- package/dist/types/components/vega-button-group/vega-button-group-item/slimmers/renderers/vega-button-group-item-renderer.d.ts +1 -0
- package/dist/types/components/vega-button-group/vega-button-group-item/vega-button-group-item.d.ts +1 -0
- package/dist/types/components/vega-button-group/vega-button-group.d.ts +5 -0
- package/dist/types/components/vega-checkbox/vega-checkbox.d.ts +22 -1
- package/dist/types/components/vega-color-picker/vega-color-picker.d.ts +14 -0
- package/dist/types/components/vega-color-swatch/slimmers/renderers/vega-color-swatch-renderer.d.ts +48 -0
- package/dist/types/components/vega-color-swatch/types.d.ts +5 -0
- package/dist/types/components/vega-color-swatch/vega-color-swatch.d.ts +86 -0
- package/dist/types/components/vega-dropdown/vega-dropdown-item/slimmers/controllers/vega-dropdown-item-state-controller.d.ts +1 -0
- package/dist/types/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.d.ts +1 -0
- package/dist/types/components/vega-dropdown/vega-dropdown-item/vega-dropdown-item.d.ts +4 -0
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +10 -0
- package/dist/types/components/vega-file-uploader/vega-file-uploader.d.ts +2 -2
- package/dist/types/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-default-content-renderer.d.ts +25 -0
- package/dist/types/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-preview-content-renderer.d.ts +10 -0
- package/dist/types/components/vega-image-uploader/vega-image-uploader.d.ts +2 -0
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.d.ts +3 -0
- package/dist/types/components/vega-input-select/types.d.ts +14 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +19 -1
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-backdrop-controller.d.ts +1 -0
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.d.ts +0 -1
- package/dist/types/components/vega-modal/slimmers/controllers/vega-nested-modal-controller.d.ts +3 -2
- package/dist/types/components/vega-modal/slimmers/renderers/vega-modal-renderer.d.ts +3 -2
- package/dist/types/components/vega-modal/vega-modal.d.ts +0 -2
- package/dist/types/components/vega-pagination/types.d.ts +7 -1
- package/dist/types/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-step-controller.d.ts +1 -0
- package/dist/types/components/vega-progress-tracker/vega-progress-tracker.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +20 -2
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-extension.d.ts +13 -2
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.d.ts +15 -4
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-extension.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/extension-controller.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +4 -3
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +14 -1
- package/dist/types/components/vega-table/slimmers/controllers/vega-table-render-input-controller.d.ts +8 -1
- package/dist/types/components/vega-table/slimmers/renderers/vega-table-pinned-renderer.d.ts +5 -1
- package/dist/types/components/vega-table/vega-table-cell/vega-table-cell.d.ts +5 -0
- package/dist/types/components/vega-table/vega-table-head-cell/vega-table-head-cell.d.ts +5 -0
- package/dist/types/components/vega-table/vega-table-head-row/slimmers/renderers/vega-table-head-row-renderer.d.ts +1 -0
- package/dist/types/components/vega-table/vega-table-head-row/vega-table-head-row.d.ts +4 -0
- package/dist/types/components/vega-text/slimmers/renderers/vega-text-tooltip-renderer.d.ts +1 -0
- package/dist/types/components/vega-text/types.d.ts +5 -3
- package/dist/types/components/vega-tooltip/vega-tooltip-content-box/vega-tooltip-content-box.d.ts +4 -0
- package/dist/types/components/vega-tooltip/vega-tooltip.d.ts +4 -0
- package/dist/types/components.d.ts +181 -8
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/formatter/string-formatter/string-mask-strategy.d.ts +56 -3
- package/dist/types/helpers/rte-manager/dto-renderer-manager.d.ts +26 -1
- package/dist/types/helpers/slimmers/drop-file-accept-filter-slimmer.d.ts +29 -0
- package/dist/types/helpers/slimmers/element-appender/body-positioned-wrapper/third-party-dialog-wrapper.d.ts +45 -0
- package/dist/types/helpers/slimmers/element-appender/element-appender-container-controller.d.ts +2 -0
- package/dist/types/helpers/slimmers/vega-table-child-render-input-consumer-slimmer.d.ts +48 -0
- package/dist/types/helpers/translation/interface.d.ts +4 -1
- package/dist/types/types/components.type.d.ts +8 -0
- package/dist/types/types/public-api.d.ts +3 -1
- package/dist/types/types/type-guard.d.ts +15 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-2f99c511.js → p-02467b61.js} +1 -1
- package/dist/vega/p-075bb809.entry.js +1 -0
- package/dist/vega/{p-59c6f795.js → p-085de8fc.js} +1 -1
- package/dist/vega/{p-0fc2ccc4.entry.js → p-0915a8d3.entry.js} +1 -1
- package/dist/vega/p-0bcb2945.entry.js +1 -0
- package/dist/vega/{p-e22e5aa1.js → p-0bf8743f.js} +1 -1
- package/dist/vega/{p-a1d51bc2.js → p-0caf52e0.js} +1 -1
- package/dist/vega/{p-42da45e3.entry.js → p-0dbd7723.entry.js} +1 -1
- package/dist/vega/{p-98c44c03.js → p-103d20f5.js} +1 -1
- package/dist/vega/p-115d6053.entry.js +1 -0
- package/dist/vega/{p-0304c3a7.js → p-116e3963.js} +1 -1
- package/dist/vega/p-142f371b.entry.js +1 -0
- package/dist/vega/p-14de7ba0.entry.js +1 -0
- package/dist/vega/p-158c6a9f.entry.js +1 -0
- package/dist/vega/{p-42e246e4.entry.js → p-19a30f98.entry.js} +1 -1
- package/dist/vega/p-1b48e8a5.entry.js +1 -0
- package/dist/vega/{p-e1117034.entry.js → p-1ca95601.entry.js} +1 -1
- package/dist/vega/p-25ab7a33.entry.js +1 -0
- package/dist/vega/p-264b3309.entry.js +1 -0
- package/dist/vega/{p-c0d45f77.entry.js → p-280f63fa.entry.js} +1 -1
- package/dist/vega/p-29d31c98.entry.js +1 -0
- package/dist/vega/{p-7ac9e8ff.entry.js → p-29f42c27.entry.js} +1 -1
- package/dist/vega/p-2b5cf2b3.js +1 -0
- package/dist/vega/{p-679b1f00.entry.js → p-30445cd9.entry.js} +1 -1
- package/dist/vega/p-318f0df5.js +1 -0
- package/dist/vega/p-337a5e76.js +1 -0
- package/dist/vega/p-380abceb.entry.js +1 -0
- package/dist/vega/p-38af89b9.js +1 -0
- package/dist/vega/p-3fae8d3f.entry.js +1 -0
- package/dist/vega/{p-49ae8c79.js → p-42141782.js} +1 -1
- package/dist/vega/{p-d0ac7af8.js → p-44044ed7.js} +1 -1
- package/dist/vega/p-475bd8bf.entry.js +1 -0
- package/dist/vega/{p-e753fac2.entry.js → p-47611a83.entry.js} +1 -1
- package/dist/vega/p-4e95248c.entry.js +1 -0
- package/dist/vega/{p-eccabba7.entry.js → p-513f51ec.entry.js} +1 -1
- package/dist/vega/{p-e8fc8495.entry.js → p-51d2e0ab.entry.js} +1 -1
- package/dist/vega/p-54ba35e3.entry.js +1 -0
- package/dist/vega/{p-dff66a67.entry.js → p-58b6ac33.entry.js} +1 -1
- package/dist/vega/p-596bc4f6.entry.js +1 -0
- package/dist/vega/{p-757bfca2.entry.js → p-597588d0.entry.js} +1 -1
- package/dist/vega/p-5be546c5.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-4ed416e7.js → p-5ffdea8e.js} +1 -1
- package/dist/vega/{p-90a0b9f3.entry.js → p-608f234f.entry.js} +1 -1
- package/dist/vega/{p-3224e47c.js → p-6572e038.js} +1 -1
- package/dist/vega/p-6e9f832f.js +1 -0
- package/dist/vega/p-783531cf.entry.js +1 -0
- package/dist/vega/{p-47a2eec1.entry.js → p-7d85cc74.entry.js} +1 -1
- package/dist/vega/p-7df43192.entry.js +1 -0
- package/dist/vega/p-81a11dc6.entry.js +1 -0
- package/dist/vega/p-8559e36f.entry.js +1 -0
- package/dist/vega/{p-f0d605e9.entry.js → p-8583dd34.entry.js} +1 -1
- package/dist/vega/p-85abe824.entry.js +1 -0
- package/dist/vega/p-874bf8b2.js +1 -0
- package/dist/vega/p-8aee6b74.js +1 -0
- package/dist/vega/{p-9324dd2c.entry.js → p-8b217c7e.entry.js} +1 -1
- package/dist/vega/p-8da66d41.entry.js +1 -0
- package/dist/vega/p-90cb665e.entry.js +1 -0
- package/dist/vega/{p-fd5ddc55.js → p-956b170c.js} +1 -1
- package/dist/vega/{p-001d36af.js → p-9751c801.js} +1 -1
- package/dist/vega/p-988401c3.entry.js +1 -0
- package/dist/vega/{p-f40d479d.entry.js → p-9c1a48b9.entry.js} +1 -1
- package/dist/vega/p-9d854d43.js +1 -0
- package/dist/vega/{p-64e22fe5.js → p-a07c0f8c.js} +1 -1
- package/dist/vega/{p-6216c30e.js → p-a0c3968b.js} +1 -1
- package/dist/vega/p-a4738b70.entry.js +1 -0
- package/dist/vega/p-a6dbc63d.entry.js +1 -0
- package/dist/vega/p-aa985d73.js +1 -0
- package/dist/vega/{p-5f95a2fa.js → p-ab829745.js} +1 -1
- package/dist/vega/p-b08a70e6.entry.js +1 -0
- package/dist/vega/p-b19b1c08.js +1 -0
- package/dist/vega/p-b5497af2.entry.js +1 -0
- package/dist/vega/p-b6c3ce6d.js +1 -0
- package/dist/vega/p-b7624ce4.js +1 -0
- package/dist/vega/{p-83863463.js → p-b9386dd0.js} +1 -1
- package/dist/vega/p-b9728ca8.js +1 -0
- package/dist/vega/{p-88e6618d.js → p-b9947846.js} +1 -1
- package/dist/vega/p-b9a95aca.entry.js +1 -0
- package/dist/vega/{p-53ba1adb.entry.js → p-bb46d8e6.entry.js} +1 -1
- package/dist/vega/p-c36afa21.entry.js +1 -0
- package/dist/vega/{p-f509b439.js → p-c8435185.js} +1 -1
- package/dist/vega/{p-ab4b06c9.entry.js → p-c8d41cdc.entry.js} +1 -1
- package/dist/vega/{p-ff47aeee.entry.js → p-cab70b95.entry.js} +1 -1
- package/dist/vega/p-cc00135a.entry.js +1 -0
- package/dist/vega/p-cc18970f.entry.js +1 -0
- package/dist/vega/p-d320496e.entry.js +1 -0
- package/dist/vega/{p-ae0f03c1.js → p-d32e83e7.js} +1 -1
- package/dist/vega/{p-37a9f4b4.entry.js → p-d456386a.entry.js} +1 -1
- package/dist/vega/{p-d289a6af.js → p-d4f1f007.js} +1 -1
- package/dist/vega/{p-82016096.js → p-d5531d3c.js} +1 -1
- package/dist/vega/{p-9b14ac66.entry.js → p-d7bd2470.entry.js} +1 -1
- package/dist/vega/{p-add63fe0.entry.js → p-e00fb667.entry.js} +1 -1
- package/dist/vega/{p-5a8be21c.entry.js → p-e340d58c.entry.js} +1 -1
- package/dist/vega/{p-dc6e7a77.js → p-e71864ff.js} +1 -1
- package/dist/vega/{p-5e9f6fb6.entry.js → p-ea564928.entry.js} +1 -1
- package/dist/vega/p-eb0ebf50.entry.js +1 -0
- package/dist/vega/p-ebdb489c.entry.js +1 -0
- package/dist/vega/{p-01541820.entry.js → p-ed01657b.entry.js} +1 -1
- package/dist/vega/p-eda7cd76.entry.js +1 -0
- package/dist/vega/{p-68a531cf.js → p-edda10f7.js} +1 -1
- package/dist/vega/{p-24b45c85.js → p-ef59f6f0.js} +1 -1
- package/dist/vega/{p-77c6f14a.entry.js → p-efc8c09e.entry.js} +1 -1
- package/dist/vega/p-f020738c.entry.js +1 -0
- package/dist/vega/{p-f2cef51a.js → p-f7a5746b.js} +1 -1
- package/dist/vega/{p-27dc6562.entry.js → p-f89cf75a.entry.js} +1 -1
- package/dist/vega/p-fb5ea4b2.js +1 -0
- package/dist/vega/p-fc7ab79d.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.js +0 -182
- package/dist/types/components/vega-file-uploader/slimmers/controllers/vega-file-uploader-drop-file-filter-controller.d.ts +0 -22
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.d.ts +0 -51
- package/dist/vega/p-08f03a52.entry.js +0 -1
- package/dist/vega/p-0a145766.entry.js +0 -1
- package/dist/vega/p-0d205fbf.js +0 -1
- package/dist/vega/p-118aeed1.entry.js +0 -1
- package/dist/vega/p-1a4e8d8a.js +0 -1
- package/dist/vega/p-23dc4064.entry.js +0 -1
- package/dist/vega/p-262a27d0.js +0 -1
- package/dist/vega/p-2beace1c.entry.js +0 -1
- package/dist/vega/p-2ce2972f.js +0 -1
- package/dist/vega/p-2e7d5e28.entry.js +0 -1
- package/dist/vega/p-32592497.entry.js +0 -1
- package/dist/vega/p-33860e54.js +0 -1
- package/dist/vega/p-3d2d267d.js +0 -1
- package/dist/vega/p-3f3c771a.entry.js +0 -1
- package/dist/vega/p-4013d954.entry.js +0 -1
- package/dist/vega/p-479a169c.entry.js +0 -1
- package/dist/vega/p-55019e55.entry.js +0 -1
- package/dist/vega/p-565aac6e.entry.js +0 -1
- package/dist/vega/p-574586c9.entry.js +0 -1
- package/dist/vega/p-5781b9f4.entry.js +0 -1
- package/dist/vega/p-57827342.entry.js +0 -1
- package/dist/vega/p-5baff397.js +0 -1
- package/dist/vega/p-62e80151.entry.js +0 -1
- package/dist/vega/p-63d73fa0.entry.js +0 -1
- package/dist/vega/p-76daa632.entry.js +0 -1
- package/dist/vega/p-8ac2d165.js +0 -1
- package/dist/vega/p-9aa1c66a.entry.js +0 -1
- package/dist/vega/p-9b01a28a.entry.js +0 -1
- package/dist/vega/p-ac43be09.entry.js +0 -1
- package/dist/vega/p-b525c800.entry.js +0 -1
- package/dist/vega/p-be651266.entry.js +0 -1
- package/dist/vega/p-c2e7992b.js +0 -1
- package/dist/vega/p-c56aa01c.entry.js +0 -1
- package/dist/vega/p-c8feb644.entry.js +0 -1
- package/dist/vega/p-cc3c661c.entry.js +0 -1
- package/dist/vega/p-cda09e99.entry.js +0 -1
- package/dist/vega/p-d29e8972.entry.js +0 -1
- package/dist/vega/p-d47aa28f.js +0 -1
- package/dist/vega/p-d90eee9a.entry.js +0 -1
- package/dist/vega/p-dcf8f58f.entry.js +0 -1
- package/dist/vega/p-e223e0dc.entry.js +0 -1
- package/dist/vega/p-ea2b5dbb.js +0 -1
- package/dist/vega/p-f2c65579.entry.js +0 -1
- package/dist/vega/p-f5013494.entry.js +0 -1
- package/dist/vega/p-f5d3ce94.js +0 -1
- package/dist/vega/p-f69e2801.entry.js +0 -1
- package/dist/vega/p-fa654762.entry.js +0 -1
- package/dist/vega/p-fbc5a7f6.entry.js +0 -1
- package/dist/vega/p-fcabf0dc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as t}from"./p-8b5d3a52.js";import{a as e,g as n,D as s,f as o,r as i}from"./p-6e70d3cc.js";import{L as r,I as a}from"./p-6e1ab235.js";import{I as l,c}from"./p-593e0f80.js";import{I as h}from"./p-781fd6e0.js";import{c as d}from"./p-6a334573.js";import{P as u}from"./p-81dd00d0.js";import{i as p}from"./p-6e9f832f.js";import{V as f}from"./p-d5531d3c.js";import{R as b,E as g,h as w,U as y,V as m,B as v,a as C,I as x,b as T,c as E,P as S,A as k,d as A}from"./p-d4f1f007.js";import{s as R,A as O,a as I,R as L,b as B,M as j,c as N,d as _,e as M,f as D,g as V,I as P,h as H,i as F,j as K,k as $,l as z,B as G,m as W,n as U,C as Z,o as J,p as X}from"./p-5ffdea8e.js";import{i as q}from"./p-b9386dd0.js";import{R as Q}from"./p-b6c3ce6d.js";import{V as Y}from"./p-a7b5f497.js";import{V as tt}from"./p-e1fbfd20.js";import{v as et}from"./p-4866e390.js";import{D as nt,d as st}from"./p-f28a6074.js";import{V as ot,a as it,b as rt,c as at}from"./p-c5eb0fa6.js";import{R as lt,a as ct,S as ht,T as dt,b as ut,C as pt,M as ft,c as bt,d as gt,e as wt,f as yt,g as mt,h as vt,i as Ct,j as xt,k as Tt,l as Et,m as St,n as kt,o as At,p as Rt,q as Ot,s as It,r as Lt,t as Bt,I as jt,u as Nt,v as _t,w as Mt,x as Dt,y as Vt,z as Pt,A as Ht,B as Ft,D as Kt,E as $t,F as zt,G as Gt,H as Wt,J as Ut,K as Zt,L as Jt,N as Xt,O as qt,P as Qt,Q as Yt,U as te,W as ee,X as ne,Y as se}from"./p-116e3963.js";import{r as oe}from"./p-77e64f26.js";import{V as ie,a as re,b as ae}from"./p-aa985d73.js";import{V as le}from"./p-8aee6b74.js";import{t as ce}from"./p-b75ee3ba.js";import{p as he}from"./p-0c667d6a.js";import{c as de}from"./p-a841cf13.js";import{C as ue}from"./p-2d0d575f.js";import{d as pe}from"./p-1bc5b3bc.js";const fe=[{payloadKey:"IS_LOAD_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaLoaderController is called",canAccept:(t,e)=>"VegaLoaderController"===t&&"load"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSE_METHOD_CALLED",payloadDescription:"Indicate if the method close of public API VegaLoaderController is called",canAccept:(t,e)=>"VegaLoaderController"===t&&"close"===e,payloadValue:()=>!0}];class be{constructor(){this.vegaPublicAPIRuntimeMetricsSlimmer=c(be,["load","close"],fe)}load(t={}){let e=t.containerSelector||"body",n=document.querySelector(e);if(n&&be.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY.includes(n.tagName)&&(e="body",n=document.querySelector("body")),!n)return r.error("Container is not found by selector: ",e),null;const s=this.createLoadingIndicator(t.indicatorOptions),o=this.createLoader(e);return o.append(s),this.appendLoader(o,n)}close(t){const e=this.findLoader(t);if(e){if(e.dataset.container){const t=document.querySelector(e.dataset.container);t&&t.dataset.vegaLoaderOriginPosition&&(t.style.position=t.dataset.vegaLoaderOriginPosition)}e.remove()}}findLoader(t){var e,n;let s;if(t.includes(">>>")){const[o,i]=t.split(">>>");s=null===(n=null===(e=document.querySelector(o))||void 0===e?void 0:e.shadowRoot)||void 0===n?void 0:n.getElementById(i)}else s=document.getElementById(t);return s}createLoader(n){const s=document.createElement("vega-loader-wrapper");return s.className=e(["body"===n?"fixed-wrapper":"absolute-wrapper"]),s.dataset.container=n,s.id=`vega-loader-${t()}`,s}createLoadingIndicator(t={}){const e=document.createElement("vega-loading-indicator");return Object.assign(e,t),e}appendLoader(t,e){return e.dataset.vegaLoaderOriginPosition=e.style.position,e.style.position="relative",e.shadowRoot?(e.shadowRoot.append(t),`${t.dataset.container}>>>${t.id}`):(e.append(t),t.id)}}be.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY=["VEGA-MODAL"],function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);i>3&&r&&Object.defineProperty(e,n,r)}([l()],be.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const ge=new be,we=[{payloadKey:"IS_OPEN_METHOD_CALLED",payloadDescription:"Indicate if the method open of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"open"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSE_METHOD_CALLED",payloadDescription:"Indicate if the method close of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"close"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSEALL_METHOD_CALLED",payloadDescription:"Indicate if the method closeAll of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"closeAll"===e,payloadValue:()=>!0}];var ye=function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r};class me{constructor(){this.resizeObserverSlimmer=d(me,u,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"}],[{callback:t=>{var e;!(t[0].contentRect.height>0)&&(null===(e=this.container)||void 0===e?void 0:e.classList.contains("hydrated"))&&(h.removeZIndex(this.container,"top"),this.container.remove(),this.container=null)},target:()=>this.container}]),this.vegaPublicAPIRuntimeMetricsSlimmer=c(me,["open","close","closeAll"],we)}async open(t){const e=this.createPageNotification(t);return this.getContainer().append(e),e.id}async closeAll(){this.container&&Array.from(this.container.children).forEach((t=>{t.close()}))}async close(t){await document.getElementById(t).close()}connectResizeObserver(){}createPageNotification(e){const o=document.createElement("vega-page-notification");return Object.keys(e).forEach((t=>{void 0!==e[t]&&(o[t]=e[t])})),o.style.marginBottom=n()===s.MOBILE?"12px":"16px",o.id=`vega-page-notification-${t()}`,o}getContainer(){return this.container||(this.container=document.createElement("vega-page-notification-list"),h.setZIndex(this.container,"top"),n()===s.MOBILE?this.container.classList.add("vega-page-notification-list-bottom"):this.container.classList.add("vega-page-notification-list-topRight"),document.body.append(this.container),this.connectResizeObserver()),this.container}}ye([a()],me.prototype,"resizeObserverSlimmer",void 0),ye([l()],me.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const ve=new me,Ce=[{payloadKey:"IS_SETSEMANTICS_METHOD_CALLED",payloadDescription:"Indicate if the method setSemantics of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:()=>!0},{payloadKey:"IS_GETSEMANTICS_METHOD_CALLED",payloadDescription:"Indicate if the method getSemantics of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"getSemantics"===e,payloadValue:()=>!0},{payloadKey:"IS_GETENABLEDEVENTIDSBYCOMPONENT_METHOD_CALLED",payloadDescription:"Indicate if the method getEnabledEventIdsByComponent of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"getEnabledEventIdsByComponent"===e,payloadValue:()=>!0},{payloadKey:"globalEventIsNative",payloadDescription:"Indicate if the vega components will emit events without the vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>!(!t.global||"native"!==t.global.namespace)},{payloadKey:"eventOfSpecificComponentsIsNative",payloadDescription:"Indicate if the vega components will emit events with the vega prefix, but special components will emit events without vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.components){const t=Object.keys(e.components);return!!(t.length>0&&"native"===e.components[t[0]].namespace)}return!1}},{payloadKey:"eventOfSpecificComponentsIsVega",payloadDescription:"Indicate if the vega components will emit events without the vega prefix, but special components will emit events with vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.global&&e.components){const t=Object.keys(e.components);return!!("native"===e.global.namespace&&t.length>0&&"vega"===e.components[t[0]].namespace)}return!1}},{payloadKey:"globalJqueryDelegatedEventIsTrue",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>!(!t.global||!0!==t.global.jqueryDelegatedEvent)},{payloadKey:"jqueryDelegatedEventIsCustomStrategy",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;return!!(e.global&&Array.isArray(e.global.jqueryDelegatedEvent)&&e.global.jqueryDelegatedEvent.length>0)}},{payloadKey:"jqueryDelegatedEventOfSpecialComponentsIsTrue",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.components){const t=Object.keys(e.components);return!!(t.length>0&&!0===e.components[t[0]].jqueryDelegatedEvent)}return!1}}];class xe{constructor(){this.vegaPublicAPIRuntimeMetricsSlimmer=c(xe,["setSemantics","getSemantics","getEnabledEventIdsByComponent"],Ce)}setSemantics(t){p.setSemantics(t)}getSemantics(t){return p.getSemantics(t)}getEnabledEventIdsByComponent(t){return p.getEnabledEventIdsByComponent(t)}}!function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);i>3&&r&&Object.defineProperty(e,n,r)}([l()],xe.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Te=new xe,Ee=[{payloadKey:"IS_OVERRIDEZINDEXBASICVALUES_METHOD_CALLED",payloadDescription:"Indicate if the method overrideZIndexBasicValues of public API ZIndexManager is called",canAccept:(t,e)=>"VegaZIndexManager"===t&&"overrideZIndexBasicValues"===e,payloadValue:()=>!0},{payloadKey:"zIndexBasicValuesGreatThanTenThousand",payloadDescription:"Indicate if the basic z-index value is great than ten thousand",canAccept:(t,e)=>"VegaZIndexManager"===t&&"overrideZIndexBasicValues"===e,payloadValue:t=>t.base>1e4}];class Se{constructor(){this.vegaPublicAPIRuntimeMetricsSlimmer=c(Se,["overrideZIndexBasicValues"],Ee)}overrideZIndexBasicValues(t){h.overrideZIndexBasicValues(t)}}!function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);i>3&&r&&Object.defineProperty(e,n,r)}([l()],Se.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const ke=new Se,Ae=[{payloadKey:"IS_WAITFORVEGA_METHOD_CALLED",payloadDescription:"Indicate if the method waitForVega of public API WaitForVegaHandler is called",canAccept:(t,e)=>"WaitForVegaHandler"===t&&"handle"===e,payloadValue:()=>!0}];class Re{constructor(){this.vegaPublicAPIRuntimeMetricsSlimmer=c(Re,["handle"],Ae)}async handle(){return await Promise.all(Array.from(document.querySelectorAll("*:not(.hydrated)")).filter((t=>t.tagName.startsWith("VEGA"))).map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)})))}}!function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);i>3&&r&&Object.defineProperty(e,n,r)}([l()],Re.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Oe=new Re,Ie=async()=>Oe.handle(),Le=[{payloadKey:"IS_LOAD_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"load"===e,payloadValue:()=>!0},{payloadKey:"IS_UNLOAD_METHOD_CALLED",payloadDescription:"Indicate if the method unLoad of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"unLoad"===e,payloadValue:()=>!0},{payloadKey:"IS_UNLOADALL_METHOD_CALLED",payloadDescription:"Indicate if the method unLoadAll of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"unLoadAll"===e,payloadValue:()=>!0}];class Be{constructor(){this.vegaPublicAPIRuntimeMetricsSlimmer=c(Be,["load","unLoad","unLoadAll"],Le),this.loaderMap=new Map}load({target:e,type:n="text",width:s,height:o,items:i,layout:r}){const a=Array.from(document.body.querySelectorAll(e)),l=`vega-skeleton-loader-${t()}`,c=[];return a.forEach((t=>{const e=i?i.map(this.createSkeleton):[this.createSkeleton({type:n,width:s,height:o})],a=(r?[this.wrapLayout(e,r)]:e).map((t=>(t.dataset[Be.LOADER_DATA_SET_KEY]=l,t)));c.push(...a),t.append(...a)})),this.loaderMap.set(l,c),l}unLoad(t){this.loaderMap.has(t)&&(this.loaderMap.get(t).forEach((t=>t.remove())),this.loaderMap.delete(t))}unLoadAll(){for(const t of this.loaderMap.values())t.forEach((t=>t.remove()));this.loaderMap.clear()}createSkeleton(t){const{type:e,width:n,height:s}=t,o=document.createElement("vega-skeleton");return Object.assign(o,{animated:!0,type:e,width:n,height:s}),o}wrapLayout(t,e){const n=document.createElement("vega-flex");return Object.assign(n,Object.assign({className:"vega-skeleton-loader-template-container"},e.props)),Object.assign(n.style,e.style),n.append(...t),n}}Be.LOADER_DATA_SET_KEY="vegaSkeletonLoaderKey",function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);i>3&&r&&Object.defineProperty(e,n,r)}([l()],Be.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const je=new Be,Ne=[{payloadKey:"IS_INIT_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaTranslation.init is called",canAccept:(t,e)=>"TranslationController"===t&&"init"===e,payloadValue:()=>!0},{payloadKey:"IS_CHANGE_LANGUAGE_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaTranslation.changeLanguage is called",canAccept:(t,e)=>"TranslationController"===t&&"changeLanguage"===e,payloadValue:()=>!0}];class _e{constructor(){this.vegaPublicAPIRuntimeMetricsSlimmer=c(_e,["init","changeLanguage"],Ne)}get currentLanguage(){return f.currentLanguage}init(t){f.init(t)}changeLanguage(t){f.changeLanguage(t)}}!function(t,e,n,s){var o,i=arguments.length,r=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);i>3&&r&&Object.defineProperty(e,n,r)}([l()],_e.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Me=new _e,De=new class{constructor(){this.extensionContextMap=new WeakMap}setExtensionContext(t){t&&t.host&&this.extensionContextMap.set(t.host,t)}getExtensionContext(t){return t?this.extensionContextMap.get(t):null}};class Ve extends Y{injectRTEScopeStyles(){return""}render(t,e,n){var s;const o=this.doRender(n,t,e);return this.fallbackRegisterRef(o,t),this.appendChildren((null===(s=o.childrenContainerGetter)||void 0===s?void 0:s.call(o))||o,t,e,n),o}useRef(t){return t[Ve.REGISTER_REF_FLAG]=!0,function(e){e&&R.register(e,t)}}getDTORenderer(t){return Q.getRTERenderer(t)}getExtensionContext(t){return De.getExtensionContext(t)}appendChildren(t,e,n,s){Array.isArray(e.children)&&e.children.length&&!t.t&&(t.t=e.children.map((t=>this.renderChildren(t,n,s))).filter(q))}renderChildren(t,e,n){const s=this.getDTORenderer(t.type);if(s)return s.render(t,e,n)}fallbackRegisterRef(t,e){e[Ve.REGISTER_REF_FLAG]||!t.o||t.o.ref||(t.o.ref=this.useRef(e))}}Ve.REGISTER_REF_FLAG="__registeredRef__";class Pe{constructor(){this.extensionContext=null,this.hasCustomStylesRenderers=new Set}static registerActionHandleStrategy(t,e,n){O.register(e,t,n)}static registerActionHandlerInterceptor(t,e,n){I.register(e,t,n)}static registerFilterStylesStrategy(t,e){L.register(t,e)}prepareBeforeLoad(t){}initialExtensionAfterLoad(t){this.extensionContext=t,De.setExtensionContext(t)}destroyExtension(){}collectExtensionRendererStyles(){let t="";return this.hasCustomStylesRenderers.size>0&&this.hasCustomStylesRenderers.forEach((e=>{t+=`${e.injectRTEScopeStyles()}\n`})),t}registerNode(t,e){B.registerRTEDTOClass(t,e)}registerRenderer(t,e){Q.registerRTEDTORenderer(t,e),e instanceof Ve&&e.injectRTEScopeStyles()&&this.hasCustomStylesRenderers.add(e)}registerToolbarButtonRenderer(t,e,n){n?Q.registerRTEToolbarButtonRendererForHost(n,t,e):Q.registerRTEToolbarButtonRenderer(t,e)}registerBlockBasicStrategies(t){b.registerBlockBasicStrategies(t)}unRegisterStrategy(t,e){O.unregister(t,e)}unRegisterInterceptor(t,e,n){I.unregister(t,e,n)}registerElementToBlockDTOClassStrategy(t){g.registerElementToBlockStrategy(t)}registerElementToNodeDTOClassStrategy(t){g.registerElementToNodeStrategy(t)}getElementToNodeDTOClassStrategies(){return g.getElementToNodeStrategies()}registerAnnotationHandler(t){w.registerHandler(t)}}class He{isHidden(t){return t.sourceEditMode}getExtensionContext(t){return De.getExtensionContext(t)}renderDropdown(t,e,n,s){return t("vega-dropdown",Object.assign({trigger:"click",searchable:!1,maxWidth:"200",itemDisplayRule:"ellipsis",ref:t=>{nt.addUniqueObserverToNode(t,ot,(t=>{this.handleDropdownClick(t.detail,e)}))}},n),s)}renderDropdownListTemplate(t,e){return t("div",{slot:"items",onMouseDown:this.preventDefault,class:"rte-dropdown-list"},[t("style",{nonce:et.nonce},".rte-dropdown-list vega-dropdown-group vega-dropdown-group { padding-left: 4px }"),...e.map((e=>"children"in e?this.renderDropdownGroup(t,e):this.renderDropdownItem(t,e)))])}renderDropdownItem(t,e){return t("vega-dropdown-item",{key:e.key,itemKey:e.key,label:e.label,prefixIcon:e.icon})}renderDropdownGroup(t,e){return t("vega-dropdown-group",{key:e.key,label:e.label,divide:!1},e.children.map((e=>"children"in e?this.renderDropdownGroup(t,e):this.renderDropdownItem(t,e))))}renderButton(t,e,n){const{icon:s,label:o,showArrowIcon:i}=n,r=this.isDisabled(e);return t("vega-rich-text-editor-toolbar-button",{disabled:r,icon:s,hidden:this.isHidden(e),selected:this.isSelected(e),ref:t=>{nt.addUniqueObserverToNode(t,it,(()=>this.handleButtonClick(e)))},onMouseDown:this.preventDefault},[this.renderButtonLabel(t,e,o),i?t("vega-icon",{size:"size-8",color:r?"text-disabled":"text-secondary",style:{marginLeft:"8px"},icon:tt.getIconKey("chevron-down")}):null].filter(q))}renderButtonLabel(t,e,n){return n?t("vega-font",{variant:"font-field-label-sm",color:this.isDisabled(e)?"text-disabled":"text-primary"},n):null}isDisabled(t){return t.host.disabled}isSelected(t){return!1}preventDefault(t){t.preventDefault()}getListItemByKey(t,e){for(const n of t)if("children"in n){const t=this.getListItemByKey(n.children,e);if(t)return t}else if(n.key===e)return n;return null}}class Fe extends j{constructor(t,e){super(),this.type="INSERT_TOKEN_NODE",this.rteRange=null,this.actionHandleResult=!1,this.rteRange=t,this.token=e}}class Ke extends He{constructor(t){super(),this.tokenList=[],this.tokenList=t}render(t,e){return this.renderDropdown(t,e,{},[this.renderButton(t,e,{label:"Tokens",showArrowIcon:!0}),this.renderDropdownListTemplate(t,this.tokenList)])}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,[s]=n();return s?t.disabled||!O.canHandle("INSERT_TOKEN_NODE",s.parent):t.disabled}return!1}handleButtonClick(t){}handleDropdownClick(t,e){const n=this.getListItemByKey(this.tokenList,t),{rteRange:s}=e,{startNode:o}=s;if(o&&o.parent){const t=new Fe(s,n);o.parent.apply(t),t.actionHandleResult&&this.flushEditorUI(e)}}flushEditorUI(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,flushValue:n}=e;n(t.value)}}}class RTETokenNode extends N{constructor(t,e,n,s,o){super(t,n,s,o),this.type="token",this.token=e,this.text=n}static from(t,e){const n=new RTETokenNode(t.id,t.token,t.text,e);return t.annotations&&(n.annotationMap=this.generateTextAnnotationMap(t.annotations)),n}toJSON(){const t=super.toJSON();return Object.assign({id:this.id,type:this.type,text:this.text,token:this.token},t.annotations?{annotations:t.annotations}:{})}isContentEditable(){return!1}clone(t){return new RTETokenNode(this.id,this.token,this.text,t,this.annotationMap)}toHtml(){return`<span class="token" contenteditable="false" template-token-key="${this.token}" token-key="${this.token}"${super.generateAttributeString()}>${this.text}</span>`}}class $e extends Ve{doRender(t,e,n){const{id:s,token:o}=e;return t("span",Object.assign(Object.assign({key:s,"template-token-key":o,"token-key":o,contenteditable:"false",style:e.getStyles(),class:`token ${e.getClasses()}`},this.additionalAttributes(e)),{ref:this.useRef(e),onClick:t=>{t.preventDefault(),n&&!1!==n.editable&&this.handleTokenElementClick(t,e,n.host)}}),e.text)}injectRTEScopeStyles(){return"span[token-key]{padding: 0 2px; margin: 0 1px; background-color: rgba(var(--v-bg-status-info, 205,209,211))}"}handleTokenElementClick(t,e,n){t.preventDefault(),n&&n.value.apply(new y(e,void 0,!0))}additionalAttributes(t){const e=t.getCustomAttributesAnnotation();let n={wrapped:"true"};return e&&(n=Object.assign(Object.assign({},n),e.render())),n}}class ze extends He{constructor(t,e,n=""){super(),this.languageList=[],this.languageChangeCallback=null,this.selectedLanguage="",this.labelRef=null,this.handleDropdownClick=t=>{this.setSelectedLanguage(t),"function"==typeof this.languageChangeCallback&&this.languageChangeCallback(t)},this.languageList=t,this.languageChangeCallback=e,this.selectedLanguage=n}setSelectedLanguage(t){this.selectedLanguage=t,this.labelRef&&(this.labelRef.textContent=this.getLanguageLabelByKey(t))}isHidden(){return!1}render(t,e){return this.renderDropdown(t,e,{source:this.languageList},[this.renderButton(t,e,{label:this.getLanguageLabelByKey(this.selectedLanguage),showArrowIcon:!0})])}renderButtonLabel(t,e,n){return t("vega-font",{variant:"font-field-label-sm",color:this.isDisabled(e)?"text-disabled":"text-primary",ref:t=>{this.labelRef=t}},n)}handleButtonClick(t){}getLanguageLabelByKey(t){var e;const n=this.getListItemByKey(this.languageList,t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:"Select Language"}}class Ge extends Pe{constructor(t,e){super(),this.languageToolbarButtonRenderer=null,this.languageState={selectedLanguage:"",contentMap:{}},this.languageChangeCallBack=t=>{const e=this.languageState.selectedLanguage;this.extensionContext&&e&&(this.languageState.contentMap[e]=this.getRTELatestValue(this.extensionContext.host)),this.languageState.selectedLanguage=t,this.applyLanguageContent(t,this.languageState.contentMap)},this.languageList=t,e&&(this.languageState=Object.assign(Object.assign({},this.languageState),e)),!this.languageState.selectedLanguage&&t.length>0&&(this.languageState.selectedLanguage=t[0].key)}prepareBeforeLoad(t){this.languageToolbarButtonRenderer=new ze(this.languageList,this.languageChangeCallBack,this.languageState.selectedLanguage),this.registerToolbarButtonRenderer("languages",this.languageToolbarButtonRenderer,t)}initialExtensionAfterLoad(t){super.initialExtensionAfterLoad(t);const{selectedLanguage:e,contentMap:n}=this.languageState;this.languageToolbarButtonRenderer&&this.languageToolbarButtonRenderer.setSelectedLanguage(e),n&&n[e]&&this.applyLanguageContent(this.languageState.selectedLanguage,this.languageState.contentMap)}setState(t){const{selectedLanguage:e,contentMap:n}=t;this.languageToolbarButtonRenderer&&this.languageToolbarButtonRenderer.setSelectedLanguage(e),this.languageState.selectedLanguage=e,this.languageState.contentMap=Object.assign({},n),this.applyLanguageContent(e,n)}getState(){const{selectedLanguage:t,contentMap:e}=this.languageState;return this.extensionContext&&(e[t]=this.getRTELatestValue(this.extensionContext.host)),this.languageState}applyLanguageContent(t,e){if(this.extensionContext&&e){let n=e[t];const{host:s,flushValue:o}=this.extensionContext;n=n?n instanceof m?n:m.fromJSON(n,s.sourceEditConfig):m.createEmptyContent(),s.value!==n&&o(n,!0)}}getRTELatestValue(t){var e;let n=t.value;if(this.extensionContext&&this.extensionContext.isSourceEditMode()&&t.shadowRoot){const s=t.shadowRoot.querySelector(".source-view-container vega-code-block");if(s){let o;t.sourceEditConfig&&(o={autoMatchFormat:null===(e=t.sourceEditConfig.autoMatchFormat)||void 0===e||e,filterInlineStyles:t.sourceEditConfig.filterInlineStyles}),n=m.fromHtml(s.value.code,o)}}return n}}class We extends j{constructor(t){super(),this.type="INSERT_FUNCTION_BLOCK",this.functionType=t}}class RTEFunctionBlock extends _{constructor(t){super(t),this.type="function-block",this.children=[]}static from(t,e){const n=new RTEFunctionBlock(t.id),s={customClass:["statement"]};let{annotations:o}=t;return o=o?Object.assign(Object.assign({},o),s):s,super.convertAnnotationsToMap(n.annotationMap,o),n.children=this.generateBlockChildren(t.children,e,n),n}toHtml(){return`<div class="statement">${this.children.map((t=>t instanceof M?`<div class="statementelement"${this.getFunctionContentStyle(t)}>${t.getChildrenHtml()}</div>`:t.toHtml())).join("")}</div>`}clone(e){const n=new RTEFunctionBlock(t());return n.parent=e,n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,children:this.children.map((t=>t.toJSON()))})}getFunctionContentStyle(t){const e=new D(t);let n=e.toCssText({standalone:!0});const s=t.getAnnotationByType("TEXT_STYLE");if(s&&"paragraph"===s.textStyle){const t=e.toCssText(void 0,void 0,s.renderStyle({standalone:!0}));n=n.replace(t,"").trim()}return n?` style="${n}"`:""}}class Ue extends V{handleAction(t,e){const{functionType:n}=t,s=this.getFunctionBlock(n),o=this.createNewParagraph(""),i=this.getReferenceBlock(e);i?i.parent.apply(new P(i,s,o)):e.apply(new H([s,o])),o&&(t.nextFocusNode=o.children[0])}getFunctionBlock(e){const n=t();return RTEFunctionBlock.from({id:n,type:"function-block",children:[{id:`${n}-1`,type:"logic-control-block",statementText:e.toUpperCase()},{id:`${n}-2`,annotations:{customClass:["statementelement"]},type:"paragraph",nodes:[{id:`${n}-2-1`,type:"text",text:" "}]},{id:`${n}-3`,type:"logic-control-block",statementText:"SHOW"},{id:`${n}-4`,annotations:{customClass:["statementelement"]},type:"paragraph",nodes:[{id:`${n}-4-1`,type:"text",text:" "}]}]})}getReferenceBlock(t){if(!(t instanceof m)){const e=t.parent;return e instanceof RTEFunctionBlock?e:t}}}class RTELogicControlNode extends F{constructor(t,e,n){super(t),this.type="logic-control-node",this.text="",this.text=e,this.parent=n}clone(){return new RTELogicControlNode(this.id,this.text,this.parent)}toHtml(){return this.text}toJSON(){return{id:this.id,type:this.type,text:this.text}}getRangeEndOffset(){return 1}getRangeContainer(){const t=R.getDOMByEntity(this);if(t)return t.parentElement}isContentEditable(){return!1}}class RTELogicControlBlock extends _{constructor(t,e,n){super(t),this.type="logic-control-block",this.children=[],this.statementText="",this.statementText=e,this.children=[new RTELogicControlNode(`${t}-node-1`,e,this)],n&&(this.parent=n)}static from(t){return new RTELogicControlBlock(t.id,t.statementText)}isNotEmpty(){return!0}getLastNode(){return this.children[this.children.length-1]}toHtml(){return`<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`}clone(t){return new RTELogicControlBlock(this.id,this.statementText,t)}toJSON(){return{id:this.id,type:this.type,statementText:this.statementText}}}class Ze extends He{render(t,e){return this.renderDropdown(t,e,{},[this.renderButton(t,e,{label:"Functions",showArrowIcon:!0}),this.renderDropdownListTemplate(t,Ze.FUNCTION_LIST)])}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,s=n()[0];let o=!0;return s&&(o=O.canHandle("INSERT_FUNCTION_BLOCK",s.parent)),t.disabled||!o}return!1}handleButtonClick(){throw new Error("Method not implemented.")}handleDropdownClick(t,e){if(e){const n=this.getExtensionContext(e.host);if(n){const{host:e,getSelectedNodes:s}=n,o=s()[0],i=new We(t);o?o.parent&&o.parent.apply(i):e.value.apply(i),i.nextFocusNode&&e.value.apply(new y(i.nextFocusNode,1))}}}}Ze.FUNCTION_LIST=[{key:"IF",label:"Conditional"},{key:"FOREACH",label:"Foreach"}];class Je extends Ve{doRender(t,e){return t("div",{key:e.id,class:"statementsyntax",ref:this.useRef(e)},t("span",{key:`${e.id}-1`,contenteditable:"false",ref:this.useRef(e.children[0])},e.statementText))}}class Xe extends v{constructor(){super(...arguments),this.blockClassName="statementsyntax"}canHandle(t,e){const n=t[e];return n&&n.nodeType===Node.ELEMENT_NODE&&n.classList.contains(this.blockClassName)&&this.isFunctionBlockChild(n)?1:0}handle(e){const n=e[0];return RTELogicControlBlock.from({id:t(),type:"logic-control-block",statementText:n.innerText})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isFunctionBlockChild(t){return!(!t.parentElement||!t.parentElement.classList.contains("statement"))}}class qe extends Ve{doRender(t,e){return t("div",{key:e.id,class:this.getElementClassName(e),ref:this.useRef(e)})}injectRTEScopeStyles(){return"div.statement{padding:2px 4px;background:rgba(var(--v-bg-accent3-secondary, 255, 239, 200));border:1px solid rgba(var(--v-bg-accent3-primary, 255, 220, 131));border-radius:4px;display:flex;flex-direction:row;justify-content:flex-start;align-items:stretch;gap:4px}div.statement .statementsyntax{padding:3px 0;line-height:22px}.rich-text-content div.statement .statementsyntax,.rich-text-content div.statement .statementelement{display:inline-block}div.statement+div.statement{margin-top:2px}div.statement .statementsyntax span{color:rgb(38, 42, 255);font-weight:bold}div.statement .statementelement{padding:2px 4px;background:rgba(var(--v-bg-secondary, 245, 247, 247));border:1px solid rgba(var(--v-border-color-input-field, 171, 198, 216));border-radius:4px;margin:0;min-width:8px}"}getElementClassName(t){let e=t.getClasses();return e.indexOf("statement")<0&&(e="statement "+e),e.trim()}}class Qe{}class Ye extends Qe{canIntercept(t,e){return e.parent&&e.parent instanceof RTEFunctionBlock}intercept(t,e,n){const s=new x(n.children[0],0);s.isFlushable=!0,n.parent.apply(s)}}class tn extends V{handleAction(t,e){const n=this.createNewParagraph("");n&&(e.parent.apply(new P(e,n)),t.newBlock=n,this.focusToNextLine(n))}focusToNextLine(t){const e=this.getRootContent(t);e&&e.apply(new y(t.children[0],1))}}class en extends j{constructor(t,e,n){super(),this.type="PASTE_PLAIN_TEXT",this.blocksToBeInserted=t,this.startNode=e,this.startOffset=n}}class nn extends Ye{intercept(t,e,n){const{blocksToBeInserted:s,rteRange:o}=e;let{startNode:i,startOffset:r}=e;o&&(i=o.startNode,r=o.startOffset);const a=new en(s,i,r);n.apply(a)}}class sn extends V{handleAction(t,e){const{blocksToBeInserted:n,startNode:s,startOffset:o}=t;if(s instanceof N){const t=n.flatMap((t=>t instanceof M?(this.copyLinkGroupAnnotations(e.annotationMap,t.annotationMap),t.children):[]));t.length>0&&(e.apply(o>0?new P(s,...t):new K(s,...t)),this.focusToNextLine(t[t.length-1],t[t.length-1].getRangeEndOffset()))}}focusToNextLine(t,e){const n=this.getRootContent(t);n&&n.apply(new y(t,e))}copyLinkGroupAnnotations(t,e){if(e&&e.has($.LINK_GROUP)){const n=e.get($.LINK_GROUP);t.has($.LINK_GROUP)?n.linkGroups.forEach(((e,n)=>{t.get($.LINK_GROUP).linkGroups.set(n,e)})):t.set($.LINK_GROUP,e.get($.LINK_GROUP))}}}const on=new Xe,rn=new class extends Xe{constructor(){super(...arguments),this.blockClassName="statementelement"}handle(e,n){const s=w.generate(M,e[0]),o=Array.from(e[0].childNodes);return M.from({id:t(),type:"paragraph",annotations:Object.assign({customClass:[this.blockClassName]},s),nodes:this.generateChildNodes(o,void 0,n)})}},an=new class extends C{canHandle(t,e){const n=t[e];return n&&"DIV"===n.tagName&&n.classList.contains("statement")&&n.childNodes.length&&n.querySelector(".statementsyntax")?1:0}handle(){return RTEFunctionBlock.from({id:t(),type:"function-block",annotations:{customClass:["statement"]},children:[]})}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}};class ln extends Pe{constructor(){super(),this.toolbarButtonRenderer=new Ze,this.registerBlockBasicStrategies(RTELogicControlBlock.name),this.registerBlockBasicStrategies(RTEFunctionBlock.name),this.preventFunctionBlockDefaultInsertNewParagraph(),this.registerNode("logic-control-block",RTELogicControlBlock),this.registerRenderer("logic-control-block",new Je),this.registerNode("function-block",RTEFunctionBlock),this.registerRenderer("function-block",new qe),this.registerToolbarButtonRenderer("functions",this.toolbarButtonRenderer),this.registerElementToBlockDTOClassStrategy(on),this.registerElementToBlockDTOClassStrategy(rn),this.registerElementToBlockDTOClassStrategy(an)}preventFunctionBlockDefaultInsertNewParagraph(){this.unRegisterStrategy(z.INSERT_NEW_PARAGRAPH,RTELogicControlBlock.name),this.unRegisterStrategy(z.APPEND_CHILDREN,RTEFunctionBlock.name),this.unRegisterStrategy(z.INSERT_CHILDREN_AFTER,RTEFunctionBlock.name),this.unRegisterStrategy(z.INSERT_CHILDREN_BEFORE,RTEFunctionBlock.name),this.unRegisterStrategy(z.PASTE_CONTENT,RTELogicControlBlock.name),Pe.registerActionHandleStrategy(RTEFunctionBlock.name,z.INSERT_NEW_PARAGRAPH,new tn)}}(()=>{const t=new Ue;Pe.registerActionHandleStrategy(m.name,"INSERT_FUNCTION_BLOCK",t),Pe.registerActionHandleStrategy(M.name,"INSERT_FUNCTION_BLOCK",t),Pe.registerActionHandleStrategy(T.name,"INSERT_FUNCTION_BLOCK",t),Pe.registerActionHandleStrategy(RTELogicControlBlock.name,"INSERT_FUNCTION_BLOCK",t),Pe.registerActionHandleStrategy(M.name,"PASTE_PLAIN_TEXT",new sn),Pe.registerActionHandlerInterceptor(M.name,z.INSERT_NEW_PARAGRAPH,new Ye),Pe.registerActionHandlerInterceptor(M.name,z.PASTE_CONTENT,new nn)})();class cn extends j{constructor(t){super(),this.isFlushable=!0,this.type="DELETE_TABLE_BLOCK",this.tableBlock=t}}class hn extends G{constructor(){super(...arguments),this.type=lt.CAPTION}static getDefaultStyles(){return{padding:"8px",border:"1px solid #ddd",borderBottom:"none",position:"relative",textAlign:"center",minHeight:"22px"}}clone(){return new hn}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--extension-table-caption"}renderStyle(t){return(null==t?void 0:t.standalone)?Object.assign(Object.assign({},hn.getDefaultStyles()),{backgroundColor:this.getCaptionBackgroundColor()}):null}toJSON(){return{caption:!0}}getCaptionBackgroundColor(){return le.isDarkMode()?ct.dark:ct.light}}class RTETableCaptionBlock extends _{constructor(t,e){super(t),this.type="table-caption";const{autoMatchFormat:n}=e||{autoMatchFormat:!0};n&&this.annotationMap.set(lt.CAPTION,new hn)}static from(t,e){const n=new RTETableCaptionBlock(t.id,e),s=t.annotations||{},{caption:o}=s,i=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(n[s[o]]=t[s[o]])}return n}(s,["caption"]);return o&&n.annotationMap.set(lt.CAPTION,new hn),super.convertAnnotationsToMap(n.annotationMap,Object.assign({},i)),n.children=super.generateBlockChildren(t.children,e,n),n}clone(t){const e=new RTETableCaptionBlock(this.id);return e.children=this.children.map((t=>t.clone(e))),e.parent=t,e.annotationMap=super.cloneAnnotations(),e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.isNotEmpty()))}toHtml(t){const e=this.children.map((e=>e.toHtml(t))).join("");return`<caption${super.generateAttributeString(t)}>${e}</caption>`}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,children:this.children.map((t=>t.toJSON()))})}}O.register(z.INSERT_CHILDREN_BEFORE,RTETableCaptionBlock.name,new E),O.register(z.PASTE_CONTENT,RTETableCaptionBlock.name,new S);class dn extends j{constructor(t){super(),this.type="TOGGLE_TABLE_CAPTION",this.isFlushable=!0,this.shouldEnable=t}}class un extends ht{canHandle(t){return t[0]===dt.CAPTION}execute(t,e,n){const s="rte-table-caption"===t[1],o=new dn(s),i=n.getCaption();if(s){const t=i&&i.isNotEmpty()?i:this.createCaptionBlock(null==i?void 0:i.id);i&&t===i||n.setCaption(t),o.nextFocusNode=t.getLastNode()}else i&&(n.setCaption(null),o.nextFocusNode=n.getFirstNode());this.syncCursorPosition(n,o.nextFocusNode)}syncCursorPosition(t,e){super.syncCursorPosition(t,e)}createCaptionBlock(e){const n={id:null!=e?e:t(),type:"table-caption",children:[{id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]}]};return RTETableCaptionBlock.from(n)}}class pn{constructor(t){this.renderContext=t}getTableExtensionContext(){return this.renderContext?De.getExtensionContext(this.renderContext.host):null}}class fn extends pn{constructor(){super(...arguments),this.settingHandlers=[new ut,new un,new pt,new ft,new bt],this.handleTableClick=(t,e)=>{const n=t.target.closest("table");if(e!==n)return this.popoverRef.hide(),void this.tableDynamicPopover.hide();this.tableDynamicPopover.hide(),this.popoverShow||(oe.call(st.getSubject(this.popoverRef,ie),n),this.popoverRef.show())},this.syncSelectedCells=()=>{if(this.tableSettingRef){const t=this.getTableSelectedCells();this.tableSettingRef.selectedCells=t}},this.handleSettingMenuClick=t=>{const e=this.settingHandlers.find((e=>e.canHandle(t.detail)));if(e){const n=this.getTableExtensionContext();n&&e.execute(t.detail,n,this.tableData),t.detail[0]===dt.CAPTION&&this.updateTableSettingCaption()}t.detail[0]!==dt.TABLE&&t.detail[0]!==dt.CELL||(this.popoverRef.hide(),this.tableDynamicPopover.show(t.detail[0]))},this.handleTableSettingPopoverShow=()=>{this.syncSelectedCells(),this.popoverShow=!0}}render(t,e,n,s){return this.tableData=e,this.tableDynamicPopover=s,t("vega-popover",{trigger:"click",isScreenPosition:!0,class:"rte-table-setting-popover",ref:t=>{this.popoverRef=t,this.popoverRef&&(nt.addUniqueObserverToNode(t,rt,this.handleTableSettingPopoverShow),nt.addUniqueObserverToNode(t,at,(()=>this.popoverShow=!1)))}},[t("div",{slot:"popover"},[t("vega-rich-text-table-setting",{ref:t=>{this.tableSettingRef=t,t&&(t.target=n())},selectedCells:this.getTableSelectedCells(),onVegaClick:this.handleSettingMenuClick})])])}updateTableSettingCaption(){const t=this.tableData.hasCaption();this.tableSettingRef&&this.tableSettingRef.hasCaption!==t&&(this.tableSettingRef.hasCaption=t)}getTableSelectedCells(){let t=[];const e=this.getTableExtensionContext();if(e&&e.tableSelection){const{tableSelection:n}=e;t=n.getSelectedCells()}return t}}class bn{static generateTablePropertiesForm(t){const e=t.annotationMap.get(lt.TABLE);let n={borderStyle:"none",borderColor:"",borderWidth:"",backgroundColor:"",width:"",height:"",textAlign:"center"};if(e){const t=e.toJSON().table,{style:s="none",color:o="",width:i=""}=t.border||{style:"none",color:"",width:""};n={backgroundColor:t.backgroundColor||"",width:t.width||"",height:t.height||"",textAlign:t.alignment,borderStyle:s,borderColor:o,borderWidth:i}}return n}updateCursorPosition(t,e){t&&e&&t.host.value.apply(new y(e,0))}}class gn extends W{constructor(t){super(),this.isFlushable=!0;const{textAlign:e,width:n,borderWidth:s,borderColor:o,borderStyle:i,height:r}=t,a=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(n[s[o]]=t[s[o]])}return n}(t,["textAlign","width","borderWidth","borderColor","borderStyle","height"]);this.tableProperties=Object.assign(Object.assign({},a),{alignment:e,border:{style:i,color:o,width:s?he(s):""},width:n?he(n):"",height:r?he(r):""})}toAnnotation(){return new gt(this.tableProperties)}}class wn extends bn{handle(t,e,n,s){e.apply(new gn(n)),this.updateCursorPosition(t,s)}}class yn extends bn{handle(t,e,n,s){t&&t.host&&(t.flushValue(t.host.value),this.updateCursorPosition(t,s))}}class mn extends bn{handle(t,e,n){const s=new gn(n);s.isFlushable=!1,e.apply(s)}}class vn extends W{constructor(t,e){super(),this.isFlushable=!0,this.cellAnnotation=t,this.originAnnotation=e}toAnnotation(){return this.updateOriginAnnotation(),this.originAnnotation}updateOriginAnnotation(){Object.keys(this.cellAnnotation).forEach((t=>{this.originAnnotation[t]=this.cellAnnotation[t]}))}}class Cn extends vn{constructor(t,e){super(t,e),this.isFlushable=!0}toAnnotation(){return this.updateOriginAnnotation(),this.originAnnotation}}var xn=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(n[s[o]]=t[s[o]])}return n};class Tn{static getStyleCollectionFromCell(t){return t.reduce(((t,e)=>{const n=e.getAnnotationByType(lt.CELL);if(t[e.id]={},n){const s=n.toJSON().tableCell,{border:o}=s,i=xn(s,["border"]),r={};o&&(r.borderStyle=o.style,r.borderColor=o.color,r.borderWidth=o.width),t[e.id]=de(Object.assign(Object.assign({},i),r))}return t}),{})}static convertStyleMapToFormField(t){const e={};for(const n in t){const s=t[n];for(const t in s)e[t]?e[t].push(s[t]):e[t]=[s[t]]}const n=Object.keys(t).length,s={};for(const t in e){const o=e[t],i=new Set(o);o.length===n&&1===i.size&&(s[t]=o[0])}return s}applyProperties(t,e,n){t.tableSelection.getSelectedCells().forEach((t=>{const s=e[t.id];if(s){const e=this.convertToVegaTableCellAnnotation(Object.assign({},s));this.applyAnnotation(t,e,n)}}))}updateCursorPosition(t,e){t&&e&&t.host.value.apply(new y(e,0))}convertToVegaTableCellAnnotation(t){const{borderStyle:e,borderWidth:n,borderColor:s}=t,o=xn(t,["borderStyle","borderWidth","borderColor"]),i=de({style:e,width:n?he(n):"",color:s});return de(Object.assign(Object.assign({},o),{backgroundColor:o.backgroundColor||"",padding:o.padding?he(o.padding):"",width:o.width?he(o.width):"",height:o.height?he(o.height):"",verticalAlign:o.verticalAlign||"",textAlign:o.textAlign||"",border:i}))}applyAnnotation(t,e,n){const s=t.getAnnotationByType(lt.CELL)||new wt({},!1),o=t instanceof yt?new Cn(e,s):new vn(e,s);o.isFlushable=n,t.apply(o)}}class En extends Tn{handle(t,e,n){t&&t.host&&(t.flushValue(t.host.value),this.updateCursorPosition(t,n))}}class Sn extends Tn{handle(t,e){this.applyProperties(t,e,!1)}}class kn extends Tn{handle(t,e,n){this.applyProperties(t,e,!0),this.updateCursorPosition(t,n)}}class An extends pn{constructor(t,e){super(e),this.tableColorSchema=[],this.popoverCloseType="none",this.tablePropertiesHandlerMap={save:new yn,cancel:new wn,change:new mn},this.cellPropertiesHandlerMap={save:new En,cancel:new kn,change:new Sn},this.handleTablePropertiesUpdate=t=>{const e=t.type.replace("vega","").toLowerCase();this.popoverCloseType=e,"change"!==e&&this.hide();const n=this.getTableExtensionContext();n&&this.tablePropertiesHandlerMap[e].handle(n,this.currentTableBlock,t.detail,this.currentFocusNode),"change"===e&&this.popoverRef&&this.popoverRef.show(!0)},this.handleCellPropertiesUpdate=t=>{const e=t.type.replace("vega","").toLowerCase();this.popoverCloseType=e,"change"!==e&&this.hide();const n=this.getTableExtensionContext();n&&this.cellPropertiesHandlerMap[e].handle(n,t.detail,this.currentFocusNode),"change"===e&&this.popoverRef&&this.popoverRef.show(!0)},this.tableColorSchema=t}destroy(){this.selectionAnchorRef&&this.selectionAnchorRef.parentNode&&(nt.removeUniqueObserverFromNode(this.selectionAnchorRef,re),this.selectionAnchorRef.parentNode.removeChild(this.selectionAnchorRef),this.selectionAnchorRef=null)}async show(t){let e=this.getTableRef();const n=this.getTableExtensionContext();let s=[];if(n&&(s=n.tableSelection.getSelectedCells()),t===dt.CELL&&s.length>1){const t=this.getOrCreateSelectionAnchor(s,e);t&&(e=t)}else t===dt.CELL&&1===s.length&&(e=R.getDOMByEntity(s[0]));this.updateContent(t),this.storeCurrentFocusNode(),oe.call(st.getSubject(this.popoverRef,ie),e),await this.popoverRef.show()}async hide(){await this.popoverRef.hide()}render(t,e,n){return this.getTableRef=e,this.currentTableBlock=n,t("vega-popover",{trigger:"click",isScreenPosition:!0,class:"rte-table-dynamic-popover",ref:t=>{this.popoverRef=t,nt.addUniqueObserverToNode(t,at,(()=>{const t=this.getTableExtensionContext();"change"===this.popoverCloseType&&t&&t.flushValue(t.host.value)}))}},[t("div",{slot:"popover",class:"rte-table-dynamic-popover-content"},[t("vega-rich-text-table-properties",{ref:t=>this.tablePropertiesFormRef=t,colors:this.tableColorSchema,type:dt.TABLE,onVegaCancel:this.handleTablePropertiesUpdate,onVegaChange:this.handleTablePropertiesUpdate,onVegaSave:this.handleTablePropertiesUpdate}),t("vega-rich-text-table-properties",{ref:t=>this.cellPropertiesFormRef=t,colors:this.tableColorSchema,type:dt.CELL,onVegaCancel:this.handleCellPropertiesUpdate,onVegaChange:this.handleCellPropertiesUpdate,onVegaSave:this.handleCellPropertiesUpdate})])])}updateContent(t){this.popoverCloseType="none";const e=this.getTableExtensionContext();this.tablePropertiesFormRef&&"TABLE"===t?(this.tablePropertiesFormRef.classList.remove("vega-hidden"),this.cellPropertiesFormRef.classList.add("vega-hidden"),this.tablePropertiesFormRef.defaultValue=bn.generateTablePropertiesForm(this.currentTableBlock)):this.cellPropertiesFormRef&&"CELL"===t&&(this.cellPropertiesFormRef.classList.remove("vega-hidden"),this.tablePropertiesFormRef.classList.add("vega-hidden"),e&&(this.cellPropertiesFormRef.styleMap=Tn.getStyleCollectionFromCell(e.tableSelection.getSelectedCells())),this.cellPropertiesFormRef.defaultValue=Tn.convertStyleMapToFormField(this.cellPropertiesFormRef.styleMap)),e&&e.getSelection().removeAllRanges()}storeCurrentFocusNode(){const t=this.getTableExtensionContext();t&&(this.currentFocusNode=t.getSelectedNodes()[0])}getOrCreateSelectionAnchor(t,e){const n=ce();if(n&&e){const s=e.closest(".rich-text-content"),o=s.getBoundingClientRect();let i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;t.map((t=>R.getDOMByEntity(t))).filter(q).forEach((t=>{const e=t.getBoundingClientRect();i=Math.min(i,e.left-o.left),r=Math.max(r,e.right-o.left),a=Math.min(a,e.top-o.top),l=Math.max(l,e.bottom-o.top)}));const c=r-i,h=l-a;return this.selectionAnchorRef=s.querySelector(".rte-table-selection-popover-anchor"),this.selectionAnchorRef||(this.selectionAnchorRef=n.createElement("div"),this.selectionAnchorRef.className="rte-table-selection-popover-anchor",this.selectionAnchorRef.style.position="absolute",this.selectionAnchorRef.style.pointerEvents="none",s.appendChild(this.selectionAnchorRef),nt.addUniqueObserverToNode(this.selectionAnchorRef,re,(()=>{this.destroy()}))),this.selectionAnchorRef.style.left=`${i}px`,this.selectionAnchorRef.style.top=`${a}px`,this.selectionAnchorRef.style.width=`${c}px`,this.selectionAnchorRef.style.height=`${h}px`,this.selectionAnchorRef}}}class Rn extends Ve{doRender(t,e,n){const s=new fn(n),o=new An(mt.getTableColors(),n);let i;const r=this.renderTable(t,e,(t=>i=t)),a=s.render(t,e,(()=>i),o),l=o.render(t,(()=>i),e),c=e.getAnnotationByType(lt.TABLE),h=n.editable?[t("vega-rich-text-table-selection-widget",{onVegaRemove:t=>{t.stopPropagation(),this.handleTableRemove(e,i)},onClick:t=>s.handleTableClick(t,i),onMouseLeave:()=>{s.syncSelectedCells()}},[t("div",{contentEditable:!0,ref:this.useRef(e)},[r,a,l])])]:[r],d={};if(c){const t=c.renderStyle();d.width=t.width,d.margin=t.margin}const u=t("div",{class:"v-rte--extension-table-container",style:Object.assign({},d)},h);return u.childrenContainerGetter=()=>r,u}injectRTEScopeStyles(){return".v-rte--extension-table-container{display:table}table.v-rte--extension-table{border-collapse:collapse}table.v-rte--extension-table th,table.v-rte--extension-table td{border:1px solid #ddd;padding:12px;text-align:left;vertical-align:middle;min-width:55px;box-sizing:border-box;position:relative}table.v-rte--extension-table th{background-color:#f2f2f2}.rte-table-setting-popover,.rte-table-dynamic-popover{display:block}table.v-rte--extension-table .v-rte-table-cell-focused::after,table.v-rte--extension-table .v-rte-table-cell-selected::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-color:rgba(158, 207, 250, 0.3)}table.v-rte--extension-table:has(.v-rte-table-cell-selected){caret-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::selection{background-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::-moz-selection{background-color:transparent}.v-rte--extension-table-caption{padding:8px;border:1px solid #ddd;border-bottom:none;background-color:rgba(var(--v-bg-table-header, 24, 24, 48));position:relative;display:table-caption;caption-side:top;min-height:22px;text-align:center;word-break:break-word;overflow-wrap:break-word}.v-rte--extension-table-caption.showPlaceholder::before{position:absolute;left:0;right:0;content:attr(data-placeholder);font-family:'Inter', sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1));text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"}renderTable(t,e,n){var s;return t("table",Object.assign(Object.assign({key:e.id},null===(s=e.getCustomAttributesAnnotation())||void 0===s?void 0:s.render()),{style:e.getStyles(),class:e.getClasses(),ref:t=>{this.useRef(e)(t),n(t)}}))}handleTableRemove(t,e){t.parent.apply(new cn(t)),this.destroySelectionAnchor(e)}destroySelectionAnchor(t){const e=t.closest(".rich-text-content");if(e){const t=e.querySelector(".rte-table-selection-popover-anchor");t&&ue.notify(st.getSubject(t,re),{host:t})}}}class On extends Ve{doRender(t,e){return t("thead",{key:e.id,ref:this.useRef(e)})}}class In extends Ve{doRender(t,e){return t("tr",{key:e.id,ref:this.useRef(e)})}}class Ln extends Ve{doRender(t,e,n){return this.renderByCellType(t,e,n,"td")}renderByCellType(t,e,n,s){var o;return t(s,Object.assign(Object.assign(Object.assign({key:`${e.id}-${s}`,ref:this.useRef(e)},null===(o=e.getCustomAttributesAnnotation())||void 0===o?void 0:o.render()),{style:e.getStyles(n),class:e.getClasses()}),n.editable?this.onSelectionListeners(e,n):void 0))}onSelectionListeners(t,e){return{onMouseDown:t=>{const n=o(t.target,"table"),s=o(t.currentTarget,"table")===n,i=t.target.closest("td, th");if(s&&i){const t=this.getExtensionContext(e.host);t&&t.tableSelection.focusCell(i)}},onMouseMove:n=>{n.stopPropagation(),n.preventDefault();const s=this.getExtensionContext(e.host);s&&s.tableSelection.dragOver(t)},onMouseUp:()=>{const t=this.getExtensionContext(e.host);t&&t.tableSelection.endDrag()}}}}class Bn extends Ve{doRender(t,e){return t("tbody",{key:e.id,ref:this.useRef(e)})}}class jn extends Ln{doRender(t,e,n){return super.renderByCellType(t,e,n,"th")}}class Nn extends j{constructor(t,e){super(),this.type="INSERT_TABLE_BLOCK",this.rowCount=t,this.columnCount=e}}class _n extends pn{constructor(){super(...arguments),this.hoveredRows=1,this.hoveredCols=1}render(t,e){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{t&&(this.tablePickerPopoverRef=t,nt.addUniqueObserverToNode(t,rt,(()=>{this.resetPicker()})))}},[t("div",{slot:"popover"},[this.generatePickerStyles(t),this.generateTableSizeGrid(t)]),t("div",{slot:"popover-content"},e)])}generateTableSizeGrid(t){const e=[];for(let n=1;n<=10;n++)for(let s=1;s<=10;s++)e.push(t("button",{class:"rte-table-picker__cell","data-row":n,"data-col":s,onMouseenter:this.handlePickerCellHover.bind(this,n,s),onClick:this.handlePickerClick.bind(this,n,s)},[]));return t("div",{class:"rte-table-picker"},[t("div",{class:"rte-table-picker__grid",ref:t=>{t&&(this.tablePickerGridRef=t)},style:{gridTemplateColumns:"repeat(10, 16px)",gridTemplateRows:"repeat(10, 16px)"}},e),t("div",{class:"rte-table-picker__hint"},t("vega-hint",{ref:t=>{t&&(this.selectedHintRef=t)}},[`${this.hoveredRows} × ${this.hoveredCols}`]))])}generatePickerStyles(t){return t("style",{},["\n.rte-table-picker__grid { display: grid; gap: 2px; }\n.rte-table-picker__cell {\n box-sizing: border-box;\n border: 1px solid #ccc;\n background-color: transparent;\n cursor: pointer;\n}\n.rte-table-picker__cell:hover {\n background-color: #cae1fc;\n}\n.rte-table-picker__cell.active {\n background-color: #cae1fc;\n}\n.rte-table-picker__hint {\n text-align: center;\n}\n "])}createTable(t,e){const n=this.getTableExtensionContext();if(n){const{host:s,getSelectedNodes:o}=n,i=o()[0],r=new Nn(t,e);i?i.parent&&i.parent.apply(r):s.value.apply(r),r.nextFocusNode&&s.value.apply(new y(r.nextFocusNode,1))}}handlePickerClick(t,e){this.createTable(t,e),this.tablePickerPopoverRef.hide()}handlePickerCellHover(t,e){this.hoveredRows=t,this.hoveredCols=e,Array.from(this.tablePickerGridRef.children).forEach((t=>{const e=Number(t.dataset.row),n=Number(t.dataset.col);e<=this.hoveredRows&&n<=this.hoveredCols?t.classList.add("active"):t.classList.remove("active")})),this.selectedHintRef.textContent=`${this.hoveredRows} × ${this.hoveredCols}`}resetPicker(){this.handlePickerCellHover(1,1)}}class Mn extends He{render(t,e){return new _n(e).render(t,super.renderButton(t,e,{showArrowIcon:!0,icon:"rte-table"}))}isDisabled(t){let e=super.isDisabled(t);const n=this.getExtensionContext(t.host);if(n){const{host:t,getSelectedNodes:s}=n,o=s()[0];let i=!0;o&&(i=O.canHandle("INSERT_TABLE_BLOCK",o.parent)&&O.canHandle(z.INSERT_CHILDREN_AFTER,o.parent.parent)),e=t.disabled||!i}return e}handleButtonClick(){}handleDropdownClick(){}}tt.register({"rte-table":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M48 264V160H232V264H48zm0 48H232V432H64c-8.8 0-16-7.2-16-16V312zM280 432V312H464V416c0 8.8-7.2 16-16 16H280zM464 264H280V160H464V264zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"/></svg>'}});class Dn extends V{handleAction(t,e){const n=this.createTableBlock(t.rowCount,t.columnCount),s=super.createNewParagraph(""),o=this.getReferenceBlock(e);o?o.parent.apply(new P(o,n,s)):e.apply(new H([n,s])),t.nextFocusNode=n.getFirstNode()}createTableBlock(e,n){const s=Math.max(e,1),o=Math.max(n,1);return vt.from({id:t(),type:"table-block",children:[Ct(s,o)]})}getReferenceBlock(t){if(!(t instanceof m))return t}}class Vn extends Qe{canIntercept(t,e){const n=e.parent;return n instanceof xt&&1===n.children.length&&0===t.startOffset}intercept(){}}class Pn extends V{handleAction(t){const e=t.tableBlock,n=e.parent,s=super.getRootContent(e),o=super.createNewParagraph("");n.apply(new P(e,o)),n.apply(new U(e)),s&&s.apply(new y(o.getLastNode()))}}class Hn extends Qe{canIntercept(t,e){return t.entityToBeRemoved&&1===e.children.length}intercept(e,n,s){if(!(n.entityToBeRemoved instanceof M)){const e=M.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]});return s.children=[],void s.apply(new H([e]))}n.entityToBeRemoved.apply(new H([new N(t(),"",n.entityToBeRemoved)]))}}class Fn extends Ve{doRender(t,e){return t("caption",{key:e.id,ref:this.useRef(e),style:e.getStyles(),class:[e.getClasses(),e.isNotEmpty()?null:"showPlaceholder"].filter(q).join(" "),"data-placeholder":"Enter table caption"})}}class Kn extends V{getRowsMaxCellCount(t){let e=0;for(const n of t){let t=0;for(const e of n.children)t+=e.colSpan;e=Math.max(e,t)}return e}getRowCellStartCols(t){const e=this.getRowsMaxCellCount(t),n=new Array(t.length),s=new Array(e).fill(0);for(let e=0;e<t.length;e++){const o=t[e].children,i=new Array(o.length);let r=0;for(let t=0;t<o.length;t++){const e=o[t];for(;r<s.length&&s[r]>0;)r++;i[t]=r;const n=Math.max(e.colSpan,Kn.DEFAULT_CELLSPAN);if(e.rowSpan>Kn.DEFAULT_CELLSPAN)for(let t=0;t<n;t++){const n=r+t;n<s.length&&(s[n]=Math.max(s[n],e.rowSpan))}r+=n}n[e]=i;for(let t=0;t<s.length;t++)s[t]>0&&s[t]--}return n}updateCellSpan(t,e,n){const s=t.getCustomAttributesAnnotation();if(n<=Kn.DEFAULT_CELLSPAN){if(s){const n=s.render();delete n[e],t.annotationMap.set(Z.CUSTOM_ATTRIBUTE,new J(n))}}else{const o=s?s.render():{};o[e]=n.toString(),t.annotationMap.set(Z.CUSTOM_ATTRIBUTE,new J(o))}}insertMovedCells(t,e,n){t.forEach(((t,s)=>{const o=e[s];if(o){const e=n[s]||[];t.sort(((t,e)=>t.logicalStartCol===e.logicalStartCol?e.cellIndex-t.cellIndex:e.logicalStartCol-t.logicalStartCol)),t.forEach((t=>{const{cell:n,logicalStartCol:s}=t;if(0===o.children.length)return o.apply(new H([n])),void(e[0]=s);const i=e.findIndex((t=>t>=s));-1===i?(o.apply(new P(o.children[o.children.length-1],n)),e.push(s)):0===i?(o.apply(new K(o.children[0],n)),e.unshift(s)):(o.apply(new K(o.children[i],n)),e.splice(i,0,s))}))}}))}splitRowsBySection(t){const e=[],n=[];return t.forEach((t=>{t.parent instanceof Tt?e.push(t):n.push(t)})),[e,n]}buildSelectedIndices(t,e){return new Set(t.map((t=>e.indexOf(t))).filter((t=>t>=0)))}intersectsRemovalRange(t,e,n,s){return t<=s&&e>=n}countRemovedRows(t,e,n){let s=0;for(let o=t;o<=e;o++)n.has(o)&&s++;return s}getHeadCellLength(t){let e=0;for(let n=0;n<t.children.length;n++){const s=t.children[n];if(!(s instanceof yt))break;e+=s.colSpan}return e}getTheStartSpanCell(t,e,n,s){const o={rowIndex:n};for(let i=n;i>=0;i--){const n=e[i];if(n.includes(s)){o.cell=t[i].children[n.indexOf(s)],o.rowIndex=i;break}}return o}getDefaultCellBlockTemplate(e,n,s=1){const o=de({colspan:n>1?n.toString():null,rowspan:s>1?s.toString():null}),i=t(),r={id:i,type:e,children:[{id:`${i}-p`,type:"paragraph",nodes:[{id:`${i}-p-t`,type:"text",text:""}]}]};return Object.keys(o).length>0&&(r.annotations={customAttribute:o}),r}getSortedValuesByNumericKey(t){return Array.from(t.entries()).sort((([t],[e])=>t-e)).map((([,t])=>t))}}Kn.DEFAULT_CELLSPAN=1;class $n extends Kn{handleAction(t,e){const{rowsToBeRemoved:n}=t,s=this.getFutureFocusRow(n[0],n[n.length-1],e),o=this.splitRowsBySection(n);if(this.removeRows(o[0]),this.removeRows(o[1]),s){const t=this.getRootContent(e);if(t){const e=s.getLastNode();t.apply(new y(e,e.getRangeEndOffset()))}}}removeRows(t){if(0===t.length)return;const e=t[0].parent,n=e.children,s=this.buildSelectedIndices(t,n);if(s.size>0){if(n.length===t.length)return void e.parent.apply(new U(e));const o=Math.min(...s),i=Math.max(...s),r=this.getRowCellStartCols(n),a=this.collectCellsToMove(n,r,s,o,i);this.insertMovedCells(a,n,r),t.forEach((t=>{t.parent.apply(new U(t))}))}}collectCellsToMove(t,e,n,s,o){const i=new Map,r=t.length;for(let a=0;a<r;a++){const l=t[a],c=l.children.length;for(let t=0;t<c;t++){const c=l.children[t],h=c.rowSpan;if(h<=Kn.DEFAULT_CELLSPAN)continue;const d=a+h-1;if(!this.intersectsRemovalRange(a,d,s,o))continue;const u=h-this.countRemovedRows(a,d,n);if(a<s&&d>=s)this.updateCellSpan(c,"rowspan",u);else if(a>=s&&d>o){const s=o+1;if(s<r&&!n.has(s)){const n=e[a][t];i.has(s)||i.set(s,[]),i.get(s).push({cell:this.cloneCellWithRowSpan(c,u),newRowSpan:u,cellIndex:t,logicalStartCol:n})}}}}return i}cloneCellWithRowSpan(t,e){const n=t.clone(t.parent);return this.updateCellSpan(n,"rowspan",e),n}getFutureFocusRow(t,e,n){const s=n.children.filter((t=>t instanceof Tt||t instanceof Et)).flatMap((t=>t.children)),o=s.indexOf(t),i=s.indexOf(e);return s[o-1]?s[o-1]:s[i+1]?s[i+1]:void 0}}class zn{constructor(){this.dragging=!1,this.anchorCell=null,this.selectedCells=new Set,this.syncRTESelectionWithDebounce=pe(this.syncRTESelection,100,this),this.handleSelectionChangeWithDebounce=pe(this.handleSelectionChange,10,this),this.filterSelectedCell=(t,e)=>{const n=new Set;if(t.intersectsNode(e)){if(e.nodeType===Node.TEXT_NODE){const t=R.getEntityByDOM(e.parentElement);if(t){const e=St(t.parent,xt);if(e)return n.add(e),Array.from(n)}}e.childNodes.forEach((e=>this.filterSelectedCell(t,e).forEach((t=>{n.add(t)}))))}return Array.from(n)},this.updateSelectedStyles=(t,e)=>{const n=1===e?"v-rte-table-cell-focused":"v-rte-table-cell-selected",s=R.getDOMByEntity(t);s&&s.classList.add(n)},this.handleDocMouseUp=()=>{this.endDrag();const t=ce();t&&t.removeEventListener("mouseup",this.handleDocMouseUp)},this.handleContentClick=()=>{this.clearSelection();const t=this.context.host.shadowRoot.querySelector(".rich-text-editor-container");t&&t.removeEventListener("mousedown",this.handleContentClick,!0)}}static computeRectRange(t,e){const n=t.parent.parent.parent;if(n!==e.parent.parent.parent)return[];const s=[];n.children.forEach((t=>{t.children.forEach((t=>s.push(t)))}));const{grid:o,cellMeta:i}=zn.buildCellGrid(s),r=i.get(t),a=i.get(e);if(!r||!a)return[];const l=r.row+r.rowSpan-1,c=r.col,h=r.col+r.colSpan-1,d=a.row+a.rowSpan-1,u=a.col,p=a.col+a.colSpan-1,f=Math.min(r.row,a.row),b=Math.max(l,d),g=Math.min(c,u),w=Math.max(h,p),y=new Set;for(let t=f;t<=b;t++){const e=o[t];for(let t=g;t<=w;t++){const n=e[t];n&&y.add(n)}}return Array.from(y)}static getCellSpan(t){let e=1,n=1;const s=t.getAnnotationByType(Z.CUSTOM_ATTRIBUTE);if(s&&s.customAttribute){const t=s.customAttribute;t.rowSpan&&(e=parseInt(t.rowSpan,10)),t.colSpan&&(n=parseInt(t.colSpan,10))}if(1===e&&1===n){const s=R.getDOMByEntity(t);if(s){const t=s.getAttribute("rowSpan"),o=s.getAttribute("colSpan");t&&(e=parseInt(t,10)),o&&(n=parseInt(o,10))}}return{rowSpan:Number.isFinite(e)&&e>0?e:1,colSpan:Number.isFinite(n)&&n>0?n:1}}static buildCellGrid(t){const e=[],n=new Map;for(let s=0;s<t.length;s++){const o=t[s];e[s]||(e[s]=[]);let i=0;for(let t=0;t<o.children.length;t++){const r=o.children[t];for(;e[s][i];)i+=1;const{rowSpan:a,colSpan:l}=zn.getCellSpan(r);n.set(r,{row:s,col:i,rowSpan:a,colSpan:l});for(let t=0;t<a;t++){const n=s+t;e[n]||(e[n]=[]);for(let t=0;t<l;t++)e[n][i+t]=r}i+=l}}return{grid:e,cellMeta:n}}destroy(){this.removeSelectionChangeListener()}init(t){this.context=t,this.addSelectionChangeListener()}setSelectedCells(t){const e=Array.from(this.selectedCells)[0]||t[0];this.updateSelectedCells(t),this.emitCellSelectionChange(e,t)}getSelectedCells(){return Array.from(this.selectedCells)}focusCell(t){const e=R.getEntityByDOM(t);e&&(this.anchorCell=e,this.setSelectedCells([e]),this.addListeners())}dragOver(t){if(!this.anchorCell)return;const e=zn.computeRectRange(this.anchorCell,t);e.length>1&&this.startDrag(),this.dragging&&(this.preventTextSelection(e),this.updateSelectedCells(e,{debounceSync:!0}))}endDrag(){this.dragging=!1,this.anchorCell=null}emitCellSelectionChange(t,e){const n=St(t,vt);if(n){const t=R.getDOMByEntity(n);t&&ue.notify(st.getSubject(t,ae),{host:t,detail:e})}}clearSelection(){this.selectedCells.forEach((t=>{const e=R.getDOMByEntity(t);e&&e.classList.remove("v-rte-table-cell-selected","v-rte-table-cell-focused")})),this.selectedCells.clear()}addSelectionChangeListener(){const t=ce();t&&t.addEventListener("selectionchange",this.handleSelectionChangeWithDebounce)}removeSelectionChangeListener(){const t=ce();t&&t.removeEventListener("selectionchange",this.handleSelectionChangeWithDebounce)}handleSelectionChange(){if(this.dragging)return void this.syncRTESelectionWithDebounce();const t=this.context.getSelection();if(t.rangeCount>0){const e=t.getRangeAt(0),n=e.commonAncestorContainer;if(o(n,"table")){const t=this.filterSelectedCell(e,n);this.setSelectedCells(t)}}}startDrag(){this.dragging=!0}updateSelectedCells(t,{debounceSync:e}={}){this.clearSelection(),t.forEach((e=>{this.selectedCells.add(e),this.updateSelectedStyles(e,t.length)})),e?this.syncRTESelectionWithDebounce():this.syncRTESelection()}syncRTESelection(){const t=Array.from(this.selectedCells),e=t.flatMap((t=>t.children.flatMap((t=>t.children.flatMap((t=>{if(t instanceof F)return t})))))).filter(q);t.length>1&&this.context.setSelectedNodes(e,{startNode:e[0],endNode:e[e.length-1],startOffset:0,endOffset:e[e.length-1].getRangeEndOffset()})}preventTextSelection(t){const e=this.context.getSelection();if(e.removeAllRanges(),t.length>0){const n=R.getDOMByEntity(t[0]);if(n){const t=new Range;t.setStart(n,0),t.setEnd(n,0),e.addRange(t)}}}addListeners(){const t=ce();t&&t.addEventListener("mouseup",this.handleDocMouseUp);const e=this.context.host.shadowRoot.querySelector(".rich-text-editor-container");e&&e.addEventListener("mousedown",this.handleContentClick,!0)}}class Gn extends Kn{handleAction(t,e){const{selectedRows:n}=t,[s,o]=this.splitRowsBySection(n);o.length>0?this.convertToHeaderRows(o,e):this.revertToBodyRows(s,e);const i=this.getRootContent(e);if(i){const t=n[0].getFirstNode();t&&i.apply(new y(t,0))}}convertToHeaderRows(e,n){let s=n.children.find((t=>t instanceof Tt));const o=e[0].parent;s||(s=Tt.from({id:t(),type:"table-head",children:[]}),n.apply(new K(o,s)));const i=o.children.indexOf(e[e.length-1]),r=o.children.slice(0,i+1),a=this.buildSelectedIndices(r,o.children),l=Math.min(...a),c=Math.max(...a);if(a.size>0){if(a.size<o.children.length){const t=this.getRowCellStartCols(o.children),e=this.collectCellsToMove(o.children,t,a,l,c);this.insertMovedCells(e,o.children,t)}this.convertBodyRowsToHeaderRows(o,s,r)}}convertBodyRowsToHeaderRows(t,e,n){for(let e=0;e<n.length;e++){const s=n[e];s.children=s.children.map((t=>this.convertTdToTh(t))),t.apply(new U(s))}e.apply(new H(n))}revertToBodyRows(e,n){let s=n.children.find((t=>t instanceof Et));const o=e[0].parent;s||(s=Et.from({id:t(),type:"table-body",children:[]}),n.apply(new P(o,s)));const i=o.children.indexOf(e[0]),r=o.children.slice(i),a=this.buildSelectedIndices(r,o.children);if(a.size>0){const t=this.getRowCellStartCols(o.children),e=this.collectCellsToMove(o.children,t,a,Math.min(...a),Math.max(...a));this.insertMovedCells(e,o.children,t),this.convertHeadRowsToBodyRows(o,s,r)}}convertHeadRowsToBodyRows(t,e,n){const s=e.children[0],o=this.getRowCellStartCols(n);for(let i=0;i<n.length;i++){const r=n[i];t.apply(new U(r));const a=s?this.getHeadCellLength(s):0;r.children=this.convertThToTd(r,o[i],a),s&&e.apply(new K(s,r))}s||e.apply(new H(n))}collectCellsToMove(t,e,n,s,o){const i=new Map,r=t.length;for(let a=0;a<r;a++){const l=t[a],c=l.children.length;for(let t=0;t<c;t++){const c=l.children[t],h=c.rowSpan;if(h<=Kn.DEFAULT_CELLSPAN)continue;const d=a+h-1;if(!this.intersectsRemovalRange(a,d,s,o))continue;const u=this.countRemovedRows(a,d,n),p=h-u;if(a<s&&d>=s){this.updateCellSpan(c,"rowspan",p);const o=s;if(o<r&&n.has(o)){const n=e[a][t];i.has(o)||i.set(o,[]),i.get(o).push({cell:this.cloneCellWithRowSpan(c,u),newRowSpan:u,cellIndex:t,logicalStartCol:n})}}else if(a>=s&&d>o){this.updateCellSpan(c,"rowspan",u);const s=o+1;if(s<r&&!n.has(s)){const n=e[a][t];i.has(s)||i.set(s,[]),i.get(s).push({cell:this.cloneCellWithRowSpan(c,p),newRowSpan:p,cellIndex:t,logicalStartCol:n})}}}}return i}convertTdToTh(t){if(t instanceof yt)return t;const e=yt.from(t.toJSON());return e.parent=t.parent,e}convertThToTd(t,e,n){return t.children.map(((s,o)=>{let i=s;const r=e[o]<n,a=s.toJSON();return i=r?s:xt.from(this.deleteHeadCellDefaultBackground(a)),i.parent=t,i}))}cloneCellWithRowSpan(e,n){const s=e.clone(e.parent);s.id=t(),s.children=[];const o=this.createNewParagraph("");return o&&s.apply(new H([o])),this.updateCellSpan(s,"rowspan",n),s}deleteHeadCellDefaultBackground(t){var e;if(t&&t.annotations&&t.annotations.customStyle){delete t.annotations.tableCell;const n=t.annotations.customStyle.backgroundColor,s=kt.getDefaultBackgroundColor();!n||n!==s&&(null===(e=i(n))||void 0===e?void 0:e.toUpperCase())!==s||delete t.annotations.customStyle.backgroundColor}return t}}class Wn extends At{handleAction(t,e){const{insertDirection:n,tableCellInsertRange:s}=t,o=new Set(s.map((t=>t.id))),i=Rt(e),r=Ot(i),[a,l]=this.getBoundaryCellColumnRange(s,i,r),c=n===jt.LEFT?a:l+1,h=this.hasSelectedCellInsideTargetColumn(i,r,c,o),d=new Set;i.forEach(((t,s)=>{if(d.has(s))return;const a=this.findExpandableCell(t,s,c,r,n,o,h);if(a){const t=a.rowSpan;if(It(a,a.colSpan+1,a.rowSpan,e,!0),t>1)for(let e=1;e<t;e++)d.add(s+e);return}const l=this.findInsertPosition(t,s,c,r,i);if(l){const e=this.generateTableCell(l.templateCell);t.apply(l.before?new K(l.anchorCell,e):new P(l.anchorCell,e))}}))}findExpandableCell(t,e,n,s,o,i,r){const a=s[e],l=t.children.reduce(((t,e)=>t+(i.has(e.id)?1:0)),0);for(const c of t.children){const t=a.indexOf(c.id),h=t+c.colSpan,d=n===h,u=e+c.rowSpan>=s.length,p=i.has(c.id),f=n>t&&n<h;if(o===jt.LEFT?f:f&&(!p||!u)||d&&c.colSpan>1&&p&&!u&&1===l&&!r)return c}return null}hasSelectedCellInsideTargetColumn(t,e,n,s){for(let o=0;o<t.length;o++){const i=t[o],r=e[o];for(const t of i.children){if(!s.has(t.id))continue;const e=r.indexOf(t.id),o=e+t.colSpan;if(n>e&&n<o)return!0}}return!1}findInsertPosition(t,e,n,s,o){const i=s[e];let r=t.children[0];if(n>=0&&n<i.length){const t=Lt(o,i[n]);t&&(r=t)}let a=0;for(let e=0;e<t.children.length;e++){const s=t.children[e];for(;a<i.length&&i[a]!==s.id;)a++;if(a>=n)return{anchorCell:s,templateCell:r,before:!0};const o=a+s.colSpan;if(o>n||e===t.children.length-1)return{anchorCell:s,templateCell:r,before:!1};a=o}return null}generateTableCell(t){return t instanceof yt?yt.from(Bt(t.type)):xt.from(Bt(t.type))}}class Un extends At{handleAction(t,e){const n=Rt(e),s=Ot(n),[o,i]=this.getBoundaryCellColumnRange(t.tableCellDeleteRange,n,s),r=Math.max(n.indexOf(t.tableCellDeleteRange[t.tableCellDeleteRange.length-1].parent),0),{coveredCellIds:a,coveredCells:l,adjustmentCellInfo:c}=this.getDeleteCellsInfo(n,o,i,s),h=this.findNextFocusableCell(n,s,o,i,a,r);this.deleteCells(l,c,e);const d=this.getRootContent(e),u=Mt(h);d&&u&&d.apply(new y(u))}getDeleteCellsInfo(t,e,n,s){const o=[],i=new Set,r=[],a=Nt(s);return t.forEach((t=>{t.children.forEach((t=>{const s=a.get(t.id);if(void 0===s)return;const{colSpan:l,rowSpan:c}=Dt(t),h=this.getColumnOverlapCount(s,l,e,n);if(h<=0)return;if(h===l)return o.push(t),void i.add(t.id);const d=Math.max(1,l-h);r.push({cell:t,nextColSpan:d,rowSpan:c})}))})),{coveredCells:o,coveredCellIds:i,adjustmentCellInfo:r}}findNextFocusableCell(t,e,n,s,o,i){for(let r=0;r<t.length;r++){const a=this.findFocusableCellIdInGridRow(e[(i+r)%t.length],n,s,o);if(!a)continue;const l=Lt(t,a);if(l)return l}return null}findFocusableCellIdInGridRow(t,e,n,s){for(let e=n+1;e<t.length;e++){const n=t[e];if(n&&!s.has(n))return n}for(let n=e-1;n>=0;n--){const e=t[n];if(e&&!s.has(e))return e}return null}deleteCells(t,e,n){t.forEach((t=>{t.parent.apply(new U(t))}));const s=new Set;e.forEach((({cell:t,nextColSpan:e,rowSpan:o})=>{s.add(t.id),It(t,e,o,n)})),this.normalizeRemainingCellSpans(n,s)}normalizeRemainingCellSpans(t,e){Rt(t).forEach((n=>{n.children.forEach((n=>{const{colSpan:s,rowSpan:o}=Dt(n);if(e.has(n.id)){const e=_t(t);if(!(o>1&&s===e))return}It(n,s,o,t)}))}))}getColumnOverlapCount(t,e,n,s){const o=t+e-1,i=Math.max(t,n),r=Math.min(o,s);return i<=r?r-i+1:0}}class Zn extends j{constructor(t){super(),this.isFlushable=!0,this.type="CREATE_SEGMENT_TABLE_CELL",this.payload=t}}class Jn extends V{handleAction(t,e){const{table:n,sourceCell:s,colSpan:o,cellType:i,keepSourceContent:r}=t.payload,a=r?this.convertCellType(s,i):Vt(i);It(a,o,s.rowSpan,n),e.apply(new K(s,a))}convertCellType(t,e){return"table-head-cell"===e?yt.from(t.toJSON()):xt.from(t.toJSON())}}class Xn extends V{handleAction(t,e){const{cell:n,targetCellType:s}=t.payload,o="table-head-cell"===s?yt.from(n.toJSON()):xt.from(n.toJSON());e.apply(new K(n,o)),e.apply(new U(n))}}class qn extends V{handleAction(t,e){const{table:n,cell:s,col:o,cellStartCol:i,endCol:r,targetCellType:a}=t.payload,l=i+s.colSpan-1,c=o>i?o-i:0,h=Math.min(r,l),d=h-o+1,u=l-h;c>0&&e.apply(new Zn({table:n,sourceCell:s,colSpan:c,cellType:s.type,keepSourceContent:!0})),e.apply(new Zn({table:n,sourceCell:s,colSpan:d,cellType:a,keepSourceContent:0===c})),u>0&&e.apply(new Zn({table:n,sourceCell:s,colSpan:u,cellType:s.type,keepSourceContent:0===c&&d===s.colSpan})),e.apply(new U(s))}}class Qn extends At{handleAction(t,e){const n=Rt(e),s=Ot(n),o=Nt(s),[i,r]=this.getBoundaryCellColumnRange(t.tableCellSelectRange,n,s),a=[],l=new Set;n.forEach((t=>{t.children.forEach((t=>{const e=o.get(t.id);void 0!==e&&e>=i&&e<=r&&!l.has(t.id)&&(l.add(t.id),a.push(t))}))})),t.selectCellCallback(a)}}class Yn extends Qe{canIntercept(t){return t.childrenToBeInserted.some((t=>!(t instanceof xt)))}intercept(){}}class ts extends V{handleAction(t,e){const{targetCell:n,mergeCells:s,colSpan:o,rowSpan:i,direction:r}=t;this.mergeContentToTargetCell(n,s),It(n,o,i,e),this.deleteOtherSelectedCells(s,n),r!==Pt.MERGE_CELL_LEFT&&r!==Pt.MERGE_CELL_RIGHT&&i>1&&this.clearRowSpanIfUniformAcrossRow(n,e,i);const a=this.getRootContent(e),l=Mt(n);a&&l&&a.apply(new y(l))}mergeContentToTargetCell(t,e){const n=e.flatMap((t=>t.children)),s=n.filter((t=>t.isNotEmpty()));t.children=(s.length>0?s:[n[0]]).map((e=>e.clone(t)))}deleteOtherSelectedCells(t,e){t.forEach((t=>{t!==e&&t.parent.apply(new U(t))}))}clearRowSpanIfUniformAcrossRow(t,e,n){const s=t.parent.parent.children,o=Ot(s),i=[];for(let e=0;e<o.length;e++)o[e].includes(t.id)&&i.push(e);if(i.length>1){const t=i[0],r=t+n-1,a=new Set;let l=Number.POSITIVE_INFINITY;for(let e=0;e<o[0].length;e++){let n=o[t][e],s=1,i=!1;for(let c=t+1;c<=r;c++)o[c][e]!==n?(s>1&&(i=!0,l=Math.min(l,s),a.add(n)),s=1,n=o[c][e]):s++;if(s<2&&!i){a.clear();break}s>1&&(l=Math.min(l,s),a.add(n))}a.size>0&&s.forEach((t=>{t.children.forEach((t=>{if(a.has(t.id)){const{rowSpan:n,colSpan:s}=Dt(t);It(t,s,n-l+1,e)}}))}))}}}class es extends C{canHandle(t,e){const n=t[e];return n&&"TABLE"===n.tagName?1:0}handle(e,n){return vt.from({id:t(),type:"table-block",annotations:w.generate(vt,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class ns extends v{canHandle(t,e){const n=t[e];return n&&"THEAD"===n.tagName?1:0}handle(e,n){return Tt.from({id:t(),type:"table-head",annotations:w.generate(Tt,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class ss extends v{canHandle(t,e){const n=t[e];return n&&"TBODY"===n.tagName?1:0}handle(e,n){return Et.from({id:t(),type:"table-body",annotations:w.generate(Et,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class os extends v{canHandle(t,e){const n=t[e];return n&&"TR"===n.tagName?1:0}handle(e,n){return Ht.from({id:t(),type:"table-row",annotations:w.generate(Ht,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class is extends v{canHandle(t,e){const n=t[e];return!n||"TD"!==n.tagName&&"TH"!==n.tagName?0:1}handle(e,n){const s=e[0],o=[{id:t(),type:"paragraph",annotations:{internalWrapper:n&&!n.autoMatchFormat},nodes:[{id:t(),type:"text",annotations:{plainText:n&&!n.autoMatchFormat},text:""}]}];return"TH"===s.tagName?yt.from({id:t(),type:"table-head-cell",annotations:this.getTableHeadCellAnnotations(s,n),children:o},n):xt.from({id:t(),type:"table-cell",annotations:w.generate(xt,s,n),children:o},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}getTableHeadCellAnnotations(t,e){const n=w.generate(yt,t,e);return n&&n.tableCell&&mt.getColorKey(n.tableCell.backgroundColor,!0)===ct.key&&(delete n.tableCell.backgroundColor,n.customStyle&&delete n.customStyle.backgroundColor),n}}class rs extends C{canHandle(t,e){const n=t[e];return n&&n.parentElement&&"TABLE"===n.parentElement.tagName&&"CAPTION"===n.tagName?1:0}handle(e,n){const s=this.getTableCaptionAnnotations(e[0],n);return RTETableCaptionBlock.from({id:t(),type:"table-caption",annotations:Object.assign(Object.assign({},s),{caption:!0}),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}getTableCaptionAnnotations(t,e){const n=w.generate(RTETableCaptionBlock,t,e);return n&&n.customStyle&&n.customStyle.backgroundColor&&mt.getColorKey(n.customStyle.backgroundColor,!0)===ct.key&&delete n.customStyle.backgroundColor,n}}class as extends k{getBackgroundColor(t){return t.style.backgroundColor?mt.getColorKey(t.style.backgroundColor)||t.style.backgroundColor:null}getBorder(t){const e=t.style,n=e.borderStyle,s=e.borderWidth,o=e.borderColor;if(o||n||s){const t="initial"===o?"":o;return{style:"initial"===n?"":n,width:"initial"===s?"":s,color:mt.getColorKey(t)||t}}return null}getWidth(t){if(t.style.width)return t.style.width;const e=t.getAttribute("width");return e?/^\d+$/.test(e)?`${e}px`:e:null}getHeight(t){if(t.style.height)return t.style.height;const e=t.getAttribute("height");return e?/^\d+$/.test(e)?`${e}px`:e:null}}class ls extends as{canHandle(t){return"RTETableBlock"===t.name}handle(t){const e=de({backgroundColor:this.getBackgroundColor(t),border:this.getBorder(t),width:this.getWidth(t),height:this.getHeight(t),alignment:this.getAlignment(t)});return Object.keys(e).length>0?{table:e}:{}}getAlignment(t){const e=t.classList;if(e.contains("v-rte--extension-table-align-left"))return"left";if(e.contains("v-rte--extension-table-align-center"))return"center";if(e.contains("v-rte--extension-table-align-right"))return"right";const n=t.style,s=n.marginLeft,o=n.marginRight;if("auto"===s&&"auto"===o)return"center";if("0"===s||"0px"===s)return"left";if("0"===o||"0px"===o)return"right";const i=t.getAttribute("align");return i&&["left","center","right"].includes(i)?i:null}}class cs extends as{canHandle(t){return"RTETableCellBlock"===t.name}handle(t){const e=de({backgroundColor:this.getBackgroundColor(t),padding:this.getPadding(t),border:this.getBorder(t),width:this.getWidth(t),height:this.getHeight(t),textAlign:this.getTextAlign(t),verticalAlign:this.getVerticalAlign(t),minWidth:this.getMinWidth(t),boxSizing:this.getBoxSizing(t)});return Object.keys(e).length>0?{tableCell:e}:{}}getMinWidth(t){return t.style.minWidth?t.style.minWidth:null}getBoxSizing(t){return t.style.boxSizing?t.style.boxSizing:null}getPadding(t){return t.style.padding?t.style.padding:null}getTextAlign(t){if(t.style.textAlign){const e=t.style.textAlign;if(["left","center","right","justify"].includes(e))return e}const e=t.getAttribute("align");return e&&["left","center","right","justify"].includes(e)?e:null}getVerticalAlign(t){if(t.style.verticalAlign){const e=t.style.verticalAlign;if(["top","middle","bottom"].includes(e))return e}return null}}class hs extends cs{canHandle(t){return"RTETableHeadCellBlock"===t.name}}class ds extends V{handleAction(t,e){const n=t.toAnnotation(),s=this.getDOMByEntity(e);if(s){const t=s.closest(".v-rte--extension-table-container"),{backgroundColorAnnotation:o,width:i,height:r}=n;s.style.backgroundColor=o.renderStyle().color,s.style.border=n.borderStr,s.style.width=i,s.style.height=r;const a=n.renderAlignmentStyle().margin;s.style.margin=a,t&&(t.style.width=i,t.style.height=r,t.style.margin=a),this.updateCustomStyleAnnotation(e,["backgroundColor","border","width","height","margin"])}}}class us extends V{handleAction(t,e){const n=t.toAnnotation(),s=this.getDOMByEntity(e);if(s){const{width:t,height:o,borderStr:i,padding:r,textAlign:a,verticalAlign:l}=n,c=n.renderStyle().backgroundColor||"";s.style.backgroundColor=c,s.style.border=i,s.style.width=t,s.style.height=o,s.style.padding=r,s.style.textAlign=a,s.style.verticalAlign=l,this.updateCustomStyleAnnotation(e,["backgroundColor","border","width","height","padding","textAlign","verticalAlign"])}}}class ps extends V{handleAction(t,e){const n=e.parent,s=n.parent,o=St(n,vt),i=Rt(o),r=i.indexOf(n),{colSpan:a,rowSpan:l}=Dt(e),c=Ft(e,i),h=Math.ceil(l/2),d=Math.max(1,l-h),u=1===l;It(e,a,h,o);const p=r+h,f=Vt(e.type);if(It(f,a,d,o),u){const t=this.createNewRowWithCell(s,f),r=s.children.indexOf(n);s.apply(new P(s.children[r],t)),i.splice(p,0,t),this.updateCellsSpanningThroughInsertionPoint(i,p,e,o)}else{const t=i[p],e=this.findInsertPosition(t,c,i,p);t.children.splice(e,0,f),f.parent=t}}findInsertPosition(t,e,n,s){let o=0;for(let t=0;t<s;t++){const i=n[t];for(const r of i.children){const{colSpan:i,rowSpan:a}=Dt(r);t+a>s&&Ft(r,n)<e&&(o+=i)}}let i=o;for(let n=0;n<t.children.length;n++){if(i>=e)return n;const s=t.children[n],{colSpan:o}=Dt(s);i+=o}return t.children.length}createNewRowWithCell(e,n){const s={id:t(),type:"table-row",children:[]},o=Ht.from(s);return o.parent=e,o.children.push(n),n.parent=o,o}updateCellsSpanningThroughInsertionPoint(t,e,n,s){for(let o=0;o<e;o++){const i=t[o];for(const t of i.children){if(t===n)continue;const{colSpan:i,rowSpan:r}=Dt(t);o+r>=e&&It(t,i,r+1,s)}}}}class fs extends V{handleAction(t,e){const n=e.parent,s=St(n,vt),o=Rt(s),i=o.indexOf(n),{colSpan:r,rowSpan:a}=Dt(e),l=Ft(e,o),c=l+r-1,h=Math.ceil(r/2),d=Math.floor(r/2);It(e,h,a,s);const u=Vt(e.type);It(u,d,a,s),n.apply(new P(e,u));const p=1===r?1:0;p>0&&this.updateOtherRowsCells(o,i,l,c,a,p,s)}updateOtherRowsCells(t,e,n,s,o,i,r){for(let a=0;a<t.length;a++){const l=t[a];if(!(a>=e&&a<e+o))for(const e of l.children){const o=Ft(e,t),{colSpan:a,rowSpan:l}=Dt(e);if(o+a-1>=n&&o<=s){It(e,a+i,l,r);break}}}}}class bs extends Kn{handleAction(e,n){const{selectedRows:s}=e,o=s[s.length-1];let i=n.children.find((t=>t instanceof Et));const r={id:t(),type:"table-row",children:[]};let a=0,l=null;i?(l=i.children[0],a=this.getHeadCellLength(l)):(i=Et.from({id:t(),type:"table-body",children:[]}),n.apply(new H([i])));const c=o.parent.children,h=this.getRowsMaxCellCount(c);if(this.getRowsMaxCellCount([o])<h){const t=c.indexOf(o),e=this.getRowCellStartCols(c),n=new Map;for(let s=0;s<h;s++){const o=s<a?"table-head-cell":"table-cell",{cell:i}=this.getTheStartSpanCell(c,e,t,s);if(i){const t=i.colSpan;n.set(s,this.getDefaultCellBlockTemplate(o,t)),s+=t-1}}r.children=this.getSortedValuesByNumericKey(n)}else r.children=this.createTableCells(o,a);const d=l?new K(l,Ht.from(r)):new H([Ht.from(r)]);i.apply(d)}createTableCells(t,e){const n=[];let s=0;for(const o of t.children)n.push(this.getDefaultCellBlockTemplate(s<e?"table-head-cell":"table-cell",o.colSpan)),s+=o.colSpan;return n}}class gs extends Kn{handleAction(e){const{insertDirection:n,selectedRows:s}=e,o=n===Kt.ABOVE?s[0]:s[s.length-1],i={id:t(),type:"table-row",children:[]},r=o.parent.children,a=this.getRowsMaxCellCount(r),l=r.indexOf(o),c=this.getRowCellStartCols(r),h=new Map;for(let t=0;t<a;t++){const{cell:e,rowIndex:s}=this.getTheStartSpanCell(r,c,l,t);if(e){const{colSpan:o,rowSpan:i}=e;if(n===Kt.ABOVE?s!==l:s+i>l+1){this.updateCellSpan(e,"rowspan",i+1),t+=o-1;continue}h.set(t,this.getDefaultCellBlockTemplate(e.type,o)),t+=o-1}}i.children=this.getSortedValuesByNumericKey(h);const d=Ht.from(i),u=n===Kt.ABOVE?new K(o,d):new P(o,d);o.parent.apply(u)}}class ws extends Qe{canIntercept(t,e){return Boolean(e.parent)}intercept(t,e,n){const s=this.createNewParagraph("");s&&(n.parent.apply(0===e.startOffset?new K(n,s):new P(n,s)),e.newBlock=s)}createNewParagraph(e){const n=B.getRTEBlockClass("paragraph");if(n)return n.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:e}]})}}class ys extends X{constructor(){super(...arguments),this.stylesToBeFiltered=gt.getDefaultStyles(),this.elementTagName="table"}canFilter(t){return this.isTableBlock(t.constructor.name)}canRefill(t,e){return this.isTableBlock(t)&&e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableBlock(t){return"RTETableBlock"===t}}class ms extends X{constructor(){super(...arguments),this.stylesToBeFiltered=hn.getDefaultStyles(),this.elementTagName="table caption"}canFilter(t){return this.isTableCaption(t.constructor.name)}canRefill(t,e){return this.isTableCaption(t)&&"CAPTION"===e.nodeName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableCaption(t){return"RTETableCaptionBlock"===t}}class vs extends X{constructor(t="td"){super(),this.stylesToBeFiltered=wt.getDefaultStyles(),this.elementTagName="",this.stylesWithRGBColor=wt.getDefaultStyles(!1),this.cellBlockClassName="",this.elementTagName=t,this.cellBlockClassName="td"===t?"RTETableCellBlock":"RTETableHeadCellBlock"}canFilter(t){return this.isTableCell(t.constructor.name)}filterAndDeleteStyles(t,e){return this.convertDefaultBorderColorFromRGBToHex(t),super.filterAndDeleteStyles(t,e)}canRefill(t,e){return this.isTableCell(t)&&e.nodeName===this.elementTagName.toUpperCase()}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableCell(t){return t===this.cellBlockClassName}convertDefaultBorderColorFromRGBToHex(t){t&&t.border&&t.border===this.stylesWithRGBColor.border&&(t.border=this.stylesToBeFiltered.border)}}class Cs extends Pe{constructor(t=$t){super(),this.toolbarButtonRenderer=new Mn,this.tableBlockRenderer=new Rn,this.tableRowBlockRenderer=new In,this.tableCellRenderer=new Ln,this.tableHeadCellRenderer=new jn,this.tableSelection=new zn,mt.setTableColors(t),this.registerToolbarButtonRenderer("table",this.toolbarButtonRenderer),this.registerBlockBasicStrategies(vt.name),this.registerBlockBasicStrategies(Tt.name),this.registerBlockBasicStrategies(yt.name),this.registerBlockBasicStrategies(Ht.name),this.registerBlockBasicStrategies(xt.name),this.registerBlockBasicStrategies(Et.name),this.registerRenderer("table-block",this.tableBlockRenderer),this.registerRenderer("table-head",new On),this.registerRenderer("table-head-cell",this.tableHeadCellRenderer),this.registerRenderer("table-row",this.tableRowBlockRenderer),this.registerRenderer("table-cell",this.tableCellRenderer),this.registerRenderer("table-body",new Bn),this.registerRenderer("table-caption",new Fn),this.registerNode("table-block",vt),this.registerNode("table-head",Tt),this.registerNode("table-head-cell",yt),this.registerNode("table-row",Ht),this.registerNode("table-cell",xt),this.registerNode("table-body",Et),this.registerNode("table-caption",RTETableCaptionBlock),this.registerElementToBlockDTOClassStrategy(new es),this.registerElementToBlockDTOClassStrategy(new ns),this.registerElementToBlockDTOClassStrategy(new ss),this.registerElementToBlockDTOClassStrategy(new os),this.registerElementToBlockDTOClassStrategy(new is),this.registerElementToBlockDTOClassStrategy(new rs),this.registerAnnotationHandler(new ls),this.registerAnnotationHandler(new cs),this.registerAnnotationHandler(new hs)}initialExtensionAfterLoad(t){this.tableSelection.init(t);const e=Object.assign(Object.assign({},t),{tableSelection:this.tableSelection});super.initialExtensionAfterLoad(e)}destroyExtension(){this.tableSelection.destroy()}}(()=>{const t=new Dn,e=new Pn;Pe.registerActionHandleStrategy(m.name,"INSERT_TABLE_BLOCK",t),Pe.registerActionHandleStrategy(m.name,"DELETE_TABLE_BLOCK",e),Pe.registerActionHandleStrategy(xt.name,"DELETE_TABLE_BLOCK",e),Pe.registerActionHandleStrategy(yt.name,"DELETE_TABLE_BLOCK",e),Pe.registerActionHandleStrategy(M.name,"INSERT_TABLE_BLOCK",t),Pe.registerActionHandleStrategy(T.name,"INSERT_TABLE_BLOCK",t),Pe.registerActionHandleStrategy(vt.name,zt,new bs),Pe.registerActionHandleStrategy(vt.name,Gt,new gs),Pe.registerActionHandleStrategy(vt.name,Wt,new $n),Pe.registerActionHandleStrategy(vt.name,Ut,new Gn),Pe.registerActionHandleStrategy(vt.name,Zt,new Wn),Pe.registerActionHandleStrategy(vt.name,Jt,new Un),Pe.registerActionHandleStrategy(vt.name,Xt,new qt),Pe.registerActionHandleStrategy(Ht.name,Qt,new qn),Pe.registerActionHandleStrategy(Ht.name,"CREATE_SEGMENT_TABLE_CELL",new Jn),Pe.registerActionHandleStrategy(Ht.name,Yt,new Xn),Pe.registerActionHandleStrategy(xt.name,te,new ps),Pe.registerActionHandleStrategy(xt.name,ee,new fs),Pe.registerActionHandleStrategy(yt.name,te,new ps),Pe.registerActionHandleStrategy(yt.name,ee,new fs),Pe.registerActionHandleStrategy(vt.name,ne,new Qn),Pe.registerActionHandleStrategy(vt.name,se,new ts),Pe.registerActionHandleStrategy(vt.name,gn.name,new ds),Pe.registerActionHandleStrategy(xt.name,vn.name,new us),Pe.registerActionHandleStrategy(yt.name,Cn.name,new us),Pe.registerActionHandlerInterceptor(M.name,z.DELETE_BLOCK_CONTENT,new Vn),Pe.registerActionHandlerInterceptor(Ht.name,z.INSERT_CHILDREN_BEFORE,new Yn),Pe.registerActionHandlerInterceptor(xt.name,z.DELETE_CHILDREN,new Hn),Pe.registerActionHandlerInterceptor(yt.name,z.DELETE_CHILDREN,new Hn),Pe.registerActionHandlerInterceptor(vt.name,z.INSERT_NEW_PARAGRAPH,new ws),Pe.registerFilterStylesStrategy(vt.name,new ys),Pe.registerFilterStylesStrategy(RTETableCaptionBlock.name,new ms),Pe.registerFilterStylesStrategy(xt.name,new vs),Pe.registerFilterStylesStrategy(yt.name,new vs("th"))})();class xs extends j{constructor(t,e){super(),this.type=z.INSERT_NODE_TO_NEAREST_ROOT,this.rteRange=t,this.nodeToBeInserted=e}}class Ts extends V{handleAction(e,n){const{rteRange:s,token:o}=e;if(s&&s.startNode){const{key:i,label:r,customAttrs:a={wrapped:"true"}}=o,l=new RTETokenNode(t(),i,r,n);l.annotationMap.set("CUSTOM_ATTRIBUTE",new J(a)),n.apply(new xs(s,l)),e.actionHandleResult=!0}}}const Es=new class extends C{canHandle(t,e){const n=t[e];return"SPAN"===n.nodeName&&n.classList.contains("token")&&n.hasAttribute("token-key")?1:0}handle(e){const n=e[0],s=n.getAttribute("token-key"),o=n.textContent,i=w.generate(N,n),{customAttribute:r}=i,a=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(n[s[o]]=t[s[o]])}return n}(i,["customAttribute","customClass"]);return{id:t(),type:"token",token:s,text:o,annotations:Object.assign(Object.assign({},a),{customAttribute:this.createCustomAttrs(r)})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}createCustomAttrs(t){const e=Object.assign(Object.assign({},t),{contenteditable:null,"template-token-key":null,"token-key":null,wrapped:"false"===t.wrapped?"false":"true"});return de(e)}};class Ss extends Pe{constructor(t=[]){super(),this.tokenRenderer=new $e,this.registerNode("token",RTETokenNode),this.registerRenderer("token",this.tokenRenderer),this.tokenToolbarButtonRenderer=new Ke(t),this.registerToolbarButtonRenderer("token",this.tokenToolbarButtonRenderer),this.registerElementToNodeDTOClassStrategy(Es)}}(()=>{const t=new Ts;Pe.registerActionHandleStrategy(M.name,"INSERT_TOKEN_NODE",t),Pe.registerActionHandleStrategy(A.name,"INSERT_TOKEN_NODE",t)})();export{Qe as A,xs as I,Ke as R,ge as V,ve as a,Te as b,ke as c,je as d,Me as e,Ss as f,Ge as g,ln as h,Cs as i,Pe as j,Ve as k,He as l,RTETokenNode as m,$e as n,ze as o,Ie as w}
|
package/dist/vega/p-5f377954.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t;!function(t){t.Angular="angular",t.Vue="vue",t.React="react",t.Next="next",t.VanillaJs="vanilla-js"}(t||(t={}));const s=new class{constructor(){this.vegaVersion="2.
|
|
1
|
+
var t;!function(t){t.Angular="angular",t.Vue="vue",t.React="react",t.Next="next",t.VanillaJs="vanilla-js"}(t||(t={}));const s=new class{constructor(){this.vegaVersion="2.83.0",this.framework=t.VanillaJs}getVegaEnv(){return{version:this.vegaVersion,framework:this.framework}}setVegaFramework(t){this.framework=t}};export{t as F,s as v}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-f28a6074.js";import{d as s,e as n}from"./p-33860e54.js";import{d as r,c as i}from"./p-02841589.js";import{L as o}from"./p-6e1ab235.js";import{i as c}from"./p-83863463.js";import{T as a}from"./p-d884c644.js";import{g as l}from"./p-8b5d3a52.js";import{V as h}from"./p-8ac2d165.js";import{c as u}from"./p-a841cf13.js";import{f as d}from"./p-6e70d3cc.js";var p,f;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(p||(p={}));class T{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(f||(f={}));class E extends T{}const x=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const s=this.rootDomToContentEntity.get(t);s&&s!==e&&this.contentEntityToRootDom.delete(s),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.constructor.name}};var g,w,A,O;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE",t.INSERT_NODE_TO_NEAREST_ROOT="INSERT_NODE_TO_NEAREST_ROOT",t.PASTE_CONTENT="PASTE_CONTENT"}(g||(g={}));class m{constructor(){this.isFlushable=!1}}function N(t){const e=t.getAttribute("style");return e?e.split(";").filter(Boolean).filter((t=>" "!==t)).map((t=>{const e=t.replace(/(['"])(.*?)\1/g,"$2").split(":");return{[r(e[0].trim())]:e[1].trim().replace(";","")}})).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{}):{}}class y{constructor(){this.classNameToBeAdded=""}filterAnnotations(t){const e=t.customStyle;return e?(this.extractAndDeleteMatchedStyles(e),0===Object.keys(e).length&&delete t.customStyle,t):t}filterAndDeleteStyles(t,e){const s=new Set(e);return this.extractAndDeleteMatchedStyles(t)&&this.classNameToBeAdded&&s.add(this.classNameToBeAdded),{styles:t,classNames:Array.from(s)}}refillStyles(t){this.classNameToBeAdded&&t.classList.remove(this.classNameToBeAdded);const e=N(t),s=Object.assign(Object.assign({},this.stylesToBeFiltered),e),n=Object.entries(Object.assign({},s)).map((([t,e])=>`${i(t)}: ${e};`)).join("");t.setAttribute("style",n)}canFilter(t){return!1}canRefill(t,e){return!1}toCssText(){return""}get alwaysFilter(){return!1}extractAndDeleteMatchedStyles(t){let e=!1;const s=this.stylesToBeFiltered;if(t&&s){const n=Object.keys(s);for(const r of n)t[r]===s[r]&&(delete t[r],e=!0)}return e}buildCssTextForStyles(t,e){return`${`.${y.RTE_CONTENT_CONTAINER_CLASS_NAME}`+(e?` .${e}`:` ${t}`)} { ${Object.entries(this.stylesToBeFiltered).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")} }`}convertStylesMapToCssText(t){return Object.entries(t||this.stylesToBeFiltered).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}isBlockOrNodeStylesMatchFilterStyles(t,e){const s=t.getStyles({standalone:!0});return this.isMatchFilterStyles(s,e)}isMatchFilterStyles(t,e){return(e&&e.length>0?e:Object.keys(this.stylesToBeFiltered)).every((e=>t[e]===this.stylesToBeFiltered[e]))}}y.RTE_CONTENT_CONTAINER_CLASS_NAME="vega-rte-content",function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(w||(w={}));class R extends T{}class S{static isTextBlock(t){return t===this.RTE_TEXT_BLOCK_CLASS_NAME}static isCodeBlock(t){return"RTECodeBlock"===t}static isListBlock(t){return"RTEListBlock"===t}static isListItemBlock(t){return"RTEListItemBlock"===t}static isTextNode(t){return t===this.RTE_TEXT_NODE_CLASS_NAME}static isLinkNode(t){return this.isTextNode(t.constructor.name)&&!!t.getAnnotationByType(w.LINK)}static isCodeNode(t){if(this.isTextNode(t.constructor.name)){const e=t.getAnnotationByType(w.CODE);return!!e&&e.code}return!1}static isImageNode(t){return"RTEImageNode"===t.constructor.name}static isCodeBlockNode(t){return"RTECodeBlockNode"===t.constructor.name}}S.RTE_TEXT_NODE_CLASS_NAME="RTETextNode",S.RTE_TEXT_BLOCK_CLASS_NAME="RTETextBlock";class C extends y{constructor(){super(...arguments),this.stylesToBeFiltered=b.getDefaultStyles(),this.elementTagName="a"}filterAnnotations(t){const e=t.link;return(null==e?void 0:e.customStyle)?(this.extractAndDeleteMatchedStyles(e.customStyle),0===Object.keys(e.customStyle).length&&delete e.customStyle,t):t}canFilter(t){return S.isLinkNode(t)}canRefill(t,e){return"RTETextNode"===t&&e.matches(this.elementTagName)}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}filterLinkGroupInlineStyles(t){const e=t.style,s=t.class?t.class.split(" "):[],n=this.filterAndDeleteStyles(e,s);return n.styles&&Object.keys(n.styles).length>0&&(t.style=n.styles),n.classNames&&n.classNames.length>0&&(t.class=n.classNames.join(" ")),t.style&&0===Object.keys(t.style).length&&delete t.style,t}}class b extends T{constructor(t){super(),this.type=p.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}static getDefaultStyles(){return{color:"rgba(var(--v-text-link, 19, 98, 226, 1))"}}clone(){const t=new b("");return this.linkGroups.forEach(((e,s)=>{t.linkGroups.set(s,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){let s=this.toJsx(t,e);return(null==e?void 0:e.filterInlineStyles)&&(s=b.linkGroupFilterStylesStrategy.filterLinkGroupInlineStyles(s)),Object.entries(s).map((([t,e])=>{const s="string"==typeof e?e:this.formatStyleToString(e);return`${i(t)}="${s}"`})).join(" ")}toJsx(t,e){const s=this.getStyle(t,e),n=this.getClass(t,e),r=this.getAttribute(t);return n.length>0&&(r.class=n.join(" ")),s&&Object.keys(s).length>0&&(r.style=s),r}getClass(t,e){const s=[];return t.link.customClass&&s.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&s.push("v-rte--link"),s}getStyle(t,e){const s={};return t.link.customStyle&&Object.assign(s,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&Object.assign(s,b.getDefaultStyles()),s}getAttribute(t){const{href:e,customAttribute:s={}}=t.link,n=t.useInternalStyle,r=s.target||(n?"_blank":"");return Object.assign(Object.assign(Object.assign({},s),e||n?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}}b.linkGroupFilterStylesStrategy=new C;class k extends E{constructor(t){super(),this.type=f.ALIGNMENT,this.textAlign=t}static from(t){return[f.ALIGNMENT,new k(t)]}static getDefaultStyles(t){switch(t){case"right":case"center":case"justify":return{textAlign:t};case"left":default:return{textAlign:"left"}}}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new k(this.textAlign)}renderStyle(t){return(null==t?void 0:t.standalone)?k.getDefaultStyles(this.textAlign):null}}class v extends E{constructor(t){super(),this.type=f.INDENT,this.indent=Math.max(0,t)}static from(t){return[f.INDENT,new v(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new v(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class B{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).has(t)||this.registry.get(e).set(t,new Set),this.registry.get(e).get(t).add(s)}static unregister(t,e,s){const n=this.registry.get(e);if(n){const e=n.get(t);e&&e.delete(s)}}static get(t,e){const s=t instanceof m?t.type:t.constructor.name,n=this.registry.get(e.constructor.name);if(n){const r=n.get(s);if(r&&r.size>0)return Array.from(r).find((s=>s.canIntercept(t,e)))}}}B.registry=new Map;class j{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,s)}static unregister(t,e){const s=this.registry.get(e);s&&s.delete(t)}static get(t,e){const s=this.registry.get(e);if(s)return s.get(t)}static executeTheStrategy(t,e){const s=B.get(t,e),n=()=>{const s=t instanceof m?t.type:t.constructor.name,n=j.get(s,e.constructor.name);if(n)return t.executedFlag=!0,n.execute(t,e);o.warn(`Type ${s} action handle strategy is not registered in class ${e.constructor.name}`)};return s?s.intercept(n,t,e):n()}static canHandle(t,e){return!!j.get(t,e.constructor.name)}}j.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(A||(A={}));class _ extends T{}class $ extends _{constructor(t){super(),this.type=A.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[A.CUSTOM_ATTRIBUTE,new $(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new $(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(c)}render(t={}){var e;const s=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete s[t])),Object.keys(s).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===s[t]&&(s[t]="true")})),s}}class L extends _{constructor(t){super(),this.type=A.CUSTOM_CLASS,this.customClass=t}static from(t){return[A.CUSTOM_CLASS,new L(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new L(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class D extends _{constructor(t){super(),this.type=A.CUSTOM_STYLE,this.customStyle=t}static from(t){return[A.CUSTOM_STYLE,new D(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new D(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class I extends E{constructor(t){super(),this.type=f.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[f.INTERNAL_WRAPPER,new I(t)]}clone(){return new I(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class M{constructor(t){this.dtoType=t instanceof RTEBlock?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,s){return s=s||this.toJSON(t,e),Object.entries(Object.assign({},s)).map((([t,e])=>`${i(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const s=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof D)).map((e=>e.renderStyle(t))).filter(c);return e&&e.length>0?this.mergeAnnotationStyles(s,e):s.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoType?t instanceof E:t instanceof R}mergeAnnotationStyles(t,e){const s={};for(const n of t)for(const t in n){const r=n[t],i=s[t];s[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return s}}class F{static register(t,e){var s;const n=null!==(s=this.registry.get(t))&&void 0!==s?s:new Set;n.add(e),this.registry.set(t,n)}static getStrategies(t){var e;return Array.from(null!==(e=this.registry.get(t))&&void 0!==e?e:[])}static executeTheStrategyFilterAction(t,e,s){return this.getStrategies(t.constructor.name).filter((e=>e.canFilter(t))).reduce(((t,e)=>e.filterAndDeleteStyles(t.styles,t.classNames)),{styles:e,classNames:s})}static executeTheStrategyRefillAction(t,e){this.getStrategies(t).filter((s=>s.canRefill(t,e))).forEach((t=>{t.refillStyles(e)}))}static generateAllStylesContent(t=!1){const e=[];return t&&(e.push("/* Font-face imports begin */\n"),e.push(Object.keys(a).map((t=>`@import url('${a[t].url}');\n`)).join(" ")),e.push("/* Font-face imports end */\n")),this.registry.forEach((t=>{t.forEach((t=>{const s=t.toCssText();s&&!e.includes(s)&&e.push(s)}))})),e.join(" ")}}F.registry=new Map,function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(O||(O={}));class RTENode{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,s){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}, ${s}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return $.from(e);case"customClass":return L.from(e);case"customStyle":return D.from(e)}}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}getStyles(t={standalone:!1}){return new M(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof L)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(A.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getElementRef(){return x.getDOMByEntity(this)}generateAttributeString(t,...e){var s;const n=new M(this),r=n.toJSON({standalone:!0},["textDecoration"]),i=this.annotationMap.get(A.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=F.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(s=this.getCustomAttributesAnnotation())||void 0===s?void 0:s.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${n.toCssText({standalone:!0},void 0,o)}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof m?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const n=x.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}const H=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof RTEBlock)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof RTENode))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class RTEBlock{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,s){return t.map((t=>{const n=H.getRTEBlockClass(t.type);if(n){const r=n.from(t,e);return r.parent=s,r}})).filter(c)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return k.from(e);case"indent":return v.from(e);case"customAttribute":return $.from(e);case"customClass":return L.from(e);case"customStyle":return D.from(e);case"internalWrapper":return I.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,s])=>{const n=this.createAnnotationEntity(e,s);c(n)&&t.set(...n)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(f.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof b||t instanceof I))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof E||t instanceof _)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(n){if(this.doApply(n),n.isFlushable){const n=x.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}getFirstNode(){if(!this.children||!this.children[0])return null;const t=this.children[0];return t instanceof RTEBlock?t.getFirstNode():t}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new M(this).toJSON(t);return Object.assign(Object.assign({},e),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof E||t instanceof L)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(A.CUSTOM_ATTRIBUTE)}generateAttributeString(t,...e){var s;const n=new M(this),r=n.toJSON({standalone:!0}),i=this.annotationMap.get(A.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=F.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(s=this.getCustomAttributesAnnotation())||void 0===s?void 0:s.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${n.toCssText({standalone:!0},void 0,o)}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof m?j.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();if(e instanceof b||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply)this.doAnnotationActionApply(t);else{const e=j.get(t.constructor.name,this.constructor.name);e&&e.execute(t,this)}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}class P{}class J extends P{constructor(){super(...arguments),this.doSplit=!0}}class K extends T{constructor(t){super(),this.type=p.SELECTION_RANGE,this.range=t}clone(){return new K(this.range)}}const U="700",W="bold",G="italic",z="underline",V="line-through";class X extends R{constructor(t){super(),this.type=w.STRIKETHROUGH,this.strikethrough=t}static from(t){return[w.STRIKETHROUGH,new X(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new X(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class q extends R{constructor(t){super(),this.type=w.UNDERLINE,this.underline=t}static from(t){return[w.UNDERLINE,new q(t)]}toJSON(){return{underline:this.underline}}clone(){return new q(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class Y extends R{constructor(t){super(),this.type=w.ITALIC,this.italic=t}static from(t){return[w.ITALIC,new Y(t)]}toJSON(){return{italic:this.italic}}clone(){return new Y(this.italic)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class Q extends R{constructor(t){super(),this.type=w.BOLD,this.bold=t}static from(t){return[w.BOLD,new Q(t)]}toJSON(){return{bold:this.bold}}clone(){return new Q(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class Z extends R{constructor(t,e=!0){super(),this.type=w.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[w.CODE,new Z(t,e)]}static getDefaultStyles(){return{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}}toJSON(){return{code:this.code}}clone(){return new Z(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?Z.getDefaultStyles():null}}const tt={key:"black",light:"#111128",dark:"#E3E3E8"},et=[tt,{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],st="",nt=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]],rt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);class it extends R{constructor(t){super(),this.type=w.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[w.TEXT_COLOR,new it(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new it(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:h.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return et.find((e=>e.key===t))||et[0]}}class ot extends R{constructor(t,e=!0){super(),this.type=w.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[w.LINK,new ot(t,e)]}toJSON(){return{link:this.link}}clone(){return new ot(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class ct extends P{constructor(t,e,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=s}toAnnotation(){return new b(this.groupKey)}}class at extends P{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class lt{execute(t,e){return o.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const s=t.annotationMap.get(A.CUSTOM_STYLE);s&&this.isCustomStyle(s,e)&&t.annotationMap.set(s.type,new D(s.removeStyles(e)))}createNewParagraph(t){const e=H.getRTEBlockClass("paragraph");if(e)return e.from({id:l(),type:"paragraph",nodes:[{id:l(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,s){return e===t.children[0]&&0===s}isCaretPositionAtBlockEnd(t,e,s){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,s):this.isCaretPositionAtDecoratorBlockEnd(t,e,s)}getDOMByEntity(t){return x.getDOMByEntity(t)}isCaretPositionAtTextBlockEnd(t,e,s){const n=t.children[t.children.length-1];return e===n&&(e.isEmpty()||s===n.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,s){return e===t.children[t.children.length-1]&&0!==s}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class ht extends m{constructor(t){super(),this.type=g.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class ut extends lt{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const s=e.getAnnotationByType(p.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof J&&t.doSplit&&s){const{startContainer:t,endContainer:n,startOffset:r,endOffset:i}=s.range,o=t===n&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(s.range)&&e.isContentEditable()){const n=this.splitTextNode(s.range,e);return t.annotationMap.has("LINK")&&t.apply(new ht(n)),n}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const s=e.cloneWithText("");this.setApplyTargetNode(s);const n=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===n?[s,e]:t===e.text.length||!e.isContentEditable()&&t===n+1?[e,s]:[e.cloneWithText(e.text.substring(0,t)),s,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:s,startOffset:n,endOffset:r}=t;return e!==s||n>0||r<(s.textContent?s.textContent.length:0)}splitTextNode(t,e){const{startContainer:s,endContainer:n,startOffset:r}=t,i=s.parentElement,o=n.parentElement,c=(t,s,n)=>{const r=t.substring(0,s),i=t.substring(s,n),o=t.substring(n);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},a=i&&x.getEntityByDOM(i),l=o&&x.getEntityByDOM(o);if(a&&a.id===e.id){const i=s===n?t.endOffset:e.text.length,[o,a,l]=c(e.text,r,i);return this.setApplyTargetNode(a),[o,a,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[s,n,r]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(n),[s,n,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class dt extends J{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new Q(this.bold)}}class pt extends T{constructor(){super(...arguments),this.type=p.CLEAR_FORMATTING,this.items=[w.BOLD,w.ITALIC,w.UNDERLINE,w.STRIKETHROUGH,w.TEXT_COLOR,w.CODE,A.CUSTOM_STYLE]}}class ft extends J{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new pt}}class Tt extends J{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new Z(this.code)}}class Et extends P{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class xt extends J{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new Y(this.italic)}}class gt extends J{constructor({link:t,newText:e,needMergeNode:s,doSplit:n,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=s,this.newText=e,this.type=r,c(n)&&(this.doSplit=n)}toAnnotation(){return new ot(this.link)}}class wt extends J{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new X(this.strikethrough)}}class At extends J{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new q(this.underline)}}class Ot extends lt{handleAction(t,e){const s=t.toAnnotation();if(t instanceof Et)e.annotationMap.delete(t.annotationType);else{if(!(s instanceof pt))return s instanceof R||s instanceof K?(t instanceof gt&&(c(t.newText)&&(e.text=t.newText),e.parent.apply(new ct(t.link.groupKey,[e],t.type))),t instanceof Tt&&this.handleAction(new ft,e),t instanceof dt&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof xt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof At||t instanceof wt)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(s.type,s)):void 0;s.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class mt extends m{constructor(){super(...arguments),this.type=g.DELETE_LINK_GROUP}}class Nt extends lt{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new mt)}}class yt extends m{constructor(t){super(),this.type=g.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class Rt extends lt{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,s){if(e&&e.startContainer&&e.endContainer){const{startContainer:n,endContainer:r,startOffset:i,endOffset:o}=e;let c=s.text;if(n===r&&i===o&&t)c=s.text.slice(0,i)+t+s.text.slice(i);else{const e=n.parentElement,a=r.parentElement,l=e&&x.getEntityByDOM(e),h=a&&x.getEntityByDOM(a);let u=0,d=s.text.length;l&&l===s?(u=i,d=n===r?o:d):h&&h===s&&(d=o),c=s.text.slice(0,u)+t+s.text.slice(d)}s.apply(new yt(c))}}}class St extends T{constructor(t){super(),this.type=w.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:s,customStyle:n,customClass:r,customAttribute:i}=t,o=new St(e);return o.groupId=t.groupId,o.child=s?St.from(s)[1]:void 0,o.customAttribute=i?$.from(i)[1]:void 0,o.customClass=r?L.from(r)[1]:void 0,o.customStyle=n?D.from(n)[1]:void 0,[w.INLINE_HTML,o]}clone(){var t,e,s,n;const r=new St(this.htmlTag);return r.groupId=this.groupId,r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(s=this.customClass)||void 0===s?void 0:s.clone(),r.customStyle=null===(n=this.customStyle)||void 0===n?void 0:n.clone(),r}renderProps(){var t,e,s;return Object.assign(Object.assign({},null===(t=this.customAttribute)||void 0===t?void 0:t.render()),{style:null===(e=this.customStyle)||void 0===e?void 0:e.renderStyle(),class:null===(s=this.customClass)||void 0===s?void 0:s.renderClass().join(" ")})}toJSON(){var t,e,s,n;return{inlineHtml:u({htmlTag:this.htmlTag,groupId:this.groupId,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(s=this.customClass)||void 0===s?void 0:s.toJSON().customClass,customStyle:null===(n=this.customStyle)||void 0===n?void 0:n.toJSON().customStyle})}}}class Ct extends lt{handleAction(t,e){const s=e.parent.getAnnotationByType(p.LINK_GROUP);if(s){const n=e.annotationMap.get("LINK").link.groupKey,r=s.linkGroups.get(n);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),s.linkGroups.set(n,r))}}}}class bt extends lt{handleAction(t,e){const s=e.parent.getAnnotationByType(p.LINK_GROUP);if(s){const t=e.annotationMap.get(w.LINK).link.groupKey,n=s.linkGroups.get(t);if(n){const r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&s.linkGroups.delete(t),0===s.linkGroups.size&&e.parent.annotationMap.delete(p.LINK_GROUP)}}e.annotationMap.delete(w.LINK)}}class kt extends R{constructor(t){super(),this.type=w.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[w.PLAIN_TEXT,new kt(t)]}clone(){return new kt(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return this.plainText?{plainText:this.plainText}:void 0}}class vt extends J{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new it(this.textColor)}}class RTETextNode extends RTENode{constructor(t,e,s,n){super(t,n),this.type=O.TEXT,this.parent=s,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,s={autoMatchFormat:!0}){const n=new RTETextNode(t.id,t.text,e),{annotations:r}=t;return r&&(n.annotationMap=this.generateTextAnnotationMap(r,s,e,n)),n}static generateTextAnnotationMap(t,e,s,n){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&s&&n&&s.apply(new ct(t.link.groupKey,[n],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(c))}static createAnnotationEntity(t,e,s){const n=!(!s||!s.autoMatchFormat);switch(t){case"bold":return Q.from(e);case"italic":return Y.from(e);case"underline":return q.from(e);case"strikethrough":return X.from(e);case"code":return Z.from(e,n);case"textColor":return it.from(e);case"link":return ot.from(e,n);case"inlineHtml":return St.from(e);case"plainText":return kt.from(e)}return RTENode.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof _||t instanceof St)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}toHtml(t){const e=this.getAnnotationByType(w.INLINE_HTML);return e?this.renderWithWrapperStr(e,t):this.renderTextStr(t)}cloneWithText(t){return new RTETextNode(l(),t,this.parent,super.cloneAnnotations())}clone(t){return new RTETextNode(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!(this.getAnnotationByType(w.INLINE_HTML)||this.text&&""!==this.text&&"\n"!==this.text)}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=this.getElementRef();if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}getInlineHtmlTagAtDepth(t){const e=this.getInlineHtmlAnnotationAtDepth(t);return e?rt.has(e.htmlTag)?null:{htmlTag:e.htmlTag,attrStr:this.annotationAttrStr(e),groupId:e.groupId,annotation:e}:null}renderHtmlFromDepth(t,e){const s=this.getInlineHtmlAnnotationAtDepth(t);return s?this.renderWithWrapperStr(s,e):this.renderTextStr(e)}getInlineHtmlAnnotationAtDepth(t){let e=this.getAnnotationByType(w.INLINE_HTML);for(let s=0;s<t&&e;s++)e=e.child;return e}registerModifyStrategy(){const t=this.constructor.name;RTETextNode.registerActionStrategyStatus[t]||(this.isContentEditable()&&(j.register(g.UPDATE_TEXT,t,new Nt),j.register(g.REPLACE_SELECTED_TEXT,t,new Rt),j.register(g.LINK_GROUP_NODE_SPLIT,t,new Ct),j.register(gt.name,t,new Ot)),j.register(J.name,t,new ut),j.register(g.DELETE_LINK_GROUP,t,new bt),j.register(dt.name,t,new Ot),j.register(ft.name,t,new Ot),j.register(xt.name,t,new Ot),j.register(At.name,t,new Ot),j.register(vt.name,t,new Ot),j.register(wt.name,t,new Ot),j.register(Tt.name,t,new Ot),j.register(P.name,t,new Ot),RTETextNode.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(p.SELECTION_RANGE);if(t instanceof J&&t.doSplit&&e){const e=j.get(J.name,this.constructor.name);if(e){const s=e.execute(t,this);s&&this.applyActionToNode(s,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){j.executeTheStrategy(t,this)}applyActionToNode(t,e){const s=e.toAnnotation();if(e instanceof at)return void this.syncUpSelectedNodes(t);s instanceof K||this.syncUpSelectedNodes(t);const n=j.get(e.constructor.name,t.constructor.name);if(n)return void n.execute(e,t);const r=j.get(P.name,RTETextNode.name);r&&r.execute(e,t)}syncUpSelectedNodes(s){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,n);i&&t.notify(i,{node:s})}}renderWithWrapperStr(t,e){const{htmlTag:s,child:n}=t,r=this.annotationAttrStr(t);return n?`<${s}${r}>${this.renderWithWrapperStr(n,e)}</${s}>`:rt.has(s)?`<${s}${r}>`:this.text?`<${s}${r}>${this.renderTextStr(e)}</${s}>`:`<${s}${r}></${s}>`}annotationAttrStr(t){const{customAttribute:e,customClass:s,customStyle:n}=t,r=[...(null==e?void 0:e.toString())||[],null==s?void 0:s.toString(),null==n?void 0:n.toString()].filter(c);return r.length>0?` ${r.join(" ")}`:""}renderTextStr(t){var e;const s=(null===(e=this.getAnnotationByType(w.CODE))||void 0===e?void 0:e.code)?"code":"span",n=super.generateAttributeString(t);return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${s}${n}>${this.text}</${s}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(w.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof R&&!(t instanceof ot)&&!(t instanceof kt)||t instanceof _)).length}}RTETextNode.registerActionStrategyStatus={},RTETextNode.htmlTag="span";class Bt extends m{constructor(t){super(),this.type=g.APPEND_CHILDREN,this.entityToBeAppended=t}}class jt extends E{constructor(t){super(),this.type=f.TEXT_STYLE,this.textStyle=t}static from(t){return[f.TEXT_STYLE,new jt(t)]}static getDefaultStyles(t){const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},s=Object.assign(Object.assign({},e),{marginTop:"0px",marginBottom:"0px"});switch(t){case"paragraph":return s;case"title":return Object.assign(Object.assign({},e),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"});case"subtitle":return Object.assign(Object.assign({},e),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"});case"heading-1":return Object.assign(Object.assign({},s),{fontSize:"22px",lineHeight:"24px",minHeight:"24px"});case"heading-2":return Object.assign(Object.assign({},s),{fontSize:"20px",lineHeight:"24px",minHeight:"24px"});case"heading-3":return Object.assign(Object.assign({},s),{fontSize:"18px"});case"heading-4":return Object.assign({},s);case"heading-5":return Object.assign(Object.assign({},s),{fontSize:"14px"});case"heading-6":return Object.assign(Object.assign({},s),{fontSize:"12px"});default:return null}}toJSON(){return{textStyle:this.textStyle}}clone(){return new jt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.textStyle?jt.getDefaultStyles(this.textStyle):null}}class _t extends P{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new jt(this.textStyle)}}class $t extends lt{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new dt(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new Et(w.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class Lt extends m{constructor(t,...e){super(),this.type=g.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class Dt extends m{constructor(t){super(),this.type=g.REPLACE_CHILD_NODES,this.newChildNodes=t}}class It extends lt{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,s){if(t){const n=t.text.slice(0,e),r=t.text.slice(e),i=s.children.indexOf(t);if(i>-1){const e=s.children.slice(0,i),o=s.children.slice(i+1);n&&e.push(t.cloneWithText(n)),r&&o.unshift(t.cloneWithText(r)),s.apply(new Dt(e));const c=s.cloneWithNodes(o);return s.parent.apply(new Lt(s,c)),c}}}}class Mt extends lt{handleAction(t,e){e.children=[],e.apply(new Bt(t.newChildNodes))}}class Ft extends m{constructor(t){super(),this.type=g.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Ht extends lt{handleAction(t,e){const s=t.blockNeedToBeMerged;if(e.type===s.type||"image"!==e.type&&"image"!==s.type){let t=s.children;"image"!==s.type&&(t=s.children.filter((t=>t.text))),e.apply(new Bt(t)),s.parent.apply(new Ft(s))}}}class Pt extends lt{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,s){if(t){const n=new RTETextNode(l(),"\n",s),r=t.text.slice(0,e),i=t.text.slice(e),o=s.children.indexOf(t);if(o>-1){const e=s.children.slice(0,o),c=s.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,n,c,s)}return n}}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(l(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Dt([...t,e,...s]))}}class Jt extends lt{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const s=e.children,n=new RTETextNode(l(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,n,r,e),n}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new Ft(t)))})),e}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(l(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Dt([...t,e,...s]))}}class Kt extends m{constructor(t,...e){super(),this.type=g.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class Ut extends m{constructor(t,e){super(),this.type=g.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class Wt extends P{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new k(this.textAlign)}}class Gt extends lt{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class zt extends P{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new v(this.indent)}}class RTETextBlock extends RTEBlock{constructor(t,e,s){super(t),this.children=[],this.type=e;const{autoMatchFormat:n}=s||{autoMatchFormat:!0};n&&(this.annotationMap=RTETextBlock.isAcceptableTextStyle(e)?new Map([jt.from(e)]):new Map([jt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var s,n;const r=new RTETextBlock(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(n=null===(s=t.annotations)||void 0===s?void 0:s.textStyle)&&void 0!==n?n:r.type}):t.annotations;return r.children=t.nodes.map((t=>{const s=H.getRTENodeClass(t.type);if(s)return s.from(t,r,e)})).filter(c),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?jt.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.children=this.children.reduce(((e,s)=>{const n=e.at(-1);if(t instanceof gt&&t.needMergeNode){const t=null==n?void 0:n.getAnnotationByType(w.LINK),r=s.getAnnotationByType(w.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,s]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),s=super.generateAttributeString(t),n=this.getChildrenHtml(t);return super.shouldRenderAsInternalWrapper()?n:[`<${e}${s}>`,n,`</${e}>`].join("")}cloneWithNodes(t){const e=new RTETextBlock(l(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new Bt(t)),e}clone(t){const e=new RTETextBlock(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}getChildrenHtml(t){const e=this.getAnnotationByType(p.LINK_GROUP);let s=this.renderGroupedNodesAtDepth(this.children,0,t);return e&&this.children.length>0&&(s=this.generateLinkHtml(e,s,t)),s}doAnnotationActionApply(t){const e=j.get(t.constructor.name,RTETextBlock.name);e&&e.execute(t,this)}renderGroupedNodesAtDepth(t,e,s){var n;let r="",i=0;for(;i<t.length;){const o=t[i].getInlineHtmlTagAtDepth(e);if(!(null==o?void 0:o.groupId)){r+=t[i].renderHtmlFromDepth(e,s),i++;continue}let c=i+1;for(;c<t.length&&(null===(n=t[c].getInlineHtmlTagAtDepth(e))||void 0===n?void 0:n.groupId)===o.groupId;)c++;if(c===i+1)r+=t[i].renderHtmlFromDepth(e,s);else{const n=this.renderGroupedNodesAtDepth(t.slice(i,c),e+1,s);r+=`<${o.htmlTag}${o.attrStr}>${n}</${o.htmlTag}>`}i=c}return r}generateLinkHtml(t,e,s){e="";let n=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(w.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(w.LINK):null;if(i){if(n.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,filterInlineStyles:null==s?void 0:s.filterInlineStyles});e+=[`<a${r?` ${r}`:""}>`,this.renderGroupedNodesAtDepth(n,0,s),"</a>"].join(""),n=[]}}else e+=this.children[r].toHtml(s)}return e}}j.register(_t.name,RTETextBlock.name,new $t),j.register(Wt.name,RTETextBlock.name,new Gt),j.register(zt.name,RTETextBlock.name,new class extends lt{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),j.register(ct.name,RTETextBlock.name,new class extends lt{handleAction(t,e){let s=e.getAnnotationByType(p.LINK_GROUP);if("update_link"===t.type){if(s){const e=s.linkGroups.get(t.groupKey);e&&s.linkGroups.set(t.groupKey,[e[0]])}}else{if(s){const e=s.linkGroups.get(t.groupKey)||[];s.linkGroups.set(t.groupKey,[...e,...t.nodes])}else s=t.toAnnotation(),s.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(p.LINK_GROUP,s)}}}),j.register(g.UNLINK_LINK_GROUP,RTETextBlock.name,new class extends lt{handleAction(t,e){const s=e.getAnnotationByType(p.LINK_GROUP);s&&(s.linkGroups.size>1?s.linkGroups.delete(t.groupKey):e.annotationMap.delete(p.LINK_GROUP))}}),j.register(g.SPLIT_BLOCK_WITH_NODE,RTETextBlock.name,new It),j.register(g.REPLACE_CHILD_NODES,RTETextBlock.name,new Mt),j.register(g.MERGE_TWO_BLOCKS_NODES,RTETextBlock.name,new Ht),j.register(g.LINE_BREAK_SINGLE_BLOCK,RTETextBlock.name,new Pt),j.register(g.LINE_BREAK_MULTIPLE_BLOCKS,RTETextBlock.name,new Jt),j.register(g.INSERT_IMAGE_TO_BLOCK,RTETextBlock.name,new class extends lt{handleAction(t,e){const s=t.splitPointNode,n=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,s,n))e.parent.apply(new Lt(e,r));else if(this.isCaretPositionAtBlockStart(e,s,n))e.parent.apply(new Kt(e,r));else{const t=new Ut(s,n);e.apply(t),e.parent.apply(new Lt(e,r))}}}),j.register(g.TRANSFORM_LIST_BLOCK,RTETextBlock.name,new class extends lt{handleAction(t,e){const s=e.parent,n=s.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>s.toListItem(t)));n.apply(new Bt(i)),s.apply(new Lt(t.selectedBlocks[0],n)),r.forEach((t=>{t.parent.apply(new Ft(t))}))}});class Vt extends lt{getPreviousNode(t){const e=t.parent,s=e.children.indexOf(t);if(s>0)return e.children[s-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,s=e.children.indexOf(t);if(e.children[s+1])return e.children[s+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,s=e.children.indexOf(t),n=e.parent;if(e.isListItemBlock()){const t=n.parent;return 0===s&&Array.isArray(n.children)&&n.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===n}return 0===s&&Array.isArray(n.children)&&n.children[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(this.isRTEBlock(t.parent)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}isRTEBlock(t){return t&&"VegaRTEContent"!==t.constructor.name}}class Xt extends m{constructor(t,e){super(),this.isFlushable=!0,this.type=g.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class qt extends P{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new K(this.range)}}class RTEDecoratorNode extends RTENode{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return d(t,`.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}RTEDecoratorNode.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",RTEDecoratorNode.DECORATOR_NODE_CLASS="v-internal-decorator-node";class Yt extends y{constructor(){super(...arguments),this.stylesToBeFiltered=Yt.STYLES,this.elementTagName="pre code"}canFilter(t){return S.isCodeBlockNode(t)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Yt.STYLES={boxSizing:"border-box",color:"rgba(var(--v-text-primary, 32, 54, 69, 1))",textAlign:"left",fontFamily:'"Roboto Mono"',fontWeight:"400",lineHeight:"22px",fontSize:"16px",whiteSpace:"pre-wrap",minHeight:"22px",tabSize:"2px"};class RTECodeBlockNode extends RTEDecoratorNode{constructor(t,e,s,n){super(t),this.type=O.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=n,this.language=s,this.annotationMap.set(A.CUSTOM_STYLE,new D(Yt.STYLES))}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(t){return`<code${this.generateAttributeString(t)}>${this.text}</code>`}clone(t){return new RTECodeBlockNode(this.id,this.text,this.language,t)}doAnnotationActionApply(t){j.executeTheStrategy(t,this)}doModifyActionApply(t){j.executeTheStrategy(t,this)}}j.register(g.UPDATE_CODE_BLOCK,RTECodeBlockNode.name,new class extends lt{handleAction(t,e){const{content:s,language:n}=t;e.language=n,e.text=s}}),j.register(qt.name,RTECodeBlockNode.name,new class extends lt{handleAction(t,e){e.annotationMap.set(p.SELECTION_RANGE,t.toAnnotation())}});var Qt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Qt||(Qt={}));class Zt extends lt{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new Ft(e)))}}class te extends y{constructor(){super(...arguments),this.stylesToBeFiltered=te.STYLES,this.elementTagName="pre"}canFilter(t){return S.isCodeBlock(t.constructor.name)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}te.STYLES={backgroundColor:"rgba(var(--v-bg-secondary, 245, 247, 247, 1))",padding:"12px"};class RTECodeBlock extends RTEBlock{constructor(t,e,s){super(t),this.type="code-block",this.annotationMap=new Map([D.from(te.STYLES)]),this.children=[new RTECodeBlockNode(`${t}-1`,e,s,this)]}static from(t){return new RTECodeBlock(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(t){const{language:e=Qt["Plain Text"]}=this.children[0];return`<pre data-language="${e}"${super.generateAttributeString(t)}>${this.children.map((e=>e.toHtml(t)))}</pre>`}clone(t){const e=RTECodeBlock.from(this.toJSON());return e.parent=t,e}apply(n){if(n instanceof m&&j.executeTheStrategy(n,this),n.isFlushable){const n=x.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(p.SELECTION_RANGE)}}j.register(g.DELETE_CODE_BLOCK,RTECodeBlock.name,new class extends Vt{handleAction(t,e){const s=e.children[0],n=e.parent;if(n){let t=this.getPreviousNode(s),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(s),r=0),n.apply(new Ft(e));const i=t?x.getDOMByEntity(t):null;if(0===n.children.length){const s=RTETextBlock.from({id:l(),type:"paragraph",nodes:[{id:l(),type:"text",text:""}]});e.parent.apply(new Bt([s])),t=s.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(s,r,i,o){const c=x.getDOMByEntity(o);if(c){const o=e.getSubjectFromParentNodeByEventId(c,n);o&&t.notify(o,{node:s,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),j.register(g.DELETE_CHILDREN,RTECodeBlock.name,new Zt),j.register(g.SWITCH_OUT_FROM_CODE_BLOCK,RTECodeBlock.name,new class extends lt{handleAction(s,r){const{content:i,language:o}=s,c=i.split("\n"),a=new Xt(c.slice(0,c.length-2).join("\n"),o);a.isFlushable=!1,r.children[0].apply(a);const h=RTETextBlock.from({id:l(),type:"paragraph",nodes:[{id:l(),text:"",type:"text"}]});r.parent.apply(new Lt(r,h));const u=x.getDOMByEntity(r);if(u){const s=e.getSubjectFromParentNodeByEventId(u,n);s&&t.notify(s,{node:h.children[0]})}}}),j.register(g.INSERT_IMAGE_TO_BLOCK,RTECodeBlock.name,new class extends lt{handleAction(t,e){e.parent.apply(new Lt(e,t.imageBlockToBeInserted))}}),RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{tt as $,j as A,E as B,A as C,L as D,RTECodeBlock as E,w as F,RTEDecoratorNode as G,Wt as H,Lt as I,O as J,_ as K,Dt as L,m as M,R as N,Ut as O,rt as P,Vt as Q,F as R,at as S,_t as T,yt as U,nt as V,Zt as W,W as X,U as Y,N as Z,et as _,B as a,G as a0,V as a1,z as a2,jt as a3,S as a4,k as a5,Z as a6,C as a7,te as a8,RTECodeBlockNode as a9,Yt as aa,Qt as ab,st as ac,gt as ad,Xt as ae,qt as af,vt as ag,dt as ah,xt as ai,At as aj,Q as ak,ft as al,Tt as am,wt as an,zt as ao,H as b,RTETextNode as c,RTEBlock as d,RTETextBlock as e,M as f,lt as g,Bt as h,RTENode as i,Kt as j,p as k,g as l,P as m,Ft as n,$ as o,y as p,$t as q,Gt as r,x as s,Pt as t,Jt as u,It as v,Mt as w,Ht as x,f as y,D as z}
|
|
1
|
+
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-f28a6074.js";import{d as s,e as n}from"./p-aa985d73.js";import{d as r,c as i}from"./p-02841589.js";import{L as o}from"./p-6e1ab235.js";import{i as c}from"./p-b9386dd0.js";import{T as a}from"./p-d884c644.js";import{g as l}from"./p-8b5d3a52.js";import{V as h}from"./p-8aee6b74.js";import{c as u}from"./p-a841cf13.js";import{f as d}from"./p-6e70d3cc.js";var p,f;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(p||(p={}));class T{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(f||(f={}));class E extends T{}const x=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const s=this.rootDomToContentEntity.get(t);s&&s!==e&&this.contentEntityToRootDom.delete(s),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.constructor.name}};var g,w,A,O;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE",t.INSERT_NODE_TO_NEAREST_ROOT="INSERT_NODE_TO_NEAREST_ROOT",t.PASTE_CONTENT="PASTE_CONTENT"}(g||(g={}));class m{constructor(){this.isFlushable=!1}}function N(t){const e=t.getAttribute("style");return e?e.split(";").filter(Boolean).filter((t=>" "!==t)).map((t=>{const e=t.replace(/(['"])(.*?)\1/g,"$2").split(":");return{[r(e[0].trim())]:e[1].trim().replace(";","")}})).reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{}):{}}class y{constructor(){this.classNameToBeAdded=""}filterAnnotations(t){const e=t.customStyle;return e?(this.extractAndDeleteMatchedStyles(e),0===Object.keys(e).length&&delete t.customStyle,t):t}filterAndDeleteStyles(t,e){const s=new Set(e);return this.extractAndDeleteMatchedStyles(t)&&this.classNameToBeAdded&&s.add(this.classNameToBeAdded),{styles:t,classNames:Array.from(s)}}refillStyles(t){this.classNameToBeAdded&&t.classList.remove(this.classNameToBeAdded);const e=N(t),s=Object.assign(Object.assign({},this.stylesToBeFiltered),e),n=Object.entries(Object.assign({},s)).map((([t,e])=>`${i(t)}: ${e};`)).join("");t.setAttribute("style",n)}canFilter(t){return!1}canRefill(t,e){return!1}toCssText(){return""}get alwaysFilter(){return!1}extractAndDeleteMatchedStyles(t){let e=!1;const s=this.stylesToBeFiltered;if(t&&s){const n=Object.keys(s);for(const r of n)t[r]===s[r]&&(delete t[r],e=!0)}return e}buildCssTextForStyles(t,e){return`${`.${y.RTE_CONTENT_CONTAINER_CLASS_NAME}`+(e?` .${e}`:` ${t}`)} { ${Object.entries(this.stylesToBeFiltered).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")} }`}convertStylesMapToCssText(t){return Object.entries(t||this.stylesToBeFiltered).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}isBlockOrNodeStylesMatchFilterStyles(t,e){const s=t.getStyles({standalone:!0});return this.isMatchFilterStyles(s,e)}isMatchFilterStyles(t,e){return(e&&e.length>0?e:Object.keys(this.stylesToBeFiltered)).every((e=>t[e]===this.stylesToBeFiltered[e]))}}y.RTE_CONTENT_CONTAINER_CLASS_NAME="vega-rte-content",function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(w||(w={}));class R extends T{}class S{static isTextBlock(t){return t===this.RTE_TEXT_BLOCK_CLASS_NAME}static isCodeBlock(t){return"RTECodeBlock"===t}static isListBlock(t){return"RTEListBlock"===t}static isListItemBlock(t){return"RTEListItemBlock"===t}static isTextNode(t){return t===this.RTE_TEXT_NODE_CLASS_NAME}static isLinkNode(t){return this.isTextNode(t.constructor.name)&&!!t.getAnnotationByType(w.LINK)}static isCodeNode(t){if(this.isTextNode(t.constructor.name)){const e=t.getAnnotationByType(w.CODE);return!!e&&e.code}return!1}static isImageNode(t){return"RTEImageNode"===t.constructor.name}static isCodeBlockNode(t){return"RTECodeBlockNode"===t.constructor.name}}S.RTE_TEXT_NODE_CLASS_NAME="RTETextNode",S.RTE_TEXT_BLOCK_CLASS_NAME="RTETextBlock";class C extends y{constructor(){super(...arguments),this.stylesToBeFiltered=b.getDefaultStyles(),this.elementTagName="a"}filterAnnotations(t){const e=t.link;return(null==e?void 0:e.customStyle)?(this.extractAndDeleteMatchedStyles(e.customStyle),0===Object.keys(e.customStyle).length&&delete e.customStyle,t):t}canFilter(t){return S.isLinkNode(t)}canRefill(t,e){return"RTETextNode"===t&&e.matches(this.elementTagName)}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}filterLinkGroupInlineStyles(t){const e=t.style,s=t.class?t.class.split(" "):[],n=this.filterAndDeleteStyles(e,s);return n.styles&&Object.keys(n.styles).length>0&&(t.style=n.styles),n.classNames&&n.classNames.length>0&&(t.class=n.classNames.join(" ")),t.style&&0===Object.keys(t.style).length&&delete t.style,t}}class b extends T{constructor(t){super(),this.type=p.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}static getDefaultStyles(){return{color:"rgba(var(--v-text-link, 19, 98, 226, 1))"}}clone(){const t=new b("");return this.linkGroups.forEach(((e,s)=>{t.linkGroups.set(s,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){let s=this.toJsx(t,e);return(null==e?void 0:e.filterInlineStyles)&&(s=b.linkGroupFilterStylesStrategy.filterLinkGroupInlineStyles(s)),Object.entries(s).map((([t,e])=>{const s="string"==typeof e?e:this.formatStyleToString(e);return`${i(t)}="${s}"`})).join(" ")}toJsx(t,e){const s=this.getStyle(t,e),n=this.getClass(t,e),r=this.getAttribute(t);return n.length>0&&(r.class=n.join(" ")),s&&Object.keys(s).length>0&&(r.style=s),r}getClass(t,e){const s=[];return t.link.customClass&&s.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&s.push("v-rte--link"),s}getStyle(t,e){const s={};return t.link.customStyle&&Object.assign(s,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&Object.assign(s,b.getDefaultStyles()),s}getAttribute(t){const{href:e,customAttribute:s={}}=t.link,n=t.useInternalStyle,r=s.target||(n?"_blank":"");return Object.assign(Object.assign(Object.assign({},s),e||n?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}}b.linkGroupFilterStylesStrategy=new C;class k extends E{constructor(t){super(),this.type=f.ALIGNMENT,this.textAlign=t}static from(t){return[f.ALIGNMENT,new k(t)]}static getDefaultStyles(t){switch(t){case"right":case"center":case"justify":return{textAlign:t};case"left":default:return{textAlign:"left"}}}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new k(this.textAlign)}renderStyle(t){return(null==t?void 0:t.standalone)?k.getDefaultStyles(this.textAlign):null}}class v extends E{constructor(t){super(),this.type=f.INDENT,this.indent=Math.max(0,t)}static from(t){return[f.INDENT,new v(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new v(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class B{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).has(t)||this.registry.get(e).set(t,new Set),this.registry.get(e).get(t).add(s)}static unregister(t,e,s){const n=this.registry.get(e);if(n){const e=n.get(t);e&&e.delete(s)}}static get(t,e){const s=t instanceof m?t.type:t.constructor.name,n=this.registry.get(e.constructor.name);if(n){const r=n.get(s);if(r&&r.size>0)return Array.from(r).find((s=>s.canIntercept(t,e)))}}}B.registry=new Map;class j{static register(t,e,s){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,s)}static unregister(t,e){const s=this.registry.get(e);s&&s.delete(t)}static get(t,e){const s=this.registry.get(e);if(s)return s.get(t)}static executeTheStrategy(t,e){const s=B.get(t,e),n=()=>{const s=t instanceof m?t.type:t.constructor.name,n=j.get(s,e.constructor.name);if(n)return t.executedFlag=!0,n.execute(t,e);o.warn(`Type ${s} action handle strategy is not registered in class ${e.constructor.name}`)};return s?s.intercept(n,t,e):n()}static canHandle(t,e){return!!j.get(t,e.constructor.name)}}j.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(A||(A={}));class _ extends T{}class $ extends _{constructor(t){super(),this.type=A.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[A.CUSTOM_ATTRIBUTE,new $(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new $(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(c)}render(t={}){var e;const s=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete s[t])),Object.keys(s).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===s[t]&&(s[t]="true")})),s}}class L extends _{constructor(t){super(),this.type=A.CUSTOM_CLASS,this.customClass=t}static from(t){return[A.CUSTOM_CLASS,new L(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new L(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class D extends _{constructor(t){super(),this.type=A.CUSTOM_STYLE,this.customStyle=t}static from(t){return[A.CUSTOM_STYLE,new D(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new D(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class I extends E{constructor(t){super(),this.type=f.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[f.INTERNAL_WRAPPER,new I(t)]}clone(){return new I(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class M{constructor(t){this.dtoType=t instanceof RTEBlock?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,s){return s=s||this.toJSON(t,e),Object.entries(Object.assign({},s)).map((([t,e])=>`${i(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const s=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof D)).map((e=>e.renderStyle(t))).filter(c);return e&&e.length>0?this.mergeAnnotationStyles(s,e):s.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoType?t instanceof E:t instanceof R}mergeAnnotationStyles(t,e){const s={};for(const n of t)for(const t in n){const r=n[t],i=s[t];s[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return s}}class F{static register(t,e){var s;const n=null!==(s=this.registry.get(t))&&void 0!==s?s:new Set;n.add(e),this.registry.set(t,n)}static getStrategies(t){var e;return Array.from(null!==(e=this.registry.get(t))&&void 0!==e?e:[])}static executeTheStrategyFilterAction(t,e,s){return this.getStrategies(t.constructor.name).filter((e=>e.canFilter(t))).reduce(((t,e)=>e.filterAndDeleteStyles(t.styles,t.classNames)),{styles:e,classNames:s})}static executeTheStrategyRefillAction(t,e){this.getStrategies(t).filter((s=>s.canRefill(t,e))).forEach((t=>{t.refillStyles(e)}))}static generateAllStylesContent(t=!1){const e=[];return t&&(e.push("/* Font-face imports begin */\n"),e.push(Object.keys(a).map((t=>`@import url('${a[t].url}');\n`)).join(" ")),e.push("/* Font-face imports end */\n")),this.registry.forEach((t=>{t.forEach((t=>{const s=t.toCssText();s&&!e.includes(s)&&e.push(s)}))})),e.join(" ")}}F.registry=new Map,function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(O||(O={}));class RTENode{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,s){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}, ${s}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return $.from(e);case"customClass":return L.from(e);case"customStyle":return D.from(e)}}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}getStyles(t={standalone:!1}){return new M(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof L)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(A.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getElementRef(){return x.getDOMByEntity(this)}generateAttributeString(t,...e){var s;const n=new M(this),r=n.toJSON({standalone:!0},["textDecoration"]),i=this.annotationMap.get(A.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=F.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(s=this.getCustomAttributesAnnotation())||void 0===s?void 0:s.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${n.toCssText({standalone:!0},void 0,o)}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof m?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const n=x.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}const H=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof RTEBlock)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof RTENode))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class RTEBlock{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,s){return t.map((t=>{const n=H.getRTEBlockClass(t.type);if(n){const r=n.from(t,e);return r.parent=s,r}})).filter(c)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return k.from(e);case"indent":return v.from(e);case"customAttribute":return $.from(e);case"customClass":return L.from(e);case"customStyle":return D.from(e);case"internalWrapper":return I.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,s])=>{const n=this.createAnnotationEntity(e,s);c(n)&&t.set(...n)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(f.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof b||t instanceof I))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof E||t instanceof _)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(n){if(this.doApply(n),n.isFlushable){const n=x.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}getFirstNode(){if(!this.children||!this.children[0])return null;const t=this.children[0];return t instanceof RTEBlock?t.getFirstNode():t}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new M(this).toJSON(t);return Object.assign(Object.assign({},e),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof E||t instanceof L)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(A.CUSTOM_ATTRIBUTE)}generateAttributeString(t,...e){var s;const n=new M(this),r=n.toJSON({standalone:!0}),i=this.annotationMap.get(A.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=F.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(s=this.getCustomAttributesAnnotation())||void 0===s?void 0:s.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${n.toCssText({standalone:!0},void 0,o)}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof m?j.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();if(e instanceof b||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply)this.doAnnotationActionApply(t);else{const e=j.get(t.constructor.name,this.constructor.name);e&&e.execute(t,this)}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}class P{}class J extends P{constructor(){super(...arguments),this.doSplit=!0}}class K extends T{constructor(t){super(),this.type=p.SELECTION_RANGE,this.range=t}clone(){return new K(this.range)}}const U="700",W="bold",G="italic",z="underline",V="line-through";class X extends R{constructor(t){super(),this.type=w.STRIKETHROUGH,this.strikethrough=t}static from(t){return[w.STRIKETHROUGH,new X(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new X(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class q extends R{constructor(t){super(),this.type=w.UNDERLINE,this.underline=t}static from(t){return[w.UNDERLINE,new q(t)]}toJSON(){return{underline:this.underline}}clone(){return new q(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class Y extends R{constructor(t){super(),this.type=w.ITALIC,this.italic=t}static from(t){return[w.ITALIC,new Y(t)]}toJSON(){return{italic:this.italic}}clone(){return new Y(this.italic)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class Q extends R{constructor(t){super(),this.type=w.BOLD,this.bold=t}static from(t){return[w.BOLD,new Q(t)]}toJSON(){return{bold:this.bold}}clone(){return new Q(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class Z extends R{constructor(t,e=!0){super(),this.type=w.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[w.CODE,new Z(t,e)]}static getDefaultStyles(){return{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}}toJSON(){return{code:this.code}}clone(){return new Z(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?Z.getDefaultStyles():null}}const tt={key:"black",light:"#111128",dark:"#E3E3E8"},et=[tt,{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],st="",nt=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]],rt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);class it extends R{constructor(t){super(),this.type=w.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[w.TEXT_COLOR,new it(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new it(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:h.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return et.find((e=>e.key===t))||et[0]}}class ot extends R{constructor(t,e=!0){super(),this.type=w.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[w.LINK,new ot(t,e)]}toJSON(){return{link:this.link}}clone(){return new ot(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class ct extends P{constructor(t,e,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=s}toAnnotation(){return new b(this.groupKey)}}class at extends P{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class lt{execute(t,e){return o.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const s=t.annotationMap.get(A.CUSTOM_STYLE);s&&this.isCustomStyle(s,e)&&t.annotationMap.set(s.type,new D(s.removeStyles(e)))}createNewParagraph(t){const e=H.getRTEBlockClass("paragraph");if(e)return e.from({id:l(),type:"paragraph",nodes:[{id:l(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,s){return e===t.children[0]&&0===s}isCaretPositionAtBlockEnd(t,e,s){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,s):this.isCaretPositionAtDecoratorBlockEnd(t,e,s)}getDOMByEntity(t){return x.getDOMByEntity(t)}isCaretPositionAtTextBlockEnd(t,e,s){const n=t.children[t.children.length-1];return e===n&&(e.isEmpty()||s===n.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,s){return e===t.children[t.children.length-1]&&0!==s}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class ht extends m{constructor(t){super(),this.type=g.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class ut extends lt{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const s=e.getAnnotationByType(p.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof J&&t.doSplit&&s){const{startContainer:t,endContainer:n,startOffset:r,endOffset:i}=s.range,o=t===n&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(s.range)&&e.isContentEditable()){const n=this.splitTextNode(s.range,e);return t.annotationMap.has("LINK")&&t.apply(new ht(n)),n}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const s=e.cloneWithText("");this.setApplyTargetNode(s);const n=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===n?[s,e]:t===e.text.length||!e.isContentEditable()&&t===n+1?[e,s]:[e.cloneWithText(e.text.substring(0,t)),s,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:s,startOffset:n,endOffset:r}=t;return e!==s||n>0||r<(s.textContent?s.textContent.length:0)}splitTextNode(t,e){const{startContainer:s,endContainer:n,startOffset:r}=t,i=s.parentElement,o=n.parentElement,c=(t,s,n)=>{const r=t.substring(0,s),i=t.substring(s,n),o=t.substring(n);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},a=i&&x.getEntityByDOM(i),l=o&&x.getEntityByDOM(o);if(a&&a.id===e.id){const i=s===n?t.endOffset:e.text.length,[o,a,l]=c(e.text,r,i);return this.setApplyTargetNode(a),[o,a,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[s,n,r]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(n),[s,n,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class dt extends J{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new Q(this.bold)}}class pt extends T{constructor(){super(...arguments),this.type=p.CLEAR_FORMATTING,this.items=[w.BOLD,w.ITALIC,w.UNDERLINE,w.STRIKETHROUGH,w.TEXT_COLOR,w.CODE,A.CUSTOM_STYLE]}}class ft extends J{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new pt}}class Tt extends J{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new Z(this.code)}}class Et extends P{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class xt extends J{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new Y(this.italic)}}class gt extends J{constructor({link:t,newText:e,needMergeNode:s,doSplit:n,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=s,this.newText=e,this.type=r,c(n)&&(this.doSplit=n)}toAnnotation(){return new ot(this.link)}}class wt extends J{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new X(this.strikethrough)}}class At extends J{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new q(this.underline)}}class Ot extends lt{handleAction(t,e){const s=t.toAnnotation();if(t instanceof Et)e.annotationMap.delete(t.annotationType);else{if(!(s instanceof pt))return s instanceof R||s instanceof K?(t instanceof gt&&(c(t.newText)&&(e.text=t.newText),e.parent.apply(new ct(t.link.groupKey,[e],t.type))),t instanceof Tt&&this.handleAction(new ft,e),t instanceof dt&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof xt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof At||t instanceof wt)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(s.type,s)):void 0;s.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class mt extends m{constructor(){super(...arguments),this.type=g.DELETE_LINK_GROUP}}class Nt extends lt{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new mt)}}class yt extends m{constructor(t){super(),this.type=g.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class Rt extends lt{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,s){if(e&&e.startContainer&&e.endContainer){const{startContainer:n,endContainer:r,startOffset:i,endOffset:o}=e;let c=s.text;if(n===r&&i===o&&t)c=s.text.slice(0,i)+t+s.text.slice(i);else{const e=n.parentElement,a=r.parentElement,l=e&&x.getEntityByDOM(e),h=a&&x.getEntityByDOM(a);let u=0,d=s.text.length;l&&l===s?(u=i,d=n===r?o:d):h&&h===s&&(d=o),c=s.text.slice(0,u)+t+s.text.slice(d)}s.apply(new yt(c))}}}class St extends T{constructor(t){super(),this.type=w.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:s,customStyle:n,customClass:r,customAttribute:i}=t,o=new St(e);return o.groupId=t.groupId,o.child=s?St.from(s)[1]:void 0,o.customAttribute=i?$.from(i)[1]:void 0,o.customClass=r?L.from(r)[1]:void 0,o.customStyle=n?D.from(n)[1]:void 0,[w.INLINE_HTML,o]}clone(){var t,e,s,n;const r=new St(this.htmlTag);return r.groupId=this.groupId,r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(s=this.customClass)||void 0===s?void 0:s.clone(),r.customStyle=null===(n=this.customStyle)||void 0===n?void 0:n.clone(),r}renderProps(){var t,e,s;return Object.assign(Object.assign({},null===(t=this.customAttribute)||void 0===t?void 0:t.render()),{style:null===(e=this.customStyle)||void 0===e?void 0:e.renderStyle(),class:null===(s=this.customClass)||void 0===s?void 0:s.renderClass().join(" ")})}toJSON(){var t,e,s,n;return{inlineHtml:u({htmlTag:this.htmlTag,groupId:this.groupId,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(s=this.customClass)||void 0===s?void 0:s.toJSON().customClass,customStyle:null===(n=this.customStyle)||void 0===n?void 0:n.toJSON().customStyle})}}}class Ct extends lt{handleAction(t,e){const s=e.parent.getAnnotationByType(p.LINK_GROUP);if(s){const n=e.annotationMap.get("LINK").link.groupKey,r=s.linkGroups.get(n);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),s.linkGroups.set(n,r))}}}}class bt extends lt{handleAction(t,e){const s=e.parent.getAnnotationByType(p.LINK_GROUP);if(s){const t=e.annotationMap.get(w.LINK).link.groupKey,n=s.linkGroups.get(t);if(n){const r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&s.linkGroups.delete(t),0===s.linkGroups.size&&e.parent.annotationMap.delete(p.LINK_GROUP)}}e.annotationMap.delete(w.LINK)}}class kt extends R{constructor(t){super(),this.type=w.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[w.PLAIN_TEXT,new kt(t)]}clone(){return new kt(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return this.plainText?{plainText:this.plainText}:void 0}}class vt extends J{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new it(this.textColor)}}class RTETextNode extends RTENode{constructor(t,e,s,n){super(t,n),this.type=O.TEXT,this.parent=s,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,s={autoMatchFormat:!0}){const n=new RTETextNode(t.id,t.text,e),{annotations:r}=t;return r&&(n.annotationMap=this.generateTextAnnotationMap(r,s,e,n)),n}static generateTextAnnotationMap(t,e,s,n){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&s&&n&&s.apply(new ct(t.link.groupKey,[n],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(c))}static createAnnotationEntity(t,e,s){const n=!(!s||!s.autoMatchFormat);switch(t){case"bold":return Q.from(e);case"italic":return Y.from(e);case"underline":return q.from(e);case"strikethrough":return X.from(e);case"code":return Z.from(e,n);case"textColor":return it.from(e);case"link":return ot.from(e,n);case"inlineHtml":return St.from(e);case"plainText":return kt.from(e)}return RTENode.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof R||t instanceof _||t instanceof St)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}toHtml(t){const e=this.getAnnotationByType(w.INLINE_HTML);return e?this.renderWithWrapperStr(e,t):this.renderTextStr(t)}cloneWithText(t){return new RTETextNode(l(),t,this.parent,super.cloneAnnotations())}clone(t){return new RTETextNode(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!(this.getAnnotationByType(w.INLINE_HTML)||this.text&&""!==this.text&&"\n"!==this.text)}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=this.getElementRef();if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}getInlineHtmlTagAtDepth(t){const e=this.getInlineHtmlAnnotationAtDepth(t);return e?rt.has(e.htmlTag)?null:{htmlTag:e.htmlTag,attrStr:this.annotationAttrStr(e),groupId:e.groupId,annotation:e}:null}renderHtmlFromDepth(t,e){const s=this.getInlineHtmlAnnotationAtDepth(t);return s?this.renderWithWrapperStr(s,e):this.renderTextStr(e)}getInlineHtmlAnnotationAtDepth(t){let e=this.getAnnotationByType(w.INLINE_HTML);for(let s=0;s<t&&e;s++)e=e.child;return e}registerModifyStrategy(){const t=this.constructor.name;RTETextNode.registerActionStrategyStatus[t]||(this.isContentEditable()&&(j.register(g.UPDATE_TEXT,t,new Nt),j.register(g.REPLACE_SELECTED_TEXT,t,new Rt),j.register(g.LINK_GROUP_NODE_SPLIT,t,new Ct),j.register(gt.name,t,new Ot)),j.register(J.name,t,new ut),j.register(g.DELETE_LINK_GROUP,t,new bt),j.register(dt.name,t,new Ot),j.register(ft.name,t,new Ot),j.register(xt.name,t,new Ot),j.register(At.name,t,new Ot),j.register(vt.name,t,new Ot),j.register(wt.name,t,new Ot),j.register(Tt.name,t,new Ot),j.register(P.name,t,new Ot),RTETextNode.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(p.SELECTION_RANGE);if(t instanceof J&&t.doSplit&&e){const e=j.get(J.name,this.constructor.name);if(e){const s=e.execute(t,this);s&&this.applyActionToNode(s,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){j.executeTheStrategy(t,this)}applyActionToNode(t,e){const s=e.toAnnotation();if(e instanceof at)return void this.syncUpSelectedNodes(t);s instanceof K||this.syncUpSelectedNodes(t);const n=j.get(e.constructor.name,t.constructor.name);if(n)return void n.execute(e,t);const r=j.get(P.name,RTETextNode.name);r&&r.execute(e,t)}syncUpSelectedNodes(s){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,n);i&&t.notify(i,{node:s})}}renderWithWrapperStr(t,e){const{htmlTag:s,child:n}=t,r=this.annotationAttrStr(t);return n?`<${s}${r}>${this.renderWithWrapperStr(n,e)}</${s}>`:rt.has(s)?`<${s}${r}>`:this.text?`<${s}${r}>${this.renderTextStr(e)}</${s}>`:`<${s}${r}></${s}>`}annotationAttrStr(t){const{customAttribute:e,customClass:s,customStyle:n}=t,r=[...(null==e?void 0:e.toString())||[],null==s?void 0:s.toString(),null==n?void 0:n.toString()].filter(c);return r.length>0?` ${r.join(" ")}`:""}renderTextStr(t){var e;const s=(null===(e=this.getAnnotationByType(w.CODE))||void 0===e?void 0:e.code)?"code":"span",n=super.generateAttributeString(t);return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${s}${n}>${this.text}</${s}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(w.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof R&&!(t instanceof ot)&&!(t instanceof kt)||t instanceof _)).length}}RTETextNode.registerActionStrategyStatus={},RTETextNode.htmlTag="span";class Bt extends m{constructor(t){super(),this.type=g.APPEND_CHILDREN,this.entityToBeAppended=t}}class jt extends E{constructor(t){super(),this.type=f.TEXT_STYLE,this.textStyle=t}static from(t){return[f.TEXT_STYLE,new jt(t)]}static getDefaultStyles(t){const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},s=Object.assign(Object.assign({},e),{marginTop:"0px",marginBottom:"0px"});switch(t){case"paragraph":return s;case"title":return Object.assign(Object.assign({},e),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"});case"subtitle":return Object.assign(Object.assign({},e),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"});case"heading-1":return Object.assign(Object.assign({},s),{fontSize:"22px",lineHeight:"24px",minHeight:"24px"});case"heading-2":return Object.assign(Object.assign({},s),{fontSize:"20px",lineHeight:"24px",minHeight:"24px"});case"heading-3":return Object.assign(Object.assign({},s),{fontSize:"18px"});case"heading-4":return Object.assign({},s);case"heading-5":return Object.assign(Object.assign({},s),{fontSize:"14px"});case"heading-6":return Object.assign(Object.assign({},s),{fontSize:"12px"});default:return null}}toJSON(){return{textStyle:this.textStyle}}clone(){return new jt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.textStyle?jt.getDefaultStyles(this.textStyle):null}}class _t extends P{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new jt(this.textStyle)}}class $t extends lt{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new dt(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new Et(w.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class Lt extends m{constructor(t,...e){super(),this.type=g.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class Dt extends m{constructor(t){super(),this.type=g.REPLACE_CHILD_NODES,this.newChildNodes=t}}class It extends lt{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,s){if(t){const n=t.text.slice(0,e),r=t.text.slice(e),i=s.children.indexOf(t);if(i>-1){const e=s.children.slice(0,i),o=s.children.slice(i+1);n&&e.push(t.cloneWithText(n)),r&&o.unshift(t.cloneWithText(r)),s.apply(new Dt(e));const c=s.cloneWithNodes(o);return s.parent.apply(new Lt(s,c)),c}}}}class Mt extends lt{handleAction(t,e){e.children=[],e.apply(new Bt(t.newChildNodes))}}class Ft extends m{constructor(t){super(),this.type=g.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Ht extends lt{handleAction(t,e){const s=t.blockNeedToBeMerged;if(e.type===s.type||"image"!==e.type&&"image"!==s.type){let t=s.children;"image"!==s.type&&(t=s.children.filter((t=>t.text))),e.apply(new Bt(t)),s.parent.apply(new Ft(s))}}}class Pt extends lt{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,s){if(t){const n=new RTETextNode(l(),"\n",s),r=t.text.slice(0,e),i=t.text.slice(e),o=s.children.indexOf(t);if(o>-1){const e=s.children.slice(0,o),c=s.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,n,c,s)}return n}}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(l(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Dt([...t,e,...s]))}}class Jt extends lt{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const s=e.children,n=new RTETextNode(l(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,n,r,e),n}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new Ft(t)))})),e}mergeLineBreakNodes(t,e,s,n){(0===s.length||s[0]&&""===s[0].text)&&s.push(new RTETextNode(l(),"\n",n,t[t.length-1]&&t[t.length-1].annotationMap)),n.apply(new Dt([...t,e,...s]))}}class Kt extends m{constructor(t,...e){super(),this.type=g.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class Ut extends m{constructor(t,e){super(),this.type=g.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class Wt extends P{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new k(this.textAlign)}}class Gt extends lt{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class zt extends P{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new v(this.indent)}}class RTETextBlock extends RTEBlock{constructor(t,e,s){super(t),this.children=[],this.type=e;const{autoMatchFormat:n}=s||{autoMatchFormat:!0};n&&(this.annotationMap=RTETextBlock.isAcceptableTextStyle(e)?new Map([jt.from(e)]):new Map([jt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var s,n;const r=new RTETextBlock(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(n=null===(s=t.annotations)||void 0===s?void 0:s.textStyle)&&void 0!==n?n:r.type}):t.annotations;return r.children=t.nodes.map((t=>{const s=H.getRTENodeClass(t.type);if(s)return s.from(t,r,e)})).filter(c),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?jt.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.children=this.children.reduce(((e,s)=>{const n=e.at(-1);if(t instanceof gt&&t.needMergeNode){const t=null==n?void 0:n.getAnnotationByType(w.LINK),r=s.getAnnotationByType(w.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,s]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),s=super.generateAttributeString(t),n=this.getChildrenHtml(t);return super.shouldRenderAsInternalWrapper()?n:[`<${e}${s}>`,n,`</${e}>`].join("")}cloneWithNodes(t){const e=new RTETextBlock(l(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new Bt(t)),e}clone(t){const e=new RTETextBlock(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}getChildrenHtml(t){const e=this.getAnnotationByType(p.LINK_GROUP);let s=this.renderGroupedNodesAtDepth(this.children,0,t);return e&&this.children.length>0&&(s=this.generateLinkHtml(e,s,t)),s}doAnnotationActionApply(t){const e=j.get(t.constructor.name,RTETextBlock.name);e&&e.execute(t,this)}renderGroupedNodesAtDepth(t,e,s){var n;let r="",i=0;for(;i<t.length;){const o=t[i].getInlineHtmlTagAtDepth(e);if(!(null==o?void 0:o.groupId)){r+=t[i].renderHtmlFromDepth(e,s),i++;continue}let c=i+1;for(;c<t.length&&(null===(n=t[c].getInlineHtmlTagAtDepth(e))||void 0===n?void 0:n.groupId)===o.groupId;)c++;if(c===i+1)r+=t[i].renderHtmlFromDepth(e,s);else{const n=this.renderGroupedNodesAtDepth(t.slice(i,c),e+1,s);r+=`<${o.htmlTag}${o.attrStr}>${n}</${o.htmlTag}>`}i=c}return r}generateLinkHtml(t,e,s){e="";let n=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(w.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(w.LINK):null;if(i){if(n.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,filterInlineStyles:null==s?void 0:s.filterInlineStyles});e+=[`<a${r?` ${r}`:""}>`,this.renderGroupedNodesAtDepth(n,0,s),"</a>"].join(""),n=[]}}else e+=this.children[r].toHtml(s)}return e}}j.register(_t.name,RTETextBlock.name,new $t),j.register(Wt.name,RTETextBlock.name,new Gt),j.register(zt.name,RTETextBlock.name,new class extends lt{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),j.register(ct.name,RTETextBlock.name,new class extends lt{handleAction(t,e){let s=e.getAnnotationByType(p.LINK_GROUP);if("update_link"===t.type){if(s){const e=s.linkGroups.get(t.groupKey);e&&s.linkGroups.set(t.groupKey,[e[0]])}}else{if(s){const e=s.linkGroups.get(t.groupKey)||[];s.linkGroups.set(t.groupKey,[...e,...t.nodes])}else s=t.toAnnotation(),s.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(p.LINK_GROUP,s)}}}),j.register(g.UNLINK_LINK_GROUP,RTETextBlock.name,new class extends lt{handleAction(t,e){const s=e.getAnnotationByType(p.LINK_GROUP);s&&(s.linkGroups.size>1?s.linkGroups.delete(t.groupKey):e.annotationMap.delete(p.LINK_GROUP))}}),j.register(g.SPLIT_BLOCK_WITH_NODE,RTETextBlock.name,new It),j.register(g.REPLACE_CHILD_NODES,RTETextBlock.name,new Mt),j.register(g.MERGE_TWO_BLOCKS_NODES,RTETextBlock.name,new Ht),j.register(g.LINE_BREAK_SINGLE_BLOCK,RTETextBlock.name,new Pt),j.register(g.LINE_BREAK_MULTIPLE_BLOCKS,RTETextBlock.name,new Jt),j.register(g.INSERT_IMAGE_TO_BLOCK,RTETextBlock.name,new class extends lt{handleAction(t,e){const s=t.splitPointNode,n=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,s,n))e.parent.apply(new Lt(e,r));else if(this.isCaretPositionAtBlockStart(e,s,n))e.parent.apply(new Kt(e,r));else{const t=new Ut(s,n);e.apply(t),e.parent.apply(new Lt(e,r))}}}),j.register(g.TRANSFORM_LIST_BLOCK,RTETextBlock.name,new class extends lt{handleAction(t,e){const s=e.parent,n=s.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>s.toListItem(t)));n.apply(new Bt(i)),s.apply(new Lt(t.selectedBlocks[0],n)),r.forEach((t=>{t.parent.apply(new Ft(t))}))}});class Vt extends lt{getPreviousNode(t){const e=t.parent,s=e.children.indexOf(t);if(s>0)return e.children[s-1];if(e.parent){const t=this.getPreviousBlock(e);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,s=e.children.indexOf(t);if(e.children[s+1])return e.children[s+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,s=e.children.indexOf(t),n=e.parent;if(e.isListItemBlock()){const t=n.parent;return 0===s&&Array.isArray(n.children)&&n.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===n}return 0===s&&Array.isArray(n.children)&&n.children[0]===e}getPreviousBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(this.isRTEBlock(t.parent)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}isRTEBlock(t){return t&&"VegaRTEContent"!==t.constructor.name}}class Xt extends m{constructor(t,e){super(),this.isFlushable=!0,this.type=g.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class qt extends P{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new K(this.range)}}class RTEDecoratorNode extends RTENode{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return d(t,`.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}RTEDecoratorNode.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",RTEDecoratorNode.DECORATOR_NODE_CLASS="v-internal-decorator-node";class Yt extends y{constructor(){super(...arguments),this.stylesToBeFiltered=Yt.STYLES,this.elementTagName="pre code"}canFilter(t){return S.isCodeBlockNode(t)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Yt.STYLES={boxSizing:"border-box",color:"rgba(var(--v-text-primary, 32, 54, 69, 1))",textAlign:"left",fontFamily:'"Roboto Mono"',fontWeight:"400",lineHeight:"22px",fontSize:"16px",whiteSpace:"pre-wrap",minHeight:"22px",tabSize:"2px"};class RTECodeBlockNode extends RTEDecoratorNode{constructor(t,e,s,n){super(t),this.type=O.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=n,this.language=s,this.annotationMap.set(A.CUSTOM_STYLE,new D(Yt.STYLES))}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(t){return`<code${this.generateAttributeString(t)}>${this.text}</code>`}clone(t){return new RTECodeBlockNode(this.id,this.text,this.language,t)}doAnnotationActionApply(t){j.executeTheStrategy(t,this)}doModifyActionApply(t){j.executeTheStrategy(t,this)}}j.register(g.UPDATE_CODE_BLOCK,RTECodeBlockNode.name,new class extends lt{handleAction(t,e){const{content:s,language:n}=t;e.language=n,e.text=s}}),j.register(qt.name,RTECodeBlockNode.name,new class extends lt{handleAction(t,e){e.annotationMap.set(p.SELECTION_RANGE,t.toAnnotation())}});var Qt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Qt||(Qt={}));class Zt extends lt{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new Ft(e)))}}class te extends y{constructor(){super(...arguments),this.stylesToBeFiltered=te.STYLES,this.elementTagName="pre"}canFilter(t){return S.isCodeBlock(t.constructor.name)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}te.STYLES={backgroundColor:"rgba(var(--v-bg-secondary, 245, 247, 247, 1))",padding:"12px"};class RTECodeBlock extends RTEBlock{constructor(t,e,s){super(t),this.type="code-block",this.annotationMap=new Map([D.from(te.STYLES)]),this.children=[new RTECodeBlockNode(`${t}-1`,e,s,this)]}static from(t){return new RTECodeBlock(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(t){const{language:e=Qt["Plain Text"]}=this.children[0];return`<pre data-language="${e}"${super.generateAttributeString(t)}>${this.children.map((e=>e.toHtml(t)))}</pre>`}clone(t){const e=RTECodeBlock.from(this.toJSON());return e.parent=t,e}apply(n){if(n instanceof m&&j.executeTheStrategy(n,this),n.isFlushable){const n=x.getDOMByEntity(this);if(n){const r=e.getSubjectFromParentNodeByEventId(n,s);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(p.SELECTION_RANGE)}}j.register(g.DELETE_CODE_BLOCK,RTECodeBlock.name,new class extends Vt{handleAction(t,e){const s=e.children[0],n=e.parent;if(n){let t=this.getPreviousNode(s),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(s),r=0),n.apply(new Ft(e));const i=t?x.getDOMByEntity(t):null;if(0===n.children.length){const s=RTETextBlock.from({id:l(),type:"paragraph",nodes:[{id:l(),type:"text",text:""}]});e.parent.apply(new Bt([s])),t=s.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(s,r,i,o){const c=x.getDOMByEntity(o);if(c){const o=e.getSubjectFromParentNodeByEventId(c,n);o&&t.notify(o,{node:s,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),j.register(g.DELETE_CHILDREN,RTECodeBlock.name,new Zt),j.register(g.SWITCH_OUT_FROM_CODE_BLOCK,RTECodeBlock.name,new class extends lt{handleAction(s,r){const{content:i,language:o}=s,c=i.split("\n"),a=new Xt(c.slice(0,c.length-2).join("\n"),o);a.isFlushable=!1,r.children[0].apply(a);const h=RTETextBlock.from({id:l(),type:"paragraph",nodes:[{id:l(),text:"",type:"text"}]});r.parent.apply(new Lt(r,h));const u=x.getDOMByEntity(r);if(u){const s=e.getSubjectFromParentNodeByEventId(u,n);s&&t.notify(s,{node:h.children[0]})}}}),j.register(g.INSERT_IMAGE_TO_BLOCK,RTECodeBlock.name,new class extends lt{handleAction(t,e){e.parent.apply(new Lt(e,t.imageBlockToBeInserted))}}),RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{tt as $,j as A,E as B,A as C,L as D,RTECodeBlock as E,w as F,RTEDecoratorNode as G,Wt as H,Lt as I,O as J,_ as K,Dt as L,m as M,R as N,Ut as O,rt as P,Vt as Q,F as R,at as S,_t as T,yt as U,nt as V,Zt as W,W as X,U as Y,N as Z,et as _,B as a,G as a0,V as a1,z as a2,jt as a3,S as a4,k as a5,Z as a6,C as a7,te as a8,RTECodeBlockNode as a9,Yt as aa,Qt as ab,st as ac,gt as ad,Xt as ae,qt as af,vt as ag,dt as ah,xt as ai,At as aj,Q as ak,ft as al,Tt as am,wt as an,zt as ao,H as b,RTETextNode as c,RTEBlock as d,RTETextBlock as e,M as f,lt as g,Bt as h,RTENode as i,Kt as j,p as k,g as l,P as m,Ft as n,$ as o,y as p,$t as q,Gt as r,x as s,Pt as t,Jt as u,It as v,Mt as w,Ht as x,f as y,D as z}
|