@globalpayments/vega 2.49.1 → 2.51.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 (599) hide show
  1. package/LICENSE +9 -17
  2. package/dist/cjs/{app-globals-65622aeb.js → app-globals-4ecf85bb.js} +11 -8
  3. package/dist/cjs/{child-nodes-event-prevent-slimmer-cc193ee1.js → child-nodes-event-prevent-slimmer-29020cc8.js} +1 -1
  4. package/dist/cjs/{child-nodes-notify-observer-slimmer-5817a53b.js → child-nodes-notify-observer-slimmer-30ba81ac.js} +1 -1
  5. package/dist/cjs/{content-state-6a48bcb5.js → code-block-2d014e17.js} +212 -975
  6. package/dist/cjs/{component-73a88c4e.js → component-1e352960.js} +1 -0
  7. package/dist/cjs/{component-global-style-slimmer-6749808c.js → component-global-style-slimmer-b0b4b997.js} +3 -0
  8. package/dist/cjs/content-state-6a5da7ec.js +1146 -0
  9. package/dist/cjs/{dark-mode-style-controller-4adb7fb2.js → dark-mode-style-controller-f9a32d68.js} +8 -0
  10. package/dist/cjs/{design-token-cba4222e.js → design-token-3f4f0bc3.js} +1 -1
  11. package/dist/cjs/{dom-node-subject-factory-d5826bff.js → dom-node-subject-factory-769dd00f.js} +1 -1
  12. package/dist/cjs/{dom-node-subject-observer-factory-a7a3b196.js → dom-node-subject-observer-factory-5aa4cc83.js} +1 -1
  13. package/dist/cjs/{effect-37695d3d.js → effect-98e88068.js} +2 -8
  14. package/dist/cjs/{element-appender-slimmer-4a26ecb2.js → element-appender-slimmer-5b1d8ffb.js} +13 -8
  15. package/dist/cjs/{event-emit-slimmer-8247249c.js → event-emit-slimmer-36036ef7.js} +15 -4
  16. package/dist/cjs/{form-field-controller-slimmer-4b0af5bc.js → form-field-controller-slimmer-01c01946.js} +9 -7
  17. package/dist/cjs/{image-annotation-action-9c2b9c8e.js → image-annotation-action-617bbb13.js} +19 -18
  18. package/dist/cjs/{index-09acd3c9.js → index-7700600c.js} +9 -0
  19. package/dist/cjs/{index-c4dec3aa.js → index-ebb1bb17.js} +3 -3
  20. package/dist/cjs/index.cjs.js +21 -20
  21. package/dist/cjs/{inject-keyboard-manager-b301e887.js → inject-keyboard-manager-dd628ccc.js} +1 -1
  22. package/dist/cjs/{internal-vega-event-manager-c9948b59.js → internal-vega-event-manager-e98944ac.js} +8 -1
  23. package/dist/cjs/{keyboard-manager-2ccf4b16.js → keyboard-manager-8c74eeb9.js} +3 -1
  24. package/dist/cjs/{keyboard-manager-slimmer-900cf2f5.js → keyboard-manager-slimmer-eb364bee.js} +1 -1
  25. package/dist/cjs/{legend-input-processor-8bcce3bf.js → legend-input-processor-b1f323fa.js} +2 -0
  26. package/dist/cjs/loader.cjs.js +15 -14
  27. package/dist/cjs/{page-resize-observer-slimmer-44e08878.js → page-resize-observer-slimmer-efa79728.js} +1 -0
  28. package/dist/cjs/{public-rules-10ec636d.js → public-rules-a3b7e267.js} +8 -7
  29. package/dist/cjs/{responsive-format-facade-263d49f6.js → responsive-format-facade-6b81192d.js} +6 -6
  30. package/dist/cjs/{rich-text-editor-required-rule-5faded94.js → rich-text-editor-required-rule-e9c7c379.js} +1 -1
  31. package/dist/cjs/selection-controller-1d7c0999.js +762 -0
  32. package/dist/cjs/{string-input-formatter-slimmer-50322824.js → string-input-formatter-slimmer-a5feb2ed.js} +3 -3
  33. package/dist/cjs/{style-formatter-ae0ef7fc.js → style-formatter-497d0fa4.js} +1 -1
  34. package/dist/cjs/{sub-state-notify-slimmer-7f437b19.js → sub-state-notify-slimmer-f68fbf29.js} +2 -2
  35. package/dist/cjs/{sub-state-observer-slimmer-e90362cd.js → sub-state-observer-slimmer-e06cdf7e.js} +3 -3
  36. package/dist/cjs/{translation-212b1875.js → translation-e5003a00.js} +5 -0
  37. package/dist/cjs/{translation-slimmer-d1512c6d.js → translation-slimmer-127a0f83.js} +1 -1
  38. package/dist/cjs/{ui-13b42af0.js → ui-6c069604.js} +2 -0
  39. package/dist/cjs/vega-accordion.cjs.entry.js +17 -16
  40. package/dist/cjs/vega-app-footer.cjs.entry.js +3 -3
  41. package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -17
  42. package/dist/cjs/vega-backdrop.cjs.entry.js +3 -3
  43. package/dist/cjs/vega-banner.cjs.entry.js +7 -7
  44. package/dist/cjs/vega-bar-chart.cjs.entry.js +3 -3
  45. package/dist/cjs/vega-box.cjs.entry.js +18 -15
  46. package/dist/cjs/vega-brand-logo.cjs.entry.js +3 -3
  47. package/dist/cjs/vega-breadcrumb.cjs.entry.js +8 -8
  48. package/dist/cjs/vega-button-circle.cjs.entry.js +18 -17
  49. package/dist/cjs/vega-button-group_2.cjs.entry.js +11 -11
  50. package/dist/cjs/vega-button-link.cjs.entry.js +8 -8
  51. package/dist/cjs/vega-button.cjs.entry.js +17 -16
  52. package/dist/cjs/vega-calendar_3.cjs.entry.js +14 -14
  53. package/dist/cjs/vega-card.cjs.entry.js +15 -14
  54. package/dist/cjs/vega-carousel.cjs.entry.js +20 -16
  55. package/dist/cjs/vega-checkbox_2.cjs.entry.js +14 -14
  56. package/dist/cjs/vega-chip.cjs.entry.js +18 -17
  57. package/dist/cjs/vega-code-block.cjs.entry.js +4160 -0
  58. package/dist/cjs/vega-color-picker.cjs.entry.js +12 -12
  59. package/dist/cjs/vega-combo-box.cjs.entry.js +15 -15
  60. package/dist/cjs/vega-counter-badge.cjs.entry.js +2 -2
  61. package/dist/cjs/vega-date-picker_2.cjs.entry.js +34 -24
  62. package/dist/cjs/vega-dialog_2.cjs.entry.js +25 -18
  63. package/dist/cjs/vega-divider.cjs.entry.js +15 -14
  64. package/dist/cjs/vega-dropdown_5.cjs.entry.js +25 -24
  65. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  66. package/dist/cjs/vega-field-error.cjs.entry.js +2 -2
  67. package/dist/cjs/vega-field-label.cjs.entry.js +7 -7
  68. package/dist/cjs/vega-file-uploader.cjs.entry.js +13 -13
  69. package/dist/cjs/vega-flag-icon.cjs.entry.js +15 -14
  70. package/dist/cjs/vega-flex.cjs.entry.js +16 -15
  71. package/dist/cjs/vega-font.cjs.entry.js +15 -14
  72. package/dist/cjs/vega-form.cjs.entry.js +15 -15
  73. package/dist/cjs/vega-grid.cjs.entry.js +15 -14
  74. package/dist/cjs/vega-hint.cjs.entry.js +2 -2
  75. package/dist/cjs/vega-icon.cjs.entry.js +19 -15
  76. package/dist/cjs/vega-image-uploader.cjs.entry.js +22 -19
  77. package/dist/cjs/vega-input-credit-card.cjs.entry.js +13 -13
  78. package/dist/cjs/vega-input-numeric.cjs.entry.js +16 -16
  79. package/dist/cjs/vega-input-phone-number.cjs.entry.js +18 -17
  80. package/dist/cjs/vega-input-range.cjs.entry.js +16 -16
  81. package/dist/cjs/vega-input-select.cjs.entry.js +25 -24
  82. package/dist/cjs/vega-input.cjs.entry.js +35 -17
  83. package/dist/cjs/{vega-internal-event-id-bfea9b93.js → vega-internal-event-id-6cdc95fe.js} +4 -0
  84. package/dist/cjs/vega-item-toggle.cjs.entry.js +7 -7
  85. package/dist/cjs/vega-left-nav_5.cjs.entry.js +26 -20
  86. package/dist/cjs/vega-line-chart.cjs.entry.js +4 -4
  87. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +15 -13
  88. package/dist/cjs/vega-page-notification_2.cjs.entry.js +5 -5
  89. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +8 -8
  90. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +8 -8
  91. package/dist/cjs/vega-pagination.cjs.entry.js +18 -17
  92. package/dist/cjs/vega-pie-chart.cjs.entry.js +3 -3
  93. package/dist/cjs/vega-popover_2.cjs.entry.js +19 -18
  94. package/dist/cjs/vega-progress-tracker.cjs.entry.js +7 -7
  95. package/dist/cjs/vega-radio_2.cjs.entry.js +16 -16
  96. package/dist/cjs/vega-rich-text-content.cjs.entry.js +189 -32
  97. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +814 -1181
  98. package/dist/cjs/vega-section-title.cjs.entry.js +2 -2
  99. package/dist/cjs/vega-segment-control.cjs.entry.js +8 -8
  100. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +20 -19
  101. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +15 -15
  102. package/dist/cjs/vega-sidenav_3.cjs.entry.js +23 -18
  103. package/dist/cjs/vega-signature-capture.cjs.entry.js +21 -19
  104. package/dist/cjs/{vega-skeleton-loader-controller-db868c98.js → vega-skeleton-loader-controller-ae2ab090.js} +15 -5
  105. package/dist/cjs/vega-skeleton.cjs.entry.js +2 -2
  106. package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
  107. package/dist/cjs/vega-stepper.cjs.entry.js +13 -13
  108. package/dist/cjs/vega-tab-group_2.cjs.entry.js +9 -9
  109. package/dist/cjs/vega-table_8.cjs.entry.js +377 -286
  110. package/dist/cjs/vega-text.cjs.entry.js +5 -3
  111. package/dist/cjs/vega-textarea.cjs.entry.js +13 -13
  112. package/dist/cjs/vega-time-picker_2.cjs.entry.js +25 -24
  113. package/dist/cjs/vega-toggle-switch.cjs.entry.js +12 -12
  114. package/dist/cjs/vega-tooltip_2.cjs.entry.js +18 -17
  115. package/dist/cjs/vega.cjs.js +15 -14
  116. package/dist/cjs/{wait-for-vega-handler-0a0738ac.js → wait-for-vega-handler-4491efc9.js} +3 -1
  117. package/dist/cjs/{y-axis-input-processor-e371c142.js → y-axis-input-processor-19a07af5.js} +1 -1
  118. package/dist/collection/collection-manifest.json +7 -1
  119. package/dist/collection/components/vega-box/slimmers/controllers/vega-box-responsive-style-controller.js +1 -0
  120. package/dist/collection/components/vega-box/slimmers/controllers/vega-box-state-styles-controller.js +1 -0
  121. package/dist/collection/components/vega-carousel/vega-carousel.js +3 -0
  122. package/dist/collection/components/vega-code-block/assets/copy.js +3 -0
  123. package/dist/collection/components/vega-code-block/slimmers/controllers/code-block-range.js +129 -0
  124. package/dist/collection/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.js +87 -0
  125. package/dist/collection/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.js +34 -0
  126. package/dist/collection/components/vega-code-block/slimmers/controllers/insert-composition-text-controller.js +100 -0
  127. package/dist/collection/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.js +86 -0
  128. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.js +50 -0
  129. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.js +57 -0
  130. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +240 -0
  131. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.js +133 -0
  132. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.js +44 -0
  133. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.js +117 -0
  134. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +67 -0
  135. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.js +122 -0
  136. package/dist/collection/components/vega-code-block/test/code-block-range.test.js +81 -0
  137. package/dist/collection/components/vega-code-block/types.js +10 -0
  138. package/dist/collection/components/vega-code-block/vega-code-block.css +160 -0
  139. package/dist/collection/components/vega-code-block/vega-code-block.js +404 -0
  140. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-month-year-dropdown-renderer.js +5 -0
  141. package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +4 -0
  142. package/dist/collection/components/vega-icon/vega-icon.js +4 -1
  143. package/dist/collection/components/vega-image-uploader/slimmers/controllers/vega-image-uploader-preview-controller.js +2 -0
  144. package/dist/collection/components/vega-input/slimmers/controllers/vega-input-compact-width-controller.js +1 -0
  145. package/dist/collection/components/vega-input/vega-input.css +12 -2
  146. package/dist/collection/components/vega-input/vega-input.js +27 -3
  147. package/dist/collection/components/vega-input-range/slimmers/renderers/vega-input-range-clear-icon-renderer.js +1 -1
  148. package/dist/collection/components/vega-input-range/vega-input-range.css +10 -0
  149. package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +5 -5
  150. package/dist/collection/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.js +1 -0
  151. package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-backdrop-controller.js +3 -0
  152. package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.js +2 -0
  153. package/dist/collection/components/vega-modal/slimmers/controllers/vega-nested-modal-controller.js +1 -0
  154. package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-backdrop-controller.js +3 -0
  155. package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.js +2 -0
  156. package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +2 -0
  157. package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +7 -0
  158. package/dist/collection/components/vega-rich-text-editor/assets/rectangle-code.js +3 -0
  159. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.js +13 -0
  160. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +3 -1
  161. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +1 -1
  162. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +48 -0
  163. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +17 -0
  164. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +77 -0
  165. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +38 -0
  166. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.js +14 -0
  167. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +4 -0
  168. package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-code-block-action.js +13 -0
  169. package/dist/collection/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.js +15 -0
  170. package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.js +13 -0
  171. package/dist/collection/components/vega-rich-text-editor/dto/actions/update-code-block-action.js +15 -0
  172. package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +98 -0
  173. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +5 -0
  174. package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +50 -0
  175. package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +1 -0
  176. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +62 -0
  177. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.js +78 -0
  178. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +19 -4
  179. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +4 -0
  180. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.js +54 -0
  181. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.js +70 -0
  182. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +7 -5
  183. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +7 -5
  184. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +24 -3
  185. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.js +64 -0
  186. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +56 -52
  187. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +21 -8
  188. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +5 -0
  189. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +3 -1
  190. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +3 -1
  191. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +3 -1
  192. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +3 -1
  193. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +3 -1
  194. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +65 -0
  195. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +3 -1
  196. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +6 -0
  197. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +3 -1
  198. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +1 -1
  199. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +1 -1
  200. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +3 -1
  201. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +3 -1
  202. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +3 -1
  203. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +3 -1
  204. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +21 -0
  205. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +2 -0
  206. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/code-block.test.js +54 -0
  207. package/dist/collection/components/vega-rich-text-editor/test/e2e-utils.js +5 -0
  208. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.js +32 -0
  209. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.js +61 -0
  210. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +10 -0
  211. package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-backdrop-controller.js +3 -0
  212. package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-open-status-controller.js +1 -0
  213. package/dist/collection/components/vega-signature-capture/slimmers/written-mode/controllers/written-mode-svg-controller.js +1 -0
  214. package/dist/collection/components/vega-table/vega-table-head-cell/slimmers/controllers/vega-table-head-cell-sort-config-controller.js +92 -0
  215. package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.js +6 -0
  216. package/dist/collection/components/vega-text/slimmers/renderers/vega-text-tooltip-renderer.js +2 -0
  217. package/dist/collection/components/vega-time-picker/slimmers/renderers/vega-time-picker-range-clear-button-renderer.js +1 -1
  218. package/dist/collection/components/vega-time-picker/vega-time-picker.css +10 -0
  219. package/dist/collection/global/scripts/before-vega-load.js +3 -0
  220. package/dist/collection/helpers/chart/graph-context-factory.js +2 -0
  221. package/dist/collection/helpers/common/wait-for-vega-handler.js +3 -1
  222. package/dist/collection/helpers/dialog/vega-dialog-controller.js +2 -0
  223. package/dist/collection/helpers/event-manager/event-delegated/vega-button-click-strategy.js +1 -0
  224. package/dist/collection/helpers/event-manager/event-delegated/vega-checkbox-change-strategy.js +1 -0
  225. package/dist/collection/helpers/event-manager/event-delegated/vega-input-select-change-strategy.js +1 -0
  226. package/dist/collection/helpers/event-manager/event-delegated/vega-input-strategy.js +1 -0
  227. package/dist/collection/helpers/event-manager/event-delegated/vega-radio-change-strategy.js +1 -0
  228. package/dist/collection/helpers/event-manager/event-delegated/vega-textarea-change-strategy.js +1 -0
  229. package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +2 -1
  230. package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +2 -0
  231. package/dist/collection/helpers/event-manager/slimmers/event-emit-slimmer.js +3 -1
  232. package/dist/collection/helpers/event-manager/test/event-emit-slimmer.test.js +11 -1
  233. package/dist/collection/helpers/keyboard/keyboard-manager.js +2 -0
  234. package/dist/collection/helpers/notify/vega-notify-controller.js +6 -1
  235. package/dist/collection/helpers/skeleton-loader/vega-skeleton-loader-controller.js +3 -0
  236. package/dist/collection/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.js +47 -0
  237. package/dist/collection/helpers/slimmers/component-global-style-slimmer.js +3 -0
  238. package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/default-wrapper.js +1 -0
  239. package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/position-relative-to-wrapper.js +2 -0
  240. package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +2 -0
  241. package/dist/collection/helpers/slimmers/field-error-ui-controller-strategies/sibling-container-error-label-container-retrieval-strategy.js +1 -0
  242. package/dist/collection/helpers/slimmers/field-error-ui-controller-strategies/sibling-container-self-retrieval-strategy.js +1 -0
  243. package/dist/collection/helpers/slimmers/page-resize-observer-slimmer.js +1 -0
  244. package/dist/collection/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.js +46 -0
  245. package/dist/collection/helpers/theme/controllers/color-schema-overriding-controller.js +2 -0
  246. package/dist/collection/helpers/theme/controllers/style-controller.abstract.js +3 -0
  247. package/dist/collection/helpers/theme/internal-theme-manager.js +3 -0
  248. package/dist/collection/helpers/translation/locales/en.js +5 -0
  249. package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +5 -0
  250. package/dist/collection/helpers/ui/element-appender.js +1 -1
  251. package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +3 -1
  252. package/dist/collection/utils/component.js +1 -0
  253. package/dist/collection/utils/e2e-utils.js +3 -0
  254. package/dist/collection/utils/effect.js +2 -0
  255. package/dist/collection/utils/safe-document.js +9 -0
  256. package/dist/collection/utils/test/safe-document.test.js +13 -0
  257. package/dist/collection/utils/test-utils.js +1 -0
  258. package/dist/collection/utils/ui.js +3 -0
  259. package/dist/esm/{app-globals-1f8c30e9.js → app-globals-d96d623d.js} +11 -8
  260. package/dist/esm/{child-nodes-event-prevent-slimmer-5d45361e.js → child-nodes-event-prevent-slimmer-2b975cbf.js} +1 -1
  261. package/dist/esm/{child-nodes-notify-observer-slimmer-ddaad39a.js → child-nodes-notify-observer-slimmer-eeed5986.js} +1 -1
  262. package/dist/esm/{content-state-dbc9f635.js → code-block-ef2f04ca.js} +195 -970
  263. package/dist/esm/{component-cae24190.js → component-7d906393.js} +1 -0
  264. package/dist/esm/{component-global-style-slimmer-000e0c11.js → component-global-style-slimmer-dad40b64.js} +3 -0
  265. package/dist/esm/content-state-69d29a07.js +1140 -0
  266. package/dist/esm/{dark-mode-style-controller-2ada8e22.js → dark-mode-style-controller-ea798fc8.js} +8 -0
  267. package/dist/esm/{design-token-0699f0ca.js → design-token-2060cd0d.js} +1 -1
  268. package/dist/esm/{dom-node-subject-factory-f77cf9cc.js → dom-node-subject-factory-6374611f.js} +2 -2
  269. package/dist/esm/{dom-node-subject-observer-factory-715dccf9.js → dom-node-subject-observer-factory-c345ca2e.js} +1 -1
  270. package/dist/esm/{effect-8efd2c3c.js → effect-f50e072d.js} +2 -8
  271. package/dist/esm/{element-appender-slimmer-96cb54e2.js → element-appender-slimmer-64a77b7f.js} +13 -8
  272. package/dist/esm/{event-emit-slimmer-b7d511f6.js → event-emit-slimmer-7428cc01.js} +15 -4
  273. package/dist/esm/{form-field-controller-slimmer-89a72ee7.js → form-field-controller-slimmer-87d80e46.js} +9 -7
  274. package/dist/esm/{image-annotation-action-1aa938ab.js → image-annotation-action-1497f70e.js} +7 -6
  275. package/dist/esm/{index-187f71d1.js → index-d0a47531.js} +9 -0
  276. package/dist/esm/{index-4aa167d6.js → index-f5d2fe61.js} +3 -3
  277. package/dist/esm/index.js +15 -14
  278. package/dist/esm/{inject-keyboard-manager-f513be4a.js → inject-keyboard-manager-e39c0fd9.js} +1 -1
  279. package/dist/esm/{internal-vega-event-manager-87dc436c.js → internal-vega-event-manager-d80c53c5.js} +8 -1
  280. package/dist/esm/{keyboard-manager-262be5ce.js → keyboard-manager-9564ad83.js} +3 -1
  281. package/dist/esm/{keyboard-manager-slimmer-42bf9773.js → keyboard-manager-slimmer-2218e6ba.js} +1 -1
  282. package/dist/esm/{legend-input-processor-8f76ce8a.js → legend-input-processor-1d266967.js} +2 -0
  283. package/dist/esm/loader.js +15 -14
  284. package/dist/esm/{page-resize-observer-slimmer-15a84d26.js → page-resize-observer-slimmer-c51f1912.js} +1 -0
  285. package/dist/esm/{public-rules-5cf6aa95.js → public-rules-3436034b.js} +8 -7
  286. package/dist/esm/{responsive-format-facade-42f3fcfa.js → responsive-format-facade-8c0ce819.js} +6 -6
  287. package/dist/esm/{rich-text-editor-required-rule-6a7cd3ee.js → rich-text-editor-required-rule-cc5b6a2d.js} +1 -1
  288. package/dist/esm/selection-controller-3d6dfc87.js +757 -0
  289. package/dist/esm/{string-input-formatter-slimmer-c61f82d6.js → string-input-formatter-slimmer-e53b6412.js} +3 -3
  290. package/dist/esm/{style-formatter-cb00c709.js → style-formatter-1eca1299.js} +1 -1
  291. package/dist/esm/{sub-state-notify-slimmer-4e3cf09d.js → sub-state-notify-slimmer-b6c8051c.js} +2 -2
  292. package/dist/esm/{sub-state-observer-slimmer-be7a6ce3.js → sub-state-observer-slimmer-93eeb87d.js} +3 -3
  293. package/dist/esm/{translation-cf7f020a.js → translation-71e0711d.js} +5 -0
  294. package/dist/esm/{translation-slimmer-88966d5c.js → translation-slimmer-e6b130bf.js} +1 -1
  295. package/dist/esm/{ui-ed1283bb.js → ui-7d177fb0.js} +2 -0
  296. package/dist/esm/vega-accordion.entry.js +17 -16
  297. package/dist/esm/vega-app-footer.entry.js +3 -3
  298. package/dist/esm/vega-app-header-button.entry.js +18 -17
  299. package/dist/esm/vega-backdrop.entry.js +3 -3
  300. package/dist/esm/vega-banner.entry.js +7 -7
  301. package/dist/esm/vega-bar-chart.entry.js +3 -3
  302. package/dist/esm/vega-box.entry.js +18 -15
  303. package/dist/esm/vega-brand-logo.entry.js +3 -3
  304. package/dist/esm/vega-breadcrumb.entry.js +8 -8
  305. package/dist/esm/vega-button-circle.entry.js +18 -17
  306. package/dist/esm/vega-button-group_2.entry.js +11 -11
  307. package/dist/esm/vega-button-link.entry.js +8 -8
  308. package/dist/esm/vega-button.entry.js +17 -16
  309. package/dist/esm/vega-calendar_3.entry.js +14 -14
  310. package/dist/esm/vega-card.entry.js +15 -14
  311. package/dist/esm/vega-carousel.entry.js +20 -16
  312. package/dist/esm/vega-checkbox_2.entry.js +14 -14
  313. package/dist/esm/vega-chip.entry.js +18 -17
  314. package/dist/esm/vega-code-block.entry.js +4156 -0
  315. package/dist/esm/vega-color-picker.entry.js +12 -12
  316. package/dist/esm/vega-combo-box.entry.js +15 -15
  317. package/dist/esm/vega-counter-badge.entry.js +2 -2
  318. package/dist/esm/vega-date-picker_2.entry.js +34 -24
  319. package/dist/esm/vega-dialog_2.entry.js +25 -18
  320. package/dist/esm/vega-divider.entry.js +15 -14
  321. package/dist/esm/vega-dropdown_5.entry.js +25 -24
  322. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  323. package/dist/esm/vega-field-error.entry.js +2 -2
  324. package/dist/esm/vega-field-label.entry.js +7 -7
  325. package/dist/esm/vega-file-uploader.entry.js +13 -13
  326. package/dist/esm/vega-flag-icon.entry.js +15 -14
  327. package/dist/esm/vega-flex.entry.js +16 -15
  328. package/dist/esm/vega-font.entry.js +15 -14
  329. package/dist/esm/vega-form.entry.js +15 -15
  330. package/dist/esm/vega-grid.entry.js +15 -14
  331. package/dist/esm/vega-hint.entry.js +2 -2
  332. package/dist/esm/vega-icon.entry.js +19 -15
  333. package/dist/esm/vega-image-uploader.entry.js +22 -19
  334. package/dist/esm/vega-input-credit-card.entry.js +13 -13
  335. package/dist/esm/vega-input-numeric.entry.js +16 -16
  336. package/dist/esm/vega-input-phone-number.entry.js +18 -17
  337. package/dist/esm/vega-input-range.entry.js +16 -16
  338. package/dist/esm/vega-input-select.entry.js +25 -24
  339. package/dist/esm/vega-input.entry.js +35 -17
  340. package/dist/esm/{vega-internal-event-id-85ad403f.js → vega-internal-event-id-178b2743.js} +3 -1
  341. package/dist/esm/vega-item-toggle.entry.js +7 -7
  342. package/dist/esm/vega-left-nav_5.entry.js +26 -20
  343. package/dist/esm/vega-line-chart.entry.js +4 -4
  344. package/dist/esm/vega-loader-wrapper_2.entry.js +15 -13
  345. package/dist/esm/vega-page-notification_2.entry.js +5 -5
  346. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +8 -8
  347. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +8 -8
  348. package/dist/esm/vega-pagination.entry.js +18 -17
  349. package/dist/esm/vega-pie-chart.entry.js +3 -3
  350. package/dist/esm/vega-popover_2.entry.js +19 -18
  351. package/dist/esm/vega-progress-tracker.entry.js +7 -7
  352. package/dist/esm/vega-radio_2.entry.js +16 -16
  353. package/dist/esm/vega-rich-text-content.entry.js +170 -13
  354. package/dist/esm/vega-rich-text-editor_4.entry.js +679 -1046
  355. package/dist/esm/vega-section-title.entry.js +2 -2
  356. package/dist/esm/vega-segment-control.entry.js +8 -8
  357. package/dist/esm/vega-selection-chip_2.entry.js +20 -19
  358. package/dist/esm/vega-selection-tile_2.entry.js +15 -15
  359. package/dist/esm/vega-sidenav_3.entry.js +23 -18
  360. package/dist/esm/vega-signature-capture.entry.js +21 -19
  361. package/dist/esm/{vega-skeleton-loader-controller-c2a8bd27.js → vega-skeleton-loader-controller-06f48dd2.js} +15 -5
  362. package/dist/esm/vega-skeleton.entry.js +2 -2
  363. package/dist/esm/vega-slot-container.entry.js +1 -1
  364. package/dist/esm/vega-stepper.entry.js +13 -13
  365. package/dist/esm/vega-tab-group_2.entry.js +9 -9
  366. package/dist/esm/vega-table_8.entry.js +377 -286
  367. package/dist/esm/vega-text.entry.js +5 -3
  368. package/dist/esm/vega-textarea.entry.js +13 -13
  369. package/dist/esm/vega-time-picker_2.entry.js +25 -24
  370. package/dist/esm/vega-toggle-switch.entry.js +12 -12
  371. package/dist/esm/vega-tooltip_2.entry.js +18 -17
  372. package/dist/esm/vega.js +15 -14
  373. package/dist/esm/{wait-for-vega-handler-b18eb955.js → wait-for-vega-handler-e0a928cd.js} +3 -1
  374. package/dist/esm/{y-axis-input-processor-e090b01c.js → y-axis-input-processor-95995d34.js} +1 -1
  375. package/dist/types/components/vega-code-block/assets/copy.d.ts +3 -0
  376. package/dist/types/components/vega-code-block/slimmers/controllers/code-block-range.d.ts +64 -0
  377. package/dist/types/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.d.ts +47 -0
  378. package/dist/types/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.d.ts +19 -0
  379. package/dist/types/components/vega-code-block/slimmers/controllers/insert-composition-text-controller.d.ts +50 -0
  380. package/dist/types/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.d.ts +43 -0
  381. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.d.ts +23 -0
  382. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.d.ts +21 -0
  383. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.d.ts +92 -0
  384. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.d.ts +63 -0
  385. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.d.ts +21 -0
  386. package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.d.ts +55 -0
  387. package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.d.ts +23 -0
  388. package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.d.ts +50 -0
  389. package/dist/types/components/vega-code-block/test/code-block-range.test.d.ts +1 -0
  390. package/dist/types/components/vega-code-block/types.d.ts +19 -0
  391. package/dist/types/components/vega-code-block/vega-code-block.d.ts +118 -0
  392. package/dist/types/components/vega-input/types.d.ts +2 -0
  393. package/dist/types/components/vega-input/vega-input.d.ts +9 -2
  394. package/dist/types/components/vega-rich-text-editor/assets/rectangle-code.d.ts +3 -0
  395. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.d.ts +12 -0
  396. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +3 -3
  397. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +4 -5
  398. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.d.ts +29 -0
  399. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.d.ts +15 -0
  400. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +28 -0
  401. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.d.ts +12 -0
  402. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.d.ts +12 -0
  403. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +5 -1
  404. package/dist/types/components/vega-rich-text-editor/dto/actions/remove-code-block-action.d.ts +10 -0
  405. package/dist/types/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.d.ts +14 -0
  406. package/dist/types/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.d.ts +14 -0
  407. package/dist/types/components/vega-rich-text-editor/dto/actions/update-code-block-action.d.ts +14 -0
  408. package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +52 -0
  409. package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +41 -0
  410. package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +2 -1
  411. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +39 -0
  412. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.d.ts +37 -0
  413. package/dist/types/components/vega-rich-text-editor/interface.d.ts +16 -4
  414. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.d.ts +31 -0
  415. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.d.ts +42 -0
  416. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +7 -0
  417. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.d.ts +45 -0
  418. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +16 -23
  419. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +6 -4
  420. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +1 -0
  421. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +22 -0
  422. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +1 -0
  423. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.d.ts +1 -0
  424. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/code-block.test.d.ts +1 -0
  425. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.d.ts +1 -0
  426. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.d.ts +1 -0
  427. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +4 -0
  428. package/dist/types/components/vega-table/interface.d.ts +3 -0
  429. package/dist/types/components/vega-table/vega-table-head-cell/slimmers/controllers/vega-table-head-cell-sort-config-controller.d.ts +42 -0
  430. package/dist/types/components/vega-table/vega-table-head-cell/vega-table-head-cell.d.ts +2 -0
  431. package/dist/types/components.d.ts +98 -3
  432. package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +2 -0
  433. package/dist/types/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.d.ts +20 -0
  434. package/dist/types/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.d.ts +1 -0
  435. package/dist/types/helpers/translation/interface.d.ts +6 -1
  436. package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +26 -0
  437. package/dist/types/types/components.type.d.ts +2 -1
  438. package/dist/types/utils/safe-document.d.ts +7 -0
  439. package/dist/types/utils/test/safe-document.test.d.ts +1 -0
  440. package/dist/vega/index.esm.js +1 -1
  441. package/dist/vega/{p-a46bc9f1.entry.js → p-06cd4a19.entry.js} +1 -1
  442. package/dist/vega/p-06fb002a.js +1 -0
  443. package/dist/vega/{p-b351ace3.entry.js → p-07cdaf74.entry.js} +1 -1
  444. package/dist/vega/{p-b847a143.entry.js → p-07e40eea.entry.js} +1 -1
  445. package/dist/vega/{p-913eb7f9.entry.js → p-0ce88865.entry.js} +1 -1
  446. package/dist/vega/{p-ec1f2d21.entry.js → p-1071f790.entry.js} +1 -1
  447. package/dist/vega/{p-45e28b9b.js → p-111d41fe.js} +1 -1
  448. package/dist/vega/p-12929d20.entry.js +1 -0
  449. package/dist/vega/{p-72ecfd40.js → p-138fcf6e.js} +1 -1
  450. package/dist/vega/{p-a01f149d.entry.js → p-151dec6a.entry.js} +1 -1
  451. package/dist/vega/{p-06adb37e.entry.js → p-1b81fc7a.entry.js} +1 -1
  452. package/dist/vega/{p-56a0b13d.js → p-1df029c2.js} +1 -1
  453. package/dist/vega/p-21d26bb4.js +2 -0
  454. package/dist/vega/p-21d4f12e.entry.js +1 -0
  455. package/dist/vega/{p-4a32a6c0.entry.js → p-21d5656d.entry.js} +1 -1
  456. package/dist/vega/{p-a7dcb2a3.js → p-21e180f2.js} +1 -1
  457. package/dist/vega/{p-0079088b.entry.js → p-2329cb73.entry.js} +1 -1
  458. package/dist/vega/{p-8c388b58.entry.js → p-29fe94b6.entry.js} +1 -1
  459. package/dist/vega/p-2f5d9aab.js +1 -0
  460. package/dist/vega/p-30c363d8.entry.js +9 -0
  461. package/dist/vega/{p-5e34ea25.entry.js → p-32a24ef1.entry.js} +1 -1
  462. package/dist/vega/p-33bd7e31.js +1 -0
  463. package/dist/vega/{p-46714da3.entry.js → p-36827489.entry.js} +1 -1
  464. package/dist/vega/{p-81fbfb6d.entry.js → p-388abe56.entry.js} +1 -1
  465. package/dist/vega/p-3b34389d.js +1 -0
  466. package/dist/vega/p-3eb2d433.js +1 -0
  467. package/dist/vega/{p-2da83c2a.js → p-3fa7d356.js} +1 -1
  468. package/dist/vega/p-425ba7d6.js +1 -0
  469. package/dist/vega/p-447a2b18.entry.js +1 -0
  470. package/dist/vega/{p-8d283666.js → p-4ab3df00.js} +1 -1
  471. package/dist/vega/{p-b649e86e.entry.js → p-4bca12ee.entry.js} +1 -1
  472. package/dist/vega/{p-b2bca332.entry.js → p-5016b57e.entry.js} +1 -1
  473. package/dist/vega/p-52905c68.entry.js +1 -0
  474. package/dist/vega/p-52bdeea0.entry.js +1 -0
  475. package/dist/vega/p-53803447.entry.js +1 -0
  476. package/dist/vega/{p-54f17c2e.entry.js → p-53815555.entry.js} +1 -1
  477. package/dist/vega/{p-d7937711.js → p-55563f5f.js} +1 -1
  478. package/dist/vega/{p-48517a5d.entry.js → p-578ac47f.entry.js} +1 -1
  479. package/dist/vega/p-586139ce.entry.js +1 -0
  480. package/dist/vega/p-597732e9.entry.js +1 -0
  481. package/dist/vega/{p-0969877b.entry.js → p-5c9efff8.entry.js} +1 -1
  482. package/dist/vega/{p-5e3a15a1.js → p-5e530257.js} +1 -1
  483. package/dist/vega/p-5f377954.js +1 -1
  484. package/dist/vega/p-60164904.entry.js +1 -0
  485. package/dist/vega/p-613ee009.js +1 -0
  486. package/dist/vega/p-61b72038.entry.js +1 -0
  487. package/dist/vega/p-642da014.entry.js +1 -0
  488. package/dist/vega/{p-9803042f.entry.js → p-647734d1.entry.js} +1 -1
  489. package/dist/vega/{p-cd205d96.js → p-65cca90f.js} +1 -1
  490. package/dist/vega/{p-6586e2a2.entry.js → p-66145767.entry.js} +1 -1
  491. package/dist/vega/p-6681efd5.js +1 -0
  492. package/dist/vega/{p-45f696b4.js → p-6b7dca3e.js} +1 -1
  493. package/dist/vega/{p-5160a6b9.entry.js → p-6ceb2d26.entry.js} +1 -1
  494. package/dist/vega/{p-6f81fe1e.js → p-6e01f0a2.js} +1 -1
  495. package/dist/vega/p-6f3dd430.entry.js +1 -0
  496. package/dist/vega/p-71d897e5.entry.js +1 -0
  497. package/dist/vega/{p-8ba43640.entry.js → p-72a4edf2.entry.js} +1 -1
  498. package/dist/vega/{p-bcb10ae3.entry.js → p-7503fe08.entry.js} +1 -1
  499. package/dist/vega/p-7add21f8.entry.js +1 -0
  500. package/dist/vega/{p-bfb344e1.entry.js → p-7df1ad72.entry.js} +1 -1
  501. package/dist/vega/{p-aea89be5.entry.js → p-7e70938a.entry.js} +1 -1
  502. package/dist/vega/{p-5064a804.js → p-864de9a1.js} +1 -1
  503. package/dist/vega/{p-10a40dfb.entry.js → p-86713a15.entry.js} +1 -1
  504. package/dist/vega/p-8a0d7805.entry.js +1 -0
  505. package/dist/vega/{p-89ab72e3.js → p-8bdc9e75.js} +1 -1
  506. package/dist/vega/{p-6cabdb36.js → p-8e31e7ea.js} +1 -1
  507. package/dist/vega/p-901b20d6.entry.js +1 -0
  508. package/dist/vega/p-90954fe4.entry.js +1 -0
  509. package/dist/vega/{p-6d7d923b.js → p-9c0cda62.js} +1 -1
  510. package/dist/vega/p-9d3292b7.entry.js +1 -0
  511. package/dist/vega/p-9eab97ee.entry.js +1 -0
  512. package/dist/vega/p-a0bd5bd7.entry.js +1 -0
  513. package/dist/vega/{p-54add0d2.js → p-a0dab2d0.js} +1 -1
  514. package/dist/vega/{p-83ef9e7d.entry.js → p-a1fbf49b.entry.js} +1 -1
  515. package/dist/vega/{p-d0007822.entry.js → p-aab6f547.entry.js} +1 -1
  516. package/dist/vega/p-b264d92e.entry.js +1 -0
  517. package/dist/vega/p-b51fa6ac.entry.js +1 -0
  518. package/dist/vega/p-b7594b78.entry.js +1 -0
  519. package/dist/vega/{p-6a830bc5.entry.js → p-c192c2d2.entry.js} +1 -1
  520. package/dist/vega/p-c4447540.entry.js +1 -0
  521. package/dist/vega/p-c8023434.entry.js +1 -0
  522. package/dist/vega/p-c91190df.entry.js +1 -0
  523. package/dist/vega/{p-647025dd.entry.js → p-cada532e.entry.js} +1 -1
  524. package/dist/vega/p-d0f0a908.entry.js +1 -0
  525. package/dist/vega/{p-02d7d948.entry.js → p-d53b262c.entry.js} +1 -1
  526. package/dist/vega/p-d64b20c2.js +1 -0
  527. package/dist/vega/{p-a5c39ba2.entry.js → p-d9cb6ec4.entry.js} +1 -1
  528. package/dist/vega/p-e16e23b7.entry.js +1 -0
  529. package/dist/vega/{p-1971d980.entry.js → p-e37ac14f.entry.js} +1 -1
  530. package/dist/vega/p-e5f1fd0b.entry.js +1 -0
  531. package/dist/vega/p-e7b00bf0.js +1 -0
  532. package/dist/vega/{p-147e3cbd.entry.js → p-e81b672b.entry.js} +1 -1
  533. package/dist/vega/{p-cfda64fd.entry.js → p-e860318d.entry.js} +1 -1
  534. package/dist/vega/p-ea723616.entry.js +1 -0
  535. package/dist/vega/{p-8ade44bf.js → p-eb832119.js} +1 -1
  536. package/dist/vega/{p-27003a81.entry.js → p-ec7d98f0.entry.js} +1 -1
  537. package/dist/vega/{p-a821bcf3.js → p-eea36d3c.js} +1 -1
  538. package/dist/vega/{p-252e42c7.entry.js → p-f0f787a2.entry.js} +1 -1
  539. package/dist/vega/p-f2f31686.entry.js +1 -0
  540. package/dist/vega/{p-27e56c67.entry.js → p-f41ae5e0.entry.js} +1 -1
  541. package/dist/vega/p-f4a13f3f.js +1 -0
  542. package/dist/vega/p-f9a9fca6.entry.js +1 -0
  543. package/dist/vega/{p-2fadef27.entry.js → p-fac5990f.entry.js} +1 -1
  544. package/dist/vega/p-fd0b2509.entry.js +1 -0
  545. package/dist/vega/p-fecb4044.js +1 -0
  546. package/dist/vega/vega.esm.js +1 -1
  547. package/package.json +3 -2
  548. package/dist/vega/p-06c5fe97.entry.js +0 -1
  549. package/dist/vega/p-0ed7a098.entry.js +0 -1
  550. package/dist/vega/p-0f6b3a89.entry.js +0 -1
  551. package/dist/vega/p-136f665b.entry.js +0 -1
  552. package/dist/vega/p-1503f791.js +0 -1
  553. package/dist/vega/p-16fd7c32.js +0 -1
  554. package/dist/vega/p-1a263af1.entry.js +0 -1
  555. package/dist/vega/p-1af4771a.entry.js +0 -1
  556. package/dist/vega/p-1c298d5a.js +0 -2
  557. package/dist/vega/p-1c63afd2.entry.js +0 -1
  558. package/dist/vega/p-1e05b7b4.entry.js +0 -1
  559. package/dist/vega/p-1ea863a6.entry.js +0 -1
  560. package/dist/vega/p-271b30b9.entry.js +0 -1
  561. package/dist/vega/p-2d1d4f33.entry.js +0 -1
  562. package/dist/vega/p-353b3ded.entry.js +0 -1
  563. package/dist/vega/p-44b0a005.js +0 -1
  564. package/dist/vega/p-47ff95ba.entry.js +0 -1
  565. package/dist/vega/p-4e76904e.entry.js +0 -1
  566. package/dist/vega/p-4ec0d36f.entry.js +0 -1
  567. package/dist/vega/p-5c954088.entry.js +0 -1
  568. package/dist/vega/p-61eb7f32.entry.js +0 -1
  569. package/dist/vega/p-646a9198.entry.js +0 -1
  570. package/dist/vega/p-6e898779.js +0 -1
  571. package/dist/vega/p-7088ead9.entry.js +0 -1
  572. package/dist/vega/p-77492977.entry.js +0 -1
  573. package/dist/vega/p-804f71b3.js +0 -1
  574. package/dist/vega/p-8789d34d.entry.js +0 -1
  575. package/dist/vega/p-8813c0ac.entry.js +0 -1
  576. package/dist/vega/p-8a85c7af.entry.js +0 -1
  577. package/dist/vega/p-98c64d77.entry.js +0 -1
  578. package/dist/vega/p-9f3539a4.entry.js +0 -1
  579. package/dist/vega/p-b42aea55.entry.js +0 -1
  580. package/dist/vega/p-b5d70ee0.entry.js +0 -1
  581. package/dist/vega/p-bc2dd43d.js +0 -1
  582. package/dist/vega/p-bf1894ec.js +0 -1
  583. package/dist/vega/p-c754b32c.js +0 -1
  584. package/dist/vega/p-c9a4e79a.entry.js +0 -1
  585. package/dist/vega/p-dbc82247.js +0 -1
  586. package/dist/vega/p-e2e36d2b.entry.js +0 -1
  587. package/dist/vega/p-ef8272b5.entry.js +0 -1
  588. package/dist/vega/p-f4c1d961.js +0 -1
  589. package/dist/vega/p-f5279deb.entry.js +0 -1
  590. package/dist/vega/p-f8033cd3.entry.js +0 -1
  591. package/dist/vega/p-fe63bd50.entry.js +0 -1
  592. /package/dist/vega/{p-eda5b7fd.js → p-05b10af4.js} +0 -0
  593. /package/dist/vega/{p-50677c8e.js → p-0c8bd757.js} +0 -0
  594. /package/dist/vega/{p-af7a3154.js → p-13effc6b.js} +0 -0
  595. /package/dist/vega/{p-ecfa7534.js → p-272440e8.js} +0 -0
  596. /package/dist/vega/{p-9b797118.js → p-519a7d55.js} +0 -0
  597. /package/dist/vega/{p-c0291e2e.js → p-834434d5.js} +0 -0
  598. /package/dist/vega/{p-bf953152.js → p-d5776087.js} +0 -0
  599. /package/dist/vega/{p-0fd6c35b.js → p-fa5eb496.js} +0 -0
