ai12z 3.18.1-alpha.2 → 3.18.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/ai12z-bot.cjs.entry.js +1 -10
  2. package/dist/cjs/ai12z-chat_2.cjs.entry.js +2 -2
  3. package/dist/cjs/ai12z-cta.cjs.entry.js +2 -2
  4. package/dist/cjs/ai12z-inline-search.cjs.entry.js +2 -2
  5. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +1 -1
  6. package/dist/cjs/index.cjs.js +2 -2
  7. package/dist/cjs/{response-adapter-BSZc0N1k.js → response-adapter-BiZsYx3F.js} +20 -15
  8. package/dist/cjs/search-results-page.cjs.entry.js +2 -2
  9. package/dist/cjs/{socket-service-Bcv9pRTP.js → socket-service-te83hltJ.js} +1 -1
  10. package/dist/collection/components/ai12z-bot/ai12z-bot.js +0 -9
  11. package/dist/collection/utils/response-adapter.js +20 -15
  12. package/dist/components/ai12z-bot.js +1 -1
  13. package/dist/components/ai12z-chat.js +1 -1
  14. package/dist/components/ai12z-cta.js +1 -1
  15. package/dist/components/ai12z-inline-search.js +1 -1
  16. package/dist/components/ai12z-knowledge-box.js +1 -1
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/{p-xPuA7imU.js → p-8eJxsLkS.js} +1 -1
  19. package/dist/components/p-C46Y7kat.js +1 -0
  20. package/dist/components/{p-BBkshCs2.js → p-CFCrlzgY.js} +1 -1
  21. package/dist/components/{p-H6rMkkSS.js → p-DDYdjgom.js} +1 -1
  22. package/dist/components/{p-C8xryOSN.js → p-DWBK1wub.js} +1 -1
  23. package/dist/components/{p-D-LWGuqg.js → p-DuK8LlQX.js} +1 -1
  24. package/dist/components/{p-zb604YaC.js → p-u3zsAAw1.js} +1 -1
  25. package/dist/components/search-results-page.js +1 -1
  26. package/dist/esm/ai12z-bot.entry.js +1 -10
  27. package/dist/esm/ai12z-chat_2.entry.js +2 -2
  28. package/dist/esm/ai12z-cta.entry.js +2 -2
  29. package/dist/esm/ai12z-inline-search.entry.js +2 -2
  30. package/dist/esm/ai12z-knowledge-box.entry.js +1 -1
  31. package/dist/esm/index.js +2 -2
  32. package/dist/esm/{response-adapter-BimJyCOz.js → response-adapter-BWIiHoX4.js} +20 -15
  33. package/dist/esm/search-results-page.entry.js +2 -2
  34. package/dist/esm/{socket-service-CM_mMRg5.js → socket-service-CAIM0w4e.js} +1 -1
  35. package/dist/library/index.esm.js +1 -1
  36. package/dist/library/library.esm.js +1 -1
  37. package/dist/library/{p-b27a2375.entry.js → p-0a15affd.entry.js} +1 -1
  38. package/dist/library/{p-03149eb5.entry.js → p-10584795.entry.js} +1 -1
  39. package/dist/library/{p-26368908.entry.js → p-1cbe7a81.entry.js} +1 -1
  40. package/dist/library/{p-66441613.entry.js → p-7be84a00.entry.js} +1 -1
  41. package/dist/library/p-80061823.entry.js +1 -0
  42. package/dist/library/{p-e15861ae.entry.js → p-8793243c.entry.js} +1 -1
  43. package/dist/library/{p-BimJyCOz.js → p-BWIiHoX4.js} +1 -1
  44. package/dist/library/{p-EFsTeS2j.js → p-DXkcorv-.js} +1 -1
  45. package/dist/types/utils/response-adapter.d.ts +6 -1
  46. package/package.json +2 -2
  47. package/dist/components/p-C5WJ7k2H.js +0 -1
  48. package/dist/library/p-6ad5e049.entry.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var responseAdapter = require('./response-adapter-BSZc0N1k.js');
4
+ var responseAdapter = require('./response-adapter-BiZsYx3F.js');
5
5
  var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
6
6
  var logger$2 = require('./logger-D--BUQGx.js');
7
7
  var utils = require('./utils-kaVdO3ki.js');
@@ -2420,15 +2420,6 @@ const Ai12zBot = class {
2420
2420
  this.isConnectingLiveAgent = false;
2421
2421
  }
2422
2422
  }
2423
- if (data.liveAgent && !this.isLiveAgent && !this.isConnectingLiveAgent) {
2424
- this.isConnectingLiveAgent = true;
2425
- try {
2426
- await this.connectLiveChat();
2427
- }
2428
- finally {
2429
- this.isConnectingLiveAgent = false;
2430
- }
2431
- }
2432
2423
  // ✅ Common cleanup
2433
2424
  this.conversationId = data.conversationId;
2434
2425
  // this.saveConversation()
@@ -6,7 +6,7 @@ var parseHelper = require('./parseHelper-DGQ2ETjm.js');
6
6
  var utils = require('./utils-kaVdO3ki.js');
7
7
  var ctaHelpers = require('./ctaHelpers-CFn_XVtl.js');
8
8
  var index$1 = require('./index-DN109Evg.js');
9
- var socketService = require('./socket-service-Bcv9pRTP.js');
9
+ var socketService = require('./socket-service-te83hltJ.js');
10
10
  var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
11
11
  var keyboardShortcuts = require('./keyboard-shortcuts-g_HyNYT-.js');
12
12
  var analyticsService = require('./analyticsService-CkAva47S.js');
@@ -14,7 +14,7 @@ var botHelpers = require('./botHelpers-B_lFspU6.js');
14
14
  var beacon = require('./beacon-Dzm5dknI.js');
15
15
  require('./_commonjsHelpers-MBWFX2dn.js');
16
16
  require('./logger-D--BUQGx.js');
17
- require('./response-adapter-BSZc0N1k.js');
17
+ require('./response-adapter-BiZsYx3F.js');
18
18
 
