@carbon/ai-chat 1.4.3 → 1.5.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 (30) hide show
  1. package/dist/es/aiChatEntry.js +41 -23
  2. package/dist/es/aiChatEntry.js.map +1 -1
  3. package/dist/es/chat.ChatAppEntry.js +4589 -3950
  4. package/dist/es/chat.ChatAppEntry.js.map +1 -1
  5. package/dist/es/{chat.languages.js → chat.languageUtils.js} +15 -24
  6. package/dist/es/chat.languageUtils.js.map +1 -0
  7. package/dist/es/serverEntry.js +3 -5
  8. package/dist/es/serverEntry.js.map +1 -1
  9. package/dist/es/web-components/cds-aichat-container/index.js +41 -20
  10. package/dist/es/web-components/cds-aichat-container/index.js.map +1 -1
  11. package/dist/es/web-components/cds-aichat-custom-element/index.js +38 -17
  12. package/dist/es/web-components/cds-aichat-custom-element/index.js.map +1 -1
  13. package/dist/es-custom/aiChatEntry.js +41 -23
  14. package/dist/es-custom/aiChatEntry.js.map +1 -1
  15. package/dist/es-custom/chat.ChatAppEntry.js +4589 -3950
  16. package/dist/es-custom/chat.ChatAppEntry.js.map +1 -1
  17. package/dist/es-custom/{chat.languages.js → chat.languageUtils.js} +15 -24
  18. package/dist/es-custom/chat.languageUtils.js.map +1 -0
  19. package/dist/es-custom/serverEntry.js +3 -5
  20. package/dist/es-custom/serverEntry.js.map +1 -1
  21. package/dist/es-custom/web-components/cds-aichat-container/index.js +41 -20
  22. package/dist/es-custom/web-components/cds-aichat-container/index.js.map +1 -1
  23. package/dist/es-custom/web-components/cds-aichat-custom-element/index.js +38 -17
  24. package/dist/es-custom/web-components/cds-aichat-custom-element/index.js.map +1 -1
  25. package/dist/types/aiChatEntry.d.ts +3 -3
  26. package/dist/types/{serverEntry-BBTNDChc.d.ts → serverEntry-CwwZQCSX.d.ts} +241 -13
  27. package/dist/types/serverEntry.d.ts +2 -2
  28. package/package.json +7 -7
  29. package/dist/es/chat.languages.js.map +0 -1
  30. package/dist/es-custom/chat.languages.js.map +0 -1
@@ -1,14 +1,13 @@
1
- import "@carbon/ai-chat-components/es/components/chain-of-thought/src/types.js";
1
+ import "@carbon/ai-chat-components/es/components/chain-of-thought/defs.js";
2
2
 
3
3
  import dayjs from "dayjs";
4
4
 
5
5
  import enLocaleData from "dayjs/locale/en.js";
6
6
 
7
- import React from "react";
8
-
9
7
  var PageObjectId;
10
8
 
11
9
  (function(PageObjectId) {
10
+ PageObjectId["CHAT_WIDGET"] = "chat_widget";
12
11
  PageObjectId["CLOSE_CHAT"] = "close_chat";
13
12
  PageObjectId["LAUNCHER"] = "launcher_open_chat";
14
13
  PageObjectId["INPUT"] = "input_field";
@@ -38,6 +37,7 @@ var PanelType;
38
37
 
39
38
  (function(PanelType) {
40
39
  PanelType["DEFAULT"] = "default";
40
+ PanelType["WORKSPACE"] = "workspace";
41
41
  })(PanelType || (PanelType = {}));
42
42
 
43
43
  var WriteableElementName;
@@ -51,6 +51,7 @@ var WriteableElementName;
51
51
  WriteableElementName["HOME_SCREEN_AFTER_STARTERS_ELEMENT"] = "homeScreenAfterStartersElement";
52
52
  WriteableElementName["HOME_SCREEN_HEADER_BOTTOM_ELEMENT"] = "homeScreenHeaderBottomElement";
53
53
  WriteableElementName["CUSTOM_PANEL_ELEMENT"] = "customPanelElement";
54
+ WriteableElementName["WORKSPACE_PANEL_ELEMENT"] = "workspacePanelElement";
54
55
  })(WriteableElementName || (WriteableElementName = {}));
55
56
 
56
57
  var CornersType;
@@ -81,6 +82,10 @@ var BusEventType;
81
82
  BusEventType["CUSTOM_PANEL_OPEN"] = "customPanel:open";
82
83
  BusEventType["CUSTOM_PANEL_PRE_CLOSE"] = "customPanel:pre:close";
83
84
  BusEventType["CUSTOM_PANEL_CLOSE"] = "customPanel:close";
85
+ BusEventType["WORKSPACE_PRE_OPEN"] = "workspace:pre:open";
86
+ BusEventType["WORKSPACE_OPEN"] = "workspace:open";
87
+ BusEventType["WORKSPACE_PRE_CLOSE"] = "workspace:pre:close";
88
+ BusEventType["WORKSPACE_CLOSE"] = "workspace:close";
84
89
  BusEventType["HUMAN_AGENT_PRE_RECEIVE"] = "human_agent:pre:receive";
85
90
  BusEventType["HUMAN_AGENT_RECEIVE"] = "human_agent:receive";
86
91
  BusEventType["HUMAN_AGENT_PRE_SEND"] = "human_agent:pre:send";
@@ -112,7 +117,6 @@ var MessageSendSource;
112
117
  MessageSendSource["HOME_SCREEN_INPUT"] = "homeScreenInput";
113
118
  MessageSendSource["OPTION_BUTTON"] = "optionButton";
114
119
  MessageSendSource["OPTION_DROP_DOWN"] = "optionDropDown";
115
- MessageSendSource["HYDRATE_RESEND"] = "hydrateResend";
116
120
  MessageSendSource["HISTORY_UPDATE"] = "historyUpdate";
117
121
  MessageSendSource["INSTANCE_SEND"] = "instanceSend";
118
122
  MessageSendSource["DATE_PICKER"] = "datePicker";
@@ -198,7 +202,7 @@ var input_ariaLabel = "Message to send";
198
202
 
199
203
  var input_placeholder = "Type something...";
200
204
 
201
- var input_buttonLabel = "Click to send message";
205
+ var input_buttonLabel = "Send message";
202
206
 
203
207
  var input_uploadButtonLabel = "Add files to upload";
204
208
 
@@ -250,7 +254,7 @@ var messages_assistantIsLoading = "{assistantName} is thinking";
250
254
 
251
255
  var messages_agentIsTyping = "The live agent is typing";
252
256
 
253
- var messages_focusHandle = "Message";
257
+ var messages_focusHandle = "Select message";
254
258
 
255
259
  var messages_scrollHandle = "Chat history begin";
256
260
 
@@ -852,6 +856,7 @@ var MessageResponseTypes;
852
856
  MessageResponseTypes["BUTTON"] = "button";
853
857
  MessageResponseTypes["GRID"] = "grid";
854
858
  MessageResponseTypes["CONVERSATIONAL_SEARCH"] = "conversational_search";
859
+ MessageResponseTypes["PREVIEW_CARD"] = "preview_card";
855
860
  })(MessageResponseTypes || (MessageResponseTypes = {}));
856
861
 
857
862
  var HumanAgentMessageType;
@@ -955,14 +960,14 @@ const RESPONSE_TYPE_TIMEOUT_MS = 2e4;
955
960
 
956
961
  const DEFAULT_CUSTOM_PANEL_ID = "wac-default-panel";
957
962
 
963
+ const WORKSPACE_CUSTOM_PANEL_ID = "workspace-panel";
964
+
958
965
  function THROW_ERROR() {
959
966
  throw Error("Not implemented.");
960
967
  }
961
968
 
962
969
  const AUTO_SCROLL_EXTRA = 28 - 8;
963
970
 
964
- const ONE_LINE_MESSAGE_HEIGHT = 88;
965
-
966
971
  const AUTO_SCROLL_THROTTLE_TIMEOUT = 100;
967
972
 