@@ -0,0 +1,4160 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-7700600c.js');
6
+ const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
7
+ const componentUsageRuntimeMetrics = require('./component-usage-runtime-metrics-dcb32c24.js');
8
+ const component = require('./component-1e352960.js');
9
+ const internalIconManager = require('./internal-icon-manager-00f49470.js');
10
+ const trashCan = require('./trash-can-46a5e19a.js');
11
+ const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-5aa4cc83.js');
12
+ const domNodeSubjectFactory = require('./dom-node-subject-factory-769dd00f.js');
13
+ const ui = require('./ui-6c069604.js');
14
+ const eventEmitSlimmer = require('./event-emit-slimmer-36036ef7.js');
15
+ const object = require('./object-bbd4ed7f.js');
16
+ const translationSlimmer = require('./translation-slimmer-127a0f83.js');
17
+ const selectionController = require('./selection-controller-1d7c0999.js');
18
+ const changeManager = require('./change-manager-a297e4d2.js');
19
+ const vegaInternalEventId = require('./vega-internal-event-id-6cdc95fe.js');
20
+ const timer = require('./timer-5f33058b.js');
21
+ const childNodesEventPreventSlimmer = require('./child-nodes-event-prevent-slimmer-29020cc8.js');
22
+ const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
23
+ const componentGlobalStyleSlimmer = require('./component-global-style-slimmer-b0b4b997.js');
24
+ require('./icon-manager-9a47399c.js');
25
+ require('./create-public-api-runtime-metrics-slimmer-a3d17afb.js');
26
+ require('./dynamic-slimmer-f31fdfd7.js');
27
+ require('./observer-f49483e8.js');
28
+ require('./internal-vega-event-manager-e98944ac.js');
29
+ require('./translation-e5003a00.js');
30
+ require('./static-subject-title-7e7d791a.js');
31
+ require('./code-block-2d014e17.js');
32
+ require('./type-guard-4ba85fdc.js');
33
+ require('./breakpoints-ebde4837.js');
34
+ require('./ui-32e69595.js');
35
+ require('./regex-c1f70fd4.js');
36
+ require('./typography-4560e7f1.js');
37
+ require('./dark-mode-style-controller-f9a32d68.js');
38
+ require('./synchronize-task-queue-1ee80e94.js');
39
+ require('./vega-env-manager-23b8b23c.js');
40
+ require('./feature-flag-controller-5e58aae4.js');
41
+ require('./index-8b247c17.js');
42
+
43
+ var CodeLanguage;
44
+ (function (CodeLanguage) {
45
+ CodeLanguage["CSS"] = "css";
46
+ CodeLanguage["HTML"] = "html";
47
+ CodeLanguage["JavaScript"] = "js";
48
+ CodeLanguage["JSX"] = "jsx";
49
+ CodeLanguage["Plain Text"] = "plainText";
50
+ CodeLanguage["TypeScript"] = "ts";
51
+ CodeLanguage["TSX"] = "tsx";
52
+ })(CodeLanguage || (CodeLanguage = {}));
53
+
54
+ var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
55
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
56
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
57
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
58
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
59
+ };
60
+ /**
61
+ * The code block editor renderer class.
62
+ */
63
+ class VegaCodeBlockRenderer extends globalSlimmerRegistry.VegaSlimmer {
64
+ constructor() {
65
+ super(...arguments);
66
+ this.languageDropdownProps = {
67
+ searchable: false,
68
+ };
69
+ this.languageOptions = Object.keys(CodeLanguage).map((key) => {
70
+ return { id: CodeLanguage[key], displayName: key };
71
+ });
72
+ /**
73
+ * Handle the code language update.
74
+ *
75
+ * @param {HTMLVegaInputSelectElement} node - The language select element.
76
+ */
77
+ this.handleLanguageChange = (node) => {
78
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, domNodeSubjectFactory.VegaChange, (payload) => {
79
+ var _a;
80
+ this.valueController.updateValue((_a = this.value) === null || _a === void 0 ? void 0 : _a.code, payload.detail);
81
+ });
82
+ };
83
+ /**
84
+ * Handle the code language update.
85
+ *
86
+ * @param {HTMLVegaButtonCircleElement} node - The delete button.
87
+ */
88
+ this.handleDeleteClick = (node) => {
89
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, domNodeSubjectFactory.VegaClick, () => {
90
+ const event = this.removeEventEmitter.emit();
91
+ if (!event.defaultPrevented) {
92
+ this.host.remove();
93
+ }
94
+ });
95
+ };
96
+ }
97
+ /**
98
+ * Get the toolbar container element ref.
99
+ *
100
+ * @returns {HTMLDivElement} - The div element.
101
+ */
102
+ getToolbarContainerRef() {
103
+ return this.toolbarContainerRef;
104
+ }
105
+ /**
106
+ * Render the code block editor toolbar element or copy element.
107
+ *
108
+ * @returns {HTMLElement} - The code block operate action button.
109
+ */
110
+ render() {
111
+ return (index.h(index.Fragment, null,
112
+ index.h("div", { part: "editor-toolbar", contenteditable: false, class: {
113
+ 'editor-toolbar': !this.readOnly,
114
+ 'copy-button-container': this.showCopyButton && this.readOnly,
115
+ }, ref: (node) => (this.toolbarContainerRef = node) },
116
+ this.renderEditorToolbar(),
117
+ this.copyButtonRenderer.render()),
118
+ this.contentRenderer.render()));
119
+ }
120
+ /**
121
+ * Render a language select and delete button.
122
+ *
123
+ * @returns {Nullable<HTMLElement>} The editor toolbar container element.
124
+ */
125
+ renderEditorToolbar() {
126
+ var _a, _b;
127
+ if (!this.readOnly) {
128
+ return (index.h(index.Fragment, null,
129
+ index.h("vega-input-select", { source: this.languageOptions, value: (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : '', disabled: this.disabled, placeholder: this.translationSlimmer.t('Select Language'), size: "small", vegaDropdownProps: this.languageDropdownProps, exportparts: "select-container, selected-box, placeholder, toggle-icon-container, toggle-icon", ref: this.handleLanguageChange }),
130
+ index.h("vega-button-circle", { key: "delete-button", disabled: this.disabled, label: this.translationSlimmer.t('Delete Code'), icon: internalIconManager.VegaInternalIconManager.getIconKey('trash-can'), iconColor: "text-secondary", variant: "icon-only", size: "extra-small", ref: this.handleDeleteClick })));
131
+ }
132
+ }
133
+ }
134
+ (() => {
135
+ internalIconManager.VegaInternalIconManager.register({
136
+ 'trash-can': trashCan.trashCan,
137
+ });
138
+ })();
139
+ __decorate$a([
140
+ globalSlimmerRegistry.MapToComponentField()
141
+ ], VegaCodeBlockRenderer.prototype, "readOnly", void 0);
142
+ __decorate$a([
143
+ globalSlimmerRegistry.MapToComponentField()
144
+ ], VegaCodeBlockRenderer.prototype, "host", void 0);
145
+ __decorate$a([
146
+ globalSlimmerRegistry.MapToComponentField()
147
+ ], VegaCodeBlockRenderer.prototype, "disabled", void 0);
148
+ __decorate$a([
149
+ globalSlimmerRegistry.MapToComponentField()
150
+ ], VegaCodeBlockRenderer.prototype, "showCopyButton", void 0);
151
+ __decorate$a([
152
+ globalSlimmerRegistry.MapToComponentField()
153
+ ], VegaCodeBlockRenderer.prototype, "value", void 0);
154
+ __decorate$a([
155
+ globalSlimmerRegistry.MapToComponentField()
156
+ ], VegaCodeBlockRenderer.prototype, "contentRenderer", void 0);
157
+ __decorate$a([
158
+ globalSlimmerRegistry.MapToComponentField()
159
+ ], VegaCodeBlockRenderer.prototype, "valueController", void 0);
160
+ __decorate$a([
161
+ globalSlimmerRegistry.MapToComponentField()
162
+ ], VegaCodeBlockRenderer.prototype, "removeEventEmitter", void 0);
163
+ __decorate$a([
164
+ globalSlimmerRegistry.MapToComponentField()
165
+ ], VegaCodeBlockRenderer.prototype, "translationSlimmer", void 0);
166
+ __decorate$a([
167
+ globalSlimmerRegistry.MapToComponentField()
168
+ ], VegaCodeBlockRenderer.prototype, "copyButtonRenderer", void 0);
169
+
170
+ var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
171
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
172
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
173
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
174
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
175
+ };
176
+ /**
177
+ * The code block content renderer class.
178
+ */
179
+ class VegaCodeBlockContentRenderer extends globalSlimmerRegistry.VegaSlimmer {
180
+ constructor() {
181
+ super(...arguments);
182
+ /**
183
+ * The code input area focus.
184
+ */
185
+ this.handleFocus = () => {
186
+ if (!this.readOnly && !this.disabled) {
187
+ this.host.classList.add('focus');
188
+ }
189
+ };
190
+ /**
191
+ * The code input area blur.
192
+ */
193
+ this.handleBlur = () => {
194
+ this.host.classList.remove('focus');
195
+ };
196
+ }
197
+ /**
198
+ * Get the editable root element.
199
+ *
200
+ * @returns {HTMLElement} - The root element.
201
+ */
202
+ getCodeContentContainerRef() {
203
+ return this.codeContentContainerRef;
204
+ }
205
+ /**
206
+ * Add focus and blur event listener.
207
+ */
208
+ registerEventListener() {
209
+ if (this.codeContentContainerRef) {
210
+ this.codeContentContainerRef.addEventListener('focusin', this.handleFocus);
211
+ this.codeContentContainerRef.addEventListener('focusout', this.handleBlur);
212
+ }
213
+ }
214
+ /**
215
+ * Remove the event listener.
216
+ */
217
+ unregisterEventListener() {
218
+ if (this.codeContentContainerRef) {
219
+ this.codeContentContainerRef.removeEventListener('focusin', this.handleFocus);
220
+ this.codeContentContainerRef.removeEventListener('focusout', this.handleBlur);
221
+ }
222
+ }
223
+ /**
224
+ * Render the code content.
225
+ *
226
+ * @returns {HTMLElement} - The code element.
227
+ */
228
+ render() {
229
+ var _a;
230
+ const codeNodes = this.contentParseController.parseCode();
231
+ const language = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.language) || '';
232
+ return (index.h(index.Fragment, null,
233
+ index.h("style", null, this.getLineNumberStyleVariable(codeNodes)),
234
+ index.h("code", { role: "textbox", tabIndex: 0, spellcheck: false, ref: (node) => (this.codeContentContainerRef = node), contenteditable: this.readOnly || this.disabled ? false : true, "data-language": language, innerHTML: codeNodes
235
+ .map((codeNode) => this.renderCodeNode(codeNode))
236
+ .join('') })));
237
+ }
238
+ /**
239
+ * Render the code node the html element.
240
+ *
241
+ * @param {CodeNodeType} codeNode - The code node object.
242
+ * @returns {string} - The html element.
243
+ */
244
+ renderCodeNode(codeNode) {
245
+ const { key, className, mark, text } = codeNode;
246
+ return `<span key='${key}' class='${className}' data-mark='${mark}' data-index='${key}'>${text}</span>`;
247
+ }
248
+ /**
249
+ * Dynamic calculate line number element width and update the margin and padding variable.
250
+ *
251
+ * @param {CodeNodeType[]} codeNodes - The code node array.
252
+ * @returns {string} - The style content.
253
+ */
254
+ getLineNumberStyleVariable(codeNodes) {
255
+ const lineCountArray = codeNodes.filter((item) => {
256
+ return item.text === '\n';
257
+ });
258
+ const singleTextLength = 10;
259
+ const gap = 16;
260
+ const space = (lineCountArray.length + 1).toString().length * singleTextLength;
261
+ return `code{--v-code-line-number-width:${space}px;--v-code-line-number-ml:-${space + gap}px;--v-code-block-pl:${space + gap}px}`;
262
+ }
263
+ }
264
+ __decorate$9([
265
+ globalSlimmerRegistry.MapToComponentField()
266
+ ], VegaCodeBlockContentRenderer.prototype, "host", void 0);
267
+ __decorate$9([
268
+ globalSlimmerRegistry.MapToComponentField()
269
+ ], VegaCodeBlockContentRenderer.prototype, "readOnly", void 0);
270
+ __decorate$9([
271
+ globalSlimmerRegistry.MapToComponentField()
272
+ ], VegaCodeBlockContentRenderer.prototype, "disabled", void 0);
273
+ __decorate$9([
274
+ globalSlimmerRegistry.MapToComponentField()
275
+ ], VegaCodeBlockContentRenderer.prototype, "value", void 0);
276
+ __decorate$9([
277
+ globalSlimmerRegistry.MapToComponentField()
278
+ ], VegaCodeBlockContentRenderer.prototype, "contentParseController", void 0);
279
+ __decorate$9([
280
+ globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
281
+ ], VegaCodeBlockContentRenderer.prototype, "registerEventListener", null);
282
+ __decorate$9([
283
+ globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
284
+ ], VegaCodeBlockContentRenderer.prototype, "unregisterEventListener", null);
285
+
286
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
287
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
288
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
289
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
290
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
291
+ };
292
+ /**
293
+ * The component value controller.
294
+ */
295
+ class VegaCodeBlockValueController extends globalSlimmerRegistry.VegaSlimmer {
296
+ /**
297
+ * Update the component value if code content or code language update.
298
+ *
299
+ * @param {string} code - The new code content.
300
+ * @param {string} language - The new code language.
301
+ */
302
+ updateValue(code, language) {
303
+ if (!this.value || this.value.code !== code || this.value.language !== language) {
304
+ this.value = {
305
+ language: language,
306
+ code,
307
+ };
308
+ this.changeEventEmitter.emit(this.value);
309
+ }
310
+ }
311
+ /**
312
+ * Set a default value if the value is not defined.
313
+ */
314
+ initialValue() {
315
+ if (!this.value) {
316
+ this.value = { code: '', language: 'plainText' };
317
+ }
318
+ }
319
+ }
320
+ __decorate$8([
321
+ globalSlimmerRegistry.MapToComponentField({ writable: true })
322
+ ], VegaCodeBlockValueController.prototype, "value", void 0);
323
+ __decorate$8([
324
+ globalSlimmerRegistry.MapToComponentField()
325
+ ], VegaCodeBlockValueController.prototype, "changeEventEmitter", void 0);
326
+ __decorate$8([
327
+ globalSlimmerRegistry.MapToComponentMethod('connectedCallback')
328
+ ], VegaCodeBlockValueController.prototype, "initialValue", null);
329
+
330
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
331
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
332
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
333
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
334
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
335
+ };
336
+ /**
337
+ * Parse the code content to different tokens.
338
+ */
339
+ class CodeContentParseController extends globalSlimmerRegistry.VegaSlimmer {
340
+ constructor() {
341
+ super(...arguments);
342
+ this.codeNodes = [];
343
+ }
344
+ /**
345
+ * Get the current rendering code node array.
346
+ *
347
+ * @returns {CodeNodeType[]} - The code node array.
348
+ */
349
+ getCurrentCodeNodes() {
350
+ return this.codeNodes;
351
+ }
352
+ /**
353
+ * Split the code content to code node array. The default parse used if the language is not defined.
354
+ *
355
+ * @returns {CodeNodeType[]} - The code node array.
356
+ */
357
+ parseCode() {
358
+ const parsers = [
359
+ this.prismCodeHighlightParser,
360
+ this.defaultCodeHighlightParser,
361
+ ];
362
+ let result = [];
363
+ for (const parser of parsers) {
364
+ if (parser.canParse()) {
365
+ result = parser.parse();
366
+ break;
367
+ }
368
+ }
369
+ this.codeNodes = result;
370
+ return result;
371
+ }
372
+ }
373
+ __decorate$7([
374
+ globalSlimmerRegistry.MapToComponentField()
375
+ ], CodeContentParseController.prototype, "prismCodeHighlightParser", void 0);
376
+ __decorate$7([
377
+ globalSlimmerRegistry.MapToComponentField()
378
+ ], CodeContentParseController.prototype, "defaultCodeHighlightParser", void 0);
379
+
380
+ /**
381
+ * The code block component range class.
382
+ */
383
+ class CodeBlockRange {
384
+ /**
385
+ * Initial the code block range.
386
+ *
387
+ * @param {HTMLElement} codeContainerRef - The code content container ref.
388
+ */
389
+ constructor(codeContainerRef) {
390
+ // The cursor position.
391
+ this.contentOffset = 0;
392
+ // The range selected text, the value will be empty if the range is collapsed.
393
+ this.selectedText = '';
394
+ this.codeContainerRef = codeContainerRef;
395
+ }
396
+ /**
397
+ * Update the code block range when the focus node changed or focus node content changed.
398
+ *
399
+ * @param {Node} startContainer - The focus node instance.
400
+ * @param {number} startOffset - The focus offset.
401
+ * @param {CodeNodeType[]} currentNodes - The current code node array.
402
+ * @param {string} [selectedText] - The range selected text.
403
+ * @returns {CodeBlockRange} - The new code block range instance.
404
+ */
405
+ updateRange(startContainer, startOffset, currentNodes, selectedText = '') {
406
+ const range = new CodeBlockRange(this.codeContainerRef);
407
+ range.selectedText = selectedText;
408
+ range.contentOffset = range.getContentOffset(startContainer, startOffset, currentNodes);
409
+ return range;
410
+ }
411
+ /**
412
+ * Update the cursor position when insert text or delete text...
413
+ *
414
+ * @param {number} newContentOffset - New value for content offset.
415
+ * @returns {number} - The new content offset.
416
+ */
417
+ updateContentOffset(newContentOffset) {
418
+ this.contentOffset = Math.max(0, newContentOffset);
419
+ this.selectedText = '';
420
+ return this.contentOffset;
421
+ }
422
+ /**
423
+ * Create a native range from the current code block range.
424
+ *
425
+ * @param {CodeNodeType[]} nextCodeNodes - The code block node array.
426
+ * @returns {Nullable<Range>} - The range instance.
427
+ */
428
+ createNativeRange(nextCodeNodes) {
429
+ const { nodeIndex, offset } = this.getFocusNodeState(nextCodeNodes, this.contentOffset);
430
+ const range = new Range();
431
+ const focusNode = this.codeContainerRef.querySelector(`span[data-index="${nodeIndex}"]`);
432
+ if (focusNode) {
433
+ const startOffset = Math.min(focusNode.firstChild.textContent.length, offset);
434
+ range.setStart(focusNode.firstChild, startOffset);
435
+ range.setEnd(focusNode.firstChild, startOffset);
436
+ return range;
437
+ }
438
+ }
439
+ /**
440
+ * Calculate the cursor position.
441
+ *
442
+ * @param {Node} startContainer - The cursor node.
443
+ * @param {number} startOffset - The cursor offset.
444
+ * @param {CodeNodeType[]} currentNodes - The code block node array.
445
+ * @returns {number} - A number value.
446
+ */
447
+ getContentOffset(startContainer, startOffset, currentNodes) {
448
+ let startSpan = startContainer.nodeType === Node.TEXT_NODE
449
+ ? startContainer.parentElement
450
+ : startContainer;
451
+ if (startSpan.nodeName === 'CODE' && startSpan.childNodes && startSpan.childNodes.length) {
452
+ startSpan = startSpan.childNodes[Math.min(startOffset, startSpan.childNodes.length - 1)];
453
+ startOffset = 0;
454
+ }
455
+ if (startSpan && startSpan.hasAttribute('data-index')) {
456
+ const index = Number(startSpan.dataset.index);
457
+ let beforeText = '';
458
+ for (let i = 0; i < index; i++) {
459
+ beforeText += currentNodes[i].text;
460
+ }
461
+ return beforeText.length + startOffset;
462
+ }
463
+ return 0;
464
+ }
465
+ /**
466
+ * Get the next focus node of the code block node array.
467
+ *
468
+ * @param {CodeNodeType[]} codeNodes - The current code block array.
469
+ * @param {number} contentOffset - The cursor position.
470
+ * @returns {FocusNodeStateType} - The object contains next focus node index and offset.
471
+ */
472
+ getFocusNodeState(codeNodes, contentOffset) {
473
+ const content = this.getCodeContent(codeNodes);
474
+ const result = { nodeIndex: 0, offset: 0 };
475
+ if (!content || contentOffset >= content.length) {
476
+ result.nodeIndex = codeNodes.length - 1;
477
+ result.offset = codeNodes[result.nodeIndex].text.length;
478
+ }
479
+ else {
480
+ let text = '';
481
+ for (let i = 0; i < codeNodes.length; i++) {
482
+ text += codeNodes[i].text;
483
+ if (text.length >= contentOffset) {
484
+ result.offset = Math.max(0, codeNodes[i].text.length - (text.length - contentOffset));
485
+ result.nodeIndex = i;
486
+ break;
487
+ }
488
+ }
489
+ }
490
+ // The cursor position is incorrect in firefox when cursor node is line break node.
491
+ if (codeNodes[result.nodeIndex].text === '\n' &&
492
+ result.offset > 0 &&
493
+ codeNodes[result.nodeIndex + 1]) {
494
+ result.nodeIndex += 1;
495
+ result.offset = 0;
496
+ }
497
+ return result;
498
+ }
499
+ /**
500
+ * Get all code content from the code block node array.
501
+ *
502
+ * @param {CodeNodeType[]} codeNodes - The code block node array.
503
+ * @returns {string} - The code content.
504
+ */
505
+ getCodeContent(codeNodes) {
506
+ return codeNodes.map((codeNode) => codeNode.text).join('');
507
+ }
508
+ }
509
+
510
+ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
511
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
512
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
513
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
514
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
515
+ };
516
+ /**
517
+ * The class used to control the code block input cursor.
518
+ */
519
+ class VegaCodeBlockSelectionController extends selectionController.AutoRunWhenReRenderTaskQueueSlimmer {
520
+ constructor() {
521
+ super(1);
522
+ this.handleSelectionWithDebounce = timer.debounce(this.handleSelectionChange, VegaCodeBlockSelectionController.SELECTION_CHANGE_DEBOUNCE_TIME, this);
523
+ /**
524
+ * The method invoke after the component re-render.
525
+ */
526
+ this.doTask = async () => {
527
+ // add await Promise.resolve to put the code behind to a micro task
528
+ await Promise.resolve();
529
+ const selection = this.getSelection();
530
+ const range = this.codeBlockRange.createNativeRange(this.contentParseController.getCurrentCodeNodes());
531
+ if (selection && range) {
532
+ selection.removeAllRanges();
533
+ selection.addRange(range);
534
+ }
535
+ };
536
+ }
537
+ /**
538
+ * Get current range instance.
539
+ *
540
+ * @returns {Nullable<CodeBlockRange>} - The range instance or null.
541
+ */
542
+ getCurrentRange() {
543
+ return this.codeBlockRange;
544
+ }
545
+ /**
546
+ * Update the text content offset, push the update native range task to a queue.
547
+ *
548
+ * @param {number} contentOffset - The next content offset.
549
+ * @param {boolean} [immediatelyRun] - Run the task immediately or not.
550
+ */
551
+ setNextCodeBlockRange(contentOffset, immediatelyRun = false) {
552
+ this.codeBlockRange.updateContentOffset(contentOffset);
553
+ super.enqueueTheTaskIntoQueue(immediatelyRun);
554
+ }
555
+ /**
556
+ * Component lifecycle
557
+ */
558
+ addSelectionChangeEventListener() {
559
+ this.codeBlockRange = new CodeBlockRange(this.contentRenderer.getCodeContentContainerRef());
560
+ // eslint-disable-next-line no-restricted-globals
561
+ document.addEventListener('selectionchange', this.handleSelectionWithDebounce);
562
+ }
563
+ /**
564
+ * Component lifecycle
565
+ */
566
+ removeSelectionChangeEventListener() {
567
+ // eslint-disable-next-line no-restricted-globals
568
+ document.removeEventListener('selectionchange', this.handleSelectionWithDebounce);
569
+ }
570
+ /**
571
+ * Get the code block selected range
572
+ *
573
+ * @returns {Selection} A [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection) object
574
+ */
575
+ getSelection() {
576
+ return selectionController.ShadowSelectionPolyfill.getSelection(this.host.shadowRoot);
577
+ }
578
+ /**
579
+ * Notify the code content selection change event.
580
+ */
581
+ handleSelectionChange() {
582
+ const selection = this.getSelection();
583
+ if (selection && selection.rangeCount > 0) {
584
+ this.syncCodeRangeByNativeRange();
585
+ changeManager.ChangeManager.notify(domNodeSubjectFactory.domNodeSubjectFactory.getSubject(this.host, vegaInternalEventId.VegaInternalCodeBlockSelectionChange), { detail: true });
586
+ }
587
+ else {
588
+ changeManager.ChangeManager.notify(domNodeSubjectFactory.domNodeSubjectFactory.getSubject(this.host, vegaInternalEventId.VegaInternalCodeBlockSelectionChange), { detail: false });
589
+ }
590
+ }
591
+ /**
592
+ * Sync the code block range to make sure the code block range content offset is up to date after user click or selected text.
593
+ */
594
+ syncCodeRangeByNativeRange() {
595
+ const selection = this.getSelection();
596
+ if (this.isCodeBlockActive() &&
597
+ this.autoRunTaskQueue.queue.length === 0 &&
598
+ !this.insertCompositionTextController.isComposing()) {
599
+ const range = selection.getRangeAt(0);
600
+ const { startContainer, startOffset } = range;
601
+ this.codeBlockRange = this.codeBlockRange.updateRange(startContainer, startOffset, this.contentParseController.getCurrentCodeNodes(), range.toString());
602
+ }
603
+ }
604
+ /**
605
+ * This method is used to determine if the code block is currently focused or active.
606
+ * In firefox and safari, the selection change event will trigger when the code block is not active, because the shadow selection polyfill will always return the selection of the code block.
607
+ *
608
+ * @returns {boolean} - Returns true if the code block is active, otherwise false.
609
+ */
610
+ isCodeBlockActive() {
611
+ return this.host && this.host.classList.contains('focus');
612
+ }
613
+ }
614
+ // Must make sure the debounce time will not greater than the RTE selection range debounce time.
615
+ VegaCodeBlockSelectionController.SELECTION_CHANGE_DEBOUNCE_TIME = Math.min(selectionController.SelectionController.SELECTION_CHANGE_DEBOUNCE_TIME, 40);
616
+ __decorate$6([
617
+ globalSlimmerRegistry.MapToComponentField()
618
+ ], VegaCodeBlockSelectionController.prototype, "host", void 0);
619
+ __decorate$6([
620
+ globalSlimmerRegistry.MapToComponentField()
621
+ ], VegaCodeBlockSelectionController.prototype, "contentRenderer", void 0);
622
+ __decorate$6([
623
+ globalSlimmerRegistry.MapToComponentField()
624
+ ], VegaCodeBlockSelectionController.prototype, "contentParseController", void 0);
625
+ __decorate$6([
626
+ globalSlimmerRegistry.MapToComponentField()
627
+ ], VegaCodeBlockSelectionController.prototype, "insertCompositionTextController", void 0);
628
+ __decorate$6([
629
+ globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
630
+ ], VegaCodeBlockSelectionController.prototype, "addSelectionChangeEventListener", null);
631
+ __decorate$6([
632
+ globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
633
+ ], VegaCodeBlockSelectionController.prototype, "removeSelectionChangeEventListener", null);
634
+
635
+ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
636
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
637
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
638
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
639
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
640
+ };
641
+ /**
642
+ * The class used to control the code block modify content action.
643
+ */
644
+ class CodeBlockInputController extends globalSlimmerRegistry.VegaSlimmer {
645
+ constructor() {
646
+ super(...arguments);
647
+ /**
648
+ * Stop the input event bubbles and update the code value.
649
+ *
650
+ * @param {InputEvent} e - The input event object.
651
+ */
652
+ this.handleInputEvent = (e) => {
653
+ this.stopEventPropagation(e);
654
+ this.updateCodeContent();
655
+ };
656
+ /**
657
+ * Prevent paste the file into code block. Prevent to delete the last space.
658
+ *
659
+ * @param {InputEvent} e - The input event object.
660
+ */
661
+ this.handleBeforeInput = (e) => {
662
+ e.stopPropagation();
663
+ const inputType = e.inputType;
664
+ if (inputType === 'insertFromPaste' && e.dataTransfer) {
665
+ // Should prevent the paste action if the content is a file.
666
+ if (e.dataTransfer.files && e.dataTransfer.files.length) {
667
+ e.preventDefault();
668
+ return;
669
+ }
670
+ // Should prevent the paste action if the plain text is empty.
671
+ const htmlContent = e.dataTransfer.getData('text/html');
672
+ // eslint-disable-next-line no-restricted-globals
673
+ const tempContainer = document.createElement('div');
674
+ tempContainer.innerHTML = htmlContent;
675
+ if (htmlContent && !tempContainer.innerText) {
676
+ e.preventDefault();
677
+ return;
678
+ }
679
+ }
680
+ else if (inputType === 'deleteContentBackward') {
681
+ if (!this.value || !this.value.code || this.value.code === '') {
682
+ e.preventDefault();
683
+ }
684
+ else {
685
+ this.handleDeleteAction(e);
686
+ }
687
+ return;
688
+ }
689
+ this.updateCodeBlockRange(e);
690
+ };
691
+ }
692
+ /**
693
+ * Stop `beforeinput` and `input` event bubbles to parent element.
694
+ */
695
+ registerInputEvent() {
696
+ const codeContentContainerRef = this.contentRenderer.getCodeContentContainerRef();
697
+ if (codeContentContainerRef) {
698
+ codeContentContainerRef.addEventListener('beforeinput', this.handleBeforeInput);
699
+ codeContentContainerRef.addEventListener('input', this.handleInputEvent);
700
+ }
701
+ }
702
+ /**
703
+ * Remove the event listener.
704
+ */
705
+ unregisterEventListener() {
706
+ const codeContentContainerRef = this.contentRenderer.getCodeContentContainerRef();
707
+ if (codeContentContainerRef) {
708
+ codeContentContainerRef.removeEventListener('beforeinput', this.handleBeforeInput);
709
+ codeContentContainerRef.removeEventListener('input', this.handleInputEvent);
710
+ }
711
+ }
712
+ /**
713
+ * Stop the event bubbles.
714
+ *
715
+ * @param {Event} e - The event object.
716
+ */
717
+ stopEventPropagation(e) {
718
+ e.stopPropagation();
719
+ }
720
+ /**
721
+ * Modify the component code content when user press delete key.
722
+ *
723
+ * @param {InputEvent} e - The input event object.
724
+ */
725
+ handleDeleteAction(e) {
726
+ const range = this.selectionController.getCurrentRange();
727
+ if (range) {
728
+ e.preventDefault();
729
+ const contentStartOffset = range.contentOffset;
730
+ const currentNodes = this.contentParseController.getCurrentCodeNodes();
731
+ let content = this.getCodeNodesContent(currentNodes);
732
+ let nextOffset = contentStartOffset;
733
+ // In low version firefox, the selected text could not delete when press delete key, so we handle the action manually.
734
+ if (range.selectedText.length) {
735
+ content = this.deleteSelectedText(content, contentStartOffset, range.selectedText.length);
736
+ }
737
+ else if (contentStartOffset > 0) {
738
+ content = content.slice(0, contentStartOffset - 1) + content.slice(contentStartOffset);
739
+ nextOffset -= 1;
740
+ }
741
+ this.valueController.updateValue(content, this.value.language);
742
+ this.selectionController.setNextCodeBlockRange(nextOffset);
743
+ }
744
+ }
745
+ /**
746
+ * Delete the selected text manually.
747
+ *
748
+ * @param {string} oldValue - The old value.
749
+ * @param {number} contentStartOffset - The start index.
750
+ * @param {number} length - The selected text length.
751
+ * @returns {string} - The content after delete.
752
+ */
753
+ deleteSelectedText(oldValue, contentStartOffset, length) {
754
+ if (length >= oldValue.length) {
755
+ oldValue = '';
756
+ }
757
+ else {
758
+ oldValue = oldValue.slice(0, contentStartOffset) + oldValue.slice(contentStartOffset + length);
759
+ }
760
+ return oldValue;
761
+ }
762
+ /**
763
+ * Update the code block range base on input data.
764
+ *
765
+ * @param {InputEvent} e - The input event object.
766
+ */
767
+ updateCodeBlockRange(e) {
768
+ const range = this.selectionController.getCurrentRange();
769
+ if (!this.insertCompositionTextController.isComposing() && range) {
770
+ this.selectionController.setNextCodeBlockRange(range.contentOffset + this.getInsertDataLength(e));
771
+ }
772
+ }
773
+ /**
774
+ * Calculates the length of the inserted data based on the input event type.
775
+ *
776
+ * @param {InputEvent} e - The input event object.
777
+ * @returns {number} - The length of the inserted data.
778
+ */
779
+ getInsertDataLength(e) {
780
+ const { data, inputType } = e;
781
+ switch (inputType) {
782
+ case 'insertText':
783
+ return data.length; // For insert text, we return the length of the inserted text.
784
+ case 'insertParagraph':
785
+ case 'insertLineBreak':
786
+ return 1;
787
+ case 'insertFromPaste':
788
+ return this.getPasteContentLength(e);
789
+ default:
790
+ return 0; // For other input types, we return 0.
791
+ }
792
+ }
793
+ /**
794
+ * Get the paste content text length.
795
+ *
796
+ * @param {InputEvent} e - The input event object.
797
+ * @returns {number} - The text length.
798
+ */
799
+ getPasteContentLength(e) {
800
+ const htmlContent = e.dataTransfer.getData('text/html');
801
+ if (htmlContent) {
802
+ // eslint-disable-next-line no-restricted-globals
803
+ const tempContainer = document.createElement('div');
804
+ tempContainer.innerHTML = htmlContent;
805
+ return tempContainer.innerText.length;
806
+ }
807
+ else {
808
+ const plainText = e.dataTransfer.getData('text/plain');
809
+ return plainText.length;
810
+ }
811
+ }
812
+ /**
813
+ * Update the code content after user modify action.
814
+ */
815
+ updateCodeContent() {
816
+ var _a;
817
+ if (!this.insertCompositionTextController.isComposing()) {
818
+ const codeContentContainerRef = this.contentRenderer.getCodeContentContainerRef();
819
+ let newText = codeContentContainerRef.innerText;
820
+ if (this.isInsertLineBreakInLowVersionFirefox(newText)) {
821
+ newText = newText + '\n';
822
+ }
823
+ this.valueController.updateValue(newText, (_a = this.value) === null || _a === void 0 ? void 0 : _a.language);
824
+ }
825
+ }
826
+ /**
827
+ * Collect the code nodes content from the code nodes array.
828
+ *
829
+ * @param {CodeNodeType[]} codeNodes - The code nodes array.
830
+ * @returns {string} - The content of code nodes.
831
+ */
832
+ getCodeNodesContent(codeNodes) {
833
+ return codeNodes.map((codeNode) => codeNode.text).join('');
834
+ }
835
+ /**
836
+ * Check if the new content update by insert line break in low version Firefox.
837
+ *
838
+ * @param {string} newText - The new text content.
839
+ * @returns {boolean} - Boolean value.
840
+ */
841
+ isInsertLineBreakInLowVersionFirefox(newText) {
842
+ var _a;
843
+ const oldValue = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.code) || '';
844
+ if (!oldValue.endsWith('\n') && newText === oldValue + '\n') {
845
+ return true;
846
+ }
847
+ return false;
848
+ }
849
+ }
850
+ __decorate$5([
851
+ globalSlimmerRegistry.MapToComponentField()
852
+ ], CodeBlockInputController.prototype, "selectionController", void 0);
853
+ __decorate$5([
854
+ globalSlimmerRegistry.MapToComponentField()
855
+ ], CodeBlockInputController.prototype, "contentRenderer", void 0);
856
+ __decorate$5([
857
+ globalSlimmerRegistry.MapToComponentField()
858
+ ], CodeBlockInputController.prototype, "valueController", void 0);
859
+ __decorate$5([
860
+ globalSlimmerRegistry.MapToComponentField()
861
+ ], CodeBlockInputController.prototype, "contentParseController", void 0);
862
+ __decorate$5([
863
+ globalSlimmerRegistry.MapToComponentField()
864
+ ], CodeBlockInputController.prototype, "insertCompositionTextController", void 0);
865
+ __decorate$5([
866
+ globalSlimmerRegistry.MapToComponentField()
867
+ ], CodeBlockInputController.prototype, "value", void 0);
868
+ __decorate$5([
869
+ globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
870
+ ], CodeBlockInputController.prototype, "registerInputEvent", null);
871
+ __decorate$5([
872
+ globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
873
+ ], CodeBlockInputController.prototype, "unregisterEventListener", null);
874
+
875
+ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
876
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
877
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
878
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
879
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
880
+ };
881
+ /**
882
+ * Control the component focus state.
883
+ */
884
+ class VegaCodeBlockFocusController extends globalSlimmerRegistry.VegaSlimmer {
885
+ /**
886
+ * Focus the code block and update the selection range offset to end.
887
+ */
888
+ focusAndUpdateSelection() {
889
+ if (!this.disabled && !this.readOnly) {
890
+ const codeContentContainerRef = this.contentRenderer.getCodeContentContainerRef();
891
+ if (codeContentContainerRef) {
892
+ codeContentContainerRef.focus();
893
+ const offset = this.value && this.value.code && this.value.code !== ' ' ? this.value.code.length : 0;
894
+ this.selectionController.setNextCodeBlockRange(offset, true);
895
+ }
896
+ }
897
+ }
898
+ /**
899
+ * Remove the focus class when component disabled or readonly.
900
+ */
901
+ removeFocusAfterDisabled() {
902
+ if (this.disabled || this.readOnly) {
903
+ this.host.classList.remove('focus');
904
+ }
905
+ }
906
+ }
907
+ __decorate$4([
908
+ globalSlimmerRegistry.MapToComponentField()
909
+ ], VegaCodeBlockFocusController.prototype, "host", void 0);
910
+ __decorate$4([
911
+ globalSlimmerRegistry.MapToComponentField()
912
+ ], VegaCodeBlockFocusController.prototype, "value", void 0);
913
+ __decorate$4([
914
+ globalSlimmerRegistry.MapToComponentField()
915
+ ], VegaCodeBlockFocusController.prototype, "readOnly", void 0);
916
+ __decorate$4([
917
+ globalSlimmerRegistry.MapToComponentField()
918
+ ], VegaCodeBlockFocusController.prototype, "disabled", void 0);
919
+ __decorate$4([
920
+ globalSlimmerRegistry.MapToComponentField()
921
+ ], VegaCodeBlockFocusController.prototype, "contentRenderer", void 0);
922
+ __decorate$4([
923
+ globalSlimmerRegistry.MapToComponentField()
924
+ ], VegaCodeBlockFocusController.prototype, "selectionController", void 0);
925
+ __decorate$4([
926
+ globalSlimmerRegistry.MapToComponentMethod('doFocus')
927
+ ], VegaCodeBlockFocusController.prototype, "focusAndUpdateSelection", null);
928
+ __decorate$4([
929
+ globalSlimmerRegistry.MapToComponentMethod('watchEditableChange')
930
+ ], VegaCodeBlockFocusController.prototype, "removeFocusAfterDisabled", null);
931
+
932
+ const copy = {
933
+ icon: `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><g clip-path="url(#clip0_70002_574)"><path fill="currentColor" d="M11.7794 1.65539L10.3439 0.219844C10.2044 0.0790078 10.0122 0 9.81303 0H5.97865C5.15014 0 4.47865 0.671719 4.47865 1.5L4.47911 7.5C4.49975 8.32969 5.1724 9 5.99975 9H10.4997C11.3247 9 11.9997 8.325 11.9997 7.5V2.18555C11.9997 1.9868 11.9201 1.79602 11.7794 1.65539ZM10.8747 7.5C10.8747 7.70709 10.7068 7.875 10.4997 7.875H5.97865C5.77151 7.875 5.60365 7.70709 5.60365 7.5V1.50305C5.60365 1.29595 5.77156 1.12805 5.97865 1.12805H8.97865L8.99975 2.25C8.99975 2.66414 9.33561 3 9.74975 3H10.8537V7.5H10.8747ZM6.37475 10.5C6.37475 10.7071 6.20684 10.875 5.99975 10.875H1.47865C1.27151 10.875 1.10365 10.7071 1.10365 10.5L1.12428 4.50234C1.12428 4.29525 1.29218 4.12734 1.49928 4.12734H3.74975V3H1.49951C0.670996 3 -0.000488281 3.67148 -0.000488281 4.5L-0.000258594 10.5C-0.000207031 11.3273 0.671465 12 1.49975 12H5.99975C6.82475 12 7.49975 11.325 7.49975 10.5V9.75H6.39584L6.37475 10.5Z"/></g><defs><clipPath id="clip0_70002_574"><rect width="12" height="12" fill="currentColor"/></clipPath></defs></svg>`,
934
+ };
935
+
936
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
937
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
938
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
939
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
940
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
941
+ };
942
+ class VegaCodeBlockCopyButtonRenderer extends globalSlimmerRegistry.VegaSlimmer {
943
+ constructor() {
944
+ super(...arguments);
945
+ /**
946
+ * Copy the code.
947
+ *
948
+ * @param {HTMLVegaButtonCircleElement} node - The copy button.
949
+ */
950
+ this.handleCopyClick = (node) => {
951
+ domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(node, domNodeSubjectFactory.VegaClick, async () => {
952
+ var _a;
953
+ const content = ((_a = this.value) === null || _a === void 0 ? void 0 : _a.code) || '';
954
+ if (content && globalThis.navigator && globalThis.navigator.clipboard) {
955
+ clearTimeout(this.updateLabelTimer);
956
+ await globalThis.navigator.clipboard.writeText(content);
957
+ const oldTooltip = node.label;
958
+ node.label = this.translationSlimmer.t('Copied');
959
+ this.updateLabelTimer = setTimeout(() => {
960
+ if (node) {
961
+ node.label = oldTooltip;
962
+ }
963
+ }, VegaCodeBlockCopyButtonRenderer.RESET_TOOLTIP_TIME);
964
+ }
965
+ });
966
+ };
967
+ }
968
+ /**
969
+ * Render a copy button.
970
+ *
971
+ * @returns {Nullable<HTMLElement>} The button element.
972
+ */
973
+ render() {
974
+ if (this.showCopyButton && this.readOnly) {
975
+ return (index.h("vega-button-circle", { key: "copy-button", label: this.translationSlimmer.t('Copy Code'), class: "copy-code-button", icon: internalIconManager.VegaInternalIconManager.getIconKey('copy'), iconColor: "text-secondary", variant: "icon-only", size: "extra-small", ref: this.handleCopyClick }));
976
+ }
977
+ }
978
+ }
979
+ (() => {
980
+ internalIconManager.VegaInternalIconManager.register({
981
+ copy: copy,
982
+ });
983
+ })();
984
+ VegaCodeBlockCopyButtonRenderer.RESET_TOOLTIP_TIME = 1000;
985
+ __decorate$3([
986
+ globalSlimmerRegistry.MapToComponentField()
987
+ ], VegaCodeBlockCopyButtonRenderer.prototype, "value", void 0);
988
+ __decorate$3([
989
+ globalSlimmerRegistry.MapToComponentField()
990
+ ], VegaCodeBlockCopyButtonRenderer.prototype, "readOnly", void 0);
991
+ __decorate$3([
992
+ globalSlimmerRegistry.MapToComponentField()
993
+ ], VegaCodeBlockCopyButtonRenderer.prototype, "showCopyButton", void 0);
994
+ __decorate$3([
995
+ globalSlimmerRegistry.MapToComponentField()
996
+ ], VegaCodeBlockCopyButtonRenderer.prototype, "translationSlimmer", void 0);
997
+
998
+ var prism = _commonjsHelpers.createCommonjsModule(function (module) {
999
+ /* **********************************************
1000
+ Begin prism-core.js
1001
+ ********************************************** */
1002
+
1003
+ /// <reference lib="WebWorker"/>
1004
+
1005
+ var _self = (typeof window !== 'undefined')
1006
+ ? window // if in browser
1007
+ : (
1008
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
1009
+ ? self // if in worker
1010
+ : {} // if in node js
1011
+ );
1012
+
1013
+ /**
1014
+ * Prism: Lightweight, robust, elegant syntax highlighting
1015
+ *
1016
+ * @license MIT <https://opensource.org/licenses/MIT>
1017
+ * @author Lea Verou <https://lea.verou.me>
1018
+ * @namespace
1019
+ * @public
1020
+ */
1021
+ var Prism = (function (_self) {
1022
+
1023
+ // Private helper vars
1024
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
1025
+ var uniqueId = 0;
1026
+
1027
+ // The grammar object for plaintext
1028
+ var plainTextGrammar = {};
1029
+
1030
+
1031
+ var _ = {
1032
+ /**
1033
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
1034
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
1035
+ * additional languages or plugins yourself.
1036
+ *
1037
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
1038
+ *
1039
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
1040
+ * empty Prism object into the global scope before loading the Prism script like this:
1041
+ *
1042
+ * ```js
1043
+ * window.Prism = window.Prism || {};
1044
+ * Prism.manual = true;
1045
+ * // add a new <script> to load Prism's script
1046
+ * ```
1047
+ *
1048
+ * @default false
1049
+ * @type {boolean}
1050
+ * @memberof Prism
1051
+ * @public
1052
+ */
1053
+ manual: _self.Prism && _self.Prism.manual,
1054
+ /**
1055
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
1056
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
1057
+ * own worker, you don't want it to do this.
1058
+ *
1059
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
1060
+ *
1061
+ * You obviously have to change this value before Prism executes. To do this, you can add an
1062
+ * empty Prism object into the global scope before loading the Prism script like this:
1063
+ *
1064
+ * ```js
1065
+ * window.Prism = window.Prism || {};
1066
+ * Prism.disableWorkerMessageHandler = true;
1067
+ * // Load Prism's script
1068
+ * ```
1069
+ *
1070
+ * @default false
1071
+ * @type {boolean}
1072
+ * @memberof Prism
1073
+ * @public
1074
+ */
1075
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
1076
+
1077
+ /**
1078
+ * A namespace for utility methods.
1079
+ *
1080
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
1081
+ * change or disappear at any time.
1082
+ *
1083
+ * @namespace
1084
+ * @memberof Prism
1085
+ */
1086
+ util: {
1087
+ encode: function encode(tokens) {
1088
+ if (tokens instanceof Token) {
1089
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
1090
+ } else if (Array.isArray(tokens)) {
1091
+ return tokens.map(encode);
1092
+ } else {
1093
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
1094
+ }
1095
+ },
1096
+
1097
+ /**
1098
+ * Returns the name of the type of the given value.
1099
+ *
1100
+ * @param {any} o
1101
+ * @returns {string}
1102
+ * @example
1103
+ * type(null) === 'Null'
1104
+ * type(undefined) === 'Undefined'
1105
+ * type(123) === 'Number'
1106
+ * type('foo') === 'String'
1107
+ * type(true) === 'Boolean'
1108
+ * type([1, 2]) === 'Array'
1109
+ * type({}) === 'Object'
1110
+ * type(String) === 'Function'
1111
+ * type(/abc+/) === 'RegExp'
1112
+ */
1113
+ type: function (o) {
1114
+ return Object.prototype.toString.call(o).slice(8, -1);
1115
+ },
1116
+
1117
+ /**
1118
+ * Returns a unique number for the given object. Later calls will still return the same number.
1119
+ *
1120
+ * @param {Object} obj
1121
+ * @returns {number}
1122
+ */
1123
+ objId: function (obj) {
1124
+ if (!obj['__id']) {
1125
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
1126
+ }
1127
+ return obj['__id'];
1128
+ },
1129
+
1130
+ /**
1131
+ * Creates a deep clone of the given object.
1132
+ *
1133
+ * The main intended use of this function is to clone language definitions.
1134
+ *
1135
+ * @param {T} o
1136
+ * @param {Record<number, any>} [visited]
1137
+ * @returns {T}
1138
+ * @template T
1139
+ */
1140
+ clone: function deepClone(o, visited) {
1141
+ visited = visited || {};
1142
+
1143
+ var clone; var id;
1144
+ switch (_.util.type(o)) {
1145
+ case 'Object':
1146
+ id = _.util.objId(o);
1147
+ if (visited[id]) {
1148
+ return visited[id];
1149
+ }
1150
+ clone = /** @type {Record<string, any>} */ ({});
1151
+ visited[id] = clone;
1152
+
1153
+ for (var key in o) {
1154
+ if (o.hasOwnProperty(key)) {
1155
+ clone[key] = deepClone(o[key], visited);
1156
+ }
1157
+ }
1158
+
1159
+ return /** @type {any} */ (clone);
1160
+
1161
+ case 'Array':
1162
+ id = _.util.objId(o);
1163
+ if (visited[id]) {
1164
+ return visited[id];
1165
+ }
1166
+ clone = [];
1167
+ visited[id] = clone;
1168
+
1169
+ (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
1170
+ clone[i] = deepClone(v, visited);
1171
+ });
1172
+
1173
+ return /** @type {any} */ (clone);
1174
+
1175
+ default:
1176
+ return o;
1177
+ }
1178
+ },
1179
+
1180
+ /**
1181
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
1182
+ *
1183
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
1184
+ *
1185
+ * @param {Element} element
1186
+ * @returns {string}
1187
+ */
1188
+ getLanguage: function (element) {
1189
+ while (element) {
1190
+ var m = lang.exec(element.className);
1191
+ if (m) {
1192
+ return m[1].toLowerCase();
1193
+ }
1194
+ element = element.parentElement;
1195
+ }
1196
+ return 'none';
1197
+ },
1198
+
1199
+ /**
1200
+ * Sets the Prism `language-xxxx` class of the given element.
1201
+ *
1202
+ * @param {Element} element
1203
+ * @param {string} language
1204
+ * @returns {void}
1205
+ */
1206
+ setLanguage: function (element, language) {
1207
+ // remove all `language-xxxx` classes
1208
+ // (this might leave behind a leading space)
1209
+ element.className = element.className.replace(RegExp(lang, 'gi'), '');
1210
+
1211
+ // add the new `language-xxxx` class
1212
+ // (using `classList` will automatically clean up spaces for us)
1213
+ element.classList.add('language-' + language);
1214
+ },
1215
+
1216
+ /**
1217
+ * Returns the script element that is currently executing.
1218
+ *
1219
+ * This does __not__ work for line script element.
1220
+ *
1221
+ * @returns {HTMLScriptElement | null}
1222
+ */
1223
+ currentScript: function () {
1224
+ if (typeof document === 'undefined') {
1225
+ return null;
1226
+ }
1227
+ if (document.currentScript && document.currentScript.tagName === 'SCRIPT' && 1 < 2 /* hack to trip TS' flow analysis */) {
1228
+ return /** @type {any} */ (document.currentScript);
1229
+ }
1230
+
1231
+ // IE11 workaround
1232
+ // we'll get the src of the current script by parsing IE11's error stack trace
1233
+ // this will not work for inline scripts
1234
+
1235
+ try {
1236
+ throw new Error();
1237
+ } catch (err) {
1238
+ // Get file src url from stack. Specifically works with the format of stack traces in IE.
1239
+ // A stack will look like this:
1240
+ //
1241
+ // Error
1242
+ // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
1243
+ // at Global code (http://localhost/components/prism-core.js:606:1)
1244
+
1245
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
1246
+ if (src) {
1247
+ var scripts = document.getElementsByTagName('script');
1248
+ for (var i in scripts) {
1249
+ if (scripts[i].src == src) {
1250
+ return scripts[i];
1251
+ }
1252
+ }
1253
+ }
1254
+ return null;
1255
+ }
1256
+ },
1257
+
1258
+ /**
1259
+ * Returns whether a given class is active for `element`.
1260
+ *
1261
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
1262
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
1263
+ * given class is just the given class with a `no-` prefix.
1264
+ *
1265
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
1266
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
1267
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
1268
+ *
1269
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
1270
+ * version of it, the class is considered active.
1271
+ *
1272
+ * @param {Element} element
1273
+ * @param {string} className
1274
+ * @param {boolean} [defaultActivation=false]
1275
+ * @returns {boolean}
1276
+ */
1277
+ isActive: function (element, className, defaultActivation) {
1278
+ var no = 'no-' + className;
1279
+
1280
+ while (element) {
1281
+ var classList = element.classList;
1282
+ if (classList.contains(className)) {
1283
+ return true;
1284
+ }
1285
+ if (classList.contains(no)) {
1286
+ return false;
1287
+ }
1288
+ element = element.parentElement;
1289
+ }
1290
+ return !!defaultActivation;
1291
+ }
1292
+ },
1293
+
1294
+ /**
1295
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
1296
+ *
1297
+ * @namespace
1298
+ * @memberof Prism
1299
+ * @public
1300
+ */
1301
+ languages: {
1302
+ /**
1303
+ * The grammar for plain, unformatted text.
1304
+ */
1305
+ plain: plainTextGrammar,
1306
+ plaintext: plainTextGrammar,
1307
+ text: plainTextGrammar,
1308
+ txt: plainTextGrammar,
1309
+
1310
+ /**
1311
+ * Creates a deep copy of the language with the given id and appends the given tokens.
1312
+ *
1313
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
1314
+ * will be overwritten at its original position.
1315
+ *
1316
+ * ## Best practices
1317
+ *
1318
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
1319
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
1320
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
1321
+ *
1322
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
1323
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
1324
+ *
1325
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
1326
+ * @param {Grammar} redef The new tokens to append.
1327
+ * @returns {Grammar} The new language created.
1328
+ * @public
1329
+ * @example
1330
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
1331
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
1332
+ * // at its original position
1333
+ * 'comment': { ... },
1334
+ * // CSS doesn't have a 'color' token, so this token will be appended
1335
+ * 'color': /\b(?:red|green|blue)\b/
1336
+ * });
1337
+ */
1338
+ extend: function (id, redef) {
1339
+ var lang = _.util.clone(_.languages[id]);
1340
+
1341
+ for (var key in redef) {
1342
+ lang[key] = redef[key];
1343
+ }
1344
+
1345
+ return lang;
1346
+ },
1347
+
1348
+ /**
1349
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
1350
+ *
1351
+ * ## Usage
1352
+ *
1353
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
1354
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
1355
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
1356
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
1357
+ * this:
1358
+ *
1359
+ * ```js
1360
+ * Prism.languages.markup.style = {
1361
+ * // token
1362
+ * };
1363
+ * ```
1364
+ *
1365
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
1366
+ * before existing tokens. For the CSS example above, you would use it like this:
1367
+ *
1368
+ * ```js
1369
+ * Prism.languages.insertBefore('markup', 'cdata', {
1370
+ * 'style': {
1371
+ * // token
1372
+ * }
1373
+ * });
1374
+ * ```
1375
+ *
1376
+ * ## Special cases
1377
+ *
1378
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
1379
+ * will be ignored.
1380
+ *
1381
+ * This behavior can be used to insert tokens after `before`:
1382
+ *
1383
+ * ```js
1384
+ * Prism.languages.insertBefore('markup', 'comment', {
1385
+ * 'comment': Prism.languages.markup.comment,
1386
+ * // tokens after 'comment'
1387
+ * });
1388
+ * ```
1389
+ *
1390
+ * ## Limitations
1391
+ *
1392
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
1393
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
1394
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
1395
+ * deleting properties which is necessary to insert at arbitrary positions.
1396
+ *
1397
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
1398
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
1399
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
1400
+ *
1401
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
1402
+ * you hold the target object in a variable, then the value of the variable will not change.
1403
+ *
1404
+ * ```js
1405
+ * var oldMarkup = Prism.languages.markup;
1406
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
1407
+ *
1408
+ * assert(oldMarkup !== Prism.languages.markup);
1409
+ * assert(newMarkup === Prism.languages.markup);
1410
+ * ```
1411
+ *
1412
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
1413
+ * object to be modified.
1414
+ * @param {string} before The key to insert before.
1415
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
1416
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
1417
+ * object to be modified.
1418
+ *
1419
+ * Defaults to `Prism.languages`.
1420
+ * @returns {Grammar} The new grammar object.
1421
+ * @public
1422
+ */
1423
+ insertBefore: function (inside, before, insert, root) {
1424
+ root = root || /** @type {any} */ (_.languages);
1425
+ var grammar = root[inside];
1426
+ /** @type {Grammar} */
1427
+ var ret = {};
1428
+
1429
+ for (var token in grammar) {
1430
+ if (grammar.hasOwnProperty(token)) {
1431
+
1432
+ if (token == before) {
1433
+ for (var newToken in insert) {
1434
+ if (insert.hasOwnProperty(newToken)) {
1435
+ ret[newToken] = insert[newToken];
1436
+ }
1437
+ }
1438
+ }
1439
+
1440
+ // Do not insert token which also occur in insert. See #1525
1441
+ if (!insert.hasOwnProperty(token)) {
1442
+ ret[token] = grammar[token];
1443
+ }
1444
+ }
1445
+ }
1446
+
1447
+ var old = root[inside];
1448
+ root[inside] = ret;
1449
+
1450
+ // Update references in other language definitions
1451
+ _.languages.DFS(_.languages, function (key, value) {
1452
+ if (value === old && key != inside) {
1453
+ this[key] = ret;
1454
+ }
1455
+ });
1456
+
1457
+ return ret;
1458
+ },
1459
+
1460
+ // Traverse a language definition with Depth First Search
1461
+ DFS: function DFS(o, callback, type, visited) {
1462
+ visited = visited || {};
1463
+
1464
+ var objId = _.util.objId;
1465
+
1466
+ for (var i in o) {
1467
+ if (o.hasOwnProperty(i)) {
1468
+ callback.call(o, i, o[i], type || i);
1469
+
1470
+ var property = o[i];
1471
+ var propertyType = _.util.type(property);
1472
+
1473
+ if (propertyType === 'Object' && !visited[objId(property)]) {
1474
+ visited[objId(property)] = true;
1475
+ DFS(property, callback, null, visited);
1476
+ } else if (propertyType === 'Array' && !visited[objId(property)]) {
1477
+ visited[objId(property)] = true;
1478
+ DFS(property, callback, i, visited);
1479
+ }
1480
+ }
1481
+ }
1482
+ }
1483
+ },
1484
+
1485
+ plugins: {},
1486
+
1487
+ /**
1488
+ * This is the most high-level function in Prism’s API.
1489
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
1490
+ * each one of them.
1491
+ *
1492
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
1493
+ *
1494
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
1495
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
1496
+ * @memberof Prism
1497
+ * @public
1498
+ */
1499
+ highlightAll: function (async, callback) {
1500
+ _.highlightAllUnder(document, async, callback);
1501
+ },
1502
+
1503
+ /**
1504
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
1505
+ * {@link Prism.highlightElement} on each one of them.
1506
+ *
1507
+ * The following hooks will be run:
1508
+ * 1. `before-highlightall`
1509
+ * 2. `before-all-elements-highlight`
1510
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
1511
+ *
1512
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
1513
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
1514
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
1515
+ * @memberof Prism
1516
+ * @public
1517
+ */
1518
+ highlightAllUnder: function (container, async, callback) {
1519
+ var env = {
1520
+ callback: callback,
1521
+ container: container,
1522
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
1523
+ };
1524
+
1525
+ _.hooks.run('before-highlightall', env);
1526
+
1527
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
1528
+
1529
+ _.hooks.run('before-all-elements-highlight', env);
1530
+
1531
+ for (var i = 0, element; (element = env.elements[i++]);) {
1532
+ _.highlightElement(element, async === true, env.callback);
1533
+ }
1534
+ },
1535
+
1536
+ /**
1537
+ * Highlights the code inside a single element.
1538
+ *
1539
+ * The following hooks will be run:
1540
+ * 1. `before-sanity-check`
1541
+ * 2. `before-highlight`
1542
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
1543
+ * 4. `before-insert`
1544
+ * 5. `after-highlight`
1545
+ * 6. `complete`
1546
+ *
1547
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
1548
+ * the element's language.
1549
+ *
1550
+ * @param {Element} element The element containing the code.
1551
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
1552
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
1553
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
1554
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
1555
+ *
1556
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
1557
+ * asynchronous highlighting to work. You can build your own bundle on the
1558
+ * [Download page](https://prismjs.com/download.html).
1559
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
1560
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
1561
+ * @memberof Prism
1562
+ * @public
1563
+ */
1564
+ highlightElement: function (element, async, callback) {
1565
+ // Find language
1566
+ var language = _.util.getLanguage(element);
1567
+ var grammar = _.languages[language];
1568
+
1569
+ // Set language on the element, if not present
1570
+ _.util.setLanguage(element, language);
1571
+
1572
+ // Set language on the parent, for styling
1573
+ var parent = element.parentElement;
1574
+ if (parent && parent.nodeName.toLowerCase() === 'pre') {
1575
+ _.util.setLanguage(parent, language);
1576
+ }
1577
+
1578
+ var code = element.textContent;
1579
+
1580
+ var env = {
1581
+ element: element,
1582
+ language: language,
1583
+ grammar: grammar,
1584
+ code: code
1585
+ };
1586
+
1587
+ function insertHighlightedCode(highlightedCode) {
1588
+ env.highlightedCode = highlightedCode;
1589
+
1590
+ _.hooks.run('before-insert', env);
1591
+
1592
+ env.element.innerHTML = env.highlightedCode;
1593
+
1594
+ _.hooks.run('after-highlight', env);
1595
+ _.hooks.run('complete', env);
1596
+ callback && callback.call(env.element);
1597
+ }
1598
+
1599
+ _.hooks.run('before-sanity-check', env);
1600
+
1601
+ // plugins may change/add the parent/element
1602
+ parent = env.element.parentElement;
1603
+ if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
1604
+ parent.setAttribute('tabindex', '0');
1605
+ }
1606
+
1607
+ if (!env.code) {
1608
+ _.hooks.run('complete', env);
1609
+ callback && callback.call(env.element);
1610
+ return;
1611
+ }
1612
+
1613
+ _.hooks.run('before-highlight', env);
1614
+
1615
+ if (!env.grammar) {
1616
+ insertHighlightedCode(_.util.encode(env.code));
1617
+ return;
1618
+ }
1619
+
1620
+ if (async && _self.Worker) {
1621
+ var worker = new Worker(_.filename);
1622
+
1623
+ worker.onmessage = function (evt) {
1624
+ insertHighlightedCode(evt.data);
1625
+ };
1626
+
1627
+ worker.postMessage(JSON.stringify({
1628
+ language: env.language,
1629
+ code: env.code,
1630
+ immediateClose: true
1631
+ }));
1632
+ } else {
1633
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
1634
+ }
1635
+ },
1636
+
1637
+ /**
1638
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
1639
+ * and the language definitions to use, and returns a string with the HTML produced.
1640
+ *
1641
+ * The following hooks will be run:
1642
+ * 1. `before-tokenize`
1643
+ * 2. `after-tokenize`
1644
+ * 3. `wrap`: On each {@link Token}.
1645
+ *
1646
+ * @param {string} text A string with the code to be highlighted.
1647
+ * @param {Grammar} grammar An object containing the tokens to use.
1648
+ *
1649
+ * Usually a language definition like `Prism.languages.markup`.
1650
+ * @param {string} language The name of the language definition passed to `grammar`.
1651
+ * @returns {string} The highlighted HTML.
1652
+ * @memberof Prism
1653
+ * @public
1654
+ * @example
1655
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
1656
+ */
1657
+ highlight: function (text, grammar, language) {
1658
+ var env = {
1659
+ code: text,
1660
+ grammar: grammar,
1661
+ language: language
1662
+ };
1663
+ _.hooks.run('before-tokenize', env);
1664
+ if (!env.grammar) {
1665
+ throw new Error('The language "' + env.language + '" has no grammar.');
1666
+ }
1667
+ env.tokens = _.tokenize(env.code, env.grammar);
1668
+ _.hooks.run('after-tokenize', env);
1669
+ return Token.stringify(_.util.encode(env.tokens), env.language);
1670
+ },
1671
+
1672
+ /**
1673
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
1674
+ * and the language definitions to use, and returns an array with the tokenized code.
1675
+ *
1676
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
1677
+ *
1678
+ * This method could be useful in other contexts as well, as a very crude parser.
1679
+ *
1680
+ * @param {string} text A string with the code to be highlighted.
1681
+ * @param {Grammar} grammar An object containing the tokens to use.
1682
+ *
1683
+ * Usually a language definition like `Prism.languages.markup`.
1684
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
1685
+ * @memberof Prism
1686
+ * @public
1687
+ * @example
1688
+ * let code = `var foo = 0;`;
1689
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
1690
+ * tokens.forEach(token => {
1691
+ * if (token instanceof Prism.Token && token.type === 'number') {
1692
+ * console.log(`Found numeric literal: ${token.content}`);
1693
+ * }
1694
+ * });
1695
+ */
1696
+ tokenize: function (text, grammar) {
1697
+ var rest = grammar.rest;
1698
+ if (rest) {
1699
+ for (var token in rest) {
1700
+ grammar[token] = rest[token];
1701
+ }
1702
+
1703
+ delete grammar.rest;
1704
+ }
1705
+
1706
+ var tokenList = new LinkedList();
1707
+ addAfter(tokenList, tokenList.head, text);
1708
+
1709
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
1710
+
1711
+ return toArray(tokenList);
1712
+ },
1713
+
1714
+ /**
1715
+ * @namespace
1716
+ * @memberof Prism
1717
+ * @public
1718
+ */
1719
+ hooks: {
1720
+ all: {},
1721
+
1722
+ /**
1723
+ * Adds the given callback to the list of callbacks for the given hook.
1724
+ *
1725
+ * The callback will be invoked when the hook it is registered for is run.
1726
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
1727
+ *
1728
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
1729
+ *
1730
+ * @param {string} name The name of the hook.
1731
+ * @param {HookCallback} callback The callback function which is given environment variables.
1732
+ * @public
1733
+ */
1734
+ add: function (name, callback) {
1735
+ var hooks = _.hooks.all;
1736
+
1737
+ hooks[name] = hooks[name] || [];
1738
+
1739
+ hooks[name].push(callback);
1740
+ },
1741
+
1742
+ /**
1743
+ * Runs a hook invoking all registered callbacks with the given environment variables.
1744
+ *
1745
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
1746
+ *
1747
+ * @param {string} name The name of the hook.
1748
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
1749
+ * @public
1750
+ */
1751
+ run: function (name, env) {
1752
+ var callbacks = _.hooks.all[name];
1753
+
1754
+ if (!callbacks || !callbacks.length) {
1755
+ return;
1756
+ }
1757
+
1758
+ for (var i = 0, callback; (callback = callbacks[i++]);) {
1759
+ callback(env);
1760
+ }
1761
+ }
1762
+ },
1763
+
1764
+ Token: Token
1765
+ };
1766
+ _self.Prism = _;
1767
+
1768
+
1769
+ // Typescript note:
1770
+ // The following can be used to import the Token type in JSDoc:
1771
+ //
1772
+ // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
1773
+
1774
+ /**
1775
+ * Creates a new token.
1776
+ *
1777
+ * @param {string} type See {@link Token#type type}
1778
+ * @param {string | TokenStream} content See {@link Token#content content}
1779
+ * @param {string|string[]} [alias] The alias(es) of the token.
1780
+ * @param {string} [matchedStr=""] A copy of the full string this token was created from.
1781
+ * @class
1782
+ * @global
1783
+ * @public
1784
+ */
1785
+ function Token(type, content, alias, matchedStr) {
1786
+ /**
1787
+ * The type of the token.
1788
+ *
1789
+ * This is usually the key of a pattern in a {@link Grammar}.
1790
+ *
1791
+ * @type {string}
1792
+ * @see GrammarToken
1793
+ * @public
1794
+ */
1795
+ this.type = type;
1796
+ /**
1797
+ * The strings or tokens contained by this token.
1798
+ *
1799
+ * This will be a token stream if the pattern matched also defined an `inside` grammar.
1800
+ *
1801
+ * @type {string | TokenStream}
1802
+ * @public
1803
+ */
1804
+ this.content = content;
1805
+ /**
1806
+ * The alias(es) of the token.
1807
+ *
1808
+ * @type {string|string[]}
1809
+ * @see GrammarToken
1810
+ * @public
1811
+ */
1812
+ this.alias = alias;
1813
+ // Copy of the full string this token was created from
1814
+ this.length = (matchedStr || '').length | 0;
1815
+ }
1816
+
1817
+ /**
1818
+ * A token stream is an array of strings and {@link Token Token} objects.
1819
+ *
1820
+ * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
1821
+ * them.
1822
+ *
1823
+ * 1. No adjacent strings.
1824
+ * 2. No empty strings.
1825
+ *
1826
+ * The only exception here is the token stream that only contains the empty string and nothing else.
1827
+ *
1828
+ * @typedef {Array<string | Token>} TokenStream
1829
+ * @global
1830
+ * @public
1831
+ */
1832
+
1833
+ /**
1834
+ * Converts the given token or token stream to an HTML representation.
1835
+ *
1836
+ * The following hooks will be run:
1837
+ * 1. `wrap`: On each {@link Token}.
1838
+ *
1839
+ * @param {string | Token | TokenStream} o The token or token stream to be converted.
1840
+ * @param {string} language The name of current language.
1841
+ * @returns {string} The HTML representation of the token or token stream.
1842
+ * @memberof Token
1843
+ * @static
1844
+ */
1845
+ Token.stringify = function stringify(o, language) {
1846
+ if (typeof o == 'string') {
1847
+ return o;
1848
+ }
1849
+ if (Array.isArray(o)) {
1850
+ var s = '';
1851
+ o.forEach(function (e) {
1852
+ s += stringify(e, language);
1853
+ });
1854
+ return s;
1855
+ }
1856
+
1857
+ var env = {
1858
+ type: o.type,
1859
+ content: stringify(o.content, language),
1860
+ tag: 'span',
1861
+ classes: ['token', o.type],
1862
+ attributes: {},
1863
+ language: language
1864
+ };
1865
+
1866
+ var aliases = o.alias;
1867
+ if (aliases) {
1868
+ if (Array.isArray(aliases)) {
1869
+ Array.prototype.push.apply(env.classes, aliases);
1870
+ } else {
1871
+ env.classes.push(aliases);
1872
+ }
1873
+ }
1874
+
1875
+ _.hooks.run('wrap', env);
1876
+
1877
+ var attributes = '';
1878
+ for (var name in env.attributes) {
1879
+ attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
1880
+ }
1881
+
1882
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
1883
+ };
1884
+
1885
+ /**
1886
+ * @param {RegExp} pattern
1887
+ * @param {number} pos
1888
+ * @param {string} text
1889
+ * @param {boolean} lookbehind
1890
+ * @returns {RegExpExecArray | null}
1891
+ */
1892
+ function matchPattern(pattern, pos, text, lookbehind) {
1893
+ pattern.lastIndex = pos;
1894
+ var match = pattern.exec(text);
1895
+ if (match && lookbehind && match[1]) {
1896
+ // change the match to remove the text matched by the Prism lookbehind group
1897
+ var lookbehindLength = match[1].length;
1898
+ match.index += lookbehindLength;
1899
+ match[0] = match[0].slice(lookbehindLength);
1900
+ }
1901
+ return match;
1902
+ }
1903
+
1904
+ /**
1905
+ * @param {string} text
1906
+ * @param {LinkedList<string | Token>} tokenList
1907
+ * @param {any} grammar
1908
+ * @param {LinkedListNode<string | Token>} startNode
1909
+ * @param {number} startPos
1910
+ * @param {RematchOptions} [rematch]
1911
+ * @returns {void}
1912
+ * @private
1913
+ *
1914
+ * @typedef RematchOptions
1915
+ * @property {string} cause
1916
+ * @property {number} reach
1917
+ */
1918
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
1919
+ for (var token in grammar) {
1920
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
1921
+ continue;
1922
+ }
1923
+
1924
+ var patterns = grammar[token];
1925
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
1926
+
1927
+ for (var j = 0; j < patterns.length; ++j) {
1928
+ if (rematch && rematch.cause == token + ',' + j) {
1929
+ return;
1930
+ }
1931
+
1932
+ var patternObj = patterns[j];
1933
+ var inside = patternObj.inside;
1934
+ var lookbehind = !!patternObj.lookbehind;
1935
+ var greedy = !!patternObj.greedy;
1936
+ var alias = patternObj.alias;
1937
+
1938
+ if (greedy && !patternObj.pattern.global) {
1939
+ // Without the global flag, lastIndex won't work
1940
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
1941
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
1942
+ }
1943
+
1944
+ /** @type {RegExp} */
1945
+ var pattern = patternObj.pattern || patternObj;
1946
+
1947
+ for ( // iterate the token list and keep track of the current token/string position
1948
+ var currentNode = startNode.next, pos = startPos;
1949
+ currentNode !== tokenList.tail;
1950
+ pos += currentNode.value.length, currentNode = currentNode.next
1951
+ ) {
1952
+
1953
+ if (rematch && pos >= rematch.reach) {
1954
+ break;
1955
+ }
1956
+
1957
+ var str = currentNode.value;
1958
+
1959
+ if (tokenList.length > text.length) {
1960
+ // Something went terribly wrong, ABORT, ABORT!
1961
+ return;
1962
+ }
1963
+
1964
+ if (str instanceof Token) {
1965
+ continue;
1966
+ }
1967
+
1968
+ var removeCount = 1; // this is the to parameter of removeBetween
1969
+ var match;
1970
+
1971
+ if (greedy) {
1972
+ match = matchPattern(pattern, pos, text, lookbehind);
1973
+ if (!match || match.index >= text.length) {
1974
+ break;
1975
+ }
1976
+
1977
+ var from = match.index;
1978
+ var to = match.index + match[0].length;
1979
+ var p = pos;
1980
+
1981
+ // find the node that contains the match
1982
+ p += currentNode.value.length;
1983
+ while (from >= p) {
1984
+ currentNode = currentNode.next;
1985
+ p += currentNode.value.length;
1986
+ }
1987
+ // adjust pos (and p)
1988
+ p -= currentNode.value.length;
1989
+ pos = p;
1990
+
1991
+ // the current node is a Token, then the match starts inside another Token, which is invalid
1992
+ if (currentNode.value instanceof Token) {
1993
+ continue;
1994
+ }
1995
+
1996
+ // find the last node which is affected by this match
1997
+ for (
1998
+ var k = currentNode;
1999
+ k !== tokenList.tail && (p < to || typeof k.value === 'string');
2000
+ k = k.next
2001
+ ) {
2002
+ removeCount++;
2003
+ p += k.value.length;
2004
+ }
2005
+ removeCount--;
2006
+
2007
+ // replace with the new match
2008
+ str = text.slice(pos, p);
2009
+ match.index -= pos;
2010
+ } else {
2011
+ match = matchPattern(pattern, 0, str, lookbehind);
2012
+ if (!match) {
2013
+ continue;
2014
+ }
2015
+ }
2016
+
2017
+ // eslint-disable-next-line no-redeclare
2018
+ var from = match.index;
2019
+ var matchStr = match[0];
2020
+ var before = str.slice(0, from);
2021
+ var after = str.slice(from + matchStr.length);
2022
+
2023
+ var reach = pos + str.length;
2024
+ if (rematch && reach > rematch.reach) {
2025
+ rematch.reach = reach;
2026
+ }
2027
+
2028
+ var removeFrom = currentNode.prev;
2029
+
2030
+ if (before) {
2031
+ removeFrom = addAfter(tokenList, removeFrom, before);
2032
+ pos += before.length;
2033
+ }
2034
+
2035
+ removeRange(tokenList, removeFrom, removeCount);
2036
+
2037
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
2038
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
2039
+
2040
+ if (after) {
2041
+ addAfter(tokenList, currentNode, after);
2042
+ }
2043
+
2044
+ if (removeCount > 1) {
2045
+ // at least one Token object was removed, so we have to do some rematching
2046
+ // this can only happen if the current pattern is greedy
2047
+
2048
+ /** @type {RematchOptions} */
2049
+ var nestedRematch = {
2050
+ cause: token + ',' + j,
2051
+ reach: reach
2052
+ };
2053
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
2054
+
2055
+ // the reach might have been extended because of the rematching
2056
+ if (rematch && nestedRematch.reach > rematch.reach) {
2057
+ rematch.reach = nestedRematch.reach;
2058
+ }
2059
+ }
2060
+ }
2061
+ }
2062
+ }
2063
+ }
2064
+
2065
+ /**
2066
+ * @typedef LinkedListNode
2067
+ * @property {T} value
2068
+ * @property {LinkedListNode<T> | null} prev The previous node.
2069
+ * @property {LinkedListNode<T> | null} next The next node.
2070
+ * @template T
2071
+ * @private
2072
+ */
2073
+
2074
+ /**
2075
+ * @template T
2076
+ * @private
2077
+ */
2078
+ function LinkedList() {
2079
+ /** @type {LinkedListNode<T>} */
2080
+ var head = { value: null, prev: null, next: null };
2081
+ /** @type {LinkedListNode<T>} */
2082
+ var tail = { value: null, prev: head, next: null };
2083
+ head.next = tail;
2084
+
2085
+ /** @type {LinkedListNode<T>} */
2086
+ this.head = head;
2087
+ /** @type {LinkedListNode<T>} */
2088
+ this.tail = tail;
2089
+ this.length = 0;
2090
+ }
2091
+
2092
+ /**
2093
+ * Adds a new node with the given value to the list.
2094
+ *
2095
+ * @param {LinkedList<T>} list
2096
+ * @param {LinkedListNode<T>} node
2097
+ * @param {T} value
2098
+ * @returns {LinkedListNode<T>} The added node.
2099
+ * @template T
2100
+ */
2101
+ function addAfter(list, node, value) {
2102
+ // assumes that node != list.tail && values.length >= 0
2103
+ var next = node.next;
2104
+
2105
+ var newNode = { value: value, prev: node, next: next };
2106
+ node.next = newNode;
2107
+ next.prev = newNode;
2108
+ list.length++;
2109
+
2110
+ return newNode;
2111
+ }
2112
+ /**
2113
+ * Removes `count` nodes after the given node. The given node will not be removed.
2114
+ *
2115
+ * @param {LinkedList<T>} list
2116
+ * @param {LinkedListNode<T>} node
2117
+ * @param {number} count
2118
+ * @template T
2119
+ */
2120
+ function removeRange(list, node, count) {
2121
+ var next = node.next;
2122
+ for (var i = 0; i < count && next !== list.tail; i++) {
2123
+ next = next.next;
2124
+ }
2125
+ node.next = next;
2126
+ next.prev = node;
2127
+ list.length -= i;
2128
+ }
2129
+ /**
2130
+ * @param {LinkedList<T>} list
2131
+ * @returns {T[]}
2132
+ * @template T
2133
+ */
2134
+ function toArray(list) {
2135
+ var array = [];
2136
+ var node = list.head.next;
2137
+ while (node !== list.tail) {
2138
+ array.push(node.value);
2139
+ node = node.next;
2140
+ }
2141
+ return array;
2142
+ }
2143
+
2144
+
2145
+ if (!_self.document) {
2146
+ if (!_self.addEventListener) {
2147
+ // in Node.js
2148
+ return _;
2149
+ }
2150
+
2151
+ if (!_.disableWorkerMessageHandler) {
2152
+ // In worker
2153
+ _self.addEventListener('message', function (evt) {
2154
+ var message = JSON.parse(evt.data);
2155
+ var lang = message.language;
2156
+ var code = message.code;
2157
+ var immediateClose = message.immediateClose;
2158
+
2159
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
2160
+ if (immediateClose) {
2161
+ _self.close();
2162
+ }
2163
+ }, false);
2164
+ }
2165
+
2166
+ return _;
2167
+ }
2168
+
2169
+ // Get current script and highlight
2170
+ var script = _.util.currentScript();
2171
+
2172
+ if (script) {
2173
+ _.filename = script.src;
2174
+
2175
+ if (script.hasAttribute('data-manual')) {
2176
+ _.manual = true;
2177
+ }
2178
+ }
2179
+
2180
+ function highlightAutomaticallyCallback() {
2181
+ if (!_.manual) {
2182
+ _.highlightAll();
2183
+ }
2184
+ }
2185
+
2186
+ if (!_.manual) {
2187
+ // If the document state is "loading", then we'll use DOMContentLoaded.
2188
+ // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
2189
+ // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
2190
+ // might take longer one animation frame to execute which can create a race condition where only some plugins have
2191
+ // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
2192
+ // See https://github.com/PrismJS/prism/issues/2102
2193
+ var readyState = document.readyState;
2194
+ if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
2195
+ document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
2196
+ } else {
2197
+ if (window.requestAnimationFrame) {
2198
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
2199
+ } else {
2200
+ window.setTimeout(highlightAutomaticallyCallback, 16);
2201
+ }
2202
+ }
2203
+ }
2204
+
2205
+ return _;
2206
+
2207
+ }(_self));
2208
+
2209
+ if (module.exports) {
2210
+ module.exports = Prism;
2211
+ }
2212
+
2213
+ // hack for components to work correctly in node.js
2214
+ if (typeof _commonjsHelpers.commonjsGlobal !== 'undefined') {
2215
+ _commonjsHelpers.commonjsGlobal.Prism = Prism;
2216
+ }
2217
+
2218
+ // some additional documentation/types
2219
+
2220
+ /**
2221
+ * The expansion of a simple `RegExp` literal to support additional properties.
2222
+ *
2223
+ * @typedef GrammarToken
2224
+ * @property {RegExp} pattern The regular expression of the token.
2225
+ * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
2226
+ * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
2227
+ * @property {boolean} [greedy=false] Whether the token is greedy.
2228
+ * @property {string|string[]} [alias] An optional alias or list of aliases.
2229
+ * @property {Grammar} [inside] The nested grammar of this token.
2230
+ *
2231
+ * The `inside` grammar will be used to tokenize the text value of each token of this kind.
2232
+ *
2233
+ * This can be used to make nested and even recursive language definitions.
2234
+ *
2235
+ * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
2236
+ * each another.
2237
+ * @global
2238
+ * @public
2239
+ */
2240
+
2241
+ /**
2242
+ * @typedef Grammar
2243
+ * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
2244
+ * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
2245
+ * @global
2246
+ * @public
2247
+ */
2248
+
2249
+ /**
2250
+ * A function which will invoked after an element was successfully highlighted.
2251
+ *
2252
+ * @callback HighlightCallback
2253
+ * @param {Element} element The element successfully highlighted.
2254
+ * @returns {void}
2255
+ * @global
2256
+ * @public
2257
+ */
2258
+
2259
+ /**
2260
+ * @callback HookCallback
2261
+ * @param {Object<string, any>} env The environment variables of the hook.
2262
+ * @returns {void}
2263
+ * @global
2264
+ * @public
2265
+ */
2266
+
2267
+
2268
+ /* **********************************************
2269
+ Begin prism-markup.js
2270
+ ********************************************** */
2271
+
2272
+ Prism.languages.markup = {
2273
+ 'comment': {
2274
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
2275
+ greedy: true
2276
+ },
2277
+ 'prolog': {
2278
+ pattern: /<\?[\s\S]+?\?>/,
2279
+ greedy: true
2280
+ },
2281
+ 'doctype': {
2282
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
2283
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
2284
+ greedy: true,
2285
+ inside: {
2286
+ 'internal-subset': {
2287
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
2288
+ lookbehind: true,
2289
+ greedy: true,
2290
+ inside: null // see below
2291
+ },
2292
+ 'string': {
2293
+ pattern: /"[^"]*"|'[^']*'/,
2294
+ greedy: true
2295
+ },
2296
+ 'punctuation': /^<!|>$|[[\]]/,
2297
+ 'doctype-tag': /^DOCTYPE/i,
2298
+ 'name': /[^\s<>'"]+/
2299
+ }
2300
+ },
2301
+ 'cdata': {
2302
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2303
+ greedy: true
2304
+ },
2305
+ 'tag': {
2306
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
2307
+ greedy: true,
2308
+ inside: {
2309
+ 'tag': {
2310
+ pattern: /^<\/?[^\s>\/]+/,
2311
+ inside: {
2312
+ 'punctuation': /^<\/?/,
2313
+ 'namespace': /^[^\s>\/:]+:/
2314
+ }
2315
+ },
2316
+ 'special-attr': [],
2317
+ 'attr-value': {
2318
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
2319
+ inside: {
2320
+ 'punctuation': [
2321
+ {
2322
+ pattern: /^=/,
2323
+ alias: 'attr-equals'
2324
+ },
2325
+ {
2326
+ pattern: /^(\s*)["']|["']$/,
2327
+ lookbehind: true
2328
+ }
2329
+ ]
2330
+ }
2331
+ },
2332
+ 'punctuation': /\/?>/,
2333
+ 'attr-name': {
2334
+ pattern: /[^\s>\/]+/,
2335
+ inside: {
2336
+ 'namespace': /^[^\s>\/:]+:/
2337
+ }
2338
+ }
2339
+
2340
+ }
2341
+ },
2342
+ 'entity': [
2343
+ {
2344
+ pattern: /&[\da-z]{1,8};/i,
2345
+ alias: 'named-entity'
2346
+ },
2347
+ /&#x?[\da-f]{1,8};/i
2348
+ ]
2349
+ };
2350
+
2351
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
2352
+ Prism.languages.markup['entity'];
2353
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
2354
+
2355
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
2356
+ Prism.hooks.add('wrap', function (env) {
2357
+
2358
+ if (env.type === 'entity') {
2359
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
2360
+ }
2361
+ });
2362
+
2363
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
2364
+ /**
2365
+ * Adds an inlined language to markup.
2366
+ *
2367
+ * An example of an inlined language is CSS with `<style>` tags.
2368
+ *
2369
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
2370
+ * case insensitive.
2371
+ * @param {string} lang The language key.
2372
+ * @example
2373
+ * addInlined('style', 'css');
2374
+ */
2375
+ value: function addInlined(tagName, lang) {
2376
+ var includedCdataInside = {};
2377
+ includedCdataInside['language-' + lang] = {
2378
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
2379
+ lookbehind: true,
2380
+ inside: Prism.languages[lang]
2381
+ };
2382
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
2383
+
2384
+ var inside = {
2385
+ 'included-cdata': {
2386
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2387
+ inside: includedCdataInside
2388
+ }
2389
+ };
2390
+ inside['language-' + lang] = {
2391
+ pattern: /[\s\S]+/,
2392
+ inside: Prism.languages[lang]
2393
+ };
2394
+
2395
+ var def = {};
2396
+ def[tagName] = {
2397
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
2398
+ lookbehind: true,
2399
+ greedy: true,
2400
+ inside: inside
2401
+ };
2402
+
2403
+ Prism.languages.insertBefore('markup', 'cdata', def);
2404
+ }
2405
+ });
2406
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
2407
+ /**
2408
+ * Adds an pattern to highlight languages embedded in HTML attributes.
2409
+ *
2410
+ * An example of an inlined language is CSS with `style` attributes.
2411
+ *
2412
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
2413
+ * case insensitive.
2414
+ * @param {string} lang The language key.
2415
+ * @example
2416
+ * addAttribute('style', 'css');
2417
+ */
2418
+ value: function (attrName, lang) {
2419
+ Prism.languages.markup.tag.inside['special-attr'].push({
2420
+ pattern: RegExp(
2421
+ /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
2422
+ 'i'
2423
+ ),
2424
+ lookbehind: true,
2425
+ inside: {
2426
+ 'attr-name': /^[^\s=]+/,
2427
+ 'attr-value': {
2428
+ pattern: /=[\s\S]+/,
2429
+ inside: {
2430
+ 'value': {
2431
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
2432
+ lookbehind: true,
2433
+ alias: [lang, 'language-' + lang],
2434
+ inside: Prism.languages[lang]
2435
+ },
2436
+ 'punctuation': [
2437
+ {
2438
+ pattern: /^=/,
2439
+ alias: 'attr-equals'
2440
+ },
2441
+ /"|'/
2442
+ ]
2443
+ }
2444
+ }
2445
+ }
2446
+ });
2447
+ }
2448
+ });
2449
+
2450
+ Prism.languages.html = Prism.languages.markup;
2451
+ Prism.languages.mathml = Prism.languages.markup;
2452
+ Prism.languages.svg = Prism.languages.markup;
2453
+
2454
+ Prism.languages.xml = Prism.languages.extend('markup', {});
2455
+ Prism.languages.ssml = Prism.languages.xml;
2456
+ Prism.languages.atom = Prism.languages.xml;
2457
+ Prism.languages.rss = Prism.languages.xml;
2458
+
2459
+
2460
+ /* **********************************************
2461
+ Begin prism-css.js
2462
+ ********************************************** */
2463
+
2464
+ (function (Prism) {
2465
+
2466
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
2467
+
2468
+ Prism.languages.css = {
2469
+ 'comment': /\/\*[\s\S]*?\*\//,
2470
+ 'atrule': {
2471
+ pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
2472
+ inside: {
2473
+ 'rule': /^@[\w-]+/,
2474
+ 'selector-function-argument': {
2475
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
2476
+ lookbehind: true,
2477
+ alias: 'selector'
2478
+ },
2479
+ 'keyword': {
2480
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
2481
+ lookbehind: true
2482
+ }
2483
+ // See rest below
2484
+ }
2485
+ },
2486
+ 'url': {
2487
+ // https://drafts.csswg.org/css-values-3/#urls
2488
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
2489
+ greedy: true,
2490
+ inside: {
2491
+ 'function': /^url/i,
2492
+ 'punctuation': /^\(|\)$/,
2493
+ 'string': {
2494
+ pattern: RegExp('^' + string.source + '$'),
2495
+ alias: 'url'
2496
+ }
2497
+ }
2498
+ },
2499
+ 'selector': {
2500
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
2501
+ lookbehind: true
2502
+ },
2503
+ 'string': {
2504
+ pattern: string,
2505
+ greedy: true
2506
+ },
2507
+ 'property': {
2508
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
2509
+ lookbehind: true
2510
+ },
2511
+ 'important': /!important\b/i,
2512
+ 'function': {
2513
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
2514
+ lookbehind: true
2515
+ },
2516
+ 'punctuation': /[(){};:,]/
2517
+ };
2518
+
2519
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
2520
+
2521
+ var markup = Prism.languages.markup;
2522
+ if (markup) {
2523
+ markup.tag.addInlined('style', 'css');
2524
+ markup.tag.addAttribute('style', 'css');
2525
+ }
2526
+
2527
+ }(Prism));
2528
+
2529
+
2530
+ /* **********************************************
2531
+ Begin prism-clike.js
2532
+ ********************************************** */
2533
+
2534
+ Prism.languages.clike = {
2535
+ 'comment': [
2536
+ {
2537
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
2538
+ lookbehind: true,
2539
+ greedy: true
2540
+ },
2541
+ {
2542
+ pattern: /(^|[^\\:])\/\/.*/,
2543
+ lookbehind: true,
2544
+ greedy: true
2545
+ }
2546
+ ],
2547
+ 'string': {
2548
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
2549
+ greedy: true
2550
+ },
2551
+ 'class-name': {
2552
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
2553
+ lookbehind: true,
2554
+ inside: {
2555
+ 'punctuation': /[.\\]/
2556
+ }
2557
+ },
2558
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
2559
+ 'boolean': /\b(?:false|true)\b/,
2560
+ 'function': /\b\w+(?=\()/,
2561
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
2562
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
2563
+ 'punctuation': /[{}[\];(),.:]/
2564
+ };
2565
+
2566
+
2567
+ /* **********************************************
2568
+ Begin prism-javascript.js
2569
+ ********************************************** */
2570
+
2571
+ Prism.languages.javascript = Prism.languages.extend('clike', {
2572
+ 'class-name': [
2573
+ Prism.languages.clike['class-name'],
2574
+ {
2575
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
2576
+ lookbehind: true
2577
+ }
2578
+ ],
2579
+ 'keyword': [
2580
+ {
2581
+ pattern: /((?:^|\})\s*)catch\b/,
2582
+ lookbehind: true
2583
+ },
2584
+ {
2585
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
2586
+ lookbehind: true
2587
+ },
2588
+ ],
2589
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
2590
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
2591
+ 'number': {
2592
+ pattern: RegExp(
2593
+ /(^|[^\w$])/.source +
2594
+ '(?:' +
2595
+ (
2596
+ // constant
2597
+ /NaN|Infinity/.source +
2598
+ '|' +
2599
+ // binary integer
2600
+ /0[bB][01]+(?:_[01]+)*n?/.source +
2601
+ '|' +
2602
+ // octal integer
2603
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
2604
+ '|' +
2605
+ // hexadecimal integer
2606
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
2607
+ '|' +
2608
+ // decimal bigint
2609
+ /\d+(?:_\d+)*n/.source +
2610
+ '|' +
2611
+ // decimal number (integer or float) but no bigint
2612
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
2613
+ ) +
2614
+ ')' +
2615
+ /(?![\w$])/.source
2616
+ ),
2617
+ lookbehind: true
2618
+ },
2619
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
2620
+ });
2621
+
2622
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
2623
+
2624
+ Prism.languages.insertBefore('javascript', 'keyword', {
2625
+ 'regex': {
2626
+ pattern: RegExp(
2627
+ // lookbehind
2628
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
2629
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
2630
+ // Regex pattern:
2631
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
2632
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
2633
+ // with the only syntax, so we have to define 2 different regex patterns.
2634
+ /\//.source +
2635
+ '(?:' +
2636
+ /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
2637
+ '|' +
2638
+ // `v` flag syntax. This supports 3 levels of nested character classes.
2639
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
2640
+ ')' +
2641
+ // lookahead
2642
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
2643
+ ),
2644
+ lookbehind: true,
2645
+ greedy: true,
2646
+ inside: {
2647
+ 'regex-source': {
2648
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
2649
+ lookbehind: true,
2650
+ alias: 'language-regex',
2651
+ inside: Prism.languages.regex
2652
+ },
2653
+ 'regex-delimiter': /^\/|\/$/,
2654
+ 'regex-flags': /^[a-z]+$/,
2655
+ }
2656
+ },
2657
+ // This must be declared before keyword because we use "function" inside the look-forward
2658
+ 'function-variable': {
2659
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
2660
+ alias: 'function'
2661
+ },
2662
+ 'parameter': [
2663
+ {
2664
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
2665
+ lookbehind: true,
2666
+ inside: Prism.languages.javascript
2667
+ },
2668
+ {
2669
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
2670
+ lookbehind: true,
2671
+ inside: Prism.languages.javascript
2672
+ },
2673
+ {
2674
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
2675
+ lookbehind: true,
2676
+ inside: Prism.languages.javascript
2677
+ },
2678
+ {
2679
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
2680
+ lookbehind: true,
2681
+ inside: Prism.languages.javascript
2682
+ }
2683
+ ],
2684
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
2685
+ });
2686
+
2687
+ Prism.languages.insertBefore('javascript', 'string', {
2688
+ 'hashbang': {
2689
+ pattern: /^#!.*/,
2690
+ greedy: true,
2691
+ alias: 'comment'
2692
+ },
2693
+ 'template-string': {
2694
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
2695
+ greedy: true,
2696
+ inside: {
2697
+ 'template-punctuation': {
2698
+ pattern: /^`|`$/,
2699
+ alias: 'string'
2700
+ },
2701
+ 'interpolation': {
2702
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
2703
+ lookbehind: true,
2704
+ inside: {
2705
+ 'interpolation-punctuation': {
2706
+ pattern: /^\$\{|\}$/,
2707
+ alias: 'punctuation'
2708
+ },
2709
+ rest: Prism.languages.javascript
2710
+ }
2711
+ },
2712
+ 'string': /[\s\S]+/
2713
+ }
2714
+ },
2715
+ 'string-property': {
2716
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
2717
+ lookbehind: true,
2718
+ greedy: true,
2719
+ alias: 'property'
2720
+ }
2721
+ });
2722
+
2723
+ Prism.languages.insertBefore('javascript', 'operator', {
2724
+ 'literal-property': {
2725
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
2726
+ lookbehind: true,
2727
+ alias: 'property'
2728
+ },
2729
+ });
2730
+
2731
+ if (Prism.languages.markup) {
2732
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
2733
+
2734
+ // add attribute support for all DOM events.
2735
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
2736
+ Prism.languages.markup.tag.addAttribute(
2737
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
2738
+ 'javascript'
2739
+ );
2740
+ }
2741
+
2742
+ Prism.languages.js = Prism.languages.javascript;
2743
+
2744
+
2745
+ /* **********************************************
2746
+ Begin prism-file-highlight.js
2747
+ ********************************************** */
2748
+
2749
+ (function () {
2750
+
2751
+ if (typeof Prism === 'undefined' || typeof document === 'undefined') {
2752
+ return;
2753
+ }
2754
+
2755
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
2756
+ if (!Element.prototype.matches) {
2757
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
2758
+ }
2759
+
2760
+ var LOADING_MESSAGE = 'Loading…';
2761
+ var FAILURE_MESSAGE = function (status, message) {
2762
+ return '✖ Error ' + status + ' while fetching file: ' + message;
2763
+ };
2764
+ var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
2765
+
2766
+ var EXTENSIONS = {
2767
+ 'js': 'javascript',
2768
+ 'py': 'python',
2769
+ 'rb': 'ruby',
2770
+ 'ps1': 'powershell',
2771
+ 'psm1': 'powershell',
2772
+ 'sh': 'bash',
2773
+ 'bat': 'batch',
2774
+ 'h': 'c',
2775
+ 'tex': 'latex'
2776
+ };
2777
+
2778
+ var STATUS_ATTR = 'data-src-status';
2779
+ var STATUS_LOADING = 'loading';
2780
+ var STATUS_LOADED = 'loaded';
2781
+ var STATUS_FAILED = 'failed';
2782
+
2783
+ var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
2784
+ + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
2785
+
2786
+ /**
2787
+ * Loads the given file.
2788
+ *
2789
+ * @param {string} src The URL or path of the source file to load.
2790
+ * @param {(result: string) => void} success
2791
+ * @param {(reason: string) => void} error
2792
+ */
2793
+ function loadFile(src, success, error) {
2794
+ var xhr = new XMLHttpRequest();
2795
+ xhr.open('GET', src, true);
2796
+ xhr.onreadystatechange = function () {
2797
+ if (xhr.readyState == 4) {
2798
+ if (xhr.status < 400 && xhr.responseText) {
2799
+ success(xhr.responseText);
2800
+ } else {
2801
+ if (xhr.status >= 400) {
2802
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
2803
+ } else {
2804
+ error(FAILURE_EMPTY_MESSAGE);
2805
+ }
2806
+ }
2807
+ }
2808
+ };
2809
+ xhr.send(null);
2810
+ }
2811
+
2812
+ /**
2813
+ * Parses the given range.
2814
+ *
2815
+ * This returns a range with inclusive ends.
2816
+ *
2817
+ * @param {string | null | undefined} range
2818
+ * @returns {[number, number | undefined] | undefined}
2819
+ */
2820
+ function parseRange(range) {
2821
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
2822
+ if (m) {
2823
+ var start = Number(m[1]);
2824
+ var comma = m[2];
2825
+ var end = m[3];
2826
+
2827
+ if (!comma) {
2828
+ return [start, start];
2829
+ }
2830
+ if (!end) {
2831
+ return [start, undefined];
2832
+ }
2833
+ return [start, Number(end)];
2834
+ }
2835
+ return undefined;
2836
+ }
2837
+
2838
+ Prism.hooks.add('before-highlightall', function (env) {
2839
+ env.selector += ', ' + SELECTOR;
2840
+ });
2841
+
2842
+ Prism.hooks.add('before-sanity-check', function (env) {
2843
+ var pre = /** @type {HTMLPreElement} */ (env.element);
2844
+ if (pre.matches(SELECTOR)) {
2845
+ env.code = ''; // fast-path the whole thing and go to complete
2846
+
2847
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
2848
+
2849
+ // add code element with loading message
2850
+ var code = pre.appendChild(document.createElement('CODE'));
2851
+ code.textContent = LOADING_MESSAGE;
2852
+
2853
+ var src = pre.getAttribute('data-src');
2854
+
2855
+ var language = env.language;
2856
+ if (language === 'none') {
2857
+ // the language might be 'none' because there is no language set;
2858
+ // in this case, we want to use the extension as the language
2859
+ var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
2860
+ language = EXTENSIONS[extension] || extension;
2861
+ }
2862
+
2863
+ // set language classes
2864
+ Prism.util.setLanguage(code, language);
2865
+ Prism.util.setLanguage(pre, language);
2866
+
2867
+ // preload the language
2868
+ var autoloader = Prism.plugins.autoloader;
2869
+ if (autoloader) {
2870
+ autoloader.loadLanguages(language);
2871
+ }
2872
+
2873
+ // load file
2874
+ loadFile(
2875
+ src,
2876
+ function (text) {
2877
+ // mark as loaded
2878
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
2879
+
2880
+ // handle data-range
2881
+ var range = parseRange(pre.getAttribute('data-range'));
2882
+ if (range) {
2883
+ var lines = text.split(/\r\n?|\n/g);
2884
+
2885
+ // the range is one-based and inclusive on both ends
2886
+ var start = range[0];
2887
+ var end = range[1] == null ? lines.length : range[1];
2888
+
2889
+ if (start < 0) { start += lines.length; }
2890
+ start = Math.max(0, Math.min(start - 1, lines.length));
2891
+ if (end < 0) { end += lines.length; }
2892
+ end = Math.max(0, Math.min(end, lines.length));
2893
+
2894
+ text = lines.slice(start, end).join('\n');
2895
+
2896
+ // add data-start for line numbers
2897
+ if (!pre.hasAttribute('data-start')) {
2898
+ pre.setAttribute('data-start', String(start + 1));
2899
+ }
2900
+ }
2901
+
2902
+ // highlight code
2903
+ code.textContent = text;
2904
+ Prism.highlightElement(code);
2905
+ },
2906
+ function (error) {
2907
+ // mark as failed
2908
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
2909
+
2910
+ code.textContent = error;
2911
+ }
2912
+ );
2913
+ }
2914
+ });
2915
+
2916
+ Prism.plugins.fileHighlight = {
2917
+ /**
2918
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
2919
+ *
2920
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
2921
+ *
2922
+ * @param {ParentNode} [container=document]
2923
+ */
2924
+ highlight: function highlight(container) {
2925
+ var elements = (container || document).querySelectorAll(SELECTOR);
2926
+
2927
+ for (var i = 0, element; (element = elements[i++]);) {
2928
+ Prism.highlightElement(element);
2929
+ }
2930
+ }
2931
+ };
2932
+
2933
+ var logged = false;
2934
+ /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
2935
+ Prism.fileHighlight = function () {
2936
+ if (!logged) {
2937
+ console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
2938
+ logged = true;
2939
+ }
2940
+ Prism.plugins.fileHighlight.highlight.apply(this, arguments);
2941
+ };
2942
+
2943
+ }());
2944
+ });
2945
+
2946
+ Prism.languages.clike = {
2947
+ 'comment': [
2948
+ {
2949
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
2950
+ lookbehind: true,
2951
+ greedy: true
2952
+ },
2953
+ {
2954
+ pattern: /(^|[^\\:])\/\/.*/,
2955
+ lookbehind: true,
2956
+ greedy: true
2957
+ }
2958
+ ],
2959
+ 'string': {
2960
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
2961
+ greedy: true
2962
+ },
2963
+ 'class-name': {
2964
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
2965
+ lookbehind: true,
2966
+ inside: {
2967
+ 'punctuation': /[.\\]/
2968
+ }
2969
+ },
2970
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
2971
+ 'boolean': /\b(?:false|true)\b/,
2972
+ 'function': /\b\w+(?=\()/,
2973
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
2974
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
2975
+ 'punctuation': /[{}[\];(),.:]/
2976
+ };
2977
+
2978
+ Prism.languages.javascript = Prism.languages.extend('clike', {
2979
+ 'class-name': [
2980
+ Prism.languages.clike['class-name'],
2981
+ {
2982
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
2983
+ lookbehind: true
2984
+ }
2985
+ ],
2986
+ 'keyword': [
2987
+ {
2988
+ pattern: /((?:^|\})\s*)catch\b/,
2989
+ lookbehind: true
2990
+ },
2991
+ {
2992
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
2993
+ lookbehind: true
2994
+ },
2995
+ ],
2996
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
2997
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
2998
+ 'number': {
2999
+ pattern: RegExp(
3000
+ /(^|[^\w$])/.source +
3001
+ '(?:' +
3002
+ (
3003
+ // constant
3004
+ /NaN|Infinity/.source +
3005
+ '|' +
3006
+ // binary integer
3007
+ /0[bB][01]+(?:_[01]+)*n?/.source +
3008
+ '|' +
3009
+ // octal integer
3010
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
3011
+ '|' +
3012
+ // hexadecimal integer
3013
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
3014
+ '|' +
3015
+ // decimal bigint
3016
+ /\d+(?:_\d+)*n/.source +
3017
+ '|' +
3018
+ // decimal number (integer or float) but no bigint
3019
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
3020
+ ) +
3021
+ ')' +
3022
+ /(?![\w$])/.source
3023
+ ),
3024
+ lookbehind: true
3025
+ },
3026
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
3027
+ });
3028
+
3029
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
3030
+
3031
+ Prism.languages.insertBefore('javascript', 'keyword', {
3032
+ 'regex': {
3033
+ pattern: RegExp(
3034
+ // lookbehind
3035
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
3036
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
3037
+ // Regex pattern:
3038
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
3039
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
3040
+ // with the only syntax, so we have to define 2 different regex patterns.
3041
+ /\//.source +
3042
+ '(?:' +
3043
+ /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
3044
+ '|' +
3045
+ // `v` flag syntax. This supports 3 levels of nested character classes.
3046
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
3047
+ ')' +
3048
+ // lookahead
3049
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
3050
+ ),
3051
+ lookbehind: true,
3052
+ greedy: true,
3053
+ inside: {
3054
+ 'regex-source': {
3055
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
3056
+ lookbehind: true,
3057
+ alias: 'language-regex',
3058
+ inside: Prism.languages.regex
3059
+ },
3060
+ 'regex-delimiter': /^\/|\/$/,
3061
+ 'regex-flags': /^[a-z]+$/,
3062
+ }
3063
+ },
3064
+ // This must be declared before keyword because we use "function" inside the look-forward
3065
+ 'function-variable': {
3066
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
3067
+ alias: 'function'
3068
+ },
3069
+ 'parameter': [
3070
+ {
3071
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
3072
+ lookbehind: true,
3073
+ inside: Prism.languages.javascript
3074
+ },
3075
+ {
3076
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
3077
+ lookbehind: true,
3078
+ inside: Prism.languages.javascript
3079
+ },
3080
+ {
3081
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
3082
+ lookbehind: true,
3083
+ inside: Prism.languages.javascript
3084
+ },
3085
+ {
3086
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
3087
+ lookbehind: true,
3088
+ inside: Prism.languages.javascript
3089
+ }
3090
+ ],
3091
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
3092
+ });
3093
+
3094
+ Prism.languages.insertBefore('javascript', 'string', {
3095
+ 'hashbang': {
3096
+ pattern: /^#!.*/,
3097
+ greedy: true,
3098
+ alias: 'comment'
3099
+ },
3100
+ 'template-string': {
3101
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
3102
+ greedy: true,
3103
+ inside: {
3104
+ 'template-punctuation': {
3105
+ pattern: /^`|`$/,
3106
+ alias: 'string'
3107
+ },
3108
+ 'interpolation': {
3109
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
3110
+ lookbehind: true,
3111
+ inside: {
3112
+ 'interpolation-punctuation': {
3113
+ pattern: /^\$\{|\}$/,
3114
+ alias: 'punctuation'
3115
+ },
3116
+ rest: Prism.languages.javascript
3117
+ }
3118
+ },
3119
+ 'string': /[\s\S]+/
3120
+ }
3121
+ },
3122
+ 'string-property': {
3123
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
3124
+ lookbehind: true,
3125
+ greedy: true,
3126
+ alias: 'property'
3127
+ }
3128
+ });
3129
+
3130
+ Prism.languages.insertBefore('javascript', 'operator', {
3131
+ 'literal-property': {
3132
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
3133
+ lookbehind: true,
3134
+ alias: 'property'
3135
+ },
3136
+ });
3137
+
3138
+ if (Prism.languages.markup) {
3139
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
3140
+
3141
+ // add attribute support for all DOM events.
3142
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
3143
+ Prism.languages.markup.tag.addAttribute(
3144
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
3145
+ 'javascript'
3146
+ );
3147
+ }
3148
+
3149
+ Prism.languages.js = Prism.languages.javascript;
3150
+
3151
+ Prism.languages.markup = {
3152
+ 'comment': {
3153
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
3154
+ greedy: true
3155
+ },
3156
+ 'prolog': {
3157
+ pattern: /<\?[\s\S]+?\?>/,
3158
+ greedy: true
3159
+ },
3160
+ 'doctype': {
3161
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
3162
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
3163
+ greedy: true,
3164
+ inside: {
3165
+ 'internal-subset': {
3166
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
3167
+ lookbehind: true,
3168
+ greedy: true,
3169
+ inside: null // see below
3170
+ },
3171
+ 'string': {
3172
+ pattern: /"[^"]*"|'[^']*'/,
3173
+ greedy: true
3174
+ },
3175
+ 'punctuation': /^<!|>$|[[\]]/,
3176
+ 'doctype-tag': /^DOCTYPE/i,
3177
+ 'name': /[^\s<>'"]+/
3178
+ }
3179
+ },
3180
+ 'cdata': {
3181
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
3182
+ greedy: true
3183
+ },
3184
+ 'tag': {
3185
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
3186
+ greedy: true,
3187
+ inside: {
3188
+ 'tag': {
3189
+ pattern: /^<\/?[^\s>\/]+/,
3190
+ inside: {
3191
+ 'punctuation': /^<\/?/,
3192
+ 'namespace': /^[^\s>\/:]+:/
3193
+ }
3194
+ },
3195
+ 'special-attr': [],
3196
+ 'attr-value': {
3197
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
3198
+ inside: {
3199
+ 'punctuation': [
3200
+ {
3201
+ pattern: /^=/,
3202
+ alias: 'attr-equals'
3203
+ },
3204
+ {
3205
+ pattern: /^(\s*)["']|["']$/,
3206
+ lookbehind: true
3207
+ }
3208
+ ]
3209
+ }
3210
+ },
3211
+ 'punctuation': /\/?>/,
3212
+ 'attr-name': {
3213
+ pattern: /[^\s>\/]+/,
3214
+ inside: {
3215
+ 'namespace': /^[^\s>\/:]+:/
3216
+ }
3217
+ }
3218
+
3219
+ }
3220
+ },
3221
+ 'entity': [
3222
+ {
3223
+ pattern: /&[\da-z]{1,8};/i,
3224
+ alias: 'named-entity'
3225
+ },
3226
+ /&#x?[\da-f]{1,8};/i
3227
+ ]
3228
+ };
3229
+
3230
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
3231
+ Prism.languages.markup['entity'];
3232
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
3233
+
3234
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
3235
+ Prism.hooks.add('wrap', function (env) {
3236
+
3237
+ if (env.type === 'entity') {
3238
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
3239
+ }
3240
+ });
3241
+
3242
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
3243
+ /**
3244
+ * Adds an inlined language to markup.
3245
+ *
3246
+ * An example of an inlined language is CSS with `<style>` tags.
3247
+ *
3248
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
3249
+ * case insensitive.
3250
+ * @param {string} lang The language key.
3251
+ * @example
3252
+ * addInlined('style', 'css');
3253
+ */
3254
+ value: function addInlined(tagName, lang) {
3255
+ var includedCdataInside = {};
3256
+ includedCdataInside['language-' + lang] = {
3257
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
3258
+ lookbehind: true,
3259
+ inside: Prism.languages[lang]
3260
+ };
3261
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
3262
+
3263
+ var inside = {
3264
+ 'included-cdata': {
3265
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
3266
+ inside: includedCdataInside
3267
+ }
3268
+ };
3269
+ inside['language-' + lang] = {
3270
+ pattern: /[\s\S]+/,
3271
+ inside: Prism.languages[lang]
3272
+ };
3273
+
3274
+ var def = {};
3275
+ def[tagName] = {
3276
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
3277
+ lookbehind: true,
3278
+ greedy: true,
3279
+ inside: inside
3280
+ };
3281
+
3282
+ Prism.languages.insertBefore('markup', 'cdata', def);
3283
+ }
3284
+ });
3285
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
3286
+ /**
3287
+ * Adds an pattern to highlight languages embedded in HTML attributes.
3288
+ *
3289
+ * An example of an inlined language is CSS with `style` attributes.
3290
+ *
3291
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
3292
+ * case insensitive.
3293
+ * @param {string} lang The language key.
3294
+ * @example
3295
+ * addAttribute('style', 'css');
3296
+ */
3297
+ value: function (attrName, lang) {
3298
+ Prism.languages.markup.tag.inside['special-attr'].push({
3299
+ pattern: RegExp(
3300
+ /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
3301
+ 'i'
3302
+ ),
3303
+ lookbehind: true,
3304
+ inside: {
3305
+ 'attr-name': /^[^\s=]+/,
3306
+ 'attr-value': {
3307
+ pattern: /=[\s\S]+/,
3308
+ inside: {
3309
+ 'value': {
3310
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
3311
+ lookbehind: true,
3312
+ alias: [lang, 'language-' + lang],
3313
+ inside: Prism.languages[lang]
3314
+ },
3315
+ 'punctuation': [
3316
+ {
3317
+ pattern: /^=/,
3318
+ alias: 'attr-equals'
3319
+ },
3320
+ /"|'/
3321
+ ]
3322
+ }
3323
+ }
3324
+ }
3325
+ });
3326
+ }
3327
+ });
3328
+
3329
+ Prism.languages.html = Prism.languages.markup;
3330
+ Prism.languages.mathml = Prism.languages.markup;
3331
+ Prism.languages.svg = Prism.languages.markup;
3332
+
3333
+ Prism.languages.xml = Prism.languages.extend('markup', {});
3334
+ Prism.languages.ssml = Prism.languages.xml;
3335
+ Prism.languages.atom = Prism.languages.xml;
3336
+ Prism.languages.rss = Prism.languages.xml;
3337
+
3338
+ Prism.languages.c = Prism.languages.extend('clike', {
3339
+ 'comment': {
3340
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
3341
+ greedy: true
3342
+ },
3343
+ 'string': {
3344
+ // https://en.cppreference.com/w/c/language/string_literal
3345
+ pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
3346
+ greedy: true
3347
+ },
3348
+ 'class-name': {
3349
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
3350
+ lookbehind: true
3351
+ },
3352
+ 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
3353
+ 'function': /\b[a-z_]\w*(?=\s*\()/i,
3354
+ 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
3355
+ 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
3356
+ });
3357
+
3358
+ Prism.languages.insertBefore('c', 'string', {
3359
+ 'char': {
3360
+ // https://en.cppreference.com/w/c/language/character_constant
3361
+ pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
3362
+ greedy: true
3363
+ }
3364
+ });
3365
+
3366
+ Prism.languages.insertBefore('c', 'string', {
3367
+ 'macro': {
3368
+ // allow for multiline macro definitions
3369
+ // spaces after the # character compile fine with gcc
3370
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
3371
+ lookbehind: true,
3372
+ greedy: true,
3373
+ alias: 'property',
3374
+ inside: {
3375
+ 'string': [
3376
+ {
3377
+ // highlight the path of the include statement as a string
3378
+ pattern: /^(#\s*include\s*)<[^>]+>/,
3379
+ lookbehind: true
3380
+ },
3381
+ Prism.languages.c['string']
3382
+ ],
3383
+ 'char': Prism.languages.c['char'],
3384
+ 'comment': Prism.languages.c['comment'],
3385
+ 'macro-name': [
3386
+ {
3387
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
3388
+ lookbehind: true
3389
+ },
3390
+ {
3391
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
3392
+ lookbehind: true,
3393
+ alias: 'function'
3394
+ }
3395
+ ],
3396
+ // highlight macro directives as keywords
3397
+ 'directive': {
3398
+ pattern: /^(#\s*)[a-z]+/,
3399
+ lookbehind: true,
3400
+ alias: 'keyword'
3401
+ },
3402
+ 'directive-hash': /^#/,
3403
+ 'punctuation': /##|\\(?=[\r\n])/,
3404
+ 'expression': {
3405
+ pattern: /\S[\s\S]*/,
3406
+ inside: Prism.languages.c
3407
+ }
3408
+ }
3409
+ }
3410
+ });
3411
+
3412
+ Prism.languages.insertBefore('c', 'function', {
3413
+ // highlight predefined macros as constants
3414
+ 'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
3415
+ });
3416
+
3417
+ delete Prism.languages.c['boolean'];
3418
+
3419
+ (function (Prism) {
3420
+
3421
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
3422
+
3423
+ Prism.languages.css = {
3424
+ 'comment': /\/\*[\s\S]*?\*\//,
3425
+ 'atrule': {
3426
+ pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
3427
+ inside: {
3428
+ 'rule': /^@[\w-]+/,
3429
+ 'selector-function-argument': {
3430
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
3431
+ lookbehind: true,
3432
+ alias: 'selector'
3433
+ },
3434
+ 'keyword': {
3435
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
3436
+ lookbehind: true
3437
+ }
3438
+ // See rest below
3439
+ }
3440
+ },
3441
+ 'url': {
3442
+ // https://drafts.csswg.org/css-values-3/#urls
3443
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
3444
+ greedy: true,
3445
+ inside: {
3446
+ 'function': /^url/i,
3447
+ 'punctuation': /^\(|\)$/,
3448
+ 'string': {
3449
+ pattern: RegExp('^' + string.source + '$'),
3450
+ alias: 'url'
3451
+ }
3452
+ }
3453
+ },
3454
+ 'selector': {
3455
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
3456
+ lookbehind: true
3457
+ },
3458
+ 'string': {
3459
+ pattern: string,
3460
+ greedy: true
3461
+ },
3462
+ 'property': {
3463
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
3464
+ lookbehind: true
3465
+ },
3466
+ 'important': /!important\b/i,
3467
+ 'function': {
3468
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
3469
+ lookbehind: true
3470
+ },
3471
+ 'punctuation': /[(){};:,]/
3472
+ };
3473
+
3474
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
3475
+
3476
+ var markup = Prism.languages.markup;
3477
+ if (markup) {
3478
+ markup.tag.addInlined('style', 'css');
3479
+ markup.tag.addAttribute('style', 'css');
3480
+ }
3481
+
3482
+ }(Prism));
3483
+
3484
+ (function (Prism) {
3485
+
3486
+ Prism.languages.typescript = Prism.languages.extend('javascript', {
3487
+ 'class-name': {
3488
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
3489
+ lookbehind: true,
3490
+ greedy: true,
3491
+ inside: null // see below
3492
+ },
3493
+ 'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/,
3494
+ });
3495
+
3496
+ // The keywords TypeScript adds to JavaScript
3497
+ Prism.languages.typescript.keyword.push(
3498
+ /\b(?:abstract|declare|is|keyof|readonly|require)\b/,
3499
+ // keywords that have to be followed by an identifier
3500
+ /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
3501
+ // This is for `import type *, {}`
3502
+ /\btype\b(?=\s*(?:[\{*]|$))/
3503
+ );
3504
+
3505
+ // doesn't work with TS because TS is too complex
3506
+ delete Prism.languages.typescript['parameter'];
3507
+ delete Prism.languages.typescript['literal-property'];
3508
+
3509
+ // a version of typescript specifically for highlighting types
3510
+ var typeInside = Prism.languages.extend('typescript', {});
3511
+ delete typeInside['class-name'];
3512
+
3513
+ Prism.languages.typescript['class-name'].inside = typeInside;
3514
+
3515
+ Prism.languages.insertBefore('typescript', 'function', {
3516
+ 'decorator': {
3517
+ pattern: /@[$\w\xA0-\uFFFF]+/,
3518
+ inside: {
3519
+ 'at': {
3520
+ pattern: /^@/,
3521
+ alias: 'operator'
3522
+ },
3523
+ 'function': /^[\s\S]+/
3524
+ }
3525
+ },
3526
+ 'generic-function': {
3527
+ // e.g. foo<T extends "bar" | "baz">( ...
3528
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
3529
+ greedy: true,
3530
+ inside: {
3531
+ 'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
3532
+ 'generic': {
3533
+ pattern: /<[\s\S]+/, // everything after the first <
3534
+ alias: 'class-name',
3535
+ inside: typeInside
3536
+ }
3537
+ }
3538
+ }
3539
+ });
3540
+
3541
+ Prism.languages.ts = Prism.languages.typescript;
3542
+
3543
+ }(Prism));
3544
+
3545
+ (function (Prism) {
3546
+
3547
+ var javascript = Prism.util.clone(Prism.languages.javascript);
3548
+
3549
+ var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
3550
+ var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
3551
+ var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
3552
+
3553
+ /**
3554
+ * @param {string} source
3555
+ * @param {string} [flags]
3556
+ */
3557
+ function re(source, flags) {
3558
+ source = source
3559
+ .replace(/<S>/g, function () { return space; })
3560
+ .replace(/<BRACES>/g, function () { return braces; })
3561
+ .replace(/<SPREAD>/g, function () { return spread; });
3562
+ return RegExp(source, flags);
3563
+ }
3564
+
3565
+ spread = re(spread).source;
3566
+
3567
+
3568
+ Prism.languages.jsx = Prism.languages.extend('markup', javascript);
3569
+ Prism.languages.jsx.tag.pattern = re(
3570
+ /<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
3571
+ );
3572
+
3573
+ Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/;
3574
+ Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
3575
+ Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
3576
+ Prism.languages.jsx.tag.inside['comment'] = javascript['comment'];
3577
+
3578
+ Prism.languages.insertBefore('inside', 'attr-name', {
3579
+ 'spread': {
3580
+ pattern: re(/<SPREAD>/.source),
3581
+ inside: Prism.languages.jsx
3582
+ }
3583
+ }, Prism.languages.jsx.tag);
3584
+
3585
+ Prism.languages.insertBefore('inside', 'special-attr', {
3586
+ 'script': {
3587
+ // Allow for two levels of nesting
3588
+ pattern: re(/=<BRACES>/.source),
3589
+ alias: 'language-javascript',
3590
+ inside: {
3591
+ 'script-punctuation': {
3592
+ pattern: /^=(?=\{)/,
3593
+ alias: 'punctuation'
3594
+ },
3595
+ rest: Prism.languages.jsx
3596
+ },
3597
+ }
3598
+ }, Prism.languages.jsx.tag);
3599
+
3600
+ // The following will handle plain text inside tags
3601
+ var stringifyToken = function (token) {
3602
+ if (!token) {
3603
+ return '';
3604
+ }
3605
+ if (typeof token === 'string') {
3606
+ return token;
3607
+ }
3608
+ if (typeof token.content === 'string') {
3609
+ return token.content;
3610
+ }
3611
+ return token.content.map(stringifyToken).join('');
3612
+ };
3613
+
3614
+ var walkTokens = function (tokens) {
3615
+ var openedTags = [];
3616
+ for (var i = 0; i < tokens.length; i++) {
3617
+ var token = tokens[i];
3618
+ var notTagNorBrace = false;
3619
+
3620
+ if (typeof token !== 'string') {
3621
+ if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
3622
+ // We found a tag, now find its kind
3623
+
3624
+ if (token.content[0].content[0].content === '</') {
3625
+ // Closing tag
3626
+ if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
3627
+ // Pop matching opening tag
3628
+ openedTags.pop();
3629
+ }
3630
+ } else {
3631
+ if (token.content[token.content.length - 1].content === '/>') ; else {
3632
+ // Opening tag
3633
+ openedTags.push({
3634
+ tagName: stringifyToken(token.content[0].content[1]),
3635
+ openedBraces: 0
3636
+ });
3637
+ }
3638
+ }
3639
+ } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
3640
+
3641
+ // Here we might have entered a JSX context inside a tag
3642
+ openedTags[openedTags.length - 1].openedBraces++;
3643
+
3644
+ } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
3645
+
3646
+ // Here we might have left a JSX context inside a tag
3647
+ openedTags[openedTags.length - 1].openedBraces--;
3648
+
3649
+ } else {
3650
+ notTagNorBrace = true;
3651
+ }
3652
+ }
3653
+ if (notTagNorBrace || typeof token === 'string') {
3654
+ if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
3655
+ // Here we are inside a tag, and not inside a JSX context.
3656
+ // That's plain text: drop any tokens matched.
3657
+ var plainText = stringifyToken(token);
3658
+
3659
+ // And merge text with adjacent text
3660
+ if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
3661
+ plainText += stringifyToken(tokens[i + 1]);
3662
+ tokens.splice(i + 1, 1);
3663
+ }
3664
+ if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
3665
+ plainText = stringifyToken(tokens[i - 1]) + plainText;
3666
+ tokens.splice(i - 1, 1);
3667
+ i--;
3668
+ }
3669
+
3670
+ tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
3671
+ }
3672
+ }
3673
+
3674
+ if (token.content && typeof token.content !== 'string') {
3675
+ walkTokens(token.content);
3676
+ }
3677
+ }
3678
+ };
3679
+
3680
+ Prism.hooks.add('after-tokenize', function (env) {
3681
+ if (env.language !== 'jsx' && env.language !== 'tsx') {
3682
+ return;
3683
+ }
3684
+ walkTokens(env.tokens);
3685
+ });
3686
+
3687
+ }(Prism));
3688
+
3689
+ (function (Prism) {
3690
+ var typescript = Prism.util.clone(Prism.languages.typescript);
3691
+ Prism.languages.tsx = Prism.languages.extend('jsx', typescript);
3692
+
3693
+ // doesn't work with TS because TS is too complex
3694
+ delete Prism.languages.tsx['parameter'];
3695
+ delete Prism.languages.tsx['literal-property'];
3696
+
3697
+ // This will prevent collisions between TSX tags and TS generic types.
3698
+ // Idea by https://github.com/karlhorky
3699
+ // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
3700
+ var tag = Prism.languages.tsx.tag;
3701
+ tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
3702
+ tag.lookbehind = true;
3703
+ }(Prism));
3704
+
3705
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3706
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3707
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3708
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3709
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3710
+ };
3711
+ const presetLanguages = Object.values(CodeLanguage);
3712
+ /**
3713
+ * Processing the code content into different types of nodes.
3714
+ */
3715
+ class CodeHighlightParser extends globalSlimmerRegistry.VegaSlimmer {
3716
+ /**
3717
+ * Split the HTML tag to avoid the content render to a html element.
3718
+ *
3719
+ * @example <div> -> ['<', 'div', '>']
3720
+ * @param {string} text - The code content.
3721
+ * @returns {string[]} - The code content array.
3722
+ */
3723
+ splitTag(text) {
3724
+ if (!this.hasSpecialCharacter(text) || text.length < 2) {
3725
+ return [text];
3726
+ }
3727
+ else {
3728
+ const result = [];
3729
+ const textArray = text.split('');
3730
+ let nextIndex = 0;
3731
+ textArray.forEach((item) => {
3732
+ if (item === '<' || item === '>' || item === '/') {
3733
+ result.push(item);
3734
+ nextIndex = result.length;
3735
+ }
3736
+ else {
3737
+ result[nextIndex] = result[nextIndex] ? result[nextIndex] + item : item;
3738
+ }
3739
+ });
3740
+ return result;
3741
+ }
3742
+ }
3743
+ /**
3744
+ * Check the current language is a preset language and the language is not plain text.
3745
+ *
3746
+ * @param {Nullable<string>} language - The input language.
3747
+ * @returns {boolean} - The boolean result.
3748
+ */
3749
+ isHighlightLanguage(language) {
3750
+ return language !== 'plainText' && presetLanguages.includes(language);
3751
+ }
3752
+ /**
3753
+ * Mark the line number class for the first node of each line.
3754
+ *
3755
+ * @param {CodeNodeType[]} codeNodes - The code nodes array.
3756
+ * @returns {CodeNodeType[]} - The code node array with line number tag.
3757
+ */
3758
+ markLineNumberNodes(codeNodes) {
3759
+ if (codeNodes.length === 0) {
3760
+ codeNodes.push({ text: '\n', key: '0', className: '' });
3761
+ }
3762
+ let lineNumber = 0;
3763
+ return codeNodes.map((node, index) => {
3764
+ let className = node.className;
3765
+ if (index === 0 || codeNodes[index - 1].text === '\n') {
3766
+ lineNumber++;
3767
+ className = `v-code-line-number ${node.className}`;
3768
+ }
3769
+ return {
3770
+ text: node.text,
3771
+ key: `${index}`,
3772
+ className,
3773
+ mark: `${lineNumber}`,
3774
+ };
3775
+ });
3776
+ }
3777
+ /**
3778
+ * Check the text has special character.
3779
+ *
3780
+ * @param {string} text - The test text.
3781
+ * @returns {boolean} - Return true is the text has <, > , /.
3782
+ */
3783
+ hasSpecialCharacter(text) {
3784
+ return /[<|>|\\/]/.test(text);
3785
+ }
3786
+ }
3787
+ __decorate$2([
3788
+ globalSlimmerRegistry.MapToComponentField()
3789
+ ], CodeHighlightParser.prototype, "value", void 0);
3790
+
3791
+ /**
3792
+ * Use the plugin Prism to highlight the code content.
3793
+ */
3794
+ class PrismCodeHighlightParseController extends CodeHighlightParser {
3795
+ /**
3796
+ * Return true when the content and language are defined.
3797
+ *
3798
+ * @returns {boolean} - Boolean value.
3799
+ */
3800
+ canParse() {
3801
+ const { code, language } = this.value || { code: '' };
3802
+ return code && language && this.isHighlightLanguage(language);
3803
+ }
3804
+ /**
3805
+ * Use plugin to parse the string code into an array of nodes with different keywords.
3806
+ *
3807
+ * @returns {CodeNodeType[]} - The object contains content and highlight type.
3808
+ */
3809
+ parse() {
3810
+ const { code, language } = this.value;
3811
+ let result = [];
3812
+ const parseLanguage = prism.languages[language];
3813
+ const tokens = prism.tokenize(code, parseLanguage);
3814
+ result = this.getHighlightNodes(tokens);
3815
+ return this.markLineNumberNodes(result);
3816
+ }
3817
+ /**
3818
+ * Parse the plugin parse result to a usable array.
3819
+ *
3820
+ * @param {(string | CodeHighlightToken)[]} tokens - The plugin parse result.
3821
+ * @param {string} [type] - The keywords. Such as variable, function-name, attr-name...
3822
+ * @returns {CodeNodeType[]} - The code node array.
3823
+ */
3824
+ getHighlightNodes(tokens, type) {
3825
+ const nodes = [];
3826
+ for (const token of tokens) {
3827
+ if (typeof token === 'string') {
3828
+ const partials = token.split(/(\n|\t)/);
3829
+ const partialsLength = partials.length;
3830
+ for (let i = 0; i < partialsLength; i++) {
3831
+ const part = partials[i];
3832
+ if (part) {
3833
+ const textArray = this.splitTag(part);
3834
+ nodes.push(...textArray.map((text) => this.createCodeNode(text, type)));
3835
+ }
3836
+ }
3837
+ }
3838
+ else {
3839
+ const { content } = token;
3840
+ if (typeof content === 'string') {
3841
+ nodes.push(...this.getHighlightNodes([content], token.type));
3842
+ }
3843
+ else if (Array.isArray(content)) {
3844
+ nodes.push(...this.getHighlightNodes(content, token.type));
3845
+ }
3846
+ }
3847
+ }
3848
+ return nodes;
3849
+ }
3850
+ /**
3851
+ * Create a CodeNodeType type object by the code content and highlight type.
3852
+ *
3853
+ * @param {string} text - The code content.
3854
+ * @param {string} highlightType - The highlight type.
3855
+ * @returns {CodeNodeType} - The code node object.
3856
+ */
3857
+ createCodeNode(text, highlightType) {
3858
+ return {
3859
+ text,
3860
+ key: '',
3861
+ className: `token ${highlightType || ''}`,
3862
+ mark: '',
3863
+ };
3864
+ }
3865
+ }
3866
+
3867
+ /**
3868
+ * Plain text parse logic.
3869
+ */
3870
+ class DefaultCodeHighlightParseController extends CodeHighlightParser {
3871
+ /**
3872
+ * Default parser will handle if others not catch.
3873
+ *
3874
+ * @returns {boolean} True value.
3875
+ */
3876
+ canParse() {
3877
+ const { code, language } = this.value || { code: '' };
3878
+ return !code || !language || language === 'plainText' || !this.isHighlightLanguage(language);
3879
+ }
3880
+ /**
3881
+ * The default parse will split the html tag and create the line number.
3882
+ *
3883
+ * @returns {CodeNodeType[]} - The code node array.
3884
+ */
3885
+ parse() {
3886
+ var _a, _b;
3887
+ const code = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '';
3888
+ const nodes = code.split(/(\n)/);
3889
+ let result = [];
3890
+ nodes.forEach((item) => {
3891
+ if (item) {
3892
+ const textArray = this.splitTag(item);
3893
+ result.push(...textArray.map((text) => ({ text, key: '', className: '' })));
3894
+ }
3895
+ });
3896
+ result = this.markLineNumberNodes(result);
3897
+ return result;
3898
+ }
3899
+ }
3900
+
3901
+ const codeColorVariableCss = ":root{--code-orange:#cd3e00;--code-green:#007e7e;--code-purple:#6851f5;--code-gray:#67727e;--code-neutral:rgb(15, 36, 51);--code-neutral-8:rgba(15, 36, 51, 0.8);--code-neutral-7:rgba(15, 36, 51, 0.7)}.dark{--code-orange:#ff9571;--code-green:#73e6dc;--code-purple:#c7bdff;--code-gray:#8b959f;--code-neutral:rgb(252, 252, 252);--code-neutral-8:rgba(252, 252, 252, 0.8);--code-neutral-7:rgba(252, 252, 252, 0.7)}";
3902
+
3903
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3904
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3905
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3906
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3907
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3908
+ };
3909
+ /**
3910
+ * The class used to control the code block insert composition text action.
3911
+ */
3912
+ class InsertCompositionTextController extends globalSlimmerRegistry.VegaSlimmer {
3913
+ constructor() {
3914
+ super(...arguments);
3915
+ this.insertCompositionTextEndFlag = true;
3916
+ /**
3917
+ * An event handler function that is triggered when the composition of text input starts. In this case,
3918
+ * it sets the `insertCompositionTextEndFlag` property of the `UserInputController` class to `false`.
3919
+ *
3920
+ * @param {CompositionEvent} e The composition event instance
3921
+ */
3922
+ this.handleCompositionStart = (e) => {
3923
+ this.insertCompositionTextEndFlag = false;
3924
+ this.stopEventPropagation(e);
3925
+ };
3926
+ /**
3927
+ * An event handler function that is triggered when the composition of text input ends. In this case,
3928
+ * it sets the `insertCompositionTextEndFlag` property of the `UserInputController` class to `true`.
3929
+ *
3930
+ * @param {CompositionEvent} e The composition event instance
3931
+ */
3932
+ this.handleCompositionEnd = (e) => {
3933
+ var _a;
3934
+ this.insertCompositionTextEndFlag = true;
3935
+ this.stopEventPropagation(e);
3936
+ const range = this.selectionController.getCurrentRange();
3937
+ if (range) {
3938
+ this.selectionController.setNextCodeBlockRange(range.contentOffset + e.data.length);
3939
+ }
3940
+ const newContent = this.contentRenderer.getCodeContentContainerRef().innerText;
3941
+ this.valueController.updateValue(newContent, (_a = this.value) === null || _a === void 0 ? void 0 : _a.language);
3942
+ };
3943
+ }
3944
+ /**
3945
+ * The method is to get the composition text insert end or not.
3946
+ *
3947
+ * @returns {boolean} The false is mean that insert composition text process is end.
3948
+ */
3949
+ isComposing() {
3950
+ return !this.insertCompositionTextEndFlag;
3951
+ }
3952
+ /**
3953
+ * Stop `beforeinput` and `input` event bubbles to parent element.
3954
+ */
3955
+ registerInputEvent() {
3956
+ const codeContentContainerRef = this.contentRenderer.getCodeContentContainerRef();
3957
+ if (codeContentContainerRef) {
3958
+ codeContentContainerRef.addEventListener('compositionstart', this.handleCompositionStart);
3959
+ codeContentContainerRef.addEventListener('compositionend', this.handleCompositionEnd);
3960
+ }
3961
+ }
3962
+ /**
3963
+ * Remove the event listener.
3964
+ */
3965
+ unregisterEventListener() {
3966
+ const codeContentContainerRef = this.contentRenderer.getCodeContentContainerRef();
3967
+ if (codeContentContainerRef) {
3968
+ codeContentContainerRef.removeEventListener('compositionstart', this.handleCompositionStart);
3969
+ codeContentContainerRef.removeEventListener('compositionend', this.handleCompositionEnd);
3970
+ }
3971
+ }
3972
+ /**
3973
+ * Stop the event bubbles.
3974
+ *
3975
+ * @param {Event} e - The event object.
3976
+ */
3977
+ stopEventPropagation(e) {
3978
+ e.stopPropagation();
3979
+ }
3980
+ }
3981
+ __decorate$1([
3982
+ globalSlimmerRegistry.MapToComponentField()
3983
+ ], InsertCompositionTextController.prototype, "selectionController", void 0);
3984
+ __decorate$1([
3985
+ globalSlimmerRegistry.MapToComponentField()
3986
+ ], InsertCompositionTextController.prototype, "contentRenderer", void 0);
3987
+ __decorate$1([
3988
+ globalSlimmerRegistry.MapToComponentField()
3989
+ ], InsertCompositionTextController.prototype, "valueController", void 0);
3990
+ __decorate$1([
3991
+ globalSlimmerRegistry.MapToComponentField()
3992
+ ], InsertCompositionTextController.prototype, "contentParseController", void 0);
3993
+ __decorate$1([
3994
+ globalSlimmerRegistry.MapToComponentField()
3995
+ ], InsertCompositionTextController.prototype, "value", void 0);
3996
+ __decorate$1([
3997
+ globalSlimmerRegistry.MapToComponentMethod('componentDidLoad')
3998
+ ], InsertCompositionTextController.prototype, "registerInputEvent", null);
3999
+ __decorate$1([
4000
+ globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
4001
+ ], InsertCompositionTextController.prototype, "unregisterEventListener", null);
4002
+
4003
+ const vegaCodeBlockCss = ":host{display:block;border-radius:2px;background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));padding-left:12px;padding-right:12px;padding-top:12px;padding-bottom:12px}:host code{display:block;box-sizing:border-box;color:rgba(var(--v-text-primary, 32, 54, 69, 1));text-align:left;font-family:\"Roboto Mono\";font-weight:400;line-height:22px;font-size:16px;white-space:pre-wrap;min-height:22px;tab-size:2px;word-break:break-word}:host code:focus-visible{outline:none}:host .editor-toolbar{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px;border:1px solid rgba(var(--v-border-divider-secondary, 199, 217, 229, 1));border-top-width:0px;border-left-width:0px;border-right-width:0px;margin-bottom:12px;user-select:none}:host .editor-toolbar vega-input-select{width:auto;min-width:161px}:host(.show-line-number) code .v-code-line-number::before{content:attr(data-mark);width:var(--v-code-line-number-width);margin-left:var(--v-code-line-number-ml);padding-right:16px;text-align:right;user-select:none;font-style:normal;word-break:keep-all;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));display:inline-block}:host(.show-line-number) code{padding-left:var(--v-code-block-pl)}:host::part(select-container){padding-top:0px;padding-bottom:0px;padding-left:8px;padding-right:8px;border-radius:4px}:host::part(selected-box),:host::part(placeholder){font-size:14px;user-select:none}:host::part(toggle-icon-container){width:12px;height:12px;line-height:12px}:host::part(toggle-icon){width:12px;height:12px}:host(.readonly) .copy-button-container{position:relative}:host(.readonly) .copy-button-container .copy-code-button{position:absolute;top:0px;right:0px}:host(.disabled:not(.highlight)) code{color:rgba(var(--v-text-input-disabled, 107, 116, 125, 1))}:host(.disabled.highlight){opacity:0.5}:host(.focus:not(.disabled,.readonly)){outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}:host(.highlight) code{color:var(--code-neutral)}code .comment,code .prolog,code .doctype,code .cdata{color:var(--code-gray);font-style:italic}code .namespace{color:var(--code-neutral-7)}code .string,code .attr-value,code .builtin{color:var(--code-green)}code .punctuation,code .operator,code .attr-equals{color:var(--code-gray)}code .entity,code .url,code .symbol,code .number,code .boolean,code .variable,code .constant,code .property,code .regex,code .inserted{color:var(--code-neutral-8)}code .atrule,code .function,code .attr-name{color:var(--code-orange)}code .deleted{color:var(--code-neutral)}code .function-variable{color:#ff0000}code .tag,code .selector,code .keyword{color:var(--code-purple)}";
4004
+
4005
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
4006
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4007
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4008
+ r = Reflect.decorate(decorators, target, key, desc);
4009
+ else
4010
+ for (var i = decorators.length - 1; i >= 0; i--)
4011
+ if (d = decorators[i])
4012
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4013
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4014
+ };
4015
+ const VegaCodeBlock = class {
4016
+ constructor(hostRef) {
4017
+ index.registerInstance(this, hostRef);
4018
+ this.vegaChange = index.createEvent(this, "vegaChange", 7);
4019
+ this.change = index.createEvent(this, "change", 7);
4020
+ this.vegaRemove = index.createEvent(this, "vegaRemove", 7);
4021
+ this.remove = index.createEvent(this, "remove", 7);
4022
+ this.globalSlimmers = {};
4023
+ //TODO: The global style should be removed after the code color change to the color token.
4024
+ this.componentGlobalStyleSlimmer = new componentGlobalStyleSlimmer.ComponentGlobalStyleSlimmer(codeColorVariableCss);
4025
+ this.translationSlimmer = new translationSlimmer.TranslationSlimmer();
4026
+ this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer();
4027
+ this.codeBlockRenderer = new VegaCodeBlockRenderer();
4028
+ this.contentRenderer = new VegaCodeBlockContentRenderer();
4029
+ this.copyButtonRenderer = new VegaCodeBlockCopyButtonRenderer();
4030
+ this.valueController = new VegaCodeBlockValueController();
4031
+ this.contentParseController = new CodeContentParseController();
4032
+ this.prismCodeHighlightParser = new PrismCodeHighlightParseController();
4033
+ this.defaultCodeHighlightParser = new DefaultCodeHighlightParseController();
4034
+ this.selectionController = new VegaCodeBlockSelectionController();
4035
+ this.inputController = new CodeBlockInputController();
4036
+ this.insertCompositionTextController = new InsertCompositionTextController();
4037
+ this.focusController = new VegaCodeBlockFocusController();
4038
+ this.changeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaCodeBlock, domNodeSubjectFactory.VegaChange);
4039
+ this.removeEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaCodeBlock, domNodeSubjectFactory.VegaRemove);
4040
+ this.eventPreventSlimmer = new childNodesEventPreventSlimmer.ChildNodesEventPreventSlimmer([domNodeSubjectFactory.VegaChange], () => this.codeBlockRenderer.getToolbarContainerRef());
4041
+ /**
4042
+ * Specifies whether the code block editor is in read-only mode.
4043
+ *
4044
+ * @vegaVersion 2.50.0
4045
+ */
4046
+ this.readOnly = false;
4047
+ /**
4048
+ * Specifies whether the code block editor is disabled.
4049
+ *
4050
+ * @vegaVersion 2.50.0
4051
+ */
4052
+ this.disabled = false;
4053
+ /**
4054
+ * Specifies whether to display the copy button in the code block.
4055
+ *
4056
+ * @vegaVersion 2.50.0
4057
+ */
4058
+ this.showCopyButton = true;
4059
+ /**
4060
+ * Specifies whether to display the code line number in the code block.
4061
+ *
4062
+ * @vegaVersion 2.50.0
4063
+ */
4064
+ this.showLineNumber = true;
4065
+ }
4066
+ watchEditableChange() {
4067
+ }
4068
+ /**
4069
+ * Check the props value to avoid unnecessary updates.
4070
+ *
4071
+ * @param {unknown} newValue - The new props value.
4072
+ * @param {unknown} oldValue - The old props value.
4073
+ * @param {string} name - The property name.
4074
+ * @returns {boolean} Return false to skip the current update flow.
4075
+ */
4076
+ componentShouldUpdate(newValue, oldValue, name) {
4077
+ if (name === 'value' && object.deepEqual(newValue, oldValue)) {
4078
+ return false;
4079
+ }
4080
+ return true;
4081
+ }
4082
+ /**
4083
+ * Invoke this method to focus the current code block.
4084
+ *
4085
+ * @vegaVersion 2.50.0
4086
+ */
4087
+ async doFocus() {
4088
+ }
4089
+ render() {
4090
+ const classNames = ui.arrayToClassString([
4091
+ this.readOnly ? 'readonly' : '',
4092
+ this.disabled ? 'disabled' : '',
4093
+ this.showLineNumber ? 'show-line-number' : '',
4094
+ this.prismCodeHighlightParser.canParse() ? 'highlight' : '',
4095
+ ]);
4096
+ return component.sanitizeVegaComponent(index.h(index.Host, { contenteditable: false, class: classNames }, this.codeBlockRenderer.render()), this.host);
4097
+ }
4098
+ get host() { return index.getElement(this); }
4099
+ static get watchers() { return {
4100
+ "readOnly": ["watchEditableChange"],
4101
+ "disabled": ["watchEditableChange"]
4102
+ }; }
4103
+ };
4104
+ __decorate([
4105
+ componentUsageRuntimeMetrics.InjectVegaGlobalSlimmer()
4106
+ ], VegaCodeBlock.prototype, "globalSlimmers", void 0);
4107
+ __decorate([
4108
+ globalSlimmerRegistry.InjectVegaSlimmer()
4109
+ ], VegaCodeBlock.prototype, "componentGlobalStyleSlimmer", void 0);
4110
+ __decorate([
4111
+ globalSlimmerRegistry.InjectVegaSlimmer()
4112
+ ], VegaCodeBlock.prototype, "translationSlimmer", void 0);
4113
+ __decorate([
4114
+ globalSlimmerRegistry.InjectVegaSlimmer()
4115
+ ], VegaCodeBlock.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
4116
+ __decorate([
4117
+ globalSlimmerRegistry.InjectVegaSlimmer()
4118
+ ], VegaCodeBlock.prototype, "codeBlockRenderer", void 0);
4119
+ __decorate([
4120
+ globalSlimmerRegistry.InjectVegaSlimmer()
4121
+ ], VegaCodeBlock.prototype, "contentRenderer", void 0);
4122
+ __decorate([
4123
+ globalSlimmerRegistry.InjectVegaSlimmer()
4124
+ ], VegaCodeBlock.prototype, "copyButtonRenderer", void 0);
4125
+ __decorate([
4126
+ globalSlimmerRegistry.InjectVegaSlimmer()
4127
+ ], VegaCodeBlock.prototype, "valueController", void 0);
4128
+ __decorate([
4129
+ globalSlimmerRegistry.InjectVegaSlimmer()
4130
+ ], VegaCodeBlock.prototype, "contentParseController", void 0);
4131
+ __decorate([
4132
+ globalSlimmerRegistry.InjectVegaSlimmer()
4133
+ ], VegaCodeBlock.prototype, "prismCodeHighlightParser", void 0);
4134
+ __decorate([
4135
+ globalSlimmerRegistry.InjectVegaSlimmer()
4136
+ ], VegaCodeBlock.prototype, "defaultCodeHighlightParser", void 0);
4137
+ __decorate([
4138
+ globalSlimmerRegistry.InjectVegaSlimmer()
4139
+ ], VegaCodeBlock.prototype, "selectionController", void 0);
4140
+ __decorate([
4141
+ globalSlimmerRegistry.InjectVegaSlimmer()
4142
+ ], VegaCodeBlock.prototype, "inputController", void 0);
4143
+ __decorate([
4144
+ globalSlimmerRegistry.InjectVegaSlimmer()
4145
+ ], VegaCodeBlock.prototype, "insertCompositionTextController", void 0);
4146
+ __decorate([
4147
+ globalSlimmerRegistry.InjectVegaSlimmer()
4148
+ ], VegaCodeBlock.prototype, "focusController", void 0);
4149
+ __decorate([
4150
+ globalSlimmerRegistry.InjectVegaSlimmer()
4151
+ ], VegaCodeBlock.prototype, "changeEventEmitter", void 0);
4152
+ __decorate([
4153
+ globalSlimmerRegistry.InjectVegaSlimmer()
4154
+ ], VegaCodeBlock.prototype, "removeEventEmitter", void 0);
4155
+ __decorate([
4156
+ globalSlimmerRegistry.InjectVegaSlimmer()
4157
+ ], VegaCodeBlock.prototype, "eventPreventSlimmer", void 0);
4158
+ VegaCodeBlock.style = vegaCodeBlockCss;
4159
+
4160
+ exports.vega_code_block = VegaCodeBlock;