@heartlandone/vega 2.103.0 → 2.105.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-85986306.js → app-globals-bc84b09b.js} +10 -10
- package/dist/cjs/{code-block-72de6c4d.js → code-block-7340d2b7.js} +1 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-23d2b3d8.js → component-value-history-controller-slimmer.abstract-dd834f8d.js} +3 -3
- package/dist/cjs/{content-state-ff40bdc6.js → content-state-dde1253f.js} +2 -2
- package/dist/cjs/{date-required-rule-608e704b.js → date-required-rule-5e6777cf.js} +1 -1
- package/dist/cjs/{design-token-a101a8d0.js → design-token-b28d222d.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-b93cc564.js → element-appender-slimmer-a87bc0ce.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-124d54ea.js → form-field-controller-slimmer-fde2b355.js} +16 -2
- package/dist/cjs/{image-annotation-action-1ee41bc7.js → image-annotation-action-715bece3.js} +2 -2
- package/dist/cjs/{image-extension-6a92c524.js → image-extension-cc8f36a1.js} +5 -5
- package/dist/cjs/index.cjs.js +17 -17
- package/dist/cjs/{inject-keyboard-manager-32d7dd0e.js → inject-keyboard-manager-1a113d04.js} +1 -1
- package/dist/cjs/{internal-calendar-period-factory-c3198ea7.js → internal-calendar-period-factory-bf5e8294.js} +1 -1
- package/dist/cjs/{internal-translation-controller-0d67ca4d.js → internal-translation-controller-b5bbefc9.js} +4 -0
- package/dist/cjs/{keyboard-manager-332eec89.js → keyboard-manager-d0271450.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-a2872981.js → keyboard-manager-slimmer-5a4c0e4c.js} +1 -1
- package/dist/cjs/{legend-input-processor-ce9b38f8.js → legend-input-processor-bd36a794.js} +28 -0
- package/dist/cjs/{link-extension-1b4ed437.js → link-extension-953fb2a0.js} +3 -3
- package/dist/cjs/loader.cjs.js +12 -12
- package/dist/cjs/{month-view-generator-b6a2b8be.js → month-view-generator-b68bcf4b.js} +1 -1
- package/dist/cjs/{public-rules-2066613c.js → public-rules-8bfc6de7.js} +7 -7
- package/dist/cjs/{range-712fe703.js → range-4060b238.js} +1 -1
- package/dist/cjs/{responsive-format-facade-44d33457.js → responsive-format-facade-fed434ed.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-1aa75d22.js → rich-text-editor-required-rule-16e74e91.js} +1 -1
- package/dist/cjs/{split-cell-operation-afc82323.js → split-cell-operation-430e9f27.js} +3 -3
- package/dist/cjs/{state-border-formatter-49984fd6.js → state-border-formatter-b469de2f.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-bd563c01.js → string-format-strategy.abstract-b3174863.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-4faebac9.js → string-input-formatter-slimmer-ceb678e9.js} +1 -1
- package/dist/cjs/{string-mask-strategy-624c4398.js → string-mask-strategy-5f84e2f6.js} +2 -2
- package/dist/cjs/{style-formatter-151d89a3.js → style-formatter-e98caf3c.js} +2 -2
- package/dist/cjs/{time-required-rule-8cd8f9b9.js → time-required-rule-249cb6b6.js} +1 -1
- package/dist/cjs/{token-extension-72d0cb08.js → token-extension-f074902b.js} +8 -8
- package/dist/cjs/{translation-slimmer-1771d01f.js → translation-slimmer-b60d598e.js} +1 -1
- package/dist/cjs/{type-guard-cce6fe1f.js → type-guard-8eb40609.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-b13c2fc4.js → valid-credit-card-number-rule-f5d2b2c6.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
- package/dist/cjs/vega-app-footer.cjs.entry.js +20 -25
- package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-bar-chart.cjs.entry.js +2 -2
- package/dist/cjs/vega-box.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +3 -3
- package/dist/cjs/vega-calendar_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +13 -13
- package/dist/cjs/vega-dialog_2.cjs.entry.js +10 -5
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -7
- 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 +3 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +21 -12
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-numeric.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-passcode.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +5 -5
- package/dist/cjs/vega-input.cjs.entry.js +6 -6
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-line-chart.cjs.entry.js +2 -2
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
- package/dist/cjs/vega-pie-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-bookmark-editor.cjs.entry.js +2 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +63 -19
- package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +1 -1
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
- package/dist/cjs/vega.cjs.js +12 -12
- package/dist/cjs/{y-axis-input-processor-d3a3839c.js → y-axis-input-processor-9ba96716.js} +1 -1
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +38 -35
- package/dist/collection/components/vega-dialog/vega-dialog.js +7 -2
- package/dist/collection/components/vega-image-uploader/slimmers/controllers/vega-image-uploader-remove-controller.js +6 -3
- package/dist/collection/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-actions-renderer.js +6 -3
- package/dist/collection/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-uploading-content-renderer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.js +45 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +16 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +3 -0
- package/dist/collection/constants/misc.js +2 -4
- package/dist/collection/helpers/slimmers/form/form-field-controller-slimmer.js +12 -1
- package/dist/collection/helpers/translation/locales/en.js +4 -0
- package/dist/collection/helpers/validator/form-field-controller.js +4 -1
- package/dist/collection/polyfill/d3/d3-shape-polyfill.js +28 -0
- package/dist/esm/{app-globals-8cdfc5c9.js → app-globals-8541b3dc.js} +10 -10
- package/dist/esm/{code-block-9360c331.js → code-block-c16c69a5.js} +1 -1
- package/dist/esm/{component-value-history-controller-slimmer.abstract-9ea58806.js → component-value-history-controller-slimmer.abstract-1cea9add.js} +3 -3
- package/dist/esm/{content-state-67a12e74.js → content-state-73664d93.js} +2 -2
- package/dist/esm/{date-required-rule-66b5bf02.js → date-required-rule-14131e09.js} +1 -1
- package/dist/esm/{design-token-acd1efeb.js → design-token-4b81bae7.js} +3 -3
- package/dist/esm/{element-appender-slimmer-7e5bc1e9.js → element-appender-slimmer-9094aa07.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-d653c494.js → form-field-controller-slimmer-6f0f083f.js} +16 -2
- package/dist/esm/{image-annotation-action-9525be48.js → image-annotation-action-86052c2e.js} +2 -2
- package/dist/esm/{image-extension-aea75132.js → image-extension-04843995.js} +5 -5
- package/dist/esm/index.js +17 -17
- package/dist/esm/{inject-keyboard-manager-f6522d2f.js → inject-keyboard-manager-1a950408.js} +1 -1
- package/dist/esm/{internal-calendar-period-factory-261df2f2.js → internal-calendar-period-factory-14c000cf.js} +1 -1
- package/dist/esm/{internal-translation-controller-3637e47e.js → internal-translation-controller-6eb30c39.js} +4 -0
- package/dist/esm/{keyboard-manager-53e8d8d0.js → keyboard-manager-e7add1f3.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-b3de042d.js → keyboard-manager-slimmer-ffe6588a.js} +1 -1
- package/dist/esm/{legend-input-processor-3b2de4b7.js → legend-input-processor-bd91524a.js} +28 -0
- package/dist/esm/{link-extension-57ba9520.js → link-extension-caabb7d8.js} +3 -3
- package/dist/esm/loader.js +12 -12
- package/dist/esm/{month-view-generator-15215a09.js → month-view-generator-0dad54d9.js} +1 -1
- package/dist/esm/{public-rules-c77a1550.js → public-rules-76247d91.js} +7 -7
- package/dist/esm/{range-3c74e1c8.js → range-c0aec697.js} +1 -1
- package/dist/esm/{responsive-format-facade-1b325d06.js → responsive-format-facade-1a9177b9.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-cfd32ba2.js → rich-text-editor-required-rule-65e18ef0.js} +1 -1
- package/dist/esm/{split-cell-operation-85a036f9.js → split-cell-operation-814641f5.js} +3 -3
- package/dist/esm/{state-border-formatter-ce3495b0.js → state-border-formatter-31f3145a.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-8ce04558.js → string-format-strategy.abstract-a8612297.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-0d60ba7d.js → string-input-formatter-slimmer-8f2aa95a.js} +1 -1
- package/dist/esm/{string-mask-strategy-cabc1d50.js → string-mask-strategy-e8bad1c6.js} +2 -2
- package/dist/esm/{style-formatter-00fe4f1c.js → style-formatter-42e87858.js} +2 -2
- package/dist/esm/{time-required-rule-57ceeae9.js → time-required-rule-fcab062e.js} +1 -1
- package/dist/esm/{token-extension-645a9520.js → token-extension-f001f08e.js} +8 -8
- package/dist/esm/{translation-slimmer-b69057eb.js → translation-slimmer-5fa762dc.js} +1 -1
- package/dist/esm/{type-guard-204094c6.js → type-guard-87bdc930.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-0874e19f.js → valid-credit-card-number-rule-5dc557f1.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -6
- package/dist/esm/vega-app-footer.entry.js +20 -25
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-bar-chart.entry.js +2 -2
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +3 -3
- package/dist/esm/vega-calendar_5.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +2 -2
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-color-swatch-picker.entry.js +3 -3
- package/dist/esm/vega-color-swatch.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +8 -8
- package/dist/esm/vega-date-picker_2.entry.js +13 -13
- package/dist/esm/vega-dialog_2.entry.js +10 -5
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +7 -7
- 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 +3 -3
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +21 -12
- package/dist/esm/vega-input-credit-card.entry.js +6 -6
- package/dist/esm/vega-input-numeric.entry.js +5 -5
- package/dist/esm/vega-input-passcode.entry.js +5 -5
- package/dist/esm/vega-input-phone-number.entry.js +4 -4
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +5 -5
- package/dist/esm/vega-input.entry.js +6 -6
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-line-chart.entry.js +2 -2
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-pie-chart.entry.js +1 -1
- package/dist/esm/vega-popover_2.entry.js +8 -8
- package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
- package/dist/esm/vega-radio_2.entry.js +5 -5
- package/dist/esm/vega-rich-text-bookmark-editor.entry.js +2 -2
- package/dist/esm/vega-rich-text-content.entry.js +6 -6
- package/dist/esm/vega-rich-text-editor_4.entry.js +63 -19
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +1 -1
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
- package/dist/esm/vega-selection-chip_2.entry.js +4 -4
- package/dist/esm/vega-selection-tile_2.entry.js +2 -2
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-tab-group_2.entry.js +6 -6
- package/dist/esm/vega-table_11.entry.js +4 -4
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +9 -9
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +6 -6
- package/dist/esm/vega.js +12 -12
- package/dist/esm/{y-axis-input-processor-c6b2a914.js → y-axis-input-processor-dd574c2e.js} +1 -1
- package/dist/sri/vega-sri-manifest.json +339 -339
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +14 -12
- package/dist/types/components/vega-dialog/vega-dialog.d.ts +2 -0
- package/dist/types/components/vega-image-uploader/slimmers/controllers/vega-image-uploader-remove-controller.d.ts +1 -0
- package/dist/types/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-actions-renderer.d.ts +1 -0
- package/dist/types/components/vega-image-uploader/slimmers/renderers/vega-image-uploader-uploading-content-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +3 -2
- package/dist/types/components.d.ts +26 -22
- package/dist/types/constants/misc.d.ts +0 -2
- package/dist/types/helpers/slimmers/form/form-field-controller-slimmer.d.ts +7 -0
- package/dist/types/helpers/translation/interface.d.ts +4 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-64eb05d3.entry.js → p-017f0314.entry.js} +1 -1
- package/dist/vega/{p-8de29082.entry.js → p-09c5aae6.entry.js} +1 -1
- package/dist/vega/p-0a8e82f1.js +1 -0
- package/dist/vega/{p-76f4fdba.entry.js → p-0c8f8d88.entry.js} +1 -1
- package/dist/vega/{p-2ff659a1.entry.js → p-0cd81963.entry.js} +1 -1
- package/dist/vega/{p-0169f71c.entry.js → p-0cda0b10.entry.js} +1 -1
- package/dist/vega/{p-4043508a.js → p-146abbc7.js} +1 -1
- package/dist/vega/{p-9a96fb05.entry.js → p-185a24ed.entry.js} +1 -1
- package/dist/vega/{p-dcfce26e.entry.js → p-1acaccd6.entry.js} +1 -1
- package/dist/vega/{p-9fcfd738.js → p-1c7dc9c6.js} +1 -1
- package/dist/vega/{p-ebe1dd2b.entry.js → p-1ccf0a96.entry.js} +1 -1
- package/dist/vega/{p-0b33753f.entry.js → p-1f0b99ac.entry.js} +1 -1
- package/dist/vega/{p-d5a75228.js → p-24b6f3ee.js} +1 -1
- package/dist/vega/p-25d8b416.js +1 -0
- package/dist/vega/{p-8e59606f.entry.js → p-27c0c41f.entry.js} +1 -1
- package/dist/vega/{p-3283fa2f.js → p-2a501c55.js} +1 -1
- package/dist/vega/p-2dbdd1bf.entry.js +1 -0
- package/dist/vega/p-2e847194.js +1 -0
- package/dist/vega/{p-f9d09b0c.js → p-3040c091.js} +1 -1
- package/dist/vega/{p-e6b0a292.entry.js → p-313ccf96.entry.js} +1 -1
- package/dist/vega/{p-17f6dc94.entry.js → p-3437ff39.entry.js} +1 -1
- package/dist/vega/p-347d664e.js +1 -0
- package/dist/vega/{p-322da1eb.entry.js → p-377a5330.entry.js} +1 -1
- package/dist/vega/{p-08bf08d2.js → p-37eb020f.js} +1 -1
- package/dist/vega/p-3831f00d.entry.js +1 -0
- package/dist/vega/{p-1f1f93bf.entry.js → p-3a153581.entry.js} +1 -1
- package/dist/vega/p-46d34326.js +1 -0
- package/dist/vega/p-4a2e040f.entry.js +1 -0
- package/dist/vega/{p-6e16bb3a.js → p-4ad6da8f.js} +1 -1
- package/dist/vega/{p-8ac0b1b2.entry.js → p-4b5591fb.entry.js} +1 -1
- package/dist/vega/{p-b3a1cd22.js → p-4cd198b9.js} +1 -1
- package/dist/vega/{p-ba67eb96.js → p-4f24f262.js} +1 -1
- package/dist/vega/{p-1b2e5898.js → p-53c1b195.js} +1 -1
- package/dist/vega/{p-cb68a43a.entry.js → p-54c21aa8.entry.js} +1 -1
- package/dist/vega/{p-cc9fc36a.entry.js → p-568d4da6.entry.js} +1 -1
- package/dist/vega/{p-7874055b.entry.js → p-593a4af3.entry.js} +1 -1
- package/dist/vega/{p-eb945d34.entry.js → p-5a60c1ed.entry.js} +1 -1
- package/dist/vega/{p-28acbe42.entry.js → p-5bdc1ff3.entry.js} +1 -1
- package/dist/vega/{p-92411f56.entry.js → p-5ccdfd46.entry.js} +1 -1
- package/dist/vega/{p-2171b571.entry.js → p-5cd6b840.entry.js} +1 -1
- package/dist/vega/{p-f981cf2c.js → p-5cfe82e7.js} +1 -1
- package/dist/vega/{p-e5fc6583.entry.js → p-5f04fb23.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-5f589bdb.entry.js +1 -0
- package/dist/vega/{p-df9585f6.js → p-68e70f75.js} +1 -1
- package/dist/vega/{p-608d3559.entry.js → p-6902bcaf.entry.js} +1 -1
- package/dist/vega/{p-3b911043.entry.js → p-6b2da3bc.entry.js} +1 -1
- package/dist/vega/{p-69eadbd8.entry.js → p-6c0d4f69.entry.js} +1 -1
- package/dist/vega/{p-7f9ad7bc.js → p-6c46ea86.js} +1 -1
- package/dist/vega/{p-6096ffc3.js → p-6d0947e2.js} +1 -1
- package/dist/vega/{p-36b795c6.entry.js → p-6ec65f72.entry.js} +1 -1
- package/dist/vega/{p-94d65dcf.entry.js → p-701ac71a.entry.js} +1 -1
- package/dist/vega/p-70a08fe5.js +1 -0
- package/dist/vega/{p-ba050d63.entry.js → p-776123f8.entry.js} +1 -1
- package/dist/vega/{p-261cf764.js → p-78a2802f.js} +1 -1
- package/dist/vega/{p-c7ec97d1.entry.js → p-7e262cb3.entry.js} +1 -1
- package/dist/vega/{p-fee080b9.entry.js → p-8a303571.entry.js} +1 -1
- package/dist/vega/{p-fdbdf12f.js → p-8e3c1c81.js} +1 -1
- package/dist/vega/{p-7d3d24f6.entry.js → p-8e59892d.entry.js} +1 -1
- package/dist/vega/{p-564110ba.entry.js → p-9960ffde.entry.js} +1 -1
- package/dist/vega/{p-e84c2589.js → p-9b571551.js} +1 -1
- package/dist/vega/{p-c08ac33f.entry.js → p-9e51b1a8.entry.js} +1 -1
- package/dist/vega/{p-1a4d1991.entry.js → p-a222639f.entry.js} +1 -1
- package/dist/vega/{p-6c4edee8.entry.js → p-a50b8c9f.entry.js} +1 -1
- package/dist/vega/{p-8c61db9d.entry.js → p-a54a2def.entry.js} +1 -1
- package/dist/vega/{p-e33a954f.js → p-a6346186.js} +1 -1
- package/dist/vega/{p-b63a90b3.entry.js → p-a6467be2.entry.js} +1 -1
- package/dist/vega/p-a7ed55d8.js +1 -0
- package/dist/vega/{p-3567dc55.entry.js → p-afa8a9af.entry.js} +1 -1
- package/dist/vega/{p-9153c2f5.entry.js → p-b015a970.entry.js} +1 -1
- package/dist/vega/p-b4e4b938.entry.js +1 -0
- package/dist/vega/{p-e2c8a470.entry.js → p-b63af0ae.entry.js} +1 -1
- package/dist/vega/{p-ade903b3.entry.js → p-ba971f6a.entry.js} +1 -1
- package/dist/vega/{p-dc83fa6b.entry.js → p-bc8bc41e.entry.js} +1 -1
- package/dist/vega/{p-ac98c189.entry.js → p-c07039d8.entry.js} +1 -1
- package/dist/vega/{p-3b4e2ba0.js → p-c0eddde0.js} +1 -1
- package/dist/vega/{p-abe5f7f0.entry.js → p-c26c979f.entry.js} +1 -1
- package/dist/vega/{p-1fb953f8.js → p-c576f76b.js} +1 -1
- package/dist/vega/{p-8193f4ef.entry.js → p-c6cfaa2f.entry.js} +1 -1
- package/dist/vega/{p-a60d75d9.js → p-c73cce9b.js} +1 -1
- package/dist/vega/{p-ca1fe571.entry.js → p-c75c14e4.entry.js} +1 -1
- package/dist/vega/{p-8197d172.entry.js → p-c8c2e940.entry.js} +1 -1
- package/dist/vega/{p-f818bb20.entry.js → p-c968f8cf.entry.js} +1 -1
- package/dist/vega/{p-2fc2299f.js → p-cef58d27.js} +1 -1
- package/dist/vega/{p-27e77ea1.entry.js → p-d1b8fb1d.entry.js} +1 -1
- package/dist/vega/p-d5ab92a5.entry.js +1 -0
- package/dist/vega/{p-d044d54f.entry.js → p-d9c2aa77.entry.js} +1 -1
- package/dist/vega/{p-1537b1e4.js → p-da94bcda.js} +1 -1
- package/dist/vega/{p-66bf209b.entry.js → p-dcf4f31f.entry.js} +1 -1
- package/dist/vega/{p-4503f5b9.entry.js → p-e11987d3.entry.js} +1 -1
- package/dist/vega/{p-a2dcde12.js → p-e1aa78db.js} +1 -1
- package/dist/vega/{p-8ea41806.js → p-e2168481.js} +1 -1
- package/dist/vega/{p-018bb83b.entry.js → p-e22a00ec.entry.js} +1 -1
- package/dist/vega/{p-4e4b50f3.entry.js → p-e67ef7a1.entry.js} +1 -1
- package/dist/vega/{p-4cdc064d.entry.js → p-ee2bd1e8.entry.js} +1 -1
- package/dist/vega/{p-45af801f.js → p-f2193656.js} +1 -1
- package/dist/vega/{p-a2c7a3bc.js → p-fc07ed1e.js} +1 -1
- package/dist/vega/{p-3e270b65.entry.js → p-fdb6f4f0.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-255fe20b.js +0 -1
- package/dist/vega/p-2acc600a.entry.js +0 -1
- package/dist/vega/p-37714a3a.js +0 -1
- package/dist/vega/p-38c551a9.entry.js +0 -1
- package/dist/vega/p-4151d4a8.js +0 -1
- package/dist/vega/p-48c2150b.entry.js +0 -1
- package/dist/vega/p-4b253f74.entry.js +0 -1
- package/dist/vega/p-7b9ed949.js +0 -1
- package/dist/vega/p-9a0e17b2.entry.js +0 -1
- package/dist/vega/p-a9fc4043.js +0 -1
- package/dist/vega/p-affb40e8.js +0 -1
- package/dist/vega/p-d3a9355c.entry.js +0 -1
- package/dist/vega/p-e668cf11.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-36a57431.js";import{e as n,f as s}from"./p-53e3f259.js";import{d as r,c as i}from"./p-02841589.js";import{L as o}from"./p-6e1ab235.js";import{i as a}from"./p-fdbdf12f.js";import{T as c}from"./p-b438e68b.js";import{D as l}from"./p-5c285374.js";import{g as u}from"./p-8b5d3a52.js";import{V as h}from"./p-d1f47512.js";import{c as d}from"./p-a841cf13.js";import{f}from"./p-aa135628.js";var p,g;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(p||(p={}));class w{get isFormattingOnly(){return!1}}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(g||(g={}));class m extends w{}const A=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 n=this.rootDomToContentEntity.get(t);n&&n!==e&&this.contentEntityToRootDom.delete(n),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.typeName}};var x;!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.NEST_LIST_ITEMS="NEST_LIST_ITEMS",t.UNNEST_LIST_ITEMS="UNNEST_LIST_ITEMS",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",t.DELETE_SELECTED_CONTENT="DELETE_SELECTED_CONTENT",t.SEQUENTIAL_COMPOSITION="SEQUENTIAL_COMPOSITION"}(x||(x={}));class S{constructor(){this.isFlushable=!1}}function y(t){const e={},n=t.getAttribute("style");if(!n)return e;const s=function(t){const e=[];let n="",s=0;for(let r=0;r<t.length;r++){const i=t[r];"("===i?(s++,n+=i):")"===i?(s--,n+=i):";"===i&&0===s?(e.push(n),n=""):n+=i}return n&&e.push(n),e}(n);for(const t of s){const n=t.trim(),s=n.indexOf(":"),i=n.substring(0,s).trim(),o=n.substring(s+1).trim();e[r(i)]=o}return e}function O(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function T(t){return O(t).replace(/"/g,""").replace(/'/g,"'")}function E(t){return t.replace(/&(?!(?:[a-zA-Z][a-zA-Z0-9]+|#[0-9]+|#x[a-fA-F0-9]+);)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function v(t){return t.replace(/\r\n?/g,"\n").split("\n")}const N="",b="";function C(t,e=!1){return v(t).map((t=>{const n=t.includes("")||t.includes("")?t:t.trim();return e?function(t){return t.split("").join(" ").split("").join("\t")}(n):n}))}function L(t){return t.map((t=>`<p>${T(t)}</p>`)).join("")}class k{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,n){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=y(t),n=Object.assign(Object.assign({},this.stylesToBeFiltered),e),s=Object.entries(Object.assign({},n)).map((([t,e])=>`${i(t)}: ${e};`)).join("");t.setAttribute("style",s)}canFilter(t){return!1}canRefill(t,e){return!1}toCssText(){return""}get alwaysFilter(){return!1}extractAndDeleteMatchedStyles(t){let e=!1;const n=this.stylesToBeFiltered;if(t&&n){const s=Object.keys(n);for(const r of s)t[r]===n[r]&&(delete t[r],e=!0)}return e}buildCssTextForStyles(t,e){return`${`.${k.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 n=t.getStyles({standalone:!0});return this.isMatchFilterStyles(n,e)}isMatchFilterStyles(t,e){return(e&&e.length>0?e:Object.keys(this.stylesToBeFiltered)).every((e=>t[e]===this.stylesToBeFiltered[e]))}}var R,j,_;k.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"}(R||(R={}));class $ extends w{}class I{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.typeName)&&!!t.getAnnotationByType(R.LINK)}static isCodeNode(t){if(this.isTextNode(t.typeName)){const e=t.getAnnotationByType(R.CODE);return!!e&&e.code}return!1}static isImageNode(t){return"RTEImageNode"===t.typeName}static isCodeBlockNode(t){return"RTECodeBlockNode"===t.typeName}}I.RTE_TEXT_NODE_CLASS_NAME="RTETextNode",I.RTE_TEXT_BLOCK_CLASS_NAME="RTETextBlock";class B extends k{constructor(){super(...arguments),this.stylesToBeFiltered=D.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 I.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,n=t.class?t.class.split(" "):[],s=this.filterAndDeleteStyles(e,n);return s.styles&&Object.keys(s.styles).length>0&&(t.style=s.styles),s.classNames&&s.classNames.length>0&&(t.class=s.classNames.join(" ")),t.style&&0===Object.keys(t.style).length&&delete t.style,t}}class D extends w{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 D("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){let n=this.toJsx(t,e);return(null==e?void 0:e.filterInlineStyles)&&(n=D.linkGroupFilterStylesStrategy.filterLinkGroupInlineStyles(n)),Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${i(t)}="${n}"`})).join(" ")}toJsx(t,e){const n=this.getStyle(t,e),s=this.getClass(t,e),r=this.getAttribute(t);return s.length>0&&(r.class=s.join(" ")),n&&Object.keys(n).length>0&&(r.style=n),r}getClass(t,e){const n=[];return t.link.customClass&&n.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&n.push("v-rte--link"),n}getStyle(t,e){const n={};return t.link.customStyle&&Object.assign(n,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&Object.assign(n,D.getDefaultStyles()),n}getAttribute(t){const{href:e,customAttribute:n={}}=t.link,s=t.useInternalStyle,r=(null==e?void 0:e.startsWith("#"))?"_self":n.target||(s?"_blank":"");return Object.assign(Object.assign(Object.assign({},n),e||s?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}}D.linkGroupFilterStylesStrategy=new B;class M extends m{constructor(t){super(),this.type=g.ALIGNMENT,this.textAlign=t}static from(t){return[g.ALIGNMENT,new M(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 M(this.textAlign)}renderStyle(t){return(null==t?void 0:t.standalone)?M.getDefaultStyles(this.textAlign):null}}class F extends m{constructor(t){super(),this.type=g.INDENT,this.indent=Math.max(0,t)}static from(t){return[g.INDENT,new F(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new F(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class P{static register(t,e,n){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(n)}static unregister(t,e,n){const s=this.registry.get(e);if(s){const e=s.get(t);e&&e.delete(n)}}static get(t,e){const n=t instanceof S?t.type:t.typeName,s=this.registry.get(e.typeName);if(s){const r=s.get(n);if(r&&r.size>0)return Array.from(r).find((n=>n.canIntercept(t,e)))}}}P.registry=new Map;class H{static register(t,e,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n)}static unregister(t,e){const n=this.registry.get(e);n&&n.delete(t)}static get(t,e){const n=this.registry.get(e);if(n)return n.get(t)}static executeTheStrategy(t,e){const n=P.get(t,e),s=()=>{const n=t instanceof S?t.type:t.typeName,s=H.get(n,e.typeName);if(s)return t.executedFlag=!0,s.execute(t,e);o.warn(`Type ${n} action handle strategy is not registered in class ${e.typeName}`)};return n?n.intercept(s,t,e):s()}static canHandle(t,e){return!!H.get(t,e.typeName)}}H.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(j||(j={}));class J extends w{}class K extends J{constructor(t){super(),this.type=j.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[j.CUSTOM_ATTRIBUTE,new K(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new K(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(a)}render(t={}){var e;const n=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete n[t])),Object.keys(n).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===n[t]&&(n[t]="true")})),n}}class U extends J{constructor(t){super(),this.type=j.CUSTOM_CLASS,this.customClass=t}static from(t){return[j.CUSTOM_CLASS,new U(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new U(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class G extends J{constructor(t){super(),this.type=j.CUSTOM_STYLE,this.customStyle=t}static from(t){return[j.CUSTOM_STYLE,new G(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new G(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="${E(Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" "))}"`}}class z extends m{constructor(t){super(),this.type=g.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[g.INTERNAL_WRAPPER,new z(t)]}clone(){return new z(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class W{constructor(t){this.dtoName=t instanceof Y?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,n){return n=n||this.toJSON(t,e),Object.entries(Object.assign({},n)).map((([t,e])=>`${i(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const n=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof G)).map((e=>e.renderStyle(t))).filter(a);return e&&e.length>0?this.mergeAnnotationStyles(n,e):n.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoName?t instanceof m:t instanceof $}mergeAnnotationStyles(t,e){const n={};for(const s of t)for(const t in s){const r=s[t],i=n[t];n[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return n}}class V{static register(t,e){var n;const s=null!==(n=this.registry.get(t))&&void 0!==n?n:new Set;s.add(e),this.registry.set(t,s)}static getStrategies(t){var e;return Array.from(null!==(e=this.registry.get(t))&&void 0!==e?e:[])}static executeTheStrategyFilterAction(t,e,n){return this.getStrategies(t.typeName).filter((e=>e.canFilter(t))).reduce(((e,n)=>n.filterAndDeleteStyles(e.styles,e.classNames,t)),{styles:e,classNames:n})}static executeTheStrategyRefillAction(t,e){this.getStrategies(t).filter((n=>n.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(c).map((t=>`@import url('${c[t].url}');\n`)).join(" ")),e.push("/* Font-face imports end */\n")),this.registry.forEach((t=>{t.forEach((t=>{const n=t.toCssText();n&&!e.includes(n)&&e.push(n)}))})),e.join(" ")}}V.registry=new Map,function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(_||(_={}));class X extends l{constructor(t,e){super(),this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.typeName}.from(${JSON.stringify(t)}, ${e}, ${n}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return K.from(e);case"customClass":return U.from(e);case"customStyle":return G.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 W(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof $||t instanceof U)).map((e=>e.renderClass(t))).filter(a).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(j.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getPlainText(){return""}getElementRef(){return A.getDOMByEntity(this)}generateAttributeString(t,...e){var n;const s=new W(this),r=s.toJSON({standalone:!0},["textDecoration"]),i=this.annotationMap.get(j.CUSTOM_CLASS);let o=r,c=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=V.executeTheStrategyFilterAction(this,r,c);o=t.styles,c=t.classNames}const l=[...(null===(n=this.getCustomAttributesAnnotation())||void 0===n?void 0:n.toString(e))||[],c&&c.length>0?`class="${c.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${E(s.toCssText({standalone:!0},void 0,o))}"`:null,...e].filter(a);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof S?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}X.typeName="RTENode";const q=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 Y)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof X))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 Y extends l{constructor(t){super(),this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.typeName}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,n){return t.map((t=>{const s=q.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(a)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return M.from(e);case"indent":return F.from(e);case"customAttribute":return K.from(e);case"customClass":return U.from(e);case"customStyle":return G.from(e);case"internalWrapper":return z.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);a(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(g.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof D||t instanceof z))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof m||t instanceof J)).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(s){if(this.doApply(s),s.isFlushable){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}allowsCaretDescend(){return!0}getFirstNode(){if(!this.children||!this.children[0])return null;const t=this.children[0];return t instanceof Y?t.getFirstNode():t}getPlainText(){var t;return(null!==(t=this.children)&&void 0!==t?t:[]).map((t=>t.getPlainText())).join("")}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new W(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 m||t instanceof U)).map((e=>e.renderClass(t))).filter(a).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(j.CUSTOM_ATTRIBUTE)}generateAttributeString(t,...e){var n;const s=new W(this),r=s.toJSON({standalone:!0}),i=this.annotationMap.get(j.CUSTOM_CLASS);let o=r,c=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=V.executeTheStrategyFilterAction(this,r,c);o=t.styles,c=t.classNames}const l=[...(null===(n=this.getCustomAttributesAnnotation())||void 0===n?void 0:n.toString(e))||[],c&&c.length>0?`class="${c.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${E(s.toCssText({standalone:!0},void 0,o))}"`:null,...e].filter(a);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof S?H.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();if(e instanceof D||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply)this.doAnnotationActionApply(t);else{const e=H.get(t.typeName,this.typeName);e&&e.execute(t,this)}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}Y.typeName="RTEBlock";class Z extends S{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}const Q="500",tt={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},et=Object.assign(Object.assign({},tt),{marginTop:"0px",marginBottom:"0px"}),nt={paragraph:et,title:Object.assign(Object.assign({},tt),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"}),subtitle:Object.assign(Object.assign({},tt),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"}),"heading-1":Object.assign(Object.assign({},et),{fontSize:"22px",lineHeight:"24px",minHeight:"24px"}),"heading-2":Object.assign(Object.assign({},et),{fontSize:"20px",lineHeight:"24px",minHeight:"24px"}),"heading-3":Object.assign(Object.assign({},et),{fontSize:"18px"}),"heading-4":Object.assign({},et),"heading-5":Object.assign(Object.assign({},et),{fontSize:"14px"}),"heading-6":Object.assign(Object.assign({},et),{fontSize:"12px"})};class st extends m{constructor(t){super(),this.type=g.TEXT_STYLE,this.textStyle=t}static from(t){return[g.TEXT_STYLE,new st(t)]}static getDefaultStyles(t){return t?nt[t]:null}toJSON(){return{textStyle:this.textStyle}}clone(){return new st(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?st.getDefaultStyles(this.textStyle):null}}class rt extends l{}rt.typeName="AnnotationAction";class it extends rt{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new st(this.textStyle)}}it.typeName="TextStyleAnnotationAction";class ot extends ${constructor(t,e=!0){super(),this.type=R.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[R.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 at extends rt{constructor(){super(...arguments),this.doSplit=!0}}at.typeName="TextSplittableAction";class ct extends at{constructor({link:t,newText:e,needMergeNode:n,doSplit:s,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=n,this.newText=e,this.type=r,a(s)&&(this.doSplit=s)}toAnnotation(){return new ot(this.link)}}ct.typeName="LinkAnnotationAction";class lt extends rt{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new D(this.groupKey)}}lt.typeName="LinkGroupAnnotationAction";const ut="700",ht="bold",dt="italic",ft="underline",pt="line-through";class gt extends ${constructor(t){super(),this.type=R.BOLD,this.bold=t}static from(t){return[R.BOLD,new gt(t)]}get isFormattingOnly(){return!0}toJSON(){return{bold:this.bold}}clone(){return new gt(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 wt extends at{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new gt(this.bold)}}wt.typeName="BoldAnnotationAction";class mt extends rt{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}mt.typeName="DeleteNodeAnnotationAction";class At{execute(t,e){return o.log(`Executing action ${t instanceof S?t.type:t.typeName} on ${e.typeName} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(j.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new G(n.removeStyles(e)))}createNewParagraph(t){const e=q.getRTEBlockClass("paragraph");if(e)return e.from({id:u(),type:"paragraph",nodes:[{id:u(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.typeName?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,n){return e===t.children[0]&&0===n}isCaretPositionAtBlockEnd(t,e,n){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,n):this.isCaretPositionAtDecoratorBlockEnd(t,e,n)}getDOMByEntity(t){return A.getDOMByEntity(t)}isCaretPositionAtTextBlockEnd(t,e,n){const s=t.children[t.children.length-1];return e===s&&(e.isEmpty()||n===s.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,n){return e===t.children[t.children.length-1]&&0!==n}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class xt extends At{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new wt(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new mt(R.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class St extends S{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class yt extends S{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Ot extends At{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,n){if(t){const s=t.text.slice(0,e),r=t.text.slice(e),i=n.children.indexOf(t);if(i>-1){const o=n.children.slice(0,i),a=n.children.slice(i+1);t.isContentEditable()?(s&&o.push(t.cloneWithText(s)),r&&a.unshift(t.cloneWithText(r))):e>0?o.push(t):a.unshift(t),n.apply(new yt(o));const c=n.cloneWithNodes(a);return n.parent.apply(new St(n,c)),c}}}}class Tt extends At{handleAction(t,e){e.children=[],e.apply(new Z(t.newChildNodes))}}class Et extends S{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class vt extends w{constructor(t){super(),this.type=p.SELECTION_RANGE,this.range=t}get isFormattingOnly(){return!0}clone(){return new vt(this.range)}}class Nt extends ${constructor(t){super(),this.type=R.STRIKETHROUGH,this.strikethrough=t}static from(t){return[R.STRIKETHROUGH,new Nt(t)]}get isFormattingOnly(){return!0}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new Nt(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 bt extends ${constructor(t){super(),this.type=R.UNDERLINE,this.underline=t}static from(t){return[R.UNDERLINE,new bt(t)]}get isFormattingOnly(){return!0}toJSON(){return{underline:this.underline}}clone(){return new bt(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 Ct extends ${constructor(t){super(),this.type=R.ITALIC,this.italic=t}static from(t){return[R.ITALIC,new Ct(t)]}get isFormattingOnly(){return!0}toJSON(){return{italic:this.italic}}clone(){return new Ct(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 Lt extends ${constructor(t,e=!0){super(),this.type=R.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[R.CODE,new Lt(t,e)]}static getDefaultStyles(){return{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}}get isFormattingOnly(){return!0}toJSON(){return{code:this.code}}clone(){return new Lt(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?Lt.getDefaultStyles():null}}const kt={key:"black",light:"#111128",dark:"#E3E3E8"},Rt=[kt,{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"}],jt="";var _t;!function(t){t.Default="default",t.Composition="composition"}(_t||(_t={}));const $t="__updateSource",It=[{key:"title"},{key:"subtitle"},{key:"heading-1"},{key:"heading-2"},{key:"heading-3"},{key:"paragraph"}],Bt=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]],Dt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Mt=22,Ft="url",Pt="email",Ht=["url","email"],Jt="data-vega-rte-block-boundary",Kt="application/x-vega-rte-paste-mode",Ut="application/x-vega-rte-preserved-whitespace",Gt="word",zt="rte-word-count",Wt="plain";class Vt extends ${constructor(t){super(),this.type=R.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[R.TEXT_COLOR,new Vt(t)]}get isFormattingOnly(){return!0}toJSON(){return{textColor:this.textColor.key}}clone(){return new Vt(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:h.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return Rt.find((e=>e.key===t))||Rt[0]}}class Xt extends rt{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}Xt.typeName="SyncUpSelectionAction";class qt extends S{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Yt extends At{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(p.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof at&&t.doSplit&&n){const{startContainer:t,endContainer:s,startOffset:r,endOffset:i}=n.range,o=t===s&&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(n.range)&&e.isContentEditable()){const s=this.splitTextNode(n.range,e);return t.annotationMap.has("LINK")&&t.apply(new qt(s)),s}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const n=e.cloneWithText("");this.setApplyTargetNode(n);const s=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===s?[n,e]:t===e.text.length||!e.isContentEditable()&&t===s+1?[e,n]:[e.cloneWithText(e.text.substring(0,t)),n,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:n,startOffset:s,endOffset:r}=t;return e!==n||s>0||r<(n.textContent?n.textContent.length:0)}splitTextNode(t,e){const{startContainer:n,endContainer:s,startOffset:r}=t,i=n.parentElement,o=s.parentElement,a=(t,n,s)=>{const r=t.substring(0,n),i=t.substring(n,s),o=t.substring(s);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},c=i&&A.getEntityByDOM(i),l=o&&A.getEntityByDOM(o);if(c&&c.id===e.id){const i=n===s?t.endOffset:e.text.length,[o,c,l]=a(e.text,r,i);return this.setApplyTargetNode(c),[o,c,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[n,s,r]=a(e.text,0,t.endOffset);return this.setApplyTargetNode(s),[n,s,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Zt extends w{constructor(){super(...arguments),this.type=p.CLEAR_FORMATTING,this.items=[R.BOLD,R.ITALIC,R.UNDERLINE,R.STRIKETHROUGH,R.TEXT_COLOR,R.CODE,j.CUSTOM_STYLE]}}class Qt extends at{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Zt}}Qt.typeName="ClearFormattingAnnotationAction";class te extends at{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new Lt(this.code)}}te.typeName="CodeAnnotationAction";class ee extends at{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new Ct(this.italic)}}ee.typeName="ItalicAnnotationAction";class ne extends at{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new Nt(this.strikethrough)}}ne.typeName="StrikethroughAnnotationAction";class se extends at{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new bt(this.underline)}}se.typeName="UnderlineAnnotationAction";class re extends At{handleAction(t,e){const n=t.toAnnotation();if(t instanceof mt)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof Zt))return n instanceof $||n instanceof vt?(t instanceof ct&&(a(t.newText)&&(e.text=t.newText),e.parent.apply(new lt(t.link.groupKey,[e],t.type))),t instanceof te&&this.handleAction(new Qt,e),t instanceof wt&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof ee&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof se||t instanceof ne)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class ie extends S{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class oe extends At{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new ie)}}class ae extends S{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class ce extends At{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,n){if(e&&e.startContainer&&e.endContainer){const{startContainer:s,endContainer:r,startOffset:i,endOffset:o}=e;let a=n.text;if(s===r&&i===o&&t)a=n.text.slice(0,i)+t+n.text.slice(i);else{const e=s.parentElement,c=r.parentElement,l=e&&A.getEntityByDOM(e),u=c&&A.getEntityByDOM(c);let h=0,d=n.text.length;l&&l===n?(h=i,d=s===r?o:d):u&&u===n&&(d=o),a=n.text.slice(0,h)+t+n.text.slice(d)}n.apply(new ae(a))}}}class le extends w{constructor(t){super(),this.type=R.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new le(e);return o.groupId=t.groupId,o.child=n?le.from(n)[1]:void 0,o.customAttribute=i?K.from(i)[1]:void 0,o.customClass=r?U.from(r)[1]:void 0,o.customStyle=s?G.from(s)[1]:void 0,[R.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new le(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===(n=this.customClass)||void 0===n?void 0:n.clone(),r.customStyle=null===(s=this.customStyle)||void 0===s?void 0:s.clone(),r}renderProps(){var t,e,n;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===(n=this.customClass)||void 0===n?void 0:n.renderClass().join(" ")})}toJSON(){var t,e,n,s;return{inlineHtml:d({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===(n=this.customClass)||void 0===n?void 0:n.toJSON().customClass,customStyle:null===(s=this.customStyle)||void 0===s?void 0:s.toJSON().customStyle})}}}class ue extends At{handleAction(t,e){const n=e.parent.getAnnotationByType(p.LINK_GROUP);if(n){const s=e.annotationMap.get("LINK").link.groupKey,r=n.linkGroups.get(s);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),n.linkGroups.set(s,r))}}}}class he extends At{handleAction(t,e){const n=e.parent.getAnnotationByType(p.LINK_GROUP);if(n){const t=e.annotationMap.get(R.LINK).link.groupKey,s=n.linkGroups.get(t);if(s){const r=s.indexOf(e);-1!==r&&s.splice(r,1),0===s.length&&n.linkGroups.delete(t),0===n.linkGroups.size&&e.parent.annotationMap.delete(p.LINK_GROUP)}}e.annotationMap.delete(R.LINK)}}class de extends ${constructor(t){super(),this.type=R.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[R.PLAIN_TEXT,new de(t)]}get isFormattingOnly(){return!0}clone(){return new de(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return this.plainText?{plainText:this.plainText}:void 0}}class fe extends at{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new Vt(this.textColor)}}fe.typeName="TextColorAnnotationAction";class pe extends X{constructor(t,e,n,s){super(t,s),this.type=_.TEXT,this.parent=n,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,n={autoMatchFormat:!0}){const s=new pe(t.id,t.text,e),{annotations:r}=t;return r&&(s.annotationMap=this.generateTextAnnotationMap(r,n,e,s)),s}static generateTextAnnotationMap(t,e,n,s){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&n&&s&&n.apply(new lt(t.link.groupKey,[s],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(a))}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return gt.from(e);case"italic":return Ct.from(e);case"underline":return bt.from(e);case"strikethrough":return Nt.from(e);case"code":return Lt.from(e,s);case"textColor":return Vt.from(e);case"link":return ot.from(e,s);case"inlineHtml":return le.from(e);case"plainText":return de.from(e)}return X.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof $||t instanceof J||t instanceof le)).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(R.INLINE_HTML);return e?this.renderWithWrapperStr(e,t):this.renderTextStr(t)}cloneWithText(t){return new pe(u(),t,this.parent,super.cloneAnnotations())}clone(t){return new pe(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!(this.getAnnotationByType(R.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}getPlainText(){return this.text}getInlineHtmlTagAtDepth(t){const e=this.getInlineHtmlAnnotationAtDepth(t);return e?Dt.has(e.htmlTag)?null:{htmlTag:e.htmlTag,attrStr:this.annotationAttrStr(e),groupId:e.groupId,annotation:e}:null}renderHtmlFromDepth(t,e){if(0===t)return this.toHtml(e);const n=this.getInlineHtmlAnnotationAtDepth(t);return n?this.renderWithWrapperStr(n,e):this.renderTextStr(e)}getInlineHtmlAnnotationAtDepth(t){let e=this.getAnnotationByType(R.INLINE_HTML);for(let n=0;n<t&&e;n++)e=e.child;return e}registerModifyStrategy(){const t=this.typeName;pe.registerActionStrategyStatus[t]||(this.isContentEditable()&&(H.register(x.UPDATE_TEXT,t,new oe),H.register(x.REPLACE_SELECTED_TEXT,t,new ce),H.register(x.LINK_GROUP_NODE_SPLIT,t,new ue),H.register(ct.typeName,t,new re)),H.register(at.typeName,t,new Yt),H.register(x.DELETE_LINK_GROUP,t,new he),H.register(wt.typeName,t,new re),H.register(Qt.typeName,t,new re),H.register(ee.typeName,t,new re),H.register(se.typeName,t,new re),H.register(fe.typeName,t,new re),H.register(ne.typeName,t,new re),H.register(te.typeName,t,new re),H.register(rt.typeName,t,new re),pe.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(p.SELECTION_RANGE);if(t instanceof at&&t.doSplit&&e){const e=H.get(at.typeName,this.typeName);if(e){const n=e.execute(t,this);n&&this.applyActionToNode(n,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){H.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof Xt)return void this.syncUpSelectedNodes(t);n instanceof vt||this.syncUpSelectedNodes(t);const s=H.get(e.typeName,t.typeName);if(s)return void s.execute(e,t);const r=H.get(rt.typeName,pe.typeName);r&&r.execute(e,t)}syncUpSelectedNodes(n){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,s);i&&t.notify(i,{node:n})}}renderWithWrapperStr(t,e){const{htmlTag:n,child:s}=t,r=this.annotationAttrStr(t);return s?`<${n}${r}>${this.renderWithWrapperStr(s,e)}</${n}>`:Dt.has(n)?`<${n}${r}>`:this.text?`<${n}${r}>${this.renderTextStr(e)}</${n}>`:`<${n}${r}></${n}>`}annotationAttrStr(t){const{customAttribute:e,customClass:n,customStyle:s}=t,r=[...(null==e?void 0:e.toString())||[],null==n?void 0:n.toString(),null==s?void 0:s.toString()].filter(a);return r.length>0?` ${r.join(" ")}`:""}renderTextStr(t){var e;const n=(null===(e=this.getAnnotationByType(R.CODE))||void 0===e?void 0:e.code)?"code":"span",s=super.generateAttributeString(t);return"\n"===this.text?"<br>":this.shouldSkipEmptyFormattingMarker()?"":this.shouldRenderAsPlainText()?this.text:`<${n}${s}>${"code"===n?T(this.text):this.text}</${n}>`}shouldSkipEmptyFormattingMarker(){return""===this.text&&this.annotationMap.size>0&&Array.from(this.annotationMap.values()).every((t=>t.isFormattingOnly))}shouldRenderAsPlainText(){const t=super.getAnnotationByType(R.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof $&&!(t instanceof ot)&&!(t instanceof de)||t instanceof J)).length}}pe.registerActionStrategyStatus={},pe.htmlTag="span",pe.typeName="RTETextNode";class ge extends At{handleAction(t,e){const n=t.blockNeedToBeMerged;if(e.type===n.type||"image"!==e.type&&"image"!==n.type){let t=n.children;"image"!==n.type&&(t=n.children.filter((t=>t.text))),e.apply(new Z(t)),"image"!==e.type&&this.transferLinkGroups(t,e),n.parent.apply(new Et(n))}}transferLinkGroups(t,e){t.forEach((t=>{if(!(t instanceof pe))return;const n=t.getAnnotationByType(R.LINK);n&&e.apply(new lt(n.link.groupKey,[t],"link"))}))}}class we extends At{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new pe(u(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const a=n.children.slice(0,o),c=n.children.slice(o+1);t.isContentEditable()?(r&&a.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i))):e>0?a.push(t):c.unshift(t),this.mergeLineBreakNodes(a,s,c,n)}return s}}mergeLineBreakNodes(t,e,n,s){if(0===n.length||n[0]&&""===n[0].text){const e=t[t.length-1];n.push(new pe(u(),"\n",s,e&&new Map(e.annotationMap)))}s.apply(new yt([...t,e,...n]))}}class me extends At{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new pe(u(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(n,s,r,e),s}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new Et(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new pe(u(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new yt([...t,e,...n]))}}class Ae extends S{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class xe extends S{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}function Se(t,e){const n=new Set(t.filter((t=>"RTEListItemBlock"===t.typeName)));return t.filter((t=>{if("RTEListItemBlock"!==t.typeName)return!0;let s=t.parent;for(;s.parent&&"RTEListItemBlock"===s.parent.typeName;){const r=s.parent;if(n.has(r))return t.parent.type=e,!1;s=r.parent}return!0}))}class ye extends rt{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new M(this.textAlign)}}ye.typeName="HorizontalAlignmentAnnotationAction";class Oe extends At{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class Te extends rt{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new F(this.indent)}}Te.typeName="IndentAnnotationAction";class Ee extends Y{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=Ee.isAcceptableTextStyle(e)?new Map([st.from(e)]):new Map([st.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new Ee(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(s=null===(n=t.annotations)||void 0===n?void 0:n.textStyle)&&void 0!==s?s:r.type}):t.annotations;return r.children=Ee.convertNodes(t.nodes,r,e),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static convertNodes(t,e,n){return t.map((t=>{const s=q.getRTENodeClass(t.type);if(s)return s.from(t,e,n)})).filter(a)}static createAnnotationEntity(t,e){return"textStyle"===t?st.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,n)=>{const s=e.at(-1);if(t instanceof ct&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(R.LINK),r=n.getAnnotationByType(R.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,n]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),n=super.generateAttributeString(t),s=this.getChildrenHtml(t);return super.shouldRenderAsInternalWrapper()?s:[`<${e}${n}>`,s,`</${e}>`].join("")}cloneWithNodes(t){const e=new Ee(u(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new Z(t)),e}clone(t){const e=new Ee(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){if(!this.isNotEmpty())return"<br>";const e=this.getAnnotationByType(p.LINK_GROUP);let n=this.renderGroupedNodesAtDepth(this.children,0,t);return e&&this.children.length>0&&(n=this.generateLinkHtml(e,n,t)),n}doAnnotationActionApply(t){const e=H.get(t.typeName,Ee.typeName);e&&e.execute(t,this)}renderGroupedNodesAtDepth(t,e,n){var s;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,n),i++;continue}let a=i+1;for(;a<t.length&&(null===(s=t[a].getInlineHtmlTagAtDepth(e))||void 0===s?void 0:s.groupId)===o.groupId;)a++;if(a===i+1)r+=t[i].renderHtmlFromDepth(e,n);else{const s=this.renderGroupedNodesAtDepth(t.slice(i,a),e+1,n);r+=`<${o.htmlTag}${o.attrStr}>${s}</${o.htmlTag}>`}i=a}return r}generateLinkHtml(t,e,n){e="";let s=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(R.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(R.LINK):null;if(i){if(s.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,filterInlineStyles:null==n?void 0:n.filterInlineStyles});e+=[`<a${r?` ${r}`:""}>`,this.renderGroupedNodesAtDepth(s,0,n),"</a>"].join(""),s=[]}}else e+=this.children[r].toHtml(n)}return e}}Ee.typeName="RTETextBlock",H.register(it.typeName,Ee.typeName,new xt),H.register(ye.typeName,Ee.typeName,new Oe),H.register(Te.typeName,Ee.typeName,new class extends At{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),H.register(lt.typeName,Ee.typeName,new class extends At{handleAction(t,e){let n=e.getAnnotationByType(p.LINK_GROUP);if("update_link"===t.type){if(n){const e=n.linkGroups.get(t.groupKey);e&&n.linkGroups.set(t.groupKey,[e[0]])}}else{if(n){const e=n.linkGroups.get(t.groupKey)||[];n.linkGroups.set(t.groupKey,[...e,...t.nodes])}else n=t.toAnnotation(),n.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(p.LINK_GROUP,n)}}}),H.register(x.UNLINK_LINK_GROUP,Ee.typeName,new class extends At{handleAction(t,e){const n=e.getAnnotationByType(p.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(p.LINK_GROUP))}}),H.register(x.SPLIT_BLOCK_WITH_NODE,Ee.typeName,new Ot),H.register(x.REPLACE_CHILD_NODES,Ee.typeName,new Tt),H.register(x.MERGE_TWO_BLOCKS_NODES,Ee.typeName,new ge),H.register(x.LINE_BREAK_SINGLE_BLOCK,Ee.typeName,new we),H.register(x.LINE_BREAK_MULTIPLE_BLOCKS,Ee.typeName,new me),H.register(x.INSERT_IMAGE_TO_BLOCK,Ee.typeName,new class extends At{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new St(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new Ae(e,r));else{const t=new xe(n,s);e.apply(t),e.parent.apply(new St(e,r))}}}),H.register(x.TRANSFORM_LIST_BLOCK,Ee.typeName,new class extends At{handleAction(t,e){const n=this.getRootContent(e);if(!n)return;const s=e.parent,r=n.createList(t.listType),i=Se(t.selectedBlocks,t.listType),o=i.map((t=>n.toListItem(t)));r.apply(new Z(o)),s.apply(new St(t.selectedBlocks[0],r)),i.forEach((t=>{t.parent.apply(new Et(t))}))}});class ve extends At{copyListAnnotations(t,e){t.annotationMap.forEach(((t,n)=>{e.annotationMap.set(n,t.clone())}))}haveSameListAnnotations(t,e){var n,s;const r=Array.from(t.annotationMap.keys()).sort(),i=Array.from(e.annotationMap.keys()).sort();return JSON.stringify(r)===JSON.stringify(i)&&JSON.stringify(this.normalizeAnnotationValue(null!==(n=t.toJSON().annotations)&&void 0!==n?n:{}))===JSON.stringify(this.normalizeAnnotationValue(null!==(s=e.toJSON().annotations)&&void 0!==s?s:{}))}normalizeAnnotationValue(t){if(Array.isArray(t))return t.map((t=>this.normalizeAnnotationValue(t)));if(t&&"object"==typeof t){const e=t;return Object.keys(e).sort().reduce(((t,n)=>(t[n]=this.normalizeAnnotationValue(e[n]),t)),{})}return t}}class Ne extends Ee{constructor(t,e,n){super(t,"list-item",n),this.nestList=[],this.nestList=e}static from(t,e={autoMatchFormat:!0}){const n=new Ne(t.id,void 0,e);n.children=Ne.convertNodes(t.nodes,n,e),t.children&&(n.nestList=t.children.map((t=>{const s=_e.from(t,e);return s.parent=n,s})));const{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);a(s)&&n.annotationMap.set(...s)})),n}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.nestList)||void 0===t?void 0:t.map((t=>t.toJSON()))})}toHtml(t){var e;const n=super.generateAttributeString(t),s=(null===(e=this.nestList)||void 0===e?void 0:e.length)?this.nestList.map((e=>e.toHtml(t))).join(""):"";return[`<li${n}>`,this.getChildrenHtml(t),s,"</li>"].join("")}cloneWithNodes(t){const e=new Ne(u());return e.children=[],e.apply(new Z(t)),e}getLastNode(){return this.nestList&&this.nestList.length>0?this.nestList[this.nestList.length-1].getLastNode():super.getLastNode()}getPlainText(){var t;const e=(null!==(t=this.nestList)&&void 0!==t?t:[]).map((t=>t.getPlainText())).join("");return super.getPlainText()+e}createNewListItem(){return new Ne(u())}clone(t){var e;const n=new Ne(this.id);return n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n.nestList=null===(e=this.nestList)||void 0===e?void 0:e.map((t=>t.clone(n))),n.parent=t,n}}Ne.typeName="RTEListItemBlock",H.register(it.typeName,Ne.typeName,new xt),H.register(ye.typeName,Ne.typeName,new Oe),H.register(x.LINE_BREAK_SINGLE_BLOCK,Ne.typeName,new we),H.register(x.LINE_BREAK_MULTIPLE_BLOCKS,Ne.typeName,new me),H.register(x.DELETE_NEST_LIST,Ne.typeName,new class extends At{handleAction(t,e){e.nestList&&(e.nestList=e.nestList.length>1?e.nestList.filter((e=>e!==t.nestListBlockToBeRemoved)):void 0)}}),H.register(x.SPLIT_BLOCK_WITH_NODE,Ne.typeName,new Ot),H.register(x.REPLACE_CHILD_NODES,Ne.typeName,new Tt),H.register(x.REPLACE_NEST_LIST,Ne.typeName,new class extends ve{handleAction(t,e){const n=this.mergeAdjacentSameType(t.newList);n.forEach((t=>{t.parent=e})),e.nestList=n}mergeAdjacentSameType(t){if(t.length<=1)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const s=e[e.length-1],r=t[n];s.type===r.type&&this.haveSameListAnnotations(s,r)?(r.children.forEach((t=>{t.parent=s})),s.children=s.children.concat(r.children)):e.push(r)}return e}}),H.register(x.MERGE_TWO_BLOCKS_NODES,Ne.typeName,new ge),H.register(x.INSERT_IMAGE_TO_BLOCK,Ne.typeName,new class extends At{handleAction(t,e){e.parent.apply(t)}});class be extends S{constructor(t){super(),this.type=x.REPLACE_NEST_LIST,this.newList=t}}class Ce extends S{constructor(t){super(),this.type=x.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}class Le extends Y{constructor(t,e){super(t),this.type="html-block",this.children=[],this.htmlTag=e}static from(t,e){const n=new Le(t.id,t.htmlTag),{annotations:s}=t;return s&&super.convertAnnotationsToMap(n.annotationMap,s),n.children=this.generateBlockChildren(t.children,e,n),n}clone(t){const e=new Le(this.id,this.htmlTag);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return!0}toHtml(t){const e=this.htmlTag,n=super.generateAttributeString(t);return Dt.has(this.htmlTag)?`<${e}${n}>`:[`<${e}${n}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,htmlTag:this.htmlTag,children:this.children.map((t=>t.toJSON()))})}}Le.typeName="RTEHtmlBlock";class ke extends At{getOrderedContiguousItems(t,e){const n=[...e].sort(((e,n)=>t.children.indexOf(e)-t.children.indexOf(n))),s=t.children.indexOf(n[0]);return s<0?[]:t.children.slice(s,s+n.length).every(((t,e)=>t===n[e]))?n:[]}}class Re extends S{constructor(t){super(),this.type=x.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class je extends m{constructor(){super(...arguments),this.type=g.LIST}static getDefaultStyles(){return{paddingLeft:"8px",marginLeft:"16px"}}static getDefaultMarkerStyles(){return{fontSize:"16px"}}renderStyle(t){return(null==t?void 0:t.standalone)?je.getDefaultStyles():null}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--list"}clone(){return new je}toJSON(){}}class _e extends Y{constructor(t,e,n){super(t),this.type="bullet-list",this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&this.annotationMap.set(g.LIST,new je)}static from(t,e={autoMatchFormat:!0}){const n=new _e(t.id,t.type,e),{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);a(s)&&n.annotationMap.set(...s)})),n.children=t.blocks.map((t=>{const s=Ne.from(t,e);return s.parent=n,s})),n}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return K.from(e);case"customClass":return U.from(e);case"customStyle":return G.from(e)}}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag();return[`<${e}${super.generateAttributeString(t)}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1].getLastNode()}clone(t){const e=new _e(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getBlockTag(){return"number-list"===this.type?"ol":"ul"}}_e.typeName="RTEListBlock",H.register(x.TRANSFORM_LIST_BLOCK,_e.typeName,new class extends ve{handleAction(t,e){var n;const s=t.selectedBlocks,r=s.every((t=>t.parent===e)),i=this.getRootContent(e);if(!i)return;if(e.parent instanceof Ne){if(r){const r=this.createListFromSource(i,e,t.listType);r.apply(new Z(e.children));const o=e.parent,a=(null!==(n=o.nestList)&&void 0!==n?n:[]).map((t=>t===e?r:t));o.apply(new be(a)),s.forEach((t=>t.children.map((t=>t.apply(new Xt)))))}else this.handleCrossListTransform(t,e);return}if(!r&&s.every((t=>t instanceof Ne))){const e=new Set(s.map((t=>t.parent))),n=new Set;e.forEach((e=>{e.type!==t.listType&&this.convertListTypeInPlace(e,t.listType)}));const r=new Set;return s.forEach((t=>{const e=t.parent;e.parent instanceof Ne||(n.add(e),r.add(e.parent))})),r.forEach((t=>{for(let e=0;e<t.children.length-1;){const s=t.children[e],r=t.children[e+1];s instanceof _e&&r instanceof _e&&s.type===r.type&&this.haveSameListAnnotations(s,r)&&n.has(s)&&n.has(r)?(s.apply(new Z([...r.children])),t.apply(new Et(r)),n.delete(r)):e++}})),void s.forEach((t=>t.children.map((t=>t.apply(new Xt)))))}const o=this.createListFromSource(i,e,t.listType),a=e.parent;if(r)o.apply(new Z(e.children)),a.apply(new St(e,o)),a.apply(new Et(e)),s.forEach((t=>t.children.map((t=>t.apply(new Xt)))));else{const n=Se(t.selectedBlocks,t.listType),s=n.map((t=>i.toListItem(t)));o.apply(new Z(s)),a.apply(new St(e,o)),n.forEach((t=>{t.parent.apply(new Et(t))})),0===e.children.length&&a.apply(new Et(e))}}convertListTypeInPlace(t,e){var n;const s=this.getRootContent(t);if(!s)return;const r=t.parent,i=this.createListFromSource(s,t,e);if(i.apply(new Z([...t.children])),r instanceof Ne){const e=(null!==(n=r.nestList)&&void 0!==n?n:[]).map((e=>e===t?i:e));r.apply(new be(e))}else r.apply(new St(t,i)),r.apply(new Et(t))}handleCrossListTransform(t,e){if(!(e.parent instanceof Ne))return;const n=this.getRootContent(e);if(!n)return;const s=e.parent,r=s.nestList,i=new Set(t.selectedBlocks.filter((t=>t instanceof Ne)).map((t=>t.parent)).filter((t=>r.includes(t))));if(!i.size)return;const o=r.map((e=>{if(!i.has(e))return e;const s=this.createListFromSource(n,e,t.listType);return s.apply(new Z(e.children)),s}));s.apply(new be(o)),t.selectedBlocks.forEach((t=>t.children.map((t=>t.apply(new Xt)))))}createListFromSource(t,e,n){const s=t.createList(n);return this.copyListAnnotations(e,s),s}}),H.register(x.TRANSFORM_PARAGRAPH_BLOCK,_e.typeName,new class extends ve{handleAction(t,e){const n=this.getSelectedSegments(t.selectedBlocks);0!==n.length&&this.hasConsistentTargetAndRoot(n,e)&&(this.syncSelection(n),[...n].reverse().forEach((t=>this.transformSegment(t))))}hasConsistentTargetAndRoot(t,e){if(t[0][0].parent!==e)return!1;const n=this.getRootContent(e);return Boolean(n&&t.every((t=>t.every((t=>this.getRootContent(t)===n)))))}syncSelection(t){t.forEach((t=>{t.forEach((t=>{t.children.forEach((t=>t.apply(new Xt)))}))}))}transformSegment(t){const e=t[0].parent,n=new Ce(t);e.parent instanceof Ne?this.handleNestedListCase(n,e):this.handleRootListCase(n,e)}handleRootListCase(t,e){const n=this.getRootContent(e);let s=!1,r=!1;const i=t.selectedBlocks,o=[];if(i.forEach((t=>{var n;t===e.children[0]&&(s=!0),t===e.children[e.children.length-1]&&(r=!0),o.push(this.toParagraph(t));for(const e of null!==(n=t.nestList)&&void 0!==n?n:[])this.appendListBlock(o,e)})),s)e.parent.apply(new Ae(e,...o));else if(r)e.parent.apply(new St(e,...o));else{const t=e.children.indexOf(i[0]),s=e.children.indexOf(i[i.length-1]),r=this.createListFromSource(n,e);r.apply(new Z(e.children.slice(0,t)));const a=this.createListFromSource(n,e);a.apply(new Z(e.children.slice(s+1)));const c=o[o.length-1];c instanceof _e&&a.children.length>0&&c.type===a.type&&this.haveSameListAnnotations(c,a)?(c.apply(new Z(a.children)),e.parent.apply(new Ae(e,r,...o))):e.parent.apply(new Ae(e,r,...o,a)),e.parent.apply(new Et(e))}if(i.map((t=>{t.nestList=[],e.apply(new Et(t))})),0===e.children.length)e.parent.apply(new Et(e));else if(s){const t=o[o.length-1];t instanceof _e&&t.type===e.type&&this.haveSameListAnnotations(t,e)&&(t.apply(new Z([...e.children])),e.parent.apply(new Et(e)))}}handleNestedListCase(t,e){const n=t.selectedBlocks,s=this.getRootContent(e),r=e.children.indexOf(n[0]),i=[];n.forEach((t=>{var e;i.push(this.toParagraph(t));for(const n of null!==(e=t.nestList)&&void 0!==e?e:[])this.appendListBlock(i,n)}));const o=e.children.indexOf(n[n.length-1]),a=e.children.slice(o+1),c=[];let l=e;for(;l.parent instanceof Ne;){const t=l.parent,e=t.parent,n=e.children.indexOf(t),s=t.nestList,r=s.indexOf(l),i=s.slice(r+1);c.push({list:e,ancestorIndex:n,trailingNestLists:i}),l=e}const u=l,h=u.parent,d=[];a.length>0&&d.push({items:a,sourceList:e});for(const t of c){for(const e of t.trailingNestLists)e.children.length>0&&d.push({items:[...e.children],sourceList:e});const e=t.list.children.slice(t.ancestorIndex+1);e.length>0&&d.push({items:e,sourceList:t.list})}const f=[];for(const t of d){const e=f[f.length-1];e&&e.sourceList.type===t.sourceList.type&&this.haveSameListAnnotations(e.sourceList,t.sourceList)?e.items.push(...t.items):f.push({items:[...t.items],sourceList:t.sourceList})}f.map((t=>{const e=this.createListFromSource(s,t.sourceList);return e.apply(new Z(t.items)),e})).forEach((t=>this.appendListBlock(i,t))),e.children=e.children.slice(0,r);const p=e.parent,g=p.nestList,w=g.indexOf(e);let m=g.slice(0,w+1);0===e.children.length&&(m=m.filter((t=>t!==e))),p.apply(new be(m));for(const t of c)if(t.list.children=t.list.children.slice(0,t.ancestorIndex+1),t.trailingNestLists.length>0){const e=t.list.children[t.ancestorIndex],n=e.nestList,s=n.indexOf(t.trailingNestLists[0]);if(s>=0){const t=n.slice(0,s);e.apply(new be(t))}}h.apply(new St(u,...i))}getSelectedSegments(t){const e=Array.from(new Set(t.filter((t=>t instanceof Ne)))).map((t=>({item:t,path:this.getStructuralPath(t)}))).filter((t=>null!==t.path)).sort(((t,e)=>this.compareStructuralPaths(t.path,e.path))).map((t=>t.item)),n=[];for(const t of e){const e=n[n.length-1],s=null==e?void 0:e[e.length-1];(null==s?void 0:s.parent)===t.parent&&t.parent.children.indexOf(t)-t.parent.children.indexOf(s)==1?e.push(t):n.push([t])}return n}getStructuralPath(t){var e;const n=[],s=new Set;let r=t,i=t.parent;for(;!s.has(i);){s.add(i);const t=i.children.indexOf(r);if(t<0)return null;if(n.unshift(t),"VegaRTEContent"===i.parent.typeName||"RTEHtmlBlock"===i.parent.typeName){const t=this.getContainerPath(i);return t?[...t,...n]:null}if(!(i.parent instanceof Ne))return null;const o=i.parent,a=(null!==(e=o.nestList)&&void 0!==e?e:[]).indexOf(i);if(a<0)return null;n.unshift(a),r=o,i=o.parent}return null}getContainerPath(t){const e=[],n=new Set;let s=t,r=t.parent;for(;r instanceof Le;){if(n.has(r))return null;n.add(r);const t=r.children.indexOf(s);if(t<0)return null;e.unshift(t),s=r,r=r.parent}const i=r.children.indexOf(s);return i<0?null:(e.unshift(i),e)}compareStructuralPaths(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++)if(t[s]!==e[s])return t[s]-e[s];return t.length-e.length}appendListBlock(t,e){const n=t[t.length-1];n instanceof _e&&n.type===e.type&&this.haveSameListAnnotations(n,e)?n.apply(new Z([...e.children])):t.push(e)}createListFromSource(t,e){const n=t.createList(e.type);return this.copyListAnnotations(e,n),n}toParagraph(t){const e=new Ee(u(),"paragraph");return e.apply(new Z(t.children)),e.annotationMap=t.annotationMap,e}}),H.register(x.INSERT_IMAGE_TO_BLOCK,_e.typeName,new class extends At{handleAction(t,e){e.parent.apply("list-item"!==e.parent.type?new St(e,t.imageBlockToBeInserted):t)}}),H.register(x.NEST_LIST_ITEMS,_e.typeName,new class extends ke{handleAction(t,e){var n,s;const r=this.getOrderedContiguousItems(e,t.selectedBlocks);if(!r.length)return;const i=e.children.indexOf(r[0]);if(i<=0)return;const o=e.children[i-1],a=new Set(r);let c=null===(n=o.nestList)||void 0===n?void 0:n[o.nestList.length-1];c||(c=new _e(u(),e.type),o.apply(new be([...null!==(s=o.nestList)&&void 0!==s?s:[],c]))),e.children=e.children.filter((t=>!a.has(t))),c.children=c.children.concat(r),r.forEach((t=>{var e;t.parent=c,(null===(e=t.nestList)||void 0===e?void 0:e.length)&&this.unifyDescendantNestLists(t,t.nestList[0].type),t.children.forEach((t=>t.apply(new Xt)))}))}unifyDescendantNestLists(t,e){var n;if(!(null===(n=t.nestList)||void 0===n?void 0:n.length))return;let s=!1;for(const n of t.nestList){n.type!==e&&(n.type=e,s=!0);for(const t of n.children)this.unifyDescendantNestLists(t,e)}s&&t.apply(new be([...t.nestList]))}}),H.register(x.UNNEST_LIST_ITEMS,_e.typeName,new class extends ke{handleAction(t,e){var n;const s=this.getOrderedContiguousItems(e,t.selectedBlocks),r=e.parent;if(!(s.length&&r instanceof Ne))return;const i=e.children.indexOf(s[0]),o=e.children.indexOf(s[s.length-1]);if(i<0||o<i)return;const a=r,c=a.parent,l=c.children.indexOf(a);if(l<0)return;const h=e.children.slice(o+1),d=new Set(s);if(e.children=e.children.filter((t=>!d.has(t))),c.children=[...c.children.slice(0,l+1),...s,...c.children.slice(l+1)],s.forEach((t=>{t.parent=c,t.children.forEach((t=>t.apply(new Xt)))})),h.length>0){const t=new Set(h);e.children=e.children.filter((e=>!t.has(e)));const r=s[s.length-1];let i=null===(n=r.nestList)||void 0===n?void 0:n[r.nestList.length-1];if(i&&i.type!==e.type&&(i=null),!i){i=new _e(u(),e.type);const t=Array.isArray(r.nestList)?r.nestList:[];r.apply(new be([...t,i]))}i.children=i.children.concat(h),h.forEach((t=>{t.parent=i}))}const f=this.collectTrailingNestLists(a,e);if(f.length>0){const t=s[s.length-1],e=Array.isArray(t.nestList)?t.nestList:[];t.apply(new be([...e,...f]))}0===e.children.length&&a.apply(new Re(e))}collectTrailingNestLists(t,e){var n;const s=null!==(n=t.nestList)&&void 0!==n?n:[],r=s.indexOf(e);if(r<0||r>=s.length-1)return[];const i=s.slice(r+1);return t.apply(new be(s.slice(0,r+1))),i}});class $e extends At{getPreviousNode(t){var e;const n=t.parent,s=n.children.indexOf(t);if(s>0)return n.children[s-1];if(n.parent){if(n.isListItemBlock()&&0===n.parent.children.indexOf(n)&&n.parent.parent instanceof Ne){const t=n.parent.parent;if(0!==(null!==(e=t.nestList)&&void 0!==e?e:[]).indexOf(n.parent)){const t=this.getPreviousBlock(n);return t?this.getBlockLastNode(t):null}const s=t.children;return s.length>0?s[s.length-1]:null}const t=this.getPreviousBlock(n);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,n=e.children.indexOf(t);if(e.children[n+1])return e.children[n+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,n=e.children.indexOf(t),s=e.parent;if(e.isListItemBlock()){const t=s.parent;return 0===n&&Array.isArray(s.children)&&s.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===s}return 0===n&&Array.isArray(s.children)&&s.children[0]===e}getPreviousBlock(t){var e;if(t.parent instanceof Ne){const n=null!==(e=t.parent.nestList)&&void 0!==e?e:[],s=n.indexOf(t);if(s>0)return n[s-1];if(0===s)return t.parent}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.typeName}}class Ie extends S{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class Be extends rt{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new vt(this.range)}}Be.typeName="SelectionChangeAction";class De extends X{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(De.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${De.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return f(t,`.${De.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}De.typeName="RTEDecoratorNode",De.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",De.DECORATOR_NODE_CLASS="v-internal-decorator-node";class Me extends k{constructor(){super(...arguments),this.stylesToBeFiltered=Me.STYLES,this.elementTagName="pre code"}canFilter(t){return I.isCodeBlockNode(t)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Me.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 Fe extends De{constructor(t,e,n,s){super(t),this.type=_.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n,this.annotationMap.set(j.CUSTOM_STYLE,new G(Me.STYLES))}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}getPlainText(){return this.text}toHtml(t){return`<code${this.generateAttributeString(t)}>${O(this.text)}</code>`}clone(t){return new Fe(this.id,this.text,this.language,t)}doAnnotationActionApply(t){H.executeTheStrategy(t,this)}doModifyActionApply(t){H.executeTheStrategy(t,this)}}Fe.typeName="RTECodeBlockNode",H.register(x.UPDATE_CODE_BLOCK,Fe.typeName,new class extends At{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),H.register(Be.typeName,Fe.typeName,new class extends At{handleAction(t,e){e.annotationMap.set(p.SELECTION_RANGE,t.toAnnotation())}});var Pe;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Pe||(Pe={}));class He extends At{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 Et(e)))}}class Je extends k{constructor(){super(...arguments),this.stylesToBeFiltered=Je.STYLES,this.elementTagName="pre"}canFilter(t){return I.isCodeBlock(t.typeName)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Je.STYLES={backgroundColor:"rgba(var(--v-bg-secondary, 245, 247, 247, 1))",padding:"12px"};class Ke extends Y{constructor(t,e,n){super(t),this.type="code-block",this.annotationMap=new Map([G.from(Je.STYLES)]),this.children=[new Fe(`${t}-1`,e,n,this)]}static from(t){return new Ke(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=Pe["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=Ke.from(this.toJSON());return e.parent=t,e}apply(s){if(s instanceof S&&H.executeTheStrategy(s,this),s.isFlushable){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(p.SELECTION_RANGE)}}Ke.typeName="RTECodeBlock",H.register(x.DELETE_CODE_BLOCK,Ke.typeName,new class extends $e{handleAction(t,e){const n=e.children[0],s=e.parent;if(s){let t=this.getPreviousNode(n),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(n),r=0),s.apply(new Et(e));const i=t?A.getDOMByEntity(t):null;if(0===s.children.length){const n=Ee.from({id:u(),type:"paragraph",nodes:[{id:u(),type:"text",text:""}]});e.parent.apply(new Z([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const a=A.getDOMByEntity(o);if(a){const o=e.getSubjectFromParentNodeByEventId(a,s);o&&t.notify(o,{node:n,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),H.register(x.DELETE_CHILDREN,Ke.typeName,new He),H.register(x.SWITCH_OUT_FROM_CODE_BLOCK,Ke.typeName,new class extends At{handleAction(n,r){const{content:i,language:o}=n,a=i.split("\n"),c=new Ie(a.slice(0,a.length-2).join("\n"),o);c.isFlushable=!1,r.children[0].apply(c);const l=Ee.from({id:u(),type:"paragraph",nodes:[{id:u(),text:"",type:"text"}]});r.parent.apply(new St(r,l));const h=A.getDOMByEntity(r);if(h){const n=e.getSubjectFromParentNodeByEventId(h,s);n&&t.notify(n,{node:l.children[0]})}}}),H.register(x.INSERT_IMAGE_TO_BLOCK,Ke.typeName,new class extends At{handleAction(t,e){e.parent.apply(new St(e,t.imageBlockToBeInserted))}}),Ke.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{ut as $,H as A,m as B,j as C,zt as D,$ as E,_ as F,J as G,Dt as H,St as I,T as J,yt as K,ge as L,S as M,R as N,Tt as O,ye as P,Oe as Q,pe as R,xe as S,$e as T,ae as U,Bt as V,He as W,Re as X,be as Y,_e as Z,ht as _,X as a,y as a0,Rt as a1,kt as a2,dt as a3,pt as a4,ft as a5,st as a6,Le as a7,I as a8,je as a9,gt as aA,g as aB,Qt as aC,te as aD,ne as aE,Te as aF,Ce as aG,_t as aH,$t as aI,Wt as aJ,Gt as aK,Pt as aL,Ft as aM,Ht as aN,M as aa,Lt as ab,Q as ac,B as ad,Je as ae,Me as af,Xt as ag,E as ah,wt as ai,mt as aj,v as ak,N as al,b as am,P as an,Pe as ao,U as ap,It as aq,jt as ar,ct as as,Ie as at,Be as au,fe as av,Mt as aw,ee as ax,se as ay,it as az,Y as b,Ee as c,Jt as d,W as e,At as f,Z as g,Ae as h,p as i,x as j,rt as k,Et as l,K as m,q as n,k as o,De as p,Ke as q,Ne as r,A as s,Fe as t,G as u,V as v,L as w,C as x,Ut as y,Kt as z}
|
|
1
|
+
import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-36a57431.js";import{e as n,f as s}from"./p-53e3f259.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-8e3c1c81.js";import{T as a}from"./p-b438e68b.js";import{D as l}from"./p-5c285374.js";import{g as u}from"./p-8b5d3a52.js";import{V as h}from"./p-d1f47512.js";import{c as d}from"./p-a841cf13.js";import{f}from"./p-aa135628.js";var p,g;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(p||(p={}));class w{get isFormattingOnly(){return!1}}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(g||(g={}));class m extends w{}const A=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 n=this.rootDomToContentEntity.get(t);n&&n!==e&&this.contentEntityToRootDom.delete(n),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.typeName}};var x;!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.NEST_LIST_ITEMS="NEST_LIST_ITEMS",t.UNNEST_LIST_ITEMS="UNNEST_LIST_ITEMS",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",t.DELETE_SELECTED_CONTENT="DELETE_SELECTED_CONTENT",t.SEQUENTIAL_COMPOSITION="SEQUENTIAL_COMPOSITION"}(x||(x={}));class S{constructor(){this.isFlushable=!1}}function y(t){const e={},n=t.getAttribute("style");if(!n)return e;const s=function(t){const e=[];let n="",s=0;for(let r=0;r<t.length;r++){const i=t[r];"("===i?(s++,n+=i):")"===i?(s--,n+=i):";"===i&&0===s?(e.push(n),n=""):n+=i}return n&&e.push(n),e}(n);for(const t of s){const n=t.trim(),s=n.indexOf(":"),i=n.substring(0,s).trim(),o=n.substring(s+1).trim();e[r(i)]=o}return e}function O(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function T(t){return O(t).replace(/"/g,""").replace(/'/g,"'")}function E(t){return t.replace(/&(?!(?:[a-zA-Z][a-zA-Z0-9]+|#[0-9]+|#x[a-fA-F0-9]+);)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function v(t){return t.replace(/\r\n?/g,"\n").split("\n")}const N="",b="";function C(t,e=!1){return v(t).map((t=>{const n=t.includes("")||t.includes("")?t:t.trim();return e?function(t){return t.split("").join(" ").split("").join("\t")}(n):n}))}function L(t){return t.map((t=>`<p>${T(t)}</p>`)).join("")}class k{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,n){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=y(t),n=Object.assign(Object.assign({},this.stylesToBeFiltered),e),s=Object.entries(Object.assign({},n)).map((([t,e])=>`${i(t)}: ${e};`)).join("");t.setAttribute("style",s)}canFilter(t){return!1}canRefill(t,e){return!1}toCssText(){return""}get alwaysFilter(){return!1}extractAndDeleteMatchedStyles(t){let e=!1;const n=this.stylesToBeFiltered;if(t&&n){const s=Object.keys(n);for(const r of s)t[r]===n[r]&&(delete t[r],e=!0)}return e}buildCssTextForStyles(t,e){return`${`.${k.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 n=t.getStyles({standalone:!0});return this.isMatchFilterStyles(n,e)}isMatchFilterStyles(t,e){return(e&&e.length>0?e:Object.keys(this.stylesToBeFiltered)).every((e=>t[e]===this.stylesToBeFiltered[e]))}}var R,j,_;k.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"}(R||(R={}));class $ extends w{}class I{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.typeName)&&!!t.getAnnotationByType(R.LINK)}static isCodeNode(t){if(this.isTextNode(t.typeName)){const e=t.getAnnotationByType(R.CODE);return!!e&&e.code}return!1}static isImageNode(t){return"RTEImageNode"===t.typeName}static isCodeBlockNode(t){return"RTECodeBlockNode"===t.typeName}}I.RTE_TEXT_NODE_CLASS_NAME="RTETextNode",I.RTE_TEXT_BLOCK_CLASS_NAME="RTETextBlock";class B extends k{constructor(){super(...arguments),this.stylesToBeFiltered=D.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 I.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,n=t.class?t.class.split(" "):[],s=this.filterAndDeleteStyles(e,n);return s.styles&&Object.keys(s.styles).length>0&&(t.style=s.styles),s.classNames&&s.classNames.length>0&&(t.class=s.classNames.join(" ")),t.style&&0===Object.keys(t.style).length&&delete t.style,t}}class D extends w{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 D("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){let n=this.toJsx(t,e);return(null==e?void 0:e.filterInlineStyles)&&(n=D.linkGroupFilterStylesStrategy.filterLinkGroupInlineStyles(n)),Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${i(t)}="${n}"`})).join(" ")}toJsx(t,e){const n=this.getStyle(t,e),s=this.getClass(t,e),r=this.getAttribute(t);return s.length>0&&(r.class=s.join(" ")),n&&Object.keys(n).length>0&&(r.style=n),r}getClass(t,e){const n=[];return t.link.customClass&&n.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&n.push("v-rte--link"),n}getStyle(t,e){const n={};return t.link.customStyle&&Object.assign(n,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&Object.assign(n,D.getDefaultStyles()),n}getAttribute(t){const{href:e,customAttribute:n={}}=t.link,s=t.useInternalStyle,r=(null==e?void 0:e.startsWith("#"))?"_self":n.target||(s?"_blank":"");return Object.assign(Object.assign(Object.assign({},n),e||s?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}}D.linkGroupFilterStylesStrategy=new B;class M extends m{constructor(t){super(),this.type=g.ALIGNMENT,this.textAlign=t}static from(t){return[g.ALIGNMENT,new M(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 M(this.textAlign)}renderStyle(t){return(null==t?void 0:t.standalone)?M.getDefaultStyles(this.textAlign):null}}class F extends m{constructor(t){super(),this.type=g.INDENT,this.indent=Math.max(0,t)}static from(t){return[g.INDENT,new F(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new F(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class P{static register(t,e,n){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(n)}static unregister(t,e,n){const s=this.registry.get(e);if(s){const e=s.get(t);e&&e.delete(n)}}static get(t,e){const n=t instanceof S?t.type:t.typeName,s=this.registry.get(e.typeName);if(s){const r=s.get(n);if(r&&r.size>0)return Array.from(r).find((n=>n.canIntercept(t,e)))}}}P.registry=new Map;class H{static register(t,e,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n)}static unregister(t,e){const n=this.registry.get(e);n&&n.delete(t)}static get(t,e){const n=this.registry.get(e);if(n)return n.get(t)}static executeTheStrategy(t,e){const n=P.get(t,e),s=()=>{const n=t instanceof S?t.type:t.typeName,s=H.get(n,e.typeName);if(s)return t.executedFlag=!0,s.execute(t,e);o.warn(`Type ${n} action handle strategy is not registered in class ${e.typeName}`)};return n?n.intercept(s,t,e):s()}static canHandle(t,e){return!!H.get(t,e.typeName)}}H.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(j||(j={}));class J extends w{}class K extends J{constructor(t){super(),this.type=j.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[j.CUSTOM_ATTRIBUTE,new K(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new K(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 n=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete n[t])),Object.keys(n).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===n[t]&&(n[t]="true")})),n}}class U extends J{constructor(t){super(),this.type=j.CUSTOM_CLASS,this.customClass=t}static from(t){return[j.CUSTOM_CLASS,new U(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new U(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class G extends J{constructor(t){super(),this.type=j.CUSTOM_STYLE,this.customStyle=t}static from(t){return[j.CUSTOM_STYLE,new G(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new G(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="${E(Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" "))}"`}}class z extends m{constructor(t){super(),this.type=g.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[g.INTERNAL_WRAPPER,new z(t)]}clone(){return new z(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class W{constructor(t){this.dtoName=t instanceof Y?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,n){return n=n||this.toJSON(t,e),Object.entries(Object.assign({},n)).map((([t,e])=>`${i(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const n=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof G)).map((e=>e.renderStyle(t))).filter(c);return e&&e.length>0?this.mergeAnnotationStyles(n,e):n.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoName?t instanceof m:t instanceof $}mergeAnnotationStyles(t,e){const n={};for(const s of t)for(const t in s){const r=s[t],i=n[t];n[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return n}}class V{static register(t,e){var n;const s=null!==(n=this.registry.get(t))&&void 0!==n?n:new Set;s.add(e),this.registry.set(t,s)}static getStrategies(t){var e;return Array.from(null!==(e=this.registry.get(t))&&void 0!==e?e:[])}static executeTheStrategyFilterAction(t,e,n){return this.getStrategies(t.typeName).filter((e=>e.canFilter(t))).reduce(((e,n)=>n.filterAndDeleteStyles(e.styles,e.classNames,t)),{styles:e,classNames:n})}static executeTheStrategyRefillAction(t,e){this.getStrategies(t).filter((n=>n.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 n=t.toCssText();n&&!e.includes(n)&&e.push(n)}))})),e.join(" ")}}V.registry=new Map,function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(_||(_={}));class X extends l{constructor(t,e){super(),this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.typeName}.from(${JSON.stringify(t)}, ${e}, ${n}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return K.from(e);case"customClass":return U.from(e);case"customStyle":return G.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 W(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof $||t instanceof U)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(j.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getPlainText(){return""}getElementRef(){return A.getDOMByEntity(this)}generateAttributeString(t,...e){var n;const s=new W(this),r=s.toJSON({standalone:!0},["textDecoration"]),i=this.annotationMap.get(j.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=V.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(n=this.getCustomAttributesAnnotation())||void 0===n?void 0:n.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${E(s.toCssText({standalone:!0},void 0,o))}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof S?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}X.typeName="RTENode";const q=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 Y)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof X))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 Y extends l{constructor(t){super(),this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.typeName}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,n){return t.map((t=>{const s=q.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(c)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return M.from(e);case"indent":return F.from(e);case"customAttribute":return K.from(e);case"customClass":return U.from(e);case"customStyle":return G.from(e);case"internalWrapper":return z.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);c(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(g.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof D||t instanceof z))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof m||t instanceof J)).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(s){if(this.doApply(s),s.isFlushable){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}allowsCaretDescend(){return!0}getFirstNode(){if(!this.children||!this.children[0])return null;const t=this.children[0];return t instanceof Y?t.getFirstNode():t}getPlainText(){var t;return(null!==(t=this.children)&&void 0!==t?t:[]).map((t=>t.getPlainText())).join("")}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new W(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 m||t instanceof U)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(j.CUSTOM_ATTRIBUTE)}generateAttributeString(t,...e){var n;const s=new W(this),r=s.toJSON({standalone:!0}),i=this.annotationMap.get(j.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=V.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(n=this.getCustomAttributesAnnotation())||void 0===n?void 0:n.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${E(s.toCssText({standalone:!0},void 0,o))}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof S?H.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();if(e instanceof D||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply)this.doAnnotationActionApply(t);else{const e=H.get(t.typeName,this.typeName);e&&e.execute(t,this)}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}Y.typeName="RTEBlock";class Z extends S{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}const Q="500",tt={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},et=Object.assign(Object.assign({},tt),{marginTop:"0px",marginBottom:"0px"}),nt={paragraph:et,title:Object.assign(Object.assign({},tt),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"}),subtitle:Object.assign(Object.assign({},tt),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"}),"heading-1":Object.assign(Object.assign({},et),{fontSize:"22px",lineHeight:"24px",minHeight:"24px"}),"heading-2":Object.assign(Object.assign({},et),{fontSize:"20px",lineHeight:"24px",minHeight:"24px"}),"heading-3":Object.assign(Object.assign({},et),{fontSize:"18px"}),"heading-4":Object.assign({},et),"heading-5":Object.assign(Object.assign({},et),{fontSize:"14px"}),"heading-6":Object.assign(Object.assign({},et),{fontSize:"12px"})};class st extends m{constructor(t){super(),this.type=g.TEXT_STYLE,this.textStyle=t}static from(t){return[g.TEXT_STYLE,new st(t)]}static getDefaultStyles(t){return t?nt[t]:null}toJSON(){return{textStyle:this.textStyle}}clone(){return new st(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?st.getDefaultStyles(this.textStyle):null}}class rt extends l{}rt.typeName="AnnotationAction";class it extends rt{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new st(this.textStyle)}}it.typeName="TextStyleAnnotationAction";class ot extends ${constructor(t,e=!0){super(),this.type=R.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[R.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 rt{constructor(){super(...arguments),this.doSplit=!0}}ct.typeName="TextSplittableAction";class at extends ct{constructor({link:t,newText:e,needMergeNode:n,doSplit:s,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=n,this.newText=e,this.type=r,c(s)&&(this.doSplit=s)}toAnnotation(){return new ot(this.link)}}at.typeName="LinkAnnotationAction";class lt extends rt{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new D(this.groupKey)}}lt.typeName="LinkGroupAnnotationAction";const ut="700",ht="bold",dt="italic",ft="underline",pt="line-through";class gt extends ${constructor(t){super(),this.type=R.BOLD,this.bold=t}static from(t){return[R.BOLD,new gt(t)]}get isFormattingOnly(){return!0}toJSON(){return{bold:this.bold}}clone(){return new gt(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 wt extends ct{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new gt(this.bold)}}wt.typeName="BoldAnnotationAction";class mt extends rt{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}mt.typeName="DeleteNodeAnnotationAction";class At{execute(t,e){return o.log(`Executing action ${t instanceof S?t.type:t.typeName} on ${e.typeName} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(j.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new G(n.removeStyles(e)))}createNewParagraph(t){const e=q.getRTEBlockClass("paragraph");if(e)return e.from({id:u(),type:"paragraph",nodes:[{id:u(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.typeName?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,n){return e===t.children[0]&&0===n}isCaretPositionAtBlockEnd(t,e,n){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,n):this.isCaretPositionAtDecoratorBlockEnd(t,e,n)}getDOMByEntity(t){return A.getDOMByEntity(t)}isCaretPositionAtTextBlockEnd(t,e,n){const s=t.children[t.children.length-1];return e===s&&(e.isEmpty()||n===s.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,n){return e===t.children[t.children.length-1]&&0!==n}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class xt extends At{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new wt(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new mt(R.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class St extends S{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class yt extends S{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Ot extends At{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,n){if(t){const s=t.text.slice(0,e),r=t.text.slice(e),i=n.children.indexOf(t);if(i>-1){const o=n.children.slice(0,i),c=n.children.slice(i+1);t.isContentEditable()?(s&&o.push(t.cloneWithText(s)),r&&c.unshift(t.cloneWithText(r))):e>0?o.push(t):c.unshift(t),n.apply(new yt(o));const a=n.cloneWithNodes(c);return n.parent.apply(new St(n,a)),a}}}}class Tt extends At{handleAction(t,e){e.children=[],e.apply(new Z(t.newChildNodes))}}class Et extends S{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class vt extends w{constructor(t){super(),this.type=p.SELECTION_RANGE,this.range=t}get isFormattingOnly(){return!0}clone(){return new vt(this.range)}}class Nt extends ${constructor(t){super(),this.type=R.STRIKETHROUGH,this.strikethrough=t}static from(t){return[R.STRIKETHROUGH,new Nt(t)]}get isFormattingOnly(){return!0}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new Nt(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 bt extends ${constructor(t){super(),this.type=R.UNDERLINE,this.underline=t}static from(t){return[R.UNDERLINE,new bt(t)]}get isFormattingOnly(){return!0}toJSON(){return{underline:this.underline}}clone(){return new bt(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 Ct extends ${constructor(t){super(),this.type=R.ITALIC,this.italic=t}static from(t){return[R.ITALIC,new Ct(t)]}get isFormattingOnly(){return!0}toJSON(){return{italic:this.italic}}clone(){return new Ct(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 Lt extends ${constructor(t,e=!0){super(),this.type=R.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[R.CODE,new Lt(t,e)]}static getDefaultStyles(){return{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}}get isFormattingOnly(){return!0}toJSON(){return{code:this.code}}clone(){return new Lt(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?Lt.getDefaultStyles():null}}const kt={key:"black",light:"#111128",dark:"#E3E3E8"},Rt=[kt,{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"}],jt="";var _t;!function(t){t.Default="default",t.Composition="composition"}(_t||(_t={}));const $t="__updateSource",It=[{key:"title"},{key:"subtitle"},{key:"heading-1"},{key:"heading-2"},{key:"heading-3"},{key:"paragraph"}],Bt=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]],Dt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Mt=22,Ft="url",Pt="email",Ht=["url","email"],Jt="data-vega-rte-block-boundary",Kt="application/x-vega-rte-paste-mode",Ut="application/x-vega-rte-preserved-whitespace",Gt="word",zt="rte-word-count",Wt="plain";class Vt extends ${constructor(t){super(),this.type=R.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[R.TEXT_COLOR,new Vt(t)]}get isFormattingOnly(){return!0}toJSON(){return{textColor:this.textColor.key}}clone(){return new Vt(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:h.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return Rt.find((e=>e.key===t))||Rt[0]}}class Xt extends rt{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}Xt.typeName="SyncUpSelectionAction";class qt extends S{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Yt extends At{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(p.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof ct&&t.doSplit&&n){const{startContainer:t,endContainer:s,startOffset:r,endOffset:i}=n.range,o=t===s&&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(n.range)&&e.isContentEditable()){const s=this.splitTextNode(n.range,e);return t.annotationMap.has("LINK")&&t.apply(new qt(s)),s}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const n=e.cloneWithText("");this.setApplyTargetNode(n);const s=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===s?[n,e]:t===e.text.length||!e.isContentEditable()&&t===s+1?[e,n]:[e.cloneWithText(e.text.substring(0,t)),n,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:n,startOffset:s,endOffset:r}=t;return e!==n||s>0||r<(n.textContent?n.textContent.length:0)}splitTextNode(t,e){const{startContainer:n,endContainer:s,startOffset:r}=t,i=n.parentElement,o=s.parentElement,c=(t,n,s)=>{const r=t.substring(0,n),i=t.substring(n,s),o=t.substring(s);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},a=i&&A.getEntityByDOM(i),l=o&&A.getEntityByDOM(o);if(a&&a.id===e.id){const i=n===s?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[n,s,r]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(s),[n,s,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Zt extends w{constructor(){super(...arguments),this.type=p.CLEAR_FORMATTING,this.items=[R.BOLD,R.ITALIC,R.UNDERLINE,R.STRIKETHROUGH,R.TEXT_COLOR,R.CODE,j.CUSTOM_STYLE]}}class Qt extends ct{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Zt}}Qt.typeName="ClearFormattingAnnotationAction";class te extends ct{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new Lt(this.code)}}te.typeName="CodeAnnotationAction";class ee extends ct{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new Ct(this.italic)}}ee.typeName="ItalicAnnotationAction";class ne extends ct{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new Nt(this.strikethrough)}}ne.typeName="StrikethroughAnnotationAction";class se extends ct{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new bt(this.underline)}}se.typeName="UnderlineAnnotationAction";class re extends At{handleAction(t,e){const n=t.toAnnotation();if(t instanceof mt)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof Zt))return n instanceof $||n instanceof vt?(t instanceof at&&(c(t.newText)&&(e.text=t.newText),e.parent.apply(new lt(t.link.groupKey,[e],t.type))),t instanceof te&&this.handleAction(new Qt,e),t instanceof wt&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof ee&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof se||t instanceof ne)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class ie extends S{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class oe extends At{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new ie)}}class ce extends S{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class ae extends At{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,n){if(e&&e.startContainer&&e.endContainer){const{startContainer:s,endContainer:r,startOffset:i,endOffset:o}=e;let c=n.text;if(s===r&&i===o&&t)c=n.text.slice(0,i)+t+n.text.slice(i);else{const e=s.parentElement,a=r.parentElement,l=e&&A.getEntityByDOM(e),u=a&&A.getEntityByDOM(a);let h=0,d=n.text.length;l&&l===n?(h=i,d=s===r?o:d):u&&u===n&&(d=o),c=n.text.slice(0,h)+t+n.text.slice(d)}n.apply(new ce(c))}}}class le extends w{constructor(t){super(),this.type=R.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new le(e);return o.groupId=t.groupId,o.child=n?le.from(n)[1]:void 0,o.customAttribute=i?K.from(i)[1]:void 0,o.customClass=r?U.from(r)[1]:void 0,o.customStyle=s?G.from(s)[1]:void 0,[R.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new le(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===(n=this.customClass)||void 0===n?void 0:n.clone(),r.customStyle=null===(s=this.customStyle)||void 0===s?void 0:s.clone(),r}renderProps(){var t,e,n;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===(n=this.customClass)||void 0===n?void 0:n.renderClass().join(" ")})}toJSON(){var t,e,n,s;return{inlineHtml:d({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===(n=this.customClass)||void 0===n?void 0:n.toJSON().customClass,customStyle:null===(s=this.customStyle)||void 0===s?void 0:s.toJSON().customStyle})}}}class ue extends At{handleAction(t,e){const n=e.parent.getAnnotationByType(p.LINK_GROUP);if(n){const s=e.annotationMap.get("LINK").link.groupKey,r=n.linkGroups.get(s);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),n.linkGroups.set(s,r))}}}}class he extends At{handleAction(t,e){const n=e.parent.getAnnotationByType(p.LINK_GROUP);if(n){const t=e.annotationMap.get(R.LINK).link.groupKey,s=n.linkGroups.get(t);if(s){const r=s.indexOf(e);-1!==r&&s.splice(r,1),0===s.length&&n.linkGroups.delete(t),0===n.linkGroups.size&&e.parent.annotationMap.delete(p.LINK_GROUP)}}e.annotationMap.delete(R.LINK)}}class de extends ${constructor(t){super(),this.type=R.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[R.PLAIN_TEXT,new de(t)]}get isFormattingOnly(){return!0}clone(){return new de(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return this.plainText?{plainText:this.plainText}:void 0}}class fe extends ct{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new Vt(this.textColor)}}fe.typeName="TextColorAnnotationAction";class pe extends X{constructor(t,e,n,s){super(t,s),this.type=_.TEXT,this.parent=n,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,n={autoMatchFormat:!0}){const s=new pe(t.id,t.text,e),{annotations:r}=t;return r&&(s.annotationMap=this.generateTextAnnotationMap(r,n,e,s)),s}static generateTextAnnotationMap(t,e,n,s){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&n&&s&&n.apply(new lt(t.link.groupKey,[s],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(c))}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return gt.from(e);case"italic":return Ct.from(e);case"underline":return bt.from(e);case"strikethrough":return Nt.from(e);case"code":return Lt.from(e,s);case"textColor":return Vt.from(e);case"link":return ot.from(e,s);case"inlineHtml":return le.from(e);case"plainText":return de.from(e)}return X.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof $||t instanceof J||t instanceof le)).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(R.INLINE_HTML);return e?this.renderWithWrapperStr(e,t):this.renderTextStr(t)}cloneWithText(t){return new pe(u(),t,this.parent,super.cloneAnnotations())}clone(t){return new pe(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!(this.getAnnotationByType(R.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}getPlainText(){return this.text}getInlineHtmlTagAtDepth(t){const e=this.getInlineHtmlAnnotationAtDepth(t);return e?Dt.has(e.htmlTag)?null:{htmlTag:e.htmlTag,attrStr:this.annotationAttrStr(e),groupId:e.groupId,annotation:e}:null}renderHtmlFromDepth(t,e){if(0===t)return this.toHtml(e);const n=this.getInlineHtmlAnnotationAtDepth(t);return n?this.renderWithWrapperStr(n,e):this.renderTextStr(e)}getInlineHtmlAnnotationAtDepth(t){let e=this.getAnnotationByType(R.INLINE_HTML);for(let n=0;n<t&&e;n++)e=e.child;return e}registerModifyStrategy(){const t=this.typeName;pe.registerActionStrategyStatus[t]||(this.isContentEditable()&&(H.register(x.UPDATE_TEXT,t,new oe),H.register(x.REPLACE_SELECTED_TEXT,t,new ae),H.register(x.LINK_GROUP_NODE_SPLIT,t,new ue),H.register(at.typeName,t,new re)),H.register(ct.typeName,t,new Yt),H.register(x.DELETE_LINK_GROUP,t,new he),H.register(wt.typeName,t,new re),H.register(Qt.typeName,t,new re),H.register(ee.typeName,t,new re),H.register(se.typeName,t,new re),H.register(fe.typeName,t,new re),H.register(ne.typeName,t,new re),H.register(te.typeName,t,new re),H.register(rt.typeName,t,new re),pe.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(p.SELECTION_RANGE);if(t instanceof ct&&t.doSplit&&e){const e=H.get(ct.typeName,this.typeName);if(e){const n=e.execute(t,this);n&&this.applyActionToNode(n,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){H.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof Xt)return void this.syncUpSelectedNodes(t);n instanceof vt||this.syncUpSelectedNodes(t);const s=H.get(e.typeName,t.typeName);if(s)return void s.execute(e,t);const r=H.get(rt.typeName,pe.typeName);r&&r.execute(e,t)}syncUpSelectedNodes(n){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,s);i&&t.notify(i,{node:n})}}renderWithWrapperStr(t,e){const{htmlTag:n,child:s}=t,r=this.annotationAttrStr(t);return s?`<${n}${r}>${this.renderWithWrapperStr(s,e)}</${n}>`:Dt.has(n)?`<${n}${r}>`:this.text?`<${n}${r}>${this.renderTextStr(e)}</${n}>`:`<${n}${r}></${n}>`}annotationAttrStr(t){const{customAttribute:e,customClass:n,customStyle:s}=t,r=[...(null==e?void 0:e.toString())||[],null==n?void 0:n.toString(),null==s?void 0:s.toString()].filter(c);return r.length>0?` ${r.join(" ")}`:""}renderTextStr(t){var e;const n=(null===(e=this.getAnnotationByType(R.CODE))||void 0===e?void 0:e.code)?"code":"span",s=super.generateAttributeString(t);return"\n"===this.text?"<br>":this.shouldSkipEmptyFormattingMarker()?"":this.shouldRenderAsPlainText()?this.text:`<${n}${s}>${"code"===n?T(this.text):this.text}</${n}>`}shouldSkipEmptyFormattingMarker(){return""===this.text&&this.annotationMap.size>0&&Array.from(this.annotationMap.values()).every((t=>t.isFormattingOnly))}shouldRenderAsPlainText(){const t=super.getAnnotationByType(R.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof $&&!(t instanceof ot)&&!(t instanceof de)||t instanceof J)).length}}pe.registerActionStrategyStatus={},pe.htmlTag="span",pe.typeName="RTETextNode";class ge extends At{handleAction(t,e){const n=t.blockNeedToBeMerged;if(e.type===n.type||"image"!==e.type&&"image"!==n.type){let t=n.children;"image"!==n.type&&(t=n.children.filter((t=>t.text))),e.apply(new Z(t)),"image"!==e.type&&this.transferLinkGroups(t,e),n.parent.apply(new Et(n))}}transferLinkGroups(t,e){t.forEach((t=>{if(!(t instanceof pe))return;const n=t.getAnnotationByType(R.LINK);n&&e.apply(new lt(n.link.groupKey,[t],"link"))}))}}class we extends At{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new pe(u(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const c=n.children.slice(0,o),a=n.children.slice(o+1);t.isContentEditable()?(r&&c.push(t.cloneWithText(r)),i&&a.unshift(t.cloneWithText(i))):e>0?c.push(t):a.unshift(t),this.mergeLineBreakNodes(c,s,a,n)}return s}}mergeLineBreakNodes(t,e,n,s){if(0===n.length||n[0]&&""===n[0].text){const e=t[t.length-1];n.push(new pe(u(),"\n",s,e&&new Map(e.annotationMap)))}s.apply(new yt([...t,e,...n]))}}class me extends At{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new pe(u(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(n,s,r,e),s}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new Et(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new pe(u(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new yt([...t,e,...n]))}}class Ae extends S{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class xe extends S{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}function Se(t,e){const n=new Set(t.filter((t=>"RTEListItemBlock"===t.typeName)));return t.filter((t=>{if("RTEListItemBlock"!==t.typeName)return!0;let s=t.parent;for(;s.parent&&"RTEListItemBlock"===s.parent.typeName;){const r=s.parent;if(n.has(r))return t.parent.type=e,!1;s=r.parent}return!0}))}class ye extends rt{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new M(this.textAlign)}}ye.typeName="HorizontalAlignmentAnnotationAction";class Oe extends At{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class Te extends rt{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new F(this.indent)}}Te.typeName="IndentAnnotationAction";class Ee extends Y{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=Ee.isAcceptableTextStyle(e)?new Map([st.from(e)]):new Map([st.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new Ee(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(s=null===(n=t.annotations)||void 0===n?void 0:n.textStyle)&&void 0!==s?s:r.type}):t.annotations;return r.children=Ee.convertNodes(t.nodes,r,e),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static convertNodes(t,e,n){return t.map((t=>{const s=q.getRTENodeClass(t.type);if(s)return s.from(t,e,n)})).filter(c)}static createAnnotationEntity(t,e){return"textStyle"===t?st.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,n)=>{const s=e.at(-1);if(t instanceof at&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(R.LINK),r=n.getAnnotationByType(R.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,n]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),n=super.generateAttributeString(t),s=this.getChildrenHtml(t);return super.shouldRenderAsInternalWrapper()?s:[`<${e}${n}>`,s,`</${e}>`].join("")}cloneWithNodes(t){const e=new Ee(u(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new Z(t)),e}clone(t){const e=new Ee(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){if(!this.isNotEmpty())return"<br>";const e=this.getAnnotationByType(p.LINK_GROUP);let n=this.renderGroupedNodesAtDepth(this.children,0,t);return e&&this.children.length>0&&(n=this.generateLinkHtml(e,n,t)),n}doAnnotationActionApply(t){const e=H.get(t.typeName,Ee.typeName);e&&e.execute(t,this)}renderGroupedNodesAtDepth(t,e,n){var s;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,n),i++;continue}let c=i+1;for(;c<t.length&&(null===(s=t[c].getInlineHtmlTagAtDepth(e))||void 0===s?void 0:s.groupId)===o.groupId;)c++;if(c===i+1)r+=t[i].renderHtmlFromDepth(e,n);else{const s=this.renderGroupedNodesAtDepth(t.slice(i,c),e+1,n);r+=`<${o.htmlTag}${o.attrStr}>${s}</${o.htmlTag}>`}i=c}return r}generateLinkHtml(t,e,n){e="";let s=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(R.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(R.LINK):null;if(i){if(s.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,filterInlineStyles:null==n?void 0:n.filterInlineStyles});e+=[`<a${r?` ${r}`:""}>`,this.renderGroupedNodesAtDepth(s,0,n),"</a>"].join(""),s=[]}}else e+=this.children[r].toHtml(n)}return e}}Ee.typeName="RTETextBlock",H.register(it.typeName,Ee.typeName,new xt),H.register(ye.typeName,Ee.typeName,new Oe),H.register(Te.typeName,Ee.typeName,new class extends At{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),H.register(lt.typeName,Ee.typeName,new class extends At{handleAction(t,e){let n=e.getAnnotationByType(p.LINK_GROUP);if("update_link"===t.type){if(n){const e=n.linkGroups.get(t.groupKey);e&&n.linkGroups.set(t.groupKey,[e[0]])}}else{if(n){const e=n.linkGroups.get(t.groupKey)||[];n.linkGroups.set(t.groupKey,[...e,...t.nodes])}else n=t.toAnnotation(),n.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(p.LINK_GROUP,n)}}}),H.register(x.UNLINK_LINK_GROUP,Ee.typeName,new class extends At{handleAction(t,e){const n=e.getAnnotationByType(p.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(p.LINK_GROUP))}}),H.register(x.SPLIT_BLOCK_WITH_NODE,Ee.typeName,new Ot),H.register(x.REPLACE_CHILD_NODES,Ee.typeName,new Tt),H.register(x.MERGE_TWO_BLOCKS_NODES,Ee.typeName,new ge),H.register(x.LINE_BREAK_SINGLE_BLOCK,Ee.typeName,new we),H.register(x.LINE_BREAK_MULTIPLE_BLOCKS,Ee.typeName,new me),H.register(x.INSERT_IMAGE_TO_BLOCK,Ee.typeName,new class extends At{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new St(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new Ae(e,r));else{const t=new xe(n,s);e.apply(t),e.parent.apply(new St(e,r))}}}),H.register(x.TRANSFORM_LIST_BLOCK,Ee.typeName,new class extends At{handleAction(t,e){const n=this.getRootContent(e);if(!n)return;const s=e.parent,r=n.createList(t.listType),i=Se(t.selectedBlocks,t.listType),o=i.map((t=>n.toListItem(t)));r.apply(new Z(o)),s.apply(new St(t.selectedBlocks[0],r)),i.forEach((t=>{t.parent.apply(new Et(t))}))}});class ve extends At{copyListAnnotations(t,e){t.annotationMap.forEach(((t,n)=>{e.annotationMap.set(n,t.clone())}))}haveSameListAnnotations(t,e){var n,s;const r=Array.from(t.annotationMap.keys()).sort(),i=Array.from(e.annotationMap.keys()).sort();return JSON.stringify(r)===JSON.stringify(i)&&JSON.stringify(this.normalizeAnnotationValue(null!==(n=t.toJSON().annotations)&&void 0!==n?n:{}))===JSON.stringify(this.normalizeAnnotationValue(null!==(s=e.toJSON().annotations)&&void 0!==s?s:{}))}normalizeAnnotationValue(t){if(Array.isArray(t))return t.map((t=>this.normalizeAnnotationValue(t)));if(t&&"object"==typeof t){const e=t;return Object.keys(e).sort().reduce(((t,n)=>(t[n]=this.normalizeAnnotationValue(e[n]),t)),{})}return t}}class Ne extends Ee{constructor(t,e,n){super(t,"list-item",n),this.nestList=[],this.nestList=e}static from(t,e={autoMatchFormat:!0}){const n=new Ne(t.id,void 0,e);n.children=Ne.convertNodes(t.nodes,n,e),t.children&&(n.nestList=t.children.map((t=>{const s=_e.from(t,e);return s.parent=n,s})));const{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);c(s)&&n.annotationMap.set(...s)})),n}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.nestList)||void 0===t?void 0:t.map((t=>t.toJSON()))})}toHtml(t){var e;const n=super.generateAttributeString(t),s=(null===(e=this.nestList)||void 0===e?void 0:e.length)?this.nestList.map((e=>e.toHtml(t))).join(""):"";return[`<li${n}>`,this.getChildrenHtml(t),s,"</li>"].join("")}cloneWithNodes(t){const e=new Ne(u());return e.children=[],e.apply(new Z(t)),e}getLastNode(){return this.nestList&&this.nestList.length>0?this.nestList[this.nestList.length-1].getLastNode():super.getLastNode()}getPlainText(){var t;const e=(null!==(t=this.nestList)&&void 0!==t?t:[]).map((t=>t.getPlainText())).join("");return super.getPlainText()+e}createNewListItem(){return new Ne(u())}clone(t){var e;const n=new Ne(this.id);return n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n.nestList=null===(e=this.nestList)||void 0===e?void 0:e.map((t=>t.clone(n))),n.parent=t,n}}Ne.typeName="RTEListItemBlock",H.register(it.typeName,Ne.typeName,new xt),H.register(ye.typeName,Ne.typeName,new Oe),H.register(x.LINE_BREAK_SINGLE_BLOCK,Ne.typeName,new we),H.register(x.LINE_BREAK_MULTIPLE_BLOCKS,Ne.typeName,new me),H.register(x.DELETE_NEST_LIST,Ne.typeName,new class extends At{handleAction(t,e){e.nestList&&(e.nestList=e.nestList.length>1?e.nestList.filter((e=>e!==t.nestListBlockToBeRemoved)):void 0)}}),H.register(x.SPLIT_BLOCK_WITH_NODE,Ne.typeName,new Ot),H.register(x.REPLACE_CHILD_NODES,Ne.typeName,new Tt),H.register(x.REPLACE_NEST_LIST,Ne.typeName,new class extends ve{handleAction(t,e){const n=this.mergeAdjacentSameType(t.newList);n.forEach((t=>{t.parent=e})),e.nestList=n}mergeAdjacentSameType(t){if(t.length<=1)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const s=e[e.length-1],r=t[n];s.type===r.type&&this.haveSameListAnnotations(s,r)?(r.children.forEach((t=>{t.parent=s})),s.children=s.children.concat(r.children)):e.push(r)}return e}}),H.register(x.MERGE_TWO_BLOCKS_NODES,Ne.typeName,new ge),H.register(x.INSERT_IMAGE_TO_BLOCK,Ne.typeName,new class extends At{handleAction(t,e){e.parent.apply(t)}});class be extends S{constructor(t){super(),this.type=x.REPLACE_NEST_LIST,this.newList=t}}class Ce extends S{constructor(t){super(),this.type=x.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}class Le extends Y{constructor(t,e){super(t),this.type="html-block",this.children=[],this.htmlTag=e}static from(t,e){const n=new Le(t.id,t.htmlTag),{annotations:s}=t;return s&&super.convertAnnotationsToMap(n.annotationMap,s),n.children=this.generateBlockChildren(t.children,e,n),n}clone(t){const e=new Le(this.id,this.htmlTag);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return!0}toHtml(t){const e=this.htmlTag,n=super.generateAttributeString(t);return Dt.has(this.htmlTag)?`<${e}${n}>`:[`<${e}${n}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,htmlTag:this.htmlTag,children:this.children.map((t=>t.toJSON()))})}}Le.typeName="RTEHtmlBlock";class ke extends At{getOrderedContiguousItems(t,e){const n=[...e].sort(((e,n)=>t.children.indexOf(e)-t.children.indexOf(n))),s=t.children.indexOf(n[0]);return s<0?[]:t.children.slice(s,s+n.length).every(((t,e)=>t===n[e]))?n:[]}}class Re extends S{constructor(t){super(),this.type=x.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class je extends m{constructor(){super(...arguments),this.type=g.LIST}static getDefaultStyles(){return{paddingLeft:"8px",marginLeft:"16px"}}static getDefaultMarkerStyles(){return{fontSize:"16px"}}renderStyle(t){return(null==t?void 0:t.standalone)?je.getDefaultStyles():null}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--list"}clone(){return new je}toJSON(){}}class _e extends Y{constructor(t,e,n){super(t),this.type="bullet-list",this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&this.annotationMap.set(g.LIST,new je)}static from(t,e={autoMatchFormat:!0}){const n=new _e(t.id,t.type,e),{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);c(s)&&n.annotationMap.set(...s)})),n.children=t.blocks.map((t=>{const s=Ne.from(t,e);return s.parent=n,s})),n}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return K.from(e);case"customClass":return U.from(e);case"customStyle":return G.from(e)}}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag();return[`<${e}${super.generateAttributeString(t)}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1].getLastNode()}clone(t){const e=new _e(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getBlockTag(){return"number-list"===this.type?"ol":"ul"}}_e.typeName="RTEListBlock",H.register(x.TRANSFORM_LIST_BLOCK,_e.typeName,new class extends ve{handleAction(t,e){var n;const s=t.selectedBlocks,r=s.every((t=>t.parent===e)),i=this.getRootContent(e);if(!i)return;if(e.parent instanceof Ne){if(r){const r=this.createListFromSource(i,e,t.listType);r.apply(new Z(e.children));const o=e.parent,c=(null!==(n=o.nestList)&&void 0!==n?n:[]).map((t=>t===e?r:t));o.apply(new be(c)),s.forEach((t=>t.children.map((t=>t.apply(new Xt)))))}else this.handleCrossListTransform(t,e);return}if(!r&&s.every((t=>t instanceof Ne))){const e=new Set(s.map((t=>t.parent))),n=new Set;e.forEach((e=>{e.type!==t.listType&&this.convertListTypeInPlace(e,t.listType)}));const r=new Set;return s.forEach((t=>{const e=t.parent;e.parent instanceof Ne||(n.add(e),r.add(e.parent))})),r.forEach((t=>{for(let e=0;e<t.children.length-1;){const s=t.children[e],r=t.children[e+1];s instanceof _e&&r instanceof _e&&s.type===r.type&&this.haveSameListAnnotations(s,r)&&n.has(s)&&n.has(r)?(s.apply(new Z([...r.children])),t.apply(new Et(r)),n.delete(r)):e++}})),void s.forEach((t=>t.children.map((t=>t.apply(new Xt)))))}const o=this.createListFromSource(i,e,t.listType),c=e.parent;if(r)o.apply(new Z(e.children)),c.apply(new St(e,o)),c.apply(new Et(e)),s.forEach((t=>t.children.map((t=>t.apply(new Xt)))));else{const n=Se(t.selectedBlocks,t.listType),s=n.map((t=>i.toListItem(t)));o.apply(new Z(s)),c.apply(new St(e,o)),n.forEach((t=>{t.parent.apply(new Et(t))})),0===e.children.length&&c.apply(new Et(e))}}convertListTypeInPlace(t,e){var n;const s=this.getRootContent(t);if(!s)return;const r=t.parent,i=this.createListFromSource(s,t,e);if(i.apply(new Z([...t.children])),r instanceof Ne){const e=(null!==(n=r.nestList)&&void 0!==n?n:[]).map((e=>e===t?i:e));r.apply(new be(e))}else r.apply(new St(t,i)),r.apply(new Et(t))}handleCrossListTransform(t,e){if(!(e.parent instanceof Ne))return;const n=this.getRootContent(e);if(!n)return;const s=e.parent,r=s.nestList,i=new Set(t.selectedBlocks.filter((t=>t instanceof Ne)).map((t=>t.parent)).filter((t=>r.includes(t))));if(!i.size)return;const o=r.map((e=>{if(!i.has(e))return e;const s=this.createListFromSource(n,e,t.listType);return s.apply(new Z(e.children)),s}));s.apply(new be(o)),t.selectedBlocks.forEach((t=>t.children.map((t=>t.apply(new Xt)))))}createListFromSource(t,e,n){const s=t.createList(n);return this.copyListAnnotations(e,s),s}}),H.register(x.TRANSFORM_PARAGRAPH_BLOCK,_e.typeName,new class extends ve{handleAction(t,e){const n=this.getSelectedSegments(t.selectedBlocks);0!==n.length&&this.hasConsistentTargetAndRoot(n,e)&&(this.syncSelection(n),[...n].reverse().forEach((t=>this.transformSegment(t))))}hasConsistentTargetAndRoot(t,e){if(t[0][0].parent!==e)return!1;const n=this.getRootContent(e);return Boolean(n&&t.every((t=>t.every((t=>this.getRootContent(t)===n)))))}syncSelection(t){t.forEach((t=>{t.forEach((t=>{t.children.forEach((t=>t.apply(new Xt)))}))}))}transformSegment(t){const e=t[0].parent,n=new Ce(t);e.parent instanceof Ne?this.handleNestedListCase(n,e):this.handleRootListCase(n,e)}handleRootListCase(t,e){const n=this.getRootContent(e);let s=!1,r=!1;const i=t.selectedBlocks,o=[];if(i.forEach((t=>{var n;t===e.children[0]&&(s=!0),t===e.children[e.children.length-1]&&(r=!0),o.push(this.toParagraph(t));for(const e of null!==(n=t.nestList)&&void 0!==n?n:[])this.appendListBlock(o,e)})),s)e.parent.apply(new Ae(e,...o));else if(r)e.parent.apply(new St(e,...o));else{const t=e.children.indexOf(i[0]),s=e.children.indexOf(i[i.length-1]),r=this.createListFromSource(n,e);r.apply(new Z(e.children.slice(0,t)));const c=this.createListFromSource(n,e);c.apply(new Z(e.children.slice(s+1)));const a=o[o.length-1];a instanceof _e&&c.children.length>0&&a.type===c.type&&this.haveSameListAnnotations(a,c)?(a.apply(new Z(c.children)),e.parent.apply(new Ae(e,r,...o))):e.parent.apply(new Ae(e,r,...o,c)),e.parent.apply(new Et(e))}if(i.map((t=>{t.nestList=[],e.apply(new Et(t))})),0===e.children.length)e.parent.apply(new Et(e));else if(s){const t=o[o.length-1];t instanceof _e&&t.type===e.type&&this.haveSameListAnnotations(t,e)&&(t.apply(new Z([...e.children])),e.parent.apply(new Et(e)))}}handleNestedListCase(t,e){const n=t.selectedBlocks,s=this.getRootContent(e),r=e.children.indexOf(n[0]),i=[];n.forEach((t=>{var e;i.push(this.toParagraph(t));for(const n of null!==(e=t.nestList)&&void 0!==e?e:[])this.appendListBlock(i,n)}));const o=e.children.indexOf(n[n.length-1]),c=e.children.slice(o+1),a=[];let l=e;for(;l.parent instanceof Ne;){const t=l.parent,e=t.parent,n=e.children.indexOf(t),s=t.nestList,r=s.indexOf(l),i=s.slice(r+1);a.push({list:e,ancestorIndex:n,trailingNestLists:i}),l=e}const u=l,h=u.parent,d=[];c.length>0&&d.push({items:c,sourceList:e});for(const t of a){for(const e of t.trailingNestLists)e.children.length>0&&d.push({items:[...e.children],sourceList:e});const e=t.list.children.slice(t.ancestorIndex+1);e.length>0&&d.push({items:e,sourceList:t.list})}const f=[];for(const t of d){const e=f[f.length-1];e&&e.sourceList.type===t.sourceList.type&&this.haveSameListAnnotations(e.sourceList,t.sourceList)?e.items.push(...t.items):f.push({items:[...t.items],sourceList:t.sourceList})}f.map((t=>{const e=this.createListFromSource(s,t.sourceList);return e.apply(new Z(t.items)),e})).forEach((t=>this.appendListBlock(i,t))),e.children=e.children.slice(0,r);const p=e.parent,g=p.nestList,w=g.indexOf(e);let m=g.slice(0,w+1);0===e.children.length&&(m=m.filter((t=>t!==e))),p.apply(new be(m));for(const t of a)if(t.list.children=t.list.children.slice(0,t.ancestorIndex+1),t.trailingNestLists.length>0){const e=t.list.children[t.ancestorIndex],n=e.nestList,s=n.indexOf(t.trailingNestLists[0]);if(s>=0){const t=n.slice(0,s);e.apply(new be(t))}}h.apply(new St(u,...i))}getSelectedSegments(t){const e=Array.from(new Set(t.filter((t=>t instanceof Ne)))).map((t=>({item:t,path:this.getStructuralPath(t)}))).filter((t=>null!==t.path)).sort(((t,e)=>this.compareStructuralPaths(t.path,e.path))).map((t=>t.item)),n=[];for(const t of e){const e=n[n.length-1],s=null==e?void 0:e[e.length-1];(null==s?void 0:s.parent)===t.parent&&t.parent.children.indexOf(t)-t.parent.children.indexOf(s)==1?e.push(t):n.push([t])}return n}getStructuralPath(t){var e;const n=[],s=new Set;let r=t,i=t.parent;for(;!s.has(i);){s.add(i);const t=i.children.indexOf(r);if(t<0)return null;if(n.unshift(t),"VegaRTEContent"===i.parent.typeName||"RTEHtmlBlock"===i.parent.typeName){const t=this.getContainerPath(i);return t?[...t,...n]:null}if(!(i.parent instanceof Ne))return null;const o=i.parent,c=(null!==(e=o.nestList)&&void 0!==e?e:[]).indexOf(i);if(c<0)return null;n.unshift(c),r=o,i=o.parent}return null}getContainerPath(t){const e=[],n=new Set;let s=t,r=t.parent;for(;r instanceof Le;){if(n.has(r))return null;n.add(r);const t=r.children.indexOf(s);if(t<0)return null;e.unshift(t),s=r,r=r.parent}const i=r.children.indexOf(s);return i<0?null:(e.unshift(i),e)}compareStructuralPaths(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++)if(t[s]!==e[s])return t[s]-e[s];return t.length-e.length}appendListBlock(t,e){const n=t[t.length-1];n instanceof _e&&n.type===e.type&&this.haveSameListAnnotations(n,e)?n.apply(new Z([...e.children])):t.push(e)}createListFromSource(t,e){const n=t.createList(e.type);return this.copyListAnnotations(e,n),n}toParagraph(t){const e=new Ee(u(),"paragraph");return e.apply(new Z(t.children)),e.annotationMap=t.annotationMap,e}}),H.register(x.INSERT_IMAGE_TO_BLOCK,_e.typeName,new class extends At{handleAction(t,e){e.parent.apply("list-item"!==e.parent.type?new St(e,t.imageBlockToBeInserted):t)}}),H.register(x.NEST_LIST_ITEMS,_e.typeName,new class extends ke{handleAction(t,e){var n,s;const r=this.getOrderedContiguousItems(e,t.selectedBlocks);if(!r.length)return;const i=e.children.indexOf(r[0]);if(i<=0)return;const o=e.children[i-1],c=new Set(r);let a=null===(n=o.nestList)||void 0===n?void 0:n[o.nestList.length-1];a||(a=new _e(u(),e.type),o.apply(new be([...null!==(s=o.nestList)&&void 0!==s?s:[],a]))),e.children=e.children.filter((t=>!c.has(t))),a.children=a.children.concat(r),r.forEach((t=>{var e;t.parent=a,(null===(e=t.nestList)||void 0===e?void 0:e.length)&&this.unifyDescendantNestLists(t,t.nestList[0].type),t.children.forEach((t=>t.apply(new Xt)))}))}unifyDescendantNestLists(t,e){var n;if(!(null===(n=t.nestList)||void 0===n?void 0:n.length))return;let s=!1;for(const n of t.nestList){n.type!==e&&(n.type=e,s=!0);for(const t of n.children)this.unifyDescendantNestLists(t,e)}s&&t.apply(new be([...t.nestList]))}}),H.register(x.UNNEST_LIST_ITEMS,_e.typeName,new class extends ke{handleAction(t,e){var n;const s=this.getOrderedContiguousItems(e,t.selectedBlocks),r=e.parent;if(!(s.length&&r instanceof Ne))return;const i=e.children.indexOf(s[0]),o=e.children.indexOf(s[s.length-1]);if(i<0||o<i)return;const c=r,a=c.parent,l=a.children.indexOf(c);if(l<0)return;const h=e.children.slice(o+1),d=new Set(s);if(e.children=e.children.filter((t=>!d.has(t))),a.children=[...a.children.slice(0,l+1),...s,...a.children.slice(l+1)],s.forEach((t=>{t.parent=a,t.children.forEach((t=>t.apply(new Xt)))})),h.length>0){const t=new Set(h);e.children=e.children.filter((e=>!t.has(e)));const r=s[s.length-1];let i=null===(n=r.nestList)||void 0===n?void 0:n[r.nestList.length-1];if(i&&i.type!==e.type&&(i=null),!i){i=new _e(u(),e.type);const t=Array.isArray(r.nestList)?r.nestList:[];r.apply(new be([...t,i]))}i.children=i.children.concat(h),h.forEach((t=>{t.parent=i}))}const f=this.collectTrailingNestLists(c,e);if(f.length>0){const t=s[s.length-1],e=Array.isArray(t.nestList)?t.nestList:[];t.apply(new be([...e,...f]))}0===e.children.length&&c.apply(new Re(e))}collectTrailingNestLists(t,e){var n;const s=null!==(n=t.nestList)&&void 0!==n?n:[],r=s.indexOf(e);if(r<0||r>=s.length-1)return[];const i=s.slice(r+1);return t.apply(new be(s.slice(0,r+1))),i}});class $e extends At{getPreviousNode(t){var e;const n=t.parent,s=n.children.indexOf(t);if(s>0)return n.children[s-1];if(n.parent){if(n.isListItemBlock()&&0===n.parent.children.indexOf(n)&&n.parent.parent instanceof Ne){const t=n.parent.parent;if(0!==(null!==(e=t.nestList)&&void 0!==e?e:[]).indexOf(n.parent)){const t=this.getPreviousBlock(n);return t?this.getBlockLastNode(t):null}const s=t.children;return s.length>0?s[s.length-1]:null}const t=this.getPreviousBlock(n);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,n=e.children.indexOf(t);if(e.children[n+1])return e.children[n+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,n=e.children.indexOf(t),s=e.parent;if(e.isListItemBlock()){const t=s.parent;return 0===n&&Array.isArray(s.children)&&s.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===s}return 0===n&&Array.isArray(s.children)&&s.children[0]===e}getPreviousBlock(t){var e;if(t.parent instanceof Ne){const n=null!==(e=t.parent.nestList)&&void 0!==e?e:[],s=n.indexOf(t);if(s>0)return n[s-1];if(0===s)return t.parent}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.typeName}}class Ie extends S{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class Be extends rt{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new vt(this.range)}}Be.typeName="SelectionChangeAction";class De extends X{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(De.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${De.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return f(t,`.${De.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}De.typeName="RTEDecoratorNode",De.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",De.DECORATOR_NODE_CLASS="v-internal-decorator-node";class Me extends k{constructor(){super(...arguments),this.stylesToBeFiltered=Me.STYLES,this.elementTagName="pre code"}canFilter(t){return I.isCodeBlockNode(t)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Me.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 Fe extends De{constructor(t,e,n,s){super(t),this.type=_.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n,this.annotationMap.set(j.CUSTOM_STYLE,new G(Me.STYLES))}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}getPlainText(){return this.text}toHtml(t){return`<code${this.generateAttributeString(t)}>${O(this.text)}</code>`}clone(t){return new Fe(this.id,this.text,this.language,t)}doAnnotationActionApply(t){H.executeTheStrategy(t,this)}doModifyActionApply(t){H.executeTheStrategy(t,this)}}Fe.typeName="RTECodeBlockNode",H.register(x.UPDATE_CODE_BLOCK,Fe.typeName,new class extends At{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),H.register(Be.typeName,Fe.typeName,new class extends At{handleAction(t,e){e.annotationMap.set(p.SELECTION_RANGE,t.toAnnotation())}});var Pe;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(Pe||(Pe={}));class He extends At{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 Et(e)))}}class Je extends k{constructor(){super(...arguments),this.stylesToBeFiltered=Je.STYLES,this.elementTagName="pre"}canFilter(t){return I.isCodeBlock(t.typeName)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Je.STYLES={backgroundColor:"rgba(var(--v-bg-secondary, 245, 247, 247, 1))",padding:"12px"};class Ke extends Y{constructor(t,e,n){super(t),this.type="code-block",this.annotationMap=new Map([G.from(Je.STYLES)]),this.children=[new Fe(`${t}-1`,e,n,this)]}static from(t){return new Ke(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=Pe["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=Ke.from(this.toJSON());return e.parent=t,e}apply(s){if(s instanceof S&&H.executeTheStrategy(s,this),s.isFlushable){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(p.SELECTION_RANGE)}}Ke.typeName="RTECodeBlock",H.register(x.DELETE_CODE_BLOCK,Ke.typeName,new class extends $e{handleAction(t,e){const n=e.children[0],s=e.parent;if(s){let t=this.getPreviousNode(n),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(n),r=0),s.apply(new Et(e));const i=t?A.getDOMByEntity(t):null;if(0===s.children.length){const n=Ee.from({id:u(),type:"paragraph",nodes:[{id:u(),type:"text",text:""}]});e.parent.apply(new Z([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const c=A.getDOMByEntity(o);if(c){const o=e.getSubjectFromParentNodeByEventId(c,s);o&&t.notify(o,{node:n,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),H.register(x.DELETE_CHILDREN,Ke.typeName,new He),H.register(x.SWITCH_OUT_FROM_CODE_BLOCK,Ke.typeName,new class extends At{handleAction(n,r){const{content:i,language:o}=n,c=i.split("\n"),a=new Ie(c.slice(0,c.length-2).join("\n"),o);a.isFlushable=!1,r.children[0].apply(a);const l=Ee.from({id:u(),type:"paragraph",nodes:[{id:u(),text:"",type:"text"}]});r.parent.apply(new St(r,l));const h=A.getDOMByEntity(r);if(h){const n=e.getSubjectFromParentNodeByEventId(h,s);n&&t.notify(n,{node:l.children[0]})}}}),H.register(x.INSERT_IMAGE_TO_BLOCK,Ke.typeName,new class extends At{handleAction(t,e){e.parent.apply(new St(e,t.imageBlockToBeInserted))}}),Ke.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{ut as $,H as A,m as B,j as C,zt as D,$ as E,_ as F,J as G,Dt as H,St as I,T as J,yt as K,ge as L,S as M,R as N,Tt as O,ye as P,Oe as Q,pe as R,xe as S,$e as T,ce as U,Bt as V,He as W,Re as X,be as Y,_e as Z,ht as _,X as a,y as a0,Rt as a1,kt as a2,dt as a3,pt as a4,ft as a5,st as a6,Le as a7,I as a8,je as a9,gt as aA,g as aB,Qt as aC,te as aD,ne as aE,Te as aF,Ce as aG,_t as aH,$t as aI,Wt as aJ,Gt as aK,Pt as aL,Ft as aM,Ht as aN,M as aa,Lt as ab,Q as ac,B as ad,Je as ae,Me as af,Xt as ag,E as ah,wt as ai,mt as aj,v as ak,N as al,b as am,P as an,Pe as ao,U as ap,It as aq,jt as ar,at as as,Ie as at,Be as au,fe as av,Mt as aw,ee as ax,se as ay,it as az,Y as b,Ee as c,Jt as d,W as e,At as f,Z as g,Ae as h,p as i,x as j,rt as k,Et as l,K as m,q as n,k as o,De as p,Ke as q,Ne as r,A as s,Fe as t,G as u,V as v,L as w,C as x,Ut as y,Kt as z}
|