19
19
  const ai12zChatCss = () => `:host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}.not-allowed{cursor:not-allowed}.prose.custom-prose{--tw-prose-body:var(--ai12z-bubble-font-color);--tw-prose-bold:var(--ai12z-bubble-font-color);--tw-prose-links:var(--ai12z-link-color);--tw-prose-headings:var(--ai12z-bubble-font-color)}.ai12z-cta-link{color:var(--ai12z-link-color);text-decoration:underline}.ai12z-cta-link:hover{color:var(--ai12z-link-hover-color)}@media (max-width: 768px){.chat-align-list{padding:16px 16px 16px 0px !important}.chat-not-user-list{padding-inline-start:40px !important}}.thumbs-up{fill:var(--ai12z-feedback-selected);width:24px}.thumbs-down{fill:var(--ai12z-feedback-selected);width:24px}.chat-thumbs-up{color:var(--ai12z-feedback-color)}.default-avatar{color:var(--ai12z-default-avatar-color, var(--ai12z-primary-color))}.chat-list{margin-top:20px;overflow-y:auto;display:flex;flex-direction:column}.custom-chat-top-height{max-height:100vh}@media (max-width: 768px){.custom-chat-bottom-height{max-height:700px}.default-avatar{display:none !important}}.custom-chat-bottom-height{max-height:100%}.custom-chat-above-height{max-height:80vh;margin-bottom:20px}.custom-list{overflow-y:auto}.chat-list-item{padding:32px 8px 0 4px;display:flex;position:relative;color:var(--ai12z-bubble-font-color);font-size:var(--ai12z-bubble-font-size)}.chat-align-list{justify-content:flex-start;padding-inline-end:40px}.chat-not-user-list{justify-content:flex-end;padding-inline-start:80px}.chat-inner-list{display:flex;align-items:flex-end;padding-right:8px}.pending-chat{display:flex;justify-content:center;align-items:center;border-width:1px;padding:20px;line-height:28px;border-radius:8px}.non-pending-user{line-height:28px;border-radius:8px}.chat-not-user-list #parent-element .non-pending-user{background-color:var(--ai12z-user-bubble-background, var(--ai12z-bubble-background))}.chat-align-list #parent-element .non-pending-user{background-color:var(--ai12z-ai-bubble-background, var(--ai12z-bubble-background));border:var(--ai12z-ai-bubble-border)}#parent-element{position:relative}.non-user-container{position:absolute;right:0;top:0;width:176px}.thumbnail{margin-bottom:30px;width:70%}.ai12z_image_result{max-width:500px;width:100%;border-radius:5%;padding:20px}.ai12z_image_caption{margin:20px;padding:1px;background-color:#f0f0f0;border-radius:5px;text-align:center}.resize{width:100%}.prose.prose-w-none *{all:unset;}.non-pending-user .ai12zBtn{background-color:var(--ai12z-primary-color);color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px}.ai12zBtn:active{background-color:rgb(118 135 214)}::-webkit-scrollbar{width:12px;height:12px}::-webkit-scrollbar-track{background:#f1f1f1;border-radius:10px}::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;border:2px solid #f1f1f1}::-webkit-scrollbar-thumb:hover{background:#555}.copy-btn{color:var(--ai12z-feedback-color)}.list-btn{background-color:#007bff;color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px;max-width:100%;}.pagination-controls{display:flex;justify-content:space-between;margin-top:20px}.pagination-controls button{padding:10px 20px;border:none;background-color:#007bff;color:white;cursor:pointer;border-radius:5px}.pagination-controls button:disabled{background-color:#ccc;cursor:not-allowed}.pagination-controls span{align-self:center;font-size:1.1em}.hidden{display:none}.carousel-container{position:relative;display:flex;overflow:hidden;margin:0 auto;width:100%;max-width:100%}.carousel-items{display:flex;transition:transform 0.3s ease-in-out;width:100%}.carousel-card{flex-shrink:0;width:100%}.card img{width:100%;height:auto}.card-body{margin:15px}.prev,.next{background:#007bff;border:none;color:white;padding:10px;cursor:pointer;border-radius:50%;position:absolute;top:50%;transform:translateY(-50%);z-index:10}.prev{cursor:pointer;left:0px}.next{cursor:pointer;right:0px}.carousel-indicators{display:flex;justify-content:center;margin-top:10px;bottom:4px;left:50%}.indicator{width:10px;height:10px;background-color:gray;border-radius:50%;margin:0 5px;cursor:pointer}button:focus-visible{outline:2px solid var(--ai12z-focus-visible-color, #0A2A43);outline-offset:2px}button.chat-btn-primary:focus-visible{outline:2px solid var(--ai12z-focus-visible-color-primary, --ai12z-focus-visible-color);outline-offset:2px}button.chat-btn-secondary:focus-visible{outline:2px solid var(--ai12z-focus-visible-color-secondary, --ai12z-focus-visible-color)}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}`;
20
20
 
@@ -3,7 +3,7 @@
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var utils = require('./utils-kaVdO3ki.js');
5
5
  var SearchResult = require('./SearchResult-CvTJr55G.js');
6
- var socketService = require('./socket-service-Bcv9pRTP.js');
6
+ var socketService = require('./socket-service-te83hltJ.js');
7
7
  var globalStore = require('./global-store-R6x06KvJ.js');
8
8
  var reCaptchaHelpers = require('./reCaptchaHelpers-C8v6BB6z.js');
9
9
  var ctaHelpers = require('./ctaHelpers-CFn_XVtl.js');
@@ -11,7 +11,7 @@ var beacon = require('./beacon-Dzm5dknI.js');
11
11
  var appStore = require('./app-store-BtkiHvcw.js');
12
12
  var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
13
13
  var purify_es = require('./purify.es-B7Ashs9w.js');
14
- require('./response-adapter-BSZc0N1k.js');
14
+ require('./response-adapter-BiZsYx3F.js');
15
15
 
