@globalpayments/vega 2.91.0 → 2.92.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.
Files changed (476) hide show
  1. package/dist/cjs/{app-globals-7bb10088.js → app-globals-2f326662.js} +13 -10
  2. package/dist/cjs/{child-nodes-event-prevent-slimmer-76d19d56.js → child-nodes-event-prevent-slimmer-b9a5b3e2.js} +1 -1
  3. package/dist/cjs/{code-block-c1039791.js → code-block-6435d641.js} +24 -1
  4. package/dist/cjs/{component-value-history-controller-slimmer.abstract-1d36641d.js → component-value-history-controller-slimmer.abstract-e4c9a5ba.js} +3 -3
  5. package/dist/cjs/{content-state-a6105949.js → content-state-96ec9114.js} +32 -3
  6. package/dist/cjs/copy-d021c780.js +7 -0
  7. package/dist/cjs/{date-required-rule-c4997459.js → date-required-rule-8c9e312b.js} +1 -1
  8. package/dist/cjs/{design-token-f65eab4a.js → design-token-3548af29.js} +3 -3
  9. package/dist/cjs/{element-appender-slimmer-316668d0.js → element-appender-slimmer-3bf69990.js} +3 -3
  10. package/dist/cjs/{file-uploader-required-rule-cc51d4ab.js → file-uploader-required-rule-5520bbec.js} +1 -1
  11. package/dist/cjs/{form-field-controller-slimmer-b0c35330.js → form-field-controller-slimmer-e0efac05.js} +1 -1
  12. package/dist/cjs/{image-annotation-action-e4596726.js → image-annotation-action-853f72c8.js} +2 -2
  13. package/dist/cjs/index-58ea899e.js +4 -0
  14. package/dist/cjs/index.cjs.js +25 -20
  15. package/dist/cjs/{inject-keyboard-manager-1f5bbb19.js → inject-keyboard-manager-0dccff1a.js} +1 -1
  16. package/dist/cjs/{internal-calendar-period-factory-9c66cf36.js → internal-calendar-period-factory-6187ec4c.js} +1 -1
  17. package/dist/cjs/{internal-translation-controller-5905469e.js → internal-translation-controller-48ebfd0f.js} +14 -0
  18. package/dist/cjs/{keyboard-manager-61e8ce38.js → keyboard-manager-dfe8d924.js} +1 -1
  19. package/dist/cjs/{keyboard-manager-slimmer-079a7e87.js → keyboard-manager-slimmer-4a2560a1.js} +1 -1
  20. package/dist/cjs/{link-extension-a7ac28f3.js → link-extension-28d95849.js} +3 -3
  21. package/dist/cjs/loader.cjs.js +14 -13
  22. package/dist/cjs/{month-view-generator-48215a05.js → month-view-generator-2e59b188.js} +1 -1
  23. package/dist/cjs/{public-rules-66540638.js → public-rules-8727c42c.js} +10 -10
  24. package/dist/cjs/{range-dea19a90.js → range-5cb3d1e4.js} +25 -3
  25. package/dist/cjs/{replace-selected-text-action-6d1ebbf9.js → replace-selected-text-action-a31563ed.js} +1 -1
  26. package/dist/cjs/{required-field-rule-b12a29e1.js → required-field-rule-400690c3.js} +1 -1
  27. package/dist/cjs/{responsive-format-facade-10ff730e.js → responsive-format-facade-98b89142.js} +2 -2
  28. package/dist/cjs/{rich-text-editor-required-rule-63492ca3.js → rich-text-editor-required-rule-8e4d577d.js} +1 -1
  29. package/dist/cjs/{split-cell-operation-30e5dd4a.js → split-cell-operation-9e3ab88d.js} +3 -3
  30. package/dist/cjs/{state-border-formatter-e7779964.js → state-border-formatter-626b0a14.js} +1 -1
  31. package/dist/cjs/{string-format-strategy.abstract-a22f0cb1.js → string-format-strategy.abstract-981f43e1.js} +1 -1
  32. package/dist/cjs/{string-input-formatter-slimmer-8179eb40.js → string-input-formatter-slimmer-fc4a0ba5.js} +1 -1
  33. package/dist/cjs/{string-mask-strategy-8b9bb0c1.js → string-mask-strategy-b47fa159.js} +2 -2
  34. package/dist/cjs/{style-formatter-380b9a86.js → style-formatter-baf18624.js} +2 -2
  35. package/dist/cjs/{time-required-rule-080d975b.js → time-required-rule-e77d174f.js} +1 -1
  36. package/dist/cjs/{token-extension-619379a3.js → token-extension-3aec039f.js} +1609 -15
  37. package/dist/cjs/{translation-slimmer-2af6f141.js → translation-slimmer-1e05769e.js} +1 -1
  38. package/dist/cjs/{type-guard-0171e779.js → type-guard-7ab48d6c.js} +1 -1
  39. package/dist/cjs/{valid-credit-card-number-rule-fdfca83e.js → valid-credit-card-number-rule-52ba9c67.js} +1 -1
  40. package/dist/cjs/vega-accordion.cjs.entry.js +18 -10
  41. package/dist/cjs/vega-app-header-button.cjs.entry.js +7 -7
  42. package/dist/cjs/vega-banner.cjs.entry.js +3 -6
  43. package/dist/cjs/vega-box.cjs.entry.js +7 -7
  44. package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
  45. package/dist/cjs/vega-button-circle.cjs.entry.js +7 -7
  46. package/dist/cjs/vega-button-group_2.cjs.entry.js +2 -2
  47. package/dist/cjs/vega-button-link.cjs.entry.js +2 -2
  48. package/dist/cjs/vega-button.cjs.entry.js +5 -5
  49. package/dist/cjs/vega-calendar_5.cjs.entry.js +9 -9
  50. package/dist/cjs/vega-card.cjs.entry.js +6 -6
  51. package/dist/cjs/vega-carousel.cjs.entry.js +4 -4
  52. package/dist/cjs/vega-checkbox_2.cjs.entry.js +5 -5
  53. package/dist/cjs/vega-chip.cjs.entry.js +7 -7
  54. package/dist/cjs/vega-code-block.cjs.entry.js +12 -15
  55. package/dist/cjs/vega-color-picker.cjs.entry.js +4 -4
  56. package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +6 -6
  57. package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
  58. package/dist/cjs/vega-combo-box.cjs.entry.js +11 -11
  59. package/dist/cjs/vega-date-picker_2.cjs.entry.js +15 -15
  60. package/dist/cjs/vega-dialog_2.cjs.entry.js +5 -5
  61. package/dist/cjs/vega-divider.cjs.entry.js +6 -6
  62. package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
  63. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  64. package/dist/cjs/vega-field-label.cjs.entry.js +13 -9
  65. package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
  66. package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
  67. package/dist/cjs/vega-flex.cjs.entry.js +7 -7
  68. package/dist/cjs/vega-font.cjs.entry.js +6 -6
  69. package/dist/cjs/vega-form.cjs.entry.js +5 -5
  70. package/dist/cjs/vega-grid.cjs.entry.js +6 -6
  71. package/dist/cjs/vega-icon.cjs.entry.js +6 -6
  72. package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
  73. package/dist/cjs/vega-input-credit-card.cjs.entry.js +9 -9
  74. package/dist/cjs/vega-input-numeric.cjs.entry.js +8 -8
  75. package/dist/cjs/vega-input-passcode.cjs.entry.js +8 -8
  76. package/dist/cjs/vega-input-phone-number.cjs.entry.js +6 -6
  77. package/dist/cjs/vega-input-range.cjs.entry.js +5 -5
  78. package/dist/cjs/vega-input-select.cjs.entry.js +8 -8
  79. package/dist/cjs/vega-input.cjs.entry.js +9 -9
  80. package/dist/cjs/vega-left-nav_5.cjs.entry.js +8 -8
  81. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +4 -4
  82. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
  83. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
  84. package/dist/cjs/vega-pagination.cjs.entry.js +6 -6
  85. package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
  86. package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +4 -4
  87. package/dist/cjs/vega-radio_2.cjs.entry.js +8 -8
  88. package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
  89. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +220 -48
  90. package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +233 -0
  91. package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
  92. package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +11 -11
  93. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +7 -7
  94. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +5 -5
  95. package/dist/cjs/vega-sidenav_3.cjs.entry.js +4 -4
  96. package/dist/cjs/vega-signature-capture.cjs.entry.js +9 -9
  97. package/dist/cjs/vega-stepper.cjs.entry.js +4 -4
  98. package/dist/cjs/vega-tab-group_2.cjs.entry.js +2 -2
  99. package/dist/cjs/vega-table_11.cjs.entry.js +6 -6
  100. package/dist/cjs/vega-textarea.cjs.entry.js +5 -5
  101. package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -11
  102. package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
  103. package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
  104. package/dist/cjs/vega.cjs.js +14 -13
  105. package/dist/cjs/xmark-large-faae5a80.js +7 -0
  106. package/dist/collection/collection-manifest.json +6 -0
  107. package/dist/collection/components/vega-accordion/slimmers/vega-accordion-renderer.js +11 -3
  108. package/dist/collection/components/vega-box/vega-box.js +3 -3
  109. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +1 -1
  110. package/dist/collection/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.js +5 -4
  111. package/dist/collection/components/vega-field-label/vega-field-label.css +20 -0
  112. package/dist/collection/components/vega-field-label/vega-field-label.js +6 -3
  113. package/dist/collection/components/vega-input/vega-input.css +1 -0
  114. package/dist/collection/components/vega-input/vega-input.js +1 -1
  115. package/dist/collection/components/vega-input-select/vega-input-select.js +1 -1
  116. package/dist/collection/components/vega-rich-text-editor/assets/cut.js +3 -0
  117. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +16 -1
  118. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +25 -0
  119. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-selected-content-strategy.js +16 -0
  120. package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-selected-content-action.js +17 -0
  121. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
  122. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +2 -0
  123. package/dist/collection/components/vega-rich-text-editor/dto/range.js +24 -2
  124. package/dist/collection/components/vega-rich-text-editor/extensions/copy/action-handler-strategies/copy-selected-content-strategy.js +226 -0
  125. package/dist/collection/components/vega-rich-text-editor/extensions/copy/actions/copy-selected-content-action.js +21 -0
  126. package/dist/collection/components/vega-rich-text-editor/extensions/copy/copy-extension.js +20 -0
  127. package/dist/collection/components/vega-rich-text-editor/extensions/copy/copy-toolbar-button-renderer.js +58 -0
  128. package/dist/collection/components/vega-rich-text-editor/extensions/cut/cut-extension.js +15 -0
  129. package/dist/collection/components/vega-rich-text-editor/extensions/cut/cut-toolbar-button-renderer.js +44 -0
  130. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/assets/find-and-replace.js +3 -0
  131. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/find-replace-extension.js +18 -0
  132. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-controller.js +105 -0
  133. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-replace-controller.abstract.js +68 -0
  134. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/block-search-strategy.abstract.js +8 -0
  135. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/code-block-search-strategy.js +19 -0
  136. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/container-block-search-strategy.js +23 -0
  137. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/list-item-block-search-strategy.js +30 -0
  138. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/text-block-search-strategy.js +20 -0
  139. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-highlight-manager.js +266 -0
  140. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-state.js +346 -0
  141. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/replace-controller.js +113 -0
  142. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/renderers/find-replace-toolbar-button-renderer.js +194 -0
  143. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/slimmers/renderers/find-replace-panel-renderer.js +153 -0
  144. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/vega-rich-text-find-replace-panel.css +50 -0
  145. package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/vega-rich-text-find-replace-panel.js +156 -0
  146. package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +2 -1
  147. package/dist/collection/components/vega-rich-text-editor/extensions/horizontal-line/horizontal-line-extension.js +2 -1
  148. package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js +2 -1
  149. package/dist/collection/components/vega-rich-text-editor/extensions/line-height/line-height-extension.js +2 -1
  150. package/dist/collection/components/vega-rich-text-editor/extensions/special-characters/special-characters-extension.js +2 -1
  151. package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +2 -1
  152. package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/controllers/selection-widget-keyboard-controller.js +1 -1
  153. package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-extension.js +2 -1
  154. package/dist/collection/components/vega-rich-text-editor/public-api.js +4 -0
  155. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +133 -0
  156. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.js +35 -0
  157. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.js +93 -0
  158. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +9 -3
  159. package/dist/collection/components/vega-textarea/vega-textarea.js +1 -1
  160. package/dist/collection/global/scripts/before-vega-load.js +6 -0
  161. package/dist/collection/helpers/translation/locales/en.js +14 -0
  162. package/dist/esm/{app-globals-6041f52f.js → app-globals-5e0d319a.js} +13 -10
  163. package/dist/esm/{aria-dialog-focusable-trap-slimmer-1332c071.js → aria-dialog-focusable-trap-slimmer-9eae86c6.js} +1 -1
  164. package/dist/esm/{child-nodes-event-prevent-slimmer-50022584.js → child-nodes-event-prevent-slimmer-f24618c5.js} +2 -2
  165. package/dist/esm/{code-block-37294847.js → code-block-b71b2aa4.js} +26 -3
  166. package/dist/esm/{component-value-history-controller-slimmer.abstract-45ccddc9.js → component-value-history-controller-slimmer.abstract-282df6e5.js} +4 -4
  167. package/dist/esm/{content-state-67950b80.js → content-state-909099f8.js} +33 -4
  168. package/dist/esm/copy-54e45e2d.js +5 -0
  169. package/dist/esm/{date-required-rule-958cf380.js → date-required-rule-15edb04a.js} +1 -1
  170. package/dist/esm/{design-token-e7e78f18.js → design-token-cb5ed6b9.js} +3 -3
  171. package/dist/esm/{element-appender-slimmer-ebda526d.js → element-appender-slimmer-e41120ee.js} +4 -4
  172. package/dist/esm/{event-emit-slimmer-b94cec83.js → event-emit-slimmer-03deba18.js} +1 -1
  173. package/dist/esm/{file-uploader-required-rule-82188a61.js → file-uploader-required-rule-96952e1a.js} +1 -1
  174. package/dist/esm/{form-field-controller-slimmer-0a2ba886.js → form-field-controller-slimmer-cfe1d8a7.js} +3 -3
  175. package/dist/esm/{image-annotation-action-7f7a5678.js → image-annotation-action-98232dc4.js} +3 -3
  176. package/dist/esm/index-090d31ca.js +4 -0
  177. package/dist/esm/index.js +24 -23
  178. package/dist/esm/{inject-keyboard-manager-2b19c121.js → inject-keyboard-manager-13cc77ab.js} +1 -1
  179. package/dist/esm/{internal-calendar-period-factory-fff8aaee.js → internal-calendar-period-factory-c3d70f3b.js} +1 -1
  180. package/dist/esm/{internal-translation-controller-aa09ca87.js → internal-translation-controller-8e8a514a.js} +14 -0
  181. package/dist/esm/{internal-vega-event-manager-956cf128.js → internal-vega-event-manager-75e5e3bb.js} +1 -1
  182. package/dist/esm/{keyboard-manager-3e5b157f.js → keyboard-manager-fe885db1.js} +1 -1
  183. package/dist/esm/{keyboard-manager-slimmer-ba5cc767.js → keyboard-manager-slimmer-61d4c79b.js} +1 -1
  184. package/dist/esm/{link-extension-afb404fb.js → link-extension-f1a3bea7.js} +3 -3
  185. package/dist/esm/loader.js +17 -16
  186. package/dist/esm/{month-view-generator-7a0c869c.js → month-view-generator-85eecb95.js} +1 -1
  187. package/dist/esm/{public-rules-f64b0b78.js → public-rules-323bea4b.js} +11 -11
  188. package/dist/esm/{range-4d09a305.js → range-e63068d1.js} +25 -3
  189. package/dist/esm/{replace-selected-text-action-12bc8b82.js → replace-selected-text-action-c0817b2b.js} +1 -1
  190. package/dist/esm/{required-field-rule-a4634842.js → required-field-rule-897fe8d1.js} +1 -1
  191. package/dist/esm/{responsive-format-facade-844c5e09.js → responsive-format-facade-fb424f5b.js} +2 -2
  192. package/dist/esm/{rich-text-editor-required-rule-d62d418e.js → rich-text-editor-required-rule-0edb8ba7.js} +1 -1
  193. package/dist/esm/{split-cell-operation-c515669e.js → split-cell-operation-93b4d775.js} +3 -3
  194. package/dist/esm/{state-border-formatter-f53847a5.js → state-border-formatter-1a528ca4.js} +1 -1
  195. package/dist/esm/{string-format-strategy.abstract-a0327405.js → string-format-strategy.abstract-72fc98aa.js} +1 -1
  196. package/dist/esm/{string-input-formatter-slimmer-12de4a25.js → string-input-formatter-slimmer-b0c480d8.js} +3 -3
  197. package/dist/esm/{string-mask-strategy-3bb03155.js → string-mask-strategy-4e00c173.js} +2 -2
  198. package/dist/esm/{style-formatter-df7bf8ec.js → style-formatter-5c1bea8d.js} +2 -2
  199. package/dist/esm/{sub-state-notify-slimmer-7ef94141.js → sub-state-notify-slimmer-0f72ce74.js} +1 -1
  200. package/dist/esm/{sub-state-observer-slimmer-d9ad2bdd.js → sub-state-observer-slimmer-64532d94.js} +1 -1
  201. package/dist/esm/{time-required-rule-db0dee53.js → time-required-rule-df500b14.js} +1 -1
  202. package/dist/esm/{token-extension-8ff92d14.js → token-extension-32d1fa56.js} +1610 -20
  203. package/dist/esm/{translation-slimmer-4904e7fe.js → translation-slimmer-60408f13.js} +1 -1
  204. package/dist/esm/{type-guard-a2cbaae9.js → type-guard-91087018.js} +1 -1
  205. package/dist/esm/{valid-credit-card-number-rule-a3f9858d.js → valid-credit-card-number-rule-681ecb75.js} +1 -1
  206. package/dist/esm/vega-accordion.entry.js +21 -13
  207. package/dist/esm/vega-app-footer.entry.js +3 -3
  208. package/dist/esm/vega-app-header-button.entry.js +10 -10
  209. package/dist/esm/vega-banner.entry.js +5 -8
  210. package/dist/esm/vega-box.entry.js +7 -7
  211. package/dist/esm/vega-breadcrumb.entry.js +5 -5
  212. package/dist/esm/vega-button-circle.entry.js +11 -11
  213. package/dist/esm/vega-button-group_2.entry.js +8 -8
  214. package/dist/esm/vega-button-link.entry.js +5 -5
  215. package/dist/esm/vega-button.entry.js +9 -9
  216. package/dist/esm/vega-calendar_5.entry.js +15 -15
  217. package/dist/esm/vega-card.entry.js +6 -6
  218. package/dist/esm/vega-carousel.entry.js +7 -7
  219. package/dist/esm/vega-checkbox_2.entry.js +10 -10
  220. package/dist/esm/vega-chip.entry.js +10 -10
  221. package/dist/esm/vega-code-block.entry.js +15 -18
  222. package/dist/esm/vega-color-picker.entry.js +9 -9
  223. package/dist/esm/vega-color-swatch-picker.entry.js +11 -11
  224. package/dist/esm/vega-color-swatch.entry.js +5 -5
  225. package/dist/esm/vega-combo-box.entry.js +16 -16
  226. package/dist/esm/vega-date-picker_2.entry.js +22 -22
  227. package/dist/esm/vega-dialog_2.entry.js +10 -10
  228. package/dist/esm/vega-divider.entry.js +6 -6
  229. package/dist/esm/vega-dropdown_5.entry.js +16 -16
  230. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  231. package/dist/esm/{vega-event-id-268f8def.js → vega-event-id-d3017041.js} +1 -1
  232. package/dist/esm/vega-field-label.entry.js +16 -12
  233. package/dist/esm/vega-file-uploader.entry.js +11 -11
  234. package/dist/esm/vega-flag-icon.entry.js +6 -6
  235. package/dist/esm/vega-flex.entry.js +7 -7
  236. package/dist/esm/vega-font.entry.js +6 -6
  237. package/dist/esm/vega-form.entry.js +11 -11
  238. package/dist/esm/vega-grid.entry.js +6 -6
  239. package/dist/esm/vega-icon.entry.js +6 -6
  240. package/dist/esm/vega-image-uploader.entry.js +13 -13
  241. package/dist/esm/vega-input-credit-card.entry.js +14 -14
  242. package/dist/esm/vega-input-numeric.entry.js +14 -14
  243. package/dist/esm/vega-input-passcode.entry.js +13 -13
  244. package/dist/esm/vega-input-phone-number.entry.js +11 -11
  245. package/dist/esm/vega-input-range.entry.js +10 -10
  246. package/dist/esm/vega-input-select.entry.js +13 -13
  247. package/dist/esm/vega-input.entry.js +15 -15
  248. package/dist/esm/{vega-internal-event-id-22151a4d.js → vega-internal-event-id-827eb1ce.js} +1 -1
  249. package/dist/esm/vega-item-toggle.entry.js +3 -3
  250. package/dist/esm/vega-left-nav_5.entry.js +14 -14
  251. package/dist/esm/vega-loader-wrapper_2.entry.js +4 -4
  252. package/dist/esm/vega-page-notification_2.entry.js +1 -1
  253. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +5 -5
  254. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +4 -4
  255. package/dist/esm/vega-pagination.entry.js +10 -10
  256. package/dist/esm/vega-popover_2.entry.js +14 -14
  257. package/dist/esm/vega-progress-tracker_2.entry.js +10 -10
  258. package/dist/esm/vega-radio_2.entry.js +13 -13
  259. package/dist/esm/vega-rich-text-content.entry.js +10 -10
  260. package/dist/esm/vega-rich-text-editor_4.entry.js +227 -55
  261. package/dist/esm/vega-rich-text-find-replace-panel.entry.js +229 -0
  262. package/dist/esm/vega-rich-text-special-characters-panel.entry.js +8 -8
  263. package/dist/esm/vega-rich-text-table-properties_3.entry.js +14 -14
  264. package/dist/esm/vega-segment-control.entry.js +3 -3
  265. package/dist/esm/vega-selection-chip_2.entry.js +13 -13
  266. package/dist/esm/vega-selection-tile_2.entry.js +11 -11
  267. package/dist/esm/vega-sidenav_3.entry.js +10 -10
  268. package/dist/esm/vega-signature-capture.entry.js +14 -14
  269. package/dist/esm/vega-stepper.entry.js +9 -9
  270. package/dist/esm/vega-tab-group_2.entry.js +5 -5
  271. package/dist/esm/vega-table_11.entry.js +12 -12
  272. package/dist/esm/vega-textarea.entry.js +10 -10
  273. package/dist/esm/vega-time-picker_2.entry.js +16 -16
  274. package/dist/esm/vega-toggle-switch.entry.js +7 -7
  275. package/dist/esm/vega-tooltip_2.entry.js +8 -8
  276. package/dist/esm/vega.js +17 -16
  277. package/dist/esm/{wait-for-component-did-render-0488922a.js → wait-for-component-did-render-0c237cb8.js} +1 -1
  278. package/dist/esm/xmark-large-c5ae7944.js +5 -0
  279. package/dist/sri/vega-sri-manifest.json +387 -375
  280. package/dist/types/components/vega-accordion/slimmers/vega-accordion-renderer.d.ts +2 -0
  281. package/dist/types/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.d.ts +1 -0
  282. package/dist/types/components/vega-field-label/types.d.ts +12 -0
  283. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.d.ts +9 -0
  284. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-selected-content-strategy.d.ts +13 -0
  285. package/dist/types/components/vega-rich-text-editor/dto/actions/delete-selected-content-action.d.ts +12 -0
  286. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -1
  287. package/dist/types/components/vega-rich-text-editor/dto/range.d.ts +16 -0
  288. package/dist/types/components/vega-rich-text-editor/extensions/copy/action-handler-strategies/copy-selected-content-strategy.d.ts +79 -0
  289. package/dist/types/components/vega-rich-text-editor/extensions/copy/actions/copy-selected-content-action.d.ts +18 -0
  290. package/dist/types/components/vega-rich-text-editor/extensions/copy/copy-extension.d.ts +10 -0
  291. package/dist/types/components/vega-rich-text-editor/extensions/copy/copy-toolbar-button-renderer.d.ts +36 -0
  292. package/dist/types/components/vega-rich-text-editor/extensions/cut/cut-extension.d.ts +11 -0
  293. package/dist/types/components/vega-rich-text-editor/extensions/cut/cut-toolbar-button-renderer.d.ts +24 -0
  294. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/assets/find-and-replace.d.ts +3 -0
  295. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/find-replace-extension.d.ts +15 -0
  296. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-controller.d.ts +65 -0
  297. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-replace-controller.abstract.d.ts +65 -0
  298. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/block-search-strategy.abstract.d.ts +29 -0
  299. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/code-block-search-strategy.d.ts +17 -0
  300. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/container-block-search-strategy.d.ts +21 -0
  301. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/list-item-block-search-strategy.d.ts +21 -0
  302. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/text-block-search-strategy.d.ts +18 -0
  303. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-highlight-manager.d.ts +88 -0
  304. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-state.d.ts +200 -0
  305. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/replace-controller.d.ts +73 -0
  306. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/renderers/find-replace-toolbar-button-renderer.d.ts +64 -0
  307. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/slimmers/renderers/find-replace-panel-renderer.d.ts +28 -0
  308. package/dist/types/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/vega-rich-text-find-replace-panel.d.ts +56 -0
  309. package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +1 -0
  310. package/dist/types/components/vega-rich-text-editor/extensions/horizontal-line/horizontal-line-extension.d.ts +1 -0
  311. package/dist/types/components/vega-rich-text-editor/extensions/languages/language-extension.d.ts +1 -0
  312. package/dist/types/components/vega-rich-text-editor/extensions/line-height/line-height-extension.d.ts +1 -0
  313. package/dist/types/components/vega-rich-text-editor/extensions/special-characters/special-characters-extension.d.ts +1 -0
  314. package/dist/types/components/vega-rich-text-editor/extensions/table/table-extension.d.ts +1 -0
  315. package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +1 -0
  316. package/dist/types/components/vega-rich-text-editor/public-api.d.ts +4 -0
  317. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.d.ts +60 -0
  318. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.d.ts +8 -0
  319. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.d.ts +8 -0
  320. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -1
  321. package/dist/types/components.d.ts +34 -0
  322. package/dist/types/global/icons/copy.d.ts +3 -0
  323. package/dist/types/helpers/translation/interface.d.ts +15 -1
  324. package/dist/types/types/ui.type.d.ts +1 -1
  325. package/dist/vega/index.esm.js +1 -1
  326. package/dist/vega/{p-cb4033ef.js → p-0179f55d.js} +1 -1
  327. package/dist/vega/{p-8bc23bcf.entry.js → p-06c2ce2c.entry.js} +1 -1
  328. package/dist/vega/{p-fb1ef3e6.entry.js → p-07b56f2b.entry.js} +1 -1
  329. package/dist/vega/{p-141f74ff.js → p-136226f8.js} +1 -1
  330. package/dist/vega/{p-e9a82603.entry.js → p-18413b62.entry.js} +1 -1
  331. package/dist/vega/p-209e0166.js +1 -0
  332. package/dist/vega/{p-014e2cf9.js → p-228c5de8.js} +1 -1
  333. package/dist/vega/{p-cc8bf6e7.entry.js → p-22f73e6e.entry.js} +1 -1
  334. package/dist/vega/p-2314494a.entry.js +1 -0
  335. package/dist/vega/p-2353b64f.entry.js +1 -0
  336. package/dist/vega/p-29e3eb12.js +1 -0
  337. package/dist/vega/p-2da12975.entry.js +1 -0
  338. package/dist/vega/{p-8019c156.js → p-2def8e3e.js} +1 -1
  339. package/dist/vega/{p-5bed3fd2.entry.js → p-2e58d99e.entry.js} +1 -1
  340. package/dist/vega/{p-bb0040d4.entry.js → p-30561e1d.entry.js} +1 -1
  341. package/dist/vega/{p-fc103347.entry.js → p-35df0f0a.entry.js} +1 -1
  342. package/dist/vega/{p-15da9d58.entry.js → p-37dffdf6.entry.js} +1 -1
  343. package/dist/vega/{p-5ffc7cb8.js → p-3a68b729.js} +1 -1
  344. package/dist/vega/{p-507612f6.entry.js → p-3cf4339a.entry.js} +1 -1
  345. package/dist/vega/{p-4cef4812.js → p-3f183b52.js} +1 -1
  346. package/dist/vega/{p-42ed76ee.entry.js → p-40501057.entry.js} +1 -1
  347. package/dist/vega/{p-12b5c5e3.entry.js → p-438b7404.entry.js} +1 -1
  348. package/dist/vega/{p-8982796b.entry.js → p-43c3848f.entry.js} +1 -1
  349. package/dist/vega/{p-9756c6b9.entry.js → p-450bf94d.entry.js} +1 -1
  350. package/dist/vega/{p-0e03daa6.js → p-45ab490c.js} +1 -1
  351. package/dist/vega/{p-94845302.entry.js → p-481601c0.entry.js} +1 -1
  352. package/dist/vega/{p-0707aa21.js → p-4953bb1a.js} +1 -1
  353. package/dist/vega/{p-2b22091e.js → p-4d9061fb.js} +1 -1
  354. package/dist/vega/{p-b2f9698a.entry.js → p-4e39adf5.entry.js} +1 -1
  355. package/dist/vega/{p-316a1e5c.entry.js → p-5038b6d7.entry.js} +1 -1
  356. package/dist/vega/{p-3cf298a4.entry.js → p-5319da71.entry.js} +1 -1
  357. package/dist/vega/p-53c76d9d.entry.js +1 -0
  358. package/dist/vega/{p-64b5fe2a.entry.js → p-5545a235.entry.js} +1 -1
  359. package/dist/vega/{p-c75872a4.entry.js → p-56cf1a65.entry.js} +1 -1
  360. package/dist/vega/{p-216ef41e.entry.js → p-5829a66d.entry.js} +1 -1
  361. package/dist/vega/p-590c8720.entry.js +1 -0
  362. package/dist/vega/{p-5e282e41.js → p-5946fadf.js} +1 -1
  363. package/dist/vega/{p-822f70b0.js → p-5beec481.js} +1 -1
  364. package/dist/vega/p-5de1acdb.js +1 -0
  365. package/dist/vega/p-5df9047c.js +1 -0
  366. package/dist/vega/p-5f377954.js +1 -1
  367. package/dist/vega/{p-aaa6e976.entry.js → p-625351a3.entry.js} +1 -1
  368. package/dist/vega/p-683cfe24.js +1 -0
  369. package/dist/vega/p-68e16c70.entry.js +1 -0
  370. package/dist/vega/{p-ef44d516.js → p-70817cf5.js} +1 -1
  371. package/dist/vega/{p-a14d8767.js → p-71e2a3ec.js} +1 -1
  372. package/dist/vega/{p-a4826f3f.entry.js → p-7798254d.entry.js} +1 -1
  373. package/dist/vega/p-7be548a7.js +1 -0
  374. package/dist/vega/{p-4037126d.js → p-802bf369.js} +1 -1
  375. package/dist/vega/{p-b77e85e0.entry.js → p-82279b03.entry.js} +1 -1
  376. package/dist/vega/{p-f362c07b.entry.js → p-8509c140.entry.js} +1 -1
  377. package/dist/vega/p-88a6c89a.js +1 -0
  378. package/dist/vega/p-890a5254.js +1 -0
  379. package/dist/vega/p-8aa07ed0.js +1 -0
  380. package/dist/vega/{p-da2b1fd0.entry.js → p-8b9a8603.entry.js} +1 -1
  381. package/dist/vega/{p-14bfc113.js → p-8bc15ed0.js} +1 -1
  382. package/dist/vega/{p-aea912ac.js → p-8d69b201.js} +1 -1
  383. package/dist/vega/p-8da860f6.js +1 -0
  384. package/dist/vega/{p-329c808e.entry.js → p-8f078d0d.entry.js} +1 -1
  385. package/dist/vega/p-916dfa7e.entry.js +1 -0
  386. package/dist/vega/{p-42a1d300.entry.js → p-9219201a.entry.js} +1 -1
  387. package/dist/vega/{p-cd2a1ffb.js → p-92823583.js} +1 -1
  388. package/dist/vega/{p-cec8ffdc.js → p-93dfab05.js} +1 -1
  389. package/dist/vega/{p-7f086e54.entry.js → p-9440a8a5.entry.js} +1 -1
  390. package/dist/vega/p-970115d6.js +1 -0
  391. package/dist/vega/{p-da067259.entry.js → p-9b1d718c.entry.js} +1 -1
  392. package/dist/vega/{p-c65a5778.entry.js → p-9cdedcfb.entry.js} +1 -1
  393. package/dist/vega/{p-6e7c1b19.entry.js → p-9fafc956.entry.js} +1 -1
  394. package/dist/vega/{p-70352240.entry.js → p-a268a4fb.entry.js} +1 -1
  395. package/dist/vega/{p-cd21adb8.js → p-a2bd621e.js} +1 -1
  396. package/dist/vega/p-a361456d.js +1 -0
  397. package/dist/vega/{p-73b9868f.js → p-aa32f2f3.js} +1 -1
  398. package/dist/vega/p-b6225d01.js +1 -0
  399. package/dist/vega/{p-58a00869.entry.js → p-b6ebfd5c.entry.js} +1 -1
  400. package/dist/vega/{p-fea33425.js → p-b730bf6e.js} +1 -1
  401. package/dist/vega/{p-81591449.entry.js → p-b799fc1f.entry.js} +1 -1
  402. package/dist/vega/{p-4644ccf9.entry.js → p-c0629528.entry.js} +1 -1
  403. package/dist/vega/{p-50d7a1c4.entry.js → p-c2e0f8b7.entry.js} +1 -1
  404. package/dist/vega/{p-522dd15f.entry.js → p-c67ce78c.entry.js} +1 -1
  405. package/dist/vega/{p-6ecb3c7d.entry.js → p-c78aeaf3.entry.js} +1 -1
  406. package/dist/vega/{p-5df53125.entry.js → p-c78e8081.entry.js} +1 -1
  407. package/dist/vega/{p-1acd5f04.entry.js → p-c8eaf91c.entry.js} +1 -1
  408. package/dist/vega/p-ca9852bb.js +1 -0
  409. package/dist/vega/{p-ce27c273.entry.js → p-cd1844ad.entry.js} +1 -1
  410. package/dist/vega/{p-a04b95aa.entry.js → p-cd9fb2ca.entry.js} +1 -1
  411. package/dist/vega/p-ce7e9515.entry.js +1 -0
  412. package/dist/vega/p-d0ce752f.entry.js +1 -0
  413. package/dist/vega/{p-044496e0.entry.js → p-d20587b4.entry.js} +1 -1
  414. package/dist/vega/{p-ae728041.entry.js → p-d3c8b871.entry.js} +1 -1
  415. package/dist/vega/{p-c87c7ef4.js → p-d7369441.js} +1 -1
  416. package/dist/vega/p-de885ef2.js +1 -0
  417. package/dist/vega/{p-b7b0930a.entry.js → p-dee38163.entry.js} +1 -1
  418. package/dist/vega/{p-6820b488.entry.js → p-e160a727.entry.js} +1 -1
  419. package/dist/vega/{p-49b4ab2b.js → p-e371738b.js} +1 -1
  420. package/dist/vega/{p-4979fd7d.js → p-e3803943.js} +1 -1
  421. package/dist/vega/p-e41d9d0e.entry.js +1 -0
  422. package/dist/vega/p-e5502873.entry.js +1 -0
  423. package/dist/vega/{p-5fcb825c.entry.js → p-e9cee498.entry.js} +1 -1
  424. package/dist/vega/p-ea22cba0.js +1 -0
  425. package/dist/vega/p-ea54ce0a.js +3 -0
  426. package/dist/vega/p-ee3155bd.js +1 -0
  427. package/dist/vega/{p-0605c656.entry.js → p-eee01ba7.entry.js} +1 -1
  428. package/dist/vega/{p-3fe43f7a.entry.js → p-ef2b9846.entry.js} +1 -1
  429. package/dist/vega/p-f0bc2bbb.js +1 -0
  430. package/dist/vega/{p-3863187f.entry.js → p-f365601c.entry.js} +1 -1
  431. package/dist/vega/p-f4a01959.js +1 -0
  432. package/dist/vega/{p-9e327397.entry.js → p-f515d189.entry.js} +1 -1
  433. package/dist/vega/{p-b504a8b4.entry.js → p-f5aefb2f.entry.js} +1 -1
  434. package/dist/vega/{p-2f48162f.entry.js → p-f6bccb06.entry.js} +1 -1
  435. package/dist/vega/{p-e75e75c9.entry.js → p-f70f7ad8.entry.js} +1 -1
  436. package/dist/vega/{p-42f3c0b1.entry.js → p-f7739cbb.entry.js} +1 -1
  437. package/dist/vega/{p-335e3237.entry.js → p-fc5dfb52.entry.js} +1 -1
  438. package/dist/vega/p-fd70418f.js +1 -0
  439. package/dist/vega/vega.esm.js +1 -1
  440. package/package.json +1 -1
  441. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +0 -92
  442. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +0 -26
  443. package/dist/vega/p-144d4b30.js +0 -1
  444. package/dist/vega/p-21775cc7.js +0 -1
  445. package/dist/vega/p-2944c76e.entry.js +0 -1
  446. package/dist/vega/p-3372f34a.entry.js +0 -1
  447. package/dist/vega/p-53ed3b1f.js +0 -1
  448. package/dist/vega/p-57f7c257.js +0 -1
  449. package/dist/vega/p-5a4e598f.js +0 -1
  450. package/dist/vega/p-5e1cd1cc.js +0 -1
  451. package/dist/vega/p-5e1ec2b8.entry.js +0 -1
  452. package/dist/vega/p-61d42e9b.entry.js +0 -1
  453. package/dist/vega/p-63ae5ada.entry.js +0 -1
  454. package/dist/vega/p-66905cbf.js +0 -1
  455. package/dist/vega/p-689070f9.entry.js +0 -1
  456. package/dist/vega/p-74fa0f5b.entry.js +0 -1
  457. package/dist/vega/p-7bb39b97.js +0 -1
  458. package/dist/vega/p-7f139b74.js +0 -1
  459. package/dist/vega/p-85d78ac1.js +0 -1
  460. package/dist/vega/p-92a144bc.js +0 -1
  461. package/dist/vega/p-9f608b97.js +0 -1
  462. package/dist/vega/p-aca134a3.entry.js +0 -1
  463. package/dist/vega/p-b2f89dbd.js +0 -1
  464. package/dist/vega/p-bd94b904.entry.js +0 -1
  465. package/dist/vega/p-c0c2a917.js +0 -3
  466. package/dist/vega/p-c40555c4.entry.js +0 -1
  467. package/dist/vega/p-d0060bdb.js +0 -1
  468. package/dist/vega/p-d00b3910.js +0 -1
  469. package/dist/vega/p-d14ddf80.js +0 -1
  470. package/dist/vega/p-dc78e8d6.js +0 -1
  471. package/dist/vega/p-ddc2d219.js +0 -1
  472. /package/dist/cjs/{feature-flag-controller-438a1510.js → feature-flag-controller-c19d0b58.js} +0 -0
  473. /package/dist/collection/{components/vega-code-block/assets → global/icons}/copy.js +0 -0
  474. /package/dist/esm/{feature-flag-controller-2a89f20c.js → feature-flag-controller-3fd04ea9.js} +0 -0
  475. /package/dist/types/components/{vega-code-block/assets/copy.d.ts → vega-rich-text-editor/assets/cut.d.ts} +0 -0
  476. /package/dist/vega/{p-bc73ce30.js → p-87a4d75f.js} +0 -0
