@coderminer/vue-markdown 1.0.0 → 1.0.1

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 (179) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +7 -2
  3. package/README.zh-CN.md +6 -3
  4. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +0 -2
  5. package/dist/chunks/MarkdownBreak-BwCi2Itt.js +0 -2
  6. package/dist/chunks/MarkdownCode-B1k9tmW5.js +0 -2
  7. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +0 -2
  8. package/dist/chunks/MarkdownContent-BAK6dqo7.js +0 -2
  9. package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
  10. package/dist/chunks/MarkdownEmphasis-CppivOEu.js +0 -2
  11. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +0 -2
  12. package/dist/chunks/MarkdownError-C0sPs5W0.js +0 -2
  13. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +0 -2
  14. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +0 -2
  15. package/dist/chunks/MarkdownHeading-DaNcP0_6.js +0 -2
  16. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +0 -2
  17. package/dist/chunks/MarkdownHtml-66lYkvwM.js +0 -2
  18. package/dist/chunks/MarkdownImage-BRy76svs.js +0 -2
  19. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +0 -2
  20. package/dist/chunks/MarkdownLink-Dbx3NwgV.js +0 -2
  21. package/dist/chunks/MarkdownList-BJ-_C71k.js +0 -2
  22. package/dist/chunks/MarkdownListItem-Z1EHIY26.js +0 -2
  23. package/dist/chunks/MarkdownLoading-D-RYtXxf.js +0 -2
  24. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +0 -2
  25. package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
  26. package/dist/chunks/MarkdownRoot-DEE6iVfh.js +0 -2
  27. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +0 -2
  28. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +0 -2
  29. package/dist/chunks/MarkdownTable-DmBTg_CR.js +0 -2
  30. package/dist/chunks/MarkdownTableCell-eiCJe847.js +0 -2
  31. package/dist/chunks/MarkdownTableRow-DuJaPntg.js +0 -2
  32. package/dist/chunks/MarkdownTableSection-PFHz-R33.js +0 -2
  33. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +0 -2
  34. package/dist/chunks/{MarkdownToc-BdOHF-Yo.js → MarkdownToc-DHWWoH6t.js} +1 -3
  35. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +0 -2
  36. package/dist/chunks/{MermaidLiveEditor-W-qf3G-5.js → MermaidLiveEditor-1TKkI5bp.js} +1 -3
  37. package/dist/chunks/{VueSyntaxHighlighter-DyLsYMwy.js → VueSyntaxHighlighter-BWpCO-cX.js} +1 -3
  38. package/dist/chunks/adapters-CMwX_NEI.js +0 -2
  39. package/dist/chunks/{blank-line-Cb-JBP_5.js → blank-line-CKKsFeKR.js} +1 -3
  40. package/dist/chunks/codemirror-DyphMAEg.js +0 -2
  41. package/dist/chunks/config-aRYo2R8_.js +0 -2
  42. package/dist/chunks/context-8NfW6fxI.js +0 -2
  43. package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
  44. package/dist/chunks/default-ZQ5aHh-N.js +3 -0
  45. package/dist/chunks/diagnostics-CtHoJyiX.js +0 -2
  46. package/dist/chunks/{export-DZQ3cUry.js → export-BrgMLgUp.js} +13 -14
  47. package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
  48. package/dist/chunks/{lib-BQiWGWpu.js → hast-util-from-html-D3e_iQ89.js} +495 -494
  49. package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
  50. package/dist/chunks/{identity-jZEhX2d5.js → identity-Bi27FKyx.js} +7 -8
  51. package/dist/chunks/labels-BtHiUTQI.js +0 -2
  52. package/dist/chunks/lib-CCnkLL6S.js +252 -0
  53. package/dist/chunks/longest-streak-DZE_EqsU.js +0 -2
  54. package/dist/chunks/{micromark-factory-space-Db040TnW.js → micromark-factory-space-CpXAnYUY.js} +2 -4
  55. package/dist/chunks/{normalize-CRYv3Wqt.js → normalize-VKfQXZiK.js} +57 -51
  56. package/dist/chunks/{plugin-DqkFHyny.js → plugin-YWo5uqTh.js} +1 -2
  57. package/dist/chunks/preset-BjaOuJUL.js +0 -2
  58. package/dist/chunks/{registry-DLjr93-V.js → registry-B7BfEkuy.js} +1051 -1045
  59. package/dist/chunks/{render-Cs8iKrgz.js → render-DAqK0w5J.js} +524 -494
  60. package/dist/chunks/{default-DWVS-I_8.js → rolldown-runtime-QGRDbDUS.js} +1 -5
  61. package/dist/chunks/{runtime-DJMnzjah.js → runtime-D95F41zG.js} +145 -117
  62. package/dist/chunks/security-y4EwUyAs.js +0 -2
  63. package/dist/chunks/{shared-DNAvZ-UY.js → shared-NjFDPmkb.js} +18 -27
  64. package/dist/chunks/{space-separated-tokens-CmBjEPdR.js → space-separated-tokens-1ebNqf35.js} +1 -3
  65. package/dist/chunks/url-D2BoivaE.js +0 -2
  66. package/dist/chunks/{useActiveHeading-BaGVMJnB.js → useActiveHeading-CnyGTG1u.js} +165 -122
  67. package/dist/components/CodeBlock.js +1 -1
  68. package/dist/components/MarkdownCustomTag.js +1 -1
  69. package/dist/components/MarkdownMath.js +1 -1
  70. package/dist/components/MarkdownMermaid.d.ts +3 -3
  71. package/dist/components/MarkdownMermaid.js +1 -1
  72. package/dist/components/MarkdownRenderer.d.ts +16 -19
  73. package/dist/components/MarkdownRenderer.js +1 -1
  74. package/dist/components/MarkdownToc.js +1 -1
  75. package/dist/components/MermaidBlock.js +1 -1
  76. package/dist/components/MermaidLiveEditor.js +1 -1
  77. package/dist/components/VueSyntaxHighlighter.js +1 -1
  78. package/dist/components/context.d.ts +2 -2
  79. package/dist/components/index.js +6 -6
  80. package/dist/components/types.d.ts +34 -2
  81. package/dist/composables/useMarkdownDocument.d.ts +2 -0
  82. package/dist/core/hast-nodes.d.ts +0 -3
  83. package/dist/core/hast-to-nodes.d.ts +9 -0
  84. package/dist/core/normalize.d.ts +10 -0
  85. package/dist/core/parts.d.ts +1 -0
  86. package/dist/core/slugger.d.ts +7 -0
  87. package/dist/core/types.d.ts +3 -1
  88. package/dist/headless.js +8 -8
  89. package/dist/highlight/convert-hast.d.ts +8 -0
  90. package/dist/highlight/index.d.ts +2 -1
  91. package/dist/highlight/index.js +4 -3
  92. package/dist/highlight/shared.d.ts +0 -5
  93. package/dist/highlight/shiki.js +2 -3
  94. package/dist/html/index.js +0 -2
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.js +47 -49
  97. package/dist/math/index.js +18 -16
  98. package/dist/mermaid/index.d.ts +2 -1
  99. package/dist/mermaid/index.js +8 -3
  100. package/dist/mermaid/plugin.d.ts +3 -0
  101. package/dist/mermaid/runtime.d.ts +3 -1
  102. package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
  103. package/dist/mermaid/sanitize-svg.d.ts +3 -0
  104. package/dist/mermaid/sanitize.d.ts +6 -2
  105. package/dist/node-components.js +6 -6
  106. package/dist/pipeline.js +1 -1
  107. package/dist/plugins.js +1 -1
  108. package/dist/styles/components.css +25 -0
  109. package/package.json +6 -3
  110. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js.map +0 -1
  111. package/dist/chunks/MarkdownBreak-BwCi2Itt.js.map +0 -1
  112. package/dist/chunks/MarkdownCode-B1k9tmW5.js.map +0 -1
  113. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js.map +0 -1
  114. package/dist/chunks/MarkdownContent-BAK6dqo7.js.map +0 -1
  115. package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js +0 -42
  116. package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js.map +0 -1
  117. package/dist/chunks/MarkdownEmphasis-CppivOEu.js.map +0 -1
  118. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js.map +0 -1
  119. package/dist/chunks/MarkdownError-C0sPs5W0.js.map +0 -1
  120. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js.map +0 -1
  121. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js.map +0 -1
  122. package/dist/chunks/MarkdownHeading-DaNcP0_6.js.map +0 -1
  123. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js.map +0 -1
  124. package/dist/chunks/MarkdownHtml-66lYkvwM.js.map +0 -1
  125. package/dist/chunks/MarkdownImage-BRy76svs.js.map +0 -1
  126. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js.map +0 -1
  127. package/dist/chunks/MarkdownLink-Dbx3NwgV.js.map +0 -1
  128. package/dist/chunks/MarkdownList-BJ-_C71k.js.map +0 -1
  129. package/dist/chunks/MarkdownListItem-Z1EHIY26.js.map +0 -1
  130. package/dist/chunks/MarkdownLoading-D-RYtXxf.js.map +0 -1
  131. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js.map +0 -1
  132. package/dist/chunks/MarkdownRenderer-DLRRfsdI.js +0 -416
  133. package/dist/chunks/MarkdownRenderer-DLRRfsdI.js.map +0 -1
  134. package/dist/chunks/MarkdownRoot-DEE6iVfh.js.map +0 -1
  135. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js.map +0 -1
  136. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js.map +0 -1
  137. package/dist/chunks/MarkdownTable-DmBTg_CR.js.map +0 -1
  138. package/dist/chunks/MarkdownTableCell-eiCJe847.js.map +0 -1
  139. package/dist/chunks/MarkdownTableRow-DuJaPntg.js.map +0 -1
  140. package/dist/chunks/MarkdownTableSection-PFHz-R33.js.map +0 -1
  141. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js.map +0 -1
  142. package/dist/chunks/MarkdownToc-BdOHF-Yo.js.map +0 -1
  143. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js.map +0 -1
  144. package/dist/chunks/MermaidLiveEditor-W-qf3G-5.js.map +0 -1
  145. package/dist/chunks/VueSyntaxHighlighter-DyLsYMwy.js.map +0 -1
  146. package/dist/chunks/adapters-CMwX_NEI.js.map +0 -1
  147. package/dist/chunks/blank-line-Cb-JBP_5.js.map +0 -1
  148. package/dist/chunks/codemirror-DyphMAEg.js.map +0 -1
  149. package/dist/chunks/config-aRYo2R8_.js.map +0 -1
  150. package/dist/chunks/context-8NfW6fxI.js.map +0 -1
  151. package/dist/chunks/default-DWVS-I_8.js.map +0 -1
  152. package/dist/chunks/diagnostics-CtHoJyiX.js.map +0 -1
  153. package/dist/chunks/export-DZQ3cUry.js.map +0 -1
  154. package/dist/chunks/hast-nodes-C0bX3M5Z.js +0 -35
  155. package/dist/chunks/hast-nodes-C0bX3M5Z.js.map +0 -1
  156. package/dist/chunks/highlightjs-BEh-YwEG.js +0 -6041
  157. package/dist/chunks/highlightjs-BEh-YwEG.js.map +0 -1
  158. package/dist/chunks/identity-jZEhX2d5.js.map +0 -1
  159. package/dist/chunks/labels-BtHiUTQI.js.map +0 -1
  160. package/dist/chunks/lib-BQiWGWpu.js.map +0 -1
  161. package/dist/chunks/lib-LwqA_W3J.js +0 -127
  162. package/dist/chunks/lib-LwqA_W3J.js.map +0 -1
  163. package/dist/chunks/longest-streak-DZE_EqsU.js.map +0 -1
  164. package/dist/chunks/micromark-factory-space-Db040TnW.js.map +0 -1
  165. package/dist/chunks/normalize-CRYv3Wqt.js.map +0 -1
  166. package/dist/chunks/plugin-DqkFHyny.js.map +0 -1
  167. package/dist/chunks/preset-BjaOuJUL.js.map +0 -1
  168. package/dist/chunks/registry-DLjr93-V.js.map +0 -1
  169. package/dist/chunks/render-Cs8iKrgz.js.map +0 -1
  170. package/dist/chunks/runtime-DJMnzjah.js.map +0 -1
  171. package/dist/chunks/security-y4EwUyAs.js.map +0 -1
  172. package/dist/chunks/shared-DNAvZ-UY.js.map +0 -1
  173. package/dist/chunks/space-separated-tokens-CmBjEPdR.js.map +0 -1
  174. package/dist/chunks/url-D2BoivaE.js.map +0 -1
  175. package/dist/chunks/useActiveHeading-BaGVMJnB.js.map +0 -1
  176. package/dist/highlight/shiki.js.map +0 -1
  177. package/dist/html/index.js.map +0 -1
  178. package/dist/index.js.map +0 -1
  179. package/dist/math/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"export-DZQ3cUry.js","names":["own","own","emptyChildren","html","body","tbody","element","commas","spaces","node","toHtml","html","toHtml","GithubSlugger","_objectSpread2","applySourceTransforms","withUniqueSlugs","BananaSlug","finalizeMarkdownDocument","defaultPlugins","ccount","resolvePlugins","resolvePipeline","assertPipelineResult","html$2","stringify","stringify$1","svg","find","_asyncToGenerator","VMD_CLASS_PREFIX","PARTS","TOKENS","partAttrs","part","partClass","extra","PART_NAMES","key","TOKEN_NAMES","ALL_TOKENS","manifest","_options$parts","_options$tokens","_options$slots","_options$labels","_options$overrideKeys","options","COMPONENT_MANIFESTS","getComponentManifest","name","validateManifest","issues","snapshot","declared","entry","rendered","label","slot","validateManifestRegistry","names","manifests","htmlVoidElements","own$2","zwitch","settings","one","parameters","fn","handlers","value","id","defaultSubsetRegex","surrogatePairsRegex","controlCharactersRegex","regexEscapeRegex","subsetToRegexCache","core","charactersToExpressionCached","basic","surrogate","pair","all","index","character","cached","subset","charactersToExpression","groups","hexadecimalRegex","toHexadecimal","code","omit","next","decimalRegex","toDecimal","characterEntitiesLegacy","characterEntitiesHtml4","dangerous","own$1","characters","notAlphanumericRegex","toNamed","attribute","formatSmart","numeric","named","decimal","stringifyEntities","htmlCommentRegex","bogusCommentEntitySubset","commentEntitySubset","comment","state","node","encode","$0","doctype","re","whitespace","thing","empty","siblingAfter","siblings","siblingBefore","emptyChildren$1","sibling","parent","offset","increment","includeWhitespace","own","omission","closing","body$1","headOrColgroupOrCaption","html$1","rubyElement","tbody$1","cells","p","li","dt","dd","optgroup","option","thead","tfoot","tr","opening","html","head","seen","child","body","colgroup","previous","tbody","constants","element$1","schema","selfClosing","parts","last","attributes","serializeAttributes","content","values","properties","serializeAttribute","info","x","y","quote","result","textEntitySubset","text","raw","root","handle","invalid","unknown","node_","emptyOptions","emptyCharacterReferences","emptyChildren","toHtml$1","options_","alternative","tree","results","children","rehypeStringify","self","compiler","BOOLEAN_ATTRIBUTES","PROPERTY_ALIASES","attrsToProps","attrs","_attrs$key","_PROPERTY_ALIASES$key","BLOCK_TAGS","element","withBlockNewlines","isBlock","output","alreadySeparated","codeBlock","language","nodeToHast","segment","nodesToHast","_node$rendered","_node$children","nodes","modelToHast","document","prepareMarkdownRun","_options$plugins","_options$disablePlugi","_options$remarkPlugin","_options$rehypePlugin","_options$slugger","_options$remarkRehype","_options$idPrefix","plugins","resolvedPipeline","remarkPlugins","rehypePlugins","transformedSource","source","diagnostics","baseSlugger","slugger","context","toHtml","unified","assertNoErrors","diagnostic","exportMarkdownHtml","_exportMarkdownHtml","_run$slugger$reset","_run$slugger","run","exportMarkdownHtmlSync","_run$slugger$reset2","_run$slugger2","_options$idPrefix2"],"sources":["../../src/core/parts.ts","../../src/core/manifest.ts","../../node_modules/html-void-elements/index.js","../../node_modules/zwitch/index.js","../../node_modules/stringify-entities/lib/core.js","../../node_modules/stringify-entities/lib/util/to-hexadecimal.js","../../node_modules/stringify-entities/lib/util/to-decimal.js","../../node_modules/character-entities-legacy/index.js","../../node_modules/character-entities-html4/index.js","../../node_modules/stringify-entities/lib/constant/dangerous.js","../../node_modules/stringify-entities/lib/util/to-named.js","../../node_modules/stringify-entities/lib/util/format-smart.js","../../node_modules/stringify-entities/lib/index.js","../../node_modules/hast-util-to-html/lib/handle/comment.js","../../node_modules/hast-util-to-html/lib/handle/doctype.js","../../node_modules/hast-util-whitespace/lib/index.js","../../node_modules/hast-util-to-html/lib/omission/util/siblings.js","../../node_modules/hast-util-to-html/lib/omission/omission.js","../../node_modules/hast-util-to-html/lib/omission/closing.js","../../node_modules/hast-util-to-html/lib/omission/opening.js","../../node_modules/hast-util-to-html/lib/handle/element.js","../../node_modules/hast-util-to-html/lib/handle/text.js","../../node_modules/hast-util-to-html/lib/handle/raw.js","../../node_modules/hast-util-to-html/lib/handle/root.js","../../node_modules/hast-util-to-html/lib/handle/index.js","../../node_modules/hast-util-to-html/lib/index.js","../../node_modules/rehype-stringify/lib/index.js","../../src/core/model-hast.ts","../../src/core/run.ts","../../src/export/index.ts"],"sourcesContent":["/**\r\n * Stable part names and token names.\r\n *\r\n * Parts are rendered as `class=\"vmd-<part>\"` plus `data-vmd-part=\"<part>\"`.\r\n * They are stable within a major version and are never generated or hashed.\r\n */\r\n\r\nexport const VMD_CLASS_PREFIX = 'vmd-'\r\n\r\nexport const PARTS = {\r\n root: 'root',\r\n body: 'body',\r\n tocColumn: 'toc-column',\r\n content: 'content',\r\n toc: 'toc',\r\n tocNav: 'toc-nav',\r\n tocItem: 'toc-item',\r\n paragraph: 'paragraph',\r\n heading: 'heading',\r\n headingAnchor: 'heading-anchor',\r\n emphasis: 'emphasis',\r\n strong: 'strong',\r\n strikethrough: 'strikethrough',\r\n link: 'link',\r\n image: 'image',\r\n list: 'list',\r\n listItem: 'list-item',\r\n blockquote: 'blockquote',\r\n hr: 'hr',\r\n break: 'break',\r\n table: 'table',\r\n tableSection: 'table-section',\r\n tableRow: 'table-row',\r\n tableCell: 'table-cell',\r\n inlineCode: 'inline-code',\r\n code: 'code',\r\n codeHeader: 'code-header',\r\n codeTitle: 'code-title',\r\n codeFileName: 'code-file-name',\r\n codeHeading: 'code-heading',\r\n codeLang: 'code-lang',\r\n codeToolbar: 'code-toolbar',\r\n codeActions: 'code-actions',\r\n codeAction: 'code-action',\r\n codeBody: 'code-body',\r\n codeFeedback: 'code-feedback',\r\n highlighter: 'highlighter',\r\n highlighterHeader: 'highlighter-header',\r\n highlighterActions: 'highlighter-actions',\r\n highlighterFooter: 'highlighter-footer',\r\n highlighterBody: 'highlighter-body',\r\n highlighterGutter: 'highlighter-gutter',\r\n highlighterLine: 'highlighter-line',\r\n highlighterHidden: 'highlighter-hidden',\r\n highlighterEmpty: 'highlighter-empty',\r\n highlighterToggle: 'highlighter-toggle',\r\n math: 'math',\r\n mathError: 'math-error',\r\n mermaid: 'mermaid',\r\n mermaidHeader: 'mermaid-header',\r\n mermaidTabs: 'mermaid-tabs',\r\n mermaidActions: 'mermaid-actions',\r\n mermaidAction: 'mermaid-action',\r\n mermaidPreview: 'mermaid-preview',\r\n mermaidSource: 'mermaid-source',\r\n mermaidPending: 'mermaid-pending',\r\n mermaidError: 'mermaid-error',\r\n mermaidFallback: 'mermaid-fallback',\r\n mermaidFullscreen: 'mermaid-fullscreen',\r\n editor: 'editor',\r\n editorPane: 'editor-pane',\r\n editorDivider: 'editor-divider',\r\n editorPreview: 'editor-preview',\r\n editorDiagnostics: 'editor-diagnostics',\r\n editorEmpty: 'editor-empty',\r\n editorToolbar: 'editor-toolbar',\r\n editorFullscreen: 'editor-fullscreen',\r\n html: 'html',\r\n customTag: 'custom-tag',\r\n taskItem: 'task-item',\r\n taskCheckbox: 'task-checkbox',\r\n footnoteReference: 'footnote-reference',\r\n footnotes: 'footnotes',\r\n searchMatch: 'search-match',\r\n error: 'error',\r\n empty: 'empty',\r\n loading: 'loading',\r\n} as const\r\n\r\nexport type MarkdownPart = (typeof PARTS)[keyof typeof PARTS]\r\n\r\nexport const TOKENS = {\r\n fontFamily: '--vmd-font-family',\r\n fontMono: '--vmd-font-mono',\r\n fontSize: '--vmd-font-size',\r\n lineHeight: '--vmd-line-height',\r\n colorText: '--vmd-color-text',\r\n colorMuted: '--vmd-color-muted',\r\n colorBg: '--vmd-color-bg',\r\n colorSurface: '--vmd-color-surface',\r\n colorBorder: '--vmd-color-border',\r\n colorAccent: '--vmd-color-accent',\r\n colorAccentContrast: '--vmd-color-accent-contrast',\r\n colorDanger: '--vmd-color-danger',\r\n colorSuccess: '--vmd-color-success',\r\n space1: '--vmd-space-1',\r\n space2: '--vmd-space-2',\r\n space3: '--vmd-space-3',\r\n space4: '--vmd-space-4',\r\n space5: '--vmd-space-5',\r\n space6: '--vmd-space-6',\r\n radiusSm: '--vmd-radius-sm',\r\n radiusMd: '--vmd-radius-md',\r\n radiusLg: '--vmd-radius-lg',\r\n shadowSm: '--vmd-shadow-sm',\r\n shadowMd: '--vmd-shadow-md',\r\n motionDuration: '--vmd-motion-duration',\r\n motionEasing: '--vmd-motion-easing',\r\n codeBg: '--vmd-code-bg',\r\n codeText: '--vmd-code-text',\r\n codeBorder: '--vmd-code-border',\r\n codeToolbarBg: '--vmd-code-toolbar-bg',\r\n mathColor: '--vmd-math-color',\r\n mathBg: '--vmd-math-bg',\r\n mermaidBg: '--vmd-mermaid-bg',\r\n mermaidBorder: '--vmd-mermaid-border',\r\n zFullscreen: '--vmd-z-fullscreen',\r\n} as const\r\n\r\nexport type MarkdownToken = (typeof TOKENS)[keyof typeof TOKENS]\r\n\r\nexport interface PartAttributes {\r\n class: string\r\n 'data-vmd-part': string\r\n}\r\n\r\n/** Build the class and `data-vmd-part` attributes for a documented part. */\r\nexport function partAttrs(part: MarkdownPart): PartAttributes {\r\n return {\r\n class: `${VMD_CLASS_PREFIX}${part}`,\r\n 'data-vmd-part': part,\r\n }\r\n}\r\n\r\n/** Merge part attributes with host-provided class names. */\r\nexport function partClass(part: MarkdownPart, extra?: string): string {\r\n return extra\r\n ? `${VMD_CLASS_PREFIX}${part} ${extra}`\r\n : `${VMD_CLASS_PREFIX}${part}`\r\n}\r\n\r\nexport const PART_NAMES: readonly MarkdownPart[] = Object.keys(PARTS).map(\r\n (key) => PARTS[key as keyof typeof PARTS],\r\n)\r\nexport const TOKEN_NAMES: readonly MarkdownToken[] = Object.keys(TOKENS).map(\r\n (key) => TOKENS[key as keyof typeof TOKENS],\r\n)\r\n","import { PARTS, TOKEN_NAMES } from './parts'\r\nimport type { MarkdownPart } from './parts'\r\n\r\n/**\r\n * Machine-readable customization manifest for one public component.\r\n *\r\n * Manifests are Vue-free so documentation, the demo inspector, and validation\r\n * tests can consume them without importing component code.\r\n */\r\nexport interface MarkdownComponentManifest {\r\n name: string\r\n parts: readonly MarkdownPart[]\r\n tokens: readonly string[]\r\n slots: readonly string[]\r\n labels: readonly string[]\r\n overrideKeys: readonly string[]\r\n tags?: readonly string[]\r\n behaviors?: readonly string[]\r\n}\r\n\r\nexport type ManifestIssueCode =\r\n | 'duplicate-manifest'\r\n | 'undeclared-part'\r\n | 'missing-part'\r\n | 'undeclared-label'\r\n | 'missing-slot'\r\n\r\nexport interface ManifestValidationIssue {\r\n code: ManifestIssueCode\r\n component: string\r\n message: string\r\n}\r\n\r\nexport interface ManifestRenderSnapshot {\r\n parts?: readonly string[]\r\n labels?: readonly string[]\r\n slots?: readonly string[]\r\n /** `strict` also requires every declared part to be rendered. */\r\n mode?: 'strict' | 'observed'\r\n}\r\n\r\nconst ALL_TOKENS = TOKEN_NAMES\r\n\r\nconst manifest = (\r\n name: string,\r\n options: {\r\n parts?: MarkdownPart[]\r\n tokens?: readonly string[]\r\n slots?: string[]\r\n labels?: string[]\r\n overrideKeys?: string[]\r\n tags?: string[]\r\n behaviors?: string[]\r\n },\r\n): MarkdownComponentManifest => ({\r\n name,\r\n parts: options.parts ?? [],\r\n tokens: options.tokens ?? [],\r\n slots: options.slots ?? [],\r\n labels: options.labels ?? [],\r\n overrideKeys: options.overrideKeys ?? [],\r\n tags: options.tags,\r\n behaviors: options.behaviors,\r\n})\r\n\r\nexport const COMPONENT_MANIFESTS: Record<string, MarkdownComponentManifest> = {\r\n MarkdownRenderer: manifest('MarkdownRenderer', {\r\n parts: Object.values(PARTS),\r\n tokens: ALL_TOKENS,\r\n slots: [\r\n 'root',\r\n 'toc',\r\n 'toc-item',\r\n 'content',\r\n 'error',\r\n 'empty',\r\n 'loading',\r\n 'code',\r\n 'code-actions',\r\n 'header',\r\n 'toolbar',\r\n 'tabs',\r\n 'actions',\r\n 'footer',\r\n 'highlighter',\r\n 'math',\r\n 'math-error',\r\n 'mermaid',\r\n 'mermaid-error',\r\n 'editor',\r\n 'editor-diagnostics',\r\n 'preview',\r\n 'fullscreen',\r\n ],\r\n labels: ['toc', 'error', 'empty', 'loading', 'headingAnchor'],\r\n overrideKeys: ['components', 'regions', 'nodeComponents', 'labels', 'theme', 'tokens'],\r\n behaviors: ['pipeline', 'slugger', 'urlTransform', 'highlighter', 'mathEngine', 'mermaidRenderer', 'diagnosticsFormatter'],\r\n }),\r\n MarkdownRoot: manifest('MarkdownRoot', {\r\n parts: ['root'],\r\n tokens: ALL_TOKENS,\r\n slots: ['default'],\r\n overrideKeys: ['as', 'tokens', 'theme'],\r\n }),\r\n MarkdownContent: manifest('MarkdownContent', {\r\n parts: ['content'],\r\n slots: ['default'],\r\n overrideKeys: ['regions.content'],\r\n }),\r\n MarkdownToc: manifest('MarkdownToc', {\r\n parts: ['toc', 'toc-nav', 'toc-item'],\r\n tokens: ['--vmd-color-accent', '--vmd-color-muted', '--vmd-space-1', '--vmd-space-3', '--vmd-space-4'],\r\n labels: ['toc'],\r\n overrideKeys: ['regions.toc', 'regions.tocItem', 'tocItem'],\r\n }),\r\n MarkdownTocItem: manifest('MarkdownTocItem', {\r\n parts: ['toc-item'],\r\n tokens: ['--vmd-color-accent', '--vmd-color-muted'],\r\n labels: ['toc'],\r\n overrideKeys: ['regions.tocItem'],\r\n }),\r\n MarkdownError: manifest('MarkdownError', {\r\n parts: ['error'],\r\n tokens: ['--vmd-color-danger', '--vmd-space-3', '--vmd-space-4', '--vmd-radius-md'],\r\n labels: ['error'],\r\n overrideKeys: ['regions.error'],\r\n }),\r\n MarkdownEmpty: manifest('MarkdownEmpty', {\r\n parts: ['empty'],\r\n tokens: ['--vmd-color-muted'],\r\n labels: ['empty'],\r\n overrideKeys: ['regions.empty'],\r\n }),\r\n MarkdownLoading: manifest('MarkdownLoading', {\r\n parts: ['loading'],\r\n tokens: ['--vmd-color-muted'],\r\n labels: ['loading'],\r\n overrideKeys: ['regions.loading'],\r\n }),\r\n MarkdownParagraph: manifest('MarkdownParagraph', {\r\n parts: ['paragraph'],\r\n tokens: ['--vmd-space-4'],\r\n slots: ['default'],\r\n overrideKeys: ['p', 'paragraph'],\r\n tags: ['p'],\r\n }),\r\n MarkdownHeading: manifest('MarkdownHeading', {\r\n parts: ['heading', 'heading-anchor'],\r\n tokens: ['--vmd-space-2', '--vmd-space-3', '--vmd-space-5', '--vmd-color-muted'],\r\n slots: ['default'],\r\n labels: ['headingAnchor'],\r\n overrideKeys: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'heading'],\r\n tags: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],\r\n }),\r\n MarkdownEmphasis: manifest('MarkdownEmphasis', {\r\n parts: ['emphasis'],\r\n slots: ['default'],\r\n overrideKeys: ['em', 'emphasis'],\r\n tags: ['em'],\r\n }),\r\n MarkdownStrong: manifest('MarkdownStrong', {\r\n parts: ['strong'],\r\n slots: ['default'],\r\n overrideKeys: ['strong'],\r\n tags: ['strong'],\r\n }),\r\n MarkdownStrikethrough: manifest('MarkdownStrikethrough', {\r\n parts: ['strikethrough'],\r\n slots: ['default'],\r\n overrideKeys: ['del', 'strikethrough'],\r\n tags: ['del'],\r\n }),\r\n MarkdownLink: manifest('MarkdownLink', {\r\n parts: ['link'],\r\n tokens: ['--vmd-color-accent'],\r\n slots: ['default'],\r\n labels: ['externalLink'],\r\n overrideKeys: ['a', 'link'],\r\n tags: ['a'],\r\n }),\r\n MarkdownImage: manifest('MarkdownImage', {\r\n parts: ['image'],\r\n slots: ['fallback'],\r\n overrideKeys: ['img', 'image'],\r\n tags: ['img'],\r\n }),\r\n MarkdownList: manifest('MarkdownList', {\r\n parts: ['list'],\r\n tokens: ['--vmd-space-4', '--vmd-space-5'],\r\n slots: ['default'],\r\n overrideKeys: ['ul', 'ol', 'list'],\r\n tags: ['ul', 'ol'],\r\n }),\r\n MarkdownListItem: manifest('MarkdownListItem', {\r\n parts: ['list-item'],\r\n tokens: ['--vmd-space-1'],\r\n slots: ['default'],\r\n overrideKeys: ['li', 'listItem'],\r\n tags: ['li'],\r\n }),\r\n MarkdownBlockquote: manifest('MarkdownBlockquote', {\r\n parts: ['blockquote'],\r\n tokens: ['--vmd-space-4', '--vmd-color-border', '--vmd-color-muted'],\r\n slots: ['default'],\r\n overrideKeys: ['blockquote'],\r\n tags: ['blockquote'],\r\n }),\r\n MarkdownHorizontalRule: manifest('MarkdownHorizontalRule', {\r\n parts: ['hr'],\r\n tokens: ['--vmd-space-5', '--vmd-color-border'],\r\n overrideKeys: ['hr', 'horizontalRule'],\r\n tags: ['hr'],\r\n }),\r\n MarkdownTable: manifest('MarkdownTable', {\r\n parts: ['table'],\r\n tokens: ['--vmd-space-4'],\r\n slots: ['default'],\r\n overrideKeys: ['table'],\r\n tags: ['table'],\r\n }),\r\n MarkdownTableSection: manifest('MarkdownTableSection', {\r\n parts: ['table-section'],\r\n tokens: ['--vmd-color-surface'],\r\n slots: ['default'],\r\n overrideKeys: ['thead', 'tbody', 'tfoot', 'tableSection'],\r\n tags: ['thead', 'tbody', 'tfoot'],\r\n }),\r\n MarkdownTableRow: manifest('MarkdownTableRow', {\r\n parts: ['table-row'],\r\n slots: ['default'],\r\n overrideKeys: ['tr', 'tableRow'],\r\n tags: ['tr'],\r\n }),\r\n MarkdownTableCell: manifest('MarkdownTableCell', {\r\n parts: ['table-cell'],\r\n tokens: ['--vmd-space-2', '--vmd-space-3', '--vmd-color-border'],\r\n slots: ['default'],\r\n overrideKeys: ['th', 'td', 'tableCell'],\r\n tags: ['th', 'td'],\r\n }),\r\n MarkdownInlineCode: manifest('MarkdownInlineCode', {\r\n parts: ['inline-code'],\r\n tokens: ['--vmd-code-bg', '--vmd-code-text', '--vmd-font-mono', '--vmd-radius-sm'],\r\n slots: ['default'],\r\n overrideKeys: ['code', 'inlineCode'],\r\n tags: ['code'],\r\n }),\r\n MarkdownCode: manifest('MarkdownCode', {\r\n parts: ['code'],\r\n tokens: ['--vmd-code-bg', '--vmd-code-text', '--vmd-code-border', '--vmd-code-toolbar-bg', '--vmd-font-mono'],\r\n slots: ['default', 'code', 'code-actions'],\r\n labels: ['copy', 'copied', 'download'],\r\n overrideKeys: ['pre', 'code'],\r\n tags: ['pre', 'code'],\r\n behaviors: ['highlighter'],\r\n }),\r\n CodeBlock: manifest('CodeBlock', {\r\n parts: [\r\n 'code',\r\n 'code-header',\r\n 'code-heading',\r\n 'code-title',\r\n 'code-file-name',\r\n 'code-lang',\r\n 'code-toolbar',\r\n 'code-body',\r\n 'code-action',\r\n 'code-feedback',\r\n 'highlighter-line',\r\n 'highlighter-gutter',\r\n 'highlighter-toggle',\r\n ],\r\n tokens: ['--vmd-code-bg', '--vmd-code-text', '--vmd-code-border', '--vmd-code-toolbar-bg', '--vmd-font-mono'],\r\n slots: ['code', 'code-actions', 'header', 'toolbar'],\r\n labels: ['copy', 'copied', 'copyFailed', 'download', 'showAll', 'showLess'],\r\n overrideKeys: ['pre', 'code', 'codeBlock'],\r\n tags: ['pre', 'code'],\r\n behaviors: ['highlighter'],\r\n }),\r\n VueSyntaxHighlighter: manifest('VueSyntaxHighlighter', {\r\n parts: [\r\n 'highlighter',\r\n 'highlighter-header',\r\n 'highlighter-actions',\r\n 'highlighter-footer',\r\n 'highlighter-body',\r\n 'highlighter-line',\r\n 'highlighter-gutter',\r\n 'highlighter-empty',\r\n 'highlighter-toggle',\r\n ],\r\n tokens: ['--vmd-code-bg', '--vmd-code-text', '--vmd-font-mono'],\r\n slots: ['header', 'footer', 'empty', 'actions', 'highlighter'],\r\n labels: ['empty', 'showAll', 'showLess', 'copyFailed'],\r\n overrideKeys: ['highlighter'],\r\n behaviors: ['highlighter'],\r\n }),\r\n MarkdownTaskItem: manifest('MarkdownTaskItem', {\r\n parts: ['task-item', 'task-checkbox'],\r\n tokens: ALL_TOKENS,\r\n slots: ['default'],\r\n labels: [],\r\n overrideKeys: ['li', 'taskItem'],\r\n tags: ['li'],\r\n behaviors: ['task-change'],\r\n }),\r\n MarkdownFootnoteReference: manifest('MarkdownFootnoteReference', {\r\n parts: ['footnote-reference'],\r\n labels: ['footnoteReference'],\r\n overrideKeys: ['sup', 'footnoteReference'],\r\n tags: ['sup'],\r\n }),\r\n MarkdownFootnotes: manifest('MarkdownFootnotes', {\r\n parts: ['footnotes'],\r\n labels: ['footnotes'],\r\n slots: ['default'],\r\n overrideKeys: ['section', 'footnotes'],\r\n tags: ['section'],\r\n }),\r\n MarkdownMath: manifest('MarkdownMath', {\r\n parts: ['math'],\r\n tokens: ['--vmd-math-color', '--vmd-math-bg'],\r\n slots: ['math', 'math-error'],\r\n labels: ['math'],\r\n overrideKeys: ['math'],\r\n behaviors: ['mathEngine'],\r\n }),\r\n MermaidBlock: manifest('MermaidBlock', {\r\n parts: [\r\n 'mermaid',\r\n 'mermaid-header',\r\n 'mermaid-tabs',\r\n 'mermaid-actions',\r\n 'mermaid-action',\r\n 'mermaid-preview',\r\n 'mermaid-source',\r\n 'mermaid-pending',\r\n 'mermaid-error',\r\n 'mermaid-fallback',\r\n 'mermaid-fullscreen',\r\n ],\r\n tokens: ['--vmd-mermaid-bg', '--vmd-mermaid-border'],\r\n slots: ['mermaid', 'mermaid-error', 'header', 'tabs', 'actions'],\r\n labels: [\r\n 'mermaid',\r\n 'mermaidFallback',\r\n 'preview',\r\n 'source',\r\n 'retry',\r\n 'exportPng',\r\n 'download',\r\n 'fullscreen',\r\n 'exitFullscreen',\r\n 'zoomIn',\r\n 'zoomOut',\r\n 'reset',\r\n 'copy',\r\n 'copied',\r\n ],\r\n overrideKeys: ['mermaid', 'mermaidBlock'],\r\n behaviors: ['mermaidRenderer'],\r\n }),\r\n MermaidLiveEditor: manifest('MermaidLiveEditor', {\r\n parts: [\r\n 'editor',\r\n 'editor-toolbar',\r\n 'editor-pane',\r\n 'editor-divider',\r\n 'editor-preview',\r\n 'editor-diagnostics',\r\n 'editor-empty',\r\n 'editor-fullscreen',\r\n 'mermaid',\r\n 'mermaid-header',\r\n 'mermaid-tabs',\r\n 'mermaid-actions',\r\n 'mermaid-action',\r\n 'mermaid-preview',\r\n 'mermaid-source',\r\n 'mermaid-pending',\r\n 'mermaid-error',\r\n 'mermaid-fallback',\r\n 'mermaid-fullscreen',\r\n ],\r\n tokens: ALL_TOKENS,\r\n slots: ['toolbar', 'editor', 'preview', 'editor-diagnostics', 'empty', 'fullscreen'],\r\n labels: [\r\n 'editor',\r\n 'editorEmpty',\r\n 'editorLine',\r\n 'editorSplitter',\r\n 'editorDiagnostics',\r\n 'editorReset',\r\n 'editorSyntaxError',\r\n 'editorParseError',\r\n 'fullscreen',\r\n 'exitFullscreen',\r\n 'reset',\r\n 'mermaid',\r\n 'mermaidFallback',\r\n ],\r\n overrideKeys: ['editor', 'diagnosticsFormatter'],\r\n behaviors: ['mermaidRenderer', 'diagnosticsFormatter'],\r\n }),\r\n MarkdownMermaid: manifest('MarkdownMermaid', {\r\n parts: [\r\n 'mermaid',\r\n 'mermaid-header',\r\n 'mermaid-tabs',\r\n 'mermaid-actions',\r\n 'mermaid-action',\r\n 'mermaid-preview',\r\n 'mermaid-source',\r\n 'mermaid-pending',\r\n 'mermaid-error',\r\n 'mermaid-fallback',\r\n 'mermaid-fullscreen',\r\n ],\r\n tokens: ['--vmd-mermaid-bg', '--vmd-mermaid-border'],\r\n slots: ['mermaid', 'mermaid-error', 'header', 'tabs', 'actions'],\r\n labels: [\r\n 'mermaid',\r\n 'mermaidFallback',\r\n 'preview',\r\n 'source',\r\n 'retry',\r\n 'exportPng',\r\n 'download',\r\n 'fullscreen',\r\n 'exitFullscreen',\r\n 'zoomIn',\r\n 'zoomOut',\r\n 'reset',\r\n 'copy',\r\n 'copied',\r\n ],\r\n overrideKeys: ['mermaid', 'mermaidBlock'],\r\n behaviors: ['mermaidRenderer'],\r\n }),\r\n MarkdownBreak: manifest('MarkdownBreak', {\r\n parts: ['break'],\r\n overrideKeys: ['br', 'break'],\r\n tags: ['br'],\r\n }),\r\n MarkdownHtml: manifest('MarkdownHtml', {\r\n parts: ['html'],\r\n overrideKeys: ['html'],\r\n }),\r\n MarkdownCustomTag: manifest('MarkdownCustomTag', {\r\n parts: ['custom-tag'],\r\n slots: ['default'],\r\n overrideKeys: ['customTag', 'x-*'],\r\n }),\r\n MarkdownChildren: manifest('MarkdownChildren', {\r\n parts: [],\r\n overrideKeys: [],\r\n }),\r\n}\r\n\r\nexport function getComponentManifest(\r\n name: string,\r\n): MarkdownComponentManifest | undefined {\r\n return COMPONENT_MANIFESTS[name]\r\n}\r\n\r\n/**\r\n * Compare a manifest with rendered output. Missing snapshot fields are skipped\r\n * so a test can validate only the parts, labels, or slots it can observe.\r\n */\r\nexport function validateManifest(\r\n entry: MarkdownComponentManifest,\r\n snapshot: ManifestRenderSnapshot,\r\n): ManifestValidationIssue[] {\r\n const issues: ManifestValidationIssue[] = []\r\n\r\n if (snapshot.parts) {\r\n const declared = new Set(entry.parts)\r\n const rendered = new Set(snapshot.parts)\r\n for (const part of rendered) {\r\n if (!declared.has(part as MarkdownPart)) {\r\n issues.push({\r\n code: 'undeclared-part',\r\n component: entry.name,\r\n message: `Rendered part \"${part}\" is not declared by ${entry.name}.`,\r\n })\r\n }\r\n }\r\n for (const part of declared) {\r\n if (!rendered.has(part) && snapshot.mode !== 'observed') {\r\n issues.push({\r\n code: 'missing-part',\r\n component: entry.name,\r\n message: `Declared part \"${part}\" was not rendered by ${entry.name}.`,\r\n })\r\n }\r\n }\r\n }\r\n\r\n if (snapshot.labels) {\r\n const declared = new Set(entry.labels)\r\n for (const label of snapshot.labels) {\r\n if (!declared.has(label)) {\r\n issues.push({\r\n code: 'undeclared-label',\r\n component: entry.name,\r\n message: `Label \"${label}\" is not declared by ${entry.name}.`,\r\n })\r\n }\r\n }\r\n }\r\n\r\n if (snapshot.slots) {\r\n const declared = new Set(entry.slots)\r\n for (const slot of snapshot.slots) {\r\n if (!declared.has(slot)) {\r\n issues.push({\r\n code: 'missing-slot',\r\n component: entry.name,\r\n message: `Slot \"${slot}\" is not declared by ${entry.name}.`,\r\n })\r\n }\r\n }\r\n }\r\n\r\n return issues\r\n}\r\n\r\nexport function validateManifestRegistry(\r\n manifests: Record<string, MarkdownComponentManifest> = COMPONENT_MANIFESTS,\r\n): ManifestValidationIssue[] {\r\n const issues: ManifestValidationIssue[] = []\r\n const names = new Set<string>()\r\n for (const entry of Object.values(manifests)) {\r\n if (names.has(entry.name)) {\r\n issues.push({\r\n code: 'duplicate-manifest',\r\n component: entry.name,\r\n message: `Duplicate manifest name \"${entry.name}\".`,\r\n })\r\n }\r\n names.add(entry.name)\r\n }\r\n return issues\r\n}\r\n","/**\n * List of HTML void tag names.\n *\n * @type {Array<string>}\n */\nexport const htmlVoidElements = [\n 'area',\n 'base',\n 'basefont',\n 'bgsound',\n 'br',\n 'col',\n 'command',\n 'embed',\n 'frame',\n 'hr',\n 'image',\n 'img',\n 'input',\n 'keygen',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr'\n]\n","/**\n * @callback Handler\n * Handle a value, with a certain ID field set to a certain value.\n * The ID field is passed to `zwitch`, and it’s value is this function’s\n * place on the `handlers` record.\n * @param {...any} parameters\n * Arbitrary parameters passed to the zwitch.\n * The first will be an object with a certain ID field set to a certain value.\n * @returns {any}\n * Anything!\n */\n\n/**\n * @callback UnknownHandler\n * Handle values that do have a certain ID field, but it’s set to a value\n * that is not listed in the `handlers` record.\n * @param {unknown} value\n * An object with a certain ID field set to an unknown value.\n * @param {...any} rest\n * Arbitrary parameters passed to the zwitch.\n * @returns {any}\n * Anything!\n */\n\n/**\n * @callback InvalidHandler\n * Handle values that do not have a certain ID field.\n * @param {unknown} value\n * Any unknown value.\n * @param {...any} rest\n * Arbitrary parameters passed to the zwitch.\n * @returns {void|null|undefined|never}\n * This should crash or return nothing.\n */\n\n/**\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @typedef Options\n * Configuration (required).\n * @property {Invalid} [invalid]\n * Handler to use for invalid values.\n * @property {Unknown} [unknown]\n * Handler to use for unknown values.\n * @property {Handlers} [handlers]\n * Handlers to use.\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Handle values based on a field.\n *\n * @template {InvalidHandler} [Invalid=InvalidHandler]\n * @template {UnknownHandler} [Unknown=UnknownHandler]\n * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]\n * @param {string} key\n * Field to switch on.\n * @param {Options<Invalid, Unknown, Handlers>} [options]\n * Configuration (required).\n * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}}\n */\nexport function zwitch(key, options) {\n const settings = options || {}\n\n /**\n * Handle one value.\n *\n * Based on the bound `key`, a respective handler will be called.\n * If `value` is not an object, or doesn’t have a `key` property, the special\n * “invalid” handler will be called.\n * If `value` has an unknown `key`, the special “unknown” handler will be\n * called.\n *\n * All arguments, and the context object, are passed through to the handler,\n * and it’s result is returned.\n *\n * @this {unknown}\n * Any context object.\n * @param {unknown} [value]\n * Any value.\n * @param {...unknown} parameters\n * Arbitrary parameters passed to the zwitch.\n * @property {Handler} invalid\n * Handle for values that do not have a certain ID field.\n * @property {Handler} unknown\n * Handle values that do have a certain ID field, but it’s set to a value\n * that is not listed in the `handlers` record.\n * @property {Handlers} handlers\n * Record of handlers.\n * @returns {unknown}\n * Anything.\n */\n function one(value, ...parameters) {\n /** @type {Handler|undefined} */\n let fn = one.invalid\n const handlers = one.handlers\n\n if (value && own.call(value, key)) {\n // @ts-expect-error Indexable.\n const id = String(value[key])\n // @ts-expect-error Indexable.\n fn = own.call(handlers, id) ? handlers[id] : one.unknown\n }\n\n if (fn) {\n return fn.call(this, value, ...parameters)\n }\n }\n\n one.handlers = settings.handlers || {}\n one.invalid = settings.invalid\n one.unknown = settings.unknown\n\n // @ts-expect-error: matches!\n return one\n}\n","/**\n * @typedef CoreOptions\n * @property {ReadonlyArray<string>} [subset=[]]\n * Whether to only escape the given subset of characters.\n * @property {boolean} [escapeOnly=false]\n * Whether to only escape possibly dangerous characters.\n * Those characters are `\"`, `&`, `'`, `<`, `>`, and `` ` ``.\n *\n * @typedef FormatOptions\n * @property {(code: number, next: number, options: CoreWithFormatOptions) => string} format\n * Format strategy.\n *\n * @typedef {CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions} CoreWithFormatOptions\n */\n\nconst defaultSubsetRegex = /[\"&'<>`]/g\nconst surrogatePairsRegex = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g\nconst controlCharactersRegex =\n // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape\n /[\\x01-\\t\\v\\f\\x0E-\\x1F\\x7F\\x81\\x8D\\x8F\\x90\\x9D\\xA0-\\uFFFF]/g\nconst regexEscapeRegex = /[|\\\\{}()[\\]^$+*?.]/g\n\n/** @type {WeakMap<ReadonlyArray<string>, RegExp>} */\nconst subsetToRegexCache = new WeakMap()\n\n/**\n * Encode certain characters in `value`.\n *\n * @param {string} value\n * @param {CoreWithFormatOptions} options\n * @returns {string}\n */\nexport function core(value, options) {\n value = value.replace(\n options.subset\n ? charactersToExpressionCached(options.subset)\n : defaultSubsetRegex,\n basic\n )\n\n if (options.subset || options.escapeOnly) {\n return value\n }\n\n return (\n value\n // Surrogate pairs.\n .replace(surrogatePairsRegex, surrogate)\n // BMP control characters (C0 except for LF, CR, SP; DEL; and some more\n // non-ASCII ones).\n .replace(controlCharactersRegex, basic)\n )\n\n /**\n * @param {string} pair\n * @param {number} index\n * @param {string} all\n */\n function surrogate(pair, index, all) {\n return options.format(\n (pair.charCodeAt(0) - 0xd800) * 0x400 +\n pair.charCodeAt(1) -\n 0xdc00 +\n 0x10000,\n all.charCodeAt(index + 2),\n options\n )\n }\n\n /**\n * @param {string} character\n * @param {number} index\n * @param {string} all\n */\n function basic(character, index, all) {\n return options.format(\n character.charCodeAt(0),\n all.charCodeAt(index + 1),\n options\n )\n }\n}\n\n/**\n * A wrapper function that caches the result of `charactersToExpression` with a WeakMap.\n * This can improve performance when tooling calls `charactersToExpression` repeatedly\n * with the same subset.\n *\n * @param {ReadonlyArray<string>} subset\n * @returns {RegExp}\n */\nfunction charactersToExpressionCached(subset) {\n let cached = subsetToRegexCache.get(subset)\n\n if (!cached) {\n cached = charactersToExpression(subset)\n subsetToRegexCache.set(subset, cached)\n }\n\n return cached\n}\n\n/**\n * @param {ReadonlyArray<string>} subset\n * @returns {RegExp}\n */\nfunction charactersToExpression(subset) {\n /** @type {Array<string>} */\n const groups = []\n let index = -1\n\n while (++index < subset.length) {\n groups.push(subset[index].replace(regexEscapeRegex, '\\\\$&'))\n }\n\n return new RegExp('(?:' + groups.join('|') + ')', 'g')\n}\n","const hexadecimalRegex = /[\\dA-Fa-f]/\n\n/**\n * Configurable ways to encode characters as hexadecimal references.\n *\n * @param {number} code\n * @param {number} next\n * @param {boolean|undefined} omit\n * @returns {string}\n */\nexport function toHexadecimal(code, next, omit) {\n const value = '&#x' + code.toString(16).toUpperCase()\n return omit && next && !hexadecimalRegex.test(String.fromCharCode(next))\n ? value\n : value + ';'\n}\n","const decimalRegex = /\\d/\n\n/**\n * Configurable ways to encode characters as decimal references.\n *\n * @param {number} code\n * @param {number} next\n * @param {boolean|undefined} omit\n * @returns {string}\n */\nexport function toDecimal(code, next, omit) {\n const value = '&#' + String(code)\n return omit && next && !decimalRegex.test(String.fromCharCode(next))\n ? value\n : value + ';'\n}\n","/**\n * List of legacy HTML named character references that don’t need a trailing semicolon.\n *\n * @type {Array<string>}\n */\nexport const characterEntitiesLegacy = [\n 'AElig',\n 'AMP',\n 'Aacute',\n 'Acirc',\n 'Agrave',\n 'Aring',\n 'Atilde',\n 'Auml',\n 'COPY',\n 'Ccedil',\n 'ETH',\n 'Eacute',\n 'Ecirc',\n 'Egrave',\n 'Euml',\n 'GT',\n 'Iacute',\n 'Icirc',\n 'Igrave',\n 'Iuml',\n 'LT',\n 'Ntilde',\n 'Oacute',\n 'Ocirc',\n 'Ograve',\n 'Oslash',\n 'Otilde',\n 'Ouml',\n 'QUOT',\n 'REG',\n 'THORN',\n 'Uacute',\n 'Ucirc',\n 'Ugrave',\n 'Uuml',\n 'Yacute',\n 'aacute',\n 'acirc',\n 'acute',\n 'aelig',\n 'agrave',\n 'amp',\n 'aring',\n 'atilde',\n 'auml',\n 'brvbar',\n 'ccedil',\n 'cedil',\n 'cent',\n 'copy',\n 'curren',\n 'deg',\n 'divide',\n 'eacute',\n 'ecirc',\n 'egrave',\n 'eth',\n 'euml',\n 'frac12',\n 'frac14',\n 'frac34',\n 'gt',\n 'iacute',\n 'icirc',\n 'iexcl',\n 'igrave',\n 'iquest',\n 'iuml',\n 'laquo',\n 'lt',\n 'macr',\n 'micro',\n 'middot',\n 'nbsp',\n 'not',\n 'ntilde',\n 'oacute',\n 'ocirc',\n 'ograve',\n 'ordf',\n 'ordm',\n 'oslash',\n 'otilde',\n 'ouml',\n 'para',\n 'plusmn',\n 'pound',\n 'quot',\n 'raquo',\n 'reg',\n 'sect',\n 'shy',\n 'sup1',\n 'sup2',\n 'sup3',\n 'szlig',\n 'thorn',\n 'times',\n 'uacute',\n 'ucirc',\n 'ugrave',\n 'uml',\n 'uuml',\n 'yacute',\n 'yen',\n 'yuml'\n]\n","/**\n * Map of named character references from HTML 4.\n *\n * @type {Record<string, string>}\n */\nexport const characterEntitiesHtml4 = {\n nbsp: ' ',\n iexcl: '¡',\n cent: '¢',\n pound: '£',\n curren: '¤',\n yen: '¥',\n brvbar: '¦',\n sect: '§',\n uml: '¨',\n copy: '©',\n ordf: 'ª',\n laquo: '«',\n not: '¬',\n shy: '­',\n reg: '®',\n macr: '¯',\n deg: '°',\n plusmn: '±',\n sup2: '²',\n sup3: '³',\n acute: '´',\n micro: 'µ',\n para: '¶',\n middot: '·',\n cedil: '¸',\n sup1: '¹',\n ordm: 'º',\n raquo: '»',\n frac14: '¼',\n frac12: '½',\n frac34: '¾',\n iquest: '¿',\n Agrave: 'À',\n Aacute: 'Á',\n Acirc: 'Â',\n Atilde: 'Ã',\n Auml: 'Ä',\n Aring: 'Å',\n AElig: 'Æ',\n Ccedil: 'Ç',\n Egrave: 'È',\n Eacute: 'É',\n Ecirc: 'Ê',\n Euml: 'Ë',\n Igrave: 'Ì',\n Iacute: 'Í',\n Icirc: 'Î',\n Iuml: 'Ï',\n ETH: 'Ð',\n Ntilde: 'Ñ',\n Ograve: 'Ò',\n Oacute: 'Ó',\n Ocirc: 'Ô',\n Otilde: 'Õ',\n Ouml: 'Ö',\n times: '×',\n Oslash: 'Ø',\n Ugrave: 'Ù',\n Uacute: 'Ú',\n Ucirc: 'Û',\n Uuml: 'Ü',\n Yacute: 'Ý',\n THORN: 'Þ',\n szlig: 'ß',\n agrave: 'à',\n aacute: 'á',\n acirc: 'â',\n atilde: 'ã',\n auml: 'ä',\n aring: 'å',\n aelig: 'æ',\n ccedil: 'ç',\n egrave: 'è',\n eacute: 'é',\n ecirc: 'ê',\n euml: 'ë',\n igrave: 'ì',\n iacute: 'í',\n icirc: 'î',\n iuml: 'ï',\n eth: 'ð',\n ntilde: 'ñ',\n ograve: 'ò',\n oacute: 'ó',\n ocirc: 'ô',\n otilde: 'õ',\n ouml: 'ö',\n divide: '÷',\n oslash: 'ø',\n ugrave: 'ù',\n uacute: 'ú',\n ucirc: 'û',\n uuml: 'ü',\n yacute: 'ý',\n thorn: 'þ',\n yuml: 'ÿ',\n fnof: 'ƒ',\n Alpha: 'Α',\n Beta: 'Β',\n Gamma: 'Γ',\n Delta: 'Δ',\n Epsilon: 'Ε',\n Zeta: 'Ζ',\n Eta: 'Η',\n Theta: 'Θ',\n Iota: 'Ι',\n Kappa: 'Κ',\n Lambda: 'Λ',\n Mu: 'Μ',\n Nu: 'Ν',\n Xi: 'Ξ',\n Omicron: 'Ο',\n Pi: 'Π',\n Rho: 'Ρ',\n Sigma: 'Σ',\n Tau: 'Τ',\n Upsilon: 'Υ',\n Phi: 'Φ',\n Chi: 'Χ',\n Psi: 'Ψ',\n Omega: 'Ω',\n alpha: 'α',\n beta: 'β',\n gamma: 'γ',\n delta: 'δ',\n epsilon: 'ε',\n zeta: 'ζ',\n eta: 'η',\n theta: 'θ',\n iota: 'ι',\n kappa: 'κ',\n lambda: 'λ',\n mu: 'μ',\n nu: 'ν',\n xi: 'ξ',\n omicron: 'ο',\n pi: 'π',\n rho: 'ρ',\n sigmaf: 'ς',\n sigma: 'σ',\n tau: 'τ',\n upsilon: 'υ',\n phi: 'φ',\n chi: 'χ',\n psi: 'ψ',\n omega: 'ω',\n thetasym: 'ϑ',\n upsih: 'ϒ',\n piv: 'ϖ',\n bull: '•',\n hellip: '…',\n prime: '′',\n Prime: '″',\n oline: '‾',\n frasl: '⁄',\n weierp: '℘',\n image: 'ℑ',\n real: 'ℜ',\n trade: '™',\n alefsym: 'ℵ',\n larr: '←',\n uarr: '↑',\n rarr: '→',\n darr: '↓',\n harr: '↔',\n crarr: '↵',\n lArr: '⇐',\n uArr: '⇑',\n rArr: '⇒',\n dArr: '⇓',\n hArr: '⇔',\n forall: '∀',\n part: '∂',\n exist: '∃',\n empty: '∅',\n nabla: '∇',\n isin: '∈',\n notin: '∉',\n ni: '∋',\n prod: '∏',\n sum: '∑',\n minus: '−',\n lowast: '∗',\n radic: '√',\n prop: '∝',\n infin: '∞',\n ang: '∠',\n and: '∧',\n or: '∨',\n cap: '∩',\n cup: '∪',\n int: '∫',\n there4: '∴',\n sim: '∼',\n cong: '≅',\n asymp: '≈',\n ne: '≠',\n equiv: '≡',\n le: '≤',\n ge: '≥',\n sub: '⊂',\n sup: '⊃',\n nsub: '⊄',\n sube: '⊆',\n supe: '⊇',\n oplus: '⊕',\n otimes: '⊗',\n perp: '⊥',\n sdot: '⋅',\n lceil: '⌈',\n rceil: '⌉',\n lfloor: '⌊',\n rfloor: '⌋',\n lang: '〈',\n rang: '〉',\n loz: '◊',\n spades: '♠',\n clubs: '♣',\n hearts: '♥',\n diams: '♦',\n quot: '\"',\n amp: '&',\n lt: '<',\n gt: '>',\n OElig: 'Œ',\n oelig: 'œ',\n Scaron: 'Š',\n scaron: 'š',\n Yuml: 'Ÿ',\n circ: 'ˆ',\n tilde: '˜',\n ensp: ' ',\n emsp: ' ',\n thinsp: ' ',\n zwnj: '‌',\n zwj: '‍',\n lrm: '‎',\n rlm: '‏',\n ndash: '–',\n mdash: '—',\n lsquo: '‘',\n rsquo: '’',\n sbquo: '‚',\n ldquo: '“',\n rdquo: '”',\n bdquo: '„',\n dagger: '†',\n Dagger: '‡',\n permil: '‰',\n lsaquo: '‹',\n rsaquo: '›',\n euro: '€'\n}\n","/**\n * List of legacy (that don’t need a trailing `;`) named references which could,\n * depending on what follows them, turn into a different meaning\n *\n * @type {Array<string>}\n */\nexport const dangerous = [\n 'cent',\n 'copy',\n 'divide',\n 'gt',\n 'lt',\n 'not',\n 'para',\n 'times'\n]\n","import {characterEntitiesLegacy} from 'character-entities-legacy'\nimport {characterEntitiesHtml4} from 'character-entities-html4'\nimport {dangerous} from '../constant/dangerous.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * `characterEntitiesHtml4` but inverted.\n *\n * @type {Record<string, string>}\n */\nconst characters = {}\n\n/** @type {string} */\nlet key\n\nfor (key in characterEntitiesHtml4) {\n if (own.call(characterEntitiesHtml4, key)) {\n characters[characterEntitiesHtml4[key]] = key\n }\n}\n\nconst notAlphanumericRegex = /[^\\dA-Za-z]/\n\n/**\n * Configurable ways to encode characters as named references.\n *\n * @param {number} code\n * @param {number} next\n * @param {boolean|undefined} omit\n * @param {boolean|undefined} attribute\n * @returns {string}\n */\nexport function toNamed(code, next, omit, attribute) {\n const character = String.fromCharCode(code)\n\n if (own.call(characters, character)) {\n const name = characters[character]\n const value = '&' + name\n\n if (\n omit &&\n characterEntitiesLegacy.includes(name) &&\n !dangerous.includes(name) &&\n (!attribute ||\n (next &&\n next !== 61 /* `=` */ &&\n notAlphanumericRegex.test(String.fromCharCode(next))))\n ) {\n return value\n }\n\n return value + ';'\n }\n\n return ''\n}\n","/**\n * @typedef FormatSmartOptions\n * @property {boolean} [useNamedReferences=false]\n * Prefer named character references (`&amp;`) where possible.\n * @property {boolean} [useShortestReferences=false]\n * Prefer the shortest possible reference, if that results in less bytes.\n * **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.\n * @property {boolean} [omitOptionalSemicolons=false]\n * Whether to omit semicolons when possible.\n * **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.\n * Omitting semicolons is possible for certain named and numeric references in some cases.\n * @property {boolean} [attribute=false]\n * Create character references which don’t fail in attributes.\n * **Note**: `attribute` only applies when operating dangerously with\n * `omitOptionalSemicolons: true`.\n */\n\nimport {toHexadecimal} from './to-hexadecimal.js'\nimport {toDecimal} from './to-decimal.js'\nimport {toNamed} from './to-named.js'\n\n/**\n * Configurable ways to encode a character yielding pretty or small results.\n *\n * @param {number} code\n * @param {number} next\n * @param {FormatSmartOptions} options\n * @returns {string}\n */\nexport function formatSmart(code, next, options) {\n let numeric = toHexadecimal(code, next, options.omitOptionalSemicolons)\n /** @type {string|undefined} */\n let named\n\n if (options.useNamedReferences || options.useShortestReferences) {\n named = toNamed(\n code,\n next,\n options.omitOptionalSemicolons,\n options.attribute\n )\n }\n\n // Use the shortest numeric reference when requested.\n // A simple algorithm would use decimal for all code points under 100, as\n // those are shorter than hexadecimal:\n //\n // * `&#99;` vs `&#x63;` (decimal shorter)\n // * `&#100;` vs `&#x64;` (equal)\n //\n // However, because we take `next` into consideration when `omit` is used,\n // And it would be possible that decimals are shorter on bigger values as\n // well if `next` is hexadecimal but not decimal, we instead compare both.\n if (\n (options.useShortestReferences || !named) &&\n options.useShortestReferences\n ) {\n const decimal = toDecimal(code, next, options.omitOptionalSemicolons)\n\n if (decimal.length < numeric.length) {\n numeric = decimal\n }\n }\n\n return named &&\n (!options.useShortestReferences || named.length < numeric.length)\n ? named\n : numeric\n}\n","/**\n * @typedef {import('./core.js').CoreOptions & import('./util/format-smart.js').FormatSmartOptions} Options\n * @typedef {import('./core.js').CoreOptions} LightOptions\n */\n\nimport {core} from './core.js'\nimport {formatSmart} from './util/format-smart.js'\nimport {formatBasic} from './util/format-basic.js'\n\n/**\n * Encode special characters in `value`.\n *\n * @param {string} value\n * Value to encode.\n * @param {Options} [options]\n * Configuration.\n * @returns {string}\n * Encoded value.\n */\nexport function stringifyEntities(value, options) {\n return core(value, Object.assign({format: formatSmart}, options))\n}\n\n/**\n * Encode special characters in `value` as hexadecimals.\n *\n * @param {string} value\n * Value to encode.\n * @param {LightOptions} [options]\n * Configuration.\n * @returns {string}\n * Encoded value.\n */\nexport function stringifyEntitiesLight(value, options) {\n return core(value, Object.assign({format: formatBasic}, options))\n}\n","/**\n * @import {Comment, Parents} from 'hast'\n * @import {State} from '../index.js'\n */\n\nimport {stringifyEntities} from 'stringify-entities'\n\nconst htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g\n\n// Declare arrays as variables so it can be cached by `stringifyEntities`\nconst bogusCommentEntitySubset = ['>']\nconst commentEntitySubset = ['<', '>']\n\n/**\n * Serialize a comment.\n *\n * @param {Comment} node\n * Node to handle.\n * @param {number | undefined} _1\n * Index of `node` in `parent.\n * @param {Parents | undefined} _2\n * Parent of `node`.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized node.\n */\nexport function comment(node, _1, _2, state) {\n // See: <https://html.spec.whatwg.org/multipage/syntax.html#comments>\n return state.settings.bogusComments\n ? '<?' +\n stringifyEntities(\n node.value,\n Object.assign({}, state.settings.characterReferences, {\n subset: bogusCommentEntitySubset\n })\n ) +\n '>'\n : '<!--' + node.value.replace(htmlCommentRegex, encode) + '-->'\n\n /**\n * @param {string} $0\n */\n function encode($0) {\n return stringifyEntities(\n $0,\n Object.assign({}, state.settings.characterReferences, {\n subset: commentEntitySubset\n })\n )\n }\n}\n","/**\n * @import {Doctype, Parents} from 'hast'\n * @import {State} from '../index.js'\n */\n\n/**\n * Serialize a doctype.\n *\n * @param {Doctype} _1\n * Node to handle.\n * @param {number | undefined} _2\n * Index of `node` in `parent.\n * @param {Parents | undefined} _3\n * Parent of `node`.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized node.\n */\nexport function doctype(_1, _2, _3, state) {\n return (\n '<!' +\n (state.settings.upperDoctype ? 'DOCTYPE' : 'doctype') +\n (state.settings.tightDoctype ? '' : ' ') +\n 'html>'\n )\n}\n","/**\n * @typedef {import('hast').Nodes} Nodes\n */\n\n// HTML whitespace expression.\n// See <https://infra.spec.whatwg.org/#ascii-whitespace>.\nconst re = /[ \\t\\n\\f\\r]/g\n\n/**\n * Check if the given value is *inter-element whitespace*.\n *\n * @param {Nodes | string} thing\n * Thing to check (`Node` or `string`).\n * @returns {boolean}\n * Whether the `value` is inter-element whitespace (`boolean`): consisting of\n * zero or more of space, tab (`\\t`), line feed (`\\n`), carriage return\n * (`\\r`), or form feed (`\\f`); if a node is passed it must be a `Text` node,\n * whose `value` field is checked.\n */\nexport function whitespace(thing) {\n return typeof thing === 'object'\n ? thing.type === 'text'\n ? empty(thing.value)\n : false\n : empty(thing)\n}\n\n/**\n * @param {string} value\n * @returns {boolean}\n */\nfunction empty(value) {\n return value.replace(re, '') === ''\n}\n","/**\n * @import {Parents, RootContent} from 'hast'\n */\n\nimport {whitespace} from 'hast-util-whitespace'\n\nexport const siblingAfter = siblings(1)\nexport const siblingBefore = siblings(-1)\n\n/** @type {Array<RootContent>} */\nconst emptyChildren = []\n\n/**\n * Factory to check siblings in a direction.\n *\n * @param {number} increment\n */\nfunction siblings(increment) {\n return sibling\n\n /**\n * Find applicable siblings in a direction.\n *\n * @template {Parents} Parent\n * Parent type.\n * @param {Parent | undefined} parent\n * Parent.\n * @param {number | undefined} index\n * Index of child in `parent`.\n * @param {boolean | undefined} [includeWhitespace=false]\n * Whether to include whitespace (default: `false`).\n * @returns {Parent extends {children: Array<infer Child>} ? Child | undefined : never}\n * Child of parent.\n */\n function sibling(parent, index, includeWhitespace) {\n const siblings = parent ? parent.children : emptyChildren\n let offset = (index || 0) + increment\n let next = siblings[offset]\n\n if (!includeWhitespace) {\n while (next && whitespace(next)) {\n offset += increment\n next = siblings[offset]\n }\n }\n\n // @ts-expect-error: it’s a correct child.\n return next\n }\n}\n","/**\n * @import {Element, Parents} from 'hast'\n */\n\n/**\n * @callback OmitHandle\n * Check if a tag can be omitted.\n * @param {Element} element\n * Element to check.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether to omit a tag.\n *\n */\n\nconst own = {}.hasOwnProperty\n\n/**\n * Factory to check if a given node can have a tag omitted.\n *\n * @param {Record<string, OmitHandle>} handlers\n * Omission handlers, where each key is a tag name, and each value is the\n * corresponding handler.\n * @returns {OmitHandle}\n * Whether to omit a tag of an element.\n */\nexport function omission(handlers) {\n return omit\n\n /**\n * Check if a given node can have a tag omitted.\n *\n * @type {OmitHandle}\n */\n function omit(node, index, parent) {\n return (\n own.call(handlers, node.tagName) &&\n handlers[node.tagName](node, index, parent)\n )\n }\n}\n","/**\n * @import {Element, Parents} from 'hast'\n */\n\nimport {whitespace} from 'hast-util-whitespace'\nimport {siblingAfter} from './util/siblings.js'\nimport {omission} from './omission.js'\n\nexport const closing = omission({\n body,\n caption: headOrColgroupOrCaption,\n colgroup: headOrColgroupOrCaption,\n dd,\n dt,\n head: headOrColgroupOrCaption,\n html,\n li,\n optgroup,\n option,\n p,\n rp: rubyElement,\n rt: rubyElement,\n tbody,\n td: cells,\n tfoot,\n th: cells,\n thead,\n tr\n})\n\n/**\n * Macro for `</head>`, `</colgroup>`, and `</caption>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction headOrColgroupOrCaption(_, index, parent) {\n const next = siblingAfter(parent, index, true)\n return (\n !next ||\n (next.type !== 'comment' &&\n !(next.type === 'text' && whitespace(next.value.charAt(0))))\n )\n}\n\n/**\n * Whether to omit `</html>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction html(_, index, parent) {\n const next = siblingAfter(parent, index)\n return !next || next.type !== 'comment'\n}\n\n/**\n * Whether to omit `</body>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction body(_, index, parent) {\n const next = siblingAfter(parent, index)\n return !next || next.type !== 'comment'\n}\n\n/**\n * Whether to omit `</p>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction p(_, index, parent) {\n const next = siblingAfter(parent, index)\n return next\n ? next.type === 'element' &&\n (next.tagName === 'address' ||\n next.tagName === 'article' ||\n next.tagName === 'aside' ||\n next.tagName === 'blockquote' ||\n next.tagName === 'details' ||\n next.tagName === 'div' ||\n next.tagName === 'dl' ||\n next.tagName === 'fieldset' ||\n next.tagName === 'figcaption' ||\n next.tagName === 'figure' ||\n next.tagName === 'footer' ||\n next.tagName === 'form' ||\n next.tagName === 'h1' ||\n next.tagName === 'h2' ||\n next.tagName === 'h3' ||\n next.tagName === 'h4' ||\n next.tagName === 'h5' ||\n next.tagName === 'h6' ||\n next.tagName === 'header' ||\n next.tagName === 'hgroup' ||\n next.tagName === 'hr' ||\n next.tagName === 'main' ||\n next.tagName === 'menu' ||\n next.tagName === 'nav' ||\n next.tagName === 'ol' ||\n next.tagName === 'p' ||\n next.tagName === 'pre' ||\n next.tagName === 'section' ||\n next.tagName === 'table' ||\n next.tagName === 'ul')\n : !parent ||\n // Confusing parent.\n !(\n parent.type === 'element' &&\n (parent.tagName === 'a' ||\n parent.tagName === 'audio' ||\n parent.tagName === 'del' ||\n parent.tagName === 'ins' ||\n parent.tagName === 'map' ||\n parent.tagName === 'noscript' ||\n parent.tagName === 'video')\n )\n}\n\n/**\n * Whether to omit `</li>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction li(_, index, parent) {\n const next = siblingAfter(parent, index)\n return !next || (next.type === 'element' && next.tagName === 'li')\n}\n\n/**\n * Whether to omit `</dt>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction dt(_, index, parent) {\n const next = siblingAfter(parent, index)\n return Boolean(\n next &&\n next.type === 'element' &&\n (next.tagName === 'dt' || next.tagName === 'dd')\n )\n}\n\n/**\n * Whether to omit `</dd>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction dd(_, index, parent) {\n const next = siblingAfter(parent, index)\n return (\n !next ||\n (next.type === 'element' &&\n (next.tagName === 'dt' || next.tagName === 'dd'))\n )\n}\n\n/**\n * Whether to omit `</rt>` or `</rp>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction rubyElement(_, index, parent) {\n const next = siblingAfter(parent, index)\n return (\n !next ||\n (next.type === 'element' &&\n (next.tagName === 'rp' || next.tagName === 'rt'))\n )\n}\n\n/**\n * Whether to omit `</optgroup>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction optgroup(_, index, parent) {\n const next = siblingAfter(parent, index)\n return !next || (next.type === 'element' && next.tagName === 'optgroup')\n}\n\n/**\n * Whether to omit `</option>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction option(_, index, parent) {\n const next = siblingAfter(parent, index)\n return (\n !next ||\n (next.type === 'element' &&\n (next.tagName === 'option' || next.tagName === 'optgroup'))\n )\n}\n\n/**\n * Whether to omit `</thead>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction thead(_, index, parent) {\n const next = siblingAfter(parent, index)\n return Boolean(\n next &&\n next.type === 'element' &&\n (next.tagName === 'tbody' || next.tagName === 'tfoot')\n )\n}\n\n/**\n * Whether to omit `</tbody>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction tbody(_, index, parent) {\n const next = siblingAfter(parent, index)\n return (\n !next ||\n (next.type === 'element' &&\n (next.tagName === 'tbody' || next.tagName === 'tfoot'))\n )\n}\n\n/**\n * Whether to omit `</tfoot>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction tfoot(_, index, parent) {\n return !siblingAfter(parent, index)\n}\n\n/**\n * Whether to omit `</tr>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction tr(_, index, parent) {\n const next = siblingAfter(parent, index)\n return !next || (next.type === 'element' && next.tagName === 'tr')\n}\n\n/**\n * Whether to omit `</td>` or `</th>`.\n *\n * @param {Element} _\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the closing tag can be omitted.\n */\nfunction cells(_, index, parent) {\n const next = siblingAfter(parent, index)\n return (\n !next ||\n (next.type === 'element' &&\n (next.tagName === 'td' || next.tagName === 'th'))\n )\n}\n","/**\n * @import {Element, Parents} from 'hast'\n */\n\nimport {whitespace} from 'hast-util-whitespace'\nimport {siblingAfter, siblingBefore} from './util/siblings.js'\nimport {closing} from './closing.js'\nimport {omission} from './omission.js'\n\nexport const opening = omission({\n body,\n colgroup,\n head,\n html,\n tbody\n})\n\n/**\n * Whether to omit `<html>`.\n *\n * @param {Element} node\n * Element.\n * @returns {boolean}\n * Whether the opening tag can be omitted.\n */\nfunction html(node) {\n const head = siblingAfter(node, -1)\n return !head || head.type !== 'comment'\n}\n\n/**\n * Whether to omit `<head>`.\n *\n * @param {Element} node\n * Element.\n * @returns {boolean}\n * Whether the opening tag can be omitted.\n */\nfunction head(node) {\n /** @type {Set<string>} */\n const seen = new Set()\n\n // Whether `srcdoc` or not,\n // make sure the content model at least doesn’t have too many `base`s/`title`s.\n for (const child of node.children) {\n if (\n child.type === 'element' &&\n (child.tagName === 'base' || child.tagName === 'title')\n ) {\n if (seen.has(child.tagName)) return false\n seen.add(child.tagName)\n }\n }\n\n // “May be omitted if the element is empty,\n // or if the first thing inside the head element is an element.”\n const child = node.children[0]\n return !child || child.type === 'element'\n}\n\n/**\n * Whether to omit `<body>`.\n *\n * @param {Element} node\n * Element.\n * @returns {boolean}\n * Whether the opening tag can be omitted.\n */\nfunction body(node) {\n const head = siblingAfter(node, -1, true)\n\n return (\n !head ||\n (head.type !== 'comment' &&\n !(head.type === 'text' && whitespace(head.value.charAt(0))) &&\n !(\n head.type === 'element' &&\n (head.tagName === 'meta' ||\n head.tagName === 'link' ||\n head.tagName === 'script' ||\n head.tagName === 'style' ||\n head.tagName === 'template')\n ))\n )\n}\n\n/**\n * Whether to omit `<colgroup>`.\n * The spec describes some logic for the opening tag, but it’s easier to\n * implement in the closing tag, to the same effect, so we handle it there\n * instead.\n *\n * @param {Element} node\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the opening tag can be omitted.\n */\nfunction colgroup(node, index, parent) {\n const previous = siblingBefore(parent, index)\n const head = siblingAfter(node, -1, true)\n\n // Previous colgroup was already omitted.\n if (\n parent &&\n previous &&\n previous.type === 'element' &&\n previous.tagName === 'colgroup' &&\n closing(previous, parent.children.indexOf(previous), parent)\n ) {\n return false\n }\n\n return Boolean(head && head.type === 'element' && head.tagName === 'col')\n}\n\n/**\n * Whether to omit `<tbody>`.\n *\n * @param {Element} node\n * Element.\n * @param {number | undefined} index\n * Index of element in parent.\n * @param {Parents | undefined} parent\n * Parent of element.\n * @returns {boolean}\n * Whether the opening tag can be omitted.\n */\nfunction tbody(node, index, parent) {\n const previous = siblingBefore(parent, index)\n const head = siblingAfter(node, -1)\n\n // Previous table section was already omitted.\n if (\n parent &&\n previous &&\n previous.type === 'element' &&\n (previous.tagName === 'thead' || previous.tagName === 'tbody') &&\n closing(previous, parent.children.indexOf(previous), parent)\n ) {\n return false\n }\n\n return Boolean(head && head.type === 'element' && head.tagName === 'tr')\n}\n","/**\n * @import {Element, Parents, Properties} from 'hast'\n * @import {State} from '../index.js'\n */\n\nimport {ccount} from 'ccount'\nimport {stringify as commas} from 'comma-separated-tokens'\nimport {find, svg} from 'property-information'\nimport {stringify as spaces} from 'space-separated-tokens'\nimport {stringifyEntities} from 'stringify-entities'\nimport {closing} from '../omission/closing.js'\nimport {opening} from '../omission/opening.js'\n\n/**\n * Maps of subsets.\n *\n * Each value is a matrix of tuples.\n * The value at `0` causes parse errors, the value at `1` is valid.\n * Of both, the value at `0` is unsafe, and the value at `1` is safe.\n *\n * @type {Record<'double' | 'name' | 'single' | 'unquoted', Array<[Array<string>, Array<string>]>>}\n */\nconst constants = {\n // See: <https://html.spec.whatwg.org/#attribute-name-state>.\n name: [\n ['\\t\\n\\f\\r &/=>'.split(''), '\\t\\n\\f\\r \"&\\'/=>`'.split('')],\n ['\\0\\t\\n\\f\\r \"&\\'/<=>'.split(''), '\\0\\t\\n\\f\\r \"&\\'/<=>`'.split('')]\n ],\n // See: <https://html.spec.whatwg.org/#attribute-value-(unquoted)-state>.\n unquoted: [\n ['\\t\\n\\f\\r &>'.split(''), '\\0\\t\\n\\f\\r \"&\\'<=>`'.split('')],\n ['\\0\\t\\n\\f\\r \"&\\'<=>`'.split(''), '\\0\\t\\n\\f\\r \"&\\'<=>`'.split('')]\n ],\n // See: <https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state>.\n single: [\n [\"&'\".split(''), '\"&\\'`'.split('')],\n [\"\\0&'\".split(''), '\\0\"&\\'`'.split('')]\n ],\n // See: <https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state>.\n double: [\n ['\"&'.split(''), '\"&\\'`'.split('')],\n ['\\0\"&'.split(''), '\\0\"&\\'`'.split('')]\n ]\n}\n\n/**\n * Serialize an element node.\n *\n * @param {Element} node\n * Node to handle.\n * @param {number | undefined} index\n * Index of `node` in `parent.\n * @param {Parents | undefined} parent\n * Parent of `node`.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized node.\n */\nexport function element(node, index, parent, state) {\n const schema = state.schema\n const omit = schema.space === 'svg' ? false : state.settings.omitOptionalTags\n let selfClosing =\n schema.space === 'svg'\n ? state.settings.closeEmptyElements\n : state.settings.voids.includes(node.tagName.toLowerCase())\n /** @type {Array<string>} */\n const parts = []\n /** @type {string} */\n let last\n\n if (schema.space === 'html' && node.tagName === 'svg') {\n state.schema = svg\n }\n\n const attributes = serializeAttributes(state, node.properties)\n\n const content = state.all(\n schema.space === 'html' && node.tagName === 'template' ? node.content : node\n )\n\n state.schema = schema\n\n // If the node is categorised as void, but it has children, remove the\n // categorisation.\n // This enables for example `menuitem`s, which are void in W3C HTML but not\n // void in WHATWG HTML, to be stringified properly.\n // Note: `menuitem` has since been removed from the HTML spec, and so is no\n // longer void.\n if (content) selfClosing = false\n\n if (attributes || !omit || !opening(node, index, parent)) {\n parts.push('<', node.tagName, attributes ? ' ' + attributes : '')\n\n if (\n selfClosing &&\n (schema.space === 'svg' || state.settings.closeSelfClosing)\n ) {\n last = attributes.charAt(attributes.length - 1)\n if (\n !state.settings.tightSelfClosing ||\n last === '/' ||\n (last && last !== '\"' && last !== \"'\")\n ) {\n parts.push(' ')\n }\n\n parts.push('/')\n }\n\n parts.push('>')\n }\n\n parts.push(content)\n\n if (!selfClosing && (!omit || !closing(node, index, parent))) {\n parts.push('</' + node.tagName + '>')\n }\n\n return parts.join('')\n}\n\n/**\n * @param {State} state\n * @param {Properties | null | undefined} properties\n * @returns {string}\n */\nfunction serializeAttributes(state, properties) {\n /** @type {Array<string>} */\n const values = []\n let index = -1\n /** @type {string} */\n let key\n\n if (properties) {\n for (key in properties) {\n if (properties[key] !== null && properties[key] !== undefined) {\n const value = serializeAttribute(state, key, properties[key])\n if (value) values.push(value)\n }\n }\n }\n\n while (++index < values.length) {\n const last = state.settings.tightAttributes\n ? values[index].charAt(values[index].length - 1)\n : undefined\n\n // In tight mode, don’t add a space after quoted attributes.\n if (index !== values.length - 1 && last !== '\"' && last !== \"'\") {\n values[index] += ' '\n }\n }\n\n return values.join('')\n}\n\n/**\n * @param {State} state\n * @param {string} key\n * @param {Properties[keyof Properties]} value\n * @returns {string}\n */\nfunction serializeAttribute(state, key, value) {\n const info = find(state.schema, key)\n const x =\n state.settings.allowParseErrors && state.schema.space === 'html' ? 0 : 1\n const y = state.settings.allowDangerousCharacters ? 0 : 1\n let quote = state.quote\n /** @type {string | undefined} */\n let result\n\n if (info.overloadedBoolean && (value === info.attribute || value === '')) {\n value = true\n } else if (\n (info.boolean || info.overloadedBoolean) &&\n (typeof value !== 'string' || value === info.attribute || value === '')\n ) {\n value = Boolean(value)\n }\n\n if (\n value === null ||\n value === undefined ||\n value === false ||\n (typeof value === 'number' && Number.isNaN(value))\n ) {\n return ''\n }\n\n const name = stringifyEntities(\n info.attribute,\n Object.assign({}, state.settings.characterReferences, {\n // Always encode without parse errors in non-HTML.\n subset: constants.name[x][y]\n })\n )\n\n // No value.\n // There is currently only one boolean property in SVG: `[download]` on\n // `<a>`.\n // This property does not seem to work in browsers (Firefox, Safari, Chrome),\n // so I can’t test if dropping the value works.\n // But I assume that it should:\n //\n // ```html\n // <!doctype html>\n // <svg viewBox=\"0 0 100 100\">\n // <a href=https://example.com download>\n // <circle cx=50 cy=40 r=35 />\n // </a>\n // </svg>\n // ```\n //\n // See: <https://github.com/wooorm/property-information/blob/main/lib/svg.js>\n if (value === true) return name\n\n // `spaces` doesn’t accept a second argument, but it’s given here just to\n // keep the code cleaner.\n value = Array.isArray(value)\n ? (info.commaSeparated ? commas : spaces)(value, {\n padLeft: !state.settings.tightCommaSeparatedLists\n })\n : String(value)\n\n if (state.settings.collapseEmptyAttributes && !value) return name\n\n // Check unquoted value.\n if (state.settings.preferUnquoted) {\n result = stringifyEntities(\n value,\n Object.assign({}, state.settings.characterReferences, {\n attribute: true,\n subset: constants.unquoted[x][y]\n })\n )\n }\n\n // If we don’t want unquoted, or if `value` contains character references when\n // unquoted…\n if (result !== value) {\n // If the alternative is less common than `quote`, switch.\n if (\n state.settings.quoteSmart &&\n ccount(value, quote) > ccount(value, state.alternative)\n ) {\n quote = state.alternative\n }\n\n result =\n quote +\n stringifyEntities(\n value,\n Object.assign({}, state.settings.characterReferences, {\n // Always encode without parse errors in non-HTML.\n subset: (quote === \"'\" ? constants.single : constants.double)[x][y],\n attribute: true\n })\n ) +\n quote\n }\n\n // Don’t add a `=` for unquoted empties.\n return name + (result ? '=' + result : result)\n}\n","/**\n * @import {Parents, Text} from 'hast'\n * @import {Raw} from 'mdast-util-to-hast'\n * @import {State} from '../index.js'\n */\n\nimport {stringifyEntities} from 'stringify-entities'\n\n// Declare array as variable so it can be cached by `stringifyEntities`\nconst textEntitySubset = ['<', '&']\n\n/**\n * Serialize a text node.\n *\n * @param {Raw | Text} node\n * Node to handle.\n * @param {number | undefined} _\n * Index of `node` in `parent.\n * @param {Parents | undefined} parent\n * Parent of `node`.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized node.\n */\nexport function text(node, _, parent, state) {\n // Check if content of `node` should be escaped.\n return parent &&\n parent.type === 'element' &&\n (parent.tagName === 'script' || parent.tagName === 'style')\n ? node.value\n : stringifyEntities(\n node.value,\n Object.assign({}, state.settings.characterReferences, {\n subset: textEntitySubset\n })\n )\n}\n","/**\n * @import {Parents} from 'hast'\n * @import {Raw} from 'mdast-util-to-hast'\n * @import {State} from '../index.js'\n */\n\nimport {text} from './text.js'\n\n/**\n * Serialize a raw node.\n *\n * @param {Raw} node\n * Node to handle.\n * @param {number | undefined} index\n * Index of `node` in `parent.\n * @param {Parents | undefined} parent\n * Parent of `node`.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized node.\n */\nexport function raw(node, index, parent, state) {\n return state.settings.allowDangerousHtml\n ? node.value\n : text(node, index, parent, state)\n}\n","/**\n * @import {Parents, Root} from 'hast'\n * @import {State} from '../index.js'\n */\n\n/**\n * Serialize a root.\n *\n * @param {Root} node\n * Node to handle.\n * @param {number | undefined} _1\n * Index of `node` in `parent.\n * @param {Parents | undefined} _2\n * Parent of `node`.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {string}\n * Serialized node.\n */\nexport function root(node, _1, _2, state) {\n return state.all(node)\n}\n","/**\n * @import {Nodes, Parents} from 'hast'\n * @import {State} from '../index.js'\n */\n\nimport {zwitch} from 'zwitch'\nimport {comment} from './comment.js'\nimport {doctype} from './doctype.js'\nimport {element} from './element.js'\nimport {raw} from './raw.js'\nimport {root} from './root.js'\nimport {text} from './text.js'\n\n/**\n * @type {(node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string}\n */\nexport const handle = zwitch('type', {\n invalid,\n unknown,\n handlers: {comment, doctype, element, raw, root, text}\n})\n\n/**\n * Fail when a non-node is found in the tree.\n *\n * @param {unknown} node\n * Unknown value.\n * @returns {never}\n * Never.\n */\nfunction invalid(node) {\n throw new Error('Expected node, not `' + node + '`')\n}\n\n/**\n * Fail when a node with an unknown type is found in the tree.\n *\n * @param {unknown} node_\n * Unknown node.\n * @returns {never}\n * Never.\n */\nfunction unknown(node_) {\n // `type` is guaranteed by runtime JS.\n const node = /** @type {Nodes} */ (node_)\n throw new Error('Cannot compile unknown node `' + node.type + '`')\n}\n","/**\n * @import {Nodes, Parents, RootContent} from 'hast'\n * @import {Schema} from 'property-information'\n * @import {Options as StringifyEntitiesOptions} from 'stringify-entities'\n */\n\n/**\n * @typedef {Omit<StringifyEntitiesOptions, 'attribute' | 'escapeOnly' | 'subset'>} CharacterReferences\n *\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [allowDangerousCharacters=false]\n * Do not encode some characters which cause XSS vulnerabilities in older\n * browsers (default: `false`).\n *\n * > ⚠️ **Danger**: only set this if you completely trust the content.\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n * Allow `raw` nodes and insert them as raw HTML (default: `false`).\n *\n * When `false`, `Raw` nodes are encoded.\n *\n * > ⚠️ **Danger**: only set this if you completely trust the content.\n * @property {boolean | null | undefined} [allowParseErrors=false]\n * Do not encode characters which cause parse errors (even though they work),\n * to save bytes (default: `false`).\n *\n * Not used in the SVG space.\n *\n * > 👉 **Note**: intentionally creates parse errors in markup (how parse\n * > errors are handled is well defined, so this works but isn’t pretty).\n * @property {boolean | null | undefined} [bogusComments=false]\n * Use “bogus comments” instead of comments to save byes: `<?charlie>`\n * instead of `<!--charlie-->` (default: `false`).\n *\n * > 👉 **Note**: intentionally creates parse errors in markup (how parse\n * > errors are handled is well defined, so this works but isn’t pretty).\n * @property {CharacterReferences | null | undefined} [characterReferences]\n * Configure how to serialize character references (optional).\n * @property {boolean | null | undefined} [closeEmptyElements=false]\n * Close SVG elements without any content with slash (`/`) on the opening tag\n * instead of an end tag: `<circle />` instead of `<circle></circle>`\n * (default: `false`).\n *\n * See `tightSelfClosing` to control whether a space is used before the\n * slash.\n *\n * Not used in the HTML space.\n * @property {boolean | null | undefined} [closeSelfClosing=false]\n * Close self-closing nodes with an extra slash (`/`): `<img />` instead of\n * `<img>` (default: `false`).\n *\n * See `tightSelfClosing` to control whether a space is used before the\n * slash.\n *\n * Not used in the SVG space.\n * @property {boolean | null | undefined} [collapseEmptyAttributes=false]\n * Collapse empty attributes: get `class` instead of `class=\"\"` (default:\n * `false`).\n *\n * Not used in the SVG space.\n *\n * > 👉 **Note**: boolean attributes (such as `hidden`) are always collapsed.\n * @property {boolean | null | undefined} [omitOptionalTags=false]\n * Omit optional opening and closing tags (default: `false`).\n *\n * For example, in `<ol><li>one</li><li>two</li></ol>`, both `</li>` closing\n * tags can be omitted.\n * The first because it’s followed by another `li`, the last because it’s\n * followed by nothing.\n *\n * Not used in the SVG space.\n * @property {boolean | null | undefined} [preferUnquoted=false]\n * Leave attributes unquoted if that results in less bytes (default: `false`).\n *\n * Not used in the SVG space.\n * @property {boolean | null | undefined} [quoteSmart=false]\n * Use the other quote if that results in less bytes (default: `false`).\n * @property {Quote | null | undefined} [quote='\"']\n * Preferred quote to use (default: `'\"'`).\n * @property {Space | null | undefined} [space='html']\n * When an `<svg>` element is found in the HTML space, this package already\n * automatically switches to and from the SVG space when entering and exiting\n * it (default: `'html'`).\n *\n * > 👉 **Note**: hast is not XML.\n * > It supports SVG as embedded in HTML.\n * > It does not support the features available in XML.\n * > Passing SVG might break but fragments of modern SVG should be fine.\n * > Use [`xast`][xast] if you need to support SVG as XML.\n * @property {boolean | null | undefined} [tightAttributes=false]\n * Join attributes together, without whitespace, if possible: get\n * `class=\"a b\"title=\"c d\"` instead of `class=\"a b\" title=\"c d\"` to save\n * bytes (default: `false`).\n *\n * Not used in the SVG space.\n *\n * > 👉 **Note**: intentionally creates parse errors in markup (how parse\n * > errors are handled is well defined, so this works but isn’t pretty).\n * @property {boolean | null | undefined} [tightCommaSeparatedLists=false]\n * Join known comma-separated attribute values with just a comma (`,`),\n * instead of padding them on the right as well (`,␠`, where `␠` represents a\n * space) (default: `false`).\n * @property {boolean | null | undefined} [tightDoctype=false]\n * Drop unneeded spaces in doctypes: `<!doctypehtml>` instead of\n * `<!doctype html>` to save bytes (default: `false`).\n *\n * > 👉 **Note**: intentionally creates parse errors in markup (how parse\n * > errors are handled is well defined, so this works but isn’t pretty).\n * @property {boolean | null | undefined} [tightSelfClosing=false]\n * Do not use an extra space when closing self-closing elements: `<img/>`\n * instead of `<img />` (default: `false`).\n *\n * > 👉 **Note**: only used if `closeSelfClosing: true` or\n * > `closeEmptyElements: true`.\n * @property {boolean | null | undefined} [upperDoctype=false]\n * Use a `<!DOCTYPE…` instead of `<!doctype…` (default: `false`).\n *\n * Useless except for XHTML.\n * @property {ReadonlyArray<string> | null | undefined} [voids]\n * Tag names of elements to serialize without closing tag (default: `html-void-elements`).\n *\n * Not used in the SVG space.\n *\n * > 👉 **Note**: It’s highly unlikely that you want to pass this, because\n * > hast is not for XML, and HTML will not add more void elements.\n *\n * @typedef {'\"' | \"'\"} Quote\n * HTML quotes for attribute values.\n *\n * @typedef {Omit<Required<{[key in keyof Options]: Exclude<Options[key], null | undefined>}>, 'space' | 'quote'>} Settings\n *\n * @typedef {'html' | 'svg'} Space\n * Namespace.\n *\n * @typedef State\n * Info passed around about the current state.\n * @property {(node: Parents | undefined) => string} all\n * Serialize the children of a parent node.\n * @property {Quote} alternative\n * Alternative quote.\n * @property {(node: Nodes, index: number | undefined, parent: Parents | undefined) => string} one\n * Serialize one node.\n * @property {Quote} quote\n * Preferred quote.\n * @property {Schema} schema\n * Current schema.\n * @property {Settings} settings\n * User configuration.\n */\n\nimport {htmlVoidElements} from 'html-void-elements'\nimport {html, svg} from 'property-information'\nimport {handle} from './handle/index.js'\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/** @type {CharacterReferences} */\nconst emptyCharacterReferences = {}\n\n/** @type {Array<never>} */\nconst emptyChildren = []\n\n/**\n * Serialize hast as HTML.\n *\n * @param {Array<RootContent> | Nodes} tree\n * Tree to serialize.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Serialized HTML.\n */\nexport function toHtml(tree, options) {\n const options_ = options || emptyOptions\n const quote = options_.quote || '\"'\n const alternative = quote === '\"' ? \"'\" : '\"'\n\n if (quote !== '\"' && quote !== \"'\") {\n throw new Error('Invalid quote `' + quote + '`, expected `\\'` or `\"`')\n }\n\n /** @type {State} */\n const state = {\n one,\n all,\n settings: {\n omitOptionalTags: options_.omitOptionalTags || false,\n allowParseErrors: options_.allowParseErrors || false,\n allowDangerousCharacters: options_.allowDangerousCharacters || false,\n quoteSmart: options_.quoteSmart || false,\n preferUnquoted: options_.preferUnquoted || false,\n tightAttributes: options_.tightAttributes || false,\n upperDoctype: options_.upperDoctype || false,\n tightDoctype: options_.tightDoctype || false,\n bogusComments: options_.bogusComments || false,\n tightCommaSeparatedLists: options_.tightCommaSeparatedLists || false,\n tightSelfClosing: options_.tightSelfClosing || false,\n collapseEmptyAttributes: options_.collapseEmptyAttributes || false,\n allowDangerousHtml: options_.allowDangerousHtml || false,\n voids: options_.voids || htmlVoidElements,\n characterReferences:\n options_.characterReferences || emptyCharacterReferences,\n closeSelfClosing: options_.closeSelfClosing || false,\n closeEmptyElements: options_.closeEmptyElements || false\n },\n schema: options_.space === 'svg' ? svg : html,\n quote,\n alternative\n }\n\n return state.one(\n Array.isArray(tree) ? {type: 'root', children: tree} : tree,\n undefined,\n undefined\n )\n}\n\n/**\n * Serialize a node.\n *\n * @this {State}\n * Info passed around about the current state.\n * @param {Nodes} node\n * Node to handle.\n * @param {number | undefined} index\n * Index of `node` in `parent.\n * @param {Parents | undefined} parent\n * Parent of `node`.\n * @returns {string}\n * Serialized node.\n */\nfunction one(node, index, parent) {\n return handle(node, index, parent, this)\n}\n\n/**\n * Serialize all children of `parent`.\n *\n * @this {State}\n * Info passed around about the current state.\n * @param {Parents | undefined} parent\n * Parent whose children to serialize.\n * @returns {string}\n */\nexport function all(parent) {\n /** @type {Array<string>} */\n const results = []\n const children = (parent && parent.children) || emptyChildren\n let index = -1\n\n while (++index < children.length) {\n results[index] = this.one(children[index], index, parent)\n }\n\n return results.join('')\n}\n","/**\n * @import {Root} from 'hast'\n * @import {Options} from 'hast-util-to-html'\n * @import {Compiler, Processor} from 'unified'\n */\n\nimport {toHtml} from 'hast-util-to-html'\n\n/**\n * Plugin to add support for serializing as HTML.\n *\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function rehypeStringify(options) {\n /** @type {Processor<undefined, undefined, undefined, Root, string>} */\n // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n const self = this\n const settings = {...self.data('settings'), ...options}\n\n self.compiler = compiler\n\n /**\n * @type {Compiler<Root, string>}\n */\n function compiler(tree) {\n return toHtml(tree, settings)\n }\n}\n","import type { Element, ElementContent, Properties, Root } from 'hast'\r\nimport type { MarkdownDocument, MarkdownNode } from './types'\r\n\r\nconst BOOLEAN_ATTRIBUTES = new Set([\r\n 'checked',\r\n 'disabled',\r\n 'hidden',\r\n 'open',\r\n 'reversed',\r\n 'multiple',\r\n 'required',\r\n 'selected',\r\n])\r\n\r\nconst PROPERTY_ALIASES: Record<string, string> = {\r\n class: 'className',\r\n for: 'htmlFor',\r\n tabindex: 'tabIndex',\r\n colspan: 'colSpan',\r\n rowspan: 'rowSpan',\r\n readonly: 'readOnly',\r\n maxlength: 'maxLength',\r\n minlength: 'minLength',\r\n referrerpolicy: 'referrerPolicy',\r\n crossorigin: 'crossOrigin',\r\n srcset: 'srcSet',\r\n datetime: 'dateTime',\r\n 'http-equiv': 'httpEquiv',\r\n}\r\n\r\nfunction attrsToProps(attrs: Record<string, string>): Properties {\r\n const properties: Properties = {}\r\n for (const key of Object.keys(attrs)) {\r\n const value = attrs[key] ?? ''\r\n const name = PROPERTY_ALIASES[key] ?? key\r\n if (BOOLEAN_ATTRIBUTES.has(key)) {\r\n properties[name] = value !== 'false'\r\n continue\r\n }\r\n if (key === 'class') {\r\n properties.className = value.split(/\\s+/).filter(Boolean)\r\n continue\r\n }\r\n properties[name] = value\r\n }\r\n return properties\r\n}\r\n\r\nconst BLOCK_TAGS = new Set([\r\n 'p',\r\n 'h1',\r\n 'h2',\r\n 'h3',\r\n 'h4',\r\n 'h5',\r\n 'h6',\r\n 'ul',\r\n 'ol',\r\n 'li',\r\n 'blockquote',\r\n 'pre',\r\n 'table',\r\n 'thead',\r\n 'tbody',\r\n 'tfoot',\r\n 'tr',\r\n 'th',\r\n 'td',\r\n 'hr',\r\n 'div',\r\n 'section',\r\n 'figure',\r\n 'figcaption',\r\n 'dl',\r\n 'dt',\r\n 'dd',\r\n 'details',\r\n 'summary',\r\n])\r\n\r\nfunction element(\r\n tagName: string,\r\n properties: Properties,\r\n children: ElementContent[],\r\n): Element {\r\n return {\r\n type: 'element',\r\n tagName,\r\n properties,\r\n children: withBlockNewlines(children),\r\n }\r\n}\r\n\r\nfunction isBlock(node: ElementContent): boolean {\r\n return node.type === 'element' && BLOCK_TAGS.has(node.tagName)\r\n}\r\n\r\n/** Keep the newlines a normal HTML serializer emits between block siblings. */\r\nfunction withBlockNewlines(children: ElementContent[]): ElementContent[] {\r\n const output: ElementContent[] = []\r\n for (const child of children) {\r\n const last = output[output.length - 1]\r\n const alreadySeparated =\r\n last?.type === 'text' && /\\n\\s*$/.test(last.value)\r\n if (output.length > 0 && isBlock(child) && !alreadySeparated) {\r\n output.push({ type: 'text', value: '\\n' })\r\n }\r\n output.push(child)\r\n }\r\n return output\r\n}\r\n\r\nfunction codeBlock(code: string, language: string): Element {\r\n return element(\r\n 'pre',\r\n {},\r\n [\r\n element(\r\n 'code',\r\n language ? { className: [`language-${language}`] } : {},\r\n [{ type: 'text', value: code }],\r\n ),\r\n ],\r\n )\r\n}\r\n\r\nfunction nodeToHast(\r\n node: MarkdownNode,\r\n): ElementContent | ElementContent[] | undefined {\r\n switch (node.kind) {\r\n case 'text': {\r\n if (!node.segments || node.segments.length === 0) {\r\n return { type: 'text', value: node.value }\r\n }\r\n return node.segments.map((segment) => {\r\n if (!segment.match) return { type: 'text', value: segment.value }\r\n return element(\r\n 'mark',\r\n {\r\n className: ['vmd-search-match'],\r\n 'data-vmd-part': 'search-match',\r\n },\r\n [{ type: 'text', value: segment.value }],\r\n )\r\n })\r\n }\r\n case 'element':\r\n return element(\r\n node.tag,\r\n attrsToProps(node.attrs),\r\n nodesToHast(node.children),\r\n )\r\n case 'code':\r\n return codeBlock(node.code, node.language)\r\n case 'math': {\r\n const rendered = nodesToHast(node.rendered ?? [])\r\n return element(\r\n 'span',\r\n {\r\n 'data-vmd-part': 'math',\r\n 'data-vmd-math': '',\r\n 'data-tex': node.tex,\r\n 'data-display': node.displayMode ? 'true' : 'false',\r\n },\r\n rendered.length > 0 ? rendered : [{ type: 'text', value: node.tex }],\r\n )\r\n }\r\n case 'mermaid':\r\n return element(\r\n 'pre',\r\n { 'data-vmd-part': 'mermaid', 'data-vmd-mermaid': '' },\r\n [\r\n element(\r\n 'code',\r\n { className: ['language-mermaid'] },\r\n [{ type: 'text', value: node.code }],\r\n ),\r\n ],\r\n )\r\n case 'custom':\r\n return element(\r\n node.tag,\r\n attrsToProps(node.attrs),\r\n nodesToHast(node.children),\r\n )\r\n case 'plugin': {\r\n const children = nodesToHast(node.children ?? [])\r\n const properties: Properties = {\r\n 'data-vmd-part': 'plugin',\r\n 'data-plugin-type': node.type,\r\n 'data-plugin-key': node.key,\r\n }\r\n if (children.length === 0) {\r\n // A plugin node may render entirely through a host component. Static\r\n // export cannot serialize component output, so emit an addressable\r\n // placeholder instead of dropping the node from the document.\r\n properties['data-plugin-unrendered'] = ''\r\n }\r\n return element('span', properties, children)\r\n }\r\n default:\r\n return undefined\r\n }\r\n}\r\n\r\nfunction nodesToHast(nodes: readonly MarkdownNode[]): ElementContent[] {\r\n const output: ElementContent[] = []\r\n for (const node of nodes) {\r\n const child = nodeToHast(node)\r\n if (!child) continue\r\n if (Array.isArray(child)) output.push(...child)\r\n else output.push(child)\r\n }\r\n return output\r\n}\r\n\r\n/**\r\n * Serialize the normalized document model back to hast for static export.\r\n * The model has already passed sanitization, filtering, URL policy, and plugin\r\n * document transforms, so this function performs no new trust decisions.\r\n */\r\nexport function modelToHast(document: MarkdownDocument): Root {\r\n return {\r\n type: 'root',\r\n children: withBlockNewlines(nodesToHast(document.nodes)),\r\n }\r\n}\r\n","import GithubSlugger from 'github-slugger'\r\nimport type {\r\n MarkdownDiagnostic,\r\n MarkdownDocumentOptions,\r\n MarkdownPipeline,\r\n MarkdownSlugger,\r\n PipelineContext,\r\n} from './types'\r\nimport { withUniqueSlugs } from './slugger'\r\nimport type { ResolvedPlugins } from '../plugins/registry'\r\nimport { defaultPlugins } from '../plugins/builtin'\r\nimport { resolvePlugins } from '../plugins/registry'\r\nimport { applySourceTransforms } from '../plugins/source'\r\nimport { resolvePipeline } from '../pipeline/custom'\r\n\r\nexport interface MarkdownRun {\r\n pipeline: MarkdownPipeline\r\n plugins: ResolvedPlugins\r\n source: string\r\n context: PipelineContext\r\n slugger: MarkdownSlugger\r\n diagnostics: MarkdownDiagnostic[]\r\n}\r\n\r\n/**\r\n * Resolve and prepare one non-reactive pipeline run. Export uses this helper so\r\n * source transforms, plugin resolution, and slugger setup match the\r\n * composable's run.\r\n */\r\nexport function prepareMarkdownRun(\r\n source: string,\r\n options: MarkdownDocumentOptions = {},\r\n diagnostics: MarkdownDiagnostic[] = [],\r\n): MarkdownRun {\r\n const plugins = resolvePlugins(\r\n options.plugins ?? defaultPlugins,\r\n options.disablePlugins ?? [],\r\n )\r\n diagnostics.push(...plugins.diagnostics)\r\n\r\n const resolvedPipeline = resolvePipeline(options.pipeline)\r\n diagnostics.push(...resolvedPipeline.diagnostics)\r\n\r\n const remarkPlugins = [\r\n ...plugins.remarkPlugins,\r\n ...(options.remarkPlugins ?? []),\r\n ]\r\n const rehypePlugins = [\r\n ...plugins.rehypePlugins,\r\n ...(options.rehypePlugins ?? []),\r\n ]\r\n\r\n const transformedSource = applySourceTransforms(\r\n source,\r\n plugins.plugins,\r\n options,\r\n diagnostics,\r\n )\r\n\r\n const baseSlugger = options.slugger ?? new GithubSlugger()\r\n const slugger = withUniqueSlugs(baseSlugger)\r\n\r\n const context: PipelineContext = {\r\n source: transformedSource,\r\n options,\r\n plugins: plugins.plugins,\r\n remarkPlugins,\r\n rehypePlugins,\r\n remarkRehypeOptions: {\r\n ...plugins.remarkRehypeOptions,\r\n ...(options.remarkRehypeOptions ?? {}),\r\n },\r\n slugger,\r\n idPrefix: options.idPrefix ?? '',\r\n diagnostics,\r\n }\r\n\r\n return {\r\n pipeline: resolvedPipeline.pipeline,\r\n plugins,\r\n source: transformedSource,\r\n context,\r\n slugger,\r\n diagnostics,\r\n }\r\n}\r\n","import { unified } from 'unified'\r\nimport rehypeStringify from 'rehype-stringify'\r\nimport type {\r\n MarkdownDiagnostic,\r\n MarkdownDocument,\r\n MarkdownDocumentOptions,\r\n} from '../core/types'\r\nimport { finalizeMarkdownDocument } from '../core/finalize'\r\nimport { modelToHast } from '../core/model-hast'\r\nimport { prepareMarkdownRun } from '../core/run'\r\nimport { assertPipelineResult } from '../pipeline/custom'\r\n\r\nexport type StaticHtmlOptions = MarkdownDocumentOptions\r\n\r\nfunction toHtml(document: MarkdownDocument): string {\r\n return unified().use(rehypeStringify).stringify(modelToHast(document))\r\n}\r\n\r\nfunction assertNoErrors(diagnostics: MarkdownDiagnostic[]): void {\r\n if (diagnostics.some((diagnostic) => diagnostic.severity === 'error')) {\r\n // The rendered path keeps the last good document; static export reports the\r\n // failure instead of returning a partial document.\r\n throw new Error(\r\n diagnostics.map((diagnostic) => diagnostic.message).join(' '),\r\n )\r\n }\r\n}\r\n\r\n/** Render Markdown to static HTML with the same normalized document as rendering. */\r\nexport async function exportMarkdownHtml(\r\n source: string,\r\n options: StaticHtmlOptions = {},\r\n): Promise<string> {\r\n const diagnostics: MarkdownDiagnostic[] = []\r\n const run = prepareMarkdownRun(source, options, diagnostics)\r\n\r\n run.slugger.reset?.()\r\n const result = assertPipelineResult(\r\n await run.pipeline.process(run.source, run.context),\r\n )\r\n const document = finalizeMarkdownDocument({\r\n source: run.source,\r\n result,\r\n options,\r\n plugins: run.plugins,\r\n pipelineName: run.pipeline.name,\r\n slugger: run.slugger,\r\n idPrefix: options.idPrefix ?? '',\r\n diagnostics,\r\n })\r\n assertNoErrors(diagnostics)\r\n return toHtml(document)\r\n}\r\n\r\n/** Synchronous static HTML export when every configured plugin is synchronous. */\r\nexport function exportMarkdownHtmlSync(\r\n source: string,\r\n options: StaticHtmlOptions = {},\r\n): string {\r\n const diagnostics: MarkdownDiagnostic[] = []\r\n const run = prepareMarkdownRun(source, options, diagnostics)\r\n if (!run.pipeline.processSync) {\r\n throw new Error('The configured pipeline does not support synchronous export.')\r\n }\r\n run.slugger.reset?.()\r\n const result = assertPipelineResult(\r\n run.pipeline.processSync(run.source, run.context),\r\n )\r\n const document = finalizeMarkdownDocument({\r\n source: run.source,\r\n result,\r\n options,\r\n plugins: run.plugins,\r\n pipelineName: run.pipeline.name,\r\n slugger: run.slugger,\r\n idPrefix: options.idPrefix ?? '',\r\n diagnostics,\r\n })\r\n assertNoErrors(diagnostics)\r\n return toHtml(document)\r\n}\r\n"],"ignoreList":[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"mappings":";;;;;;;AAOA,IAAa8B,IAAmB,QAEnBC,IAAQ;CACnB,MAAM;CACN,MAAM;CACN,WAAW;CACX,SAAS;CACT,KAAK;CACL,QAAQ;CACR,SAAS;CACT,WAAW;CACX,SAAS;CACT,eAAe;CACf,UAAU;CACV,QAAQ;CACR,eAAe;CACf,MAAM;CACN,OAAO;CACP,MAAM;CACN,UAAU;CACV,YAAY;CACZ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,c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AAA,OAAY,KAAZwM;EAClB;CACF,CAAC;CAED,OADAV,EAAeN,CAAW,GACnBI,EAAOnB,CAAQ;AACxB"}
