@globalpayments/vega 2.103.0 → 2.104.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-007d10db.js} +1 -1
- 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 +11 -11
- 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-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 +14 -14
- 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 +11 -11
- package/dist/cjs/{y-axis-input-processor-d3a3839c.js → y-axis-input-processor-9ba96716.js} +1 -1
- 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/helpers/translation/locales/en.js +4 -0
- 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-aaea8aaf.js} +1 -1
- 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 +11 -11
- 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-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 +14 -14
- 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 +11 -11
- package/dist/esm/{y-axis-input-processor-c6b2a914.js → y-axis-input-processor-dd574c2e.js} +1 -1
- package/dist/sri/vega-sri-manifest.json +338 -338
- 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/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-eb945d34.entry.js → p-06a0c795.entry.js} +1 -1
- package/dist/vega/p-09ed519b.entry.js +1 -0
- 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-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-ac98c189.entry.js → p-26fdf04e.entry.js} +1 -1
- package/dist/vega/{p-3283fa2f.js → p-2a501c55.js} +1 -1
- package/dist/vega/p-2e847194.js +1 -0
- package/dist/vega/{p-f9d09b0c.js → p-3040c091.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-7874055b.entry.js → p-35de277a.entry.js} +1 -1
- 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-1f1f93bf.entry.js → p-3a153581.entry.js} +1 -1
- package/dist/vega/p-46d34326.js +1 -0
- package/dist/vega/{p-ca1fe571.entry.js → p-48470109.entry.js} +1 -1
- package/dist/vega/p-4a2e040f.entry.js +1 -0
- package/dist/vega/{p-6e16bb3a.js → p-4ad6da8f.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-fee080b9.entry.js → p-5025f7b6.entry.js} +1 -1
- package/dist/vega/{p-b63a90b3.entry.js → p-53838cd1.entry.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-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-df9585f6.js → p-68e70f75.js} +1 -1
- package/dist/vega/{p-608d3559.entry.js → p-6902bcaf.entry.js} +1 -1
- package/dist/vega/{p-1a4d1991.entry.js → p-6a13ba24.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-abe5f7f0.entry.js → p-70659d97.entry.js} +1 -1
- package/dist/vega/{p-018bb83b.entry.js → p-7157dd20.entry.js} +1 -1
- package/dist/vega/{p-3b911043.entry.js → p-74b54dcc.entry.js} +1 -1
- 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-27e77ea1.entry.js → p-88ada88b.entry.js} +1 -1
- package/dist/vega/{p-e6b0a292.entry.js → p-892f3e98.entry.js} +1 -1
- package/dist/vega/{p-dcfce26e.entry.js → p-8a9e80ac.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-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-a7ed55d8.js +1 -0
- package/dist/vega/{p-c08ac33f.entry.js → p-ab6c13d9.entry.js} +1 -1
- package/dist/vega/{p-3567dc55.entry.js → p-afa8a9af.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-3b4e2ba0.js → p-c0eddde0.js} +1 -1
- package/dist/vega/{p-dc83fa6b.entry.js → p-c11b20c0.entry.js} +1 -1
- package/dist/vega/{p-4cdc064d.entry.js → p-c3532738.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-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-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-8ac0b1b2.entry.js → p-dcdd7098.entry.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-4e4b50f3.entry.js → p-e67ef7a1.entry.js} +1 -1
- package/dist/vega/{p-8de29082.entry.js → p-ea97ec60.entry.js} +1 -1
- package/dist/vega/{p-8e59606f.entry.js → p-ebc1e0da.entry.js} +1 -1
- package/dist/vega/{p-45af801f.js → p-f2193656.js} +1 -1
- package/dist/vega/{p-9a96fb05.entry.js → p-f5f78884.entry.js} +1 -1
- package/dist/vega/p-f839e009.entry.js +1 -0
- package/dist/vega/{p-9153c2f5.entry.js → p-fa970e96.entry.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/{p-a9fc4043.js → p-fffc1f47.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-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-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{g as t}from"./p-8b5d3a52.js";import{a as e,g as n,D as s,f as i,r,b as a}from"./p-aa135628.js";import{L as o,I as l}from"./p-6e1ab235.js";import{I as c,D as h,c as d}from"./p-5c285374.js";import{I as u}from"./p-781fd6e0.js";import{c as p}from"./p-6a334573.js";import{P as f}from"./p-81dd00d0.js";import{i as g}from"./p-29584bb5.js";import{V as w}from"./p-affb40e8.js";import{I as m}from"./p-a60d75d9.js";import{M as v,A as b,R as y,H as x,a as C,s as L,b as T,c as A,N as S,d as k,e as E,f as O,I,g as R,h as B,i as N,j as M,B as j,k as H,l as D,C as _,m as P,n as V,o as $,p as F,S as z,U as K,q as W,r as q,t as U,u as G,v as Z,w as Q,x as J,y as Y,z as X,D as tt}from"./p-f9d09b0c.js";import{U as et,V as nt,B as st,E as it,h as rt,H as at,I as ot,R as lt,a as ct,P as ht,A as dt,S as ut,b as pt,C as ft}from"./p-df9585f6.js";import{a as gt,b as wt,e as mt}from"./p-3b4e2ba0.js";import{V as vt}from"./p-44245a36.js";import{i as bt}from"./p-fdbdf12f.js";import{v as yt}from"./p-4866e390.js";import{b as xt,A as Ct,R as Lt,h as Tt,c as At,I as St}from"./p-8ea41806.js";import{R as kt,a as Et,S as Ot,T as It,b as Rt,c as Bt,d as Nt,e as Mt,C as jt,M as Ht,f as Dt,g as _t,h as Pt,i as Vt,j as $t,k as Ft,l as zt,m as Kt,n as Wt,o as qt,p as Ut,q as Gt,s as Zt,r as Qt,t as Jt,I as Yt,u as Xt,v as te,w as ee,x as ne,y as se,z as ie,A as re,B as ae,D as oe,E as le,F as ce,G as he,H as de,J as ue,K as pe,L as fe,N as ge,O as we,P as me,Q as ve,U as be,W as ye,X as xe,Y as Ce}from"./p-08bf08d2.js";import{C as Le}from"./p-2d0d575f.js";import{D as Te,d as Ae}from"./p-36a57431.js";import{V as Se,a as ke,b as Ee}from"./p-53e3f259.js";import{r as Oe}from"./p-77e64f26.js";import{V as Ie,a as Re}from"./p-d1f47512.js";import{V as Be,a as Ne,b as Me,c as je}from"./p-a83cef5a.js";import{t as He}from"./p-b75ee3ba.js";import{p as De}from"./p-0c667d6a.js";import{c as _e}from"./p-a841cf13.js";import{d as Pe}from"./p-1bc5b3bc.js";import{c as Ve}from"./p-02841589.js";import{c as $e}from"./p-890a5254.js";const Fe=[{payloadKey:"IS_LOAD_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaLoaderController is called",canAccept:(t,e)=>"VegaLoaderController"===t&&"load"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSE_METHOD_CALLED",payloadDescription:"Indicate if the method close of public API VegaLoaderController is called",canAccept:(t,e)=>"VegaLoaderController"===t&&"close"===e,payloadValue:()=>!0}];class ze extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(ze,["load","close"],Fe,ze.typeName)}load(t={}){let e=t.containerSelector||"body",n=document.querySelector(e);if(n&&ze.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY.includes(n.tagName)&&(e="body",n=document.querySelector("body")),!n)return o.error("Container is not found by selector: ",e),null;const s=this.createLoadingIndicator(t.indicatorOptions),i=this.createLoader(e);return i.append(s),this.appendLoader(i,n)}close(t){const e=this.findLoader(t);if(e){if(e.dataset.container){const t=document.querySelector(e.dataset.container);t&&t.dataset.vegaLoaderOriginPosition&&(t.style.position=t.dataset.vegaLoaderOriginPosition)}e.remove()}}findLoader(t){var e,n;let s;if(t.includes(">>>")){const[i,r]=t.split(">>>");s=null===(n=null===(e=document.querySelector(i))||void 0===e?void 0:e.shadowRoot)||void 0===n?void 0:n.getElementById(r)}else s=document.getElementById(t);return s}createLoader(n){const s=document.createElement("vega-loader-wrapper");return s.className=e(["body"===n?"fixed-wrapper":"absolute-wrapper"]),s.dataset.container=n,s.id=`vega-loader-${t()}`,s}createLoadingIndicator(t={}){const e=document.createElement("vega-loading-indicator");return Object.assign(e,t),e}appendLoader(t,e){return e.dataset.vegaLoaderOriginPosition=e.style.position,e.style.position="relative",e.shadowRoot?(e.shadowRoot.append(t),`${t.dataset.container}>>>${t.id}`):(e.append(t),t.id)}}ze.typeName="VegaLoaderController",ze.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY=["VEGA-MODAL"],function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],ze.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Ke=new ze,We=[{payloadKey:"IS_OPEN_METHOD_CALLED",payloadDescription:"Indicate if the method open of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"open"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSE_METHOD_CALLED",payloadDescription:"Indicate if the method close of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"close"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSEALL_METHOD_CALLED",payloadDescription:"Indicate if the method closeAll of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"closeAll"===e,payloadValue:()=>!0}];var qe=function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};class Ue extends h{constructor(){super(...arguments),this.resizeObserverSlimmer=p(Ue,f,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"}],[{callback:t=>{var e;!(t[0].contentRect.height>0)&&(null===(e=this.container)||void 0===e?void 0:e.classList.contains("hydrated"))&&(u.removeZIndex(this.container,"top"),this.container.remove(),this.container=null)},target:()=>this.container}]),this.vegaPublicAPIRuntimeMetricsSlimmer=d(Ue,["open","close","closeAll"],We,Ue.typeName)}async open(t){const e=this.createPageNotification(t);return this.getContainer().append(e),e.id}async closeAll(){this.container&&Array.from(this.container.children).forEach((t=>{t.close()}))}async close(t){await document.getElementById(t).close()}connectResizeObserver(){}createPageNotification(e){const i=document.createElement("vega-page-notification");return Object.keys(e).forEach((t=>{void 0!==e[t]&&(i[t]=e[t])})),i.style.marginBottom=n()===s.MOBILE?"12px":"16px",i.id=`vega-page-notification-${t()}`,i}getContainer(){return this.container||(this.container=document.createElement("vega-page-notification-list"),u.setZIndex(this.container,"top"),n()===s.MOBILE?this.container.classList.add("vega-page-notification-list-bottom"):this.container.classList.add("vega-page-notification-list-topRight"),document.body.append(this.container),this.connectResizeObserver()),this.container}}Ue.typeName="VegaNotifyController",qe([l()],Ue.prototype,"resizeObserverSlimmer",void 0),qe([c()],Ue.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Ge=new Ue,Ze=[{payloadKey:"IS_SETSEMANTICS_METHOD_CALLED",payloadDescription:"Indicate if the method setSemantics of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:()=>!0},{payloadKey:"IS_GETSEMANTICS_METHOD_CALLED",payloadDescription:"Indicate if the method getSemantics of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"getSemantics"===e,payloadValue:()=>!0},{payloadKey:"IS_GETENABLEDEVENTIDSBYCOMPONENT_METHOD_CALLED",payloadDescription:"Indicate if the method getEnabledEventIdsByComponent of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"getEnabledEventIdsByComponent"===e,payloadValue:()=>!0},{payloadKey:"globalEventIsNative",payloadDescription:"Indicate if the vega components will emit events without the vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>!(!t.global||"native"!==t.global.namespace)},{payloadKey:"eventOfSpecificComponentsIsNative",payloadDescription:"Indicate if the vega components will emit events with the vega prefix, but special components will emit events without vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.components){const t=Object.keys(e.components);return!!(t.length>0&&"native"===e.components[t[0]].namespace)}return!1}},{payloadKey:"eventOfSpecificComponentsIsVega",payloadDescription:"Indicate if the vega components will emit events without the vega prefix, but special components will emit events with vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.global&&e.components){const t=Object.keys(e.components);return!!("native"===e.global.namespace&&t.length>0&&"vega"===e.components[t[0]].namespace)}return!1}},{payloadKey:"globalJqueryDelegatedEventIsTrue",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>!(!t.global||!0!==t.global.jqueryDelegatedEvent)},{payloadKey:"jqueryDelegatedEventIsCustomStrategy",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;return!!(e.global&&Array.isArray(e.global.jqueryDelegatedEvent)&&e.global.jqueryDelegatedEvent.length>0)}},{payloadKey:"jqueryDelegatedEventOfSpecialComponentsIsTrue",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.components){const t=Object.keys(e.components);return!!(t.length>0&&!0===e.components[t[0]].jqueryDelegatedEvent)}return!1}}];class Qe extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(Qe,["setSemantics","getSemantics","getEnabledEventIdsByComponent"],Ze,Qe.typeName)}setSemantics(t){g.setSemantics(t)}getSemantics(t){return g.getSemantics(t)}getEnabledEventIdsByComponent(t){return g.getEnabledEventIdsByComponent(t)}}Qe.typeName="VegaEventManager",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],Qe.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Je=new Qe,Ye=[{payloadKey:"IS_OVERRIDEZINDEXBASICVALUES_METHOD_CALLED",payloadDescription:"Indicate if the method overrideZIndexBasicValues of public API ZIndexManager is called",canAccept:(t,e)=>"VegaZIndexManager"===t&&"overrideZIndexBasicValues"===e,payloadValue:()=>!0},{payloadKey:"zIndexBasicValuesGreatThanTenThousand",payloadDescription:"Indicate if the basic z-index value is great than ten thousand",canAccept:(t,e)=>"VegaZIndexManager"===t&&"overrideZIndexBasicValues"===e,payloadValue:t=>t.base>1e4}];class Xe extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(Xe,["overrideZIndexBasicValues"],Ye,Xe.typeName)}overrideZIndexBasicValues(t){u.overrideZIndexBasicValues(t)}}Xe.typeName="VegaZIndexManager",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],Xe.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const tn=new Xe,en=[{payloadKey:"IS_WAITFORVEGA_METHOD_CALLED",payloadDescription:"Indicate if the method waitForVega of public API WaitForVegaHandler is called",canAccept:(t,e)=>"WaitForVegaHandler"===t&&"handle"===e,payloadValue:()=>!0}];class nn extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(nn,["handle"],en,nn.typeName)}async handle(){return await Promise.all(Array.from(document.querySelectorAll("*:not(.hydrated)")).filter((t=>t.tagName.startsWith("VEGA"))).map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)})))}}nn.typeName="WaitForVegaHandler",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],nn.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const sn=new nn,rn=async()=>sn.handle(),an=[{payloadKey:"IS_LOAD_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"load"===e,payloadValue:()=>!0},{payloadKey:"IS_UNLOAD_METHOD_CALLED",payloadDescription:"Indicate if the method unLoad of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"unLoad"===e,payloadValue:()=>!0},{payloadKey:"IS_UNLOADALL_METHOD_CALLED",payloadDescription:"Indicate if the method unLoadAll of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"unLoadAll"===e,payloadValue:()=>!0}];class on extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(on,["load","unLoad","unLoadAll"],an,on.typeName),this.loaderMap=new Map}load({target:e,type:n="text",width:s,height:i,items:r,layout:a}){const o=Array.from(document.body.querySelectorAll(e)),l=`vega-skeleton-loader-${t()}`,c=[];return o.forEach((t=>{const e=r?r.map(this.createSkeleton):[this.createSkeleton({type:n,width:s,height:i})],o=(a?[this.wrapLayout(e,a)]:e).map((t=>(t.dataset[on.LOADER_DATA_SET_KEY]=l,t)));c.push(...o),t.append(...o)})),this.loaderMap.set(l,c),l}unLoad(t){this.loaderMap.has(t)&&(this.loaderMap.get(t).forEach((t=>t.remove())),this.loaderMap.delete(t))}unLoadAll(){for(const t of this.loaderMap.values())t.forEach((t=>t.remove()));this.loaderMap.clear()}createSkeleton(t){const{type:e,width:n,height:s}=t,i=document.createElement("vega-skeleton");return Object.assign(i,{animated:!0,type:e,width:n,height:s}),i}wrapLayout(t,e){const n=document.createElement("vega-flex");return Object.assign(n,Object.assign({className:"vega-skeleton-loader-template-container"},e.props)),Object.assign(n.style,e.style),n.append(...t),n}}on.typeName="VegaSkeletonLoaderController",on.LOADER_DATA_SET_KEY="vegaSkeletonLoaderKey",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],on.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const ln=new on,cn=[{payloadKey:"IS_INIT_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaTranslation.init is called",canAccept:(t,e)=>"TranslationController"===t&&"init"===e,payloadValue:()=>!0},{payloadKey:"IS_CHANGE_LANGUAGE_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaTranslation.changeLanguage is called",canAccept:(t,e)=>"TranslationController"===t&&"changeLanguage"===e,payloadValue:()=>!0}];class hn extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(hn,["init","changeLanguage"],cn,hn.typeName)}get currentLanguage(){return w.currentLanguage}init(t){w.init(t)}changeLanguage(t){w.changeLanguage(t)}}hn.typeName="TranslationController",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],hn.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const dn=new hn;class un{static fromDate(t,e="month",n,s=!0){const i=m.createCalendarPeriod(t,e,n,s);return m.toCalendarPeriodType(i)}}class pn extends v{constructor(t,e){super(),this.type="INSERT_TOKEN_NODE",this.rteRange=null,this.actionHandleResult=!1,this.rteRange=t,this.token=e}}class fn extends xt{constructor(t){super(),this.tokenList=[],this.tokenList=t}render(t,e){return this.renderDropdown(t,e,{},[this.renderButton(t,e,{label:"Tokens",ariaLabel:"Tokens",showArrowIcon:!0,tooltip:{text:"Insert token"}}),this.renderDropdownListTemplate(t,this.tokenList,e)])}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,[s]=n();return s?t.disabled||!b.canHandle("INSERT_TOKEN_NODE",s.parent):t.disabled}return!1}handleButtonClick(t){}handleDropdownClick(t,e){const n=this.getListItemByKey(this.tokenList,t),{rteRange:s}=e,{startNode:i}=s;if(i&&i.parent){const t=new pn(s,n);i.parent.apply(t),t.actionHandleResult&&this.flushEditorUI(e)}}flushEditorUI(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,flushValue:n}=e;n(t.value)}}}class gn extends y{constructor(t,e,n,s,i){super(t,n,s,i),this.type="token",this.token=e,this.text=n}static from(t,e){const n=new gn(t.id,t.token,t.text,e);return t.annotations&&(n.annotationMap=this.generateTextAnnotationMap(t.annotations)),n}toJSON(){const t=super.toJSON();return Object.assign({id:this.id,type:this.type,text:this.text,token:this.token},t.annotations?{annotations:t.annotations}:{})}isContentEditable(){return!1}clone(t){return new gn(this.id,this.token,this.text,t,this.annotationMap)}toHtml(){return`<span class="token" contenteditable="false" template-token-key="${this.token}" token-key="${this.token}"${super.generateAttributeString()}>${this.text}</span>`}renderHtmlFromDepth(t,e){const n=this.getInlineHtmlAnnotationAtDepth(t);return n?this.renderTokenWithWrapperStr(n):this.toHtml()}renderTokenWithWrapperStr(t){const{htmlTag:e,child:n}=t,s=this.inlineHtmlAnnotationAttrStr(t);return n?`<${e}${s}>${this.renderTokenWithWrapperStr(n)}</${e}>`:x.has(e)?`<${e}${s}>`:`<${e}${s}>${this.toHtml()}</${e}>`}inlineHtmlAnnotationAttrStr(t){const{customAttribute:e,customClass:n,customStyle:s}=t,i=[...(null==e?void 0:e.toString())||[],null==n?void 0:n.toString(),null==s?void 0:s.toString()].filter(bt);return i.length>0?` ${i.join(" ")}`:""}}gn.typeName="RTETokenNode";class wn extends gt{doRender(t,e,n){const{id:s,token:i}=e;return t("span",Object.assign(Object.assign({key:s,"template-token-key":i,"token-key":i,contenteditable:"false",style:e.getStyles(),class:`token ${e.getClasses()}`},this.additionalAttributes(e)),{ref:this.useRef(e),onClick:t=>{t.preventDefault(),n&&!1!==n.editable&&this.handleTokenElementClick(t,e,n.host)}}),e.text)}injectRTEScopeStyles(){return"span[token-key]{padding: 0 2px; margin: 0 1px; background-color: rgba(var(--v-bg-status-info, 205,209,211))}"}handleTokenElementClick(t,e,n){t.preventDefault(),n&&n.value.apply(new et(e,void 0,!0))}additionalAttributes(t){const e=t.getCustomAttributesAnnotation();let n={wrapped:"true"};return e&&(n=Object.assign(Object.assign({},n),e.render())),n}}wn.typeName="RTETokenNodeRenderer";class mn extends xt{constructor(t,e,n=""){super(),this.languageList=[],this.languageChangeCallback=null,this.selectedLanguage="",this.labelRef=null,this.translation=null,this.handleDropdownClick=t=>{this.setSelectedLanguage(t),"function"==typeof this.languageChangeCallback&&this.languageChangeCallback(t)},this.languageList=t,this.languageChangeCallback=e,this.selectedLanguage=n}setSelectedLanguage(t){var e;if(this.selectedLanguage=t,(null===(e=this.labelRef)||void 0===e?void 0:e.firstChild)&&this.translation){const e=this.getLanguageLabelByKey(t);this.labelRef.firstChild.nodeValue=this.translation.t(e)}}isHidden(){return!1}render(t,e){const n=this.languageList.map((t=>this.translateDropdownEntry(t,e)));return this.renderDropdown(t,e,{source:n},[this.renderButton(t,e,{label:this.getLanguageLabelByKey(this.selectedLanguage),ariaLabel:"Language",showArrowIcon:!0,tooltip:{text:"Select language"}})])}renderButtonLabel(t,e,n){return this.translation=e.translation,t("vega-font",{variant:"font-field-label-sm",color:this.isDisabled(e)?"text-disabled":"text-primary","aria-hidden":"true",ref:t=>{this.labelRef=t}},e.translation.t(n))}handleButtonClick(t){}getLanguageLabelByKey(t){var e;const n=this.getListItemByKey(this.languageList,t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:"Select Language"}translateDropdownEntry(t,e){const n=e.translation.t(t.label);return Object.assign(Object.assign({},t),"children"in t?{label:n,children:t.children.map((t=>this.translateDropdownEntry(t,e)))}:{label:n})}}class vn extends wt{constructor(t,e){super(),this.languageToolbarButtonRenderer=null,this.languageState={selectedLanguage:"",contentMap:{}},this.languageChangeCallBack=t=>{const e=this.languageState.selectedLanguage;this.extensionContext&&e&&(this.languageState.contentMap[e]=this.getRTELatestValue(this.extensionContext.host)),this.languageState.selectedLanguage=t,this.applyLanguageContent(t,this.languageState.contentMap)},this.languageList=t,e&&(this.languageState=Object.assign(Object.assign({},this.languageState),e)),!this.languageState.selectedLanguage&&t.length>0&&(this.languageState.selectedLanguage=t[0].key)}prepareBeforeLoad(t){this.languageToolbarButtonRenderer=new mn(this.languageList,this.languageChangeCallBack,this.languageState.selectedLanguage),this.registerToolbarButtonRenderer(vn.TOOLBAR_BUTTON_KEY,this.languageToolbarButtonRenderer,t)}initialExtensionAfterLoad(t){super.initialExtensionAfterLoad(t);const{selectedLanguage:e,contentMap:n}=this.languageState;this.languageToolbarButtonRenderer&&this.languageToolbarButtonRenderer.setSelectedLanguage(e),n&&n[e]&&this.applyLanguageContent(this.languageState.selectedLanguage,this.languageState.contentMap)}setState(t){const{selectedLanguage:e,contentMap:n}=t;this.languageToolbarButtonRenderer&&this.languageToolbarButtonRenderer.setSelectedLanguage(e),this.languageState.selectedLanguage=e,this.languageState.contentMap=Object.assign({},n),this.applyLanguageContent(e,n)}getState(){const{selectedLanguage:t,contentMap:e}=this.languageState;return this.extensionContext&&(e[t]=this.getRTELatestValue(this.extensionContext.host)),this.languageState}applyLanguageContent(t,e){if(this.extensionContext&&e){let n=e[t];const{host:s,flushValue:i}=this.extensionContext;n=n?n instanceof nt?n:nt.fromJSON(n,s.sourceEditConfig):nt.createEmptyContent(),s.value!==n&&i(n,!0)}}getRTELatestValue(t){var e;let n=t.value;if(this.extensionContext&&this.extensionContext.isSourceEditMode()&&t.shadowRoot){const s=t.shadowRoot.querySelector(".source-view-container vega-code-block");if(s){let i;t.sourceEditConfig&&(i={autoMatchFormat:null===(e=t.sourceEditConfig.autoMatchFormat)||void 0===e||e,filterInlineStyles:t.sourceEditConfig.filterInlineStyles,blockBoundaryRegistry:this.extensionContext.blockBoundaryRegistry}),n=nt.fromHtml(s.value.code,i)}}return n}}vn.TOOLBAR_BUTTON_KEY="languages";class bn extends v{constructor(t){super(),this.type="INSERT_FUNCTION_BLOCK",this.functionType=t}}const yn=["statement","statementelement","statementsyntax"];class xn extends C{constructor(t,e,n){super(t),this.type="logic-control-node",this.text="",this.text=e,this.parent=n}clone(){return new xn(this.id,this.text,this.parent)}toHtml(){return this.text}toJSON(){return{id:this.id,type:this.type,text:this.text}}getRangeEndOffset(){return 1}getRangeContainer(){const t=L.getDOMByEntity(this);if(t)return t.parentElement}isContentEditable(){return!1}getPlainText(){return this.text}}xn.typeName="RTELogicControlNode";class Cn extends T{constructor(t,e,n){super(t),this.type="logic-control-block",this.children=[],this.statementText="",this.statementText=e,this.children=[new xn(`${t}-node-1`,e,this)],n&&(this.parent=n)}static from(t){return new Cn(t.id,t.statementText)}isNotEmpty(){return!0}getLastNode(){return this.children[this.children.length-1]}toHtml(){return`<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`}clone(t){return new Cn(this.id,this.statementText,t)}toJSON(){return{id:this.id,type:this.type,statementText:this.statementText}}}Cn.typeName="RTELogicControlBlock";class Ln extends T{constructor(t){super(t),this.type="function-block",this.children=[]}static from(t,e){const n=new Ln(t.id),s={customClass:["statement"]};let{annotations:i}=t;return i=i?Object.assign(Object.assign({},i),s):s,super.convertAnnotationsToMap(n.annotationMap,i),n.children=this.generateBlockChildren(t.children,e,n),this.unwrapForeachContent(n.children),n}static unwrapForeachContent(t){t.forEach(((e,n)=>{const s=t[n+1];e instanceof Cn&&"FOREACH"===e.statementText&&s instanceof A&&s.children.forEach((t=>{const e=t.getAnnotationByType(S.INLINE_HTML);"div"===(null==e?void 0:e.htmlTag)&&(e.child?t.annotationMap.set(S.INLINE_HTML,e.child):t.annotationMap.delete(S.INLINE_HTML))}))}))}toHtml(){const t=this.children.map((t=>t instanceof A?`<div class="statementelement"${this.getFunctionContentStyle(t)}>${t.getChildrenHtml()}</div>`:t.toHtml())).join("");return`<div class="statement" ${k}>${t}</div>`}clone(e){const n=new Ln(t());return n.parent=e,n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n}getLastNode(){return this.children[this.children.length-1].getLastNode()}allowsCaretDescend(){return!1}isNotEmpty(){return this.children.length>0}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,children:this.children.map((t=>t.toJSON()))})}getFunctionContentStyle(t){const e=new E(t);let n=e.toCssText({standalone:!0});const s=t.getAnnotationByType("TEXT_STYLE");if(s&&"paragraph"===s.textStyle){const t=e.toCssText(void 0,void 0,s.renderStyle({standalone:!0}));n=n.replace(t,"").trim()}return n?` style="${n}"`:""}}Ln.typeName="RTEFunctionBlock";class Tn extends O{handleAction(t,e){const{functionType:n}=t,s=this.getFunctionBlock(n),i=this.createNewParagraph(""),r=this.getReferenceBlock(e);r?r.parent.apply(new I(r,s,i)):e.apply(new R([s,i])),i&&(t.nextFocusNode=i.children[0])}getFunctionBlock(e){const n=t();return Ln.from({id:n,type:"function-block",children:[{id:`${n}-1`,type:"logic-control-block",statementText:e.toUpperCase()},{id:`${n}-2`,annotations:{customClass:["statementelement"]},type:"paragraph",nodes:[{id:`${n}-2-1`,type:"text",text:" "}]},{id:`${n}-3`,type:"logic-control-block",statementText:"SHOW"},{id:`${n}-4`,annotations:{customClass:["statementelement"]},type:"paragraph",nodes:[{id:`${n}-4-1`,type:"text",text:" "}]}]})}getReferenceBlock(t){if(!(t instanceof nt)){const e=t.parent;return e instanceof Ln?e:t}}}class An extends xt{render(t,e){return this.renderDropdown(t,e,{},[this.renderButton(t,e,{label:"Functions",ariaLabel:"Functions",showArrowIcon:!0,tooltip:{text:"Insert function"}}),this.renderDropdownListTemplate(t,An.FUNCTION_LIST,e)])}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,s=n()[0];let i=!0;return s&&(i=b.canHandle("INSERT_FUNCTION_BLOCK",s.parent)),t.disabled||!i}return!1}handleButtonClick(){throw new Error("Method not implemented.")}handleDropdownClick(t,e){if(e){const n=this.getExtensionContext(e.host);if(n){const{host:e,getSelectedNodes:s}=n,i=s()[0],r=new bn(t);i?i.parent&&i.parent.apply(r):e.value.apply(r),r.nextFocusNode&&e.value.apply(new et(r.nextFocusNode,1))}}}}An.FUNCTION_LIST=[{key:"IF",label:"Conditional"},{key:"FOREACH",label:"Foreach"}];class Sn extends gt{doRender(t,e){return t("div",{key:e.id,class:"statementsyntax",ref:this.useRef(e)},t("span",{key:`${e.id}-1`,contenteditable:"false",ref:this.useRef(e.children[0])},e.statementText))}}Sn.typeName="RTELogicControlBlockRenderer";const kn=t=>t.hasAttribute(k)||yn.some((e=>t.classList.contains(e))),En=t=>t.hasAttribute(k)||t.classList.contains("statement");class On extends st{constructor(){super(...arguments),this.blockClassName="statementsyntax"}canHandle(t,e){const n=t[e];return n&&n.nodeType===Node.ELEMENT_NODE&&n.classList.contains(this.blockClassName)&&this.isFunctionBlockChild(n)?1:0}handle(e){const n=e[0];return Cn.from({id:t(),type:"logic-control-block",statementText:n.innerText})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isFunctionBlockChild(t){return!(!t.parentElement||!En(t.parentElement))}}class In extends gt{doRender(t,e){return t("div",{key:e.id,class:this.getElementClassName(e),[k]:"",ref:this.useRef(e)})}injectRTEScopeStyles(){return"div.statement{padding:2px 4px;background:rgba(var(--v-bg-accent3-secondary, 255, 239, 200));border:1px solid rgba(var(--v-bg-accent3-primary, 255, 220, 131));border-radius:4px;display:flex;flex-direction:row;justify-content:flex-start;align-items:stretch;gap:4px}div.statement .statementsyntax{padding:3px 0;line-height:22px}.rich-text-content div.statement .statementsyntax,.rich-text-content div.statement .statementelement{display:inline-block}div.statement+div.statement{margin-top:2px}div.statement .statementsyntax span{color:rgb(38, 42, 255);font-weight:bold}div.statement .statementelement{padding:2px 4px;background:rgba(var(--v-bg-secondary, 245, 247, 247));border:1px solid rgba(var(--v-border-color-input-field, 171, 198, 216));border-radius:4px;margin:0;min-width:8px}"}getElementClassName(t){let e=t.getClasses();return e.indexOf("statement")<0&&(e="statement "+e),e.trim()}}In.typeName="RTEFunctionBlockRenderer";class Rn extends Ct{canIntercept(t,e){return e.parent&&e.parent instanceof Ln}intercept(t,e,n){const s=new ot(n.children[0],0);s.isFlushable=!0,n.parent.apply(s)}}class Bn extends O{handleAction(t,e){const n=this.createNewParagraph("");n&&(e.parent.apply(new I(e,n)),t.newBlock=n,this.focusToNextLine(n))}focusToNextLine(t){const e=this.getRootContent(t);e&&e.apply(new et(t.children[0],1))}}class Nn extends v{constructor(t,e,n){super(),this.type="PASTE_PLAIN_TEXT",this.blocksToBeInserted=t,this.startNode=e,this.startOffset=n}}class Mn extends Rn{intercept(t,e,n){const{blocksToBeInserted:s,rteRange:i}=e;let{startNode:r,startOffset:a}=e;i&&(r=i.startNode,a=i.startOffset);const o=new Nn(s,r,a);n.apply(o)}}class jn extends O{handleAction(t,e){const{blocksToBeInserted:n,startNode:s,startOffset:i}=t;if(s instanceof y){const t=n.flatMap((t=>t instanceof A?(this.copyLinkGroupAnnotations(e.annotationMap,t.annotationMap),t.children):[]));t.length>0&&(e.apply(i>0?new I(s,...t):new B(s,...t)),this.focusToNextLine(t[t.length-1],t[t.length-1].getRangeEndOffset()))}}focusToNextLine(t,e){const n=this.getRootContent(t);n&&n.apply(new et(t,e))}copyLinkGroupAnnotations(t,e){if(e&&e.has(N.LINK_GROUP)){const n=e.get(N.LINK_GROUP);t.has(N.LINK_GROUP)?n.linkGroups.forEach(((e,n)=>{t.get(N.LINK_GROUP).linkGroups.set(n,e)})):t.set(N.LINK_GROUP,e.get(N.LINK_GROUP))}}}const Hn=new On,Dn=new class extends On{constructor(){super(...arguments),this.blockClassName="statementelement"}handle(e,n){const s=rt.generate(A,e[0]);return A.from({id:t(),type:"paragraph",annotations:Object.assign({customClass:[this.blockClassName]},s),nodes:this.generateChildNodes(Array.from(e[0].childNodes),void 0,n)})}},_n=new class extends it{canHandle(t,e){const n=t[e];if(n.nodeType!==Node.ELEMENT_NODE)return 0;const s=En(n);return"DIV"===n.tagName&&s&&n.childNodes.length&&n.querySelector(".statementsyntax")?1:0}handle(){return Ln.from({id:t(),type:"function-block",annotations:{customClass:["statement"]},children:[]})}appendChildBlocks(t,e){Ln.unwrapForeachContent(e),t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}},Pn=new class extends at{canHandle(t,e){const n=t[e];if(n.nodeType!==Node.ELEMENT_NODE)return 0;const s=!!n.querySelector(`[${k}], .statement`);return"DIV"===n.nodeName&&!kn(n)&&s?1:0}};class Vn extends wt{constructor(){super(),this.unregisterBlockBoundaryPredicate=null,this.registerBlockBasicStrategies(Cn.typeName),this.registerBlockBasicStrategies(Ln.typeName),this.preventFunctionBlockDefaultInsertNewParagraph(),this.registerNode("logic-control-block",Cn),this.registerRenderer("logic-control-block",new Sn),this.registerNode("function-block",Ln),this.registerRenderer("function-block",new In),this.registerElementToBlockDTOClassStrategy(Hn),this.registerElementToBlockDTOClassStrategy(Dn),this.registerElementToBlockDTOClassStrategy(_n),this.registerElementToBlockDTOClassStrategy(Pn)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(Vn.TOOLBAR_BUTTON_KEY,new An,t)}initialExtensionAfterLoad(t){var e;super.initialExtensionAfterLoad(t),null===(e=this.unregisterBlockBoundaryPredicate)||void 0===e||e.call(this),this.unregisterBlockBoundaryPredicate=this.registerBlockBoundaryPredicate(kn)}destroyExtension(){var t;null===(t=this.unregisterBlockBoundaryPredicate)||void 0===t||t.call(this),this.unregisterBlockBoundaryPredicate=null}preventFunctionBlockDefaultInsertNewParagraph(){this.unRegisterStrategy(M.INSERT_NEW_PARAGRAPH,Cn.typeName),this.unRegisterStrategy(M.APPEND_CHILDREN,Ln.typeName),this.unRegisterStrategy(M.INSERT_CHILDREN_AFTER,Ln.typeName),this.unRegisterStrategy(M.INSERT_CHILDREN_BEFORE,Ln.typeName),this.unRegisterStrategy(M.PASTE_CONTENT,Cn.typeName),wt.registerActionHandleStrategy(Ln.typeName,M.INSERT_NEW_PARAGRAPH,new Bn)}}(()=>{const t=new Tn;wt.registerActionHandleStrategy(nt.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(A.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(lt.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(Cn.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(A.typeName,"PASTE_PLAIN_TEXT",new jn),wt.registerActionHandlerInterceptor(A.typeName,M.INSERT_NEW_PARAGRAPH,new Rn),wt.registerActionHandlerInterceptor(A.typeName,M.PASTE_CONTENT,new Mn)})(),Vn.TOOLBAR_BUTTON_KEY="functions";class $n extends v{constructor(t){super(),this.isFlushable=!0,this.type="DELETE_TABLE_BLOCK",this.tableBlock=t}}class Fn extends j{constructor(){super(...arguments),this.type=kt.CAPTION}static getDefaultStyles(){return{padding:"8px",border:"1px solid #ddd",borderBottom:"none",position:"relative",textAlign:"center",minHeight:"22px"}}clone(){return new Fn}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--extension-table-caption"}renderStyle(t){return(null==t?void 0:t.standalone)?Object.assign(Object.assign({},Fn.getDefaultStyles()),{backgroundColor:this.getCaptionBackgroundColor()}):null}toJSON(){return{caption:!0}}getCaptionBackgroundColor(){return Ie.isDarkMode()?Et.dark:Et.light}}class zn extends T{constructor(t,e){super(t),this.type="table-caption";const{autoMatchFormat:n}=e||{autoMatchFormat:!0};n&&this.annotationMap.set(kt.CAPTION,new Fn)}static from(t,e){const n=new zn(t.id,e),s=t.annotations||{},{caption:i}=s,r=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n}(s,["caption"]);return i&&n.annotationMap.set(kt.CAPTION,new Fn),super.convertAnnotationsToMap(n.annotationMap,Object.assign({},r)),n.children=super.generateBlockChildren(t.children,e,n),n}clone(t){const e=new zn(this.id);return e.children=this.children.map((t=>t.clone(e))),e.parent=t,e.annotationMap=super.cloneAnnotations(),e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.isNotEmpty()))}toHtml(t){const e=this.children.map((e=>e.toHtml(t))).join("");return`<caption${super.generateAttributeString(t)}>${e}</caption>`}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,children:this.children.map((t=>t.toJSON()))})}}zn.typeName="RTETableCaptionBlock",b.register(M.INSERT_CHILDREN_BEFORE,zn.typeName,new ct),b.register(M.PASTE_CONTENT,zn.typeName,new ht);class Kn extends v{constructor(t){super(),this.type="TOGGLE_TABLE_CAPTION",this.isFlushable=!0,this.shouldEnable=t}}class Wn extends Ot{canHandle(t){return t[0]===It.CAPTION}execute(t,e,n){const s="rte-table-caption"===t[1],i=new Kn(s),r=n.getCaption();if(s){const t=r&&r.isNotEmpty()?r:this.createCaptionBlock(null==r?void 0:r.id);r&&t===r||n.setCaption(t),i.nextFocusNode=t.getLastNode()}else r&&(n.setCaption(null),i.nextFocusNode=n.getFirstNode());this.syncCursorPosition(n,i.nextFocusNode)}syncCursorPosition(t,e){super.syncCursorPosition(t,e)}createCaptionBlock(e){const n={id:null!=e?e:t(),type:"table-caption",children:[{id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]}]};return zn.from(n)}}class qn{static generateTablePropertiesForm(t){const e=t.annotationMap.get(kt.TABLE);let n={borderStyle:"none",borderColor:"",borderWidth:"",backgroundColor:"",width:"",height:"",textAlign:"center"};if(e){const t=e.toJSON().table,{style:s="none",color:i="",width:r=""}=t.border||{style:"none",color:"",width:""};n={backgroundColor:t.backgroundColor||"",width:t.width||"",height:t.height||"",textAlign:t.alignment,borderStyle:s,borderColor:i,borderWidth:r}}return n}updateCursorPosition(t,e){t&&e&&t.host.value.apply(new et(e,0))}}class Un extends H{constructor(t){super(),this.isFlushable=!0;const{textAlign:e,width:n,borderWidth:s,borderColor:i,borderStyle:r,height:a}=t,o=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n}(t,["textAlign","width","borderWidth","borderColor","borderStyle","height"]);this.tableProperties=Object.assign(Object.assign({},o),{alignment:e,border:{style:r,color:i,width:s?De(s):""},width:n?De(n):"",height:a?De(a):""})}toAnnotation(){return new Rt(this.tableProperties)}}Un.typeName="UpdateTablePropertiesAction";class Gn extends qn{handle(t,e,n,s){e.apply(new Un(n)),this.updateCursorPosition(t,s)}}class Zn extends qn{handle(t,e,n,s){t&&t.host&&(t.flushValue(t.host.value),this.updateCursorPosition(t,s))}}class Qn extends qn{handle(t,e,n){const s=new Un(n);s.isFlushable=!1,e.apply(s)}}class Jn extends H{constructor(t,e){super(),this.isFlushable=!0,this.cellAnnotation=t,this.originAnnotation=e}toAnnotation(){return this.updateOriginAnnotation(),this.originAnnotation}updateOriginAnnotation(){Object.keys(this.cellAnnotation).forEach((t=>{this.originAnnotation[t]=this.cellAnnotation[t]}))}}Jn.typeName="RTETableCellAnnotationsAction";class Yn extends Jn{constructor(t,e){super(t,e),this.isFlushable=!0}toAnnotation(){return this.updateOriginAnnotation(),this.originAnnotation}}Yn.typeName="RTETableHeadCellAnnotationsAction";var Xn=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n};class ts{static getStyleCollectionFromCell(t){return t.reduce(((t,e)=>{const n=e.getAnnotationByType(kt.CELL);if(t[e.id]={},n){const s=n.toJSON().tableCell,{border:i}=s,r=Xn(s,["border"]),a={};i&&(a.borderStyle=i.style,a.borderColor=i.color,a.borderWidth=i.width),t[e.id]=_e(Object.assign(Object.assign({},r),a))}return t}),{})}static convertStyleMapToFormField(t){const e={};for(const n in t){const s=t[n];for(const t in s)e[t]?e[t].push(s[t]):e[t]=[s[t]]}const n=Object.keys(t).length,s={};for(const t in e){const i=e[t],r=new Set(i);i.length===n&&1===r.size&&(s[t]=i[0])}return s}applyProperties(t,e,n){t.tableSelection.getSelectedCells().forEach((t=>{const s=e[t.id];if(s){const e=this.convertToVegaTableCellAnnotation(Object.assign({},s));this.applyAnnotation(t,e,n)}}))}updateCursorPosition(t,e){t&&e&&t.host.value.apply(new et(e,0))}convertToVegaTableCellAnnotation(t){const{borderStyle:e,borderWidth:n,borderColor:s}=t,i=Xn(t,["borderStyle","borderWidth","borderColor"]),r=_e({style:e,width:n?De(n):"",color:s});return _e(Object.assign(Object.assign({},i),{backgroundColor:i.backgroundColor||"",padding:i.padding?De(i.padding):"",width:i.width?De(i.width):"",height:i.height?De(i.height):"",verticalAlign:i.verticalAlign||"",textAlign:i.textAlign||"",border:r}))}applyAnnotation(t,e,n){const s=t.getAnnotationByType(kt.CELL)||new Bt({},!1),i=t instanceof Nt?new Yn(e,s):new Jn(e,s);i.isFlushable=n,t.apply(i)}}class es extends ts{handle(t,e,n){t&&t.host&&(t.flushValue(t.host.value),this.updateCursorPosition(t,n))}}class ns extends ts{handle(t,e){this.applyProperties(t,e,!1)}}class ss extends ts{handle(t,e,n){this.applyProperties(t,e,!0),this.updateCursorPosition(t,n)}}class is{constructor(t){this.inertedContentEl=null,this.returnFocusCell=null,this.escapePressed=!1,this.keydownListenerDocument=null,this.handleDocumentKeydown=t=>{"Escape"===t.code&&this.isEventWithinPopover(t)&&(this.escapePressed=!0)},this.renderContext=t}getTableExtensionContext(){return this.renderContext?mt.getExtensionContext(this.renderContext.host):null}beginReturnFocusTracking(t){this.returnFocusCell=null!=t?t:null,this.escapePressed=!1}attachEscapeTracker(t){t.addEventListener("keydown",this.handleDocumentKeydown,{capture:!0}),this.keydownListenerDocument=t}detachEscapeTracker(){this.keydownListenerDocument&&(this.keydownListenerDocument.removeEventListener("keydown",this.handleDocumentKeydown,{capture:!0}),this.keydownListenerDocument=null)}isEventWithinPopover(t){return!1}restoreFocusOnEscapeHide(){setTimeout((()=>{const t=this.escapePressed,e=this.returnFocusCell;this.escapePressed=!1,this.returnFocusCell=null,t&&e&&e.isConnected&&this.restoreFocusToCell(e)}),0)}restoreFocusToCell(t){var e,n,s;t.focus();const i=this.getTableExtensionContext(),r=null!==(s=null!==(e=null==i?void 0:i.getSelection())&&void 0!==e?e:null===(n=t.ownerDocument)||void 0===n?void 0:n.getSelection())&&void 0!==s?s:null;if(r){const e=new Range;e.setStart(t,0),e.setEnd(t,0),r.removeAllRanges(),r.addRange(e)}}getInertContentTarget(){return null}setEditorContentInert(t){if(t){const t=this.getInertContentTarget();t&&(t.setAttribute("inert",""),this.inertedContentEl=t)}else this.inertedContentEl&&(this.inertedContentEl.removeAttribute("inert"),this.inertedContentEl=null)}}class rs extends is{constructor(t,e){super(e),this.popoverCloseType="none",this.tablePropertiesHandlerMap={save:new Zn,cancel:new Gn,change:new Qn},this.cellPropertiesHandlerMap={save:new es,cancel:new ss,change:new ns},this.handleTablePropertiesUpdate=t=>{const e=t.type.replace("vega","").toLowerCase();this.popoverCloseType=e,"change"!==e&&this.hide();const n=this.getTableExtensionContext();n&&this.tablePropertiesHandlerMap[e].handle(n,this.currentTableBlock,t.detail,this.currentFocusNode),"change"===e&&this.popoverRef.show(!0)},this.handleCellPropertiesUpdate=t=>{const e=t.type.replace("vega","").toLowerCase();this.popoverCloseType=e,"change"!==e&&this.hide();const n=this.getTableExtensionContext();n&&this.cellPropertiesHandlerMap[e].handle(n,t.detail,this.currentFocusNode),"change"===e&&this.popoverRef.show(!0)},this.tableColorSchema=t}destroy(){this.setEditorContentInert(!1),this.detachEscapeTracker(),this.selectionAnchorRef&&this.selectionAnchorRef.parentNode&&(Te.removeUniqueObserverFromNode(this.selectionAnchorRef,Se),this.selectionAnchorRef.parentNode.removeChild(this.selectionAnchorRef),this.selectionAnchorRef=null)}async show(t,e){this.beginReturnFocusTracking(e);let n=this.getTableRef();const s=this.getTableExtensionContext();let i=[];if(s&&(i=s.tableSelection.getSelectedCells()),t===It.CELL&&i.length>1){const t=this.getOrCreateSelectionAnchor(i,n);t&&(n=t)}else t===It.CELL&&1===i.length&&(n=L.getDOMByEntity(i[0]));this.updateContent(t),this.storeCurrentFocusNode(),Oe.call(Ae.getSubject(this.popoverRef,ke),n),await this.popoverRef.show(),e&&this.focusFirstFormField(t)}async hide(){await this.popoverRef.hide()}reTarget(t,e){this.getTableRef=e,this.currentTableBlock=t}render(){const t=He();if(t){const e=t.createElement("vega-popover");e.trigger="click",e.isScreenPosition=!0,e.className="rte-table-dynamic-popover",Te.addUniqueObserverToNode(e,Be,(()=>{const t=this.getTableExtensionContext();"change"===this.popoverCloseType&&t&&t.flushValue(t.host.value),this.handleDialogHide()})),this.attachEscapeTracker(t);const n=t.createElement("div");n.setAttribute("slot","popover"),n.className="rte-table-dynamic-popover-content";const s=t.createElement("vega-rich-text-table-properties");s.colors=this.tableColorSchema,s.type=It.TABLE,s.setAttribute("type",It.TABLE),s.addEventListener("vegaCancel",this.handleTablePropertiesUpdate),s.addEventListener("vegaChange",this.handleTablePropertiesUpdate),s.addEventListener("vegaSave",this.handleTablePropertiesUpdate);const i=t.createElement("vega-rich-text-table-properties");return i.colors=this.tableColorSchema,i.type=It.CELL,i.setAttribute("type",It.CELL),i.addEventListener("vegaCancel",this.handleCellPropertiesUpdate),i.addEventListener("vegaChange",this.handleCellPropertiesUpdate),i.addEventListener("vegaSave",this.handleCellPropertiesUpdate),n.appendChild(s),n.appendChild(i),e.appendChild(n),this.popoverRef=e,this.tablePropertiesFormRef=s,this.cellPropertiesFormRef=i,e}}isEventWithinPopover(t){const e=t.composedPath();return!!this.tablePropertiesFormRef&&e.includes(this.tablePropertiesFormRef)||!!this.cellPropertiesFormRef&&e.includes(this.cellPropertiesFormRef)}getInertContentTarget(){var t,e,n;return null!==(n=null===(e=null===(t=this.getTableRef)||void 0===t?void 0:t.call(this))||void 0===e?void 0:e.closest(".rich-text-content"))&&void 0!==n?n:null}updateContent(t){this.popoverCloseType="none";const e=this.getTableExtensionContext();"TABLE"===t?(this.tablePropertiesFormRef.classList.remove("vega-hidden"),this.cellPropertiesFormRef.classList.add("vega-hidden"),this.tablePropertiesFormRef.defaultValue=qn.generateTablePropertiesForm(this.currentTableBlock)):"CELL"===t&&(this.cellPropertiesFormRef.classList.remove("vega-hidden"),this.tablePropertiesFormRef.classList.add("vega-hidden"),e&&(this.cellPropertiesFormRef.styleMap=ts.getStyleCollectionFromCell(e.tableSelection.getSelectedCells())),this.cellPropertiesFormRef.defaultValue=ts.convertStyleMapToFormField(this.cellPropertiesFormRef.styleMap)),e&&e.getSelection().removeAllRanges()}storeCurrentFocusNode(){const t=this.getTableExtensionContext();t&&(this.currentFocusNode=t.getSelectedNodes()[0])}focusFirstFormField(t){const e=t===It.TABLE?this.tablePropertiesFormRef:this.cellPropertiesFormRef;e&&(this.setEditorContentInert(!0),requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t,n,s,i,r;const a=null!==(n=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("[data-vega-form]"))&&void 0!==n?n:null,o=null!==(i=null===(s=null==a?void 0:a.shadowRoot)||void 0===s?void 0:s.querySelector(".vega-input-select-container"))&&void 0!==i?i:null;null===(r=null!=o?o:a)||void 0===r||r.focus()}))})))}handleDialogHide(){this.setEditorContentInert(!1),this.restoreFocusOnEscapeHide()}getOrCreateSelectionAnchor(t,e){const n=He();if(n&&e){const s=e.closest(".rich-text-content"),i=s.getBoundingClientRect();let r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;t.map((t=>L.getDOMByEntity(t))).filter(bt).forEach((t=>{const e=t.getBoundingClientRect();r=Math.min(r,e.left-i.left),a=Math.max(a,e.right-i.left),o=Math.min(o,e.top-i.top),l=Math.max(l,e.bottom-i.top)}));const c=a-r,h=l-o;return this.selectionAnchorRef=s.querySelector(".rte-table-selection-popover-anchor"),this.selectionAnchorRef||(this.selectionAnchorRef=n.createElement("div"),this.selectionAnchorRef.className="rte-table-selection-popover-anchor",this.selectionAnchorRef.style.position="absolute",this.selectionAnchorRef.style.pointerEvents="none",s.appendChild(this.selectionAnchorRef),Te.addUniqueObserverToNode(this.selectionAnchorRef,Se,(()=>{this.destroy()}))),this.selectionAnchorRef.style.left=`${r}px`,this.selectionAnchorRef.style.top=`${o}px`,this.selectionAnchorRef.style.width=`${c}px`,this.selectionAnchorRef.style.height=`${h}px`,this.selectionAnchorRef}}}class as extends is{constructor(t){super(t),this.settingHandlers=[new Mt,new Wn,new jt,new Ht,new Dt],this.handleTableClick=(t,e,n)=>{const s=t.target.closest("table");s===n()&&(t.stopPropagation(),this.reTarget(e,n),this.tableDynamicPopover.hide(),Oe.call(Ae.getSubject(this.popoverRef,ke),s),this.popoverRef.show(!0))},this.syncSelectedCells=()=>{this.tableSettingRef&&(this.tableSettingRef.selectedCells=this.getTableSelectedCells())},this.hide=()=>{var t;this.tableDynamicPopover.hide(),null===(t=this.popoverRef)||void 0===t||t.hide()},this.openSettingToolbarForKeyboard=(t,e,n)=>{this.reTarget(t,e),this.tableDynamicPopover.hide(),Oe.call(Ae.getSubject(this.popoverRef,ke),e()),this.popoverRef.show(!0),this.focusFirstSettingButton(n)},this.focusFirstSettingButton=t=>{var e,n;this.beginReturnFocusTracking(t),null===(n=null===(e=this.getTableExtensionContext())||void 0===e?void 0:e.getSelection())||void 0===n||n.removeAllRanges(),this.setEditorContentInert(!0),setTimeout((()=>{var t,e,n;const s=Array.from(null!==(n=null===(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".rte-table-setting-item"))&&void 0!==n?n:[]).find((t=>!t.hasAttribute("disabled")));null==s||s.focus()}),0)},this.handleSettingMenuClick=t=>{const e=this.settingHandlers.find((e=>e.canHandle(t.detail)));if(e){const n=this.getTableExtensionContext();n&&e.execute(t.detail,n,this.tableBlock),t.detail[0]===It.CAPTION&&(this.updateTableSettingCaption(),this.moveFocusToCaption())}if(t.detail[0]===It.TABLE||t.detail[0]===It.CELL){const e=this.returnFocusCell;this.popoverRef.hide(),this.tableDynamicPopover.show(t.detail[0],e)}},this.handleTableSettingPopoverShow=()=>{this.syncSelectedCells(),this.labelSettingDialog()},this.handleTableSettingPopoverHide=()=>{this.setEditorContentInert(!1),this.restoreFocusOnEscapeHide()},this.tableDynamicPopover=new rs(_t.getTableColors(),t)}destroy(){this.tableDynamicPopover.destroy(),this.setEditorContentInert(!1),this.detachEscapeTracker(),this.popoverContainer&&this.popoverContainer.remove()}render(){const t=He();if(t&&this.renderContext){this.popoverContainer=t.createElement("div"),this.renderContext.host.appendChild(this.popoverContainer);const e=this.tableDynamicPopover.render(),n=t.createElement("vega-popover");n.trigger="click",n.isScreenPosition=!0,n.className="rte-table-setting-popover",Te.addUniqueObserverToNode(n,Ne,this.handleTableSettingPopoverShow),Te.addUniqueObserverToNode(n,Be,this.handleTableSettingPopoverHide),this.attachEscapeTracker(t);const s=t.createElement("div");s.setAttribute("slot","popover");const i=t.createElement("vega-rich-text-table-setting");i.addEventListener("vegaClick",this.handleSettingMenuClick),s.appendChild(i),n.appendChild(s),this.popoverContainer.appendChild(n),this.popoverContainer.appendChild(e),this.popoverRef=n,this.tableSettingRef=i}}isEventWithinPopover(t){return!!this.tableSettingRef&&t.composedPath().includes(this.tableSettingRef)}getInertContentTarget(){var t,e,n;return null!==(n=null===(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.target)||void 0===e?void 0:e.closest(".rich-text-content"))&&void 0!==n?n:null}updateTableSettingCaption(){const t=this.tableBlock.hasCaption();this.tableSettingRef&&this.tableSettingRef.hasCaption!==t&&(this.tableSettingRef.hasCaption=t)}moveFocusToCaption(){this.tableBlock.hasCaption()&&(this.setEditorContentInert(!1),setTimeout((()=>{var t,e,n,s,i,r,a;const o=null!==(n=null===(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.target)||void 0===e?void 0:e.querySelector("caption"))&&void 0!==n?n:null;if(!o)return;o.focus();const l=null!==(a=null!==(i=null===(s=this.getTableExtensionContext())||void 0===s?void 0:s.getSelection())&&void 0!==i?i:null===(r=o.ownerDocument)||void 0===r?void 0:r.getSelection())&&void 0!==a?a:null;if(l){const t=new Range;t.selectNodeContents(o),t.collapse(!1),l.removeAllRanges(),l.addRange(t)}}),0))}reTarget(t,e){this.tableSettingRef&&(this.tableBlock=t,this.tableSettingRef.target=e(),this.tableSettingRef.selectedCells=this.getTableSelectedCells(),this.tableDynamicPopover.reTarget(t,e))}labelSettingDialog(){var t,e;const n=null!==(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.closest("vega-popover-content-box"))&&void 0!==e?e:null;n&&(n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-label","Table tools"))}getTableSelectedCells(){let t=[];const e=this.getTableExtensionContext();if(e&&e.tableSelection){const{tableSelection:n}=e;t=n.getSelectedCells()}return t}}class os extends gt{doRender(t,e,n){let s;const i=this.renderTable(t,e,(t=>s=t),n);this.renderTableToolbar(n);const r=e.getAnnotationByType(kt.TABLE),a=n.editable?[t("vega-rich-text-table-selection-widget",{onVegaRemove:t=>{t.stopPropagation(),this.handleTableRemove(e,s)},onClick:t=>{this.tableToolbar&&this.tableToolbar.handleTableClick(t,e,(()=>s))},onMouseLeave:()=>{this.tableToolbar&&this.tableToolbar.syncSelectedCells()}},[t("div",{class:"v-rte--extension-table-widget",contentEditable:!1,ref:this.useRef(e)},[i])])]:[i],o={};if(r){const t=r.renderStyle();o.width=t.width,o.margin=t.margin}const l=t("div",{class:"v-rte--extension-table-container",role:"presentation",style:Object.assign({},o)},a);return l.childrenContainerGetter=()=>i,l}destroy(){this.destroyTableToolbar()}injectRTEScopeStyles(){return".v-rte--extension-table-container{display:table}table.v-rte--extension-table{border-collapse:collapse}table.v-rte--extension-table th,table.v-rte--extension-table td{border:1px solid #ddd;padding:12px;text-align:left;vertical-align:middle;min-width:55px;box-sizing:border-box;position:relative}table.v-rte--extension-table th:focus,table.v-rte--extension-table td:focus{outline:none}table.v-rte--extension-table th{background-color:#f2f2f2}.rte-table-setting-popover,.rte-table-dynamic-popover{display:block}table.v-rte--extension-table .v-rte-table-cell-focused::after,table.v-rte--extension-table .v-rte-table-cell-selected::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-color:rgba(158, 207, 250, 0.3)}table.v-rte--extension-table:has(.v-rte-table-cell-selected){caret-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::selection{background-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::-moz-selection{background-color:transparent}.v-rte--extension-table-caption{padding:8px;border:1px solid #ddd;border-bottom:none;background-color:rgba(var(--v-bg-table-header, 240, 243, 247, 1));position:relative;display:table-caption;caption-side:top;min-height:22px;text-align:center;word-break:break-word;overflow-wrap:break-word}.v-rte--extension-table-caption.showPlaceholder::before{position:absolute;left:0;right:0;content:attr(data-placeholder);font-family:'Inter', sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1));text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"}renderTable(t,e,n,s){var i;const r=!!s.editable;return t("table",Object.assign(Object.assign(Object.assign(Object.assign({key:e.id},null===(i=e.getCustomAttributesAnnotation())||void 0===i?void 0:i.render()),{style:e.getStyles(),class:e.getClasses()}),r?{onClick:t=>this.handleTableActivate(t,s),onKeyDown:t=>this.handleTableKeyDown(t,s,e)}:void 0),{ref:t=>{this.useRef(e)(t),n(t)}}))}handleTableActivate(t,e){t.target===t.currentTarget&&this.focusFirstCell(t.currentTarget,e)}handleTableKeyDown(t,e,n){var s,i;if(t.altKey&&"F10"===t.key){t.preventDefault(),t.stopPropagation();const e=t.currentTarget,i=t.target,r=i?i.closest("td, th"):null;return void(null===(s=this.tableToolbar)||void 0===s||s.openSettingToolbarForKeyboard(n,(()=>e),r))}if("Escape"!==t.key)return;const r=t.currentTarget,a=t.target,o=a?a.closest("td, th"):null;o&&r.contains(o)&&(t.preventDefault(),t.stopPropagation(),this.focusTable(r,e),null===(i=this.tableToolbar)||void 0===i||i.hide())}focusFirstCell(t,e){const n=t.querySelector("td, th");if(!n)return;n.focus();const s=this.getSelection(e,t);if(s){const t=new Range;t.setStart(n,0),t.setEnd(n,0),s.removeAllRanges(),s.addRange(t)}}focusTable(t,e){var n;const s=this.getSelection(e,t);null==s||s.removeAllRanges();const i=this.getExtensionContext(e.host);null===(n=null==i?void 0:i.tableSelection)||void 0===n||n.setSelectedCells([]),t.setAttribute("tabindex","-1");const r=()=>{t.removeAttribute("tabindex"),t.removeEventListener("blur",r)};t.addEventListener("blur",r),t.focus()}getSelection(t,e){const n=this.getExtensionContext(t.host);return n?n.getSelection():e.ownerDocument?e.ownerDocument.getSelection():null}handleTableRemove(t,e){t.apply(new $n(t)),this.destroySelectionAnchor(e)}destroySelectionAnchor(t){const e=t.closest(".rich-text-content");if(e){const t=e.querySelector(".rte-table-selection-popover-anchor");t&&Le.notify(Ae.getSubject(t,Se),{host:t})}}renderTableToolbar(t){t.editable?this.tableToolbar||(this.tableToolbar=new as(t),this.tableToolbar.render()):this.destroyTableToolbar()}destroyTableToolbar(){var t;null===(t=this.tableToolbar)||void 0===t||t.destroy(),this.tableToolbar=null}}os.typeName="RTETableBlockRenderer";class ls extends gt{doRender(t,e){return t("thead",{key:e.id,ref:this.useRef(e)})}}ls.typeName="RTETableHeadRenderer";class cs extends gt{doRender(t,e){return t("tr",{key:e.id,ref:this.useRef(e)})}}cs.typeName="RTETableRowBlockRenderer";class hs extends gt{doRender(t,e,n){return this.renderByCellType(t,e,n,"td")}renderByCellType(t,e,n,s){var i;return t(s,Object.assign(Object.assign(Object.assign(Object.assign({key:`${e.id}-${s}`,ref:this.useRef(e)},n.editable?{contentEditable:!0,tabindex:-1}:void 0),null===(i=e.getCustomAttributesAnnotation())||void 0===i?void 0:i.render()),{style:e.getStyles(n),class:e.getClasses()}),n.editable?this.onSelectionListeners(e,n):void 0))}onSelectionListeners(t,e){return{onMouseDown:t=>{const n=i(t.target,"table"),s=i(t.currentTarget,"table")===n,r=t.target.closest("td, th");if(s&&r){const t=this.getExtensionContext(e.host);t&&t.tableSelection.focusCell(r)}},onMouseMove:n=>{n.stopPropagation(),n.preventDefault();const s=this.getExtensionContext(e.host);s&&s.tableSelection.dragOver(t)},onMouseUp:()=>{const t=this.getExtensionContext(e.host);t&&t.tableSelection.endDrag()}}}}hs.typeName="RTETableCellRenderer";class ds extends gt{doRender(t,e){return t("tbody",{key:e.id,ref:this.useRef(e)})}}ds.typeName="RTETableBodyRenderer";class us extends hs{doRender(t,e,n){return super.renderByCellType(t,e,n,"th")}}us.typeName="RTETableHeadCellRenderer";class ps extends v{constructor(t,e){super(),this.type="INSERT_TABLE_BLOCK",this.rowCount=t,this.columnCount=e}}class fs extends is{constructor(){super(...arguments),this.hoveredRows=1,this.hoveredCols=1}render(t,e){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,isScreenPosition:!0,ref:t=>{t&&(this.tablePickerPopoverRef=t,Te.addUniqueObserverToNode(t,Ne,(()=>{this.resetPicker()})))}},[t("div",{slot:"popover"},[this.generatePickerStyles(t),this.generateTableSizeGrid(t)]),t("div",{slot:"popover-content"},e)])}generateTableSizeGrid(t){const e=[];for(let n=1;n<=10;n++)for(let s=1;s<=10;s++)e.push(t("button",{class:"rte-table-picker__cell","data-row":n,"data-col":s,onMouseenter:this.handlePickerCellHover.bind(this,n,s),onClick:this.handlePickerClick.bind(this,n,s)},[]));return t("div",{class:"rte-table-picker"},[t("div",{class:"rte-table-picker__grid",ref:t=>{t&&(this.tablePickerGridRef=t)},style:{gridTemplateColumns:"repeat(10, 16px)",gridTemplateRows:"repeat(10, 16px)"}},e),t("div",{class:"rte-table-picker__hint"},t("vega-hint",{ref:t=>{t&&(this.selectedHintRef=t)}},[`${this.hoveredRows} × ${this.hoveredCols}`]))])}generatePickerStyles(t){return t("style",{},["\n.rte-table-picker__grid { display: grid; gap: 2px; }\n.rte-table-picker__cell {\n box-sizing: border-box;\n border: 1px solid #ccc;\n background-color: transparent;\n cursor: pointer;\n}\n.rte-table-picker__cell:hover {\n background-color: #cae1fc;\n}\n.rte-table-picker__cell.active {\n background-color: #cae1fc;\n}\n.rte-table-picker__hint {\n text-align: center;\n}\n "])}createTable(t,e){const n=this.getTableExtensionContext();if(n){const{host:s,getSelectedNodes:i}=n,r=i()[0],a=new ps(t,e);r?r.parent&&r.parent.apply(a):s.value.apply(a),a.nextFocusNode&&s.value.apply(new et(a.nextFocusNode,1))}}handlePickerClick(t,e){this.createTable(t,e),this.tablePickerPopoverRef.hide()}handlePickerCellHover(t,e){this.hoveredRows=t,this.hoveredCols=e,Array.from(this.tablePickerGridRef.children).forEach((t=>{const e=Number(t.dataset.row),n=Number(t.dataset.col);e<=this.hoveredRows&&n<=this.hoveredCols?t.classList.add("active"):t.classList.remove("active")})),this.selectedHintRef.textContent=`${this.hoveredRows} × ${this.hoveredCols}`}resetPicker(){this.handlePickerCellHover(1,1)}}class gs extends xt{render(t,e){return new fs(e).render(t,super.renderButton(t,e,{showArrowIcon:!0,icon:"rte-table",ariaLabel:"Table",tooltip:{text:"Insert table"}}))}isDisabled(t){let e=super.isDisabled(t);const n=this.getExtensionContext(t.host);if(n){const{host:t,getSelectedNodes:s}=n,i=s()[0];let r=!0;i&&(r=b.canHandle("INSERT_TABLE_BLOCK",i.parent)&&b.canHandle(M.INSERT_CHILDREN_AFTER,i.parent.parent)),e=t.disabled||!r}return e}handleButtonClick(){}handleDropdownClick(){}}vt.register({"rte-table":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M48 264V160H232V264H48zm0 48H232V432H64c-8.8 0-16-7.2-16-16V312zM280 432V312H464V416c0 8.8-7.2 16-16 16H280zM464 264H280V160H464V264zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"/></svg>'}});class ws extends O{handleAction(t,e){const n=this.createTableBlock(t.rowCount,t.columnCount),s=super.createNewParagraph(""),i=this.getReferenceBlock(e);i?i.parent.apply(new I(i,n,s)):e.apply(new R([n,s])),t.nextFocusNode=n.getFirstNode()}createTableBlock(e,n){const s=Math.max(e,1),i=Math.max(n,1);return Pt.from({id:t(),type:"table-block",children:[Vt(s,i)]})}getReferenceBlock(t){if(!(t instanceof nt))return t}}class ms extends Ct{canIntercept(t,e){const n=e.parent;return n instanceof $t&&1===n.children.length&&0===t.startOffset}intercept(){}}class vs extends O{handleAction(t){const e=t.tableBlock,n=e.parent,s=super.getRootContent(e),i=super.createNewParagraph("");n.apply(new I(e,i)),n.apply(new D(e)),s&&s.apply(new et(i.getLastNode()))}}class bs extends Ct{canIntercept(t,e){return t.entityToBeRemoved&&1===e.children.length}intercept(e,n,s){if(!(n.entityToBeRemoved instanceof A)){const e=A.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]});return s.children=[],void s.apply(new R([e]))}n.entityToBeRemoved.apply(new R([new y(t(),"",n.entityToBeRemoved)]))}}class ys extends gt{doRender(t,e,n){return t("caption",Object.assign(Object.assign({key:e.id,ref:this.useRef(e)},n.editable?{contentEditable:!0}:void 0),{style:e.getStyles(),class:[e.getClasses(),e.isNotEmpty()?null:"showPlaceholder"].filter(bt).join(" "),"data-placeholder":"Enter table caption"}))}}ys.typeName="RTETableCaptionRenderer";class xs extends O{getRowsMaxCellCount(t){let e=0;for(const n of t){let t=0;for(const e of n.children)t+=e.colSpan;e=Math.max(e,t)}return e}getRowCellStartCols(t){const e=this.getRowsMaxCellCount(t),n=new Array(t.length),s=new Array(e).fill(0);for(let e=0;e<t.length;e++){const i=t[e].children,r=new Array(i.length);let a=0;for(let t=0;t<i.length;t++){const e=i[t];for(;a<s.length&&s[a]>0;)a++;r[t]=a;const n=Math.max(e.colSpan,xs.DEFAULT_CELLSPAN);if(e.rowSpan>xs.DEFAULT_CELLSPAN)for(let t=0;t<n;t++){const n=a+t;n<s.length&&(s[n]=Math.max(s[n],e.rowSpan))}a+=n}n[e]=r;for(let t=0;t<s.length;t++)s[t]>0&&s[t]--}return n}updateCellSpan(t,e,n){const s=t.getCustomAttributesAnnotation();if(n<=xs.DEFAULT_CELLSPAN){if(s){const n=s.render();delete n[e],t.annotationMap.set(_.CUSTOM_ATTRIBUTE,new P(n))}}else{const i=s?s.render():{};i[e]=n.toString(),t.annotationMap.set(_.CUSTOM_ATTRIBUTE,new P(i))}}insertMovedCells(t,e,n){t.forEach(((t,s)=>{const i=e[s];if(i){const e=n[s]||[];t.sort(((t,e)=>t.logicalStartCol===e.logicalStartCol?e.cellIndex-t.cellIndex:e.logicalStartCol-t.logicalStartCol)),t.forEach((t=>{const{cell:n,logicalStartCol:s}=t;if(0===i.children.length)return i.apply(new R([n])),void(e[0]=s);const r=e.findIndex((t=>t>=s));-1===r?(i.apply(new I(i.children[i.children.length-1],n)),e.push(s)):0===r?(i.apply(new B(i.children[0],n)),e.unshift(s)):(i.apply(new B(i.children[r],n)),e.splice(r,0,s))}))}}))}splitRowsBySection(t){const e=[],n=[];return t.forEach((t=>{t.parent instanceof Ft?e.push(t):n.push(t)})),[e,n]}buildSelectedIndices(t,e){return new Set(t.map((t=>e.indexOf(t))).filter((t=>t>=0)))}intersectsRemovalRange(t,e,n,s){return t<=s&&e>=n}countRemovedRows(t,e,n){let s=0;for(let i=t;i<=e;i++)n.has(i)&&s++;return s}getHeadCellLength(t){let e=0;for(let n=0;n<t.children.length;n++){const s=t.children[n];if(!(s instanceof Nt))break;e+=s.colSpan}return e}getTheStartSpanCell(t,e,n,s){const i={rowIndex:n};for(let r=n;r>=0;r--){const n=e[r];if(n.includes(s)){i.cell=t[r].children[n.indexOf(s)],i.rowIndex=r;break}}return i}getDefaultCellBlockTemplate(e,n,s=1){const i=_e({colspan:n>1?n.toString():null,rowspan:s>1?s.toString():null}),r=t(),a={id:r,type:e,children:[{id:`${r}-p`,type:"paragraph",nodes:[{id:`${r}-p-t`,type:"text",text:""}]}]};return Object.keys(i).length>0&&(a.annotations={customAttribute:i}),a}getSortedValuesByNumericKey(t){return Array.from(t.entries()).sort((([t],[e])=>t-e)).map((([,t])=>t))}}xs.DEFAULT_CELLSPAN=1;class Cs extends xs{handleAction(t,e){const{rowsToBeRemoved:n}=t,s=this.getFutureFocusRow(n[0],n[n.length-1],e),i=this.splitRowsBySection(n);if(this.removeRows(i[0]),this.removeRows(i[1]),s){const t=this.getRootContent(e);if(t){const e=s.getLastNode();t.apply(new et(e,e.getRangeEndOffset()))}}}removeRows(t){if(0===t.length)return;const e=t[0].parent,n=e.children,s=this.buildSelectedIndices(t,n);if(s.size>0){if(n.length===t.length)return void e.parent.apply(new D(e));const i=Math.min(...s),r=Math.max(...s),a=this.getRowCellStartCols(n),o=this.collectCellsToMove(n,a,s,i,r);this.insertMovedCells(o,n,a),t.forEach((t=>{t.parent.apply(new D(t))}))}}collectCellsToMove(t,e,n,s,i){const r=new Map,a=t.length;for(let o=0;o<a;o++){const l=t[o],c=l.children.length;for(let t=0;t<c;t++){const c=l.children[t],h=c.rowSpan;if(h<=xs.DEFAULT_CELLSPAN)continue;const d=o+h-1;if(!this.intersectsRemovalRange(o,d,s,i))continue;const u=h-this.countRemovedRows(o,d,n);if(o<s&&d>=s)this.updateCellSpan(c,"rowspan",u);else if(o>=s&&d>i){const s=i+1;if(s<a&&!n.has(s)){const n=e[o][t];r.has(s)||r.set(s,[]),r.get(s).push({cell:this.cloneCellWithRowSpan(c,u),newRowSpan:u,cellIndex:t,logicalStartCol:n})}}}}return r}cloneCellWithRowSpan(t,e){const n=t.clone(t.parent);return this.updateCellSpan(n,"rowspan",e),n}getFutureFocusRow(t,e,n){const s=n.children.filter((t=>t instanceof Ft||t instanceof zt)).flatMap((t=>t.children)),i=s.indexOf(t),r=s.indexOf(e);return s[i-1]?s[i-1]:s[r+1]?s[r+1]:void 0}}class Ls{constructor(){this.dragging=!1,this.anchorCell=null,this.selectedCells=new Set,this.syncRTESelectionWithDebounce=Pe(this.syncRTESelection,100,this),this.handleSelectionChangeWithDebounce=Pe(this.handleSelectionChange,10,this),this.filterSelectedCell=(t,e)=>{const n=new Set;if(t.intersectsNode(e)){if(e.nodeType===Node.TEXT_NODE){const t=L.getEntityByDOM(e.parentElement);if(t){const e=Kt(t.parent,$t);if(e)return n.add(e),Array.from(n)}}e.childNodes.forEach((e=>this.filterSelectedCell(t,e).forEach((t=>{n.add(t)}))))}return Array.from(n)},this.updateSelectedStyles=(t,e)=>{const n=1===e?"v-rte-table-cell-focused":"v-rte-table-cell-selected",s=L.getDOMByEntity(t);s&&s.classList.add(n)},this.handleDocMouseUp=()=>{this.endDrag();const t=He();t&&t.removeEventListener("mouseup",this.handleDocMouseUp)},this.handleContentClick=()=>{this.clearSelection();const t=this.context.host.shadowRoot.querySelector(".rich-text-editor-container");t&&t.removeEventListener("mousedown",this.handleContentClick,!0)}}static computeRectRange(t,e){const n=t.parent.parent.parent;if(n!==e.parent.parent.parent)return[];const s=[];n.children.forEach((t=>{t.children.forEach((t=>s.push(t)))}));const{grid:i,cellMeta:r}=Ls.buildCellGrid(s),a=r.get(t),o=r.get(e);if(!a||!o)return[];const l=a.row+a.rowSpan-1,c=a.col,h=a.col+a.colSpan-1,d=o.row+o.rowSpan-1,u=o.col,p=o.col+o.colSpan-1,f=Math.min(a.row,o.row),g=Math.max(l,d),w=Math.min(c,u),m=Math.max(h,p),v=new Set;for(let t=f;t<=g;t++){const e=i[t];for(let t=w;t<=m;t++){const n=e[t];n&&v.add(n)}}return Array.from(v)}static getCellSpan(t){let e=1,n=1;const s=t.getAnnotationByType(_.CUSTOM_ATTRIBUTE);if(s&&s.customAttribute){const t=s.customAttribute;t.rowSpan&&(e=parseInt(t.rowSpan,10)),t.colSpan&&(n=parseInt(t.colSpan,10))}if(1===e&&1===n){const s=L.getDOMByEntity(t);if(s){const t=s.getAttribute("rowSpan"),i=s.getAttribute("colSpan");t&&(e=parseInt(t,10)),i&&(n=parseInt(i,10))}}return{rowSpan:Number.isFinite(e)&&e>0?e:1,colSpan:Number.isFinite(n)&&n>0?n:1}}static buildCellGrid(t){const e=[],n=new Map;for(let s=0;s<t.length;s++){const i=t[s];e[s]||(e[s]=[]);let r=0;for(let t=0;t<i.children.length;t++){const a=i.children[t];for(;e[s][r];)r+=1;const{rowSpan:o,colSpan:l}=Ls.getCellSpan(a);n.set(a,{row:s,col:r,rowSpan:o,colSpan:l});for(let t=0;t<o;t++){const n=s+t;e[n]||(e[n]=[]);for(let t=0;t<l;t++)e[n][r+t]=a}r+=l}}return{grid:e,cellMeta:n}}destroy(){this.removeSelectionChangeListener()}init(t){this.context=t,this.addSelectionChangeListener()}setSelectedCells(t){const e=Array.from(this.selectedCells)[0]||t[0];this.updateSelectedCells(t),this.emitCellSelectionChange(e,t)}getSelectedCells(){return Array.from(this.selectedCells)}focusCell(t){const e=L.getEntityByDOM(t);e&&(this.anchorCell=e,this.setSelectedCells([e]),this.addListeners())}dragOver(t){if(!this.anchorCell)return;const e=Ls.computeRectRange(this.anchorCell,t);e.length>1&&this.startDrag(),this.dragging&&(this.preventTextSelection(e),this.updateSelectedCells(e,{debounceSync:!0}))}endDrag(){this.dragging=!1,this.anchorCell=null}emitCellSelectionChange(t,e){const n=Kt(t,Pt);if(n){const t=L.getDOMByEntity(n);t&&Le.notify(Ae.getSubject(t,Ee),{host:t,detail:e})}}clearSelection(){this.selectedCells.forEach((t=>{const e=L.getDOMByEntity(t);e&&e.classList.remove("v-rte-table-cell-selected","v-rte-table-cell-focused")})),this.selectedCells.clear()}addSelectionChangeListener(){const t=He();t&&t.addEventListener("selectionchange",this.handleSelectionChangeWithDebounce)}removeSelectionChangeListener(){const t=He();t&&t.removeEventListener("selectionchange",this.handleSelectionChangeWithDebounce)}handleSelectionChange(){if(this.dragging)return void this.syncRTESelectionWithDebounce();const t=this.context.getSelection();if(t.rangeCount>0){const e=t.getRangeAt(0),n=e.commonAncestorContainer;if(i(n,"table")){let t=this.filterSelectedCell(e,n);0===t.length&&(t=this.resolveCaretCell(n)),this.setSelectedCells(t)}}}resolveCaretCell(t){var e;const n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,s=null!==(e=null==n?void 0:n.closest("td, th"))&&void 0!==e?e:null;if(!s)return[];const i=L.getEntityByDOM(s);return i?[i]:[]}startDrag(){this.dragging=!0}updateSelectedCells(t,{debounceSync:e}={}){this.clearSelection(),t.forEach((e=>{this.selectedCells.add(e),this.updateSelectedStyles(e,t.length)})),e?this.syncRTESelectionWithDebounce():this.syncRTESelection()}syncRTESelection(){const t=Array.from(this.selectedCells),e=t.flatMap((t=>t.children.flatMap((t=>t.children.flatMap((t=>{if(t instanceof C)return t})))))).filter(bt);t.length>1&&this.context.setSelectedNodes(e,{startNode:e[0],endNode:e[e.length-1],startOffset:0,endOffset:e[e.length-1].getRangeEndOffset()})}preventTextSelection(t){const e=this.context.getSelection();if(e.removeAllRanges(),t.length>0){const n=L.getDOMByEntity(t[0]);if(n){const t=new Range;t.setStart(n,0),t.setEnd(n,0),e.addRange(t)}}}addListeners(){const t=He();t&&t.addEventListener("mouseup",this.handleDocMouseUp);const e=this.context.host.shadowRoot.querySelector(".rich-text-editor-container");e&&e.addEventListener("mousedown",this.handleContentClick,!0)}}class Ts extends xs{handleAction(t,e){const{selectedRows:n}=t,[s,i]=this.splitRowsBySection(n);i.length>0?this.convertToHeaderRows(i,e):this.revertToBodyRows(s,e);const r=this.getRootContent(e);if(r){const t=n[0].getFirstNode();t&&r.apply(new et(t,0))}}convertToHeaderRows(e,n){let s=n.children.find((t=>t instanceof Ft));const i=e[0].parent;s||(s=Ft.from({id:t(),type:"table-head",children:[]}),n.apply(new B(i,s)));const r=i.children.indexOf(e[e.length-1]),a=i.children.slice(0,r+1),o=this.buildSelectedIndices(a,i.children),l=Math.min(...o),c=Math.max(...o);if(o.size>0){if(o.size<i.children.length){const t=this.getRowCellStartCols(i.children),e=this.collectCellsToMove(i.children,t,o,l,c);this.insertMovedCells(e,i.children,t)}this.convertBodyRowsToHeaderRows(i,s,a)}}convertBodyRowsToHeaderRows(t,e,n){for(let e=0;e<n.length;e++){const s=n[e];s.children=s.children.map((t=>this.convertTdToTh(t))),t.apply(new D(s))}e.apply(new R(n))}revertToBodyRows(e,n){let s=n.children.find((t=>t instanceof zt));const i=e[0].parent;s||(s=zt.from({id:t(),type:"table-body",children:[]}),n.apply(new I(i,s)));const r=i.children.indexOf(e[0]),a=i.children.slice(r),o=this.buildSelectedIndices(a,i.children);if(o.size>0){const t=this.getRowCellStartCols(i.children),e=this.collectCellsToMove(i.children,t,o,Math.min(...o),Math.max(...o));this.insertMovedCells(e,i.children,t),this.convertHeadRowsToBodyRows(i,s,a)}}convertHeadRowsToBodyRows(t,e,n){const s=e.children[0],i=this.getRowCellStartCols(n);for(let r=0;r<n.length;r++){const a=n[r];t.apply(new D(a));const o=s?this.getHeadCellLength(s):0;a.children=this.convertThToTd(a,i[r],o),s&&e.apply(new B(s,a))}s||e.apply(new R(n))}collectCellsToMove(t,e,n,s,i){const r=new Map,a=t.length;for(let o=0;o<a;o++){const l=t[o],c=l.children.length;for(let t=0;t<c;t++){const c=l.children[t],h=c.rowSpan;if(h<=xs.DEFAULT_CELLSPAN)continue;const d=o+h-1;if(!this.intersectsRemovalRange(o,d,s,i))continue;const u=this.countRemovedRows(o,d,n),p=h-u;if(o<s&&d>=s){this.updateCellSpan(c,"rowspan",p);const i=s;if(i<a&&n.has(i)){const n=e[o][t];r.has(i)||r.set(i,[]),r.get(i).push({cell:this.cloneCellWithRowSpan(c,u),newRowSpan:u,cellIndex:t,logicalStartCol:n})}}else if(o>=s&&d>i){this.updateCellSpan(c,"rowspan",u);const s=i+1;if(s<a&&!n.has(s)){const n=e[o][t];r.has(s)||r.set(s,[]),r.get(s).push({cell:this.cloneCellWithRowSpan(c,p),newRowSpan:p,cellIndex:t,logicalStartCol:n})}}}}return r}convertTdToTh(t){if(t instanceof Nt)return t;const e=Nt.from(t.toJSON());return e.parent=t.parent,e}convertThToTd(t,e,n){return t.children.map(((s,i)=>{let r=s;const a=e[i]<n,o=s.toJSON();return r=a?s:$t.from(this.deleteHeadCellDefaultBackground(o)),r.parent=t,r}))}cloneCellWithRowSpan(e,n){const s=e.clone(e.parent);s.id=t(),s.children=[];const i=this.createNewParagraph("");return i&&s.apply(new R([i])),this.updateCellSpan(s,"rowspan",n),s}deleteHeadCellDefaultBackground(t){var e;if(t&&t.annotations&&t.annotations.customStyle){delete t.annotations.tableCell;const n=t.annotations.customStyle.backgroundColor,s=Wt.getDefaultBackgroundColor();!n||n!==s&&(null===(e=r(n))||void 0===e?void 0:e.toUpperCase())!==s||delete t.annotations.customStyle.backgroundColor}return t}}class As extends qt{handleAction(t,e){const{insertDirection:n,tableCellInsertRange:s}=t,i=new Set(s.map((t=>t.id))),r=Ut(e),a=Gt(r),[o,l]=this.getBoundaryCellColumnRange(s,r,a),c=n===Yt.LEFT?o:l+1,h=this.hasSelectedCellInsideTargetColumn(r,a,c,i),d=new Set;r.forEach(((t,s)=>{if(d.has(s))return;const o=this.findExpandableCell(t,s,c,a,n,i,h);if(o){const t=o.rowSpan;if(Zt(o,o.colSpan+1,o.rowSpan,e,!0),t>1)for(let e=1;e<t;e++)d.add(s+e);return}const l=this.findInsertPosition(t,s,c,a,r);if(l){const e=this.generateTableCell(l.templateCell);t.apply(l.before?new B(l.anchorCell,e):new I(l.anchorCell,e))}}))}findExpandableCell(t,e,n,s,i,r,a){const o=s[e],l=t.children.reduce(((t,e)=>t+(r.has(e.id)?1:0)),0);for(const c of t.children){const t=o.indexOf(c.id),h=t+c.colSpan,d=n===h,u=e+c.rowSpan>=s.length,p=r.has(c.id),f=n>t&&n<h;if(i===Yt.LEFT?f:f&&(!p||!u)||d&&c.colSpan>1&&p&&!u&&1===l&&!a)return c}return null}hasSelectedCellInsideTargetColumn(t,e,n,s){for(let i=0;i<t.length;i++){const r=t[i],a=e[i];for(const t of r.children){if(!s.has(t.id))continue;const e=a.indexOf(t.id),i=e+t.colSpan;if(n>e&&n<i)return!0}}return!1}findInsertPosition(t,e,n,s,i){const r=s[e];let a=t.children[0];if(n>=0&&n<r.length){const t=Qt(i,r[n]);t&&(a=t)}let o=0;for(let e=0;e<t.children.length;e++){const s=t.children[e];for(;o<r.length&&r[o]!==s.id;)o++;if(o>=n)return{anchorCell:s,templateCell:a,before:!0};const i=o+s.colSpan;if(i>n||e===t.children.length-1)return{anchorCell:s,templateCell:a,before:!1};o=i}return null}generateTableCell(t){return t instanceof Nt?Nt.from(Jt(t.type)):$t.from(Jt(t.type))}}class Ss extends qt{handleAction(t,e){const n=Ut(e),s=Gt(n),[i,r]=this.getBoundaryCellColumnRange(t.tableCellDeleteRange,n,s),a=Math.max(n.indexOf(t.tableCellDeleteRange[t.tableCellDeleteRange.length-1].parent),0),{coveredCellIds:o,coveredCells:l,adjustmentCellInfo:c}=this.getDeleteCellsInfo(n,i,r,s),h=this.findNextFocusableCell(n,s,i,r,o,a);this.deleteCells(l,c,e);const d=this.getRootContent(e),u=ee(h);d&&u&&d.apply(new et(u))}getDeleteCellsInfo(t,e,n,s){const i=[],r=new Set,a=[],o=Xt(s);return t.forEach((t=>{t.children.forEach((t=>{const s=o.get(t.id);if(void 0===s)return;const{colSpan:l,rowSpan:c}=ne(t),h=this.getColumnOverlapCount(s,l,e,n);if(h<=0)return;if(h===l)return i.push(t),void r.add(t.id);const d=Math.max(1,l-h);a.push({cell:t,nextColSpan:d,rowSpan:c})}))})),{coveredCells:i,coveredCellIds:r,adjustmentCellInfo:a}}findNextFocusableCell(t,e,n,s,i,r){for(let a=0;a<t.length;a++){const o=this.findFocusableCellIdInGridRow(e[(r+a)%t.length],n,s,i);if(!o)continue;const l=Qt(t,o);if(l)return l}return null}findFocusableCellIdInGridRow(t,e,n,s){for(let e=n+1;e<t.length;e++){const n=t[e];if(n&&!s.has(n))return n}for(let n=e-1;n>=0;n--){const e=t[n];if(e&&!s.has(e))return e}return null}deleteCells(t,e,n){t.forEach((t=>{t.parent.apply(new D(t))}));const s=new Set;e.forEach((({cell:t,nextColSpan:e,rowSpan:i})=>{s.add(t.id),Zt(t,e,i,n)})),this.normalizeRemainingCellSpans(n,s)}normalizeRemainingCellSpans(t,e){Ut(t).forEach((n=>{n.children.forEach((n=>{const{colSpan:s,rowSpan:i}=ne(n);if(e.has(n.id)){const e=te(t);if(!(i>1&&s===e))return}Zt(n,s,i,t)}))}))}getColumnOverlapCount(t,e,n,s){const i=t+e-1,r=Math.max(t,n),a=Math.min(i,s);return r<=a?a-r+1:0}}class ks extends v{constructor(t){super(),this.isFlushable=!0,this.type="CREATE_SEGMENT_TABLE_CELL",this.payload=t}}class Es extends O{handleAction(t,e){const{table:n,sourceCell:s,colSpan:i,cellType:r,keepSourceContent:a}=t.payload,o=a?this.convertCellType(s,r):se(r);Zt(o,i,s.rowSpan,n),e.apply(new B(s,o))}convertCellType(t,e){return"table-head-cell"===e?Nt.from(t.toJSON()):$t.from(t.toJSON())}}class Os extends O{handleAction(t,e){const{cell:n,targetCellType:s}=t.payload,i="table-head-cell"===s?Nt.from(n.toJSON()):$t.from(n.toJSON());e.apply(new B(n,i)),e.apply(new D(n))}}class Is extends O{handleAction(t,e){const{table:n,cell:s,col:i,cellStartCol:r,endCol:a,targetCellType:o}=t.payload,l=r+s.colSpan-1,c=i>r?i-r:0,h=Math.min(a,l),d=h-i+1,u=l-h;c>0&&e.apply(new ks({table:n,sourceCell:s,colSpan:c,cellType:s.type,keepSourceContent:!0})),e.apply(new ks({table:n,sourceCell:s,colSpan:d,cellType:o,keepSourceContent:0===c})),u>0&&e.apply(new ks({table:n,sourceCell:s,colSpan:u,cellType:s.type,keepSourceContent:0===c&&d===s.colSpan})),e.apply(new D(s))}}class Rs extends qt{handleAction(t,e){const n=Ut(e),s=Gt(n),i=Xt(s),[r,a]=this.getBoundaryCellColumnRange(t.tableCellSelectRange,n,s),o=[],l=new Set;n.forEach((t=>{t.children.forEach((t=>{const e=i.get(t.id);void 0!==e&&e>=r&&e<=a&&!l.has(t.id)&&(l.add(t.id),o.push(t))}))})),t.selectCellCallback(o)}}class Bs extends Ct{canIntercept(t){return t.childrenToBeInserted.some((t=>!(t instanceof $t)))}intercept(){}}class Ns extends O{handleAction(t,e){const{targetCell:n,mergeCells:s,colSpan:i,rowSpan:r,direction:a}=t;this.mergeContentToTargetCell(n,s),Zt(n,i,r,e),this.deleteOtherSelectedCells(s,n),a!==ie.MERGE_CELL_LEFT&&a!==ie.MERGE_CELL_RIGHT&&r>1&&this.clearRowSpanIfUniformAcrossRow(n,e,r);const o=this.getRootContent(e),l=ee(n);o&&l&&o.apply(new et(l))}mergeContentToTargetCell(t,e){const n=e.flatMap((t=>t.children)),s=n.filter((t=>t.isNotEmpty()));t.children=(s.length>0?s:[n[0]]).map((e=>e.clone(t)))}deleteOtherSelectedCells(t,e){t.forEach((t=>{t!==e&&t.parent.apply(new D(t))}))}clearRowSpanIfUniformAcrossRow(t,e,n){const s=t.parent.parent.children,i=Gt(s),r=[];for(let e=0;e<i.length;e++)i[e].includes(t.id)&&r.push(e);if(r.length>1){const t=r[0],a=t+n-1,o=new Set;let l=Number.POSITIVE_INFINITY;for(let e=0;e<i[0].length;e++){let n=i[t][e],s=1,r=!1;for(let c=t+1;c<=a;c++)i[c][e]!==n?(s>1&&(r=!0,l=Math.min(l,s),o.add(n)),s=1,n=i[c][e]):s++;if(s<2&&!r){o.clear();break}s>1&&(l=Math.min(l,s),o.add(n))}o.size>0&&s.forEach((t=>{t.children.forEach((t=>{if(o.has(t.id)){const{rowSpan:n,colSpan:s}=ne(t);Zt(t,s,n-l+1,e)}}))}))}}}class Ms extends it{canHandle(t,e){const n=t[e];return n&&"TABLE"===n.tagName?1:0}handle(e,n){return Pt.from({id:t(),type:"table-block",annotations:rt.generate(Pt,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class js extends st{canHandle(t,e){const n=t[e];return n&&"THEAD"===n.tagName?1:0}handle(e,n){return Ft.from({id:t(),type:"table-head",annotations:rt.generate(Ft,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class Hs extends st{canHandle(t,e){const n=t[e];return n&&"TBODY"===n.tagName?1:0}handle(e,n){return zt.from({id:t(),type:"table-body",annotations:rt.generate(zt,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class Ds extends st{canHandle(t,e){const n=t[e];return n&&"TR"===n.tagName?1:0}handle(e,n){return re.from({id:t(),type:"table-row",annotations:rt.generate(re,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class _s extends st{canHandle(t,e){const n=t[e];return!n||"TD"!==n.tagName&&"TH"!==n.tagName?0:1}handle(e,n){const s=e[0],i=[{id:t(),type:"paragraph",annotations:{internalWrapper:n&&!n.autoMatchFormat},nodes:[{id:t(),type:"text",annotations:{plainText:n&&!n.autoMatchFormat},text:""}]}];return"TH"===s.tagName?Nt.from({id:t(),type:"table-head-cell",annotations:this.getTableHeadCellAnnotations(s,n),children:i},n):$t.from({id:t(),type:"table-cell",annotations:rt.generate($t,s,n),children:i},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}getTableHeadCellAnnotations(t,e){const n=rt.generate(Nt,t,e);return n&&n.tableCell&&_t.getColorKey(n.tableCell.backgroundColor,!0)===Et.key&&(delete n.tableCell.backgroundColor,n.customStyle&&delete n.customStyle.backgroundColor),n}}class Ps extends it{canHandle(t,e){const n=t[e];return n&&n.parentElement&&"TABLE"===n.parentElement.tagName&&"CAPTION"===n.tagName?1:0}handle(e,n){const s=this.getTableCaptionAnnotations(e[0],n);return zn.from({id:t(),type:"table-caption",annotations:Object.assign(Object.assign({},s),{caption:!0}),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}getTableCaptionAnnotations(t,e){const n=rt.generate(zn,t,e);return n&&n.customStyle&&n.customStyle.backgroundColor&&_t.getColorKey(n.customStyle.backgroundColor,!0)===Et.key&&delete n.customStyle.backgroundColor,n}}class Vs extends dt{getBackgroundColor(t){return t.style.backgroundColor?_t.getColorKey(t.style.backgroundColor)||t.style.backgroundColor:null}getBorder(t){const e=t.style,n=e.borderStyle,s=e.borderWidth,i=e.borderColor;if(i||n||s){const t="initial"===i?"":i;return{style:"initial"===n?"":n,width:this.normalizeBorderWidth(s),color:_t.getColorKey(t)||t}}return null}normalizeBorderWidth(t){return"initial"===t||Vs.BORDER_WIDTH_KEYWORDS.includes(t)?"":t}getWidth(t){if(t.style.width)return t.style.width;const e=t.getAttribute("width");return e?/^\d+$/.test(e)?`${e}px`:e:null}getHeight(t){if(t.style.height)return t.style.height;const e=t.getAttribute("height");return e?/^\d+$/.test(e)?`${e}px`:e:null}}Vs.BORDER_WIDTH_KEYWORDS=["thin","medium","thick"];class $s extends Vs{canHandle(t){return"RTETableBlock"===t.typeName}handle(t){const e=_e({backgroundColor:this.getBackgroundColor(t),border:this.getBorder(t),width:this.getWidth(t),height:this.getHeight(t),alignment:this.getAlignment(t)});return Object.keys(e).length>0?{table:e}:{}}getAlignment(t){const e=t.classList;if(e.contains("v-rte--extension-table-align-left"))return"left";if(e.contains("v-rte--extension-table-align-center"))return"center";if(e.contains("v-rte--extension-table-align-right"))return"right";const n=t.style,s=n.marginLeft,i=n.marginRight;if("auto"===s&&"auto"===i)return"center";if("0"===s||"0px"===s)return"left";if("0"===i||"0px"===i)return"right";const r=t.getAttribute("align");return r&&["left","center","right"].includes(r)?r:null}}class Fs extends Vs{canHandle(t){return"RTETableCellBlock"===t.typeName}handle(t){const e=_e({backgroundColor:this.getBackgroundColor(t),padding:this.getPadding(t),border:this.getBorder(t),width:this.getWidth(t),height:this.getHeight(t),textAlign:this.getTextAlign(t),verticalAlign:this.getVerticalAlign(t),minWidth:this.getMinWidth(t),boxSizing:this.getBoxSizing(t)});return Object.keys(e).length>0?{tableCell:e}:{}}getMinWidth(t){return t.style.minWidth?t.style.minWidth:null}getBoxSizing(t){return t.style.boxSizing?t.style.boxSizing:null}getPadding(t){return t.style.padding?t.style.padding:null}getTextAlign(t){if(t.style.textAlign){const e=t.style.textAlign;if(["left","center","right","justify"].includes(e))return e}const e=t.getAttribute("align");return e&&["left","center","right","justify"].includes(e)?e:null}getVerticalAlign(t){if(t.style.verticalAlign){const e=t.style.verticalAlign;if(["top","middle","bottom"].includes(e))return e}return null}}class zs extends Fs{canHandle(t){return"RTETableHeadCellBlock"===t.typeName}}class Ks extends O{handleAction(t,e){const n=t.toAnnotation(),s=this.getDOMByEntity(e);if(s){const t=s.closest(".v-rte--extension-table-container"),{backgroundColorAnnotation:i,width:r,height:a}=n;s.style.backgroundColor=i.renderStyle().color,s.style.border=n.borderStr,s.style.width=r,s.style.height=a;const o=n.renderAlignmentStyle().margin;s.style.margin=o,t&&(t.style.width=r,t.style.height=a,t.style.margin=o),this.updateCustomStyleAnnotation(e,["backgroundColor","border","width","height","margin"])}}}class Ws extends O{handleAction(t,e){const n=t.toAnnotation(),s=this.getDOMByEntity(e);if(s){const{width:t,height:i,borderStr:r,padding:a,textAlign:o,verticalAlign:l}=n,c=n.renderStyle().backgroundColor||"";s.style.backgroundColor=c,s.style.border=r,s.style.width=t,s.style.height=i,s.style.padding=a,s.style.textAlign=o,s.style.verticalAlign=l,this.updateCustomStyleAnnotation(e,["backgroundColor","border","width","height","padding","textAlign","verticalAlign"])}}}class qs extends O{handleAction(t,e){const n=e.parent,s=n.parent,i=Kt(n,Pt),r=Ut(i),a=r.indexOf(n),{colSpan:o,rowSpan:l}=ne(e),c=ae(e,r),h=Math.ceil(l/2),d=Math.max(1,l-h),u=1===l;Zt(e,o,h,i);const p=a+h,f=se(e.type);if(Zt(f,o,d,i),u){const t=this.createNewRowWithCell(s,f),a=s.children.indexOf(n);s.apply(new I(s.children[a],t)),r.splice(p,0,t),this.updateCellsSpanningThroughInsertionPoint(r,p,e,i)}else{const t=r[p],e=this.findInsertPosition(t,c,r,p);t.children.splice(e,0,f),f.parent=t}}findInsertPosition(t,e,n,s){let i=0;for(let t=0;t<s;t++){const r=n[t];for(const a of r.children){const{colSpan:r,rowSpan:o}=ne(a);t+o>s&&ae(a,n)<e&&(i+=r)}}let r=i;for(let n=0;n<t.children.length;n++){if(r>=e)return n;const s=t.children[n],{colSpan:i}=ne(s);r+=i}return t.children.length}createNewRowWithCell(e,n){const s={id:t(),type:"table-row",children:[]},i=re.from(s);return i.parent=e,i.children.push(n),n.parent=i,i}updateCellsSpanningThroughInsertionPoint(t,e,n,s){for(let i=0;i<e;i++){const r=t[i];for(const t of r.children){if(t===n)continue;const{colSpan:r,rowSpan:a}=ne(t);i+a>=e&&Zt(t,r,a+1,s)}}}}class Us extends O{handleAction(t,e){const n=e.parent,s=Kt(n,Pt),i=Ut(s),r=i.indexOf(n),{colSpan:a,rowSpan:o}=ne(e),l=ae(e,i),c=l+a-1,h=Math.ceil(a/2),d=Math.floor(a/2);Zt(e,h,o,s);const u=se(e.type);Zt(u,d,o,s),n.apply(new I(e,u));const p=1===a?1:0;p>0&&this.updateOtherRowsCells(i,r,l,c,o,p,s)}updateOtherRowsCells(t,e,n,s,i,r,a){for(let o=0;o<t.length;o++){const l=t[o];if(!(o>=e&&o<e+i))for(const e of l.children){const i=ae(e,t),{colSpan:o,rowSpan:l}=ne(e);if(i+o-1>=n&&i<=s){Zt(e,o+r,l,a);break}}}}}class Gs extends xs{handleAction(e,n){const{selectedRows:s}=e,i=s[s.length-1];let r=n.children.find((t=>t instanceof zt));const a={id:t(),type:"table-row",children:[]};let o=0,l=null;r?(l=r.children[0],o=this.getHeadCellLength(l)):(r=zt.from({id:t(),type:"table-body",children:[]}),n.apply(new R([r])));const c=i.parent.children,h=this.getRowsMaxCellCount(c);if(this.getRowsMaxCellCount([i])<h){const t=c.indexOf(i),e=this.getRowCellStartCols(c),n=new Map;for(let s=0;s<h;s++){const i=s<o?"table-head-cell":"table-cell",{cell:r}=this.getTheStartSpanCell(c,e,t,s);if(r){const t=r.colSpan;n.set(s,this.getDefaultCellBlockTemplate(i,t)),s+=t-1}}a.children=this.getSortedValuesByNumericKey(n)}else a.children=this.createTableCells(i,o);const d=l?new B(l,re.from(a)):new R([re.from(a)]);r.apply(d)}createTableCells(t,e){const n=[];let s=0;for(const i of t.children)n.push(this.getDefaultCellBlockTemplate(s<e?"table-head-cell":"table-cell",i.colSpan)),s+=i.colSpan;return n}}class Zs extends xs{handleAction(e){const{insertDirection:n,selectedRows:s}=e,i=n===oe.ABOVE?s[0]:s[s.length-1],r={id:t(),type:"table-row",children:[]},a=i.parent.children,o=this.getRowsMaxCellCount(a),l=a.indexOf(i),c=this.getRowCellStartCols(a),h=new Map;for(let t=0;t<o;t++){const{cell:e,rowIndex:s}=this.getTheStartSpanCell(a,c,l,t);if(e){const{colSpan:i,rowSpan:r}=e;if(n===oe.ABOVE?s!==l:s+r>l+1){this.updateCellSpan(e,"rowspan",r+1),t+=i-1;continue}h.set(t,this.getDefaultCellBlockTemplate(e.type,i)),t+=i-1}}r.children=this.getSortedValuesByNumericKey(h);const d=re.from(r),u=n===oe.ABOVE?new B(i,d):new I(i,d);i.parent.apply(u)}}class Qs extends Ct{canIntercept(t,e){return Boolean(e.parent)}intercept(t,e,n){const s=this.createNewParagraph("");s&&(n.parent.apply(0===e.startOffset?new B(n,s):new I(n,s)),e.newBlock=s)}createNewParagraph(e){const n=V.getRTEBlockClass("paragraph");if(n)return n.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:e}]})}}class Js extends ${constructor(){super(...arguments),this.stylesToBeFiltered=Rt.getDefaultStyles(),this.elementTagName="table"}canFilter(t){return this.isTableBlock(t.typeName)}canRefill(t,e){return this.isTableBlock(t)&&e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableBlock(t){return"RTETableBlock"===t}}class Ys extends ${constructor(){super(...arguments),this.stylesToBeFiltered=Fn.getDefaultStyles(),this.elementTagName="table caption"}canFilter(t){return this.isTableCaption(t.typeName)}canRefill(t,e){return this.isTableCaption(t)&&"CAPTION"===e.nodeName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableCaption(t){return"RTETableCaptionBlock"===t}}class Xs extends ${constructor(t="td"){super(),this.stylesToBeFiltered=Bt.getDefaultStyles(),this.elementTagName="",this.stylesWithRGBColor=Bt.getDefaultStyles(!1),this.cellBlockClassName="",this.elementTagName=t,this.cellBlockClassName="td"===t?"RTETableCellBlock":"RTETableHeadCellBlock"}canFilter(t){return this.isTableCell(t.typeName)}filterAndDeleteStyles(t,e){return this.convertDefaultBorderColorFromRGBToHex(t),super.filterAndDeleteStyles(t,e)}canRefill(t,e){return this.isTableCell(t)&&e.nodeName===this.elementTagName.toUpperCase()}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableCell(t){return t===this.cellBlockClassName}convertDefaultBorderColorFromRGBToHex(t){t&&t.border&&t.border===this.stylesWithRGBColor.border&&(t.border=this.stylesToBeFiltered.border)}}class ti extends wt{constructor(t=le){super(),this.toolbarButtonRenderer=new gs,this.tableBlockRenderer=new os,this.tableRowBlockRenderer=new cs,this.tableCellRenderer=new hs,this.tableHeadCellRenderer=new us,this.tableSelection=new Ls,_t.setTableColors(t),this.registerToolbarButtonRenderer(ti.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer),this.registerBlockBasicStrategies(Pt.typeName),this.registerBlockBasicStrategies(Ft.typeName),this.registerBlockBasicStrategies(Nt.typeName),this.registerBlockBasicStrategies(re.typeName),this.registerBlockBasicStrategies($t.typeName),this.registerBlockBasicStrategies(zt.typeName),this.registerRenderer("table-block",this.tableBlockRenderer),this.registerRenderer("table-head",new ls),this.registerRenderer("table-head-cell",this.tableHeadCellRenderer),this.registerRenderer("table-row",this.tableRowBlockRenderer),this.registerRenderer("table-cell",this.tableCellRenderer),this.registerRenderer("table-body",new ds),this.registerRenderer("table-caption",new ys),this.registerNode("table-block",Pt),this.registerNode("table-head",Ft),this.registerNode("table-head-cell",Nt),this.registerNode("table-row",re),this.registerNode("table-cell",$t),this.registerNode("table-body",zt),this.registerNode("table-caption",zn),this.registerElementToBlockDTOClassStrategy(new Ms),this.registerElementToBlockDTOClassStrategy(new js),this.registerElementToBlockDTOClassStrategy(new Hs),this.registerElementToBlockDTOClassStrategy(new Ds),this.registerElementToBlockDTOClassStrategy(new _s),this.registerElementToBlockDTOClassStrategy(new Ps),this.registerAnnotationHandler(new $s),this.registerAnnotationHandler(new Fs),this.registerAnnotationHandler(new zs)}initialExtensionAfterLoad(t){this.tableSelection.init(t);const e=Object.assign(Object.assign({},t),{tableSelection:this.tableSelection});super.initialExtensionAfterLoad(e)}destroyExtension(){this.tableBlockRenderer.destroy(),this.tableSelection.destroy()}}(()=>{const t=new ws,e=new vs;wt.registerActionHandleStrategy(nt.typeName,"INSERT_TABLE_BLOCK",t),wt.registerActionHandleStrategy(Pt.typeName,"DELETE_TABLE_BLOCK",e),wt.registerActionHandleStrategy(A.typeName,"INSERT_TABLE_BLOCK",t),wt.registerActionHandleStrategy(lt.typeName,"INSERT_TABLE_BLOCK",t),wt.registerActionHandleStrategy(Pt.typeName,ce,new Gs),wt.registerActionHandleStrategy(Pt.typeName,he,new Zs),wt.registerActionHandleStrategy(Pt.typeName,de,new Cs),wt.registerActionHandleStrategy(Pt.typeName,ue,new Ts),wt.registerActionHandleStrategy(Pt.typeName,pe,new As),wt.registerActionHandleStrategy(Pt.typeName,fe,new Ss),wt.registerActionHandleStrategy(Pt.typeName,ge,new we),wt.registerActionHandleStrategy(re.typeName,me,new Is),wt.registerActionHandleStrategy(re.typeName,"CREATE_SEGMENT_TABLE_CELL",new Es),wt.registerActionHandleStrategy(re.typeName,ve,new Os),wt.registerActionHandleStrategy($t.typeName,be,new qs),wt.registerActionHandleStrategy($t.typeName,ye,new Us),wt.registerActionHandleStrategy(Nt.typeName,be,new qs),wt.registerActionHandleStrategy(Nt.typeName,ye,new Us),wt.registerActionHandleStrategy(Pt.typeName,xe,new Rs),wt.registerActionHandleStrategy(Pt.typeName,Ce,new Ns),wt.registerActionHandleStrategy(Pt.typeName,Un.typeName,new Ks),wt.registerActionHandleStrategy($t.typeName,Jn.typeName,new Ws),wt.registerActionHandleStrategy(Nt.typeName,Yn.typeName,new Ws),wt.registerActionHandlerInterceptor(A.typeName,M.DELETE_BLOCK_CONTENT,new ms),wt.registerActionHandlerInterceptor(re.typeName,M.INSERT_CHILDREN_BEFORE,new Bs),wt.registerActionHandlerInterceptor($t.typeName,M.DELETE_CHILDREN,new bs),wt.registerActionHandlerInterceptor(Nt.typeName,M.DELETE_CHILDREN,new bs),wt.registerActionHandlerInterceptor(Pt.typeName,M.INSERT_NEW_PARAGRAPH,new Qs),wt.registerFilterStylesStrategy(Pt.typeName,new Js),wt.registerFilterStylesStrategy(zn.typeName,new Ys),wt.registerFilterStylesStrategy($t.typeName,new Xs),wt.registerFilterStylesStrategy(Nt.typeName,new Xs("th"))})(),ti.TOOLBAR_BUTTON_KEY="table";class ei extends F{constructor(t,e,n){super(t,n),this.type="horizontal-line",this.parent=e}toJSON(){return{id:this.id,type:"horizontal-line"}}clone(t){return new ei(this.id,t,super.cloneAnnotations())}toHtml(){return"<hr>"}}ei.typeName="RTEHorizontalLineNode";const ni={display:"inline-block",width:"100%",height:"4px",backgroundColor:"rgb(222, 222, 222)",borderWidth:"0px"};class si extends ${constructor(){super(...arguments),this.stylesToBeFiltered=ni,this.elementTagName="hr"}canFilter(t){return class{static isHorizontalLineBlock(t){return"RTEHorizontalLineBlock"===t}}.isHorizontalLineBlock(t.typeName)}canRefill(t,e){return e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}var ii;!function(t){t.HORIZONTAL_LINE="HORIZONTAL_LINE"}(ii||(ii={}));class ri extends j{constructor(){super(...arguments),this.type=ii.HORIZONTAL_LINE}static from(){return[ii.HORIZONTAL_LINE,new ri]}static getDefaultStyles(){return ni}toJSON(){return null}clone(){return new ri}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte-horizontal-line-hr"}renderStyle(t){return(null==t?void 0:t.standalone)?ri.getDefaultStyles():null}}class ai extends T{constructor(t,e){super(t),this.type="horizontal-line",this.children=[];const{autoMatchFormat:n=!0}=null!=e?e:{};n&&(this.annotationMap=new Map([ri.from()]))}static from(e,n={autoMatchFormat:!0}){var s,i;const r=new ai(e.id,n),a=(null===(i=null===(s=e.children)||void 0===s?void 0:s[0])||void 0===i?void 0:i.id)||t(),o=new ei(a,r);return r.children=[o],e.annotations&&T.convertAnnotationsToMap(r.annotationMap,e.annotations),r}static create(e,n={autoMatchFormat:!0}){const s=new ai(t(),n),i=new ei(t(),s);return s.children=[i],e&&T.convertAnnotationsToMap(s.annotationMap,e),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"horizontal-line",children:this.children.map((t=>t.toJSON()))})}toHtml(t){return`<hr${super.generateAttributeString(t)}>`}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1]}clone(t){const e=new ai(this.id);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}}ai.typeName="RTEHorizontalLineBlock";class oi extends gt{doRender(t,e,n){const s=e.children[0],i=e.getStyles(n),r=e.getClasses(n),a=[F.DECORATOR_NODE_CLASS,r].filter(Boolean).join(" ");return t("div",{key:e.id,class:`v-rte-horizontal-line ${F.DECORATOR_CONTAINER_CLASS}`,ref:this.useRef(e)},[t("hr",{key:(null==s?void 0:s.id)||e.id+"-hr",class:a,style:Object.keys(i).length>0?i:void 0,ref:s?this.useRef(s):void 0})])}injectRTEScopeStyles(){return".v-rte-horizontal-line{padding:8px 0;overflow:hidden}.v-rte-horizontal-line .v-rte-horizontal-line-hr{display:inline-block;width:100%;height:4px;border-width:0px;background-color:rgb(222, 222, 222)}"}}oi.typeName="RTEHorizontalLineBlockRenderer";class li extends v{constructor(t,e=0){super(),this.type="INSERT_HORIZONTAL_LINE_BLOCK",this.splitPointNode=t,this.startOffsetOfNode=e}}class ci extends xt{render(t,e){return this.renderButton(t,e,{icon:"horizontal-line",ariaLabel:w.t("Horizontal line"),tooltip:{text:w.t("Horizontal line")}})}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,[s]=n();return s?t.disabled||!b.canHandle("INSERT_HORIZONTAL_LINE_BLOCK",s.parent):t.disabled}return!1}handleButtonClick(t){if(this.isDisabled(t))return;const e=this.getExtensionContext(t.host);if(e){const{host:n,getSelectedNodes:s,flushValue:i}=e,r=s()[0],a=new li(r,t.rteRange.startOffset);r?r.parent&&r.parent.apply(a):n.value.apply(a),a.nextFocusNode&&n.value.apply(new et(a.nextFocusNode,0)),i(n.value)}}handleDropdownClick(){}}vt.register({"horizontal-line":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 224H32 608h32v64H608 32 0V224z"/></svg>'}});class hi extends it{canHandle(t,e){return"HR"===t[e].tagName?1:0}handle(t,e){const n=rt.generate(ai,t[0],e);return ai.create(n,e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class di extends O{handleAction(t,e){const n=ai.create();if(t.splitPointNode instanceof y){const s=t.splitPointNode,i=t.startOffsetOfNode;if(this.isCaretPositionAtBlockEnd(e,s,i))this.insertAfterWithFocus(t,e,n);else if(this.isCaretPositionAtBlockStart(e,s,i))e.parent.apply(new B(e,n)),t.nextFocusNode=e.getFirstNode();else{const r=new z(s,i);e.apply(r);const a=this.getNextSiblingBlock(e);e.parent.apply(new I(e,n)),t.nextFocusNode=a.getFirstNode()}}else if(t.splitPointNode)this.insertAfterWithFocus(t,e,n);else{const s=super.createNewParagraph("");e.apply(new R([n,s])),t.nextFocusNode=s.children[0]}}insertAfterWithFocus(t,e,n){const s=this.getNextSiblingBlock(e),i=null==s?void 0:s.getFirstNode();if(i instanceof y)e.parent.apply(new I(e,n)),t.nextFocusNode=i;else{const s=super.createNewParagraph("");e.parent.apply(new I(e,n,s)),t.nextFocusNode=s.children[0]}}getNextSiblingBlock(t){const e=t.parent.children,n=e.indexOf(t);return e[n+1]}}class ui extends wt{constructor(){super(),this.blockRenderer=new oi,this.toolbarButtonRenderer=new ci,this.registerBlockBasicStrategies(ai.typeName),this.registerNode("horizontal-line",ai),this.registerRenderer("horizontal-line",this.blockRenderer),this.registerToolbarButtonRenderer(ui.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer),this.registerElementToBlockDTOClassStrategy(new hi),wt.registerFilterStylesStrategy(ai.typeName,new si)}}var pi;(()=>{const t=new di;wt.registerActionHandleStrategy(nt.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t),wt.registerActionHandleStrategy(A.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t),wt.registerActionHandleStrategy(lt.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t),wt.registerActionHandleStrategy(ai.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t)})(),ui.TOOLBAR_BUTTON_KEY="horizontalLine",function(t){t.BLOCKQUOTE="BLOCKQUOTE"}(pi||(pi={}));const fi={overflow:"hidden",marginInline:"0",paddingInline:"24px",borderInlineStart:"solid 5px hsl(0, 0%, 80%)"};class gi extends j{constructor(){super(...arguments),this.type=pi.BLOCKQUOTE}static from(){return[pi.BLOCKQUOTE,new gi]}static getDefaultCssText(){return`.v-rte-blockquote {\n${Object.entries(fi).map((([t,e])=>`\t${Ve(t)}: ${e};`)).join("\n")}\n}`}toJSON(){return null}clone(){return new gi}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte-blockquote"}renderStyle(t){return(null==t?void 0:t.standalone)?fi:null}}class wi extends T{constructor(t,e){super(t),this.type="blockquote",this.children=[];const{autoMatchFormat:n=!0}=null!=e?e:{};n&&(this.annotationMap=new Map([gi.from()]))}static from(t,e){const n=new wi(t.id,e);return t.annotations&&T.convertAnnotationsToMap(n.annotationMap,t.annotations),n.children=T.generateBlockChildren(t.children,e,n),n}clone(t){const e=new wi(this.id),n=e;return e.children=this.children.map((t=>t.clone(n))),e.annotationMap=this.cloneAnnotations(),e.parent=t,e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0}toHtml(t){return`<blockquote${this.generateAttributeString(t)}>${this.children.map((e=>e.toHtml(t))).join("")}</blockquote>`}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:"blockquote",children:this.children.map((t=>t.toJSON()))})}}wi.typeName="RTEBlockquoteBlock";class mi extends O{handleAction(e,n){const s=e.selectedBlocks,i=n.children,r=new Set(s),a=i.indexOf(s[0]),o=i.slice(0,a).filter((t=>!r.has(t))).length,l=new wi(t());l.parent=n,l.children=s,s.forEach((t=>{t.parent=l}));for(let t=i.length-1;t>=0;t--)r.has(i[t])&&i.splice(t,1);i.splice(o,0,l)}}class vi extends O{handleAction(t,e){const n=e.parent,s=[...e.children];s.length>0&&n.apply(new B(e,...s)),n.apply(new D(e))}}class bi extends Ct{canIntercept(t,e){const n=e.parent;return n instanceof wi&&!e.isNotEmpty()&&n.children[n.children.length-1]===e}intercept(t,e,n){const s=n.parent,i=this.createNewParagraph("");i&&(s.parent.apply(new I(s,i)),s.apply(new D(n)),e.newBlock=i)}createNewParagraph(e){const n=V.getRTEBlockClass("paragraph");if(n)return n.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:e}]})}}class yi extends v{constructor(t){super(),this.isFlushable=!0,this.type="TRANSFORM_TO_BLOCKQUOTE",this.selectedBlocks=t}}class xi extends v{constructor(){super(...arguments),this.isFlushable=!0,this.type="REMOVE_BLOCKQUOTE"}}class Ci extends it{canHandle(t,e){return"BLOCKQUOTE"===t[e].tagName?1:0}handle(e,n){const s=rt.generate(wi,e[0],n);return wi.from({id:t(),type:"blockquote",annotations:s,children:[]},n)}appendChildBlocks(t,e){const n=e.flatMap((t=>t instanceof wi?t.children:[t]));t.children=n.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class Li extends gt{doRender(t,e,n){var s;return t("blockquote",Object.assign({key:e.id,class:e.getClasses(n),style:e.getStyles(n),ref:this.useRef(e)},null===(s=e.getCustomAttributesAnnotation())||void 0===s?void 0:s.render()))}injectRTEScopeStyles(){return gi.getDefaultCssText()}}Li.typeName="RTEBlockquoteBlockRenderer";const Ti=new Li;class Ai extends xt{render(t,e){return this.renderButton(t,e,{icon:"quote-left",ariaLabel:e.translation.t("Block quote"),tooltip:{text:"Block quote"}})}isSelected(t){const e=this.getStartNode(t);return!!e&&null!==this.findBlockquoteAncestor(e)}isDisabled(t){if(t.host.disabled)return!0;const e=this.getStartNode(t);if(!e||null!==this.findBlockquoteAncestor(e))return!1;const{container:n}=this.resolveWrapAnchor(e.parent);return!b.canHandle("TRANSFORM_TO_BLOCKQUOTE",n)}handleButtonClick(t){const e=this.getExtensionContext(t.host);if(e){const{host:n,getSelectedNodes:s}=e,i=s(),r=i[0];if(!r)return void this.appendEmptyBlockquote(n.value);this.findBlockquoteAncestor(r)?this.collectBlockquoteAncestors(i).forEach((t=>{t.apply(new xi)})):this.wrapSelectedBlocks(i),n.value.apply(new et(r,t.rteRange.startOffset))}}handleDropdownClick(){}appendEmptyBlockquote(e){if(e.children.length>0){const n=e.children[e.children.length-1],s=A.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]});e.apply(new I(n,s)),e.apply(new yi([s])),e.apply(new et(s.getLastNode(),0))}}wrapSelectedBlocks(t){var e,n;const s=this.getUniqueBlocks(t),i=new Set(s.map((t=>{var e;return null!==(e=this.resolveWrapAnchor(t,!0).wrapBlock)&&void 0!==e?e:t}))).size>1,r=new Set;for(const t of s){const{wrapBlock:e}=this.resolveWrapAnchor(t,i);e instanceof wi&&!r.has(e)&&(r.add(e),e.apply(new xi))}const a=new Map;for(const t of s){const s=this.resolveWrapAnchor(t,i),{container:r}=s;if(r){const i=null!==(e=s.wrapBlock)&&void 0!==e?e:t,o=null!==(n=a.get(r))&&void 0!==n?n:new Set;o.add(i),a.set(r,o)}}for(const[t,e]of a)t.apply(new yi([...e]))}getStartNode(t){const e=this.getExtensionContext(t.host);return null==e?void 0:e.getSelectedNodes()[0]}collectBlockquoteAncestors(t){const e=new Set;return t.forEach((t=>{const n=this.findBlockquoteAncestor(t);n&&e.add(n)})),e}findBlockquoteAncestor(t){let e=t.parent;for(;e&&!(e instanceof nt);){if(e instanceof wi)return e;e=e.parent}return null}getUniqueBlocks(t){const e=new Set,n=[];return t.forEach((t=>{const s=t.parent;s&&!e.has(s)&&(e.add(s),n.push(s))})),n}resolveWrapAnchor(t,e=!1){let n=t;for(;n.parent&&!(n.parent instanceof nt)&&(e||!b.canHandle("TRANSFORM_TO_BLOCKQUOTE",n.parent));)n=n.parent;return{wrapBlock:n!==t?n:null,container:n.parent}}}vt.register({"quote-left":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M0 216C0 149.7 53.7 96 120 96l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64L0 216zm256 0c0-66.3 53.7-120 120-120l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64l0-136z"/></svg>'}});class Si extends ${constructor(){super(...arguments),this.stylesToBeFiltered=fi,this.elementTagName="blockquote"}static isBlockquoteBlock(t){return"RTEBlockquoteBlock"===t}canFilter(t){return Si.isBlockquoteBlock(t.typeName)}canRefill(t,e){return e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}class ki extends wt{constructor(){super(),this.toolbarButtonRenderer=new Ai,this.registerBlockBasicStrategies(wi.typeName),this.registerNode("blockquote",wi),this.registerRenderer("blockquote",Ti),this.registerToolbarButtonRenderer(ki.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer),this.registerElementToBlockDTOClassStrategy(new Ci),wt.registerFilterStylesStrategy(wi.typeName,new Si)}}(()=>{const t=new mi;wt.registerActionHandleStrategy(nt.typeName,"TRANSFORM_TO_BLOCKQUOTE",t),wt.registerActionHandleStrategy($t.typeName,"TRANSFORM_TO_BLOCKQUOTE",t),wt.registerActionHandleStrategy(Nt.typeName,"TRANSFORM_TO_BLOCKQUOTE",t),wt.registerActionHandleStrategy(wi.typeName,"REMOVE_BLOCKQUOTE",new vi),wt.registerActionHandlerInterceptor(A.typeName,M.INSERT_NEW_PARAGRAPH,new bi)})(),ki.TOOLBAR_BUTTON_KEY="blockquote";const Ei={key:"latin",label:"Latin",characters:[{character:"Ā",title:"Latin capital letter a with macron"},{character:"ā",title:"Latin small letter a with macron"},{character:"Ă",title:"Latin capital letter a with breve"},{character:"ă",title:"Latin small letter a with breve"},{character:"Ą",title:"Latin capital letter a with ogonek"},{character:"ą",title:"Latin small letter a with ogonek"},{character:"Ć",title:"Latin capital letter c with acute"},{character:"ć",title:"Latin small letter c with acute"},{character:"Ĉ",title:"Latin capital letter c with circumflex"},{character:"ĉ",title:"Latin small letter c with circumflex"},{character:"Ċ",title:"Latin capital letter c with dot above"},{character:"ċ",title:"Latin small letter c with dot above"},{character:"Č",title:"Latin capital letter c with caron"},{character:"č",title:"Latin small letter c with caron"},{character:"Ď",title:"Latin capital letter d with caron"},{character:"ď",title:"Latin small letter d with caron"},{character:"Đ",title:"Latin capital letter d with stroke"},{character:"đ",title:"Latin small letter d with stroke"},{character:"Ē",title:"Latin capital letter e with macron"},{character:"ē",title:"Latin small letter e with macron"},{character:"Ĕ",title:"Latin capital letter e with breve"},{character:"ĕ",title:"Latin small letter e with breve"},{character:"Ė",title:"Latin capital letter e with dot above"},{character:"ė",title:"Latin small letter e with dot above"},{character:"Ę",title:"Latin capital letter e with ogonek"},{character:"ę",title:"Latin small letter e with ogonek"},{character:"Ě",title:"Latin capital letter e with caron"},{character:"ě",title:"Latin small letter e with caron"},{character:"Ĝ",title:"Latin capital letter g with circumflex"},{character:"ĝ",title:"Latin small letter g with circumflex"},{character:"Ğ",title:"Latin capital letter g with breve"},{character:"ğ",title:"Latin small letter g with breve"},{character:"Ġ",title:"Latin capital letter g with dot above"},{character:"ġ",title:"Latin small letter g with dot above"},{character:"Ģ",title:"Latin capital letter g with cedilla"},{character:"ģ",title:"Latin small letter g with cedilla"},{character:"Ĥ",title:"Latin capital letter h with circumflex"},{character:"ĥ",title:"Latin small letter h with circumflex"},{character:"Ħ",title:"Latin capital letter h with stroke"},{character:"ħ",title:"Latin small letter h with stroke"},{character:"Ĩ",title:"Latin capital letter i with tilde"},{character:"ĩ",title:"Latin small letter i with tilde"},{character:"Ī",title:"Latin capital letter i with macron"},{character:"ī",title:"Latin small letter i with macron"},{character:"Ĭ",title:"Latin capital letter i with breve"},{character:"ĭ",title:"Latin small letter i with breve"},{character:"Į",title:"Latin capital letter i with ogonek"},{character:"į",title:"Latin small letter i with ogonek"},{character:"İ",title:"Latin capital letter i with dot above"},{character:"ı",title:"Latin small letter dotless i"},{character:"IJ",title:"Latin capital ligature ij"},{character:"ij",title:"Latin small ligature ij"},{character:"Ĵ",title:"Latin capital letter j with circumflex"},{character:"ĵ",title:"Latin small letter j with circumflex"},{character:"Ķ",title:"Latin capital letter k with cedilla"},{character:"ķ",title:"Latin small letter k with cedilla"},{character:"ĸ",title:"Latin small letter kra"},{character:"Ĺ",title:"Latin capital letter l with acute"},{character:"ĺ",title:"Latin small letter l with acute"},{character:"Ļ",title:"Latin capital letter l with cedilla"},{character:"ļ",title:"Latin small letter l with cedilla"},{character:"Ľ",title:"Latin capital letter l with caron"},{character:"ľ",title:"Latin small letter l with caron"},{character:"Ŀ",title:"Latin capital letter l with middle dot"},{character:"ŀ",title:"Latin small letter l with middle dot"},{character:"Ł",title:"Latin capital letter l with stroke"},{character:"ł",title:"Latin small letter l with stroke"},{character:"Ń",title:"Latin capital letter n with acute"},{character:"ń",title:"Latin small letter n with acute"},{character:"Ņ",title:"Latin capital letter n with cedilla"},{character:"ņ",title:"Latin small letter n with cedilla"},{character:"Ň",title:"Latin capital letter n with caron"},{character:"ň",title:"Latin small letter n with caron"},{character:"ʼn",title:"Latin small letter n preceded by apostrophe"},{character:"Ŋ",title:"Latin capital letter eng"},{character:"ŋ",title:"Latin small letter eng"},{character:"Ō",title:"Latin capital letter o with macron"},{character:"ō",title:"Latin small letter o with macron"},{character:"Ŏ",title:"Latin capital letter o with breve"},{character:"ŏ",title:"Latin small letter o with breve"},{character:"Ő",title:"Latin capital letter o with double acute"},{character:"ő",title:"Latin small letter o with double acute"},{character:"Œ",title:"Latin capital ligature oe"},{character:"œ",title:"Latin small ligature oe"},{character:"Ŕ",title:"Latin capital letter r with acute"},{character:"ŕ",title:"Latin small letter r with acute"},{character:"Ŗ",title:"Latin capital letter r with cedilla"},{character:"ŗ",title:"Latin small letter r with cedilla"},{character:"Ř",title:"Latin capital letter r with caron"},{character:"ř",title:"Latin small letter r with caron"},{character:"Ś",title:"Latin capital letter s with acute"},{character:"ś",title:"Latin small letter s with acute"},{character:"Ŝ",title:"Latin capital letter s with circumflex"},{character:"ŝ",title:"Latin small letter s with circumflex"},{character:"Ş",title:"Latin capital letter s with cedilla"},{character:"ş",title:"Latin small letter s with cedilla"},{character:"Š",title:"Latin capital letter s with caron"},{character:"š",title:"Latin small letter s with caron"},{character:"Ţ",title:"Latin capital letter t with cedilla"},{character:"ţ",title:"Latin small letter t with cedilla"},{character:"Ť",title:"Latin capital letter t with caron"},{character:"ť",title:"Latin small letter t with caron"},{character:"Ŧ",title:"Latin capital letter t with stroke"},{character:"ŧ",title:"Latin small letter t with stroke"},{character:"Ũ",title:"Latin capital letter u with tilde"},{character:"ũ",title:"Latin small letter u with tilde"},{character:"Ū",title:"Latin capital letter u with macron"},{character:"ū",title:"Latin small letter u with macron"},{character:"Ŭ",title:"Latin capital letter u with breve"},{character:"ŭ",title:"Latin small letter u with breve"},{character:"Ů",title:"Latin capital letter u with ring above"},{character:"ů",title:"Latin small letter u with ring above"},{character:"Ű",title:"Latin capital letter u with double acute"},{character:"ű",title:"Latin small letter u with double acute"},{character:"Ų",title:"Latin capital letter u with ogonek"},{character:"ų",title:"Latin small letter u with ogonek"},{character:"Ŵ",title:"Latin capital letter w with circumflex"},{character:"ŵ",title:"Latin small letter w with circumflex"},{character:"Ŷ",title:"Latin capital letter y with circumflex"},{character:"ŷ",title:"Latin small letter y with circumflex"},{character:"Ÿ",title:"Latin capital letter y with diaeresis"},{character:"Ź",title:"Latin capital letter z with acute"},{character:"ź",title:"Latin small letter z with acute"},{character:"Ż",title:"Latin capital letter z with dot above"},{character:"ż",title:"Latin small letter z with dot above"},{character:"Ž",title:"Latin capital letter z with caron"},{character:"ž",title:"Latin small letter z with caron"},{character:"ſ",title:"Latin small letter long s"}]},Oi={key:"mathematical",label:"Mathematical",characters:[{character:"<",title:"Less-than sign"},{character:">",title:"Greater-than sign"},{character:"≤",title:"Less-than or equal to"},{character:"≥",title:"Greater-than or equal to"},{character:"–",title:"En dash"},{character:"—",title:"Em dash"},{character:"¯",title:"Macron"},{character:"‾",title:"Overline"},{character:"°",title:"Degree sign"},{character:"−",title:"Minus sign"},{character:"±",title:"Plus-minus sign"},{character:"÷",title:"Division sign"},{character:"⁄",title:"Fraction slash"},{character:"×",title:"Multiplication sign"},{character:"ƒ",title:"Latin small letter f with hook"},{character:"∫",title:"Integral"},{character:"∑",title:"N-ary summation"},{character:"∞",title:"Infinity"},{character:"√",title:"Square root"},{character:"∼",title:"Tilde operator"},{character:"≅",title:"Approximately equal to"},{character:"≈",title:"Almost equal to"},{character:"≠",title:"Not equal to"},{character:"≡",title:"Identical to"},{character:"∈",title:"Element of"},{character:"∉",title:"Not an element of"},{character:"∋",title:"Contains as member"},{character:"∏",title:"N-ary product"},{character:"∧",title:"Logical and"},{character:"∨",title:"Logical or"},{character:"¬",title:"Not sign"},{character:"∩",title:"Intersection"},{character:"∪",title:"Union"},{character:"∂",title:"Partial differential"},{character:"∀",title:"For all"},{character:"∃",title:"There exists"},{character:"∅",title:"Empty set"},{character:"∇",title:"Nabla"},{character:"∗",title:"Asterisk operator"},{character:"∝",title:"Proportional to"},{character:"∠",title:"Angle"},{character:"¼",title:"Vulgar fraction one quarter"},{character:"½",title:"Vulgar fraction one half"},{character:"¾",title:"Vulgar fraction three quarters"}]},Ii={key:"arrows",label:"Arrows",characters:[{character:"←",title:"leftwards simple arrow"},{character:"→",title:"rightwards simple arrow"},{character:"↑",title:"upwards simple arrow"},{character:"↓",title:"downwards simple arrow"},{character:"⇐",title:"leftwards double arrow"},{character:"⇒",title:"rightwards double arrow"},{character:"⇑",title:"upwards double arrow"},{character:"⇓",title:"downwards double arrow"},{character:"⇠",title:"leftwards dashed arrow"},{character:"⇢",title:"rightwards dashed arrow"},{character:"⇡",title:"upwards dashed arrow"},{character:"⇣",title:"downwards dashed arrow"},{character:"⇤",title:"leftwards arrow to bar"},{character:"⇥",title:"rightwards arrow to bar"},{character:"⤒",title:"upwards arrow to bar"},{character:"⤓",title:"downwards arrow to bar"},{character:"↨",title:"up down arrow with base"},{character:"🔙",title:"back with leftwards arrow above"},{character:"🔚",title:"end with leftwards arrow above"},{character:"🔛",title:"on with exclamation mark with left right arrow above"},{character:"🔜",title:"soon with rightwards arrow above"},{character:"🔝",title:"top with upwards arrow above"}]},Ri={key:"currency",label:"Currency",characters:[{character:"$",title:"Dollar sign"},{character:"€",title:"Euro sign"},{character:"¥",title:"Yen sign"},{character:"£",title:"Pound sign"},{character:"¢",title:"Cent sign"},{character:"₠",title:"Euro-currency sign"},{character:"₡",title:"Colon sign"},{character:"₢",title:"Cruzeiro sign"},{character:"₣",title:"French franc sign"},{character:"₤",title:"Lira sign"},{character:"¤",title:"Currency sign"},{character:"₿",title:"Bitcoin sign"},{character:"₥",title:"Mill sign"},{character:"₦",title:"Naira sign"},{character:"₧",title:"Peseta sign"},{character:"₨",title:"Rupee sign"},{character:"₩",title:"Won sign"},{character:"₪",title:"New sheqel sign"},{character:"₫",title:"Dong sign"},{character:"₭",title:"Kip sign"},{character:"₮",title:"Tugrik sign"},{character:"₯",title:"Drachma sign"},{character:"₰",title:"German penny sign"},{character:"₱",title:"Peso sign"},{character:"₲",title:"Guarani sign"},{character:"₳",title:"Austral sign"},{character:"₴",title:"Hryvnia sign"},{character:"₵",title:"Cedi sign"},{character:"₶",title:"Livre tournois sign"},{character:"₷",title:"Spesmilo sign"},{character:"₸",title:"Tenge sign"},{character:"₹",title:"Indian rupee sign"},{character:"₺",title:"Turkish lira sign"},{character:"₻",title:"Nordic mark sign"},{character:"₼",title:"Manat sign"},{character:"₽",title:"Ruble sign"}]},Bi={key:"text",label:"Text",characters:[{character:"‹",title:"Single left-pointing angle quotation mark"},{character:"›",title:"Single right-pointing angle quotation mark"},{character:"«",title:"Left-pointing double angle quotation mark"},{character:"»",title:"Right-pointing double angle quotation mark"},{character:"‘",title:"Left single quotation mark"},{character:"’",title:"Right single quotation mark"},{character:"“",title:"Left double quotation mark"},{character:"”",title:"Right double quotation mark"},{character:"‚",title:"Single low-9 quotation mark"},{character:"„",title:"Double low-9 quotation mark"},{character:"¡",title:"Inverted exclamation mark"},{character:"¿",title:"Inverted question mark"},{character:"‥",title:"Two dot leader"},{character:"…",title:"Horizontal ellipsis"},{character:"‡",title:"Double dagger"},{character:"‰",title:"Per mille sign"},{character:"‱",title:"Per ten thousand sign"},{character:"‼",title:"Double exclamation mark"},{character:"⁈",title:"Question exclamation mark"},{character:"⁉",title:"Exclamation question mark"},{character:"⁇",title:"Double question mark"},{character:"©",title:"Copyright sign"},{character:"®",title:"Registered sign"},{character:"™",title:"Trade mark sign"},{character:"§",title:"Section sign"},{character:"¶",title:"Paragraph sign"},{character:"⁋",title:"Reversed paragraph sign"}]},Ni=[Ri,Bi,Oi,Ii,Ei];class Mi extends xt{constructor(t){super(),this.panelRef=null,this.categories=t}render(t,e){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,isScreenPosition:!0,role:"presentation",ref:t=>{t&&Te.addUniqueObserverToNode(t,Ne,(()=>{this.handlePopoverShow()}))}},[t("div",{slot:"popover"},[t("vega-rich-text-special-characters-panel",{categories:this.categories,ref:t=>{t&&(this.panelRef=t,Te.addUniqueObserverToNode(t,Me,(t=>{this.insertCharacter(e,t.detail)})))}})]),t("div",{slot:"popover-content"},this.renderButton(t,e,{icon:"rte-special-characters",ariaLabel:e.translation.t("Special Characters"),tooltip:{text:"Special Characters"}}))])}handleButtonClick(){}handleDropdownClick(){}handlePopoverShow(){this.panelRef&&this.panelRef.resetPanel()}insertCharacter(t,e){const n=t.rteRange,s=n.startNode;if(!s)return;const i=this.isCaretOnLineBreak(s,n)?this.insertAtLineBreak(s,e,n):this.insertAtTextNode(s,e,n);t.host.value.apply(new et(i.node,i.offset))}isCaretOnLineBreak(t,e){return t instanceof y&&"\n"===t.text&&e.startOffset===e.endOffset}insertAtTextNode(t,e,n){const s=new Lt(e,n);return s.isFlushable=!0,t.apply(s),{node:t,offset:Math.min(n.startOffset+e.length,t.getRangeEndOffset())}}insertAtLineBreak(t,e,n){return{node:this.insertTextToLineBreakNode(t,e,n),offset:e.length}}insertTextToLineBreakNode(t,e,n){const s=t.parent,i=s.children.indexOf(t);if(0===n.startOffset&&s.children[i+1]){const n=t.cloneWithText(e),i=new B(t,n);return i.isFlushable=!0,s.apply(i),n}const r=new K(e);return r.isFlushable=!0,t.apply(r),t}}vt.register({"rte-special-characters":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M224 80C126.8 80 48 158.8 48 256c0 63.7 33.8 119.5 84.6 150.4c11.4 7 19.4 19.6 19.4 34.2c0 21.8-17.6 39.4-39.4 39.4H24c-13.3 0-24-10.7-24-24s10.7-24 24-24H85.4C33.4 391 0 327.4 0 256C0 132.3 100.3 32 224 32s224 100.3 224 224c0 71.4-33.4 135-85.4 176H424c13.3 0 24 10.7 24 24s-10.7 24-24 24H335.4c-21.8 0-39.4-17.6-39.4-39.4c0-14.6 8-27.2 19.4-34.2C366.2 375.5 400 319.7 400 256c0-97.2-78.8-176-176-176z"/></svg>'}});class ji extends wt{constructor(t){super(),this.categories=this.buildCategories(t)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(ji.TOOLBAR_BUTTON_KEY,new Mi(this.categories),t)}buildCategories(t){const e=!1!==(null==t?void 0:t.includeDefaults)?Ni:[];return(null==t?void 0:t.categories)?[...e,...t.categories]:e}}ji.TOOLBAR_BUTTON_KEY="special-characters";class Hi{}class Di extends Hi{canHandle(t){return t instanceof W}collect(t){return[t]}}class _i extends Hi{canHandle(t){return t instanceof q}collect(t,e){const n=t,s=[n];if(n.nestList&&n.nestList.length>0)for(const t of n.nestList)s.push(...e(t.children));return s}}class Pi extends Hi{canHandle(t){return t instanceof A}collect(t){return[t]}}class Vi extends Hi{canHandle(t){return null!=t.children&&t.children.length>0&&!(t.children[0]instanceof y)}collect(t,e){return e(t.children)}}class $i{constructor(){this.matches=[],this.currentIndex=-1,this.flatCache=new WeakMap,this.cachedContent=null,this.matchCase=!1,this.wholeWords=!1,this.blockSearchStrategies=[new Di,new _i,new Pi,new Vi]}search(t,e){if(this.invalidateCacheIfNeeded(t),!e)return this.matches=[],void(this.currentIndex=-1);const n=this.buildRegExp(e,this.getFindOptions()),s=this.collectSearchableBlocks(t.children),i=[];for(const t of s){let e=this.flatCache.get(t);e||(e=t instanceof W?this.buildCodeBlockFlat(t):this.buildTextBlockFlat(t),this.flatCache.set(t,e));const{flatText:s,segments:r}=e;if(!s)continue;let a;for(n.lastIndex=0;null!==(a=n.exec(s));){const e=a.index+a[0].length,n=this.flatOffsetToNodePositions(r,e-a[1].length,e);n.length>0&&i.push({block:t,nodes:n,matchText:a[1]})}}this.matches=i,this.currentIndex=i.length>0?0:-1}next(){0!==this.matches.length&&(this.currentIndex=(this.currentIndex+1)%this.matches.length)}prev(){0!==this.matches.length&&(this.currentIndex=(this.currentIndex-1+this.matches.length)%this.matches.length)}setCurrentIndex(t){this.currentIndex=0!==this.matches.length?Math.max(0,Math.min(t,this.matches.length-1)):-1}getCurrentMatch(){var t;return null!==(t=this.matches[this.currentIndex])&&void 0!==t?t:null}getMatches(){return this.matches}getTotal(){return this.matches.length}getCurrentIndex(){return this.currentIndex}clearResults(){this.matches=[],this.currentIndex=-1}clear(){this.matches=[],this.currentIndex=-1,this.flatCache=new WeakMap,this.cachedContent=null}setMatchCase(t){this.matchCase=t}setWholeWords(t){this.wholeWords=t}invalidateCacheIfNeeded(t){t!==this.cachedContent&&(this.flatCache=new WeakMap,this.cachedContent=t)}buildRegExp(t,e){const n=this.escapeRegExp(t);let s="gu";if(e.matchCase||(s+="i"),e.wholeWords){const e="[^a-zA-ZÀ-ɏḀ-ỿ]",i=new RegExp(`^${e}`).test(t)?"":`(?:^|${e})`,r=new RegExp(`${e}$`).test(t)?"":`(?=${e}|$)`;return new RegExp(`${i}(${n})${r}`,s)}return new RegExp(`(${n})`,s)}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}collectSearchableBlocks(t){const e=[],n=this.collectSearchableBlocks.bind(this);for(const s of t){const t=this.blockSearchStrategies.find((t=>t.canHandle(s)));t&&e.push(...t.collect(s,n))}return e}buildTextBlockFlat(t){const e=[],n=[];let s=0;for(const i of t.children){if(!i.isContentEditable()){n.push("\0"),s+="\0".length;continue}const t=i.text.length;e.push({node:i,start:s,end:s+t}),n.push(i.text),s+=t}return{flatText:n.join(""),segments:e}}buildCodeBlockFlat(t){const e=t.children[0];if(!e)return{flatText:"",segments:[]};const n=e.text;return{flatText:n,segments:[{node:e,start:0,end:n.length}]}}flatOffsetToNodePositions(t,e,n){const s=[];for(const i of t){if(i.end<=e)continue;if(i.start>=n)break;const t=Math.max(0,e-i.start),r=Math.min(i.end,n)-i.start;s.push({node:i.node,startOffset:t,endOffset:r})}return s}getFindOptions(){return{matchCase:this.matchCase,wholeWords:this.wholeWords}}}class Fi{constructor(){this.overlayContainer=null,Re.registerCustomDarkModeColor({"rte-find-highlight-bg":"255, 235, 0, 0.55","rte-find-highlight-active-bg":"255, 190, 0, 0.7","rte-find-highlight-blend":"lighten"})}apply(t,e,n,s=!0){if(this.clear(),0===t.length)return;const i=this.getOrCreateOverlay(n);if(i){const n=i.getBoundingClientRect();let r=null;t.forEach(((t,s)=>{const a=s===e,o=a?"rgba(var(--v-rte-find-highlight-active-bg, 255, 150, 0, 0.5))":"rgba(var(--v-rte-find-highlight-bg, 255, 220, 0, 0.35))";t.nodes.forEach((t=>{const e=this.createHighlightRectangles(i,n,t,o);a&&!r&&e&&(r=e)}))})),s&&r&&r.scrollIntoView({block:"center",inline:"nearest"})}}clear(){this.overlayContainer&&(this.overlayContainer.innerHTML="")}getOrCreateOverlay(t){if(this.overlayContainer&&this.overlayContainer.isConnected)return this.overlayContainer;const e=He();if(e){const n=this.resolveOverlayMountTarget(t);if(n){const t=e.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.pointerEvents="none",t.style.overflow="visible",t.style.setProperty("mix-blend-mode","var(--v-rte-find-highlight-blend, multiply)"),n.appendChild(t),this.overlayContainer=t,t}}return null}resolveOverlayMountTarget(t){var e,n,s,i;return null!==(i=null===(s=null===(n=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector("vega-rich-text-content"))||void 0===n?void 0:n.shadowRoot)||void 0===s?void 0:s.querySelector(".rich-text-content"))&&void 0!==i?i:null}createHighlightRectangles(t,e,n,s){const i=L.getDOMByEntity(n.node);if(!i)return null;const r=this.buildRange(i,n);if(!r)return null;const a=r.getClientRects(),o=He();let l=null;if(o)for(let n=0;n<a.length;n++){const i=a[n];if(0===i.width||0===i.height)continue;const r=o.createElement("div");r.style.position="absolute",r.style.top=i.top-e.top+"px",r.style.left=i.left-e.left+"px",r.style.width=`${i.width}px`,r.style.height=`${i.height}px`,r.style.backgroundColor=s,r.style.pointerEvents="none",r.style.borderRadius="2px",t.appendChild(r),l||(l=r)}return l}buildRange(t,e){if(e.node instanceof U)return this.buildCodeBlockRange(t,e);const n=t.firstChild;if(!n)return null;const s=He();if(s){const t=s.createRange();try{return t.setStart(n,e.startOffset),t.setEnd(n,e.endOffset),t}catch(t){return null}}return null}buildCodeBlockRange(t,e){const n=t.shadowRoot.querySelector("code");if(!n)return null;const s=He();if(s){const t=s.createTreeWalker(n,NodeFilter.SHOW_TEXT);let i=0,r=null,a=0,o=null,l=0,c=t.nextNode();for(;c;){const n=c.textContent.length;if(!r&&i+n>e.startOffset&&(r=c,a=e.startOffset-i),i+n>=e.endOffset){o=c,l=e.endOffset-i;break}i+=n,c=t.nextNode()}if(r&&o){const t=s.createRange();try{return t.setStart(r,a),t.setEnd(o,l),t}catch(t){return null}}}return null}}class zi{constructor(t){this.context=t}setHost(t){this.context.hostRef=t}setKeyword(t){return this.context.keyword=t,this.context.state.clearResults(),this.context.hostRef&&this.context.highlightManager.clear(),{current:0,total:0}}applyAndGetResult(t=!0){const e=this.context.state.getTotal(),n=e>0?this.context.state.getCurrentIndex()+1:0;return this.context.hostRef&&this.context.highlightManager.apply(this.context.state.getMatches(),this.context.state.getCurrentIndex(),this.context.hostRef,t),{current:n,total:e}}}class Ki extends zi{constructor(t){super(t)}find(){return this.context.hostRef?(this.context.state.search(this.context.hostRef.value,this.context.keyword),this.applyAndGetResult()):{current:0,total:0}}next(){return this.context.state.next(),this.applyAndGetResult()}prev(){return this.context.state.prev(),this.applyAndGetResult()}clear(){this.context.state.clear(),this.context.hostRef&&this.context.highlightManager.clear()}refresh(t=!0){if(!this.context.keyword||!this.context.hostRef)return null;const e=this.context.state.getCurrentIndex();return this.context.state.search(this.context.hostRef.value,this.context.keyword),this.context.state.setCurrentIndex(e),this.applyAndGetResult(t)}setMatchCase(t){return this.context.state.setMatchCase(t),this.updateFindResults()}setWholeWords(t){return this.context.state.setWholeWords(t),this.updateFindResults()}updateFindResults(){return this.context.state.clearResults(),this.context.keyword&&this.context.hostRef?(this.context.state.search(this.context.hostRef.value,this.context.keyword),this.applyAndGetResult()):{current:0,total:0}}}class Wi extends zi{constructor(t){super(t),this.replacement="",this.flushFn=null}setFlushValue(t){this.flushFn=t}setReplacement(t){this.replacement=t}replace(){const t=this.context.state.getCurrentMatch();if(t&&this.context.hostRef&&this.flushFn){const e=this.context.state.getCurrentIndex();this.applyMatchReplacement(t),this.flushFn(this.context.hostRef.value),this.context.state.clear(),this.context.state.search(this.context.hostRef.value,this.context.keyword),this.context.state.setCurrentIndex(e)}return this.applyAndGetResult()}replaceAll(){if(this.context.state.getTotal()>0&&this.flushFn&&this.context.hostRef){const t=this.context.state.getMatches();for(let e=t.length-1;e>=0;e-=1)this.applyMatchReplacement(t[e]);this.flushFn(this.context.hostRef.value),this.context.state.clear(),this.context.state.search(this.context.hostRef.value,this.context.keyword)}return this.applyAndGetResult()}applyMatchReplacement(t){t.nodes.forEach(((t,e)=>{const n=0===e?this.replacement:"";t.node.text=t.node.text.slice(0,t.startOffset)+n+t.node.text.slice(t.endOffset)}))}}class qi extends xt{constructor(){super(...arguments),this.sharedContext={state:new $i,highlightManager:new Fi,hostRef:null,keyword:""},this.findController=new Ki(this.sharedContext),this.replaceController=new Wi(this.sharedContext),this.panelRef=null,this.popoverRef=null,this.isPopoverOpen=!1,this.scrollOnNextRefresh=!1,this.debouncedRefresh=Pe(this.onContentChanged,100,this),this.panelActionHandlers={find:()=>this.findController.find(),prev:()=>this.findController.prev(),next:()=>this.findController.next(),replace:()=>(this.scrollOnNextRefresh=!0,this.replaceController.replace()),"replace-all":()=>(this.scrollOnNextRefresh=!0,this.replaceController.replaceAll()),"match-case":t=>this.findController.setMatchCase(t),"whole-words":t=>this.findController.setWholeWords(t),close:()=>this.closePanel()}}render(t,e){return this.syncEditorState(e),t("vega-popover",{trigger:"none",alignment:"start",placement:"bottom",showArrow:!1,isScreenPosition:!0,role:"presentation",ref:t=>{t&&(this.popoverRef=t,Te.addUniqueObserverToNode(t,Be,(()=>{const t=this.shouldRestoreFocusToButton();this.isPopoverOpen=!1,this.findController.clear(),this.updatePanel({current:0,total:0}),t&&setTimeout((()=>this.focusToolbarButton()))})),Te.addUniqueObserverToNode(t,Ne,(()=>{this.isPopoverOpen=!0})))}},[t("div",{slot:"popover"},[t("vega-rich-text-find-replace-panel",{ref:t=>{t&&(this.panelRef=t,Te.addUniqueObserverToNode(t,je,(t=>{"keyword"===t.detail.type?this.updatePanel(this.findController.setKeyword(t.detail.value)):"replace"===t.detail.type&&this.replaceController.setReplacement(t.detail.value)})),Te.addUniqueObserverToNode(t,Me,(t=>{this.handlePanelAction(t.detail)})))}})]),t("div",{slot:"popover-content"},this.renderButton(t,e,{icon:"rte-find-replace",ariaLabel:e.translation.t("Find and replace"),tooltip:{text:w.t("Find and replace")}}))])}handleButtonClick(){this.popoverRef&&(this.isPopoverOpen?this.popoverRef.hide():this.popoverRef.show())}handleDropdownClick(){}syncEditorState(t){this.findController.setHost(t.host);const e=this.getExtensionContext(t.host);e&&this.replaceController.setFlushValue(e.flushValue),Te.addUniqueObserverToNode(t.host,je,this.debouncedRefresh),this.isHidden(t)&&this.isPopoverOpen&&this.popoverRef?this.popoverRef.hide():this.isPopoverOpen&&this.popoverRef&&this.popoverRef.show(!0)}handlePanelAction(t){const{action:e,data:n}=t,s=this.panelActionHandlers[e];if(s){const t=s(n);t&&this.updatePanel(t)}}updatePanel(t){this.panelRef&&this.panelRef.updateResult(t.current,t.total)}onContentChanged(){if(!this.isPopoverOpen)return;const t=this.scrollOnNextRefresh;this.scrollOnNextRefresh=!1;const e=this.findController.refresh(t);e&&this.updatePanel(e)}closePanel(){this.popoverRef&&this.popoverRef.hide()}shouldRestoreFocusToButton(){const t=a(document,!0);return!t||t===document.body||this.isElementWithinPanel(t)}isElementWithinPanel(t){if(!t||!this.panelRef)return!1;let e=t;for(;e;){if(e===this.panelRef)return!0;const t=e.parentNode;e=t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}return!1}}vt.register({"rte-find-replace":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --\x3e<path fill="currentColor" d="M208 48c39.6 0 75.9 14.4 103.8 38.2L279 119c-6.9 6.9-8.9 17.2-5.2 26.2S286.3 160 296 160l96 0c13.3 0 24-10.7 24-24l0-96c0-9.7-5.8-18.5-14.8-22.2S381.9 16.2 375 23L345.8 52.2c-36.7-32.5-85-52.2-137.8-52.2-99.4 0-182.4 69.7-203.1 162.8-2.9 12.9 5.3 25.8 18.2 28.6 1.4 .3 2.7 .5 4.1 .5l2.3 0C40.1 191.5 49.4 184 51.8 173.2 67.7 101.6 131.6 48 208 48zM386 224c-10.4 .7-19.4 8.1-21.8 18.8-15.9 71.7-79.8 125.2-156.2 125.2-39.6 0-75.9-14.4-103.8-38.2L137 297c6.9-6.9 8.9-17.2 5.2-26.2S129.7 256 120 256l-96 0c-13.3 0-24 10.7-24 24l0 96c0 9.7 5.8 18.5 14.8 22.2S34.1 399.8 41 393l29.2-29.2c36.7 32.5 85 52.2 137.8 52.2 48.8 0 93.7-16.8 129.1-44.9L471 505c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L371.1 337.1c19.2-24.2 33.1-52.8 40-84 2.9-12.9-5.3-25.8-18.2-28.6-1.2-.3-2.4-.4-3.6-.5l-3.2 0z"/></svg>'}});class Ui extends wt{prepareBeforeLoad(t){this.registerToolbarButtonRenderer(Ui.TOOLBAR_BUTTON_KEY,new qi,t)}}Ui.TOOLBAR_BUTTON_KEY="findReplace";const Gi=[{title:"0.5",value:"0.5"},{title:"1",value:"1"},{title:"1.5",value:"1.5"},{title:"2",value:"2"},{title:"2.5",value:"2.5"}];var Zi;!function(t){t.LINE_HEIGHT="LINE_HEIGHT"}(Zi||(Zi={}));class Qi extends j{constructor(t){super(),this.type=Zi.LINE_HEIGHT,this.lineHeight=t}static from(t){return[Zi.LINE_HEIGHT,new Qi(t)]}static getDefaultStyles(t){return{lineHeight:t}}toJSON(){return{lineHeight:this.lineHeight}}renderClass(){return null}clone(){return new Qi(this.lineHeight)}renderStyle(){return Qi.getDefaultStyles(this.lineHeight)}}class Ji extends H{constructor(t){super(),this.isFlushable=!0,this.lineHeight=t}toAnnotation(){return new Qi(this.lineHeight)}}Ji.typeName="LineHeightAnnotationAction";class Yi extends O{handleAction(t,e){this.updateCustomStyleAnnotation(e,["lineHeight"])}}class Xi extends xt{constructor(t){super(),this.options=t}render(t,e){const n=this.options.map((t=>{var e;return{key:t.value,label:null!==(e=t.title)&&void 0!==e?e:t.value}}));return this.renderDropdown(t,e,{selectType:"single",selectedSourceKey:this.getSelectedSourceValue(e)},[this.renderButton(t,e,{icon:"line-height",ariaLabel:e.translation.t("Line Height"),showArrowIcon:!0,tooltip:{text:w.t("Line Height")}}),this.renderDropdownListTemplate(t,n,e)])}renderDropdownItem(t,e,n){return t("vega-dropdown-item",{key:e.key,itemKey:e.key,prefixIcon:e.icon},t("span",void 0,n.translation.t(e.label)))}isSelected(){return!1}isDisabled(t){var e;if(t.host.disabled)return!0;const n=this.getExtensionContext(t.host);return!!(null!==(e=null==n?void 0:n.getSelectedNodes())&&void 0!==e?e:[]).some((t=>{var e;return(null===(e=t.getAnnotationByType(S.CODE))||void 0===e?void 0:e.code)||t.parent instanceof W}))||this.getSelectedBlocks(t).some((t=>t instanceof W||t instanceof lt||!b.canHandle(Ji.typeName,t)))}handleDropdownClick(t,e){const n=t;this.getSelectedBlocks(e).forEach((t=>{t.apply(new Ji(n))}))}handleButtonClick(){}getSelectedSourceValue(t){const e=this.getSelectedBlocks(t);if(0===e.length)return"";const n=e[0].getAnnotationByType(Zi.LINE_HEIGHT);return e.every((t=>{const e=t.getAnnotationByType(Zi.LINE_HEIGHT);return(null==e?void 0:e.lineHeight)===(null==n?void 0:n.lineHeight)}))&&n?n.lineHeight:""}getSelectedBlocks(t){var e,n;const s=this.getExtensionContext(t.host),i=null!==(e=null==s?void 0:s.getSelectedNodes())&&void 0!==e?e:[],r=[];return i.forEach((t=>{t.parent instanceof T&&!r.includes(t.parent)&&r.push(t.parent)})),0===r.length&&(null===(n=t.rteRange.startNode)||void 0===n?void 0:n.parent)instanceof T&&r.push(t.rteRange.startNode.parent),r}}vt.register({"line-height":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M113.8 39.9c-4.6-5.1-11-7.9-17.8-7.9s-13.3 2.9-17.8 7.9l-72 80c-8.9 9.9-8.1 25 1.8 33.9s25 8.1 33.9-1.8L72 118.5V393.5L41.8 359.9c-8.9-9.9-24-10.7-33.9-1.8s-10.7 24-1.8 33.9l72 80c4.6 5.1 11 7.9 17.8 7.9s13.3-2.9 17.8-7.9l72-80c8.9-9.9 8.1-25-1.8-33.9s-25-8.1-33.9 1.8L120 393.5V118.5l30.2 33.5c8.9 9.9 24 10.7 33.9 1.8s10.7-24 1.8-33.9l-72-80zM248 72c-13.3 0-24 10.7-24 24s10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248zm0 160c-13.3 0-24 10.7-24 24s10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248zM224 416c0 13.3 10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248c-13.3 0-24 10.7-24 24z"/></svg>'}});const tr=new Set([A.typeName,q.typeName]);class er extends dt{constructor(t=Gi){super(),this.allowedLineHeights=new Set(t.map((t=>t.value)))}canHandle(t){return tr.has(t.typeName)}handle(t){var e,n;const s=null!==(n=null===(e=null==t?void 0:t.style.lineHeight)||void 0===e?void 0:e.trim())&&void 0!==n?n:"";return s&&this.allowedLineHeights.has(s)?{lineHeight:s}:{}}}class nr extends ${constructor(){super(...arguments),this.stylesToBeFiltered={}}get alwaysFilter(){return!0}filterAnnotations(t){const e=t,n=e.lineHeight,s=e.customStyle;return n&&s&&s.lineHeight===n&&delete s.lineHeight,s&&0===Object.keys(s).length&&delete e.customStyle,t}}const sr=new WeakMap,ir=new WeakSet;class rr extends wt{constructor(t=Gi){super(),this.options=t,this.toolbarButtonRenderer=null,this.registerAnnotationHandler(new er(this.options)),[A,q].forEach((t=>{!function(t,e){sr.set(t,new Set(e.map((t=>t.value))))}(t,this.options)}))}prepareBeforeLoad(t){this.toolbarButtonRenderer=new Xi(this.options),this.registerToolbarButtonRenderer(rr.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer,t)}}[A,q].forEach((t=>{wt.registerActionHandleStrategy(t.typeName,Ji.typeName,new Yi),Z.register(t.typeName,new nr),function(t){ir.has(t)||(ir.add(t),wt.attachAnnotationFromJson(t,"lineHeight",((e,n)=>{if("string"!=typeof n||""===n)return;e.annotationMap.set(...Qi.from(n));const s=sr.get(t);s&&s.size>0&&function(t,e){const n=t.annotationMap.get(Zi.LINE_HEIGHT);if(!n||e.has(n.lineHeight))return;const s=n.lineHeight;t.annotationMap.delete(Zi.LINE_HEIGHT);const i=t.annotationMap.get(_.CUSTOM_STYLE);i?i.customStyle=Object.assign(Object.assign({},i.customStyle),{lineHeight:s}):t.annotationMap.set(...G.from({lineHeight:s}))}(e,s)})))}(t)})),rr.TOOLBAR_BUTTON_KEY="lineHeight";class ar extends xt{constructor(t){super(),this.controller=t}isHidden(){return!1}render(t,e){const n=this.isSelected();return this.renderButton(t,e,{icon:n?"rte-fullscreen-exit":"rte-fullscreen-enter",ariaLabel:e.translation.t(n?"Exit fullscreen mode":"Enter fullscreen mode"),tooltip:{text:w.t(n?"Exit fullscreen mode":"Enter fullscreen mode")}})}isSelected(){return this.controller.isActive()}handleButtonClick(t){this.controller.toggleFullscreen();const e=this.getExtensionContext(t.host);e&&e.forceUpdate(t.host)}handleDropdownClick(){}}vt.register({"rte-fullscreen-enter":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M295 183c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l135-135V168c0 13.3 10.7 24 24 24s24-10.7 24-24V24c0-13.3-10.7-24-24-24H344c-13.3 0-24 10.7-24 24s10.7 24 24 24h86.1L295 183zM217 329c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L48 430.1V344c0-13.3-10.7-24-24-24s-24 10.7-24 24V488c0 13.3 10.7 24 24 24H168c13.3 0 24-10.7 24-24s-10.7-24-24-24H81.9L217 329z"/></svg>'},"rte-fullscreen-exit":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M473 57c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-135 135V72c0-13.3-10.7-24-24-24s-24 10.7-24 24V216c0 13.3 10.7 24 24 24H424c13.3 0 24-10.7 24-24s-10.7-24-24-24H337.9L473 57zM7 455c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l135-135V440c0 13.3 10.7 24 24 24s24-10.7 24-24V296c0-13.3-10.7-24-24-24H56c-13.3 0-24 10.7-24 24s10.7 24 24 24h86.1L7 455z"/></svg>'}});class or{constructor(t){this.active=!1,this.hostStyle=null,this.scrollX=0,this.scrollY=0,this.host=t}isActive(){return this.active}enterFullscreen(){var t,e,n,s;const i=this.host;if(this.active||!i.shadowRoot||!i.ownerDocument)return;this.hostStyle=i.getAttribute("style"),this.scrollX=null!==(e=null===(t=i.ownerDocument.defaultView)||void 0===t?void 0:t.scrollX)&&void 0!==e?e:0,this.scrollY=null!==(s=null===(n=i.ownerDocument.defaultView)||void 0===n?void 0:n.scrollY)&&void 0!==s?s:0,this.lockDocumentScroll(i.ownerDocument);const r=this.hostStyle?/;\s*$/.test(this.hostStyle)?this.hostStyle:`${this.hostStyle};`:"";i.setAttribute("style",`${r}${or.HOST_FULLSCREEN_STYLE}`),i instanceof HTMLElement&&u.setZIndex(i,"base");const a=i.ownerDocument.createElement("style");a.id=or.STYLE_TAG_ID,yt.nonce&&a.setAttribute("nonce",yt.nonce),a.textContent=or.INNER_FULLSCREEN_CSS,i.shadowRoot.appendChild(a),this.active=!0}exitFullscreen(){var t,e,n,s;const i=this.host;this.active&&(i.ownerDocument&&this.unlockDocumentScroll(i.ownerDocument),i instanceof HTMLElement&&u.removeZIndex(i,"base"),null===this.hostStyle?i.removeAttribute("style"):i.setAttribute("style",this.hostStyle),null===(e=null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(`#${or.STYLE_TAG_ID}`))||void 0===e||e.remove(),null===(s=null===(n=i.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===s||s.scrollTo(this.scrollX,this.scrollY),this.active=!1)}toggleFullscreen(){this.active?this.exitFullscreen():this.enterFullscreen()}lockDocumentScroll(t){const e=or.documentScrollLockStates.get(t);e?or.documentScrollLockStates.set(t,Object.assign(Object.assign({},e),{lockCount:e.lockCount+1})):(or.documentScrollLockStates.set(t,{lockCount:1,bodyOverflow:t.body.style.overflow,documentOverflow:t.documentElement.style.overflow}),t.body.style.overflow="hidden",t.documentElement.style.overflow="hidden")}unlockDocumentScroll(t){const e=or.documentScrollLockStates.get(t);e&&(e.lockCount>1?or.documentScrollLockStates.set(t,Object.assign(Object.assign({},e),{lockCount:e.lockCount-1})):(t.body.style.overflow=e.bodyOverflow,t.documentElement.style.overflow=e.documentOverflow,or.documentScrollLockStates.delete(t)))}}or.STYLE_TAG_ID="v-rte-fullscreen-styles",or.HOST_FULLSCREEN_STYLE="position:fixed;inset:0;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));",or.INNER_FULLSCREEN_CSS=":host > vega-flex { height: 100%; padding: 5px; box-sizing: border-box; } .rich-text-editor-container { flex: 1 !important; height: auto !important; min-height: 0 !important; resize: none !important; overflow: auto !important; } .source-view-container:not(.vega-hidden) { display: flex !important; flex: 1 !important; min-height: 0 !important; overflow: auto !important; flex-direction: column; }",or.documentScrollLockStates=new WeakMap;class lr extends wt{prepareBeforeLoad(t){const e=new or(t);lr.controllerStore.set(t,e),this.registerToolbarButtonRenderer(lr.TOOLBAR_BUTTON_KEY,new ar(e),t)}destroyExtension(){var t,e;if(null===(t=this.extensionContext)||void 0===t?void 0:t.host){const t=this.extensionContext.host;null===(e=lr.controllerStore.get(t))||void 0===e||e.exitFullscreen(),lr.controllerStore.delete(t)}}}var cr,hr;lr.TOOLBAR_BUTTON_KEY="fullscreen",lr.controllerStore=lr.createStateStore(),function(t){t.RICH="rich",t.PLAIN="plain",t.WORD="word"}(cr||(cr={})),function(t){t[t.DEFAULT_FALLBACK=-1]="DEFAULT_FALLBACK",t[t.BASE=0]="BASE",t[t.WORD=10]="WORD"}(hr||(hr={}));class dr{get type(){return cr.RICH}get priority(){return hr.BASE}get supportsImageProcessing(){return!1}get consumesPlainText(){return!1}transform(t){const e=this.getSourceContent(t);return{html:this.process(e),text:this.consumesPlainText?e:t.text,mode:this.type,markers:{},extractImages:this.supportsImageProcessing,imagesToExtract:this.supportsImageProcessing?t.files:[]}}getSourceContent(t){return this.consumesPlainText?t.text:t.html}}class ur extends dr{canHandle(t){return void 0!==t}process(t){return t}get priority(){return hr.DEFAULT_FALLBACK}}const pr=/symbol|wingdings|webdings/i,fr=/mso-list\s*:\s*l\d+/i,gr=/mso-list\s*:\s*l\d+\s+level(\d+)/i,wr=/mso-list\s*:\s*l(\d+)/i,mr=/\blfo(\d+)/i,vr=/mso-list\s*:\s*ignore/i,br=/font-family\s*:\s*([^;]+)/i,yr=/MsoListParagraph/i,xr=/^(i|[ivxlcdm]{2,})$/,Cr=/^(I|[IVXLCDM]{2,})$/,Lr=/^[a-z]+$/,Tr=/^[A-Z]+$/,Ar=/^[0-9]+$/,Sr=/list-style-type\s*:\s*([^;]+)/i,kr={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"},Er=new Set(["P","DIV","UL","OL","LI","H1","H2","H3","H4","H5","H6","TABLE","BLOCKQUOTE","PRE"]),Or=["colspan","rowspan"],Ir=/^\d+$/,Rr=/^border(-(top|right|bottom|left))?(-(width|style|color))?$/,Br=/^padding(-(top|right|bottom|left))?$/,Nr=/^width$/,Mr=/^0+(\.0+)?([a-z%]+)?$/i,jr=[{attribute:"valign",property:"vertical-align"},{attribute:"align",property:"text-align"},{attribute:"bgcolor",property:"background-color"}],Hr=/(?:^|\s)(?:language|lang)-([a-z0-9+_.-]+)(?:\s|$)/i,Dr=/^mso[a-z0-9_-]*$/i;class _r{static isCodeBlock(t){return t.nodeType===Node.ELEMENT_NODE&&"PRE"===t.tagName.toUpperCase()}apply(t){Array.from(t.querySelectorAll("pre")).forEach((t=>{this.stripWordClassArtifacts(t),t.hasAttribute("data-language")||t.setAttribute("data-language",this.resolveLanguage(t))}))}getAllowedTags(){return["PRE"]}getAllowedAttributes(){return new Map([["PRE",["data-language"]]])}getAllowedStyles(){return[]}resolveLanguage(t){const e=this.resolveLanguageFromClassName(t).trim();return""!==e?e:"plainText"}resolveLanguageFromClassName(t){const e=t.getAttribute("class")||"",n=Hr.exec(e);return n?n[1]:""}stripWordClassArtifacts(t){const e=t.getAttribute("class")||"";if(!e)return;const n=e.split(/\s+/).map((t=>t.trim())).filter((t=>""!==t&&!Dr.test(t)));0!==n.length?t.setAttribute("class",n.join(" ")):t.removeAttribute("class")}}const Pr=[new class{apply(t){Array.from(t.querySelectorAll("table")).forEach((t=>this.normalizeTable(t)))}getAllowedTags(){return["TABLE","THEAD","TBODY","TR","TH","TD","CAPTION"]}getAllowedAttributes(){return new Map([["TD",["colspan","rowspan"]],["TH",["colspan","rowspan"]]])}getAllowedStyles(){return["border","width"]}normalizeTable(t){this.removeStructuralWhitespace(t),this.stripClass(t),this.removeBorderAndPaddingStyles(t),Array.from(t.querySelectorAll("thead, tbody, tfoot, caption, tr")).forEach((t=>this.stripClass(t))),this.removeHiddenMisalignedCells(t),this.mergeFooterIntoBody(t),this.promoteHeadCells(t),Array.from(t.querySelectorAll("td, th")).forEach((t=>{this.removeCellLayoutWhitespace(t),this.stripClass(t),this.normalizeSpanAttributes(t),this.migrateCellAttributes(t),this.migrateCellWidth(t),this.removeBorderAndPaddingStyles(t)}))}removeHiddenMisalignedCells(t){Array.from(t.querySelectorAll("tr")).filter((e=>this.isRowOfTable(t,e))).forEach((t=>{const e=t.lastElementChild;e&&("TD"===e.tagName||"TH"===e.tagName)&&this.isHiddenMisalignedCell(e)&&t.removeChild(e)}))}isRowOfTable(t,e){let n=e.parentElement;for(;n&&"BODY"!==n.tagName;){if("TABLE"===n.tagName)return n===t;n=n.parentElement}return!1}isHiddenMisalignedCell(t){return!this.hasExplicitSpan(t)&&!!this.hasZeroWidthMarker(t)&&!this.hasMeaningfulCellContent(t)}hasExplicitSpan(t){return Or.some((e=>t.hasAttribute(e)))}hasZeroWidthMarker(t){const e=t.getAttribute("width");if(null!==e&&Mr.test(e.trim()))return!0;const n=t.getAttribute("data-style");if(null===n)return!1;const s=this.readStyleDeclaration(n,"width");return null!==s&&Mr.test(s)}hasMeaningfulCellContent(t){return""!==(t.textContent||"").trim()}readStyleDeclaration(t,e){const n=t.split(";").map((t=>t.trim())).filter((t=>""!==t));for(const t of n){const n=t.indexOf(":");if(-1===n)continue;if(t.slice(0,n).trim().toLowerCase()!==e.toLowerCase())continue;const s=t.slice(n+1).trim();return""===s?null:s}return null}mergeFooterIntoBody(t){Array.from(t.children).filter((t=>"TFOOT"===t.tagName)).forEach((e=>{const n=Array.from(t.children).filter((t=>"TBODY"===t.tagName)),s=n[n.length-1];if(s){for(;e.firstChild;)s.appendChild(e.firstChild);e.parentNode&&e.parentNode.removeChild(e)}else this.replaceElementTag(e,"tbody")}))}promoteHeadCells(t){Array.from(t.querySelectorAll("thead")).forEach((t=>{Array.from(t.children).forEach((t=>{"TR"===t.tagName&&Array.from(t.children).forEach((t=>{"TD"===t.tagName&&this.renameCell(t,"th")}))}))}))}renameCell(t,e){this.replaceElementTag(t,e)}replaceElementTag(t,e){const n=t.ownerDocument.createElement(e);for(Array.from(t.attributes).forEach((t=>{n.setAttribute(t.name,t.value)}));t.firstChild;)n.appendChild(t.firstChild);return t.parentNode&&t.parentNode.replaceChild(n,t),n}stripClass(t){t.hasAttribute("class")&&t.removeAttribute("class")}removeStructuralWhitespace(t){[t,...Array.from(t.querySelectorAll("thead, tbody, tfoot, tr"))].forEach((t=>{Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&""===(e.textContent||"").trim()&&t.removeChild(e)}))}))}removeCellLayoutWhitespace(t){Array.from(t.children).some((t=>Er.has(t.tagName)))&&Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&""===(e.textContent||"").trim()&&t.removeChild(e)}))}normalizeSpanAttributes(t){Or.forEach((e=>{const n=t.getAttribute(e);if(null===n)return;const s=Number(n);!Ir.test(n)||s<=1?t.removeAttribute(e):t.setAttribute(e,String(s))}))}migrateCellAttributes(t){jr.forEach((({attribute:e,property:n})=>{const s=t.getAttribute(e);s&&""!==s.trim()&&this.appendStyleDeclaration(t,n,s.trim().toLowerCase()),t.removeAttribute(e)}))}migrateCellWidth(t){const e=t.getAttribute("width");t.removeAttribute("width"),this.removeMatchingStyleDeclarations(t,(t=>Nr.test(t)));const n=this.toCssWidth(e);null!==n&&this.appendStyleDeclaration(t,"width",n)}toCssWidth(t){if(null===t||""===t.trim())return null;const e=t.trim();return/^\d+(\.\d+)?$/.test(e)?`${e}px`:e}appendStyleDeclaration(t,e,n){const s=t.getAttribute("data-style")||"";if(this.styleHasProperty(s,e))return;const i=""===s.trim()?"":`${s.replace(/;\s*$/,"")}; `;t.setAttribute("data-style",`${i}${e}: ${n}`)}removeBorderAndPaddingStyles(t){this.removeMatchingStyleDeclarations(t,(t=>Rr.test(t)||Br.test(t)))}removeMatchingStyleDeclarations(t,e){const n=t.getAttribute("data-style");if(null===n||""===n.trim())return;const s=n.split(";").map((t=>t.trim())).filter((t=>""!==t)).filter((t=>{const n=t.indexOf(":");if(-1===n)return!0;const s=t.slice(0,n).trim().toLowerCase();return!e(s)}));s.length>0?t.setAttribute("data-style",s.join("; ")):t.removeAttribute("data-style")}styleHasProperty(t,e){return new RegExp(`(^|;)\\s*${e}\\s*:`,"i").test(t)}},new class{apply(t){this.nestSiblingLists(t);const e=new Set;Array.from(t.querySelectorAll("p")).forEach((t=>{this.isWordListParagraph(t)&&t.parentElement&&e.add(t.parentElement)})),Array.from(t.children).some((t=>this.isWordListParagraph(t)))&&e.add(t),e.forEach((t=>this.processContainer(t))),this.applyOrderedListTypeAttributes(t)}getAllowedTags(){return["UL","OL","LI"]}getAllowedAttributes(){return new Map}getAllowedStyles(){return["list-style"]}nestSiblingLists(t){const e=Array.from(t.querySelectorAll("ol, ul"));for(let t=e.length-1;t>=0;t--)Array.from(e[t].children).forEach((t=>{if("OL"!==t.tagName&&"UL"!==t.tagName)return;const e=t.previousElementSibling;e&&"LI"===e.tagName&&e.appendChild(t)}))}applyOrderedListTypeAttributes(t){Array.from(t.querySelectorAll("ol[type]")).forEach((t=>{const e=t.getAttribute("type")||"",n=kr[e];if(!n)return;const s=t.getAttribute("data-style")||"";if(Sr.test(s))return;const i=""===s.trim()?"":`${s.replace(/;\s*$/,"")}; `;t.setAttribute("data-style",`${i}list-style-type: ${n}`)}))}processContainer(t){const e=Array.from(t.children);let n=0;for(;n<e.length;){if(!this.isWordListParagraph(e[n])){n++;continue}const s=[];for(;n<e.length&&this.isWordListParagraph(e[n]);)s.push(e[n]),n++;this.transformRun(s,t)}}isWordListParagraph(t){if("P"!==t.tagName)return!1;const e=t.getAttribute("data-style")||"";if(fr.test(e))return!0;const n=t.getAttribute("class")||"";return yr.test(n)&&void 0!==this.findMarker(t)}transformRun(t,e){const n=t[0],s=[];t.forEach((t=>{const i=this.findMarker(t),r=this.resolveLevel(t),a=!!i&&this.isOrderedMarker(i,t),o=this.resolveListId(t);for(;s.length>0&&s[s.length-1].level>r;)s.pop();let l=s[s.length-1];const c=a&&i?this.resolveListStyleType(i,l,r,o):null,h=this.buildListItem(t,i);!l||l.level<r?l=this.openNestedList(s,e,n,a,r,c,o):this.needsSiblingList(l,a,c,o)&&(l=this.openSiblingList(s,a,r,c,o)),l.listEl.appendChild(h)})),t.forEach((t=>t.remove()))}needsSiblingList(t,e,n,s){return null!==t.listId&&null!==s&&t.listId!==s||t.ordered!==e||!!e&&this.readListStyleType(t.listEl)!==n}readListStyleType(t){const e=Sr.exec(t.getAttribute("data-style")||"");return e?e[1].trim():null}openNestedList(t,e,n,s,i,r,a){let o=t[t.length-1],l=o?o.level:0;for(;l<i-1;){const i=this.createListElement(e,s,null);this.attachList(i,o,e,n),i.appendChild(i.ownerDocument.createElement("li")),t.push({level:l+1,ordered:s,listId:a,listEl:i}),o=t[t.length-1],l=o.level}const c=t[t.length-1],h=this.createListElement(e,s,r);this.attachList(h,c,e,n);const d={level:i,ordered:s,listId:a,listEl:h};return t.push(d),d}openSiblingList(t,e,n,s,i){const r=t[t.length-1],a=this.createListElement(r.listEl,e,s),o=r.listEl.parentNode;o&&o.insertBefore(a,r.listEl.nextSibling),t.pop();const l={level:n,ordered:e,listId:i,listEl:a};return t.push(l),l}attachList(t,e,n,s){e?(e.listEl.lastElementChild||e.listEl).appendChild(t):n.insertBefore(t,s)}createListElement(t,e,n){const s=t.ownerDocument.createElement(e?"ol":"ul");return e&&n&&s.setAttribute("data-style",`list-style-type: ${n}`),s}buildListItem(t,e){const n=t.ownerDocument.createElement("li");for(e&&(this.preserveMarkerPlaceholderImages(e,t),this.removeMarker(e,t));t.firstChild;)n.appendChild(t.firstChild);return n}preserveMarkerPlaceholderImages(t,e){const n=Array.from(t.querySelectorAll("img")).filter((t=>(t.getAttribute("src")||"").startsWith("file://"))),s=e.firstChild;n.forEach((t=>{e.insertBefore(t,s)}))}removeMarker(t,e){let n=t;for(;n!==e;){const t=n.parentElement;if(n.remove(),!t||t===e||!this.isEmptyElement(t))break;n=t}}findMarker(t){return Array.from(t.querySelectorAll("span")).find((t=>vr.test(t.getAttribute("data-style")||"")))}isEmptyElement(t){return""===(t.textContent||"").replace(/[\s\u00A0]/g,"")}resolveLevel(t){const e=t.getAttribute("data-style")||"",n=gr.exec(e);return n?parseInt(n[1],10):1}resolveListId(t){const e=t.getAttribute("data-style")||"",n=mr.exec(e);if(n)return`lfo${n[1]}`;const s=wr.exec(e);return s?`l${s[1]}`:null}isOrderedMarker(t,e){const n=t.textContent.replace(/[\s\u00A0]/g,"");return!pr.test(this.resolveMarkerFont(t,e))&&(/[0-9]/.test(n)||/^[a-z]+[.)]/i.test(n))}resolveListStyleType(t,e,n,s){const i=t.textContent.replace(/[\s\u00A0]/g,"").replace(/[.)]+$/,"");if(Ar.test(i))return null;if("i"===i||"I"===i){const t="i"===i?"lower-alpha":"upper-alpha";if(this.continuesAlphaList(e,n,s,t))return t}return xr.test(i)?"lower-roman":Cr.test(i)?"upper-roman":Lr.test(i)?"lower-alpha":Tr.test(i)?"upper-alpha":null}continuesAlphaList(t,e,n,s){return!(!t||!t.ordered||t.level!==e||null!==t.listId&&null!==n&&t.listId!==n||this.readListStyleType(t.listEl)!==s)}resolveMarkerFont(t,e){let n=t;for(;n&&n!==e.parentElement;){const t=br.exec(n.getAttribute("data-style")||"");if(t)return t[1];n=n.parentElement}return""}},new class{getAllowedTags(){return["IMG"]}getAllowedAttributes(){return new Map([["IMG",["src","alt","title","width","height"]]])}getAllowedStyles(){return[]}apply(t){this.normalizeWordImageDataElements(t),this.normalizeStandardImages(t),this.liftImagesOutOfTextStyleBlocks(t),this.insertSpanBetweenAdjacentImages(t)}liftImagesOutOfTextStyleBlocks(t){Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6, p")).filter((t=>this.isImageLiftTargetBlock(t))).forEach((t=>{if(!t.parentNode)return;const e=Array.from(t.querySelectorAll("img"));let n=t;e.forEach((e=>{t.parentNode.insertBefore(e,n.nextSibling),n=e}))}))}isImageLiftTargetBlock(t){const e=t.tagName.toLowerCase();if(/^h[1-6]$/.test(e))return!0;if("p"===e){const e=(t.getAttribute("class")||"").toLowerCase();return/msotitle/.test(e)||/msosubtitle/.test(e)}return!1}normalizeWordImageDataElements(t){Array.from(t.querySelectorAll("v\\:imagedata, imagedata")).forEach((e=>{const n=e.getAttribute("src")||e.getAttribute("o:href")||e.getAttribute("href")||"",s=e.getAttribute("alt")||e.getAttribute("o:title")||e.getAttribute("title")||"",i=e.closest("v\\:shape, shape")||e;if(!n)return void i.remove();if(this.isListImage(i)&&!n.startsWith("file://"))return void i.remove();const r=t.ownerDocument.createElement("img");if(r.setAttribute("src",n),s&&r.setAttribute("alt",s),i.parentNode){const e=i.getAttribute("id")||"";e&&this.removeFallbackImagesForShapeId(t,e),i.parentNode.insertBefore(r,i),i.parentNode.removeChild(i)}}))}removeFallbackImagesForShapeId(t,e){Array.from(t.querySelectorAll("img")).forEach((t=>{(t.getAttribute("v:shapes")||t.getAttribute("shapes")||"")===e&&t.remove()}))}normalizeStandardImages(t){Array.from(t.querySelectorAll("img")).forEach((t=>{const e=t.getAttribute("src")||"";this.isListImage(t)?e.startsWith("file://")||t.remove():e||t.remove()}))}insertSpanBetweenAdjacentImages(t){Array.from(t.querySelectorAll("img")).forEach((e=>{if(!e.parentNode)return;const n=e.nextSibling;if(n&&n.nodeType===Node.ELEMENT_NODE&&"img"===n.tagName.toLowerCase()){const s=t.ownerDocument.createElement("span");s.innerHTML=" ",e.parentNode.insertBefore(s,n)}}))}isListImage(t){return Boolean(t.closest("li,ul,ol"))}},new _r,new class{apply(t){Array.from(t.querySelectorAll("[data-type]")).forEach((t=>{t.removeAttribute("data-type")})),Array.from(t.querySelectorAll("p")).forEach((t=>{const e=t.getAttribute("class"),n=this.resolveRole(e);null!==e&&t.removeAttribute("class"),n&&t.classList.add(`v-rte--text-style-${n}`)}))}getAllowedTags(){return["P","BR","SPAN","STRONG","B","EM","I","U","S","STRIKE","DEL","H1","H2","H3","H4","H5","H6","A","CODE"]}getAllowedAttributes(){return new Map([["*",["class","style"]],["A",["href","target","title"]]])}getAllowedStyles(){return["color","background","text-align","text-indent","text-decoration","margin","padding","font","line-height","letter-spacing","vertical-align"]}resolveRole(t){if(!t)return null;const e=t.toLowerCase(),n=/msoheading([1-6])/.exec(e);return n?`heading-${n[1]}`:/msosubtitle/.test(e)?"subtitle":/msotitle/.test(e)?"title":null}}],Vr=function(t){const e=new Set,n=new Set,s=new Map;t.forEach((t=>{t.getAllowedTags().forEach((t=>{e.add(t.toUpperCase())})),t.getAllowedStyles().forEach((t=>{n.add(t.toLowerCase())})),t.getAllowedAttributes().forEach(((t,e)=>{const n="*"===e?e:e.toUpperCase();s.has(n)||s.set(n,new Set);const i=s.get(n);t.forEach((t=>{i.add(t.toLowerCase())}))}))}));const i={};return s.forEach(((t,e)=>{i[e]=Array.from(t)})),{allowedTags:Array.from(e),allowedAttributes:i,allowedStylePrefixes:Array.from(n)}}(Pr),$r=["windowtext"];class Fr extends dr{get type(){return cr.WORD}canHandle(t){return!!t&&Fr.WORD_SIGNATURE_PATTERNS.some((e=>e.test(t)))}get priority(){return hr.WORD}get supportsImageProcessing(){return!0}process(t,e=Vr){if(!t)return"";const n=this.stripWordComments(t),s=ut.preserve(n).getProcessedHtml(),i=(new DOMParser).parseFromString(s,"text/html").body;return this.fixWordStructure(i),Array.from(i.childNodes).forEach((t=>{this.sanitizeNode(t,e)})),this.collapseInsignificantWhitespace(i),this.removeInterBlockWhitespace(i),this.preserveWordEmptyLines(i),this.restoreStyleAttributeName(i.innerHTML)}stripWordComments(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<!\[[\s\S]*?\]>/g,"")}fixWordStructure(t){Fr.STRUCTURE_TRANSFORMERS.forEach((e=>{e.apply(t)}))}removeInterBlockWhitespace(t){Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&""===e.textContent.trim()&&t.removeChild(e)}))}collapseInsignificantWhitespace(t){if(!_r.isCodeBlock(t))if(t.nodeType!==Node.TEXT_NODE)Array.from(t.childNodes).forEach((t=>{this.collapseInsignificantWhitespace(t)}));else{const e=t.textContent,n=e.replace(/[ \t\r\n\f]+/g," ");n!==e&&(t.textContent=n)}}preserveWordEmptyLines(t){Array.from(t.querySelectorAll("p")).forEach((t=>{if(t.querySelector("img"))return;const e=t.textContent;""===e.replace(/[\s\u200B]+/g,"")&&/\u00A0/.test(e)&&(t.textContent="")}))}sanitizeNode(t,e){if(t.nodeType===Node.TEXT_NODE)return;if(t.nodeType!==Node.ELEMENT_NODE)return void this.removeSelf(t);const n=t,s=n.tagName.toUpperCase(),i=Array.from(n.childNodes);for(let t=i.length-1;t>=0;t--)this.sanitizeNode(i[t],e);if(e.allowedTags.includes(s))this.sanitizeAttributes(n,s,e);else{for(;n.firstChild;)n.parentNode&&"function"==typeof n.parentNode.insertBefore&&n.parentNode.insertBefore(n.firstChild,n);this.removeSelf(n)}}sanitizeAttributes(t,e,n){const s=new Set([...n.allowedAttributes["*"]||[],...n.allowedAttributes[e]||[]]);Array.from(t.attributes).forEach((e=>{const i=e.name.toLowerCase(),r="data-style"===i;s.has(r?"style":i)?r&&this.sanitizeStyleAttribute(t,e.name,n):t.removeAttribute(e.name)}))}sanitizeStyleAttribute(t,e,n){const s=t.getAttribute(e)||"",i=t.ownerDocument.createElement("span");i.setAttribute("style",s);const r=i.style,a=[];for(let t=0;t<r.length;t++){const e=r[t],s=n.allowedStylePrefixes.some((t=>e===t||e.startsWith(`${t}-`))),i=r.getPropertyValue(e),o=i.toLowerCase(),l=$r.some((t=>o.includes(t)));s&&!l&&a.push(`${e}: ${i}`)}const o=a.join("; ");o?t.setAttribute(e,o):t.removeAttribute(e)}restoreStyleAttributeName(t){return t.replace(/\sdata-style=/g," style=")}removeSelf(t){t.parentNode&&"function"==typeof t.parentNode.removeChild&&t.parentNode.removeChild(t)}}Fr.STRUCTURE_TRANSFORMERS=[...Pr],Fr.WORD_SIGNATURE_PATTERNS=[/content=["']?Microsoft\s+Word/i,/urn:schemas-microsoft-com:office/i,/class=["']?Mso[A-Za-z]/i,/mso-[a-z-]+\s*:/i,/<\/?o:p>/i];class zr extends dr{get type(){return cr.PLAIN}get consumesPlainText(){return!0}canHandle(){return!1}process(t,e=!1){return t&&He()?Q(J(t,e)):""}transform(t){const e=this.getPlainTextSource(t);return{html:this.process(e.text,e.hasEncodedWhitespace),text:e.text,mode:this.type,markers:e.hasEncodedWhitespace?{[Y]:"true"}:{},extractImages:!1,imagesToExtract:[]}}getPlainTextSource(t){if(!t.html)return{text:t.text||"",hasEncodedWhitespace:!1};const e=Tt(t.html);if(t.text&&t.text.includes("\t")&&e)return{text:t.text,hasEncodedWhitespace:!1};const n=At(t.html,{preserveBoundaryBlankLines:!e,keepPreservedWhitespaceMarkers:!0});return n?{text:n,hasEncodedWhitespace:!0}:{text:t.text||"",hasEncodedWhitespace:!1}}}class Kr{constructor(){this.defaultStrategy=new ur,this.strategies=[new zr,new Fr,this.defaultStrategy]}select(t,e){return e&&e!==cr.RICH?this.selectStrategyByType(e):this.selectStrategy(t.html)}selectStrategy(t){return this.selectHighestPriorityStrategy(this.strategies.filter((e=>e.canHandle(t))))}selectStrategyByType(t){return this.selectHighestPriorityStrategy(this.strategies.filter((e=>e.type===t)))}registerStrategy(t){this.strategies.push(t)}selectHighestPriorityStrategy(t){return t.sort(((t,e)=>e.priority-t.priority))[0]||this.defaultStrategy}}class Wr{parseLocalImages(t,e){if(!t.includes("<img"))return{html:t,previews:[]};const n=t.replace(/\s+style=/g," data-style="),s=(new DOMParser).parseFromString(n,"text/html"),i=Array.from(s.querySelectorAll("img")).filter((t=>t.src.startsWith("file://")));if(0===i.length)return{html:t,previews:[]};const r=this.extractImageFiles(e,i);if(0===r.length)return{html:t,previews:[]};const a=this.createImagePreviews(i,r);return{html:s.body.innerHTML.replace(/ data-style=/g," style="),previews:a}}createImagePreviews(e,n){const s=[];return e.forEach(((e,i)=>{if(this.isListImage(e))return void e.remove();const r=n[i];if(!r)return;const a=URL.createObjectURL(r);e.setAttribute("src",a);const o=t();e.setAttribute(Wr.PREVIEW_IMG_KEY,o),s.push({id:o,file:r,objectUrl:a})})),s}extractImageFiles(t,e){let n=[];return t&&(t.rtf&&(n=this.safeExtractWordImages(t.rtf,e)),0===n.length&&t.files&&(n=t.files.filter((t=>t.type.startsWith("image/"))))),n}safeExtractWordImages(t,e){const n=this.stripListPictureDefinitions(t),s=[];return[...n.matchAll(/\\pngblip|\\jpegblip/g)].forEach(((t,i)=>{if(i>=e.length||void 0===t.index)return;const r=t[0].includes("png")?"image/png":"image/jpeg",a=this.extractImageBytes(n,t.index+t[0].length);if(0===a.length)return;const o=r.split("/")[1],l=new File([new Uint8Array(a)],`word_img_${Date.now()}_${i}.${o}`,{type:r});s.push(l)})),s}stripListPictureDefinitions(t){return this.removeBalancedGroups(t,"{\\*\\listpicture")}removeBalancedGroups(t,e){let n=t.indexOf(e);for(;-1!==n;){const s=this.findGroupEnd(t,n);n=(t=t.slice(0,n)+t.slice(s)).indexOf(e,n)}return t}findGroupEnd(t,e){const n=t.length;let s=0,i=e;for(;i<n;){const e=t[i];if("\\"!==e){if("{"===e)s++;else if("}"===e&&(s--,0===s))return i+1;i++}else i+=2}return n}extractImageBytes(t,e){const n=t.length,s=[];let i=0,r=-1,a=e;for(;a<n;){const e=t[a];if("{"===e){i++,a++;continue}if("}"===e){if(0===i)break;i--,a++;continue}if(i>0){a++;continue}if("\\"===e){for(a++;a<n&&/[a-zA-Z]/.test(t[a]);)a++;for(a<n&&"-"===t[a]&&a++;a<n&&/[0-9]/.test(t[a]);)a++;continue}const o=this.hexNibble(e);o>=0&&(r<0?r=o:(s.push(r<<4|o),r=-1)),a++}return s}hexNibble(t){return t>="0"&&t<="9"?t.charCodeAt(0)-48:t>="a"&&t<="f"?t.charCodeAt(0)-87:t>="A"&&t<="F"?t.charCodeAt(0)-55:-1}isListImage(t){return Boolean(t.closest("li,ul,ol"))}}Wr.PREVIEW_IMG_KEY="data-rte-id";class qr extends v{constructor(t,e){super(),this.type="REPLACE_IMAGE_SRC",this.img=t,this.url=e}}class Ur{constructor(){this.ownedImageIds=new Set,this.pendingNotifyImageIds=[]}register(t){this.pendingNotifyImageIds=[],t.forEach((t=>{this.pendingNotifyImageIds.push(t.id),this.ownedImageIds.add(t.id),Ur.pendingImages.set(t.id,t)}))}hasPendingNotifications(){return this.pendingNotifyImageIds.length>0}notifyInserted(t,e,n){const s=this.pendingNotifyImageIds.map((t=>Ur.pendingImages.get(t))).filter((t=>!!t));this.pendingNotifyImageIds=[],s.length&&"function"==typeof t&&(s.forEach((t=>t.notified=!0)),t(s.map((t=>({id:t.id,file:t.file}))),((t,s)=>this.replaceUrl(t,s,e,n))))}discardUnsentPreviews(){this.ownedImageIds.forEach((t=>{const e=Ur.pendingImages.get(t);e&&e.notified||(e&&e.objectUrl.startsWith("blob:")&&URL.revokeObjectURL(e.objectUrl),Ur.pendingImages.delete(t),this.ownedImageIds.delete(t))})),this.pendingNotifyImageIds=[]}replaceUrl(t,e,n,s){var i;const r=n();if(r){const n=null!==(i=r.querySelector(`img[data-rte-id="${t}"]`))&&void 0!==i?i:null;if(n){const t=s(n);t&&t.apply(new qr(n,e))}}const a=Ur.pendingImages.get(t);a&&(a.objectUrl.startsWith("blob:")&&URL.revokeObjectURL(a.objectUrl),Ur.pendingImages.delete(t),this.ownedImageIds.delete(t))}}Ur.pendingImages=new Map;class Gr{constructor(t,e){this.getHostElement=t,this.getSelectionRange=e}compute(t){var e,n,s;const i=this.getHostElement();if(!i)return{left:0,top:0,placement:["bottom","top"]};const r=i.getBoundingClientRect(),a=null!==(n=null===(e=i.ownerDocument.defaultView)||void 0===e?void 0:e.innerHeight)&&void 0!==n?n:window.innerHeight,o=t,l="number"==typeof o.clientX&&o.clientX>0&&"number"==typeof o.clientY&&o.clientY>0,c=l?null:this.getCaretRect(),h=12,d=l?o.clientX:null!==(s=null==c?void 0:c.left)&&void 0!==s?s:r.left+h,u=l?o.clientY:c?c.bottom:r.top+40,p=Math.max(r.left+h,r.right-220),f=Math.min(Math.max(d,r.left+h),p),g=Math.max(u+8,r.top+h),w=a-g-h;return{left:f,top:g,placement:w>=88||w>=g-h?["bottom","top"]:["top","bottom"]}}getCaretRect(){const t=this.getSelectionRange();if(!t)return null;const e=t.getBoundingClientRect();if(!this.isUnavailableRect(e))return e;const n=t.getClientRects();return n.length>0?n[0]:this.getRangeContainerRect(t)}isUnavailableRect(t){return 0===t.width&&0===t.height&&0===t.left&&0===t.top}getRangeContainerRect(t){var e,n,s,i,r,a;const o=null!==(e=t.startContainer)&&void 0!==e?e:null;if(!o)return null;if(o.nodeType===Node.ELEMENT_NODE){const e=o,a=null!==(n=e.childNodes[t.startOffset-1])&&void 0!==n?n:null,l=null!==(s=e.childNodes[t.startOffset])&&void 0!==s?s:null;return null!==(r=null!==(i=this.getNodeRect(a))&&void 0!==i?i:this.getNodeRect(l))&&void 0!==r?r:this.getNodeRect(e)}return null!==(a=this.getNodeRect(o))&&void 0!==a?a:this.getNodeRect(o.parentNode)}getNodeRect(t){var e,n;if(!t)return null;if(t.nodeType===Node.TEXT_NODE)return null!==(n=null===(e=t.parentElement)||void 0===e?void 0:e.getBoundingClientRect())&&void 0!==n?n:null;if(t.nodeType===Node.ELEMENT_NODE){const e=t.getBoundingClientRect();return this.isUnavailableRect(e)?null:e}return null}}class Zr{constructor(t=new Wr){this.parser=t}extract(t,e,n){return this.parser.parseLocalImages(t,{files:e,rtf:n})}}class Qr{constructor(t,e,n){this.selector=t,this.imageExtractor=e,this.pendingImageRegistry=n}process(t,e){const n={html:t.html,text:t.text,files:t.files,rtf:t.rtf},s=this.selector.select(n,e).transform(n);if(!s.extractImages)return s;const i=this.imageExtractor.extract(s.html,s.imagesToExtract,n.rtf);return i.previews.length>0&&this.pendingImageRegistry.register(i.previews),Object.assign(Object.assign({},s),{html:i.html})}}class Jr{build(t){const e=Object.assign({},t.markers);Jr.RESERVED_KEYS.forEach((t=>delete e[t]));const n=Object.assign(Object.assign({},e),{"text/html":t.html,"text/plain":t.text,[X]:t.mode});if("undefined"!=typeof DataTransfer){const t=new DataTransfer;return Object.keys(n).forEach((e=>{const s=n[e];s&&t.setData(e,s)})),t}return{getData:t=>{var e;return null!==(e=n[t])&&void 0!==e?e:""}}}}Jr.RESERVED_KEYS=["text/html","text/plain",X];class Yr{dispatch(t,e){const n=new CustomEvent("beforeinput",{bubbles:!0,cancelable:!0});try{Object.defineProperties(n,{inputType:{value:"insertFromPaste",configurable:!0},dataTransfer:{value:e,configurable:!0}})}catch(t){Object.assign(n,{inputType:"insertFromPaste",dataTransfer:e})}t.dispatchEvent(n)}}class Xr{constructor(t){this.getContext=t}capture(){var t;const e=this.getContext(),n=null==e?void 0:e.getSelection();return{range:n&&n.rangeCount>0?n.getRangeAt(0).cloneRange():null,selectedNodes:[...(null===(t=null==e?void 0:e.getSelectedNodes)||void 0===t?void 0:t.call(e))||[]]}}restore(t){this.restoreRange(t.range),this.restoreControllerState(t)}restoreControllerState(t){const e=this.getContext();t.range&&e&&e.setSelectedNodes(t.selectedNodes||[],{startNode:t.range.startContainer,endNode:t.range.endContainer,startOffset:t.range.startOffset,endOffset:t.range.endOffset})}restoreRange(t){var e;if(!t)return;const n=null===(e=this.getContext())||void 0===e?void 0:e.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}}class ta{constructor(t,e){this.selectionSnapshotService=t,this.onPasteCaptured=e,this.editableEl=null,this.handlePasteEvent=t=>{const e=t.clipboardData;if(!e)return;const n=e.getData("text/html")||"",s=e.getData("text/plain")||"",i=e.getData("text/rtf")||"";if(!n&&!s)return t.preventDefault(),void t.stopPropagation();t.preventDefault(),t.stopPropagation();const r=this.selectionSnapshotService.capture(),a=e.files?Array.from(e.files):[];this.onPasteCaptured({html:n,text:s,range:r.range,selectedNodes:r.selectedNodes,files:a,rtf:i},t)}}attach(t){var e;this.detach(),this.editableEl=t,null===(e=this.editableEl)||void 0===e||e.addEventListener("paste",this.handlePasteEvent)}detach(){var t;null===(t=this.editableEl)||void 0===t||t.removeEventListener("paste",this.handlePasteEvent),this.editableEl=null}}class ea{constructor(t,e,n={}){this.hostRoot=t,this.callbacks=e,this.options=n,this.chooserEl=null,this.dropdownEl=null,this.triggerButtonEl=null}open(t){this.destroy();const e=this.hostRoot.ownerDocument,n=e.createElement("div");n.setAttribute(ea.CHOOSER_ATTR,"true"),n.style.position="fixed",n.style.zIndex="1000",n.style.left=`${t.left}px`,n.style.top=`${t.top}px`;const s=this.createPasteChooserDropdown(e,t.placement);s.placement=t.placement,n.append(s),this.hostRoot.appendChild(n),this.chooserEl=n,this.dropdownEl=s,s.addEventListener("vegaShow",(()=>{this.triggerButtonEl&&(this.triggerButtonEl.selected=!0)})),s.addEventListener("vegaHide",(()=>{this.triggerButtonEl&&(this.triggerButtonEl.selected=!1)}))}destroy(){var t;this.dropdownEl&&"function"==typeof this.dropdownEl.hide&&this.dropdownEl.hide(),(null===(t=this.chooserEl)||void 0===t?void 0:t.parentNode)&&this.chooserEl.parentNode.removeChild(this.chooserEl),this.triggerButtonEl&&(this.triggerButtonEl.selected=!1),this.dropdownEl=null,this.chooserEl=null,this.triggerButtonEl=null}includesEventPath(t){if(!this.chooserEl)return!1;const e=t.some((t=>"tagName"in t&&"VEGA-DROPDOWN-CONTENT-BOX"===t.tagName));return t.includes(this.chooserEl)||e}createPasteChooserDropdown(t,e){const n=t.createElement("vega-dropdown");n.trigger="click",n.selectType="single",n.selectedSourceKey="rich",n.maxWidth=220,n.alignment="start",n.itemDisplayRule="ellipsis",n.isScreenPosition=!0;const s=t.createElement("vega-rich-text-editor-toolbar-button"),i="top"===e[0]?"chevron-up":"chevron-down";s.setAttribute(ea.CHOOSER_TRIGGER_ATTR,"true"),s.setAttribute("aria-label",w.t("Paste options")),s.setAttribute("arrow-icon",i),s.icon="rte-paste",s.showArrowIcon=!0,s.selected=!1,this.triggerButtonEl=s;const r=t.createElement("vega-tooltip");r.text=w.t("Paste options"),r.placement=["bottom","top"],r.append(s),n.append(r);const a=t.createElement("div");a.setAttribute("slot","items");const o=[this.createDropdownItem(t,cr.RICH,w.t("Use rich text"),ea.CHOOSER_RICH_ATTR),this.createDropdownItem(t,cr.PLAIN,w.t("Use plain text"),ea.CHOOSER_PLAIN_ATTR)];return this.options.showWordOption&&o.push(this.createDropdownItem(t,cr.WORD,w.t("Use Word"),ea.CHOOSER_WORD_ATTR)),a.append(...o),n.append(a),n.addEventListener("vegaDropdownClick",(t=>{const e=t.detail;e!==cr.RICH&&e!==cr.PLAIN&&e!==cr.WORD||this.callbacks.onModeSelect(e)})),n}createDropdownItem(t,e,n,s){const i=t.createElement("vega-dropdown-item");return i.itemKey=e,i.label=n,i.setAttribute(s,"true"),i}}vt.register({"rte-paste":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M80 96v16c0 17.7 14.3 32 32 32h60.8c16.6-28.7 47.6-48 83.2-48h62c-7.1-27.6-32.2-48-62-48H215.4C211.6 20.9 188.2 0 160 0s-51.6 20.9-55.4 48H64C28.7 48 0 76.7 0 112V384c0 35.3 28.7 64 64 64h96V400H64c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H80zm64-40a16 16 0 1 1 32 0 16 16 0 1 1 -32 0zM256 464c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H384v48c0 17.7 14.3 32 32 32h48V448c0 8.8-7.2 16-16 16H256zm192 48c35.3 0 64-28.7 64-64V227.9c0-12.7-5.1-24.9-14.1-33.9l-51.9-51.9c-9-9-21.2-14.1-33.9-14.1H256c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></svg>'}}),ea.CHOOSER_ATTR="data-rte-paste-chooser",ea.CHOOSER_RICH_ATTR="data-rte-paste-type-rich",ea.CHOOSER_PLAIN_ATTR="data-rte-paste-type-plain",ea.CHOOSER_WORD_ATTR="data-rte-paste-type-word",ea.CHOOSER_TRIGGER_ATTR="data-rte-paste-trigger";class na{constructor(t,e,n){this.positioner=t,this.onModeSelect=e,this.onClearPayload=n,this.chooserUI=null,this.listenerDocument=null,this.listenerWindow=null,this.contentHostEl=null,this.handleOutsidePointerDown=t=>{if(!this.chooserUI)return;const e="function"==typeof t.composedPath?t.composedPath():[];this.chooserUI.includesEventPath(e)||this.clear()},this.handleOutsideKeyDown=t=>{"Escape"===t.key&&this.clear()},this.handleOutsideScroll=()=>this.clear()}get ui(){return this.chooserUI}open(t,e,n,s){var i,r,a;const o=null!==(i=null==t?void 0:t.shadowRoot)&&void 0!==i?i:null;if(!o||!t)return;this.clear(!1);const l=this.positioner.compute(n);this.chooserUI=new ea(o,{onModeSelect:this.onModeSelect},{showWordOption:s}),this.chooserUI.open(l),this.contentHostEl=e,this.listenerDocument=t.ownerDocument,this.listenerWindow=this.listenerDocument.defaultView,this.listenerDocument.addEventListener("mousedown",this.handleOutsidePointerDown,!0),this.listenerDocument.addEventListener("keydown",this.handleOutsideKeyDown,!0),this.listenerDocument.addEventListener("scroll",this.handleOutsideScroll,!0),null===(r=this.listenerWindow)||void 0===r||r.addEventListener("scroll",this.handleOutsideScroll,!0),null===(a=this.contentHostEl)||void 0===a||a.addEventListener("scroll",this.handleOutsideScroll)}clear(t=!0){var e,n,s;null===(e=this.contentHostEl)||void 0===e||e.removeEventListener("scroll",this.handleOutsideScroll),this.contentHostEl=null,null===(n=this.listenerWindow)||void 0===n||n.removeEventListener("scroll",this.handleOutsideScroll,!0),this.listenerWindow=null,this.listenerDocument&&(this.listenerDocument.removeEventListener("mousedown",this.handleOutsidePointerDown,!0),this.listenerDocument.removeEventListener("keydown",this.handleOutsideKeyDown,!0),this.listenerDocument.removeEventListener("scroll",this.handleOutsideScroll,!0),this.listenerDocument=null),null===(s=this.chooserUI)||void 0===s||s.destroy(),this.chooserUI=null,t&&this.onClearPayload()}}class sa extends wt{constructor(t={}){super(),this.editableEl=null,this.contentHostEl=null,this.pendingPastePayload=null,this.handlePasteEvent=t=>{this.pasteEventInterceptor.handlePasteEvent(t)},this.handleOutsidePointerDown=t=>{this.pasteChooserController.handleOutsidePointerDown(t)},this.handleOutsideKeyDown=t=>{this.pasteChooserController.handleOutsideKeyDown(t)},this.handleOutsideScroll=()=>{this.pasteChooserController.handleOutsideScroll()},this.options=t,this.strategySelector=new Kr,this.imageParser=new Wr,this.pendingImageRegistry=new Ur,this.chooserPositioner=new Gr((()=>this.hostEl),(()=>{var t,e;return null!==(e=null===(t=this.pendingPastePayload)||void 0===t?void 0:t.range)&&void 0!==e?e:this.cloneCurrentSelectionRange()})),this.processingPipeline=new Qr(this.strategySelector,new Zr(this.imageParser),this.pendingImageRegistry),this.dataTransferBuilder=new Jr,this.pasteDispatcher=new Yr,this.selectionSnapshotService=new Xr((()=>this.extensionContext)),this.pasteEventInterceptor=new ta(this.selectionSnapshotService,((t,e)=>{this.pendingPastePayload=t,this.renderPasteChooser(e)})),this.pasteChooserController=new na(this.chooserPositioner,(t=>this.applyPasteMode(t)),(()=>{this.pendingPastePayload=null}))}initialExtensionAfterLoad(t){super.initialExtensionAfterLoad(t),this.hostEl=t.host,this.attachPasteListener()}destroyExtension(){this.detachPasteListener(),this.clearPasteChooser(),this.pendingImageRegistry.discardUnsentPreviews()}get chooserUI(){return this.pasteChooserController.ui}attachPasteListener(){const{editableEl:t,contentHostEl:e}=this.getEditorElements();this.editableEl=t,this.contentHostEl=e,this.pasteEventInterceptor.attach(this.editableEl)}detachPasteListener(){this.pasteEventInterceptor.detach(),this.editableEl=null,this.contentHostEl=null}getEditorElements(){var t,e,n,s,i;const r=null!==(n=null===(e=null===(t=this.hostEl)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelector("vega-rich-text-content"))&&void 0!==n?n:null;return{editableEl:null!==(i=null===(s=null==r?void 0:r.shadowRoot)||void 0===s?void 0:s.querySelector(".rich-text-content"))&&void 0!==i?i:null,contentHostEl:r}}getEditableElement(){const{editableEl:t}=this.getEditorElements();return t}cloneCurrentSelectionRange(){return this.selectionSnapshotService.capture().range}renderPasteChooser(t){var e;this.pasteChooserController.open(this.hostEl,this.contentHostEl,t,!0===(null===(e=this.options)||void 0===e?void 0:e.enableWordPaste))}applyPasteMode(t){var e;if(!this.pendingPastePayload)return void this.clearPasteChooser();const n=null!==(e=this.editableEl)&&void 0!==e?e:this.getEditableElement();if(!n)return void this.clearPasteChooser();n.focus(),this.selectionSnapshotService.restore(this.pendingPastePayload);const s=this.processingPipeline.process(this.pendingPastePayload,t),i=this.dataTransferBuilder.build(s);this.pasteDispatcher.dispatch(n,i),this.clearPasteChooser(),this.emitLocalImageInsertedEvent()}emitLocalImageInsertedEvent(){this.pendingImageRegistry.hasPendingNotifications()&&this.pendingImageRegistry.notifyInserted(this.options.imageInsertedCallback,(()=>{var t;return null!==(t=this.editableEl)&&void 0!==t?t:this.getEditableElement()}),(t=>this.getDTOEntityByDom(t)))}clearPasteChooser(t=!0){this.pasteChooserController.clear(t)}}wt.registerActionHandleStrategy(pt.typeName,"REPLACE_IMAGE_SRC",new class extends O{handleAction(t,e){const{img:n,url:s}=t;if(n.setAttribute("src",s),n.removeAttribute(Wr.PREVIEW_IMG_KEY),e.url=s,e.annotationMap&&e.annotationMap.has("CUSTOM_ATTRIBUTE")){const t=e.annotationMap.get("CUSTOM_ATTRIBUTE");t.customAttribute.src=s,delete t.customAttribute[Wr.PREVIEW_IMG_KEY]}}});class ia extends v{constructor(t,e){super(),this.type="COPY_SELECTED_CONTENT_ACTION",this.selection=null,this.selectedNodes=[],this.copyResult=null,this.selection=t,this.selectedNodes=e}}class ra extends xt{render(t,e){return this.renderButton(t,e,{icon:"rte-copy",ariaLabel:e.translation.t("Copy"),tooltip:{text:"Copy"}})}isDisabled(t){const e=this.getExtensionContext(t.host);return!e||e.host.disabled||!e.getSelection()||e.getSelection().isCollapsed}handleButtonClick(t){const e=this.getExtensionContext(t.host);e&&e.host&&e.host.value.apply(new ia(e.getSelection(),e.getSelectedNodes()))}handleDropdownClick(){}}vt.register({"rte-copy":$e});class aa extends wt{prepareBeforeLoad(t){this.registerToolbarButtonRenderer(aa.TOOLBAR_BUTTON_KEY,new ra,t)}}b.register("COPY_SELECTED_CONTENT_ACTION",nt.typeName,new class extends O{handleAction(t){const e=this.getParentBlocks(t.selectedNodes),{html:n,text:s}=this.getSelectedContent(t.selection,e);(s||n)&&(t.copyResult=this.copyToClipboard(n,s))}getSelectedContent(t,e){const n={html:"",text:""};if(!t||0===t.rangeCount||t.isCollapsed)return n;const s=t.getRangeAt(0),i=He();if(!i)return n;const r=s.cloneContents(),a=i.createElement("div"),o=s.commonAncestorContainer;if(1===e.length){const t=this.getDOMByEntity(e[0]);if(t&&t.contains(o)){const e=this.wrapWithAncestorChain(r,o,t);return a.appendChild(e),n.html=a.innerHTML,n.text=a.textContent,n}}else if(e.length>1&&e.every((t=>"list-item"===t.type))){const t=e[0].parent;if(t&&e.every((e=>e.parent===t))){const e=this.getDOMByEntity(t);if(e&&e.contains(o)){const t=e.cloneNode(!1);return t.appendChild(r),a.appendChild(t),n.html=a.innerHTML,n.text=a.textContent,n}}}return a.appendChild(r),n.html=a.innerHTML,n.text=a.textContent,n}wrapWithAncestorChain(t,e,n){const s=n.cloneNode(!1),i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;if(i===n)return s.appendChild(t),s;const r=i.cloneNode(!1);r.appendChild(t);let a=r,o=i.parentElement;for(;o&&o!==n;){const t=o.cloneNode(!1);t.appendChild(a),a=t,o=o.parentElement}if(s.appendChild(a),"LI"===s.tagName&&o&&o.parentElement&&"OL"===o.parentElement.tagName){const t=o.parentElement.cloneNode(!1);return t.appendChild(s),t}return s}getParentBlocks(t){const e=[];for(const n of t){const t=n.parent;t&&!e.includes(t)&&e.push(t)}return e}async copyToClipboard(t,e){let n=!1;try{const s=new Blob([t],{type:"text/html"}),i=new Blob([e],{type:"text/plain"}),r=new ClipboardItem({"text/html":s,"text/plain":i});await navigator.clipboard.write([r]),n=!0}catch(s){n=this.copyWithExecCommand(t,e),n||o.warn("Failed to copy the selected content to the clipboard. Use keyboard shortcuts instead.")}return n}copyWithExecCommand(t,e){const n=He();if(!n)return!1;const s=n=>{n.clipboardData&&(n.clipboardData.setData("text/html",t),n.clipboardData.setData("text/plain",e)),n.preventDefault()};n.addEventListener("copy",s);try{return n.execCommand("copy")}finally{n.removeEventListener("copy",s)}}}),aa.TOOLBAR_BUTTON_KEY="copy";class oa extends v{constructor(t,e,n=!1){super(),this.type=M.DELETE_SELECTED_CONTENT,this.mergeFlag=!1,this.host=t,this.mergeFlag=e,this.isFlushable=n}}class la extends ra{render(t,e){return this.renderButton(t,e,{icon:"rte-cut",ariaLabel:e.translation.t("Cut"),tooltip:{text:"Cut"}})}async handleButtonClick(t){const e=this.getExtensionContext(t.host);if(e&&e.host){const{host:t}=e,n=new ia(e.getSelection(),e.getSelectedNodes());t.value.apply(n),await n.copyResult&&t.value.apply(new oa(t,!0,!0))}}}vt.register({"rte-cut":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --\x3e<path fill="currentColor" d="M48 112a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm176 0C224 50.1 173.9 0 112 0S0 50.1 0 112 50.1 224 112 224c24 0 46.3-7.6 64.5-20.4l57.3 52.4-57.3 52.4C158.3 295.6 136 288 112 288 50.1 288 0 338.1 0 400s50.1 112 112 112 112-50.1 112-112c0-20.5-5.5-39.6-15.1-56.2L504.2 73.7c9.8-8.9 10.5-24.1 1.5-33.9s-24.1-10.5-33.9-1.5l-202.4 185.2-60.5-55.3c9.6-16.5 15.1-35.7 15.1-56.2zM471.8 473.7c9.8 8.9 25 8.3 33.9-1.5s8.3-25-1.5-33.9L338.6 286.8 302.7 319 471.8 473.7zM48 400a64 64 0 1 1 128 0 64 64 0 1 1 -128 0z"/></svg>'}});class ca extends wt{prepareBeforeLoad(t){this.registerToolbarButtonRenderer(ca.TOOLBAR_BUTTON_KEY,new la,t)}}ca.TOOLBAR_BUTTON_KEY="cut";const ha={showCharCount:!0,countInlineBreak:!1,hardLimit:!1};class da extends wt{constructor(t={}){super(),this.type=tt,this.config=Object.assign(Object.assign({},ha),t)}getConfig(){return this.config}getData(t){const e=t.getPlainText(),{maxChars:n,hardLimit:s}=this.config;return{count:this.calculateTextCount(e),maxChars:n,hardLimit:s}}calculateTextCount(t){const{countInlineBreak:e}=this.config;return[...e?t:t.replace(/\n/g,"")].length}}wt.registerActionHandlerInterceptor(nt.typeName,ft,new class extends Ct{canIntercept(t){var e;const n=null===(e=t.host.extensions)||void 0===e?void 0:e.find((t=>this.isWordCountExtension(t)));if(!n)return!1;const{hardLimit:s,maxChars:i}=n.getConfig(),r=t.candidate.getPlainText(),a=n.calculateTextCount(r);if(!bt(i)||a<=i)return!1;let o=!1,l="";return s&&t.previous&&(l=t.previous.getPlainText(),o=a>n.calculateTextCount(l)),this.notifyCharsLimitExceeded(r,l,n,t),o}intercept(){}notifyCharsLimitExceeded(t,e,n,s){const{maxChars:i,hardLimit:r,onCharsLimitExceeded:a}=n.getConfig();"function"==typeof a&&(r&&e===t||a(s.host,i))}isWordCountExtension(t){return t.type===tt}});class ua extends O{handleAction(e,n){const{rteRange:s,token:i}=e;if(s&&s.startNode){const{key:r,label:a,customAttrs:o={wrapped:"true"}}=i,l=new gn(t(),r,a,n);l.annotationMap.set("CUSTOM_ATTRIBUTE",new P(o)),n.apply(new St(s,l)),e.actionHandleResult=!0}}}const pa=new class extends it{canHandle(t,e){const n=t[e];return"SPAN"===n.nodeName&&n.classList.contains("token")&&n.hasAttribute("token-key")?1:0}handle(e,n,s){const i=e[0],r=i.getAttribute("token-key"),a=i.textContent,o=rt.generate(y,i),{customAttribute:l}=o,c=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n}(o,["customAttribute","customClass"]);return{id:t(),type:"token",token:r,text:a,annotations:Object.assign(Object.assign(Object.assign({},c),(null==s?void 0:s.inlineHtml)?{inlineHtml:s.inlineHtml}:{}),{customAttribute:this.createCustomAttrs(l)})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}createCustomAttrs(t){const e=Object.assign(Object.assign({},t),{contenteditable:null,"template-token-key":null,"token-key":null,wrapped:"false"===t.wrapped?"false":"true"});return _e(e)}};class fa extends wt{constructor(t=[]){super(),this.tokenRenderer=new wn,this.tokenList=t,this.registerNode("token",gn),this.registerRenderer("token",this.tokenRenderer),this.registerElementToNodeDTOClassStrategy(pa)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(fa.TOOLBAR_BUTTON_KEY,new fn(this.tokenList),t)}}(()=>{const t=new ua;wt.registerActionHandleStrategy(A.typeName,"INSERT_TOKEN_NODE",t),wt.registerActionHandleStrategy(q.typeName,"INSERT_TOKEN_NODE",t)})(),fa.TOOLBAR_BUTTON_KEY="token";export{da as A,un as B,gn as C,wn as D,mn as E,wi as F,oa as G,fn as R,Ke as V,Ge as a,Je as b,tn as c,ln as d,dn as e,fa as f,vn as g,Gi as h,Vn as i,ti as j,ui as k,ki as l,ji as m,Ui as n,Ni as o,Ei as p,Oi as q,Ii as r,Ri as s,Bi as t,rr as u,sa as v,rn as w,lr as x,aa as y,ca as z}
|
|
1
|
+
import{g as t}from"./p-8b5d3a52.js";import{a as e,g as n,D as s,f as i,r,b as a}from"./p-aa135628.js";import{L as o,I as l}from"./p-6e1ab235.js";import{I as c,D as h,c as d}from"./p-5c285374.js";import{I as u}from"./p-781fd6e0.js";import{c as p}from"./p-6a334573.js";import{P as f}from"./p-81dd00d0.js";import{i as g}from"./p-29584bb5.js";import{V as w}from"./p-347d664e.js";import{I as m}from"./p-c73cce9b.js";import{M as v,A as b,R as y,H as x,a as C,s as L,b as T,c as A,N as S,d as k,e as E,f as O,I,g as R,h as B,i as N,j as M,B as j,k as H,l as D,C as _,m as P,n as V,o as $,p as F,S as z,U as K,q as W,r as q,t as U,u as G,v as Z,w as Q,x as J,y as Y,z as X,D as tt}from"./p-3040c091.js";import{U as et,V as nt,B as st,E as it,h as rt,H as at,I as ot,R as lt,a as ct,P as ht,A as dt,S as ut,b as pt,C as ft}from"./p-68e70f75.js";import{a as gt,b as wt,e as mt}from"./p-c0eddde0.js";import{V as vt}from"./p-44245a36.js";import{i as bt}from"./p-8e3c1c81.js";import{v as yt}from"./p-4866e390.js";import{b as xt,A as Ct,R as Lt,h as Tt,c as At,I as St}from"./p-e2168481.js";import{R as kt,a as Et,S as Ot,T as It,b as Rt,c as Bt,d as Nt,e as Mt,C as jt,M as Ht,f as Dt,g as _t,h as Pt,i as Vt,j as $t,k as Ft,l as zt,m as Kt,n as Wt,o as qt,p as Ut,q as Gt,s as Zt,r as Qt,t as Jt,I as Yt,u as Xt,v as te,w as ee,x as ne,y as se,z as ie,A as re,B as ae,D as oe,E as le,F as ce,G as he,H as de,J as ue,K as pe,L as fe,N as ge,O as we,P as me,Q as ve,U as be,W as ye,X as xe,Y as Ce}from"./p-37eb020f.js";import{C as Le}from"./p-2d0d575f.js";import{D as Te,d as Ae}from"./p-36a57431.js";import{V as Se,a as ke,b as Ee}from"./p-53e3f259.js";import{r as Oe}from"./p-77e64f26.js";import{V as Ie,a as Re}from"./p-d1f47512.js";import{V as Be,a as Ne,b as Me,c as je}from"./p-a83cef5a.js";import{t as He}from"./p-b75ee3ba.js";import{p as De}from"./p-0c667d6a.js";import{c as _e}from"./p-a841cf13.js";import{d as Pe}from"./p-1bc5b3bc.js";import{c as Ve}from"./p-02841589.js";import{c as $e}from"./p-890a5254.js";const Fe=[{payloadKey:"IS_LOAD_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaLoaderController is called",canAccept:(t,e)=>"VegaLoaderController"===t&&"load"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSE_METHOD_CALLED",payloadDescription:"Indicate if the method close of public API VegaLoaderController is called",canAccept:(t,e)=>"VegaLoaderController"===t&&"close"===e,payloadValue:()=>!0}];class ze extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(ze,["load","close"],Fe,ze.typeName)}load(t={}){let e=t.containerSelector||"body",n=document.querySelector(e);if(n&&ze.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY.includes(n.tagName)&&(e="body",n=document.querySelector("body")),!n)return o.error("Container is not found by selector: ",e),null;const s=this.createLoadingIndicator(t.indicatorOptions),i=this.createLoader(e);return i.append(s),this.appendLoader(i,n)}close(t){const e=this.findLoader(t);if(e){if(e.dataset.container){const t=document.querySelector(e.dataset.container);t&&t.dataset.vegaLoaderOriginPosition&&(t.style.position=t.dataset.vegaLoaderOriginPosition)}e.remove()}}findLoader(t){var e,n;let s;if(t.includes(">>>")){const[i,r]=t.split(">>>");s=null===(n=null===(e=document.querySelector(i))||void 0===e?void 0:e.shadowRoot)||void 0===n?void 0:n.getElementById(r)}else s=document.getElementById(t);return s}createLoader(n){const s=document.createElement("vega-loader-wrapper");return s.className=e(["body"===n?"fixed-wrapper":"absolute-wrapper"]),s.dataset.container=n,s.id=`vega-loader-${t()}`,s}createLoadingIndicator(t={}){const e=document.createElement("vega-loading-indicator");return Object.assign(e,t),e}appendLoader(t,e){return e.dataset.vegaLoaderOriginPosition=e.style.position,e.style.position="relative",e.shadowRoot?(e.shadowRoot.append(t),`${t.dataset.container}>>>${t.id}`):(e.append(t),t.id)}}ze.typeName="VegaLoaderController",ze.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY=["VEGA-MODAL"],function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],ze.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Ke=new ze,We=[{payloadKey:"IS_OPEN_METHOD_CALLED",payloadDescription:"Indicate if the method open of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"open"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSE_METHOD_CALLED",payloadDescription:"Indicate if the method close of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"close"===e,payloadValue:()=>!0},{payloadKey:"IS_CLOSEALL_METHOD_CALLED",payloadDescription:"Indicate if the method closeAll of public API VegaNotifyController is called",canAccept:(t,e)=>"VegaNotifyController"===t&&"closeAll"===e,payloadValue:()=>!0}];var qe=function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a};class Ue extends h{constructor(){super(...arguments),this.resizeObserverSlimmer=p(Ue,f,[],[{mapFrom:"connectResizeObserver",mapTo:"connectResizeObserver"}],[{callback:t=>{var e;!(t[0].contentRect.height>0)&&(null===(e=this.container)||void 0===e?void 0:e.classList.contains("hydrated"))&&(u.removeZIndex(this.container,"top"),this.container.remove(),this.container=null)},target:()=>this.container}]),this.vegaPublicAPIRuntimeMetricsSlimmer=d(Ue,["open","close","closeAll"],We,Ue.typeName)}async open(t){const e=this.createPageNotification(t);return this.getContainer().append(e),e.id}async closeAll(){this.container&&Array.from(this.container.children).forEach((t=>{t.close()}))}async close(t){await document.getElementById(t).close()}connectResizeObserver(){}createPageNotification(e){const i=document.createElement("vega-page-notification");return Object.keys(e).forEach((t=>{void 0!==e[t]&&(i[t]=e[t])})),i.style.marginBottom=n()===s.MOBILE?"12px":"16px",i.id=`vega-page-notification-${t()}`,i}getContainer(){return this.container||(this.container=document.createElement("vega-page-notification-list"),u.setZIndex(this.container,"top"),n()===s.MOBILE?this.container.classList.add("vega-page-notification-list-bottom"):this.container.classList.add("vega-page-notification-list-topRight"),document.body.append(this.container),this.connectResizeObserver()),this.container}}Ue.typeName="VegaNotifyController",qe([l()],Ue.prototype,"resizeObserverSlimmer",void 0),qe([c()],Ue.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Ge=new Ue,Ze=[{payloadKey:"IS_SETSEMANTICS_METHOD_CALLED",payloadDescription:"Indicate if the method setSemantics of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:()=>!0},{payloadKey:"IS_GETSEMANTICS_METHOD_CALLED",payloadDescription:"Indicate if the method getSemantics of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"getSemantics"===e,payloadValue:()=>!0},{payloadKey:"IS_GETENABLEDEVENTIDSBYCOMPONENT_METHOD_CALLED",payloadDescription:"Indicate if the method getEnabledEventIdsByComponent of public API VegaEventManager is called",canAccept:(t,e)=>"VegaEventManager"===t&&"getEnabledEventIdsByComponent"===e,payloadValue:()=>!0},{payloadKey:"globalEventIsNative",payloadDescription:"Indicate if the vega components will emit events without the vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>!(!t.global||"native"!==t.global.namespace)},{payloadKey:"eventOfSpecificComponentsIsNative",payloadDescription:"Indicate if the vega components will emit events with the vega prefix, but special components will emit events without vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.components){const t=Object.keys(e.components);return!!(t.length>0&&"native"===e.components[t[0]].namespace)}return!1}},{payloadKey:"eventOfSpecificComponentsIsVega",payloadDescription:"Indicate if the vega components will emit events without the vega prefix, but special components will emit events with vega prefix",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.global&&e.components){const t=Object.keys(e.components);return!!("native"===e.global.namespace&&t.length>0&&"vega"===e.components[t[0]].namespace)}return!1}},{payloadKey:"globalJqueryDelegatedEventIsTrue",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>!(!t.global||!0!==t.global.jqueryDelegatedEvent)},{payloadKey:"jqueryDelegatedEventIsCustomStrategy",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;return!!(e.global&&Array.isArray(e.global.jqueryDelegatedEvent)&&e.global.jqueryDelegatedEvent.length>0)}},{payloadKey:"jqueryDelegatedEventOfSpecialComponentsIsTrue",payloadDescription:"Indicate if the use jQuery with event delegation",canAccept:(t,e)=>"VegaEventManager"===t&&"setSemantics"===e,payloadValue:t=>{const e=t;if(e.components){const t=Object.keys(e.components);return!!(t.length>0&&!0===e.components[t[0]].jqueryDelegatedEvent)}return!1}}];class Qe extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(Qe,["setSemantics","getSemantics","getEnabledEventIdsByComponent"],Ze,Qe.typeName)}setSemantics(t){g.setSemantics(t)}getSemantics(t){return g.getSemantics(t)}getEnabledEventIdsByComponent(t){return g.getEnabledEventIdsByComponent(t)}}Qe.typeName="VegaEventManager",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],Qe.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const Je=new Qe,Ye=[{payloadKey:"IS_OVERRIDEZINDEXBASICVALUES_METHOD_CALLED",payloadDescription:"Indicate if the method overrideZIndexBasicValues of public API ZIndexManager is called",canAccept:(t,e)=>"VegaZIndexManager"===t&&"overrideZIndexBasicValues"===e,payloadValue:()=>!0},{payloadKey:"zIndexBasicValuesGreatThanTenThousand",payloadDescription:"Indicate if the basic z-index value is great than ten thousand",canAccept:(t,e)=>"VegaZIndexManager"===t&&"overrideZIndexBasicValues"===e,payloadValue:t=>t.base>1e4}];class Xe extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(Xe,["overrideZIndexBasicValues"],Ye,Xe.typeName)}overrideZIndexBasicValues(t){u.overrideZIndexBasicValues(t)}}Xe.typeName="VegaZIndexManager",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],Xe.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const tn=new Xe,en=[{payloadKey:"IS_WAITFORVEGA_METHOD_CALLED",payloadDescription:"Indicate if the method waitForVega of public API WaitForVegaHandler is called",canAccept:(t,e)=>"WaitForVegaHandler"===t&&"handle"===e,payloadValue:()=>!0}];class nn extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(nn,["handle"],en,nn.typeName)}async handle(){return await Promise.all(Array.from(document.querySelectorAll("*:not(.hydrated)")).filter((t=>t.tagName.startsWith("VEGA"))).map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)})))}}nn.typeName="WaitForVegaHandler",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],nn.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const sn=new nn,rn=async()=>sn.handle(),an=[{payloadKey:"IS_LOAD_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"load"===e,payloadValue:()=>!0},{payloadKey:"IS_UNLOAD_METHOD_CALLED",payloadDescription:"Indicate if the method unLoad of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"unLoad"===e,payloadValue:()=>!0},{payloadKey:"IS_UNLOADALL_METHOD_CALLED",payloadDescription:"Indicate if the method unLoadAll of public API VegaSkeletonLoaderController is called",canAccept:(t,e)=>"VegaSkeletonLoaderController"===t&&"unLoadAll"===e,payloadValue:()=>!0}];class on extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(on,["load","unLoad","unLoadAll"],an,on.typeName),this.loaderMap=new Map}load({target:e,type:n="text",width:s,height:i,items:r,layout:a}){const o=Array.from(document.body.querySelectorAll(e)),l=`vega-skeleton-loader-${t()}`,c=[];return o.forEach((t=>{const e=r?r.map(this.createSkeleton):[this.createSkeleton({type:n,width:s,height:i})],o=(a?[this.wrapLayout(e,a)]:e).map((t=>(t.dataset[on.LOADER_DATA_SET_KEY]=l,t)));c.push(...o),t.append(...o)})),this.loaderMap.set(l,c),l}unLoad(t){this.loaderMap.has(t)&&(this.loaderMap.get(t).forEach((t=>t.remove())),this.loaderMap.delete(t))}unLoadAll(){for(const t of this.loaderMap.values())t.forEach((t=>t.remove()));this.loaderMap.clear()}createSkeleton(t){const{type:e,width:n,height:s}=t,i=document.createElement("vega-skeleton");return Object.assign(i,{animated:!0,type:e,width:n,height:s}),i}wrapLayout(t,e){const n=document.createElement("vega-flex");return Object.assign(n,Object.assign({className:"vega-skeleton-loader-template-container"},e.props)),Object.assign(n.style,e.style),n.append(...t),n}}on.typeName="VegaSkeletonLoaderController",on.LOADER_DATA_SET_KEY="vegaSkeletonLoaderKey",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],on.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const ln=new on,cn=[{payloadKey:"IS_INIT_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaTranslation.init is called",canAccept:(t,e)=>"TranslationController"===t&&"init"===e,payloadValue:()=>!0},{payloadKey:"IS_CHANGE_LANGUAGE_METHOD_CALLED",payloadDescription:"Indicate if the method load of public API VegaTranslation.changeLanguage is called",canAccept:(t,e)=>"TranslationController"===t&&"changeLanguage"===e,payloadValue:()=>!0}];class hn extends h{constructor(){super(...arguments),this.vegaPublicAPIRuntimeMetricsSlimmer=d(hn,["init","changeLanguage"],cn,hn.typeName)}get currentLanguage(){return w.currentLanguage}init(t){w.init(t)}changeLanguage(t){w.changeLanguage(t)}}hn.typeName="TranslationController",function(t,e,n,s){var i,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);r>3&&a&&Object.defineProperty(e,n,a)}([c()],hn.prototype,"vegaPublicAPIRuntimeMetricsSlimmer",void 0);const dn=new hn;class un{static fromDate(t,e="month",n,s=!0){const i=m.createCalendarPeriod(t,e,n,s);return m.toCalendarPeriodType(i)}}class pn extends v{constructor(t,e){super(),this.type="INSERT_TOKEN_NODE",this.rteRange=null,this.actionHandleResult=!1,this.rteRange=t,this.token=e}}class fn extends xt{constructor(t){super(),this.tokenList=[],this.tokenList=t}render(t,e){return this.renderDropdown(t,e,{},[this.renderButton(t,e,{label:"Tokens",ariaLabel:"Tokens",showArrowIcon:!0,tooltip:{text:"Insert token"}}),this.renderDropdownListTemplate(t,this.tokenList,e)])}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,[s]=n();return s?t.disabled||!b.canHandle("INSERT_TOKEN_NODE",s.parent):t.disabled}return!1}handleButtonClick(t){}handleDropdownClick(t,e){const n=this.getListItemByKey(this.tokenList,t),{rteRange:s}=e,{startNode:i}=s;if(i&&i.parent){const t=new pn(s,n);i.parent.apply(t),t.actionHandleResult&&this.flushEditorUI(e)}}flushEditorUI(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,flushValue:n}=e;n(t.value)}}}class gn extends y{constructor(t,e,n,s,i){super(t,n,s,i),this.type="token",this.token=e,this.text=n}static from(t,e){const n=new gn(t.id,t.token,t.text,e);return t.annotations&&(n.annotationMap=this.generateTextAnnotationMap(t.annotations)),n}toJSON(){const t=super.toJSON();return Object.assign({id:this.id,type:this.type,text:this.text,token:this.token},t.annotations?{annotations:t.annotations}:{})}isContentEditable(){return!1}clone(t){return new gn(this.id,this.token,this.text,t,this.annotationMap)}toHtml(){return`<span class="token" contenteditable="false" template-token-key="${this.token}" token-key="${this.token}"${super.generateAttributeString()}>${this.text}</span>`}renderHtmlFromDepth(t,e){const n=this.getInlineHtmlAnnotationAtDepth(t);return n?this.renderTokenWithWrapperStr(n):this.toHtml()}renderTokenWithWrapperStr(t){const{htmlTag:e,child:n}=t,s=this.inlineHtmlAnnotationAttrStr(t);return n?`<${e}${s}>${this.renderTokenWithWrapperStr(n)}</${e}>`:x.has(e)?`<${e}${s}>`:`<${e}${s}>${this.toHtml()}</${e}>`}inlineHtmlAnnotationAttrStr(t){const{customAttribute:e,customClass:n,customStyle:s}=t,i=[...(null==e?void 0:e.toString())||[],null==n?void 0:n.toString(),null==s?void 0:s.toString()].filter(bt);return i.length>0?` ${i.join(" ")}`:""}}gn.typeName="RTETokenNode";class wn extends gt{doRender(t,e,n){const{id:s,token:i}=e;return t("span",Object.assign(Object.assign({key:s,"template-token-key":i,"token-key":i,contenteditable:"false",style:e.getStyles(),class:`token ${e.getClasses()}`},this.additionalAttributes(e)),{ref:this.useRef(e),onClick:t=>{t.preventDefault(),n&&!1!==n.editable&&this.handleTokenElementClick(t,e,n.host)}}),e.text)}injectRTEScopeStyles(){return"span[token-key]{padding: 0 2px; margin: 0 1px; background-color: rgba(var(--v-bg-status-info, 205,209,211))}"}handleTokenElementClick(t,e,n){t.preventDefault(),n&&n.value.apply(new et(e,void 0,!0))}additionalAttributes(t){const e=t.getCustomAttributesAnnotation();let n={wrapped:"true"};return e&&(n=Object.assign(Object.assign({},n),e.render())),n}}wn.typeName="RTETokenNodeRenderer";class mn extends xt{constructor(t,e,n=""){super(),this.languageList=[],this.languageChangeCallback=null,this.selectedLanguage="",this.labelRef=null,this.translation=null,this.handleDropdownClick=t=>{this.setSelectedLanguage(t),"function"==typeof this.languageChangeCallback&&this.languageChangeCallback(t)},this.languageList=t,this.languageChangeCallback=e,this.selectedLanguage=n}setSelectedLanguage(t){var e;if(this.selectedLanguage=t,(null===(e=this.labelRef)||void 0===e?void 0:e.firstChild)&&this.translation){const e=this.getLanguageLabelByKey(t);this.labelRef.firstChild.nodeValue=this.translation.t(e)}}isHidden(){return!1}render(t,e){const n=this.languageList.map((t=>this.translateDropdownEntry(t,e)));return this.renderDropdown(t,e,{source:n},[this.renderButton(t,e,{label:this.getLanguageLabelByKey(this.selectedLanguage),ariaLabel:"Language",showArrowIcon:!0,tooltip:{text:"Select language"}})])}renderButtonLabel(t,e,n){return this.translation=e.translation,t("vega-font",{variant:"font-field-label-sm",color:this.isDisabled(e)?"text-disabled":"text-primary","aria-hidden":"true",ref:t=>{this.labelRef=t}},e.translation.t(n))}handleButtonClick(t){}getLanguageLabelByKey(t){var e;const n=this.getListItemByKey(this.languageList,t);return null!==(e=null==n?void 0:n.label)&&void 0!==e?e:"Select Language"}translateDropdownEntry(t,e){const n=e.translation.t(t.label);return Object.assign(Object.assign({},t),"children"in t?{label:n,children:t.children.map((t=>this.translateDropdownEntry(t,e)))}:{label:n})}}class vn extends wt{constructor(t,e){super(),this.languageToolbarButtonRenderer=null,this.languageState={selectedLanguage:"",contentMap:{}},this.languageChangeCallBack=t=>{const e=this.languageState.selectedLanguage;this.extensionContext&&e&&(this.languageState.contentMap[e]=this.getRTELatestValue(this.extensionContext.host)),this.languageState.selectedLanguage=t,this.applyLanguageContent(t,this.languageState.contentMap)},this.languageList=t,e&&(this.languageState=Object.assign(Object.assign({},this.languageState),e)),!this.languageState.selectedLanguage&&t.length>0&&(this.languageState.selectedLanguage=t[0].key)}prepareBeforeLoad(t){this.languageToolbarButtonRenderer=new mn(this.languageList,this.languageChangeCallBack,this.languageState.selectedLanguage),this.registerToolbarButtonRenderer(vn.TOOLBAR_BUTTON_KEY,this.languageToolbarButtonRenderer,t)}initialExtensionAfterLoad(t){super.initialExtensionAfterLoad(t);const{selectedLanguage:e,contentMap:n}=this.languageState;this.languageToolbarButtonRenderer&&this.languageToolbarButtonRenderer.setSelectedLanguage(e),n&&n[e]&&this.applyLanguageContent(this.languageState.selectedLanguage,this.languageState.contentMap)}setState(t){const{selectedLanguage:e,contentMap:n}=t;this.languageToolbarButtonRenderer&&this.languageToolbarButtonRenderer.setSelectedLanguage(e),this.languageState.selectedLanguage=e,this.languageState.contentMap=Object.assign({},n),this.applyLanguageContent(e,n)}getState(){const{selectedLanguage:t,contentMap:e}=this.languageState;return this.extensionContext&&(e[t]=this.getRTELatestValue(this.extensionContext.host)),this.languageState}applyLanguageContent(t,e){if(this.extensionContext&&e){let n=e[t];const{host:s,flushValue:i}=this.extensionContext;n=n?n instanceof nt?n:nt.fromJSON(n,s.sourceEditConfig):nt.createEmptyContent(),s.value!==n&&i(n,!0)}}getRTELatestValue(t){var e;let n=t.value;if(this.extensionContext&&this.extensionContext.isSourceEditMode()&&t.shadowRoot){const s=t.shadowRoot.querySelector(".source-view-container vega-code-block");if(s){let i;t.sourceEditConfig&&(i={autoMatchFormat:null===(e=t.sourceEditConfig.autoMatchFormat)||void 0===e||e,filterInlineStyles:t.sourceEditConfig.filterInlineStyles,blockBoundaryRegistry:this.extensionContext.blockBoundaryRegistry}),n=nt.fromHtml(s.value.code,i)}}return n}}vn.TOOLBAR_BUTTON_KEY="languages";class bn extends v{constructor(t){super(),this.type="INSERT_FUNCTION_BLOCK",this.functionType=t}}const yn=["statement","statementelement","statementsyntax"];class xn extends C{constructor(t,e,n){super(t),this.type="logic-control-node",this.text="",this.text=e,this.parent=n}clone(){return new xn(this.id,this.text,this.parent)}toHtml(){return this.text}toJSON(){return{id:this.id,type:this.type,text:this.text}}getRangeEndOffset(){return 1}getRangeContainer(){const t=L.getDOMByEntity(this);if(t)return t.parentElement}isContentEditable(){return!1}getPlainText(){return this.text}}xn.typeName="RTELogicControlNode";class Cn extends T{constructor(t,e,n){super(t),this.type="logic-control-block",this.children=[],this.statementText="",this.statementText=e,this.children=[new xn(`${t}-node-1`,e,this)],n&&(this.parent=n)}static from(t){return new Cn(t.id,t.statementText)}isNotEmpty(){return!0}getLastNode(){return this.children[this.children.length-1]}toHtml(){return`<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`}clone(t){return new Cn(this.id,this.statementText,t)}toJSON(){return{id:this.id,type:this.type,statementText:this.statementText}}}Cn.typeName="RTELogicControlBlock";class Ln extends T{constructor(t){super(t),this.type="function-block",this.children=[]}static from(t,e){const n=new Ln(t.id),s={customClass:["statement"]};let{annotations:i}=t;return i=i?Object.assign(Object.assign({},i),s):s,super.convertAnnotationsToMap(n.annotationMap,i),n.children=this.generateBlockChildren(t.children,e,n),this.unwrapForeachContent(n.children),n}static unwrapForeachContent(t){t.forEach(((e,n)=>{const s=t[n+1];e instanceof Cn&&"FOREACH"===e.statementText&&s instanceof A&&s.children.forEach((t=>{const e=t.getAnnotationByType(S.INLINE_HTML);"div"===(null==e?void 0:e.htmlTag)&&(e.child?t.annotationMap.set(S.INLINE_HTML,e.child):t.annotationMap.delete(S.INLINE_HTML))}))}))}toHtml(){const t=this.children.map((t=>t instanceof A?`<div class="statementelement"${this.getFunctionContentStyle(t)}>${t.getChildrenHtml()}</div>`:t.toHtml())).join("");return`<div class="statement" ${k}>${t}</div>`}clone(e){const n=new Ln(t());return n.parent=e,n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n}getLastNode(){return this.children[this.children.length-1].getLastNode()}allowsCaretDescend(){return!1}isNotEmpty(){return this.children.length>0}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,children:this.children.map((t=>t.toJSON()))})}getFunctionContentStyle(t){const e=new E(t);let n=e.toCssText({standalone:!0});const s=t.getAnnotationByType("TEXT_STYLE");if(s&&"paragraph"===s.textStyle){const t=e.toCssText(void 0,void 0,s.renderStyle({standalone:!0}));n=n.replace(t,"").trim()}return n?` style="${n}"`:""}}Ln.typeName="RTEFunctionBlock";class Tn extends O{handleAction(t,e){const{functionType:n}=t,s=this.getFunctionBlock(n),i=this.createNewParagraph(""),r=this.getReferenceBlock(e);r?r.parent.apply(new I(r,s,i)):e.apply(new R([s,i])),i&&(t.nextFocusNode=i.children[0])}getFunctionBlock(e){const n=t();return Ln.from({id:n,type:"function-block",children:[{id:`${n}-1`,type:"logic-control-block",statementText:e.toUpperCase()},{id:`${n}-2`,annotations:{customClass:["statementelement"]},type:"paragraph",nodes:[{id:`${n}-2-1`,type:"text",text:" "}]},{id:`${n}-3`,type:"logic-control-block",statementText:"SHOW"},{id:`${n}-4`,annotations:{customClass:["statementelement"]},type:"paragraph",nodes:[{id:`${n}-4-1`,type:"text",text:" "}]}]})}getReferenceBlock(t){if(!(t instanceof nt)){const e=t.parent;return e instanceof Ln?e:t}}}class An extends xt{render(t,e){return this.renderDropdown(t,e,{},[this.renderButton(t,e,{label:"Functions",ariaLabel:"Functions",showArrowIcon:!0,tooltip:{text:"Insert function"}}),this.renderDropdownListTemplate(t,An.FUNCTION_LIST,e)])}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,s=n()[0];let i=!0;return s&&(i=b.canHandle("INSERT_FUNCTION_BLOCK",s.parent)),t.disabled||!i}return!1}handleButtonClick(){throw new Error("Method not implemented.")}handleDropdownClick(t,e){if(e){const n=this.getExtensionContext(e.host);if(n){const{host:e,getSelectedNodes:s}=n,i=s()[0],r=new bn(t);i?i.parent&&i.parent.apply(r):e.value.apply(r),r.nextFocusNode&&e.value.apply(new et(r.nextFocusNode,1))}}}}An.FUNCTION_LIST=[{key:"IF",label:"Conditional"},{key:"FOREACH",label:"Foreach"}];class Sn extends gt{doRender(t,e){return t("div",{key:e.id,class:"statementsyntax",ref:this.useRef(e)},t("span",{key:`${e.id}-1`,contenteditable:"false",ref:this.useRef(e.children[0])},e.statementText))}}Sn.typeName="RTELogicControlBlockRenderer";const kn=t=>t.hasAttribute(k)||yn.some((e=>t.classList.contains(e))),En=t=>t.hasAttribute(k)||t.classList.contains("statement");class On extends st{constructor(){super(...arguments),this.blockClassName="statementsyntax"}canHandle(t,e){const n=t[e];return n&&n.nodeType===Node.ELEMENT_NODE&&n.classList.contains(this.blockClassName)&&this.isFunctionBlockChild(n)?1:0}handle(e){const n=e[0];return Cn.from({id:t(),type:"logic-control-block",statementText:n.innerText})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isFunctionBlockChild(t){return!(!t.parentElement||!En(t.parentElement))}}class In extends gt{doRender(t,e){return t("div",{key:e.id,class:this.getElementClassName(e),[k]:"",ref:this.useRef(e)})}injectRTEScopeStyles(){return"div.statement{padding:2px 4px;background:rgba(var(--v-bg-accent3-secondary, 255, 239, 200));border:1px solid rgba(var(--v-bg-accent3-primary, 255, 220, 131));border-radius:4px;display:flex;flex-direction:row;justify-content:flex-start;align-items:stretch;gap:4px}div.statement .statementsyntax{padding:3px 0;line-height:22px}.rich-text-content div.statement .statementsyntax,.rich-text-content div.statement .statementelement{display:inline-block}div.statement+div.statement{margin-top:2px}div.statement .statementsyntax span{color:rgb(38, 42, 255);font-weight:bold}div.statement .statementelement{padding:2px 4px;background:rgba(var(--v-bg-secondary, 245, 247, 247));border:1px solid rgba(var(--v-border-color-input-field, 171, 198, 216));border-radius:4px;margin:0;min-width:8px}"}getElementClassName(t){let e=t.getClasses();return e.indexOf("statement")<0&&(e="statement "+e),e.trim()}}In.typeName="RTEFunctionBlockRenderer";class Rn extends Ct{canIntercept(t,e){return e.parent&&e.parent instanceof Ln}intercept(t,e,n){const s=new ot(n.children[0],0);s.isFlushable=!0,n.parent.apply(s)}}class Bn extends O{handleAction(t,e){const n=this.createNewParagraph("");n&&(e.parent.apply(new I(e,n)),t.newBlock=n,this.focusToNextLine(n))}focusToNextLine(t){const e=this.getRootContent(t);e&&e.apply(new et(t.children[0],1))}}class Nn extends v{constructor(t,e,n){super(),this.type="PASTE_PLAIN_TEXT",this.blocksToBeInserted=t,this.startNode=e,this.startOffset=n}}class Mn extends Rn{intercept(t,e,n){const{blocksToBeInserted:s,rteRange:i}=e;let{startNode:r,startOffset:a}=e;i&&(r=i.startNode,a=i.startOffset);const o=new Nn(s,r,a);n.apply(o)}}class jn extends O{handleAction(t,e){const{blocksToBeInserted:n,startNode:s,startOffset:i}=t;if(s instanceof y){const t=n.flatMap((t=>t instanceof A?(this.copyLinkGroupAnnotations(e.annotationMap,t.annotationMap),t.children):[]));t.length>0&&(e.apply(i>0?new I(s,...t):new B(s,...t)),this.focusToNextLine(t[t.length-1],t[t.length-1].getRangeEndOffset()))}}focusToNextLine(t,e){const n=this.getRootContent(t);n&&n.apply(new et(t,e))}copyLinkGroupAnnotations(t,e){if(e&&e.has(N.LINK_GROUP)){const n=e.get(N.LINK_GROUP);t.has(N.LINK_GROUP)?n.linkGroups.forEach(((e,n)=>{t.get(N.LINK_GROUP).linkGroups.set(n,e)})):t.set(N.LINK_GROUP,e.get(N.LINK_GROUP))}}}const Hn=new On,Dn=new class extends On{constructor(){super(...arguments),this.blockClassName="statementelement"}handle(e,n){const s=rt.generate(A,e[0]);return A.from({id:t(),type:"paragraph",annotations:Object.assign({customClass:[this.blockClassName]},s),nodes:this.generateChildNodes(Array.from(e[0].childNodes),void 0,n)})}},_n=new class extends it{canHandle(t,e){const n=t[e];if(n.nodeType!==Node.ELEMENT_NODE)return 0;const s=En(n);return"DIV"===n.tagName&&s&&n.childNodes.length&&n.querySelector(".statementsyntax")?1:0}handle(){return Ln.from({id:t(),type:"function-block",annotations:{customClass:["statement"]},children:[]})}appendChildBlocks(t,e){Ln.unwrapForeachContent(e),t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}},Pn=new class extends at{canHandle(t,e){const n=t[e];if(n.nodeType!==Node.ELEMENT_NODE)return 0;const s=!!n.querySelector(`[${k}], .statement`);return"DIV"===n.nodeName&&!kn(n)&&s?1:0}};class Vn extends wt{constructor(){super(),this.unregisterBlockBoundaryPredicate=null,this.registerBlockBasicStrategies(Cn.typeName),this.registerBlockBasicStrategies(Ln.typeName),this.preventFunctionBlockDefaultInsertNewParagraph(),this.registerNode("logic-control-block",Cn),this.registerRenderer("logic-control-block",new Sn),this.registerNode("function-block",Ln),this.registerRenderer("function-block",new In),this.registerElementToBlockDTOClassStrategy(Hn),this.registerElementToBlockDTOClassStrategy(Dn),this.registerElementToBlockDTOClassStrategy(_n),this.registerElementToBlockDTOClassStrategy(Pn)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(Vn.TOOLBAR_BUTTON_KEY,new An,t)}initialExtensionAfterLoad(t){var e;super.initialExtensionAfterLoad(t),null===(e=this.unregisterBlockBoundaryPredicate)||void 0===e||e.call(this),this.unregisterBlockBoundaryPredicate=this.registerBlockBoundaryPredicate(kn)}destroyExtension(){var t;null===(t=this.unregisterBlockBoundaryPredicate)||void 0===t||t.call(this),this.unregisterBlockBoundaryPredicate=null}preventFunctionBlockDefaultInsertNewParagraph(){this.unRegisterStrategy(M.INSERT_NEW_PARAGRAPH,Cn.typeName),this.unRegisterStrategy(M.APPEND_CHILDREN,Ln.typeName),this.unRegisterStrategy(M.INSERT_CHILDREN_AFTER,Ln.typeName),this.unRegisterStrategy(M.INSERT_CHILDREN_BEFORE,Ln.typeName),this.unRegisterStrategy(M.PASTE_CONTENT,Cn.typeName),wt.registerActionHandleStrategy(Ln.typeName,M.INSERT_NEW_PARAGRAPH,new Bn)}}(()=>{const t=new Tn;wt.registerActionHandleStrategy(nt.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(A.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(lt.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(Cn.typeName,"INSERT_FUNCTION_BLOCK",t),wt.registerActionHandleStrategy(A.typeName,"PASTE_PLAIN_TEXT",new jn),wt.registerActionHandlerInterceptor(A.typeName,M.INSERT_NEW_PARAGRAPH,new Rn),wt.registerActionHandlerInterceptor(A.typeName,M.PASTE_CONTENT,new Mn)})(),Vn.TOOLBAR_BUTTON_KEY="functions";class $n extends v{constructor(t){super(),this.isFlushable=!0,this.type="DELETE_TABLE_BLOCK",this.tableBlock=t}}class Fn extends j{constructor(){super(...arguments),this.type=kt.CAPTION}static getDefaultStyles(){return{padding:"8px",border:"1px solid #ddd",borderBottom:"none",position:"relative",textAlign:"center",minHeight:"22px"}}clone(){return new Fn}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--extension-table-caption"}renderStyle(t){return(null==t?void 0:t.standalone)?Object.assign(Object.assign({},Fn.getDefaultStyles()),{backgroundColor:this.getCaptionBackgroundColor()}):null}toJSON(){return{caption:!0}}getCaptionBackgroundColor(){return Ie.isDarkMode()?Et.dark:Et.light}}class zn extends T{constructor(t,e){super(t),this.type="table-caption";const{autoMatchFormat:n}=e||{autoMatchFormat:!0};n&&this.annotationMap.set(kt.CAPTION,new Fn)}static from(t,e){const n=new zn(t.id,e),s=t.annotations||{},{caption:i}=s,r=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n}(s,["caption"]);return i&&n.annotationMap.set(kt.CAPTION,new Fn),super.convertAnnotationsToMap(n.annotationMap,Object.assign({},r)),n.children=super.generateBlockChildren(t.children,e,n),n}clone(t){const e=new zn(this.id);return e.children=this.children.map((t=>t.clone(e))),e.parent=t,e.annotationMap=super.cloneAnnotations(),e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.isNotEmpty()))}toHtml(t){const e=this.children.map((e=>e.toHtml(t))).join("");return`<caption${super.generateAttributeString(t)}>${e}</caption>`}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,children:this.children.map((t=>t.toJSON()))})}}zn.typeName="RTETableCaptionBlock",b.register(M.INSERT_CHILDREN_BEFORE,zn.typeName,new ct),b.register(M.PASTE_CONTENT,zn.typeName,new ht);class Kn extends v{constructor(t){super(),this.type="TOGGLE_TABLE_CAPTION",this.isFlushable=!0,this.shouldEnable=t}}class Wn extends Ot{canHandle(t){return t[0]===It.CAPTION}execute(t,e,n){const s="rte-table-caption"===t[1],i=new Kn(s),r=n.getCaption();if(s){const t=r&&r.isNotEmpty()?r:this.createCaptionBlock(null==r?void 0:r.id);r&&t===r||n.setCaption(t),i.nextFocusNode=t.getLastNode()}else r&&(n.setCaption(null),i.nextFocusNode=n.getFirstNode());this.syncCursorPosition(n,i.nextFocusNode)}syncCursorPosition(t,e){super.syncCursorPosition(t,e)}createCaptionBlock(e){const n={id:null!=e?e:t(),type:"table-caption",children:[{id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]}]};return zn.from(n)}}class qn{static generateTablePropertiesForm(t){const e=t.annotationMap.get(kt.TABLE);let n={borderStyle:"none",borderColor:"",borderWidth:"",backgroundColor:"",width:"",height:"",textAlign:"center"};if(e){const t=e.toJSON().table,{style:s="none",color:i="",width:r=""}=t.border||{style:"none",color:"",width:""};n={backgroundColor:t.backgroundColor||"",width:t.width||"",height:t.height||"",textAlign:t.alignment,borderStyle:s,borderColor:i,borderWidth:r}}return n}updateCursorPosition(t,e){t&&e&&t.host.value.apply(new et(e,0))}}class Un extends H{constructor(t){super(),this.isFlushable=!0;const{textAlign:e,width:n,borderWidth:s,borderColor:i,borderStyle:r,height:a}=t,o=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n}(t,["textAlign","width","borderWidth","borderColor","borderStyle","height"]);this.tableProperties=Object.assign(Object.assign({},o),{alignment:e,border:{style:r,color:i,width:s?De(s):""},width:n?De(n):"",height:a?De(a):""})}toAnnotation(){return new Rt(this.tableProperties)}}Un.typeName="UpdateTablePropertiesAction";class Gn extends qn{handle(t,e,n,s){e.apply(new Un(n)),this.updateCursorPosition(t,s)}}class Zn extends qn{handle(t,e,n,s){t&&t.host&&(t.flushValue(t.host.value),this.updateCursorPosition(t,s))}}class Qn extends qn{handle(t,e,n){const s=new Un(n);s.isFlushable=!1,e.apply(s)}}class Jn extends H{constructor(t,e){super(),this.isFlushable=!0,this.cellAnnotation=t,this.originAnnotation=e}toAnnotation(){return this.updateOriginAnnotation(),this.originAnnotation}updateOriginAnnotation(){Object.keys(this.cellAnnotation).forEach((t=>{this.originAnnotation[t]=this.cellAnnotation[t]}))}}Jn.typeName="RTETableCellAnnotationsAction";class Yn extends Jn{constructor(t,e){super(t,e),this.isFlushable=!0}toAnnotation(){return this.updateOriginAnnotation(),this.originAnnotation}}Yn.typeName="RTETableHeadCellAnnotationsAction";var Xn=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n};class ts{static getStyleCollectionFromCell(t){return t.reduce(((t,e)=>{const n=e.getAnnotationByType(kt.CELL);if(t[e.id]={},n){const s=n.toJSON().tableCell,{border:i}=s,r=Xn(s,["border"]),a={};i&&(a.borderStyle=i.style,a.borderColor=i.color,a.borderWidth=i.width),t[e.id]=_e(Object.assign(Object.assign({},r),a))}return t}),{})}static convertStyleMapToFormField(t){const e={};for(const n in t){const s=t[n];for(const t in s)e[t]?e[t].push(s[t]):e[t]=[s[t]]}const n=Object.keys(t).length,s={};for(const t in e){const i=e[t],r=new Set(i);i.length===n&&1===r.size&&(s[t]=i[0])}return s}applyProperties(t,e,n){t.tableSelection.getSelectedCells().forEach((t=>{const s=e[t.id];if(s){const e=this.convertToVegaTableCellAnnotation(Object.assign({},s));this.applyAnnotation(t,e,n)}}))}updateCursorPosition(t,e){t&&e&&t.host.value.apply(new et(e,0))}convertToVegaTableCellAnnotation(t){const{borderStyle:e,borderWidth:n,borderColor:s}=t,i=Xn(t,["borderStyle","borderWidth","borderColor"]),r=_e({style:e,width:n?De(n):"",color:s});return _e(Object.assign(Object.assign({},i),{backgroundColor:i.backgroundColor||"",padding:i.padding?De(i.padding):"",width:i.width?De(i.width):"",height:i.height?De(i.height):"",verticalAlign:i.verticalAlign||"",textAlign:i.textAlign||"",border:r}))}applyAnnotation(t,e,n){const s=t.getAnnotationByType(kt.CELL)||new Bt({},!1),i=t instanceof Nt?new Yn(e,s):new Jn(e,s);i.isFlushable=n,t.apply(i)}}class es extends ts{handle(t,e,n){t&&t.host&&(t.flushValue(t.host.value),this.updateCursorPosition(t,n))}}class ns extends ts{handle(t,e){this.applyProperties(t,e,!1)}}class ss extends ts{handle(t,e,n){this.applyProperties(t,e,!0),this.updateCursorPosition(t,n)}}class is{constructor(t){this.inertedContentEl=null,this.returnFocusCell=null,this.escapePressed=!1,this.keydownListenerDocument=null,this.handleDocumentKeydown=t=>{"Escape"===t.code&&this.isEventWithinPopover(t)&&(this.escapePressed=!0)},this.renderContext=t}getTableExtensionContext(){return this.renderContext?mt.getExtensionContext(this.renderContext.host):null}beginReturnFocusTracking(t){this.returnFocusCell=null!=t?t:null,this.escapePressed=!1}attachEscapeTracker(t){t.addEventListener("keydown",this.handleDocumentKeydown,{capture:!0}),this.keydownListenerDocument=t}detachEscapeTracker(){this.keydownListenerDocument&&(this.keydownListenerDocument.removeEventListener("keydown",this.handleDocumentKeydown,{capture:!0}),this.keydownListenerDocument=null)}isEventWithinPopover(t){return!1}restoreFocusOnEscapeHide(){setTimeout((()=>{const t=this.escapePressed,e=this.returnFocusCell;this.escapePressed=!1,this.returnFocusCell=null,t&&e&&e.isConnected&&this.restoreFocusToCell(e)}),0)}restoreFocusToCell(t){var e,n,s;t.focus();const i=this.getTableExtensionContext(),r=null!==(s=null!==(e=null==i?void 0:i.getSelection())&&void 0!==e?e:null===(n=t.ownerDocument)||void 0===n?void 0:n.getSelection())&&void 0!==s?s:null;if(r){const e=new Range;e.setStart(t,0),e.setEnd(t,0),r.removeAllRanges(),r.addRange(e)}}getInertContentTarget(){return null}setEditorContentInert(t){if(t){const t=this.getInertContentTarget();t&&(t.setAttribute("inert",""),this.inertedContentEl=t)}else this.inertedContentEl&&(this.inertedContentEl.removeAttribute("inert"),this.inertedContentEl=null)}}class rs extends is{constructor(t,e){super(e),this.popoverCloseType="none",this.tablePropertiesHandlerMap={save:new Zn,cancel:new Gn,change:new Qn},this.cellPropertiesHandlerMap={save:new es,cancel:new ss,change:new ns},this.handleTablePropertiesUpdate=t=>{const e=t.type.replace("vega","").toLowerCase();this.popoverCloseType=e,"change"!==e&&this.hide();const n=this.getTableExtensionContext();n&&this.tablePropertiesHandlerMap[e].handle(n,this.currentTableBlock,t.detail,this.currentFocusNode),"change"===e&&this.popoverRef.show(!0)},this.handleCellPropertiesUpdate=t=>{const e=t.type.replace("vega","").toLowerCase();this.popoverCloseType=e,"change"!==e&&this.hide();const n=this.getTableExtensionContext();n&&this.cellPropertiesHandlerMap[e].handle(n,t.detail,this.currentFocusNode),"change"===e&&this.popoverRef.show(!0)},this.tableColorSchema=t}destroy(){this.setEditorContentInert(!1),this.detachEscapeTracker(),this.selectionAnchorRef&&this.selectionAnchorRef.parentNode&&(Te.removeUniqueObserverFromNode(this.selectionAnchorRef,Se),this.selectionAnchorRef.parentNode.removeChild(this.selectionAnchorRef),this.selectionAnchorRef=null)}async show(t,e){this.beginReturnFocusTracking(e);let n=this.getTableRef();const s=this.getTableExtensionContext();let i=[];if(s&&(i=s.tableSelection.getSelectedCells()),t===It.CELL&&i.length>1){const t=this.getOrCreateSelectionAnchor(i,n);t&&(n=t)}else t===It.CELL&&1===i.length&&(n=L.getDOMByEntity(i[0]));this.updateContent(t),this.storeCurrentFocusNode(),Oe.call(Ae.getSubject(this.popoverRef,ke),n),await this.popoverRef.show(),e&&this.focusFirstFormField(t)}async hide(){await this.popoverRef.hide()}reTarget(t,e){this.getTableRef=e,this.currentTableBlock=t}render(){const t=He();if(t){const e=t.createElement("vega-popover");e.trigger="click",e.isScreenPosition=!0,e.className="rte-table-dynamic-popover",Te.addUniqueObserverToNode(e,Be,(()=>{const t=this.getTableExtensionContext();"change"===this.popoverCloseType&&t&&t.flushValue(t.host.value),this.handleDialogHide()})),this.attachEscapeTracker(t);const n=t.createElement("div");n.setAttribute("slot","popover"),n.className="rte-table-dynamic-popover-content";const s=t.createElement("vega-rich-text-table-properties");s.colors=this.tableColorSchema,s.type=It.TABLE,s.setAttribute("type",It.TABLE),s.addEventListener("vegaCancel",this.handleTablePropertiesUpdate),s.addEventListener("vegaChange",this.handleTablePropertiesUpdate),s.addEventListener("vegaSave",this.handleTablePropertiesUpdate);const i=t.createElement("vega-rich-text-table-properties");return i.colors=this.tableColorSchema,i.type=It.CELL,i.setAttribute("type",It.CELL),i.addEventListener("vegaCancel",this.handleCellPropertiesUpdate),i.addEventListener("vegaChange",this.handleCellPropertiesUpdate),i.addEventListener("vegaSave",this.handleCellPropertiesUpdate),n.appendChild(s),n.appendChild(i),e.appendChild(n),this.popoverRef=e,this.tablePropertiesFormRef=s,this.cellPropertiesFormRef=i,e}}isEventWithinPopover(t){const e=t.composedPath();return!!this.tablePropertiesFormRef&&e.includes(this.tablePropertiesFormRef)||!!this.cellPropertiesFormRef&&e.includes(this.cellPropertiesFormRef)}getInertContentTarget(){var t,e,n;return null!==(n=null===(e=null===(t=this.getTableRef)||void 0===t?void 0:t.call(this))||void 0===e?void 0:e.closest(".rich-text-content"))&&void 0!==n?n:null}updateContent(t){this.popoverCloseType="none";const e=this.getTableExtensionContext();"TABLE"===t?(this.tablePropertiesFormRef.classList.remove("vega-hidden"),this.cellPropertiesFormRef.classList.add("vega-hidden"),this.tablePropertiesFormRef.defaultValue=qn.generateTablePropertiesForm(this.currentTableBlock)):"CELL"===t&&(this.cellPropertiesFormRef.classList.remove("vega-hidden"),this.tablePropertiesFormRef.classList.add("vega-hidden"),e&&(this.cellPropertiesFormRef.styleMap=ts.getStyleCollectionFromCell(e.tableSelection.getSelectedCells())),this.cellPropertiesFormRef.defaultValue=ts.convertStyleMapToFormField(this.cellPropertiesFormRef.styleMap)),e&&e.getSelection().removeAllRanges()}storeCurrentFocusNode(){const t=this.getTableExtensionContext();t&&(this.currentFocusNode=t.getSelectedNodes()[0])}focusFirstFormField(t){const e=t===It.TABLE?this.tablePropertiesFormRef:this.cellPropertiesFormRef;e&&(this.setEditorContentInert(!0),requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t,n,s,i,r;const a=null!==(n=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector("[data-vega-form]"))&&void 0!==n?n:null,o=null!==(i=null===(s=null==a?void 0:a.shadowRoot)||void 0===s?void 0:s.querySelector(".vega-input-select-container"))&&void 0!==i?i:null;null===(r=null!=o?o:a)||void 0===r||r.focus()}))})))}handleDialogHide(){this.setEditorContentInert(!1),this.restoreFocusOnEscapeHide()}getOrCreateSelectionAnchor(t,e){const n=He();if(n&&e){const s=e.closest(".rich-text-content"),i=s.getBoundingClientRect();let r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;t.map((t=>L.getDOMByEntity(t))).filter(bt).forEach((t=>{const e=t.getBoundingClientRect();r=Math.min(r,e.left-i.left),a=Math.max(a,e.right-i.left),o=Math.min(o,e.top-i.top),l=Math.max(l,e.bottom-i.top)}));const c=a-r,h=l-o;return this.selectionAnchorRef=s.querySelector(".rte-table-selection-popover-anchor"),this.selectionAnchorRef||(this.selectionAnchorRef=n.createElement("div"),this.selectionAnchorRef.className="rte-table-selection-popover-anchor",this.selectionAnchorRef.style.position="absolute",this.selectionAnchorRef.style.pointerEvents="none",s.appendChild(this.selectionAnchorRef),Te.addUniqueObserverToNode(this.selectionAnchorRef,Se,(()=>{this.destroy()}))),this.selectionAnchorRef.style.left=`${r}px`,this.selectionAnchorRef.style.top=`${o}px`,this.selectionAnchorRef.style.width=`${c}px`,this.selectionAnchorRef.style.height=`${h}px`,this.selectionAnchorRef}}}class as extends is{constructor(t){super(t),this.settingHandlers=[new Mt,new Wn,new jt,new Ht,new Dt],this.handleTableClick=(t,e,n)=>{const s=t.target.closest("table");s===n()&&(t.stopPropagation(),this.reTarget(e,n),this.tableDynamicPopover.hide(),Oe.call(Ae.getSubject(this.popoverRef,ke),s),this.popoverRef.show(!0))},this.syncSelectedCells=()=>{this.tableSettingRef&&(this.tableSettingRef.selectedCells=this.getTableSelectedCells())},this.hide=()=>{var t;this.tableDynamicPopover.hide(),null===(t=this.popoverRef)||void 0===t||t.hide()},this.openSettingToolbarForKeyboard=(t,e,n)=>{this.reTarget(t,e),this.tableDynamicPopover.hide(),Oe.call(Ae.getSubject(this.popoverRef,ke),e()),this.popoverRef.show(!0),this.focusFirstSettingButton(n)},this.focusFirstSettingButton=t=>{var e,n;this.beginReturnFocusTracking(t),null===(n=null===(e=this.getTableExtensionContext())||void 0===e?void 0:e.getSelection())||void 0===n||n.removeAllRanges(),this.setEditorContentInert(!0),setTimeout((()=>{var t,e,n;const s=Array.from(null!==(n=null===(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".rte-table-setting-item"))&&void 0!==n?n:[]).find((t=>!t.hasAttribute("disabled")));null==s||s.focus()}),0)},this.handleSettingMenuClick=t=>{const e=this.settingHandlers.find((e=>e.canHandle(t.detail)));if(e){const n=this.getTableExtensionContext();n&&e.execute(t.detail,n,this.tableBlock),t.detail[0]===It.CAPTION&&(this.updateTableSettingCaption(),this.moveFocusToCaption())}if(t.detail[0]===It.TABLE||t.detail[0]===It.CELL){const e=this.returnFocusCell;this.popoverRef.hide(),this.tableDynamicPopover.show(t.detail[0],e)}},this.handleTableSettingPopoverShow=()=>{this.syncSelectedCells(),this.labelSettingDialog()},this.handleTableSettingPopoverHide=()=>{this.setEditorContentInert(!1),this.restoreFocusOnEscapeHide()},this.tableDynamicPopover=new rs(_t.getTableColors(),t)}destroy(){this.tableDynamicPopover.destroy(),this.setEditorContentInert(!1),this.detachEscapeTracker(),this.popoverContainer&&this.popoverContainer.remove()}render(){const t=He();if(t&&this.renderContext){this.popoverContainer=t.createElement("div"),this.renderContext.host.appendChild(this.popoverContainer);const e=this.tableDynamicPopover.render(),n=t.createElement("vega-popover");n.trigger="click",n.isScreenPosition=!0,n.className="rte-table-setting-popover",Te.addUniqueObserverToNode(n,Ne,this.handleTableSettingPopoverShow),Te.addUniqueObserverToNode(n,Be,this.handleTableSettingPopoverHide),this.attachEscapeTracker(t);const s=t.createElement("div");s.setAttribute("slot","popover");const i=t.createElement("vega-rich-text-table-setting");i.addEventListener("vegaClick",this.handleSettingMenuClick),s.appendChild(i),n.appendChild(s),this.popoverContainer.appendChild(n),this.popoverContainer.appendChild(e),this.popoverRef=n,this.tableSettingRef=i}}isEventWithinPopover(t){return!!this.tableSettingRef&&t.composedPath().includes(this.tableSettingRef)}getInertContentTarget(){var t,e,n;return null!==(n=null===(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.target)||void 0===e?void 0:e.closest(".rich-text-content"))&&void 0!==n?n:null}updateTableSettingCaption(){const t=this.tableBlock.hasCaption();this.tableSettingRef&&this.tableSettingRef.hasCaption!==t&&(this.tableSettingRef.hasCaption=t)}moveFocusToCaption(){this.tableBlock.hasCaption()&&(this.setEditorContentInert(!1),setTimeout((()=>{var t,e,n,s,i,r,a;const o=null!==(n=null===(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.target)||void 0===e?void 0:e.querySelector("caption"))&&void 0!==n?n:null;if(!o)return;o.focus();const l=null!==(a=null!==(i=null===(s=this.getTableExtensionContext())||void 0===s?void 0:s.getSelection())&&void 0!==i?i:null===(r=o.ownerDocument)||void 0===r?void 0:r.getSelection())&&void 0!==a?a:null;if(l){const t=new Range;t.selectNodeContents(o),t.collapse(!1),l.removeAllRanges(),l.addRange(t)}}),0))}reTarget(t,e){this.tableSettingRef&&(this.tableBlock=t,this.tableSettingRef.target=e(),this.tableSettingRef.selectedCells=this.getTableSelectedCells(),this.tableDynamicPopover.reTarget(t,e))}labelSettingDialog(){var t,e;const n=null!==(e=null===(t=this.tableSettingRef)||void 0===t?void 0:t.closest("vega-popover-content-box"))&&void 0!==e?e:null;n&&(n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-label","Table tools"))}getTableSelectedCells(){let t=[];const e=this.getTableExtensionContext();if(e&&e.tableSelection){const{tableSelection:n}=e;t=n.getSelectedCells()}return t}}class os extends gt{doRender(t,e,n){let s;const i=this.renderTable(t,e,(t=>s=t),n);this.renderTableToolbar(n);const r=e.getAnnotationByType(kt.TABLE),a=n.editable?[t("vega-rich-text-table-selection-widget",{onVegaRemove:t=>{t.stopPropagation(),this.handleTableRemove(e,s)},onClick:t=>{this.tableToolbar&&this.tableToolbar.handleTableClick(t,e,(()=>s))},onMouseLeave:()=>{this.tableToolbar&&this.tableToolbar.syncSelectedCells()}},[t("div",{class:"v-rte--extension-table-widget",contentEditable:!1,ref:this.useRef(e)},[i])])]:[i],o={};if(r){const t=r.renderStyle();o.width=t.width,o.margin=t.margin}const l=t("div",{class:"v-rte--extension-table-container",role:"presentation",style:Object.assign({},o)},a);return l.childrenContainerGetter=()=>i,l}destroy(){this.destroyTableToolbar()}injectRTEScopeStyles(){return".v-rte--extension-table-container{display:table}table.v-rte--extension-table{border-collapse:collapse}table.v-rte--extension-table th,table.v-rte--extension-table td{border:1px solid #ddd;padding:12px;text-align:left;vertical-align:middle;min-width:55px;box-sizing:border-box;position:relative}table.v-rte--extension-table th:focus,table.v-rte--extension-table td:focus{outline:none}table.v-rte--extension-table th{background-color:#f2f2f2}.rte-table-setting-popover,.rte-table-dynamic-popover{display:block}table.v-rte--extension-table .v-rte-table-cell-focused::after,table.v-rte--extension-table .v-rte-table-cell-selected::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-color:rgba(158, 207, 250, 0.3)}table.v-rte--extension-table:has(.v-rte-table-cell-selected){caret-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::selection{background-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::-moz-selection{background-color:transparent}.v-rte--extension-table-caption{padding:8px;border:1px solid #ddd;border-bottom:none;background-color:rgba(var(--v-bg-table-header, 240, 243, 247, 1));position:relative;display:table-caption;caption-side:top;min-height:22px;text-align:center;word-break:break-word;overflow-wrap:break-word}.v-rte--extension-table-caption.showPlaceholder::before{position:absolute;left:0;right:0;content:attr(data-placeholder);font-family:'Inter', sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1));text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"}renderTable(t,e,n,s){var i;const r=!!s.editable;return t("table",Object.assign(Object.assign(Object.assign(Object.assign({key:e.id},null===(i=e.getCustomAttributesAnnotation())||void 0===i?void 0:i.render()),{style:e.getStyles(),class:e.getClasses()}),r?{onClick:t=>this.handleTableActivate(t,s),onKeyDown:t=>this.handleTableKeyDown(t,s,e)}:void 0),{ref:t=>{this.useRef(e)(t),n(t)}}))}handleTableActivate(t,e){t.target===t.currentTarget&&this.focusFirstCell(t.currentTarget,e)}handleTableKeyDown(t,e,n){var s,i;if(t.altKey&&"F10"===t.key){t.preventDefault(),t.stopPropagation();const e=t.currentTarget,i=t.target,r=i?i.closest("td, th"):null;return void(null===(s=this.tableToolbar)||void 0===s||s.openSettingToolbarForKeyboard(n,(()=>e),r))}if("Escape"!==t.key)return;const r=t.currentTarget,a=t.target,o=a?a.closest("td, th"):null;o&&r.contains(o)&&(t.preventDefault(),t.stopPropagation(),this.focusTable(r,e),null===(i=this.tableToolbar)||void 0===i||i.hide())}focusFirstCell(t,e){const n=t.querySelector("td, th");if(!n)return;n.focus();const s=this.getSelection(e,t);if(s){const t=new Range;t.setStart(n,0),t.setEnd(n,0),s.removeAllRanges(),s.addRange(t)}}focusTable(t,e){var n;const s=this.getSelection(e,t);null==s||s.removeAllRanges();const i=this.getExtensionContext(e.host);null===(n=null==i?void 0:i.tableSelection)||void 0===n||n.setSelectedCells([]),t.setAttribute("tabindex","-1");const r=()=>{t.removeAttribute("tabindex"),t.removeEventListener("blur",r)};t.addEventListener("blur",r),t.focus()}getSelection(t,e){const n=this.getExtensionContext(t.host);return n?n.getSelection():e.ownerDocument?e.ownerDocument.getSelection():null}handleTableRemove(t,e){t.apply(new $n(t)),this.destroySelectionAnchor(e)}destroySelectionAnchor(t){const e=t.closest(".rich-text-content");if(e){const t=e.querySelector(".rte-table-selection-popover-anchor");t&&Le.notify(Ae.getSubject(t,Se),{host:t})}}renderTableToolbar(t){t.editable?this.tableToolbar||(this.tableToolbar=new as(t),this.tableToolbar.render()):this.destroyTableToolbar()}destroyTableToolbar(){var t;null===(t=this.tableToolbar)||void 0===t||t.destroy(),this.tableToolbar=null}}os.typeName="RTETableBlockRenderer";class ls extends gt{doRender(t,e){return t("thead",{key:e.id,ref:this.useRef(e)})}}ls.typeName="RTETableHeadRenderer";class cs extends gt{doRender(t,e){return t("tr",{key:e.id,ref:this.useRef(e)})}}cs.typeName="RTETableRowBlockRenderer";class hs extends gt{doRender(t,e,n){return this.renderByCellType(t,e,n,"td")}renderByCellType(t,e,n,s){var i;return t(s,Object.assign(Object.assign(Object.assign(Object.assign({key:`${e.id}-${s}`,ref:this.useRef(e)},n.editable?{contentEditable:!0,tabindex:-1}:void 0),null===(i=e.getCustomAttributesAnnotation())||void 0===i?void 0:i.render()),{style:e.getStyles(n),class:e.getClasses()}),n.editable?this.onSelectionListeners(e,n):void 0))}onSelectionListeners(t,e){return{onMouseDown:t=>{const n=i(t.target,"table"),s=i(t.currentTarget,"table")===n,r=t.target.closest("td, th");if(s&&r){const t=this.getExtensionContext(e.host);t&&t.tableSelection.focusCell(r)}},onMouseMove:n=>{n.stopPropagation(),n.preventDefault();const s=this.getExtensionContext(e.host);s&&s.tableSelection.dragOver(t)},onMouseUp:()=>{const t=this.getExtensionContext(e.host);t&&t.tableSelection.endDrag()}}}}hs.typeName="RTETableCellRenderer";class ds extends gt{doRender(t,e){return t("tbody",{key:e.id,ref:this.useRef(e)})}}ds.typeName="RTETableBodyRenderer";class us extends hs{doRender(t,e,n){return super.renderByCellType(t,e,n,"th")}}us.typeName="RTETableHeadCellRenderer";class ps extends v{constructor(t,e){super(),this.type="INSERT_TABLE_BLOCK",this.rowCount=t,this.columnCount=e}}class fs extends is{constructor(){super(...arguments),this.hoveredRows=1,this.hoveredCols=1}render(t,e){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,isScreenPosition:!0,ref:t=>{t&&(this.tablePickerPopoverRef=t,Te.addUniqueObserverToNode(t,Ne,(()=>{this.resetPicker()})))}},[t("div",{slot:"popover"},[this.generatePickerStyles(t),this.generateTableSizeGrid(t)]),t("div",{slot:"popover-content"},e)])}generateTableSizeGrid(t){const e=[];for(let n=1;n<=10;n++)for(let s=1;s<=10;s++)e.push(t("button",{class:"rte-table-picker__cell","data-row":n,"data-col":s,onMouseenter:this.handlePickerCellHover.bind(this,n,s),onClick:this.handlePickerClick.bind(this,n,s)},[]));return t("div",{class:"rte-table-picker"},[t("div",{class:"rte-table-picker__grid",ref:t=>{t&&(this.tablePickerGridRef=t)},style:{gridTemplateColumns:"repeat(10, 16px)",gridTemplateRows:"repeat(10, 16px)"}},e),t("div",{class:"rte-table-picker__hint"},t("vega-hint",{ref:t=>{t&&(this.selectedHintRef=t)}},[`${this.hoveredRows} × ${this.hoveredCols}`]))])}generatePickerStyles(t){return t("style",{},["\n.rte-table-picker__grid { display: grid; gap: 2px; }\n.rte-table-picker__cell {\n box-sizing: border-box;\n border: 1px solid #ccc;\n background-color: transparent;\n cursor: pointer;\n}\n.rte-table-picker__cell:hover {\n background-color: #cae1fc;\n}\n.rte-table-picker__cell.active {\n background-color: #cae1fc;\n}\n.rte-table-picker__hint {\n text-align: center;\n}\n "])}createTable(t,e){const n=this.getTableExtensionContext();if(n){const{host:s,getSelectedNodes:i}=n,r=i()[0],a=new ps(t,e);r?r.parent&&r.parent.apply(a):s.value.apply(a),a.nextFocusNode&&s.value.apply(new et(a.nextFocusNode,1))}}handlePickerClick(t,e){this.createTable(t,e),this.tablePickerPopoverRef.hide()}handlePickerCellHover(t,e){this.hoveredRows=t,this.hoveredCols=e,Array.from(this.tablePickerGridRef.children).forEach((t=>{const e=Number(t.dataset.row),n=Number(t.dataset.col);e<=this.hoveredRows&&n<=this.hoveredCols?t.classList.add("active"):t.classList.remove("active")})),this.selectedHintRef.textContent=`${this.hoveredRows} × ${this.hoveredCols}`}resetPicker(){this.handlePickerCellHover(1,1)}}class gs extends xt{render(t,e){return new fs(e).render(t,super.renderButton(t,e,{showArrowIcon:!0,icon:"rte-table",ariaLabel:"Table",tooltip:{text:"Insert table"}}))}isDisabled(t){let e=super.isDisabled(t);const n=this.getExtensionContext(t.host);if(n){const{host:t,getSelectedNodes:s}=n,i=s()[0];let r=!0;i&&(r=b.canHandle("INSERT_TABLE_BLOCK",i.parent)&&b.canHandle(M.INSERT_CHILDREN_AFTER,i.parent.parent)),e=t.disabled||!r}return e}handleButtonClick(){}handleDropdownClick(){}}vt.register({"rte-table":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M48 264V160H232V264H48zm0 48H232V432H64c-8.8 0-16-7.2-16-16V312zM280 432V312H464V416c0 8.8-7.2 16-16 16H280zM464 264H280V160H464V264zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"/></svg>'}});class ws extends O{handleAction(t,e){const n=this.createTableBlock(t.rowCount,t.columnCount),s=super.createNewParagraph(""),i=this.getReferenceBlock(e);i?i.parent.apply(new I(i,n,s)):e.apply(new R([n,s])),t.nextFocusNode=n.getFirstNode()}createTableBlock(e,n){const s=Math.max(e,1),i=Math.max(n,1);return Pt.from({id:t(),type:"table-block",children:[Vt(s,i)]})}getReferenceBlock(t){if(!(t instanceof nt))return t}}class ms extends Ct{canIntercept(t,e){const n=e.parent;return n instanceof $t&&1===n.children.length&&0===t.startOffset}intercept(){}}class vs extends O{handleAction(t){const e=t.tableBlock,n=e.parent,s=super.getRootContent(e),i=super.createNewParagraph("");n.apply(new I(e,i)),n.apply(new D(e)),s&&s.apply(new et(i.getLastNode()))}}class bs extends Ct{canIntercept(t,e){return t.entityToBeRemoved&&1===e.children.length}intercept(e,n,s){if(!(n.entityToBeRemoved instanceof A)){const e=A.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]});return s.children=[],void s.apply(new R([e]))}n.entityToBeRemoved.apply(new R([new y(t(),"",n.entityToBeRemoved)]))}}class ys extends gt{doRender(t,e,n){return t("caption",Object.assign(Object.assign({key:e.id,ref:this.useRef(e)},n.editable?{contentEditable:!0}:void 0),{style:e.getStyles(),class:[e.getClasses(),e.isNotEmpty()?null:"showPlaceholder"].filter(bt).join(" "),"data-placeholder":"Enter table caption"}))}}ys.typeName="RTETableCaptionRenderer";class xs extends O{getRowsMaxCellCount(t){let e=0;for(const n of t){let t=0;for(const e of n.children)t+=e.colSpan;e=Math.max(e,t)}return e}getRowCellStartCols(t){const e=this.getRowsMaxCellCount(t),n=new Array(t.length),s=new Array(e).fill(0);for(let e=0;e<t.length;e++){const i=t[e].children,r=new Array(i.length);let a=0;for(let t=0;t<i.length;t++){const e=i[t];for(;a<s.length&&s[a]>0;)a++;r[t]=a;const n=Math.max(e.colSpan,xs.DEFAULT_CELLSPAN);if(e.rowSpan>xs.DEFAULT_CELLSPAN)for(let t=0;t<n;t++){const n=a+t;n<s.length&&(s[n]=Math.max(s[n],e.rowSpan))}a+=n}n[e]=r;for(let t=0;t<s.length;t++)s[t]>0&&s[t]--}return n}updateCellSpan(t,e,n){const s=t.getCustomAttributesAnnotation();if(n<=xs.DEFAULT_CELLSPAN){if(s){const n=s.render();delete n[e],t.annotationMap.set(_.CUSTOM_ATTRIBUTE,new P(n))}}else{const i=s?s.render():{};i[e]=n.toString(),t.annotationMap.set(_.CUSTOM_ATTRIBUTE,new P(i))}}insertMovedCells(t,e,n){t.forEach(((t,s)=>{const i=e[s];if(i){const e=n[s]||[];t.sort(((t,e)=>t.logicalStartCol===e.logicalStartCol?e.cellIndex-t.cellIndex:e.logicalStartCol-t.logicalStartCol)),t.forEach((t=>{const{cell:n,logicalStartCol:s}=t;if(0===i.children.length)return i.apply(new R([n])),void(e[0]=s);const r=e.findIndex((t=>t>=s));-1===r?(i.apply(new I(i.children[i.children.length-1],n)),e.push(s)):0===r?(i.apply(new B(i.children[0],n)),e.unshift(s)):(i.apply(new B(i.children[r],n)),e.splice(r,0,s))}))}}))}splitRowsBySection(t){const e=[],n=[];return t.forEach((t=>{t.parent instanceof Ft?e.push(t):n.push(t)})),[e,n]}buildSelectedIndices(t,e){return new Set(t.map((t=>e.indexOf(t))).filter((t=>t>=0)))}intersectsRemovalRange(t,e,n,s){return t<=s&&e>=n}countRemovedRows(t,e,n){let s=0;for(let i=t;i<=e;i++)n.has(i)&&s++;return s}getHeadCellLength(t){let e=0;for(let n=0;n<t.children.length;n++){const s=t.children[n];if(!(s instanceof Nt))break;e+=s.colSpan}return e}getTheStartSpanCell(t,e,n,s){const i={rowIndex:n};for(let r=n;r>=0;r--){const n=e[r];if(n.includes(s)){i.cell=t[r].children[n.indexOf(s)],i.rowIndex=r;break}}return i}getDefaultCellBlockTemplate(e,n,s=1){const i=_e({colspan:n>1?n.toString():null,rowspan:s>1?s.toString():null}),r=t(),a={id:r,type:e,children:[{id:`${r}-p`,type:"paragraph",nodes:[{id:`${r}-p-t`,type:"text",text:""}]}]};return Object.keys(i).length>0&&(a.annotations={customAttribute:i}),a}getSortedValuesByNumericKey(t){return Array.from(t.entries()).sort((([t],[e])=>t-e)).map((([,t])=>t))}}xs.DEFAULT_CELLSPAN=1;class Cs extends xs{handleAction(t,e){const{rowsToBeRemoved:n}=t,s=this.getFutureFocusRow(n[0],n[n.length-1],e),i=this.splitRowsBySection(n);if(this.removeRows(i[0]),this.removeRows(i[1]),s){const t=this.getRootContent(e);if(t){const e=s.getLastNode();t.apply(new et(e,e.getRangeEndOffset()))}}}removeRows(t){if(0===t.length)return;const e=t[0].parent,n=e.children,s=this.buildSelectedIndices(t,n);if(s.size>0){if(n.length===t.length)return void e.parent.apply(new D(e));const i=Math.min(...s),r=Math.max(...s),a=this.getRowCellStartCols(n),o=this.collectCellsToMove(n,a,s,i,r);this.insertMovedCells(o,n,a),t.forEach((t=>{t.parent.apply(new D(t))}))}}collectCellsToMove(t,e,n,s,i){const r=new Map,a=t.length;for(let o=0;o<a;o++){const l=t[o],c=l.children.length;for(let t=0;t<c;t++){const c=l.children[t],h=c.rowSpan;if(h<=xs.DEFAULT_CELLSPAN)continue;const d=o+h-1;if(!this.intersectsRemovalRange(o,d,s,i))continue;const u=h-this.countRemovedRows(o,d,n);if(o<s&&d>=s)this.updateCellSpan(c,"rowspan",u);else if(o>=s&&d>i){const s=i+1;if(s<a&&!n.has(s)){const n=e[o][t];r.has(s)||r.set(s,[]),r.get(s).push({cell:this.cloneCellWithRowSpan(c,u),newRowSpan:u,cellIndex:t,logicalStartCol:n})}}}}return r}cloneCellWithRowSpan(t,e){const n=t.clone(t.parent);return this.updateCellSpan(n,"rowspan",e),n}getFutureFocusRow(t,e,n){const s=n.children.filter((t=>t instanceof Ft||t instanceof zt)).flatMap((t=>t.children)),i=s.indexOf(t),r=s.indexOf(e);return s[i-1]?s[i-1]:s[r+1]?s[r+1]:void 0}}class Ls{constructor(){this.dragging=!1,this.anchorCell=null,this.selectedCells=new Set,this.syncRTESelectionWithDebounce=Pe(this.syncRTESelection,100,this),this.handleSelectionChangeWithDebounce=Pe(this.handleSelectionChange,10,this),this.filterSelectedCell=(t,e)=>{const n=new Set;if(t.intersectsNode(e)){if(e.nodeType===Node.TEXT_NODE){const t=L.getEntityByDOM(e.parentElement);if(t){const e=Kt(t.parent,$t);if(e)return n.add(e),Array.from(n)}}e.childNodes.forEach((e=>this.filterSelectedCell(t,e).forEach((t=>{n.add(t)}))))}return Array.from(n)},this.updateSelectedStyles=(t,e)=>{const n=1===e?"v-rte-table-cell-focused":"v-rte-table-cell-selected",s=L.getDOMByEntity(t);s&&s.classList.add(n)},this.handleDocMouseUp=()=>{this.endDrag();const t=He();t&&t.removeEventListener("mouseup",this.handleDocMouseUp)},this.handleContentClick=()=>{this.clearSelection();const t=this.context.host.shadowRoot.querySelector(".rich-text-editor-container");t&&t.removeEventListener("mousedown",this.handleContentClick,!0)}}static computeRectRange(t,e){const n=t.parent.parent.parent;if(n!==e.parent.parent.parent)return[];const s=[];n.children.forEach((t=>{t.children.forEach((t=>s.push(t)))}));const{grid:i,cellMeta:r}=Ls.buildCellGrid(s),a=r.get(t),o=r.get(e);if(!a||!o)return[];const l=a.row+a.rowSpan-1,c=a.col,h=a.col+a.colSpan-1,d=o.row+o.rowSpan-1,u=o.col,p=o.col+o.colSpan-1,f=Math.min(a.row,o.row),g=Math.max(l,d),w=Math.min(c,u),m=Math.max(h,p),v=new Set;for(let t=f;t<=g;t++){const e=i[t];for(let t=w;t<=m;t++){const n=e[t];n&&v.add(n)}}return Array.from(v)}static getCellSpan(t){let e=1,n=1;const s=t.getAnnotationByType(_.CUSTOM_ATTRIBUTE);if(s&&s.customAttribute){const t=s.customAttribute;t.rowSpan&&(e=parseInt(t.rowSpan,10)),t.colSpan&&(n=parseInt(t.colSpan,10))}if(1===e&&1===n){const s=L.getDOMByEntity(t);if(s){const t=s.getAttribute("rowSpan"),i=s.getAttribute("colSpan");t&&(e=parseInt(t,10)),i&&(n=parseInt(i,10))}}return{rowSpan:Number.isFinite(e)&&e>0?e:1,colSpan:Number.isFinite(n)&&n>0?n:1}}static buildCellGrid(t){const e=[],n=new Map;for(let s=0;s<t.length;s++){const i=t[s];e[s]||(e[s]=[]);let r=0;for(let t=0;t<i.children.length;t++){const a=i.children[t];for(;e[s][r];)r+=1;const{rowSpan:o,colSpan:l}=Ls.getCellSpan(a);n.set(a,{row:s,col:r,rowSpan:o,colSpan:l});for(let t=0;t<o;t++){const n=s+t;e[n]||(e[n]=[]);for(let t=0;t<l;t++)e[n][r+t]=a}r+=l}}return{grid:e,cellMeta:n}}destroy(){this.removeSelectionChangeListener()}init(t){this.context=t,this.addSelectionChangeListener()}setSelectedCells(t){const e=Array.from(this.selectedCells)[0]||t[0];this.updateSelectedCells(t),this.emitCellSelectionChange(e,t)}getSelectedCells(){return Array.from(this.selectedCells)}focusCell(t){const e=L.getEntityByDOM(t);e&&(this.anchorCell=e,this.setSelectedCells([e]),this.addListeners())}dragOver(t){if(!this.anchorCell)return;const e=Ls.computeRectRange(this.anchorCell,t);e.length>1&&this.startDrag(),this.dragging&&(this.preventTextSelection(e),this.updateSelectedCells(e,{debounceSync:!0}))}endDrag(){this.dragging=!1,this.anchorCell=null}emitCellSelectionChange(t,e){const n=Kt(t,Pt);if(n){const t=L.getDOMByEntity(n);t&&Le.notify(Ae.getSubject(t,Ee),{host:t,detail:e})}}clearSelection(){this.selectedCells.forEach((t=>{const e=L.getDOMByEntity(t);e&&e.classList.remove("v-rte-table-cell-selected","v-rte-table-cell-focused")})),this.selectedCells.clear()}addSelectionChangeListener(){const t=He();t&&t.addEventListener("selectionchange",this.handleSelectionChangeWithDebounce)}removeSelectionChangeListener(){const t=He();t&&t.removeEventListener("selectionchange",this.handleSelectionChangeWithDebounce)}handleSelectionChange(){if(this.dragging)return void this.syncRTESelectionWithDebounce();const t=this.context.getSelection();if(t.rangeCount>0){const e=t.getRangeAt(0),n=e.commonAncestorContainer;if(i(n,"table")){let t=this.filterSelectedCell(e,n);0===t.length&&(t=this.resolveCaretCell(n)),this.setSelectedCells(t)}}}resolveCaretCell(t){var e;const n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,s=null!==(e=null==n?void 0:n.closest("td, th"))&&void 0!==e?e:null;if(!s)return[];const i=L.getEntityByDOM(s);return i?[i]:[]}startDrag(){this.dragging=!0}updateSelectedCells(t,{debounceSync:e}={}){this.clearSelection(),t.forEach((e=>{this.selectedCells.add(e),this.updateSelectedStyles(e,t.length)})),e?this.syncRTESelectionWithDebounce():this.syncRTESelection()}syncRTESelection(){const t=Array.from(this.selectedCells),e=t.flatMap((t=>t.children.flatMap((t=>t.children.flatMap((t=>{if(t instanceof C)return t})))))).filter(bt);t.length>1&&this.context.setSelectedNodes(e,{startNode:e[0],endNode:e[e.length-1],startOffset:0,endOffset:e[e.length-1].getRangeEndOffset()})}preventTextSelection(t){const e=this.context.getSelection();if(e.removeAllRanges(),t.length>0){const n=L.getDOMByEntity(t[0]);if(n){const t=new Range;t.setStart(n,0),t.setEnd(n,0),e.addRange(t)}}}addListeners(){const t=He();t&&t.addEventListener("mouseup",this.handleDocMouseUp);const e=this.context.host.shadowRoot.querySelector(".rich-text-editor-container");e&&e.addEventListener("mousedown",this.handleContentClick,!0)}}class Ts extends xs{handleAction(t,e){const{selectedRows:n}=t,[s,i]=this.splitRowsBySection(n);i.length>0?this.convertToHeaderRows(i,e):this.revertToBodyRows(s,e);const r=this.getRootContent(e);if(r){const t=n[0].getFirstNode();t&&r.apply(new et(t,0))}}convertToHeaderRows(e,n){let s=n.children.find((t=>t instanceof Ft));const i=e[0].parent;s||(s=Ft.from({id:t(),type:"table-head",children:[]}),n.apply(new B(i,s)));const r=i.children.indexOf(e[e.length-1]),a=i.children.slice(0,r+1),o=this.buildSelectedIndices(a,i.children),l=Math.min(...o),c=Math.max(...o);if(o.size>0){if(o.size<i.children.length){const t=this.getRowCellStartCols(i.children),e=this.collectCellsToMove(i.children,t,o,l,c);this.insertMovedCells(e,i.children,t)}this.convertBodyRowsToHeaderRows(i,s,a)}}convertBodyRowsToHeaderRows(t,e,n){for(let e=0;e<n.length;e++){const s=n[e];s.children=s.children.map((t=>this.convertTdToTh(t))),t.apply(new D(s))}e.apply(new R(n))}revertToBodyRows(e,n){let s=n.children.find((t=>t instanceof zt));const i=e[0].parent;s||(s=zt.from({id:t(),type:"table-body",children:[]}),n.apply(new I(i,s)));const r=i.children.indexOf(e[0]),a=i.children.slice(r),o=this.buildSelectedIndices(a,i.children);if(o.size>0){const t=this.getRowCellStartCols(i.children),e=this.collectCellsToMove(i.children,t,o,Math.min(...o),Math.max(...o));this.insertMovedCells(e,i.children,t),this.convertHeadRowsToBodyRows(i,s,a)}}convertHeadRowsToBodyRows(t,e,n){const s=e.children[0],i=this.getRowCellStartCols(n);for(let r=0;r<n.length;r++){const a=n[r];t.apply(new D(a));const o=s?this.getHeadCellLength(s):0;a.children=this.convertThToTd(a,i[r],o),s&&e.apply(new B(s,a))}s||e.apply(new R(n))}collectCellsToMove(t,e,n,s,i){const r=new Map,a=t.length;for(let o=0;o<a;o++){const l=t[o],c=l.children.length;for(let t=0;t<c;t++){const c=l.children[t],h=c.rowSpan;if(h<=xs.DEFAULT_CELLSPAN)continue;const d=o+h-1;if(!this.intersectsRemovalRange(o,d,s,i))continue;const u=this.countRemovedRows(o,d,n),p=h-u;if(o<s&&d>=s){this.updateCellSpan(c,"rowspan",p);const i=s;if(i<a&&n.has(i)){const n=e[o][t];r.has(i)||r.set(i,[]),r.get(i).push({cell:this.cloneCellWithRowSpan(c,u),newRowSpan:u,cellIndex:t,logicalStartCol:n})}}else if(o>=s&&d>i){this.updateCellSpan(c,"rowspan",u);const s=i+1;if(s<a&&!n.has(s)){const n=e[o][t];r.has(s)||r.set(s,[]),r.get(s).push({cell:this.cloneCellWithRowSpan(c,p),newRowSpan:p,cellIndex:t,logicalStartCol:n})}}}}return r}convertTdToTh(t){if(t instanceof Nt)return t;const e=Nt.from(t.toJSON());return e.parent=t.parent,e}convertThToTd(t,e,n){return t.children.map(((s,i)=>{let r=s;const a=e[i]<n,o=s.toJSON();return r=a?s:$t.from(this.deleteHeadCellDefaultBackground(o)),r.parent=t,r}))}cloneCellWithRowSpan(e,n){const s=e.clone(e.parent);s.id=t(),s.children=[];const i=this.createNewParagraph("");return i&&s.apply(new R([i])),this.updateCellSpan(s,"rowspan",n),s}deleteHeadCellDefaultBackground(t){var e;if(t&&t.annotations&&t.annotations.customStyle){delete t.annotations.tableCell;const n=t.annotations.customStyle.backgroundColor,s=Wt.getDefaultBackgroundColor();!n||n!==s&&(null===(e=r(n))||void 0===e?void 0:e.toUpperCase())!==s||delete t.annotations.customStyle.backgroundColor}return t}}class As extends qt{handleAction(t,e){const{insertDirection:n,tableCellInsertRange:s}=t,i=new Set(s.map((t=>t.id))),r=Ut(e),a=Gt(r),[o,l]=this.getBoundaryCellColumnRange(s,r,a),c=n===Yt.LEFT?o:l+1,h=this.hasSelectedCellInsideTargetColumn(r,a,c,i),d=new Set;r.forEach(((t,s)=>{if(d.has(s))return;const o=this.findExpandableCell(t,s,c,a,n,i,h);if(o){const t=o.rowSpan;if(Zt(o,o.colSpan+1,o.rowSpan,e,!0),t>1)for(let e=1;e<t;e++)d.add(s+e);return}const l=this.findInsertPosition(t,s,c,a,r);if(l){const e=this.generateTableCell(l.templateCell);t.apply(l.before?new B(l.anchorCell,e):new I(l.anchorCell,e))}}))}findExpandableCell(t,e,n,s,i,r,a){const o=s[e],l=t.children.reduce(((t,e)=>t+(r.has(e.id)?1:0)),0);for(const c of t.children){const t=o.indexOf(c.id),h=t+c.colSpan,d=n===h,u=e+c.rowSpan>=s.length,p=r.has(c.id),f=n>t&&n<h;if(i===Yt.LEFT?f:f&&(!p||!u)||d&&c.colSpan>1&&p&&!u&&1===l&&!a)return c}return null}hasSelectedCellInsideTargetColumn(t,e,n,s){for(let i=0;i<t.length;i++){const r=t[i],a=e[i];for(const t of r.children){if(!s.has(t.id))continue;const e=a.indexOf(t.id),i=e+t.colSpan;if(n>e&&n<i)return!0}}return!1}findInsertPosition(t,e,n,s,i){const r=s[e];let a=t.children[0];if(n>=0&&n<r.length){const t=Qt(i,r[n]);t&&(a=t)}let o=0;for(let e=0;e<t.children.length;e++){const s=t.children[e];for(;o<r.length&&r[o]!==s.id;)o++;if(o>=n)return{anchorCell:s,templateCell:a,before:!0};const i=o+s.colSpan;if(i>n||e===t.children.length-1)return{anchorCell:s,templateCell:a,before:!1};o=i}return null}generateTableCell(t){return t instanceof Nt?Nt.from(Jt(t.type)):$t.from(Jt(t.type))}}class Ss extends qt{handleAction(t,e){const n=Ut(e),s=Gt(n),[i,r]=this.getBoundaryCellColumnRange(t.tableCellDeleteRange,n,s),a=Math.max(n.indexOf(t.tableCellDeleteRange[t.tableCellDeleteRange.length-1].parent),0),{coveredCellIds:o,coveredCells:l,adjustmentCellInfo:c}=this.getDeleteCellsInfo(n,i,r,s),h=this.findNextFocusableCell(n,s,i,r,o,a);this.deleteCells(l,c,e);const d=this.getRootContent(e),u=ee(h);d&&u&&d.apply(new et(u))}getDeleteCellsInfo(t,e,n,s){const i=[],r=new Set,a=[],o=Xt(s);return t.forEach((t=>{t.children.forEach((t=>{const s=o.get(t.id);if(void 0===s)return;const{colSpan:l,rowSpan:c}=ne(t),h=this.getColumnOverlapCount(s,l,e,n);if(h<=0)return;if(h===l)return i.push(t),void r.add(t.id);const d=Math.max(1,l-h);a.push({cell:t,nextColSpan:d,rowSpan:c})}))})),{coveredCells:i,coveredCellIds:r,adjustmentCellInfo:a}}findNextFocusableCell(t,e,n,s,i,r){for(let a=0;a<t.length;a++){const o=this.findFocusableCellIdInGridRow(e[(r+a)%t.length],n,s,i);if(!o)continue;const l=Qt(t,o);if(l)return l}return null}findFocusableCellIdInGridRow(t,e,n,s){for(let e=n+1;e<t.length;e++){const n=t[e];if(n&&!s.has(n))return n}for(let n=e-1;n>=0;n--){const e=t[n];if(e&&!s.has(e))return e}return null}deleteCells(t,e,n){t.forEach((t=>{t.parent.apply(new D(t))}));const s=new Set;e.forEach((({cell:t,nextColSpan:e,rowSpan:i})=>{s.add(t.id),Zt(t,e,i,n)})),this.normalizeRemainingCellSpans(n,s)}normalizeRemainingCellSpans(t,e){Ut(t).forEach((n=>{n.children.forEach((n=>{const{colSpan:s,rowSpan:i}=ne(n);if(e.has(n.id)){const e=te(t);if(!(i>1&&s===e))return}Zt(n,s,i,t)}))}))}getColumnOverlapCount(t,e,n,s){const i=t+e-1,r=Math.max(t,n),a=Math.min(i,s);return r<=a?a-r+1:0}}class ks extends v{constructor(t){super(),this.isFlushable=!0,this.type="CREATE_SEGMENT_TABLE_CELL",this.payload=t}}class Es extends O{handleAction(t,e){const{table:n,sourceCell:s,colSpan:i,cellType:r,keepSourceContent:a}=t.payload,o=a?this.convertCellType(s,r):se(r);Zt(o,i,s.rowSpan,n),e.apply(new B(s,o))}convertCellType(t,e){return"table-head-cell"===e?Nt.from(t.toJSON()):$t.from(t.toJSON())}}class Os extends O{handleAction(t,e){const{cell:n,targetCellType:s}=t.payload,i="table-head-cell"===s?Nt.from(n.toJSON()):$t.from(n.toJSON());e.apply(new B(n,i)),e.apply(new D(n))}}class Is extends O{handleAction(t,e){const{table:n,cell:s,col:i,cellStartCol:r,endCol:a,targetCellType:o}=t.payload,l=r+s.colSpan-1,c=i>r?i-r:0,h=Math.min(a,l),d=h-i+1,u=l-h;c>0&&e.apply(new ks({table:n,sourceCell:s,colSpan:c,cellType:s.type,keepSourceContent:!0})),e.apply(new ks({table:n,sourceCell:s,colSpan:d,cellType:o,keepSourceContent:0===c})),u>0&&e.apply(new ks({table:n,sourceCell:s,colSpan:u,cellType:s.type,keepSourceContent:0===c&&d===s.colSpan})),e.apply(new D(s))}}class Rs extends qt{handleAction(t,e){const n=Ut(e),s=Gt(n),i=Xt(s),[r,a]=this.getBoundaryCellColumnRange(t.tableCellSelectRange,n,s),o=[],l=new Set;n.forEach((t=>{t.children.forEach((t=>{const e=i.get(t.id);void 0!==e&&e>=r&&e<=a&&!l.has(t.id)&&(l.add(t.id),o.push(t))}))})),t.selectCellCallback(o)}}class Bs extends Ct{canIntercept(t){return t.childrenToBeInserted.some((t=>!(t instanceof $t)))}intercept(){}}class Ns extends O{handleAction(t,e){const{targetCell:n,mergeCells:s,colSpan:i,rowSpan:r,direction:a}=t;this.mergeContentToTargetCell(n,s),Zt(n,i,r,e),this.deleteOtherSelectedCells(s,n),a!==ie.MERGE_CELL_LEFT&&a!==ie.MERGE_CELL_RIGHT&&r>1&&this.clearRowSpanIfUniformAcrossRow(n,e,r);const o=this.getRootContent(e),l=ee(n);o&&l&&o.apply(new et(l))}mergeContentToTargetCell(t,e){const n=e.flatMap((t=>t.children)),s=n.filter((t=>t.isNotEmpty()));t.children=(s.length>0?s:[n[0]]).map((e=>e.clone(t)))}deleteOtherSelectedCells(t,e){t.forEach((t=>{t!==e&&t.parent.apply(new D(t))}))}clearRowSpanIfUniformAcrossRow(t,e,n){const s=t.parent.parent.children,i=Gt(s),r=[];for(let e=0;e<i.length;e++)i[e].includes(t.id)&&r.push(e);if(r.length>1){const t=r[0],a=t+n-1,o=new Set;let l=Number.POSITIVE_INFINITY;for(let e=0;e<i[0].length;e++){let n=i[t][e],s=1,r=!1;for(let c=t+1;c<=a;c++)i[c][e]!==n?(s>1&&(r=!0,l=Math.min(l,s),o.add(n)),s=1,n=i[c][e]):s++;if(s<2&&!r){o.clear();break}s>1&&(l=Math.min(l,s),o.add(n))}o.size>0&&s.forEach((t=>{t.children.forEach((t=>{if(o.has(t.id)){const{rowSpan:n,colSpan:s}=ne(t);Zt(t,s,n-l+1,e)}}))}))}}}class Ms extends it{canHandle(t,e){const n=t[e];return n&&"TABLE"===n.tagName?1:0}handle(e,n){return Pt.from({id:t(),type:"table-block",annotations:rt.generate(Pt,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class js extends st{canHandle(t,e){const n=t[e];return n&&"THEAD"===n.tagName?1:0}handle(e,n){return Ft.from({id:t(),type:"table-head",annotations:rt.generate(Ft,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class Hs extends st{canHandle(t,e){const n=t[e];return n&&"TBODY"===n.tagName?1:0}handle(e,n){return zt.from({id:t(),type:"table-body",annotations:rt.generate(zt,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class Ds extends st{canHandle(t,e){const n=t[e];return n&&"TR"===n.tagName?1:0}handle(e,n){return re.from({id:t(),type:"table-row",annotations:rt.generate(re,e[0],n),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class _s extends st{canHandle(t,e){const n=t[e];return!n||"TD"!==n.tagName&&"TH"!==n.tagName?0:1}handle(e,n){const s=e[0],i=[{id:t(),type:"paragraph",annotations:{internalWrapper:n&&!n.autoMatchFormat},nodes:[{id:t(),type:"text",annotations:{plainText:n&&!n.autoMatchFormat},text:""}]}];return"TH"===s.tagName?Nt.from({id:t(),type:"table-head-cell",annotations:this.getTableHeadCellAnnotations(s,n),children:i},n):$t.from({id:t(),type:"table-cell",annotations:rt.generate($t,s,n),children:i},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}getTableHeadCellAnnotations(t,e){const n=rt.generate(Nt,t,e);return n&&n.tableCell&&_t.getColorKey(n.tableCell.backgroundColor,!0)===Et.key&&(delete n.tableCell.backgroundColor,n.customStyle&&delete n.customStyle.backgroundColor),n}}class Ps extends it{canHandle(t,e){const n=t[e];return n&&n.parentElement&&"TABLE"===n.parentElement.tagName&&"CAPTION"===n.tagName?1:0}handle(e,n){const s=this.getTableCaptionAnnotations(e[0],n);return zn.from({id:t(),type:"table-caption",annotations:Object.assign(Object.assign({},s),{caption:!0}),children:[]},n)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}getTableCaptionAnnotations(t,e){const n=rt.generate(zn,t,e);return n&&n.customStyle&&n.customStyle.backgroundColor&&_t.getColorKey(n.customStyle.backgroundColor,!0)===Et.key&&delete n.customStyle.backgroundColor,n}}class Vs extends dt{getBackgroundColor(t){return t.style.backgroundColor?_t.getColorKey(t.style.backgroundColor)||t.style.backgroundColor:null}getBorder(t){const e=t.style,n=e.borderStyle,s=e.borderWidth,i=e.borderColor;if(i||n||s){const t="initial"===i?"":i;return{style:"initial"===n?"":n,width:this.normalizeBorderWidth(s),color:_t.getColorKey(t)||t}}return null}normalizeBorderWidth(t){return"initial"===t||Vs.BORDER_WIDTH_KEYWORDS.includes(t)?"":t}getWidth(t){if(t.style.width)return t.style.width;const e=t.getAttribute("width");return e?/^\d+$/.test(e)?`${e}px`:e:null}getHeight(t){if(t.style.height)return t.style.height;const e=t.getAttribute("height");return e?/^\d+$/.test(e)?`${e}px`:e:null}}Vs.BORDER_WIDTH_KEYWORDS=["thin","medium","thick"];class $s extends Vs{canHandle(t){return"RTETableBlock"===t.typeName}handle(t){const e=_e({backgroundColor:this.getBackgroundColor(t),border:this.getBorder(t),width:this.getWidth(t),height:this.getHeight(t),alignment:this.getAlignment(t)});return Object.keys(e).length>0?{table:e}:{}}getAlignment(t){const e=t.classList;if(e.contains("v-rte--extension-table-align-left"))return"left";if(e.contains("v-rte--extension-table-align-center"))return"center";if(e.contains("v-rte--extension-table-align-right"))return"right";const n=t.style,s=n.marginLeft,i=n.marginRight;if("auto"===s&&"auto"===i)return"center";if("0"===s||"0px"===s)return"left";if("0"===i||"0px"===i)return"right";const r=t.getAttribute("align");return r&&["left","center","right"].includes(r)?r:null}}class Fs extends Vs{canHandle(t){return"RTETableCellBlock"===t.typeName}handle(t){const e=_e({backgroundColor:this.getBackgroundColor(t),padding:this.getPadding(t),border:this.getBorder(t),width:this.getWidth(t),height:this.getHeight(t),textAlign:this.getTextAlign(t),verticalAlign:this.getVerticalAlign(t),minWidth:this.getMinWidth(t),boxSizing:this.getBoxSizing(t)});return Object.keys(e).length>0?{tableCell:e}:{}}getMinWidth(t){return t.style.minWidth?t.style.minWidth:null}getBoxSizing(t){return t.style.boxSizing?t.style.boxSizing:null}getPadding(t){return t.style.padding?t.style.padding:null}getTextAlign(t){if(t.style.textAlign){const e=t.style.textAlign;if(["left","center","right","justify"].includes(e))return e}const e=t.getAttribute("align");return e&&["left","center","right","justify"].includes(e)?e:null}getVerticalAlign(t){if(t.style.verticalAlign){const e=t.style.verticalAlign;if(["top","middle","bottom"].includes(e))return e}return null}}class zs extends Fs{canHandle(t){return"RTETableHeadCellBlock"===t.typeName}}class Ks extends O{handleAction(t,e){const n=t.toAnnotation(),s=this.getDOMByEntity(e);if(s){const t=s.closest(".v-rte--extension-table-container"),{backgroundColorAnnotation:i,width:r,height:a}=n;s.style.backgroundColor=i.renderStyle().color,s.style.border=n.borderStr,s.style.width=r,s.style.height=a;const o=n.renderAlignmentStyle().margin;s.style.margin=o,t&&(t.style.width=r,t.style.height=a,t.style.margin=o),this.updateCustomStyleAnnotation(e,["backgroundColor","border","width","height","margin"])}}}class Ws extends O{handleAction(t,e){const n=t.toAnnotation(),s=this.getDOMByEntity(e);if(s){const{width:t,height:i,borderStr:r,padding:a,textAlign:o,verticalAlign:l}=n,c=n.renderStyle().backgroundColor||"";s.style.backgroundColor=c,s.style.border=r,s.style.width=t,s.style.height=i,s.style.padding=a,s.style.textAlign=o,s.style.verticalAlign=l,this.updateCustomStyleAnnotation(e,["backgroundColor","border","width","height","padding","textAlign","verticalAlign"])}}}class qs extends O{handleAction(t,e){const n=e.parent,s=n.parent,i=Kt(n,Pt),r=Ut(i),a=r.indexOf(n),{colSpan:o,rowSpan:l}=ne(e),c=ae(e,r),h=Math.ceil(l/2),d=Math.max(1,l-h),u=1===l;Zt(e,o,h,i);const p=a+h,f=se(e.type);if(Zt(f,o,d,i),u){const t=this.createNewRowWithCell(s,f),a=s.children.indexOf(n);s.apply(new I(s.children[a],t)),r.splice(p,0,t),this.updateCellsSpanningThroughInsertionPoint(r,p,e,i)}else{const t=r[p],e=this.findInsertPosition(t,c,r,p);t.children.splice(e,0,f),f.parent=t}}findInsertPosition(t,e,n,s){let i=0;for(let t=0;t<s;t++){const r=n[t];for(const a of r.children){const{colSpan:r,rowSpan:o}=ne(a);t+o>s&&ae(a,n)<e&&(i+=r)}}let r=i;for(let n=0;n<t.children.length;n++){if(r>=e)return n;const s=t.children[n],{colSpan:i}=ne(s);r+=i}return t.children.length}createNewRowWithCell(e,n){const s={id:t(),type:"table-row",children:[]},i=re.from(s);return i.parent=e,i.children.push(n),n.parent=i,i}updateCellsSpanningThroughInsertionPoint(t,e,n,s){for(let i=0;i<e;i++){const r=t[i];for(const t of r.children){if(t===n)continue;const{colSpan:r,rowSpan:a}=ne(t);i+a>=e&&Zt(t,r,a+1,s)}}}}class Us extends O{handleAction(t,e){const n=e.parent,s=Kt(n,Pt),i=Ut(s),r=i.indexOf(n),{colSpan:a,rowSpan:o}=ne(e),l=ae(e,i),c=l+a-1,h=Math.ceil(a/2),d=Math.floor(a/2);Zt(e,h,o,s);const u=se(e.type);Zt(u,d,o,s),n.apply(new I(e,u));const p=1===a?1:0;p>0&&this.updateOtherRowsCells(i,r,l,c,o,p,s)}updateOtherRowsCells(t,e,n,s,i,r,a){for(let o=0;o<t.length;o++){const l=t[o];if(!(o>=e&&o<e+i))for(const e of l.children){const i=ae(e,t),{colSpan:o,rowSpan:l}=ne(e);if(i+o-1>=n&&i<=s){Zt(e,o+r,l,a);break}}}}}class Gs extends xs{handleAction(e,n){const{selectedRows:s}=e,i=s[s.length-1];let r=n.children.find((t=>t instanceof zt));const a={id:t(),type:"table-row",children:[]};let o=0,l=null;r?(l=r.children[0],o=this.getHeadCellLength(l)):(r=zt.from({id:t(),type:"table-body",children:[]}),n.apply(new R([r])));const c=i.parent.children,h=this.getRowsMaxCellCount(c);if(this.getRowsMaxCellCount([i])<h){const t=c.indexOf(i),e=this.getRowCellStartCols(c),n=new Map;for(let s=0;s<h;s++){const i=s<o?"table-head-cell":"table-cell",{cell:r}=this.getTheStartSpanCell(c,e,t,s);if(r){const t=r.colSpan;n.set(s,this.getDefaultCellBlockTemplate(i,t)),s+=t-1}}a.children=this.getSortedValuesByNumericKey(n)}else a.children=this.createTableCells(i,o);const d=l?new B(l,re.from(a)):new R([re.from(a)]);r.apply(d)}createTableCells(t,e){const n=[];let s=0;for(const i of t.children)n.push(this.getDefaultCellBlockTemplate(s<e?"table-head-cell":"table-cell",i.colSpan)),s+=i.colSpan;return n}}class Zs extends xs{handleAction(e){const{insertDirection:n,selectedRows:s}=e,i=n===oe.ABOVE?s[0]:s[s.length-1],r={id:t(),type:"table-row",children:[]},a=i.parent.children,o=this.getRowsMaxCellCount(a),l=a.indexOf(i),c=this.getRowCellStartCols(a),h=new Map;for(let t=0;t<o;t++){const{cell:e,rowIndex:s}=this.getTheStartSpanCell(a,c,l,t);if(e){const{colSpan:i,rowSpan:r}=e;if(n===oe.ABOVE?s!==l:s+r>l+1){this.updateCellSpan(e,"rowspan",r+1),t+=i-1;continue}h.set(t,this.getDefaultCellBlockTemplate(e.type,i)),t+=i-1}}r.children=this.getSortedValuesByNumericKey(h);const d=re.from(r),u=n===oe.ABOVE?new B(i,d):new I(i,d);i.parent.apply(u)}}class Qs extends Ct{canIntercept(t,e){return Boolean(e.parent)}intercept(t,e,n){const s=this.createNewParagraph("");s&&(n.parent.apply(0===e.startOffset?new B(n,s):new I(n,s)),e.newBlock=s)}createNewParagraph(e){const n=V.getRTEBlockClass("paragraph");if(n)return n.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:e}]})}}class Js extends ${constructor(){super(...arguments),this.stylesToBeFiltered=Rt.getDefaultStyles(),this.elementTagName="table"}canFilter(t){return this.isTableBlock(t.typeName)}canRefill(t,e){return this.isTableBlock(t)&&e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableBlock(t){return"RTETableBlock"===t}}class Ys extends ${constructor(){super(...arguments),this.stylesToBeFiltered=Fn.getDefaultStyles(),this.elementTagName="table caption"}canFilter(t){return this.isTableCaption(t.typeName)}canRefill(t,e){return this.isTableCaption(t)&&"CAPTION"===e.nodeName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableCaption(t){return"RTETableCaptionBlock"===t}}class Xs extends ${constructor(t="td"){super(),this.stylesToBeFiltered=Bt.getDefaultStyles(),this.elementTagName="",this.stylesWithRGBColor=Bt.getDefaultStyles(!1),this.cellBlockClassName="",this.elementTagName=t,this.cellBlockClassName="td"===t?"RTETableCellBlock":"RTETableHeadCellBlock"}canFilter(t){return this.isTableCell(t.typeName)}filterAndDeleteStyles(t,e){return this.convertDefaultBorderColorFromRGBToHex(t),super.filterAndDeleteStyles(t,e)}canRefill(t,e){return this.isTableCell(t)&&e.nodeName===this.elementTagName.toUpperCase()}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}isTableCell(t){return t===this.cellBlockClassName}convertDefaultBorderColorFromRGBToHex(t){t&&t.border&&t.border===this.stylesWithRGBColor.border&&(t.border=this.stylesToBeFiltered.border)}}class ti extends wt{constructor(t=le){super(),this.toolbarButtonRenderer=new gs,this.tableBlockRenderer=new os,this.tableRowBlockRenderer=new cs,this.tableCellRenderer=new hs,this.tableHeadCellRenderer=new us,this.tableSelection=new Ls,_t.setTableColors(t),this.registerToolbarButtonRenderer(ti.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer),this.registerBlockBasicStrategies(Pt.typeName),this.registerBlockBasicStrategies(Ft.typeName),this.registerBlockBasicStrategies(Nt.typeName),this.registerBlockBasicStrategies(re.typeName),this.registerBlockBasicStrategies($t.typeName),this.registerBlockBasicStrategies(zt.typeName),this.registerRenderer("table-block",this.tableBlockRenderer),this.registerRenderer("table-head",new ls),this.registerRenderer("table-head-cell",this.tableHeadCellRenderer),this.registerRenderer("table-row",this.tableRowBlockRenderer),this.registerRenderer("table-cell",this.tableCellRenderer),this.registerRenderer("table-body",new ds),this.registerRenderer("table-caption",new ys),this.registerNode("table-block",Pt),this.registerNode("table-head",Ft),this.registerNode("table-head-cell",Nt),this.registerNode("table-row",re),this.registerNode("table-cell",$t),this.registerNode("table-body",zt),this.registerNode("table-caption",zn),this.registerElementToBlockDTOClassStrategy(new Ms),this.registerElementToBlockDTOClassStrategy(new js),this.registerElementToBlockDTOClassStrategy(new Hs),this.registerElementToBlockDTOClassStrategy(new Ds),this.registerElementToBlockDTOClassStrategy(new _s),this.registerElementToBlockDTOClassStrategy(new Ps),this.registerAnnotationHandler(new $s),this.registerAnnotationHandler(new Fs),this.registerAnnotationHandler(new zs)}initialExtensionAfterLoad(t){this.tableSelection.init(t);const e=Object.assign(Object.assign({},t),{tableSelection:this.tableSelection});super.initialExtensionAfterLoad(e)}destroyExtension(){this.tableBlockRenderer.destroy(),this.tableSelection.destroy()}}(()=>{const t=new ws,e=new vs;wt.registerActionHandleStrategy(nt.typeName,"INSERT_TABLE_BLOCK",t),wt.registerActionHandleStrategy(Pt.typeName,"DELETE_TABLE_BLOCK",e),wt.registerActionHandleStrategy(A.typeName,"INSERT_TABLE_BLOCK",t),wt.registerActionHandleStrategy(lt.typeName,"INSERT_TABLE_BLOCK",t),wt.registerActionHandleStrategy(Pt.typeName,ce,new Gs),wt.registerActionHandleStrategy(Pt.typeName,he,new Zs),wt.registerActionHandleStrategy(Pt.typeName,de,new Cs),wt.registerActionHandleStrategy(Pt.typeName,ue,new Ts),wt.registerActionHandleStrategy(Pt.typeName,pe,new As),wt.registerActionHandleStrategy(Pt.typeName,fe,new Ss),wt.registerActionHandleStrategy(Pt.typeName,ge,new we),wt.registerActionHandleStrategy(re.typeName,me,new Is),wt.registerActionHandleStrategy(re.typeName,"CREATE_SEGMENT_TABLE_CELL",new Es),wt.registerActionHandleStrategy(re.typeName,ve,new Os),wt.registerActionHandleStrategy($t.typeName,be,new qs),wt.registerActionHandleStrategy($t.typeName,ye,new Us),wt.registerActionHandleStrategy(Nt.typeName,be,new qs),wt.registerActionHandleStrategy(Nt.typeName,ye,new Us),wt.registerActionHandleStrategy(Pt.typeName,xe,new Rs),wt.registerActionHandleStrategy(Pt.typeName,Ce,new Ns),wt.registerActionHandleStrategy(Pt.typeName,Un.typeName,new Ks),wt.registerActionHandleStrategy($t.typeName,Jn.typeName,new Ws),wt.registerActionHandleStrategy(Nt.typeName,Yn.typeName,new Ws),wt.registerActionHandlerInterceptor(A.typeName,M.DELETE_BLOCK_CONTENT,new ms),wt.registerActionHandlerInterceptor(re.typeName,M.INSERT_CHILDREN_BEFORE,new Bs),wt.registerActionHandlerInterceptor($t.typeName,M.DELETE_CHILDREN,new bs),wt.registerActionHandlerInterceptor(Nt.typeName,M.DELETE_CHILDREN,new bs),wt.registerActionHandlerInterceptor(Pt.typeName,M.INSERT_NEW_PARAGRAPH,new Qs),wt.registerFilterStylesStrategy(Pt.typeName,new Js),wt.registerFilterStylesStrategy(zn.typeName,new Ys),wt.registerFilterStylesStrategy($t.typeName,new Xs),wt.registerFilterStylesStrategy(Nt.typeName,new Xs("th"))})(),ti.TOOLBAR_BUTTON_KEY="table";class ei extends F{constructor(t,e,n){super(t,n),this.type="horizontal-line",this.parent=e}toJSON(){return{id:this.id,type:"horizontal-line"}}clone(t){return new ei(this.id,t,super.cloneAnnotations())}toHtml(){return"<hr>"}}ei.typeName="RTEHorizontalLineNode";const ni={display:"inline-block",width:"100%",height:"4px",backgroundColor:"rgb(222, 222, 222)",borderWidth:"0px"};class si extends ${constructor(){super(...arguments),this.stylesToBeFiltered=ni,this.elementTagName="hr"}canFilter(t){return class{static isHorizontalLineBlock(t){return"RTEHorizontalLineBlock"===t}}.isHorizontalLineBlock(t.typeName)}canRefill(t,e){return e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}var ii;!function(t){t.HORIZONTAL_LINE="HORIZONTAL_LINE"}(ii||(ii={}));class ri extends j{constructor(){super(...arguments),this.type=ii.HORIZONTAL_LINE}static from(){return[ii.HORIZONTAL_LINE,new ri]}static getDefaultStyles(){return ni}toJSON(){return null}clone(){return new ri}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte-horizontal-line-hr"}renderStyle(t){return(null==t?void 0:t.standalone)?ri.getDefaultStyles():null}}class ai extends T{constructor(t,e){super(t),this.type="horizontal-line",this.children=[];const{autoMatchFormat:n=!0}=null!=e?e:{};n&&(this.annotationMap=new Map([ri.from()]))}static from(e,n={autoMatchFormat:!0}){var s,i;const r=new ai(e.id,n),a=(null===(i=null===(s=e.children)||void 0===s?void 0:s[0])||void 0===i?void 0:i.id)||t(),o=new ei(a,r);return r.children=[o],e.annotations&&T.convertAnnotationsToMap(r.annotationMap,e.annotations),r}static create(e,n={autoMatchFormat:!0}){const s=new ai(t(),n),i=new ei(t(),s);return s.children=[i],e&&T.convertAnnotationsToMap(s.annotationMap,e),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"horizontal-line",children:this.children.map((t=>t.toJSON()))})}toHtml(t){return`<hr${super.generateAttributeString(t)}>`}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1]}clone(t){const e=new ai(this.id);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}}ai.typeName="RTEHorizontalLineBlock";class oi extends gt{doRender(t,e,n){const s=e.children[0],i=e.getStyles(n),r=e.getClasses(n),a=[F.DECORATOR_NODE_CLASS,r].filter(Boolean).join(" ");return t("div",{key:e.id,class:`v-rte-horizontal-line ${F.DECORATOR_CONTAINER_CLASS}`,ref:this.useRef(e)},[t("hr",{key:(null==s?void 0:s.id)||e.id+"-hr",class:a,style:Object.keys(i).length>0?i:void 0,ref:s?this.useRef(s):void 0})])}injectRTEScopeStyles(){return".v-rte-horizontal-line{padding:8px 0;overflow:hidden}.v-rte-horizontal-line .v-rte-horizontal-line-hr{display:inline-block;width:100%;height:4px;border-width:0px;background-color:rgb(222, 222, 222)}"}}oi.typeName="RTEHorizontalLineBlockRenderer";class li extends v{constructor(t,e=0){super(),this.type="INSERT_HORIZONTAL_LINE_BLOCK",this.splitPointNode=t,this.startOffsetOfNode=e}}class ci extends xt{render(t,e){return this.renderButton(t,e,{icon:"horizontal-line",ariaLabel:w.t("Horizontal line"),tooltip:{text:w.t("Horizontal line")}})}isDisabled(t){const e=this.getExtensionContext(t.host);if(e){const{host:t,getSelectedNodes:n}=e,[s]=n();return s?t.disabled||!b.canHandle("INSERT_HORIZONTAL_LINE_BLOCK",s.parent):t.disabled}return!1}handleButtonClick(t){if(this.isDisabled(t))return;const e=this.getExtensionContext(t.host);if(e){const{host:n,getSelectedNodes:s,flushValue:i}=e,r=s()[0],a=new li(r,t.rteRange.startOffset);r?r.parent&&r.parent.apply(a):n.value.apply(a),a.nextFocusNode&&n.value.apply(new et(a.nextFocusNode,0)),i(n.value)}}handleDropdownClick(){}}vt.register({"horizontal-line":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 224H32 608h32v64H608 32 0V224z"/></svg>'}});class hi extends it{canHandle(t,e){return"HR"===t[e].tagName?1:0}handle(t,e){const n=rt.generate(ai,t[0],e);return ai.create(n,e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class di extends O{handleAction(t,e){const n=ai.create();if(t.splitPointNode instanceof y){const s=t.splitPointNode,i=t.startOffsetOfNode;if(this.isCaretPositionAtBlockEnd(e,s,i))this.insertAfterWithFocus(t,e,n);else if(this.isCaretPositionAtBlockStart(e,s,i))e.parent.apply(new B(e,n)),t.nextFocusNode=e.getFirstNode();else{const r=new z(s,i);e.apply(r);const a=this.getNextSiblingBlock(e);e.parent.apply(new I(e,n)),t.nextFocusNode=a.getFirstNode()}}else if(t.splitPointNode)this.insertAfterWithFocus(t,e,n);else{const s=super.createNewParagraph("");e.apply(new R([n,s])),t.nextFocusNode=s.children[0]}}insertAfterWithFocus(t,e,n){const s=this.getNextSiblingBlock(e),i=null==s?void 0:s.getFirstNode();if(i instanceof y)e.parent.apply(new I(e,n)),t.nextFocusNode=i;else{const s=super.createNewParagraph("");e.parent.apply(new I(e,n,s)),t.nextFocusNode=s.children[0]}}getNextSiblingBlock(t){const e=t.parent.children,n=e.indexOf(t);return e[n+1]}}class ui extends wt{constructor(){super(),this.blockRenderer=new oi,this.toolbarButtonRenderer=new ci,this.registerBlockBasicStrategies(ai.typeName),this.registerNode("horizontal-line",ai),this.registerRenderer("horizontal-line",this.blockRenderer),this.registerToolbarButtonRenderer(ui.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer),this.registerElementToBlockDTOClassStrategy(new hi),wt.registerFilterStylesStrategy(ai.typeName,new si)}}var pi;(()=>{const t=new di;wt.registerActionHandleStrategy(nt.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t),wt.registerActionHandleStrategy(A.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t),wt.registerActionHandleStrategy(lt.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t),wt.registerActionHandleStrategy(ai.typeName,"INSERT_HORIZONTAL_LINE_BLOCK",t)})(),ui.TOOLBAR_BUTTON_KEY="horizontalLine",function(t){t.BLOCKQUOTE="BLOCKQUOTE"}(pi||(pi={}));const fi={overflow:"hidden",marginInline:"0",paddingInline:"24px",borderInlineStart:"solid 5px hsl(0, 0%, 80%)"};class gi extends j{constructor(){super(...arguments),this.type=pi.BLOCKQUOTE}static from(){return[pi.BLOCKQUOTE,new gi]}static getDefaultCssText(){return`.v-rte-blockquote {\n${Object.entries(fi).map((([t,e])=>`\t${Ve(t)}: ${e};`)).join("\n")}\n}`}toJSON(){return null}clone(){return new gi}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte-blockquote"}renderStyle(t){return(null==t?void 0:t.standalone)?fi:null}}class wi extends T{constructor(t,e){super(t),this.type="blockquote",this.children=[];const{autoMatchFormat:n=!0}=null!=e?e:{};n&&(this.annotationMap=new Map([gi.from()]))}static from(t,e){const n=new wi(t.id,e);return t.annotations&&T.convertAnnotationsToMap(n.annotationMap,t.annotations),n.children=T.generateBlockChildren(t.children,e,n),n}clone(t){const e=new wi(this.id),n=e;return e.children=this.children.map((t=>t.clone(n))),e.annotationMap=this.cloneAnnotations(),e.parent=t,e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return this.children.length>0}toHtml(t){return`<blockquote${this.generateAttributeString(t)}>${this.children.map((e=>e.toHtml(t))).join("")}</blockquote>`}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:"blockquote",children:this.children.map((t=>t.toJSON()))})}}wi.typeName="RTEBlockquoteBlock";class mi extends O{handleAction(e,n){const s=e.selectedBlocks,i=n.children,r=new Set(s),a=i.indexOf(s[0]),o=i.slice(0,a).filter((t=>!r.has(t))).length,l=new wi(t());l.parent=n,l.children=s,s.forEach((t=>{t.parent=l}));for(let t=i.length-1;t>=0;t--)r.has(i[t])&&i.splice(t,1);i.splice(o,0,l)}}class vi extends O{handleAction(t,e){const n=e.parent,s=[...e.children];s.length>0&&n.apply(new B(e,...s)),n.apply(new D(e))}}class bi extends Ct{canIntercept(t,e){const n=e.parent;return n instanceof wi&&!e.isNotEmpty()&&n.children[n.children.length-1]===e}intercept(t,e,n){const s=n.parent,i=this.createNewParagraph("");i&&(s.parent.apply(new I(s,i)),s.apply(new D(n)),e.newBlock=i)}createNewParagraph(e){const n=V.getRTEBlockClass("paragraph");if(n)return n.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:e}]})}}class yi extends v{constructor(t){super(),this.isFlushable=!0,this.type="TRANSFORM_TO_BLOCKQUOTE",this.selectedBlocks=t}}class xi extends v{constructor(){super(...arguments),this.isFlushable=!0,this.type="REMOVE_BLOCKQUOTE"}}class Ci extends it{canHandle(t,e){return"BLOCKQUOTE"===t[e].tagName?1:0}handle(e,n){const s=rt.generate(wi,e[0],n);return wi.from({id:t(),type:"blockquote",annotations:s,children:[]},n)}appendChildBlocks(t,e){const n=e.flatMap((t=>t instanceof wi?t.children:[t]));t.children=n.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}}class Li extends gt{doRender(t,e,n){var s;return t("blockquote",Object.assign({key:e.id,class:e.getClasses(n),style:e.getStyles(n),ref:this.useRef(e)},null===(s=e.getCustomAttributesAnnotation())||void 0===s?void 0:s.render()))}injectRTEScopeStyles(){return gi.getDefaultCssText()}}Li.typeName="RTEBlockquoteBlockRenderer";const Ti=new Li;class Ai extends xt{render(t,e){return this.renderButton(t,e,{icon:"quote-left",ariaLabel:e.translation.t("Block quote"),tooltip:{text:"Block quote"}})}isSelected(t){const e=this.getStartNode(t);return!!e&&null!==this.findBlockquoteAncestor(e)}isDisabled(t){if(t.host.disabled)return!0;const e=this.getStartNode(t);if(!e||null!==this.findBlockquoteAncestor(e))return!1;const{container:n}=this.resolveWrapAnchor(e.parent);return!b.canHandle("TRANSFORM_TO_BLOCKQUOTE",n)}handleButtonClick(t){const e=this.getExtensionContext(t.host);if(e){const{host:n,getSelectedNodes:s}=e,i=s(),r=i[0];if(!r)return void this.appendEmptyBlockquote(n.value);this.findBlockquoteAncestor(r)?this.collectBlockquoteAncestors(i).forEach((t=>{t.apply(new xi)})):this.wrapSelectedBlocks(i),n.value.apply(new et(r,t.rteRange.startOffset))}}handleDropdownClick(){}appendEmptyBlockquote(e){if(e.children.length>0){const n=e.children[e.children.length-1],s=A.from({id:t(),type:"paragraph",nodes:[{id:t(),type:"text",text:""}]});e.apply(new I(n,s)),e.apply(new yi([s])),e.apply(new et(s.getLastNode(),0))}}wrapSelectedBlocks(t){var e,n;const s=this.getUniqueBlocks(t),i=new Set(s.map((t=>{var e;return null!==(e=this.resolveWrapAnchor(t,!0).wrapBlock)&&void 0!==e?e:t}))).size>1,r=new Set;for(const t of s){const{wrapBlock:e}=this.resolveWrapAnchor(t,i);e instanceof wi&&!r.has(e)&&(r.add(e),e.apply(new xi))}const a=new Map;for(const t of s){const s=this.resolveWrapAnchor(t,i),{container:r}=s;if(r){const i=null!==(e=s.wrapBlock)&&void 0!==e?e:t,o=null!==(n=a.get(r))&&void 0!==n?n:new Set;o.add(i),a.set(r,o)}}for(const[t,e]of a)t.apply(new yi([...e]))}getStartNode(t){const e=this.getExtensionContext(t.host);return null==e?void 0:e.getSelectedNodes()[0]}collectBlockquoteAncestors(t){const e=new Set;return t.forEach((t=>{const n=this.findBlockquoteAncestor(t);n&&e.add(n)})),e}findBlockquoteAncestor(t){let e=t.parent;for(;e&&!(e instanceof nt);){if(e instanceof wi)return e;e=e.parent}return null}getUniqueBlocks(t){const e=new Set,n=[];return t.forEach((t=>{const s=t.parent;s&&!e.has(s)&&(e.add(s),n.push(s))})),n}resolveWrapAnchor(t,e=!1){let n=t;for(;n.parent&&!(n.parent instanceof nt)&&(e||!b.canHandle("TRANSFORM_TO_BLOCKQUOTE",n.parent));)n=n.parent;return{wrapBlock:n!==t?n:null,container:n.parent}}}vt.register({"quote-left":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M0 216C0 149.7 53.7 96 120 96l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64L0 216zm256 0c0-66.3 53.7-120 120-120l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64l0-136z"/></svg>'}});class Si extends ${constructor(){super(...arguments),this.stylesToBeFiltered=fi,this.elementTagName="blockquote"}static isBlockquoteBlock(t){return"RTEBlockquoteBlock"===t}canFilter(t){return Si.isBlockquoteBlock(t.typeName)}canRefill(t,e){return e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}class ki extends wt{constructor(){super(),this.toolbarButtonRenderer=new Ai,this.registerBlockBasicStrategies(wi.typeName),this.registerNode("blockquote",wi),this.registerRenderer("blockquote",Ti),this.registerToolbarButtonRenderer(ki.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer),this.registerElementToBlockDTOClassStrategy(new Ci),wt.registerFilterStylesStrategy(wi.typeName,new Si)}}(()=>{const t=new mi;wt.registerActionHandleStrategy(nt.typeName,"TRANSFORM_TO_BLOCKQUOTE",t),wt.registerActionHandleStrategy($t.typeName,"TRANSFORM_TO_BLOCKQUOTE",t),wt.registerActionHandleStrategy(Nt.typeName,"TRANSFORM_TO_BLOCKQUOTE",t),wt.registerActionHandleStrategy(wi.typeName,"REMOVE_BLOCKQUOTE",new vi),wt.registerActionHandlerInterceptor(A.typeName,M.INSERT_NEW_PARAGRAPH,new bi)})(),ki.TOOLBAR_BUTTON_KEY="blockquote";const Ei={key:"latin",label:"Latin",characters:[{character:"Ā",title:"Latin capital letter a with macron"},{character:"ā",title:"Latin small letter a with macron"},{character:"Ă",title:"Latin capital letter a with breve"},{character:"ă",title:"Latin small letter a with breve"},{character:"Ą",title:"Latin capital letter a with ogonek"},{character:"ą",title:"Latin small letter a with ogonek"},{character:"Ć",title:"Latin capital letter c with acute"},{character:"ć",title:"Latin small letter c with acute"},{character:"Ĉ",title:"Latin capital letter c with circumflex"},{character:"ĉ",title:"Latin small letter c with circumflex"},{character:"Ċ",title:"Latin capital letter c with dot above"},{character:"ċ",title:"Latin small letter c with dot above"},{character:"Č",title:"Latin capital letter c with caron"},{character:"č",title:"Latin small letter c with caron"},{character:"Ď",title:"Latin capital letter d with caron"},{character:"ď",title:"Latin small letter d with caron"},{character:"Đ",title:"Latin capital letter d with stroke"},{character:"đ",title:"Latin small letter d with stroke"},{character:"Ē",title:"Latin capital letter e with macron"},{character:"ē",title:"Latin small letter e with macron"},{character:"Ĕ",title:"Latin capital letter e with breve"},{character:"ĕ",title:"Latin small letter e with breve"},{character:"Ė",title:"Latin capital letter e with dot above"},{character:"ė",title:"Latin small letter e with dot above"},{character:"Ę",title:"Latin capital letter e with ogonek"},{character:"ę",title:"Latin small letter e with ogonek"},{character:"Ě",title:"Latin capital letter e with caron"},{character:"ě",title:"Latin small letter e with caron"},{character:"Ĝ",title:"Latin capital letter g with circumflex"},{character:"ĝ",title:"Latin small letter g with circumflex"},{character:"Ğ",title:"Latin capital letter g with breve"},{character:"ğ",title:"Latin small letter g with breve"},{character:"Ġ",title:"Latin capital letter g with dot above"},{character:"ġ",title:"Latin small letter g with dot above"},{character:"Ģ",title:"Latin capital letter g with cedilla"},{character:"ģ",title:"Latin small letter g with cedilla"},{character:"Ĥ",title:"Latin capital letter h with circumflex"},{character:"ĥ",title:"Latin small letter h with circumflex"},{character:"Ħ",title:"Latin capital letter h with stroke"},{character:"ħ",title:"Latin small letter h with stroke"},{character:"Ĩ",title:"Latin capital letter i with tilde"},{character:"ĩ",title:"Latin small letter i with tilde"},{character:"Ī",title:"Latin capital letter i with macron"},{character:"ī",title:"Latin small letter i with macron"},{character:"Ĭ",title:"Latin capital letter i with breve"},{character:"ĭ",title:"Latin small letter i with breve"},{character:"Į",title:"Latin capital letter i with ogonek"},{character:"į",title:"Latin small letter i with ogonek"},{character:"İ",title:"Latin capital letter i with dot above"},{character:"ı",title:"Latin small letter dotless i"},{character:"IJ",title:"Latin capital ligature ij"},{character:"ij",title:"Latin small ligature ij"},{character:"Ĵ",title:"Latin capital letter j with circumflex"},{character:"ĵ",title:"Latin small letter j with circumflex"},{character:"Ķ",title:"Latin capital letter k with cedilla"},{character:"ķ",title:"Latin small letter k with cedilla"},{character:"ĸ",title:"Latin small letter kra"},{character:"Ĺ",title:"Latin capital letter l with acute"},{character:"ĺ",title:"Latin small letter l with acute"},{character:"Ļ",title:"Latin capital letter l with cedilla"},{character:"ļ",title:"Latin small letter l with cedilla"},{character:"Ľ",title:"Latin capital letter l with caron"},{character:"ľ",title:"Latin small letter l with caron"},{character:"Ŀ",title:"Latin capital letter l with middle dot"},{character:"ŀ",title:"Latin small letter l with middle dot"},{character:"Ł",title:"Latin capital letter l with stroke"},{character:"ł",title:"Latin small letter l with stroke"},{character:"Ń",title:"Latin capital letter n with acute"},{character:"ń",title:"Latin small letter n with acute"},{character:"Ņ",title:"Latin capital letter n with cedilla"},{character:"ņ",title:"Latin small letter n with cedilla"},{character:"Ň",title:"Latin capital letter n with caron"},{character:"ň",title:"Latin small letter n with caron"},{character:"ʼn",title:"Latin small letter n preceded by apostrophe"},{character:"Ŋ",title:"Latin capital letter eng"},{character:"ŋ",title:"Latin small letter eng"},{character:"Ō",title:"Latin capital letter o with macron"},{character:"ō",title:"Latin small letter o with macron"},{character:"Ŏ",title:"Latin capital letter o with breve"},{character:"ŏ",title:"Latin small letter o with breve"},{character:"Ő",title:"Latin capital letter o with double acute"},{character:"ő",title:"Latin small letter o with double acute"},{character:"Œ",title:"Latin capital ligature oe"},{character:"œ",title:"Latin small ligature oe"},{character:"Ŕ",title:"Latin capital letter r with acute"},{character:"ŕ",title:"Latin small letter r with acute"},{character:"Ŗ",title:"Latin capital letter r with cedilla"},{character:"ŗ",title:"Latin small letter r with cedilla"},{character:"Ř",title:"Latin capital letter r with caron"},{character:"ř",title:"Latin small letter r with caron"},{character:"Ś",title:"Latin capital letter s with acute"},{character:"ś",title:"Latin small letter s with acute"},{character:"Ŝ",title:"Latin capital letter s with circumflex"},{character:"ŝ",title:"Latin small letter s with circumflex"},{character:"Ş",title:"Latin capital letter s with cedilla"},{character:"ş",title:"Latin small letter s with cedilla"},{character:"Š",title:"Latin capital letter s with caron"},{character:"š",title:"Latin small letter s with caron"},{character:"Ţ",title:"Latin capital letter t with cedilla"},{character:"ţ",title:"Latin small letter t with cedilla"},{character:"Ť",title:"Latin capital letter t with caron"},{character:"ť",title:"Latin small letter t with caron"},{character:"Ŧ",title:"Latin capital letter t with stroke"},{character:"ŧ",title:"Latin small letter t with stroke"},{character:"Ũ",title:"Latin capital letter u with tilde"},{character:"ũ",title:"Latin small letter u with tilde"},{character:"Ū",title:"Latin capital letter u with macron"},{character:"ū",title:"Latin small letter u with macron"},{character:"Ŭ",title:"Latin capital letter u with breve"},{character:"ŭ",title:"Latin small letter u with breve"},{character:"Ů",title:"Latin capital letter u with ring above"},{character:"ů",title:"Latin small letter u with ring above"},{character:"Ű",title:"Latin capital letter u with double acute"},{character:"ű",title:"Latin small letter u with double acute"},{character:"Ų",title:"Latin capital letter u with ogonek"},{character:"ų",title:"Latin small letter u with ogonek"},{character:"Ŵ",title:"Latin capital letter w with circumflex"},{character:"ŵ",title:"Latin small letter w with circumflex"},{character:"Ŷ",title:"Latin capital letter y with circumflex"},{character:"ŷ",title:"Latin small letter y with circumflex"},{character:"Ÿ",title:"Latin capital letter y with diaeresis"},{character:"Ź",title:"Latin capital letter z with acute"},{character:"ź",title:"Latin small letter z with acute"},{character:"Ż",title:"Latin capital letter z with dot above"},{character:"ż",title:"Latin small letter z with dot above"},{character:"Ž",title:"Latin capital letter z with caron"},{character:"ž",title:"Latin small letter z with caron"},{character:"ſ",title:"Latin small letter long s"}]},Oi={key:"mathematical",label:"Mathematical",characters:[{character:"<",title:"Less-than sign"},{character:">",title:"Greater-than sign"},{character:"≤",title:"Less-than or equal to"},{character:"≥",title:"Greater-than or equal to"},{character:"–",title:"En dash"},{character:"—",title:"Em dash"},{character:"¯",title:"Macron"},{character:"‾",title:"Overline"},{character:"°",title:"Degree sign"},{character:"−",title:"Minus sign"},{character:"±",title:"Plus-minus sign"},{character:"÷",title:"Division sign"},{character:"⁄",title:"Fraction slash"},{character:"×",title:"Multiplication sign"},{character:"ƒ",title:"Latin small letter f with hook"},{character:"∫",title:"Integral"},{character:"∑",title:"N-ary summation"},{character:"∞",title:"Infinity"},{character:"√",title:"Square root"},{character:"∼",title:"Tilde operator"},{character:"≅",title:"Approximately equal to"},{character:"≈",title:"Almost equal to"},{character:"≠",title:"Not equal to"},{character:"≡",title:"Identical to"},{character:"∈",title:"Element of"},{character:"∉",title:"Not an element of"},{character:"∋",title:"Contains as member"},{character:"∏",title:"N-ary product"},{character:"∧",title:"Logical and"},{character:"∨",title:"Logical or"},{character:"¬",title:"Not sign"},{character:"∩",title:"Intersection"},{character:"∪",title:"Union"},{character:"∂",title:"Partial differential"},{character:"∀",title:"For all"},{character:"∃",title:"There exists"},{character:"∅",title:"Empty set"},{character:"∇",title:"Nabla"},{character:"∗",title:"Asterisk operator"},{character:"∝",title:"Proportional to"},{character:"∠",title:"Angle"},{character:"¼",title:"Vulgar fraction one quarter"},{character:"½",title:"Vulgar fraction one half"},{character:"¾",title:"Vulgar fraction three quarters"}]},Ii={key:"arrows",label:"Arrows",characters:[{character:"←",title:"leftwards simple arrow"},{character:"→",title:"rightwards simple arrow"},{character:"↑",title:"upwards simple arrow"},{character:"↓",title:"downwards simple arrow"},{character:"⇐",title:"leftwards double arrow"},{character:"⇒",title:"rightwards double arrow"},{character:"⇑",title:"upwards double arrow"},{character:"⇓",title:"downwards double arrow"},{character:"⇠",title:"leftwards dashed arrow"},{character:"⇢",title:"rightwards dashed arrow"},{character:"⇡",title:"upwards dashed arrow"},{character:"⇣",title:"downwards dashed arrow"},{character:"⇤",title:"leftwards arrow to bar"},{character:"⇥",title:"rightwards arrow to bar"},{character:"⤒",title:"upwards arrow to bar"},{character:"⤓",title:"downwards arrow to bar"},{character:"↨",title:"up down arrow with base"},{character:"🔙",title:"back with leftwards arrow above"},{character:"🔚",title:"end with leftwards arrow above"},{character:"🔛",title:"on with exclamation mark with left right arrow above"},{character:"🔜",title:"soon with rightwards arrow above"},{character:"🔝",title:"top with upwards arrow above"}]},Ri={key:"currency",label:"Currency",characters:[{character:"$",title:"Dollar sign"},{character:"€",title:"Euro sign"},{character:"¥",title:"Yen sign"},{character:"£",title:"Pound sign"},{character:"¢",title:"Cent sign"},{character:"₠",title:"Euro-currency sign"},{character:"₡",title:"Colon sign"},{character:"₢",title:"Cruzeiro sign"},{character:"₣",title:"French franc sign"},{character:"₤",title:"Lira sign"},{character:"¤",title:"Currency sign"},{character:"₿",title:"Bitcoin sign"},{character:"₥",title:"Mill sign"},{character:"₦",title:"Naira sign"},{character:"₧",title:"Peseta sign"},{character:"₨",title:"Rupee sign"},{character:"₩",title:"Won sign"},{character:"₪",title:"New sheqel sign"},{character:"₫",title:"Dong sign"},{character:"₭",title:"Kip sign"},{character:"₮",title:"Tugrik sign"},{character:"₯",title:"Drachma sign"},{character:"₰",title:"German penny sign"},{character:"₱",title:"Peso sign"},{character:"₲",title:"Guarani sign"},{character:"₳",title:"Austral sign"},{character:"₴",title:"Hryvnia sign"},{character:"₵",title:"Cedi sign"},{character:"₶",title:"Livre tournois sign"},{character:"₷",title:"Spesmilo sign"},{character:"₸",title:"Tenge sign"},{character:"₹",title:"Indian rupee sign"},{character:"₺",title:"Turkish lira sign"},{character:"₻",title:"Nordic mark sign"},{character:"₼",title:"Manat sign"},{character:"₽",title:"Ruble sign"}]},Bi={key:"text",label:"Text",characters:[{character:"‹",title:"Single left-pointing angle quotation mark"},{character:"›",title:"Single right-pointing angle quotation mark"},{character:"«",title:"Left-pointing double angle quotation mark"},{character:"»",title:"Right-pointing double angle quotation mark"},{character:"‘",title:"Left single quotation mark"},{character:"’",title:"Right single quotation mark"},{character:"“",title:"Left double quotation mark"},{character:"”",title:"Right double quotation mark"},{character:"‚",title:"Single low-9 quotation mark"},{character:"„",title:"Double low-9 quotation mark"},{character:"¡",title:"Inverted exclamation mark"},{character:"¿",title:"Inverted question mark"},{character:"‥",title:"Two dot leader"},{character:"…",title:"Horizontal ellipsis"},{character:"‡",title:"Double dagger"},{character:"‰",title:"Per mille sign"},{character:"‱",title:"Per ten thousand sign"},{character:"‼",title:"Double exclamation mark"},{character:"⁈",title:"Question exclamation mark"},{character:"⁉",title:"Exclamation question mark"},{character:"⁇",title:"Double question mark"},{character:"©",title:"Copyright sign"},{character:"®",title:"Registered sign"},{character:"™",title:"Trade mark sign"},{character:"§",title:"Section sign"},{character:"¶",title:"Paragraph sign"},{character:"⁋",title:"Reversed paragraph sign"}]},Ni=[Ri,Bi,Oi,Ii,Ei];class Mi extends xt{constructor(t){super(),this.panelRef=null,this.categories=t}render(t,e){return t("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,isScreenPosition:!0,role:"presentation",ref:t=>{t&&Te.addUniqueObserverToNode(t,Ne,(()=>{this.handlePopoverShow()}))}},[t("div",{slot:"popover"},[t("vega-rich-text-special-characters-panel",{categories:this.categories,ref:t=>{t&&(this.panelRef=t,Te.addUniqueObserverToNode(t,Me,(t=>{this.insertCharacter(e,t.detail)})))}})]),t("div",{slot:"popover-content"},this.renderButton(t,e,{icon:"rte-special-characters",ariaLabel:e.translation.t("Special Characters"),tooltip:{text:"Special Characters"}}))])}handleButtonClick(){}handleDropdownClick(){}handlePopoverShow(){this.panelRef&&this.panelRef.resetPanel()}insertCharacter(t,e){const n=t.rteRange,s=n.startNode;if(!s)return;const i=this.isCaretOnLineBreak(s,n)?this.insertAtLineBreak(s,e,n):this.insertAtTextNode(s,e,n);t.host.value.apply(new et(i.node,i.offset))}isCaretOnLineBreak(t,e){return t instanceof y&&"\n"===t.text&&e.startOffset===e.endOffset}insertAtTextNode(t,e,n){const s=new Lt(e,n);return s.isFlushable=!0,t.apply(s),{node:t,offset:Math.min(n.startOffset+e.length,t.getRangeEndOffset())}}insertAtLineBreak(t,e,n){return{node:this.insertTextToLineBreakNode(t,e,n),offset:e.length}}insertTextToLineBreakNode(t,e,n){const s=t.parent,i=s.children.indexOf(t);if(0===n.startOffset&&s.children[i+1]){const n=t.cloneWithText(e),i=new B(t,n);return i.isFlushable=!0,s.apply(i),n}const r=new K(e);return r.isFlushable=!0,t.apply(r),t}}vt.register({"rte-special-characters":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M224 80C126.8 80 48 158.8 48 256c0 63.7 33.8 119.5 84.6 150.4c11.4 7 19.4 19.6 19.4 34.2c0 21.8-17.6 39.4-39.4 39.4H24c-13.3 0-24-10.7-24-24s10.7-24 24-24H85.4C33.4 391 0 327.4 0 256C0 132.3 100.3 32 224 32s224 100.3 224 224c0 71.4-33.4 135-85.4 176H424c13.3 0 24 10.7 24 24s-10.7 24-24 24H335.4c-21.8 0-39.4-17.6-39.4-39.4c0-14.6 8-27.2 19.4-34.2C366.2 375.5 400 319.7 400 256c0-97.2-78.8-176-176-176z"/></svg>'}});class ji extends wt{constructor(t){super(),this.categories=this.buildCategories(t)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(ji.TOOLBAR_BUTTON_KEY,new Mi(this.categories),t)}buildCategories(t){const e=!1!==(null==t?void 0:t.includeDefaults)?Ni:[];return(null==t?void 0:t.categories)?[...e,...t.categories]:e}}ji.TOOLBAR_BUTTON_KEY="special-characters";class Hi{}class Di extends Hi{canHandle(t){return t instanceof W}collect(t){return[t]}}class _i extends Hi{canHandle(t){return t instanceof q}collect(t,e){const n=t,s=[n];if(n.nestList&&n.nestList.length>0)for(const t of n.nestList)s.push(...e(t.children));return s}}class Pi extends Hi{canHandle(t){return t instanceof A}collect(t){return[t]}}class Vi extends Hi{canHandle(t){return null!=t.children&&t.children.length>0&&!(t.children[0]instanceof y)}collect(t,e){return e(t.children)}}class $i{constructor(){this.matches=[],this.currentIndex=-1,this.flatCache=new WeakMap,this.cachedContent=null,this.matchCase=!1,this.wholeWords=!1,this.blockSearchStrategies=[new Di,new _i,new Pi,new Vi]}search(t,e){if(this.invalidateCacheIfNeeded(t),!e)return this.matches=[],void(this.currentIndex=-1);const n=this.buildRegExp(e,this.getFindOptions()),s=this.collectSearchableBlocks(t.children),i=[];for(const t of s){let e=this.flatCache.get(t);e||(e=t instanceof W?this.buildCodeBlockFlat(t):this.buildTextBlockFlat(t),this.flatCache.set(t,e));const{flatText:s,segments:r}=e;if(!s)continue;let a;for(n.lastIndex=0;null!==(a=n.exec(s));){const e=a.index+a[0].length,n=this.flatOffsetToNodePositions(r,e-a[1].length,e);n.length>0&&i.push({block:t,nodes:n,matchText:a[1]})}}this.matches=i,this.currentIndex=i.length>0?0:-1}next(){0!==this.matches.length&&(this.currentIndex=(this.currentIndex+1)%this.matches.length)}prev(){0!==this.matches.length&&(this.currentIndex=(this.currentIndex-1+this.matches.length)%this.matches.length)}setCurrentIndex(t){this.currentIndex=0!==this.matches.length?Math.max(0,Math.min(t,this.matches.length-1)):-1}getCurrentMatch(){var t;return null!==(t=this.matches[this.currentIndex])&&void 0!==t?t:null}getMatches(){return this.matches}getTotal(){return this.matches.length}getCurrentIndex(){return this.currentIndex}clearResults(){this.matches=[],this.currentIndex=-1}clear(){this.matches=[],this.currentIndex=-1,this.flatCache=new WeakMap,this.cachedContent=null}setMatchCase(t){this.matchCase=t}setWholeWords(t){this.wholeWords=t}invalidateCacheIfNeeded(t){t!==this.cachedContent&&(this.flatCache=new WeakMap,this.cachedContent=t)}buildRegExp(t,e){const n=this.escapeRegExp(t);let s="gu";if(e.matchCase||(s+="i"),e.wholeWords){const e="[^a-zA-ZÀ-ɏḀ-ỿ]",i=new RegExp(`^${e}`).test(t)?"":`(?:^|${e})`,r=new RegExp(`${e}$`).test(t)?"":`(?=${e}|$)`;return new RegExp(`${i}(${n})${r}`,s)}return new RegExp(`(${n})`,s)}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}collectSearchableBlocks(t){const e=[],n=this.collectSearchableBlocks.bind(this);for(const s of t){const t=this.blockSearchStrategies.find((t=>t.canHandle(s)));t&&e.push(...t.collect(s,n))}return e}buildTextBlockFlat(t){const e=[],n=[];let s=0;for(const i of t.children){if(!i.isContentEditable()){n.push("\0"),s+="\0".length;continue}const t=i.text.length;e.push({node:i,start:s,end:s+t}),n.push(i.text),s+=t}return{flatText:n.join(""),segments:e}}buildCodeBlockFlat(t){const e=t.children[0];if(!e)return{flatText:"",segments:[]};const n=e.text;return{flatText:n,segments:[{node:e,start:0,end:n.length}]}}flatOffsetToNodePositions(t,e,n){const s=[];for(const i of t){if(i.end<=e)continue;if(i.start>=n)break;const t=Math.max(0,e-i.start),r=Math.min(i.end,n)-i.start;s.push({node:i.node,startOffset:t,endOffset:r})}return s}getFindOptions(){return{matchCase:this.matchCase,wholeWords:this.wholeWords}}}class Fi{constructor(){this.overlayContainer=null,Re.registerCustomDarkModeColor({"rte-find-highlight-bg":"255, 235, 0, 0.55","rte-find-highlight-active-bg":"255, 190, 0, 0.7","rte-find-highlight-blend":"lighten"})}apply(t,e,n,s=!0){if(this.clear(),0===t.length)return;const i=this.getOrCreateOverlay(n);if(i){const n=i.getBoundingClientRect();let r=null;t.forEach(((t,s)=>{const a=s===e,o=a?"rgba(var(--v-rte-find-highlight-active-bg, 255, 150, 0, 0.5))":"rgba(var(--v-rte-find-highlight-bg, 255, 220, 0, 0.35))";t.nodes.forEach((t=>{const e=this.createHighlightRectangles(i,n,t,o);a&&!r&&e&&(r=e)}))})),s&&r&&r.scrollIntoView({block:"center",inline:"nearest"})}}clear(){this.overlayContainer&&(this.overlayContainer.innerHTML="")}getOrCreateOverlay(t){if(this.overlayContainer&&this.overlayContainer.isConnected)return this.overlayContainer;const e=He();if(e){const n=this.resolveOverlayMountTarget(t);if(n){const t=e.createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.pointerEvents="none",t.style.overflow="visible",t.style.setProperty("mix-blend-mode","var(--v-rte-find-highlight-blend, multiply)"),n.appendChild(t),this.overlayContainer=t,t}}return null}resolveOverlayMountTarget(t){var e,n,s,i;return null!==(i=null===(s=null===(n=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector("vega-rich-text-content"))||void 0===n?void 0:n.shadowRoot)||void 0===s?void 0:s.querySelector(".rich-text-content"))&&void 0!==i?i:null}createHighlightRectangles(t,e,n,s){const i=L.getDOMByEntity(n.node);if(!i)return null;const r=this.buildRange(i,n);if(!r)return null;const a=r.getClientRects(),o=He();let l=null;if(o)for(let n=0;n<a.length;n++){const i=a[n];if(0===i.width||0===i.height)continue;const r=o.createElement("div");r.style.position="absolute",r.style.top=i.top-e.top+"px",r.style.left=i.left-e.left+"px",r.style.width=`${i.width}px`,r.style.height=`${i.height}px`,r.style.backgroundColor=s,r.style.pointerEvents="none",r.style.borderRadius="2px",t.appendChild(r),l||(l=r)}return l}buildRange(t,e){if(e.node instanceof U)return this.buildCodeBlockRange(t,e);const n=t.firstChild;if(!n)return null;const s=He();if(s){const t=s.createRange();try{return t.setStart(n,e.startOffset),t.setEnd(n,e.endOffset),t}catch(t){return null}}return null}buildCodeBlockRange(t,e){const n=t.shadowRoot.querySelector("code");if(!n)return null;const s=He();if(s){const t=s.createTreeWalker(n,NodeFilter.SHOW_TEXT);let i=0,r=null,a=0,o=null,l=0,c=t.nextNode();for(;c;){const n=c.textContent.length;if(!r&&i+n>e.startOffset&&(r=c,a=e.startOffset-i),i+n>=e.endOffset){o=c,l=e.endOffset-i;break}i+=n,c=t.nextNode()}if(r&&o){const t=s.createRange();try{return t.setStart(r,a),t.setEnd(o,l),t}catch(t){return null}}}return null}}class zi{constructor(t){this.context=t}setHost(t){this.context.hostRef=t}setKeyword(t){return this.context.keyword=t,this.context.state.clearResults(),this.context.hostRef&&this.context.highlightManager.clear(),{current:0,total:0}}applyAndGetResult(t=!0){const e=this.context.state.getTotal(),n=e>0?this.context.state.getCurrentIndex()+1:0;return this.context.hostRef&&this.context.highlightManager.apply(this.context.state.getMatches(),this.context.state.getCurrentIndex(),this.context.hostRef,t),{current:n,total:e}}}class Ki extends zi{constructor(t){super(t)}find(){return this.context.hostRef?(this.context.state.search(this.context.hostRef.value,this.context.keyword),this.applyAndGetResult()):{current:0,total:0}}next(){return this.context.state.next(),this.applyAndGetResult()}prev(){return this.context.state.prev(),this.applyAndGetResult()}clear(){this.context.state.clear(),this.context.hostRef&&this.context.highlightManager.clear()}refresh(t=!0){if(!this.context.keyword||!this.context.hostRef)return null;const e=this.context.state.getCurrentIndex();return this.context.state.search(this.context.hostRef.value,this.context.keyword),this.context.state.setCurrentIndex(e),this.applyAndGetResult(t)}setMatchCase(t){return this.context.state.setMatchCase(t),this.updateFindResults()}setWholeWords(t){return this.context.state.setWholeWords(t),this.updateFindResults()}updateFindResults(){return this.context.state.clearResults(),this.context.keyword&&this.context.hostRef?(this.context.state.search(this.context.hostRef.value,this.context.keyword),this.applyAndGetResult()):{current:0,total:0}}}class Wi extends zi{constructor(t){super(t),this.replacement="",this.flushFn=null}setFlushValue(t){this.flushFn=t}setReplacement(t){this.replacement=t}replace(){const t=this.context.state.getCurrentMatch();if(t&&this.context.hostRef&&this.flushFn){const e=this.context.state.getCurrentIndex();this.applyMatchReplacement(t),this.flushFn(this.context.hostRef.value),this.context.state.clear(),this.context.state.search(this.context.hostRef.value,this.context.keyword),this.context.state.setCurrentIndex(e)}return this.applyAndGetResult()}replaceAll(){if(this.context.state.getTotal()>0&&this.flushFn&&this.context.hostRef){const t=this.context.state.getMatches();for(let e=t.length-1;e>=0;e-=1)this.applyMatchReplacement(t[e]);this.flushFn(this.context.hostRef.value),this.context.state.clear(),this.context.state.search(this.context.hostRef.value,this.context.keyword)}return this.applyAndGetResult()}applyMatchReplacement(t){t.nodes.forEach(((t,e)=>{const n=0===e?this.replacement:"";t.node.text=t.node.text.slice(0,t.startOffset)+n+t.node.text.slice(t.endOffset)}))}}class qi extends xt{constructor(){super(...arguments),this.sharedContext={state:new $i,highlightManager:new Fi,hostRef:null,keyword:""},this.findController=new Ki(this.sharedContext),this.replaceController=new Wi(this.sharedContext),this.panelRef=null,this.popoverRef=null,this.isPopoverOpen=!1,this.scrollOnNextRefresh=!1,this.debouncedRefresh=Pe(this.onContentChanged,100,this),this.panelActionHandlers={find:()=>this.findController.find(),prev:()=>this.findController.prev(),next:()=>this.findController.next(),replace:()=>(this.scrollOnNextRefresh=!0,this.replaceController.replace()),"replace-all":()=>(this.scrollOnNextRefresh=!0,this.replaceController.replaceAll()),"match-case":t=>this.findController.setMatchCase(t),"whole-words":t=>this.findController.setWholeWords(t),close:()=>this.closePanel()}}render(t,e){return this.syncEditorState(e),t("vega-popover",{trigger:"none",alignment:"start",placement:"bottom",showArrow:!1,isScreenPosition:!0,role:"presentation",ref:t=>{t&&(this.popoverRef=t,Te.addUniqueObserverToNode(t,Be,(()=>{const t=this.shouldRestoreFocusToButton();this.isPopoverOpen=!1,this.findController.clear(),this.updatePanel({current:0,total:0}),t&&setTimeout((()=>this.focusToolbarButton()))})),Te.addUniqueObserverToNode(t,Ne,(()=>{this.isPopoverOpen=!0})))}},[t("div",{slot:"popover"},[t("vega-rich-text-find-replace-panel",{ref:t=>{t&&(this.panelRef=t,Te.addUniqueObserverToNode(t,je,(t=>{"keyword"===t.detail.type?this.updatePanel(this.findController.setKeyword(t.detail.value)):"replace"===t.detail.type&&this.replaceController.setReplacement(t.detail.value)})),Te.addUniqueObserverToNode(t,Me,(t=>{this.handlePanelAction(t.detail)})))}})]),t("div",{slot:"popover-content"},this.renderButton(t,e,{icon:"rte-find-replace",ariaLabel:e.translation.t("Find and replace"),tooltip:{text:w.t("Find and replace")}}))])}handleButtonClick(){this.popoverRef&&(this.isPopoverOpen?this.popoverRef.hide():this.popoverRef.show())}handleDropdownClick(){}syncEditorState(t){this.findController.setHost(t.host);const e=this.getExtensionContext(t.host);e&&this.replaceController.setFlushValue(e.flushValue),Te.addUniqueObserverToNode(t.host,je,this.debouncedRefresh),this.isHidden(t)&&this.isPopoverOpen&&this.popoverRef?this.popoverRef.hide():this.isPopoverOpen&&this.popoverRef&&this.popoverRef.show(!0)}handlePanelAction(t){const{action:e,data:n}=t,s=this.panelActionHandlers[e];if(s){const t=s(n);t&&this.updatePanel(t)}}updatePanel(t){this.panelRef&&this.panelRef.updateResult(t.current,t.total)}onContentChanged(){if(!this.isPopoverOpen)return;const t=this.scrollOnNextRefresh;this.scrollOnNextRefresh=!1;const e=this.findController.refresh(t);e&&this.updatePanel(e)}closePanel(){this.popoverRef&&this.popoverRef.hide()}shouldRestoreFocusToButton(){const t=a(document,!0);return!t||t===document.body||this.isElementWithinPanel(t)}isElementWithinPanel(t){if(!t||!this.panelRef)return!1;let e=t;for(;e;){if(e===this.panelRef)return!0;const t=e.parentNode;e=t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}return!1}}vt.register({"rte-find-replace":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --\x3e<path fill="currentColor" d="M208 48c39.6 0 75.9 14.4 103.8 38.2L279 119c-6.9 6.9-8.9 17.2-5.2 26.2S286.3 160 296 160l96 0c13.3 0 24-10.7 24-24l0-96c0-9.7-5.8-18.5-14.8-22.2S381.9 16.2 375 23L345.8 52.2c-36.7-32.5-85-52.2-137.8-52.2-99.4 0-182.4 69.7-203.1 162.8-2.9 12.9 5.3 25.8 18.2 28.6 1.4 .3 2.7 .5 4.1 .5l2.3 0C40.1 191.5 49.4 184 51.8 173.2 67.7 101.6 131.6 48 208 48zM386 224c-10.4 .7-19.4 8.1-21.8 18.8-15.9 71.7-79.8 125.2-156.2 125.2-39.6 0-75.9-14.4-103.8-38.2L137 297c6.9-6.9 8.9-17.2 5.2-26.2S129.7 256 120 256l-96 0c-13.3 0-24 10.7-24 24l0 96c0 9.7 5.8 18.5 14.8 22.2S34.1 399.8 41 393l29.2-29.2c36.7 32.5 85 52.2 137.8 52.2 48.8 0 93.7-16.8 129.1-44.9L471 505c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L371.1 337.1c19.2-24.2 33.1-52.8 40-84 2.9-12.9-5.3-25.8-18.2-28.6-1.2-.3-2.4-.4-3.6-.5l-3.2 0z"/></svg>'}});class Ui extends wt{prepareBeforeLoad(t){this.registerToolbarButtonRenderer(Ui.TOOLBAR_BUTTON_KEY,new qi,t)}}Ui.TOOLBAR_BUTTON_KEY="findReplace";const Gi=[{title:"0.5",value:"0.5"},{title:"1",value:"1"},{title:"1.5",value:"1.5"},{title:"2",value:"2"},{title:"2.5",value:"2.5"}];var Zi;!function(t){t.LINE_HEIGHT="LINE_HEIGHT"}(Zi||(Zi={}));class Qi extends j{constructor(t){super(),this.type=Zi.LINE_HEIGHT,this.lineHeight=t}static from(t){return[Zi.LINE_HEIGHT,new Qi(t)]}static getDefaultStyles(t){return{lineHeight:t}}toJSON(){return{lineHeight:this.lineHeight}}renderClass(){return null}clone(){return new Qi(this.lineHeight)}renderStyle(){return Qi.getDefaultStyles(this.lineHeight)}}class Ji extends H{constructor(t){super(),this.isFlushable=!0,this.lineHeight=t}toAnnotation(){return new Qi(this.lineHeight)}}Ji.typeName="LineHeightAnnotationAction";class Yi extends O{handleAction(t,e){this.updateCustomStyleAnnotation(e,["lineHeight"])}}class Xi extends xt{constructor(t){super(),this.options=t}render(t,e){const n=this.options.map((t=>{var e;return{key:t.value,label:null!==(e=t.title)&&void 0!==e?e:t.value}}));return this.renderDropdown(t,e,{selectType:"single",selectedSourceKey:this.getSelectedSourceValue(e)},[this.renderButton(t,e,{icon:"line-height",ariaLabel:e.translation.t("Line Height"),showArrowIcon:!0,tooltip:{text:w.t("Line Height")}}),this.renderDropdownListTemplate(t,n,e)])}renderDropdownItem(t,e,n){return t("vega-dropdown-item",{key:e.key,itemKey:e.key,prefixIcon:e.icon},t("span",void 0,n.translation.t(e.label)))}isSelected(){return!1}isDisabled(t){var e;if(t.host.disabled)return!0;const n=this.getExtensionContext(t.host);return!!(null!==(e=null==n?void 0:n.getSelectedNodes())&&void 0!==e?e:[]).some((t=>{var e;return(null===(e=t.getAnnotationByType(S.CODE))||void 0===e?void 0:e.code)||t.parent instanceof W}))||this.getSelectedBlocks(t).some((t=>t instanceof W||t instanceof lt||!b.canHandle(Ji.typeName,t)))}handleDropdownClick(t,e){const n=t;this.getSelectedBlocks(e).forEach((t=>{t.apply(new Ji(n))}))}handleButtonClick(){}getSelectedSourceValue(t){const e=this.getSelectedBlocks(t);if(0===e.length)return"";const n=e[0].getAnnotationByType(Zi.LINE_HEIGHT);return e.every((t=>{const e=t.getAnnotationByType(Zi.LINE_HEIGHT);return(null==e?void 0:e.lineHeight)===(null==n?void 0:n.lineHeight)}))&&n?n.lineHeight:""}getSelectedBlocks(t){var e,n;const s=this.getExtensionContext(t.host),i=null!==(e=null==s?void 0:s.getSelectedNodes())&&void 0!==e?e:[],r=[];return i.forEach((t=>{t.parent instanceof T&&!r.includes(t.parent)&&r.push(t.parent)})),0===r.length&&(null===(n=t.rteRange.startNode)||void 0===n?void 0:n.parent)instanceof T&&r.push(t.rteRange.startNode.parent),r}}vt.register({"line-height":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M113.8 39.9c-4.6-5.1-11-7.9-17.8-7.9s-13.3 2.9-17.8 7.9l-72 80c-8.9 9.9-8.1 25 1.8 33.9s25 8.1 33.9-1.8L72 118.5V393.5L41.8 359.9c-8.9-9.9-24-10.7-33.9-1.8s-10.7 24-1.8 33.9l72 80c4.6 5.1 11 7.9 17.8 7.9s13.3-2.9 17.8-7.9l72-80c8.9-9.9 8.1-25-1.8-33.9s-25-8.1-33.9 1.8L120 393.5V118.5l30.2 33.5c8.9 9.9 24 10.7 33.9 1.8s10.7-24 1.8-33.9l-72-80zM248 72c-13.3 0-24 10.7-24 24s10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248zm0 160c-13.3 0-24 10.7-24 24s10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248zM224 416c0 13.3 10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248c-13.3 0-24 10.7-24 24z"/></svg>'}});const tr=new Set([A.typeName,q.typeName]);class er extends dt{constructor(t=Gi){super(),this.allowedLineHeights=new Set(t.map((t=>t.value)))}canHandle(t){return tr.has(t.typeName)}handle(t){var e,n;const s=null!==(n=null===(e=null==t?void 0:t.style.lineHeight)||void 0===e?void 0:e.trim())&&void 0!==n?n:"";return s&&this.allowedLineHeights.has(s)?{lineHeight:s}:{}}}class nr extends ${constructor(){super(...arguments),this.stylesToBeFiltered={}}get alwaysFilter(){return!0}filterAnnotations(t){const e=t,n=e.lineHeight,s=e.customStyle;return n&&s&&s.lineHeight===n&&delete s.lineHeight,s&&0===Object.keys(s).length&&delete e.customStyle,t}}const sr=new WeakMap,ir=new WeakSet;class rr extends wt{constructor(t=Gi){super(),this.options=t,this.toolbarButtonRenderer=null,this.registerAnnotationHandler(new er(this.options)),[A,q].forEach((t=>{!function(t,e){sr.set(t,new Set(e.map((t=>t.value))))}(t,this.options)}))}prepareBeforeLoad(t){this.toolbarButtonRenderer=new Xi(this.options),this.registerToolbarButtonRenderer(rr.TOOLBAR_BUTTON_KEY,this.toolbarButtonRenderer,t)}}[A,q].forEach((t=>{wt.registerActionHandleStrategy(t.typeName,Ji.typeName,new Yi),Z.register(t.typeName,new nr),function(t){ir.has(t)||(ir.add(t),wt.attachAnnotationFromJson(t,"lineHeight",((e,n)=>{if("string"!=typeof n||""===n)return;e.annotationMap.set(...Qi.from(n));const s=sr.get(t);s&&s.size>0&&function(t,e){const n=t.annotationMap.get(Zi.LINE_HEIGHT);if(!n||e.has(n.lineHeight))return;const s=n.lineHeight;t.annotationMap.delete(Zi.LINE_HEIGHT);const i=t.annotationMap.get(_.CUSTOM_STYLE);i?i.customStyle=Object.assign(Object.assign({},i.customStyle),{lineHeight:s}):t.annotationMap.set(...G.from({lineHeight:s}))}(e,s)})))}(t)})),rr.TOOLBAR_BUTTON_KEY="lineHeight";class ar extends xt{constructor(t){super(),this.controller=t}isHidden(){return!1}render(t,e){const n=this.isSelected();return this.renderButton(t,e,{icon:n?"rte-fullscreen-exit":"rte-fullscreen-enter",ariaLabel:e.translation.t(n?"Exit fullscreen mode":"Enter fullscreen mode"),tooltip:{text:w.t(n?"Exit fullscreen mode":"Enter fullscreen mode")}})}isSelected(){return this.controller.isActive()}handleButtonClick(t){this.controller.toggleFullscreen();const e=this.getExtensionContext(t.host);e&&e.forceUpdate(t.host)}handleDropdownClick(){}}vt.register({"rte-fullscreen-enter":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M295 183c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l135-135V168c0 13.3 10.7 24 24 24s24-10.7 24-24V24c0-13.3-10.7-24-24-24H344c-13.3 0-24 10.7-24 24s10.7 24 24 24h86.1L295 183zM217 329c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L48 430.1V344c0-13.3-10.7-24-24-24s-24 10.7-24 24V488c0 13.3 10.7 24 24 24H168c13.3 0 24-10.7 24-24s-10.7-24-24-24H81.9L217 329z"/></svg>'},"rte-fullscreen-exit":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M473 57c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-135 135V72c0-13.3-10.7-24-24-24s-24 10.7-24 24V216c0 13.3 10.7 24 24 24H424c13.3 0 24-10.7 24-24s-10.7-24-24-24H337.9L473 57zM7 455c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l135-135V440c0 13.3 10.7 24 24 24s24-10.7 24-24V296c0-13.3-10.7-24-24-24H56c-13.3 0-24 10.7-24 24s10.7 24 24 24h86.1L7 455z"/></svg>'}});class or{constructor(t){this.active=!1,this.hostStyle=null,this.scrollX=0,this.scrollY=0,this.host=t}isActive(){return this.active}enterFullscreen(){var t,e,n,s;const i=this.host;if(this.active||!i.shadowRoot||!i.ownerDocument)return;this.hostStyle=i.getAttribute("style"),this.scrollX=null!==(e=null===(t=i.ownerDocument.defaultView)||void 0===t?void 0:t.scrollX)&&void 0!==e?e:0,this.scrollY=null!==(s=null===(n=i.ownerDocument.defaultView)||void 0===n?void 0:n.scrollY)&&void 0!==s?s:0,this.lockDocumentScroll(i.ownerDocument);const r=this.hostStyle?/;\s*$/.test(this.hostStyle)?this.hostStyle:`${this.hostStyle};`:"";i.setAttribute("style",`${r}${or.HOST_FULLSCREEN_STYLE}`),i instanceof HTMLElement&&u.setZIndex(i,"base");const a=i.ownerDocument.createElement("style");a.id=or.STYLE_TAG_ID,yt.nonce&&a.setAttribute("nonce",yt.nonce),a.textContent=or.INNER_FULLSCREEN_CSS,i.shadowRoot.appendChild(a),this.active=!0}exitFullscreen(){var t,e,n,s;const i=this.host;this.active&&(i.ownerDocument&&this.unlockDocumentScroll(i.ownerDocument),i instanceof HTMLElement&&u.removeZIndex(i,"base"),null===this.hostStyle?i.removeAttribute("style"):i.setAttribute("style",this.hostStyle),null===(e=null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(`#${or.STYLE_TAG_ID}`))||void 0===e||e.remove(),null===(s=null===(n=i.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===s||s.scrollTo(this.scrollX,this.scrollY),this.active=!1)}toggleFullscreen(){this.active?this.exitFullscreen():this.enterFullscreen()}lockDocumentScroll(t){const e=or.documentScrollLockStates.get(t);e?or.documentScrollLockStates.set(t,Object.assign(Object.assign({},e),{lockCount:e.lockCount+1})):(or.documentScrollLockStates.set(t,{lockCount:1,bodyOverflow:t.body.style.overflow,documentOverflow:t.documentElement.style.overflow}),t.body.style.overflow="hidden",t.documentElement.style.overflow="hidden")}unlockDocumentScroll(t){const e=or.documentScrollLockStates.get(t);e&&(e.lockCount>1?or.documentScrollLockStates.set(t,Object.assign(Object.assign({},e),{lockCount:e.lockCount-1})):(t.body.style.overflow=e.bodyOverflow,t.documentElement.style.overflow=e.documentOverflow,or.documentScrollLockStates.delete(t)))}}or.STYLE_TAG_ID="v-rte-fullscreen-styles",or.HOST_FULLSCREEN_STYLE="position:fixed;inset:0;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));",or.INNER_FULLSCREEN_CSS=":host > vega-flex { height: 100%; padding: 5px; box-sizing: border-box; } .rich-text-editor-container { flex: 1 !important; height: auto !important; min-height: 0 !important; resize: none !important; overflow: auto !important; } .source-view-container:not(.vega-hidden) { display: flex !important; flex: 1 !important; min-height: 0 !important; overflow: auto !important; flex-direction: column; }",or.documentScrollLockStates=new WeakMap;class lr extends wt{prepareBeforeLoad(t){const e=new or(t);lr.controllerStore.set(t,e),this.registerToolbarButtonRenderer(lr.TOOLBAR_BUTTON_KEY,new ar(e),t)}destroyExtension(){var t,e;if(null===(t=this.extensionContext)||void 0===t?void 0:t.host){const t=this.extensionContext.host;null===(e=lr.controllerStore.get(t))||void 0===e||e.exitFullscreen(),lr.controllerStore.delete(t)}}}var cr,hr;lr.TOOLBAR_BUTTON_KEY="fullscreen",lr.controllerStore=lr.createStateStore(),function(t){t.RICH="rich",t.PLAIN="plain",t.WORD="word"}(cr||(cr={})),function(t){t[t.DEFAULT_FALLBACK=-1]="DEFAULT_FALLBACK",t[t.BASE=0]="BASE",t[t.WORD=10]="WORD"}(hr||(hr={}));class dr{get type(){return cr.RICH}get priority(){return hr.BASE}get supportsImageProcessing(){return!1}get consumesPlainText(){return!1}transform(t){const e=this.getSourceContent(t);return{html:this.process(e),text:this.consumesPlainText?e:t.text,mode:this.type,markers:{},extractImages:this.supportsImageProcessing,imagesToExtract:this.supportsImageProcessing?t.files:[]}}getSourceContent(t){return this.consumesPlainText?t.text:t.html}}class ur extends dr{canHandle(t){return void 0!==t}process(t){return t}get priority(){return hr.DEFAULT_FALLBACK}}const pr=/symbol|wingdings|webdings/i,fr=/mso-list\s*:\s*l\d+/i,gr=/mso-list\s*:\s*l\d+\s+level(\d+)/i,wr=/mso-list\s*:\s*l(\d+)/i,mr=/\blfo(\d+)/i,vr=/mso-list\s*:\s*ignore/i,br=/font-family\s*:\s*([^;]+)/i,yr=/MsoListParagraph/i,xr=/^(i|[ivxlcdm]{2,})$/,Cr=/^(I|[IVXLCDM]{2,})$/,Lr=/^[a-z]+$/,Tr=/^[A-Z]+$/,Ar=/^[0-9]+$/,Sr=/list-style-type\s*:\s*([^;]+)/i,kr={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"},Er=new Set(["P","DIV","UL","OL","LI","H1","H2","H3","H4","H5","H6","TABLE","BLOCKQUOTE","PRE"]),Or=["colspan","rowspan"],Ir=/^\d+$/,Rr=/^border(-(top|right|bottom|left))?(-(width|style|color))?$/,Br=/^padding(-(top|right|bottom|left))?$/,Nr=/^width$/,Mr=/^0+(\.0+)?([a-z%]+)?$/i,jr=[{attribute:"valign",property:"vertical-align"},{attribute:"align",property:"text-align"},{attribute:"bgcolor",property:"background-color"}],Hr=/(?:^|\s)(?:language|lang)-([a-z0-9+_.-]+)(?:\s|$)/i,Dr=/^mso[a-z0-9_-]*$/i;class _r{static isCodeBlock(t){return t.nodeType===Node.ELEMENT_NODE&&"PRE"===t.tagName.toUpperCase()}apply(t){Array.from(t.querySelectorAll("pre")).forEach((t=>{this.stripWordClassArtifacts(t),t.hasAttribute("data-language")||t.setAttribute("data-language",this.resolveLanguage(t))}))}getAllowedTags(){return["PRE"]}getAllowedAttributes(){return new Map([["PRE",["data-language"]]])}getAllowedStyles(){return[]}resolveLanguage(t){const e=this.resolveLanguageFromClassName(t).trim();return""!==e?e:"plainText"}resolveLanguageFromClassName(t){const e=t.getAttribute("class")||"",n=Hr.exec(e);return n?n[1]:""}stripWordClassArtifacts(t){const e=t.getAttribute("class")||"";if(!e)return;const n=e.split(/\s+/).map((t=>t.trim())).filter((t=>""!==t&&!Dr.test(t)));0!==n.length?t.setAttribute("class",n.join(" ")):t.removeAttribute("class")}}const Pr=[new class{apply(t){Array.from(t.querySelectorAll("table")).forEach((t=>this.normalizeTable(t)))}getAllowedTags(){return["TABLE","THEAD","TBODY","TR","TH","TD","CAPTION"]}getAllowedAttributes(){return new Map([["TD",["colspan","rowspan"]],["TH",["colspan","rowspan"]]])}getAllowedStyles(){return["border","width"]}normalizeTable(t){this.removeStructuralWhitespace(t),this.stripClass(t),this.removeBorderAndPaddingStyles(t),Array.from(t.querySelectorAll("thead, tbody, tfoot, caption, tr")).forEach((t=>this.stripClass(t))),this.removeHiddenMisalignedCells(t),this.mergeFooterIntoBody(t),this.promoteHeadCells(t),Array.from(t.querySelectorAll("td, th")).forEach((t=>{this.removeCellLayoutWhitespace(t),this.stripClass(t),this.normalizeSpanAttributes(t),this.migrateCellAttributes(t),this.migrateCellWidth(t),this.removeBorderAndPaddingStyles(t)}))}removeHiddenMisalignedCells(t){Array.from(t.querySelectorAll("tr")).filter((e=>this.isRowOfTable(t,e))).forEach((t=>{const e=t.lastElementChild;e&&("TD"===e.tagName||"TH"===e.tagName)&&this.isHiddenMisalignedCell(e)&&t.removeChild(e)}))}isRowOfTable(t,e){let n=e.parentElement;for(;n&&"BODY"!==n.tagName;){if("TABLE"===n.tagName)return n===t;n=n.parentElement}return!1}isHiddenMisalignedCell(t){return!this.hasExplicitSpan(t)&&!!this.hasZeroWidthMarker(t)&&!this.hasMeaningfulCellContent(t)}hasExplicitSpan(t){return Or.some((e=>t.hasAttribute(e)))}hasZeroWidthMarker(t){const e=t.getAttribute("width");if(null!==e&&Mr.test(e.trim()))return!0;const n=t.getAttribute("data-style");if(null===n)return!1;const s=this.readStyleDeclaration(n,"width");return null!==s&&Mr.test(s)}hasMeaningfulCellContent(t){return""!==(t.textContent||"").trim()}readStyleDeclaration(t,e){const n=t.split(";").map((t=>t.trim())).filter((t=>""!==t));for(const t of n){const n=t.indexOf(":");if(-1===n)continue;if(t.slice(0,n).trim().toLowerCase()!==e.toLowerCase())continue;const s=t.slice(n+1).trim();return""===s?null:s}return null}mergeFooterIntoBody(t){Array.from(t.children).filter((t=>"TFOOT"===t.tagName)).forEach((e=>{const n=Array.from(t.children).filter((t=>"TBODY"===t.tagName)),s=n[n.length-1];if(s){for(;e.firstChild;)s.appendChild(e.firstChild);e.parentNode&&e.parentNode.removeChild(e)}else this.replaceElementTag(e,"tbody")}))}promoteHeadCells(t){Array.from(t.querySelectorAll("thead")).forEach((t=>{Array.from(t.children).forEach((t=>{"TR"===t.tagName&&Array.from(t.children).forEach((t=>{"TD"===t.tagName&&this.renameCell(t,"th")}))}))}))}renameCell(t,e){this.replaceElementTag(t,e)}replaceElementTag(t,e){const n=t.ownerDocument.createElement(e);for(Array.from(t.attributes).forEach((t=>{n.setAttribute(t.name,t.value)}));t.firstChild;)n.appendChild(t.firstChild);return t.parentNode&&t.parentNode.replaceChild(n,t),n}stripClass(t){t.hasAttribute("class")&&t.removeAttribute("class")}removeStructuralWhitespace(t){[t,...Array.from(t.querySelectorAll("thead, tbody, tfoot, tr"))].forEach((t=>{Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&""===(e.textContent||"").trim()&&t.removeChild(e)}))}))}removeCellLayoutWhitespace(t){Array.from(t.children).some((t=>Er.has(t.tagName)))&&Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&""===(e.textContent||"").trim()&&t.removeChild(e)}))}normalizeSpanAttributes(t){Or.forEach((e=>{const n=t.getAttribute(e);if(null===n)return;const s=Number(n);!Ir.test(n)||s<=1?t.removeAttribute(e):t.setAttribute(e,String(s))}))}migrateCellAttributes(t){jr.forEach((({attribute:e,property:n})=>{const s=t.getAttribute(e);s&&""!==s.trim()&&this.appendStyleDeclaration(t,n,s.trim().toLowerCase()),t.removeAttribute(e)}))}migrateCellWidth(t){const e=t.getAttribute("width");t.removeAttribute("width"),this.removeMatchingStyleDeclarations(t,(t=>Nr.test(t)));const n=this.toCssWidth(e);null!==n&&this.appendStyleDeclaration(t,"width",n)}toCssWidth(t){if(null===t||""===t.trim())return null;const e=t.trim();return/^\d+(\.\d+)?$/.test(e)?`${e}px`:e}appendStyleDeclaration(t,e,n){const s=t.getAttribute("data-style")||"";if(this.styleHasProperty(s,e))return;const i=""===s.trim()?"":`${s.replace(/;\s*$/,"")}; `;t.setAttribute("data-style",`${i}${e}: ${n}`)}removeBorderAndPaddingStyles(t){this.removeMatchingStyleDeclarations(t,(t=>Rr.test(t)||Br.test(t)))}removeMatchingStyleDeclarations(t,e){const n=t.getAttribute("data-style");if(null===n||""===n.trim())return;const s=n.split(";").map((t=>t.trim())).filter((t=>""!==t)).filter((t=>{const n=t.indexOf(":");if(-1===n)return!0;const s=t.slice(0,n).trim().toLowerCase();return!e(s)}));s.length>0?t.setAttribute("data-style",s.join("; ")):t.removeAttribute("data-style")}styleHasProperty(t,e){return new RegExp(`(^|;)\\s*${e}\\s*:`,"i").test(t)}},new class{apply(t){this.nestSiblingLists(t);const e=new Set;Array.from(t.querySelectorAll("p")).forEach((t=>{this.isWordListParagraph(t)&&t.parentElement&&e.add(t.parentElement)})),Array.from(t.children).some((t=>this.isWordListParagraph(t)))&&e.add(t),e.forEach((t=>this.processContainer(t))),this.applyOrderedListTypeAttributes(t)}getAllowedTags(){return["UL","OL","LI"]}getAllowedAttributes(){return new Map}getAllowedStyles(){return["list-style"]}nestSiblingLists(t){const e=Array.from(t.querySelectorAll("ol, ul"));for(let t=e.length-1;t>=0;t--)Array.from(e[t].children).forEach((t=>{if("OL"!==t.tagName&&"UL"!==t.tagName)return;const e=t.previousElementSibling;e&&"LI"===e.tagName&&e.appendChild(t)}))}applyOrderedListTypeAttributes(t){Array.from(t.querySelectorAll("ol[type]")).forEach((t=>{const e=t.getAttribute("type")||"",n=kr[e];if(!n)return;const s=t.getAttribute("data-style")||"";if(Sr.test(s))return;const i=""===s.trim()?"":`${s.replace(/;\s*$/,"")}; `;t.setAttribute("data-style",`${i}list-style-type: ${n}`)}))}processContainer(t){const e=Array.from(t.children);let n=0;for(;n<e.length;){if(!this.isWordListParagraph(e[n])){n++;continue}const s=[];for(;n<e.length&&this.isWordListParagraph(e[n]);)s.push(e[n]),n++;this.transformRun(s,t)}}isWordListParagraph(t){if("P"!==t.tagName)return!1;const e=t.getAttribute("data-style")||"";if(fr.test(e))return!0;const n=t.getAttribute("class")||"";return yr.test(n)&&void 0!==this.findMarker(t)}transformRun(t,e){const n=t[0],s=[];t.forEach((t=>{const i=this.findMarker(t),r=this.resolveLevel(t),a=!!i&&this.isOrderedMarker(i,t),o=this.resolveListId(t);for(;s.length>0&&s[s.length-1].level>r;)s.pop();let l=s[s.length-1];const c=a&&i?this.resolveListStyleType(i,l,r,o):null,h=this.buildListItem(t,i);!l||l.level<r?l=this.openNestedList(s,e,n,a,r,c,o):this.needsSiblingList(l,a,c,o)&&(l=this.openSiblingList(s,a,r,c,o)),l.listEl.appendChild(h)})),t.forEach((t=>t.remove()))}needsSiblingList(t,e,n,s){return null!==t.listId&&null!==s&&t.listId!==s||t.ordered!==e||!!e&&this.readListStyleType(t.listEl)!==n}readListStyleType(t){const e=Sr.exec(t.getAttribute("data-style")||"");return e?e[1].trim():null}openNestedList(t,e,n,s,i,r,a){let o=t[t.length-1],l=o?o.level:0;for(;l<i-1;){const i=this.createListElement(e,s,null);this.attachList(i,o,e,n),i.appendChild(i.ownerDocument.createElement("li")),t.push({level:l+1,ordered:s,listId:a,listEl:i}),o=t[t.length-1],l=o.level}const c=t[t.length-1],h=this.createListElement(e,s,r);this.attachList(h,c,e,n);const d={level:i,ordered:s,listId:a,listEl:h};return t.push(d),d}openSiblingList(t,e,n,s,i){const r=t[t.length-1],a=this.createListElement(r.listEl,e,s),o=r.listEl.parentNode;o&&o.insertBefore(a,r.listEl.nextSibling),t.pop();const l={level:n,ordered:e,listId:i,listEl:a};return t.push(l),l}attachList(t,e,n,s){e?(e.listEl.lastElementChild||e.listEl).appendChild(t):n.insertBefore(t,s)}createListElement(t,e,n){const s=t.ownerDocument.createElement(e?"ol":"ul");return e&&n&&s.setAttribute("data-style",`list-style-type: ${n}`),s}buildListItem(t,e){const n=t.ownerDocument.createElement("li");for(e&&(this.preserveMarkerPlaceholderImages(e,t),this.removeMarker(e,t));t.firstChild;)n.appendChild(t.firstChild);return n}preserveMarkerPlaceholderImages(t,e){const n=Array.from(t.querySelectorAll("img")).filter((t=>(t.getAttribute("src")||"").startsWith("file://"))),s=e.firstChild;n.forEach((t=>{e.insertBefore(t,s)}))}removeMarker(t,e){let n=t;for(;n!==e;){const t=n.parentElement;if(n.remove(),!t||t===e||!this.isEmptyElement(t))break;n=t}}findMarker(t){return Array.from(t.querySelectorAll("span")).find((t=>vr.test(t.getAttribute("data-style")||"")))}isEmptyElement(t){return""===(t.textContent||"").replace(/[\s\u00A0]/g,"")}resolveLevel(t){const e=t.getAttribute("data-style")||"",n=gr.exec(e);return n?parseInt(n[1],10):1}resolveListId(t){const e=t.getAttribute("data-style")||"",n=mr.exec(e);if(n)return`lfo${n[1]}`;const s=wr.exec(e);return s?`l${s[1]}`:null}isOrderedMarker(t,e){const n=t.textContent.replace(/[\s\u00A0]/g,"");return!pr.test(this.resolveMarkerFont(t,e))&&(/[0-9]/.test(n)||/^[a-z]+[.)]/i.test(n))}resolveListStyleType(t,e,n,s){const i=t.textContent.replace(/[\s\u00A0]/g,"").replace(/[.)]+$/,"");if(Ar.test(i))return null;if("i"===i||"I"===i){const t="i"===i?"lower-alpha":"upper-alpha";if(this.continuesAlphaList(e,n,s,t))return t}return xr.test(i)?"lower-roman":Cr.test(i)?"upper-roman":Lr.test(i)?"lower-alpha":Tr.test(i)?"upper-alpha":null}continuesAlphaList(t,e,n,s){return!(!t||!t.ordered||t.level!==e||null!==t.listId&&null!==n&&t.listId!==n||this.readListStyleType(t.listEl)!==s)}resolveMarkerFont(t,e){let n=t;for(;n&&n!==e.parentElement;){const t=br.exec(n.getAttribute("data-style")||"");if(t)return t[1];n=n.parentElement}return""}},new class{getAllowedTags(){return["IMG"]}getAllowedAttributes(){return new Map([["IMG",["src","alt","title","width","height"]]])}getAllowedStyles(){return[]}apply(t){this.normalizeWordImageDataElements(t),this.normalizeStandardImages(t),this.liftImagesOutOfTextStyleBlocks(t),this.insertSpanBetweenAdjacentImages(t)}liftImagesOutOfTextStyleBlocks(t){Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6, p")).filter((t=>this.isImageLiftTargetBlock(t))).forEach((t=>{if(!t.parentNode)return;const e=Array.from(t.querySelectorAll("img"));let n=t;e.forEach((e=>{t.parentNode.insertBefore(e,n.nextSibling),n=e}))}))}isImageLiftTargetBlock(t){const e=t.tagName.toLowerCase();if(/^h[1-6]$/.test(e))return!0;if("p"===e){const e=(t.getAttribute("class")||"").toLowerCase();return/msotitle/.test(e)||/msosubtitle/.test(e)}return!1}normalizeWordImageDataElements(t){Array.from(t.querySelectorAll("v\\:imagedata, imagedata")).forEach((e=>{const n=e.getAttribute("src")||e.getAttribute("o:href")||e.getAttribute("href")||"",s=e.getAttribute("alt")||e.getAttribute("o:title")||e.getAttribute("title")||"",i=e.closest("v\\:shape, shape")||e;if(!n)return void i.remove();if(this.isListImage(i)&&!n.startsWith("file://"))return void i.remove();const r=t.ownerDocument.createElement("img");if(r.setAttribute("src",n),s&&r.setAttribute("alt",s),i.parentNode){const e=i.getAttribute("id")||"";e&&this.removeFallbackImagesForShapeId(t,e),i.parentNode.insertBefore(r,i),i.parentNode.removeChild(i)}}))}removeFallbackImagesForShapeId(t,e){Array.from(t.querySelectorAll("img")).forEach((t=>{(t.getAttribute("v:shapes")||t.getAttribute("shapes")||"")===e&&t.remove()}))}normalizeStandardImages(t){Array.from(t.querySelectorAll("img")).forEach((t=>{const e=t.getAttribute("src")||"";this.isListImage(t)?e.startsWith("file://")||t.remove():e||t.remove()}))}insertSpanBetweenAdjacentImages(t){Array.from(t.querySelectorAll("img")).forEach((e=>{if(!e.parentNode)return;const n=e.nextSibling;if(n&&n.nodeType===Node.ELEMENT_NODE&&"img"===n.tagName.toLowerCase()){const s=t.ownerDocument.createElement("span");s.innerHTML=" ",e.parentNode.insertBefore(s,n)}}))}isListImage(t){return Boolean(t.closest("li,ul,ol"))}},new _r,new class{apply(t){Array.from(t.querySelectorAll("[data-type]")).forEach((t=>{t.removeAttribute("data-type")})),Array.from(t.querySelectorAll("p")).forEach((t=>{const e=t.getAttribute("class"),n=this.resolveRole(e);null!==e&&t.removeAttribute("class"),n&&t.classList.add(`v-rte--text-style-${n}`)}))}getAllowedTags(){return["P","BR","SPAN","STRONG","B","EM","I","U","S","STRIKE","DEL","H1","H2","H3","H4","H5","H6","A","CODE"]}getAllowedAttributes(){return new Map([["*",["class","style"]],["A",["href","target","title"]]])}getAllowedStyles(){return["color","background","text-align","text-indent","text-decoration","margin","padding","font","line-height","letter-spacing","vertical-align"]}resolveRole(t){if(!t)return null;const e=t.toLowerCase(),n=/msoheading([1-6])/.exec(e);return n?`heading-${n[1]}`:/msosubtitle/.test(e)?"subtitle":/msotitle/.test(e)?"title":null}}],Vr=function(t){const e=new Set,n=new Set,s=new Map;t.forEach((t=>{t.getAllowedTags().forEach((t=>{e.add(t.toUpperCase())})),t.getAllowedStyles().forEach((t=>{n.add(t.toLowerCase())})),t.getAllowedAttributes().forEach(((t,e)=>{const n="*"===e?e:e.toUpperCase();s.has(n)||s.set(n,new Set);const i=s.get(n);t.forEach((t=>{i.add(t.toLowerCase())}))}))}));const i={};return s.forEach(((t,e)=>{i[e]=Array.from(t)})),{allowedTags:Array.from(e),allowedAttributes:i,allowedStylePrefixes:Array.from(n)}}(Pr),$r=["windowtext"];class Fr extends dr{get type(){return cr.WORD}canHandle(t){return!!t&&Fr.WORD_SIGNATURE_PATTERNS.some((e=>e.test(t)))}get priority(){return hr.WORD}get supportsImageProcessing(){return!0}process(t,e=Vr){if(!t)return"";const n=this.stripWordComments(t),s=ut.preserve(n).getProcessedHtml(),i=(new DOMParser).parseFromString(s,"text/html").body;return this.fixWordStructure(i),Array.from(i.childNodes).forEach((t=>{this.sanitizeNode(t,e)})),this.collapseInsignificantWhitespace(i),this.removeInterBlockWhitespace(i),this.preserveWordEmptyLines(i),this.restoreStyleAttributeName(i.innerHTML)}stripWordComments(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<!\[[\s\S]*?\]>/g,"")}fixWordStructure(t){Fr.STRUCTURE_TRANSFORMERS.forEach((e=>{e.apply(t)}))}removeInterBlockWhitespace(t){Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&""===e.textContent.trim()&&t.removeChild(e)}))}collapseInsignificantWhitespace(t){if(!_r.isCodeBlock(t))if(t.nodeType!==Node.TEXT_NODE)Array.from(t.childNodes).forEach((t=>{this.collapseInsignificantWhitespace(t)}));else{const e=t.textContent,n=e.replace(/[ \t\r\n\f]+/g," ");n!==e&&(t.textContent=n)}}preserveWordEmptyLines(t){Array.from(t.querySelectorAll("p")).forEach((t=>{if(t.querySelector("img"))return;const e=t.textContent;""===e.replace(/[\s\u200B]+/g,"")&&/\u00A0/.test(e)&&(t.textContent="")}))}sanitizeNode(t,e){if(t.nodeType===Node.TEXT_NODE)return;if(t.nodeType!==Node.ELEMENT_NODE)return void this.removeSelf(t);const n=t,s=n.tagName.toUpperCase(),i=Array.from(n.childNodes);for(let t=i.length-1;t>=0;t--)this.sanitizeNode(i[t],e);if(e.allowedTags.includes(s))this.sanitizeAttributes(n,s,e);else{for(;n.firstChild;)n.parentNode&&"function"==typeof n.parentNode.insertBefore&&n.parentNode.insertBefore(n.firstChild,n);this.removeSelf(n)}}sanitizeAttributes(t,e,n){const s=new Set([...n.allowedAttributes["*"]||[],...n.allowedAttributes[e]||[]]);Array.from(t.attributes).forEach((e=>{const i=e.name.toLowerCase(),r="data-style"===i;s.has(r?"style":i)?r&&this.sanitizeStyleAttribute(t,e.name,n):t.removeAttribute(e.name)}))}sanitizeStyleAttribute(t,e,n){const s=t.getAttribute(e)||"",i=t.ownerDocument.createElement("span");i.setAttribute("style",s);const r=i.style,a=[];for(let t=0;t<r.length;t++){const e=r[t],s=n.allowedStylePrefixes.some((t=>e===t||e.startsWith(`${t}-`))),i=r.getPropertyValue(e),o=i.toLowerCase(),l=$r.some((t=>o.includes(t)));s&&!l&&a.push(`${e}: ${i}`)}const o=a.join("; ");o?t.setAttribute(e,o):t.removeAttribute(e)}restoreStyleAttributeName(t){return t.replace(/\sdata-style=/g," style=")}removeSelf(t){t.parentNode&&"function"==typeof t.parentNode.removeChild&&t.parentNode.removeChild(t)}}Fr.STRUCTURE_TRANSFORMERS=[...Pr],Fr.WORD_SIGNATURE_PATTERNS=[/content=["']?Microsoft\s+Word/i,/urn:schemas-microsoft-com:office/i,/class=["']?Mso[A-Za-z]/i,/mso-[a-z-]+\s*:/i,/<\/?o:p>/i];class zr extends dr{get type(){return cr.PLAIN}get consumesPlainText(){return!0}canHandle(){return!1}process(t,e=!1){return t&&He()?Q(J(t,e)):""}transform(t){const e=this.getPlainTextSource(t);return{html:this.process(e.text,e.hasEncodedWhitespace),text:e.text,mode:this.type,markers:e.hasEncodedWhitespace?{[Y]:"true"}:{},extractImages:!1,imagesToExtract:[]}}getPlainTextSource(t){if(!t.html)return{text:t.text||"",hasEncodedWhitespace:!1};const e=Tt(t.html);if(t.text&&t.text.includes("\t")&&e)return{text:t.text,hasEncodedWhitespace:!1};const n=At(t.html,{preserveBoundaryBlankLines:!e,keepPreservedWhitespaceMarkers:!0});return n?{text:n,hasEncodedWhitespace:!0}:{text:t.text||"",hasEncodedWhitespace:!1}}}class Kr{constructor(){this.defaultStrategy=new ur,this.strategies=[new zr,new Fr,this.defaultStrategy]}select(t,e){return e&&e!==cr.RICH?this.selectStrategyByType(e):this.selectStrategy(t.html)}selectStrategy(t){return this.selectHighestPriorityStrategy(this.strategies.filter((e=>e.canHandle(t))))}selectStrategyByType(t){return this.selectHighestPriorityStrategy(this.strategies.filter((e=>e.type===t)))}registerStrategy(t){this.strategies.push(t)}selectHighestPriorityStrategy(t){return t.sort(((t,e)=>e.priority-t.priority))[0]||this.defaultStrategy}}class Wr{parseLocalImages(t,e){if(!t.includes("<img"))return{html:t,previews:[]};const n=t.replace(/\s+style=/g," data-style="),s=(new DOMParser).parseFromString(n,"text/html"),i=Array.from(s.querySelectorAll("img")).filter((t=>t.src.startsWith("file://")));if(0===i.length)return{html:t,previews:[]};const r=this.extractImageFiles(e,i);if(0===r.length)return{html:t,previews:[]};const a=this.createImagePreviews(i,r);return{html:s.body.innerHTML.replace(/ data-style=/g," style="),previews:a}}createImagePreviews(e,n){const s=[];return e.forEach(((e,i)=>{if(this.isListImage(e))return void e.remove();const r=n[i];if(!r)return;const a=URL.createObjectURL(r);e.setAttribute("src",a);const o=t();e.setAttribute(Wr.PREVIEW_IMG_KEY,o),s.push({id:o,file:r,objectUrl:a})})),s}extractImageFiles(t,e){let n=[];return t&&(t.rtf&&(n=this.safeExtractWordImages(t.rtf,e)),0===n.length&&t.files&&(n=t.files.filter((t=>t.type.startsWith("image/"))))),n}safeExtractWordImages(t,e){const n=this.stripListPictureDefinitions(t),s=[];return[...n.matchAll(/\\pngblip|\\jpegblip/g)].forEach(((t,i)=>{if(i>=e.length||void 0===t.index)return;const r=t[0].includes("png")?"image/png":"image/jpeg",a=this.extractImageBytes(n,t.index+t[0].length);if(0===a.length)return;const o=r.split("/")[1],l=new File([new Uint8Array(a)],`word_img_${Date.now()}_${i}.${o}`,{type:r});s.push(l)})),s}stripListPictureDefinitions(t){return this.removeBalancedGroups(t,"{\\*\\listpicture")}removeBalancedGroups(t,e){let n=t.indexOf(e);for(;-1!==n;){const s=this.findGroupEnd(t,n);n=(t=t.slice(0,n)+t.slice(s)).indexOf(e,n)}return t}findGroupEnd(t,e){const n=t.length;let s=0,i=e;for(;i<n;){const e=t[i];if("\\"!==e){if("{"===e)s++;else if("}"===e&&(s--,0===s))return i+1;i++}else i+=2}return n}extractImageBytes(t,e){const n=t.length,s=[];let i=0,r=-1,a=e;for(;a<n;){const e=t[a];if("{"===e){i++,a++;continue}if("}"===e){if(0===i)break;i--,a++;continue}if(i>0){a++;continue}if("\\"===e){for(a++;a<n&&/[a-zA-Z]/.test(t[a]);)a++;for(a<n&&"-"===t[a]&&a++;a<n&&/[0-9]/.test(t[a]);)a++;continue}const o=this.hexNibble(e);o>=0&&(r<0?r=o:(s.push(r<<4|o),r=-1)),a++}return s}hexNibble(t){return t>="0"&&t<="9"?t.charCodeAt(0)-48:t>="a"&&t<="f"?t.charCodeAt(0)-87:t>="A"&&t<="F"?t.charCodeAt(0)-55:-1}isListImage(t){return Boolean(t.closest("li,ul,ol"))}}Wr.PREVIEW_IMG_KEY="data-rte-id";class qr extends v{constructor(t,e){super(),this.type="REPLACE_IMAGE_SRC",this.img=t,this.url=e}}class Ur{constructor(){this.ownedImageIds=new Set,this.pendingNotifyImageIds=[]}register(t){this.pendingNotifyImageIds=[],t.forEach((t=>{this.pendingNotifyImageIds.push(t.id),this.ownedImageIds.add(t.id),Ur.pendingImages.set(t.id,t)}))}hasPendingNotifications(){return this.pendingNotifyImageIds.length>0}notifyInserted(t,e,n){const s=this.pendingNotifyImageIds.map((t=>Ur.pendingImages.get(t))).filter((t=>!!t));this.pendingNotifyImageIds=[],s.length&&"function"==typeof t&&(s.forEach((t=>t.notified=!0)),t(s.map((t=>({id:t.id,file:t.file}))),((t,s)=>this.replaceUrl(t,s,e,n))))}discardUnsentPreviews(){this.ownedImageIds.forEach((t=>{const e=Ur.pendingImages.get(t);e&&e.notified||(e&&e.objectUrl.startsWith("blob:")&&URL.revokeObjectURL(e.objectUrl),Ur.pendingImages.delete(t),this.ownedImageIds.delete(t))})),this.pendingNotifyImageIds=[]}replaceUrl(t,e,n,s){var i;const r=n();if(r){const n=null!==(i=r.querySelector(`img[data-rte-id="${t}"]`))&&void 0!==i?i:null;if(n){const t=s(n);t&&t.apply(new qr(n,e))}}const a=Ur.pendingImages.get(t);a&&(a.objectUrl.startsWith("blob:")&&URL.revokeObjectURL(a.objectUrl),Ur.pendingImages.delete(t),this.ownedImageIds.delete(t))}}Ur.pendingImages=new Map;class Gr{constructor(t,e){this.getHostElement=t,this.getSelectionRange=e}compute(t){var e,n,s;const i=this.getHostElement();if(!i)return{left:0,top:0,placement:["bottom","top"]};const r=i.getBoundingClientRect(),a=null!==(n=null===(e=i.ownerDocument.defaultView)||void 0===e?void 0:e.innerHeight)&&void 0!==n?n:window.innerHeight,o=t,l="number"==typeof o.clientX&&o.clientX>0&&"number"==typeof o.clientY&&o.clientY>0,c=l?null:this.getCaretRect(),h=12,d=l?o.clientX:null!==(s=null==c?void 0:c.left)&&void 0!==s?s:r.left+h,u=l?o.clientY:c?c.bottom:r.top+40,p=Math.max(r.left+h,r.right-220),f=Math.min(Math.max(d,r.left+h),p),g=Math.max(u+8,r.top+h),w=a-g-h;return{left:f,top:g,placement:w>=88||w>=g-h?["bottom","top"]:["top","bottom"]}}getCaretRect(){const t=this.getSelectionRange();if(!t)return null;const e=t.getBoundingClientRect();if(!this.isUnavailableRect(e))return e;const n=t.getClientRects();return n.length>0?n[0]:this.getRangeContainerRect(t)}isUnavailableRect(t){return 0===t.width&&0===t.height&&0===t.left&&0===t.top}getRangeContainerRect(t){var e,n,s,i,r,a;const o=null!==(e=t.startContainer)&&void 0!==e?e:null;if(!o)return null;if(o.nodeType===Node.ELEMENT_NODE){const e=o,a=null!==(n=e.childNodes[t.startOffset-1])&&void 0!==n?n:null,l=null!==(s=e.childNodes[t.startOffset])&&void 0!==s?s:null;return null!==(r=null!==(i=this.getNodeRect(a))&&void 0!==i?i:this.getNodeRect(l))&&void 0!==r?r:this.getNodeRect(e)}return null!==(a=this.getNodeRect(o))&&void 0!==a?a:this.getNodeRect(o.parentNode)}getNodeRect(t){var e,n;if(!t)return null;if(t.nodeType===Node.TEXT_NODE)return null!==(n=null===(e=t.parentElement)||void 0===e?void 0:e.getBoundingClientRect())&&void 0!==n?n:null;if(t.nodeType===Node.ELEMENT_NODE){const e=t.getBoundingClientRect();return this.isUnavailableRect(e)?null:e}return null}}class Zr{constructor(t=new Wr){this.parser=t}extract(t,e,n){return this.parser.parseLocalImages(t,{files:e,rtf:n})}}class Qr{constructor(t,e,n){this.selector=t,this.imageExtractor=e,this.pendingImageRegistry=n}process(t,e){const n={html:t.html,text:t.text,files:t.files,rtf:t.rtf},s=this.selector.select(n,e).transform(n);if(!s.extractImages)return s;const i=this.imageExtractor.extract(s.html,s.imagesToExtract,n.rtf);return i.previews.length>0&&this.pendingImageRegistry.register(i.previews),Object.assign(Object.assign({},s),{html:i.html})}}class Jr{build(t){const e=Object.assign({},t.markers);Jr.RESERVED_KEYS.forEach((t=>delete e[t]));const n=Object.assign(Object.assign({},e),{"text/html":t.html,"text/plain":t.text,[X]:t.mode});if("undefined"!=typeof DataTransfer){const t=new DataTransfer;return Object.keys(n).forEach((e=>{const s=n[e];s&&t.setData(e,s)})),t}return{getData:t=>{var e;return null!==(e=n[t])&&void 0!==e?e:""}}}}Jr.RESERVED_KEYS=["text/html","text/plain",X];class Yr{dispatch(t,e){const n=new CustomEvent("beforeinput",{bubbles:!0,cancelable:!0});try{Object.defineProperties(n,{inputType:{value:"insertFromPaste",configurable:!0},dataTransfer:{value:e,configurable:!0}})}catch(t){Object.assign(n,{inputType:"insertFromPaste",dataTransfer:e})}t.dispatchEvent(n)}}class Xr{constructor(t){this.getContext=t}capture(){var t;const e=this.getContext(),n=null==e?void 0:e.getSelection();return{range:n&&n.rangeCount>0?n.getRangeAt(0).cloneRange():null,selectedNodes:[...(null===(t=null==e?void 0:e.getSelectedNodes)||void 0===t?void 0:t.call(e))||[]]}}restore(t){this.restoreRange(t.range),this.restoreControllerState(t)}restoreControllerState(t){const e=this.getContext();t.range&&e&&e.setSelectedNodes(t.selectedNodes||[],{startNode:t.range.startContainer,endNode:t.range.endContainer,startOffset:t.range.startOffset,endOffset:t.range.endOffset})}restoreRange(t){var e;if(!t)return;const n=null===(e=this.getContext())||void 0===e?void 0:e.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}}class ta{constructor(t,e){this.selectionSnapshotService=t,this.onPasteCaptured=e,this.editableEl=null,this.handlePasteEvent=t=>{const e=t.clipboardData;if(!e)return;const n=e.getData("text/html")||"",s=e.getData("text/plain")||"",i=e.getData("text/rtf")||"";if(!n&&!s)return t.preventDefault(),void t.stopPropagation();t.preventDefault(),t.stopPropagation();const r=this.selectionSnapshotService.capture(),a=e.files?Array.from(e.files):[];this.onPasteCaptured({html:n,text:s,range:r.range,selectedNodes:r.selectedNodes,files:a,rtf:i},t)}}attach(t){var e;this.detach(),this.editableEl=t,null===(e=this.editableEl)||void 0===e||e.addEventListener("paste",this.handlePasteEvent)}detach(){var t;null===(t=this.editableEl)||void 0===t||t.removeEventListener("paste",this.handlePasteEvent),this.editableEl=null}}class ea{constructor(t,e,n={}){this.hostRoot=t,this.callbacks=e,this.options=n,this.chooserEl=null,this.dropdownEl=null,this.triggerButtonEl=null}open(t){this.destroy();const e=this.hostRoot.ownerDocument,n=e.createElement("div");n.setAttribute(ea.CHOOSER_ATTR,"true"),n.style.position="fixed",n.style.zIndex="1000",n.style.left=`${t.left}px`,n.style.top=`${t.top}px`;const s=this.createPasteChooserDropdown(e,t.placement);s.placement=t.placement,n.append(s),this.hostRoot.appendChild(n),this.chooserEl=n,this.dropdownEl=s,s.addEventListener("vegaShow",(()=>{this.triggerButtonEl&&(this.triggerButtonEl.selected=!0)})),s.addEventListener("vegaHide",(()=>{this.triggerButtonEl&&(this.triggerButtonEl.selected=!1)}))}destroy(){var t;this.dropdownEl&&"function"==typeof this.dropdownEl.hide&&this.dropdownEl.hide(),(null===(t=this.chooserEl)||void 0===t?void 0:t.parentNode)&&this.chooserEl.parentNode.removeChild(this.chooserEl),this.triggerButtonEl&&(this.triggerButtonEl.selected=!1),this.dropdownEl=null,this.chooserEl=null,this.triggerButtonEl=null}includesEventPath(t){if(!this.chooserEl)return!1;const e=t.some((t=>"tagName"in t&&"VEGA-DROPDOWN-CONTENT-BOX"===t.tagName));return t.includes(this.chooserEl)||e}createPasteChooserDropdown(t,e){const n=t.createElement("vega-dropdown");n.trigger="click",n.selectType="single",n.selectedSourceKey="rich",n.maxWidth=220,n.alignment="start",n.itemDisplayRule="ellipsis",n.isScreenPosition=!0;const s=t.createElement("vega-rich-text-editor-toolbar-button"),i="top"===e[0]?"chevron-up":"chevron-down";s.setAttribute(ea.CHOOSER_TRIGGER_ATTR,"true"),s.setAttribute("aria-label",w.t("Paste options")),s.setAttribute("arrow-icon",i),s.icon="rte-paste",s.showArrowIcon=!0,s.selected=!1,this.triggerButtonEl=s;const r=t.createElement("vega-tooltip");r.text=w.t("Paste options"),r.placement=["bottom","top"],r.append(s),n.append(r);const a=t.createElement("div");a.setAttribute("slot","items");const o=[this.createDropdownItem(t,cr.RICH,w.t("Use rich text"),ea.CHOOSER_RICH_ATTR),this.createDropdownItem(t,cr.PLAIN,w.t("Use plain text"),ea.CHOOSER_PLAIN_ATTR)];return this.options.showWordOption&&o.push(this.createDropdownItem(t,cr.WORD,w.t("Use Word"),ea.CHOOSER_WORD_ATTR)),a.append(...o),n.append(a),n.addEventListener("vegaDropdownClick",(t=>{const e=t.detail;e!==cr.RICH&&e!==cr.PLAIN&&e!==cr.WORD||this.callbacks.onModeSelect(e)})),n}createDropdownItem(t,e,n,s){const i=t.createElement("vega-dropdown-item");return i.itemKey=e,i.label=n,i.setAttribute(s,"true"),i}}vt.register({"rte-paste":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M80 96v16c0 17.7 14.3 32 32 32h60.8c16.6-28.7 47.6-48 83.2-48h62c-7.1-27.6-32.2-48-62-48H215.4C211.6 20.9 188.2 0 160 0s-51.6 20.9-55.4 48H64C28.7 48 0 76.7 0 112V384c0 35.3 28.7 64 64 64h96V400H64c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H80zm64-40a16 16 0 1 1 32 0 16 16 0 1 1 -32 0zM256 464c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H384v48c0 17.7 14.3 32 32 32h48V448c0 8.8-7.2 16-16 16H256zm192 48c35.3 0 64-28.7 64-64V227.9c0-12.7-5.1-24.9-14.1-33.9l-51.9-51.9c-9-9-21.2-14.1-33.9-14.1H256c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></svg>'}}),ea.CHOOSER_ATTR="data-rte-paste-chooser",ea.CHOOSER_RICH_ATTR="data-rte-paste-type-rich",ea.CHOOSER_PLAIN_ATTR="data-rte-paste-type-plain",ea.CHOOSER_WORD_ATTR="data-rte-paste-type-word",ea.CHOOSER_TRIGGER_ATTR="data-rte-paste-trigger";class na{constructor(t,e,n){this.positioner=t,this.onModeSelect=e,this.onClearPayload=n,this.chooserUI=null,this.listenerDocument=null,this.listenerWindow=null,this.contentHostEl=null,this.handleOutsidePointerDown=t=>{if(!this.chooserUI)return;const e="function"==typeof t.composedPath?t.composedPath():[];this.chooserUI.includesEventPath(e)||this.clear()},this.handleOutsideKeyDown=t=>{"Escape"===t.key&&this.clear()},this.handleOutsideScroll=()=>this.clear()}get ui(){return this.chooserUI}open(t,e,n,s){var i,r,a;const o=null!==(i=null==t?void 0:t.shadowRoot)&&void 0!==i?i:null;if(!o||!t)return;this.clear(!1);const l=this.positioner.compute(n);this.chooserUI=new ea(o,{onModeSelect:this.onModeSelect},{showWordOption:s}),this.chooserUI.open(l),this.contentHostEl=e,this.listenerDocument=t.ownerDocument,this.listenerWindow=this.listenerDocument.defaultView,this.listenerDocument.addEventListener("mousedown",this.handleOutsidePointerDown,!0),this.listenerDocument.addEventListener("keydown",this.handleOutsideKeyDown,!0),this.listenerDocument.addEventListener("scroll",this.handleOutsideScroll,!0),null===(r=this.listenerWindow)||void 0===r||r.addEventListener("scroll",this.handleOutsideScroll,!0),null===(a=this.contentHostEl)||void 0===a||a.addEventListener("scroll",this.handleOutsideScroll)}clear(t=!0){var e,n,s;null===(e=this.contentHostEl)||void 0===e||e.removeEventListener("scroll",this.handleOutsideScroll),this.contentHostEl=null,null===(n=this.listenerWindow)||void 0===n||n.removeEventListener("scroll",this.handleOutsideScroll,!0),this.listenerWindow=null,this.listenerDocument&&(this.listenerDocument.removeEventListener("mousedown",this.handleOutsidePointerDown,!0),this.listenerDocument.removeEventListener("keydown",this.handleOutsideKeyDown,!0),this.listenerDocument.removeEventListener("scroll",this.handleOutsideScroll,!0),this.listenerDocument=null),null===(s=this.chooserUI)||void 0===s||s.destroy(),this.chooserUI=null,t&&this.onClearPayload()}}class sa extends wt{constructor(t={}){super(),this.editableEl=null,this.contentHostEl=null,this.pendingPastePayload=null,this.handlePasteEvent=t=>{this.pasteEventInterceptor.handlePasteEvent(t)},this.handleOutsidePointerDown=t=>{this.pasteChooserController.handleOutsidePointerDown(t)},this.handleOutsideKeyDown=t=>{this.pasteChooserController.handleOutsideKeyDown(t)},this.handleOutsideScroll=()=>{this.pasteChooserController.handleOutsideScroll()},this.options=t,this.strategySelector=new Kr,this.imageParser=new Wr,this.pendingImageRegistry=new Ur,this.chooserPositioner=new Gr((()=>this.hostEl),(()=>{var t,e;return null!==(e=null===(t=this.pendingPastePayload)||void 0===t?void 0:t.range)&&void 0!==e?e:this.cloneCurrentSelectionRange()})),this.processingPipeline=new Qr(this.strategySelector,new Zr(this.imageParser),this.pendingImageRegistry),this.dataTransferBuilder=new Jr,this.pasteDispatcher=new Yr,this.selectionSnapshotService=new Xr((()=>this.extensionContext)),this.pasteEventInterceptor=new ta(this.selectionSnapshotService,((t,e)=>{this.pendingPastePayload=t,this.renderPasteChooser(e)})),this.pasteChooserController=new na(this.chooserPositioner,(t=>this.applyPasteMode(t)),(()=>{this.pendingPastePayload=null}))}initialExtensionAfterLoad(t){super.initialExtensionAfterLoad(t),this.hostEl=t.host,this.attachPasteListener()}destroyExtension(){this.detachPasteListener(),this.clearPasteChooser(),this.pendingImageRegistry.discardUnsentPreviews()}get chooserUI(){return this.pasteChooserController.ui}attachPasteListener(){const{editableEl:t,contentHostEl:e}=this.getEditorElements();this.editableEl=t,this.contentHostEl=e,this.pasteEventInterceptor.attach(this.editableEl)}detachPasteListener(){this.pasteEventInterceptor.detach(),this.editableEl=null,this.contentHostEl=null}getEditorElements(){var t,e,n,s,i;const r=null!==(n=null===(e=null===(t=this.hostEl)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelector("vega-rich-text-content"))&&void 0!==n?n:null;return{editableEl:null!==(i=null===(s=null==r?void 0:r.shadowRoot)||void 0===s?void 0:s.querySelector(".rich-text-content"))&&void 0!==i?i:null,contentHostEl:r}}getEditableElement(){const{editableEl:t}=this.getEditorElements();return t}cloneCurrentSelectionRange(){return this.selectionSnapshotService.capture().range}renderPasteChooser(t){var e;this.pasteChooserController.open(this.hostEl,this.contentHostEl,t,!0===(null===(e=this.options)||void 0===e?void 0:e.enableWordPaste))}applyPasteMode(t){var e;if(!this.pendingPastePayload)return void this.clearPasteChooser();const n=null!==(e=this.editableEl)&&void 0!==e?e:this.getEditableElement();if(!n)return void this.clearPasteChooser();n.focus(),this.selectionSnapshotService.restore(this.pendingPastePayload);const s=this.processingPipeline.process(this.pendingPastePayload,t),i=this.dataTransferBuilder.build(s);this.pasteDispatcher.dispatch(n,i),this.clearPasteChooser(),this.emitLocalImageInsertedEvent()}emitLocalImageInsertedEvent(){this.pendingImageRegistry.hasPendingNotifications()&&this.pendingImageRegistry.notifyInserted(this.options.imageInsertedCallback,(()=>{var t;return null!==(t=this.editableEl)&&void 0!==t?t:this.getEditableElement()}),(t=>this.getDTOEntityByDom(t)))}clearPasteChooser(t=!0){this.pasteChooserController.clear(t)}}wt.registerActionHandleStrategy(pt.typeName,"REPLACE_IMAGE_SRC",new class extends O{handleAction(t,e){const{img:n,url:s}=t;if(n.setAttribute("src",s),n.removeAttribute(Wr.PREVIEW_IMG_KEY),e.url=s,e.annotationMap&&e.annotationMap.has("CUSTOM_ATTRIBUTE")){const t=e.annotationMap.get("CUSTOM_ATTRIBUTE");t.customAttribute.src=s,delete t.customAttribute[Wr.PREVIEW_IMG_KEY]}}});class ia extends v{constructor(t,e){super(),this.type="COPY_SELECTED_CONTENT_ACTION",this.selection=null,this.selectedNodes=[],this.copyResult=null,this.selection=t,this.selectedNodes=e}}class ra extends xt{render(t,e){return this.renderButton(t,e,{icon:"rte-copy",ariaLabel:e.translation.t("Copy"),tooltip:{text:"Copy"}})}isDisabled(t){const e=this.getExtensionContext(t.host);return!e||e.host.disabled||!e.getSelection()||e.getSelection().isCollapsed}handleButtonClick(t){const e=this.getExtensionContext(t.host);e&&e.host&&e.host.value.apply(new ia(e.getSelection(),e.getSelectedNodes()))}handleDropdownClick(){}}vt.register({"rte-copy":$e});class aa extends wt{prepareBeforeLoad(t){this.registerToolbarButtonRenderer(aa.TOOLBAR_BUTTON_KEY,new ra,t)}}b.register("COPY_SELECTED_CONTENT_ACTION",nt.typeName,new class extends O{handleAction(t){const e=this.getParentBlocks(t.selectedNodes),{html:n,text:s}=this.getSelectedContent(t.selection,e);(s||n)&&(t.copyResult=this.copyToClipboard(n,s))}getSelectedContent(t,e){const n={html:"",text:""};if(!t||0===t.rangeCount||t.isCollapsed)return n;const s=t.getRangeAt(0),i=He();if(!i)return n;const r=s.cloneContents(),a=i.createElement("div"),o=s.commonAncestorContainer;if(1===e.length){const t=this.getDOMByEntity(e[0]);if(t&&t.contains(o)){const e=this.wrapWithAncestorChain(r,o,t);return a.appendChild(e),n.html=a.innerHTML,n.text=a.textContent,n}}else if(e.length>1&&e.every((t=>"list-item"===t.type))){const t=e[0].parent;if(t&&e.every((e=>e.parent===t))){const e=this.getDOMByEntity(t);if(e&&e.contains(o)){const t=e.cloneNode(!1);return t.appendChild(r),a.appendChild(t),n.html=a.innerHTML,n.text=a.textContent,n}}}return a.appendChild(r),n.html=a.innerHTML,n.text=a.textContent,n}wrapWithAncestorChain(t,e,n){const s=n.cloneNode(!1),i=e.nodeType===Node.TEXT_NODE?e.parentElement:e;if(i===n)return s.appendChild(t),s;const r=i.cloneNode(!1);r.appendChild(t);let a=r,o=i.parentElement;for(;o&&o!==n;){const t=o.cloneNode(!1);t.appendChild(a),a=t,o=o.parentElement}if(s.appendChild(a),"LI"===s.tagName&&o&&o.parentElement&&"OL"===o.parentElement.tagName){const t=o.parentElement.cloneNode(!1);return t.appendChild(s),t}return s}getParentBlocks(t){const e=[];for(const n of t){const t=n.parent;t&&!e.includes(t)&&e.push(t)}return e}async copyToClipboard(t,e){let n=!1;try{const s=new Blob([t],{type:"text/html"}),i=new Blob([e],{type:"text/plain"}),r=new ClipboardItem({"text/html":s,"text/plain":i});await navigator.clipboard.write([r]),n=!0}catch(s){n=this.copyWithExecCommand(t,e),n||o.warn("Failed to copy the selected content to the clipboard. Use keyboard shortcuts instead.")}return n}copyWithExecCommand(t,e){const n=He();if(!n)return!1;const s=n=>{n.clipboardData&&(n.clipboardData.setData("text/html",t),n.clipboardData.setData("text/plain",e)),n.preventDefault()};n.addEventListener("copy",s);try{return n.execCommand("copy")}finally{n.removeEventListener("copy",s)}}}),aa.TOOLBAR_BUTTON_KEY="copy";class oa extends v{constructor(t,e,n=!1){super(),this.type=M.DELETE_SELECTED_CONTENT,this.mergeFlag=!1,this.host=t,this.mergeFlag=e,this.isFlushable=n}}class la extends ra{render(t,e){return this.renderButton(t,e,{icon:"rte-cut",ariaLabel:e.translation.t("Cut"),tooltip:{text:"Cut"}})}async handleButtonClick(t){const e=this.getExtensionContext(t.host);if(e&&e.host){const{host:t}=e,n=new ia(e.getSelection(),e.getSelectedNodes());t.value.apply(n),await n.copyResult&&t.value.apply(new oa(t,!0,!0))}}}vt.register({"rte-cut":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --\x3e<path fill="currentColor" d="M48 112a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm176 0C224 50.1 173.9 0 112 0S0 50.1 0 112 50.1 224 112 224c24 0 46.3-7.6 64.5-20.4l57.3 52.4-57.3 52.4C158.3 295.6 136 288 112 288 50.1 288 0 338.1 0 400s50.1 112 112 112 112-50.1 112-112c0-20.5-5.5-39.6-15.1-56.2L504.2 73.7c9.8-8.9 10.5-24.1 1.5-33.9s-24.1-10.5-33.9-1.5l-202.4 185.2-60.5-55.3c9.6-16.5 15.1-35.7 15.1-56.2zM471.8 473.7c9.8 8.9 25 8.3 33.9-1.5s8.3-25-1.5-33.9L338.6 286.8 302.7 319 471.8 473.7zM48 400a64 64 0 1 1 128 0 64 64 0 1 1 -128 0z"/></svg>'}});class ca extends wt{prepareBeforeLoad(t){this.registerToolbarButtonRenderer(ca.TOOLBAR_BUTTON_KEY,new la,t)}}ca.TOOLBAR_BUTTON_KEY="cut";const ha={showCharCount:!0,countInlineBreak:!1,hardLimit:!1};class da extends wt{constructor(t={}){super(),this.type=tt,this.config=Object.assign(Object.assign({},ha),t)}getConfig(){return this.config}getData(t){const e=t.getPlainText(),{maxChars:n,hardLimit:s}=this.config;return{count:this.calculateTextCount(e),maxChars:n,hardLimit:s}}calculateTextCount(t){const{countInlineBreak:e}=this.config;return[...e?t:t.replace(/\n/g,"")].length}}wt.registerActionHandlerInterceptor(nt.typeName,ft,new class extends Ct{canIntercept(t){var e;const n=null===(e=t.host.extensions)||void 0===e?void 0:e.find((t=>this.isWordCountExtension(t)));if(!n)return!1;const{hardLimit:s,maxChars:i}=n.getConfig(),r=t.candidate.getPlainText(),a=n.calculateTextCount(r);if(!bt(i)||a<=i)return!1;let o=!1,l="";return s&&t.previous&&(l=t.previous.getPlainText(),o=a>n.calculateTextCount(l)),this.notifyCharsLimitExceeded(r,l,n,t),o}intercept(){}notifyCharsLimitExceeded(t,e,n,s){const{maxChars:i,hardLimit:r,onCharsLimitExceeded:a}=n.getConfig();"function"==typeof a&&(r&&e===t||a(s.host,i))}isWordCountExtension(t){return t.type===tt}});class ua extends O{handleAction(e,n){const{rteRange:s,token:i}=e;if(s&&s.startNode){const{key:r,label:a,customAttrs:o={wrapped:"true"}}=i,l=new gn(t(),r,a,n);l.annotationMap.set("CUSTOM_ATTRIBUTE",new P(o)),n.apply(new St(s,l)),e.actionHandleResult=!0}}}const pa=new class extends it{canHandle(t,e){const n=t[e];return"SPAN"===n.nodeName&&n.classList.contains("token")&&n.hasAttribute("token-key")?1:0}handle(e,n,s){const i=e[0],r=i.getAttribute("token-key"),a=i.textContent,o=rt.generate(y,i),{customAttribute:l}=o,c=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]])}return n}(o,["customAttribute","customClass"]);return{id:t(),type:"token",token:r,text:a,annotations:Object.assign(Object.assign(Object.assign({},c),(null==s?void 0:s.inlineHtml)?{inlineHtml:s.inlineHtml}:{}),{customAttribute:this.createCustomAttrs(l)})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}createCustomAttrs(t){const e=Object.assign(Object.assign({},t),{contenteditable:null,"template-token-key":null,"token-key":null,wrapped:"false"===t.wrapped?"false":"true"});return _e(e)}};class fa extends wt{constructor(t=[]){super(),this.tokenRenderer=new wn,this.tokenList=t,this.registerNode("token",gn),this.registerRenderer("token",this.tokenRenderer),this.registerElementToNodeDTOClassStrategy(pa)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(fa.TOOLBAR_BUTTON_KEY,new fn(this.tokenList),t)}}(()=>{const t=new ua;wt.registerActionHandleStrategy(A.typeName,"INSERT_TOKEN_NODE",t),wt.registerActionHandleStrategy(q.typeName,"INSERT_TOKEN_NODE",t)})(),fa.TOOLBAR_BUTTON_KEY="token";export{da as A,un as B,gn as C,wn as D,mn as E,wi as F,oa as G,fn as R,Ke as V,Ge as a,Je as b,tn as c,ln as d,dn as e,fa as f,vn as g,Gi as h,Vn as i,ti as j,ui as k,ki as l,ji as m,Ui as n,Ni as o,Ei as p,Oi as q,Ii as r,Ri as s,Bi as t,rr as u,sa as v,rn as w,lr as x,aa as y,ca as z}
|