@@ -5,27 +5,28 @@ import { I as InjectVegaTelemetrySlimmer, c as createPublicAPIRuntimeMetricsSlim
5
5
  import { I as InternalVegaZIndexManager } from './internal-vega-z-index-manager-7d2b54c3.js';
6
6
  import { c as createDynamicSlimmer } from './dynamic-slimmer-90b8af32.js';
7
7
  import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-e24d36c5.js';
8
- import { i as internalVegaEventManager } from './internal-vega-event-manager-956cf128.js';
9
- import { V as VegaInternalTranslation } from './internal-translation-controller-aa09ca87.js';
10
- import { I as InternalCalendarPeriodConverter } from './internal-calendar-period-factory-fff8aaee.js';
11
- import { U as UpdateCursorPositionAction, V as VegaRTEContent, B as BlockToRTEBlockStrategyAbstract, E as ElementToDTOStrategy, h as htmlElementToAnnotationGenerator, I as InsertNewParagraphAction, R as RTEImageBlock, a as InsertChildrenBeforeStrategy, P as PasteContentStrategy, A as AnnotationGeneratorStrategyAbstract, b as RTEListItemBlock } from './content-state-67950b80.js';
12
- import { R as RTEExtensionContextManager, a as VegaRTEExtensionRenderer, b as VegaRTEExtension } from './link-extension-afb404fb.js';
13
- import { M as ModifyContentAction, A as ActionHandleStrategyRegistry, R as RTETextNode, a as RTEBlock, b as RTETextBlock, c as RTEAnnotationStyle, d as ActionHandleStrategy, I as InsertChildrenAfterAction, e as AppendChildrenAction, f as RTENode, s as stateEntityRenderingRegistry, g as InsertChildrenBeforeAction, h as InternalAnnotationTypeEnum, i as ModifyContentActionType, B as BlockAnnotation, j as AnnotationAction, k as RemoveChildrenAction, C as CommonAnnotationTypeEnum, l as CustomAttributeAnnotation, m as RTEDTOClassManager, n as RTEFilterStylesStrategy, o as RTEDecoratorNode, S as SplitBlockWithNodeAction, U as UpdateTextAction, N as NodeAnnotationTypeEnum, p as RTECodeBlock, q as CustomStyleAnnotation, r as RTEFilterStylesStrategyRegistry } from './code-block-37294847.js';
14
- import { i as isNonNullable } from './type-guard-a2cbaae9.js';
8
+ import { i as internalVegaEventManager } from './internal-vega-event-manager-75e5e3bb.js';
9
+ import { V as VegaInternalTranslation } from './internal-translation-controller-8e8a514a.js';
10
+ import { I as InternalCalendarPeriodConverter } from './internal-calendar-period-factory-c3d70f3b.js';
11
+ import { U as UpdateCursorPositionAction, V as VegaRTEContent, B as BlockToRTEBlockStrategyAbstract, E as ElementToDTOStrategy, h as htmlElementToAnnotationGenerator, I as InsertNewParagraphAction, R as RTEImageBlock, a as InsertChildrenBeforeStrategy, P as PasteContentStrategy, A as AnnotationGeneratorStrategyAbstract, b as RTEListItemBlock } from './content-state-909099f8.js';
12
+ import { M as ModifyContentAction, A as ActionHandleStrategyRegistry, R as RTETextNode, a as RTEBlock, b as RTETextBlock, c as RTEAnnotationStyle, d as ActionHandleStrategy, I as InsertChildrenAfterAction, e as AppendChildrenAction, f as RTENode, s as stateEntityRenderingRegistry, g as InsertChildrenBeforeAction, h as InternalAnnotationTypeEnum, i as ModifyContentActionType, B as BlockAnnotation, j as AnnotationAction, k as RemoveChildrenAction, C as CommonAnnotationTypeEnum, l as CustomAttributeAnnotation, m as RTEDTOClassManager, n as RTEFilterStylesStrategy, o as RTEDecoratorNode, S as SplitBlockWithNodeAction, U as UpdateTextAction, p as RTECodeBlock, q as RTECodeBlockNode, N as NodeAnnotationTypeEnum, r as CustomStyleAnnotation, t as RTEFilterStylesStrategyRegistry } from './code-block-b71b2aa4.js';
13
+ import { i as isNonNullable } from './type-guard-91087018.js';
14
+ import { R as RTEExtensionContextManager, a as VegaRTEExtensionRenderer, b as VegaRTEExtension } from './link-extension-f1a3bea7.js';
15
15
  import { V as VegaInternalIconManager } from './internal-icon-manager-e7c57096.js';
16
16
  import { v as vegaNonceManager } from './vega-nonce-manager-497e5eb5.js';
17
17
  import { D as DomNodeSubjectObserverFactory, d as domNodeSubjectFactory } from './dom-node-subject-observer-factory-ddff8662.js';
18
- import { V as VegaDropdownClick, a as VegaClick, b as VegaPopoverHide, c as VegaPopoverShow } from './vega-event-id-268f8def.js';
19
- import { R as RTETableExtensionAnnotationTypeEnum, a as RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR, S as SettingEventHandler, T as TableSettingType, b as RTETableAnnotation, c as RTETableCellAnnotation, d as RTETableHeadCellBlock, e as RowOperationEventHandler, C as ColumnOperationEventHandler, M as MergeCellsOperationEventHandler, f as SplitCellOperationEventHandler, g as RTETableColorManager, h as RTETableBlock, i as generateTableBody, j as RTETableCellBlock, k as RTETableHeadBlock, l as RTETableBodyBlock, m as getParentBlockByType, n as RTETableHeadCellAnnotation, o as TableColumnStrategy, p as getAllTableRows, q as buildTableGrid, s as setSpanAttributes, r as findCellBlockById, t as getDefaultCellBlockTemplate, I as InsertTableColumnDirection, u as buildCellStartColumnMap, v as getTableColumnCount, w as getFirstNode, x as getCellSpan, y as createNewCell, z as MergeCellsOperationType, A as RTETableRowBlock, B as getActualColumnPosition, D as InsertTableRowDirection, E as RTE_TABLE_DEFAULT_COLORS, F as INSERT_TABLE_ROW_INTO_DIFFERENT_SECTION, G as INSERT_TABLE_ROW_INTO_SAME_SECTION, H as DELETE_TABLE_ROW, J as TOGGLE_HEADER_ROW, K as INSERT_TABLE_COLUMN, L as DELETE_TABLE_COLUMN, N as TOGGLE_HEADER_TABLE_COLUMN, O as ToggleHeaderTableColumnStrategy, P as SPLIT_TABLE_CELL, Q as REPLACE_TABLE_CELL, U as SPLIT_CELL_HORIZONTALLY, W as SPLIT_CELL_VERTICALLY, X as SELECT_TABLE_COLUMN, Y as MERGE_CELLS } from './split-cell-operation-c515669e.js';
18
+ import { V as VegaDropdownClick, a as VegaClick, b as VegaPopoverHide, c as VegaPopoverShow, d as VegaChange } from './vega-event-id-d3017041.js';
19
+ import { R as RTETableExtensionAnnotationTypeEnum, a as RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR, S as SettingEventHandler, T as TableSettingType, b as RTETableAnnotation, c as RTETableCellAnnotation, d as RTETableHeadCellBlock, e as RowOperationEventHandler, C as ColumnOperationEventHandler, M as MergeCellsOperationEventHandler, f as SplitCellOperationEventHandler, g as RTETableColorManager, h as RTETableBlock, i as generateTableBody, j as RTETableCellBlock, k as RTETableHeadBlock, l as RTETableBodyBlock, m as getParentBlockByType, n as RTETableHeadCellAnnotation, o as TableColumnStrategy, p as getAllTableRows, q as buildTableGrid, s as setSpanAttributes, r as findCellBlockById, t as getDefaultCellBlockTemplate, I as InsertTableColumnDirection, u as buildCellStartColumnMap, v as getTableColumnCount, w as getFirstNode, x as getCellSpan, y as createNewCell, z as MergeCellsOperationType, A as RTETableRowBlock, B as getActualColumnPosition, D as InsertTableRowDirection, E as RTE_TABLE_DEFAULT_COLORS, F as INSERT_TABLE_ROW_INTO_DIFFERENT_SECTION, G as INSERT_TABLE_ROW_INTO_SAME_SECTION, H as DELETE_TABLE_ROW, J as TOGGLE_HEADER_ROW, K as INSERT_TABLE_COLUMN, L as DELETE_TABLE_COLUMN, N as TOGGLE_HEADER_TABLE_COLUMN, O as ToggleHeaderTableColumnStrategy, P as SPLIT_TABLE_CELL, Q as REPLACE_TABLE_CELL, U as SPLIT_CELL_HORIZONTALLY, W as SPLIT_CELL_VERTICALLY, X as SELECT_TABLE_COLUMN, Y as MERGE_CELLS } from './split-cell-operation-93b4d775.js';
20
20
  import { C as ChangeManager } from './change-manager-6a7eb88c.js';
21
- import { V as VegaInternalRTEExtensionTableCellsSelectionAnchor, a as VegaInternalPopoverUpdateTarget, b as VegaInternalRTEExtensionTableCellSelectionChange } from './vega-internal-event-id-22151a4d.js';
21
+ import { V as VegaInternalRTEExtensionTableCellsSelectionAnchor, a as VegaInternalPopoverUpdateTarget, b as VegaInternalRTEExtensionTableCellSelectionChange } from './vega-internal-event-id-827eb1ce.js';
22
22
  import { r as remoteInvocationRegistry } from './remote-invocation-registry-d69245c2.js';
23
- import { V as VegaInternalThemeManager } from './dark-mode-style-controller-ca5afd2d.js';
23
+ import { V as VegaInternalThemeManager, a as VegaDarkModeStyleController } from './dark-mode-style-controller-ca5afd2d.js';
24
24
  import { t as tryGetDocument } from './try-get-document-bef0f526.js';
25
25
  import { p as parseToPixelString } from './pixel-f32c07ce.js';
26
26
  import { c as cleanObject } from './object-0c277f57.js';
27
27
  import { d as debounce } from './timer-9321173b.js';
28
- import { R as ReplaceSelectedTextAction } from './replace-selected-text-action-12bc8b82.js';
28
+ import { R as ReplaceSelectedTextAction } from './replace-selected-text-action-c0817b2b.js';
29
+ import { c as copy } from './copy-54e45e2d.js';
29
30
 
30
31
  const VegaLoaderRuntimeMetricsPayloadDefinition = [
31
32
  {
@@ -1767,7 +1768,7 @@ class VegaRTELanguageExtension extends VegaRTEExtension {
1767
1768
  */
1768
1769
  prepareBeforeLoad(host) {
1769
1770
  this.languageToolbarButtonRenderer = new RTELanguageToolbarButtonRenderer(this.languageList, this.languageChangeCallBack, this.languageState.selectedLanguage);
1770
- this.registerToolbarButtonRenderer('languages', this.languageToolbarButtonRenderer, host);
1771
+ this.registerToolbarButtonRenderer(VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY, this.languageToolbarButtonRenderer, host);
1771
1772
  }
1772
1773
  /**
1773
1774
  * Initializes the language extension.
@@ -1859,6 +1860,7 @@ class VegaRTELanguageExtension extends VegaRTEExtension {
1859
1860
  return result;
1860
1861
  }
1861
1862
  }
1863
+ VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY = 'languages';
1862
1864
 
1863
1865
  const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
1864
1866
  /**
@@ -2651,7 +2653,7 @@ class VegaRTEFunctionExtension extends VegaRTEExtension {
2651
2653
  }
2652
2654
  /** @inheritDoc */
2653
2655
  prepareBeforeLoad(host) {
2654
- this.registerToolbarButtonRenderer('functions', new FunctionToolbarButtonRenderer(), host);
2656
+ this.registerToolbarButtonRenderer(VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY, new FunctionToolbarButtonRenderer(), host);
2655
2657
  }
2656
2658
  /**
2657
2659
  * Remove the appen children strategies to prevent default insert new paragraph logic in function block
@@ -2675,6 +2677,7 @@ class VegaRTEFunctionExtension extends VegaRTEExtension {
2675
2677
  VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
2676
2678
  VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
2677
2679
  })();
2680
+ VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY = 'functions';
2678
2681
 
2679
2682
  const tableBlockStylesCss = ".v-rte--extension-table-container{display:table}table.v-rte--extension-table{border-collapse:collapse}table.v-rte--extension-table th,table.v-rte--extension-table td{border:1px solid #ddd;padding:12px;text-align:left;vertical-align:middle;min-width:55px;box-sizing:border-box;position:relative}table.v-rte--extension-table th{background-color:#f2f2f2}.rte-table-setting-popover,.rte-table-dynamic-popover{display:block}table.v-rte--extension-table .v-rte-table-cell-focused::after,table.v-rte--extension-table .v-rte-table-cell-selected::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-color:rgba(158, 207, 250, 0.3)}table.v-rte--extension-table:has(.v-rte-table-cell-selected){caret-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::selection{background-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::-moz-selection{background-color:transparent}.v-rte--extension-table-caption{padding:8px;border:1px solid #ddd;border-bottom:none;background-color:rgba(var(--v-bg-table-header, 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}";
2680
2683
 
@@ -7311,7 +7314,7 @@ class VegaRTETableExtension extends VegaRTEExtension {
7311
7314
  this.tableHeadCellRenderer = new RTETableHeadCellRenderer();
7312
7315
  this.tableSelection = new RTETableSelection();
7313
7316
  RTETableColorManager.setTableColors(colors);
7314
- this.registerToolbarButtonRenderer('table', this.toolbarButtonRenderer);
7317
+ this.registerToolbarButtonRenderer(VegaRTETableExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
7315
7318
  this.registerBlockBasicStrategies(RTETableBlock.name);
7316
7319
  this.registerBlockBasicStrategies(RTETableHeadBlock.name);
7317
7320
  this.registerBlockBasicStrategies(RTETableHeadCellBlock.name);
@@ -7399,6 +7402,7 @@ class VegaRTETableExtension extends VegaRTEExtension {
7399
7402
  VegaRTEExtension.registerFilterStylesStrategy(RTETableCellBlock.dtoName, new TableCellFilterStylesStrategy());
7400
7403
  VegaRTEExtension.registerFilterStylesStrategy(RTETableHeadCellBlock.dtoName, new TableCellFilterStylesStrategy('th'));
7401
7404
  })();
7405
+ VegaRTETableExtension.TOOLBAR_BUTTON_KEY = 'table';
7402
7406
 
7403
7407
  /**
7404
7408
  * Horizontal line node — a decorator node representing `<hr>` in the editor.
@@ -7896,7 +7900,7 @@ class VegaRTEHorizontalLineExtension extends VegaRTEExtension {
7896
7900
  // Register the renderer
7897
7901
  this.registerRenderer('horizontal-line', this.blockRenderer);
7898
7902
  // Register the toolbar button
7899
- this.registerToolbarButtonRenderer('horizontalLine', this.toolbarButtonRenderer);
7903
+ this.registerToolbarButtonRenderer(VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
7900
7904
  // Register HTML → DTO conversion strategy
7901
7905
  this.registerElementToBlockDTOClassStrategy(new HrToHorizontalLineBlockStrategy());
7902
7906
  // Register filter styles strategy for source edit round-trip
@@ -7911,6 +7915,7 @@ class VegaRTEHorizontalLineExtension extends VegaRTEExtension {
7911
7915
  VegaRTEExtension.registerActionHandleStrategy(RTEImageBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
7912
7916
  VegaRTEExtension.registerActionHandleStrategy(RTEHorizontalLineBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
7913
7917
  })();
7918
+ VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY = 'horizontalLine';
7914
7919
 
7915
7920
  const ARROW_CHARACTERS = [
7916
7921
  { character: '←', title: 'leftwards simple arrow' },
@@ -8408,7 +8413,7 @@ class VegaRTESpecialCharactersExtension extends VegaRTEExtension {
8408
8413
  }
8409
8414
  /** @inheritDoc */
8410
8415
  prepareBeforeLoad(host) {
8411
- this.registerToolbarButtonRenderer('special-characters', new RTESpecialCharactersToolbarButtonRenderer(this.categories), host);
8416
+ this.registerToolbarButtonRenderer(VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY, new RTESpecialCharactersToolbarButtonRenderer(this.categories), host);
8412
8417
  }
8413
8418
  /**
8414
8419
  * Builds the final list of special character categories from the provided config.
@@ -8427,6 +8432,1200 @@ class VegaRTESpecialCharactersExtension extends VegaRTEExtension {
8427
8432
  return [...defaultCategories, ...config.categories];
8428
8433
  }
8429
8434
  }
8435
+ VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY = 'special-characters';
8436
+
8437
+ const findReplaceIcon = {
8438
+ icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><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>`,
8439
+ };
8440
+
8441
+ /**
8442
+ * Defines how a specific type of RTEBlock contributes searchable leaf blocks.
8443
+ *
8444
+ * Implementations are registered on FindReplaceState in priority order.
8445
+ * The first strategy whose `canHandle` returns true is used.
8446
+ */
8447
+ class BlockSearchStrategy {
8448
+ }
8449
+
8450
+ /**
8451
+ * Handles RTECodeBlock — a searchable leaf block whose text lives in children[0].text.
8452
+ */
8453
+ class CodeBlockSearchStrategy extends BlockSearchStrategy {
8454
+ /**
8455
+ * @inheritDoc
8456
+ */
8457
+ canHandle(block) {
8458
+ return block instanceof RTECodeBlock;
8459
+ }
8460
+ /**
8461
+ * @inheritDoc
8462
+ */
8463
+ collect(block) {
8464
+ return [block];
8465
+ }
8466
+ }
8467
+
8468
+ /**
8469
+ * Handles RTEListItemBlock — a searchable leaf block that may also carry
8470
+ * nested RTEListBlocks via its `nestList` property.
8471
+ *
8472
+ * Must be registered before TextBlockSearchStrategy because RTEListItemBlock
8473
+ * extends RTETextBlock and would otherwise be matched by the parent class check.
8474
+ */
8475
+ class ListItemBlockSearchStrategy extends BlockSearchStrategy {
8476
+ /**
8477
+ * @inheritDoc
8478
+ */
8479
+ canHandle(block) {
8480
+ return block instanceof RTEListItemBlock;
8481
+ }
8482
+ /**
8483
+ * @inheritDoc
8484
+ */
8485
+ collect(block, recurse) {
8486
+ const listItemBlock = block;
8487
+ const result = [listItemBlock];
8488
+ if (listItemBlock.nestList && listItemBlock.nestList.length > 0) {
8489
+ for (const nestedList of listItemBlock.nestList) {
8490
+ result.push(...recurse(nestedList.children));
8491
+ }
8492
+ }
8493
+ return result;
8494
+ }
8495
+ }
8496
+
8497
+ /**
8498
+ * Handles plain RTETextBlock (paragraph, heading, etc.) — a searchable leaf
8499
+ * block whose text lives in its RTETextNode children.
8500
+ */
8501
+ class TextBlockSearchStrategy extends BlockSearchStrategy {
8502
+ /**
8503
+ * @inheritDoc
8504
+ */
8505
+ canHandle(block) {
8506
+ return block instanceof RTETextBlock;
8507
+ }
8508
+ /**
8509
+ * @inheritDoc
8510
+ */
8511
+ collect(block) {
8512
+ return [block];
8513
+ }
8514
+ }
8515
+
8516
+ /**
8517
+ * Fallback strategy for generic container blocks whose concrete type is not
8518
+ * known at compile time (RTEHtmlBlock, table blocks, extension-defined blocks, …).
8519
+ *
8520
+ * A block is treated as a container when its children array is non-empty and
8521
+ * the first child is not an RTETextNode (i.e. children are blocks, not nodes).
8522
+ */
8523
+ class ContainerBlockSearchStrategy extends BlockSearchStrategy {
8524
+ /**
8525
+ * @inheritDoc
8526
+ */
8527
+ canHandle(block) {
8528
+ return (block.children != null && block.children.length > 0 && !(block.children[0] instanceof RTETextNode));
8529
+ }
8530
+ /**
8531
+ * @inheritDoc
8532
+ */
8533
+ collect(block, recurse) {
8534
+ return recurse(block.children);
8535
+ }
8536
+ }
8537
+
8538
+ /**
8539
+ * Sentinel character inserted into the flat text in place of a non-editable
8540
+ * node (e.g. a token). It keeps surrounding searchable segments from bridging
8541
+ * across the removed node — producing false matches — while never matching any
8542
+ * user keyword. `\u0000` (NULL) does not appear in editable document text.
8543
+ */
8544
+ const NON_EDITABLE_SENTINEL = '\u0000';
8545
+ /**
8546
+ * Manages the in-memory state for a single Find & Replace session.
8547
+ *
8548
+ * One instance is created per editor host inside VegaRTEFindReplaceExtension
8549
+ * during `initialExtensionAfterLoad`. It holds all search results, the
8550
+ * current navigation index, and a per-block flat-text cache.
8551
+ *
8552
+ * Public API:
8553
+ * - `search(content, keyword)` — run a search, replace current state using current options
8554
+ * - `next()` / `prev()` — navigate through results
8555
+ * - `getCurrentMatch()` / `getMatches()` / `getTotal()` / `getCurrentIndex()` — read state
8556
+ * - `clear()` — reset everything
8557
+ */
8558
+ class FindReplaceState {
8559
+ constructor() {
8560
+ this.matches = [];
8561
+ this.currentIndex = -1;
8562
+ this.flatCache = new WeakMap();
8563
+ this.cachedContent = null;
8564
+ this.matchCase = false;
8565
+ this.wholeWords = false;
8566
+ /**
8567
+ * Ordered strategy chain used to classify and traverse each block type.
8568
+ * More specific types (RTEListItemBlock) must precede their parent class (RTETextBlock).
8569
+ */
8570
+ this.blockSearchStrategies = [
8571
+ new CodeBlockSearchStrategy(),
8572
+ new ListItemBlockSearchStrategy(),
8573
+ new TextBlockSearchStrategy(),
8574
+ new ContainerBlockSearchStrategy(),
8575
+ ];
8576
+ }
8577
+ /**
8578
+ * Runs a fresh search over the given content and replaces all previous results.
8579
+ *
8580
+ * The flat-text cache is invalidated whenever the content reference changes
8581
+ * (i.e. after the user edits the document). When only the keyword or options
8582
+ * change (user typing in the find input), the cache is reused.
8583
+ *
8584
+ * @param {VegaRTEContent} content - The root content DTO to search.
8585
+ * @param {string} keyword - The search keyword entered by the user.
8586
+ * Uses the currently stored `matchCase` and `wholeWords` options.
8587
+ */
8588
+ search(content, keyword) {
8589
+ this.invalidateCacheIfNeeded(content);
8590
+ if (!keyword) {
8591
+ this.matches = [];
8592
+ this.currentIndex = -1;
8593
+ return;
8594
+ }
8595
+ const regex = this.buildRegExp(keyword, this.getFindOptions());
8596
+ const blocks = this.collectSearchableBlocks(content.children);
8597
+ const results = [];
8598
+ for (const block of blocks) {
8599
+ let cached = this.flatCache.get(block);
8600
+ if (!cached) {
8601
+ cached =
8602
+ block instanceof RTECodeBlock
8603
+ ? this.buildCodeBlockFlat(block)
8604
+ : this.buildTextBlockFlat(block);
8605
+ this.flatCache.set(block, cached);
8606
+ }
8607
+ const { flatText, segments } = cached;
8608
+ if (!flatText) {
8609
+ continue;
8610
+ }
8611
+ regex.lastIndex = 0;
8612
+ let match;
8613
+ while ((match = regex.exec(flatText)) !== null) {
8614
+ // match[1] is always the keyword capture group. In wholeWords mode,
8615
+ // match[0] may include a leading non-letter boundary char, so we
8616
+ // compute the actual start from the end offset minus the keyword length.
8617
+ const matchEnd = match.index + match[0].length;
8618
+ const matchStart = matchEnd - match[1].length;
8619
+ const nodes = this.flatOffsetToNodePositions(segments, matchStart, matchEnd);
8620
+ if (nodes.length > 0) {
8621
+ results.push({ block, nodes, matchText: match[1] });
8622
+ }
8623
+ }
8624
+ }
8625
+ this.matches = results;
8626
+ this.currentIndex = results.length > 0 ? 0 : -1;
8627
+ }
8628
+ /**
8629
+ * Advances to the next match, wrapping around to the first.
8630
+ */
8631
+ next() {
8632
+ if (this.matches.length === 0) {
8633
+ return;
8634
+ }
8635
+ this.currentIndex = (this.currentIndex + 1) % this.matches.length;
8636
+ }
8637
+ /**
8638
+ * Moves to the previous match, wrapping around to the last.
8639
+ */
8640
+ prev() {
8641
+ if (this.matches.length === 0) {
8642
+ return;
8643
+ }
8644
+ this.currentIndex = (this.currentIndex - 1 + this.matches.length) % this.matches.length;
8645
+ }
8646
+ /**
8647
+ * Sets the current index directly. Clamps to valid range.
8648
+ *
8649
+ * @param {number} index - The desired index.
8650
+ */
8651
+ setCurrentIndex(index) {
8652
+ if (this.matches.length === 0) {
8653
+ this.currentIndex = -1;
8654
+ return;
8655
+ }
8656
+ this.currentIndex = Math.max(0, Math.min(index, this.matches.length - 1));
8657
+ }
8658
+ /**
8659
+ * Returns the currently active match, or null if there are no results.
8660
+ *
8661
+ * @returns {FindMatch | null} The currently active match, or null if there are no results.
8662
+ */
8663
+ getCurrentMatch() {
8664
+ var _a;
8665
+ return (_a = this.matches[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
8666
+ }
8667
+ /**
8668
+ * Returns all matches from the last search.
8669
+ *
8670
+ * @returns {ReadonlyArray<FindMatch>} All matches from the last search.
8671
+ */
8672
+ getMatches() {
8673
+ return this.matches;
8674
+ }
8675
+ /**
8676
+ * Returns the total number of matches from the last search.
8677
+ *
8678
+ * @returns {number} The total number of matches.
8679
+ */
8680
+ getTotal() {
8681
+ return this.matches.length;
8682
+ }
8683
+ /**
8684
+ * Returns the 0-based index of the current match, or -1 when there are no results.
8685
+ *
8686
+ * @returns {number} The 0-based index, or -1 when there are no results.
8687
+ */
8688
+ getCurrentIndex() {
8689
+ return this.currentIndex;
8690
+ }
8691
+ /**
8692
+ * Resets only match results and navigation index.
8693
+ * The flat-text cache and cached content reference are preserved so that
8694
+ * a subsequent search on the same document (e.g. after a keyword change)
8695
+ * can reuse the already-computed block flat texts.
8696
+ */
8697
+ clearResults() {
8698
+ this.matches = [];
8699
+ this.currentIndex = -1;
8700
+ }
8701
+ /**
8702
+ * Resets all search state, including results, navigation index, and flat-text cache.
8703
+ * Use this when the session ends (e.g. panel closed) or the host changes.
8704
+ */
8705
+ clear() {
8706
+ this.matches = [];
8707
+ this.currentIndex = -1;
8708
+ this.flatCache = new WeakMap();
8709
+ this.cachedContent = null;
8710
+ }
8711
+ /**
8712
+ * Sets the matchCase search option.
8713
+ *
8714
+ * @param {boolean} enabled - Whether to enable case-sensitive matching.
8715
+ */
8716
+ setMatchCase(enabled) {
8717
+ this.matchCase = enabled;
8718
+ }
8719
+ /**
8720
+ * Sets the wholeWords search option.
8721
+ *
8722
+ * @param {boolean} enabled - Whether to enable whole-word matching.
8723
+ */
8724
+ setWholeWords(enabled) {
8725
+ this.wholeWords = enabled;
8726
+ }
8727
+ // ─── Private helpers ──────────────────────────────────────────────────────────
8728
+ /**
8729
+ * Invalidates the flat-text cache when the content reference has changed.
8730
+ * Since flushChanges always produces a new VegaRTEContent via clone(), a
8731
+ * changed reference reliably indicates the document has been edited.
8732
+ *
8733
+ * @param {VegaRTEContent} content - The incoming content reference.
8734
+ */
8735
+ invalidateCacheIfNeeded(content) {
8736
+ if (content !== this.cachedContent) {
8737
+ this.flatCache = new WeakMap();
8738
+ this.cachedContent = content;
8739
+ }
8740
+ }
8741
+ /**
8742
+ * Builds a RegExp from the keyword and search options.
8743
+ *
8744
+ * @param {string} keyword - The raw user input.
8745
+ * @param {FindOptions} options - Search options.
8746
+ * @returns {RegExp} The compiled regular expression.
8747
+ */
8748
+ buildRegExp(keyword, options) {
8749
+ const escaped = this.escapeRegExp(keyword);
8750
+ // eslint-disable-next-line spellcheck/spell-checker
8751
+ let flags = 'gu';
8752
+ if (!options.matchCase) {
8753
+ flags += 'i';
8754
+ }
8755
+ if (options.wholeWords) {
8756
+ // Aligned with CKEditor's findByTextCallback non-letter boundary group.
8757
+ //
8758
+ // The keyword is wrapped in a capturing group (match[1]) so the search
8759
+ // loop can compute the exact start offset without lookbehind assertions
8760
+ // (not supported in Safari < 16.4). The non-capturing prefix group
8761
+ // `(?:^|nonLetter)` may consume one boundary char, which is why we
8762
+ // derive matchStart as matchEnd - match[1].length rather than match.index.
8763
+ const nonLetter = '[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF]';
8764
+ const prefix = !new RegExp(`^${nonLetter}`).test(keyword) ? `(?:^|${nonLetter})` : '';
8765
+ const suffix = !new RegExp(`${nonLetter}$`).test(keyword) ? `(?=${nonLetter}|$)` : '';
8766
+ return new RegExp(`${prefix}(${escaped})${suffix}`, flags);
8767
+ }
8768
+ return new RegExp(`(${escaped})`, flags);
8769
+ }
8770
+ /**
8771
+ * Escapes all regex special characters so the keyword is treated as literal text.
8772
+ *
8773
+ * @param {string} text - The raw input string.
8774
+ * @returns {string} The escaped string safe for use in a RegExp constructor.
8775
+ */
8776
+ escapeRegExp(text) {
8777
+ return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
8778
+ }
8779
+ /**
8780
+ * Recursively collects all searchable leaf blocks (RTETextBlock and RTECodeBlock)
8781
+ * from a block tree in document order.
8782
+ *
8783
+ * Each block is dispatched to the first matching BlockSearchStrategy.
8784
+ *
8785
+ * @param {RTEBlock[]} blocks - The block array to traverse.
8786
+ * @returns {(RTETextBlock | RTECodeBlock)[]} Ordered list of searchable leaf blocks.
8787
+ */
8788
+ collectSearchableBlocks(blocks) {
8789
+ const result = [];
8790
+ const recurse = this.collectSearchableBlocks.bind(this);
8791
+ for (const block of blocks) {
8792
+ const strategy = this.blockSearchStrategies.find((s) => s.canHandle(block));
8793
+ if (strategy) {
8794
+ result.push(...strategy.collect(block, recurse));
8795
+ }
8796
+ }
8797
+ return result;
8798
+ }
8799
+ /**
8800
+ * Builds the flat text and segment table for a RTETextBlock.
8801
+ *
8802
+ * Non-editable child nodes (e.g. tokens, which render as read-only chips)
8803
+ * are excluded from the searchable flat text. Each is replaced by a single
8804
+ * sentinel character so that adjacent editable segments cannot bridge across
8805
+ * the token to form a false match, while keeping segment offsets aligned.
8806
+ *
8807
+ * @param {RTETextBlock} block - The text block to flatten.
8808
+ * @returns {BlockFlatCache} The flat text string and segment mapping.
8809
+ */
8810
+ buildTextBlockFlat(block) {
8811
+ const segments = [];
8812
+ const flatParts = [];
8813
+ let cursor = 0;
8814
+ for (const node of block.children) {
8815
+ if (!node.isContentEditable()) {
8816
+ flatParts.push(NON_EDITABLE_SENTINEL);
8817
+ cursor += NON_EDITABLE_SENTINEL.length;
8818
+ continue;
8819
+ }
8820
+ const len = node.text.length;
8821
+ segments.push({ node, start: cursor, end: cursor + len });
8822
+ flatParts.push(node.text);
8823
+ cursor += len;
8824
+ }
8825
+ return {
8826
+ flatText: flatParts.join(''),
8827
+ segments,
8828
+ };
8829
+ }
8830
+ /**
8831
+ * Builds the flat text and segment table for a RTECodeBlock.
8832
+ *
8833
+ * @param {RTECodeBlock} block - The code block to flatten.
8834
+ * @returns {BlockFlatCache} The flat text string and segment mapping.
8835
+ */
8836
+ buildCodeBlockFlat(block) {
8837
+ const codeNode = block.children[0];
8838
+ if (!codeNode) {
8839
+ return { flatText: '', segments: [] };
8840
+ }
8841
+ const flatText = codeNode.text;
8842
+ return {
8843
+ flatText,
8844
+ segments: [{ node: codeNode, start: 0, end: flatText.length }],
8845
+ };
8846
+ }
8847
+ /**
8848
+ * Maps a flat [matchStart, matchEnd) range back to individual node positions.
8849
+ *
8850
+ * @param {(TextSegment | CodeSegment)[]} segments - The segment table.
8851
+ * @param {number} matchStart - Inclusive start in the flat text.
8852
+ * @param {number} matchEnd - Exclusive end in the flat text.
8853
+ * @returns {NodePosition[]} Ordered list of node-local positions spanning the match.
8854
+ */
8855
+ flatOffsetToNodePositions(segments, matchStart, matchEnd) {
8856
+ const positions = [];
8857
+ for (const segment of segments) {
8858
+ if (segment.end <= matchStart) {
8859
+ continue;
8860
+ }
8861
+ if (segment.start >= matchEnd) {
8862
+ break;
8863
+ }
8864
+ const localStart = Math.max(0, matchStart - segment.start);
8865
+ const localEnd = Math.min(segment.end, matchEnd) - segment.start;
8866
+ positions.push({ node: segment.node, startOffset: localStart, endOffset: localEnd });
8867
+ }
8868
+ return positions;
8869
+ }
8870
+ /**
8871
+ * Builds the current find options from the shared context.
8872
+ *
8873
+ * @returns {FindOptions} The options for the search engine.
8874
+ */
8875
+ getFindOptions() {
8876
+ return { matchCase: this.matchCase, wholeWords: this.wholeWords };
8877
+ }
8878
+ }
8879
+
8880
+ // Light-mode values (used as CSS var() fall-backs).
8881
+ // Dark-mode values are registered via VegaDarkModeStyleController below.
8882
+ const HIGHLIGHT_BG_LIGHT = '255, 220, 0, 0.35';
8883
+ const HIGHLIGHT_ACTIVE_BG_LIGHT = '255, 150, 0, 0.5';
8884
+ // Dark-mode: brighter yellow/orange tones stand out on dark backgrounds.
8885
+ const HIGHLIGHT_BG_DARK = '255, 235, 0, 0.55';
8886
+ const HIGHLIGHT_ACTIVE_BG_DARK = '255, 190, 0, 0.7';
8887
+ // CSS var() expressions that auto-switch between light and dark.
8888
+ const HIGHLIGHT_BG = `rgba(var(--v-rte-find-highlight-bg, ${HIGHLIGHT_BG_LIGHT}))`;
8889
+ const HIGHLIGHT_ACTIVE_BG = `rgba(var(--v-rte-find-highlight-active-bg, ${HIGHLIGHT_ACTIVE_BG_LIGHT}))`;
8890
+ /**
8891
+ * Manages highlights for the Find & Replace extension using a DOM overlay.
8892
+ *
8893
+ * Instead of modifying the RTE content tree (which causes re-renders, cursor
8894
+ * jumping, and VegaChange events), this manager renders semi-transparent
8895
+ * highlight rectangles in an absolutely-positioned overlay container.
8896
+ *
8897
+ * The overlay lives inside `.rich-text-editor-container` (the RTE's scroll
8898
+ * container) so highlight divs scroll naturally with the text content.
8899
+ * `pointer-events: none` ensures highlights don't interfere with user
8900
+ * interaction (selection, typing, clicking).
8901
+ *
8902
+ * Position computation uses `Range.getClientRects()` on the actual text DOM
8903
+ * nodes (resolved via `stateEntityRenderingRegistry.getDOMByEntity`).
8904
+ */
8905
+ class FindReplaceHighlightManager {
8906
+ constructor() {
8907
+ this.overlayContainer = null;
8908
+ // Register dark-mode overrides so `html.dark { --v-rte-find-highlight-*: ... }` is generated.
8909
+ // CSS variables cascade into shadow DOM and update automatically when html.dark is toggled.
8910
+ VegaDarkModeStyleController.registerCustomDarkModeColor({
8911
+ 'rte-find-highlight-bg': HIGHLIGHT_BG_DARK,
8912
+ 'rte-find-highlight-active-bg': HIGHLIGHT_ACTIVE_BG_DARK,
8913
+ 'rte-find-highlight-blend': 'lighten',
8914
+ });
8915
+ }
8916
+ /**
8917
+ * Renders highlight overlays for all matches, with the active match
8918
+ * visually distinct. Clears any existing highlights before applying.
8919
+ *
8920
+ * @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
8921
+ * @param {ReadonlyArray<FindMatch>} matches - All search results.
8922
+ * @param {number} currentIndex - 0-based index of the active match (-1 = none).
8923
+ * @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
8924
+ * @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
8925
+ */
8926
+ apply(matches, currentIndex, host, scrollToActive = true) {
8927
+ this.clear();
8928
+ if (matches.length === 0) {
8929
+ return;
8930
+ }
8931
+ const overlay = this.getOrCreateOverlay(host);
8932
+ if (overlay) {
8933
+ const overlayRect = overlay.getBoundingClientRect();
8934
+ let activeHighlightDiv = null;
8935
+ matches.forEach((match, matchIndex) => {
8936
+ const isActive = matchIndex === currentIndex;
8937
+ const bg = isActive ? HIGHLIGHT_ACTIVE_BG : HIGHLIGHT_BG;
8938
+ match.nodes.forEach((nodePosition) => {
8939
+ const highlightDiv = this.createHighlightRectangles(overlay, overlayRect, nodePosition, bg);
8940
+ if (isActive && !activeHighlightDiv && highlightDiv) {
8941
+ activeHighlightDiv = highlightDiv;
8942
+ }
8943
+ });
8944
+ });
8945
+ if (scrollToActive && activeHighlightDiv) {
8946
+ activeHighlightDiv.scrollIntoView({ block: 'center', inline: 'nearest' });
8947
+ }
8948
+ }
8949
+ }
8950
+ /**
8951
+ * Removes all highlight overlay elements.
8952
+ * Safe to call multiple times or when no highlights are active.
8953
+ */
8954
+ clear() {
8955
+ if (this.overlayContainer) {
8956
+ this.overlayContainer.innerHTML = '';
8957
+ }
8958
+ }
8959
+ // ─── Private helpers ──────────────────────────────────────────────────────────
8960
+ /**
8961
+ * Gets the existing overlay container or creates one inside the RTE's
8962
+ * scroll container (`.rich-text-editor-container`).
8963
+ *
8964
+ * @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
8965
+ * @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
8966
+ * @returns {HTMLDivElement | null} The overlay container, or null in SSR environments.
8967
+ */
8968
+ getOrCreateOverlay(host) {
8969
+ if (this.overlayContainer && this.overlayContainer.isConnected) {
8970
+ return this.overlayContainer;
8971
+ }
8972
+ const safeDocument = tryGetDocument();
8973
+ if (safeDocument) {
8974
+ const scrollContainer = host.shadowRoot.querySelector('.rich-text-editor-container');
8975
+ if (scrollContainer) {
8976
+ // The overlay is appended as the last child (paints above content).
8977
+ // Blend mode is controlled via CSS variable --v-rte-find-highlight-blend:
8978
+ // - Light (default): multiply (yellow darkens white bg, text readable)
8979
+ // - Dark (via html.dark override): lighten (yellow visible on dark bg,
8980
+ // white text unaffected since lighten(255, x) = 255)
8981
+ // CSS vars cascade into shadow DOM and react to theme switches instantly.
8982
+ const overlay = safeDocument.createElement('div');
8983
+ overlay.style.position = 'absolute';
8984
+ overlay.style.top = '0';
8985
+ overlay.style.left = '0';
8986
+ overlay.style.width = '100%';
8987
+ overlay.style.height = '100%';
8988
+ overlay.style.pointerEvents = 'none';
8989
+ overlay.style.overflow = 'visible';
8990
+ overlay.style.setProperty('mix-blend-mode', 'var(--v-rte-find-highlight-blend, multiply)');
8991
+ scrollContainer.appendChild(overlay);
8992
+ this.overlayContainer = overlay;
8993
+ return overlay;
8994
+ }
8995
+ }
8996
+ return null;
8997
+ }
8998
+ /**
8999
+ * Creates absolutely-positioned highlight rectangles for a single node
9000
+ * position within a match.
9001
+ *
9002
+ * Uses client rectangle extraction from `Range` to handle multi-line matches (where a
9003
+ * single text range may produce multiple rectangles due to line wrapping).
9004
+ *
9005
+ * @param {HTMLDivElement} overlay - The overlay container.
9006
+ * @param {DOMRect} overlayRect - The overlay's bounding client rect (for coordinate conversion).
9007
+ * @param {NodePosition} nodePosition - The node and character offsets for this segment.
9008
+ * @param {string} bg - The background color to apply.
9009
+ * @returns {Nullable<HTMLDivElement>} The first created highlight div for this node segment.
9010
+ */
9011
+ createHighlightRectangles(overlay, overlayRect, nodePosition, bg) {
9012
+ const domElement = stateEntityRenderingRegistry.getDOMByEntity(nodePosition.node);
9013
+ if (!domElement) {
9014
+ return null;
9015
+ }
9016
+ const range = this.buildRange(domElement, nodePosition);
9017
+ if (!range) {
9018
+ return null;
9019
+ }
9020
+ // eslint-disable-next-line spellcheck/spell-checker -- DOM API method name is fixed by platform.
9021
+ const clientRectList = range.getClientRects();
9022
+ const safeDocument = tryGetDocument();
9023
+ let firstHighlightDiv = null;
9024
+ if (safeDocument) {
9025
+ for (let i = 0; i < clientRectList.length; i++) {
9026
+ const rect = clientRectList[i];
9027
+ if (rect.width === 0 || rect.height === 0) {
9028
+ continue;
9029
+ }
9030
+ const div = safeDocument.createElement('div');
9031
+ div.style.position = 'absolute';
9032
+ div.style.top = `${rect.top - overlayRect.top}px`;
9033
+ div.style.left = `${rect.left - overlayRect.left}px`;
9034
+ div.style.width = `${rect.width}px`;
9035
+ div.style.height = `${rect.height}px`;
9036
+ div.style.backgroundColor = bg;
9037
+ div.style.pointerEvents = 'none';
9038
+ div.style.borderRadius = '2px';
9039
+ overlay.appendChild(div);
9040
+ if (!firstHighlightDiv) {
9041
+ firstHighlightDiv = div;
9042
+ }
9043
+ }
9044
+ }
9045
+ return firstHighlightDiv;
9046
+ }
9047
+ /**
9048
+ * Builds a DOM Range for the given node position.
9049
+ *
9050
+ * For standard text nodes (RTETextNode rendered as `<span>`), the first
9051
+ * child is a Text node and offsets apply directly.
9052
+ *
9053
+ * For code block nodes (`<vega-code-block>` with shadow DOM), we traverse
9054
+ * the shadow root's `<code>` element child spans to locate the correct
9055
+ * text positions by accumulated character offset.
9056
+ *
9057
+ * @param {HTMLElement} domElement - The registered DOM element for the node.
9058
+ * @param {NodePosition} nodePosition - The character offsets within the node.
9059
+ * @returns {Nullable<Range>} A Range if successfully built, or null on failure.
9060
+ */
9061
+ buildRange(domElement, nodePosition) {
9062
+ // <vega-code-block> wraps syntax-highlighted tokens inside a shadow root <code> element.
9063
+ if (nodePosition.node instanceof RTECodeBlockNode) {
9064
+ return this.buildCodeBlockRange(domElement, nodePosition);
9065
+ }
9066
+ // Standard text node: <span> with a direct Text child.
9067
+ const textNode = domElement.firstChild;
9068
+ if (!textNode) {
9069
+ return null;
9070
+ }
9071
+ const safeDocument = tryGetDocument();
9072
+ if (safeDocument) {
9073
+ const range = safeDocument.createRange();
9074
+ try {
9075
+ range.setStart(textNode, nodePosition.startOffset);
9076
+ range.setEnd(textNode, nodePosition.endOffset);
9077
+ return range;
9078
+ }
9079
+ catch (_a) {
9080
+ return null;
9081
+ }
9082
+ }
9083
+ return null;
9084
+ }
9085
+ /**
9086
+ * Builds a Range inside a `<vega-code-block>` shadow DOM element.
9087
+ *
9088
+ * `<vega-code-block>` renders its content inside a shadow root with a `<code>`
9089
+ * element containing multiple child `<span>` nodes (one per syntax token).
9090
+ * This method walks all Text nodes within that `<code>` element, accumulating
9091
+ * character length until the positions corresponding to startOffset / endOffset
9092
+ * are found.
9093
+ *
9094
+ * @param {HTMLElement} domElement - The `<vega-code-block>` host element.
9095
+ * @param {NodePosition} nodePosition - The character offsets within the node.
9096
+ * @returns {Range | null} A Range if successfully built, or null on failure.
9097
+ */
9098
+ buildCodeBlockRange(domElement, nodePosition) {
9099
+ const shadowRoot = domElement.shadowRoot;
9100
+ const codeEl = shadowRoot.querySelector('code');
9101
+ if (!codeEl) {
9102
+ return null;
9103
+ }
9104
+ const safeDocument = tryGetDocument();
9105
+ if (safeDocument) {
9106
+ const walker = safeDocument.createTreeWalker(codeEl, NodeFilter.SHOW_TEXT);
9107
+ let accumulated = 0;
9108
+ let startNode = null;
9109
+ let startLocal = 0;
9110
+ let endNode = null;
9111
+ let endLocal = 0;
9112
+ let current = walker.nextNode();
9113
+ while (current) {
9114
+ const len = current.textContent.length;
9115
+ if (!startNode && accumulated + len > nodePosition.startOffset) {
9116
+ startNode = current;
9117
+ startLocal = nodePosition.startOffset - accumulated;
9118
+ }
9119
+ if (accumulated + len >= nodePosition.endOffset) {
9120
+ endNode = current;
9121
+ endLocal = nodePosition.endOffset - accumulated;
9122
+ break;
9123
+ }
9124
+ accumulated += len;
9125
+ current = walker.nextNode();
9126
+ }
9127
+ if (startNode && endNode) {
9128
+ const range = safeDocument.createRange();
9129
+ try {
9130
+ range.setStart(startNode, startLocal);
9131
+ range.setEnd(endNode, endLocal);
9132
+ return range;
9133
+ }
9134
+ catch (_a) {
9135
+ return null;
9136
+ }
9137
+ }
9138
+ }
9139
+ return null;
9140
+ }
9141
+ }
9142
+
9143
+ /**
9144
+ * Creates a new shared controller context with default (empty) state.
9145
+ *
9146
+ * @returns {FindReplaceControllerContext} A fresh context instance.
9147
+ */
9148
+ function createFindReplaceControllerContext() {
9149
+ return {
9150
+ state: new FindReplaceState(),
9151
+ highlightManager: new FindReplaceHighlightManager(),
9152
+ hostRef: null,
9153
+ keyword: '',
9154
+ };
9155
+ }
9156
+ /**
9157
+ * Abstract base controller for the Find & Replace extension.
9158
+ *
9159
+ * Holds shared operations ({@link setHost}, {@link setKeyword}) and the
9160
+ * common helper {@link applyAndGetResult}. Concrete implementations
9161
+ * ({@link FindController}, {@link ReplaceController}) add the respective
9162
+ * search/navigation and mutation capabilities.
9163
+ */
9164
+ class FindReplaceControllerAbstract {
9165
+ constructor(context) {
9166
+ this.context = context;
9167
+ }
9168
+ /**
9169
+ * Updates the cached host reference. Called on each render cycle.
9170
+ *
9171
+ * @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
9172
+ * @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
9173
+ */
9174
+ setHost(host) {
9175
+ this.context.hostRef = host;
9176
+ }
9177
+ /**
9178
+ * Updates the keyword. Clears previous match results and highlights,
9179
+ * but preserves the flat-text cache so the next find() on the same
9180
+ * document does not re-flatten every block.
9181
+ *
9182
+ * @param {string} keyword - The new search keyword.
9183
+ * @returns {FindReplaceResult} Reset result (0/0).
9184
+ */
9185
+ setKeyword(keyword) {
9186
+ this.context.keyword = keyword;
9187
+ this.context.state.clearResults();
9188
+ if (this.context.hostRef) {
9189
+ this.context.highlightManager.clear();
9190
+ }
9191
+ return { current: 0, total: 0 };
9192
+ }
9193
+ // ─── Protected ────────────────────────────────────────────────────────────────
9194
+ /**
9195
+ * Applies highlight overlays and returns the current result for the panel.
9196
+ *
9197
+ * @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
9198
+ * @returns {FindReplaceResult} The current match position and total count.
9199
+ */
9200
+ applyAndGetResult(scrollToActive = true) {
9201
+ const total = this.context.state.getTotal();
9202
+ const current = total > 0 ? this.context.state.getCurrentIndex() + 1 : 0;
9203
+ if (this.context.hostRef) {
9204
+ this.context.highlightManager.apply(this.context.state.getMatches(), this.context.state.getCurrentIndex(), this.context.hostRef, scrollToActive);
9205
+ }
9206
+ return { current, total };
9207
+ }
9208
+ }
9209
+
9210
+ /**
9211
+ * Concrete find controller.
9212
+ *
9213
+ * Provides search, navigation, highlight, and lifecycle capabilities.
9214
+ * Shares state with {@link ReplaceController} via the injected
9215
+ * {@link FindReplaceControllerContext}.
9216
+ */
9217
+ class FindController extends FindReplaceControllerAbstract {
9218
+ constructor(context) {
9219
+ super(context);
9220
+ }
9221
+ /**
9222
+ * Runs a search with the current keyword on the host's content.
9223
+ * Applies highlights and returns the result for panel display.
9224
+ *
9225
+ * @returns {FindReplaceResult} The match count and current position.
9226
+ */
9227
+ find() {
9228
+ if (!this.context.hostRef) {
9229
+ return { current: 0, total: 0 };
9230
+ }
9231
+ this.context.state.search(this.context.hostRef.value, this.context.keyword);
9232
+ return this.applyAndGetResult();
9233
+ }
9234
+ /**
9235
+ * Navigates to the next match.
9236
+ *
9237
+ * @returns {FindReplaceResult} Updated position.
9238
+ */
9239
+ next() {
9240
+ this.context.state.next();
9241
+ return this.applyAndGetResult();
9242
+ }
9243
+ /**
9244
+ * Navigates to the previous match.
9245
+ *
9246
+ * @returns {FindReplaceResult} Updated position.
9247
+ */
9248
+ prev() {
9249
+ this.context.state.prev();
9250
+ return this.applyAndGetResult();
9251
+ }
9252
+ /**
9253
+ * Clears all search state and removes highlight overlays.
9254
+ */
9255
+ clear() {
9256
+ this.context.state.clear();
9257
+ if (this.context.hostRef) {
9258
+ this.context.highlightManager.clear();
9259
+ }
9260
+ }
9261
+ /**
9262
+ * Re-runs the search after content has changed (e.g. user typed while
9263
+ * panel is open). Attempts to preserve the previous navigation position.
9264
+ *
9265
+ * @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
9266
+ * @returns {FindReplaceResult | null} Updated result, or null if no search is active.
9267
+ */
9268
+ refresh(scrollToActive = true) {
9269
+ if (!this.context.keyword || !this.context.hostRef) {
9270
+ return null;
9271
+ }
9272
+ const prevIndex = this.context.state.getCurrentIndex();
9273
+ this.context.state.search(this.context.hostRef.value, this.context.keyword);
9274
+ this.context.state.setCurrentIndex(prevIndex);
9275
+ return this.applyAndGetResult(scrollToActive);
9276
+ }
9277
+ /**
9278
+ * Toggles the match-case search option, clears previous results,
9279
+ * and re-runs the search if a keyword is set.
9280
+ *
9281
+ * @param {boolean} enabled - Whether match-case should be enabled.
9282
+ * @returns {FindReplaceResult} The updated search result.
9283
+ */
9284
+ setMatchCase(enabled) {
9285
+ this.context.state.setMatchCase(enabled);
9286
+ return this.updateFindResults();
9287
+ }
9288
+ /**
9289
+ * Toggles the whole-words search option, clears previous results,
9290
+ * and re-runs the search if a keyword is set.
9291
+ *
9292
+ * @param {boolean} enabled - Whether whole-words should be enabled.
9293
+ * @returns {FindReplaceResult} The updated search result.
9294
+ */
9295
+ setWholeWords(enabled) {
9296
+ this.context.state.setWholeWords(enabled);
9297
+ return this.updateFindResults();
9298
+ }
9299
+ // ─── Private helpers ──────────────────────────────────────────────────────────
9300
+ /**
9301
+ * Clears previous results and re-runs the search with the current keyword and options.
9302
+ *
9303
+ * @returns {FindReplaceResult} The updated search result.
9304
+ */
9305
+ updateFindResults() {
9306
+ this.context.state.clearResults();
9307
+ if (this.context.keyword && this.context.hostRef) {
9308
+ this.context.state.search(this.context.hostRef.value, this.context.keyword);
9309
+ return this.applyAndGetResult();
9310
+ }
9311
+ return { current: 0, total: 0 };
9312
+ }
9313
+ }
9314
+
9315
+ /**
9316
+ * Replace controller — adds mutation capabilities on top of the shared
9317
+ * find state.
9318
+ *
9319
+ * Shares state with {@link FindController} via the injected
9320
+ * {@link FindReplaceControllerContext}, so both controllers always operate
9321
+ * on the same search results and highlight overlays.
9322
+ */
9323
+ class ReplaceController extends FindReplaceControllerAbstract {
9324
+ constructor(context) {
9325
+ super(context);
9326
+ /** The replacement string used by replace() and replaceAll(). Updated via setReplacement(). */
9327
+ this.replacement = '';
9328
+ this.flushFn = null;
9329
+ }
9330
+ /**
9331
+ * Stores the flush callback used to commit content changes to the editor.
9332
+ * Called by the toolbar renderer after obtaining it from the extension context.
9333
+ *
9334
+ * Calling `flushValue` once — even after mutating multiple nodes — creates a
9335
+ * single entry in the editor's undo stack, so the entire replace/replaceAll
9336
+ * operation is undone as one atomic step.
9337
+ *
9338
+ * @param {(value: VegaRTEContent) => void} fn - The flush function.
9339
+ * @returns {void} No return value.
9340
+ */
9341
+ setFlushValue(fn) {
9342
+ this.flushFn = fn;
9343
+ }
9344
+ /**
9345
+ * Stores the replacement text for the next replace() or replaceAll() call.
9346
+ *
9347
+ * @param {string} text - The replacement string.
9348
+ * @returns {void} No return value.
9349
+ */
9350
+ setReplacement(text) {
9351
+ this.replacement = text;
9352
+ }
9353
+ /**
9354
+ * Replaces the current match with the stored replacement text,
9355
+ * advances to the next match, and refreshes highlights.
9356
+ * An empty replacement string deletes the matched text.
9357
+ *
9358
+ * No-op when there is no current match or no host.
9359
+ *
9360
+ * @returns {FindReplaceResult} Updated match position and total.
9361
+ */
9362
+ replace() {
9363
+ const currentMatch = this.context.state.getCurrentMatch();
9364
+ if (currentMatch && this.context.hostRef && this.flushFn) {
9365
+ const previousIndex = this.context.state.getCurrentIndex();
9366
+ this.applyMatchReplacement(currentMatch);
9367
+ this.flushFn(this.context.hostRef.value);
9368
+ this.context.state.clear();
9369
+ this.context.state.search(this.context.hostRef.value, this.context.keyword);
9370
+ // setCurrentIndex clamps to [0, total-1], so passing previousIndex
9371
+ // directly keeps the cursor as close as possible to the replaced position
9372
+ // rather than wrapping around when previousIndex >= total.
9373
+ this.context.state.setCurrentIndex(previousIndex);
9374
+ }
9375
+ return this.applyAndGetResult();
9376
+ }
9377
+ /**
9378
+ * Replaces all matches with the stored replacement text in a single operation
9379
+ * (one flushValue call = one Undo step), then re-runs the search.
9380
+ * An empty replacement string deletes all matched text.
9381
+ *
9382
+ * No-op when there are no matches or no host.
9383
+ *
9384
+ * @returns {FindReplaceResult} Updated match position and total.
9385
+ */
9386
+ replaceAll() {
9387
+ if (this.context.state.getTotal() > 0 && this.flushFn && this.context.hostRef) {
9388
+ const matches = this.context.state.getMatches();
9389
+ // Iterate in reverse so that mutating a later match does not shift the
9390
+ // startOffset/endOffset of earlier matches that have not yet been processed.
9391
+ for (let i = matches.length - 1; i >= 0; i -= 1) {
9392
+ this.applyMatchReplacement(matches[i]);
9393
+ }
9394
+ this.flushFn(this.context.hostRef.value);
9395
+ this.context.state.clear();
9396
+ this.context.state.search(this.context.hostRef.value, this.context.keyword);
9397
+ }
9398
+ return this.applyAndGetResult();
9399
+ }
9400
+ // ─── Private ──────────────────────────────────────────────────────────────────
9401
+ /**
9402
+ * Directly mutates the matched nodes in the live content tree.
9403
+ * `position.node` is already a reference into `this.context.hostRef.value`,
9404
+ * so no cloning or path navigation is needed.
9405
+ *
9406
+ * For multi-node (cross-span) matches the first node receives the replacement
9407
+ * text and every subsequent node has its matched slice deleted.
9408
+ *
9409
+ * This method mutates the content tree in place. The caller is
9410
+ * responsible for calling `state.clear()` afterwards to invalidate the
9411
+ * flat-text cache, which uses reference equality and will not detect the
9412
+ * in-place change automatically.
9413
+ *
9414
+ * @param {FindMatch} match - The match to replace.
9415
+ * @returns {void} No return value.
9416
+ */
9417
+ applyMatchReplacement(match) {
9418
+ match.nodes.forEach((position, index) => {
9419
+ const replacementText = index === 0 ? this.replacement : '';
9420
+ position.node.text =
9421
+ position.node.text.slice(0, position.startOffset) +
9422
+ replacementText +
9423
+ position.node.text.slice(position.endOffset);
9424
+ });
9425
+ }
9426
+ }
9427
+
9428
+ /**
9429
+ * Toolbar button renderer for the Find & Replace extension.
9430
+ *
9431
+ * Responsible only for UI concerns:
9432
+ * - Renders the toolbar button wrapped in a vega-popover.
9433
+ * - Wires panel events to the {@link FindController} and {@link ReplaceController}.
9434
+ * - Pushes controller results back to the panel display.
9435
+ *
9436
+ * Both controllers share a single {@link FindReplaceControllerContext} so they
9437
+ * operate on the same search state and highlight overlays.
9438
+ */
9439
+ class FindReplaceToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
9440
+ constructor() {
9441
+ super(...arguments);
9442
+ this.sharedContext = createFindReplaceControllerContext();
9443
+ this.findController = new FindController(this.sharedContext);
9444
+ this.replaceController = new ReplaceController(this.sharedContext);
9445
+ this.panelRef = null;
9446
+ this.popoverRef = null;
9447
+ this.isPopoverOpen = false;
9448
+ this.scrollOnNextRefresh = false;
9449
+ this.debouncedRefresh = debounce(this.onContentChanged, 100, this);
9450
+ /* eslint-disable jsdoc/require-jsdoc */
9451
+ this.panelActionHandlers = {
9452
+ 'find': () => this.findController.find(),
9453
+ 'prev': () => this.findController.prev(),
9454
+ 'next': () => this.findController.next(),
9455
+ 'replace': () => {
9456
+ this.scrollOnNextRefresh = true;
9457
+ return this.replaceController.replace();
9458
+ },
9459
+ 'replace-all': () => {
9460
+ this.scrollOnNextRefresh = true;
9461
+ return this.replaceController.replaceAll();
9462
+ },
9463
+ 'match-case': (data) => this.findController.setMatchCase(data),
9464
+ 'whole-words': (data) => this.findController.setWholeWords(data),
9465
+ 'close': () => this.closePanel(),
9466
+ };
9467
+ }
9468
+ /* eslint-enable jsdoc/require-jsdoc */
9469
+ /**
9470
+ * @inheritDoc
9471
+ */
9472
+ render(h, editorContext) {
9473
+ this.syncEditorState(editorContext);
9474
+ return h('vega-popover', {
9475
+ trigger: 'none',
9476
+ alignment: 'start',
9477
+ placement: 'bottom',
9478
+ showArrow: false,
9479
+ isScreenPosition: true,
9480
+ // eslint-disable-next-line jsdoc/require-jsdoc
9481
+ ref: (ref) => {
9482
+ if (ref) {
9483
+ this.popoverRef = ref;
9484
+ DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaPopoverHide, () => {
9485
+ this.isPopoverOpen = false;
9486
+ this.findController.clear();
9487
+ this.updatePanel({ current: 0, total: 0 });
9488
+ });
9489
+ DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaPopoverShow, () => {
9490
+ this.isPopoverOpen = true;
9491
+ });
9492
+ }
9493
+ },
9494
+ }, [
9495
+ h('div', { slot: 'popover' }, [
9496
+ h('vega-rich-text-find-replace-panel', {
9497
+ // eslint-disable-next-line jsdoc/require-jsdoc
9498
+ ref: (ref) => {
9499
+ if (ref) {
9500
+ this.panelRef = ref;
9501
+ DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, (e) => {
9502
+ if (e.detail.type === 'keyword') {
9503
+ this.updatePanel(this.findController.setKeyword(e.detail.value));
9504
+ }
9505
+ else if (e.detail.type === 'replace') {
9506
+ this.replaceController.setReplacement(e.detail.value);
9507
+ }
9508
+ });
9509
+ DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaClick, (payload) => {
9510
+ this.handlePanelAction(payload.detail);
9511
+ });
9512
+ }
9513
+ },
9514
+ }),
9515
+ ]),
9516
+ h('div', { slot: 'popover-content' }, this.renderButton(h, editorContext, {
9517
+ icon: 'rte-find-replace',
9518
+ tooltip: { text: VegaInternalTranslation.t('Find and replace') },
9519
+ })),
9520
+ ]);
9521
+ }
9522
+ /**
9523
+ * Toggles the popover open/close when the toolbar button is clicked.
9524
+ */
9525
+ handleButtonClick() {
9526
+ if (this.popoverRef) {
9527
+ if (this.isPopoverOpen) {
9528
+ void this.popoverRef.hide();
9529
+ }
9530
+ else {
9531
+ void this.popoverRef.show();
9532
+ }
9533
+ }
9534
+ }
9535
+ /* istanbul ignore next */
9536
+ /**
9537
+ * Not used — this button has no dropdown.
9538
+ */
9539
+ handleDropdownClick() {
9540
+ // no-op
9541
+ }
9542
+ // ─── Private helpers ──────────────────────────────────────────────────────────
9543
+ /**
9544
+ * Synchronizes internal state with the editor context on each render cycle.
9545
+ * Registers the host reference and content-change listener, and hides the
9546
+ * popover if the toolbar item becomes hidden while open.
9547
+ *
9548
+ * @param {VegaRTEToolbarRenderContext} editorContext - The render context.
9549
+ */
9550
+ syncEditorState(editorContext) {
9551
+ this.findController.setHost(editorContext.host);
9552
+ const extensionContext = this.getExtensionContext(editorContext.host);
9553
+ if (extensionContext) {
9554
+ this.replaceController.setFlushValue(extensionContext.flushValue);
9555
+ }
9556
+ DomNodeSubjectObserverFactory.addUniqueObserverToNode(editorContext.host, VegaChange, this.debouncedRefresh);
9557
+ if (this.isHidden(editorContext) && this.isPopoverOpen && this.popoverRef) {
9558
+ void this.popoverRef.hide();
9559
+ }
9560
+ }
9561
+ /**
9562
+ * Dispatches panel button actions to the controller.
9563
+ *
9564
+ * @param {FindReplacePanelAction} panelAction - The structured action emitted by the panel.
9565
+ */
9566
+ handlePanelAction(panelAction) {
9567
+ const { action, data } = panelAction;
9568
+ const handler = this.panelActionHandlers[action];
9569
+ if (handler) {
9570
+ const result = handler(data);
9571
+ if (result) {
9572
+ this.updatePanel(result);
9573
+ }
9574
+ }
9575
+ }
9576
+ /**
9577
+ * Pushes result to the panel counter display.
9578
+ *
9579
+ * @param {FindReplaceResult} result - The current/total values.
9580
+ */
9581
+ updatePanel(result) {
9582
+ if (this.panelRef) {
9583
+ void this.panelRef.updateResult(result.current, result.total);
9584
+ }
9585
+ }
9586
+ /**
9587
+ * Content changed — ask the controller to refresh search results.
9588
+ */
9589
+ onContentChanged() {
9590
+ if (!this.isPopoverOpen) {
9591
+ return;
9592
+ }
9593
+ const shouldScroll = this.scrollOnNextRefresh;
9594
+ this.scrollOnNextRefresh = false;
9595
+ const result = this.findController.refresh(shouldScroll);
9596
+ if (result) {
9597
+ this.updatePanel(result);
9598
+ }
9599
+ }
9600
+ /**
9601
+ * Closes the panel popover.
9602
+ */
9603
+ closePanel() {
9604
+ if (this.popoverRef) {
9605
+ void this.popoverRef.hide();
9606
+ }
9607
+ }
9608
+ }
9609
+ (() => {
9610
+ VegaInternalIconManager.register({ 'rte-find-replace': findReplaceIcon });
9611
+ })();
9612
+
9613
+ /**
9614
+ * Find & Replace extension for Vega Rich Text Editor.
9615
+ *
9616
+ * Registers a toolbar button (magnifying-glass icon) that toggles the find-replace panel.
9617
+ * Each editor host gets its own isolated FindReplaceState and toolbar renderer instance,
9618
+ * created during the per-host prepareBeforeLoad lifecycle hook.
9619
+ *
9620
+ * Toolbar key: 'findReplace'
9621
+ */
9622
+ class VegaRTEFindReplaceExtension extends VegaRTEExtension {
9623
+ /** @inheritDoc */
9624
+ prepareBeforeLoad(host) {
9625
+ this.registerToolbarButtonRenderer(VegaRTEFindReplaceExtension.TOOLBAR_BUTTON_KEY, new FindReplaceToolbarButtonRenderer(), host);
9626
+ }
9627
+ }
9628
+ VegaRTEFindReplaceExtension.TOOLBAR_BUTTON_KEY = 'findReplace';
8430
9629
 
8431
9630
  /**
8432
9631
  * Default line height options used by the line-height extension when no
@@ -8827,7 +10026,7 @@ class VegaRTELineHeightExtension extends VegaRTEExtension {
8827
10026
  */
8828
10027
  prepareBeforeLoad(host) {
8829
10028
  this.toolbarButtonRenderer = new RTELineHeightToolbarButtonRenderer(this.options);
8830
- this.registerToolbarButtonRenderer('lineHeight', this.toolbarButtonRenderer, host);
10029
+ this.registerToolbarButtonRenderer(VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer, host);
8831
10030
  }
8832
10031
  }