16
16
  const ai12zCtaCss = () => `:host{--bg-smoke-light:rgba(0, 0, 0, 0.5);margin-left:20px;font-family:var(--ai12z-search-font-family) var(--ai12z-font-family) !important;font-size:var(--ai12z-search-font-size, var(--ai12z-font-size)) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}.keyboard-shortcuts-btn{vertical-align:middle;padding-right:5px;color:#666}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.skip-links{position:relative;z-index:9999}.skip-link{position:absolute;top:-40px;left:0;background-color:var(--ai12z-primary-color, #007bff);color:white;padding:8px 16px;text-decoration:none;border-radius:4px;font-weight:500;z-index:10000;opacity:0;pointer-events:none;transition:top 0.2s, opacity 0.2s}.skip-link:focus{top:8px;opacity:1;pointer-events:auto;outline:3px solid var(--ai12z-secondary-accent, #0056b3);outline-offset:2px}.bg-smoke-light{transition:opacity 300ms ease-in-out;position:fixed;top:0;left:0;z-index:200;height:100vh;width:100vw;cursor:auto;flex-direction:column;background-color:#0003;--tw-backdrop-blur:blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.modal-content{transition:transform 300ms ease-in-out, opacity 300ms ease-in-out;transform:scale(0.9);opacity:0}.modal-position{position:relative;padding:32px 16px 8px;flex-direction:column}.modal-header-position{padding:0px 0px 8px 0px}.cta-header{min-height:48px;padding:0 0 12px}.modal-close:hover{color:rgb(31 41 55)}.model-heading{color:var(--ai12z-heading-color);font-size:var(--ai12z-heading-font-size)}:host(.show-modal) .bg-smoke-light{opacity:1}:host(.show-modal) .modal-content{transform:scale(1);opacity:1}.modal-content-wrapper{background-color:rgb(255 255 255);width:100%;max-width:768px;border-radius:8px;clip-path:inset(0 round 8px)}.model-wrapper{position:fixed;top:0;left:0;z-index:200;height:100vh;width:100vw;cursor:auto;flex-direction:column;background-color:#0003;padding:16px;--tw-backdrop-blur:blur(4px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.custom-model{overflow:auto;inset:0px;position:fixed;min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-items:center}.hide-dialog{display:none !important}.modal-position .btn-position{position:absolute;right:0px;top:0px;padding:4px 16px;color:var(--ai12z-secondary-accent, #0056B3)}@media (max-width: 768px){.modal-content-wrapper{width:100%;height:100vh;height:100dvh !important;margin:0 !important;border-radius:0;overflow:auto;max-width:none !important}.custom-privacy{position:fixed !important;bottom:0;left:0;width:100%;padding:10px}.modal-position .btn-position{padding:7.2px 12px 7.2px 16px;position:fixed}.content-area{padding:0px !important}.modal-header-position{padding:0px 16px 8px}.has-conversation .welcome-template-top-container,.has-conversation .welcome-template-bottom-container{display:none}}.btn-left{top:0;left:0;position:absolute;padding:5.6px 16px;color:var(--ai12z-secondary-accent, #0056B3)}.custom-privacy{color:var(--ai12z-knowledge-box-privacy-color);text-align:center;margin-top:auto;bottom:0;left:0;right:0}.custom-button{align-items:center;text-align:left;background-color:rgb(255 255 255);color:rgb(148 163 184);border-radius:8px;width:288px;min-height:48px;padding-left:16px;padding-right:16px}.custom-msg{text-align:center;color:var(--ai12z-font-mute);justify-content:center;max-width:none !important;}.cta-search-results{border-top-width:1px;border-bottom-width:0px;border-color:rgb(243 244 246)}.cta-search-results-list{position:relative;padding-bottom:20px;padding-top:20px}.cta-search-results-list:hover{background-color:var(--ai12z-hover-bg-color)}.cta-search-container{margin-left:auto;margin-right:auto;display:flex;max-width:896px;justify-content:space-between;-moz-column-gap:24px;column-gap:24px}.cta-search-container-two{display:flex;min-width:0px;-moz-column-gap:16px;column-gap:16px}.cta-search-container-three{min-width:0px;flex:1 1 auto}.cta-search-text{font-weight:600;line-height:24px;font-size:var(--ai12z-search-result-title-font-size);color:var(--ai12z-search-result-title-color)}.cta-search-text-position{position:absolute;left:0px;right:0px;top:-1px;bottom:0px}.cta-search-description{margin-top:4px;display:flex;font-size:var(--ai12z-search-result-description-font-size);line-height:16px;line-height:20px;color:var(--ai12z-search-result-description-color)}.cta-search-list-arrow{display:flex;align-items:center;flex-shrink:0;-moz-column-gap:16px;column-gap:16px}.custom-icon-width{width:64px}.results-icon svg{width:24px;height:24px}.modal-body{display:flex;flex-direction:column}.cta-layout{display:flex;flex:1;min-height:0}.cta-layout.normal{flex-direction:column}.cta-layout.reverse{flex-direction:column-reverse}.input-wrapper{position:sticky;top:0;bottom:0;z-index:10;background:white;padding:16px}.content-area{flex:1;padding:12px}.welcome-template-top-container{padding-top:10px}.welcome-template-bottom-container{padding-bottom:10px}`;
17
17
 
@@ -3,8 +3,8 @@
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var utils = require('./utils-kaVdO3ki.js');
5
5
  var SearchResult = require('./SearchResult-CvTJr55G.js');
6
- var socketService = require('./socket-service-Bcv9pRTP.js');
7
- require('./response-adapter-BSZc0N1k.js');
6
+ var socketService = require('./socket-service-te83hltJ.js');
7
+ require('./response-adapter-BiZsYx3F.js');
8
8
 
9
9
  const ai12zInlineSearchCss = () => `:host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}`;
10
10
 
@@ -3,7 +3,7 @@
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var utils = require('./utils-kaVdO3ki.js');
5
5
  var styleSheetRegistry = require('./styleSheetRegistry-Cv84KUXj.js');
6
- var responseAdapter = require('./response-adapter-BSZc0N1k.js');
6
+ var responseAdapter = require('./response-adapter-BiZsYx3F.js');
7
7
  var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
8
8
  var globalStore = require('./global-store-R6x06KvJ.js');
9
9
  var index$1 = require('./index-DN109Evg.js');
@@ -12,7 +12,7 @@ var ai12zContainer_entry = require('./ai12z-container.entry.cjs.js');
12
12
  require('./index-v8T1EJAJ.js');
13
13
  require('./beacon-Dzm5dknI.js');
14
14
  require('./utils-kaVdO3ki.js');
15
- require('./response-adapter-BSZc0N1k.js');
15
+ require('./response-adapter-BiZsYx3F.js');
16
16
  require('./processCarouselData-BPxsH6Ck.js');
17
17
  require('./_commonjsHelpers-MBWFX2dn.js');
18
18
  require('./logger-D--BUQGx.js');
@@ -28,7 +28,7 @@ require('./app-store-BtkiHvcw.js');
28
28
  require('./parseHelper-DGQ2ETjm.js');
29
29
  require('./bodyScrollLock-C7gKTAfx.js');
