ngwr 12.2.0 → 13.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 (208) hide show
  1. package/README.md +11 -1
  2. package/border-glow/border-glow.scss +1 -1
  3. package/border-glow/styles/_index.scss +15 -233
  4. package/border-glow/styles/_rules.scss +228 -0
  5. package/breadcrumbs/breadcrumbs.scss +1 -1
  6. package/breadcrumbs/styles/_index.scss +15 -78
  7. package/breadcrumbs/styles/_rules.scss +84 -0
  8. package/card/card.scss +1 -1
  9. package/card/styles/_index.scss +15 -96
  10. package/card/styles/_rules.scss +96 -0
  11. package/cascader/cascader.scss +1 -1
  12. package/cascader/styles/_index.scss +15 -244
  13. package/cascader/styles/_rules.scss +261 -0
  14. package/checkbox/styles/_index.scss +7 -0
  15. package/circular-text/circular-text.scss +1 -1
  16. package/circular-text/styles/_index.scss +15 -63
  17. package/circular-text/styles/_rules.scss +58 -0
  18. package/color-picker/styles/_index.scss +8 -0
  19. package/drag-drop/sortable-list.scss +1 -1
  20. package/drag-drop/styles/_index.scss +14 -143
  21. package/drag-drop/styles/_rules.scss +151 -0
  22. package/falling-text/falling-text.scss +1 -1
  23. package/falling-text/styles/_index.scss +15 -36
  24. package/falling-text/styles/_rules.scss +31 -0
  25. package/fesm2022/ngwr-border-glow.mjs +14 -5
  26. package/fesm2022/ngwr-border-glow.mjs.map +1 -1
  27. package/fesm2022/ngwr-breadcrumbs.mjs +15 -4
  28. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  29. package/fesm2022/ngwr-card.mjs +2 -2
  30. package/fesm2022/ngwr-card.mjs.map +1 -1
  31. package/fesm2022/ngwr-cascader.mjs +27 -9
  32. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  33. package/fesm2022/ngwr-checkbox.mjs +86 -8
  34. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  35. package/fesm2022/ngwr-circular-text.mjs +2 -2
  36. package/fesm2022/ngwr-circular-text.mjs.map +1 -1
  37. package/fesm2022/ngwr-color-picker.mjs +57 -7
  38. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  39. package/fesm2022/ngwr-context-menu.mjs +6 -2
  40. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  41. package/fesm2022/ngwr-date-picker.mjs +8 -0
  42. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  43. package/fesm2022/ngwr-dialog.mjs +22 -16
  44. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  45. package/fesm2022/ngwr-directives.mjs +5 -2
  46. package/fesm2022/ngwr-directives.mjs.map +1 -1
  47. package/fesm2022/ngwr-drag-drop.mjs +2 -2
  48. package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
  49. package/fesm2022/ngwr-drawer.mjs +24 -18
  50. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  51. package/fesm2022/ngwr-dropdown.mjs +6 -2
  52. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  53. package/fesm2022/ngwr-falling-text.mjs +2 -2
  54. package/fesm2022/ngwr-falling-text.mjs.map +1 -1
  55. package/fesm2022/ngwr-file-upload.mjs +29 -8
  56. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  57. package/fesm2022/ngwr-form.mjs +48 -1
  58. package/fesm2022/ngwr-form.mjs.map +1 -1
  59. package/fesm2022/ngwr-fuzzy-text.mjs +21 -4
  60. package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
  61. package/fesm2022/ngwr-glitch-text.mjs +2 -2
  62. package/fesm2022/ngwr-glitch-text.mjs.map +1 -1
  63. package/fesm2022/ngwr-gradient-text.mjs +11 -4
  64. package/fesm2022/ngwr-gradient-text.mjs.map +1 -1
  65. package/fesm2022/ngwr-icon-adapters-feather.mjs +11 -0
  66. package/fesm2022/ngwr-icon-adapters-feather.mjs.map +1 -1
  67. package/fesm2022/ngwr-icon-adapters-lucide.mjs +22 -2
  68. package/fesm2022/ngwr-icon-adapters-lucide.mjs.map +1 -1
  69. package/fesm2022/ngwr-icon.mjs +474 -37
  70. package/fesm2022/ngwr-icon.mjs.map +1 -1
  71. package/fesm2022/ngwr-input-otp.mjs +41 -3
  72. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  73. package/fesm2022/ngwr-knob.mjs +17 -2
  74. package/fesm2022/ngwr-knob.mjs.map +1 -1
  75. package/fesm2022/ngwr-lightbox.mjs +2 -2
  76. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  77. package/fesm2022/ngwr-list.mjs +2 -2
  78. package/fesm2022/ngwr-list.mjs.map +1 -1
  79. package/fesm2022/ngwr-loading-bar.mjs +2 -2
  80. package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
  81. package/fesm2022/ngwr-markdown.mjs +63 -11
  82. package/fesm2022/ngwr-markdown.mjs.map +1 -1
  83. package/fesm2022/ngwr-marquee.mjs +2 -2
  84. package/fesm2022/ngwr-marquee.mjs.map +1 -1
  85. package/fesm2022/ngwr-overlay.mjs +36 -7
  86. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  87. package/fesm2022/ngwr-pagination.mjs +1 -1
  88. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  89. package/fesm2022/ngwr-qr.mjs +38 -1
  90. package/fesm2022/ngwr-qr.mjs.map +1 -1
  91. package/fesm2022/ngwr-radio.mjs +63 -8
  92. package/fesm2022/ngwr-radio.mjs.map +1 -1
  93. package/fesm2022/ngwr-rating.mjs +17 -2
  94. package/fesm2022/ngwr-rating.mjs.map +1 -1
  95. package/fesm2022/ngwr-segmented.mjs +22 -3
  96. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  97. package/fesm2022/ngwr-select.mjs +46 -12
  98. package/fesm2022/ngwr-select.mjs.map +1 -1
  99. package/fesm2022/ngwr-shiny-text.mjs +12 -5
  100. package/fesm2022/ngwr-shiny-text.mjs.map +1 -1
  101. package/fesm2022/ngwr-slider.mjs +21 -6
  102. package/fesm2022/ngwr-slider.mjs.map +1 -1
  103. package/fesm2022/ngwr-spotlight-card.mjs +2 -2
  104. package/fesm2022/ngwr-spotlight-card.mjs.map +1 -1
  105. package/fesm2022/ngwr-star-border.mjs +2 -2
  106. package/fesm2022/ngwr-star-border.mjs.map +1 -1
  107. package/fesm2022/ngwr-switch.mjs +44 -4
  108. package/fesm2022/ngwr-switch.mjs.map +1 -1
  109. package/fesm2022/ngwr-table.mjs +1 -1
  110. package/fesm2022/ngwr-table.mjs.map +1 -1
  111. package/fesm2022/ngwr-tabs.mjs +6 -2
  112. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  113. package/fesm2022/ngwr-textarea.mjs +5 -2
  114. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  115. package/fesm2022/ngwr-theme.mjs +41 -1
  116. package/fesm2022/ngwr-theme.mjs.map +1 -1
  117. package/fesm2022/ngwr-tilt-card.mjs +2 -2
  118. package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
  119. package/fesm2022/ngwr-transfer.mjs +38 -6
  120. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  121. package/fesm2022/ngwr-tree.mjs +33 -7
  122. package/fesm2022/ngwr-tree.mjs.map +1 -1
  123. package/fesm2022/ngwr-typewriter.mjs +2 -2
  124. package/fesm2022/ngwr-typewriter.mjs.map +1 -1
  125. package/fesm2022/ngwr-utils.mjs +107 -1
  126. package/fesm2022/ngwr-utils.mjs.map +1 -1
  127. package/fesm2022/ngwr-version.mjs +1 -1
  128. package/fesm2022/ngwr-version.mjs.map +1 -1
  129. package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
  130. package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
  131. package/fesm2022/ngwr-waves.mjs +2 -2
  132. package/fesm2022/ngwr-waves.mjs.map +1 -1
  133. package/file-upload/styles/_index.scss +6 -0
  134. package/glitch-text/glitch-text.scss +1 -1
  135. package/glitch-text/styles/_index.scss +14 -164
  136. package/glitch-text/styles/_rules.scss +160 -0
  137. package/gradient-text/gradient-text.scss +1 -1
  138. package/gradient-text/styles/_index.scss +15 -118
  139. package/gradient-text/styles/_rules.scss +113 -0
  140. package/input/styles/_index.scss +13 -0
  141. package/input-otp/styles/_index.scss +8 -0
  142. package/lightbox/lightbox.scss +1 -1
  143. package/lightbox/styles/_index.scss +15 -191
  144. package/lightbox/styles/_rules.scss +198 -0
  145. package/list/list.scss +1 -1
  146. package/list/styles/_index.scss +15 -101
  147. package/list/styles/_rules.scss +108 -0
  148. package/llms-full.txt +4 -4
  149. package/loading-bar/loading-bar.scss +1 -1
  150. package/loading-bar/styles/_index.scss +15 -33
  151. package/loading-bar/styles/_rules.scss +28 -0
  152. package/marquee/marquee.scss +1 -1
  153. package/marquee/styles/_index.scss +15 -155
  154. package/marquee/styles/_rules.scss +150 -0
  155. package/package.json +3 -3
  156. package/segmented/styles/_index.scss +8 -0
  157. package/select/styles/_index.scss +17 -1
  158. package/shiny-text/shiny-text.scss +1 -1
  159. package/shiny-text/styles/_index.scss +14 -105
  160. package/shiny-text/styles/_rules.scss +101 -0
  161. package/slider/styles/_index.scss +8 -0
  162. package/spotlight-card/spotlight-card.scss +1 -1
  163. package/spotlight-card/styles/_index.scss +15 -52
  164. package/spotlight-card/styles/_rules.scss +47 -0
  165. package/star-border/star-border.scss +1 -1
  166. package/star-border/styles/_index.scss +15 -125
  167. package/star-border/styles/_rules.scss +120 -0
  168. package/switch/styles/_index.scss +7 -0
  169. package/theme/styles/_dark.scss +81 -4
  170. package/theme/styles/_index.scss +1 -0
  171. package/theme/styles/_motion.scss +94 -0
  172. package/tilt-card/styles/_index.scss +15 -45
  173. package/tilt-card/styles/_rules.scss +40 -0
  174. package/tilt-card/tilt-card.scss +1 -1
  175. package/tree/styles/_index.scss +15 -1
  176. package/types/ngwr-breadcrumbs.d.ts +1 -0
  177. package/types/ngwr-cascader.d.ts +17 -1
  178. package/types/ngwr-checkbox.d.ts +51 -3
  179. package/types/ngwr-color-picker.d.ts +19 -1
  180. package/types/ngwr-file-upload.d.ts +18 -1
  181. package/types/ngwr-form.d.ts +51 -2
  182. package/types/ngwr-fuzzy-text.d.ts +5 -0
  183. package/types/ngwr-icon-adapters-feather.d.ts +11 -0
  184. package/types/ngwr-icon.d.ts +42 -1
  185. package/types/ngwr-input-otp.d.ts +23 -1
  186. package/types/ngwr-knob.d.ts +14 -0
  187. package/types/ngwr-radio.d.ts +37 -2
  188. package/types/ngwr-rating.d.ts +14 -0
  189. package/types/ngwr-segmented.d.ts +18 -1
  190. package/types/ngwr-select.d.ts +17 -1
  191. package/types/ngwr-shiny-text.d.ts +1 -0
  192. package/types/ngwr-slider.d.ts +14 -1
  193. package/types/ngwr-switch.d.ts +26 -2
  194. package/types/ngwr-textarea.d.ts +3 -0
  195. package/types/ngwr-theme.d.ts +24 -0
  196. package/types/ngwr-transfer.d.ts +17 -1
  197. package/types/ngwr-tree.d.ts +21 -1
  198. package/types/ngwr-utils.d.ts +47 -1
  199. package/types/ngwr-version.d.ts +1 -1
  200. package/typewriter/styles/_index.scss +15 -38
  201. package/typewriter/styles/_rules.scss +33 -0
  202. package/typewriter/typewriter.scss +1 -1
  203. package/virtual-scroll/styles/_index.scss +15 -32
  204. package/virtual-scroll/styles/_rules.scss +27 -0
  205. package/virtual-scroll/virtual-scroll.scss +1 -1
  206. package/waves/styles/_index.scss +15 -50
  207. package/waves/styles/_rules.scss +45 -0
  208. package/waves/waves.scss +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-markdown.mjs","sources":["../../../projects/lib/markdown/parse-markdown.ts","../../../projects/lib/markdown/tokens.ts","../../../projects/lib/markdown/wr-markdown-highlight.ts","../../../projects/lib/markdown/wr-markdown.ts","../../../projects/lib/markdown/wr-markdown.html","../../../projects/lib/markdown/provide-wr-markdown.ts","../../../projects/lib/markdown/ngwr-markdown.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type {\n WrMarkdownAlign,\n WrMarkdownBlock,\n WrMarkdownCell,\n WrMarkdownInline,\n WrMarkdownListItem,\n WrMarkdownParseOptions,\n} from './interfaces';\n\n/**\n * Markdown to a node tree. No HTML anywhere in the pipeline.\n *\n * **Why a parser in a component library that has one runtime dependency.** The\n * alternative was `marked` or `markdown-it`, and both produce an HTML string —\n * which then has to reach the DOM through `[innerHTML]`, which means Angular's\n * sanitizer on the hot path of the one component whose input is untrusted by\n * definition, and `bypassSecurityTrustHtml` the moment syntax highlighting is\n * wanted. A node tree renders through ordinary Angular bindings instead: every\n * text node is a text node, every `href` goes through `SecurityContext.URL`, and\n * nothing is ever parsed as HTML. That is worth a parser.\n *\n * The second reason is streaming, which no general-purpose parser is built for.\n * See {@link WrMarkdownParseOptions.streaming}: an open fence has to render as a\n * code block, and a half-typed `**` must not flash on screen as literal\n * asterisks.\n *\n * **The subset, stated rather than discovered.** ATX headings, paragraphs,\n * fenced code, blockquotes, bullet / ordered / task lists (nested), GFM tables,\n * thematic breaks; inline code, strong, emphasis, strikethrough, links, images,\n * autolinks (bracketed and bare), hard breaks, backslash escapes.\n *\n * Deliberately absent, each for a reason:\n *\n * - **Raw HTML is escaped, never rendered.** A markdown renderer whose input is\n * model output or user comments cannot pass `<img onerror>` through and call\n * it a feature. `<div>` in equals `<div>` on screen, as text.\n * - **Indented (four-space) code blocks.** In a document that also has nested\n * lists, indentation is structural, and the ambiguity resolves against the\n * author roughly every time: a wrapped list continuation becomes a code block.\n * Fences are unambiguous, and fences are what generators emit.\n * - **Setext headings** (`===` / `---` under a line). `---` is a thematic break\n * here, always. The dual meaning is a well-known trap and the underline form\n * is essentially unused in generated markdown.\n * - **Reference links, footnotes, definition lists.** They need a second pass\n * over a document that, mid-stream, is not all there yet.\n *\n * Two known deviations, kept rather than fixed, because the cure looked worse than\n * the disease:\n *\n * - **A blank line inside a NESTED list marks the outer list loose too**, so\n * `- a` / ` - b` / blank / ` - c` / `- d` double-spaces the outer items.\n * CommonMark scopes looseness per list; telling the two apart needs to know\n * which level a blank line belongs to, and the indentation alone does not say —\n * content at the item's own indent can belong either to the item or to a\n * sublist's sibling. The visible cost is spacing.\n * - **An unmatched `[` is not linear.** The scan is bounded per opener\n * ({@link MAX_LABEL_LENGTH}) and short-circuits once the source is known to hold\n * no `]` at all, which took `'['.repeat(100000)` from 8s to 0.2s — but a\n * document that is mostly open brackets with a `]` somewhere still pays per\n * opener. Real prose does not have that shape.\n *\n * @param source markdown text\n * @returns block nodes, ready to render\n */\nfunction parseMarkdown(source: string, options: WrMarkdownParseOptions = {}): readonly WrMarkdownBlock[] {\n if (!source) return [];\n\n const ctx = newContext(options.streaming ?? false);\n const blocks = parseBlocks(normalize(source).split('\\n'), 0, ctx);\n\n return ctx.streaming ? applyStreamingTail(blocks) : blocks;\n}\n\n/**\n * How deep a quote / list nest may go before the parser stops recursing.\n *\n * Not a taste limit: each level is a recursive call over its own slice of the\n * lines, so a pathological input (`> > > > …` a thousand deep, which is four\n * kilobytes of text) is a stack overflow inside a change-detection pass. Past\n * the cap the content renders as paragraphs — visible, harmless, and nothing a\n * real document reaches.\n */\nconst MAX_DEPTH = 12;\n\n/**\n * How many columns of a table are rendered.\n *\n * The same class of protection as {@link MAX_DEPTH}, for the same reason, and it\n * was measured rather than guessed: every row is padded to the header's width, so\n * cells scale as columns × rows while the input scales as columns + rows. A 38 KB\n * document — a 10,001-pipe header and 2,000 short rows, which is what a truncated\n * table from a model looks like — produced **20 million cells** in 4.5 seconds,\n * inside a `computed` that re-runs on every streamed chunk. No real table is wider\n * than this; a wider one renders its first 128 columns.\n */\nconst MAX_TABLE_COLUMNS = 128;\n\n/**\n * Threaded down the whole parse rather than applied afterwards.\n *\n * Streaming changes what an UNMATCHED marker means, and only the parser knows it\n * found one. A post-pass over the tree cannot tell `**bold**` from `**bold` —\n * both end up as text and marker characters — so the decision has to be made\n * where the closer was looked for and not found.\n */\ninterface ParseContext {\n readonly streaming: boolean;\n /**\n * Heading slugs already handed out, so a document with two `## Fixes` produces\n * two DIFFERENT ids. Duplicate ids are invalid, and `#fixes` would resolve to\n * whichever came first.\n */\n readonly slugs: Map<string, number>;\n /**\n * Per marker character, the earliest index from which a closer search has\n * already come up empty.\n *\n * This is what keeps the inline scanner linear. The closer search is monotone —\n * if no valid closer exists after index `i`, none exists after any index past\n * `i` either, since that window is a subset — so one failure answers every\n * later opener of the same character. Without it, `'*a '.repeat(34000)` is 10.8\n * SECONDS inside a `computed`, on the main thread.\n *\n * Scoped to ONE scan, not to the document: `inlines()` replaces this and\n * {@link ParseContext.noBracket} on entry, because the numbers index into the\n * string that call is walking and mean nothing in any other.\n */\n readonly noCloser: Map<string, number>;\n /** Same idea for `]`: the index from which the source contains none at all. */\n readonly noBracket: { from: number };\n /**\n * True while parsing a link's label. CommonMark forbids links inside links, and\n * a tree built with DOM APIs happily nests the `<a>` an HTML parser would have\n * rejected — which is invalid markup and an axe `nested-interactive` violation.\n */\n readonly inLink: boolean;\n}\n\nfunction newContext(streaming: boolean): ParseContext {\n return {\n streaming,\n slugs: new Map(),\n noCloser: new Map(),\n noBracket: { from: Number.POSITIVE_INFINITY },\n inLink: false,\n };\n}\n\nconst FENCE_RE = /^( {0,3})(`{3,}|~{3,})[ \\t]*(.*)$/;\n// The closing `#` run must be PRECEDED by whitespace, or `# C#` loses its sharp\n// and `#######` (seven, not a heading in any dialect) matches as an empty h6.\nconst HEADING_RE = /^ {0,3}(#{1,6})(?:[ \\t]+(.*?))?(?:[ \\t]+#+)?[ \\t]*$/;\nconst RULE_RE = /^ {0,3}(?:(?:\\*[ \\t]*){3,}|(?:-[ \\t]*){3,}|(?:_[ \\t]*){3,})$/;\nconst QUOTE_RE = /^ {0,3}>[ \\t]?(.*)$/;\nconst LIST_RE = /^( *)([-*+]|\\d{1,9}[.)])(?:([ \\t]+)(.*)|[ \\t]*)$/;\nconst TASK_RE = /^\\[([ xX])\\](?:[ \\t]+(.*)|[ \\t]*)$/;\nconst TABLE_DELIM_RE = /^ {0,3}\\|?[ \\t]*:?-+:?[ \\t]*(?:\\|[ \\t]*:?-+:?[ \\t]*)*\\|?[ \\t]*$/;\n\n/**\n * `\\r\\n` and lone `\\r` out; tabs in the INDENT to four spaces, so indent maths is\n * in one unit.\n *\n * The whole leading whitespace run, not just a line-initial tab: `' \\t- b'` is\n * two spaces and a tab, and `parseList` measures indentation in characters, so a\n * tab counted as one column made mixed indentation parse as literal text.\n */\nfunction normalize(source: string): string {\n return source.replace(/\\r\\n?/g, '\\n').replace(/^[ \\t]+/gm, indent => indent.replace(/\\t/g, ' '));\n}\n\n/** Does this line begin a block that interrupts a paragraph or a list item? */\nfunction startsBlock(line: string): boolean {\n return (\n FENCE_RE.test(line) || HEADING_RE.test(line) || RULE_RE.test(line) || QUOTE_RE.test(line) || LIST_RE.test(line)\n );\n}\n\n/**\n * Does this line end the paragraph it follows?\n *\n * Every block start does, except the two lists CommonMark says cannot interrupt\n * one: an ordered item whose number is not 1, and an item with no content. The\n * first rule exists for a single shape, and it is a shape prose actually has —\n * \"The year was\" / \"1986. It was a good year.\" must not become a list numbered\n * from 1986.\n */\nfunction interruptsParagraph(line: string): boolean {\n const list = matchListStart(line);\n if (list && !RULE_RE.test(line)) {\n return list.content.trim() !== '' && (!list.ordered || list.number === 1);\n }\n\n return startsBlock(line);\n}\n\ninterface ListStart {\n readonly indent: number;\n readonly ordered: boolean;\n readonly number: number;\n readonly content: string;\n /** Column the item's own content starts at — the dedent for everything inside it. */\n readonly contentIndent: number;\n}\n\nfunction matchListStart(line: string): ListStart | null {\n const match = LIST_RE.exec(line);\n if (!match) return null;\n\n const [, indent, marker, spaces, content] = match;\n const ordered = !/^[-*+]$/.test(marker);\n\n return {\n indent: indent.length,\n ordered,\n number: ordered ? Number.parseInt(marker, 10) : 1,\n content: content ?? '',\n // An empty item (`-` alone) has no run of spaces to measure, so assume one.\n contentIndent: indent.length + marker.length + (spaces?.length ?? 1),\n };\n}\n\nfunction parseBlocks(lines: readonly string[], depth: number, ctx: ParseContext): readonly WrMarkdownBlock[] {\n if (depth >= MAX_DEPTH) {\n const text = lines.join('\\n').trim();\n return text ? [{ kind: 'paragraph', inlines: inlines(text, 0, ctx) }] : [];\n }\n\n const out: WrMarkdownBlock[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (!line.trim()) {\n i++;\n continue;\n }\n\n const fence = FENCE_RE.exec(line);\n if (fence) {\n const [, indent, marker, info] = fence;\n const body: string[] = [];\n const closer = new RegExp(`^ {0,3}\\\\${marker[0]}{${marker.length},}[ \\\\t]*$`);\n let closed = false;\n i++;\n\n while (i < lines.length) {\n if (closer.test(lines[i])) {\n closed = true;\n i++;\n break;\n }\n // The opening fence's own indentation is not part of the code.\n body.push(stripIndent(lines[i], indent.length));\n i++;\n }\n\n out.push({\n kind: 'code',\n language: info.trim().split(/\\s+/)[0].toLowerCase() || null,\n code: body.join('\\n'),\n closed,\n });\n continue;\n }\n\n const heading = HEADING_RE.exec(line);\n if (heading) {\n const text = (heading[2] ?? '').trim();\n const content = inlines(text, 0, ctx);\n out.push({\n kind: 'heading',\n level: heading[1].length as 1 | 2 | 3 | 4 | 5 | 6,\n inlines: content,\n // Slugged from the rendered TEXT, not from the markdown: `## See [docs](url)`\n // was producing `see-docshttpsxdeva`, an anchor nobody can link to.\n id: uniqueSlug(plainText(content), ctx),\n });\n i++;\n continue;\n }\n\n if (RULE_RE.test(line)) {\n out.push({ kind: 'rule' });\n i++;\n continue;\n }\n\n if (QUOTE_RE.test(line)) {\n const body: string[] = [];\n while (i < lines.length) {\n const quoted = QUOTE_RE.exec(lines[i]);\n if (quoted) {\n body.push(quoted[1]);\n i++;\n continue;\n }\n // Lazy continuation: an unmarked, non-blank line still belongs to the\n // quote unless it starts a block of its own.\n if (!lines[i].trim() || startsBlock(lines[i])) break;\n body.push(lines[i].trimStart());\n i++;\n }\n out.push({ kind: 'quote', children: parseBlocks(body, depth + 1, ctx) });\n continue;\n }\n\n if (matchListStart(line)) {\n const [list, next] = parseList(lines, i, depth, ctx);\n out.push(list);\n i = next;\n continue;\n }\n\n if (isTableStart(lines, i)) {\n const [table, next] = parseTable(lines, i, ctx);\n out.push(table);\n i = next;\n continue;\n }\n\n const paragraph: string[] = [line];\n i++;\n while (i < lines.length && lines[i].trim() && !interruptsParagraph(lines[i])) {\n // A delimiter row two lines in turns the paragraph into a table header.\n if (isTableStart(lines, i)) break;\n paragraph.push(lines[i]);\n i++;\n }\n out.push({ kind: 'paragraph', inlines: inlines(paragraph.join('\\n').trim(), 0, ctx) });\n }\n\n return out;\n}\n\n/**\n * A table header, or a sentence that happens to contain a pipe.\n *\n * GFM's own rule, and the one this used to be missing: \"the header row must match\n * the delimiter row in the number of cells. If not, a table will not be\n * recognized.\" Without the count check, `Use the | character` followed by `---`\n * became a two-column table with an empty body — swallowing both the sentence and\n * the thematic break, and contradicting this file's own decision that `---` is\n * always a rule.\n */\nfunction isTableStart(lines: readonly string[], at: number): boolean {\n const header = lines[at];\n const delimiter = lines[at + 1];\n\n if (!header?.includes('|') || delimiter === undefined || !TABLE_DELIM_RE.test(delimiter)) return false;\n\n return splitRow(header).length === splitRow(delimiter).length;\n}\n\n/** Remove up to `width` leading spaces — never more, so relative indent survives. */\nfunction stripIndent(line: string, width: number): string {\n let cut = 0;\n while (cut < width && line[cut] === ' ') cut++;\n return line.slice(cut);\n}\n\nfunction parseList(\n lines: readonly string[],\n from: number,\n depth: number,\n ctx: ParseContext\n): [WrMarkdownBlock, number] {\n const first = matchListStart(lines[from])!;\n const items: WrMarkdownListItem[] = [];\n let loose = false;\n let i = from;\n\n while (i < lines.length) {\n // A thematic break wins over a list item, which is CommonMark's rule and not\n // a nicety: `* * *` matches the bullet pattern, so without this `* a`,\n // `* * *`, `* b` is one list with a phantom nesting level where the divider\n // was, and the `<hr>` is gone.\n if (RULE_RE.test(lines[i])) break;\n\n const start = matchListStart(lines[i]);\n // A different marker family starts a NEW list rather than continuing this\n // one — `- a` then `1. b` is two lists, and rendering it as one silently\n // renumbers the author's content.\n if (start?.ordered !== first.ordered || start.indent > first.indent + 3) break;\n\n const body: string[] = [start.content];\n let blanks = 0;\n i++;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (!line.trim()) {\n blanks++;\n i++;\n continue;\n }\n\n const indent = line.length - line.trimStart().length;\n if (indent >= start.contentIndent) {\n // A blank line followed by more of the same item makes the list loose,\n // which is what decides whether items get `<p>` wrappers.\n if (blanks > 0) {\n body.push(...Array<string>(blanks).fill(''));\n loose = true;\n blanks = 0;\n }\n body.push(stripIndent(line, start.contentIndent));\n i++;\n continue;\n }\n\n // Out-dented: a sibling item, another block, or lazy continuation of this\n // item's paragraph. After a blank line only a sibling can follow.\n if (blanks > 0 || matchListStart(line) || startsBlock(line)) break;\n body.push(line.trimStart());\n i++;\n }\n\n const nextIsSibling = i < lines.length && matchListStart(lines[i]) !== null;\n if (blanks > 0 && nextIsSibling) loose = true;\n\n items.push(makeItem(body, depth, ctx));\n\n if (blanks > 0 && !nextIsSibling) break;\n }\n\n return [{ kind: 'list', ordered: first.ordered, start: first.number, tight: !loose, items }, i];\n}\n\nfunction makeItem(body: readonly string[], depth: number, ctx: ParseContext): WrMarkdownListItem {\n const task = TASK_RE.exec(body[0] ?? '');\n const lines = task ? [task[2] ?? '', ...body.slice(1)] : body;\n\n return {\n children: parseBlocks(lines, depth + 1, ctx),\n checked: task ? task[1].toLowerCase() === 'x' : null,\n };\n}\n\nfunction parseTable(lines: readonly string[], from: number, ctx: ParseContext): [WrMarkdownBlock, number] {\n const head = splitRow(lines[from]).slice(0, MAX_TABLE_COLUMNS);\n const align = splitRow(lines[from + 1]).map((spec): WrMarkdownAlign => {\n const left = spec.startsWith(':');\n const right = spec.endsWith(':');\n if (left && right) return 'center';\n if (right) return 'end';\n if (left) return 'start';\n return null;\n });\n\n const rows: WrMarkdownCell[][] = [];\n let i = from + 2;\n\n while (i < lines.length) {\n const line = lines[i];\n // GFM ends a table at a blank line, a line that starts another block, or\n // anything without a cell divider.\n if (!line.trim() || !line.includes('|') || startsBlock(line)) break;\n rows.push(normalizeCells(splitRow(line), head.length, ctx));\n i++;\n }\n\n return [\n {\n kind: 'table',\n head: head.map(cell => ({ inlines: inlines(cell, 0, ctx) })),\n rows,\n align: normalizeAlign(align, head.length),\n },\n i,\n ];\n}\n\n/** Split on unescaped pipes, dropping the optional leading and trailing one. */\nfunction splitRow(line: string): string[] {\n const cells: string[] = [];\n let current = '';\n\n for (let i = 0; i < line.length; i++) {\n if (line[i] === '\\\\' && line[i + 1] === '|') {\n current += '|';\n i++;\n continue;\n }\n if (line[i] === '|') {\n cells.push(current);\n current = '';\n continue;\n }\n current += line[i];\n }\n cells.push(current);\n\n if (cells.length > 1 && !cells[0].trim()) cells.shift();\n if (cells.length > 1 && !cells[cells.length - 1].trim()) cells.pop();\n\n return cells.map(cell => cell.trim());\n}\n\n/** A row shorter than the header gets empty cells; a longer one is truncated. */\nfunction normalizeCells(cells: readonly string[], width: number, ctx: ParseContext): WrMarkdownCell[] {\n return Array.from({ length: width }, (_, index) => ({ inlines: inlines(cells[index] ?? '', 0, ctx) }));\n}\n\nfunction normalizeAlign(align: readonly WrMarkdownAlign[], width: number): WrMarkdownAlign[] {\n return Array.from({ length: width }, (_, index) => align[index] ?? null);\n}\n\n/**\n * GitHub-compatible heading slug: lowercase, punctuation dropped, spaces to dashes.\n *\n * `_` and `-` are KEPT, which is what GitHub does — stripping the underscore broke\n * every published `#snake_case` anchor.\n */\nfunction slug(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}\\s_-]/gu, '')\n .trim()\n .replace(/\\s+/g, '-');\n}\n\n/**\n * The slug, with a counter when the document repeats a title.\n *\n * Two `## Fixes` in one changelog produced two `id=\"fixes\"`, which is invalid and\n * makes `#fixes` resolve to whichever came first. GitHub appends `-1`, `-2`; so\n * does this. An empty slug (a heading of pure emoji, or no text at all) stays\n * empty and the renderer binds no `id`.\n */\nfunction uniqueSlug(text: string, ctx: ParseContext): string {\n const base = slug(text);\n if (!base) return '';\n\n const used = ctx.slugs.get(base) ?? 0;\n ctx.slugs.set(base, used + 1);\n\n return used === 0 ? base : `${base}-${used}`;\n}\n\n// ---------------------------------------------------------------------------\n// Inline\n// ---------------------------------------------------------------------------\n\n// Every ASCII punctuation character, which is what CommonMark allows. The\n// hand-written subset left `\\$`, `\\&`, `\\%` and eight others rendering with their\n// backslash — and `\\$` is what generators emit to keep a dollar out of math mode.\nconst ESCAPABLE = /[!-/:-@[-`{-~]/;\nconst SCHEME_RE = /^([a-z][a-z0-9+.-]*):/i;\nconst ALLOWED_SCHEMES = new Set(['http', 'https', 'mailto', 'tel', 'ftp']);\nconst DATA_IMAGE_RE = /^data:image\\/(?:png|jpe?g|gif|webp|avif);base64,[a-z0-9+/=]+$/i;\nconst AUTOLINK_RE = /^<((?:https?|mailto|tel):[^>\\s]+)>/i;\n/** `<destination>` — markdown's way of putting a space in a URL. */\nconst ANGLE_DEST_RE = /^<([^<>]*)>(?:\\s+[\"'(](.*)[\"')])?$/;\n/** CommonMark's own cap on a link label, which is also what bounds the scan. */\nconst MAX_LABEL_LENGTH = 999;\nconst BARE_URL_RE = /^https?:\\/\\/[^\\s<>[\\]()]*(?:\\([^\\s<>()]*\\)[^\\s<>[\\]()]*)*/i;\nconst EMAIL_AUTOLINK_RE = /^<([^\\s@<>]+@[^\\s@<>.]+\\.[^\\s@<>]+)>/;\n\n/**\n * A URL safe to put in `href` / `src`, or `null` to render the link as plain text.\n *\n * Two layers, and both are wanted. Angular sanitizes `[href]` bindings itself,\n * but its answer to a hostile URL is the string `unsafe:javascript:…` in a live\n * anchor — a link that looks real, is announced as a link, and does nothing.\n * Refusing it here means the label renders as text instead, which is honest.\n *\n * Whitespace and control characters are stripped before the scheme is read,\n * because `java\\nscript:` and `java script:` are the same URL to a browser and\n * different strings to a naive check.\n */\nfunction safeMarkdownUrl(raw: string, kind: 'link' | 'image'): string | null {\n const url = raw.trim();\n // Whitespace and control characters only: a hyphen has no business being\n // stripped out of a host name. Written as escapes rather than literal bytes —\n // a raw NUL inside a regex literal makes the file binary to every text tool.\n // Stripping control characters is the entire point here: a browser ignores them\n // before resolving the scheme, so a check that reads the raw string sees a\n // relative path and waves `java\\u0000script:` straight through.\n // eslint-disable-next-line no-control-regex\n const bare = url.replace(/[\\s\\u0000-\\u001f\\u007f]/g, '');\n const scheme = SCHEME_RE.exec(bare);\n\n // No scheme at all: relative path, `#anchor`, `//host` — nothing executable.\n if (!scheme) return url;\n\n const name = scheme[1].toLowerCase();\n\n // `data:` is an image-only allowance, and only for raster types: an SVG can\n // carry script, and `data:text/html` is a same-origin document.\n if (name === 'data') return kind === 'image' && DATA_IMAGE_RE.test(bare) ? bare : null;\n\n return ALLOWED_SCHEMES.has(name) ? url : null;\n}\n\n/** Inline markdown to nodes. */\nfunction parseInlines(source: string, options: WrMarkdownParseOptions = {}): readonly WrMarkdownInline[] {\n return inlines(source, 0, newContext(options.streaming ?? false));\n}\n\nfunction inlines(source: string, depth: number, outer: ParseContext): readonly WrMarkdownInline[] {\n if (depth >= MAX_DEPTH) return source ? [{ kind: 'text', value: source }] : [];\n\n // The two failure memos hold INDEXES into `source`, so they are only ever true\n // of the one string this call is scanning — and the context they live on spans\n // the whole document. Shared, an index recorded in one paragraph is compared\n // against a position in the next, and refuses emphasis and links that are\n // perfectly well formed; `matchEmphasis` recursing on a slice (below) does the\n // same thing INSIDE a single paragraph, so restoring on return would not be\n // enough either. A memo per scan is the only keying that means anything, and it\n // costs nothing: the linearity argument in {@link ParseContext.noCloser} is a\n // statement about one string in the first place.\n const ctx: ParseContext = { ...outer, noCloser: new Map(), noBracket: { from: Number.POSITIVE_INFINITY } };\n\n const out: WrMarkdownInline[] = [];\n let text = '';\n let i = 0;\n\n const flush = (): void => {\n if (text) {\n out.push({ kind: 'text', value: text });\n text = '';\n }\n };\n\n while (i < source.length) {\n const char = source[i];\n\n if (char === '\\\\') {\n // A backslash before a newline is a hard break; before punctuation, an escape.\n if (source[i + 1] === '\\n') {\n flush();\n out.push({ kind: 'break' });\n i += 2;\n continue;\n }\n if (i + 1 < source.length && ESCAPABLE.test(source[i + 1])) {\n text += source[i + 1];\n i += 2;\n continue;\n }\n }\n\n if (char === '\\n') {\n // Two trailing spaces are markdown's hard break. `endsWith`, not\n // `/[ ]{2,}$/.test(text)`: that regex has no start anchor, so it retries\n // from every position of the accumulated paragraph, which made paragraph\n // parsing quadratic. On a 161 KB document a CPU profile put 3306 ms of 3378\n // ms of total self-time in that one test — and it is re-paid on every\n // streamed chunk.\n const hard = text.endsWith(' ');\n if (hard) {\n text = text.replace(/[ ]+$/, '');\n flush();\n out.push({ kind: 'break' });\n } else {\n // A soft break is whitespace; CSS collapses it like any other.\n text += '\\n';\n }\n i++;\n continue;\n }\n\n if (char === '`') {\n const run = /^`+/.exec(source.slice(i))![0];\n const close = findCodeClose(source, i + run.length, run);\n if (close !== -1) {\n flush();\n out.push({ kind: 'code', value: codeSpanValue(source.slice(i + run.length, close)) });\n i = close + run.length;\n continue;\n }\n }\n\n if (char === '<') {\n const auto = AUTOLINK_RE.exec(source.slice(i));\n if (auto) {\n // `ctx.inLink`: CommonMark forbids a link inside a link, and nothing else\n // stops it here — a tree built with DOM APIs nests the `<a>` an HTML\n // parser would have thrown away, which is invalid markup and an axe\n // `nested-interactive` violation at serious level.\n const href = ctx.inLink ? null : safeMarkdownUrl(auto[1], 'link');\n flush();\n out.push(\n href\n ? { kind: 'link', href, title: null, children: [{ kind: 'text', value: auto[1] }] }\n : { kind: 'text', value: auto[1] }\n );\n i += auto[0].length;\n continue;\n }\n const email = EMAIL_AUTOLINK_RE.exec(source.slice(i));\n if (email) {\n // Through `safeMarkdownUrl` like every other href: built by hand, this was\n // the one destination that skipped the control-character strip, which the\n // component's own JSDoc promises for all of them.\n const href = ctx.inLink ? null : safeMarkdownUrl(`mailto:${email[1]}`, 'link');\n flush();\n out.push(\n href\n ? { kind: 'link', href, title: null, children: [{ kind: 'text', value: email[1] }] }\n : { kind: 'text', value: email[1] }\n );\n i += email[0].length;\n continue;\n }\n }\n\n if (char === '!' && source[i + 1] === '[') {\n const link = matchLink(source, i + 1, ctx);\n if (link) {\n const src = safeMarkdownUrl(link.href, 'image');\n const alt = plainText(inlines(link.label, depth + 1, { ...ctx, inLink: true }));\n flush();\n // A refused source leaves the alt text, which is the information the\n // author actually wrote.\n out.push(src ? { kind: 'image', src, alt, title: link.title } : { kind: 'text', value: alt });\n i = link.end;\n continue;\n }\n }\n\n if (char === '[') {\n const link = matchLink(source, i, ctx);\n if (link) {\n const href = ctx.inLink ? null : safeMarkdownUrl(link.href, 'link');\n // The label is parsed with links SUPPRESSED, so an inner one renders as\n // its own text — CommonMark's answer to `[a [b](c)](d)`.\n const children = inlines(link.label, depth + 1, { ...ctx, inLink: true });\n flush();\n if (href) out.push({ kind: 'link', href, title: link.title, children });\n else out.push(...children);\n i = link.end;\n continue;\n }\n }\n\n if ((char === 'h' || char === 'H') && (i === 0 || !/[\\w/]/.test(source[i - 1]))) {\n const bare = ctx.inLink ? null : BARE_URL_RE.exec(source.slice(i));\n if (bare) {\n const url = trimUrlPunctuation(bare[0]);\n const href = safeMarkdownUrl(url, 'link');\n if (href) {\n flush();\n out.push({ kind: 'link', href, title: null, children: [{ kind: 'text', value: url }] });\n i += url.length;\n continue;\n }\n }\n }\n\n if (char === '*' || char === '_' || char === '~') {\n const emphasis = matchEmphasis(source, i, depth, ctx);\n if (emphasis) {\n flush();\n out.push(emphasis.node);\n i = emphasis.end;\n continue;\n }\n }\n\n text += char;\n i++;\n }\n\n flush();\n\n return out;\n}\n\n/** The closing backtick run of exactly the opener's length — a longer run is not it. */\nfunction findCodeClose(source: string, from: number, run: string): number {\n for (let i = from; i < source.length; i++) {\n if (source[i] !== '`') continue;\n\n let end = i;\n while (source[end] === '`') end++;\n if (end - i === run.length) return i;\n i = end - 1;\n }\n\n return -1;\n}\n\n/** CommonMark strips one space from each end when both are present. */\nfunction codeSpanValue(raw: string): string {\n const value = raw.replace(/\\n/g, ' ');\n return value.length > 2 && value.startsWith(' ') && value.endsWith(' ') && value.trim() ? value.slice(1, -1) : value;\n}\n\ninterface LinkMatch {\n readonly label: string;\n readonly href: string;\n readonly title: string | null;\n /** Index just past the closing paren. */\n readonly end: number;\n}\n\n/**\n * `[label](href \"title\")` starting at `source[at] === '['`.\n *\n * Two bounds, both load-bearing. The label scan stops at\n * {@link MAX_LABEL_LENGTH}, which is CommonMark's own limit, and a scan that\n * reaches the end of the source without meeting a single `]` records the fact in\n * the context — from then on every later `[` answers in constant time. Without\n * that, `'['.repeat(100000)` spent 8 seconds on the main thread, inside a\n * `computed`.\n */\nfunction matchLink(source: string, at: number, ctx: ParseContext): LinkMatch | null {\n if (at >= ctx.noBracket.from) return null;\n\n let depth = 0;\n let close = -1;\n let sawClose = false;\n let scannedToEnd = true;\n\n for (let i = at; i < source.length; i++) {\n if (i - at > MAX_LABEL_LENGTH) {\n scannedToEnd = false;\n break;\n }\n const char = source[i];\n if (char === '\\\\') {\n i++;\n continue;\n }\n // A code span can hold an unbalanced bracket; stepping over it keeps\n // `` [`a]b`](x) `` from ending the label early.\n if (char === '`') {\n const run = /^`+/.exec(source.slice(i))![0];\n const end = findCodeClose(source, i + run.length, run);\n if (end !== -1) {\n i = end + run.length - 1;\n continue;\n }\n }\n if (char === '[') depth++;\n if (char === ']') {\n sawClose = true;\n depth--;\n if (depth === 0) {\n close = i;\n break;\n }\n }\n }\n\n if (close === -1) {\n // Only when the source truly holds no `]` past here: an unbalanced nest\n // (`[[a](b)`) fails for a different reason, and memoising that would hide the\n // valid link one character to the right.\n if (!sawClose && scannedToEnd) ctx.noBracket.from = Math.min(ctx.noBracket.from, at);\n return null;\n }\n\n if (source[close + 1] !== '(') return null;\n\n let parens = 1;\n let end = -1;\n for (let i = close + 2; i < source.length; i++) {\n const char = source[i];\n if (char === '\\\\') {\n i++;\n continue;\n }\n if (char === '(') parens++;\n if (char === ')') {\n parens--;\n if (parens === 0) {\n end = i;\n break;\n }\n }\n // A newline inside the destination means this was never a link.\n if (char === '\\n') return null;\n }\n\n if (end === -1) return null;\n\n const target = source.slice(close + 2, end).trim();\n const label = source.slice(at + 1, close);\n\n // `<…>` around the destination is markdown's way of allowing a space in it, and\n // it has to be unwrapped BEFORE the scheme is read: `[a](<javascript:alert(1)>)`\n // has no scheme while the bracket is still attached, so `safeMarkdownUrl` read\n // it as a relative path and waved it through — leaving Angular's sanitizer, the\n // layer this file calls insufficient, as the only thing standing in the way.\n const angled = ANGLE_DEST_RE.exec(target);\n if (angled) return { label, href: angled[1], title: angled[2] ?? null, end: end + 1 };\n\n const titled = /^(\\S*)\\s+[\"'(](.*)[\"')]$/.exec(target);\n\n return {\n label,\n href: titled ? titled[1] : target,\n title: titled ? titled[2] : null,\n end: end + 1,\n };\n}\n\n/** Trailing sentence punctuation belongs to the prose, not to the bare URL. */\nfunction trimUrlPunctuation(url: string): string {\n return url.replace(/[.,;:!?'\"]+$/, '');\n}\n\ninterface EmphasisMatch {\n readonly node: WrMarkdownInline;\n readonly end: number;\n}\n\n/**\n * Emphasis, strong and strikethrough.\n *\n * A pragmatic reading of CommonMark's flanking rules rather than the full\n * algorithm: an opener may not be followed by whitespace, a closer may not be\n * preceded by it, and `_` additionally may not sit against a word character on\n * the outside. That last clause is the one that matters in practice — without it\n * `snake_case_name` renders as `snake<em>case</em>name`, which is how most\n * lightweight parsers embarrass themselves on code-adjacent prose.\n */\nfunction matchEmphasis(source: string, at: number, depth: number, ctx: ParseContext): EmphasisMatch | null {\n const char = source[at];\n const run = /^(\\*+|_+|~+)/.exec(source.slice(at))![0].length;\n\n // `~` is strikethrough only as a pair: a single one is arithmetic, a path, or\n // LaTeX far more often than it is emphasis.\n if (char === '~' && run < 2) return null;\n\n const use = char === '~' ? 2 : Math.min(run, 2);\n const after = source[at + run];\n if (after === undefined || /\\s/.test(after)) return null;\n if (char === '_' && at > 0 && /[\\p{L}\\p{N}]/u.test(source[at - 1])) return null;\n\n // Already known to have no closer from here on. The search is monotone — the\n // window for a later opener is a subset of this one — so one failure answers\n // every subsequent opener of the same character, which is what turns a\n // quadratic scan into a linear one.\n const failedFrom = ctx.noCloser.get(char);\n if (failedFrom !== undefined && at >= failedFrom) return null;\n\n for (let i = at + run; i < source.length; i++) {\n const current = source[i];\n\n if (current === '\\\\') {\n i++;\n continue;\n }\n\n if (current === '`') {\n const backticks = /^`+/.exec(source.slice(i))![0];\n const end = findCodeClose(source, i + backticks.length, backticks);\n if (end !== -1) {\n i = end + backticks.length - 1;\n continue;\n }\n }\n\n if (current !== char) continue;\n\n let end = i;\n while (source[end] === char) end++;\n const length = end - i;\n\n if (length < use || /\\s/.test(source[i - 1])) {\n i = end - 1;\n continue;\n }\n if (char === '_' && end < source.length && /[\\p{L}\\p{N}]/u.test(source[end])) {\n i = end - 1;\n continue;\n }\n\n // Take `use` markers from the START of the opener and the END of the closer,\n // so `***x***` leaves `*x*` inside the strong node and nests correctly.\n const children = inlines(source.slice(at + use, end - use), depth + 1, ctx);\n const kind = char === '~' ? 'del' : use === 2 ? 'strong' : 'em';\n\n return { node: { kind, children }, end };\n }\n\n // No closer anywhere in this source. Recorded so the next opener of the same\n // character does not repeat the walk.\n //\n // Note what does NOT happen here any more: an optimistic close. Guessing at the\n // scanner level meant a marker 40 characters back swallowed the rest of the\n // block — including markup that had already parsed, so an unclosed backtick ate\n // a finished `[docs](url)` and rendered it as monospaced source. Mid-stream\n // guessing now happens once, on the document's tail, where it can be bounded.\n // See {@link applyStreamingTail}.\n ctx.noCloser.set(char, Math.min(failedFrom ?? Number.POSITIVE_INFINITY, at));\n\n return null;\n}\n\n/** Text content of an inline tree — for `alt` and for heading slugs. */\nfunction plainText(inlines: readonly WrMarkdownInline[]): string {\n return inlines\n .map(node => {\n switch (node.kind) {\n case 'text':\n case 'code':\n return node.value;\n case 'image':\n return node.alt;\n case 'break':\n return ' ';\n default:\n return plainText(node.children);\n }\n })\n .join('');\n}\n\n// ---------------------------------------------------------------------------\n// Streaming\n// ---------------------------------------------------------------------------\n\n/**\n * How far back from the end of the document a marker may sit and still be treated\n * as mid-flight.\n *\n * The optimistic close is a GUESS, and a guess needs a blast radius. Unbounded, a\n * `*` forty characters back turned the rest of a finished sentence into emphasis\n * for the whole stream and then unwrapped it at the end — the exact restyle the\n * feature exists to avoid. Within a chunk's distance of the end, an unmatched\n * marker is nearly always a construct still arriving.\n */\nconst TAIL_WINDOW = 80;\n\n/**\n * A run that is worth closing optimistically, and its node kind.\n *\n * Deliberately no single `*` or `_`. Those are multiplication signs, file names\n * and `snake_case` far more often than they are emphasis mid-word, and getting it\n * wrong there restyles ordinary prose. `**`, `__`, `~~` and a backtick are\n * unambiguous enough to bet on.\n */\nconst OPTIMISTIC_RE = /(\\*\\*|__|~~|`)([^\\s*_~`][^*_~`]*)$/;\n\n/**\n * A construct the stream has only begun to type: a trailing marker run, or a link\n * whose destination has not arrived.\n *\n * Anchored, and every alternative bounded. The version this replaced allowed\n * `\\][^)]*` to run to the end of the text, so a CLOSED `[docs]` in the middle of a\n * sentence matched from the bracket onwards and deleted the rest of the paragraph\n * — and kept deleting it for the whole stream, because the paragraph stayed the\n * last block. `See the [docs] for details.` rendered as `See the `.\n */\nconst FRAGMENT_RE = /(?:[*_~`]+|!?\\[[^\\]\\n]*(?:\\]\\([^)\\s]*)?)$/;\n\n/**\n * The mid-stream adjustments, applied once to the document's TAIL.\n *\n * Everything the streaming mode does beyond parsing an open fence lives here, and\n * the reason is scope. The tail is the only part of a streamed document that is\n * still changing, so it is the only part where guessing is defensible; a guess\n * made inside the inline scanner cannot tell whether it is at the end of the\n * document or in the middle of a paragraph that finished two chunks ago.\n *\n * It descends: the last block may be a quote, or the last item of a list, which is\n * where most streamed prose actually lives. The version that only looked at a\n * top-level paragraph left the `**` flicker in place everywhere else while the\n * documentation claimed otherwise.\n */\nfunction applyStreamingTail(blocks: readonly WrMarkdownBlock[]): readonly WrMarkdownBlock[] {\n const last = blocks[blocks.length - 1];\n if (!last) return blocks;\n\n const patched = patchBlock(last);\n if (patched === last) return blocks;\n\n const head = blocks.slice(0, -1);\n\n return patched === null ? head : [...head, patched];\n}\n\n/** `null` to drop the block entirely, the same reference to leave it alone. */\nfunction patchBlock(block: WrMarkdownBlock): WrMarkdownBlock | null {\n switch (block.kind) {\n case 'paragraph':\n case 'heading': {\n // `## ` with nothing after it yet: a node that would render as an empty box.\n if (block.inlines.length === 0) return null;\n\n const inlines = patchInlines(block.inlines);\n if (inlines === block.inlines) return block;\n\n return inlines.length === 0 ? null : { ...block, inlines };\n }\n\n case 'quote': {\n const children = applyStreamingTail(block.children);\n if (children === block.children) return block;\n\n return children.length === 0 ? null : { ...block, children };\n }\n\n case 'list': {\n const item = block.items[block.items.length - 1];\n if (!item) return block;\n\n const children = applyStreamingTail(item.children);\n if (children === item.children) return block;\n\n // The item stays even when its content goes: the bullet is already on\n // screen, and removing it would be a flicker of its own.\n return { ...block, items: [...block.items.slice(0, -1), { ...item, children }] };\n }\n\n default:\n return block;\n }\n}\n\nfunction patchInlines(nodes: readonly WrMarkdownInline[]): readonly WrMarkdownInline[] {\n const last = nodes[nodes.length - 1];\n if (!last) return nodes;\n\n // The tail may be inside a wrapper — `**bold and [lin` puts it inside the strong.\n if (last.kind === 'strong' || last.kind === 'em' || last.kind === 'del' || last.kind === 'link') {\n const children = patchInlines(last.children);\n if (children === last.children) return nodes;\n\n const head = nodes.slice(0, -1);\n\n return children.length === 0 ? head : [...head, { ...last, children }];\n }\n\n // A backtick that has only just arrived, already painted as an empty chip.\n if (last.kind === 'code' && last.value === '') return nodes.slice(0, -1);\n\n if (last.kind !== 'text') return nodes;\n\n const patched = patchText(last.value);\n\n return patched === null ? nodes : [...nodes.slice(0, -1), ...patched];\n}\n\n/** `null` when the text is not a tail that needs adjusting. */\nfunction patchText(value: string): readonly WrMarkdownInline[] | null {\n let text = value;\n\n // Repeatedly, because dropping `[lin` from `**bold and [lin` exposes the `**`\n // behind it, which is then a candidate for the optimistic close below.\n for (let pass = 0; pass < 3; pass++) {\n const shorter = text.replace(FRAGMENT_RE, '');\n if (shorter === text) break;\n text = shorter;\n }\n\n const opening = OPTIMISTIC_RE.exec(text);\n if (opening) {\n const [matched, marker, content] = opening;\n const at = text.length - matched.length;\n const before = text.slice(0, at);\n // `_` may not close against a word character, so mid-word it is not a marker\n // at all — `snake_case` must not italicise as it arrives.\n const wordBefore = marker === '__' && at > 0 && /[\\p{L}\\p{N}]/u.test(text[at - 1]);\n\n if (!wordBefore && content.length <= TAIL_WINDOW) {\n const node: WrMarkdownInline =\n marker === '`'\n ? { kind: 'code', value: content }\n : { kind: marker === '~~' ? 'del' : 'strong', children: [{ kind: 'text', value: content }] };\n\n return before ? [{ kind: 'text', value: before }, node] : [node];\n }\n }\n\n if (text === value) return null;\n\n return text ? [{ kind: 'text', value: text }] : [];\n}\n\nexport { parseInlines, parseMarkdown, plainText, safeMarkdownUrl };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrMarkdownHighlighter } from './interfaces';\n\n/**\n * The app's syntax highlighter, or `null` for none.\n *\n * Defaults to `null` on purpose: highlighting means a grammar engine, and one of\n * those in the library's dependency tree would be paid for by every consumer who\n * renders a paragraph of text. Provide it with `provideWrMarkdownHighlighter()`.\n */\nexport const WR_MARKDOWN_HIGHLIGHTER = new InjectionToken<WrMarkdownHighlighter | null>('WR_MARKDOWN_HIGHLIGHTER', {\n factory: () => null,\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Injectable, inject, signal } from '@angular/core';\n\nimport type { WrHighlightLine } from './interfaces';\nimport { WR_MARKDOWN_HIGHLIGHTER } from './tokens';\n\n/**\n * How many highlighted code blocks to remember, per language.\n *\n * A requirement of streaming rather than an optimisation: a code block that grows\n * by a token per chunk asks to be highlighted with a DIFFERENT string every time,\n * so an unbounded store would hold every intermediate state of every block for the\n * life of the app — and this service is `providedIn: 'root'`.\n *\n * Comfortably larger than any one document, deliberately. A window too small to\n * hold what is on screen means every pass evicts entries that same pass still\n * needs and asks for them again — a grammar engine running for ever on a page that\n * has stopped changing.\n */\nconst CACHE_LIMIT = 256;\n\n/**\n * How many languages to remember at all.\n *\n * {@link CACHE_LIMIT} bounds the store in the dimension a STREAM controls and\n * left it unbounded in the dimension the DOCUMENT controls: `language` is the\n * first word of the code fence's info string, arbitrary text from an input\n * `<wr-markdown>` treats as untrusted — so a document of ```` ```a1 ```` …\n * ```` ```aN ```` fences created N buckets that only `invalidate()` ever\n * removed. Same `providedIn: 'root'` lifetime as the rest of this store.\n *\n * Comfortably larger than any one document for the same reason `CACHE_LIMIT` is:\n * a window too small to hold what is on screen evicts what the same pass still\n * renders. A document with more than a few dozen distinct languages is exotic.\n *\n * Evicting here cannot re-dirty the effect that requests, which is the loop this\n * class is built around avoiding: that effect depends on `generation`, and\n * nothing on this path writes it.\n *\n * Exported for the spec, not through `public-api.ts` — the number is the whole\n * assertion, and a copy of it in the test would stop tracking this one.\n */\nconst LANGUAGE_LIMIT = 64;\n\n/** One block's answer. `lines` stays `null` until an async highlighter resolves. */\ninterface Entry {\n lines: readonly WrHighlightLine[] | null;\n}\n\n/**\n * Turns fenced code into coloured spans, once per distinct block.\n *\n * **Two rules hold this together, and both were learned by breaking them.**\n *\n * `request` never READS a signal that it writes. An earlier version kept the\n * answers in a signal and rebuilt it on every store, so the component's `effect` —\n * which calls `request` — depended on the signal `request` wrote, and a document\n * with more code blocks than the cache could hold looped for ever: evict,\n * re-request, write, re-dirty. It did not merely spin, it starved the timers that\n * were supposed to fail the test. The plain `Map` is the source of truth now, and a\n * single `revision` counter is the only reactive part; nothing that writes reads it\n * back.\n *\n * And `linesFor` is a pure read, safe to call while Angular renders. Asking a\n * highlighter for a block means writing when the answer lands, and Angular refuses\n * a signal write during rendering (NG0600) — so the component requests from an\n * `effect`, which runs after the render, and the template only reads.\n *\n * Blocks appear as plain text first and gain colour when the answer arrives. For an\n * async highlighter that is right rather than a compromise: a grammar engine loads\n * WASM, and blocking on it would leave the reader with an empty box instead of\n * their code.\n */\n@Injectable({ providedIn: 'root' })\nexport class WrMarkdownHighlight {\n private readonly highlighter = inject(WR_MARKDOWN_HIGHLIGHTER);\n\n /** Language to code to answer. Insertion order is least-recently-rendered first. */\n private readonly cache = new Map<string, Map<string, Entry>>();\n\n /** Bumped whenever an answer lands. Read by the template, never by a writer. */\n private readonly revision = signal(0);\n\n private readonly generationSignal = signal(0);\n\n /**\n * Bumped ONLY by {@link invalidate}. Read it in the effect that requests, so a\n * consumer can force a re-ask.\n *\n * Separate from `revision` on purpose, and the separation is the whole safety\n * argument. An effect that requests and also depends on the signal that storing\n * an answer writes is the shape that looped for ever here once: past the cache\n * limit, requesting stops being idempotent, so each pass writes, re-dirties the\n * effect, evicts and requests again. Nothing inside `request` touches this one.\n */\n readonly generation = this.generationSignal.asReadonly();\n\n /** Spans for one block, or `null` for plain text. Safe to call from a template. */\n linesFor(code: string, language: string | null): readonly WrHighlightLine[] | null {\n if (!language) return null;\n\n // Establishes the dependency, so a late answer re-renders the block waiting.\n this.revision();\n\n const perLanguage = this.cache.get(language);\n const entry = perLanguage?.get(code);\n if (!entry || !perLanguage) return null;\n\n // Touched on read, so eviction drops what nobody is rendering rather than what\n // arrived first. Insertion order had it exactly backwards: mid-stream it\n // discarded the finished block the reader was looking at and kept the\n // half-typed intermediates, and the finished block flashed back to plain text.\n perLanguage.delete(code);\n perLanguage.set(code, entry);\n\n return entry.lines;\n }\n\n /**\n * Forget every answer and ask again on the next render.\n *\n * The cache is keyed on `(language, code)` and nothing else, which is right for\n * the streaming case it exists for and wrong for one real situation: a\n * highlighter that returns per-theme colours serves whichever palette was\n * current when a block was first rendered, for ever. There is no theme\n * dimension to key on — the library cannot know what a highlighter's answer\n * depends on — so the honest fix is to let the consumer say when it changed.\n *\n * A highlighter that returns theme-agnostic colours (CSS `light-dark()`, a\n * custom property) needs none of this.\n *\n * @example\n * ```ts\n * const highlight = inject(WrMarkdownHighlight);\n * effect(() => {\n * theme.current();\n * highlight.invalidate();\n * });\n * ```\n */\n invalidate(): void {\n this.cache.clear();\n this.generationSignal.update(generation => generation + 1);\n this.revision.update(revision => revision + 1);\n }\n\n /**\n * Ask for a block to be highlighted. Idempotent, and safe to call for every\n * block on every change — call it from an `effect`, never from a template.\n */\n request(code: string, language: string | null): void {\n // A bare fence has no grammar to pick, so there is nothing to ask for.\n if (!this.highlighter || !language || !code) return;\n\n const existing = this.cache.get(language);\n // Deleted before it is re-set, because `Map.set` on a key it already holds\n // keeps the ORIGINAL position: a plain `set` would leave the outer map in\n // first-sighting order, and `evictLanguage` would then drop a language still\n // being asked for in favour of one seen earlier and no longer rendered.\n if (existing) this.cache.delete(language);\n const perLanguage = existing ?? new Map<string, Entry>();\n this.cache.set(language, perLanguage);\n this.evictLanguage();\n // Presence IS the record of having asked — a separate `asked` set was a second\n // structure to keep in step with this one, and eviction only pruned one of them.\n if (perLanguage.has(code)) return;\n\n const entry: Entry = { lines: null };\n perLanguage.set(code, entry);\n this.evict(perLanguage);\n\n let result: ReturnType<typeof this.highlighter>;\n try {\n result = this.highlighter(code, language);\n } catch {\n // A highlighter that throws on an unknown grammar costs the reader colour,\n // not their code.\n return;\n }\n\n if (result instanceof Promise) {\n result.then(lines => this.fill(entry, lines)).catch(() => undefined);\n } else {\n this.fill(entry, result);\n }\n }\n\n /**\n * Fill in an answer and let the view know.\n *\n * Writes through the entry OBJECT rather than looking its key up again. The entry\n * may have been evicted while the promise was in flight, in which case this\n * writes to something nothing holds — which is the intended outcome. The version\n * that re-inserted by key put entries back behind eviction's back, and the cache\n * grew without a ceiling for exactly the async highlighter its limit exists for.\n */\n private fill(entry: Entry, lines: readonly WrHighlightLine[] | null): void {\n if (!lines) return;\n\n entry.lines = lines;\n this.revision.update(revision => revision + 1);\n }\n\n /** `Map` iterates in insertion order, and `linesFor` re-inserts on read. */\n private evict(perLanguage: Map<string, Entry>): void {\n while (perLanguage.size > CACHE_LIMIT) {\n const oldest = perLanguage.keys().next();\n if (oldest.done) return;\n perLanguage.delete(oldest.value);\n }\n }\n\n /**\n * The same bound, one dimension out. `request` re-inserts a bucket it already\n * holds, so the outer map iterates least-recently-REQUESTED first — and the\n * component's effect asks for every code block in the document it is showing,\n * so a language that stops being requested is one nothing renders any more.\n *\n * Read is deliberately NOT a touch here, unlike {@link linesFor} for the inner\n * map: with the effect re-asking for every block, request order already tracks\n * what is rendered, and nothing has needed the finer signal.\n */\n private evictLanguage(): void {\n while (this.cache.size > LANGUAGE_LIMIT) {\n const oldest = this.cache.keys().next();\n if (oldest.done) return;\n this.cache.delete(oldest.value);\n }\n }\n}\n\nexport { LANGUAGE_LIMIT };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, DestroyRef, ViewEncapsulation, computed, effect, inject, input, signal } from '@angular/core';\n\nimport { useConfigValue } from 'ngwr/config';\nimport { WrCopyToClipboard } from 'ngwr/directives';\nimport { useI18nText } from 'ngwr/i18n';\n\nimport type {\n WrHighlightLine,\n WrMarkdownBlock,\n WrMarkdownCell,\n WrMarkdownInline,\n WrMarkdownListItem,\n} from './interfaces';\nimport { parseMarkdown } from './parse-markdown';\nimport { WrMarkdownHighlight } from './wr-markdown-highlight';\n\n/** How long the copy button stays in its \"copied\" state. */\nconst COPIED_FEEDBACK_MS = 2000;\n\n/** Code blocks anywhere in the tree — a quote or a list item holds blocks too. */\nfunction collectCode(blocks: readonly WrMarkdownBlock[]): readonly { code: string; language: string | null }[] {\n const found: { code: string; language: string | null }[] = [];\n\n for (const block of blocks) {\n if (block.kind === 'code') found.push({ code: block.code, language: block.language });\n if (block.kind === 'quote') found.push(...collectCode(block.children));\n if (block.kind === 'list') for (const item of block.items) found.push(...collectCode(item.children));\n }\n\n return found;\n}\n\n/**\n * Renders markdown — as DOM, not as HTML.\n *\n * Built for streamed model output, and useful for any markdown an app does not\n * write itself: comments, release notes, a README. `[streaming]` makes a partial\n * document render like a whole one (see {@link parseMarkdown}); without it the\n * component is an ordinary renderer.\n *\n * **Raw HTML in the source is escaped, never rendered.** That is a deliberate\n * limit rather than an unfinished feature: the input is untrusted by\n * construction, `[innerHTML]` is how every comparable renderer takes it, and one\n * `<img onerror>` is the whole cost of being wrong. Nothing here is parsed as\n * HTML at any point — every text node is a text node and every `href` goes\n * through Angular's URL sanitizer on top of this component's own scheme check.\n *\n * @example\n * ```html\n * <wr-markdown [value]=\"answer()\" [streaming]=\"pending()\" copyable />\n * ```\n *\n * @see https://ngwr.dev/reference/components/markdown\n */\n@Component({\n selector: 'wr-markdown',\n templateUrl: './wr-markdown.html',\n imports: [NgTemplateOutlet, WrCopyToClipboard],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-markdown',\n '[class.wr-markdown--streaming]': 'streaming()',\n },\n})\nexport class WrMarkdown {\n private readonly highlight = inject(WrMarkdownHighlight);\n private readonly destroyRef = inject(DestroyRef);\n\n /** The markdown source. */\n readonly value = input<string>('');\n\n /**\n * The source is a prefix of a longer document.\n *\n * Turns on partial-safe parsing — an open fence renders as code, a half-typed\n * `**bold` renders as bold rather than as asterisks — and marks the host with\n * `.wr-markdown--streaming`, which paints a caret after the last block.\n *\n * @default false\n */\n readonly streaming = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a copy button on finished code blocks.\n *\n * Falls back to `markdown.copyable` from `provideWrConfig()`, then `false`.\n * Only CLOSED blocks get one: mid-stream the code is not all there, and a\n * button that copies half a snippet is worse than no button.\n */\n readonly copyable = input<boolean | null, BooleanInput>(null, {\n // `null` survives, because it is what \"the template said nothing\" means to\n // `useConfigValue` — but a bare `copyable` attribute has to reach `true`, and\n // without a transform it arrives as `''` and does not compile under\n // `strictTemplates`. The component's own JSDoc example was the proof.\n transform: value => (value == null ? null : coerceBooleanProperty(value)),\n });\n\n /**\n * Where links open. `_blank` also sets `rel=\"noopener noreferrer\"`, which is\n * not optional — a target without it hands the opener to a page whose URL came\n * from the document being rendered.\n *\n * Falls back to `markdown.linkTarget` from `provideWrConfig()`, then no target.\n */\n readonly linkTarget = input<'_blank' | '_self' | null>(null);\n\n /**\n * Put a slugged `id` on every heading, so the document can be linked into.\n *\n * @default true\n */\n readonly headingIds = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Namespace for the generated heading ids, and for the in-document `#fragment`\n * links that point at them.\n *\n * Defaults to `'user-content-'`, which is what GitHub emits for untrusted\n * markdown, and for the same reason: without a namespace a document that\n * happens to contain `# Search` renders `id=\"search\"` and steals it from the\n * page around it. That is not cosmetic — a `<label for=\"search\">` silently\n * stops labelling its input, and `getElementById` starts answering with a\n * heading. Anchors written INSIDE the document keep working, because a bare\n * `#fragment` href gets the same prefix.\n *\n * Set it to `''` for a document you author yourself and want clean anchors for.\n */\n readonly headingIdPrefix = input<string>('user-content-');\n\n /** Accessible name of the copy button. Falls back to `markdown.copy`, then `'Copy code'`. */\n readonly copyLabel = input<string | null>(null);\n\n /** Announced after a successful copy. Falls back to `markdown.copied`, then `'Copied'`. */\n readonly copiedLabel = input<string | null>(null);\n\n /** Read out for a checked task item. Falls back to `markdown.taskDone`, then `'Done:'`. */\n readonly taskDoneLabel = input<string | null>(null);\n\n /** Read out for an unchecked task item. Falls back to `markdown.taskTodo`, then `'To do:'`. */\n readonly taskTodoLabel = input<string | null>(null);\n\n protected readonly resolvedCopyable = useConfigValue(this.copyable, config => config.markdown?.copyable, false);\n protected readonly resolvedLinkTarget = useConfigValue<'_blank' | '_self' | null>(\n this.linkTarget,\n config => config.markdown?.linkTarget,\n null\n );\n protected readonly resolvedCopyLabel = useI18nText(this.copyLabel, 'markdown.copy', 'Copy code');\n protected readonly resolvedCopiedLabel = useI18nText(this.copiedLabel, 'markdown.copied', 'Copied');\n protected readonly resolvedTaskDoneLabel = useI18nText(this.taskDoneLabel, 'markdown.taskDone', 'Done:');\n protected readonly resolvedTaskTodoLabel = useI18nText(this.taskTodoLabel, 'markdown.taskTodo', 'To do:');\n\n /**\n * The parsed document, re-derived whenever the source changes.\n *\n * The WHOLE buffer, on every chunk — so a streamed answer costs O(n²) over the\n * stream. That is a deliberate trade rather than an oversight: freezing the\n * blocks before the last blank line would halve it, but a blank line is not a\n * safe boundary in markdown (a list continues across one), and a wrong boundary\n * corrupts the document rather than slowing it down. The constant is small —\n * 300 KB of prose parses in ~120 ms — and `@for`'s `track $index` keeps the\n * DOM cost proportional to what actually changed.\n */\n protected readonly blocks = computed(() => parseMarkdown(this.value(), { streaming: this.streaming() }));\n\n /** `rel` is bound, not hard-coded, so a same-tab link does not carry a pointless one. */\n protected readonly linkRel = computed(() => (this.resolvedLinkTarget() === '_blank' ? 'noopener noreferrer' : null));\n\n /**\n * Which code block last got copied, held by IDENTITY.\n *\n * Keyed on the code string, two blocks containing the same snippet both lit up\n * — and a document that shows the same one-liner twice is ordinary. Block nodes\n * are recreated whenever the source changes, so the confirmation also clears\n * itself on the next chunk, which is the right lifetime for it.\n */\n private readonly copiedBlock = signal<WrMarkdownBlock | null>(null);\n\n private copiedTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n // Requested here rather than from the template: asking the highlighter means\n // writing a signal when the answer lands, and Angular refuses a signal write\n // during rendering (NG0600). An effect runs after it.\n effect(() => {\n // `generation` is what makes `WrMarkdownHighlight.invalidate()` reach the\n // blocks already on screen. It is deliberately NOT the signal that storing\n // an answer bumps — depending on that one from here is the loop.\n this.highlight.generation();\n for (const block of this.codeBlocks()) this.highlight.request(block.code, block.language);\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.copiedTimer !== null) clearTimeout(this.copiedTimer);\n });\n }\n\n /**\n * A newline as data rather than as template text.\n *\n * The lines of a highlighted block are separate elements, and what separates\n * them on screen — and in a copy — is a real `\\n` inside the `<pre>`. Angular\n * strips whitespace-only text nodes from templates, so the character cannot be\n * typed there; an interpolation of it survives.\n */\n protected readonly newline = String.fromCharCode(10);\n\n /** Every code block in the document, nested ones included. */\n private readonly codeBlocks = computed(() => collectCode(this.blocks()));\n\n /** Spans for a code block, or `null` to render it as plain text. */\n protected linesOf(code: string, language: string | null): readonly WrHighlightLine[] | null {\n return this.highlight.linesFor(code, language);\n }\n\n protected isCopied(block: WrMarkdownBlock): boolean {\n return this.copiedBlock() === block;\n }\n\n protected onCopied(block: WrMarkdownBlock): void {\n this.copiedBlock.set(block);\n if (this.copiedTimer !== null) clearTimeout(this.copiedTimer);\n this.copiedTimer = setTimeout(() => {\n this.copiedBlock.set(null);\n this.copiedTimer = null;\n }, COPIED_FEEDBACK_MS);\n }\n\n /** A heading's id, namespaced, or `null` when there is nothing to link to. */\n protected idOf(id: string): string | null {\n if (!this.headingIds() || !id) return null;\n\n return `${this.headingIdPrefix()}${id}`;\n }\n\n /**\n * A link's destination, with a bare fragment pointed at the namespaced id.\n *\n * Otherwise prefixing the headings would quietly break every `[see](#section)`\n * the document writes about itself.\n */\n protected hrefOf(href: string): string {\n const prefix = this.headingIdPrefix();\n if (!prefix || !this.headingIds() || !href.startsWith('#') || href.length < 2) return href;\n\n return `#${prefix}${href.slice(1)}`;\n }\n\n /**\n * Casts for the recursive templates, and the reason they exist.\n *\n * Block content nests — a quote holds blocks, a list item holds blocks — so the\n * template recurses through `ngTemplateOutlet` into itself. That is the one\n * recursion shape which adds NO elements to the DOM; a recursive component\n * would put a host element between `<ul>` and its `<li>`, which is invalid\n * markup and breaks the list's accessibility tree. The cost is that\n * `ngTemplateOutlet` context arrives as `any`, and `@switch` cannot narrow\n * `any`. Casting it back at the top of each template restores full\n * `strictTemplates` checking inside the loop, where the work happens.\n */\n protected asBlocks(value: unknown): readonly WrMarkdownBlock[] {\n return value as readonly WrMarkdownBlock[];\n }\n\n protected asInlines(value: unknown): readonly WrMarkdownInline[] {\n return value as readonly WrMarkdownInline[];\n }\n\n protected asItems(value: unknown): readonly WrMarkdownListItem[] {\n return value as readonly WrMarkdownListItem[];\n }\n\n protected asCells(value: unknown): readonly WrMarkdownCell[] {\n return value as readonly WrMarkdownCell[];\n }\n}\n","<!--\n Recursion runs through `ngTemplateOutlet` into these templates rather than\n through a child component, so the rendered DOM is exactly the document — no\n wrapper element between a `<ul>` and its `<li>`. See `asBlocks` for the whole\n reasoning.\n-->\n<ng-template #inlineList let-raw>\n @let nodes = asInlines(raw);\n\n @for (node of nodes; track $index) {\n @switch (node.kind) {\n @case ('text') {\n <!-- Wrapped, and not for tidiness: a bare interpolation on its own line is\n ONE text node that includes the indentation around it, so `a **b** c`\n rendered with a space inside every `<strong>`. Inside an element the\n whitespace becomes separate whitespace-only nodes, which Angular\n removes, and `<ng-container>` itself renders nothing. Prettier\n reformats the bare form back, so this also has to survive `--fix`. -->\n <ng-container>{{ node.value }}</ng-container>\n }\n @case ('code') {\n <!-- `dir=\"ltr\"` because code is not prose: under RTL the browser\n reorders `foo();` to `;foo()`. -->\n <code class=\"wr-markdown__code-inline\" dir=\"ltr\">{{ node.value }}</code>\n }\n @case ('strong') {\n <strong class=\"wr-markdown__strong\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></strong>\n }\n @case ('em') {\n <em class=\"wr-markdown__em\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></em>\n }\n @case ('del') {\n <del class=\"wr-markdown__del\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></del>\n }\n @case ('link') {\n <a\n class=\"wr-markdown__link\"\n [href]=\"hrefOf(node.href)\"\n [attr.title]=\"node.title\"\n [attr.target]=\"resolvedLinkTarget()\"\n [attr.rel]=\"linkRel()\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></a>\n }\n @case ('image') {\n <img\n class=\"wr-markdown__image\"\n [src]=\"node.src\"\n [alt]=\"node.alt\"\n [attr.title]=\"node.title\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n }\n @case ('break') {\n <br />\n }\n }\n }\n</ng-template>\n\n<ng-template #itemList let-raw let-tight=\"tight\">\n @let items = asItems(raw);\n\n @for (item of items; track $index) {\n <li class=\"wr-markdown__item\" [class.wr-markdown__item--task]=\"item.checked !== null\">\n @if (item.checked !== null) {\n <!-- Presentational, with the state as text beside it: a real\n `<input type=\"checkbox\">` here would be an unlabelled form control,\n which is a serious axe violation, and making it operable would\n promise an interaction a renderer cannot honour. -->\n <span class=\"wr-markdown__task\" [class.wr-markdown__task--checked]=\"item.checked\" aria-hidden=\"true\"></span>\n <span class=\"wr-markdown__sr-only\">{{ item.checked ? resolvedTaskDoneLabel() : resolvedTaskTodoLabel() }}</span>\n }\n <ng-container\n [ngTemplateOutlet]=\"blockList\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, tight: tight }\"\n />\n </li>\n }\n</ng-template>\n\n<ng-template #blockList let-raw let-tight=\"tight\">\n @let list = asBlocks(raw);\n\n @for (block of list; track $index) {\n @switch (block.kind) {\n @case ('paragraph') {\n <!-- A tight list drops the `<p>`, which is what CommonMark specifies and\n what keeps a one-line list from being double-spaced. -->\n @if (tight) {\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n } @else {\n <p class=\"wr-markdown__paragraph\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </p>\n }\n }\n @case ('heading') {\n @switch (block.level) {\n @case (1) {\n <h1 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h1>\n }\n @case (2) {\n <h2 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h2>\n }\n @case (3) {\n <h3 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h3>\n }\n @case (4) {\n <h4 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h4>\n }\n @case (5) {\n <h5 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h5>\n }\n @default {\n <h6 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h6>\n }\n }\n }\n @case ('code') {\n @let highlighted = linesOf(block.code, block.language);\n\n <div class=\"wr-markdown__code-block\">\n <pre\n class=\"wr-markdown__pre\"\n dir=\"ltr\"\n tabindex=\"0\"\n ><code class=\"wr-markdown__code\" [attr.data-language]=\"block.language\">@if (highlighted) {@for (row of highlighted; track $index) {<span class=\"wr-markdown__line\">@for (span of row; track $index) {<span\n [style.color]=\"span.color\"\n [style.font-style]=\"span.fontStyle === 'italic' ? 'italic' : null\"\n [style.font-weight]=\"span.fontStyle === 'bold' ? 'bold' : null\"\n [style.text-decoration]=\"span.fontStyle === 'underline' ? 'underline' : null\"\n >{{ span.text }}</span>}</span>@if (!$last) {{{ newline }}}}} @else {{{ block.code }}}</code></pre>\n\n @if (resolvedCopyable() && block.closed) {\n <button\n type=\"button\"\n class=\"wr-markdown__copy\"\n [wrCopyToClipboard]=\"block.code\"\n [attr.aria-label]=\"isCopied(block) ? resolvedCopiedLabel() : resolvedCopyLabel()\"\n (copied)=\"onCopied(block)\"\n >\n <svg\n class=\"wr-markdown__copy-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @if (isCopied(block)) {\n <path d=\"M20 6 9 17l-5-5\" />\n } @else {\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n }\n </svg>\n </button>\n }\n </div>\n }\n @case ('quote') {\n <blockquote class=\"wr-markdown__quote\">\n <ng-container\n [ngTemplateOutlet]=\"blockList\"\n [ngTemplateOutletContext]=\"{ $implicit: block.children, tight: false }\"\n />\n </blockquote>\n }\n @case ('list') {\n @if (block.ordered) {\n <ol\n class=\"wr-markdown__list wr-markdown__list--ordered\"\n [attr.start]=\"block.start === 1 ? null : block.start\"\n >\n <ng-container\n [ngTemplateOutlet]=\"itemList\"\n [ngTemplateOutletContext]=\"{ $implicit: block.items, tight: block.tight }\"\n />\n </ol>\n } @else {\n <ul class=\"wr-markdown__list\">\n <ng-container\n [ngTemplateOutlet]=\"itemList\"\n [ngTemplateOutletContext]=\"{ $implicit: block.items, tight: block.tight }\"\n />\n </ul>\n }\n }\n @case ('table') {\n <!-- Its own scroller: a wide table must not push the page sideways, which\n is also what keeps the RTL layout gate quiet about it. -->\n <div class=\"wr-markdown__table-scroll\" tabindex=\"0\">\n <table class=\"wr-markdown__table\">\n <thead>\n <tr>\n @for (cell of block.head; track column; let column = $index) {\n <th class=\"wr-markdown__th\" scope=\"col\" [style.text-align]=\"block.align[column]\">\n <ng-container\n [ngTemplateOutlet]=\"inlineList\"\n [ngTemplateOutletContext]=\"{ $implicit: cell.inlines }\"\n />\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of block.rows; track $index) {\n <tr>\n @for (cell of asCells(row); track column; let column = $index) {\n <td class=\"wr-markdown__td\" [style.text-align]=\"block.align[column]\">\n <ng-container\n [ngTemplateOutlet]=\"inlineList\"\n [ngTemplateOutletContext]=\"{ $implicit: cell.inlines }\"\n />\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n @case ('rule') {\n <hr class=\"wr-markdown__rule\" />\n }\n }\n }\n</ng-template>\n\n<ng-container [ngTemplateOutlet]=\"blockList\" [ngTemplateOutletContext]=\"{ $implicit: blocks(), tight: false }\" />\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport type { WrMarkdownHighlighter } from './interfaces';\nimport { WR_MARKDOWN_HIGHLIGHTER } from './tokens';\n\n/**\n * Give every `<wr-markdown>` in the app a syntax highlighter.\n *\n * The highlighter returns coloured SPANS, not HTML — see\n * {@link WrMarkdownHighlighter} for why that signature is the one worth having.\n * It may be async, and it may return `null` for languages it does not know; both\n * render the block as plain text, which is also what server-side rendering\n * produces, since a highlighter that resolves after prerender has already\n * finished cannot contribute to the HTML.\n *\n * Pass `{ useFactory }` when the adapter needs to inject something. A highlighter\n * is itself a function, so the factory cannot be detected by shape — hence the\n * wrapper object rather than an overload that would guess.\n *\n * @example\n * ```ts\n * bootstrapApplication(App, {\n * providers: [\n * provideWrMarkdownHighlighter(shikiSpans),\n *\n * // Or, when the adapter has dependencies of its own:\n * provideWrMarkdownHighlighter({\n * useFactory: () => {\n * const isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n * return (code, language) => (isBrowser ? shikiSpans(code, language) : null);\n * },\n * }),\n * ],\n * });\n * ```\n */\nexport function provideWrMarkdownHighlighter(\n highlighter: WrMarkdownHighlighter | { readonly useFactory: () => WrMarkdownHighlighter }\n): EnvironmentProviders {\n if (typeof highlighter === 'function') {\n return makeEnvironmentProviders([{ provide: WR_MARKDOWN_HIGHLIGHTER, useValue: highlighter }]);\n }\n\n return makeEnvironmentProviders([{ provide: WR_MARKDOWN_HIGHLIGHTER, useFactory: highlighter.useFactory }]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;AAKG;AAWH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDG;AACH,SAAS,aAAa,CAAC,MAAc,EAAE,UAAkC,EAAE,EAAA;AACzE,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,EAAE;IAEtB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;AAClD,IAAA,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;AAEjE,IAAA,OAAO,GAAG,CAAC,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM;AAC5D;AAEA;;;;;;;;AAQG;AACH,MAAM,SAAS,GAAG,EAAE;AAEpB;;;;;;;;;;AAUG;AACH,MAAM,iBAAiB,GAAG,GAAG;AA2C7B,SAAS,UAAU,CAAC,SAAkB,EAAA;IACpC,OAAO;QACL,SAAS;QACT,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,QAAQ,EAAE,IAAI,GAAG,EAAE;AACnB,QAAA,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE;AAC7C,QAAA,MAAM,EAAE,KAAK;KACd;AACH;AAEA,MAAM,QAAQ,GAAG,mCAAmC;AACpD;AACA;AACA,MAAM,UAAU,GAAG,qDAAqD;AACxE,MAAM,OAAO,GAAG,8DAA8D;AAC9E,MAAM,QAAQ,GAAG,qBAAqB;AACtC,MAAM,OAAO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,QAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAOlC,UAAU,EAAA,UAAA,EAAA,CAAA;kBAVtB,SAAS;+BACE,aAAa,EAAA,OAAA,EAEd,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,EAAA,aAAA,EAC/B,iBAAiB,CAAC,IAAI,EAAA,IAAA,EAC/B;AACJ,wBAAA,KAAK,EAAE,aAAa;AACpB,wBAAA,gCAAgC,EAAE,aAAa;AAChD,qBAAA,EAAA,QAAA,EAAA,k4UAAA,EAAA;;;AEvEH;;;;;AAKG;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACG,SAAU,4BAA4B,CAC1C,WAAyF,EAAA;AAEzF,IAAA,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;AACrC,QAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;IAChG;AAEA,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC;AAC7G;;ACnDA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-markdown.mjs","sources":["../../../projects/lib/markdown/parse-markdown.ts","../../../projects/lib/markdown/tokens.ts","../../../projects/lib/markdown/wr-markdown-highlight.ts","../../../projects/lib/markdown/wr-markdown.ts","../../../projects/lib/markdown/wr-markdown.html","../../../projects/lib/markdown/provide-wr-markdown.ts","../../../projects/lib/markdown/ngwr-markdown.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type {\n WrMarkdownAlign,\n WrMarkdownBlock,\n WrMarkdownCell,\n WrMarkdownInline,\n WrMarkdownListItem,\n WrMarkdownParseOptions,\n} from './interfaces';\n\n/**\n * Markdown to a node tree. No HTML anywhere in the pipeline.\n *\n * **Why a parser in a component library that has one runtime dependency.** The\n * alternative was `marked` or `markdown-it`, and both produce an HTML string —\n * which then has to reach the DOM through `[innerHTML]`, which means Angular's\n * sanitizer on the hot path of the one component whose input is untrusted by\n * definition, and `bypassSecurityTrustHtml` the moment syntax highlighting is\n * wanted. A node tree renders through ordinary Angular bindings instead: every\n * text node is a text node, every `href` goes through `SecurityContext.URL`, and\n * nothing is ever parsed as HTML. That is worth a parser.\n *\n * The second reason is streaming, which no general-purpose parser is built for.\n * See {@link WrMarkdownParseOptions.streaming}: an open fence has to render as a\n * code block, and a half-typed `**` must not flash on screen as literal\n * asterisks.\n *\n * **The subset, stated rather than discovered.** ATX headings, paragraphs,\n * fenced code, blockquotes, bullet / ordered / task lists (nested), GFM tables,\n * thematic breaks; inline code, strong, emphasis, strikethrough, links, images,\n * autolinks (bracketed and bare), hard breaks, backslash escapes.\n *\n * Deliberately absent, each for a reason:\n *\n * - **Raw HTML is escaped, never rendered.** A markdown renderer whose input is\n * model output or user comments cannot pass `<img onerror>` through and call\n * it a feature. `<div>` in equals `<div>` on screen, as text.\n * - **Indented (four-space) code blocks.** In a document that also has nested\n * lists, indentation is structural, and the ambiguity resolves against the\n * author roughly every time: a wrapped list continuation becomes a code block.\n * Fences are unambiguous, and fences are what generators emit.\n * - **Setext headings** (`===` / `---` under a line). `---` is a thematic break\n * here, always. The dual meaning is a well-known trap and the underline form\n * is essentially unused in generated markdown.\n * - **Reference links, footnotes, definition lists.** They need a second pass\n * over a document that, mid-stream, is not all there yet.\n *\n * Two known deviations, kept rather than fixed, because the cure looked worse than\n * the disease:\n *\n * - **A blank line inside a NESTED list marks the outer list loose too**, so\n * `- a` / ` - b` / blank / ` - c` / `- d` double-spaces the outer items.\n * CommonMark scopes looseness per list; telling the two apart needs to know\n * which level a blank line belongs to, and the indentation alone does not say —\n * content at the item's own indent can belong either to the item or to a\n * sublist's sibling. The visible cost is spacing.\n * - **An unmatched `[` is not linear.** The scan is bounded per opener\n * ({@link MAX_LABEL_LENGTH}) and short-circuits once the source is known to hold\n * no `]` at all, which took `'['.repeat(100000)` from 8s to 0.2s — but a\n * document that is mostly open brackets with a `]` somewhere still pays per\n * opener. Real prose does not have that shape.\n *\n * @param source markdown text\n * @returns block nodes, ready to render\n */\nfunction parseMarkdown(source: string, options: WrMarkdownParseOptions = {}): readonly WrMarkdownBlock[] {\n if (!source) return [];\n\n const ctx = newContext(options.streaming ?? false);\n const blocks = parseBlocks(normalize(source).split('\\n'), 0, ctx);\n\n return ctx.streaming ? applyStreamingTail(blocks) : blocks;\n}\n\n/**\n * How deep a quote / list nest may go before the parser stops recursing.\n *\n * Not a taste limit: each level is a recursive call over its own slice of the\n * lines, so a pathological input (`> > > > …` a thousand deep, which is four\n * kilobytes of text) is a stack overflow inside a change-detection pass. Past\n * the cap the content renders as paragraphs — visible, harmless, and nothing a\n * real document reaches.\n */\nconst MAX_DEPTH = 12;\n\n/**\n * How many columns of a table are rendered.\n *\n * The same class of protection as {@link MAX_DEPTH}, for the same reason, and it\n * was measured rather than guessed: every row is padded to the header's width, so\n * cells scale as columns × rows while the input scales as columns + rows. A 38 KB\n * document — a 10,001-pipe header and 2,000 short rows, which is what a truncated\n * table from a model looks like — produced **20 million cells** in 4.5 seconds,\n * inside a `computed` that re-runs on every streamed chunk. No real table is wider\n * than this; a wider one renders its first 128 columns.\n */\nconst MAX_TABLE_COLUMNS = 128;\n\n/**\n * Threaded down the whole parse rather than applied afterwards.\n *\n * Streaming changes what an UNMATCHED marker means, and only the parser knows it\n * found one. A post-pass over the tree cannot tell `**bold**` from `**bold` —\n * both end up as text and marker characters — so the decision has to be made\n * where the closer was looked for and not found.\n */\ninterface ParseContext {\n readonly streaming: boolean;\n /**\n * Heading slugs already handed out, so a document with two `## Fixes` produces\n * two DIFFERENT ids. Duplicate ids are invalid, and `#fixes` would resolve to\n * whichever came first.\n */\n readonly slugs: Map<string, number>;\n /**\n * Per marker character, the earliest index from which a closer search has\n * already come up empty.\n *\n * This is what keeps the inline scanner linear. The closer search is monotone —\n * if no valid closer exists after index `i`, none exists after any index past\n * `i` either, since that window is a subset — so one failure answers every\n * later opener of the same character. Without it, `'*a '.repeat(34000)` is 10.8\n * SECONDS inside a `computed`, on the main thread.\n *\n * Scoped to ONE scan, not to the document: `inlines()` replaces this and\n * {@link ParseContext.noBracket} on entry, because the numbers index into the\n * string that call is walking and mean nothing in any other.\n */\n readonly noCloser: Map<string, number>;\n /** Same idea for `]`: the index from which the source contains none at all. */\n readonly noBracket: { from: number };\n /**\n * True while parsing a link's label. CommonMark forbids links inside links, and\n * a tree built with DOM APIs happily nests the `<a>` an HTML parser would have\n * rejected — which is invalid markup and an axe `nested-interactive` violation.\n */\n readonly inLink: boolean;\n}\n\nfunction newContext(streaming: boolean): ParseContext {\n return {\n streaming,\n slugs: new Map(),\n noCloser: new Map(),\n noBracket: { from: Number.POSITIVE_INFINITY },\n inLink: false,\n };\n}\n\nconst FENCE_RE = /^( {0,3})(`{3,}|~{3,})[ \\t]*(.*)$/;\n// The closing `#` run must be PRECEDED by whitespace, or `# C#` loses its sharp\n// and `#######` (seven, not a heading in any dialect) matches as an empty h6.\nconst HEADING_RE = /^ {0,3}(#{1,6})(?:[ \\t]+(.*?))?(?:[ \\t]+#+)?[ \\t]*$/;\nconst RULE_RE = /^ {0,3}(?:(?:\\*[ \\t]*){3,}|(?:-[ \\t]*){3,}|(?:_[ \\t]*){3,})$/;\nconst QUOTE_RE = /^ {0,3}>[ \\t]?(.*)$/;\nconst LIST_RE = /^( *)([-*+]|\\d{1,9}[.)])(?:([ \\t]+)(.*)|[ \\t]*)$/;\nconst TASK_RE = /^\\[([ xX])\\](?:[ \\t]+(.*)|[ \\t]*)$/;\nconst TABLE_DELIM_RE = /^ {0,3}\\|?[ \\t]*:?-+:?[ \\t]*(?:\\|[ \\t]*:?-+:?[ \\t]*)*\\|?[ \\t]*$/;\n\n/**\n * `\\r\\n` and lone `\\r` out; tabs in the INDENT to four spaces, so indent maths is\n * in one unit.\n *\n * The whole leading whitespace run, not just a line-initial tab: `' \\t- b'` is\n * two spaces and a tab, and `parseList` measures indentation in characters, so a\n * tab counted as one column made mixed indentation parse as literal text.\n */\nfunction normalize(source: string): string {\n return source.replace(/\\r\\n?/g, '\\n').replace(/^[ \\t]+/gm, indent => indent.replace(/\\t/g, ' '));\n}\n\n/** Does this line begin a block that interrupts a paragraph or a list item? */\nfunction startsBlock(line: string): boolean {\n return (\n FENCE_RE.test(line) || HEADING_RE.test(line) || RULE_RE.test(line) || QUOTE_RE.test(line) || LIST_RE.test(line)\n );\n}\n\n/**\n * Does this line end the paragraph it follows?\n *\n * Every block start does, except the two lists CommonMark says cannot interrupt\n * one: an ordered item whose number is not 1, and an item with no content. The\n * first rule exists for a single shape, and it is a shape prose actually has —\n * \"The year was\" / \"1986. It was a good year.\" must not become a list numbered\n * from 1986.\n */\nfunction interruptsParagraph(line: string): boolean {\n const list = matchListStart(line);\n if (list && !RULE_RE.test(line)) {\n return list.content.trim() !== '' && (!list.ordered || list.number === 1);\n }\n\n return startsBlock(line);\n}\n\ninterface ListStart {\n readonly indent: number;\n readonly ordered: boolean;\n readonly number: number;\n readonly content: string;\n /** Column the item's own content starts at — the dedent for everything inside it. */\n readonly contentIndent: number;\n}\n\nfunction matchListStart(line: string): ListStart | null {\n const match = LIST_RE.exec(line);\n if (!match) return null;\n\n const [, indent, marker, spaces, content] = match;\n const ordered = !/^[-*+]$/.test(marker);\n\n return {\n indent: indent.length,\n ordered,\n number: ordered ? Number.parseInt(marker, 10) : 1,\n content: content ?? '',\n // An empty item (`-` alone) has no run of spaces to measure, so assume one.\n contentIndent: indent.length + marker.length + (spaces?.length ?? 1),\n };\n}\n\nfunction parseBlocks(lines: readonly string[], depth: number, ctx: ParseContext): readonly WrMarkdownBlock[] {\n if (depth >= MAX_DEPTH) {\n const text = lines.join('\\n').trim();\n return text ? [{ kind: 'paragraph', inlines: inlines(text, 0, ctx) }] : [];\n }\n\n const out: WrMarkdownBlock[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (!line.trim()) {\n i++;\n continue;\n }\n\n const fence = FENCE_RE.exec(line);\n if (fence) {\n const [, indent, marker, info] = fence;\n const body: string[] = [];\n const closer = new RegExp(`^ {0,3}\\\\${marker[0]}{${marker.length},}[ \\\\t]*$`);\n let closed = false;\n i++;\n\n while (i < lines.length) {\n if (closer.test(lines[i])) {\n closed = true;\n i++;\n break;\n }\n // The opening fence's own indentation is not part of the code.\n body.push(stripIndent(lines[i], indent.length));\n i++;\n }\n\n out.push({\n kind: 'code',\n language: info.trim().split(/\\s+/)[0].toLowerCase() || null,\n code: body.join('\\n'),\n closed,\n });\n continue;\n }\n\n const heading = HEADING_RE.exec(line);\n if (heading) {\n const text = (heading[2] ?? '').trim();\n const content = inlines(text, 0, ctx);\n out.push({\n kind: 'heading',\n level: heading[1].length as 1 | 2 | 3 | 4 | 5 | 6,\n inlines: content,\n // Slugged from the rendered TEXT, not from the markdown: `## See [docs](url)`\n // was producing `see-docshttpsxdeva`, an anchor nobody can link to.\n id: uniqueSlug(plainText(content), ctx),\n });\n i++;\n continue;\n }\n\n if (RULE_RE.test(line)) {\n out.push({ kind: 'rule' });\n i++;\n continue;\n }\n\n if (QUOTE_RE.test(line)) {\n const body: string[] = [];\n while (i < lines.length) {\n const quoted = QUOTE_RE.exec(lines[i]);\n if (quoted) {\n body.push(quoted[1]);\n i++;\n continue;\n }\n // Lazy continuation: an unmarked, non-blank line still belongs to the\n // quote unless it starts a block of its own.\n if (!lines[i].trim() || startsBlock(lines[i])) break;\n body.push(lines[i].trimStart());\n i++;\n }\n out.push({ kind: 'quote', children: parseBlocks(body, depth + 1, ctx) });\n continue;\n }\n\n if (matchListStart(line)) {\n const [list, next] = parseList(lines, i, depth, ctx);\n out.push(list);\n i = next;\n continue;\n }\n\n if (isTableStart(lines, i)) {\n const [table, next] = parseTable(lines, i, ctx);\n out.push(table);\n i = next;\n continue;\n }\n\n const paragraph: string[] = [line];\n i++;\n while (i < lines.length && lines[i].trim() && !interruptsParagraph(lines[i])) {\n // A delimiter row two lines in turns the paragraph into a table header.\n if (isTableStart(lines, i)) break;\n paragraph.push(lines[i]);\n i++;\n }\n out.push({ kind: 'paragraph', inlines: inlines(paragraph.join('\\n').trim(), 0, ctx) });\n }\n\n return out;\n}\n\n/**\n * A table header, or a sentence that happens to contain a pipe.\n *\n * GFM's own rule, and the one this used to be missing: \"the header row must match\n * the delimiter row in the number of cells. If not, a table will not be\n * recognized.\" Without the count check, `Use the | character` followed by `---`\n * became a two-column table with an empty body — swallowing both the sentence and\n * the thematic break, and contradicting this file's own decision that `---` is\n * always a rule.\n */\nfunction isTableStart(lines: readonly string[], at: number): boolean {\n const header = lines[at];\n const delimiter = lines[at + 1];\n\n if (!header?.includes('|') || delimiter === undefined || !TABLE_DELIM_RE.test(delimiter)) return false;\n\n return splitRow(header).length === splitRow(delimiter).length;\n}\n\n/** Remove up to `width` leading spaces — never more, so relative indent survives. */\nfunction stripIndent(line: string, width: number): string {\n let cut = 0;\n while (cut < width && line[cut] === ' ') cut++;\n return line.slice(cut);\n}\n\nfunction parseList(\n lines: readonly string[],\n from: number,\n depth: number,\n ctx: ParseContext\n): [WrMarkdownBlock, number] {\n const first = matchListStart(lines[from])!;\n const items: WrMarkdownListItem[] = [];\n let loose = false;\n let i = from;\n\n while (i < lines.length) {\n // A thematic break wins over a list item, which is CommonMark's rule and not\n // a nicety: `* * *` matches the bullet pattern, so without this `* a`,\n // `* * *`, `* b` is one list with a phantom nesting level where the divider\n // was, and the `<hr>` is gone.\n if (RULE_RE.test(lines[i])) break;\n\n const start = matchListStart(lines[i]);\n // A different marker family starts a NEW list rather than continuing this\n // one — `- a` then `1. b` is two lists, and rendering it as one silently\n // renumbers the author's content.\n if (start?.ordered !== first.ordered || start.indent > first.indent + 3) break;\n\n const body: string[] = [start.content];\n let blanks = 0;\n i++;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (!line.trim()) {\n blanks++;\n i++;\n continue;\n }\n\n const indent = line.length - line.trimStart().length;\n if (indent >= start.contentIndent) {\n // A blank line followed by more of the same item makes the list loose,\n // which is what decides whether items get `<p>` wrappers.\n if (blanks > 0) {\n body.push(...Array<string>(blanks).fill(''));\n loose = true;\n blanks = 0;\n }\n body.push(stripIndent(line, start.contentIndent));\n i++;\n continue;\n }\n\n // Out-dented: a sibling item, another block, or lazy continuation of this\n // item's paragraph. After a blank line only a sibling can follow.\n if (blanks > 0 || matchListStart(line) || startsBlock(line)) break;\n body.push(line.trimStart());\n i++;\n }\n\n const nextIsSibling = i < lines.length && matchListStart(lines[i]) !== null;\n if (blanks > 0 && nextIsSibling) loose = true;\n\n items.push(makeItem(body, depth, ctx));\n\n if (blanks > 0 && !nextIsSibling) break;\n }\n\n return [{ kind: 'list', ordered: first.ordered, start: first.number, tight: !loose, items }, i];\n}\n\nfunction makeItem(body: readonly string[], depth: number, ctx: ParseContext): WrMarkdownListItem {\n const task = TASK_RE.exec(body[0] ?? '');\n const lines = task ? [task[2] ?? '', ...body.slice(1)] : body;\n\n return {\n children: parseBlocks(lines, depth + 1, ctx),\n checked: task ? task[1].toLowerCase() === 'x' : null,\n };\n}\n\nfunction parseTable(lines: readonly string[], from: number, ctx: ParseContext): [WrMarkdownBlock, number] {\n const head = splitRow(lines[from]).slice(0, MAX_TABLE_COLUMNS);\n const align = splitRow(lines[from + 1]).map((spec): WrMarkdownAlign => {\n const left = spec.startsWith(':');\n const right = spec.endsWith(':');\n if (left && right) return 'center';\n if (right) return 'end';\n if (left) return 'start';\n return null;\n });\n\n const rows: WrMarkdownCell[][] = [];\n let i = from + 2;\n\n while (i < lines.length) {\n const line = lines[i];\n // GFM ends a table at a blank line, a line that starts another block, or\n // anything without a cell divider.\n if (!line.trim() || !line.includes('|') || startsBlock(line)) break;\n rows.push(normalizeCells(splitRow(line), head.length, ctx));\n i++;\n }\n\n return [\n {\n kind: 'table',\n head: head.map(cell => ({ inlines: inlines(cell, 0, ctx) })),\n rows,\n align: normalizeAlign(align, head.length),\n },\n i,\n ];\n}\n\n/** Split on unescaped pipes, dropping the optional leading and trailing one. */\nfunction splitRow(line: string): string[] {\n const cells: string[] = [];\n let current = '';\n\n for (let i = 0; i < line.length; i++) {\n if (line[i] === '\\\\' && line[i + 1] === '|') {\n current += '|';\n i++;\n continue;\n }\n if (line[i] === '|') {\n cells.push(current);\n current = '';\n continue;\n }\n current += line[i];\n }\n cells.push(current);\n\n if (cells.length > 1 && !cells[0].trim()) cells.shift();\n if (cells.length > 1 && !cells[cells.length - 1].trim()) cells.pop();\n\n return cells.map(cell => cell.trim());\n}\n\n/** A row shorter than the header gets empty cells; a longer one is truncated. */\nfunction normalizeCells(cells: readonly string[], width: number, ctx: ParseContext): WrMarkdownCell[] {\n return Array.from({ length: width }, (_, index) => ({ inlines: inlines(cells[index] ?? '', 0, ctx) }));\n}\n\nfunction normalizeAlign(align: readonly WrMarkdownAlign[], width: number): WrMarkdownAlign[] {\n return Array.from({ length: width }, (_, index) => align[index] ?? null);\n}\n\n/**\n * GitHub-compatible heading slug: lowercase, punctuation dropped, spaces to dashes.\n *\n * `_` and `-` are KEPT, which is what GitHub does — stripping the underscore broke\n * every published `#snake_case` anchor.\n */\nfunction slug(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}\\s_-]/gu, '')\n .trim()\n .replace(/\\s+/g, '-');\n}\n\n/**\n * The slug, with a counter when the document repeats a title.\n *\n * Two `## Fixes` in one changelog produced two `id=\"fixes\"`, which is invalid and\n * makes `#fixes` resolve to whichever came first. GitHub appends `-1`, `-2`; so\n * does this. An empty slug (a heading of pure emoji, or no text at all) stays\n * empty and the renderer binds no `id`.\n */\nfunction uniqueSlug(text: string, ctx: ParseContext): string {\n const base = slug(text);\n if (!base) return '';\n\n const used = ctx.slugs.get(base) ?? 0;\n ctx.slugs.set(base, used + 1);\n\n return used === 0 ? base : `${base}-${used}`;\n}\n\n// ---------------------------------------------------------------------------\n// Inline\n// ---------------------------------------------------------------------------\n\n// Every ASCII punctuation character, which is what CommonMark allows. The\n// hand-written subset left `\\$`, `\\&`, `\\%` and eight others rendering with their\n// backslash — and `\\$` is what generators emit to keep a dollar out of math mode.\nconst ESCAPABLE = /[!-/:-@[-`{-~]/;\nconst SCHEME_RE = /^([a-z][a-z0-9+.-]*):/i;\nconst ALLOWED_SCHEMES = new Set(['http', 'https', 'mailto', 'tel', 'ftp']);\nconst DATA_IMAGE_RE = /^data:image\\/(?:png|jpe?g|gif|webp|avif);base64,[a-z0-9+/=]+$/i;\n// `[^<>\\s]` and not `[^>\\s]`: CommonMark defines autolink content as\n// `[^<>\\x00-\\x20]*`, so `<` ends it by spec — and admitting it is what made this\n// quadratic. On `<http://a<http://a<…` the scheme matches, the class swallows the\n// rest of the document looking for `>`, then backtracks a character at a time, once\n// per `<`. 160 KB took 1.7 s. `ANGLE_DEST_RE` and `EMAIL_AUTOLINK_RE` beside it\n// already exclude `<`; this one was the outlier. The only input that now parses\n// differently is `<http://a<b>`, which no other parser reads as a link either.\nconst AUTOLINK_RE = /^<((?:https?|mailto|tel):[^<>\\s]+)>/i;\n/** `<destination>` — markdown's way of putting a space in a URL. */\nconst ANGLE_DEST_RE = /^<([^<>]*)>(?:\\s+[\"'(](.*)[\"')])?$/;\n/** CommonMark's own cap on a link label, which is also what bounds the scan. */\nconst MAX_LABEL_LENGTH = 999;\n/**\n * How deep parentheses may nest inside `[a](…)` before the destination is refused\n * outright — counted from the `(` that opens it, so 31 nested pairs inside.\n *\n * This is a bound on WORK, not on taste, and it is the only thing standing\n * between a paragraph and a frozen tab. The destination scan walks forward for a\n * balancing `)`, and an unclosed destination sends it to the end of the line; one\n * `[a](x` costs nothing, but `'[a](x'.repeat(16384)` — 80 KB on a single line —\n * makes every one of the 16384 openers walk the whole remainder, which measured\n * 936 ms at 80 KB and 3.9 s at 160 KB, synchronously inside a `computed` during\n * change detection. A `~4x` cost per doubling of the input: quadratic, on a\n * component whose documented input is a comment or a model's output.\n *\n * The cap fixes it because a scan can only keep going by NOT finding its closer,\n * and every later `[…](` it walks past contributes an unmatched `(` of its own —\n * so after 32 of them the scan stops, no opener's walk can cover more than the\n * next 32 openers, and the total is linear in the document. (A `)` that would\n * bring the count back down is the closer, and ends the scan anyway.) The number\n * is cmark's: `manual_scan_link_url` refuses at the same depth, for the same\n * reason.\n *\n * What it costs: a destination with 32 or more nested `(` is no longer a link and\n * renders as text. No URL looks like that — the deep end of the real world is a\n * Wikipedia `..._(disambiguation)`, which is one pair.\n */\nconst MAX_DESTINATION_NESTING = 32;\nconst BARE_URL_RE = /^https?:\\/\\/[^\\s<>[\\]()]*(?:\\([^\\s<>()]*\\)[^\\s<>[\\]()]*)*/i;\nconst EMAIL_AUTOLINK_RE = /^<([^\\s@<>]+@[^\\s@<>.]+\\.[^\\s@<>]+)>/;\n\n/**\n * A URL safe to put in `href` / `src`, or `null` to render the link as plain text.\n *\n * Two layers, and both are wanted. Angular sanitizes `[href]` bindings itself,\n * but its answer to a hostile URL is the string `unsafe:javascript:…` in a live\n * anchor — a link that looks real, is announced as a link, and does nothing.\n * Refusing it here means the label renders as text instead, which is honest.\n *\n * Whitespace and control characters are stripped before the scheme is read,\n * because `java\\nscript:` and `java script:` are the same URL to a browser and\n * different strings to a naive check.\n */\nfunction safeMarkdownUrl(raw: string, kind: 'link' | 'image'): string | null {\n const url = raw.trim();\n // Whitespace and control characters only: a hyphen has no business being\n // stripped out of a host name. Written as escapes rather than literal bytes —\n // a raw NUL inside a regex literal makes the file binary to every text tool.\n // Stripping control characters is the entire point here: a browser ignores them\n // before resolving the scheme, so a check that reads the raw string sees a\n // relative path and waves `java\\u0000script:` straight through.\n // eslint-disable-next-line no-control-regex\n const bare = url.replace(/[\\s\\u0000-\\u001f\\u007f]/g, '');\n const scheme = SCHEME_RE.exec(bare);\n\n // No scheme at all: relative path, `#anchor`, `//host` — nothing executable.\n if (!scheme) return url;\n\n const name = scheme[1].toLowerCase();\n\n // `data:` is an image-only allowance, and only for raster types: an SVG can\n // carry script, and `data:text/html` is a same-origin document.\n if (name === 'data') return kind === 'image' && DATA_IMAGE_RE.test(bare) ? bare : null;\n\n return ALLOWED_SCHEMES.has(name) ? url : null;\n}\n\n/** Inline markdown to nodes. */\nfunction parseInlines(source: string, options: WrMarkdownParseOptions = {}): readonly WrMarkdownInline[] {\n return inlines(source, 0, newContext(options.streaming ?? false));\n}\n\nfunction inlines(source: string, depth: number, outer: ParseContext): readonly WrMarkdownInline[] {\n if (depth >= MAX_DEPTH) return source ? [{ kind: 'text', value: source }] : [];\n\n // The two failure memos hold INDEXES into `source`, so they are only ever true\n // of the one string this call is scanning — and the context they live on spans\n // the whole document. Shared, an index recorded in one paragraph is compared\n // against a position in the next, and refuses emphasis and links that are\n // perfectly well formed; `matchEmphasis` recursing on a slice (below) does the\n // same thing INSIDE a single paragraph, so restoring on return would not be\n // enough either. A memo per scan is the only keying that means anything, and it\n // costs nothing: the linearity argument in {@link ParseContext.noCloser} is a\n // statement about one string in the first place.\n const ctx: ParseContext = { ...outer, noCloser: new Map(), noBracket: { from: Number.POSITIVE_INFINITY } };\n\n const out: WrMarkdownInline[] = [];\n let text = '';\n let i = 0;\n\n const flush = (): void => {\n if (text) {\n out.push({ kind: 'text', value: text });\n text = '';\n }\n };\n\n while (i < source.length) {\n const char = source[i];\n\n if (char === '\\\\') {\n // A backslash before a newline is a hard break; before punctuation, an escape.\n if (source[i + 1] === '\\n') {\n flush();\n out.push({ kind: 'break' });\n i += 2;\n continue;\n }\n if (i + 1 < source.length && ESCAPABLE.test(source[i + 1])) {\n text += source[i + 1];\n i += 2;\n continue;\n }\n }\n\n if (char === '\\n') {\n // Two trailing spaces are markdown's hard break, and the question is asked\n // of the SOURCE rather than of `text` — twice now, this one line has been\n // where paragraph parsing went quadratic.\n //\n // `/[ ]{2,}$/.test(text)` was the first version: no start anchor, so it\n // retries from every position of the accumulated paragraph. A CPU profile\n // of a 161 KB document put 3306 ms of 3378 ms of total self-time in it.\n // `text.endsWith(' ')` replaced it and is quadratic for a different\n // reason: `text` is built by `+=`, so it is a rope, and every read of its\n // tail flattens the whole thing — 160,000 short lines cost 1980 ms of\n // copying against 7 ms for the same loop without the test. Ordinary prose\n // reaches that shape; nothing has to be malformed.\n //\n // Reading `source` instead answers the same question in constant time, and\n // it IS the same question: while `text` is non-empty its last character is\n // always `source[i - 1]` (every branch that appends appends exactly the\n // character it consumed), and when it is empty the preceding characters\n // belong to a construct that just closed — none of which can end in a\n // space, since a closing fence, `)`, `>` or emphasis marker is never one.\n const hard = source[i - 1] === ' ' && source[i - 2] === ' ';\n if (hard) {\n text = text.replace(/[ ]+$/, '');\n flush();\n out.push({ kind: 'break' });\n } else {\n // A soft break is whitespace; CSS collapses it like any other.\n text += '\\n';\n }\n i++;\n continue;\n }\n\n if (char === '`') {\n const run = /^`+/.exec(source.slice(i))![0];\n const close = findCodeClose(source, i + run.length, run);\n if (close !== -1) {\n flush();\n out.push({ kind: 'code', value: codeSpanValue(source.slice(i + run.length, close)) });\n i = close + run.length;\n continue;\n }\n }\n\n if (char === '<') {\n const auto = AUTOLINK_RE.exec(source.slice(i));\n if (auto) {\n // `ctx.inLink`: CommonMark forbids a link inside a link, and nothing else\n // stops it here — a tree built with DOM APIs nests the `<a>` an HTML\n // parser would have thrown away, which is invalid markup and an axe\n // `nested-interactive` violation at serious level.\n const href = ctx.inLink ? null : safeMarkdownUrl(auto[1], 'link');\n flush();\n out.push(\n href\n ? { kind: 'link', href, title: null, children: [{ kind: 'text', value: auto[1] }] }\n : { kind: 'text', value: auto[1] }\n );\n i += auto[0].length;\n continue;\n }\n const email = EMAIL_AUTOLINK_RE.exec(source.slice(i));\n if (email) {\n // Through `safeMarkdownUrl` like every other href: built by hand, this was\n // the one destination that skipped the control-character strip, which the\n // component's own JSDoc promises for all of them.\n const href = ctx.inLink ? null : safeMarkdownUrl(`mailto:${email[1]}`, 'link');\n flush();\n out.push(\n href\n ? { kind: 'link', href, title: null, children: [{ kind: 'text', value: email[1] }] }\n : { kind: 'text', value: email[1] }\n );\n i += email[0].length;\n continue;\n }\n }\n\n if (char === '!' && source[i + 1] === '[') {\n const link = matchLink(source, i + 1, ctx);\n if (link) {\n const src = safeMarkdownUrl(link.href, 'image');\n const alt = plainText(inlines(link.label, depth + 1, { ...ctx, inLink: true }));\n flush();\n // A refused source leaves the alt text, which is the information the\n // author actually wrote.\n out.push(src ? { kind: 'image', src, alt, title: link.title } : { kind: 'text', value: alt });\n i = link.end;\n continue;\n }\n }\n\n if (char === '[') {\n const link = matchLink(source, i, ctx);\n if (link) {\n const href = ctx.inLink ? null : safeMarkdownUrl(link.href, 'link');\n // The label is parsed with links SUPPRESSED, so an inner one renders as\n // its own text — CommonMark's answer to `[a [b](c)](d)`.\n const children = inlines(link.label, depth + 1, { ...ctx, inLink: true });\n flush();\n if (href) out.push({ kind: 'link', href, title: link.title, children });\n else out.push(...children);\n i = link.end;\n continue;\n }\n }\n\n if ((char === 'h' || char === 'H') && (i === 0 || !/[\\w/]/.test(source[i - 1]))) {\n const bare = ctx.inLink ? null : BARE_URL_RE.exec(source.slice(i));\n if (bare) {\n const url = trimUrlPunctuation(bare[0]);\n const href = safeMarkdownUrl(url, 'link');\n if (href) {\n flush();\n out.push({ kind: 'link', href, title: null, children: [{ kind: 'text', value: url }] });\n i += url.length;\n continue;\n }\n }\n }\n\n if (char === '*' || char === '_' || char === '~') {\n const emphasis = matchEmphasis(source, i, depth, ctx);\n if (emphasis) {\n flush();\n out.push(emphasis.node);\n i = emphasis.end;\n continue;\n }\n }\n\n text += char;\n i++;\n }\n\n flush();\n\n return out;\n}\n\n/** The closing backtick run of exactly the opener's length — a longer run is not it. */\nfunction findCodeClose(source: string, from: number, run: string): number {\n for (let i = from; i < source.length; i++) {\n if (source[i] !== '`') continue;\n\n let end = i;\n while (source[end] === '`') end++;\n if (end - i === run.length) return i;\n i = end - 1;\n }\n\n return -1;\n}\n\n/** CommonMark strips one space from each end when both are present. */\nfunction codeSpanValue(raw: string): string {\n const value = raw.replace(/\\n/g, ' ');\n return value.length > 2 && value.startsWith(' ') && value.endsWith(' ') && value.trim() ? value.slice(1, -1) : value;\n}\n\ninterface LinkMatch {\n readonly label: string;\n readonly href: string;\n readonly title: string | null;\n /** Index just past the closing paren. */\n readonly end: number;\n}\n\n/**\n * `[label](href \"title\")` starting at `source[at] === '['`.\n *\n * Three bounds, all load-bearing. The label scan stops at\n * {@link MAX_LABEL_LENGTH}, which is CommonMark's own limit, and a scan that\n * reaches the end of the source without meeting a single `]` records the fact in\n * the context — from then on every later `[` answers in constant time. Without\n * that, `'['.repeat(100000)` spent 8 seconds on the main thread, inside a\n * `computed`. The third is {@link MAX_DESTINATION_NESTING}, on the destination\n * scan, and it is the one that makes the whole function linear.\n */\nfunction matchLink(source: string, at: number, ctx: ParseContext): LinkMatch | null {\n if (at >= ctx.noBracket.from) return null;\n\n let depth = 0;\n let close = -1;\n let sawClose = false;\n let scannedToEnd = true;\n\n for (let i = at; i < source.length; i++) {\n if (i - at > MAX_LABEL_LENGTH) {\n scannedToEnd = false;\n break;\n }\n const char = source[i];\n if (char === '\\\\') {\n i++;\n continue;\n }\n // A code span can hold an unbalanced bracket; stepping over it keeps\n // `` [`a]b`](x) `` from ending the label early.\n if (char === '`') {\n const run = /^`+/.exec(source.slice(i))![0];\n const end = findCodeClose(source, i + run.length, run);\n if (end !== -1) {\n i = end + run.length - 1;\n continue;\n }\n }\n if (char === '[') depth++;\n if (char === ']') {\n sawClose = true;\n depth--;\n if (depth === 0) {\n close = i;\n break;\n }\n }\n }\n\n if (close === -1) {\n // Only when the source truly holds no `]` past here: an unbalanced nest\n // (`[[a](b)`) fails for a different reason, and memoising that would hide the\n // valid link one character to the right.\n if (!sawClose && scannedToEnd) ctx.noBracket.from = Math.min(ctx.noBracket.from, at);\n return null;\n }\n\n if (source[close + 1] !== '(') return null;\n\n let parens = 1;\n let end = -1;\n for (let i = close + 2; i < source.length; i++) {\n const char = source[i];\n if (char === '\\\\') {\n i++;\n continue;\n }\n if (char === '(') {\n parens++;\n // Giving up HERE is what makes the scan linear rather than quadratic — see\n // {@link MAX_DESTINATION_NESTING}.\n if (parens > MAX_DESTINATION_NESTING) return null;\n }\n if (char === ')') {\n parens--;\n if (parens === 0) {\n end = i;\n break;\n }\n }\n // A newline inside the destination means this was never a link.\n if (char === '\\n') return null;\n }\n\n if (end === -1) return null;\n\n const target = source.slice(close + 2, end).trim();\n const label = source.slice(at + 1, close);\n\n // `<…>` around the destination is markdown's way of allowing a space in it, and\n // it has to be unwrapped BEFORE the scheme is read: `[a](<javascript:alert(1)>)`\n // has no scheme while the bracket is still attached, so `safeMarkdownUrl` read\n // it as a relative path and waved it through — leaving Angular's sanitizer, the\n // layer this file calls insufficient, as the only thing standing in the way.\n const angled = ANGLE_DEST_RE.exec(target);\n if (angled) return { label, href: angled[1], title: angled[2] ?? null, end: end + 1 };\n\n const titled = /^(\\S*)\\s+[\"'(](.*)[\"')]$/.exec(target);\n\n return {\n label,\n href: titled ? titled[1] : target,\n title: titled ? titled[2] : null,\n end: end + 1,\n };\n}\n\n/** Trailing sentence punctuation belongs to the prose, not to the bare URL. */\nfunction trimUrlPunctuation(url: string): string {\n return url.replace(/[.,;:!?'\"]+$/, '');\n}\n\ninterface EmphasisMatch {\n readonly node: WrMarkdownInline;\n readonly end: number;\n}\n\n/**\n * Emphasis, strong and strikethrough.\n *\n * A pragmatic reading of CommonMark's flanking rules rather than the full\n * algorithm: an opener may not be followed by whitespace, a closer may not be\n * preceded by it, and `_` additionally may not sit against a word character on\n * the outside. That last clause is the one that matters in practice — without it\n * `snake_case_name` renders as `snake<em>case</em>name`, which is how most\n * lightweight parsers embarrass themselves on code-adjacent prose.\n */\nfunction matchEmphasis(source: string, at: number, depth: number, ctx: ParseContext): EmphasisMatch | null {\n const char = source[at];\n const run = /^(\\*+|_+|~+)/.exec(source.slice(at))![0].length;\n\n // `~` is strikethrough only as a pair: a single one is arithmetic, a path, or\n // LaTeX far more often than it is emphasis.\n if (char === '~' && run < 2) return null;\n\n const use = char === '~' ? 2 : Math.min(run, 2);\n const after = source[at + run];\n if (after === undefined || /\\s/.test(after)) return null;\n if (char === '_' && at > 0 && /[\\p{L}\\p{N}]/u.test(source[at - 1])) return null;\n\n // Already known to have no closer from here on. The search is monotone — the\n // window for a later opener is a subset of this one — so one failure answers\n // every subsequent opener of the same character, which is what turns a\n // quadratic scan into a linear one.\n const failedFrom = ctx.noCloser.get(char);\n if (failedFrom !== undefined && at >= failedFrom) return null;\n\n for (let i = at + run; i < source.length; i++) {\n const current = source[i];\n\n if (current === '\\\\') {\n i++;\n continue;\n }\n\n if (current === '`') {\n const backticks = /^`+/.exec(source.slice(i))![0];\n const end = findCodeClose(source, i + backticks.length, backticks);\n if (end !== -1) {\n i = end + backticks.length - 1;\n continue;\n }\n }\n\n if (current !== char) continue;\n\n let end = i;\n while (source[end] === char) end++;\n const length = end - i;\n\n if (length < use || /\\s/.test(source[i - 1])) {\n i = end - 1;\n continue;\n }\n if (char === '_' && end < source.length && /[\\p{L}\\p{N}]/u.test(source[end])) {\n i = end - 1;\n continue;\n }\n\n // Take `use` markers from the START of the opener and the END of the closer,\n // so `***x***` leaves `*x*` inside the strong node and nests correctly.\n const children = inlines(source.slice(at + use, end - use), depth + 1, ctx);\n const kind = char === '~' ? 'del' : use === 2 ? 'strong' : 'em';\n\n return { node: { kind, children }, end };\n }\n\n // No closer anywhere in this source. Recorded so the next opener of the same\n // character does not repeat the walk.\n //\n // Note what does NOT happen here any more: an optimistic close. Guessing at the\n // scanner level meant a marker 40 characters back swallowed the rest of the\n // block — including markup that had already parsed, so an unclosed backtick ate\n // a finished `[docs](url)` and rendered it as monospaced source. Mid-stream\n // guessing now happens once, on the document's tail, where it can be bounded.\n // See {@link applyStreamingTail}.\n ctx.noCloser.set(char, Math.min(failedFrom ?? Number.POSITIVE_INFINITY, at));\n\n return null;\n}\n\n/** Text content of an inline tree — for `alt` and for heading slugs. */\nfunction plainText(inlines: readonly WrMarkdownInline[]): string {\n return inlines\n .map(node => {\n switch (node.kind) {\n case 'text':\n case 'code':\n return node.value;\n case 'image':\n return node.alt;\n case 'break':\n return ' ';\n default:\n return plainText(node.children);\n }\n })\n .join('');\n}\n\n// ---------------------------------------------------------------------------\n// Streaming\n// ---------------------------------------------------------------------------\n\n/**\n * How far back from the end of the document a marker may sit and still be treated\n * as mid-flight.\n *\n * The optimistic close is a GUESS, and a guess needs a blast radius. Unbounded, a\n * `*` forty characters back turned the rest of a finished sentence into emphasis\n * for the whole stream and then unwrapped it at the end — the exact restyle the\n * feature exists to avoid. Within a chunk's distance of the end, an unmatched\n * marker is nearly always a construct still arriving.\n */\nconst TAIL_WINDOW = 80;\n\n/**\n * A run that is worth closing optimistically, and its node kind.\n *\n * Deliberately no single `*` or `_`. Those are multiplication signs, file names\n * and `snake_case` far more often than they are emphasis mid-word, and getting it\n * wrong there restyles ordinary prose. `**`, `__`, `~~` and a backtick are\n * unambiguous enough to bet on.\n */\nconst OPTIMISTIC_RE = /(\\*\\*|__|~~|`)([^\\s*_~`][^*_~`]*)$/;\n\n/**\n * A construct the stream has only begun to type: a trailing marker run, or a link\n * whose destination has not arrived.\n *\n * Anchored, and every alternative bounded. The version this replaced allowed\n * `\\][^)]*` to run to the end of the text, so a CLOSED `[docs]` in the middle of a\n * sentence matched from the bracket onwards and deleted the rest of the paragraph\n * — and kept deleting it for the whole stream, because the paragraph stayed the\n * last block. `See the [docs] for details.` rendered as `See the `.\n */\nconst FRAGMENT_RE = /(?:[*_~`]+|!?\\[[^\\]\\n]*(?:\\]\\([^)\\s]*)?)$/;\n\n/**\n * The mid-stream adjustments, applied once to the document's TAIL.\n *\n * Everything the streaming mode does beyond parsing an open fence lives here, and\n * the reason is scope. The tail is the only part of a streamed document that is\n * still changing, so it is the only part where guessing is defensible; a guess\n * made inside the inline scanner cannot tell whether it is at the end of the\n * document or in the middle of a paragraph that finished two chunks ago.\n *\n * It descends: the last block may be a quote, or the last item of a list, which is\n * where most streamed prose actually lives. The version that only looked at a\n * top-level paragraph left the `**` flicker in place everywhere else while the\n * documentation claimed otherwise.\n */\nfunction applyStreamingTail(blocks: readonly WrMarkdownBlock[]): readonly WrMarkdownBlock[] {\n const last = blocks[blocks.length - 1];\n if (!last) return blocks;\n\n const patched = patchBlock(last);\n if (patched === last) return blocks;\n\n const head = blocks.slice(0, -1);\n\n return patched === null ? head : [...head, patched];\n}\n\n/** `null` to drop the block entirely, the same reference to leave it alone. */\nfunction patchBlock(block: WrMarkdownBlock): WrMarkdownBlock | null {\n switch (block.kind) {\n case 'paragraph':\n case 'heading': {\n // `## ` with nothing after it yet: a node that would render as an empty box.\n if (block.inlines.length === 0) return null;\n\n const inlines = patchInlines(block.inlines);\n if (inlines === block.inlines) return block;\n\n return inlines.length === 0 ? null : { ...block, inlines };\n }\n\n case 'quote': {\n const children = applyStreamingTail(block.children);\n if (children === block.children) return block;\n\n return children.length === 0 ? null : { ...block, children };\n }\n\n case 'list': {\n const item = block.items[block.items.length - 1];\n if (!item) return block;\n\n const children = applyStreamingTail(item.children);\n if (children === item.children) return block;\n\n // The item stays even when its content goes: the bullet is already on\n // screen, and removing it would be a flicker of its own.\n return { ...block, items: [...block.items.slice(0, -1), { ...item, children }] };\n }\n\n default:\n return block;\n }\n}\n\nfunction patchInlines(nodes: readonly WrMarkdownInline[]): readonly WrMarkdownInline[] {\n const last = nodes[nodes.length - 1];\n if (!last) return nodes;\n\n // The tail may be inside a wrapper — `**bold and [lin` puts it inside the strong.\n if (last.kind === 'strong' || last.kind === 'em' || last.kind === 'del' || last.kind === 'link') {\n const children = patchInlines(last.children);\n if (children === last.children) return nodes;\n\n const head = nodes.slice(0, -1);\n\n return children.length === 0 ? head : [...head, { ...last, children }];\n }\n\n // A backtick that has only just arrived, already painted as an empty chip.\n if (last.kind === 'code' && last.value === '') return nodes.slice(0, -1);\n\n if (last.kind !== 'text') return nodes;\n\n const patched = patchText(last.value);\n\n return patched === null ? nodes : [...nodes.slice(0, -1), ...patched];\n}\n\n/** `null` when the text is not a tail that needs adjusting. */\nfunction patchText(value: string): readonly WrMarkdownInline[] | null {\n let text = value;\n\n // Repeatedly, because dropping `[lin` from `**bold and [lin` exposes the `**`\n // behind it, which is then a candidate for the optimistic close below.\n for (let pass = 0; pass < 3; pass++) {\n const shorter = text.replace(FRAGMENT_RE, '');\n if (shorter === text) break;\n text = shorter;\n }\n\n const opening = OPTIMISTIC_RE.exec(text);\n if (opening) {\n const [matched, marker, content] = opening;\n const at = text.length - matched.length;\n const before = text.slice(0, at);\n // `_` may not close against a word character, so mid-word it is not a marker\n // at all — `snake_case` must not italicise as it arrives.\n const wordBefore = marker === '__' && at > 0 && /[\\p{L}\\p{N}]/u.test(text[at - 1]);\n\n if (!wordBefore && content.length <= TAIL_WINDOW) {\n const node: WrMarkdownInline =\n marker === '`'\n ? { kind: 'code', value: content }\n : { kind: marker === '~~' ? 'del' : 'strong', children: [{ kind: 'text', value: content }] };\n\n return before ? [{ kind: 'text', value: before }, node] : [node];\n }\n }\n\n if (text === value) return null;\n\n return text ? [{ kind: 'text', value: text }] : [];\n}\n\nexport { parseInlines, parseMarkdown, plainText, safeMarkdownUrl };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrMarkdownHighlighter } from './interfaces';\n\n/**\n * The app's syntax highlighter, or `null` for none.\n *\n * Defaults to `null` on purpose: highlighting means a grammar engine, and one of\n * those in the library's dependency tree would be paid for by every consumer who\n * renders a paragraph of text. Provide it with `provideWrMarkdownHighlighter()`.\n */\nexport const WR_MARKDOWN_HIGHLIGHTER = new InjectionToken<WrMarkdownHighlighter | null>('WR_MARKDOWN_HIGHLIGHTER', {\n factory: () => null,\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Injectable, inject, signal } from '@angular/core';\n\nimport type { WrHighlightLine } from './interfaces';\nimport { WR_MARKDOWN_HIGHLIGHTER } from './tokens';\n\n/**\n * How many highlighted code blocks to remember, per language.\n *\n * A requirement of streaming rather than an optimisation: a code block that grows\n * by a token per chunk asks to be highlighted with a DIFFERENT string every time,\n * so an unbounded store would hold every intermediate state of every block for the\n * life of the app — and this service is `providedIn: 'root'`.\n *\n * Comfortably larger than any one document, deliberately. A window too small to\n * hold what is on screen means every pass evicts entries that same pass still\n * needs and asks for them again — a grammar engine running for ever on a page that\n * has stopped changing.\n */\nconst CACHE_LIMIT = 256;\n\n/**\n * How many languages to remember at all.\n *\n * {@link CACHE_LIMIT} bounds the store in the dimension a STREAM controls and\n * left it unbounded in the dimension the DOCUMENT controls: `language` is the\n * first word of the code fence's info string, arbitrary text from an input\n * `<wr-markdown>` treats as untrusted — so a document of ```` ```a1 ```` …\n * ```` ```aN ```` fences created N buckets that only `invalidate()` ever\n * removed. Same `providedIn: 'root'` lifetime as the rest of this store.\n *\n * Comfortably larger than any one document for the same reason `CACHE_LIMIT` is:\n * a window too small to hold what is on screen evicts what the same pass still\n * renders. A document with more than a few dozen distinct languages is exotic.\n *\n * Evicting here cannot re-dirty the effect that requests, which is the loop this\n * class is built around avoiding: that effect depends on `generation`, and\n * nothing on this path writes it.\n *\n * Exported for the spec, not through `public-api.ts` — the number is the whole\n * assertion, and a copy of it in the test would stop tracking this one.\n */\nconst LANGUAGE_LIMIT = 64;\n\n/** One block's answer. `lines` stays `null` until an async highlighter resolves. */\ninterface Entry {\n lines: readonly WrHighlightLine[] | null;\n}\n\n/**\n * Turns fenced code into coloured spans, once per distinct block.\n *\n * **Two rules hold this together, and both were learned by breaking them.**\n *\n * `request` never READS a signal that it writes. An earlier version kept the\n * answers in a signal and rebuilt it on every store, so the component's `effect` —\n * which calls `request` — depended on the signal `request` wrote, and a document\n * with more code blocks than the cache could hold looped for ever: evict,\n * re-request, write, re-dirty. It did not merely spin, it starved the timers that\n * were supposed to fail the test. The plain `Map` is the source of truth now, and a\n * single `revision` counter is the only reactive part; nothing that writes reads it\n * back.\n *\n * And `linesFor` is a pure read, safe to call while Angular renders. Asking a\n * highlighter for a block means writing when the answer lands, and Angular refuses\n * a signal write during rendering (NG0600) — so the component requests from an\n * `effect`, which runs after the render, and the template only reads.\n *\n * Blocks appear as plain text first and gain colour when the answer arrives. For an\n * async highlighter that is right rather than a compromise: a grammar engine loads\n * WASM, and blocking on it would leave the reader with an empty box instead of\n * their code.\n */\n@Injectable({ providedIn: 'root' })\nexport class WrMarkdownHighlight {\n private readonly highlighter = inject(WR_MARKDOWN_HIGHLIGHTER);\n\n /** Language to code to answer. Insertion order is least-recently-rendered first. */\n private readonly cache = new Map<string, Map<string, Entry>>();\n\n /** Bumped whenever an answer lands. Read by the template, never by a writer. */\n private readonly revision = signal(0);\n\n private readonly generationSignal = signal(0);\n\n /**\n * Bumped ONLY by {@link invalidate}. Read it in the effect that requests, so a\n * consumer can force a re-ask.\n *\n * Separate from `revision` on purpose, and the separation is the whole safety\n * argument. An effect that requests and also depends on the signal that storing\n * an answer writes is the shape that looped for ever here once: past the cache\n * limit, requesting stops being idempotent, so each pass writes, re-dirties the\n * effect, evicts and requests again. Nothing inside `request` touches this one.\n */\n readonly generation = this.generationSignal.asReadonly();\n\n /** Spans for one block, or `null` for plain text. Safe to call from a template. */\n linesFor(code: string, language: string | null): readonly WrHighlightLine[] | null {\n if (!language) return null;\n\n // Establishes the dependency, so a late answer re-renders the block waiting.\n this.revision();\n\n const perLanguage = this.cache.get(language);\n const entry = perLanguage?.get(code);\n if (!entry || !perLanguage) return null;\n\n // Touched on read, so eviction drops what nobody is rendering rather than what\n // arrived first. Insertion order had it exactly backwards: mid-stream it\n // discarded the finished block the reader was looking at and kept the\n // half-typed intermediates, and the finished block flashed back to plain text.\n perLanguage.delete(code);\n perLanguage.set(code, entry);\n\n return entry.lines;\n }\n\n /**\n * Forget every answer and ask again on the next render.\n *\n * The cache is keyed on `(language, code)` and nothing else, which is right for\n * the streaming case it exists for and wrong for one real situation: a\n * highlighter that returns per-theme colours serves whichever palette was\n * current when a block was first rendered, for ever. There is no theme\n * dimension to key on — the library cannot know what a highlighter's answer\n * depends on — so the honest fix is to let the consumer say when it changed.\n *\n * A highlighter that returns theme-agnostic colours (CSS `light-dark()`, a\n * custom property) needs none of this.\n *\n * @example\n * ```ts\n * const highlight = inject(WrMarkdownHighlight);\n * effect(() => {\n * theme.current();\n * highlight.invalidate();\n * });\n * ```\n */\n invalidate(): void {\n this.cache.clear();\n this.generationSignal.update(generation => generation + 1);\n this.revision.update(revision => revision + 1);\n }\n\n /**\n * Ask for a block to be highlighted. Idempotent, and safe to call for every\n * block on every change — call it from an `effect`, never from a template.\n */\n request(code: string, language: string | null): void {\n // A bare fence has no grammar to pick, so there is nothing to ask for.\n if (!this.highlighter || !language || !code) return;\n\n const existing = this.cache.get(language);\n // Deleted before it is re-set, because `Map.set` on a key it already holds\n // keeps the ORIGINAL position: a plain `set` would leave the outer map in\n // first-sighting order, and `evictLanguage` would then drop a language still\n // being asked for in favour of one seen earlier and no longer rendered.\n if (existing) this.cache.delete(language);\n const perLanguage = existing ?? new Map<string, Entry>();\n this.cache.set(language, perLanguage);\n this.evictLanguage();\n // Presence IS the record of having asked — a separate `asked` set was a second\n // structure to keep in step with this one, and eviction only pruned one of them.\n if (perLanguage.has(code)) return;\n\n const entry: Entry = { lines: null };\n perLanguage.set(code, entry);\n this.evict(perLanguage);\n\n let result: ReturnType<typeof this.highlighter>;\n try {\n result = this.highlighter(code, language);\n } catch {\n // A highlighter that throws on an unknown grammar costs the reader colour,\n // not their code.\n return;\n }\n\n if (result instanceof Promise) {\n result.then(lines => this.fill(entry, lines)).catch(() => undefined);\n } else {\n this.fill(entry, result);\n }\n }\n\n /**\n * Fill in an answer and let the view know.\n *\n * Writes through the entry OBJECT rather than looking its key up again. The entry\n * may have been evicted while the promise was in flight, in which case this\n * writes to something nothing holds — which is the intended outcome. The version\n * that re-inserted by key put entries back behind eviction's back, and the cache\n * grew without a ceiling for exactly the async highlighter its limit exists for.\n */\n private fill(entry: Entry, lines: readonly WrHighlightLine[] | null): void {\n if (!lines) return;\n\n entry.lines = lines;\n this.revision.update(revision => revision + 1);\n }\n\n /** `Map` iterates in insertion order, and `linesFor` re-inserts on read. */\n private evict(perLanguage: Map<string, Entry>): void {\n while (perLanguage.size > CACHE_LIMIT) {\n const oldest = perLanguage.keys().next();\n if (oldest.done) return;\n perLanguage.delete(oldest.value);\n }\n }\n\n /**\n * The same bound, one dimension out. `request` re-inserts a bucket it already\n * holds, so the outer map iterates least-recently-REQUESTED first — and the\n * component's effect asks for every code block in the document it is showing,\n * so a language that stops being requested is one nothing renders any more.\n *\n * Read is deliberately NOT a touch here, unlike {@link linesFor} for the inner\n * map: with the effect re-asking for every block, request order already tracks\n * what is rendered, and nothing has needed the finer signal.\n */\n private evictLanguage(): void {\n while (this.cache.size > LANGUAGE_LIMIT) {\n const oldest = this.cache.keys().next();\n if (oldest.done) return;\n this.cache.delete(oldest.value);\n }\n }\n}\n\nexport { LANGUAGE_LIMIT };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, DestroyRef, ViewEncapsulation, computed, effect, inject, input, signal } from '@angular/core';\n\nimport { useConfigValue } from 'ngwr/config';\nimport { WrCopyToClipboard } from 'ngwr/directives';\nimport { useI18nText } from 'ngwr/i18n';\n\nimport type {\n WrHighlightLine,\n WrMarkdownBlock,\n WrMarkdownCell,\n WrMarkdownInline,\n WrMarkdownListItem,\n} from './interfaces';\nimport { parseMarkdown } from './parse-markdown';\nimport { WrMarkdownHighlight } from './wr-markdown-highlight';\n\n/** How long the copy button stays in its \"copied\" state. */\nconst COPIED_FEEDBACK_MS = 2000;\n\n/** Code blocks anywhere in the tree — a quote or a list item holds blocks too. */\nfunction collectCode(blocks: readonly WrMarkdownBlock[]): readonly { code: string; language: string | null }[] {\n const found: { code: string; language: string | null }[] = [];\n\n for (const block of blocks) {\n if (block.kind === 'code') found.push({ code: block.code, language: block.language });\n if (block.kind === 'quote') found.push(...collectCode(block.children));\n if (block.kind === 'list') for (const item of block.items) found.push(...collectCode(item.children));\n }\n\n return found;\n}\n\n/**\n * Renders markdown — as DOM, not as HTML.\n *\n * Built for streamed model output, and useful for any markdown an app does not\n * write itself: comments, release notes, a README. `[streaming]` makes a partial\n * document render like a whole one (see {@link parseMarkdown}); without it the\n * component is an ordinary renderer.\n *\n * **Raw HTML in the source is escaped, never rendered.** That is a deliberate\n * limit rather than an unfinished feature: the input is untrusted by\n * construction, `[innerHTML]` is how every comparable renderer takes it, and one\n * `<img onerror>` is the whole cost of being wrong. Nothing here is parsed as\n * HTML at any point — every text node is a text node and every `href` goes\n * through Angular's URL sanitizer on top of this component's own scheme check.\n *\n * @example\n * ```html\n * <wr-markdown [value]=\"answer()\" [streaming]=\"pending()\" copyable />\n * ```\n *\n * @see https://ngwr.dev/reference/components/markdown\n */\n@Component({\n selector: 'wr-markdown',\n templateUrl: './wr-markdown.html',\n imports: [NgTemplateOutlet, WrCopyToClipboard],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-markdown',\n '[class.wr-markdown--streaming]': 'streaming()',\n },\n})\nexport class WrMarkdown {\n private readonly highlight = inject(WrMarkdownHighlight);\n private readonly destroyRef = inject(DestroyRef);\n\n /** The markdown source. */\n readonly value = input<string>('');\n\n /**\n * The source is a prefix of a longer document.\n *\n * Turns on partial-safe parsing — an open fence renders as code, a half-typed\n * `**bold` renders as bold rather than as asterisks — and marks the host with\n * `.wr-markdown--streaming`, which paints a caret after the last block.\n *\n * @default false\n */\n readonly streaming = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a copy button on finished code blocks.\n *\n * Falls back to `markdown.copyable` from `provideWrConfig()`, then `false`.\n * Only CLOSED blocks get one: mid-stream the code is not all there, and a\n * button that copies half a snippet is worse than no button.\n */\n readonly copyable = input<boolean | null, BooleanInput>(null, {\n // `null` survives, because it is what \"the template said nothing\" means to\n // `useConfigValue` — but a bare `copyable` attribute has to reach `true`, and\n // without a transform it arrives as `''` and does not compile under\n // `strictTemplates`. The component's own JSDoc example was the proof.\n transform: value => (value == null ? null : coerceBooleanProperty(value)),\n });\n\n /**\n * Where links open. `_blank` also sets `rel=\"noopener noreferrer\"`, which is\n * not optional — a target without it hands the opener to a page whose URL came\n * from the document being rendered.\n *\n * Falls back to `markdown.linkTarget` from `provideWrConfig()`, then no target.\n */\n readonly linkTarget = input<'_blank' | '_self' | null>(null);\n\n /**\n * Put a slugged `id` on every heading, so the document can be linked into.\n *\n * @default true\n */\n readonly headingIds = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Namespace for the generated heading ids, and for the in-document `#fragment`\n * links that point at them.\n *\n * Defaults to `'user-content-'`, which is what GitHub emits for untrusted\n * markdown, and for the same reason: without a namespace a document that\n * happens to contain `# Search` renders `id=\"search\"` and steals it from the\n * page around it. That is not cosmetic — a `<label for=\"search\">` silently\n * stops labelling its input, and `getElementById` starts answering with a\n * heading. Anchors written INSIDE the document keep working, because a bare\n * `#fragment` href gets the same prefix.\n *\n * Set it to `''` for a document you author yourself and want clean anchors for.\n */\n readonly headingIdPrefix = input<string>('user-content-');\n\n /** Accessible name of the copy button. Falls back to `markdown.copy`, then `'Copy code'`. */\n readonly copyLabel = input<string | null>(null);\n\n /** Announced after a successful copy. Falls back to `markdown.copied`, then `'Copied'`. */\n readonly copiedLabel = input<string | null>(null);\n\n /** Read out for a checked task item. Falls back to `markdown.taskDone`, then `'Done:'`. */\n readonly taskDoneLabel = input<string | null>(null);\n\n /** Read out for an unchecked task item. Falls back to `markdown.taskTodo`, then `'To do:'`. */\n readonly taskTodoLabel = input<string | null>(null);\n\n protected readonly resolvedCopyable = useConfigValue(this.copyable, config => config.markdown?.copyable, false);\n protected readonly resolvedLinkTarget = useConfigValue<'_blank' | '_self' | null>(\n this.linkTarget,\n config => config.markdown?.linkTarget,\n null\n );\n protected readonly resolvedCopyLabel = useI18nText(this.copyLabel, 'markdown.copy', 'Copy code');\n protected readonly resolvedCopiedLabel = useI18nText(this.copiedLabel, 'markdown.copied', 'Copied');\n protected readonly resolvedTaskDoneLabel = useI18nText(this.taskDoneLabel, 'markdown.taskDone', 'Done:');\n protected readonly resolvedTaskTodoLabel = useI18nText(this.taskTodoLabel, 'markdown.taskTodo', 'To do:');\n\n /**\n * The parsed document, re-derived whenever the source changes.\n *\n * The WHOLE buffer, on every chunk — so a streamed answer costs O(n²) over the\n * stream. That is a deliberate trade rather than an oversight: freezing the\n * blocks before the last blank line would halve it, but a blank line is not a\n * safe boundary in markdown (a list continues across one), and a wrong boundary\n * corrupts the document rather than slowing it down. The constant is small —\n * 300 KB of prose parses in ~120 ms — and `@for`'s `track $index` keeps the\n * DOM cost proportional to what actually changed.\n */\n protected readonly blocks = computed(() => parseMarkdown(this.value(), { streaming: this.streaming() }));\n\n /** `rel` is bound, not hard-coded, so a same-tab link does not carry a pointless one. */\n protected readonly linkRel = computed(() => (this.resolvedLinkTarget() === '_blank' ? 'noopener noreferrer' : null));\n\n /**\n * Which code block last got copied, held by IDENTITY.\n *\n * Keyed on the code string, two blocks containing the same snippet both lit up\n * — and a document that shows the same one-liner twice is ordinary. Block nodes\n * are recreated whenever the source changes, so the confirmation also clears\n * itself on the next chunk, which is the right lifetime for it.\n */\n private readonly copiedBlock = signal<WrMarkdownBlock | null>(null);\n\n private copiedTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n // Requested here rather than from the template: asking the highlighter means\n // writing a signal when the answer lands, and Angular refuses a signal write\n // during rendering (NG0600). An effect runs after it.\n effect(() => {\n // `generation` is what makes `WrMarkdownHighlight.invalidate()` reach the\n // blocks already on screen. It is deliberately NOT the signal that storing\n // an answer bumps — depending on that one from here is the loop.\n this.highlight.generation();\n for (const block of this.codeBlocks()) this.highlight.request(block.code, block.language);\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.copiedTimer !== null) clearTimeout(this.copiedTimer);\n });\n }\n\n /**\n * A newline as data rather than as template text.\n *\n * The lines of a highlighted block are separate elements, and what separates\n * them on screen — and in a copy — is a real `\\n` inside the `<pre>`. Angular\n * strips whitespace-only text nodes from templates, so the character cannot be\n * typed there; an interpolation of it survives.\n */\n protected readonly newline = String.fromCharCode(10);\n\n /** Every code block in the document, nested ones included. */\n private readonly codeBlocks = computed(() => collectCode(this.blocks()));\n\n /** Spans for a code block, or `null` to render it as plain text. */\n protected linesOf(code: string, language: string | null): readonly WrHighlightLine[] | null {\n return this.highlight.linesFor(code, language);\n }\n\n protected isCopied(block: WrMarkdownBlock): boolean {\n return this.copiedBlock() === block;\n }\n\n protected onCopied(block: WrMarkdownBlock): void {\n this.copiedBlock.set(block);\n if (this.copiedTimer !== null) clearTimeout(this.copiedTimer);\n this.copiedTimer = setTimeout(() => {\n this.copiedBlock.set(null);\n this.copiedTimer = null;\n }, COPIED_FEEDBACK_MS);\n }\n\n /** A heading's id, namespaced, or `null` when there is nothing to link to. */\n protected idOf(id: string): string | null {\n if (!this.headingIds() || !id) return null;\n\n return `${this.headingIdPrefix()}${id}`;\n }\n\n /**\n * A link's destination, with a bare fragment pointed at the namespaced id.\n *\n * Otherwise prefixing the headings would quietly break every `[see](#section)`\n * the document writes about itself.\n */\n protected hrefOf(href: string): string {\n const prefix = this.headingIdPrefix();\n if (!prefix || !this.headingIds() || !href.startsWith('#') || href.length < 2) return href;\n\n return `#${prefix}${href.slice(1)}`;\n }\n\n /**\n * Casts for the recursive templates, and the reason they exist.\n *\n * Block content nests — a quote holds blocks, a list item holds blocks — so the\n * template recurses through `ngTemplateOutlet` into itself. That is the one\n * recursion shape which adds NO elements to the DOM; a recursive component\n * would put a host element between `<ul>` and its `<li>`, which is invalid\n * markup and breaks the list's accessibility tree. The cost is that\n * `ngTemplateOutlet` context arrives as `any`, and `@switch` cannot narrow\n * `any`. Casting it back at the top of each template restores full\n * `strictTemplates` checking inside the loop, where the work happens.\n */\n protected asBlocks(value: unknown): readonly WrMarkdownBlock[] {\n return value as readonly WrMarkdownBlock[];\n }\n\n protected asInlines(value: unknown): readonly WrMarkdownInline[] {\n return value as readonly WrMarkdownInline[];\n }\n\n protected asItems(value: unknown): readonly WrMarkdownListItem[] {\n return value as readonly WrMarkdownListItem[];\n }\n\n protected asCells(value: unknown): readonly WrMarkdownCell[] {\n return value as readonly WrMarkdownCell[];\n }\n}\n","<!--\n Recursion runs through `ngTemplateOutlet` into these templates rather than\n through a child component, so the rendered DOM is exactly the document — no\n wrapper element between a `<ul>` and its `<li>`. See `asBlocks` for the whole\n reasoning.\n-->\n<ng-template #inlineList let-raw>\n @let nodes = asInlines(raw);\n\n @for (node of nodes; track $index) {\n @switch (node.kind) {\n @case ('text') {\n <!-- Wrapped, and not for tidiness: a bare interpolation on its own line is\n ONE text node that includes the indentation around it, so `a **b** c`\n rendered with a space inside every `<strong>`. Inside an element the\n whitespace becomes separate whitespace-only nodes, which Angular\n removes, and `<ng-container>` itself renders nothing. Prettier\n reformats the bare form back, so this also has to survive `--fix`. -->\n <ng-container>{{ node.value }}</ng-container>\n }\n @case ('code') {\n <!-- `dir=\"ltr\"` because code is not prose: under RTL the browser\n reorders `foo();` to `;foo()`. -->\n <code class=\"wr-markdown__code-inline\" dir=\"ltr\">{{ node.value }}</code>\n }\n @case ('strong') {\n <strong class=\"wr-markdown__strong\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></strong>\n }\n @case ('em') {\n <em class=\"wr-markdown__em\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></em>\n }\n @case ('del') {\n <del class=\"wr-markdown__del\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></del>\n }\n @case ('link') {\n <a\n class=\"wr-markdown__link\"\n [href]=\"hrefOf(node.href)\"\n [attr.title]=\"node.title\"\n [attr.target]=\"resolvedLinkTarget()\"\n [attr.rel]=\"linkRel()\"\n ><ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: node.children }\"\n /></a>\n }\n @case ('image') {\n <img\n class=\"wr-markdown__image\"\n [src]=\"node.src\"\n [alt]=\"node.alt\"\n [attr.title]=\"node.title\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n }\n @case ('break') {\n <br />\n }\n }\n }\n</ng-template>\n\n<ng-template #itemList let-raw let-tight=\"tight\">\n @let items = asItems(raw);\n\n @for (item of items; track $index) {\n <li class=\"wr-markdown__item\" [class.wr-markdown__item--task]=\"item.checked !== null\">\n @if (item.checked !== null) {\n <!-- Presentational, with the state as text beside it: a real\n `<input type=\"checkbox\">` here would be an unlabelled form control,\n which is a serious axe violation, and making it operable would\n promise an interaction a renderer cannot honour. -->\n <span class=\"wr-markdown__task\" [class.wr-markdown__task--checked]=\"item.checked\" aria-hidden=\"true\"></span>\n <span class=\"wr-markdown__sr-only\">{{ item.checked ? resolvedTaskDoneLabel() : resolvedTaskTodoLabel() }}</span>\n }\n <ng-container\n [ngTemplateOutlet]=\"blockList\"\n [ngTemplateOutletContext]=\"{ $implicit: item.children, tight: tight }\"\n />\n </li>\n }\n</ng-template>\n\n<ng-template #blockList let-raw let-tight=\"tight\">\n @let list = asBlocks(raw);\n\n @for (block of list; track $index) {\n @switch (block.kind) {\n @case ('paragraph') {\n <!-- A tight list drops the `<p>`, which is what CommonMark specifies and\n what keeps a one-line list from being double-spaced. -->\n @if (tight) {\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n } @else {\n <p class=\"wr-markdown__paragraph\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </p>\n }\n }\n @case ('heading') {\n @switch (block.level) {\n @case (1) {\n <h1 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h1>\n }\n @case (2) {\n <h2 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h2>\n }\n @case (3) {\n <h3 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h3>\n }\n @case (4) {\n <h4 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h4>\n }\n @case (5) {\n <h5 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h5>\n }\n @default {\n <h6 class=\"wr-markdown__heading\" [attr.id]=\"idOf(block.id)\">\n <ng-container [ngTemplateOutlet]=\"inlineList\" [ngTemplateOutletContext]=\"{ $implicit: block.inlines }\" />\n </h6>\n }\n }\n }\n @case ('code') {\n @let highlighted = linesOf(block.code, block.language);\n\n <div class=\"wr-markdown__code-block\">\n <pre\n class=\"wr-markdown__pre\"\n dir=\"ltr\"\n tabindex=\"0\"\n ><code class=\"wr-markdown__code\" [attr.data-language]=\"block.language\">@if (highlighted) {@for (row of highlighted; track $index) {<span class=\"wr-markdown__line\">@for (span of row; track $index) {<span\n [style.color]=\"span.color\"\n [style.font-style]=\"span.fontStyle === 'italic' ? 'italic' : null\"\n [style.font-weight]=\"span.fontStyle === 'bold' ? 'bold' : null\"\n [style.text-decoration]=\"span.fontStyle === 'underline' ? 'underline' : null\"\n >{{ span.text }}</span>}</span>@if (!$last) {{{ newline }}}}} @else {{{ block.code }}}</code></pre>\n\n @if (resolvedCopyable() && block.closed) {\n <button\n type=\"button\"\n class=\"wr-markdown__copy\"\n [wrCopyToClipboard]=\"block.code\"\n [attr.aria-label]=\"isCopied(block) ? resolvedCopiedLabel() : resolvedCopyLabel()\"\n (copied)=\"onCopied(block)\"\n >\n <svg\n class=\"wr-markdown__copy-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n @if (isCopied(block)) {\n <path d=\"M20 6 9 17l-5-5\" />\n } @else {\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n }\n </svg>\n </button>\n }\n </div>\n }\n @case ('quote') {\n <blockquote class=\"wr-markdown__quote\">\n <ng-container\n [ngTemplateOutlet]=\"blockList\"\n [ngTemplateOutletContext]=\"{ $implicit: block.children, tight: false }\"\n />\n </blockquote>\n }\n @case ('list') {\n @if (block.ordered) {\n <ol\n class=\"wr-markdown__list wr-markdown__list--ordered\"\n [attr.start]=\"block.start === 1 ? null : block.start\"\n >\n <ng-container\n [ngTemplateOutlet]=\"itemList\"\n [ngTemplateOutletContext]=\"{ $implicit: block.items, tight: block.tight }\"\n />\n </ol>\n } @else {\n <ul class=\"wr-markdown__list\">\n <ng-container\n [ngTemplateOutlet]=\"itemList\"\n [ngTemplateOutletContext]=\"{ $implicit: block.items, tight: block.tight }\"\n />\n </ul>\n }\n }\n @case ('table') {\n <!-- Its own scroller: a wide table must not push the page sideways, which\n is also what keeps the RTL layout gate quiet about it. -->\n <div class=\"wr-markdown__table-scroll\" tabindex=\"0\">\n <table class=\"wr-markdown__table\">\n <thead>\n <tr>\n @for (cell of block.head; track column; let column = $index) {\n <th class=\"wr-markdown__th\" scope=\"col\" [style.text-align]=\"block.align[column]\">\n <ng-container\n [ngTemplateOutlet]=\"inlineList\"\n [ngTemplateOutletContext]=\"{ $implicit: cell.inlines }\"\n />\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of block.rows; track $index) {\n <tr>\n @for (cell of asCells(row); track column; let column = $index) {\n <td class=\"wr-markdown__td\" [style.text-align]=\"block.align[column]\">\n <ng-container\n [ngTemplateOutlet]=\"inlineList\"\n [ngTemplateOutletContext]=\"{ $implicit: cell.inlines }\"\n />\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n @case ('rule') {\n <hr class=\"wr-markdown__rule\" />\n }\n }\n }\n</ng-template>\n\n<ng-container [ngTemplateOutlet]=\"blockList\" [ngTemplateOutletContext]=\"{ $implicit: blocks(), tight: false }\" />\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport type { WrMarkdownHighlighter } from './interfaces';\nimport { WR_MARKDOWN_HIGHLIGHTER } from './tokens';\n\n/**\n * Give every `<wr-markdown>` in the app a syntax highlighter.\n *\n * The highlighter returns coloured SPANS, not HTML — see\n * {@link WrMarkdownHighlighter} for why that signature is the one worth having.\n * It may be async, and it may return `null` for languages it does not know; both\n * render the block as plain text, which is also what server-side rendering\n * produces, since a highlighter that resolves after prerender has already\n * finished cannot contribute to the HTML.\n *\n * Pass `{ useFactory }` when the adapter needs to inject something. A highlighter\n * is itself a function, so the factory cannot be detected by shape — hence the\n * wrapper object rather than an overload that would guess.\n *\n * @example\n * ```ts\n * bootstrapApplication(App, {\n * providers: [\n * provideWrMarkdownHighlighter(shikiSpans),\n *\n * // Or, when the adapter has dependencies of its own:\n * provideWrMarkdownHighlighter({\n * useFactory: () => {\n * const isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n * return (code, language) => (isBrowser ? shikiSpans(code, language) : null);\n * },\n * }),\n * ],\n * });\n * ```\n */\nexport function provideWrMarkdownHighlighter(\n highlighter: WrMarkdownHighlighter | { readonly useFactory: () => WrMarkdownHighlighter }\n): EnvironmentProviders {\n if (typeof highlighter === 'function') {\n return makeEnvironmentProviders([{ provide: WR_MARKDOWN_HIGHLIGHTER, useValue: highlighter }]);\n }\n\n return makeEnvironmentProviders([{ provide: WR_MARKDOWN_HIGHLIGHTER, useFactory: highlighter.useFactory }]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;AAKG;AAWH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDG;AACH,SAAS,aAAa,CAAC,MAAc,EAAE,UAAkC,EAAE,EAAA;AACzE,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,EAAE;IAEtB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;AAClD,IAAA,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;AAEjE,IAAA,OAAO,GAAG,CAAC,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,GAAG,MAAM;AAC5D;AAEA;;;;;;;;AAQG;AACH,MAAM,SAAS,GAAG,EAAE;AAEpB;;;;;;;;;;AAUG;AACH,MAAM,iBAAiB,GAAG,GAAG;AA2C7B,SAAS,UAAU,CAAC,SAAkB,EAAA;IACpC,OAAO;QACL,SAAS;QACT,KAAK,EAAE,IAAI,GAAG,EAAE;QAChB,QAAQ,EAAE,IAAI,GAAG,E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