@carbon/ai-chat-components 1.9.0 → 1.10.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 (562) hide show
  1. package/custom-elements.json +163 -2
  2. package/es/components/audio-player/src/audio-player.js.map +1 -1
  3. package/es/components/audio-player/src/audio-player.scss.js.map +1 -1
  4. package/es/components/audio-player/src/providers/base-provider.js.map +1 -1
  5. package/es/components/audio-player/src/providers/native-audio-provider.js.map +1 -1
  6. package/es/components/audio-player/src/providers/soundcloud-provider.js.map +1 -1
  7. package/es/components/audio-player/src/transcript.js.map +1 -1
  8. package/es/components/audio-player/src/transcript.scss.js.map +1 -1
  9. package/es/components/audio-player/src/utils/url-detector.js.map +1 -1
  10. package/es/components/card/src/card-footer.js.map +1 -1
  11. package/es/components/card/src/card-footer.scss.js.map +1 -1
  12. package/es/components/card/src/card-steps.js.map +1 -1
  13. package/es/components/card/src/card-steps.scss.js.map +1 -1
  14. package/es/components/card/src/card.js.map +1 -1
  15. package/es/components/card/src/card.scss.js.map +1 -1
  16. package/es/components/carousel/src/carousel.js.map +1 -1
  17. package/es/components/carousel/src/carousel.scss.js.map +1 -1
  18. package/es/components/chain-of-thought/defs.js.map +1 -1
  19. package/es/components/chain-of-thought/src/chain-of-thought-step.js.map +1 -1
  20. package/es/components/chain-of-thought/src/chain-of-thought-step.scss.js.map +1 -1
  21. package/es/components/chain-of-thought/src/chain-of-thought-toggle.js.map +1 -1
  22. package/es/components/chain-of-thought/src/chain-of-thought-toggle.scss.js.map +1 -1
  23. package/es/components/chain-of-thought/src/chain-of-thought.js.map +1 -1
  24. package/es/components/chain-of-thought/src/chain-of-thought.scss.js.map +1 -1
  25. package/es/components/chain-of-thought/src/tool-call-data.js.map +1 -1
  26. package/es/components/chain-of-thought/src/tool-call-data.scss.js.map +1 -1
  27. package/es/components/chat-button/defs.js.map +1 -1
  28. package/es/components/chat-button/index.d.ts +1 -0
  29. package/es/components/chat-button/index.js +1 -0
  30. package/es/components/chat-button/index.js.map +1 -1
  31. package/es/components/chat-button/src/chat-button-skeleton.d.ts +30 -0
  32. package/es/components/chat-button/src/chat-button-skeleton.js +41 -0
  33. package/es/components/chat-button/src/chat-button-skeleton.js.map +1 -0
  34. package/es/components/chat-button/src/chat-button.d.ts +4 -1
  35. package/es/components/chat-button/src/chat-button.js +30 -2
  36. package/es/components/chat-button/src/chat-button.js.map +1 -1
  37. package/es/components/chat-button/src/chat-button.scss.js +1 -1
  38. package/es/components/chat-button/src/chat-button.scss.js.map +1 -1
  39. package/es/components/chat-history/src/chat-history.scss.js +1 -1
  40. package/es/components/chat-history/src/chat-history.scss.js.map +1 -1
  41. package/es/components/chat-history/src/history-content.js.map +1 -1
  42. package/es/components/chat-history/src/history-delete-panel.js +1 -0
  43. package/es/components/chat-history/src/history-delete-panel.js.map +1 -1
  44. package/es/components/chat-history/src/history-header.js.map +1 -1
  45. package/es/components/chat-history/src/history-loading.js.map +1 -1
  46. package/es/components/chat-history/src/history-panel-item-input.js.map +1 -1
  47. package/es/components/chat-history/src/history-panel-item.js.map +1 -1
  48. package/es/components/chat-history/src/history-panel-items.js.map +1 -1
  49. package/es/components/chat-history/src/history-panel-menu.js.map +1 -1
  50. package/es/components/chat-history/src/history-panel.js.map +1 -1
  51. package/es/components/chat-history/src/history-search-item.js.map +1 -1
  52. package/es/components/chat-history/src/history-shell.js.map +1 -1
  53. package/es/components/chat-history/src/history-toolbar.js.map +1 -1
  54. package/es/components/chat-shell/src/chat-header.js.map +1 -1
  55. package/es/components/chat-shell/src/chat-header.scss.js.map +1 -1
  56. package/es/components/chat-shell/src/corner-manager.js.map +1 -1
  57. package/es/components/chat-shell/src/initialization-manager.js.map +1 -1
  58. package/es/components/chat-shell/src/panel-manager.js.map +1 -1
  59. package/es/components/chat-shell/src/panel.js.map +1 -1
  60. package/es/components/chat-shell/src/panel.scss.js.map +1 -1
  61. package/es/components/chat-shell/src/resize-observer-manager.js.map +1 -1
  62. package/es/components/chat-shell/src/shell.js.map +1 -1
  63. package/es/components/chat-shell/src/shell.scss.js.map +1 -1
  64. package/es/components/chat-shell/src/slot-observer.js.map +1 -1
  65. package/es/components/chat-shell/src/workspace-manager-utils.js.map +1 -1
  66. package/es/components/chat-shell/src/workspace-manager.js.map +1 -1
  67. package/es/components/code-snippet/src/code-snippet.js.map +1 -1
  68. package/es/components/code-snippet/src/code-snippet.scss.js.map +1 -1
  69. package/es/components/code-snippet/src/codemirror/base-setup.js.map +1 -1
  70. package/es/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -1
  71. package/es/components/code-snippet/src/codemirror/content-sync.js.map +1 -1
  72. package/es/components/code-snippet/src/codemirror/detect-language.js.map +1 -1
  73. package/es/components/code-snippet/src/codemirror/diff-decorator.js.map +1 -1
  74. package/es/components/code-snippet/src/codemirror/editor-manager.js.map +1 -1
  75. package/es/components/code-snippet/src/codemirror/language-controller.js.map +1 -1
  76. package/es/components/code-snippet/src/codemirror/language-data.js.map +1 -1
  77. package/es/components/code-snippet/src/codemirror/language-utils.js.map +1 -1
  78. package/es/components/code-snippet/src/codemirror/marker-utils.js.map +1 -1
  79. package/es/components/code-snippet/src/codemirror/theme.js.map +1 -1
  80. package/es/components/code-snippet/src/dom-utils.js.map +1 -1
  81. package/es/components/code-snippet/src/formatters.js.map +1 -1
  82. package/es/components/code-snippet/src/layout-utils.js.map +1 -1
  83. package/es/components/code-snippet/src/streaming-manager.js.map +1 -1
  84. package/es/components/feedback/src/feedback-buttons.js.map +1 -1
  85. package/es/components/feedback/src/feedback-buttons.scss.js.map +1 -1
  86. package/es/components/feedback/src/feedback.js.map +1 -1
  87. package/es/components/feedback/src/feedback.scss.js.map +1 -1
  88. package/es/components/file-uploads/src/file-type-icon.js.map +1 -1
  89. package/es/components/file-uploads/src/file-upload-item.js.map +1 -1
  90. package/es/components/file-uploads/src/file-upload-item.scss.js.map +1 -1
  91. package/es/components/file-uploads/src/file-uploads.js.map +1 -1
  92. package/es/components/file-uploads/src/file-uploads.scss.js.map +1 -1
  93. package/es/components/launcher/src/launcher.js +1 -0
  94. package/es/components/launcher/src/launcher.js.map +1 -1
  95. package/es/components/launcher/src/launcher.scss.js +1 -1
  96. package/es/components/launcher/src/launcher.scss.js.map +1 -1
  97. package/es/components/markdown/src/markdown-renderer-types.d.ts +3 -14
  98. package/es/components/markdown/src/markdown-renderer.js +0 -4
  99. package/es/components/markdown/src/markdown-renderer.js.map +1 -1
  100. package/es/components/markdown/src/markdown-token-tree.d.ts +0 -2
  101. package/es/components/markdown/src/markdown-token-tree.js.map +1 -1
  102. package/es/components/markdown/src/markdown.js +0 -1
  103. package/es/components/markdown/src/markdown.js.map +1 -1
  104. package/es/components/markdown/src/markdown.scss.js.map +1 -1
  105. package/es/components/markdown/src/markdown.template.js.map +1 -1
  106. package/es/components/markdown/src/plugins/markdown-it-attrs.js +2 -3
  107. package/es/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -1
  108. package/es/components/markdown/src/plugins/markdown-it-highlight.js.map +1 -1
  109. package/es/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -1
  110. package/es/components/markdown/src/utils/html-helpers.js.map +1 -1
  111. package/es/components/markdown/src/utils/lit-directives.js.map +1 -1
  112. package/es/components/markdown/src/utils/plugin-fallback.js +0 -1
  113. package/es/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  114. package/es/components/markdown/src/utils/slot-names.js.map +1 -1
  115. package/es/components/markdown/src/utils/streaming-table.js.map +1 -1
  116. package/es/components/markdown/src/utils/table-helpers.d.ts +10 -0
  117. package/es/components/markdown/src/utils/table-helpers.js +0 -1
  118. package/es/components/markdown/src/utils/table-helpers.js.map +1 -1
  119. package/es/components/processing/src/processing.js.map +1 -1
  120. package/es/components/processing/src/processing.scss.js.map +1 -1
  121. package/es/components/prompt-line/autocomplete/src/autocomplete.d.ts +10 -3
  122. package/es/components/prompt-line/autocomplete/src/autocomplete.js +95 -48
  123. package/es/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
  124. package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  125. package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js.map +1 -1
  126. package/es/components/prompt-line/index.d.ts +1 -1
  127. package/es/components/prompt-line/src/autocomplete-controller.d.ts +12 -1
  128. package/es/components/prompt-line/src/autocomplete-controller.js +42 -6
  129. package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  130. package/es/components/prompt-line/src/error-message.js.map +1 -1
  131. package/es/components/prompt-line/src/error-message.scss.js.map +1 -1
  132. package/es/components/prompt-line/src/prompt-line-constants.js.map +1 -1
  133. package/es/components/prompt-line/src/prompt-line-controller.js.map +1 -1
  134. package/es/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -1
  135. package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  136. package/es/components/prompt-line/src/prompt-line-shell.js.map +1 -1
  137. package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  138. package/es/components/prompt-line/src/prompt-line-shell.scss.js.map +1 -1
  139. package/es/components/prompt-line/src/prompt-line.js.map +1 -1
  140. package/es/components/prompt-line/src/prompt-line.scss.js.map +1 -1
  141. package/es/components/prompt-line/src/send-control.js.map +1 -1
  142. package/es/components/prompt-line/src/send-control.scss.js.map +1 -1
  143. package/es/components/prompt-line/src/stop-streaming-button.js.map +1 -1
  144. package/es/components/prompt-line/src/stop-streaming-button.scss.js.map +1 -1
  145. package/es/components/prompt-line/src/tiptap/build-extensions.d.ts +17 -0
  146. package/es/components/prompt-line/src/tiptap/build-extensions.js.map +1 -1
  147. package/es/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +12 -0
  148. package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -1
  149. package/es/components/prompt-line/src/tiptap/carbon-mention.js +1 -0
  150. package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
  151. package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js +2 -3
  152. package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -1
  153. package/es/components/prompt-line/src/tiptap/chat-enter.js.map +1 -1
  154. package/es/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
  155. package/es/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -1
  156. package/es/components/prompt-line/src/tiptap/index.d.ts +1 -1
  157. package/es/components/prompt-line/src/tiptap/json-utils.js.map +1 -1
  158. package/es/components/prompt-line/src/tiptap/keymap.js.map +1 -1
  159. package/es/components/prompt-line/src/tiptap/origin-meta.js.map +1 -1
  160. package/es/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -1
  161. package/es/components/prompt-line/src/tiptap/render-in-light-dom.js.map +1 -1
  162. package/es/components/prompt-line/src/tiptap/render-token-chip.d.ts +12 -0
  163. package/es/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -1
  164. package/es/components/prompt-line/src/tiptap/token-node-view.js.map +1 -1
  165. package/es/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -1
  166. package/es/components/prompt-line/src/tiptap/types.d.ts +18 -4
  167. package/es/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -1
  168. package/es/components/prompt-line/src/tiptap/value-sync.js.map +1 -1
  169. package/es/components/prompt-line/src/types.js.map +1 -1
  170. package/es/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  171. package/es/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  172. package/es/components/reasoning-steps/src/reasoning-step.scss.js.map +1 -1
  173. package/es/components/reasoning-steps/src/reasoning-steps-toggle.js.map +1 -1
  174. package/es/components/reasoning-steps/src/reasoning-steps-toggle.scss.js.map +1 -1
  175. package/es/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
  176. package/es/components/reasoning-steps/src/reasoning-steps.scss.js +1 -1
  177. package/es/components/reasoning-steps/src/reasoning-steps.scss.js.map +1 -1
  178. package/es/components/shared/dynamic-css-var-sheet.js +24 -2
  179. package/es/components/shared/dynamic-css-var-sheet.js.map +1 -1
  180. package/es/components/shared/media-utils/script-loader.js.map +1 -1
  181. package/es/components/table/src/table-loader.js.map +1 -1
  182. package/es/components/table/src/table-pagination.template.js.map +1 -1
  183. package/es/components/table/src/table-skeleton.template.js.map +1 -1
  184. package/es/components/table/src/table.js.map +1 -1
  185. package/es/components/table/src/table.scss.js.map +1 -1
  186. package/es/components/table/src/table.template.js.map +1 -1
  187. package/es/components/toolbar/src/toolbar.js.map +1 -1
  188. package/es/components/toolbar/src/toolbar.scss.js +1 -1
  189. package/es/components/toolbar/src/toolbar.scss.js.map +1 -1
  190. package/es/components/truncated-text/src/truncated-text.js.map +1 -1
  191. package/es/components/truncated-text/src/truncated-text.scss.js.map +1 -1
  192. package/es/components/video-player/src/providers/base-provider.js.map +1 -1
  193. package/es/components/video-player/src/providers/kaltura-provider.js.map +1 -1
  194. package/es/components/video-player/src/providers/native-video-provider.js.map +1 -1
  195. package/es/components/video-player/src/providers/vimeo-provider.js.map +1 -1
  196. package/es/components/video-player/src/providers/youtube-provider.js.map +1 -1
  197. package/es/components/video-player/src/utils/url-detector.js.map +1 -1
  198. package/es/components/video-player/src/video-player.js.map +1 -1
  199. package/es/components/video-player/src/video-player.scss.js.map +1 -1
  200. package/es/components/workspace-shell/src/header-collapsible-manager.js.map +1 -1
  201. package/es/components/workspace-shell/src/workspace-shell-body.js.map +1 -1
  202. package/es/components/workspace-shell/src/workspace-shell-footer.js.map +1 -1
  203. package/es/components/workspace-shell/src/workspace-shell-footer.scss.js.map +1 -1
  204. package/es/components/workspace-shell/src/workspace-shell-header.js +2 -1
  205. package/es/components/workspace-shell/src/workspace-shell-header.js.map +1 -1
  206. package/es/components/workspace-shell/src/workspace-shell-header.scss.js +1 -1
  207. package/es/components/workspace-shell/src/workspace-shell-header.scss.js.map +1 -1
  208. package/es/components/workspace-shell/src/workspace-shell.js.map +1 -1
  209. package/es/components/workspace-shell/src/workspace-shell.scss.js +1 -1
  210. package/es/components/workspace-shell/src/workspace-shell.scss.js.map +1 -1
  211. package/es/globals/decorators/carbon-element.js.map +1 -1
  212. package/es/globals/scss/common.scss.js.map +1 -1
  213. package/es/globals/settings.js.map +1 -1
  214. package/es/globals/utils/aria-announcer-manager.js.map +1 -1
  215. package/es/globals/utils/browser-utils.js.map +1 -1
  216. package/es/globals/utils/csv.js.map +1 -1
  217. package/es/globals/utils/dom-utils.js.map +1 -1
  218. package/es/globals/utils/focus-utils.js.map +1 -1
  219. package/es/globals/utils/iconTransform.js.map +1 -1
  220. package/es/globals/utils/rtl-utils.js.map +1 -1
  221. package/es/globals/utils/uuid.js.map +1 -1
  222. package/es/react/ai-label-action-button.js.map +1 -1
  223. package/es/react/audio-player.js.map +1 -1
  224. package/es/react/autocomplete.js.map +1 -1
  225. package/es/react/card.js.map +1 -1
  226. package/es/react/carousel.js.map +1 -1
  227. package/es/react/chain-of-thought-step.js.map +1 -1
  228. package/es/react/chain-of-thought-toggle.js.map +1 -1
  229. package/es/react/chain-of-thought.js.map +1 -1
  230. package/es/react/chat-button-skeleton.d.ts +11 -0
  231. package/es/react/chat-button-skeleton.js +28 -0
  232. package/es/react/chat-button-skeleton.js.map +1 -0
  233. package/es/react/chat-button.js.map +1 -1
  234. package/es/react/chat-header.js.map +1 -1
  235. package/es/react/chat-shell.js.map +1 -1
  236. package/es/react/code-snippet.d.ts +1 -1
  237. package/es/react/code-snippet.js +1 -1
  238. package/es/react/code-snippet.js.map +1 -1
  239. package/es/react/error-message.js.map +1 -1
  240. package/es/react/feedback-buttons.js.map +1 -1
  241. package/es/react/feedback.js.map +1 -1
  242. package/es/react/file-upload-item.js.map +1 -1
  243. package/es/react/file-uploads.js.map +1 -1
  244. package/es/react/history/history-content.js.map +1 -1
  245. package/es/react/history/history-delete-panel.js.map +1 -1
  246. package/es/react/history/history-header.js.map +1 -1
  247. package/es/react/history/history-loading.js.map +1 -1
  248. package/es/react/history/history-panel-item-input.js.map +1 -1
  249. package/es/react/history/history-panel-item.js.map +1 -1
  250. package/es/react/history/history-panel-items.js.map +1 -1
  251. package/es/react/history/history-panel-menu.js.map +1 -1
  252. package/es/react/history/history-panel.js.map +1 -1
  253. package/es/react/history/history-search-item.js.map +1 -1
  254. package/es/react/history/history-shell.js.map +1 -1
  255. package/es/react/history/history-toolbar.js.map +1 -1
  256. package/es/react/hooks/useChatAutocomplete.js +4 -3
  257. package/es/react/hooks/useChatAutocomplete.js.map +1 -1
  258. package/es/react/input-send-control.js.map +1 -1
  259. package/es/react/launcher.js.map +1 -1
  260. package/es/react/markdown.js.map +1 -1
  261. package/es/react/panel.js.map +1 -1
  262. package/es/react/processing.js.map +1 -1
  263. package/es/react/prompt-line-shell.js.map +1 -1
  264. package/es/react/prompt-line.js.map +1 -1
  265. package/es/react/reasoning-step.js.map +1 -1
  266. package/es/react/reasoning-steps-toggle.js.map +1 -1
  267. package/es/react/reasoning-steps.js.map +1 -1
  268. package/es/react/stop-streaming-button.js.map +1 -1
  269. package/es/react/table.js.map +1 -1
  270. package/es/react/tool-call-data.js.map +1 -1
  271. package/es/react/toolbar.js +1 -1
  272. package/es/react/toolbar.js.map +1 -1
  273. package/es/react/transcript.js.map +1 -1
  274. package/es/react/utils/transformSuggestionConfig.js.map +1 -1
  275. package/es/react/utils/withWebComponentBridge.js.map +1 -1
  276. package/es/react/video-player.js.map +1 -1
  277. package/es/react/workspace-shell.js.map +1 -1
  278. package/es/testing/PageObjectId.js.map +1 -1
  279. package/es/testing/load-all-lazy-deps.js.map +1 -1
  280. package/es-custom/components/audio-player/src/audio-player.js.map +1 -1
  281. package/es-custom/components/audio-player/src/audio-player.scss.js.map +1 -1
  282. package/es-custom/components/audio-player/src/providers/base-provider.js.map +1 -1
  283. package/es-custom/components/audio-player/src/providers/native-audio-provider.js.map +1 -1
  284. package/es-custom/components/audio-player/src/providers/soundcloud-provider.js.map +1 -1
  285. package/es-custom/components/audio-player/src/transcript.js.map +1 -1
  286. package/es-custom/components/audio-player/src/transcript.scss.js.map +1 -1
  287. package/es-custom/components/audio-player/src/utils/url-detector.js.map +1 -1
  288. package/es-custom/components/card/src/card-footer.js.map +1 -1
  289. package/es-custom/components/card/src/card-footer.scss.js.map +1 -1
  290. package/es-custom/components/card/src/card-steps.js.map +1 -1
  291. package/es-custom/components/card/src/card-steps.scss.js.map +1 -1
  292. package/es-custom/components/card/src/card.js.map +1 -1
  293. package/es-custom/components/card/src/card.scss.js.map +1 -1
  294. package/es-custom/components/carousel/src/carousel.js.map +1 -1
  295. package/es-custom/components/carousel/src/carousel.scss.js.map +1 -1
  296. package/es-custom/components/chain-of-thought/defs.js.map +1 -1
  297. package/es-custom/components/chain-of-thought/src/chain-of-thought-step.js.map +1 -1
  298. package/es-custom/components/chain-of-thought/src/chain-of-thought-step.scss.js.map +1 -1
  299. package/es-custom/components/chain-of-thought/src/chain-of-thought-toggle.js.map +1 -1
  300. package/es-custom/components/chain-of-thought/src/chain-of-thought-toggle.scss.js.map +1 -1
  301. package/es-custom/components/chain-of-thought/src/chain-of-thought.js.map +1 -1
  302. package/es-custom/components/chain-of-thought/src/chain-of-thought.scss.js.map +1 -1
  303. package/es-custom/components/chain-of-thought/src/tool-call-data.js.map +1 -1
  304. package/es-custom/components/chain-of-thought/src/tool-call-data.scss.js.map +1 -1
  305. package/es-custom/components/chat-button/defs.js.map +1 -1
  306. package/es-custom/components/chat-button/index.d.ts +1 -0
  307. package/es-custom/components/chat-button/index.js +1 -0
  308. package/es-custom/components/chat-button/index.js.map +1 -1
  309. package/es-custom/components/chat-button/src/chat-button-skeleton.d.ts +30 -0
  310. package/es-custom/components/chat-button/src/chat-button-skeleton.js +41 -0
  311. package/es-custom/components/chat-button/src/chat-button-skeleton.js.map +1 -0
  312. package/es-custom/components/chat-button/src/chat-button.d.ts +4 -1
  313. package/es-custom/components/chat-button/src/chat-button.js +30 -2
  314. package/es-custom/components/chat-button/src/chat-button.js.map +1 -1
  315. package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
  316. package/es-custom/components/chat-button/src/chat-button.scss.js.map +1 -1
  317. package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
  318. package/es-custom/components/chat-history/src/chat-history.scss.js.map +1 -1
  319. package/es-custom/components/chat-history/src/history-content.js.map +1 -1
  320. package/es-custom/components/chat-history/src/history-delete-panel.js +1 -0
  321. package/es-custom/components/chat-history/src/history-delete-panel.js.map +1 -1
  322. package/es-custom/components/chat-history/src/history-header.js.map +1 -1
  323. package/es-custom/components/chat-history/src/history-loading.js.map +1 -1
  324. package/es-custom/components/chat-history/src/history-panel-item-input.js.map +1 -1
  325. package/es-custom/components/chat-history/src/history-panel-item.js.map +1 -1
  326. package/es-custom/components/chat-history/src/history-panel-items.js.map +1 -1
  327. package/es-custom/components/chat-history/src/history-panel-menu.js.map +1 -1
  328. package/es-custom/components/chat-history/src/history-panel.js.map +1 -1
  329. package/es-custom/components/chat-history/src/history-search-item.js.map +1 -1
  330. package/es-custom/components/chat-history/src/history-shell.js.map +1 -1
  331. package/es-custom/components/chat-history/src/history-toolbar.js.map +1 -1
  332. package/es-custom/components/chat-shell/src/chat-header.js.map +1 -1
  333. package/es-custom/components/chat-shell/src/chat-header.scss.js.map +1 -1
  334. package/es-custom/components/chat-shell/src/corner-manager.js.map +1 -1
  335. package/es-custom/components/chat-shell/src/initialization-manager.js.map +1 -1
  336. package/es-custom/components/chat-shell/src/panel-manager.js.map +1 -1
  337. package/es-custom/components/chat-shell/src/panel.js.map +1 -1
  338. package/es-custom/components/chat-shell/src/panel.scss.js.map +1 -1
  339. package/es-custom/components/chat-shell/src/resize-observer-manager.js.map +1 -1
  340. package/es-custom/components/chat-shell/src/shell.js.map +1 -1
  341. package/es-custom/components/chat-shell/src/shell.scss.js.map +1 -1
  342. package/es-custom/components/chat-shell/src/slot-observer.js.map +1 -1
  343. package/es-custom/components/chat-shell/src/workspace-manager-utils.js.map +1 -1
  344. package/es-custom/components/chat-shell/src/workspace-manager.js.map +1 -1
  345. package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
  346. package/es-custom/components/code-snippet/src/code-snippet.scss.js.map +1 -1
  347. package/es-custom/components/code-snippet/src/codemirror/base-setup.js.map +1 -1
  348. package/es-custom/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -1
  349. package/es-custom/components/code-snippet/src/codemirror/content-sync.js.map +1 -1
  350. package/es-custom/components/code-snippet/src/codemirror/detect-language.js.map +1 -1
  351. package/es-custom/components/code-snippet/src/codemirror/diff-decorator.js.map +1 -1
  352. package/es-custom/components/code-snippet/src/codemirror/editor-manager.js.map +1 -1
  353. package/es-custom/components/code-snippet/src/codemirror/language-controller.js.map +1 -1
  354. package/es-custom/components/code-snippet/src/codemirror/language-data.js.map +1 -1
  355. package/es-custom/components/code-snippet/src/codemirror/language-utils.js.map +1 -1
  356. package/es-custom/components/code-snippet/src/codemirror/marker-utils.js.map +1 -1
  357. package/es-custom/components/code-snippet/src/codemirror/theme.js.map +1 -1
  358. package/es-custom/components/code-snippet/src/dom-utils.js.map +1 -1
  359. package/es-custom/components/code-snippet/src/formatters.js.map +1 -1
  360. package/es-custom/components/code-snippet/src/layout-utils.js.map +1 -1
  361. package/es-custom/components/code-snippet/src/streaming-manager.js.map +1 -1
  362. package/es-custom/components/feedback/src/feedback-buttons.js.map +1 -1
  363. package/es-custom/components/feedback/src/feedback-buttons.scss.js.map +1 -1
  364. package/es-custom/components/feedback/src/feedback.js.map +1 -1
  365. package/es-custom/components/feedback/src/feedback.scss.js.map +1 -1
  366. package/es-custom/components/file-uploads/src/file-type-icon.js.map +1 -1
  367. package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -1
  368. package/es-custom/components/file-uploads/src/file-upload-item.scss.js.map +1 -1
  369. package/es-custom/components/file-uploads/src/file-uploads.js.map +1 -1
  370. package/es-custom/components/file-uploads/src/file-uploads.scss.js.map +1 -1
  371. package/es-custom/components/launcher/src/launcher.js +1 -0
  372. package/es-custom/components/launcher/src/launcher.js.map +1 -1
  373. package/es-custom/components/launcher/src/launcher.scss.js +1 -1
  374. package/es-custom/components/launcher/src/launcher.scss.js.map +1 -1
  375. package/es-custom/components/markdown/src/markdown-renderer-types.d.ts +3 -14
  376. package/es-custom/components/markdown/src/markdown-renderer.js +0 -4
  377. package/es-custom/components/markdown/src/markdown-renderer.js.map +1 -1
  378. package/es-custom/components/markdown/src/markdown-token-tree.d.ts +0 -2
  379. package/es-custom/components/markdown/src/markdown-token-tree.js.map +1 -1
  380. package/es-custom/components/markdown/src/markdown.js +0 -1
  381. package/es-custom/components/markdown/src/markdown.js.map +1 -1
  382. package/es-custom/components/markdown/src/markdown.scss.js.map +1 -1
  383. package/es-custom/components/markdown/src/markdown.template.js.map +1 -1
  384. package/es-custom/components/markdown/src/plugins/markdown-it-attrs.js +2 -3
  385. package/es-custom/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -1
  386. package/es-custom/components/markdown/src/plugins/markdown-it-highlight.js.map +1 -1
  387. package/es-custom/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -1
  388. package/es-custom/components/markdown/src/utils/html-helpers.js.map +1 -1
  389. package/es-custom/components/markdown/src/utils/lit-directives.js.map +1 -1
  390. package/es-custom/components/markdown/src/utils/plugin-fallback.js +0 -1
  391. package/es-custom/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  392. package/es-custom/components/markdown/src/utils/slot-names.js.map +1 -1
  393. package/es-custom/components/markdown/src/utils/streaming-table.js.map +1 -1
  394. package/es-custom/components/markdown/src/utils/table-helpers.d.ts +10 -0
  395. package/es-custom/components/markdown/src/utils/table-helpers.js +0 -1
  396. package/es-custom/components/markdown/src/utils/table-helpers.js.map +1 -1
  397. package/es-custom/components/processing/src/processing.js.map +1 -1
  398. package/es-custom/components/processing/src/processing.scss.js.map +1 -1
  399. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.d.ts +10 -3
  400. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js +95 -48
  401. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
  402. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  403. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js.map +1 -1
  404. package/es-custom/components/prompt-line/index.d.ts +1 -1
  405. package/es-custom/components/prompt-line/src/autocomplete-controller.d.ts +12 -1
  406. package/es-custom/components/prompt-line/src/autocomplete-controller.js +42 -6
  407. package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  408. package/es-custom/components/prompt-line/src/error-message.js.map +1 -1
  409. package/es-custom/components/prompt-line/src/error-message.scss.js.map +1 -1
  410. package/es-custom/components/prompt-line/src/prompt-line-constants.js.map +1 -1
  411. package/es-custom/components/prompt-line/src/prompt-line-controller.js.map +1 -1
  412. package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -1
  413. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  414. package/es-custom/components/prompt-line/src/prompt-line-shell.js.map +1 -1
  415. package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  416. package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js.map +1 -1
  417. package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
  418. package/es-custom/components/prompt-line/src/prompt-line.scss.js.map +1 -1
  419. package/es-custom/components/prompt-line/src/send-control.js.map +1 -1
  420. package/es-custom/components/prompt-line/src/send-control.scss.js.map +1 -1
  421. package/es-custom/components/prompt-line/src/stop-streaming-button.js.map +1 -1
  422. package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js.map +1 -1
  423. package/es-custom/components/prompt-line/src/tiptap/build-extensions.d.ts +17 -0
  424. package/es-custom/components/prompt-line/src/tiptap/build-extensions.js.map +1 -1
  425. package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +12 -0
  426. package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -1
  427. package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js +1 -0
  428. package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
  429. package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js +2 -3
  430. package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -1
  431. package/es-custom/components/prompt-line/src/tiptap/chat-enter.js.map +1 -1
  432. package/es-custom/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
  433. package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -1
  434. package/es-custom/components/prompt-line/src/tiptap/index.d.ts +1 -1
  435. package/es-custom/components/prompt-line/src/tiptap/json-utils.js.map +1 -1
  436. package/es-custom/components/prompt-line/src/tiptap/keymap.js.map +1 -1
  437. package/es-custom/components/prompt-line/src/tiptap/origin-meta.js.map +1 -1
  438. package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -1
  439. package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.js.map +1 -1
  440. package/es-custom/components/prompt-line/src/tiptap/render-token-chip.d.ts +12 -0
  441. package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -1
  442. package/es-custom/components/prompt-line/src/tiptap/token-node-view.js.map +1 -1
  443. package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -1
  444. package/es-custom/components/prompt-line/src/tiptap/types.d.ts +18 -4
  445. package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -1
  446. package/es-custom/components/prompt-line/src/tiptap/value-sync.js.map +1 -1
  447. package/es-custom/components/prompt-line/src/types.js.map +1 -1
  448. package/es-custom/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  449. package/es-custom/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  450. package/es-custom/components/reasoning-steps/src/reasoning-step.scss.js.map +1 -1
  451. package/es-custom/components/reasoning-steps/src/reasoning-steps-toggle.js.map +1 -1
  452. package/es-custom/components/reasoning-steps/src/reasoning-steps-toggle.scss.js.map +1 -1
  453. package/es-custom/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
  454. package/es-custom/components/reasoning-steps/src/reasoning-steps.scss.js +1 -1
  455. package/es-custom/components/reasoning-steps/src/reasoning-steps.scss.js.map +1 -1
  456. package/es-custom/components/shared/dynamic-css-var-sheet.js +24 -2
  457. package/es-custom/components/shared/dynamic-css-var-sheet.js.map +1 -1
  458. package/es-custom/components/shared/media-utils/script-loader.js.map +1 -1
  459. package/es-custom/components/table/src/table-loader.js.map +1 -1
  460. package/es-custom/components/table/src/table-pagination.template.js.map +1 -1
  461. package/es-custom/components/table/src/table-skeleton.template.js.map +1 -1
  462. package/es-custom/components/table/src/table.js.map +1 -1
  463. package/es-custom/components/table/src/table.scss.js.map +1 -1
  464. package/es-custom/components/table/src/table.template.js.map +1 -1
  465. package/es-custom/components/toolbar/src/toolbar.js.map +1 -1
  466. package/es-custom/components/toolbar/src/toolbar.scss.js +1 -1
  467. package/es-custom/components/toolbar/src/toolbar.scss.js.map +1 -1
  468. package/es-custom/components/truncated-text/src/truncated-text.js.map +1 -1
  469. package/es-custom/components/truncated-text/src/truncated-text.scss.js.map +1 -1
  470. package/es-custom/components/video-player/src/providers/base-provider.js.map +1 -1
  471. package/es-custom/components/video-player/src/providers/kaltura-provider.js.map +1 -1
  472. package/es-custom/components/video-player/src/providers/native-video-provider.js.map +1 -1
  473. package/es-custom/components/video-player/src/providers/vimeo-provider.js.map +1 -1
  474. package/es-custom/components/video-player/src/providers/youtube-provider.js.map +1 -1
  475. package/es-custom/components/video-player/src/utils/url-detector.js.map +1 -1
  476. package/es-custom/components/video-player/src/video-player.js.map +1 -1
  477. package/es-custom/components/video-player/src/video-player.scss.js.map +1 -1
  478. package/es-custom/components/workspace-shell/src/header-collapsible-manager.js.map +1 -1
  479. package/es-custom/components/workspace-shell/src/workspace-shell-body.js.map +1 -1
  480. package/es-custom/components/workspace-shell/src/workspace-shell-footer.js.map +1 -1
  481. package/es-custom/components/workspace-shell/src/workspace-shell-footer.scss.js.map +1 -1
  482. package/es-custom/components/workspace-shell/src/workspace-shell-header.js +2 -1
  483. package/es-custom/components/workspace-shell/src/workspace-shell-header.js.map +1 -1
  484. package/es-custom/components/workspace-shell/src/workspace-shell-header.scss.js +1 -1
  485. package/es-custom/components/workspace-shell/src/workspace-shell-header.scss.js.map +1 -1
  486. package/es-custom/components/workspace-shell/src/workspace-shell.js.map +1 -1
  487. package/es-custom/components/workspace-shell/src/workspace-shell.scss.js +1 -1
  488. package/es-custom/components/workspace-shell/src/workspace-shell.scss.js.map +1 -1
  489. package/es-custom/globals/decorators/carbon-element.js.map +1 -1
  490. package/es-custom/globals/scss/common.scss.js.map +1 -1
  491. package/es-custom/globals/settings.js.map +1 -1
  492. package/es-custom/globals/utils/aria-announcer-manager.js.map +1 -1
  493. package/es-custom/globals/utils/browser-utils.js.map +1 -1
  494. package/es-custom/globals/utils/csv.js.map +1 -1
  495. package/es-custom/globals/utils/dom-utils.js.map +1 -1
  496. package/es-custom/globals/utils/focus-utils.js.map +1 -1
  497. package/es-custom/globals/utils/iconTransform.js.map +1 -1
  498. package/es-custom/globals/utils/rtl-utils.js.map +1 -1
  499. package/es-custom/globals/utils/uuid.js.map +1 -1
  500. package/es-custom/react/ai-label-action-button.js.map +1 -1
  501. package/es-custom/react/audio-player.js.map +1 -1
  502. package/es-custom/react/autocomplete.js.map +1 -1
  503. package/es-custom/react/card.js.map +1 -1
  504. package/es-custom/react/carousel.js.map +1 -1
  505. package/es-custom/react/chain-of-thought-step.js.map +1 -1
  506. package/es-custom/react/chain-of-thought-toggle.js.map +1 -1
  507. package/es-custom/react/chain-of-thought.js.map +1 -1
  508. package/es-custom/react/chat-button-skeleton.d.ts +11 -0
  509. package/es-custom/react/chat-button-skeleton.js +28 -0
  510. package/es-custom/react/chat-button-skeleton.js.map +1 -0
  511. package/es-custom/react/chat-button.js.map +1 -1
  512. package/es-custom/react/chat-header.js.map +1 -1
  513. package/es-custom/react/chat-shell.js.map +1 -1
  514. package/es-custom/react/code-snippet.d.ts +1 -1
  515. package/es-custom/react/code-snippet.js +1 -1
  516. package/es-custom/react/code-snippet.js.map +1 -1
  517. package/es-custom/react/error-message.js.map +1 -1
  518. package/es-custom/react/feedback-buttons.js.map +1 -1
  519. package/es-custom/react/feedback.js.map +1 -1
  520. package/es-custom/react/file-upload-item.js.map +1 -1
  521. package/es-custom/react/file-uploads.js.map +1 -1
  522. package/es-custom/react/history/history-content.js.map +1 -1
  523. package/es-custom/react/history/history-delete-panel.js.map +1 -1
  524. package/es-custom/react/history/history-header.js.map +1 -1
  525. package/es-custom/react/history/history-loading.js.map +1 -1
  526. package/es-custom/react/history/history-panel-item-input.js.map +1 -1
  527. package/es-custom/react/history/history-panel-item.js.map +1 -1
  528. package/es-custom/react/history/history-panel-items.js.map +1 -1
  529. package/es-custom/react/history/history-panel-menu.js.map +1 -1
  530. package/es-custom/react/history/history-panel.js.map +1 -1
  531. package/es-custom/react/history/history-search-item.js.map +1 -1
  532. package/es-custom/react/history/history-shell.js.map +1 -1
  533. package/es-custom/react/history/history-toolbar.js.map +1 -1
  534. package/es-custom/react/hooks/useChatAutocomplete.js +4 -3
  535. package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -1
  536. package/es-custom/react/input-send-control.js.map +1 -1
  537. package/es-custom/react/launcher.js.map +1 -1
  538. package/es-custom/react/markdown.js.map +1 -1
  539. package/es-custom/react/panel.js.map +1 -1
  540. package/es-custom/react/processing.js.map +1 -1
  541. package/es-custom/react/prompt-line-shell.js.map +1 -1
  542. package/es-custom/react/prompt-line.js.map +1 -1
  543. package/es-custom/react/reasoning-step.js.map +1 -1
  544. package/es-custom/react/reasoning-steps-toggle.js.map +1 -1
  545. package/es-custom/react/reasoning-steps.js.map +1 -1
  546. package/es-custom/react/stop-streaming-button.js.map +1 -1
  547. package/es-custom/react/table.js.map +1 -1
  548. package/es-custom/react/tool-call-data.js.map +1 -1
  549. package/es-custom/react/toolbar.js +1 -1
  550. package/es-custom/react/toolbar.js.map +1 -1
  551. package/es-custom/react/transcript.js.map +1 -1
  552. package/es-custom/react/utils/transformSuggestionConfig.js.map +1 -1
  553. package/es-custom/react/utils/withWebComponentBridge.js.map +1 -1
  554. package/es-custom/react/video-player.js.map +1 -1
  555. package/es-custom/react/workspace-shell.js.map +1 -1
  556. package/es-custom/testing/PageObjectId.js.map +1 -1
  557. package/es-custom/testing/load-all-lazy-deps.js.map +1 -1
  558. package/package.json +3 -3
  559. package/es/react/__tests__/jest.setup.js +0 -82
  560. package/es/react/__tests__/jest.setup.js.map +0 -1
  561. package/es-custom/react/__tests__/jest.setup.js +0 -82
  562. package/es-custom/react/__tests__/jest.setup.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"html-helpers.js","sources":["../../../../../src/components/markdown/src/utils/html-helpers.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;AACA,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAS;IAC7C,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,KAAK;AACN,CAAA,CAAC;AAEF;AACA;AACA,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAS;IACtD,aAAa;IACb,MAAM;IACN,WAAW;IACX,WAAW;IACX,aAAa;IACb,QAAQ;IACR,WAAW;IACX,YAAY;AACb,CAAA,CAAC;AASF;AACO,MAAM,mBAAmB,GAAG;AAEnC;AACA;AACA;AACA;AACA,SAAS,qBAAqB,CAC5B,OAA2B,EAAA;IAE3B,MAAM,OAAO,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,EAAE;AAEtC,IAAA,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AACxB,QAAA,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;AACxB,QAAA,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;AACxB,QAAA,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;AACxB,QAAA,OAAO,CAAC,UAAU,CAAC,IAAI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AAC,MAAM,GAAG,CAAA,GAAA,EAAM,UAAU,CAAA,CAAA,CAAG,GAAG,KAAK;AAC/D,QAAA,OAAO,CAAA,EAAG,OAAO,CAAA,EAAG,YAAY,MAAM;IACxC;AAEA,IAAA,IAAI,IAAI,KAAK,YAAY,EAAE;AACzB,QAAA,OAAO,EAAE;IACX;AAEA,IAAA,OAAO,KAAK,CAAC,OAAO,IAAI,EAAE;AAC5B;;;;"}
