@gengage/assistant-fe 0.2.8 → 0.2.10

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 (80) hide show
  1. package/dist/assistant-fe.css +2 -1
  2. package/dist/chat-C1_48HTk.js +4867 -0
  3. package/dist/chat-C1_48HTk.js.map +1 -0
  4. package/dist/chat-DJpVCmRT.cjs +13 -0
  5. package/dist/chat-DJpVCmRT.cjs.map +1 -0
  6. package/dist/chat.cjs +1 -2
  7. package/dist/chat.iife.js +31 -31
  8. package/dist/chat.iife.js.map +1 -1
  9. package/dist/chat.js +2 -15
  10. package/dist/common--5smIEwc.js +390 -0
  11. package/dist/common--5smIEwc.js.map +1 -0
  12. package/dist/common-DTY__1sq.cjs +2 -0
  13. package/dist/common-DTY__1sq.cjs.map +1 -0
  14. package/dist/common.cjs +1 -2
  15. package/dist/common.js +5 -448
  16. package/dist/index.cjs +1 -2
  17. package/dist/index.js +7 -70
  18. package/dist/native-webview-D1v6n8kJ.cjs +2 -0
  19. package/dist/native-webview-D1v6n8kJ.cjs.map +1 -0
  20. package/dist/native-webview-DlY9mxqG.js +521 -0
  21. package/dist/native-webview-DlY9mxqG.js.map +1 -0
  22. package/dist/native.cjs +1 -2
  23. package/dist/native.iife.js +31 -31
  24. package/dist/native.iife.js.map +1 -1
  25. package/dist/native.js +2 -9
  26. package/dist/qna-C-ZboudC.cjs +2 -0
  27. package/dist/qna-C-ZboudC.cjs.map +1 -0
  28. package/dist/qna-CDfFy61x.js +442 -0
  29. package/dist/qna-CDfFy61x.js.map +1 -0
  30. package/dist/qna.cjs +1 -2
  31. package/dist/qna.css +1 -1
  32. package/dist/qna.iife.js +29 -29
  33. package/dist/qna.iife.js.map +1 -1
  34. package/dist/qna.js +2 -463
  35. package/dist/quantity-stepper-BuwCXbPt.cjs +2 -0
  36. package/dist/quantity-stepper-BuwCXbPt.cjs.map +1 -0
  37. package/dist/quantity-stepper-CTEOqVS6.js +74 -0
  38. package/dist/quantity-stepper-CTEOqVS6.js.map +1 -0
  39. package/dist/schemas-BNc2hTff.cjs +86 -0
  40. package/dist/schemas-BNc2hTff.cjs.map +1 -0
  41. package/dist/schemas-ClU0oPbf.js +4625 -0
  42. package/dist/schemas-ClU0oPbf.js.map +1 -0
  43. package/dist/simrel-B2UMdZ9p.cjs +2 -0
  44. package/dist/simrel-B2UMdZ9p.cjs.map +1 -0
  45. package/dist/simrel-BjL12luk.js +657 -0
  46. package/dist/simrel-BjL12luk.js.map +1 -0
  47. package/dist/simrel.cjs +1 -2
  48. package/dist/simrel.css +1 -1
  49. package/dist/simrel.iife.js +29 -29
  50. package/dist/simrel.iife.js.map +1 -1
  51. package/dist/simrel.js +2 -689
  52. package/package.json +13 -13
  53. package/dist/chat.cjs.map +0 -1
  54. package/dist/chat.js.map +0 -1
  55. package/dist/common.cjs.map +0 -1
  56. package/dist/common.js.map +0 -1
  57. package/dist/index-BAQXPosE.cjs +0 -2
  58. package/dist/index-BAQXPosE.cjs.map +0 -1
  59. package/dist/index-CUBMZpGs.js +0 -5111
  60. package/dist/index-CUBMZpGs.js.map +0 -1
  61. package/dist/index-Dco2Aw73.cjs +0 -13
  62. package/dist/index-Dco2Aw73.cjs.map +0 -1
  63. package/dist/index-DvSU2I9u.js +0 -506
  64. package/dist/index-DvSU2I9u.js.map +0 -1
  65. package/dist/index.cjs.map +0 -1
  66. package/dist/index.js.map +0 -1
  67. package/dist/native.cjs.map +0 -1
  68. package/dist/native.js.map +0 -1
  69. package/dist/qna.cjs.map +0 -1
  70. package/dist/qna.js.map +0 -1
  71. package/dist/quantity-stepper-CQWgexMO.cjs +0 -2
  72. package/dist/quantity-stepper-CQWgexMO.cjs.map +0 -1
  73. package/dist/quantity-stepper-CjY_cpgJ.js +0 -80
  74. package/dist/quantity-stepper-CjY_cpgJ.js.map +0 -1
  75. package/dist/schemas-5lXjLjwW.js +0 -4944
  76. package/dist/schemas-5lXjLjwW.js.map +0 -1
  77. package/dist/schemas-DqUVzVDf.cjs +0 -86
  78. package/dist/schemas-DqUVzVDf.cjs.map +0 -1
  79. package/dist/simrel.cjs.map +0 -1
  80. package/dist/simrel.js.map +0 -1