30
30
  require('./SearchResult-CvTJr55G.js');
31
- require('./socket-service-Bcv9pRTP.js');
31
+ require('./socket-service-te83hltJ.js');
32
32
  require('./purify.es-B7Ashs9w.js');
33
33
  require('./styleSheetRegistry-Cv84KUXj.js');
34
34
  require('./analyticsService-CkAva47S.js');
@@ -4024,27 +4024,32 @@ Object.assign(lookup, {
4024
4024
  * Adapts new backend (v2) response formats to the legacy format
4025
4025
  * expected by existing frontend components.
4026
4026
  */
4027
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
4028
+ var t = {};
4029
+ for (var p in s)
4030
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4031
+ t[p] = s[p];
4032
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
4033
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
4034
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
4035
+ t[p[i]] = s[p[i]];
4036
+ }
4037
+ return t;
4038
+ };
4027
4039
  /**
4028
4040
  * Adapts a v2 `complete` event payload to the legacy `end_response` format.
4029
4041
  *
4030
- * v2 format: { content, conversation_id, tokens }
4042
+ * v2 format: { content, conversation_id, tokens, ...directives }
4031
4043
  * Legacy format: { answer, conversationId, insightId, controlData, controlType, controls, ... }
4044
+ *
4045
+ * Any other field is a directive the server took out of the answer
4046
+ * ([directive=changePanel data="main"] arrives as `changePanel: "main"`), as legacy
4047
+ * `end_response` carried them. They pass through unchanged so `messageReceived`
4048
+ * listeners and the bot's own handlers (e.g. `liveAgent`) receive them.
4032
4049
  */
4033
4050
  function adaptCompleteToLegacy(data) {
4034
- return {
4035
- answer: data.content || "",
4036
- conversationId: data.conversation_id || "",
4037
- insightId: data.insight_id || null,
4038
- controlData: data.control_data || null,
4039
- controlType: data.control_type || null,
4040
- controls: data.controls || [],
4041
- relevanceScore: data.relevance_score || null,
4042
- context: data.context || [],
4043
- didAnswer: !!data.content,
4044
- sender: data.sender || null,
4045
- tokens: data.tokens || null,
4046
- beaconId: data.beacon_id || null,
4047
- };
4051
+ const _a = data !== null && data !== void 0 ? data : {}, { content, conversation_id, insight_id, control_data, control_type, controls, relevance_score, context, sender, tokens, beacon_id } = _a, directives = __rest(_a, ["content", "conversation_id", "insight_id", "control_data", "control_type", "controls", "relevance_score", "context", "sender", "tokens", "beacon_id"]);
4052
+ return Object.assign(Object.assign({}, directives), { answer: content || "", conversationId: conversation_id || "", insightId: insight_id || null, controlData: control_data || null, controlType: control_type || null, controls: controls || [], relevanceScore: relevance_score || null, context: context || [], didAnswer: !!content, sender: sender || null, tokens: tokens || null, beaconId: beacon_id || null });
4048
4053
  }
