@vc-shell/framework 1.1.44 → 1.1.46

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 (453) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/core/plugins/modularity/loader.ts +150 -74
  3. package/core/services/app-bar-mobile-buttons-service.ts +1 -1
  4. package/dist/core/plugins/modularity/loader.d.ts.map +1 -1
  5. package/dist/core/services/app-bar-mobile-buttons-service.d.ts +1 -1
  6. package/dist/core/services/app-bar-mobile-buttons-service.d.ts.map +1 -1
  7. package/dist/framework.js +33355 -295
  8. package/dist/index.css +1 -9
  9. package/dist/index.d.ts +0 -4
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/locales/de.json +0 -84
  12. package/dist/locales/en.json +0 -84
  13. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue.d.ts.map +1 -1
  14. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts +1 -1
  15. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts.map +1 -1
  16. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/internal/bladeRouteResolver.d.ts.map +1 -1
  17. package/dist/shared/components/change-password-button/change-password-button.vue.d.ts.map +1 -1
  18. package/dist/shared/components/logout-button/logout-button.vue.d.ts.map +1 -1
  19. package/dist/shared/components/settings-menu-item/settings-menu-item.vue.d.ts.map +1 -1
  20. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  21. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +6 -6
  22. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/dist/ui/components/atoms/vc-hint/vc-hint.vue.d.ts.map +1 -1
  25. package/dist/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue.d.ts.map +1 -1
  26. package/dist/ui/components/atoms/vc-icon/icons/index.d.ts +0 -26
  27. package/dist/ui/components/atoms/vc-icon/icons/index.d.ts.map +1 -1
  28. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts.map +1 -1
  29. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts.map +1 -1
  30. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  31. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts +0 -5
  32. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
  33. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts +0 -20
  34. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
  35. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
  36. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +36 -0
  37. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts.map +1 -0
  38. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts +17 -0
  39. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts.map +1 -0
  40. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +16 -2381
  41. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  42. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
  43. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
  44. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  45. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +1 -1
  46. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  47. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue.d.ts.map +1 -1
  48. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  49. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
  50. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  51. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
  52. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue.d.ts.map +1 -1
  53. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue.d.ts.map +1 -1
  54. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  55. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  56. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +2 -2
  57. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
  58. package/dist/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue.d.ts.map +1 -1
  59. package/dist/vendor-boolbase-Cp9L0GAZ.js +25 -0
  60. package/dist/vendor-cheerio-HN9zIPZn.js +3135 -0
  61. package/dist/vendor-cheerio-select-5Ry0HvBq.js +306 -0
  62. package/dist/vendor-core-js-l0sNRNKZ.js +1 -0
  63. package/dist/vendor-css-select-DRIZ9kfZ.js +966 -0
  64. package/dist/vendor-css-what-DuPJ1HEF.js +448 -0
  65. package/dist/vendor-cypress-signalr-mock-BKdBJpdt.js +778 -0
  66. package/dist/vendor-date-fns-515YWkk-.js +6724 -0
  67. package/dist/vendor-dom-serializer-nQMsqjYW.js +286 -0
  68. package/dist/vendor-dom7-CJLPMwy5.js +941 -0
  69. package/dist/vendor-domelementtype-CjSzQey5.js +53 -0
  70. package/dist/vendor-domhandler-9z8cS16a.js +484 -0
  71. package/dist/vendor-dompurify-CRFzu7ib.js +1336 -0
  72. package/dist/vendor-domutils-Bc-Opz-v.js +981 -0
  73. package/dist/vendor-entities-Bfsx4xOQ.js +636 -0
  74. package/dist/vendor-floating-ui-core-wV8u8QP4.js +511 -0
  75. package/dist/vendor-floating-ui-dom-DDnRPs17.js +706 -0
  76. package/dist/vendor-floating-ui-utils-OMIFy1QU.js +296 -0
  77. package/dist/vendor-floating-ui-vue-D-tCDAMm.js +167 -0
  78. package/dist/vendor-fontsource-plus-jakarta-sans.css +1 -0
  79. package/dist/vendor-headlessui-vue-CY9FRgTb.js +83 -0
  80. package/dist/vendor-htmlparser2-B1dhFPOs.js +1426 -0
  81. package/dist/vendor-iconify-vue-DfRGgyNu.js +1840 -0
  82. package/dist/vendor-intlify-core-base-BuknsFQe.js +1876 -0
  83. package/dist/vendor-intlify-message-compiler-CuOQDWx1.js +1508 -0
  84. package/dist/vendor-intlify-shared-Cz4YRMuC.js +241 -0
  85. package/dist/vendor-iso-639-1-BJCk9DvE.js +819 -0
  86. package/dist/vendor-linkify-it-CKUf4vsc.js +830 -0
  87. package/dist/vendor-linkifyjs-BfyGgbCh.js +1756 -0
  88. package/dist/vendor-lodash-es-BySUOlwf.js +18333 -0
  89. package/dist/vendor-markdown-it-D-apazHa.js +6000 -0
  90. package/dist/vendor-markdown-it-task-lists-rxMVH6Ku.js +131 -0
  91. package/dist/vendor-mdurl-BNh2CCgT.js +537 -0
  92. package/dist/vendor-microsoft-applicationinsights-analytics-js-kG3lLg8X.js +1275 -0
  93. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-C0uQkiQq.js +591 -0
  94. package/dist/vendor-microsoft-applicationinsights-channel-js-Dyd_PXA3.js +2153 -0
  95. package/dist/vendor-microsoft-applicationinsights-common-CfmP1_Qr.js +2470 -0
  96. package/dist/vendor-microsoft-applicationinsights-core-js-Cq4YSEvZ.js +6589 -0
  97. package/dist/vendor-microsoft-applicationinsights-dependencies-js-C56OBFr4.js +1510 -0
  98. package/dist/vendor-microsoft-applicationinsights-properties-js-CBJTBawx.js +761 -0
  99. package/dist/vendor-microsoft-applicationinsights-shims-CX8sJgar.js +70 -0
  100. package/dist/vendor-microsoft-applicationinsights-web-pim2ri-g.js +667 -0
  101. package/dist/vendor-microsoft-dynamicproto-js-CFBBUu9p.js +520 -0
  102. package/dist/vendor-microsoft-signalr-dUnlRsGm.js +3339 -0
  103. package/dist/vendor-moment-Mki5YqAR.js +5679 -0
  104. package/dist/vendor-nevware21-ts-async-CLMApQ9E.js +395 -0
  105. package/dist/vendor-nevware21-ts-utils-e8v8Jty3.js +1160 -0
  106. package/dist/vendor-normalize-css.css +1 -0
  107. package/dist/vendor-nth-check-Bx8TxtJt.js +157 -0
  108. package/dist/vendor-orderedmap-dGG6uMFJ.js +137 -0
  109. package/dist/vendor-parse5-Bt2NhSzR.js +8432 -0
  110. package/dist/vendor-parse5-htmlparser2-tree-adapter-BUUtKzf8.js +216 -0
  111. package/dist/vendor-popperjs-core-Cr2byIky.js +1790 -0
  112. package/dist/vendor-prettier-B4PaeWRQ.js +98 -0
  113. package/dist/vendor-prosemirror-commands-BH9lWGpW.js +561 -0
  114. package/dist/vendor-prosemirror-dropcursor-CeyPcxrA.js +146 -0
  115. package/dist/vendor-prosemirror-gapcursor-U8UoUJII.js +236 -0
  116. package/dist/vendor-prosemirror-history-BDaJkvNx.js +414 -0
  117. package/dist/vendor-prosemirror-keymap-BbWvIWmH.js +128 -0
  118. package/dist/vendor-prosemirror-markdown-gB0PXBbz.js +866 -0
  119. package/dist/vendor-prosemirror-model-BZu3WVcD.js +3463 -0
  120. package/dist/vendor-prosemirror-schema-list-Bl9NpKA7.js +158 -0
  121. package/dist/vendor-prosemirror-state-BvL9Pxph.js +1003 -0
  122. package/dist/vendor-prosemirror-tables-17qAnviK.js +2159 -0
  123. package/dist/vendor-prosemirror-transform-CE9VV3qg.js +2156 -0
  124. package/dist/vendor-prosemirror-view-CU2WTHT7.js +5811 -0
  125. package/dist/vendor-punycode-js-iAs5RxMf.js +441 -0
  126. package/dist/vendor-rope-sequence-BdXDKoGt.js +207 -0
  127. package/dist/vendor-semver-CVLMK-S4.js +2702 -0
  128. package/dist/vendor-ssr-window-s6OpKa3O.js +150 -0
  129. package/dist/vendor-swiper-CdiyNHVt.js +5679 -0
  130. package/dist/vendor-swiper.css +1 -0
  131. package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +1 -0
  132. package/dist/vendor-tanstack-vue-virtual-l0sNRNKZ.js +1 -0
  133. package/dist/vendor-tippy-js-DWFe2TfK.js +1647 -0
  134. package/dist/vendor-tiptap-core-NfwGfaQk.js +4910 -0
  135. package/dist/vendor-tiptap-extension-blockquote-jmWBTtsI.js +57 -0
  136. package/dist/vendor-tiptap-extension-bold-p5frh4ak.js +97 -0
  137. package/dist/vendor-tiptap-extension-bubble-menu-KUhZSfrs.js +218 -0
  138. package/dist/vendor-tiptap-extension-bullet-list-COmZRoSB.js +73 -0
  139. package/dist/vendor-tiptap-extension-code-block-DyTARZss.js +221 -0
  140. package/dist/vendor-tiptap-extension-code-jVv6CXpX.js +75 -0
  141. package/dist/vendor-tiptap-extension-document-DssuotYs.js +13 -0
  142. package/dist/vendor-tiptap-extension-dropcursor-BoO0Qv91.js +26 -0
  143. package/dist/vendor-tiptap-extension-floating-menu-CrO8CN5w.js +165 -0
  144. package/dist/vendor-tiptap-extension-gapcursor-KpsWEoMD.js +30 -0
  145. package/dist/vendor-tiptap-extension-hard-break-ldOzhSvf.js +68 -0
  146. package/dist/vendor-tiptap-extension-heading-CKz2llX0.js +77 -0
  147. package/dist/vendor-tiptap-extension-history-DeKZ2VQ9.js +48 -0
  148. package/dist/vendor-tiptap-extension-horizontal-rule-CAjWRyDS.js +92 -0
  149. package/dist/vendor-tiptap-extension-image-ZagcEYuk.js +76 -0
  150. package/dist/vendor-tiptap-extension-italic-CM4xdznY.js +96 -0
  151. package/dist/vendor-tiptap-extension-link-Z-AMC4Ri.js +414 -0
  152. package/dist/vendor-tiptap-extension-list-item-BJi5QpXc.js +37 -0
  153. package/dist/vendor-tiptap-extension-ordered-list-C_TMrfBE.js +97 -0
  154. package/dist/vendor-tiptap-extension-paragraph-CQw0E0Au.js +39 -0
  155. package/dist/vendor-tiptap-extension-placeholder-BBNVKfa_.js +66 -0
  156. package/dist/vendor-tiptap-extension-strike-DUyMYX1Z.js +79 -0
  157. package/dist/vendor-tiptap-extension-table-cell-CoDIMPA5.js +47 -0
  158. package/dist/vendor-tiptap-extension-table-header-DvbGHnmw.js +47 -0
  159. package/dist/vendor-tiptap-extension-table-row-D1uqN5Aj.js +26 -0
  160. package/dist/vendor-tiptap-extension-table-tKS4MOM4.js +354 -0
  161. package/dist/vendor-tiptap-extension-text-DtRBhKB2.js +12 -0
  162. package/dist/vendor-tiptap-extension-underline-DqaSFp_P.js +50 -0
  163. package/dist/vendor-tiptap-markdown-7-PCADTU.js +1017 -0
  164. package/dist/vendor-tiptap-pm-l0sNRNKZ.js +1 -0
  165. package/dist/vendor-tiptap-starter-kit-CDSV_Zuu.js +88 -0
  166. package/dist/vendor-tiptap-vue-3-DZg2fjq_.js +268 -0
  167. package/dist/vendor-truncate-html-3qQY0Djo.js +196 -0
  168. package/dist/vendor-uc-micro-jjt6LQ65.js +23 -0
  169. package/dist/vendor-vee-validate-i18n-v_gHjRmD.js +154 -0
  170. package/dist/vendor-vee-validate-rules-DzV3VY3N.js +536 -0
  171. package/dist/vendor-vue-currency-input-DGAkEFBO.js +545 -0
  172. package/dist/vendor-vue-demi-l0sNRNKZ.js +1 -0
  173. package/dist/vendor-vue-devtools-api-DXYR8qBG.js +169 -0
  174. package/dist/vendor-vue-i18n-Co752uk3.js +1897 -0
  175. package/dist/vendor-vue3-application-insights-CYWFCr_J.js +119 -0
  176. package/dist/vendor-vue3-touch-events-BJEAiSa3.js +416 -0
  177. package/dist/vendor-vuepic-vue-datepicker-BSWXRSiu.js +5019 -0
  178. package/dist/vendor-vuepic-vue-datepicker.css +1 -0
  179. package/dist/vendor-vueuse-components-l1bL12mE.js +339 -0
  180. package/dist/vendor-vueuse-core-DGcJOmwG.js +7743 -0
  181. package/dist/vendor-vueuse-shared-_mOXsFuM.js +1568 -0
  182. package/dist/vendor-w3c-keyname-BOm2dtJm.js +121 -0
  183. package/package.json +22 -11
  184. package/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue +3 -3
  185. package/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.ts +2 -1
  186. package/shared/components/blade-navigation/composables/useBladeNavigation/internal/bladeRouteResolver.ts +1 -0
  187. package/shared/components/change-password-button/change-password-button.vue +1 -2
  188. package/shared/components/logout-button/logout-button.vue +1 -2
  189. package/shared/components/notifications/components/notification-container/index.ts +1 -1
  190. package/shared/components/notifications/core/notification.ts +1 -1
  191. package/shared/components/settings-menu-item/settings-menu-item.vue +1 -0
  192. package/shared/components/sidebar/sidebar.vue +2 -2
  193. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +2 -1
  194. package/ui/components/atoms/vc-hint/vc-hint.vue +2 -0
  195. package/ui/components/atoms/vc-icon/composables/use-icon.ts +1 -1
  196. package/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue +18 -14
  197. package/ui/components/atoms/vc-icon/icons/index.ts +1 -27
  198. package/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue +7 -11
  199. package/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue +37 -31
  200. package/ui/components/atoms/vc-icon/vc-icon-examples.vue +1 -1
  201. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +4 -5
  202. package/ui/components/atoms/vc-icon/vc-icon.vue +43 -186
  203. package/ui/components/atoms/vc-icon/vc-lucide-icon.vue +22 -70
  204. package/ui/components/atoms/vc-icon/vc-material-icon.vue +28 -59
  205. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +2 -3
  206. package/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue +103 -0
  207. package/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue +252 -0
  208. package/ui/components/molecules/vc-editor/vc-editor.stories.ts +1 -4
  209. package/ui/components/molecules/vc-editor/vc-editor.vue +666 -360
  210. package/ui/components/molecules/vc-form/vc-form.vue +7 -5
  211. package/ui/components/molecules/vc-input/vc-input.vue +1 -1
  212. package/ui/components/molecules/vc-pagination/vc-pagination.vue +4 -17
  213. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarMobileActions.vue +1 -1
  214. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue +1 -3
  215. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -4
  216. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +1 -3
  217. package/ui/components/organisms/vc-app/vc-app.backupsb.ts +214 -214
  218. package/ui/components/organisms/vc-app/vc-app.vue +3 -5
  219. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +3 -10
  220. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/mobile/vc-blade-toolbar-mobile.vue +1 -1
  221. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue +2 -2
  222. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue +2 -2
  223. package/ui/components/organisms/vc-blade/vc-blade.vue +4 -5
  224. package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +1 -3
  225. package/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue +1 -2
  226. package/ui/components/organisms/vc-table/composables/useTableState.ts +5 -5
  227. package/dist/apl-B2DGVGxc.js +0 -76
  228. package/dist/asciiarmor-2LVJmxlE.js +0 -34
  229. package/dist/asn1-jKiBa2Ya.js +0 -95
  230. package/dist/asterisk-DS281yxp.js +0 -271
  231. package/dist/brainfuck-C_p9pTT8.js +0 -34
  232. package/dist/clike-DGTaUp48.js +0 -620
  233. package/dist/clojure-CCKyeQKf.js +0 -800
  234. package/dist/cmake-CuaCgAKt.js +0 -28
  235. package/dist/cobol-BlTKFDRj.js +0 -72
  236. package/dist/coffeescript-BVCvwO8I.js +0 -179
  237. package/dist/commonlisp-D_kxz07b.js +0 -75
  238. package/dist/crystal-D309uH6_.js +0 -217
  239. package/dist/css-BkF-NPzE.js +0 -1553
  240. package/dist/cypher-BMq4Fwjl.js +0 -68
  241. package/dist/d-BZcgY6La.js +0 -127
  242. package/dist/diff-Cg9d_RX2.js +0 -18
  243. package/dist/dockerfile-DIy8NleC.js +0 -194
  244. package/dist/dtd-CtLokQ-U.js +0 -84
  245. package/dist/dylan-QYeExnWK.js +0 -234
  246. package/dist/ebnf-DUPDuY4r.js +0 -78
  247. package/dist/ecl-CiXN-g_D.js +0 -121
  248. package/dist/eiffel-yQhjl4T1.js +0 -110
  249. package/dist/elm-CNT9vbN0.js +0 -108
  250. package/dist/erlang-CFOYdy9e.js +0 -487
  251. package/dist/factor-DDOC7X6P.js +0 -65
  252. package/dist/fcl-CPC2WYrI.js +0 -103
  253. package/dist/forth-BmxRyE9S.js +0 -60
  254. package/dist/fortran-9bvPyrOW.js +0 -442
  255. package/dist/gas-cpmYfFX2.js +0 -183
  256. package/dist/gherkin-CJuwpceU.js +0 -34
  257. package/dist/groovy-DZeT_VM-.js +0 -146
  258. package/dist/haskell-Bvt3Qq1t.js +0 -375
  259. package/dist/haxe-70NVW1pR.js +0 -359
  260. package/dist/http-D9LttvKF.js +0 -44
  261. package/dist/idl-B6TRFYjl.js +0 -947
  262. package/dist/index-4DWvmoYg.js +0 -71
  263. package/dist/index-52o7mJaX.js +0 -156
  264. package/dist/index-B0KatioT.js +0 -98
  265. package/dist/index-BP3W8zuk.js +0 -268
  266. package/dist/index-BykT5L1A.js +0 -148134
  267. package/dist/index-CfXo9hsG.js +0 -75
  268. package/dist/index-Ch37pBUt.js +0 -308
  269. package/dist/index-D2KGkAYT.js +0 -93
  270. package/dist/index-D83zQom_.js +0 -58
  271. package/dist/index-DuQrVLbu.js +0 -134
  272. package/dist/index-_fdMid5h.js +0 -288
  273. package/dist/index-a1wO-owY.js +0 -545
  274. package/dist/index-crMpNSFe.js +0 -611
  275. package/dist/index-dmBRpHHY.js +0 -137
  276. package/dist/index-kBdB14Fz.js +0 -341
  277. package/dist/index-uBhy41le.js +0 -249
  278. package/dist/index-zZrijNsr.js +0 -299
  279. package/dist/javascript-C2yteZeJ.js +0 -691
  280. package/dist/jinja2-DnB6dQmV.js +0 -154
  281. package/dist/julia-DpvXAuO6.js +0 -241
  282. package/dist/livescript-CanGTf8u.js +0 -272
  283. package/dist/lua-XplVlWi_.js +0 -217
  284. package/dist/mathematica-jaRHnSxC.js +0 -35
  285. package/dist/mbox-BctzC1hL.js +0 -76
  286. package/dist/mirc-CFBPAOaF.js +0 -72
  287. package/dist/mllike-BSnXJBGA.js +0 -272
  288. package/dist/modelica-vUgVs--1.js +0 -93
  289. package/dist/mscgen-Cpl0NYLN.js +0 -104
  290. package/dist/mumps-CQoS1kWX.js +0 -25
  291. package/dist/nginx-zDPm3Z74.js +0 -89
  292. package/dist/nsis-fePjrhq7.js +0 -62
  293. package/dist/ntriples-CsNjv2QF.js +0 -79
  294. package/dist/octave-C8PmmSRH.js +0 -143
  295. package/dist/oz-Ce8aN8oE.js +0 -151
  296. package/dist/pascal-De0D6mP7.js +0 -77
  297. package/dist/perl-B4bSCe1C.js +0 -915
  298. package/dist/pig-D24Z8EXi.js +0 -54
  299. package/dist/powershell-DkYVfTzP.js +0 -249
  300. package/dist/properties-Dn9wna3M.js +0 -26
  301. package/dist/protobuf-BPIjwpzm.js +0 -49
  302. package/dist/pug-CwAQJzGR.js +0 -248
  303. package/dist/puppet-nyd4dhjf.js +0 -45
  304. package/dist/python-BkR3uSy8.js +0 -313
  305. package/dist/q-DXjKs-tC.js +0 -83
  306. package/dist/r-LKEuhEGI.js +0 -104
  307. package/dist/rpm-IznJm2Xc.js +0 -57
  308. package/dist/ruby-CcYfvIk6.js +0 -228
  309. package/dist/sas-7E8yHoCW.js +0 -105
  310. package/dist/scheme-DjibxsNh.js +0 -124
  311. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +0 -113
  312. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +0 -1
  313. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +0 -3
  314. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +0 -1
  315. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +0 -102
  316. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +0 -1
  317. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +0 -4
  318. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +0 -1
  319. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +0 -3
  320. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +0 -1
  321. package/dist/shell-C0C2sNA_.js +0 -182
  322. package/dist/sieve-Bwz7vjP5.js +0 -72
  323. package/dist/simple-mode-B0dvCdAA.js +0 -89
  324. package/dist/smalltalk-Bhddl2pB.js +0 -48
  325. package/dist/solr-BNlsLglM.js +0 -41
  326. package/dist/sparql-FarWu_Gb.js +0 -197
  327. package/dist/spreadsheet-C-cy4P5N.js +0 -49
  328. package/dist/sql-CfG5lQ3l.js +0 -282
  329. package/dist/stex-Du4h4KAU.js +0 -129
  330. package/dist/stylus-CAdqWld3.js +0 -250
  331. package/dist/swift-DSxqR9R6.js +0 -230
  332. package/dist/tcl-xfoLljhY.js +0 -81
  333. package/dist/textile-D1AWE-pc.js +0 -295
  334. package/dist/tiddlywiki-5wqsXtSk.js +0 -155
  335. package/dist/tiki-__Kn3CeS.js +0 -181
  336. package/dist/toml-BHiuTcfn.js +0 -49
  337. package/dist/troff-D2UO-fKf.js +0 -35
  338. package/dist/ttcn-Bsa4sfRm.js +0 -123
  339. package/dist/ttcn-cfg-Bac_acMi.js +0 -88
  340. package/dist/turtle-xwJUxoPV.js +0 -80
  341. package/dist/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue.d.ts +0 -7
  342. package/dist/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue.d.ts.map +0 -1
  343. package/dist/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue.d.ts +0 -7
  344. package/dist/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue.d.ts.map +0 -1
  345. package/dist/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue.d.ts +0 -7
  346. package/dist/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue.d.ts.map +0 -1
  347. package/dist/ui/components/atoms/vc-icon/icons/BellIcon.vue.d.ts +0 -7
  348. package/dist/ui/components/atoms/vc-icon/icons/BellIcon.vue.d.ts.map +0 -1
  349. package/dist/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue.d.ts +0 -7
  350. package/dist/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue.d.ts.map +0 -1
  351. package/dist/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue.d.ts +0 -7
  352. package/dist/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue.d.ts.map +0 -1
  353. package/dist/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue.d.ts +0 -7
  354. package/dist/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue.d.ts.map +0 -1
  355. package/dist/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue.d.ts +0 -7
  356. package/dist/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue.d.ts.map +0 -1
  357. package/dist/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue.d.ts +0 -7
  358. package/dist/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue.d.ts.map +0 -1
  359. package/dist/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue.d.ts +0 -7
  360. package/dist/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue.d.ts.map +0 -1
  361. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue.d.ts +0 -7
  362. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue.d.ts.map +0 -1
  363. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue.d.ts +0 -7
  364. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue.d.ts.map +0 -1
  365. package/dist/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue.d.ts +0 -7
  366. package/dist/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue.d.ts.map +0 -1
  367. package/dist/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue.d.ts +0 -7
  368. package/dist/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue.d.ts.map +0 -1
  369. package/dist/ui/components/atoms/vc-icon/icons/LogoutIcon.vue.d.ts +0 -7
  370. package/dist/ui/components/atoms/vc-icon/icons/LogoutIcon.vue.d.ts.map +0 -1
  371. package/dist/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue.d.ts +0 -7
  372. package/dist/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue.d.ts.map +0 -1
  373. package/dist/ui/components/atoms/vc-icon/icons/OffersIcon.vue.d.ts +0 -7
  374. package/dist/ui/components/atoms/vc-icon/icons/OffersIcon.vue.d.ts.map +0 -1
  375. package/dist/ui/components/atoms/vc-icon/icons/OrdersIcon.vue.d.ts +0 -7
  376. package/dist/ui/components/atoms/vc-icon/icons/OrdersIcon.vue.d.ts.map +0 -1
  377. package/dist/ui/components/atoms/vc-icon/icons/PeopleIcon.vue.d.ts +0 -7
  378. package/dist/ui/components/atoms/vc-icon/icons/PeopleIcon.vue.d.ts.map +0 -1
  379. package/dist/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue.d.ts +0 -7
  380. package/dist/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue.d.ts.map +0 -1
  381. package/dist/ui/components/atoms/vc-icon/icons/ProductsIcon.vue.d.ts +0 -7
  382. package/dist/ui/components/atoms/vc-icon/icons/ProductsIcon.vue.d.ts.map +0 -1
  383. package/dist/ui/components/atoms/vc-icon/icons/ProfileIcon.vue.d.ts +0 -7
  384. package/dist/ui/components/atoms/vc-icon/icons/ProfileIcon.vue.d.ts.map +0 -1
  385. package/dist/ui/components/atoms/vc-icon/icons/SearchIcon.vue.d.ts +0 -7
  386. package/dist/ui/components/atoms/vc-icon/icons/SearchIcon.vue.d.ts.map +0 -1
  387. package/dist/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue.d.ts +0 -7
  388. package/dist/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue.d.ts.map +0 -1
  389. package/dist/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue.d.ts +0 -7
  390. package/dist/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue.d.ts.map +0 -1
  391. package/dist/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue.d.ts +0 -7
  392. package/dist/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue.d.ts.map +0 -1
  393. package/dist/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue.d.ts +0 -7
  394. package/dist/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue.d.ts.map +0 -1
  395. package/dist/vb-c2kQGd6-.js +0 -74
  396. package/dist/vbscript-1f_Dhg5H.js +0 -324
  397. package/dist/velocity-DJd0pTTC.js +0 -96
  398. package/dist/verilog-CiS1jyi5.js +0 -262
  399. package/dist/vhdl-T9HkrbI2.js +0 -106
  400. package/dist/webidl-CjfDENEo.js +0 -155
  401. package/dist/xquery-BUQdORAS.js +0 -422
  402. package/dist/yacas-C0absKBh.js +0 -73
  403. package/dist/z80-Pki2zAjW.js +0 -61
  404. package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +0 -186
  405. package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +0 -175
  406. package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +0 -185
  407. package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +0 -245
  408. package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +0 -192
  409. package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +0 -347
  410. package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +0 -239
  411. package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +0 -186
  412. package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +0 -281
  413. package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +0 -312
  414. package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +0 -361
  415. package/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.ts +0 -224
  416. package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +0 -131
  417. package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +0 -666
  418. package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +0 -202
  419. package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +0 -178
  420. package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +0 -203
  421. package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +0 -92
  422. package/shared/modules/dynamic/components/fields/storybook/common/args.ts +0 -130
  423. package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +0 -8
  424. package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +0 -54
  425. package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +0 -16
  426. package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +0 -41
  427. package/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue +0 -15
  428. package/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue +0 -20
  429. package/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue +0 -13
  430. package/ui/components/atoms/vc-icon/icons/BellIcon.vue +0 -14
  431. package/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue +0 -13
  432. package/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue +0 -13
  433. package/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue +0 -13
  434. package/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue +0 -13
  435. package/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue +0 -16
  436. package/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue +0 -20
  437. package/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue +0 -14
  438. package/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue +0 -14
  439. package/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue +0 -27
  440. package/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue +0 -22
  441. package/ui/components/atoms/vc-icon/icons/LogoutIcon.vue +0 -13
  442. package/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue +0 -14
  443. package/ui/components/atoms/vc-icon/icons/OffersIcon.vue +0 -23
  444. package/ui/components/atoms/vc-icon/icons/OrdersIcon.vue +0 -19
  445. package/ui/components/atoms/vc-icon/icons/PeopleIcon.vue +0 -21
  446. package/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue +0 -20
  447. package/ui/components/atoms/vc-icon/icons/ProductsIcon.vue +0 -23
  448. package/ui/components/atoms/vc-icon/icons/ProfileIcon.vue +0 -18
  449. package/ui/components/atoms/vc-icon/icons/SearchIcon.vue +0 -14
  450. package/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue +0 -21
  451. package/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue +0 -16
  452. package/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue +0 -26
  453. package/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue +0 -19
