@carbon/ai-chat-components 1.13.0 → 1.14.0-rc.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 (206) hide show
  1. package/custom-elements.json +1147 -462
  2. package/es/components/audio-player/src/audio-player.scss.js +1 -1
  3. package/es/components/audio-player/src/transcript.js +15 -0
  4. package/es/components/audio-player/src/transcript.js.map +1 -1
  5. package/es/components/card/src/card-footer.scss.js +1 -1
  6. package/es/components/card/src/card-steps.scss.js +1 -1
  7. package/es/components/card/src/card.scss.js +1 -1
  8. package/es/components/chat-button/src/chat-button.scss.js +1 -1
  9. package/es/components/chat-history/src/chat-history.scss.js +1 -1
  10. package/es/components/chat-history/src/history-header.js +1 -0
  11. package/es/components/chat-history/src/history-header.js.map +1 -1
  12. package/es/components/chat-history/src/history-toolbar.js +4 -1
  13. package/es/components/chat-history/src/history-toolbar.js.map +1 -1
  14. package/es/components/chat-shell/src/shell.scss.js +1 -1
  15. package/es/components/code-snippet/src/code-snippet.d.ts +3 -2
  16. package/es/components/code-snippet/src/code-snippet.js +4 -3
  17. package/es/components/code-snippet/src/code-snippet.js.map +1 -1
  18. package/es/components/code-snippet/src/code-snippet.scss.js +1 -1
  19. package/es/components/feedback/src/feedback.js +17 -3
  20. package/es/components/feedback/src/feedback.js.map +1 -1
  21. package/es/components/file-uploads/src/file-upload-item.scss.js +1 -1
  22. package/es/components/file-uploads/src/file-uploads.scss.js +1 -1
  23. package/es/components/launcher/src/launcher.scss.js +1 -1
  24. package/es/components/markdown/__tests__/inline-selection-fixture.d.ts +13 -0
  25. package/es/components/markdown/index.d.ts +2 -0
  26. package/es/components/markdown/index.js +3 -0
  27. package/es/components/markdown/index.js.map +1 -1
  28. package/es/components/markdown/src/inline-markdown.d.ts +41 -0
  29. package/es/components/markdown/src/inline-markdown.js +92 -0
  30. package/es/components/markdown/src/inline-markdown.js.map +1 -0
  31. package/es/components/markdown/src/inline-markdown.scss.js +13 -0
  32. package/es/components/markdown/src/inline-markdown.scss.js.map +1 -0
  33. package/es/components/markdown/src/inline-run-projection.scss.js +13 -0
  34. package/es/components/markdown/src/inline-run-projection.scss.js.map +1 -0
  35. package/es/components/markdown/src/markdown-renderer-types.d.ts +132 -0
  36. package/es/components/markdown/src/markdown-renderer.js +131 -25
  37. package/es/components/markdown/src/markdown-renderer.js.map +1 -1
  38. package/es/components/markdown/src/markdown.js +1 -0
  39. package/es/components/markdown/src/markdown.js.map +1 -1
  40. package/es/components/markdown/src/markdown.scss.js +1 -1
  41. package/es/components/markdown/src/utils/inline-run-projection.d.ts +15 -0
  42. package/es/components/markdown/src/utils/inline-run-projection.js +196 -0
  43. package/es/components/markdown/src/utils/inline-run-projection.js.map +1 -0
  44. package/es/components/markdown/src/utils/inline-validation.d.ts +13 -0
  45. package/es/components/markdown/src/utils/inline-validation.js +97 -0
  46. package/es/components/markdown/src/utils/inline-validation.js.map +1 -0
  47. package/es/components/markdown/src/utils/plugin-fallback.js +20 -13
  48. package/es/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  49. package/es/components/markdown/src/utils/plugin-host-container.d.ts +5 -6
  50. package/es/components/markdown/src/utils/plugin-host-container.js.map +1 -1
  51. package/es/components/messages-shell/index.d.ts +11 -0
  52. package/es/components/messages-shell/index.js +9 -0
  53. package/es/components/messages-shell/index.js.map +1 -0
  54. package/es/components/messages-shell/src/messages-shell.d.ts +57 -0
  55. package/es/components/messages-shell/src/messages-shell.js +141 -0
  56. package/es/components/messages-shell/src/messages-shell.js.map +1 -0
  57. package/es/components/messages-shell/src/messages-shell.scss.js +13 -0
  58. package/es/components/messages-shell/src/messages-shell.scss.js.map +1 -0
  59. package/es/components/processing/src/processing.scss.js +1 -1
  60. package/es/components/prompt-line/autocomplete/src/autocomplete.d.ts +26 -9
  61. package/es/components/prompt-line/autocomplete/src/autocomplete.js +116 -107
  62. package/es/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
  63. package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  64. package/es/components/prompt-line/src/autocomplete-controller-element.js +13 -1
  65. package/es/components/prompt-line/src/autocomplete-controller-element.js.map +1 -1
  66. package/es/components/prompt-line/src/autocomplete-controller.js +9 -2
  67. package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  68. package/es/components/prompt-line/src/prompt-line-controller.d.ts +7 -0
  69. package/es/components/prompt-line/src/prompt-line-rich-runtime.js +17 -0
  70. package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  71. package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  72. package/es/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +1 -0
  73. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +3 -0
  74. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
  75. package/es/components/prompt-line/src/prompt-line.d.ts +7 -0
  76. package/es/components/prompt-line/src/prompt-line.js +9 -0
  77. package/es/components/prompt-line/src/prompt-line.js.map +1 -1
  78. package/es/components/prompt-line/src/send-control.scss.js +1 -1
  79. package/es/components/prompt-line/src/stop-streaming-button.scss.js +1 -1
  80. package/es/components/prompt-line/src/tiptap/carbon-mention.js +43 -21
  81. package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
  82. package/es/components/prompt-line/src/tiptap/plain-text-paste.js +8 -3
  83. package/es/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -1
  84. package/es/components/prompt-line/src/tiptap/strip-presentation-fields.d.ts +3 -3
  85. package/es/components/prompt-line/src/tiptap/strip-presentation-fields.js.map +1 -1
  86. package/es/components/prompt-line/src/tiptap/types.d.ts +27 -11
  87. package/es/components/reasoning-steps/src/reasoning-step.d.ts +3 -3
  88. package/es/components/reasoning-steps/src/reasoning-step.js +4 -4
  89. package/es/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  90. package/es/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  91. package/es/components/reasoning-steps/src/reasoning-steps-toggle.scss.js +1 -1
  92. package/es/components/reasoning-steps/src/reasoning-steps.d.ts +5 -4
  93. package/es/components/reasoning-steps/src/reasoning-steps.js +5 -4
  94. package/es/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
  95. package/es/components/truncated-text/src/truncated-text.scss.js +1 -1
  96. package/es/components/video-player/src/video-player.scss.js +1 -1
  97. package/es/globals/scss/common.scss.js +1 -1
  98. package/es/react/hooks/useChatAutocomplete.js +7 -1
  99. package/es/react/hooks/useChatAutocomplete.js.map +1 -1
  100. package/es/react/messages-shell.d.ts +3 -0
  101. package/es/react/messages-shell.js +32 -0
  102. package/es/react/messages-shell.js.map +1 -0
  103. package/es-custom/components/audio-player/src/audio-player.scss.js +1 -1
  104. package/es-custom/components/audio-player/src/transcript.js +15 -0
  105. package/es-custom/components/audio-player/src/transcript.js.map +1 -1
  106. package/es-custom/components/card/src/card-footer.scss.js +1 -1
  107. package/es-custom/components/card/src/card-steps.scss.js +1 -1
  108. package/es-custom/components/card/src/card.scss.js +1 -1
  109. package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
  110. package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
  111. package/es-custom/components/chat-history/src/history-header.js +1 -0
  112. package/es-custom/components/chat-history/src/history-header.js.map +1 -1
  113. package/es-custom/components/chat-history/src/history-toolbar.js +4 -1
  114. package/es-custom/components/chat-history/src/history-toolbar.js.map +1 -1
  115. package/es-custom/components/chat-shell/src/shell.scss.js +1 -1
  116. package/es-custom/components/code-snippet/src/code-snippet.d.ts +3 -2
  117. package/es-custom/components/code-snippet/src/code-snippet.js +4 -3
  118. package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
  119. package/es-custom/components/code-snippet/src/code-snippet.scss.js +1 -1
  120. package/es-custom/components/feedback/src/feedback.js +17 -3
  121. package/es-custom/components/feedback/src/feedback.js.map +1 -1
  122. package/es-custom/components/file-uploads/src/file-upload-item.scss.js +1 -1
  123. package/es-custom/components/file-uploads/src/file-uploads.scss.js +1 -1
  124. package/es-custom/components/launcher/src/launcher.scss.js +1 -1
  125. package/es-custom/components/markdown/__tests__/inline-selection-fixture.d.ts +13 -0
  126. package/es-custom/components/markdown/index.d.ts +2 -0
  127. package/es-custom/components/markdown/index.js +3 -0
  128. package/es-custom/components/markdown/index.js.map +1 -1
  129. package/es-custom/components/markdown/src/inline-markdown.d.ts +41 -0
  130. package/es-custom/components/markdown/src/inline-markdown.js +92 -0
  131. package/es-custom/components/markdown/src/inline-markdown.js.map +1 -0
  132. package/es-custom/components/markdown/src/inline-markdown.scss.js +13 -0
  133. package/es-custom/components/markdown/src/inline-markdown.scss.js.map +1 -0
  134. package/es-custom/components/markdown/src/inline-run-projection.scss.js +13 -0
  135. package/es-custom/components/markdown/src/inline-run-projection.scss.js.map +1 -0
  136. package/es-custom/components/markdown/src/markdown-renderer-types.d.ts +132 -0
  137. package/es-custom/components/markdown/src/markdown-renderer.js +131 -25
  138. package/es-custom/components/markdown/src/markdown-renderer.js.map +1 -1
  139. package/es-custom/components/markdown/src/markdown.js +1 -0
  140. package/es-custom/components/markdown/src/markdown.js.map +1 -1
  141. package/es-custom/components/markdown/src/markdown.scss.js +1 -1
  142. package/es-custom/components/markdown/src/utils/inline-run-projection.d.ts +15 -0
  143. package/es-custom/components/markdown/src/utils/inline-run-projection.js +196 -0
  144. package/es-custom/components/markdown/src/utils/inline-run-projection.js.map +1 -0
  145. package/es-custom/components/markdown/src/utils/inline-validation.d.ts +13 -0
  146. package/es-custom/components/markdown/src/utils/inline-validation.js +97 -0
  147. package/es-custom/components/markdown/src/utils/inline-validation.js.map +1 -0
  148. package/es-custom/components/markdown/src/utils/plugin-fallback.js +20 -13
  149. package/es-custom/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  150. package/es-custom/components/markdown/src/utils/plugin-host-container.d.ts +5 -6
  151. package/es-custom/components/markdown/src/utils/plugin-host-container.js.map +1 -1
  152. package/es-custom/components/messages-shell/index.d.ts +11 -0
  153. package/es-custom/components/messages-shell/index.js +9 -0
  154. package/es-custom/components/messages-shell/index.js.map +1 -0
  155. package/es-custom/components/messages-shell/src/messages-shell.d.ts +57 -0
  156. package/es-custom/components/messages-shell/src/messages-shell.js +141 -0
  157. package/es-custom/components/messages-shell/src/messages-shell.js.map +1 -0
  158. package/es-custom/components/messages-shell/src/messages-shell.scss.js +13 -0
  159. package/es-custom/components/messages-shell/src/messages-shell.scss.js.map +1 -0
  160. package/es-custom/components/processing/src/processing.scss.js +1 -1
  161. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.d.ts +26 -9
  162. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js +116 -107
  163. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
  164. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  165. package/es-custom/components/prompt-line/src/autocomplete-controller-element.js +13 -1
  166. package/es-custom/components/prompt-line/src/autocomplete-controller-element.js.map +1 -1
  167. package/es-custom/components/prompt-line/src/autocomplete-controller.js +9 -2
  168. package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  169. package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +7 -0
  170. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +17 -0
  171. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  172. package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  173. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +1 -0
  174. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +3 -0
  175. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
  176. package/es-custom/components/prompt-line/src/prompt-line.d.ts +7 -0
  177. package/es-custom/components/prompt-line/src/prompt-line.js +9 -0
  178. package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
  179. package/es-custom/components/prompt-line/src/send-control.scss.js +1 -1
  180. package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js +1 -1
  181. package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js +43 -21
  182. package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
  183. package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js +8 -3
  184. package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -1
  185. package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.d.ts +3 -3
  186. package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.js.map +1 -1
  187. package/es-custom/components/prompt-line/src/tiptap/types.d.ts +27 -11
  188. package/es-custom/components/reasoning-steps/src/reasoning-step.d.ts +3 -3
  189. package/es-custom/components/reasoning-steps/src/reasoning-step.js +4 -4
  190. package/es-custom/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  191. package/es-custom/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  192. package/es-custom/components/reasoning-steps/src/reasoning-steps-toggle.scss.js +1 -1
  193. package/es-custom/components/reasoning-steps/src/reasoning-steps.d.ts +5 -4
  194. package/es-custom/components/reasoning-steps/src/reasoning-steps.js +5 -4
  195. package/es-custom/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
  196. package/es-custom/components/truncated-text/src/truncated-text.scss.js +1 -1
  197. package/es-custom/components/video-player/src/video-player.scss.js +1 -1
  198. package/es-custom/globals/scss/common.scss.js +1 -1
  199. package/es-custom/react/hooks/useChatAutocomplete.js +7 -1
  200. package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -1
  201. package/es-custom/react/messages-shell.d.ts +3 -0
  202. package/es-custom/react/messages-shell.js +32 -0
  203. package/es-custom/react/messages-shell.js.map +1 -0
  204. package/package.json +6 -6
  205. package/scss/_markdown-inline.scss +138 -0
  206. package/telemetry.yml +4 -0
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-renderer.js","sources":["../../../../src/components/markdown/src/markdown-renderer.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Walks a `TokenTree` and emits a Lit `TemplateResult` plus a batch of {@link MarkdownRendererSlotDescriptor} records the markdown element consumes during its `updated()` reconcile. External callers should go through {@link renderMarkdownTree} so the batch isn't accidentally dropped.\n *\n * ### Dispatch precedence\n *\n * Per token, in order:\n *\n * 1. **Consumer override** — `options.customRenderers`. For `table`/`codeBlock` the renderer emits a named `<slot>` placeholder and records a descriptor; the markdown element's `updated()` invokes the consumer callback later. For `link`/`image` the callback runs synchronously here as an attribute transform (no slot, no descriptor); `checklist` adjusts the rendered `cds-checkbox` (its toggles are delivered by a listener on the markdown element).\n * 2. **Plugin-overridden rule** — `shouldDelegateToPluginRule(token, md)` is true when a user-supplied markdown-it plugin overrode the renderer rule for one of the curated leaf tokens in `PLUGIN_DELEGABLE_TOKEN_TYPES` (`fence`, `image`, `code_inline`, `html_block`). The token routes through `renderFallback` and surfaces as a `pluginFallback` descriptor.\n * 3. **Native Lit dispatch** — the hand-written `renderWithStaticTag` switch. Kept flat (rather than a tag-to-renderer map) so the per-tag exceptions — task-list passthrough, Carbon `cds-unordered-list` / `cds-ordered-list` wrappers, automatic `target=\"_blank\"` on `<a>`, image plugin delegation — stay easy to grep.\n * 4. **Unknown plugin-introduced token** — anything not natively handled falls through to `renderFallback`, so plugins that register `md.renderer.rules[type]` (footnote, deflist, custom containers, emoji) just work.\n *\n * ### Slot contract\n *\n * {@link MarkdownRendererSlotDescriptor} (defined in `./markdown-renderer-types.ts`) is the bridge between this module and `./markdown.ts`. This module appends descriptors via `recordCustomRender`; the markdown element's `reconcileCustomRendererHosts` consumes them, invokes consumer callbacks (or adopts plugin-fallback HTML) and attaches the result as a light-DOM `<div slot=\"…\">` host (or `<span>` for inline plugin output).\n */\n\nimport DOMPurify from 'dompurify';\nimport { html, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { Token } from 'markdown-it';\nimport '@carbon/web-components/es/components/list/index.js';\nimport '@carbon/web-components/es/components/checkbox/index.js';\nimport '../../code-snippet/index.js';\nimport '../../card/index.js';\nimport '../../table/index.js';\nimport { defaultLineCountText } from '../../code-snippet/src/formatters.js';\n\nimport { renderTable } from './utils/table-helpers.js';\nimport {\n combineConsecutiveHtmlInline,\n combineSplitHtmlBlocks,\n} from './utils/html-helpers.js';\nimport {\n htmlContainer,\n sanitizeHtmlContent,\n spread,\n} from './utils/lit-directives.js';\nimport {\n isNativelyHandled,\n renderFallback,\n shouldDelegateToPluginRule,\n} from './utils/plugin-fallback.js';\nimport {\n MARKDOWN_SLOT_PREFIX,\n withInstanceNamespace,\n} from './utils/slot-names.js';\nimport { type TokenTree } from './markdown-token-tree.js';\nimport type {\n MarkdownRendererLinkResult,\n MarkdownRendererSlotDescriptor,\n RenderTokenTreeOptions,\n} from './markdown-renderer-types.js';\n\n// Re-export types so existing imports of these from this module keep working.\nexport type {\n MarkdownCustomRenderers,\n MarkdownRendererChecklist,\n MarkdownRendererChecklistItemArgs,\n MarkdownRendererChecklistToggleArgs,\n MarkdownRendererCodeBlockArgs,\n MarkdownRendererCodeBlockData,\n MarkdownRendererImageArgs,\n MarkdownRendererImageResult,\n MarkdownRendererLinkArgs,\n MarkdownRendererLinkResult,\n MarkdownRendererSlotDescriptor,\n MarkdownRendererTableArgs,\n MarkdownRendererTableData,\n RenderTokenTreeOptions,\n} from './markdown-renderer-types.js';\n\n/**\n * Slot name for an overridable token — unique across the page, stable across\n * streaming ticks. Three parts:\n *\n * - `startLine` (not the full `token.map`) so the name doesn't change when the\n * token's `endLine` advances during streaming;\n * - `currentIndex` from the parent context, disambiguating siblings that share\n * a start line (rare but possible);\n * - the owning element's namespace, because slot hosts from every markdown\n * element on the page are hoisted into one shared light-DOM container and\n * projected back by name (see `./utils/slot-names.js`).\n */\nfunction slotNameFor(\n kind: 'table' | 'codeBlock',\n token: Token,\n options: RenderTokenTreeOptions\n): string {\n const startLine = token.map?.[0] ?? 0;\n const index = options.context?.currentIndex ?? 0;\n return withInstanceNamespace(\n `${MARKDOWN_SLOT_PREFIX}-${kind}-${startLine}-${index}`,\n options\n );\n}\n\n/**\n * Drops attributes DOMPurify considers unsafe (event handlers, `javascript:`\n * URLs, etc.) from a plain attr object. Used both for the parsed token attrs\n * and for attributes a consumer `link`/`image` renderer merges in — the latter\n * bypass the token-attr pass, so they must be re-checked here.\n */\nfunction sanitizeAttrs(attrs: Record<string, string>): Record<string, string> {\n return Object.fromEntries(\n Object.entries(attrs).filter(([key, value]) => {\n // Use DOMPurify to check if attribute is safe\n const fragment = DOMPurify.sanitize(`<a ${key}=\"${value}\">`, {\n RETURN_DOM: true,\n });\n const element = fragment.firstChild as Element | null;\n return element?.getAttribute(key) !== null;\n })\n );\n}\n\n/**\n * Concatenates the plain-text content of a node's descendants. A lossy\n * convenience for consumer `link`/`checklist` callbacks that want the visible\n * text; the rich children still render through the normal dispatch.\n */\nfunction extractText(node: TokenTree): string {\n const { token, children } = node;\n if (children && children.length > 0) {\n return children.map(extractText).join('');\n }\n return token.content ?? '';\n}\n\nfunction renderChildTokenTrees(\n children: TokenTree[],\n options: RenderTokenTreeOptions,\n childContext?: RenderTokenTreeOptions['context']\n): TemplateResult {\n const normalizedChildren = combineConsecutiveHtmlInline(\n combineSplitHtmlBlocks(children)\n );\n\n // Multiple or complex children: use repeat for stable keying\n return html`${repeat(\n normalizedChildren,\n (child, index) => {\n // Key by start line + type + tag rather than array index so blocks keep\n // a stable identity when earlier siblings transiently merge/split during\n // streaming re-parses (which would otherwise re-key and remount later\n // blocks — e.g. remounting a code snippet and reloading its editor). We\n // use `token.map?.[0]` (start line, like `slotNameFor`) rather than the\n // node's `key`/`generateKey`, whose embedded end line advances every tick.\n const startLine = child.token.map?.[0] ?? index;\n const stableKey = `${startLine}:${child.token.type}:${child.token.tag}`;\n\n if (child.token.type?.includes('table')) {\n return `table-${stableKey}`;\n }\n\n return `stable-${stableKey}`;\n },\n (child, index) => {\n const result = renderTokenTree(child, {\n ...options,\n context: {\n ...childContext,\n parentChildren: normalizedChildren,\n currentIndex: index,\n },\n });\n // Ensure we never return undefined, which Lit would render as the string \"undefined\"\n return result ?? html``;\n }\n )}`;\n}\n\n/**\n * Top-level entry: renders a markdown token tree to a Lit `TemplateResult`\n * and returns the batch of custom-renderer slot descriptors collected along\n * the way. Callers receive both pieces in one call so the batch can't be\n * accidentally dropped.\n */\nexport function renderMarkdownTree(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): {\n template: TemplateResult;\n batch: MarkdownRendererSlotDescriptor[];\n} {\n const batch: MarkdownRendererSlotDescriptor[] = [];\n let pluginSlotIndex = 0;\n // Memoized per node, not just counted. `renderFallback` runs inside a\n // lit-html `repeat()` callback, so it evaluates when lit-html commits the\n // template — and one render result gets committed again on any later Lit\n // update that leaves `renderedContent` alone. A bare counter would hand the\n // same token a fresh index on each commit, minting a second slot the very\n // next reconcile retires. First evaluation still assigns 0, 1, 2 in walk\n // order, so a single-commit render is unchanged.\n const pluginSlotIndexes = new WeakMap<TokenTree, number>();\n const template = renderTokenTree(node, {\n ...options,\n recordCustomRender: (descriptor) => batch.push(descriptor),\n pluginSlotCounter: {\n next: (forNode: TokenTree) => {\n const existing = pluginSlotIndexes.get(forNode);\n if (existing !== undefined) {\n return existing;\n }\n const index = pluginSlotIndex++;\n pluginSlotIndexes.set(forNode, index);\n return index;\n },\n },\n });\n return { template, batch };\n}\n\n/**\n * Converts TokenTree to Lit TemplateResult.\n *\n * Recursive renderer; external callers should use {@link renderMarkdownTree}\n * which collects the slot-descriptor batch.\n */\nexport function renderTokenTree(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): TemplateResult {\n const { token, children } = node;\n const { context, sanitize } = options;\n\n // Handle raw HTML blocks and inline HTML\n if (token.type === 'html_block' || token.type === 'html_inline') {\n // Plugin-overridden html_block rules (rare but supported) — route through\n // the plugin's renderer before our default unsafeHTML pass-through.\n if (\n token.type === 'html_block' &&\n shouldDelegateToPluginRule(token, options.md) &&\n options.md\n ) {\n return renderFallback(\n token as Token,\n node,\n options.md,\n sanitize,\n options\n );\n }\n\n let content = token.content || '';\n\n // Apply HTML sanitization if requested\n if (sanitize && content) {\n content = sanitizeHtmlContent(content);\n }\n\n return html`${unsafeHTML(content)}`;\n }\n\n // Handle split HTML blocks that wrap markdown siblings (e.g. <details>…</details>).\n if (token.type === 'html_container') {\n const openingHtml = token.content ?? '';\n const innerContent = renderChildTokenTrees(children, options, context);\n\n return html`<div\n class=\"cds-aichat-markdown-html-container\"\n ${htmlContainer(openingHtml, innerContent, sanitize)}></div>`;\n }\n\n // Handle plain text content\n if (token.type === 'text') {\n return html`${token.content}`;\n }\n\n // Hard and soft line breaks. Handled before the tag-based dispatch because\n // hardbreak has tag=\"br\", which `renderWithStaticTag` does not know and would\n // route through the plugin-fallback slot machinery.\n if (token.type === 'hardbreak' || token.type === 'softbreak') {\n return token.type === 'softbreak' && options.md?.options.breaks === false\n ? html`${'\\n'}`\n : html`<br />`;\n }\n\n // Handle inline code spans\n if (token.type === 'code_inline') {\n if (shouldDelegateToPluginRule(token, options.md) && options.md) {\n return renderFallback(\n token as Token,\n node,\n options.md,\n sanitize,\n options\n );\n }\n return html`<code>${token.content}</code>`;\n }\n\n // Handle fenced code blocks\n if (token.type === 'fence') {\n const language = token.info?.trim() ?? '';\n const {\n codeSnippetHighlight = true,\n codeSnippetShowLessText,\n codeSnippetShowMoreText,\n codeSnippetCopyButtonTooltipContent,\n codeSnippetGetLineCountText = defaultLineCountText,\n codeSnippetAriaLabelReadOnly,\n codeSnippetAriaLabelEditable,\n } = options;\n\n const defaultTemplate = html`<cds-aichat-card is-flush>\n <div slot=\"body\">\n <cds-aichat-code-snippet\n data-rounded\n .language=${language}\n .highlight=${codeSnippetHighlight}\n .detectLanguage=${true}\n .showLessText=${codeSnippetShowLessText}\n .showMoreText=${codeSnippetShowMoreText}\n .copyButtonTooltipContent=${codeSnippetCopyButtonTooltipContent}\n .getLineCountText=${codeSnippetGetLineCountText}\n .ariaLabelReadOnly=${codeSnippetAriaLabelReadOnly}\n .ariaLabelEditable=${codeSnippetAriaLabelEditable}\n .code=${token.content}></cds-aichat-code-snippet>\n </div>\n </cds-aichat-card>`;\n\n if (options.customRenderers?.codeBlock) {\n const slotName = slotNameFor('codeBlock', token as Token, options);\n options.recordCustomRender?.({\n slotName,\n kind: 'codeBlock',\n token: token as Token,\n data: {\n language,\n code: token.content ?? '',\n isStreaming: !!options.streaming,\n },\n });\n return html`<slot name=${slotName}>${defaultTemplate}</slot>`;\n }\n\n // Honor user-plugin `fence` overrides (markdown-it-mermaid, syntax\n // highlighters, etc.). customRenderer slot above wins when set.\n if (shouldDelegateToPluginRule(token, options.md) && options.md) {\n return renderFallback(\n token as Token,\n node,\n options.md,\n sanitize,\n options\n );\n }\n\n return defaultTemplate;\n }\n\n // Handle structural elements (paragraphs, headings, lists, etc.)\n const tag = token.tag;\n\n // Convert markdown-it attributes (array of [key, value]) into an object.\n const rawAttrs = (token.attrs || []).reduce(\n (acc, [key, value]) => {\n acc[key] = value;\n return acc;\n },\n {} as Record<string, string>\n );\n\n // Apply attribute sanitization if requested\n let attrs = rawAttrs;\n const isCustomElement = !!token.tag && token.tag.includes('-');\n if (sanitize && !isCustomElement) {\n attrs = sanitizeAttrs(rawAttrs);\n }\n\n // Set up context for child rendering\n let childContext = context;\n if (tag === 'thead') {\n childContext = { ...context, isInThead: true };\n }\n\n // Render child content\n let content: TemplateResult;\n\n if (children.length === 1 && children[0].token.type === 'text') {\n // Optimization: single text child doesn't need repeat wrapper\n content = html`${children[0].token.content}`;\n } else {\n content = renderChildTokenTrees(children, options, childContext);\n }\n\n // Unknown plugin-introduced tokens (no tag we recognize) — defer to\n // markdown-it's renderer so plugins that register md.renderer.rules[type]\n // (footnote, emoji, deflist, container, etc.) just work.\n if (!tag && options.md && !isNativelyHandled(token)) {\n return renderFallback(token as Token, node, options.md, sanitize, options);\n }\n\n // Handle tokens without HTML tags (just return content)\n if (!tag) {\n return content;\n }\n\n // Render the final HTML element with appropriate tag\n return renderWithStaticTag(\n tag,\n token as Token,\n content,\n attrs,\n options,\n childContext,\n node\n );\n}\n\n/**\n * Renders HTML elements with static tag names.\n */\nfunction renderWithStaticTag(\n tag: string,\n token: Token,\n content: TemplateResult,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n _context?: { isInThead?: boolean },\n node?: TokenTree\n): TemplateResult {\n // Handle root token specially\n if (token.type === 'root') {\n return content;\n }\n\n const hasTaskListItems = (listNode?: TokenTree) =>\n !!listNode?.children?.some((child) => {\n if (child.token.type !== 'list_item_open') {\n return false;\n }\n\n const classAttr = child.token.attrs?.find(([key]) => key === 'class');\n return classAttr?.[1]?.split(/\\s+/).includes('task-list-item');\n });\n\n switch (tag) {\n // Basic block elements\n case 'p':\n return html`<p ${spread(attrs)}>${content}</p>`;\n\n case 'blockquote':\n return html`<blockquote ${spread(attrs)}>${content}</blockquote>`;\n\n case 'pre':\n return html`<pre ${spread(attrs)}>${content}</pre>`;\n\n case 'hr':\n return html`<hr ${spread(attrs)} />`;\n\n // Headings\n case 'h1':\n return html`<h1 ${spread(attrs)}>${content}</h1>`;\n case 'h2':\n return html`<h2 ${spread(attrs)}>${content}</h2>`;\n case 'h3':\n return html`<h3 ${spread(attrs)}>${content}</h3>`;\n case 'h4':\n return html`<h4 ${spread(attrs)}>${content}</h4>`;\n case 'h5':\n return html`<h5 ${spread(attrs)}>${content}</h5>`;\n case 'h6':\n return html`<h6 ${spread(attrs)}>${content}</h6>`;\n\n // Lists with Carbon components\n case 'ul': {\n const nested = token.level > 1;\n if (hasTaskListItems(node)) {\n return html`<ul ${spread(attrs)}>\n ${content}\n </ul>`;\n }\n return html`<p>\n <cds-unordered-list ?nested=${nested} ${spread(attrs)}>\n ${content}\n </cds-unordered-list>\n </p>`;\n }\n\n case 'ol': {\n const nested = token.level > 1;\n if (hasTaskListItems(node)) {\n return html`<ol ${spread(attrs)}>\n ${content}\n </ol>`;\n }\n return html`<p>\n <cds-ordered-list native ?nested=${nested} ${spread(attrs)}>\n ${content}\n </cds-ordered-list>\n </p>`;\n }\n\n case 'li': {\n const classList = attrs.class?.split(/\\s+/) ?? [];\n if (classList.includes('task-list-item')) {\n return html`<li ${spread(attrs)}>${content}</li>`;\n }\n return html`<cds-list-item ${spread(attrs)}>${content}</cds-list-item>`;\n }\n\n case 'cds-checkbox': {\n const { checked, disabled, ...otherAttrs } = attrs;\n let isChecked = checked === 'true';\n\n // A configured `checklist` renderer can supply the checked state\n // (so a persisted toggle survives streaming re-renders) and makes the\n // boxes interactive.\n const checklist = options.customRenderers?.checklist;\n if (checklist?.getChecked && node) {\n const override = checklist.getChecked({\n id: otherAttrs['data-cds-aichat-checklist-id'] ?? '',\n label: extractText(node),\n checked: isChecked,\n token,\n });\n if (typeof override === 'boolean') {\n isChecked = override;\n }\n }\n\n const isDisabled = checklist\n ? false\n : disabled === undefined\n ? false\n : disabled === '' || disabled === 'true';\n\n return html`<cds-checkbox\n ?checked=${isChecked}\n ?disabled=${isDisabled}\n ${spread(otherAttrs)}\n >${content}</cds-checkbox\n >`;\n }\n\n // Inline formatting\n case 'strong':\n return html`<strong ${spread(attrs)}>${content}</strong>`;\n case 'em':\n return html`<em ${spread(attrs)}>${content}</em>`;\n case 'code':\n return html`<code ${spread(attrs)}>${content}</code>`;\n case 'del':\n return html`<del ${spread(attrs)}>${content}</del>`;\n case 'sub':\n return html`<sub ${spread(attrs)}>${content}</sub>`;\n case 'sup':\n return html`<sup ${spread(attrs)}>${content}</sup>`;\n case 'span':\n return html`<span ${spread(attrs)}>${content}</span>`;\n case 'i':\n return html`<i ${spread(attrs)}>${content}</i>`;\n case 'b':\n return html`<b ${spread(attrs)}>${content}</b>`;\n case 'small':\n return html`<small ${spread(attrs)}>${content}</small>`;\n case 'mark':\n return html`<mark ${spread(attrs)}>${content}</mark>`;\n case 'ins':\n return html`<ins ${spread(attrs)}>${content}</ins>`;\n case 's':\n return html`<s ${spread(attrs)}>${content}</s>`;\n case 'kbd':\n return html`<kbd ${spread(attrs)}>${content}</kbd>`;\n case 'var':\n return html`<var ${spread(attrs)}>${content}</var>`;\n case 'samp':\n return html`<samp ${spread(attrs)}>${content}</samp>`;\n case 'cite':\n return html`<cite ${spread(attrs)}>${content}</cite>`;\n case 'abbr':\n return html`<abbr ${spread(attrs)}>${content}</abbr>`;\n case 'dfn':\n return html`<dfn ${spread(attrs)}>${content}</dfn>`;\n case 'time':\n return html`<time ${spread(attrs)}>${content}</time>`;\n case 'q':\n return html`<q ${spread(attrs)}>${content}</q>`;\n\n // Links: optional consumer attribute transform, then automatic\n // target=\"_blank\" safety default.\n case 'a': {\n let linkAttrs: Record<string, string> = {\n ...attrs,\n target: attrs.target ?? '_blank',\n };\n\n let onClickHandler: MarkdownRendererLinkResult['onClick'];\n\n const linkRenderer = options.customRenderers?.link;\n\n if (linkRenderer && node) {\n const result = linkRenderer({\n href: attrs.href ?? '',\n title: attrs.title,\n text: extractText(node),\n attributes: { ...attrs },\n token,\n });\n\n if (result) {\n linkAttrs = {\n ...linkAttrs,\n ...(result.attributes ?? {}),\n };\n\n if (result.href !== undefined) {\n linkAttrs.href = result.href;\n }\n if (result.target !== undefined) {\n linkAttrs.target = result.target;\n }\n if (result.rel !== undefined) {\n linkAttrs.rel = result.rel;\n }\n\n // Consumer-supplied attributes are merged after the initial token\n // sanitization pass, so sanitize the final attribute set again.\n if (options.sanitize) {\n linkAttrs = sanitizeAttrs(linkAttrs);\n }\n\n onClickHandler = result.onClick;\n }\n }\n\n return html`<a ${spread(linkAttrs)} @click=${onClickHandler}\n >${content}</a\n >`;\n }\n\n // Self-closing image. A consumer `image` transform wins first (mirroring\n // how `codeBlock` wins over plugin `fence` rules); otherwise\n // plugin-introduced wrappers (e.g. image-figures) route through\n // `shouldDelegateToPluginRule` before falling back to a plain `<img>`.\n case 'img': {\n const imageRenderer = options.customRenderers?.image;\n if (imageRenderer && node) {\n let imgAttrs: Record<string, string> = attrs;\n const result = imageRenderer({\n src: attrs.src ?? '',\n alt: attrs.alt,\n title: attrs.title,\n attributes: { ...attrs },\n token,\n });\n if (result) {\n imgAttrs = { ...attrs, ...(result.attributes ?? {}) };\n if (result.src !== undefined) {\n imgAttrs.src = result.src;\n }\n if (options.sanitize) {\n imgAttrs = sanitizeAttrs(imgAttrs);\n }\n }\n return html`<img ${spread(imgAttrs)} />`;\n }\n if (node && options.md && shouldDelegateToPluginRule(token, options.md)) {\n return renderFallback(\n token,\n node,\n options.md,\n options.sanitize,\n options\n );\n }\n return html`<img ${spread(attrs)} />`;\n }\n\n // Tables with Carbon component and streaming support\n case 'table': {\n if (!node) {\n return html`<div>Error: Missing table data</div>`;\n }\n const slotName = options.customRenderers?.table\n ? slotNameFor('table', token, options)\n : undefined;\n return renderTable(\n token,\n node,\n attrs,\n options,\n renderTokenTree,\n slotName\n );\n }\n\n // Fallback for unknown tags. If we have the markdown-it instance available,\n // defer to its renderer for plugin-introduced container tags (footnote_block,\n // dl/dt/dd from deflist, custom containers, etc.). Otherwise fall back to\n // a generic <div>.\n default:\n if (options.md && node && !isNativelyHandled(token)) {\n return renderFallback(\n token,\n node,\n options.md,\n options.sanitize,\n options\n );\n }\n return html`<div ${spread(attrs)}>${content}</div>`;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;;AAeG;AA0DH;;;;;;;;;;;AAWG;AACH,SAAS,WAAW,CAClB,IAA2B,EAC3B,KAAY,EACZ,OAA+B,EAAA;IAE/B,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,YAAY,IAAI,CAAC;AAChD,IAAA,OAAO,qBAAqB,CAC1B,CAAA,EAAG,oBAAoB,IAAI,IAAI,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EACvD,OAAO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ACA,YAAA,IAAI,IAAI,IAAI,OAAO,CAAC,EAAE,IAAI,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE;AACvE,gBAAA,OAAO,cAAc,CACnB,KAAK,EACL,IAAI,EACJ,OAAO,CAAC,EAAE,EACV,OAAO,CAAC,QAAQ,EAChB,OAAO,CACR;YACH;YACA,OAAO,IAAI,CAAA,CAAA,KAAA,EAAQ,MAAM,CAAC,KAAK,CAAC,KAAK;QACvC;;QAGA,KAAK,OAAO,EAAE;YACZ,IAAI,CAAC,IAAI,EAAE;gBACT,OAAO,IAAI,CAAA,CAAA,oCAAA,CAAsC;YACnD;AACA,YAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,EAAE;kBACtC,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO;kBACnC,SAAS;AACb,YAAA,OAAO,WAAW,CAChB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,eAAe,EACf,QAAQ,CACT;QACH;;;;;AAMA,QAAA;AACE,YAAA,IAAI,OAAO,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;AACnD,gBAAA,OAAO,cAAc,CACnB,KAAK,EACL,IAAI,EACJ,OAAO,CAAC,EAAE,EACV,OAAO,CAAC,QAAQ,EAChB,OAAO,CACR;YACH;YACA,OAAO,IAAI,CAAA,CAAA,KAAA,EAAQ,MAAM,CAAC,KAAK,CAAC,CAAA,CAAA,EAAI,OAAO,CAAA,MAAA,CAAQ;;AAEzD;;"}
1
+ {"version":3,"file":"markdown-renderer.js","sources":["../../../../src/components/markdown/src/markdown-renderer.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Walks a `TokenTree` and emits a Lit `TemplateResult` plus a batch of {@link MarkdownRendererSlotDescriptor} records the markdown element consumes during its `updated()` reconcile. External callers should go through {@link renderMarkdownTree} so the batch isn't accidentally dropped.\n *\n * ### Dispatch precedence\n *\n * Per token, in order:\n *\n * 1. **Consumer override** — `options.customRenderers`. For `table`/`codeBlock` the renderer emits a named `<slot>` placeholder and records a descriptor; the markdown element's `updated()` invokes the consumer callback later. For `link`/`image` the callback runs synchronously here as an attribute transform (no slot, no descriptor); `checklist` adjusts the rendered `cds-checkbox` (its toggles are delivered by a listener on the markdown element).\n * 2. **Plugin-overridden rule** — `shouldDelegateToPluginRule(token, md)` is true when a user-supplied markdown-it plugin overrode the renderer rule for one of the curated leaf tokens in `PLUGIN_DELEGABLE_TOKEN_TYPES` (`fence`, `image`, `code_inline`, `html_block`). The token routes through `renderFallback` and surfaces as a `pluginFallback` descriptor.\n * 3. **Native Lit dispatch** — the hand-written `renderWithStaticTag` switch. Kept flat (rather than a tag-to-renderer map) so the per-tag exceptions — task-list passthrough, Carbon `cds-unordered-list` / `cds-ordered-list` wrappers, automatic `target=\"_blank\"` on `<a>`, image plugin delegation — stay easy to grep.\n * 4. **Unknown plugin-introduced token** — anything not natively handled falls through to `renderFallback`, so plugins that register `md.renderer.rules[type]` (footnote, deflist, custom containers, emoji) just work.\n *\n * ### Slot contract\n *\n * {@link MarkdownRendererSlotDescriptor} (defined in `./markdown-renderer-types.ts`) is the bridge between this module and `./markdown.ts`. This module appends descriptors via `recordCustomRender`; the markdown element's `reconcileCustomRendererHosts` consumes them, invokes consumer callbacks (or adopts plugin-fallback HTML) and attaches the result as a light-DOM `<div slot=\"…\">` host (or `<span>` for inline plugin output).\n */\n\nimport DOMPurify from 'dompurify';\nimport { InlineMarkdownError } from './utils/inline-validation.js';\nimport { html, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { Token } from 'markdown-it';\nimport '@carbon/web-components/es/components/list/index.js';\nimport '@carbon/web-components/es/components/checkbox/index.js';\nimport '../../code-snippet/index.js';\nimport '../../card/index.js';\nimport '../../table/index.js';\nimport { defaultLineCountText } from '../../code-snippet/src/formatters.js';\n\nimport { renderTable } from './utils/table-helpers.js';\nimport {\n projectedInlinePlugin,\n projectInlineRun,\n} from './utils/inline-run-projection.js';\nimport {\n combineConsecutiveHtmlInline,\n combineSplitHtmlBlocks,\n} from './utils/html-helpers.js';\nimport {\n htmlContainer,\n sanitizeHtmlContent,\n spread,\n} from './utils/lit-directives.js';\nimport {\n isNativelyHandled,\n renderFallback,\n shouldDelegateToPluginRule,\n} from './utils/plugin-fallback.js';\nimport {\n MARKDOWN_SLOT_PREFIX,\n withInstanceNamespace,\n} from './utils/slot-names.js';\nimport { type TokenTree } from './markdown-token-tree.js';\nimport type {\n MarkdownRendererLinkResult,\n MarkdownRendererSlotDescriptor,\n RenderTokenTreeOptions,\n} from './markdown-renderer-types.js';\n\n// Re-export types so existing imports of these from this module keep working.\nexport type {\n MarkdownCustomRenderers,\n MarkdownRendererChecklist,\n MarkdownRendererChecklistItemArgs,\n MarkdownRendererChecklistToggleArgs,\n MarkdownRendererCodeBlockArgs,\n MarkdownRendererCodeBlockData,\n MarkdownRendererImageArgs,\n MarkdownRendererImageResult,\n MarkdownRendererLinkArgs,\n MarkdownRendererLinkResult,\n MarkdownRendererSlotDescriptor,\n MarkdownRendererTableArgs,\n MarkdownRendererTableData,\n RenderTokenTreeOptions,\n} from './markdown-renderer-types.js';\n\n/**\n * Slot name for an overridable token — unique across the page, stable across\n * streaming ticks. Three parts:\n *\n * - `startLine` (not the full `token.map`) so the name doesn't change when the\n * token's `endLine` advances during streaming;\n * - `currentIndex` from the parent context, disambiguating siblings that share\n * a start line (rare but possible);\n * - the owning element's namespace, because slot hosts from every markdown\n * element on the page are hoisted into one shared light-DOM container and\n * projected back by name (see `./utils/slot-names.js`).\n */\nfunction slotNameFor(\n kind: 'table' | 'codeBlock',\n token: Token,\n options: RenderTokenTreeOptions\n): string {\n const startLine = token.map?.[0] ?? 0;\n const index = options.context?.currentIndex ?? 0;\n return withInstanceNamespace(\n `${MARKDOWN_SLOT_PREFIX}-${kind}-${startLine}-${index}`,\n options\n );\n}\n\n/**\n * Drops attributes DOMPurify considers unsafe (event handlers, `javascript:`\n * URLs, etc.) from a plain attr object. Used both for the parsed token attrs\n * and for attributes a consumer `link`/`image` renderer merges in — the latter\n * bypass the token-attr pass, so they must be re-checked here.\n */\nfunction sanitizeAttrs(attrs: Record<string, string>): Record<string, string> {\n return Object.fromEntries(\n Object.entries(attrs).filter(([key, value]) => {\n // Use DOMPurify to check if attribute is safe\n const fragment = DOMPurify.sanitize(`<a ${key}=\"${value}\">`, {\n RETURN_DOM: true,\n });\n const element = fragment.firstChild as Element | null;\n return element?.getAttribute(key) !== null;\n })\n );\n}\n\n/**\n * Concatenates the plain-text content of a node's descendants. A lossy\n * convenience for consumer `link`/`checklist` callbacks that want the visible\n * text; the rich children still render through the normal dispatch.\n */\nfunction extractText(node: TokenTree): string {\n const { token, children } = node;\n if (children && children.length > 0) {\n return children.map(extractText).join('');\n }\n return token.content ?? '';\n}\n\nfunction renderChildTokenTrees(\n children: TokenTree[],\n options: RenderTokenTreeOptions,\n childContext?: RenderTokenTreeOptions['context']\n): TemplateResult {\n const normalizedChildren = combineConsecutiveHtmlInline(\n combineSplitHtmlBlocks(children)\n );\n\n if (options.inline) {\n return html`${normalizedChildren.map((child, index) =>\n renderInlineChild(child, {\n ...options,\n context: {\n ...childContext,\n parentChildren: normalizedChildren,\n currentIndex: index,\n },\n })\n )}`;\n }\n\n // Multiple or complex children: use repeat for stable keying\n return html`${repeat(\n normalizedChildren,\n (child, index) => {\n // Key by start line + type + tag rather than array index so blocks keep\n // a stable identity when earlier siblings transiently merge/split during\n // streaming re-parses (which would otherwise re-key and remount later\n // blocks — e.g. remounting a code snippet and reloading its editor). We\n // use `token.map?.[0]` (start line, like `slotNameFor`) rather than the\n // node's `key`/`generateKey`, whose embedded end line advances every tick.\n const startLine = child.token.map?.[0] ?? index;\n const stableKey = `${startLine}:${child.token.type}:${child.token.tag}`;\n\n if (child.token.type?.includes('table')) {\n return `table-${stableKey}`;\n }\n\n return `stable-${stableKey}`;\n },\n (child, index) => {\n const result = renderTokenTree(child, {\n ...options,\n context: {\n ...childContext,\n parentChildren: normalizedChildren,\n currentIndex: index,\n },\n });\n // Ensure we never return undefined, which Lit would render as the string \"undefined\"\n return result ?? html``;\n }\n )}`;\n}\n\n/**\n * An inline child that a plugin owns renders through the plugin's rule alone.\n * Rendering its subtree first would run host callbacks for output the plugin\n * then discards.\n */\nfunction renderInlineChild(\n child: TokenTree,\n options: RenderTokenTreeOptions\n): TemplateResult {\n if (options.md && !isNativelyHandled(child.token)) {\n return renderFallback(\n child.token as Token,\n child,\n options.md,\n options.sanitize,\n options\n );\n }\n return renderTokenTree(child, options);\n}\n\nfunction renderHTMLString(\n content: string,\n options: RenderTokenTreeOptions\n): TemplateResult {\n return options.inline\n ? options.inline.renderHTML(content)\n : html`${unsafeHTML(content)}`;\n}\n\nfunction renderRawHTML(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): TemplateResult {\n const { token } = node;\n const { sanitize } = options;\n // Plugin-overridden html_block rules (rare but supported) — route through\n // the plugin's renderer before our default unsafeHTML pass-through.\n if (\n token.type === 'html_block' &&\n shouldDelegateToPluginRule(token, options.md) &&\n options.md\n ) {\n return renderFallback(token as Token, node, options.md, sanitize, options);\n }\n\n let content = token.content || '';\n\n // Apply HTML sanitization if requested\n if (sanitize && content) {\n content = sanitizeHtmlContent(content);\n }\n\n return renderHTMLString(content, options);\n}\n\nfunction containsInlinePlugin(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): boolean {\n if (!options.md || (node.token.block && node.token.type !== 'inline')) {\n return false;\n }\n if (!isNativelyHandled(node.token)) {\n return true;\n }\n if (\n shouldDelegateToPluginRule(node.token, options.md) &&\n !(node.token.tag === 'img' && options.customRenderers?.image)\n ) {\n return true;\n }\n return node.children.some((child) => containsInlinePlugin(child, options));\n}\n\nfunction canProjectInlineRun({ token, children }: TokenTree): boolean {\n if (\n (token.block && token.type !== 'inline') ||\n token.tag?.includes('-') ||\n ['input', 'button', 'select', 'textarea'].includes(token.tag ?? '') ||\n ['html_inline', 'html_block', 'html_container'].includes(token.type ?? '')\n ) {\n return false;\n }\n return children.every(canProjectInlineRun);\n}\n\nfunction shouldProjectInlineRun(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): boolean {\n return (\n node.token.type === 'inline' &&\n !options.inline &&\n canProjectInlineRun(node) &&\n containsInlinePlugin(node, options)\n );\n}\n\nfunction renderProjectedInlineRun(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): TemplateResult {\n const cached = options.preparedInlineRuns?.get(node);\n if (cached) {\n return cached;\n }\n let hasPlugin = false;\n const content = renderChildTokenTrees(\n node.children,\n {\n ...options,\n inline: {\n validateAttributes: () => {},\n renderHTML: (markup, pluginToken) => {\n if (!pluginToken) {\n return html`${unsafeHTML(markup)}`;\n }\n hasPlugin = true;\n return html`${projectedInlinePlugin(\n markup,\n pluginToken.content || markup.replace(/<[^>]*>/g, '')\n )}`;\n },\n },\n },\n options.context\n );\n const index = options.pluginSlotCounter?.next(node) ?? 0;\n const slotName = withInstanceNamespace(\n `${MARKDOWN_SLOT_PREFIX}-pluginFallback-${index}`,\n options\n );\n const result = hasPlugin\n ? projectInlineRun(content, {\n slotName,\n fallbackHost: options.projectionHost,\n resetInlineStyles: true,\n })\n : content;\n options.preparedInlineRuns?.set(node, result);\n return result;\n}\n\n/** The token's attributes as an object, sanitized and checked as requested. */\nfunction resolveAttrs(\n token: TokenTree['token'],\n options: RenderTokenTreeOptions\n): Record<string, string> {\n const rawAttrs = Object.fromEntries(token.attrs || []);\n const isCustomElement = !!token.tag && token.tag.includes('-');\n const attrs =\n options.sanitize && !isCustomElement ? sanitizeAttrs(rawAttrs) : rawAttrs;\n validateInlineAttributes(attrs, options);\n return attrs;\n}\n\nfunction validateInlineAttributes(\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions\n) {\n options.inline?.validateAttributes(attrs);\n}\n\nfunction rejectInlineBlock(tag: string, options: RenderTokenTreeOptions) {\n if (options.inline) {\n throw new InlineMarkdownError(\n 'non-inline-output',\n `renderInlineMarkdown cannot render the native token tag \"${tag}\" inline.`\n );\n }\n}\n\n/**\n * Top-level entry: renders a markdown token tree to a Lit `TemplateResult`\n * and returns the batch of custom-renderer slot descriptors collected along\n * the way. Callers receive both pieces in one call so the batch can't be\n * accidentally dropped.\n */\nexport function renderMarkdownTree(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): {\n template: TemplateResult;\n batch: MarkdownRendererSlotDescriptor[];\n} {\n const batch: MarkdownRendererSlotDescriptor[] = [];\n let pluginSlotIndex = 0;\n // Memoized per node, not just counted. `renderFallback` runs inside a\n // lit-html `repeat()` callback, so it evaluates when lit-html commits the\n // template — and one render result gets committed again on any later Lit\n // update that leaves `renderedContent` alone. A bare counter would hand the\n // same token a fresh index on each commit, minting a second slot the very\n // next reconcile retires. First evaluation still assigns 0, 1, 2 in walk\n // order, so a single-commit render is unchanged.\n const pluginSlotIndexes = new WeakMap<TokenTree, number>();\n const template = renderTokenTree(node, {\n ...options,\n preparedInlineRuns: new WeakMap(),\n recordCustomRender: (descriptor) => batch.push(descriptor),\n pluginSlotCounter: {\n next: (forNode: TokenTree) => {\n const existing = pluginSlotIndexes.get(forNode);\n if (existing !== undefined) {\n return existing;\n }\n const index = pluginSlotIndex++;\n pluginSlotIndexes.set(forNode, index);\n return index;\n },\n },\n });\n return { template, batch };\n}\n\n/**\n * Converts TokenTree to Lit TemplateResult.\n *\n * Recursive renderer; external callers should use {@link renderMarkdownTree}\n * which collects the slot-descriptor batch.\n */\nexport function renderTokenTree(\n node: TokenTree,\n options: RenderTokenTreeOptions\n): TemplateResult {\n const { token, children } = node;\n const { context, sanitize } = options;\n\n // Keep adjacent native text and plugin output in one DOM selection tree.\n if (shouldProjectInlineRun(node, options)) {\n return renderProjectedInlineRun(node, options);\n }\n\n // Handle raw HTML blocks and inline HTML\n if (token.type === 'html_block' || token.type === 'html_inline') {\n return renderRawHTML(node, options);\n }\n\n // Handle split HTML blocks that wrap markdown siblings (e.g. <details>…</details>).\n if (token.type === 'html_container') {\n const openingHtml = token.content ?? '';\n const innerContent = renderChildTokenTrees(children, options, context);\n\n return html`<div\n class=\"cds-aichat-markdown-html-container\"\n ${htmlContainer(openingHtml, innerContent, sanitize)}></div>`;\n }\n\n // Handle plain text content\n if (token.type === 'text') {\n return html`${token.content}`;\n }\n\n // Hard and soft line breaks. Handled before the tag-based dispatch because\n // hardbreak has tag=\"br\", which `renderWithStaticTag` does not know and would\n // route through the plugin-fallback slot machinery.\n if (token.type === 'hardbreak' || token.type === 'softbreak') {\n return token.type === 'softbreak' && options.md?.options.breaks === false\n ? html`${'\\n'}`\n : html`<br />`;\n }\n\n // Handle inline code spans\n if (token.type === 'code_inline') {\n if (shouldDelegateToPluginRule(token, options.md) && options.md) {\n return renderFallback(\n token as Token,\n node,\n options.md,\n sanitize,\n options\n );\n }\n return html`<code>${token.content}</code>`;\n }\n\n // Handle fenced code blocks\n if (token.type === 'fence') {\n const language = token.info?.trim() ?? '';\n const {\n codeSnippetHighlight = true,\n codeSnippetShowLessText,\n codeSnippetShowMoreText,\n codeSnippetCopyButtonTooltipContent,\n codeSnippetGetLineCountText = defaultLineCountText,\n codeSnippetAriaLabelReadOnly,\n codeSnippetAriaLabelEditable,\n } = options;\n\n const defaultTemplate = html`<cds-aichat-card is-flush>\n <div slot=\"body\">\n <cds-aichat-code-snippet\n data-rounded\n .language=${language}\n .highlight=${codeSnippetHighlight}\n .detectLanguage=${true}\n .showLessText=${codeSnippetShowLessText}\n .showMoreText=${codeSnippetShowMoreText}\n .copyButtonTooltipContent=${codeSnippetCopyButtonTooltipContent}\n .getLineCountText=${codeSnippetGetLineCountText}\n .ariaLabelReadOnly=${codeSnippetAriaLabelReadOnly}\n .ariaLabelEditable=${codeSnippetAriaLabelEditable}\n .code=${token.content}></cds-aichat-code-snippet>\n </div>\n </cds-aichat-card>`;\n\n if (options.customRenderers?.codeBlock) {\n const slotName = slotNameFor('codeBlock', token as Token, options);\n options.recordCustomRender?.({\n slotName,\n kind: 'codeBlock',\n token: token as Token,\n data: {\n language,\n code: token.content ?? '',\n isStreaming: !!options.streaming,\n },\n });\n return html`<slot name=${slotName}>${defaultTemplate}</slot>`;\n }\n\n // Honor user-plugin `fence` overrides (markdown-it-mermaid, syntax\n // highlighters, etc.). customRenderer slot above wins when set.\n if (shouldDelegateToPluginRule(token, options.md) && options.md) {\n return renderFallback(\n token as Token,\n node,\n options.md,\n sanitize,\n options\n );\n }\n\n return defaultTemplate;\n }\n\n // Handle structural elements (paragraphs, headings, lists, etc.)\n const tag = token.tag;\n\n const attrs = resolveAttrs(token, options);\n\n // Set up context for child rendering\n let childContext = context;\n if (tag === 'thead') {\n childContext = { ...context, isInThead: true };\n }\n\n // Render child content\n let content: TemplateResult;\n\n if (children.length === 1 && children[0].token.type === 'text') {\n // Optimization: single text child doesn't need repeat wrapper\n content = html`${children[0].token.content}`;\n } else {\n content = renderChildTokenTrees(children, options, childContext);\n }\n\n // Unknown plugin-introduced tokens (no tag we recognize) — defer to\n // markdown-it's renderer so plugins that register md.renderer.rules[type]\n // (footnote, emoji, deflist, container, etc.) just work.\n if (!tag && options.md && !isNativelyHandled(token)) {\n return renderFallback(token as Token, node, options.md, sanitize, options);\n }\n\n // Handle tokens without HTML tags (just return content)\n if (!tag) {\n return content;\n }\n\n // Render the final HTML element with appropriate tag\n return renderWithStaticTag(\n tag,\n token as Token,\n content,\n attrs,\n options,\n childContext,\n node\n );\n}\n\n/**\n * Renders HTML elements with static tag names.\n */\nfunction renderWithStaticTag(\n tag: string,\n token: Token,\n content: TemplateResult,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n _context?: { isInThead?: boolean },\n node?: TokenTree\n): TemplateResult {\n // Handle root token specially\n if (token.type === 'root') {\n return content;\n }\n\n const hasTaskListItems = (listNode?: TokenTree) =>\n !!listNode?.children?.some((child) => {\n if (child.token.type !== 'list_item_open') {\n return false;\n }\n\n const classAttr = child.token.attrs?.find(([key]) => key === 'class');\n return classAttr?.[1]?.split(/\\s+/).includes('task-list-item');\n });\n\n switch (tag) {\n // Basic block elements\n case 'p':\n return html`<p ${spread(attrs)}>${content}</p>`;\n\n case 'blockquote':\n return html`<blockquote ${spread(attrs)}>${content}</blockquote>`;\n\n case 'pre':\n return html`<pre ${spread(attrs)}>${content}</pre>`;\n\n case 'hr':\n return html`<hr ${spread(attrs)} />`;\n\n // Headings\n case 'h1':\n return html`<h1 ${spread(attrs)}>${content}</h1>`;\n case 'h2':\n return html`<h2 ${spread(attrs)}>${content}</h2>`;\n case 'h3':\n return html`<h3 ${spread(attrs)}>${content}</h3>`;\n case 'h4':\n return html`<h4 ${spread(attrs)}>${content}</h4>`;\n case 'h5':\n return html`<h5 ${spread(attrs)}>${content}</h5>`;\n case 'h6':\n return html`<h6 ${spread(attrs)}>${content}</h6>`;\n\n // Lists with Carbon components\n case 'ul': {\n const nested = token.level > 1;\n if (hasTaskListItems(node)) {\n return html`<ul ${spread(attrs)}>\n ${content}\n </ul>`;\n }\n return html`<p>\n <cds-unordered-list ?nested=${nested} ${spread(attrs)}>\n ${content}\n </cds-unordered-list>\n </p>`;\n }\n\n case 'ol': {\n const nested = token.level > 1;\n if (hasTaskListItems(node)) {\n return html`<ol ${spread(attrs)}>\n ${content}\n </ol>`;\n }\n return html`<p>\n <cds-ordered-list native ?nested=${nested} ${spread(attrs)}>\n ${content}\n </cds-ordered-list>\n </p>`;\n }\n\n case 'li': {\n const classList = attrs.class?.split(/\\s+/) ?? [];\n if (classList.includes('task-list-item')) {\n return html`<li ${spread(attrs)}>${content}</li>`;\n }\n return html`<cds-list-item ${spread(attrs)}>${content}</cds-list-item>`;\n }\n\n case 'cds-checkbox': {\n const { checked, disabled, ...otherAttrs } = attrs;\n let isChecked = checked === 'true';\n\n // A configured `checklist` renderer can supply the checked state\n // (so a persisted toggle survives streaming re-renders) and makes the\n // boxes interactive.\n const checklist = options.customRenderers?.checklist;\n if (checklist?.getChecked && node) {\n const override = checklist.getChecked({\n id: otherAttrs['data-cds-aichat-checklist-id'] ?? '',\n label: extractText(node),\n checked: isChecked,\n token,\n });\n if (typeof override === 'boolean') {\n isChecked = override;\n }\n }\n\n const isDisabled = checklist\n ? false\n : disabled === undefined\n ? false\n : disabled === '' || disabled === 'true';\n\n return html`<cds-checkbox\n ?checked=${isChecked}\n ?disabled=${isDisabled}\n ${spread(otherAttrs)}\n >${content}</cds-checkbox\n >`;\n }\n\n // Inline formatting\n case 'strong':\n return html`<strong ${spread(attrs)}>${content}</strong>`;\n case 'em':\n return html`<em ${spread(attrs)}>${content}</em>`;\n case 'code':\n return html`<code ${spread(attrs)}>${content}</code>`;\n case 'del':\n return html`<del ${spread(attrs)}>${content}</del>`;\n case 'sub':\n return html`<sub ${spread(attrs)}>${content}</sub>`;\n case 'sup':\n return html`<sup ${spread(attrs)}>${content}</sup>`;\n case 'span':\n return html`<span ${spread(attrs)}>${content}</span>`;\n case 'i':\n return html`<i ${spread(attrs)}>${content}</i>`;\n case 'b':\n return html`<b ${spread(attrs)}>${content}</b>`;\n case 'small':\n return html`<small ${spread(attrs)}>${content}</small>`;\n case 'mark':\n return html`<mark ${spread(attrs)}>${content}</mark>`;\n case 'ins':\n return html`<ins ${spread(attrs)}>${content}</ins>`;\n case 's':\n return html`<s ${spread(attrs)}>${content}</s>`;\n case 'kbd':\n return html`<kbd ${spread(attrs)}>${content}</kbd>`;\n case 'var':\n return html`<var ${spread(attrs)}>${content}</var>`;\n case 'samp':\n return html`<samp ${spread(attrs)}>${content}</samp>`;\n case 'cite':\n return html`<cite ${spread(attrs)}>${content}</cite>`;\n case 'abbr':\n return html`<abbr ${spread(attrs)}>${content}</abbr>`;\n case 'dfn':\n return html`<dfn ${spread(attrs)}>${content}</dfn>`;\n case 'time':\n return html`<time ${spread(attrs)}>${content}</time>`;\n case 'q':\n return html`<q ${spread(attrs)}>${content}</q>`;\n\n // Links: optional consumer attribute transform, then automatic\n // target=\"_blank\" safety default.\n case 'a': {\n let linkAttrs: Record<string, string> = {\n ...attrs,\n target: attrs.target ?? '_blank',\n };\n\n let onClickHandler: MarkdownRendererLinkResult['onClick'];\n\n const linkRenderer = options.customRenderers?.link;\n\n if (linkRenderer && node) {\n const result = linkRenderer({\n href: attrs.href ?? '',\n title: attrs.title,\n text: extractText(node),\n attributes: { ...attrs },\n token,\n });\n\n if (result) {\n linkAttrs = {\n ...linkAttrs,\n ...(result.attributes ?? {}),\n };\n\n if (result.href !== undefined) {\n linkAttrs.href = result.href;\n }\n if (result.target !== undefined) {\n linkAttrs.target = result.target;\n }\n if (result.rel !== undefined) {\n linkAttrs.rel = result.rel;\n }\n\n // Consumer-supplied attributes are merged after the initial token\n // sanitization pass, so sanitize the final attribute set again.\n if (options.sanitize) {\n linkAttrs = sanitizeAttrs(linkAttrs);\n }\n\n onClickHandler = result.onClick;\n }\n }\n\n validateInlineAttributes(linkAttrs, options);\n return html`<a ${spread(linkAttrs)} @click=${onClickHandler}\n >${content}</a\n >`;\n }\n\n // Self-closing image. A consumer `image` transform wins first (mirroring\n // how `codeBlock` wins over plugin `fence` rules); otherwise\n // plugin-introduced wrappers (e.g. image-figures) route through\n // `shouldDelegateToPluginRule` before falling back to a plain `<img>`.\n case 'img': {\n const imageRenderer = options.customRenderers?.image;\n if (imageRenderer && node) {\n let imgAttrs: Record<string, string> = attrs;\n const result = imageRenderer({\n src: attrs.src ?? '',\n alt: attrs.alt,\n title: attrs.title,\n attributes: { ...attrs },\n token,\n });\n if (result) {\n imgAttrs = { ...attrs, ...(result.attributes ?? {}) };\n if (result.src !== undefined) {\n imgAttrs.src = result.src;\n }\n if (options.sanitize) {\n imgAttrs = sanitizeAttrs(imgAttrs);\n }\n }\n validateInlineAttributes(imgAttrs, options);\n return html`<img ${spread(imgAttrs)} />`;\n }\n if (node && options.md && shouldDelegateToPluginRule(token, options.md)) {\n return renderFallback(\n token,\n node,\n options.md,\n options.sanitize,\n options\n );\n }\n return html`<img ${spread(attrs)} />`;\n }\n\n // Tables with Carbon component and streaming support\n case 'table': {\n if (!node) {\n return html`<div>Error: Missing table data</div>`;\n }\n const slotName = options.customRenderers?.table\n ? slotNameFor('table', token, options)\n : undefined;\n return renderTable(\n token,\n node,\n attrs,\n options,\n renderTokenTree,\n slotName\n );\n }\n\n // Fallback for unknown tags. If we have the markdown-it instance available,\n // defer to its renderer for plugin-introduced container tags (footnote_block,\n // dl/dt/dd from deflist, custom containers, etc.). Otherwise fall back to\n // a generic <div>.\n default:\n if (options.md && node && !isNativelyHandled(token)) {\n return renderFallback(\n token,\n node,\n options.md,\n options.sanitize,\n options\n );\n }\n rejectInlineBlock(tag, options);\n return html`<div ${spread(attrs)}>${content}</div>`;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;;AAeG;AA+DH;;;;;;;;;;;AAWG;AACH,SAAS,WAAW,CAClB,IAA2B,EAC3B,KAAY,EACZ,OAA+B,EAAA;IAE/B,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,YAAY,IAAI,CAAC;AAChD,IAAA,OAAO,qBAAqB,CAC1B,CAAA,EAAG,oBAAoB,IAAI,IAAI,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EACvD,OAAO,CACR;AACH;AAEA;;;;;AAKG;AACH,SAAS,aAAa,CAAC,KAA6B,EAAA;IAClD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;;QAE5C,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA,GAAA,EAAM,GAAG,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YACH;AACA,YAAA,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC;YAC/B,OAAO,IAAI,CAAA,CAAA,KAAA,EAAQ,MAAM,CAAC,KAAK,CAAC,CAAA,CAAA,EAAI,OAAO,CAAA,MAAA,CAAQ;;AAEzD;;"}
@@ -354,6 +354,7 @@ let CDSAIChatMarkdown = class CDSAIChatMarkdown extends LitElement {
354
354
  // Custom-renderer hooks
355
355
  customRenderers: this.customRenderers,
356
356
  slotNamespace: this.slotNamespace,
357
+ projectionHost: this,
357
358
  md: this.markdownItInstance,
358
359
  });