4049
4054
  /**
4050
4055
  * Adapts a v2 `chunk` event payload to the legacy `response` format.
@@ -3,12 +3,12 @@
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var utils = require('./utils-kaVdO3ki.js');
5
5
  var SearchResult = require('./SearchResult-CvTJr55G.js');
6
- var socketService = require('./socket-service-Bcv9pRTP.js');
6
+ var socketService = require('./socket-service-te83hltJ.js');
7
7
  var ctaHelpers = require('./ctaHelpers-CFn_XVtl.js');
8
8
  var globalStore = require('./global-store-R6x06KvJ.js');
9
9
  var reCaptchaHelpers = require('./reCaptchaHelpers-C8v6BB6z.js');
10
10
  var beacon = require('./beacon-Dzm5dknI.js');
11
- require('./response-adapter-BSZc0N1k.js');
11
+ require('./response-adapter-BiZsYx3F.js');
12
12
 
13
13
  const searchResultsViewCss = () => `:host{display:block;width:100%;font-family:var(--ai12z-font-family);font-size:var(--ai12z-font-size);color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}.search-page-container{background-color:var(--ai12z-search-bar-bgcolor, rgb(244, 242, 238))}.submit-button{background-color:var(--ai12z-search-bar-button-bgcolor, var(--ai12z-primary-color))}.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}.plus-icon{color:var(--ai12z-plus-icon-color)}#searchPanel{flex:1;min-height:0;display:flex;flex-direction:column}.welcome-template-container{flex-shrink:0;padding:16px;background:rgba(255, 255, 255, 0.95);backdrop-filter:blur(8px);margin-left:auto;margin-right:auto}.welcome-template-container{animation:slideUp 0.3s ease-out}@keyframes slideUp{from{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}.error-message-container{margin-top:4px}.error-msg{color:#dc2626;font-size:12px;display:block;animation:slideIn 0.2s ease-out}.enter-tip{font-size:12px;color:#fff;margin-left:10px}#searchForm{margin:0px}.search-layout{display:grid;grid-template-columns:minmax(0, 1fr) 420px;gap:32px;width:100%;padding:0 16px}.search-layout-no-aside{grid-template-columns:minmax(0, 1fr)}.left-column{height:100vh;display:flex;flex-direction:column}.quick-links-column{position:sticky;top:88px;height:-moz-fit-content;height:fit-content;}.chat-fieldset{border:2px solid var(--ai12z-primary-color);border-radius:16px;padding:12px;margin:0;background-color:var(--ai12z-primary-color)}.cta-search-results{border-top-width:1px;border-bottom-width:0px;border-color:rgb(243 244 246)}.cta-search-results-list{position:relative;padding-bottom:20px;padding-top:20px}.cta-search-results-list:hover{background-color:var(--ai12z-hover-bg-color)}.cta-search-container{margin-left:auto;margin-right:auto;display:flex;max-width:896px;justify-content:space-between;-moz-column-gap:24px;column-gap:24px}.cta-search-container-two{display:flex;min-width:0px;-moz-column-gap:16px;column-gap:16px}.cta-search-container-three{min-width:0px;flex:1 1 auto}.cta-search-text{font-weight:600;line-height:24px;font-size:var(--ai12z-search-result-title-font-size);color:var(--ai12z-search-result-title-color)}.cta-search-text-position{position:absolute;left:0px;right:0px;top:-1px;bottom:0px}.cta-search-description{margin-top:4px;display:flex;font-size:var(--ai12z-search-result-description-font-size);line-height:16px;line-height:20px;color:var(--ai12z-search-result-description-color)}.cta-search-list-arrow{display:flex;align-items:center;flex-shrink:0;-moz-column-gap:16px;column-gap:16px}.custom-icon-width{width:64px}.results-icon svg{width:24px;height:24px}@keyframes slideIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.chat-content-wrapper::-webkit-scrollbar{width:8px}.chat-content-wrapper::-webkit-scrollbar-track{background:var(--ai12z-scrollbar-track-color, #f1f1f1);border-radius:10px}.chat-content-wrapper::-webkit-scrollbar-button{display:none}.chat-content-wrapper::-webkit-scrollbar-thumb{background:var(--ai12z-scrollbar-thumb-color, #888);border-radius:10px}.chat-content-wrapper::-webkit-scrollbar-thumb:hover{background:var(--ai12z-scrollbar-thumb-hover-color, #555)}.chat-content-wrapper{scrollbar-width:thin;scrollbar-color:var(--ai12z-scrollbar-thumb-color, #888) var(--ai12z-scrollbar-track-color, #f1f1f1);min-height:0}@media (max-width: 768px){.search-layout{grid-template-columns:1fr;gap:16px}.quick-links-column{display:none}.welcome-template-container{padding:12px}.welcome-template-content{padding:16px;border-radius:12px}.chat-content-wrapper::-webkit-scrollbar{width:4px}.has-conversation .welcome-template-container{display:none}}.sources-panel{width:360px;padding:16px;border-radius:12px;font-family:system-ui, -apple-system, sans-serif}.title{margin:0 0 12px;font-size:16px;font-weight:600;color:#0f172a}.skeleton-list{display:flex;flex-direction:column;gap:10px}.skeleton-line{height:14px;border-radius:999px;background:linear-gradient( 90deg, #e5e7eb 25%, #f1f5f9 37%, #e5e7eb 63% );background-size:400% 100%;}.skeleton-line.short{width:65%}.divider{height:1px;background:#e2e8f0;margin:6px 0}@keyframes shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}.chat-panel{flex:1;min-height:0;display:flex;flex-direction:column}.chat-content-wrapper{min-height:0;overflow-y:auto;flex:1}.chat-fixed-section{flex-shrink:0;display:flex;flex-direction:column;position:sticky;top:0;z-index:1000}.textarea-at-top .chat-fixed-section{top:0;bottom:auto;order:1}.textarea-at-top .chat-content-wrapper{order:2}.textarea-at-top .chat-fieldset{order:1}.textarea-at-top .welcome-template-container{order:2}.textarea-at-bottom .chat-content-wrapper{order:1}.textarea-at-bottom .chat-fixed-section{top:auto;bottom:0;order:2}.textarea-at-bottom .welcome-template-container{order:1}.textarea-at-bottom .chat-fieldset{order:2}`;
14
14
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var responseAdapter = require('./response-adapter-BSZc0N1k.js');
3
+ var responseAdapter = require('./response-adapter-BiZsYx3F.js');
4
4
  var utils = require('./utils-kaVdO3ki.js');
5
5
  var index = require('./index-v8T1EJAJ.js');
6
6
 
@@ -1386,15 +1386,6 @@ export class Ai12zBot {
1386
1386
  this.isConnectingLiveAgent = false;
1387
1387
  }
1388
1388
  }
1389
- if (data.liveAgent && !this.isLiveAgent && !this.isConnectingLiveAgent) {
1390
- this.isConnectingLiveAgent = true;
1391
- try {
1392
- await this.connectLiveChat();
1393
- }
1394
- finally {
1395
- this.isConnectingLiveAgent = false;
1396
- }
1397
- }
1398
1389
  // ✅ Common cleanup
1399
1390
  this.conversationId = data.conversationId;
1400
1391
  // this.saveConversation()
@@ -2,27 +2,32 @@
2
2
  * Adapts new backend (v2) response formats to the legacy format
3
3
  * expected by existing frontend components.
4
4
  */
5
+ var __rest = (this && this.__rest) || function (s, e) {
6
+ var t = {};
7
+ for (var p in s)
8
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9
+ t[p] = s[p];
10
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
11
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
13
+ t[p[i]] = s[p[i]];
14
+ }
15
+ return t;
16
+ };
5
17
  /**
6
18
  * Adapts a v2 `complete` event payload to the legacy `end_response` format.
7
19
  *
8
- * v2 format: { content, conversation_id, tokens }
20
+ * v2 format: { content, conversation_id, tokens, ...directives }
9
21
  * Legacy format: { answer, conversationId, insightId, controlData, controlType, controls, ... }
22
+ *
23
+ * Any other field is a directive the server took out of the answer
24
+ * ([directive=changePanel data="main"] arrives as `changePanel: "main"`), as legacy
25
+ * `end_response` carried them. They pass through unchanged so `messageReceived`
26
+ * listeners and the bot's own handlers (e.g. `liveAgent`) receive them.
10
27
  */
11
28
  export function adaptCompleteToLegacy(data) {
12
- return {
13
- answer: data.content || "",
14
- conversationId: data.conversation_id || "",
15
- insightId: data.insight_id || null,
16
- controlData: data.control_data || null,
17
- controlType: data.control_type || null,
18
- controls: data.controls || [],
19
- relevanceScore: data.relevance_score || null,
20
- context: data.context || [],
21
- didAnswer: !!data.content,
22
- sender: data.sender || null,
23
- tokens: data.tokens || null,
24
- beaconId: data.beacon_id || null,
25
- };
29
+ const _a = data !== null && data !== void 0 ? data : {}, { content, conversation_id, insight_id, control_data, control_type, controls, relevance_score, context, sender, tokens, beacon_id } = _a, directives = __rest(_a, ["content", "conversation_id", "insight_id", "control_data", "control_type", "controls", "relevance_score", "context", "sender", "tokens", "beacon_id"]);
30
+ return Object.assign(Object.assign({}, directives), { answer: content || "", conversationId: conversation_id || "", insightId: insight_id || null, controlData: control_data || null, controlType: control_type || null, controls: controls || [], relevanceScore: relevance_score || null, context: context || [], didAnswer: !!content, sender: sender || null, tokens: tokens || null, beaconId: beacon_id || null });
26
31
  }
