@gengage/assistant-fe 0.6.18 → 0.6.19

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 (41) hide show
  1. package/dist/account-config-D_EMuR0g.js +1479 -0
  2. package/dist/agentic/context/context-store.d.ts +2 -1
  3. package/dist/agentic/index.d.ts +0 -1
  4. package/dist/agentic/index.js +155 -181
  5. package/dist/agentic/types.d.ts +6 -1
  6. package/dist/agentic/worker.d.ts +0 -2
  7. package/dist/agentic/worker.js +117 -415
  8. package/dist/agentic.iife.js +6 -6
  9. package/dist/{api-paths-CEDR4rld.js → api-paths-lIioK7-S.js} +1 -1
  10. package/dist/chat/components/InlineLauncher.d.ts +1 -1
  11. package/dist/chat-runtime.js +1 -1
  12. package/dist/chat.iife.js +1 -1
  13. package/dist/chat.js +1 -1
  14. package/dist/{common-BBgWfT-W.js → common-8WOyaL9-.js} +1 -1
  15. package/dist/common.js +5 -5
  16. package/dist/{connection-warning-B-doodzu.js → connection-warning-CBR0CWsY.js} +1 -1
  17. package/dist/{fastIntent-CloHPZQh.js → fastIntent-Dw79pmRK.js} +1 -1
  18. package/dist/index.js +10 -10
  19. package/dist/native.iife.js +1 -1
  20. package/dist/qna-runtime.js +1 -1
  21. package/dist/qna.iife.js +1 -1
  22. package/dist/qna.js +1 -1
  23. package/dist/{runtime-Ctqq0V6G.js → runtime-BsnZ6gt2.js} +3 -3
  24. package/dist/{runtime-BGCNkU1H.js → runtime-D5Sj-_tA.js} +3 -3
  25. package/dist/{runtime-CbWCU424.js → runtime-w0f2VkzL.js} +3 -3
  26. package/dist/{simbut-Dh4cJysK.js → simbut-BvdJtzCu.js} +1 -1
  27. package/dist/simbut.iife.js +1 -1
  28. package/dist/simbut.js +1 -1
  29. package/dist/{simrel-B-sjHbL5.js → simrel-DU6a27g9.js} +1 -1
  30. package/dist/simrel-runtime.js +1 -1
  31. package/dist/simrel.iife.js +1 -1
  32. package/dist/simrel.js +2 -2
  33. package/dist/{widget-base-CIJT5AiP.js → widget-base-BeWuIxD6.js} +1 -1
  34. package/package.json +4 -2
  35. package/dist/account-config-gj7_mF6Q.js +0 -1731
  36. package/dist/agentic/recipes/catalog-assistant-flow.d.ts +0 -50
  37. package/dist/agentic/recipes/input-text/actions.d.ts +0 -15
  38. package/dist/agentic/recipes/input-text/index.d.ts +0 -4
  39. package/dist/agentic/recipes/input-text/products.d.ts +0 -4
  40. package/dist/agentic/recipes/input-text/ranking.d.ts +0 -14
  41. package/dist/agentic/recipes/input-text/steps.d.ts +0 -31
@@ -44,7 +44,7 @@
44
44
  transform: translateY(0);
45
45
  }
46
46
  }