@@ -1,35 +0,0 @@
1
- import { i as e } from "./security-y4EwUyAs.js";
2
- import { t } from "./lib-BQiWGWpu.js";
3
- // src/core/hast-nodes.ts
4
- function n(t, r = "") {
5
- let i = [];
6
- return t.forEach((t, a) => {
7
- let o = r ? `${r}.${a}` : String(a);
8
- if (t.type === "text") {
9
- t.value !== "" && i.push({
10
- kind: "text",
11
- key: o,
12
- value: t.value
13
- });
14
- return;
15
- }
16
- if (t.type !== "element") return;
17
- let s = t;
18
- i.push({
19
- kind: "element",
20
- key: o,
21
- tag: s.tagName,
22
- attrs: e(s.tagName, s.properties, { allowStyle: !0 }),
23
- children: n(s.children, o)
24
- });
25
- }), i;
26
- }
27
- function r(e) {
28
- return n(e);
29
- }
30
- function i(e) {
31
- return n(t(e, { fragment: !0 }).children);
32
- }
33
- export { i as n, r as t };
34
-
35
- //# sourceMappingURL=hast-nodes-C0bX3M5Z.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hast-nodes-C0bX3M5Z.js","names":["propertiesToAttrs","fromHast","result","nodes","key","path","index","node","element","hastToMarkdownNodes","htmlToMarkdownNodes","fromHtml","html"],"sources":["../../src/core/hast-nodes.ts"],"sourcesContent":["import { fromHtml } from 'hast-util-from-html'\r\nimport type { Element, RootContent } from 'hast'\r\nimport type { MarkdownNode } from './types'\r\nimport { propertiesToAttrs } from './security'\r\n\r\nfunction fromHast(nodes: readonly RootContent[], path = ''): MarkdownNode[] {\r\n const result: MarkdownNode[] = []\r\n nodes.forEach((node, index) => {\r\n const key = path ? `${path}.${index}` : String(index)\r\n if (node.type === 'text') {\r\n if (node.value !== '') {\r\n result.push({ kind: 'text', key, value: node.value })\r\n }\r\n return\r\n }\r\n if (node.type !== 'element') return\r\n const element = node as Element\r\n result.push({\r\n kind: 'element',\r\n key,\r\n tag: element.tagName,\r\n // Engine output is trusted host code. Attributes are normalized and\r\n // inline styles are limited to the constrained subset; tags are not\r\n // filtered here.\r\n attrs: propertiesToAttrs(element.tagName, element.properties, {\r\n allowStyle: true,\r\n }),\r\n children: fromHast(element.children, key),\r\n })\r\n })\r\n return result\r\n}\r\n\r\n/** Convert an already-parsed trusted hast subtree into normalized nodes. */\r\nexport function hastToMarkdownNodes(\r\n nodes: readonly RootContent[],\r\n): MarkdownNode[] {\r\n return fromHast(nodes)\r\n}\r\n\r\n/** Convert trusted engine HTML into normalized nodes. */\r\nexport function htmlToMarkdownNodes(html: string): MarkdownNode[] {\r\n return fromHast(fromHtml(html, { fragment: true }).children)\r\n}\r\n"],"mappings":";;;AAKA,SAASC,EAAS,GAA+B,IAAO,IAAoB;CAC1E,IAAMC,IAAyB,CAAC;CAwBhC,OAvBAC,EAAM,SAAS,GAAM,MAAU;EAC7B,IAAMC,IAAMC,IAAO,GAAGA,EAAK,GAAGC,MAAU,OAAOA,CAAK;EACpD,IAAIC,EAAK,SAAS,QAAQ;GACxB,AAAIA,EAAK,UAAU,MACjBL,EAAO,KAAK;IAAE,MAAM;IAAQ;IAAK,OAAOK,EAAK;GAAM,CAAC;GAEtD;EACF;EACA,IAAIA,EAAK,SAAS,WAAW;EAC7B,IAAMC,IAAUD;EAChB,EAAO,KAAK;GACV,MAAM;GACN;GACA,KAAKC,EAAQ;GAIb,OAAOR,EAAkBQ,EAAQ,SAASA,EAAQ,YAAY,EAC5D,YAAY,GACd,CAAC;GACD,UAAUP,EAASO,EAAQ,UAAUJ,CAAG;EAC1C,CAAC;CACH,CAAC,GACMF;AACT;AAGA,SAAgBO,EACd,GACgB;CAChB,OAAOR,EAASE,CAAK;AACvB;AAGA,SAAgBO,EAAoB,GAA8B;CAChE,OAAOT,EAASU,EAASC,GAAM,EAAE,UAAU,GAAK,CAAC,CAAC,CAAC,QAAQ;AAC7D"}