package/dist/qna.iife.js CHANGED
@@ -1,15 +1,15 @@
1
- (function(x){"use strict";const Ft=({element:e,renderElement:t})=>{if(!e.children||e.children.length===0)return null;const n=document.createElement("div");for(const o of e.children){const r=t(o);r&&n.appendChild(r)}return n};function Mt(e){const t=document.createElement("div");if(t.className=e.containerClassName,!e.spec.elements[e.spec.root])return t;const o=e.unknownRenderer??Ft,r=i=>{const a=e.spec.elements[i];if(!a)return null;const c=e.registry[a.type];return c?c({elementId:i,element:a,spec:e.spec,context:e.context,renderElement:r}):o({elementId:i,element:a,spec:e.spec,context:e.context,renderElement:r})},s=r(e.spec.root);return s&&t.appendChild(s),t}function Bt(e,t){if(!t)return e;const n={...e};for(const[o,r]of Object.entries(t))r&&(n[o]=r);return n}function Jt(e,t){const n={event_name:"stream.start",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{endpoint:t.endpoint,request_id:t.request_id}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),t.widget!==void 0&&(n.widget=t.widget),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function Qt(e,t){const n={event_name:"stream.done",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{request_id:t.request_id,latency_ms:t.latency_ms,chunk_count:t.chunk_count}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),t.widget!==void 0&&(n.widget=t.widget),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function Ht(e,t){const n={event_name:"stream.error",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{request_id:t.request_id,error_code:t.error_code,error_message:t.error_message}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),t.widget!==void 0&&(n.widget=t.widget),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function Wt(e,t){const n={event_name:"metering.summary",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{meter_key:t.meter_key,quantity:t.quantity,unit:t.unit}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function Vt(e,t){const n={event_name:"widget.history.snapshot",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,widget:t.widget,payload:{message_count:t.message_count,history_ref:t.history_ref,redaction_level:t.redaction_level}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function Gt(e,t){const n={event_name:"checkout.start",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,widget:t.attribution_source,payload:{attribution_source:t.attribution_source,attribution_action_id:t.attribution_action_id,cart_value:t.cart_value,currency:t.currency,line_items:t.line_items}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function Kt(e,t){const n={event_name:"checkout.complete",account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,widget:t.attribution_source,payload:{attribution_source:t.attribution_source,attribution_action_id:t.attribution_action_id,cart_value:t.cart_value,currency:t.currency,line_items:t.line_items}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function fe(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!1}))}function Ce(e,t){const n=o=>{t(o.detail)};return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function Yt(){const t=window.__gengageSessionId??sessionStorage.getItem("gengage_session_id")??null??crypto.randomUUID();return window.__gengageSessionId=t,sessionStorage.setItem("gengage_session_id",t),window.gengage||(window.gengage={}),window.gengage.sessionId=t,t}function Xt(e){return{sessionId:e?.sessionId??Yt(),...e}}const Pe={"--gengage-chat-offset":"20px","--gengage-chat-launcher-size":"56px","--gengage-chat-width":"400px","--gengage-chat-shell-radius":"1rem","--gengage-chat-header-height":"60px","--gengage-chat-conversation-width":"396px","--gengage-chat-panel-min-width":"320px","--gengage-chat-panel-max-width":"860px","--gengage-chat-input-height":"48px","--gengage-qna-pill-radius":"999px","--gengage-qna-input-radius":"0.75rem","--gengage-simrel-card-radius":"0.75rem"};function en(e){return e?{...Pe,...e}:{...Pe}}const j="gengage-global-toast-root",Re="gengage-global-toast-style",he="gengage-global-toast-root--visible",tn=4200,nn=1500,on=15e3;let Ne=!1,U=null;function rn(e){return typeof e=="string"&&e.toLowerCase().startsWith("tr")?"Bağlantı sorunu oluştu. Lütfen tekrar deneyin.":"Connection issue. Please try again."}function sn(){Ne||typeof window>"u"||typeof document>"u"||(Ne=!0,Ce("gengage:global:error",e=>{an(e)}))}function an(e){if(typeof document>"u")return;const t=e.message.trim();if(!t)return;pn();const n=dn();n.innerHTML="";const o=document.createElement("section");o.className="gengage-global-toast gengage-global-toast--error",o.setAttribute("role","status"),o.setAttribute("aria-live","polite");const r=document.createElement("div");r.className="gengage-global-toast-title",r.textContent=un(e.source);const s=document.createElement("div");s.className="gengage-global-toast-message",s.textContent=t,o.appendChild(r),o.appendChild(s),n.appendChild(o),n.classList.add(he),U&&(clearTimeout(U),U=null),U=setTimeout(()=>{cn()},ln(e.durationMs))}function cn(){if(typeof document>"u")return;const e=document.getElementById(j);e&&(e.classList.remove(he),e.innerHTML="",U&&(clearTimeout(U),U=null))}function un(e){switch(e){case"chat":return"Chat warning";case"qna":return"QnA warning";case"simrel":return"Widget warning";default:return"Connection warning"}}function dn(){const e=document.getElementById(j);if(e instanceof HTMLElement)return e;const t=document.createElement("div");return t.id=j,t.className="gengage-global-toast-root",document.body.appendChild(t),t}function ln(e){return typeof e!="number"||!Number.isFinite(e)?tn:Math.min(on,Math.max(nn,Math.round(e)))}function pn(){if(document.getElementById(Re))return;const e=document.createElement("style");e.id=Re,e.textContent=`
2
- #${j} {
1
+ (function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=({element:e,renderElement:t})=>{if(!e.children||e.children.length===0)return null;let n=document.createElement(`div`);for(let r of e.children){let e=t(r);e&&n.appendChild(e)}return n};function n(e){let n=document.createElement(`div`);if(n.className=e.containerClassName,!e.spec.elements[e.spec.root])return n;let r=e.unknownRenderer??t,i=t=>{let n=e.spec.elements[t];if(!n)return null;let a=e.registry[n.type];return a?a({elementId:t,element:n,spec:e.spec,context:e.context,renderElement:i}):r({elementId:t,element:n,spec:e.spec,context:e.context,renderElement:i})},a=i(e.spec.root);return a&&n.appendChild(a),n}function r(e,t){if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t))r&&(n[e]=r);return n}function i(e,t){let n={event_name:`stream.start`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{endpoint:t.endpoint,request_id:t.request_id}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),t.widget!==void 0&&(n.widget=t.widget),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function a(e,t){let n={event_name:`stream.done`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{request_id:t.request_id,latency_ms:t.latency_ms,chunk_count:t.chunk_count}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),t.widget!==void 0&&(n.widget=t.widget),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function o(e,t){let n={event_name:`stream.error`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{request_id:t.request_id,error_code:t.error_code,error_message:t.error_message}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),t.widget!==void 0&&(n.widget=t.widget),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function s(e,t){let n={event_name:`metering.summary`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,payload:{meter_key:t.meter_key,quantity:t.quantity,unit:t.unit}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function c(e,t){let n={event_name:`widget.history.snapshot`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,widget:t.widget,payload:{message_count:t.message_count,history_ref:t.history_ref,redaction_level:t.redaction_level}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function l(e,t){let n={event_name:`checkout.start`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,widget:t.attribution_source,payload:{attribution_source:t.attribution_source,attribution_action_id:t.attribution_action_id,cart_value:t.cart_value,currency:t.currency,line_items:t.line_items}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function u(e,t){let n={event_name:`checkout.complete`,account_id:e.account_id,session_id:e.session_id,correlation_id:e.correlation_id,widget:t.attribution_source,payload:{attribution_source:t.attribution_source,attribution_action_id:t.attribution_action_id,cart_value:t.cart_value,currency:t.currency,line_items:t.line_items}};return e.view_id!==void 0&&(n.view_id=e.view_id),e.user_id!==void 0&&(n.user_id=e.user_id),e.page_type!==void 0&&(n.page_type=e.page_type),e.sku!==void 0&&(n.sku=e.sku),n}function d(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!1}))}function f(e,t){let n=e=>{t(e.detail)};return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function p(){let e=window.__gengageSessionId??sessionStorage.getItem(`gengage_session_id`)??null??crypto.randomUUID();return window.__gengageSessionId=e,sessionStorage.setItem(`gengage_session_id`,e),window.gengage||(window.gengage={}),window.gengage.sessionId=e,e}function m(e){return{sessionId:e?.sessionId??p(),...e}}var h={"--gengage-chat-offset":`20px`,"--gengage-chat-launcher-size":`56px`,"--gengage-chat-width":`400px`,"--gengage-chat-shell-radius":`1rem`,"--gengage-chat-header-height":`60px`,"--gengage-chat-conversation-width":`396px`,"--gengage-chat-panel-min-width":`320px`,"--gengage-chat-panel-max-width":`860px`,"--gengage-chat-input-height":`48px`,"--gengage-qna-pill-radius":`999px`,"--gengage-qna-input-radius":`0.75rem`,"--gengage-simrel-card-radius":`0.75rem`};function ee(e){return e?{...h,...e}:{...h}}var g=`gengage-global-toast-root`,te=`gengage-global-toast-style`,ne=`gengage-global-toast-root--visible`,re=4200,ie=1500,ae=15e3,oe=!1,_=null;function se(e){return typeof e==`string`&&e.toLowerCase().startsWith(`tr`)?`Bağlantı sorunu oluştu. Lütfen tekrar deneyin.`:`Connection issue. Please try again.`}function ce(){oe||typeof window>`u`||typeof document>`u`||(oe=!0,f(`gengage:global:error`,e=>{le(e)}))}function le(e){if(typeof document>`u`)return;let t=e.message.trim();if(!t)return;me();let n=fe();n.innerHTML=``;let r=document.createElement(`section`);r.className=`gengage-global-toast gengage-global-toast--error`,r.setAttribute(`role`,`status`),r.setAttribute(`aria-live`,`polite`);let i=document.createElement(`div`);i.className=`gengage-global-toast-title`,i.textContent=de(e.source);let a=document.createElement(`div`);a.className=`gengage-global-toast-message`,a.textContent=t,r.appendChild(i),r.appendChild(a),n.appendChild(r),n.classList.add(ne),_&&=(clearTimeout(_),null),_=setTimeout(()=>{ue()},pe(e.durationMs))}function ue(){if(typeof document>`u`)return;let e=document.getElementById(g);e&&(e.classList.remove(ne),e.innerHTML=``,_&&=(clearTimeout(_),null))}function de(e){switch(e){case`chat`:return`Chat warning`;case`qna`:return`QnA warning`;case`simrel`:return`Widget warning`;default:return`Connection warning`}}function fe(){let e=document.getElementById(g);if(e instanceof HTMLElement)return e;let t=document.createElement(`div`);return t.id=g,t.className=`gengage-global-toast-root`,document.body.appendChild(t),t}function pe(e){return typeof e!=`number`||!Number.isFinite(e)?re:Math.min(ae,Math.max(ie,Math.round(e)))}function me(){if(document.getElementById(te))return;let e=document.createElement(`style`);e.id=te,e.textContent=`
2
+ #${g} {
3
3
  position: fixed;
4
4
  top: 16px;
5
5
  right: 16px;
6
6
  z-index: 2147483646;
7
7
  pointer-events: none;
8
8
  }
9
- #${j}.${he} {
9
+ #${g}.${ne} {
10
10
  pointer-events: auto;
11
11
  }
12
- #${j} .gengage-global-toast {
12
+ #${g} .gengage-global-toast {
13
13
  min-width: 260px;
14
14
  max-width: min(92vw, 420px);
15
15
  border-radius: 12px;
@@ -24,12 +24,12 @@
24
24
  line-height: 1.4;
25
25
  animation: gengage-global-toast-in 180ms ease-out forwards;
26
26
  }
27
- #${j} .gengage-global-toast-title {
27
+ #${g} .gengage-global-toast-title {
28
28
  margin: 0 0 4px;
29
29
  font-size: 12px;
30
30
  font-weight: 700;
31
31
  }
32
- #${j} .gengage-global-toast-message {
32
+ #${g} .gengage-global-toast-message {
33
33
  margin: 0;
34
34
  font-weight: 500;
35
35
  }
@@ -43,44 +43,44 @@
43
43
  transform: translateY(0);
44
44
  }
45
45
  }
46
- `,document.head.appendChild(e)}let V=null;function fn(){if(V!==null)return V;try{V=localStorage.getItem("gengage:debug")==="1"}catch{V=!1}return V}function ge(e,t,n){if(!fn())return;const o=[`[gengage:${e}]`,t];n!==void 0&&o.push(n),console.debug(...o)}class hn{constructor(){this.isVisible=!1,this.isInitialised=!1,this._handlers=new Map,this._cleanups=[],this._ownsRoot=!1,this._destroying=!1}async init(t){if(this.isInitialised){console.warn("[gengage] Widget already initialised. Call update() instead.");return}const n=en(t.theme);this.config={...t,theme:n,session:Xt(t.session)},this.root=this._resolveMount(t.mountTarget),this._applyTheme(n),sn();const o=Ce("gengage:context:update",r=>this.update(r));this._cleanups.push(o),ge("lifecycle",`${this.constructor.name}.init`,{accountId:t.accountId,sku:t.pageContext?.sku});try{await this.onInit(this.config)}catch(r){throw this.destroy(),r}this._destroying||(this.isInitialised=!0,ge("lifecycle",`${this.constructor.name} ready`),this.emit("ready"))}update(t){this.isInitialised&&(this.config.pageContext?this.config={...this.config,pageContext:{...this.config.pageContext,...t}}:t.pageType!==void 0&&(this.config={...this.config,pageContext:t}),this.onUpdate(t),this.emit("context-update",this.config.pageContext))}show(){this.isVisible||(this.isVisible=!0,this.root.style.display="",this.onShow(),this.emit("show"))}hide(){this.isVisible&&(this.isVisible=!1,this.root.style.display="none",this.onHide(),this.emit("hide"))}destroy(){this._destroying||(this._destroying=!0,this.emit("destroy"),this._cleanups.forEach(t=>t()),this._cleanups.length=0,this._handlers.clear(),this.onDestroy(),this.config.analyticsClient?.destroy(),this._ownsRoot?this.root.remove():this.root.innerHTML="",this.isInitialised=!1)}on(t,n){return this._handlers.has(t)||this._handlers.set(t,new Set),this._handlers.get(t).add(n),()=>this._handlers.get(t)?.delete(n)}trackCheckout(t,n){const o=t==="start"?Gt:Kt;this.track(o(this.analyticsContext(),n))}flushMeteringSummary(t){this.track(Wt(this.analyticsContext(),t))}emit(t,...n){this._handlers.get(t)?.forEach(o=>o(...n))}addCleanup(t){this._cleanups.push(t)}track(t){this.config.analyticsClient?.track(t)}analyticsContext(){const t={account_id:this.config.accountId,session_id:this.config.session?.sessionId??"",correlation_id:this.config.session?.sessionId??""};return this.config.session?.viewId!==void 0&&(t.view_id=this.config.session.viewId),this.config.session?.userId!==void 0&&(t.user_id=this.config.session.userId),this.config.pageContext?.pageType!==void 0&&(t.page_type=this.config.pageContext.pageType),this.config.pageContext?.sku!==void 0&&(t.sku=this.config.pageContext.sku),this.config.session?.abTestVariant!==void 0&&(t.ab_test_variant=this.config.session.abTestVariant),this.config.session?.abTestExperimentId!==void 0&&(t.ab_test_experiment_id=this.config.session.abTestExperimentId),t}_resolveMount(t){if(t instanceof HTMLElement)return t;if(typeof t=="string"){const o=document.querySelector(t);if(!o)throw new Error(`[gengage] Mount target not found: "${t}"`);return o}const n=document.createElement("div");return n.dataset.gengageWidget=this.constructor.name.toLowerCase(),document.body.appendChild(n),this._ownsRoot=!0,n}_applyTheme(t){if(t){for(const[n,o]of Object.entries(t))if(o!==void 0){const r=n.startsWith("--")?n:`--gengage-${gn(n)}`;this.root.style.setProperty(r,o)}}}}function gn(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function je(e){return typeof e=="object"&&e!==null&&typeof e.type=="string"}function mn(e){const t=[];let n=0,o=!1,r=!1,s=0;for(let i=0;i<e.length;i++){const a=e[i];if(r){r=!1;continue}if(a==="\\"&&o){r=!0;continue}if(a==='"'){o=!o;continue}o||(a==="{"&&n++,a==="}"&&(n--,n===0&&(t.push(e.slice(s,i+1)),s=i+1)))}return t.length>0?t:[e]}function De(e,t){const n=e.trim();if(!n||n.startsWith(":"))return!1;const o=n.startsWith("data: ")?n.slice(6):n;if(o==="[DONE]")return t.onDone?.(),!0;try{const r=JSON.parse(o);return je(r)?(ge("stream",`event: ${r.type}`,r),t.onEvent(r),r.type==="done"?(t.onDone?.(),!0):!1):!1}catch{const r=mn(o);if(r.length>1){for(const s of r)try{const i=JSON.parse(s);if(!je(i))continue;if(t.onEvent(i),i.type==="done")return t.onDone?.(),!0}catch{}return!1}return!1}}async function _n(e,t){if(!e.ok){t.onError?.(new Error(`HTTP ${e.status}: ${e.statusText}`));return}if(!e.body){t.onError?.(new Error("Response body is null — streaming not supported"));return}const n=e.body.getReader(),o=new TextDecoder("utf-8");let r="";const s=t.idleTimeoutMs??6e4,i=Symbol("idle-timeout");let a=!1;try{for(;;){const c=n.read();let u;const p=await(s>0?Promise.race([c.then(_=>(clearTimeout(u),_)),new Promise(_=>{u=setTimeout(()=>_(i),s)})]):c);if(p===i){a=!0,await n.cancel();break}const{done:h,value:l}=p;if(h)break;r+=o.decode(l,{stream:!0});const f=r.split(`
47
- `);r=f.pop()??"";for(const _ of f)if(De(_,t))return}if(r.trim()&&De(r,t))return}catch(c){if(c instanceof DOMException&&c.name==="AbortError")return;t.onError?.(c instanceof Error?c:new Error(String(c)))}finally{a||n.releaseLock()}t.onDone?.()}const yn={process_action:"/process_action",launcher_action:"/launcher_action",similar_products:"/similar_products",product_groupings:"/product_groupings"};function vn(e){if(e===void 0)throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");const t=e.trim();return t===""?"":t.replace(/\/+$/,"")}function wn(e,t){return`${vn(t?.middlewareUrl)}/chat${yn[e]}`}const Le=3,bn=(e,t)=>{const n=e.replace(/\s+/g," ").trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g,"");if(!n)return"";const o=t?.stripLeadingStopWords?n.replace(/^(?:daha|için)\s+/i,"").trim():n;return o?o.split(/\s+/).slice(0,3).join(" ").trim():""},me=(e,t)=>e?e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map(n=>bn(n,t)).filter(Boolean):[];function kn(e){const t=(e.display_keywords??[]).flatMap(r=>me(r,{stripLeadingStopWords:!0})),n=t.filter((r,s)=>t.indexOf(r)===s);if(n.length>0)return n.slice(0,Le);const o=[...me(e.chosen_attribute,{stripLeadingStopWords:!0}),...me(e.short_name)];return o.filter((r,s)=>o.indexOf(r)===s).slice(0,Le)}function zn(e){return kn(e).join(" • ")}function Sn(e){if(typeof e.type!="string")return null;if($n(e))return e;const n=e;switch(n.type){case"outputText":return Tn(n);case"suggestedActions":return En(n);case"productList":return An(n);case"productDetails":return In(n);case"productDetailsSimilars":return On(n);case"comparisonTable":return Zn(n);case"context":return Nn(n);case"chatStreamEnd":return jn();case"loading":return Dn(n);case"panelLoading":return Ln(n);case"similarLoading":return xn(n);case"redirect":return Un(n);case"error":return qn(n);case"dummy":return Fn();case"launcherAction":return Mn(n);case"text":return _e(n);case"productItem":return Bn(n);case"text_image":return xe(n);case"quick_qna":return Ue(n);case"reviewHighlights":return Jn(n);case"aiProductSuggestions":return Wn(n);case"aiProductGroupings":return Vn(n);case"aiSuggestedSearches":return Gn(n);case"prosAndCons":return Qn(n);case"getGroundingReview":return Kn(n);case"voice":return Xn(n);case"visitorDataResponse":return Hn(n);case"productListPreview":return Yn();case"groupList":return eo(n);case"formGetInfo":case"formTestDrive":case"formServiceRequest":case"launchFormPage":return to(n);case"launcherContent":return oo(n);case"handoff":return no(n);default:return null}}function $n(e){const t=e.type;if(typeof t!="string")return!1;switch(t){case"metadata":return typeof e.sessionId=="string"&&typeof e.model=="string";case"text_chunk":return typeof e.content=="string";case"ui_spec":{const n=e.widget;if(n!=="chat"&&n!=="qna"&&n!=="simrel")return!1;const o=N(e.spec);return o?typeof o.root=="string"&&N(o.elements)!==null:!1}case"action":{const n=N(e.action);return n!==null&&typeof n.kind=="string"}case"error":return typeof e.code=="string"&&typeof e.message=="string";case"done":return!0;default:return!1}}function Tn(e){const t=b(e.payload.text,e.payload.plain_text)??"",n=b(e.payload.plain_text,e.payload.text)??t;if(e.payload.is_error)return{type:"error",code:"BACKEND_ERROR",message:n||"Backend returned an error"};const o={type:"text_chunk",content:t,final:!0},r=e.payload.product_mentions;Array.isArray(r)&&r.length>0&&(o.productMentions=r.filter(a=>typeof a=="object"&&a!==null&&typeof a.sku=="string"&&typeof a.short_name=="string"));const s=e.payload.sku_to_product_item;s&&typeof s=="object"&&!Array.isArray(s)&&(o.skuToProductItem=s);const i=e.payload.conversation_mode;return typeof i=="string"&&i&&(o.conversationMode=i),o}function En(e){const t=(e.payload.actions??[]).map(n=>{const o=b(n.title)??"",r=C(n.requestDetails,o),s=r?{label:o,action:r}:null;return s?(typeof n.icon=="string"&&(s.icon=n.icon),typeof n.image=="string"&&(s.image=n.image),s):null});return qe(t.filter(Me),"chat")}function An(e){const t=Fe(e.payload.product_list??[],"chat");t.panelHint="panel";const n=t.spec.elements[t.spec.root];return n&&(typeof e.payload.offset=="number"&&(n.props={...n.props,offset:e.payload.offset}),typeof e.payload.end_of_list=="boolean"&&(n.props={...n.props,endOfList:e.payload.end_of_list}),typeof e.payload.title=="string"&&(n.props={...n.props,panelTitle:e.payload.title})),t}function In(e){const t=e.payload.productDetails;return t?{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ProductDetailsPanel",props:{product:J(t)}}}},panelHint:"panel"}:io("chat")}function On(e){const t=Fe(e.payload.similarProducts??[],"chat"),n=t.spec.elements[t.spec.root];return n&&(n.props={...n.props,similarsAppend:!0}),{...t,panelHint:"panel"}}function Zn(e){const t=e.payload.multiple_product_details??[],n=e.payload,o={key_differences:n.key_differences,recommended_choice:n.recommended_choice,recommended_choice_sku:n.recommended_choice_sku,special_considerations:n.special_considerations,criteria_view:n.criteria_view,criteria_view_short:n.criteria_view_short,compared_field_names:n.compared_field_names,winner_product:n.winner_product,winner_hits:n.winner_hits,...e.payload.product_comparison_framework??{}},r=e.payload.table,s=e.payload.features_list,i=[];for(const v of t){const w=J(v);i.push(w)}const a=Cn(r,i,o,s);let c;o?.recommended_choice_sku?c=o.recommended_choice_sku:o?.winner_product&&o.winner_product.length>0&&(c=o.winner_product[0]?.product_detail?.sku??o.winner_product[0]?.sku);const u=c?i.find(v=>v.sku===c)??i[0]:i[0],p=[];if(Array.isArray(o?.key_differences))for(const v of o.key_differences)typeof v=="string"&&p.push(v);const h=uo(o?.special_considerations),l=o?.recommended_choice,f=o?.winner_hits,_={};for(const v of i){const w=v.sku;w&&(_[w]={title:v.name??w,type:"launchSingleProduct",payload:{sku:w}})}const m={products:i,attributes:a,highlights:p,productActions:_};return u&&(m.recommended=u),h.length>0&&(m.specialCases=h),l&&(m.recommendedText=l),f&&(m.winnerHits=f),typeof o?.key_differences=="string"&&(m.keyDifferencesHtml=o.key_differences),o?.special_considerations&&(m.specialConsiderations=o.special_considerations),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ComparisonTable",props:m}}},panelHint:"panel"}}function Cn(e,t,n,o){if(!e)return[];const r=Object.entries(e);if(r.length===0)return[];const s=r[0]?.[1];if(Array.isArray(s)){const l=n.criteria_view??n.criteria_view_short??{},f=n.compared_field_names??Object.keys(e),_=[];for(const m of f){const v=e[m];if(!v||!Array.isArray(v))continue;const w=l[m]??m;_.push({label:w,values:v.map(E=>typeof E=="string"?E:String(E??""))})}return _}const i=e,a=t.map(l=>String(l.sku??"")).filter(l=>l.length>0),c=n.criteria_view??n.criteria_view_short??{},p=(o&&o.length>0?o:n.compared_field_names&&n.compared_field_names.length>0?n.compared_field_names:Pn(i)).filter(l=>l!=="name"&&l!=="name_short"&&!l.endsWith("_short")),h=[];for(const l of p){const f=a.map(m=>{const v=i[m];if(!v||typeof v!="object")return"";const w=v[`${l}_short`],E=v[l];return Rn(w??E)});if(f.every(m=>m.length===0))continue;const _=c[l]??l;h.push({label:_,values:f})}return h}function Pn(e){const t=[],n=new Set;for(const o of Object.values(e))if(!(!o||typeof o!="object"))for(const r of Object.keys(o))n.has(r)||(n.add(r),t.push(r));return t}function Rn(e){return typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):""}function Nn(e){return{type:"metadata",sessionId:"",model:"",meta:{panel:e.payload.panel,messages:e.payload.messages,message_id:e.payload.message_id}}}function jn(){return{type:"done"}}function Dn(e){return{type:"metadata",sessionId:"",model:"",meta:{loading:!0,loadingText:e.payload.text,thinkingMessages:e.payload.thinking_messages,dynamicLoading:e.payload.is_dynamic===!0}}}function Ln(e){return{type:"metadata",sessionId:"",model:"",meta:{loading:!0,panelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function xn(e){return{type:"metadata",sessionId:"",model:"",meta:{loading:!0,similarPanelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function Un(e){const t=b(e.payload.url);return t?{type:"action",action:{kind:"navigate",url:t,newTab:e.payload.new_tab===!0}}:{type:"metadata",sessionId:"",model:"",meta:{redirect:e.payload,redirectTarget:b(e.payload.to)}}}function qn(e){return{type:"error",code:"BACKEND_ERROR",message:b(e.payload?.text,e.payload?.message,e.payload?.error)??"Backend returned an error"}}function Fn(e){return{type:"metadata",sessionId:"",model:"",meta:{noop:!0}}}function Mn(e){const t=e.payload??{};if(Array.isArray(t.action_list)){const s={action_list:t.action_list},i=typeof t.type=="string"?t.type:void 0,a=typeof t.theme=="string"?t.theme:void 0;return i!==void 0&&(s.type=i),a!==void 0&&(s.theme=a),Ue({payload:s})}const o=N(t.action);if(o){const s={action:o},i=typeof t.text=="string"?t.text:void 0,a=typeof t.image_url=="string"?t.image_url:void 0,c=typeof t.theme=="string"?t.theme:void 0;return i!==void 0&&(s.text=i),a!==void 0&&(s.image_url=a),c!==void 0&&(s.theme=c),xe({payload:s})}const r=typeof t.text=="string"?t.text:"";if(r){const s={text:r},i=typeof t.type=="string"?t.type:void 0,a=typeof t.theme=="string"?t.theme:void 0,c=N(t.payload)??void 0;return i!==void 0&&(s.type=i),c!==void 0&&(s.payload=c),a!==void 0&&(s.theme=a),_e({payload:s})}return{type:"metadata",sessionId:"",model:"",meta:{launcherAction:t}}}function _e(e){const t={text:b(e.payload.text)??""};return typeof e.payload.theme=="string"&&(t.theme=e.payload.theme),e.payload.payload!==void 0&&(t.payload=e.payload.payload),{type:"ui_spec",widget:"qna",spec:{root:"root",elements:{root:{type:"QuestionHeading",props:t}}}}}function Bn(e){return ro(e.payload,"qna")}function xe(e){const t=b(e.payload.text)??"",n=C(e.payload.action,t);if(n){const r={label:t||n.title,action:n};return typeof e.payload.image_url=="string"&&(r.image=e.payload.image_url),typeof e.payload.theme=="string"&&(r.theme=e.payload.theme),{type:"ui_spec",widget:"qna",spec:{root:"root",elements:{root:{type:"ActionButton",props:r}}}}}const o={text:t};return typeof e.payload.theme=="string"&&(o.theme=e.payload.theme),_e({payload:o})}function Ue(e){const t=(e.payload.action_list??[]).map(n=>{const o=b(n.title)??"",r=C(n.requestDetails,o),s=r?{label:o,action:r}:null;return s?(typeof n.icon=="string"&&(s.icon=n.icon),typeof n.image=="string"&&(s.image=n.image),s):null});return qe(t.filter(Me),"qna")}function Jn(e){const n={reviews:(e.payload.reviews??[]).map(o=>{const r={};return typeof o.review_class=="string"&&(r.review_class=o.review_class),typeof o.review_text=="string"&&(r.review_text=o.review_text),(typeof o.review_rating=="string"||typeof o.review_rating=="number")&&(r.review_rating=o.review_rating),typeof o.review_tag=="string"&&(r.review_tag=o.review_tag),r})};return typeof e.payload.sku=="string"&&(n.sku=e.payload.sku),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ReviewHighlights",props:n}}}}}function Qn(e){const t={};return Array.isArray(e.payload.pros)&&(t.pros=e.payload.pros),Array.isArray(e.payload.cons)&&(t.cons=e.payload.cons),typeof e.payload.product_name=="string"&&(t.productName=e.payload.product_name),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ProsAndCons",props:t}}}}}function Hn(e){return{type:"metadata",sessionId:"",model:"",meta:{visitorDataResponse:e.payload}}}function Wn(e){const t=e.payload.product_suggestions??[],n=[];for(let o=0;o<t.length;o++){const r=t[o];if(!r)continue;const s=so(r);if(!s)continue;const i={product:s},a=C(r.requestDetails,s.name);a&&(i.action=a),typeof r.role=="string"&&(i.role=r.role),typeof r.reason=="string"&&(i.reason=r.reason),typeof r.review_highlight=="string"&&(i.reviewHighlight=r.review_highlight),Array.isArray(r.labels)&&(i.labels=r.labels),typeof r.expert_quality_score=="number"&&(i.expertQualityScore=r.expert_quality_score),n.push(i)}return n.length===0?{type:"metadata",sessionId:"",model:"",meta:{aiProductSuggestions:e.payload.product_suggestions??[]}}:{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"AITopPicks",props:{suggestions:n}}}}}}function Vn(e){const t=e.payload.product_groupings??[],n=[];for(let o=0;o<t.length;o++){const r=t[o];if(!r)continue;const s=b(r.name)??"",i=r.sku&&r.sku.length>0?{type:"findSimilar",payload:{sku:r.sku}}:void 0,a=C(r.requestDetails??i,s);if(!a)continue;const c={name:s,action:a};if(Array.isArray(r.labels)){const u=r.labels.filter(p=>typeof p=="string");u.length>0&&(c.labels=u)}typeof r.image=="string"&&(c.image=r.image),n.push(c)}return n.length===0?{type:"metadata",sessionId:"",model:"",meta:{aiProductGroupings:e.payload.product_groupings??[]}}:{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"AIGroupingCards",props:{entries:n}}}}}}function Gn(e){const t=e.payload.suggested_searches??[],n=[];for(let o=0;o<t.length;o++){const r=t[o];if(!r)continue;const s=b(r.short_name,r.chosen_attribute,r.detailed_user_message)??`Search ${o+1}`,i={},a=b(r.detailed_user_message);a&&(i.text=a);const c=N(r.requestDetails),u=N(c?.payload),p=u?.group_skus;r.group_skus&&Array.isArray(r.group_skus)?i.group_skus=r.group_skus:Array.isArray(p)&&(i.group_skus=p.filter(E=>typeof E=="string"));const h=b(r.sku,r.representative_product_sku,u?.sku);h&&(i.sku=h),i.is_suggested_text=1;const l={type:"inputText",payload:i},f=C(r.requestDetails,s),_=f?.type==="findSimilar"&&typeof i.text=="string"?C(l,s):f??C(l,s);if(!_)continue;const m={shortName:s,action:_},v=b(r.detailed_user_message);v&&v!==s&&(m.detailedMessage=v);const w=zn(r);w&&w!==s&&w!==(v??"")&&(m.whyDifferent=w),typeof r.image=="string"&&(m.image=r.image),n.push(m)}return n.length===0?{type:"metadata",sessionId:"",model:"",meta:{aiSuggestedSearches:e.payload.suggested_searches??[]}}:{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"AISuggestedSearchCards",props:{entries:n}}}}}}function Kn(e){const t=C(e.payload.requestDetails,b(e.payload.review_count,e.payload.text,e.payload.title)??"Show product reviews");if(!t)return{type:"metadata",sessionId:"",model:"",meta:{groundingReview:e.payload}};const n={action:t};return e.payload.title&&(n.title=e.payload.title),e.payload.text&&(n.text=e.payload.text),e.payload.review_count&&(n.reviewCount=e.payload.review_count),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"GroundingReviewCard",props:n}}}}}function Yn(){return{type:"metadata",sessionId:"",model:"",meta:{analyzeAnimation:!0}}}function Xn(e){return{type:"metadata",sessionId:"",model:"",meta:{voice:e.payload}}}function eo(e){const t=e.payload.group_list??[],n=[];for(const r of t){const s=r.group_name??"",i=(r.product_list??[]).map(J);n.push({groupName:s,products:i})}const o=[];for(const r of e.payload.filter_tags??[]){const s=r.title??"";if(!s)continue;const i=C(r.requestDetails,s),a={title:s};i&&(a.action=i),o.push(a)}return{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"CategoriesContainer",props:{groups:n,filterTags:o}}}},panelHint:"panel"}}function to(e){return{type:"metadata",sessionId:"",model:"",meta:{formType:e.type,formPayload:e.payload??{}}}}function no(e){const t={};return typeof e.payload?.summary=="string"&&(t.summary=e.payload.summary),Array.isArray(e.payload?.products_discussed)&&(t.products_discussed=e.payload.products_discussed),typeof e.payload?.user_sentiment=="string"&&(t.user_sentiment=e.payload.user_sentiment),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"HandoffNotice",props:t}}}}}function oo(e){return{type:"metadata",sessionId:"",model:"",meta:{launcherContent:e.payload??{}}}}function qe(e,t){const n={},o=[];for(let r=0;r<e.length;r++){const s=e[r];if(!s)continue;const i=`action-${r}`;o.push(i);const a={label:s.label,action:s.action};s.icon!==void 0&&(a.icon=s.icon),s.image!==void 0&&(a.image=s.image),s.description!==void 0&&(a.description=s.description),n[i]={type:"ActionButton",props:a}}return n.root={type:"ActionButtons",props:{buttons:e.map(r=>{const s={label:r.label,action:r.action};return r.image!==void 0&&(s.image=r.image),r.description!==void 0&&(s.description=r.description),r.icon!==void 0&&(s.icon=r.icon),s})},children:o},{type:"ui_spec",widget:t,spec:{root:"root",elements:n}}}function Fe(e,t){const n={},o=[];for(let r=0;r<e.length;r++){const s=e[r];if(!s)continue;const i=`product-${r}`;o.push(i),n[i]={type:"ProductCard",props:{product:J(s),index:r}}}return n.root={type:"ProductGrid",props:{layout:"grid"},children:o},{type:"ui_spec",widget:t,spec:{root:"root",elements:n}}}function ro(e,t){return{type:"ui_spec",widget:t,spec:{root:"root",elements:{root:{type:"ProductCard",props:{product:J(e),index:0}}}}}}function io(e){return{type:"ui_spec",widget:e,spec:{root:"root",elements:{root:{type:"ActionButtons",props:{buttons:[]},children:[]}}}}}function so(e){const t=b(e.sku),n=b(e.short_name),o=N(e.product_item)??e;return ao(o,t,n)}function ao(e,t,n){const o=b(e.sku,t),r=b(e.name,n);if(!o||!r)return null;const s={sku:o,name:r},i=b(e.brand);i&&(s.brand=i);const a=b(e.url);a&&(s.url=a);const c=co(e.images);if(c.length>0)s.images=c;else{const _=b(e.image,e.image_url,e.imageUrl);_&&(s.images=[_])}const u=G(e.price_discounted);u!==void 0&&(s.price_discounted=u);const p=G(e.price);p!==void 0&&(s.price=p);const h=G(e.rating);h!==void 0&&(s.rating=h);const l=G(e.review_count)??G(e.reviewCount);l!==void 0&&(s.review_count=l);const f=b(e.cart_code,e.cartCode);return f&&(s.cart_code=f),typeof e.in_stock=="boolean"&&(s.in_stock=e.in_stock),typeof e.inStock=="boolean"&&(s.in_stock=e.inStock),J(s)}function C(e,t){const n=N(e);if(!n)return null;const o=n.type;if(typeof o!="string"||o.length===0)return null;const r={title:t||o,type:o};return n.payload!==void 0&&(r.payload=n.payload),r}function N(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function b(...e){for(const t of e)if(typeof t=="string"){const n=t.trim();if(n.length>0)return n}}function co(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function uo(e){if(typeof e=="string"){const t=e.trim();return t?[t]:[]}return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim()).filter(t=>t.length>0):[]}function G(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let t;e.includes(".")&&e.includes(",")?t=e.replace(/\./g,"").replace(",","."):t=e.replace(",",".");const n=Number(t);if(Number.isFinite(n))return n}}function Me(e){return e!=null}const lo=new Set(["sku","name","brand","images","price","price_discounted","price_currency","discount_reason","url","rating","review_count","cart_code","in_stock","category_ids","category_names","variants","facet_hits","promotions"]);function J(e){const t=e.price_discounted!=null&&e.price_discounted>0,n=t?e.price_discounted:e.price,o=t&&e.price!=null?e.price:void 0;let r;o!=null&&n!=null&&o>0&&(r=Math.round((o-n)/o*100));const s=b(e.brand),i=b(e.name)??e.sku,a=s&&!i.toLowerCase().startsWith(s.toLowerCase())?`${s} ${i}`:i,c={sku:e.sku,name:a,url:b(e.url)??""},u=e.images?.[0];u&&(c.imageUrl=u),e.images&&e.images.length>1&&(c.images=e.images),n!=null&&(c.price=String(n)),o!=null&&(c.originalPrice=String(o)),r!==void 0&&(c.discountPercent=r),s!==void 0&&(c.brand=s),e.rating!==void 0&&(c.rating=e.rating),e.review_count!==void 0&&(c.reviewCount=e.review_count),e.cart_code!==void 0&&(c.cartCode=e.cart_code),e.in_stock!==void 0&&(c.inStock=e.in_stock),e.variants&&e.variants.length>0&&(c.variants=e.variants),e.discount_reason!==void 0&&(c.discountReason=e.discount_reason),e.promotions&&e.promotions.length>0&&(c.promotions=e.promotions);const p=e,h={};let l=!1;for(const f of Object.keys(p))lo.has(f)||(h[f]=p[f],l=!0);return l&&(c.extras=h),c}async function po(e,t,n){const o=wn("launcher_action",t),r={uiSpecs:[],actions:[]},s={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)};n!==void 0&&(s.signal=n);const i=await fetch(o,s);if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);const a={onEvent:c=>{const u=Sn(c);if(u&&(u.type==="ui_spec"&&r.uiSpecs.push(u.spec),u.type==="ui_spec"&&u.spec.elements)){for(const p of Object.values(u.spec.elements))if(p.type==="ActionButton"&&p.props?.action){const h=p.props.action;r.actions.push(h)}}}};return n!==void 0&&(a.signal=n),await _n(i,a),r}function fo(){return typeof window<"u"&&Array.isArray(window.dataLayer)}function ye(e,t){const n={event:e,...t};fo()&&window.dataLayer.push(n)}function ho(e){ye("gengage-on-init",{gengage_widget:e})}function go(e){ye("gengage-show",{gengage_widget:e})}function mo(e,t){ye("gengage-suggested-question",{gengage_question_title:e,gengage_action_type:t})}function Be(e){const t=document.createElement("div");t.className="gengage-qna-buttons",t.setAttribute("role","group"),t.setAttribute("aria-label",e.quickQuestionsAriaLabel??"Quick questions"),e.orientation==="vertical"&&(t.style.flexDirection="column");for(const n of e.actions){const o=document.createElement("button");o.className="gengage-qna-button",o.textContent=n.title,o.type="button",o.addEventListener("click",()=>{const r={title:n.title,type:n.type};n.payload!==void 0&&(r.payload=n.payload),e.onAction(r)}),t.appendChild(o)}if(e.ctaText||e.onOpenChat){const n=document.createElement("button");n.className="gengage-qna-cta",n.textContent=e.ctaText??e.defaultCtaText??"Ask something else",n.type="button",n.addEventListener("click",()=>{e.onOpenChat?.()}),t.appendChild(n)}return t}function _o(e){const t=document.createElement("div");t.className="gengage-qna-input-wrapper";const n=document.createElement("input");n.type="text",n.className="gengage-qna-input",n.setAttribute("aria-label",e.askQuestionAriaLabel??"Ask a question");const o=Array.isArray(e.placeholders)?e.placeholders:e.placeholders?[e.placeholders]:[e.defaultInputPlaceholder??"Ask a question..."];let r=0;n.placeholder=o[0]??"";let s=null,i=null;o.length>1&&(s=setInterval(()=>{n.classList.add("gengage-qna-input--fade"),i=setTimeout(()=>{r=(r+1)%o.length,n.placeholder=o[r]??"",n.classList.remove("gengage-qna-input--fade")},180)},3e3));const a=document.createElement("button");a.className="gengage-qna-send",a.type="button",a.textContent=e.ctaLabel??e.sendButtonText??"Ask",a.setAttribute("aria-label",e.sendQuestionAriaLabel??"Send question");const c=()=>{const u=n.value.trim();u&&(e.onSubmit({title:u,type:"user_message",payload:u}),n.value="")};return a.addEventListener("click",c),n.addEventListener("keydown",u=>{u.key==="Enter"&&(u.preventDefault(),c())}),t.appendChild(n),t.appendChild(a),t._cleanup=()=>{s&&clearInterval(s),i&&clearTimeout(i)},t}function te(e,t){if(!e||typeof e!="object")return null;const n=e,o=n.type;if(typeof o!="string"||o.length===0)return null;const r=n.title,s=n.payload,i=typeof r=="string"&&r.length>0?r:t;if(!i)return null;const a={title:i,type:o};return s!==void 0&&(a.payload=s),a}function Je(e){const t={title:e.title,type:e.type};return e.payload!==void 0&&(t.payload=e.payload),t}function Qe(e,t){const n=[],o=e.props?.actions;if(Array.isArray(o))for(const i of o){const a=te(i);a&&n.push(a)}const r=e.props?.buttons;if(Array.isArray(r))for(const i of r){if(!i||typeof i!="object")continue;const a=i,c=typeof a.label=="string"?a.label:void 0,u=te(a.action,c);u&&n.push(u)}if(e.children)for(const i of e.children){const a=t.elements[i];if(!a||a.type!=="ActionButton")continue;const c=typeof a.props?.label=="string"?a.props.label:void 0,u=te(a.props?.action,c);u&&n.push(u)}const s=new Set;return n.filter(i=>s.has(i.title)?!1:(s.add(i.title),!0))}const He={ButtonRow:({element:e,spec:t,context:n})=>{const o=Qe(e,t).map(Je),r=e.props?.orientation,s={actions:o,onAction:n.onAction,defaultCtaText:n.i18n.defaultCtaText,quickQuestionsAriaLabel:n.i18n.quickQuestionsAriaLabel};return n.onOpenChat!==void 0&&(s.onOpenChat=n.onOpenChat),n.ctaText!==void 0&&(s.ctaText=n.ctaText),(r==="horizontal"||r==="vertical")&&(s.orientation=r),Be(s)},ActionButtons:({element:e,spec:t,context:n})=>{const r={actions:Qe(e,t).map(Je),onAction:n.onAction,defaultCtaText:n.i18n.defaultCtaText,quickQuestionsAriaLabel:n.i18n.quickQuestionsAriaLabel};return n.onOpenChat!==void 0&&(r.onOpenChat=n.onOpenChat),n.ctaText!==void 0&&(r.ctaText=n.ctaText),Be(r)},ActionButton:({element:e,context:t})=>{const n=document.createElement("button");n.className="gengage-qna-button",n.type="button";const o=e.props?.label;typeof o=="string"?n.textContent=o:n.textContent=t.i18n.defaultCtaText;const r=te(e.props?.action,typeof o=="string"?o:void 0);return r&&n.addEventListener("click",()=>t.onAction(r)),n},TextInput:({element:e,context:t})=>{const n=e.props?.placeholder,o=typeof n=="string"||Array.isArray(n)?n:t.inputPlaceholder,r=typeof e.props?.ctaLabel=="string"?e.props.ctaLabel:void 0,s={onSubmit:t.onAction,askQuestionAriaLabel:t.i18n.askQuestionAriaLabel,defaultInputPlaceholder:t.i18n.defaultInputPlaceholder,sendButtonText:t.i18n.sendButton,sendQuestionAriaLabel:t.i18n.sendQuestionAriaLabel};return o!==void 0&&(s.placeholders=o),r!==void 0&&(s.ctaLabel=r),_o(s)},QuestionHeading:({element:e})=>{const t=document.createElement("h3");t.className="gengage-qna-heading";const n=e.props?.text;return t.textContent=typeof n=="string"?n:"",t},ProductCard:()=>null},ve=({element:e,renderElement:t})=>{if(!e.children||e.children.length===0)return null;const n=document.createElement("div");for(const o of e.children){const r=t(o);r&&n.appendChild(r)}return n};function We(){return{...He}}function Ve(e,t,n=He,o=ve){return Mt({spec:e,context:t,registry:n,containerClassName:"gengage-qna-uispec",unknownRenderer:o})}const Ge={quickQuestionsAriaLabel:"Hızlı sorular",askQuestionAriaLabel:"Soru sorun",defaultInputPlaceholder:"Bir soru sorun...",sendButton:"Sor",sendQuestionAriaLabel:"Soruyu gönder",defaultCtaText:"Başka bir şey sor"},yo={quickQuestionsAriaLabel:"Quick questions",askQuestionAriaLabel:"Ask a question",defaultInputPlaceholder:"Ask a question...",sendButton:"Ask",sendQuestionAriaLabel:"Send question",defaultCtaText:"Ask something else"};function vo(e){return e?e.toLowerCase().split("-")[0]??"tr":"tr"}function wo(e){return vo(e)==="en"?yo:Ge}function d(e,t,n){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,p=Object.keys(u);for(let h=0;h<p.length;h++){const l=p[h];l in a||(a[l]=u[l].bind(a))}}const r=n?.Parent??Object;class s extends r{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const p of u._zod.deferred)p();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Q extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ke extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ye={};function q(e){return Ye}function Xe(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function we(e,t){return typeof t=="bigint"?t.toString():t}function be(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ke(e){return e==null}function ze(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const et=Symbol("evaluating");function y(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==et)return o===void 0&&(o=et,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function F(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function D(...e){const t={};for(const n of e){const o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function tt(e){return JSON.stringify(e)}function bo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const nt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ko=be(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function K(e){if(ne(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ne(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ot(e){return K(e)?{...e}:Array.isArray(e)?[...e]:e}const zo=new Set(["string","number","symbol"]);function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,n){const o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function g(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function So(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function $o(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=D(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return F(this,"shape",i),i},checks:[]});return L(e,s)}function To(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=D(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return F(this,"shape",i),i},checks:[]});return L(e,s)}function Eo(e,t){if(!K(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=D(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return F(this,"shape",s),s}});return L(e,r)}function Ao(e,t){if(!K(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=D(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return F(this,"shape",o),o}});return L(e,n)}function Io(e,t){const n=D(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return F(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return L(e,n)}function Oo(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=D(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return F(this,"shape",c),c},checks:[]});return L(t,i)}function Zo(e,t,n){const o=D(t._zod.def,{get shape(){const r=t._zod.def.shape,s={...r};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)s[i]=new e({type:"nonoptional",innerType:r[i]});return F(this,"shape",s),s}});return L(t,o)}function H(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function rt(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function re(e){return typeof e=="string"?e:e?.message}function M(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=re(e.inst?._zod.def?.error?.(e))??re(t?.error?.(e))??re(n.customError?.(e))??re(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Se(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Y(...e){const[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}const it=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,we,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},st=d("$ZodError",it),at=d("$ZodError",it,{Parent:Error});function Co(e,t=n=>n.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function Po(e,t=n=>n.message){const n={_errors:[]},o=r=>{for(const s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return o(e),n}const $e=e=>(t,n,o,r)=>{const s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Q;if(i.issues.length){const a=new(r?.Err??e)(i.issues.map(c=>M(c,s,q())));throw nt(a,r?.callee),a}return i.value},Te=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(r?.Err??e)(i.issues.map(c=>M(c,s,q())));throw nt(a,r?.callee),a}return i.value},ie=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new Q;return s.issues.length?{success:!1,error:new(e??st)(s.issues.map(i=>M(i,r,q())))}:{success:!0,data:s.value}},Ro=ie(at),se=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>M(i,r,q())))}:{success:!0,data:s.value}},No=se(at),jo=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return $e(e)(t,n,r)},Do=e=>(t,n,o)=>$e(e)(t,n,o),Lo=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Te(e)(t,n,r)},xo=e=>async(t,n,o)=>Te(e)(t,n,o),Uo=e=>(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ie(e)(t,n,r)},qo=e=>(t,n,o)=>ie(e)(t,n,o),Fo=e=>async(t,n,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return se(e)(t,n,r)},Mo=e=>async(t,n,o)=>se(e)(t,n,o),Bo=/^[cC][^\s-]{8,}$/,Jo=/^[0-9a-z]+$/,Qo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ho=/^[0-9a-vA-V]{20}$/,Wo=/^[A-Za-z0-9]{27}$/,Vo=/^[a-zA-Z0-9_-]{21}$/,Go=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ko=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ct=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Yo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function er(){return new RegExp(Xo,"u")}const tr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,or=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ir=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ut=/^[A-Za-z0-9_-]*$/,sr=/^\+[1-9]\d{6,14}$/,dt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ar=new RegExp(`^${dt}$`);function lt(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cr(e){return new RegExp(`^${lt(e)}$`)}function ur(e){const t=lt({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${dt}T(?:${o})$`)}const dr=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},lr=/^(?:true|false)$/i,pr=/^[^A-Z]*$/,fr=/^[^a-z]*$/,P=d("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),hr=d("$ZodCheckMaxLength",(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!ke(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const r=o.value;if(r.length<=t.maximum)return;const i=Se(r);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gr=d("$ZodCheckMinLength",(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!ke(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const r=o.value;if(r.length>=t.minimum)return;const i=Se(r);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mr=d("$ZodCheckLengthEquals",(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=o=>{const r=o.value;return!ke(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{const r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=o=>{const r=o.value,s=r.length;if(s===t.length)return;const i=Se(r),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),ae=d("$ZodCheckStringFormat",(e,t)=>{var n,o;P.init(e,t),e._zod.onattach.push(r=>{const s=r._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),_r=d("$ZodCheckRegex",(e,t)=>{ae.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),yr=d("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pr),ae.init(e,t)}),vr=d("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=fr),ae.init(e,t)}),wr=d("$ZodCheckIncludes",(e,t)=>{P.init(e,t);const n=oe(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),br=d("$ZodCheckStartsWith",(e,t)=>{P.init(e,t);const n=new RegExp(`^${oe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),kr=d("$ZodCheckEndsWith",(e,t)=>{P.init(e,t);const n=new RegExp(`.*${oe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),zr=d("$ZodCheckOverwrite",(e,t)=>{P.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Sr{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(`
48
- `).filter(i=>i),r=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,r=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,r.join(`
49
- `))}}const $r={major:4,minor:3,patch:6},S=d("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$r;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const r of o)for(const s of r._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const r=(i,a,c)=>{let u=H(i),p;for(const h of a){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(u)continue;const l=i.issues.length,f=h._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Q;if(p||f instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await f,i.issues.length!==l&&(u||(u=H(i,l)))});else{if(i.issues.length===l)continue;u||(u=H(i,l))}}return p?p.then(()=>i):i},s=(i,a,c)=>{if(H(i))return i.aborted=!0,i;const u=r(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Q;return u.then(p=>e._zod.parse(p,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(p=>s(p,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Q;return c.then(u=>r(u,o,a))}return r(c,o,a)}}y(e,"~standard",()=>({validate:r=>{try{const s=Ro(e,r);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return No(e,r).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ee=d("$ZodString",(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dr(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),k=d("$ZodStringFormat",(e,t)=>{ae.init(e,t),Ee.init(e,t)}),Tr=d("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ko),k.init(e,t)}),Er=d("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ct(o))}else t.pattern??(t.pattern=ct());k.init(e,t)}),Ar=d("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Yo),k.init(e,t)}),Ir=d("$ZodURL",(e,t)=>{k.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Or=d("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=er()),k.init(e,t)}),Zr=d("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Vo),k.init(e,t)}),Cr=d("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Bo),k.init(e,t)}),Pr=d("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jo),k.init(e,t)}),Rr=d("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Qo),k.init(e,t)}),Nr=d("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ho),k.init(e,t)}),jr=d("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wo),k.init(e,t)}),Dr=d("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ur(t)),k.init(e,t)}),Lr=d("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ar),k.init(e,t)}),xr=d("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cr(t)),k.init(e,t)}),Ur=d("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Go),k.init(e,t)}),qr=d("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tr),k.init(e,t),e._zod.bag.format="ipv4"}),Fr=d("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nr),k.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Mr=d("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=or),k.init(e,t)}),Br=d("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=rr),k.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(o.length!==2)throw new Error;const[r,s]=o;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function pt(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Jr=d("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ir),k.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{pt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Qr(e){if(!ut.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return pt(n)}const Hr=d("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ut),k.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Qr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Wr=d("$ZodE164",(e,t)=>{t.pattern??(t.pattern=sr),k.init(e,t)});function Vr(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const Gr=d("$ZodJWT",(e,t)=>{k.init(e,t),e._zod.check=n=>{Vr(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Kr=d("$ZodBoolean",(e,t)=>{S.init(e,t),e._zod.pattern=lr,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Yr=d("$ZodUnknown",(e,t)=>{S.init(e,t),e._zod.parse=n=>n}),Xr=d("$ZodNever",(e,t)=>{S.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function ft(e,t,n){e.issues.length&&t.issues.push(...rt(n,e.issues)),t.value[n]=e.value}const ei=d("$ZodArray",(e,t)=>{S.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let i=0;i<r.length;i++){const a=r[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>ft(u,n,i))):ft(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ce(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...rt(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function ht(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=So(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function gt(e,t,n,o,r,s){const i=[],a=r.keySet,c=r.catchall._zod,u=c.def.type,p=c.optout==="optional";for(const h in t){if(a.has(h))continue;if(u==="never"){i.push(h);continue}const l=c.run({value:t[h],issues:[]},o);l instanceof Promise?e.push(l.then(f=>ce(f,n,h,t,p))):ce(l,n,h,t,p)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const ti=d("$ZodObject",(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=be(()=>ht(t));y(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const p=a[u]._zod;if(p.values){c[u]??(c[u]=new Set);for(const h of p.values)c[u].add(h)}}return c});const r=ne,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=o.value);const u=a.value;if(!r(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const p=[],h=i.shape;for(const l of i.keys){const f=h[l],_=f._zod.optout==="optional",m=f._zod.run({value:u[l],issues:[]},c);m instanceof Promise?p.push(m.then(v=>ce(v,a,l,u,_))):ce(m,a,l,u,_)}return s?gt(p,u,a,c,o.value,e):p.length?Promise.all(p).then(()=>a):a}}),ni=d("$ZodObjectJIT",(e,t)=>{ti.init(e,t);const n=e._zod.parse,o=be(()=>ht(t)),r=l=>{const f=new Sr(["shape","payload","ctx"]),_=o.value,m=R=>{const I=tt(R);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};f.write("const input = payload.value;");const v=Object.create(null);let w=0;for(const R of _.keys)v[R]=`key_${w++}`;f.write("const newResult = {};");for(const R of _.keys){const I=v[R],Z=tt(R),Ha=l[R]?._zod?.optout==="optional";f.write(`const ${I} = ${m(R)};`),Ha?f.write(`
50
- if (${I}.issues.length) {
51
- if (${Z} in input) {
52
- payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
46
+ `,document.head.appendChild(e)}var v=null;function he(){if(v!==null)return v;try{v=localStorage.getItem(`gengage:debug`)===`1`}catch{v=!1}return v}function ge(e,t,n){if(!he())return;let r=[`[gengage:${e}]`,t];n!==void 0&&r.push(n),console.debug(...r)}var _e=class{constructor(){this.isVisible=!1,this.isInitialised=!1,this._handlers=new Map,this._cleanups=[],this._ownsRoot=!1,this._destroying=!1}async init(e){if(this.isInitialised){console.warn(`[gengage] Widget already initialised. Call update() instead.`);return}let t=ee(e.theme);this.config={...e,theme:t,session:m(e.session)},this.root=this._resolveMount(e.mountTarget),this._applyTheme(t),ce();let n=f(`gengage:context:update`,e=>this.update(e));this._cleanups.push(n),ge(`lifecycle`,`${this.constructor.name}.init`,{accountId:e.accountId,sku:e.pageContext?.sku});try{await this.onInit(this.config)}catch(e){throw this.destroy(),e}this._destroying||(this.isInitialised=!0,ge(`lifecycle`,`${this.constructor.name} ready`),this.emit(`ready`))}update(e){this.isInitialised&&(this.config.pageContext?this.config={...this.config,pageContext:{...this.config.pageContext,...e}}:e.pageType!==void 0&&(this.config={...this.config,pageContext:e}),this.onUpdate(e),this.emit(`context-update`,this.config.pageContext))}show(){this.isVisible||(this.isVisible=!0,this.root.style.display=``,this.onShow(),this.emit(`show`))}hide(){this.isVisible&&(this.isVisible=!1,this.root.style.display=`none`,this.onHide(),this.emit(`hide`))}destroy(){this._destroying||(this._destroying=!0,this.emit(`destroy`),this._cleanups.forEach(e=>e()),this._cleanups.length=0,this._handlers.clear(),this.onDestroy(),this.config.analyticsClient?.destroy(),this._ownsRoot?this.root.remove():this.root.innerHTML=``,this.isInitialised=!1)}on(e,t){return this._handlers.has(e)||this._handlers.set(e,new Set),this._handlers.get(e).add(t),()=>this._handlers.get(e)?.delete(t)}trackCheckout(e,t){let n=e===`start`?l:u;this.track(n(this.analyticsContext(),t))}flushMeteringSummary(e){this.track(s(this.analyticsContext(),e))}emit(e,...t){this._handlers.get(e)?.forEach(e=>e(...t))}addCleanup(e){this._cleanups.push(e)}track(e){this.config.analyticsClient?.track(e)}analyticsContext(){let e={account_id:this.config.accountId,session_id:this.config.session?.sessionId??``,correlation_id:this.config.session?.sessionId??``};return this.config.session?.viewId!==void 0&&(e.view_id=this.config.session.viewId),this.config.session?.userId!==void 0&&(e.user_id=this.config.session.userId),this.config.pageContext?.pageType!==void 0&&(e.page_type=this.config.pageContext.pageType),this.config.pageContext?.sku!==void 0&&(e.sku=this.config.pageContext.sku),this.config.session?.abTestVariant!==void 0&&(e.ab_test_variant=this.config.session.abTestVariant),this.config.session?.abTestExperimentId!==void 0&&(e.ab_test_experiment_id=this.config.session.abTestExperimentId),e}_resolveMount(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`){let t=document.querySelector(e);if(!t)throw Error(`[gengage] Mount target not found: "${e}"`);return t}let t=document.createElement(`div`);return t.dataset.gengageWidget=this.constructor.name.toLowerCase(),document.body.appendChild(t),this._ownsRoot=!0,t}_applyTheme(e){if(e){for(let[t,n]of Object.entries(e))if(n!==void 0){let e=t.startsWith(`--`)?t:`--gengage-${ve(t)}`;this.root.style.setProperty(e,n)}}}};function ve(e){return e.replace(/([A-Z])/g,`-$1`).toLowerCase()}function ye(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function be(e){let t=[],n=0,r=!1,i=!1,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(i){i=!1;continue}if(s===`\\`&&r){i=!0;continue}if(s===`"`){r=!r;continue}r||(s===`{`&&n++,s===`}`&&(n--,n===0&&(t.push(e.slice(a,o+1)),a=o+1)))}return t.length>0?t:[e]}function xe(e,t){let n=e.trim();if(!n||n.startsWith(`:`))return!1;let r=n.startsWith(`data: `)?n.slice(6):n;if(r===`[DONE]`)return t.onDone?.(),!0;try{let e=JSON.parse(r);return ye(e)?(ge(`stream`,`event: ${e.type}`,e),t.onEvent(e),e.type===`done`?(t.onDone?.(),!0):!1):!1}catch{let e=be(r);if(e.length>1){for(let n of e)try{let e=JSON.parse(n);if(!ye(e))continue;if(t.onEvent(e),e.type===`done`)return t.onDone?.(),!0}catch{}return!1}return!1}}async function Se(e,t){if(!e.ok){t.onError?.(Error(`HTTP ${e.status}: ${e.statusText}`));return}if(!e.body){t.onError?.(Error(`Response body is null — streaming not supported`));return}let n=e.body.getReader(),r=new TextDecoder(`utf-8`),i=``,a=t.idleTimeoutMs??6e4,o=Symbol(`idle-timeout`),s=!1;try{for(;;){let e=n.read(),c,l=await(a>0?Promise.race([e.then(e=>(clearTimeout(c),e)),new Promise(e=>{c=setTimeout(()=>e(o),a)})]):e);if(l===o){s=!0,await n.cancel();break}let{done:u,value:d}=l;if(u)break;i+=r.decode(d,{stream:!0});let f=i.split(`
47
+ `);i=f.pop()??``;for(let e of f)if(xe(e,t))return}if(i.trim()&&xe(i,t))return}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;t.onError?.(e instanceof Error?e:Error(String(e)))}finally{s||n.releaseLock()}t.onDone?.()}var Ce={process_action:`/process_action`,launcher_action:`/launcher_action`,similar_products:`/similar_products`,product_groupings:`/product_groupings`};function we(e){if(e===void 0)throw Error(`[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.`);let t=e.trim();return t===``?``:t.replace(/\/+$/,``)}function Te(e,t){return`${we(t?.middlewareUrl)}/chat${Ce[e]}`}var Ee=3,De=(e,t)=>{let n=e.replace(/\s+/g,` `).trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g,``);if(!n)return``;let r=t?.stripLeadingStopWords?n.replace(/^(?:daha|için)\s+/i,``).trim():n;return r?r.split(/\s+/).slice(0,3).join(` `).trim():``},Oe=(e,t)=>e?e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map(e=>De(e,t)).filter(Boolean):[];function ke(e){let t=(e.display_keywords??[]).flatMap(e=>Oe(e,{stripLeadingStopWords:!0})),n=t.filter((e,n)=>t.indexOf(e)===n);if(n.length>0)return n.slice(0,Ee);let r=[...Oe(e.chosen_attribute,{stripLeadingStopWords:!0}),...Oe(e.short_name)];return r.filter((e,t)=>r.indexOf(e)===t).slice(0,Ee)}function Ae(e){return ke(e).join(` • `)}function je(e){if(typeof e.type!=`string`)return null;if(Me(e))return e;let t=e;switch(t.type){case`outputText`:return Ne(t);case`suggestedActions`:return Pe(t);case`productList`:return Fe(t);case`productDetails`:return Ie(t);case`productDetailsSimilars`:return Le(t);case`comparisonTable`:return Re(t);case`context`:return He(t);case`chatStreamEnd`:return Ue();case`loading`:return We(t);case`panelLoading`:return Ge(t);case`similarLoading`:return Ke(t);case`redirect`:return qe(t);case`error`:return Je(t);case`dummy`:return Ye(t);case`launcherAction`:return Xe(t);case`text`:return Ze(t);case`productItem`:return Qe(t);case`text_image`:return $e(t);case`quick_qna`:return et(t);case`reviewHighlights`:return tt(t);case`aiProductSuggestions`:return it(t);case`aiProductGroupings`:return at(t);case`aiSuggestedSearches`:return ot(t);case`prosAndCons`:return nt(t);case`getGroundingReview`:return st(t);case`voice`:return lt(t);case`visitorDataResponse`:return rt(t);case`productListPreview`:return ct();case`groupList`:return ut(t);case`formGetInfo`:case`formTestDrive`:case`formServiceRequest`:case`launchFormPage`:return dt(t);case`launcherContent`:return pt(t);case`handoff`:return ft(t);default:return null}}function Me(e){let t=e.type;if(typeof t!=`string`)return!1;switch(t){case`metadata`:return typeof e.sessionId==`string`&&typeof e.model==`string`;case`text_chunk`:return typeof e.content==`string`;case`ui_spec`:{let t=e.widget;if(t!==`chat`&&t!==`qna`&&t!==`simrel`)return!1;let n=b(e.spec);return n?typeof n.root==`string`&&b(n.elements)!==null:!1}case`action`:{let t=b(e.action);return t!==null&&typeof t.kind==`string`}case`error`:return typeof e.code==`string`&&typeof e.message==`string`;case`done`:return!0;default:return!1}}function Ne(e){let t=x(e.payload.text,e.payload.plain_text)??``,n=x(e.payload.plain_text,e.payload.text)??t;if(e.payload.is_error)return{type:`error`,code:`BACKEND_ERROR`,message:n||`Backend returned an error`};let r={type:`text_chunk`,content:t,final:!0},i=e.payload.product_mentions;Array.isArray(i)&&i.length>0&&(r.productMentions=i.filter(e=>typeof e==`object`&&!!e&&typeof e.sku==`string`&&typeof e.short_name==`string`));let a=e.payload.sku_to_product_item;a&&typeof a==`object`&&!Array.isArray(a)&&(r.skuToProductItem=a);let o=e.payload.conversation_mode;return typeof o==`string`&&o&&(r.conversationMode=o),r}function Pe(e){return mt((e.payload.actions??[]).map(e=>{let t=x(e.title)??``,n=y(e.requestDetails,t),r=n?{label:t,action:n}:null;return r?(typeof e.icon==`string`&&(r.icon=e.icon),typeof e.image==`string`&&(r.image=e.image),r):null}).filter(St),`chat`)}function Fe(e){let t=ht(e.payload.product_list??[],`chat`);t.panelHint=`panel`;let n=t.spec.elements[t.spec.root];return n&&(typeof e.payload.offset==`number`&&(n.props={...n.props,offset:e.payload.offset}),typeof e.payload.end_of_list==`boolean`&&(n.props={...n.props,endOfList:e.payload.end_of_list}),typeof e.payload.title==`string`&&(n.props={...n.props,panelTitle:e.payload.title})),t}function Ie(e){let t=e.payload.productDetails;return t?{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProductDetailsPanel`,props:{product:C(t)}}}},panelHint:`panel`}:_t(`chat`)}function Le(e){let t=ht(e.payload.similarProducts??[],`chat`),n=t.spec.elements[t.spec.root];return n&&(n.props={...n.props,similarsAppend:!0}),{...t,panelHint:`panel`}}function Re(e){let t=e.payload.multiple_product_details??[],n=e.payload,r={key_differences:n.key_differences,recommended_choice:n.recommended_choice,recommended_choice_sku:n.recommended_choice_sku,special_considerations:n.special_considerations,criteria_view:n.criteria_view,criteria_view_short:n.criteria_view_short,compared_field_names:n.compared_field_names,winner_product:n.winner_product,winner_hits:n.winner_hits,...e.payload.product_comparison_framework??{}},i=e.payload.table,a=e.payload.features_list,o=[];for(let e of t){let t=C(e);o.push(t)}let s=ze(i,o,r,a),c;r?.recommended_choice_sku?c=r.recommended_choice_sku:r?.winner_product&&r.winner_product.length>0&&(c=r.winner_product[0]?.product_detail?.sku??r.winner_product[0]?.sku);let l=c?o.find(e=>e.sku===c)??o[0]:o[0],u=[];if(Array.isArray(r?.key_differences))for(let e of r.key_differences)typeof e==`string`&&u.push(e);let d=xt(r?.special_considerations),f=r?.recommended_choice,p=r?.winner_hits,m={};for(let e of o){let t=e.sku;t&&(m[t]={title:e.name??t,type:`launchSingleProduct`,payload:{sku:t}})}let h={products:o,attributes:s,highlights:u,productActions:m};return l&&(h.recommended=l),d.length>0&&(h.specialCases=d),f&&(h.recommendedText=f),p&&(h.winnerHits=p),typeof r?.key_differences==`string`&&(h.keyDifferencesHtml=r.key_differences),r?.special_considerations&&(h.specialConsiderations=r.special_considerations),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ComparisonTable`,props:h}}},panelHint:`panel`}}function ze(e,t,n,r){if(!e)return[];let i=Object.entries(e);if(i.length===0)return[];let a=i[0]?.[1];if(Array.isArray(a)){let t=n.criteria_view??n.criteria_view_short??{},r=n.compared_field_names??Object.keys(e),i=[];for(let n of r){let r=e[n];if(!r||!Array.isArray(r))continue;let a=t[n]??n;i.push({label:a,values:r.map(e=>typeof e==`string`?e:String(e??``))})}return i}let o=e,s=t.map(e=>String(e.sku??``)).filter(e=>e.length>0),c=n.criteria_view??n.criteria_view_short??{},l=(r&&r.length>0?r:n.compared_field_names&&n.compared_field_names.length>0?n.compared_field_names:Be(o)).filter(e=>e!==`name`&&e!==`name_short`&&!e.endsWith(`_short`)),u=[];for(let e of l){let t=s.map(t=>{let n=o[t];if(!n||typeof n!=`object`)return``;let r=n[`${e}_short`],i=n[e];return Ve(r??i)});if(t.every(e=>e.length===0))continue;let n=c[e]??e;u.push({label:n,values:t})}return u}function Be(e){let t=[],n=new Set;for(let r of Object.values(e))if(!(!r||typeof r!=`object`))for(let e of Object.keys(r))n.has(e)||(n.add(e),t.push(e));return t}function Ve(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function He(e){return{type:`metadata`,sessionId:``,model:``,meta:{panel:e.payload.panel,messages:e.payload.messages,message_id:e.payload.message_id}}}function Ue(){return{type:`done`}}function We(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,loadingText:e.payload.text,thinkingMessages:e.payload.thinking_messages,dynamicLoading:e.payload.is_dynamic===!0}}}function Ge(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,panelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function Ke(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,similarPanelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function qe(e){let t=x(e.payload.url);return t?{type:`action`,action:{kind:`navigate`,url:t,newTab:e.payload.new_tab===!0}}:{type:`metadata`,sessionId:``,model:``,meta:{redirect:e.payload,redirectTarget:x(e.payload.to)}}}function Je(e){return{type:`error`,code:`BACKEND_ERROR`,message:x(e.payload?.text,e.payload?.message,e.payload?.error)??`Backend returned an error`}}function Ye(e){return{type:`metadata`,sessionId:``,model:``,meta:{noop:!0}}}function Xe(e){let t=e.payload??{};if(Array.isArray(t.action_list)){let e={action_list:t.action_list},n=typeof t.type==`string`?t.type:void 0,r=typeof t.theme==`string`?t.theme:void 0;return n!==void 0&&(e.type=n),r!==void 0&&(e.theme=r),et({type:`quick_qna`,payload:e})}let n=b(t.action);if(n){let e={action:n},r=typeof t.text==`string`?t.text:void 0,i=typeof t.image_url==`string`?t.image_url:void 0,a=typeof t.theme==`string`?t.theme:void 0;return r!==void 0&&(e.text=r),i!==void 0&&(e.image_url=i),a!==void 0&&(e.theme=a),$e({type:`text_image`,payload:e})}let r=typeof t.text==`string`?t.text:``;if(r){let e={text:r},n=typeof t.type==`string`?t.type:void 0,i=typeof t.theme==`string`?t.theme:void 0,a=b(t.payload)??void 0;return n!==void 0&&(e.type=n),a!==void 0&&(e.payload=a),i!==void 0&&(e.theme=i),Ze({type:`text`,payload:e})}return{type:`metadata`,sessionId:``,model:``,meta:{launcherAction:t}}}function Ze(e){let t={text:x(e.payload.text)??``};return typeof e.payload.theme==`string`&&(t.theme=e.payload.theme),e.payload.payload!==void 0&&(t.payload=e.payload.payload),{type:`ui_spec`,widget:`qna`,spec:{root:`root`,elements:{root:{type:`QuestionHeading`,props:t}}}}}function Qe(e){return gt(e.payload,`qna`)}function $e(e){let t=x(e.payload.text)??``,n=y(e.payload.action,t);if(n){let r={label:t||n.title,action:n};return typeof e.payload.image_url==`string`&&(r.image=e.payload.image_url),typeof e.payload.theme==`string`&&(r.theme=e.payload.theme),{type:`ui_spec`,widget:`qna`,spec:{root:`root`,elements:{root:{type:`ActionButton`,props:r}}}}}let r={text:t};return typeof e.payload.theme==`string`&&(r.theme=e.payload.theme),Ze({type:`text`,payload:r})}function et(e){return mt((e.payload.action_list??[]).map(e=>{let t=x(e.title)??``,n=y(e.requestDetails,t),r=n?{label:t,action:n}:null;return r?(typeof e.icon==`string`&&(r.icon=e.icon),typeof e.image==`string`&&(r.image=e.image),r):null}).filter(St),`qna`)}function tt(e){let t={reviews:(e.payload.reviews??[]).map(e=>{let t={};return typeof e.review_class==`string`&&(t.review_class=e.review_class),typeof e.review_text==`string`&&(t.review_text=e.review_text),(typeof e.review_rating==`string`||typeof e.review_rating==`number`)&&(t.review_rating=e.review_rating),typeof e.review_tag==`string`&&(t.review_tag=e.review_tag),t})};return typeof e.payload.sku==`string`&&(t.sku=e.payload.sku),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ReviewHighlights`,props:t}}}}}function nt(e){let t={};return Array.isArray(e.payload.pros)&&(t.pros=e.payload.pros),Array.isArray(e.payload.cons)&&(t.cons=e.payload.cons),typeof e.payload.product_name==`string`&&(t.productName=e.payload.product_name),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProsAndCons`,props:t}}}}}function rt(e){return{type:`metadata`,sessionId:``,model:``,meta:{visitorDataResponse:e.payload}}}function it(e){let t=e.payload.product_suggestions??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=vt(r);if(!i)continue;let a={product:i},o=y(r.requestDetails,i.name);o&&(a.action=o),typeof r.role==`string`&&(a.role=r.role),typeof r.reason==`string`&&(a.reason=r.reason),typeof r.review_highlight==`string`&&(a.reviewHighlight=r.review_highlight),Array.isArray(r.labels)&&(a.labels=r.labels),typeof r.expert_quality_score==`number`&&(a.expertQualityScore=r.expert_quality_score),n.push(a)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiProductSuggestions:e.payload.product_suggestions??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AITopPicks`,props:{suggestions:n}}}}}}function at(e){let t=e.payload.product_groupings??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=x(r.name)??``,a=r.sku&&r.sku.length>0?{type:`findSimilar`,payload:{sku:r.sku}}:void 0,o=y(r.requestDetails??a,i);if(!o)continue;let s={name:i,action:o};if(Array.isArray(r.labels)){let e=r.labels.filter(e=>typeof e==`string`);e.length>0&&(s.labels=e)}typeof r.image==`string`&&(s.image=r.image),n.push(s)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiProductGroupings:e.payload.product_groupings??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AIGroupingCards`,props:{entries:n}}}}}}function ot(e){let t=e.payload.suggested_searches??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=x(r.short_name,r.chosen_attribute,r.detailed_user_message)??`Search ${e+1}`,a={},o=x(r.detailed_user_message);o&&(a.text=o);let s=b(b(r.requestDetails)?.payload),c=s?.group_skus;r.group_skus&&Array.isArray(r.group_skus)?a.group_skus=r.group_skus:Array.isArray(c)&&(a.group_skus=c.filter(e=>typeof e==`string`));let l=x(r.sku,r.representative_product_sku,s?.sku);l&&(a.sku=l),a.is_suggested_text=1;let u={type:`inputText`,payload:a},d=y(r.requestDetails,i),f=d?.type===`findSimilar`&&typeof a.text==`string`?y(u,i):d??y(u,i);if(!f)continue;let p={shortName:i,action:f},m=x(r.detailed_user_message);m&&m!==i&&(p.detailedMessage=m);let h=Ae(r);h&&h!==i&&h!==(m??``)&&(p.whyDifferent=h),typeof r.image==`string`&&(p.image=r.image),n.push(p)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiSuggestedSearches:e.payload.suggested_searches??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AISuggestedSearchCards`,props:{entries:n}}}}}}function st(e){let t=y(e.payload.requestDetails,x(e.payload.review_count,e.payload.text,e.payload.title)??`Show product reviews`);if(!t)return{type:`metadata`,sessionId:``,model:``,meta:{groundingReview:e.payload}};let n={action:t};return e.payload.title&&(n.title=e.payload.title),e.payload.text&&(n.text=e.payload.text),e.payload.review_count&&(n.reviewCount=e.payload.review_count),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`GroundingReviewCard`,props:n}}}}}function ct(){return{type:`metadata`,sessionId:``,model:``,meta:{analyzeAnimation:!0}}}function lt(e){return{type:`metadata`,sessionId:``,model:``,meta:{voice:e.payload}}}function ut(e){let t=e.payload.group_list??[],n=[];for(let e of t){let t=e.group_name??``,r=(e.product_list??[]).map(C);n.push({groupName:t,products:r})}let r=[];for(let t of e.payload.filter_tags??[]){let e=t.title??``;if(!e)continue;let n=y(t.requestDetails,e),i={title:e};n&&(i.action=n),r.push(i)}return{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`CategoriesContainer`,props:{groups:n,filterTags:r}}}},panelHint:`panel`}}function dt(e){return{type:`metadata`,sessionId:``,model:``,meta:{formType:e.type,formPayload:e.payload??{}}}}function ft(e){let t={};return typeof e.payload?.summary==`string`&&(t.summary=e.payload.summary),Array.isArray(e.payload?.products_discussed)&&(t.products_discussed=e.payload.products_discussed),typeof e.payload?.user_sentiment==`string`&&(t.user_sentiment=e.payload.user_sentiment),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`HandoffNotice`,props:t}}}}}function pt(e){return{type:`metadata`,sessionId:``,model:``,meta:{launcherContent:e.payload??{}}}}function mt(e,t){let n={},r=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=`action-${t}`;r.push(a);let o={label:i.label,action:i.action};i.icon!==void 0&&(o.icon=i.icon),i.image!==void 0&&(o.image=i.image),i.description!==void 0&&(o.description=i.description),n[a]={type:`ActionButton`,props:o}}return n.root={type:`ActionButtons`,props:{buttons:e.map(e=>{let t={label:e.label,action:e.action};return e.image!==void 0&&(t.image=e.image),e.description!==void 0&&(t.description=e.description),e.icon!==void 0&&(t.icon=e.icon),t})},children:r},{type:`ui_spec`,widget:t,spec:{root:`root`,elements:n}}}function ht(e,t){let n={},r=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=`product-${t}`;r.push(a),n[a]={type:`ProductCard`,props:{product:C(i),index:t}}}return n.root={type:`ProductGrid`,props:{layout:`grid`},children:r},{type:`ui_spec`,widget:t,spec:{root:`root`,elements:n}}}function gt(e,t){return{type:`ui_spec`,widget:t,spec:{root:`root`,elements:{root:{type:`ProductCard`,props:{product:C(e),index:0}}}}}}function _t(e){return{type:`ui_spec`,widget:e,spec:{root:`root`,elements:{root:{type:`ActionButtons`,props:{buttons:[]},children:[]}}}}}function vt(e){let t=x(e.sku),n=x(e.short_name);return yt(b(e.product_item)??e,t,n)}function yt(e,t,n){let r=x(e.sku,t),i=x(e.name,n);if(!r||!i)return null;let a={sku:r,name:i},o=x(e.brand);o&&(a.brand=o);let s=x(e.url);s&&(a.url=s);let c=bt(e.images);if(c.length>0)a.images=c;else{let t=x(e.image,e.image_url,e.imageUrl);t&&(a.images=[t])}let l=S(e.price_discounted);l!==void 0&&(a.price_discounted=l);let u=S(e.price);u!==void 0&&(a.price=u);let d=S(e.rating);d!==void 0&&(a.rating=d);let f=S(e.review_count)??S(e.reviewCount);f!==void 0&&(a.review_count=f);let p=x(e.cart_code,e.cartCode);return p&&(a.cart_code=p),typeof e.in_stock==`boolean`&&(a.in_stock=e.in_stock),typeof e.inStock==`boolean`&&(a.in_stock=e.inStock),C(a)}function y(e,t){let n=b(e);if(!n)return null;let r=n.type;if(typeof r!=`string`||r.length===0)return null;let i={title:t||r,type:r};return n.payload!==void 0&&(i.payload=n.payload),i}function b(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function x(...e){for(let t of e)if(typeof t==`string`){let e=t.trim();if(e.length>0)return e}}function bt(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):[]}function xt(e){if(typeof e==`string`){let t=e.trim();return t?[t]:[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]}function S(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t;t=e.includes(`.`)&&e.includes(`,`)?e.replace(/\./g,``).replace(`,`,`.`):e.replace(`,`,`.`);let n=Number(t);if(Number.isFinite(n))return n}}function St(e){return e!=null}var Ct=new Set([`sku`,`name`,`brand`,`images`,`price`,`price_discounted`,`price_currency`,`discount_reason`,`url`,`rating`,`review_count`,`cart_code`,`in_stock`,`category_ids`,`category_names`,`variants`,`facet_hits`,`promotions`]);function C(e){let t=e.price_discounted!=null&&e.price_discounted>0,n=t?e.price_discounted:e.price,r=t&&e.price!=null?e.price:void 0,i;r!=null&&n!=null&&r>0&&(i=Math.round((r-n)/r*100));let a=x(e.brand),o=x(e.name)??e.sku,s=a&&!o.toLowerCase().startsWith(a.toLowerCase())?`${a} ${o}`:o,c={sku:e.sku,name:s,url:x(e.url)??``},l=e.images?.[0];l&&(c.imageUrl=l),e.images&&e.images.length>1&&(c.images=e.images),n!=null&&(c.price=String(n)),r!=null&&(c.originalPrice=String(r)),i!==void 0&&(c.discountPercent=i),a!==void 0&&(c.brand=a),e.rating!==void 0&&(c.rating=e.rating),e.review_count!==void 0&&(c.reviewCount=e.review_count),e.cart_code!==void 0&&(c.cartCode=e.cart_code),e.in_stock!==void 0&&(c.inStock=e.in_stock),e.variants&&e.variants.length>0&&(c.variants=e.variants),e.discount_reason!==void 0&&(c.discountReason=e.discount_reason),e.promotions&&e.promotions.length>0&&(c.promotions=e.promotions);let u=e,d={},f=!1;for(let e of Object.keys(u))Ct.has(e)||(d[e]=u[e],f=!0);return f&&(c.extras=d),c}async function wt(e,t,n){let r=Te(`launcher_action`,t),i={uiSpecs:[],actions:[]},a={method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)};n!==void 0&&(a.signal=n);let o=await fetch(r,a);if(!o.ok)throw Error(`HTTP ${o.status}: ${o.statusText}`);let s={onEvent:e=>{let t=je(e);if(t&&(t.type===`ui_spec`&&i.uiSpecs.push(t.spec),t.type===`ui_spec`&&t.spec.elements)){for(let e of Object.values(t.spec.elements))if(e.type===`ActionButton`&&e.props?.action){let t=e.props.action;i.actions.push(t)}}}};return n!==void 0&&(s.signal=n),await Se(o,s),i}function Tt(){return typeof window<`u`&&Array.isArray(window.dataLayer)}function Et(e,t){let n={event:e,...t};Tt()&&window.dataLayer.push(n)}function Dt(e){Et(`gengage-on-init`,{gengage_widget:e})}function Ot(e){Et(`gengage-show`,{gengage_widget:e})}function kt(e,t){Et(`gengage-suggested-question`,{gengage_question_title:e,gengage_action_type:t})}function At(e){let t=document.createElement(`div`);t.className=`gengage-qna-buttons`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,e.quickQuestionsAriaLabel??`Quick questions`),e.orientation===`vertical`&&(t.style.flexDirection=`column`);for(let n of e.actions){let r=document.createElement(`button`);r.className=`gengage-qna-button`,r.textContent=n.title,r.type=`button`,r.addEventListener(`click`,()=>{let t={title:n.title,type:n.type};n.payload!==void 0&&(t.payload=n.payload),e.onAction(t)}),t.appendChild(r)}if(e.ctaText||e.onOpenChat){let n=document.createElement(`button`);n.className=`gengage-qna-cta`,n.textContent=e.ctaText??e.defaultCtaText??`Ask something else`,n.type=`button`,n.addEventListener(`click`,()=>{e.onOpenChat?.()}),t.appendChild(n)}return t}function jt(e){let t=document.createElement(`div`);t.className=`gengage-qna-input-wrapper`;let n=document.createElement(`input`);n.type=`text`,n.className=`gengage-qna-input`,n.setAttribute(`aria-label`,e.askQuestionAriaLabel??`Ask a question`);let r=Array.isArray(e.placeholders)?e.placeholders:e.placeholders?[e.placeholders]:[e.defaultInputPlaceholder??`Ask a question...`],i=0;n.placeholder=r[0]??``;let a=null,o=null;r.length>1&&(a=setInterval(()=>{n.classList.add(`gengage-qna-input--fade`),o=setTimeout(()=>{i=(i+1)%r.length,n.placeholder=r[i]??``,n.classList.remove(`gengage-qna-input--fade`)},180)},3e3));let s=document.createElement(`button`);s.className=`gengage-qna-send`,s.type=`button`,s.textContent=e.ctaLabel??e.sendButtonText??`Ask`,s.setAttribute(`aria-label`,e.sendQuestionAriaLabel??`Send question`);let c=()=>{let t=n.value.trim();t&&(e.onSubmit({title:t,type:`user_message`,payload:t}),n.value=``)};return s.addEventListener(`click`,c),n.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),c())}),t.appendChild(n),t.appendChild(s),t._cleanup=()=>{a&&clearInterval(a),o&&clearTimeout(o)},t}function w(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=n.type;if(typeof r!=`string`||r.length===0)return null;let i=n.title,a=n.payload,o=typeof i==`string`&&i.length>0?i:t;if(!o)return null;let s={title:o,type:r};return a!==void 0&&(s.payload=a),s}function Mt(e){let t={title:e.title,type:e.type};return e.payload!==void 0&&(t.payload=e.payload),t}function Nt(e,t){let n=[],r=e.props?.actions;if(Array.isArray(r))for(let e of r){let t=w(e);t&&n.push(t)}let i=e.props?.buttons;if(Array.isArray(i))for(let e of i){if(!e||typeof e!=`object`)continue;let t=e,r=typeof t.label==`string`?t.label:void 0,i=w(t.action,r);i&&n.push(i)}if(e.children)for(let r of e.children){let e=t.elements[r];if(!e||e.type!==`ActionButton`)continue;let i=typeof e.props?.label==`string`?e.props.label:void 0,a=w(e.props?.action,i);a&&n.push(a)}let a=new Set;return n.filter(e=>a.has(e.title)?!1:(a.add(e.title),!0))}var Pt={ButtonRow:({element:e,spec:t,context:n})=>{let r=Nt(e,t).map(Mt),i=e.props?.orientation,a={actions:r,onAction:n.onAction,defaultCtaText:n.i18n.defaultCtaText,quickQuestionsAriaLabel:n.i18n.quickQuestionsAriaLabel};return n.onOpenChat!==void 0&&(a.onOpenChat=n.onOpenChat),n.ctaText!==void 0&&(a.ctaText=n.ctaText),(i===`horizontal`||i===`vertical`)&&(a.orientation=i),At(a)},ActionButtons:({element:e,spec:t,context:n})=>{let r={actions:Nt(e,t).map(Mt),onAction:n.onAction,defaultCtaText:n.i18n.defaultCtaText,quickQuestionsAriaLabel:n.i18n.quickQuestionsAriaLabel};return n.onOpenChat!==void 0&&(r.onOpenChat=n.onOpenChat),n.ctaText!==void 0&&(r.ctaText=n.ctaText),At(r)},ActionButton:({element:e,context:t})=>{let n=document.createElement(`button`);n.className=`gengage-qna-button`,n.type=`button`;let r=e.props?.label;typeof r==`string`?n.textContent=r:n.textContent=t.i18n.defaultCtaText;let i=w(e.props?.action,typeof r==`string`?r:void 0);return i&&n.addEventListener(`click`,()=>t.onAction(i)),n},TextInput:({element:e,context:t})=>{let n=e.props?.placeholder,r=typeof n==`string`||Array.isArray(n)?n:t.inputPlaceholder,i=typeof e.props?.ctaLabel==`string`?e.props.ctaLabel:void 0,a={onSubmit:t.onAction,askQuestionAriaLabel:t.i18n.askQuestionAriaLabel,defaultInputPlaceholder:t.i18n.defaultInputPlaceholder,sendButtonText:t.i18n.sendButton,sendQuestionAriaLabel:t.i18n.sendQuestionAriaLabel};return r!==void 0&&(a.placeholders=r),i!==void 0&&(a.ctaLabel=i),jt(a)},QuestionHeading:({element:e})=>{let t=document.createElement(`h3`);t.className=`gengage-qna-heading`;let n=e.props?.text;return t.textContent=typeof n==`string`?n:``,t},ProductCard:()=>null},Ft=({element:e,renderElement:t})=>{if(!e.children||e.children.length===0)return null;let n=document.createElement(`div`);for(let r of e.children){let e=t(r);e&&n.appendChild(e)}return n};function It(){return{...Pt}}function Lt(e,t,r=Pt,i=Ft){return n({spec:e,context:t,registry:r,containerClassName:`gengage-qna-uispec`,unknownRenderer:i})}var Rt={quickQuestionsAriaLabel:`Hızlı sorular`,askQuestionAriaLabel:`Soru sorun`,defaultInputPlaceholder:`Bir soru sorun...`,sendButton:`Sor`,sendQuestionAriaLabel:`Soruyu gönder`,defaultCtaText:`Başka bir şey sor`},zt={quickQuestionsAriaLabel:`Quick questions`,askQuestionAriaLabel:`Ask a question`,defaultInputPlaceholder:`Ask a question...`,sendButton:`Ask`,sendQuestionAriaLabel:`Send question`,defaultCtaText:`Ask something else`};function Bt(e){return e?e.toLowerCase().split(`-`)[0]??`tr`:`tr`}function Vt(e){switch(Bt(e)){case`en`:return zt;default:return Rt}}Object.freeze({status:`aborted`});function T(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var E=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ht=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ut={};function D(e){return e&&Object.assign(Ut,e),Ut}function Wt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Gt(e,t){return typeof t==`bigint`?t.toString():t}function Kt(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function qt(e){return e==null}function Jt(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var Yt=Symbol(`evaluating`);function O(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Yt)return r===void 0&&(r=Yt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function k(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function A(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Xt(e){return JSON.stringify(e)}function Zt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Qt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function $t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var en=Kt(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function j(e){if($t(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!($t(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function tn(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}var nn=new Set([`string`,`number`,`symbol`]);function M(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function N(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function P(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function rn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function an(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return N(e,A(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return k(this,`shape`,e),e},checks:[]}))}function on(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return N(e,A(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return k(this,`shape`,r),r},checks:[]}))}function sn(e,t){if(!j(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return N(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return k(this,`shape`,n),n}}))}function cn(e,t){if(!j(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return N(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return k(this,`shape`,n),n}}))}function ln(e,t){return N(e,A(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return k(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function un(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return N(t,A(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return k(this,`shape`,i),i},checks:[]}))}function dn(e,t,n){return N(t,A(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return k(this,`shape`,i),i}}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function fn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return typeof e==`string`?e:e?.message}function L(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function pn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function R(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var mn=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Gt,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},hn=T(`$ZodError`,mn),gn=T(`$ZodError`,mn,{Parent:Error});function _n(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function vn(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var yn=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new E;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>L(e,a,D())));throw Qt(t,i?.callee),t}return o.value},bn=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>L(e,a,D())));throw Qt(t,i?.callee),t}return o.value},z=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new E;return a.issues.length?{success:!1,error:new(e??hn)(a.issues.map(e=>L(e,i,D())))}:{success:!0,data:a.value}},xn=z(gn),B=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>L(e,i,D())))}:{success:!0,data:a.value}},Sn=B(gn),Cn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return yn(e)(t,n,i)},wn=e=>(t,n,r)=>yn(e)(t,n,r),Tn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return bn(e)(t,n,i)},En=e=>async(t,n,r)=>bn(e)(t,n,r),Dn=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return z(e)(t,n,i)},On=e=>(t,n,r)=>z(e)(t,n,r),kn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return B(e)(t,n,i)},An=e=>async(t,n,r)=>B(e)(t,n,r),jn=/^[cC][^\s-]{8,}$/,Mn=/^[0-9a-z]+$/,Nn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pn=/^[0-9a-vA-V]{20}$/,Fn=/^[A-Za-z0-9]{27}$/,In=/^[a-zA-Z0-9_-]{21}$/,Ln=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Bn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Vn=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Hn(){return new RegExp(Vn,`u`)}var Un=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Gn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Kn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jn=/^[A-Za-z0-9_-]*$/,Yn=/^\+[1-9]\d{6,14}$/,Xn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Zn=RegExp(`^${Xn}$`);function Qn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $n(e){return RegExp(`^${Qn(e)}$`)}function er(e){let t=Qn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Xn}T(?:${r})$`)}var tr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},nr=/^(?:true|false)$/i,rr=/^[^A-Z]*$/,ir=/^[^a-z]*$/,V=T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ar=T(`$ZodCheckMaxLength`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=pn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),or=T(`$ZodCheckMinLength`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=pn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sr=T(`$ZodCheckLengthEquals`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=pn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),H=T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;V.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),cr=T(`$ZodCheckRegex`,(e,t)=>{H.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),lr=T(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=rr,H.init(e,t)}),ur=T(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ir,H.init(e,t)}),dr=T(`$ZodCheckIncludes`,(e,t)=>{V.init(e,t);let n=M(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),fr=T(`$ZodCheckStartsWith`,(e,t)=>{V.init(e,t);let n=RegExp(`^${M(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),pr=T(`$ZodCheckEndsWith`,(e,t)=>{V.init(e,t);let n=RegExp(`.*${M(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),mr=T(`$ZodCheckOverwrite`,(e,t)=>{V.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),hr=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
48
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
49
+ `))}},gr={major:4,minor:3,patch:6},U=T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=F(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new E;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=F(e,t))});else{if(e.issues.length===t)continue;r||=F(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(F(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new E;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new E;return o.then(e=>t(e,r,a))}return t(o,r,a)}}O(e,`~standard`,()=>({validate:t=>{try{let n=xn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Sn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),_r=T(`$ZodString`,(e,t)=>{U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??tr(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),W=T(`$ZodStringFormat`,(e,t)=>{H.init(e,t),_r.init(e,t)}),vr=T(`$ZodGUID`,(e,t)=>{t.pattern??=Rn,W.init(e,t)}),yr=T(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=zn(e)}else t.pattern??=zn();W.init(e,t)}),br=T(`$ZodEmail`,(e,t)=>{t.pattern??=Bn,W.init(e,t)}),xr=T(`$ZodURL`,(e,t)=>{W.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Sr=T(`$ZodEmoji`,(e,t)=>{t.pattern??=Hn(),W.init(e,t)}),Cr=T(`$ZodNanoID`,(e,t)=>{t.pattern??=In,W.init(e,t)}),wr=T(`$ZodCUID`,(e,t)=>{t.pattern??=jn,W.init(e,t)}),Tr=T(`$ZodCUID2`,(e,t)=>{t.pattern??=Mn,W.init(e,t)}),Er=T(`$ZodULID`,(e,t)=>{t.pattern??=Nn,W.init(e,t)}),Dr=T(`$ZodXID`,(e,t)=>{t.pattern??=Pn,W.init(e,t)}),Or=T(`$ZodKSUID`,(e,t)=>{t.pattern??=Fn,W.init(e,t)}),kr=T(`$ZodISODateTime`,(e,t)=>{t.pattern??=er(t),W.init(e,t)}),Ar=T(`$ZodISODate`,(e,t)=>{t.pattern??=Zn,W.init(e,t)}),jr=T(`$ZodISOTime`,(e,t)=>{t.pattern??=$n(t),W.init(e,t)}),Mr=T(`$ZodISODuration`,(e,t)=>{t.pattern??=Ln,W.init(e,t)}),Nr=T(`$ZodIPv4`,(e,t)=>{t.pattern??=Un,W.init(e,t),e._zod.bag.format=`ipv4`}),Pr=T(`$ZodIPv6`,(e,t)=>{t.pattern??=Wn,W.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Fr=T(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Gn,W.init(e,t)}),Ir=T(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Kn,W.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Lr(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Rr=T(`$ZodBase64`,(e,t)=>{t.pattern??=qn,W.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Lr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function zr(e){if(!Jn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Lr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Br=T(`$ZodBase64URL`,(e,t)=>{t.pattern??=Jn,W.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{zr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Vr=T(`$ZodE164`,(e,t)=>{t.pattern??=Yn,W.init(e,t)});function Hr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ur=T(`$ZodJWT`,(e,t)=>{W.init(e,t),e._zod.check=n=>{Hr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Wr=T(`$ZodBoolean`,(e,t)=>{U.init(e,t),e._zod.pattern=nr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Gr=T(`$ZodUnknown`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),Kr=T(`$ZodNever`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function qr(e,t,n){e.issues.length&&t.issues.push(...fn(n,e.issues)),t.value[n]=e.value}var Jr=T(`$ZodArray`,(e,t)=>{U.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>qr(t,n,e))):qr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Yr(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...fn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Xr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=rn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Zr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Yr(e,n,i,t,u))):Yr(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Qr=T(`$ZodObject`,(e,t)=>{if(U.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Kt(()=>Xr(t));O(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=$t,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Yr(n,t,e,s,r))):Yr(i,t,e,s,r)}return i?Zr(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),$r=T(`$ZodObjectJIT`,(e,t)=>{Qr.init(e,t);let n=e._zod.parse,r=Kt(()=>Xr(t)),i=e=>{let t=new hr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Xt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Xt(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
50
+ if (${n}.issues.length) {
51
+ if (${o} in input) {
52
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
53
53
  ...iss,
54
- path: iss.path ? [${Z}, ...iss.path] : [${Z}]
54
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
55
55
  })));
56
56
  }
57
57
  }
58
58
 
59
- if (${I}.value === undefined) {
60
- if (${Z} in input) {
61
- newResult[${Z}] = undefined;
59
+ if (${n}.value === undefined) {
60
+ if (${o} in input) {
61
+ newResult[${o}] = undefined;
62
62
  }
63
63
  } else {
64
- newResult[${Z}] = ${I}.value;
64
+ newResult[${o}] = ${n}.value;
65
65
  }
66
66
 
67
- `):f.write(`
68
- if (${I}.issues.length) {
69
- payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
67
+ `):t.write(`
68
+ if (${n}.issues.length) {
69
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
70
70
  ...iss,
71
- path: iss.path ? [${Z}, ...iss.path] : [${Z}]
71
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
72
72
  })));
73
73
  }
74
74
 
75
- if (${I}.value === undefined) {
76
- if (${Z} in input) {
77
- newResult[${Z}] = undefined;
75
+ if (${n}.value === undefined) {
76
+ if (${o} in input) {
77
+ newResult[${o}] = undefined;
78
78
  }
79
79
  } else {
80
- newResult[${Z}] = ${I}.value;
80
+ newResult[${o}] = ${n}.value;
81
81
  }
82
82
 
83
- `)}f.write("payload.value = newResult;"),f.write("return payload;");const E=f.compile();return(R,I)=>E(l,R,I)};let s;const i=ne,a=!Ye.jitless,u=a&&ko.value,p=t.catchall;let h;e._zod.parse=(l,f)=>{h??(h=o.value);const _=l.value;return i(_)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=r(t.shape)),l=s(l,f),p?gt([],_,l,f,h,e):l):n(l,f):(l.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),l)}});function mt(e,t,n,o){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const r=e.filter(s=>!H(s));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>M(i,o,q())))}),t)}const oi=d("$ZodUnion",(e,t)=>{S.init(e,t),y(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),y(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),y(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),y(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>ze(s.source)).join("|")})$`)}});const n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(r,s)=>{if(n)return o(r,s);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:r.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>mt(c,r,e,s)):mt(a,r,e,s)}}),ri=d("$ZodIntersection",(e,t)=>{S.init(e,t),e._zod.parse=(n,o)=>{const r=n.value,s=t.left._zod.run({value:r,issues:[]},o),i=t.right._zod.run({value:r,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>_t(n,c,u)):_t(n,s,i)}});function Ae(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(K(e)&&K(t)){const n=Object.keys(t),o=Object.keys(e).filter(s=>n.indexOf(s)!==-1),r={...e,...t};for(const s of o){const i=Ae(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};r[s]=i.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const r=e[o],s=t[o],i=Ae(r,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _t(e,t,n){const o=new Map;let r;for(const a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);const s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&r&&e.issues.push({...r,keys:s}),H(e))return e;const i=Ae(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const ii=d("$ZodEnum",(e,t)=>{S.init(e,t);const n=Xe(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(r=>zo.has(typeof r)).map(r=>typeof r=="string"?oe(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const i=r.value;return o.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),si=d("$ZodTransform",(e,t)=>{S.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Ke(e.constructor.name);const r=t.transform(n.value,n);if(o.async)return(r instanceof Promise?r:Promise.resolve(r)).then(i=>(n.value=i,n));if(r instanceof Promise)throw new Q;return n.value=r,n}});function yt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const vt=d("$ZodOptional",(e,t)=>{S.init(e,t),e._zod.optin="optional",e._zod.optout="optional",y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ze(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>yt(s,n.value)):yt(r,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),ai=d("$ZodExactOptional",(e,t)=>{vt.init(e,t),y(e._zod,"values",()=>t.innerType._zod.values),y(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),ci=d("$ZodNullable",(e,t)=>{S.init(e,t),y(e._zod,"optin",()=>t.innerType._zod.optin),y(e._zod,"optout",()=>t.innerType._zod.optout),y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ze(n.source)}|null)$`):void 0}),y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),ui=d("$ZodDefault",(e,t)=>{S.init(e,t),e._zod.optin="optional",y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>wt(s,t)):wt(r,t)}});function wt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const di=d("$ZodPrefault",(e,t)=>{S.init(e,t),e._zod.optin="optional",y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),li=d("$ZodNonOptional",(e,t)=>{S.init(e,t),y(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>bt(s,e)):bt(r,e)}});function bt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const pi=d("$ZodCatch",(e,t)=>{S.init(e,t),y(e._zod,"optin",()=>t.innerType._zod.optin),y(e._zod,"optout",()=>t.innerType._zod.optout),y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>M(i,o,q()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(s=>M(s,o,q()))},input:n.value}),n.issues=[]),n)}}),fi=d("$ZodPipe",(e,t)=>{S.init(e,t),y(e._zod,"values",()=>t.in._zod.values),y(e._zod,"optin",()=>t.in._zod.optin),y(e._zod,"optout",()=>t.out._zod.optout),y(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){const s=t.out._zod.run(n,o);return s instanceof Promise?s.then(i=>ue(i,t.in,o)):ue(s,t.in,o)}const r=t.in._zod.run(n,o);return r instanceof Promise?r.then(s=>ue(s,t.out,o)):ue(r,t.out,o)}});function ue(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const hi=d("$ZodReadonly",(e,t)=>{S.init(e,t),y(e._zod,"propValues",()=>t.innerType._zod.propValues),y(e._zod,"values",()=>t.innerType._zod.values),y(e._zod,"optin",()=>t.innerType?._zod?.optin),y(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(kt):kt(r)}});function kt(e){return e.value=Object.freeze(e.value),e}const gi=d("$ZodCustom",(e,t)=>{P.init(e,t),S.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then(s=>zt(s,n,o,e));zt(r,n,o,e)}});function zt(e,t,n,o){if(!e){const r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),t.issues.push(Y(r))}}var St;class mi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const o={...this.get(n)??{}};delete o.id;const r={...o,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function _i(){return new mi}(St=globalThis).__zod_globalRegistry??(St.__zod_globalRegistry=_i());const X=globalThis.__zod_globalRegistry;function yi(e,t){return new e({type:"string",...g(t)})}function vi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function $t(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function wi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function bi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function ki(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Si(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function $i(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Ti(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Ei(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Ai(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Ii(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Oi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Zi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Ci(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Pi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Ri(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Ni(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function ji(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Di(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Li(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function xi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Ui(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function qi(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Fi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Mi(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Bi(e,t){return new e({type:"boolean",...g(t)})}function Ji(e){return new e({type:"unknown"})}function Qi(e,t){return new e({type:"never",...g(t)})}function Tt(e,t){return new hr({check:"max_length",...g(t),maximum:e})}function de(e,t){return new gr({check:"min_length",...g(t),minimum:e})}function Et(e,t){return new mr({check:"length_equals",...g(t),length:e})}function Hi(e,t){return new _r({check:"string_format",format:"regex",...g(t),pattern:e})}function Wi(e){return new yr({check:"string_format",format:"lowercase",...g(e)})}function Vi(e){return new vr({check:"string_format",format:"uppercase",...g(e)})}function Gi(e,t){return new wr({check:"string_format",format:"includes",...g(t),includes:e})}function Ki(e,t){return new br({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Yi(e,t){return new kr({check:"string_format",format:"ends_with",...g(t),suffix:e})}function W(e){return new zr({check:"overwrite",tx:e})}function Xi(e){return W(t=>t.normalize(e))}function es(){return W(e=>e.trim())}function ts(){return W(e=>e.toLowerCase())}function ns(){return W(e=>e.toUpperCase())}function os(){return W(e=>bo(e))}function rs(e,t,n){return new e({type:"array",element:t,...g(n)})}function is(e,t,n){return new e({type:"custom",check:"custom",fn:t,...g(n)})}function ss(e){const t=as(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Y(o,n.value,t._zod.def));else{const r=o;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(Y(r))}},e(n.value,n)));return t}function as(e,t){const n=new P({check:"custom",...g(t)});return n._zod.check=e,n}function At(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??X,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function T(e,t,n={path:[],schemaPath:[]}){var o;const r=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,p);else{const l=i.schema,f=t.processors[r.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);f(e,t,l,p)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),T(h,t,p),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&A(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function It(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}const r=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(i[0])?.id,l=e.external.uri??(_=>_);if(h)return{ref:l(h)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${l("__shared")}#/${a}/${f}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,p=i[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:u+p}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=r(i);a.def={...a.schema},u&&(a.defId=u);const p=a.schema;for(const h in p)delete p[h];p.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
83
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=$t,s=!Ut.jitless,c=s&&en.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Zr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function ei(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!F(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,D())))}),t)}var ti=T(`$ZodUnion`,(e,t)=>{U.init(e,t),O(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),O(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),O(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),O(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Jt(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>ei(t,i,e,a)):ei(s,i,e,a)}}),ni=T(`$ZodIntersection`,(e,t)=>{U.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ii(e,t,n)):ii(e,i,a)}});function ri(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(j(e)&&j(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=ri(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ri(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ii(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),F(e))return e;let o=ri(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var ai=T(`$ZodEnum`,(e,t)=>{U.init(e,t);let n=Wt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>nn.has(typeof e)).map(e=>typeof e==`string`?M(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),oi=T(`$ZodTransform`,(e,t)=>{U.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ht(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new E;return n.value=i,n}});function si(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var ci=T(`$ZodOptional`,(e,t)=>{U.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),O(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Jt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>si(t,e.value)):si(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),li=T(`$ZodExactOptional`,(e,t)=>{ci.init(e,t),O(e._zod,`values`,()=>t.innerType._zod.values),O(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ui=T(`$ZodNullable`,(e,t)=>{U.init(e,t),O(e._zod,`optin`,()=>t.innerType._zod.optin),O(e._zod,`optout`,()=>t.innerType._zod.optout),O(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Jt(e.source)}|null)$`):void 0}),O(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),di=T(`$ZodDefault`,(e,t)=>{U.init(e,t),e._zod.optin=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>fi(e,t)):fi(r,t)}});function fi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var pi=T(`$ZodPrefault`,(e,t)=>{U.init(e,t),e._zod.optin=`optional`,O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),mi=T(`$ZodNonOptional`,(e,t)=>{U.init(e,t),O(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>hi(t,e)):hi(i,e)}});function hi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var gi=T(`$ZodCatch`,(e,t)=>{U.init(e,t),O(e._zod,`optin`,()=>t.innerType._zod.optin),O(e._zod,`optout`,()=>t.innerType._zod.optout),O(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>L(e,n,D()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>L(e,n,D()))},input:e.value}),e.issues=[]),e)}}),_i=T(`$ZodPipe`,(e,t)=>{U.init(e,t),O(e._zod,`values`,()=>t.in._zod.values),O(e._zod,`optin`,()=>t.in._zod.optin),O(e._zod,`optout`,()=>t.out._zod.optout),O(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>vi(e,t.in,n)):vi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>vi(e,t.out,n)):vi(r,t.out,n)}});function vi(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var yi=T(`$ZodReadonly`,(e,t)=>{U.init(e,t),O(e._zod,`propValues`,()=>t.innerType._zod.propValues),O(e._zod,`values`,()=>t.innerType._zod.values),O(e._zod,`optin`,()=>t.innerType?._zod?.optin),O(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(bi):bi(r)}});function bi(e){return e.value=Object.freeze(e.value),e}var xi=T(`$ZodCustom`,(e,t)=>{V.init(e,t),U.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Si(t,n,r,e));Si(i,n,r,e)}});function Si(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(R(e))}}var Ci,wi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ti(){return new wi}(Ci=globalThis).__zod_globalRegistry??(Ci.__zod_globalRegistry=Ti());var G=globalThis.__zod_globalRegistry;function Ei(e,t){return new e({type:`string`,...P(t)})}function Di(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...P(t)})}function Oi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...P(t)})}function ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...P(t)})}function Ai(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...P(t)})}function ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...P(t)})}function Mi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...P(t)})}function Ni(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...P(t)})}function Pi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...P(t)})}function Fi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...P(t)})}function Ii(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...P(t)})}function Li(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...P(t)})}function Ri(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...P(t)})}function zi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...P(t)})}function Bi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...P(t)})}function Vi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...P(t)})}function Hi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...P(t)})}function Ui(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...P(t)})}function Wi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...P(t)})}function Gi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...P(t)})}function Ki(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...P(t)})}function qi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...P(t)})}function Ji(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...P(t)})}function Yi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...P(t)})}function Xi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...P(t)})}function Zi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...P(t)})}function Qi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...P(t)})}function $i(e,t){return new e({type:`boolean`,...P(t)})}function ea(e){return new e({type:`unknown`})}function ta(e,t){return new e({type:`never`,...P(t)})}function na(e,t){return new ar({check:`max_length`,...P(t),maximum:e})}function ra(e,t){return new or({check:`min_length`,...P(t),minimum:e})}function ia(e,t){return new sr({check:`length_equals`,...P(t),length:e})}function aa(e,t){return new cr({check:`string_format`,format:`regex`,...P(t),pattern:e})}function oa(e){return new lr({check:`string_format`,format:`lowercase`,...P(e)})}function sa(e){return new ur({check:`string_format`,format:`uppercase`,...P(e)})}function ca(e,t){return new dr({check:`string_format`,format:`includes`,...P(t),includes:e})}function la(e,t){return new fr({check:`string_format`,format:`starts_with`,...P(t),prefix:e})}function ua(e,t){return new pr({check:`string_format`,format:`ends_with`,...P(t),suffix:e})}function K(e){return new mr({check:`overwrite`,tx:e})}function da(e){return K(t=>t.normalize(e))}function fa(){return K(e=>e.trim())}function pa(){return K(e=>e.toLowerCase())}function ma(){return K(e=>e.toUpperCase())}function ha(){return K(e=>Zt(e))}function ga(e,t,n){return new e({type:`array`,element:t,...P(n)})}function _a(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...P(n)})}function va(e){let t=ya(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(R(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(R(r))}},e(n.value,n)));return t}function ya(e,t){let n=new V({check:`custom`,...P(t)});return n._zod.check=e,n}function ba(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??G,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function q(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,q(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&J(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
84
84
 
85
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ot(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},p=a.ref;if(a.ref=null,p){o(p);const l=e.seen.get(p),f=l.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),i._zod.parent===p)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(f.$ref&&l.def)for(const m in c)m==="$ref"||m==="allOf"||m in l.def&&JSON.stringify(c[m])===JSON.stringify(l.def[m])&&delete c[m]}const h=i._zod.parent;if(h&&h!==p){o(h);const l=e.seen.get(h);if(l?.schema.$ref&&(c.$ref=l.schema.$ref,l.def))for(const f in c)f==="$ref"||f==="allOf"||f in l.def&&JSON.stringify(c[f])===JSON.stringify(l.def[f])&&delete c[f]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())o(i[0]);const r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(i)}Object.assign(r,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?r.$defs=s:r.definitions=s);try{const i=JSON.parse(JSON.stringify(r));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:le(t,"input",e.processors),output:le(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function A(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return A(o.element,n);if(o.type==="set")return A(o.valueType,n);if(o.type==="lazy")return A(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return A(o.innerType,n);if(o.type==="intersection")return A(o.left,n)||A(o.right,n);if(o.type==="record"||o.type==="map")return A(o.keyType,n)||A(o.valueType,n);if(o.type==="pipe")return A(o.in,n)||A(o.out,n);if(o.type==="object"){for(const r in o.shape)if(A(o.shape[r],n))return!0;return!1}if(o.type==="union"){for(const r of o.options)if(A(r,n))return!0;return!1}if(o.type==="tuple"){for(const r of o.items)if(A(r,n))return!0;return!!(o.rest&&A(o.rest,n))}return!1}const cs=(e,t={})=>n=>{const o=At({...n,processors:t});return T(e,o),It(o,e),Ot(o,e)},le=(e,t,n={})=>o=>{const{libraryOptions:r,target:s}=o??{},i=At({...r??{},target:s,io:t,processors:n});return T(e,i),It(i,e),Ot(i,e)},us={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ds=(e,t,n,o)=>{const r=n;r.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(r.minLength=s),typeof i=="number"&&(r.maxLength=i),a&&(r.format=us[a]??a,r.format===""&&delete r.format,a==="time"&&delete r.format),u&&(r.contentEncoding=u),c&&c.size>0){const p=[...c];p.length===1?r.pattern=p[0].source:p.length>1&&(r.allOf=[...p.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},ls=(e,t,n,o)=>{n.type="boolean"},ps=(e,t,n,o)=>{n.not={}},fs=(e,t,n,o)=>{},hs=(e,t,n,o)=>{const r=e._zod.def,s=Xe(r.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},gs=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ms=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},_s=(e,t,n,o)=>{const r=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(r.minItems=i),typeof a=="number"&&(r.maxItems=a),r.type="array",r.items=T(s.element,t,{...o,path:[...o.path,"items"]})},ys=(e,t,n,o)=>{const r=n,s=e._zod.def;r.type="object",r.properties={};const i=s.shape;for(const u in i)r.properties[u]=T(i[u],t,{...o,path:[...o.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const p=s.shape[u]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));c.size>0&&(r.required=Array.from(c)),s.catchall?._zod.def.type==="never"?r.additionalProperties=!1:s.catchall?s.catchall&&(r.additionalProperties=T(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},vs=(e,t,n,o)=>{const r=e._zod.def,s=r.inclusive===!1,i=r.options.map((a,c)=>T(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},ws=(e,t,n,o)=>{const r=e._zod.def,s=T(r.left,t,{...o,path:[...o.path,"allOf",0]}),i=T(r.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},bs=(e,t,n,o)=>{const r=e._zod.def,s=T(r.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=r.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},ks=(e,t,n,o)=>{const r=e._zod.def;T(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType},zs=(e,t,n,o)=>{const r=e._zod.def;T(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},Ss=(e,t,n,o)=>{const r=e._zod.def;T(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},$s=(e,t,n,o)=>{const r=e._zod.def;T(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType;let i;try{i=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Ts=(e,t,n,o)=>{const r=e._zod.def,s=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;T(s,t,o);const i=t.seen.get(e);i.ref=s},Es=(e,t,n,o)=>{const r=e._zod.def;T(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType,n.readOnly=!0},Zt=(e,t,n,o)=>{const r=e._zod.def;T(r.innerType,t,o);const s=t.seen.get(e);s.ref=r.innerType},As=d("ZodISODateTime",(e,t)=>{Dr.init(e,t),z.init(e,t)});function Is(e){return Ui(As,e)}const Os=d("ZodISODate",(e,t)=>{Lr.init(e,t),z.init(e,t)});function Zs(e){return qi(Os,e)}const Cs=d("ZodISOTime",(e,t)=>{xr.init(e,t),z.init(e,t)});function Ps(e){return Fi(Cs,e)}const Rs=d("ZodISODuration",(e,t)=>{Ur.init(e,t),z.init(e,t)});function Ns(e){return Mi(Rs,e)}const O=d("ZodError",(e,t)=>{st.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Po(e,n)},flatten:{value:n=>Co(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,we,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,we,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),js=$e(O),Ds=Te(O),Ls=ie(O),xs=se(O),Us=jo(O),qs=Do(O),Fs=Lo(O),Ms=xo(O),Bs=Uo(O),Js=qo(O),Qs=Fo(O),Hs=Mo(O),$=d("ZodType",(e,t)=>(S.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:le(e,"input"),output:le(e,"output")}}),e.toJSONSchema=cs(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(D(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>L(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>js(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>Ls(e,n,o),e.parseAsync=async(n,o)=>Ds(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>xs(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>Us(e,n,o),e.decode=(n,o)=>qs(e,n,o),e.encodeAsync=async(n,o)=>Fs(e,n,o),e.decodeAsync=async(n,o)=>Ms(e,n,o),e.safeEncode=(n,o)=>Bs(e,n,o),e.safeDecode=(n,o)=>Js(e,n,o),e.safeEncodeAsync=async(n,o)=>Qs(e,n,o),e.safeDecodeAsync=async(n,o)=>Hs(e,n,o),e.refine=(n,o)=>e.check(La(n,o)),e.superRefine=n=>e.check(xa(n)),e.overwrite=n=>e.check(W(n)),e.optional=()=>Dt(e),e.exactOptional=()=>$a(e),e.nullable=()=>Lt(e),e.nullish=()=>Dt(Lt(e)),e.nonoptional=n=>Za(e,n),e.array=()=>Rt(e),e.or=n=>Nt([e,n]),e.and=n=>ba(e,n),e.transform=n=>Ut(e,za(n)),e.default=n=>Aa(e,n),e.prefault=n=>Oa(e,n),e.catch=n=>Pa(e,n),e.pipe=n=>Ut(e,n),e.readonly=()=>ja(e),e.describe=n=>{const o=e.clone();return X.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return X.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return X.get(e);const o=e.clone();return X.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ct=d("_ZodString",(e,t)=>{Ee.init(e,t),$.init(e,t),e._zod.processJSONSchema=(o,r,s)=>ds(e,o,r);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(Hi(...o)),e.includes=(...o)=>e.check(Gi(...o)),e.startsWith=(...o)=>e.check(Ki(...o)),e.endsWith=(...o)=>e.check(Yi(...o)),e.min=(...o)=>e.check(de(...o)),e.max=(...o)=>e.check(Tt(...o)),e.length=(...o)=>e.check(Et(...o)),e.nonempty=(...o)=>e.check(de(1,...o)),e.lowercase=o=>e.check(Wi(o)),e.uppercase=o=>e.check(Vi(o)),e.trim=()=>e.check(es()),e.normalize=(...o)=>e.check(Xi(...o)),e.toLowerCase=()=>e.check(ts()),e.toUpperCase=()=>e.check(ns()),e.slugify=()=>e.check(os())}),Ws=d("ZodString",(e,t)=>{Ee.init(e,t),Ct.init(e,t),e.email=n=>e.check(vi(Vs,n)),e.url=n=>e.check(Si(Gs,n)),e.jwt=n=>e.check(xi(la,n)),e.emoji=n=>e.check($i(Ks,n)),e.guid=n=>e.check($t(Pt,n)),e.uuid=n=>e.check(wi(pe,n)),e.uuidv4=n=>e.check(bi(pe,n)),e.uuidv6=n=>e.check(ki(pe,n)),e.uuidv7=n=>e.check(zi(pe,n)),e.nanoid=n=>e.check(Ti(Ys,n)),e.guid=n=>e.check($t(Pt,n)),e.cuid=n=>e.check(Ei(Xs,n)),e.cuid2=n=>e.check(Ai(ea,n)),e.ulid=n=>e.check(Ii(ta,n)),e.base64=n=>e.check(ji(ca,n)),e.base64url=n=>e.check(Di(ua,n)),e.xid=n=>e.check(Oi(na,n)),e.ksuid=n=>e.check(Zi(oa,n)),e.ipv4=n=>e.check(Ci(ra,n)),e.ipv6=n=>e.check(Pi(ia,n)),e.cidrv4=n=>e.check(Ri(sa,n)),e.cidrv6=n=>e.check(Ni(aa,n)),e.e164=n=>e.check(Li(da,n)),e.datetime=n=>e.check(Is(n)),e.date=n=>e.check(Zs(n)),e.time=n=>e.check(Ps(n)),e.duration=n=>e.check(Ns(n))});function B(e){return yi(Ws,e)}const z=d("ZodStringFormat",(e,t)=>{k.init(e,t),Ct.init(e,t)}),Vs=d("ZodEmail",(e,t)=>{Ar.init(e,t),z.init(e,t)}),Pt=d("ZodGUID",(e,t)=>{Tr.init(e,t),z.init(e,t)}),pe=d("ZodUUID",(e,t)=>{Er.init(e,t),z.init(e,t)}),Gs=d("ZodURL",(e,t)=>{Ir.init(e,t),z.init(e,t)}),Ks=d("ZodEmoji",(e,t)=>{Or.init(e,t),z.init(e,t)}),Ys=d("ZodNanoID",(e,t)=>{Zr.init(e,t),z.init(e,t)}),Xs=d("ZodCUID",(e,t)=>{Cr.init(e,t),z.init(e,t)}),ea=d("ZodCUID2",(e,t)=>{Pr.init(e,t),z.init(e,t)}),ta=d("ZodULID",(e,t)=>{Rr.init(e,t),z.init(e,t)}),na=d("ZodXID",(e,t)=>{Nr.init(e,t),z.init(e,t)}),oa=d("ZodKSUID",(e,t)=>{jr.init(e,t),z.init(e,t)}),ra=d("ZodIPv4",(e,t)=>{qr.init(e,t),z.init(e,t)}),ia=d("ZodIPv6",(e,t)=>{Fr.init(e,t),z.init(e,t)}),sa=d("ZodCIDRv4",(e,t)=>{Mr.init(e,t),z.init(e,t)}),aa=d("ZodCIDRv6",(e,t)=>{Br.init(e,t),z.init(e,t)}),ca=d("ZodBase64",(e,t)=>{Jr.init(e,t),z.init(e,t)}),ua=d("ZodBase64URL",(e,t)=>{Hr.init(e,t),z.init(e,t)}),da=d("ZodE164",(e,t)=>{Wr.init(e,t),z.init(e,t)}),la=d("ZodJWT",(e,t)=>{Gr.init(e,t),z.init(e,t)}),pa=d("ZodBoolean",(e,t)=>{Kr.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ls(e,n,o)});function fa(e){return Bi(pa,e)}const ha=d("ZodUnknown",(e,t)=>{Yr.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>fs()});function Ie(){return Ji(ha)}const ga=d("ZodNever",(e,t)=>{Xr.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ps(e,n,o)});function ma(e){return Qi(ga,e)}const _a=d("ZodArray",(e,t)=>{ei.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>_s(e,n,o,r),e.element=t.element,e.min=(n,o)=>e.check(de(n,o)),e.nonempty=n=>e.check(de(1,n)),e.max=(n,o)=>e.check(Tt(n,o)),e.length=(n,o)=>e.check(Et(n,o)),e.unwrap=()=>e.element});function Rt(e,t){return rs(_a,e,t)}const ya=d("ZodObject",(e,t)=>{ni.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ys(e,n,o,r),y(e,"shape",()=>t.shape),e.keyof=()=>Ze(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ie()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ie()}),e.strict=()=>e.clone({...e._zod.def,catchall:ma()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Eo(e,n),e.safeExtend=n=>Ao(e,n),e.merge=n=>Io(e,n),e.pick=n=>$o(e,n),e.omit=n=>To(e,n),e.partial=(...n)=>Oo(jt,e,n[0]),e.required=(...n)=>Zo(xt,e,n[0])});function ee(e,t){const n={type:"object",shape:e??{},...g(t)};return new ya(n)}const va=d("ZodUnion",(e,t)=>{oi.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>vs(e,n,o,r),e.options=t.options});function Nt(e,t){return new va({type:"union",options:e,...g(t)})}const wa=d("ZodIntersection",(e,t)=>{ri.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ws(e,n,o,r)});function ba(e,t){return new wa({type:"intersection",left:e,right:t})}const Oe=d("ZodEnum",(e,t)=>{ii.init(e,t),$.init(e,t),e._zod.processJSONSchema=(o,r,s)=>hs(e,o,r),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(o,r)=>{const s={};for(const i of o)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Oe({...t,checks:[],...g(r),entries:s})},e.exclude=(o,r)=>{const s={...t.entries};for(const i of o)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Oe({...t,checks:[],...g(r),entries:s})}});function Ze(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Oe({type:"enum",entries:n,...g(t)})}const ka=d("ZodTransform",(e,t)=>{si.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ms(e,n),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new Ke(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Y(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Y(i))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(s=>(n.value=s,n)):(n.value=r,n)}});function za(e){return new ka({type:"transform",transform:e})}const jt=d("ZodOptional",(e,t)=>{vt.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Zt(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Dt(e){return new jt({type:"optional",innerType:e})}const Sa=d("ZodExactOptional",(e,t)=>{ai.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Zt(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new Sa({type:"optional",innerType:e})}const Ta=d("ZodNullable",(e,t)=>{ci.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>bs(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Lt(e){return new Ta({type:"nullable",innerType:e})}const Ea=d("ZodDefault",(e,t)=>{ui.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>zs(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Aa(e,t){return new Ea({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ot(t)}})}const Ia=d("ZodPrefault",(e,t)=>{di.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ss(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Oa(e,t){return new Ia({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ot(t)}})}const xt=d("ZodNonOptional",(e,t)=>{li.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>ks(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function Za(e,t){return new xt({type:"nonoptional",innerType:e,...g(t)})}const Ca=d("ZodCatch",(e,t)=>{pi.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>$s(e,n,o,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pa(e,t){return new Ca({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ra=d("ZodPipe",(e,t)=>{fi.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Ts(e,n,o,r),e.in=t.in,e.out=t.out});function Ut(e,t){return new Ra({type:"pipe",in:e,out:t})}const Na=d("ZodReadonly",(e,t)=>{hi.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>Es(e,n,o,r),e.unwrap=()=>e._zod.def.innerType});function ja(e){return new Na({type:"readonly",innerType:e})}const Da=d("ZodCustom",(e,t)=>{gi.init(e,t),$.init(e,t),e._zod.processJSONSchema=(n,o,r)=>gs(e,n)});function La(e,t={}){return is(Da,e,t)}function xa(e){return ss(e)}const Ua=ee({title:B(),type:B(),payload:Ie().optional()}),qa=ee({label:B(),action:Ua,variant:Ze(["primary","outline","ghost"]).optional()}),Fa=ee({orientation:Ze(["horizontal","vertical"]).optional(),wrap:fa().optional()}),Ma=ee({placeholder:Nt([B(),Rt(B())]).optional(),ctaLabel:B().optional()}),Ba=ee({text:B()}),Ja={components:{ActionButton:{schema:qa,description:"A single clickable QNA action button."},ButtonRow:{schema:Fa,description:"Container for a group of QNA action buttons."},TextInput:{schema:Ma,description:"Free-text input with rotating placeholder and CTA button."},QuestionHeading:{schema:Ba,description:"A heading displayed above the QNA button group."}}};class qt extends hn{constructor(){super(...arguments),this._abortController=null,this._debounceTimer=null,this._contentEl=null,this._i18n=Ge,this._actionHandler=this._handleAction.bind(this),this._openChatHandler=this._handleOpenChat.bind(this)}async onInit(t){this._i18n=this._resolveI18n(t),this._contentEl=document.createElement("div"),this._contentEl.className="gengage-qna-container",this.root.appendChild(this._contentEl);const n=t.pageContext?.sku;n&&(this._lastSku=n,await this._fetchAndRender(n)),ho("qna")}onUpdate(t){const n=t.sku;!n||n===this._lastSku||(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=null,this._lastSku=n,this._fetchAndRender(n)},50))}onShow(){this._contentEl&&(this._contentEl.style.opacity="0",this._contentEl.style.transition="opacity 0.2s ease-in",requestAnimationFrame(()=>{this._contentEl&&(this._contentEl.style.opacity="1")}))}onHide(){}onDestroy(){this._abort(),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null),this._contentEl&&(this._cleanupTextInputTimers(),this._contentEl.remove(),this._contentEl=null)}_abort(){this._abortController?.abort(),this._abortController=null}_cleanupTextInputTimers(){if(!this._contentEl)return;const t=this._contentEl.querySelectorAll(".gengage-qna-input-wrapper");for(const n of t)n._cleanup?.()}async _fetchAndRender(t){if(this._abort(),this._abortController=new AbortController,!this._contentEl)return;this._cleanupTextInputTimers(),this._contentEl.innerHTML="";const n=this._createLoadingIndicator();this._contentEl.appendChild(n);const o={middlewareUrl:this.config.middlewareUrl},r=crypto.randomUUID(),s=Date.now();this.track(Jt(this.analyticsContext(),{endpoint:"launcher_action",request_id:r,widget:"qna"}));try{const i={account_id:this.config.accountId,session_id:this.config.session?.sessionId??"",correlation_id:this.config.session?.sessionId??"",sku:t,locale:this.config.locale??"tr"},a=this.config.pageContext?.pageType;a!==void 0&&(i.page_type=a);const c=await po(i,o,this._abortController.signal);if(this.track(Qt(this.analyticsContext(),{request_id:r,latency_ms:Date.now()-s,chunk_count:c.actions.length,widget:"qna"})),this.track(Vt(this.analyticsContext(),{message_count:c.actions.length,history_ref:r,redaction_level:"none",widget:"qna"})),!this._contentEl)return;if(this._contentEl.innerHTML="",!this._specIncludesType(c.uiSpecs,"QuestionHeading")&&this.config.showStaticQuestion&&this.config.staticQuestionText){const w=document.createElement("h3");w.className="gengage-qna-heading",w.textContent=this.config.staticQuestionText,this._contentEl.appendChild(w)}const p=this.config.inputPlaceholder;let h;if(p!==!0)h=p??this._i18n.defaultInputPlaceholder;else if(c.actions.length>0){const w=c.actions.filter(E=>E.type==="user_message"||E.title.includes("?")).map(E=>E.title);h=w.length>0?w:this._i18n.defaultInputPlaceholder}else h=this._i18n.defaultInputPlaceholder;const l={onAction:this._actionHandler,i18n:this._i18n};this.config.hideButtonRowCta||(l.onOpenChat=this._openChatHandler,this.config.ctaText!==void 0&&(l.ctaText=this.config.ctaText)),h!==void 0&&(l.inputPlaceholder=h);const f=this._buildFallbackActionsSpec(c.actions),m=(c.uiSpecs.length>0?c.uiSpecs:[f]).filter(w=>Object.keys(w.elements).length>0);for(const w of m){const E=this._renderUISpec(w,l);this._contentEl.appendChild(E)}m.length>0&&go("qna"),!this._specIncludesType(m,"TextInput")&&this._appendStandaloneInput(l,h)}catch(i){if(i instanceof DOMException&&i.name==="AbortError")return;if(fe("gengage:global:error",{source:"qna",code:"FETCH_ERROR",message:rn(this.config.locale)}),this.track(Ht(this.analyticsContext(),{request_id:r,error_code:"FETCH_ERROR",error_message:i instanceof Error?i.message:String(i),widget:"qna"})),this._contentEl){this._cleanupTextInputTimers(),this._contentEl.innerHTML="";const a=this.config.inputPlaceholder===!0?this._i18n.defaultInputPlaceholder:this.config.inputPlaceholder??this._i18n.defaultInputPlaceholder,c={onAction:this._actionHandler,i18n:this._i18n,onOpenChat:this._openChatHandler};this.config.ctaText!==void 0&&(c.ctaText=this.config.ctaText),this._appendStandaloneInput(c,a)}}}_createLoadingIndicator(){const t=document.createElement("div");t.className="gengage-qna-loading";for(let n=0;n<3;n++){const o=document.createElement("div");o.className="gengage-qna-loading-dot",t.appendChild(o)}return t}_resolveI18n(t){return{...wo(t.locale),...t.i18n}}_resolveUISpecRegistry(){const t=We();return Bt(t,this.config.renderer?.registry)}_renderUISpec(t,n){const o=this._resolveUISpecRegistry(),r=this.config.renderer?.unknownRenderer??ve,s=(c,u)=>Ve(c,u,o,r),i=this.config.renderer?.renderUISpec;return i?i(t,n,{registry:o,unknownRenderer:r,defaultRender:s}):s(t,n)}_specIncludesType(t,n){for(const o of t)for(const r of Object.values(o.elements))if(r.type===n)return!0;return!1}_buildFallbackActionsSpec(t){if(t.length===0)return{root:"root",elements:{}};const n={},o=[];for(let r=0;r<t.length;r++){const s=t[r],i=`action-${r}`;o.push(i),n[i]={type:"ActionButton",props:{label:s.title,action:{title:s.title,type:s.type,payload:s.payload}}}}return n.root={type:"ButtonRow",children:o},{root:"root",elements:n}}_appendStandaloneInput(t,n){if(!this._contentEl)return;const o={root:"root",elements:{root:{type:"TextInput",props:{placeholder:n}}}},r=this._renderUISpec(o,t);this._contentEl.appendChild(r)}_handleAction(t){mo(t.title,t.type),this.config.onActionSelected?.(t),fe("gengage:qna:action",t)}_handleOpenChat(){const t=this._contentEl?.querySelector(".gengage-qna-input");t&&t.focus(),this.config.onOpenChat?.(),fe("gengage:qna:open-chat",{})}}function Qa(){return new qt}x.GengageQNA=qt,x.createDefaultQnaUISpecRegistry=We,x.createQNAWidget=Qa,x.defaultQnaUnknownUISpecRenderer=ve,x.qnaCatalog=Ja,x.renderQnaUISpec=Ve,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})})(this.Gengage=this.Gengage||{});
86
- //# sourceMappingURL=qna.iife.js.map
85
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Sa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:wa(t,`input`,e.processors),output:wa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function J(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return J(r.element,n);if(r.type===`set`)return J(r.valueType,n);if(r.type===`lazy`)return J(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return J(r.innerType,n);if(r.type===`intersection`)return J(r.left,n)||J(r.right,n);if(r.type===`record`||r.type===`map`)return J(r.keyType,n)||J(r.valueType,n);if(r.type===`pipe`)return J(r.in,n)||J(r.out,n);if(r.type===`object`){for(let e in r.shape)if(J(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(J(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(J(e,n))return!0;return!!(r.rest&&J(r.rest,n))}return!1}var Ca=(e,t={})=>n=>{let r=ba({...n,processors:t});return q(e,r),xa(r,e),Sa(r,e)},wa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ba({...i??{},target:a,io:t,processors:n});return q(e,o),xa(o,e),Sa(o,e)},Ta={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ea=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ta[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Da=(e,t,n,r)=>{n.type=`boolean`},Oa=(e,t,n,r)=>{n.not={}},ka=(e,t,n,r)=>{let i=e._zod.def,a=Wt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Aa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ja=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ma=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=q(a.element,t,{...r,path:[...r.path,`items`]})},Na=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=q(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=q(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Pa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>q(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fa=(e,t,n,r)=>{let i=e._zod.def,a=q(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=q(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ia=(e,t,n,r)=>{let i=e._zod.def,a=q(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},La=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ra=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},za=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ba=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Va=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;q(a,t,r);let o=t.seen.get(e);o.ref=a},Ha=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ua=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wa=T(`ZodISODateTime`,(e,t)=>{kr.init(e,t),Q.init(e,t)});function Ga(e){return Yi(Wa,e)}var Ka=T(`ZodISODate`,(e,t)=>{Ar.init(e,t),Q.init(e,t)});function qa(e){return Xi(Ka,e)}var Ja=T(`ZodISOTime`,(e,t)=>{jr.init(e,t),Q.init(e,t)});function Ya(e){return Zi(Ja,e)}var Xa=T(`ZodISODuration`,(e,t)=>{Mr.init(e,t),Q.init(e,t)});function Za(e){return Qi(Xa,e)}var Qa=(e,t)=>{hn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>vn(e,t)},flatten:{value:t=>_n(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Gt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Gt,2)}},isEmpty:{get(){return e.issues.length===0}}})};T(`ZodError`,Qa);var Y=T(`ZodError`,Qa,{Parent:Error}),$a=yn(Y),eo=bn(Y),to=z(Y),no=B(Y),ro=Cn(Y),io=wn(Y),ao=Tn(Y),oo=En(Y),so=Dn(Y),co=On(Y),lo=kn(Y),uo=An(Y),X=T(`ZodType`,(e,t)=>(U.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:wa(e,`input`),output:wa(e,`output`)}}),e.toJSONSchema=Ca(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(A(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>N(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>$a(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>to(e,t,n),e.parseAsync=async(t,n)=>eo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>no(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ro(e,t,n),e.decode=(t,n)=>io(e,t,n),e.encodeAsync=async(t,n)=>ao(e,t,n),e.decodeAsync=async(t,n)=>oo(e,t,n),e.safeEncode=(t,n)=>so(e,t,n),e.safeDecode=(t,n)=>co(e,t,n),e.safeEncodeAsync=async(t,n)=>lo(e,t,n),e.safeDecodeAsync=async(t,n)=>uo(e,t,n),e.refine=(t,n)=>e.check(hs(t,n)),e.superRefine=t=>e.check(gs(t)),e.overwrite=t=>e.check(K(t)),e.optional=()=>Zo(e),e.exactOptional=()=>$o(e),e.nullable=()=>ts(e),e.nullish=()=>Zo(ts(e)),e.nonoptional=t=>ss(e,t),e.array=()=>Bo(e),e.or=t=>Uo([e,t]),e.and=t=>Go(e,t),e.transform=t=>ds(e,Yo(t)),e.default=t=>rs(e,t),e.prefault=t=>as(e,t),e.catch=t=>ls(e,t),e.pipe=t=>ds(e,t),e.readonly=()=>ps(e),e.describe=t=>{let n=e.clone();return G.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return G.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return G.get(e);let n=e.clone();return G.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),fo=T(`_ZodString`,(e,t)=>{_r.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(aa(...t)),e.includes=(...t)=>e.check(ca(...t)),e.startsWith=(...t)=>e.check(la(...t)),e.endsWith=(...t)=>e.check(ua(...t)),e.min=(...t)=>e.check(ra(...t)),e.max=(...t)=>e.check(na(...t)),e.length=(...t)=>e.check(ia(...t)),e.nonempty=(...t)=>e.check(ra(1,...t)),e.lowercase=t=>e.check(oa(t)),e.uppercase=t=>e.check(sa(t)),e.trim=()=>e.check(fa()),e.normalize=(...t)=>e.check(da(...t)),e.toLowerCase=()=>e.check(pa()),e.toUpperCase=()=>e.check(ma()),e.slugify=()=>e.check(ha())}),po=T(`ZodString`,(e,t)=>{_r.init(e,t),fo.init(e,t),e.email=t=>e.check(Di(mo,t)),e.url=t=>e.check(Ni(_o,t)),e.jwt=t=>e.check(Ji(Mo,t)),e.emoji=t=>e.check(Pi(vo,t)),e.guid=t=>e.check(Oi(ho,t)),e.uuid=t=>e.check(ki(go,t)),e.uuidv4=t=>e.check(Ai(go,t)),e.uuidv6=t=>e.check(ji(go,t)),e.uuidv7=t=>e.check(Mi(go,t)),e.nanoid=t=>e.check(Fi(yo,t)),e.guid=t=>e.check(Oi(ho,t)),e.cuid=t=>e.check(Ii(bo,t)),e.cuid2=t=>e.check(Li(xo,t)),e.ulid=t=>e.check(Ri(So,t)),e.base64=t=>e.check(Gi(ko,t)),e.base64url=t=>e.check(Ki(Ao,t)),e.xid=t=>e.check(zi(Co,t)),e.ksuid=t=>e.check(Bi(wo,t)),e.ipv4=t=>e.check(Vi(To,t)),e.ipv6=t=>e.check(Hi(Eo,t)),e.cidrv4=t=>e.check(Ui(Do,t)),e.cidrv6=t=>e.check(Wi(Oo,t)),e.e164=t=>e.check(qi(jo,t)),e.datetime=t=>e.check(Ga(t)),e.date=t=>e.check(qa(t)),e.time=t=>e.check(Ya(t)),e.duration=t=>e.check(Za(t))});function Z(e){return Ei(po,e)}var Q=T(`ZodStringFormat`,(e,t)=>{W.init(e,t),fo.init(e,t)}),mo=T(`ZodEmail`,(e,t)=>{br.init(e,t),Q.init(e,t)}),ho=T(`ZodGUID`,(e,t)=>{vr.init(e,t),Q.init(e,t)}),go=T(`ZodUUID`,(e,t)=>{yr.init(e,t),Q.init(e,t)}),_o=T(`ZodURL`,(e,t)=>{xr.init(e,t),Q.init(e,t)}),vo=T(`ZodEmoji`,(e,t)=>{Sr.init(e,t),Q.init(e,t)}),yo=T(`ZodNanoID`,(e,t)=>{Cr.init(e,t),Q.init(e,t)}),bo=T(`ZodCUID`,(e,t)=>{wr.init(e,t),Q.init(e,t)}),xo=T(`ZodCUID2`,(e,t)=>{Tr.init(e,t),Q.init(e,t)}),So=T(`ZodULID`,(e,t)=>{Er.init(e,t),Q.init(e,t)}),Co=T(`ZodXID`,(e,t)=>{Dr.init(e,t),Q.init(e,t)}),wo=T(`ZodKSUID`,(e,t)=>{Or.init(e,t),Q.init(e,t)}),To=T(`ZodIPv4`,(e,t)=>{Nr.init(e,t),Q.init(e,t)}),Eo=T(`ZodIPv6`,(e,t)=>{Pr.init(e,t),Q.init(e,t)}),Do=T(`ZodCIDRv4`,(e,t)=>{Fr.init(e,t),Q.init(e,t)}),Oo=T(`ZodCIDRv6`,(e,t)=>{Ir.init(e,t),Q.init(e,t)}),ko=T(`ZodBase64`,(e,t)=>{Rr.init(e,t),Q.init(e,t)}),Ao=T(`ZodBase64URL`,(e,t)=>{Br.init(e,t),Q.init(e,t)}),jo=T(`ZodE164`,(e,t)=>{Vr.init(e,t),Q.init(e,t)}),Mo=T(`ZodJWT`,(e,t)=>{Ur.init(e,t),Q.init(e,t)}),No=T(`ZodBoolean`,(e,t)=>{Wr.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function Po(e){return $i(No,e)}var Fo=T(`ZodUnknown`,(e,t)=>{Gr.init(e,t),X.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Io(){return ea(Fo)}var Lo=T(`ZodNever`,(e,t)=>{Kr.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r)});function Ro(e){return ta(Lo,e)}var zo=T(`ZodArray`,(e,t)=>{Jr.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(ra(t,n)),e.nonempty=t=>e.check(ra(1,t)),e.max=(t,n)=>e.check(na(t,n)),e.length=(t,n)=>e.check(ia(t,n)),e.unwrap=()=>e.element});function Bo(e,t){return ga(zo,e,t)}var Vo=T(`ZodObject`,(e,t)=>{$r.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),O(e,`shape`,()=>t.shape),e.keyof=()=>qo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Io()}),e.loose=()=>e.clone({...e._zod.def,catchall:Io()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ro()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>sn(e,t),e.safeExtend=t=>cn(e,t),e.merge=t=>ln(e,t),e.pick=t=>an(e,t),e.omit=t=>on(e,t),e.partial=(...t)=>un(Xo,e,t[0]),e.required=(...t)=>dn(os,e,t[0])});function $(e,t){return new Vo({type:`object`,shape:e??{},...P(t)})}var Ho=T(`ZodUnion`,(e,t)=>{ti.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),e.options=t.options});function Uo(e,t){return new Ho({type:`union`,options:e,...P(t)})}var Wo=T(`ZodIntersection`,(e,t)=>{ni.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r)});function Go(e,t){return new Wo({type:`intersection`,left:e,right:t})}var Ko=T(`ZodEnum`,(e,t)=>{ai.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ko({...t,checks:[],...P(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ko({...t,checks:[],...P(r),entries:i})}});function qo(e,t){return new Ko({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var Jo=T(`ZodTransform`,(e,t)=>{oi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ht(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(R(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(R(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Yo(e){return new Jo({type:`transform`,transform:e})}var Xo=T(`ZodOptional`,(e,t)=>{ci.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zo(e){return new Xo({type:`optional`,innerType:e})}var Qo=T(`ZodExactOptional`,(e,t)=>{li.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new Qo({type:`optional`,innerType:e})}var es=T(`ZodNullable`,(e,t)=>{ui.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ts(e){return new es({type:`nullable`,innerType:e})}var ns=T(`ZodDefault`,(e,t)=>{di.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rs(e,t){return new ns({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():tn(t)}})}var is=T(`ZodPrefault`,(e,t)=>{pi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function as(e,t){return new is({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():tn(t)}})}var os=T(`ZodNonOptional`,(e,t)=>{mi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ss(e,t){return new os({type:`nonoptional`,innerType:e,...P(t)})}var cs=T(`ZodCatch`,(e,t)=>{gi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ls(e,t){return new cs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var us=T(`ZodPipe`,(e,t)=>{_i.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.in=t.in,e.out=t.out});function ds(e,t){return new us({type:`pipe`,in:e,out:t})}var fs=T(`ZodReadonly`,(e,t)=>{yi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ps(e){return new fs({type:`readonly`,innerType:e})}var ms=T(`ZodCustom`,(e,t)=>{xi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r)});function hs(e,t={}){return _a(ms,e,t)}function gs(e){return va(e)}var _s=$({title:Z(),type:Z(),payload:Io().optional()}),vs=$({label:Z(),action:_s,variant:qo([`primary`,`outline`,`ghost`]).optional()}),ys=$({orientation:qo([`horizontal`,`vertical`]).optional(),wrap:Po().optional()}),bs=$({placeholder:Uo([Z(),Bo(Z())]).optional(),ctaLabel:Z().optional()}),xs=$({text:Z()}),Ss={components:{ActionButton:{schema:vs,description:`A single clickable QNA action button.`},ButtonRow:{schema:ys,description:`Container for a group of QNA action buttons.`},TextInput:{schema:bs,description:`Free-text input with rotating placeholder and CTA button.`},QuestionHeading:{schema:xs,description:`A heading displayed above the QNA button group.`}}},Cs=class extends _e{constructor(...e){super(...e),this._abortController=null,this._debounceTimer=null,this._contentEl=null,this._i18n=Rt,this._actionHandler=this._handleAction.bind(this),this._openChatHandler=this._handleOpenChat.bind(this)}async onInit(e){this._i18n=this._resolveI18n(e),this._contentEl=document.createElement(`div`),this._contentEl.className=`gengage-qna-container`,this.root.appendChild(this._contentEl);let t=e.pageContext?.sku;t&&(this._lastSku=t,await this._fetchAndRender(t)),Dt(`qna`)}onUpdate(e){let t=e.sku;!t||t===this._lastSku||(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=null,this._lastSku=t,this._fetchAndRender(t)},50))}onShow(){this._contentEl&&(this._contentEl.style.opacity=`0`,this._contentEl.style.transition=`opacity 0.2s ease-in`,requestAnimationFrame(()=>{this._contentEl&&(this._contentEl.style.opacity=`1`)}))}onHide(){}onDestroy(){this._abort(),this._debounceTimer&&=(clearTimeout(this._debounceTimer),null),this._contentEl&&=(this._cleanupTextInputTimers(),this._contentEl.remove(),null)}_abort(){this._abortController?.abort(),this._abortController=null}_cleanupTextInputTimers(){if(!this._contentEl)return;let e=this._contentEl.querySelectorAll(`.gengage-qna-input-wrapper`);for(let t of e)t._cleanup?.()}async _fetchAndRender(e){if(this._abort(),this._abortController=new AbortController,!this._contentEl)return;this._cleanupTextInputTimers(),this._contentEl.innerHTML=``;let t=this._createLoadingIndicator();this._contentEl.appendChild(t);let n={middlewareUrl:this.config.middlewareUrl},r=crypto.randomUUID(),s=Date.now();this.track(i(this.analyticsContext(),{endpoint:`launcher_action`,request_id:r,widget:`qna`}));try{let t={account_id:this.config.accountId,session_id:this.config.session?.sessionId??``,correlation_id:this.config.session?.sessionId??``,sku:e,locale:this.config.locale??`tr`},i=this.config.pageContext?.pageType;i!==void 0&&(t.page_type=i);let o=await wt(t,n,this._abortController.signal);if(this.track(a(this.analyticsContext(),{request_id:r,latency_ms:Date.now()-s,chunk_count:o.actions.length,widget:`qna`})),this.track(c(this.analyticsContext(),{message_count:o.actions.length,history_ref:r,redaction_level:`none`,widget:`qna`})),!this._contentEl)return;if(this._contentEl.innerHTML=``,!this._specIncludesType(o.uiSpecs,`QuestionHeading`)&&this.config.showStaticQuestion&&this.config.staticQuestionText){let e=document.createElement(`h3`);e.className=`gengage-qna-heading`,e.textContent=this.config.staticQuestionText,this._contentEl.appendChild(e)}let l=this.config.inputPlaceholder,u;if(l!==!0)u=l??this._i18n.defaultInputPlaceholder;else if(o.actions.length>0){let e=o.actions.filter(e=>e.type===`user_message`||e.title.includes(`?`)).map(e=>e.title);u=e.length>0?e:this._i18n.defaultInputPlaceholder}else u=this._i18n.defaultInputPlaceholder;let d={onAction:this._actionHandler,i18n:this._i18n};this.config.hideButtonRowCta||(d.onOpenChat=this._openChatHandler,this.config.ctaText!==void 0&&(d.ctaText=this.config.ctaText)),u!==void 0&&(d.inputPlaceholder=u);let f=this._buildFallbackActionsSpec(o.actions),p=(o.uiSpecs.length>0?o.uiSpecs:[f]).filter(e=>Object.keys(e.elements).length>0);for(let e of p){let t=this._renderUISpec(e,d);this._contentEl.appendChild(t)}p.length>0&&Ot(`qna`),this._specIncludesType(p,`TextInput`)||this._appendStandaloneInput(d,u)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;if(d(`gengage:global:error`,{source:`qna`,code:`FETCH_ERROR`,message:se(this.config.locale)}),this.track(o(this.analyticsContext(),{request_id:r,error_code:`FETCH_ERROR`,error_message:e instanceof Error?e.message:String(e),widget:`qna`})),this._contentEl){this._cleanupTextInputTimers(),this._contentEl.innerHTML=``;let e=this.config.inputPlaceholder===!0?this._i18n.defaultInputPlaceholder:this.config.inputPlaceholder??this._i18n.defaultInputPlaceholder,t={onAction:this._actionHandler,i18n:this._i18n,onOpenChat:this._openChatHandler};this.config.ctaText!==void 0&&(t.ctaText=this.config.ctaText),this._appendStandaloneInput(t,e)}}}_createLoadingIndicator(){let e=document.createElement(`div`);e.className=`gengage-qna-loading`;for(let t=0;t<3;t++){let t=document.createElement(`div`);t.className=`gengage-qna-loading-dot`,e.appendChild(t)}return e}_resolveI18n(e){return{...Vt(e.locale),...e.i18n}}_resolveUISpecRegistry(){return r(It(),this.config.renderer?.registry)}_renderUISpec(e,t){let n=this._resolveUISpecRegistry(),r=this.config.renderer?.unknownRenderer??Ft,i=(e,t)=>Lt(e,t,n,r),a=this.config.renderer?.renderUISpec;return a?a(e,t,{registry:n,unknownRenderer:r,defaultRender:i}):i(e,t)}_specIncludesType(e,t){for(let n of e)for(let e of Object.values(n.elements))if(e.type===t)return!0;return!1}_buildFallbackActionsSpec(e){if(e.length===0)return{root:`root`,elements:{}};let t={},n=[];for(let r=0;r<e.length;r++){let i=e[r],a=`action-${r}`;n.push(a),t[a]={type:`ActionButton`,props:{label:i.title,action:{title:i.title,type:i.type,payload:i.payload}}}}return t.root={type:`ButtonRow`,children:n},{root:`root`,elements:t}}_appendStandaloneInput(e,t){if(!this._contentEl)return;let n={root:`root`,elements:{root:{type:`TextInput`,props:{placeholder:t}}}},r=this._renderUISpec(n,e);this._contentEl.appendChild(r)}_handleAction(e){kt(e.title,e.type),this.config.onActionSelected?.(e),d(`gengage:qna:action`,e)}_handleOpenChat(){let e=this._contentEl?.querySelector(`.gengage-qna-input`);e&&e.focus(),this.config.onOpenChat?.(),d(`gengage:qna:open-chat`,{})}};function ws(){return new Cs}e.GengageQNA=Cs,e.createDefaultQnaUISpecRegistry=It,e.createQNAWidget=ws,e.defaultQnaUnknownUISpecRenderer=Ft,e.qnaCatalog=Ss,e.renderQnaUISpec=Lt})(this.Gengage=this.Gengage||{});
86
+ //# sourceMappingURL=qna.iife.js.map