27
32
  /**
28
33
  * Adapts a v2 `chunk` event payload to the legacy `response` format.
@@ -1 +1 @@
1
- import{A as o,d as s}from"./p-C5WJ7k2H.js";const p=o,r=s;export{p as Ai12zBot,r as defineCustomElement}
1
+ import{A as o,d as s}from"./p-C46Y7kat.js";const t=o,a=s;export{t as Ai12zBot,a as defineCustomElement}
@@ -1 +1 @@
1
- import{M as o,d as r}from"./p-C8xryOSN.js";const s=o,p=r;export{s as Ai12zChat,p as defineCustomElement}
1
+ import{M as o,d as s}from"./p-DWBK1wub.js";const p=o,r=s;export{p as Ai12zChat,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as o,d as s}from"./p-zb604YaC.js";const a=o,p=s;export{a as Ai12zCta,p as defineCustomElement}
1
+ import{A as s,d as o}from"./p-u3zsAAw1.js";const p=s,r=o;export{p as Ai12zCta,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as o,d as s}from"./p-xPuA7imU.js";const m=o,p=s;export{m as Ai12zInlineSearch,p as defineCustomElement}
1
+ import{A as s,d as o}from"./p-8eJxsLkS.js";const p=s,r=o;export{p as Ai12zInlineSearch,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as o,d as s}from"./p-D-LWGuqg.js";const p=o,r=s;export{p as Ai12zKnowledgeBox,r as defineCustomElement}
1
+ import{A as o,d as s}from"./p-DuK8LlQX.js";const p=o,r=s;export{p as Ai12zKnowledgeBox,r as defineCustomElement}
@@ -1 +1 @@
1
- import{g as e}from"./p-rVmRQ8bG.js";export{a as getAssetPath,r as render,s as setAssetPath,b as setNonce,c as setPlatformOptions}from"./p-rVmRQ8bG.js";export{A as Ai12zBeacon}from"./p-D7e8HNXM.js";export{A as Ai12zBot}from"./p-C5WJ7k2H.js";export{A as Ai12zCta}from"./p-zb604YaC.js";export{A as Ai12zKnowledgeBox}from"./p-D-LWGuqg.js";export{S as Ai12zSearchPanel}from"./p-yp55Zv6C.js";export{S as Ai12zSearchResultsPage}from"./p-BBkshCs2.js";export{A as Ai12zInlineSearch}from"./p-xPuA7imU.js";export{A as Ai12zForm}from"./p-DxzrIzcK.js";export{A as Ai12zContainer}from"./p-DrKpCVS_.js";e();
1
+ import{g as e}from"./p-rVmRQ8bG.js";export{a as getAssetPath,r as render,s as setAssetPath,b as setNonce,c as setPlatformOptions}from"./p-rVmRQ8bG.js";export{A as Ai12zBeacon}from"./p-D7e8HNXM.js";export{A as Ai12zBot}from"./p-C46Y7kat.js";export{A as Ai12zCta}from"./p-u3zsAAw1.js";export{A as Ai12zKnowledgeBox}from"./p-DuK8LlQX.js";export{S as Ai12zSearchPanel}from"./p-yp55Zv6C.js";export{S as Ai12zSearchResultsPage}from"./p-CFCrlzgY.js";export{A as Ai12zInlineSearch}from"./p-8eJxsLkS.js";export{A as Ai12zForm}from"./p-DxzrIzcK.js";export{A as Ai12zContainer}from"./p-DrKpCVS_.js";e();
@@ -1 +1 @@
1
- import{t as s,p as t,H as i,e,E as a,h}from"./p-rVmRQ8bG.js";import{d as o,a as c,n,o as r,q as l}from"./p-CPRWfcS6.js";import{d,S as f}from"./p-CaMH5wYq.js";import{d as m,S as u}from"./p-C8xryOSN.js";import{d as p}from"./p-BGvClrhu.js";import{d as b}from"./p-BaWiE0V_.js";import{d as y}from"./p-BRczakta.js";import{d as g}from"./p-nxQB8VYC.js";const k=t(class extends i{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.stateChanged=e(this,"stateChanged",7),this.startStream=e(this,"startStream",7),this.streamResponse=e(this,"streamResponse",7),this.startInlineResponse=e(this,"startInlineResponse",7),this.endResponse=e(this,"endResponse",7),this.dataKey=a.DATA_KEY||"",this.dataMode=a.DATA_MODE||"prod",this.resultPosition="below",this.autoSearch=!0,this.categorize=!0,this.settings={},this.formData={search:""},this.conversationHistory=[],this.searchResults=[],this.isOpen=!1,this.aiMessageId="",this.ctaSettings={},this.imgFiles=[],this.thumbsId="",this.isChat=!1,this.isSubmitted=!1,this.handleSubmit=async(s,t,i,e,a)=>{var h;if(s.preventDefault(),this.isOpen=!0,this.formData=Object.assign(Object.assign({},this.formData),{search:t}),this.imgFiles=a,e||"follow-up"!==i||(this.conversationHistory=[],this.isChat=!1),!this.formData.search&&(null===(h=this.formData.search)||void 0===h?void 0:h.trim().length)<3&&a&&a.length<1)return this.isSubmitted=!1,void this.stateChanged.emit(!1);try{let s={answer:"",formModel:null,insight_id:null};"ask-ai"===i||this.isChat?(this.isChat=!0,this.conversationHistory.push({message:this.formData.search,images:a,status:"success",type:"user"}),this.aiMessageId=`ai-message-${c()}`,this.thumbsId=c(),this.conversationHistory.push({message:'<div class="animate-ping">...</div>',type:"ai",status:"pending",id:this.aiMessageId}),a&&a.length>0&&(this.imgFiles=a),this.conversationHistory.pop(),s.answer=null==s?void 0:s.answer,this.conversationHistory=[...this.conversationHistory,{message:null==s?void 0:s.answer,type:"ai",status:"success",insightId:null==s?void 0:s.insight_id,id:this.aiMessageId,thumbsId:this.thumbsId,formModel:null==s?void 0:s.formModel}],this.startStream.emit({search:this.formData.search})):this.autoSearch&&(s=await n(this.dataKey,this.dataMode,this.formData.search.trim()),this.displaySearchResults(s))}catch(s){console.error(s)}finally{this.isSubmitted=!1,this.stateChanged.emit(!1)}},this.displaySearchResults=s=>{this.searchResults=s.docs||[],this.isSubmitted=!1}}componentWillLoad(){r(`https://cdn.ai12z.net/assets/bot/${a.CDN_PATH}/tailwind.min.css`,this.el),this.socketService=u.createInstance(this.dataMode,this.dataKey)}surveyHandler(s){if("button"===s.detail.type)this.handleSubmit(null,s.detail.results,s.detail.type,!1,null);else if("carousel"===s.detail.type)this.conversationHistory=[...this.conversationHistory,s.detail.results];else if("update"===s.detail.type){const t=this.conversationHistory.findIndex((t=>t.id===s.detail.results.id));this.conversationHistory=[...this.conversationHistory.slice(0,t),s.detail.results,...this.conversationHistory.slice(t+1)]}}render(){return h("div",{key:"599c7caaac8d8e99f2b0c4a7ac4feee38ee2857b",style:{width:"100%"},class:"container flex flex-col"},"above"===this.resultPosition&&h("div",{key:"99f353e5f66dc6cd7473ab9b81a096e5f30300de",class:"relative custom-results"},!this.isChat&&!this.categorize&&this.isOpen&&h(f,{key:"9a23aad93fc58d2b805948f94579215538185c08",results:this.searchResults}),!this.isChat&&this.categorize&&this.isOpen&&h("ai12z-category",{key:"523f31e0ee8767754ee5a6c5204686796fb68936",categoryList:this.searchResults,linkTarget:"_blank"})),"above"===this.resultPosition&&h("div",{key:"652ff8685b58eb938df406950388a1942a6c9486"},this.isChat&&h("ai12z-chat",{key:"0ae26baf7e6d153a206203161fcfcff22e8c6acf",chats:this.conversationHistory,env:this.dataMode,query:this.formData.search,apiKey:this.dataKey,aiMessageId:this.aiMessageId,imgFiles:this.imgFiles,target:"_blank",voiceType:"default",voice:"Google US English",onFeedback:async s=>{const{feedback:t,insightId:i}=s.detail;l(this.dataKey,this.dataMode,i,t)},componentType:"inline",chatPosition:this.resultPosition,socketIn:this.socketService,settings:this.settings})),h("div",{key:"e5fdcfd679cf2151321de78c0d706f88eaca2cd1",class:"search-bar"},h("ai12z-input-form",{key:"694c2f6641ca19c596d3d5670a1587842a568489",onAction:async s=>{const{value:t,type:i,followUp:e,imgFiles:a}=s.detail;await this.handleSubmit(s,t,i,e,a)},isChat:this.isChat,placeholder:"AI search",buttonText:"Ask AI",iconSrc:"",followUpLabel:"Do you have a follow up question?",isImageUpload:!0,isEnableMic:!0,componentType:"inline"})),"below"===this.resultPosition&&h("div",{key:"6b09f3a526381cbfc12ec3da9887d82dbdeb14c3",class:"relative custom-results"},!this.isChat&&!this.categorize&&this.isOpen&&h(f,{key:"c60a247c63d08299d60232853e46be865b135dd5",results:this.searchResults}),!this.isChat&&this.categorize&&this.isOpen&&h("ai12z-category",{key:"7561f48021c0584a085ae9fd57e60a08764d15bf",categoryList:this.searchResults,linkTarget:"_blank"})),"below"===this.resultPosition&&h("div",{key:"9f5c3c19b1b586dbca859f725b6ef4f3116968d5"},this.isChat&&h("ai12z-chat",{key:"5196a858a213f039625fa42e42aba8a4ad5032ed",chats:this.conversationHistory,env:this.dataMode,query:this.formData.search,apiKey:this.dataKey,aiMessageId:this.aiMessageId,imgFiles:this.imgFiles,target:"_blank",voiceType:"default",voice:"Google US English",onFeedback:async s=>{const{feedback:t,insightId:i}=s.detail;l(this.dataKey,this.dataMode,i,t)},componentType:"inline",chatPosition:this.resultPosition,socketIn:this.socketService,settings:this.settings})))}get el(){return this}static get style(){return":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}"}},[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"]]]);function v(){"undefined"!=typeof customElements&&["ai12z-inline-search","ai12z-category","ai12z-chat","ai12z-input-form","audio-recorder","image-uploader","item-list","keyboard-shortcuts-dialog"].forEach((t=>{switch(t){case"ai12z-inline-search":customElements.get(s(t))||customElements.define(s(t),k);break;case"ai12z-category":customElements.get(s(t))||d();break;case"ai12z-chat":customElements.get(s(t))||m();break;case"ai12z-input-form":customElements.get(s(t))||p();break;case"audio-recorder":customElements.get(s(t))||b();break;case"image-uploader":customElements.get(s(t))||y();break;case"item-list":customElements.get(s(t))||o();break;case"keyboard-shortcuts-dialog":customElements.get(s(t))||g()}}))}v();export{k as A,v as d}
1
+ import{t as s,p as t,H as i,e,E as a,h}from"./p-rVmRQ8bG.js";import{d as o,a as c,n,o as r,q as l}from"./p-CPRWfcS6.js";import{d,S as f}from"./p-CaMH5wYq.js";import{d as m,S as u}from"./p-DWBK1wub.js";import{d as p}from"./p-BGvClrhu.js";import{d as b}from"./p-BaWiE0V_.js";import{d as y}from"./p-BRczakta.js";import{d as g}from"./p-nxQB8VYC.js";const k=t(class extends i{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),this.stateChanged=e(this,"stateChanged",7),this.startStream=e(this,"startStream",7),this.streamResponse=e(this,"streamResponse",7),this.startInlineResponse=e(this,"startInlineResponse",7),this.endResponse=e(this,"endResponse",7),this.dataKey=a.DATA_KEY||"",this.dataMode=a.DATA_MODE||"prod",this.resultPosition="below",this.autoSearch=!0,this.categorize=!0,this.settings={},this.formData={search:""},this.conversationHistory=[],this.searchResults=[],this.isOpen=!1,this.aiMessageId="",this.ctaSettings={},this.imgFiles=[],this.thumbsId="",this.isChat=!1,this.isSubmitted=!1,this.handleSubmit=async(s,t,i,e,a)=>{var h;if(s.preventDefault(),this.isOpen=!0,this.formData=Object.assign(Object.assign({},this.formData),{search:t}),this.imgFiles=a,e||"follow-up"!==i||(this.conversationHistory=[],this.isChat=!1),!this.formData.search&&(null===(h=this.formData.search)||void 0===h?void 0:h.trim().length)<3&&a&&a.length<1)return this.isSubmitted=!1,void this.stateChanged.emit(!1);try{let s={answer:"",formModel:null,insight_id:null};"ask-ai"===i||this.isChat?(this.isChat=!0,this.conversationHistory.push({message:this.formData.search,images:a,status:"success",type:"user"}),this.aiMessageId=`ai-message-${c()}`,this.thumbsId=c(),this.conversationHistory.push({message:'<div class="animate-ping">...</div>',type:"ai",status:"pending",id:this.aiMessageId}),a&&a.length>0&&(this.imgFiles=a),this.conversationHistory.pop(),s.answer=null==s?void 0:s.answer,this.conversationHistory=[...this.conversationHistory,{message:null==s?void 0:s.answer,type:"ai",status:"success",insightId:null==s?void 0:s.insight_id,id:this.aiMessageId,thumbsId:this.thumbsId,formModel:null==s?void 0:s.formModel}],this.startStream.emit({search:this.formData.search})):this.autoSearch&&(s=await n(this.dataKey,this.dataMode,this.formData.search.trim()),this.displaySearchResults(s))}catch(s){console.error(s)}finally{this.isSubmitted=!1,this.stateChanged.emit(!1)}},this.displaySearchResults=s=>{this.searchResults=s.docs||[],this.isSubmitted=!1}}componentWillLoad(){r(`https://cdn.ai12z.net/assets/bot/${a.CDN_PATH}/tailwind.min.css`,this.el),this.socketService=u.createInstance(this.dataMode,this.dataKey)}surveyHandler(s){if("button"===s.detail.type)this.handleSubmit(null,s.detail.results,s.detail.type,!1,null);else if("carousel"===s.detail.type)this.conversationHistory=[...this.conversationHistory,s.detail.results];else if("update"===s.detail.type){const t=this.conversationHistory.findIndex((t=>t.id===s.detail.results.id));this.conversationHistory=[...this.conversationHistory.slice(0,t),s.detail.results,...this.conversationHistory.slice(t+1)]}}render(){return h("div",{key:"599c7caaac8d8e99f2b0c4a7ac4feee38ee2857b",style:{width:"100%"},class:"container flex flex-col"},"above"===this.resultPosition&&h("div",{key:"99f353e5f66dc6cd7473ab9b81a096e5f30300de",class:"relative custom-results"},!this.isChat&&!this.categorize&&this.isOpen&&h(f,{key:"9a23aad93fc58d2b805948f94579215538185c08",results:this.searchResults}),!this.isChat&&this.categorize&&this.isOpen&&h("ai12z-category",{key:"523f31e0ee8767754ee5a6c5204686796fb68936",categoryList:this.searchResults,linkTarget:"_blank"})),"above"===this.resultPosition&&h("div",{key:"652ff8685b58eb938df406950388a1942a6c9486"},this.isChat&&h("ai12z-chat",{key:"0ae26baf7e6d153a206203161fcfcff22e8c6acf",chats:this.conversationHistory,env:this.dataMode,query:this.formData.search,apiKey:this.dataKey,aiMessageId:this.aiMessageId,imgFiles:this.imgFiles,target:"_blank",voiceType:"default",voice:"Google US English",onFeedback:async s=>{const{feedback:t,insightId:i}=s.detail;l(this.dataKey,this.dataMode,i,t)},componentType:"inline",chatPosition:this.resultPosition,socketIn:this.socketService,settings:this.settings})),h("div",{key:"e5fdcfd679cf2151321de78c0d706f88eaca2cd1",class:"search-bar"},h("ai12z-input-form",{key:"694c2f6641ca19c596d3d5670a1587842a568489",onAction:async s=>{const{value:t,type:i,followUp:e,imgFiles:a}=s.detail;await this.handleSubmit(s,t,i,e,a)},isChat:this.isChat,placeholder:"AI search",buttonText:"Ask AI",iconSrc:"",followUpLabel:"Do you have a follow up question?",isImageUpload:!0,isEnableMic:!0,componentType:"inline"})),"below"===this.resultPosition&&h("div",{key:"6b09f3a526381cbfc12ec3da9887d82dbdeb14c3",class:"relative custom-results"},!this.isChat&&!this.categorize&&this.isOpen&&h(f,{key:"c60a247c63d08299d60232853e46be865b135dd5",results:this.searchResults}),!this.isChat&&this.categorize&&this.isOpen&&h("ai12z-category",{key:"7561f48021c0584a085ae9fd57e60a08764d15bf",categoryList:this.searchResults,linkTarget:"_blank"})),"below"===this.resultPosition&&h("div",{key:"9f5c3c19b1b586dbca859f725b6ef4f3116968d5"},this.isChat&&h("ai12z-chat",{key:"5196a858a213f039625fa42e42aba8a4ad5032ed",chats:this.conversationHistory,env:this.dataMode,query:this.formData.search,apiKey:this.dataKey,aiMessageId:this.aiMessageId,imgFiles:this.imgFiles,target:"_blank",voiceType:"default",voice:"Google US English",onFeedback:async s=>{const{feedback:t,insightId:i}=s.detail;l(this.dataKey,this.dataMode,i,t)},componentType:"inline",chatPosition:this.resultPosition,socketIn:this.socketService,settings:this.settings})))}get el(){return this}static get style(){return":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}"}},[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"]]]);function v(){"undefined"!=typeof customElements&&["ai12z-inline-search","ai12z-category","ai12z-chat","ai12z-input-form","audio-recorder","image-uploader","item-list","keyboard-shortcuts-dialog"].forEach((t=>{switch(t){case"ai12z-inline-search":customElements.get(s(t))||customElements.define(s(t),k);break;case"ai12z-category":customElements.get(s(t))||d();break;case"ai12z-chat":customElements.get(s(t))||m();break;case"ai12z-input-form":customElements.get(s(t))||p();break;case"audio-recorder":customElements.get(s(t))||b();break;case"image-uploader":customElements.get(s(t))||y();break;case"item-list":customElements.get(s(t))||o();break;case"keyboard-shortcuts-dialog":customElements.get(s(t))||g()}}))}v();export{k as A,v as d}