8833
10032
  (() => {
@@ -8837,6 +10036,396 @@ class VegaRTELineHeightExtension extends VegaRTEExtension {
8837
10036
  attachLineHeightFromJson(BlockClass);
8838
10037
  });
8839
10038
  })();
10039
+ VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY = 'lineHeight';
10040
+
10041
+ /**
10042
+ * Action to extract the currently selected content (HTML and plain text) from the editor.
10043
+ *
10044
+ * The action is read-only: it does not mutate the content state. The handling strategy resolves
10045
+ * the selected HTML and plain text and writes them directly to the clipboard.
10046
+ *
10047
+ * @example host.value.apply(new CopySelectedContentAction(selection, selectedNodes));
10048
+ */
10049
+ class CopySelectedContentAction extends ModifyContentAction {
10050
+ constructor(selection, selectedNodes) {
10051
+ super();
10052
+ this.type = 'COPY_SELECTED_CONTENT_ACTION';
10053
+ this.selection = null;
10054
+ this.selectedNodes = [];
10055
+ // The result of the copy operation, which may be a Promise if the clipboard write is asynchronous.
10056
+ this.copyResult = null;
10057
+ this.selection = selection;
10058
+ this.selectedNodes = selectedNodes;
10059
+ }
10060
+ }
10061
+
10062
+ /**
10063
+ * Toolbar button renderer for the Copy extension.
10064
+ * Renders a toolbar button that copies the currently selected editor text to the clipboard.
10065
+ */
10066
+ class RTECopyToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
10067
+ /**
10068
+ * Renders the copy toolbar button.
10069
+ *
10070
+ * @param {VegaRTECreateElementFunction} h - Create element function.
10071
+ * @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
10072
+ * @returns {VegaRTERenderResult} - The toolbar button render result.
10073
+ */
10074
+ render(h, editorContext) {
10075
+ return this.renderButton(h, editorContext, {
10076
+ icon: 'rte-copy',
10077
+ tooltip: { text: 'Copy' },
10078
+ });
10079
+ }
10080
+ /**
10081
+ * Determines if the copy button should be disabled.
10082
+ * Disabled when the editor is disabled or when no content is selected.
10083
+ *
10084
+ * @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
10085
+ * @returns {boolean} - True if the button should be disabled.
10086
+ */
10087
+ isDisabled(editorContext) {
10088
+ const context = this.getExtensionContext(editorContext.host);
10089
+ return (!context || context.host.disabled || !context.getSelection() || context.getSelection().isCollapsed);
10090
+ }
10091
+ /**
10092
+ * Handles the copy button click event.
10093
+ * Dispatches a copy action through `host.value`; the action handler extracts the current selection
10094
+ * and writes the resulting HTML and plain text content to the clipboard.
10095
+ *
10096
+ * @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
10097
+ */
10098
+ handleButtonClick(editorContext) {
10099
+ const context = this.getExtensionContext(editorContext.host);
10100
+ if (context && context.host) {
10101
+ context.host.value.apply(new CopySelectedContentAction(context.getSelection(), context.getSelectedNodes()));
10102
+ }
10103
+ }
10104
+ /*istanbul ignore next*/
10105
+ /**
10106
+ * Handles dropdown click event. Not applicable for the copy button, so it's left empty.
10107
+ */
10108
+ handleDropdownClick() {
10109
+ }
10110
+ }
10111
+ (() => {
10112
+ VegaInternalIconManager.register({ 'rte-copy': copy });
10113
+ })();
10114
+
10115
+ /**
10116
+ * Strategy that extracts the HTML and plain text content of the current selection, stores the
10117
+ * result on the {@link CopySelectedContentAction} and writes it to the clipboard.
10118
+ */
10119
+ class CopySelectedContentStrategy extends ActionHandleStrategy {
10120
+ /**
10121
+ * @inheritDoc
10122
+ */
10123
+ handleAction(action) {
10124
+ const parentBlocks = this.getParentBlocks(action.selectedNodes);
10125
+ const { html, text } = this.getSelectedContent(action.selection, parentBlocks);
10126
+ if (text || html) {
10127
+ action.copyResult = this.copyToClipboard(html, text);
10128
+ }
10129
+ }
10130
+ /**
10131
+ * Extracts the HTML and text content from the current selection.
10132
+ *
10133
+ * `Range.cloneContents()` returns only the nodes inside the selection, dropping the ancestor chain
10134
+ * between the selection's common ancestor and its block. When the selection stays inside a single
10135
+ * block, those dropped ancestors carry the styling, so the cloned fragment is re-wrapped with
10136
+ * shallow clones of every ancestor from the common ancestor up to the block, preserving arbitrary
10137
+ * inline nesting (e.g. `block > strong > em > span > text`).
10138
+ *
10139
+ * When the selection covers the whole block (its common ancestor sits above the block) or spans
10140
+ * multiple blocks, each block is already kept by `cloneContents()`, so no re-wrapping is done.
10141
+ *
10142
+ * @param {Nullable<Selection>} selection - The current selection object.
10143
+ * @param {RTEBlock[]} parentBlocks - The parent blocks of the selected nodes.
10144
+ * @returns {RTESelectedContent} - The HTML and text content of the selected content.
10145
+ */
10146
+ getSelectedContent(selection, parentBlocks) {
10147
+ const result = { html: '', text: '' };
10148
+ if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
10149
+ return result;
10150
+ }
10151
+ const range = selection.getRangeAt(0);
10152
+ const doc = tryGetDocument();
10153
+ if (!doc) {
10154
+ return result;
10155
+ }
10156
+ // `cloneContents()` returns a `DocumentFragment` of real DOM nodes (already well-formed). Its
10157
+ // `textContent` is the plain text; the fragment itself is wrapped/serialized into HTML below.
10158
+ const fragment = range.cloneContents();
10159
+ // A `DocumentFragment` has no `innerHTML`, so a temporary element is used to serialize it to HTML.
10160
+ const container = doc.createElement('div');
10161
+ const commonAncestor = range.commonAncestorContainer;
10162
+ if (parentBlocks.length === 1) {
10163
+ const block = this.getDOMByEntity(parentBlocks[0]);
10164
+ // Only re-wrap when the block is dropped from the clone, i.e. the selection stays inside the
10165
+ // block. When the whole block is selected, `commonAncestor` sits above it and the clone
10166
+ // already keeps the block, so wrapping again would nest a duplicate block.
10167
+ if (block && block.contains(commonAncestor)) {
10168
+ // Wrap the cloned fragment with the dropped ancestor chain (from `commonAncestor` up to the
10169
+ // block), preserving each element's styles, then serialize the rebuilt block to HTML.
10170
+ const cloneNode = this.wrapWithAncestorChain(fragment, commonAncestor, block);
10171
+ container.appendChild(cloneNode);
10172
+ result.html = container.innerHTML;
10173
+ result.text = container.textContent;
10174
+ return result;
10175
+ }
10176
+ }
10177
+ else if (parentBlocks.length > 1 &&
10178
+ parentBlocks.every((block) => block.type === 'list-item')) {
10179
+ const firstList = parentBlocks[0].parent;
10180
+ if (firstList && parentBlocks.every((block) => block.parent === firstList)) {
10181
+ const listElement = this.getDOMByEntity(firstList);
10182
+ if (listElement && listElement.contains(commonAncestor)) {
10183
+ const cloneListElement = listElement.cloneNode(false);
10184
+ cloneListElement.appendChild(fragment);
10185
+ container.appendChild(cloneListElement);
10186
+ result.html = container.innerHTML;
10187
+ result.text = container.textContent;
10188
+ return result;
10189
+ }
10190
+ }
10191
+ }
10192
+ // The selection covers whole/multiple blocks: the clone already keeps them, so serialize as-is.
10193
+ container.appendChild(fragment);
10194
+ result.html = container.innerHTML;
10195
+ result.text = container.textContent;
10196
+ return result;
10197
+ }
10198
+ /**
10199
+ * Wraps the cloned selection fragment with the ancestor chain that `cloneContents()` dropped,
10200
+ * rebuilding every element from the selection's common ancestor up to the block while preserving
10201
+ * each element's styles. Returns the cloned block that holds the rebuilt chain and content.
10202
+ *
10203
+ * When the common ancestor is the block itself, the fragment is appended directly under the cloned
10204
+ * block, since no inline ancestor chain was dropped.
10205
+ *
10206
+ * @param {Node} content - The cloned selection fragment to place at the innermost level.
10207
+ * @param {Node} commonAncestor - The selection's common ancestor container.
10208
+ * @param {HTMLElement} block - The block element to stop cloning at.
10209
+ * @returns {HTMLElement} - The cloned block wrapping the rebuilt ancestor chain and content.
10210
+ */
10211
+ wrapWithAncestorChain(content, commonAncestor, block) {
10212
+ const blockClone = block.cloneNode(false);
10213
+ // `cloneContents()` keeps everything inside `commonAncestor`, so the dropped chain runs from
10214
+ // `commonAncestor` (its element, when the ancestor is a text node) up to the block.
10215
+ const targetElement = commonAncestor.nodeType === Node.TEXT_NODE
10216
+ ? commonAncestor.parentElement
10217
+ : commonAncestor;
10218
+ // The target is the block itself: the content sits directly under the block, no chain to rebuild.
10219
+ if (targetElement === block) {
10220
+ blockClone.appendChild(content);
10221
+ return blockClone;
10222
+ }
10223
+ // Clone the target as the innermost container and place the content inside it.
10224
+ const innermost = targetElement.cloneNode(false);
10225
+ innermost.appendChild(content);
10226
+ // Walk up from the target to the block, cloning each ancestor and nesting the chain bottom-up.
10227
+ let shouldAppendNode = innermost;
10228
+ let current = targetElement.parentElement;
10229
+ while (current && current !== block) {
10230
+ const parentClone = current.cloneNode(false);
10231
+ parentClone.appendChild(shouldAppendNode);
10232
+ shouldAppendNode = parentClone;
10233
+ current = current.parentElement;
10234
+ }
10235
+ // Append the assembled ancestor chain to the cloned block.
10236
+ blockClone.appendChild(shouldAppendNode);
10237
+ // When the block is a list item inside an ordered list, wrap the cloned list item with a
10238
+ // shallow clone of the ordered list to preserve the numbering.
10239
+ if (blockClone.tagName === 'LI' &&
10240
+ current &&
10241
+ current.parentElement &&
10242
+ current.parentElement.tagName === 'OL') {
10243
+ const cloneList = current.parentElement.cloneNode(false);
10244
+ cloneList.appendChild(blockClone);
10245
+ return cloneList;
10246
+ }
10247
+ return blockClone;
10248
+ }
10249
+ /**
10250
+ * Retrieves the parent blocks of the given selected nodes.
10251
+ *
10252
+ * @param {RTENode[]} selectedNodes - The nodes for which to find parent blocks.
10253
+ * @returns {RTEBlock[]} An array of parent blocks.
10254
+ */
10255
+ getParentBlocks(selectedNodes) {
10256
+ const parentBlocks = [];
10257
+ for (const node of selectedNodes) {
10258
+ const block = node.parent;
10259
+ if (block && !parentBlocks.includes(block)) {
10260
+ parentBlocks.push(block);
10261
+ }
10262
+ }
10263
+ return parentBlocks;
10264
+ }
10265
+ /**
10266
+ * Copies both HTML and plain text content to the clipboard using the Clipboard API.
10267
+ *
10268
+ * Browser compatibility for `navigator.clipboard.write()` with `ClipboardItem`:
10269
+ * - Chrome 76+, Edge 79+, Safari 13.1+, Firefox 127+
10270
+ *
10271
+ * Since Firefox 86+ must be supported, fall back to `execCommand('copy')` when the
10272
+ * Clipboard API is unavailable or fails (e.g. Firefox 86-126).
10273
+ *
10274
+ * @param {string} htmlContent - The HTML content to copy.
10275
+ * @param {string} textContent - The plain text content to copy.
10276
+ * @returns {Promise<boolean>} - A promise that resolves to true if the copy operation succeeded.
10277
+ */
10278
+ async copyToClipboard(htmlContent, textContent) {
10279
+ let result = false;
10280
+ try {
10281
+ const htmlBlob = new Blob([htmlContent], { type: 'text/html' });
10282
+ const textBlob = new Blob([textContent], { type: 'text/plain' });
10283
+ const clipboardItem = new ClipboardItem({
10284
+ 'text/html': htmlBlob,
10285
+ 'text/plain': textBlob,
10286
+ });
10287
+ await navigator.clipboard.write([clipboardItem]);
10288
+ result = true;
10289
+ }
10290
+ catch (_a) {
10291
+ // Fallback for browsers without ClipboardItem support (e.g. Firefox 86-126)
10292
+ result = this.copyWithExecCommand(htmlContent, textContent);
10293
+ if (!result) {
10294
+ LogUtility.warn('Failed to copy the selected content to the clipboard. Use keyboard shortcuts instead.');
10295
+ }
10296
+ }
10297
+ return result;
10298
+ }
10299
+ /**
10300
+ * Fallback copy method using `execCommand('copy')` for browsers that don't support the
10301
+ * Clipboard API (e.g. Firefox 86-126).
10302
+ *
10303
+ * Instead of creating a temporary element and changing the selection (which would clear the
10304
+ * editor's Shadow DOM selection and steal focus), this intercepts the native `copy` event that
10305
+ * `execCommand('copy')` triggers and overrides its clipboard data. The user's original selection
10306
+ * and focus stay untouched.
10307
+ *
10308
+ * @param {string} htmlContent - The HTML content to copy.
10309
+ * @param {string} textContent - The plain text content to copy.
10310
+ * @returns {boolean} - True if the copy command succeeded.
10311
+ */
10312
+ copyWithExecCommand(htmlContent, textContent) {
10313
+ const doc = tryGetDocument();
10314
+ if (!doc) {
10315
+ return false;
10316
+ }
10317
+ /**
10318
+ * Overrides the clipboard data of the native copy event triggered by `execCommand('copy')`.
10319
+ *
10320
+ * @param {ClipboardEvent} event - The native copy event.
10321
+ */
10322
+ const onCopy = (event) => {
10323
+ if (event.clipboardData) {
10324
+ event.clipboardData.setData('text/html', htmlContent);
10325
+ event.clipboardData.setData('text/plain', textContent);
10326
+ }
10327
+ event.preventDefault();
10328
+ };
10329
+ doc.addEventListener('copy', onCopy);
10330
+ try {
10331
+ return doc.execCommand('copy');
10332
+ }
10333
+ finally {
10334
+ doc.removeEventListener('copy', onCopy);
10335
+ }
10336
+ }
10337
+ }
10338
+
10339
+ /**
10340
+ * Vega Rich Text Editor Copy Extension.
10341
+ * Adds a toolbar button that copies the currently selected editor content to the clipboard.
10342
+ */
10343
+ class VegaRTECopyExtension extends VegaRTEExtension {
10344
+ /** @inheritDoc */
10345
+ prepareBeforeLoad(host) {
10346
+ this.registerToolbarButtonRenderer(VegaRTECopyExtension.TOOLBAR_BUTTON_KEY, new RTECopyToolbarButtonRenderer(), host);
10347
+ }
10348
+ }
10349
+ (() => {
10350
+ ActionHandleStrategyRegistry.register('COPY_SELECTED_CONTENT_ACTION', VegaRTEContent.name, new CopySelectedContentStrategy());
10351
+ })();
10352
+ // The unique key for the copy toolbar button, used for registration and retrieval.
10353
+ VegaRTECopyExtension.TOOLBAR_BUTTON_KEY = 'copy';
10354
+
10355
+ const cutIcon = {
10356
+ icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><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>`,
10357
+ };
10358
+
10359
+ /**
10360
+ * Delete the currently selected content from the editor.
10361
+ *
10362
+ * @example currentVegaRTEContent.apply(new DeleteSelectedContentAction(host, mergeFlag))
10363
+ */
10364
+ class DeleteSelectedContentAction extends ModifyContentAction {
10365
+ constructor(host, mergeFlag, flushable = false) {
10366
+ super();
10367
+ this.type = ModifyContentActionType.DELETE_SELECTED_CONTENT;
10368
+ // mergeFlag indicates whether the action should merge adjacent text nodes after deletion.
10369
+ this.mergeFlag = false;
10370
+ this.host = host;
10371
+ this.mergeFlag = mergeFlag;
10372
+ this.isFlushable = flushable;
10373
+ }
10374
+ }
10375
+
10376
+ /**
10377
+ * Toolbar button renderer for the Cut extension.
10378
+ * Reuses the Copy renderer to write the selected editor content to the clipboard,
10379
+ * then removes the selected content from the editor.
10380
+ */
10381
+ class RTECutToolbarButtonRenderer extends RTECopyToolbarButtonRenderer {
10382
+ /**
10383
+ * Renders the cut toolbar button.
10384
+ *
10385
+ * @param {VegaRTECreateElementFunction} h - Create element function.
10386
+ * @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
10387
+ * @returns {VegaRTERenderResult} - The toolbar button render result.
10388
+ */
10389
+ render(h, editorContext) {
10390
+ return this.renderButton(h, editorContext, {
10391
+ icon: 'rte-cut',
10392
+ tooltip: { text: 'Cut' },
10393
+ });
10394
+ }
10395
+ /**
10396
+ * Handles the cut button click event.
10397
+ * Copies the current editor selection to the clipboard and then deletes it from the editor.
10398
+ *
10399
+ * @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
10400
+ */
10401
+ async handleButtonClick(editorContext) {
10402
+ const context = this.getExtensionContext(editorContext.host);
10403
+ if (context && context.host) {
10404
+ const { host } = context;
10405
+ const copySelectedContentAction = new CopySelectedContentAction(context.getSelection(), context.getSelectedNodes());
10406
+ host.value.apply(copySelectedContentAction);
10407
+ const isCopySuccessful = await copySelectedContentAction.copyResult;
10408
+ isCopySuccessful && host.value.apply(new DeleteSelectedContentAction(host, true, true));
10409
+ }
10410
+ }
10411
+ }
10412
+ (() => {
10413
+ VegaInternalIconManager.register({ 'rte-cut': cutIcon });
10414
+ })();
10415
+
10416
+ /**
10417
+ * Vega Rich Text Editor Cut Extension.
10418
+ * Adds a toolbar button that copies the currently selected editor content to the clipboard
10419
+ * and removes it from the editor.
10420
+ */
10421
+ class VegaRTECutExtension extends VegaRTEExtension {
10422
+ /** @inheritDoc */
10423
+ prepareBeforeLoad(host) {
10424
+ this.registerToolbarButtonRenderer(VegaRTECutExtension.TOOLBAR_BUTTON_KEY, new RTECutToolbarButtonRenderer(), host);
10425
+ }
10426
+ }
10427
+ // The unique key for the cut toolbar button, used for registration and retrieval.
10428
+ VegaRTECutExtension.TOOLBAR_BUTTON_KEY = 'cut';
8840
10429
 
8841
10430
  /**
8842
10431
  * Insert a new children to the nearest position of the parent container
@@ -8956,7 +10545,7 @@ class VegaRTETokenExtension extends VegaRTEExtension {
8956
10545
  }
8957
10546
  /** @inheritDoc */
8958
10547
  prepareBeforeLoad(host) {
8959
- this.registerToolbarButtonRenderer('token', new RTETokenToolbarButtonRenderer(this.tokenList), host);
10548
+ this.registerToolbarButtonRenderer(VegaRTETokenExtension.TOOLBAR_BUTTON_KEY, new RTETokenToolbarButtonRenderer(this.tokenList), host);
8960
10549
  }
8961
10550
  }
8962
10551
  (() => {
@@ -8964,5 +10553,6 @@ class VegaRTETokenExtension extends VegaRTEExtension {
8964
10553
  VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
8965
10554
  VegaRTEExtension.registerActionHandleStrategy(RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
8966
10555
  })();
10556
+ VegaRTETokenExtension.TOOLBAR_BUTTON_KEY = 'token';
8967
10557
 
8968
- export { ActionHandlerInterceptor as A, InsertNodeToNearestRootAction as I, RTETokenToolbarButtonRenderer as R, VegaLoader as V, VegaNotify as a, VegaEventManager$1 as b, VegaZIndexManager$1 as c, VegaSkeletonLoader as d, VegaTranslation as e, VegaRTETokenExtension as f, VegaRTELanguageExtension as g, VegaRTEDefaultLineHeightOptions as h, VegaRTEFunctionExtension as i, VegaRTETableExtension as j, VegaRTEHorizontalLineExtension as k, VegaRTESpecialCharactersExtension as l, VegaRTESpecialCharactersEssentials as m, VegaRTESpecialCharactersLatin as n, VegaRTESpecialCharactersMathematical as o, VegaRTESpecialCharactersArrows as p, VegaRTESpecialCharactersCurrency as q, VegaRTESpecialCharactersText as r, VegaRTELineHeightExtension as s, VegaCalendarPeriodFactory as t, VegaRTEToolbarButtonRenderer as u, RTETokenNode as v, waitForVega as w, RTETokenNodeRenderer as x, RTELanguageToolbarButtonRenderer as y };
10558
+ export { RTETokenNodeRenderer as A, RTELanguageToolbarButtonRenderer as B, ActionHandlerInterceptor as C, DeleteSelectedContentAction as D, InsertNodeToNearestRootAction as I, RTETokenToolbarButtonRenderer as R, VegaLoader as V, VegaNotify as a, VegaEventManager$1 as b, VegaZIndexManager$1 as c, VegaSkeletonLoader as d, VegaTranslation as e, VegaRTETokenExtension as f, VegaRTELanguageExtension as g, VegaRTEDefaultLineHeightOptions as h, VegaRTEFunctionExtension as i, VegaRTETableExtension as j, VegaRTEHorizontalLineExtension as k, VegaRTESpecialCharactersExtension as l, VegaRTEFindReplaceExtension as m, VegaRTESpecialCharactersEssentials as n, VegaRTESpecialCharactersLatin as o, VegaRTESpecialCharactersMathematical as p, VegaRTESpecialCharactersArrows as q, VegaRTESpecialCharactersCurrency as r, VegaRTESpecialCharactersText as s, VegaRTELineHeightExtension as t, VegaRTECopyExtension as u, VegaRTECutExtension as v, waitForVega as w, VegaCalendarPeriodFactory as x, VegaRTEToolbarButtonRenderer as y, RTETokenNode as z };