@@ -0,0 +1,1426 @@
1
+ import { x as xmlDecodeTree, h as htmlDecodeTree, d as determineBranch, B as BinTrieFlags, r as replaceCodePoint, f as fromCodePoint } from './vendor-entities-Bfsx4xOQ.js';
2
+ import { f as DomHandler } from './vendor-domhandler-9z8cS16a.js';
3
+
4
+ var CharCodes;
5
+ (function (CharCodes) {
6
+ CharCodes[CharCodes["Tab"] = 9] = "Tab";
7
+ CharCodes[CharCodes["NewLine"] = 10] = "NewLine";
8
+ CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed";
9
+ CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn";
10
+ CharCodes[CharCodes["Space"] = 32] = "Space";
11
+ CharCodes[CharCodes["ExclamationMark"] = 33] = "ExclamationMark";
12
+ CharCodes[CharCodes["Number"] = 35] = "Number";
13
+ CharCodes[CharCodes["Amp"] = 38] = "Amp";
14
+ CharCodes[CharCodes["SingleQuote"] = 39] = "SingleQuote";
15
+ CharCodes[CharCodes["DoubleQuote"] = 34] = "DoubleQuote";
16
+ CharCodes[CharCodes["Dash"] = 45] = "Dash";
17
+ CharCodes[CharCodes["Slash"] = 47] = "Slash";
18
+ CharCodes[CharCodes["Zero"] = 48] = "Zero";
19
+ CharCodes[CharCodes["Nine"] = 57] = "Nine";
20
+ CharCodes[CharCodes["Semi"] = 59] = "Semi";
21
+ CharCodes[CharCodes["Lt"] = 60] = "Lt";
22
+ CharCodes[CharCodes["Eq"] = 61] = "Eq";
23
+ CharCodes[CharCodes["Gt"] = 62] = "Gt";
24
+ CharCodes[CharCodes["Questionmark"] = 63] = "Questionmark";
25
+ CharCodes[CharCodes["UpperA"] = 65] = "UpperA";
26
+ CharCodes[CharCodes["LowerA"] = 97] = "LowerA";
27
+ CharCodes[CharCodes["UpperF"] = 70] = "UpperF";
28
+ CharCodes[CharCodes["LowerF"] = 102] = "LowerF";
29
+ CharCodes[CharCodes["UpperZ"] = 90] = "UpperZ";
30
+ CharCodes[CharCodes["LowerZ"] = 122] = "LowerZ";
31
+ CharCodes[CharCodes["LowerX"] = 120] = "LowerX";
32
+ CharCodes[CharCodes["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
33
+ })(CharCodes || (CharCodes = {}));
34
+ /** All the states the tokenizer can be in. */
35
+ var State;
36
+ (function (State) {
37
+ State[State["Text"] = 1] = "Text";
38
+ State[State["BeforeTagName"] = 2] = "BeforeTagName";
39
+ State[State["InTagName"] = 3] = "InTagName";
40
+ State[State["InSelfClosingTag"] = 4] = "InSelfClosingTag";
41
+ State[State["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
42
+ State[State["InClosingTagName"] = 6] = "InClosingTagName";
43
+ State[State["AfterClosingTagName"] = 7] = "AfterClosingTagName";
44
+ // Attributes
45
+ State[State["BeforeAttributeName"] = 8] = "BeforeAttributeName";
46
+ State[State["InAttributeName"] = 9] = "InAttributeName";
47
+ State[State["AfterAttributeName"] = 10] = "AfterAttributeName";
48
+ State[State["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
49
+ State[State["InAttributeValueDq"] = 12] = "InAttributeValueDq";
50
+ State[State["InAttributeValueSq"] = 13] = "InAttributeValueSq";
51
+ State[State["InAttributeValueNq"] = 14] = "InAttributeValueNq";
52
+ // Declarations
53
+ State[State["BeforeDeclaration"] = 15] = "BeforeDeclaration";
54
+ State[State["InDeclaration"] = 16] = "InDeclaration";
55
+ // Processing instructions
56
+ State[State["InProcessingInstruction"] = 17] = "InProcessingInstruction";
57
+ // Comments & CDATA
58
+ State[State["BeforeComment"] = 18] = "BeforeComment";
59
+ State[State["CDATASequence"] = 19] = "CDATASequence";
60
+ State[State["InSpecialComment"] = 20] = "InSpecialComment";
61
+ State[State["InCommentLike"] = 21] = "InCommentLike";
62
+ // Special tags
63
+ State[State["BeforeSpecialS"] = 22] = "BeforeSpecialS";
64
+ State[State["SpecialStartSequence"] = 23] = "SpecialStartSequence";
65
+ State[State["InSpecialTag"] = 24] = "InSpecialTag";
66
+ State[State["BeforeEntity"] = 25] = "BeforeEntity";
67
+ State[State["BeforeNumericEntity"] = 26] = "BeforeNumericEntity";
68
+ State[State["InNamedEntity"] = 27] = "InNamedEntity";
69
+ State[State["InNumericEntity"] = 28] = "InNumericEntity";
70
+ State[State["InHexEntity"] = 29] = "InHexEntity";
71
+ })(State || (State = {}));
72
+ function isWhitespace(c) {
73
+ return (c === CharCodes.Space ||
74
+ c === CharCodes.NewLine ||
75
+ c === CharCodes.Tab ||
76
+ c === CharCodes.FormFeed ||
77
+ c === CharCodes.CarriageReturn);
78
+ }
79
+ function isEndOfTagSection(c) {
80
+ return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace(c);
81
+ }
82
+ function isNumber(c) {
83
+ return c >= CharCodes.Zero && c <= CharCodes.Nine;
84
+ }
85
+ function isASCIIAlpha(c) {
86
+ return ((c >= CharCodes.LowerA && c <= CharCodes.LowerZ) ||
87
+ (c >= CharCodes.UpperA && c <= CharCodes.UpperZ));
88
+ }
89
+ function isHexDigit(c) {
90
+ return ((c >= CharCodes.UpperA && c <= CharCodes.UpperF) ||
91
+ (c >= CharCodes.LowerA && c <= CharCodes.LowerF));
92
+ }
93
+ var QuoteType;
94
+ (function (QuoteType) {
95
+ QuoteType[QuoteType["NoValue"] = 0] = "NoValue";
96
+ QuoteType[QuoteType["Unquoted"] = 1] = "Unquoted";
97
+ QuoteType[QuoteType["Single"] = 2] = "Single";
98
+ QuoteType[QuoteType["Double"] = 3] = "Double";
99
+ })(QuoteType || (QuoteType = {}));
100
+ /**
101
+ * Sequences used to match longer strings.
102
+ *
103
+ * We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End
104
+ * sequences with an increased offset.
105
+ */
106
+ const Sequences = {
107
+ Cdata: new Uint8Array([0x43, 0x44, 0x41, 0x54, 0x41, 0x5b]),
108
+ CdataEnd: new Uint8Array([0x5d, 0x5d, 0x3e]),
109
+ CommentEnd: new Uint8Array([0x2d, 0x2d, 0x3e]),
110
+ ScriptEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74]),
111
+ StyleEnd: new Uint8Array([0x3c, 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65]),
112
+ TitleEnd: new Uint8Array([0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65]), // `</title`
113
+ };
114
+ class Tokenizer {
115
+ constructor({ xmlMode = false, decodeEntities = true, }, cbs) {
116
+ this.cbs = cbs;
117
+ /** The current state the tokenizer is in. */
118
+ this.state = State.Text;
119
+ /** The read buffer. */
120
+ this.buffer = "";
121
+ /** The beginning of the section that is currently being read. */
122
+ this.sectionStart = 0;
123
+ /** The index within the buffer that we are currently looking at. */
124
+ this.index = 0;
125
+ /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
126
+ this.baseState = State.Text;
127
+ /** For special parsing behavior inside of script and style tags. */
128
+ this.isSpecial = false;
129
+ /** Indicates whether the tokenizer has been paused. */
130
+ this.running = true;
131
+ /** The offset of the current buffer. */
132
+ this.offset = 0;
133
+ this.currentSequence = undefined;
134
+ this.sequenceIndex = 0;
135
+ this.trieIndex = 0;
136
+ this.trieCurrent = 0;
137
+ /** For named entities, the index of the value. For numeric entities, the code point. */
138
+ this.entityResult = 0;
139
+ this.entityExcess = 0;
140
+ this.xmlMode = xmlMode;
141
+ this.decodeEntities = decodeEntities;
142
+ this.entityTrie = xmlMode ? xmlDecodeTree : htmlDecodeTree;
143
+ }
144
+ reset() {
145
+ this.state = State.Text;
146
+ this.buffer = "";
147
+ this.sectionStart = 0;
148
+ this.index = 0;
149
+ this.baseState = State.Text;
150
+ this.currentSequence = undefined;
151
+ this.running = true;
152
+ this.offset = 0;
153
+ }
154
+ write(chunk) {
155
+ this.offset += this.buffer.length;
156
+ this.buffer = chunk;
157
+ this.parse();
158
+ }
159
+ end() {
160
+ if (this.running)
161
+ this.finish();
162
+ }
163
+ pause() {
164
+ this.running = false;
165
+ }
166
+ resume() {
167
+ this.running = true;
168
+ if (this.index < this.buffer.length + this.offset) {
169
+ this.parse();
170
+ }
171
+ }
172
+ /**
173
+ * The current index within all of the written data.
174
+ */
175
+ getIndex() {
176
+ return this.index;
177
+ }
178
+ /**
179
+ * The start of the current section.
180
+ */
181
+ getSectionStart() {
182
+ return this.sectionStart;
183
+ }
184
+ stateText(c) {
185
+ if (c === CharCodes.Lt ||
186
+ (!this.decodeEntities && this.fastForwardTo(CharCodes.Lt))) {
187
+ if (this.index > this.sectionStart) {
188
+ this.cbs.ontext(this.sectionStart, this.index);
189
+ }
190
+ this.state = State.BeforeTagName;
191
+ this.sectionStart = this.index;
192
+ }
193
+ else if (this.decodeEntities && c === CharCodes.Amp) {
194
+ this.state = State.BeforeEntity;
195
+ }
196
+ }
197
+ stateSpecialStartSequence(c) {
198
+ const isEnd = this.sequenceIndex === this.currentSequence.length;
199
+ const isMatch = isEnd
200
+ ? // If we are at the end of the sequence, make sure the tag name has ended
201
+ isEndOfTagSection(c)
202
+ : // Otherwise, do a case-insensitive comparison
203
+ (c | 0x20) === this.currentSequence[this.sequenceIndex];
204
+ if (!isMatch) {
205
+ this.isSpecial = false;
206
+ }
207
+ else if (!isEnd) {
208
+ this.sequenceIndex++;
209
+ return;
210
+ }
211
+ this.sequenceIndex = 0;
212
+ this.state = State.InTagName;
213
+ this.stateInTagName(c);
214
+ }
215
+ /** Look for an end tag. For <title> tags, also decode entities. */
216
+ stateInSpecialTag(c) {
217
+ if (this.sequenceIndex === this.currentSequence.length) {
218
+ if (c === CharCodes.Gt || isWhitespace(c)) {
219
+ const endOfText = this.index - this.currentSequence.length;
220
+ if (this.sectionStart < endOfText) {
221
+ // Spoof the index so that reported locations match up.
222
+ const actualIndex = this.index;
223
+ this.index = endOfText;
224
+ this.cbs.ontext(this.sectionStart, endOfText);
225
+ this.index = actualIndex;
226
+ }
227
+ this.isSpecial = false;
228
+ this.sectionStart = endOfText + 2; // Skip over the `</`
229
+ this.stateInClosingTagName(c);
230
+ return; // We are done; skip the rest of the function.
231
+ }
232
+ this.sequenceIndex = 0;
233
+ }
234
+ if ((c | 0x20) === this.currentSequence[this.sequenceIndex]) {
235
+ this.sequenceIndex += 1;
236
+ }
237
+ else if (this.sequenceIndex === 0) {
238
+ if (this.currentSequence === Sequences.TitleEnd) {
239
+ // We have to parse entities in <title> tags.
240
+ if (this.decodeEntities && c === CharCodes.Amp) {
241
+ this.state = State.BeforeEntity;
242
+ }
243
+ }
244
+ else if (this.fastForwardTo(CharCodes.Lt)) {
245
+ // Outside of <title> tags, we can fast-forward.
246
+ this.sequenceIndex = 1;
247
+ }
248
+ }
249
+ else {
250
+ // If we see a `<`, set the sequence index to 1; useful for eg. `<</script>`.
251
+ this.sequenceIndex = Number(c === CharCodes.Lt);
252
+ }
253
+ }
254
+ stateCDATASequence(c) {
255
+ if (c === Sequences.Cdata[this.sequenceIndex]) {
256
+ if (++this.sequenceIndex === Sequences.Cdata.length) {
257
+ this.state = State.InCommentLike;
258
+ this.currentSequence = Sequences.CdataEnd;
259
+ this.sequenceIndex = 0;
260
+ this.sectionStart = this.index + 1;
261
+ }
262
+ }
263
+ else {
264
+ this.sequenceIndex = 0;
265
+ this.state = State.InDeclaration;
266
+ this.stateInDeclaration(c); // Reconsume the character
267
+ }
268
+ }
269
+ /**
270
+ * When we wait for one specific character, we can speed things up
271
+ * by skipping through the buffer until we find it.
272
+ *
273
+ * @returns Whether the character was found.
274
+ */
275
+ fastForwardTo(c) {
276
+ while (++this.index < this.buffer.length + this.offset) {
277
+ if (this.buffer.charCodeAt(this.index - this.offset) === c) {
278
+ return true;
279
+ }
280
+ }
281
+ /*
282
+ * We increment the index at the end of the `parse` loop,
283
+ * so set it to `buffer.length - 1` here.
284
+ *
285
+ * TODO: Refactor `parse` to increment index before calling states.
286
+ */
287
+ this.index = this.buffer.length + this.offset - 1;
288
+ return false;
289
+ }
290
+ /**
291
+ * Comments and CDATA end with `-->` and `]]>`.
292
+ *
293
+ * Their common qualities are:
294
+ * - Their end sequences have a distinct character they start with.
295
+ * - That character is then repeated, so we have to check multiple repeats.
296
+ * - All characters but the start character of the sequence can be skipped.
297
+ */
298
+ stateInCommentLike(c) {
299
+ if (c === this.currentSequence[this.sequenceIndex]) {
300
+ if (++this.sequenceIndex === this.currentSequence.length) {
301
+ if (this.currentSequence === Sequences.CdataEnd) {
302
+ this.cbs.oncdata(this.sectionStart, this.index, 2);
303
+ }
304
+ else {
305
+ this.cbs.oncomment(this.sectionStart, this.index, 2);
306
+ }
307
+ this.sequenceIndex = 0;
308
+ this.sectionStart = this.index + 1;
309
+ this.state = State.Text;
310
+ }
311
+ }
312
+ else if (this.sequenceIndex === 0) {
313
+ // Fast-forward to the first character of the sequence
314
+ if (this.fastForwardTo(this.currentSequence[0])) {
315
+ this.sequenceIndex = 1;
316
+ }
317
+ }
318
+ else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
319
+ // Allow long sequences, eg. --->, ]]]>
320
+ this.sequenceIndex = 0;
321
+ }
322
+ }
323
+ /**
324
+ * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
325
+ *
326
+ * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
327
+ * We allow anything that wouldn't end the tag.
328
+ */
329
+ isTagStartChar(c) {
330
+ return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);
331
+ }
332
+ startSpecial(sequence, offset) {
333
+ this.isSpecial = true;
334
+ this.currentSequence = sequence;
335
+ this.sequenceIndex = offset;
336
+ this.state = State.SpecialStartSequence;
337
+ }
338
+ stateBeforeTagName(c) {
339
+ if (c === CharCodes.ExclamationMark) {
340
+ this.state = State.BeforeDeclaration;
341
+ this.sectionStart = this.index + 1;
342
+ }
343
+ else if (c === CharCodes.Questionmark) {
344
+ this.state = State.InProcessingInstruction;
345
+ this.sectionStart = this.index + 1;
346
+ }
347
+ else if (this.isTagStartChar(c)) {
348
+ const lower = c | 0x20;
349
+ this.sectionStart = this.index;
350
+ if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {
351
+ this.startSpecial(Sequences.TitleEnd, 3);
352
+ }
353
+ else {
354
+ this.state =
355
+ !this.xmlMode && lower === Sequences.ScriptEnd[2]
356
+ ? State.BeforeSpecialS
357
+ : State.InTagName;
358
+ }
359
+ }
360
+ else if (c === CharCodes.Slash) {
361
+ this.state = State.BeforeClosingTagName;
362
+ }
363
+ else {
364
+ this.state = State.Text;
365
+ this.stateText(c);
366
+ }
367
+ }
368
+ stateInTagName(c) {
369
+ if (isEndOfTagSection(c)) {
370
+ this.cbs.onopentagname(this.sectionStart, this.index);
371
+ this.sectionStart = -1;
372
+ this.state = State.BeforeAttributeName;
373
+ this.stateBeforeAttributeName(c);
374
+ }
375
+ }
376
+ stateBeforeClosingTagName(c) {
377
+ if (isWhitespace(c)) ;
378
+ else if (c === CharCodes.Gt) {
379
+ this.state = State.Text;
380
+ }
381
+ else {
382
+ this.state = this.isTagStartChar(c)
383
+ ? State.InClosingTagName
384
+ : State.InSpecialComment;
385
+ this.sectionStart = this.index;
386
+ }
387
+ }
388
+ stateInClosingTagName(c) {
389
+ if (c === CharCodes.Gt || isWhitespace(c)) {
390
+ this.cbs.onclosetag(this.sectionStart, this.index);
391
+ this.sectionStart = -1;
392
+ this.state = State.AfterClosingTagName;
393
+ this.stateAfterClosingTagName(c);
394
+ }
395
+ }
396
+ stateAfterClosingTagName(c) {
397
+ // Skip everything until ">"
398
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
399
+ this.state = State.Text;
400
+ this.baseState = State.Text;
401
+ this.sectionStart = this.index + 1;
402
+ }
403
+ }
404
+ stateBeforeAttributeName(c) {
405
+ if (c === CharCodes.Gt) {
406
+ this.cbs.onopentagend(this.index);
407
+ if (this.isSpecial) {
408
+ this.state = State.InSpecialTag;
409
+ this.sequenceIndex = 0;
410
+ }
411
+ else {
412
+ this.state = State.Text;
413
+ }
414
+ this.baseState = this.state;
415
+ this.sectionStart = this.index + 1;
416
+ }
417
+ else if (c === CharCodes.Slash) {
418
+ this.state = State.InSelfClosingTag;
419
+ }
420
+ else if (!isWhitespace(c)) {
421
+ this.state = State.InAttributeName;
422
+ this.sectionStart = this.index;
423
+ }
424
+ }
425
+ stateInSelfClosingTag(c) {
426
+ if (c === CharCodes.Gt) {
427
+ this.cbs.onselfclosingtag(this.index);
428
+ this.state = State.Text;
429
+ this.baseState = State.Text;
430
+ this.sectionStart = this.index + 1;
431
+ this.isSpecial = false; // Reset special state, in case of self-closing special tags
432
+ }
433
+ else if (!isWhitespace(c)) {
434
+ this.state = State.BeforeAttributeName;
435
+ this.stateBeforeAttributeName(c);
436
+ }
437
+ }
438
+ stateInAttributeName(c) {
439
+ if (c === CharCodes.Eq || isEndOfTagSection(c)) {
440
+ this.cbs.onattribname(this.sectionStart, this.index);
441
+ this.sectionStart = -1;
442
+ this.state = State.AfterAttributeName;
443
+ this.stateAfterAttributeName(c);
444
+ }
445
+ }
446
+ stateAfterAttributeName(c) {
447
+ if (c === CharCodes.Eq) {
448
+ this.state = State.BeforeAttributeValue;
449
+ }
450
+ else if (c === CharCodes.Slash || c === CharCodes.Gt) {
451
+ this.cbs.onattribend(QuoteType.NoValue, this.index);
452
+ this.state = State.BeforeAttributeName;
453
+ this.stateBeforeAttributeName(c);
454
+ }
455
+ else if (!isWhitespace(c)) {
456
+ this.cbs.onattribend(QuoteType.NoValue, this.index);
457
+ this.state = State.InAttributeName;
458
+ this.sectionStart = this.index;
459
+ }
460
+ }
461
+ stateBeforeAttributeValue(c) {
462
+ if (c === CharCodes.DoubleQuote) {
463
+ this.state = State.InAttributeValueDq;
464
+ this.sectionStart = this.index + 1;
465
+ }
466
+ else if (c === CharCodes.SingleQuote) {
467
+ this.state = State.InAttributeValueSq;
468
+ this.sectionStart = this.index + 1;
469
+ }
470
+ else if (!isWhitespace(c)) {
471
+ this.sectionStart = this.index;
472
+ this.state = State.InAttributeValueNq;
473
+ this.stateInAttributeValueNoQuotes(c); // Reconsume token
474
+ }
475
+ }
476
+ handleInAttributeValue(c, quote) {
477
+ if (c === quote ||
478
+ (!this.decodeEntities && this.fastForwardTo(quote))) {
479
+ this.cbs.onattribdata(this.sectionStart, this.index);
480
+ this.sectionStart = -1;
481
+ this.cbs.onattribend(quote === CharCodes.DoubleQuote
482
+ ? QuoteType.Double
483
+ : QuoteType.Single, this.index);
484
+ this.state = State.BeforeAttributeName;
485
+ }
486
+ else if (this.decodeEntities && c === CharCodes.Amp) {
487
+ this.baseState = this.state;
488
+ this.state = State.BeforeEntity;
489
+ }
490
+ }
491
+ stateInAttributeValueDoubleQuotes(c) {
492
+ this.handleInAttributeValue(c, CharCodes.DoubleQuote);
493
+ }
494
+ stateInAttributeValueSingleQuotes(c) {
495
+ this.handleInAttributeValue(c, CharCodes.SingleQuote);
496
+ }
497
+ stateInAttributeValueNoQuotes(c) {
498
+ if (isWhitespace(c) || c === CharCodes.Gt) {
499
+ this.cbs.onattribdata(this.sectionStart, this.index);
500
+ this.sectionStart = -1;
501
+ this.cbs.onattribend(QuoteType.Unquoted, this.index);
502
+ this.state = State.BeforeAttributeName;
503
+ this.stateBeforeAttributeName(c);
504
+ }
505
+ else if (this.decodeEntities && c === CharCodes.Amp) {
506
+ this.baseState = this.state;
507
+ this.state = State.BeforeEntity;
508
+ }
509
+ }
510
+ stateBeforeDeclaration(c) {
511
+ if (c === CharCodes.OpeningSquareBracket) {
512
+ this.state = State.CDATASequence;
513
+ this.sequenceIndex = 0;
514
+ }
515
+ else {
516
+ this.state =
517
+ c === CharCodes.Dash
518
+ ? State.BeforeComment
519
+ : State.InDeclaration;
520
+ }
521
+ }
522
+ stateInDeclaration(c) {
523
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
524
+ this.cbs.ondeclaration(this.sectionStart, this.index);
525
+ this.state = State.Text;
526
+ this.sectionStart = this.index + 1;
527
+ }
528
+ }
529
+ stateInProcessingInstruction(c) {
530
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
531
+ this.cbs.onprocessinginstruction(this.sectionStart, this.index);
532
+ this.state = State.Text;
533
+ this.sectionStart = this.index + 1;
534
+ }
535
+ }
536
+ stateBeforeComment(c) {
537
+ if (c === CharCodes.Dash) {
538
+ this.state = State.InCommentLike;
539
+ this.currentSequence = Sequences.CommentEnd;
540
+ // Allow short comments (eg. <!-->)
541
+ this.sequenceIndex = 2;
542
+ this.sectionStart = this.index + 1;
543
+ }
544
+ else {
545
+ this.state = State.InDeclaration;
546
+ }
547
+ }
548
+ stateInSpecialComment(c) {
549
+ if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
550
+ this.cbs.oncomment(this.sectionStart, this.index, 0);
551
+ this.state = State.Text;
552
+ this.sectionStart = this.index + 1;
553
+ }
554
+ }
555
+ stateBeforeSpecialS(c) {
556
+ const lower = c | 0x20;
557
+ if (lower === Sequences.ScriptEnd[3]) {
558
+ this.startSpecial(Sequences.ScriptEnd, 4);
559
+ }
560
+ else if (lower === Sequences.StyleEnd[3]) {
561
+ this.startSpecial(Sequences.StyleEnd, 4);
562
+ }
563
+ else {
564
+ this.state = State.InTagName;
565
+ this.stateInTagName(c); // Consume the token again
566
+ }
567
+ }
568
+ stateBeforeEntity(c) {
569
+ // Start excess with 1 to include the '&'
570
+ this.entityExcess = 1;
571
+ this.entityResult = 0;
572
+ if (c === CharCodes.Number) {
573
+ this.state = State.BeforeNumericEntity;
574
+ }
575
+ else if (c === CharCodes.Amp) ;
576
+ else {
577
+ this.trieIndex = 0;
578
+ this.trieCurrent = this.entityTrie[0];
579
+ this.state = State.InNamedEntity;
580
+ this.stateInNamedEntity(c);
581
+ }
582
+ }
583
+ stateInNamedEntity(c) {
584
+ this.entityExcess += 1;
585
+ this.trieIndex = determineBranch(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);
586
+ if (this.trieIndex < 0) {
587
+ this.emitNamedEntity();
588
+ this.index--;
589
+ return;
590
+ }
591
+ this.trieCurrent = this.entityTrie[this.trieIndex];
592
+ const masked = this.trieCurrent & BinTrieFlags.VALUE_LENGTH;
593
+ // If the branch is a value, store it and continue
594
+ if (masked) {
595
+ // The mask is the number of bytes of the value, including the current byte.
596
+ const valueLength = (masked >> 14) - 1;
597
+ // If we have a legacy entity while parsing strictly, just skip the number of bytes
598
+ if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {
599
+ this.trieIndex += valueLength;
600
+ }
601
+ else {
602
+ // Add 1 as we have already incremented the excess
603
+ const entityStart = this.index - this.entityExcess + 1;
604
+ if (entityStart > this.sectionStart) {
605
+ this.emitPartial(this.sectionStart, entityStart);
606
+ }
607
+ // If this is a surrogate pair, consume the next two bytes
608
+ this.entityResult = this.trieIndex;
609
+ this.trieIndex += valueLength;
610
+ this.entityExcess = 0;
611
+ this.sectionStart = this.index + 1;
612
+ if (valueLength === 0) {
613
+ this.emitNamedEntity();
614
+ }
615
+ }
616
+ }
617
+ }
618
+ emitNamedEntity() {
619
+ this.state = this.baseState;
620
+ if (this.entityResult === 0) {
621
+ return;
622
+ }
623
+ const valueLength = (this.entityTrie[this.entityResult] & BinTrieFlags.VALUE_LENGTH) >>
624
+ 14;
625
+ switch (valueLength) {
626
+ case 1: {
627
+ this.emitCodePoint(this.entityTrie[this.entityResult] &
628
+ ~BinTrieFlags.VALUE_LENGTH);
629
+ break;
630
+ }
631
+ case 2: {
632
+ this.emitCodePoint(this.entityTrie[this.entityResult + 1]);
633
+ break;
634
+ }
635
+ case 3: {
636
+ this.emitCodePoint(this.entityTrie[this.entityResult + 1]);
637
+ this.emitCodePoint(this.entityTrie[this.entityResult + 2]);
638
+ }
639
+ }
640
+ }
641
+ stateBeforeNumericEntity(c) {
642
+ if ((c | 0x20) === CharCodes.LowerX) {
643
+ this.entityExcess++;
644
+ this.state = State.InHexEntity;
645
+ }
646
+ else {
647
+ this.state = State.InNumericEntity;
648
+ this.stateInNumericEntity(c);
649
+ }
650
+ }
651
+ emitNumericEntity(strict) {
652
+ const entityStart = this.index - this.entityExcess - 1;
653
+ const numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);
654
+ if (numberStart !== this.index) {
655
+ // Emit leading data if any
656
+ if (entityStart > this.sectionStart) {
657
+ this.emitPartial(this.sectionStart, entityStart);
658
+ }
659
+ this.sectionStart = this.index + Number(strict);
660
+ this.emitCodePoint(replaceCodePoint(this.entityResult));
661
+ }
662
+ this.state = this.baseState;
663
+ }
664
+ stateInNumericEntity(c) {
665
+ if (c === CharCodes.Semi) {
666
+ this.emitNumericEntity(true);
667
+ }
668
+ else if (isNumber(c)) {
669
+ this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);
670
+ this.entityExcess++;
671
+ }
672
+ else {
673
+ if (this.allowLegacyEntity()) {
674
+ this.emitNumericEntity(false);
675
+ }
676
+ else {
677
+ this.state = this.baseState;
678
+ }
679
+ this.index--;
680
+ }
681
+ }
682
+ stateInHexEntity(c) {
683
+ if (c === CharCodes.Semi) {
684
+ this.emitNumericEntity(true);
685
+ }
686
+ else if (isNumber(c)) {
687
+ this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);
688
+ this.entityExcess++;
689
+ }
690
+ else if (isHexDigit(c)) {
691
+ this.entityResult =
692
+ this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);
693
+ this.entityExcess++;
694
+ }
695
+ else {
696
+ if (this.allowLegacyEntity()) {
697
+ this.emitNumericEntity(false);
698
+ }
699
+ else {
700
+ this.state = this.baseState;
701
+ }
702
+ this.index--;
703
+ }
704
+ }
705
+ allowLegacyEntity() {
706
+ return (!this.xmlMode &&
707
+ (this.baseState === State.Text ||
708
+ this.baseState === State.InSpecialTag));
709
+ }
710
+ /**
711
+ * Remove data that has already been consumed from the buffer.
712
+ */
713
+ cleanup() {
714
+ // If we are inside of text or attributes, emit what we already have.
715
+ if (this.running && this.sectionStart !== this.index) {
716
+ if (this.state === State.Text ||
717
+ (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {
718
+ this.cbs.ontext(this.sectionStart, this.index);
719
+ this.sectionStart = this.index;
720
+ }
721
+ else if (this.state === State.InAttributeValueDq ||
722
+ this.state === State.InAttributeValueSq ||
723
+ this.state === State.InAttributeValueNq) {
724
+ this.cbs.onattribdata(this.sectionStart, this.index);
725
+ this.sectionStart = this.index;
726
+ }
727
+ }
728
+ }
729
+ shouldContinue() {
730
+ return this.index < this.buffer.length + this.offset && this.running;
731
+ }
732
+ /**
733
+ * Iterates through the buffer, calling the function corresponding to the current state.
734
+ *
735
+ * States that are more likely to be hit are higher up, as a performance improvement.
736
+ */
737
+ parse() {
738
+ while (this.shouldContinue()) {
739
+ const c = this.buffer.charCodeAt(this.index - this.offset);
740
+ switch (this.state) {
741
+ case State.Text: {
742
+ this.stateText(c);
743
+ break;
744
+ }
745
+ case State.SpecialStartSequence: {
746
+ this.stateSpecialStartSequence(c);
747
+ break;
748
+ }
749
+ case State.InSpecialTag: {
750
+ this.stateInSpecialTag(c);
751
+ break;
752
+ }
753
+ case State.CDATASequence: {
754
+ this.stateCDATASequence(c);
755
+ break;
756
+ }
757
+ case State.InAttributeValueDq: {
758
+ this.stateInAttributeValueDoubleQuotes(c);
759
+ break;
760
+ }
761
+ case State.InAttributeName: {
762
+ this.stateInAttributeName(c);
763
+ break;
764
+ }
765
+ case State.InCommentLike: {
766
+ this.stateInCommentLike(c);
767
+ break;
768
+ }
769
+ case State.InSpecialComment: {
770
+ this.stateInSpecialComment(c);
771
+ break;
772
+ }
773
+ case State.BeforeAttributeName: {
774
+ this.stateBeforeAttributeName(c);
775
+ break;
776
+ }
777
+ case State.InTagName: {
778
+ this.stateInTagName(c);
779
+ break;
780
+ }
781
+ case State.InClosingTagName: {
782
+ this.stateInClosingTagName(c);
783
+ break;
784
+ }
785
+ case State.BeforeTagName: {
786
+ this.stateBeforeTagName(c);
787
+ break;
788
+ }
789
+ case State.AfterAttributeName: {
790
+ this.stateAfterAttributeName(c);
791
+ break;
792
+ }
793
+ case State.InAttributeValueSq: {
794
+ this.stateInAttributeValueSingleQuotes(c);
795
+ break;
796
+ }
797
+ case State.BeforeAttributeValue: {
798
+ this.stateBeforeAttributeValue(c);
799
+ break;
800
+ }
801
+ case State.BeforeClosingTagName: {
802
+ this.stateBeforeClosingTagName(c);
803
+ break;
804
+ }
805
+ case State.AfterClosingTagName: {
806
+ this.stateAfterClosingTagName(c);
807
+ break;
808
+ }
809
+ case State.BeforeSpecialS: {
810
+ this.stateBeforeSpecialS(c);
811
+ break;
812
+ }
813
+ case State.InAttributeValueNq: {
814
+ this.stateInAttributeValueNoQuotes(c);
815
+ break;
816
+ }
817
+ case State.InSelfClosingTag: {
818
+ this.stateInSelfClosingTag(c);
819
+ break;
820
+ }
821
+ case State.InDeclaration: {
822
+ this.stateInDeclaration(c);
823
+ break;
824
+ }
825
+ case State.BeforeDeclaration: {
826
+ this.stateBeforeDeclaration(c);
827
+ break;
828
+ }
829
+ case State.BeforeComment: {
830
+ this.stateBeforeComment(c);
831
+ break;
832
+ }
833
+ case State.InProcessingInstruction: {
834
+ this.stateInProcessingInstruction(c);
835
+ break;
836
+ }
837
+ case State.InNamedEntity: {
838
+ this.stateInNamedEntity(c);
839
+ break;
840
+ }
841
+ case State.BeforeEntity: {
842
+ this.stateBeforeEntity(c);
843
+ break;
844
+ }
845
+ case State.InHexEntity: {
846
+ this.stateInHexEntity(c);
847
+ break;
848
+ }
849
+ case State.InNumericEntity: {
850
+ this.stateInNumericEntity(c);
851
+ break;
852
+ }
853
+ default: {
854
+ // `this._state === State.BeforeNumericEntity`
855
+ this.stateBeforeNumericEntity(c);
856
+ }
857
+ }
858
+ this.index++;
859
+ }
860
+ this.cleanup();
861
+ }
862
+ finish() {
863
+ if (this.state === State.InNamedEntity) {
864
+ this.emitNamedEntity();
865
+ }
866
+ // If there is remaining data, emit it in a reasonable way
867
+ if (this.sectionStart < this.index) {
868
+ this.handleTrailingData();
869
+ }
870
+ this.cbs.onend();
871
+ }
872
+ /** Handle any trailing data. */
873
+ handleTrailingData() {
874
+ const endIndex = this.buffer.length + this.offset;
875
+ if (this.state === State.InCommentLike) {
876
+ if (this.currentSequence === Sequences.CdataEnd) {
877
+ this.cbs.oncdata(this.sectionStart, endIndex, 0);
878
+ }
879
+ else {
880
+ this.cbs.oncomment(this.sectionStart, endIndex, 0);
881
+ }
882
+ }
883
+ else if (this.state === State.InNumericEntity &&
884
+ this.allowLegacyEntity()) {
885
+ this.emitNumericEntity(false);
886
+ // All trailing data will have been consumed
887
+ }
888
+ else if (this.state === State.InHexEntity &&
889
+ this.allowLegacyEntity()) {
890
+ this.emitNumericEntity(false);
891
+ // All trailing data will have been consumed
892
+ }
893
+ else if (this.state === State.InTagName ||
894
+ this.state === State.BeforeAttributeName ||
895
+ this.state === State.BeforeAttributeValue ||
896
+ this.state === State.AfterAttributeName ||
897
+ this.state === State.InAttributeName ||
898
+ this.state === State.InAttributeValueSq ||
899
+ this.state === State.InAttributeValueDq ||
900
+ this.state === State.InAttributeValueNq ||
901
+ this.state === State.InClosingTagName) ;
902
+ else {
903
+ this.cbs.ontext(this.sectionStart, endIndex);
904
+ }
905
+ }
906
+ emitPartial(start, endIndex) {
907
+ if (this.baseState !== State.Text &&
908
+ this.baseState !== State.InSpecialTag) {
909
+ this.cbs.onattribdata(start, endIndex);
910
+ }
911
+ else {
912
+ this.cbs.ontext(start, endIndex);
913
+ }
914
+ }
915
+ emitCodePoint(cp) {
916
+ if (this.baseState !== State.Text &&
917
+ this.baseState !== State.InSpecialTag) {
918
+ this.cbs.onattribentity(cp);
919
+ }
920
+ else {
921
+ this.cbs.ontextentity(cp);
922
+ }
923
+ }
924
+ }
925
+
926
+ const formTags = new Set([
927
+ "input",
928
+ "option",
929
+ "optgroup",
930
+ "select",
931
+ "button",
932
+ "datalist",
933
+ "textarea",
934
+ ]);
935
+ const pTag = new Set(["p"]);
936
+ const tableSectionTags = new Set(["thead", "tbody"]);
937
+ const ddtTags = new Set(["dd", "dt"]);
938
+ const rtpTags = new Set(["rt", "rp"]);
939
+ const openImpliesClose = new Map([
940
+ ["tr", new Set(["tr", "th", "td"])],
941
+ ["th", new Set(["th"])],
942
+ ["td", new Set(["thead", "th", "td"])],
943
+ ["body", new Set(["head", "link", "script"])],
944
+ ["li", new Set(["li"])],
945
+ ["p", pTag],
946
+ ["h1", pTag],
947
+ ["h2", pTag],
948
+ ["h3", pTag],
949
+ ["h4", pTag],
950
+ ["h5", pTag],
951
+ ["h6", pTag],
952
+ ["select", formTags],
953
+ ["input", formTags],
954
+ ["output", formTags],
955
+ ["button", formTags],
956
+ ["datalist", formTags],
957
+ ["textarea", formTags],
958
+ ["option", new Set(["option"])],
959
+ ["optgroup", new Set(["optgroup", "option"])],
960
+ ["dd", ddtTags],
961
+ ["dt", ddtTags],
962
+ ["address", pTag],
963
+ ["article", pTag],
964
+ ["aside", pTag],
965
+ ["blockquote", pTag],
966
+ ["details", pTag],
967
+ ["div", pTag],
968
+ ["dl", pTag],
969
+ ["fieldset", pTag],
970
+ ["figcaption", pTag],
971
+ ["figure", pTag],
972
+ ["footer", pTag],
973
+ ["form", pTag],
974
+ ["header", pTag],
975
+ ["hr", pTag],
976
+ ["main", pTag],
977
+ ["nav", pTag],
978
+ ["ol", pTag],
979
+ ["pre", pTag],
980
+ ["section", pTag],
981
+ ["table", pTag],
982
+ ["ul", pTag],
983
+ ["rt", rtpTags],
984
+ ["rp", rtpTags],
985
+ ["tbody", tableSectionTags],
986
+ ["tfoot", tableSectionTags],
987
+ ]);
988
+ const voidElements = new Set([
989
+ "area",
990
+ "base",
991
+ "basefont",
992
+ "br",
993
+ "col",
994
+ "command",
995
+ "embed",
996
+ "frame",
997
+ "hr",
998
+ "img",
999
+ "input",
1000
+ "isindex",
1001
+ "keygen",
1002
+ "link",
1003
+ "meta",
1004
+ "param",
1005
+ "source",
1006
+ "track",
1007
+ "wbr",
1008
+ ]);
1009
+ const foreignContextElements = new Set(["math", "svg"]);
1010
+ const htmlIntegrationElements = new Set([
1011
+ "mi",
1012
+ "mo",
1013
+ "mn",
1014
+ "ms",
1015
+ "mtext",
1016
+ "annotation-xml",
1017
+ "foreignobject",
1018
+ "desc",
1019
+ "title",
1020
+ ]);
1021
+ const reNameEnd = /\s|\//;
1022
+ class Parser {
1023
+ constructor(cbs, options = {}) {
1024
+ var _a, _b, _c, _d, _e;
1025
+ this.options = options;
1026
+ /** The start index of the last event. */
1027
+ this.startIndex = 0;
1028
+ /** The end index of the last event. */
1029
+ this.endIndex = 0;
1030
+ /**
1031
+ * Store the start index of the current open tag,
1032
+ * so we can update the start index for attributes.
1033
+ */
1034
+ this.openTagStart = 0;
1035
+ this.tagname = "";
1036
+ this.attribname = "";
1037
+ this.attribvalue = "";
1038
+ this.attribs = null;
1039
+ this.stack = [];
1040
+ this.foreignContext = [];
1041
+ this.buffers = [];
1042
+ this.bufferOffset = 0;
1043
+ /** The index of the last written buffer. Used when resuming after a `pause()`. */
1044
+ this.writeIndex = 0;
1045
+ /** Indicates whether the parser has finished running / `.end` has been called. */
1046
+ this.ended = false;
1047
+ this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};
1048
+ this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;
1049
+ this.lowerCaseAttributeNames =
1050
+ (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;
1051
+ this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer)(this.options, this);
1052
+ (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);
1053
+ }
1054
+ // Tokenizer event handlers
1055
+ /** @internal */
1056
+ ontext(start, endIndex) {
1057
+ var _a, _b;
1058
+ const data = this.getSlice(start, endIndex);
1059
+ this.endIndex = endIndex - 1;
1060
+ (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);
1061
+ this.startIndex = endIndex;
1062
+ }
1063
+ /** @internal */
1064
+ ontextentity(cp) {
1065
+ var _a, _b;
1066
+ /*
1067
+ * Entities can be emitted on the character, or directly after.
1068
+ * We use the section start here to get accurate indices.
1069
+ */
1070
+ const index = this.tokenizer.getSectionStart();
1071
+ this.endIndex = index - 1;
1072
+ (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, fromCodePoint(cp));
1073
+ this.startIndex = index;
1074
+ }
1075
+ isVoidElement(name) {
1076
+ return !this.options.xmlMode && voidElements.has(name);
1077
+ }
1078
+ /** @internal */
1079
+ onopentagname(start, endIndex) {
1080
+ this.endIndex = endIndex;
1081
+ let name = this.getSlice(start, endIndex);
1082
+ if (this.lowerCaseTagNames) {
1083
+ name = name.toLowerCase();
1084
+ }
1085
+ this.emitOpenTag(name);
1086
+ }
1087
+ emitOpenTag(name) {
1088
+ var _a, _b, _c, _d;
1089
+ this.openTagStart = this.startIndex;
1090
+ this.tagname = name;
1091
+ const impliesClose = !this.options.xmlMode && openImpliesClose.get(name);
1092
+ if (impliesClose) {
1093
+ while (this.stack.length > 0 &&
1094
+ impliesClose.has(this.stack[this.stack.length - 1])) {
1095
+ const element = this.stack.pop();
1096
+ (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, element, true);
1097
+ }
1098
+ }
1099
+ if (!this.isVoidElement(name)) {
1100
+ this.stack.push(name);
1101
+ if (foreignContextElements.has(name)) {
1102
+ this.foreignContext.push(true);
1103
+ }
1104
+ else if (htmlIntegrationElements.has(name)) {
1105
+ this.foreignContext.push(false);
1106
+ }
1107
+ }
1108
+ (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);
1109
+ if (this.cbs.onopentag)
1110
+ this.attribs = {};
1111
+ }
1112
+ endOpenTag(isImplied) {
1113
+ var _a, _b;
1114
+ this.startIndex = this.openTagStart;
1115
+ if (this.attribs) {
1116
+ (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied);
1117
+ this.attribs = null;
1118
+ }
1119
+ if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {
1120
+ this.cbs.onclosetag(this.tagname, true);
1121
+ }
1122
+ this.tagname = "";
1123
+ }
1124
+ /** @internal */
1125
+ onopentagend(endIndex) {
1126
+ this.endIndex = endIndex;
1127
+ this.endOpenTag(false);
1128
+ // Set `startIndex` for next node
1129
+ this.startIndex = endIndex + 1;
1130
+ }
1131
+ /** @internal */
1132
+ onclosetag(start, endIndex) {
1133
+ var _a, _b, _c, _d, _e, _f;
1134
+ this.endIndex = endIndex;
1135
+ let name = this.getSlice(start, endIndex);
1136
+ if (this.lowerCaseTagNames) {
1137
+ name = name.toLowerCase();
1138
+ }
1139
+ if (foreignContextElements.has(name) ||
1140
+ htmlIntegrationElements.has(name)) {
1141
+ this.foreignContext.pop();
1142
+ }
1143
+ if (!this.isVoidElement(name)) {
1144
+ const pos = this.stack.lastIndexOf(name);
1145
+ if (pos !== -1) {
1146
+ if (this.cbs.onclosetag) {
1147
+ let count = this.stack.length - pos;
1148
+ while (count--) {
1149
+ // We know the stack has sufficient elements.
1150
+ this.cbs.onclosetag(this.stack.pop(), count !== 0);
1151
+ }
1152
+ }
1153
+ else
1154
+ this.stack.length = pos;
1155
+ }
1156
+ else if (!this.options.xmlMode && name === "p") {
1157
+ // Implicit open before close
1158
+ this.emitOpenTag("p");
1159
+ this.closeCurrentTag(true);
1160
+ }
1161
+ }
1162
+ else if (!this.options.xmlMode && name === "br") {
1163
+ // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.
1164
+ (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, "br");
1165
+ (_d = (_c = this.cbs).onopentag) === null || _d === void 0 ? void 0 : _d.call(_c, "br", {}, true);
1166
+ (_f = (_e = this.cbs).onclosetag) === null || _f === void 0 ? void 0 : _f.call(_e, "br", false);
1167
+ }
1168
+ // Set `startIndex` for next node
1169
+ this.startIndex = endIndex + 1;
1170
+ }
1171
+ /** @internal */
1172
+ onselfclosingtag(endIndex) {
1173
+ this.endIndex = endIndex;
1174
+ if (this.options.xmlMode ||
1175
+ this.options.recognizeSelfClosing ||
1176
+ this.foreignContext[this.foreignContext.length - 1]) {
1177
+ this.closeCurrentTag(false);
1178
+ // Set `startIndex` for next node
1179
+ this.startIndex = endIndex + 1;
1180
+ }
1181
+ else {
1182
+ // Ignore the fact that the tag is self-closing.
1183
+ this.onopentagend(endIndex);
1184
+ }
1185
+ }
1186
+ closeCurrentTag(isOpenImplied) {
1187
+ var _a, _b;
1188
+ const name = this.tagname;
1189
+ this.endOpenTag(isOpenImplied);
1190
+ // Self-closing tags will be on the top of the stack
1191
+ if (this.stack[this.stack.length - 1] === name) {
1192
+ // If the opening tag isn't implied, the closing tag has to be implied.
1193
+ (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied);
1194
+ this.stack.pop();
1195
+ }
1196
+ }
1197
+ /** @internal */
1198
+ onattribname(start, endIndex) {
1199
+ this.startIndex = start;
1200
+ const name = this.getSlice(start, endIndex);
1201
+ this.attribname = this.lowerCaseAttributeNames
1202
+ ? name.toLowerCase()
1203
+ : name;
1204
+ }
1205
+ /** @internal */
1206
+ onattribdata(start, endIndex) {
1207
+ this.attribvalue += this.getSlice(start, endIndex);
1208
+ }
1209
+ /** @internal */
1210
+ onattribentity(cp) {
1211
+ this.attribvalue += fromCodePoint(cp);
1212
+ }
1213
+ /** @internal */
1214
+ onattribend(quote, endIndex) {
1215
+ var _a, _b;
1216
+ this.endIndex = endIndex;
1217
+ (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double
1218
+ ? '"'
1219
+ : quote === QuoteType.Single
1220
+ ? "'"
1221
+ : quote === QuoteType.NoValue
1222
+ ? undefined
1223
+ : null);
1224
+ if (this.attribs &&
1225
+ !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {
1226
+ this.attribs[this.attribname] = this.attribvalue;
1227
+ }
1228
+ this.attribvalue = "";
1229
+ }
1230
+ getInstructionName(value) {
1231
+ const index = value.search(reNameEnd);
1232
+ let name = index < 0 ? value : value.substr(0, index);
1233
+ if (this.lowerCaseTagNames) {
1234
+ name = name.toLowerCase();
1235
+ }
1236
+ return name;
1237
+ }
1238
+ /** @internal */
1239
+ ondeclaration(start, endIndex) {
1240
+ this.endIndex = endIndex;
1241
+ const value = this.getSlice(start, endIndex);
1242
+ if (this.cbs.onprocessinginstruction) {
1243
+ const name = this.getInstructionName(value);
1244
+ this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
1245
+ }
1246
+ // Set `startIndex` for next node
1247
+ this.startIndex = endIndex + 1;
1248
+ }
1249
+ /** @internal */
1250
+ onprocessinginstruction(start, endIndex) {
1251
+ this.endIndex = endIndex;
1252
+ const value = this.getSlice(start, endIndex);
1253
+ if (this.cbs.onprocessinginstruction) {
1254
+ const name = this.getInstructionName(value);
1255
+ this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
1256
+ }
1257
+ // Set `startIndex` for next node
1258
+ this.startIndex = endIndex + 1;
1259
+ }
1260
+ /** @internal */
1261
+ oncomment(start, endIndex, offset) {
1262
+ var _a, _b, _c, _d;
1263
+ this.endIndex = endIndex;
1264
+ (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset));
1265
+ (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);
1266
+ // Set `startIndex` for next node
1267
+ this.startIndex = endIndex + 1;
1268
+ }
1269
+ /** @internal */
1270
+ oncdata(start, endIndex, offset) {
1271
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1272
+ this.endIndex = endIndex;
1273
+ const value = this.getSlice(start, endIndex - offset);
1274
+ if (this.options.xmlMode || this.options.recognizeCDATA) {
1275
+ (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);
1276
+ (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
1277
+ (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);
1278
+ }
1279
+ else {
1280
+ (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);
1281
+ (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);
1282
+ }
1283
+ // Set `startIndex` for next node
1284
+ this.startIndex = endIndex + 1;
1285
+ }
1286
+ /** @internal */
1287
+ onend() {
1288
+ var _a, _b;
1289
+ if (this.cbs.onclosetag) {
1290
+ // Set the end index for all remaining tags
1291
+ this.endIndex = this.startIndex;
1292
+ for (let index = this.stack.length; index > 0; this.cbs.onclosetag(this.stack[--index], true))
1293
+ ;
1294
+ }
1295
+ (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);
1296
+ }
1297
+ /**
1298
+ * Resets the parser to a blank state, ready to parse a new HTML document
1299
+ */
1300
+ reset() {
1301
+ var _a, _b, _c, _d;
1302
+ (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);
1303
+ this.tokenizer.reset();
1304
+ this.tagname = "";
1305
+ this.attribname = "";
1306
+ this.attribs = null;
1307
+ this.stack.length = 0;
1308
+ this.startIndex = 0;
1309
+ this.endIndex = 0;
1310
+ (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);
1311
+ this.buffers.length = 0;
1312
+ this.bufferOffset = 0;
1313
+ this.writeIndex = 0;
1314
+ this.ended = false;
1315
+ }
1316
+ /**
1317
+ * Resets the parser, then parses a complete document and
1318
+ * pushes it to the handler.
1319
+ *
1320
+ * @param data Document to parse.
1321
+ */
1322
+ parseComplete(data) {
1323
+ this.reset();
1324
+ this.end(data);
1325
+ }
1326
+ getSlice(start, end) {
1327
+ while (start - this.bufferOffset >= this.buffers[0].length) {
1328
+ this.shiftBuffer();
1329
+ }
1330
+ let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);
1331
+ while (end - this.bufferOffset > this.buffers[0].length) {
1332
+ this.shiftBuffer();
1333
+ slice += this.buffers[0].slice(0, end - this.bufferOffset);
1334
+ }
1335
+ return slice;
1336
+ }
1337
+ shiftBuffer() {
1338
+ this.bufferOffset += this.buffers[0].length;
1339
+ this.writeIndex--;
1340
+ this.buffers.shift();
1341
+ }
1342
+ /**
1343
+ * Parses a chunk of data and calls the corresponding callbacks.
1344
+ *
1345
+ * @param chunk Chunk to parse.
1346
+ */
1347
+ write(chunk) {
1348
+ var _a, _b;
1349
+ if (this.ended) {
1350
+ (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(".write() after done!"));
1351
+ return;
1352
+ }
1353
+ this.buffers.push(chunk);
1354
+ if (this.tokenizer.running) {
1355
+ this.tokenizer.write(chunk);
1356
+ this.writeIndex++;
1357
+ }
1358
+ }
1359
+ /**
1360
+ * Parses the end of the buffer and clears the stack, calls onend.
1361
+ *
1362
+ * @param chunk Optional final chunk to parse.
1363
+ */
1364
+ end(chunk) {
1365
+ var _a, _b;
1366
+ if (this.ended) {
1367
+ (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(".end() after done!"));
1368
+ return;
1369
+ }
1370
+ if (chunk)
1371
+ this.write(chunk);
1372
+ this.ended = true;
1373
+ this.tokenizer.end();
1374
+ }
1375
+ /**
1376
+ * Pauses parsing. The parser won't emit events until `resume` is called.
1377
+ */
1378
+ pause() {
1379
+ this.tokenizer.pause();
1380
+ }
1381
+ /**
1382
+ * Resumes parsing after `pause` was called.
1383
+ */
1384
+ resume() {
1385
+ this.tokenizer.resume();
1386
+ while (this.tokenizer.running &&
1387
+ this.writeIndex < this.buffers.length) {
1388
+ this.tokenizer.write(this.buffers[this.writeIndex++]);
1389
+ }
1390
+ if (this.ended)
1391
+ this.tokenizer.end();
1392
+ }
1393
+ /**
1394
+ * Alias of `write`, for backwards compatibility.
1395
+ *
1396
+ * @param chunk Chunk to parse.
1397
+ * @deprecated
1398
+ */
1399
+ parseChunk(chunk) {
1400
+ this.write(chunk);
1401
+ }
1402
+ /**
1403
+ * Alias of `end`, for backwards compatibility.
1404
+ *
1405
+ * @param chunk Optional final chunk to parse.
1406
+ * @deprecated
1407
+ */
1408
+ done(chunk) {
1409
+ this.end(chunk);
1410
+ }
1411
+ }
1412
+
1413
+ // Helper methods
1414
+ /**
1415
+ * Parses the data, returns the resulting document.
1416
+ *
1417
+ * @param data The data that should be parsed.
1418
+ * @param options Optional options for the parser and DOM builder.
1419
+ */
1420
+ function parseDocument(data, options) {
1421
+ const handler = new DomHandler(undefined, options);
1422
+ new Parser(handler, options).end(data);
1423
+ return handler.root;
1424
+ }
1425
+
1426
+ export { parseDocument as p };