968
973
  async function sleep(milliseconds) {
@@ -1142,20 +1147,6 @@ async function loadLocale(requestedLocale) {
1142
1147
  return enLocaleData;
1143
1148
  }
1144
1149
 
1145
- function handleBTag(chunks) {
1146
- return React.createElement("b", null, chunks);
1147
- }
1148
-
1149
- function handleBRTag() {
1150
- return React.createElement("br", null);
1151
- }
1152
-
1153
- function addHTMLSupport(values) {
1154
- values.b = handleBTag;
1155
- values.br = handleBRTag;
1156
- return values;
1157
- }
1158
-
1159
1150
  async function loadDayjsLocale(locale) {
1160
1151
  if (!dayjs.Ls[locale]) {
1161
1152
  const previousLocale = dayjs.locale();
@@ -1172,5 +1163,5 @@ async function loadDayjsLocale(locale) {
1172
1163
  return locale;
1173
1164
  }
1174
1165
 
1175
- export { ENGLISH_US_DATE_FORMAT as $, WA_CONSOLE_PREFIX as A, BusEventType as B, CornersType as C, DEFAULT_CUSTOM_PANEL_ID as D, ErrorType as E, FeedbackInteractionType as F, setEnableDebugLog as G, HumanAgentsOnlineStatus as H, IFrameItemDisplayOption as I, consoleDebug as J, resolveOrTimeout as K, loadLocale as L, MessageSendSource as M, MainWindowOpenReason as N, OnErrorType as O, PageObjectId as P, addHTMLSupport as Q, ReasoningStepOpenState as R, ScreenShareState as S, getResponsiveElementPaddingValue as T, UserType as U, ViewType as V, WriteableElementName as W, RESPONSE_TYPE_TIMEOUT_MS as X, THROW_ERROR as Y, RIGHT_TO_LEFT_MARK as Z, loadDayjsLocale as _, PanelType as a, createDidCatchErrorData as a0, AUTO_SCROLL_EXTRA as a1, ONE_LINE_MESSAGE_HEIGHT as a2, AUTO_SCROLL_THROTTLE_TIMEOUT as a3, isValidForUpload as a4, MainWindowCloseReason as a5, ViewChangeReason as b, CancellationReason as c, CarbonTheme as d, enLanguagePack as e, MinimizeButtonIconType as f, FileStatusValue as g, ButtonItemKind as h, ButtonItemType as i, MessageInputType as j, MessageResponseTypes as k, OptionItemPreference as l, WidthOptions as m, HumanAgentMessageType as n, MessageErrorState as o, normalizeModuleInterop as p, localeLoaders as q, InternalMessageRequestType as r, consoleError as s, debugLog as t, sleep as u, callOnError as v, consoleWarn as w, consoleLog as x, isEnableDebugLog as y, safeFetchTextWithTimeout as z };
1176
- //# sourceMappingURL=chat.languages.js.map
1166
+ export { ENGLISH_US_DATE_FORMAT as $, safeFetchTextWithTimeout as A, BusEventType as B, CornersType as C, DEFAULT_CUSTOM_PANEL_ID as D, ErrorType as E, FeedbackInteractionType as F, WA_CONSOLE_PREFIX as G, HumanAgentsOnlineStatus as H, IFrameItemDisplayOption as I, setEnableDebugLog as J, consoleDebug as K, resolveOrTimeout as L, MessageSendSource as M, loadLocale as N, OnErrorType as O, PageObjectId as P, MainWindowOpenReason as Q, ReasoningStepOpenState as R, ScreenShareState as S, getResponsiveElementPaddingValue as T, UserType as U, ViewType as V, WriteableElementName as W, RESPONSE_TYPE_TIMEOUT_MS as X, THROW_ERROR as Y, RIGHT_TO_LEFT_MARK as Z, loadDayjsLocale as _, PanelType as a, createDidCatchErrorData as a0, AUTO_SCROLL_THROTTLE_TIMEOUT as a1, AUTO_SCROLL_EXTRA as a2, isValidForUpload as a3, MainWindowCloseReason as a4, ViewChangeReason as b, CancellationReason as c, CarbonTheme as d, enLanguagePack as e, MinimizeButtonIconType as f, FileStatusValue as g, ButtonItemKind as h, ButtonItemType as i, MessageInputType as j, MessageResponseTypes as k, OptionItemPreference as l, WidthOptions as m, HumanAgentMessageType as n, MessageErrorState as o, normalizeModuleInterop as p, localeLoaders as q, InternalMessageRequestType as r, consoleError as s, WORKSPACE_CUSTOM_PANEL_ID as t, debugLog as u, sleep as v, callOnError as w, consoleWarn as x, consoleLog as y, isEnableDebugLog as z };
1167
+ //# sourceMappingURL=chat.languageUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.languageUtils.js","sources":["../../../../src/testing/PageObjectId.ts","../../../../src/types/instance/apiTypes.ts","../../../../src/types/instance/ChatInstance.ts","../../../../src/types/config/CornersType.ts","../../../../src/types/events/eventBusTypes.ts","../../../../src/types/config/MessagingConfig.ts","../../../../src/types/config/PublicConfig.ts","../../../../src/types/config/ServiceDeskConfig.ts","../../../../src/types/messaging/Messages.ts","../../../../src/types/messaging/LocalMessageItem.ts","../../../../src/chat/utils/constants.ts","../../../../src/chat/utils/lang/promiseUtils.ts","../../../../src/chat/utils/miscUtils.ts","../../../../src/chat/utils/moduleInterop.ts","../../../../src/chat/utils/languageUtils.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * An enum of all of our data-testid we use. For some elements (like INPUT) they can appear in multiple \"panels\"\n * (e.g. on the home screen and in the main chat window). There are provided testids for \"panels\" as well so you\n * can first select a panel and then select the correct child.\n *\n * @category Testing\n *\n * @experimental\n */\nexport enum PageObjectId {\n /**\n * The root chat widget container (for scoping tests/accessibility checks).\n */\n CHAT_WIDGET = \"chat_widget\",\n\n /**\n * Minimize chat button in header.\n */\n CLOSE_CHAT = \"close_chat\",\n\n /**\n * The launcher button to open the chat. This id is maintained across desktop and mobile launchers.\n */\n LAUNCHER = \"launcher_open_chat\",\n\n /**\n * Input field.\n */\n INPUT = \"input_field\",\n\n /**\n * Input send button.\n */\n INPUT_SEND = \"input_send\",\n\n /**\n * The chat header title element.\n */\n HEADER_TITLE = \"header_title\",\n\n /**\n * The chat header name element.\n */\n HEADER_NAME = \"header_name\",\n\n // Panel identifiers\n /**\n * The main chat panel.\n */\n MAIN_PANEL = \"main_panel\",\n\n /**\n * Disclaimer panel.\n */\n DISCLAIMER_PANEL = \"disclaimer_panel\",\n\n /**\n * Disclaimer accept button.\n */\n DISCLAIMER_ACCEPT_BUTTON = \"disclaimer_accept_button\",\n\n /**\n * Homescreen Panel.\n */\n HOME_SCREEN_PANEL = \"home_screen_panel\",\n\n /**\n * Hydration/loading state panel.\n */\n HYDRATING_PANEL = \"hydrating_panel\",\n\n /**\n * Catastrophic error panel.\n */\n CATASTROPHIC_PANEL = \"catastrophic_panel\",\n\n /**\n * Iframe panel.\n */\n IFRAME_PANEL = \"iframe_panel\",\n\n /**\n * Conversational search panel.\n */\n CONVERSATIONAL_SEARCH_CITATION_PANEL = \"conversational_search_citation_panel\",\n\n /**\n * Custom panel.\n */\n CUSTOM_PANEL = \"custom_panel\",\n\n /**\n * A panel that opens from a button response.\n */\n BUTTON_RESPONSE_PANEL = \"button_response_panel\",\n}\n\n/**\n * Ids used for data-testid.\n *\n * @category Testing\n *\n * @experimental\n */\nexport type TestId = PageObjectId;\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Whether a particular Carbon AI Chat view is visible or not.\n *\n * @category Instance\n */\nexport interface ViewState {\n /**\n * Whether the launcher is visible or not.\n */\n launcher: boolean;\n\n /**\n * Whether the main window is visible or not.\n */\n mainWindow: boolean;\n}\n\n/**\n * The different views that can be shown by Carbon AI Chat.\n *\n * @category Instance\n */\nexport enum ViewType {\n /**\n * The launcher view is used to open the main window.\n */\n LAUNCHER = \"launcher\",\n\n /**\n * The main window view is used to ask WA questions and converse with an agent, as well as many other things. The\n * string value is kept camel case to align with the viewState mainWindow property.\n */\n MAIN_WINDOW = \"mainWindow\",\n}\n\n/**\n * Describes the different panel types that Carbon AI Chat supports.\n *\n * @category Instance\n */\nexport enum PanelType {\n /**\n * Opens the panel so that it overlays the main chat content.\n */\n DEFAULT = \"default\",\n\n /**\n * Opens the panel in the Workspace layout.\n *\n * On large screens, the panel is placed at the `preferredLocation` (`start` or `end`)\n * and pushes the chat content.\n *\n * On small screens, the panel behaves like `DEFAULT`.\n *\n * @experimental\n */\n WORKSPACE = \"workspace\",\n}\n\nexport type PanelConfigOptionsByType = {\n [PanelType.DEFAULT]: DefaultCustomPanelConfigOptions;\n [PanelType.WORKSPACE]: WorkspaceCustomPanelConfigOptions;\n};\n\n/**\n * This manager handles fetching an instance for manipulating the custom panel.\n *\n * @category Instance\n */\nexport interface CustomPanels {\n /**\n * Gets a custom panel instance.\n */\n getPanel: (panel?: PanelType) => CustomPanelInstance;\n}\n\n/**\n * The custom panel instance for controlling and manipulating a custom panel in Carbon AI Chat.\n *\n * @category Instance\n */\nexport interface CustomPanelInstance {\n /**\n * The custom panel hostElement.\n */\n hostElement?: HTMLDivElement | undefined;\n\n /**\n * Opens the custom panel.\n *\n * @param options Custom panel options.\n */\n open: (options?: CustomPanelOpenOptions) => void;\n\n /**\n * Closes the custom panel.\n */\n close: () => void;\n}\n\n/**\n * Describes general config options for Carbon AI Chat's internal panel components. This interface is used by legacy\n * panels rendered inside the product.\n *\n * @category Instance\n */\nexport interface BasePanelConfigOptions {\n /**\n * The panel title which is left blank by default.\n */\n title?: string | null;\n\n /**\n * Indicates if the close button in the panel should be hidden. When {@link hidePanelHeader} is true, the close button\n * is hidden automatically.\n */\n hideCloseButton?: boolean;\n\n /**\n * Indicates if the panel header should be hidden. Hiding the header removes the default title, close button, and back\n * button from the chrome.\n */\n hidePanelHeader?: boolean;\n\n /**\n * Indicates if the back button in the panel should be hidden. When {@link hidePanelHeader} is true, the back button is\n * hidden automatically.\n */\n hideBackButton?: boolean;\n\n /**\n * This callback is called when the close button is clicked.\n */\n onClickClose?: () => void;\n\n /**\n * Called when the restart button is clicked.\n */\n onClickRestart?: () => void;\n\n /**\n * This callback is called when the back button is clicked.\n */\n onClickBack?: () => void;\n}\n\n/**\n * Options that change how the custom panel looks. When a header is shown, it inherits styling and behavior from the\n * configured {@link HeaderConfig} (title, assistant name, AI slug, minimize button style, overflow menu, etc.) unless\n * explicitly overridden below.\n *\n * @category Instance\n *\n * @deprecated Use {@link DefaultCustomPanelConfigOptions} for default panels.\n *\n */\nexport interface CustomPanelConfigOptions {\n /**\n * The panel title displayed in the custom panel header. Left blank by default which causes the configured chat header\n * title/name to be shown instead. When a back button is visible the inherited header stays on screen above the panel\n * so this title acts like a breadcrumb; when the back button is hidden, the header fills the panel chrome and this\n * title becomes the primary heading within the overlay.\n */\n title?: string;\n\n /**\n * Indicates if the close/minimize button in the custom panel should be hidden.\n */\n hideCloseButton?: boolean;\n\n /**\n * Indicates if the panel header should be hidden. Hiding the header removes the inherited title, AI slug, minimize\n * button, and back button chrome entirely. Leave this undefined to animate the panel in with the standard header; set\n * it to true when you need a chrome-free experience (for example, when the panel content provides its own close\n * controls or you want the panel to cover the chat header without animating the header into view).\n */\n hidePanelHeader?: boolean;\n\n /**\n * Indicates if the back button in the custom panel should be hidden. When {@link hidePanelHeader} is true, the back\n * button is hidden automatically. When the back button is visible the panel opens beneath the chat header so users\n * can always access the assistant-level header controls while the panel is active.\n */\n hideBackButton?: boolean;\n\n /**\n * Called when the header's close/minimize button is clicked. By default Carbon AI Chat will run its normal close\n * behavior (which collapses the experience) before this callback fires; set {@link disableDefaultCloseAction} to true\n * if you plan to intercept the event and manage closing yourself. The callback still fires even when the default\n * action is disabled.\n */\n onClickClose?: () => void;\n\n /**\n * Called when the restart button in the header is clicked. Use this to trigger a conversation reset or your own\n * telemetry when the restart control is surfaced.\n */\n onClickRestart?: () => void;\n\n /**\n * Called after the header's back button is clicked. The panel automatically closes before this callback is invoked,\n * so you can safely run follow-up logic or analytics once the panel has been dismissed.\n */\n onClickBack?: () => void;\n\n /**\n * Determines if the panel open/close animation should be turned off.\n */\n disableAnimation?: boolean;\n\n /**\n * Disables the default action that is taken when the close button is clicked. Normally clicking the close/minimize\n * button will run Carbon AI Chat's standard close routine (after verifying no view change is in progress). Set this\n * to true when you want to keep the experience open or handle closing asynchronously; you'll need to perform the\n * desired close work inside {@link onClickClose}.\n */\n disableDefaultCloseAction?: boolean;\n}\n\n/**\n * Options supported by the default custom panel implementation.\n *\n * When {@link hideBackButton} is set to true, any {@link title} value defined here will override the title/name in\n * the main chat header.\n *\n * @category Instance\n */\nexport interface DefaultCustomPanelConfigOptions {\n /**\n * The panel title displayed in the custom panel header. When a back button is visible the inherited header remains\n * on screen above the panel so this title acts like a breadcrumb; when the back button is hidden, the header fills\n * the panel chrome and this title becomes the primary heading within the overlay.\n */\n title?: string;\n\n /**\n * Determines if the panel open/close animation should be turned off. By default, the panel will animate up from the\n * bottom of the chat window.\n */\n disableAnimation?: boolean;\n\n /**\n * Indicates if the back button in the custom panel should be hidden.\n */\n hideBackButton?: boolean;\n}\n/**\n * Options supported by the workspace custom panel implementation.\n *\n * @experimental\n * @category Instance\n */\nexport interface WorkspaceCustomPanelConfigOptions {\n /**\n * Determines if the panel open/close animation should be turned off. By default, the panel will animate up from the\n * bottom of the chat window.\n */\n disableAnimation?: boolean;\n /**\n * Where the chat will attempt to render the workspace in logical terms. For a ltr layout \"start\" will render on the left and \"end\" will render on the right. If there is not enough room to render the workspace, it will be rendered as a panel overlaying the content with a back button.\n */\n preferredLocation?: \"start\" | \"end\";\n}\n\n/**\n * Options accepted by {@link CustomPanelInstance.open}. Legacy consumers may continue to pass\n * {@link CustomPanelConfigOptions} until the next major release.\n *\n * @category Instance\n */\nexport type CustomPanelOpenOptions =\n | CustomPanelConfigOptions\n | DefaultCustomPanelConfigOptions\n | WorkspaceCustomPanelConfigOptions;\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport {\n CustomPanels,\n ViewState,\n ViewType,\n WorkspaceCustomPanelConfigOptions,\n} from \"./apiTypes\";\nimport { BusEvent, BusEventType } from \"../events/eventBusTypes\";\nimport { ChatInstanceMessaging } from \"../config/MessagingConfig\";\nimport type { PersistedState } from \"../state/AppState\";\nimport type { PersistedHumanAgentState } from \"../state/PersistedHumanAgentState\";\nimport { MessageRequest } from \"../messaging/Messages\";\nimport type { ServiceManager } from \"../../chat/services/ServiceManager\";\n\n/**\n * The interface represents the API contract with the chat widget and contains all the public methods and properties\n * that can be used with Carbon AI Chat.\n *\n * @category Instance\n */\nexport interface ChatInstance extends EventHandlers, ChatActions {\n /**\n * Returns state information of the Carbon AI Chat that could be useful.\n */\n getState: () => PublicChatState;\n\n /**\n * Manager for accessing and controlling custom panels.\n */\n customPanels?: CustomPanels;\n\n /**\n * Enables/Disables Workspace Panel animations.\n *\n * @experimental\n */\n updateWorkspaceAnimationBehaviour: (isDisabled: boolean) => void;\n\n /**\n * Manages the position of the workspace panel.\n *\n * @experimental\n */\n updateWorkspacePosition: (preferredLocation: \"start\" | \"end\") => void;\n\n /**\n * Internal testing property that exposes the serviceManager.\n * Only available when exposeServiceManagerForTesting is set to true in PublicConfig.\n *\n * @internal\n */\n serviceManager?: ServiceManager;\n}\n\n/**\n * This is the state made available by calling {@link ChatInstance.getState}. This is a public method that returns immutable values.\n *\n * @category Instance\n */\nexport interface PublicInputState {\n /**\n * @experimental Raw text currently queued in the input before being sent to customSendMessage.\n */\n rawValue: string;\n}\n\n/**\n * Represents public state for default custom panel.\n *\n * @category Instance\n */\nexport interface PublicDefaultCustomPanelState {\n /** Indicates if the default custom panel overlay is currently open. */\n isOpen: boolean;\n}\n/**\n * Represents public state for workspace custom panel.\n *\n * @category Instance\n */\nexport interface PublicWorkspaceCustomPanelState {\n /** Indicates if the workspace custom panel overlay is currently open. */\n isOpen: boolean;\n /**\n * Config options for the workspace panels.\n */\n options: WorkspaceCustomPanelConfigOptions;\n}\n\n/**\n * Represents public state for each supported custom panel variant.\n *\n * @category Instance\n */\nexport interface PublicCustomPanelsState {\n /** State for the default overlay-style custom panel. */\n default: PublicDefaultCustomPanelState;\n /**\n * State for the workspace custom panel.\n *\n * @experimental\n */\n workspace: PublicWorkspaceCustomPanelState;\n}\n\n/**\n * Type returned by {@link ChatInstance.getState}.\n *\n * @category Instance\n */\nexport type PublicChatState = Readonly<\n Omit<PersistedState, \"humanAgentState\"> & {\n /**\n * Current human agent state.\n */\n humanAgent: PublicChatHumanAgentState;\n\n /**\n * Counter that indicates if a message is loading and a loading indicator should be displayed.\n * If \"0\" then we do not show loading indicator.\n */\n isMessageLoadingCounter: number;\n\n /**\n * Optional string to display next to the loading indicator.\n */\n isMessageLoadingText?: string;\n\n /**\n * Counter that indicates if the chat is hydrating and a full screen loading state should be displayed.\n */\n isHydratingCounter: number;\n\n /**\n * The message id of the currently active response. The \"active response\" is the latest response that has been\n * received or is expected. For instance, if you send another message the current activeResponseId will be set to\n * null until you get a new response back. This is meant to be used to disable any user inputs in a user_defined\n * response that you don't want active if its not a message you should be receiving inputs from.\n */\n activeResponseId: string | null;\n\n /**\n * @experimental State representing the main input surface.\n */\n input: PublicInputState;\n\n /**\n * @experimental State for any surfaced custom panels.\n */\n customPanels: PublicCustomPanelsState;\n }\n>;\n\n/**\n * Methods for controlling the input field.\n *\n * @category Instance\n */\nexport interface ChatInstanceInput {\n /**\n * @experimental Updates the raw text queued in the input before it is sent to customSendMessage.\n * Use this when you want to manipulate the canonical value while leaving presentation up to the default renderer or,\n * in the future, a custom slot implementation.\n *\n * @example\n * ```ts\n * instance.input.updateRawValue((prev) => `${prev} @celeste`);\n * ```\n */\n updateRawValue: (updater: (previous: string) => string) => void;\n}\n\n/**\n * Current connection state of the human agent experience.\n *\n * @category Instance\n */\nexport type PublicChatHumanAgentState = Readonly<\n PersistedHumanAgentState & {\n /** Indicates if Carbon AI Chat is attempting to connect to an agent. */\n isConnecting: boolean;\n }\n>;\n\n/**\n * This is a subset of the public interface that is managed by the event bus that is used for registering and\n * unregistering event listeners on the bus.\n *\n * @category Instance\n */\nexport interface EventHandlers {\n /**\n * Adds the given event handler as a listener for events of the given type.\n *\n * @param handlers The handler or handlers along with the event type to start listening for events.\n * @returns The instance for method chaining.\n */\n on: (handlers: TypeAndHandler | TypeAndHandler[]) => EventHandlers;\n\n /**\n * Removes an event listener that was previously added via {@link on} or {@link once}.\n *\n * @param handlers The handler or handlers along with the event type to stop listening for events.\n * @returns The instance for method chaining.\n */\n off: (handlers: TypeAndHandler | TypeAndHandler[]) => EventHandlers;\n\n /**\n * Adds the given event handler as a listener for events of the given type. After the first event is handled, this\n * handler will automatically be removed.\n *\n * @param handlers The handler or handlers along with the event type to start listening for an event.\n * @returns The instance for method chaining.\n */\n once: (handlers: TypeAndHandler | TypeAndHandler[]) => EventHandlers;\n}\n\n/**\n * The type of handler for event bus events. This function may return a Promise in which case, the bus will await\n * the result and the loop will block until the Promise is resolved.\n *\n * @category Instance\n */\nexport type EventBusHandler<T extends BusEvent = BusEvent> = (\n event: T,\n instance: ChatInstance,\n) => unknown;\n\n/**\n * The type of the object that is passed to the event bus functions (e.g. \"on\") when registering a handler.\n *\n * @category Instance\n */\nexport interface TypeAndHandler {\n /**\n * The type of event this handler is for.\n */\n type: BusEventType;\n\n /**\n * The handler for events of this type.\n */\n handler: EventBusHandler;\n}\n\n/**\n * This is a subset of the public interface that provides methods that can be used by the user to control the widget\n * and have it perform certain actions.\n *\n * @category Instance\n */\ninterface ChatActions {\n /**\n * Messaging actions for a chat instance.\n */\n messaging: ChatInstanceMessaging;\n /**\n * This function can be called when another component wishes this component to gain focus. It is up to the\n * component to decide where focus belongs. This may return true or false to indicate if a suitable focus location\n * was found.\n */\n requestFocus: () => boolean | void;\n\n /**\n * Sends the given message to the assistant on the remote server. This will result in a \"pre:send\" and \"send\" event\n * being fired on the event bus. The returned promise will resolve once a response has received and processed and\n * both the \"pre:receive\" and \"receive\" events have fired. It will reject when too many errors have occurred and\n * the system gives up retrying.\n *\n * @param message The message to send.\n * @param options Options for the message sent.\n */\n send: (\n message: MessageRequest | string,\n options?: SendOptions,\n ) => Promise<void>;\n\n /**\n * Fire the view:pre:change and view:change events and change the view of the Carbon AI Chat. If a {@link ViewType} is\n * provided then that view will become visible and the rest will be hidden. If a {@link ViewState} is provided that\n * includes all of the views then all of the views will be changed accordingly. If a partial {@link ViewState} is\n * provided then only the views provided will be changed.\n */\n changeView: (newView: ViewType | ViewState) => Promise<void>;\n\n /**\n * Returns the list of writable elements.\n */\n writeableElements: Partial<WriteableElements>;\n\n /**\n * @deprecated Configure via {@link InputConfig.isVisible}.\n */\n updateInputFieldVisibility: (isVisible: boolean) => void;\n\n /**\n * @deprecated Configure via {@link InputConfig.isDisabled}\n * or {@link PublicConfig.isReadonly}.\n */\n updateInputIsDisabled: (isDisabled: boolean) => void;\n\n /**\n * @deprecated Configure via {@link LauncherConfig.showUnreadIndicator}.\n */\n updateAssistantUnreadIndicatorVisibility: (isVisible: boolean) => void;\n\n /**\n * Scrolls to the (original) message with the given ID. Since there may be multiple message items in a given\n * message, this will scroll the first message to the top of the message window.\n *\n * @param messageID The (original) message ID to scroll to.\n * @param animate Whether or not the scroll should be animated. Defaults to true.\n */\n scrollToMessage: (messageID: string, animate?: boolean) => void;\n\n /**\n * Restarts the conversation with the assistant. This does not make any changes to a conversation with a human agent.\n * This will clear all the current assistant messages from the main assistant view and cancel any outstanding\n * messages. This will also clear the current assistant session which will force a new session to start on the\n * next message.\n *\n * @deprecated Use {@link ChatInstanceMessaging.restartConversation} instead.\n */\n restartConversation: () => Promise<void>;\n\n /**\n * Initiates a doAutoScroll on the currently visible chat panel.\n */\n doAutoScroll: () => void;\n\n /**\n * @param direction Either increases or decreases the internal counter that indicates whether the \"message is loading\"\n * indicator is shown. If the count is greater than zero, then the indicator is shown. Values of \"increase\" or \"decrease\" will\n * increase or decrease the value. \"reset\" will set the value back to 0. You may pass undefined as the first value\n * if you just wish to update the message.\n *\n * You can access the current value via {@link ChatInstance.getState}.\n *\n * @param message You can also, optionally, pass a plain text string as the second argument. It will display next to the loading indicator for\n * you to give meaningful feedback while the message is loading (or simple strings like \"Thinking...\", etc). The most\n * recent value will be used. So if you call it with a string value and then again with no value, the value will be\n * replaced with undefined and stop showing in the UI.\n */\n updateIsMessageLoadingCounter: (\n direction: IncreaseOrDecrease,\n message?: string,\n ) => void;\n\n /**\n * Either increases or decreases the internal counter that indicates whether the hydration fullscreen loading state is\n * shown. If the count is greater than zero, then the indicator is shown. Values of \"increase\" or \"decrease\" will\n * increase or decrease the value. \"reset\" will set the value back to 0.\n *\n * You can access the current value via {@link ChatInstance.getState}.\n */\n updateIsChatLoadingCounter: (direction: IncreaseOrDecrease) => void;\n\n /**\n * Actions for mutating the chat input contents.\n */\n input: ChatInstanceInput;\n\n /**\n * Actions that are related to a service desk integration.\n */\n serviceDesk: ChatInstanceServiceDeskActions;\n\n /**\n * Remove any record of the current session from the browser's SessionStorage.\n *\n * @param keepOpenState If we are destroying the session to restart the chat this can be used to preserve if the web\n * chat is open.\n */\n destroySession: (keepOpenState?: boolean) => Promise<void>;\n}\n\n/**\n * @category Instance\n */\nexport type IncreaseOrDecrease = \"increase\" | \"decrease\" | \"reset\" | undefined;\n\n/**\n * This interface represents the options for when a MessageRequest is sent to the server with the send method.\n *\n * @category Instance\n */\nexport interface SendOptions {\n /**\n * If you want to send a message to the API, but NOT have it show up in the UI, set this to true. The \"pre:send\"\n * and \"send\" events will still be fired but the message will not be added to the local message list displayed in\n * the UI. Note that the response message will still be added.\n */\n silent?: boolean;\n\n /**\n * @internal\n * Optionally, we can provide the original ID of the original message that present an option response_type that\n * provided the options that were selected. We use this to then set the `ui_state.setOptionSelected` in that\n * original message to be able to show which option was selected in the UI.\n */\n setValueSelectedForMessageID?: string;\n}\n\n/**\n * An object of elements we expose to developers to write to. Be sure to check the documentation of the React or\n * web component you are using for how to make use of this, as it differs based on implementation.\n *\n * @category Instance\n */\nexport type WriteableElements = Record<WriteableElementName, HTMLElement>;\n\n/**\n * @category Instance\n */\nexport enum WriteableElementName {\n /**\n * An element that appears in the AI theme only and is shown beneath the title and description in the AI tooltip\n * content.\n */\n AI_TOOLTIP_AFTER_DESCRIPTION_ELEMENT = \"aiTooltipAfterDescriptionElement\",\n\n /**\n * An element that appears in the main message body directly above the welcome node.\n */\n WELCOME_NODE_BEFORE_ELEMENT = \"welcomeNodeBeforeElement\",\n\n /**\n * An element that appears in the header on a new line. Only visible while talking to the assistant.\n */\n HEADER_BOTTOM_ELEMENT = \"headerBottomElement\",\n\n /**\n * An element that appears after the messages area and before the input area.\n */\n BEFORE_INPUT_ELEMENT = \"beforeInputElement\",\n\n /**\n * An element that appears above the input field on the home screen.\n */\n HOME_SCREEN_BEFORE_INPUT_ELEMENT = \"homeScreenBeforeInputElement\",\n\n /**\n * An element that appears on the home screen after the conversation starters.\n */\n HOME_SCREEN_AFTER_STARTERS_ELEMENT = \"homeScreenAfterStartersElement\",\n\n /**\n * An element that appears on the home screen above the welcome message and conversation starters.\n */\n HOME_SCREEN_HEADER_BOTTOM_ELEMENT = \"homeScreenHeaderBottomElement\",\n\n /**\n * An element to be housed in the custom panel.\n */\n CUSTOM_PANEL_ELEMENT = \"customPanelElement\",\n\n /**\n * An element to be housed in the custom panel.\n */\n WORKSPACE_PANEL_ELEMENT = \"workspacePanelElement\",\n}\n\n/**\n * @category Instance\n */\nexport type ChangeFunction = (text: string) => void;\n\n/**\n * Upload options. Currently only applies to conversations with a human agent.\n *\n * @category Instance\n */\nexport interface FileUploadCapabilities {\n /**\n * Indicates that file uploads may be performed by the user.\n */\n allowFileUploads: boolean;\n\n /**\n * If file uploads are allowed, this indicates if more than one file may be selected at a time. The default is false.\n */\n allowMultipleFileUploads: boolean;\n\n /**\n * If file uploads are allowed, this is the set a file types that are allowed. This is filled into the \"accept\"\n * field for the file input element.\n */\n allowedFileUploadTypes: string;\n}\n\n/**\n * Start or end conversations with human agent.\n *\n * @category Instance\n */\nexport interface ChatInstanceServiceDeskActions {\n /**\n * Ends the conversation with a human agent. This does not request confirmation from the user first. If the user\n * is not connected or connecting to a human agent, this function has no effect. You can determine if the user is\n * connected or connecting by calling {@link ChatInstance.getState}. Note that this function\n * returns a Promise that only resolves when the conversation has ended. This includes after the\n * {@link BusEventType.HUMAN_AGENT_PRE_END_CHAT} and {@link BusEventType.HUMAN_AGENT_END_CHAT} events have been fired and\n * resolved.\n */\n endConversation: () => Promise<void>;\n\n /**\n * Sets the suspended state for an agent conversation. A conversation can be suspended or un-suspended only if the\n * user is currently connecting or connected to an agent. If a conversation is suspended, then messages from the user\n * will no longer be routed to the service desk and incoming messages from the service desk will not be displayed. In\n * addition, the current connection status with an agent will not be shown.\n */\n updateIsSuspended: (isSuspended: boolean) => Promise<void>;\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * The types of corners the chat can have.\n *\n * @category Config\n */\nexport enum CornersType {\n /**\n * Makes the corners on the chat component rounded.\n */\n ROUND = \"round\",\n\n /**\n * Makes the corners on the chat component square.\n */\n SQUARE = \"square\",\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This file contains the type definitions for the event bus.\n */\n\nimport { DeepPartial } from \"../utilities/DeepPartial\";\n\nimport {\n ResponseUserProfile,\n ButtonItem,\n GenericItem,\n Message,\n MessageRequest,\n MessageResponse,\n PartialOrCompleteItemChunk,\n} from \"../messaging/Messages\";\nimport { ViewState } from \"../instance/apiTypes\";\nimport { FileUpload } from \"../config/ServiceDeskConfig\";\nimport { HumanAgentsOnlineStatus } from \"../config/ServiceDeskConfig\";\nimport { PublicChatState } from \"../instance/ChatInstance\";\n\n/** @category Events */\nexport enum BusEventType {\n /**\n * When a panel has been closed.\n */\n CLOSE_PANEL_BUTTON_TOGGLED = \"closePanelButton:toggled\",\n\n /**\n * Fired before a message is received. Can take mutations to the message.\n */\n PRE_RECEIVE = \"pre:receive\",\n\n /**\n * Fired after a message is received.\n */\n RECEIVE = \"receive\",\n\n /**\n * Fired before a message is sent to customSendMessage. Can take mutations to the message.\n */\n PRE_SEND = \"pre:send\",\n\n /**\n * Fired after the message is sent to customSendMessage.\n */\n SEND = \"send\",\n\n /**\n * Fired before the view changes (e.g. when the chat window closes).\n */\n VIEW_PRE_CHANGE = \"view:pre:change\",\n\n /**\n * Fired after the view changes (e.g. when the chat window closes).\n */\n VIEW_CHANGE = \"view:change\",\n\n /**\n * Fired when a button response item with button_type \"custom_event\" is clicked.\n * Provides the originating button item and the full message payload to handlers.\n */\n MESSAGE_ITEM_CUSTOM = \"messageItemCustom\",\n\n /**\n * Fired when a userDefined message is received.\n */\n USER_DEFINED_RESPONSE = \"userDefinedResponse\",\n\n /**\n * Fired when history begins to load.\n */\n HISTORY_BEGIN = \"history:begin\",\n\n /**\n * Fired after history is loaded.\n */\n HISTORY_END = \"history:end\",\n\n /**\n * Fired before a conversation restarts.\n */\n PRE_RESTART_CONVERSATION = \"pre:restartConversation\",\n\n /**\n * Fired after a conversation restarts.\n */\n RESTART_CONVERSATION = \"restartConversation\",\n\n /**\n * When the chat has finished hydrating from history or welcome node request.\n */\n CHAT_READY = \"chat:ready\",\n\n /**\n * Fired before a custom panel opens.\n */\n CUSTOM_PANEL_PRE_OPEN = \"customPanel:pre:open\",\n\n /**\n * Fired after a custom panel opens.\n */\n CUSTOM_PANEL_OPEN = \"customPanel:open\",\n\n /**\n * Fired before a custom panel closes.\n */\n CUSTOM_PANEL_PRE_CLOSE = \"customPanel:pre:close\",\n\n /**\n * Fired after a custom panel closes.\n */\n CUSTOM_PANEL_CLOSE = \"customPanel:close\",\n\n /**\n * Fired before a workspace opens.\n */\n WORKSPACE_PRE_OPEN = \"workspace:pre:open\",\n\n /**\n * Fired after a workspace opens.\n */\n WORKSPACE_OPEN = \"workspace:open\",\n\n /**\n * Fired before a workspace closes.\n */\n WORKSPACE_PRE_CLOSE = \"workspace:pre:close\",\n\n /**\n * Fired after a workspace closes.\n */\n WORKSPACE_CLOSE = \"workspace:close\",\n\n /**\n * This event is fired before Carbon AI Chat processes a message received from a human agent from a service desk.\n * You can use this to filter messages before they are displayed to the end user.\n */\n HUMAN_AGENT_PRE_RECEIVE = \"human_agent:pre:receive\",\n\n /**\n * This event is fired after Carbon AI Chat processes a message received from a human agent from a service desk.\n * You can use this to update your history store.\n */\n HUMAN_AGENT_RECEIVE = \"human_agent:receive\",\n\n /**\n * This event is fired before Carbon AI Chat sends a message to a human agent from a service desk.\n * You can use this to filter messages before they are sent to the agent.\n */\n HUMAN_AGENT_PRE_SEND = \"human_agent:pre:send\",\n\n /**\n * This event is fired after Carbon AI Chat sends a message to a human agent from a service desk.\n * You can use this to update your history store.\n */\n HUMAN_AGENT_SEND = \"human_agent:send\",\n\n /**\n * This event is fired before a chat with a service desk has started. This occurs as soon as the user clicks the\n * \"Request agent\" button and before any attempt is made to communicate with the service desk.\n */\n HUMAN_AGENT_PRE_START_CHAT = \"human_agent:pre:startChat\",\n\n /**\n * This event is fired before a chat with an agent is ended. This occurs after the user has selected \"Yes\" from the\n * confirmation modal but it can also be fired if the chat is ended by the agent. Note that this is not fired if a\n * request for an agent is cancelled. The human_agent:endChat event however is fired in that case.\n */\n HUMAN_AGENT_PRE_END_CHAT = \"human_agent:pre:endChat\",\n\n /**\n * This event is fired after a chat with an agent has ended. This is fired after {@link BusEventType.HUMAN_AGENT_PRE_END_CHAT} but\n * can be fired both from the user leaving the chat or the agent ending the chat.\n */\n HUMAN_AGENT_END_CHAT = \"human_agent:endChat\",\n\n /**\n * This event is fired after Carbon AI Chat calls \"areAnyAgentsOnline\" for a service desk. It will report the value returned\n * from that call. This is particularly useful if some custom code wants to take action if no agents are online.\n */\n HUMAN_AGENT_ARE_ANY_AGENTS_ONLINE = \"human_agent:areAnyAgentsOnline\",\n\n /**\n * Fired when a new chunk in a user_defined response comes through.\n */\n CHUNK_USER_DEFINED_RESPONSE = \"chunk:userDefinedResponse\",\n\n /**\n * This event is fired when the user interacts with the feedback controls on a message. This includes both the feedback\n * buttons (thumbs up/down) as well as the details popup where the user can submit additional information.\n */\n FEEDBACK = \"feedback\",\n\n /**\n * This event is fired when the \"stop streaming\" button in the input field is clicked.\n */\n STOP_STREAMING = \"stopStreaming\",\n\n /**\n * This event is fired whenever the public state returned by ChatInstance.getState() changes.\n * This includes changes to viewState, showUnreadIndicator, and other persisted state.\n */\n STATE_CHANGE = \"state:change\",\n\n /**\n * Fired if the disclaimer is accepted.\n */\n DISCLAIMER_ACCEPTED = \"disclaimerAccepted\",\n}\n\n/**\n * The possible reasons why the view may be changed.\n *\n * @category Events\n */\nexport enum ViewChangeReason {\n /**\n * Indicates the Carbon AI Chat has loaded for the first time and a view is trying to open. If openChatByDefault is\n * true then the main window will be trying to open, otherwise the launcher will be trying to open.\n */\n WEB_CHAT_LOADED = \"webChatLoaded\",\n\n /**\n * Indicates the user clicked on our built-in launcher button that opened the main window.\n */\n LAUNCHER_CLICKED = \"launcherClicked\",\n\n /**\n * Indicates the user clicked on our built-in minimize button that closed the launcher.\n */\n MAIN_WINDOW_MINIMIZED = \"mainWindowMinimized\",\n\n /**\n * Indicates the view was changed by a call to {@link ChatInstance.changeView}.\n */\n CALLED_CHANGE_VIEW = \"calledChangeView\",\n}\n\n/**\n * The different sources that can cause a send event to occur.\n *\n * @category Events\n */\nexport enum MessageSendSource {\n /**\n * The user has entered a value from the main input on the message list.\n */\n MESSAGE_INPUT = \"messageInput\",\n\n /**\n * The user has entered a value from the input on the home screen.\n */\n HOME_SCREEN_INPUT = \"homeScreenInput\",\n\n /**\n * The user clicked a button from an option response.\n */\n OPTION_BUTTON = \"optionButton\",\n\n /**\n * The user selected a value from a dropdown for an option response.\n */\n OPTION_DROP_DOWN = \"optionDropDown\",\n\n /**\n * The message was sent as an event history update.\n */\n HISTORY_UPDATE = \"historyUpdate\",\n\n /**\n * An external call to the public \"instance.send\" method was made.\n */\n INSTANCE_SEND = \"instanceSend\",\n\n /**\n * The user chose a value from the date picker.\n */\n DATE_PICKER = \"datePicker\",\n\n /**\n * The user clicked a post back button from a button response.\n */\n POST_BACK_BUTTON = \"postBackButton\",\n\n /**\n * The user clicked a starter from the home screen.\n */\n HOME_SCREEN_STARTER = \"homeScreenStarter\",\n\n /**\n * A default request for the welcome message was made.\n */\n WELCOME_REQUEST = \"welcomeRequest\",\n\n /**\n * This is used for message events.\n */\n EVENT = \"event\",\n\n /**\n * Some other source.\n */\n OTHER = \"other\",\n}\n\n/**\n * The discriminating union of all the possible bus event types.\n * @category Events\n */\nexport interface BusEvent {\n /**\n * The type of this event.\n */\n type: BusEventType;\n}\n\n/**\n *\n *\n * @category Events\n */\nexport interface BusEventClosePanelButtonClicked extends BusEvent {\n type: BusEventType.CLOSE_PANEL_BUTTON_TOGGLED;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventPreReceive extends BusEvent {\n type: BusEventType.PRE_RECEIVE;\n data: MessageResponse;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventReceive extends BusEvent {\n type: BusEventType.RECEIVE;\n data: MessageResponse;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventPreSend extends BusEvent {\n type: BusEventType.PRE_SEND;\n data: MessageRequest;\n\n /**\n * The source of the message being sent.\n */\n source: MessageSendSource;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventSend extends BusEvent {\n type: BusEventType.SEND;\n data: MessageRequest;\n\n /**\n * The source of the message being sent.\n */\n source: MessageSendSource;\n}\n\n/**\n * @category Service desk\n */\nexport interface BusEventHumanAgentPreReceive extends BusEvent {\n type: BusEventType.HUMAN_AGENT_PRE_RECEIVE;\n data: MessageResponse;\n responseUserProfile?: ResponseUserProfile;\n}\n\n/**\n * @category Service desk\n */\nexport interface BusEventHumanAgentReceive extends BusEvent {\n type: BusEventType.HUMAN_AGENT_RECEIVE;\n data: MessageResponse;\n responseUserProfile?: ResponseUserProfile;\n}\n\n/**\n * @category Service desk\n */\nexport interface BusEventHumanAgentPreSend extends BusEvent {\n type: BusEventType.HUMAN_AGENT_PRE_SEND;\n data: MessageRequest;\n files: FileUpload[];\n}\n\n/**\n * @category Service desk\n */\nexport interface BusEventHumanAgentSend extends BusEvent {\n type: BusEventType.HUMAN_AGENT_SEND;\n data: MessageRequest;\n files: FileUpload[];\n}\n\n/**\n * Fires before the view state is updated in the store. This event is awaited, making it ideal for async operations like animations.\n *\n * **Event Timing:**\n * 1. VIEW_PRE_CHANGE fires (awaited)\n * 2. View state is updated in store\n * 3. VIEW_CHANGE fires (awaited)\n *\n * **Use cases:**\n * - Run animations before the view changes\n * - Modify the new view state before it's applied\n * - Cancel the view change entirely\n *\n * @category Events\n */\nexport interface BusEventViewPreChange extends BusEvent {\n type: BusEventType.VIEW_PRE_CHANGE;\n\n /**\n * The reason the view is changing.\n */\n reason: ViewChangeReason;\n\n /**\n * The previous view state before this event.\n */\n oldViewState: ViewState;\n\n /**\n * The new view state that Carbon AI Chat is going to switch to. This new state can be changed by the event handler.\n */\n newViewState: ViewState;\n\n /**\n * This is used by the event handler to indicate that the view change should be cancelled and Carbon AI Chat's view should\n * not be changed.\n */\n cancelViewChange: boolean;\n}\n\n/**\n * Fires after the view state has been updated in the store. This event is awaited, making it ideal for async operations that should happen after the view change.\n *\n * **Event Timing:**\n * 1. VIEW_PRE_CHANGE fires (awaited)\n * 2. View state is updated in store\n * 3. VIEW_CHANGE fires (awaited) ← You are here\n *\n * **Use cases:**\n * - React to completed view changes\n * - Run cleanup or follow-up animations\n * - Cancel and revert the view change (causes immediate revert without firing events)\n *\n * @category Events\n */\nexport interface BusEventViewChange extends BusEvent {\n type: BusEventType.VIEW_CHANGE;\n\n /**\n * The reason the view is changing.\n */\n reason: ViewChangeReason;\n\n /**\n * The previous view state from before the view:pre:change event.\n */\n oldViewState: ViewState;\n\n /**\n * The new view state that Carbon AI Chat has switched to. This new state can be changed by the event handler.\n */\n newViewState: ViewState;\n\n /**\n * This is used by the event handler to indicate that the view change should be cancelled and Carbon AI Chat's view should\n * not be changed. Since the view has already changed when this event is fired, this property will cause the view to\n * change back. Note that the view change events are *not* fired when the view changes back.\n */\n cancelViewChange: boolean;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventReset extends BusEvent {\n type: BusEventType.RESTART_CONVERSATION;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventChatReady extends BusEvent {\n type: BusEventType.CHAT_READY;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventPreReset extends BusEvent {\n type: BusEventType.PRE_RESTART_CONVERSATION;\n}\n\n/**\n * This describes a custom event that can be authored with the button response type of type \"option\". When clicked,\n * this event will fire and provide information authored in the custom event.\n *\n * @category Events\n */\nexport interface BusEventMessageItemCustom extends BusEvent {\n type: BusEventType.MESSAGE_ITEM_CUSTOM;\n\n /**\n * The button item that triggered this custom event.\n */\n messageItem: ButtonItem;\n\n /**\n * The full message response that contained the button item that triggered this custom event.\n */\n fullMessage: MessageResponse;\n}\n\n/**\n * Used to populate user_defined responses. Please see the React or web component documentation as usage of this\n * differs based on implementation.\n *\n * @category Events\n */\nexport interface BusEventUserDefinedResponse extends BusEvent {\n type: BusEventType.USER_DEFINED_RESPONSE;\n data: {\n /**\n * The individual message item that is being displayed in this custom response.\n */\n message: GenericItem;\n\n /**\n * The full message (response or request) that contains the message item.\n */\n fullMessage: Message;\n\n /**\n * The slot name for users of the web components cds-aichat-container or cds-aichat-custom-element.\n */\n slot?: string;\n };\n}\n\n/**\n * @category Events\n */\nexport interface BusEventChunkUserDefinedResponse extends BusEvent {\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE;\n data: {\n /**\n * The individual message item that is being displayed in this custom response.\n */\n messageItem: DeepPartial<GenericItem>;\n\n /**\n * The full chunk that contained the user defined response.\n */\n chunk: PartialOrCompleteItemChunk;\n\n /**\n * The slot name for users of the web components cds-aichat-container or cds-aichat-custom-element.\n */\n slot?: string;\n };\n}\n\n/**\n * The event is fired whenever the widget begins processing a list of messages that have been loaded from history.\n * This event may be fired not only when the history is first loaded but it may be fired later during the life of\n * the widget if additional messages are loaded from history.\n *\n * This event is fired when this process begins. This is fired before all the \"pre:receive\" and \"receive\" events are\n * fired which means that the messages here are the original messages before any possible modifications by the event\n * handlers.\n *\n * @category Events\n */\nexport interface BusEventHistoryBegin extends BusEvent {\n /**\n * The discriminating type of this event.\n */\n type: BusEventType.HISTORY_BEGIN;\n\n /**\n * The list of all the messages that are being loaded by this history event.\n */\n messages: Message[];\n\n /**\n * Indicates that modifications were made to the given messages and that updates to those messages should be saved in\n * the history store. This is similar to the update behavior of the \"pre:receive\" event that is handled\n * automatically.\n */\n updateMessageIDs?: string[];\n}\n\n/**\n * The event is fired whenever the widget begins processing a list of messages that have been loaded from history.\n * This event may be fired not only when the history is first loaded but it may be fired later during the life of\n * the widget if additional messages are loaded from history.\n *\n * This event is fired when this process ends. This is fired after all the \"pre:receive\" and \"receive\" events are\n * fired which means that the messages here are the potentially modified messages after any possible modifications\n * by the event handlers.\n *\n * @category Events\n */\nexport interface BusEventHistoryEnd extends BusEvent {\n /**\n * The discriminating type of this event.\n */\n type: BusEventType.HISTORY_END;\n\n /**\n * The list of all the messages that were loaded by this history event.\n */\n messages: Message[];\n}\n\n/**\n * @category Events\n */\nexport interface BusEventCustomPanelPreOpen extends BusEvent {\n type: BusEventType.CUSTOM_PANEL_PRE_OPEN;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventCustomPanelOpen extends BusEvent {\n type: BusEventType.CUSTOM_PANEL_OPEN;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventCustomPanelPreClose extends BusEvent {\n type: BusEventType.CUSTOM_PANEL_PRE_CLOSE;\n}\n\n/**\n * @category Events\n */\nexport interface BusEventCustomPanelClose extends BusEvent {\n type: BusEventType.CUSTOM_PANEL_CLOSE;\n}\n\n/**\n * @category Events\n * @experimental\n */\nexport interface BusEventWorkspacePreOpen extends BusEvent {\n type: BusEventType.WORKSPACE_PRE_OPEN;\n data: {\n /**\n * The individual message item that is being displayed in this custom response.\n */\n message: GenericItem;\n\n /**\n * The full message response that contains the message item.\n */\n fullMessage: MessageResponse;\n };\n}\n\n/**\n * @category Events\n * @experimental\n */\nexport interface BusEventWorkspaceOpen extends BusEvent {\n type: BusEventType.WORKSPACE_OPEN;\n data: {\n /**\n * The individual message item that is being displayed in this custom response.\n */\n message: GenericItem;\n\n /**\n * The full message response that contains the message item.\n */\n fullMessage: MessageResponse;\n };\n}\n\n/**\n * @category Events\n * @experimental\n */\nexport interface BusEventWorkspacePreClose extends BusEvent {\n type: BusEventType.WORKSPACE_PRE_CLOSE;\n data: {\n /**\n * The individual message item that is being displayed in this custom response.\n */\n message: GenericItem;\n\n /**\n * The full message response that contains the message item.\n */\n fullMessage: MessageResponse;\n };\n}\n\n/**\n * @category Events\n * @experimental\n */\nexport interface BusEventWorkspaceClose extends BusEvent {\n type: BusEventType.WORKSPACE_CLOSE;\n data: {\n /**\n * The individual message item that is being displayed in this custom response.\n */\n message: GenericItem;\n\n /**\n * The full message response that contains the message item.\n */\n fullMessage: MessageResponse;\n };\n}\n\n/**\n * This event is fired before the user is connected to a service desk. This occurs as soon as the user clicks the\n * \"Request agent\" button and before any attempt is made to communicate with the service desk.\n *\n * @category Service desk\n */\nexport interface BusEventHumanAgentPreStartChat<\n TPayloadType = unknown,\n> extends BusEvent {\n /**\n * The type of the event.\n */\n type: BusEventType.HUMAN_AGENT_PRE_START_CHAT;\n\n /**\n * The message that was used to trigger the connection to the agent.\n */\n message: MessageResponse;\n\n /**\n * This flag can be set by a listener to indicate that the connection process should be cancelled.\n */\n cancelStartChat?: boolean;\n\n /**\n * Some arbitrary payload of data that will be passed to the service desk when a chat is started.\n */\n preStartChatPayload?: TPayloadType;\n}\n\n/**\n * This event is fired before a chat with an agent is ended. This occurs after the user has selected \"Yes\" from the\n * confirmation modal but it can also be fired if the chat is ended by the agent.\n *\n * @category Service desk\n */\nexport interface BusEventHumanAgentPreEndChat<\n TPayloadType = unknown,\n> extends BusEvent {\n /**\n * The type of the event.\n */\n type: BusEventType.HUMAN_AGENT_PRE_END_CHAT;\n\n /**\n * Indicates if the chat was ended by the agent.\n */\n endedByHumanAgent: boolean;\n\n /**\n * An arbitrary payload object that a listener may set. This payload will be passed to the service desk\n * ServiceDesk endChat function.\n */\n preEndChatPayload: TPayloadType;\n\n /**\n * This value may be set by a listener to indicate that the process of ending the chat should be cancelled.\n */\n cancelEndChat: boolean;\n}\n\n/**\n * This event is fired after a chat with an agent has ended. This is fired after {@link BusEventType.HUMAN_AGENT_PRE_END_CHAT} but\n * can be fired both from the user leaving the chat or the agent ending the chat.\n *\n * @category Service desk\n */\nexport interface BusEventHumanAgentEndChat extends BusEvent {\n /**\n * The type of the event.\n */\n type: BusEventType.HUMAN_AGENT_END_CHAT;\n\n /**\n * Indicates if the chat was ended by the agent.\n */\n endedByHumanAgent: boolean;\n\n /**\n * Indicates if the chat was ended because the request for an agent was cancelled or an error occurred while\n * starting the chat. This means the start never fully started.\n */\n requestCancelled: boolean;\n}\n\n/**\n * This event is fired after Carbon AI Chat calls \"areAnyAgentsOnline\" for a service desk. It will report the value returned\n * from that call. This is particularly useful if some custom code wants to take action if no agents are online.\n *\n * @category Service desk\n */\nexport interface BusEventHumanAgentAreAnyAgentsOnline extends BusEvent {\n /**\n * The type of the event.\n */\n type: BusEventType.HUMAN_AGENT_ARE_ANY_AGENTS_ONLINE;\n\n /**\n * The result that was returned from \"areAnyAgentsOnline\". If an error occurred, this will be\n * {@link HumanAgentsOnlineStatus.OFFLINE}.\n */\n areAnyAgentsOnline: HumanAgentsOnlineStatus;\n}\n\n/**\n * The ways the user may interact with the feedback controls.\n *\n * @category Events\n */\nexport enum FeedbackInteractionType {\n /**\n * Indicates the details popup was opened after the user clicked one of the feedback buttons.\n */\n DETAILS_OPENED = \"detailsOpened\",\n\n /**\n * Indicates the details popup was closed after the user clicked the \"X\" button to close it or if the user clicked the\n * feedback button that opened it.\n */\n DETAILS_CLOSED = \"detailsClosed\",\n\n /**\n * Indicates feedback was submitted. This includes both when the details panel is open and submitted as well as when\n * the user clicks a feedback button and the details are not shown.\n */\n SUBMITTED = \"submitted\",\n}\n\n/**\n * This event is fired when the user interacts with the feedback controls on a message. This includes both the feedback\n * buttons (thumbs up/down) as well as the details popup where the user can submit additional information.\n *\n * @category Events\n */\nexport interface BusEventFeedback extends BusEvent {\n /**\n * The message item for which feedback was provided.\n */\n messageItem: GenericItem;\n\n /**\n * The message for which feedback was provided.\n */\n message: MessageResponse;\n\n /**\n * Indicates if the user is providing positive or negative feedback.\n */\n isPositive: boolean;\n\n /**\n * The type of interaction the user had with the feedback.\n */\n interactionType: FeedbackInteractionType;\n\n /**\n * When submitting feedback details, this is the text the user entered into the text field (if visible).\n */\n text?: string;\n\n /**\n * When submitting feedback details, this is the list of categories the user selected (if visible).\n */\n categories?: string[];\n}\n\n/**\n * This event is fired whenever the public state returned by ChatInstance.getState() changes.\n * This includes changes to viewState, showUnreadIndicator, and other persisted state.\n *\n * @category Events\n */\nexport interface BusEventStateChange extends BusEvent {\n /**\n * The type of the event.\n */\n type: BusEventType.STATE_CHANGE;\n\n /**\n * The previous state before the change.\n */\n previousState: PublicChatState;\n\n /**\n * The new state after the change.\n */\n newState: PublicChatState;\n}\n\n/**\n * The possible reasons why the chat window may be opened.\n *\n * @category Events\n */\nexport enum MainWindowOpenReason {\n /**\n * Indicates the user clicked on our built-in launcher button that opened the main window.\n */\n DEFAULT_LAUNCHER = \"default_launcher\",\n\n /**\n * Indicates the main window was opened because {@link PublicConfig.openChatByDefault} was set to true.\n */\n OPEN_BY_DEFAULT = \"open_by_default\",\n\n /**\n * Indicates the main window was opened as a result of session history.\n */\n SESSION_HISTORY = \"session_history\",\n}\n\n/**\n * The possible reasons why the chat window may be closed.\n *\n * @category Events\n */\nexport enum MainWindowCloseReason {\n /**\n * Indicates the user clicked on our built-in minimize button that closed to the launcher.\n */\n DEFAULT_MINIMIZE = \"default_minimize\",\n\n /**\n * Indicates the user clicked the close and restart button that minimized to the launcher.\n */\n MAIN_WINDOW_CLOSED_AND_RESTARTED = \"main_window_closed_and_restarted\",\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { HistoryItem } from \"../messaging/History\";\nimport type { MessageResponse, StreamChunk } from \"../messaging/Messages\";\nimport { BusEventSend } from \"../events/eventBusTypes\";\n\n/**\n * Reasons why a message request was cancelled via the abort signal.\n *\n * @category Messaging\n */\nexport enum CancellationReason {\n /**\n * User clicked the \"stop streaming\" button during message streaming.\n */\n STOP_STREAMING = \"Stop streaming\",\n\n /**\n * User restarted or cleared the conversation.\n */\n CONVERSATION_RESTARTED = \"Conversation restarted\",\n\n /**\n * Message request exceeded the configured timeout duration.\n */\n TIMEOUT = \"Request timeout\",\n}\n\n/**\n * Messaging actions for a chat instance.\n *\n * @category Messaging\n */\nexport interface ChatInstanceMessaging {\n /**\n * Instructs the widget to process the given message as an incoming message received from the assistant. This will\n * fire a \"pre:receive\" event immediately and a \"receive\" event after the event has been processed by the widget.\n *\n * @param message A {@link MessageResponse} object.\n */\n addMessage: (message: MessageResponse) => Promise<void>;\n\n /**\n * Adds a streaming message chunk to the chat widget.\n */\n addMessageChunk: (chunk: StreamChunk) => Promise<void>;\n\n /**\n * Removes the messages with the given IDs from the chat view.\n */\n removeMessages: (messageIDs: string[]) => Promise<void>;\n\n /**\n * Clears the current conversation. This will trigger a restart of the conversation but will not start a new\n * conversation (hydration). It will also clear any loading indicators UNLESS you have set\n * {@link PublicConfigMessaging.messageLoadingIndicatorTimeoutSecs} to 0.\n */\n clearConversation: () => Promise<void>;\n\n /**\n * Inserts the given messages into the chat window as part of the chat history. This will fire the history:begin\n * and history:end events.\n */\n insertHistory: (messages: HistoryItem[]) => Promise<void>;\n\n /**\n * Restarts the conversation with the assistant. This does not make any changes to a conversation with a human agent.\n * This will clear all the current assistant messages from the main assistant view and cancel any outstanding\n * messages. It will also clear any loading indicators UNLESS you have set\n * {@link PublicConfigMessaging.messageLoadingIndicatorTimeoutSecs} to 0.\n */\n restartConversation: () => Promise<void>;\n}\n\n/**\n * Options for calling the addMessage method.\n *\n * @category Messaging\n */\nexport interface AddMessageOptions {\n /**\n * Indicates if the message should be treated as a new welcome message (as opposed to an existing one loaded from\n * history).\n */\n isLatestWelcomeNode?: boolean;\n}\n\n/**\n * @category Messaging\n */\nexport interface CustomSendMessageOptions {\n /**\n * A signal to let customSendMessage to cancel a request if it has exceeded Carbon AI Chat's timeout.\n */\n signal: AbortSignal;\n\n /**\n * If the message was sent with \"silent\" set to true to not be displayed in the conversation history.\n */\n silent: boolean;\n\n /**\n * BusEventSend provides extra context such as MessageSendSource.\n */\n busEventSend?: BusEventSend;\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { ChatInstance } from \"../instance/ChatInstance\";\nimport { CustomSendMessageOptions } from \"./MessagingConfig\";\nimport { MessageRequest } from \"../messaging/Messages\";\nimport { CornersType } from \"./CornersType\";\nimport { HomeScreenConfig } from \"./HomeScreenConfig\";\nimport type { LayoutCustomProperties } from \"./LayoutCustomProperties\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"./ServiceDeskConfig\";\nimport { HistoryItem } from \"../messaging/History\";\nimport { LauncherConfig } from \"./LauncherConfig\";\nimport { DeepPartial } from \"../utilities/DeepPartial\";\nimport enLanguagePackData from \"../../chat/languages/en.json\";\n\n/**\n * This file contains the definition for the public application configuration operations that are provided by the\n * host page.\n */\n\n/**\n * The raw strings used for {@link PublicConfig.strings}. Presented in ICU format.\n *\n * @category Config\n */\nexport const enLanguagePack = enLanguagePackData;\n\n/**\n * A language pack represents the set of display strings for a particular language.\n * It defines all the text strings that can be customized for different languages.\n *\n * @category Config\n */\nexport type LanguagePack = typeof enLanguagePack;\n\n/**\n * Configuration interface for Carbon AI Chat.\n *\n * @category Config\n */\nexport interface PublicConfig {\n /**\n * This is a one-off listener for catastrophic errors. This is used instead of a normal event bus handler because this function can be\n * defined and called before the event bus has been created.\n */\n onError?: (data: OnErrorData) => void;\n\n /**\n * By default, the chat window will be rendered in a \"closed\" state.\n */\n openChatByDefault?: boolean;\n\n /**\n * Disclaimer screen configuration.\n *\n * If `disclaimerHTML` changes after the disclaimer has been accepted, we request a user to accept again.\n */\n disclaimer?: DisclaimerPublicConfig;\n\n /**\n * This value is only used when a custom element is being used to render the widget. By default, a number of\n * enhancements to the widget are activated on mobile devices which can interfere with a custom element. This\n * value can be used to disable those enhancements while using a custom element.\n */\n disableCustomElementMobileEnhancements?: boolean;\n\n /**\n * Add a bunch of noisy console.log messages!\n */\n debug?: boolean;\n\n /**\n * Expose internal serviceManager on ChatInstance for testing purposes.\n * This should only be used in test environments.\n *\n * @internal\n */\n exposeServiceManagerForTesting?: boolean;\n\n /**\n * Which Carbon theme tokens to inject. If unset (falsy), the chat inherits tokens from the host page.\n * Set to a specific theme to force token injection.\n */\n injectCarbonTheme?: CarbonTheme;\n\n /**\n * Enables Carbon AI theme styling. Defaults to true.\n */\n aiEnabled?: boolean;\n\n /**\n * This is a factory for producing custom implementations of service desks. If this value is set, then this will\n * be used to create an instance of a {@link ServiceDesk} when the user attempts to connect to an agent.\n *\n * If it is changed in the middle of a conversation (you should obviously avoid this) the conversation with the\n * human agent will be disconnected.\n */\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /**\n * Any public config to apply to service desks.\n */\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * If the Carbon AI Chat should grab focus if the chat is open on page load.\n */\n shouldTakeFocusIfOpensAutomatically?: boolean;\n\n /**\n * An optional namespace that can be added to the Carbon AI Chat that must be 30 characters or under. This value is\n * intended to enable multiple instances of the Carbon AI Chat to be used on the same page. The namespace for this web\n * chat. This value is used to generate a value to append to anything unique (id, session keys, etc) to allow\n * multiple Carbon AI Chats on the same page.\n *\n * Note: this value is used in the aria region label for the Carbon AI Chat. This means this value will be read out loud\n * by users using a screen reader.\n */\n namespace?: string;\n\n /**\n * @internal\n * Indicates if a focus trap should be enabled when the Carbon AI Chat is open.\n */\n enableFocusTrap?: boolean;\n\n /**\n * Indicates if Carbon AI Chat should sanitize HTML from the assistant.\n */\n shouldSanitizeHTML?: boolean;\n\n /**\n * Extra config for controlling the behavior of the header.\n */\n header?: HeaderConfig;\n\n /**\n * The config object for changing Carbon AI Chat's layout.\n */\n layout?: LayoutConfig;\n\n /**\n * Config options for controlling messaging.\n */\n messaging?: PublicConfigMessaging;\n\n /**\n * Sets the chat into a read only mode for displaying old conversations.\n */\n isReadonly?: boolean;\n\n /**\n * Allows for feedback to persist in all messages, not just the latest message.\n */\n persistFeedback?: boolean;\n\n /**\n * Sets the name of the assistant. Defaults to \"watsonx\". Used in screen reader announcements and error messages.\n */\n assistantName?: string;\n\n /**\n * The locale to use for the widget. This controls the language pack and regional formatting.\n * Example values include: 'en', 'en-us', 'fr', 'es'.\n */\n locale?: string;\n\n /**\n * Configuration for the homescreen.\n *\n * If you change anything but `is_on` after the chat session has started, the chat will handle it gracefully.\n *\n * If you turn on the homescreen after the user has already started chatting, it will show up in the header as\n * an icon, but the user won't be forced to go back to the homescreen (unlike turning on the disclaimer mid-chat).\n */\n homescreen?: HomeScreenConfig;\n\n /**\n * Configuration for the launcher.\n */\n launcher?: LauncherConfig;\n\n /**\n * Configuration for the main input field on the chat.\n */\n input?: InputConfig;\n\n /**\n * Optional partial language pack overrides. Values merge with defaults.\n */\n strings?: DeepPartial<LanguagePack>;\n}\n\n/**\n * A single menu option.\n *\n * @category Config\n */\nexport interface CustomMenuOption {\n /**\n * The text to display for the menu option.\n */\n text: string;\n\n /**\n * The callback handler to call when the option is selected. Provide this of \"url\".\n */\n handler: () => void;\n}\n\n/**\n * @category Config\n */\nexport enum MinimizeButtonIconType {\n /**\n * This shows an \"X\" icon.\n */\n CLOSE = \"close\",\n\n /**\n * This shows a \"-\" icon.\n */\n MINIMIZE = \"minimize\",\n\n /**\n * This shows an icon that indicates that the Carbon AI Chat can be collapsed into a side panel.\n */\n SIDE_PANEL_LEFT = \"side-panel-left\",\n\n /**\n * This shows an icon that indicates that the Carbon AI Chat can be collapsed into a side panel.\n */\n SIDE_PANEL_RIGHT = \"side-panel-right\",\n}\n\n/**\n * Configuration for the input field in the main chat and homescreen.\n *\n * @category Config\n */\nexport interface InputConfig {\n /**\n * The maximum number of characters allowed in the input field. Defaults to 10000.\n */\n maxInputCharacters?: number;\n\n /**\n * Controls whether the main input surface is visible when the chat loads.\n * Defaults to true.\n */\n isVisible?: boolean;\n\n /**\n * If true, the main input surface starts in a disabled (read-only) state.\n * Equivalent to {@link PublicConfig.isReadonly}, but scoped just to the assistant input.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Configuration for the main header of the chat.\n *\n * @category Config\n */\nexport interface HeaderConfig {\n /**\n * If the chat should supply its own header. Can be false if you have a fullscreen chat or one embedded into a page and\n * you want to only make use of the main application header. Defaults to true.\n */\n isOn?: boolean;\n\n /**\n * Indicates the icon to use for the close button in the header.\n */\n minimizeButtonIconType?: MinimizeButtonIconType;\n\n /**\n * Hide the ability to minimize the Carbon AI Chat.\n */\n hideMinimizeButton?: boolean;\n\n /**\n * If true, shows the restart conversation button in the header of home screen and main chat.\n */\n showRestartButton?: boolean;\n\n /**\n * The chat header title.\n */\n title?: string;\n\n /**\n * The name displayed after the title.\n */\n name?: string;\n\n /**\n * All the currently configured custom menu options.\n */\n menuOptions?: CustomMenuOption[];\n\n /**\n * Controls whether to show the AI label/slug in the header. Defaults to true.\n *\n * There is currently no version of this that does not include the AI theme\n * blue gradients.\n */\n showAiLabel?: boolean;\n}\n\n/**\n * @category Config\n */\nexport interface LayoutConfig {\n /**\n * Indicates if the Carbon AI Chat widget should keep its border and box-shadow.\n */\n showFrame?: boolean;\n\n /**\n * Indicates if content inside the Carbon AI Chat widget should be constrained to a max-width.\n *\n * At larger widths the card, carousel, options and conversational search response types\n * have pending issues.\n */\n hasContentMaxWidth?: boolean;\n\n /**\n * This flag is used to disable Carbon AI Chat's rounded corners.\n */\n corners?: CornersType;\n\n /**\n * CSS variable overrides for the chat UI.\n *\n * Keys correspond to values from `LayoutCustomProperties` (e.g. `LayoutCustomProperties.height`),\n * which map to the underlying `--cds-aichat-…` custom properties.\n * Values are raw CSS values such as `\"420px\"`, `\"9999\"`, etc.\n *\n * Example:\n * { height: \"560px\", width: \"420px\" }\n */\n customProperties?: Partial<Record<LayoutCustomProperties, string>>;\n}\n\n/**\n * Config options for controlling messaging.\n *\n * @category Config\n */\nexport interface PublicConfigMessaging {\n /**\n * Indicates if Carbon AI Chat should make a request for the welcome message when a new conversation begins. If this is\n * true, then Carbon AI Chat will start with an empty conversation.\n *\n * **Manual session management required**: Changes to this property after conversation has started have no effect.\n * To apply new welcome behavior, call `instance.messaging.restartConversation()`.\n */\n skipWelcome?: boolean;\n\n /**\n * Changes the timeout used by the message service when making message calls. The timeout is in seconds. The\n * default is 150 seconds. After this time, an error will be shown in the client and an Abort signal will be sent\n * to customSendMessage. If set to 0, the chat will never timeout. This is tied to either {@link ChatInstanceMessaging.addMessage} or\n * {@link ChatInstanceMessaging.addMessageChunk} being called after this message was sent. If neither of those methods\n * are called with in the window defined here, the chat will timeout (unless the value is set to 0).\n */\n messageTimeoutSecs?: number;\n\n /**\n * Controls how long AI chat should wait before showing the loading indicator. If set to 0, the chat will never show\n * the loading indicator on its own. This is tied to either {@link ChatInstanceMessaging.addMessage} or\n * {@link ChatInstanceMessaging.addMessageChunk} being called after this message was sent. If neither of those methods\n * are called with in the window defined here, the loading indicator will be shown.\n */\n messageLoadingIndicatorTimeoutSecs?: number;\n\n /**\n * A callback for Carbon AI Chat to use to send messages to your assistant.\n *\n * Carbon AI Chat will queue up any additional user messages until the Promise from a previous call to customSendMessage\n * has resolved. If you do not make customSendMessage async, it will be up to you to manage what happens when a message is\n * sent when the previous is still processing. If the Promise rejects, an error indicator will be displayed next to the user's message.\n *\n * If the request takes longer than PublicConfigMessaging.messageTimeoutSecs than the AbortSignal will be sent.\n */\n customSendMessage?: (\n request: MessageRequest,\n requestOptions: CustomSendMessageOptions,\n instance: ChatInstance,\n ) => Promise<void> | void;\n\n /**\n * This is a callback function that is used by Carbon AI Chat to retrieve history data for populating the Carbon AI Chat. If\n * this function is defined, it will be used instead of any other mechanism for fetching history.\n *\n * If this function is mutated after it was initially called, the chat does not re-call it.\n */\n customLoadHistory?: (instance: ChatInstance) => Promise<HistoryItem[]>;\n}\n\n/**\n * @category Config\n */\nexport interface DisclaimerPublicConfig {\n /**\n * If the disclaimer is turned on.\n */\n isOn: boolean;\n\n /**\n * HTML content to show in disclaimer.\n */\n disclaimerHTML: string;\n}\n\n/**\n * A string identifying what Carbon Theme we should base UI variables off of.\n * Defaults to \"inherit\". If you are not hosting the chat on a website that is Carbon styles, you will want to choose\n * once of the non-inherited values to inject the correct CSS custom property values into the code. See\n * https://carbondesignsystem.com/guidelines/color/tokens.\n *\n * @category Config\n */\nexport enum CarbonTheme {\n /**\n * Injects Carbon white theme tokens.\n */\n WHITE = \"white\",\n /**\n * Injects Carbon Gray 10 theme tokens.\n */\n G10 = \"g10\",\n /**\n * Injects Carbon Gray 90 theme tokens.\n */\n G90 = \"g90\",\n /**\n * Injects Carbon Gray 100 theme tokens.\n */\n G100 = \"g100\",\n}\n\n/**\n * The different categories of errors that the system can record. These values are published for end user consumption.\n *\n * @category Config\n */\nexport enum OnErrorType {\n /**\n * Indicates an error sending a message to the assistant. This error is only generated after all retries have\n * failed and the system has given up.\n */\n MESSAGE_COMMUNICATION = \"MESSAGE_COMMUNICATION\",\n\n /**\n * This indicates an error in one of the components that occurs as part of rendering the UI.\n */\n RENDER = \"RENDER\",\n\n /**\n * This indicates a known error with the configuration for a service desk. Fired when a connect_to_agent\n * response type is received, but none is configured.\n */\n INTEGRATION_ERROR = \"INTEGRATION_ERROR\",\n\n /**\n * This indicates that some error occurred while trying to hydrate the chat. This will prevent the chat from\n * functioning.\n */\n HYDRATION = \"HYDRATION\",\n}\n\n/**\n * Fired when a serious error in the chat occurs.\n *\n * @category Config\n */\nexport interface OnErrorData {\n /**\n * The type of error that occurred.\n */\n errorType: OnErrorType;\n\n /**\n * A message associated with the error.\n */\n message: string;\n\n /**\n * An extra blob of data associated with the error. This may be a stack trace for thrown errors.\n */\n otherData?: unknown;\n\n /**\n * If the error is of the severity that requires a whole restart of Carbon AI Chat.\n */\n catastrophicErrorType?: boolean;\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { DeepPartial } from \"../utilities/DeepPartial\";\n\nimport {\n ResponseUserProfile,\n MessageRequest,\n MessageResponse,\n} from \"../messaging/Messages\";\nimport type {\n ChatInstance,\n FileUploadCapabilities,\n} from \"../instance/ChatInstance\";\n\n/**\n * Constants for the Carbon FileStatus type because they weren't kind enough to include their own enum.\n *\n * @category Service desk\n */\nexport enum FileStatusValue {\n COMPLETE = \"complete\",\n EDIT = \"edit\",\n UPLOADING = \"uploading\",\n SUCCESS = \"success\",\n}\n\n/**\n * An interface that represents a file to upload and its current upload status.\n *\n * @category Service desk\n */\nexport interface FileUpload {\n /**\n * A unique ID for the file.\n */\n id: string;\n\n /**\n * The file to upload.\n */\n file: File;\n\n /**\n * The current upload status.\n */\n status: FileStatusValue;\n\n /**\n * Indicates if the file contains an error or failed to upload.\n */\n isError?: boolean;\n\n /**\n * If the file failed to upload, this is an optional error message to display.\n */\n errorMessage?: string;\n}\n\n/**\n * The section of the public config that contains configuration options for service desk integrations.\n *\n * @category Service desk\n */\nexport interface ServiceDeskPublicConfig {\n /**\n * The timeout value in seconds to use when determining agent availability. When a connect_to_agent response is\n * received, the system will ask the service desk if any agents are available. If no response is received within\n * the timeout window, the system will return \"false\" to indicate no agents are available.\n */\n availabilityTimeoutSeconds?: number;\n\n /**\n * Indicates if Carbon AI Chat should auto-connect to an agent whenever it receives a connect_to_agent response and\n * agents are available. This essentially mimics the user clicking the \"Request agent\" button on the card. The\n * card is still displayed to the user.\n */\n skipConnectHumanAgentCard?: boolean;\n\n /**\n * The timeout value is seconds to use when waiting for an agent to join the chat after an agent has been\n * requested. If no agent joins after this time, the chat will be ended and an error message will be displayed to\n * the user. By default, there is no timeout.\n */\n agentJoinTimeoutSeconds?: number;\n\n /**\n * Indicates if Carbon AI Chat should automatically attempt to reconnect the user to a human agent when it is loaded. This\n * only works if the service desk integration being used supports reconnecting. This value defaults to true.\n */\n allowReconnect?: boolean;\n}\n\n/**\n * Represents the different states for the availability of a human agent from a service desk.\n *\n * @category Service desk\n */\nexport enum HumanAgentsOnlineStatus {\n /**\n * Indicates that agents are online.\n */\n ONLINE = \"online\",\n\n /**\n * Indicates that no agents are online.\n */\n OFFLINE = \"offline\",\n\n /**\n * Indicates that it is unknown whether any agents are available. This may be because the service desk being used\n * doesn't support the ability to determine this information.\n */\n UNKNOWN = \"unknown\",\n}\n\n/**\n * The parameters that are passed to a service desk factory.\n *\n * @category Service desk\n */\nexport interface ServiceDeskFactoryParameters {\n /**\n * The callback used by the service desk to communicate with the widget.\n */\n callback: ServiceDeskCallback;\n\n /**\n * The instance of Carbon AI Chat.\n */\n instance: ChatInstance;\n\n /**\n * Any state that was stored for the service desk. This value may be undefined if no state has been stored.\n */\n persistedState: unknown;\n}\n\n/**\n * This interface represents the operations that a service desk integration can call on Carbon AI Chat when it wants web\n * chat to do something. When a service desk integration instance is created, Carbon AI Chat will provide an\n * implementation of this interface to the integration for it to use.\n *\n * @category Service desk\n */\nexport interface ServiceDeskCallback<TPersistedStateType = unknown> {\n /**\n * Updates Carbon AI Chat with the capabilities supported by the service desk. Some of these capabilities may support\n * being changed dynamically and can be updated at any time.\n *\n * @param capabilities The set of capabilities to update. Only properties that need to be changed need to be included.\n */\n updateCapabilities(capabilities: Partial<ServiceDeskCapabilities>): void;\n\n /**\n * Sends updated availability information to the chat widget for a user who is waiting to be connected to an\n * agent (e.g. the user is number 2 in line). This may be called at any point while waiting for the connection to\n * provide newer information.\n *\n * Note: Of the fields in the AgentAvailability object, only one of positionInQueue and estimatedWaitTime can be\n * rendered in the widget. If both fields are provided, estimatedWaitTime will take priority and the\n * positionInQueue field will be ignored.\n *\n * @param availability The availability information to display to the user.\n */\n updateAgentAvailability(availability: AgentAvailability): Promise<void>;\n\n /**\n * Informs the chat widget that an agent has joined the chat.\n */\n agentJoined(profile: ResponseUserProfile): Promise<void>;\n\n /**\n * Informs the chat widget that the agent has read all the messages that have been sent to the service desk.\n */\n agentReadMessages(): Promise<void>;\n\n /**\n * Tells the chat widget if an agent has started or stopped typing.\n *\n * @param isTyping If true, indicates that the agent is typing. False indicates the agent has stopped typing.\n */\n agentTyping(isTyping: boolean): Promise<void>;\n\n /**\n * Sends a message to the chat widget from an agent.\n *\n * Note: The text response type from the standard Watson API is supported in addition to the Carbon AI Chat specific\n * MessageResponseTypes.INLINE_ERROR response type.\n *\n * @param message The message to display to the user. Note, the ability to pass a string for the message was added in\n * Carbon AI Chat 6.7.0. Earlier versions of Carbon AI Chat will not work if you pass just a string.\n * @param agentID The ID of the agent who is sending the message. If this is not provided, then the ID of the last\n * agent who joined the conversation will be used.\n */\n sendMessageToUser(\n message: MessageResponse | string,\n agentID?: string,\n ): Promise<void>;\n\n /**\n * Informs the chat widget that a transfer to another agent is in progress. The agent profile information is\n * optional if the service desk doesn't have the information available. This message simply tells the chat widget\n * that the transfer has started. The service desk should inform the widget when the transfer is complete by\n * sending a {@link agentJoined} message later.\n */\n beginTransferToAnotherAgent(profile?: ResponseUserProfile): Promise<void>;\n\n /**\n * Informs the chat widget that the agent has left the conversation. This does not end the conversation itself,\n * rather the only action that occurs is the visitor receives the agent left status message. If the user sends\n * another message, it is up to the service desk to decide what to do with it.\n */\n agentLeftChat(): Promise<void>;\n\n /**\n * Informs the chat widget that the agent has ended the conversation.\n */\n agentEndedChat(): Promise<void>;\n\n /**\n * Sets the state of the given error type.\n *\n * @param errorInfo Details for the error whose state is being set.\n */\n setErrorStatus(errorInfo: ServiceDeskErrorInfo): Promise<void>;\n\n /**\n * Updates the status of a file upload. The upload may either be successful or an error may have occurred. The\n * location of a file upload may be in one of two places. The first occurs when the user has selected a file to be\n * uploaded but has not yet sent the file. In this case, the file appears inside the Carbon AI Chat input area. If an\n * error is indicated on the file, the error message will be displayed along with the file and the user must\n * remove the file from the input area before a message can be sent.\n *\n * The second occurs after the user has sent the file and the service desk has begun to upload the file. In this\n * case, the file no longer appears in the input area but appears as a sent message in the message list. If an\n * error occurs during this time, an icon will appear next to the message to indicate an error occurred and an\n * error message will be added to the message list.\n *\n * @param fileID The ID of the file upload to update.\n * @param isError Indicates that the upload has an error or failed to upload.\n * @param errorMessage An error message to display along with a file in error.\n */\n setFileUploadStatus(\n fileID: string,\n isError?: boolean,\n errorMessage?: string,\n ): Promise<void>;\n\n /**\n * Requests that the user share their screen with the agent. This will present a modal dialog to the user who must\n * respond before continuing the conversation. This method returns a Promise that resolves when the user has\n * responded to the request or the request times out.\n *\n * @returns Returns a Promise that will resolve with the state the of the request. This Promise will reject if no\n * chat with an agent is currently running.\n */\n screenShareRequest(): Promise<ScreenShareState>;\n\n /**\n * Informs Carbon AI Chat that a screen sharing session has ended or been cancelled. This may occur while waiting for a\n * screen sharing request to be accepted or while screen sharing is in progress.\n */\n screenShareEnded(): Promise<void>;\n\n /**\n * Returns the persisted agent state from the store. This is the current state as updated by\n * {@link updatePersistedState}. The object returned here is frozen and may not be modified.\n */\n persistedState(): TPersistedStateType;\n\n /**\n * Allows the service desk to store state that may be retrieved when Carbon AI Chat is reloaded on a page. This information\n * is stored in browser session storage which has a total limit of 5MB per origin so the storage should be used\n * sparingly. Also, the value provided here must be JSON serializable.\n *\n * When Carbon AI Chat is reloaded, the data provided here will be returned to the service desk via the\n * ServiceDeskFactoryParameters.persistedState property. This data may also be retrieved by using the\n * {@link persistedState} method.\n *\n * @param state The state to update.\n * @param mergeWithCurrent Indicates if the new state should be merged into the existing state. If false, then the\n * existing state will be fully replaced with the new state. Merging with existing state expects the state to be\n * an object. This argument is true by default.\n */\n updatePersistedState(\n state: DeepPartial<TPersistedStateType>,\n mergeWithCurrent?: boolean,\n ): void;\n}\n\n/**\n * The set of capabilities and parameters that are supported by the service desk.\n *\n * @category Service desk\n */\nexport type ServiceDeskCapabilities = FileUploadCapabilities;\n\n/**\n * The possible state changes for a screen sharing request.\n *\n * @category Service desk\n */\nexport enum ScreenShareState {\n /**\n * Indicates the screen sharing was accepted by the user.\n */\n ACCEPTED = \"accepted\",\n\n /**\n * Indicates the screen sharing was declined by the user.\n */\n DECLINED = \"declined\",\n\n /**\n * Indicates the screen sharing request was cancelled.\n */\n CANCELLED = \"cancelled\",\n\n /**\n * Indicates that screen sharing has ended.\n */\n ENDED = \"ended\",\n}\n\n/**\n * Information about the current availability of an agent while a user is waiting to be connected. If these are not set\n * the Carbon AI Chat will provide generic messaging letting the user know that a request for an agent has been sent.\n *\n * Note that only one of these fields will be used by Carbon AI Chat if more than one has been assigned a value. Priority\n * first goes to estimatedWaitTime, then positionInQueue, and then message.\n *\n * @category Service desk\n */\nexport interface AgentAvailability {\n /**\n * The current position of the user in a queue. E.g. \"You are number 2 in line.\"\n */\n positionInQueue?: number;\n\n /**\n * The estimated wait time for the user in minutes. E.g. \"Current wait time is 2 minutes.\"\n */\n estimatedWaitTime?: number;\n\n /**\n * A custom message to display to the user containing the updated status. This may contain markdown.\n */\n message?: string;\n}\n\n/**\n * The possible events that may have some form of error status.\n *\n * @category Service desk\n */\nexport enum ErrorType {\n /**\n * This error is meant to be displayed while the user is attempting to connect to a service desk and before an\n * agent has joined. If this error is generated by the service desk, it is expected that the service desk will\n * treat the chat as having ended (or never started).\n */\n CONNECTING = 1,\n\n /**\n * This is used to indicate the state of errors that can happen any time during a chat where the service desk\n * implementation has lost a connection to the back-end. If this error occurs while the user is waiting for an\n * agent to join, it will be treated as a {@link ErrorType.CONNECTING} error instead.\n */\n DISCONNECTED = 2,\n\n /**\n * This error is used to report when there was an error sending a message to the agent.\n */\n USER_MESSAGE = 3,\n}\n\n/**\n * This is the parent interface for the information passed to {@link ServiceDeskCallback#setErrorStatus}. It is used\n * as a discriminating union where the {@link #type} property is the discriminating value that determines which\n * child interface is to be used.\n *\n * @category Service desk\n */\ninterface BaseErrorInfo {\n /**\n * An optional value that will be logged to the console as an error.\n */\n logInfo?: unknown;\n}\n\n/**\n * This error is meant to be displayed while the user is attempting to connect to a service desk and before an\n * agent has joined. If this error is generated by the service desk, it is expected that the service desk will\n * treat the chat as having ended (or never started).\n *\n * @category Service desk\n */\nexport interface ConnectingErrorInfo extends BaseErrorInfo {\n /**\n * The discriminating value for this type.\n */\n type: ErrorType.CONNECTING;\n\n /**\n * An optional message that is displayed to the user in the assistant view. If this value is not provided, a default\n * message will be shown instead.\n *\n * Note that support for this field was added in Carbon AI Chat 6.7.0. It will be ignored in earlier versions.\n */\n messageToUser?: string;\n}\n\n/**\n * This is used to indicate the state of errors that can happen any time during a chat where the service desk\n * implementation has lost a connection to the back-end. If this error occurs while the user is waiting for an\n * agent to join, it will be treated as a {@link ErrorType.CONNECTING} error instead.\n *\n * @category Service desk\n */\nexport interface DisconnectedErrorInfo extends BaseErrorInfo {\n /**\n * The discriminating value for this type.\n */\n type: ErrorType.DISCONNECTED;\n\n /**\n * Indicates if the service desk has become disconnected. A value of true can be passed that will indicate that a\n * previous disconnection is over and the service desk is now connected again.\n */\n isDisconnected: boolean;\n}\n\n/**\n * This error is used to report when there was an error sending a message to the agent.\n *\n * @category Service desk\n */\nexport interface UserMessageErrorInfo extends BaseErrorInfo {\n /**\n * The discriminating value for this type.\n */\n type: ErrorType.USER_MESSAGE;\n\n /**\n * The ID of the message that is in error.\n */\n messageID: string;\n}\n\n/**\n * The type for the information passed to {@link ServiceDeskCallback#setErrorStatus}. It is a discriminating union\n * where the type property is the discriminating value that determines which child interface is to be used.\n *\n * @category Service desk\n */\nexport type ServiceDeskErrorInfo =\n | ConnectingErrorInfo\n | DisconnectedErrorInfo\n | UserMessageErrorInfo;\n\n/**\n * Additional options that may be passed to the service desk when a chat is started.\n *\n * @category Service desk\n */\nexport interface StartChatOptions<TPayloadType = unknown> {\n /**\n * Some arbitrary payload of data that was provided as part of the \"human_agent:pre:startChat\" event.\n */\n preStartChatPayload: TPayloadType;\n}\n\n/**\n * Additional info that may be provided when a chat is ended.\n *\n * @category Service desk\n */\nexport interface EndChatInfo<TPayloadType = unknown> {\n /**\n * Before a chat is ended, a {@link BusEventType.HUMAN_AGENT_PRE_END_CHAT} is fired. The payload value assigned to this\n * event by a listener is provided here.\n */\n preEndChatPayload: TPayloadType;\n\n /**\n * Indicates if the chat was ended by the agent (or by the service desk integration). If false, indicates the chat\n * was ended by the user or by Carbon AI Chat.\n */\n endedByHumanAgent: boolean;\n}\n\n/**\n * This is a set of additional data that may be included when the user sends a message to an agent.\n *\n * @category Service desk\n */\nexport interface AdditionalDataToAgent {\n /**\n * A set of files that user has selected to upload to an agent. This value may be undefined if there are no files\n * to upload.\n */\n filesToUpload?: FileUpload[];\n}\n\n/**\n * This is the public interface for a human agent service desk integration. This is the interface between the chat\n * widget and the implementation of the human agent interface with one of the various supported service desks.\n *\n * @category Service desk\n */\nexport interface ServiceDesk {\n /**\n * Returns a name for this service desk integration. This value should reflect the service desk that is being\n * integrated to (e.g. \"genesys web messenger\"). This information will be reported to IBM and may be used to gauge\n * interest in various service desks for the possibility of creating fully supported out-of-the-box implementations.\n *\n * This value is required for custom service desks and may have a maximum of 40 characters.\n */\n getName?: () => string;\n\n /**\n * Instructs the service desk to start a new chat. This will be called when a user requests to connect to an agent\n * and Carbon AI Chat initiates the process (typically when the user clicks the button on the \"Connect to Agent\" card).\n * It will make the appropriate calls to the service desk to start the chat and will make use of the callback to\n * inform Carbon AI Chat when an agent joins or messages are received.\n *\n * This may be called multiple times by Carbon AI Chat. If a user begins a chat with an agent, ends the chat and then\n * begins a new chat with an agent, this function will be called again.\n *\n * If the integration is unable to start a chat (such as if the service desk is down or no agents are available)\n * then this function should throw an error to let Carbon AI Chat know that the chat could not be started.\n *\n * The {@link areAnyAgentsOnline} function is called before this function is called and is called as soon as a\n * \"connect_to_agent\" message has been received from the assistant. This determines if the \"Connect to Agent\" card\n * should be displayed to the user or if the \"no agents are available\" message configured in the skill should be\n * shown instead.\n *\n * @param connectMessage The original server message response that caused the connection to an agent. It will\n * contain specific information to send to the service desk as part of the connection. This can include things\n * like a message to display to a human agent.\n * @param startChatOptions Additional configuration for startChat.\n * @returns Returns a Promise that resolves when the service desk has successfully started a new chat. This does\n * not necessarily mean that an agent has joined the conversation or has read any messages sent by the user.\n */\n startChat: (\n connectMessage: MessageResponse,\n startChatOptions: StartChatOptions,\n ) => Promise<void>;\n\n /**\n * Tells the service desk to terminate the chat.\n *\n * @param info Additional info that may be provided as part of ending the chat.\n * @returns Returns a Promise that resolves when the service desk has successfully handled the call.\n */\n endChat: (info: EndChatInfo<unknown>) => Promise<void>;\n\n /**\n * Sends a message to the agent in the service desk. Note that the message text may be empty if the user has\n * selected files to upload and has not chosen to include a message to go along with the files.\n *\n * @param message The message from the user.\n * @param messageID The unique ID of the message assigned by the widget.\n * @param additionalData Additional data to include in the message to the agent.\n * @returns Returns a Promise that resolves when the service desk has successfully handled the call.\n */\n sendMessageToAgent: (\n message: MessageRequest,\n messageID: string,\n additionalData: AdditionalDataToAgent,\n ) => Promise<void>;\n\n /**\n * Tells the service desk if a user has started or stopped typing.\n *\n * @param isTyping If true, indicates that the user is typing. False indicates the user has stopped typing.\n * @returns Returns a Promise that resolves when the service desk has successfully handled the call.\n * @since 5.1.1\n */\n userTyping?: (isTyping: boolean) => Promise<void>;\n\n /**\n * Informs the service desk that the user has read all the messages that have been sent by the service desk.\n *\n * @returns Returns a Promise that resolves when the service desk has successfully handled the call.\n */\n userReadMessages?: () => Promise<void>;\n\n /**\n * Checks if any agents are online and can connect to a user when they become available. This does not necessarily\n * mean that an agent is immediately available; when a chat is started, the user may still have to wait for an\n * agent to become available. The callback function {@link ServiceDeskCallback.updateAgentAvailability} is used to\n * give the user more up-to-date information while they are waiting for an agent to become available.\n *\n * @param connectMessage The message that contains the transfer_info object that may be used by the service desk,\n * so it can perform a more specific check.\n * @returns True if some agents are available or false if no agents are available. This may also return null which\n * means the availability status of agents is unknown or the service desk doesn't support this information.\n */\n areAnyAgentsOnline?: (\n connectMessage: MessageResponse,\n ) => Promise<boolean | null>;\n\n /**\n * Indicates that the user has selected some files to be uploaded but that the user has not yet chosen to send\n * them to the agent. This method can use this as an opportunity to perform any early validation of the files in\n * order to display an error to the user. It should not actually upload the files at this point. If the user\n * chooses to send the files to the agent, they will be included later when {@link ServiceDesk#sendMessageToAgent} is called.\n *\n * This method may be called multiple times before a user sends the files.\n *\n * If there are errors in the files, this method should use {@link ServiceDeskCallback#setFileUploadStatus} to update\n * the status with an error message. The user will not be able to upload any files until any files in error are\n * removed.\n */\n filesSelectedForUpload?: (uploads: FileUpload[]) => void;\n\n /**\n * Tells the service desk that the user has requested to stop sharing their screen.\n */\n screenShareStop?: () => Promise<void>;\n\n /**\n * This will be called when the service desk is first initialized and it is determined that the user was previously\n * connected to an agent. This function should perform whatever steps are necessary to reconnect the user. Web chat\n * will assume the user is permitted to send messages and is connected to the same agent when this function resolves.\n *\n * @returns true to indicate that the reconnect was successful.\n */\n reconnect?: () => Promise<boolean>;\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This file contains the generic types for the API between a general chat widget and a chat back-end. It is\n * intended to provide base types for a standalone widget and should not contain any imports of other types.\n */\n\nimport { DeepPartial } from \"../utilities/DeepPartial\";\nimport { MessageErrorState } from \"./LocalMessageItem\";\nimport { HumanAgentsOnlineStatus } from \"../config/ServiceDeskConfig\";\nimport { FileStatusValue } from \"../config/ServiceDeskConfig\";\nimport {\n BUTTON_KIND,\n BUTTON_SIZE,\n} from \"@carbon/web-components/es/components/button/defs.js\";\nimport {\n CHAT_BUTTON_KIND,\n CHAT_BUTTON_SIZE,\n} from \"@carbon/ai-chat-components/es/react/chat-button.js\";\nimport { ChainOfThoughtStepStatus } from \"@carbon/ai-chat-components/es/components/chain-of-thought/defs.js\";\n\n/**\n * This is the main interface that represents a request from a user sent to an assistant.\n *\n * @category Messaging\n */\ninterface MessageRequest<TInputType extends BaseMessageInput = MessageInput> {\n /**\n * The unique identifier for this request object. This value may be assigned by the client when a request is\n * made but should be assigned by the service if one is not provided.\n */\n id?: string;\n\n /**\n * The history information to store as part of this request. This includes extra information that was provided to\n * the user and about the user that was used in making the request.\n */\n history?: MessageRequestHistory;\n\n /**\n * Used to store private state information about the message.\n *\n * @internal\n */\n ui_state_internal?: MessageUIStateInternal;\n\n /**\n * The input data to the back-end to make in this request.\n */\n input: TInputType;\n\n /**\n * Optional context which is added from external resources.\n */\n context?: unknown;\n\n /**\n * The ID of the thread this request belongs to. This is here to prepare for input message editing and regenerating\n * responses.\n */\n thread_id?: string;\n}\n\n/**\n * The set of possible message input types in a request.\n *\n * @category Messaging\n */\nenum MessageInputType {\n /**\n * Represents a simple text message.\n */\n TEXT = \"text\",\n\n /**\n * Represents an event message that can be used to send control, updates, or action information to the back-end.\n */\n EVENT = \"event\",\n}\n\n/**\n * These are custom message types that are not part of the api but are generated by the widget for internal use.\n *\n * @category Messaging\n */\nenum InternalMessageRequestType {\n FILE = \"file\",\n}\n\n/**\n * @category Messaging\n */\ninterface BaseMessageInput {\n /**\n * The type of user input.\n */\n message_type?: MessageInputType;\n}\n\n/**\n * Base interface for an event message that can be used to send control, updates, or action information to the back-end.\n *\n * @category Messaging\n */\ninterface EventInput<\n TEventInputType = EventInputData,\n> extends BaseMessageInput {\n /**\n * Event messages have this as their input type.\n */\n message_type: MessageInputType.EVENT;\n\n /**\n * The type of the event.\n */\n event: TEventInputType;\n}\n\n/**\n * Input for an event. The name of the event is mandatory. Additional fields depend on the event.\n *\n * @template TNameType The type of the name property for the event. This can just be a string or it can be a\n * specific string in order to create type safety ensuring each event has the right name (e.g. \"typeof MY_EVENT_NAME\").\n *\n * @category Messaging\n */\ninterface EventInputData<TNameType extends string = string> {\n /**\n * The name of the event.\n */\n name: TNameType;\n}\n\n/**\n * The default interface for message input that is sent to an assistant in a message request. This represents basic text\n * input.\n *\n * @category Messaging\n */\ninterface MessageInput extends BaseMessageInput {\n /**\n * The text of the user input to send to the back-end.\n */\n text?: string;\n\n /**\n * For messages that are sent between the user and a human agent, we assign an agent type to the message to distinguish what type it is.\n */\n agent_message_type?: HumanAgentMessageType;\n}\n\n/**\n * This interface represents the main response content that is received by a client from an assistant. It is generally\n * in response to a previous message request.\n *\n * @category Messaging\n */\ninterface MessageResponse<TGenericType = GenericItem[]> {\n /**\n * A unique identifier for this response object.\n */\n id?: string;\n\n /**\n * The id of the request that this is the response of.\n */\n request_id?: string;\n\n /**\n * The output from the back-end to be rendered or processed by the client.\n */\n output: MessageOutput<TGenericType>;\n\n /**\n * The context information returned by the back-end.\n */\n context?: unknown;\n\n /**\n * The ID of the thread this request belongs to. This is here to prepare for input message editing and regenerating\n * responses.\n */\n thread_id?: string;\n\n /**\n * Used to store private state information about the message.\n *\n * @internal\n */\n ui_state_internal?: MessageUIStateInternal;\n\n /**\n * The history information to store as part of this request.\n */\n history?: MessageResponseHistory;\n\n /**\n * Options for the {@link MessageResponse}. This includes metadata about the user or assistant sending this response.\n */\n message_options?: MessageResponseOptions;\n}\n\n/**\n * The output context for a message response from an assistant.\n *\n * @category Messaging\n */\ninterface MessageOutput<TGenericType = GenericItem[]> {\n /**\n * Responses intended to be processed by a generic channel. This will be an array of message response items.\n */\n generic?: TGenericType;\n}\n\n/**\n * The set of possible message types in a response.\n *\n * @category Messaging\n */\nenum MessageResponseTypes {\n /**\n * Represents a basic text response. The given text may contain rich content such as markdown.\n */\n TEXT = \"text\",\n\n /**\n * A response that requests the user choose an option from a list. The list of options may be presented as a list\n * of buttons or it may be from a drop-down.\n */\n OPTION = \"option\",\n\n /**\n * Indicates that the conversation should be escalated to a human agent and offers that opportunity to the user.\n */\n CONNECT_TO_HUMAN_AGENT = \"connect_to_agent\",\n\n /**\n * Displays an image to the user.\n */\n IMAGE = \"image\",\n\n /**\n * Indicates that the chat should display a pause at this point in the conversation before displaying additional\n * items.\n */\n PAUSE = \"pause\",\n\n /**\n * A user defined response will be displayed according to custom logic in the client.\n */\n USER_DEFINED = \"user_defined\",\n\n /**\n * Displays the contents of an iframe to the user.\n */\n IFRAME = \"iframe\",\n\n /**\n * Displays a video to the user using a video player.\n */\n VIDEO = \"video\",\n\n /**\n * Displays an audio clip to the user using an audio player.\n */\n AUDIO = \"audio\",\n\n /**\n * Asks the user to provide a date. This may result in a date picker being presented to the user.\n */\n DATE = \"date\",\n\n /**\n * Displays a general error message to the user and include developer info to be logged and to debug.\n */\n INLINE_ERROR = \"inline_error\",\n\n /**\n * Displays a card that can contain other response types.\n */\n CARD = \"card\",\n\n /**\n * Displays a carousel of cards that can contain other response types.\n */\n CAROUSEL = \"carousel\",\n\n /**\n * Displays a button that can either send a message back to the backend, open a url, or throw a client side event.\n */\n BUTTON = \"button\",\n\n /**\n * Ability to layout response types inside a grid.\n */\n GRID = \"grid\",\n\n /**\n * Ability to show citations on your RAG result.\n */\n CONVERSATIONAL_SEARCH = \"conversational_search\",\n\n /**\n * Displays a preview card that can take the user flow to a workspace view.\n */\n PREVIEW_CARD = \"preview_card\",\n}\n\n/**\n * These are the human agent specific message types.\n *\n * @category Service desk\n */\nexport enum HumanAgentMessageType {\n /**\n * There was an error in a message.\n */\n INLINE_ERROR = \"inline_error\",\n\n /**\n * The agent sent a message.\n */\n FROM_HUMAN_AGENT = \"from_agent\",\n\n /**\n * The user sent a message.\n */\n FROM_USER = \"from_user\",\n\n /**\n * The agent left the chat.\n */\n HUMAN_AGENT_LEFT_CHAT = \"agent_left_chat\",\n\n /**\n * The agent ended the conversation.\n */\n HUMAN_AGENT_ENDED_CHAT = \"agent_ended_chat\",\n\n /**\n * The agent joined the conversation.\n */\n HUMAN_AGENT_JOINED = \"agent_joined\",\n\n /**\n * A disconnection warning was emitted.\n */\n RELOAD_WARNING = \"user_connected_warning\",\n\n /**\n * The conversation was transferred to another agent.\n */\n TRANSFER_TO_HUMAN_AGENT = \"transfer_to_agent\",\n\n /**\n * The end user ended the conversation with the agent.\n */\n USER_ENDED_CHAT = \"user_ended_chat\",\n\n /**\n * The conversation was ended.\n */\n CHAT_WAS_ENDED = \"chat_was_ended\",\n\n /**\n * The conversation was disconnected.\n */\n DISCONNECTED = \"disconnected\",\n\n /**\n * The conversation was re-connected.\n */\n RECONNECTED = \"reconnected\",\n\n /**\n * Screen sharing requested.\n */\n SHARING_REQUESTED = \"sharing_requested\",\n\n /**\n * Screen sharing accepted.\n */\n SHARING_ACCEPTED = \"sharing_accepted\",\n\n /**\n * Screen sharing declined.\n */\n SHARING_DECLINED = \"sharing_declined\",\n\n /**\n * Screen sharing cancelled.\n */\n SHARING_CANCELLED = \"sharing_cancelled\",\n\n /**\n * Screen sharing ended.\n */\n SHARING_ENDED = \"sharing_ended\",\n\n /**\n * A system message.\n */\n SYSTEM = \"system\",\n}\n\n/**\n * A general type to indicate any message.\n *\n * @category Messaging\n */\nexport type Message =\n | MessageRequest<MessageInput>\n | MessageRequest<EventInput>\n | MessageResponse;\n\n/**\n * @category Messaging\n */\nexport interface ItemStreamingMetadata {\n /**\n * An identifier for this item within the full message response. This ID is used to correlate a partial or\n * complete item chunk with other chunks that represent the same item. This ID is only unique for a given message\n * response.\n */\n id: string;\n\n /**\n * When included on a partial_item, indicates if the stream can be cancelled.\n * If so, a \"stop streaming\" button will display in the UI.\n */\n cancellable?: boolean;\n\n /**\n * Indicates if the stream has stopped which will trigger the UI to respond with appropriate a11y states\n * and messaging.\n */\n stream_stopped?: boolean;\n}\n\n/**\n * Status of the chain of thought step.\n *\n * @category Messaging\n */\nexport { ChainOfThoughtStepStatus };\n\n/**\n * A chain of thought step is meant to show tool calls and other steps made by your agent\n * to reach its final answer.\n *\n * @category Messaging\n */\nexport interface ChainOfThoughtStep {\n /**\n * The plain text name of the step.\n */\n title?: string;\n\n /**\n * An optional human readable description of what the tool does.\n *\n * Accepts markdown formatted text.\n */\n description?: string;\n\n /**\n * The plain text name of the tool called.\n */\n tool_name?: string;\n\n /**\n * Optional request metadata sent to a tool.\n */\n request?: {\n /**\n * Arguments sent to the tool. If this is properly formed JSON, it will be shown as a code block.\n */\n args?: unknown;\n };\n\n /**\n * Optional response from a tool.\n */\n response?: {\n /**\n * Content returned by the tool. If this is properly formed JSON, it will be shown as a code block.\n *\n * You can also return markdown compatible text here.\n */\n content: unknown;\n };\n\n /**\n * Optionally, share the status of this step. An icon will appear in the view showing the status. If no status is\n * shared, the UI will assume success.\n */\n status?: ChainOfThoughtStepStatus;\n}\n\n/**\n * Options that control additional features available for a message item.\n *\n * @category Messaging\n */\nexport interface GenericItemMessageOptions {\n /**\n * Controls the display of feedback options (thumbs up/down) for a message item.\n */\n feedback?: GenericItemMessageFeedbackOptions;\n}\n\n/**\n * If you want to have different categories for positive and negative feedback, you can provide two different arrays.\n *\n * You may not provide one of the arrays. e.g. you want negative categories but don't care about positive categories.\n *\n * @category Messaging\n */\nexport interface GenericItemMessageFeedbackCategories {\n /**\n * List of strings for positive feedback categories.\n */\n positive?: string[];\n\n /**\n * List of strings for negative feedback categories.\n */\n negative?: string[];\n}\n\n/**\n * Controls the display of a feedback options (thumbs up/down) for a message item.\n *\n * @category Messaging\n */\nexport interface GenericItemMessageFeedbackOptions {\n /**\n * Indicates if a request for feedback should be displayed.\n */\n is_on?: boolean;\n\n /**\n * A unique identifier for this feedback. This is required for the feedback to be recorded in message history.\n */\n id?: string;\n\n /**\n * Indicates if the user should be asked for additional detailed information when providing positive feedback. This\n * defaults to true.\n */\n show_positive_details?: boolean;\n\n /**\n * Indicates if the user should be asked for additional detailed information when providing negative feedback. This\n * defaults to true.\n */\n show_negative_details?: boolean;\n\n /**\n * Indicates whether the text area should be shown. This defaults to true.\n */\n show_text_area?: boolean;\n\n /**\n * Indicates whether the prompt line should be shown. This defaults to true.\n */\n show_prompt?: boolean;\n\n /**\n * The title to display in the popup. A default value will be used if no value is provided here.\n */\n title?: string;\n\n /**\n * The prompt text to display to the user. A default value will be used if no value is provided here.\n */\n prompt?: string;\n\n /**\n * An optional set of categories to allow the user to choose from. This can either be an array of strings for\n * both positive and negative feedback or a {@link GenericItemMessageFeedbackCategories} object to make different\n * configuration for both.\n */\n categories?: string[] | GenericItemMessageFeedbackCategories;\n\n /**\n * The placeholder to show in the text area. A default value will be used if no value is provided here.\n */\n placeholder?: string;\n\n /**\n * The legal disclaimer text to show at the bottom of the popup. This text may contain rich markdown content. If this\n * value is not provided, no text will be shown.\n */\n disclaimer?: string;\n}\n\n/**\n * @category Messaging\n */\nexport type PanelItem<TUserDefinedType = Record<string, unknown>> =\n BaseGenericItem<TUserDefinedType> & MessageItemPanelInfo;\n\n/**\n * @category Messaging\n */\nexport type PartialOrCompleteItemChunk = PartialItemChunk | CompleteItemChunk;\n\n/**\n * The base interface that all message response items must implement. Contains common properties\n * shared by all item types.\n *\n * @category Messaging\n */\ninterface BaseGenericItem<TUserDefinedType = Record<string, unknown>> {\n /**\n * The response type of this message item.\n */\n response_type: MessageResponseTypes;\n\n /**\n * Metadata used to identify a generic item within the context of a stream in order to correlate any updates meant\n * for a specific item.\n */\n streaming_metadata?: ItemStreamingMetadata;\n\n /**\n * An optional buckets of additional user defined properties for this item.\n */\n user_defined?: TUserDefinedType;\n\n /**\n * For messages that are sent between the user and a human agent, we assign an agent type to the message to distinguish what type it is.\n */\n agent_message_type?: HumanAgentMessageType;\n\n /**\n * Options that control additional features available for a message item.\n */\n message_item_options?: GenericItemMessageOptions;\n}\n\n/**\n * The basic class for items returned from an assistant as part of a message response. These are the items contained\n * in the {@link MessageOutput.generic} array.\n *\n * @category Messaging\n */\ntype GenericItem<TUserDefinedType = Record<string, unknown>> =\n | TextItem<TUserDefinedType>\n | OptionItem<TUserDefinedType>\n | ConnectToHumanAgentItem<TUserDefinedType>\n | ImageItem<TUserDefinedType>\n | PauseItem<TUserDefinedType>\n | UserDefinedItem<TUserDefinedType>\n | IFrameItem<TUserDefinedType>\n | VideoItem<TUserDefinedType>\n | AudioItem<TUserDefinedType>\n | DateItem<TUserDefinedType>\n | InlineErrorItem<TUserDefinedType>\n | CardItem<TUserDefinedType>\n | CarouselItem<TUserDefinedType>\n | ButtonItem<TUserDefinedType>\n | GridItem<TUserDefinedType>\n | ConversationalSearchItem<TUserDefinedType>\n | PreviewCardItem<TUserDefinedType>;\n\n/**\n * A user defined item returned in a message response from an assistant.\n *\n * @category Messaging\n */\ninterface UserDefinedItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * If the user_defined response type should be rendered as full width and ignore margin on the \"start\".\n */\n full_width?: boolean;\n}\n\n/**\n * This message item represents a preview card that can trigger a workflow view.\n *\n * @category Messaging\n */\ninterface PreviewCardItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * The title of the preview card.\n */\n title?: string;\n\n /**\n * The subtitle of the preview card.\n */\n subtitle?: string;\n\n /**\n * Additional data to be passed to workspace.\n */\n additional_data?: any;\n}\n\n/**\n * A text item returned in a message response from an assistant.\n *\n * The Carbon AI Chat supports basic styling inside text responses to match the theme of your Carbon AI Chat,\n * both with Markdown or HTML content returned from your assistant. Using Markdown and `user_defined`\n * ({@link UserDefinedItem}) responses instead of HTML in your text responses is the recommendation. It allows\n * adding channels that do not support HTML (such as Facebook, Slack, or WhatsApp) without having to rewrite\n * your content.\n *\n * ## Markdown\n *\n * The Carbon AI Chat supports the following Markdown syntax in the text response type:\n *\n * **Text formatting:**\n *\n * - `**bold text**` or `__bold text__`\n * - `*italic text*` or `_italic text_`\n * - `~~strikethrough~~`\n * - `==highlighted text==`\n * - `^superscript^`\n * - `~subscript~`\n *\n * **Code:**\n *\n * - `` `inline code` `` or fenced code blocks with syntax highlighting.\n *\n * **Headers:**\n *\n * - `# H1`, `## H2`, `### H3`, `#### H4`, `##### H5`, `###### H6`\n *\n * **Lists:**\n *\n * - Unordered lists using `*`, `+`, or `-`\n * - Ordered lists using `1.`, `2.`, etc.\n * - Nested lists are supported\n *\n * **Links and images:**\n *\n * - `[link text](URL)` for links (opens in new tab by default)\n * - `![alt text](image URL)` for images\n *\n * **Other elements:**\n *\n * - `> blockquote text` for blockquotes\n * - Tables using pipe syntax with automatic pagination and sorting\n * - Horizontal rules using `---` or `***`\n * - Line breaks are preserved (breaks: true)\n * - Automatic URL detection and conversion to links\n *\n * **Attributes:**\n *\n * - Custom attributes using `{{class=\"my-class\" id=\"my-id\"}}` syntax\n * - Supported attributes: `target`, `rel`, `class`, `id`\n *\n * **HTML support:**\n *\n * - Raw HTML is supported when enabled\n * - Custom elements and web components are allowed\n * - Content is sanitized for security when sanitization is enabled\n *\n * The Carbon AI Chat follows CommonMark rules with these extensions and enhancements.\n *\n * ## HTML content\n *\n * If you include HTML (including `style` and `script` tags) in your text response from your assistant, the\n * Carbon AI Chat renders those elements as provided, unless you set {@link PublicConfig.shouldSanitizeHTML}\n * to `true`. A better approach is to use a `user_defined` response instead of adding HTML directly to your\n * responses to make adding support for channels that do not support HTML easier.\n *\n * @category Messaging\n */\ninterface TextItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * The text of the response.\n */\n text?: string;\n}\n\n/**\n * A \"connect to agent\" item returned in a message response from an assistant. This is used when the back-end\n * indicates that a user's conversation should be escalated to a human agent.\n *\n * @category Messaging\n */\ninterface ConnectToHumanAgentItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * A message to be sent to the human agent who will be taking over the conversation.\n */\n message_to_human_agent?: string;\n\n /**\n * Contains the message to be rendered if there are agents available.\n */\n agent_available?: {\n message: string;\n };\n\n /**\n * Contains the message to be rendered if there are no agents available.\n */\n agent_unavailable?: {\n message: string;\n };\n\n /**\n * When a conversation is escalated to an agent additional information is needed to fulfill the request. This\n * additional information typically is added by the channel integration and cannot be deduced from the dialog\n * itself.\n */\n transfer_info?: ConnectToHumanAgentItemTransferInfo;\n}\n\n/**\n * Additional information as part of a {@link ConnectToHumanAgentItem} that may be needed to perform a transfer to an agent.\n *\n * @category Messaging\n */\ninterface ConnectToHumanAgentItemTransferInfo {\n /**\n * Each service desk may require different information to start the connection. It can be account details or\n * security information. This is a bucket of all the service desk specific properties.\n */\n additional_data?: {\n [key: string]: string;\n };\n\n /**\n * An initial set of message items to send to the agent.\n */\n summary_message_to_agent?: TextItem[];\n}\n\n/**\n * A pause item returned in a message response from an assistant. This indicates that the client should pause before\n * displaying additional response items.\n *\n * @category Messaging\n */\ninterface PauseItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * How long to pause, in milliseconds.\n */\n time?: number;\n\n /**\n * Whether to display an \"is typing\" indicator during the pause.\n */\n typing?: boolean;\n}\n\n/**\n * An option item returned in a message response from an assistant. This response type is used when displaying a list\n * of options to the user. How the options are displayed is up to the client but is often displayed in either a\n * drop-down or as a list of buttons.\n *\n * @category Messaging\n */\ninterface OptionItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * An array of objects describing the options from which the user can choose.\n */\n options: SingleOption[];\n\n /**\n * An optional title to be shown alongside the options.\n */\n title?: string;\n\n /**\n * An optional description to be shown alongside the options.\n */\n description?: string;\n\n /**\n * The preferred type of control to display (e.g. button or dropdown).\n */\n preference?: OptionItemPreference;\n}\n\n/**\n * The set of possible response preferences for an options response.\n *\n * @category Messaging\n */\nenum OptionItemPreference {\n /**\n * Indicates the options should be displayed as a drop-down.\n */\n DROPDOWN = \"dropdown\",\n\n /**\n * Indicates the options should be displayed as buttons.\n */\n BUTTON = \"button\",\n}\n\n/**\n * Represents an individual option that is part of an \"options\" response.\n *\n * @category Messaging\n */\ninterface SingleOption {\n /**\n * The user-facing label for the option or disambiguation suggestion. This label is taken from the user_label property\n * of the corresponding dialog node.\n */\n label: string;\n\n value: {\n /**\n * An input object that should be sent back to the assistant when this option is chosen by a user.\n */\n input: MessageInput;\n };\n}\n\n/**\n * @category Messaging\n */\ninterface IFrameItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * The source URL to an embeddable page\n */\n source: string;\n\n /**\n * The preview image of the source URL. This property is unfurled from the source URL at runtime. It is used when\n * IFrameItemDisplayOption is set to 'panel' for the preview card to open the panel.\n */\n image_url?: string;\n\n /**\n * The title of the source URL. This property is unfurled from the source URL at runtime. It is used when\n * IFrameItemDisplayOption is set to 'panel' for the preview card to open the panel.\n */\n title?: string;\n\n /**\n * The description of the source URL. This property is unfurled from the source URL at runtime. It is used when\n * IFrameItemDisplayOption is set to 'panel' for the preview card to open the panel.\n */\n description?: string;\n\n /**\n * How the iframe should be displayed.\n */\n display?: IFrameItemDisplayOption;\n}\n\n/**\n * Dimension information for displaying a media item.\n *\n * @category Messaging\n */\ninterface MediaItemDimensions {\n /**\n * This property's value is used to calculate a responsive height for Carbon AI Chat's media player so that its aspect\n * ratio is the same between different screen widths. This is set to a reasonable default depending on the response type\n * and other details like what service you are pulling the content from (e.g. Youtube or SoundCloud).\n */\n base_height?: number;\n}\n\n/**\n * Represents a single subtitle/caption track for video content.\n * Uses WebVTT format for accessibility. Rendered as native HTML5 track elements.\n *\n * @category Messaging\n */\ninterface MediaSubtitleTrack {\n /**\n * URL pointing to the WebVTT subtitle file.\n */\n src: string;\n\n /**\n * The language code (e.g., \"en\", \"es\", \"fr\").\n * Used for the track's srclang attribute.\n */\n language: string;\n\n /**\n * Human-readable label for the track (e.g., \"English\", \"Spanish\").\n * Displayed in the browser's subtitle menu.\n */\n label: string;\n\n /**\n * The kind of text track.\n * - \"subtitles\": Translation of dialogue (default)\n * - \"captions\": Transcription including sound effects\n * - \"descriptions\": Audio descriptions for visually impaired\n */\n kind?: \"subtitles\" | \"captions\" | \"descriptions\";\n\n /**\n * Whether this track should be enabled by default.\n * Only one track should be default.\n */\n default?: boolean;\n}\n\n/**\n * Represents a text transcript for audio content.\n * Displayed as readable text below the audio player for accessibility.\n *\n * @category Messaging\n */\ninterface MediaTranscript {\n /**\n * Full text transcript of the audio content.\n * Supports markdown for formatting.\n */\n text: string;\n\n /**\n * Language of the transcript (e.g., \"en\", \"es\", \"fr\").\n */\n language?: string;\n\n /**\n * Optional label for the transcript (e.g., \"English Transcript\").\n */\n label?: string;\n}\n\n/**\n * Accessibility features for raw media files (not embedded platforms).\n * These features only apply when using direct file URLs (e.g., .mp4, .mp3).\n *\n * For embedded platforms (YouTube, Vimeo, SoundCloud, Mixcloud, etc.),\n * rely on the platform's built-in accessibility features instead.\n *\n * @category Messaging\n */\ninterface MediaFileAccessibility {\n /**\n * Subtitle/caption tracks for video files.\n * Supports WebVTT format rendered as native HTML5 track elements.\n */\n subtitle_tracks?: MediaSubtitleTrack[];\n\n /**\n * Text transcript for audio files.\n * Displayed as expandable text below the audio player.\n */\n transcript?: MediaTranscript;\n}\n\n/**\n * The different ways an iframe item may be displayed.\n *\n * @category Messaging\n */\nenum IFrameItemDisplayOption {\n /**\n * The iframe is displayed inline in the main message list.\n */\n INLINE = \"inline\",\n\n /**\n * The iframe is displayed in a separate panel after showing a card in the main message list.\n */\n PANEL = \"panel\",\n}\n\n/**\n * A reusable media object that may need to display a title and description with an alt_text to label the item for\n * accessibility purposes. This is used by the Audio, Video and Image response types.\n *\n * @category Messaging\n */\ninterface MediaItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * The url pointing to a media source, whether audio, video, or image.\n *\n * For video this can be a file like an .mp4 or a YouTube, Facebook, Vimeo, Twitch, Streamable, Wistia, or Vidyard url.\n *\n * For audio this can be a file like an .mp3 or a SoundCloud or Mixcloud url.\n */\n source: string;\n\n /**\n * The title for the item.\n */\n title?: string;\n\n /**\n * The description for the item.\n */\n description?: string;\n\n /**\n * The alt text for labeling the item. Screen readers will announce this text when the user's virtual cursor\n * is focused on the item.\n */\n alt_text?: string;\n\n /**\n * Settings that control the dimensions for the media item.\n */\n dimensions?: MediaItemDimensions;\n\n /**\n * Accessibility features for raw media files.\n * Only applies to direct file URLs (e.g., .mp4, .mp3), not embedded platforms.\n */\n file_accessibility?: MediaFileAccessibility;\n}\n\n/**\n * Citations for text generated by an AI to provide the user with relevant source information and context.\n *\n * @category Messaging\n */\ninterface ConversationalSearchItemCitation {\n /**\n * Optional url of the citation. May not be a valid URL.\n */\n url?: string;\n\n /**\n * Optional explanation text for the citation.\n */\n text?: string;\n\n /**\n * Optional title of the citation URL.\n */\n title?: string;\n\n /**\n * Optional array of ranges indicating where in `text` the citation is located.\n */\n ranges?: {\n start: number;\n end: number;\n }[];\n\n /**\n * In some implementations, the content searched isn't in an accessible URL. For instance, it could be from Milvus or\n * ElasticSearch. In that scenario, you may populate \"search_results\". This field will allow you define which index in\n * the search_results array matches with this citation. The end user can then drill into the larger search result to\n * view it rather than clicking on a URL to actually see the content.\n */\n search_result_idx?: number;\n}\n\n/**\n * A text response generated by AI with an optional list of citations for where the information came from.\n *\n * @category Messaging\n */\ninterface ConversationalSearchItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * The returned conversational text. Any HTML/Markdown will be ignored.\n */\n text: string;\n\n /**\n * Citations are used to connect specific text within a conversational search response with the relevant documents\n * returned by the backend.\n */\n citations?: ConversationalSearchItemCitation[];\n\n /**\n * In some implementations, the content searched isn't in an accessible URL. For instance, it could be from Milvus or\n * ElasticSearch. In that scenario, you may populate \"search_results\". Combine this with\n * {@link ConversationalSearchItemCitation.search_result_idx}.\n */\n search_results?: SearchResult[];\n}\n\n/**\n * An inline error response generated by a conversational skill provider with a user-friendly text and developer debug info.\n *\n * @category Messaging\n */\ninterface InlineErrorItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * Some end user friendly text describing the error and what they should do next.\n *\n * If no specific text is passed, the client is responsible for fallback generic error message text.\n */\n text?: string;\n\n /**\n * Relevant debug info intended to be passed on to developers.\n *\n * This information should not include anything sensitive that might reveal details about our back-end environment that should not be public.\n */\n debug?: {\n /**\n * The error code of any underlying error, despite the service returning 200.\n */\n statusCode?: number;\n\n /**\n * Developer-friendly error text.\n */\n text?: string;\n\n /**\n * Any additional key-value pairs for debugging.\n */\n info?: Record<string, unknown>;\n };\n}\n\n/**\n * The image response type definition. This is currently the same as {@link MediaItem}.\n *\n * @category Messaging\n */\ntype ImageItem<TUserDefinedType = Record<string, unknown>> =\n MediaItem<TUserDefinedType>;\n\n/**\n * The video response type definition for future reuse. This is currently the same as {@link MediaItem}.\n *\n * @category Messaging\n */\ntype VideoItem<TUserDefinedType = Record<string, unknown>> =\n MediaItem<TUserDefinedType>;\n\n/**\n * The audio response type definition for future reuse. This is currently the same as {@link MediaItem}.\n *\n * @category Messaging\n */\ntype AudioItem<TUserDefinedType = Record<string, unknown>> =\n MediaItem<TUserDefinedType>;\n\n/**\n * @category Messaging\n */\nenum ButtonItemType {\n /**\n * A button that sends its value back to the backend.\n */\n POST_BACK = \"post_back\",\n\n /**\n * A button that throws an event for your UI to respond to.\n */\n CUSTOM_EVENT = \"custom_event\",\n\n /**\n * A button that shows a panel.\n */\n SHOW_PANEL = \"show_panel\",\n\n /**\n * A button that opens a URL.\n */\n URL = \"url\",\n}\n\n/**\n * @category Messaging\n */\nenum WidthOptions {\n /**\n * Width the size of the floating chat for smaller content.\n */\n SMALL = \"small\",\n\n /**\n * Max width of 438px, 2/3rd of the width of chat in fullscreen view with hasContentMaxWidth: true.\n */\n MEDIUM = \"medium\",\n\n /**\n * Max width of 585px, the full with of chat in fullscreen view with hasContentMaxWidth: true.\n */\n LARGE = \"large\",\n}\n\n/**\n * @category Messaging\n */\ninterface WithWidthOptions {\n /**\n * Sets an optional max width of the component. Options are small, medium and large.\n * By default, the component will be 100% width of the container.\n */\n max_width?: WidthOptions;\n}\n\n/**\n * @category Messaging\n */\ninterface WithBodyAndFooter {\n /**\n * A list of message items to render in a Carbon AI Chat panel.\n */\n body?: GenericItem[];\n\n /**\n * A list of button items that are rendered under the panel body.\n */\n footer?: ButtonItem[];\n}\n\n/**\n * @category Messaging\n */\ninterface MessageItemPanelInfo extends WithBodyAndFooter {\n /**\n * The title to give the panel in Carbon AI Chat.\n */\n title?: string;\n\n /**\n * Determines if the panel header should not be visible or not.\n */\n show_header?: boolean;\n\n /**\n * Determines if the panel close and open animations should be enabled or not.\n */\n show_animations?: boolean;\n}\n\n/**\n * @category Messaging\n */\nenum ButtonItemKind {\n /**\n * Default Carbon button.\n */\n DEFAULT = \"default\",\n\n /**\n * Secondary Carbon button.\n */\n SECONDARY = \"secondary\",\n\n /**\n * Tertiary Carbon button.\n */\n TERTIARY = \"tertiary\",\n\n /**\n * Danger Carbon button.\n */\n DANGER = \"danger\",\n\n /**\n * Ghost Carbon button.\n */\n GHOST = \"ghost\",\n\n /**\n * Button displayed like a link.\n */\n LINK = \"link\",\n}\n\n/**\n * This message item represents a button that can perform various actions such as sending messages, opening URLs, or showing panels.\n *\n * @category Messaging\n */\ninterface ButtonItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n /**\n * The style of button to display.\n */\n kind?: BUTTON_KIND | CHAT_BUTTON_KIND | \"LINK\";\n\n /**\n * The button size.\n */\n size?: BUTTON_SIZE | CHAT_BUTTON_SIZE;\n\n /**\n * Whether the button should be rendered as a standard carbon button.\n *\n * @internal\n */\n is?: \"standard-button\";\n\n /**\n * The type of button.\n */\n button_type: ButtonItemType;\n\n /**\n * The URL for the user to visit when the button is clicked.\n */\n url?: string;\n\n /**\n * Where to open the link. The default value is _self.\n */\n target?: string;\n\n /**\n * The display text for the link.\n */\n label?: string;\n\n /**\n * A custom event that can be listened to by Carbon AI Chat when the button item is clicked.\n */\n custom_event_name?: string;\n\n value?: {\n /**\n * An input object that should be sent back to the assistant when this option is chosen by a user.\n */\n input: MessageInput;\n };\n\n /**\n * The panel options to display in a panel when the \"show_panel\" button type is clicked.\n */\n panel?: MessageItemPanelInfo;\n\n /**\n * The URL pointing to an image.\n */\n image_url?: string;\n\n /**\n * The alt text for labeling the item. Screen readers will announce this text when the user's virtual cursor\n * is focused on the item.\n */\n alt_text?: string;\n}\n\n/**\n * @category Messaging\n */\ntype CardItem<TUserDefinedType = Record<string, unknown>> =\n BaseGenericItem<TUserDefinedType> & WithBodyAndFooter & WithWidthOptions;\n\n/**\n * @category Messaging\n */\ninterface CarouselItem<\n TUserDefinedType = Record<string, unknown>,\n> extends BaseGenericItem<TUserDefinedType> {\n items: GenericItem[];\n}\n\n/**\n * Horizontal alignment values for items in a grid response.\n *\n * @category Messaging\n */\ntype HorizontalCellAlignment = \"left\" | \"center\" | \"right\";\n\n/**\n * Vertical alignment values for items in a grid response.\n *\n * @category Messaging\n */\ntype VerticalCellAlignment = \"top\" | \"center\" | \"bottom\";\n\n/**\n * @category Messaging\n */\ninterface GridItem<TUserDefinedType = Record<string, unknown>>\n extends BaseGenericItem<TUserDefinedType>, WithWidthOptions {\n /**\n * Determines the horizontal alignment of all items in the grid.\n */\n horizontal_alignment?: HorizontalCellAlignment;\n\n /**\n * Determines the vertical alignment of all items in the grid.\n */\n vertical_alignment?: VerticalCellAlignment;\n\n /**\n * The list of column specifications. This will determine the maximum number of columns that can be rendered.\n */\n columns: {\n width: string;\n }[];\n\n /**\n * A list of rows to render.\n */\n rows: {\n /**\n * A list of cells to render in a row.\n */\n cells: {\n /**\n * Determines the horizontal alignment of items in the individual cell.\n */\n horizontal_alignment?: HorizontalCellAlignment;\n\n /**\n * Determines the vertical alignment of items in the individual cell.\n */\n vertical_alignment?: VerticalCellAlignment;\n\n /**\n * Message items to render in the cell.\n */\n items: GenericItem[];\n }[];\n }[];\n}\n\n/**\n * This is the response item that represents a request for a date which should prompt the client to use a date picker or\n * similar control to provide a date. There are currently no additional properties of the response.\n *\n * @category Messaging\n */\ntype DateItem<TUserDefinedType = Record<string, unknown>> =\n BaseGenericItem<TUserDefinedType>;\n\n/**\n * @category Messaging\n */\ninterface Chunk {\n /**\n * Additional metadata associated with the stream.\n */\n streaming_metadata?: {\n /**\n * The ID of the complete message response object. This ID will be the ID of the full message that is received\n * in the final chunk of the stream.\n */\n response_id: string;\n };\n}\n\n/**\n *\n * @category Messaging\n * @internal\n */\ninterface MessageUIStateInternal {\n /**\n * @internal\n * Indicates if this message was loaded from history or if it's a new message created in the current browser\n * page.\n */\n from_history?: boolean;\n\n /**\n * @internal\n * The state of a connect to agent card when it's initially displayed. Used by session history on reload to make\n * sure the initial state is persisted. This property can apply to all CTA responses in the message should there\n * happen to be more than one. When this property is null it means a check was performed but it got no answer.\n */\n agent_availability?: HumanAgentsOnlineStatus;\n\n /**\n * @internal\n * This is used by the connect to agent message. It indicates that no service desk was configured when the connect\n * to agent response was received by the client.\n */\n agent_no_service_desk?: boolean;\n}\n\n/**\n * If the reasoning step is open, closed, or is controlled by Carbon AI Chat.\n *\n * If a user elects to open/close the user action will override what is provided here.\n *\n * @category Messaging\n */\nenum ReasoningStepOpenState {\n OPEN = \"open\",\n CLOSE = \"close\",\n DEFAULT = \"default\",\n}\n\n/**\n * An individual reasoning step.\n *\n * @category Messaging\n */\ninterface ReasoningStep {\n /**\n * The title of the reasoning step.\n */\n title: string;\n\n /**\n * Marks if this individual step is open. Only use this if you don't want the default behavior.\n *\n * If the step has content, by default the reasoning step will automatically open and will close when the\n * next step(s) have content or the first {@link GenericItem} is returned with something to display.\n *\n * No matter what you choose, if the user manually marks something open/closed they retain control.\n */\n open_state?: ReasoningStepOpenState;\n\n /**\n * Optional markdown content to explain what the step is doing.\n */\n content?: string;\n}\n\n/**\n * The interface describing how to pass reasoning steps to the UI.\n *\n * @category Messaging\n */\ninterface ReasoningSteps {\n /**\n * Marks if the reasoning step interface is open. Only use this if you don't want the default behavior.\n *\n * By default the reasoning step interface will automatically open and will then close when the first\n * {@link GenericItem} is returned with something to display.\n *\n * No matter what you choose, if the user manually marks something open/closed they retain control.\n */\n open_state?: ReasoningStepOpenState;\n\n /**\n * The array of reasoning steps for this message.\n */\n steps?: ReasoningStep[];\n\n /**\n * Optional markdown content to explain what the step is doing.\n */\n content?: string;\n}\n\n/**\n * This interface contains options for a {@link MessageResponse}.\n *\n * @category Messaging\n */\ninterface MessageResponseOptions {\n /**\n * This is the profile for the human or assistant who sent or triggered this message.\n */\n response_user_profile?: ResponseUserProfile;\n\n /**\n * Controls the display of the reasoning steps component.\n *\n * Most people should use reasoning steps instead of chain of thought.\n *\n * Chain of thought it meant more for technical \"called X API and got Y result back\".\n *\n * Reasoning steps can include that kind of detail depending on your use case, but is meant more for user friendly\n * content than debugging technical internal content.\n */\n reasoning?: ReasoningSteps;\n\n /**\n * Controls the display of the chain of thought component.\n *\n * Most people should use reasoning steps instead of chain of thought.\n *\n * Chain of thought it meant more for technical \"called X API and got Y result back\".\n *\n * Reasoning steps can include that kind of detail depending on your use case, but is meant more for user friendly\n * content than debugging technical internal content.\n */\n chain_of_thought?: ChainOfThoughtStep[];\n}\n\n/**\n * This interface contains information about the history of a given {@link MessageResponse}. This information should be\n * saved your history store.\n *\n * @category Messaging\n */\ninterface MessageResponseHistory {\n /**\n * The time at which this message occurred.\n */\n timestamp?: number;\n\n /**\n * Indicates if this is a \"silent\" message. These messages are sent to or received from the assistant but should\n * not be displayed to the user.\n */\n silent?: boolean;\n\n /**\n * The error state of this message.\n */\n error_state?: MessageErrorState;\n\n /**\n * The state of feedback provided on the items in this message.\n */\n feedback?: {\n [feedbackID: string]: MessageHistoryFeedback;\n };\n\n /**\n * @internal\n * If this message represents a file upload, this is the status of that file. If the upload failed due to an\n * error, the upload will be complete and the error_state value above will be set. The \"success\" status is a\n * temporary status that displays a checkmark on successful uploads. The \"complete\" status is the permanent\n * status stored in session history.\n */\n file_upload_status?: FileStatusValue;\n}\n\n/**\n * This interface contains information about the history of a given {@link MessageRequest}. This information should be\n * saved your history store.\n *\n * @category Messaging\n */\ninterface MessageRequestHistory {\n /**\n * The time at which this message occurred.\n */\n timestamp?: number;\n\n /**\n * The user-friendly label that was associated with this message. This is used on messages that were sent by the\n * user to the assistant to request a response. This is the user displayed text that was entered or selected by\n * the user when that request was made. Most commonly used to make sure a {@link OptionItem} shows the correct button\n * selected when loading history.\n */\n label?: string;\n\n /**\n * If the message was a welcome node request.\n */\n is_welcome_request?: boolean;\n\n /**\n * If this message is related to another message, this is the ID of that other message. This is used when a user\n * choices an option and it includes the ID of the message response that presented the options to the user so we\n * can associate the user's request with that earlier response and display the appropriate selected state.\n */\n related_message_id?: string;\n\n /**\n * Indicates if this is a \"silent\" message. These messages are sent to or received from the assistant but should\n * not be displayed to the user.\n */\n silent?: boolean;\n\n /**\n * The error state of this message.\n */\n error_state?: MessageErrorState;\n\n /**\n * @internal\n * If this message represents a file upload, this is the status of that file. If the upload failed due to an\n * error, the upload will be complete and the error_state value above will be set. The \"success\" status is a\n * temporary status that displays a checkmark on successful uploads. The \"complete\" status is the permanent\n * status stored in session history.\n */\n file_upload_status?: FileStatusValue;\n}\n\n/**\n * @category Messaging\n */\ninterface MessageHistoryFeedback {\n /**\n * Indicates if positive feedback was provided.\n */\n is_positive: boolean;\n\n /**\n * The feedback text provided by the user.\n */\n text?: string;\n\n /**\n * When submitting feedback details, this is the list of categories the user selected (if visible).\n */\n categories?: string[];\n}\n\n/**\n * @category Messaging\n */\ninterface PartialResponse {\n /**\n * This contains the history of this response.\n */\n message_options?: DeepPartial<MessageResponseOptions>;\n}\n\n/**\n * The interface for a chunk that represents a partial update (or first time chunk) to a message item.\n *\n * @category Messaging\n */\ninterface PartialItemChunk extends Chunk {\n /**\n * The partial details of the item. The client will decide what rules to follow for merging this in with any\n * existing data for the same item (which is identified using the {@link ItemStreamingMetadata.id} property).\n */\n partial_item: DeepPartial<GenericItem>;\n\n /**\n * Change the agent display name and other items on the full response.\n */\n partial_response?: PartialResponse;\n}\n\n/**\n * A chunk that represents a complete update to a single message item within a streaming response.\n *\n * This chunk type exists to allow immediate replacement of a streaming item with its final, corrected version\n * before the entire message response is complete. This enables real-time corrections to individual items\n * (like fixing typos in streaming text) while other items in the same message may still be streaming.\n *\n * The item provided here should have all the data necessary to render the item including any data that was\n * previously received from partial chunks. This chunk may contain corrections to previous chunks.\n *\n * Use this when you need to finalize a specific item but the overall message response isn't ready yet.\n *\n * If you are only streaming a single item you can skip\n * this chunk type entirely. CompleteItemChunk is primarily useful when streaming multiple different message\n * items and you need to finalize one item while others are still streaming.\n *\n * For ending the entire streaming response en masse, use {@link FinalResponseChunk}.\n *\n * @category Messaging\n */\ninterface CompleteItemChunk extends Chunk {\n complete_item: GenericItem;\n /**\n * Change the agent display name and other items on the full response.\n */\n partial_response?: PartialResponse;\n}\n\n/**\n * A chunk that represents the entire completed message response, signaling the end of streaming.\n *\n * This chunk type exists as the definitive way to close a streaming session and provide the final,\n * authoritative version of the complete message response. Unlike {@link CompleteItemChunk} which updates\n * individual items, this chunk finalizes the entire response and triggers cleanup of streaming UI states\n * (like hiding \"stop streaming\" buttons).\n *\n * The response provided here should have all the data necessary to render the response including any data\n * that was previously received from item chunks. This final response may contain corrections to previous chunks.\n *\n * Use this to signal that streaming is complete and provide the canonical final state of the entire message.\n * The ID of the message should match the ID that was previously provided by streaming_metadata.response_id.\n *\n * @category Messaging\n */\ninterface FinalResponseChunk {\n final_response: MessageResponse;\n}\n\n/**\n * @category Messaging\n */\ntype StreamChunk = PartialItemChunk | CompleteItemChunk | FinalResponseChunk;\n\n/**\n * Types of users we accept messages from.\n *\n * @category Messaging\n */\nenum UserType {\n /**\n * A message from a human.\n */\n HUMAN = \"human\",\n\n /**\n * A message from a non-watsonx assistant, used for interacting with assistants that are not backed by watsonx.\n *\n * Official guidance is to not use this for IBM products without explicit exception.\n */\n BOT = \"bot\",\n\n /**\n * A message from watsonx.\n */\n WATSONX = \"watsonx\",\n}\n\n/**\n * Profile information about a specific agent that can be used to display information to the user. This may\n * represent a human agent or a virtual assistant agent.\n *\n * @category Messaging\n */\ninterface ResponseUserProfile {\n /**\n * A unique identifier for this agent.\n */\n id: string;\n\n /**\n * The visible name for the response author. Can be the full name or just a first name for a human.\n */\n nickname: string;\n\n /**\n * The type of user. If its a \"human\" there is more protection against code injection attacks, where as assistant responses\n * are trusted by default unless {@link PublicConfig.shouldSanitizeHTML} is set to true.\n */\n user_type: UserType;\n\n /**\n * A URL pointing to an avatar for the response author. This image should be a square.\n */\n profile_picture_url?: string;\n}\n\n/**\n * A single search result.\n *\n * @category Messaging\n */\ninterface SearchResult {\n /**\n * The search result. This can be drilled into and viewed in a larger and scrollable format.\n */\n body?: string;\n}\n\nexport {\n ResponseUserProfile,\n AudioItem,\n BaseGenericItem,\n BaseMessageInput,\n ButtonItem,\n ButtonItemKind,\n ButtonItemType,\n CardItem,\n CarouselItem,\n Chunk,\n CompleteItemChunk,\n ConnectToHumanAgentItem,\n ConnectToHumanAgentItemTransferInfo,\n ConversationalSearchItem,\n ConversationalSearchItemCitation,\n DateItem,\n EventInput,\n EventInputData,\n FinalResponseChunk,\n GenericItem,\n GridItem,\n HorizontalCellAlignment,\n IFrameItem,\n IFrameItemDisplayOption,\n ImageItem,\n InlineErrorItem,\n MediaItem,\n MediaItemDimensions,\n MediaSubtitleTrack,\n MediaTranscript,\n MediaFileAccessibility,\n MessageInput,\n MessageInputType,\n MessageItemPanelInfo,\n MessageOutput,\n MessageRequest,\n MessageResponse,\n MessageResponseTypes,\n SingleOption,\n OptionItem,\n OptionItemPreference,\n PartialItemChunk,\n PauseItem,\n StreamChunk,\n TextItem,\n UserDefinedItem,\n VerticalCellAlignment,\n VideoItem,\n WithBodyAndFooter,\n WidthOptions,\n WithWidthOptions,\n MessageHistoryFeedback,\n InternalMessageRequestType,\n SearchResult,\n PartialResponse,\n UserType,\n MessageUIStateInternal,\n MessageResponseOptions,\n MessageResponseHistory,\n MessageRequestHistory,\n ReasoningSteps,\n ReasoningStep,\n ReasoningStepOpenState,\n PreviewCardItem,\n};\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { DeepPartial } from \"../utilities/DeepPartial\";\n\nimport { HasNeedsAnnouncement } from \"../utilities/HasNeedsAnnouncement\";\nimport { GenericItem, MessageRequest } from \"./Messages\";\n\n/**\n * The different type of error states a given message can be in.\n *\n * @category Messaging\n */\nenum MessageErrorState {\n /**\n * No errors.\n */\n NONE = 1,\n\n /**\n * The message failed to be sent and no more attempts will be made.\n */\n FAILED = 2,\n\n /**\n * The message failed while streaming.\n */\n FAILED_WHILE_STREAMING = 3,\n\n /**\n * There was an error sending the message but the system is retrying the message.\n */\n RETRYING = 4,\n\n /**\n * Indicates that the previous message has entered the retrying state and that this message is waiting for it to\n * finish or fail. This message will remain in the waiting state until it finishes successfully or it enters a\n * retrying state itself.\n */\n WAITING = 5,\n}\n\n/**\n * This file contains the definition for the {@link LocalMessageItem} interface which defines a generic local message\n * that is used to represent either a message request or response. This represents an individual item from the generic\n * array of a message response (an individual response type) or the single item from the input of a message request.\n *\n * @category Messaging\n */\n\ninterface LocalMessageItem<TGenericItemType extends GenericItem = GenericItem> {\n /**\n * The original message data (request or response minus the input or output data) this message represents.\n */\n item: TGenericItemType;\n\n /**\n * Assistant context\n */\n context?: unknown;\n\n /**\n * The local UI state that is currently associated with this message.\n */\n ui_state: LocalMessageUIState<TGenericItemType>;\n\n /**\n * The ID of the original/full message that this local message item was created for. Note that the full message\n * may contain multiple message items and this {@link LocalMessageItem} only represents one of those.\n */\n fullMessageID: string;\n}\n\n/**\n * @category Messaging\n */\ninterface LocalMessageUIState<\n TGenericItemType extends GenericItem = GenericItem,\n> extends HasNeedsAnnouncement {\n /**\n * The ID of this local message item. Note that this is not the same ID as the ID of the full message request or\n * response that this item came from. Also note that these IDs are generated by Carbon AI Chat and are not persisted\n * anywhere. They are not part of session history so they cannot be used as permanent references to this message item.\n */\n id: string;\n\n /**\n * Indicates if this message is the response to a welcome request.\n */\n isWelcomeResponse?: boolean;\n\n /**\n * If this is an option response_type, optionSelected is that value of the item that was selected. This value is\n * populated via crawling history.\n */\n optionSelected?: MessageRequest;\n\n /**\n * In the case where this local message represents a message request generated by the user this value is the\n * original text entered by the user. It is also the text displayed in the UI. Usually this value is the same as\n * the value on the underlying {@link MessageRequest} but in the event that a pre:send handler modifies the text\n * before it is sent to the back-end these values will differ. We continue to show the user's original text in the\n * UI instead of the modified text that was sent to the back-end.\n */\n originalUserText?: string;\n\n /**\n * Indicates if this message was used to start an agent conversation that was then ended.\n */\n wasHumanAgentChatEnded?: boolean;\n\n /**\n * A list of local message item ids for nested message item. This prop is used by the carousel response type.\n */\n itemsLocalMessageItemIDs?: string[];\n\n /**\n * A list of local message item ids for nested message item. This prop is used by response types that can support\n * response types nested inside them.\n */\n bodyLocalMessageItemIDs?: string[];\n\n /**\n * A list of local message item ids for nested button response types. This prop is used by response types that can\n * support response types nested inside them.\n */\n footerLocalMessageItemIDs?: string[];\n\n /**\n * A list of local message item ids for nested items in a grid cell. This prop is used by the grid response type.\n */\n gridLocalMessageItemIDs?: string[][][];\n\n /**\n * If this item is currently streaming, this will contain the current streaming status.\n */\n streamingState?: LocalMessageItemStreamingState<TGenericItemType>;\n\n /**\n * Indicates if this item is part of an intermediate step during streaming. This will be true for items received\n * as part of a \"partial_item\" or a \"complete_item\". This value will be removed when the \"final_response\" is received.\n */\n isIntermediateStreaming?: boolean;\n}\n\n/**\n * @category Messaging\n */\ninterface LocalMessageItemStreamingState<\n TGenericItemType extends GenericItem = GenericItem,\n> {\n /**\n * Indicates if streaming is done and we've received all the pieces.\n */\n isDone: boolean;\n\n /**\n * Represents the current state of an item that is being streamed to Carbon AI Chat in chunks.\n */\n chunks: DeepPartial<TGenericItemType>[];\n}\n\nexport {\n LocalMessageItem,\n LocalMessageUIState,\n MessageErrorState,\n LocalMessageItemStreamingState,\n};\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { FileStatusValue } from \"../../types/config/ServiceDeskConfig\";\nimport { WriteableElementName } from \"../../types/instance/ChatInstance\";\nimport { CornersType } from \"../../types/config/CornersType\";\n\n// Prefix used to distinguish console logs omitted from our code\nconst WA_CONSOLE_PREFIX = \"[Chat]\";\n\n// The right-to-left mark character string which mixes the direction of a string.\n// For more info on right-to-left mark: https://www.w3.org/TR/WCAG20-TECHS/H34.html\nconst RIGHT_TO_LEFT_MARK = String.fromCharCode(0x200f);\n\nconst ENGLISH_US_DATE_FORMAT = \"mm/dd/yyyy\";\n\n// The timeout, in milliseconds, to wait for a response type to load content.\nconst RESPONSE_TYPE_TIMEOUT_MS = 20000;\n\n// These are custom panel ids.\nconst DEFAULT_CUSTOM_PANEL_ID = \"wac-default-panel\";\nconst WORKSPACE_CUSTOM_PANEL_ID = \"workspace-panel\";\n\n/**\n * This function serves as a placeholder in places where a functional value is required, but not expected to be\n * fired. In the event that it is, it will throw an error, letting you know it shouldn't be.\n */\nfunction THROW_ERROR() {\n throw Error(\"Not implemented.\");\n}\n\n// When we auto-scroll to a message, we want to scroll a bit more than necessary because messages have a lot of\n// padding on the top that we want to cut off when scrolling. This is the extra amount we scroll by. There's 28px of\n// padding above the message and we want to cut that down to just 8 so we scroll an extra 20px (28 - 8).\nconst AUTO_SCROLL_EXTRA = 28 - 8;\n\n// How much to throttle auto scrolling. When we are in test mode, we set this to zero.\nconst AUTO_SCROLL_THROTTLE_TIMEOUT = 100;\n\nexport {\n AUTO_SCROLL_THROTTLE_TIMEOUT,\n WA_CONSOLE_PREFIX,\n RIGHT_TO_LEFT_MARK,\n ENGLISH_US_DATE_FORMAT,\n RESPONSE_TYPE_TIMEOUT_MS,\n DEFAULT_CUSTOM_PANEL_ID,\n WORKSPACE_CUSTOM_PANEL_ID,\n WriteableElementName,\n FileStatusValue,\n THROW_ERROR,\n CornersType,\n AUTO_SCROLL_EXTRA,\n};\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Miscellaneous utils for dealing with promises.\n */\n\nasync function sleep(milliseconds: number) {\n await new Promise((resolve) => {\n setTimeout(resolve, milliseconds);\n });\n}\n\n/**\n * This function returns a Promise that will be resolved if the provided Promise has resolved within the duration\n * specified. Otherwise the promise will be rejected.\n *\n * @param promise The Promise which will be resolved or timed out.\n * @param duration The duration of the timeout in milliseconds.\n * @param errorMessage An optional message to display.\n */\nfunction resolveOrTimeout<T>(\n promise: Promise<T>,\n duration: number,\n errorMessage?: string,\n): Promise<T> {\n // Create a promise that rejects in <ms> milliseconds\n const timeout = new Promise<T>((resolve, reject) => {\n setTimeout(() => {\n const message =\n errorMessage || `The operation timed out after ${duration}ms`;\n reject(message);\n }, duration);\n });\n\n // Returns a race between the timeout and the original in promise\n return Promise.race([promise, timeout]);\n}\n\nexport { resolveOrTimeout, sleep };\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Miscellaneous utilities that don't fit anywhere else.\n */\n\nimport { ErrorInfo } from \"react\";\n\nimport { AppConfig } from \"../../types/state/AppConfig\";\nimport { FileUpload } from \"../../types/config/ServiceDeskConfig\";\nimport { FileStatusValue, WA_CONSOLE_PREFIX } from \"./constants\";\nimport { resolveOrTimeout } from \"./lang/promiseUtils\";\nimport { OnErrorData, OnErrorType } from \"../../types/config/PublicConfig\";\n\n/**\n * A global flag to indicate if we want to show debug messages in the browser console. This is generally set from\n * {@link PublicConfig.debug}.\n */\nlet enableDebugLog = false;\n\n/**\n * This is a no-op function that's for the purpose of verifying at build time that a given item matches a given\n * type. To use, pass the item as the \"item\" parameter and pass the type as the \"TItemType\" type parameter. Since\n * this is incurring a runtime call for what is really a build-time check, this function should be used sparingly.\n */\nfunction assertType<TItemType>(item: TItemType): TItemType {\n return item;\n}\n\n/**\n * A simple utility to send a message to the console log but only id debug logging is enabled.\n */\nfunction debugLog(message: string, ...args: any[]) {\n if (enableDebugLog) {\n console.log(`${WA_CONSOLE_PREFIX} ${message}`, ...args);\n }\n}\n\n/**\n * A simple utility to send an error message to the console log.\n */\nfunction consoleError(message: string, ...args: any[]) {\n console.error(`${WA_CONSOLE_PREFIX} ${message}`, ...args);\n}\n\n/**\n * A simple utility to send an error message to the console log.\n */\nfunction consoleLog(message: string, ...args: any[]) {\n console.log(`${WA_CONSOLE_PREFIX} ${message}`, ...args);\n}\n\n/**\n * A simple utility to send a message to the console log.\n */\nfunction consoleDebug(message: string, ...args: any[]) {\n console.debug(`${WA_CONSOLE_PREFIX} ${message}`, ...args);\n}\n\n/**\n * A simple utility to send an warning message to the console log.\n */\nfunction consoleWarn(message: string, ...args: any[]) {\n console.warn(`${WA_CONSOLE_PREFIX} ${message}`, ...args);\n}\n\n/**\n * Sets a global flag to indicate if we want to show debug messages in the browser console. This is generally set from\n * {@link PublicConfig.debug}.\n */\nfunction setEnableDebugLog(debug: boolean) {\n enableDebugLog = debug;\n}\n\n/**\n * Indicates if the global flag to indicate if we want to show debug messages in the browser console is enabled.\n */\nfunction isEnableDebugLog() {\n return enableDebugLog;\n}\n\n/**\n * Safely returns the text from the given fetch response or undefined if there is an error. This will also impose a\n * timeout on getting the text\n */\nasync function safeFetchTextWithTimeout(response: Response): Promise<string> {\n try {\n if (response) {\n return resolveOrTimeout(response.text(), 2000, \"Getting response text\");\n }\n } catch (error) {\n consoleError(\"Error getting fetch text\", error);\n }\n return undefined;\n}\n\n/**\n * Returns a {@link OnErrorData} that represents an error that occurred while rendering a component.\n */\nfunction createDidCatchErrorData(\n component: string,\n error: Error,\n errorInfo: ErrorInfo,\n isCatastrophicError?: boolean,\n): OnErrorData {\n return {\n errorType: OnErrorType.RENDER,\n message: `${component}.componentDidCatch`,\n otherData: {\n error,\n errorInfo,\n },\n catastrophicErrorType: isCatastrophicError,\n };\n}\n\n/**\n * This function will calculate and return the necessary top padding percentage value that will help render a media\n * player with a responsive aspect ratio.\n */\nfunction getResponsiveElementPaddingValue(baseHeight = 180) {\n return `${100 / (320 / baseHeight)}%`;\n}\n\n/**\n * Indicates if the given file is valid for uploading. The file must still be in the edit step and it must not\n * contain an error.\n */\nfunction isValidForUpload(upload: FileUpload) {\n return upload.status === FileStatusValue.EDIT && !upload.isError;\n}\n\n/**\n * Calls the given onError function.\n */\nfunction callOnError(onError: (data: OnErrorData) => void, data: OnErrorData) {\n if (onError) {\n try {\n onError(data);\n } catch (error) {\n consoleError(\"Error calling onError\", error);\n }\n }\n}\n\nfunction getAssistantName(aiEnabled: boolean | undefined, config: AppConfig) {\n let assistantName;\n if (aiEnabled) {\n assistantName = \"watsonx\";\n } else {\n assistantName = config.public.assistantName || \"watsonx\";\n }\n\n return assistantName;\n}\n\nexport {\n assertType,\n debugLog,\n consoleError,\n consoleWarn,\n setEnableDebugLog,\n createDidCatchErrorData,\n consoleDebug,\n consoleLog,\n isEnableDebugLog,\n getResponsiveElementPaddingValue,\n isValidForUpload,\n safeFetchTextWithTimeout,\n callOnError,\n getAssistantName,\n};\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Normalizes CommonJS and ESM default exports so that dynamically imported\n * modules always return the actual value we care about (component, class, etc).\n *\n * Some libraries (like `react-player`) can emit shapes such as:\n * { default: Component }\n * { default: { default: Component } }\n * Component\n *\n * This helper unwraps those nested `default` properties until it reaches either\n * a primitive, a function, or an object without a `default` field.\n */\nexport function normalizeModuleInterop<T>(mod: T): any {\n let resolved: any = mod;\n\n while (\n resolved &&\n typeof resolved === \"object\" &&\n \"default\" in resolved &&\n resolved.default !== resolved\n ) {\n resolved = resolved.default;\n }\n\n return resolved;\n}\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport dayjs from \"dayjs\";\nimport enLocaleData from \"dayjs/locale/en.js\";\nimport { consoleError } from \"./miscUtils\";\nimport { normalizeModuleInterop } from \"./moduleInterop\";\n\nconst localeLoaders = {\n ar: () =>\n import(\"dayjs/locale/ar.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"ar-dz\": () =>\n import(\"dayjs/locale/ar-dz.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"ar-kw\": () =>\n import(\"dayjs/locale/ar-kw.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"ar-ly\": () =>\n import(\"dayjs/locale/ar-ly.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"ar-ma\": () =>\n import(\"dayjs/locale/ar-ma.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"ar-sa\": () =>\n import(\"dayjs/locale/ar-sa.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"ar-tn\": () =>\n import(\"dayjs/locale/ar-tn.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n cs: () =>\n import(\"dayjs/locale/cs.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n de: () =>\n import(\"dayjs/locale/de.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"de-at\": () =>\n import(\"dayjs/locale/de-at.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"de-ch\": () =>\n import(\"dayjs/locale/de-ch.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n en: () =>\n import(\"dayjs/locale/en.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"en-au\": () =>\n import(\"dayjs/locale/en-au.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"en-ca\": () =>\n import(\"dayjs/locale/en-ca.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"en-gb\": () =>\n import(\"dayjs/locale/en-gb.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"en-ie\": () =>\n import(\"dayjs/locale/en-ie.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"en-il\": () =>\n import(\"dayjs/locale/en-il.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"en-nz\": () =>\n import(\"dayjs/locale/en-nz.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n es: () =>\n import(\"dayjs/locale/es.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"es-do\": () =>\n import(\"dayjs/locale/es-do.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"es-us\": () =>\n import(\"dayjs/locale/es-us.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n nl: () =>\n import(\"dayjs/locale/nl.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n fr: () =>\n import(\"dayjs/locale/fr.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"fr-ca\": () =>\n import(\"dayjs/locale/fr-ca.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"fr-ch\": () =>\n import(\"dayjs/locale/fr-ch.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n it: () =>\n import(\"dayjs/locale/it.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"it-ch\": () =>\n import(\"dayjs/locale/it-ch.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n ja: () =>\n import(\"dayjs/locale/ja.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n ko: () =>\n import(\"dayjs/locale/ko.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n pt: () =>\n import(\"dayjs/locale/pt.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"pt-br\": () =>\n import(\"dayjs/locale/pt-br.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n zh: () =>\n import(\"dayjs/locale/zh-cn.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"zh-cn\": () =>\n import(\"dayjs/locale/zh-cn.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"zh-tw\": () =>\n import(\"dayjs/locale/zh-tw.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n // The zh-mo and zh-hk locales fallback to zh-tw.\n \"zh-mo\": () =>\n import(\"dayjs/locale/zh-tw.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n \"zh-hk\": () =>\n import(\"dayjs/locale/zh-tw.js\" as any).then((mod) =>\n normalizeModuleInterop(mod),\n ),\n};\n\n/**\n * Determines if the given object contains a key that supported the given locale. This will determine if there is an\n * exact match from the given object and if so, that key will be returned. If not, the language will be extracted\n * from the locale and that will be checked to see if it supported by the given object. If the language is\n * supported, that will be returned. If nothing is found to support the locale, this will return null.\n *\n * @param locale The locale (which may or may not include a region) to determine if we have a valid match or null if\n * there is no match.\n * @param object The object containing the values to check for support.\n */\nfunction isSupportedLocale<T>(locale: string, object: T): keyof T | null {\n if (!locale) {\n return null;\n }\n\n // Normalize the locale to lower case and change underscores to dashes.\n locale = locale.toLowerCase().replace(/_/g, \"-\");\n\n if ((object as any)[locale]) {\n // If there's an exact match for the requested locale, then we'll use that.\n return locale as keyof T;\n }\n\n // If not, look to see if there's a match for just the language without the region.\n const language = locale.substring(0, 2);\n if ((object as any)[language]) {\n return language as keyof T;\n }\n\n // No match was found.\n return null;\n}\n\n/**\n * Determines if the given object contains a key that supported the given locale. This will determine if there is an\n * exact match from the given object and if so, that key will be returned. If not, the language will be extracted\n * from the locale and that will be checked to see if it supported by the given object. If the language is\n * supported, that will be returned. If nothing is found to support the locale, this will return null. If no locale\n * was requested, then the browser's languages/locales will be used instead.\n *\n * @param requestedLocale The locale (which may or may not include a region) that was provided in the public config.\n * @param object The object containing the values to check for support.\n * @param objectType A user friendly string describing the type of data in the given object. Used for outputting\n * error messages.\n */\nfunction findSupportedKey<T>(\n requestedLocale: string,\n object: T,\n objectType: string,\n): keyof T {\n // Check to see if the requested locale is supported.\n const requestedSupported = isSupportedLocale(requestedLocale, object);\n if (requestedSupported) {\n return requestedSupported;\n }\n\n if (requestedLocale) {\n const keyList = JSON.stringify(Object.keys(object));\n consoleError(\n `The requested locale \"${requestedLocale}\" does not contain a supported ${objectType}. We are defaulting to \"en\". The supported values are ${keyList}.`,\n );\n }\n\n // Return English as the default.\n return \"en\" as keyof T;\n}\n\n/**\n * Loads the appropriate {@link LanguagePack} from the corresponding module for the requested locale.\n */\nasync function loadLocale(requestedLocale: string): Promise<ILocale> {\n try {\n const localeKey = findSupportedKey(\n requestedLocale,\n localeLoaders,\n \"locale\",\n );\n const localeModule = await localeLoaders[localeKey]();\n if (localeModule) {\n return localeModule;\n }\n consoleError(\n `The locale data for \"${localeKey}\" did not load. The application will default to \"en\".`,\n );\n } catch (error) {\n consoleError(\n `An error occurred loading the locale data for \"${requestedLocale}\". The application will default to \"en\".`,\n error,\n );\n }\n return enLocaleData;\n}\n\n/**\n * Loads a dayjs locale if it hasn't been loaded already, but doesn't replace the current globally set locale.\n *\n * @param locale The dayjs locale to load.\n * @returns returns the locale it succeeded to load.\n */\nasync function loadDayjsLocale(locale: string): Promise<string> {\n if (!dayjs.Ls[locale]) {\n const previousLocale = dayjs.locale();\n const localePack = await loadLocale(locale);\n\n // We need to temporarily set the new locale globally so that it's available and then return to the previously\n // set locale.\n dayjs.locale(localePack);\n dayjs.locale(previousLocale);\n\n // Determine if the locale we attempted to set was successful.\n const isLoaded = Boolean(dayjs.Ls[locale]);\n // If the locale we attempted to load was not successful, and it's 2 characters long, it's not a locale\n // recognized by dayjs, and we should throw an error.\n if (!isLoaded && locale.length === 2) {\n throw Error(\"Locale is not recognized.\");\n } else if (!isLoaded) {\n // If the locale we were provided is more than two characters, we were possibly given a region that's not\n // supported, so let's attempt to load just the language, which is the first two characters.\n return loadDayjsLocale(locale.substring(0, 2));\n }\n }\n return locale;\n}\n\nexport { loadLocale, loadDayjsLocale, localeLoaders };\n"],"names":["PageObjectId","ViewType","PanelType","WriteableElementName","CornersType","BusEventType","ViewChangeReason","MessageSendSource","FeedbackInteractionType","MainWindowOpenReason","MainWindowCloseReason","CancellationReason","enLanguagePack","enLanguagePackData","MinimizeButtonIconType","CarbonTheme","OnErrorType","FileStatusValue","HumanAgentsOnlineStatus","ScreenShareState","ErrorType","MessageInputType","InternalMessageRequestType","MessageResponseTypes","HumanAgentMessageType","OptionItemPreference","IFrameItemDisplayOption","ButtonItemType","WidthOptions","ButtonItemKind","ReasoningStepOpenState","UserType","MessageErrorState","WA_CONSOLE_PREFIX","RIGHT_TO_LEFT_MARK","String","fromCharCode","ENGLISH_US_DATE_FORMAT","RESPONSE_TYPE_TIMEOUT_MS","DEFAULT_CUSTOM_PANEL_ID","WORKSPACE_CUSTOM_PANEL_ID","THROW_ERROR","Error","AUTO_SCROLL_EXTRA","AUTO_SCROLL_THROTTLE_TIMEOUT","async","sleep","milliseconds","Promise","resolve","setTimeout","resolveOrTimeout","promise","duration","errorMessage","timeout","reject","message","race","enableDebugLog","debugLog","args","console","log","consoleError","error","consoleLog","consoleDebug","debug","consoleWarn","warn","setEnableDebugLog","isEnableDebugLog","safeFetchTextWithTimeout","response","text","undefined","createDidCatchErrorData","component","errorInfo","isCatastrophicError","errorType","RENDER","otherData","catastrophicErrorType","getResponsiveElementPaddingValue","baseHeight","isValidForUpload","upload","status","EDIT","isError","callOnError","onError","data","normalizeModuleInterop","mod","resolved","default","localeLoaders","ar","import","then","cs","de","en","es","nl","fr","it","ja","ko","pt","zh","isSupportedLocale","locale","object","toLowerCase","replace","language","substring","findSupportedKey","requestedLocale","objectType","requestedSupported","keyList","JSON","stringify","Object","keys","loadLocale","localeKey","localeModule","enLocaleData","loadDayjsLocale","dayjs","Ls","previousLocale","localePack","isLoaded","Boolean","length"],"mappings":";;;;;;IAkBYA;;CAAZ,SAAYA;EAIVA,aAAA,iBAAA;EAKAA,aAAA,gBAAA;EAKAA,aAAA,cAAA;EAKAA,aAAA,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