359
360
  this.renderedContent = template;
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.js","sources":["../../../../src/components/markdown/src/markdown.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { html, LitElement, PropertyValues, TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './markdown.scss?lit';\nimport throttle from 'lodash-es/throttle.js';\nimport { IS_PHONE } from '../../../globals/utils/browser-utils.js';\n\nimport MarkdownIt from 'markdown-it';\n\nimport {\n markdownToTokenTree,\n type MarkdownItPlugin,\n type TokenTree,\n} from './markdown-token-tree.js';\nimport type {\n MarkdownCustomRendererMountDetail,\n MarkdownPluginFallbackMountDetail,\n} from './utils/plugin-host-container.js';\nimport {\n renderMarkdownTree,\n type MarkdownCustomRenderers,\n type MarkdownRendererSlotDescriptor,\n} from './markdown-renderer.js';\nimport {\n hasLikelyPartialTableTail,\n hasNodeAfterTable,\n hasTrailingTableToken,\n} from './utils/streaming-table.js';\nimport { nextMarkdownInstanceId } from './utils/slot-names.js';\n\nconst CONSOLE_PREFIX = '[carbon-ai-chat-components]';\n\n/**\n * True if `node` is inside (or is) a light-DOM element with a `slot` attribute\n * set, up to (but not including) `boundary`. Portal hosts mounted by consumers\n * carry a `slot` attribute, so this is used to skip both `textContent`\n * contributions and observed mutations that originated inside a portal subtree.\n */\nfunction isInsidePortalHost(node: Node, boundary: Node): boolean {\n let cur: Node | null = node;\n while (cur && cur !== boundary) {\n if (cur instanceof Element && cur.hasAttribute('slot')) {\n return true;\n }\n cur = cur.parentNode;\n }\n return false;\n}\n\n/**\n * Concatenates the markdown source from `element`'s light-DOM children,\n * skipping any `<element slot=\"…\">` portal hosts so consumer-rendered overrides\n * don't contaminate the parsed markdown source.\n */\nfunction readLightDomMarkdownSource(element: Element): string {\n let out = '';\n for (const child of Array.from(element.childNodes)) {\n if (child instanceof Element && child.hasAttribute('slot')) {\n continue;\n }\n if (child.nodeType === Node.TEXT_NODE) {\n out += child.nodeValue ?? '';\n } else if (child instanceof Element) {\n out += child.textContent ?? '';\n }\n }\n return out.trim();\n}\n\n/**\n * Renders markdown as Carbon-styled DOM. Streaming-friendly: incremental updates reparse the markdown source into a `TokenTree`, diff it against the prior tree to reuse stable subtrees, then walk it into a Lit `TemplateResult` — Lit's `repeat` directive keys off the diffed nodes so unchanged DOM stays put.\n *\n * ### Lifecycle\n *\n * 1. A property setter (or a light-DOM mutation) lands. `willUpdate` decides whether the change requires a reparse (`markdown`, `removeHTML`, `markdownItPlugins`) or only a re-render (translated strings, `streaming`, `sanitizeHTML`, `customRenderers`).\n * 2. `scheduleRender` throttles bursts to 100ms (leading + trailing).\n * 3. `renderMarkdown` parses (if needed) via {@link markdownToTokenTree}, then calls {@link renderMarkdownTree} to produce both a `TemplateResult` and a batch of {@link MarkdownRendererSlotDescriptor} records.\n * 4. After Lit commits, `updated()` runs `reconcileCustomRendererHosts` — that is where consumer-supplied `customRenderers` callbacks fire and plugin-fallback HTML is adopted into light-DOM slot hosts.\n *\n * ### Extensibility\n *\n * - {@link markdownItPlugins} runs after the built-in markdown-it plugins (markdown-it-attrs, highlight, task-lists). A new array identity rebuilds the markdown-it instance and forces a full reparse. Tokens introduced by a plugin that the native dispatch can't handle — either an unknown tag, or a plugin-overridden rule on a curated allow-list of leaf tokens — route through `md.renderer.render()` via `./utils/plugin-fallback.ts` and surface as `pluginFallback` descriptors. Their rendered HTML is adopted into a light-DOM slot host so consumer-supplied CSS (e.g. a KaTeX stylesheet on the host page) reaches it.\n * - {@link customRenderers} overrides per-element rendering for `table` and `codeBlock`. The renderer emits a named `<slot>` placeholder; the reconciler invokes the consumer's callback with the parsed data and appends the returned `HTMLElement` as a `<div slot=\"…\">` light-DOM child. Returning the same element reference across renders avoids DOM churn.\n *\n * ### Light-DOM source adoption\n *\n * When the `markdown` property has never been set explicitly, the element treats its light-DOM text content as the initial source and watches for further mutations via a `MutationObserver`. Setting the property explicitly stops the observer — the property is then the authoritative source.\n *\n * ### Related files\n *\n * - `./markdown-token-tree.ts` — markdown-it parse + tree builder + streaming-aware diff (with `cachedHtml` carry-forward for plugin-delegated tokens).\n * - `./markdown-renderer.ts` — `TokenTree` → Lit `TemplateResult`, plus descriptor collection.\n * - `./markdown-renderer-types.ts` — public ({@link MarkdownCustomRenderers}) and internal ({@link MarkdownRendererSlotDescriptor}, `RenderTokenTreeOptions`) contracts.\n * - `./utils/plugin-fallback.ts` — delegation to `md.renderer.render()` for plugin-introduced tokens.\n * - `./utils/streaming-table.ts` — heuristics that hold a streaming table in a skeleton \"loading\" state until its tail stabilizes.\n *\n * @element cds-aichat-markdown\n */\n@carbonElement(`${prefix}-markdown`)\nclass CDSAIChatMarkdown extends LitElement {\n static styles = [commonStyles, styles];\n\n /**\n * Sanitize any HTML included in the markdown. e.g. remove script tags, onclick handlers, etc.\n */\n @property({ type: Boolean, attribute: 'sanitize-html' })\n sanitizeHTML = false;\n\n /**\n * Remove all HTML from included markdown.\n */\n @property({ type: Boolean, attribute: 'remove-html' })\n removeHTML = false;\n\n /**\n * Internal storage for markdown content.\n * @internal\n */\n private _markdown = '';\n\n /**\n * Flag to temporarily allow internal markdown updates without marking as explicitly set.\n * @internal\n */\n private isInternalMarkdownUpdate = false;\n\n /**\n * Direct markdown source input.\n */\n @property({ type: String })\n get markdown(): string {\n return this._markdown;\n }\n set markdown(value: string) {\n const oldValue = this._markdown;\n this._markdown = value;\n\n // Track that markdown was explicitly set (not from Light DOM adoption)\n // Only mark as explicitly set if this is NOT an internal update\n if (!this.isInternalMarkdownUpdate) {\n this.markdownPropertyExplicitlySet = true;\n this.stopObservingLightDom();\n }\n\n this.requestUpdate('markdown', oldValue);\n }\n\n /**\n * If you are actively streaming, setting this to true can help prevent needless UI thrashing when writing\n * complex components (like a sortable and filterable table).\n */\n @property({ type: Boolean, attribute: 'streaming' })\n streaming = false;\n\n // Code snippet properties\n /** Enable syntax highlighting for any code fence blocks. */\n @property({ type: Boolean, attribute: 'code-snippet-highlight' })\n codeSnippetHighlight = true;\n\n /** Label for collapsing long code blocks. */\n @property({ type: String, attribute: 'code-snippet-show-less-text' })\n codeSnippetShowLessText = 'Show less';\n\n /** Label for expanding long code blocks. */\n @property({ type: String, attribute: 'code-snippet-show-more-text' })\n codeSnippetShowMoreText = 'Show more';\n\n /** Tooltip content for the copy action on code blocks. */\n @property({\n type: String,\n attribute: 'code-snippet-copy-button-tooltip-content',\n })\n codeSnippetCopyButtonTooltipContent = 'Copy code';\n\n /** Formatter for the code block line count. */\n @property({ type: Object, attribute: false })\n codeSnippetGetLineCountText?: ({ count }: { count: number }) => string;\n\n /** Aria-label for code snippets when in read-only mode. */\n @property({ type: String, attribute: 'code-snippet-aria-label-readonly' })\n codeSnippetAriaLabelReadOnly = 'Code snippet';\n\n /** Aria-label for code snippets when in editable mode. */\n @property({ type: String, attribute: 'code-snippet-aria-label-editable' })\n codeSnippetAriaLabelEditable = 'Code editor';\n\n // Table properties\n /** Placeholder text for table filters. */\n @property({ type: String, attribute: 'table-filter-placeholder-text' })\n tableFilterPlaceholderText = 'Filter table...';\n\n /** Label for the previous page control in tables. */\n @property({ type: String, attribute: 'table-previous-page-text' })\n tablePreviousPageText = 'Previous page';\n\n /** Label for the next page control in tables. */\n @property({ type: String, attribute: 'table-next-page-text' })\n tableNextPageText = 'Next page';\n\n /** Label for the items-per-page control in tables. */\n @property({ type: String, attribute: 'table-items-per-page-text' })\n tableItemsPerPageText = 'Items per page:';\n\n /** Label for download of CSV of table data. */\n @property({ type: String, attribute: 'table-download-label-text' })\n tableDownloadLabelText = 'Download table data';\n\n /** Locale used for table pagination and formatting. */\n @property({ type: String, attribute: 'table-locale' })\n tableLocale = 'en';\n\n /** Optional formatter for supplemental pagination text. */\n @property({ type: Object, attribute: false })\n tableGetPaginationSupplementalText?: ({ count }: { count: number }) => string;\n\n /** Optional formatter for pagination status text. */\n @property({ type: Object, attribute: false })\n tableGetPaginationStatusText?: ({\n start,\n end,\n count,\n }: {\n start: number;\n end: number;\n count: number;\n }) => string;\n\n /**\n * Markdown-it plugins applied after the built-in plugins\n * (markdown-it-attrs, markdown-it-highlight, markdown-it-task-lists).\n * Changes force a reparse. Memoize this array — a new reference each render\n * rebuilds the markdown-it instance.\n */\n @property({ type: Array, attribute: false })\n markdownItPlugins?: MarkdownItPlugin[];\n\n /**\n * Per-element render overrides. For each `kind` whose callback is provided,\n * the markdown element emits a named `<slot>` placeholder in its shadow\n * DOM, then — after each render — invokes the callback with the parsed\n * data and adopts the returned `HTMLElement` as a `<div slot=\"…\">`\n * light-DOM child of this element. Return `null` to fall back to the\n * default Carbon rendering. Returning the same element reference across\n * renders avoids DOM churn.\n *\n * Inside a chat, a container relocates the returned element into its own\n * light DOM — page DOM at the top of the chain — and this element forwards\n * it back into the named slot, so consumer-loaded page CSS reaches it.\n * Standalone (no chat ancestor), it stays a light-DOM child of this element.\n */\n @property({ attribute: false })\n customRenderers?: MarkdownCustomRenderers;\n\n /**\n * Descriptors collected during the most recent render task; consumed by\n * the `updated()` reconcile to invoke {@link customRenderers} callbacks.\n * @internal\n */\n private latestRendererDescriptors: MarkdownRendererSlotDescriptor[] = [];\n\n /**\n * Light-DOM slot hosts adopted on behalf of {@link customRenderers}, keyed\n * by slot name. Reused across renders for stable identity.\n * @internal\n */\n private slotHosts: Map<string, HTMLElement> = new Map();\n\n /**\n * `<slot name=X slot=X>` forwarders minted for {@link customRenderers} hosts\n * an outer listener relocated into its own light DOM, keyed by slot name.\n *\n * Appended imperatively rather than rendered: Lit commits into the shadow\n * root, and this hop has to be a light-DOM child of this element to gather\n * the relocated host out of the chat element's light DOM and hand it to the\n * shadow `<slot>` the renderer emitted. Minted where the claim is read\n * rather than by a subscriber, because the mount event fires once per host\n * and is never replayed — a listener that subscribes later cannot mint it.\n * @internal\n */\n private rendererForwarders: Map<string, HTMLSlotElement> = new Map();\n\n /**\n * Namespace appended to every slot name this element mints, so two markdown\n * elements rendering identical markdown never collide in the shared\n * page-level host container a chat container hoists slot hosts into.\n *\n * Assigned in the field initializer (construction) rather than\n * `connectedCallback`, which runs again after a DOM move — the namespace, and\n * therefore every slot name and every adopted host, must survive a\n * disconnect/reconnect.\n * @internal\n */\n private readonly slotNamespace = nextMarkdownInstanceId();\n\n /**\n * Slot names whose host was created by an outer listener (a chat container\n * that called `preventDefault()` on the host-mount event). We track these so\n * we can fire matching unmount events without trying to remove a host we\n * never appended.\n * @internal\n */\n private delegatedPluginSlots: Set<string> = new Set();\n\n /**\n * The markdown-it instance produced by the most recent parse. Forwarded into\n * the renderer so unknown tokens can fall back to `md.renderer.render()`.\n * @internal\n */\n private markdownItInstance?: MarkdownIt;\n\n /**\n * @internal\n */\n private needsReparse = false;\n\n /**\n * Tracks the latest asynchronous rendering work so callers waiting on `updateComplete` know when throttled updates are done.\n *\n * @internal\n */\n private renderTask: Promise<void> | null = null;\n\n private hasRenderedStreamingTableLoadingFrame = false;\n /**\n * The most recent tree parsed while in streaming table loading mode, held back\n * from rendering. It seeds `previousTreeForDiff`, so the tick that leaves loading\n * mode without a reparse still renders the content staged during it.\n * @internal\n */\n private stagedStreamingTokenTree: TokenTree | null = null;\n\n /**\n * @internal\n */\n private isStreamingTableLoadingMode = false;\n\n /**\n * @internal\n */\n private hasConnected = false;\n\n /**\n * Tracks whether the markdown property has been explicitly set by the user.\n * When false, the component will monitor Light DOM changes.\n * @internal\n */\n private markdownPropertyExplicitlySet = false;\n\n /**\n * MutationObserver to monitor Light DOM changes when markdown property isn't explicitly set.\n * @internal\n */\n private lightDomObserver: MutationObserver | null = null;\n\n /**\n * Generation counter for Light DOM mutation processing. Incremented when a\n * mutation is observed and decremented when the resulting microtask\n * completes. `updateComplete` waits while the counter is non-zero.\n * @internal\n */\n private pendingLightDomMutations = 0;\n\n connectedCallback() {\n super.connectedCallback();\n this.hasConnected = true;\n\n if (IS_PHONE) {\n this.setAttribute('phone', '');\n }\n\n this.adoptLightDomMarkdown();\n\n // Task-list checkbox toggles bubble (composed) out of the rendered\n // `cds-checkbox` elements; one delegated listener forwards them to a\n // consumer `checklist.onToggle`.\n this.addEventListener(\n 'cds-checkbox-changed',\n this.handleChecklistToggle as EventListener\n );\n\n // Ensure we parse and render on initial mount, even if markdown was set before connection\n this.needsReparse = true;\n this.scheduleRender();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\n 'cds-checkbox-changed',\n this.handleChecklistToggle as EventListener\n );\n this.stopObservingLightDom();\n // Tear down any adopted slot hosts so they don't leak across re-connect.\n for (const host of this.slotHosts.values()) {\n host.remove();\n }\n this.slotHosts.clear();\n // Ask any delegating chat container to drop its hosts too. The loop above\n // already detached every relocated node — `slotHosts` holds the reference\n // wherever the node ended up — so this retires forwarders and announces.\n for (const slotName of this.delegatedPluginSlots.keys()) {\n this.retireDelegatedSlot(slotName);\n }\n this.latestRendererDescriptors = [];\n }\n\n /**\n * Delegated handler for `cds-checkbox-changed` from rendered task-list\n * checkboxes. Resolves the toggled checkbox via the composed event path (a\n * host listener would otherwise see a retargeted `event.target`), reads the\n * identity stamped by the task-list plugin, and forwards the new state to a\n * consumer `checklist.onToggle`.\n */\n private handleChecklistToggle = (event: Event): void => {\n const onToggle = this.customRenderers?.checklist?.onToggle;\n if (!onToggle) {\n return;\n }\n const checkbox = event\n .composedPath()\n .find(\n (target): target is HTMLElement =>\n target instanceof HTMLElement &&\n target.tagName.toLowerCase() === 'cds-checkbox'\n );\n const id = checkbox?.getAttribute('data-cds-aichat-checklist-id');\n if (!checkbox || id == null) {\n // Not a stamped task-list checkbox — ignore unrelated cds-checkboxes.\n return;\n }\n const checked = !!(event as CustomEvent<{ checked?: boolean }>).detail\n ?.checked;\n const label =\n checkbox.closest('cds-list-item, li')?.textContent?.trim() ?? '';\n onToggle({ id, label, checked });\n };\n\n private adoptLightDomMarkdown() {\n // Backward compatibility: treat static light-DOM text as initial markdown\n // when the explicit `markdown` property was not provided.\n if (!this.markdownPropertyExplicitlySet) {\n const lightDomMarkdown = readLightDomMarkdownSource(this);\n if (lightDomMarkdown) {\n // Set markdown without triggering the \"explicitly set\" flag\n this.isInternalMarkdownUpdate = true;\n this.markdown = lightDomMarkdown;\n this.isInternalMarkdownUpdate = false;\n }\n\n // Start observing Light DOM changes only if markdown property wasn't explicitly set\n this.startObservingLightDom();\n }\n }\n\n private startObservingLightDom() {\n if (this.lightDomObserver || this.markdownPropertyExplicitlySet) {\n return;\n }\n\n this.lightDomObserver = new MutationObserver((records) => {\n // Only update from Light DOM if markdown property still hasn't been explicitly set\n if (!this.markdownPropertyExplicitlySet) {\n // Mutations that happened entirely inside a portal host (a light-DOM\n // child with a `slot` attribute) are noise from the consumer's\n // overrides re-rendering — they don't change the markdown source.\n const relevant = records.filter(\n (record) => !isInsidePortalHost(record.target, this)\n );\n if (relevant.length === 0) {\n return;\n }\n\n // Process the mutation in a microtask so the DOM has settled. Track\n // it via a counter so `updateComplete` can await any concurrent\n // mutations without the fragility of a single-slot promise field.\n this.pendingLightDomMutations += 1;\n Promise.resolve()\n .then(() => {\n const lightDomMarkdown = readLightDomMarkdownSource(this);\n if (this.markdown !== lightDomMarkdown) {\n this.isInternalMarkdownUpdate = true;\n this.markdown = lightDomMarkdown;\n this.isInternalMarkdownUpdate = false;\n }\n })\n .finally(() => {\n this.pendingLightDomMutations -= 1;\n });\n } else {\n // If markdown was explicitly set, stop observing\n this.stopObservingLightDom();\n }\n });\n\n this.lightDomObserver.observe(this, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n }\n\n private stopObservingLightDom() {\n if (this.lightDomObserver) {\n this.lightDomObserver.disconnect();\n this.lightDomObserver = null;\n }\n }\n\n protected willUpdate(changed: PropertyValues<this>) {\n // Handle initial render case: if markdown was set before connectedCallback,\n // Lit won't report it as \"changed\" but we still need to parse it\n const isInitialRender = !this.hasConnected && this.markdown;\n\n if (\n changed.has('removeHTML') ||\n changed.has('markdown') ||\n changed.has('markdownItPlugins') ||\n isInitialRender\n ) {\n // Properties that affect token tree structure require full reparse\n // - removeHTML: toggles post-parse HTML-token stripping\n // - markdown: updates the source text to parse\n // - markdownItPlugins: swaps the markdown-it instance, new parser rules\n // - isInitialRender: ensures pre-set markdown gets parsed on first render\n this.needsReparse = true;\n this.scheduleRender();\n } else if (\n // Properties that only affect rendering can skip reparsing\n // - sanitizeHTML: applies DOMPurify during render, doesn't change tokens\n // - string properties: change translated strings in rendered output\n // - streaming: affects loading states in rendered output\n // - customRenderers: only changes which tokens emit a slot\n changed.has('sanitizeHTML') ||\n changed.has('streaming') ||\n changed.has('customRenderers') ||\n // Code snippet properties\n changed.has('codeSnippetHighlight') ||\n changed.has('codeSnippetShowLessText') ||\n changed.has('codeSnippetShowMoreText') ||\n changed.has('codeSnippetCopyButtonTooltipContent') ||\n changed.has('codeSnippetGetLineCountText') ||\n changed.has('codeSnippetAriaLabelReadOnly') ||\n changed.has('codeSnippetAriaLabelEditable') ||\n // Table properties\n changed.has('tableFilterPlaceholderText') ||\n changed.has('tablePreviousPageText') ||\n changed.has('tableNextPageText') ||\n changed.has('tableItemsPerPageText') ||\n changed.has('tableDownloadLabelText') ||\n changed.has('tableLocale') ||\n changed.has('tableGetPaginationSupplementalText') ||\n changed.has('tableGetPaginationStatusText')\n ) {\n this.scheduleRender();\n }\n }\n\n /**\n * @internal\n */\n @state()\n tokenTree: TokenTree = {\n key: 'root',\n token: {\n type: 'root',\n tag: '',\n nesting: 0,\n level: 0,\n content: '',\n attrs: null,\n children: null,\n markup: '',\n block: true,\n hidden: false,\n map: null,\n info: '',\n meta: null,\n },\n children: [],\n };\n\n /**\n * @internal\n */\n @state()\n renderedContent: TemplateResult | null = null;\n\n /**\n * Throttled function that updates the rendered content.\n * If needsReparse is true, parses markdown into a token tree first.\n * Otherwise, just re-renders the existing token tree with current settings.\n *\n * @internal\n */\n private renderMarkdown = async () => {\n try {\n const markdownContent = this.markdown ?? '';\n const previousTreeForDiff =\n this.stagedStreamingTokenTree ?? this.tokenTree;\n let nextTokenTree = previousTreeForDiff;\n\n if (this.needsReparse) {\n // First, we take the markdown we were given and use the markdown-it parser to turn is into a tree we can\n // transform into Lit components and compare smartly to avoid re-renders of components that were already\n // rendered when the markdown is updated (likely by streaming, but possibly by an edit somewhere in the\n // middle). It takes the current tokenTree as an argument for quick diffing to avoid re-creating parts\n // of the tree.\n const parsed = markdownToTokenTree(\n markdownContent,\n previousTreeForDiff,\n {\n removeHtml: this.removeHTML,\n markdownItPlugins: this.markdownItPlugins,\n }\n );\n nextTokenTree = parsed.tree;\n this.markdownItInstance = parsed.md;\n this.needsReparse = false;\n }\n\n const hasStreamingTailTable =\n Boolean(this.streaming) && hasTrailingTableToken(nextTokenTree);\n const hasParsedNodeAfterTable = hasNodeAfterTable(nextTokenTree);\n\n if (!this.streaming) {\n this.isStreamingTableLoadingMode = false;\n } else if (this.isStreamingTableLoadingMode) {\n if (\n hasParsedNodeAfterTable &&\n !hasLikelyPartialTableTail(markdownContent)\n ) {\n this.isStreamingTableLoadingMode = false;\n }\n } else if (hasStreamingTailTable) {\n this.isStreamingTableLoadingMode = true;\n }\n\n // Render-and-stash helper. Each invocation produces a fresh batch of\n // renderer-slot descriptors; the `updated()` reconcile then invokes\n // the consumer's `customRenderers` callbacks for each descriptor and\n // adopts the returned `HTMLElement` as a light-DOM slot host.\n const renderAndDispatch = (tree: TokenTree): void => {\n const { template, batch } = renderMarkdownTree(tree, {\n sanitize: this.sanitizeHTML,\n streaming: this.streaming,\n // Code snippet properties\n codeSnippetHighlight: this.codeSnippetHighlight,\n codeSnippetShowLessText: this.codeSnippetShowLessText,\n codeSnippetShowMoreText: this.codeSnippetShowMoreText,\n codeSnippetCopyButtonTooltipContent:\n this.codeSnippetCopyButtonTooltipContent,\n codeSnippetGetLineCountText: this.codeSnippetGetLineCountText,\n codeSnippetAriaLabelReadOnly: this.codeSnippetAriaLabelReadOnly,\n codeSnippetAriaLabelEditable: this.codeSnippetAriaLabelEditable,\n // Table properties\n tableFilterPlaceholderText: this.tableFilterPlaceholderText,\n tablePreviousPageText: this.tablePreviousPageText,\n tableNextPageText: this.tableNextPageText,\n tableItemsPerPageText: this.tableItemsPerPageText,\n tableDownloadLabelText: this.tableDownloadLabelText,\n tableLocale: this.tableLocale,\n tableGetPaginationSupplementalText:\n this.tableGetPaginationSupplementalText,\n tableGetPaginationStatusText: this.tableGetPaginationStatusText,\n // Custom-renderer hooks\n customRenderers: this.customRenderers,\n slotNamespace: this.slotNamespace,\n md: this.markdownItInstance,\n });\n this.renderedContent = template;\n this.latestRendererDescriptors = batch;\n };\n\n if (this.streaming && this.isStreamingTableLoadingMode) {\n if (!this.hasRenderedStreamingTableLoadingFrame) {\n if (nextTokenTree !== this.tokenTree) {\n this.tokenTree = nextTokenTree;\n }\n renderAndDispatch(nextTokenTree);\n this.hasRenderedStreamingTableLoadingFrame = true;\n this.stagedStreamingTokenTree = null;\n } else {\n this.stagedStreamingTokenTree = nextTokenTree;\n }\n return;\n }\n\n // Never prefer the staged tree here: when nothing was reparsed `nextTokenTree`\n // *is* the staged tree (see `previousTreeForDiff` above), and when something\n // was, it came from newer source.\n this.stagedStreamingTokenTree = null;\n this.hasRenderedStreamingTableLoadingFrame = false;\n if (nextTokenTree !== this.tokenTree) {\n this.tokenTree = nextTokenTree;\n }\n\n // Next we take that tree and transform it into Lit content to be rendered into the template.\n // this.renderedContent is what is rendered in the template directly.\n renderAndDispatch(nextTokenTree);\n } catch (error) {\n console.error(`${CONSOLE_PREFIX} Failed to parse markdown`, error);\n }\n };\n\n /**\n * @internal\n */\n private scheduleRender = throttle(\n () => {\n // Lit's getter/setter pipeline can schedule multiple renders quickly.\n // We capture the active render promise so we can report completion later.\n const task = this.renderMarkdown();\n const trackedTask = task.finally(() => {\n if (this.renderTask === trackedTask) {\n this.renderTask = null;\n }\n });\n\n this.renderTask = trackedTask;\n return trackedTask;\n },\n 100,\n { leading: true, trailing: true }\n );\n\n protected async getUpdateComplete(): Promise<boolean> {\n // `updateComplete` is Lit's public hook for consumers/tests to await\n // all pending work. Because we throttle renders, the base implementation\n // might resolve before the throttled callback runs. Overriding this\n // method lets us flush the throttle and await the render promise so\n // callers can reliably wait for `renderedContent` to update.\n const result = await super.getUpdateComplete();\n\n const flushResult = (\n this.scheduleRender as {\n flush?: () => Promise<void> | void;\n }\n ).flush?.();\n\n if (flushResult instanceof Promise) {\n await flushResult;\n }\n\n if (this.renderTask) {\n await this.renderTask;\n }\n\n // Drain any in-flight Light DOM mutation microtasks and their resulting\n // renders. Each iteration yields the event loop so newly enqueued\n // mutations can settle; the counter goes back to zero once everything\n // has flushed.\n while (this.pendingLightDomMutations > 0) {\n await Promise.resolve();\n\n const postMutationFlush = (\n this.scheduleRender as {\n flush?: () => Promise<void> | void;\n }\n ).flush?.();\n\n if (postMutationFlush instanceof Promise) {\n await postMutationFlush;\n }\n\n if (this.renderTask) {\n await this.renderTask;\n }\n }\n\n return result;\n }\n\n protected updated(changed: PropertyValues<this>) {\n super.updated(changed);\n this.reconcileCustomRendererHosts();\n }\n\n /**\n * Drops a claim: retires the forwarder minted for it, if any, then tells the\n * container to let go.\n *\n * The forwarder goes first. An assigned node suppresses the shadow slot's\n * fallback content for as long as it exists, so a surviving forwarder turns\n * a removed host into a blank region instead of the default rendering.\n * @internal\n */\n /**\n * Records a claim and mints the innermost hop back to the host the listener\n * just relocated. Called in the same pass that read the claim because the\n * mount event fires once per host and is never replayed — minting here is\n * what makes a claim without its forwarder unrepresentable.\n * @internal\n */\n private adoptDelegatedSlot(slotName: string) {\n this.delegatedPluginSlots.add(slotName);\n const forwarder = document.createElement('slot');\n forwarder.setAttribute('name', slotName);\n forwarder.setAttribute('slot', slotName);\n this.rendererForwarders.set(slotName, forwarder);\n this.appendChild(forwarder);\n }\n\n private retireDelegatedSlot(slotName: string) {\n this.rendererForwarders.get(slotName)?.remove();\n this.rendererForwarders.delete(slotName);\n this.delegatedPluginSlots.delete(slotName);\n this.dispatchEvent(\n new CustomEvent('cds-aichat-markdown-plugin-host-unmount', {\n bubbles: true,\n composed: true,\n detail: { slotName },\n })\n );\n }\n\n /**\n * Invoke the consumer's `customRenderers` callbacks once per descriptor and\n * adopt their returned `HTMLElement` as a `<span slot=\"…\">` (for inline\n * plugin tokens) or `<div slot=\"…\">` (block tokens and consumer renderers)\n * light-DOM child. Hosts persist across renders so a consumer returning the\n * same element reference produces no DOM churn; hosts whose slot names\n * dropped out of the latest descriptor batch are removed.\n *\n * @internal\n */\n private reconcileCustomRendererHosts() {\n const renderers = this.customRenderers;\n const descriptors = this.latestRendererDescriptors;\n const wanted = new Set<string>();\n\n for (const descriptor of descriptors) {\n if (descriptor.kind === 'pluginFallback') {\n wanted.add(descriptor.slotName);\n\n // Offer the slot to a chat-container ancestor first. The chain\n // appends the host to its OWN light DOM (page DOM at the top of the\n // chain) so external CSS (e.g. a KaTeX stylesheet on the host page)\n // reaches the plugin output. If a listener calls preventDefault, it\n // has taken over hosting and we skip the local appendChild path.\n const alreadyDelegated = this.delegatedPluginSlots.has(\n descriptor.slotName\n );\n if (!alreadyDelegated && !this.slotHosts.has(descriptor.slotName)) {\n const mountEvent = new CustomEvent(\n 'cds-aichat-markdown-plugin-host-mount',\n {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n kind: 'pluginFallback',\n slotName: descriptor.slotName,\n html: descriptor.html,\n isInline: descriptor.isInline,\n } satisfies MarkdownPluginFallbackMountDetail,\n }\n );\n this.dispatchEvent(mountEvent);\n if (mountEvent.defaultPrevented) {\n this.adoptDelegatedSlot(descriptor.slotName);\n }\n } else if (alreadyDelegated) {\n // The chain owns this slot; push HTML updates through a second\n // event so streaming chunks reach the page-level host element.\n this.dispatchEvent(\n new CustomEvent('cds-aichat-markdown-plugin-host-update', {\n bubbles: true,\n composed: true,\n detail: {\n slotName: descriptor.slotName,\n html: descriptor.html,\n },\n })\n );\n }\n\n if (this.delegatedPluginSlots.has(descriptor.slotName)) {\n continue;\n }\n\n // Fallback: no outer listener took over (standalone usage, e.g.\n // storybook). Adopt the host as our own light-DOM child, matching\n // the pre-event behavior so existing tests/stories keep working.\n let host = this.slotHosts.get(descriptor.slotName);\n if (!host) {\n const tag = descriptor.isInline ? 'span' : 'div';\n host = document.createElement(tag);\n host.setAttribute('slot', descriptor.slotName);\n this.slotHosts.set(descriptor.slotName, host);\n this.appendChild(host);\n }\n // Only rewrite innerHTML when the plugin output actually changed;\n // streaming re-renders frequently land here with the same HTML.\n if (host.innerHTML !== descriptor.html) {\n host.innerHTML = descriptor.html;\n }\n continue;\n }\n\n const callback = renderers?.[descriptor.kind];\n if (!callback) {\n continue;\n }\n let result: HTMLElement | null;\n try {\n result = (\n callback as (\n args: Parameters<NonNullable<typeof callback>>[0]\n ) => HTMLElement | null\n )({\n ...descriptor.data,\n token: descriptor.token,\n slotName: descriptor.slotName,\n });\n } catch (error) {\n console.error(\n `[carbon-ai-chat-components] customRenderers.${descriptor.kind} threw`,\n error\n );\n continue;\n }\n if (result == null) {\n const existing = this.slotHosts.get(descriptor.slotName);\n if (existing) {\n existing.remove();\n this.slotHosts.delete(descriptor.slotName);\n }\n continue;\n }\n wanted.add(descriptor.slotName);\n let host = this.slotHosts.get(descriptor.slotName);\n if (!host) {\n host = document.createElement('div');\n host.setAttribute('slot', descriptor.slotName);\n this.slotHosts.set(descriptor.slotName, host);\n\n // Offer the host to a chat-container ancestor so it lives in page\n // light DOM, where consumer-loaded global CSS (e.g. `@carbon/styles`\n // for a returned `@carbon/react` component) can reach it — the markdown\n // element's own light DOM sits inside the chat's shadow root, where it\n // cannot. Mirrors the plugin-fallback path above, but forwards the live\n // host element instead of an HTML string; the markdown element keeps\n // ownership of the host's content across renders, and mints the slot\n // hop back to it below. If no ancestor takes over (standalone usage,\n // e.g. storybook), host it locally.\n const mountEvent = new CustomEvent(\n 'cds-aichat-markdown-plugin-host-mount',\n {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n kind: 'customRenderer',\n slotName: descriptor.slotName,\n element: host,\n isInline: false,\n } satisfies MarkdownCustomRendererMountDetail,\n }\n );\n this.dispatchEvent(mountEvent);\n if (mountEvent.defaultPrevented) {\n this.adoptDelegatedSlot(descriptor.slotName);\n } else {\n this.appendChild(host);\n }\n }\n if (host.firstChild !== result || host.childNodes.length !== 1) {\n host.replaceChildren(result);\n }\n }\n\n for (const [slotName, host] of this.slotHosts) {\n if (!wanted.has(slotName)) {\n host.remove();\n this.slotHosts.delete(slotName);\n }\n }\n\n // Drop claims whose descriptor disappeared (a streaming chunk removed a\n // math node, a `customRenderers` callback returned null): the host was\n // already detached above, so this retires the hop and announces.\n for (const slotName of this.delegatedPluginSlots.keys()) {\n if (!wanted.has(slotName)) {\n this.retireDelegatedSlot(slotName);\n }\n }\n }\n\n protected render() {\n const { renderedContent } = this;\n return html`<div class=\"cds-aichat-markdown-stack\">\n ${renderedContent}\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-aichat-markdown': CDSAIChatMarkdown;\n }\n}\n\nexport { CDSAIChatMarkdown };\nexport default CDSAIChatMarkdown;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAkCH,MAAM,cAAc,GAAG,6BAA6B;AAEpD;;;;;AAKG;AACH,SAAS,kBAAkB,CAAC,IAAU,EAAE,QAAc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oCAAA,EAAA,MAAA,CAAA;AAI9E,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE;AAS/B,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,8BAAA,EAAA,MAAA,CAAA;AASb,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;AACJ,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,CAAA;AAiBvC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AACY,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AAsT1C,UAAA,CAAA;AADC,IAAA,KAAK;AAmBJ,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAMF,UAAA,CAAA;AADC,IAAA,KAAK;AACwC,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AAte1C,iBAAiB,GAAA,UAAA,CAAA;AADtB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,SAAA,CAAW;AAC7B,CAAA,EAAA,iBAAiB,CA+3BtB;AASD,0BAAe,iBAAiB;;"}
1
+ {"version":3,"file":"markdown.js","sources":["../../../../src/components/markdown/src/markdown.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { html, LitElement, PropertyValues, TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './markdown.scss?lit';\nimport throttle from 'lodash-es/throttle.js';\nimport { IS_PHONE } from '../../../globals/utils/browser-utils.js';\n\nimport MarkdownIt from 'markdown-it';\n\nimport {\n markdownToTokenTree,\n type MarkdownItPlugin,\n type TokenTree,\n} from './markdown-token-tree.js';\nimport type {\n MarkdownCustomRendererMountDetail,\n MarkdownPluginFallbackMountDetail,\n} from './utils/plugin-host-container.js';\nimport {\n renderMarkdownTree,\n type MarkdownCustomRenderers,\n type MarkdownRendererSlotDescriptor,\n} from './markdown-renderer.js';\nimport {\n hasLikelyPartialTableTail,\n hasNodeAfterTable,\n hasTrailingTableToken,\n} from './utils/streaming-table.js';\nimport { nextMarkdownInstanceId } from './utils/slot-names.js';\n\nconst CONSOLE_PREFIX = '[carbon-ai-chat-components]';\n\n/**\n * True if `node` is inside (or is) a light-DOM element with a `slot` attribute\n * set, up to (but not including) `boundary`. Portal hosts mounted by consumers\n * carry a `slot` attribute, so this is used to skip both `textContent`\n * contributions and observed mutations that originated inside a portal subtree.\n */\nfunction isInsidePortalHost(node: Node, boundary: Node): boolean {\n let cur: Node | null = node;\n while (cur && cur !== boundary) {\n if (cur instanceof Element && cur.hasAttribute('slot')) {\n return true;\n }\n cur = cur.parentNode;\n }\n return false;\n}\n\n/**\n * Concatenates the markdown source from `element`'s light-DOM children,\n * skipping any `<element slot=\"…\">` portal hosts so consumer-rendered overrides\n * don't contaminate the parsed markdown source.\n */\nfunction readLightDomMarkdownSource(element: Element): string {\n let out = '';\n for (const child of Array.from(element.childNodes)) {\n if (child instanceof Element && child.hasAttribute('slot')) {\n continue;\n }\n if (child.nodeType === Node.TEXT_NODE) {\n out += child.nodeValue ?? '';\n } else if (child instanceof Element) {\n out += child.textContent ?? '';\n }\n }\n return out.trim();\n}\n\n/**\n * Renders markdown as Carbon-styled DOM. Streaming-friendly: incremental updates reparse the markdown source into a `TokenTree`, diff it against the prior tree to reuse stable subtrees, then walk it into a Lit `TemplateResult` — Lit's `repeat` directive keys off the diffed nodes so unchanged DOM stays put.\n *\n * ### Lifecycle\n *\n * 1. A property setter (or a light-DOM mutation) lands. `willUpdate` decides whether the change requires a reparse (`markdown`, `removeHTML`, `markdownItPlugins`) or only a re-render (translated strings, `streaming`, `sanitizeHTML`, `customRenderers`).\n * 2. `scheduleRender` throttles bursts to 100ms (leading + trailing).\n * 3. `renderMarkdown` parses (if needed) via {@link markdownToTokenTree}, then calls {@link renderMarkdownTree} to produce both a `TemplateResult` and a batch of {@link MarkdownRendererSlotDescriptor} records.\n * 4. After Lit commits, `updated()` runs `reconcileCustomRendererHosts` — that is where consumer-supplied `customRenderers` callbacks fire and plugin-fallback HTML is adopted into light-DOM slot hosts.\n *\n * ### Extensibility\n *\n * - {@link markdownItPlugins} runs after the built-in markdown-it plugins (markdown-it-attrs, highlight, task-lists). A new array identity rebuilds the markdown-it instance and forces a full reparse. Tokens introduced by a plugin that the native dispatch can't handle — either an unknown tag, or a plugin-overridden rule on a curated allow-list of leaf tokens — route through `md.renderer.render()` via `./utils/plugin-fallback.ts` and surface as `pluginFallback` descriptors. Their rendered HTML is adopted into a light-DOM slot host so consumer-supplied CSS (e.g. a KaTeX stylesheet on the host page) reaches it.\n * - {@link customRenderers} overrides per-element rendering for `table` and `codeBlock`. The renderer emits a named `<slot>` placeholder; the reconciler invokes the consumer's callback with the parsed data and appends the returned `HTMLElement` as a `<div slot=\"…\">` light-DOM child. Returning the same element reference across renders avoids DOM churn.\n *\n * ### Light-DOM source adoption\n *\n * When the `markdown` property has never been set explicitly, the element treats its light-DOM text content as the initial source and watches for further mutations via a `MutationObserver`. Setting the property explicitly stops the observer — the property is then the authoritative source.\n *\n * ### Related files\n *\n * - `./markdown-token-tree.ts` — markdown-it parse + tree builder + streaming-aware diff (with `cachedHtml` carry-forward for plugin-delegated tokens).\n * - `./markdown-renderer.ts` — `TokenTree` → Lit `TemplateResult`, plus descriptor collection.\n * - `./markdown-renderer-types.ts` — public ({@link MarkdownCustomRenderers}) and internal ({@link MarkdownRendererSlotDescriptor}, `RenderTokenTreeOptions`) contracts.\n * - `./utils/plugin-fallback.ts` — delegation to `md.renderer.render()` for plugin-introduced tokens.\n * - `./utils/streaming-table.ts` — heuristics that hold a streaming table in a skeleton \"loading\" state until its tail stabilizes.\n *\n * @element cds-aichat-markdown\n */\n@carbonElement(`${prefix}-markdown`)\nclass CDSAIChatMarkdown extends LitElement {\n static styles = [commonStyles, styles];\n\n /**\n * Sanitize any HTML included in the markdown. e.g. remove script tags, onclick handlers, etc.\n */\n @property({ type: Boolean, attribute: 'sanitize-html' })\n sanitizeHTML = false;\n\n /**\n * Remove all HTML from included markdown.\n */\n @property({ type: Boolean, attribute: 'remove-html' })\n removeHTML = false;\n\n /**\n * Internal storage for markdown content.\n * @internal\n */\n private _markdown = '';\n\n /**\n * Flag to temporarily allow internal markdown updates without marking as explicitly set.\n * @internal\n */\n private isInternalMarkdownUpdate = false;\n\n /**\n * Direct markdown source input.\n */\n @property({ type: String })\n get markdown(): string {\n return this._markdown;\n }\n set markdown(value: string) {\n const oldValue = this._markdown;\n this._markdown = value;\n\n // Track that markdown was explicitly set (not from Light DOM adoption)\n // Only mark as explicitly set if this is NOT an internal update\n if (!this.isInternalMarkdownUpdate) {\n this.markdownPropertyExplicitlySet = true;\n this.stopObservingLightDom();\n }\n\n this.requestUpdate('markdown', oldValue);\n }\n\n /**\n * If you are actively streaming, setting this to true can help prevent needless UI thrashing when writing\n * complex components (like a sortable and filterable table).\n */\n @property({ type: Boolean, attribute: 'streaming' })\n streaming = false;\n\n // Code snippet properties\n /** Enable syntax highlighting for any code fence blocks. */\n @property({ type: Boolean, attribute: 'code-snippet-highlight' })\n codeSnippetHighlight = true;\n\n /** Label for collapsing long code blocks. */\n @property({ type: String, attribute: 'code-snippet-show-less-text' })\n codeSnippetShowLessText = 'Show less';\n\n /** Label for expanding long code blocks. */\n @property({ type: String, attribute: 'code-snippet-show-more-text' })\n codeSnippetShowMoreText = 'Show more';\n\n /** Tooltip content for the copy action on code blocks. */\n @property({\n type: String,\n attribute: 'code-snippet-copy-button-tooltip-content',\n })\n codeSnippetCopyButtonTooltipContent = 'Copy code';\n\n /** Formatter for the code block line count. */\n @property({ type: Object, attribute: false })\n codeSnippetGetLineCountText?: ({ count }: { count: number }) => string;\n\n /** Aria-label for code snippets when in read-only mode. */\n @property({ type: String, attribute: 'code-snippet-aria-label-readonly' })\n codeSnippetAriaLabelReadOnly = 'Code snippet';\n\n /** Aria-label for code snippets when in editable mode. */\n @property({ type: String, attribute: 'code-snippet-aria-label-editable' })\n codeSnippetAriaLabelEditable = 'Code editor';\n\n // Table properties\n /** Placeholder text for table filters. */\n @property({ type: String, attribute: 'table-filter-placeholder-text' })\n tableFilterPlaceholderText = 'Filter table...';\n\n /** Label for the previous page control in tables. */\n @property({ type: String, attribute: 'table-previous-page-text' })\n tablePreviousPageText = 'Previous page';\n\n /** Label for the next page control in tables. */\n @property({ type: String, attribute: 'table-next-page-text' })\n tableNextPageText = 'Next page';\n\n /** Label for the items-per-page control in tables. */\n @property({ type: String, attribute: 'table-items-per-page-text' })\n tableItemsPerPageText = 'Items per page:';\n\n /** Label for download of CSV of table data. */\n @property({ type: String, attribute: 'table-download-label-text' })\n tableDownloadLabelText = 'Download table data';\n\n /** Locale used for table pagination and formatting. */\n @property({ type: String, attribute: 'table-locale' })\n tableLocale = 'en';\n\n /** Optional formatter for supplemental pagination text. */\n @property({ type: Object, attribute: false })\n tableGetPaginationSupplementalText?: ({ count }: { count: number }) => string;\n\n /** Optional formatter for pagination status text. */\n @property({ type: Object, attribute: false })\n tableGetPaginationStatusText?: ({\n start,\n end,\n count,\n }: {\n start: number;\n end: number;\n count: number;\n }) => string;\n\n /**\n * Markdown-it plugins applied after the built-in plugins\n * (markdown-it-attrs, markdown-it-highlight, markdown-it-task-lists).\n * Changes force a reparse. Memoize this array — a new reference each render\n * rebuilds the markdown-it instance.\n */\n @property({ type: Array, attribute: false })\n markdownItPlugins?: MarkdownItPlugin[];\n\n /**\n * Per-element render overrides. For each `kind` whose callback is provided,\n * the markdown element emits a named `<slot>` placeholder in its shadow\n * DOM, then — after each render — invokes the callback with the parsed\n * data and adopts the returned `HTMLElement` as a `<div slot=\"…\">`\n * light-DOM child of this element. Return `null` to fall back to the\n * default Carbon rendering. Returning the same element reference across\n * renders avoids DOM churn.\n *\n * Inside a chat, a container relocates the returned element into its own\n * light DOM — page DOM at the top of the chain — and this element forwards\n * it back into the named slot, so consumer-loaded page CSS reaches it.\n * Standalone (no chat ancestor), it stays a light-DOM child of this element.\n */\n @property({ attribute: false })\n customRenderers?: MarkdownCustomRenderers;\n\n /**\n * Descriptors collected during the most recent render task; consumed by\n * the `updated()` reconcile to invoke {@link customRenderers} callbacks.\n * @internal\n */\n private latestRendererDescriptors: MarkdownRendererSlotDescriptor[] = [];\n\n /**\n * Light-DOM slot hosts adopted on behalf of {@link customRenderers}, keyed\n * by slot name. Reused across renders for stable identity.\n * @internal\n */\n private slotHosts: Map<string, HTMLElement> = new Map();\n\n /**\n * `<slot name=X slot=X>` forwarders minted for {@link customRenderers} hosts\n * an outer listener relocated into its own light DOM, keyed by slot name.\n *\n * Appended imperatively rather than rendered: Lit commits into the shadow\n * root, and this hop has to be a light-DOM child of this element to gather\n * the relocated host out of the chat element's light DOM and hand it to the\n * shadow `<slot>` the renderer emitted. Minted where the claim is read\n * rather than by a subscriber, because the mount event fires once per host\n * and is never replayed — a listener that subscribes later cannot mint it.\n * @internal\n */\n private rendererForwarders: Map<string, HTMLSlotElement> = new Map();\n\n /**\n * Namespace appended to every slot name this element mints, so two markdown\n * elements rendering identical markdown never collide in the shared\n * page-level host container a chat container hoists slot hosts into.\n *\n * Assigned in the field initializer (construction) rather than\n * `connectedCallback`, which runs again after a DOM move — the namespace, and\n * therefore every slot name and every adopted host, must survive a\n * disconnect/reconnect.\n * @internal\n */\n private readonly slotNamespace = nextMarkdownInstanceId();\n\n /**\n * Slot names whose host was created by an outer listener (a chat container\n * that called `preventDefault()` on the host-mount event). We track these so\n * we can fire matching unmount events without trying to remove a host we\n * never appended.\n * @internal\n */\n private delegatedPluginSlots: Set<string> = new Set();\n\n /**\n * The markdown-it instance produced by the most recent parse. Forwarded into\n * the renderer so unknown tokens can fall back to `md.renderer.render()`.\n * @internal\n */\n private markdownItInstance?: MarkdownIt;\n\n /**\n * @internal\n */\n private needsReparse = false;\n\n /**\n * Tracks the latest asynchronous rendering work so callers waiting on `updateComplete` know when throttled updates are done.\n *\n * @internal\n */\n private renderTask: Promise<void> | null = null;\n\n private hasRenderedStreamingTableLoadingFrame = false;\n /**\n * The most recent tree parsed while in streaming table loading mode, held back\n * from rendering. It seeds `previousTreeForDiff`, so the tick that leaves loading\n * mode without a reparse still renders the content staged during it.\n * @internal\n */\n private stagedStreamingTokenTree: TokenTree | null = null;\n\n /**\n * @internal\n */\n private isStreamingTableLoadingMode = false;\n\n /**\n * @internal\n */\n private hasConnected = false;\n\n /**\n * Tracks whether the markdown property has been explicitly set by the user.\n * When false, the component will monitor Light DOM changes.\n * @internal\n */\n private markdownPropertyExplicitlySet = false;\n\n /**\n * MutationObserver to monitor Light DOM changes when markdown property isn't explicitly set.\n * @internal\n */\n private lightDomObserver: MutationObserver | null = null;\n\n /**\n * Generation counter for Light DOM mutation processing. Incremented when a\n * mutation is observed and decremented when the resulting microtask\n * completes. `updateComplete` waits while the counter is non-zero.\n * @internal\n */\n private pendingLightDomMutations = 0;\n\n connectedCallback() {\n super.connectedCallback();\n this.hasConnected = true;\n\n if (IS_PHONE) {\n this.setAttribute('phone', '');\n }\n\n this.adoptLightDomMarkdown();\n\n // Task-list checkbox toggles bubble (composed) out of the rendered\n // `cds-checkbox` elements; one delegated listener forwards them to a\n // consumer `checklist.onToggle`.\n this.addEventListener(\n 'cds-checkbox-changed',\n this.handleChecklistToggle as EventListener\n );\n\n // Ensure we parse and render on initial mount, even if markdown was set before connection\n this.needsReparse = true;\n this.scheduleRender();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\n 'cds-checkbox-changed',\n this.handleChecklistToggle as EventListener\n );\n this.stopObservingLightDom();\n // Tear down any adopted slot hosts so they don't leak across re-connect.\n for (const host of this.slotHosts.values()) {\n host.remove();\n }\n this.slotHosts.clear();\n // Ask any delegating chat container to drop its hosts too. The loop above\n // already detached every relocated node — `slotHosts` holds the reference\n // wherever the node ended up — so this retires forwarders and announces.\n for (const slotName of this.delegatedPluginSlots.keys()) {\n this.retireDelegatedSlot(slotName);\n }\n this.latestRendererDescriptors = [];\n }\n\n /**\n * Delegated handler for `cds-checkbox-changed` from rendered task-list\n * checkboxes. Resolves the toggled checkbox via the composed event path (a\n * host listener would otherwise see a retargeted `event.target`), reads the\n * identity stamped by the task-list plugin, and forwards the new state to a\n * consumer `checklist.onToggle`.\n */\n private handleChecklistToggle = (event: Event): void => {\n const onToggle = this.customRenderers?.checklist?.onToggle;\n if (!onToggle) {\n return;\n }\n const checkbox = event\n .composedPath()\n .find(\n (target): target is HTMLElement =>\n target instanceof HTMLElement &&\n target.tagName.toLowerCase() === 'cds-checkbox'\n );\n const id = checkbox?.getAttribute('data-cds-aichat-checklist-id');\n if (!checkbox || id == null) {\n // Not a stamped task-list checkbox — ignore unrelated cds-checkboxes.\n return;\n }\n const checked = !!(event as CustomEvent<{ checked?: boolean }>).detail\n ?.checked;\n const label =\n checkbox.closest('cds-list-item, li')?.textContent?.trim() ?? '';\n onToggle({ id, label, checked });\n };\n\n private adoptLightDomMarkdown() {\n // Backward compatibility: treat static light-DOM text as initial markdown\n // when the explicit `markdown` property was not provided.\n if (!this.markdownPropertyExplicitlySet) {\n const lightDomMarkdown = readLightDomMarkdownSource(this);\n if (lightDomMarkdown) {\n // Set markdown without triggering the \"explicitly set\" flag\n this.isInternalMarkdownUpdate = true;\n this.markdown = lightDomMarkdown;\n this.isInternalMarkdownUpdate = false;\n }\n\n // Start observing Light DOM changes only if markdown property wasn't explicitly set\n this.startObservingLightDom();\n }\n }\n\n private startObservingLightDom() {\n if (this.lightDomObserver || this.markdownPropertyExplicitlySet) {\n return;\n }\n\n this.lightDomObserver = new MutationObserver((records) => {\n // Only update from Light DOM if markdown property still hasn't been explicitly set\n if (!this.markdownPropertyExplicitlySet) {\n // Mutations that happened entirely inside a portal host (a light-DOM\n // child with a `slot` attribute) are noise from the consumer's\n // overrides re-rendering — they don't change the markdown source.\n const relevant = records.filter(\n (record) => !isInsidePortalHost(record.target, this)\n );\n if (relevant.length === 0) {\n return;\n }\n\n // Process the mutation in a microtask so the DOM has settled. Track\n // it via a counter so `updateComplete` can await any concurrent\n // mutations without the fragility of a single-slot promise field.\n this.pendingLightDomMutations += 1;\n Promise.resolve()\n .then(() => {\n const lightDomMarkdown = readLightDomMarkdownSource(this);\n if (this.markdown !== lightDomMarkdown) {\n this.isInternalMarkdownUpdate = true;\n this.markdown = lightDomMarkdown;\n this.isInternalMarkdownUpdate = false;\n }\n })\n .finally(() => {\n this.pendingLightDomMutations -= 1;\n });\n } else {\n // If markdown was explicitly set, stop observing\n this.stopObservingLightDom();\n }\n });\n\n this.lightDomObserver.observe(this, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n }\n\n private stopObservingLightDom() {\n if (this.lightDomObserver) {\n this.lightDomObserver.disconnect();\n this.lightDomObserver = null;\n }\n }\n\n protected willUpdate(changed: PropertyValues<this>) {\n // Handle initial render case: if markdown was set before connectedCallback,\n // Lit won't report it as \"changed\" but we still need to parse it\n const isInitialRender = !this.hasConnected && this.markdown;\n\n if (\n changed.has('removeHTML') ||\n changed.has('markdown') ||\n changed.has('markdownItPlugins') ||\n isInitialRender\n ) {\n // Properties that affect token tree structure require full reparse\n // - removeHTML: toggles post-parse HTML-token stripping\n // - markdown: updates the source text to parse\n // - markdownItPlugins: swaps the markdown-it instance, new parser rules\n // - isInitialRender: ensures pre-set markdown gets parsed on first render\n this.needsReparse = true;\n this.scheduleRender();\n } else if (\n // Properties that only affect rendering can skip reparsing\n // - sanitizeHTML: applies DOMPurify during render, doesn't change tokens\n // - string properties: change translated strings in rendered output\n // - streaming: affects loading states in rendered output\n // - customRenderers: only changes which tokens emit a slot\n changed.has('sanitizeHTML') ||\n changed.has('streaming') ||\n changed.has('customRenderers') ||\n // Code snippet properties\n changed.has('codeSnippetHighlight') ||\n changed.has('codeSnippetShowLessText') ||\n changed.has('codeSnippetShowMoreText') ||\n changed.has('codeSnippetCopyButtonTooltipContent') ||\n changed.has('codeSnippetGetLineCountText') ||\n changed.has('codeSnippetAriaLabelReadOnly') ||\n changed.has('codeSnippetAriaLabelEditable') ||\n // Table properties\n changed.has('tableFilterPlaceholderText') ||\n changed.has('tablePreviousPageText') ||\n changed.has('tableNextPageText') ||\n changed.has('tableItemsPerPageText') ||\n changed.has('tableDownloadLabelText') ||\n changed.has('tableLocale') ||\n changed.has('tableGetPaginationSupplementalText') ||\n changed.has('tableGetPaginationStatusText')\n ) {\n this.scheduleRender();\n }\n }\n\n /**\n * @internal\n */\n @state()\n tokenTree: TokenTree = {\n key: 'root',\n token: {\n type: 'root',\n tag: '',\n nesting: 0,\n level: 0,\n content: '',\n attrs: null,\n children: null,\n markup: '',\n block: true,\n hidden: false,\n map: null,\n info: '',\n meta: null,\n },\n children: [],\n };\n\n /**\n * @internal\n */\n @state()\n renderedContent: TemplateResult | null = null;\n\n /**\n * Throttled function that updates the rendered content.\n * If needsReparse is true, parses markdown into a token tree first.\n * Otherwise, just re-renders the existing token tree with current settings.\n *\n * @internal\n */\n private renderMarkdown = async () => {\n try {\n const markdownContent = this.markdown ?? '';\n const previousTreeForDiff =\n this.stagedStreamingTokenTree ?? this.tokenTree;\n let nextTokenTree = previousTreeForDiff;\n\n if (this.needsReparse) {\n // First, we take the markdown we were given and use the markdown-it parser to turn is into a tree we can\n // transform into Lit components and compare smartly to avoid re-renders of components that were already\n // rendered when the markdown is updated (likely by streaming, but possibly by an edit somewhere in the\n // middle). It takes the current tokenTree as an argument for quick diffing to avoid re-creating parts\n // of the tree.\n const parsed = markdownToTokenTree(\n markdownContent,\n previousTreeForDiff,\n {\n removeHtml: this.removeHTML,\n markdownItPlugins: this.markdownItPlugins,\n }\n );\n nextTokenTree = parsed.tree;\n this.markdownItInstance = parsed.md;\n this.needsReparse = false;\n }\n\n const hasStreamingTailTable =\n Boolean(this.streaming) && hasTrailingTableToken(nextTokenTree);\n const hasParsedNodeAfterTable = hasNodeAfterTable(nextTokenTree);\n\n if (!this.streaming) {\n this.isStreamingTableLoadingMode = false;\n } else if (this.isStreamingTableLoadingMode) {\n if (\n hasParsedNodeAfterTable &&\n !hasLikelyPartialTableTail(markdownContent)\n ) {\n this.isStreamingTableLoadingMode = false;\n }\n } else if (hasStreamingTailTable) {\n this.isStreamingTableLoadingMode = true;\n }\n\n // Render-and-stash helper. Each invocation produces a fresh batch of\n // renderer-slot descriptors; the `updated()` reconcile then invokes\n // the consumer's `customRenderers` callbacks for each descriptor and\n // adopts the returned `HTMLElement` as a light-DOM slot host.\n const renderAndDispatch = (tree: TokenTree): void => {\n const { template, batch } = renderMarkdownTree(tree, {\n sanitize: this.sanitizeHTML,\n streaming: this.streaming,\n // Code snippet properties\n codeSnippetHighlight: this.codeSnippetHighlight,\n codeSnippetShowLessText: this.codeSnippetShowLessText,\n codeSnippetShowMoreText: this.codeSnippetShowMoreText,\n codeSnippetCopyButtonTooltipContent:\n this.codeSnippetCopyButtonTooltipContent,\n codeSnippetGetLineCountText: this.codeSnippetGetLineCountText,\n codeSnippetAriaLabelReadOnly: this.codeSnippetAriaLabelReadOnly,\n codeSnippetAriaLabelEditable: this.codeSnippetAriaLabelEditable,\n // Table properties\n tableFilterPlaceholderText: this.tableFilterPlaceholderText,\n tablePreviousPageText: this.tablePreviousPageText,\n tableNextPageText: this.tableNextPageText,\n tableItemsPerPageText: this.tableItemsPerPageText,\n tableDownloadLabelText: this.tableDownloadLabelText,\n tableLocale: this.tableLocale,\n tableGetPaginationSupplementalText:\n this.tableGetPaginationSupplementalText,\n tableGetPaginationStatusText: this.tableGetPaginationStatusText,\n // Custom-renderer hooks\n customRenderers: this.customRenderers,\n slotNamespace: this.slotNamespace,\n projectionHost: this,\n md: this.markdownItInstance,\n });\n this.renderedContent = template;\n this.latestRendererDescriptors = batch;\n };\n\n if (this.streaming && this.isStreamingTableLoadingMode) {\n if (!this.hasRenderedStreamingTableLoadingFrame) {\n if (nextTokenTree !== this.tokenTree) {\n this.tokenTree = nextTokenTree;\n }\n renderAndDispatch(nextTokenTree);\n this.hasRenderedStreamingTableLoadingFrame = true;\n this.stagedStreamingTokenTree = null;\n } else {\n this.stagedStreamingTokenTree = nextTokenTree;\n }\n return;\n }\n\n // Never prefer the staged tree here: when nothing was reparsed `nextTokenTree`\n // *is* the staged tree (see `previousTreeForDiff` above), and when something\n // was, it came from newer source.\n this.stagedStreamingTokenTree = null;\n this.hasRenderedStreamingTableLoadingFrame = false;\n if (nextTokenTree !== this.tokenTree) {\n this.tokenTree = nextTokenTree;\n }\n\n // Next we take that tree and transform it into Lit content to be rendered into the template.\n // this.renderedContent is what is rendered in the template directly.\n renderAndDispatch(nextTokenTree);\n } catch (error) {\n console.error(`${CONSOLE_PREFIX} Failed to parse markdown`, error);\n }\n };\n\n /**\n * @internal\n */\n private scheduleRender = throttle(\n () => {\n // Lit's getter/setter pipeline can schedule multiple renders quickly.\n // We capture the active render promise so we can report completion later.\n const task = this.renderMarkdown();\n const trackedTask = task.finally(() => {\n if (this.renderTask === trackedTask) {\n this.renderTask = null;\n }\n });\n\n this.renderTask = trackedTask;\n return trackedTask;\n },\n 100,\n { leading: true, trailing: true }\n );\n\n protected async getUpdateComplete(): Promise<boolean> {\n // `updateComplete` is Lit's public hook for consumers/tests to await\n // all pending work. Because we throttle renders, the base implementation\n // might resolve before the throttled callback runs. Overriding this\n // method lets us flush the throttle and await the render promise so\n // callers can reliably wait for `renderedContent` to update.\n const result = await super.getUpdateComplete();\n\n const flushResult = (\n this.scheduleRender as {\n flush?: () => Promise<void> | void;\n }\n ).flush?.();\n\n if (flushResult instanceof Promise) {\n await flushResult;\n }\n\n if (this.renderTask) {\n await this.renderTask;\n }\n\n // Drain any in-flight Light DOM mutation microtasks and their resulting\n // renders. Each iteration yields the event loop so newly enqueued\n // mutations can settle; the counter goes back to zero once everything\n // has flushed.\n while (this.pendingLightDomMutations > 0) {\n await Promise.resolve();\n\n const postMutationFlush = (\n this.scheduleRender as {\n flush?: () => Promise<void> | void;\n }\n ).flush?.();\n\n if (postMutationFlush instanceof Promise) {\n await postMutationFlush;\n }\n\n if (this.renderTask) {\n await this.renderTask;\n }\n }\n\n return result;\n }\n\n protected updated(changed: PropertyValues<this>) {\n super.updated(changed);\n this.reconcileCustomRendererHosts();\n }\n\n /**\n * Drops a claim: retires the forwarder minted for it, if any, then tells the\n * container to let go.\n *\n * The forwarder goes first. An assigned node suppresses the shadow slot's\n * fallback content for as long as it exists, so a surviving forwarder turns\n * a removed host into a blank region instead of the default rendering.\n * @internal\n */\n /**\n * Records a claim and mints the innermost hop back to the host the listener\n * just relocated. Called in the same pass that read the claim because the\n * mount event fires once per host and is never replayed — minting here is\n * what makes a claim without its forwarder unrepresentable.\n * @internal\n */\n private adoptDelegatedSlot(slotName: string) {\n this.delegatedPluginSlots.add(slotName);\n const forwarder = document.createElement('slot');\n forwarder.setAttribute('name', slotName);\n forwarder.setAttribute('slot', slotName);\n this.rendererForwarders.set(slotName, forwarder);\n this.appendChild(forwarder);\n }\n\n private retireDelegatedSlot(slotName: string) {\n this.rendererForwarders.get(slotName)?.remove();\n this.rendererForwarders.delete(slotName);\n this.delegatedPluginSlots.delete(slotName);\n this.dispatchEvent(\n new CustomEvent('cds-aichat-markdown-plugin-host-unmount', {\n bubbles: true,\n composed: true,\n detail: { slotName },\n })\n );\n }\n\n /**\n * Invoke the consumer's `customRenderers` callbacks once per descriptor and\n * adopt their returned `HTMLElement` as a `<span slot=\"…\">` (for inline\n * plugin tokens) or `<div slot=\"…\">` (block tokens and consumer renderers)\n * light-DOM child. Hosts persist across renders so a consumer returning the\n * same element reference produces no DOM churn; hosts whose slot names\n * dropped out of the latest descriptor batch are removed.\n *\n * @internal\n */\n private reconcileCustomRendererHosts() {\n const renderers = this.customRenderers;\n const descriptors = this.latestRendererDescriptors;\n const wanted = new Set<string>();\n\n for (const descriptor of descriptors) {\n if (descriptor.kind === 'pluginFallback') {\n wanted.add(descriptor.slotName);\n\n // Offer the slot to a chat-container ancestor first. The chain\n // appends the host to its OWN light DOM (page DOM at the top of the\n // chain) so external CSS (e.g. a KaTeX stylesheet on the host page)\n // reaches the plugin output. If a listener calls preventDefault, it\n // has taken over hosting and we skip the local appendChild path.\n const alreadyDelegated = this.delegatedPluginSlots.has(\n descriptor.slotName\n );\n if (!alreadyDelegated && !this.slotHosts.has(descriptor.slotName)) {\n const mountEvent = new CustomEvent(\n 'cds-aichat-markdown-plugin-host-mount',\n {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n kind: 'pluginFallback',\n slotName: descriptor.slotName,\n html: descriptor.html,\n isInline: descriptor.isInline,\n } satisfies MarkdownPluginFallbackMountDetail,\n }\n );\n this.dispatchEvent(mountEvent);\n if (mountEvent.defaultPrevented) {\n this.adoptDelegatedSlot(descriptor.slotName);\n }\n } else if (alreadyDelegated) {\n // The chain owns this slot; push HTML updates through a second\n // event so streaming chunks reach the page-level host element.\n this.dispatchEvent(\n new CustomEvent('cds-aichat-markdown-plugin-host-update', {\n bubbles: true,\n composed: true,\n detail: {\n slotName: descriptor.slotName,\n html: descriptor.html,\n },\n })\n );\n }\n\n if (this.delegatedPluginSlots.has(descriptor.slotName)) {\n continue;\n }\n\n // Fallback: no outer listener took over (standalone usage, e.g.\n // storybook). Adopt the host as our own light-DOM child, matching\n // the pre-event behavior so existing tests/stories keep working.\n let host = this.slotHosts.get(descriptor.slotName);\n if (!host) {\n const tag = descriptor.isInline ? 'span' : 'div';\n host = document.createElement(tag);\n host.setAttribute('slot', descriptor.slotName);\n this.slotHosts.set(descriptor.slotName, host);\n this.appendChild(host);\n }\n // Only rewrite innerHTML when the plugin output actually changed;\n // streaming re-renders frequently land here with the same HTML.\n if (host.innerHTML !== descriptor.html) {\n host.innerHTML = descriptor.html;\n }\n continue;\n }\n\n const callback = renderers?.[descriptor.kind];\n if (!callback) {\n continue;\n }\n let result: HTMLElement | null;\n try {\n result = (\n callback as (\n args: Parameters<NonNullable<typeof callback>>[0]\n ) => HTMLElement | null\n )({\n ...descriptor.data,\n token: descriptor.token,\n slotName: descriptor.slotName,\n });\n } catch (error) {\n console.error(\n `[carbon-ai-chat-components] customRenderers.${descriptor.kind} threw`,\n error\n );\n continue;\n }\n if (result == null) {\n const existing = this.slotHosts.get(descriptor.slotName);\n if (existing) {\n existing.remove();\n this.slotHosts.delete(descriptor.slotName);\n }\n continue;\n }\n wanted.add(descriptor.slotName);\n let host = this.slotHosts.get(descriptor.slotName);\n if (!host) {\n host = document.createElement('div');\n host.setAttribute('slot', descriptor.slotName);\n this.slotHosts.set(descriptor.slotName, host);\n\n // Offer the host to a chat-container ancestor so it lives in page\n // light DOM, where consumer-loaded global CSS (e.g. `@carbon/styles`\n // for a returned `@carbon/react` component) can reach it — the markdown\n // element's own light DOM sits inside the chat's shadow root, where it\n // cannot. Mirrors the plugin-fallback path above, but forwards the live\n // host element instead of an HTML string; the markdown element keeps\n // ownership of the host's content across renders, and mints the slot\n // hop back to it below. If no ancestor takes over (standalone usage,\n // e.g. storybook), host it locally.\n const mountEvent = new CustomEvent(\n 'cds-aichat-markdown-plugin-host-mount',\n {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n kind: 'customRenderer',\n slotName: descriptor.slotName,\n element: host,\n isInline: false,\n } satisfies MarkdownCustomRendererMountDetail,\n }\n );\n this.dispatchEvent(mountEvent);\n if (mountEvent.defaultPrevented) {\n this.adoptDelegatedSlot(descriptor.slotName);\n } else {\n this.appendChild(host);\n }\n }\n if (host.firstChild !== result || host.childNodes.length !== 1) {\n host.replaceChildren(result);\n }\n }\n\n for (const [slotName, host] of this.slotHosts) {\n if (!wanted.has(slotName)) {\n host.remove();\n this.slotHosts.delete(slotName);\n }\n }\n\n // Drop claims whose descriptor disappeared (a streaming chunk removed a\n // math node, a `customRenderers` callback returned null): the host was\n // already detached above, so this retires the hop and announces.\n for (const slotName of this.delegatedPluginSlots.keys()) {\n if (!wanted.has(slotName)) {\n this.retireDelegatedSlot(slotName);\n }\n }\n }\n\n protected render() {\n const { renderedContent } = this;\n return html`<div class=\"cds-aichat-markdown-stack\">\n ${renderedContent}\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-aichat-markdown': CDSAIChatMarkdown;\n }\n}\n\nexport { CDSAIChatMarkdown };\nexport default CDSAIChatMarkdown;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAkCH,MAAM,cAAc,GAAG,6BAA6B;AAEpD;;;;;AAKG;AACH,SAAS,kBAAkB,CAAC,IAAU,EAAE,QAAc,EAAA;IACpD,IAAI,GAAG,GAAgB,IAAI;AAC3B,IAAA,OAAO,GAAG,IAAI,GAAG,KAAK,QAAQ,EAAE;QAC9B,IAAI,GAAG,YAAY,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;AACtD,YAAA,OAAO,IAAI;QACb;AACA,QAAA,GAAG,GAAG,GAAG,CAAC,UAAU;IACtB;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;AAIG;AACH,SAAS,0BAA0B,CAAC,OAAgB,EAAA;IAClD,IAAI,GAAG,GAAG,EAAE;AACZ,IAAA,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAClD,IAAI,KAAK,YAAY,OAAO,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YAC1D;QACF;QACA,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE;AACrC,YAAA,GAAG,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE;QAC9B;AAAO,aAAA,IAAI,KAAK,YAAY,OAAO,EAAE;AACnC,YAAA,GAAG,IAAI,KAAK,CAAC,WAAW,IAAI,EA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AAA;AADtB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,SAAA,CAAW;AAC7B,CAAA,EAAA,iBAAiB,CAg4BtB;AASD,0BAAe,iBAAiB;;"}
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { css } from 'lit';
9
9
 
10
- var styles = css(["@charset \"UTF-8\";:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;display:block;font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);inline-size:100%;letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857);max-inline-size:100%}:host mark{background-color:var(--cds-highlight,#d0e2ff);border-radius:.25rem;color:var(--cds-text-primary,#161616)}:host b,:host strong{font-weight:700}:host em,:host i{font-style:italic}:host blockquote{border-inline-start:2px solid var(--cds-border-subtle-00,#e0e0e0);padding-inline-start:.5rem}:host blockquote>:not(:first-child){margin-block-start:1rem}:host blockquote>h1+:not(:first-child),:host blockquote>h2+:not(:first-child),:host blockquote>h3+:not(:first-child),:host blockquote>h4+:not(:first-child),:host blockquote>h5+:not(:first-child),:host blockquote>h6+:not(:first-child){margin-block-start:.5rem}:host .cds-aichat-markdown-stack{display:block;max-inline-size:100%}:host .cds-aichat-markdown-stack>slot{display:block}:host .cds-aichat-markdown-stack>:not(:first-child){margin-block-start:1rem}:host .cds-aichat-markdown-stack>h1+:not(:first-child),:host .cds-aichat-markdown-stack>h2+:not(:first-child),:host .cds-aichat-markdown-stack>h3+:not(:first-child),:host .cds-aichat-markdown-stack>h4+:not(:first-child),:host .cds-aichat-markdown-stack>h5+:not(:first-child),:host .cds-aichat-markdown-stack>h6+:not(:first-child){margin-block-start:.25rem}:host p{font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857)}:host a{color:var(--cds-link-primary,#0f62fe);outline:none;text-decoration:none}@media (prefers-reduced-motion:no-preference){:host a{transition:color motion(standard,productive) 70ms}}:host a:hover{color:var(--cds-link-primary-hover,#0043ce);text-decoration:underline}:host a:focus{outline:1px solid var(--cds-focus,#0f62fe)}@media screen and (prefers-contrast){:host a:focus{outline-style:dotted}}:host a:focus{outline-color:var(--cds-focus,#0f62fe);text-decoration:underline}:host a:visited{color:var(--cds-link-primary,#0f62fe)}:host a:active{outline:1px solid var(--cds-focus,#0f62fe)}@media screen and (prefers-contrast){:host a:active{outline-style:dotted}}:host a:active{color:var(--cds-link-primary,#0f62fe);outline-color:var(--cds-focus,#0f62fe);text-decoration:underline}:host a:visited:hover{color:var(--cds-link-primary-hover,#0043ce)}:host a:active:visited,:host a:active:visited:hover{outline:1px solid var(--cds-focus,#0f62fe)}@media screen and (prefers-contrast){:host a:active:visited,:host a:active:visited:hover{outline-style:dotted}}:host a:active:visited,:host a:active:visited:hover{color:var(--cds-link-primary,#0f62fe);outline-color:var(--cds-focus,#0f62fe);text-decoration:underline}:host pre{background-color:var(--cds-layer-02,#fff);border:1px solid var(--cds-chat-bubble-border,#e0e0e0);font-family:var(--cds-code-02-font-family,\"IBM Plex Mono\",system-ui,-apple-system,BlinkMacSystemFont,\".SFNSText-Regular\",monospace);font-size:var(--cds-code-02-font-size,.875rem);font-weight:var(--cds-code-02-font-weight,400);letter-spacing:var(--cds-code-02-letter-spacing,.32px);line-height:var(--cds-code-02-line-height,1.42857);overflow:auto hidden;padding:1rem;white-space:pre-wrap}:host hr{background-color:var(--cds-border-subtle-01,#c6c6c6);block-size:1px;border:0;margin:0}:host img{max-inline-size:100%}:host h1{font-size:var(--cds-heading-04-font-size,1.75rem);font-weight:var(--cds-heading-04-font-weight,400);letter-spacing:var(--cds-heading-04-letter-spacing,0);line-height:var(--cds-heading-04-line-height,1.28572)}:host h2{font-size:var(--cds-heading-03-font-size,1.25rem);font-weight:var(--cds-heading-03-font-weight,400);letter-spacing:var(--cds-heading-03-letter-spacing,0);line-height:var(--cds-heading-03-line-height,1.4)}:host h3{font-size:var(--cds-heading-02-font-size,1rem);font-weight:var(--cds-heading-02-font-weight,600);letter-spacing:var(--cds-heading-02-letter-spacing,0);line-height:var(--cds-heading-02-line-height,1.5)}:host h4{font-size:var(--cds-heading-01-font-size,.875rem);font-weight:var(--cds-heading-01-font-weight,600);letter-spacing:var(--cds-heading-01-letter-spacing,.16px);line-height:var(--cds-heading-01-line-height,1.42857)}:host h5{font-size:var(--cds-heading-01-font-size,.875rem);font-weight:var(--cds-heading-01-font-weight,600);letter-spacing:var(--cds-heading-01-letter-spacing,.16px);line-height:var(--cds-heading-01-line-height,1.42857)}:host h6{font-size:var(--cds-heading-01-font-size,.875rem);font-weight:var(--cds-heading-01-font-weight,600);letter-spacing:var(--cds-heading-01-letter-spacing,.16px);line-height:var(--cds-heading-01-line-height,1.42857)}:host ol,:host ul{font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857);list-style:none;margin:0;padding:0}:host li{padding-inline-start:.25rem}:host li+li{margin-block-start:.5rem}:host ul{margin-inline-start:1rem}:host ul>li{color:var(--cds-text-primary,#161616);position:relative}:host ul>li:before{content:\"–\";inset-inline-start:-1rem;position:absolute}:host ol{counter-reset:item;margin-inline-start:1rem}:host ol>li{color:var(--cds-text-primary,#161616);position:relative}:host ol>li:before{content:counter(item) \".\";counter-increment:item;inset-inline-start:-1rem;position:absolute}:host ol ol,:host ol ul,:host ul ol,:host ul ul{margin-block-start:.5rem;margin-inline-start:2rem}:host ul ul>li:before{content:\"▪\";inset-inline-start:-.75rem}:host ol ol{list-style-type:lower-latin}:host ol ol>li:before{content:counter(item,lower-latin) \".\"}:host .cds-aichat-table--square{--cds-aichat-border-radius-start-start:0;--cds-aichat-border-radius-start-end:0;--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}:host cds-ordered-list cds-list-item:not([nested]){margin-inline-start:1rem}:host cds-aichat-code-snippet{display:block}:host cds-aichat-code-snippet:not(:defined){display:none}:host([phone]){font-size:var(--cds-body-02-font-size,1rem);font-weight:var(--cds-body-02-font-weight,400);letter-spacing:var(--cds-body-02-letter-spacing,0);line-height:var(--cds-body-02-line-height,1.5)}:host([phone]) p{font-size:var(--cds-body-02-font-size,1rem);font-weight:var(--cds-body-02-font-weight,400);letter-spacing:var(--cds-body-02-letter-spacing,0);line-height:var(--cds-body-02-line-height,1.5)}:host([phone]) ol,:host([phone]) ul{font-size:var(--cds-body-02-font-size,1rem);font-weight:var(--cds-body-02-font-weight,400);letter-spacing:var(--cds-body-02-letter-spacing,0);line-height:var(--cds-body-02-line-height,1.5)}"]);
10
+ var styles = css(["@charset \"UTF-8\";:host{display:block;inline-size:100%;max-inline-size:100%;--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857)}:host mark{background-color:var(--cds-highlight,#d0e2ff);border-radius:.25rem;color:var(--cds-text-primary,#161616)}:host b,:host strong{font-weight:700}:host em,:host i{font-style:italic}:host blockquote{border-inline-start:2px solid var(--cds-border-subtle-00,#e0e0e0);padding-inline-start:.5rem}:host blockquote>:not(:first-child){margin-block-start:1rem}:host blockquote>h1+:not(:first-child),:host blockquote>h2+:not(:first-child),:host blockquote>h3+:not(:first-child),:host blockquote>h4+:not(:first-child),:host blockquote>h5+:not(:first-child),:host blockquote>h6+:not(:first-child){margin-block-start:.5rem}:host .cds-aichat-markdown-stack{display:block;max-inline-size:100%}:host .cds-aichat-markdown-stack>slot{display:block}:host .cds-aichat-markdown-stack>:not(:first-child){margin-block-start:1rem}:host .cds-aichat-markdown-stack>h1+:not(:first-child),:host .cds-aichat-markdown-stack>h2+:not(:first-child),:host .cds-aichat-markdown-stack>h3+:not(:first-child),:host .cds-aichat-markdown-stack>h4+:not(:first-child),:host .cds-aichat-markdown-stack>h5+:not(:first-child),:host .cds-aichat-markdown-stack>h6+:not(:first-child){margin-block-start:.25rem}:host p{font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857)}:host a{color:var(--cds-link-primary,#0f62fe);outline:none;text-decoration:none}@media (prefers-reduced-motion:no-preference){:host a{transition:color motion(standard,productive) 70ms}}:host a:hover{color:var(--cds-link-primary-hover,#0043ce);text-decoration:underline}:host a:focus{outline:1px solid var(--cds-focus,#0f62fe)}@media screen and (prefers-contrast){:host a:focus{outline-style:dotted}}:host a:focus{outline-color:var(--cds-focus,#0f62fe);text-decoration:underline}:host a:visited{color:var(--cds-link-primary,#0f62fe)}:host a:active{outline:1px solid var(--cds-focus,#0f62fe)}@media screen and (prefers-contrast){:host a:active{outline-style:dotted}}:host a:active{color:var(--cds-link-primary,#0f62fe);outline-color:var(--cds-focus,#0f62fe);text-decoration:underline}:host a:visited:hover{color:var(--cds-link-primary-hover,#0043ce)}:host a:active:visited,:host a:active:visited:hover{outline:1px solid var(--cds-focus,#0f62fe)}@media screen and (prefers-contrast){:host a:active:visited,:host a:active:visited:hover{outline-style:dotted}}:host a:active:visited,:host a:active:visited:hover{color:var(--cds-link-primary,#0f62fe);outline-color:var(--cds-focus,#0f62fe);text-decoration:underline}:host pre{background-color:var(--cds-layer-02,#fff);border:1px solid var(--cds-chat-bubble-border,#e0e0e0);font-family:var(--cds-code-02-font-family,\"IBM Plex Mono\",system-ui,-apple-system,BlinkMacSystemFont,\".SFNSText-Regular\",monospace);font-size:var(--cds-code-02-font-size,.875rem);font-weight:var(--cds-code-02-font-weight,400);letter-spacing:var(--cds-code-02-letter-spacing,.32px);line-height:var(--cds-code-02-line-height,1.42857);overflow:auto hidden;padding:1rem;white-space:pre-wrap}:host hr{background-color:var(--cds-border-subtle-01,#c6c6c6);block-size:1px;border:0;margin:0}:host img{max-inline-size:100%}:host h1{font-size:var(--cds-heading-04-font-size,1.75rem);font-weight:var(--cds-heading-04-font-weight,400);letter-spacing:var(--cds-heading-04-letter-spacing,0);line-height:var(--cds-heading-04-line-height,1.28572)}:host h2{font-size:var(--cds-heading-03-font-size,1.25rem);font-weight:var(--cds-heading-03-font-weight,400);letter-spacing:var(--cds-heading-03-letter-spacing,0);line-height:var(--cds-heading-03-line-height,1.4)}:host h3{font-size:var(--cds-heading-02-font-size,1rem);font-weight:var(--cds-heading-02-font-weight,600);letter-spacing:var(--cds-heading-02-letter-spacing,0);line-height:var(--cds-heading-02-line-height,1.5)}:host h4{font-size:var(--cds-heading-01-font-size,.875rem);font-weight:var(--cds-heading-01-font-weight,600);letter-spacing:var(--cds-heading-01-letter-spacing,.16px);line-height:var(--cds-heading-01-line-height,1.42857)}:host h5{font-size:var(--cds-heading-01-font-size,.875rem);font-weight:var(--cds-heading-01-font-weight,600);letter-spacing:var(--cds-heading-01-letter-spacing,.16px);line-height:var(--cds-heading-01-line-height,1.42857)}:host h6{font-size:var(--cds-heading-01-font-size,.875rem);font-weight:var(--cds-heading-01-font-weight,600);letter-spacing:var(--cds-heading-01-letter-spacing,.16px);line-height:var(--cds-heading-01-line-height,1.42857)}:host ol,:host ul{font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857);list-style:none;margin:0;padding:0}:host li{padding-inline-start:.25rem}:host li+li{margin-block-start:.5rem}:host ul{margin-inline-start:1rem}:host ul>li{color:var(--cds-text-primary,#161616);position:relative}:host ul>li:before{content:\"–\";inset-inline-start:-1rem;position:absolute}:host ol{counter-reset:item;margin-inline-start:1rem}:host ol>li{color:var(--cds-text-primary,#161616);position:relative}:host ol>li:before{content:counter(item) \".\";counter-increment:item;inset-inline-start:-1rem;position:absolute}:host ol ol,:host ol ul,:host ul ol,:host ul ul{margin-block-start:.5rem;margin-inline-start:2rem}:host ul ul>li:before{content:\"▪\";inset-inline-start:-.75rem}:host ol ol{list-style-type:lower-latin}:host ol ol>li:before{content:counter(item,lower-latin) \".\"}:host .cds-aichat-table--square{--cds-aichat-border-radius-start-start:0;--cds-aichat-border-radius-start-end:0;--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}:host cds-ordered-list cds-list-item:not([nested]){margin-inline-start:1rem}:host cds-aichat-code-snippet{display:block}:host cds-aichat-code-snippet:not(:defined){display:none}:host([phone]){font-size:var(--cds-body-02-font-size,1rem);font-weight:var(--cds-body-02-font-weight,400);letter-spacing:var(--cds-body-02-letter-spacing,0);line-height:var(--cds-body-02-line-height,1.5)}:host([phone]) p{font-size:var(--cds-body-02-font-size,1rem);font-weight:var(--cds-body-02-font-weight,400);letter-spacing:var(--cds-body-02-letter-spacing,0);line-height:var(--cds-body-02-line-height,1.5)}:host([phone]) ol,:host([phone]) ul{font-size:var(--cds-body-02-font-size,1rem);font-weight:var(--cds-body-02-font-weight,400);letter-spacing:var(--cds-body-02-letter-spacing,0);line-height:var(--cds-body-02-line-height,1.5)}"]);
11
11
 
12
12
  export { styles as default };
13
13
  //# sourceMappingURL=markdown.scss.js.map
@@ -0,0 +1,15 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import { Directive, type ChildPart } from 'lit/directive.js';
3
+ export declare function installInlineRunStyles(host: HTMLElement): () => void;
4
+ declare class ProjectedInlinePlugin extends Directive {
5
+ render(_markup: string, fallback: string): string;
6
+ update(part: ChildPart, [markup, fallback]: [string, string]): string | TemplateResult<1>;
7
+ }
8
+ export declare const projectedInlinePlugin: (_markup: string, fallback: string) => import("lit-html/directive.js").DirectiveResult<typeof ProjectedInlinePlugin>;
9
+ interface InlineRunOptions {
10
+ slotName: string;
11
+ fallbackHost?: HTMLElement;
12
+ resetInlineStyles?: boolean;
13
+ }
14
+ export declare function projectInlineRun(content: TemplateResult, options: InlineRunOptions): TemplateResult;
15
+ export {};