1
+ {"version":3,"file":"html-helpers.js","sources":["../../../../../src/components/markdown/src/utils/html-helpers.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 type { TokenTree } from '../markdown-token-tree';\n\n// HTML elements that never ship closing tags; treat them as self-closing so the stack logic does not wait for </tag>.\nconst SELF_CLOSING_HTML_TAGS = new Set<string>([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n]);\n\n// Token types we can safely glue into the combined HTML chunk. Anything else (e.g., emphasis markers) should abort\n// the merge to avoid damaging markdown.\nconst INLINE_HTML_ALLOWED_TOKEN_TYPES = new Set<string>([\n 'html_inline',\n 'text',\n 'softbreak',\n 'hardbreak',\n 'code_inline',\n 'entity',\n 'link_open',\n 'link_close',\n]);\n\ntype HtmlInlineTag =\n | { kind: 'opening'; tagName: string; selfClosing: boolean }\n | { kind: 'closing'; tagName: string };\n\ntype HtmlBlockBoundary =\n { kind: 'opening'; tagName: string } | { kind: 'closing'; tagName: string };\n\n/** Marker element appended to opening HTML so markdown children mount inside the block. */\nexport const HTML_CONTAINER_SLOT = '<div data-aichat-markdown=\"\"></div>';\n\n// Detects html_block openers (e.g. \"<div>\\n<summary>…\") that markdown-it split from\n// their closing tag. Used by combineSplitHtmlBlocks to wrap later markdown siblings\n// back inside the HTML element. Returns null for closers, self-closing tags, or blocks\n// that already include a matching </tag>.\nfunction parseHtmlBlockOpening(\n content: string | undefined\n): HtmlBlockBoundary | null {\n const trimmed = (content ?? '').trim();\n\n if (\n !trimmed.startsWith('<') ||\n trimmed.startsWith('</') ||\n trimmed.startsWith('<!') ||\n trimmed.startsWith('<?') ||\n trimmed.startsWith('<%')\n ) {\n return null;\n }\n\n const openingMatch = trimmed.match(/^<\\s*([A-Za-z][\\w:-]*)\\b/);\n if (!openingMatch) {\n return null;\n }\n\n const tagName = openingMatch[1].toLowerCase();\n if (SELF_CLOSING_HTML_TAGS.has(tagName) || /\\/>\\s*$/.test(trimmed)) {\n return null;\n }\n\n const closePattern = new RegExp(`</\\\\s*${tagName}\\\\s*>`, 'i');\n if (closePattern.test(trimmed)) {\n return null;\n }\n\n return { kind: 'opening', tagName };\n}\n\nfunction parseHtmlBlockClosing(\n content: string | undefined\n): HtmlBlockBoundary | null {\n const trimmed = (content ?? '').trim();\n const closingMatch = trimmed.match(/^<\\/\\s*([A-Za-z][\\w:-]*)\\s*>$/);\n if (!closingMatch) {\n return null;\n }\n\n return { kind: 'closing', tagName: closingMatch[1].toLowerCase() };\n}\n\n// Minimal tag parser that ignores comments/entities (e.g., <!-- ... -->) and reports whether a tag opens, closes, or\n// self-closes a given element.\nfunction parseHtmlInlineTag(content: string | undefined): HtmlInlineTag | null {\n const trimmed = (content ?? '').trim();\n\n if (!trimmed.startsWith('<') || !trimmed.endsWith('>')) {\n // Not bracketed like \"<...>\"; definitely not a tag token.\n return null;\n }\n\n if (trimmed.startsWith('</')) {\n // Closing tag: extract the element name. Reject malformed endings.\n const closingMatch = trimmed.match(/^<\\/\\s*([A-Za-z][\\w:-]*)\\s*>$/);\n if (!closingMatch) {\n return null;\n }\n return { kind: 'closing', tagName: closingMatch[1].toLowerCase() };\n }\n\n // Skip comments/doctype/instruction fragments; they cannot help balance nesting.\n if (\n trimmed.startsWith('<!') ||\n trimmed.startsWith('<?') ||\n trimmed.startsWith('<%')\n ) {\n return null;\n }\n\n // Opening tag: grab the element name even if attributes trail after it.\n const openingMatch = trimmed.match(/^<\\s*([A-Za-z][\\w:-]*)\\b[\\s\\S]*>$/);\n if (!openingMatch) {\n return null;\n }\n\n const tagName = openingMatch[1].toLowerCase();\n // Treat `<tag/>` and the HTML void elements as self-contained so they do not\n // add entries to the stack.\n const selfClosing =\n trimmed.endsWith('/>') || SELF_CLOSING_HTML_TAGS.has(tagName);\n\n return { kind: 'opening', tagName, selfClosing };\n}\n\n// Collapses runs of html_inline tokens (possibly interleaved with text) into a\n// single token so the browser does not auto-close the first tag mid-render.\nexport function combineConsecutiveHtmlInline(\n children: TokenTree[]\n): TokenTree[] {\n if (children.length < 2) {\n return children;\n }\n\n const combinedChildren: TokenTree[] = [];\n let didCombine = false;\n\n for (let index = 0; index < children.length; index++) {\n const startNode = children[index];\n\n if (startNode.token.type !== 'html_inline') {\n combinedChildren.push(startNode);\n continue;\n }\n\n const openingTag = parseHtmlInlineTag(startNode.token.content);\n if (\n !openingTag ||\n openingTag.kind !== 'opening' ||\n openingTag.selfClosing\n ) {\n combinedChildren.push(startNode);\n continue;\n }\n\n const stack: string[] = [openingTag.tagName]; // Track nested openings we must close.\n const chunkTokens: TokenTree[] = [startNode]; // Collect tokens to merge if the stack clears.\n let content = startNode.token.content ?? '';\n let endIndex = index;\n let success = false;\n\n for (let lookahead = index + 1; lookahead < children.length; lookahead++) {\n const candidate = children[lookahead];\n const tokenType = candidate.token.type ?? '';\n\n if (!INLINE_HTML_ALLOWED_TOKEN_TYPES.has(tokenType)) {\n // Encountered formatting/inline constructs we do not know how to merge.\n break;\n }\n\n if (tokenType === 'html_inline') {\n const parsed = parseHtmlInlineTag(candidate.token.content);\n if (!parsed) {\n // Malformed tag; abandon the merge.\n break;\n }\n\n chunkTokens.push(candidate);\n content += candidate.token.content ?? '';\n\n if (parsed.kind === 'opening') {\n if (!parsed.selfClosing) {\n // Push nested openers so we wait for their matching closers too.\n stack.push(parsed.tagName);\n }\n } else {\n const expected = stack[stack.length - 1];\n if (expected !== parsed.tagName) {\n // Mismatched closing tag; bail before corrupting structure.\n break;\n }\n\n stack.pop();\n endIndex = lookahead;\n\n if (stack.length === 0) {\n // All openings matched; we can fuse the run.\n success = true;\n break;\n }\n }\n\n continue;\n }\n\n // Non-tag inline content (text, code, breaks, links) is safe to append.\n chunkTokens.push(candidate);\n content += serializeInlineToken(candidate);\n }\n\n if (!success) {\n // If we couldn't successfully combine, just add the original token and continue\n combinedChildren.push(startNode);\n continue;\n }\n\n if (stack.length === 0 && endIndex > index) {\n combinedChildren.push({\n key: chunkTokens.map((token) => token.key).join('|'),\n token: {\n ...startNode.token,\n content,\n },\n children: [],\n });\n index = endIndex; // Skip over tokens we already collapsed.\n didCombine = true;\n continue;\n }\n\n combinedChildren.push(startNode);\n }\n\n return didCombine ? combinedChildren : children;\n}\n\n// Wraps markdown block tokens that sit between a split html_block opener and\n// closer so rendered content stays inside the HTML element (e.g. <details>).\nexport function combineSplitHtmlBlocks(children: TokenTree[]): TokenTree[] {\n if (children.length < 2) {\n return children;\n }\n\n const combinedChildren: TokenTree[] = [];\n let didCombine = false;\n\n for (let index = 0; index < children.length; index++) {\n const startNode = children[index];\n\n if (startNode.token.type !== 'html_block') {\n combinedChildren.push(startNode);\n continue;\n }\n\n const openingTag = parseHtmlBlockOpening(startNode.token.content);\n if (!openingTag) {\n combinedChildren.push(startNode);\n continue;\n }\n\n const stack: string[] = [openingTag.tagName];\n const innerChildren: TokenTree[] = [];\n let endIndex = index;\n let closingHtml = '';\n let success = false;\n\n for (let lookahead = index + 1; lookahead < children.length; lookahead++) {\n const candidate = children[lookahead];\n\n if (candidate.token.type === 'html_block') {\n const nestedClosing = parseHtmlBlockClosing(candidate.token.content);\n if (nestedClosing) {\n const expected = stack[stack.length - 1];\n if (expected !== nestedClosing.tagName) {\n break;\n }\n\n stack.pop();\n endIndex = lookahead;\n\n if (stack.length === 0) {\n closingHtml = candidate.token.content ?? '';\n success = true;\n break;\n }\n\n innerChildren.push(candidate);\n continue;\n }\n\n const nestedOpening = parseHtmlBlockOpening(candidate.token.content);\n if (nestedOpening) {\n stack.push(nestedOpening.tagName);\n }\n\n innerChildren.push(candidate);\n continue;\n }\n\n innerChildren.push(candidate);\n }\n\n if (!success || endIndex <= index) {\n combinedChildren.push(startNode);\n continue;\n }\n\n combinedChildren.push({\n key: [\n startNode.key,\n ...innerChildren.map((child) => child.key),\n children[endIndex].key,\n ].join('|'),\n token: {\n ...startNode.token,\n type: 'html_container',\n tag: openingTag.tagName,\n meta: { closingHtml },\n },\n children: innerChildren,\n });\n index = endIndex;\n didCombine = true;\n }\n\n return didCombine ? combinedChildren : children;\n}\n\nfunction serializeInlineToken(tokenTree: TokenTree): string {\n const token = tokenTree.token;\n const type = token.type ?? '';\n\n if (\n type === 'text' ||\n type === 'code_inline' ||\n type === 'softbreak' ||\n type === 'hardbreak' ||\n type === 'entity' ||\n type === 'html_inline'\n ) {\n return token.content ?? '';\n }\n\n if (type === 'link_open') {\n const attrs = (token.attrs ?? []) as Array<\n [string, string | null | undefined]\n >;\n const attrString = attrs\n .map(([name, value]) => {\n if (!name) {\n return '';\n }\n if (value === undefined || value === null) {\n return name;\n }\n const escaped = String(value).replace(/\"/g, '&quot;');\n return `${name}=\"${escaped}\"`;\n })\n .filter(Boolean)\n .join(' ');\n\n const childContent = (tokenTree.children ?? [])\n .map((child) => serializeInlineToken(child))\n .join('');\n\n const openTag = attrString.length ? `<a ${attrString}>` : '<a>';\n return `${openTag}${childContent}</a>`;\n }\n\n if (type === 'link_close') {\n return '';\n }\n\n return token.content ?? '';\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;AACA,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAS;IAC7C,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,KA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C,KAAI;YACrB,IAAI,CAAC,IAAI,EAAE;AACT,gBAAA,OAAO,EAAE;YACX;YACA,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;AACzC,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;AACrD,YAAA,OAAO,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,OAAO,GAAG;AAC/B,QAAA,CAAC;aACA,MAAM,CAAC,OAAO;aACd,IAAI,CAAC,GAAG,CAAC;QAEZ,MAAM,YAAY,GAAG,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE;aAC3C,GAAG,CAAC,CAAC,KAAK,KAAK,oBAAoB,CAAC,KAAK,CAAC;aAC1C,IAAI,CAAC,EAAE,CAAC;AAEX,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,GAAG,CAAA,GAAA,EAAM,UAAU,CAAA,CAAA,CAAG,GAAG,KAAK;AAC/D,QAAA,OAAO,CAAA,EAAG,OAAO,CAAA,EAAG,YAAY,MAAM;IACxC;AAEA,IAAA,IAAI,IAAI,KAAK,YAAY,EAAE;AACzB,QAAA,OAAO,EAAE;IACX;AAEA,IAAA,OAAO,KAAK,CAAC,OAAO,IAAI,EAAE;AAC5B;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"lit-directives.js","sources":["../../../../../src/components/markdown/src/utils/lit-directives.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAeH;AACA,MAAM,WAAY,SAAQ,SAAS,CAAA;AACjC,IAAA,MAAM,CAAC,MAA+B,EAAA;AACpC,QAAA,OAAO,OAAO;IAChB;AACA,IAAA,MAAM,CAAC,IAAS,EAAE,CAAC,KAAK,CAA4B,EAAA;AAClD,QAAA,MAAM,EAAE,GAAG,IAAI,CAAC,OAAkB;AAClC,QAAA,KAAK,MAA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W,EAAE,aAAa,EAAE,QAAQ,CAAoC,EAAA;AAEzE,QAAA,MAAM,IAAI,GAAI,IAAoB,CAAC,OAAsB;QAEzD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,eAAe,KAAK,WAAW,EAAE;AAC7D,YAAA,IAAI,CAAC,eAAe,GAAG,WAAW;AAClC,YAAA,IAAI,OAAO,GAAG,CAAA,EAAG,WAAW,CAAA,EAAG,mBAAmB,EAAE;AACpD,YAAA,IAAI,QAAQ,IAAI,OAAO,EAAE;AACvB,gBAAA,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;YACxC;YAEA,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC;AACzE,YAAA,IAAI,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC;QACjE;AAEA,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC;QACzC;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;MAEY,aAAa,GAAG,SAAS,CAAC,aAAa;;;;"}
1
+ {"version":3,"file":"lit-directives.js","sources":["../../../../../src/components/markdown/src/utils/lit-directives.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 DOMPurify from 'dompurify';\nimport { nothing, render, TemplateResult } from 'lit';\nimport {\n Directive,\n ElementPart,\n Part,\n PartInfo,\n PartType,\n directive,\n} from 'lit/directive.js';\n\nimport { HTML_CONTAINER_SLOT } from './html-helpers.js';\n\n// Generic attribute spread for Lit templates\nclass SpreadAttrs extends Directive {\n render(_attrs: Record<string, unknown>) {\n return nothing;\n }\n update(part: any, [attrs]: [Record<string, unknown>]) {\n const el = part.element as Element;\n for (const [k, v] of Object.entries(attrs ?? {})) {\n if (v === false || v === null || v === undefined) {\n el.removeAttribute(k);\n } else if (v === true) {\n el.setAttribute(k, '');\n } else {\n el.setAttribute(k, String(v));\n }\n }\n return nothing;\n }\n}\n\nexport const spread = directive(SpreadAttrs);\n\nexport const sanitizeHtmlContent = (content: string) =>\n DOMPurify.sanitize(content, {\n ADD_ATTR: ['data-aichat-markdown'],\n CUSTOM_ELEMENT_HANDLING: {\n tagNameCheck: () => true, // Allow custom elements\n attributeNameCheck: () => true,\n allowCustomizedBuiltInElements: true,\n },\n });\n\nclass HtmlContainer extends Directive {\n private slotElement: HTMLElement | null = null;\n private lastOpeningHtml = '';\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.ELEMENT) {\n throw new Error('HtmlContainer must be used on an element');\n }\n }\n\n render(\n _openingHtml: string,\n _childTemplate: TemplateResult,\n _sanitize: boolean\n ) {\n return nothing;\n }\n\n update(\n part: Part,\n [openingHtml, childTemplate, sanitize]: [string, TemplateResult, boolean]\n ) {\n const host = (part as ElementPart).element as HTMLElement;\n\n if (!this.slotElement || this.lastOpeningHtml !== openingHtml) {\n this.lastOpeningHtml = openingHtml;\n let content = `${openingHtml}${HTML_CONTAINER_SLOT}`;\n if (sanitize && content) {\n content = sanitizeHtmlContent(content);\n }\n\n const fragment = document.createRange().createContextualFragment(content);\n host.replaceChildren(...Array.from(fragment.childNodes));\n this.slotElement = host.querySelector('[data-aichat-markdown]');\n }\n\n if (this.slotElement) {\n render(childTemplate, this.slotElement);\n }\n\n return nothing;\n }\n}\n\nexport const htmlContainer = directive(HtmlContainer);\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAeH;AACA,MAAM,WAAY,SAAQ,SAAS,CAAA;AACjC,IAAA,MAAM,CAAC,MAA+B,EAAA;AACpC,QAAA,OAAO,OAAO;IA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;AAEA,IAAA,MAAM,CACJ,YAAoB,EACpB,cAA8B,EAC9B,SAAkB,EAAA;AAElB,QAAA,OAAO,OAAO;IAChB;IAEA,MAAM,CACJ,IAAU,EACV,CAAC,WAAW,EAAE,aAAa,EAAE,QAAQ,CAAoC,EAAA;AAEzE,QAAA,MAAM,IAAI,GAAI,IAAoB,CAAC,OAAsB;QAEzD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,eAAe,KAAK,WAAW,EAAE;AAC7D,YAAA,IAAI,CAAC,eAAe,GAAG,WAAW;AAClC,YAAA,IAAI,OAAO,GAAG,CAAA,EAAG,WAAW,CAAA,EAAG,mBAAmB,EAAE;AACpD,YAAA,IAAI,QAAQ,IAAI,OAAO,EAAE;AACvB,gBAAA,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;YACxC;YAEA,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC;AACzE,YAAA,IAAI,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACxD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC;QACjE;AAEA,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC;QACzC;AAEA,QAAA,OAAO,OAAO;IAChB;AACD;MAEY,aAAa,GAAG,SAAS,CAAC,aAAa;;"}
@@ -210,7 +210,6 @@ function renderFallback(token, node, md, sanitize, options) {
210
210
  slotName,
211
211
  kind: 'pluginFallback',
212
212
  token,
213
- node,
214
213
  html: safe,
215
214
  isInline: token.block === false,
216
215
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-fallback.js","sources":["../../../../../src/components/markdown/src/utils/plugin-fallback.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;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CAAC,EAC5C;YACA,IAAI,CAAC,UAAU,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACtC;IACF;IAEA,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,CAAC;AACpD,IAAA,MAAM,QAAQ,GAAG,qBAAqB,CACpC,CAAA,EAAG,2BAA2B,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,EACzC,OAAO,CACR;IACD,OAAO,CAAC,kBAAkB,GAAG;QAC3B,QAAQ;AACR,QAAA,IAAI,EAAE,gBAAgB;QACtB,KAAK;QACL,IAAI;AACJ,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,QAAQ,EAAE,KAAK,CAAC,KAAK,KAAK,KAAK;AAChC,KAAA,CAAC;AACF,IAAA,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,UAAU;AAC7C;;;;"}
1
+ {"version":3,"file":"plugin-fallback.js","sources":["../../../../../src/components/markdown/src/utils/plugin-fallback.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, TemplateResult } from 'lit';\nimport MarkdownIt, { Token } from 'markdown-it';\n\nimport {\n getPluginOverriddenRules,\n PLUGIN_DELEGABLE_TOKEN_TYPES,\n type TokenTree,\n} from '../markdown-token-tree.js';\nimport { sanitizeHtmlContent } from './lit-directives.js';\nimport { withInstanceNamespace } from './slot-names.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\n\n/**\n * Slot-name prefix shared by every plugin-fallback descriptor. A render-scoped\n * sequence number follows, then the owning element's namespace (see\n * `./slot-names.js`); the markdown component uses this prefix when adopting the\n * light-DOM host so external observers can target plugin output with CSS or\n * query selectors.\n *\n * @internal\n */\nexport const PLUGIN_FALLBACK_SLOT_PREFIX =\n 'cds-aichat-markdown-renderer-pluginFallback';\n\n// Token types our hand-written renderer handles natively (no markdown-it\n// fallback needed).\nconst NATIVELY_HANDLED_TOKEN_TYPES = new Set<string>([\n 'root',\n 'text',\n 'code_inline',\n 'fence',\n 'html_block',\n 'html_inline',\n 'html_container',\n 'inline',\n 'hr',\n 'thematic_break',\n]);\n\n// HTML tags whose paired open/close (or self-contained leaf) is rendered by\n// `renderWithStaticTag`. Anything else falls through to the markdown-it\n// renderer fallback.\nconst NATIVELY_HANDLED_TAGS = new Set<string>([\n 'p',\n 'blockquote',\n 'pre',\n 'hr',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'ul',\n 'ol',\n 'li',\n 'cds-checkbox',\n 'strong',\n 'em',\n 'code',\n 'del',\n 'sub',\n 'sup',\n 'span',\n 'i',\n 'b',\n 'small',\n 'mark',\n 'ins',\n 's',\n 'kbd',\n 'var',\n 'samp',\n 'cite',\n 'abbr',\n 'dfn',\n 'time',\n 'q',\n 'a',\n 'table',\n 'img',\n // Table internals — their open/close pairs are walked into via children.\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n // Task-list checkbox input element produced by markdown-it-task-lists.\n 'input',\n]);\n\n/**\n * True when the renderer can dispatch `token` itself (hand-written Lit\n * template). False when an unknown plugin-introduced token type or tag should\n * route through `md.renderer.render()`.\n */\nexport function isNativelyHandled(token: Partial<Token>): boolean {\n if (token.type && NATIVELY_HANDLED_TOKEN_TYPES.has(token.type)) {\n return true;\n }\n if (token.tag && NATIVELY_HANDLED_TAGS.has(token.tag)) {\n return true;\n }\n return false;\n}\n\n/**\n * True when the token's type is in the curated delegation allow-list and a\n * user-supplied markdown-it plugin has overridden (or added) the matching\n * `md.renderer.rules[type]`. Native dispatch sites consult this to decide\n * whether to route through `md.renderer.render()` instead of the hand-written\n * Lit template.\n */\nexport function shouldDelegateToPluginRule(\n token: Partial<Token>,\n md: MarkdownIt | undefined\n): boolean {\n if (!token.type || !md) {\n return false;\n }\n if (!PLUGIN_DELEGABLE_TOKEN_TYPES.has(token.type)) {\n return false;\n }\n return getPluginOverriddenRules(md).has(token.type);\n}\n\nfunction synthesizeCloseToken(openToken: Token): Token {\n const closeType = openToken.type.replace(/_open$/, '_close');\n return {\n type: closeType,\n tag: openToken.tag,\n nesting: -1,\n level: Math.max(0, openToken.level - 1),\n content: '',\n attrs: null,\n children: null,\n markup: openToken.markup,\n block: openToken.block,\n hidden: false,\n map: null,\n info: '',\n meta: null,\n } as Token;\n}\n\n/**\n * Re-emits the original flat markdown-it token sequence beneath `node` so the\n * sequence can be passed to `md.renderer.render()`. `inline` tokens are emitted\n * as-is (markdown-it's renderer reads their `.children` directly).\n */\nfunction flattenSubtree(node: TokenTree): Token[] {\n const tokens: Token[] = [];\n for (const child of node.children) {\n const t = child.token as Token;\n if (t.type === 'inline') {\n tokens.push(t);\n } else if (t.nesting === 1) {\n tokens.push(t);\n tokens.push(...flattenSubtree(child));\n tokens.push(synthesizeCloseToken(t));\n } else {\n tokens.push(t);\n }\n }\n return tokens;\n}\n\n/**\n * Builds the flat token slice to hand to `md.renderer.render()` for a token the\n * native renderer doesn't handle. Leaf tokens render alone; paired-container\n * opens reassemble `[open, ...children, close]` from the tree.\n */\nfunction sliceForFallback(token: Token, node: TokenTree): Token[] {\n if (token.nesting === 1) {\n return [token, ...flattenSubtree(node), synthesizeCloseToken(token)];\n }\n return [token];\n}\n\n/**\n * Renders an unknown token via markdown-it's HTML renderer and emits a named\n * `<slot>` placeholder. The markdown element adopts a light-DOM\n * `<div slot=\"…\">` host containing the sanitized HTML so consumer-supplied\n * CSS (e.g. KaTeX's stylesheet) reaches the rendered output.\n *\n * For leaf token types in {@link PLUGIN_DELEGABLE_TOKEN_TYPES} the rendered\n * HTML is cached on the {@link TokenTree} node and inherited across\n * `diffTokenTree` calls when the underlying token is unchanged — so a stable\n * earlier-in-document fence/image/etc. doesn't re-invoke the plugin's rule on\n * every streaming chunk. The cache is tagged with the `MarkdownIt` instance\n * that produced it; a plugin swap (which builds a fresh instance) invalidates\n * the cache automatically.\n */\nexport function renderFallback(\n token: Token,\n node: TokenTree,\n md: MarkdownIt,\n sanitize: boolean,\n options: RenderTokenTreeOptions\n): TemplateResult {\n let safe: string;\n if (node?.cachedHtml && node.cachedHtml.md === md) {\n safe = node.cachedHtml.html;\n } else {\n const slice = sliceForFallback(token, node);\n const htmlStr = md.renderer.render(slice, md.options, {});\n safe = sanitize ? sanitizeHtmlContent(htmlStr) : htmlStr;\n if (\n node &&\n typeof token.type === 'string' &&\n PLUGIN_DELEGABLE_TOKEN_TYPES.has(token.type)\n ) {\n node.cachedHtml = { md, html: safe };\n }\n }\n\n const index = options.pluginSlotCounter?.next() ?? 0;\n const slotName = withInstanceNamespace(\n `${PLUGIN_FALLBACK_SLOT_PREFIX}-${index}`,\n options\n );\n options.recordCustomRender?.({\n slotName,\n kind: 'pluginFallback',\n token,\n html: safe,\n isInline: token.block === false,\n });\n return html`<slot name=${slotName}></slot>`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAcH;;;;;;;;AAQG;AACI,MAAM,2BAA2B,GACtC;AAEF;AACA;AACA,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAS;IACnD,MAAM;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACP,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,IAAI;IACJ,gBAAgB;AACjB,CAAA,CAAC;AAEF;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,GAAG;IACH,YAAY;IACZ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,GAAG;IACH,GAAG;IACH,OAAO;IACP,MAAM;IACN,KAAK;IACL,G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ils/slot-names.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;;;;;;;AAOG;AACI,MAAM,oBAAoB,GAAG;AAEpC;;;;;;;;;;;;;AAaG;AACH,MAAM,qBAAqB,GAAG,qCAAqC;AAEnE;;;;;;;;;;;;;;AAcG;SACa,sBAAsB,GAAA;IACpC,MAAM,KAAK,GAAG,UAA2D;AACzE,IAAA,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;AACpD,IAAA,KAAK,CAAC,qBAAqB,CAAC,GAAG,IAAI;IACnC,OAAO,CAAA,CAAA,EAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;AAChC;AAEA;;;;;;;;;;;;;;AAcG;AACG,SAAU,qBAAqB,CACnC,QAAgB,EAChB,OAA+B,EAAA;IAE/B,OAAO,OAAO,CAAC;AACb,UAAE,CAAA,EAAG,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAA;UACpC,QAAQ;AACd;;;;"}
1
+ {"version":3,"file":"slot-names.js","sources":["../../../../../src/components/markdown/src/utils/slot-names.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 type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\n\n/**\n * Slot-name prefix shared by every custom-renderer descriptor. External\n * observers target rendered blocks with `[slot^=\"…-renderer-table-\"]` and\n * friends, so the prefix and the `-<kind>-` segment after it are stable;\n * everything past that is opaque.\n *\n * @internal\n */\nexport const MARKDOWN_SLOT_PREFIX = 'cds-aichat-markdown-renderer';\n\n/**\n * Key the per-page instance sequence is parked under. It lives on `globalThis`\n * rather than in a module-scoped `let` so every copy of this module loaded on\n * the page advances one sequence — the `es` and `es-custom` builds are separate\n * module scopes with separate class definitions. Without `globalThis`, each\n * build would start counting from zero.\n *\n * The name is deliberately underscore-prefixed and camelCase: the `es-custom`\n * build rewrites the bare tokens `cds` and `cds-aichat` in every emitted file\n * (`tasks/build.js`), and neither word-boundary regex can match inside\n * `__cdsAIChat…`, so both builds agree on the key.\n *\n * @internal\n */\nconst INSTANCE_SEQUENCE_KEY = '__cdsAIChatMarkdownInstanceSequence';\n\n/**\n * Mints the namespace that scopes every slot name one `cds-aichat-markdown`\n * element emits. Call once per element, at construction.\n *\n * A page-global sequence rather than a random id: uniqueness comes from the\n * shared counter, and short deterministic names stay readable in DevTools and\n * in test output.\n *\n * The count is base-36, not decimal, so the sequence reads `e1`, `e2`, … `e9`,\n * `ea`, … `ez`, `e10`. The `e` keeps the suffix from being read as one more of\n * the numeric position segments the base name already ends in\n * (`…-codeBlock-0-0-e3`, not `…-codeBlock-0-0-3`).\n *\n * @internal\n */\nexport function nextMarkdownInstanceId(): string {\n const scope = globalThis as unknown as Record<string, number | undefined>;\n const next = (scope[INSTANCE_SEQUENCE_KEY] ?? 0) + 1;\n scope[INSTANCE_SEQUENCE_KEY] = next;\n return `e${next.toString(36)}`;\n}\n\n/**\n * Appends the owning element's namespace to a parent-scoped slot name.\n *\n * Slot hosts are hoisted out of the markdown element into a single page-level\n * container (see the chat containers in `@carbon/ai-chat`) and projected back\n * by name, so a name that is unique only within one element collides across\n * elements: the first element's `<slot>` gathers every matching host and the\n * rest gather none.\n *\n * The namespace is a *suffix* so `[slot^=\"cds-aichat-markdown-renderer-…\"]`\n * selectors keep matching. Falls back to the bare name when the renderer is\n * driven directly, without an owning element.\n *\n * @internal\n */\nexport function withInstanceNamespace(\n baseName: string,\n options: RenderTokenTreeOptions\n): string {\n return options.slotNamespace\n ? `${baseName}-${options.slotNamespace}`\n : baseName;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;;;;;;;AAOG;AACI,MAAM,oBAAoB,GAAG;AAEpC;;;;;;;;;;;;;AAaG;AACH,MAAM,qBAAqB,GAAG,qCAAqC;AAEnE;;;;;;;;;;;;;;AAcG;SACa,sBAAsB,GAAA;IACpC,MAAM,KAAK,GAAG,UAA2D;AACzE,IAAA,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;AACpD,IAAA,KAAK,CAAC,qBAAqB,CAAC,GAAG,IAAI;IACnC,OAAO,CAAA,CAAA,EAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;AAChC;AAEA;;;;;;;;;;;;;;AAcG;AACG,SAAU,qBAAqB,CACnC,QAAgB,EAChB,OAA+B,EAAA;IAE/B,OAAO,OAAO,CAAC;AACb,UAAE,CAAA,EAAG,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAA;UACpC,QAAQ;AACd;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"streaming-table.js","sources":["../../../../../src/components/markdown/src/utils/streaming-table.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;;;;AAIG;AACG,SAAU,qBAAqB,CAAC,IAAe,EAAA;IACnD,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;AAC9B,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE;AACpC,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,KAAK;IACd;IAEA,OAAO,qBAAqB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC7D;AAEA;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,IAAe,EAAA;AAC/C,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE;AACpC,IAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;AACpD,QAAA,MAAM,KAAK,GAAG,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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 type { TokenTree } from '../markdown-token-tree.js';\n\n/**\n * True if the right-most leaf of the tree is a `table` token. A trailing table\n * is one that sits at the end of the current markdown output, not just at the\n * end of an arbitrary subtree — so we follow only the rightmost branch.\n */\nexport function hasTrailingTableToken(node: TokenTree): boolean {\n if (node.token.tag === 'table') {\n return true;\n }\n\n const children = node.children || [];\n if (children.length === 0) {\n return false;\n }\n\n return hasTrailingTableToken(children[children.length - 1]);\n}\n\n/**\n * True if any table token in the tree has a sibling that follows it. Used to\n * detect that the streaming author has moved past a table, so we can exit the\n * \"table loading\" hold and render the live table.\n */\nexport function hasNodeAfterTable(node: TokenTree): boolean {\n const children = node.children || [];\n for (let index = 0; index < children.length; index++) {\n const child = children[index];\n if (child.token.tag === 'table' && index < children.length - 1) {\n return true;\n }\n if (hasNodeAfterTable(child)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * True when a table at `currentIndex` inside `parentChildren` has no\n * siblings after it — i.e. it is currently the last child of its parent.\n * The streaming-table renderer uses this to decide whether the live table\n * should show its skeleton/loading state.\n */\nexport function isTableAtStreamingTail(\n parentChildren: readonly unknown[],\n currentIndex: number\n): boolean {\n return currentIndex >= parentChildren.length - 1;\n}\n\n/**\n * Heuristic that returns true when the last non-empty line of the markdown\n * source looks like an in-progress table row or separator. markdown-it can\n * momentarily stop recognizing the table token while a row is half-written, so\n * the streaming-table hold uses this to avoid flickering between table and\n * non-table renderings.\n */\nexport function hasLikelyPartialTableTail(markdown: string): boolean {\n const normalized = markdown.replace(/\\r/g, '');\n const lines = normalized.split('\\n');\n let index = lines.length - 1;\n\n while (index >= 0 && lines[index].trim() === '') {\n index--;\n }\n\n if (index < 0) {\n return false;\n }\n\n const lastLine = lines[index].trim();\n\n // During streaming, partially emitted table rows frequently end with a pipe\n // and markdown-it can temporarily stop recognizing the table token.\n if (lastLine.startsWith('|') || lastLine.endsWith('|')) {\n return true;\n }\n\n // Keep loading mode if the tail still looks like a table separator row.\n return /^\\|?[\\s:-]+(\\|[\\s:-]+)+\\|?$/.test(lastLine);\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;;;;AAIG;AACG,SAAU,qBAAqB,CAAC,IAAe,EAAA;IACnD,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;AAC9B,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE;AACpC,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,KAAK;IACd;IAEA,OAAO,qBAAqB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC7D;AAEA;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,IAAe,EAAA;AAC/C,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE;AACpC,IAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;AACpD,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;AAC7B,QAAA,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;AAC9D,YAAA,OAAO,IAAI;QACb;AACA,QAAA,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE;AAC5B,YAAA,OAAO,IAAI;QACb;IACF;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;;;;AAKG;AACG,SAAU,sBAAsB,CACpC,cAAkC,EAClC,YAAoB,EAAA;AAEpB,IAAA,OAAO,YAAY,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC;AAClD;AAEA;;;;;;AAMG;AACG,SAAU,yBAAyB,CAAC,QAAgB,EAAA;IACxD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC;AACpC,IAAA,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC;AAE5B,IAAA,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;AAC/C,QAAA,KAAK,EAAE;IACT;AAEA,IAAA,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,QAAA,OAAO,KAAK;IACd;IAEA,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE;;;AAIpC,IAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AACtD,QAAA,OAAO,IAAI;IACb;;AAGA,IAAA,OAAO,6BAA6B,CAAC,IAAI,CAAC,QAAQ,CAAC;AACrD;;"}
@@ -10,8 +10,18 @@ export declare const DEFAULT_PAGINATION_STATUS_TEXT: ({ start, end, count, }: {
10
10
  end: number;
11
11
  count: number;
12
12
  }) => string;
13
+ /**
14
+ * One cell of a parsed markdown table. A custom table renderer reads these
15
+ * from the `headers` and `rows` it is handed.
16
+ */
13
17
  export interface TableCellData {
18
+ /** Plain text of the cell, with markdown syntax stripped. */
14
19
  text: string;
20
+ /**
21
+ * Token tree for the cell's content, or `null` when the cell is plain
22
+ * text. Render it to keep the links, code spans, and emphasis that `text`
23
+ * drops.
24
+ */
15
25
  tokens: TokenTree[] | null;
16
26
  }
17
27
  /**
@@ -190,7 +190,6 @@ function renderTable(token, node, attrs, options, renderToken, slotName) {
190
190
  slotName,
191
191
  kind: 'table',
192
192
  token,
193
- node,
194
193
  data: {
195
194
  headers: dataHeaders,
196
195
  rows: dataRows,
@@ -1 +1 @@
1
- {"version":3,"file":"table-helpers.js","sources":["../../../../../src/components/markdown/src/utils/table-helpers.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAeH;AACO,MAAM,oCAAoC,GAAG,CAAC,EACnD,KAAK,GAGN,KAAK,CAAA,EAAG,KAAK;MACD,8BAA8B,GAAG,CAAC,EAC7C,KAAK,EACL,GAAG,EACH,KAAK,GAKN,KAAK,CAAA,EAAG,KAAK,IAAI,GAAG,CAAA,IAAA,EAAO,KAAK,CAAA,MAAA;AAOjC;;;;;;AAMG;AACG,SAAU,gBAAgB,CAAC,SAAoB,EAAA;IAInD,MAAM,OAAO,GAAoB,EAAE;IACnC,MAAM,IAAI,GAAsB,EAAE;AAElC,IAAA,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtC,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAE/B,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;AACjC,oBAAA,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE;wBACzC,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;4BAC9B,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;wBACxC;oBACF;gBACF;YACF;QACF;aAAO,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAEtC,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;oBACjC,MAAM,GAAG,GAAoB,EAAE;AAC/B,oBAAA,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE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BACpB,sBAAsB;gBACjC,WAAW;uCACY,kCAAkC;iCACxC,4BAA4B;YACjD,KAAK,CAAA;SACR;AAEP,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;;;;;AAK1B,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACvE,OAAO,CAAC,kBAAkB,GAAG;YAC3B,QAAQ;AACR,YAAA,IAAI,EAAE,OAAO;YACb,KAAK;YACL,IAAI;AACJ,YAAA,IAAI,EAAE;AACJ,gBAAA,OAAO,EAAE,WAAW;AACpB,gBAAA,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,CAAC,CAAC,SAAS;gBACxB,SAAS;AACV,aAAA;AACF,SAAA,CAAC;AACF,QAAA,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,oBAAoB,SAAS;IACpE;AAEA,IAAA,OAAO,oBAAoB;AAC7B;;;;"}
1
+ {"version":3,"file":"table-helpers.js","sources":["../../../../../src/components/markdown/src/utils/table-helpers.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, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Token } from 'markdown-it';\n\nimport type {\n TableCellContent,\n TableRowContent,\n} from '../../../table/src/table.js';\nimport { combineConsecutiveHtmlInline } from './html-helpers.js';\nimport { isTableAtStreamingTail } from './streaming-table.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\nimport type { TokenTree } from '../markdown-token-tree';\n\n// Default localization functions for table pagination\nexport const DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT = ({\n count,\n}: {\n count: number;\n}) => `${count} items`;\nexport const DEFAULT_PAGINATION_STATUS_TEXT = ({\n start,\n end,\n count,\n}: {\n start: number;\n end: number;\n count: number;\n}) => `${start}–${end} of ${count} items`;\n\n/**\n * One cell of a parsed markdown table. A custom table renderer reads these\n * from the `headers` and `rows` it is handed.\n */\nexport interface TableCellData {\n /** Plain text of the cell, with markdown syntax stripped. */\n text: string;\n /**\n * Token tree for the cell's content, or `null` when the cell is plain\n * text. Render it to keep the links, code spans, and emphasis that `text`\n * drops.\n */\n tokens: TokenTree[] | null;\n}\n\n/**\n * Extracts tabular data from a table TokenTree node.\n *\n * Converts the hierarchical markdown table structure into the flat\n * header/rows format expected by the cds-aichat-table component while retaining\n * the TokenTree children required for rich rendering within cells.\n */\nexport function extractTableData(tableNode: TokenTree): {\n headers: TableCellData[];\n rows: TableCellData[][];\n} {\n const headers: TableCellData[] = [];\n const rows: TableCellData[][] = [];\n\n for (const child of tableNode.children) {\n if (child.token.tag === 'thead') {\n // Extract column headers\n for (const theadChild of child.children) {\n if (theadChild.token.tag === 'tr') {\n for (const thChild of theadChild.children) {\n if (thChild.token.tag === 'th') {\n headers.push(extractCellData(thChild));\n }\n }\n }\n }\n } else if (child.token.tag === 'tbody') {\n // Extract data rows\n for (const tbodyChild of child.children) {\n if (tbodyChild.token.tag === 'tr') {\n const row: TableCellData[] = [];\n for (const tdChild of tbodyChild.children) {\n if (tdChild.token.tag === 'td') {\n row.push(extractCellData(tdChild));\n }\n }\n rows.push(row);\n }\n }\n }\n }\n\n return { headers, rows };\n}\n\n/**\n * Recursively extracts plain text content from a TokenTree node.\n *\n * This is used for table cells and other contexts where we need the\n * text content without HTML formatting.\n */\nexport function extractTextContent(node: TokenTree): string {\n // Handle direct text tokens\n if (node.token.type === 'text') {\n return node.token.content || '';\n }\n\n // Handle inline code\n if (node.token.type === 'code_inline') {\n return node.token.content || '';\n }\n\n if (node.token.type === 'softbreak' || node.token.type === 'hardbreak') {\n return '\\n';\n }\n\n // Recursively extract text from child nodes\n let text = '';\n for (const child of node.children) {\n text += extractTextContent(child);\n }\n\n return text;\n}\n\nfunction extractCellData(node: TokenTree): TableCellData {\n const text = extractTextContent(node);\n const tokens = extractRenderableChildren(node);\n const hasRichContent = tokens.some((child) => child.token.type !== 'text');\n\n return {\n text,\n tokens: hasRichContent ? tokens : null,\n };\n}\n\nfunction extractRenderableChildren(node: TokenTree): TokenTree[] {\n if (node.children.length === 1) {\n const onlyChild = node.children[0];\n if (\n onlyChild.token.type === 'inline' &&\n onlyChild.children &&\n onlyChild.children.length\n ) {\n return onlyChild.children;\n }\n }\n\n return node.children;\n}\n\n/**\n * Renders the body of the `case \"table\"` branch of `renderWithStaticTag`.\n *\n * Lives outside the renderer's switch because it covers three flows: streaming\n * loading state, default Carbon-table rendering, and the `customRenderers.table`\n * slot override.\n *\n * `renderToken` is the recursive renderer the caller dispatched from, passed in\n * to avoid a cycle with `markdown-renderer.ts`. `slotName` is non-undefined when\n * the consumer registered a `table` custom renderer, in which case the result is\n * wrapped in a named `<slot>` and an override descriptor is reported via\n * `recordCustomRender`.\n */\nexport function renderTable(\n token: Token,\n node: TokenTree,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n renderToken: (\n node: TokenTree,\n options: RenderTokenTreeOptions\n ) => TemplateResult,\n slotName: string | undefined\n): TemplateResult {\n const {\n streaming,\n forceTableLoading,\n context: parentContext,\n tableFilterPlaceholderText,\n tablePreviousPageText,\n tableNextPageText,\n tableItemsPerPageText,\n tableDownloadLabelText,\n tableLocale,\n tableGetPaginationSupplementalText,\n tableGetPaginationStatusText,\n } = options;\n\n // Determine if we should show loading state during streaming\n let isLoading = Boolean(forceTableLoading);\n if (\n !isLoading &&\n streaming &&\n parentContext?.parentChildren &&\n parentContext?.currentIndex !== undefined\n ) {\n isLoading = isTableAtStreamingTail(\n parentContext.parentChildren,\n parentContext.currentIndex\n );\n }\n\n const renderCellTokens = (tokens: TokenTree[], contextOverrides = {}) => {\n // Same as block/inline rendering: merge split raw HTML (e.g. `<a>…</a>`)\n // so each cell is not rendered as separate unsafeHTML + text chunks.\n const normalizedTokens = combineConsecutiveHtmlInline(tokens);\n return html`${repeat(\n normalizedTokens,\n (child, index) => `cell-${index}:${child.token.type}:${child.token.tag}`,\n (child, index) =>\n renderToken(child, {\n ...options,\n context: {\n ...options.context,\n ...contextOverrides,\n parentChildren: normalizedTokens,\n currentIndex: index,\n },\n })\n )}`;\n };\n\n const createCellContent = (\n cell: TableCellData,\n contextOverrides?: Record<string, unknown>\n ): TableCellContent => ({\n text: cell.text,\n template: cell.tokens\n ? renderCellTokens(cell.tokens, contextOverrides)\n : null,\n });\n\n // Only extract and process table data when not loading to avoid unnecessary work.\n // During loading, the table shows a skeleton and doesn't need the actual data.\n let headers: TableCellContent[] = [];\n let tableRows: TableRowContent[] = [];\n\n if (!isLoading) {\n const extractedData = extractTableData(node);\n headers = extractedData.headers.map((cell) =>\n createCellContent(cell, { isInThead: true })\n );\n tableRows = extractedData.rows.map((row) => ({\n cells: row.map((cell) => createCellContent(cell)),\n }));\n }\n\n // Always return the same structure to allow Lit to reuse the table element.\n // When isLoading is true, the table component will show a skeleton state.\n // When isLoading is false, it will show the actual data.\n // This prevents recreating the table element and preserves its internal state.\n const defaultTableTemplate = html`<div class=\"cds-aichat-table--square\">\n <cds-aichat-table\n data-rounded\n .headers=${headers}\n .rows=${tableRows}\n .loading=${isLoading}\n .filterPlaceholderText=${tableFilterPlaceholderText}\n .previousPageText=${tablePreviousPageText}\n .nextPageText=${tableNextPageText}\n .itemsPerPageText=${tableItemsPerPageText}\n .downloadLabelText=${tableDownloadLabelText}\n .locale=${tableLocale}\n .getPaginationSupplementalText=${tableGetPaginationSupplementalText}\n .getPaginationStatusText=${tableGetPaginationStatusText}\n ...=${attrs}></cds-aichat-table>\n </div>`;\n\n if (slotName !== undefined) {\n // For the override path we pass the raw extracted cell data (not the\n // Lit-wrapped TableCellContent) so consumers can render however they\n // like. Extract once even when loading so the consumer always gets\n // the data — they can read `isLoading` to choose a skeleton state.\n const { headers: dataHeaders, rows: dataRows } = extractTableData(node);\n options.recordCustomRender?.({\n slotName,\n kind: 'table',\n token,\n data: {\n headers: dataHeaders,\n rows: dataRows,\n isStreaming: !!streaming,\n isLoading,\n },\n });\n return html`<slot name=${slotName}>${defaultTableTemplate}</slot>`;\n }\n\n return defaultTableTemplate;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAeH;AACO,MAAM,oCAAoC,GAAG,CAAC,EACnD,KAAK,GAGN,KAAK,CAAA,EAAG,KAAK;MACD,8BAA8B,GAAG,CAAC,EAC7C,KAAK,EACL,GAAG,EACH,KAAK,GAKN,KAAK,CAAA,EAAG,KAAK,IAAI,GAAG,CAAA,IAAA,EAAO,KAAK,CAAA,MAAA;AAiBjC;;;;;;AAMG;AACG,SAAU,gBAAgB,CAAC,SAAoB,EAAA;IAInD,MAAM,OAAO,GAAoB,EAAE;IACnC,MAAM,IAAI,GAAsB,EAAE;AAElC,IAAA,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtC,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAE/B,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;AACjC,oBAAA,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE;wBACzC,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;4BAC9B,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;wBACxC;oBACF;gBACF;YACF;QACF;aAAO,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAEtC,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;oBACjC,MAAM,GAAG,GAAoB,EAAE;AAC/B,oBAAA,KAAK,M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,qBAAqB;sBACzB,iBAAiB;0BACb,qBAAqB;2BACpB,sBAAsB;gBACjC,WAAW;uCACY,kCAAkC;iCACxC,4BAA4B;YACjD,KAAK,CAAA;SACR;AAEP,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;;;;;AAK1B,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACvE,OAAO,CAAC,kBAAkB,GAAG;YAC3B,QAAQ;AACR,YAAA,IAAI,EAAE,OAAO;YACb,KAAK;AACL,YAAA,IAAI,EAAE;AACJ,gBAAA,OAAO,EAAE,WAAW;AACpB,gBAAA,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,CAAC,CAAC,SAAS;gBACxB,SAAS;AACV,aAAA;AACF,SAAA,CAAC;AACF,QAAA,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,oBAAoB,SAAS;IACpE;AAEA,IAAA,OAAO,oBAAoB;AAC7B;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"processing.js","sources":["../../../../src/components/processing/src/processing.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAUH;;;AAGG;AAEH,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU,CAAA;AAA5C,IAAA,WAAA,GAAA;;;QAKE,IAAA,CAAA,IAAI,GAAG,KAAK;AAEZ;;;AAGG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;IAiBnB;IAfE,MAAM,GAAA;QACJ,MAAM,OAAO,GAAG,QAAQ,CAAC;AACvB,YAAA,CAAC,CAAA,MAAA,CAAQ,GAAG,IAAI,CAAC,IAAI;AACrB,YAAA,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,IAAI;AAC/B,YAAA,CAAC,CAAA,UAAA,CAAY,GAAG,IAAI,CAAC,SAAS;AAC/B,SAAA,CAAC;QAEF,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,OAAO,CAAA;;;;;;WAMzB;IACT;;AA3BO,mBAAA,CAAA,MAAM,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC;AAItC,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;AACjC,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAOb,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE;AAClC,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAZd,mBAAmB,GAAA,UAAA,CAAA;AADxB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,WAAA,CAAa;AAC/B,CAAA,EAAA,mBAAmB,CA6BxB;AASD,4BAAe,mBAAmB;;;;"}
1
+ {"version":3,"file":"processing.js","sources":["../../../../src/components/processing/src/processing.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 { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './processing.scss?lit';\nimport { carbonElement } from '../../../globals/decorators';\nimport prefix from '../../../globals/settings.js';\n\n/**\n * Processing component\n * @element cds-aichat-processing\n */\n@carbonElement(`${prefix}-processing`)\nclass CDSAIChatProcessing extends LitElement {\n static styles = [commonStyles, styles];\n\n /** Enables the linear looping animation variant. */\n @property({ type: Boolean, attribute: 'loop' })\n loop = false;\n\n /**\n * Removes the ~1s entry delay so the dots appear immediately. Composes with\n * both the looping and non-looping variants.\n */\n @property({ type: Boolean, attribute: 'quick-load' })\n quickLoad = false;\n\n render() {\n const classes = classMap({\n [`linear`]: this.loop,\n [`linear--no-loop`]: !this.loop,\n [`quick-load`]: this.quickLoad,\n });\n\n return html`<div class=${classes}>\n <svg class=\"dots\" viewBox=\"0 0 32 32\">\n <circle class=\"dot dot--left\" cx=\"8\" cy=\"16\" />\n <circle class=\"dot dot--center\" cx=\"16\" cy=\"16\" r=\"2\" />\n <circle class=\"dot dot--right\" cx=\"24\" cy=\"16\" r=\"2\" />\n </svg>\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-aichat-processing': CDSAIChatProcessing;\n }\n}\n\nexport { CDSAIChatProcessing };\nexport default CDSAIChatProcessing;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAUH;;;AAGG;AAEH,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU,CAAA;AAA5C,IAAA,WAAA,GAAA;;;QAKE,IAAA,CAAA,IAAI,GAAG,KAAK;AAEZ;;;AAGG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;IAiBnB;IAfE,MAAM,GAAA;QACJ,MAAM,OAAO,GAAG,QAAQ,CAAC;AACvB,YAAA,CAAC,CAAA,MAAA,CAAQ,GAAG,IAAI,CAAC,IAAI;AACrB,YAAA,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,IAAI;AAC/B,YAAA,CAAC,CAAA,UAAA,CAAY,GAAG,IAAI,CAAC,SAAS;AAC/B,SAAA,CAAC;QAEF,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,OAAO,CAAA;;;;;;WAMzB;IACT;;AA3BO,mBAAA,CAAA,MAAM,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC;AAItC,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;AACjC,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAOb,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE;AAClC,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAZd,mBAAmB,GAAA,UAAA,CAAA;AADxB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,WAAA,CAAa;AAC/B,CAAA,EAAA,mBAAmB,CA6BxB;AASD,4BAAe,mBAAmB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"processing.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"processing.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -33,11 +33,11 @@ export interface AutocompleteI18n {
33
33
  suggestionsAvailable: (count: number) => string;
34
34
  /**
35
35
  * Announced when the user moves focus to an item via arrow keys.
36
- * Receives the item label, optional description, and position info.
36
+ * Receives the item label, optional description, optional group label, and position info.
37
37
  *
38
- * @example (label, description, position) => `${label}${description ? `, ${description}` : ""}, ${position}`
38
+ * @example (label, description, groupLabel, position) => `${label}${description ? `, ${description}` : ""}${groupLabel ? `, ${groupLabel}` : ""}, ${position}`
39
39
  */
40
- itemNavigation: (label: string, description: string | undefined, position: string) => string;
40
+ itemNavigation: (label: string, description: string | undefined, groupLabel: string | undefined, position: string) => string;
41
41
  /**
42
42
  * Announced when an item is selected/inserted.
43
43
  * Receives the item label.
@@ -56,6 +56,11 @@ export interface AutocompleteI18n {
56
56
  suggestionsClosed: string;
57
57
  /** Accessible label for the listbox element. */
58
58
  listboxLabel: string;
59
+ /**
60
+ * Accessible label for the implicit group that wraps flat (non-grouped) items
61
+ * when the listbox element also contains grouped items.
62
+ */
63
+ nonGroupedItemsLabel: string;
59
64
  }
60
65
  /** Default English strings — used as the fallback value for `i18n`. */
61
66
  export declare const defaultAutocompleteI18n: AutocompleteI18n;
@@ -156,12 +161,14 @@ declare class AutocompleteElement extends LitElement {
156
161
  private _scheduleMoveAnnouncement;
157
162
  private _handleSend;
158
163
  private _handleMousedown;
164
+ private _handleItemMouseEnter;
159
165
  private _handleClickOutside;
160
166
  private _scrollActiveItemIntoView;
161
167
  private _selectItem;
162
168
  private _dismiss;
163
169
  private _handleItemClick;
164
170
  private _getActiveOptionId;
171
+ private _getGroupTitleAtIndex;
165
172
  private _getLabelParts;
166
173
  /**
167
174
  * Render the avatar if provided
@@ -31,11 +31,12 @@ const groupClass = `${itemClass}-group`;
31
31
  const defaultAutocompleteI18n = {
32
32
  noSuggestions: 'No suggestions.',
33
33
  suggestionsAvailable: (count) => `${count} suggestion${count === 1 ? '' : 's'}. Use up and down arrows to move, Enter to pick, Escape to close.`,
34
- itemNavigation: (label, description, position) => `${label}${description ? `, ${description}` : ''}, ${position}`,
34
+ itemNavigation: (label, description, groupLabel, position) => `${label}${description ? `, ${description}` : ''}${groupLabel ? `, ${groupLabel}` : ''}, ${position}`,
35
35
  itemInserted: (label) => `${label} inserted.`,
36
36
  itemSent: (label) => `${label} sent.`,
37
37
  suggestionsClosed: 'Suggestions closed.',
38
38
  listboxLabel: 'Autocomplete options',
39
+ nonGroupedItemsLabel: 'Non-grouped options',
39
40
  };
40
41
  /**
41
42
  * Autocomplete component for AI Chat input suggestions.
@@ -160,15 +161,10 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
160
161
  // Use composedPath() instead of event.target so clicks originating inside
161
162
  // a shadow root are visible.
162
163
  const path = event.composedPath();
163
- const isNode = (t) => t instanceof Node;
164
- // Check if click is on autocomplete itself
165
- if (path.filter(isNode).some((n) => this.contains(n))) {
164
+ if (path.includes(this)) {
166
165
  return;
167
166
  }
168
- // Check if click is on anchor element
169
- const { anchorElement } = this;
170
- if (anchorElement &&
171
- path.filter(isNode).some((n) => anchorElement.contains(n))) {
167
+ if (this.anchorElement && path.includes(this.anchorElement)) {
172
168
  return;
173
169
  }
174
170
  this._dismiss();
@@ -276,7 +272,7 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
276
272
  return;
277
273
  }
278
274
  const position = `${index + 1} of ${total}`;
279
- this._announcer.announce(this.i18n.itemNavigation(item.label, item.description, position));
275
+ this._announcer.announce(this.i18n.itemNavigation(item.label, item.description, this._getGroupTitleAtIndex(index), position));
280
276
  }, 50);
281
277
  }
282
278
  _handleSend(index) {
@@ -292,6 +288,12 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
292
288
  composed: true,
293
289
  }));
294
290
  }
291
+ _handleItemMouseEnter(index) {
292
+ if (this._getItemAtIndex(index)?.disabled) {
293
+ return;
294
+ }
295
+ this._focusedIndex = index;
296
+ }
295
297
  _scrollActiveItemIntoView() {
296
298
  this.updateComplete.then(() => {
297
299
  const itemsContainer = this.shadowRoot?.querySelector(`.${blockClass}__items`);
@@ -336,6 +338,22 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
336
338
  const item = this._getItemAtIndex(this._focusedIndex);
337
339
  return item ? `${item.id}--option` : undefined;
338
340
  }
341
+ _getGroupTitleAtIndex(index) {
342
+ if (index < this.items.length) {
343
+ return this.groups.length > 0
344
+ ? this.i18n.nonGroupedItemsLabel
345
+ : undefined;
346
+ }
347
+ let currentIndex = this.items.length;
348
+ for (const group of this.groups) {
349
+ const groupEndIndex = currentIndex + group.items.length;
350
+ if (index < groupEndIndex) {
351
+ return group.title;
352
+ }
353
+ currentIndex = groupEndIndex;
354
+ }
355
+ return undefined;
356
+ }
339
357
  _getLabelParts(item) {
340
358
  const label = item.label;
341
359
  const input = this.inputText.toLowerCase();
@@ -385,7 +403,8 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
385
403
  this._handleItemClick(index);
386
404
  }
387
405
  }}"
388
- aria-selected="${isActive ? 'true' : 'false'}"
406
+ @mouseenter="${() => this._handleItemMouseEnter(index)}"
407
+ aria-selected="false"
389
408
  aria-disabled="${isDisabled ? 'true' : 'false'}"
390
409
  class=${classMap({
391
410
  [itemClass]: true,
@@ -444,6 +463,7 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
444
463
  return liveRegions;
445
464
  }
446
465
  let currentIndex = 0;
466
+ const hasGroups = this.groups.length > 0;
447
467
  return html `
448
468
  ${liveRegions}
449
469
  <div class="${blockClass}">
@@ -456,46 +476,73 @@ let AutocompleteElement = class AutocompleteElement extends LitElement {
456
476
  </div>
457
477
  `
458
478
  : ''}
479
+ ${hasGroups
480
+ ? html `
481
+ <div
482
+ aria-activedescendant="${this._getActiveOptionId()}"
483
+ aria-label="${this.i18n.listboxLabel}"
484
+ class="${blockClass}__items"
485
+ id="${blockClass}-listbox"
486
+ role="listbox">
487
+ <!-- Flat items wrapped in their own implicit group -->
488
+ ${this.items.length > 0
489
+ ? html `
490
+ <ul
491
+ role="group"
492
+ aria-label="${this.i18n.nonGroupedItemsLabel}"
493
+ class="${groupClass}__items">
494
+ ${this.items.map((item, index) => {
495
+ const itemIndex = currentIndex++;
496
+ return this._renderItem(item, itemIndex, {
497
+ firstItem: !this.headerConfig?.showHeader && index === 0,
498
+ });
499
+ })}
500
+ </ul>
501
+ `
502
+ : ''}
459
503
 
460
- <ul
461
- aria-activedescendant="${this._getActiveOptionId()}"
462
- aria-label="${this.i18n.listboxLabel}"
463
- class="${blockClass}__items"
464
- id="${blockClass}-listbox"
465
- role="listbox">
466
- <!-- Flat items -->
467
- ${this.items.map((item, index) => {
468
- const itemIndex = currentIndex++;
469
- return this._renderItem(item, itemIndex, {
470
- firstItem: !this.headerConfig?.showHeader && index === 0,
471
- lastItem: this.groups.length === 0 && index === this.items.length - 1,
472
- });
473
- })}
474
-
475
- <!-- Grouped items -->
476
- ${this.groups.map((group, groupIndex) => {
477
- const groupStartIndex = currentIndex;
478
- currentIndex += group.items.length;
479
- const isLastGroup = groupIndex === this.groups.length - 1;
480
- return html `
481
- <li
482
- role="group"
483
- aria-label="${group.title}"
484
- class="${groupClass}">
485
- ${group.title
486
- ? html `<div class="${groupClass}__title">
487
- ${group.title}
488
- </div>`
489
- : null}
490
- <ul class="${groupClass}__items">
491
- ${group.items.map((item, itemIndex) => this._renderItem(item, groupStartIndex + itemIndex, {
492
- lastItem: isLastGroup && itemIndex === group.items.length - 1,
493
- }))}
504
+ <!-- Grouped items -->
505
+ ${this.groups.map((group, groupIndex) => {
506
+ const groupStartIndex = currentIndex;
507
+ currentIndex += group.items.length;
508
+ const isLastGroup = groupIndex === this.groups.length - 1;
509
+ return html `
510
+ <ul
511
+ role="group"
512
+ aria-labelledby="group-label-${groupIndex}"
513
+ class="${groupClass}__items">
514
+ <li
515
+ role="presentation"
516
+ id="group-label-${groupIndex}"
517
+ class="${groupClass}__title">
518
+ ${group.title}
519
+ </li>
520
+ ${group.items.map((item, itemIndex) => this._renderItem(item, groupStartIndex + itemIndex, {
521
+ lastItem: isLastGroup &&
522
+ itemIndex === group.items.length - 1,
523
+ }))}
524
+ </ul>
525
+ `;
526
+ })}
527
+ </div>
528
+ `
529
+ : html `
530
+ <!-- Flat items only -->
531
+ <ul
532
+ aria-activedescendant="${this._getActiveOptionId()}"
533
+ aria-label="${this.i18n.listboxLabel}"
534
+ class="${blockClass}__items"
535
+ id="${blockClass}-listbox"
536
+ role="listbox">
537
+ ${this.items.map((item, index) => {
538
+ const itemIndex = currentIndex++;
539
+ return this._renderItem(item, itemIndex, {
540
+ firstItem: !this.headerConfig?.showHeader && index === 0,
541
+ lastItem: index === this.items.length - 1,
542
+ });
543
+ })}
494
544
  </ul>
495
- </li>
496
- `;
497
- })}
498
- </ul>
545
+ `}
499
546
  </div>
500
547
  `;
501
548
  }