47
- `,document.head.appendChild(t)}var ze,ma,At,On,qn,jn,$n,fa,Oe,Vn,it=L((()=>{Ke(),As(),ze="gengage-global-toast-root",ma="gengage-global-toast-style",At="gengage-global-toast-root--visible",On=4200,qn=1500,jn=15e3,$n=["--gengage-font-family","--surface-card","--text-primary","--text-muted","--border-default","--radius-card","--shadow-3","--error","--ds-toast-error-bg","--ds-toast-error-border","--ds-toast-error-accent","--ds-toast-error-fg","--ds-toast-error-shadow"],fa=!1,Oe=null,Vn=[/failed to fetch/i,/networkerror/i,/network request failed/i,/load failed/i,/err_network/i,/fetch failed/i,/network error/i]}));function zs(){if(rt!==null)return rt;try{rt=localStorage.getItem("gengage:debug")==="1"}catch{rt=!1}return rt}function Be(t,e,a){if(!zs())return;const n=[`[gengage:${t}]`,e];a!==void 0&&n.push(a),console.debug(...n)}var rt,ot=L((()=>{rt=null}));function Hs(){if(typeof window>"u")return;const t=window;t.__gengageSdkRuntimeInfoLogged||(t.__gengageSdkRuntimeInfoLogged=!0,console.info(`[gengage] @gengage/assistant-fe v${Gn} (${Wn})`))}var Gn,Wn,Fs=L((()=>{Gn=("0.6.18".trim(),"0.6.18".trim()),Wn=("iife-build".trim(),"iife-build".trim())}));function Ds(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}var pt,Lt=L((()=>{Ke(),Tn(),Ts(),it(),ot(),Fs(),pt=class{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 e=Ps(t.theme);Hs(),this.config={...t,theme:e,session:Pn(t.session)},this.root=this._resolveMount(t.mountTarget),this._applyTheme(e),Ls();const a=Tt("gengage:context:update",n=>this.update(n));this._cleanups.push(a),Be("lifecycle",`${this.constructor.name}.init`,{accountId:t.accountId,sku:t.pageContext?.sku});try{await this.onInit(this.config)}catch(n){throw this.destroy(),n}this._destroying||(this.isInitialised=!0,Be("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._cleanupRoot(),this.isInitialised=!1)}_cleanupRoot(){this._ownsRoot?this.root.remove():this.root.innerHTML=""}on(t,e){return this._handlers.has(t)||this._handlers.set(t,new Set),this._handlers.get(t).add(e),()=>this._handlers.get(t)?.delete(e)}emit(t,...e){this._handlers.get(t)?.forEach(a=>a(...e))}addCleanup(t){this._cleanups.push(t)}_resolveMount(t){if(t instanceof HTMLElement)return t;if(typeof t=="string"){const a=document.querySelector(t);if(!a)throw new Error(`[gengage] Mount target not found: "${t}"`);return a}const e=document.createElement("div");return e.dataset.gengageWidget=this.constructor.name.toLowerCase(),document.body.insertBefore(e,document.body.firstChild),this._ownsRoot=!0,e}_applyTheme(t){if(t){for(const[e,a]of Object.entries(t))if(a!==void 0){const n=e.startsWith("--")?e:`--gengage-${Ds(e)}`;this.root.style.setProperty(n,a)}}}}}));function Kn(){const t=Date.now(),e=new Uint8Array(16);crypto.getRandomValues(e),e[0]=t/2**40&255,e[1]=t/2**32&255,e[2]=t/2**24&255,e[3]=t/2**16&255,e[4]=t/2**8&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128;const a=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}var Us=L((()=>{}));function Os(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.gengage=="string"&&typeof e.type=="string"}function qs(){try{return typeof process<"u"&&process.env.NODE_ENV!=="production"}catch{return!1}}var Yn,js=L((()=>{Yn=class{constructor(t){this._handlers=new Map,this._destroyed=!1,this._namespace=t.namespace,this._allowedOrigins=t.allowedOrigins??[location.origin],this._onMessage=t.onMessage,this._allowedOrigins.includes("*")&&qs()&&console.warn("[gengage] postMessage bridge using wildcard origin. Set allowedOrigins for production security."),this._messageListener=e=>this._handlePostMessage(e),window.addEventListener("message",this._messageListener)}send(t,e){if(this._destroyed)return;const a={namespace:this._namespace,type:t};e!==void 0&&(a.payload=e),window.dispatchEvent(new CustomEvent("gengage:bridge:message",{detail:a,bubbles:!1}))}on(t,e){this._handlers.has(t)||this._handlers.set(t,new Set);const a=this._handlers.get(t);return a.add(e),()=>{a.delete(e),a.size===0&&this._handlers.delete(t)}}destroy(){this._destroyed||(this._destroyed=!0,window.removeEventListener("message",this._messageListener),this._handlers.clear())}_handlePostMessage(t){if(this._destroyed||!this._isOriginAllowed(t.origin))return;const e=t.data;if(!Os(e)||e.gengage!==this._namespace)return;const a={type:e.type};e.payload!==void 0&&(a.payload=e.payload),this._onMessage?.(a);const n=this._handlers.get(a.type);if(n)for(const i of n)i(a.payload)}_isOriginAllowed(t){return this._allowedOrigins.includes("*")?!0:this._allowedOrigins.includes(t)}}}));function Qn(t,e){if(typeof window>"u"||!pe(t))return!1;const a=new CustomEvent("gengage:navigate",{detail:e===void 0?{url:t}:{url:t,newTab:e},cancelable:!0});return window.dispatchEvent(a)?(e?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t,!0):!1}var Zn=L((()=>{ge()}));function $s(t,e,a={}){const n=t.action,i=a.logger??Xn;switch(Be("action",`routing action: ${n.kind}`,n),n.kind){case"open_chat":e.openChat?.(n.payload);return;case"navigate":{if(typeof n.url!="string"){st(n,e,a,i);return}if(!pe(n.url)){i.warn("[gengage] Blocked navigation to unsafe URL:",n.url);return}const r=typeof n.newTab=="boolean"?n.newTab:void 0;if(e.navigate){e.navigate({url:n.url,...r!==void 0&&{newTab:r}});return}(a.defaultNavigate??Vs)(n.url,r);return}case"save_session":if(typeof n.sessionId!="string"||typeof n.sku!="string"){st(n,e,a,i);return}e.saveSession?.({sessionId:n.sessionId,sku:n.sku});return;case"add_to_cart":if(typeof n.sku!="string"||typeof n.quantity!="number"||typeof n.cartCode!="string"){st(n,e,a,i);return}e.addToCart?.({sku:n.sku,quantity:n.quantity,cartCode:n.cartCode});return;case"script_call":{if(a.allowScriptCall===!1){st(n,e,a,i);return}if(typeof n.name!="string"){st(n,e,a,i);return}const r=Gs(n.payload)?n.payload:void 0;e.scriptCall?.({name:n.name,...r!==void 0&&{payload:r}});return}default:st(n,e,a,i)}}function st(t,e,a,n){const i=a.unknownActionPolicy??"log-and-ignore";if(i==="delegate"){e.unknown?.(t),e.unknown||n.warn("[gengage] Unknown action received without delegate handler",t);return}if(i==="throw")throw new Error(`[gengage] Unknown action kind: ${t.kind}`);n.warn("[gengage] Unknown action ignored",t)}function Vs(t,e){if(!(typeof window>"u")){if(!pe(t)){console.warn("[gengage] Blocked navigation to unsafe URL:",t);return}Qn(t,e)}}function Gs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Xn,Ws=L((()=>{ge(),ot(),Zn(),Xn=console}));function He(t){const e=t?.trim();return e||"tr"}var ht=L((()=>{}));function ve(t){const e=globalThis.CSS?.escape;if(typeof e=="function")return e(t);const a=Array.from(t);return a.map((n,i)=>{const r=n.codePointAt(0);return r===void 0?"":r===0?"�":r>=1&&r<=31||r===127||i===0&&r>=48&&r<=57||i===1&&a[0]==="-"&&r>=48&&r<=57?`\\${r.toString(16)} `:i===0&&n==="-"&&a.length===1?"\\-":r>=128||/[A-Za-z0-9_-]/.test(n)?n:`\\${n}`}).join("")}var It=L((()=>{}));function Ks(t){return Jn.includes(t.type)?t.size>5242880?{ok:!1,reason:"too_large"}:{ok:!0}:{ok:!1,reason:"invalid_type"}}var Jn,Ys,Qs=L((()=>{Jn=["image/jpeg","image/png","image/webp"],Ys=5*1024*1024}));function ei(t){return typeof t=="object"&&t!==null&&typeof t.type=="string"}function Zs(t){const e=[];let a=0,n=!1,i=!1,r=0;for(let o=0;o<t.length;o++){const s=t[o];if(i){i=!1;continue}if(s==="\\"&&n){i=!0;continue}if(s==='"'){n=!n;continue}n||(s==="{"&&a++,s==="}"&&(a--,a===0&&(e.push(t.slice(r,o+1)),r=o+1)))}return e.length>0?e:[t]}function ti(t,e){const a=t.trim();if(!a||a.startsWith(":"))return!1;const n=a.startsWith("data: ")?a.slice(6):a;if(n==="[DONE]")return e.onDone?.(),!0;try{const i=JSON.parse(n);return ei(i)?(Be("stream",`event: ${i.type}`,i),e.onEvent(i),i.type==="done"?(e.onDone?.(),!0):!1):!1}catch{const i=Zs(n);if(i.length>1){for(const r of i)try{const o=JSON.parse(r);if(!ei(o))continue;if(e.onEvent(o),o.type==="done")return e.onDone?.(),!0}catch{}return!1}return!1}}async function Nt(t,e){if(!t.ok){e.onError?.(new Error(`HTTP ${t.status}: ${t.statusText}`));return}if(!t.body){e.onError?.(new Error("Response body is null — streaming not supported"));return}const a=t.body.getReader(),n=new TextDecoder("utf-8");let i="";const r=e.idleTimeoutMs??6e4,o=Symbol("idle-timeout");let s=!1;try{for(;;){const c=a.read();let l;const d=await(r>0?Promise.race([c.then(b=>(clearTimeout(l),b)),new Promise(b=>{l=setTimeout(()=>b(o),r)})]):c);if(d===o){s=!0,await a.cancel();break}const{done:g,value:h}=d;if(g)break;i+=n.decode(h,{stream:!0});const f=i.split(`
47
+ `,document.head.appendChild(t)}var ze,ma,At,On,qn,jn,$n,fa,Oe,Vn,it=L((()=>{Ke(),As(),ze="gengage-global-toast-root",ma="gengage-global-toast-style",At="gengage-global-toast-root--visible",On=4200,qn=1500,jn=15e3,$n=["--gengage-font-family","--surface-card","--text-primary","--text-muted","--border-default","--radius-card","--shadow-3","--error","--ds-toast-error-bg","--ds-toast-error-border","--ds-toast-error-accent","--ds-toast-error-fg","--ds-toast-error-shadow"],fa=!1,Oe=null,Vn=[/failed to fetch/i,/networkerror/i,/network request failed/i,/load failed/i,/err_network/i,/fetch failed/i,/network error/i]}));function zs(){if(rt!==null)return rt;try{rt=localStorage.getItem("gengage:debug")==="1"}catch{rt=!1}return rt}function Be(t,e,a){if(!zs())return;const n=[`[gengage:${t}]`,e];a!==void 0&&n.push(a),console.debug(...n)}var rt,ot=L((()=>{rt=null}));function Hs(){if(typeof window>"u")return;const t=window;t.__gengageSdkRuntimeInfoLogged||(t.__gengageSdkRuntimeInfoLogged=!0,console.info(`[gengage] @gengage/assistant-fe v${Gn} (${Wn})`))}var Gn,Wn,Fs=L((()=>{Gn=("0.6.19".trim(),"0.6.19".trim()),Wn=("iife-build".trim(),"iife-build".trim())}));function Ds(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}var pt,Lt=L((()=>{Ke(),Tn(),Ts(),it(),ot(),Fs(),pt=class{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 e=Ps(t.theme);Hs(),this.config={...t,theme:e,session:Pn(t.session)},this.root=this._resolveMount(t.mountTarget),this._applyTheme(e),Ls();const a=Tt("gengage:context:update",n=>this.update(n));this._cleanups.push(a),Be("lifecycle",`${this.constructor.name}.init`,{accountId:t.accountId,sku:t.pageContext?.sku});try{await this.onInit(this.config)}catch(n){throw this.destroy(),n}this._destroying||(this.isInitialised=!0,Be("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._cleanupRoot(),this.isInitialised=!1)}_cleanupRoot(){this._ownsRoot?this.root.remove():this.root.innerHTML=""}on(t,e){return this._handlers.has(t)||this._handlers.set(t,new Set),this._handlers.get(t).add(e),()=>this._handlers.get(t)?.delete(e)}emit(t,...e){this._handlers.get(t)?.forEach(a=>a(...e))}addCleanup(t){this._cleanups.push(t)}_resolveMount(t){if(t instanceof HTMLElement)return t;if(typeof t=="string"){const a=document.querySelector(t);if(!a)throw new Error(`[gengage] Mount target not found: "${t}"`);return a}const e=document.createElement("div");return e.dataset.gengageWidget=this.constructor.name.toLowerCase(),document.body.insertBefore(e,document.body.firstChild),this._ownsRoot=!0,e}_applyTheme(t){if(t){for(const[e,a]of Object.entries(t))if(a!==void 0){const n=e.startsWith("--")?e:`--gengage-${Ds(e)}`;this.root.style.setProperty(n,a)}}}}}));function Kn(){const t=Date.now(),e=new Uint8Array(16);crypto.getRandomValues(e),e[0]=t/2**40&255,e[1]=t/2**32&255,e[2]=t/2**24&255,e[3]=t/2**16&255,e[4]=t/2**8&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128;const a=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}var Us=L((()=>{}));function Os(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.gengage=="string"&&typeof e.type=="string"}function qs(){try{return typeof process<"u"&&process.env.NODE_ENV!=="production"}catch{return!1}}var Yn,js=L((()=>{Yn=class{constructor(t){this._handlers=new Map,this._destroyed=!1,this._namespace=t.namespace,this._allowedOrigins=t.allowedOrigins??[location.origin],this._onMessage=t.onMessage,this._allowedOrigins.includes("*")&&qs()&&console.warn("[gengage] postMessage bridge using wildcard origin. Set allowedOrigins for production security."),this._messageListener=e=>this._handlePostMessage(e),window.addEventListener("message",this._messageListener)}send(t,e){if(this._destroyed)return;const a={namespace:this._namespace,type:t};e!==void 0&&(a.payload=e),window.dispatchEvent(new CustomEvent("gengage:bridge:message",{detail:a,bubbles:!1}))}on(t,e){this._handlers.has(t)||this._handlers.set(t,new Set);const a=this._handlers.get(t);return a.add(e),()=>{a.delete(e),a.size===0&&this._handlers.delete(t)}}destroy(){this._destroyed||(this._destroyed=!0,window.removeEventListener("message",this._messageListener),this._handlers.clear())}_handlePostMessage(t){if(this._destroyed||!this._isOriginAllowed(t.origin))return;const e=t.data;if(!Os(e)||e.gengage!==this._namespace)return;const a={type:e.type};e.payload!==void 0&&(a.payload=e.payload),this._onMessage?.(a);const n=this._handlers.get(a.type);if(n)for(const i of n)i(a.payload)}_isOriginAllowed(t){return this._allowedOrigins.includes("*")?!0:this._allowedOrigins.includes(t)}}}));function Qn(t,e){if(typeof window>"u"||!pe(t))return!1;const a=new CustomEvent("gengage:navigate",{detail:e===void 0?{url:t}:{url:t,newTab:e},cancelable:!0});return window.dispatchEvent(a)?(e?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t,!0):!1}var Zn=L((()=>{ge()}));function $s(t,e,a={}){const n=t.action,i=a.logger??Xn;switch(Be("action",`routing action: ${n.kind}`,n),n.kind){case"open_chat":e.openChat?.(n.payload);return;case"navigate":{if(typeof n.url!="string"){st(n,e,a,i);return}if(!pe(n.url)){i.warn("[gengage] Blocked navigation to unsafe URL:",n.url);return}const r=typeof n.newTab=="boolean"?n.newTab:void 0;if(e.navigate){e.navigate({url:n.url,...r!==void 0&&{newTab:r}});return}(a.defaultNavigate??Vs)(n.url,r);return}case"save_session":if(typeof n.sessionId!="string"||typeof n.sku!="string"){st(n,e,a,i);return}e.saveSession?.({sessionId:n.sessionId,sku:n.sku});return;case"add_to_cart":if(typeof n.sku!="string"||typeof n.quantity!="number"||typeof n.cartCode!="string"){st(n,e,a,i);return}e.addToCart?.({sku:n.sku,quantity:n.quantity,cartCode:n.cartCode});return;case"script_call":{if(a.allowScriptCall===!1){st(n,e,a,i);return}if(typeof n.name!="string"){st(n,e,a,i);return}const r=Gs(n.payload)?n.payload:void 0;e.scriptCall?.({name:n.name,...r!==void 0&&{payload:r}});return}default:st(n,e,a,i)}}function st(t,e,a,n){const i=a.unknownActionPolicy??"log-and-ignore";if(i==="delegate"){e.unknown?.(t),e.unknown||n.warn("[gengage] Unknown action received without delegate handler",t);return}if(i==="throw")throw new Error(`[gengage] Unknown action kind: ${t.kind}`);n.warn("[gengage] Unknown action ignored",t)}function Vs(t,e){if(!(typeof window>"u")){if(!pe(t)){console.warn("[gengage] Blocked navigation to unsafe URL:",t);return}Qn(t,e)}}function Gs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Xn,Ws=L((()=>{ge(),ot(),Zn(),Xn=console}));function He(t){const e=t?.trim();return e||"tr"}var ht=L((()=>{}));function ve(t){const e=globalThis.CSS?.escape;if(typeof e=="function")return e(t);const a=Array.from(t);return a.map((n,i)=>{const r=n.codePointAt(0);return r===void 0?"":r===0?"�":r>=1&&r<=31||r===127||i===0&&r>=48&&r<=57||i===1&&a[0]==="-"&&r>=48&&r<=57?`\\${r.toString(16)} `:i===0&&n==="-"&&a.length===1?"\\-":r>=128||/[A-Za-z0-9_-]/.test(n)?n:`\\${n}`}).join("")}var It=L((()=>{}));function Ks(t){return Jn.includes(t.type)?t.size>5242880?{ok:!1,reason:"too_large"}:{ok:!0}:{ok:!1,reason:"invalid_type"}}var Jn,Ys,Qs=L((()=>{Jn=["image/jpeg","image/png","image/webp"],Ys=5*1024*1024}));function ei(t){return typeof t=="object"&&t!==null&&typeof t.type=="string"}function Zs(t){const e=[];let a=0,n=!1,i=!1,r=0;for(let o=0;o<t.length;o++){const s=t[o];if(i){i=!1;continue}if(s==="\\"&&n){i=!0;continue}if(s==='"'){n=!n;continue}n||(s==="{"&&a++,s==="}"&&(a--,a===0&&(e.push(t.slice(r,o+1)),r=o+1)))}return e.length>0?e:[t]}function ti(t,e){const a=t.trim();if(!a||a.startsWith(":"))return!1;const n=a.startsWith("data: ")?a.slice(6):a;if(n==="[DONE]")return e.onDone?.(),!0;try{const i=JSON.parse(n);return ei(i)?(Be("stream",`event: ${i.type}`,i),e.onEvent(i),i.type==="done"?(e.onDone?.(),!0):!1):!1}catch{const i=Zs(n);if(i.length>1){for(const r of i)try{const o=JSON.parse(r);if(!ei(o))continue;if(e.onEvent(o),o.type==="done")return e.onDone?.(),!0}catch{}return!1}return!1}}async function Nt(t,e){if(!t.ok){e.onError?.(new Error(`HTTP ${t.status}: ${t.statusText}`));return}if(!t.body){e.onError?.(new Error("Response body is null — streaming not supported"));return}const a=t.body.getReader(),n=new TextDecoder("utf-8");let i="";const r=e.idleTimeoutMs??6e4,o=Symbol("idle-timeout");let s=!1;try{for(;;){const c=a.read();let l;const d=await(r>0?Promise.race([c.then(b=>(clearTimeout(l),b)),new Promise(b=>{l=setTimeout(()=>b(o),r)})]):c);if(d===o){s=!0,await a.cancel();break}const{done:g,value:h}=d;if(g)break;i+=n.decode(h,{stream:!0});const f=i.split(`
48
48
  `);i=f.pop()??"";for(const b of f)if(ti(b,e))return}if(i.trim()&&ti(i,e))return}catch(c){if(c instanceof DOMException&&c.name==="AbortError")return;e.onError?.(c instanceof Error?c:new Error(String(c)))}finally{s||a.releaseLock()}e.onDone?.()}var ba=L((()=>{ot()}));function Xs(t){const e=(t.display_keywords??[]).flatMap(i=>Mt(i,{stripLeadingStopWords:!0})),a=e.filter((i,r)=>e.indexOf(i)===r);if(a.length>0)return a.slice(0,va);const n=[...Mt(t.chosen_attribute,{stripLeadingStopWords:!0}),...Mt(t.short_name)];return n.filter((i,r)=>n.indexOf(i)===r).slice(0,va)}function Js(t){return Xs(t).join(" • ")}var va,ai,Mt,ec=L((()=>{va=3,ai=(t,e)=>{const a=t.replace(/\s+/g," ").trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g,"");if(!a)return"";const n=e?.stripLeadingStopWords?a.replace(/^(?:daha|için)\s+/i,"").trim():a;return n?n.split(/\s+/).slice(0,3).join(" ").trim():""},Mt=(t,e)=>t?t.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map(a=>ai(a,e)).filter(Boolean):[]}));function ni(t){return t==="beauty_consulting"||t==="account_expert"}var ii=L((()=>{}));function ya(...t){for(const e of t){if(typeof e!="string")continue;const a=e.trim();if(a.length>0)return a}}function xa(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.trim().length>0).map(e=>e.trim()):[]}function Bt(t){const e={...t},a=ya(e.sku),n=xa(e.group_skus);if(a?e.sku=a:delete e.sku,n.length>0?e.group_skus=n:delete e.group_skus,a||n.length>0)delete e.image_url;else{const i=ya(e.image_url);i?e.image_url=i:delete e.image_url}return e}var _a=L((()=>{}));function Rt(t){if(typeof t.type!="string")return null;if(tc(t))return t;const e=t;switch(e.type){case"outputText":return ac(e);case"suggestedActions":return nc(e);case"productList":return ic(e);case"productDetails":return rc(e);case"productDetailsSimilars":return oc(e);case"comparisonTable":return sc(e);case"context":return dc(e);case"chatStreamEnd":return pc();case"loading":return hc(e);case"panelLoading":return uc(e);case"similarLoading":return mc(e);case"redirect":return fc(e);case"error":return bc(e);case"dummy":return vc(e);case"launcherAction":return yc(e);case"text":return wa(e);case"productItem":return xc(e);case"text_image":return ri(e);case"quick_qna":return oi(e);case"reviewHighlights":return _c(e);case"aiProductSuggestions":return Cc(e);case"aiProductGroupings":return Sc(e);case"aiSuggestedSearches":return Pc(e);case"prosAndCons":return wc(e);case"getGroundingReview":return Tc(e);case"voice":return Lc(e);case"visitorDataResponse":return kc(e);case"productListPreview":return Ac();case"groupList":return Ic(e);case"formGetInfo":case"formTestDrive":case"formServiceRequest":case"launchFormPage":return Nc(e);case"launcherContent":return Bc(e);case"handoff":return Mc(e);case"uiSpec":return qc(e);default:return null}}function tc(t){const e=t.type;if(typeof e!="string")return!1;switch(e){case"metadata":return typeof t.sessionId=="string"&&typeof t.model=="string";case"text_chunk":return typeof t.content=="string";case"ui_spec":{const a=t.widget;if(a!=="chat"&&a!=="qna"&&a!=="simrel")return!1;const n=xe(t.spec);return n?typeof n.root=="string"&&xe(n.elements)!==null:!1}case"action":{const a=xe(t.action);return a!==null&&typeof a.kind=="string"}case"error":return typeof t.code=="string"&&typeof t.message=="string";case"done":return!0;default:return!1}}function ac(t){const e=te(t.payload.text,t.payload.plain_text)??"",a=te(t.payload.plain_text,t.payload.text)??e;if(t.payload.is_error)return{type:"error",code:"BACKEND_ERROR",message:a||"Backend returned an error"};const n={type:"text_chunk",content:e,final:!0},i=t.payload.product_mentions;Array.isArray(i)&&i.length>0&&(n.productMentions=i.filter(c=>typeof c=="object"&&c!==null&&typeof c.sku=="string"&&typeof c.short_name=="string"));const r=t.payload.sku_to_product_item;r&&typeof r=="object"&&!Array.isArray(r)&&(n.skuToProductItem=r);const o=t.payload.conversation_mode;typeof o=="string"&&o&&(n.conversationMode=o);const s=t.payload.render_hint;return typeof s=="string"&&s&&(n.renderHint=s),t.payload.kvkk===!0&&(n.kvkk=!0),n}function nc(t){return si((t.payload.actions??[]).map(e=>{const a=te(e.title)??"",n=Ee(e.requestDetails,a),i=n?{label:a,action:n}:null;return i?(typeof e.icon=="string"&&(i.icon=e.icon),typeof e.image=="string"&&(i.image=e.image),i):null}).filter(mt),"chat")}function ic(t){const e=(Array.isArray(t.payload.style_variations)?t.payload.style_variations:[]).map(o=>{const s=te(o.style_label);if(!s)return null;const c=te(o.style_mood),l=te(o.image_url??void 0),d=(Array.isArray(o.product_list)?o.product_list:[]).map(h=>{const f=xe(h);return f?ka(xe(f.product_detail)??xe(f.product)??f):null}).filter(mt),g=Array.isArray(o.recommendation_groups)?o.recommendation_groups.map(h=>({label:te(h.label)??"",reason:te(h.reason)??"",skus:Array.isArray(h.skus)?h.skus.filter(f=>typeof f=="string"&&f.trim().length>0):[]})):[];return{style_label:s,style_mood:c??"",...l?{image_url:l}:{},...typeof o.status=="string"?{status:o.status}:{},product_list:d,recommendation_groups:g}}).filter(mt),a=t.payload.product_list??[],n=ni(t.payload.source)&&e.length>0?e[0].product_list:null,i=n?Rc(n,"chat"):ci(a,"chat");i.panelHint="panel";const r=i.spec.elements[i.spec.root];if(r){const o={};typeof t.payload.offset=="number"&&(o.offset=t.payload.offset),typeof t.payload.end_of_list=="boolean"&&(o.endOfList=t.payload.end_of_list),typeof t.payload.title=="string"&&(o.panelTitle=t.payload.title),typeof t.payload.source=="string"&&(o.source=t.payload.source),e.length>0&&(o.styleVariations=e),t.payload.replace_panel===!0&&(o.replacePanel=!0),(t.payload.ranking_state==="pending"||t.payload.ranking_state==="final")&&(o.rankingState=t.payload.ranking_state);const s=t.payload.sequence_id??t.payload.search_id;typeof s=="string"&&s.length>0&&(o.sequenceId=s),Object.keys(o).length>0&&(r.props={...r.props,...o})}return i}function rc(t){const e=t.payload.productDetails;if(!e)return Hc("chat");const a=qe(e);return{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ProductDetailsPanel",props:{product:{...e,...a}}}}},panelHint:"panel"}}function oc(t){const e=ci(t.payload.similarProducts??[],"chat"),a=e.spec.elements[e.spec.root];return a&&(a.props={...a.props,similarsAppend:!0}),{...e,panelHint:"panel"}}function sc(t){const e=t.payload.multiple_product_details??[],a=t.payload,n={key_differences:a.key_differences,recommended_choice:a.recommended_choice,recommended_choice_sku:a.recommended_choice_sku,special_considerations:a.special_considerations,criteria_view:a.criteria_view,criteria_view_short:a.criteria_view_short,compared_field_names:a.compared_field_names,winner_product:a.winner_product,winner_hits:a.winner_hits,...t.payload.product_comparison_framework??{}},i=t.payload.table,r=t.payload.features_list,o=[];for(const u of e){const p=qe(u);o.push(p)}const s=cc(i,o,n,r);let c;n?.recommended_choice_sku?c=n.recommended_choice_sku:n?.winner_product&&n.winner_product.length>0&&(c=n.winner_product[0]?.product_detail?.sku??n.winner_product[0]?.sku);const l=c?o.find(u=>u.sku===c)??o[0]:o[0],d=[];if(Array.isArray(n?.key_differences))for(const u of n.key_differences)typeof u=="string"&&d.push(u);const g=li(n?.special_considerations),h=n?.recommended_choice,f=n?.winner_hits,b={};for(const u of o){const p=u.sku;p&&(b[p]={title:u.name??p,type:"launchSingleProduct",payload:{sku:p}})}const m={products:o,attributes:s,highlights:d,productActions:b};return l&&(m.recommended=l),g.length>0&&(m.specialCases=g),h&&(m.recommendedText=h),f&&(m.winnerHits=f),typeof n?.key_differences=="string"&&(m.keyDifferencesHtml=n.key_differences),n?.special_considerations&&(m.specialConsiderations=n.special_considerations),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ComparisonTable",props:m}}},panelHint:"panel"}}function cc(t,e,a,n){if(!t)return[];const i=Object.entries(t);if(i.length===0)return[];const r=i[0]?.[1];if(Array.isArray(r)){const g=a.criteria_view??a.criteria_view_short??{},h=a.compared_field_names??Object.keys(t),f=[];for(const b of h){const m=t[b];if(!m||!Array.isArray(m))continue;const u=g[b]??b;f.push({label:u,values:m.map(p=>typeof p=="string"?p:String(p??""))})}return f}const o=t,s=e.map(g=>String(g.sku??"")).filter(g=>g.length>0),c=a.criteria_view??a.criteria_view_short??{},l=(n&&n.length>0?n:a.compared_field_names&&a.compared_field_names.length>0?a.compared_field_names:lc(o)).filter(g=>g!=="name"&&g!=="name_short"&&!g.endsWith("_short")),d=[];for(const g of l){const h=s.map(b=>{const m=o[b];if(!m||typeof m!="object")return"";const u=m[`${g}_short`],p=m[g];return gc(u??p)});if(h.every(b=>b.length===0))continue;const f=c[g]??g;d.push({label:f,values:h})}return d}function lc(t){const e=[],a=new Set;for(const n of Object.values(t))if(!(!n||typeof n!="object"))for(const i of Object.keys(n))a.has(i)||(a.add(i),e.push(i));return e}function gc(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):""}function dc(t){return{type:"metadata",sessionId:"",model:"",meta:{panel:t.payload.panel,messages:t.payload.messages,message_id:t.payload.message_id}}}function pc(){return{type:"done"}}function hc(t){return{type:"metadata",sessionId:"",model:"",meta:{loading:!0,loadingText:t.payload.text,thinkingMessages:t.payload.thinking_messages,dynamicLoading:t.payload.is_dynamic===!0}}}function uc(t){return{type:"metadata",sessionId:"",model:"",meta:{loading:!0,panelLoading:!0,panelPendingType:t.payload?.pending_type,loadingText:t.payload?.text}}}function mc(t){return{type:"metadata",sessionId:"",model:"",meta:{loading:!0,similarPanelLoading:!0,panelPendingType:t.payload?.pending_type,loadingText:t.payload?.text}}}function fc(t){const e=te(t.payload.url);return e?{type:"action",action:{kind:"navigate",url:e,newTab:t.payload.new_tab===!0}}:{type:"metadata",sessionId:"",model:"",meta:{redirect:t.payload,redirectTarget:te(t.payload.to)}}}function bc(t){return{type:"error",code:"BACKEND_ERROR",message:te(t.payload?.text,t.payload?.message,t.payload?.error)??"Backend returned an error"}}function vc(t){return{type:"metadata",sessionId:"",model:"",meta:{noop:!0}}}function yc(t){const e=t.payload??{};if(Array.isArray(e.action_list)){const i={action_list:e.action_list},r=typeof e.type=="string"?e.type:void 0,o=typeof e.theme=="string"?e.theme:void 0;return r!==void 0&&(i.type=r),o!==void 0&&(i.theme=o),oi({type:"quick_qna",payload:i})}const a=xe(e.action);if(a){const i={action:a},r=typeof e.text=="string"?e.text:void 0,o=typeof e.image_url=="string"?e.image_url:void 0,s=typeof e.theme=="string"?e.theme:void 0;return r!==void 0&&(i.text=r),o!==void 0&&(i.image_url=o),s!==void 0&&(i.theme=s),ri({type:"text_image",payload:i})}const n=typeof e.text=="string"?e.text:"";if(n){const i={text:n},r=typeof e.type=="string"?e.type:void 0,o=typeof e.theme=="string"?e.theme:void 0,s=xe(e.payload)??void 0;return r!==void 0&&(i.type=r),s!==void 0&&(i.payload=s),o!==void 0&&(i.theme=o),wa({type:"text",payload:i})}return{type:"metadata",sessionId:"",model:"",meta:{launcherAction:e}}}function wa(t){const e={text:te(t.payload.text)??""};return typeof t.payload.theme=="string"&&(e.theme=t.payload.theme),t.payload.payload!==void 0&&(e.payload=t.payload.payload),{type:"ui_spec",widget:"qna",spec:{root:"root",elements:{root:{type:"QuestionHeading",props:e}}}}}function xc(t){return zc(t.payload,"qna")}function ri(t){const e=te(t.payload.text)??"",a=Ee(t.payload.action,e);if(a){const i={label:e||a.title,action:a};return typeof t.payload.image_url=="string"&&(i.image=t.payload.image_url),typeof t.payload.theme=="string"&&(i.theme=t.payload.theme),{type:"ui_spec",widget:"qna",spec:{root:"root",elements:{root:{type:"ActionButton",props:i}}}}}const n={text:e};return typeof t.payload.theme=="string"&&(n.theme=t.payload.theme),wa({type:"text",payload:n})}function oi(t){return si((t.payload.action_list??[]).map(e=>{const a=te(e.title)??"",n=Ee(e.requestDetails,a),i=n?{label:a,action:n}:null;return i?(typeof e.icon=="string"&&(i.icon=e.icon),typeof e.image=="string"&&(i.image=e.image),i):null}).filter(mt),"qna")}function _c(t){const e={reviews:(t.payload.reviews??[]).map(a=>{const n={};return typeof a.review_class=="string"&&(n.review_class=a.review_class),typeof a.review_text=="string"&&(n.review_text=a.review_text),(typeof a.review_rating=="string"||typeof a.review_rating=="number")&&(n.review_rating=a.review_rating),typeof a.review_tag=="string"&&(n.review_tag=a.review_tag),n})};return typeof t.payload.sku=="string"&&(e.sku=t.payload.sku),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ReviewHighlights",props:e}}}}}function wc(t){const e={};return Array.isArray(t.payload.pros)&&(e.pros=t.payload.pros),Array.isArray(t.payload.cons)&&(e.cons=t.payload.cons),typeof t.payload.product_name=="string"&&(e.productName=t.payload.product_name),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"ProsAndCons",props:e}}}}}function kc(t){return{type:"metadata",sessionId:"",model:"",meta:{visitorDataResponse:t.payload}}}function Cc(t){const e=t.payload.product_suggestions??[],a=[];for(let n=0;n<e.length;n++){const i=e[n];if(!i)continue;const r=Fc(i);if(!r)continue;const o={product:r},s=Ee(i.requestDetails,r.name);s&&(o.action=s),typeof i.role=="string"&&(o.role=i.role),typeof i.reason=="string"&&(o.reason=i.reason),typeof i.review_highlight=="string"&&(o.reviewHighlight=i.review_highlight),Array.isArray(i.labels)&&(o.labels=i.labels),typeof i.expert_quality_score=="number"&&(o.expertQualityScore=i.expert_quality_score),a.push(o)}return a.length===0?{type:"metadata",sessionId:"",model:"",meta:{aiProductSuggestions:t.payload.product_suggestions??[]}}:{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"AITopPicks",props:{suggestions:a}}}}}}function Sc(t){const e=t.payload.product_groupings??[],a=[],n=[];for(let i=0;i<e.length;i++){const r=e[i];if(!r)continue;const o=te(r.name)??"",s=te(r.description),c=te(r.highlight),l=Array.isArray(r.labels)?li(r.labels):[],d=te(r.sku,r.repr_sku),g=te(r.image,r.repr_image),h=Ec(r,o,d),f=(Array.isArray(r.group_products)?r.group_products:[]).map(u=>{const p=xe(u);return p?ka(p):null}).filter(mt),b=g??te(...f.map(u=>u.imageUrl));if(o&&f.length>0){const u={groupName:o,products:f};b&&(u.image=b),s&&(u.description=s),c&&(u.highlight=c),l.length>0&&(u.labels=l),a.push(u)}if(!h)continue;const m={name:o,action:h};l.length>0&&(m.labels=l),g!==void 0&&(m.image=g),n.push(m)}return a.length>0?{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"CategoriesContainer",props:{groups:a}}}},panelHint:"panel"}:n.length===0?{type:"metadata",sessionId:"",model:"",meta:{aiProductGroupings:t.payload.product_groupings??[]}}:{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"AIGroupingCards",props:{entries:n}}}}}}function Ec(t,e,a){const n=xe(t.requestDetails);if(n){if(n.type!=="findSimilar")return Ee(n,e);const o={...xe(n.payload)??{}};a&&!ya(o.sku)&&(o.sku=a);const s=xa(t.group_skus);return s.length>0&&(o.group_skus=s),Ee({...n,payload:Bt(o)},e)}const i={};a&&(i.sku=a);const r=xa(t.group_skus);return r.length>0&&(i.group_skus=r),Object.keys(i).length===0?null:Ee({type:"findSimilar",payload:Bt(i)},e)}function Pc(t){const e=t.payload.suggested_searches??[],a=[];for(let n=0;n<e.length;n++){const i=e[n];if(!i)continue;const r=te(i.short_name,i.chosen_attribute,i.detailed_user_message)??`Search ${n+1}`,o={},s=te(i.detailed_user_message);s&&(o.text=s);const c=xe(xe(i.requestDetails)?.payload),l=c?.group_skus;i.group_skus&&Array.isArray(i.group_skus)?o.group_skus=i.group_skus:Array.isArray(l)&&(o.group_skus=l.filter(p=>typeof p=="string"));const d=te(i.sku,i.representative_product_sku,c?.sku);d&&(o.sku=d),o.is_suggested_text=1;const g={type:"inputText",payload:o},h=Ee(i.requestDetails,r),f=h?.type==="findSimilar"&&typeof o.text=="string"?Ee(g,r):h??Ee(g,r);if(!f)continue;const b={shortName:r,action:f},m=te(i.detailed_user_message);m&&m!==r&&(b.detailedMessage=m);const u=Js(i);u&&u!==r&&u!==(m??"")&&(b.whyDifferent=u),typeof i.image=="string"&&(b.image=i.image),a.push(b)}return a.length===0?{type:"metadata",sessionId:"",model:"",meta:{aiSuggestedSearches:t.payload.suggested_searches??[]}}:{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"AISuggestedSearchCards",props:{entries:a}}}}}}function Tc(t){const e=t.payload,a=Ee(e.requestDetails??e.request_details,te(e.review_count,e.reviewCount,e.text,e.title)??"Show product reviews");if(!a)return{type:"metadata",sessionId:"",model:"",meta:{groundingReview:e}};const n={action:a};return e.title&&(n.title=e.title),e.text&&(n.text=e.text),e.review_count?n.reviewCount=e.review_count:typeof e.reviewCount=="string"&&e.reviewCount.trim()&&(n.reviewCount=e.reviewCount),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"GroundingReviewCard",props:n}}}}}function Ac(){return{type:"metadata",sessionId:"",model:"",meta:{analyzeAnimation:!0}}}function Lc(t){return{type:"metadata",sessionId:"",model:"",meta:{voice:t.payload}}}function Ic(t){const e=t.payload.group_list??[],a=[];for(const i of e){const r=i.group_name??"",o=(i.product_list??[]).map(qe);a.push({groupName:r,products:o})}const n=[];for(const i of t.payload.filter_tags??[]){const r=i.title??"";if(!r)continue;const o=Ee(i.requestDetails,r),s={title:r};o&&(s.action=o),n.push(s)}return{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"CategoriesContainer",props:{groups:a,filterTags:n}}}},panelHint:"panel"}}function Nc(t){return{type:"metadata",sessionId:"",model:"",meta:{formType:t.type,formPayload:t.payload??{}}}}function Mc(t){const e={};return typeof t.payload?.summary=="string"&&(e.summary=t.payload.summary),Array.isArray(t.payload?.products_discussed)&&(e.products_discussed=t.payload.products_discussed),typeof t.payload?.user_sentiment=="string"&&(e.user_sentiment=t.payload.user_sentiment),{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:"HandoffNotice",props:e}}}}}function Bc(t){return{type:"metadata",sessionId:"",model:"",meta:{launcherContent:t.payload??{}}}}function si(t,e){const a={},n=[];for(let i=0;i<t.length;i++){const r=t[i];if(!r)continue;const o=`action-${i}`;n.push(o);const s={label:r.label,action:r.action};r.icon!==void 0&&(s.icon=r.icon),r.image!==void 0&&(s.image=r.image),r.description!==void 0&&(s.description=r.description),a[o]={type:"ActionButton",props:s}}return a.root={type:"ActionButtons",props:{buttons:t.map(i=>{const r={label:i.label,action:i.action};return i.image!==void 0&&(r.image=i.image),i.description!==void 0&&(r.description=i.description),i.icon!==void 0&&(r.icon=i.icon),r})},children:n},{type:"ui_spec",widget:e,spec:{root:"root",elements:a}}}function ci(t,e){const a={},n=[];for(let i=0;i<t.length;i++){const r=t[i];if(!r)continue;const o=qe(r),s=`product-${i}`;n.push(s);const c={product:o,index:i};o.sku&&(c.action={title:o.name,type:"launchSingleProduct",payload:{sku:o.sku}}),a[s]={type:"ProductCard",props:c}}return a.root={type:"ProductGrid",props:{layout:"grid"},children:n},{type:"ui_spec",widget:e,spec:{root:"root",elements:a}}}function Rc(t,e){const a={},n=[];for(let i=0;i<t.length;i++){const r=t[i];if(!r)continue;const o=`product-${i}`;n.push(o);const s={product:r,index:i},c=r.sku;c&&(s.action={title:r.name??"",type:"launchSingleProduct",payload:{sku:c}}),a[o]={type:"ProductCard",props:s}}return a.root={type:"ProductGrid",props:{layout:"grid"},children:n},{type:"ui_spec",widget:e,spec:{root:"root",elements:a}}}function zc(t,e){return{type:"ui_spec",widget:e,spec:{root:"root",elements:{root:{type:"ProductCard",props:{product:qe(t),index:0}}}}}}function Hc(t){return{type:"ui_spec",widget:t,spec:{root:"root",elements:{root:{type:"ActionButtons",props:{buttons:[]},children:[]}}}}}function Fc(t){const e=te(t.sku),a=te(t.short_name),n={...xe(t.product_item)??t},i=te(t.discount_reason,t.discountReason);return i&&!te(n.discount_reason,n.discountReason)&&(n.discount_reason=i),ka(n,e,a)}function ka(t,e,a){const n=te(t.sku,e),i=te(t.name,a);if(!n||!i)return null;const r={sku:n,name:i},o=te(t.brand);o&&(r.brand=o);const s=te(t.url);s&&(r.url=s);const c=Dc(t.images);if(c.length>0)r.images=c;else{const m=te(t.image,t.image_url,t.imageUrl);m&&(r.images=[m])}const l=ut(t.price_discounted);l!==void 0&&(r.price_discounted=l);const d=ut(t.price);d!==void 0&&(r.price=d);const g=ut(t.rating);g!==void 0&&(r.rating=g);const h=ut(t.review_count)??ut(t.reviewCount);h!==void 0&&(r.review_count=h);const f=te(t.cart_code,t.cartCode);f&&(r.cart_code=f),typeof t.in_stock=="boolean"&&(r.in_stock=t.in_stock),typeof t.inStock=="boolean"&&(r.in_stock=t.inStock);const b=te(t.discount_reason,t.discountReason);return b&&(r.discount_reason=b),qe(r)}function Ee(t,e){const a=xe(t);if(!a)return null;const n=a.type;if(typeof n!="string"||n.length===0)return null;const i={title:e||n,type:n};return a.payload!==void 0&&(i.payload=a.payload),i}function xe(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function te(...t){for(const e of t)if(typeof e=="string"){const a=e.trim();if(a.length>0)return a}}function Dc(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):[]}function li(t){if(typeof t=="string"){const e=t.trim();return e?[e]:[]}return Array.isArray(t)?t.filter(e=>typeof e=="string").map(e=>e.trim()).filter(e=>e.length>0):[]}function ut(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){let e;t.includes(".")&&t.includes(",")?e=t.replace(/\./g,"").replace(",","."):e=t.replace(",",".");const a=Number(e);if(Number.isFinite(a))return a}}function mt(t){return t!=null}function qe(t){const e=t.price_discounted!=null&&t.price_discounted>0,a=e?t.price_discounted:t.price,n=e&&t.price!=null?t.price:void 0;let i;n!=null&&a!=null&&n>0?i=Math.round((n-a)/n*100):t.price_discount_rate!=null&&t.price_discount_rate>0&&(i=t.price_discount_rate);const r=te(t.brand),o=te(t.name)??t.sku,s=r&&!o.toLowerCase().startsWith(r.toLowerCase())?`${r} ${o}`:o,c={sku:t.sku,name:s,url:te(t.url)??""},l=t.images?.[0];l&&(c.imageUrl=l),t.images&&t.images.length>1&&(c.images=t.images),a!=null&&a>0&&(c.price=String(a)),n!=null&&n>0&&(c.originalPrice=String(n)),i!==void 0&&(c.discountPercent=i),r!==void 0&&(c.brand=r),t.rating!==void 0&&(c.rating=t.rating),t.review_count!==void 0&&(c.reviewCount=t.review_count),t.cart_code!==void 0&&(c.cartCode=t.cart_code),t.in_stock!==void 0&&(c.inStock=t.in_stock),t.variants&&t.variants.length>0&&(c.variants=t.variants),t.discount_reason!==void 0&&(c.discountReason=t.discount_reason),t.promotions&&t.promotions.length>0&&(c.promotions=t.promotions),t.description!==void 0&&(c.description=t.description),t.description_html!==void 0&&(c.descriptionHtml=t.description_html),t.features&&t.features.length>0&&(c.features=t.features),t.specifications!==void 0&&(c.specifications=t.specifications),t.facet_hits&&(c.facetHits=t.facet_hits),t.category_names&&t.category_names.length>0&&(c.categoryNames=t.category_names),t.short_name!==void 0&&(c.shortName=t.short_name);const d=t,g={};let h=!1;for(const f of Object.keys(d))gi.has(f)||(g[f]=d[f],h=!0);return h&&(c.extras=g),c}function Uc(t){return t.results.map(qe)}function Oc(t){return t.product_groupings.map(e=>{const a={name:e.name,products:(e.group_products??[]).map(qe)};return e.highlight!==void 0&&(a.highlight=e.highlight),a})}function qc(t){const e=t.payload.type,{type:a,...n}=t.payload;return{type:"ui_spec",widget:"chat",spec:{root:"root",elements:{root:{type:e,props:n}}}}}var gi,Ca=L((()=>{ec(),ii(),_a(),gi=new Set(["sku","name","brand","images","price","price_discounted","price_discount_rate","price_currency","discount_reason","url","rating","review_count","cart_code","in_stock","description","description_html","features","specifications","short_name","category_ids","category_names","variants","facet_hits","promotions"])}));function jc(t){if(t===void 0)throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");const e=t.trim();return e===""?"":e.replace(/\/+$/,"")}function zt(t,e){return`${jc(e?.middlewareUrl)}/chat${di[t]}`}var di,Sa=L((()=>{di={process_action:"/process_action",launcher_action:"/launcher_action",similar_products:"/similar_products",product_groupings:"/product_groupings"}}));function $c(t){if(!(typeof window>"u"||!t))try{const e=window.GengageAssistantInjector?.[t]?.streamTransport;return typeof e=="function"?e:void 0}catch{return}}var Vc=L((()=>{}));async function Ht(t,e={},a={}){const n=Gc(t,e);if(!n)return fetch(t,e);const i=Date.now(),r=await Kc(n,i);if(r)return Zc(r);const o=await fetch(t,e);return o.ok&&Yc(n,o.clone(),i,{ttlMs:a.ttlMs??hi,maxEntries:a.maxEntries??Ta,maxBodyBytes:a.maxBodyBytes??ui}),o}function Gc(t,e={}){if(typeof Request<"u"&&t instanceof Request)return null;const a=String(e.method||"GET").toUpperCase();return a!=="POST"||typeof e.body!="string"||Wc(e.body)?null:`rr:${il(nl({url:String(t),method:a,headers:Xc(e.headers),body:e.body}))}`}function Wc(t){try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e))return!1;const a=e.type;return typeof a=="string"&&bi.has(a)}catch{return!1}}async function Kc(t,e){const a=Ie.get(t);if(a)if(a.expiresAt<=e)Ie.delete(t);else return a.lastAccessedAt=e,Ie.delete(t),Ie.set(t,a),Ea(a),a;const n=await el(t);return n?n.expiresAt<=e?(Ie.delete(t),tl(t),null):(n.lastAccessedAt=e,Ie.set(t,n),Ea(n),pi(Ta),n):null}async function Yc(t,e,a,n){try{const i=await e.text();if(rl(i)>n.maxBodyBytes||Qc(i))return;const r={key:t,status:e.status,statusText:e.statusText,headers:Jc(e.headers),body:i,createdAt:a,expiresAt:a+n.ttlMs,lastAccessedAt:a};Ie.set(t,r),pi(n.maxEntries),await Ea(r),await al(n.maxEntries,a)}catch{}}function Qc(t){return/"_error"\s*:/u.test(t)||/"type"\s*:\s*"error"/u.test(t)}function Zc(t){return new Response(t.body,{status:t.status,statusText:t.statusText,headers:new Headers(t.headers)})}function Xc(t){const e=new Headers(t),a=[];return e.forEach((n,i)=>{const r=i.toLowerCase();r!=="authorization"&&r!=="cookie"&&a.push([r,n])}),a.sort(([n],[i])=>n.localeCompare(i))}function Jc(t){const e=[];return t.forEach((a,n)=>{const i=n.toLowerCase();i!=="set-cookie"&&e.push([i,a])}),e.sort(([a],[n])=>a.localeCompare(n))}function pi(t){for(;Ie.size>t;){const e=[...Ie.values()].sort((a,n)=>a.lastAccessedAt-n.lastAccessedAt)[0];if(!e)break;Ie.delete(e.key)}}async function Ft(){return typeof indexedDB>"u"?null:(Aa??=new Promise(t=>{const e=indexedDB.open(mi,fi);e.onupgradeneeded=()=>{const a=e.result;a.objectStoreNames.contains(Le)||a.createObjectStore(Le,{keyPath:"key"}).createIndex("lastAccessedAt","lastAccessedAt",{unique:!1})},e.onsuccess=()=>t(e.result),e.onerror=()=>t(null),e.onblocked=()=>t(null)}),Aa)}async function el(t){const e=await Ft();return e?new Promise(a=>{const n=e.transaction(Le,"readonly"),i=n.objectStore(Le).get(t);i.onsuccess=()=>a(i.result??null),i.onerror=()=>a(null),n.onerror=()=>a(null)}):null}async function Ea(t){const e=await Ft();e&&await new Promise(a=>{const n=e.transaction(Le,"readwrite");n.objectStore(Le).put(t),n.oncomplete=()=>a(),n.onerror=()=>a(),n.onabort=()=>a()})}async function tl(t){const e=await Ft();e&&await new Promise(a=>{const n=e.transaction(Le,"readwrite");n.objectStore(Le).delete(t),n.oncomplete=()=>a(),n.onerror=()=>a(),n.onabort=()=>a()})}async function al(t,e){const a=await Ft();a&&await new Promise(n=>{const i=a.transaction(Le,"readwrite"),r=i.objectStore(Le),o=[],s=r.openCursor();s.onsuccess=()=>{const c=s.result;if(!c){const l=o.filter(g=>g.expiresAt<=e),d=o.filter(g=>g.expiresAt>e).sort((g,h)=>g.lastAccessedAt-h.lastAccessedAt).slice(0,Math.max(0,o.length-l.length-t));for(const g of[...l,...d])r.delete(g.key);return}o.push(c.value),c.continue()},s.onerror=()=>n(),i.oncomplete=()=>n(),i.onerror=()=>n(),i.onabort=()=>n()})}function nl(t){return JSON.stringify(Pa(t))}function Pa(t){return Array.isArray(t)?t.map(Pa):!t||typeof t!="object"?t:Object.fromEntries(Object.entries(t).sort(([e],[a])=>e.localeCompare(a)).map(([e,a])=>[e,Pa(a)]))}function il(t){let e=14695981039346656037n;const a=1099511628211n;for(let n=0;n<t.length;n+=1)e^=BigInt(t.charCodeAt(n)),e=BigInt.asUintN(64,e*a);return e.toString(16).padStart(16,"0")}function rl(t){return typeof TextEncoder<"u"?new TextEncoder().encode(t).byteLength:t.length}var hi,Ta,ui,mi,fi,Le,bi,Ie,Aa,La=L((()=>{hi=7200*1e3,Ta=200,ui=5*1024*1024,mi="gengage_request_response_cache",fi=1,Le="responses",bi=new Set(["addToCart","like"]),Ie=new Map,Aa=null}));function ol(t,e){const a=t.type,n=t.payload!=null&&typeof t.payload=="object"&&!Array.isArray(t.payload)?t.payload:{},i=r=>{const o={...n};for(const[s,c]of Object.entries(r))s in o||(o[s]=c);return o};switch(a){case"user_message":case"inputText":{const r=typeof t.payload=="string",o=r?{text:t.payload}:t.payload!=null&&typeof t.payload=="object"&&!Array.isArray(t.payload)?t.payload:n,s={is_launcher:0};if(e.pageContext?.extra&&(s.page_details=e.pageContext.extra),!r&&!("sku_list"in o)){const l=e.pageContext?.skuList&&e.pageContext.skuList.length>0?e.pageContext.skuList:e.pageContext?.sku?[e.pageContext.sku]:void 0;l&&l.length>0&&(s.sku_list=l)}"is_suggested_text"in o||(s.is_suggested_text=0);const c={...o};for(const[l,d]of Object.entries(s))l in c||(c[l]=d);return{...t,payload:c}}case"findSimilar":{const r={is_launcher:0};return t.title&&(r.text=t.title,r.input=t.title),{...t,payload:Bt(i(r))}}case"getComparisonTable":{const r=t.payload;if(r&&typeof r=="object"&&!Array.isArray(r)&&"gengage_analytics_source"in r){const o={...r};return delete o.gengage_analytics_source,{...t,payload:o}}return t}case"launchProductList":return t;case"launchHomepage":return t;case"addToCart":{const r={};return"error_message"in n||(r.error_message=""),{...t,payload:i(r)}}case"reviewSummary":{const r={};return e.pageContext?.sku&&!("sku"in n)&&(r.sku=e.pageContext.sku),Object.keys(r).length===0?t:{...t,payload:i(r)}}default:return t}}function vi(t){const{action:e,type:a,payload:n,...i}=t,r=a??e?.type??"inputText",o=n??e?.payload,s=xi[r]??r,c={...i,type:s};return o!==void 0&&(c.payload=typeof o=="string"?{text:o}:o),JSON.stringify(c)}function sl(t){return JSON.parse(vi(t))}function cl(t){return t!==null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function yi(t,e){let a=!1;const n=()=>e?.aborted===!0,i=()=>a||n(),r=()=>{i()||(a=!0,t.onDone())};return{fireDone:r,callbacks:{onTextChunk:(...o)=>{i()||t.onTextChunk(...o)},onUISpec:(...o)=>{i()||t.onUISpec(...o)},onAction:o=>{i()||t.onAction(o)},onMetadata:o=>{i()||t.onMetadata(o)},onError:o=>{n()||t.onError(o)},onDone:r}}}function ll(t,e,a){const n=new AbortController,i=a.injectorAdapter??$c(a.accountId);return i?((async()=>{const o=yi(e,n.signal);try{if(await Promise.resolve(),n.signal.aborted)return;const s=i(sl(t),o.callbacks,n.signal,a.attachment);cl(s)&&(await s,o.fireDone())}catch(s){if(n.signal.aborted||s instanceof DOMException&&s.name==="AbortError")return;o.callbacks.onError(s instanceof Error?s:new Error(String(s)))}})(),n):((async()=>{try{const o=zt("process_action",a),s=vi(t),c=a.attachment!==void 0;let l;if(c){const h=new FormData;h.append("request",s),a.attachment!==void 0&&h.append("attachment",a.attachment),l={method:"POST",body:h,signal:n.signal}}else l={method:"POST",headers:{"Content-Type":"application/json"},body:s,signal:n.signal};const d=c?await fetch(o,l):await Ht(o,l);if(!d.ok){let h=d.statusText;try{const f=await d.json(),b=f.detail??f.message??f.error;typeof b=="string"&&(h=b)}catch{}e.onError(new Error(`HTTP ${d.status}: ${h}`));return}const g=yi(e);await Nt(d,{onEvent:h=>{const f=Rt(h);if(f)switch(f.type){case"text_chunk":g.callbacks.onTextChunk(f.content,f.final===!0,{productMentions:f.productMentions,skuToProductItem:f.skuToProductItem,conversationMode:f.conversationMode,renderHint:f.renderHint,kvkk:f.kvkk});break;case"ui_spec":g.callbacks.onUISpec(f.spec,f.widget,f.panelHint,f.clearPanel===!0);break;case"action":g.callbacks.onAction(f);break;case"metadata":g.callbacks.onMetadata(f);break;case"error":g.callbacks.onError(new Error(f.message));break;case"done":g.fireDone();break}},onError:e.onError,signal:n.signal}),g.fireDone()}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;e.onError(o instanceof Error?o:new Error(String(o)))}})(),n)}var xi,gl=L((()=>{ba(),Ca(),Sa(),Vc(),_a(),La(),xi={user_message:"inputText"}}));function dl(){if(typeof window>"u")return!1;const t=new URLSearchParams(window.location.search);if(_i.some(e=>t.get(e)==="1"))return!0;try{return wi.some(e=>window.localStorage.getItem(e)==="1")}catch{return!1}}function pl(t,e,a){if(!dl())return;const n=(window.__gengageChatPresentationDebugSeq??0)+1;window.__gengageChatPresentationDebugSeq=n;const i={seq:n,time:new Date().toISOString(),scope:t,message:e,payload:a};window.__gengageChatPresentationDebugLog||(window.__gengageChatPresentationDebugLog=[]),window.__gengageChatPresentationDebugLog.push(i),window.__gengageChatPresentationDebugLog.length>400&&window.__gengageChatPresentationDebugLog.shift();const r=`[gengage-chat-debug #${n}][${t}] ${e}`;a===void 0?console.debug(r):console.debug(r,a)}var _i,wi,hl=L((()=>{_i=["chat_debug","presentation_debug"],wi=["gengage_chat_debug","gengage_presentation_debug"]}));function ki(t){Ye=t}function ul(){if(Ye&&Ye.isConnected)return Ye;Ye=null;const t=document.getElementById(ft);return t||(pl("chat-scroll","failed to resolve scroll container (not registered)",{id:ft}),null)}function Ci(){Ye=null}var ft,Ye,Si=L((()=>{hl(),ft="gengage-chat-scroll",Ye=null})),Qe,ml=L((()=>{Qe={headerTitle:"Ürün Uzmanı",inputPlaceholder:"Ürün ara, soru sor",sendButton:"Gönder",closeButton:"Kapat",openButton:"Sohbeti aç",newChatButton:"Yeni sohbet",poweredBy:"Gengage ile",errorMessage:"Bir hata oluştu. Lütfen tekrar deneyin.",retryButton:"Tekrar Dene",loadingMessage:"İsteğinizi inceliyorum...",loadingSequenceGeneric:["İsteğinizi inceliyorum...","Ürün ve yorumlara bakıyorum...","Detayları inceliyorum..."],loadingSequencePanel:["En ilgili detayları inceliyorum","En güçlü sinyalleri kontrol ediyorum","Bu görünümü sizin için hazırlıyorum"],loadingSequenceComparison:["Ürün farklarını inceliyorum","En güçlü farkları ve ödünleşimleri kontrol ediyorum","Karşılaştırmayı sizin için hazırlıyorum"],productCtaLabel:"Satın Al",viewOnSiteLabel:"Sitede Gör",attachImageButton:"Resim ekle",attachMenuSelectPhoto:"Fotoğraf Seç",attachMenuPaste:"Yapıştır",clipboardNoImageMessage:"Panoda görsel bulunamadı. Önce bir görsel kopyalayın veya dosya seçin.",removeAttachmentButton:"Resmi kaldır",invalidFileType:"Sadece JPEG, PNG ve WebP dosyaları destekleniyor.",fileTooLarge:"Dosya boyutu 5 MB'dan küçük olmalıdır.",aiTopPicksTitle:"Sizin İçin En İyiler",roleWinner:"Size Özel Seçimim",roleBestValue:"En Uygun Fiyatlı",roleBestAlternative:"En İyi Alternatif",viewDetails:"Detayları Gör",groundingReviewCta:"Yorumları Oku",groundingReviewSubtitle:"{count} yorum mevcut",variantsLabel:"Varyantlar",sortRelated:"Önerilen",sortPriceAsc:"Fiyat düşükten yükseğe",sortPriceDesc:"Fiyat yüksekten düşüğe",sortToolbarAriaLabel:"Ürünleri sırala",compareSelected:"Karşılaştır",compareMinHint:"En az 2 ürün seçin",compareMaxHint:"En fazla 5 ürün seçebilirsiniz",comparisonSelectLabel:"Karşılaştırmak için seç",comparisonSelectedLabel:"Seçildi",comparisonSelectCardHint:"Karşılaştırmaya eklemek veya çıkarmak için kartın herhangi bir yerine dokunun.",comparisonPreparingLabel:"Karşılaştırma tablosu hazırlanıyor…",panelTitleProductDetails:"Ürün Detayı",panelTitleSimilarProducts:"Benzer Ürünler",panelTitleComparisonResults:"Karşılaştırma Sonuçları",panelTitleCategories:"Kategoriler",panelTitleSearchResults:"Arama Sonuçları",inStockLabel:"Stokta",outOfStockLabel:"Tükendi",findSimilarLabel:"Benzerlerini Bul",galleryPrevAriaLabel:"Önceki görsel",galleryNextAriaLabel:"Sonraki görsel",beautyStylesPreparedTitle:"Sizin için {count} farklı öneri yönü hazırladım",consultingOtherCompatibleProductsLabel:"Diğer Uyumlu Ürünler",consultingFallbackGroupLabel:"Öneri",consultingFallbackStyleLabel:"Stil {index}",consultingStyleLoadingDescription:"Bu stil için ürünleri toplamaya devam ediyorum. Panel kısa süre içinde yenilenir.",consultingStyleUnavailableDescription:"Bu stil için şu anda yeterli ürün eşleşmesi çıkaramadım. Diğer stilleri inceleyebilirsiniz.",consultingStyleLoadingBadge:"Yükleniyor",consultingStyleUnavailableBadge:"Hazır değil",choicePrompterHeading:"Kararsız mı kaldın?",choicePrompterSuggestion:"Ürünleri seçip karşılaştırabilirsin",choicePrompterCta:"Seç ve Karşılaştır",viewMoreLabel:"Daha Fazla Göster",similarProductsLabel:"Benzer Ürünler",addToCartButton:"Sepete Ekle",addedToCartToast:"Sepete eklendi",shareButton:"Paylaş",productInfoTab:"Ürün Bilgileri",specificationsTab:"Teknik Özellikler",recommendedChoiceLabel:"Önerilen Seçim",highlightsLabel:"Öne Çıkan Özellikler",keyDifferencesLabel:"Temel Farklar",specialCasesLabel:"Özel Durumlar İçin",emptyReviewsMessage:"Yorum özeti bulunamadı.",closeAriaLabel:"Kapat",startChatLabel:"Sohbete Başla",voiceButton:"Sesli giriş",voiceListening:"Dinleniyor...",voiceNotSupported:"Sesli giriş bu tarayıcıda desteklenmiyor.",voicePermissionDenied:"Mikrofon erişimi reddedildi.",voiceError:"Sesli giriş hatası.",handoffHeading:"Destek temsilcisine aktarılıyor",productNotFoundMessage:"Bu ürün bilgisi şu an kullanılamıyor. Başka bir konuda yardımcı olabilirim.",stopGenerating:"Yanıtı Durdur",offlineMessage:"Çevrimdışısınız — bağlantı kurulduğunda mesajlar gönderilecek.",cartAriaLabel:"Sepetim",favoritesAriaLabel:"Favorilerim",historyAriaLabel:"Sohbet geçmişi",historyPageTitle:"Sohbet Geçmişi",emptyHistoryMessage:"Henüz kaydedilmiş sohbet yok.",historyDeleteLabel:"Sohbeti sil",historyDeleteConfirmMessage:"Bu sohbet geçmişten silinsin mi? Bu işlem geri alınamaz.",showPanelAriaLabel:"Sonuçları Göster",addToFavoritesLabel:"Favorilere ekle",customerReviewsTitle:"Müşteri Yorumları",togglePanelAriaLabel:"Paneli aç/kapat",chatMessagesAriaLabel:"Sohbet mesajları",suggestionsAriaLabel:"Öneriler",moreSuggestionsAriaLabel:"Daha fazla öneri",rollbackAriaLabel:"Bu mesaja geri dön",backAriaLabel:"Geri",forwardAriaLabel:"İleri",closePanelAriaLabel:"Paneli kapat",dismissAriaLabel:"Kapat",cartAddErrorMessage:"Üzgünüm sepete ekleyemedim, bir sorunla karşılaştım.",favoriteToggleErrorMessage:"Favoriler güncellenemedi. Lütfen tekrar deneyin.",reviewFilterPositive:"Olumlu",reviewFilterNegative:"Olumsuz",decreaseLabel:"Azalt",increaseLabel:"Artır",reviewCustomersMentionSingular:"1 müşteri bahsediyor",reviewCustomersMentionPlural:"müşteri bahsediyor",reviewSubjectsHeading:"İncelemek için seçin",tryAgainButton:"Tekrar dene",askSomethingElseButton:"Başka bir şey sor",accountInactiveMessage:"Bu hesap şu an aktif değil. Lütfen daha sonra tekrar deneyin.",favoritesPageTitle:"Favorilerim",emptyFavoritesMessage:"Henüz favori ürün yok. Bir ürünü kalp ikonuna tıklayarak favorilere ekleyebilirsin.",showFormerMessagesButton:"↑ Önceki mesajları göster",aiAnalysisAnalyzingLabel:"Ürünler analiz ediliyor...",aiBrowseCategoriesTitle:"Kategorilere Göz At",photoAnalysisBadge:"Cilt Analizi",photoAnalysisStrengthsLabel:"Öne Çıkanlar",photoAnalysisFocusLabel:"Odak Noktaları",photoAnalysisCelebStyleLabel:"Celeb Vibe Eşleşmesi",beautyPhotoStepTitle:"Selfie ile kişiselleştir",beautyPhotoStepDescription:"İstersen net bir profil fotoğrafı yükle, sana özel önerilerde bulunayım.",beautyPhotoStepUpload:"Fotoğraf Yükle",beautyPhotoStepProcessing:"Fotoğraf işleniyor...",beautyPhotoStepSkip:"Geç",beautyPhotoStepSkipMessage:"Fotoğraf adımını geçiyorum"}})),Ei,fl=L((()=>{Ei={headerTitle:"Product Expert",inputPlaceholder:"Search products, ask questions",sendButton:"Send",closeButton:"Close",openButton:"Open chat",newChatButton:"New chat",poweredBy:"Powered by Gengage",errorMessage:"Something went wrong. Please try again.",retryButton:"Retry",loadingMessage:"Reviewing your request...",loadingSequenceGeneric:["Reviewing your request...","Looking through products and reviews...","Reviewing the details..."],loadingSequencePanel:["Reviewing the most relevant details","Checking the strongest signals","Preparing this view for you"],loadingSequenceComparison:["Reviewing the product differences","Checking the strongest tradeoffs","Preparing your comparison"],productCtaLabel:"Buy",viewOnSiteLabel:"View on Site",attachImageButton:"Attach image",attachMenuSelectPhoto:"Choose photo",attachMenuPaste:"Paste",clipboardNoImageMessage:"No image found in clipboard. Copy an image first or choose a file.",removeAttachmentButton:"Remove image",invalidFileType:"Only JPEG, PNG and WebP files are supported.",fileTooLarge:"File must be smaller than 5 MB.",aiTopPicksTitle:"Top Picks for You",roleWinner:"Top Pick",roleBestValue:"Best Value",roleBestAlternative:"Best Alternative",viewDetails:"View Details",groundingReviewCta:"Read Reviews",groundingReviewSubtitle:"{count} reviews available",variantsLabel:"Variants",sortRelated:"Recommended",sortPriceAsc:"Price low to high",sortPriceDesc:"Price high to low",sortToolbarAriaLabel:"Sort products",compareSelected:"Compare",compareMinHint:"Select at least 2 products",compareMaxHint:"You can select up to 5 products",comparisonSelectLabel:"Select to compare",comparisonSelectedLabel:"Selected",comparisonSelectCardHint:"Tap anywhere on the card to add or remove it from comparison.",comparisonPreparingLabel:"Preparing your comparison…",panelTitleProductDetails:"Product Details",panelTitleSimilarProducts:"Similar Products",panelTitleComparisonResults:"Comparison Results",panelTitleCategories:"Categories",panelTitleSearchResults:"Search Results",inStockLabel:"In Stock",outOfStockLabel:"Out of Stock",findSimilarLabel:"Find Similar",galleryPrevAriaLabel:"Previous image",galleryNextAriaLabel:"Next image",beautyStylesPreparedTitle:"Prepared {count} recommendation directions for you",consultingOtherCompatibleProductsLabel:"Other compatible products",consultingFallbackGroupLabel:"Recommendation",consultingFallbackStyleLabel:"Style {index}",consultingStyleLoadingDescription:"I am still collecting products for this style. The panel will refresh shortly.",consultingStyleUnavailableDescription:"I could not find enough product matches for this style yet. You can review the other styles.",consultingStyleLoadingBadge:"Loading",consultingStyleUnavailableBadge:"Not ready",choicePrompterHeading:"Can't decide?",choicePrompterSuggestion:"Select products to compare them",choicePrompterCta:"Select & Compare",viewMoreLabel:"Show More",similarProductsLabel:"Similar Products",addToCartButton:"Add to Cart",addedToCartToast:"Added to cart",shareButton:"Share",productInfoTab:"Product Info",specificationsTab:"Specifications",recommendedChoiceLabel:"Recommended Choice",highlightsLabel:"Key Highlights",keyDifferencesLabel:"Key Differences",specialCasesLabel:"For Special Cases",emptyReviewsMessage:"No review summary found.",closeAriaLabel:"Close",startChatLabel:"Start Chat",voiceButton:"Voice input",voiceListening:"Listening...",voiceNotSupported:"Voice input is not supported in this browser.",voicePermissionDenied:"Microphone access denied.",voiceError:"Voice input error.",handoffHeading:"Transferring to a support agent",productNotFoundMessage:"Product information is currently unavailable. I can help with something else.",stopGenerating:"Stop generating",offlineMessage:"You're offline — messages will send when you reconnect.",cartAriaLabel:"My cart",favoritesAriaLabel:"My favorites",historyAriaLabel:"Chat history",historyPageTitle:"Chat History",emptyHistoryMessage:"You don't have any saved chats yet.",historyDeleteLabel:"Delete chat",historyDeleteConfirmMessage:"Delete this chat from history? This cannot be undone.",showPanelAriaLabel:"Show Results",addToFavoritesLabel:"Add to favorites",customerReviewsTitle:"Customer Reviews",togglePanelAriaLabel:"Toggle panel",chatMessagesAriaLabel:"Chat messages",suggestionsAriaLabel:"Suggestions",moreSuggestionsAriaLabel:"More suggestions",rollbackAriaLabel:"Rollback to this message",backAriaLabel:"Back",forwardAriaLabel:"Forward",closePanelAriaLabel:"Close panel",dismissAriaLabel:"Dismiss",cartAddErrorMessage:"Sorry, I couldn't add that to your cart. Something went wrong.",favoriteToggleErrorMessage:"We couldn't update favorites. Please try again.",reviewFilterPositive:"Positive",reviewFilterNegative:"Negative",decreaseLabel:"Decrease",increaseLabel:"Increase",reviewCustomersMentionSingular:"1 customer mentions",reviewCustomersMentionPlural:"customers mention",reviewSubjectsHeading:"Select to learn more",tryAgainButton:"Try again",askSomethingElseButton:"Ask something else",accountInactiveMessage:"This account is currently inactive. Please try again later.",favoritesPageTitle:"My Favorites",emptyFavoritesMessage:"No favorites yet. Heart a product to save it here.",showFormerMessagesButton:"↑ Show earlier messages",aiAnalysisAnalyzingLabel:"Analyzing products...",aiBrowseCategoriesTitle:"Browse categories",photoAnalysisBadge:"Skin Analysis",photoAnalysisStrengthsLabel:"Your strengths",photoAnalysisFocusLabel:"Focus points",photoAnalysisCelebStyleLabel:"Celeb style match",beautyPhotoStepTitle:"Personalize with a selfie",beautyPhotoStepDescription:"Upload a clear profile photo so I can give you personalized recommendations.",beautyPhotoStepUpload:"Upload Photo",beautyPhotoStepProcessing:"Processing photo...",beautyPhotoStepSkip:"Skip",beautyPhotoStepSkipMessage:"Skip the photo step"}}));function bl(t){return t?t.toLowerCase().split("-")[0]??"tr":"tr"}function vl(t){return bl(t)==="en"?Ei:Qe}var bt=L((()=>{ml(),fl()}));function yl(){return Pi()!==null}function Pi(){const t=globalThis;return t.SpeechRecognition??t.webkitSpeechRecognition??null}function xl(t){switch(t){case"not-allowed":return"not-allowed";case"no-speech":return"no-speech";case"audio-capture":return"no-microphone";case"network":return"network";case"aborted":return"aborted";default:return"unknown"}}var Ti,_l=L((()=>{Ti=class{constructor(t,e){this.recognition=null,this._state="idle",this.silenceTimer=null,this.accumulatedTranscript="",this.intentionalStop=!1,this._lastRestartAt=0,this.callbacks=t,this.lang=e?.lang??"tr-TR",this.silenceTimeoutMs=e?.silenceTimeoutMs??1500,this.autoSubmit=e?.autoSubmit??!0}get state(){return this._state}start(){if(this._state==="listening")return;const t=Pi();if(!t){this.setState("error"),this.callbacks.onError?.("not-supported","Web Speech API is not supported in this browser.");return}if(typeof globalThis.isSecureContext<"u"&&!globalThis.isSecureContext){this.setState("error"),this.callbacks.onError?.("not-allowed","Voice input requires HTTPS.");return}this.accumulatedTranscript="",this.intentionalStop=!1;const e=new t;e.continuous=!0,e.interimResults=!0,e.lang=this.lang,e.maxAlternatives=1,e.onstart=()=>{this.setState("listening")},e.onresult=a=>{this.clearSilenceTimer();let n="",i="";for(let r=a.resultIndex;r<a.results.length;r++){const o=a.results[r];if(!o)continue;const s=o[0];s&&(o.isFinal?i+=s.transcript:n+=s.transcript)}i&&(this.accumulatedTranscript+=i,this.callbacks.onFinal?.(this.accumulatedTranscript)),n&&this.callbacks.onInterim?.(this.accumulatedTranscript+n),this.autoSubmit&&this.accumulatedTranscript&&this.startSilenceTimer()},e.onerror=a=>{const n=xl(a.error);this.intentionalStop&&(a.error==="no-speech"||a.error==="aborted")||(this.setState("error"),this.callbacks.onError?.(n,a.message||a.error))},e.onend=()=>{if(this.clearSilenceTimer(),this._state==="listening"&&!this.intentionalStop){const a=Date.now();if(a-this._lastRestartAt<500){this.setState("idle");return}this._lastRestartAt=a;try{e.start()}catch{this.setState("idle")}return}this.setState("idle")},this.recognition=e;try{e.start()}catch{this.setState("error"),this.callbacks.onError?.("unknown","Failed to start speech recognition.")}}stop(){if(this.intentionalStop=!0,this.clearSilenceTimer(),this.recognition){try{this.recognition.stop()}catch{}this.recognition=null}return this.setState("idle"),this.accumulatedTranscript}abort(){if(this.intentionalStop=!0,this.clearSilenceTimer(),this.accumulatedTranscript="",this.recognition){try{this.recognition.abort()}catch{}this.recognition=null}this.setState("idle")}destroy(){this.abort()}setState(t){this._state!==t&&(this._state=t,this.callbacks.onStateChange?.(t))}startSilenceTimer(){this.clearSilenceTimer(),this.silenceTimer=setTimeout(()=>{const t=this.stop();t.trim()&&this.callbacks.onAutoSubmit?.(t.trim())},this.silenceTimeoutMs)}clearSilenceTimer(){this.silenceTimer!==null&&(clearTimeout(this.silenceTimer),this.silenceTimer=null)}}}));function wl(t){const e=document.createElement("div");e.className="gengage-chat-kvkk-banner gds-evidence-card gds-evidence-card-warning",e.dataset.gengagePart="kvkk-banner",e.setAttribute("role","alert");const a=document.createElement("div");a.className="gengage-chat-kvkk-content",a.dataset.gengagePart="kvkk-content",a.innerHTML=ye(t.htmlContent),e.appendChild(a);const n=document.createElement("button");return n.className="gengage-chat-kvkk-dismiss",n.dataset.gengagePart="kvkk-dismiss",n.type="button",n.setAttribute("aria-label",t.closeAriaLabel??"Close privacy notice"),n.textContent="×",n.addEventListener("click",t.onDismiss),e.appendChild(n),e}var kl=L((()=>{ge()})),Ai,Cl=L((()=>{Ai=class{constructor(t){this._el=document.createElement("div"),this._el.className="gengage-chat-panel-topbar gds-toolbar",this._el.dataset.gengagePart="panel-topbar",this._backBtn=document.createElement("button"),this._backBtn.className="gengage-chat-panel-topbar-back gds-btn gds-btn-ghost gds-icon-btn",this._backBtn.dataset.gengagePart="panel-topbar-back",this._backBtn.type="button",this._backBtn.disabled=!0,this._backBtn.setAttribute("aria-label",t.backAriaLabel??"Back"),this._backBtn.title=t.backAriaLabel??"Back",this._backBtn.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/><path d="M21 12H9"/></svg>',this._backBtn.addEventListener("click",()=>t.onBack());const e=document.createElement("div");e.className="gengage-chat-panel-topbar-title-wrap",this._titleEl=document.createElement("span"),this._titleEl.className="gengage-chat-panel-topbar-title",this._titleEl.dataset.gengagePart="panel-topbar-title",e.appendChild(this._titleEl),this._forwardBtn=document.createElement("button"),this._forwardBtn.className="gengage-chat-panel-topbar-forward gds-btn gds-btn-ghost gds-icon-btn",this._forwardBtn.dataset.gengagePart="panel-topbar-forward",this._forwardBtn.type="button",this._forwardBtn.disabled=!0,this._forwardBtn.setAttribute("aria-label",t.forwardAriaLabel??"Forward"),this._forwardBtn.title=t.forwardAriaLabel??"Forward",this._forwardBtn.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/><path d="M3 12h12"/></svg>',this._forwardBtn.addEventListener("click",()=>t.onForward()),this._actionsEl=document.createElement("div"),this._actionsEl.className="gengage-chat-panel-topbar-actions",this._actionsEl.dataset.gengagePart="panel-topbar-actions",this._closeBtn=document.createElement("button"),this._closeBtn.className="gengage-chat-panel-topbar-close gds-btn gds-btn-ghost gds-icon-btn",this._closeBtn.dataset.gengagePart="panel-topbar-close",this._closeBtn.type="button",this._closeBtn.setAttribute("aria-label",t.closePanelAriaLabel??"Close panel"),this._closeBtn.title=t.closePanelAriaLabel??"Close panel",this._closeBtn.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',this._closeBtn.addEventListener("click",()=>t.onClose?.()),this._el.appendChild(this._backBtn),this._el.appendChild(e),this._el.appendChild(this._actionsEl),this._el.appendChild(this._forwardBtn),this._el.appendChild(this._closeBtn)}update(t,e,a){this._backBtn.disabled=!t,this._forwardBtn.disabled=!e,this._backBtn.hidden=!t,this._forwardBtn.hidden=!e,this._titleEl.textContent=a,this._titleEl.title=a}getElement(){return this._el}setTitle(t){this._titleEl.textContent=t}setActions(t){this._actionsEl.replaceChildren(),t&&this._actionsEl.appendChild(t)}getTitle(){return this._titleEl.textContent??""}}}));function Sl(t){return{processing:t.processing===!0,title:typeof t.title=="string"?t.title:void 0,description:typeof t.description=="string"?t.description:void 0,uploadLabel:typeof t.upload_label=="string"?t.upload_label:void 0,skipLabel:typeof t.skip_label=="string"?t.skip_label:void 0}}function Li(t,e,a){const n=t.props??{},i=n.processing===!0,r={...Qe,...e.i18n??{}},o=document.createElement("div");o.className="gengage-chat-beauty-photo-step-card";const s=document.createElement("span");s.className="gengage-chat-beauty-photo-step-icon",s.setAttribute("aria-hidden","true"),s.textContent="✦";const c=document.createElement("div");c.className="gengage-chat-beauty-photo-step-content";const l=document.createElement("div");l.className="gengage-chat-beauty-photo-step-title",l.textContent=(typeof n.title=="string"?n.title:void 0)??r.beautyPhotoStepTitle;const d=document.createElement("p");d.className="gengage-chat-beauty-photo-step-desc",d.textContent=(typeof n.description=="string"?n.description:void 0)??r.beautyPhotoStepDescription;const g=document.createElement("div");g.className="gengage-chat-beauty-photo-step-actions";const h=document.createElement("button");h.type="button",h.className="gengage-chat-beauty-photo-step-upload gds-btn gds-btn-primary",h.textContent=i?r.beautyPhotoStepProcessing:(typeof n.upload_label=="string"?n.upload_label:void 0)??r.beautyPhotoStepUpload,h.disabled=i,a?.onUpload&&h.addEventListener("click",()=>a.onUpload());const f=document.createElement("button");return f.type="button",f.className="gengage-chat-beauty-photo-step-skip gds-btn gds-btn-ghost",f.textContent=(typeof n.skip_label=="string"?n.skip_label:void 0)??r.beautyPhotoStepSkip,a?.onSkip&&f.addEventListener("click",()=>a.onSkip()),g.appendChild(h),g.appendChild(f),c.appendChild(l),c.appendChild(d),c.appendChild(g),o.appendChild(s),o.appendChild(c),o}var Ia=L((()=>{bt()}));function El(t,e){if(t)return t;const a=document.createElement("section");a.className="gengage-chat-beauty-photo-step",a.dataset.gengagePart="chat-beauty-photo-step",a.hidden=!0;const n=e?.querySelector(".gengage-chat-input-area");return n?n.parentElement?.insertBefore(a,n):e?.appendChild(a),a}function Pl(t,e,a,n,i){if(!a.visible)return t&&(t.hidden=!0,t.innerHTML=""),t;const r=El(t,e);r.hidden=!1,r.innerHTML="";const o=Li({type:"BeautyPhotoStep",props:{processing:a.processing??!1,title:a.title,description:a.description,upload_label:a.uploadLabel,skip_label:a.skipLabel}},{i18n:n,onAction:()=>{}},{onUpload:i,onSkip:a.onSkip});return r.appendChild(o),r}var Tl=L((()=>{Ia()}));function Ii(t){const e=typeof t.summary=="string"?t.summary:"",a=Array.isArray(t.strengths)?t.strengths.filter(c=>typeof c=="string"):[],n=Array.isArray(t.focus_points)?t.focus_points.filter(c=>typeof c=="string"):[];if(!e&&a.length===0&&n.length===0)return null;const i={summary:e},r=typeof t.celeb_style=="string"?t.celeb_style:void 0,o=typeof t.celeb_style_reason=="string"?t.celeb_style_reason:void 0,s=typeof t.next_question=="string"?t.next_question:void 0;return a.length>0&&(i.strengths=a),n.length>0&&(i.focusPoints=n),r&&(i.celebStyle=r),o&&(i.celebStyleReason=o),s&&(i.nextQuestion=s),i}function Ni(t,e,a){if(e.length===0)return null;const n=document.createElement("section");n.className=`gengage-chat-photo-analysis-section ${a}`;const i=document.createElement("h4");i.className="gengage-chat-photo-analysis-section-title",i.textContent=t;const r=document.createElement("ul");r.className="gengage-chat-photo-analysis-section-list";for(const o of e){const s=document.createElement("li");s.className="gengage-chat-photo-analysis-section-item",s.textContent=o,r.appendChild(s)}return n.appendChild(i),n.appendChild(r),n}function Mi(t,e){const a=document.createElement("div");a.className="gengage-chat-photo-analysis-card";const n=document.createElement("div");n.className="gengage-chat-photo-analysis-badge",n.textContent=t.badge;const i=document.createElement("div");if(i.className="gengage-chat-photo-analysis-body",e.summary){const c=document.createElement("p");c.className="gengage-chat-photo-analysis-summary",c.textContent=e.summary,i.appendChild(c)}const r=document.createElement("div");r.className="gengage-chat-photo-analysis-highlights";const o=Ni(t.strengths,e.strengths??[],"gengage-chat-photo-analysis-section--strengths"),s=Ni(t.focus,e.focusPoints??[],"gengage-chat-photo-analysis-section--focus");if(o&&r.appendChild(o),s&&r.appendChild(s),r.childElementCount>0&&i.appendChild(r),e.celebStyle){const c=document.createElement("section");c.className="gengage-chat-photo-analysis-section gengage-chat-photo-analysis-section--celeb";const l=document.createElement("h4");l.className="gengage-chat-photo-analysis-section-title",l.textContent=t.celebStyle;const d=document.createElement("p");if(d.className="gengage-chat-photo-analysis-celeb-name",d.textContent=e.celebStyle,c.appendChild(l),c.appendChild(d),e.celebStyleReason){const g=document.createElement("p");g.className="gengage-chat-photo-analysis-celeb-reason",g.textContent=e.celebStyleReason,c.appendChild(g)}i.appendChild(c)}if(e.nextQuestion){const c=document.createElement("p");c.className="gengage-chat-photo-analysis-next",c.textContent=e.nextQuestion,i.appendChild(c)}return a.appendChild(n),a.appendChild(i),a}function Al(t){const e={...Qe,...t?.i18n??{}};return{badge:e.photoAnalysisBadge,strengths:e.photoAnalysisStrengthsLabel,focus:e.photoAnalysisFocusLabel,celebStyle:e.photoAnalysisCelebStyleLabel}}function Ll(t,e){const a=Ii(t.props??{})??{summary:""};return Mi(Al(e),a)}function Il(t,e,a){t.innerHTML="",a&&t.appendChild(Mi(e,a))}var Na=L((()=>{bt()}));async function Nl(t){for(const e of t)for(const a of e.types)if(a.startsWith("image/"))try{const n=await e.getType(a);if(!n||n.size===0)continue;const i=a||n.type||"image/png",r=i==="image/png"?"png":i==="image/webp"?"webp":"jpg",o=`paste-${Date.now()}.${r}`;return new File([n],o,{type:i})}catch{continue}for(const e of t)if(e.types.includes("text/html"))try{const a=(await(await e.getType("text/html")).text()).match(zi)?.[0];if(!a||a.length>5e6)continue;const n=await(await fetch(a)).blob();if(!n||n.size===0)continue;const i=n.type||"image/png";if(!["image/jpeg","image/png","image/webp"].includes(i))continue;const r=i==="image/png"?"png":i==="image/webp"?"webp":"jpg";return new File([n],`paste-${Date.now()}.${r}`,{type:i})}catch{continue}return null}async function Ml(t){try{const e=t??(typeof navigator.clipboard?.read=="function"?navigator.clipboard.read():null);return e?Nl(await e):null}catch{}return null}var Ma,Ba,Bi,Ri,Ra,zi,Hi,Bl=L((()=>{Si(),ge(),Ke(),bt(),_l(),It(),kl(),Cl(),Tl(),Na(),Ma='<svg viewBox="0 0 16 16" class="gengage-chat-icon"><path d="M3 8h10M9 4l4 4-4 4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',Ba={search:'<svg viewBox="0 0 16 16" class="gengage-chat-icon"><circle cx="6.5" cy="6.5" r="5" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="10" y1="10" x2="15" y2="15" stroke="currentColor" stroke-width="1.5"/></svg>',review:'<svg viewBox="0 0 16 16" class="gengage-chat-icon"><polygon points="8,1 10,6 15,6 11,9 12.5,14 8,11 3.5,14 5,9 1,6 6,6" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>',info:'<svg viewBox="0 0 16 16" class="gengage-chat-icon"><circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="1.5"/><line x1="8" y1="7" x2="8" y2="12" stroke="currentColor" stroke-width="1.5"/><circle cx="8" cy="4.5" r="0.8" fill="currentColor"/></svg>',similar:'<svg viewBox="0 0 16 16" class="gengage-chat-icon"><rect x="1" y="3" width="6" height="6" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/><rect x="9" y="3" width="6" height="6" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>'},Bi=Qe,Ri=1400,Ra=1500,zi=/data:image\/(png|jpeg|jpg|webp);base64,[A-Za-z0-9+/=]+/gi,Hi=class{_renderPhotoAnalysisCard(t,e){Il(t,{badge:this.i18n.photoAnalysisBadge,strengths:this.i18n.photoAnalysisStrengthsLabel,focus:this.i18n.photoAnalysisFocusLabel,celebStyle:this.i18n.photoAnalysisCelebStyleLabel},e)}constructor(t,e){this._sendStopHandler=null,this._panelVisible=!1,this._panelCollapsed=!1,this._onPanelToggle=void 0,this._onHostShellSync=void 0,this._pendingAttachment=null,this._onAttachment=void 0,this._onRollback=void 0,this._onLinkClick=void 0,this._userScrolledUp=!1,this._scrollLockedUntil=0,this._favBadgeEl=null,this._thinkingSteps=[],this._firstBotMessageIds=new Set,this._voiceInput=null,this._micBtn=null,this._voiceEnabled=!1,this._voiceLang="tr-TR",this._ignoreNextDividerClick=!1,this._cleanups=[],this._focusTrapHandler=null,this._previouslyFocusedElement=null,this._conversationEl=null,this._reopenPanelBtn=null,this._presentationFocusThreadId=null,this._formerMessagesBtn=null,this._programmaticScrollUntil=0,this._userInteractionUntil=0,this._touchStartY=null,this._presentationPinned=!0,this._presentationUserInteracting=!1,this._resizeRafId=null,this._cartBtn=null,this._attachWrapEl=null,this._attachMenuEl=null,this._attachBtn=null,this._attachMenuCleanup=null,this._attachMenuClickTimerId=null,this._typingLoadingBinding=null,this._panelLoadingBinding=null,this._panelAiZoneLoadingBinding=null,this._beautyPhotoStepEl=null,this._options=e,this.i18n={...Bi,...e.i18n},this.onSend=e.onSend,e.onPanelToggle!==void 0&&(this._onPanelToggle=e.onPanelToggle),e.onHostShellSync!==void 0&&(this._onHostShellSync=e.onHostShellSync),e.onAttachment!==void 0&&(this._onAttachment=e.onAttachment),e.onRollback!==void 0&&(this._onRollback=e.onRollback),e.onLinkClick!==void 0&&(this._onLinkClick=e.onLinkClick),e.voiceEnabled&&(this._voiceEnabled=!0),e.voiceLang!==void 0&&(this._voiceLang=e.voiceLang),this.root=document.createElement("div"),this.root.className="gengage-chat-drawer gds-panel",this.root.dataset.gengagePart="chat-drawer",this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-label",this.i18n.headerTitle??"Chat"),this.root.setAttribute("aria-modal","true");const a="gengage-chat-dialog-desc",n=document.createElement("span");n.id=a,n.className="gengage-sr-only",n.textContent=this.i18n.headerTitle??"AI shopping assistant",this.root.appendChild(n),this.root.setAttribute("aria-describedby",a);let i=null;{const C=document.createElement("div");C.className="gengage-chat-drawer-handle",C.dataset.gengagePart="chat-drawer-handle",C.setAttribute("aria-hidden","true"),C.style.pointerEvents="none",i=C}const r=document.createElement("div");r.className="gengage-chat-header gds-shell-header",r.dataset.gengagePart="chat-header";const o=document.createElement("div");o.className="gengage-chat-header-left",o.dataset.gengagePart="chat-header-left";const s=e.headerAvatarUrl??e.launcherImageUrl,c=typeof e.headerAvatarUrl=="string"&&e.headerAvatarUrl.length>0&&e.headerAvatarUrl!==e.launcherImageUrl;if(s){const C=document.createElement("img");C.className="gengage-chat-header-avatar",c&&C.classList.add("gengage-chat-header-avatar--logo"),C.dataset.gengagePart="chat-header-avatar",C.src=s,C.alt=e.headerTitle??"Assistant",o.appendChild(C)}const l=document.createElement("div");l.className="gengage-chat-header-info",l.dataset.gengagePart="chat-header-info";const d=document.createElement("div");d.className="gengage-chat-header-title-row",d.dataset.gengagePart="chat-header-title-row";const g=document.createElement("span");if(g.className="gengage-chat-header-title",g.dataset.gengagePart="chat-header-title",g.textContent=e.headerTitle??this.i18n.headerTitle??"Product Expert",d.appendChild(g),e.headerBadge){const C=document.createElement("span");C.className="gengage-chat-header-badge gds-badge gds-badge-brand",C.dataset.gengagePart="chat-header-badge",C.textContent=e.headerBadge,d.appendChild(C)}l.appendChild(d);const h=document.createElement("a");h.className="gengage-chat-header-powered",h.dataset.gengagePart="chat-header-powered-by",h.href="https://gengage.ai/",h.target="_blank",h.rel="noopener noreferrer",h.innerHTML=`<svg viewBox="0 0 15 15" fill="none" aria-hidden="true"><path d="M15 5.88941C12.2201 5.88941 9.72762 7.14107 8.05571 9.11059H0C2.77991 9.11059 5.27238 7.85893 6.94429 5.88941H15Z" fill="currentColor"/><path d="M9.10964 0C9.10964 2.24394 8.29524 4.30038 6.94429 5.88941C5.27238 7.85962 2.77922 9.11059 0 9.11059V5.88941C3.24802 5.88941 5.89036 3.2465 5.89036 0H9.10964Z" fill="currentColor" fill-opacity="0.68"/><path d="M15 5.88941V9.11059C11.752 9.11059 9.10964 11.7535 9.10964 15H5.89036C5.89036 12.7561 6.70476 10.6996 8.05571 9.11059C9.72762 7.14038 12.2208 5.88941 15 5.88941Z" fill="currentColor" fill-opacity="0.68"/></svg>${this.i18n.poweredBy}`,l.appendChild(h),o.appendChild(l),r.appendChild(o);const f=document.createElement("div");f.className="gengage-chat-header-right",f.dataset.gengagePart="chat-header-actions";{const C=document.createElement("button");C.type="button",C.className="gengage-chat-header-btn gengage-chat-header-btn--reopen-panel gds-btn gds-btn-ghost gds-icon-btn",C.dataset.gengagePart="chat-header-reopen-panel",C.setAttribute("aria-label",this.i18n.showPanelAriaLabel),C.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="3" x2="9" y2="21"/></svg>',C.addEventListener("click",()=>this._showMobilePanelFromBtn()),f.appendChild(C),this._reopenPanelBtn=C}if(e.headerCartUrl||e.onCartClick){const C=document.createElement("button");C.type="button",C.className="gengage-chat-header-btn gengage-chat-header-btn--cart gds-btn gds-btn-ghost gds-icon-btn",C.dataset.gengagePart="chat-header-cart",C.setAttribute("aria-label",this.i18n.cartAriaLabel),C.title=this.i18n.cartAriaLabel,C.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>',C.addEventListener("click",()=>e.onCartClick?.()),f.appendChild(C),this._cartBtn=C}if(e.onHistoryClick){const C=document.createElement("button");C.type="button",C.className="gengage-chat-header-btn gengage-chat-header-btn--history gds-btn gds-btn-ghost gds-icon-btn",C.dataset.gengagePart="chat-header-history",C.setAttribute("aria-label",this.i18n.historyAriaLabel),C.title=this.i18n.historyAriaLabel,C.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 8v5l3 2"/><path d="M3.05 11A9 9 0 1 1 5 17.5"/><path d="M3 8v4h4"/></svg>',C.addEventListener("click",()=>e.onHistoryClick?.()),f.appendChild(C)}if(e.onNewChat){const C=document.createElement("button");C.className="gengage-chat-header-btn gengage-chat-new-chat gds-btn gds-btn-ghost gds-icon-btn",C.dataset.gengagePart="chat-header-new-chat",C.type="button",C.setAttribute("aria-label",this.i18n.newChatButton),C.title=this.i18n.newChatButton,C.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>',C.addEventListener("click",()=>e.onNewChat?.()),f.appendChild(C)}const b=document.createElement("button");if(b.className="gengage-chat-close gds-btn gds-btn-ghost gds-icon-btn",b.dataset.gengagePart="chat-header-close",b.type="button",b.setAttribute("aria-label",this.i18n.closeButton),b.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',b.addEventListener("click",e.onClose),e.showHeaderFavorites){const C=document.createElement("button");C.className="gengage-chat-header-btn gengage-chat-header-btn--fav gds-btn gds-btn-ghost gds-icon-btn",C.dataset.gengagePart="chat-header-favorites",C.type="button",C.setAttribute("aria-label",this.i18n.favoritesAriaLabel),C.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>';const A=document.createElement("span");A.className="gengage-chat-header-fav-badge",A.dataset.gengagePart="chat-header-favorites-badge",A.setAttribute("aria-hidden","true"),A.style.display="none",C.appendChild(A),this._favBadgeEl=A,C.addEventListener("click",()=>{e.onFavoritesClick?.()}),f.appendChild(C)}f.appendChild(b),i&&r.insertBefore(i,r.firstChild),r.appendChild(f);{let A=0,z=0,Z=!1;const re=G=>{if(!(this._options.getMobileViewport?.()??window.innerWidth<=768)||G.target.closest('button, a, input, [role="button"]'))return;const Y=G.changedTouches?.[0];Y&&(A=Y.clientY,z=0,Z=!0,this.root.style.transition="none")},ce=G=>{if(!Z)return;const Y=G.changedTouches?.[0];if(!Y)return;z=Y.clientY-A;const X=(e.getMobileState?.()??"full")==="full"?Math.max(0,z):z;G.preventDefault(),this.root.style.transform=`translateY(${X}px)`},fe=()=>{if(!Z)return;Z=!1;const G=e.getMobileState?.()??"full";let Y;z>72?Y=G==="full"?"half":"close":z<-72&&G==="half"?Y="full":Y=G,this.root.style.transition="",Y==="close"?(this.root.style.transform="translateY(100%)",setTimeout(()=>{this.root.style.transform="",e.onMobileSnap?.("close")},280)):(this.root.style.transform="",e.onMobileSnap?.(Y)),z=0},H=()=>{Z&&(Z=!1,z=0,this.root.style.transition="",this.root.style.transform="")};r.addEventListener("touchstart",re,{passive:!0}),r.addEventListener("touchmove",ce,{passive:!1}),r.addEventListener("touchend",fe,{passive:!0}),r.addEventListener("touchcancel",H,{passive:!0}),this._cleanups.push(()=>{r.removeEventListener("touchstart",re),r.removeEventListener("touchmove",ce),r.removeEventListener("touchend",fe),r.removeEventListener("touchcancel",H)})}const m=document.createElement("div");m.className="gengage-chat-body",m.dataset.gengagePart="chat-body",this._panelEl=document.createElement("div"),this._panelEl.className="gengage-chat-panel gds-panel",this._panelEl.dataset.gengagePart="chat-panel",this._panelTopBar=new Ai({onBack:()=>e.onPanelBack?.(),onForward:()=>e.onPanelForward?.(),onClose:()=>{e.getMobileViewport?.()??!1?this.hideMobilePanel():this.clearPanel(),e.onPanelClose?.()},backAriaLabel:this.i18n.backAriaLabel,forwardAriaLabel:this.i18n.forwardAriaLabel,closePanelAriaLabel:this.i18n.closePanelAriaLabel}),this._panelEl.appendChild(this._panelTopBar.getElement());const u=()=>this._updateScrollAffordance();this._panelEl.addEventListener("scroll",u,{passive:!0}),this._cleanups.push(()=>this._panelEl.removeEventListener("scroll",u)),m.appendChild(this._panelEl),this._dividerEl=document.createElement("div"),this._dividerEl.className="gengage-chat-panel-divider gengage-chat-panel-divider--hidden",this._dividerEl.dataset.gengagePart="chat-panel-divider",this._dividerEl.setAttribute("role","separator"),this._dividerEl.setAttribute("aria-label",this.i18n.togglePanelAriaLabel),this._dividerEl.setAttribute("title",this.i18n.togglePanelAriaLabel);const p=document.createElement("button");p.className="gengage-chat-panel-divider-toggle gds-btn gds-btn-ghost",p.dataset.gengagePart="chat-panel-divider-toggle",p.type="button",p.setAttribute("aria-label",this.i18n.togglePanelAriaLabel),p.setAttribute("title",this.i18n.togglePanelAriaLabel),p.textContent="»",p.addEventListener("click",()=>{if(this._ignoreNextDividerClick){this._ignoreNextDividerClick=!1;return}this.togglePanel(),this._onPanelToggle?.()});let y=null,_=null;const x=24,P=C=>{if(!(this._options.getMobileViewport?.()??window.innerWidth<=768))return;const A=C.changedTouches?.[0];A&&(y=A.clientX,_=A.clientY)},E=C=>{if(!(this._options.getMobileViewport?.()??window.innerWidth<=768)||y===null||_===null)return;const A=C.changedTouches?.[0];if(!A)return;const z=A.clientX-y,Z=A.clientY-_;if(y=null,_=null,Math.abs(Z)<x||Math.abs(Z)<Math.abs(z))return;const re=Z<0;re!==this._panelCollapsed&&(this._ignoreNextDividerClick=!0,this.setPanelCollapsed(re),this._onPanelToggle?.())};this._dividerEl.addEventListener("touchstart",P,{passive:!0}),this._dividerEl.addEventListener("touchend",E,{passive:!0}),this._cleanups.push(()=>{this._dividerEl.removeEventListener("touchstart",P),this._dividerEl.removeEventListener("touchend",E)}),this._dividerEl.appendChild(p),m.appendChild(this._dividerEl);const w=document.createElement("div");w.className="gengage-chat-conversation",w.dataset.gengagePart="chat-conversation",this._conversationEl=w,w.appendChild(r);const T=document.createElement("div");T.className="gengage-chat-offline-bar gds-evidence-card gds-evidence-card-warning",T.dataset.gengagePart="chat-offline-bar",T.setAttribute("role","status"),T.setAttribute("aria-live","polite"),T.textContent=this.i18n.offlineMessage,typeof navigator<"u"&&!navigator.onLine&&T.classList.add("gengage-chat-offline-bar--visible"),w.appendChild(T);const F=()=>T.classList.add("gengage-chat-offline-bar--visible"),Q=()=>T.classList.remove("gengage-chat-offline-bar--visible");window.addEventListener("offline",F),window.addEventListener("online",Q),this._cleanups.push(()=>{window.removeEventListener("offline",F),window.removeEventListener("online",Q)}),this._kvkkSlot=document.createElement("div"),this._kvkkSlot.className="gengage-chat-kvkk-slot",this._kvkkSlot.dataset.gengagePart="chat-kvkk-slot",w.appendChild(this._kvkkSlot),this.messagesEl=document.createElement("div"),this.messagesEl.id=ft,this.messagesEl.className="gengage-chat-messages",this.messagesEl.dataset.gengagePart="chat-messages",this.messagesEl.setAttribute("role","log"),this.messagesEl.setAttribute("aria-live","polite"),this.messagesEl.setAttribute("aria-atomic","false"),this.messagesEl.setAttribute("aria-label",this.i18n.chatMessagesAriaLabel),ki(this.messagesEl);const J=document.createElement("button");J.type="button",J.className="gengage-chat-former-messages-btn gds-chip",J.dataset.gengagePart="chat-former-messages-button",J.textContent=this.i18n.showFormerMessagesButton,J.setAttribute("aria-label",this.i18n.showFormerMessagesButton),J.style.display="none",J.addEventListener("click",()=>{this._options.presentation?.onReleasePresentationFocus?.()}),this.messagesEl.appendChild(J),this._formerMessagesBtn=J;const oe=()=>{this._userInteractionUntil=Date.now()+2e3};let U=!1;const S=()=>this._options.presentation,B=()=>{U||(U=!0,requestAnimationFrame(()=>{U=!1;const{scrollTop:C,scrollHeight:A,clientHeight:z}=this.messagesEl,Z=A-C-z;this._userScrolledUp=Z>10;const re=this._presentationPinned?Z<96:Z<32,ce=Date.now(),fe=ce<this._programmaticScrollUntil,H=!re&&ce<this._userInteractionUntil,G=fe?!1:H;re!==this._presentationPinned&&(this._presentationPinned=re,S()?.onPinnedToBottomChange?.(re)),G!==this._presentationUserInteracting&&(this._presentationUserInteracting=G,S()?.onUserInteractingChange?.(G))}))};this.messagesEl.addEventListener("scroll",B,{passive:!0}),this._cleanups.push(()=>{this.messagesEl.removeEventListener("scroll",B)});const k=C=>{oe(),C.deltaY<-6&&this._presentationFocusThreadId&&this._options.presentation?.onFormerMessagesHint?.()};this.messagesEl.addEventListener("wheel",k,{passive:!0}),this._cleanups.push(()=>this.messagesEl.removeEventListener("wheel",k));const M=C=>{oe(),this._touchStartY=C.touches[0]?.clientY??null},W=C=>{oe();const A=C.touches[0]?.clientY,z=this._touchStartY;typeof A=="number"&&typeof z=="number"&&A-z>10&&this._presentationFocusThreadId&&this._options.presentation?.onFormerMessagesHint?.()};this.messagesEl.addEventListener("touchstart",M,{passive:!0}),this.messagesEl.addEventListener("touchmove",W,{passive:!0}),this._cleanups.push(()=>{this.messagesEl.removeEventListener("touchstart",M),this.messagesEl.removeEventListener("touchmove",W)}),w.appendChild(this.messagesEl),this._panelFloatingEl=document.createElement("div"),this._panelFloatingEl.className="gengage-chat-panel-float",this._panelFloatingEl.dataset.gengagePart="chat-panel-floating-layer",this._panelEl.appendChild(this._panelFloatingEl),this._resetPanelAiZoneElement(),this._pillsEl=document.createElement("div"),this._pillsEl.className="gengage-chat-pills",this._pillsEl.dataset.gengagePart="chat-suggestion-pills",this._pillsEl.setAttribute("role","toolbar"),this._pillsEl.setAttribute("aria-label",this.i18n.suggestionsAriaLabel),this._pillsEl.style.display="none";const $=document.createElement("div");$.className="gengage-chat-pills-scroll",$.dataset.gengagePart="chat-suggestion-pills-scroll",this._pillsEl.appendChild($);const D=document.createElement("button");D.className="gengage-chat-pills-arrow gds-btn gds-btn-ghost",D.dataset.gengagePart="chat-suggestion-pills-more",D.type="button",D.setAttribute("aria-label",this.i18n.moreSuggestionsAriaLabel),D.textContent="›",D.addEventListener("click",()=>{$.scrollBy({left:150,behavior:"smooth"})}),this._pillsEl.appendChild(D);let ae=!1;const ne=()=>{ae||(ae=!0,requestAnimationFrame(()=>{ae=!1;const C=$.scrollLeft+$.clientWidth>=$.scrollWidth-4;D.style.display=C?"none":""}))};$.addEventListener("scroll",ne,{passive:!0}),this._cleanups.push(()=>{$.removeEventListener("scroll",ne)}),w.appendChild(this._pillsEl),this._inputChipsEl=document.createElement("div"),this._inputChipsEl.className="gengage-chat-input-chips",this._inputChipsEl.dataset.gengagePart="chat-input-chips",this._inputChipsEl.style.display="none",w.appendChild(this._inputChipsEl);const V=document.createElement("div");V.className="gengage-chat-input-area",V.dataset.gengagePart="chat-input-area",this.inputEl=document.createElement("textarea"),this.inputEl.className="gengage-chat-input",this.inputEl.dataset.gengagePart="chat-input",this.inputEl.rows=1,this.inputEl.placeholder=this.i18n.inputPlaceholder,this.inputEl.addEventListener("input",()=>{this._resizeRafId!==null&&cancelAnimationFrame(this._resizeRafId),this._resizeRafId=requestAnimationFrame(()=>{this._resizeRafId=null,this.inputEl.style.height="auto",this.inputEl.style.height=`${Math.min(this.inputEl.scrollHeight,120)}px`}),this._updateSendEnabled()}),this.inputEl.addEventListener("keydown",C=>{C.key==="Enter"&&!C.isComposing&&((this._options.getMobileViewport?.()??window.innerWidth<=768)||!C.shiftKey)&&(C.preventDefault(),this._submit())}),this.inputEl.addEventListener("paste",C=>{const A=C.clipboardData;if(!A)return;let z=null;const Z=A.files?.[0];if(Z&&Z.type.startsWith("image/"))z=Z;else if(A.items?.length)for(let re=0;re<A.items.length;re++){const ce=A.items[re];if(ce?.kind==="file"&&ce.type.startsWith("image/")){const fe=ce.getAsFile();if(fe){z=fe;break}}}z&&(C.preventDefault(),this._routeAttachmentFile(z))}),this._fileInput=document.createElement("input"),this._fileInput.type="file",this._fileInput.accept="image/jpeg,image/png,image/webp",this._fileInput.style.display="none",this._fileInput.addEventListener("change",()=>{const C=this._fileInput.files?.[0];C&&this._routeAttachmentFile(C),this._fileInput.value=""});const v=document.createElement("div");v.className="gengage-chat-attach-wrap",v.dataset.gengagePart="chat-attach-wrap",this._attachWrapEl=v;const N=document.createElement("button");this._attachBtn=N,N.className="gengage-chat-attach-btn gds-btn gds-btn-ghost",N.dataset.gengagePart="chat-attach-button",N.type="button",N.setAttribute("aria-label",this.i18n.attachImageButton),N.setAttribute("aria-haspopup","menu"),N.setAttribute("aria-expanded","false"),N.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>',N.addEventListener("click",C=>{C.stopPropagation(),this._toggleAttachMenu()});const I=document.createElement("div");this._attachMenuEl=I,I.className="gengage-chat-attach-menu gds-menu",I.dataset.gengagePart="chat-attach-menu",I.setAttribute("role","menu"),I.setAttribute("hidden","");const R=document.createElement("button");R.type="button",R.className="gengage-chat-attach-menu-item gds-btn gds-btn-ghost",R.dataset.gengagePart="chat-attach-menu-select-photo",R.setAttribute("role","menuitem"),R.innerHTML=`<span class="gengage-chat-attach-menu-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg></span><span class="gengage-chat-attach-menu-label">${this.i18n.attachMenuSelectPhoto}</span>`,R.addEventListener("click",C=>{C.stopPropagation(),this._closeAttachMenu(),this._fileInput.click()});const O=document.createElement("div");O.className="gengage-chat-attach-menu-sep",O.dataset.gengagePart="chat-attach-menu-separator",O.setAttribute("aria-hidden","true");const q=document.createElement("button");q.type="button",q.className="gengage-chat-attach-menu-item gds-btn gds-btn-ghost",q.dataset.gengagePart="chat-attach-menu-paste",q.setAttribute("role","menuitem"),q.innerHTML=`<span class="gengage-chat-attach-menu-icon" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H9a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1Z"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"/><path d="M16 4h2a2 2 0 0 1 2 2v4"/><path d="M21 14H11"/><path d="m15 10-4 4 4 4"/></svg></span><span class="gengage-chat-attach-menu-label">${this.i18n.attachMenuPaste}</span>`,q.addEventListener("click",C=>{C.stopPropagation();const A=typeof navigator.clipboard?.read=="function"?navigator.clipboard.read():void 0;this._pasteImageFromClipboardMenu(A)}),I.appendChild(R),I.appendChild(O),I.appendChild(q),v.appendChild(N),v.appendChild(I),this._previewStrip=document.createElement("div"),this._previewStrip.className="gengage-chat-attachment-preview gengage-chat-attachment-preview--hidden gds-card-soft",this._previewStrip.dataset.gengagePart="chat-attachment-preview";const j=document.createElement("img");j.className="gengage-chat-attachment-preview-thumb",j.dataset.gengagePart="chat-attachment-preview-thumb",j.alt="",this._previewName=document.createElement("span"),this._previewName.className="gengage-chat-attachment-name",this._previewName.dataset.gengagePart="chat-attachment-preview-name";const ee=document.createElement("button");ee.className="gengage-chat-attachment-remove gds-btn gds-btn-ghost",ee.dataset.gengagePart="chat-attachment-preview-remove",ee.type="button",ee.setAttribute("aria-label",this.i18n.removeAttachmentButton),ee.textContent="×",ee.addEventListener("click",()=>this.clearAttachment()),this._previewStrip.appendChild(j),this._previewStrip.appendChild(this._previewName),this._previewStrip.appendChild(ee),this.sendBtn=document.createElement("button"),this.sendBtn.className="gengage-chat-send gds-btn gds-btn-primary",this.sendBtn.dataset.gengagePart="chat-send",this.sendBtn.type="button",this.sendBtn.disabled=!0,this.sendBtn.setAttribute("aria-label",this.i18n.sendButton),this.sendBtn.dataset.tooltip=this.i18n.sendButton,this._renderSendButtonIcon("send"),this.sendBtn.addEventListener("click",()=>{if(this._sendStopHandler){const C=this._sendStopHandler;this.hideStopButton(),C();return}this._submit()}),V.addEventListener("dragover",C=>{C.preventDefault(),V.classList.add("gengage-chat-input-area--dragover")}),V.addEventListener("dragleave",()=>{V.classList.remove("gengage-chat-input-area--dragover")}),V.addEventListener("drop",C=>{C.preventDefault(),V.classList.remove("gengage-chat-input-area--dragover");const A=C.dataTransfer?.files[0];A&&this._routeAttachmentFile(A)});const K=document.createElement("div");K.className="gengage-chat-input-pill gds-input-shell",K.dataset.gengagePart="chat-input-shell",K.appendChild(v),K.appendChild(this.inputEl),this._voiceEnabled&&yl()&&(this._micBtn=document.createElement("button"),this._micBtn.className="gengage-chat-mic-btn gds-btn gds-btn-ghost",this._micBtn.dataset.gengagePart="chat-mic-button",this._micBtn.type="button",this._micBtn.setAttribute("aria-label",this.i18n.voiceButton),this._micBtn.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/></svg>',this._micBtn.addEventListener("click",()=>this._toggleVoice()),K.appendChild(this._micBtn),this._voiceInput=new Ti({onInterim:C=>{this._resizeRafId!==null&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this.inputEl.value=C,this.inputEl.style.height="auto",this.inputEl.style.height=`${Math.min(this.inputEl.scrollHeight,120)}px`},onFinal:C=>{this.inputEl.value=C},onAutoSubmit:C=>{this.inputEl.value=C,this._micBtn?.classList.remove("gengage-chat-mic-btn--active"),this._submit()},onStateChange:C=>{C==="listening"?this._micBtn?.classList.add("gengage-chat-mic-btn--active"):this._micBtn?.classList.remove("gengage-chat-mic-btn--active")},onError:(C,A)=>{this._micBtn?.classList.remove("gengage-chat-mic-btn--active")}},{lang:this._voiceLang})),K.appendChild(this.sendBtn),V.appendChild(this._previewStrip),V.appendChild(this._fileInput),V.appendChild(K),w.appendChild(V),m.appendChild(w),this._comparisonDockSlotEl=document.createElement("div"),this._comparisonDockSlotEl.className="gengage-chat-comparison-dock-slot",this._comparisonDockSlotEl.dataset.gengagePart="comparison-dock-slot",m.appendChild(this._comparisonDockSlotEl),this.root.appendChild(m),this._setupHorizontalSwipe(w);const se=document.createElement("div");se.className="gengage-chat-footer",se.dataset.gengagePart="chat-footer",se.textContent=this.i18n.poweredBy,this.root.appendChild(se);const me=C=>{C.key==="Escape"&&e.onClose()};this.root.addEventListener("keydown",me),this._cleanups.push(()=>this.root.removeEventListener("keydown",me)),t.appendChild(this.root)}addMessage(t){const e=this._options.renderMessageUISpec?.(t)??null;if(!(t.content||t.attachment||e||t.role==="user"&&this._onRollback))return;const a=document.createElement("div");if(a.className=`gengage-chat-bubble gds-message ${t.role==="assistant"?"gds-message-assistant":"gds-message-user"} gengage-chat-bubble--${t.role}`,a.dataset.gengagePart=t.role==="assistant"?"chat-message-assistant":"chat-message-user",a.setAttribute("role","listitem"),a.dataset.messageId=t.id,t.threadId&&(a.dataset.threadId=t.threadId),this._firstBotMessageIds.has(t.id)&&a.classList.add("gengage-chat-bubble--first"),t.attachment){const n=document.createElement("img");n.className="gengage-chat-attachment-thumb";const i=URL.createObjectURL(t.attachment);n.src=i,n.alt=t.attachment.name,n.addEventListener("load",()=>URL.revokeObjectURL(i),{once:!0}),n.addEventListener("error",()=>URL.revokeObjectURL(i),{once:!0}),a.insertBefore(n,a.firstChild)}if(t.content){const n=document.createElement("div");if(n.className="gengage-chat-bubble-text",n.dataset.gengagePart="chat-message-text",t.role==="assistant"){if(t.renderHint==="photo_analysis"?(a.classList.add("gengage-chat-bubble--photo-analysis"),this._renderPhotoAnalysisCard(n,t.photoAnalysis)):n.innerHTML=ye(t.content),this._onLinkClick){const i=n.querySelectorAll("a[href]");for(const r of i)r.addEventListener("click",o=>{o.preventDefault();const s=r.getAttribute("href");s&&this._onLinkClick?.(s)})}}else n.textContent=t.content;a.appendChild(n)}if(e&&(a.classList.add("gengage-chat-bubble--ui-spec"),t.content||a.classList.add("gengage-chat-bubble--ui-spec-only"),e.classList.add("gengage-chat-bubble-ui-spec"),(e.classList.contains("gengage-chat-panel-restore-card")||e.querySelector(".gengage-chat-panel-restore-card")!==null)&&a.classList.add("gengage-chat-bubble--panel-restore"),a.appendChild(e)),t.role==="user"&&this._onRollback){const n=document.createElement("button");n.className="gengage-chat-rollback-btn gds-btn gds-btn-ghost",n.dataset.gengagePart="chat-message-rollback",n.type="button",n.setAttribute("aria-label",this.i18n.rollbackAriaLabel),n.title=this.i18n.rollbackAriaLabel,n.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg>',n.addEventListener("click",i=>{i.stopPropagation(),this._onRollback?.(t.id)}),a.appendChild(n)}this.messagesEl.appendChild(a),this._presentationFocusThreadId&&this._applyPresentationCollapsed(),this._scrollToBottom(t.role==="user")}removeMessageBubble(t){this._firstBotMessageIds.delete(t),this.messagesEl.querySelector(`[data-message-id="${ve(t)}"]`)?.remove(),this._presentationFocusThreadId&&this._applyPresentationCollapsed()}showTypingIndicator(t,e="auto"){this.removeTypingIndicator();const a=this._thinkingSteps.length>0?this._thinkingSteps.slice(-3):t?[t]:this.i18n.loadingSequenceGeneric,{root:n,binding:i}=this._createLoadingSequence("chat",a,"chat-typing-indicator","gengage-chat-typing");n.dataset.typing="true",this._typingLoadingBinding=i,this.messagesEl.appendChild(n),this.setTypingIndicatorMode(e),this._scrollToBottom(!0)}addThinkingStep(t){const e=t.trim();e&&this._thinkingSteps[this._thinkingSteps.length-1]!==e&&(this._thinkingSteps.push(e),this._thinkingSteps=this._thinkingSteps.slice(-3),this._typingLoadingBinding&&this._applyLoadingSteps(this._typingLoadingBinding,this._thinkingSteps,!0),this._panelLoadingBinding&&this._applyLoadingSteps(this._panelLoadingBinding,this._thinkingSteps,!0),this._panelAiZoneLoadingBinding&&this._applyLoadingSteps(this._panelAiZoneLoadingBinding,this._thinkingSteps,!0))}setThinkingSteps(t){const e=t.map(a=>a.trim()).filter(Boolean).slice(-3);e.length!==0&&(this._thinkingSteps=e,this._typingLoadingBinding&&this._applyLoadingSteps(this._typingLoadingBinding,this._thinkingSteps,!0),this._panelLoadingBinding&&this._applyLoadingSteps(this._panelLoadingBinding,this._thinkingSteps,!0),this._panelAiZoneLoadingBinding&&this._applyLoadingSteps(this._panelAiZoneLoadingBinding,this._thinkingSteps,!0))}removeTypingIndicator(){this._destroyLoadingBinding(this._typingLoadingBinding),this._typingLoadingBinding=null,this.messagesEl.querySelector(".gengage-chat-typing")?.remove(),this._thinkingSteps=[],this.hideStopButton()}setTypingIndicatorMode(t){const e=this.messagesEl.querySelector(".gengage-chat-typing"),a=this._typingLoadingBinding;if(!e||!a)return;const n=t==="auto"?this._panelOwnsProgressSurface()?"presence":"full":t;e.dataset.progressMode!==n&&(e.classList.toggle("gengage-chat-typing--presence",n==="presence"),e.dataset.progressMode=n,n==="presence"?(a.labelEl.setAttribute("aria-hidden","true"),a.labelEl.classList.add("gengage-sr-only"),e.setAttribute("aria-label",this.i18n.loadingMessage)):(a.labelEl.removeAttribute("aria-hidden"),a.labelEl.classList.remove("gengage-sr-only"),e.removeAttribute("aria-label")))}_panelOwnsProgressSurface(){return(this._options.getMobileViewport?.()??window.innerWidth<=768)||!this._panelVisible||this._panelCollapsed?!1:this._panelLoadingBinding!==null||this._panelAiZoneLoadingBinding!==null}showStopButton(t){this._sendStopHandler=t,this.sendBtn.disabled=!1,this.sendBtn.classList.add("gengage-chat-send--stop","gds-btn-secondary"),this.sendBtn.classList.remove("gds-btn-primary"),this.sendBtn.setAttribute("aria-label",this.i18n.stopGenerating),this.sendBtn.dataset.tooltip=this.i18n.stopGenerating,this._renderSendButtonIcon("stop")}hideStopButton(){this._sendStopHandler=null,this.sendBtn.classList.remove("gengage-chat-send--stop","gds-btn-secondary"),this.sendBtn.classList.add("gds-btn-primary"),this.sendBtn.setAttribute("aria-label",this.i18n.sendButton),this.sendBtn.dataset.tooltip=this.i18n.sendButton,this._renderSendButtonIcon("send"),this._updateSendEnabled()}showError(t,e){const a=document.createElement("div");a.className="gengage-chat-error",a.setAttribute("role","alert");const n=document.createElement("span");if(n.textContent=t??this.i18n.errorMessage,a.appendChild(n),e){const i=document.createElement("button");i.className="gengage-chat-error-retry",i.textContent=this.i18n.retryButton??"Retry",i.addEventListener("click",()=>{a.remove(),e()}),a.appendChild(i)}this.messagesEl.appendChild(a),this._scrollToBottom(!0)}showErrorWithRecovery(t,e){this.showError(t),this.setRecoveryPills(e)}showRecoveryPillsOnly(t){this.setRecoveryPills(t)}setRecoveryPills(t){this.setPills([{label:this.i18n.tryAgainButton,onAction:t.onRetry},{label:this.i18n.askSomethingElseButton,onAction:t.onNewQuestion}])}clearMessages(){const t=this._formerMessagesBtn;for(const e of[...this.messagesEl.children])e!==t&&e.remove()}setPills(t){const e=this._pillsEl.querySelector(".gengage-chat-pills-scroll");if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);if(t.length===0){this._pillsEl.style.display="none";return}this._pillsEl.style.display="";for(const n of t){const i=document.createElement("button");if(i.className=n.image?"gengage-chat-pill gds-chip gds-chip-active gengage-chat-pill--rich":"gengage-chat-pill gds-chip gds-chip-active",i.type="button",n.icon){const o=Ba[n.icon]??Ma,s=document.createElement("span");s.className="gengage-chat-pill-icon",s.innerHTML=o,i.appendChild(s)}if(n.image&&we(n.image)){const o=document.createElement("img");o.className="gengage-chat-pill-img",o.src=n.image,o.alt="",i.appendChild(o)}const r=document.createElement("span");if(r.className="gengage-chat-pill-text",r.textContent=n.label,i.appendChild(r),n.description){const o=document.createElement("span");o.className="gengage-chat-pill-desc";const s=`pill-desc-${Math.random().toString(36).slice(2,9)}`;o.id=s,o.textContent=n.description,i.appendChild(o),i.setAttribute("aria-describedby",s)}i.addEventListener("click",()=>n.onAction()),e.appendChild(i)}const a=this._pillsEl.querySelector(".gengage-chat-pills-arrow");a&&requestAnimationFrame(()=>{a.style.display=e.scrollWidth>e.clientWidth?"":"none"})}focusInput(){this.inputEl.focus()}showKvkkBanner(t,e){this._kvkkSlot.innerHTML="";const a=wl({htmlContent:t,onDismiss:e,closeAriaLabel:this.i18n.closeAriaLabel});this._kvkkSlot.appendChild(a)}hideKvkkBanner(){this._kvkkSlot.innerHTML=""}isKvkkBannerVisible(){return this._kvkkSlot.childNodes.length>0}getElement(){return this.root}openAttachmentPicker(){this._fileInput.click()}setAttachmentControlsVisible(t){this._attachWrapEl&&(this._attachWrapEl.style.display=t?"":"none",t||this._closeAttachMenu())}setBeautyPhotoStepCard(t){this._beautyPhotoStepEl=Pl(this._beautyPhotoStepEl,this._conversationEl??null,t,this.i18n,()=>this.openAttachmentPicker())}stageAttachment(t){this._pendingAttachment=t,this._previewName.textContent=t.name;const e=this._previewStrip.querySelector(".gengage-chat-attachment-preview-thumb");e&&(e.src&&e.src.startsWith("blob:")&&URL.revokeObjectURL(e.src),e.src=URL.createObjectURL(t)),this._previewStrip.classList.remove("gengage-chat-attachment-preview--hidden"),this._updateSendEnabled()}clearAttachment(){const t=this._previewStrip.querySelector(".gengage-chat-attachment-preview-thumb");t?.src&&(URL.revokeObjectURL(t.src),t.src=""),this._pendingAttachment=null,this._previewStrip.classList.add("gengage-chat-attachment-preview--hidden"),this._updateSendEnabled()}_routeAttachmentFile(t){if(this._onAttachment)try{this._onAttachment(t)}catch(e){console.error("[gengage:chat] Attachment callback error:",e)}else this.stageAttachment(t)}_closeAttachMenu(){this._attachMenuEl&&(this._attachMenuEl.setAttribute("hidden",""),this._attachBtn?.setAttribute("aria-expanded","false"),this._attachMenuClickTimerId!==null&&(clearTimeout(this._attachMenuClickTimerId),this._attachMenuClickTimerId=null),this._attachMenuCleanup&&(this._attachMenuCleanup(),this._attachMenuCleanup=null))}_openAttachMenu(){if(!this._attachMenuEl)return;this._attachMenuEl.removeAttribute("hidden"),this._attachBtn?.setAttribute("aria-expanded","true");const t=a=>{this._attachWrapEl?.contains(a.target)||this._closeAttachMenu()},e=a=>{a.key==="Escape"&&(a.stopPropagation(),this._closeAttachMenu())};this._attachMenuClickTimerId=window.setTimeout(()=>{this._attachMenuClickTimerId=null,document.addEventListener("click",t,!0)},0),document.addEventListener("keydown",e,!0),this._attachMenuCleanup=()=>{document.removeEventListener("click",t,!0),document.removeEventListener("keydown",e,!0)}}_toggleAttachMenu(){this._attachMenuEl&&(this._attachMenuEl.hasAttribute("hidden")?this._openAttachMenu():this._closeAttachMenu())}async _pasteImageFromClipboardMenu(t){const e=await Ml(t);if(e){this._routeAttachmentFile(e),this._closeAttachMenu();return}ue("gengage:global:error",{message:this.i18n.clipboardNoImageMessage,source:"chat"}),this._closeAttachMenu()}getPendingAttachment(){return this._pendingAttachment}setPanelAiZoneState(t,e){if(this._panelAiZoneEl.isConnected&&(this._clearPanelAiZoneState(),t!=="hidden")){if(this._panelAiZoneEl.removeAttribute("hidden"),t==="analyzing"){this._panelAiZoneEl.innerHTML="";const a=[e?.analyzingLabel??this.i18n.aiAnalysisAnalyzingLabel,...this.i18n.loadingSequencePanel],{root:n,binding:i}=this._createLoadingSequence("panel",this._thinkingSteps.length>0?this._thinkingSteps.slice(-3):a,"panel-ai-zone-loading","gengage-chat-panel-ai-zone-inner");this._panelAiZoneLoadingBinding=i,this._panelAiZoneEl.appendChild(n)}else t==="results"&&e?.resultEl&&(this._panelAiZoneEl.innerHTML="",this._panelAiZoneEl.appendChild(e.resultEl));this.setTypingIndicatorMode("auto")}}_clearPanelAiZoneState(){this._destroyLoadingBinding(this._panelAiZoneLoadingBinding),this._panelAiZoneLoadingBinding=null,this._panelAiZoneEl.innerHTML="",this._panelAiZoneEl.setAttribute("hidden",""),this.setTypingIndicatorMode("auto")}_resetPanelAiZoneElement(){this._panelAiZoneEl=document.createElement("div"),this._panelAiZoneEl.className="gengage-chat-panel-ai-zone",this._panelAiZoneEl.setAttribute("hidden","")}_emitHostShellSync(){this.setTypingIndicatorMode("auto"),this._onHostShellSync?.()}_applyPanelCollapsedState(){this._panelEl.classList.toggle("gengage-chat-panel--collapsed",this._panelCollapsed);const t=this._dividerEl.querySelector(".gengage-chat-panel-divider-toggle");t&&(t.textContent=this._panelCollapsed?"«":"»")}_syncPanelTopBarFromContent(t){const e=t.querySelector(".gengage-chat-product-grid-head");if(e){const a=e.querySelector(".gengage-chat-product-grid-head-title"),n=e.querySelector(".gengage-chat-product-grid-head-actions");if(a?.textContent?.trim()){const i=a.textContent.trim();t.dataset.gengagePanelDerivedTitle=i,this._panelTopBar.setTitle(i)}n?(n.classList.add("gengage-chat-panel-topbar-toolbar-host"),this._panelTopBar.setActions(n)):this._panelTopBar.setActions(null),e.remove();return}this._syncPanelTopBarTitleFromContent(t)}_syncPanelTopBarTitleFromContent(t){const e=t.dataset.gengagePanelDerivedTitle;if(e?.trim()){this._panelTopBar.setTitle(e.trim());return}const a=t.querySelector(".gengage-chat-product-details-title, .gengage-chat-product-details-similars-heading, .gengage-chat-ai-top-picks-title")?.textContent?.trim();a&&this._panelTopBar.setTitle(a)}setPanelContent(t,e){this._destroyLoadingBinding(this._panelLoadingBinding),this._panelLoadingBinding=null,e?.preserveAiZone!==!0&&this._clearPanelAiZoneState(),this._panelVisible?this._swapPanelContent(t):(this._panelEl.innerHTML="",this._resetPanelAiZoneElement(),this._panelEl.appendChild(this._panelTopBar.getElement()),this._panelEl.appendChild(this._panelAiZoneEl),this._panelTopBar.setActions(null),this._panelEl.appendChild(t),this._panelEl.appendChild(this._panelFloatingEl)),this._syncPanelTopBarFromContent(t),this._dividerEl.classList.remove("gengage-chat-panel-divider--hidden"),this._panelVisible=!0,this._panelEl.classList.add("gengage-chat-panel--visible"),this.root.classList.add("gengage-chat-drawer--with-panel"),this._panelCollapsed&&this.setPanelCollapsed(!1),this._syncComparisonDockVisibility(),requestAnimationFrame(()=>{this._updateScrollAffordance(),this._smoothScrollPanelListToTop()}),this._reopenPanelBtn&&(this._reopenPanelBtn.style.display="none"),this._emitHostShellSync()}_swapPanelContent(t){this._panelTopBar.setActions(null);const e=this._panelEl.querySelector(".gengage-chat-panel-skeleton");if(e){e.replaceWith(t);return}const a=this.getPanelContentElement();if(a){a.replaceWith(t);return}this._panelEl.insertBefore(t,this._panelFloatingEl)}appendPanelContent(t){this._panelEl.insertBefore(t,this._panelFloatingEl),this._syncPanelTopBarFromContent(this.getPanelContentElement()??t),this._dividerEl.classList.remove("gengage-chat-panel-divider--hidden"),this._panelVisible=!0,this._panelEl.classList.add("gengage-chat-panel--visible"),this.root.classList.add("gengage-chat-drawer--with-panel"),this.setPanelCollapsed(this._panelCollapsed),this._syncComparisonDockVisibility(),this._emitHostShellSync()}getPanelContentElement(){const t=this._panelEl.children;for(let e=0;e<t.length;e++){const a=t[e];if(!(a.classList.contains("gengage-chat-panel-topbar")||a.classList.contains("gengage-chat-panel-ai-zone")||a.classList.contains("gengage-chat-panel-float")))return a}return null}resyncPanelTopBarFromCurrentContent(){const t=this.getPanelContentElement();t&&this._syncPanelTopBarFromContent(t)}isPanelVisible(){return this._panelVisible}hasPanelContent(){return this._panelVisible&&this.getPanelContentElement()!==null}isPanelLoading(){return this._panelEl.querySelector(".gengage-chat-panel-skeleton")!==null}showPanelLoading(t){this._destroyLoadingBinding(this._panelLoadingBinding),this._panelLoadingBinding=null,this._dividerEl.classList.remove("gengage-chat-panel-divider--hidden"),this._panelEl.innerHTML="",this._resetPanelAiZoneElement(),this._panelEl.appendChild(this._panelTopBar.getElement()),this._panelEl.appendChild(this._panelAiZoneEl);const e=document.createElement("div");e.className="gengage-chat-panel-skeleton";const a=t==="comparisonTable"?this.i18n.loadingSequenceComparison:this.i18n.loadingSequencePanel,{root:n,binding:i}=this._createLoadingSequence("panel",this._thinkingSteps.length>0?this._thinkingSteps.slice(-3):a,"panel-loading-status","gengage-chat-panel-loading-status");switch(this._panelLoadingBinding=i,t){case"productDetails":{e.appendChild(n);const r=document.createElement("div");r.className="gengage-chat-panel-skeleton-block gengage-chat-panel-skeleton-block--image",e.appendChild(r);for(let o=0;o<3;o++){const s=document.createElement("div");s.className="gengage-chat-panel-skeleton-block gengage-chat-panel-skeleton-block--text",e.appendChild(s)}break}case"productList":case"groupList":{e.appendChild(n);const r=document.createElement("div");r.className="gengage-chat-panel-skeleton-grid";for(let o=0;o<6;o++){const s=document.createElement("div");s.className="gengage-chat-panel-skeleton-block gengage-chat-panel-skeleton-block--card",r.appendChild(s)}e.appendChild(r);break}case"comparisonTable":{e.classList.add("gengage-chat-panel-skeleton--comparison"),e.appendChild(n);const r=document.createElement("div");r.className="gengage-chat-comparison gengage-chat-comparison--skeleton",r.setAttribute("aria-busy","true");const o=document.createElement("div");o.className="gengage-chat-comparison-recommended";const s=document.createElement("div");s.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-label",o.appendChild(s);const c=document.createElement("div");c.className="gengage-chat-comparison-recommended-body";const l=document.createElement("div");l.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-img",l.setAttribute("aria-hidden","true");const d=document.createElement("div");d.className="gengage-chat-comparison-recommended-info";for(let w=0;w<2;w++){const T=document.createElement("div");T.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-title",w===1&&T.classList.add("gengage-chat-comparison-skeleton-rec-title--short"),d.appendChild(T)}const g=document.createElement("div");g.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-rec-price",d.appendChild(g),c.appendChild(l),c.appendChild(d),o.appendChild(c);const h=document.createElement("div");h.className="gengage-chat-comparison-highlights";const f=document.createElement("div");f.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-label",h.appendChild(f);const b=document.createElement("ul");b.className="gengage-chat-comparison-skeleton-hl-list";for(let w=0;w<3;w++){const T=document.createElement("li"),F=document.createElement("div");F.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-hl-line",w===1&&F.classList.add("gengage-chat-comparison-skeleton-hl-line--medium"),w===2&&F.classList.add("gengage-chat-comparison-skeleton-hl-line--short"),T.appendChild(F),b.appendChild(T)}h.appendChild(b),o.appendChild(h),r.appendChild(o);const m=document.createElement("div");m.className="gengage-chat-comparison-key-differences";const u=document.createElement("div");u.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-heading",m.appendChild(u);const p=document.createElement("div");p.className="gengage-chat-comparison-key-differences-content";for(let w=0;w<4;w++){const T=document.createElement("div");T.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-kd-line",p.appendChild(T)}m.appendChild(p),r.appendChild(m);const y=document.createElement("div");y.className="gengage-chat-comparison-special gengage-chat-comparison-special--skeleton";const _=document.createElement("div");_.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-special-line",y.appendChild(_),r.appendChild(y);const x=document.createElement("div");x.className="gengage-chat-comparison-skeleton-table-wrap";const P=document.createElement("div");P.className="gengage-chat-comparison-skeleton-table-head";const E=document.createElement("div");E.className="gengage-chat-comparison-skeleton-table-corner",P.appendChild(E);for(let w=0;w<3;w++){const T=document.createElement("div");T.className="gengage-chat-comparison-skeleton-table-col";const F=document.createElement("div");F.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-img";const Q=document.createElement("div");Q.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-name";const J=document.createElement("div");J.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-th-price",T.appendChild(F),T.appendChild(Q),T.appendChild(J),P.appendChild(T)}x.appendChild(P);for(let w=0;w<3;w++){const T=document.createElement("div");T.className="gengage-chat-comparison-skeleton-table-row";const F=document.createElement("div");F.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-label",T.appendChild(F);for(let Q=0;Q<3;Q++){const J=document.createElement("div");J.className="gengage-chat-comparison-skeleton-shimmer gengage-chat-comparison-skeleton-table-cell",T.appendChild(J)}x.appendChild(T)}r.appendChild(x),e.appendChild(r);break}default:e.appendChild(n);for(let r=0;r<3;r++){const o=document.createElement("div");o.className="gengage-chat-panel-skeleton-block",e.appendChild(o)}break}this._panelEl.appendChild(e),this._panelEl.appendChild(this._panelFloatingEl),this._panelVisible=!0,this._panelEl.classList.add("gengage-chat-panel--visible"),this.root.classList.add("gengage-chat-drawer--with-panel"),this._applyPanelCollapsedState(),this._syncComparisonDockVisibility(),this._emitHostShellSync()}updatePanelTopBar(t,e,a){const n=this._options.getMobileViewport?.()??!1;this._panelTopBar.update(n?!0:t,e,a);const i=this.getPanelContentElement();i&&this._syncPanelTopBarTitleFromContent(i)}getPanelTopBarTitle(){return this._panelTopBar.getTitle()}updateFavoritesBadge(t){this._favBadgeEl&&(t>0?(this._favBadgeEl.textContent=t>99?"99+":String(t),this._favBadgeEl.style.display=""):this._favBadgeEl.style.display="none")}clearPanel(){this._destroyLoadingBinding(this._panelLoadingBinding),this._panelLoadingBinding=null,this._destroyLoadingBinding(this._panelAiZoneLoadingBinding),this._panelAiZoneLoadingBinding=null,this._panelEl.innerHTML="",this._resetPanelAiZoneElement(),this._panelEl.appendChild(this._panelTopBar.getElement()),this._panelEl.appendChild(this._panelAiZoneEl),this._panelEl.appendChild(this._panelFloatingEl),this._panelTopBar.setActions(null),this._panelVisible=!1,this._panelEl.classList.remove("gengage-chat-panel--visible","gengage-chat-panel--collapsed"),this.root.classList.remove("gengage-chat-drawer--with-panel"),this._dividerEl.classList.add("gengage-chat-panel-divider--hidden"),this._reopenPanelBtn&&(this._reopenPanelBtn.style.display="none"),this.setComparisonDockContent(null),this._emitHostShellSync()}_syncComparisonDockVisibility(){const t=this._panelVisible&&this._comparisonDockSlotEl.children.length>0;this._comparisonDockSlotEl.classList.toggle("gengage-chat-comparison-dock-slot--panel-visible",t),this._comparisonDockSlotEl.style.display=t?"":"none",this._comparisonDockSlotEl.setAttribute("aria-hidden",t?"false":"true")}setComparisonDockContent(t){this._comparisonDockSlotEl.replaceChildren(),t&&this._comparisonDockSlotEl.appendChild(t),this._syncComparisonDockVisibility()}hideMobilePanel(){this._panelVisible&&(this._panelVisible=!1,this._panelEl.classList.remove("gengage-chat-panel--visible"),this._reopenPanelBtn&&(this._reopenPanelBtn.style.display="flex"),this._syncComparisonDockVisibility(),this._emitHostShellSync())}_showMobilePanelFromBtn(){this._panelVisible||(this._panelVisible=!0,this._panelEl.classList.add("gengage-chat-panel--visible"),this._reopenPanelBtn&&(this._reopenPanelBtn.style.display="none"),this._syncComparisonDockVisibility(),this._emitHostShellSync())}showMobilePanel(){this._showMobilePanelFromBtn()}expandPanel(){this._panelCollapsed=!1,this._panelEl.classList.remove("gengage-chat-panel--collapsed"),this._panelVisible||(this._panelVisible=!0,this._panelEl.classList.add("gengage-chat-panel--visible"),this.root.classList.add("gengage-chat-drawer--with-panel")),this._syncComparisonDockVisibility(),this._emitHostShellSync()}setForceExpanded(){this._panelCollapsed=!1,this._panelEl.classList.remove("gengage-chat-panel--collapsed"),this._panelVisible||(this._panelVisible=!0,this._panelEl.classList.add("gengage-chat-panel--visible"),this.root.classList.add("gengage-chat-drawer--with-panel")),this._dividerEl.classList.remove("gengage-chat-panel-divider--hidden"),this._syncComparisonDockVisibility(),this._emitHostShellSync()}_smoothScrollPanelListToTop(){this._panelEl.scrollTop=0}_getChoicePrompterRevealScrollThreshold(){if(!(this._options.getMobileViewport?.()??window.innerWidth<=768))return 88;const t=this._panelEl.querySelector(".gengage-chat-product-grid--mobile .gengage-chat-product-card, .gengage-chat-product-grid .gengage-chat-product-card"),e=this._panelEl.querySelector(".gengage-chat-product-card"),a=t??e;if(!a)return 88;const n=Math.round(a.getBoundingClientRect().height);return!Number.isFinite(n)||n<=0?88:n}_updateScrollAffordance(){const t=this._panelEl,e=t.scrollTop+t.clientHeight>=t.scrollHeight-10,a=this._getChoicePrompterRevealScrollThreshold();t.classList.toggle("gengage-chat-panel--has-scroll",!e&&t.scrollHeight>t.clientHeight),t.classList.toggle("gengage-chat-panel--scrolled",t.scrollTop>a)}_setupHorizontalSwipe(t){let e=0,a=0;const n=r=>{if(!(this._options.getMobileViewport?.()??window.innerWidth<=768))return;const o=r.touches[0];o&&(e=o.clientX,a=o.clientY)},i=r=>{if(!(this._options.getMobileViewport?.()??window.innerWidth<=768))return;const o=r.changedTouches[0];if(!o)return;const s=o.clientX-e,c=o.clientY-a;Math.abs(s)>50&&Math.abs(s)>Math.abs(c)*2&&(this.togglePanel(),this._onPanelToggle?.())};t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchend",i,{passive:!0}),this._cleanups.push(()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchend",i)})}togglePanel(){this.setPanelCollapsed(!this._panelCollapsed)}isPanelCollapsed(){return this._panelCollapsed}setPanelCollapsed(t){this._panelCollapsed=t,this._applyPanelCollapsedState(),this._emitHostShellSync()}persistPanelState(t){try{const e=`gengage:panel:${t}`;this._panelCollapsed?sessionStorage.setItem(e,"collapsed"):sessionStorage.removeItem(e)}catch{}}restorePanelState(t){try{const e=`gengage:panel:${t}`;if(sessionStorage.getItem(e)==="collapsed")return this._panelCollapsed=!0,!0}catch{}return!1}_createLoadingSequence(t,e,a,n){const i=document.createElement("div");i.className=`${n} gds-progress-loader ${t==="chat"?"gds-progress-loader-chat":"gds-progress-loader-panel"}`,i.dataset.gengagePart=a,i.setAttribute("role","status"),i.setAttribute("aria-live","polite");const r=document.createElement("span");r.className=t==="chat"?"gengage-chat-typing-text gds-progress-label":"gengage-chat-panel-loading-label gds-progress-label",i.appendChild(r);const o=document.createElement("span");o.className=t==="chat"?"gengage-chat-typing-dots gds-progress-dots":"gds-progress-dots",o.setAttribute("aria-hidden","true");for(let c=0;c<3;c++){const l=document.createElement("span");l.className="gds-progress-dot",o.appendChild(l)}i.appendChild(o);const s={labelEl:r,steps:[],index:0,intervalId:null};return this._applyLoadingSteps(s,e),{root:i,binding:s}}_applyLoadingSteps(t,e,a=!1){const n=e.map(r=>r.trim()).filter(Boolean).slice(-3),i=[this.i18n.loadingMessage];t.steps=n.length>0?n:i,this._clearLoadingBindingInterval(t),t.index=a?t.steps.length-1:0,t.labelEl.textContent=t.steps[t.index],!a&&t.steps.length>1&&(t.intervalId=setInterval(()=>{if(t.index>=t.steps.length-1){this._clearLoadingBindingInterval(t);return}t.index+=1,t.labelEl.textContent=t.steps[t.index],t.index>=t.steps.length-1&&this._clearLoadingBindingInterval(t)},Ri))}_clearLoadingBindingInterval(t){t?.intervalId&&(clearInterval(t.intervalId),t.intervalId=null)}_destroyLoadingBinding(t){this._clearLoadingBindingInterval(t)}_updateSendEnabled(){if(this._sendStopHandler){this.sendBtn.disabled=!1;return}const t=this.inputEl.value.trim().length>0||this._pendingAttachment!==null;this.sendBtn.disabled=!t}_renderSendButtonIcon(t){this.sendBtn.innerHTML=t==="stop"?'<span class="gengage-chat-send-stop-icon" aria-hidden="true"></span>':'<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>'}_submit(){const t=this.inputEl.value.trim(),e=this._pendingAttachment;if(this._sendStopHandler){const a=this._sendStopHandler;if(this.hideStopButton(),a(),!t&&!e)return}else if(!t&&!e)return;this.onSend(t,e??void 0),this.inputEl.value="",this.inputEl.style.height="auto",this.clearAttachment(),this._updateSendEnabled()}_toggleVoice(){if(this._voiceInput)if(this._voiceInput.state==="listening"){const t=this._voiceInput.stop();t.trim()&&(this.inputEl.value=t,this._submit())}else this.inputEl.value="",this._voiceInput.start()}lockScrollForRestore(){this._scrollLockedUntil=Date.now()+500}_scrollToBottom(t=!1){!t&&this._userScrolledUp||!t&&this._options.presentation?.shouldBlockSoftAutoScroll?.()||!t&&Date.now()<this._scrollLockedUntil||requestAnimationFrame(()=>{this.messagesEl.scrollTop=this.messagesEl.scrollHeight,this._userScrolledUp=!1})}scrollToBottomIfNeeded(){this._scrollToBottom(!1)}updateBotMessage(t,e,a,n){const i=this.messagesEl.querySelector(`[data-message-id="${ve(t)}"]`);if(!i)return;let r=i.querySelector(".gengage-chat-bubble-text");r||(r=document.createElement("div"),r.className="gengage-chat-bubble-text",i.appendChild(r)),a==="photo_analysis"?(i.classList.add("gengage-chat-bubble--photo-analysis"),this._renderPhotoAnalysisCard(r,n)):(i.classList.remove("gengage-chat-bubble--photo-analysis"),r.innerHTML=ye(e)),this._scrollToBottom(!1)}markFirstBotMessage(t){this._firstBotMessageIds.add(t);const e=this.messagesEl.querySelector(`[data-message-id="${ve(t)}"]`);e&&e.classList.add("gengage-chat-bubble--first")}scrollToLastThread(){const t=this.messagesEl.querySelectorAll("[data-thread-id]");if(t.length===0){this._scrollToBottom(!0);return}const e=t[t.length-1].getAttribute("data-thread-id");if(!e){this._scrollToBottom(!0);return}this._programmaticScrollUntil=Date.now()+700;const a=this.messagesEl.querySelector(`[data-thread-id="${ve(e)}"]`);a?requestAnimationFrame(()=>{a.scrollIntoView({block:"start",behavior:"auto"}),this._userScrolledUp=!1}):this._scrollToBottom(!0)}scrollThreadIntoView(t,e="smooth"){const a=this.messagesEl.querySelectorAll(`[data-thread-id="${ve(t)}"]`),n=this.messagesEl.ownerDocument.defaultView?.HTMLElement;if(!n)return!1;let i=null,r=null;for(let c=0;c<a.length;c++){const l=a[c];if(l instanceof n&&(r||(r=l),!l.classList.contains("gengage-chat-bubble--presentation-collapsed")&&!l.classList.contains("gengage-chat-bubble--hidden")&&l.offsetHeight!==0&&!(l.classList.contains("gengage-chat-bubble--assistant")&&(l.textContent?.trim().length??0)===0))){i=l;break}}if(i||(i=r),!i)return!1;const o=Date.now();this._programmaticScrollUntil=o+Ra,this._scrollLockedUntil=Math.max(this._scrollLockedUntil,o+Ra),this._userScrolledUp=!0;const s=()=>{this._scrollMessagesTo(Math.max(i.offsetTop-20,0),e)};return s(),requestAnimationFrame(s),!0}scrollToBottomPresentation(t="smooth"){this._programmaticScrollUntil=Date.now()+700,requestAnimationFrame(()=>{this._scrollMessagesTo(this.messagesEl.scrollHeight,t),this._userScrolledUp=!1})}_scrollMessagesTo(t,e){if(typeof this.messagesEl.scrollTo=="function"){this.messagesEl.scrollTo({top:t,behavior:e});return}this.messagesEl.scrollTop=t}setPresentationFocus(t){this._presentationFocusThreadId=t,this._applyPresentationCollapsed()}setFormerMessagesButtonVisible(t){this._formerMessagesBtn&&(this._formerMessagesBtn.style.display=t?"":"none")}setInputPlaceholder(t){this.inputEl.placeholder=t}_applyPresentationCollapsed(){const t=this._presentationFocusThreadId;this.messagesEl.querySelectorAll("[data-thread-id]").forEach(e=>{const a=e.dataset.threadId;a&&(t&&a!==t?e.classList.add("gengage-chat-bubble--presentation-collapsed"):e.classList.remove("gengage-chat-bubble--presentation-collapsed"))})}refreshPresentationCollapsed(){this._presentationFocusThreadId&&this._applyPresentationCollapsed()}setInputAreaChips(t){if(this._inputChipsEl.innerHTML="",t.length===0){this._inputChipsEl.style.display="none";return}this._inputChipsEl.style.display="";for(const e of t){const a=document.createElement("button");if(a.className="gengage-chat-input-chip gds-chip",a.type="button",e.icon){const i=Ba[e.icon]??Ma,r=document.createElement("span");r.className="gengage-chat-input-chip-icon",r.innerHTML=i,a.appendChild(r)}const n=document.createElement("span");n.textContent=e.label,a.appendChild(n),a.addEventListener("click",()=>e.onAction()),this._inputChipsEl.appendChild(a)}}clearInputAreaChips(){this._inputChipsEl.innerHTML="",this._inputChipsEl.style.display="none"}trapFocus(){this._previouslyFocusedElement=document.activeElement,this.releaseFocus();const t=e=>{if(e.key!=="Tab")return;const a=Array.from(this.root.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(l=>{const d=getComputedStyle(l);return l.hidden||l.getAttribute("aria-hidden")==="true"||d.display==="none"||d.visibility==="hidden"?!1:l.getClientRects().length>0});if(a.length===0)return;const n=a[0],i=a[a.length-1],r=e.composedPath().find(l=>l instanceof HTMLElement&&this.root.contains(l))??null,o=this.root.getRootNode(),s=r??(o instanceof ShadowRoot&&o.activeElement instanceof HTMLElement?o.activeElement:document.activeElement instanceof HTMLElement?document.activeElement:null),c=s&&this.root.contains(s)?s:null;e.shiftKey?(c===n||!this.root.contains(c))&&(e.preventDefault(),i.focus()):(c===i||!this.root.contains(c))&&(e.preventDefault(),n.focus())};this._focusTrapHandler=t,this.root.addEventListener("keydown",t)}releaseFocus(){if(this._focusTrapHandler&&(this.root.removeEventListener("keydown",this._focusTrapHandler),this._focusTrapHandler=null),this._previouslyFocusedElement){try{this._previouslyFocusedElement.focus()}catch{}this._previouslyFocusedElement=null}}flashCartBadge(){this._cartBtn&&(this._cartBtn.classList.remove("gengage-chat-header-btn--cart-flash"),this._cartBtn.offsetWidth,this._cartBtn.classList.add("gengage-chat-header-btn--cart-flash"),this._cartBtn.addEventListener("animationend",()=>{this._cartBtn?.classList.remove("gengage-chat-header-btn--cart-flash")},{once:!0}))}showCartToast(t){this.root.querySelector(".gengage-chat-cart-toast")?.remove();const e=document.createElement("div");e.className="gengage-chat-cart-toast",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.textContent=t,this.root.appendChild(e),e.offsetWidth,e.classList.add("gengage-chat-cart-toast--visible"),setTimeout(()=>{e.classList.remove("gengage-chat-cart-toast--visible"),setTimeout(()=>e.remove(),300)},2500)}destroy(){ki(null),this.releaseFocus(),this._resizeRafId!==null&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this._destroyLoadingBinding(this._typingLoadingBinding),this._typingLoadingBinding=null,this._destroyLoadingBinding(this._panelLoadingBinding),this._panelLoadingBinding=null,this._destroyLoadingBinding(this._panelAiZoneLoadingBinding),this._panelAiZoneLoadingBinding=null,this._closeAttachMenu();for(const t of this._cleanups)t();this._cleanups.length=0,this._voiceInput?.destroy(),this._voiceInput=null}}}));function Fi(t){return t==="watch_expert"?"account_expert":Di.includes(t)?t:null}function Rl(t){return typeof t=="string"?Fi(t):null}function ke(t){return t==null||typeof t!="object"||Array.isArray(t)?null:t}function zl(...t){for(const e of t)if(typeof e=="string"){const a=e.trim();if(a.length>0)return a}}function Hl(t){const e=ke(t);if(!e)return null;const a=zl(e.assistant_mode,e.assistantMode);if(!a)return null;const n=Fi(a);return!n||n==="shopping"?null:n}function Fl(t){return t==="beauty_consulting"?"user_message":"findSimilar"}var Di,Ui=L((()=>{Di=["shopping","beauty_consulting","account_expert"]})),Oi,Dl=L((()=>{Ui(),ot(),Oi=class{constructor(){this._mode="shopping",this._uiHints=null}get mode(){return this._mode}set mode(t){this._mode=t}get uiHints(){return this._uiHints}set uiHints(t){this._uiHints=t}get isShopping(){return this._mode==="shopping"}get isBeautyConsulting(){return this._mode==="beauty_consulting"}get isChoicePrompterHidden(){return this._uiHints?.hide_choice_prompter===!0}applyUiHints(t,e,a){const n=r=>this._uiHints?.[r]===!0;t?.setAttachmentControlsVisible(!n("hide_attachment_controls")),n("hide_choice_prompter")&&a?.();const i=typeof this._uiHints?.input_placeholder=="string"?this._uiHints.input_placeholder:void 0;i?t?.setInputPlaceholder(i):t?.setInputPlaceholder(e)}handleRedirect(t){Be("mode","redirect metadata received",t);const e=Hl(t);return e?(this.switchMode(e),!0):!1}switchMode(t){const e=this._mode;this._mode=t,Be("mode","assistant mode switched",{from:e,to:t})}updateFromContext(t){const e=t.assistant_mode;if(typeof e=="string"&&e){const a=Rl(e);a?this._mode=a:Be("mode","ignoring unrecognised assistant_mode from context",e)}else e===null&&(this._mode="shopping");this._uiHints=ke(t.ui_hints)??null}reset(){const t=this._mode!=="shopping";return this._mode="shopping",this._uiHints=null,t}resolveAttachmentActionType(){return Fl(this._mode)}shouldCondenseThinking(){return this._mode!=="shopping"}}}));function Ul(){return{streamIncludedBeautyPhotoStep:!1,pendingPhotoStepSkip:!1}}function Ol(t,e,a,n,i){if(t==="PhotoAnalysisCard"){const r=Ii(e);return r?(i.photoAnalysis=r,i.renderHint="photo_analysis",n.ensureRendered(),n.cancelTypewriter(),n.drawer?.updateBotMessage(i.id,i.content??"","photo_analysis",i.photoAnalysis),!0):(Be("beauty","PhotoAnalysisCard parse failed, falling through to generic renderer",e),!1)}if(t==="BeautyPhotoStep"){a.streamIncludedBeautyPhotoStep=!0;const r=Sl(e);return n.drawer?.setBeautyPhotoStepCard({visible:!0,...r,onSkip:()=>{n.drawer?.setBeautyPhotoStepCard({visible:!1}),n.streamDone?n.sendSkipMessage():a.pendingPhotoStepSkip=!0}}),!0}return!1}function ql(t){return t.renderHint==="photo_analysis"}function jl(t,e){t.streamIncludedBeautyPhotoStep||e.drawer?.setBeautyPhotoStepCard({visible:!1}),t.pendingPhotoStepSkip&&(t.pendingPhotoStepSkip=!1,e.sendSkipMessage())}function $l(t,e){t.pendingPhotoStepSkip&&(t.pendingPhotoStepSkip=!1,e.sendSkipMessage())}var Vl=L((()=>{Na(),Ia(),ot()}));function za(t){return Number.isFinite(t)?Math.max(0,Math.min(5,t)):0}function Ha(t){return Number.isFinite(t)?Math.max(0,Math.min(100,Math.round(t))):0}function Fa(t){const e=za(t),a=Math.floor(e),n=e-a>=.5,i=5-a-(n?1:0),r=document.createElement("span");if(r.className="gengage-star-rating",r.setAttribute("role","img"),r.setAttribute("aria-label",`${e.toFixed(1)} out of 5 stars`),a>0&&r.appendChild(document.createTextNode("★".repeat(a))),n){const o=document.createElement("span");o.className="gengage-star-half",o.textContent="☆";const s=document.createElement("span");s.textContent="★",o.appendChild(s),r.appendChild(o)}return i>0&&r.appendChild(document.createTextNode("☆".repeat(i))),r}function Ce(t){t.addEventListener("error",()=>{t.style.display="none"},{once:!0})}var je=L((()=>{}));function ie(t,e){const a=Number(t);if(!Number.isFinite(a)||a<0)return t;const n={...qi,...e},i=Math.abs(a%1)<Number.EPSILON,r=n.alwaysShowDecimals||!i?a.toFixed(2):a.toFixed(0),o=r.indexOf("."),s=o===-1?r:r.slice(0,o),c=o===-1?void 0:r.slice(o+1),l=s.replace(/\B(?=(\d{3})+(?!\d))/g,n.thousandsSeparator);let d;return c!==void 0?d=`${l}${n.decimalSeparator}${c}`:d=l,n.currencySymbol?n.currencyPosition==="prefix"?`${n.currencySymbol}${d}`:`${d} ${n.currencySymbol}`:d}var qi,ct=L((()=>{qi={currencyCode:"TRY",currencySymbol:"TL",currencyPosition:"suffix",thousandsSeparator:".",decimalSeparator:",",alwaysShowDecimals:!1}}));function Gl(t,e,a){return e?.[t]??Vi[t]??t.replace(/_/g," ").replace(/^./u,n=>Wl(n,a))}function Wl(t,e){try{return t.toLocaleUpperCase(He(e))}catch{return t.toLocaleUpperCase("tr")}}function ji(t){if(typeof t!="string")return!1;const e=Number(t);return Number.isFinite(e)&&e>0}function Kl(t){const e=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isFinite(e)&&e>0}function Yl(t){const e=typeof t=="number"?t:Number(t),a=document.createElement("div");a.className="gengage-chat-comparison-recommended-rating",a.innerHTML='<span class="gengage-chat-comparison-recommended-rating-icon" aria-hidden="true"><svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3.6l2.58 5.23 5.77.84-4.17 4.07.98 5.75L12 16.78l-5.16 2.71.99-5.75L3.66 9.67l5.76-.84L12 3.6z"/></svg></span>';const n=document.createElement("span");return n.className="gengage-chat-comparison-recommended-rating-value",n.textContent=e.toFixed(1),a.appendChild(n),a}function Ql(t){const{recommended:e,products:a,attributes:n,highlights:i,specialCases:r,onProductClick:o,i18n:s}=t,c=document.createElement("div");if(c.className="gengage-chat-comparison",c.dataset.gengagePart="comparison-dialog",c.setAttribute("role","dialog"),c.setAttribute("aria-label",s?.comparisonHeading??"Comparison Results"),e){const l=document.createElement("article");l.className="gengage-chat-comparison-recommended gds-card",l.dataset.gengagePart="comparison-recommended-card";const d=document.createElement("div");d.className="gengage-chat-comparison-recommended-label",d.textContent=s?.recommendedChoiceLabel??"Recommended Choice",l.appendChild(d);const g=document.createElement("div");g.className="gengage-chat-comparison-recommended-body",g.classList.add("gds-clickable"),g.tabIndex=0,g.setAttribute("role","button"),g.setAttribute("aria-label",e.name);const h=document.createElement("div");if(h.className="gengage-chat-comparison-recommended-media",e.imageUrl&&we(e.imageUrl)){const p=document.createElement("img");p.src=e.imageUrl,p.alt=e.name,p.loading="lazy",p.addEventListener("error",()=>{p.style.display="none"},{once:!0}),h.appendChild(p)}else{const p=document.createElement("div");p.className="gengage-chat-comparison-recommended-placeholder",p.setAttribute("aria-hidden","true"),h.appendChild(p)}g.appendChild(h);const f=document.createElement("div");f.className="gengage-chat-comparison-recommended-info";const b=document.createElement("div");b.className="gengage-chat-comparison-recommended-title",b.textContent=e.name,f.appendChild(b);const m=document.createElement("div");if(m.className="gengage-chat-comparison-recommended-meta",Kl(e.rating)&&m.appendChild(Yl(e.rating)),ji(e.price)){const p=document.createElement("div");p.className="gengage-chat-comparison-recommended-price",p.textContent=ie(e.price,t.pricing),m.appendChild(p)}if(m.childElementCount>0&&f.appendChild(m),t.recommendedText){const p=document.createElement("p");p.className="gengage-chat-comparison-recommended-text",p.innerHTML=ye(t.recommendedText),f.appendChild(p)}g.appendChild(f);const u=()=>{o({sku:e.sku,name:e.name})};if(g.addEventListener("click",u),g.addEventListener("keydown",p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),u())}),l.appendChild(g),i.length>0){const p=document.createElement("div");p.className="gengage-chat-comparison-highlights",p.dataset.gengagePart="comparison-highlights";const y=document.createElement("div");y.className="gengage-chat-comparison-highlights-label",y.textContent=s?.highlightsLabel??"Key Highlights",p.appendChild(y);const _=document.createElement("ul");for(const x of i){const P=document.createElement("li");P.textContent=x,_.appendChild(P)}p.appendChild(_),l.appendChild(p)}c.appendChild(l)}if(t.keyDifferencesHtml){const l=document.createElement("details");l.className="gengage-chat-comparison-key-differences",l.dataset.gengagePart="comparison-key-differences";const d=document.createElement("summary");d.className="gengage-chat-comparison-key-differences-summary";const g=document.createElement("span");g.className="gengage-chat-comparison-key-differences-summary-label",g.textContent=s?.keyDifferencesLabel??"Key Differences";const h=document.createElement("span");h.className="gengage-chat-comparison-key-differences-summary-meta",h.textContent=s?.viewMoreLabel??"Show More",d.appendChild(g),d.appendChild(h),l.appendChild(d);const f=document.createElement("div");f.className="gengage-chat-comparison-key-differences-content",f.innerHTML=ye(Zl(t.keyDifferencesHtml)),l.appendChild(f),c.appendChild(l)}if(r&&r.length>0){const l=document.createElement("details");l.className="gengage-chat-comparison-special gds-evidence-card gds-evidence-card-warning",l.dataset.gengagePart="comparison-special-cases";const d=document.createElement("summary");d.textContent=s?.specialCasesLabel??"For Special Cases",l.appendChild(d);const g=document.createElement("ul");for(const h of r)Xl(g,h);g.childElementCount>0&&l.appendChild(g),c.appendChild(l)}if(a.length>0&&n.length>0){const l=document.createElement("table");l.className="gengage-chat-comparison-table gds-comparison-table";const d=document.createElement("thead"),g=document.createElement("tr"),h=document.createElement("th");g.appendChild(h);for(const m of a){const u=document.createElement("th");m.sku===e?.sku&&(u.className="gengage-chat-comparison-selected gds-comparison-table-winner-cell");const p=document.createElement("div");p.className="gengage-chat-comparison-table-header-cell gengage-chat-comparison-table-header-cell--clickable gds-clickable",p.tabIndex=0,p.setAttribute("role","button"),p.setAttribute("aria-label",m.name),p.title=m.name;const y=()=>{o({sku:m.sku,name:m.name})};if(p.addEventListener("click",y),p.addEventListener("keydown",x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),y())}),m.imageUrl&&we(m.imageUrl)){const x=document.createElement("img");x.src=m.imageUrl,x.alt=m.name,x.loading="lazy",x.addEventListener("error",()=>{x.style.display="none"},{once:!0}),p.appendChild(x)}else{const x=document.createElement("div");x.className="gengage-chat-comparison-table-header-img-placeholder",x.setAttribute("aria-hidden","true"),p.appendChild(x)}const _=document.createElement("div");if(_.className="gengage-chat-comparison-table-product-name",_.textContent=m.name,p.appendChild(_),ji(m.price)){const x=document.createElement("div");x.className="gengage-chat-comparison-table-price",x.textContent=ie(m.price,t.pricing),p.appendChild(x)}u.appendChild(p),g.appendChild(u)}d.appendChild(g),l.appendChild(d);const f=document.createElement("tbody");for(const m of n){const u=document.createElement("tr"),p=document.createElement("td");p.className="gengage-chat-comparison-label",p.textContent=Gl(m.label,s?.criteriaLabels,t.locale),u.appendChild(p);for(let y=0;y<m.values.length;y++){const _=document.createElement("td");a[y]?.sku===e?.sku&&(_.className="gengage-chat-comparison-selected gds-comparison-table-winner-cell");const x=m.values[y]??"";$i(x)?_.innerHTML=ye(x):_.textContent=x,u.appendChild(_)}f.appendChild(u)}l.appendChild(f);const b=document.createElement("div");b.className="gengage-chat-comparison-table-wrapper",b.dataset.gengagePart="comparison-table-wrapper",b.appendChild(l),c.appendChild(b)}return c.addEventListener("keydown",l=>{if(l.key!=="Tab")return;const d=c.querySelectorAll('button, [href], input, [tabindex]:not([tabindex="-1"])');if(d.length===0)return;const g=d[0],h=d[d.length-1];l.shiftKey&&document.activeElement===g?(l.preventDefault(),h.focus()):!l.shiftKey&&document.activeElement===h&&(l.preventDefault(),g.focus())}),c}function Zl(t){if(/<[uo]l[\s>]/i.test(t)||/<li[\s>]/i.test(t))return t;const e=t.split(`
49
49
  `).filter(a=>a.trim());return e.length<=1?t:"<ul>"+e.map(a=>`<li>${a.trim()}</li>`).join("")+"</ul>"}function Xl(t,e){const a=ye(e);if(!a)return;const n=document.createElement("template");n.innerHTML=a;const i=Array.from(n.content.querySelectorAll("li"));if(i.length>0){for(const o of i){const s=document.createElement("li");s.innerHTML=ye(o.innerHTML),t.appendChild(s)}return}const r=document.createElement("li");$i(e)?r.innerHTML=a:r.textContent=e,t.appendChild(r)}function $i(t){return/<\/?[a-z][\s\S]*>/i.test(t)}var Vi,Jl=L((()=>{ge(),ct(),ht(),Vi={screen_size:"Screen Size",weight:"Weight",battery_capacity:"Battery Capacity",battery_life:"Battery Life",storage:"Storage",memory:"Memory",ram:"RAM",processor:"Processor",camera:"Camera",resolution:"Resolution",display_type:"Display Type",refresh_rate:"Refresh Rate",color:"Color",material:"Material",dimensions:"Dimensions",warranty:"Warranty",connectivity:"Connectivity",water_resistance:"Water Resistance",operating_system:"Operating System",brand:"Brand",model:"Model",price:"Price",energy_class:"Energy Class",noise_level:"Noise Level",capacity:"Capacity",power:"Power",voltage:"Voltage",width:"Width",height:"Height",depth:"Depth"}}));function vt(t,e=18){const a="http://www.w3.org/2000/svg",n=document.createElementNS(a,"svg");n.setAttribute("width",String(e)),n.setAttribute("height",String(e)),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true");for(const i of t){const r=document.createElementNS(a,"path");r.setAttribute("d",i),n.appendChild(r)}return n}var Gi=L((()=>{}));function eg(t){if(typeof t!="string")return[Dt];const e=t.split(/[,;|/]+/).map(a=>a.trim().replace(/\s+/g," ")).filter(a=>a.length>0);return e.length===0?[Dt]:Array.from(new Set(e.map(a=>a.toLocaleLowerCase()))).map(a=>e.find(n=>n.toLocaleLowerCase()===a)??Dt)}function tg(t){return t==="positive"||t==="negative"||t==="neutral"?t:"neutral"}function ag(t){if(typeof t!="string")return"";const e=t.trim().replace(/\s+/g," ");return e.length<=Da?e:`${e.slice(0,Da-3).trimEnd()}...`}function ng(t){return t.positive>t.negative?"positive":t.negative>t.positive?"negative":"neutral"}function ig(t){return vt(t==="positive"?["M7 17 17 7","M7 7h10v10"]:t==="negative"?["M7 7 17 17","M17 7v10H7"]:["M5 12h14"],14)}function rg(t,e="1 customer mentions",a="customers mention"){return t===1?e:`${t} ${a}`}function og(t,e){const a=document.createElement("div");a.className="gengage-chat-review-highlights";const n=t.props?.reviews;if(!Array.isArray(n)||n.length===0){const m=document.createElement("div");return m.className="gengage-chat-review-empty",m.textContent=e?.emptyReviewsMessage??"No review summary found.",a.appendChild(m),a}const i=n.filter(m=>m!==null&&typeof m=="object"),r=new Map;for(const m of i){const u=tg(m.review_class),p=ag(m.review_text),y=eg(m.review_tag);for(const _ of y){const x=_.toLocaleLowerCase();let P=r.get(x);if(P||(P={key:x,label:_,mentions:0,positive:0,negative:0,neutral:0,snippets:[]},r.set(x,P)),P.mentions+=1,u==="positive"?P.positive+=1:u==="negative"?P.negative+=1:P.neutral+=1,p.length>0&&P.snippets.length<Wi&&!P.snippets.some(E=>E.text===p)){const E={text:p,tone:u};m.review_rating!==void 0&&String(m.review_rating).length>0&&(E.rating=m.review_rating),P.snippets.push(E)}}}const o=Array.from(r.values()).sort((m,u)=>u.mentions!==m.mentions?u.mentions-m.mentions:m.label.localeCompare(u.label));if(o.length===0){const m=document.createElement("div");return m.className="gengage-chat-review-empty",m.textContent=e?.emptyReviewsMessage??"No review summary found.",a.appendChild(m),a}const s=(e?.reviewFilterPositive??"positive").toLowerCase(),c=(e?.reviewFilterNegative??"negative").toLowerCase(),l=document.createElement("div");l.className="gengage-chat-review-subjects-heading",l.textContent=e?.reviewSubjectsHeading??"Select to learn more",a.appendChild(l);let d=o[0]?.key??null;const g=document.createElement("div");g.className="gengage-chat-review-subjects gds-toolbar gds-toolbar-compact";const h=document.createElement("section");h.className="gengage-chat-review-detail gds-evidence-card";const f=()=>{for(;h.firstChild;)h.removeChild(h.firstChild);if(!d)return;const m=o.find(_=>_.key===d);if(!m)return;const u=document.createElement("div");u.className="gengage-chat-review-detail-meta";const p=document.createElement("span");if(p.className="gengage-chat-review-detail-mentions",p.textContent=`${rg(m.mentions,e?.reviewCustomersMentionSingular,e?.reviewCustomersMentionPlural)} "${m.label}"`,u.appendChild(p),m.positive>0){const _=document.createElement("span");_.className="gengage-chat-review-detail-positive",_.textContent=`${m.positive} ${s}`,u.appendChild(_)}if(m.negative>0){const _=document.createElement("span");_.className="gengage-chat-review-detail-negative",_.textContent=`${m.negative} ${c}`,u.appendChild(_)}h.appendChild(u);const y=document.createElement("div");y.className="gengage-chat-review-snippets";for(const _ of m.snippets){const x=document.createElement("article");x.className="gengage-chat-review-snippet",x.dataset.tone=_.tone;const P=document.createElement("div");if(P.className="gengage-chat-review-snippet-text",P.textContent=`"${_.text}"`,x.appendChild(P),_.rating!==void 0&&String(_.rating).length>0){const E=document.createElement("div");E.className="gengage-chat-review-snippet-rating",E.textContent=`★ ${String(_.rating)}`,x.appendChild(E)}y.appendChild(x)}h.appendChild(y)},b=()=>{for(const m of g.querySelectorAll(".gengage-chat-review-subject")){const u=m.dataset.subjectKey===d;m.classList.toggle("gengage-chat-review-subject--active",u),m.classList.toggle("gds-chip-active",u),m.setAttribute("aria-pressed",String(u))}};for(const m of o){const u=ng(m),p=document.createElement("button");p.type="button",p.className="gengage-chat-review-subject gds-chip",p.dataset.subjectKey=m.key,p.dataset.tone=u;const y=document.createElement("span");y.className="gengage-chat-review-subject-icon",y.appendChild(ig(u)),p.appendChild(y);const _=document.createElement("span");_.className="gengage-chat-review-subject-label",_.textContent=m.label,p.appendChild(_);const x=document.createElement("span");x.className="gengage-chat-review-subject-count",x.textContent=`(${m.mentions})`,p.appendChild(x),p.addEventListener("click",()=>{d=m.key,b(),f()}),g.appendChild(p)}return a.appendChild(g),b(),f(),a.appendChild(h),a}var Dt,Da,Wi,sg=L((()=>{Gi(),Dt="General",Da=220,Wi=6}));function cg(t){if(!t)return;const e=t.discountReason??t.discount_reason??t.campaignReason??t.campaign_reason;if(typeof e!="string")return;const a=e.trim();return a.length>0?a:void 0}function lt(t,e){if(t.productPriceUi?.showCampaignReason===!0)return cg(e)}function yt(t,e){const a=e?.originalPriceStyle??e?.price_original_style;if(a==="inline"||a==="strikethrough")return a;const n=t.productPriceUi?.originalPriceStyle;return n==="inline"||n==="strikethrough"?n:"strikethrough"}function Ut(t){const e=document.createElement("div");return e.className="gengage-chat-campaign-reason",e.textContent=t,e}function Ot(t,e){for(const n of["campaignReasonLogoUrl","campaign_reason_logo_url","discountBadgeLogoUrl","discount_badge_logo_url"]){const i=e?.[n];if(typeof i=="string"&&i.trim()){const r=i.trim();if(we(r))return r}}const a=t.productPriceUi?.campaignBadgeLogoUrl;if(typeof a=="string"&&a.trim()){const n=a.trim();if(we(n))return n}}function qt(t){const e=document.createElement("div");if(e.className="gengage-chat-campaign-price-badge",e.dataset.gengagePart="campaign-price-badge",t.logoUrl){const r=document.createElement("div");r.className="gengage-chat-campaign-price-badge__logo";const o=document.createElement("img");o.alt="",o.loading="lazy",o.src=t.logoUrl,Ce(o),r.appendChild(o),e.appendChild(r)}const a=document.createElement("div");a.className="gengage-chat-campaign-price-badge__body";const n=document.createElement("div");n.className="gengage-chat-campaign-price-badge__reason",n.textContent=t.reasonText;const i=document.createElement("span");return i.className="gengage-chat-campaign-price-badge__sale",i.textContent=t.salePriceFormatted,a.appendChild(n),a.appendChild(i),e.appendChild(a),e}var Ua=L((()=>{ge(),je()}));function lg(){try{return globalThis.GENGAGE_TOPPICKS_MOBILE_LAYOUT==="uniform"}catch{return!1}}function Ki(t){const e=t.product.sku;if(typeof e=="string"&&e.length>0)return e;const a=t.action?.payload;return a&&typeof a=="object"&&"sku"in a&&typeof a.sku=="string"?a.sku:null}function Yi(t,e){if(!t||!e)return null;const a=Zi[t];return a?e[a]??t:t}function gg(t){const e=t.rating,a=typeof e=="number"?e:typeof e=="string"?parseFloat(e):NaN;if(Number.isNaN(a)||a<=0)return null;const n=document.createElement("div");n.className="gengage-chat-ai-toppick-rating",n.dataset.gengagePart="ai-top-pick-rating";const i=document.createElement("span");i.className="gengage-chat-ai-toppick-rating-icon",i.setAttribute("aria-hidden","true"),i.innerHTML='<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3.6l2.58 5.23 5.77.84-4.17 4.07.98 5.75L12 16.78l-5.16 2.71.99-5.75L3.66 9.67l5.76-.84L12 3.6z"/></svg>';const r=document.createElement("span");return r.className="gengage-chat-ai-toppick-rating-value",r.textContent=a.toFixed(1),n.appendChild(i),n.appendChild(r),n}function dg(t,e,a,n,i){const r=document.createElement("div");r.className="gengage-chat-ai-toppick-media",r.dataset.gengagePart="ai-top-pick-media";const o=t.product,s=o.imageUrl;if(s&&we(s)){const l=document.createElement("img");l.className="gengage-chat-ai-toppick-img",l.dataset.gengagePart="ai-top-pick-image",he(l,"src",s),l.loading="lazy",l.alt=e,Ce(l),r.appendChild(l)}const c=Ki(t);if(c&&!i?.skipOverlayActions){const l=document.createElement("div");if(l.className="gengage-chat-product-card-img-actions",n.onFavoriteToggle){const f=document.createElement("button");f.className="gengage-chat-favorite-btn",f.type="button",f.dataset.gengageFavoriteSku=c,f.setAttribute("aria-label",n.i18n?.addToFavoritesLabel??"Add to favorites");const b=n.favoritedSkus?.has(c)??!1;b&&f.classList.add("gengage-chat-favorite-btn--active"),f.innerHTML=`<svg width="14" height="14" viewBox="0 0 24 24" fill="${b?"currentColor":"none"}" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>`,f.addEventListener("click",m=>{m.stopPropagation(),f.classList.toggle("gengage-chat-favorite-btn--active"),f.querySelector("svg")?.setAttribute("fill",f.classList.contains("gengage-chat-favorite-btn--active")?"currentColor":"none"),n.onFavoriteToggle?.(c,o)}),l.appendChild(f)}const d=n.i18n?.findSimilarLabel??"Find Similar",g=document.createElement("button");g.className="gengage-chat-find-similar-pill",g.type="button",g.setAttribute("aria-label",d),g.dataset.tooltip=d,g.innerHTML='<span class="gengage-chat-find-similar-pill-icon" aria-hidden="true"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M16 16l5.5 5.5"/></svg></span>';const h=document.createElement("span");h.className="gengage-chat-find-similar-pill-text",h.textContent=d,g.appendChild(h),g.addEventListener("click",f=>{f.stopPropagation(),n.onAction({title:d,type:"findSimilar",payload:{sku:c}})}),l.appendChild(g),r.appendChild(l)}a.appendChild(r)}function pg(t,e,a){const n=t.price,i=t.originalPrice;if(!n)return;const r=lt(a,t),o=yt(a,t),s=!!(i&&i!==n),c=!!(r&&s),l=Ot(a,t),d=document.createElement("div");if(d.className="gengage-chat-ai-toppick-price",d.dataset.gengagePart="ai-top-pick-price",c){const g=qt({reasonText:r,salePriceFormatted:ie(n,a.pricing),...l!==void 0?{logoUrl:l}:{}});if(s&&o==="inline"){d.classList.add("gengage-chat-ai-toppick-price--inline"),d.appendChild(g);const h=document.createElement("span");h.className="gengage-chat-ai-toppick-price-sep",h.setAttribute("aria-hidden","true");const f=document.createElement("span");f.className="gengage-chat-ai-toppick-original-price",f.textContent=ie(i,a.pricing),d.appendChild(h),d.appendChild(f)}else{const h=document.createElement("span");h.className="gengage-chat-ai-toppick-original-price",h.textContent=ie(i,a.pricing),d.appendChild(h),d.appendChild(document.createTextNode(" ")),d.appendChild(g)}e.appendChild(d);return}if(s&&o==="inline"){d.classList.add("gengage-chat-ai-toppick-price--inline");const g=document.createElement("span");g.className="gengage-chat-ai-toppick-price-current",g.textContent=ie(n,a.pricing);const h=document.createElement("span");h.className="gengage-chat-ai-toppick-price-sep",h.setAttribute("aria-hidden","true");const f=document.createElement("span");f.className="gengage-chat-ai-toppick-original-price",f.textContent=ie(i,a.pricing),d.appendChild(g),d.appendChild(h),d.appendChild(f)}else if(s){const g=document.createElement("span");g.className="gengage-chat-ai-toppick-original-price",g.textContent=ie(i,a.pricing),d.appendChild(g),d.appendChild(document.createTextNode(" "));const h=document.createElement("span");h.className="gengage-chat-ai-toppick-price-current",h.textContent=ie(n,a.pricing),d.appendChild(h)}else{const g=document.createElement("span");g.className="gengage-chat-ai-toppick-price-current",g.textContent=ie(n,a.pricing),d.appendChild(g)}if(r){const g=document.createElement("div");g.className="gengage-chat-ai-toppick-price-stack",g.appendChild(Ut(r)),g.appendChild(d),e.appendChild(g)}else e.appendChild(d)}function hg(t,e,a){const n=typeof t.reason=="string"?t.reason.trim():"",i=a.hideUserReviews!==!0&&typeof t.reviewHighlight=="string"?t.reviewHighlight.trim():"";if(!(!n&&!i)){if(n){const r=document.createElement("p");r.className="gengage-chat-ai-toppick-reason",r.dataset.gengagePart="ai-top-pick-reason",r.textContent=n,e.appendChild(r)}if(i){const r=document.createElement("div");r.className="gengage-chat-ai-toppick-review",r.dataset.gengagePart="ai-top-pick-review",r.textContent=i,e.appendChild(r)}}}function Qi(t,e,a,n){const i=document.createElement("div");i.className=a?"gengage-chat-ai-toppick-card gengage-chat-ai-toppick-card--winner gds-card":"gengage-chat-ai-toppick-card gengage-chat-ai-toppick-card--compact gds-card";const r=n?.uniformMobileLayout===!0;!a&&r&&i.classList.add("gengage-chat-ai-toppick-card--mobile-uniform"),i.dataset.gengagePart=a?"ai-top-pick-card-winner":"ai-top-pick-card";const o=t.product,s=Ki(t),c=o.url??"",l=o.cartCode,d=o.inStock,g=!!(s&&l&&d!==!1),h=t.action;s&&e.onProductClick?(i.classList.add("gds-clickable"),i.addEventListener("click",w=>{if(w.target.closest(".gengage-chat-ai-toppick-cta")||w.target.closest(".gengage-chat-favorite-btn")||w.target.closest(".gengage-chat-find-similar-pill"))return;const T=o.name;e.onProductClick?.({sku:s,url:c,...T?{name:T}:{}})})):h&&(i.classList.add("gds-clickable"),i.addEventListener("click",w=>{w.target.closest(".gengage-chat-ai-toppick-cta")||w.target.closest(".gengage-chat-favorite-btn")||w.target.closest(".gengage-chat-find-similar-pill")||e.onAction(h)}));const f=o.name||"Product image",b=!a&&e.isMobile===!0&&!r,m=a?Yi(t.role,e.i18n)??e.i18n?.roleWinner??"TOP MATCH":Yi(t.role,e.i18n);if(m&&!b){const w=document.createElement("span");w.className="gengage-chat-ai-toppick-badge gds-badge",w.dataset.gengagePart="ai-top-pick-role-badge",w.textContent=m,i.appendChild(w)}const u=document.createElement("div");u.className="gengage-chat-ai-toppick-top-row",u.dataset.gengagePart="ai-top-pick-top-row",dg(t,f,u,e,{skipOverlayActions:b});const p=document.createElement("div");if(p.className="gengage-chat-ai-toppick-body",p.dataset.gengagePart="ai-top-pick-body",m&&b){const w=document.createElement("div");w.className="gengage-chat-ai-toppick-role-line",w.dataset.gengagePart="ai-top-pick-role-line",w.textContent=m,p.appendChild(w)}const y=o.name;if(y){const w=document.createElement("div");w.className="gengage-chat-ai-toppick-name",w.dataset.gengagePart="ai-top-pick-name",w.textContent=y,p.appendChild(w)}const _=gg(o);_&&p.appendChild(_),pg(o,p,e),t.labels&&t.labels.length>0&&p.appendChild(mg(t.labels)),u.appendChild(p),i.appendChild(u);const x=document.createElement("div");if(x.className="gengage-chat-ai-toppick-detail",x.dataset.gengagePart="ai-top-pick-detail",a)hg(t,x,e);else{const w=typeof t.reason=="string"?t.reason.trim():"";if(w){const T=document.createElement("p");T.className="gengage-chat-ai-toppick-snippet",T.dataset.gengagePart="ai-top-pick-snippet",T.textContent=w,x.appendChild(T)}}x.childNodes.length>0&&i.appendChild(x);const P=!!(s&&e.topPicksLoadingSku===s),E=(g||h)&&!b;if(P||g||h){const w=document.createElement("div");if(w.className="gengage-chat-ai-toppick-spinner",w.dataset.gengagePart="ai-top-pick-spinner",w.style.display=P?"":"none",i.appendChild(w),E){const T=document.createElement("button");T.className="gengage-chat-ai-toppick-cta gds-btn gds-btn-primary",T.dataset.gengagePart="ai-top-pick-cta",T.type="button",T.textContent=g?e.i18n?.addToCartButton??"Add to Cart":e.i18n?.viewDetails??"View Details",T.addEventListener("click",F=>{if(F.stopPropagation(),g){e.onAction({title:e.i18n?.addToCartButton??"Add to Cart",type:"addToCart",payload:{sku:s,cartCode:l,quantity:1}});return}if(h){if(h.type==="findSimilar"&&s&&e.onProductClick){const Q=o.name;e.onProductClick({sku:s,url:c,...Q?{name:Q}:{}});return}e.onAction(h)}}),i.appendChild(T)}}return i}function ug(t,e){const a=document.createElement("div");a.className="gengage-chat-ai-top-picks",a.dataset.gengagePart="ai-top-picks";const n=t.props?.suggestions??[];if(n.length===0)return a;const i=document.createElement("div");i.className="gengage-chat-ai-top-picks-scroll",i.dataset.gengagePart="ai-top-picks-scroll";const r=e.isMobile===!0&&lg(),o=n[0];if(i.appendChild(Qi(o,e,!0,{uniformMobileLayout:r})),n.length>1){const s=document.createElement("div");s.className="gengage-chat-ai-top-picks-rest",r&&s.classList.add("gengage-chat-ai-top-picks-rest--uniform-mobile"),s.dataset.gengagePart="ai-top-picks-rest";for(let c=1;c<n.length;c++){const l=n[c],d=l.role==="winner";s.appendChild(Qi(l,e,d,{uniformMobileLayout:r}))}i.appendChild(s)}return a.appendChild(i),a}function mg(t){const e=document.createElement("div");e.className="gengage-chat-ai-toppick-labels",e.dataset.gengagePart="ai-top-pick-labels";for(const a of t){const n=document.createElement("span");n.className="gengage-chat-ai-toppick-label gds-chip",n.dataset.gengagePart="ai-top-pick-label",n.dataset.sentiment=a.sentiment??"neutral",n.textContent=a.label,e.appendChild(n)}return e}var Zi,fg=L((()=>{ct(),ge(),je(),Ua(),Zi={winner:"roleWinner",best_value:"roleBestValue",best_alternative:"roleBestAlternative"}}));function bg(t,e){const a=document.createElement("div");a.className="gengage-chat-grounding-review gds-evidence-card",a.dataset.gengagePart="grounding-review-card";const n=t.props??{},i=n.title,r=n.reviewCount,o=n.action,s=e.i18n?.groundingReviewCta??"Read Reviews",c=document.createElement("span");c.className="gengage-chat-grounding-review-icon",c.appendChild(vt(["M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z","M8 9h8","M8 13h6"])),a.appendChild(c);const l=document.createElement("div");l.className="gengage-chat-grounding-review-body",l.dataset.gengagePart="grounding-review-body";const d=document.createElement("div");if(d.className="gengage-chat-grounding-review-title",d.dataset.gengagePart="grounding-review-title",d.textContent=i??e.i18n?.customerReviewsTitle??"Customer Reviews",l.appendChild(d),r){const b=document.createElement("div");b.className="gengage-chat-grounding-review-subtitle",b.dataset.gengagePart="grounding-review-subtitle",b.textContent=(e.i18n?.groundingReviewSubtitle??"{count} yorum mevcut").replace("{count}",r),l.appendChild(b)}a.appendChild(l);const g=document.createElement("span");g.className="gengage-chat-grounding-review-cta",g.dataset.gengagePart="grounding-review-cta";const h=document.createElement("span");h.textContent=s,g.appendChild(h);const f=document.createElement("span");return f.className="gengage-chat-grounding-review-cta-icon",f.appendChild(vt(["M5 12h14","M15 8l4 4-4 4"],14)),g.appendChild(f),a.appendChild(g),o&&(a.classList.add("gds-clickable"),a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.addEventListener("click",()=>e.onAction(o)),a.addEventListener("keydown",b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),e.onAction(o))})),a}var vg=L((()=>{Gi()}));function yg(t){const e=t.action.type;if(e!=="findSimilar")return t.action;const a=t.action.payload&&typeof t.action.payload=="object"?t.action.payload:null,n=typeof a?.input=="string"&&a.input.trim()||typeof a?.text=="string"&&a.text.trim()||t.name.trim();if(!n)return t.action;const i={...a??{},text:n,is_suggested_text:1};return typeof a?.input=="string"&&a.input.trim()?i.input=a.input:delete i.input,{title:t.action.title,type:e,payload:Bt(i)}}function xg(t,e){const a=document.createElement("div");a.className="gengage-chat-grouping-cards",a.dataset.gengagePart="ai-grouping-cards";const n=t.props?.entries??[];if(n.length===0)return a;const i=t.props?.sectionTitle,r=typeof i=="string"&&i.trim().length>0?i.trim():e.i18n?.aiBrowseCategoriesTitle;if(r){const s=document.createElement("h3");s.className="gengage-chat-grouping-section-title",s.textContent=r,a.appendChild(s)}const o=document.createElement("div");o.className="gengage-chat-grouping-cards-scroll",o.dataset.gengagePart="ai-grouping-cards-scroll";for(const s of n){const c=document.createElement("div");if(c.className="gengage-chat-grouping-card gds-card",c.dataset.gengagePart="ai-grouping-card",c.classList.add("gds-clickable"),c.addEventListener("click",()=>e.onAction(yg(s))),s.image&&we(s.image)){const h=document.createElement("img");h.className="gengage-chat-grouping-card-img",h.dataset.gengagePart="ai-grouping-card-image",h.draggable=!1,h.src=s.image,h.alt=s.name,h.width=64,h.height=64,c.appendChild(h)}const l=document.createElement("div");l.className="gengage-chat-grouping-card-body",l.dataset.gengagePart="ai-grouping-card-body";const d=document.createElement("span");if(d.className="gengage-chat-grouping-card-name",d.dataset.gengagePart="ai-grouping-card-name",d.textContent=s.name,l.appendChild(d),s.labels&&s.labels.length>0){const h=document.createElement("div");h.className="gengage-chat-grouping-card-labels",h.dataset.gengagePart="ai-grouping-card-labels";for(const f of s.labels.slice(0,2)){const b=document.createElement("span");b.className="gengage-chat-grouping-card-label gds-chip",b.textContent=f,h.appendChild(b)}l.appendChild(h)}c.appendChild(l);const g=document.createElement("span");g.className="gengage-chat-grouping-card-arrow",g.textContent="↳",c.insertBefore(g,c.firstChild),o.appendChild(c)}return a.appendChild(o),a}var _g=L((()=>{ge(),_a()}));function wg(t,e){const a=document.createElement("div");a.className="gengage-chat-suggested-search-cards",a.dataset.gengagePart="ai-suggested-search-cards";const n=t.props?.entries??[];if(n.length===0)return a;for(const i of n){const r=document.createElement("div");if(r.className="gengage-chat-suggested-search-card gds-card",r.dataset.gengagePart="ai-suggested-search-card",r.classList.add("gds-clickable"),r.addEventListener("click",()=>e.onAction(i.action)),i.image&&we(i.image)){const c=document.createElement("img");c.className="gengage-chat-suggested-search-card-img",c.dataset.gengagePart="ai-suggested-search-card-image",c.src=i.image,c.alt=i.shortName,c.width=64,c.height=64,r.appendChild(c)}const o=document.createElement("div");o.className="gengage-chat-suggested-search-card-body",o.dataset.gengagePart="ai-suggested-search-card-body";const s=document.createElement("div");s.className="gengage-chat-suggested-search-card-name",s.dataset.gengagePart="ai-suggested-search-card-name",s.textContent=i.shortName,o.appendChild(s),r.appendChild(o),a.appendChild(r)}return a}var kg=L((()=>{ge()}));function Xi(t,e){const a=t.length>=2,n=e.i18n?.compareSelected??"Compare",i=e.comparisonSelectionWarning,r=document.createElement("div");r.className="gengage-chat-comparison-floating-btn",r.dataset.gengagePart="comparison-dock";const o=document.createElement("div");o.className="gengage-chat-comparison-floating-summary";const s=document.createElement("span");s.className="gengage-chat-comparison-floating-count",s.textContent=String(t.length),o.appendChild(s);const c=document.createElement("div");c.className="gengage-chat-comparison-floating-copy";const l=document.createElement("div");if(l.className="gengage-chat-comparison-floating-title",l.textContent=a?`${n} (${t.length})`:e.i18n?.compareMinHint??"Select at least 2 products",c.appendChild(l),i){const g=document.createElement("div");g.className="gengage-chat-comparison-floating-warning",g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.textContent=i,c.appendChild(g)}o.appendChild(c),r.appendChild(o);const d=document.createElement("button");if(d.className="gengage-chat-comparison-floating-action gds-btn gds-btn-primary",d.type="button",d.textContent=n,d.disabled=!a,a||d.classList.add("gengage-chat-comparison-floating-action--disabled"),d.addEventListener("click",()=>{a&&e.onAction({title:n,type:"getComparisonTable",payload:{sku_list:[...t],gengage_analytics_source:"floating_compare_dock"}})}),r.appendChild(d),e.onToggleComparisonSku){const g=document.createElement("button");g.className="gengage-chat-comparison-floating-close gds-btn gds-btn-ghost gds-icon-btn",g.dataset.gengagePart="comparison-dock-close",g.type="button",g.setAttribute("aria-label",e.i18n?.closeAriaLabel??"Close"),g.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18"/><path d="M6 6l12 12"/></svg>',g.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),e.onToggleComparisonSku?.("")}),r.appendChild(g)}return r}var Ji=L((()=>{}));function Cg(t){const e=document.createElement("div");e.className="gengage-chat-pros-cons gds-card-soft",e.dataset.gengagePart="pros-cons";const a=t.props?.productName;if(a){const r=document.createElement("h4");r.className="gengage-chat-pros-cons-heading",r.textContent=a,e.appendChild(r)}const n=t.props?.pros,i=t.props?.cons;if(n&&n.length>0){const r=document.createElement("ul");r.className="gengage-chat-pros-cons-list",r.dataset.gengagePart="pros-list";for(const o of n){const s=document.createElement("li");s.className="gengage-chat-pros-cons-item",s.dataset.gengagePart="pros-item";const c=document.createElement("span");c.className="gengage-chat-pros-cons-icon gengage-chat-pros-cons-icon--pro",c.textContent="✓",s.appendChild(c);const l=document.createElement("span");l.textContent=o,s.appendChild(l),r.appendChild(s)}e.appendChild(r)}if(i&&i.length>0){const r=document.createElement("ul");r.className="gengage-chat-pros-cons-list",r.dataset.gengagePart="cons-list";for(const o of i){const s=document.createElement("li");s.className="gengage-chat-pros-cons-item",s.dataset.gengagePart="cons-item";const c=document.createElement("span");c.className="gengage-chat-pros-cons-icon gengage-chat-pros-cons-icon--con",c.textContent="✗",s.appendChild(c);const l=document.createElement("span");l.textContent=o,s.appendChild(l),r.appendChild(s)}e.appendChild(r)}return e}var Sg=L((()=>{}));function Eg(t){const e=[],a=new Set,n=(i,r)=>{if(typeof i!="string")return;const o=i.trim();if(!o)return;const s=o.toLowerCase();a.has(s)||(a.add(s),e.push({text:o,accent:r}))};n(t.highlight,!0);for(const i of t.labels??[])n(i,!1);return e.slice(0,er)}function Pg(t){const e=Eg(t),a=typeof t.description=="string"?t.description.trim():"";if(!a&&e.length===0)return null;const n=document.createElement("div");if(n.className="gengage-chat-categories-group-summary",n.dataset.gengagePart="categories-group-summary",n.appendChild(Tg(t)),e.length>0&&n.appendChild(Ag(e)),a){const i=document.createElement("p");i.className="gengage-chat-categories-group-reason",i.dataset.gengagePart="categories-group-reason",i.textContent=a,n.appendChild(i)}return n}function Tg(t){const e=document.createElement("div");if(e.className="gengage-chat-categories-group-selection",e.dataset.gengagePart="categories-group-selection",t.image&&we(t.image)){const n=document.createElement("img");n.className="gengage-chat-categories-group-selection-image",n.draggable=!1,n.src=t.image,n.alt=t.groupName,n.loading="lazy",Ce(n),e.appendChild(n)}const a=document.createElement("div");return a.className="gengage-chat-categories-group-selection-title",a.textContent=t.groupName,e.appendChild(a),e}function Ag(t){const e=document.createElement("div");e.className="gengage-chat-categories-group-chips",e.dataset.gengagePart="categories-group-chips";for(const a of t){const n=document.createElement("span");n.className=a.accent?"gengage-chat-categories-group-chip gengage-chat-categories-group-chip--accent gds-chip gds-chip-active":"gengage-chat-categories-group-chip gds-chip",n.textContent=a.text,e.appendChild(n)}return e}function Lg(t,e){const a=t.props?.groups??[],n=t.props?.filterTags??[],i=`gengage-cat-${tr++}`,r=document.createElement("div");if(r.className="gengage-chat-categories",r.dataset.gengagePart="categories-container",a.length===0)return r;const o=document.createElement("div");o.className="gengage-chat-categories-tabs gds-toolbar",o.dataset.gengagePart="categories-tab-bar",o.setAttribute("role","tablist");const s=[],c=[],l=d=>{for(let g=0;g<s.length;g++){const h=g===d;s[g].classList.toggle("gengage-chat-categories-tab--active",h),s[g].classList.toggle("is-active",h),s[g].setAttribute("aria-selected",String(h)),s[g].tabIndex=h?0:-1,c[g].style.display=h?"":"none"}};for(let d=0;d<a.length;d++){const g=a[d],h=`${i}-tab-${d}`,f=`${i}-panel-${d}`,b=document.createElement("button");if(b.className="gengage-chat-categories-tab gds-tab",b.type="button",b.dataset.gengagePart="categories-tab",b.id=h,b.setAttribute("role","tab"),b.setAttribute("aria-controls",f),b.setAttribute("aria-selected",String(d===0)),b.tabIndex=d===0?0:-1,d===0&&b.classList.add("gengage-chat-categories-tab--active","is-active"),g.image&&we(g.image)){const _=document.createElement("img");_.className="gengage-chat-categories-tab-image",_.draggable=!1,_.src=g.image,_.alt=g.groupName,_.loading="lazy",Ce(_),b.appendChild(_)}const m=document.createElement("span");m.className="gengage-chat-categories-tab-text",m.textContent=g.groupName,b.appendChild(m),b.addEventListener("click",()=>l(d)),b.addEventListener("keydown",_=>{let x=-1;_.key==="ArrowRight"||_.key==="ArrowDown"?x=(d+1)%a.length:_.key==="ArrowLeft"||_.key==="ArrowUp"?x=(d-1+a.length)%a.length:_.key==="Home"?x=0:_.key==="End"&&(x=a.length-1),x>=0&&(_.preventDefault(),l(x),s[x].focus())}),s.push(b),o.appendChild(b);const u=document.createElement("div");u.className="gengage-chat-categories-panel",u.dataset.gengagePart="categories-panel",u.id=f,u.setAttribute("role","tabpanel"),u.setAttribute("aria-labelledby",h),d!==0&&(u.style.display="none");const p=Pg(g);p&&u.appendChild(p);const y=document.createElement("div");y.className="gengage-chat-categories-grid",y.dataset.gengagePart="categories-grid";for(const _ of g.products){const x=Ig(_,e);y.appendChild(x)}u.appendChild(y),c.push(u)}r.appendChild(o);for(const d of c)r.appendChild(d);if(n.length>0){const d=document.createElement("div");d.className="gengage-chat-categories-filter-tags gds-toolbar",d.dataset.gengagePart="categories-filter-tags";for(const g of n){const h=document.createElement("button");h.className="gengage-chat-categories-filter-tag gds-chip",h.type="button",h.dataset.gengagePart="categories-filter-tag",h.textContent=g.title,g.action&&h.addEventListener("click",()=>{e.onAction(g.action)}),d.appendChild(h)}r.appendChild(d)}return r}function Ig(t,e){const a=document.createElement("div");if(a.className="gengage-chat-product-card gds-card gds-product-card gds-card-interactive",a.dataset.gengagePart="categories-product-card",t.imageUrl&&we(t.imageUrl)){const r=document.createElement("img");r.className="gengage-chat-product-card-img",r.draggable=!1,r.src=t.imageUrl,r.alt=t.name,r.loading="lazy",Ce(r),a.appendChild(r)}const n=document.createElement("div");n.className="gengage-chat-product-card-body";const i=document.createElement("div");if(i.className="gengage-chat-product-card-name",i.textContent=t.name,n.appendChild(i),t.price){const r=document.createElement("div");r.className="gengage-chat-product-card-price",r.textContent=ie(t.price,e.pricing),n.appendChild(r)}return a.appendChild(n),(e.onProductSelect||e.onAction)&&(a.classList.add("gds-clickable"),a.addEventListener("click",()=>{if(t.sku){e.onAction({title:t.name,type:"launchSingleProduct",payload:{sku:t.sku}});return}e.onProductSelect?.(t)})),a}var er,tr,Ng=L((()=>{ge(),ct(),je(),er=4,tr=0}));function Mg(t,e){const a=document.createElement("div");a.className="gengage-chat-handoff-notice gds-evidence-card gds-evidence-card-warning",a.dataset.gengagePart="handoff-notice",a.setAttribute("role","alert");const n=document.createElement("span");n.className="gengage-chat-handoff-notice-icon",n.textContent="👤",n.setAttribute("aria-hidden","true"),a.appendChild(n);const i=document.createElement("h4");i.className="gengage-chat-handoff-notice-heading",i.textContent=e.i18n?.handoffHeading??"Transferring to a support agent",a.appendChild(i);const r=t.props?.summary;if(r){const o=document.createElement("p");o.className="gengage-chat-handoff-notice-summary",o.textContent=r,a.appendChild(o)}return a}var Bg=L((()=>{}));function $e(t){return typeof t=="string"?t:""}function Rg(t){return Array.isArray(t)?t.map(e=>{if(!e||typeof e!="object")return null;const a=e;return{imageUrl:$e(a.imageUrl)||void 0,name:$e(a.name)||void 0}}).filter(e=>e!==null):[]}function zg(t,e){const a=t.props??{},n=$e(a.eyebrow),i=$e(a.title),r=a.showTitle!==!1,o=$e(a.ctaLabel)||e.i18n?.showPanelAriaLabel||"Show Results",s=$e(a.panelMessageId),c=$e(a.highlightMessageId),l=$e(a.threadId),d=Rg(a.products).slice(0,3),g=document.createElement("button");g.type="button",g.className="gengage-chat-panel-restore-card gds-card",!n&&!r&&g.classList.add("gengage-chat-panel-restore-card--minimal"),g.dataset.gengagePart="panel-restore-card";const h=i||n||o;g.setAttribute("aria-label",i?`${h} - ${o}`:h);const f={title:i,type:ar,payload:{panelMessageId:s,highlightMessageId:c,threadId:l}};if(g.addEventListener("click",()=>e.onAction(f)),n){const m=document.createElement("div");m.className="gengage-chat-panel-restore-card__eyebrow",m.textContent=n,g.appendChild(m)}if(d.length>0){const m=document.createElement("div");m.className="gengage-chat-panel-restore-card__previews";for(const u of d){const p=document.createElement("div");p.className="gengage-chat-panel-restore-card__thumb";const y=u.imageUrl;if(y&&pe(y)){const _=document.createElement("img");_.loading="lazy",_.alt=u.name||i,he(_,"src",y),Ce(_),p.appendChild(_)}m.appendChild(p)}g.appendChild(m)}if(r&&i){const m=document.createElement("div");m.className="gengage-chat-panel-restore-card__title",m.textContent=i,m.title=i,g.appendChild(m)}const b=document.createElement("div");return b.className="gengage-chat-panel-restore-card__cta",b.textContent=o,g.appendChild(b),g}var ar,nr=L((()=>{ge(),je(),ar="frontend_restore_panel_message"}));function Hg(t,e){const a=t.props?.product??t.props,n=document.createElement("div");if(n.className="gengage-chat-product-summary gds-card",n.dataset.gengagePart="product-summary-card",!a)return n;n.classList.add("gds-clickable"),n.addEventListener("click",p=>{p.target.closest("a")||e.onProductSelect?.(a)});const i=a.imageUrl;if(i&&pe(i)){const p=document.createElement("div");p.className="gengage-chat-product-summary__image",p.dataset.gengagePart="product-summary-image";const y=document.createElement("img");y.loading="lazy",he(y,"src",i),y.alt=a.name||"Product image",Ce(y),p.appendChild(y),n.appendChild(p)}const r=document.createElement("div");r.className="gengage-chat-product-summary__content",r.dataset.gengagePart="product-summary-content";const o=a.brand,s=a.name;if(s){const p=document.createElement("div");p.className="gengage-chat-product-summary__name",p.dataset.gengagePart="product-summary-name";const y=o&&!s.toLowerCase().startsWith(o.toLowerCase())?`${o} ${s}`:s;p.textContent=y,p.title=y,r.appendChild(p)}const c=a.rating,l=a.reviewCount;if(e.hideUserReviews!==!0&&typeof c=="number"&&Number.isFinite(c)&&c>0){const p=document.createElement("div");if(p.className="gengage-chat-product-summary__rating",p.dataset.gengagePart="product-summary-rating",p.appendChild(Fa(c)),typeof l=="number"&&Number.isFinite(l)){const y=document.createElement("span");y.className="gengage-chat-product-summary__review-count",y.textContent=` (${l})`,p.appendChild(y)}r.appendChild(p)}const d=a.price,g=a.originalPrice;if(d){const p=lt(e,a),y=yt(e,a),_=!!(g&&g!==d),x=document.createElement("div");x.className="gengage-chat-product-summary__price",x.dataset.gengagePart="product-summary-price";const P=!!(p&&_),E=Ot(e,a);if(P){const w=qt({reasonText:p,salePriceFormatted:ie(d,e.pricing),...E!==void 0?{logoUrl:E}:{}});if(_&&y==="inline"){x.classList.add("gengage-chat-product-summary__price--inline"),x.appendChild(w);const T=document.createElement("span");T.className="gengage-chat-product-summary__price-sep",T.setAttribute("aria-hidden","true");const F=document.createElement("span");F.className="gengage-chat-product-summary__price-original",F.textContent=ie(g,e.pricing),x.appendChild(T),x.appendChild(F)}else{const T=document.createElement("span");T.className="gengage-chat-product-summary__price-original",T.textContent=ie(g,e.pricing),x.appendChild(T),x.appendChild(document.createTextNode(" ")),x.appendChild(w)}r.appendChild(x)}else{if(_&&y==="inline"){x.classList.add("gengage-chat-product-summary__price--inline");const w=document.createElement("span");w.className="gengage-chat-product-summary__price-current",w.textContent=ie(d,e.pricing);const T=document.createElement("span");T.className="gengage-chat-product-summary__price-sep",T.setAttribute("aria-hidden","true");const F=document.createElement("span");F.className="gengage-chat-product-summary__price-original",F.textContent=ie(g,e.pricing),x.appendChild(w),x.appendChild(T),x.appendChild(F)}else if(_){const w=document.createElement("span");w.className="gengage-chat-product-summary__price-original",w.textContent=ie(g,e.pricing),x.appendChild(w),x.appendChild(document.createTextNode(" "));const T=document.createElement("span");T.className="gengage-chat-product-summary__price-current",T.textContent=ie(d,e.pricing),x.appendChild(T)}else{const w=document.createElement("span");w.className="gengage-chat-product-summary__price-current",w.textContent=ie(d,e.pricing),x.appendChild(w)}if(p){const w=document.createElement("div");w.className="gengage-chat-product-summary__price-stack",w.appendChild(Ut(p)),w.appendChild(x),r.appendChild(w)}else r.appendChild(x)}}n.appendChild(r);const h=a.url,f=a.sku,b=a.cartCode??a.cart_code,m=typeof b=="string"&&b.trim()?b.trim():void 0,u=a.inStock;if(f&&m&&u!==!1){const p=document.createElement("button");p.type="button",p.className="gengage-chat-product-summary__cta gds-chip gds-chip-active",p.dataset.gengagePart="product-summary-cta",p.textContent=e.i18n?.addToCartButton??"Add to Cart",p.addEventListener("click",y=>{y.stopPropagation(),e.onAction({title:e.i18n?.addToCartButton??"Add to Cart",type:"addToCart",payload:{sku:f,cartCode:m,quantity:1}})}),n.appendChild(p)}else if(h&&pe(h)){const p=document.createElement("a");p.className="gengage-chat-product-summary__cta gds-chip gds-chip-active",p.dataset.gengagePart="product-summary-cta",he(p,"href",h),he(p,"target","_blank"),he(p,"rel","noopener noreferrer"),p.textContent=e.i18n?.productCtaLabel??"View",n.appendChild(p)}return n}var Fg=L((()=>{ct(),ge(),je(),Ua()})),ir,Dg=L((()=>{Na(),Ia(),ir={PhotoAnalysisCard:({element:t,context:e})=>Ll(t,e),BeautyPhotoStep:({element:t,context:e})=>Li(t,e)}}));function Oa(){return window.innerWidth<768}function rr(){return{...$a}}function or(t,e,a=$a,n=Gt){return ga({spec:t,context:e,registry:a,containerClassName:"gengage-chat-uispec",unknownRenderer:n})}function Ug(t,e){const a=document.createElement("div");a.className="gengage-chat-action-buttons";const n=t.props?.buttons;if(n)for(const i of n){const r=document.createElement("button");r.className="gengage-chat-action-btn",r.textContent=i.label,r.addEventListener("click",()=>e.onAction(i.action)),a.appendChild(r)}return a}function Og(t,e){const a=document.createElement("button");a.className="gengage-chat-action-btn";const n=t.props?.label;typeof n=="string"&&(a.textContent=n);const i=t.props?.action;return i&&a.addEventListener("click",()=>e.onAction(i)),a}function sr(t,e,a,n,i){t.replaceChildren();const r=yt(e,a),o=!!(i&&n&&i!==n),s=lt(e,a),c=!!(s&&o),l=Ot(e,a);if(!n||parseFloat(n)<=0)return;if(c){const g=qt({reasonText:s,salePriceFormatted:ie(n,e.pricing),...l!==void 0?{logoUrl:l}:{}});if(o&&r==="inline"){t.classList.add("gengage-chat-product-card-price-block--inline");const h=document.createElement("div");h.className="gengage-chat-product-card-price-row",h.appendChild(g);const f=document.createElement("span");f.className="gengage-chat-product-card-price-sep",f.setAttribute("aria-hidden","true");const b=document.createElement("span");b.className="gengage-chat-product-card-original-price",b.textContent=ie(i,e.pricing),h.appendChild(f),h.appendChild(b),t.appendChild(h);return}if(t.classList.remove("gengage-chat-product-card-price-block--inline"),t.appendChild(g),o){t.appendChild(document.createTextNode(" "));const h=document.createElement("span");h.className="gengage-chat-product-card-original-price",h.textContent=ie(i,e.pricing),t.appendChild(h)}return}if(o&&r==="inline"){t.classList.add("gengage-chat-product-card-price-block--inline");const g=document.createElement("div");g.className="gengage-chat-product-card-price-row";const h=document.createElement("span");h.className="gengage-chat-product-card-current-price",h.textContent=ie(n,e.pricing);const f=document.createElement("span");f.className="gengage-chat-product-card-price-sep",f.setAttribute("aria-hidden","true");const b=document.createElement("span");b.className="gengage-chat-product-card-original-price",b.textContent=ie(i,e.pricing),g.appendChild(h),g.appendChild(f),g.appendChild(b),t.appendChild(g);return}t.classList.remove("gengage-chat-product-card-price-block--inline");const d=document.createElement("span");if(d.className="gengage-chat-product-card-current-price",d.textContent=ie(n,e.pricing),t.appendChild(d),o){t.appendChild(document.createTextNode(" "));const g=document.createElement("span");g.className="gengage-chat-product-card-original-price",g.textContent=ie(i,e.pricing),t.appendChild(g)}}function cr(t,e,a,n,i,r,o){t.classList.remove("gengage-chat-product-details-price--inline"),t.replaceChildren(),t.className="gengage-chat-product-details-price";const s=lt(e,a),c=!!(s&&o),l=Ot(e,a);if(c){const g=qt({reasonText:s,salePriceFormatted:ie(n,e.pricing),...l!==void 0?{logoUrl:l}:{}});if(o&&r==="inline"){t.classList.add("gengage-chat-product-details-price--inline"),t.appendChild(g);const h=document.createElement("span");h.className="gengage-chat-product-details-price-sep",h.setAttribute("aria-hidden","true");const f=document.createElement("span");f.className="gengage-chat-product-details-original-price",f.textContent=ie(i,e.pricing),t.appendChild(h),t.appendChild(f)}else{if(o){const h=document.createElement("span");h.className="gengage-chat-product-details-original-price",h.textContent=ie(i,e.pricing),t.appendChild(h),t.appendChild(document.createTextNode(" "))}t.appendChild(g)}}else if(o&&r==="inline"){t.classList.add("gengage-chat-product-details-price--inline");const g=document.createElement("span");g.className="gengage-chat-product-details-current-price",g.textContent=ie(n,e.pricing);const h=document.createElement("span");h.className="gengage-chat-product-details-price-sep",h.setAttribute("aria-hidden","true");const f=document.createElement("span");f.className="gengage-chat-product-details-original-price",f.textContent=ie(i,e.pricing),t.appendChild(g),t.appendChild(h),t.appendChild(f)}else{if(o){const h=document.createElement("span");h.className="gengage-chat-product-details-original-price",h.textContent=ie(i,e.pricing),t.appendChild(h),t.appendChild(document.createTextNode(" "))}const g=document.createElement("span");g.className="gengage-chat-product-details-current-price",g.textContent=ie(n,e.pricing),t.appendChild(g)}const d=jt(a,"discountPercent","price_discount_rate");if(!e.hideProductDiscountBadge&&typeof d=="number"&&d>0){const g=document.createElement("span");g.className="gengage-chat-product-details-discount-badge",g.textContent=`%${Ha(d)}`,t.appendChild(g)}}function qa(t,e){const a=document.createElement("div");a.className="gengage-chat-product-card gds-card gds-product-card gds-card-interactive";const n=t.props?.product??t.props;if(!n)return a;const i=n.sku;i&&(a.dataset.sku=i);const r=t.props?.action,o=n.name,s=n.url,c=n.sku,l=s&&pe(s)?s:void 0,d=()=>r?.type!=="launchSingleProduct"||l===void 0||c===void 0||e.onProductClick===void 0?!1:(e.onProductClick({sku:c,url:l,...typeof o=="string"?{name:o}:{}}),!0);(e.onProductSelect||r)&&(a.classList.add("gds-clickable"),a.addEventListener("click",k=>{if(!a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")&&!k.target.closest(".gengage-chat-product-card-atc")&&!k.target.closest(".gengage-chat-product-card-cta")){if(r){d()||e.onAction(r);return}e.onProductSelect?.(n)}}));const g=n.imageUrl;if(g&&pe(g)){const k=document.createElement("div");k.className="gengage-chat-product-card-img-wrapper";const M=document.createElement("img");M.className="gengage-chat-product-card-img",M.loading="lazy",he(M,"src",g);const W=n.name;W&&(M.alt=W),Ce(M),k.appendChild(M);const $=n.discountPercent;if(!e.hideProductDiscountBadge&&typeof $=="number"&&$>0){const v=document.createElement("span");v.className="gengage-chat-product-card-discount-badge",v.textContent=`%${Ha($)}`,k.appendChild(v)}const D=document.createElement("div");D.className="gengage-chat-product-card-img-actions";const ae=n.sku;if(ae&&e.onFavoriteToggle){const v=document.createElement("button");v.className="gengage-chat-favorite-btn",v.type="button",v.dataset.gengageFavoriteSku=ae,v.setAttribute("aria-label",e.i18n?.addToFavoritesLabel??"Add to favorites");const N=e.favoritedSkus?.has(ae)??!1;N&&v.classList.add("gengage-chat-favorite-btn--active"),v.innerHTML=`<svg width="14" height="14" viewBox="0 0 24 24" fill="${N?"currentColor":"none"}" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>`,v.addEventListener("click",I=>{I.stopPropagation(),v.classList.toggle("gengage-chat-favorite-btn--active");const R=v.querySelector("svg");R&&R.setAttribute("fill",v.classList.contains("gengage-chat-favorite-btn--active")?"currentColor":"none"),e.onFavoriteToggle(ae,n)}),D.appendChild(v)}const ne=n.sku,V=e.i18n?.findSimilarLabel??"Find Similar";if(ne){const v=document.createElement("button");v.className="gengage-chat-find-similar-pill",v.type="button",v.setAttribute("aria-label",V),v.dataset.tooltip=V,v.innerHTML='<span class="gengage-chat-find-similar-pill-icon" aria-hidden="true"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M16 16l5.5 5.5"/></svg></span>';const N=document.createElement("span");N.className="gengage-chat-find-similar-pill-text",N.textContent=V,v.appendChild(N),v.addEventListener("click",I=>{I.stopPropagation(),e.onAction({title:V,type:"findSimilar",payload:{sku:ne}})}),D.appendChild(v)}D.childElementCount>0&&k.appendChild(D),a.appendChild(k)}const h=document.createElement("div");h.className="gengage-chat-product-card-body";const f=n.brand;if(f){const k=document.createElement("div");k.className="gengage-chat-product-card-brand",k.textContent=f,h.appendChild(k)}const b=n.rating,m=n.reviewCount,u=n.price,p=n.originalPrice,y=n.price_async,_=lt(e,n),x=yt(e,n),P=!!(p&&u&&p!==u&&parseFloat(u)>0),E=!!(_&&P),w=!!(_&&!E||P&&x==="inline"),T=typeof b=="number"&&Number.isFinite(b)&&b>0,F=document.createElement("div");F.className="gengage-chat-product-card-meta-row";const Q=document.createElement("div");Q.className="gengage-chat-product-card-price gengage-chat-product-card-price-block";const J=w?(()=>{const k=document.createElement("div");return k.className="gengage-chat-product-card-price-stack",_&&!E&&k.appendChild(Ut(_)),k.appendChild(Q),k})():Q;if(y===!0){const k=document.createElement("span");k.className="gengage-chat-price-skeleton",Q.appendChild(k),setTimeout(()=>{k.parentElement&&(u&&parseFloat(u)>0?sr(Q,e,n,u,n.originalPrice):k.remove())},300)}else u&&parseFloat(u)>0&&sr(Q,e,n,u,p);if((Q.childElementCount>0||y===!0)&&F.appendChild(J),T){const k=document.createElement("div");k.className="gengage-chat-product-card-rating gengage-chat-product-card-rating-compact";const M=za(b),W=[`${M.toFixed(1)}`,"out of 5 stars"];typeof m=="number"&&Number.isFinite(m)&&W.push(`(${m} reviews)`),k.setAttribute("aria-label",W.join(" "));const $=document.createElement("span");$.className="gengage-chat-product-card-rating-compact-star",$.setAttribute("aria-hidden","true"),$.innerHTML='<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3.6l2.58 5.23 5.77.84-4.17 4.07.98 5.75L12 16.78l-5.16 2.71.99-5.75L3.66 9.67l5.76-.84L12 3.6z"/></svg>';const D=document.createElement("span");D.className="gengage-chat-product-card-rating-compact-value",D.textContent=M.toFixed(1),k.appendChild($),k.appendChild(D),F.appendChild(k)}if(F.childElementCount===0&&(F.classList.add("gengage-chat-product-card-meta-row--empty"),F.setAttribute("aria-hidden","true")),h.appendChild(F),o){const k=document.createElement("div");k.className="gengage-chat-product-card-name",k.textContent=o,k.title=o,h.appendChild(k)}const oe=n.inStock;if(e.hideStockStatus!==!0&&typeof oe=="boolean"){const k=document.createElement("div");k.className=`gengage-chat-product-card-stock ${oe?"is-in-stock":"is-out-of-stock"}`,k.textContent=oe?e.i18n?.inStockLabel??"In Stock":e.i18n?.outOfStockLabel??"Out of Stock",h.appendChild(k)}a.appendChild(h);const U=n.cartCode,S=!!(U&&c&&oe!==!1),B=e.i18n?.productCtaLabel??"View";if(S){const k=document.createElement("div");k.className="gengage-chat-product-card-buy-footer";const M=document.createElement("button");M.type="button",M.className="gengage-chat-product-card-buy-trigger",M.textContent=B,M.addEventListener("click",W=>{W.stopPropagation(),e.onAction({title:e.i18n?.addToCartButton??B,type:"addToCart",payload:{sku:c,cartCode:U,quantity:1}})}),k.appendChild(M),a.appendChild(k)}else if(r){const k=document.createElement("button");k.className="gengage-chat-product-card-cta",k.type="button",k.textContent=r.type==="launchSingleProduct"?B:r.title||B,k.addEventListener("click",M=>{if(a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")){M.stopPropagation();return}d()||e.onAction(r)}),a.appendChild(k)}else if(l){const k=document.createElement("a");k.className="gengage-chat-product-card-cta",he(k,"href",l),he(k,"target","_blank"),he(k,"rel","noopener noreferrer"),k.textContent=B,k.addEventListener("click",M=>{if(a.parentElement?.classList.contains("gengage-chat-comparison-select-wrapper")){M.preventDefault(),M.stopPropagation();return}e.onProductClick&&c&&(M.preventDefault(),e.onProductClick({sku:c,url:l,...o?{name:o}:{}}))}),a.appendChild(k)}if(e.comparisonSelectMode&&c&&e.onToggleComparisonSku){const k=document.createElement("div");k.className="gengage-chat-comparison-select-wrapper";const M=e.comparisonSelectedSkus?.includes(c)??!1;M&&k.classList.add("gengage-chat-comparison-select-wrapper--selected");const W=n.name??c,$=e.i18n?.comparisonSelectCardHint??"Tap anywhere on the card to add or remove it from comparison.";k.setAttribute("role","group"),k.setAttribute("aria-label",`${String(W)}. ${$}`);const D=document.createElement("button");D.type="button",D.className="gengage-chat-comparison-checkbox",D.dataset.selected=M?"true":"false",D.setAttribute("aria-pressed",M?"true":"false");const ae=document.createElement("span");ae.className="gengage-chat-comparison-checkbox-icon",ae.innerHTML=M?'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>':'<span class="gengage-chat-comparison-checkbox-dot"></span>';const ne=document.createElement("span");ne.className="gengage-chat-comparison-checkbox-label",ne.textContent=M?e.i18n?.comparisonSelectedLabel??"Selected":e.i18n?.comparisonSelectLabel??"Select to compare",D.appendChild(ae),D.appendChild(ne),D.addEventListener("click",v=>{v.stopPropagation(),e.onToggleComparisonSku?.(c)});const V=document.createElement("div");return V.className="gengage-chat-comparison-card-hint",V.setAttribute("aria-hidden","true"),V.textContent=$,k.addEventListener("click",v=>{v.target.closest(".gengage-chat-comparison-checkbox")||(v.stopPropagation(),e.onToggleComparisonSku?.(c))}),k.appendChild(D),k.appendChild(V),k.appendChild(a),k}return a}function Se(t,...e){for(const a of e){const n=t[a];if(typeof n=="string"){const i=n.trim();if(i.length>0)return i}}}function jt(t,...e){for(const a of e){const n=t[a];if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){const i=Number(n.replace(",","."));if(Number.isFinite(i))return i}}}function $t(t,...e){for(const a of e){const n=t[a];if(typeof n=="boolean")return n}}function qg(t,...e){for(const a of e){const n=t[a];if(n&&typeof n=="object"&&!Array.isArray(n))return n}}function jg(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.trim().length>0):[]}function $g(t){const e=[...jg(t.images),Se(t,"imageUrl","image_url","image")].filter(a=>!!a&&pe(a));return Array.from(new Set(e))}function Vg(t){return typeof DOMParser<"u"?(new DOMParser().parseFromString(t,"text/html").body.textContent??"").replace(/\s+/g," ").trim():t.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()}function Gg(t){const e=Se(t,"description_html","descriptionHtml");if(e){const n=Vg(e);if(n)return{text:n,html:e}}const a=Se(t,"description");return a?{text:a}:void 0}function Vt(t){return Array.isArray(t)?t.map(e=>{if(!e||typeof e!="object")return null;const a=e,n=Se(a,"key","name","label","title"),i=a.value,r=typeof i=="string"||typeof i=="number"||typeof i=="boolean"?String(i).trim():void 0;return!n||!r?null:{key:n,value:r}}).filter(e=>e!==null):t&&typeof t=="object"?Object.entries(t).map(([e,a])=>{const n=typeof a=="string"||typeof a=="number"||typeof a=="boolean"?String(a).trim():void 0;return!e||!n?null:{key:e,value:n}}).filter(e=>e!==null):[]}function lr(t){const e=Vt(t.features);return e.length>0?e:Vt(t.specifications)}function Wg(t){const e=t.specifications,a=Vt(e);if(a.length>0)return Array.isArray(e)?a:Object.fromEntries(a.map(i=>[i.key,i.value]));const n=Vt(t.features);return n.length>0?n:void 0}function Fe(t,...e){return Se(t,...e)}function gr(t,...e){return jt(t,...e)}function dr(t){return Fe(t,"value","option_value","attribute_value","label","title","name","variant_name","sku")}function pr(t){const e=Fe(t,"type","attribute","option_name","attribute_name");return e||(Fe(t,"value")?Fe(t,"name","variant_name"):void 0)}function Kg(t){const e=pr(t)?.toLowerCase();return!!(Se(t,"color","colour","color_hex","hex","swatch","swatchColor")||e&&Va.has(e))}function hr(t){if(!t)return;const e=t.trim();if(!(!e||e.includes(";"))&&(typeof CSS<"u"&&CSS.supports?.("color",e)||/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)))return e}function Yg(t){const e=hr(Fe(t,"swatchColor","swatch","color_hex","hex","color","colour"));if(e)return e;if(Kg(t))return hr(dr(t))}function Qg(t){return Fe(t,"image","imageUrl","image_url","swatchImage","swatch_image")}function Zg(t){return gr(t,"price_discounted","priceDiscounted")??Fe(t,"price_discounted","priceDiscounted")??gr(t,"price")??Fe(t,"price")}function Xg(t){const e=t.trim().toLowerCase();return Va.has(e)||br.has(e)||vr.has(e)}function Jg(t){const e=t.trim().toLowerCase();return e==="renk kodu"?"Renk":e==="color code"?"Color":t.trim()}function ed(t){for(const e of yr){const a=t[e];if(!Array.isArray(a))continue;const n=a.filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i));if(n.length>0)return n}}function td(t){const e=ed(t);if(e)return e;const a=Se(t,"sku"),n=$t(t,"inStock","in_stock"),i=[],r=new Set,o=(c,l)=>{if(!Xg(c)||typeof l!="string"&&typeof l!="number"&&typeof l!="boolean")return;const d=String(l).trim();if(!d)return;const g=Jg(c),h=`${g.toLowerCase()}:${d.toLowerCase()}`;r.has(h)||(r.add(h),i.push({name:g,value:d,sku:a,inStock:n}))},s=qg(t,"facetHits","facet_hits");if(s)for(const[c,l]of Object.entries(s))o(c,l);for(const c of lr(t))o(c.key,c.value);return i}function ad(t,e){const a=Array.from(new Set(t.map(pr).filter(n=>!!n)));return a.length===1?`${t.length} ${a[0]}`:e.i18n?.variantsLabel??"Variants"}function nd(t,e){const a=document.createElement("article");a.className="gengage-chat-product-details-panel";const n=t.props?.product??t.props;if(!n)return a;const i=Se(n,"name"),r=Se(n,"brand"),o=Se(n,"sku"),s=Se(n,"cartCode","cart_code"),c=Se(n,"price"),l=Se(n,"originalPrice","price_original"),d=$t(n,"price_async"),g=lt(e,n),h=yt(e,n),f=!!(l&&c&&l!==c),b=$t(n,"inStock","in_stock"),m=jt(n,"reviewCount","review_count"),u=jt(n,"rating"),p=$g(n),y=lr(n).slice(0,4);if(p.length>1){const S=document.createElement("div");S.className="gengage-chat-product-details-media gengage-chat-product-details-gallery gengage-chat-product-details-img-wrap";const B=document.createElement("img");B.className="gengage-chat-product-details-img",he(B,"src",p[0]),B.alt=i??"Product image",Ce(B),S.appendChild(B);const k=document.createElement("div");k.className="gengage-chat-product-gallery-thumbs";const M=6;let W=null,$=0;const D=e.i18n,ae=D?.galleryPrevAriaLabel??"Previous image",ne=D?.galleryNextAriaLabel??"Next image",V=j=>j==="prev"?'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 18 9 12 15 6"/></svg>':'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="9 18 15 12 9 6"/></svg>',v=document.createElement("button");v.type="button",v.className="gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--prev gds-btn gds-btn-ghost gds-icon-btn",v.setAttribute("aria-label",ae),v.innerHTML=V("prev");const N=document.createElement("button");N.type="button",N.className="gengage-chat-product-gallery-nav gengage-chat-product-gallery-nav--next gds-btn gds-btn-ghost gds-icon-btn",N.setAttribute("aria-label",ne),N.innerHTML=V("next");const I=()=>{v.disabled=$<=0,N.disabled=$>=p.length-1},R=j=>{if(j<0||j>=p.length||j===$)return;const ee=p[j];if(!ee)return;he(B,"src",ee);const K=k.querySelectorAll(".gengage-chat-product-gallery-thumb");W&&W.classList.remove("gengage-chat-product-gallery-thumb--active"),j<M&&K[j]?(K[j].classList.add("gengage-chat-product-gallery-thumb--active"),W=K[j]):W=null,$=j,I()};for(let j=0;j<p.length;j++){const ee=p[j];if(j>=M)break;const K=document.createElement("img");K.className="gengage-chat-product-gallery-thumb",j===0&&(K.classList.add("gengage-chat-product-gallery-thumb--active"),W=K),he(K,"src",ee),K.alt=`${i??"Product"} ${j+1}`,K.width=48,K.height=48,Ce(K),K.addEventListener("click",()=>{R(j)}),k.appendChild(K)}if(p.length>M){const j=document.createElement("span");j.className="gengage-chat-product-gallery-thumb-more",j.textContent=`+${p.length-M}`,k.appendChild(j)}v.addEventListener("click",j=>{j.stopPropagation(),R($-1)}),N.addEventListener("click",j=>{j.stopPropagation(),R($+1)}),I();let O=0;const q=50;B.addEventListener("touchstart",j=>{O=j.changedTouches[0].clientX},{passive:!0}),B.addEventListener("touchend",j=>{const ee=j.changedTouches[0].clientX,K=O-ee;Math.abs(K)<q||R(K>0?Math.min($+1,p.length-1):Math.max($-1,0))}),S.appendChild(v),S.appendChild(N),S.appendChild(k),a.appendChild(S)}else if(p.length===1){const S=document.createElement("div");S.className="gengage-chat-product-details-media gengage-chat-product-details-img-wrap";const B=document.createElement("img");B.className="gengage-chat-product-details-img",B.loading="lazy",he(B,"src",p[0]),Ce(B),B.alt=i??"Product image",S.appendChild(B),a.appendChild(S)}const _=document.createElement("div");if(_.className="gengage-chat-product-details-content",r&&(!i||!i.toLowerCase().startsWith(r.toLowerCase()))){const S=document.createElement("div");S.className="gengage-chat-product-details-brand",S.textContent=r,_.appendChild(S)}if(i){const S=document.createElement("h3");S.className="gengage-chat-product-details-title",S.textContent=i,S.title=i,_.appendChild(S)}if(e.hideUserReviews!==!0&&typeof u=="number"&&Number.isFinite(u)&&u>0){const S=document.createElement(o?"button":"div");S.className="gengage-chat-product-details-rating",o&&(S.type="button",S.classList.add("gengage-chat-product-details-rating--clickable"),S.setAttribute("aria-label",e.i18n?.groundingReviewCta??"Read Reviews"),S.addEventListener("click",()=>{e.onAction({title:e.i18n?.customerReviewsTitle??"Customer Reviews",type:"reviewSummary",payload:{sku:o}})})),S.appendChild(Fa(u));const B=document.createElement("span");if(B.className="gengage-chat-product-details-rating-value",B.textContent=za(u).toFixed(1),S.appendChild(B),typeof m=="number"&&Number.isFinite(m)){const k=document.createElement("span");k.className="gengage-chat-product-details-review-count",k.textContent=` (${m})`,S.appendChild(k)}_.appendChild(S)}{const S=!!(g&&f);let B=_;if(g&&!S){const M=document.createElement("div");M.className="gengage-chat-product-details-price-stack",M.appendChild(Ut(g)),_.appendChild(M),B=M}const k=document.createElement("div");if(k.className="gengage-chat-product-details-price",d===!0){const M=document.createElement("span");M.className="gengage-chat-price-skeleton",k.appendChild(M),B.appendChild(k),setTimeout(()=>{if(M.parentElement)if(c&&parseFloat(c)>0)cr(k,e,n,c,l,h,f);else{const W=k.parentElement;k.remove(),W?.classList.contains("gengage-chat-product-details-price-stack")&&W.remove()}},300)}else if(c&&parseFloat(c)>0)cr(k,e,n,c,l,h,f),B.appendChild(k);else if(g){const M=B;M.classList.contains("gengage-chat-product-details-price-stack")&&M.remove()}}if(e.hideStockStatus!==!0&&typeof b=="boolean"){const S=document.createElement("div");S.className=`gengage-chat-product-details-stock ${b?"is-in-stock":"is-out-of-stock"}`,S.textContent=b?e.i18n?.inStockLabel??"In Stock":e.i18n?.outOfStockLabel??"Out of Stock",_.appendChild(S)}const x=n.promotions;if(x&&x.length>0){const S=document.createElement("div");S.className="gengage-chat-product-details-promos";for(const B of x.slice(0,3)){if(!B||/%(0(\.0+)?)\s/.test(B))continue;const k=document.createElement("span");k.className="gengage-chat-product-details-promo-badge",k.textContent=B,k.title=B,S.appendChild(k)}S.childElementCount>0&&_.appendChild(S)}if(y.length>0){const S=document.createElement("dl");S.className="gengage-chat-product-details-facts";for(const B of y){const k=document.createElement("div");k.className="gengage-chat-product-details-fact";const M=document.createElement("dt");M.textContent=B.key;const W=document.createElement("dd");W.textContent=B.value,k.appendChild(M),k.appendChild(W),S.appendChild(k)}_.appendChild(S)}const P=td(n);if(P.length>0){const S=document.createElement("div");S.className="gengage-chat-product-variants";const B=document.createElement("div");B.className="gengage-chat-product-variants-label",B.textContent=ad(P,e),S.appendChild(B);const k=document.createElement("div");k.className="gengage-chat-product-variants-list";for(const M of P){const W=dr(M),$=Fe(M,"sku");if(!W&&!$)continue;const D=document.createElement("button");D.className="gengage-chat-product-variant-btn gds-chip",D.type="button";const ae=W??$??"";D.title=ae;const ne=$t(M,"in_stock","inStock");$&&o&&$===o?(D.classList.add("gengage-chat-product-variant-btn--active"),D.setAttribute("aria-pressed","true")):D.setAttribute("aria-pressed","false"),ne===!1&&(D.classList.add("gengage-chat-product-variant-btn--out"),D.disabled=!0);const V=Qg(M),v=Yg(M);if(V&&pe(V)){const R=document.createElement("img");R.className="gengage-chat-product-variant-swatch gengage-chat-product-variant-swatch--image",he(R,"src",V),R.alt="",R.setAttribute("aria-hidden","true"),Ce(R),D.appendChild(R)}else if(v){const R=document.createElement("span");R.className="gengage-chat-product-variant-swatch",R.setAttribute("aria-hidden","true"),R.style.backgroundColor=v,D.appendChild(R)}const N=document.createElement("span");N.className="gengage-chat-product-variant-label",N.textContent=ae,D.appendChild(N);const I=Zg(M);if(I&&String(I)!==String(c)){const R=document.createElement("span");R.className="gengage-chat-product-variant-price",R.textContent=ie(String(I),e.pricing),D.appendChild(R)}if($&&$!==o){const R=i??"",O=(typeof M.value=="string"?M.value.trim():"")||(typeof M.name=="string"?M.name.trim():"")||(typeof M.variant_name=="string"?M.variant_name.trim():"")||"",q=R.length>0?O.length>0&&O!==R?`${R} (${O})`:R:ae;D.addEventListener("click",()=>{e.onAction({title:q,type:"launchVariant",payload:{sku:$}})})}k.appendChild(D)}k.childElementCount>0&&(S.appendChild(k),_.appendChild(S))}const E=document.createElement("div");E.className="gengage-chat-product-details-actions";const w=t.props?.action;if(w){const S=document.createElement("button");S.className="gengage-chat-product-details-cta gds-btn gds-btn-primary",S.type="button",S.textContent=w.title||e.i18n?.productCtaLabel||"View",S.addEventListener("click",()=>e.onAction(w)),E.appendChild(S)}if(s&&o&&b!==!1){const S=document.createElement("button");S.className="gengage-chat-product-details-atc gds-btn gds-btn-primary",S.type="button",S.textContent=e.i18n?.addToCartButton??"Add to Cart",S.addEventListener("click",()=>{e.onAction({title:e.i18n?.addToCartButton??"Add to Cart",type:"addToCart",payload:{sku:o,cartCode:s,quantity:1}})}),E.appendChild(S)}const T=Se(n,"url");if(!w&&T&&pe(T)){const S=document.createElement("a");S.className="gengage-chat-product-details-cta gds-btn gds-btn-secondary",he(S,"href",T),he(S,"target","_blank"),he(S,"rel","noopener noreferrer"),S.textContent=e.i18n?.viewOnSiteLabel??e.i18n?.productCtaLabel??"View on Site",S.addEventListener("click",B=>{e.onProductClick&&o&&(B.preventDefault(),e.onProductClick({sku:o,url:T,...i?{name:i}:{}}))}),E.appendChild(S)}const F=T;if(F&&pe(F)){let W=function(D,ae){const ne=document.createElementNS(k,"circle");ne.setAttribute("cx",D),ne.setAttribute("cy",ae),ne.setAttribute("r","3"),M.appendChild(ne)},$=function(D,ae,ne,V){const v=document.createElementNS(k,"line");v.setAttribute("x1",D),v.setAttribute("y1",ae),v.setAttribute("x2",ne),v.setAttribute("y2",V),M.appendChild(v)};var oe=W,U=$;const S=document.createElement("button");S.className="gengage-chat-product-details-share gds-btn gds-btn-ghost gds-icon-btn",S.type="button";const B=e.i18n?.shareButton??"Share";S.title=B,S.setAttribute("aria-label",B);const k="http://www.w3.org/2000/svg",M=document.createElementNS(k,"svg");M.setAttribute("width","18"),M.setAttribute("height","18"),M.setAttribute("viewBox","0 0 24 24"),M.setAttribute("fill","none"),M.setAttribute("stroke","currentColor"),M.setAttribute("stroke-width","2"),M.setAttribute("stroke-linecap","round"),M.setAttribute("stroke-linejoin","round"),W("18","5"),W("6","12"),W("18","19"),$("8.59","13.51","15.42","17.49"),$("15.41","6.51","8.59","10.49"),S.appendChild(M),S.addEventListener("click",async()=>{try{navigator.share?await navigator.share({title:i??"",url:F}):navigator.clipboard&&(await navigator.clipboard.writeText(F),S.classList.add("gengage-chat-product-details-share--copied"),setTimeout(()=>S.classList.remove("gengage-chat-product-details-share--copied"),1500))}catch{}}),E.appendChild(S)}E.childElementCount>0&&_.appendChild(E),a.appendChild(_);const Q=Gg(n),J=Wg(n);return(Q||J)&&a.appendChild(od(Q,J,e)),a}function ja(t){if(t.nodeType===Node.TEXT_NODE)return document.createTextNode(t.textContent??"");if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t,a=e.tagName.toUpperCase();if(_r.has(a))return null;if(!xr.has(a)){const i=document.createDocumentFragment();for(const r of Array.from(e.childNodes)){const o=ja(r);o&&i.appendChild(o)}return i}const n=document.createElement(a.toLowerCase());for(const i of Array.from(e.childNodes)){const r=ja(i);r&&n.appendChild(r)}return n}function id(t,e){const a=e.split(/\n{2,}/).map(n=>n.replace(/\s+/g," ").trim()).filter(Boolean);if(a.length!==0)for(const n of a){const i=document.createElement("p");i.textContent=n,t.appendChild(i)}}function rd(t,e){if(t.classList.add("gengage-chat-product-description"),e.html&&typeof DOMParser<"u"){const a=new DOMParser().parseFromString(e.html,"text/html"),n=Array.from(a.body.childNodes).map(i=>ja(i)).filter(i=>!!i&&(i.nodeType===Node.ELEMENT_NODE||!!i.textContent?.trim()));if(n.length>0){for(const i of n)t.appendChild(i);return}}id(t,e.text)}function od(t,e,a){const n=document.createElement("div");n.className="gengage-chat-product-detail-tabs";const i=document.createElement("div");i.className="gengage-chat-product-detail-tab-bar gds-toolbar";const r=[];if(t){const s=document.createElement("button");s.className="gengage-chat-product-detail-tab gds-tab gengage-chat-product-detail-tab--active is-active",s.type="button",s.setAttribute("aria-selected","true"),s.textContent=a.i18n?.productInfoTab??"Product Info",i.appendChild(s);const c=document.createElement("div");c.className="gengage-chat-product-detail-tab-panel",rd(c,t),r.push(c)}if(e){const s=document.createElement("button");s.className=`gengage-chat-product-detail-tab gds-tab${t?"":" gengage-chat-product-detail-tab--active is-active"}`,s.type="button",s.setAttribute("aria-selected",t?"false":"true"),s.textContent=a.i18n?.specificationsTab??"Specifications",i.appendChild(s);const c=document.createElement("div");c.className="gengage-chat-product-detail-tab-panel",t&&(c.style.display="none");const l=document.createElement("table");l.className="gengage-chat-product-specs-table";const d=Array.isArray(e)?e:Object.entries(e).map(([g,h])=>({key:g,value:h}));for(const g of d){const h=document.createElement("tr"),f=document.createElement("td");f.className="gengage-chat-product-specs-key",f.textContent=g.key;const b=document.createElement("td");b.className="gengage-chat-product-specs-value",b.textContent=g.value,h.appendChild(f),h.appendChild(b),l.appendChild(h)}c.appendChild(l),r.push(c)}const o=i.querySelectorAll(".gengage-chat-product-detail-tab");o.forEach((s,c)=>{s.addEventListener("click",()=>{o.forEach(l=>{l.classList.remove("gengage-chat-product-detail-tab--active","is-active"),l.setAttribute("aria-selected","false")}),s.classList.add("gengage-chat-product-detail-tab--active","is-active"),s.setAttribute("aria-selected","true"),r.forEach((l,d)=>{l.style.display=d===c?"":"none"})})}),n.appendChild(i);for(const s of r)n.appendChild(s);return n}function ur(t){const e='width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';switch(t){case"related":return`<svg ${e} aria-hidden="true"><path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z"/></svg>`;case"priceAsc":return`<svg ${e} aria-hidden="true"><polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/></svg>`;case"priceDesc":return`<svg ${e} aria-hidden="true"><polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/><polyline points="16 17 22 17 22 11"/></svg>`;default:return""}}function sd(){return'<svg class="gengage-chat-product-sort-chevron" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>'}function cd(){return'<svg class="gengage-chat-product-sort-check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>'}function ld(){return'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 3 4 7l4 4"/><path d="M16 21l4-4-4-4"/><path d="M4 7h16"/><path d="M20 17H4"/></svg>'}function mr(t,e){return t.type===e.type&&t.direction===e.direction}function fr(t,e,a){if(!a||a.type==="related")return t;const n=t.map(i=>{const r=e.elements[i]?.props?.product,o=r?Number(r.price):NaN;return{id:i,price:Number.isFinite(o)?o:1/0}});return n.sort((i,r)=>i.price===1/0&&r.price===1/0?0:i.price===1/0?1:r.price===1/0?-1:a.direction==="desc"?r.price-i.price:i.price-r.price),n.map(i=>i.id)}function gd(t,e,a,n){const i=fr(e,a,n),r=new Map;for(const o of Array.from(t.children)){const s=o.dataset.elementId;s&&r.set(s,o)}for(const o of i){const s=r.get(o);s&&t.appendChild(s)}}function dd(t,e,a,n){const i=document.createElement("div");i.className="gengage-chat-product-grid-wrapper";const r=Ya(t),o=r.isConsulting,s=t.children??[],c=document.createElement("div");c.className="gengage-chat-product-grid";const l=n?.panelProductListHeading;if(!o&&s.length>1&&n?.onSortChange){const h=document.createElement("div");h.className="gengage-chat-product-sort-toolbar",h.setAttribute("role","toolbar"),h.setAttribute("aria-label",n.i18n?.sortToolbarAriaLabel??"Sort products");let f=n.productSort??{type:"related"};const b=[{label:n.i18n?.sortRelated??"Related",sortState:{type:"related"},icon:"related"},{label:n.i18n?.sortPriceAsc??"Price ↑",sortState:{type:"price",direction:"asc"},icon:"priceAsc"},{label:n.i18n?.sortPriceDesc??"Price ↓",sortState:{type:"price",direction:"desc"},icon:"priceDesc"}],m=document.createElement("div");m.className="gengage-chat-product-sort-dropdown";const u=document.createElement("button");u.type="button",u.className="gengage-chat-product-sort-trigger gds-btn gds-btn-ghost",u.setAttribute("aria-haspopup","listbox"),u.setAttribute("aria-expanded","false");const p=n.i18n?.sortToolbarAriaLabel??"Sort products",y=document.createElement("span");y.className="gengage-chat-product-sort-trigger-icon";const _=document.createElement("span");_.className="gengage-chat-product-sort-trigger-label";const x=U=>{const S=b.find(B=>mr(B.sortState,U))??b[0];_.textContent=S.label,y.innerHTML=ur(S.icon),m.dataset.sortIcon=S.icon,u.setAttribute("aria-label",`${p}: ${S.label}`),u.title=S.label};x(f);const P=document.createElement("span");P.className="gengage-chat-product-sort-trigger-chevron",P.innerHTML=sd(),u.appendChild(y),u.appendChild(_),u.appendChild(P);const E=document.createElement("div");E.className="gengage-chat-product-sort-menu gds-menu",E.hidden=!0,E.setAttribute("role","listbox"),E.setAttribute("aria-label",p);const w=h.ownerDocument;let T=null;const F=()=>{E.hidden=!0,m.classList.remove("gengage-chat-product-sort-dropdown--open"),u.setAttribute("aria-expanded","false"),T?.abort(),T=null},Q=U=>{m.classList.contains("gengage-chat-product-sort-dropdown--open")&&(m.contains(U.target)||F())},J=U=>{U.key==="Escape"&&(U.preventDefault(),F())},oe=()=>{E.hidden=!1,m.classList.add("gengage-chat-product-sort-dropdown--open"),u.setAttribute("aria-expanded","true"),T=new AbortController;const{signal:U}=T;w.addEventListener("click",Q,{signal:U}),w.addEventListener("keydown",J,{capture:!0,signal:U})};u.addEventListener("click",U=>{U.stopPropagation(),m.classList.contains("gengage-chat-product-sort-dropdown--open")?F():oe()});for(const U of b){const S=document.createElement("button");S.type="button",S.className="gengage-chat-product-sort-option gds-menu-option",S.setAttribute("role","option");const B=mr(f,U.sortState);S.setAttribute("aria-selected",B?"true":"false"),B&&S.classList.add("gengage-chat-product-sort-option--active","gds-menu-option-active");const k=U.sortState.type==="related"?"related":`price-${U.sortState.direction??""}`;S.dataset.sortKey=k;const M=document.createElement("span");M.className="gengage-chat-product-sort-option-icon",M.innerHTML=ur(U.icon);const W=document.createElement("span");W.className="gengage-chat-product-sort-option-label",W.textContent=U.label;const $=document.createElement("span");$.className="gengage-chat-product-sort-option-check",$.innerHTML=cd(),$.setAttribute("aria-hidden","true"),B||$.classList.add("gengage-chat-product-sort-option-check--hidden"),S.appendChild(M),S.appendChild(W),S.appendChild($),S.addEventListener("click",()=>{f=U.sortState,n.onSortChange?.(U.sortState),gd(c,s,e,U.sortState),E.querySelectorAll(".gengage-chat-product-sort-option").forEach(D=>{const ae=D,ne=ae.dataset.sortKey===k;ae.classList.toggle("gengage-chat-product-sort-option--active",ne),ae.classList.toggle("gds-menu-option-active",ne),ae.setAttribute("aria-selected",ne?"true":"false"),ae.querySelector(".gengage-chat-product-sort-option-check")?.classList.toggle("gengage-chat-product-sort-option-check--hidden",!ne)}),x(U.sortState),F()}),E.appendChild(S)}if(m.appendChild(u),m.appendChild(E),h.appendChild(m),n.onToggleComparisonSku){const U=document.createElement("button");U.className="gengage-chat-comparison-toggle-btn gds-btn gds-btn-ghost",U.type="button",n.comparisonSelectMode&&U.classList.add("gengage-chat-comparison-toggle-btn--active"),n.isStreaming&&U.classList.add("gengage-chat-comparison-toggle-btn--hidden");const S=document.createElement("span");S.className="gengage-chat-comparison-toggle-icon",S.innerHTML=ld();const B=document.createElement("span");B.className="gengage-chat-comparison-toggle-label";const k=n.i18n?.compareSelected??"Compare";B.textContent=k,U.setAttribute("aria-label",k),U.title=k,U.appendChild(S),U.appendChild(B),U.addEventListener("click",()=>{n.onToggleComparisonSku?.("")}),h.appendChild(U)}if(l){h.classList.add("gengage-chat-product-sort-toolbar--inline");const U=document.createElement("div");U.className="gengage-chat-product-grid-head";const S=document.createElement("span");S.className="gengage-chat-product-grid-head-title",S.textContent=l,U.appendChild(S);const B=document.createElement("div");B.className="gengage-chat-product-grid-head-actions",B.appendChild(h),U.appendChild(B),i.appendChild(U)}else i.appendChild(h)}else if(l){const h=document.createElement("div");h.className="gengage-chat-product-grid-head";const f=document.createElement("span");f.className="gengage-chat-product-grid-head-title",f.textContent=l,h.appendChild(f),i.appendChild(h)}if(o)xd(i,c,r,n);else{const h=fr(s,e,n?.productSort);for(const f of h){if(!e.elements[f])continue;const b=a(f);b&&(b.dataset.elementId=f,c.appendChild(b))}}(n?.isMobile??Oa())&&c.classList.add("gengage-chat-product-grid--mobile"),t.props?.rankingState==="pending"&&(c.classList.add("gengage-chat-product-grid--pending"),c.inert=!0,c.setAttribute("aria-busy","true")),i.appendChild(c);const d=t.props?.endOfList;if(!o&&d!==!0&&s.length>0){const h=n?.i18n?.viewMoreLabel??"Show More",f=document.createElement("button");f.className="gengage-chat-product-grid-view-more",f.type="button",f.textContent=h,f.addEventListener("click",()=>{n?.onAction({title:h,type:"moreProductList",payload:{}})}),i.appendChild(f)}const g=n?.isMobile??Oa();if(n?.comparisonSelectMode&&n.comparisonSelectedSkus&&!g){const h=Xi(n.comparisonSelectedSkus,n);i.appendChild(h)}return i}function pd(t,e,a){const n=i=>{const r=i?.url;return typeof r=="string"?r.trim():""};if(e.sku===t){const i=n(e);if(i.length>0)return i}return n(a.find(i=>i.sku===t))}function hd(t,e){const a=t.props??{},n=a.keyDifferencesHtml,i=a.recommended,r=a.products??[],o=a.attributes??[],s=a.highlights??[],c=a.specialCases,l=a.recommendedText,d=a.winnerHits,g=a.productActions;if(!i)return document.createElement("div");const h={recommended:i,products:r,attributes:o,highlights:s,specialCases:c,locale:e.locale,onProductClick:({sku:b,name:m})=>{const u=pd(b,i,r);e.onProductClick?.({sku:b,url:u,...m!==void 0&&m!==""?{name:m}:{}})},pricing:e.pricing};l!==void 0&&(h.recommendedText=l),d!==void 0&&(h.winnerHits=d),g!==void 0&&(h.productActions=g),n!==void 0&&(h.keyDifferencesHtml=n),e.i18n&&(h.i18n={comparisonHeading:e.i18n.panelTitleComparisonResults,recommendedChoiceLabel:e.i18n.recommendedChoiceLabel,highlightsLabel:e.i18n.highlightsLabel,keyDifferencesLabel:e.i18n.keyDifferencesLabel,viewMoreLabel:e.i18n.viewMoreLabel,specialCasesLabel:e.i18n.specialCasesLabel,addToCartButton:e.i18n.addToCartButton});const f=Ql(h);return(e.isMobile??Oa())&&f.classList.add("gengage-chat-comparison--mobile"),f}function ud(t){const e=document.createElement("hr");e.className="gengage-chat-divider";const a=t.props?.label;if(a){const n=document.createElement("div");n.className="gengage-chat-divider-wrapper";const i=document.createElement("span");i.className="gengage-chat-divider-label",i.textContent=a,n.appendChild(e),n.appendChild(i);const r=document.createElement("hr");return r.className="gengage-chat-divider",n.appendChild(r),n}return e}var $a,Gt,Va,br,vr,yr,xr,_r,wr=L((()=>{nt(),ct(),Jl(),sg(),fg(),vg(),_g(),kg(),Ji(),Sg(),Ng(),Bg(),nr(),Fg(),Dg(),Pr(),ge(),je(),Ua(),$a={ActionButtons:({element:t,context:e})=>Ug(t,e),ActionButton:({element:t,context:e})=>Og(t,e),ProductCard:({element:t,context:e})=>qa(t,e),ProductDetailsPanel:({element:t,context:e})=>nd(t,e),ProductGrid:({element:t,spec:e,renderElement:a,context:n})=>dd(t,e,a,n),ReviewHighlights:({element:t,context:e})=>e.hideUserReviews===!0?null:og(t,{emptyReviewsMessage:e.i18n?.emptyReviewsMessage,reviewFilterPositive:e.i18n?.reviewFilterPositive,reviewFilterNegative:e.i18n?.reviewFilterNegative,reviewCustomersMentionSingular:e.i18n?.reviewCustomersMentionSingular,reviewCustomersMentionPlural:e.i18n?.reviewCustomersMentionPlural,reviewSubjectsHeading:e.i18n?.reviewSubjectsHeading}),ComparisonTable:({element:t,context:e})=>hd(t,e),AITopPicks:({element:t,context:e})=>ug(t,e),GroundingReviewCard:({element:t,context:e})=>e.hideUserReviews===!0?null:bg(t,e),AIGroupingCards:({element:t,context:e})=>xg(t,e),AISuggestedSearchCards:({element:t,context:e})=>wg(t,e),ProsAndCons:({element:t})=>Cg(t),CategoriesContainer:({element:t,context:e})=>Lg(t,e),HandoffNotice:({element:t,context:e})=>Mg(t,e),PanelRestoreCard:({element:t,context:e})=>zg(t,e),ProductSummaryCard:({element:t,context:e})=>Hg(t,e),Divider:({element:t})=>ud(t),...ir},Gt=({element:t,renderElement:e})=>{if(!t.children||t.children.length===0)return null;const a=document.createElement("div");for(const n of t.children){const i=e(n);i&&a.appendChild(i)}return a},Va=new Set(["color","colour","renk","renk kodu","color code"]),br=new Set(["size","beden","boyut"]),vr=new Set(["finish","bitiş","bitişi"]),yr=["variants","variantOptions","variant_options","productVariants","product_variants","options"],xr=new Set(["H2","H3","H4","P","BR","UL","OL","LI","STRONG","B","EM","I"]),_r=new Set(["SCRIPT","STYLE","NOSCRIPT","IFRAME","OBJECT","EMBED"])}));function kr(t){return{...Qe,...t?.i18n??{}}}function Cr(t){return t.watchStylesPreparedTitle??t.beautyStylesPreparedTitle}function Wt(t){return typeof t.status=="string"?t.status:"ready"}function Ga(t){const e=t.findIndex(a=>Wt(a)!=="loading");return e<0?0:e}function md(t){if(typeof t!="string")return;const e=t.trim();if(!e)return;if(/^https?:\/\//i.test(e))return e;let a=e.split(/[?#]/)[0];if(a&&(a=a.replace(/^\/+/,""),a.startsWith("remoteConfig/")&&(a=a.slice(13)),!!a))return`https://configs.gengage.ai/assets/${a}`}function Sr(t,e,a,n){const{grid:i,i18n:r}=t;i.innerHTML="",i.classList.remove("gengage-chat-product-grid--consulting-groups");const o=document.createElement("section");o.className="gengage-chat-consulting-loading-panel";const s=document.createElement("h4");s.className="gengage-chat-consulting-loading-panel-title",s.textContent=Kt(e,n,r),o.appendChild(s);const c=document.createElement("p");if(c.className="gengage-chat-consulting-loading-panel-copy",c.textContent=a==="loading"?r.consultingStyleLoadingDescription:r.consultingStyleUnavailableDescription,o.appendChild(c),a==="loading"){const l=document.createElement("div");l.className="gengage-chat-consulting-loading-grid";for(let d=0;d<3;d+=1){const g=document.createElement("div");g.className="gengage-chat-consulting-loading-card",l.appendChild(g)}o.appendChild(l)}i.appendChild(o)}function Kt(t,e,a){const n=i=>a.consultingFallbackStyleLabel.replace("{index}",String(i));return t.style_label??n(e)}function Wa(t,e){const a=t.variations[e];if(!a)return;const{grid:n,ctx:i,i18n:r}=t;n.innerHTML="",n.classList.remove("gengage-chat-product-grid--consulting-groups");const o=Wt(a),s=e+1;if(o==="loading"){Sr(t,a,"loading",s);return}if(o!=="ready"&&(!Array.isArray(a.product_list)||a.product_list.length===0)){Sr(t,a,"unavailable",s);return}const c=Array.isArray(a.product_list)?a.product_list:[],l=Array.isArray(a.recommendation_groups)?a.recommendation_groups:[];if(l.length>0){n.classList.add("gengage-chat-product-grid--consulting-groups");const d=new Map;for(const u of c){const p=typeof u?.sku=="string"?u.sku:void 0;p&&d.set(p,u)}const g=(u,p,y,_)=>{if(p.length===0)return;const x=document.createElement("section");x.className="gengage-chat-consulting-group";const P=document.createElement("div");P.className="gengage-chat-consulting-group-header";const E=document.createElement("h4");if(E.className="gengage-chat-consulting-group-label",E.textContent=`${u} (${p.length})`,P.appendChild(E),typeof _=="string"&&_.trim().length>0){const T=document.createElement("p");T.className="gengage-chat-consulting-group-reason",T.textContent=_,P.appendChild(T)}x.appendChild(P);const w=document.createElement("div");w.className="gengage-chat-product-grid gengage-chat-consulting-group-grid",y&&w.classList.add("gengage-chat-consulting-group-grid--single-group"),w.style.setProperty("--consulting-group-columns",String(Math.max(1,Math.min(4,p.length))));for(const T of p){const F=qa({type:"ProductCard",props:{product:T}},i??{onAction:()=>{}});w.appendChild(F)}x.appendChild(w),n.appendChild(x)},h=new Set,f=[];for(const u of l){const p=(Array.isArray(u.skus)?u.skus.filter(x=>typeof x=="string"&&x.trim().length>0):[]).map(x=>(h.add(x),d.get(x))).filter(x=>!!x);if(p.length===0)continue;const y=typeof u.label=="string"&&u.label.trim().length>0?u.label:r.consultingFallbackGroupLabel,_=typeof u.reason=="string"?u.reason:void 0;f.push({labelText:y,products:p,..._!==void 0?{reasonText:_}:{}})}const b=c.filter(u=>{const p=typeof u?.sku=="string"?u.sku:"";return p.length>0&&!h.has(p)});b.length>0&&f.push({labelText:r.consultingOtherCompatibleProductsLabel,products:b});const m=f.length===1;for(const u of f)g(u.labelText,u.products,m,u.reasonText);return}for(const d of c){const g=qa({type:"ProductCard",props:{product:d}},i??{onAction:()=>{}});n.appendChild(g)}}function Ka(t,e,a,n){const i=Wt(e),r=n.consultingStyleLoadingBadge,o=n.consultingStyleUnavailableBadge;t.classList.remove("gengage-chat-consulting-style-btn--loading","gengage-chat-consulting-style-btn--muted"),i==="loading"?t.classList.add("gengage-chat-consulting-style-btn--loading"):i!=="ready"&&t.classList.add("gengage-chat-consulting-style-btn--muted"),t.setAttribute("aria-label",Kt(e,a+1,n));let s=t.querySelector(".gengage-chat-consulting-style-media");s?s.innerHTML="":(s=document.createElement("div"),s.className="gengage-chat-consulting-style-media",t.appendChild(s));const c=md(e.image_url);if(c&&pe(c)){const d=document.createElement("img");d.className="gengage-chat-consulting-style-image",d.draggable=!1,he(d,"src",c),d.alt=Kt(e,a+1,n),d.loading="lazy",Ce(d),s.appendChild(d)}const l=document.createElement("span");if(l.className="gengage-chat-consulting-style-caption",l.textContent=Kt(e,a+1,n),s.appendChild(l),i==="loading"||i!=="ready"){const d=document.createElement("span");d.className="gengage-chat-consulting-style-status",d.textContent=i==="loading"?r:o,s.appendChild(d)}}function Er(t,e,a,n){t.addEventListener("click",()=>{const i=xt.get(e);i&&i.selectedIndex!==n&&(i.selectedIndex=n,a.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((r,o)=>{r.classList.toggle("gengage-chat-consulting-style-btn--active",o===n)}),Wa(i,n))})}function fd(t,e,a,n){const i=kr(n),r=Ga(a),o=document.createElement("div");o.className="gengage-chat-consulting-style-picker";const s={grid:e,ctx:n,variations:a,i18n:i,selectedIndex:r};xt.set(o,s);const c=document.createElement("div");c.className="gengage-chat-consulting-style-picker-title",c.textContent=Cr(i).replace("{count}",String(a.length)),o.appendChild(c);const l=document.createElement("div");l.className="gengage-chat-consulting-style-grid",o.appendChild(l),a.forEach((d,g)=>{const h=document.createElement("button");h.type="button",h.className="gengage-chat-consulting-style-btn gds-card",g===r&&h.classList.add("gengage-chat-consulting-style-btn--active"),Ka(h,d,g,i),Er(h,o,l,g),l.appendChild(h)}),t.appendChild(o),Wa(s,r)}function bd(t,e,a){const n=t.querySelector(".gengage-chat-consulting-style-picker"),i=vd(t);if(!n||!i)return!1;const r=n.querySelector(".gengage-chat-consulting-style-grid");if(!r)return!1;const o=kr(a);let s=xt.get(n);if(s)s.grid=i,s.ctx=a,s.variations=e,s.i18n=o;else{const h={grid:i,ctx:a,variations:e,i18n:o,selectedIndex:Ga(e)};xt.set(n,h),s=h}const c=n.querySelector(".gengage-chat-consulting-style-picker-title");c&&(c.textContent=Cr(o).replace("{count}",String(e.length)));const l=s;let d=l.selectedIndex;d>=e.length&&(d=Math.max(0,e.length-1)),d<0&&(d=0),e.length>0&&Wt(e[d]??{})==="loading"&&(d=Ga(e)),l.selectedIndex=d;const g=[...r.querySelectorAll(".gengage-chat-consulting-style-btn")];if(g.length===0)return!1;for(let h=0;h<e.length;h+=1){const f=e[h];let b=g[h];b?Ka(b,f,h,o):(b=document.createElement("button"),b.type="button",b.className="gengage-chat-consulting-style-btn gds-card",Ka(b,f,h,o),Er(b,n,r,h),r.appendChild(b),g[h]=b)}for(;r.querySelectorAll(".gengage-chat-consulting-style-btn").length>e.length;)r.lastElementChild?.remove();return r.querySelectorAll(".gengage-chat-consulting-style-btn").forEach((h,f)=>{h.classList.toggle("gengage-chat-consulting-style-btn--active",f===l.selectedIndex)}),Wa(l,l.selectedIndex),!0}function vd(t){const e=[...t.children];for(let a=e.length-1;a>=0;a-=1){const n=e[a];if(n.classList.contains("gengage-chat-product-grid"))return n}return t.querySelector(":scope > .gengage-chat-product-grid")}var xt,yd=L((()=>{ge(),je(),bt(),wr(),xt=new WeakMap}));function Ya(t){const e=typeof t.props?.source=="string"?t.props.source:void 0,a=(Array.isArray(t.props?.styleVariations)?t.props.styleVariations:[]).filter(n=>typeof n.style_label=="string"&&n.style_label.trim().length>0);return{isConsulting:ni(e)&&a.length>0,source:e,styleVariations:a}}function xd(t,e,a,n){fd(t,e,a.styleVariations,n)}function _d(t){return!t.isConsulting||t.styleVariations.length===0?!0:t.styleVariations.some(e=>(typeof e.status=="string"?e.status:"ready")!=="loading")}function wd(t,e,a){return!e.isConsulting||!e.source?!1:bd(t,e.styleVariations,a)}var Pr=L((()=>{yd(),ii()}));function kd(t){const e=document.createElement("div");e.className="gengage-chat-launcher-container",e.dataset.gengagePart="chat-launcher-container";const a=document.createElement("div");a.className="gengage-chat-launcher-content-area",a.dataset.gengagePart="chat-launcher-content-primary",e.appendChild(a);const n=document.createElement("button");if(n.type="button",n.setAttribute("aria-label",t.ariaLabel??"Open chat"),t.imageUrl){n.className="gengage-chat-launcher gengage-chat-launcher--image-mode";const r=document.createElement("img");if(r.src=t.imageUrl,r.alt="",r.draggable=!1,t.mobileImageUrl){r.className="gengage-chat-launcher-img--desktop";const o=document.createElement("img");o.src=t.mobileImageUrl,o.alt="",o.draggable=!1,o.className="gengage-chat-launcher-img--mobile",n.appendChild(r),n.appendChild(o)}else n.appendChild(r)}else n.className="gengage-chat-launcher",n.innerHTML=t.svgMarkup??Tr;if(n.dataset.gengagePart="chat-launcher-button",t.tooltip!==void 0){const r=document.createElement("span");r.className="gengage-chat-launcher-tooltip",r.dataset.gengagePart="chat-launcher-tooltip",r.textContent=t.tooltip,n.appendChild(r)}t.hideMobile&&(e.dataset.hideMobile="1"),t.mobileBreakpoint!==void 0&&(e.dataset.mobileBreakpoint=String(t.mobileBreakpoint)),n.addEventListener("click",t.onClick),e.appendChild(n);const i=document.createElement("div");return i.className="gengage-chat-launcher-content-area-bottom",i.dataset.gengagePart="chat-launcher-content-secondary",e.appendChild(i),{container:e,button:n,contentArea:a,contentAreaBottom:i}}var Tr,Cd=L((()=>{Tr=`<svg width="28" height="28" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
50
50
  <rect x="3" y="7" width="18" height="13" rx="3" fill="currentColor" opacity="0.15"/>