@carbon/ai-chat-components 1.13.0 → 1.14.0-rc.0

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 (194) hide show
  1. package/custom-elements.json +1147 -462
  2. package/es/components/audio-player/src/audio-player.scss.js +1 -1
  3. package/es/components/audio-player/src/transcript.js +15 -0
  4. package/es/components/audio-player/src/transcript.js.map +1 -1
  5. package/es/components/card/src/card-footer.scss.js +1 -1
  6. package/es/components/card/src/card-steps.scss.js +1 -1
  7. package/es/components/card/src/card.scss.js +1 -1
  8. package/es/components/chat-button/src/chat-button.scss.js +1 -1
  9. package/es/components/chat-history/src/chat-history.scss.js +1 -1
  10. package/es/components/chat-shell/src/shell.scss.js +1 -1
  11. package/es/components/code-snippet/src/code-snippet.d.ts +3 -2
  12. package/es/components/code-snippet/src/code-snippet.js +4 -3
  13. package/es/components/code-snippet/src/code-snippet.js.map +1 -1
  14. package/es/components/code-snippet/src/code-snippet.scss.js +1 -1
  15. package/es/components/feedback/src/feedback.js +17 -3
  16. package/es/components/feedback/src/feedback.js.map +1 -1
  17. package/es/components/file-uploads/src/file-upload-item.scss.js +1 -1
  18. package/es/components/file-uploads/src/file-uploads.scss.js +1 -1
  19. package/es/components/launcher/src/launcher.scss.js +1 -1
  20. package/es/components/markdown/__tests__/inline-selection-fixture.d.ts +13 -0
  21. package/es/components/markdown/index.d.ts +2 -0
  22. package/es/components/markdown/index.js +3 -0
  23. package/es/components/markdown/index.js.map +1 -1
  24. package/es/components/markdown/src/inline-markdown.d.ts +41 -0
  25. package/es/components/markdown/src/inline-markdown.js +92 -0
  26. package/es/components/markdown/src/inline-markdown.js.map +1 -0
  27. package/es/components/markdown/src/inline-markdown.scss.js +13 -0
  28. package/es/components/markdown/src/inline-markdown.scss.js.map +1 -0
  29. package/es/components/markdown/src/inline-run-projection.scss.js +13 -0
  30. package/es/components/markdown/src/inline-run-projection.scss.js.map +1 -0
  31. package/es/components/markdown/src/markdown-renderer.js +131 -25
  32. package/es/components/markdown/src/markdown-renderer.js.map +1 -1
  33. package/es/components/markdown/src/markdown.js +1 -0
  34. package/es/components/markdown/src/markdown.js.map +1 -1
  35. package/es/components/markdown/src/markdown.scss.js +1 -1
  36. package/es/components/markdown/src/utils/inline-run-projection.d.ts +15 -0
  37. package/es/components/markdown/src/utils/inline-run-projection.js +196 -0
  38. package/es/components/markdown/src/utils/inline-run-projection.js.map +1 -0
  39. package/es/components/markdown/src/utils/inline-validation.d.ts +13 -0
  40. package/es/components/markdown/src/utils/inline-validation.js +97 -0
  41. package/es/components/markdown/src/utils/inline-validation.js.map +1 -0
  42. package/es/components/markdown/src/utils/plugin-fallback.js +20 -13
  43. package/es/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  44. package/es/components/markdown/src/utils/plugin-host-container.d.ts +5 -6
  45. package/es/components/markdown/src/utils/plugin-host-container.js.map +1 -1
  46. package/es/components/messages-shell/index.d.ts +11 -0
  47. package/es/components/messages-shell/index.js +9 -0
  48. package/es/components/messages-shell/index.js.map +1 -0
  49. package/es/components/messages-shell/src/messages-shell.d.ts +57 -0
  50. package/es/components/messages-shell/src/messages-shell.js +141 -0
  51. package/es/components/messages-shell/src/messages-shell.js.map +1 -0
  52. package/es/components/messages-shell/src/messages-shell.scss.js +13 -0
  53. package/es/components/messages-shell/src/messages-shell.scss.js.map +1 -0
  54. package/es/components/processing/src/processing.scss.js +1 -1
  55. package/es/components/prompt-line/autocomplete/src/autocomplete.d.ts +26 -9
  56. package/es/components/prompt-line/autocomplete/src/autocomplete.js +116 -107
  57. package/es/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
  58. package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  59. package/es/components/prompt-line/src/autocomplete-controller-element.js +13 -1
  60. package/es/components/prompt-line/src/autocomplete-controller-element.js.map +1 -1
  61. package/es/components/prompt-line/src/autocomplete-controller.js +9 -2
  62. package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  63. package/es/components/prompt-line/src/prompt-line-controller.d.ts +7 -0
  64. package/es/components/prompt-line/src/prompt-line-rich-runtime.js +17 -0
  65. package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  66. package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  67. package/es/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +1 -0
  68. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +3 -0
  69. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
  70. package/es/components/prompt-line/src/prompt-line.d.ts +7 -0
  71. package/es/components/prompt-line/src/prompt-line.js +9 -0
  72. package/es/components/prompt-line/src/prompt-line.js.map +1 -1
  73. package/es/components/prompt-line/src/send-control.scss.js +1 -1
  74. package/es/components/prompt-line/src/stop-streaming-button.scss.js +1 -1
  75. package/es/components/prompt-line/src/tiptap/carbon-mention.js +43 -21
  76. package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
  77. package/es/components/prompt-line/src/tiptap/plain-text-paste.js +8 -3
  78. package/es/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -1
  79. package/es/components/prompt-line/src/tiptap/strip-presentation-fields.d.ts +3 -3
  80. package/es/components/prompt-line/src/tiptap/strip-presentation-fields.js.map +1 -1
  81. package/es/components/prompt-line/src/tiptap/types.d.ts +27 -11
  82. package/es/components/reasoning-steps/src/reasoning-step.d.ts +3 -3
  83. package/es/components/reasoning-steps/src/reasoning-step.js +4 -4
  84. package/es/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  85. package/es/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  86. package/es/components/reasoning-steps/src/reasoning-steps-toggle.scss.js +1 -1
  87. package/es/components/reasoning-steps/src/reasoning-steps.d.ts +5 -4
  88. package/es/components/reasoning-steps/src/reasoning-steps.js +5 -4
  89. package/es/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
  90. package/es/components/truncated-text/src/truncated-text.scss.js +1 -1
  91. package/es/components/video-player/src/video-player.scss.js +1 -1
  92. package/es/react/hooks/useChatAutocomplete.js +7 -1
  93. package/es/react/hooks/useChatAutocomplete.js.map +1 -1
  94. package/es/react/messages-shell.d.ts +3 -0
  95. package/es/react/messages-shell.js +32 -0
  96. package/es/react/messages-shell.js.map +1 -0
  97. package/es-custom/components/audio-player/src/audio-player.scss.js +1 -1
  98. package/es-custom/components/audio-player/src/transcript.js +15 -0
  99. package/es-custom/components/audio-player/src/transcript.js.map +1 -1
  100. package/es-custom/components/card/src/card-footer.scss.js +1 -1
  101. package/es-custom/components/card/src/card-steps.scss.js +1 -1
  102. package/es-custom/components/card/src/card.scss.js +1 -1
  103. package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
  104. package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
  105. package/es-custom/components/chat-shell/src/shell.scss.js +1 -1
  106. package/es-custom/components/code-snippet/src/code-snippet.d.ts +3 -2
  107. package/es-custom/components/code-snippet/src/code-snippet.js +4 -3
  108. package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
  109. package/es-custom/components/code-snippet/src/code-snippet.scss.js +1 -1
  110. package/es-custom/components/feedback/src/feedback.js +17 -3
  111. package/es-custom/components/feedback/src/feedback.js.map +1 -1
  112. package/es-custom/components/file-uploads/src/file-upload-item.scss.js +1 -1
  113. package/es-custom/components/file-uploads/src/file-uploads.scss.js +1 -1
  114. package/es-custom/components/launcher/src/launcher.scss.js +1 -1
  115. package/es-custom/components/markdown/__tests__/inline-selection-fixture.d.ts +13 -0
  116. package/es-custom/components/markdown/index.d.ts +2 -0
  117. package/es-custom/components/markdown/index.js +3 -0
  118. package/es-custom/components/markdown/index.js.map +1 -1
  119. package/es-custom/components/markdown/src/inline-markdown.d.ts +41 -0
  120. package/es-custom/components/markdown/src/inline-markdown.js +92 -0
  121. package/es-custom/components/markdown/src/inline-markdown.js.map +1 -0
  122. package/es-custom/components/markdown/src/inline-markdown.scss.js +13 -0
  123. package/es-custom/components/markdown/src/inline-markdown.scss.js.map +1 -0
  124. package/es-custom/components/markdown/src/inline-run-projection.scss.js +13 -0
  125. package/es-custom/components/markdown/src/inline-run-projection.scss.js.map +1 -0
  126. package/es-custom/components/markdown/src/markdown-renderer.js +131 -25
  127. package/es-custom/components/markdown/src/markdown-renderer.js.map +1 -1
  128. package/es-custom/components/markdown/src/markdown.js +1 -0
  129. package/es-custom/components/markdown/src/markdown.js.map +1 -1
  130. package/es-custom/components/markdown/src/markdown.scss.js +1 -1
  131. package/es-custom/components/markdown/src/utils/inline-run-projection.d.ts +15 -0
  132. package/es-custom/components/markdown/src/utils/inline-run-projection.js +196 -0
  133. package/es-custom/components/markdown/src/utils/inline-run-projection.js.map +1 -0
  134. package/es-custom/components/markdown/src/utils/inline-validation.d.ts +13 -0
  135. package/es-custom/components/markdown/src/utils/inline-validation.js +97 -0
  136. package/es-custom/components/markdown/src/utils/inline-validation.js.map +1 -0
  137. package/es-custom/components/markdown/src/utils/plugin-fallback.js +20 -13
  138. package/es-custom/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  139. package/es-custom/components/markdown/src/utils/plugin-host-container.d.ts +5 -6
  140. package/es-custom/components/markdown/src/utils/plugin-host-container.js.map +1 -1
  141. package/es-custom/components/messages-shell/index.d.ts +11 -0
  142. package/es-custom/components/messages-shell/index.js +9 -0
  143. package/es-custom/components/messages-shell/index.js.map +1 -0
  144. package/es-custom/components/messages-shell/src/messages-shell.d.ts +57 -0
  145. package/es-custom/components/messages-shell/src/messages-shell.js +141 -0
  146. package/es-custom/components/messages-shell/src/messages-shell.js.map +1 -0
  147. package/es-custom/components/messages-shell/src/messages-shell.scss.js +13 -0
  148. package/es-custom/components/messages-shell/src/messages-shell.scss.js.map +1 -0
  149. package/es-custom/components/processing/src/processing.scss.js +1 -1
  150. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.d.ts +26 -9
  151. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js +116 -107
  152. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.js.map +1 -1
  153. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  154. package/es-custom/components/prompt-line/src/autocomplete-controller-element.js +13 -1
  155. package/es-custom/components/prompt-line/src/autocomplete-controller-element.js.map +1 -1
  156. package/es-custom/components/prompt-line/src/autocomplete-controller.js +9 -2
  157. package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  158. package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +7 -0
  159. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +17 -0
  160. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  161. package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  162. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +1 -0
  163. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +3 -0
  164. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
  165. package/es-custom/components/prompt-line/src/prompt-line.d.ts +7 -0
  166. package/es-custom/components/prompt-line/src/prompt-line.js +9 -0
  167. package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
  168. package/es-custom/components/prompt-line/src/send-control.scss.js +1 -1
  169. package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js +1 -1
  170. package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js +43 -21
  171. package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -1
  172. package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js +8 -3
  173. package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -1
  174. package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.d.ts +3 -3
  175. package/es-custom/components/prompt-line/src/tiptap/strip-presentation-fields.js.map +1 -1
  176. package/es-custom/components/prompt-line/src/tiptap/types.d.ts +27 -11
  177. package/es-custom/components/reasoning-steps/src/reasoning-step.d.ts +3 -3
  178. package/es-custom/components/reasoning-steps/src/reasoning-step.js +4 -4
  179. package/es-custom/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  180. package/es-custom/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  181. package/es-custom/components/reasoning-steps/src/reasoning-steps-toggle.scss.js +1 -1
  182. package/es-custom/components/reasoning-steps/src/reasoning-steps.d.ts +5 -4
  183. package/es-custom/components/reasoning-steps/src/reasoning-steps.js +5 -4
  184. package/es-custom/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
  185. package/es-custom/components/truncated-text/src/truncated-text.scss.js +1 -1
  186. package/es-custom/components/video-player/src/video-player.scss.js +1 -1
  187. package/es-custom/react/hooks/useChatAutocomplete.js +7 -1
  188. package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -1
  189. package/es-custom/react/messages-shell.d.ts +3 -0
  190. package/es-custom/react/messages-shell.js +32 -0
  191. package/es-custom/react/messages-shell.js.map +1 -0
  192. package/package.json +4 -4
  193. package/scss/_markdown-inline.scss +138 -0
  194. package/telemetry.yml +4 -0
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.js","sources":["../../../../../src/components/prompt-line/autocomplete/src/autocomplete.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 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\nimport { css, html, LitElement, unsafeCSS } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { carbonElement } from '../../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../../globals/settings.js';\nimport { AriaAnnouncerManager } from '../../../../globals/utils/aria-announcer-manager.js';\n\nimport styles from './autocomplete.scss?lit';\nimport { iconLoader } from '@carbon/web-components/es-custom/globals/internal/icon-loader.js';\nimport SendFilled16 from '@carbon/icons/es/send--filled/16.js';\n\nimport type {\n SuggestionItem,\n SuggestionItemGroup,\n} from '../../src/tiptap/types.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nconst blockClass = `${prefix}-autocomplete`;\nconst itemClass = `${blockClass}-item`;\nconst groupClass = `${itemClass}-group`;\n\n/**\n * Configuration for the autocomplete header\n */\nexport interface HeaderConfig {\n /** Whether to show the header */\n showHeader: boolean;\n /** Title text to display in the header */\n title: string;\n}\n\n/**\n * Localized / consumer-supplied strings for the autocomplete component.\n * All fields are required so callers explicitly provide every user-visible string.\n */\nexport interface AutocompleteI18n {\n /** Announced when the suggestions list is empty. */\n noSuggestions: string;\n /**\n * Announced when the suggestions list first opens.\n * Receives the item count so the caller can form the full phrase.\n *\n * @example (count) => `${count} suggestion${count === 1 ? \"\" : \"s\"}. Use up and down arrows to move, Enter to pick, Escape to close.`\n */\n suggestionsAvailable: (count: number) => string;\n /**\n * Announced when the user moves focus to an item via arrow keys.\n * Receives the item label, optional description, optional group label, and position info.\n *\n * @example (label, description, groupLabel, position) => `${label}${description ? `, ${description}` : \"\"}${groupLabel ? `, ${groupLabel}` : \"\"}, ${position}`\n */\n itemNavigation: (\n label: string,\n description: string | undefined,\n groupLabel: string | undefined,\n position: string\n ) => string;\n /**\n * Announced when an item is selected/inserted.\n * Receives the item label.\n *\n * @example (label) => `${label} inserted.`\n */\n itemInserted: (label: string) => string;\n /**\n * Announced when an item is sent to the chat.\n * Receives the item label.\n *\n * @example (label) => `${label} sent.`\n */\n itemSent: (label: string) => string;\n /** Announced when the suggestions list is closed/dismissed. */\n suggestionsClosed: string;\n /** Accessible label for the listbox element. */\n listboxLabel: string;\n /**\n * Accessible label for the implicit group that wraps flat (non-grouped) items\n * when the listbox element also contains grouped items.\n */\n nonGroupedItemsLabel: string;\n}\n\n/** Default English strings — used as the fallback value for `i18n`. */\nexport const defaultAutocompleteI18n: AutocompleteI18n = {\n noSuggestions: 'No suggestions.',\n suggestionsAvailable: (count) =>\n `${count} suggestion${count === 1 ? '' : 's'}. Use up and down arrows to move, Enter to pick, Escape to close.`,\n itemNavigation: (label, description, groupLabel, position) =>\n `${label}${description ? `, ${description}` : ''}${groupLabel ? `, ${groupLabel}` : ''}, ${position}`,\n itemInserted: (label) => `${label} inserted.`,\n itemSent: (label) => `${label} sent.`,\n suggestionsClosed: 'Suggestions closed.',\n listboxLabel: 'Autocomplete options',\n nonGroupedItemsLabel: 'Non-grouped options',\n};\n\n/**\n * Custom event detail for autocomplete select events\n */\nexport interface AutocompleteSelectEventDetail {\n item: SuggestionItem;\n}\n\n/**\n * Custom event detail for autocomplete send events\n */\nexport interface AutocompleteSendEventDetail {\n text: string;\n}\n\nexport interface AutocompleteNavigatedEventDetail {\n navigated: boolean;\n}\n\n/**\n * Autocomplete component for AI Chat input suggestions.\n *\n * @element cds-custom-aichat-autocomplete\n * @fires {CustomEvent<AutocompleteSelectEventDetail>} cds-custom-aichat-autocomplete-select - Fired when an item is clicked/activated and `disableDirectSend` is true (insert-into-editor path)\n * @fires {CustomEvent<AutocompleteSendEventDetail>} cds-custom-aichat-autocomplete-send - Fired when an item is clicked/activated and `disableDirectSend` is false (default: sends directly to chat)\n * @fires {CustomEvent} cds-custom-aichat-autocomplete-dismiss - Fired when the autocomplete is dismissed\n */\n@carbonElement(`${prefix}-autocomplete`)\nclass AutocompleteElement extends LitElement {\n static styles = css`\n ${unsafeCSS(styles)}\n `;\n\n /**\n * Array of suggestion items to display\n */\n @property({ type: Array, attribute: false })\n items: SuggestionItem[] = [];\n\n /**\n * Array of grouped suggestion items to display. These will be displayed after any provided `items`.\n */\n @property({ type: Array, attribute: false })\n groups: SuggestionItemGroup[] = [];\n\n /**\n * Optional header configuration\n */\n @property({ type: Object, attribute: false })\n headerConfig?: HeaderConfig;\n\n /**\n * Localized strings for announcements and labels.\n * Defaults to English via `defaultAutocompleteI18n`.\n */\n @property({ type: Object, attribute: false })\n i18n: AutocompleteI18n = defaultAutocompleteI18n;\n\n /**\n * The current text in the input (used to apply styling to indicate what user has already typed)\n */\n @property({ type: String, attribute: 'input-text', reflect: true })\n inputText = '';\n\n /**\n * When `false` (default), clicking an item fires `cds-custom-aichat-autocomplete-send` and\n * the item sends directly to chat.\n *\n * When `true`, clicking an item fires `cds-custom-aichat-autocomplete-select` instead\n * and inserts it into the editor rather than send immediately.\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-direct-send' })\n disableDirectSend = false;\n\n /**\n * Whether the autocomplete is attached to another element (e.g., an input field).\n * When true, the bottom corners will not be rounded.\n */\n @property({ type: Boolean, reflect: true })\n attached = true;\n\n /**\n * Optional element that \"owns\" this list (e.g. the editor). Clicks on the\n * anchor element are treated as inside-clicks and do not dismiss the list.\n */\n @property({ type: Object, attribute: false })\n anchorElement: Element | null = null;\n\n /**\n * Currently active item index\n * @internal\n */\n @state()\n private _focusedIndex = -1;\n\n private _userHasNavigated = false;\n\n private _setUserHasNavigated(value: boolean): void {\n if (this._userHasNavigated === value) {\n return;\n }\n this._userHasNavigated = value;\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-autocomplete-navigated',\n { detail: { navigated: value }, bubbles: true, composed: true }\n )\n );\n }\n\n private _announcer = new AriaAnnouncerManager();\n private _listboxEl: HTMLElement | null = null;\n\n /**\n * Pending arrow-move announcement timer. Held-key rapid fires are collapsed:\n * only the last pending label is spoken.\n */\n private _moveAnnouncePending: number | null = null;\n\n /** Whether the open announcement has already fired for this show. */\n private _openAnnounced = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener('keydown', this._handleKeydown);\n document.addEventListener('click', this._handleClickOutside);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this._handleKeydown);\n this._listboxEl?.removeEventListener('mousedown', this._handleMousedown);\n document.removeEventListener('click', this._handleClickOutside);\n this._announcer.disconnect();\n if (this._moveAnnouncePending !== null) {\n clearTimeout(this._moveAnnouncePending);\n this._moveAnnouncePending = null;\n }\n }\n\n public hasNavigated(): boolean {\n return this._userHasNavigated;\n }\n\n firstUpdated() {\n const regions = this.renderRoot.querySelectorAll<HTMLDivElement>(\n `.${blockClass}__live-region`\n );\n this._announcer.connect(Array.from(regions));\n this._listboxEl = this.renderRoot.querySelector<HTMLElement>(\n `.${blockClass}__items`\n );\n this._listboxEl?.addEventListener('mousedown', this._handleMousedown);\n }\n\n updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n const itemsChanged =\n changedProperties.has('items') || changedProperties.has('groups');\n\n if (itemsChanged) {\n const totalItems = this._getTotalItemCount();\n if (totalItems === 0) {\n this._announcer.announce(this.i18n.noSuggestions);\n this._openAnnounced = false;\n return;\n }\n this._focusedIndex = -1;\n this._setUserHasNavigated(false);\n if (!this._openAnnounced) {\n this._openAnnounced = true;\n this._announcer.announce(this.i18n.suggestionsAvailable(totalItems));\n }\n }\n }\n\n /**\n * Get the total count of all items (flat items + items in groups)\n */\n private _getTotalItemCount(): number {\n const flatCount = this.items.length;\n const groupedCount = this.groups.reduce(\n (sum, group) => sum + group.items.length,\n 0\n );\n return flatCount + groupedCount;\n }\n\n /**\n * Get the item at a specific index (accounting for both flat items and groups)\n */\n private _getItemAtIndex(index: number): SuggestionItem | null {\n if (index < this.items.length) {\n return this.items[index];\n }\n\n let currentIndex = this.items.length;\n for (const group of this.groups) {\n if (index < currentIndex + group.items.length) {\n return group.items[index - currentIndex];\n }\n currentIndex += group.items.length;\n }\n\n return null;\n }\n\n /**\n * Move focus to the next enabled item in the given direction (+1 / -1),\n * skipping over any disabled items. Mirrors the Carbon Dropdown `_navigate`\n * pattern. Returns the resolved index, or the current index if no enabled\n * item exists in that direction.\n */\n private _navigateTo(from: number, direction: 1 | -1): number {\n const totalItems = this._getTotalItemCount();\n // When no item is selected yet (-1), ArrowUp wraps to the last item.\n const start = from === -1 && direction === -1 ? totalItems : from;\n let next = start + direction;\n while (next >= 0 && next < totalItems) {\n if (!this._getItemAtIndex(next)?.disabled) {\n return next;\n }\n next += direction;\n }\n // No enabled item found in that direction — stay put (keep -1 if unnavigated).\n return from;\n }\n\n private _handleKeydown = (event: KeyboardEvent) => {\n const totalItems = this._getTotalItemCount();\n if (totalItems === 0) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this._focusedIndex = this._navigateTo(this._focusedIndex, 1);\n this._setUserHasNavigated(true);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n this._focusedIndex = this._navigateTo(this._focusedIndex, -1);\n this._setUserHasNavigated(true);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n\n case 'Home': {\n event.preventDefault();\n // Find first enabled item from the top.\n let first = 0;\n while (first < totalItems && this._getItemAtIndex(first)?.disabled) {\n first++;\n }\n this._focusedIndex = first < totalItems ? first : this._focusedIndex;\n this._setUserHasNavigated(true);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n }\n case 'End': {\n event.preventDefault();\n // Find last enabled item from the bottom.\n let last = totalItems - 1;\n while (last >= 0 && this._getItemAtIndex(last)?.disabled) {\n last--;\n }\n this._focusedIndex = last >= 0 ? last : this._focusedIndex;\n this._setUserHasNavigated(true);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n }\n\n case 'Tab':\n event.preventDefault();\n this._focusedIndex = this._navigateTo(this._focusedIndex, 1);\n this._setUserHasNavigated(true);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n\n case 'Escape':\n event.preventDefault();\n this._dismiss();\n break;\n\n case 'Enter':\n if (!this._userHasNavigated) {\n return;\n }\n event.preventDefault();\n this._handleItemClick(this._focusedIndex);\n break;\n }\n };\n\n /**\n * Schedule a move announcement, replacing any pending one so rapid arrow\n * holds only speak the final position.\n */\n private _scheduleMoveAnnouncement(index: number, total: number): void {\n if (this._moveAnnouncePending !== null) {\n clearTimeout(this._moveAnnouncePending);\n }\n this._moveAnnouncePending = window.setTimeout(() => {\n this._moveAnnouncePending = null;\n const item = this._getItemAtIndex(index);\n if (!item) {\n return;\n }\n const position = `${index + 1} of ${total}`;\n this._announcer.announce(\n this.i18n.itemNavigation(\n item.label,\n item.description,\n this._getGroupTitleAtIndex(index),\n position\n )\n );\n }, 50);\n }\n\n private _handleSend(index: number) {\n const item = this._getItemAtIndex(index);\n if (!item) {\n return;\n }\n this._focusedIndex = index;\n this._announcer.announce(this.i18n.itemSent(item.label));\n this.dispatchEvent(\n new CustomEvent<AutocompleteSendEventDetail>(\n 'cds-custom-aichat-autocomplete-send',\n {\n detail: { text: item.value ?? item.label },\n bubbles: true,\n composed: true,\n }\n )\n );\n }\n\n private _handleMousedown = (event: MouseEvent) => {\n // Prevent the editor from losing focus when the user clicks one of the list\n // items. Without this, mousedown transfers focus away from the editor,\n // carbonStarterTrigger.onTransaction fires, sees editor.isFocused === false,\n // and dismisses the list before the click event can trigger onSelect.\n event.preventDefault();\n };\n\n private _handleItemMouseEnter(index: number): void {\n if (this._getItemAtIndex(index)?.disabled) {\n return;\n }\n this._focusedIndex = index;\n }\n\n private _handleClickOutside = (event: MouseEvent) => {\n // Use composedPath() instead of event.target so clicks originating inside\n // a shadow root are visible.\n const path = event.composedPath();\n\n if (path.includes(this)) {\n return;\n }\n if (this.anchorElement && path.includes(this.anchorElement)) {\n return;\n }\n this._dismiss();\n };\n\n private _scrollActiveItemIntoView(): void {\n this.updateComplete.then(() => {\n const itemsContainer = this.shadowRoot?.querySelector(\n `.${blockClass}__items`\n );\n const options = Array.from(\n itemsContainer?.querySelectorAll('li[role=\"option\"]') ?? []\n );\n (options[this._focusedIndex] as HTMLElement | undefined)?.scrollIntoView({\n block: 'nearest',\n });\n });\n }\n\n private _selectItem(item: SuggestionItem) {\n if (item.disabled) {\n return;\n }\n this._announcer.announce(this.i18n.itemInserted(item.label));\n this.dispatchEvent(\n new CustomEvent<AutocompleteSelectEventDetail>(\n 'cds-custom-aichat-autocomplete-select',\n {\n detail: { item },\n bubbles: true,\n composed: true,\n }\n )\n );\n }\n\n private _dismiss() {\n this._openAnnounced = false;\n this._setUserHasNavigated(false);\n this._announcer.announce(this.i18n.suggestionsClosed);\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-autocomplete-dismiss', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private _handleItemClick(index: number) {\n const item = this._getItemAtIndex(index);\n if (!item || item.disabled) {\n return;\n }\n\n if (!this.disableDirectSend) {\n this._handleSend(index);\n return;\n }\n this._focusedIndex = index;\n this._selectItem(item);\n }\n\n private _getActiveOptionId(): string | undefined {\n if (!this._userHasNavigated) {\n return undefined;\n }\n const item = this._getItemAtIndex(this._focusedIndex);\n return item ? `${item.id}--option` : undefined;\n }\n\n private _getGroupTitleAtIndex(index: number): string | undefined {\n if (index < this.items.length) {\n return this.groups.length > 0\n ? this.i18n.nonGroupedItemsLabel\n : undefined;\n }\n\n let currentIndex = this.items.length;\n for (const group of this.groups) {\n const groupEndIndex = currentIndex + group.items.length;\n if (index < groupEndIndex) {\n return group.title;\n }\n currentIndex = groupEndIndex;\n }\n\n return undefined;\n }\n\n private _getLabelParts(item: SuggestionItem): {\n typed: string;\n remainder: string;\n } {\n const label = item.label;\n const input = this.inputText.toLowerCase();\n\n if (input && label.toLowerCase().startsWith(input)) {\n return {\n typed: label.substring(0, input.length),\n remainder: label.substring(input.length),\n };\n }\n\n return { typed: '', remainder: label };\n }\n\n /**\n * Render the avatar if provided\n */\n private _renderAvatar(item: SuggestionItem) {\n const { avatar } = item;\n if (!avatar) {\n return null;\n }\n if (typeof avatar === 'string') {\n return html`<div class=\"${itemClass}__avatar\">\n <img src=\"${avatar}\" alt=\"\" />\n </div>`;\n }\n // CarbonIcon descriptor (object, not a function)\n if (typeof avatar !== 'function') {\n return html`<div class=\"${itemClass}__avatar\">\n ${iconLoader(avatar)}\n </div>`;\n }\n return null;\n }\n\n /**\n * Render a single `<li role=\"option\">` for both flat and grouped contexts.\n */\n private _renderItem(\n item: SuggestionItem,\n index: number,\n opts: { firstItem?: boolean; lastItem?: boolean } = {}\n ) {\n const { typed, remainder } = this._getLabelParts(item);\n const isActive = this._userHasNavigated && index === this._focusedIndex;\n const isDisabled = !!item.disabled;\n const id = `${item.id}--option`;\n\n return html`\n <li\n @click=\"${() => this._handleItemClick(index)}\"\n @keydown=\"${(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n this._handleItemClick(index);\n }\n }}\"\n @mouseenter=\"${() => this._handleItemMouseEnter(index)}\"\n aria-selected=\"false\"\n aria-disabled=\"${isDisabled ? 'true' : 'false'}\"\n class=${classMap({\n [itemClass]: true,\n [`${itemClass}--active`]: isActive,\n [`${itemClass}--disabled`]: isDisabled,\n })}\n id=\"${id}\"\n role=\"option\"\n tabindex=\"-1\"\n ?first-item=\"${opts.firstItem}\"\n ?last-item=\"${opts.lastItem}\">\n <div class=\"${itemClass}__content\">\n ${this._renderAvatar(item)}\n <div class=\"${itemClass}__text\">\n <div class=\"${itemClass}__label\">\n ${\n typed\n ? html`<span class=\"${itemClass}__label-typed\"\n >${typed}</span\n >`\n : ''\n }${\n remainder\n ? html`<span class=\"${itemClass}__label-remainder\"\n >${remainder}</span\n >`\n : ''\n }\n </div>\n ${\n item.description\n ? html`<div class=\"${itemClass}__description\">\n ${item.description}\n </div>`\n : null\n }\n </div>\n </div>\n ${\n !this.disableDirectSend\n ? html`<span aria-hidden=\"true\" class=\"${itemClass}__send-icon\">\n ${iconLoader(SendFilled16)}\n </span>`\n : null\n }\n </li>\n `;\n }\n\n render() {\n const totalItems = this._getTotalItemCount();\n\n // Always render the live regions so the last announcement is not lost\n // when the list empties (e.g. \"No suggestions.\" or \"Suggestions closed.\").\n const liveRegions = html`\n <div\n class=\"${blockClass}__live-region\"\n aria-live=\"polite\"\n aria-atomic=\"false\"></div>\n <div\n class=\"${blockClass}__live-region\"\n aria-live=\"polite\"\n aria-atomic=\"false\"></div>\n `;\n\n if (totalItems === 0) {\n return liveRegions;\n }\n\n let currentIndex = 0;\n const hasGroups = this.groups.length > 0;\n\n return html`\n ${liveRegions}\n <div class=\"${blockClass}\">\n ${\n this.headerConfig?.showHeader\n ? html`\n <div class=\"${blockClass}__header\">\n <span class=\"${blockClass}__title\">\n ${this.headerConfig.title}\n </span>\n </div>\n `\n : ''\n }\n ${\n hasGroups\n ? html`\n <div\n aria-activedescendant=\"${this._getActiveOptionId()}\"\n aria-label=\"${this.i18n.listboxLabel}\"\n class=\"${blockClass}__items\"\n id=\"${blockClass}-listbox\"\n role=\"listbox\">\n <!-- Flat items wrapped in their own implicit group -->\n ${\n this.items.length > 0\n ? html`\n <ul\n role=\"group\"\n aria-label=\"${this.i18n.nonGroupedItemsLabel}\"\n class=\"${groupClass}__items\">\n ${this.items.map((item, index) => {\n const itemIndex = currentIndex++;\n return this._renderItem(item, itemIndex, {\n firstItem:\n !this.headerConfig?.showHeader && index === 0,\n });\n })}\n </ul>\n `\n : ''\n }\n\n <!-- Grouped items -->\n ${this.groups.map((group, groupIndex) => {\n const groupStartIndex = currentIndex;\n currentIndex += group.items.length;\n const isLastGroup = groupIndex === this.groups.length - 1;\n return html`\n <ul\n role=\"group\"\n aria-labelledby=\"group-label-${groupIndex}\"\n class=\"${groupClass}__items\">\n <li\n role=\"presentation\"\n id=\"group-label-${groupIndex}\"\n class=\"${groupClass}__title\">\n ${group.title}\n </li>\n ${group.items.map((item, itemIndex) =>\n this._renderItem(item, groupStartIndex + itemIndex, {\n lastItem:\n isLastGroup &&\n itemIndex === group.items.length - 1,\n })\n )}\n </ul>\n `;\n })}\n </div>\n `\n : html`\n <!-- Flat items only -->\n <ul\n aria-activedescendant=\"${this._getActiveOptionId()}\"\n aria-label=\"${this.i18n.listboxLabel}\"\n class=\"${blockClass}__items\"\n id=\"${blockClass}-listbox\"\n role=\"listbox\">\n ${this.items.map((item, index) => {\n const itemIndex = currentIndex++;\n return this._renderItem(item, itemIndex, {\n firstItem: !this.headerConfig?.showHeader && index === 0,\n lastItem: index === this.items.length - 1,\n });\n })}\n </ul>\n `\n }\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-custom-aichat-autocomplete': AutocompleteElement;\n }\n}\n\nexport default AutocompleteElement;\nexport type {\n SuggestionItem,\n SuggestionItemGroup,\n} from '../../src/tiptap/types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAmBH,MAAM,UAAU,GAAG,CAAA,EAAG,MAAM,eAAe;AAC3C,MAAM,SAAS,GAAG,CAAA,EAAG,UAAU,OAAO;AACtC,MAAM,UAAU,GAAG,CAAA,EAAG,SAAS,QAAQ;AA+DvC;AACO,MAAM,uBAAuB,GAAqB;AACvD,IAAA,aAAa,EAAE,iBAAiB;IAChC,oBAAoB,EAAE,CAAC,KAAK,KAC1B,CAAA,EAAG,KAAK,CAAA,WAAA,EAAc,KAAK,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,iEAAA,CAAmE;AACjH,IAAA,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,KACvD,CAAA,EAAG,KAAK,GAAG,WAAW,GAAG,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,GAAG,EAAE,CAAA,EAAG,UAAU,GAAG,CAAA,EAAA,EAAK,UAAU,EAAE,GAAG,EAAE,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAE;IACvG,YAAY,EAAE,CAAC,KAAK,KAAK,CAAA,EAAG,KAAK,CAAA,UAAA,CAAY;IAC7C,QAAQ,EAAE,CAAC,KAAK,KAAK,CAAA,EAAG,KAAK,CAAA,MAAA,CAAQ;AACrC,IAAA,iBAAiB,EAAE,qBAAqB;AACxC,IAAA,YAAY,EAAE,sBAAsB;AACpC,IAAA,oBAAoB,EAAE,qBAAqB;;AAqB7C;;;;;;;AAOG;AAEH,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAKE;;AAEG;QAEH,IAAA,CAAA,KAAK,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MAAA,CAAA;AAOhB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE;AACP,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAO7B,UAAA,CAAA;AADP,IAAA,KAAK;AACqB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAjEvB,mBAAmB,GAAA,UAAA,CAAA;AADxB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,aAAA,CAAe;AACjC,CAAA,EAAA,mBAAmB,CAmpBxB;AAQD,4BAAe,mBAAmB;;"}
1
+ {"version":3,"file":"autocomplete.js","sources":["../../../../../src/components/prompt-line/autocomplete/src/autocomplete.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 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\nimport { css, html, LitElement, nothing, unsafeCSS } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { carbonElement } from '../../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../../globals/settings.js';\nimport { AriaAnnouncerManager } from '../../../../globals/utils/aria-announcer-manager.js';\n\nimport styles from './autocomplete.scss?lit';\nimport { iconLoader } from '@carbon/web-components/es-custom/globals/internal/icon-loader.js';\nimport SendFilled16 from '@carbon/icons/es/send--filled/16.js';\n\nimport type {\n SuggestionItem,\n SuggestionItemGroup,\n} from '../../src/tiptap/types.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nconst blockClass = `${prefix}-autocomplete`;\nconst itemClass = `${blockClass}-item`;\nconst groupClass = `${itemClass}-group`;\n\n/**\n * One option in render order. `index` is its flat keyboard index;\n * `groupIndex` is its position in `groups`, or `undefined` when ungrouped.\n */\nexport interface FlatEntry {\n item: SuggestionItem;\n index: number;\n groupIndex: number | undefined;\n groupTitle: string | undefined;\n}\n\n/**\n * Configuration for the autocomplete header\n */\nexport interface HeaderConfig {\n /** Whether to show the header */\n showHeader: boolean;\n /** Title text to display in the header */\n title: string;\n}\n\n/**\n * Localized / consumer-supplied strings for the autocomplete component.\n * All fields are required so callers explicitly provide every user-visible string.\n */\nexport interface AutocompleteI18n {\n /** Announced when the suggestions list is empty. */\n noSuggestions: string;\n /**\n * Announced when the suggestions list first opens.\n * Receives the item count so the caller can form the full phrase.\n *\n * @example (count) => `${count} suggestion${count === 1 ? \"\" : \"s\"}. Use up and down arrows to move, Enter to pick, Escape to close.`\n */\n suggestionsAvailable: (count: number) => string;\n /**\n * Announced when the user moves focus to an item via arrow keys.\n * Receives the item label, optional description, optional group label, and position info.\n *\n * @example (label, description, groupLabel, position) => `${label}${description ? `, ${description}` : \"\"}${groupLabel ? `, ${groupLabel}` : \"\"}, ${position}`\n */\n itemNavigation: (\n label: string,\n description: string | undefined,\n groupLabel: string | undefined,\n position: string\n ) => string;\n /**\n * Announced when an item is selected/inserted.\n * Receives the item label.\n *\n * @example (label) => `${label} inserted.`\n */\n itemInserted: (label: string) => string;\n /**\n * Announced when an item is sent to the chat.\n * Receives the item label.\n *\n * @example (label) => `${label} sent.`\n */\n itemSent: (label: string) => string;\n /** Announced when the suggestions list is closed/dismissed. */\n suggestionsClosed: string;\n /** Accessible label for the listbox element. */\n listboxLabel: string;\n /**\n * Accessible label for the implicit group that wraps flat (non-grouped) items\n * when the listbox element also contains grouped items.\n */\n nonGroupedItemsLabel: string;\n}\n\n/** Default English strings — used as the fallback value for `i18n`. */\nexport const defaultAutocompleteI18n: AutocompleteI18n = {\n noSuggestions: 'No suggestions.',\n suggestionsAvailable: (count) =>\n `${count} suggestion${count === 1 ? '' : 's'}. Use up and down arrows to move, Enter to pick, Escape to close.`,\n itemNavigation: (label, description, groupLabel, position) =>\n `${label}${description ? `, ${description}` : ''}${groupLabel ? `, ${groupLabel}` : ''}, ${position}`,\n itemInserted: (label) => `${label} inserted.`,\n itemSent: (label) => `${label} sent.`,\n suggestionsClosed: 'Suggestions closed.',\n listboxLabel: 'Autocomplete options',\n nonGroupedItemsLabel: 'Non-grouped options',\n};\n\n/**\n * Custom event detail for autocomplete select events\n */\nexport interface AutocompleteSelectEventDetail {\n item: SuggestionItem;\n}\n\n/**\n * Custom event detail for autocomplete send events\n */\nexport interface AutocompleteSendEventDetail {\n text: string;\n}\n\nexport interface AutocompleteNavigatedEventDetail {\n navigated: boolean;\n}\n\n/**\n * Autocomplete component for AI Chat input suggestions.\n *\n * @element cds-custom-aichat-autocomplete\n * @fires {CustomEvent<AutocompleteSelectEventDetail>} cds-custom-aichat-autocomplete-select - Fired when an item is clicked/activated and `disableDirectSend` is true (insert-into-editor path)\n * @fires {CustomEvent<AutocompleteSendEventDetail>} cds-custom-aichat-autocomplete-send - Fired when an item is clicked/activated and `disableDirectSend` is false (default: sends directly to chat)\n * @fires {CustomEvent} cds-custom-aichat-autocomplete-dismiss - Fired when the autocomplete is dismissed\n */\n@carbonElement(`${prefix}-autocomplete`)\nclass AutocompleteElement extends LitElement {\n static styles = css`\n ${unsafeCSS(styles)}\n `;\n\n /**\n * Array of suggestion items to display\n */\n @property({ type: Array, attribute: false })\n items: SuggestionItem[] = [];\n\n /**\n * Array of grouped suggestion items to display. These will be displayed after any provided `items`.\n */\n @property({ type: Array, attribute: false })\n groups: SuggestionItemGroup[] = [];\n\n /**\n * Optional header configuration\n */\n @property({ type: Object, attribute: false })\n headerConfig?: HeaderConfig;\n\n /**\n * Localized strings for announcements and labels.\n * Defaults to English via `defaultAutocompleteI18n`.\n */\n @property({ type: Object, attribute: false })\n i18n: AutocompleteI18n = defaultAutocompleteI18n;\n\n /**\n * The current text in the input (used to apply styling to indicate what user has already typed)\n */\n @property({ type: String, attribute: 'input-text', reflect: true })\n inputText = '';\n\n /**\n * When `false` (default), clicking an item fires `cds-custom-aichat-autocomplete-send` and\n * the item sends directly to chat.\n *\n * When `true`, clicking an item fires `cds-custom-aichat-autocomplete-select` instead\n * and inserts it into the editor rather than send immediately.\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-direct-send' })\n disableDirectSend = false;\n\n /**\n * Whether the autocomplete is attached to another element (e.g., an input field).\n * When true, the bottom corners will not be rounded.\n */\n @property({ type: Boolean, reflect: true })\n attached = true;\n\n /**\n * Optional element that \"owns\" this list (e.g. the editor). Clicks on the\n * anchor element are treated as inside-clicks and do not dismiss the list.\n */\n @property({ type: Object, attribute: false })\n anchorElement: Element | null = null;\n\n /**\n * Currently active item index\n * @internal\n */\n @state()\n private _focusedIndex = -1;\n\n private _userHasNavigated = false;\n\n private _setUserHasNavigated(value: boolean): void {\n if (this._userHasNavigated === value) {\n return;\n }\n this._userHasNavigated = value;\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-autocomplete-navigated',\n { detail: { navigated: value }, bubbles: true, composed: true }\n )\n );\n }\n\n private _announcer = new AriaAnnouncerManager();\n private _listboxEl: HTMLElement | null = null;\n\n /**\n * Pending arrow-move announcement timer. Held-key rapid fires are collapsed:\n * only the last pending label is spoken.\n */\n private _moveAnnouncePending: number | null = null;\n\n /** Cached flat item list, rebuilt on every update via willUpdate. */\n private _flatList: FlatEntry[] = [];\n\n /** Whether the open announcement has already fired for this show. */\n private _openAnnounced = false;\n\n /** Total item count from the last announcement, used to detect count changes. */\n private _previousTotalItems = 0;\n\n /**\n * Pending timer for filtered count announcement. Keystroke updates are debounced\n * so rapid typing does not interrupt typing echo with an announcement on every key.\n */\n private _filterAnnouncePending: number | null = null;\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener('keydown', this._handleKeydown);\n document.addEventListener('click', this._handleClickOutside);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this._handleKeydown);\n this._listboxEl?.removeEventListener('mousedown', this._handleMousedown);\n document.removeEventListener('click', this._handleClickOutside);\n this._announcer.disconnect();\n if (this._moveAnnouncePending !== null) {\n clearTimeout(this._moveAnnouncePending);\n this._moveAnnouncePending = null;\n }\n if (this._filterAnnouncePending !== null) {\n clearTimeout(this._filterAnnouncePending);\n this._filterAnnouncePending = null;\n }\n }\n\n public hasNavigated(): boolean {\n return this._userHasNavigated;\n }\n\n firstUpdated() {\n const regions = this.renderRoot.querySelectorAll<HTMLDivElement>(\n `.${blockClass}__live-region`\n );\n this._announcer.connect(Array.from(regions));\n this._listboxEl = this.renderRoot.querySelector<HTMLElement>(\n `.${blockClass}__items`\n );\n this._listboxEl?.addEventListener('mousedown', this._handleMousedown);\n }\n\n willUpdate(changedProperties: Map<string, any>) {\n super.willUpdate(changedProperties);\n this._flatList = this._buildFlatList();\n }\n\n updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n const itemsChanged =\n changedProperties.has('items') || changedProperties.has('groups');\n\n if (itemsChanged) {\n if (this._moveAnnouncePending !== null) {\n clearTimeout(this._moveAnnouncePending);\n this._moveAnnouncePending = null;\n }\n const totalItems = this._flatList.length;\n if (totalItems === 0) {\n if (this._filterAnnouncePending !== null) {\n clearTimeout(this._filterAnnouncePending);\n this._filterAnnouncePending = null;\n }\n this._focusedIndex = -1;\n this._setUserHasNavigated(false);\n this._announcer.announce(this.i18n.noSuggestions);\n this._openAnnounced = false;\n this._previousTotalItems = 0;\n return;\n }\n this._focusedIndex = -1;\n this._setUserHasNavigated(false);\n if (!this._openAnnounced) {\n this._openAnnounced = true;\n this._previousTotalItems = totalItems;\n this._announcer.announce(this.i18n.suggestionsAvailable(totalItems));\n } else if (totalItems !== this._previousTotalItems) {\n this._previousTotalItems = totalItems;\n if (this._filterAnnouncePending !== null) {\n clearTimeout(this._filterAnnouncePending);\n }\n this._filterAnnouncePending = window.setTimeout(() => {\n this._filterAnnouncePending = null;\n this._announcer.announce(this.i18n.suggestionsAvailable(totalItems));\n }, 250);\n }\n }\n }\n\n /**\n * Build a flat list of all items in render order: ungrouped items first,\n * then each group's items in group order. Called unconditionally from\n * willUpdate so in-place mutations followed by requestUpdate() are reflected.\n */\n private _buildFlatList(): FlatEntry[] {\n const result: FlatEntry[] = [];\n const hasGroups = this.groups.length > 0;\n for (const item of this.items) {\n result.push({\n item,\n index: result.length,\n groupIndex: undefined,\n groupTitle: hasGroups ? this.i18n.nonGroupedItemsLabel : undefined,\n });\n }\n this.groups.forEach((group, groupIndex) => {\n for (const item of group.items) {\n result.push({\n item,\n index: result.length,\n groupIndex,\n groupTitle: group.title,\n });\n }\n });\n return result;\n }\n\n /**\n * Move focus to the next enabled item in the given direction (+1 / -1),\n * skipping over any disabled items. Mirrors the Carbon Dropdown `_navigate`\n * pattern. Returns the resolved index, or `from` if no enabled item exists\n * in that direction.\n */\n private _navigateTo(\n list: FlatEntry[],\n from: number,\n direction: 1 | -1\n ): number {\n // When no item is selected yet (-1), ArrowUp wraps to the last item.\n const start = from === -1 && direction === -1 ? list.length : from;\n let next = start + direction;\n while (next >= 0 && next < list.length) {\n if (!list[next].item.disabled) {\n return next;\n }\n next += direction;\n }\n // No enabled item found in that direction — stay put (keep -1 if unnavigated).\n return from;\n }\n\n private _handleKeydown = (event: KeyboardEvent) => {\n const list = this._flatList;\n const totalItems = list.length;\n if (totalItems === 0) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this._focusedIndex = this._navigateTo(list, this._focusedIndex, 1);\n this._setUserHasNavigated(this._focusedIndex !== -1);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n\n case 'ArrowUp':\n event.preventDefault();\n this._focusedIndex = this._navigateTo(list, this._focusedIndex, -1);\n this._setUserHasNavigated(this._focusedIndex !== -1);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n\n case 'Home':\n case 'End': {\n event.preventDefault();\n // Scanning from -1 lands on the first enabled item going down and\n // wraps to the last enabled item going up. Stay put if none exists.\n const target = this._navigateTo(\n list,\n -1,\n event.key === 'Home' ? 1 : -1\n );\n if (target !== -1) {\n this._focusedIndex = target;\n }\n this._setUserHasNavigated(this._focusedIndex !== -1);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n }\n\n case 'Tab':\n event.preventDefault();\n this._focusedIndex = this._navigateTo(list, this._focusedIndex, 1);\n this._setUserHasNavigated(this._focusedIndex !== -1);\n this._scheduleMoveAnnouncement(this._focusedIndex, totalItems);\n this._scrollActiveItemIntoView();\n break;\n\n case 'Escape':\n event.preventDefault();\n this._dismiss();\n break;\n\n case 'Enter':\n if (!this._userHasNavigated) {\n return;\n }\n event.preventDefault();\n this._handleItemClick(this._focusedIndex);\n break;\n }\n };\n\n /**\n * Schedule a move announcement, replacing any pending one so rapid arrow\n * holds only speak the final position.\n */\n private _scheduleMoveAnnouncement(index: number, total: number): void {\n if (this._moveAnnouncePending !== null) {\n clearTimeout(this._moveAnnouncePending);\n }\n this._moveAnnouncePending = window.setTimeout(() => {\n this._moveAnnouncePending = null;\n const entry = this._flatList[index];\n if (!entry) {\n return;\n }\n const position = `${index + 1} of ${total}`;\n this._announcer.announce(\n this.i18n.itemNavigation(\n entry.item.label,\n entry.item.description,\n entry.groupTitle,\n position\n )\n );\n }, 50);\n }\n\n private _handleSend(index: number, item: SuggestionItem) {\n this._focusedIndex = index;\n this._announcer.announce(this.i18n.itemSent(item.label));\n this.dispatchEvent(\n new CustomEvent<AutocompleteSendEventDetail>(\n 'cds-custom-aichat-autocomplete-send',\n {\n detail: { text: item.value ?? item.label },\n bubbles: true,\n composed: true,\n }\n )\n );\n }\n\n private _handleMousedown = (event: MouseEvent) => {\n // Prevent the editor from losing focus when the user clicks one of the list\n // items. Without this, mousedown transfers focus away from the editor,\n // carbonStarterTrigger.onTransaction fires, sees editor.isFocused === false,\n // and dismisses the list before the click event can trigger onSelect.\n event.preventDefault();\n };\n\n private _handleItemMouseEnter(index: number): void {\n if (this._flatList[index]?.item.disabled) {\n return;\n }\n this._focusedIndex = index;\n }\n\n private _handleClickOutside = (event: MouseEvent) => {\n // Use composedPath() instead of event.target so clicks originating inside\n // a shadow root are visible.\n const path = event.composedPath();\n\n if (path.includes(this)) {\n return;\n }\n if (this.anchorElement && path.includes(this.anchorElement)) {\n return;\n }\n this._dismiss();\n };\n\n private _scrollActiveItemIntoView(): void {\n this.updateComplete.then(() => {\n const itemsContainer = this.shadowRoot?.querySelector(\n `.${blockClass}__items`\n );\n const options = Array.from(\n itemsContainer?.querySelectorAll('li[role=\"option\"]') ?? []\n );\n (options[this._focusedIndex] as HTMLElement | undefined)?.scrollIntoView({\n block: 'nearest',\n });\n });\n }\n\n private _selectItem(item: SuggestionItem) {\n if (item.disabled) {\n return;\n }\n this._announcer.announce(this.i18n.itemInserted(item.label));\n this.dispatchEvent(\n new CustomEvent<AutocompleteSelectEventDetail>(\n 'cds-custom-aichat-autocomplete-select',\n {\n detail: { item },\n bubbles: true,\n composed: true,\n }\n )\n );\n }\n\n private _dismiss() {\n if (this._filterAnnouncePending !== null) {\n clearTimeout(this._filterAnnouncePending);\n this._filterAnnouncePending = null;\n }\n this._openAnnounced = false;\n this._previousTotalItems = 0;\n this._setUserHasNavigated(false);\n this._announcer.announce(this.i18n.suggestionsClosed);\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-autocomplete-dismiss', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private _handleItemClick(index: number) {\n const item = this._flatList[index]?.item;\n if (!item || item.disabled) {\n return;\n }\n\n if (!this.disableDirectSend) {\n this._handleSend(index, item);\n return;\n }\n this._focusedIndex = index;\n this._selectItem(item);\n }\n\n private _getActiveOptionId(): string | undefined {\n if (!this._userHasNavigated) {\n return undefined;\n }\n const entry = this._flatList[this._focusedIndex];\n return entry ? `${entry.item.id}--option` : undefined;\n }\n\n private _getLabelParts(item: SuggestionItem): {\n typed: string;\n remainder: string;\n } {\n const label = item.label;\n const input = this.inputText.toLowerCase();\n\n if (input && label.toLowerCase().startsWith(input)) {\n return {\n typed: label.substring(0, input.length),\n remainder: label.substring(input.length),\n };\n }\n\n return { typed: '', remainder: label };\n }\n\n /**\n * Render the avatar if provided\n */\n private _renderAvatar(item: SuggestionItem) {\n const { avatar } = item;\n if (!avatar) {\n return null;\n }\n if (typeof avatar === 'string') {\n return html`<div class=\"${itemClass}__avatar\">\n <img src=\"${avatar}\" alt=\"\" />\n </div>`;\n }\n // CarbonIcon descriptor (object, not a function)\n if (typeof avatar !== 'function') {\n return html`<div class=\"${itemClass}__avatar\">\n ${iconLoader(avatar)}\n </div>`;\n }\n return null;\n }\n\n /**\n * Render a single `<li role=\"option\">` for both flat and grouped contexts.\n */\n private _renderItem(\n item: SuggestionItem,\n index: number,\n opts: { firstItem?: boolean; lastItem?: boolean } = {}\n ) {\n const { typed, remainder } = this._getLabelParts(item);\n const isActive = this._userHasNavigated && index === this._focusedIndex;\n const isDisabled = !!item.disabled;\n const id = `${item.id}--option`;\n\n return html`\n <li\n @click=\"${() => this._handleItemClick(index)}\"\n @keydown=\"${(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n this._handleItemClick(index);\n }\n }}\"\n @mouseenter=\"${() => this._handleItemMouseEnter(index)}\"\n aria-selected=\"false\"\n aria-disabled=\"${isDisabled ? 'true' : 'false'}\"\n class=${classMap({\n [itemClass]: true,\n [`${itemClass}--active`]: isActive,\n [`${itemClass}--disabled`]: isDisabled,\n })}\n id=\"${id}\"\n role=\"option\"\n tabindex=\"-1\"\n ?first-item=\"${opts.firstItem}\"\n ?last-item=\"${opts.lastItem}\">\n <div class=\"${itemClass}__content\">\n ${this._renderAvatar(item)}\n <div class=\"${itemClass}__text\">\n <div class=\"${itemClass}__label\">\n ${\n typed\n ? html`<span class=\"${itemClass}__label-typed\"\n >${typed}</span\n >`\n : ''\n }${\n remainder\n ? html`<span class=\"${itemClass}__label-remainder\"\n >${remainder}</span\n >`\n : ''\n }\n </div>\n ${\n item.description\n ? html`<div class=\"${itemClass}__description\">\n ${item.description}\n </div>`\n : null\n }\n </div>\n </div>\n ${\n !this.disableDirectSend\n ? html`<span aria-hidden=\"true\" class=\"${itemClass}__send-icon\">\n ${iconLoader(SendFilled16)}\n </span>`\n : null\n }\n </li>\n `;\n }\n\n render() {\n const flatList = this._flatList;\n\n // Always render the live regions so the last announcement is not lost\n // when the list empties (e.g. \"No suggestions.\" or \"Suggestions closed.\").\n const liveRegions = html`\n <div\n class=\"${blockClass}__live-region\"\n aria-live=\"polite\"\n aria-atomic=\"false\"></div>\n <div\n class=\"${blockClass}__live-region\"\n aria-live=\"polite\"\n aria-atomic=\"false\"></div>\n `;\n\n if (flatList.length === 0) {\n return liveRegions;\n }\n\n const hasGroups = this.groups.length > 0;\n const activeOptionId = this._getActiveOptionId();\n const ungrouped = flatList.filter(\n (entry) => entry.groupIndex === undefined\n );\n\n return html`\n ${liveRegions}\n <div class=\"${blockClass}\">\n ${\n this.headerConfig?.showHeader\n ? html`\n <div class=\"${blockClass}__header\">\n <span class=\"${blockClass}__title\">\n ${this.headerConfig.title}\n </span>\n </div>\n `\n : ''\n }\n ${\n hasGroups\n ? html`\n <div\n aria-activedescendant=\"${activeOptionId ?? nothing}\"\n aria-label=\"${this.i18n.listboxLabel}\"\n class=\"${blockClass}__items\"\n id=\"${blockClass}-listbox\"\n role=\"listbox\">\n <!-- Flat items wrapped in their own implicit group -->\n ${\n ungrouped.length > 0\n ? html`\n <ul\n role=\"group\"\n aria-label=\"${this.i18n.nonGroupedItemsLabel}\"\n class=\"${groupClass}__items\">\n ${ungrouped.map(({ item, index }) =>\n this._renderItem(item, index, {\n firstItem:\n !this.headerConfig?.showHeader && index === 0,\n })\n )}\n </ul>\n `\n : ''\n }\n\n <!-- Grouped items -->\n ${this.groups.map((group, groupIndex) => {\n const entries = flatList.filter(\n (entry) => entry.groupIndex === groupIndex\n );\n const isLastGroup = groupIndex === this.groups.length - 1;\n return html`\n <ul\n role=\"group\"\n aria-labelledby=\"group-label-${groupIndex}\"\n class=\"${groupClass}__items\">\n <li\n role=\"presentation\"\n id=\"group-label-${groupIndex}\"\n class=\"${groupClass}__title\">\n ${group.title}\n </li>\n ${entries.map(({ item, index }, position) =>\n this._renderItem(item, index, {\n lastItem:\n isLastGroup && position === entries.length - 1,\n })\n )}\n </ul>\n `;\n })}\n </div>\n `\n : html`\n <!-- Flat items only -->\n <ul\n aria-activedescendant=\"${activeOptionId ?? nothing}\"\n aria-label=\"${this.i18n.listboxLabel}\"\n class=\"${blockClass}__items\"\n id=\"${blockClass}-listbox\"\n role=\"listbox\">\n ${flatList.map(({ item, index }) =>\n this._renderItem(item, index, {\n firstItem: !this.headerConfig?.showHeader && index === 0,\n lastItem: index === flatList.length - 1,\n })\n )}\n </ul>\n `\n }\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-custom-aichat-autocomplete': AutocompleteElement;\n }\n}\n\nexport default AutocompleteElement;\nexport type {\n SuggestionItem,\n SuggestionItemGroup,\n} from '../../src/tiptap/types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAmBH,MAAM,UAAU,GAAG,CAAA,EAAG,MAAM,eAAe;AAC3C,MAAM,SAAS,GAAG,CAAA,EAAG,UAAU,OAAO;AACtC,MAAM,UAAU,GAAG,CAAA,EAAG,SAAS,QAAQ;AA0EvC;AACO,MAAM,uBAAuB,GAAqB;AACvD,IAAA,aAAa,EAAE,iBAAiB;IAChC,oBAAoB,EAAE,CAAC,KAAK,KAC1B,CAAA,EAAG,KAAK,CAAA,WAAA,EAAc,KAAK,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,iEAAA,CAAmE;AACjH,IAAA,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,KACvD,CAAA,EAAG,KAAK,GAAG,WAAW,GAAG,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,GAAG,EAAE,CAAA,EAAG,UAAU,GAAG,CAAA,EAAA,EAAK,UAAU,EAAE,GAAG,EAAE,CAAA,EAAA,EAAK,QAA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ACqB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAjEvB,mBAAmB,GAAA,UAAA,CAAA;AADxB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,aAAA,CAAe;AACjC,CAAA,EAAA,mBAAmB,CAsqBxB;AAQD,4BAAe,mBAAmB;;"}
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { css } from 'lit';
9
9
 
10
- var styles = css([":host :host([data-rounded=\"\"]),:host [data-rounded=\"\"]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=\"\"])::part(button),:host :host([data-rounded=\"\"])::part(link),:host [data-rounded=\"\"]::part(button),:host [data-rounded=\"\"]::part(link){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem);outline-offset:-.0625rem}:host :host([data-rounded=\"\"])>:only-child,:host [data-rounded=\"\"]>:only-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]),:host [data-rounded=top]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]),:host [data-rounded=top-left]{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]),:host [data-rounded=top-right]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]),:host [data-rounded=bottom]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]),:host [data-rounded=bottom-left]{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]),:host [data-rounded=bottom-right]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child,:host [data-rounded=top]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child,:host [data-rounded=top]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child,:host [data-rounded=top-left]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top-left]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child,:host [data-rounded=top-right]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top-right]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child,:host [data-rounded=bottom]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child,:host [data-rounded=bottom]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child,:host [data-rounded=bottom-left]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom-left]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child,:host [data-rounded=bottom-right]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom-right]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child,:host [data-rounded=top][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child::part(button),:host [data-rounded=top][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child,:host [data-rounded=top-right][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child::part(button),:host [data-rounded=top-right][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child,:host [data-rounded=top-left][data-stacked]>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child::part(button),:host [data-rounded=top-left][data-stacked]>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child,:host [data-rounded=bottom][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child::part(button),:host [data-rounded=bottom][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child,:host [data-rounded=bottom-right][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-right][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child,:host [data-rounded=bottom-left][data-stacked]>:last-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-left][data-stacked]>:last-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;--cds-aichat-autocomplete-max-height:none}:host .cds-custom-aichat-autocomplete{background:var(--cds-chat-prompt-background,#fff);border:1px solid var(--cds-chat-prompt-border-start,#f4f4f4);border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0);border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0);display:flex;flex-direction:column;max-block-size:var(--cds-aichat-autocomplete-max-height)}:host .cds-custom-aichat-autocomplete__header{align-items:center;border-block-end:1px solid var(--cds-border-subtle-00,#e0e0e0);display:flex;flex-shrink:0;gap:1rem;justify-content:space-between;min-block-size:2.5rem;padding-block:0;padding-inline:1rem}:host .cds-custom-aichat-autocomplete__title{color:var(--cds-text-primary,#161616);font-size:var(--cds-heading-compact-01-font-size,.875rem);font-weight:var(--cds-heading-compact-01-font-weight,600);letter-spacing:var(--cds-heading-compact-01-letter-spacing,.16px);line-height:var(--cds-heading-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete__items{display:flex;flex:1 1 auto;flex-direction:column;margin:0;min-block-size:0;overflow-y:auto;padding:0}:host .cds-custom-aichat-autocomplete__live-region{clip:rect(0,0,0,0);block-size:1px;border:0;inline-size:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap}:host .cds-custom-aichat-autocomplete-item-group__title{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);letter-spacing:var(--cds-label-01-letter-spacing,.32px);line-height:var(--cds-label-01-line-height,1.33333);padding-block-end:.25rem;padding-block-start:1rem;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item-group__items{display:flex;flex-direction:column;margin:0;padding:0}:host .cds-custom-aichat-autocomplete-item{align-items:start;background:none;border:none;cursor:pointer;display:flex;font:inherit;inline-size:100%;min-block-size:2.5rem;padding-block:0;padding-inline:0;position:relative;text-align:start}:host .cds-custom-aichat-autocomplete-item:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-custom-aichat-autocomplete-item:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){:host .cds-custom-aichat-autocomplete-item:focus{outline-style:dotted}}:host .cds-custom-aichat-autocomplete-item--active,:host .cds-custom-aichat-autocomplete-item--active:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-custom-aichat-autocomplete-item--disabled{cursor:default;pointer-events:none}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-remainder,:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-icon-disabled,hsla(0,0%,9%,.25))}:host .cds-custom-aichat-autocomplete-item__content{align-items:start;display:flex;flex:1;gap:.5rem;padding-block:11px;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item__text{display:flex;flex-direction:column;gap:.125rem}:host .cds-custom-aichat-autocomplete-item__label{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-placeholder,hsla(0,0%,9%,.4))}:host .cds-custom-aichat-autocomplete-item__label-remainder{color:var(--cds-text-primary,#161616)}:host .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-secondary,#525252);font-size:var(--cds-helper-text-01-font-size,.75rem);letter-spacing:var(--cds-helper-text-01-letter-spacing,.32px);line-height:var(--cds-helper-text-01-line-height,1.33333)}:host .cds-custom-aichat-autocomplete-item__send-icon{align-self:start;display:flex;padding-block:.75rem;padding-inline:.75rem;pointer-events:none;visibility:hidden;z-index:1}:host .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-interactive,#0f62fe)}:host .cds-custom-aichat-autocomplete-item--active .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus-within .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:hover .cds-custom-aichat-autocomplete-item__send-icon{visibility:visible}:host .cds-custom-aichat-autocomplete-item:after{background:var(--cds-border-subtle-00,#e0e0e0);block-size:1px;content:\"\";display:block;inset-block-end:0;inset-inline:1rem;position:absolute}:host .cds-custom-aichat-autocomplete-item:focus:after,:host .cds-custom-aichat-autocomplete-item:hover:after{display:none}:host .cds-custom-aichat-autocomplete-item[first-item]{border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]{border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]:after{display:none}:host([attached]){--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}"]);
10
+ var styles = css([":host :host([data-rounded=\"\"]),:host [data-rounded=\"\"]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=\"\"])::part(button),:host :host([data-rounded=\"\"])::part(link),:host [data-rounded=\"\"]::part(button),:host [data-rounded=\"\"]::part(link){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem);outline-offset:-.0625rem}:host :host([data-rounded=\"\"])>:only-child,:host [data-rounded=\"\"]>:only-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]),:host [data-rounded=top]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]),:host [data-rounded=top-left]{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]),:host [data-rounded=top-right]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]),:host [data-rounded=bottom]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]),:host [data-rounded=bottom-left]{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]),:host [data-rounded=bottom-right]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child,:host [data-rounded=top]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child,:host [data-rounded=top]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child,:host [data-rounded=top-left]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top-left]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child,:host [data-rounded=top-right]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top-right]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child,:host [data-rounded=bottom]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child,:host [data-rounded=bottom]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child,:host [data-rounded=bottom-left]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom-left]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child,:host [data-rounded=bottom-right]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom-right]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child,:host [data-rounded=top][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child::part(button),:host [data-rounded=top][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child,:host [data-rounded=top-right][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child::part(button),:host [data-rounded=top-right][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child,:host [data-rounded=top-left][data-stacked]>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child::part(button),:host [data-rounded=top-left][data-stacked]>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child,:host [data-rounded=bottom][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child::part(button),:host [data-rounded=bottom][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child,:host [data-rounded=bottom-right][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-right][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child,:host [data-rounded=bottom-left][data-stacked]>:last-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-left][data-stacked]>:last-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;--cds-aichat-autocomplete-max-height:none}:host .cds-custom-aichat-autocomplete{background:var(--cds-chat-prompt-background,#fff);border:1px solid var(--cds-chat-prompt-border-start,#f4f4f4);border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0);border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0);display:flex;flex-direction:column;max-block-size:var(--cds-aichat-autocomplete-max-height)}:host .cds-custom-aichat-autocomplete__header{align-items:center;border-block-end:1px solid var(--cds-border-subtle-00,#e0e0e0);display:flex;flex-shrink:0;gap:1rem;justify-content:space-between;min-block-size:2.5rem;padding-block:0;padding-inline:1rem}:host .cds-custom-aichat-autocomplete__title{color:var(--cds-text-primary,#161616);font-size:var(--cds-heading-compact-01-font-size,.875rem);font-weight:var(--cds-heading-compact-01-font-weight,600);letter-spacing:var(--cds-heading-compact-01-letter-spacing,.16px);line-height:var(--cds-heading-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete__items{display:flex;flex:1 1 auto;flex-direction:column;margin:0;min-block-size:0;overflow-y:auto;padding:0}:host .cds-custom-aichat-autocomplete__live-region{block-size:1px;border:0;overflow:hidden;padding:0;position:absolute;clip:rect(0,0,0,0);inline-size:1px;white-space:nowrap}:host .cds-custom-aichat-autocomplete-item-group__title{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);letter-spacing:var(--cds-label-01-letter-spacing,.32px);line-height:var(--cds-label-01-line-height,1.33333);padding-block-end:.25rem;padding-block-start:1rem;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item-group__items{display:flex;flex-direction:column;margin:0;padding:0}:host .cds-custom-aichat-autocomplete-item{align-items:start;background:none;border:none;cursor:pointer;display:flex;font:inherit;inline-size:100%;min-block-size:2.5rem;padding-block:0;padding-inline:0;position:relative;text-align:start}:host .cds-custom-aichat-autocomplete-item:hover{background:var(--cds-background-hover,hsla(0,0%,55.3%,.12))}:host .cds-custom-aichat-autocomplete-item:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){:host .cds-custom-aichat-autocomplete-item:focus{outline-style:dotted}}:host .cds-custom-aichat-autocomplete-item--active,:host .cds-custom-aichat-autocomplete-item--active:hover{background:var(--cds-background-hover,hsla(0,0%,55.3%,.12))}:host .cds-custom-aichat-autocomplete-item--disabled{cursor:default;pointer-events:none}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-remainder,:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-disabled,rgba(22,22,22,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-disabled,rgba(22,22,22,.25))}:host .cds-custom-aichat-autocomplete-item--disabled .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-icon-disabled,rgba(22,22,22,.25))}:host .cds-custom-aichat-autocomplete-item__content{align-items:start;display:flex;flex:1;gap:.5rem;padding-block:11px;padding-inline:1rem}:host .cds-custom-aichat-autocomplete-item__text{display:flex;flex-direction:column;gap:.125rem}:host .cds-custom-aichat-autocomplete-item__label{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}:host .cds-custom-aichat-autocomplete-item__label-typed{color:var(--cds-text-placeholder,rgba(22,22,22,.4))}:host .cds-custom-aichat-autocomplete-item__label-remainder{color:var(--cds-text-primary,#161616)}:host .cds-custom-aichat-autocomplete-item__description{color:var(--cds-text-secondary,#525252);font-size:var(--cds-helper-text-01-font-size,.75rem);letter-spacing:var(--cds-helper-text-01-letter-spacing,.32px);line-height:var(--cds-helper-text-01-line-height,1.33333)}:host .cds-custom-aichat-autocomplete-item__send-icon{align-self:start;display:flex;padding-block:.75rem;padding-inline:.75rem;pointer-events:none;visibility:hidden;z-index:1}:host .cds-custom-aichat-autocomplete-item__send-icon svg{fill:var(--cds-interactive,#0f62fe)}:host .cds-custom-aichat-autocomplete-item--active .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:focus-within .cds-custom-aichat-autocomplete-item__send-icon,:host .cds-custom-aichat-autocomplete-item:hover .cds-custom-aichat-autocomplete-item__send-icon{visibility:visible}:host .cds-custom-aichat-autocomplete-item:after{background:var(--cds-border-subtle-00,#e0e0e0);block-size:1px;content:\"\";display:block;inset-block-end:0;inset-inline:1rem;position:absolute}:host .cds-custom-aichat-autocomplete-item:focus:after,:host .cds-custom-aichat-autocomplete-item:hover:after{display:none}:host .cds-custom-aichat-autocomplete-item[first-item]{border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]{border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0)}:host .cds-custom-aichat-autocomplete-item[last-item]:after{display:none}:host([attached]){--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}"]);
11
11
 
12
12
  export { styles as default };
13
13
  //# sourceMappingURL=autocomplete.scss.js.map
@@ -168,7 +168,7 @@ let AutocompleteControllerElement = class AutocompleteControllerElement extends
168
168
  }
169
169
  render() {
170
170
  const { trigger, items, renderCustomList, disableDirectSend } = this._state;
171
- if (!trigger || items.length === 0) {
171
+ if (!trigger) {
172
172
  // List is gone — reset navigation state so the send button is unblocked.
173
173
  // This covers cases where the list is removed without an autocomplete
174
174
  // dismiss/select/send event (e.g. the user deletes the trigger character).
@@ -180,7 +180,19 @@ let AutocompleteControllerElement = class AutocompleteControllerElement extends
180
180
  }
181
181
  return nothing;
182
182
  }
183
+ if (items.length === 0 && this._listNavigated) {
184
+ this._listNavigated = false;
185
+ this.dispatchEvent(new CustomEvent('cds-custom-aichat-list-navigated', { detail: { navigated: false }, bubbles: true, composed: true }));
186
+ this.dispatchEvent(new CustomEvent('cds-custom-aichat-autocomplete-navigated', { detail: { navigated: false }, bubbles: true, composed: true }));
187
+ }
183
188
  if (renderCustomList) {
189
+ // When items are empty the built-in autocomplete element is kept mounted
190
+ // so it can announce the zero-results state. Consumer-supplied renderers
191
+ // are not mounted in that case: they own their own empty-state handling
192
+ // and were not rendered before this PR.
193
+ if (items.length === 0) {
194
+ return nothing;
195
+ }
184
196
  const result = renderCustomList({
185
197
  items,
186
198
  query: trigger.query,
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-controller-element.js","sources":["../../../../src/components/prompt-line/src/autocomplete-controller-element.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 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\nimport { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings.js';\n\nimport '../autocomplete/src/autocomplete.js';\nimport type { AutocompleteNavigatedEventDetail } from '../autocomplete/src/autocomplete.js';\nimport {\n AutocompleteController,\n itemsToGroups,\n type AutocompleteControllerState,\n} from './autocomplete-controller.js';\nimport type {\n AutocompleteConfig,\n StartersConfig,\n SuggestionItem,\n TriggerSuggestionConfig,\n} from './tiptap/types.js';\n\n/**\n * `<cds-custom-aichat-autocomplete-controller>` — drops the autocomplete overlay\n * lifecycle into a `<cds-custom-aichat-prompt-line-shell>`'s `autocomplete-content` slot.\n *\n * Listens for `cds-custom-aichat-trigger-change` events bubbling up from the\n * enclosing prompt-line-shell (the events are `composed: true, bubbles: true`, so\n * they reach here from inside the prompt-line's shadow root). Scoping the\n * listener to the shell — rather than `window` — keeps multiple\n * shell/controller pairs on the same page from cross-talking. Renders the\n * built-in `<cds-custom-aichat-autocomplete>` or the active config's\n * `renderCustomList` output. Selection routes back into the originating\n * prompt-line.\n *\n * @element cds-custom-aichat-autocomplete-controller\n * @fires cds-custom-aichat-starter-selected — `{ text: string }` after a starter is\n * inserted into the editor; consumer triggers send.\n * @fires cds-custom-aichat-autocomplete-item-selected — `{ item: SuggestionItem }`\n * after a suggestion item is selected. Fired in addition to type-specific callbacks.\n * @fires cds-custom-aichat-autocomplete-item-send — `{ text: string }` when the\n * per-item send button is clicked inside the suggestion list.\n * @fires cds-custom-aichat-list-navigated — `{ navigated: boolean }` when the user\n * starts or stops navigating the suggestion list with arrow keys. WC\n * consumers should use this to disable their send control while `navigated`\n * is `true` (the `listNavigated` getter reflects the same state).\n */\n@carbonElement(`${prefix}-autocomplete-controller`)\nclass AutocompleteControllerElement extends LitElement {\n /** `@`-style mention trigger config. */\n @property({ attribute: false })\n mention?: TriggerSuggestionConfig;\n\n /** `/`-style command trigger config. */\n @property({ attribute: false })\n command?: TriggerSuggestionConfig;\n\n /** Live-typeahead autocomplete config (no trigger character). */\n @property({ attribute: false })\n autocomplete?: AutocompleteConfig;\n\n /** Starter prompts shown when the editor is empty + focused + editable. */\n @property({ attribute: false })\n starters?: StartersConfig;\n\n /** When true, starter selection inserts text without firing the send event. */\n @property({ type: Boolean, attribute: 'is-send-disabled' })\n isSendDisabled = false;\n\n @state()\n private _state: AutocompleteControllerState = { trigger: null, items: [] };\n\n /**\n * Tracks whether the user is actively navigating inside the autocomplete\n * list. When `true`, the send button should be disabled so that Enter\n * confirms the highlighted item rather than submitting the prompt.\n */\n @state()\n private _listNavigated = false;\n\n /**\n * Returns `true` while the user is navigating inside the autocomplete list.\n * Consumers can use this to disable their send control.\n */\n get listNavigated(): boolean {\n return this._listNavigated;\n }\n\n private _controller: AutocompleteController | null = null;\n /**\n * Ancestor we subscribed `cds-custom-aichat-trigger-change` on. Scoping the\n * listener to the enclosing `<cds-custom-aichat-prompt-line-shell>` (rather than\n * `window`) keeps a second shell/controller pair on the same page from\n * receiving each other's events.\n */\n private _eventSource: EventTarget | null = null;\n\n // Render in light DOM so consumers' page-level CSS / portals can reach\n // any custom list element they've slotted in via renderCustomList.\n protected override createRenderRoot(): this {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('mousedown', this._handleMousedown);\n this.addEventListener(\n 'cds-custom-aichat-autocomplete-navigated',\n this._handleAutocompleteNavigated as EventListener\n );\n this._controller = new AutocompleteController({\n mention: this.mention,\n command: this.command,\n autocomplete: this.autocomplete,\n starters: this.starters,\n isSendDisabled: this.isSendDisabled,\n onStarterSelected: (text) => {\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-starter-selected', {\n detail: { text },\n bubbles: true,\n composed: true,\n })\n );\n },\n onChange: (next) => {\n this._state = next;\n },\n });\n // Scope to the enclosing prompt-line-shell so multiple shell/controller pairs\n // on the same page don't cross-talk. Falls back to `this` if the\n // controller is used outside a shell — in that case the consumer\n // should make sure their prompt-line bubbles events into this element.\n this._eventSource = this.closest('cds-custom-aichat-prompt-line-shell') ?? this;\n this._eventSource.addEventListener(\n 'cds-custom-aichat-trigger-change',\n this._handleTriggerChange as EventListener\n );\n }\n\n override disconnectedCallback(): void {\n this.removeEventListener('mousedown', this._handleMousedown);\n this.removeEventListener(\n 'cds-custom-aichat-autocomplete-navigated',\n this._handleAutocompleteNavigated as EventListener\n );\n this._eventSource?.removeEventListener(\n 'cds-custom-aichat-trigger-change',\n this._handleTriggerChange as EventListener\n );\n this._eventSource = null;\n this._controller?.destroy();\n this._controller = null;\n super.disconnectedCallback();\n }\n\n override updated(changed: Map<string, unknown>): void {\n if (!this._controller) {\n return;\n }\n if (\n changed.has('mention') ||\n changed.has('command') ||\n changed.has('autocomplete') ||\n changed.has('starters') ||\n changed.has('isSendDisabled')\n ) {\n this._controller.setConfigs({\n mention: this.mention,\n command: this.command,\n autocomplete: this.autocomplete,\n starters: this.starters,\n isSendDisabled: this.isSendDisabled,\n });\n }\n // Register the currently-rendered list element with the controller so\n // arrow / Enter / Escape on the editor get forwarded into it.\n const listEl =\n this.querySelector<HTMLElement>('cds-custom-aichat-autocomplete') ??\n (this.firstElementChild instanceof HTMLElement\n ? this.firstElementChild\n : null);\n this._controller.setListElement(listEl);\n\n // Pass the editor DOM as anchorElement so the autocomplete's outside-click\n // guard treats clicks on the editor as inside-clicks (not dismissals).\n const editorDom = this._controller.getPromptLine()?.getEditor()?.view\n .dom as Element | undefined;\n const autocompleteEl = this.querySelector<\n HTMLElement & { anchorElement?: Element | null }\n >('cds-custom-aichat-autocomplete');\n if (autocompleteEl) {\n autocompleteEl.anchorElement = editorDom ?? null;\n }\n }\n\n override render() {\n const { trigger, items, renderCustomList, disableDirectSend } = this._state;\n if (!trigger || items.length === 0) {\n // List is gone — reset navigation state so the send button is unblocked.\n // This covers cases where the list is removed without an autocomplete\n // dismiss/select/send event (e.g. the user deletes the trigger character).\n if (this._listNavigated) {\n this._listNavigated = false;\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-list-navigated',\n { detail: { navigated: false }, bubbles: true, composed: true }\n )\n );\n // Also fire the lower-level event so send-control's shell listener fires.\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-autocomplete-navigated',\n { detail: { navigated: false }, bubbles: true, composed: true }\n )\n );\n }\n return nothing;\n }\n if (renderCustomList) {\n const result = renderCustomList({\n items,\n query: trigger.query,\n onDismiss: () => this._controller?.dismiss(),\n onSelect: (item) => this._selectItem(item),\n onSend: (text) => this._sendItem(text),\n });\n if (result instanceof HTMLElement) {\n return html`${result}`;\n }\n // Custom renderer returned something other than an HTMLElement (e.g.\n // a React node). Surface it on a side-channel event so React adapters\n // can portal it into place themselves.\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-custom-list-render', {\n detail: { reactNode: result },\n bubbles: true,\n composed: true,\n })\n );\n return nothing;\n }\n const { items: flatItems, groups } = itemsToGroups(items);\n return html`\n <cds-custom-aichat-autocomplete\n .items=${flatItems}\n .groups=${groups}\n .disableDirectSend=${disableDirectSend}\n @cds-custom-aichat-autocomplete-select=${(\n e: CustomEvent<{ item: SuggestionItem }>\n ) => this._selectItem(e.detail.item)}\n @cds-custom-aichat-autocomplete-send=${(e: CustomEvent<{ text: string }>) =>\n this._sendItem(e.detail.text)}\n @cds-custom-aichat-autocomplete-dismiss=${() => this._controller?.dismiss()}></cds-custom-aichat-autocomplete>\n `;\n }\n\n private _selectItem(item: SuggestionItem): void {\n this._controller?.select(item);\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-autocomplete-item-selected', {\n detail: { item },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private _sendItem(text: string): void {\n if (this.isSendDisabled) {\n return;\n }\n this._controller?.dismiss(true);\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-autocomplete-item-send', {\n detail: { text },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private _handleMousedown = (event: MouseEvent): void => {\n // Prevent the autocomplete list from stealing focus from the editor.\n event.preventDefault();\n };\n\n private _handleAutocompleteNavigated = (event: Event): void => {\n const { navigated } = (\n event as CustomEvent<AutocompleteNavigatedEventDetail>\n ).detail;\n if (this._listNavigated === navigated) {\n return;\n }\n this._listNavigated = navigated;\n // Re-fire a composed event so parent elements (e.g. a WC integration shell)\n // can disable their send control while the user navigates the list.\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-list-navigated',\n { detail: { navigated }, bubbles: true, composed: true }\n )\n );\n };\n\n private _handleTriggerChange = (event: Event): void => {\n this._controller?.handleTriggerChangeEvent(\n event as CustomEvent<\n Parameters<AutocompleteController['handleTriggerChange']>[0]\n >\n );\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-custom-aichat-autocomplete-controller': AutocompleteControllerElement;\n }\n}\n\nexport default AutocompleteControllerElement;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAsBH;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AAEH,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,UAAU,CAAA;AAAtD,IAAA,WAAA,GAAA;;;QAmBE,IAAA,CAAA,cAAc,GAAG,KAAK;QAGd,IAAA,CAAA,MAAM,GAAgC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;AAE1E;;;;AAIG;QAEK,IAAA,CAAA,cAAc,GAAG,KAAK;QAUtB,IAAA,CAAA,WAAW,GAAkC,IAAI;AACzD;;;;;AAKG;QACK,IAAA,CAAA,YAAY,G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AA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AACJ,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAI1B,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE;AACnC,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAGf,UAAA,CAAA;AADP,IAAA,KAAK;AACqE,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAQnE,UAAA,CAAA;AADP,IAAA,KAAK;AACyB,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AA9B3B,6BAA6B,GAAA,UAAA,CAAA;AADlC,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,wBAAA,CAA0B;AAC5C,CAAA,EAAA,6BAA6B,CAyQlC;AAQD,4CAAe,6BAA6B;;"}
1
+ {"version":3,"file":"autocomplete-controller-element.js","sources":["../../../../src/components/prompt-line/src/autocomplete-controller-element.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 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\nimport { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings.js';\n\nimport '../autocomplete/src/autocomplete.js';\nimport type { AutocompleteNavigatedEventDetail } from '../autocomplete/src/autocomplete.js';\nimport {\n AutocompleteController,\n itemsToGroups,\n type AutocompleteControllerState,\n} from './autocomplete-controller.js';\nimport type {\n AutocompleteConfig,\n StartersConfig,\n SuggestionItem,\n TriggerSuggestionConfig,\n} from './tiptap/types.js';\n\n/**\n * `<cds-custom-aichat-autocomplete-controller>` — drops the autocomplete overlay\n * lifecycle into a `<cds-custom-aichat-prompt-line-shell>`'s `autocomplete-content` slot.\n *\n * Listens for `cds-custom-aichat-trigger-change` events bubbling up from the\n * enclosing prompt-line-shell (the events are `composed: true, bubbles: true`, so\n * they reach here from inside the prompt-line's shadow root). Scoping the\n * listener to the shell — rather than `window` — keeps multiple\n * shell/controller pairs on the same page from cross-talking. Renders the\n * built-in `<cds-custom-aichat-autocomplete>` or the active config's\n * `renderCustomList` output. Selection routes back into the originating\n * prompt-line.\n *\n * @element cds-custom-aichat-autocomplete-controller\n * @fires cds-custom-aichat-starter-selected — `{ text: string }` after a starter is\n * inserted into the editor; consumer triggers send.\n * @fires cds-custom-aichat-autocomplete-item-selected — `{ item: SuggestionItem }`\n * after a suggestion item is selected. Fired in addition to type-specific callbacks.\n * @fires cds-custom-aichat-autocomplete-item-send — `{ text: string }` when the\n * per-item send button is clicked inside the suggestion list.\n * @fires cds-custom-aichat-list-navigated — `{ navigated: boolean }` when the user\n * starts or stops navigating the suggestion list with arrow keys. WC\n * consumers should use this to disable their send control while `navigated`\n * is `true` (the `listNavigated` getter reflects the same state).\n */\n@carbonElement(`${prefix}-autocomplete-controller`)\nclass AutocompleteControllerElement extends LitElement {\n /** `@`-style mention trigger config. */\n @property({ attribute: false })\n mention?: TriggerSuggestionConfig;\n\n /** `/`-style command trigger config. */\n @property({ attribute: false })\n command?: TriggerSuggestionConfig;\n\n /** Live-typeahead autocomplete config (no trigger character). */\n @property({ attribute: false })\n autocomplete?: AutocompleteConfig;\n\n /** Starter prompts shown when the editor is empty + focused + editable. */\n @property({ attribute: false })\n starters?: StartersConfig;\n\n /** When true, starter selection inserts text without firing the send event. */\n @property({ type: Boolean, attribute: 'is-send-disabled' })\n isSendDisabled = false;\n\n @state()\n private _state: AutocompleteControllerState = { trigger: null, items: [] };\n\n /**\n * Tracks whether the user is actively navigating inside the autocomplete\n * list. When `true`, the send button should be disabled so that Enter\n * confirms the highlighted item rather than submitting the prompt.\n */\n @state()\n private _listNavigated = false;\n\n /**\n * Returns `true` while the user is navigating inside the autocomplete list.\n * Consumers can use this to disable their send control.\n */\n get listNavigated(): boolean {\n return this._listNavigated;\n }\n\n private _controller: AutocompleteController | null = null;\n /**\n * Ancestor we subscribed `cds-custom-aichat-trigger-change` on. Scoping the\n * listener to the enclosing `<cds-custom-aichat-prompt-line-shell>` (rather than\n * `window`) keeps a second shell/controller pair on the same page from\n * receiving each other's events.\n */\n private _eventSource: EventTarget | null = null;\n\n // Render in light DOM so consumers' page-level CSS / portals can reach\n // any custom list element they've slotted in via renderCustomList.\n protected override createRenderRoot(): this {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('mousedown', this._handleMousedown);\n this.addEventListener(\n 'cds-custom-aichat-autocomplete-navigated',\n this._handleAutocompleteNavigated as EventListener\n );\n this._controller = new AutocompleteController({\n mention: this.mention,\n command: this.command,\n autocomplete: this.autocomplete,\n starters: this.starters,\n isSendDisabled: this.isSendDisabled,\n onStarterSelected: (text) => {\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-starter-selected', {\n detail: { text },\n bubbles: true,\n composed: true,\n })\n );\n },\n onChange: (next) => {\n this._state = next;\n },\n });\n // Scope to the enclosing prompt-line-shell so multiple shell/controller pairs\n // on the same page don't cross-talk. Falls back to `this` if the\n // controller is used outside a shell — in that case the consumer\n // should make sure their prompt-line bubbles events into this element.\n this._eventSource = this.closest('cds-custom-aichat-prompt-line-shell') ?? this;\n this._eventSource.addEventListener(\n 'cds-custom-aichat-trigger-change',\n this._handleTriggerChange as EventListener\n );\n }\n\n override disconnectedCallback(): void {\n this.removeEventListener('mousedown', this._handleMousedown);\n this.removeEventListener(\n 'cds-custom-aichat-autocomplete-navigated',\n this._handleAutocompleteNavigated as EventListener\n );\n this._eventSource?.removeEventListener(\n 'cds-custom-aichat-trigger-change',\n this._handleTriggerChange as EventListener\n );\n this._eventSource = null;\n this._controller?.destroy();\n this._controller = null;\n super.disconnectedCallback();\n }\n\n override updated(changed: Map<string, unknown>): void {\n if (!this._controller) {\n return;\n }\n if (\n changed.has('mention') ||\n changed.has('command') ||\n changed.has('autocomplete') ||\n changed.has('starters') ||\n changed.has('isSendDisabled')\n ) {\n this._controller.setConfigs({\n mention: this.mention,\n command: this.command,\n autocomplete: this.autocomplete,\n starters: this.starters,\n isSendDisabled: this.isSendDisabled,\n });\n }\n // Register the currently-rendered list element with the controller so\n // arrow / Enter / Escape on the editor get forwarded into it.\n const listEl =\n this.querySelector<HTMLElement>('cds-custom-aichat-autocomplete') ??\n (this.firstElementChild instanceof HTMLElement\n ? this.firstElementChild\n : null);\n this._controller.setListElement(listEl);\n\n // Pass the editor DOM as anchorElement so the autocomplete's outside-click\n // guard treats clicks on the editor as inside-clicks (not dismissals).\n const editorDom = this._controller.getPromptLine()?.getEditor()?.view\n .dom as Element | undefined;\n const autocompleteEl = this.querySelector<\n HTMLElement & { anchorElement?: Element | null }\n >('cds-custom-aichat-autocomplete');\n if (autocompleteEl) {\n autocompleteEl.anchorElement = editorDom ?? null;\n }\n }\n\n override render() {\n const { trigger, items, renderCustomList, disableDirectSend } = this._state;\n if (!trigger) {\n // List is gone — reset navigation state so the send button is unblocked.\n // This covers cases where the list is removed without an autocomplete\n // dismiss/select/send event (e.g. the user deletes the trigger character).\n if (this._listNavigated) {\n this._listNavigated = false;\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-list-navigated',\n { detail: { navigated: false }, bubbles: true, composed: true }\n )\n );\n // Also fire the lower-level event so send-control's shell listener fires.\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-autocomplete-navigated',\n { detail: { navigated: false }, bubbles: true, composed: true }\n )\n );\n }\n return nothing;\n }\n if (items.length === 0 && this._listNavigated) {\n this._listNavigated = false;\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-list-navigated',\n { detail: { navigated: false }, bubbles: true, composed: true }\n )\n );\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-autocomplete-navigated',\n { detail: { navigated: false }, bubbles: true, composed: true }\n )\n );\n }\n if (renderCustomList) {\n // When items are empty the built-in autocomplete element is kept mounted\n // so it can announce the zero-results state. Consumer-supplied renderers\n // are not mounted in that case: they own their own empty-state handling\n // and were not rendered before this PR.\n if (items.length === 0) {\n return nothing;\n }\n const result = renderCustomList({\n items,\n query: trigger.query,\n onDismiss: () => this._controller?.dismiss(),\n onSelect: (item) => this._selectItem(item),\n onSend: (text) => this._sendItem(text),\n });\n if (result instanceof HTMLElement) {\n return html`${result}`;\n }\n // Custom renderer returned something other than an HTMLElement (e.g.\n // a React node). Surface it on a side-channel event so React adapters\n // can portal it into place themselves.\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-custom-list-render', {\n detail: { reactNode: result },\n bubbles: true,\n composed: true,\n })\n );\n return nothing;\n }\n const { items: flatItems, groups } = itemsToGroups(items);\n return html`\n <cds-custom-aichat-autocomplete\n .items=${flatItems}\n .groups=${groups}\n .disableDirectSend=${disableDirectSend}\n @cds-custom-aichat-autocomplete-select=${(\n e: CustomEvent<{ item: SuggestionItem }>\n ) => this._selectItem(e.detail.item)}\n @cds-custom-aichat-autocomplete-send=${(e: CustomEvent<{ text: string }>) =>\n this._sendItem(e.detail.text)}\n @cds-custom-aichat-autocomplete-dismiss=${() => this._controller?.dismiss()}></cds-custom-aichat-autocomplete>\n `;\n }\n\n private _selectItem(item: SuggestionItem): void {\n this._controller?.select(item);\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-autocomplete-item-selected', {\n detail: { item },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private _sendItem(text: string): void {\n if (this.isSendDisabled) {\n return;\n }\n this._controller?.dismiss(true);\n this.dispatchEvent(\n new CustomEvent('cds-custom-aichat-autocomplete-item-send', {\n detail: { text },\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private _handleMousedown = (event: MouseEvent): void => {\n // Prevent the autocomplete list from stealing focus from the editor.\n event.preventDefault();\n };\n\n private _handleAutocompleteNavigated = (event: Event): void => {\n const { navigated } = (\n event as CustomEvent<AutocompleteNavigatedEventDetail>\n ).detail;\n if (this._listNavigated === navigated) {\n return;\n }\n this._listNavigated = navigated;\n // Re-fire a composed event so parent elements (e.g. a WC integration shell)\n // can disable their send control while the user navigates the list.\n this.dispatchEvent(\n new CustomEvent<AutocompleteNavigatedEventDetail>(\n 'cds-custom-aichat-list-navigated',\n { detail: { navigated }, bubbles: true, composed: true }\n )\n );\n };\n\n private _handleTriggerChange = (event: Event): void => {\n this._controller?.handleTriggerChangeEvent(\n event as CustomEvent<\n Parameters<AutocompleteController['handleTriggerChange']>[0]\n >\n );\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-custom-aichat-autocomplete-controller': AutocompleteControllerElement;\n }\n}\n\nexport default AutocompleteControllerElement;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAsBH;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AAEH,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,UAAU,CAAA;AAAtD,IAAA,WAAA,GAAA;;;QAmBE,IAAA,CAAA,cAAc,GAAG,KAAK;QAGd,IAAA,CAAA,MAAM,GAAgC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;AAE1E;;;;AAIG;QAEK,IAAA,CAAA,cAAc,GAAG,KAAK;QAUtB,IAAA,CAAA,WAAW,GAAkC,IAAI;AACzD;;;;;AAKG;QACK,IAAA,CAAA,YAAY,GAAuB,IAAI;AAkNvC,QAAA,IAAA,CAAA,gBAAgB,GAAG,CAAC,KAAiB,KAAU;;YAErD,KAAK,CAAC,cAAc,EAAE;AACxB,QAAA,CAAC;AAEO,QAAA,IAAA,CAAA,4BAA4B,GAAG,CAAC,KAAY,KAAU;AAC5D,YAAA,MAAM,EAAE,SA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,SAAA,EAAA,MAAA,CAAA;AAIlC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AACI,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAIlC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AACI,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAIlC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AACJ,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAI1B,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE;AACnC,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAGf,UAAA,CAAA;AADP,IAAA,KAAK;AACqE,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAQnE,UAAA,CAAA;AADP,IAAA,KAAK;AACyB,CAAA,EAAA,6BAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AA9B3B,6BAA6B,GAAA,UAAA,CAAA;AADlC,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,wBAAA,CAA0B;AAC5C,CAAA,EAAA,6BAA6B,CA+RlC;AAQD,4CAAe,6BAA6B;;"}
@@ -312,7 +312,6 @@ class AutocompleteController {
312
312
  { type: 'text', text: ' ' },
313
313
  ])
314
314
  .run();
315
- config?.onSelect?.(item);
316
315
  }
317
316
  else if (trigger.type === 'autocomplete') {
318
317
  const text = item.value ?? item.label;
@@ -355,7 +354,10 @@ class AutocompleteController {
355
354
  this._detachEditorKeyHandler();
356
355
  return;
357
356
  }
358
- const editorDom = this._trigger && this._listElement
357
+ // Do not bind key forwarding when items are empty: there is nothing to
358
+ // navigate, and keeping the handler bound would trap Tab, Home, End,
359
+ // arrows, and Escape while the list is mounted but shows no matches.
360
+ const editorDom = this._trigger && this._listElement && this._items.length > 0
359
361
  ? (this._promptLine?.getEditor()?.view.dom ?? null)
360
362
  : null;
361
363
  if (editorDom === this._editorDomBound) {
@@ -435,6 +437,11 @@ class AutocompleteController {
435
437
  return this._configForTrigger(trigger.type)?.disableDirectSend;
436
438
  }
437
439
  _emit() {
440
+ // Re-evaluate key-forwarding on every items change: the empty-items guard
441
+ // in _refreshEditorKeyHandler must detach the handler when items go to
442
+ // zero (the list element stays mounted for the announcement, so
443
+ // setListElement won't re-trigger the refresh).
444
+ this._refreshEditorKeyHandler();
438
445
  this._onChange({
439
446
  trigger: this._trigger,
440
447
  items: this._items,