ai12z 3.17.2 → 3.17.4
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.
- package/dist/cjs/ai12z-bot.cjs.entry.js +125 -26
- package/dist/cjs/library.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +127 -27
- package/dist/components/ai12z-bot.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-BDHD9yF0.js +1 -0
- package/dist/esm/ai12z-bot.entry.js +125 -26
- package/dist/esm/library.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/p-8cca467d.entry.js +1 -0
- package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +14 -5
- package/package.json +2 -2
- package/dist/components/p-CdRaSl47.js +0 -1
- package/dist/library/p-d70f0bde.entry.js +0 -1
package/dist/esm/library.js
CHANGED
|
@@ -43,5 +43,5 @@ var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
43
43
|
|
|
44
44
|
patchBrowser().then(async (options) => {
|
|
45
45
|
await globalScripts();
|
|
46
|
-
return bootstrapLazy(JSON.parse("[[\"ai12z-knowledge-box\",[[257,\"ai12z-knowledge-box\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[1537,\"config-id\"],\"question\":[1537],\"socket\":[1032],\"isLoading\":[1028,\"is-loading\"],\"questionId\":[32],\"isInitialized\":[32],\"kbSettings\":[32],\"searchResults\":[32],\"items\":[32],\"error\":[32],\"domId\":[32],\"surveyDomId\":[32],\"buttons\":[32],\"currentStreamingText\":[32],\"isStreaming\":[32],\"finalResponse\":[32],\"scriptArray\":[32],\"showButton\":[32],\"welcomeReady\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},null,{\"question\":[{\"watchPropHandler\":0}],\"domId\":[{\"watchStateHandler\":0}]}]]],[\"dynamic-form\",[[0,\"dynamic-form\",{\"form\":[8],\"formSettings\":[1032,\"form-settings\"],\"formsettings\":[8],\"theme\":[8]}]]],[\"ai12z-spinner\",[[2,\"ai12z-spinner\",{\"class\":[1]}]]],[\"item-list\",[[0,\"item-list\",{\"inputType\":[1,\"input-type\"],\"carouselType\":[1,\"carousel-type\"],\"customTemplate\":[16],\"customSource\":[8,\"custom-source\"],\"llm\":[16],\"customStyles\":[1,\"custom-styles\"],\"customScripts\":[1,\"custom-scripts\"],\"isExpanded\":[4,\"is-expanded\"],\"currentPage\":[32],\"htmlTemplate\":[32],\"currentIndex\":[32],\"formSettings\":[32],\"itemsPerPage\":[32],\"emptyMessage\":[32],\"buttonText\":[32],\"panelTemplate\":[32],\"panelIndex\":[32],\"panelName\":[32],\"items\":[32],\"theme\":[32],\"selectByIndex\":[64],\"selectByName\":[64]}]]],[\"ai12z-beacon\",[[0,\"ai12z-beacon\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"disable\":[516]},null,{\"dataKey\":[{\"onPropChange\":0}],\"dataMode\":[{\"onPropChange\":0}],\"disable\":[{\"onPropChange\":0}]}]]],[\"ai12z-container\",[[1,\"ai12z-container\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"instanceId\":[513,\"instance-id\"],\"parameters\":[513],\"renderType\":[1537,\"render-type\"],\"contentTemplate\":[513,\"content-template\"],\"isLoading\":[32],\"error\":[32],\"contentText\":[32],\"htmlWidgetMarkup\":[32],\"domId\":[32]},null,{\"parameters\":[{\"onParametersChanged\":0}],\"contentTemplate\":[{\"onContentTemplateChanged\":0}]}]]],[\"ai12z-form\",[[1,\"ai12z-form\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"isLoading\":[32],\"error\":[32],\"isReady\":[32],\"honeypotValue\":[32],\"loadDynamicForm\":[64]},null,{\"keyName\":[{\"watchLoadProps\":0}]}]]],[\"ai12z-chat-message\",[[1,\"ai12z-chat-message\",{\"text\":[1],\"streaming\":[4],\"kbSettings\":[8,\"kb-settings\"],\"showButton\":[4,\"show-button\"],\"isExpanded\":[32],\"isCollapsing\":[32],\"canExpand\":[32]},[[4,\"initializeScripts\",\"handleInitializeScripts\"]],{\"text\":[{\"onTextChange\":0}]}]]],[\"ai12z-category_2\",[[0,\"ai12z-category\",{\"categoryList\":[520,\"category-list\"],\"linkTarget\":[513,\"link-target\"]},[[4,\"clearResults\",\"clearResultsHandler\"]],{\"categoryList\":[{\"watchCategoryList\":0}]}],[0,\"audio-recorder\",{\"componentType\":[1,\"component-type\"],\"dataKey\":[32],\"dataMode\":[32],\"isRecording\":[32],\"isProcessing\":[32],\"time\":[32],\"transcript\":[32],\"fullTranscript\":[32],\"isSpeechRecognitionSupported\":[32],\"userCountry\":[32]}]]],[\"ai12z-chat_2\",[[0,\"ai12z-input-form\",{\"isChat\":[4,\"is-chat\"],\"placeholder\":[1],\"buttonText\":[1,\"button-text\"],\"followUpLabel\":[1,\"follow-up-label\"],\"iconSrc\":[1,\"icon-src\"],\"isImageUpload\":[4,\"is-image-upload\"],\"isEnableMic\":[4,\"is-enable-mic\"],\"openMenuUpward\":[4,\"open-menu-upward\"],\"componentType\":[1,\"component-type\"],\"chatLength\":[2,\"chat-length\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"imagesBase64List\":[32],\"showShortcutsDialog\":[32],\"shortcuts\":[32],\"searchInput\":[32],\"submitted\":[32],\"showErrorMessage\":[32],\"hideAllButtons\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32]},[[4,\"stateChanged\",\"stateChangedHandler\"],[4,\"clearInput\",\"clearInputHandler\"]]],[1,\"ai12z-chat\",{\"chatId\":[1,\"chat-id\"],\"chats\":[1032],\"query\":[1025],\"apiKey\":[1,\"api-key\"],\"aiMessageId\":[1025,\"ai-message-id\"],\"imgFiles\":[1032,\"img-files\"],\"env\":[1025],\"conversationId\":[1025,\"conversation-id\"],\"dataAttributes\":[8,\"data-attributes\"],\"chatExcludeTags\":[16],\"chatIncludeTags\":[16],\"target\":[1],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"componentType\":[1,\"component-type\"],\"chatPosition\":[1,\"chat-position\"],\"socketIn\":[16],\"customstyle\":[1],\"customJS\":[1,\"custom-j-s\"],\"avatarUrl\":[1,\"avatar-url\"],\"settings\":[8],\"scrollBottom\":[32],\"copied\":[32],\"isPlayed\":[32],\"buttons\":[32],\"itemList\":[32],\"currentChatData\":[32],\"currentTemplate\":[32],\"currentPage\":[32],\"currentResponse\":[32],\"currentSlide\":[32],\"scriptArray\":[32],\"isProse\":[32],\"isProcessingEndResponse\":[32],\"surveyDomId\":[32],\"focusedIndex\":[32],\"hydrateMessagesFromState\":[64]},[[8,\"streamResponse\",\"streamResponseHandler\"],[8,\"endResponse\",\"endResponseHandler\"],[0,\"buttonClick\",\"buttonClickHandler\"],[4,\"stopStream\",\"stopStreamInputHandler\"],[4,\"startStream\",\"startStreamInputHandler\"]],{\"chats\":[{\"watchHandler\":0}]}]]],[\"ai12z-inline-search\",[[1,\"ai12z-inline-search\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"resultPosition\":[1,\"result-position\"],\"autoSearch\":[4,\"auto-search\"],\"categorize\":[4],\"settings\":[16],\"formData\":[32],\"conversationHistory\":[32],\"searchResults\":[32],\"isOpen\":[32]},[[4,\"survey\",\"surveyHandler\"]]]]],[\"search-results-page\",[[1,\"search-results-page\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"dataAttributes\":[1,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"configId\":[1,\"config-id\"],\"query\":[32],\"searchResultSettings\":[32],\"searchResults\":[32],\"hideAllButtons\":[32],\"isChat\":[32],\"chatHistory\":[32],\"aiMessageId\":[32],\"socketService\":[32],\"thumbsId\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"imgFiles\":[32],\"displayText\":[32],\"showWelcomeTemplate\":[32],\"timer\":[32],\"questionCounter\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32],\"isRendered\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},[[4,\"messageReceived\",\"messageReceivedHandler\"],[4,\"survey\",\"surveyHandler\"]]]]],[\"chatbot-history_2\",[[1,\"chatbot-history\",{\"chatList\":[16],\"botName\":[1,\"bot-name\"],\"chatlogo\":[1],\"heading\":[1],\"styles\":[1],\"scripts\":[1],\"showDeleteModal\":[32],\"chatToDelete\":[32],\"activeId\":[32],\"focusedIndex\":[32]}],[1,\"delete-confirmation-modal\",{\"show\":[4],\"dialogTitle\":[1,\"dialog-title\"],\"message\":[1],\"confirmButtonText\":[1,\"confirm-button-text\"],\"cancelButtonText\":[1,\"cancel-button-text\"]}]]],[\"ai12z-cta\",[[257,\"ai12z-cta\",{\"isCta\":[1028,\"is-cta\"],\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[513,\"data-attributes\"],\"options\":[16],\"excludeTags\":[16],\"includeTags\":[16],\"socketService\":[32],\"ctaSettings\":[32],\"showModal\":[32],\"timer\":[32],\"questionCounter\":[32],\"formData\":[32],\"searchResults\":[32],\"error\":[32],\"conversationId\":[32],\"canRender\":[32],\"chatHistory\":[32],\"isChat\":[32],\"aiMessageId\":[32],\"thumbsId\":[32],\"imgFiles\":[32],\"announceMessage\":[32],\"showHistory\":[32],\"conversationHistory\":[32],\"isRendered\":[32],\"openModal\":[64],\"sendMessage\":[64],\"sendJSON\":[64],\"closeModal\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"survey\",\"surveyHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]],[\"ai12z-search-panel\",[[1,\"ai12z-search-panel\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"categorize\":[4],\"placeholder\":[1],\"redirectUrl\":[1,\"redirect-url\"],\"query\":[32],\"searchResults\":[32],\"hideAllButtons\":[32]}]]],[\"chat-avatar_6\",[[0,\"interaction-buttons\",{\"message\":[8],\"chatArray\":[16],\"currentIndex\":[2,\"current-index\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"source\":[1],\"conversationId\":[1,\"conversation-id\"],\"projectId\":[1,\"project-id\"],\"isPlayed\":[32],\"audioElement\":[32],\"copied\":[32]}],[1,\"privacy-modal\",{\"message\":[1],\"show\":[4]}],[0,\"chat-avatar\",{\"senderType\":[1,\"sender-type\"],\"avatarUrl\":[1,\"avatar-url\"]}],[0,\"hamburger-menu\",{\"isToggled\":[1540,\"is-toggled\"],\"messages\":[16],\"botSettings\":[8,\"bot-settings\"],\"isLiveAgentEnabled\":[4,\"is-live-agent-enabled\"],\"liveAgentButtonText\":[1,\"live-agent-button-text\"],\"hasCheckedLiveAgent\":[32]},null,{\"isToggled\":[{\"watchToggled\":0}],\"messages\":[{\"watchMessages\":0}],\"liveAgentButtonText\":[{\"watchLiveAgentButtonText\":0}]}],[257,\"live-agent-chat\",{\"config\":[8],\"isApiReady\":[32],\"startChat\":[64]}],[1,\"typing-indicator\",{\"size\":[2],\"color\":[1],\"spacing\":[2]}]]],[\"image-uploader_2\",[[0,\"image-uploader\",{\"maxImages\":[2,\"max-images\"],\"disabled\":[4],\"images\":[16],\"targetElement\":[16],\"removeImageAtIndex\":[64]},[[4,\"isElementAvailable\",\"handleIsOpened\"],[4,\"capturedImgUpload\",\"handleCapturedImage\"]]],[1,\"keyboard-shortcuts-dialog\",{\"show\":[4],\"shortcuts\":[16],\"groupedShortcuts\":[32]},null,{\"show\":[{\"handleShowChange\":0}],\"shortcuts\":[{\"handleShortcutsChange\":0}]}]]],[\"ai12z-bot\",[[257,\"ai12z-bot\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[520,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"liveAgentButtonText\":[32],\"isLiveAgentEnabled\":[32],\"isTypingIndicatorVisible\":[32],\"botSettings\":[32],\"canRender\":[32],\"voiceType\":[32],\"voice\":[32],\"showSubmit\":[32],\"hideAllButtons\":[32],\"showMenu\":[32],\"isProse\":[32],\"isLiveAgent\":[32],\"isConnectingLiveAgent\":[32],\"showWelcomeScreen\":[32],\"showHistory\":[32],\"conversationId\":[32],\"surveyDomId\":[32],\"searchResults\":[32],\"buttons\":[32],\"currentDomId\":[32],\"messages\":[32],\"questionCounter\":[32],\"visitorID\":[32],\"timestamp\":[32],\"rowCount\":[32],\"isBot\":[32],\"conversationHistory\":[32],\"query\":[32],\"scriptArray\":[32],\"imagesBase64List\":[32],\"focusedIndex\":[32],\"isAnimated\":[32],\"isMinimized\":[32],\"isStreaming\":[32],\"showErrorMessage\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"isOpened\":[32],\"isContent\":[32],\"isExpanded\":[32],\"isToggled\":[32],\"showPrivacy\":[32],\"isRendered\":[32],\"showShortcutsDialog\":[32],\"showLiveAgentEndDialog\":[32],\"liveAgentSessionId\":[32],\"liveAgentConversationId\":[32],\"liveAgentProviderName\":[32],\"liveAgentListenersRegistered\":[32],\"shortcuts\":[32],\"announceMessage\":[32],\"liveAgentDirective\":[32],\"sendMessage\":[64],\"sendQuery\":[64],\"sendJSON\":[64],\"openBot\":[64],\"action\":[64],\"setProcessDataOverride\":[64],\"configureSettings\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"buttonClick\",\"buttonClickHandler\"],[0,\"sendQueryToBot\",\"sendQueryToBotHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"],[0,\"openChat\",\"openChatHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]]]"), options);
|
|
46
|
+
return bootstrapLazy(JSON.parse("[[\"ai12z-knowledge-box\",[[257,\"ai12z-knowledge-box\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[1537,\"config-id\"],\"question\":[1537],\"socket\":[1032],\"isLoading\":[1028,\"is-loading\"],\"questionId\":[32],\"isInitialized\":[32],\"kbSettings\":[32],\"searchResults\":[32],\"items\":[32],\"error\":[32],\"domId\":[32],\"surveyDomId\":[32],\"buttons\":[32],\"currentStreamingText\":[32],\"isStreaming\":[32],\"finalResponse\":[32],\"scriptArray\":[32],\"showButton\":[32],\"welcomeReady\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},null,{\"question\":[{\"watchPropHandler\":0}],\"domId\":[{\"watchStateHandler\":0}]}]]],[\"dynamic-form\",[[0,\"dynamic-form\",{\"form\":[8],\"formSettings\":[1032,\"form-settings\"],\"formsettings\":[8],\"theme\":[8]}]]],[\"ai12z-spinner\",[[2,\"ai12z-spinner\",{\"class\":[1]}]]],[\"item-list\",[[0,\"item-list\",{\"inputType\":[1,\"input-type\"],\"carouselType\":[1,\"carousel-type\"],\"customTemplate\":[16],\"customSource\":[8,\"custom-source\"],\"llm\":[16],\"customStyles\":[1,\"custom-styles\"],\"customScripts\":[1,\"custom-scripts\"],\"isExpanded\":[4,\"is-expanded\"],\"currentPage\":[32],\"htmlTemplate\":[32],\"currentIndex\":[32],\"formSettings\":[32],\"itemsPerPage\":[32],\"emptyMessage\":[32],\"buttonText\":[32],\"panelTemplate\":[32],\"panelIndex\":[32],\"panelName\":[32],\"items\":[32],\"theme\":[32],\"selectByIndex\":[64],\"selectByName\":[64]}]]],[\"ai12z-beacon\",[[0,\"ai12z-beacon\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"disable\":[516]},null,{\"dataKey\":[{\"onPropChange\":0}],\"dataMode\":[{\"onPropChange\":0}],\"disable\":[{\"onPropChange\":0}]}]]],[\"ai12z-container\",[[1,\"ai12z-container\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"instanceId\":[513,\"instance-id\"],\"parameters\":[513],\"renderType\":[1537,\"render-type\"],\"contentTemplate\":[513,\"content-template\"],\"isLoading\":[32],\"error\":[32],\"contentText\":[32],\"htmlWidgetMarkup\":[32],\"domId\":[32]},null,{\"parameters\":[{\"onParametersChanged\":0}],\"contentTemplate\":[{\"onContentTemplateChanged\":0}]}]]],[\"ai12z-form\",[[1,\"ai12z-form\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"isLoading\":[32],\"error\":[32],\"isReady\":[32],\"honeypotValue\":[32],\"loadDynamicForm\":[64]},null,{\"keyName\":[{\"watchLoadProps\":0}]}]]],[\"ai12z-chat-message\",[[1,\"ai12z-chat-message\",{\"text\":[1],\"streaming\":[4],\"kbSettings\":[8,\"kb-settings\"],\"showButton\":[4,\"show-button\"],\"isExpanded\":[32],\"isCollapsing\":[32],\"canExpand\":[32]},[[4,\"initializeScripts\",\"handleInitializeScripts\"]],{\"text\":[{\"onTextChange\":0}]}]]],[\"ai12z-category_2\",[[0,\"ai12z-category\",{\"categoryList\":[520,\"category-list\"],\"linkTarget\":[513,\"link-target\"]},[[4,\"clearResults\",\"clearResultsHandler\"]],{\"categoryList\":[{\"watchCategoryList\":0}]}],[0,\"audio-recorder\",{\"componentType\":[1,\"component-type\"],\"dataKey\":[32],\"dataMode\":[32],\"isRecording\":[32],\"isProcessing\":[32],\"time\":[32],\"transcript\":[32],\"fullTranscript\":[32],\"isSpeechRecognitionSupported\":[32],\"userCountry\":[32]}]]],[\"ai12z-chat_2\",[[0,\"ai12z-input-form\",{\"isChat\":[4,\"is-chat\"],\"placeholder\":[1],\"buttonText\":[1,\"button-text\"],\"followUpLabel\":[1,\"follow-up-label\"],\"iconSrc\":[1,\"icon-src\"],\"isImageUpload\":[4,\"is-image-upload\"],\"isEnableMic\":[4,\"is-enable-mic\"],\"openMenuUpward\":[4,\"open-menu-upward\"],\"componentType\":[1,\"component-type\"],\"chatLength\":[2,\"chat-length\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"imagesBase64List\":[32],\"showShortcutsDialog\":[32],\"shortcuts\":[32],\"searchInput\":[32],\"submitted\":[32],\"showErrorMessage\":[32],\"hideAllButtons\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32]},[[4,\"stateChanged\",\"stateChangedHandler\"],[4,\"clearInput\",\"clearInputHandler\"]]],[1,\"ai12z-chat\",{\"chatId\":[1,\"chat-id\"],\"chats\":[1032],\"query\":[1025],\"apiKey\":[1,\"api-key\"],\"aiMessageId\":[1025,\"ai-message-id\"],\"imgFiles\":[1032,\"img-files\"],\"env\":[1025],\"conversationId\":[1025,\"conversation-id\"],\"dataAttributes\":[8,\"data-attributes\"],\"chatExcludeTags\":[16],\"chatIncludeTags\":[16],\"target\":[1],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"componentType\":[1,\"component-type\"],\"chatPosition\":[1,\"chat-position\"],\"socketIn\":[16],\"customstyle\":[1],\"customJS\":[1,\"custom-j-s\"],\"avatarUrl\":[1,\"avatar-url\"],\"settings\":[8],\"scrollBottom\":[32],\"copied\":[32],\"isPlayed\":[32],\"buttons\":[32],\"itemList\":[32],\"currentChatData\":[32],\"currentTemplate\":[32],\"currentPage\":[32],\"currentResponse\":[32],\"currentSlide\":[32],\"scriptArray\":[32],\"isProse\":[32],\"isProcessingEndResponse\":[32],\"surveyDomId\":[32],\"focusedIndex\":[32],\"hydrateMessagesFromState\":[64]},[[8,\"streamResponse\",\"streamResponseHandler\"],[8,\"endResponse\",\"endResponseHandler\"],[0,\"buttonClick\",\"buttonClickHandler\"],[4,\"stopStream\",\"stopStreamInputHandler\"],[4,\"startStream\",\"startStreamInputHandler\"]],{\"chats\":[{\"watchHandler\":0}]}]]],[\"ai12z-inline-search\",[[1,\"ai12z-inline-search\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"resultPosition\":[1,\"result-position\"],\"autoSearch\":[4,\"auto-search\"],\"categorize\":[4],\"settings\":[16],\"formData\":[32],\"conversationHistory\":[32],\"searchResults\":[32],\"isOpen\":[32]},[[4,\"survey\",\"surveyHandler\"]]]]],[\"search-results-page\",[[1,\"search-results-page\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"dataAttributes\":[1,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"configId\":[1,\"config-id\"],\"query\":[32],\"searchResultSettings\":[32],\"searchResults\":[32],\"hideAllButtons\":[32],\"isChat\":[32],\"chatHistory\":[32],\"aiMessageId\":[32],\"socketService\":[32],\"thumbsId\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"imgFiles\":[32],\"displayText\":[32],\"showWelcomeTemplate\":[32],\"timer\":[32],\"questionCounter\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32],\"isRendered\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},[[4,\"messageReceived\",\"messageReceivedHandler\"],[4,\"survey\",\"surveyHandler\"]]]]],[\"chatbot-history_2\",[[1,\"chatbot-history\",{\"chatList\":[16],\"botName\":[1,\"bot-name\"],\"chatlogo\":[1],\"heading\":[1],\"styles\":[1],\"scripts\":[1],\"showDeleteModal\":[32],\"chatToDelete\":[32],\"activeId\":[32],\"focusedIndex\":[32]}],[1,\"delete-confirmation-modal\",{\"show\":[4],\"dialogTitle\":[1,\"dialog-title\"],\"message\":[1],\"confirmButtonText\":[1,\"confirm-button-text\"],\"cancelButtonText\":[1,\"cancel-button-text\"]}]]],[\"ai12z-cta\",[[257,\"ai12z-cta\",{\"isCta\":[1028,\"is-cta\"],\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[513,\"data-attributes\"],\"options\":[16],\"excludeTags\":[16],\"includeTags\":[16],\"socketService\":[32],\"ctaSettings\":[32],\"showModal\":[32],\"timer\":[32],\"questionCounter\":[32],\"formData\":[32],\"searchResults\":[32],\"error\":[32],\"conversationId\":[32],\"canRender\":[32],\"chatHistory\":[32],\"isChat\":[32],\"aiMessageId\":[32],\"thumbsId\":[32],\"imgFiles\":[32],\"announceMessage\":[32],\"showHistory\":[32],\"conversationHistory\":[32],\"isRendered\":[32],\"openModal\":[64],\"sendMessage\":[64],\"sendJSON\":[64],\"closeModal\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"survey\",\"surveyHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]],[\"ai12z-search-panel\",[[1,\"ai12z-search-panel\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"categorize\":[4],\"placeholder\":[1],\"redirectUrl\":[1,\"redirect-url\"],\"query\":[32],\"searchResults\":[32],\"hideAllButtons\":[32]}]]],[\"chat-avatar_6\",[[0,\"interaction-buttons\",{\"message\":[8],\"chatArray\":[16],\"currentIndex\":[2,\"current-index\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"source\":[1],\"conversationId\":[1,\"conversation-id\"],\"projectId\":[1,\"project-id\"],\"isPlayed\":[32],\"audioElement\":[32],\"copied\":[32]}],[1,\"privacy-modal\",{\"message\":[1],\"show\":[4]}],[0,\"chat-avatar\",{\"senderType\":[1,\"sender-type\"],\"avatarUrl\":[1,\"avatar-url\"]}],[0,\"hamburger-menu\",{\"isToggled\":[1540,\"is-toggled\"],\"messages\":[16],\"botSettings\":[8,\"bot-settings\"],\"isLiveAgentEnabled\":[4,\"is-live-agent-enabled\"],\"liveAgentButtonText\":[1,\"live-agent-button-text\"],\"hasCheckedLiveAgent\":[32]},null,{\"isToggled\":[{\"watchToggled\":0}],\"messages\":[{\"watchMessages\":0}],\"liveAgentButtonText\":[{\"watchLiveAgentButtonText\":0}]}],[257,\"live-agent-chat\",{\"config\":[8],\"isApiReady\":[32],\"startChat\":[64]}],[1,\"typing-indicator\",{\"size\":[2],\"color\":[1],\"spacing\":[2]}]]],[\"image-uploader_2\",[[0,\"image-uploader\",{\"maxImages\":[2,\"max-images\"],\"disabled\":[4],\"images\":[16],\"targetElement\":[16],\"removeImageAtIndex\":[64]},[[4,\"isElementAvailable\",\"handleIsOpened\"],[4,\"capturedImgUpload\",\"handleCapturedImage\"]]],[1,\"keyboard-shortcuts-dialog\",{\"show\":[4],\"shortcuts\":[16],\"groupedShortcuts\":[32]},null,{\"show\":[{\"handleShowChange\":0}],\"shortcuts\":[{\"handleShortcutsChange\":0}]}]]],[\"ai12z-bot\",[[257,\"ai12z-bot\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[520,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"liveAgentButtonText\":[32],\"isLiveAgentEnabled\":[32],\"isTypingIndicatorVisible\":[32],\"botSettings\":[32],\"canRender\":[32],\"voiceType\":[32],\"voice\":[32],\"showSubmit\":[32],\"hideAllButtons\":[32],\"showMenu\":[32],\"isProse\":[32],\"isLiveAgent\":[32],\"isConnectingLiveAgent\":[32],\"showWelcomeScreen\":[32],\"showHistory\":[32],\"conversationId\":[32],\"surveyDomId\":[32],\"searchResults\":[32],\"buttons\":[32],\"currentDomId\":[32],\"messages\":[32],\"questionCounter\":[32],\"visitorID\":[32],\"timestamp\":[32],\"rowCount\":[32],\"isBot\":[32],\"conversationHistory\":[32],\"query\":[32],\"scriptArray\":[32],\"imagesBase64List\":[32],\"focusedIndex\":[32],\"isAnimated\":[32],\"isMinimized\":[32],\"isStreaming\":[32],\"showErrorMessage\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"isOpened\":[32],\"isContent\":[32],\"isExpanded\":[32],\"isToggled\":[32],\"showPrivacy\":[32],\"isRendered\":[32],\"showShortcutsDialog\":[32],\"showLiveAgentEndDialog\":[32],\"liveAgentSessionId\":[32],\"liveAgentConversationId\":[32],\"liveAgentProviderName\":[32],\"liveAgentListenersRegistered\":[32],\"shortcuts\":[32],\"announceMessage\":[32],\"liveAgentDirective\":[32],\"isSending\":[32],\"sendMessage\":[64],\"sendQuery\":[64],\"sendJSON\":[64],\"openBot\":[64],\"action\":[64],\"setProcessDataOverride\":[64],\"configureSettings\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"buttonClick\",\"buttonClickHandler\"],[0,\"sendQueryToBot\",\"sendQueryToBotHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"],[0,\"openChat\",\"openChatHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]]]"), options);
|
|
47
47
|
});
|
package/dist/esm/loader.js
CHANGED
|
@@ -4,7 +4,7 @@ export { s as setNonce } from './index-DrTyKvbY.js';
|
|
|
4
4
|
const defineCustomElements = async (win, options) => {
|
|
5
5
|
if (typeof window === 'undefined') return undefined;
|
|
6
6
|
await globalScripts();
|
|
7
|
-
return bootstrapLazy(JSON.parse("[[\"ai12z-knowledge-box\",[[257,\"ai12z-knowledge-box\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[1537,\"config-id\"],\"question\":[1537],\"socket\":[1032],\"isLoading\":[1028,\"is-loading\"],\"questionId\":[32],\"isInitialized\":[32],\"kbSettings\":[32],\"searchResults\":[32],\"items\":[32],\"error\":[32],\"domId\":[32],\"surveyDomId\":[32],\"buttons\":[32],\"currentStreamingText\":[32],\"isStreaming\":[32],\"finalResponse\":[32],\"scriptArray\":[32],\"showButton\":[32],\"welcomeReady\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},null,{\"question\":[{\"watchPropHandler\":0}],\"domId\":[{\"watchStateHandler\":0}]}]]],[\"dynamic-form\",[[0,\"dynamic-form\",{\"form\":[8],\"formSettings\":[1032,\"form-settings\"],\"formsettings\":[8],\"theme\":[8]}]]],[\"ai12z-spinner\",[[2,\"ai12z-spinner\",{\"class\":[1]}]]],[\"item-list\",[[0,\"item-list\",{\"inputType\":[1,\"input-type\"],\"carouselType\":[1,\"carousel-type\"],\"customTemplate\":[16],\"customSource\":[8,\"custom-source\"],\"llm\":[16],\"customStyles\":[1,\"custom-styles\"],\"customScripts\":[1,\"custom-scripts\"],\"isExpanded\":[4,\"is-expanded\"],\"currentPage\":[32],\"htmlTemplate\":[32],\"currentIndex\":[32],\"formSettings\":[32],\"itemsPerPage\":[32],\"emptyMessage\":[32],\"buttonText\":[32],\"panelTemplate\":[32],\"panelIndex\":[32],\"panelName\":[32],\"items\":[32],\"theme\":[32],\"selectByIndex\":[64],\"selectByName\":[64]}]]],[\"ai12z-beacon\",[[0,\"ai12z-beacon\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"disable\":[516]},null,{\"dataKey\":[{\"onPropChange\":0}],\"dataMode\":[{\"onPropChange\":0}],\"disable\":[{\"onPropChange\":0}]}]]],[\"ai12z-container\",[[1,\"ai12z-container\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"instanceId\":[513,\"instance-id\"],\"parameters\":[513],\"renderType\":[1537,\"render-type\"],\"contentTemplate\":[513,\"content-template\"],\"isLoading\":[32],\"error\":[32],\"contentText\":[32],\"htmlWidgetMarkup\":[32],\"domId\":[32]},null,{\"parameters\":[{\"onParametersChanged\":0}],\"contentTemplate\":[{\"onContentTemplateChanged\":0}]}]]],[\"ai12z-form\",[[1,\"ai12z-form\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"isLoading\":[32],\"error\":[32],\"isReady\":[32],\"honeypotValue\":[32],\"loadDynamicForm\":[64]},null,{\"keyName\":[{\"watchLoadProps\":0}]}]]],[\"ai12z-chat-message\",[[1,\"ai12z-chat-message\",{\"text\":[1],\"streaming\":[4],\"kbSettings\":[8,\"kb-settings\"],\"showButton\":[4,\"show-button\"],\"isExpanded\":[32],\"isCollapsing\":[32],\"canExpand\":[32]},[[4,\"initializeScripts\",\"handleInitializeScripts\"]],{\"text\":[{\"onTextChange\":0}]}]]],[\"ai12z-category_2\",[[0,\"ai12z-category\",{\"categoryList\":[520,\"category-list\"],\"linkTarget\":[513,\"link-target\"]},[[4,\"clearResults\",\"clearResultsHandler\"]],{\"categoryList\":[{\"watchCategoryList\":0}]}],[0,\"audio-recorder\",{\"componentType\":[1,\"component-type\"],\"dataKey\":[32],\"dataMode\":[32],\"isRecording\":[32],\"isProcessing\":[32],\"time\":[32],\"transcript\":[32],\"fullTranscript\":[32],\"isSpeechRecognitionSupported\":[32],\"userCountry\":[32]}]]],[\"ai12z-chat_2\",[[0,\"ai12z-input-form\",{\"isChat\":[4,\"is-chat\"],\"placeholder\":[1],\"buttonText\":[1,\"button-text\"],\"followUpLabel\":[1,\"follow-up-label\"],\"iconSrc\":[1,\"icon-src\"],\"isImageUpload\":[4,\"is-image-upload\"],\"isEnableMic\":[4,\"is-enable-mic\"],\"openMenuUpward\":[4,\"open-menu-upward\"],\"componentType\":[1,\"component-type\"],\"chatLength\":[2,\"chat-length\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"imagesBase64List\":[32],\"showShortcutsDialog\":[32],\"shortcuts\":[32],\"searchInput\":[32],\"submitted\":[32],\"showErrorMessage\":[32],\"hideAllButtons\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32]},[[4,\"stateChanged\",\"stateChangedHandler\"],[4,\"clearInput\",\"clearInputHandler\"]]],[1,\"ai12z-chat\",{\"chatId\":[1,\"chat-id\"],\"chats\":[1032],\"query\":[1025],\"apiKey\":[1,\"api-key\"],\"aiMessageId\":[1025,\"ai-message-id\"],\"imgFiles\":[1032,\"img-files\"],\"env\":[1025],\"conversationId\":[1025,\"conversation-id\"],\"dataAttributes\":[8,\"data-attributes\"],\"chatExcludeTags\":[16],\"chatIncludeTags\":[16],\"target\":[1],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"componentType\":[1,\"component-type\"],\"chatPosition\":[1,\"chat-position\"],\"socketIn\":[16],\"customstyle\":[1],\"customJS\":[1,\"custom-j-s\"],\"avatarUrl\":[1,\"avatar-url\"],\"settings\":[8],\"scrollBottom\":[32],\"copied\":[32],\"isPlayed\":[32],\"buttons\":[32],\"itemList\":[32],\"currentChatData\":[32],\"currentTemplate\":[32],\"currentPage\":[32],\"currentResponse\":[32],\"currentSlide\":[32],\"scriptArray\":[32],\"isProse\":[32],\"isProcessingEndResponse\":[32],\"surveyDomId\":[32],\"focusedIndex\":[32],\"hydrateMessagesFromState\":[64]},[[8,\"streamResponse\",\"streamResponseHandler\"],[8,\"endResponse\",\"endResponseHandler\"],[0,\"buttonClick\",\"buttonClickHandler\"],[4,\"stopStream\",\"stopStreamInputHandler\"],[4,\"startStream\",\"startStreamInputHandler\"]],{\"chats\":[{\"watchHandler\":0}]}]]],[\"ai12z-inline-search\",[[1,\"ai12z-inline-search\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"resultPosition\":[1,\"result-position\"],\"autoSearch\":[4,\"auto-search\"],\"categorize\":[4],\"settings\":[16],\"formData\":[32],\"conversationHistory\":[32],\"searchResults\":[32],\"isOpen\":[32]},[[4,\"survey\",\"surveyHandler\"]]]]],[\"search-results-page\",[[1,\"search-results-page\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"dataAttributes\":[1,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"configId\":[1,\"config-id\"],\"query\":[32],\"searchResultSettings\":[32],\"searchResults\":[32],\"hideAllButtons\":[32],\"isChat\":[32],\"chatHistory\":[32],\"aiMessageId\":[32],\"socketService\":[32],\"thumbsId\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"imgFiles\":[32],\"displayText\":[32],\"showWelcomeTemplate\":[32],\"timer\":[32],\"questionCounter\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32],\"isRendered\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},[[4,\"messageReceived\",\"messageReceivedHandler\"],[4,\"survey\",\"surveyHandler\"]]]]],[\"chatbot-history_2\",[[1,\"chatbot-history\",{\"chatList\":[16],\"botName\":[1,\"bot-name\"],\"chatlogo\":[1],\"heading\":[1],\"styles\":[1],\"scripts\":[1],\"showDeleteModal\":[32],\"chatToDelete\":[32],\"activeId\":[32],\"focusedIndex\":[32]}],[1,\"delete-confirmation-modal\",{\"show\":[4],\"dialogTitle\":[1,\"dialog-title\"],\"message\":[1],\"confirmButtonText\":[1,\"confirm-button-text\"],\"cancelButtonText\":[1,\"cancel-button-text\"]}]]],[\"ai12z-cta\",[[257,\"ai12z-cta\",{\"isCta\":[1028,\"is-cta\"],\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[513,\"data-attributes\"],\"options\":[16],\"excludeTags\":[16],\"includeTags\":[16],\"socketService\":[32],\"ctaSettings\":[32],\"showModal\":[32],\"timer\":[32],\"questionCounter\":[32],\"formData\":[32],\"searchResults\":[32],\"error\":[32],\"conversationId\":[32],\"canRender\":[32],\"chatHistory\":[32],\"isChat\":[32],\"aiMessageId\":[32],\"thumbsId\":[32],\"imgFiles\":[32],\"announceMessage\":[32],\"showHistory\":[32],\"conversationHistory\":[32],\"isRendered\":[32],\"openModal\":[64],\"sendMessage\":[64],\"sendJSON\":[64],\"closeModal\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"survey\",\"surveyHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]],[\"ai12z-search-panel\",[[1,\"ai12z-search-panel\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"categorize\":[4],\"placeholder\":[1],\"redirectUrl\":[1,\"redirect-url\"],\"query\":[32],\"searchResults\":[32],\"hideAllButtons\":[32]}]]],[\"chat-avatar_6\",[[0,\"interaction-buttons\",{\"message\":[8],\"chatArray\":[16],\"currentIndex\":[2,\"current-index\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"source\":[1],\"conversationId\":[1,\"conversation-id\"],\"projectId\":[1,\"project-id\"],\"isPlayed\":[32],\"audioElement\":[32],\"copied\":[32]}],[1,\"privacy-modal\",{\"message\":[1],\"show\":[4]}],[0,\"chat-avatar\",{\"senderType\":[1,\"sender-type\"],\"avatarUrl\":[1,\"avatar-url\"]}],[0,\"hamburger-menu\",{\"isToggled\":[1540,\"is-toggled\"],\"messages\":[16],\"botSettings\":[8,\"bot-settings\"],\"isLiveAgentEnabled\":[4,\"is-live-agent-enabled\"],\"liveAgentButtonText\":[1,\"live-agent-button-text\"],\"hasCheckedLiveAgent\":[32]},null,{\"isToggled\":[{\"watchToggled\":0}],\"messages\":[{\"watchMessages\":0}],\"liveAgentButtonText\":[{\"watchLiveAgentButtonText\":0}]}],[257,\"live-agent-chat\",{\"config\":[8],\"isApiReady\":[32],\"startChat\":[64]}],[1,\"typing-indicator\",{\"size\":[2],\"color\":[1],\"spacing\":[2]}]]],[\"image-uploader_2\",[[0,\"image-uploader\",{\"maxImages\":[2,\"max-images\"],\"disabled\":[4],\"images\":[16],\"targetElement\":[16],\"removeImageAtIndex\":[64]},[[4,\"isElementAvailable\",\"handleIsOpened\"],[4,\"capturedImgUpload\",\"handleCapturedImage\"]]],[1,\"keyboard-shortcuts-dialog\",{\"show\":[4],\"shortcuts\":[16],\"groupedShortcuts\":[32]},null,{\"show\":[{\"handleShowChange\":0}],\"shortcuts\":[{\"handleShortcutsChange\":0}]}]]],[\"ai12z-bot\",[[257,\"ai12z-bot\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[520,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"liveAgentButtonText\":[32],\"isLiveAgentEnabled\":[32],\"isTypingIndicatorVisible\":[32],\"botSettings\":[32],\"canRender\":[32],\"voiceType\":[32],\"voice\":[32],\"showSubmit\":[32],\"hideAllButtons\":[32],\"showMenu\":[32],\"isProse\":[32],\"isLiveAgent\":[32],\"isConnectingLiveAgent\":[32],\"showWelcomeScreen\":[32],\"showHistory\":[32],\"conversationId\":[32],\"surveyDomId\":[32],\"searchResults\":[32],\"buttons\":[32],\"currentDomId\":[32],\"messages\":[32],\"questionCounter\":[32],\"visitorID\":[32],\"timestamp\":[32],\"rowCount\":[32],\"isBot\":[32],\"conversationHistory\":[32],\"query\":[32],\"scriptArray\":[32],\"imagesBase64List\":[32],\"focusedIndex\":[32],\"isAnimated\":[32],\"isMinimized\":[32],\"isStreaming\":[32],\"showErrorMessage\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"isOpened\":[32],\"isContent\":[32],\"isExpanded\":[32],\"isToggled\":[32],\"showPrivacy\":[32],\"isRendered\":[32],\"showShortcutsDialog\":[32],\"showLiveAgentEndDialog\":[32],\"liveAgentSessionId\":[32],\"liveAgentConversationId\":[32],\"liveAgentProviderName\":[32],\"liveAgentListenersRegistered\":[32],\"shortcuts\":[32],\"announceMessage\":[32],\"liveAgentDirective\":[32],\"sendMessage\":[64],\"sendQuery\":[64],\"sendJSON\":[64],\"openBot\":[64],\"action\":[64],\"setProcessDataOverride\":[64],\"configureSettings\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"buttonClick\",\"buttonClickHandler\"],[0,\"sendQueryToBot\",\"sendQueryToBotHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"],[0,\"openChat\",\"openChatHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]]]"), options);
|
|
7
|
+
return bootstrapLazy(JSON.parse("[[\"ai12z-knowledge-box\",[[257,\"ai12z-knowledge-box\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[1537,\"config-id\"],\"question\":[1537],\"socket\":[1032],\"isLoading\":[1028,\"is-loading\"],\"questionId\":[32],\"isInitialized\":[32],\"kbSettings\":[32],\"searchResults\":[32],\"items\":[32],\"error\":[32],\"domId\":[32],\"surveyDomId\":[32],\"buttons\":[32],\"currentStreamingText\":[32],\"isStreaming\":[32],\"finalResponse\":[32],\"scriptArray\":[32],\"showButton\":[32],\"welcomeReady\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},null,{\"question\":[{\"watchPropHandler\":0}],\"domId\":[{\"watchStateHandler\":0}]}]]],[\"dynamic-form\",[[0,\"dynamic-form\",{\"form\":[8],\"formSettings\":[1032,\"form-settings\"],\"formsettings\":[8],\"theme\":[8]}]]],[\"ai12z-spinner\",[[2,\"ai12z-spinner\",{\"class\":[1]}]]],[\"item-list\",[[0,\"item-list\",{\"inputType\":[1,\"input-type\"],\"carouselType\":[1,\"carousel-type\"],\"customTemplate\":[16],\"customSource\":[8,\"custom-source\"],\"llm\":[16],\"customStyles\":[1,\"custom-styles\"],\"customScripts\":[1,\"custom-scripts\"],\"isExpanded\":[4,\"is-expanded\"],\"currentPage\":[32],\"htmlTemplate\":[32],\"currentIndex\":[32],\"formSettings\":[32],\"itemsPerPage\":[32],\"emptyMessage\":[32],\"buttonText\":[32],\"panelTemplate\":[32],\"panelIndex\":[32],\"panelName\":[32],\"items\":[32],\"theme\":[32],\"selectByIndex\":[64],\"selectByName\":[64]}]]],[\"ai12z-beacon\",[[0,\"ai12z-beacon\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"disable\":[516]},null,{\"dataKey\":[{\"onPropChange\":0}],\"dataMode\":[{\"onPropChange\":0}],\"disable\":[{\"onPropChange\":0}]}]]],[\"ai12z-container\",[[1,\"ai12z-container\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"instanceId\":[513,\"instance-id\"],\"parameters\":[513],\"renderType\":[1537,\"render-type\"],\"contentTemplate\":[513,\"content-template\"],\"isLoading\":[32],\"error\":[32],\"contentText\":[32],\"htmlWidgetMarkup\":[32],\"domId\":[32]},null,{\"parameters\":[{\"onParametersChanged\":0}],\"contentTemplate\":[{\"onContentTemplateChanged\":0}]}]]],[\"ai12z-form\",[[1,\"ai12z-form\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"keyName\":[513,\"key-name\"],\"isLoading\":[32],\"error\":[32],\"isReady\":[32],\"honeypotValue\":[32],\"loadDynamicForm\":[64]},null,{\"keyName\":[{\"watchLoadProps\":0}]}]]],[\"ai12z-chat-message\",[[1,\"ai12z-chat-message\",{\"text\":[1],\"streaming\":[4],\"kbSettings\":[8,\"kb-settings\"],\"showButton\":[4,\"show-button\"],\"isExpanded\":[32],\"isCollapsing\":[32],\"canExpand\":[32]},[[4,\"initializeScripts\",\"handleInitializeScripts\"]],{\"text\":[{\"onTextChange\":0}]}]]],[\"ai12z-category_2\",[[0,\"ai12z-category\",{\"categoryList\":[520,\"category-list\"],\"linkTarget\":[513,\"link-target\"]},[[4,\"clearResults\",\"clearResultsHandler\"]],{\"categoryList\":[{\"watchCategoryList\":0}]}],[0,\"audio-recorder\",{\"componentType\":[1,\"component-type\"],\"dataKey\":[32],\"dataMode\":[32],\"isRecording\":[32],\"isProcessing\":[32],\"time\":[32],\"transcript\":[32],\"fullTranscript\":[32],\"isSpeechRecognitionSupported\":[32],\"userCountry\":[32]}]]],[\"ai12z-chat_2\",[[0,\"ai12z-input-form\",{\"isChat\":[4,\"is-chat\"],\"placeholder\":[1],\"buttonText\":[1,\"button-text\"],\"followUpLabel\":[1,\"follow-up-label\"],\"iconSrc\":[1,\"icon-src\"],\"isImageUpload\":[4,\"is-image-upload\"],\"isEnableMic\":[4,\"is-enable-mic\"],\"openMenuUpward\":[4,\"open-menu-upward\"],\"componentType\":[1,\"component-type\"],\"chatLength\":[2,\"chat-length\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"imagesBase64List\":[32],\"showShortcutsDialog\":[32],\"shortcuts\":[32],\"searchInput\":[32],\"submitted\":[32],\"showErrorMessage\":[32],\"hideAllButtons\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32]},[[4,\"stateChanged\",\"stateChangedHandler\"],[4,\"clearInput\",\"clearInputHandler\"]]],[1,\"ai12z-chat\",{\"chatId\":[1,\"chat-id\"],\"chats\":[1032],\"query\":[1025],\"apiKey\":[1,\"api-key\"],\"aiMessageId\":[1025,\"ai-message-id\"],\"imgFiles\":[1032,\"img-files\"],\"env\":[1025],\"conversationId\":[1025,\"conversation-id\"],\"dataAttributes\":[8,\"data-attributes\"],\"chatExcludeTags\":[16],\"chatIncludeTags\":[16],\"target\":[1],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"componentType\":[1,\"component-type\"],\"chatPosition\":[1,\"chat-position\"],\"socketIn\":[16],\"customstyle\":[1],\"customJS\":[1,\"custom-j-s\"],\"avatarUrl\":[1,\"avatar-url\"],\"settings\":[8],\"scrollBottom\":[32],\"copied\":[32],\"isPlayed\":[32],\"buttons\":[32],\"itemList\":[32],\"currentChatData\":[32],\"currentTemplate\":[32],\"currentPage\":[32],\"currentResponse\":[32],\"currentSlide\":[32],\"scriptArray\":[32],\"isProse\":[32],\"isProcessingEndResponse\":[32],\"surveyDomId\":[32],\"focusedIndex\":[32],\"hydrateMessagesFromState\":[64]},[[8,\"streamResponse\",\"streamResponseHandler\"],[8,\"endResponse\",\"endResponseHandler\"],[0,\"buttonClick\",\"buttonClickHandler\"],[4,\"stopStream\",\"stopStreamInputHandler\"],[4,\"startStream\",\"startStreamInputHandler\"]],{\"chats\":[{\"watchHandler\":0}]}]]],[\"ai12z-inline-search\",[[1,\"ai12z-inline-search\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"resultPosition\":[1,\"result-position\"],\"autoSearch\":[4,\"auto-search\"],\"categorize\":[4],\"settings\":[16],\"formData\":[32],\"conversationHistory\":[32],\"searchResults\":[32],\"isOpen\":[32]},[[4,\"survey\",\"surveyHandler\"]]]]],[\"search-results-page\",[[1,\"search-results-page\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"dataAttributes\":[1,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"configId\":[1,\"config-id\"],\"query\":[32],\"searchResultSettings\":[32],\"searchResults\":[32],\"hideAllButtons\":[32],\"isChat\":[32],\"chatHistory\":[32],\"aiMessageId\":[32],\"socketService\":[32],\"thumbsId\":[32],\"isOpen\":[32],\"capturedFile\":[32],\"imgFiles\":[32],\"displayText\":[32],\"showWelcomeTemplate\":[32],\"timer\":[32],\"questionCounter\":[32],\"emptyMessageError\":[32],\"announceMessage\":[32],\"isRendered\":[32],\"sendMessage\":[64],\"sendJSON\":[64]},[[4,\"messageReceived\",\"messageReceivedHandler\"],[4,\"survey\",\"surveyHandler\"]]]]],[\"chatbot-history_2\",[[1,\"chatbot-history\",{\"chatList\":[16],\"botName\":[1,\"bot-name\"],\"chatlogo\":[1],\"heading\":[1],\"styles\":[1],\"scripts\":[1],\"showDeleteModal\":[32],\"chatToDelete\":[32],\"activeId\":[32],\"focusedIndex\":[32]}],[1,\"delete-confirmation-modal\",{\"show\":[4],\"dialogTitle\":[1,\"dialog-title\"],\"message\":[1],\"confirmButtonText\":[1,\"confirm-button-text\"],\"cancelButtonText\":[1,\"cancel-button-text\"]}]]],[\"ai12z-cta\",[[257,\"ai12z-cta\",{\"isCta\":[1028,\"is-cta\"],\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[513,\"data-attributes\"],\"options\":[16],\"excludeTags\":[16],\"includeTags\":[16],\"socketService\":[32],\"ctaSettings\":[32],\"showModal\":[32],\"timer\":[32],\"questionCounter\":[32],\"formData\":[32],\"searchResults\":[32],\"error\":[32],\"conversationId\":[32],\"canRender\":[32],\"chatHistory\":[32],\"isChat\":[32],\"aiMessageId\":[32],\"thumbsId\":[32],\"imgFiles\":[32],\"announceMessage\":[32],\"showHistory\":[32],\"conversationHistory\":[32],\"isRendered\":[32],\"openModal\":[64],\"sendMessage\":[64],\"sendJSON\":[64],\"closeModal\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"survey\",\"surveyHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]],[\"ai12z-search-panel\",[[1,\"ai12z-search-panel\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"categorize\":[4],\"placeholder\":[1],\"redirectUrl\":[1,\"redirect-url\"],\"query\":[32],\"searchResults\":[32],\"hideAllButtons\":[32]}]]],[\"chat-avatar_6\",[[0,\"interaction-buttons\",{\"message\":[8],\"chatArray\":[16],\"currentIndex\":[2,\"current-index\"],\"dataKey\":[1,\"data-key\"],\"dataMode\":[1,\"data-mode\"],\"voiceType\":[1,\"voice-type\"],\"voice\":[1],\"source\":[1],\"conversationId\":[1,\"conversation-id\"],\"projectId\":[1,\"project-id\"],\"isPlayed\":[32],\"audioElement\":[32],\"copied\":[32]}],[1,\"privacy-modal\",{\"message\":[1],\"show\":[4]}],[0,\"chat-avatar\",{\"senderType\":[1,\"sender-type\"],\"avatarUrl\":[1,\"avatar-url\"]}],[0,\"hamburger-menu\",{\"isToggled\":[1540,\"is-toggled\"],\"messages\":[16],\"botSettings\":[8,\"bot-settings\"],\"isLiveAgentEnabled\":[4,\"is-live-agent-enabled\"],\"liveAgentButtonText\":[1,\"live-agent-button-text\"],\"hasCheckedLiveAgent\":[32]},null,{\"isToggled\":[{\"watchToggled\":0}],\"messages\":[{\"watchMessages\":0}],\"liveAgentButtonText\":[{\"watchLiveAgentButtonText\":0}]}],[257,\"live-agent-chat\",{\"config\":[8],\"isApiReady\":[32],\"startChat\":[64]}],[1,\"typing-indicator\",{\"size\":[2],\"color\":[1],\"spacing\":[2]}]]],[\"image-uploader_2\",[[0,\"image-uploader\",{\"maxImages\":[2,\"max-images\"],\"disabled\":[4],\"images\":[16],\"targetElement\":[16],\"removeImageAtIndex\":[64]},[[4,\"isElementAvailable\",\"handleIsOpened\"],[4,\"capturedImgUpload\",\"handleCapturedImage\"]]],[1,\"keyboard-shortcuts-dialog\",{\"show\":[4],\"shortcuts\":[16],\"groupedShortcuts\":[32]},null,{\"show\":[{\"handleShowChange\":0}],\"shortcuts\":[{\"handleShortcutsChange\":0}]}]]],[\"ai12z-bot\",[[257,\"ai12z-bot\",{\"dataKey\":[513,\"data-key\"],\"dataMode\":[513,\"data-mode\"],\"configId\":[513,\"config-id\"],\"dataAttributes\":[520,\"data-attributes\"],\"excludeTags\":[16],\"includeTags\":[16],\"liveAgentButtonText\":[32],\"isLiveAgentEnabled\":[32],\"isTypingIndicatorVisible\":[32],\"botSettings\":[32],\"canRender\":[32],\"voiceType\":[32],\"voice\":[32],\"showSubmit\":[32],\"hideAllButtons\":[32],\"showMenu\":[32],\"isProse\":[32],\"isLiveAgent\":[32],\"isConnectingLiveAgent\":[32],\"showWelcomeScreen\":[32],\"showHistory\":[32],\"conversationId\":[32],\"surveyDomId\":[32],\"searchResults\":[32],\"buttons\":[32],\"currentDomId\":[32],\"messages\":[32],\"questionCounter\":[32],\"visitorID\":[32],\"timestamp\":[32],\"rowCount\":[32],\"isBot\":[32],\"conversationHistory\":[32],\"query\":[32],\"scriptArray\":[32],\"imagesBase64List\":[32],\"focusedIndex\":[32],\"isAnimated\":[32],\"isMinimized\":[32],\"isStreaming\":[32],\"showErrorMessage\":[32],\"errorMessage\":[32],\"emptyMessageError\":[32],\"isOpened\":[32],\"isContent\":[32],\"isExpanded\":[32],\"isToggled\":[32],\"showPrivacy\":[32],\"isRendered\":[32],\"showShortcutsDialog\":[32],\"showLiveAgentEndDialog\":[32],\"liveAgentSessionId\":[32],\"liveAgentConversationId\":[32],\"liveAgentProviderName\":[32],\"liveAgentListenersRegistered\":[32],\"shortcuts\":[32],\"announceMessage\":[32],\"liveAgentDirective\":[32],\"isSending\":[32],\"sendMessage\":[64],\"sendQuery\":[64],\"sendJSON\":[64],\"openBot\":[64],\"action\":[64],\"setProcessDataOverride\":[64],\"configureSettings\":[64]},[[0,\"keydown\",\"handleKeyDown\"],[0,\"buttonClick\",\"buttonClickHandler\"],[0,\"sendQueryToBot\",\"sendQueryToBotHandler\"],[0,\"deleteChatHistory\",\"deleteChatHistoryHandler\"],[0,\"chatClick\",\"chatClickHandler\"],[0,\"openChat\",\"openChatHandler\"],[0,\"formComplete\",\"formSubmittedHandler\"]],{\"dataKey\":[{\"onDataKeyChange\":0}],\"dataMode\":[{\"onDataModeChange\":0}]}]]]]"), options);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { defineCustomElements };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,B as t,c as a,H as n,w as o,N as i,g as r,b as d}from"./p-DrTyKvbY.js";export{s as setNonce}from"./p-DrTyKvbY.js";var c=e=>{const t=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return t.call(this,e);const a=t.call(this,!1),s=this.childNodes;if(e)for(let e=0;e<s.length;e++)2!==s[e].nodeType&&a.appendChild(s[e].cloneNode(!0));return a}};(()=>{t.isDev&&!t.isTesting&&a("Running in development mode."),t.cloneNodeFix&&c(n.prototype);const s=t.scriptDataOpts?o.document&&Array.from(o.document.querySelectorAll("script")).find((e=>new RegExp(`/${i}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===i)):null,r=import.meta.url,d=t.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==r&&(d.resourcesUrl=new URL(".",r).href),e(d)})().then((async e=>(await r(),d(JSON.parse('[["p-8421d322",[[257,"ai12z-knowledge-box",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"configId":[1537,"config-id"],"question":[1537],"socket":[1032],"isLoading":[1028,"is-loading"],"questionId":[32],"isInitialized":[32],"kbSettings":[32],"searchResults":[32],"items":[32],"error":[32],"domId":[32],"surveyDomId":[32],"buttons":[32],"currentStreamingText":[32],"isStreaming":[32],"finalResponse":[32],"scriptArray":[32],"showButton":[32],"welcomeReady":[32],"sendMessage":[64],"sendJSON":[64]},null,{"question":[{"watchPropHandler":0}],"domId":[{"watchStateHandler":0}]}]]],["p-cee8f0d9",[[0,"dynamic-form",{"form":[8],"formSettings":[1032,"form-settings"],"formsettings":[8],"theme":[8]}]]],["p-9f812fb1",[[2,"ai12z-spinner",{"class":[1]}]]],["p-399cbd12",[[0,"item-list",{"inputType":[1,"input-type"],"carouselType":[1,"carousel-type"],"customTemplate":[16],"customSource":[8,"custom-source"],"llm":[16],"customStyles":[1,"custom-styles"],"customScripts":[1,"custom-scripts"],"isExpanded":[4,"is-expanded"],"currentPage":[32],"htmlTemplate":[32],"currentIndex":[32],"formSettings":[32],"itemsPerPage":[32],"emptyMessage":[32],"buttonText":[32],"panelTemplate":[32],"panelIndex":[32],"panelName":[32],"items":[32],"theme":[32],"selectByIndex":[64],"selectByName":[64]}]]],["p-5d06fa91",[[0,"ai12z-beacon",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"disable":[516]},null,{"dataKey":[{"onPropChange":0}],"dataMode":[{"onPropChange":0}],"disable":[{"onPropChange":0}]}]]],["p-011b77dd",[[1,"ai12z-container",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"keyName":[513,"key-name"],"instanceId":[513,"instance-id"],"parameters":[513],"renderType":[1537,"render-type"],"contentTemplate":[513,"content-template"],"isLoading":[32],"error":[32],"contentText":[32],"htmlWidgetMarkup":[32],"domId":[32]},null,{"parameters":[{"onParametersChanged":0}],"contentTemplate":[{"onContentTemplateChanged":0}]}]]],["p-acaf89a9",[[1,"ai12z-form",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"keyName":[513,"key-name"],"isLoading":[32],"error":[32],"isReady":[32],"honeypotValue":[32],"loadDynamicForm":[64]},null,{"keyName":[{"watchLoadProps":0}]}]]],["p-cc717ebf",[[1,"ai12z-chat-message",{"text":[1],"streaming":[4],"kbSettings":[8,"kb-settings"],"showButton":[4,"show-button"],"isExpanded":[32],"isCollapsing":[32],"canExpand":[32]},[[4,"initializeScripts","handleInitializeScripts"]],{"text":[{"onTextChange":0}]}]]],["p-901079eb",[[0,"ai12z-category",{"categoryList":[520,"category-list"],"linkTarget":[513,"link-target"]},[[4,"clearResults","clearResultsHandler"]],{"categoryList":[{"watchCategoryList":0}]}],[0,"audio-recorder",{"componentType":[1,"component-type"],"dataKey":[32],"dataMode":[32],"isRecording":[32],"isProcessing":[32],"time":[32],"transcript":[32],"fullTranscript":[32],"isSpeechRecognitionSupported":[32],"userCountry":[32]}]]],["p-c580c2ec",[[0,"ai12z-input-form",{"isChat":[4,"is-chat"],"placeholder":[1],"buttonText":[1,"button-text"],"followUpLabel":[1,"follow-up-label"],"iconSrc":[1,"icon-src"],"isImageUpload":[4,"is-image-upload"],"isEnableMic":[4,"is-enable-mic"],"openMenuUpward":[4,"open-menu-upward"],"componentType":[1,"component-type"],"chatLength":[2,"chat-length"],"dataKey":[1,"data-key"],"dataMode":[1,"data-mode"],"imagesBase64List":[32],"showShortcutsDialog":[32],"shortcuts":[32],"searchInput":[32],"submitted":[32],"showErrorMessage":[32],"hideAllButtons":[32],"isOpen":[32],"capturedFile":[32],"errorMessage":[32],"emptyMessageError":[32],"announceMessage":[32]},[[4,"stateChanged","stateChangedHandler"],[4,"clearInput","clearInputHandler"]]],[1,"ai12z-chat",{"chatId":[1,"chat-id"],"chats":[1032],"query":[1025],"apiKey":[1,"api-key"],"aiMessageId":[1025,"ai-message-id"],"imgFiles":[1032,"img-files"],"env":[1025],"conversationId":[1025,"conversation-id"],"dataAttributes":[8,"data-attributes"],"chatExcludeTags":[16],"chatIncludeTags":[16],"target":[1],"voiceType":[1,"voice-type"],"voice":[1],"componentType":[1,"component-type"],"chatPosition":[1,"chat-position"],"socketIn":[16],"customstyle":[1],"customJS":[1,"custom-j-s"],"avatarUrl":[1,"avatar-url"],"settings":[8],"scrollBottom":[32],"copied":[32],"isPlayed":[32],"buttons":[32],"itemList":[32],"currentChatData":[32],"currentTemplate":[32],"currentPage":[32],"currentResponse":[32],"currentSlide":[32],"scriptArray":[32],"isProse":[32],"isProcessingEndResponse":[32],"surveyDomId":[32],"focusedIndex":[32],"hydrateMessagesFromState":[64]},[[8,"streamResponse","streamResponseHandler"],[8,"endResponse","endResponseHandler"],[0,"buttonClick","buttonClickHandler"],[4,"stopStream","stopStreamInputHandler"],[4,"startStream","startStreamInputHandler"]],{"chats":[{"watchHandler":0}]}]]],["p-26ae3f92",[[1,"ai12z-inline-search",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"resultPosition":[1,"result-position"],"autoSearch":[4,"auto-search"],"categorize":[4],"settings":[16],"formData":[32],"conversationHistory":[32],"searchResults":[32],"isOpen":[32]},[[4,"survey","surveyHandler"]]]]],["p-27e7129a",[[1,"search-results-page",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"dataAttributes":[1,"data-attributes"],"excludeTags":[16],"includeTags":[16],"configId":[1,"config-id"],"query":[32],"searchResultSettings":[32],"searchResults":[32],"hideAllButtons":[32],"isChat":[32],"chatHistory":[32],"aiMessageId":[32],"socketService":[32],"thumbsId":[32],"isOpen":[32],"capturedFile":[32],"imgFiles":[32],"displayText":[32],"showWelcomeTemplate":[32],"timer":[32],"questionCounter":[32],"emptyMessageError":[32],"announceMessage":[32],"isRendered":[32],"sendMessage":[64],"sendJSON":[64]},[[4,"messageReceived","messageReceivedHandler"],[4,"survey","surveyHandler"]]]]],["p-64e9659d",[[1,"chatbot-history",{"chatList":[16],"botName":[1,"bot-name"],"chatlogo":[1],"heading":[1],"styles":[1],"scripts":[1],"showDeleteModal":[32],"chatToDelete":[32],"activeId":[32],"focusedIndex":[32]}],[1,"delete-confirmation-modal",{"show":[4],"dialogTitle":[1,"dialog-title"],"message":[1],"confirmButtonText":[1,"confirm-button-text"],"cancelButtonText":[1,"cancel-button-text"]}]]],["p-f0da6325",[[257,"ai12z-cta",{"isCta":[1028,"is-cta"],"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"configId":[513,"config-id"],"dataAttributes":[513,"data-attributes"],"options":[16],"excludeTags":[16],"includeTags":[16],"socketService":[32],"ctaSettings":[32],"showModal":[32],"timer":[32],"questionCounter":[32],"formData":[32],"searchResults":[32],"error":[32],"conversationId":[32],"canRender":[32],"chatHistory":[32],"isChat":[32],"aiMessageId":[32],"thumbsId":[32],"imgFiles":[32],"announceMessage":[32],"showHistory":[32],"conversationHistory":[32],"isRendered":[32],"openModal":[64],"sendMessage":[64],"sendJSON":[64],"closeModal":[64]},[[0,"keydown","handleKeyDown"],[0,"survey","surveyHandler"],[0,"formComplete","formSubmittedHandler"],[0,"deleteChatHistory","deleteChatHistoryHandler"],[0,"chatClick","chatClickHandler"]],{"dataKey":[{"onDataKeyChange":0}],"dataMode":[{"onDataModeChange":0}]}]]],["p-3fc2b8d9",[[1,"ai12z-search-panel",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"categorize":[4],"placeholder":[1],"redirectUrl":[1,"redirect-url"],"query":[32],"searchResults":[32],"hideAllButtons":[32]}]]],["p-61d61d51",[[0,"interaction-buttons",{"message":[8],"chatArray":[16],"currentIndex":[2,"current-index"],"dataKey":[1,"data-key"],"dataMode":[1,"data-mode"],"voiceType":[1,"voice-type"],"voice":[1],"source":[1],"conversationId":[1,"conversation-id"],"projectId":[1,"project-id"],"isPlayed":[32],"audioElement":[32],"copied":[32]}],[1,"privacy-modal",{"message":[1],"show":[4]}],[0,"chat-avatar",{"senderType":[1,"sender-type"],"avatarUrl":[1,"avatar-url"]}],[0,"hamburger-menu",{"isToggled":[1540,"is-toggled"],"messages":[16],"botSettings":[8,"bot-settings"],"isLiveAgentEnabled":[4,"is-live-agent-enabled"],"liveAgentButtonText":[1,"live-agent-button-text"],"hasCheckedLiveAgent":[32]},null,{"isToggled":[{"watchToggled":0}],"messages":[{"watchMessages":0}],"liveAgentButtonText":[{"watchLiveAgentButtonText":0}]}],[257,"live-agent-chat",{"config":[8],"isApiReady":[32],"startChat":[64]}],[1,"typing-indicator",{"size":[2],"color":[1],"spacing":[2]}]]],["p-c76d1511",[[0,"image-uploader",{"maxImages":[2,"max-images"],"disabled":[4],"images":[16],"targetElement":[16],"removeImageAtIndex":[64]},[[4,"isElementAvailable","handleIsOpened"],[4,"capturedImgUpload","handleCapturedImage"]]],[1,"keyboard-shortcuts-dialog",{"show":[4],"shortcuts":[16],"groupedShortcuts":[32]},null,{"show":[{"handleShowChange":0}],"shortcuts":[{"handleShortcutsChange":0}]}]]],["p-d70f0bde",[[257,"ai12z-bot",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"configId":[513,"config-id"],"dataAttributes":[520,"data-attributes"],"excludeTags":[16],"includeTags":[16],"liveAgentButtonText":[32],"isLiveAgentEnabled":[32],"isTypingIndicatorVisible":[32],"botSettings":[32],"canRender":[32],"voiceType":[32],"voice":[32],"showSubmit":[32],"hideAllButtons":[32],"showMenu":[32],"isProse":[32],"isLiveAgent":[32],"isConnectingLiveAgent":[32],"showWelcomeScreen":[32],"showHistory":[32],"conversationId":[32],"surveyDomId":[32],"searchResults":[32],"buttons":[32],"currentDomId":[32],"messages":[32],"questionCounter":[32],"visitorID":[32],"timestamp":[32],"rowCount":[32],"isBot":[32],"conversationHistory":[32],"query":[32],"scriptArray":[32],"imagesBase64List":[32],"focusedIndex":[32],"isAnimated":[32],"isMinimized":[32],"isStreaming":[32],"showErrorMessage":[32],"errorMessage":[32],"emptyMessageError":[32],"isOpened":[32],"isContent":[32],"isExpanded":[32],"isToggled":[32],"showPrivacy":[32],"isRendered":[32],"showShortcutsDialog":[32],"showLiveAgentEndDialog":[32],"liveAgentSessionId":[32],"liveAgentConversationId":[32],"liveAgentProviderName":[32],"liveAgentListenersRegistered":[32],"shortcuts":[32],"announceMessage":[32],"liveAgentDirective":[32],"sendMessage":[64],"sendQuery":[64],"sendJSON":[64],"openBot":[64],"action":[64],"setProcessDataOverride":[64],"configureSettings":[64]},[[0,"keydown","handleKeyDown"],[0,"buttonClick","buttonClickHandler"],[0,"sendQueryToBot","sendQueryToBotHandler"],[0,"deleteChatHistory","deleteChatHistoryHandler"],[0,"chatClick","chatClickHandler"],[0,"openChat","openChatHandler"],[0,"formComplete","formSubmittedHandler"]],{"dataKey":[{"onDataKeyChange":0}],"dataMode":[{"onDataModeChange":0}]}]]]]'),e))));
|
|
1
|
+
import{p as e,B as t,c as a,H as n,w as o,N as i,g as r,b as d}from"./p-DrTyKvbY.js";export{s as setNonce}from"./p-DrTyKvbY.js";var c=e=>{const t=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return t.call(this,e);const a=t.call(this,!1),s=this.childNodes;if(e)for(let e=0;e<s.length;e++)2!==s[e].nodeType&&a.appendChild(s[e].cloneNode(!0));return a}};(()=>{t.isDev&&!t.isTesting&&a("Running in development mode."),t.cloneNodeFix&&c(n.prototype);const s=t.scriptDataOpts?o.document&&Array.from(o.document.querySelectorAll("script")).find((e=>new RegExp(`/${i}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===i)):null,r=import.meta.url,d=t.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==r&&(d.resourcesUrl=new URL(".",r).href),e(d)})().then((async e=>(await r(),d(JSON.parse('[["p-8421d322",[[257,"ai12z-knowledge-box",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"configId":[1537,"config-id"],"question":[1537],"socket":[1032],"isLoading":[1028,"is-loading"],"questionId":[32],"isInitialized":[32],"kbSettings":[32],"searchResults":[32],"items":[32],"error":[32],"domId":[32],"surveyDomId":[32],"buttons":[32],"currentStreamingText":[32],"isStreaming":[32],"finalResponse":[32],"scriptArray":[32],"showButton":[32],"welcomeReady":[32],"sendMessage":[64],"sendJSON":[64]},null,{"question":[{"watchPropHandler":0}],"domId":[{"watchStateHandler":0}]}]]],["p-cee8f0d9",[[0,"dynamic-form",{"form":[8],"formSettings":[1032,"form-settings"],"formsettings":[8],"theme":[8]}]]],["p-9f812fb1",[[2,"ai12z-spinner",{"class":[1]}]]],["p-399cbd12",[[0,"item-list",{"inputType":[1,"input-type"],"carouselType":[1,"carousel-type"],"customTemplate":[16],"customSource":[8,"custom-source"],"llm":[16],"customStyles":[1,"custom-styles"],"customScripts":[1,"custom-scripts"],"isExpanded":[4,"is-expanded"],"currentPage":[32],"htmlTemplate":[32],"currentIndex":[32],"formSettings":[32],"itemsPerPage":[32],"emptyMessage":[32],"buttonText":[32],"panelTemplate":[32],"panelIndex":[32],"panelName":[32],"items":[32],"theme":[32],"selectByIndex":[64],"selectByName":[64]}]]],["p-5d06fa91",[[0,"ai12z-beacon",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"disable":[516]},null,{"dataKey":[{"onPropChange":0}],"dataMode":[{"onPropChange":0}],"disable":[{"onPropChange":0}]}]]],["p-011b77dd",[[1,"ai12z-container",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"keyName":[513,"key-name"],"instanceId":[513,"instance-id"],"parameters":[513],"renderType":[1537,"render-type"],"contentTemplate":[513,"content-template"],"isLoading":[32],"error":[32],"contentText":[32],"htmlWidgetMarkup":[32],"domId":[32]},null,{"parameters":[{"onParametersChanged":0}],"contentTemplate":[{"onContentTemplateChanged":0}]}]]],["p-acaf89a9",[[1,"ai12z-form",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"keyName":[513,"key-name"],"isLoading":[32],"error":[32],"isReady":[32],"honeypotValue":[32],"loadDynamicForm":[64]},null,{"keyName":[{"watchLoadProps":0}]}]]],["p-cc717ebf",[[1,"ai12z-chat-message",{"text":[1],"streaming":[4],"kbSettings":[8,"kb-settings"],"showButton":[4,"show-button"],"isExpanded":[32],"isCollapsing":[32],"canExpand":[32]},[[4,"initializeScripts","handleInitializeScripts"]],{"text":[{"onTextChange":0}]}]]],["p-901079eb",[[0,"ai12z-category",{"categoryList":[520,"category-list"],"linkTarget":[513,"link-target"]},[[4,"clearResults","clearResultsHandler"]],{"categoryList":[{"watchCategoryList":0}]}],[0,"audio-recorder",{"componentType":[1,"component-type"],"dataKey":[32],"dataMode":[32],"isRecording":[32],"isProcessing":[32],"time":[32],"transcript":[32],"fullTranscript":[32],"isSpeechRecognitionSupported":[32],"userCountry":[32]}]]],["p-c580c2ec",[[0,"ai12z-input-form",{"isChat":[4,"is-chat"],"placeholder":[1],"buttonText":[1,"button-text"],"followUpLabel":[1,"follow-up-label"],"iconSrc":[1,"icon-src"],"isImageUpload":[4,"is-image-upload"],"isEnableMic":[4,"is-enable-mic"],"openMenuUpward":[4,"open-menu-upward"],"componentType":[1,"component-type"],"chatLength":[2,"chat-length"],"dataKey":[1,"data-key"],"dataMode":[1,"data-mode"],"imagesBase64List":[32],"showShortcutsDialog":[32],"shortcuts":[32],"searchInput":[32],"submitted":[32],"showErrorMessage":[32],"hideAllButtons":[32],"isOpen":[32],"capturedFile":[32],"errorMessage":[32],"emptyMessageError":[32],"announceMessage":[32]},[[4,"stateChanged","stateChangedHandler"],[4,"clearInput","clearInputHandler"]]],[1,"ai12z-chat",{"chatId":[1,"chat-id"],"chats":[1032],"query":[1025],"apiKey":[1,"api-key"],"aiMessageId":[1025,"ai-message-id"],"imgFiles":[1032,"img-files"],"env":[1025],"conversationId":[1025,"conversation-id"],"dataAttributes":[8,"data-attributes"],"chatExcludeTags":[16],"chatIncludeTags":[16],"target":[1],"voiceType":[1,"voice-type"],"voice":[1],"componentType":[1,"component-type"],"chatPosition":[1,"chat-position"],"socketIn":[16],"customstyle":[1],"customJS":[1,"custom-j-s"],"avatarUrl":[1,"avatar-url"],"settings":[8],"scrollBottom":[32],"copied":[32],"isPlayed":[32],"buttons":[32],"itemList":[32],"currentChatData":[32],"currentTemplate":[32],"currentPage":[32],"currentResponse":[32],"currentSlide":[32],"scriptArray":[32],"isProse":[32],"isProcessingEndResponse":[32],"surveyDomId":[32],"focusedIndex":[32],"hydrateMessagesFromState":[64]},[[8,"streamResponse","streamResponseHandler"],[8,"endResponse","endResponseHandler"],[0,"buttonClick","buttonClickHandler"],[4,"stopStream","stopStreamInputHandler"],[4,"startStream","startStreamInputHandler"]],{"chats":[{"watchHandler":0}]}]]],["p-26ae3f92",[[1,"ai12z-inline-search",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"resultPosition":[1,"result-position"],"autoSearch":[4,"auto-search"],"categorize":[4],"settings":[16],"formData":[32],"conversationHistory":[32],"searchResults":[32],"isOpen":[32]},[[4,"survey","surveyHandler"]]]]],["p-27e7129a",[[1,"search-results-page",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"dataAttributes":[1,"data-attributes"],"excludeTags":[16],"includeTags":[16],"configId":[1,"config-id"],"query":[32],"searchResultSettings":[32],"searchResults":[32],"hideAllButtons":[32],"isChat":[32],"chatHistory":[32],"aiMessageId":[32],"socketService":[32],"thumbsId":[32],"isOpen":[32],"capturedFile":[32],"imgFiles":[32],"displayText":[32],"showWelcomeTemplate":[32],"timer":[32],"questionCounter":[32],"emptyMessageError":[32],"announceMessage":[32],"isRendered":[32],"sendMessage":[64],"sendJSON":[64]},[[4,"messageReceived","messageReceivedHandler"],[4,"survey","surveyHandler"]]]]],["p-64e9659d",[[1,"chatbot-history",{"chatList":[16],"botName":[1,"bot-name"],"chatlogo":[1],"heading":[1],"styles":[1],"scripts":[1],"showDeleteModal":[32],"chatToDelete":[32],"activeId":[32],"focusedIndex":[32]}],[1,"delete-confirmation-modal",{"show":[4],"dialogTitle":[1,"dialog-title"],"message":[1],"confirmButtonText":[1,"confirm-button-text"],"cancelButtonText":[1,"cancel-button-text"]}]]],["p-f0da6325",[[257,"ai12z-cta",{"isCta":[1028,"is-cta"],"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"configId":[513,"config-id"],"dataAttributes":[513,"data-attributes"],"options":[16],"excludeTags":[16],"includeTags":[16],"socketService":[32],"ctaSettings":[32],"showModal":[32],"timer":[32],"questionCounter":[32],"formData":[32],"searchResults":[32],"error":[32],"conversationId":[32],"canRender":[32],"chatHistory":[32],"isChat":[32],"aiMessageId":[32],"thumbsId":[32],"imgFiles":[32],"announceMessage":[32],"showHistory":[32],"conversationHistory":[32],"isRendered":[32],"openModal":[64],"sendMessage":[64],"sendJSON":[64],"closeModal":[64]},[[0,"keydown","handleKeyDown"],[0,"survey","surveyHandler"],[0,"formComplete","formSubmittedHandler"],[0,"deleteChatHistory","deleteChatHistoryHandler"],[0,"chatClick","chatClickHandler"]],{"dataKey":[{"onDataKeyChange":0}],"dataMode":[{"onDataModeChange":0}]}]]],["p-3fc2b8d9",[[1,"ai12z-search-panel",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"categorize":[4],"placeholder":[1],"redirectUrl":[1,"redirect-url"],"query":[32],"searchResults":[32],"hideAllButtons":[32]}]]],["p-61d61d51",[[0,"interaction-buttons",{"message":[8],"chatArray":[16],"currentIndex":[2,"current-index"],"dataKey":[1,"data-key"],"dataMode":[1,"data-mode"],"voiceType":[1,"voice-type"],"voice":[1],"source":[1],"conversationId":[1,"conversation-id"],"projectId":[1,"project-id"],"isPlayed":[32],"audioElement":[32],"copied":[32]}],[1,"privacy-modal",{"message":[1],"show":[4]}],[0,"chat-avatar",{"senderType":[1,"sender-type"],"avatarUrl":[1,"avatar-url"]}],[0,"hamburger-menu",{"isToggled":[1540,"is-toggled"],"messages":[16],"botSettings":[8,"bot-settings"],"isLiveAgentEnabled":[4,"is-live-agent-enabled"],"liveAgentButtonText":[1,"live-agent-button-text"],"hasCheckedLiveAgent":[32]},null,{"isToggled":[{"watchToggled":0}],"messages":[{"watchMessages":0}],"liveAgentButtonText":[{"watchLiveAgentButtonText":0}]}],[257,"live-agent-chat",{"config":[8],"isApiReady":[32],"startChat":[64]}],[1,"typing-indicator",{"size":[2],"color":[1],"spacing":[2]}]]],["p-c76d1511",[[0,"image-uploader",{"maxImages":[2,"max-images"],"disabled":[4],"images":[16],"targetElement":[16],"removeImageAtIndex":[64]},[[4,"isElementAvailable","handleIsOpened"],[4,"capturedImgUpload","handleCapturedImage"]]],[1,"keyboard-shortcuts-dialog",{"show":[4],"shortcuts":[16],"groupedShortcuts":[32]},null,{"show":[{"handleShowChange":0}],"shortcuts":[{"handleShortcutsChange":0}]}]]],["p-8cca467d",[[257,"ai12z-bot",{"dataKey":[513,"data-key"],"dataMode":[513,"data-mode"],"configId":[513,"config-id"],"dataAttributes":[520,"data-attributes"],"excludeTags":[16],"includeTags":[16],"liveAgentButtonText":[32],"isLiveAgentEnabled":[32],"isTypingIndicatorVisible":[32],"botSettings":[32],"canRender":[32],"voiceType":[32],"voice":[32],"showSubmit":[32],"hideAllButtons":[32],"showMenu":[32],"isProse":[32],"isLiveAgent":[32],"isConnectingLiveAgent":[32],"showWelcomeScreen":[32],"showHistory":[32],"conversationId":[32],"surveyDomId":[32],"searchResults":[32],"buttons":[32],"currentDomId":[32],"messages":[32],"questionCounter":[32],"visitorID":[32],"timestamp":[32],"rowCount":[32],"isBot":[32],"conversationHistory":[32],"query":[32],"scriptArray":[32],"imagesBase64List":[32],"focusedIndex":[32],"isAnimated":[32],"isMinimized":[32],"isStreaming":[32],"showErrorMessage":[32],"errorMessage":[32],"emptyMessageError":[32],"isOpened":[32],"isContent":[32],"isExpanded":[32],"isToggled":[32],"showPrivacy":[32],"isRendered":[32],"showShortcutsDialog":[32],"showLiveAgentEndDialog":[32],"liveAgentSessionId":[32],"liveAgentConversationId":[32],"liveAgentProviderName":[32],"liveAgentListenersRegistered":[32],"shortcuts":[32],"announceMessage":[32],"liveAgentDirective":[32],"isSending":[32],"sendMessage":[64],"sendQuery":[64],"sendJSON":[64],"openBot":[64],"action":[64],"setProcessDataOverride":[64],"configureSettings":[64]},[[0,"keydown","handleKeyDown"],[0,"buttonClick","buttonClickHandler"],[0,"sendQueryToBot","sendQueryToBotHandler"],[0,"deleteChatHistory","deleteChatHistoryHandler"],[0,"chatClick","chatClickHandler"],[0,"openChat","openChatHandler"],[0,"formComplete","formSubmittedHandler"]],{"dataKey":[{"onDataKeyChange":0}],"dataMode":[{"onDataModeChange":0}]}]]]]'),e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as t,r as i,a as e,f as s,h as o,e as n,d as a}from"./p-DrTyKvbY.js";import{b as r,l as h}from"./p-BimJyCOz.js";import{s as l,p as d}from"./p-uabJ4_3U.js";import{L as c,a as u}from"./p-Dbu5RJ7G.js";import{c as v,k as p,K as g,L as m,M as f,u as b,f as y,N as w,n as x,O as S,b as A}from"./p-CKY1nbED.js";import{H as C}from"./p-BD0OHkts.js";import{a as E}from"./p-odmyXuxx.js";import{e as k}from"./p-B6xjvrgl.js";import{i as T,g as I,b as z,p as N,r as L,c as O}from"./p-DsLiOXw0.js";import{r as R}from"./p-DNiRApIn.js";import{c as D}from"./p-_n0zqQUg.js";import{D as _,w as B,h as M}from"./p-9aFvbubk.js";import{f as $,s as P}from"./p-9AKYJrv1.js";import{a as j}from"./p-BBQFikkr.js";import{e as U,p as G}from"./p-C2x1hKSJ.js";import{i as F,s as H,b as V}from"./p-C7iZqaK3.js";import{b as q}from"./p-DvxYmlU_.js";import"./p-Dj2_voLF.js";const J=t.DATA_MODE||"prod";class Z extends Error{constructor(t="Live agent session authentication has expired"){super(t),this.name="LiveAgentAuthExpiredError"}}const K=new class{constructor(){this.events=new Map}on(t,i){this.events.has(t)||this.events.set(t,new Set),this.events.get(t).add(i)}off(t,i){var e;null===(e=this.events.get(t))||void 0===e||e.delete(i)}emit(t,i){var e;null===(e=this.events.get(t))||void 0===e||e.forEach((t=>t(i)))}},Y=new c("SalesforceLiveAgentProvider",{logLevel:u.Info,remoteLoggingUrl:""});class W{constructor(){this.configSettings=null,this.sessionContext=null,this.endpointSSE="",this.checkAgentAvailability=async t=>{var i,e,s;this.availabilityAbort=new AbortController;const{signal:o}=this.availabilityAbort,n=Date.now();for(;Date.now()-n<2e4;){if(o.aborted)return!1;const n=await fetch(`${null===(i=this.configSettings)||void 0===i?void 0:i.instanceUrl}/iamessage/api/v2/conversation/${t}/entries`,{method:"GET",signal:o,headers:{"Content-Type":"application/json",Authorization:`Bearer ${null===(e=this.sessionContext)||void 0===e?void 0:e.accessToken}`}});if(!n.ok)return Y.warn(`Agent availability check failed: ${n.status} ${n.statusText}`),K.emit("AGENT_UNAVAILABLE",{reason:"request_error"}),!1;const a=await n.json();Y.debug("Agent availability check result:",a);const r=null!==(s=null==a?void 0:a.conversationEntries)&&void 0!==s?s:[],h=r.find((t=>"RoutingResult"===t.entryType));if(h){let t=h.entryPayload;if("string"==typeof t)try{t=JSON.parse(t)}catch(t){Y.warn("Failed to parse RoutingResult entryPayload")}const i=null==t?void 0:t.failureReason;return i?(Y.warn("Routing failed with reason:",i),K.emit("AGENT_UNAVAILABLE",{reason:i}),!1):(Y.debug("Agent routed successfully"),!0)}Y.debug(`No RoutingResult yet (entries: ${r.length}), retrying in 1500ms…`),await new Promise(((t,i)=>{const e=setTimeout(t,1500);o.addEventListener("abort",(()=>{clearTimeout(e),i()}),{once:!0})})).catch((()=>null))}return Y.warn("Timed out waiting for MIAW routing result"),K.emit("AGENT_UNAVAILABLE",{reason:"timeout"}),!1},this.configSettings=null,this.sessionContext=null,this.endpointSSE=v(J)}async authenticate(){var t,i,e;const s=await fetch(`${null===(t=this.configSettings)||void 0===t?void 0:t.instanceUrl}/iamessage/api/v2/authorization/unauthenticated/access-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:null===(i=this.configSettings)||void 0===i?void 0:i.orgId,esDeveloperName:null===(e=this.configSettings)||void 0===e?void 0:e.messagingChannelId,capabilitiesVersion:"1",platform:"Web",context:{appName:"DemoMessagingClient",clientVersion:"1.0.0"}})});if(!s.ok)throw new Error(`Failed to authenticate with Salesforce MIAW: [error]: ${s.status} ${s.statusText}`);const o=await s.json();this.sessionContext||(this.sessionContext={}),this.sessionContext.accessToken=o.accessToken,this.sessionContext.sessionId=o.lastEventId}async startSession(){var t,i,e,s,o,n,a,r,h,l,d,c;const u={};if(null===(i=null===(t=this.sessionContext)||void 0===t?void 0:t.extraPrechatFormDetails)||void 0===i?void 0:i.length)for(const t of this.sessionContext.extraPrechatFormDetails)(null==t?void 0:t.label)&&"string"==typeof t.value&&""!==t.value.trim()&&(u[t.label]=t.value);const v=crypto.randomUUID().toLowerCase(),p=await fetch(`${null===(e=this.configSettings)||void 0===e?void 0:e.instanceUrl}/iamessage/api/v2/conversation`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${null===(s=this.sessionContext)||void 0===s?void 0:s.accessToken}`},body:JSON.stringify({conversationId:v,esDeveloperName:null===(o=this.configSettings)||void 0===o?void 0:o.messagingChannelId,routingAttributes:Object.assign({recordId:null===(n=this.sessionContext)||void 0===n?void 0:n.conversationId},u)})});if(!p.ok)throw new Error(`Conversation start failed: ${p.status} ${p.statusText}`);if(p.ok){this.sessionContext.conversationId=v,K.emit("liveAgentReady",void 0),K.emit("AGENT_SESSION_INFO",{sessionId:this.sessionContext.accessToken,conversationId:this.sessionContext.conversationId});let t="";if(null===(r=null===(a=this.sessionContext)||void 0===a?void 0:a.extraPrechatFormDetails)||void 0===r?void 0:r.length){const i=this.sessionContext.extraPrechatFormDetails.filter((t=>(null==t?void 0:t.label)&&"string"==typeof t.value&&""!==t.value.trim()&&!1!==t.displayToAgent)).map((t=>`${t.label}: ${t.value}`));i.length>0&&(t+=`Pre-chat details:\n${i.join("\n")}\n\n`)}(null===(h=this.sessionContext)||void 0===h?void 0:h.initialMessages)&&(null===(l=this.sessionContext)||void 0===l?void 0:l.initialMessages.length)>0&&(null===(d=this.sessionContext.initialMessages[0])||void 0===d||d.messages.forEach((i=>{(null==i?void 0:i.text)&&(i.text=i.text.replace(/<\/?p>/g,""),t+=(null==i?void 0:i.isUser)?`User: ${i.text}\n`:`Bot: ${i.text}\n`)}))),t&&this.sendMessage({isNewSession:!0,sessionId:(null===(c=this.sessionContext)||void 0===c?void 0:c.sessionId)||"",message:t}),await this.checkAgentAvailability(this.sessionContext.conversationId||"")?(Y.debug("Agent is available, starting to listen to messages"),this.listenToMessages()):Y.warn("No agent assigned — skipping SSE listener setup")}}async initialize(t){var i,e,s;if(Y.debug("Initializing Salesforce Live Agent Provider"),this.configSettings||(this.configSettings=(null==t?void 0:t.config)||this.configSettings),!(null===(i=this.configSettings)||void 0===i?void 0:i.instanceUrl)||!(null===(e=this.configSettings)||void 0===e?void 0:e.orgId)||!(null===(s=this.configSettings)||void 0===s?void 0:s.messagingChannelId))throw new Error("Missing required configuration settings for Salesforce Live Agent Provider");this.sessionContext||(this.sessionContext={accessToken:"",lastMessageReadTime:0,sessionId:"",initialMessages:(null==t?void 0:t.messageHistory)||[],isActive:!1,conversationId:(null==t?void 0:t.conversationId)||crypto.randomUUID().toLowerCase(),userId:(null==t?void 0:t.userId)||"",extraPrechatFormDetails:(null==t?void 0:t.extraPrechatFormDetails)||[]});try{await this.authenticate(),await this.startSession()}catch(t){throw Y.error("Error initializing Salesforce Live Agent Provider:",t),t}}parseMessageEntries(t){return t.filter((t=>{var i,e,s,o;return"Message"===t.entryType&&(null===(s=null===(e=null===(i=t.entryPayload)||void 0===i?void 0:i.abstractMessage)||void 0===e?void 0:e.staticContent)||void 0===s?void 0:s.text)&&"EndUser"!=(null===(o=t.sender)||void 0===o?void 0:o.role)})).map((t=>({id:t.entryPayload.abstractMessage.id,content:t.entryPayload.abstractMessage.staticContent.text,sender:{role:this.mapSenderRole(t.sender.role),displayName:t.senderDisplayName||"Unknown"},timestamp:t.clientTimestamp})))}handleParticipantChange(t){try{if(Y.debug("Participant change event received:",t.data),!t.data)return;const i=JSON.parse(t.data),e=JSON.parse(i.conversationEntry.entryPayload).entries;let s=[];e.forEach((t=>{var i,e;const o=crypto.randomUUID();"add"===t.operation&&"agent"===t.participant.role.toLowerCase()&&s.push({id:o,isUser:!1,conversationId:o,type:"system",text:`${t.displayName} has joined the chat`,timestamp:new Date,sender:{role:"agent",displayName:null!==(i=null==t?void 0:t.displayName)&&void 0!==i?i:"System"}}),"remove"===t.operation&&"agent"===t.participant.role.toLowerCase()&&s.push({id:o,type:"system",text:`${t.displayName} has left the chat`,conversationId:o,isUser:!1,timestamp:new Date,sender:{role:"agent",displayName:null!==(e=null==t?void 0:t.displayName)&&void 0!==e?e:"System"}})})),(null==s?void 0:s.length)>0&&K.emit("AGENT_EVENT",s)}catch(t){Y.error("Error handling participant change event:",t)}}mapEntriesToMessages(t){return t.map((t=>({id:t.entryPayload.abstractMessage.id,text:t.entryPayload.abstractMessage.staticContent.text,sender:{role:this.mapSenderRole(t.sender.role),displayName:t.senderDisplayName||"Unknown"},type:"endUser"===t.sender.role?"user":"ai",timestamp:new Date(t.timestamp),isUser:!1,conversationId:t.entryPayload.abstractMessage.id})))}handleParticipantMessage(t){var i,e;try{if(!t.data)return;const s=JSON.parse(t.data);if("EndUser"===(null===(e=null===(i=null==s?void 0:s.conversationEntry)||void 0===i?void 0:i.sender)||void 0===e?void 0:e.role))return void Y.debug("Ignoring message from EndUser role");const o=JSON.parse(s.conversationEntry.entryPayload);s.conversationEntry.entryPayload=o;const n=this.mapEntriesToMessages([s.conversationEntry]);(null==n?void 0:n.length)>0&&K.emit("AGENT_MESSAGE",n)}catch(t){Y.error("Error handling participant message event:",t)}}mapSenderRole(t){const i=t.toLowerCase();return"chatbot"===i?"agent":"enduser"===i?"endUser":"unknown"}handleSessionStatusChange(t){var i;try{if(!t.data)return;const e=JSON.parse(t.data),s=JSON.parse(e.conversationEntry.entryPayload);Y.debug("Session status changed:",null==s?void 0:s.sessionStatus),"Active"===(null==s?void 0:s.sessionStatus)?K.emit("AGENT_SESSION_CREATED",!0):"Ended"===(null==s?void 0:s.sessionStatus)&&(K.emit("CONVERSATION_CLOSED",!0),null===(i=this.eventSource)||void 0===i||i.close())}catch(t){Y.error("Error handling session status change event:",t)}}listenToMessages(){var t,i,e,s;Y.debug("Listening to messages from Salesforce Live Agent"),null===(t=this.eventSource)||void 0===t||t.close();const o=new EventSource(`${this.endpointSSE}/bot/liveagent/sse?token=${null===(i=this.sessionContext)||void 0===i?void 0:i.accessToken}&org_id=${null===(e=this.configSettings)||void 0===e?void 0:e.orgId}&sse_url=${null===(s=this.configSettings)||void 0===s?void 0:s.instanceUrl}`,{withCredentials:!0});if(!o)throw Y.error("Failed to create EventSource"),new Error("Failed to create EventSource");this.eventSource=o,o.onerror=t=>{const i=null==t?void 0:t.data;Y.error("string"==typeof i&&i?`❌ SSE server error frame: ${i}`:"❌ SSE Error: Connection lost or error occurred"),K.emit("AGENT_ERROR",{reason:"string"==typeof i&&i?i:"transport"}),o.close()},o.onopen=()=>{Y.debug("✅ SSE Connection Established")};const n=t=>{var i,e;try{const s=JSON.parse(t.data);switch(Y.debug("📡 Message Received on entrytype:",null===(i=null==s?void 0:s.conversationEntry)||void 0===i?void 0:i.entryType," --- ",t.data),null===(e=null==s?void 0:s.conversationEntry)||void 0===e?void 0:e.entryType){case"RoutingResult":case"RoutingWorkResult":Y.debug("Conversation Routing Result:",t.data),K.emit("FINDING_AGENT",t.data);break;case"ParticipantChanged":Y.debug("Conversation ParticipantChanged event received:",null==t?void 0:t.data),this.handleParticipantChange(t);break;case"Message":this.handleParticipantMessage(t);break;case"CloseConversation":K.emit("CONVERSATION_CLOSED",!0),o.close();break;case"DeliveryAcknowledgement":case"ReadAcknowledgement":Y.debug("Conversation event received:",null==t?void 0:t.data);break;case"TypingStartedIndicator":K.emit("TYPING_STARTED",!0);break;case"TypingStoppedIndicator":Y.debug("Typing indicator received:",t.data),K.emit("TYPING_STOPPED",!0);break;case"StreamingToken":Y.debug("Streaming token received",t.data);break;case"ProgressIndicator":Y.debug("Progress indicator received",t.data);break;case"SessionStatusChanged":Y.debug("Session status changed event received",t.data),this.handleSessionStatusChange(t)}}catch(t){return void Y.error("Failed to parse event data:",t)}};Object.values({Message:"CONVERSATION_MESSAGE",RoutingResult:"CONVERSATION_ROUTING_RESULT",RoutingWorkResult:"CONVERSATION_ROUTING_WORK_RESULT",ParticipantChanged:"CONVERSATION_PARTICIPANT_CHANGED",TypingStartedIndicator:"CONVERSATION_TYPING_STARTED_INDICATOR",TypingStoppedIndicator:"CONVERSATION_TYPING_STOPPED_INDICATOR",DeliveryAcknowledgement:"CONVERSATION_DELIVERY_ACKNOWLEDGEMENT",ReadAcknowledgement:"CONVERSATION_READ_ACKNOWLEDGEMENT",CloseConversation:"CONVERSATION_CLOSE_CONVERSATION",StreamingToken:"CONVERSATION_STREAMING_TOKEN",ProgressIndicator:"CONVERSATION_PROGRESS_INDICATOR",SessionStatusChanged:"CONVERSATION_SESSION_STATUS_CHANGED"}).forEach((t=>o.addEventListener(t,n))),o.onmessage=n,o.addEventListener("upstream_error",(t=>{Y.error("❌ Live agent SSE upstream error:",t.data),K.emit("AGENT_ERROR",{reason:"string"==typeof t.data&&t.data?t.data:"upstream_error"}),o.close()}))}async startChat(t){await this.initialize(t)}async resumeChat(t){var i,e,s;if(!(null==t?void 0:t.sessionId)||!(null==t?void 0:t.conversationId))throw new Error("resumeChat requires sessionId (accessToken) and conversationId");if(this.configSettings=(null==t?void 0:t.config)||this.configSettings,!(null===(i=this.configSettings)||void 0===i?void 0:i.instanceUrl)||!(null===(e=this.configSettings)||void 0===e?void 0:e.orgId)||!(null===(s=this.configSettings)||void 0===s?void 0:s.messagingChannelId))throw new Error("Missing required configuration settings for resuming Salesforce Live Agent session");this.sessionContext={accessToken:t.sessionId,conversationId:t.conversationId,userId:t.userId||"",isActive:!0,lastMessageReadTime:0};const o=new URL(`${this.configSettings.instanceUrl}/iamessage/api/v2/conversation/${this.sessionContext.conversationId}/entries`);o.searchParams.set("limit","1"),o.searchParams.set("direction","FromEnd");const n=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${this.sessionContext.accessToken}`}});if(401===n.status||403===n.status)throw new Z;if(!n.ok)throw new Error(`Session probe failed: ${n.status} ${n.statusText}`);K.emit("liveAgentReady",void 0),this.listenToMessages()}async sendMessage(t){var i,e,s,o;if(!(await fetch(`${null===(i=this.configSettings)||void 0===i?void 0:i.instanceUrl}/iamessage/api/v2/conversation/${null===(e=this.sessionContext)||void 0===e?void 0:e.conversationId}/message`,{method:"POST",headers:{Authorization:`Bearer ${null===(s=this.sessionContext)||void 0===s?void 0:s.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify({message:{id:crypto.randomUUID(),messageType:"StaticContentMessage",staticContent:{formatType:"Text",text:null==t?void 0:t.message}},esDeveloperName:null===(o=this.configSettings)||void 0===o?void 0:o.messagingChannelId,isNewMessagingSession:(null==t?void 0:t.isNewSession)||!1,language:""})})).ok)throw new Error("Failed to send message")}async pollMessages(t){return new Promise((async(t,i)=>{this.sessionContext.lastMessageReadTime=0;const e=async()=>{var s,o,n;try{const i=new URL(`${null===(s=this.configSettings)||void 0===s?void 0:s.instanceUrl}/iamessage/api/v2/conversation/${null===(o=this.sessionContext)||void 0===o?void 0:o.conversationId}/entries`);i.searchParams.append("limit","50"),i.searchParams.append("direction","FromEnd"),i.searchParams.append("startTimestamp",`${this.sessionContext.lastMessageReadTime}`);const a=await fetch(i.toString(),{method:"GET",headers:{Authorization:`Bearer ${null===(n=this.sessionContext)||void 0===n?void 0:n.accessToken}`}}),r=await a.json(),h=this.parseMessageEntries(r.conversationEntries).sort(((t,i)=>t.timestamp-i.timestamp)).map((t=>{var i;return{text:t.content,isUser:!1,id:t.id,timestamp:new Date(t.timestamp),images:[],conversationId:t.id,formModel:"",surveyDomId:"",sender:{role:"endUser"===t.sender.role?"user":"ai",displayName:null===(i=null==t?void 0:t.sender)||void 0===i?void 0:i.displayName}}}));(null==h?void 0:h.length)>0&&(this.sessionContext.lastMessageReadTime=(new Date).getTime(),K.emit("messageReceived",h)),t(h),setTimeout(e,5e3)}catch(t){Y.error("Error on Polling",t.toString()),i(t)}};await e()}))}async isChatActive(t){return Y.debug("sessionId",t),!!this.sessionContext&&this.sessionContext.isActive}async endChat(t){var i,e,s,o,n,a,r;if(null===(i=this.availabilityAbort)||void 0===i||i.abort(),null===(e=this.eventSource)||void 0===e||e.close(),null===(s=this.sessionContext)||void 0===s?void 0:s.conversationId){const t=await fetch(`${null===(o=this.configSettings)||void 0===o?void 0:o.instanceUrl}/iamessage/api/v2/conversation/${null===(n=this.sessionContext)||void 0===n?void 0:n.conversationId}?esDeveloperName=${null===(a=this.configSettings)||void 0===a?void 0:a.messagingChannelId}`,{method:"DELETE",headers:{Authorization:`Bearer ${null===(r=this.sessionContext)||void 0===r?void 0:r.accessToken}`,"Content-Type":"application/json"}});(null==t?void 0:t.ok)||Y.warn("Failed to end the chat")}}async getTranscript(t){return Y.debug("sessionId",t),this.sessionContext&&this.sessionContext.initialMessages||[]}}class Q{constructor(){}static getProvider(t){if("salesforce"!==(null!=t?t:this.provider))throw new Error("Unsupported Live Agent provider");return this.providerInstance=new W,this.providerInstance}}Q.provider="salesforce";class X{constructor(){this.logger=new c("LiveAgentEventHandler",{logLevel:u.Warn}),this.handleAgentMessage=t=>{let i="";if((null==t?void 0:t.length)>0)for(const e of t)i+=(null==e?void 0:e.text)+"\n\n";return i},this.sendMessage=t=>{this.liveAgentProvider?(this.logger.debug("Sending message to Live Agent:",t.message),this.liveAgentProvider.sendMessage(t)):this.logger.warn("Live Agent provider is not initialized. Cannot send message.")},this.disconnectLiveAgent=()=>{this.liveAgentProvider?(this.logger.debug("Disconnecting from Live Agent"),this.liveAgentProvider.endChat("")):this.logger.warn("Live Agent provider is not initialized. Cannot disconnect.")}}addAgentEventMessage(t){const i=document.createElement("div");return t.forEach((t=>{const e=document.createElement("div");e.className="py-2 border-b border-gray-200 text-center";const s=document.createElement("span");s.className="text-[10px] font-medium text-gray-500 tracking-wide",s.textContent=(null==t?void 0:t.text)||"Agent event",e.appendChild(s),i.appendChild(e)})),i}async connectToLiveAgent(t="salesforce",i){try{switch(this.logger.debug("Connected to Live Agent",t," --- ",i),t){case"salesforce":this.logger.debug("Using Salesforce Live Agent Provider"),this.liveAgentProvider=Q.getProvider(t),await this.liveAgentProvider.startChat(i);break;case"custom":this.logger.debug("Using Custom Live Agent Provider");break;case"liveagent":this.logger.debug("Using LiveAgent Live Agent Provider");break;default:throw new Error(`Unsupported Live Agent provider: ${t}`)}}catch(t){throw this.logger.error("Error connecting to Live Agent:",t),t}}async resumeLiveAgentSession(t="salesforce",i){try{if(this.logger.debug("Resuming Live Agent session",t," --- ",i),this.liveAgentProvider=Q.getProvider(t),!this.liveAgentProvider.resumeChat)throw new Error(`Provider '${t}' does not support session resume`);await this.liveAgentProvider.resumeChat(i)}catch(t){throw this.logger.error("Error resuming Live Agent session:",t),t}}}function tt(t){return!!function(t){return"object"==typeof t&&null!==t}(t)&&Array.isArray(t.messages)&&"boolean"==typeof t.isMinimized&&"boolean"==typeof t.isOpened&&"boolean"==typeof t.isExpanded&&"string"==typeof t.conversationId&&"string"==typeof t.projectId&&"boolean"==typeof t.newChat}function it(t){return"undefined"!=typeof TextEncoder?(new TextEncoder).encode(t).length:t.length}function et(t,i,e={}){var s,o,n,a;if("undefined"==typeof document)return!1;const r=null!==(s=e.path)&&void 0!==s?s:"/",h=null!==(o=e.sameSite)&&void 0!==o?o:"Lax",l=null!==(n=e.secure)&&void 0!==n?n:"undefined"!=typeof window&&"https:"===window.location.protocol,d=e.domain;let c=`${t}=${encodeURIComponent(i)}`;if(d){if(!/^[a-zA-Z0-9._-]+$/.test(d))return console.warn("AI12Z: Invalid cookie domain characters"),!1;c+=`; Domain=${d}`}c+=`; Path=${r}`,c+=`; SameSite=${h}`,c+="; Max-Age="+24*(null!==(a=e.maxAgeDays)&&void 0!==a?a:7)*60*60,l&&(c+="; Secure");const u=it(c);return u>4e3?(console.warn(`AI12Z: Cookie value exceeds safe limit (${u} bytes). Cookie not set.`),!1):(document.cookie=c,!0)}function st(t,i,e={}){var s,o;const n=Object.assign({},i);(null===(s=n.messages)||void 0===s?void 0:s.length)>0&&(n.messages=[]);const a=JSON.stringify(n),r=encodeURIComponent(a),h=null!==(o=e.maxBytes)&&void 0!==o?o:3800;return it(r)>h?(console.warn(`AI12Z: Cookie '${t}' exceeds size limit and was skipped`),!1):et(t,a,e)}function ot(t){if(!t)return;if("undefined"==typeof window)return;const i=t.replace(/^\./,""),e=window.location.hostname;if(e===i||e.endsWith("."+i))return t;console.warn("AI12Z: subDomain does not match current host")}const nt=new c("Ai12zBot"),at=class{constructor(s){i(this,s),this.messageSent=e(this,"messageSent",7),this.messageReceived=e(this,"messageReceived",7),this.close=e(this,"close",7),this.open=e(this,"open",7),this.minimize=e(this,"minimize",7),this.errored=e(this,"errored",7),this.formSubmitted=e(this,"formSubmitted",7),this.isElementAvailable=e(this,"isElementAvailable",7),this.cdnPath="https://cdn.ai12z.net/assets/bot",this.surveyCDNPath="https://cdn.ai12z.net/pkg/surveyjs",this.styles=["https://cdn.jsdelivr.net/npm/@highlightjs/cdn-assets@11.11.1/styles/default.min.css",`https://cdn.ai12z.net/assets/bot/${t.CDN_PATH}/tailwind.min.css`],this.liveAgentEventHandler=new X,this.customStyle="",this.customJS="",this.dataOverrideFunction=null,this.ignoreChunks=!1,this.unreadCount=0,this.hasPersistedConversationId=!1,this.liveAgentButtonText="Talk to a Live Agent",this.isLiveAgentEnabled=!1,this.isTypingIndicatorVisible=!1,this.dataKey=t.DATA_KEY||"",this.dataMode=t.DATA_MODE||"prod",this.dataAttributes={},this.excludeTags=[],this.includeTags=[],this.botSettings={},this.canRender=!0,this.voiceType="default",this.voice="en-US",this.showSubmit=!1,this.hideAllButtons=!1,this.showMenu=!1,this.isProse=!0,this.isLiveAgent=!1,this.isConnectingLiveAgent=!1,this.showWelcomeScreen=!0,this.showHistory=!1,this.conversationId="",this.surveyDomId="",this.searchResults={},this.buttons=[],this.currentDomId="",this.messages=[],this.questionCounter=0,this.timestamp="",this.rowCount=1,this.isBot=!1,this.conversationHistory=[],this.query="",this.scriptArray=[],this.imagesBase64List=[],this.focusedIndex=-1,this.isAnimated=!1,this.isMinimized=!1,this.isStreaming=!1,this.showErrorMessage=!1,this.errorMessage="",this.emptyMessageError=!1,this.isOpened=!1,this.isContent=!1,this.isToggled=!1,this.showPrivacy=!1,this.isRendered=!1,this.showShortcutsDialog=!1,this.showLiveAgentEndDialog=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.liveAgentProviderName="salesforce",this.liveAgentListenersRegistered=!1,this.shortcuts=_,this.announceMessage="",this.isSending=!1,this.messageRefs=[],this.handlePaste=t=>{var i;t.preventDefault();const e=(null===(i=t.clipboardData)||void 0===i?void 0:i.getData("text"))||"";if(this.inputEl&&e){const t=this.inputEl,i=t.selectionStart,s=t.selectionEnd,o=t.value,n=o.substring(0,i)+e+o.substring(s);t.value=n;const a=i+e.length;t.setSelectionRange(a,a),setTimeout((()=>{this.adjustHeight()}),0)}},this.checkHistory=()=>{const t=localStorage.getItem(`${this.visitorID}`);let i=[];t&&(i=JSON.parse(t),i=i.filter((t=>{var i;return t.projectId===(null===(i=this.botSettings)||void 0===i?void 0:i.pId)}))),this.showHistory=i.length>0&&"v1"===this.botSettings.botVersion},this.initializeScript=t=>T(t,this.mainObject),this.renderSurvey=async t=>{if(this.surveyDomId){await this.assetLoader.loadSurveyDependencies();try{await R({chat:t,surveyDomId:this.surveyDomId,shadowRoot:this.el.shadowRoot,config:{dataKey:this.dataKey,dataMode:this.dataMode,dataAttributes:this.dataAttributes,formSubmitRenderCallback:t=>{this.handleSurveyCompletionRender(t)},onSubmitError:t=>{var i;const e=null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector(`#${this.surveyDomId}`);e?e.innerHTML="Form submission blocked by validation"!==t?"Failed to submit form":"Submission blocked due to suspicious activity.":console.error(`Survey element not found for DOM ID: ${this.surveyDomId}`)}}})}catch(t){console.error("Error rendering survey:",t)}}else console.warn("Survey DOM ID is empty")},this.handleMessage=(t,i)=>{var e;const s=new l.Converter,o=null===(e=this.el.shadowRoot)||void 0===e?void 0:e.querySelector(`#${i}`);if(!o)return void console.error(`Message bubble with ID ${i} not found.`);var n=o.getAttribute("data-bubbleText")||"";o.setAttribute("data-bubbleText",n+=t),o.setAttribute("aria-label",n),o.setAttribute("role","log"),o.setAttribute("aria-live","polite"),o.setAttribute("aria-atomic","false");let a=s.makeHtml(n);o.innerHTML=a},this.updateScreenSize=()=>{window.innerWidth<=767&&(this.isMinimized=!this.isOpened)},this.handleSend=async(t,i={})=>{var e,s,o;const{isHide:n=!1,isLiveChatEnded:a=!1,bypassSendGuard:r=!1}=i;if((this.isSending||this.isStreaming)&&!r)return this.query="",!1;this.isSending=!0;const h="string"==typeof this.query?this.query.trim():"",l="string"==typeof t?t.trim():"",d=(null===(e=this.inputEl)||void 0===e?void 0:e.value.trim())||"",c=h||l||d,u=l||(n?"":c);if(!c&&0===this.imagesBase64List.length)return this.showEmptyMessageValidation(),this.query="",this.isSending=!1,!1;if(!n&&!u&&0===this.imagesBase64List.length)return this.query="",this.isSending=!1,this.showEmptyMessageValidation(),!1;this.emptyMessageError=!1,this.surveyDomId="",this.announce("Message sent successfully"),this.isLiveAgent||(this.questionCounter=this.questionCounter+1,localStorage.setItem("ai12z-bot-data",JSON.stringify({qCounter:this.questionCounter})));const v=u;this.inputEl&&(this.inputEl.value=v),0===this.messages.length&&this.botSettings.autoResetTimer>0&&this.startTimer(),this.showWelcomeScreen&&"v1"===this.botSettings.botVersion&&(this.showWelcomeScreen=!1);try{0!==this.messages.length&&(null===(s=this.socket)||void 0===s?void 0:s.connected)&&this.socket&&this.socket.connected||await this.socketConnection()}catch(t){return console.error("Error in handleSend:",t),this.query="",this.isSending=!1,!1}const m=(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(this.messages=[...this.messages,{text:v,isUser:!0,id:`user-${p()}`,timestamp:m,images:this.imagesBase64List,conversationId:this.conversationId,isLoading:!1,formModel:{},surveyDomId:"",isHide:null!=n&&n},{text:this.botSettings.maxQuestion>0&&this.questionCounter>this.botSettings.maxQuestion&&!this.isLiveAgent&&!a?""!==this.botSettings.msgLimit?this.botSettings.msgLimit:"Sorry, you have reached the maximum number of questions.":"",isUser:!1,id:"",timestamp:"",isLoading:!(this.botSettings.maxQuestion>0&&this.questionCounter>this.botSettings.maxQuestion&&!this.isLiveAgent&&!a),images:[],conversationId:this.conversationId,formModel:{},surveyDomId:""}],2===this.messages.length&&(this.visitorID=g()),this.checkHistory(),setTimeout((()=>{this.scrollToBottom()}),100),this.botSettings.maxQuestion>0&&this.questionCounter>this.botSettings.maxQuestion&&!this.isLiveAgent&&!a)return this.inputEl.value="",this.query="",this.releaseSendLock(),!1;this.currentDomId="",this.isLiveAgent?(this.messages=this.messages.slice(0,-1),this.liveAgentEventHandler.sendMessage({sessionId:"",message:this.inputEl.value}),this.updateBotState(),this.inputEl.value&&(this.inputEl.value=""),this.query="",this.isSending=!1):(this.checkLiveAgentMode(),this.isStreaming=!0,this.ignoreChunks=!1,this.resetStreamEndWatchdog(),this.invokeSocket(c));const f=null===(o=this.el.shadowRoot)||void 0===o?void 0:o.querySelector("#previewContainer");return f&&(f.innerHTML=""),this.imagesBase64List=[],this.rowCount=1,this.showSubmit=!1,!0},this.agentMessageCreated=t=>{var i;const e=this.liveAgentEventHandler.handleAgentMessage(t);if(!e)return;this.announce("New message received from live agent");const s=(new l.Converter).makeHtml(e),o=Array.isArray(t)?t[0]:t,n={id:`chatbot-${p()}`,text:s,isUser:!1,isLoading:!1,timestamp:(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),images:[],conversationId:this.conversationId,formModel:{},surveyDomId:"",thumbsId:`${p()}`,showIcon:!0,hideThumbsUpandDown:!0,insightId:null,sender:null!==(i=null==o?void 0:o.sender)&&void 0!==i?i:{role:"agent",displayName:"Agent"}};this.messages=[...this.messages,n],this.currentDomId="",this.updateBotState(),this.scheduleAutoScroll()},this.addEventMessage=t=>{var i;const e=this.liveAgentEventHandler.addAgentEventMessage([{text:t}]);if(""===this.currentDomId&&this.messages.length>0&&(this.currentDomId=this.messages[this.messages.length-1].id),e&&this.currentDomId){const t=null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector(`#${this.currentDomId}`);if(t)return t.parentNode.appendChild(e),this.currentDomId="",e}return null},this.findingAgent=()=>{this.announce("Finding a live agent for you"),this.isTypingIndicatorVisible=!1,this.removeFindingAgentPlaceholder();const t=this.addEventMessage("Connecting to a live agent...");t&&t.setAttribute("data-finding-agent","true"),this.currentDomId=""},this.handleTypingStarted=t=>{this.isTypingIndicatorVisible=t},this.handleTypingStopped=()=>{this.isTypingIndicatorVisible=!1},this.handleAgentError=t=>{nt.warn("Live Agent error category:",function(t){if(!t)return"unknown";if("transport"===t)return"transport";const i=/\b([1-5]\d{2})\b/.exec(t);return i?`upstream_${i[1][0]}xx`:"upstream_other"}(null==t?void 0:t.reason)),this.addEventMessage("Something went wrong with Live Agent, please try again later"),this.isLiveAgent=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.isTypingIndicatorVisible=!1,this.liveAgentEventHandler.disconnectLiveAgent(),this.clearEvents(),this.liveAgentButtonText="Talk to a Live Agent",this.announce("Live agent connection failed")},this.handleAgentConversationEnded=()=>{if(this.isLiveAgent){const t=this.messages[this.messages.length-1];"system"===(null==t?void 0:t.type)&&"string"==typeof(null==t?void 0:t.text)&&t.text.toLowerCase().includes("left")||(this.messages=[...this.messages,{id:`system-${p()}`,text:"The live agent has left the conversation.",type:"system",isUser:!1,isLoading:!1,timestamp:(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),images:[],conversationId:this.conversationId,formModel:{},surveyDomId:"",sender:null}]),this.announce("Live agent chat ended")}this.isLiveAgent=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.isTypingIndicatorVisible=!1,this.liveAgentButtonText="Talk to a Live Agent",this.currentDomId="",this.clearEvents(),this.updateBotState(),this.scheduleAutoScroll()},this.agentEventHandler=t=>{if(this.isTypingIndicatorVisible=!1,(null==t?void 0:t.length)>0){const i=t.map((t=>({id:t.id||`system-${p()}`,text:t.text||"",type:"system",isUser:!1,isLoading:!1,timestamp:new Date,images:[],conversationId:this.conversationId,formModel:{},surveyDomId:"",sender:t.sender||null})));this.messages=[...this.messages,...i],this.updateBotState(),this.removeFindingAgentPlaceholder(),this.inputEl&&(this.inputEl.value=""),this.currentDomId="",this.scheduleAutoScroll()}},this.handleAgentSessionCreated=()=>{this.announce("Connected to live agent"),this.isLiveAgent=!0,this.liveAgentButtonText="End Live Agent chat",requestAnimationFrame((()=>{var t;const i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelector('[data-testid="user-input-textarea"]');i&&(this.inputEl=i)}))},this.handleAgentSessionInfo=t=>{this.liveAgentSessionId=(null==t?void 0:t.sessionId)||"",this.liveAgentConversationId=(null==t?void 0:t.conversationId)||"",this.isLiveAgent=!0,this.updateBotState()},this.handleAgentUnavailable=()=>{this.addEventMessage("Live Agent is currently unavailable. Please try again later."),this.isTypingIndicatorVisible=!1,this.isLiveAgent=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.updateBotState(),this.announce("Live agent is currently unavailable"),this.clearEvents()},this.toggleBot=()=>{this.isToggled=!this.isToggled},this.menuClick=t=>{switch(t.type){case"menu":this.toggleBot(t),this.showHistory=!1,this.showWelcomeScreen=!0,this.isStreaming||this.handleSend(t.button.label);break;case"history":this.toggleBot(t),this.showHistory=!0,this.loadConversation();break;case"end":this.syncBodyScrollLock(!1),this.messages=[],this.conversationId="",this.isOpened=!1,this.isMinimized=!this.isExpanded,this.showWelcomeScreen=!0,this.toggleBot(t),this.showHistory=!1,this.close.emit("close");break;case"startover":this.messages=[],this.conversationId="",this.isOpened=!0,this.isMinimized=!1,this.showWelcomeScreen=!0,this.toggleBot(t),this.showHistory=!1,this.updateBotState()}}}get mainObject(){return window.ai12z||(window.ai12z={}),window.ai12z}handleKeyDown(t){var i,e;if(!["Control","Shift","Alt","Meta"].includes(t.key)){if(("?"===t.key||"/"===t.key)&&t.shiftKey&&(t.metaKey||t.ctrlKey)&&!this.isInputFocused())return t.preventDefault(),void(this.showShortcutsDialog=!this.showShortcutsDialog);if(this.showShortcutsDialog&&("Escape"===t.key||("?"===t.key||"/"===t.key)&&t.shiftKey&&(t.metaKey||t.ctrlKey)))return t.preventDefault(),void(this.showShortcutsDialog=!1);if("k"===t.key&&(t.metaKey||t.ctrlKey))return t.preventDefault(),t.stopPropagation(),void this.action("open");if("h"===t.key&&(t.metaKey||t.ctrlKey))return t.preventDefault(),t.stopPropagation(),this.showHistory=!this.showHistory,this.showWelcomeScreen=!1,void this.loadConversation();if("n"===t.key&&(t.metaKey||t.ctrlKey))return t.preventDefault(),t.stopPropagation(),void this.handleNewConversation();"Enter"===t.key&&!t.shiftKey&&this.isOpened&&this.isInputFocused()&&(t.preventDefault(),t.stopPropagation(),(null===(i=this.inputEl)||void 0===i?void 0:i.value.trim().length)>0&&!this.isStreaming?this.handleSend(this.inputEl.value):0===(null===(e=this.inputEl)||void 0===e?void 0:e.value.trim().length)&&0===this.imagesBase64List.length&&(this.emptyMessageError=!0,this.announce("Message cannot be empty. Please enter a message."),this.inputEl&&this.inputEl.focus(),setTimeout((()=>{this.emptyMessageError=!1}),3e3))),"Escape"===t.key&&(this.action("minimize"),this.showPrivacy&&(this.showPrivacy=!1,t.preventDefault()))}}isInputFocused(){var t;const i=(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.activeElement)||document.activeElement;return"TEXTAREA"===(null==i?void 0:i.tagName)||"INPUT"===(null==i?void 0:i.tagName)}handleNewConversation(){this.syncBodyScrollLock(!0),this.messages=[],this.conversationId="",this.showWelcomeScreen=!0,this.showHistory=!1,this.isOpened=!0,this.releaseSendLock(),setTimeout((()=>{var t;null===(t=this.inputEl)||void 0===t||t.focus()}),100)}buttonClickHandler(t){this.showWelcomeScreen=!1,this.query=t.detail.action,this.handleSend(t.detail.label)}sendQueryToBotHandler(t){this.showWelcomeScreen=!1,this.query=t.detail,this.handleSend(t.detail)}deleteChatHistoryHandler(t){var i;const e=this.getConversationHistory().filter((i=>i.conversationId!==t.detail.conversationId));localStorage.setItem(`${this.visitorID}`,JSON.stringify(e)),this.conversationHistory=$(e,null===(i=this.botSettings._id)||void 0===i?void 0:i.$oid,this.botSettings.pId)}chatClickHandler(t){t.detail.length>0&&(this.messages=t.detail,requestAnimationFrame((()=>{this.hydrateMessagesFromState()}))),this.showWelcomeScreen=!1,this.showHistory=!1}openChatHandler(t){}formSubmittedHandler(t){t.stopPropagation(),this.formSubmitted.emit(t.detail.data)}async sendMessage(t,i,e){this.query=t,this.handleSend(null!=i?i:t,e)}async sendQuery(t){console.warn("sendQuery mehtdod is deprecated, use sendMessage instead"),this.handleSend(t)}async sendJSON(t,i){this.query=JSON.stringify(t),this.handleSend(i)}async openBot(t=!1){this.openChat(t)}async action(t,i){var e;"open"===t&&this.openChat(null!==(e=null==i?void 0:i.expanded)&&void 0!==e&&e),"minimize"===t&&this.isOpened&&(this.syncBodyScrollLock(!1),this.minimizeChat()),this.checkHistory(),"close"===t&&(this.syncBodyScrollLock(!1),this.searchResults={},this.surveyDomId="",this.showWelcomeScreen=!0,this.showHistory=this.messages.length>0,this.messages=[],this.conversationId="",this.isOpened=!1,this.close.emit("close"),this.announce("Chat closed"),clearInterval(this.timer))}async setProcessDataOverride(t){this.dataOverrideFunction=t}async configureSettings(t){this.botSettings=Object.assign(Object.assign({},this.botSettings),t)}async componentWillLoad(){this.canRender=await m(this.dataKey,this.dataMode),this.checkCustomSlot(),this.timestamp=f(new Date),this.updateScreenSize(),await this.configBot(),this.botSettings.disableBeacon||F(this.dataKey,this.dataMode),this.visitorID="ai12z-"+localStorage.getItem("ai12z-visitorId"),this.hydrateStateFromStorage(),j("bot",this.dataKey,this.dataMode)}onDataKeyChange(t){j("bot",this.dataKey,this.dataMode)}onDataModeChange(t){j("bot",this.dataKey,this.dataMode)}hydrateStateFromStorage(){var t,i,e;const s=null===(t=this.botSettings)||void 0===t?void 0:t.pId;if(!s)return void console.warn("AI12Z: Cannot hydrate state - projectId not available");const o=I(s,null===(i=this.botSettings._id)||void 0===i?void 0:i.$oid)||function(t,i){const e=function(t){if("undefined"==typeof document)return null;const i=t.replace(/([.*+?^${}()|[\]\\])/g,"\\$1"),e=document.cookie.match(new RegExp(`(?:^|; )${i}=([^;]*)`));return e?decodeURIComponent(e[1]):null}(t);if(!e)return null;try{const s=JSON.parse(e);return i&&!i(s)?(console.warn(`AI12Z: Cookie '${t}' failed validation`),null):s}catch(t){return console.warn("AI12Z: Failed to parse cookie JSON:",t),null}}(z(s,null===(e=this.botSettings._id)||void 0===e?void 0:e.$oid),tt);o&&(this.isOpened=o.isOpened,this.isMinimized=o.isMinimized,this.isOpened&&this.syncBodyScrollLock(!0,!1),this.isExpanded=o.isExpanded,this.conversationId=o.conversationId,this.hasPersistedConversationId=Boolean(o.conversationId),o.newChat||(this.messages=[...o.messages||[]]),o.isLiveAgent&&o.liveAgentSessionId&&o.liveAgentConversationId&&(this.isLiveAgent=o.isLiveAgent||!0,this.liveAgentSessionId=o.liveAgentSessionId,this.liveAgentConversationId=o.liveAgentConversationId,this.liveAgentProviderName=o.liveAgentProviderName||"salesforce",this.liveAgentButtonText="End Live Agent chat",setTimeout((()=>this.recoverLiveAgentSession()),0)),setTimeout((()=>{this.scrollToBottom()}),100))}async recoverLiveAgentSession(){var t,i,e,s,o,n;if(0===Object.keys(null!==(e=null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.liveagent)||void 0===i?void 0:i.providers)&&void 0!==e?e:{}).length||!this.liveAgentSessionId||!this.liveAgentConversationId)return;const a=null!==(n=null===(o=null===(s=this.botSettings)||void 0===s?void 0:s.liveagent)||void 0===o?void 0:o.providers[this.liveAgentProviderName])&&void 0!==n?n:null;if(a)try{this.registerLiveAgentListeners(),await this.liveAgentEventHandler.resumeLiveAgentSession(this.liveAgentProviderName,{sessionId:this.liveAgentSessionId,conversationId:this.liveAgentConversationId,userId:this.visitorID,config:a})}catch(t){t instanceof Z?(this.addEventMessage("Your live agent session has expired. Please reconnect."),this.announce("Live agent session expired")):console.warn("AI12Z: Failed to recover live agent session, ending gracefully:",t),this.isLiveAgent=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.liveAgentButtonText="Talk to a Live Agent",this.clearEvents()}}releaseSendLock(){this.clearStreamEndWatchdog(),this.isStreaming=!1,this.isSending=!1}clearStreamEndWatchdog(){this.streamEndWatchdog&&(clearTimeout(this.streamEndWatchdog),this.streamEndWatchdog=void 0)}resetStreamEndWatchdog(){this.clearStreamEndWatchdog(),this.streamEndWatchdog=setTimeout((()=>{this.streamEndWatchdog=void 0,this.isStreaming&&(console.error("Socket response timed out before completion"),this.failTurn("Something went wrong. Please try again."))}),3e4)}componentDidLoad(){var t;E(this.el),"undefined"==typeof window||window.Handlebars||(window.Handlebars=C),s.register("bot",this),window.addEventListener("resize",this.updateScreenSize.bind(this)),document.addEventListener("click",this.handleClickOutside.bind(this));const i=document.createElement("script");i.text='\n var ai12zChat = window["ai12z"] = {}\n ',document.head.appendChild(i),null===(t=this.el.shadowRoot)||void 0===t||t.appendChild(i),this.assetLoader||this.initializeAssetLoader(),this.messages.length>0&&requestAnimationFrame((()=>{this.hydrateMessagesFromState()})),s.setActive("bot")}async hydrateMessagesFromState(){var t,i,e,s;if((null===(t=this.el)||void 0===t?void 0:t.shadowRoot)&&0!==this.messages.length){await new Promise((t=>requestAnimationFrame((()=>t()))));for(const t of this.messages)if(!t.isUser&&t.id){if("template"===t.controlType)this.processTemplateData(t,t.itemComponent);else if("form"===t.controlType){if(!t.surveyDomId)continue;if(this.surveyDomId=t.surveyDomId,!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(t.surveyDomId)){console.warn("Invalid surveyDomId, skipping render");continue}t.text=`<div id=${this.surveyDomId} style="width: 100%;" class="survey-container"></div>`,(await B(`#${t.id}`,this.el)).querySelector(`#${t.surveyDomId}`)||await B(`#${t.surveyDomId}`,this.el),await this.renderSurvey(t.itemComponent)}else if("carousel"===t.controlType&&"carousel"===(null===(i=t.itemComponent)||void 0===i?void 0:i.controlType))this.processChatData(t,t.itemComponent);else if(!t.controlType){t.text=b(t.text,(null===(e=this.botSettings)||void 0===e?void 0:e.linkTarget)||"_blank","ai12z-link",null===(s=this.botSettings)||void 0===s?void 0:s.utm,"answer");const i=y(t.text);t.text=i.body,this.buttons=i.buttons,this.addEventListeners(`#${t.id}`)}"form"!==t.controlType&&this.checkHighlightcode(t.id)}}}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside.bind(this)),window.removeEventListener("resize",this.updateScreenSize),this.autoScrollTimer&&clearTimeout(this.autoScrollTimer),this.clearStreamEndWatchdog()}handleClickOutside(t){this.showMenu&&this.plusIconRef&&!this.plusIconRef.contains(t.target)&&(this.showMenu=!1)}async initializeAssetLoader(){try{this.assetLoader=D({shadowRoot:this.el.shadowRoot,cdnPath:this.cdnPath,surveyCDNPath:this.surveyCDNPath,customStyles:this.styles}),await this.assetLoader.loadBotAssets()}catch(t){console.error("❌ Failed to initialize asset loader:",t)}}async processDataOverride(t){if(this.dataOverrideFunction&&"function"==typeof this.dataOverrideFunction)try{return await this.dataOverrideFunction(t)}catch(t){throw console.error("Error in custom processDataOverride:",t),t}return t}announce(t){this.announceMessage=t,setTimeout((()=>{this.announceMessage=""}),1e3)}isFirstExchange(){return!this.hasPersistedConversationId}syncBodyScrollLock(t,i=this.isOpened){t&&!i&&q.acquire("ai12z-bot"),!t&&i&&q.release("ai12z-bot")}openChat(t=!1){var i,e;this.syncBodyScrollLock(!0),this.unreadCount=0,s.setActive("bot"),this.isExpanded=t,this.isMinimized=!1,this.isContent=!1,this.isOpened=!0;const o=z(this.botSettings.pId,null===(i=this.botSettings._id)||void 0===i?void 0:i.$oid);if(sessionStorage.getItem(o))this.updateBotState();else{const t={messages:[],isMinimized:this.isMinimized,isOpened:this.isOpened,isExpanded:this.isExpanded,conversationId:this.conversationId,projectId:this.botSettings.pId,configId:null===(e=this.botSettings._id)||void 0===e?void 0:e.$oid,newChat:!0};sessionStorage.setItem(o,JSON.stringify(t)),this.botSettings.cookies&&ot(this.botSettings.subDomain)&&st(o,t,{domain:this.botSettings.subDomain})}setTimeout((()=>{this.announce("Chat opened")}),600),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.imageUploaderRef&&this.isElementAvailable.emit(!0)}))})),this.open.emit("open")}minimizeChat(){this.isOpened=!1,this.isContent=!!this.isExpanded,this.isMinimized=!this.isExpanded,this.isAnimated=!1,this.updateScreenSize(),this.announce("Chat minimized"),this.minimize.emit("minimize")}adjustHeight(){this.inputEl&&(this.inputEl.style.height="auto",this.inputEl.style.height=this.inputEl.scrollHeight+"px")}async configBot(){var t,i,e,s,o;const n={apiKey:this.dataKey,configId:this.configId,configType:"bot"};try{const a=await w(n,this.dataMode);if(a){if(this.botSettings=a,(null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.v3)||void 0===i?void 0:i.siteKey)?k(a._id,a.v3.siteKey,"bot",this.dataKey,this.dataMode,(t=>{this.errored.emit(t),this.announce("An error occurred while loading the chat.")})).then((t=>{t&&(this.isRendered=!0)})).catch((t=>{console.error("Recaptcha verification failed:",t),this.isRendered=!1})):this.isRendered=!0,"v2"!==this.botSettings.botVersion||this.botSettings.isExpanded||this.isBot||this.isOpened||(this.isMinimized=!0),this.assetLoader||await this.initializeAssetLoader(),this.assetLoader)try{await this.assetLoader.loadBotTheme(this.botSettings)}catch(t){console.error("Failed to load bot theme:",t)}if(this.botSettings.isExpanded&&!this.isBot?(this.isExpanded=!0,this.isMinimized=!1):this.isOpened||(this.isMinimized=!0),this.botSettings.linkTarget||(this.botSettings.linkTarget="_blank"),this.botSettings.customCSS&&(this.customStyle=this.botSettings.customCSS),this.botSettings.customJS&&(this.customJS=this.botSettings.customJS),"v2"===this.botSettings.botVersion){const t=localStorage.getItem("ai12z-visitorId");this.visitorID="ai12z-"+t}if(this.botSettings.privacyTemplate&&""!==this.botSettings.privacyTemplate&&(this.showPrivacy=!0),this.botSettings.audioType&&(this.voiceType=this.botSettings.audioType,this.voice=this.botSettings.voice),this.botSettings&&!(null===(e=this.botSettings)||void 0===e?void 0:e.cookies)){const t=ot(this.botSettings.subDomain);!function(t,i={}){const{path:e="/",domain:s}=i;"undefined"!=typeof document&&function(t,i="/",e){et(t,"",{maxAgeDays:0,path:i,domain:e})}(t,e,s)}(z(this.botSettings.pId,null===(o=null===(s=this.botSettings)||void 0===s?void 0:s._id)||void 0===o?void 0:o.$oid),{domain:t})}}}catch(t){console.error("Error loading bot configuration:",t)}}checkCustomSlot(){const t=this.el.children;if(t&&t.length>0)for(var i=0;i<t.length;i++)"bot"!==t[i].tagName.toLowerCase()&&"bot"!==t[i].getAttribute("slot")||(this.isBot=!0,this.isExpanded=!1)}handleSocketResponse(){this.socket.off("response"),this.socket.off("end_response"),this.socket.off("chunk"),this.socket.off("complete"),void 0===this.botSettings.maxQuestion||0===this.botSettings.maxQuestion?(this.botSettings.maxQuestion=0,this.handleBotMessages()):this.questionCounter<=this.botSettings.maxQuestion&&this.handleBotMessages()}hideSpinner(t){return new Promise((i=>{var e;const s=null===(e=this.el.shadowRoot)||void 0===e?void 0:e.querySelector(`#${t.id}`);if(s){const t=s.querySelector("#spinner");t&&(t.style.display="none")}i(!0)}))}async processTemplateData(t,i){await N(t,i,this.el.shadowRoot,(t=>this.hideSpinner(t)),(t=>this.renderTemplateData(t)),(t=>{this.messages=this.messages.map((i=>i.id===t.id?t:i))}),C)}async renderTemplateData(t){await L(t,this.el,this.scriptArray,this.mainObject,this.initializeScript)}async processChatData(t,i){d(t,i,this.el,(t=>this.hideSpinner(t)),(t=>{this.messages=this.messages.map((i=>i.id===t.id?t:i)),this.updateBotState()}),this.customJS,this.customStyle,this.isExpanded)}handleBotMessages(){const t=A(this.dataMode),i="v2"===t?"complete":"end_response";this.socket.on("v2"===t?"chunk":"response",(async i=>{this.resetStreamEndWatchdog();const{id:e,idChanged:s}=U(this.currentDomId,this.messages,"chatbot");this.currentDomId=e,s&&(this.messages=[...this.messages]);const o="v2"===t?i.content:i.data;requestAnimationFrame((()=>{this.ignoreChunks||(this.messages[this.messages.length-1].isLoading=!1,this.handleMessage(o,this.currentDomId))}))})),this.socket.on(i,(async i=>{if(!i)return console.error("Received empty end response payload"),void this.failTurn("Something went wrong. Please try again.");this.clearStreamEndWatchdog();const e="v2"===t?r(i):i;void 0!==e.showInput&&"boolean"==typeof e.showInput&&(this.botSettings.showInput=e.showInput),this.unreadCount++;const{id:s,idChanged:o,orphaned:n}=U(this.currentDomId,this.messages,"chatbot");this.currentDomId=s,o&&(this.messages=[...this.messages]);const a=this.isFirstExchange();e.beaconId&&sessionStorage.setItem("ai12zBeaconId",e.beaconId),a&&!this.botSettings.disableBeacon&&(H(this.dataKey,this.dataMode,e.conversationId,e.beaconId),this.hasPersistedConversationId=!0),n||this.messageReceived.emit({data:e,domId:this.currentDomId}),this.announce(this.isOpened?"New message received":"New message received while chat is minimized"),requestAnimationFrame((async()=>{var t,i,s,o,n,r,h;try{const l={element:this.el,hideSpinner:t=>{this.hideSpinner(t)},updateConversations:(t,i)=>this.updateConversations(t,i),renderSurvey:t=>this.renderSurvey(t),processTemplateData:(t,i)=>this.processTemplateData(t,i),processChatData:(t,i)=>this.processChatData(t,i),checkHighlightcode:t=>this.checkHighlightcode(t),addEventListeners:t=>this.addEventListeners(t),customStyle:this.customStyle,customJS:this.customJS,controlSettings:this.botSettings,utmConfig:null===(t=this.botSettings)||void 0===t?void 0:t.utm,conversationId:this.conversationId};if(await M({data:e,currentDomId:this.currentDomId,inputType:"bot",setMessages:t=>{this.messages=[...this.messages,t],requestAnimationFrame((()=>{setTimeout((()=>{t&&t.id&&this.hideSpinner(t).then((()=>{}))}),0)}))},setSurveyDomId:t=>{this.surveyDomId=t},setButtons:t=>{this.buttons=t},config:l}),e.liveAgent&&!this.isLiveAgent&&!this.isConnectingLiveAgent){this.liveAgentDirective=e.liveAgent,this.isConnectingLiveAgent=!0;try{await this.connectLiveChat()}finally{this.isConnectingLiveAgent=!1}}if(e.liveAgent&&!this.isLiveAgent&&!this.isConnectingLiveAgent){this.isConnectingLiveAgent=!0;try{await this.connectLiveChat()}finally{this.isConnectingLiveAgent=!1}}if(this.conversationId=e.conversationId,P(null===(i=this.botSettings)||void 0===i?void 0:i.pId,this.messages,this.conversationId,null!==(o=null===(s=this.botSettings._id)||void 0===s?void 0:s.$oid)&&void 0!==o?o:"",this.visitorID,"bot",{isMinimized:this.isMinimized,isOpened:this.isOpened,isExpanded:this.isExpanded}),this.visitorID&&a){const t=z(this.botSettings.pId,null===(n=this.botSettings._id)||void 0===n?void 0:n.$oid);sessionStorage.setItem(t,JSON.stringify({isMinimized:this.isMinimized,isOpened:this.isOpened,isExpanded:this.isExpanded,messages:this.messages,conversationId:this.conversationId,configId:null===(r=this.botSettings._id)||void 0===r?void 0:r.$oid,visitorID:this.visitorID,projectId:null===(h=this.botSettings)||void 0===h?void 0:h.pId,date:new Date}))}else this.updateBotState();this.scrollToBottom(),this.releaseSendLock(),this.currentDomId=""}catch(t){console.error("Error handling end_response:",t),this.releaseSendLock()}}))}))}updateConversations(t,i){var e,s,o,n,a,r;const h={id:this.currentDomId,text:t,isUser:!1,isLoading:!1,timestamp:(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),images:[],conversationId:this.conversationId,formModel:null!==(n=null!==(o=null===(s=null===(e=i.controlData)||void 0===e?void 0:e.data)||void 0===s?void 0:s.source)&&void 0!==o?o:i.controlData)&&void 0!==n?n:{},surveyDomId:this.surveyDomId,controlType:i.controlType,thumbsId:`${p()}`,showIcon:!i.controlType&&!this.surveyDomId,hideThumbsUpandDown:!!this.isLiveAgent,insightId:null!==(a=null==i?void 0:i.insightId)&&void 0!==a?a:null,sender:null!==(r=null==i?void 0:i.sender)&&void 0!==r?r:null,itemComponent:i};this.messages=this.messages.map((t=>t.id===this.currentDomId?h:t)),requestAnimationFrame((()=>{this.checkHighlightcode(this.currentDomId),this.currentDomId=""}))}checkHighlightcode(t=""){var i;try{if(!t)return console.warn("highlightcodeId is empty"),void(this.isProse=!0);const e=null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector(`#${t}`);if(!e)return console.warn(`Element with id '${t}' not found in shadowRoot`),void(this.isProse=!0);const s=e.querySelectorAll("pre");s.length>0?(e.classList.remove("prose"),import("./p-C3lNE7QP.js").then((function(t){return t.i})).then((({default:t})=>{t.configure({ignoreUnescapedHTML:!0}),s.forEach((i=>{i.dataset.highlighted?console.warn("Element previously highlighted..."):t.highlightElement(i)}))})).catch((t=>console.error("Failed to load highlight.js:",t)))):"form"!==this.messages[this.messages.length-1].controlType&&e.classList.add("prose")}catch(t){console.error("Error in highlightcode:",t),this.isProse=!0}}async handleSurveyCompletionRender(t){const i=this.messages.findIndex((i=>i.surveyDomId===t.domId));if(-1!==i){this.currentDomId=this.messages[i].id,this.surveyDomId=t.domId,this.updateConversations(t.completedHtml,{});const e=t.jsonData;this.query=e;let s=!1;try{s=await this.handleSend(t.completeText,{isHide:!0,bypassSendGuard:!0})}finally{s||console.error("Failed to send form data in finally block"),this.query===e&&(this.query="")}if(!s)return void console.error("Failed to send form data");this.formSubmitted.emit(t.sender.data),this.scrollToBottom()}else console.warn("Could not find message to update for survey completion")}addEventListeners(t){var i;const e=null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector(t);e&&this.buttons.forEach((t=>{const i=e.querySelector(`#${t.id}`);if(i){const e=i.getAttribute("data-original-click");if(!e)return void console.warn(`originalClickHandler is not defined for button with id: ${t.id}`);const s=e.match(/^([\w.]+)\s*\(([\s\S]*)\)$/);if(s){const e=s[1],o=s[2],n=this,a=e.includes(".")?e.split(".").pop():e,r=n[a];i.addEventListener("click",(()=>{if("function"==typeof n[a])try{switch(a){case"sendQuery":console.warn("sendQuery is deprecated, use sendMessage instead");const i=G(o);if(!i)return;i[0]=t.label,r.apply(n,i);break;case"sendMessage":const e=G(o);if(!e)return;r.apply(n,e);break;case"sendJSON":const s=G(o);if(!s)return;r.apply(n,s);break;default:console.warn(`Unknown function: ${a}`)}}catch(t){console.error(`Error invoking ${e}:`,t)}else console.warn(`Function ${a} not found on this`)}))}}}))}async socketConnection(){const t=A(this.dataMode);let i=v(this.dataMode);this.socket=h(i,{transports:"v2"===t?["websocket","polling"]:["polling"]}),await new Promise(((i,e)=>{let s=!1;const o=setTimeout((()=>{if(!s){s=!0;const t="Unable to connect to server. Please try again later.";console.error("Socket connection timed out"),this.errored.emit({message:t,code:"CONNECTION_TIMEOUT"}),e(new Error(t))}}),3e4);this.socket.on("connect",(()=>{"v2"===t?(this.socket.emit("authenticate",{api_key:this.dataKey}),this.socket.once("authenticated",(()=>{s||(s=!0,clearTimeout(o)),this.handleSocketResponse(),i()})),this.socket.once("error",(t=>{"AUTH_FAILED"!==t.code&&"AUTH_REQUIRED"!==t.code&&"AUTH_ERROR"!==t.code||(s||(s=!0,clearTimeout(o)),this.errored.emit(t),e(new Error(t.message)))}))):(s||(s=!0,clearTimeout(o)),this.handleSocketResponse(),i())}))})).catch((t=>{console.error("Socket connection failed:",t.message),this.messages.length>0&&(this.messages[this.messages.length-1].text=t.message,this.messages[this.messages.length-1].isLoading=!1,this.messages=[...this.messages]),this.isStreaming=!1,this.isSending=!1})),this.socket.on("connect_error",(t=>{this.errored.emit(t),this.announce("Unable to connect to chat server. Please try again."),console.error("Connection error:",t)})),this.socket.on("error",(()=>{this.isStreaming&&this.failTurn("Something went wrong. Please try again.")})),this.socket.on("disconnect",(()=>{this.socket.off("response"),this.socket.off("chunk"),this.isStreaming&&this.failTurn("Connection lost. Please try again.")}))}failTurn(t){this.releaseSendLock();const i=this.messages[this.messages.length-1];i&&!i.isUser&&i.isLoading&&(i.text=t,i.isLoading=!1,this.messages=[...this.messages])}invokeSocket(t){var i;let e,s;if("v2"===A(this.dataMode)){s="query";const o=sessionStorage.getItem("ai12zBeaconId");e=Object.assign({query:t,conversation_id:this.conversationId||"",base64_images:(null===(i=this.imagesBase64List)||void 0===i?void 0:i.length)>0?this.imagesBase64List:void 0,beacon_id:this.botSettings.disableBeacon?"":null!=o?o:""},this.botSettings.disableBeacon||o?{}:{beacon_data:V()})}else s="evaluate_query",e={apiKey:this.dataKey,query:t,conversationId:this.conversationId,event:"evaluate_query",attributes:this.dataAttributes,excludeTags:this.excludeTags,includeTags:this.includeTags,base64Images:this.imagesBase64List,meta:x()};this.processDataOverride(e).then((t=>{null!=t&&(this.messageSent.emit(JSON.stringify(t)),this.socket.emit(s,t,(t=>{t&&(this.errored.emit(t),this.announce("Unable to send message. Please try again."),this.currentDomId=`chatbot-${p()}`,this.messages[this.messages.length-1].id=this.currentDomId,this.messages[this.messages.length-1].text="Error connecting to server. Please try again later.")})),this.inputEl&&(this.inputEl.value="",this.adjustHeight()),this.query="")})).catch((t=>{console.error("Error in processDataOverride:",t),this.errored.emit(t),this.releaseSendLock(),this.announce("An error occurred while sending your message.")}))}getConversationHistory(){const t=localStorage.getItem(`${this.visitorID}`);return t?JSON.parse(t):[]}loadConversation(){var t;this.showWelcomeScreen=!1;const i=localStorage.getItem(`${this.visitorID}`);i&&(this.conversationHistory=JSON.parse(i),this.conversationHistory=$(this.conversationHistory,null===(t=this.botSettings._id)||void 0===t?void 0:t.$oid,this.botSettings.pId))}startTimer(){this.timer=setInterval((()=>{this.questionCounter=0,localStorage.setItem("ai12z-bot-data",JSON.stringify({qCounter:this.questionCounter}))}),this.botSettings.autoResetTimer)}stopResponse(){this.ignoreChunks=!0,this.isStreaming=!1,this.releaseSendLock(),this.messages[this.messages.length-1].isLoading=!1}showEmptyMessageValidation(){this.emptyMessageError=!0,this.announce("Message cannot be empty. Please enter a message."),this.inputEl&&this.inputEl.focus(),setTimeout((()=>{this.emptyMessageError=!1}),3e3)}scrollToBottom(){var t;const i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelector(".chat-body");i&&i.scroll({top:i.scrollHeight,behavior:"smooth"}),this.isOpened&&(this.unreadCount=0)}isNearBottom(t=150){var i;const e=null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector(".chat-body");return!e||e.scrollHeight-e.scrollTop-e.clientHeight<=t}scheduleAutoScroll(){this.isNearBottom()&&(this.autoScrollTimer&&clearTimeout(this.autoScrollTimer),this.autoScrollTimer=setTimeout((()=>this.scrollToBottom()),60))}checkLiveAgentBusinessHours(){var t,i,e,s,o,n;const a=null!==(e=null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.liveagent)||void 0===i?void 0:i.businessHours)&&void 0!==e?e:null,r=null!==(n=null===(o=null===(s=this.botSettings)||void 0===s?void 0:s.liveagent)||void 0===o?void 0:o.timezone)&&void 0!==n?n:null;return!a||!r||O(a,r)}checkLiveAgentMode(){var t,i,e,s;const o=(null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.liveagent)||void 0===i?void 0:i.providers)&&Object.keys(null===(s=null===(e=this.botSettings)||void 0===e?void 0:e.liveagent)||void 0===s?void 0:s.providers).length>0;let n=!1;try{n=this.checkLiveAgentBusinessHours()}catch(t){console.error("Error checking live agent business hours:",t)}this.isLiveAgentEnabled=o&&this.messages.length>1&&n}openEndLiveAgentDialog(){this.isToggled=!1,this.showLiveAgentEndDialog=!0}closeEndLiveAgentDialog(){this.showLiveAgentEndDialog=!1}async handleLiveAgentToolbarAction(){this.isLiveAgent?this.openEndLiveAgentDialog():await this.connectLiveChat()}confirmEndLiveAgent(){this.showLiveAgentEndDialog=!1,this.disconnectLiveChat()}disconnectLiveChat(){var t,i,e,s;this.liveAgentEventHandler.disconnectLiveAgent(),this.isLiveAgent=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.liveAgentButtonText="Talk to a Live Agent";const o=""!==(null===(t=this.botSettings)||void 0===t?void 0:t.llmMessageOnDisconnect)?null===(i=this.botSettings)||void 0===i?void 0:i.llmMessageOnDisconnect:"The live agent has been disconnected. Please do not initiate the live agent directive again.",n=""!==(null===(e=this.botSettings)||void 0===e?void 0:e.userMessageOnDisconnect)?null===(s=this.botSettings)||void 0===s?void 0:s.userMessageOnDisconnect:"The live agent has ended the conversation.";this.query=o,this.handleSend(n,{isLiveChatEnded:!0,bypassSendGuard:!0}),this.announce("Live agent chat ended"),this.clearEvents()}removeFindingAgentPlaceholder(){var t;const i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelector('[data-finding-agent="true"]');if(null==i?void 0:i.parentNode){const t=i.parentNode;t.removeChild(i),t.parentNode&&0===t.childElementCount&&t.parentNode.removeChild(t)}}registerLiveAgentListeners(){this.liveAgentListenersRegistered||(this.liveAgentListenersRegistered=!0,K.on("FINDING_AGENT",this.findingAgent),K.on("AGENT_EVENT",this.agentEventHandler),K.on("AGENT_UNAVAILABLE",this.handleAgentUnavailable),K.on("TYPING_STARTED",this.handleTypingStarted),K.on("TYPING_STOPPED",this.handleTypingStopped),K.on("AGENT_MESSAGE",this.agentMessageCreated),K.on("AGENT_ERROR",this.handleAgentError),K.on("CONVERSATION_CLOSED",this.handleAgentConversationEnded),K.on("AGENT_SESSION_INFO",this.handleAgentSessionInfo))}clearEvents(){this.liveAgentListenersRegistered=!1,K.off("FINDING_AGENT",this.findingAgent),K.off("AGENT_EVENT",this.agentEventHandler),K.off("AGENT_UNAVAILABLE",this.handleAgentUnavailable),K.off("AGENT_MESSAGE",this.agentMessageCreated),K.off("AGENT_ERROR",this.handleAgentError),K.off("CONVERSATION_CLOSED",this.handleAgentConversationEnded),K.off("TYPING_STARTED",this.handleTypingStarted),K.off("TYPING_STOPPED",this.handleTypingStopped),K.off("AGENT_SESSION_CREATED",this.handleAgentSessionCreated),K.off("AGENT_SESSION_INFO",this.handleAgentSessionInfo)}async connectLiveChat(){var t,i,e,s,o,n,a,r,h,l,d,c;this.announce("Connecting to live agent"),this.clearEvents();const u=Object.keys(null!==(e=null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.liveagent)||void 0===i?void 0:i.providers)&&void 0!==e?e:{});if(0===u.length)return console.error("No live agent provider found in bot settings"),void this.announce("Live agent is not configured");u.length>1&&console.warn("Multiple live agent providers found, using the first one");let v=null!==(a=null===(n=null===(o=null===(s=this.botSettings)||void 0===s?void 0:s.liveagent)||void 0===o?void 0:o.providers)||void 0===n?void 0:n[u[0]])&&void 0!==a?a:null;if(!v)return console.error("No live agent settings found for the provider",u[0]),void this.announce("Live agent settings are unavailable");if(v){let t=this.getConversationHistory().filter((t=>{var i;return t.conversationId===this.conversationId&&t.projectId===(null===(i=this.botSettings)||void 0===i?void 0:i.pId)}));const i=Object.entries(this.liveAgentDirective&&"object"==typeof this.liveAgentDirective?this.liveAgentDirective:{}).map((([t,i])=>({label:t.charAt(0).toUpperCase()+t.slice(1),value:i,displayToAgent:!0})));let e;this.isTypingIndicatorVisible=!0,v={config:v,userId:this.visitorID,conversationId:this.conversationId,messageHistory:t,extraPrechatFormDetails:i},this.liveAgentProviderName=u[0];try{e=this.checkLiveAgentBusinessHours()}catch(t){return console.error("AI12Z: unexpected error evaluating business hours — blocking live agent connection",t),this.announce("Unexpected error evaluating business hours. Live agent connection blocked."),this.addEventMessage("Unexpected error evaluating business hours. Please try again later."),void(this.isTypingIndicatorVisible=!1)}if(!e){const t=null!==(h=null===(r=v.config)||void 0===r?void 0:r.outsideBusinessHoursMessage)&&void 0!==h?h:"Our live agents are currently offline. Please try again during our business hours.";return this.addEventMessage(t),this.announce("Live agents are currently offline"),void(this.isTypingIndicatorVisible=!1)}if("liveagent"===u[0]){if(!this.liveAgentRef)return this.isTypingIndicatorVisible=!1,console.error("LiveAgent reference is not set"),void this.announce("Live agent is currently unavailable");await this.liveAgentRef.startChat(),this.isLiveAgent=!0,this.liveAgentButtonText="End Live Agent chat",this.announce("Connected to live agent")}else{const t=Number(null===(l=null==v?void 0:v.config)||void 0===l?void 0:l.maxWaitTime),i=1e3*(Number.isFinite(t)&&t>=5?t:300);this.registerLiveAgentListeners();try{await this.liveAgentEventHandler.connectToLiveAgent(u[0],v)}catch(t){return console.error("Live agent connection error:",t),this.isTypingIndicatorVisible=!1,this.liveAgentSessionId="",this.liveAgentConversationId="",this.updateBotState(),this.addEventMessage("Issue connecting to live agent. Please try again later."),this.announce("Issue connecting to live agent. Please try again later."),this.liveAgentEventHandler.disconnectLiveAgent(),void this.clearEvents()}let e,s=()=>{};try{await new Promise(((t,o)=>{s=()=>{this.handleAgentSessionCreated(),t("SUCCESS")},K.on("AGENT_SESSION_CREATED",s),e=setTimeout((()=>o(new Error("TIMEOUT"))),i)}))}catch(t){this.liveAgentSessionId="",this.liveAgentConversationId="",this.isLiveAgent=!1,this.isTypingIndicatorVisible=!1;const i=null!==(c=null===(d=v.config)||void 0===d?void 0:d.maxWaitMessage)&&void 0!==c?c:"Sorry, no agents are available at the moment.";this.removeFindingAgentPlaceholder(),this.addEventMessage(i),this.liveAgentEventHandler.disconnectLiveAgent(),this.clearEvents(),this.updateBotState(),this.announce("Agents are not available at this time.")}finally{e&&clearTimeout(e),K.off("AGENT_SESSION_CREATED",s)}}}}handleMessageKeyNav(t,i){var e,s;if("ArrowDown"===t.key){t.preventDefault();const s=Math.min(this.messages.length-1,i+1);this.focusedIndex=s,null===(e=this.messageRefs[s])||void 0===e||e.focus()}else if("ArrowUp"===t.key){t.preventDefault();const e=Math.max(0,i-1);this.focusedIndex=e,null===(s=this.messageRefs[e])||void 0===s||s.focus()}}async updateBotState(){var t,i,e,s;const o=z(this.botSettings.pId,null===(t=this.botSettings._id)||void 0===t?void 0:t.$oid);let n=await S(o);if(n||(n=I(this.botSettings.pId,null===(i=this.botSettings._id)||void 0===i?void 0:i.$oid)),"string"==typeof n)try{n=JSON.parse(n)}catch(t){console.error("AI12Z: Failed to parse bot state from sessionStorage:",t)}Array.isArray(n)&&(n=n.find((t=>{var i;return t.projectId===(null===(i=this.botSettings)||void 0===i?void 0:i.pId)}))||null);const a={isMinimized:this.isMinimized,isOpened:this.isOpened,isExpanded:this.isExpanded,messages:this.messages,conversationId:this.conversationId,projectId:null===(e=this.botSettings)||void 0===e?void 0:e.pId,configId:null===(s=this.botSettings)||void 0===s?void 0:s._id.$oid,newChat:0===this.messages.length,isLiveAgent:this.isLiveAgent,liveAgentProviderName:this.liveAgentProviderName,liveAgentSessionId:this.liveAgentSessionId,liveAgentConversationId:this.liveAgentConversationId};0===this.messages.length&&(this.conversationId="");try{sessionStorage.setItem(o,JSON.stringify(a)),this.botSettings.cookies&&ot(this.botSettings.subDomain)&&st(o,function(t,i){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)i.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(e[s[o]]=t[s[o]])}return e}(a,["liveAgentSessionId","liveAgentConversationId"]),{domain:this.botSettings.subDomain})}catch(t){console.error("AI12Z: Failed to update bot state in sessionStorage:",t)}}skipTo(t){var i;const e=null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector("#"+t);e&&e.focus()}render(){var t,i,e,s,a,r,h,l,d,c,u,v,p,g,m,f,b,y,w,x,S,A;return this.canRender?o("div",{lang:"en"},o("div",{class:"skip-links "+(this.isOpened?"visible":"hidden")},o("a",{class:"skip-link",href:"#main-content",onClick:()=>this.skipTo("main-content")},"Skip to main content"),o("a",{class:"skip-link",href:"#message-input",onClick:()=>{var t;null===(t=this.inputEl)||void 0===t||t.focus()}},"Skip to message input")),"v1"!==this.botSettings.botVersion&&this.isRendered&&o("div",{class:`pt-0 show-grid ${this.isAnimated?"transition ease-out duration-300":""} layout ${this.isOpened?"is-open":""} ${this.isExpanded?"is-expanded":""} search-flex`,style:{gridTemplateColumns:`0fr minmax(${null!==(t=this.botSettings.minWidth)&&void 0!==t?t:"340px"}, ${null!==(i=this.botSettings.maxWidth)&&void 0!==i?i:"375px"}) 0fr`,paddingTop:null!==(s=null===(e=this.botSettings)||void 0===e?void 0:e.paddingTop)&&void 0!==s?s:"96px"}},o("div",{class:"modal-overlay",role:"none","aria-label":"Close Modal",style:{display:this.isExpanded&&this.isOpened?"grid":"none",opacity:this.isExpanded&&this.isOpened?"1":"0",pointerEvents:this.isExpanded&&this.isOpened?"all":"none"}}),o("div",{class:"modal","data-testid":"modal","aria-hidden":"false",role:"dialog","aria-modal":"true",tabindex:"-1",style:{display:this.isOpened?"grid":"none",opacity:this.isOpened?"1":"0",transform:this.isOpened?"none":"translateY(100%)"}},o("header",{role:"banner"},o("div",{class:"flex bg-white overflow-hidden border-b border-gray-90 border-solid md:pl-3 pl-4 justify-end md:rounded-t-xl items-center toolbar"},o("div",{class:"flex gap-1 toolbar-overflow-actions"},this.isLiveAgentEnabled&&(null===(h=null===(r=null===(a=this.botSettings)||void 0===a?void 0:a.liveagent)||void 0===r?void 0:r.providers)||void 0===h?void 0:h.liveagent)&&o("live-agent-chat",{config:null===(c=null===(d=null===(l=this.botSettings)||void 0===l?void 0:l.liveagent)||void 0===d?void 0:d.providers)||void 0===c?void 0:c.liveagent,ref:t=>this.liveAgentRef=t}),!this.showHistory&&o("button",{class:"rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-transparent hover:bg-blue-95 disabled:bg-transparent disabled:hover:bg-transparent h-6 w-6 bot-btn-primary",tabindex:"0","aria-label":"options menu","aria-haspopup":"menu","aria-expanded":this.isToggled?"true":"false","aria-controls":"dropdown-menu",onClick:t=>{t.preventDefault(),t.stopPropagation(),this.toggleBot(t)}},o("i",{class:"block wes-icon--loading text-body2 modal-toolbar-icon ",title:"Options Menu"},o("svg",{viewBox:"0 0 24 24",id:"align-left-2","data-name":"Flat Line",xmlns:"http://www.w3.org/2000/svg",class:"icon flat-line",fill:"currentColor","aria-hidden":"true"},o("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),o("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),o("g",{id:"SVGRepo_iconCarrier"},o("path",{id:"primary",d:"M3,12H17M3,6H21M3,18H13",style:{fill:"none",stroke:"currentColor"}}))))),this.showHistory&&o("button",{class:"w-6 h-6 back-btn bot-btn-primary",tabindex:"0","aria-label":"Back",onClick:t=>{t.preventDefault(),t.stopPropagation(),this.showHistory=!1,this.showWelcomeScreen=!0,this.isOpened=!0,this.isMinimized=!1,this.isAnimated=!0}},o("i",{title:"Back"},o("svg",{viewBox:"0 0 200 200","data-name":"Layer 1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20","aria-hidden":"true"},o("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),o("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),o("g",{id:"SVGRepo_iconCarrier"},o("title",null),o("path",{d:"M160,89.75H56l53-53a9.67,9.67,0,0,0,0-14,9.67,9.67,0,0,0-14,0l-56,56a30.18,30.18,0,0,0-8.5,18.5c0,1-.5,1.5-.5,2.5a6.34,6.34,0,0,0,.5,3,31.47,31.47,0,0,0,8.5,18.5l56,56a9.9,9.9,0,0,0,14-14l-52.5-53.5H160a10,10,0,0,0,0-20Z"}))))),o("hamburger-menu",{isToggled:this.isToggled,botSettings:this.botSettings,messages:this.messages,liveAgentButtonText:this.liveAgentButtonText,isLiveAgentEnabled:this.isLiveAgentEnabled,onHamburgerMenuClick:t=>{this.menuClick(t.detail)},onHandleByLiveAgent:()=>{this.handleLiveAgentToolbarAction()},onToggledChange:t=>{this.isToggled=t.detail}})),(null===(u=this.botSettings)||void 0===u?void 0:u.botLogo)&&o("img",{src:null===(v=this.botSettings)||void 0===v?void 0:v.botLogo,class:"w-8 h-8 rounded-lg",alt:"Bot Logo"}),o("h2",{class:"flex-1 pl-2 heading text-body1"},null===(p=this.botSettings)||void 0===p?void 0:p.botName),o("div",{class:"buttons flex gap-2 p-[10px]"},this.isLiveAgent&&o("button",{"aria-label":"End Live Agent",title:"End Live Agent",onClick:()=>this.openEndLiveAgentDialog()},o("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 -960 960 960",width:"24px",fill:"#151313"},o("path",{d:"m136-304-92-90q-12-12-12-28t12-28q88-95 203-142.5T480-640q118 0 232.5 47.5T916-450q12 12 12 28t-12 28l-92 90q-11 11-25.5 12t-26.5-8l-116-88q-8-6-12-14t-4-18v-114q-38-12-78-19t-82-7q-42 0-82 7t-78 19v114q0 10-4 18t-12 14l-116 88q-12 9-26.5 8T136-304Zm104-198q-29 15-56 34.5T128-424l40 40 72-56v-62Zm480 2v60l72 56 40-38q-29-26-56-45t-56-33Zm-480-2Zm480 2Z"}))),this.messages.length>0&&o("button",{class:"rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-transparent hover:bg-blue-95 disabled:bg-transparent disabled:hover:bg-transparent h-6 w-6 bot-btn-primary",tabindex:"0",onClick:t=>{t.preventDefault(),this.messages=[],this.isOpened=!0,this.isMinimized=!1,this.showWelcomeScreen=!0,this.showHistory=!1,this.updateBotState(),this.checkLiveAgentMode()},"aria-label":"Start New Conversation",title:"Start New Conversation"},o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20",class:"modal-toolbar-icon","aria-hidden":"true"},o("circle",{cx:"4",cy:"4",r:"1.5"}),o("circle",{cx:"10",cy:"4",r:"1.5"}),o("circle",{cx:"16",cy:"4",r:"1.5"}),o("circle",{cx:"4",cy:"10",r:"1.5"}),o("circle",{cx:"10",cy:"10",r:"1.5"}),o("circle",{cx:"16",cy:"10",r:"1.5"}),o("circle",{cx:"4",cy:"16",r:"1.5"}),o("circle",{cx:"10",cy:"16",r:"1.5"}),o("circle",{cx:"16",cy:"16",r:"1.5"}))),o("button",{class:"rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-transparent hover:bg-blue-95 disabled:bg-transparent disabled:hover:bg-transparent h-6 w-6 bot-btn-primary",tabindex:"0",onClick:t=>{t.preventDefault(),this.showShortcutsDialog=!0},"aria-label":"Keyboard Shortcuts",title:"Keyboard Shortcuts (Press ? for help)"},o("i",{class:"wes-block wes-icon--loading wes-text-body2 modal-toolbar-icon",title:"Keyboard Shortcuts"},o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},o("path",{d:"M3 5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V14C21 15.1046 20.1046 16 19 16H13L9 21V16H5C3.89543 16 3 15.1046 3 14V5Z",stroke:"currentColor","stroke-width":"2"}),o("circle",{cx:"12",cy:"10",r:"1",fill:"currentColor"}),o("path",{d:"M9 10C9 8.34315 10.3431 7 12 7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})))),o("button",{class:"rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-transparent hover:bg-blue-95 disabled:bg-transparent disabled:hover:bg-transparent h-6 w-6 hidden md:flex bot-btn-primary",tabindex:"0",onClick:()=>{this.isExpanded=!this.isExpanded,this.isAnimated=!0,this.updateBotState()},"aria-label":"Collapse Bot to Side Panel","aria-expanded":this.isExpanded?"true":"false","aria-controls":"settings-panel"},o("i",{class:"wes-block wes-icon--loading wes-text-body2 modal-toolbar-icon",title:"Collapse Bot to Side Panel"},this.isExpanded&&o("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor","aria-hidden":"true"},o("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.215 14.7076H27.692C28.3074 14.7076 28.492 14.0307 27.9997 13.5383L24.9843 10.4614L30.5228 4.86149C30.8305 4.5538 30.8305 3.99995 30.5228 3.69226L28.2459 1.41536C27.9382 1.16921 27.4459 1.16921 27.0767 1.4769L21.5381 7.01532L18.3997 3.99995C17.9073 3.50765 17.2304 3.69226 17.2304 4.30764V13.7845C17.2304 14.2153 17.7843 14.7076 18.215 14.7076ZM13.7847 17.2308H4.30766C3.69227 17.2308 3.50765 17.9077 3.99996 18.4L7.01537 21.4769L1.47686 27.0769C1.16917 27.3846 1.16917 27.9384 1.47686 28.2461L3.75381 30.523C4.0615 30.8307 4.55381 30.8307 4.92305 30.523L10.5231 24.923L13.6616 27.9384C14.0924 28.4923 14.7693 28.3076 14.7693 27.6923V18.2769C14.7693 17.8462 14.2154 17.2308 13.7847 17.2308Z"})),!this.isExpanded&&o("svg",{viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor","aria-hidden":"true"},o("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M30.0308 1.23071H20.4923C19.8769 1.23071 19.6923 1.78455 20.1846 2.27686L23.2 5.29222L17.6615 10.8306C17.3538 11.1383 17.3538 11.6306 17.6615 11.9999L19.9384 14.2768C20.2461 14.5845 20.7384 14.5845 21.1077 14.2768L26.7077 8.67681L29.7231 11.6922C30.2154 12.1845 30.7692 11.9999 30.7692 11.3845V1.90763C30.7692 1.5384 30.4 1.23071 30.0308 1.23071ZM2.15379 30.7692H11.6307C12.2461 30.7692 12.4307 30.0923 11.9384 29.6L8.92303 26.5231L14.4615 20.9231C14.7692 20.6154 14.7692 20.0616 14.4615 19.7539L12.1846 17.477C11.8769 17.1693 11.3846 17.1693 11.0153 17.477L5.47687 23.0154L2.39995 20C1.8461 19.5077 1.23071 19.6923 1.23071 20.3077V29.7846C1.23071 30.2153 1.72302 30.7692 2.15379 30.7692Z"})))),o("button",{class:"rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-transparent hover:bg-blue-95 disabled:bg-transparent disabled:hover:bg-transparent h-6 w-6 bot-btn-primary","data-testid":"modal-minimize",tabindex:"0","aria-label":"Minimize",onClick:()=>{this.syncBodyScrollLock(!1),this.isOpened=!1,this.isContent=!(!this.isExpanded||!this.botSettings.isExpanded),this.isMinimized=!this.isExpanded||!this.botSettings.isExpanded,this.isAnimated=!1,this.updateScreenSize(),this.updateBotState(),this.announce("Chat minimized"),this.minimize.emit("minimize")}},o("i",{class:"block wes-icon--loading text-body2 modal-toolbar-icon",title:"Minimize Bot"},o("svg",{viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor","aria-hidden":"true"},o("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M25 24.25C25 24.65 24.65 25 24.25 25H1.75C1.35 25 1 24.65 1 24.25V22.75C1 22.35 1.35 22 1.75 22H24.25C24.65 22 25 22.35 25 22.75V24.25Z"}))))))),o("div",{class:"flex-1 flex flex-col main",role:"main","aria-labelledby":"chat-main-heading",id:"main-content",tabindex:"-1"},o("h1",{id:"chat-main-heading",class:"sr-only"},"Chat"),o("div",{class:"h-full flex flex-col chat-body"},o("div",{class:"px-5 flex-[1_1_0] min-h-[calc(100%-1px)] flex flex-col gap-y-3 @md:px-3 messages-container",role:"region","aria-labelledby":"messages-region-heading"},o("h2",{id:"messages-region-heading",class:"sr-only"},"Messages"),this.showWelcomeScreen&&o("div",{class:"@md:px-6 pb-3 @md:pb-7 @md:pt-8 pt-5 text-display5",innerHTML:null===(m=null===(g=this.botSettings)||void 0===g?void 0:g.welcome)||void 0===m?void 0:m.message}),this.messages.length>0&&!this.showHistory&&this.messages.map(((t,i)=>{var e,s,n,a;return"system"===t.type?o("div",{class:"flex justify-center pb-3 message-item",role:"listitem",tabindex:-1,ref:t=>this.messageRefs[i]=t,"aria-label":t.text},o("span",{class:"text-[10px] font-medium text-gray-500 tracking-wide border-b border-gray-200 py-1 px-3 text-center"},t.text)):o("div",{class:`flex pb-3 gap-x-2 @md:gap-x-3 \n ${t.isUser?"self-end":""}\n ${t.isUser?"justify-end":""} end-user-message message-item`,style:{opacity:"1",transform:"none"},role:"listitem",tabindex:i===this.focusedIndex?0:-1,onKeyDown:t=>this.handleMessageKeyNav(t,i),ref:t=>this.messageRefs[i]=t,"aria-label":"Message from "+(t.isUser?"User":"Bot")},t.isUser&&!t.isHide&&o("div",{class:"flex flex-col items-end"},o("div",{"data-testid":"message",class:"break-words @md:text-body2 box-border @md:pr-4 flex-1 rounded-lg py-2 px-4 user-msg text-body3",innerHTML:t.text,id:t.id,"aria-live":"polite","aria-atomic":"false","aria-label":t.text,role:"log"},null===(e=null==t?void 0:t.images)||void 0===e?void 0:e.map((t=>o("img",{src:t,class:"thumbnail",alt:"thumbnail images"})))),o("div",{class:"text-gray-30 pt-2 text-right text-body4"},"Sent ",t.timestamp)),!t.isUser&&o("div",{class:"avatar-column"},o("chat-avatar",{id:`la${t.id}`,senderType:(null==t?void 0:t.sender)?"agent":"bot",avatarUrl:null===(s=this.botSettings)||void 0===s?void 0:s.botAvatar})),!t.isUser&&o("div",{class:"flex flex-col",style:{width:"100%"}},o("div",{"data-testid":"message",class:{prose:"form"!==t.controlType,"transition-all":!0,"duration-300":!0,"opacity-100":this.isProse,"opacity-90":!this.isProse,"max-w-full break-words @md:text-body2 box-border @md:pr-4 flex-1 rounded-lg text-gray-30 pr-2 text-body3":!0},innerHTML:t.text,id:t.id},t.isLoading&&o("div",{class:"w-full rounded-md",id:"spinner"},o("div",{class:"flex animate-pulse space-x-4"},o("div",{class:"flex-1 space-y-3 py-1"},o("div",{class:"h-4 rounded bg-gray-200"}),o("div",{class:"space-y-3"},o("div",{class:"grid grid-cols-3 gap-4"},o("div",{class:"col-span-2 h-4 rounded bg-gray-200"}),o("div",{class:"col-span-1 h-4 rounded bg-gray-200"})),o("div",{class:"h-4 rounded bg-gray-200"})))))),""!==t.text&&t.showIcon&&(null===(n=this.botSettings.showMessageIcons)||void 0===n||n)&&o("interaction-buttons",{message:t,chatArray:this.messages,currentIndex:i,dataKey:this.dataKey,dataMode:this.dataMode,voice:this.voice,voiceType:this.voiceType,source:"bot",conversationId:this.conversationId,projectId:(null===(a=this.botSettings)||void 0===a?void 0:a.pId)||""}),o("div",{class:"text-gray-30 pt-2 text-body4"},this.botSettings.botName," • ",t.timestamp)))})),this.showHistory&&o("chatbot-history",{chatList:this.conversationHistory,botName:null===(f=this.botSettings)||void 0===f?void 0:f.botName,styles:this.customStyle,scripts:this.customJS}),o("div",{class:"h-px pt-2px",style:{overflowAnchor:"auto"}})),o("div",{role:"status","aria-live":"polite","aria-atomic":"true",class:"sr-only"},this.announceMessage)))),!1!==(null===(b=this.botSettings)||void 0===b?void 0:b.showInput)&&o("form",{"data-testid":"user-input",class:`relative pointer-events-auto ${this.isOpened?"p-2.5":""} searchform user-input`,"aria-label":"Message Area","aria-hidden":"false",style:{opacity:this.isMinimized?"0":"1",transform:"translateX(0)",pointerEvents:this.isMinimized?"none":"auto"}},!this.isOpened&&o("div",{class:`absolute right-4 md:right-0 border-2 border-white border-solid rounded-full ${this.isContent?"":"top-0"} minimize-input`},o("button",{class:"rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-gray-500 bg-opacity-60 hover:bg-opacity-80 h-5 w-5 bot-btn-primary","aria-label":"Minimized to fab Bot",tabindex:"0",onClick:t=>{t.preventDefault();const i=!this.isMinimized,e=!i;this.syncBodyScrollLock(e),this.isMinimized=i,this.isOpened=e,this.updateBotState()}},o("i",{class:"block ai-minimize-icon ai-text-caption",title:"Minimize Bot"},o("svg",{xmlns:"http://www.w3.org/2000/svg",height:"52",width:"52",viewBox:"0 0 520 520",fill:"#fff","aria-hidden":"true"},o("path",{d:"M500 275c0 8-7 15-15 15H35c-8 0-15-7-15-15v-30c0-8 7-15 15-15h450c8 0 15 7 15 15z"}))))),o("fieldset",{class:"flex flex-col @md:mx-0 @md:rounded-t-xl transition-colors "+(this.isMinimized&&!this.isExpanded?"":"p-4 user-input-fieldset")},!this.isExpanded&&this.isOpened&&0===this.messages.length&&o("privacy-modal",{show:this.showPrivacy,message:this.botSettings.privacyTemplate}),o("div",{class:"flex-1 align-bottom"},o("div",{"aria-hidden":this.isTypingIndicatorVisible?"false":"true",class:"flex items-center justify-center w-full "+(this.isTypingIndicatorVisible?"h-12 opacity-100":"h-0 opacity-0 pointer-events-none")},o("typing-indicator",null)),o("div",{class:"grow-wrap show-grid after:whitespace-pre-wrap after:invisible relative","data-replicated-value":"","aria-disabled":"false"},this.botSettings.imageUpload&&o("div",{"aria-disabled":"true",class:`absolute flex items-center left-0 bottom-0 h-full pl-4 pr-2 ${this.hideAllButtons?"hidden":""} agent-input-icon`},o("button",{class:"plus-icon bot-plus-icon bot-btn-primary",tabindex:"0","aria-label":"Add Image",onClick:t=>{t.stopPropagation(),t.preventDefault(),this.showMenu=!this.showMenu}},o("i",{class:"plus-icon bot-plus-icon wes-block wes-text-body1",title:"Add Image"},o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20","aria-hidden":"true"},o("path",{d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"})))),o("div",{class:"absolute bottom-6 left-0 w-44 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n "+(this.showMenu?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-90 pointer-events-none")},o("ul",{class:"space-y-2",ref:t=>this.plusIconRef=t},o("li",{class:"px-4 py-2 hover:bg-gray-100 cursor-pointer flex",onClick:()=>{this.showMenu=!1}},o("image-uploader",{maxImages:10,images:this.imagesBase64List,targetElement:this.inputEl,onImagesChange:t=>{this.errorMessage="",this.showErrorMessage=!1,this.imagesBase64List=[...t.detail]},onImageUploadError:t=>{this.errorMessage=t.detail,this.showErrorMessage=!0,this.announce(t.detail||"Image upload failed")},ref:t=>this.imageUploaderRef=t}))))),o("div",{class:"textarea"},this.imagesBase64List.length>0&&o("div",{class:"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1"},this.imagesBase64List.map(((t,i)=>o("div",{class:"image-Container sc-ai12z-input-form",key:i},o("img",{src:t,style:{width:"70px",height:"50px",borderRadius:"12px"},alt:"uploaded image"}),o("span",{class:"delete-image sc-ai12z-input-form cursor-pointer ml-1",onClick:()=>{this.imagesBase64List=this.imagesBase64List.filter(((t,e)=>e!==i)),this.imageUploaderRef&&"function"==typeof this.imageUploaderRef.removeImageAtIndex&&this.imageUploaderRef.removeImageAtIndex(i),this.imagesBase64List=[...this.imagesBase64List]}},"×"))))),o("textarea",{id:"message-input","aria-invalid":this.emptyMessageError,"aria-describedby":[this.emptyMessageError?"empty-message-error":"","message-hint",0===this.messages.length?"input-enter-tip":""].filter(Boolean).join(" "),"aria-placeholder":this.isLiveAgent?"Type a message to the agent...":""!==(null===(y=this.botSettings)||void 0===y?void 0:y.botPlaceholderText)?null===(w=this.botSettings)||void 0===w?void 0:w.botPlaceholderText:"Ask me anything","aria-label":"Type your message here",class:"resize-none overflow-hidden text-ellipsis focus:outline-none w-full custom-input "+(this.hideAllButtons?"hidden":""),"data-testid":"user-input-textarea",rows:this.rowCount,name:"userMessage",placeholder:this.isLiveAgent?"Type a message to the agent...":""!==(null===(x=this.botSettings)||void 0===x?void 0:x.botPlaceholderText)?null===(S=this.botSettings)||void 0===S?void 0:S.botPlaceholderText:"Ask me anything",ref:t=>this.inputEl=t,onKeyUp:()=>{this.adjustHeight()},onKeyDown:t=>{this.handleKeyDown(t),"Enter"!==t.key||t.shiftKey||(this.syncBodyScrollLock(!0),this.isOpened=!0)},onPaste:t=>{this.handlePaste(t)}}),o("span",{id:"message-hint",class:"sr-only"},"Press Enter to send, Shift+Enter for new line")),this.botSettings.enableMic&&o("div",{class:"absolute bottom-0 "+(this.hideAllButtons?"w-full":"right-8")},o("audio-recorder",{"component-type":"bot",onStartRecord:()=>{this.hideAllButtons=!0},onStopRecord:()=>{this.hideAllButtons=!1},onSendTranscript:t=>{setTimeout((()=>{this.inputEl&&(this.inputEl.value=t.detail,this.adjustHeight(),this.showSubmit=!0)}),1e3)},style:{width:this.hideAllButtons?"100%":"10%"}})),o("div",{class:"absolute right-0 bottom-0 "+(this.hideAllButtons?"hidden":"")},!this.isStreaming&&o("button",{class:"text-white transition rounded-full p-1.5 self-center btn-bg-color bot-btn-primary","aria-label":"Send Message",tabindex:"0",id:"message-submit",onClick:t=>{var i,e;if(t.preventDefault(),""===(null===(i=this.inputEl)||void 0===i?void 0:i.value.trim())&&this.imagesBase64List&&0===this.imagesBase64List.length)return this.emptyMessageError=!0,this.announce("Message cannot be empty. Please enter a message."),this.inputEl&&this.inputEl.focus(),void setTimeout((()=>{this.emptyMessageError=!1}),3e3);this.syncBodyScrollLock(!0),this.isOpened=!0,this.handleSend(null===(e=this.inputEl)||void 0===e?void 0:e.value)}},o("i",{class:"block ai-icon text-body1",title:"Send Message"},o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",class:"size-6","aria-hidden":"true"},o("path",{"fill-rule":"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z","clip-rule":"evenodd"})))),this.isStreaming&&o("button",{class:"text-white transition rounded-full p-1.5 self-center btn-bg-color bot-btn-primary","aria-label":"Stop Streaming",tabindex:"0",id:"message-submit",onClick:t=>{t.preventDefault(),this.syncBodyScrollLock(!0),this.isOpened=!0,this.stopResponse()}},o("i",{class:"block text-body1",title:"Stop Streaming"},o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:"size-6","aria-hidden":"true"},o("path",{d:"M4.5 5.75C4.5 5.05964 5.05964 4.5 5.75 4.5H14.25C14.9404 4.5 15.5 5.05964 15.5 5.75V14.25C15.5 14.9404 14.9404 15.5 14.25 15.5H5.75C5.05964 15.5 4.5 14.9404 4.5 14.25V5.75Z"})))))),this.isExpanded&&!this.isOpened&&o("privacy-modal",{show:this.showPrivacy,message:this.botSettings.privacyTemplate}),0===this.messages.length&&o("div",{id:"input-enter-tip",role:"tooltip",class:"enter-tip"},"Tip: Press Enter to send, Shift+Enter for new line"),this.emptyMessageError&&o("div",{class:"error-message-container"},o("span",{id:"empty-message-error",class:"error-msg",role:"alert"},"Message cannot be empty. Please enter a message to send.")),this.showErrorMessage&&o("p",{class:"error-msg",innerHTML:this.errorMessage}),this.botSettings.buttons&&this.botSettings.buttons.length>0&&!this.isOpened&&o("div",{class:"bot-buttons-container flex flex-wrap gap-2 mt-2.5 mb-1"},this.botSettings.buttons.map(((t,i)=>o("button",{key:i,class:"px-4 py-2 ai12z-btn",onClick:i=>{i.preventDefault(),this.syncBodyScrollLock(!0),this.isOpened=!0,this.isContent=!1,this.handleSend(t.label)}},t.label))))))),o("div",{class:"pointer-events-auto fixed right-7 whitespace-nowrap transition-transform duration-300 ease-in-out fab",style:{opacity:this.isMinimized?"1":"0",transform:this.isMinimized?"translateX(0)":"translateX(-100%)",pointerEvents:this.isMinimized?"auto":"none",transformOrigin:"50% 50% 0px"},onClick:()=>{this.openChat()}},this.isBot&&o("slot",{name:"bot"}),!this.isBot&&o("button",{class:"rounded-full flex cursor-pointer items-center pr-[14px] md:gap-x-3 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-blue-focused bot-btn-primary",tabindex:"0","aria-label":"open Bot"},o("div",{class:"w-10 h-10 flex items-center justify-center bg-white rounded-full border relative"},this.botSettings.botLaunchIcon&&o("img",{src:this.botSettings.botLaunchIcon,alt:"bot icon",class:"w-8 h-8 rounded-lg"}),!this.botSettings.botLaunchIcon&&o("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"#2095ae","aria-hidden":"true"},o("g",{"stroke-width":"0"}),o("g",{"stroke-linecap":"round","stroke-linejoin":"round"}),o("g",null," ",o("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"#2095ae","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})," "))),o("span",{class:"bot-name"}," ",null===(A=this.botSettings)||void 0===A?void 0:A.botName," ")))),o("keyboard-shortcuts-dialog",{show:this.showShortcutsDialog,shortcuts:this.shortcuts,onCloseDialog:()=>{this.showShortcutsDialog=!1}}),o("delete-confirmation-modal",{show:this.showLiveAgentEndDialog,dialogTitle:"End live agent chat?",message:"You are about to end the current live agent conversation. You can continue chatting with the bot after ending it.",confirmButtonText:"End",onConfirmDelete:()=>{this.confirmEndLiveAgent()},onCancelDelete:()=>{this.closeEndLiveAgentDialog()}})):o(n,null,o("span",{style:{display:"none"}},"Failed to load ai12z bot control due to insufficient fund"))}get el(){return a(this)}static get watchers(){return{dataKey:[{onDataKeyChange:0}],dataMode:[{onDataModeChange:0}]}}};at.style=':host{font-family:var(--ai12zBot-v2-font-family) !important;font-size:var(--ai12zBot-v2-font-size) !important;color:var(--ai12zBot-v2-font-color, black);text-align:var(--ai12zBot-v2-text-align, left)}.chat-body{height:100%;overflow-y:auto;display:flex;flex-direction:column;gap:10px;overflow-x:hidden}.chat-body::-webkit-scrollbar{width:5px;height:5px;}.chat-body::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;}.message{padding:10px;border-radius:15px;font-size:14px;line-height:1.4;word-wrap:break-word}span.prose{font-size:14px;}.image-Container{position:relative;display:inline-block;margin-right:10px}.delete-image{opacity:3;position:absolute;right:3px;top:0;cursor:pointer;line-height:10px}.ai12zBtn{background-color:var(--ai12zBot-v2-button-background) !important;color:var(--ai12zBot-v2-button-font-color);padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px}.ai12z-btn{background-color:var(--ai12zBot-v2-button-background) !important;color:var(--ai12zBot-v2-button-font-color);padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px}.custom-privacy{color:var(--ai12z-bot-privacy-color);padding-bottom:10px;padding-left:5px;margin-top:auto;}@media (max-width: 768px){.hide-chatbot{display:none !important}}:host{--wes-c-icon-color:#fff;--fab-bottom:26px;--xsf-ai12z-zindex-isexpanded-10:20020;--ai-toolbar-icon-color:#2095ae;--xsf-ai12z-zindex-0:19979;--xsf-ai12z-zindex-10:19989;--xsf-ai12z-fab-bottom:26px}.modal-overlay{position:absolute;height:100%;width:100%;z-index:var(--xsf-ai12z-zindex-0);background-color:#2e2e2e99}.layout{pointer-events:none;position:fixed;inset:0;height:100dvh;width:99dvw;justify-content:flex-end;grid-template-rows:auto 1fr auto;grid-template-areas:"left toolbar right" "left main right" "left footer right";padding-top:96px;transition-property:grid-template-columns, padding-top;z-index:19979}.layout.is-open .modal{pointer-events:auto}.layout.is-expanded ai12z-bot{pointer-events:auto}.layout.is-open.is-expanded .modal{border-top-left-radius:12px;border-top-right-radius:12px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);z-index:var(--xsf-ai12z-zindex-isexpanded-10)}.layout.is-open .user-input-fieldset{background-image:none;padding:0px;background:none}.layout.is-expanded .user-input-fieldset{border-top-left-radius:12px;border-top-right-radius:12px}.layout.is-open .grow-wrap>.textarea,.layout.is-open .grow-wrap>button,.layout.is-open .grow-wrap:after{border-color:var(--ai12zBot-v2-searchbar-open-border-color);}.layout.is-expanded .grow-wrap:after{display:none}.layout.is-open.is-expanded .user-input{z-index:var(--xsf-ai12z-zindex-isexpanded-10)}.layout.is-open .user-input{z-index:var(--xsf-ai12z-zindex-10)}.text-body2{font-size:16px;line-height:1.5;letter-spacing:-0.12px;font-weight:400}.modal-toolbar-icon{color:var(--ai12zBot-v2-toolbar-icon-color, inherit);width:16px;height:16px}.search-flex{flex:1 1 0%}.show-grid{display:grid}.hide-title{padding:0px;opacity:0;height:0px}.user-msg{background-color:var(--ai12zBot-v2-user-bubble-background);color:var(--ai12zBot-v2-user-bubble-font-color)}.text-body4{font-size:var(--ai12zBot-v2-timestamp-font-size);line-height:1.5;letter-spacing:0.03px;font-weight:400;color:var(--ai12zBot-v2-timestamp-font-color)}.isContent{background:var(--ai12zBot-v2-content-background);padding:10px}.default-botAvatar{color:var(--ai12zBot-v2-default-avatar-color)}.searchform{opacity:1;transform:none}.user-input{margin-left:auto;margin-right:auto;width:100%;max-width:840px;min-width:340px;grid-area:footer}.main{margin-left:auto;margin-right:auto;width:100%;max-width:840px;min-width:340px;margin-top:7px}.heading{color:var(--ai12zBot-v2-title-color)}.dropdown-item-button{display:flex;width:100%;cursor:pointer;align-items:center;-moz-column-gap:8px;column-gap:8px;border-radius:4px;--tw-border-opacity:1;--tw-bg-opacity:1;background-color:var(--ai12zBot-v2-dropdown-bgcolor);padding:8px 24px;font-weight:500;--tw-text-opacity:1;color:var(--ai12zBot-v2-dropdown-font-color);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:75ms}.helptext{padding:0px;opacity:0;height:0px}.minimize-input{transform:translateY(calc(-100% - 4px))}.ai-text-caption{font-size:12px;line-height:1.5;letter-spacing:0.2px;font-weight:400}.fab>button{background:var(--ai12zBot-v2-fab-button-background);}.user-input-fieldset{background:var(--ai12zBot-v2-searchbar-background)}.return-text-color{color:rgb(255, 255, 255)}.ai-minimize-icon svg{fill:currentColor;height:1em;width:1em}.hide-form{opacity:0;transform:none}.show-form{opacity:1;transform:none}.ai-minimize-icon{color:var(--wes-c-icon-color, inherit)}.fab{bottom:var(--fab-bottom, 30px)}.text-body1{font-size:var(--ai12zBot-v2-title-font-size);line-height:1.5;letter-spacing:-0.12px;font-weight:400}#message-submit{margin-right:6px;margin-bottom:7px;background-color:var(--ai12zBot-v2-searchbar-submit-bgcolor)}.ai-icon{color:var(--ai12zBot-v2-searchbar-submit-color);font-size:24px;width:24px;height:24px}.bot-plus-icon{color:var(--ai12zBot-v2-searchbar-plus-icon-color);font-size:24px;width:24px;height:24px}.grow-wrap>.textarea,.grow-wrap:after{min-height:48px;align-content:center;border-radius:24px;border-width:1px;border-style:solid;border:1px solid var(--ai12zBot-v2-searchbar-border-color);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:8px 48px;text-indent:2px;font-size:16px;line-height:1.5;letter-spacing:-0.12px;font-weight:400;--tw-text-opacity:1;color:rgb(46 46 46 / var(--tw-text-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-ring-inset:inset;--tw-ring-offset-width:0px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:0.15s}.grow-wrap>.textarea,.grow-wrap:after{grid-area:1 / 1 / 2 / 2}.modal{position:relative;grid-column:span 1 / span 1;grid-column-start:2;grid-row:span 3 / span 3;grid-row-start:1;display:grid;border-top-left-radius:0;border-top-right-radius:0;background-position:center;box-shadow:0 16px 32px -4px #18181829, 0 12px 24px -4px #18181814;background-image:var(--ai12zBot-v2-modal-backgroundImage);background-repeat:no-repeat;background-size:100vw 100vh;grid-template-columns:subgrid;grid-template-rows:subgrid;z-index:var(--xsf-ai12z-zindex-10);transition:0.3sease-out;transition-property:grid-template-columns}.dropdown-menu{pointer-events:none;opacity:0;z-index:10;background-color:var(--ai12zBot-v2-dropdown-bgcolor);transform:translateY(-10px);transition:opacity 0.3s ease, transform 0.3s ease}.dropdown-menu.show{pointer-events:auto;opacity:1;pointer-events:auto;transform:translateY(0);background-color:var(--ai12zBot-v2-dropdown-bgcolor)}.copy-btn{color:var(--ai12zBot-v2-copy-btn-color)}.thumbs-up{fill:var(--ai12zBot-v2-feedback-selected);width:24px}.thumbs-down{fill:var( --ai12zBot-v2-feedback-selected);width:24px}.chat-thumbs-up{color:var(--ai12zBot-v2-feedback-color)}.thumbs-container{justify-content:flex-start;align-items:center}.back-btn svg{fill:var(--ai12zBot-v2-back-button-color)}.dropdown-item{background-color:var(--ai12zBot-v2-dropdown-bgcolor)}button:focus-visible{outline:2px solid var(--ai12zBot-v2-focus-visible-color, #0A2A43);outline-offset:2px}button.bot-btn-primary:focus-visible{outline:2px solid var(--ai12zBot-v2-focus-visible-color-primary, var(--ai12zBot-v2-focus-visible-color, #0A2A43));outline-offset:2px}button.bot-btn-secondary:focus-visible{outline:2px solid var(--ai12zBot-v2-focus-visible-color-secondary, var(--ai12zBot-v2-focus-visible-color, #0A2A43))}.bot-name{color:var(--ai12zBot-v2-fab-name-color, var(--ai12zBot-v2-bot-name-color));font-weight:var(--ai12zBot-v2-fab-font-weight, var(--ai12zBot-v2-bot-name-font-weight))}.ai12z-link{color:var(--ai12zBot-v2-link-color);text-decoration:underline}.ai12z-link:hover{color:var(--ai12zBot-v2-link-hover-color);text-decoration:underline}.toolbar{height:52px;border:#fff;grid-area:toolbar}.skip-link{position:absolute;left:-999px;top:auto;width:1px;height:1px;overflow:hidden}.skip-link:focus{left:10px;top:10px;width:auto;height:auto;z-index:1000}.enter-tip{font-size:12px;color:#666;margin-left:10px}.skip-links.hidden{position:absolute;left:-9999px;}.skip-links.visible{left:auto;position:static;}.error-message-container{margin-top:4px}.error-msg{color:#dc2626;font-size:12px;display:block;animation:slideIn 0.2s ease-out}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}@keyframes slideIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media (min-width: 1024px){.modal{background-size:80vw 100vh}}@media (min-width: 1024px){.layout.is-expanded{grid-template-columns:1fr minmax(340px, 80dvw) 1fr !important}}@media (min-width: 768px){.layout.is-expanded{-moz-column-gap:48px;column-gap:48px}}@media (max-width: 767px){.layout.is-open{padding-top:0px !important;grid-template-columns:0fr minmax(340px, 1fr) 0fr !important}}@media (max-width: 767px){.fab{right:30px;bottom:var(--xsf-ai12z-fab-bottom, 26px)}}';export{at as ai12z_bot}
|
|
@@ -11,6 +11,11 @@ declare global {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
type HandleSendOptions = {
|
|
15
|
+
isHide?: boolean;
|
|
16
|
+
isLiveChatEnded?: boolean;
|
|
17
|
+
bypassSendGuard?: boolean;
|
|
18
|
+
};
|
|
14
19
|
export declare class Ai12zBot {
|
|
15
20
|
private cdnPath;
|
|
16
21
|
private surveyCDNPath;
|
|
@@ -26,6 +31,7 @@ export declare class Ai12zBot {
|
|
|
26
31
|
private socket;
|
|
27
32
|
private liveAgentRef;
|
|
28
33
|
private ignoreChunks;
|
|
34
|
+
private streamEndWatchdog?;
|
|
29
35
|
private unreadCount;
|
|
30
36
|
private hasPersistedConversationId;
|
|
31
37
|
liveAgentButtonText: string;
|
|
@@ -109,6 +115,7 @@ export declare class Ai12zBot {
|
|
|
109
115
|
shortcuts: KeyboardShortcut[];
|
|
110
116
|
announceMessage: string;
|
|
111
117
|
liveAgentDirective: boolean | Object;
|
|
118
|
+
isSending: boolean;
|
|
112
119
|
private imageUploaderRef;
|
|
113
120
|
private messageRefs;
|
|
114
121
|
messageSent: EventEmitter;
|
|
@@ -144,6 +151,9 @@ export declare class Ai12zBot {
|
|
|
144
151
|
onDataModeChange(_v: string): void;
|
|
145
152
|
private hydrateStateFromStorage;
|
|
146
153
|
private recoverLiveAgentSession;
|
|
154
|
+
private releaseSendLock;
|
|
155
|
+
private clearStreamEndWatchdog;
|
|
156
|
+
private resetStreamEndWatchdog;
|
|
147
157
|
componentDidLoad(): void;
|
|
148
158
|
private hydrateMessagesFromState;
|
|
149
159
|
disconnectedCallback(): void;
|
|
@@ -177,7 +187,8 @@ export declare class Ai12zBot {
|
|
|
177
187
|
private handleSurveyCompletionRender;
|
|
178
188
|
addEventListeners(msgId: any): void;
|
|
179
189
|
socketConnection(): Promise<void>;
|
|
180
|
-
|
|
190
|
+
private failTurn;
|
|
191
|
+
invokeSocket(query: string): void;
|
|
181
192
|
handleMessage: (data: any, aiMessageId: any) => void;
|
|
182
193
|
getConversationHistory(): any;
|
|
183
194
|
loadConversation(): void;
|
|
@@ -185,10 +196,7 @@ export declare class Ai12zBot {
|
|
|
185
196
|
updateScreenSize: () => void;
|
|
186
197
|
stopResponse(): void;
|
|
187
198
|
private showEmptyMessageValidation;
|
|
188
|
-
handleSend: (eleValue: string, options?:
|
|
189
|
-
isHide?: boolean;
|
|
190
|
-
isLiveChatEnded?: boolean;
|
|
191
|
-
}) => Promise<void>;
|
|
199
|
+
handleSend: (eleValue: string, options?: HandleSendOptions) => Promise<boolean>;
|
|
192
200
|
scrollToBottom(): void;
|
|
193
201
|
private autoScrollTimer?;
|
|
194
202
|
/** True when the chat is scrolled to (or within `threshold`px of) the bottom. */
|
|
@@ -231,3 +239,4 @@ export declare class Ai12zBot {
|
|
|
231
239
|
skipTo(id: string): void;
|
|
232
240
|
render(): any;
|
|
233
241
|
}
|
|
242
|
+
export {};
|