@dori-ai/dori-side-widget 1.13.188 → 1.13.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{main-BnVYAeT4.js → main-CVtqsvQy.js} +1 -1
- package/dist/assets/main-CVtqsvQy.js.br +0 -0
- package/dist/assets/main-CVtqsvQy.js.gz +0 -0
- package/dist/widget.js +2 -2
- package/dist/widget.js.br +0 -0
- package/dist/widget.js.gz +0 -0
- package/package.json +1 -1
- package/dist/assets/main-BnVYAeT4.js.br +0 -0
- package/dist/assets/main-BnVYAeT4.js.gz +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./MarkdownContent-D7AdAAbE.js","./provider-BH4DFhmC.js","../widget.js","./link-BqZqqrLE.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{l as e,h as t,i as n,o as r,n as o,A as a,t as i,p as s,c as l,a as c,b as d,d as u,f as p,g as f,e as h,j as g,k as m,m as b,q as x,r as y,_ as v,s as w,u as k,v as C,w as j,x as S,y as z,z as E,B as A,C as R,D as T,E as _,F as W,G as I,H as L,I as M,J as B,K as F,L as D,M as H,N as P}from"../widget.js";import{r as q,j as O,c as N,a as Y,u as V,g as U,b as Z,d as K,e as Q,m as G,f as X,h as J,i as $,B as ee,k as te,l as ne,n as re,R as oe,o as ae,p as ie,q as se,s as le,t as ce,I as de,H as ue,U as pe,T as fe,v as he,V as ge,w as me,S as be,x as xe,y as ye,z as ve,A as we,G as ke,C as Ce,D as je,E as Se,F as ze,J as Ee,K as Ae,L as Re,M as Te,N as _e,O as We,P as Ie,Q as Le,W as Me,X as Be,Y as Fe,Z as De,_ as He,$ as Pe,a0 as qe,a1 as Oe,a2 as Ne,a3 as Ye,a4 as Ve,a5 as Ue,a6 as Ze,a7 as Ke,a8 as Qe,a9 as Ge,aa as Xe,ab as Je,ac as $e,ad as et,ae as tt,af as nt,ag as rt,ah as ot,ai as at,aj as it,ak as st,al as lt,am as ct,an as dt,ao as ut,ap as pt,aq as ft,ar as ht,as as gt,at as mt,au as bt,av as xt,aw as yt,ax as vt,ay as wt,az as kt,aA as Ct,aB as jt,aC as St,aD as zt,aE as Et,aF as At,aG as Rt,aH as Tt,aI as _t,aJ as Wt,aK as It,aL as Lt,aM as Mt,aN as Bt,aO as Ft,aP as Dt,aQ as Ht,aR as Pt,aS as qt,aT as Ot,aU as Nt,aV as Yt,aW as Vt,aX as Ut,aY as Zt,aZ as Kt,a_ as Qt,a$ as Gt,b0 as Xt,b1 as Jt,b2 as $t,b3 as en}from"./provider-BH4DFhmC.js";import{u as tn,L as nn}from"./link-BqZqqrLE.js";import{d as rn,s as on}from"./report-BHr6U1PB.js";const an=q.forwardRef(function(e,t){const{templateAreas:n,column:r,row:o,autoFlow:a,autoRows:i,templateRows:s,autoColumns:l,templateColumns:c,inline:d,...u}=e;return O.jsx(N.div,{...u,ref:t,css:[{display:d?"inline-grid":"grid",gridTemplateAreas:n,gridAutoColumns:l,gridColumn:r,gridRow:o,gridAutoFlow:a,gridAutoRows:i,gridTemplateRows:s,gridTemplateColumns:c},e.css]})});var sn=Y();function ln(e,t){const n=V().normalizeValue(e),r=function(e={}){e.fallback||(e.fallback="base");const t=V();let n=!1;const r=t.breakpoints.values.map(({min:t,name:r})=>{const o={breakpoint:r,query:`(min-width: ${t})`,fallback:!n};return r===e.fallback&&(n=!0),o}).filter(({breakpoint:t})=>!!e.breakpoints?.includes(t)),o=r.map(({fallback:e})=>e),a=function(e,t={}){const{fallback:n=[],ssr:r=!0,getWindow:o}=t,a=function(e,t=[]){const n=q.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return q.useInsertionEffect(()=>{n.current=e}),q.useCallback((...e)=>n.current?.(...e),t)}(o),i=Array.isArray(e)?e:[e],s=n?.filter(e=>null!=e),[l,c]=q.useState(()=>i.map((e,t)=>{if(!r){const{media:t,matches:n}=(o?.()??window).matchMedia(e);return{media:t,matches:n}}return{media:e,matches:!!s[t]}}));return q.useEffect(()=>{const e=a()??window;c(t=>{const n=i.map(t=>{const{media:n,matches:r}=e.matchMedia(t);return{media:n,matches:r}});return t.every((e,t)=>e.matches===n[t].matches&&e.media===n[t].media)?t:n});const t=i.map(t=>e.matchMedia(t)),n=e=>{c(t=>t.slice().map(t=>t.media===e.media?{...t,matches:e.matches}:t))},r=t.map(e=>function(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch(n){return e.addListener(t),()=>e.removeListener(t)}}(e,n));return()=>r.forEach(e=>e())},[a]),l.map(e=>e.matches)}(r.map(e=>e.query),{fallback:o,ssr:e.ssr}).lastIndexOf(!0);return r[a]?.breakpoint??e.fallback}({breakpoints:Object.keys(n),...t});return n[r]}var cn=e=>{if(!e)return;const t=U(e),n=Z(e),r=K(e),o=()=>{requestAnimationFrame(()=>{let n;e.style.height="auto",n="content-box"===t.boxSizing?e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),"none"!==t.maxHeight&&n>parseFloat(t.maxHeight)?("hidden"===t.overflowY&&(e.style.overflowY="scroll"),n=parseFloat(t.maxHeight)):"hidden"!==t.overflowY&&(e.style.overflowY="hidden"),e.style.height=`${n}px`})};e.addEventListener("input",o),e.form?.addEventListener("reset",o);const a=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(a,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),o()}});const s=new n.ResizeObserver(()=>{requestAnimationFrame(()=>o())});s.observe(e);const l=new n.MutationObserver(()=>o());return l.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),r.fonts?.addEventListener("loadingdone",o),()=>{e.removeEventListener("input",o),e.form?.removeEventListener("reset",o),r.fonts?.removeEventListener("loadingdone",o),s.disconnect(),l.disconnect()}};const dn=q.forwardRef((e,t)=>{const{autoresize:n,...r}=e,o=q.useRef(null),a=Q(),i=G(a?.getTextareaProps(),{style:{resize:n?"none":void 0}},r);return q.useEffect(()=>{if(n)return cn(o.current)},[n]),O.jsx(X.textarea,{...i,ref:J(t,o)})});dn.displayName="FieldTextarea";const{withContext:un}=$({key:"badge"}),pn=un("span"),fn=q.forwardRef(function(e,t){return O.jsx(ee,{px:"0",py:"0",_icon:{fontSize:"1.2em"},ref:t,...e})}),{useRecipeResult:hn}=$({key:"icon"}),gn=q.forwardRef(function(e,t){const{styles:n,className:r,props:o}=hn({asChild:!e.as,...e});return O.jsx(N.svg,{ref:t,focusable:!1,"aria-hidden":"true",...o,css:[n,e.css],className:te(r,e.className)})});function mn(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,a=q.Children.toArray(e.path),i=q.forwardRef((e,r)=>O.jsx(gn,{ref:r,asChild:!1,viewBox:t,...o,...e,children:a.length?a:O.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}const bn=q.forwardRef(function(e,t){const{direction:n,align:r,justify:o,wrap:a,basis:i,grow:s,shrink:l,inline:c,...d}=e;return O.jsx(N.div,{ref:t,...d,css:{display:c?"inline-flex":"flex",flexDirection:n,alignItems:r,justifyContent:o,flexWrap:a,flexBasis:i,flexGrow:s,flexShrink:l,...e.css}})}),xn=q.forwardRef(function(e,t){const{columns:n,minChildWidth:r,...o}=e,a=V(),i=r?function(e,t){return ne(e,e=>{const n=t.tokens.getVar(`sizes.${e}`,"number"==typeof(r=e)?`${r}px`:r);var r;return null===e?null:`repeat(auto-fit, minmax(${n}, 1fr))`})}(r,a):ne(n,e=>null===e?null:`repeat(${e}, minmax(0, 1fr))`);return O.jsx(an,{ref:t,templateColumns:i,...o})}),{withContext:yn}=$({key:"textarea"}),vn=yn(dn),wn=mn({displayName:"CloseIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M6.26915 5.7309C5.98798 5.44973 5.53209 5.44973 5.25092 5.7309C4.96975 6.01207 4.96975 6.46796 5.25092 6.74913L10.5018 12L5.25092 17.2509C4.96975 17.5321 4.96975 17.9879 5.25092 18.2691C5.53209 18.5503 5.98798 18.5503 6.26915 18.2691L11.52 13.0183L16.7709 18.2691C17.0521 18.5503 17.5079 18.5503 17.7891 18.2691C18.0703 17.9879 18.0703 17.5321 17.7891 17.2509L12.5383 12L17.7891 6.74913C18.0703 6.46796 18.0703 6.01207 17.7891 5.7309C17.5079 5.44973 17.0521 5.44973 16.7709 5.7309L11.52 10.9817L6.26915 5.7309Z",fill:"currentColor"})}),kn=mn({displayName:"CheckCircleIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm4.457 7.457-5.25 5.25a1 1 0 0 1-1.414 0l-2.25-2.25a1 1 0 1 1 1.414-1.414l1.543 1.543 4.543-4.543a1 1 0 0 1 1.414 1.414Z",fill:"currentColor"})}),Cn=mn({displayName:"ExternalLinkIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M14 4a1 1 0 0 1 0-2h7a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0V6.414l-8.293 8.293a1 1 0 0 1-1.414-1.414L18.586 5H14ZM5 7a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-5a1 1 0 1 0-2 0v4H6V9h4a1 1 0 1 0 0-2H5Z",fill:"currentColor"})}),jn=mn({displayName:"ExpandIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fill:"currentColor"})}),Sn=mn({displayName:"ReplyIcon",viewBox:"0 0 15 12",path:O.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.16536 1.81467C7.16536 0.791333 5.9427 0.263999 5.1987 0.965999L1.30003 4.64C1.15132 4.78022 1.03284 4.94936 0.951856 5.13703C0.870874 5.3247 0.829102 5.52694 0.829102 5.73133C0.829102 5.93573 0.870874 6.13797 0.951856 6.32563C1.03284 6.5133 1.15132 6.68244 1.30003 6.82267L5.19736 10.5C5.94136 11.202 7.1647 10.674 7.1647 9.65133V8.33467C7.93731 8.19507 8.73376 8.28024 9.45939 8.58006C10.185 8.87989 10.8093 9.38175 11.258 10.026L11.7927 10.794C12.5207 11.84 14.162 11.3247 14.162 10.0507V9.738C14.162 5.89267 10.9394 2.87667 7.1647 3.05733L7.16536 1.81467ZM5.8847 1.69333C5.90839 1.67111 5.93807 1.6563 5.97007 1.65072C6.00208 1.64514 6.03501 1.64904 6.06483 1.66193C6.09465 1.67482 6.12005 1.69614 6.13791 1.72328C6.15577 1.75042 6.16531 1.78218 6.16536 1.81467V3.54C6.16536 3.87333 6.45736 4.132 6.78803 4.092C10.1767 3.68 13.1627 6.32467 13.1627 9.73867V10.0507C13.1627 10.3453 12.7827 10.4647 12.614 10.2227L12.0787 9.45467C11.4785 8.5928 10.6268 7.93727 9.63996 7.57763C8.65317 7.21799 7.5794 7.17179 6.56536 7.44533C6.45052 7.47639 6.34911 7.54442 6.27681 7.6389C6.2045 7.73337 6.16534 7.84903 6.16536 7.968V9.65067C6.16531 9.68315 6.15577 9.71492 6.13791 9.74205C6.12005 9.76919 6.09465 9.79051 6.06483 9.8034C6.03501 9.81629 6.00208 9.82019 5.97007 9.81461C5.93807 9.80903 5.90839 9.79422 5.8847 9.772L1.9867 6.09533C1.93716 6.04859 1.8977 5.99223 1.87072 5.92969C1.84375 5.86716 1.82984 5.79977 1.82984 5.73167C1.82984 5.66356 1.84375 5.59618 1.87072 5.53364C1.8977 5.4711 1.93716 5.41474 1.9867 5.368L5.8847 1.69333Z",fill:"currentColor"})}),zn=mn({displayName:"SuggestionIcon",viewBox:"0 0 16 16",path:O.jsx("path",{d:"M4.56503 3.915C5.11896 2.73832 6.04737 1.77849 7.20497 1.18572C8.36257 0.592947 9.68402 0.400681 10.9625 0.63901C12.2411 0.877339 13.4045 1.53281 14.2708 2.50286C15.137 3.4729 15.6573 4.70277 15.75 6C15.8332 7.19515 15.548 8.38706 14.9329 9.41516C14.3178 10.4433 13.4024 11.2581 12.31 11.75C11.9379 12.672 11.3425 13.4871 10.5774 14.122C9.81221 14.7569 8.90126 15.1917 7.92642 15.3873C6.95158 15.5829 5.94341 15.5332 4.99255 15.2426C4.04169 14.952 3.17794 14.4297 2.47896 13.7226C1.77998 13.0155 1.26768 12.1458 0.988107 11.1916C0.708538 10.2375 0.670468 9.2288 0.877321 8.25629C1.08417 7.28377 1.52946 6.37791 2.17316 5.62013C2.81685 4.86235 3.63877 4.27641 4.56503 3.915ZM9.90503 1.5H9.60503C8.52019 1.56681 7.48862 1.99351 6.67357 2.71256C5.85852 3.43161 5.30656 4.40195 5.10503 5.47L10.675 1.565C10.4205 1.52309 10.163 1.50136 9.90503 1.5ZM11.905 1.93L5.33003 6.555L5.06003 6.745C5.11592 7.4665 5.33108 8.16663 5.69003 8.79499L13.565 3.155C13.1023 2.63199 12.5329 2.21427 11.895 1.93H11.905ZM14.145 3.97L6.25003 9.60999C6.70986 10.1331 7.27572 10.5524 7.91003 10.84L14.75 5.82C14.6759 5.16869 14.47 4.53927 14.145 3.97ZM14.75 7.065L9.10503 11.2C9.4681 11.2629 9.83728 11.283 10.205 11.26C11.33 11.1916 12.3968 10.7368 13.225 9.97234C14.0532 9.20793 14.5919 8.1809 14.75 7.065ZM6.75003 14.5C7.59348 14.4958 8.42238 14.2798 9.16061 13.8718C9.89883 13.4638 10.5227 12.8769 10.975 12.165C10.7406 12.2117 10.5035 12.2434 10.265 12.26H9.90003C8.40699 12.257 6.97069 11.6876 5.88117 10.6668C4.79165 9.64592 4.13007 8.24969 4.03003 6.76C4.00121 6.25734 4.03819 5.75307 4.14003 5.26C3.22219 5.83357 2.51524 6.68948 2.12538 7.69915C1.73553 8.70883 1.68382 9.81774 1.97803 10.8593C2.27224 11.9009 2.89648 12.8189 3.75697 13.4754C4.61746 14.1318 5.66774 14.4914 6.75003 14.5Z",fill:"currentColor"})}),En=mn({displayName:"AiSearchIcon",viewBox:"0 0 16 16",path:O.jsxs(O.Fragment,{children:[O.jsx("path",{d:"M8 2.66683C5.42267 2.66683 3.33333 4.75617 3.33333 7.3335H2C2 4.01979 4.68629 1.3335 8 1.3335C11.3137 1.3335 14 4.01979 14 7.3335C14 8.75016 13.509 10.0522 12.6879 11.0786L14.8047 13.1954L13.8619 14.1382L11.7451 12.0214C10.7187 12.8425 9.41667 13.3335 8 13.3335V12.0002C10.5773 12.0002 12.6667 9.91083 12.6667 7.3335C12.6667 4.75617 10.5773 2.66683 8 2.66683Z",fill:"currentColor"}),O.jsx("path",{d:"M5.85714 6.6665L2 11.2498H4.57143L4.14286 13.9998L8 9.4165H5.42857L5.85714 6.6665Z",fill:"currentColor"})]})}),An=mn({displayName:"SparkleIcon",viewBox:"0 0 16 16",path:O.jsxs(O.Fragment,{children:[O.jsx("path",{d:"M8 1.5l1.15 3.11a2 2 0 0 0 1.18 1.18L13.44 6.93l-3.11 1.15a2 2 0 0 0-1.18 1.18L8 12.37l-1.15-3.11a2 2 0 0 0-1.18-1.18L2.56 6.93l3.11-1.15a2 2 0 0 0 1.18-1.18L8 1.5Z",fill:"currentColor"}),O.jsx("path",{d:"M12.75 10.5l.42 1.13c.08.22.25.39.47.47l1.13.42-1.13.42a.83.83 0 0 0-.47.47l-.42 1.13-.42-1.13a.83.83 0 0 0-.47-.47l-1.13-.42 1.13-.42c.22-.08.39-.25.47-.47l.42-1.13Z",fill:"currentColor",opacity:"0.75"})]})}),Rn=mn({displayName:"SquareBlackIcon",viewBox:"0 0 32 32",path:O.jsxs(O.Fragment,{children:[O.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),O.jsx("path",{d:"M22 10H10V22H22V10Z",fill:"var(--chakra-colors-button-text, white)"})]})}),Tn=mn({displayName:"ArrowUpBlackIcon",viewBox:"0 0 32 32",path:O.jsxs(O.Fragment,{children:[O.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),O.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5858 11.0002C15.3669 10.2191 16.6332 10.2191 17.4143 11.0002L20.3738 13.9597C20.7643 14.3502 20.7643 14.9834 20.3738 15.3739C19.9833 15.7644 19.3501 15.7644 18.9596 15.3739L17 13.4144V21.0002C17 21.5524 16.5523 22.0002 16 22.0002C15.4478 22.0002 15 21.5524 15 21.0002V13.4144L13.0405 15.3739C12.65 15.7644 12.0168 15.7645 11.6263 15.3739C11.2358 14.9834 11.2358 14.3502 11.6263 13.9597L14.5858 11.0002Z",fill:"var(--chakra-colors-button-text, white)"})]})}),_n=mn({displayName:"ArrowLeftIcon",viewBox:"0 0 32 32",path:O.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0002 17.4139C10.2191 16.6329 10.2191 15.3665 11.0002 14.5855L13.9597 11.6259C14.3502 11.2354 14.9834 11.2354 15.3739 11.6259C15.7644 12.0165 15.7644 12.6496 15.3739 13.0401L13.4144 14.9997H21.0002C21.5524 14.9997 22.0002 15.4474 22.0002 15.9997C22.0002 16.552 21.5524 16.9997 21.0002 16.9997H13.4144L15.3739 18.9592C15.7644 19.3498 15.7645 19.9829 15.3739 20.3735C14.9834 20.764 14.3502 20.764 13.9597 20.3735L11.0002 17.4139Z",fill:"currentColor"})}),Wn=mn({displayName:"ReloadIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M19.146 4.854l-1.489 1.489A8 8 0 1 0 12 20a8.094 8.094 0 0 0 7.371-4.886 1 1 0 1 0-1.842-.779A6.071 6.071 0 0 1 12 18a6 6 0 1 1 4.243-10.243l-1.39 1.39a.5.5 0 0 0 .354.854H19.5A.5.5 0 0 0 20 9.5V5.207a.5.5 0 0 0-.854-.353z",fill:"currentColor"})}),In=mn({displayName:"CartBagIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M16 7C16 5.4 14.9 4 13.5 4H10.5C9.1 4 8 5.4 8 7H5C4.448 7 4 7.448 4 8V19C4 19.552 4.448 20 5 20H19C19.552 20 20 19.552 20 19V8C20 7.448 19.552 7 19 7H16ZM10.5 6H13.5C13.776 6 14 6.4 14 7H10C10 6.4 10.224 6 10.5 6ZM18 18H6V9H8V10.5C8 11.052 8.448 11.5 9 11.5C9.552 11.5 10 11.052 10 10.5V9H14V10.5C14 11.052 14.448 11.5 15 11.5C15.552 11.5 16 11.052 16 10.5V9H18V18Z",fill:"currentColor"})}),Ln=mn({displayName:"HeartIcon",viewBox:"0 0 24 24",path:O.jsx("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 1 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",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Mn=mn({displayName:"HeartFilledIcon",viewBox:"0 0 24 24",path:O.jsx("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 1 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",fill:"currentColor",stroke:"currentColor",strokeWidth:"1",strokeLinejoin:"round"})}),Bn=mn({displayName:"ArrowRightIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M12.293 5.293C12.684 4.902 13.316 4.902 13.707 5.293L19.707 11.293C20.098 11.684 20.098 12.316 19.707 12.707L13.707 18.707C13.316 19.098 12.684 19.098 12.293 18.707C11.902 18.316 11.902 17.684 12.293 17.293L16.586 13H5C4.448 13 4 12.552 4 12C4 11.448 4.448 11 5 11H16.586L12.293 6.707C11.902 6.316 11.902 5.684 12.293 5.293Z",fill:"currentColor"})}),Fn=mn({displayName:"AiBigIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M18.423 9.97031L16.7505 10.5726C15.8336 10.903 15.0009 11.4317 14.3118 12.1208C13.6226 12.81 13.094 13.6427 12.7635 14.5596L12.1613 16.2321C12.1492 16.2651 12.1272 16.2936 12.0984 16.3137C12.0695 16.3339 12.0352 16.3447 12 16.3447C11.9649 16.3447 11.9305 16.3339 11.9017 16.3137C11.8728 16.2936 11.8509 16.2651 11.8388 16.2321L11.2365 14.5596C10.9061 13.6427 10.3774 12.81 9.68826 12.1208C8.99911 11.4317 8.16641 10.903 7.24953 10.5726L5.57703 9.97031C5.544 9.9582 5.51549 9.93624 5.49535 9.9074C5.47521 9.87856 5.46441 9.84423 5.46441 9.80906C5.46441 9.77388 5.47521 9.73955 5.49535 9.71071C5.51549 9.68188 5.544 9.65992 5.57703 9.64781L7.24953 9.04556C8.16641 8.7151 8.99911 8.18645 9.68826 7.49729C10.3774 6.80814 10.9061 5.97544 11.2365 5.05856L11.8388 3.38606C11.8509 3.35303 11.8728 3.32452 11.9017 3.30438C11.9305 3.28424 11.9649 3.27344 12 3.27344C12.0352 3.27344 12.0695 3.28424 12.0984 3.30438C12.1272 3.32452 12.1492 3.35303 12.1613 3.38606L12.7635 5.05856C13.094 5.97544 13.6226 6.80814 14.3118 7.49729C15.0009 8.18645 15.8336 8.7151 16.7505 9.04556L18.423 9.64781C18.4564 9.65958 18.4853 9.68141 18.5057 9.71029C18.5261 9.73917 18.5371 9.77368 18.5371 9.80906C18.5371 9.84443 18.5261 9.87894 18.5057 9.90782C18.4853 9.9367 18.4564 9.95853 18.423 9.97031ZM22.4423 17.4988L21.5955 17.8041C21.1313 17.9715 20.7097 18.2393 20.3607 18.5883C20.0118 18.9372 19.744 19.3588 19.5765 19.8231L19.2713 20.6698C19.2652 20.6866 19.254 20.7011 19.2394 20.7113C19.2248 20.7216 19.2074 20.727 19.1895 20.727C19.1717 20.727 19.1543 20.7216 19.1396 20.7113C19.125 20.7011 19.1139 20.6866 19.1078 20.6698L18.8025 19.8231C18.635 19.3588 18.3673 18.9372 18.0183 18.5883C17.6694 18.2393 17.2478 17.9715 16.7835 17.8041L15.9368 17.4988C15.92 17.4927 15.9055 17.4816 15.8953 17.467C15.885 17.4523 15.8795 17.4349 15.8795 17.4171C15.8795 17.3992 15.885 17.3818 15.8953 17.3672C15.9055 17.3525 15.92 17.3414 15.9368 17.3353L16.7835 17.0301C17.2478 16.8626 17.6694 16.5948 18.0183 16.2459C18.3673 15.8969 18.635 15.4753 18.8025 15.0111L19.1078 14.1643C19.1139 14.1475 19.125 14.133 19.1396 14.1228C19.1543 14.1126 19.1717 14.1071 19.1895 14.1071C19.2074 14.1071 19.2248 14.1126 19.2394 14.1228C19.254 14.133 19.2652 14.1475 19.2713 14.1643L19.5765 15.0111C19.744 15.4753 20.0118 15.8969 20.3607 16.2459C20.7097 16.5948 21.1313 16.8626 21.5955 17.0301L22.4423 17.3353C22.4591 17.3414 22.4735 17.3525 22.4838 17.3672C22.494 17.3818 22.4995 17.3992 22.4995 17.4171C22.4995 17.4349 22.494 17.4523 22.4838 17.467C22.4735 17.4816 22.4591 17.4927 22.4423 17.4988ZM8.06253 17.4988L7.21578 17.8041C6.75155 17.9715 6.32995 18.2393 5.98098 18.5883C5.63201 18.9372 5.36426 19.3588 5.19678 19.8231L4.89153 20.6698C4.88542 20.6866 4.8743 20.7011 4.85967 20.7113C4.84505 20.7216 4.82763 20.727 4.80978 20.727C4.79192 20.727 4.7745 20.7216 4.75988 20.7113C4.74525 20.7011 4.73413 20.6866 4.72803 20.6698L4.42278 19.8231C4.2553 19.3588 3.98754 18.9372 3.63858 18.5883C3.28961 18.2393 2.86801 17.9715 2.40378 17.8041L1.55703 17.4988C1.54025 17.4927 1.52576 17.4816 1.51552 17.467C1.50528 17.4523 1.49979 17.4349 1.49979 17.4171C1.49979 17.3992 1.50528 17.3818 1.51552 17.3672C1.52576 17.3525 1.54025 17.3414 1.55703 17.3353L2.40378 17.0301C2.86801 16.8626 3.28961 16.5948 3.63858 16.2459C3.98754 15.8969 4.2553 15.4753 4.42278 15.0111L4.72803 14.1643C4.73413 14.1475 4.74525 14.133 4.75988 14.1228C4.7745 14.1126 4.79192 14.1071 4.80978 14.1071C4.82763 14.1071 4.84505 14.1126 4.85967 14.1228C4.8743 14.133 4.88542 14.1475 4.89153 14.1643L5.19678 15.0111C5.36426 15.4753 5.63201 15.8969 5.98098 16.2459C6.32995 16.5948 6.75155 16.8626 7.21578 17.0301L8.06253 17.3353C8.13903 17.3631 8.13903 17.4718 8.06253 17.4988Z",fill:"currentColor"})});mn({displayName:"AiRainbowIconBase",viewBox:"0 0 24 24",path:O.jsxs(O.Fragment,{children:[O.jsx("g",{clipPath:"url(#clip0_497_8063)",children:O.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:"url(#paint0_linear_497_8063)"})}),O.jsxs("defs",{children:[O.jsxs("linearGradient",{id:"paint0_linear_497_8063",x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[O.jsx("stop",{stopColor:"#FF7E90"}),O.jsx("stop",{offset:"0.463542",stopColor:"#A939FF"}),O.jsx("stop",{offset:"1",stopColor:"#0020FF"})]}),O.jsx("clipPath",{id:"clip0_497_8063",children:O.jsx("rect",{width:"24",height:"24",fill:"white"})})]})]})});const Dn=e=>{const t=tn("colors","primary"),[n,r,o]=re(t),a=oe.useMemo(()=>`rainbow-gradient-${Math.random().toString(36).substr(2,9)}`,[]),{w:i,width:s,transform:l}=e,c="string"==typeof i?i:"string"==typeof s?s:"number"==typeof i?`${i}px`:"number"==typeof s?`${s}px`:"24px";return O.jsx(ae,{position:"relative",display:"inline-block",width:c,height:c,transform:l,children:O.jsxs("svg",{viewBox:"0 0 24 24",width:c,height:c,style:{display:"block"},children:[O.jsxs("defs",{children:[O.jsxs("linearGradient",{id:a,x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[O.jsx("stop",{stopColor:n}),O.jsx("stop",{offset:"0.463542",stopColor:r}),O.jsx("stop",{offset:"1",stopColor:o})]}),O.jsx("clipPath",{id:`clip-${a}`,children:O.jsx("rect",{width:"24",height:"24",fill:"white"})})]}),O.jsx("g",{clipPath:`url(#clip-${a})`,children:O.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:`url(#${a})`})})]})})},Hn=""+new URL("dori.ico",import.meta.url).href,Pn=({onClose:e,isMobile:t=!1,isExpanded:a=!1,onToggleExpand:i,fullPageHref:s,onReload:l})=>{const{botData:c,cartItemCount:d,shortlistEnabled:u,shortlist:p,setShortlistOpen:f}=ie(),h=se(),{t:g}=le(),m=n(c)&&d>0,b=u&&p.length>0,x=c?.bot_image?c.bot_image:Hn,y=ce(x),v=he(y.ratio),[w,k]=q.useState(!1),C=q.useRef(p.length);return q.useEffect(()=>{if(p.length===C.current)return;C.current=p.length,k(!0);const e=setTimeout(()=>k(!1),250);return()=>clearTimeout(e)},[p.length]),O.jsxs(bn,{justify:"space-between",align:"center",flexShrink:0,children:[c?.feature_flags?.hide_header_logo?O.jsx(ae,{h:h.length(40)}):O.jsx(de,{src:x,alt:"",role:"presentation",onLoad:y.onLoad,h:h.length(40),w:v?"auto":h.length(40),maxW:v?h.length(140):void 0,objectFit:v?"contain":"cover",borderRadius:v?h.radius(6):"50%"}),O.jsxs(ue,{gap:h.space(3),children:[b&&O.jsxs(ee,{variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,transform:w?"scale(1.12)":"scale(1)",transition:"transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)",onClick:()=>f(!0),"aria-label":g("savedProducts"),fontFamily:pe,children:[O.jsx(Mn,{boxSize:h.length(15),color:"primary"}),O.jsx(fe,{fontSize:h.font(13),fontWeight:"500",color:"text",children:p.length})]}),m&&O.jsxs(ee,{variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,onClick:()=>{if(!r()){const e=`${o()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},fontFamily:pe,children:[O.jsx(In,{boxSize:h.length(16),color:"text"}),O.jsx(fe,{fontSize:h.font(13),fontWeight:"500",color:"text",children:d})]}),s?O.jsx(ee,{asChild:!0,variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,fontFamily:pe,children:O.jsxs("a",{href:s,children:[O.jsx(jn,{boxSize:h.length(16),color:"text"}),g("aiPageOpenFull")]})}):!t&&i&&O.jsxs(ee,{variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,onClick:()=>i?.(),fontFamily:pe,children:[O.jsx(jn,{boxSize:h.length(16),color:"text"}),g(a?"minimize":"showFullScreen")]}),l&&O.jsx(fn,{size:"sm",boxSize:h.length(36),minW:h.length(36),variant:"ghost","aria-label":g("reload"),onClick:l,color:"text",_hover:{bgColor:"mutedText"},children:O.jsx(Wn,{boxSize:t?h.length(16):h.length(24),color:"text"})}),O.jsx(fn,{size:"sm",boxSize:h.length(36),minW:h.length(36),variant:"ghost","aria-label":g("close"),onClick:()=>{a&&i?.(),e()},color:"text",_hover:{bgColor:"mutedText"},children:O.jsx(wn,{boxSize:t?h.length(16):h.length(24),color:"text"})})]})]})};class qn{static async getUploadCredentials(e){const t={file_extension:e,expires_in:3600,content_length_range:{min_bytes:1024,max_bytes:10485760}},n=await fetch(a.getUploadUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({data:t})});if(!n.ok)throw new Error(`Failed to get upload credentials: ${n.status} ${n.statusText}`);return await n.json()}static async compressImage(e,t=1024,n=.8){return new Promise(r=>{const o=document.createElement("canvas"),a=o.getContext("2d"),i=new Image;i.onload=()=>{const{width:s,height:l}=this.calculateDimensions(i.width,i.height,t);o.width=s,o.height=l,a.drawImage(i,0,0,s,l),o.toBlob(t=>{const a=new File([t],e.name,{type:"image/jpeg",lastModified:Date.now()});r({file:a,preview:o.toDataURL("image/jpeg",n),format:"jpeg"})},"image/jpeg",n)},i.src=URL.createObjectURL(e)})}static getFileExtension(e){const t=e.name.split(".").pop()?.toLowerCase();switch(t){case"jpg":case"jpeg":default:return"jpeg";case"webp":return"webp";case"png":return"png";case"heic":return"heic"}}static calculateDimensions(e,t,n){if(e<=n)return{width:e,height:t};const r=t/e;return{width:n,height:Math.round(n*r)}}static async uploadImage(e,t){const n=new FormData;Object.entries(e.fields).forEach(([e,t])=>{n.append(e,t)}),n.append("file",t);const r=await fetch(e.url,{method:"POST",body:n});if(!r.ok&&204!==r.status)throw new Error("Error uploading image");return e.public_url}}const On=()=>{const[e,t]=q.useState(null),[n,r]=q.useState(!1);return{uploadedImage:e,isUploading:n,handleFileSelect:()=>{const e=document.createElement("input");e.type="file",e.accept="image/jpeg,image/jpg,image/webp,image/png,image/heic",e.onchange=e=>{const n=e.target.files?.[0];n&&(async e=>{try{r(!0);const n=await qn.compressImage(e),o=await qn.getUploadCredentials(n.format),a=await qn.uploadImage(o,n.file);t({url:a,preview:n.preview,name:e.name,size:n.file.size})}catch(n){console.error("Upload failed:",n),alert("Failed to upload image")}finally{r(!1)}})(n)},e.click()},removeImage:()=>{e?.preview&&URL.revokeObjectURL(e.preview),t(null)}}},Nn=({imageUrl:e,onRemove:t})=>{const n=se();return O.jsxs("div",{style:{position:"relative",display:"inline-block",background:"transparent"},children:[O.jsx(de,{src:e,alt:"Uploaded image",w:n.length(80),h:n.length(80),borderRadius:n.radius(12),objectFit:"cover",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.11)"}),O.jsx(fn,{position:"absolute",top:n.length(6),right:n.length(6),bg:"primary",color:"buttonText","aria-label":"Remove image",onClick:t,size:"sm",borderRadius:"50%",minW:n.length(24),h:n.length(24),children:O.jsx(wn,{boxSize:n.length(14)})})]})},Yn=()=>{const[e,t]=q.useState(!1);return q.useEffect(()=>{const e=e=>{"Tab"===e.key&&t(!0)},n=()=>t(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",n,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",n,!0)}},[]),e},Vn=e=>e?{"&:has(textarea:focus, input:focus)":{boxShadow:"inset 0 0 0 2px var(--chakra-colors-text)"}}:void 0,Un=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r,isMobileView:o})=>{const{t:a}=le(),i=Yn(),{botData:s,chatState:{repliedProduct:l},setRepliedProduct:c}=ie(),d=!s?.feature_flags?.hide_image_upload,u=se(),[p,f]=q.useState(t),{uploadedImage:h,isUploading:g,handleFileSelect:m,removeImage:b}=On();q.useEffect(()=>{f(y(t))},[t]);const x=e=>{(p.trim()||e||h)&&(r?.({message:e??p.trim(),imageUrl:h?.url},l?.product),c?.(null),f(""),b())},y=e=>e.trimStart();return O.jsxs(ge,{gap:u.space(2),align:"stretch",bg:"transparent",position:"relative",children:[h&&O.jsx(ae,{position:"absolute",bottom:l?o?u.length(300):u.length(190):u.length(90),left:u.length(12),zIndex:1e6,bg:"transparent",pointerEvents:"auto",children:O.jsx(Nn,{imageUrl:h.preview,onRemove:b})}),O.jsx(ae,{bgColor:"lightBackground",borderRadius:u.radius(24),css:Vn(i),position:"relative",p:u.space(2),w:"full",h:l?o?u.length(300):u.length(190):u.length(90),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:O.jsxs(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:u.space(2),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:[l&&O.jsxs(ge,{opacity:1,p:u.length(8),gap:u.length(8),borderRadius:u.radius(12),borderWidth:"1px",borderColor:"borderColor",bgColor:"lightBackground",children:[O.jsxs(ue,{justify:"space-between",align:"center",w:"full",children:[O.jsx(de,{src:l?.product?.image,alt:"product",w:u.length(40),h:u.length(40)}),O.jsx(fe,{fontSize:u.font(12),fontWeight:400,color:"text",children:l?.product?.name}),O.jsx(fn,{bg:"transparent","aria-label":"Remove product",onClick:()=>c?.(null),children:O.jsx(wn,{boxSize:u.length(24),color:"text"})})]}),l?.suggestions&&l.suggestions.length>0&&O.jsxs(O.Fragment,{children:[O.jsx(ae,{display:{base:"none",md:"block"},w:"full",children:O.jsx(ue,{w:"full",justify:"flex-start",align:"center",gap:u.space(2),children:l.suggestions.map(e=>O.jsx(ee,{variant:"outline",bg:"transparent",color:"text",fontSize:u.font(12),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),h:u.length(32),px:u.space(3),minW:"unset",flex:1,lineHeight:"1.5",overflow:"hidden",children:O.jsx(ae,{as:"span",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block",w:"100%",children:e})},e))})}),O.jsx(ae,{display:{base:"block",md:"none"},w:"full",children:O.jsx(ge,{w:"full",align:"stretch",gap:u.length(8),children:l.suggestions.map(e=>O.jsx(ee,{variant:"outline",bg:"transparent",w:"full",color:"text",fontSize:u.font(14),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),children:e},e))})})]})]}),O.jsx(vn,{"aria-label":a("messageInputLabel"),value:p,onChange:e=>(e=>{const t=y(e);f(t),n?.(t)})(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:e,fontSize:me(u,16),color:"text",fontWeight:300,resize:"none",rows:1,lineHeight:"1.5",h:"100%",border:"none",bg:"transparent",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},pr:u.length(48),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"}),d&&O.jsx(fn,{position:"absolute",bottom:u.length(8),left:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background","aria-label":"Upload image",onClick:m,_hover:{bg:"background"},disabled:g,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",color:"text",children:g?O.jsx(be,{size:"sm",color:"text"}):O.jsx(xe,{color:"text"})}),O.jsx(fn,{position:"absolute",bottom:u.length(12),right:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Send",onClick:()=>x(),_hover:{bg:"veryLightBackground"},disabled:!p.trim()&&!h,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"background",cursor:"not-allowed",opacity:.7},transform:"scale(1)",zIndex:2,children:O.jsx(Tn,{boxSize:u.length(30),color:"primary"})})]})})]})},Zn=({placeholder:e="Write a prompt or paste a contract address",onStop:t})=>{const n=se(),{stopCurrentRequest:r}=ie();return O.jsx(ge,{gap:n.space(2),align:"stretch",bg:"transparent",position:"relative",children:O.jsx(ae,{bg:"lightBackground",borderRadius:n.radius(32),position:"relative",p:n.space(3),w:"full",h:n.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:O.jsx(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:n.space(3),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:O.jsxs(ue,{justify:"space-between",align:"center",h:"full",children:[O.jsx(fe,{color:"mutedText",fontSize:n.font(16),flex:1,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e}),O.jsx(fn,{size:"xs",boxSize:n.length(32),minW:n.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Stop",onClick:()=>{r?.(),t?.()},_hover:{bg:"veryLightBackground"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,children:O.jsx(Rn,{boxSize:n.length(30),color:"primary"})})]})})})})},Kn=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r})=>{const{t:o}=le(),a=Yn(),i=se(),{botData:s}=ie(),l=!s?.feature_flags?.hide_image_upload,[c,d]=q.useState(t),[u,p]=q.useState(!1),{uploadedImage:f,isUploading:h,handleFileSelect:g,removeImage:m}=On(),b=q.useRef(null);q.useEffect(()=>{d(t)},[t]);const x=()=>{(c.trim()||f)&&(r?.({message:c.trim(),imageUrl:f?.url}),d(""),m())};return O.jsxs(ge,{gap:i.space(2),align:"stretch",children:[f&&O.jsx(ae,{mb:i.space(2),alignSelf:"flex-start",bg:"transparent",children:O.jsx(Nn,{imageUrl:f.preview,onRemove:m})}),O.jsxs(ae,{bg:"lightBackground",borderRadius:i.radius(24),css:Vn(a),position:"relative",p:i.space(2),w:"full",h:u?i.length(80):i.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",cursor:"pointer",onClick:()=>{p(!0),setTimeout(()=>{if(b.current){b.current.focus();const e=b.current.value.length;b.current.setSelectionRange(e,e)}},100)},children:[O.jsx(ae,{position:"absolute",top:i.length(8),left:i.length(8),zIndex:2,children:O.jsx(Dn,{w:i.length(24),h:i.length(24),transform:"rotate(2700deg)",color:"primary"})}),O.jsx(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?0:1,transform:u?"translateY(-20px) scale(0.95)":"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"none":"auto",children:O.jsx(ue,{justify:"space-between",align:"center",h:"full",children:O.jsx(fe,{color:"#999999",fontSize:i.font(16),flex:1,paddingStart:i.length(32),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e})})}),l&&O.jsx(fn,{position:"absolute",bottom:i.length(7.5),right:i.length(52),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Upload image",onClick:e=>{e.stopPropagation(),g()},_hover:{bg:"veryLightBackground"},disabled:h,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",children:h?O.jsx(be,{size:"sm"}):O.jsx(xe,{size:i.length(24)})}),O.jsx(fn,{position:"absolute",bottom:i.length(8),right:i.length(12),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"primary","aria-label":"Send",onClick:e=>{e.stopPropagation(),x()},_hover:{bg:"darkPrimary"},disabled:!c.trim()&&!f,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"primary",opacity:.5,cursor:"not-allowed"},transform:"scale(1) rotate(180deg)",zIndex:2,children:O.jsx(_n,{boxSize:i.length(30),color:"buttonText"})}),O.jsx(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?1:0,transform:u?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"auto":"none",children:O.jsx(vn,{"aria-label":o("messageInputLabel"),ref:b,value:c,onChange:e=>{return t=e.target.value,d(t),void n?.(t);var t},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:e,paddingLeft:i.length(32),paddingRight:l?i.length(80):i.length(40),fontSize:me(i,16),color:"text",fontWeight:300,resize:"none",h:"100%",border:"none",bg:"transparent",cursor:"text",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",rows:2,lineHeight:"1.5"})})]})]})},Qn=({state:e="starting",placeholder:t="Write a prompt or paste a contract address",value:n="",onChange:r,onSend:o,onStop:a})=>{const[i,s]=q.useState(!1);return q.useEffect(()=>{const e=()=>{s(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),"starting"===e?O.jsx(Un,{placeholder:t,value:n,onChange:r,onSend:o,isMobileView:i}):"generating"===e?O.jsx(Zn,{placeholder:t,onStop:a,isMobileView:i}):O.jsx(Kn,{placeholder:t,value:n,onChange:r,onSend:o})},Gn=e=>{const t=e.includes("?")?"&":"?";return`${e}${t}utm_source=dori&utm_medium=dori_widget&utm_campaign=dori_product_recommendation`},Xn=(e,t)=>{const n=e.includes("?")?"&":"?";return`${e}${n}utm_source=customer_referral&utm_medium=widget&utm_campaign=powered_by&utm_term=${t}`};function Jn(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"none"};const n=t?.logo_url?.trim();if(n)return{kind:"merchant",src:n,alt:t?.logo_alt?.trim()||e?.bot_name||"Store logo"};const r=Boolean(t?.disclaimer_text?.trim());return t?.is_white_labeled||r?{kind:"none"}:{kind:"dori"}}function $n(e){return!e?.white_label?.ai_notice_only&&!1!==e?.customization?.enable_shopper_memory}function er(e){return"dori"===Jn(e).kind?"Dori":e?.agent_name?.trim()||e?.bot_name?.trim()||"Dori"}const tr="/policies/privacy-policy",nr=()=>{const{t:e}=le(),{botData:t}=ie(),n=se(),[r,o]=q.useState(!1);return O.jsxs(ae,{position:"relative",display:"inline-flex",alignItems:"center",children:[O.jsxs(ae,{as:"span",display:"inline-flex",alignItems:"center",gap:n.space(1),tabIndex:0,cursor:"default",px:n.space(2),py:"1px",borderRadius:"9999px",bgGradient:"to-r",gradientFrom:"primaryWash",gradientTo:"primaryWashStrong",color:"darkPrimary",border:"1px solid",borderColor:"primaryWash",lineHeight:"1.25",transition:"background 120ms ease, box-shadow 120ms ease",_hover:{boxShadow:"0 1px 6px rgba(0,0,0,0.10)"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:()=>o(!0),onBlur:()=>o(!1),"aria-describedby":"dori-personalized-tip",children:[O.jsx(An,{boxSize:n.font(11),"aria-hidden":"true"}),O.jsx(fe,{as:"span",fontSize:n.font(10),fontWeight:"600",children:e("personalizedBadge")})]}),r&&O.jsx(ae,{id:"dori-personalized-tip",role:"tooltip",position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",zIndex:20,width:"max(220px, 80%)",maxW:"260px",bg:"rgba(32,34,35,0.96)",color:"white",fontSize:n.font(11),lineHeight:"1.45",px:n.space(3),py:n.space(2),borderRadius:"8px",boxShadow:"0 6px 20px rgba(0,0,0,0.22)",pointerEvents:"none",children:e("personalizedTooltip").split("{name}").join(er(t))})]})},rr=()=>{const e=se(),{botData:t}=ie(),{isMobile:n}=ye(),{t:r}=le(),o=function(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"short"};const n=t?.disclaimer_text?.trim();return n?{kind:"custom",text:n}:{kind:"default"}}(t),a="custom"===o.kind?o.text:r("short"===o.kind?"aiCanMakeMistakesShort":"aiCanMakeMistakes"),i=Jn(t),s=function(e){const t=e?.white_label;if(!t?.privacy_link_enabled)return null;const n=t.privacy_link_url?.trim();return n?/^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(n)?`https://${n}`:tr:tr}(t);return O.jsxs(ue,{gapX:e.space(2),justifyContent:n?"start":"center",align:"center",alignContent:"center",alignItems:"center",w:"full",wrap:n?"wrap":"nowrap",children:["dori"===i.kind&&O.jsx(nn,{href:Xn("https://dori.tech/",t?.sharing_id||""),target:"_blank",rel:"noopener noreferrer",display:"inline-flex",alignItems:"center",children:O.jsx(de,{src:Hn,alt:"Dori AI",boxSize:ve(e)})}),"merchant"===i.kind&&O.jsx(de,{src:i.src,alt:i.alt,h:ve(e),w:"auto",maxW:we(e),objectFit:"contain",flexShrink:0}),O.jsxs(ae,{fontSize:e.font(10),color:"mutedText",px:e.space(0),py:e.space(0),bg:"transparent",border:"none",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:e.space(1),children:[O.jsx(ae,{as:"span",children:a}),s&&O.jsx(nn,{href:s,target:"_blank",rel:"noopener noreferrer",color:"inherit",textDecoration:"underline",whiteSpace:"nowrap",children:r("privacyPolicy")}),$n(t)&&O.jsx(nr,{})]})]})};function or(e){return ke({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 184 144 144 144-144"},child:[]}]})(e)}function ar(e){return ke({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 328 144-144 144 144"},child:[]}]})(e)}const ir=(e={})=>{const{enableTwinkling:t=!0,enableFloating:n=!0,enableRotation:r=!0,enableScaling:o=!0,twinklingSpeed:a=1e3,floatingSpeed:i=3e3,rotationSpeed:s=8e3,scalingSpeed:l=4e3,floatingRange:c=2.5,rotationRange:d=90,scalingRange:u=1.2}=e,[p,f]=q.useState(1),[h,g]=q.useState(0),[m,b]=q.useState(0),[x,y]=q.useState(1);return q.useEffect(()=>{if(!t)return;const e=setInterval(()=>{f(e=>1===e?.2:1)},a);return()=>clearInterval(e)},[t,a]),q.useEffect(()=>{if(!n)return;const e=setInterval(()=>{g(e=>0===e?c:0)},i);return()=>clearInterval(e)},[n,i,c]),q.useEffect(()=>{if(!r)return;const e=setInterval(()=>{b(e=>0===e?d:0)},s);return()=>clearInterval(e)},[r,s,d]),q.useEffect(()=>{if(!o)return;const e=setInterval(()=>{y(e=>1===e?u:1)},l);return()=>clearInterval(e)},[o,l,u]),{getStarfieldTransform:(e,t)=>[].filter(Boolean).join(" "),getIconStyle:()=>({opacity:p,transition:"transform 0.8s ease-in-out, opacity 1s ease-in-out"}),twinkleOpacity:p,floatingOffset:h,rotationAngle:m,scaleFactor:x}};function sr(e){if(!e)return null;const{customization:t,bot_image:n,agent_image:r,bot_image_original:o}=e;switch(t?.fab_avatar_source){case"none":return null;case"logo":return n||null;case"agent":return r||null}return t?.enable_avatar_in_fab&&((n&&n!==o?n:null)||r||n)||null}const lr=e=>"bottom"===e?.anchor?"bottom":"middle",cr=(e,t)=>t?(e=>e?.customization?.mobile?.position?{align:e.customization?.mobile?.position?.align??"right",sideSpacing:e.customization?.mobile?.position?.side_spacing??8,bottomSpacing:e.customization?.mobile?.position?.bottom_spacing??0,anchor:lr(e.customization?.mobile?.position)}:{align:"right",sideSpacing:8,bottomSpacing:20,anchor:"middle"})(e):(e=>e?.customization?.position?{align:e.customization?.position?.align??"right",sideSpacing:e.customization?.position?.side_spacing??16,bottomSpacing:e.customization?.position?.bottom_spacing??0,anchor:lr(e.customization?.position)}:{align:"right",sideSpacing:16,bottomSpacing:60,anchor:"middle"})(e),dr=(e,t,n)=>"bottom"===e.anchor||n&&!!sr(t),ur=(e,t)=>"bottom"===e.anchor?Math.max(0,e.bottomSpacing):t?.customization?.mobile?.position?.bottom_spacing??90;function pr(){return"undefined"!=typeof window&&!!window.$crisp}function fr(){pr()&&window.$crisp.push(["do","chat:hide"])}function hr(){console.log("trying to open"),pr()&&(console.log("trying to open2"),window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:open"]))}const gr=15e3,mr="chatra";let br=!1,xr=!1,yr=null,vr=0,wr=null,kr=0,Cr=!1;function jr(...e){console.log("[Dori-Chatra]",...e)}function Sr(){return"undefined"!=typeof window&&"function"==typeof window.Chatra}function zr(){return!!Sr()&&!!document.getElementById(mr)}function Er(e){if(Sr())try{window.Chatra("hide"),jr("called Chatra('hide') —",e)}catch(t){jr("error calling hide:",t)}}function Ar(){null!==yr&&(clearInterval(yr),yr=null,jr("stopped maintain loop"))}function Rr(){xr||Date.now()-vr>3e4?Ar():br&&Sr()&&Er("maintain loop")}function Tr(){if(!xr)return;const e=document.getElementById(mr);if(!e)return;const t=e.className||"",n=-1!==t.indexOf("chatra--visible");-1!==t.indexOf("chatra--expanded")?Cr=!0:Cr&&(Date.now()-kr<1500||n&&Er("user closed chat"))}function _r(){jr("openChatraChat invoked"),xr=!0,Cr=!1,Ar(),function(){if(wr||"undefined"==typeof document)return;const e=()=>{const e=document.getElementById(mr);return!!e&&(wr=new MutationObserver(Tr),wr.observe(e,{attributes:!0,attributeFilter:["class","style"]}),jr("attached close observer to #chatra"),!0)};if(e())return;const t=Date.now(),n=setInterval(()=>{(e()||Date.now()-t>gr)&&clearInterval(n)},200)}(),function(e){if(zr())return void e();const t=Date.now(),n=setInterval(()=>{zr()?(clearInterval(n),e()):Date.now()-t>gr&&(clearInterval(n),jr("Chatra never fully loaded within",gr,"ms"))},200)}(()=>{kr=Date.now();try{window.Chatra("show"),jr("called Chatra('show')"),setTimeout(()=>{try{window.Chatra("openChat"),jr("called Chatra('openChat')")}catch(e){jr("error calling openChat:",e)}},50)}catch(e){jr("error calling show:",e)}})}const Wr="dori-shopify-inbox-hide",Ir="data-dori-inbox-open",Lr="shopify-chat",Mr="inbox-online-store-chat";let Br=null;function Fr(...e){console.log("[Dori-ShopifyInbox]",...e)}function Dr(){if("undefined"==typeof document)return null;const e=document.querySelector(Lr);if(e)return{el:e,legacy:!1};const t=document.querySelector(Mr);return t?{el:t,legacy:!0}:null}function Hr(){Fr("openShopifyInbox invoked"),function(e){const t=Dr();if(t)return void e(t);const n=Date.now(),r=setInterval(()=>{const t=Dr();t?(clearInterval(r),e(t)):Date.now()-n>15e3&&(clearInterval(r),Fr("Inbox embed never appeared within",15e3,"ms"))},200)}(({el:e,legacy:t})=>{if(document.documentElement.setAttribute(Ir,""),t)requestAnimationFrame(()=>{const t=e.shadowRoot?.querySelector("button");t?(t.click(),Fr("clicked legacy activator")):Fr("legacy activator not found in shadow root")});else{if(function(e){Br||"undefined"==typeof document||(Br=new MutationObserver(()=>{e.hasAttribute("open")||document.documentElement.removeAttribute(Ir)}),Br.observe(e,{attributes:!0,attributeFilter:["open"]}))}(e),"function"==typeof e.show)try{return e.show(),void Fr("called shopify-chat.show()")}catch(n){Fr("show() failed, falling back to the open attribute:",n)}e.setAttribute("open","")}})}const Pr=e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t},qr=(e,t,n)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),r=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${r}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":hr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":_r(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":Hr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"dori":n&&n()}},Or=({channels:e,isOpen:t,onToggle:n,isMobile:r,onMouseEnter:o,onChatClick:a})=>{const{botData:i}=ie(),s=ln({base:!0,md:!1})??!1,l=cr(i,s),c=!0!==i?.customization?.disable_idle_animation,{getStarfieldTransform:d,getIconStyle:u}=ir({enableTwinkling:c,enableFloating:c,enableRotation:c,enableScaling:c}),p=Pr(e);return 0===p.length?null:O.jsxs(ge,{gap:2,align:"flex-end",alignItems:"center",position:"absolute",bottom:"100%",right:0,children:[r&&t&&O.jsx(fn,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:O.jsx(or,{size:20})}),O.jsx(ae,{mb:3,opacity:t?1:0,transform:t?"translateY(0)":"translateY(10px)",transition:"all 0.2s ease",pointerEvents:t?"auto":"none",onMouseEnter:o,children:O.jsxs(ge,{gap:2,align:"flex-end",children:[O.jsx(ae,{borderRadius:"full",cursor:"pointer",onClick:()=>qr("dori",{},a),bg:"primary",boxSize:{base:"36px",md:"48px"},display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"md",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},transition:"all 0.2s ease",children:O.jsx(Fn,{boxSize:{base:"24px",md:"32px"},color:"background",transform:d("expanded",l),...u()})}),p.map((e,t)=>O.jsx(ae,{borderRadius:"full",cursor:"pointer",onClick:()=>qr(e.type,e.data,a),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)"}},transition:"all 0.2s ease",children:O.jsx(de,{src:e.icon,alt:e.name,boxSize:{base:"36px",md:"48px"},borderRadius:"full",objectFit:"fill"})},`${e.type}-${t}`))]})}),r&&!t&&O.jsx(fn,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:O.jsx(ar,{size:20})})]})},Nr=({channels:e})=>{const t=se(),n=(e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t})(e);return 0===n.length?null:O.jsx(ue,{gap:t.space(3),w:"full",alignItems:"center",justifyContent:"start",wrap:"wrap",children:n.map((e,n)=>O.jsxs(ae,{display:"flex",alignItems:"center",gap:t.space(3),cursor:"pointer",borderRadius:t.radius(16),padding:"6px 8px",bg:"lightBackground",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"veryLightBackground",transform:"scale(1.05)"}},transition:"all 0.2s ease",onClick:()=>((e,t)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),n=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${n}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":hr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":_r(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":Hr(),window.dispatchEvent(new Event("dori:close-widget"))}})(e.type,e.data),flexShrink:0,children:[O.jsx(de,{src:e.icon,alt:e.name,boxSize:{base:t.length(22),md:t.length(24)},borderRadius:"full",objectFit:"cover"}),O.jsx(fe,{fontSize:{base:t.font(12),md:t.font(14)},fontWeight:"400",color:"text",whiteSpace:"nowrap",children:e.name})]},`${e.type}-${n}`))})},Yr=({offer:e,selections:t,onDone:n,onClose:r})=>{const o=se(),{isMobile:a}=ye(),{t:s}=le(),{botData:l,chatState:c}=ie(),[d,u]=q.useState(""),[p,f]=q.useState(!1),[h,g]=q.useState(!1),[m,b]=q.useState(null),x=(e,t={})=>i(e,{assistantId:l?.assistant_id,threadId:c.threadId,payload:{placement:"quiz",...t}}),y=async()=>{if(h)return;if(!Se(d))return void b(s("followUpInvalidEmail"));if(!p)return;g(!0),b(null);const t=await ze(d.trim(),e.tags);g(!1),"ok"===t?(Ee(),Ae(d.trim()),x("email_signup_joined")):x("email_signup_failed",{result:t}),n()};return O.jsxs(ge,{gap:o.space(3),align:"stretch",flex:1,justify:"start","data-dori-quiz-signup":"",children:[O.jsxs(ue,{justify:"space-between",align:"center",gap:o.space(2),children:[O.jsx(ue,{gap:o.space(1.5),flexWrap:"wrap",children:t.map((e,t)=>O.jsxs(ae,{px:o.space(3),py:o.space(1),borderRadius:o.radius(16),bg:"veryLightBackground",border:"1px solid",borderColor:"primary",fontSize:o.font(11),fontWeight:500,color:"primary",fontFamily:pe,whiteSpace:"nowrap",children:["✓ ",e]},t))}),r&&O.jsx(ae,{as:"button",onClick:r,cursor:"pointer",p:1,borderRadius:"full",opacity:.5,_hover:{opacity:1,bg:"lightBackground"},flexShrink:0,"aria-label":"Close",children:O.jsx(fe,{fontSize:"16px",color:"text",lineHeight:"1",children:"×"})})]}),O.jsxs(ue,{gap:o.space(2),align:"flex-start",children:[O.jsx(ae,{color:"primary",mt:"3px",flexShrink:0,children:O.jsx(Ce,{"aria-hidden":!0})}),O.jsxs(ge,{align:"stretch",gap:o.space(1),children:[O.jsx(fe,{fontSize:o.font(17),fontWeight:700,color:"text",lineHeight:"1.4",fontFamily:pe,children:e.headline}),e.detail&&O.jsx(fe,{fontSize:o.font(12),color:"mutedText",lineHeight:"1.5",fontFamily:pe,children:e.detail})]})]}),O.jsx(je,{value:d,onChange:e=>{u(e.target.value),m&&b(null)},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:s("followUpEmailPlaceholder"),"aria-label":s("followUpEmailPlaceholder"),type:"email",inputMode:"email",autoComplete:"email",fontSize:a?me(o,16):o.font(14),color:"text",bg:"background",borderColor:"border",borderRadius:o.radius(10),height:o.length(40),px:o.space(3),_placeholder:{color:"mutedText"},_focus:{borderColor:"primary",boxShadow:"none"}}),m&&O.jsx(fe,{fontSize:o.font(11),color:"red.500",fontFamily:pe,"data-dori-quiz-signup-error":"",children:m}),O.jsxs("label",{style:{display:"flex",gap:6,alignItems:"flex-start",cursor:"pointer"},children:[O.jsx("input",{type:"checkbox",checked:p,onChange:e=>f(e.target.checked),style:{marginTop:2}}),O.jsxs(fe,{as:"span",fontSize:o.font(11),color:"mutedText",lineHeight:"1.35",fontFamily:pe,children:[s("signupConsent")," ",O.jsx("a",{href:"/policies/privacy-policy",target:"_blank",rel:"noreferrer",style:{textDecoration:"underline"},children:s("followUpPrivacy")})]})]}),O.jsx(ee,{borderRadius:o.radius(24),bg:"primary",color:"buttonText",fontSize:o.font(13),fontWeight:600,height:o.length(40),loading:h,disabled:!p||!d.trim(),onClick:()=>{y()},fontFamily:pe,children:s("signupShowResults")}),O.jsx(ee,{variant:"outline",borderRadius:o.radius(24),borderColor:"border",color:"text",bg:"transparent",fontSize:o.font(13),height:o.length(40),onClick:()=>{x("email_signup_skipped"),n()},disabled:h,fontFamily:pe,_hover:{bg:"veryLightBackground"},"data-dori-quiz-signup-skip":"",children:s("signupSkip")})]})},Vr=({flow:e,onComplete:t,onClose:n})=>{const r=se(),[o,a]=q.useState(0),[i,s]=q.useState([]),[l,c]=q.useState("active"),[d,u]=q.useState(!1),[p,f]=q.useState(!1),[h,g]=q.useState(!1),m=q.useRef(null),b=q.useRef(null),x=q.useRef(null),y=q.useRef(null),v=tn("colors","primary"),w=Re(v);q.useEffect(()=>{if("active"!==l)return;u(!1);const e=requestAnimationFrame(()=>{u(!0)});return()=>cancelAnimationFrame(e)},[o,l]),q.useEffect(()=>()=>{m.current&&clearTimeout(m.current),b.current&&clearTimeout(b.current),x.current&&clearTimeout(x.current),y.current&&clearTimeout(y.current)},[]);const k=q.useCallback(n=>{c("analyzing");const r=800+700*Math.random();x.current=setTimeout(()=>{const r=n.map(e=>e.option.label).join(" · ");let o=e.result_prompt;n.forEach((e,t)=>{const n=`{step${t+1}}`;o=o.split(n).join(e.option.value)});const a=Te(),i=n.map(e=>e.option.label).join(", ");t(r,`${a}[Quiz selections: ${i}] ${o}`)},r)},[e,t]),C=q.useCallback(t=>{if(h)return;g(!0);const n=[...i,{stepIndex:o,option:t}];s(n),o<e.steps.length-1?(u(!1),m.current=setTimeout(()=>{a(e=>e+1),g(!1)},280)):(f(!0),y.current=setTimeout(()=>{f(!1),!e.email_signup||_e()?k(n):c("signup")},300))},[h,i,o,e,k]),j=q.useCallback(()=>{o<=0||p||(u(!1),b.current=setTimeout(()=>{s(e=>e.slice(0,-1)),a(e=>e-1),g(!1)},250))},[o,p]),S=e.steps[o];return"signup"===l&&e.email_signup?O.jsx(Yr,{offer:e.email_signup,selections:i.map(e=>e.option.label),onDone:()=>{We(),k(i)},onClose:n}):"analyzing"===l?O.jsxs(ge,{gap:r.space(3),align:"center",flex:1,justify:"center",transition:"opacity 0.3s ease",children:[O.jsx(ue,{gap:r.space(2),flexWrap:"wrap",justify:"center",children:i.map((e,t)=>O.jsx(Ur,{label:e.option.label},t))}),O.jsxs(ge,{gap:r.space(2),align:"center",py:r.space(4),children:[O.jsx(En,{boxSize:r.length(20),color:"primary",opacity:.6}),O.jsx(fe,{fontSize:r.font(14),fontWeight:500,fontFamily:pe,css:{background:`linear-gradient(90deg, ${v}44, ${v}, ${v}44)`,backgroundSize:"200% 100%",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",animation:"dori-shimmer 1.5s ease-in-out infinite"},children:e.analyzing_text})]}),O.jsx("style",{children:"\n @keyframes dori-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "})]}):O.jsxs(ge,{gap:r.space(4),align:"stretch",flex:1,justify:"start",opacity:p?0:1,transform:p?"translateY(-8px)":"translateY(0)",transition:"opacity 0.3s ease, transform 0.3s ease",children:[i.length>0&&O.jsxs(ue,{gap:r.space(2),flexWrap:"wrap",align:"center",children:[O.jsx(ae,{as:"button",onClick:j,"aria-label":"Back",cursor:"pointer",px:r.space(2),py:r.space(1),borderRadius:r.radius(12),fontSize:r.font(11),color:"primary",opacity:.8,_hover:{opacity:1,bg:"veryLightBackground"},transition:"all 0.15s ease",fontFamily:pe,flexShrink:0,children:"←"}),i.map((e,t)=>O.jsx(Ur,{label:e.option.label},t))]}),O.jsxs(ae,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",children:[O.jsxs(ge,{align:"stretch",gap:r.space(3),mb:r.space(3),children:[O.jsxs(ue,{justify:"space-between",align:"center",gap:r.space(3),children:[O.jsxs(ue,{gap:r.space(2),align:"center",minW:0,children:[O.jsx(ae,{display:"flex",alignItems:"center",justifyContent:"center",boxSize:r.length(24),borderRadius:r.radius(12),bg:"background",border:"1px solid",borderColor:"primary",flexShrink:0,children:O.jsx(En,{boxSize:r.length(12),color:"primary"})}),O.jsx(fe,{fontSize:r.font(11),fontWeight:600,fontFamily:pe,lineHeight:"1.4",css:{background:w,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:e.entry_label})]}),O.jsxs(ue,{gap:r.space(1),align:"center",flexShrink:0,children:[O.jsxs(ae,{px:r.space(2.5),py:r.space(1),borderRadius:r.radius(999),bg:"background",border:"1px solid",borderColor:"primary",fontSize:r.font(10),fontWeight:700,color:"primary",fontFamily:pe,lineHeight:"1",flexShrink:0,children:[o+1,"/",e.steps.length]}),n&&O.jsx(ae,{as:"button",onClick:n,cursor:"pointer",p:1,borderRadius:"full",opacity:.5,_hover:{opacity:1,bg:"lightBackground"},transition:"all 0.15s ease",flexShrink:0,"aria-label":"Close",children:O.jsx(fe,{fontSize:"16px",color:"text",lineHeight:"1",children:"×"})})]})]}),O.jsx(fe,{fontSize:r.font(17),fontWeight:700,color:"text",lineHeight:"1.45",fontFamily:pe,children:S.question}),O.jsx(ae,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:r.radius(16),px:r.space(3),py:r.space(2.5),children:O.jsxs(ue,{gap:r.space(2),align:"start",children:[O.jsx(ae,{boxSize:r.length(7),borderRadius:"full",bg:"primary",mt:r.length(7),flexShrink:0}),O.jsx(fe,{fontSize:r.font(12),color:"mutedText",fontWeight:500,lineHeight:"1.65",fontFamily:pe,opacity:.9,children:S.reason})]})})]}),O.jsx(ae,{display:"grid",gridTemplateColumns:{base:"1fr 1fr"},gap:r.space(2),children:S.options.map((e,t)=>O.jsx(ae,{as:"button",px:r.space(3),py:"8px",borderRadius:r.radius(24),border:"1px solid",borderColor:"primary",bg:"veryLightBackground",cursor:"pointer",textAlign:"start",display:"flex",alignItems:"center",gap:r.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(6px)",transition:`opacity 0.25s ease ${40*t}ms, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) ${40*t}ms, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease`,_hover:{bg:"lightBackground",boxShadow:`0 0 0 1px ${v}33`},_active:{bg:"lightBackground",transform:"translateY(0) scale(0.97)"},onClick:()=>C(e),fontFamily:pe,children:O.jsxs(ae,{flex:"1",minW:0,children:[O.jsx(fe,{fontSize:r.font(13),fontWeight:500,color:"text",lineHeight:"1.4",whiteSpace:"normal",wordBreak:"break-word",children:e.label}),e.subtitle&&O.jsx(fe,{fontSize:r.font(10),color:"mutedText",opacity:.6,lineHeight:"1.2",children:e.subtitle})]})},e.value))})]})]})},Ur=({label:e})=>{const t=se();return O.jsxs(ae,{px:t.space(3),py:t.space(1),borderRadius:t.radius(16),bg:"veryLightBackground",border:"1px solid",borderColor:"primary",fontSize:t.font(11),fontWeight:500,color:"primary",fontFamily:pe,whiteSpace:"nowrap",children:["✓ ",e]})},Zr=({chips:e,onChipClick:t,onDismiss:n})=>{const r=se(),[o,a]=q.useState(!1);return q.useEffect(()=>{const e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)},[]),0===e.length?null:O.jsx(ae,{flexShrink:0,opacity:o?1:0,transform:o?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)","data-dori-nudge":"chip-row",children:O.jsxs(ue,{gap:r.space(2),wrap:"wrap",align:"center",children:[e.map((e,n)=>O.jsx(ee,{size:"sm",variant:"outline",borderRadius:r.radius(20),borderWidth:"1.5px",borderColor:"primary",bg:"veryLightBackground",color:"text",fontSize:r.font(13),fontWeight:500,px:r.space(3),py:r.space(1.5),height:"auto",whiteSpace:"normal",wordBreak:"break-word",textAlign:"start",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},onClick:()=>t(e),fontFamily:pe,children:e},`${n}-${e}`)),O.jsx(fn,{size:"xs",borderRadius:"full",bg:"transparent","aria-label":"Dismiss nudge",color:"mutedText",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},minW:r.length(22),w:r.length(22),h:r.length(22),p:r.space(0),flexShrink:0,onClick:n,opacity:.6,children:O.jsx(wn,{boxSize:r.length(11)})})]})})};const Kr=({onStartChat:e,isMobile:t,isExpanded:n=!1,onToggleExpand:r,fullPageHref:o,onClose:a})=>{const{inputValue:i,handleInputChange:c}=((e="")=>{const[t,n]=q.useState(e),r=q.useCallback(e=>{n(e)},[]),o=q.useCallback(e=>{t.trim()&&e&&(e(t.trim()),n(""))},[t]),a=q.useCallback((e,t)=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),o(t))},[o]),i=q.useCallback(()=>{n("")},[]),s=q.useCallback(e=>{n(e)},[]);return{inputValue:t,setInputValue:n,handleInputChange:r,handleSubmit:o,handleKeyPress:a,clearInput:i,setInput:s}})(),{botData:d,effectiveSuggestedReplies:u}=ie(),p=se(),f=Ie(t?1:Le(d).width),{t:h,translations:g}=le(),m=s(d,g),b=tn("colors","primary"),x=Re(b),y=u,v=!1,w=q.useMemo(()=>y.slice(0,4),[y]),[k,C]=Me();q.useMemo(()=>y.slice(0,2),[y]);const j=({message:t,imageUrl:n})=>{(t.trim()||n)&&e(t.trim(),n)},S=!0===d?.feature_flags?.greeting_one_line,z=q.useRef(null),E=function(e,t,n,r,o){const[a,i]=q.useState(n);return q.useLayoutEffect(()=>{if(!t)return void i(n);const o=e.current,a=o?.parentElement;if(!o||!a)return;const s=()=>{const e=o.style.fontSize;o.style.fontSize=`${n}px`;const t=o.scrollWidth;o.style.fontSize=e,i(function(e,t,n,r){if(!(e>0&&t>e))return n;const o=Math.floor(n*(e/t)*.99);return Math.max(r,Math.min(n,o))}(a.clientWidth,t,n,r))};if(s(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(s);return l.observe(a),()=>l.disconnect()},[e,t,n,r,o]),a}(z,S,parseFloat(p.isMini?p.font(24):`${f.greetingFontPx}px`),14,m||""),A=!0===d?.feature_flags?.composer_at_bottom,R=O.jsx(ae,{children:O.jsx(Qn,{state:"minimized",placeholder:h("askAnything"),value:i,onChange:c,onSend:j})});return O.jsxs(O.Fragment,{children:[O.jsx(Pn,{onClose:a,isMobile:t,isExpanded:n,onToggleExpand:r,fullPageHref:o}),O.jsxs(ge,{h:"full",minH:0,justify:"flex-start",align:"stretch",gap:p.space(f.sectionGap),children:[m&&O.jsx(ge,{gap:p.space(3),w:"full",align:"start",mb:p.length(f.greetingGapPx),flexShrink:0,children:O.jsx(fe,{ref:z,fontWeight:n?600:500,fontStyle:"normal",fontSize:S?`${E}px`:p.isMini?p.font(24):`${f.greetingFontPx}px`,whiteSpace:S?"nowrap":void 0,letterSpacing:"0",textAlign:n?"center":"right",fontFamily:pe,css:{background:x,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:m})}),O.jsx(ae,{flex:1,minH:0,overflowY:"auto",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:O.jsxs(ge,{gap:p.space(4),align:"stretch",justify:"start",pb:p.space(3),children:[!A&&R,k&&O.jsx(Zr,{chips:[k],onChipClick:t=>{l("offer_guide_chat_opened",{from:"opening"}),C(),Fe(t).then(n=>e(t,void 0,n))},onDismiss:()=>{Be(),C()}}),v,v,w.length>0&&O.jsx(ae,{w:"full",children:O.jsx(ae,{display:"grid",gridTemplateColumns:{base:"1fr",md:f.starterColumns},gap:p.space(3),w:"full",children:w.map((e,t)=>O.jsxs(ee,{variant:"outline",borderRadius:p.radius(24),border:"1px solid",borderColor:"borderColor",bg:"lightBackground",color:"text",fontSize:p.font(14),fontWeight:400,padding:"8px 12px",_hover:{bg:"veryLightBackground",borderColor:"borderColor"},onClick:()=>(e=>{j({message:e,imageUrl:void 0})})(e),justifyContent:"start",w:"full",height:"auto",lineHeight:"1.5",whiteSpace:"pre-wrap",children:[O.jsx(En,{boxSize:p.length(16),color:"text"}),O.jsx(ae,{as:"span",flex:"1",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"break-word",fontFamily:pe,children:e})]},t))})})]})}),O.jsx(ae,{w:"full",flexShrink:0,children:O.jsx(Nr,{channels:d?.merchant_support_channels})}),A&&O.jsx(ae,{w:"full",flexShrink:0,children:R}),O.jsx(ae,{flexShrink:0,transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:O.jsx(rr,{variant:"default"})})]})]})},Qr=({message:e,type:t="default"})=>{const n="loading"===t,{botData:r}=ie(),o=se(),a=e.replace(/\\([!?.,'":;\-\[\](){}#*_~`>+])/g,"$1"),i=r?.agent_image||Hn,s=ce(i),l=he(s.ratio),c=n?a.replace(/[.\u2026]{1,3}\s*$/u,"").trim():a;return O.jsxs(ae,{position:"relative",width:"full",children:[O.jsx(ae,{opacity:"0",bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),children:O.jsx(fe,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),fontFamily:pe,children:a})}),O.jsx(ae,{h:o.length(50)}),O.jsx(ae,{position:"absolute",left:0,bottom:0,children:O.jsx(de,{src:i,alt:"",role:"presentation",onLoad:s.onLoad,w:o.length(24),h:o.length(24),borderRadius:"50%",objectFit:l?"contain":"cover",...l?{p:"2px",bg:"background",border:"1px solid",borderColor:"borderColor"}:{}})}),O.jsx(ae,{position:"absolute",left:o.length(21),bottom:o.length(21),width:o.length(7.68),height:o.length(7.68),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),O.jsx(ae,{position:"absolute",left:o.length(27),bottom:o.length(27),width:o.length(15.8),height:o.length(15.8),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),O.jsx(ae,{position:"absolute",left:o.length(35),bottom:o.length(35),bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:n?O.jsxs(ue,{gap:o.length(8),align:"center",children:[c&&O.jsx(fe,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"mutedText",fontFamily:pe,children:c}),O.jsx(ue,{gap:o.length(3),align:"center","aria-hidden":"true",children:[0,1,2].map(e=>O.jsx(ae,{w:o.length(4),h:o.length(4),borderRadius:"full",bg:"mutedText",css:{animation:`dori-typing-dot 1.2s ease-in-out ${.15*e}s infinite`}},e))}),O.jsx("style",{children:"\n @keyframes dori-typing-dot {\n 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n }\n "})]}):O.jsx(fe,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"text",fontFamily:pe,children:a})})]})};function Gr(e,t){t?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}function Xr(e,t){let n=-1;const r=()=>{const r=e.getBoundingClientRect();n=r.width,t(function(e){const t={bgColor:null,transform:null};try{const n=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!n||!r)return t;const o=Math.min(1,256/Math.max(n,r)),a=Math.max(1,Math.round(n*o)),i=Math.max(1,Math.round(r*o)),s=document.createElement("canvas"),l=s.getContext("2d",{willReadFrequently:!0});if(!l)return t;s.width=a,s.height=i,l.drawImage(e,0,0,a,i);const{data:c}=l.getImageData(0,0,a,i),d=(e,t)=>{const n=4*(t*a+e);return[c[n],c[n+1],c[n+2],c[n+3]]},u=[d(0,0),d(a-1,0),d(0,i-1),d(a-1,i-1)].filter(([,,,e])=>e>=128),p=0===u.length;let f=null,h=null;if(!p){const e=new Map;for(const t of u){const n=`${t[0]},${t[1]},${t[2]}`,r=e.get(n);r?r.n+=1:e.set(n,{c:t,n:1})}f=Array.from(e.values()).sort((e,t)=>t.n-e.n)[0].c,h=`rgb(${f[0]}, ${f[1]}, ${f[2]})`}const g=Math.max(1,Math.floor(Math.max(a,i)/160)),m=(e,t)=>{const[n,r,o,a]=d(e,t);if(a<128)return!1;if(p)return!0;if(!f)return!1;const i=n-f[0],s=r-f[1],l=o-f[2];return Math.sqrt(i*i+s*s+l*l)>30};let b=a,x=i,y=-1,v=-1;for(let e=0;e<i;e+=g)for(let t=0;t<a;t+=g)m(t,e)&&(t<b&&(b=t),t>y&&(y=t),e<x&&(x=e),e>v&&(v=e));if(y<0||v<0)return{bgColor:h,transform:null};const w=(y-b+g)/a,k=(v-x+g)/i;if(Math.max(w,k)>.8)return{bgColor:h,transform:null};const C=e.getBoundingClientRect();if(!C.width||!C.height)return{bgColor:h,transform:null};const j=Math.min(C.width/n,C.height/r),S=Math.max(w*n*j/C.width,k*r*j/C.height);if(!S)return{bgColor:h,transform:null};const z=Math.min(2.2,.88/S);if(z<1.06)return{bgColor:h,transform:null};const E=-((x+(v-x+g)/2)/i-.5)*r*j*z;return{bgColor:h,transform:`translate(${(-((b+(y-b+g)/2)/a-.5)*n*j*z).toFixed(1)}px, ${E.toFixed(1)}px) scale(${z.toFixed(3)})`}}catch{return t}}(e))},o=()=>r();e.complete&&e.naturalWidth>0?r():e.addEventListener("load",o);const a="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{const o=t[0]?.contentRect?.width??0;o>0&&Math.abs(o-n)>8&&e.complete&&e.naturalWidth>0&&r()}):null;return a?.observe(e),()=>{e.removeEventListener("load",o),a?.disconnect()}}const Jr={black:"#222222",white:"#ffffff",offwhite:"#f3efe7","off-white":"#f3efe7",ivory:"#f4f0e1",cream:"#f3ead3",natural:"#e8ded0",beige:"#d9c7a8",tan:"#cba36b",taupe:"#9b8978",camel:"#bd9a6a",khaki:"#a39a6a",sand:"#d8c19a",stone:"#cabfa9",nude:"#e3c4a8",gray:"#808080",grey:"#808080",charcoal:"#3a3d40",slate:"#5a6470",graphite:"#4a4a4a",silver:"#c4c4c4",ash:"#b2b2b2",smoke:"#8c8c8c",pewter:"#9a9a94",gunmetal:"#53565a",red:"#c8302b",crimson:"#a31f34",scarlet:"#c4302a",cherry:"#a31330",ruby:"#9b1b30",wine:"#5e1f2b",burgundy:"#5b1a26",bordeaux:"#4e1822",maroon:"#6b1f2a",brick:"#9c4a3a",terracotta:"#c46a4a",rust:"#9e4a2e",coral:"#e36a52",salmon:"#e69079",punch:"#d83a5e",pink:"#e58aab",rose:"#d98ca0",blush:"#e8c0c4",magenta:"#b8336a",fuchsia:"#c2407e",orange:"#e08234",pumpkin:"#e07b39",apricot:"#e7a473",peach:"#f0b48f",amber:"#c98a2b",mustard:"#c9962f",gold:"#c9a227",honey:"#d7a13a",sunshine:"#f4c842",yellow:"#e8c63a",lemon:"#e7d44a",canary:"#e6d24a",brown:"#6b4a2e",chocolate:"#4f3422",coffee:"#5a4334",mocha:"#7a5a44",caramel:"#a9743f",chestnut:"#6e3f2a",walnut:"#5a4031",espresso:"#3a2a21",bronze:"#7d5a33",copper:"#a35d3a",clay:"#a86a4f",green:"#3f7a3f",forest:"#2c4a2c",olive:"#6b6a35",sage:"#9aa583",moss:"#5e6b3a",mint:"#8fd0b0",emerald:"#1f8a5a",jade:"#3a9b78",lime:"#9bc24a","olive green":"#6b6a35",leaf:"#5a8a3a",blue:"#2f5fa8",navy:"#27314f",cobalt:"#2a4d9b",azure:"#3a8fd0",sky:"#86b8e0",denim:"#46688f",sapphire:"#1f4e8c",marine:"#27506b",ocean:"#1f6e8c",teal:"#1d8a85",turquoise:"#3fb7b0",aqua:"#5fc7c0",cyan:"#3bb6c4",periwinkle:"#8a9cd8",indigo:"#3a3a7a",purple:"#6f4a8e",violet:"#7a4ba0",plum:"#6e3a5e",grape:"#6f4a8e",eggplant:"#4b2e57",aubergine:"#4b2e57",amethyst:"#8a6aa0",lavender:"#b9a7d6",lilac:"#c4a8d6",mauve:"#a07a8a",seafoam:"#8fcab0",sangria:"#7a1f2b",midnight:"#1f2540",onyx:"#2a2a2a",ebony:"#2b2622",jet:"#2a2a2a",pearl:"#f0ead9",snow:"#fafafa",heather:"#9a8fa0",oat:"#dcceb4",fog:"#cfd2cf",berry:"#8a2f4a",rosso:"#c8302b",rojo:"#c8302b",rouge:"#c8302b",rot:"#c8302b",vermelho:"#c8302b",blu:"#2f5fa8",azul:"#2f5fa8",bleu:"#2f5fa8",blau:"#2f5fa8",azzurro:"#3a8fd0",verde:"#3f7a3f",vert:"#3f7a3f","grün":"#3f7a3f",gruen:"#3f7a3f",nero:"#222222",negro:"#222222",noir:"#222222",schwarz:"#222222",preto:"#222222",bianco:"#ffffff",blanco:"#ffffff",blanc:"#ffffff","weiß":"#ffffff",weiss:"#ffffff",branco:"#ffffff",giallo:"#e8c63a",amarillo:"#e8c63a",jaune:"#e8c63a",gelb:"#e8c63a",grigio:"#808080",gris:"#808080",grau:"#808080",marrone:"#6b4a2e","marrón":"#6b4a2e",marron:"#6b4a2e",braun:"#6b4a2e",viola:"#7a4ba0",morado:"#7a4ba0",lila:"#c4a8d6",arancione:"#e08234",naranja:"#e08234"},$r=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function eo(e,t){return t&&$r.test(t)?t:function(e){if(!e)return null;const t=e.trim().toLowerCase();if(Jr[t])return Jr[t];for(const n of t.split(/[\s/_,&+().-]+/))if(n&&Jr[n])return Jr[n];return null}(e)}function to(e,t,n,r,o){for(const a of e?.options??[])if(a.position===n)for(const e of a.values){if(!e.swatch||!e.swatch_variant)continue;const r=t.find(t=>String(t.id)===e.swatch_variant);if(r&&De(r,n)===o)return e.swatch}return e?.options?.find(e=>e.name===r)?.values.find(e=>e.value===o)?.swatch??null}function no(e){return!!e?.values.some(e=>e.swatch)}const ro=/colo|couleur|farbe|màu|colore|kleur/i,oo=({product:e,selectedColor:t=null,onColorChange:n,showQuantity:r=!1,onAdded:o,controlled:a=!1,onSelectionChange:i,onLiveLoaded:s})=>{const l=se(),{addToCartDirect:c,botData:d,isTestMode:u}=ie(),{t:p}=le(),f=e.variant_summary,[h,g]=q.useState(null),[m,b]=q.useState(!1),x=q.useRef(s);x.current=s;const[y,v]=q.useState({}),[w,k]=q.useState("idle"),[C,j]=q.useState(null),[S,z]=q.useState(1);q.useEffect(()=>{let t=!1;const n=He(e.url);if(n)return Pe(n).then(e=>{!t&&e&&e.variants?.length&&(g(e),b(!0),x.current?.(e))}).catch(()=>{}),()=>{t=!0}},[e.url]);const E=(e.currency||d?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",A=q.useMemo(()=>h?qe(h):[],[h]),R=q.useMemo(()=>m&&h?A.map((e,t)=>{const n=ro.test(e.name)||function(e,t){return!!e?.options?.some(e=>e.position===t&&no(e))}(f,t+1),r=e.values.map(r=>{let o=null;if(n){const e=h.variants.find(e=>De(e,t+1)===r&&e.featured_image?.src);o=e?.featured_image?.src??null}return{value:r,image:o,swatch:n?to(f,h.variants,t+1,e.name,r):null}}),o=n&&new Set(r.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:n,useImages:o,values:r}}).filter(e=>e.values.length>1):(f?.options??[]).map(e=>{const t=ro.test(e.name)||no(e),n=e.values.map(e=>({value:e.value,image:e.image,swatch:e.swatch})),r=t&&new Set(n.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:t,useImages:r,values:n}}),[m,h,A,f]),T=R.findIndex(e=>e.isColor),_=q.useRef(null);q.useEffect(()=>{if(t===_.current)return;if(_.current=t??null,null==t||T<0)return;const e=R[T]?.name;e&&v(n=>{if(n[e]===t)return n;const r={};for(let e=0;e<T;e++){const t=R[e].name;n[t]&&(r[t]=n[t])}r[e]=t;for(let e=T+1;e<R.length;e++){const t=R[e],o=n[t.name];o&&((!m||!h||Oe(h,{...r,[t.name]:o}).some(e=>!1!==e.available))&&(r[t.name]=o))}return r})},[t,T,R,m,h]);const W=q.useRef(!1),I=e=>{const t=R.find(t=>t.name===e);return!!t&&(t.isColor||1===t.values.length)};q.useEffect(()=>{if(!a||W.current||0===R.length)return;if(Object.keys(y).length>0)return void(W.current=!0);const e=R.find(e=>e.isColor),r=t=>{e&&t[e.name]&&n?.(t[e.name])},o=e&&t&&e.values.some(e=>e.value===t)?t:null;if(m&&h){const t=e?A.findIndex(t=>t.name===e.name)+1:0,n=o&&h.variants.find(e=>!1!==e.available&&De(e,t)===o)||h.variants.find(e=>!1!==e.available),a={};return n&&A.forEach((e,t)=>{const r=De(n,t+1);r&&I(e.name)&&(a[e.name]=r)}),W.current=!0,void(Object.keys(a).length&&(v(a),r(a)))}const i={};for(const t of R){if(!I(t.name))continue;const e=f?.options.find(e=>e.name===t.name)?.values??[],n=t=>{const n=e.find(e=>e.value===t);return!n||!1!==n.available},r=t.isColor&&o&&n(o)?{value:o}:t.values.find(e=>n(e.value));r&&(i[t.name]=r.value)}W.current=!0,Object.keys(i).length&&(v(i),r(i))},[a,m,h,R,A]);const L=R.every(e=>y[e.name]),M=q.useMemo(()=>m&&h&&L?Oe(h,y).find(e=>!1!==e.available)??null:null,[m,h,L,y]),B=L&&!(m&&h&&!M),F=R.map(e=>y[e.name]).filter(Boolean).join(" · ");q.useEffect(()=>{a&&i?.({allChosen:L,canAdd:B,variantId:M?String(M.id):null,priceCents:M?.price??null,selectedLabel:F,selectedOptions:y})},[a,L,B,M,F,y]);const D=r&&null!=M?.price?Ne(M.price/100*S,E):null,H=null!=M?.price?` · ${Ne(M.price/100,E)}`:"",P=Ye(l),N=(e,t,r)=>{const o=((e,t)=>{const n=R[e];if(m&&h){const r={[n.name]:t};for(let t=0;t<e;t++){const e=y[R[t].name];e&&(r[R[t].name]=e)}return Oe(h,r).some(e=>!1!==e.available)}const r=f?.options.find(e=>e.name===n.name)?.values.find(e=>e.value===t);return!r||!1!==r.available})(e,r.value),i=y[t.name]===r.value,s=t.isColor?eo(r.value,r.swatch):null,c={as:"button",type:"button",disabled:!o,"aria-pressed":i,"aria-label":r.value,title:r.value,onClick:()=>o&&((e,t)=>{const r=R[e].name,o=y[r]===t;v(n=>{const a={};for(let t=0;t<e;t++){const e=R[t].name;n[e]&&(a[e]=n[e])}return o||(a[r]=t),a}),!o&&R[e]?.isColor&&n?.(t),"added"!==w&&"error"!==w||(k("idle"),j(null))})(e,r.value),cursor:o?"pointer":"not-allowed",opacity:o?1:.35,style:{appearance:"none",WebkitAppearance:"none"}},d=a?`${P.image}px`:l.length(40),u=a?`${P.dot}px`:l.length(26);return t.useImages&&r.image?O.jsx(ae,{...c,position:"relative",p:l.space(0),w:d,h:d,borderRadius:l.radius(10),overflow:"hidden",border:i?"3px solid":"2px solid",borderColor:i?"primary":"borderColor",boxShadow:i?"0 0 0 2px var(--chakra-colors-veryLightBackground)":void 0,backgroundImage:`url(${r.image})`,backgroundSize:"cover",backgroundPosition:"center",flexShrink:0,children:!o&&O.jsx(ae,{position:"absolute",top:"50%",left:"-4px",right:"-4px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):s?O.jsx(ae,{...c,position:"relative",p:l.space(0),w:u,h:u,borderRadius:"full",bg:s,border:i?"3px solid":"2px solid",borderColor:i?"primary":"transparent",boxShadow:i?"0 0 0 2px var(--chakra-colors-background)":"inset 0 0 0 0.5px rgba(0,0,0,0.2)",flexShrink:0,children:!o&&O.jsx(ae,{position:"absolute",top:"50%",left:"-2px",right:"-2px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):O.jsx(ae,{...c,px:l.space(2.5),py:l.space(1),minH:a?`${P.minH}px`:void 0,display:a?"flex":"inline-flex",alignItems:"center",justifyContent:"center",minW:0,borderRadius:l.radius(8),border:i?"2px solid":"1px solid",borderColor:i?"primary":"borderColor",bg:i?"primary":"background",children:O.jsx(fe,{fontSize:a?`${P.font}px`:l.font(12),overflow:"hidden",textOverflow:"ellipsis",fontWeight:i?600:400,color:i?"white":"text",textDecoration:o?"none":"line-through",whiteSpace:"nowrap",fontFamily:pe,children:r.value})},r.value)},Y=R.map((e,t)=>O.jsxs(ae,{children:[O.jsxs(fe,{fontSize:a?l.font(12):l.font(11),color:"mutedText",mb:l.space(1.5),fontFamily:pe,children:[e.name,y[e.name]?O.jsx(fe,{as:"span",color:"primary",fontWeight:600,children:` · ${y[e.name]}`}):""]}),!a||e.useImages||e.isColor?O.jsx(ue,{gap:l.space(a?P.gap:1.5),wrap:"wrap",children:e.values.map(n=>N(t,e,n))}):O.jsx(ae,{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${P.minWidth}px, 1fr))`,gap:l.space(P.gap),children:e.values.map(n=>N(t,e,n))})]},e.name));return a?O.jsx(ge,{align:"stretch",gap:l.space(3),w:"full",pt:l.space(1),children:Y}):O.jsxs(ge,{align:"stretch",gap:l.space(2),w:"full",pt:l.space(1),children:[Y,r&&O.jsxs(ue,{justify:"space-between",align:"center",children:[O.jsx(fe,{fontSize:l.font(12),fontWeight:500,color:"text",fontFamily:pe,children:p("quantity")}),O.jsxs(ue,{gap:l.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:l.radius(8),overflow:"hidden",children:[O.jsx(ee,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:S<=1?"mutedText":"text",disabled:S<=1||"adding"===w,onClick:()=>z(e=>Math.max(1,e-1)),"aria-label":p("decreaseQuantity"),children:"−"}),O.jsx(fe,{fontSize:l.font(13),fontWeight:600,minW:l.length(28),textAlign:"center",color:"text",fontFamily:pe,children:S}),O.jsx(ee,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:S>=10?"mutedText":"text",disabled:S>=10||"adding"===w,onClick:()=>z(e=>Math.min(10,e+1)),"aria-label":p("increaseQuantity"),children:"+"})]})]}),O.jsxs(ee,{size:"sm",h:l.length(34),borderRadius:l.radius(8),fontSize:l.font(12),fontWeight:500,bg:"primary",color:"buttonText",gap:l.space(1.5),w:"full",disabled:!L||"adding"===w,loading:"adding"===w,onClick:async()=>{if(!L||"adding"===w)return;if(m&&h&&!M)return k("error"),void j(null);k("adding"),j(null);const t=r?S:1,n=null!=e.id?String(e.id):void 0,a=M?{variant_id:String(M.id),product_id:n,product_name:e.name,quantity:t}:{product_id:n,product_name:e.name,product_url:e.url,selected_options:y,quantity:t},i=Ve(e,d);if(i)return void Gr(i.href,u);const s=await c(a);"success"===s.type?(k("added"),o?.({selectedLabel:F,quantity:t})):(k("error"),j(Ue(s,p)||null))},_hover:{opacity:.92},fontFamily:pe,children:[O.jsx(In,{boxSize:l.length(14)}),"added"===w?`✓ ${p("addedToCart")}`:L?D&&L?p("addQty").replace("{qty}",String(S)).replace("{price}",D):p("addToCartButton")+(F?` · ${F}`:"")+H:p("selectOptionsToContinue")]}),"error"===w&&O.jsx(fe,{fontSize:l.font(11),color:"error",fontFamily:pe,children:C||p("errorOccurred")})]})},ao=({src:e,alt:t,height:n,fallbackBg:r,onClick:o})=>{const{ref:a,bgColor:i,transform:s}=function(e){const t=q.useRef(null),[n,r]=q.useState({bgColor:null,transform:null});return q.useEffect(()=>{r({bgColor:null,transform:null});const n=t.current;if(n&&e)return Xr(n,r)},[e]),{ref:t,...n}}(e);return O.jsx(ae,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},bg:i||r,borderRadius:"md",overflow:"hidden",cursor:o?"pointer":"default",onClick:o,children:O.jsx(de,{ref:a,src:e,alt:t,w:"full",h:n,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:s??void 0,transition:"transform 0.25s ease"})})},io=({slides:e,activeColor:t,onColorChange:n,height:r,bgColor:o,alt:a,onImageClick:i})=>{const s=se(),l=q.useRef(null),c=q.useRef(!1),d=q.useRef(!1),u=q.useRef(null),[p,f]=q.useState(0),h=q.useRef(t);h.current=t;const g=q.useRef(e);g.current=e;const m=q.useRef(n);m.current=n;const b=q.useRef(p);b.current=p;const x=e=>{null!=e?.color&&e.color!==h.current&&m.current?.(e.color)},y=(e,t)=>{const n=l.current,r=g.current[e];n&&r&&(c.current=!0,n.scrollTo({left:e*n.clientWidth,behavior:"smooth"}),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{c.current=!1},450),f(e),t&&x(r))},v=q.useRef(y);v.current=y;const w=q.useRef(t??null);q.useEffect(()=>{if(t===w.current)return;if(w.current=t??null,null==t||d.current)return;const n=e.findIndex(e=>e.color===t);n<0||n===b.current||v.current(n,!1)},[t,e]);const k=e.map(e=>e.id+"\0"+e.src).join("|"),C=q.useRef(null);q.useEffect(()=>{if(C.current===k)return;C.current=k;const e=l.current,t=g.current.findIndex(e=>null!=e.color&&e.color===h.current),n=Math.max(0,t);e&&e.clientWidth>0&&e.scrollTo({left:n*e.clientWidth}),f(n)},[k]),q.useEffect(()=>{const e=l.current;if(!e)return;let t;const n=()=>{if(c.current||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth),n=g.current[t];n&&(f(t),x(n))},r=()=>{c.current||(d.current=!0,t&&window.clearTimeout(t),t=window.setTimeout(()=>{d.current=!1,n()},160))},o=()=>{t&&window.clearTimeout(t),d.current=!1,n()},a=t=>{if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;t.preventDefault();let n=e.parentElement;for(;n;){const e=getComputedStyle(n).overflowY;if(n.scrollHeight>n.clientHeight&&("auto"===e||"scroll"===e))return void n.scrollBy({top:t.deltaY});n=n.parentElement}window.scrollBy({top:t.deltaY})};return e.addEventListener("scroll",r,{passive:!0}),e.addEventListener("scrollend",o),e.addEventListener("wheel",a,{passive:!1}),()=>{e.removeEventListener("scroll",r),e.removeEventListener("scrollend",o),e.removeEventListener("wheel",a),t&&window.clearTimeout(t)}},[]),q.useEffect(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const j=e=>O.jsx(fn,{"aria-label":e<0?"Previous image":"Next image",position:"absolute",top:"50%",...e<0?{left:"6px"}:{right:"6px"},transform:"translateY(-50%)",size:"xs",minW:s.length(28),w:s.length(28),h:s.length(28),borderRadius:"full",bg:"rgba(255,255,255,0.92)",color:"text",border:"1px solid",borderColor:"borderColor",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",_hover:{bg:"white"},onClick:t=>{t.stopPropagation(),y(p+e,!0)},children:e<0?O.jsx(_n,{boxSize:s.length(12)}):O.jsx(Bn,{boxSize:s.length(12)})});return O.jsxs(ae,{position:"relative",w:"full",dir:"ltr",children:[O.jsx(ue,{ref:l,gap:0,w:"full",css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map((e,t)=>O.jsx(ao,{src:e.src,alt:a,height:r,fallbackBg:o,onClick:i?()=>i(t):void 0},e.id))}),e.length>1&&p>0&&j(-1),e.length>1&&p<e.length-1&&j(1),e.length>1&&O.jsx(ue,{position:"absolute",bottom:s.length(6),left:"0",right:"0",justify:"center",gap:1,pointerEvents:"none",children:e.map((e,t)=>O.jsx(ae,{w:s.length(5),h:s.length(5),borderRadius:"full",bg:t===p?"primary":"rgba(0,0,0,0.25)",transition:"background 0.2s"},`dot-${e.id}`))})]})},so=/colo|couleur|farbe|màu|colore|kleur/i,lo=({product:e,isDesktop:t=!1,variant:r="default",badgeLabel:o,hideCta:a=!1})=>{const i="hero"===r,s="compact"===r,l=s?80:130,{sendMessage:p,setRepliedProduct:f,botData:h,chatState:g,addToCartDirect:m,isCartBusy:b,productFocusEnabled:x,shortlistEnabled:y,enterFocusMode:v,openVariantModal:w,isShortlisted:k,toggleShortlist:C,rememberCardColour:j,isTestMode:S}=ie(),z=se(),E=i?z.length(160):s?z.length(80):z.length(124),{t:A}=le(),R=(e?.currency||h?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",{name:T,price:_,originalPrice:W,discount:I,image:L,id:M,url:B}=e,F=n(h),D="full",H=Ve(e,h),P=null!==H,N=Boolean(e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=_&&e.sale_price<_),Y=N&&e.sale_price?e.sale_price:_,V=N?_:W,U=N&&null!=e.sale_percent_off&&e.sale_percent_off>0?e.sale_percent_off:I,Z=N&&null!=e.sale_amount_off&&e.sale_amount_off>0?e.sale_amount_off:void 0,K=!!V&&!!Y&&V>Y,Q=N?e.sale_label:void 0,G=e.minimum_quantity&&e.minimum_quantity>1?Math.floor(e.minimum_quantity):void 0,[X,J]=q.useState(!1),[$,te]=q.useState(!1),[ne,re]=q.useState(!1),[oe,ce]=q.useState(!1),he=q.useRef(null);q.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const[me,be]=q.useState(!1),xe=(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),ye=tn("colors","background"),ve=Array.isArray(ye)?ye[0]:ye,[we,ke]=q.useState(ve),Ce=!0===h?.feature_flags?.disable_image_backdrop?ve:we,[je,Se]=q.useState(null),ze=q.useRef(null),[Ee,Ae]=q.useState(e.selected_color??null);q.useEffect(()=>{null!=M&&j(String(M),Ee)},[M,Ee,j]);const Re=q.useMemo(()=>{const t=e.variant_summary?.options?.find(e=>so.test(e.name||""));return!s&&t&&L&&t.values.some(e=>e.image)?t.values.map(e=>({id:`color:${e.value}`,src:e.image||L,color:e.value})):[]},[e.variant_summary,L,s]),Te=Re.length>1,_e=e.description?.length&&e.description?.length>l;q.useEffect(()=>{const e=ze.current;if(e)return Xr(e,e=>{ke(e.bgColor??ve),Se(e.transform)})},[L,ve]);const We=async()=>{if(H)return void Gr(H.href,S);if(ne)return;re(!0);const t=He(B);try{const n=await m({product_id:null!=M?String(M):void 0,product_name:T,product_url:B||void 0,product_handle:t||void 0,quantity:u(e),quantity_label:d(e)});if("success"===n.type&&(ce(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(()=>ce(!1),1600)),"failed"===n.type&&"busy"===n.reason)return;if("success"!==n.type){const n=A("addToCartMessage").replace("{product}",T),r=`DORI_INTERNAL_EVENT:add_to_cart_request:${JSON.stringify({product_name:T,product_url:B||null,product_handle:t||null,quantity:e.price_unit?1:G??1})}`;await p({message:n,apiMessage:r})}}finally{re(!1)}},Ie=ne||b,Le=xe&&me,Me=k(M),[Be,Fe]=q.useState(!1),De=q.useRef(null);q.useEffect(()=>()=>{De.current&&clearTimeout(De.current)},[]);const Pe=x?()=>v(e,`card_body:${r}`):async()=>{if(!B||!h)return;const t=Gn(B);c(e,h,g.threadId),Gr(t,S)},qe=e=>{e.stopPropagation(),H&&Gr(H.href,S)},Oe=t=>{t.stopPropagation(),P?qe(t):xe?w(Ee?{...e,selected_color:Ee}:e,"card"):We()};return O.jsxs(ge,{gap:z.space(1),children:[O.jsx(ae,{bg:"background",borderRadius:s?z.radius(12):z.radius(16),border:"1px solid",borderColor:i?"primary":"borderColor",borderWidth:i?"1.5px":"1px",p:z.space(s?1.5:2),w:"full",transition:"all 0.2s ease",_hover:{borderColor:"primary",transform:"translateY(-1px)"},children:O.jsxs(ge,{gap:z.space(s?1.5:2),align:"stretch",children:[O.jsxs(ae,{position:"relative",borderRadius:"md",children:[y&&!s&&O.jsx(fn,{"aria-label":A(Me?"removeSaved":"saveForLater"),position:"absolute",top:z.length(6),right:z.length(6),zIndex:2,variant:"ghost",size:"xs",minW:z.length(26),w:z.length(26),h:z.length(26),p:z.space(0),borderRadius:"full",bg:"background",_hover:{bg:"background"},boxShadow:"0 1px 4px rgba(0,0,0,0.18)",color:Me?"primary":"mutedText",transform:Be?"scale(1.2)":"scale(1)",transition:"transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:t=>{t.stopPropagation(),C(e),Fe(!0),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>Fe(!1),220)},children:Me?O.jsx(Mn,{boxSize:z.length(14)}):O.jsx(Ln,{boxSize:z.length(14)})}),i&&o&&O.jsx(ae,{position:"absolute",top:z.length(6),left:z.length(6),zIndex:1,bg:"primary",color:"buttonText",fontSize:z.font(10),fontWeight:"600",px:z.space(2),py:z.space(.5),borderRadius:z.radius(6),fontFamily:pe,boxShadow:"0 1px 3px rgba(0,0,0,0.15)",children:o}),Te?O.jsx(io,{slides:Re,activeColor:Ee,onColorChange:Ae,height:E,bgColor:Ce,alt:T,onImageClick:Pe}):O.jsx(ae,{cursor:"pointer",onClick:Pe,_hover:{opacity:.9},transition:"all 0.3s ease",bg:Ce,borderRadius:"md",overflow:"hidden",children:$?O.jsx(ae,{w:"full",h:E,display:"flex",alignItems:"center",justifyContent:"center",bg:"lightBackground",borderRadius:"md",children:O.jsx(In,{boxSize:z.length(24),color:"mutedText"})}):O.jsx(de,{ref:ze,src:L,alt:T,w:"full",h:E,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:je??void 0,transition:"transform 0.25s ease",onError:()=>te(!0)})})]}),O.jsx(ue,{gap:z.space(1),align:"center",w:"full",children:O.jsx(fe,{fontWeight:600,fontSize:s?z.font(11):z.font(12),lineHeight:s?z.lineHeight(18):z.lineHeight(24),color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1,minW:0,title:T,fontFamily:pe,cursor:"pointer",onClick:Pe,...x&&{role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Pe())},"aria-label":A("selectedProduct").replace("{name}",T)},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"2px",borderRadius:"4px"},transition:"color 0.2s",children:T})}),!s&&e.description&&O.jsx(ae,{borderRadius:z.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",padding:"6px 10px",w:"full",bg:"lightBackground",cursor:"pointer",onClick:Pe,_hover:{bg:"veryLightBackground"},transition:"background-color 0.2s",children:O.jsxs(fe,{fontSize:z.font(12),fontWeight:400,color:"text",lineHeight:z.lineHeight(20),overflow:"hidden",title:e.description,fontFamily:pe,children:[_e&&!X?e.description?.substring(0,l)+"... ":e.description,_e&&!X&&O.jsx(fe,{as:"span",fontSize:z.font(12),lineHeight:z.lineHeight(4),color:"primary",borderRadius:z.radius(4),flex:1,cursor:"pointer",fontWeight:400,fontFamily:pe,onClick:e=>{e.stopPropagation(),J(!0)},children:A("more")})]})}),O.jsxs(ue,{justify:"space-between",align:"end",cursor:"pointer",onClick:Pe,children:[O.jsxs(ge,{gap:z.space(1),align:"start",children:[(K||U||Z)&&O.jsxs(ue,{gap:z.space(1),children:[K&&O.jsx(fe,{fontSize:z.font(12),color:"mutedText",textDecoration:"line-through",fontFamily:pe,children:null!=V?Ne(V,R):null}),(U||Z)&&O.jsx(pn,{bg:"errorBackground",color:"error",fontSize:z.font(12),borderRadius:z.radius(24),title:Q||void 0,children:U?`${U}%`:`-${Ne(Z??0,R)}`})]}),!!Y&&Y>0&&O.jsxs(fe,{fontSize:z.font(12),fontWeight:"700",color:"text",fontFamily:pe,children:[Ne(Y,R),e.price_unit?O.jsxs(fe,{as:"span",fontSize:z.font(10),fontWeight:500,color:"mutedText",children:[" / ",e.price_unit]}):G?O.jsxs(fe,{as:"span",fontSize:z.font(10),fontWeight:500,color:"mutedText",children:[" ",A("perUnit")]}):null]}),e.price_on_request&&O.jsx(fe,{fontSize:z.font(12),fontWeight:"700",color:"text",fontFamily:pe,children:A("priceOnRequest")}),G&&!e.price_unit&&O.jsx(fe,{fontSize:z.font(11),fontWeight:600,color:"mutedText",fontFamily:pe,children:A("soldInSetsOf").replace("{count}",String(G))})]}),x&&!s&&O.jsxs(fe,{role:"button",tabIndex:0,fontSize:z.font(11.5),fontWeight:500,color:"mutedText",whiteSpace:"nowrap",flexShrink:0,cursor:"pointer",onClick:t=>{t.stopPropagation(),v(e,"details_button")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),v(e,"details_button"))},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",borderRadius:"4px"},fontFamily:pe,children:[A("detailsAction")," ›"]})]})]})}),a?null:x?F&&O.jsx(ge,{gap:z.space(1),w:D,align:"stretch",children:s?O.jsx(fn,{variant:"outline",size:"xs",h:z.length(26),color:"primary",borderColor:"borderColor",borderRadius:z.radius(6),borderWidth:"1px",_hover:{bg:"veryLightBackground"},onClick:Oe,disabled:!P&&!xe&&Ie,"aria-label":A(P?H.labelKey:"addToCartButton"),children:O.jsx(In,{boxSize:z.length(14)})}):O.jsxs(ee,{variant:"solid",size:"xs",h:z.length(36),fontSize:z.font(13),bg:"primary",color:"buttonText",borderRadius:z.radius(10),w:"full",fontWeight:600,onClick:Oe,disabled:!P&&!xe&&(Ie||oe),loading:!P&&!xe&&Ie,_hover:{opacity:.9},fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[P?null:O.jsx(In,{boxSize:z.length(15)}),P?A(H.labelKey):xe?A("addToCartFull"):oe?`✓ ${A("addedToCart")}`:A(Ie?"addToCartAdding":"addToCartFull")]})}):O.jsxs(ge,{gap:z.space(1),w:D,align:"stretch",children:[O.jsxs(ue,{gap:z.space(.5),children:[O.jsx(fn,{variant:"outline",size:"xs",h:s?z.length(26):z.length(30),fontSize:z.font(12),color:"primary",borderColor:"borderColor",borderRadius:z.radius(4),_hover:{bg:"veryLightBackground"},borderWidth:"1px",onClick:()=>{f({product:e,suggestions:[A("doesProductHaveDiscount"),A("whatFeaturesSpecial"),A("otherColorsAvailable")]})},"aria-label":"Reply to product",children:O.jsx(Sn,{boxSize:s?z.length(14):z.length(16)})}),!s&&O.jsxs(ee,{variant:"outline",size:"xs",h:z.length(30),fontSize:z.font(12),color:"primary",borderRadius:z.radius(4),flex:1,fontWeight:400,onClick:()=>{const e=`${A("doYouHaveSimilar")} ${T}`;p({message:e,apiMessage:`${e} (product id: ${M})`})},_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:pe,whiteSpace:"nowrap",minW:0,overflow:"hidden",textOverflow:"ellipsis",children:[O.jsx(zn,{boxSize:z.length(16)}),A("similar")]}),!s&&F&&O.jsxs(ee,{variant:"outline",size:"xs",h:z.length(30),fontSize:z.font(12),color:"primary",borderRadius:t?"4px":"6px",flex:1,minW:0,fontWeight:400,onClick:P?qe:xe?()=>be(e=>!e):We,disabled:!P&&!xe&&Ie,loading:!P&&!xe&&Ie,_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[P?null:Le?O.jsx(wn,{boxSize:z.length(11)}):O.jsx(In,{boxSize:z.length(16)}),A(P?H.labelKey:Le?"close":Ie?"addToCartAdding":"addToCartButton")]})]}),me&&xe&&!P&&O.jsx(oo,{product:e,selectedColor:Ee,onColorChange:Ae})]})]})},co=({index:e,delay:t=70,children:n})=>{const[r,o]=q.useState(!1);return q.useEffect(()=>{const n=setTimeout(()=>o(!0),e*t);return()=>clearTimeout(n)},[e,t]),O.jsx(ae,{opacity:r?1:0,transform:r?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:n})},uo=({products:e,isDesktop:t})=>O.jsx(xn,{dir:"ltr",columns:t?2:1,gapX:t?2:1,gapY:t?4:2,w:"full",children:e.map((e,n)=>O.jsx(co,{index:n,children:O.jsx(lo,{product:e,isDesktop:t})},e.id))});function po(e){return e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=e.price&&e.sale_price<e.price&&e.sale_price?e.sale_price:e.price}const fo=({product:e,index:t,isLast:n,isDesktop:r,delay:o,status:a,cardVariant:i,hideCardCta:s,onRemove:l})=>{const c=se(),[d,u]=q.useState(!1),{t:p}=le();q.useEffect(()=>{const e=setTimeout(()=>u(!0),o);return()=>clearTimeout(e)},[o]);const f=e.step_label?e.step_label.replace(/^\S+\s*\d+\s*[:.\-]\s*/i,"").trim()||e.step_label:null;return O.jsx(ae,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:O.jsxs(ue,{align:"stretch",gap:c.space(0),children:[O.jsxs(ge,{align:"center",gap:c.space(0),w:c.length(28),flexShrink:0,children:[O.jsx(ae,{w:c.length(28),h:c.length(28),borderRadius:"full",bg:"primary",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,children:"adding"===a?O.jsx(be,{size:"xs",color:"buttonText"}):O.jsx(fe,{fontSize:c.font(12),fontWeight:"700",color:"buttonText",lineHeight:"1",children:"added"===a?"✓":t+1})}),!n&&O.jsx(ae,{flex:1,w:"2px",bg:"borderColor",minH:c.length(8),opacity:d?1:0,transition:"opacity 0.3s ease-out 0.2s"})]}),O.jsxs(ge,{align:"stretch",gap:c.space(1.5),flex:1,minW:0,pl:c.space(2.5),pb:n?0:3,children:[O.jsxs(ue,{justify:"space-between",align:"center",minH:c.length(28),children:[f?O.jsx(fe,{fontSize:c.font(13),fontWeight:"600",color:"text",fontFamily:pe,pt:c.space(.5),children:f}):O.jsx(ae,{}),O.jsxs(ue,{gap:c.space(0),align:"center",children:["failed"===a&&O.jsx(fe,{fontSize:c.font(11),color:"red.500",fontFamily:pe,pr:c.space(1.5),children:p("stepAddFailed")}),"added"!==a&&O.jsx(ae,{as:"button","aria-label":p("removeProduct"),onClick:l,color:"mutedText",cursor:"pointer",w:c.length(28),h:c.length(28),display:"flex",alignItems:"center",justifyContent:"center",borderRadius:c.radius(6),_hover:{color:"text",bg:"veryLightBackground"},children:O.jsx(wn,{boxSize:c.length(10)})})]})]}),O.jsx(lo,{product:e,isDesktop:r,variant:i,hideCta:s})]})]})})};function ho(e,t){const n=e.external_product_id?String(e.external_product_id):null;return t.some(t=>n&&null!=t.product_id&&String(t.product_id)===n||!!e.name&&!!t.product_title&&t.product_title===e.name)}const go={single_pick:({products:e,isDesktop:t})=>{const n=se(),r=e[0],o=e.slice(1,3),{t:a}=le(),[i,s]=q.useState(!1),[l,c]=q.useState(!1);return q.useEffect(()=>{const e=requestAnimationFrame(()=>s(!0)),t=o.length>0?setTimeout(()=>c(!0),300):void 0;return()=>{cancelAnimationFrame(e),t&&clearTimeout(t)}},[o.length]),r?O.jsxs(ge,{gap:n.space(3),w:"full",align:"stretch",children:[O.jsx(ae,{opacity:i?1:0,transform:i?"translateY(0)":"translateY(8px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:O.jsx(lo,{product:r,isDesktop:t,variant:"hero",badgeLabel:a("topPick")})}),o.length>0&&O.jsxs(ae,{opacity:l?1:0,transform:l?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:[O.jsx(fe,{fontSize:n.font(11),fontWeight:500,color:"mutedText",fontFamily:pe,mb:n.space(2),px:n.space(1),children:a("alsoConsider")}),O.jsx(xn,{dir:"ltr",columns:1===o.length?1:2,gapX:n.space(2),gapY:n.space(2),w:"full",children:o.map(e=>O.jsx(ae,{children:O.jsx(lo,{product:e,isDesktop:t,variant:1===o.length?"default":"compact"})},e.id))})]})]}):null},shortlist:({products:e,isDesktop:t})=>{const{t:n}=le();return O.jsx(ge,{gap:3,w:"full",align:"stretch",children:e.map((e,r)=>O.jsx(co,{index:r,delay:120,children:O.jsx(lo,{product:e,isDesktop:t,variant:0===r?"hero":"default",badgeLabel:0===r?n("topPick"):void 0})},e.id))})},routine:({products:e,isDesktop:t})=>{const r=se(),{botData:o,addToCartDirect:a,isCartBusy:i,cartItemCount:s}=ie(),{t:l}=le(),[c,f]=q.useState({}),[h,g]=q.useState({}),[m,b]=q.useState({}),[x,y]=q.useState(!1);q.useEffect(()=>{if(!n(o))return;let t=!1;return(async()=>{const n=await p();if(t||!n)return;const r={};for(const t of e)ho(t,n.items||[])&&(r[t.id]=!0);b(r)})(),()=>{t=!0}},[o,e,s]);const v=e=>m[e.id]?"added":h[e.id]??"idle",w=e.filter(e=>!c[e.id]&&null===Ve(e,o)),k=w.filter(e=>"added"!==v(e)),C=w.length>0&&0===k.length,j=k.every(e=>Number.isFinite(po(e))&&po(e)>0),S=w[0]?.currency||o?.currency,z=w.reduce((e,t)=>e+po(t),0),E=k.reduce((e,t)=>e+po(t),0),A=w.every(e=>Number.isFinite(po(e))&&po(e)>0),R=n(o)&&w.length>=2&&w.every(e=>!function(e){return(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1)}(e)),T=x?l("addingRoutine"):C?`✓ ${l("addedToCart")}`:j?`${l("addRoutine")} · ${Ne(E,S)}`:l("addRoutine");return O.jsxs(ge,{gap:r.space(0),w:"full",align:"stretch",children:[O.jsxs(ue,{justify:"space-between",align:"baseline",mb:r.space(1.5),pl:r.length(38),children:[O.jsx(fe,{fontSize:r.font(13),fontWeight:"700",color:"text",fontFamily:pe,children:l("routineTitle")}),A&&w.length>=2&&O.jsx(fe,{fontSize:r.font(13),fontWeight:"700",color:"text",fontFamily:pe,children:Ne(z,S)})]}),e.map((e,n)=>{if(c[e.id])return O.jsxs(ue,{pl:r.length(38),pb:r.space(2),gap:r.space(2),align:"center",children:[O.jsx(fe,{fontSize:r.font(12),color:"mutedText",fontFamily:pe,textDecoration:"line-through",lineClamp:1,minW:0,children:e.name}),O.jsx(fe,{fontSize:r.font(12),color:"mutedText",fontFamily:pe,children:l("stepRemoved")}),O.jsx(ae,{as:"button",onClick:()=>f(t=>{const n={...t};return delete n[e.id],n}),color:"primary",fontSize:r.font(12),fontWeight:"600",cursor:"pointer",fontFamily:pe,px:r.space(2),h:r.length(24),children:l("undo")})]},e.id);const o=w.findIndex(t=>t.id===e.id);return O.jsx(fo,{product:e,index:o,isLast:o===w.length-1,isDesktop:t,delay:200*n,status:v(e),cardVariant:R?"compact":"default",hideCardCta:R,onRemove:()=>f(t=>({...t,[e.id]:!0}))},e.id)}),R&&O.jsx(ee,{mt:r.space(2.5),ml:r.length(38),size:"sm",h:r.length(36),fontSize:r.font(13),fontWeight:"600",bg:C?"veryLightBackground":"primary",color:C?"text":"white",borderRadius:r.radius(8),fontFamily:pe,onClick:async()=>{if(!x&&!i&&0!==k.length){y(!0);try{const e=[...k];for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;if(g(e=>({...e,[n.id]:"adding"})),"success"!==(await a({product_id:null!=n.id?String(n.id):void 0,product_name:n.name,product_url:n.url||void 0,product_handle:He(n.url)||void 0,quantity:u(n),quantity_label:d(n)},{deferCartEffects:!r})).type)return void g(e=>({...e,[n.id]:"failed"}));g(e=>({...e,[n.id]:"added"}))}}finally{y(!1)}}},disabled:x||i||C,loading:x,_hover:C?{}:{opacity:.9},children:T})]})},explore:uo},mo=({products:e,shape:t="explore"})=>{const{chatState:n,botData:r,isTestMode:o}=ie(),a=q.useRef(new Set),s=q.useRef(null),[l,c]=q.useState(!1),d=q.useCallback(()=>{s.current&&c(s.current.offsetWidth>=600)},[]);q.useEffect(()=>{d();const e=new ResizeObserver(d);return s.current&&e.observe(s.current),()=>e.disconnect()},[d]),q.useEffect(()=>{if(o)return;const t=Ze.SHOPIFY;if(!n.threadId)return;const i=r?.sharing_id||f();if(!i)return;const s=h(),l=[];if(e.forEach(e=>{const t=e.external_product_id;t&&(a.current.has(t)||(a.current.add(t),l.push(t)))}),l.length>0){const e=window.DORI_CUSTOMER_ID,r=null!=e?String(e):void 0,o=g();m(l,n.threadId||"",s,t,i,void 0,r,o)}},[e,t,n.threadId,r?.sharing_id,r?.assistant_id,o]);const u=q.useRef(null),p=q.useRef(!1);q.useEffect(()=>{if(o)return;const a=u.current;if(!a||p.current)return;const s=e.map(e=>e.external_product_id).filter(e=>Boolean(e)).slice(0,12);if(0===s.length)return;const l=new IntersectionObserver(o=>{for(const a of o)a.isIntersecting&&!p.current&&(p.current=!0,i("recommendation_seen",{assistantId:r?.assistant_id,threadId:n.threadId,payload:{set_id:s.join(","),shape:t,count:e.length,product_ids:s}}),l.disconnect())},{threshold:0});return l.observe(a),()=>l.disconnect()},[e,t,o,r?.assistant_id,n.threadId]);const b=go[t]||uo;return O.jsxs(ge,{ref:s,align:"stretch",gap:2,w:"full",children:[O.jsx(ae,{ref:u,h:"1px",w:"full","aria-hidden":!0}),O.jsx(ae,{px:1,w:"full",children:O.jsx(b,{products:e,isDesktop:l})})]})},bo=({index:e,children:t})=>{const[n,r]=q.useState(!1);return q.useEffect(()=>{const t=setTimeout(()=>r(!0),70*e);return()=>clearTimeout(t)},[e]),O.jsx(ae,{opacity:n?1:0,transform:n?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:t})},xo=({suggestions:e,options:t=!1})=>{const n=se(),{sendMessage:r,focusModeProduct:o}=ie(),{visible:a,asOptions:i}=Ke(e,{options:t,focusMode:!!o});return O.jsx(bn,{direction:"row",wrap:"wrap",gap:n.space(2),maxW:"full",alignSelf:"flex-start",children:a.map((e,t)=>O.jsx(bo,{index:t,children:O.jsxs(ee,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:n.radius(18),px:n.space(3.5),h:"auto",lineHeight:"1.4",py:n.space(2),onClick:()=>(e=>{r({message:e})})(e),_hover:{bg:"lightBackground",borderColor:"primary"},_active:{bg:"veryLightBackground"},textAlign:"start",justifyContent:"flex-start",gap:n.space(1.5),w:"auto",maxW:"100%",children:[!i&&O.jsx(En,{boxSize:n.length(13),color:"primary",flexShrink:0}),O.jsx(fe,{fontSize:{base:n.font(14),md:n.font(13)},fontWeight:"500",color:"text",textAlign:"start",wordBreak:"break-word",whiteSpace:"normal",lineClamp:2,children:e})]})},t))})},yo=()=>{const e=se(),{botData:t}=ie(),{t:n}=le(),a=!0===t?.hide_checkout_button;return O.jsxs(ue,{mt:e.space(3),gap:e.space(2),justify:"flex-start",children:[O.jsxs(ee,{size:"xs",variant:"outline",borderColor:"borderColor",color:"mutedText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{if(!r()){const e=`${o()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},_hover:{borderColor:"primary"},children:[O.jsx(In,{boxSize:e.length(14)}),n("cartViewCart")]}),!a&&O.jsxs(ee,{size:"xs",variant:"solid",bg:"primary",color:"buttonText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{b()},_hover:{opacity:.85},children:[n("cartCheckout"),O.jsx(Bn,{boxSize:e.length(14)})]})]})},vo=({add:e})=>{const t=se(),{botData:n,chatState:a}=ie(),{t:s}=le(),l=e?.cart??null,c=(l?.currency||n?.currency||"USD").split(" - ")[0]?.trim().toUpperCase(),d=e=>Ne(e/100,c),u=l?.added??null,p=u?.name||e?.product_name||null,f=u?.variant_title??null,h=u?.quantity??e?.quantity??null,g=null!=u?.unit_price&&null!=h?u.unit_price*h:null,m=null!=g?d(g):null,x=l?.others??[],y=e=>[e.variant_title,e.quantity>1?`x${e.quantity}`:null,null!=e.line_price?d(e.line_price):null].filter(Boolean).join(" · ");return O.jsx(ae,{mt:t.space(3),border:"1.5px solid",borderColor:"borderColor",borderRadius:t.radius(14),p:t.space(3.5),bg:"background",w:"full",maxW:t.length(360),boxShadow:"0 1px 6px rgba(0, 0, 0, 0.05)",children:O.jsxs(ge,{align:"stretch",gap:t.space(2.5),children:[O.jsxs(ue,{gap:t.space(1.5),children:[O.jsx(kn,{boxSize:t.length(16),color:"primary"}),O.jsx(fe,{fontSize:t.font(13),fontWeight:700,color:"primary",fontFamily:pe,children:s("addedToCart")})]}),p&&O.jsxs(ue,{gap:t.space(2.5),align:"center",children:[u?.image?O.jsx(de,{src:u.image,alt:p,w:t.length(48),h:t.length(48),objectFit:"cover",onLoad:Qe,borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground"}):O.jsx(ae,{w:t.length(48),h:t.length(48),borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:O.jsx(In,{boxSize:t.length(18),color:"mutedText"})}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:t.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:p}),O.jsx(fe,{fontSize:t.font(12),color:"mutedText",fontFamily:pe,children:[f,h&&h>1?`x${h}`:null,m].filter(Boolean).join(" · ")})]})]}),x.map((e,n)=>O.jsxs(ue,{gap:t.space(2.5),align:"center",opacity:.75,children:[e.image?O.jsx(de,{src:e.image,alt:e.title||"",w:t.length(32),h:t.length(32),objectFit:"cover",onLoad:Qe,borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground"}):O.jsx(ae,{w:t.length(32),h:t.length(32),borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:O.jsx(In,{boxSize:t.length(14),color:"mutedText"})}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:t.font(12),fontWeight:500,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:e.title}),O.jsx(fe,{fontSize:t.font(11),color:"mutedText",fontFamily:pe,children:y(e)})]})]},n)),!!l?.hidden_line_count&&l.hidden_line_count>0&&O.jsx(fe,{fontSize:t.font(11),color:"mutedText",fontFamily:pe,children:s("cartMoreItems").replace("{count}",String(l.hidden_line_count))}),l&&l.item_count>0&&O.jsx(fe,{fontSize:t.font(12),fontWeight:600,color:"text",borderTop:"1px solid",borderColor:"borderColor",pt:t.space(2),fontFamily:pe,children:s(1===l.item_count?"cartLineOne":"cartLine").replace("{count}",String(l.item_count)).replace("{total}",d(l.total_price))}),O.jsxs(ue,{gap:t.space(2),children:[O.jsxs(ee,{size:"sm",flex:1,variant:"outline",borderColor:"borderColor",color:"text",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{if(i("closer_action_clicked",{assistantId:n?.assistant_id,threadId:a.threadId,payload:{action:"view_cart"}}),!r()){const e=`${o()}cart`;window.location.href=e}},_hover:{borderColor:"primary"},children:[O.jsx(In,{boxSize:t.length(13)}),s("cartViewCart")]}),!0!==n?.hide_checkout_button&&O.jsxs(ee,{size:"sm",flex:1,variant:"solid",bg:"primary",color:"buttonText",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{i("closer_action_clicked",{assistantId:n?.assistant_id,threadId:a.threadId,payload:{action:"checkout"}}),b()},_hover:{opacity:.85},children:[s("cartCheckout"),O.jsx(Bn,{boxSize:t.length(13)})]})]})]})})},wo=({onSubmit:e,onClose:t,existingText:n})=>{const r=se(),[o,a]=q.useState(n||""),[i,s]=q.useState(!1);return q.useEffect(()=>{a(n||"")},[n]),O.jsx(ae,{mt:r.space(2),bg:"background",borderRadius:r.radius(10),p:r.space(3),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:r.length(280),children:O.jsxs(ge,{gap:r.space(3),align:"stretch",children:[O.jsxs(ge,{gap:r.space(.5),align:"start",children:[O.jsx(fe,{fontSize:r.font(13),fontWeight:"600",color:"text",lineHeight:"1.4",children:"Tell us what was wrong"}),O.jsx(fe,{fontSize:r.font(11),color:"mutedText",lineHeight:"1.4",children:"Your comment is optional and helps us improve responses."})]}),O.jsx(vn,{value:o,onChange:e=>a(e.target.value),placeholder:"Describe what you expected...","aria-label":"Describe what you expected",rows:3,fontSize:r.font(12),resize:"none",borderColor:"borderColor",borderRadius:r.radius(8),p:r.space(2),bg:"lightBackground",color:"text",autoFocus:!0,_placeholder:{color:"mutedText"},_focus:{outline:"none",borderColor:"primary",boxShadow:"none"}}),O.jsxs(ue,{gap:r.space(2),justify:"flex-end",children:[O.jsx(ee,{size:"sm",variant:"ghost",onClick:t,disabled:i,fontSize:r.font(12),color:"mutedText",px:r.space(3),h:r.length(30),_hover:{bg:"lightBackground"},children:"Cancel"}),O.jsx(ee,{size:"sm",variant:"outline",onClick:async()=>{s(!0),await e(void 0),s(!1)},disabled:i,fontSize:r.font(12),color:"text",borderColor:"borderColor",px:r.space(3),h:r.length(30),children:"No Comment"}),O.jsx(ee,{size:"sm",onClick:async()=>{s(!0),await e(o.trim()||void 0),s(!1)},disabled:i,fontSize:r.font(12),bg:"primary",color:"buttonText",px:r.space(3),h:r.length(30),borderRadius:r.radius(8),_hover:{opacity:.85},children:i?"Submitting...":"Submit"})]})]})})},ko=({messageIndex:e,feedback:t})=>{const n=se(),{submitFeedback:r}=ie(),[o,a]=q.useState(!1),i="like"===t?.rating,s="dislike"===t?.rating;return O.jsxs(ae,{mt:n.space(1.5),children:[O.jsxs(ue,{gap:n.space(1.5),align:"center",children:[O.jsx(ae,{as:"button",onClick:async()=>{i||(await r(e,"like"),a(!1))},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:i?"primary":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:i?"primary":"borderColor",cursor:"pointer",title:"This response was helpful","aria-label":"This response was helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:O.jsx(fe,{fontSize:n.font(16),lineHeight:"1",children:"👍"})}),O.jsx(ae,{as:"button",onClick:()=>{a(!0)},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:s?"red.500":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:s?"red.500":"borderColor",cursor:"pointer",title:"This response wasn't helpful","aria-label":"This response wasn't helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:O.jsx(fe,{fontSize:n.font(16),lineHeight:"1",children:"👎"})})]}),t?.feedbackText&&O.jsxs(ae,{mt:n.space(1),px:n.space(2.5),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:n.length(280),children:[O.jsx(fe,{fontSize:n.font(10),color:"mutedText",lineHeight:"1.2",fontWeight:"600",textTransform:"uppercase",mb:n.space(1),children:"Submitted Feedback"}),O.jsx(fe,{fontSize:n.font(11),color:"mutedText",lineHeight:"1.4",children:t.feedbackText})]}),o&&O.jsx(ae,{maxW:n.length(280),children:O.jsx(wo,{onSubmit:async t=>{await r(e,"dislike",t),a(!1)},onClose:()=>{a(!1)},existingText:t?.feedbackText})})]})},Co=({variant:e,children:t,textSize:n={base:"15px",md:"14px"}})=>{const r=se(),o=Ge(r,n);return"user"===e?O.jsx(fe,{wordBreak:"break-word",fontSize:r.font(14),fontWeight:"500",color:"text",fontFamily:pe,whiteSpace:"pre-wrap",children:t}):O.jsx(fe,{fontSize:o,fontWeight:"400",color:"text",textAlign:"left",lineHeight:"1.6",whiteSpace:"pre-wrap",children:t})},jo=(So=()=>v(()=>import("./MarkdownContent-D7AdAAbE.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),zo=Co,Eo="markdown",oe.lazy(()=>x(So,zo,(e,t)=>{console.warn(`[Dori] chunk "${Eo}" failed twice, rendering plain fallback`,e,t);try{y(t instanceof Error?t:new Error(String(t)),{chunk:Eo,degraded:!0})}catch{}})));var So,zo,Eo;const Ao=({message:e,isStreaming:t=!1,doriMessageIndex:n,isAfterProducts:r=!1})=>{const o=se(),{isTestMode:a,enterFocusMode:i,productFocusEnabled:s}=ie(),l=tn("colors","primary"),c=Re(l),d=function(e){const t=Date.now()-new Date(e).getTime()<2e3,[n,r]=q.useState(!t);return q.useEffect(()=>{if(!t)return;const e=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(e)},[t]),n}(e.timestamp),u=function(e,t){const n=q.useRef(e),r=q.useRef(t?0:e.length),[o,a]=q.useState(t?"":e),i=q.useRef(null),s=q.useRef(t);n.current=e,s.current=t;const l=q.useCallback(()=>{const e=n.current,t=e.length-r.current;if(t<=0||!s.current)return void(i.current=null);const o=Math.max(1,Math.ceil(.12*t));r.current=Math.min(e.length,r.current+o),a(e.slice(0,r.current)),r.current<e.length?i.current=requestAnimationFrame(l):i.current=null},[]),c=q.useCallback(()=>{null===i.current&&(i.current=requestAnimationFrame(l))},[l]),d=q.useCallback(()=>{null!==i.current&&(cancelAnimationFrame(i.current),i.current=null)},[]);return q.useEffect(()=>(t?r.current<e.length&&c():(d(),r.current=e.length,a(e)),d),[t]),q.useEffect(()=>{t&&r.current<e.length&&c()},[e,t,c]),o}(e.content,t);if("welcome"===e.type)return O.jsx(Qr,{message:e.content});if("loading"===e.type)return e.content&&O.jsx(Qr,{message:e.content,type:"loading"});if("user"===e.type)return O.jsxs(ae,{maxW:o.length(220),alignSelf:"flex-end",mb:o.space(2),children:[e.imageUrl&&O.jsx(ae,{w:o.length(120),h:o.length(120),mb:o.space(2),borderRadius:o.radius(12),background:c,children:O.jsx(de,{src:e.imageUrl,alt:"Uploaded image",w:"100%",h:"100%",borderRadius:o.radius(12),objectFit:"cover"})}),(e.content.length>0||e.repliedProduct)&&O.jsxs(ge,{bg:"lightBackground",borderRadius:o.radius(24),px:o.space(3),py:o.space(2),gap:o.space(2),alignItems:"start",w:"full",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:[e.repliedProduct&&(()=>{const t=e.repliedProduct,n=s&&null!=t.id,r=()=>i(t,"replied_chip");return O.jsxs(ue,{bg:"background",borderRadius:o.radius(12),p:o.space(2),gap:o.space(2),w:"full",...n&&{role:"button",tabIndex:0,cursor:"pointer","aria-label":t.name,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())},_hover:{bg:"veryLightBackground"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"background 0.15s"},children:[O.jsx(de,{src:t.image,alt:"product",w:o.length(40),h:o.length(40),objectFit:"cover",onLoad:Qe,borderRadius:o.radius(8)}),O.jsx(fe,{fontSize:o.font(12),fontWeight:"400",color:"text",children:t.name})]})})(),O.jsx(q.Suspense,{fallback:O.jsx(Co,{variant:"user",children:e.content}),children:O.jsx(jo,{variant:"user",children:e.content})})]})]});if("products"===e.type)return O.jsx(ae,{maxW:"100%",alignSelf:"flex-start",mb:o.space(4),w:"full",opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:O.jsx(mo,{products:e.products||[],shape:e.shape})});if("suggestions"===e.type)return O.jsx(xo,{suggestions:e.suggestions||[],options:e.optionChips});if("follow_up"===e.type&&e.followUp)return O.jsx(Je,{message:e});if("handover"===e.type&&e.handover)return O.jsx($e,{message:e});if("email_signup"===e.type&&e.emailSignup)return O.jsx(et,{message:e});if("team"===e.type)return O.jsx(tt,{message:e});if("handover_event"===e.type&&e.handoverEvent)return O.jsx(nt,{message:e});if("dori"===e.type&&!e.content?.trim()&&!t&&!e.showCartSummary)return null;const p="undefined"!=typeof document&&"true"===document.querySelector("script#dori-side-widget")?.getAttribute("data-hide-ratings"),f=a&&!p&&"dori"===e.type&&!t,h=Ge(o,r&&!t?{base:"14px",md:"13px"}:{base:"15px",md:"14px"});return O.jsxs(ge,{align:"stretch",gap:o.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[(!!u?.trim()||t)&&O.jsx(ae,{w:"full",alignSelf:"flex-start",children:O.jsx(q.Suspense,{fallback:O.jsx(Co,{variant:"dori",textSize:h,children:u}),children:O.jsx(jo,{variant:"dori",textSize:h,children:u})})}),e.showCartSummary?O.jsx(vo,{add:e.closerAdd}):e.showCartActions&&O.jsx(yo,{}),f&&void 0!==n&&O.jsx(ko,{messageIndex:n,feedback:e.feedback})]})},Ro=e=>O.jsx(Xe,{label:"message",fallback:e.message?.content?O.jsx(Co,{variant:"user"===e.message.type?"user":"dori",children:e.message.content}):null,children:O.jsx(Ao,{...e})}),To=({product:e,messages:t})=>{const n=se(),{enterFocusMode:r}=ie(),{t:o}=le(),a=t.filter(e=>"user"===e.type||"products"===e.type||"dori"===e.type&&(!!e.content?.trim()||e.showCartSummary)).length,i=1===a?o("productChatMessageOne"):o("productChatMessages").replace("{count}",String(a)),s=()=>r(e,"chat_card");return O.jsxs(ue,{role:"button",tabIndex:0,"aria-label":`${e.name} · ${i}`,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())},mt:n.space(1),mb:n.space(1),px:n.space(3),py:n.space(2.5),gap:n.space(2.5),align:"center",border:"1.5px solid",borderColor:"borderColor",borderRadius:n.radius(14),bg:"background",cursor:"pointer",_hover:{borderColor:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"border-color 0.15s",children:[e.image&&O.jsx(de,{src:e.image,alt:"",w:n.length(36),h:n.length(36),objectFit:"cover",onLoad:Qe,borderRadius:n.radius(8),flexShrink:0,bg:"lightBackground"}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:n.font(12.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:e.name}),O.jsxs(fe,{fontSize:n.font(11),color:"mutedText",fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[o("productChatLabel")," · ",i]})]}),O.jsx(Bn,{boxSize:n.length(13),color:"mutedText",flexShrink:0})]})},_o=["product_click","add_to_cart","exit_intent"];function Wo(e){const t=(e?.fields??[]).filter(e=>"phone"===e||"email"===e);return Array.from(new Set(t))}const Io="dori-lead-settled-",Lo="dori-lead-asks-";function Mo(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch{return null}}function Bo(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch{}}function Fo(e){e&&Bo(`${Io}${e}`,"1")}function Do(e){if(!e)return 0;const t=Number.parseInt(Mo(`${Lo}${e}`)??"",10);return Number.isFinite(t)&&t>0?t:0}const Ho=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.trim()),Po=({threadId:e,fields:t,rule:n,message:r,note:o,onSettled:a})=>{const i=se(),{isMobile:s}=ye(),{t:l}=le(),[c,d]=q.useState(!1),[u,p]=q.useState({phone:"",email:""}),[f,h]=q.useState(!1),[g,m]=q.useState(!1);q.useEffect(()=>{const e=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(e)},[]),q.useEffect(()=>{if(!g)return;const e=setTimeout(a,2500);return()=>clearTimeout(e)},[g,a]);const b=q.useMemo(()=>{return{phone:t.includes("phone")&&(e=u.phone,(e.match(/\d/g)||[]).length>=6)?u.phone:void 0,email:t.includes("email")&&Ho(u.email)?u.email:void 0};var e},[t,u]),x=Boolean(b.phone||b.email),y=async()=>{!f&&x&&(h(!0),Fo(e),await w(e,{...b,trigger:n.trigger}),h(!1),m(!0))},v=e=>l("phone"===e?"leadPromptPhonePlaceholder":"leadPromptEmailPlaceholder");return O.jsx(ae,{flexShrink:0,opacity:c?1:0,transform:c?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",borderWidth:"1px",borderColor:"border",borderRadius:i.radius(10),bg:"veryLightBackground",px:i.space(2.5),py:i.space(2),"data-dori-lead-capture":n.trigger,children:g?O.jsx(fe,{fontSize:i.font(12),color:"text",fontFamily:pe,children:l("leadPromptSaved")}):O.jsxs(ge,{align:"stretch",gap:i.space(1.5),children:[O.jsx(fe,{fontSize:i.font(12),lineHeight:"1.35",color:"text",fontFamily:pe,children:n.message||r||l("leadPromptText")}),O.jsxs(ue,{gap:i.space(1.5),wrap:"wrap",align:"center",children:[t.map(e=>O.jsx(je,{value:u[e],onChange:t=>p(n=>({...n,[e]:t.target.value})),onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:v(e),"aria-label":v(e),type:"phone"===e?"tel":"email",inputMode:"phone"===e?"tel":"email",autoComplete:"phone"===e?"tel":"email",fontSize:s?me(i,16):i.font(13),color:"text",bg:"background",borderColor:"border",borderRadius:i.radius(8),flex:"1 1 8rem",minW:"8rem",height:i.length(32),px:i.space(2.5),py:0,_placeholder:{color:"mutedText"},_focus:{borderColor:"primary",boxShadow:"none"}},e)),O.jsx(ee,{size:"sm",flexShrink:0,borderRadius:i.radius(8),bg:"primary",color:"buttonText",fontSize:i.font(12),px:i.space(3),height:i.length(32),loading:f,disabled:!x,onClick:y,fontFamily:pe,children:l("leadPromptSave")})]}),O.jsxs(ue,{justify:"space-between",align:"center",gap:i.space(2),children:[O.jsx(fe,{fontSize:i.font(10),lineHeight:"1.3",color:"mutedText",fontFamily:pe,children:o||l("leadPromptNote")}),O.jsx(ee,{size:"sm",variant:"plain",flexShrink:0,fontSize:i.font(11),color:"mutedText",px:0,height:"auto",minH:"auto",py:0,onClick:()=>{Fo(e),a()},fontFamily:pe,children:l("leadPromptSkip")})]})]})})};function qo(){const e=ie(),t=e.botData?.feature_flags?.lead_capture,n=e.chatState.threadId,[r,o]=q.useState(!1),[a,i]=q.useState(null),[s,l]=q.useState(0),[c,d]=q.useState([]),[u,p]=q.useState(0),f=Boolean(t?.enabled),h=q.useMemo(()=>e.messages.filter(e=>"dori"===e.type).length,[e.messages]);q.useEffect(()=>{o(function(e){return!!e&&"1"===Mo(`${Io}${e}`)}(n)),l(Do(n)),d([]),i(null)},[n]);const g=e=>d(t=>t.includes(e)?t:[...t,e]),m=q.useRef(Date.now());q.useEffect(()=>{m.current=Date.now(),p(0)},[e.messages.length]),q.useEffect(()=>{if(!f)return;const e=setInterval(()=>{p(Math.floor((Date.now()-m.current)/1e3))},5e3);return()=>clearInterval(e)},[f]),q.useEffect(()=>{f&&(e.focusedProduct||e.focusModeProduct)&&g("product_click")},[f,e.focusedProduct,e.focusModeProduct]);const b=q.useRef(e.cartItemCount??0);q.useEffect(()=>{if(!f)return;const t=e.cartItemCount??0;t>b.current&&g("add_to_cart"),b.current=t},[f,e.cartItemCount]),q.useEffect(()=>{if(!f)return;if("undefined"==typeof window||"undefined"==typeof document)return;if(window.matchMedia?.("(hover: none)")?.matches)return;const e=e=>{e.clientY<=0&&g("exit_intent")};return document.addEventListener("mouseout",e),()=>document.removeEventListener("mouseout",e)},[f]);const x=function(e,t){if(!e?.enabled)return null;if(!t.hasThread||t.settled||t.busy)return null;const n=e.fields??[],r=e.rules??[];if(0===n.length||0===r.length)return null;const o=e.max_asks??1;return t.asksUsed>=o?null:r.find(e=>function(e,t){switch(e.trigger){case"conversation_start":return!0;case"after_turns":return t.botTurns>=(e.value??1);case"idle":return t.botTurns>0&&t.idleSeconds>=(e.value??45);default:return!!_o.includes(e.trigger)&&t.firedEvents.includes(e.trigger)}}(e,t))??null}(t,{botTurns:h,idleSeconds:u,firedEvents:c,asksUsed:s,settled:r,hasThread:Boolean(n),busy:e.anySheetOpen||"generating"===e.inputState||!!e.handover});q.useEffect(()=>{!r&&!a&&x&&n&&(i(x),l(function(e){if(!e)return 0;const t=Do(e)+1;return Bo(`${Lo}${e}`,String(t)),t}(n)))},[x,a,r,n]);const y=function(e,t,n){return n?null:e??t}(a,x,r);return{rule:y,threadId:n,fields:Wo(t),message:t?.message,note:t?.note,settle:()=>{i(null),o(!0)}}}const Oo=({chat:e,t:t})=>{const n=se(),[r,o]=q.useState(!1);return q.useEffect(()=>{const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),O.jsxs(ue,{role:"status","aria-live":"polite",flexShrink:0,justify:"space-between",align:"center",px:n.space(3),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderLeft:"3px solid",borderLeftColor:"primary",fontSize:n.font(13),opacity:r?1:0,transform:r?"translateY(0)":"translateY(8px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[O.jsx(fe,{color:"mutedText",fontSize:n.font(13),lineClamp:1,flex:1,children:"remove"===e.cartUndoState.operation?t("cartUndoRemoved").replace("{product}",e.cartUndoState.productName):t("cartUndoQuantityChanged").replace("{product}",e.cartUndoState.productName)}),O.jsxs(ue,{gap:n.space(1),children:[O.jsx(ee,{size:"xs",variant:"ghost",color:"primary",fontWeight:"600",fontSize:n.font(13),onClick:e.handleCartUndo,_hover:{bg:"transparent",opacity:.7},px:n.space(2),minW:"auto",children:t("cartUndoButton")}),O.jsx(fn,{size:"xs",variant:"ghost","aria-label":"Dismiss",onClick:e.dismissCartUndo,color:"mutedText",_hover:{bg:"transparent",opacity:.7},minW:"auto",h:"auto",p:n.space(.5),children:O.jsx(wn,{boxSize:n.length(12)})})]})]})},No=({header:e})=>{const t=ie(),n=rt(t.handover),r=t.messages[t.messages.length-1],o=!!t.handover&&"user"===r?.type&&null!==t.handoverTeamReadAt&&t.handoverTeamReadAt>=new Date(r.timestamp).getTime(),{botData:a}=t,{t:i,translations:c}=le(),d=s(a,c),{isMobile:u}=ye(),p=qo(),f=se(),h=Ie(u?1:Le(t.botData).width),g=q.useRef(null),m=q.useRef(!0),b=q.useRef(!1),x=q.useRef(0),y=q.useCallback(()=>{if(b.current)return void(b.current=!1);if(Date.now()-x.current>3e3)return;const e=g.current;if(!e)return;const n=e.scrollHeight-e.scrollTop-e.clientHeight<80;n!==m.current&&(m.current=n,t.setAutoScrollEnabled(n))},[t.setAutoScrollEnabled]);q.useEffect(()=>{const e=g.current;e&&(t.handoverTeamTyping||o)&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&k(t.messagesEndRef.current)},[t.handoverTeamTyping,o,t.messagesEndRef]);const v=q.useRef(null),w=q.useRef(null),C=q.useCallback(e=>{const t=g.current,n=t?.querySelector(`[data-turn-anchor="${e}"]`),r=n?.firstElementChild??null;if(!t||!r)return!0;const o=()=>r.getBoundingClientRect().top-t.getBoundingClientRect().top-4,a=o();if(Math.abs(a)<=1)return!0;const i=t.scrollTop;return b.current=!0,t.scrollTop=i+a,t.scrollTop===i&&(b.current=!1),Math.abs(o())<=1},[]);q.useEffect(()=>{const e=t.answerAnchorTurnRef.current;if(e&&v.current!==e){const n=t.messages,r=n.findIndex(t=>"user"===t.type&&t.id===e);(-1===r?void 0:n.slice(r+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))&&(v.current=e,t.setAutoScrollEnabled(!1),m.current=!1,w.current=e)}const n=w.current;n&&C(n)&&(w.current=null)},[t.messages,t.answerAnchorTurnRef,t.setAutoScrollEnabled,C]),q.useEffect(()=>{const e=g.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>{const e=w.current;e&&C(e)&&(w.current=null)});for(const n of Array.from(e.children))t.observe(n);return()=>t.disconnect()},[C]);const j=q.useCallback(()=>{x.current=Date.now(),w.current=null},[]),S=q.useRef(0),z=null!=t.focusModeProduct,E=q.useRef(z);q.useLayoutEffect(()=>{const e=g.current,n=E.current;E.current=z,e&&(!n&&z?S.current=e.scrollTop:n&&!z&&(t.setAutoScrollEnabled(!1),m.current=!1,e.scrollTop=S.current))},[z,t.setAutoScrollEnabled]);const[A,R]=Me(),T=tn("colors","primary"),_=Re(T),W=q.useMemo(()=>{if(!t.chatState.isRequestInProgress)return null;if(t.messages.some(e=>"loading"===e.type))return null;for(let e=t.messages.length-1;e>=0;e--)if("dori"===t.messages[e].type)return t.messages[e].id;return null},[t.chatState.isRequestInProgress,t.messages]),I=q.useMemo(()=>{const e=[];for(const n of t.messages){const t=n.focusProductId;if(null!=t){const r=e[e.length-1];if(r&&"productChat"===r.kind&&r.tagId===t){r.messages.push(n);continue}e.push({kind:"productChat",tagId:t,product:null,messages:[n]});continue}e.push({kind:"msg",msg:n})}return e.flatMap(e=>{if("productChat"!==e.kind)return[e];const t=e.messages.find(t=>"user"===t.type&&t.repliedProduct&&String(t.repliedProduct.id)===e.tagId)?.repliedProduct??e.messages.find(e=>"user"===e.type&&e.repliedProduct)?.repliedProduct??null;return t?[{...e,product:t}]:e.messages.map(e=>({kind:"msg",msg:e}))})},[t.messages]),L=q.useMemo(()=>{const e=new Map;let n=0;for(const r of t.messages)"dori"===r.type&&e.set(r.id,n++);return e},[t.messages]);return O.jsxs(O.Fragment,{children:[e,d&&O.jsx(fe,{fontWeight:"600",fontStyle:"normal",fontSize:f.isMini?f.font(24):`${h.greetingFontPx}px`,letterSpacing:"0",w:"fit-content",transition:"opacity 0.5s ease",fontFamily:pe,css:{background:_,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:d}),O.jsxs(ge,{flex:1,justify:"center",align:"stretch",gap:f.space(h.sectionGap),minH:0,transition:"opacity 0.5s ease",opacity:1,children:[O.jsx(ae,{ref:g,flex:1,overflowY:"scroll",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",onScroll:y,onWheel:j,onTouchStart:j,onTouchMove:j,onPointerDown:j,onKeyDown:j,css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:O.jsxs(ge,{overscrollBehavior:"contain",gap:f.space(2),align:"stretch",pb:f.space(2),children:["live"===t.handover?.state&&O.jsx(ot,{card:t.handover}),O.jsx(Xe,{label:"message-list",children:I.reduce((e,t)=>{if("productChat"===t.kind)return e.elements.push(O.jsx(To,{product:t.product,messages:t.messages},`product-chat-${t.messages[0].id}`)),e.prevType="productChat",e;const n=t.msg,r="dori"===n.type,o=r&&"products"===e.prevType,a=O.jsx(Ro,{message:n,isStreaming:n.id===W,doriMessageIndex:r?L.get(n.id):void 0,isAfterProducts:o},n.id);return e.elements.push("user"===n.type?O.jsx("div",{"data-turn-anchor":n.id,style:{display:"contents"},children:a},n.id):a),e.prevType=n.type,e},{elements:[],prevType:""}).elements},I.length),t.handoverTeamTyping&&O.jsx(at,{card:t.handover}),o&&O.jsx(it,{}),O.jsx("div",{ref:t.messagesEndRef,style:{height:"1px"}})]})}),t.cartUndoState&&O.jsx(Oo,{chat:t,t:i}),A&&!t.anySheetOpen&&O.jsx(Zr,{chips:[A],onChipClick:e=>{l("offer_guide_chat_opened",{from:"chat"}),R(),Fe(e).then(n=>t.sendMessage({message:e,apiMessage:n}))},onDismiss:()=>{Be(),R()}}),p.rule&&p.threadId&&O.jsx(Po,{threadId:p.threadId,fields:p.fields,rule:p.rule,message:p.message,note:p.note,onSettled:p.settle}),O.jsx(ae,{flexShrink:0,bg:"transparent",borderRadius:f.radius(12),transition:"all 0.2s ease",onInput:t.noteHandoverTyping,children:O.jsx(Qn,{state:t.inputState,placeholder:"generating"===t.inputState?i("processing"):"live"===t.handover?.state?i("handoverMessagePlaceholder").replace("{team}",n):t.focusedProduct?i("askAboutProduct"):i("whatsYourQuestion"),onSend:t.isInputDisabled?void 0:t.sendMessage,onStop:t.stopCurrentRequest})})]})]})};function Yo(e){return{position:"fixed",transition:"all 0.5s ease",visibility:e?"visible":"hidden",opacity:e?1:0,bgColor:"background",zIndex:1e6,overflow:"hidden",willChange:"transform",pointerEvents:e?"auto":"none",overscrollBehavior:"contain",touchAction:"pan-x pan-y"}}const Vo=({children:e,showSuggestionScreen:t,isOpen:n,isExpanded:r=!1,onClose:o})=>{const{isMobile:a}=ye(),{botData:i}=ie(),s=q.useRef(null),l=i?.customization?.position?.align??"right",c=Le(i),d=ft(c.width,c.height),u=dt(i),p=Ie(a?1:c.width),f=ut(pt(i,a)),h=tn("colors","borderColor"),g=!0===i?.feature_flags?.panel_drawer,m=(b={isMobile:a,mobileScale:u,isOpen:n,isExpanded:r,isDrawer:g,align:l,panel:d,borderColor:h}).isMobile?function(e){const{isOpen:t,mobileScale:n}=e,r=n<1;return{...Yo(t),top:r?"auto":"0",left:"0",right:"0",bottom:"0",width:"auto",maxWidth:"100vw",height:r?`min(100dvh, max(${Math.round(100*n)}dvh, ${lt}px))`:"auto",border:"none",borderRadius:r?`${st}px ${st}px 0px 0px`:"0px",boxShadow:r?"0px -6px 24px rgba(0, 0, 0, 0.12)":"none",transform:t?"translateY(0)":"translateY(100vh)"}}(b):b.isDrawer?function(e){const{isOpen:t,align:n,panel:r}=e;return{...Yo(t),top:"0",left:"left"===n?"0":"auto",right:"right"===n?"0":"auto",bottom:"0",width:r.width,maxWidth:"100vw",height:"100dvh",border:"none",borderRadius:"0px",boxShadow:"right"===n?"-8px 0px 28px rgba(0, 0, 0, 0.14)":"8px 0px 28px rgba(0, 0, 0, 0.14)",transform:t?"translateX(0)":"right"===n?"translateX(100%)":"translateX(-100%)"}}(b):function(e){const{isOpen:t,isExpanded:n,align:r,panel:o,borderColor:a}=e,i=n?"50%":"20px";return{...Yo(t),top:"50%",left:"left"===r?i:"auto",right:"right"===r?i:"auto",bottom:"auto",width:n?o.expandedWidth:o.width,maxWidth:`calc(100vw - ${2*ct}px)`,height:n?o.expandedHeight:o.height,border:`1px solid ${a}`,borderRadius:"24px",boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",transform:t?n?"right"===r?"translate(50%, -50%)":"translate(-50%, -50%)":"translateY(-50%)":n?"right"===r?"translate(50%, -50%) translateX(120%)":"translate(-50%, -50%) translateX(-120%)":"right"===r?"translateY(-50%) translateX(120%)":"translateY(-50%) translateX(-120%)"}}(b);var b;return(({containerRef:e,isOpen:t,showSuggestionScreen:n})=>{q.useEffect(()=>{if(!t||!e.current)return;const n=e.current,r=e=>{if(e.scrollHeight<=e.clientHeight+1)return!1;const t=getComputedStyle(e).overflowY;return"auto"===t||"scroll"===t},o=e=>{e.preventDefault(),e.stopPropagation();const t=(e=>{let t=e.composedPath?.()[0]??e.target;for(;t&&t!==n;){if(t instanceof HTMLElement&&r(t))return t;t=t.parentElement}return null})(e)||n.querySelector('[data-scroll-container="sheet"]')||n.querySelector('[data-scroll-container="focus-mode"]')||n.querySelector('[data-scroll-container="chat-messages"]');t&&(t.scrollTop+=e.deltaY)};return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,n])})({containerRef:s,isOpen:n,showSuggestionScreen:t}),q.useEffect(()=>{const e=s.current;if(!e)return;const t=e=>e.preventDefault();return e.addEventListener("gesturestart",t,{passive:!1}),e.addEventListener("gesturechange",t,{passive:!1}),()=>{e.removeEventListener("gesturestart",t),e.removeEventListener("gesturechange",t)}},[]),q.useEffect(()=>{if(!n||!g||a||!o)return;const e=e=>{"Escape"===e.key&&setTimeout(()=>{e.defaultPrevented||o()},0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,g,a,o]),O.jsxs(O.Fragment,{children:[!a&&g&&O.jsx(ae,{"data-dori-drawer-backdrop":"","aria-hidden":"true",position:"fixed",top:"0",left:"0",right:"0",bottom:"0",bgColor:"rgba(0, 0, 0, 0.4)",zIndex:1e6,opacity:n?1:0,visibility:n?"visible":"hidden",pointerEvents:n?"auto":"none",transition:"opacity 0.3s ease, visibility 0.3s ease",onClick:o}),O.jsx(ae,{ref:s,...m,children:O.jsxs(ge,{p:f.space(p.padding),pb:f.space(p.paddingBottom),h:"full",justify:"flex-start",align:"stretch",gap:f.space(p.contentGap),children:[e,!t&&O.jsx(ae,{transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:O.jsx(rr,{variant:"default"})})]})})]})},Uo=/colo|couleur|farbe|màu|colore|kleur/i,Zo=({variantSummary:e})=>{const t=se();if(!e?.options?.length)return null;const{options:n}=e,r=n.find(e=>Uo.test(e.name||"")||no(e)),o=r?(()=>{const e=new Set(r.values.map(e=>e.image).filter(Boolean)).size>1,n=r.values.slice(0,6),o=r.values.length-n.length;return O.jsxs(ue,{gap:t.space(1),align:"center",wrap:"wrap",children:[n.map((n,r)=>{const o=!1===n.available,a=eo(n.value,n.swatch);return e&&n.image?O.jsx(ae,{position:"relative",title:n.value,w:t.length(16),h:t.length(16),borderRadius:t.radius(4),backgroundImage:`url(${n.image})`,backgroundSize:"cover",backgroundPosition:"center",border:"0.5px solid rgba(0,0,0,0.15)",opacity:o?.35:1,flexShrink:0,children:o&&O.jsx(ae,{position:"absolute",top:t.length(7),left:"-2px",w:t.length(20),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):a?O.jsx(ae,{position:"relative",title:n.value,w:t.length(15),h:t.length(15),borderRadius:"full",bg:a,border:"0.5px solid rgba(0,0,0,0.2)",opacity:o?.35:1,flexShrink:0,children:o&&O.jsx(ae,{position:"absolute",top:t.length(7),left:"-1px",w:t.length(17),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):O.jsx(fe,{fontSize:t.font(10),px:t.space(1.5),py:t.space(.5),borderRadius:t.radius(6),border:"0.5px solid",borderColor:"borderColor",color:"mutedText",opacity:o?.5:1,textDecoration:o?"line-through":"none",whiteSpace:"nowrap",title:n.value,fontFamily:pe,children:n.value},r)}),o>0&&O.jsxs(fe,{fontSize:t.font(11),color:"mutedText",fontFamily:pe,children:["+",o]})]})})():null,a=(r?n.filter(e=>e!==r):n).map(e=>{const n=e.values.slice(0,4),r=e.values.length-n.length;return O.jsxs(fe,{fontSize:t.font(11),color:"mutedText",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxW:"100%",fontFamily:pe,children:[e.name,":"," ",n.map((e,t)=>O.jsxs(fe,{as:"span",textDecoration:!1===e.available?"line-through":"none",opacity:!1===e.available?.6:1,children:[e.value,t<n.length-1?", ":""]},t)),r>0?`, +${r}`:""]},e.name)});return o||0!==a.length?O.jsxs(ge,{align:"start",gap:t.space(.5),w:"full",children:[o,a]}):null};let Ko=1;const Qo=[];let Go=!1,Xo=0;function Jo(){if(Xo>0)return void Xo--;const e=Qo.pop();e&&e.close()}function $o(e,t){const n=q.useRef(t);n.current=t,q.useEffect(()=>{if(!e)return;const t=function(e){if("undefined"==typeof window||!window.history?.pushState)return null;const t=Ko++;try{window.history.pushState({__dori_layer:t},"")}catch{return null}return Go||(Go=!0,window.addEventListener("popstate",Jo)),Qo.push({id:t,close:e}),t}(()=>n.current());return null!=t?()=>function(e){const t=Qo.findIndex(t=>t.id===e);if(-1!==t){Qo.splice(t,1);try{window.history.state?.__dori_layer===e&&(Xo++,window.history.back())}catch{}}}(t):void 0},[e])}const ea=({slides:e,initialIndex:t,alt:n,onClose:r})=>{const o=se(),a=q.useRef(null),[i,s]=q.useState(t);$o(!0,r),q.useEffect(()=>{const e=a.current;e&&e.clientWidth>0&&t>0&&e.scrollTo({left:t*e.clientWidth})},[]);const l=t=>{const n=a.current;!n||t<0||t>=e.length||(n.scrollTo({left:t*n.clientWidth,behavior:"smooth"}),s(t))},c=q.useRef(null);q.useEffect(()=>{const e=c.current;if(!e)return;const t=e.getRootNode().activeElement;return e.focus({preventScroll:!0}),()=>{t?.isConnected&&t.focus({preventScroll:!0})}},[]),q.useEffect(()=>{document.activeElement===document.body&&c.current?.focus({preventScroll:!0})},[i]);const d=e=>O.jsx(fn,{"aria-label":e<0?"Previous image":"Next image",position:"absolute",top:"50%",...e<0?{left:o.length(10)}:{right:o.length(10)},transform:"translateY(-50%)",zIndex:2,size:"sm",minW:o.length(36),w:o.length(36),h:o.length(36),p:0,borderRadius:"full",bg:"rgba(255,255,255,0.92)",color:"text",border:"1px solid",borderColor:"borderColor",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",_hover:{bg:"white"},onClick:()=>l(i+e),children:e<0?O.jsx(_n,{boxSize:o.length(14)}):O.jsx(Bn,{boxSize:o.length(14)})});return O.jsxs(ae,{ref:c,tabIndex:-1,role:"dialog","aria-label":n,outline:"none",onKeyDown:e=>{"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),l(i+("ArrowLeft"===e.key?-1:1)))},dir:"ltr",position:"absolute",inset:0,zIndex:60,bg:"rgba(12, 12, 12, 0.94)","data-dori-sheet":"true",children:[O.jsx(fn,{"aria-label":"Close",position:"absolute",top:o.length(10),right:o.length(10),zIndex:2,size:"sm",minW:o.length(34),w:o.length(34),h:o.length(34),p:0,borderRadius:"full",bg:"rgba(255,255,255,0.14)",color:"white",_hover:{bg:"rgba(255,255,255,0.26)"},onClick:r,children:O.jsx(wn,{boxSize:o.length(12)})}),O.jsx(ue,{ref:a,gap:0,w:"full",h:"full",onScroll:()=>{const e=a.current;if(!e||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth);t!==i&&s(t)},onClick:r,css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map(e=>O.jsx(ae,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},h:"full",display:"flex",alignItems:"center",justifyContent:"center",p:4,children:O.jsx(de,{src:e.src,alt:n,w:"100%",h:"auto",maxH:"100%",objectFit:"contain",onClick:e=>e.stopPropagation()})},e.id))}),e.length>1&&i>0&&d(-1),e.length>1&&i<e.length-1&&d(1),e.length>1&&O.jsx(ue,{position:"absolute",bottom:o.length(14),left:"0",right:"0",justify:"center",gap:1.5,pointerEvents:"none",children:e.map((e,t)=>O.jsx(ae,{w:o.length(6),h:o.length(6),borderRadius:"full",bg:t===i?"white":"rgba(255,255,255,0.35)"},`dot-${e.id}`))})]})},ta=/colo|couleur|farbe|màu|colore|kleur/i,na=e=>(e||"").replace(/^https?:/,"").split("?")[0],ra=({onClose:e})=>{const{focusModeProduct:t,focusModeAnchorTs:r,exitFocusMode:o,openVariantModal:a,variantModalProduct:s,addToCartDirect:l,sendMessage:p,stopCurrentRequest:f,botData:h,chatState:g,messages:m,inputState:b,isInputDisabled:x,shortlistEnabled:y,isShortlisted:v,toggleShortlist:w,answerAnchorTurnRef:k,isTestMode:C}=ie(),j=se(),{t:S}=le(),z=t,E=null!=z,A=q.useRef(null),[R,T]=q.useState(!1),[_,W]=q.useState(!1),I=q.useRef(null),L=q.useMemo(()=>"undefined"!=typeof window&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,[]);q.useEffect(()=>{if(!E)return T(!1),void W(!1);const e=requestAnimationFrame(()=>T(!0));return()=>cancelAnimationFrame(e)},[E]),q.useEffect(()=>()=>{I.current&&clearTimeout(I.current)},[]);const M=q.useCallback(e=>{L?o(e):W(t=>t||(I.current=setTimeout(()=>o(e),180),!0))},[L,o]);$o(E,()=>M("back_gesture"));const[B,F]=q.useState(null);q.useEffect(()=>{if(!E)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),null==B?s||M("escape"):F(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E,s,B,M]),q.useEffect(()=>{if(E){const e=requestAnimationFrame(()=>A.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)}},[E]);const[D,H]=q.useState(null),P=z?.url;q.useEffect(()=>{H(null);const e=P?He(P):void 0;if(!e)return;let t=!1;return Pe(e).then(e=>{!t&&e&&H(e)}).catch(()=>{}),()=>{t=!0}},[P]);const N=null!=z?.id?String(z.id):null,Y=q.useMemo(()=>null==N?[]:m.filter(e=>null!=e.focusProductId&&String(e.focusProductId)===N),[m,N]),V=q.useMemo(()=>{if(!g.isRequestInProgress)return null;if(Y.some(e=>"loading"===e.type))return null;for(let e=Y.length-1;e>=0;e--)if("dori"===Y[e].type)return Y[e].id;return null},[g.isRequestInProgress,Y]),U=q.useRef(null),Z=q.useRef(null),K=q.useRef(!1),Q=q.useRef(!1);Q.current=Y.length>0,q.useEffect(()=>{F(null);const e=U.current;Q.current?(K.current=!0,e&&(e.scrollTop=e.scrollHeight)):(K.current=!1,e&&(e.scrollTop=0)),I.current&&(clearTimeout(I.current),I.current=null),W(!1)},[r]);const G=q.useRef(!1),X=q.useCallback(()=>{if(G.current)return void(G.current=!1);const e=U.current;e&&(K.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},[]);q.useEffect(()=>{if(!E)return;const e=U.current,t=Z.current;if(!e||!t)return;const n=new ResizeObserver(()=>{K.current&&(G.current=!0,e.scrollTop=e.scrollHeight)});return n.observe(t),()=>n.disconnect()},[E]);const J=q.useCallback(()=>{K.current=!0;const e=U.current;e&&(G.current=!0,e.scrollTop=e.scrollHeight)},[]),$=q.useRef(null);q.useEffect(()=>{if(!E)return;const e=k.current;if(!e||$.current===e)return;const t=Y.findIndex(t=>"user"===t.type&&t.id===e);if(-1===t)return;if(!Y.slice(t+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))return;$.current=e,K.current=!1;const n=U.current,r=n?.querySelector(`[data-turn-anchor="${e}"]`),o=r?.firstElementChild??null;if(n&&o){const e=o.getBoundingClientRect().top-n.getBoundingClientRect().top;Math.abs(e-4)>1&&(G.current=!0,n.scrollTop+=e-4)}},[E,Y,k]);const te=q.useMemo(()=>z?function(e,t){const n=[],r=new Set,o=(e,t,o)=>{t&&!r.has(na(t))&&(r.add(na(t)),n.push(null!=o?{id:e,src:t,color:o}:{id:e,src:t}))};if(t){const r=(t.options??[]).findIndex(e=>ta.test("string"==typeof e?e:e?.name||""));if(r>=0){const e=new Set;for(const n of t.variants){const t=De(n,r+1);t&&!e.has(t)&&(e.add(t),o(`color:${t}`,n.featured_image?.src,t))}}for(const[e,a]of(t.images??[]).entries()){if(n.length>=8)break;o(`img:${e}`,a)}return 0===n.length&&o("main",e.image),n.slice(0,8)}const a=e.variant_summary?.options?.find(e=>ta.test(e.name||""));if(a?.values?.some(e=>e.image))for(const i of a.values)o(`color:${i.value}`,i.image,i.value);return 0===n.length&&o("main",e.image),n.slice(0,8)}(z,D):[],[z,D]);if(!z)return null;const ne=te[0]?.src||z.image,re=te.length>0?te:ne?[{id:"hero",src:ne}]:[],oe=n(h),ce=(z.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),he=(z.currency||h?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",me=Boolean(z.is_on_sale&&null!=z.sale_price&&z.sale_price>0&&null!=z.price&&z.sale_price<z.price),be=me&&z.sale_price?z.sale_price:z.price,xe=e=>i("focus_path_clicked",{assistantId:h?.assistant_id,threadId:g.threadId,payload:{product_id:z.id,path:e,mode_version:"focused_chat_v2"}}),ye=Ve(z,h),ve=null!==ye,we=(e,t)=>{xe(e),J(),p({message:t,apiMessage:`${t} (product id: ${z.id})`,focusScoped:!0})},ke=!0===h?.feature_flags?.hide_price_check,Ce=(e,t,n)=>O.jsxs(ee,{variant:"outline",h:j.length(40),px:j.space(2),gap:j.space(1.5),fontSize:j.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",borderRadius:j.radius(10),bg:"background",justifyContent:"center",_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},onClick:n,fontFamily:pe,children:[O.jsx(de,{src:e,alt:"",w:j.length(15),h:j.length(15),objectFit:"contain",flexShrink:0}),O.jsx(ae,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),je=v(z.id);return O.jsxs(ae,{position:"absolute",inset:0,zIndex:30,bg:"background","data-dori-sheet":"true","data-focus-mode":"true",transform:R&&!_?"translateX(0)":"translateX(100%)",transition:L?"none":"transform 180ms ease-out",children:[O.jsxs(bn,{direction:"column",h:"full",minH:0,children:[O.jsxs(bn,{align:"center",gap:j.space(2),px:j.space(4),py:j.space(2.5),flexShrink:0,borderBottom:"1px solid",borderColor:"borderColor",bg:"background",children:[O.jsx(fn,{ref:A,"aria-label":S("back"),size:"sm",variant:"ghost",color:"text",borderRadius:"full",minW:j.length(34),w:j.length(34),h:j.length(34),p:j.space(0),flexShrink:0,css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:()=>M("back"),children:O.jsx(_n,{boxSize:j.length(16)})}),z.image&&O.jsx(de,{src:z.image,alt:z.name,w:j.length(38),h:j.length(38),objectFit:"cover",onLoad:Qe,borderRadius:j.radius(8),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:j.font(13.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:z.name}),O.jsxs(ue,{gap:j.space(1.5),align:"center",children:[me&&null!=z.price&&O.jsx(fe,{fontSize:j.font(11),color:"mutedText",textDecoration:"line-through",fontFamily:pe,children:Ne(z.price,he)}),!!be&&be>0&&O.jsx(fe,{fontSize:j.font(12.5),fontWeight:700,color:"text",fontFamily:pe,children:Ne(be,he)}),z.price_on_request&&O.jsx(fe,{fontSize:j.font(12.5),fontWeight:700,color:"text",fontFamily:pe,children:S("priceOnRequest")}),me&&!!z.sale_percent_off&&O.jsxs(pn,{bg:"errorBackground",color:"error",fontSize:j.font(10),borderRadius:j.radius(12),children:[z.sale_percent_off,"%"]})]})]}),y&&O.jsx(fn,{"aria-label":S(je?"removeSaved":"saveForLater"),size:"sm",variant:"ghost",minW:j.length(34),w:j.length(34),h:j.length(34),p:j.space(0),borderRadius:"full",flexShrink:0,color:je?"primary":"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:()=>w(z),children:je?O.jsx(Mn,{boxSize:j.length(17)}):O.jsx(Ln,{boxSize:j.length(17)})}),e&&O.jsx(fn,{"aria-label":"Close",size:"sm",variant:"ghost",minW:j.length(34),w:j.length(34),h:j.length(34),p:j.space(0),borderRadius:"full",flexShrink:0,color:"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:e,children:O.jsx(wn,{boxSize:j.length(13)})})]}),O.jsx(ae,{ref:U,flex:1,minH:0,overflowY:"auto",overflowX:"hidden",overscrollBehavior:"contain","data-scroll-container":"focus-mode",onScroll:X,px:j.space(4),py:j.space(3),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:O.jsxs(ge,{ref:Z,align:"stretch",gap:j.space(3.5),children:[te.length>1?O.jsx(io,{slides:te,activeColor:null,height:ht(j,"gallery"),bgColor:"lightBackground",alt:z.name,onImageClick:e=>F(e)}):ne&&O.jsx(de,{src:ne,alt:z.name,role:"button",tabIndex:0,w:"full",h:ht(j,"single"),objectFit:"contain",borderRadius:j.radius(12),bg:"lightBackground",cursor:"zoom-in",onClick:()=>F(0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),F(0))}}),!!z.description&&O.jsx(ae,{borderRadius:j.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",px:j.length(10),py:j.length(6),bg:"lightBackground",children:O.jsx(fe,{fontSize:j.font(12.5),color:"text",lineHeight:"1.5",lineClamp:3,fontFamily:pe,children:z.description})}),z.variant_summary&&O.jsx(Zo,{variantSummary:z.variant_summary}),O.jsxs(ge,{align:"stretch",gap:j.space(1.5),children:[O.jsx(fe,{fontSize:j.font(11),fontWeight:600,color:"mutedText",textTransform:"uppercase",letterSpacing:"0.05em",fontFamily:pe,children:S("needHelpDeciding")}),O.jsxs(ae,{display:"grid",gridTemplateColumns:`repeat(${ke?2:3}, minmax(0, 1fr))`,gap:j.space(1.5),children:[Ce("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAY7klEQVR42tV7eZhU1bXvb+29z6mq7oamm0kGBZmEBlESPlEcqmX0xjhCNdg4RqM3GC6+jyRivpdX1PfevZrnM04vajDRvCuiVDnF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kBDtTmG6dePgZ1wBOrXl4bkBlcokLb7pz1yzEfff65X7gHAE7pDcy/aX6LMeaIzdzfDwB5gibddvXQfS31cwKjo8ba7m0ZXiE1Z1BgdE+GlQShHan2AoBvdA8GK0HCOFLtYXCh840L9QghaF/YCa3s3a3nw68+9Mym7woEOnGpz+XpY6snXd1iMk9qtl2ttbm4prPgJueLCpx18l0nZDGDGZBCQAnZVBouufn9P7+eKjz7ewOg0FsYveWyc3c27H1XGy2klJAsWgnYBsIhtr19KYDyzuDg72w748T5XJmZB1jYImMMXNflvqU9z39z4Uvvx9o1Pn8fEiCYmUfNuOB9j/U4YiAs3WTfbuV3vv6Hl7bR0dS5jiZxYqZLb5522jcte+7OmuAaBhBW7j8+eSZ9LuXqdSflFbvOKrSYesu0kcOmnWsHTzvHjr4mWsPMrpIKzOwU3grLD6fdOPh3p5P5He7Nr+mOvia6bsi0c+zw2Hl26uxpI0/0RUuFE+vNsc0mM5IUWQTgQAennD1rwrpRMy5UZ197saVDOsIO7hKjTk4JO07LWU/ikTMuFGOuncCBMWXMZKAkZY0/Gu06v08qAKjMHa65rgqLQEn2NTwblHm+Lus8k6V2Lv1wMQ4dpq3y0MxJKAWlXLc9LScVgHQid7zco6jnK/WNjX9zIkVngckW9i3Xjd0eB8r/HPqOEB3muJw6ygZR7o0eQEJIFp+Vu93+CoDytHx/cQABWPJGstQLSo5o9LrnP+s6+a79VZf/vrm5mUpKSrjwWQcg5Dg0c/KUBvsdvGT+fwEvnYKDff9ehQAAAABJRU5ErkJggg==",S("compareAction"),()=>we("compare",S("compareIntent").replace("{name}",z.name))),Ce("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVVklEQVR42t17e5xU1ZXut/bjnKrqbmleDSrGZHzwEALSiKjgqcZG0RGNSapvANF4o0OuoxF/SjQzv5uyvXeSEJM7xqC5zniTESXj7fpNYpxkFBC6SxBBacCAqIlMIgaFlnd3ddU5Z++97h9VhQ0+iDeho+5/u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lhkiPngmmE0y4aEQJZ5ovHzh6//xg9P9S08829z10him1laH1rx55/hGPxqg2upSqWWlQjyfBCE2Rpb9JFlBhGSqXD8coO8tvkv3YCBnmeEYoJeGTuvctf2xXVqJ4cawZThyTkDp2iez2axI7uuwdMv7H8DovyMzHeXI7DODhq4l43qISBKIqazESRhXOH3Q0NV9+x5DAOJcW0aMbWrpIemtTngSJNgpSbIQukNDGsasbm1tdem7OuxH48hMOTkpfvzt/7NbKrWBpCgL2GAnlIBWesOPv/3j3ZXk8x9VBDV0aBcBIKVT/0FlSuMSvmSS3toxM27ey1mIY2WF+vXcYBAEggH4ylsupACXCwRYCImE9lYwyvXD+KNLcdMOANeccMqqnpANO0tSSlI69SsA6Egfe65+NUCVFtcnBzxN5eSWAEMQM+pSdav69vljWmtrq8tms2LSFXfvECqx/ORhdV5vJEp+7fBfAaCKgT56h6fb2tr0tx5/4NXQxZ9mBhJKvznvylmn39ZyW+nDHp6u4vnqX357YK3dkekJdee0lvs6q//HR61lMuVE5cybW2ZNnHfRW43XXLS76W9mff7PeVKMP4SQ//8Ae5YJEhPYjogAAAAASUVORK5CYII=",S("similarAction"),()=>we("similar",`${S("doYouHaveSimilar")} ${z.name}`)),!ke&&Ce("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVpElEQVR42s2beZyU1ZX3f+feZ+2NpluaIIYIcUEwEGiNW5yiBRS3OPqmUGlEQG2Zd4S4ZN5ETT5FzRsSEycqkDjayhpc6EokBhRkr2iMII3LCE40ajJJRNmapbue7d575o/qxoZIBFnv59N/dD1PVT2/7z3n3HPPPUXYdzAIBAJgOl4SIBgwJAkoo0kKyU/Pf9rZmmwtXbN2DXvdqkphdMnr729Ej+qeFQZc+uHmD6l7dfduuws7nSCI7PKKii8ooxPLEu+eXNWjeWb25x8CQDqdlrlcTuMYDdrrv0xGIJs1ADBiUv3ZO8MdI6I46SeIugVhQFLKEimt8iAMISQcS9rlcRJDkvBICDfRCYQQ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DKZjEC6KL52zPBH9oh3Xb+sc7TfT4Z33FjAPj/KZEHEA0YPeSqGvk6FScH2nRJfOE2vzlp6HREx0u2BOQdNAM4ae/GjrTpsSMIosD3XL5clTWtmLT64JOe4APCJO0AKYc4ed8lTu5PCdSqIA+lavivsRf2/2GfSE1Me/4ABTLj/rpp1G968v1WFY1QUB5bn+hXSa1oz64VDNvtjBqDzb5OZmc9vuGzmzrBtrAqTWNrSkUxtlrRfAUMpo85KyFTrRIW253rltt+0ZsbiQwp4xweATj/XI8CcM27ET9t0eGcSJ2BjQLLYpKK0ARHguA7KLP/JV2Y8N/pwiz8qQXC/dgAwZyBembXkrhNKK/+P73prLWklAgQBwJGSSxxvY1enpOHVmYvrqVifOqzij6UFdAoMEMjCWELiijuurd28reUUNkZUVVX+9cGLb1x72mWXRZ2e87AfvPwvV+e0GtOjKzYAAAAASUVORK5CYII=",S("worthItAction"),()=>we("price_check",S("priceCheckIntent").replace("{name}",z.name)))]}),!!z.url&&O.jsxs(ee,{variant:"outline",h:j.length(40),w:"full",px:j.space(3),fontSize:j.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",bg:"background",justifyContent:"center",gap:j.space(1.5),borderRadius:j.radius(10),onClick:()=>{xe("product_page"),z.url&&h&&(c(z,h,g.threadId),Gr(Gn(z.url),C))},_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},fontFamily:pe,children:[O.jsx(Cn,{boxSize:j.length(13)}),S("productPage")]})]}),Y.length>0&&O.jsx(ge,{align:"stretch",gap:j.space(2),children:Y.reduce((e,t)=>{const n=O.jsx(Ro,{message:t,isStreaming:t.id===V,isAfterProducts:"products"===e.prevType},t.id);return e.elements.push("user"===t.type?O.jsx("div",{"data-turn-anchor":t.id,style:{display:"contents"},children:n},t.id):n),e.prevType=t.type,e},{elements:[],prevType:""}).elements})]})}),O.jsxs(ge,{flexShrink:0,align:"stretch",gap:j.space(2),px:j.space(4),pt:j.space(2.5),borderTop:"1px solid",borderColor:"borderColor",bg:"background",children:[oe&&O.jsxs(ee,{h:j.length(44),borderRadius:j.radius(12),fontSize:j.font(14),fontWeight:600,bg:"primary",color:"buttonText",w:"full",gap:j.space(1.5),onClick:()=>{ye?Gr(ye.href,C):(xe("add"),J(),ce?a(z,"focus_mode"):l({product_id:null!=z.id?String(z.id):void 0,product_name:z.name,product_url:z.url||void 0,product_handle:He(z.url)||void 0,quantity:u(z),quantity_label:d(z)}))},_hover:{opacity:.92},fontFamily:pe,children:[ve?null:O.jsx(In,{boxSize:j.length(16)}),S(ve?ye.labelKey:"addToCartFull")]}),O.jsx(ae,{children:O.jsx(Qn,{state:b,placeholder:S("generating"===b?"processing":"askAboutProduct"),onSend:x?void 0:(e,t)=>(J(),p({message:e.message,imageUrl:e.imageUrl,focusScoped:!0},t)),onStop:f})})]})]}),null!=B&&re.length>0&&O.jsx(ea,{slides:re,initialIndex:Math.min(B,re.length-1),alt:z.name,onClose:()=>F(null)})]})},oa=({open:e,onClose:t,title:n,children:r,onBack:o,footer:a})=>{const i=se(),s=q.useRef(null);return $o(e,o??t),q.useEffect(()=>{if(!e)return;const n=document.activeElement,r=e=>{"Escape"===e.key&&(e.preventDefault(),t())};window.addEventListener("keydown",r);const o=requestAnimationFrame(()=>{const e=s.current?.querySelector("[data-sheet-initial-focus='true']");(e||s.current)?.focus({preventScroll:!0})});return()=>{cancelAnimationFrame(o),window.removeEventListener("keydown",r),n?.focus?.({preventScroll:!0})}},[e,t]),e?O.jsxs(ae,{position:"absolute",inset:0,zIndex:30,"data-dori-sheet":"true",children:[O.jsx(ae,{position:"absolute",inset:0,bg:"blackAlpha.500",onClick:t,"aria-hidden":"true"}),O.jsxs(bn,{ref:s,tabIndex:-1,position:"absolute",bottom:0,left:0,right:0,direction:"column",bg:"background",borderTopRadius:"16px",maxH:"82%",pb:i.space(3),borderTop:"1px solid",borderColor:"borderColor",boxShadow:"0 -8px 24px rgba(0,0,0,0.18)",role:"dialog","aria-modal":"true","aria-label":n||void 0,children:[O.jsx(ae,{w:i.length(36),h:i.length(4),borderRadius:i.radius(2),bg:"borderColor",mx:"auto",mt:i.space(2),mb:i.space(1),flexShrink:0}),O.jsxs(bn,{align:"center",justify:"space-between",px:i.space(4),py:i.space(1),flexShrink:0,gap:i.space(2),children:[O.jsxs(bn,{align:"center",gap:i.space(1.5),minW:0,children:[o&&O.jsx(fn,{"aria-label":"Back",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:o,children:O.jsx(_n,{boxSize:i.length(13)})}),O.jsx(fe,{fontSize:i.font(14),fontWeight:"600",color:"text",lineHeight:"1.3",fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:n||""})]}),O.jsx(fn,{"aria-label":"Close",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:t,children:O.jsx(wn,{boxSize:i.length(10)})})]}),O.jsx(ae,{flex:1,minH:0,overflowY:"auto","data-scroll-container":"sheet",px:i.space(4),pt:i.space(1),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},children:r}),a&&O.jsx(ae,{flexShrink:0,px:i.space(4),pt:i.space(2.5),borderTop:"1px solid",borderColor:"borderColor",children:a})]})]}):null},aa=()=>{const e=se(),{variantModalProduct:t,variantModalSource:n,openVariantModal:r,addToCartDirect:o,botData:a,chatState:s,isTestMode:l}=ie(),{t:c}=le(),d=q.useRef(null),[u,p]=q.useState(null),[f,h]=q.useState(1),[g,m]=q.useState("idle"),[b,x]=q.useState(null),[y,v]=q.useState(null),w=t,k=null!=w?.id?String(w.id):null,C=q.useRef(k);if(q.useEffect(()=>{C.current!==k&&(C.current=k,null!=k&&(p(null),h(1),m("idle"),x(null),v(null)))},[k]),!w)return null;const j=y??w.selected_color??null,S=(j?w.variant_summary?.options?.flatMap(e=>e.values).find(e=>e.value===j&&e.image)?.image:null)||w.image,z=(w.currency||a?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",E=()=>{d.current&&(clearTimeout(d.current),d.current=null),p(null),h(1),m("idle"),x(null),v(null),r(null)},A="focus_mode"===n?E:void 0,R=u?.canAdd??!1,T=u?.priceCents??null,_=null!=T?Ne(T/100*f,z):null,W=gt(e),I=!R&&"added"!==g,L="added"===g?`✓ ${c("addedToCart")}`:R?_?c("addQty").replace("{qty}",String(f)).replace("{price}",_):c("addToCartFull"):c("selectOptionsToContinue"),M=(e,t,n)=>O.jsx(ee,{variant:"ghost",size:"xs",minW:`${W.stepper}px`,h:`${W.stepper}px`,borderRadius:0,fontSize:`${W.stepperFont}px`,color:t?"mutedText":"text",disabled:t||"adding"===g||"added"===g,onClick:n,"aria-label":e,children:e}),B=O.jsxs(ge,{align:"stretch",gap:e.space(1.5),pb:e.space(1),children:[O.jsxs(ue,{gap:e.space(2.5),align:"center",children:[O.jsxs(ue,{gap:e.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:e.radius(10),overflow:"hidden",flexShrink:0,children:[M("−",f<=1,()=>h(e=>Math.max(1,e-1))),O.jsx(fe,{fontSize:`${W.stepperFont}px`,fontWeight:600,minW:`${W.qtyWidth}px`,textAlign:"center",color:"text",fontFamily:pe,children:f}),M("+",f>=10,()=>h(e=>Math.min(10,e+1)))]}),O.jsxs(ee,{flex:1,h:`${W.cta}px`,borderRadius:`${W.ctaRadius}px`,fontSize:`${I?W.ctaHintFont:W.ctaFont}px`,fontWeight:600,bg:"primary",color:"buttonText",gap:e.space(1.5),disabled:!R&&"added"!==g||"adding"===g,loading:"adding"===g,onClick:async()=>{if(!u?.canAdd||"adding"===g||"added"===g)return;m("adding"),x(null);const e=null!=w.id?String(w.id):void 0,t=u.variantId?{variant_id:u.variantId,product_id:e,product_name:w.name,quantity:f}:{product_id:e,product_name:w.name,product_url:w.url,selected_options:u.selectedOptions,quantity:f},n=Ve(w,a);if(n)return void Gr(n.href,l);const r=await o(t);"success"===r.type?(m("added"),i("variant_modal_added",{assistantId:a?.assistant_id,threadId:s.threadId,payload:{product_id:w.id,selected:u.selectedLabel,quantity:f}}),d.current=setTimeout(E,900)):"failed"===r.type&&"busy"===r.reason?m("idle"):(m("error"),x(Ue(r,c)||null))},_hover:{opacity:.92},fontFamily:pe,"data-sheet-initial-focus":"true",children:[O.jsx(In,{boxSize:`${W.ctaIcon}px`,flexShrink:0}),O.jsx(ae,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:L})]})]}),"error"===g&&O.jsx(fe,{fontSize:e.font(11),color:"error",fontFamily:pe,children:b||c("errorOccurred")})]});return O.jsx(oa,{open:!0,onClose:E,onBack:A,title:c("chooseOptions"),footer:B,children:O.jsxs(ge,{align:"stretch",gap:e.space(3),pb:e.space(2),children:[O.jsxs(ue,{gap:e.space(2.5),align:"center",children:[S&&O.jsx(de,{src:S,alt:w.name,w:e.length(52),h:e.length(52),objectFit:"cover",onLoad:Qe,borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground"}),O.jsxs(ae,{minW:0,children:[O.jsx(fe,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:w.name}),O.jsx(fe,{fontSize:e.font(12),color:"mutedText",fontFamily:pe,children:u?.selectedLabel||(w.price?Ne(w.price,z):"")})]})]}),O.jsx(oo,{product:w,controlled:!0,selectedColor:j,onColorChange:v,onSelectionChange:e=>{p(e),"error"===g&&(m("idle"),x(null))}},String(w.id))]})})},ia=()=>{const e=se(),{shortlist:t,removeFromShortlist:n,shortlistOpen:r,setShortlistOpen:o,enterFocusMode:a,sendMessage:s,botData:l,chatState:c}=ie(),{t:d}=le();if(q.useEffect(()=>{r&&i("shortlist_opened",{assistantId:l?.assistant_id,threadId:c.threadId,payload:{count:t.length}})},[r]),!r)return null;const u=()=>o(!1),p=(e,t)=>{const n=(t||l?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD";return Ne(e,n)},f=t.length>=2?O.jsx(ee,{w:"full",h:e.length(40),borderRadius:e.radius(12),fontSize:e.font(14),fontWeight:600,bg:"primary",color:"buttonText",onClick:()=>{const e=t.map(e=>e.name).join(", "),n=t.map(e=>e.id).join(", "),r=d("compareSavedIntent").replace("{names}",e);i("shortlist_compare_clicked",{assistantId:l?.assistant_id,threadId:c.threadId,payload:{count:t.length}}),u(),s({message:r,apiMessage:`${r} (product ids: ${n})`})},_hover:{opacity:.92},fontFamily:pe,children:d("compareSaved").replace("{count}",String(t.length))}):void 0;return O.jsx(oa,{open:!0,onClose:u,title:d("savedProducts"),footer:f,children:O.jsxs(ge,{align:"stretch",gap:e.space(1.5),pb:e.space(2),children:[0===t.length&&O.jsx(fe,{fontSize:e.font(13),color:"mutedText",textAlign:"center",py:e.space(6),fontFamily:pe,children:d("savedEmpty")}),t.map(t=>O.jsxs(ue,{gap:e.space(2.5),align:"center",p:e.space(1.5),borderRadius:e.radius(12),cursor:"pointer",onClick:()=>{u(),a(t,"shortlist")},_hover:{bg:"lightBackground"},transition:"background 0.15s",children:[t.image&&O.jsx(de,{src:t.image,alt:t.name,w:e.length(44),h:e.length(44),objectFit:"cover",onLoad:Qe,borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:t.name}),!!t.price&&t.price>0&&O.jsx(fe,{fontSize:e.font(12),color:"mutedText",fontFamily:pe,children:p(t.price,t.currency)}),t.price_on_request&&O.jsx(fe,{fontSize:e.font(12),color:"mutedText",fontFamily:pe,children:d("priceOnRequest")})]}),O.jsx(fn,{"aria-label":d("removeSaved"),size:"xs",variant:"ghost",minW:e.length(28),w:e.length(28),h:e.length(28),p:e.space(0),borderRadius:"full",color:"primary",css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:e=>{e.stopPropagation(),n(t.id)},children:O.jsx(Mn,{boxSize:e.length(14)})})]},String(t.id)))]})})},sa=({isOpen:n,onClose:r,isExpanded:o=!1,onToggleExpand:a,fullPageHref:i,pendingChat:s,onPendingChatConsumed:l})=>{const{sendMessage:c,addWelcomeMessage:d,resetBot:u,chatState:p,focusedProduct:f,isInputDisabled:h}=ie(),{showSuggestionScreen:g,goToChat:m,goToSuggestion:b}=(n=>{const[r,o]=q.useState(!0),a=q.useRef(!1),i=q.useRef(!1);return q.useEffect(()=>{if(!i.current){const n=e();t()&&n.length>0&&(a.current=!0,o(!1),console.log("Skipping welcome screen - existing messages found:",n.length)),i.current=!0}},[]),q.useEffect(()=>{n&&!a.current?o(!0):n&&a.current&&o(!1)},[n]),{showSuggestionScreen:r,goToChat:q.useCallback(()=>{a.current=!0,o(!1)},[]),goToSuggestion:q.useCallback(()=>{a.current=!1,o(!0)},[])}})(n);q.useEffect(()=>{g&&(p.isRequestInProgress||f)&&m()},[g,p.isRequestInProgress,f,m]);const{isMobile:x}=ye(),y=q.useRef(!1);q.useEffect(()=>{n&&!y.current&&(C(),y.current=!0)},[n]);const v=x,w=(e,t,n)=>{m(),d(),c({message:e,imageUrl:t,apiMessage:n})};q.useEffect(()=>{if(n&&s&&!h){const e=setTimeout(()=>{w(s.message,s.imageUrl,s.apiMessage),l?.()},100);return()=>clearTimeout(e)}},[n,s,h]);return O.jsxs(Vo,{showSuggestionScreen:g,isOpen:n,isExpanded:o,onClose:r,children:[g?O.jsx(Kr,{onStartChat:w,isMobile:v,isExpanded:o,onToggleExpand:a,fullPageHref:i,onClose:r}):O.jsx(No,{header:O.jsx(Pn,{onClose:r,isMobile:v,isExpanded:o,onToggleExpand:a,fullPageHref:i,onReload:()=>{u(),b()}})}),O.jsx(ra,{onClose:r}),O.jsx(aa,{}),O.jsx(ia,{})]})};function la(e,t=!1){const n=e?.feature_flags,r=(t?n?.mobile_fab_scale:void 0)??n?.fab_scale??e?.customization?.avatar_fab_scale;return"number"==typeof r&&Number.isFinite(r)?Math.min(1.5,Math.max(.4,r)):1}const ca="0 6px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06)",da={size:"xs",flexShrink:0,h:"32px",px:3,borderRadius:"full",bg:"primary",color:"buttonText",fontSize:"12px",fontWeight:600,fontFamily:pe,whiteSpace:"nowrap",transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},ua=q.forwardRef(function({icon:e,children:t,action:n,actionBelow:r=!1,onClose:o,closeLabel:a,maxW:i},s){return O.jsxs(ue,{ref:s,gap:2,align:r?"flex-start":"center",maxW:i,minH:"44px",py:r?2.5:1.5,ps:3,pe:1,bg:"background",borderRadius:"22px",border:"1px solid",borderColor:"borderColor",boxShadow:ca,children:[O.jsx(ae,{flexShrink:0,display:"flex",color:"primary",mt:r?"2px":0,children:e}),O.jsxs(ae,{flex:"1",minW:0,children:[t,r&&n?O.jsx(ae,{mt:2,children:n}):null]}),r?null:n,O.jsx(fn,{size:"xs",variant:"ghost","aria-label":a,onClick:o,flexShrink:0,w:"28px",minW:"28px",h:"28px",borderRadius:"full",color:"text",opacity:.55,transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:O.jsx(wn,{boxSize:"12px"})})]})}),pa=()=>!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function fa(e,t,n,r){const o=q.useRef(null),a=q.useRef(r);a.current=r;const i=q.useRef(n);return i.current=n,q.useEffect(()=>{if(!e)return;o.current?.focus({preventScroll:!0});const n=e=>{const n=o.current;if(!n)return;if("Escape"===e.key)return t&&e.stopPropagation(),void i.current();if(!t||"Tab"!==e.key)return;const r=Array.from(n.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])')),a=function(e){return e.getRootNode().activeElement??null}(n),s=r[0],l=r[r.length-1];if(s&&a&&n.contains(a))!e.shiftKey||a!==s&&a!==n?e.shiftKey||a!==l||(e.preventDefault(),s.focus()):(e.preventDefault(),l.focus());else{e.preventDefault();const t=e.shiftKey?l:s;t?t.focus():n.focus()}};return document.addEventListener("keydown",n,!0),()=>{document.removeEventListener("keydown",n,!0),a.current?.()}},[e,t]),o}function ha({layer:e,open:t,onCollapse:n,onClosed:r,label:o,children:a}){const i=fa(t,!0,n,r),[s,l]=q.useState(!1);if(q.useEffect(()=>{if(!t)return void l(!1);const e=requestAnimationFrame(()=>l(!0)),n=document.documentElement,r=n.style.overflow;return n.style.overflow="hidden",()=>{cancelAnimationFrame(e),n.style.overflow=r}},[t]),!e)return null;const c=pa()?void 0:"transform 220ms ease-out, opacity 220ms ease-out";return sn.createPortal(O.jsxs(ae,{display:t?"block":"none",children:[O.jsx(ae,{position:"fixed",inset:0,zIndex:1000001,bg:"blackAlpha.400",opacity:s?1:0,transition:c,touchAction:"none",onClick:n,"aria-hidden":!0}),O.jsxs(ae,{ref:i,role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,outline:"none",position:"fixed",left:0,right:0,bottom:0,zIndex:1000002,display:"flex",flexDirection:"column",bg:"background",borderTopRadius:"20px",boxShadow:"0 -8px 32px rgba(0,0,0,0.14)",css:{maxHeight:"85vh","@supports (height: 1dvh)":{maxHeight:"85dvh"}},transform:s||pa()?"none":"translateY(24px)",opacity:s?1:0,transition:c,children:[O.jsx(ae,{as:"button",tabIndex:-1,"aria-hidden":!0,onClick:n,py:2.5,flexShrink:0,cursor:"pointer",children:O.jsx(ae,{w:"36px",h:"4px",mx:"auto",borderRadius:"full",bg:"blackAlpha.300"})}),O.jsx(ae,{overflowY:"auto",overscrollBehavior:"contain",px:4,pb:"calc(16px + env(safe-area-inset-bottom, 0px))",children:a})]})]}),e)}function ga({open:e,onCollapse:t,onClosed:n,label:r,children:o,w:a,maxH:i}){const s=fa(e,!1,t,n),l=q.useRef(t);return l.current=t,q.useEffect(()=>{if(!e)return;const t=e=>{s.current&&!e.composedPath().includes(s.current)&&l.current()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,s]),O.jsx(ae,{ref:s,display:e?"block":"none",role:"dialog","aria-label":r,tabIndex:-1,outline:"none",w:a,maxH:i,overflowY:"auto",overscrollBehavior:"contain",bg:"background",borderRadius:"20px",border:"1px solid",borderColor:"borderColor",boxShadow:ca,p:4,children:o})}function ma({isMobile:e,layer:t,w:n,maxH:r,...o}){return e?O.jsx(ha,{layer:t,...o}):O.jsx(ga,{w:n,maxH:r,...o})}const ba={size:"xs",borderRadius:"999px",fontSize:"12.5px",fontWeight:600,px:3,h:"28px",fontFamily:pe,transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},xa=e=>e&&"Default Title"!==e?e:"";function ya({api:e,row:t}){const n=e.rowFacts(t),{price:r,note:o}=n,a="added"===t.state?null!=t.paid&&t.paid<r-.005?Math.max(0,t.paid):null:n.pay,i=t.variants.filter(e=>e.available),s="added"===t.state?e.say(null,"added_check"):"sold"===t.state?e.say(null,"sold_out"):e.say(null,"add");return O.jsxs(ge,{align:"stretch",gap:1.5,py:2,borderTop:"1px solid",borderColor:"blackAlpha.100","data-dori-guide-row":t.pid,children:[O.jsxs(ue,{align:"flex-start",gap:2,children:[t.image?O.jsx(de,{src:t.image,alt:"",boxSize:"48px",objectFit:"cover",onLoad:Qe,borderRadius:"8px",flexShrink:0,bg:"blackAlpha.50"}):null,O.jsxs(ge,{align:"stretch",gap:.5,flex:1,minW:0,children:[O.jsx(fe,{fontSize:"12.5px",lineHeight:"1.3",lineClamp:2,fontFamily:pe,color:"text",children:t.title}),O.jsxs(fe,{fontSize:"12.5px",fontFamily:pe,color:"text",children:[O.jsx("b",{children:null==a?e.money(r):a<.005?e.say(null,"free"):e.money(a)}),null!=a?O.jsx("s",{style:{marginInlineStart:6,opacity:.6},children:e.money(r)}):null]}),o?O.jsx(fe,{fontSize:"11.5px",color:"mutedText",fontFamily:pe,children:o}):null,1===i.length&&xa(i[0].title)?O.jsx(fe,{fontSize:"11.5px",color:"mutedText",fontFamily:pe,children:i[0].title}):null]}),O.jsx(ee,{...ba,flexShrink:0,bg:"idle"===t.state?"primary":"blackAlpha.100",color:"idle"===t.state?"buttonText":"text",disabled:"idle"!==t.state||!t.chosen,loading:"adding"===t.state,onClick:()=>{e.add(t.pid)},"aria-label":`${s}: ${t.title}`,children:s})]}),i.length>1&&"added"!==t.state?O.jsx(ue,{gap:1,flexWrap:"wrap",ps:t.image?"56px":0,children:i.map(n=>O.jsx(ee,{...ba,h:"auto",minH:"24px",py:"3px",maxW:"100%",whiteSpace:"normal",textAlign:"start",lineHeight:"1.25",fontWeight:500,variant:"outline","aria-pressed":t.chosen===n.id,bg:t.chosen===n.id?"text":"transparent",color:t.chosen===n.id?"background":"text",onClick:()=>e.choose(t.pid,n.id),children:n.title},n.id))}):null]})}const va=({api:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{v:i,visible:s}=function(e){const[t,n]=q.useState(e),[r,o]=q.useState(!1);return q.useEffect(()=>{if(e){n(e);const t=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(t)}o(!1);const t=window.setTimeout(()=>n(null),200);return()=>window.clearTimeout(t)},[e]),{v:e??t,visible:!!e&&r}}(e.view),l=q.useRef(null);if(!i)return null;const c=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,d=!e.view,u=i.decision,p="add_this"!==u.cta&&"add_it"!==u.cta||!i.rows?.[0]?null:i.rows[0],f=p?.variants.find(e=>e.id===p.chosen)??null,h=p&&f?e.rowFacts(p):null,g=e.say(null,"close")||"Close",m=h?.note??i.note;let b=null;if(i.result)i.result.undoVid&&(b={label:e.say(null,"undo"),run:()=>{e.undo()},quiet:!0});else if("see_picks"===u.cta)b={label:e.say(null,"show_picks"),run:()=>{e.unfold()},opens:!0};else if(p&&"idle"===p.state){const t=h?null==h.pay?e.money(h.price):h.pay<.005?e.say(null,"free"):e.money(h.pay):"",n=f?[e.say(null,"add"),xa(f.title),t].filter(Boolean).join(" · "):"";b=n&&n.length<=40?{label:n,run:()=>{e.add(p.pid)}}:{label:e.say(null,"choose"),run:()=>{e.unfold()},opens:!0}}const x=b?O.jsx(ee,{ref:l,...da,...b.quiet?{bg:"blackAlpha.100",color:"text"}:{},"aria-haspopup":b.opens?"dialog":void 0,onClick:b.run,children:b.label}):null,y=i.result?O.jsx(fe,{fontSize:"13px",lineHeight:"1.35",color:"text",fontFamily:pe,children:i.result.text}):null,v=i.rows??[];return O.jsxs(ae,{opacity:s?1:0,transform:s||c?"none":"translateY(8px) scale(0.98)",transformOrigin:"bottom",transition:"opacity 200ms ease-out, transform 200ms ease-out",pointerEvents:d?"none":void 0,"aria-hidden":d||void 0,"data-dori-offer-guide":d?void 0:u.offer,children:[!i.open&&O.jsx(ua,{maxW:r,icon:O.jsx(In,{boxSize:"16px"}),closeLabel:g,onClose:e.close,action:x,actionBelow:!!b&&b.label.length>12,children:O.jsx(ae,{"aria-live":"polite",role:i.result?"status":void 0,children:y??O.jsxs(O.Fragment,{children:[O.jsx(fe,{fontSize:"13px",fontWeight:600,lineHeight:"1.35",color:"text",fontFamily:pe,children:i.line}),m?O.jsx(fe,{fontSize:"12px",lineHeight:"1.35",color:"mutedText",mt:.5,fontFamily:pe,children:m}):null]})})}),i.open&&O.jsx(ma,{isMobile:t,layer:n,open:!0,label:i.head||i.line,w:o,maxH:a,onCollapse:e.fold,onClosed:()=>l.current?.focus(),children:O.jsxs(ge,{align:"stretch",gap:2,children:[O.jsxs(ue,{align:"flex-start",gap:2,children:[O.jsx(fe,{flex:1,fontSize:"13px",fontWeight:600,lineHeight:"1.4",color:"text",fontFamily:pe,children:i.line}),O.jsx(fn,{size:"xs",variant:"ghost","aria-label":g,onClick:e.close,h:"auto",minW:"auto",p:1,color:"text",transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:O.jsx(wn,{boxSize:"14px"})})]}),i.head?O.jsx(fe,{fontSize:"12px",color:"mutedText",fontFamily:pe,children:i.head}):null,null==i.rows?O.jsx(ue,{justify:"center",py:4,children:O.jsx(be,{size:"sm",color:"primary"})}):v.length?v.map(t=>O.jsx(ya,{api:e,row:t},t.pid)):O.jsx(fe,{fontSize:"12.5px",color:"mutedText",py:2,fontFamily:pe,children:e.say(null,"sold_out")}),i.result?O.jsxs(ue,{role:"status","aria-live":"polite",gap:2,pt:1,borderTop:"1px solid",borderColor:"blackAlpha.100",children:[O.jsx(ae,{flex:1,children:y}),i.result.undoVid?O.jsx(ee,{variant:"plain",size:"xs",h:"auto",p:0,textDecoration:"underline",fontWeight:400,onClick:()=>{e.undo()},children:e.say(null,"undo")}):null]}):null]})})]})},wa="dori-quiz-dismissed";function ka(){try{return"true"===sessionStorage.getItem(wa)}catch{return!1}}function Ca(){try{sessionStorage.setItem(wa,"true")}catch{}}const ja=e=>null==e?null:{p:new Set(e.p),v:new Set(e.v||[])},Sa=(e,t)=>null===e||e.p.has(t.pid)||e.v.has(t.vid),za=e=>Math.round(100*e)/100;function Ea(e,t=new Date){const n=e.offers.filter(e=>!e.ends_at||new Date(e.ends_at)>t);return{pack:e,offers:n.map(e=>({o:e,scope:ja(e.scope),buys:ja(e.buys),gets:e.same?ja(e.buys):ja(e.gets)}))}}const Aa=e=>e.reduce((e,t)=>e+t.price*t.qty,0),Ra=e=>e.flatMap(e=>Array.from({length:e.qty},()=>({pid:e.pid,vid:e.vid,price:e.price}))),Ta=(e,t)=>null!=e.pct?t*e.pct:Math.min(e.amount??0,t);function _a(e,t,n){const r=new Map,o=e.offers.filter(e=>"ship"!==e.o.kind).map(e=>"basic"===e.o.kind?function(e,t){const n=e.o,r=Ra(t).filter(t=>Sa(e.scope,t)),o=r.reduce((e,t)=>e+t.price,0),a=r.length,i=a>0&&(!n.min_amount||o>=n.min_amount)&&(!n.min_qty||a>=n.min_qty),s=i?null!=n.pct?n.pct*o:n.each?r.reduce((e,t)=>e+Math.min(n.amount??0,t.price),0):Math.min(n.amount??0,o):0;return{off:e,applies:i,value:s,disc:i?r:[],amt:o,qty:a,gapAmount:n.min_amount?Math.max(0,n.min_amount-o):null,gapQty:n.min_qty?Math.max(0,n.min_qty-a):null}}(e,t):function(e,t){const n=e.o,r=n.buy_qty||1,o=n.get_qty||1,a=Ra(t);if(n.same){const t=a.filter(t=>Sa(e.buys,t)).sort((e,t)=>t.price-e.price);let i=Math.floor(t.length/(r+o));n.per_order&&(i=Math.min(i,n.per_order));const s=t.slice(t.length-i*o).sort((e,t)=>e.price-t.price),l=t.length-i*(r+o);return{off:e,applies:i>0,value:s.reduce((e,t)=>e+Ta(n,t.price),0),disc:s,el:t,earned:l>=r&&(!n.per_order||i<n.per_order)}}const i=a.filter(t=>Sa(e.buys,t)),s=a.filter(t=>Sa(e.gets,t)).sort((e,t)=>e.price-t.price),l=n.per_order?n.per_order*o:1/0,c=new Set;for(const f of s){if(c.size>=l)break;i.filter(e=>e!==f&&!c.has(e)).length>=r*Math.ceil((c.size+1)/o)&&c.add(f)}const d=s.filter(e=>c.has(e)),u=i.filter(e=>!c.has(e)).length,p=Math.min(Math.floor(u/r)*o,l);return{off:e,applies:d.length>0,value:d.reduce((e,t)=>e+Ta(n,t.price),0),disc:d,earned:p>d.length,hasGet:s.length>0,hasBuy:u>0}}(e,t));o.forEach(e=>r.set(e.off.o.id,e));const a=o.filter(e=>e.applies&&e.value>0).sort((e,t)=>t.value-e.value),i=a.slice(0,1),s=a.slice(1).some(e=>{return t=i[0].off.o,n=e.off.o,!!t.cw?.[n.cls||"product"]&&!!n.cw?.[t.cls||"product"];var t,n}),l=za(Aa(t))-i.reduce((e,t)=>e+za(t.value),0),c=e.offers.filter(e=>"ship"===e.o.kind).map(e=>{const t=((e,t)=>!e.countries||!!t.country&&e.countries.includes(t.country))(e.o,n),o={off:e,applies:t&&l>=(e.o.min??0),value:0,disc:[],gap:Math.max(0,(e.o.min??0)-l)};var a,s;return!o.applies||!i.length||(a=i[0].off.o,"rates"===(s=e.o).source||a.ship_ok&&("order"===a.cls?s.with_order:s.with_product))||(o.applies=!1,o.offBy=i[0].off),r.set(e.o.id,o),o}),d=i.concat(c.filter(e=>e.applies));return{st:r,applied:d,ids:new Set(d.map(e=>e.off.o.id)),base:l,stacked:s}}const Wa=(e,t,n)=>za(Aa(t))-_a(e,t,n).applied.reduce((e,t)=>e+za(t.value),0);function Ia(e,t,n,r){const o=_a(e,t,r);if(o.stacked)return!1;const a=o.applied.reduce((e,t)=>e+t.disc.length,0);return Math.abs(Wa(e,t,r)-n)<=.01*(a+1)+1e-9}const La=(e,t,n,r="")=>e.concat([{pid:t,vid:r,qty:1,price:n}]),Ma=(e,t,n,r,o,a="")=>Wa(e,La(t,n,r,a),o)-Wa(e,t,o),Ba=(e,t,n)=>t.speak&&!n.blocked.has(t.id)&&!("ship"===t.kind&&n.country!==e.pack.main_country)&&(!t.ends_at||new Date(t.ends_at)>new Date),Fa=(e,t)=>e.pack.products[t]?.p??0,Da=(e,t)=>e.pack.products[t]?.ty||"",Ha=(e,t)=>e.offers.find(n=>"ship"===n.o.kind&&Ba(e,n.o,t))?.o??null;function Pa(e,t,n){const r=function(e,t,n){const r=e=>!!e&&"basic"===e.off.o.kind&&!e.off.o.scope,o=n.applied.find(e=>r(e));return[...t.ids].filter(e=>!n.ids.has(e)).map(e=>t.st.get(e)).filter(e=>!(e.off.o.free_anyway||r(e)&&o&&o.value>e.value)).map(e=>e.off.o)}(0,t,n);return{block:r.find(e=>"ship"!==e.kind)??null,shipLost:r.find(e=>"ship"===e.kind)??null}}const qa=e=>e.pct??0;function Oa(e,t){const n=e.applied.find(e=>"basic"===e.off.o.kind&&!e.off.o.scope);return n&&!t.scope&&n.off.o.id!==t.id&&qa(n.off.o)<qa(t)?n.off.o:null}function Na(e,t,n,r,o,a,i){const s=e.offers.find(e=>e.o.id===n)?.o;if(!s||s.ends_at&&new Date(s.ends_at)<=new Date)return!1;const l=_a(e,t,i),c=_a(e,La(t,r,a,o),i);return c.ids.has(n)&&!c.stacked&&!Pa(0,l,c).block}function Ya(e,t,n,r){const o=t.o,a=new Set(n.map(e=>e.pid)),i=t=>!a.has(t)&&!r.sold.has(t)&&!!e.pack.products[t],s=new Set(n.map(t=>Da(e,t.pid)).filter(Boolean)),l=t=>Ma(e,n,t,Fa(e,t),r);let c=[];if("ship"===o.kind||"basic"===o.kind&&!o.scope&&o.min_amount){const t=e.pack.closers.filter(t=>(t=>!r.sold.has(t)&&!!e.pack.products[t])(t)&&_a(e,La(n,t,Fa(e,t)),r).ids.has(o.id)).map((e,t)=>({id:e,i:t,x:l(e)})).sort((e,t)=>e.x-t.x||e.i-t.i);if(t.length){const n=2*t[0].x;c=[t[0],...t.filter(t=>s.has(Da(e,t.id))&&t.x<=n),...t].map(e=>e.id)}}else if("basic"===o.kind)c=(o.scope?o.picks||[]:e.pack.closers).filter(i);else{c=(o.picks||[]).filter(e=>i(e)&&Sa(t.gets,{pid:e,vid:""}));const a=Ha(e,r);if(a?.fee){const t=t=>{const o=La(n,t,Fa(e,t));return Wa(e,o,r)+(_a(e,o,r).ids.has(a.id)?0:a.fee)},o=c.filter(t=>Va(e,n,t,Fa(e,t),r)).sort((e,n)=>t(e)-t(n));o.length&&(!c.length||t(o[0])<t(c[0])-.005)&&(c=[o[0],...c])}}return[...new Set(c)].filter(t=>l(t)<=Fa(e,t)+.005&&Na(e,n,o.id,t,"",Fa(e,t),r)).slice(0,3)}function Va(e,t,n,r,o){const a=Ha(e,o);return a&&!_a(e,t,o).ids.has(a.id)&&_a(e,La(t,n,r),o).ids.has(a.id)?a:null}function Ua(e){return null!=e.pct?Math.round(1e3*e.pct)/10+"%":e.amount??0}function Za(e,t){const n=(t||e.language||"en").toLowerCase(),r=n.split("-")[0],o=e.copy[n]?n:e.copy[r]?r:null;return o?{lang:o,copy:e.copy[o]}:null}const Ka=new Set(["US","GB","AE","NL","PH","CZ","DO","BS","GM","CF","KM","MV","MH","SB","VA","CD","CG"]),Qa=new Set(["gap","fee","fee_lo","fee_hi","saving","price","paid","eff"]);const Ga=9e3;function Xa(e){const t=Date.parse(e?.checked_at||e?.built_at||"");return e&&Number.isFinite(t)&&Date.now()-t<2592e5?e:null}const Ja=new WeakMap;function $a(e){if(!1===e?.customization?.enable_offer_guide)return!1;const t=Xa(e?.offer_guide);if(!t||!Za(t,mt()))return!1;let n=Ja.get(t);return n||(n=Ea(t),Ja.set(t,n)),r=n,o=bt(j()??null),r.offers.some(e=>Ba(r,e.o,o));var r,o}const ei=e=>String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"");function ti(e,t){const n=t.variants.map(e=>({id:String(e.id),title:String(e.title||""),available:!1!==e.available,price:Number(e.price??0)/100})),r=n.filter(e=>e.available);return{pid:e,title:t.title,image:t.images?.[0]??null,variants:n,chosen:1===r.length?r[0].id:null,state:r.length?"idle":"sold"}}function ni(e,t){const n=q.useMemo(()=>Xa(e?.offer_guide),[e?.offer_guide]),r=q.useMemo(()=>n?Ea(n):null,[n]),o=q.useMemo(()=>n?Za(n,mt()):null,[n]),[a,i]=q.useState(null),[s,c]=q.useState(!1),d=q.useRef(null),u=q.useRef(null),p=q.useRef(!1),f=q.useRef(0),h=q.useRef(t);h.current!==t&&(h.current=t,t||(f.current+=1));const g=q.useRef(null),m=q.useRef(!1),b=j()??null,x=q.useCallback(e=>{d.current=e,i(e)},[]),y=q.useCallback(e=>{g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const e=d.current;!e||p.current||e.open||x(null)},e)},[x]),v=q.useCallback((e,t,r={})=>{if(!o||!n)return"";const a=function(e,t,n){return(t?e.copy.offers[t]?.[n]:void 0)??e.copy.ui[n]??null}(o,e,t),i=e?n.offers.find(t=>t.id===e)??null:null;return a?function(e,t,n,r,o){const a={...t};return o&&null==a.off&&(a.off=Ua(o)),o?.countries?.length&&null==a.country&&(a.country=function(e,t){try{const n=new Intl.DisplayNames([t],{type:"region"}).of(e)||e;return"en"===t&&Ka.has(e)?`the ${n}`:n}catch{return e}}(o.countries[0],r)),e.replace(/\{([a-z_]+)\}/g,(e,t)=>{const r=a[t];return null==r?e:"number"!=typeof r||!Qa.has(t)&&"off"!==t?String(r):Ne(r,n.currency)})}(a,r,n,o.lang,i):""},[o,n]),w=q.useCallback((e,t,n,o,a=()=>!0)=>{if(!r)return null;const i=e.variants.map(i=>({...i,available:i.available&&Na(r,n,t,e.pid,i.id,i.price,o)&&a(i)})),s=i.filter(e=>e.available);if(!s.length)return null;const l=1===s.length?s[0].id:s.some(t=>t.id===e.chosen)?e.chosen:null;return{...e,variants:i,chosen:l}},[r]),k=q.useCallback(async()=>{const e=f.current;if(!r||!o||!t||p.current||xt()||yt())return;const n=d.current;if(n&&(n.open||n.result))return;const a=await vt(),i=bt(b);if(!a||a.unknown||a.currency!==r.pack.currency||!Ia(r,a.lines,a.total,i))return void(n&&x(null));if(u.current=a,n&&n.cart===wt(a.lines))return;const s=await async function(){const e=window.ShopifyAnalytics?.meta?.product;if(!e?.id||!Array.isArray(e.variants)||!e.variants.length)return null;const t=new URLSearchParams(window.location.search).get("variant"),n=e.variants.find(e=>String(e.id)===t)??(1===e.variants.length?e.variants[0]:null),r=n?Number(n.price)/100:Math.min(...e.variants.map(e=>Number(e.price)/100));return{pid:String(e.id),vid:n?String(n.id):"",price:r}}(),c=function(e,t,n,r){const o=_a(e,t,r);if(o.stacked)return{quiet:"two discounts combine here"};const a=Aa(t);if(n&&!t.some(e=>e.pid===n.pid)){const a=La(t,n.pid,n.price,n.vid),i=_a(e,a,r),{block:s,shipLost:l}=Pa(0,o,i),c=i.applied.filter(t=>Ba(e,t.off.o,r)&&(!o.ids.has(t.off.o.id)||t.value>(o.st.get(t.off.o.id)?.value??0)+.001));if(c.length&&!s&&!i.stacked){const i=c[0],s=i.off.o,d={offer:s.id,cta:"add_this",picks:[n.pid],shipNote:!!l};if("ship"===s.kind)return{...d,key:t.length?"page_add":"page_alone",vars:{}};if("basic"===s.kind){const e=Oa(o,s);return e?{...d,key:"page_move",vars:{from:Ua(e)}}:{...d,key:"page_add",vars:{}}}if(s.same){const n=Wa(e,a,r)-Wa(e,t,r);return{...d,key:"page_add",vars:{n:i.el?.length??0},costsNothing:Math.abs(n)<.005}}return{...d,key:Sa(i.off.gets,n)?"page_get":"page_buy",vars:{}}}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||!a.earned||!Ba(e,n,r))continue;const s=Ya(e,i,t,r);if(!s.length)continue;const l=s[0],c=_a(e,La(t,l,Fa(e,l)),r);if(!c.ids.has(n.id)||c.stacked)continue;const{block:d,shipLost:u}=Pa(0,o,c);if(d)continue;if(n.same){const t=Math.min(Fa(e,l),...(a.el??[]).map(e=>e.price));if(Ta(n,t)<.2*Fa(e,l))continue;return{offer:n.id,key:"earned",vars:{},cta:"see_picks",picks:s,shipNote:!!u}}const p=!!i.gets&&1===i.gets.p.size;return{offer:n.id,key:"earned",vars:{},cta:p?"add_it":"see_picks",picks:s,shipNote:!!u}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||n.same||!a.hasGet||a.hasBuy||r.infoSeen.has(`lost-${n.id}`)||!Ba(e,n,r))continue;const s=t.find(e=>Sa(i.gets,e));if(s)return{offer:n.id,key:"lost",vars:{price:s.price},cta:"info",picks:[],shipNote:!1,once:`lost-${n.id}`}}for(const i of e.offers){const n=i.o,s=o.st.get(n.id);if(!Ba(e,n,r)||s.applies||!t.length)continue;const l="ship"===n.kind?s.gap??0:"basic"===n.kind&&!n.scope&&n.min_amount?s.gapAmount??0:0;if(l>0){if(l>.5*a)continue;const s=Ya(e,i,t,r);if(!s.length)continue;const c=s[0];if("basic"===n.kind&&Ma(e,t,c,Fa(e,c),r)>.8*Fa(e,c))continue;const d=_a(e,La(t,c,Fa(e,c)),r),{block:u,shipLost:p}=Pa(0,o,d);if(u||d.stacked)continue;const f={offer:n.id,cta:"see_picks",picks:s,shipNote:!!p};if("ship"===n.kind)return null!=n.fee?{...f,key:"gap_fee",vars:{gap:l,fee:n.fee}}:n.fee_range?{...f,key:"gap_fee",vars:{gap:l,fee_lo:n.fee_range[0],fee_hi:n.fee_range[1]}}:{...f,key:"gap",vars:{gap:l}};const h=Oa(o,n);return h?{...f,key:"gap_move",vars:{gap:l,from:Ua(h)}}:{...f,key:"gap",vars:{gap:l}}}if("basic"===n.kind&&n.min_qty&&1===s.gapQty){const a=Ya(e,i,t,r);if(!a.length)continue;const s=_a(e,La(t,a[0],Fa(e,a[0])),r),{block:l,shipLost:c}=Pa(0,o,s);if(!s.ids.has(n.id)||l||s.stacked)continue;const d=n.scope?null:Oa(o,n);return{offer:n.id,key:d?"one_more_move":"one_more",vars:d?{from:Ua(d)}:{},cta:"see_picks",picks:a,shipNote:!!c}}}if(n)for(const i of e.offers){const t=i.o,a=o.st.get(t.id);if(!r.infoSeen.has(t.id)&&!o.ids.has(t.id)&&Ba(e,t,r)){if("basic"===t.kind){if(!t.scope||!t.min_qty||!Sa(i.scope,n))continue}else{if("bxgy"!==t.kind)continue;if(!Sa(i.buys,n)||(t.same?(a.el?.length??0)>0:a.hasBuy))continue}return{offer:t.id,key:"info",vars:{},cta:"info",picks:[],shipNote:!1,once:t.id}}}return{quiet:"nothing true and worth saying here"}}(r,a.lines,s,i);if("quiet"in c)return void(n&&x(null));if("info"===c.cta&&m.current)return;const g=`${c.offer}|${c.key}|${wt(a.lines)}|${s?.pid??""}`;if(n?.sig===g||kt(g))return;const k=r.pack.offers.find(e=>e.id===c.offer)??null,C={sig:g,cart:wt(a.lines),decision:c,offer:k,line:v(c.offer,c.key,c.vars)+(c.costsNothing?` ${v(null,"costs_nothing")}`:""),note:c.shipNote?v(null,"ship_note"):null,head:"see_picks"===c.cta&&v(c.offer,"picks_head")||null,open:!1,rows:null,result:null,used:!1};if(C.line){if("add_this"===c.cta||"add_it"===c.cta){const e=c.picks[0],t=r.pack.products[e]?.h??("add_this"===c.cta?window.location.pathname.match(/\/products\/([^/?#]+)/)?.[1]:null),n=t?await Pe(decodeURIComponent(t)).catch(()=>null):null;if(!n)return;const o=ti(e,n),l=t=>!c.costsNothing||Math.abs(Ma(r,a.lines,e,t.price,i,t.id))<.005,d="sold"===o.state?null:w(o,c.offer,a.lines,i,l);if(!d)return;if("add_this"===c.cta&&s?.vid&&d.variants.some(e=>e.id===s.vid&&e.available)&&(d.chosen=s.vid),"add_it"===c.cta&&!d.chosen){const e=a.lines.find(e=>e.vt&&d.variants.some(t=>t.available&&ei(t.title)===ei(e.vt))),t=e&&d.variants.find(t=>t.available&&ei(t.title)===ei(e.vt));t&&(d.chosen=t.id,C.line=v(c.offer,"earned_size",c.vars)||C.line)}C.rows=[d]}e===f.current&&h.current&&(Ct(g),m.current=!0,c.once&&jt(c.once),St(C.line,a),x(C),y(15e3),l("offer_guide_shown",{offer:c.offer,key:c.key,cta:c.cta,kind:k?.kind,lang:o.lang}))}},[r,o,t,b,v,x,y,w]),C=q.useCallback(async()=>{try{await k()}finally{c(!0)}},[k]);q.useEffect(()=>{if(!r||!o||!t)return;let e=null;const n=window.setTimeout(()=>{C()},1500),a=()=>{e&&window.clearTimeout(e),e=window.setTimeout(()=>{C()},800)};return window.addEventListener(zt,a),()=>{window.clearTimeout(n),e&&window.clearTimeout(e),window.removeEventListener(zt,a)}},[r,o,t,C]),q.useEffect(()=>()=>{f.current+=1,g.current&&window.clearTimeout(g.current)},[]);const S=q.useCallback(e=>{const t=d.current;t&&x(e(t))},[x]),z=q.useCallback(async()=>{const e=d.current;if(!e||!r)return;if(e.open)return;if(g.current&&window.clearTimeout(g.current),Et(),l("offer_guide_unfolded",{offer:e.decision.offer,key:e.decision.key}),e.rows)return void S(e=>({...e,open:!0}));S(e=>({...e,open:!0}));const t=bt(b),n=(await Promise.all(e.decision.picks.map(async n=>{const o=r.pack.products[n]?.h,a=o?await Pe(o).catch(()=>null):null;if(!a)return null;const i=ti(n,a);return"sold"===i.state&&At(n),"sold"===i.state||t.sold.has(n)?null:w(i,e.decision.offer,u.current?.lines??[],t)}))).filter(e=>!!e);S(t=>t.sig===e.sig?{...t,rows:n}:t)},[r,b,S,w]),E=q.useCallback(()=>{const e=d.current;e?.open&&(S(e=>({...e,open:!1})),e.used&&y(Ga))},[S,y]),A=q.useCallback(e=>{const t=e.variants.find(t=>t.id===e.chosen)??e.variants.filter(e=>e.available).sort((e,t)=>e.price-t.price)[0],o=t?.price??0,a=u.current?.lines??[];if(!r||!n||"added"===e.state)return{price:o,pay:null,note:null};const i=bt(b),s=_a(r,a.concat([{pid:e.pid,vid:t?.id??"",qty:1,price:o}]),i).applied.find(t=>"bxgy"===t.off.o.kind&&t.disc.some(t=>t.pid===e.pid)),l=Ma(r,a,e.pid,o,i,t?.id??""),c=[];let d=null;s&&Math.abs(l-o)>.005?d=Math.max(0,l):Math.abs(l-o)>.005&&c.push(v(null,"adds_to_total",{eff:l}));const p=Va(r,a,e.pid,o,i);return p&&c.push(v(p.id,"reaches")),function(e,t,n,r,o,a){return!!Pa(0,_a(e,t,a),_a(e,La(t,n,o,r),a)).shipLost}(r,a,e.pid,t?.id??"",o,i)&&c.push(v(null,"ship_note")),{price:o,pay:d,note:c.filter(Boolean).join(" · ")||null}},[r,n,b,v]),R=q.useCallback((e,t)=>{S(n=>({...n,rows:n.rows?.map(n=>n.pid===e?{...n,chosen:t}:n)??null}))},[S]),T=q.useCallback(async e=>{const t=d.current,o=t?.rows?.find(t=>t.pid===e);if(!t||!o||!o.chosen||!r||p.current)return;const a=o.variants.find(e=>e.id===o.chosen);if(!a)return;p.current=!0,g.current&&window.clearTimeout(g.current),S(t=>({...t,rows:t.rows?.map(t=>t.pid===e?{...t,state:"adding"}:t)??null}));const i=bt(b),s=await vt();if(!Xa(n)||!s||s.unknown||s.currency!==r.pack.currency||wt(s.lines)!==t.cart||!Ia(r,s.lines,s.total,i)||!Na(r,s.lines,t.decision.offer,e,a.id,a.price,i))return p.current=!1,x(null),void C();const c=await Rt(a.id,t.decision.offer),f="success"===c.type||"out_of_stock"===c.reason?s:await vt(),h="success"===c.type||!!f&&Tt(f,a.id)>Tt(s,a.id);let m,w=!1,k="idle",j=null;if(h){k="added";const n=await vt();u.current=n;const c=!!n&&!n.unknown&&n.currency===s.currency;if(j=c&&"bxgy"===t.offer?.kind?za(n.total-s.total):null,c&&Ia(r,n.lines,n.total,i)){const o=function(e,t,n,r,o,a,i,s){const l=e.offers.find(e=>e.o.id===t)??null,c=l?.o??null,d=s??Wa(e,r,i)-Wa(e,n,i),u=_a(e,r,i),p=_a(e,n,i).applied.find(e=>"ship"===e.off.o.kind),f=p?u.st.get(p.off.o.id):void 0,h=!(!p||!f||f.applies||!f.offBy||p.off.o.free_anyway),g=(e,t={},n=!1)=>({key:e,from:"ui",vars:t,ok:n,shipNote:h});if(!c)return d<a-.005?g("added_cost",{eff:d}):g("added");if("ship"===c.kind){const t=u.st.get(c.id);return Ba(e,c,i)?t.applies?{key:"added_reached",from:"offer",vars:{},ok:!0,shipNote:h}:{key:"added_gap",from:"offer",vars:{gap:t.gap??0},ok:!0,shipNote:h}:g("added")}const m=u.applied.find(e=>e.off.o.id===c.id);if(d<a-.005){if(!m)return g("added_cost",{eff:d});if("basic"===c.kind)return{key:"added",from:"offer",vars:{saving:za(m.value)},ok:!0,shipNote:h};if(c.same){const t=m.disc[0];return t?{key:"added",from:"offer",vars:{title:e.pack.products[t.pid]?.t??"",price:t.price},ok:!0,shipNote:h}:g("added_cost",{eff:d},!0)}return"bxgy"!==c.kind||m.disc.some(e=>e.pid===o)?{key:"added",from:"offer",vars:{paid:za(d),price:a},ok:!0,shipNote:h}:g("added_cost",{eff:d},!0)}if(Math.abs(d-a)<.005){if("bxgy"===c.kind&&!c.same){const t=m?.disc.find(e=>e.pid!==o),n=t?e.pack.products[t.pid]?.t:null;if(n)return{key:"added_full_went",from:"offer",vars:{title:n},ok:!1,shipNote:h}}return g("added_full")}return g("added_cost",{eff:d})}(r,t.decision.offer,s.lines,n.lines,e,a.price,i,j);m=v("offer"===o.from?t.decision.offer:null,o.key,o.vars)+(o.shipNote?` ${v(null,"ship_note")}`:""),w=o.ok}else m=v(null,"added");const d=t.offer;d&&"ship"!==d.kind&&c&&n.total-s.total>=a.price-.005&&!_a(r,n.lines,i).ids.has(d.id)&&_t(d.id),Wt(o.title),l("offer_guide_add",{offer:t.decision.offer,ok:!0,promised:w,kind:d?.kind})}else"out_of_stock"===c.reason?(At(e),k="sold",m=v(null,"sold_out_now")):f?m=v(null,"add_failed"):(k="unsure",m=v(null,"unsure")),l("offer_guide_add",{offer:t.decision.offer,ok:!1,reason:f?c.reason:"unread"});It(m),p.current=!1,S(t=>({...t,used:!0,rows:t.rows?.map(t=>t.pid===e?{...t,state:k,paid:j}:t)??null,result:{text:m,ok:w,undoVid:"added"===k?a.id:null}})),y(Ga)},[r,b,v,S,y,x,C]),_=q.useCallback(async()=>{const e=d.current,t=e?.result?.undoVid;if(!e||!t||p.current)return;p.current=!0,g.current&&window.clearTimeout(g.current);const n=await Lt(t,e.decision.offer),r="done"===n;p.current=!1,l("offer_guide_undo",{offer:e.decision.offer,ok:r});const o=e.rows?.find(e=>e.variants.some(e=>e.id===t));r&&o&&Mt(o.title),S(e=>({...e,rows:r?e.rows?.map(e=>e.variants.some(e=>e.id===t)?{...e,state:"idle",paid:null}:e)??null:e.rows,result:{text:v(null,r?"removed":"failed"===n?"undo_failed":"unsure"),ok:!1,undoVid:"failed"===n?t:null}})),u.current=await vt(),y(Ga)},[v,S,y]),W=q.useCallback(()=>{const e=d.current;f.current+=1,Bt(),Ca(),Ft(),Dt(),x(null),l("offer_guide_closed",{offer:e?.decision.offer,used:!!e?.used})},[x]),I=q.useCallback(e=>Ne(e,n?.currency),[n?.currency]);return{view:a,looked:s,unfold:z,fold:E,choose:R,add:T,undo:_,close:W,rowFacts:A,say:v,money:I}}const ri=q.forwardRef(function({hookText:e,cta:t,maxW:n,onStart:r,onDismiss:o},a){return O.jsx(ua,{maxW:n,icon:O.jsx(En,{boxSize:"16px"}),closeLabel:"Close",onClose:o,action:O.jsxs(ee,{ref:a,...da,gap:"4px",onClick:r,children:[t,O.jsx(Bn,{boxSize:"12px"})]}),children:O.jsx(ae,{as:"button",onClick:r,w:"full",textAlign:"start",cursor:"pointer",tabIndex:-1,children:O.jsx(fe,{fontSize:"13px",fontWeight:600,color:"text",lineHeight:"1.3",lineClamp:2,fontFamily:pe,children:e})})})});function oi(e,t,n,r){const o=e%10,a=e%100;return 1===o&&11!==a?t:o>=2&&o<=4&&(a<12||a>14)?n:r}const ai={English:{subtitle:e=>`Answer ${e} quick question${e>1?"s":""} for personalized recommendations`,cta:"Start",skip:"Or open chat instead"},Czech:{subtitle:e=>`Odpovězte na ${e} ${1===e?"otázku":"otázky"} pro personalizovaná doporučení`,cta:"Začít",skip:"Nebo otevřít chat"},German:{subtitle:e=>`Beantworten Sie ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten",skip:"Oder Chat öffnen"},Hungarian:{subtitle:e=>`Válaszolj ${e} gyors kérdésre személyre szabott ajánlásokért`,cta:"Indítás",skip:"Vagy nyisd meg a chatet"},Persian:{subtitle:e=>`به ${e} سوال کوتاه پاسخ بدید تا پیشنهادات شخصی دریافت کنید`,cta:"شروع",skip:"یا چت را باز کنید"},French:{subtitle:e=>`Répondez à ${e} question${e>1?"s":""} rapide${e>1?"s":""} pour des recommandations personnalisées`,cta:"Commencer",skip:"Ou ouvrir le chat"},Spanish:{subtitle:e=>`Responde ${e} pregunta${e>1?"s":""} rápida${e>1?"s":""} para recomendaciones personalizadas`,cta:"Empezar",skip:"O abrir el chat"},Arabic:{subtitle:e=>`أجب عن ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} للحصول على توصيات مخصصة`,cta:"ابدأ",skip:"أو افتح المحادثة"},Turkish:{subtitle:e=>`Kişiselleştirilmiş öneriler için ${e} hızlı soruyu yanıtlayın`,cta:"Başla",skip:"Veya sohbeti aç"},Portuguese:{subtitle:e=>`Responda ${e} pergunta${e>1?"s":""} rápida${e>1?"s":""} para recomendações personalizadas`,cta:"Começar",skip:"Ou abrir o chat"},Italian:{subtitle:e=>`Rispondi a ${e} ${1===e?"domanda veloce":"domande veloci"} per raccomandazioni personalizzate`,cta:"Inizia",skip:"Oppure apri la chat"},Japanese:{subtitle:e=>`${e}つの質問に答えるだけで、あなたにぴったりのおすすめをご提案します`,cta:"はじめる",skip:"チャットで相談する"},Chinese:{subtitle:e=>`回答${e}个简单问题,获取专属推荐`,cta:"开始",skip:"或直接打开聊天"},Korean:{subtitle:e=>`${e}개의 간단한 질문에 답하고 맞춤 추천을 받아보세요`,cta:"시작하기",skip:"또는 채팅 열기"},Russian:{subtitle:e=>`Ответьте на ${e} ${oi(e,"короткий вопрос","коротких вопроса","коротких вопросов")}, чтобы получить персональные рекомендации`,cta:"Начать",skip:"Или открыть чат"},Ukrainian:{subtitle:e=>`Дайте відповідь на ${e} ${oi(e,"коротке запитання","короткі запитання","коротких запитань")}, щоб отримати персональні рекомендації`,cta:"Почати",skip:"Або відкрити чат"},Polish:{subtitle:e=>`Odpowiedz na ${e} ${function(e){if(1===e)return"krótkie pytanie";const t=e%10,n=e%100;return t>=2&&t<=4&&(n<12||n>14)?"krótkie pytania":"krótkich pytań"}(e)}, aby otrzymać spersonalizowane rekomendacje`,cta:"Zacznij",skip:"Lub otwórz czat"},Slovak:{subtitle:e=>`Odpovedzte na ${e} ${1===e?"krátku otázku":e<5?"krátke otázky":"krátkych otázok"} a získajte odporúčania na mieru`,cta:"Začať",skip:"Alebo otvoriť chat"},Bulgarian:{subtitle:e=>`Отговорете на ${e} ${1===e?"кратък въпрос":"кратки въпроса"} за персонални препоръки`,cta:"Започни",skip:"Или отвори чата"},Croatian:{subtitle:e=>`Odgovorite na ${e} ${oi(e,"kratko pitanje","kratka pitanja","kratkih pitanja")} za osobne preporuke`,cta:"Započni",skip:"Ili otvori chat"},Dutch:{subtitle:e=>`Beantwoord ${e} korte ${1===e?"vraag":"vragen"} voor persoonlijke aanbevelingen`,cta:"Starten",skip:"Of open de chat"},Swedish:{subtitle:e=>`Svara på ${e} ${1===e?"snabb fråga":"snabba frågor"} för personliga rekommendationer`,cta:"Börja",skip:"Eller öppna chatten"},Norwegian:{subtitle:e=>`Svar på ${e} ${1===e?"raskt spørsmål":"raske spørsmål"} for personlige anbefalinger`,cta:"Start",skip:"Eller åpne chatten"},Danish:{subtitle:e=>`Svar på ${e} ${1===e?"hurtigt spørgsmål":"hurtige spørgsmål"} for personlige anbefalinger`,cta:"Start",skip:"Eller åbn chatten"},Finnish:{subtitle:e=>`Vastaa ${e} lyhyeen kysymykseen ja saat henkilökohtaisia suosituksia`,cta:"Aloita",skip:"Tai avaa chat"},Estonian:{subtitle:e=>`Vasta ${e} lühikesele küsimusele ja saa isikupärastatud soovitusi`,cta:"Alusta",skip:"Või ava vestlus"},Latvian:{subtitle:e=>`Atbildiet uz ${e} ${e%10==1&&e%100!=11?"īsu jautājumu":"īsiem jautājumiem"} un saņemiet personalizētus ieteikumus`,cta:"Sākt",skip:"Vai atvērt tērzēšanu"},Lithuanian:{subtitle:e=>`Atsakykite į ${e} ${e%10==1&&e%100!=11?"trumpą klausimą":e%10>=2&&(e%100<10||e%100>=20)?"trumpus klausimus":"trumpų klausimų"} ir gaukite asmeninių rekomendacijų`,cta:"Pradėti",skip:"Arba atidarykite pokalbį"},Greek:{subtitle:e=>`Απαντήστε σε ${e} ${1===e?"σύντομη ερώτηση":"σύντομες ερωτήσεις"} για εξατομικευμένες προτάσεις`,cta:"Έναρξη",skip:"Ή ανοίξτε τη συνομιλία"},Romanian:{subtitle:e=>`Răspunde la ${e} ${1===e?"întrebare scurtă":"întrebări scurte"} pentru recomandări personalizate`,cta:"Începe",skip:"Sau deschide chatul"},Albanian:{subtitle:e=>`Përgjigjuni ${e} ${1===e?"pyetjeje të shkurtër":"pyetjeve të shkurtra"} për rekomandime të personalizuara`,cta:"Fillo",skip:"Ose hap bisedën"},Hebrew:{subtitle:e=>1===e?"ענו על שאלה קצרה אחת לקבלת המלצות מותאמות אישית":`ענו על ${e} שאלות קצרות לקבלת המלצות מותאמות אישית`,cta:"התחלה",skip:"או פתחו את הצ׳אט"},Urdu:{subtitle:e=>`ذاتی سفارشات کے لیے ${e} مختصر ${1===e?"سوال":"سوالات"} کے جواب دیں`,cta:"شروع کریں",skip:"یا چیٹ کھولیں"},Hindi:{subtitle:e=>`व्यक्तिगत सुझावों के लिए ${e} ${1===e?"छोटे सवाल":"छोटे सवालों"} का जवाब दें`,cta:"शुरू करें",skip:"या चैट खोलें"},Bengali:{subtitle:e=>`ব্যক্তিগত সুপারিশ পেতে ${e}টি ছোট প্রশ্নের উত্তর দিন`,cta:"শুরু করুন",skip:"অথবা চ্যাট খুলুন"},Tamil:{subtitle:e=>`தனிப்பட்ட பரிந்துரைகளுக்கு ${e} சிறிய ${1===e?"கேள்விக்கு":"கேள்விகளுக்கு"} பதிலளிக்கவும்`,cta:"தொடங்கு",skip:"அல்லது அரட்டையைத் திற"},Telugu:{subtitle:e=>`వ్యక్తిగత సిఫార్సుల కోసం ${e} చిన్న ${1===e?"ప్రశ్నకు":"ప్రశ్నలకు"} సమాధానం ఇవ్వండి`,cta:"ప్రారంభించండి",skip:"లేదా చాట్ తెరవండి"},Thai:{subtitle:e=>`ตอบคำถามสั้นๆ ${e} ข้อ เพื่อรับคำแนะนำเฉพาะคุณ`,cta:"เริ่มเลย",skip:"หรือเปิดแชท"},Vietnamese:{subtitle:e=>`Trả lời ${e} câu hỏi ngắn để nhận gợi ý dành riêng cho bạn`,cta:"Bắt đầu",skip:"Hoặc mở trò chuyện"},Indonesian:{subtitle:e=>`Jawab ${e} pertanyaan singkat untuk rekomendasi yang dipersonalisasi`,cta:"Mulai",skip:"Atau buka obrolan"},Malay:{subtitle:e=>`Jawab ${e} soalan ringkas untuk cadangan yang diperibadikan`,cta:"Mula",skip:"Atau buka sembang"},Swahili:{subtitle:e=>`Jibu ${1===e?"swali 1 fupi":`maswali ${e} mafupi`} upate mapendekezo yanayokufaa`,cta:"Anza",skip:"Au fungua gumzo"},Filipino:{subtitle:e=>`Sagutin ang ${e} maikling tanong para sa mga personal na rekomendasyon`,cta:"Simulan",skip:"O buksan ang chat"},Iraqi:{subtitle:e=>`جاوب على ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} حتى تحصل على اقتراحات تناسبك`,cta:"ابدأ",skip:"أو افتح المحادثة"},Amharic:{subtitle:e=>`ለግል ምክሮች ${e} አጭር ጥያቄ${1===e?"":"ዎች"}ን ይመልሱ`,cta:"ጀምር",skip:"ወይም ውይይቱን ይክፈቱ"},Burmese:{subtitle:e=>`သင့်အတွက် အကြံပြုချက်များ ရရန် မေးခွန်းတို ${e} ခုကို ဖြေဆိုပါ`,cta:"စတင်ရန်",skip:"သို့မဟုတ် ချက်တင်ကို ဖွင့်ပါ"},Gujarati:{subtitle:e=>`વ્યક્તિગત ભલામણો માટે ${e} ટૂંકા ${1===e?"પ્રશ્નનો":"પ્રશ્નોના"} જવાબ આપો`,cta:"શરૂ કરો",skip:"અથવા ચેટ ખોલો"},Hausa:{subtitle:e=>`Amsa ${1===e?"tambaya 1 gajera":`tambayoyi ${e} gajeru`} don samun shawarwari na musamman`,cta:"Fara",skip:"Ko buɗe hira"},Igbo:{subtitle:e=>`Zaa ajụjụ ${e} dị mkpụmkpụ maka ndụmọdụ ahaziri gị`,cta:"Malite",skip:"Ma ọ bụ mepee nkata"},Kannada:{subtitle:e=>`ವೈಯಕ್ತಿಕ ಶಿಫಾರಸುಗಳಿಗಾಗಿ ${e} ಚಿಕ್ಕ ${1===e?"ಪ್ರಶ್ನೆಗೆ":"ಪ್ರಶ್ನೆಗಳಿಗೆ"} ಉತ್ತರಿಸಿ`,cta:"ಪ್ರಾರಂಭಿಸಿ",skip:"ಅಥವಾ ಚಾಟ್ ತೆರೆಯಿರಿ"},Khmer:{subtitle:e=>`ឆ្លើយសំណួរខ្លីៗ ${e} ដើម្បីទទួលបានការណែនាំសម្រាប់អ្នក`,cta:"ចាប់ផ្តើម",skip:"ឬបើកការជជែក"},Lao:{subtitle:e=>`ຕອບຄຳຖາມສັ້ນໆ ${e} ຂໍ້ ເພື່ອຮັບຄຳແນະນຳສະເພາະທ່ານ`,cta:"ເລີ່ມ",skip:"ຫຼື ເປີດແຊັດ"},Malayalam:{subtitle:e=>`വ്യക്തിഗത ശുപാർശകൾക്കായി ${e} ചെറിയ ${1===e?"ചോദ്യത്തിന്":"ചോദ്യങ്ങൾക്ക്"} ഉത്തരം നൽകുക`,cta:"തുടങ്ങുക",skip:"അല്ലെങ്കിൽ ചാറ്റ് തുറക്കുക"},Marathi:{subtitle:e=>`वैयक्तिक शिफारशींसाठी ${e} ${1===e?"छोट्या प्रश्नाचे":"छोट्या प्रश्नांची"} उत्तरे द्या`,cta:"सुरू करा",skip:"किंवा चॅट उघडा"},Mongolian:{subtitle:e=>`Танд тохирсон зөвлөмж авахын тулд ${e} богино асуултад хариулна уу`,cta:"Эхлэх",skip:"Эсвэл чат нээх"},Nepali:{subtitle:e=>`व्यक्तिगत सुझावका लागि ${e} वटा छोटा प्रश्नको जवाफ दिनुहोस्`,cta:"सुरु गर्नुहोस्",skip:"वा च्याट खोल्नुहोस्"},Pashto:{subtitle:e=>`د شخصي وړاندیزونو لپاره ${e} لنډو ${1===e?"پوښتنې":"پوښتنو"} ته ځواب ورکړئ`,cta:"پیل",skip:"یا چیټ پرانیزئ"},Punjabi:{subtitle:e=>`ਨਿੱਜੀ ਸਿਫ਼ਾਰਸ਼ਾਂ ਲਈ ${e} ਛੋਟੇ ${1===e?"ਸਵਾਲ":"ਸਵਾਲਾਂ"} ਦੇ ਜਵਾਬ ਦਿਓ`,cta:"ਸ਼ੁਰੂ ਕਰੋ",skip:"ਜਾਂ ਚੈਟ ਖੋਲ੍ਹੋ"},Sinhala:{subtitle:e=>`ඔබට ගැළපෙන නිර්දේශ ලබා ගැනීමට කෙටි ප්රශ්න ${e}කට පිළිතුරු දෙන්න`,cta:"අරඹන්න",skip:"නැතහොත් කතාබහ විවෘත කරන්න"},Somali:{subtitle:e=>`Ka jawaab ${e} ${1===e?"su'aal gaaban":"su'aalood oo gaagaaban"} si aad u hesho talooyin kuu gaar ah`,cta:"Bilow",skip:"Ama fur wada-sheekaysiga"},Yoruba:{subtitle:e=>`Dáhùn ìbéèrè kúkúrú ${e} láti gba àbá tó bá ọ mu`,cta:"Bẹ̀rẹ̀",skip:"Tàbí ṣí ìjíròrò"},Zulu:{subtitle:e=>`Phendula ${1===e?"umbuzo omfushane o-1":`imibuzo emifushane engu-${e}`} ukuze uthole iziphakamiso ezenzelwe wena`,cta:"Qala",skip:"Noma vula ingxoxo"},Afrikaans:{subtitle:e=>`Beantwoord ${e} kort ${1===e?"vraag":"vrae"} vir persoonlike aanbevelings`,cta:"Begin",skip:"Of maak die klets oop"}},ii={subtitle:e=>`Beantworte ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten",skip:"Oder Chat öffnen"};function si(e,t=!1){const n=Ht(e),r=Object.keys(ai).find(e=>e.toLowerCase()===n.toLowerCase()),o=ai[e]||ai[n]||(r?ai[r]:void 0)||ai.English;return t&&o===ai.German?ii:o}let li=!1;const ci=({quiz:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{phase:i,open:s,flow:l,text:c,handleStart:d,handleDismiss:u,handleCollapse:p,handleComplete:f,handleSkipToChat:h}=e,g=q.useRef(null);if("hidden"===i||!l)return null;const m={isMobile:t,layer:n,w:o,maxH:a,onCollapse:p,onClosed:()=>g.current?.focus()};return O.jsxs(O.Fragment,{children:[!s&&O.jsx(ri,{ref:g,hookText:l.welcome_hook,cta:c.cta,maxW:r,onStart:d,onDismiss:u}),"expanded"===i&&O.jsxs(ma,{...m,open:s,label:l.entry_label,children:[O.jsx(Vr,{flow:l,onComplete:f,onClose:u}),O.jsx(ae,{as:"button",onClick:h,display:"block",mx:"auto",mt:1,fontSize:"12px",color:"mutedText",textDecoration:"underline",fontFamily:pe,cursor:"pointer",children:c.skip})]})]})};function di(e){const t={};for(const[n,r]of Object.entries(e))t["left"===n?"right":"right"===n?"left":n]=r;return t}const ui=e=>"left"===e?"right":"left",pi={own:3e3,hook:6400};function fi(e){const t=e.codePointAt(0)??0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12352&&t<=12543?4:t>=44032&&t<=55215?3:t>=1536&&t<=1791||t>=1872&&t<=1919?1.6:1}function hi(e){const t=e?.feature_flags?.bubble_seconds;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:null}function gi(e){const t=e?.feature_flags?.bubble_stay;return"until_closed"===t?"until_closed":"seconds"===t&&null!==hi(e)?"seconds":"read"}function mi(e,t,n,r=pi.own){const o=gi(e);if("until_closed"===o)return null;if("seconds"===o)return 1e3*Math.min(20,Math.max(3,hi(e)));const a="own"===n?r:pi[n];return Math.min(1e4,Math.max(a,function(e){let t=0;for(const n of e)t+=fi(n);return Math.round(1e3+55*t)}(t)))}const bi=["homepage","category","product","search","cart","other"],xi={home:"homepage",collection:"category",product:"product",searchresults:"search",search:"search",cart:"cart"};function yi(){if("undefined"==typeof window)return"other";try{const e=window.ShopifyAnalytics?.meta?.page?.pageType;if("string"==typeof e&&e)return xi[e.toLowerCase()]??"other"}catch{}return Pt()}function vi(e){return!(!function(e,t=yi()){const n=function(e){const t=e?.customization?.quiz_pages;if(!Array.isArray(t))return null;const n=bi.filter(e=>t.includes(e));return n.length?n:null}(e);return null===n||n.includes(t)}(e)||"product"===yi()&&$a(e))}const wi=({onClick:e,suppressBubble:t=!1,slot:n})=>{const{botData:r,diagnosticFlow:o,diagnosticShown:a,proactiveSuppressedThisSession:i,suppressProactiveForSession:s,effectiveFabCta:l,handover:c,handoverUnread:d}=ie(),{t:u}=le(),p=tn("colors","primary"),f=tn("colors","background"),h=tn("colors","lightBackground"),g=Re(p),m=Array.isArray(p)?p[0]:p,b=qt(f,h),x=function(e,t){if(t)return null;const n=e?.feature_flags?.fab_pill_each_page_seconds;return"number"!=typeof n||!Number.isFinite(n)||n<=0?null:Math.min(10,Math.max(1,n))}(r,!!sr(r)),y="until_closed"===gi(r)&&!r?.customization?.disable_welcome_popup,[v,w]=q.useState(()=>y&&!Ot()||!y&&!Nt()&&!Yt()&&S()||null!==x&&!yt()?"expanded":"minimized"),[k,C]=q.useState(!1),[j,E]=q.useState(!1),[A,R]=q.useState(!1),[T,_]=q.useState(!1),[W,I]=q.useState(!1),L=q.useRef(null),M=()=>{L.current&&(clearTimeout(L.current),L.current=null)},B=Pr(r?.merchant_support_channels).length>0,F=()=>{M(),!U&&B&&(R(!0),_(!0))};q.useEffect(()=>()=>M(),[]);const D=!0!==r?.customization?.disable_idle_animation,{getStarfieldTransform:H,getIconStyle:P}=ir({enableTwinkling:D,enableFloating:D,enableRotation:D,enableScaling:D}),N=q.useRef(!1),Y=q.useRef(0),V=q.useRef(null),U=ln({base:!0,md:!1})??!1,Z=cr(r,U),K=sr(r),Q=!!K,G=la(r,U),X=(e,t)=>function(e,t,n){return{base:`${Math.round(e*n)}px`,md:`${Math.round(t*n)}px`}}(e,t,G),J=function(e,t){return t&&!0===e?.feature_flags?.fab_transparent}(r,Q),$=function(e,t){return!t&&!0===e?.feature_flags?.fab_always_expanded}(r,Q),te=function(e){return!0===e?.feature_flags?.fab_icon_only}(r),ne=l??(r?.agent_name?u("askAgent").replace("{name}",r.agent_name):u("askDori")),re=q.useRef(null),[oe,se]=q.useState(null);q.useEffect(()=>{let e=!1;const t=()=>{const t=re.current;!e&&t&&se(t.scrollWidth)};return t(),document.fonts?.ready?.then(t).catch(()=>{}),()=>{e=!0}},[ne,U]);const ce=(()=>{if(null==oe)return{base:"120px",md:"150px"};const e=U?120:150,t=2*(U?8:12),n=Math.round((U?20:24)*G),r=U?280:360,o=t+8+n+oe+2;return`${Math.min(r,Math.max(e,o))}px`})(),he=!0===r?.customization?.enable_standalone_quiz&&vi(r)&&o&&!a?o.welcome_hook:null,ge=!he,me=q.useRef(Yt()),be=y?Ot():i,xe=t||be||!y&&ge&&me.current?null:function(e,t){return t||function(e){return e?.feature_flags?.bubble_text?.trim()||null}(e)}(r,he),ye=()=>{if(y&&Ot())return;z();const e=++Y.current;w("expanded"),E(!1),I(!1);const t=setTimeout(()=>{if(Y.current===e&&(C(!0),!r?.customization?.disable_welcome_popup)){const t=setTimeout(()=>{if(Y.current!==e)return;E(!0);const t=mi(r,xe??"","own",1e3*(x??3));if(null===t)return;const n=setTimeout(()=>{Y.current===e&&(E(!1),setTimeout(()=>{Y.current===e&&w("minimized")},300))},t);return()=>clearTimeout(n)},100);return()=>clearTimeout(t)}},100);return()=>clearTimeout(t)},ve=()=>{w("minimized"),E(!1);const e=setTimeout(()=>{C(!0)},0);return()=>clearTimeout(e)},we=e=>{const t=++Y.current;w("expanded"),E(!1);const n=setTimeout(()=>C(!0),100),r=setTimeout(()=>{Y.current===t&&w("minimized")},100+1e3*e);return()=>{clearTimeout(n),clearTimeout(r)}};q.useEffect(()=>{N.current||(N.current=!0,y?Ot()||he?ve():ye():Nt()?null===x||yt()?ve():we(x):!he||r?.customization?.disable_welcome_popup?!Yt()&&S()?ye():null!==x?we(x):ve():ve())},[]),q.useEffect(()=>{const e=setInterval(()=>{Nt()||Yt()||S()&&ye()},1e3);return()=>clearInterval(e)},[]),q.useEffect(()=>{if(!he)return;if(r?.customization?.disable_welcome_popup)return;if(y?Ot():Nt())return;Y.current++,C(!0),V.current&&(clearTimeout(V.current),V.current=null),I(!0),w("expanded");const e=setTimeout(()=>{E(!0)},400),t=mi(r,he,"hook"),n=null===t?null:setTimeout(()=>{E(!1),V.current=setTimeout(()=>{w("minimized"),V.current=null},350)},t);return()=>{clearTimeout(e),n&&clearTimeout(n),V.current&&(clearTimeout(V.current),V.current=null)}},[he]);const ke=q.useRef(null);q.useEffect(()=>{if(j&&xe&&!r?.customization?.disable_welcome_popup){if(ge){if(Yt())return;return Vt(),void Ut(!1)}ke.current!==xe&&(ke.current=xe,Ut(!0))}},[j,xe]);const Ce=()=>{Kt(),e&&(e(),"minimized"===v&&(E(!1),setTimeout(()=>{w("expanded"),setTimeout(()=>{r?.customization?.disable_welcome_popup||setTimeout(()=>{E(!0)},50)},100)},0)))},je=Ce,Se=te||!$&&("minimized"===v||Q),ze=function(e){const t=e.hasAvatarFab&&e.animationsEnabled&&e.isMinimized&&!e.isMenuOpen;return{breathe:t,halo:t&&!e.isTransparentFab}}({hasAvatarFab:Q,animationsEnabled:D,isMinimized:Se,isMenuOpen:A,isTransparentFab:J}),Ee=dr(Z,r,U),Ae="right"===Z.align?"32px 0px 32px 32px":"0px 32px 32px 32px";return O.jsxs(ae,{position:"relative",transform:k?Ee?"translateY(0) scale(1)":`translateY(calc(-50% + ${Z.bottomSpacing}px)) scale(1)`:Ee?"translateY(100px) scale(0.9)":`translateY(calc(-50% + ${Z.bottomSpacing}px + 100px)) scale(0.9)`,opacity:k?1:0,onMouseLeave:()=>{U||(M(),L.current=setTimeout(()=>{R(!1),_(!1)},100))},children:[O.jsx(Or,{channels:r?.merchant_support_channels,isOpen:A,onToggle:()=>R(!A),isMobile:U,onMouseEnter:F,onChatClick:e}),O.jsx(ae,{visibility:A?"hidden":void 0,"aria-hidden":A||void 0,children:n}),"expanded"===v&&xe&&!r?.customization?.disable_welcome_popup&&O.jsx(ae,{position:"absolute",bottom:"100%",[Z.align]:"0",mb:2,w:{base:"70vw",md:"25vw"},maxW:{base:"300px",md:"300px"},bg:b,borderRadius:"16px",p:2,pe:3,boxShadow:W?"0 8px 32px rgba(0,0,0,0.16), 0 0 0 1.5px rgba(120,120,200,0.13)":"lg",opacity:j?1:0,transform:j?"translateY(0) scale(1)":W?"translateY(20px) scale(0.88)":"translateY(10px) scale(0.95)",transition:j?W?"opacity 0.5s ease, transform 0.7s cubic-bezier(0.22, 1.61, 0.36, 1), box-shadow 0.4s ease":"opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)":"opacity 0.25s ease, transform 0.25s ease",cursor:"pointer",onClick:je,children:O.jsxs(ue,{gap:1,align:"center",width:"100%",justifyContent:"flex-start",children:[O.jsx(fn,{size:"xs",variant:"ghost","aria-label":"Close",onClick:e=>{e.stopPropagation(),s(),Dt(),Bt(),Ca(),E(!1),setTimeout(()=>w("minimized"),300)},color:"text",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"rgba(0,0,0,0.1)"}},h:"auto",p:1,children:O.jsx(wn,{boxSize:"16px"})}),O.jsx(fe,{fontSize:"12px",fontWeight:"400",color:"text",lineHeight:"1.75",flex:1,width:"100%",fontFamily:pe,children:xe})]})}),ze.breathe&&O.jsx("style",{children:"\n @keyframes dori-avatar-breathe {\n 0%, 100% { scale: 1; }\n 50% { scale: 1.06; }\n }\n @keyframes dori-avatar-halo {\n 0% { box-shadow: 0 0 0 0 var(--dori-halo); }\n 70%, 100% { box-shadow: 0 0 0 12px var(--dori-halo-end); }\n }\n .dori-avatar-breathe {\n animation: dori-avatar-breathe 3s ease-in-out infinite;\n }\n .dori-avatar-breathe.dori-avatar-halo {\n animation:\n dori-avatar-breathe 3s ease-in-out infinite,\n dori-avatar-halo 3s ease-out infinite;\n }\n @media (prefers-reduced-motion: reduce) {\n .dori-avatar-breathe { animation: none !important; }\n }\n "}),O.jsx(ee,{borderRadius:Se?"50%":Ae,borderWidth:0,bg:J?"transparent":g,color:"text",border:"none !important",w:Se?X(48,56):ce,minW:Se?X(48,56):ce,h:Se?X(48,56):"auto",p:Se?"0":{base:2,md:3},overflow:"hidden",transition:"width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), min-width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 0.4s ease, padding 0.3s ease, transform 0.2s ease",onClick:Ce,className:["fab-glass",ze.breathe&&"dori-avatar-breathe",ze.halo&&"dori-avatar-halo"].filter(Boolean).join(" "),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.05)"}},style:{borderRadius:Se?"50%":Ae,cursor:"pointer",touchAction:"manipulation",WebkitTapHighlightColor:"transparent",...ze.halo?{"--dori-halo":Zt(m,.5),"--dori-halo-end":Zt(m,0)}:{}},onMouseEnter:F,justifyContent:"center",children:O.jsxs(ue,{gap:Se?0:2,position:"relative",w:"full",justify:Se?"center":"space-between",overflow:"hidden",children:[O.jsx(fe,{fontSize:{base:"14px",md:"16px"},fontWeight:{base:"500",md:"600"},lineHeight:"1.5",whiteSpace:"nowrap",fontFamily:pe,color:"background",opacity:Se?0:1,maxW:Se?"0px":"none",transition:"opacity 0.2s ease, max-width 0.35s ease",overflow:"hidden",ref:re,children:ne}),!A&&(K?O.jsx(de,{src:K,alt:"",role:"presentation",boxSize:X(52,60),borderRadius:"full",objectFit:"cover",flexShrink:0}):O.jsx(Fn,{boxSize:X(20,24),color:"background",transform:H(v,Z),...P(),flexShrink:0}))]})}),d>0&&!A&&O.jsx(ae,{position:"absolute",top:X(-6,-6),..."right"===Z.align?{left:X(-6,-6)}:{right:X(-6,-6)},minW:"20px",h:"20px",px:"5px",borderRadius:"full",bg:"#E5484D",color:"white",fontSize:"12px",fontWeight:"600",fontFamily:pe,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",boxShadow:"0 0 0 2px white",role:"status","aria-label":u("handoverUnread").replace("{team}",c?.teamName||u("handoverTheTeam")),"data-dori-handover-unread":d,children:d>9?"9+":d})]})};let ki=!1;const Ci=q.forwardRef(function({bubble:e,settled:t,styles:n,onClick:r,quiz:o,sheetLayer:a},i){const{botData:s}=ie(),l=ln({base:!0,md:!1})??!1,[c,d]=q.useState(!1),u=ni(s,!1!==s?.customization?.enable_offer_guide&&t&&!c),p=$a(s),[f,h]=q.useState(!1);q.useEffect(()=>{if(!p||!t||u.looked)return;const e=window.setTimeout(()=>h(!0),5e3);return()=>window.clearTimeout(e)},[p,t,u.looked]),q.useEffect(()=>{u.view&&(ki=!0)},[u.view]);const g=!p||u.looked||f,m=ki||!!u.view,b=c?"quiz":u.view?"guide":o.eligible&&t&&g&&!m?"quiz":null,x=function({speaking:e,onOpenWidget:t,onStartChat:n,onDismissed:r,onEngagedChange:o}){const{diagnosticFlow:a,diagnosticShown:i,markDiagnosticShown:s,effectiveLanguage:l,informalAddress:c,suppressProactiveForSession:d}=ie(),[u,p]=q.useState("hidden"),[f,h]=q.useState(!1),g=!!a&&!i&&!ka();return q.useEffect(()=>{o("expanded"===u)},[u]),q.useEffect(()=>()=>o(!1),[]),q.useEffect(()=>{if("expanded"!==u){if("hidden"===u&&e&&g){const e=setTimeout(()=>p("teaser"),800);return()=>clearTimeout(e)}"teaser"!==u||e&&g||p("hidden")}},[u,e,g]),q.useEffect(()=>{"teaser"!==u||li||(li=!0,C()?.capture("quiz_card_impression",{presentation:"pill"}))},[u]),{phase:u,open:f,flow:a,text:si(l||"English",c),handleStart:()=>{"expanded"!==u&&C()?.capture("quiz_card_started",{presentation:"pill"}),p("expanded"),h(!0)},handleDismiss:()=>{Ca(),d(),Bt(),Dt(),C()?.capture("quiz_card_dismiss",{phase:u,presentation:"pill"}),h(!1),p("hidden"),r?.()},handleCollapse:()=>h(!1),handleComplete:(e,t)=>{s(),C()?.capture("quiz_card_completed"),h(!1),p("hidden"),n(e,void 0,t),C()?.capture("quiz_card_widget_opened")},handleSkipToChat:()=>{Ca(),s(),C()?.capture("quiz_card_skip_to_chat"),h(!1),p("hidden"),r?.(),t()}}}({speaking:"quiz"===b,onStartChat:o.onStartChat,onOpenWidget:o.onOpenWidget,onDismissed:o.onDismissed,onEngagedChange:d}),y=cr(s,l),v=Math.round((l?48:56)*la(s,l)),w=dr(y,s,l),k=`calc(100vw - ${2*y.sideSpacing}px)`,j=`min(${l?340:360}px, ${k})`,S=`min(400px, ${k})`,z=e=>w?`max(240px, calc(100vh - ${ur(y,s)+(e?v+8:0)+16}px))`:`max(240px, calc(50vh + ${y.bottomSpacing+(e?-v/2-8:v/2)-16}px))`,E=z(e),A="opposite"===function(e){return"opposite"===e?.customization?.quiz_position?"opposite":"launcher"}(s),R=l&&e,T=e&&!l?`calc(100vw - ${2*y.sideSpacing+v+16}px)`:k,_=A?{pillMaxW:`min(${l?340:360}px, ${T})`,panelW:`min(400px, ${T})`,panelMaxH:z(R)}:{pillMaxW:j,panelW:S,panelMaxH:E},W=("quiz"===b||c)&&O.jsx(ci,{quiz:x,isMobile:l,layer:a,..._}),I=O.jsxs(ae,{position:"absolute",bottom:e?"100%":0,mb:e?2:0,[y.align]:0,w:"max-content","data-dori-corner-slot":"",children:[O.jsx(va,{api:u,isMobile:l,layer:a,pillMaxW:j,panelW:S,panelMaxH:E}),!A&&W]}),L=A&&W?O.jsx(ae,{position:"fixed",zIndex:"1000000",...di(n),children:O.jsx(ae,{position:"relative",h:`${v}px`,transform:w?void 0:`translateY(calc(-50% + ${y.bottomSpacing}px))`,children:O.jsx(ae,{position:"absolute",bottom:R?`${v+8}px`:0,[ui(y.align)]:0,w:"max-content","data-dori-corner-slot":"","data-dori-quiz-corner":"",children:W})})}):null,M=null!==b||m||o.eligible&&!g;return e?O.jsxs(O.Fragment,{children:[O.jsx(ae,{ref:i,position:"fixed",zIndex:"1000000",...n,children:O.jsx(wi,{onClick:r,suppressBubble:M,slot:I})}),L]}):O.jsxs(O.Fragment,{children:[O.jsx(ae,{position:"fixed",zIndex:"1000000",...n,children:O.jsx(ae,{position:"relative",h:`${v}px`,transform:w?void 0:`translateY(calc(-50% + ${y.bottomSpacing}px))`,children:I})}),L]})}),ji="dori-chat",Si="#dori-chat",zi={open:!1,expand:!1};function Ei(){if("undefined"==typeof window)return!1;try{const e=window.DORI_HIDE_LAUNCHER;if(!0===e||"true"===e)return!0;const t=document.querySelector("script#dori-side-widget");return"true"===t?.getAttribute("data-hide-launcher")}catch{return!1}}function Ai({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return!(r||"never"===e||"fallback"===e&&t&&!1!==n)}function Ri({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return r||"fallback"!==e||!t||null!==n}function Ti(){const[e,t]=q.useState(()=>{const e=document.querySelector("script#dori-side-widget");return"true"===e?.getAttribute("data-test-mode")}),[n,r]=q.useState(!1),[s,l]=q.useState(Ei),[c,d]=q.useState(()=>window.__doriAskResult??null),[u,p]=q.useState(!1),f=c?c.placed:!u&&null,[h,g]=q.useState(""),{botData:m,botError:b,updateBotData:x,diagnosticFlow:y,diagnosticShown:v,onWidgetOpened:w,setPanelOpen:k}=ie(),C=se(),j=q.useRef(m);j.current=m;const S=q.useRef(null),z=q.useCallback(e=>{const t=L(e);if(!t)return!1;const n=j.current;if(!n)return S.current=e??{},!0;const r=R(n.feature_flags,o(),t);return!!r&&(window.location.assign(r),!0)},[]);q.useEffect(()=>{const e=S.current;m&&e&&(S.current=null,window.doriWidget?.open?.(e))},[m]),function(e){const{isTestMode:t,sendMessage:n,submitFeedback:r,messages:o,inputState:a,chatState:i}=ie(),s=q.useRef({open:e,sendMessage:n,submitFeedback:r});s.current={open:e,sendMessage:n,submitFeedback:r},q.useEffect(()=>{if(!t)return;const e=window,n=e=>{const t=String(e||"").trim();t&&(s.current.open(),s.current.sendMessage({message:t}))};return e.doriWidget={...e.doriWidget,ask:n,rateAnswer:(e,t,n)=>s.current.submitFeedback(e,t,n)},()=>{e.doriWidget?.ask===n&&(delete e.doriWidget.ask,delete e.doriWidget.rateAnswer)}},[t]);const l=q.useRef(o);l.current=o;const c=q.useRef(i.threadId);c.current=i.threadId;const d=q.useRef(!1);q.useEffect(()=>{const e="generating"===a,n=d.current&&!e;if(d.current=e,!t||!n)return;const r=window.setTimeout(()=>{const e=l.current.filter(e=>"dori"===e.type),t=e[e.length-1];t&&t.content?.trim()&&window.dispatchEvent(new CustomEvent("dori:test-answer",{detail:{widget:"side",index:e.length-1,text:t.content,threadId:c.current??null}}))},400);return()=>window.clearTimeout(r)},[a,t])}(()=>{V.current="api_open",t(!0)});const N=!0===m?.feature_flags?.panel_drawer,Y=n&&!C.isMini&&!N,V=q.useRef("unknown"),U=q.useRef(e),Z=q.useRef(e);Z.current=e,q.useEffect(()=>{e&&!U.current&&(w(),i("widget_opened",{assistantId:m?.assistant_id,payload:{trigger:V.current}}),V.current="unknown"),U.current=e},[e,m?.assistant_id,w]),q.useEffect(()=>{k(e)},[e,k]);const[K,Q]=q.useState(null),G=m?.assistant_id;q.useEffect(()=>{T()},[]),q.useEffect(()=>{K&&G&&(Q(null),i(K.event,{assistantId:G,payload:{intent:K.intent}}))},[K,G]),q.useEffect(()=>{if(G)return _(e=>i("banner_seen",{assistantId:G,payload:{intent:e}}))},[G]);const[X,J]=q.useState(null),[$,ee]=q.useState(!1),te=!0===m?.feature_flags?.base_channel&&!0===m?.customization?.disable_welcome_popup,ne=!0===m?.customization?.enable_standalone_quiz&&vi(m)&&!!y&&!v&&!$&&!e&&!ka()&&!te&&!xt(),[re,oe]=q.useState(null),{isCurrentPathBanned:le}=(e=>{const[t,n]=q.useState("");return q.useEffect(()=>{const e=()=>{n(E())};e();const t=()=>{e()};window.addEventListener("popstate",t);const r=history.pushState,o=history.replaceState;return history.pushState=function(...t){r.apply(history,t),e()},history.replaceState=function(...t){o.apply(history,t),e()},()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=o}},[]),{isCurrentPathBanned:()=>A(t,e)}})(m?.banned_paths||[]);q.useEffect(()=>{e&&Dt()},[e]),q.useEffect(()=>{!function(e,t){if(!e)return;const n=function(e){return"number"==typeof e&&Number.isInteger(e)?e<1||e>2147483647?null:e:null}(t);if(null===n)return e.style.removeProperty("position"),void e.style.removeProperty("z-index");e.style.position="relative",e.style.zIndex=String(n)}(document.getElementById("dori-react-widget-host"),m?.feature_flags?.widget_z_index)},[m?.feature_flags?.widget_z_index]),q.useEffect(()=>{m?.merchant_support_channels?.crisp?.enabled&&(fr(),pr()&&window.$crisp.push(["on","chat:closed",()=>{fr()}]))},[m?.merchant_support_channels?.crisp?.enabled]),q.useEffect(()=>{m?.merchant_support_channels?.chatra?.enabled&&(jr("hideChatraWidget invoked"),br=!0,function(e){if(Sr())return void e();const t=Date.now(),n=setInterval(()=>{Sr()?(clearInterval(n),e()):Date.now()-t>gr&&(clearInterval(n),jr("Chatra never became ready within",gr,"ms"))},200)}(()=>{xr||Er("initial hide")}),null!==yr||"undefined"==typeof window||xr||(vr=Date.now(),yr=setInterval(Rr,1e3)))},[m?.merchant_support_channels?.chatra?.enabled]),q.useEffect(()=>{m?.merchant_support_channels?.shopifyInbox?.enabled&&function(){if("undefined"==typeof document)return;if(document.getElementById(Wr))return;const e=document.createElement("style");e.id=Wr,e.textContent=`\n html:not([${Ir}]) ${Lr}::part(activator) { display: none !important; }\n html:not([${Ir}]) ${Mr} { display: none !important; }\n `,document.head.appendChild(e),Fr("launcher hidden")}()},[m?.merchant_support_channels?.shopifyInbox?.enabled]),q.useEffect(()=>{if(!h||!m?.is_widget_enabled)return;const e=window.setTimeout(()=>{Qt(a.klaviyoStorefront,h)},4e3);return()=>window.clearTimeout(e)},[h,m?.is_widget_enabled]),Gt({sharingId:h});const ce=ln({base:!0,md:!1})??!1,de=cr(m,ce),ue=((e,t=!1,n=null)=>{const{align:r,sideSpacing:o}=e;return t?{bottom:`${ur(e,n)}px`,[r]:`${o}px`}:{top:"50%",[r]:`${o}px`}})(de,dr(de,m,ce),m);q.useEffect(()=>{window.chatbotData?g(window.chatbotData.sharingID):W("useEffect sharing ID",()=>{g((()=>{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||""})());const e=document.querySelector("script#dori-side-widget");if(!e)return;const t=new MutationObserver(t=>{for(const n of t)if("attributes"===n.type&&"data-sharing-id"===n.attributeName){const t=e.getAttribute("data-sharing-id")||"";g(t),console.log("data-sharing-id changed:",t)}});return t.observe(e,{attributes:!0,attributeFilter:["data-sharing-id"]}),()=>{t.disconnect()}})()},[]);const pe=q.useRef(null),fe=q.useRef(!1),he=q.useRef(null);q.useEffect(()=>{const e=e=>d(e.detail??null);return window.addEventListener("dori:ask-button",e),()=>window.removeEventListener("dori:ask-button",e)},[]);const ge=Boolean(m?.feature_flags?.ask_button);q.useEffect(()=>{if(!ge||c)return;const e=setTimeout(()=>p(!0),4e3);return()=>clearTimeout(e)},[ge,c]);const me={mode:m?.feature_flags?.bubble_mode,askOn:ge,askPlaced:f,pageHidden:s},be=c??(ge&&u?{zone:"none",device:rn()}:null);q.useEffect(()=>{if(!be||be.pending||!m?.assistant_id)return;let e=!0;try{e=on(window.sessionStorage,be.device)}catch{}e&&i("header_entry",{assistantId:m.assistant_id,payload:{zone:be.zone,spot:be.spot,label:be.label,device:be.device}})},[be?.zone,be?.device,be?.pending,m?.assistant_id]);const xe=q.useCallback(()=>{const e=document.getElementById("dori-react-widget-host");e&&e.contains(document.activeElement)&&(fe.current=!0),t(!1)},[]);q.useEffect(()=>{if(!e)return;const t=e=>{if("Escape"!==e.key)return;const t=document.getElementById("dori-react-widget-host");if(!(e.target instanceof Node))return;const n=he.current;(n&&n.contains(e.target)||t&&t.contains(e.target))&&setTimeout(()=>{e.defaultPrevented||xe()},0)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,xe]);const ye=Yn(),ve=q.useRef(ye);ve.current=ye,q.useEffect(()=>{if(!e||!ve.current)return;const t=setTimeout(()=>{(function(){const e=document.getElementById("dori-react-widget-host");if(!e)return null;const t=[e];for(;t.length;){const e=t.shift();for(const t of e.querySelectorAll("textarea"))if(t.getClientRects().length)return t;for(const n of e.querySelectorAll("*"))n.shadowRoot&&t.push(n.shadowRoot)}return null})()?.focus({preventScroll:!0})},350);return()=>clearTimeout(t)},[e]),q.useEffect(()=>{if(e||!fe.current)return;fe.current=!1;const t=he.current;he.current=null;const n=requestAnimationFrame(()=>{t?.isConnected?t.focus({preventScroll:!0}):pe.current?.querySelector("button.fab-glass")?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[e]),q.useEffect(()=>{const e=e=>{if(z(e))return;if(M(Z.current,e?.source))return void t(!1);const n=P(e),o="banner_link"===e?.source;V.current=n?o?"banner_link":"banner":e?.source??"api_open";const a=document.activeElement,i=document.getElementById("dori-react-widget-host");if(he.current=a instanceof HTMLElement&&a!==document.body&&!i?.contains(a)?a:null,t(!0),e?.expand&&r(!0),n){const t=B(e),n=F(t),{firstTap:r,sendOpener:a}=D(n);r&&Q({intent:n,event:o?"banner_link_tapped":"banner_tapped"});const i=a?H(n,t?.initiator):null;i&&J(i)}},n=()=>t(!1),o=e=>{"cart"===e.detail?.reason&&(Ca(),ee(!0)),n()},a=()=>{V.current="api_toggle",t(e=>!e)},i=e=>{x(e)},s=()=>l(!0),c=()=>l(!1),d=window;d.doriWidget={...d.doriWidget,open:e,close:n,toggle:a,updateConfig:i,hideLauncher:s,showLauncher:c},I(t=>e(t));const u=t=>{const n=t.detail;e(n)};return window.addEventListener("dori:open-widget",u),window.addEventListener("dori:close-widget",o),window.addEventListener("dori:toggle-widget",a),window.addEventListener("dori:hide-launcher",s),window.addEventListener("dori:show-launcher",c),()=>{d.doriWidget&&(d.doriWidget.open===e&&delete d.doriWidget.open,d.doriWidget.close===n&&delete d.doriWidget.close,d.doriWidget.toggle===a&&delete d.doriWidget.toggle,d.doriWidget.updateConfig===i&&delete d.doriWidget.updateConfig,d.doriWidget.hideLauncher===s&&delete d.doriWidget.hideLauncher,d.doriWidget.showLauncher===c&&delete d.doriWidget.showLauncher),window.removeEventListener("dori:open-widget",u),window.removeEventListener("dori:close-widget",o),window.removeEventListener("dori:toggle-widget",a),window.removeEventListener("dori:hide-launcher",s),window.removeEventListener("dori:show-launcher",c)}},[x,z]),q.useEffect(()=>{const e=function(){if("undefined"==typeof window)return zi;try{const e=new URLSearchParams(window.location.search).get(ji)?.trim().toLowerCase();if("banner"===e)return{open:!0,expand:!0,banner:!0};if("open"===e||"expand"===e)return{open:!0,expand:"expand"===e};if(window.location.hash.toLowerCase()===Si)return{open:!0,expand:!1}}catch{}return zi}();e.open&&(function(){if("undefined"!=typeof window&&window.history?.replaceState)try{const e=new URL(window.location.href);let t=!1;e.searchParams.has(ji)&&(e.searchParams.delete(ji),t=!0),e.hash.toLowerCase()===Si&&(e.hash="",t=!0),t&&window.history.replaceState(window.history.state,"",e.toString())}catch{}}(),e.banner?window.doriWidget?.open?.({source:"banner_link",expand:!0}):e.expand&&z({expand:!0,source:"link"})||(V.current="deep_link",t(!0),e.expand&&r(!0)))},[z]);const we=Xt({botData:m,botError:b,isPathBanned:le()});b&&!m&&console.warn("[Dori Widget] bot data unavailable — hiding widget:",b);const ke=q.useCallback((e,n,r)=>{ee(!0),J({message:e,imageUrl:n,apiMessage:r}),V.current="quiz_chat",t(!0)},[]),Ce=q.useCallback(()=>{J(null)},[]);return O.jsx(ae,{fontFamily:Jt("system-ui, Avenir, Helvetica, Arial, sans-serif"),lineHeight:"1.5",fontWeight:"400",colorScheme:"light",children:!we&&O.jsxs(O.Fragment,{children:[O.jsx(sa,{isOpen:e,onClose:xe,isExpanded:Y,onToggleExpand:C.isMini||N?void 0:e=>r(void 0===e?!Y:e),fullPageHref:R(m?.feature_flags,o(),"chat"),pendingChat:X,onPendingChatConsumed:Ce}),!e&&O.jsx(Ci,{ref:pe,bubble:Ai(me),settled:Ri(me),styles:ue,onClick:()=>{e||(V.current="fab",he.current=null),t(!e)},quiz:{eligible:ne,onStartChat:ke,onOpenWidget:()=>{V.current="quiz_card",t(!0)},onDismissed:()=>ee(!0)},sheetLayer:re}),O.jsx(ae,{ref:oe,"data-dori-corner-layer":""})]})})}function _i(){return O.jsx(Ti,{})}console.log("isDevelopment",!1);let Wi=!1;function Ii(){if(Wi)return console.log("[Dori Widget] Already initialized, skipping"),()=>{};Wi=!0;const e=[];let t=document.getElementById("dori-react-widget-host");t||(t=document.createElement("div"),t.id="dori-react-widget-host",t.setAttribute("data-nosnippet",""),document.body.appendChild(t));const n=$t.createRoot(t);n.render(O.jsx(oe.StrictMode,{children:O.jsx(Xe,{children:O.jsx(en,{children:O.jsx(_i,{})})})})),e.push(n);const r=()=>{v(()=>import("./MarkdownContent-D7AdAAbE.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})};return"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r,{timeout:3e3}):window.setTimeout(r,1500),()=>{e.forEach(e=>e.unmount()),Wi=!1}}export{Ii as initializeDoriWidget};
|
|
2
|
+
import{l as e,h as t,i as n,o as r,n as o,A as a,t as i,p as s,c as l,a as c,b as d,d as u,f as p,g as f,e as h,j as g,k as m,m as b,q as x,r as y,_ as v,s as w,u as k,v as C,w as j,x as S,y as z,z as E,B as A,C as R,D as _,E as T,F as W,G as I,H as L,I as M,J as B,K as F,L as D,M as H,N as P}from"../widget.js";import{r as q,j as O,c as N,a as Y,u as V,g as U,b as Z,d as K,e as Q,m as G,f as X,h as J,i as $,B as ee,k as te,l as ne,n as re,R as oe,o as ae,p as ie,q as se,s as le,t as ce,I as de,H as ue,U as pe,T as fe,v as he,V as ge,w as me,S as be,x as xe,y as ye,z as ve,A as we,G as ke,C as Ce,D as je,E as Se,F as ze,J as Ee,K as Ae,L as Re,M as _e,N as Te,O as We,P as Ie,Q as Le,W as Me,X as Be,Y as Fe,Z as De,_ as He,$ as Pe,a0 as qe,a1 as Oe,a2 as Ne,a3 as Ye,a4 as Ve,a5 as Ue,a6 as Ze,a7 as Ke,a8 as Qe,a9 as Ge,aa as Xe,ab as Je,ac as $e,ad as et,ae as tt,af as nt,ag as rt,ah as ot,ai as at,aj as it,ak as st,al as lt,am as ct,an as dt,ao as ut,ap as pt,aq as ft,ar as ht,as as gt,at as mt,au as bt,av as xt,aw as yt,ax as vt,ay as wt,az as kt,aA as Ct,aB as jt,aC as St,aD as zt,aE as Et,aF as At,aG as Rt,aH as _t,aI as Tt,aJ as Wt,aK as It,aL as Lt,aM as Mt,aN as Bt,aO as Ft,aP as Dt,aQ as Ht,aR as Pt,aS as qt,aT as Ot,aU as Nt,aV as Yt,aW as Vt,aX as Ut,aY as Zt,aZ as Kt,a_ as Qt,a$ as Gt,b0 as Xt,b1 as Jt,b2 as $t,b3 as en}from"./provider-BH4DFhmC.js";import{u as tn,L as nn}from"./link-BqZqqrLE.js";import{d as rn,s as on}from"./report-BHr6U1PB.js";const an=q.forwardRef(function(e,t){const{templateAreas:n,column:r,row:o,autoFlow:a,autoRows:i,templateRows:s,autoColumns:l,templateColumns:c,inline:d,...u}=e;return O.jsx(N.div,{...u,ref:t,css:[{display:d?"inline-grid":"grid",gridTemplateAreas:n,gridAutoColumns:l,gridColumn:r,gridRow:o,gridAutoFlow:a,gridAutoRows:i,gridTemplateRows:s,gridTemplateColumns:c},e.css]})});var sn=Y();function ln(e,t){const n=V().normalizeValue(e),r=function(e={}){e.fallback||(e.fallback="base");const t=V();let n=!1;const r=t.breakpoints.values.map(({min:t,name:r})=>{const o={breakpoint:r,query:`(min-width: ${t})`,fallback:!n};return r===e.fallback&&(n=!0),o}).filter(({breakpoint:t})=>!!e.breakpoints?.includes(t)),o=r.map(({fallback:e})=>e),a=function(e,t={}){const{fallback:n=[],ssr:r=!0,getWindow:o}=t,a=function(e,t=[]){const n=q.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return q.useInsertionEffect(()=>{n.current=e}),q.useCallback((...e)=>n.current?.(...e),t)}(o),i=Array.isArray(e)?e:[e],s=n?.filter(e=>null!=e),[l,c]=q.useState(()=>i.map((e,t)=>{if(!r){const{media:t,matches:n}=(o?.()??window).matchMedia(e);return{media:t,matches:n}}return{media:e,matches:!!s[t]}}));return q.useEffect(()=>{const e=a()??window;c(t=>{const n=i.map(t=>{const{media:n,matches:r}=e.matchMedia(t);return{media:n,matches:r}});return t.every((e,t)=>e.matches===n[t].matches&&e.media===n[t].media)?t:n});const t=i.map(t=>e.matchMedia(t)),n=e=>{c(t=>t.slice().map(t=>t.media===e.media?{...t,matches:e.matches}:t))},r=t.map(e=>function(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch(n){return e.addListener(t),()=>e.removeListener(t)}}(e,n));return()=>r.forEach(e=>e())},[a]),l.map(e=>e.matches)}(r.map(e=>e.query),{fallback:o,ssr:e.ssr}).lastIndexOf(!0);return r[a]?.breakpoint??e.fallback}({breakpoints:Object.keys(n),...t});return n[r]}var cn=e=>{if(!e)return;const t=U(e),n=Z(e),r=K(e),o=()=>{requestAnimationFrame(()=>{let n;e.style.height="auto",n="content-box"===t.boxSizing?e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),"none"!==t.maxHeight&&n>parseFloat(t.maxHeight)?("hidden"===t.overflowY&&(e.style.overflowY="scroll"),n=parseFloat(t.maxHeight)):"hidden"!==t.overflowY&&(e.style.overflowY="hidden"),e.style.height=`${n}px`})};e.addEventListener("input",o),e.form?.addEventListener("reset",o);const a=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(a,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),o()}});const s=new n.ResizeObserver(()=>{requestAnimationFrame(()=>o())});s.observe(e);const l=new n.MutationObserver(()=>o());return l.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),r.fonts?.addEventListener("loadingdone",o),()=>{e.removeEventListener("input",o),e.form?.removeEventListener("reset",o),r.fonts?.removeEventListener("loadingdone",o),s.disconnect(),l.disconnect()}};const dn=q.forwardRef((e,t)=>{const{autoresize:n,...r}=e,o=q.useRef(null),a=Q(),i=G(a?.getTextareaProps(),{style:{resize:n?"none":void 0}},r);return q.useEffect(()=>{if(n)return cn(o.current)},[n]),O.jsx(X.textarea,{...i,ref:J(t,o)})});dn.displayName="FieldTextarea";const{withContext:un}=$({key:"badge"}),pn=un("span"),fn=q.forwardRef(function(e,t){return O.jsx(ee,{px:"0",py:"0",_icon:{fontSize:"1.2em"},ref:t,...e})}),{useRecipeResult:hn}=$({key:"icon"}),gn=q.forwardRef(function(e,t){const{styles:n,className:r,props:o}=hn({asChild:!e.as,...e});return O.jsx(N.svg,{ref:t,focusable:!1,"aria-hidden":"true",...o,css:[n,e.css],className:te(r,e.className)})});function mn(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,a=q.Children.toArray(e.path),i=q.forwardRef((e,r)=>O.jsx(gn,{ref:r,asChild:!1,viewBox:t,...o,...e,children:a.length?a:O.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}const bn=q.forwardRef(function(e,t){const{direction:n,align:r,justify:o,wrap:a,basis:i,grow:s,shrink:l,inline:c,...d}=e;return O.jsx(N.div,{ref:t,...d,css:{display:c?"inline-flex":"flex",flexDirection:n,alignItems:r,justifyContent:o,flexWrap:a,flexBasis:i,flexGrow:s,flexShrink:l,...e.css}})}),xn=q.forwardRef(function(e,t){const{columns:n,minChildWidth:r,...o}=e,a=V(),i=r?function(e,t){return ne(e,e=>{const n=t.tokens.getVar(`sizes.${e}`,"number"==typeof(r=e)?`${r}px`:r);var r;return null===e?null:`repeat(auto-fit, minmax(${n}, 1fr))`})}(r,a):ne(n,e=>null===e?null:`repeat(${e}, minmax(0, 1fr))`);return O.jsx(an,{ref:t,templateColumns:i,...o})}),{withContext:yn}=$({key:"textarea"}),vn=yn(dn),wn=mn({displayName:"CloseIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M6.26915 5.7309C5.98798 5.44973 5.53209 5.44973 5.25092 5.7309C4.96975 6.01207 4.96975 6.46796 5.25092 6.74913L10.5018 12L5.25092 17.2509C4.96975 17.5321 4.96975 17.9879 5.25092 18.2691C5.53209 18.5503 5.98798 18.5503 6.26915 18.2691L11.52 13.0183L16.7709 18.2691C17.0521 18.5503 17.5079 18.5503 17.7891 18.2691C18.0703 17.9879 18.0703 17.5321 17.7891 17.2509L12.5383 12L17.7891 6.74913C18.0703 6.46796 18.0703 6.01207 17.7891 5.7309C17.5079 5.44973 17.0521 5.44973 16.7709 5.7309L11.52 10.9817L6.26915 5.7309Z",fill:"currentColor"})}),kn=mn({displayName:"CheckCircleIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm4.457 7.457-5.25 5.25a1 1 0 0 1-1.414 0l-2.25-2.25a1 1 0 1 1 1.414-1.414l1.543 1.543 4.543-4.543a1 1 0 0 1 1.414 1.414Z",fill:"currentColor"})}),Cn=mn({displayName:"ExternalLinkIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M14 4a1 1 0 0 1 0-2h7a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0V6.414l-8.293 8.293a1 1 0 0 1-1.414-1.414L18.586 5H14ZM5 7a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-5a1 1 0 1 0-2 0v4H6V9h4a1 1 0 1 0 0-2H5Z",fill:"currentColor"})}),jn=mn({displayName:"ExpandIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fill:"currentColor"})}),Sn=mn({displayName:"ReplyIcon",viewBox:"0 0 15 12",path:O.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.16536 1.81467C7.16536 0.791333 5.9427 0.263999 5.1987 0.965999L1.30003 4.64C1.15132 4.78022 1.03284 4.94936 0.951856 5.13703C0.870874 5.3247 0.829102 5.52694 0.829102 5.73133C0.829102 5.93573 0.870874 6.13797 0.951856 6.32563C1.03284 6.5133 1.15132 6.68244 1.30003 6.82267L5.19736 10.5C5.94136 11.202 7.1647 10.674 7.1647 9.65133V8.33467C7.93731 8.19507 8.73376 8.28024 9.45939 8.58006C10.185 8.87989 10.8093 9.38175 11.258 10.026L11.7927 10.794C12.5207 11.84 14.162 11.3247 14.162 10.0507V9.738C14.162 5.89267 10.9394 2.87667 7.1647 3.05733L7.16536 1.81467ZM5.8847 1.69333C5.90839 1.67111 5.93807 1.6563 5.97007 1.65072C6.00208 1.64514 6.03501 1.64904 6.06483 1.66193C6.09465 1.67482 6.12005 1.69614 6.13791 1.72328C6.15577 1.75042 6.16531 1.78218 6.16536 1.81467V3.54C6.16536 3.87333 6.45736 4.132 6.78803 4.092C10.1767 3.68 13.1627 6.32467 13.1627 9.73867V10.0507C13.1627 10.3453 12.7827 10.4647 12.614 10.2227L12.0787 9.45467C11.4785 8.5928 10.6268 7.93727 9.63996 7.57763C8.65317 7.21799 7.5794 7.17179 6.56536 7.44533C6.45052 7.47639 6.34911 7.54442 6.27681 7.6389C6.2045 7.73337 6.16534 7.84903 6.16536 7.968V9.65067C6.16531 9.68315 6.15577 9.71492 6.13791 9.74205C6.12005 9.76919 6.09465 9.79051 6.06483 9.8034C6.03501 9.81629 6.00208 9.82019 5.97007 9.81461C5.93807 9.80903 5.90839 9.79422 5.8847 9.772L1.9867 6.09533C1.93716 6.04859 1.8977 5.99223 1.87072 5.92969C1.84375 5.86716 1.82984 5.79977 1.82984 5.73167C1.82984 5.66356 1.84375 5.59618 1.87072 5.53364C1.8977 5.4711 1.93716 5.41474 1.9867 5.368L5.8847 1.69333Z",fill:"currentColor"})}),zn=mn({displayName:"SuggestionIcon",viewBox:"0 0 16 16",path:O.jsx("path",{d:"M4.56503 3.915C5.11896 2.73832 6.04737 1.77849 7.20497 1.18572C8.36257 0.592947 9.68402 0.400681 10.9625 0.63901C12.2411 0.877339 13.4045 1.53281 14.2708 2.50286C15.137 3.4729 15.6573 4.70277 15.75 6C15.8332 7.19515 15.548 8.38706 14.9329 9.41516C14.3178 10.4433 13.4024 11.2581 12.31 11.75C11.9379 12.672 11.3425 13.4871 10.5774 14.122C9.81221 14.7569 8.90126 15.1917 7.92642 15.3873C6.95158 15.5829 5.94341 15.5332 4.99255 15.2426C4.04169 14.952 3.17794 14.4297 2.47896 13.7226C1.77998 13.0155 1.26768 12.1458 0.988107 11.1916C0.708538 10.2375 0.670468 9.2288 0.877321 8.25629C1.08417 7.28377 1.52946 6.37791 2.17316 5.62013C2.81685 4.86235 3.63877 4.27641 4.56503 3.915ZM9.90503 1.5H9.60503C8.52019 1.56681 7.48862 1.99351 6.67357 2.71256C5.85852 3.43161 5.30656 4.40195 5.10503 5.47L10.675 1.565C10.4205 1.52309 10.163 1.50136 9.90503 1.5ZM11.905 1.93L5.33003 6.555L5.06003 6.745C5.11592 7.4665 5.33108 8.16663 5.69003 8.79499L13.565 3.155C13.1023 2.63199 12.5329 2.21427 11.895 1.93H11.905ZM14.145 3.97L6.25003 9.60999C6.70986 10.1331 7.27572 10.5524 7.91003 10.84L14.75 5.82C14.6759 5.16869 14.47 4.53927 14.145 3.97ZM14.75 7.065L9.10503 11.2C9.4681 11.2629 9.83728 11.283 10.205 11.26C11.33 11.1916 12.3968 10.7368 13.225 9.97234C14.0532 9.20793 14.5919 8.1809 14.75 7.065ZM6.75003 14.5C7.59348 14.4958 8.42238 14.2798 9.16061 13.8718C9.89883 13.4638 10.5227 12.8769 10.975 12.165C10.7406 12.2117 10.5035 12.2434 10.265 12.26H9.90003C8.40699 12.257 6.97069 11.6876 5.88117 10.6668C4.79165 9.64592 4.13007 8.24969 4.03003 6.76C4.00121 6.25734 4.03819 5.75307 4.14003 5.26C3.22219 5.83357 2.51524 6.68948 2.12538 7.69915C1.73553 8.70883 1.68382 9.81774 1.97803 10.8593C2.27224 11.9009 2.89648 12.8189 3.75697 13.4754C4.61746 14.1318 5.66774 14.4914 6.75003 14.5Z",fill:"currentColor"})}),En=mn({displayName:"AiSearchIcon",viewBox:"0 0 16 16",path:O.jsxs(O.Fragment,{children:[O.jsx("path",{d:"M8 2.66683C5.42267 2.66683 3.33333 4.75617 3.33333 7.3335H2C2 4.01979 4.68629 1.3335 8 1.3335C11.3137 1.3335 14 4.01979 14 7.3335C14 8.75016 13.509 10.0522 12.6879 11.0786L14.8047 13.1954L13.8619 14.1382L11.7451 12.0214C10.7187 12.8425 9.41667 13.3335 8 13.3335V12.0002C10.5773 12.0002 12.6667 9.91083 12.6667 7.3335C12.6667 4.75617 10.5773 2.66683 8 2.66683Z",fill:"currentColor"}),O.jsx("path",{d:"M5.85714 6.6665L2 11.2498H4.57143L4.14286 13.9998L8 9.4165H5.42857L5.85714 6.6665Z",fill:"currentColor"})]})}),An=mn({displayName:"SparkleIcon",viewBox:"0 0 16 16",path:O.jsxs(O.Fragment,{children:[O.jsx("path",{d:"M8 1.5l1.15 3.11a2 2 0 0 0 1.18 1.18L13.44 6.93l-3.11 1.15a2 2 0 0 0-1.18 1.18L8 12.37l-1.15-3.11a2 2 0 0 0-1.18-1.18L2.56 6.93l3.11-1.15a2 2 0 0 0 1.18-1.18L8 1.5Z",fill:"currentColor"}),O.jsx("path",{d:"M12.75 10.5l.42 1.13c.08.22.25.39.47.47l1.13.42-1.13.42a.83.83 0 0 0-.47.47l-.42 1.13-.42-1.13a.83.83 0 0 0-.47-.47l-1.13-.42 1.13-.42c.22-.08.39-.25.47-.47l.42-1.13Z",fill:"currentColor",opacity:"0.75"})]})}),Rn=mn({displayName:"SquareBlackIcon",viewBox:"0 0 32 32",path:O.jsxs(O.Fragment,{children:[O.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),O.jsx("path",{d:"M22 10H10V22H22V10Z",fill:"var(--chakra-colors-button-text, white)"})]})}),_n=mn({displayName:"ArrowUpBlackIcon",viewBox:"0 0 32 32",path:O.jsxs(O.Fragment,{children:[O.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),O.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5858 11.0002C15.3669 10.2191 16.6332 10.2191 17.4143 11.0002L20.3738 13.9597C20.7643 14.3502 20.7643 14.9834 20.3738 15.3739C19.9833 15.7644 19.3501 15.7644 18.9596 15.3739L17 13.4144V21.0002C17 21.5524 16.5523 22.0002 16 22.0002C15.4478 22.0002 15 21.5524 15 21.0002V13.4144L13.0405 15.3739C12.65 15.7644 12.0168 15.7645 11.6263 15.3739C11.2358 14.9834 11.2358 14.3502 11.6263 13.9597L14.5858 11.0002Z",fill:"var(--chakra-colors-button-text, white)"})]})}),Tn=mn({displayName:"ArrowLeftIcon",viewBox:"0 0 32 32",path:O.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0002 17.4139C10.2191 16.6329 10.2191 15.3665 11.0002 14.5855L13.9597 11.6259C14.3502 11.2354 14.9834 11.2354 15.3739 11.6259C15.7644 12.0165 15.7644 12.6496 15.3739 13.0401L13.4144 14.9997H21.0002C21.5524 14.9997 22.0002 15.4474 22.0002 15.9997C22.0002 16.552 21.5524 16.9997 21.0002 16.9997H13.4144L15.3739 18.9592C15.7644 19.3498 15.7645 19.9829 15.3739 20.3735C14.9834 20.764 14.3502 20.764 13.9597 20.3735L11.0002 17.4139Z",fill:"currentColor"})}),Wn=mn({displayName:"ReloadIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M19.146 4.854l-1.489 1.489A8 8 0 1 0 12 20a8.094 8.094 0 0 0 7.371-4.886 1 1 0 1 0-1.842-.779A6.071 6.071 0 0 1 12 18a6 6 0 1 1 4.243-10.243l-1.39 1.39a.5.5 0 0 0 .354.854H19.5A.5.5 0 0 0 20 9.5V5.207a.5.5 0 0 0-.854-.353z",fill:"currentColor"})}),In=mn({displayName:"CartBagIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M16 7C16 5.4 14.9 4 13.5 4H10.5C9.1 4 8 5.4 8 7H5C4.448 7 4 7.448 4 8V19C4 19.552 4.448 20 5 20H19C19.552 20 20 19.552 20 19V8C20 7.448 19.552 7 19 7H16ZM10.5 6H13.5C13.776 6 14 6.4 14 7H10C10 6.4 10.224 6 10.5 6ZM18 18H6V9H8V10.5C8 11.052 8.448 11.5 9 11.5C9.552 11.5 10 11.052 10 10.5V9H14V10.5C14 11.052 14.448 11.5 15 11.5C15.552 11.5 16 11.052 16 10.5V9H18V18Z",fill:"currentColor"})}),Ln=mn({displayName:"HeartIcon",viewBox:"0 0 24 24",path:O.jsx("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 1 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",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),Mn=mn({displayName:"HeartFilledIcon",viewBox:"0 0 24 24",path:O.jsx("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 1 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",fill:"currentColor",stroke:"currentColor",strokeWidth:"1",strokeLinejoin:"round"})}),Bn=mn({displayName:"ArrowRightIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M12.293 5.293C12.684 4.902 13.316 4.902 13.707 5.293L19.707 11.293C20.098 11.684 20.098 12.316 19.707 12.707L13.707 18.707C13.316 19.098 12.684 19.098 12.293 18.707C11.902 18.316 11.902 17.684 12.293 17.293L16.586 13H5C4.448 13 4 12.552 4 12C4 11.448 4.448 11 5 11H16.586L12.293 6.707C11.902 6.316 11.902 5.684 12.293 5.293Z",fill:"currentColor"})}),Fn=mn({displayName:"AiBigIcon",viewBox:"0 0 24 24",path:O.jsx("path",{d:"M18.423 9.97031L16.7505 10.5726C15.8336 10.903 15.0009 11.4317 14.3118 12.1208C13.6226 12.81 13.094 13.6427 12.7635 14.5596L12.1613 16.2321C12.1492 16.2651 12.1272 16.2936 12.0984 16.3137C12.0695 16.3339 12.0352 16.3447 12 16.3447C11.9649 16.3447 11.9305 16.3339 11.9017 16.3137C11.8728 16.2936 11.8509 16.2651 11.8388 16.2321L11.2365 14.5596C10.9061 13.6427 10.3774 12.81 9.68826 12.1208C8.99911 11.4317 8.16641 10.903 7.24953 10.5726L5.57703 9.97031C5.544 9.9582 5.51549 9.93624 5.49535 9.9074C5.47521 9.87856 5.46441 9.84423 5.46441 9.80906C5.46441 9.77388 5.47521 9.73955 5.49535 9.71071C5.51549 9.68188 5.544 9.65992 5.57703 9.64781L7.24953 9.04556C8.16641 8.7151 8.99911 8.18645 9.68826 7.49729C10.3774 6.80814 10.9061 5.97544 11.2365 5.05856L11.8388 3.38606C11.8509 3.35303 11.8728 3.32452 11.9017 3.30438C11.9305 3.28424 11.9649 3.27344 12 3.27344C12.0352 3.27344 12.0695 3.28424 12.0984 3.30438C12.1272 3.32452 12.1492 3.35303 12.1613 3.38606L12.7635 5.05856C13.094 5.97544 13.6226 6.80814 14.3118 7.49729C15.0009 8.18645 15.8336 8.7151 16.7505 9.04556L18.423 9.64781C18.4564 9.65958 18.4853 9.68141 18.5057 9.71029C18.5261 9.73917 18.5371 9.77368 18.5371 9.80906C18.5371 9.84443 18.5261 9.87894 18.5057 9.90782C18.4853 9.9367 18.4564 9.95853 18.423 9.97031ZM22.4423 17.4988L21.5955 17.8041C21.1313 17.9715 20.7097 18.2393 20.3607 18.5883C20.0118 18.9372 19.744 19.3588 19.5765 19.8231L19.2713 20.6698C19.2652 20.6866 19.254 20.7011 19.2394 20.7113C19.2248 20.7216 19.2074 20.727 19.1895 20.727C19.1717 20.727 19.1543 20.7216 19.1396 20.7113C19.125 20.7011 19.1139 20.6866 19.1078 20.6698L18.8025 19.8231C18.635 19.3588 18.3673 18.9372 18.0183 18.5883C17.6694 18.2393 17.2478 17.9715 16.7835 17.8041L15.9368 17.4988C15.92 17.4927 15.9055 17.4816 15.8953 17.467C15.885 17.4523 15.8795 17.4349 15.8795 17.4171C15.8795 17.3992 15.885 17.3818 15.8953 17.3672C15.9055 17.3525 15.92 17.3414 15.9368 17.3353L16.7835 17.0301C17.2478 16.8626 17.6694 16.5948 18.0183 16.2459C18.3673 15.8969 18.635 15.4753 18.8025 15.0111L19.1078 14.1643C19.1139 14.1475 19.125 14.133 19.1396 14.1228C19.1543 14.1126 19.1717 14.1071 19.1895 14.1071C19.2074 14.1071 19.2248 14.1126 19.2394 14.1228C19.254 14.133 19.2652 14.1475 19.2713 14.1643L19.5765 15.0111C19.744 15.4753 20.0118 15.8969 20.3607 16.2459C20.7097 16.5948 21.1313 16.8626 21.5955 17.0301L22.4423 17.3353C22.4591 17.3414 22.4735 17.3525 22.4838 17.3672C22.494 17.3818 22.4995 17.3992 22.4995 17.4171C22.4995 17.4349 22.494 17.4523 22.4838 17.467C22.4735 17.4816 22.4591 17.4927 22.4423 17.4988ZM8.06253 17.4988L7.21578 17.8041C6.75155 17.9715 6.32995 18.2393 5.98098 18.5883C5.63201 18.9372 5.36426 19.3588 5.19678 19.8231L4.89153 20.6698C4.88542 20.6866 4.8743 20.7011 4.85967 20.7113C4.84505 20.7216 4.82763 20.727 4.80978 20.727C4.79192 20.727 4.7745 20.7216 4.75988 20.7113C4.74525 20.7011 4.73413 20.6866 4.72803 20.6698L4.42278 19.8231C4.2553 19.3588 3.98754 18.9372 3.63858 18.5883C3.28961 18.2393 2.86801 17.9715 2.40378 17.8041L1.55703 17.4988C1.54025 17.4927 1.52576 17.4816 1.51552 17.467C1.50528 17.4523 1.49979 17.4349 1.49979 17.4171C1.49979 17.3992 1.50528 17.3818 1.51552 17.3672C1.52576 17.3525 1.54025 17.3414 1.55703 17.3353L2.40378 17.0301C2.86801 16.8626 3.28961 16.5948 3.63858 16.2459C3.98754 15.8969 4.2553 15.4753 4.42278 15.0111L4.72803 14.1643C4.73413 14.1475 4.74525 14.133 4.75988 14.1228C4.7745 14.1126 4.79192 14.1071 4.80978 14.1071C4.82763 14.1071 4.84505 14.1126 4.85967 14.1228C4.8743 14.133 4.88542 14.1475 4.89153 14.1643L5.19678 15.0111C5.36426 15.4753 5.63201 15.8969 5.98098 16.2459C6.32995 16.5948 6.75155 16.8626 7.21578 17.0301L8.06253 17.3353C8.13903 17.3631 8.13903 17.4718 8.06253 17.4988Z",fill:"currentColor"})});mn({displayName:"AiRainbowIconBase",viewBox:"0 0 24 24",path:O.jsxs(O.Fragment,{children:[O.jsx("g",{clipPath:"url(#clip0_497_8063)",children:O.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:"url(#paint0_linear_497_8063)"})}),O.jsxs("defs",{children:[O.jsxs("linearGradient",{id:"paint0_linear_497_8063",x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[O.jsx("stop",{stopColor:"#FF7E90"}),O.jsx("stop",{offset:"0.463542",stopColor:"#A939FF"}),O.jsx("stop",{offset:"1",stopColor:"#0020FF"})]}),O.jsx("clipPath",{id:"clip0_497_8063",children:O.jsx("rect",{width:"24",height:"24",fill:"white"})})]})]})});const Dn=e=>{const t=tn("colors","primary"),[n,r,o]=re(t),a=oe.useMemo(()=>`rainbow-gradient-${Math.random().toString(36).substr(2,9)}`,[]),{w:i,width:s,transform:l}=e,c="string"==typeof i?i:"string"==typeof s?s:"number"==typeof i?`${i}px`:"number"==typeof s?`${s}px`:"24px";return O.jsx(ae,{position:"relative",display:"inline-block",width:c,height:c,transform:l,children:O.jsxs("svg",{viewBox:"0 0 24 24",width:c,height:c,style:{display:"block"},children:[O.jsxs("defs",{children:[O.jsxs("linearGradient",{id:a,x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[O.jsx("stop",{stopColor:n}),O.jsx("stop",{offset:"0.463542",stopColor:r}),O.jsx("stop",{offset:"1",stopColor:o})]}),O.jsx("clipPath",{id:`clip-${a}`,children:O.jsx("rect",{width:"24",height:"24",fill:"white"})})]}),O.jsx("g",{clipPath:`url(#clip-${a})`,children:O.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:`url(#${a})`})})]})})},Hn=""+new URL("dori.ico",import.meta.url).href,Pn=({onClose:e,isMobile:t=!1,isExpanded:a=!1,onToggleExpand:i,fullPageHref:s,onReload:l})=>{const{botData:c,cartItemCount:d,shortlistEnabled:u,shortlist:p,setShortlistOpen:f}=ie(),h=se(),{t:g}=le(),m=n(c)&&d>0,b=u&&p.length>0,x=c?.bot_image?c.bot_image:Hn,y=ce(x),v=he(y.ratio),[w,k]=q.useState(!1),C=q.useRef(p.length);return q.useEffect(()=>{if(p.length===C.current)return;C.current=p.length,k(!0);const e=setTimeout(()=>k(!1),250);return()=>clearTimeout(e)},[p.length]),O.jsxs(bn,{justify:"space-between",align:"center",flexShrink:0,children:[c?.feature_flags?.hide_header_logo?O.jsx(ae,{h:h.length(40)}):O.jsx(de,{src:x,alt:"",role:"presentation",onLoad:y.onLoad,h:h.length(40),w:v?"auto":h.length(40),maxW:v?h.length(140):void 0,objectFit:v?"contain":"cover",borderRadius:v?h.radius(6):"50%"}),O.jsxs(ue,{gap:h.space(3),children:[b&&O.jsxs(ee,{variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,transform:w?"scale(1.12)":"scale(1)",transition:"transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)",onClick:()=>f(!0),"aria-label":g("savedProducts"),fontFamily:pe,children:[O.jsx(Mn,{boxSize:h.length(15),color:"primary"}),O.jsx(fe,{fontSize:h.font(13),fontWeight:"500",color:"text",children:p.length})]}),m&&O.jsxs(ee,{variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,onClick:()=>{if(!r()){const e=`${o()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},fontFamily:pe,children:[O.jsx(In,{boxSize:h.length(16),color:"text"}),O.jsx(fe,{fontSize:h.font(13),fontWeight:"500",color:"text",children:d})]}),s?O.jsx(ee,{asChild:!0,variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,fontFamily:pe,children:O.jsxs("a",{href:s,children:[O.jsx(jn,{boxSize:h.length(16),color:"text"}),g("aiPageOpenFull")]})}):!t&&i&&O.jsxs(ee,{variant:"outline",size:"sm",borderRadius:h.radius(4),px:h.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${h.length(5)} ${h.length(9)}`,onClick:()=>i?.(),fontFamily:pe,children:[O.jsx(jn,{boxSize:h.length(16),color:"text"}),g(a?"minimize":"showFullScreen")]}),l&&O.jsx(fn,{size:"sm",boxSize:h.length(36),minW:h.length(36),variant:"ghost","aria-label":g("reload"),onClick:l,color:"text",_hover:{bgColor:"mutedText"},children:O.jsx(Wn,{boxSize:t?h.length(16):h.length(24),color:"text"})}),O.jsx(fn,{size:"sm",boxSize:h.length(36),minW:h.length(36),variant:"ghost","aria-label":g("close"),onClick:()=>{a&&i?.(),e()},color:"text",_hover:{bgColor:"mutedText"},children:O.jsx(wn,{boxSize:t?h.length(16):h.length(24),color:"text"})})]})]})};class qn{static async getUploadCredentials(e){const t={file_extension:e,expires_in:3600,content_length_range:{min_bytes:1024,max_bytes:10485760}},n=await fetch(a.getUploadUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({data:t})});if(!n.ok)throw new Error(`Failed to get upload credentials: ${n.status} ${n.statusText}`);return await n.json()}static async compressImage(e,t=1024,n=.8){return new Promise(r=>{const o=document.createElement("canvas"),a=o.getContext("2d"),i=new Image;i.onload=()=>{const{width:s,height:l}=this.calculateDimensions(i.width,i.height,t);o.width=s,o.height=l,a.drawImage(i,0,0,s,l),o.toBlob(t=>{const a=new File([t],e.name,{type:"image/jpeg",lastModified:Date.now()});r({file:a,preview:o.toDataURL("image/jpeg",n),format:"jpeg"})},"image/jpeg",n)},i.src=URL.createObjectURL(e)})}static getFileExtension(e){const t=e.name.split(".").pop()?.toLowerCase();switch(t){case"jpg":case"jpeg":default:return"jpeg";case"webp":return"webp";case"png":return"png";case"heic":return"heic"}}static calculateDimensions(e,t,n){if(e<=n)return{width:e,height:t};const r=t/e;return{width:n,height:Math.round(n*r)}}static async uploadImage(e,t){const n=new FormData;Object.entries(e.fields).forEach(([e,t])=>{n.append(e,t)}),n.append("file",t);const r=await fetch(e.url,{method:"POST",body:n});if(!r.ok&&204!==r.status)throw new Error("Error uploading image");return e.public_url}}const On=()=>{const[e,t]=q.useState(null),[n,r]=q.useState(!1);return{uploadedImage:e,isUploading:n,handleFileSelect:()=>{const e=document.createElement("input");e.type="file",e.accept="image/jpeg,image/jpg,image/webp,image/png,image/heic",e.onchange=e=>{const n=e.target.files?.[0];n&&(async e=>{try{r(!0);const n=await qn.compressImage(e),o=await qn.getUploadCredentials(n.format),a=await qn.uploadImage(o,n.file);t({url:a,preview:n.preview,name:e.name,size:n.file.size})}catch(n){console.error("Upload failed:",n),alert("Failed to upload image")}finally{r(!1)}})(n)},e.click()},removeImage:()=>{e?.preview&&URL.revokeObjectURL(e.preview),t(null)}}},Nn=({imageUrl:e,onRemove:t})=>{const n=se();return O.jsxs("div",{style:{position:"relative",display:"inline-block",background:"transparent"},children:[O.jsx(de,{src:e,alt:"Uploaded image",w:n.length(80),h:n.length(80),borderRadius:n.radius(12),objectFit:"cover",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.11)"}),O.jsx(fn,{position:"absolute",top:n.length(6),right:n.length(6),bg:"primary",color:"buttonText","aria-label":"Remove image",onClick:t,size:"sm",borderRadius:"50%",minW:n.length(24),h:n.length(24),children:O.jsx(wn,{boxSize:n.length(14)})})]})},Yn=()=>{const[e,t]=q.useState(!1);return q.useEffect(()=>{const e=e=>{"Tab"===e.key&&t(!0)},n=()=>t(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",n,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",n,!0)}},[]),e},Vn=e=>e?{"&:has(textarea:focus, input:focus)":{boxShadow:"inset 0 0 0 2px var(--chakra-colors-text)"}}:void 0,Un=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r,isMobileView:o})=>{const{t:a}=le(),i=Yn(),{botData:s,chatState:{repliedProduct:l},setRepliedProduct:c}=ie(),d=!s?.feature_flags?.hide_image_upload,u=se(),[p,f]=q.useState(t),{uploadedImage:h,isUploading:g,handleFileSelect:m,removeImage:b}=On();q.useEffect(()=>{f(y(t))},[t]);const x=e=>{(p.trim()||e||h)&&(r?.({message:e??p.trim(),imageUrl:h?.url},l?.product),c?.(null),f(""),b())},y=e=>e.trimStart();return O.jsxs(ge,{gap:u.space(2),align:"stretch",bg:"transparent",position:"relative",children:[h&&O.jsx(ae,{position:"absolute",bottom:l?o?u.length(300):u.length(190):u.length(90),left:u.length(12),zIndex:1e6,bg:"transparent",pointerEvents:"auto",children:O.jsx(Nn,{imageUrl:h.preview,onRemove:b})}),O.jsx(ae,{bgColor:"lightBackground",borderRadius:u.radius(24),css:Vn(i),position:"relative",p:u.space(2),w:"full",h:l?o?u.length(300):u.length(190):u.length(90),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:O.jsxs(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:u.space(2),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:[l&&O.jsxs(ge,{opacity:1,p:u.length(8),gap:u.length(8),borderRadius:u.radius(12),borderWidth:"1px",borderColor:"borderColor",bgColor:"lightBackground",children:[O.jsxs(ue,{justify:"space-between",align:"center",w:"full",children:[O.jsx(de,{src:l?.product?.image,alt:"product",w:u.length(40),h:u.length(40)}),O.jsx(fe,{fontSize:u.font(12),fontWeight:400,color:"text",children:l?.product?.name}),O.jsx(fn,{bg:"transparent","aria-label":"Remove product",onClick:()=>c?.(null),children:O.jsx(wn,{boxSize:u.length(24),color:"text"})})]}),l?.suggestions&&l.suggestions.length>0&&O.jsxs(O.Fragment,{children:[O.jsx(ae,{display:{base:"none",md:"block"},w:"full",children:O.jsx(ue,{w:"full",justify:"flex-start",align:"center",gap:u.space(2),children:l.suggestions.map(e=>O.jsx(ee,{variant:"outline",bg:"transparent",color:"text",fontSize:u.font(12),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),h:u.length(32),px:u.space(3),minW:"unset",flex:1,lineHeight:"1.5",overflow:"hidden",children:O.jsx(ae,{as:"span",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block",w:"100%",children:e})},e))})}),O.jsx(ae,{display:{base:"block",md:"none"},w:"full",children:O.jsx(ge,{w:"full",align:"stretch",gap:u.length(8),children:l.suggestions.map(e=>O.jsx(ee,{variant:"outline",bg:"transparent",w:"full",color:"text",fontSize:u.font(14),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),children:e},e))})})]})]}),O.jsx(vn,{"aria-label":a("messageInputLabel"),value:p,onChange:e=>(e=>{const t=y(e);f(t),n?.(t)})(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:e,fontSize:me(u,16),color:"text",fontWeight:300,resize:"none",rows:1,lineHeight:"1.5",h:"100%",border:"none",bg:"transparent",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},pr:u.length(48),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"}),d&&O.jsx(fn,{position:"absolute",bottom:u.length(8),left:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background","aria-label":"Upload image",onClick:m,_hover:{bg:"background"},disabled:g,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",color:"text",children:g?O.jsx(be,{size:"sm",color:"text"}):O.jsx(xe,{color:"text"})}),O.jsx(fn,{position:"absolute",bottom:u.length(12),right:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Send",onClick:()=>x(),_hover:{bg:"veryLightBackground"},disabled:!p.trim()&&!h,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"background",cursor:"not-allowed",opacity:.7},transform:"scale(1)",zIndex:2,children:O.jsx(_n,{boxSize:u.length(30),color:"primary"})})]})})]})},Zn=({placeholder:e="Write a prompt or paste a contract address",onStop:t})=>{const n=se(),{stopCurrentRequest:r}=ie();return O.jsx(ge,{gap:n.space(2),align:"stretch",bg:"transparent",position:"relative",children:O.jsx(ae,{bg:"lightBackground",borderRadius:n.radius(32),position:"relative",p:n.space(3),w:"full",h:n.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:O.jsx(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:n.space(3),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:O.jsxs(ue,{justify:"space-between",align:"center",h:"full",children:[O.jsx(fe,{color:"mutedText",fontSize:n.font(16),flex:1,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e}),O.jsx(fn,{size:"xs",boxSize:n.length(32),minW:n.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Stop",onClick:()=>{r?.(),t?.()},_hover:{bg:"veryLightBackground"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,children:O.jsx(Rn,{boxSize:n.length(30),color:"primary"})})]})})})})},Kn=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r})=>{const{t:o}=le(),a=Yn(),i=se(),{botData:s}=ie(),l=!s?.feature_flags?.hide_image_upload,[c,d]=q.useState(t),[u,p]=q.useState(!1),{uploadedImage:f,isUploading:h,handleFileSelect:g,removeImage:m}=On(),b=q.useRef(null);q.useEffect(()=>{d(t)},[t]);const x=()=>{(c.trim()||f)&&(r?.({message:c.trim(),imageUrl:f?.url}),d(""),m())};return O.jsxs(ge,{gap:i.space(2),align:"stretch",children:[f&&O.jsx(ae,{mb:i.space(2),alignSelf:"flex-start",bg:"transparent",children:O.jsx(Nn,{imageUrl:f.preview,onRemove:m})}),O.jsxs(ae,{bg:"lightBackground",borderRadius:i.radius(24),css:Vn(a),position:"relative",p:i.space(2),w:"full",h:u?i.length(80):i.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",cursor:"pointer",onClick:()=>{p(!0),setTimeout(()=>{if(b.current){b.current.focus();const e=b.current.value.length;b.current.setSelectionRange(e,e)}},100)},children:[O.jsx(ae,{position:"absolute",top:i.length(8),left:i.length(8),zIndex:2,children:O.jsx(Dn,{w:i.length(24),h:i.length(24),transform:"rotate(2700deg)",color:"primary"})}),O.jsx(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?0:1,transform:u?"translateY(-20px) scale(0.95)":"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"none":"auto",children:O.jsx(ue,{justify:"space-between",align:"center",h:"full",children:O.jsx(fe,{color:"#999999",fontSize:i.font(16),flex:1,paddingStart:i.length(32),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e})})}),l&&O.jsx(fn,{position:"absolute",bottom:i.length(7.5),right:i.length(52),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Upload image",onClick:e=>{e.stopPropagation(),g()},_hover:{bg:"veryLightBackground"},disabled:h,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",children:h?O.jsx(be,{size:"sm"}):O.jsx(xe,{size:i.length(24)})}),O.jsx(fn,{position:"absolute",bottom:i.length(8),right:i.length(12),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"primary","aria-label":"Send",onClick:e=>{e.stopPropagation(),x()},_hover:{bg:"darkPrimary"},disabled:!c.trim()&&!f,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"primary",opacity:.5,cursor:"not-allowed"},transform:"scale(1) rotate(180deg)",zIndex:2,children:O.jsx(Tn,{boxSize:i.length(30),color:"buttonText"})}),O.jsx(ae,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?1:0,transform:u?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"auto":"none",children:O.jsx(vn,{"aria-label":o("messageInputLabel"),ref:b,value:c,onChange:e=>{return t=e.target.value,d(t),void n?.(t);var t},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:e,paddingLeft:i.length(32),paddingRight:l?i.length(80):i.length(40),fontSize:me(i,16),color:"text",fontWeight:300,resize:"none",h:"100%",border:"none",bg:"transparent",cursor:"text",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",rows:2,lineHeight:"1.5"})})]})]})},Qn=({state:e="starting",placeholder:t="Write a prompt or paste a contract address",value:n="",onChange:r,onSend:o,onStop:a})=>{const[i,s]=q.useState(!1);return q.useEffect(()=>{const e=()=>{s(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),"starting"===e?O.jsx(Un,{placeholder:t,value:n,onChange:r,onSend:o,isMobileView:i}):"generating"===e?O.jsx(Zn,{placeholder:t,onStop:a,isMobileView:i}):O.jsx(Kn,{placeholder:t,value:n,onChange:r,onSend:o})},Gn=e=>{const t=e.includes("?")?"&":"?";return`${e}${t}utm_source=dori&utm_medium=dori_widget&utm_campaign=dori_product_recommendation`},Xn=(e,t)=>{const n=e.includes("?")?"&":"?";return`${e}${n}utm_source=customer_referral&utm_medium=widget&utm_campaign=powered_by&utm_term=${t}`};function Jn(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"none"};const n=t?.logo_url?.trim();if(n)return{kind:"merchant",src:n,alt:t?.logo_alt?.trim()||e?.bot_name||"Store logo"};const r=Boolean(t?.disclaimer_text?.trim());return t?.is_white_labeled||r?{kind:"none"}:{kind:"dori"}}function $n(e){return!e?.white_label?.ai_notice_only&&!1!==e?.customization?.enable_shopper_memory}function er(e){return"dori"===Jn(e).kind?"Dori":e?.agent_name?.trim()||e?.bot_name?.trim()||"Dori"}const tr="/policies/privacy-policy",nr=()=>{const{t:e}=le(),{botData:t}=ie(),n=se(),[r,o]=q.useState(!1);return O.jsxs(ae,{position:"relative",display:"inline-flex",alignItems:"center",children:[O.jsxs(ae,{as:"span",display:"inline-flex",alignItems:"center",gap:n.space(1),tabIndex:0,cursor:"default",px:n.space(2),py:"1px",borderRadius:"9999px",bgGradient:"to-r",gradientFrom:"primaryWash",gradientTo:"primaryWashStrong",color:"darkPrimary",border:"1px solid",borderColor:"primaryWash",lineHeight:"1.25",transition:"background 120ms ease, box-shadow 120ms ease",_hover:{boxShadow:"0 1px 6px rgba(0,0,0,0.10)"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:()=>o(!0),onBlur:()=>o(!1),"aria-describedby":"dori-personalized-tip",children:[O.jsx(An,{boxSize:n.font(11),"aria-hidden":"true"}),O.jsx(fe,{as:"span",fontSize:n.font(10),fontWeight:"600",children:e("personalizedBadge")})]}),r&&O.jsx(ae,{id:"dori-personalized-tip",role:"tooltip",position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",zIndex:20,width:"max(220px, 80%)",maxW:"260px",bg:"rgba(32,34,35,0.96)",color:"white",fontSize:n.font(11),lineHeight:"1.45",px:n.space(3),py:n.space(2),borderRadius:"8px",boxShadow:"0 6px 20px rgba(0,0,0,0.22)",pointerEvents:"none",children:e("personalizedTooltip").split("{name}").join(er(t))})]})},rr=()=>{const e=se(),{botData:t}=ie(),{isMobile:n}=ye(),{t:r}=le(),o=function(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"short"};const n=t?.disclaimer_text?.trim();return n?{kind:"custom",text:n}:{kind:"default"}}(t),a="custom"===o.kind?o.text:r("short"===o.kind?"aiCanMakeMistakesShort":"aiCanMakeMistakes"),i=Jn(t),s=function(e){const t=e?.white_label;if(!t?.privacy_link_enabled)return null;const n=t.privacy_link_url?.trim();return n?/^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(n)?`https://${n}`:tr:tr}(t);return O.jsxs(ue,{gapX:e.space(2),justifyContent:n?"start":"center",align:"center",alignContent:"center",alignItems:"center",w:"full",wrap:n?"wrap":"nowrap",children:["dori"===i.kind&&O.jsx(nn,{href:Xn("https://dori.tech/",t?.sharing_id||""),target:"_blank",rel:"noopener noreferrer",display:"inline-flex",alignItems:"center",children:O.jsx(de,{src:Hn,alt:"Dori AI",boxSize:ve(e)})}),"merchant"===i.kind&&O.jsx(de,{src:i.src,alt:i.alt,h:ve(e),w:"auto",maxW:we(e),objectFit:"contain",flexShrink:0}),O.jsxs(ae,{fontSize:e.font(10),color:"mutedText",px:e.space(0),py:e.space(0),bg:"transparent",border:"none",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:e.space(1),children:[O.jsx(ae,{as:"span",children:a}),s&&O.jsx(nn,{href:s,target:"_blank",rel:"noopener noreferrer",color:"inherit",textDecoration:"underline",whiteSpace:"nowrap",children:r("privacyPolicy")}),$n(t)&&O.jsx(nr,{})]})]})};function or(e){return ke({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 184 144 144 144-144"},child:[]}]})(e)}function ar(e){return ke({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 328 144-144 144 144"},child:[]}]})(e)}const ir=(e={})=>{const{enableTwinkling:t=!0,enableFloating:n=!0,enableRotation:r=!0,enableScaling:o=!0,twinklingSpeed:a=1e3,floatingSpeed:i=3e3,rotationSpeed:s=8e3,scalingSpeed:l=4e3,floatingRange:c=2.5,rotationRange:d=90,scalingRange:u=1.2}=e,[p,f]=q.useState(1),[h,g]=q.useState(0),[m,b]=q.useState(0),[x,y]=q.useState(1);return q.useEffect(()=>{if(!t)return;const e=setInterval(()=>{f(e=>1===e?.2:1)},a);return()=>clearInterval(e)},[t,a]),q.useEffect(()=>{if(!n)return;const e=setInterval(()=>{g(e=>0===e?c:0)},i);return()=>clearInterval(e)},[n,i,c]),q.useEffect(()=>{if(!r)return;const e=setInterval(()=>{b(e=>0===e?d:0)},s);return()=>clearInterval(e)},[r,s,d]),q.useEffect(()=>{if(!o)return;const e=setInterval(()=>{y(e=>1===e?u:1)},l);return()=>clearInterval(e)},[o,l,u]),{getStarfieldTransform:(e,t)=>[].filter(Boolean).join(" "),getIconStyle:()=>({opacity:p,transition:"transform 0.8s ease-in-out, opacity 1s ease-in-out"}),twinkleOpacity:p,floatingOffset:h,rotationAngle:m,scaleFactor:x}};function sr(e){if(!e)return null;const{customization:t,bot_image:n,agent_image:r,bot_image_original:o}=e;switch(t?.fab_avatar_source){case"none":return null;case"logo":return n||null;case"agent":return r||null}return t?.enable_avatar_in_fab&&((n&&n!==o?n:null)||r||n)||null}const lr=e=>"bottom"===e?.anchor?"bottom":"middle",cr=(e,t)=>t?(e=>e?.customization?.mobile?.position?{align:e.customization?.mobile?.position?.align??"right",sideSpacing:e.customization?.mobile?.position?.side_spacing??8,bottomSpacing:e.customization?.mobile?.position?.bottom_spacing??0,anchor:lr(e.customization?.mobile?.position)}:{align:"right",sideSpacing:8,bottomSpacing:20,anchor:"middle"})(e):(e=>e?.customization?.position?{align:e.customization?.position?.align??"right",sideSpacing:e.customization?.position?.side_spacing??16,bottomSpacing:e.customization?.position?.bottom_spacing??0,anchor:lr(e.customization?.position)}:{align:"right",sideSpacing:16,bottomSpacing:60,anchor:"middle"})(e),dr=(e,t,n)=>"bottom"===e.anchor||n&&!!sr(t),ur=(e,t)=>"bottom"===e.anchor?Math.max(0,e.bottomSpacing):t?.customization?.mobile?.position?.bottom_spacing??90;function pr(){return"undefined"!=typeof window&&!!window.$crisp}function fr(){pr()&&window.$crisp.push(["do","chat:hide"])}function hr(){console.log("trying to open"),pr()&&(console.log("trying to open2"),window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:open"]))}const gr=15e3,mr="chatra";let br=!1,xr=!1,yr=null,vr=0,wr=null,kr=0,Cr=!1;function jr(...e){console.log("[Dori-Chatra]",...e)}function Sr(){return"undefined"!=typeof window&&"function"==typeof window.Chatra}function zr(){return!!Sr()&&!!document.getElementById(mr)}function Er(e){if(Sr())try{window.Chatra("hide"),jr("called Chatra('hide') —",e)}catch(t){jr("error calling hide:",t)}}function Ar(){null!==yr&&(clearInterval(yr),yr=null,jr("stopped maintain loop"))}function Rr(){xr||Date.now()-vr>3e4?Ar():br&&Sr()&&Er("maintain loop")}function _r(){if(!xr)return;const e=document.getElementById(mr);if(!e)return;const t=e.className||"",n=-1!==t.indexOf("chatra--visible");-1!==t.indexOf("chatra--expanded")?Cr=!0:Cr&&(Date.now()-kr<1500||n&&Er("user closed chat"))}function Tr(){jr("openChatraChat invoked"),xr=!0,Cr=!1,Ar(),function(){if(wr||"undefined"==typeof document)return;const e=()=>{const e=document.getElementById(mr);return!!e&&(wr=new MutationObserver(_r),wr.observe(e,{attributes:!0,attributeFilter:["class","style"]}),jr("attached close observer to #chatra"),!0)};if(e())return;const t=Date.now(),n=setInterval(()=>{(e()||Date.now()-t>gr)&&clearInterval(n)},200)}(),function(e){if(zr())return void e();const t=Date.now(),n=setInterval(()=>{zr()?(clearInterval(n),e()):Date.now()-t>gr&&(clearInterval(n),jr("Chatra never fully loaded within",gr,"ms"))},200)}(()=>{kr=Date.now();try{window.Chatra("show"),jr("called Chatra('show')"),setTimeout(()=>{try{window.Chatra("openChat"),jr("called Chatra('openChat')")}catch(e){jr("error calling openChat:",e)}},50)}catch(e){jr("error calling show:",e)}})}const Wr="dori-shopify-inbox-hide",Ir="data-dori-inbox-open",Lr="shopify-chat",Mr="inbox-online-store-chat";let Br=null;function Fr(...e){console.log("[Dori-ShopifyInbox]",...e)}function Dr(){if("undefined"==typeof document)return null;const e=document.querySelector(Lr);if(e)return{el:e,legacy:!1};const t=document.querySelector(Mr);return t?{el:t,legacy:!0}:null}function Hr(){Fr("openShopifyInbox invoked"),function(e){const t=Dr();if(t)return void e(t);const n=Date.now(),r=setInterval(()=>{const t=Dr();t?(clearInterval(r),e(t)):Date.now()-n>15e3&&(clearInterval(r),Fr("Inbox embed never appeared within",15e3,"ms"))},200)}(({el:e,legacy:t})=>{if(document.documentElement.setAttribute(Ir,""),t)requestAnimationFrame(()=>{const t=e.shadowRoot?.querySelector("button");t?(t.click(),Fr("clicked legacy activator")):Fr("legacy activator not found in shadow root")});else{if(function(e){Br||"undefined"==typeof document||(Br=new MutationObserver(()=>{e.hasAttribute("open")||document.documentElement.removeAttribute(Ir)}),Br.observe(e,{attributes:!0,attributeFilter:["open"]}))}(e),"function"==typeof e.show)try{return e.show(),void Fr("called shopify-chat.show()")}catch(n){Fr("show() failed, falling back to the open attribute:",n)}e.setAttribute("open","")}})}const Pr=e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t},qr=(e,t,n)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),r=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${r}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":hr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":Tr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":Hr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"dori":n&&n()}},Or=({channels:e,isOpen:t,onToggle:n,isMobile:r,onMouseEnter:o,onChatClick:a})=>{const{botData:i}=ie(),s=ln({base:!0,md:!1})??!1,l=cr(i,s),c=!0!==i?.customization?.disable_idle_animation,{getStarfieldTransform:d,getIconStyle:u}=ir({enableTwinkling:c,enableFloating:c,enableRotation:c,enableScaling:c}),p=Pr(e);return 0===p.length?null:O.jsxs(ge,{gap:2,align:"flex-end",alignItems:"center",position:"absolute",bottom:"100%",right:0,children:[r&&t&&O.jsx(fn,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:O.jsx(or,{size:20})}),O.jsx(ae,{mb:3,opacity:t?1:0,transform:t?"translateY(0)":"translateY(10px)",transition:"all 0.2s ease",pointerEvents:t?"auto":"none",onMouseEnter:o,children:O.jsxs(ge,{gap:2,align:"flex-end",children:[O.jsx(ae,{borderRadius:"full",cursor:"pointer",onClick:()=>qr("dori",{},a),bg:"primary",boxSize:{base:"36px",md:"48px"},display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"md",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},transition:"all 0.2s ease",children:O.jsx(Fn,{boxSize:{base:"24px",md:"32px"},color:"background",transform:d("expanded",l),...u()})}),p.map((e,t)=>O.jsx(ae,{borderRadius:"full",cursor:"pointer",onClick:()=>qr(e.type,e.data,a),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)"}},transition:"all 0.2s ease",children:O.jsx(de,{src:e.icon,alt:e.name,boxSize:{base:"36px",md:"48px"},borderRadius:"full",objectFit:"fill"})},`${e.type}-${t}`))]})}),r&&!t&&O.jsx(fn,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:O.jsx(ar,{size:20})})]})},Nr=({channels:e})=>{const t=se(),n=(e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t})(e);return 0===n.length?null:O.jsx(ue,{gap:t.space(3),w:"full",alignItems:"center",justifyContent:"start",wrap:"wrap",children:n.map((e,n)=>O.jsxs(ae,{display:"flex",alignItems:"center",gap:t.space(3),cursor:"pointer",borderRadius:t.radius(16),padding:"6px 8px",bg:"lightBackground",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"veryLightBackground",transform:"scale(1.05)"}},transition:"all 0.2s ease",onClick:()=>((e,t)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),n=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${n}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":hr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":Tr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":Hr(),window.dispatchEvent(new Event("dori:close-widget"))}})(e.type,e.data),flexShrink:0,children:[O.jsx(de,{src:e.icon,alt:e.name,boxSize:{base:t.length(22),md:t.length(24)},borderRadius:"full",objectFit:"cover"}),O.jsx(fe,{fontSize:{base:t.font(12),md:t.font(14)},fontWeight:"400",color:"text",whiteSpace:"nowrap",children:e.name})]},`${e.type}-${n}`))})},Yr=({offer:e,selections:t,onDone:n,onClose:r})=>{const o=se(),{isMobile:a}=ye(),{t:s}=le(),{botData:l,chatState:c}=ie(),[d,u]=q.useState(""),[p,f]=q.useState(!1),[h,g]=q.useState(!1),[m,b]=q.useState(null),x=(e,t={})=>i(e,{assistantId:l?.assistant_id,threadId:c.threadId,payload:{placement:"quiz",...t}}),y=async()=>{if(h)return;if(!Se(d))return void b(s("followUpInvalidEmail"));if(!p)return;g(!0),b(null);const t=await ze(d.trim(),e.tags);g(!1),"ok"===t?(Ee(),Ae(d.trim()),x("email_signup_joined")):x("email_signup_failed",{result:t}),n()};return O.jsxs(ge,{gap:o.space(3),align:"stretch",flex:1,justify:"start","data-dori-quiz-signup":"",children:[O.jsxs(ue,{justify:"space-between",align:"center",gap:o.space(2),children:[O.jsx(ue,{gap:o.space(1.5),flexWrap:"wrap",children:t.map((e,t)=>O.jsxs(ae,{px:o.space(3),py:o.space(1),borderRadius:o.radius(16),bg:"veryLightBackground",border:"1px solid",borderColor:"primary",fontSize:o.font(11),fontWeight:500,color:"primary",fontFamily:pe,whiteSpace:"nowrap",children:["✓ ",e]},t))}),r&&O.jsx(ae,{as:"button",onClick:r,cursor:"pointer",p:1,borderRadius:"full",opacity:.5,_hover:{opacity:1,bg:"lightBackground"},flexShrink:0,"aria-label":"Close",children:O.jsx(fe,{fontSize:"16px",color:"text",lineHeight:"1",children:"×"})})]}),O.jsxs(ue,{gap:o.space(2),align:"flex-start",children:[O.jsx(ae,{color:"primary",mt:"3px",flexShrink:0,children:O.jsx(Ce,{"aria-hidden":!0})}),O.jsxs(ge,{align:"stretch",gap:o.space(1),children:[O.jsx(fe,{fontSize:o.font(17),fontWeight:700,color:"text",lineHeight:"1.4",fontFamily:pe,children:e.headline}),e.detail&&O.jsx(fe,{fontSize:o.font(12),color:"mutedText",lineHeight:"1.5",fontFamily:pe,children:e.detail})]})]}),O.jsx(je,{value:d,onChange:e=>{u(e.target.value),m&&b(null)},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:s("followUpEmailPlaceholder"),"aria-label":s("followUpEmailPlaceholder"),type:"email",inputMode:"email",autoComplete:"email",fontSize:a?me(o,16):o.font(14),color:"text",bg:"background",borderColor:"border",borderRadius:o.radius(10),height:o.length(40),px:o.space(3),_placeholder:{color:"mutedText"},_focus:{borderColor:"primary",boxShadow:"none"}}),m&&O.jsx(fe,{fontSize:o.font(11),color:"red.500",fontFamily:pe,"data-dori-quiz-signup-error":"",children:m}),O.jsxs("label",{style:{display:"flex",gap:6,alignItems:"flex-start",cursor:"pointer"},children:[O.jsx("input",{type:"checkbox",checked:p,onChange:e=>f(e.target.checked),style:{marginTop:2}}),O.jsxs(fe,{as:"span",fontSize:o.font(11),color:"mutedText",lineHeight:"1.35",fontFamily:pe,children:[s("signupConsent")," ",O.jsx("a",{href:"/policies/privacy-policy",target:"_blank",rel:"noreferrer",style:{textDecoration:"underline"},children:s("followUpPrivacy")})]})]}),O.jsx(ee,{borderRadius:o.radius(24),bg:"primary",color:"buttonText",fontSize:o.font(13),fontWeight:600,height:o.length(40),loading:h,disabled:!p||!d.trim(),onClick:()=>{y()},fontFamily:pe,children:s("signupShowResults")}),O.jsx(ee,{variant:"outline",borderRadius:o.radius(24),borderColor:"border",color:"text",bg:"transparent",fontSize:o.font(13),height:o.length(40),onClick:()=>{x("email_signup_skipped"),n()},disabled:h,fontFamily:pe,_hover:{bg:"veryLightBackground"},"data-dori-quiz-signup-skip":"",children:s("signupSkip")})]})},Vr=({flow:e,onComplete:t,onClose:n})=>{const r=se(),[o,a]=q.useState(0),[i,s]=q.useState([]),[l,c]=q.useState("active"),[d,u]=q.useState(!1),[p,f]=q.useState(!1),[h,g]=q.useState(!1),m=q.useRef(null),b=q.useRef(null),x=q.useRef(null),y=q.useRef(null),v=tn("colors","primary"),w=Re(v);q.useEffect(()=>{if("active"!==l)return;u(!1);const e=requestAnimationFrame(()=>{u(!0)});return()=>cancelAnimationFrame(e)},[o,l]),q.useEffect(()=>()=>{m.current&&clearTimeout(m.current),b.current&&clearTimeout(b.current),x.current&&clearTimeout(x.current),y.current&&clearTimeout(y.current)},[]);const k=q.useCallback(n=>{c("analyzing");const r=800+700*Math.random();x.current=setTimeout(()=>{const r=n.map(e=>e.option.label).join(" · ");let o=e.result_prompt;n.forEach((e,t)=>{const n=`{step${t+1}}`;o=o.split(n).join(e.option.value)});const a=_e(),i=n.map(e=>e.option.label).join(", ");t(r,`${a}[Quiz selections: ${i}] ${o}`)},r)},[e,t]),C=q.useCallback(t=>{if(h)return;g(!0);const n=[...i,{stepIndex:o,option:t}];s(n),o<e.steps.length-1?(u(!1),m.current=setTimeout(()=>{a(e=>e+1),g(!1)},280)):(f(!0),y.current=setTimeout(()=>{f(!1),!e.email_signup||Te()?k(n):c("signup")},300))},[h,i,o,e,k]),j=q.useCallback(()=>{o<=0||p||(u(!1),b.current=setTimeout(()=>{s(e=>e.slice(0,-1)),a(e=>e-1),g(!1)},250))},[o,p]),S=e.steps[o];return"signup"===l&&e.email_signup?O.jsx(Yr,{offer:e.email_signup,selections:i.map(e=>e.option.label),onDone:()=>{We(),k(i)},onClose:n}):"analyzing"===l?O.jsxs(ge,{gap:r.space(3),align:"center",flex:1,justify:"center",transition:"opacity 0.3s ease",children:[O.jsx(ue,{gap:r.space(2),flexWrap:"wrap",justify:"center",children:i.map((e,t)=>O.jsx(Ur,{label:e.option.label},t))}),O.jsxs(ge,{gap:r.space(2),align:"center",py:r.space(4),children:[O.jsx(En,{boxSize:r.length(20),color:"primary",opacity:.6}),O.jsx(fe,{fontSize:r.font(14),fontWeight:500,fontFamily:pe,css:{background:`linear-gradient(90deg, ${v}44, ${v}, ${v}44)`,backgroundSize:"200% 100%",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",animation:"dori-shimmer 1.5s ease-in-out infinite"},children:e.analyzing_text})]}),O.jsx("style",{children:"\n @keyframes dori-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "})]}):O.jsxs(ge,{gap:r.space(4),align:"stretch",flex:1,justify:"start",opacity:p?0:1,transform:p?"translateY(-8px)":"translateY(0)",transition:"opacity 0.3s ease, transform 0.3s ease",children:[i.length>0&&O.jsxs(ue,{gap:r.space(2),flexWrap:"wrap",align:"center",children:[O.jsx(ae,{as:"button",onClick:j,"aria-label":"Back",cursor:"pointer",px:r.space(2),py:r.space(1),borderRadius:r.radius(12),fontSize:r.font(11),color:"primary",opacity:.8,_hover:{opacity:1,bg:"veryLightBackground"},transition:"all 0.15s ease",fontFamily:pe,flexShrink:0,children:"←"}),i.map((e,t)=>O.jsx(Ur,{label:e.option.label},t))]}),O.jsxs(ae,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",children:[O.jsxs(ge,{align:"stretch",gap:r.space(3),mb:r.space(3),children:[O.jsxs(ue,{justify:"space-between",align:"center",gap:r.space(3),children:[O.jsxs(ue,{gap:r.space(2),align:"center",minW:0,children:[O.jsx(ae,{display:"flex",alignItems:"center",justifyContent:"center",boxSize:r.length(24),borderRadius:r.radius(12),bg:"background",border:"1px solid",borderColor:"primary",flexShrink:0,children:O.jsx(En,{boxSize:r.length(12),color:"primary"})}),O.jsx(fe,{fontSize:r.font(11),fontWeight:600,fontFamily:pe,lineHeight:"1.4",css:{background:w,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:e.entry_label})]}),O.jsxs(ue,{gap:r.space(1),align:"center",flexShrink:0,children:[O.jsxs(ae,{px:r.space(2.5),py:r.space(1),borderRadius:r.radius(999),bg:"background",border:"1px solid",borderColor:"primary",fontSize:r.font(10),fontWeight:700,color:"primary",fontFamily:pe,lineHeight:"1",flexShrink:0,children:[o+1,"/",e.steps.length]}),n&&O.jsx(ae,{as:"button",onClick:n,cursor:"pointer",p:1,borderRadius:"full",opacity:.5,_hover:{opacity:1,bg:"lightBackground"},transition:"all 0.15s ease",flexShrink:0,"aria-label":"Close",children:O.jsx(fe,{fontSize:"16px",color:"text",lineHeight:"1",children:"×"})})]})]}),O.jsx(fe,{fontSize:r.font(17),fontWeight:700,color:"text",lineHeight:"1.45",fontFamily:pe,children:S.question}),O.jsx(ae,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:r.radius(16),px:r.space(3),py:r.space(2.5),children:O.jsxs(ue,{gap:r.space(2),align:"start",children:[O.jsx(ae,{boxSize:r.length(7),borderRadius:"full",bg:"primary",mt:r.length(7),flexShrink:0}),O.jsx(fe,{fontSize:r.font(12),color:"mutedText",fontWeight:500,lineHeight:"1.65",fontFamily:pe,opacity:.9,children:S.reason})]})})]}),O.jsx(ae,{display:"grid",gridTemplateColumns:{base:"1fr 1fr"},gap:r.space(2),children:S.options.map((e,t)=>O.jsx(ae,{as:"button",px:r.space(3),py:"8px",borderRadius:r.radius(24),border:"1px solid",borderColor:"primary",bg:"veryLightBackground",cursor:"pointer",textAlign:"start",display:"flex",alignItems:"center",gap:r.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(6px)",transition:`opacity 0.25s ease ${40*t}ms, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) ${40*t}ms, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease`,_hover:{bg:"lightBackground",boxShadow:`0 0 0 1px ${v}33`},_active:{bg:"lightBackground",transform:"translateY(0) scale(0.97)"},onClick:()=>C(e),fontFamily:pe,children:O.jsxs(ae,{flex:"1",minW:0,children:[O.jsx(fe,{fontSize:r.font(13),fontWeight:500,color:"text",lineHeight:"1.4",whiteSpace:"normal",wordBreak:"break-word",children:e.label}),e.subtitle&&O.jsx(fe,{fontSize:r.font(10),color:"mutedText",opacity:.6,lineHeight:"1.2",children:e.subtitle})]})},e.value))})]})]})},Ur=({label:e})=>{const t=se();return O.jsxs(ae,{px:t.space(3),py:t.space(1),borderRadius:t.radius(16),bg:"veryLightBackground",border:"1px solid",borderColor:"primary",fontSize:t.font(11),fontWeight:500,color:"primary",fontFamily:pe,whiteSpace:"nowrap",children:["✓ ",e]})},Zr=({chips:e,onChipClick:t,onDismiss:n})=>{const r=se(),[o,a]=q.useState(!1);return q.useEffect(()=>{const e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)},[]),0===e.length?null:O.jsx(ae,{flexShrink:0,opacity:o?1:0,transform:o?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)","data-dori-nudge":"chip-row",children:O.jsxs(ue,{gap:r.space(2),wrap:"wrap",align:"center",children:[e.map((e,n)=>O.jsx(ee,{size:"sm",variant:"outline",borderRadius:r.radius(20),borderWidth:"1.5px",borderColor:"primary",bg:"veryLightBackground",color:"text",fontSize:r.font(13),fontWeight:500,px:r.space(3),py:r.space(1.5),height:"auto",whiteSpace:"normal",wordBreak:"break-word",textAlign:"start",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},onClick:()=>t(e),fontFamily:pe,children:e},`${n}-${e}`)),O.jsx(fn,{size:"xs",borderRadius:"full",bg:"transparent","aria-label":"Dismiss nudge",color:"mutedText",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},minW:r.length(22),w:r.length(22),h:r.length(22),p:r.space(0),flexShrink:0,onClick:n,opacity:.6,children:O.jsx(wn,{boxSize:r.length(11)})})]})})};const Kr=({onStartChat:e,isMobile:t,isExpanded:n=!1,onToggleExpand:r,fullPageHref:o,onClose:a})=>{const{inputValue:i,handleInputChange:c}=((e="")=>{const[t,n]=q.useState(e),r=q.useCallback(e=>{n(e)},[]),o=q.useCallback(e=>{t.trim()&&e&&(e(t.trim()),n(""))},[t]),a=q.useCallback((e,t)=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),o(t))},[o]),i=q.useCallback(()=>{n("")},[]),s=q.useCallback(e=>{n(e)},[]);return{inputValue:t,setInputValue:n,handleInputChange:r,handleSubmit:o,handleKeyPress:a,clearInput:i,setInput:s}})(),{botData:d,effectiveSuggestedReplies:u}=ie(),p=se(),f=Ie(t?1:Le(d).width),{t:h,translations:g}=le(),m=s(d,g),b=tn("colors","primary"),x=Re(b),y=u,v=!1,w=q.useMemo(()=>y.slice(0,4),[y]),[k,C]=Me();q.useMemo(()=>y.slice(0,2),[y]);const j=({message:t,imageUrl:n})=>{(t.trim()||n)&&e(t.trim(),n)},S=!0===d?.feature_flags?.greeting_one_line,z=q.useRef(null),E=function(e,t,n,r,o){const[a,i]=q.useState(n);return q.useLayoutEffect(()=>{if(!t)return void i(n);const o=e.current,a=o?.parentElement;if(!o||!a)return;const s=()=>{const e=o.style.fontSize;o.style.fontSize=`${n}px`;const t=o.scrollWidth;o.style.fontSize=e,i(function(e,t,n,r){if(!(e>0&&t>e))return n;const o=Math.floor(n*(e/t)*.99);return Math.max(r,Math.min(n,o))}(a.clientWidth,t,n,r))};if(s(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(s);return l.observe(a),()=>l.disconnect()},[e,t,n,r,o]),a}(z,S,parseFloat(p.isMini?p.font(24):`${f.greetingFontPx}px`),14,m||""),A=!0===d?.feature_flags?.composer_at_bottom,R=O.jsx(ae,{children:O.jsx(Qn,{state:"minimized",placeholder:h("askAnything"),value:i,onChange:c,onSend:j})});return O.jsxs(O.Fragment,{children:[O.jsx(Pn,{onClose:a,isMobile:t,isExpanded:n,onToggleExpand:r,fullPageHref:o}),O.jsxs(ge,{h:"full",minH:0,justify:"flex-start",align:"stretch",gap:p.space(f.sectionGap),children:[m&&O.jsx(ge,{gap:p.space(3),w:"full",align:"start",mb:p.length(f.greetingGapPx),flexShrink:0,children:O.jsx(fe,{ref:z,fontWeight:n?600:500,fontStyle:"normal",fontSize:S?`${E}px`:p.isMini?p.font(24):`${f.greetingFontPx}px`,whiteSpace:S?"nowrap":void 0,letterSpacing:"0",textAlign:n?"center":"right",fontFamily:pe,css:{background:x,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:m})}),O.jsx(ae,{flex:1,minH:0,overflowY:"auto",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:O.jsxs(ge,{gap:p.space(4),align:"stretch",justify:"start",pb:p.space(3),children:[!A&&R,k&&O.jsx(Zr,{chips:[k],onChipClick:t=>{l("offer_guide_chat_opened",{from:"opening"}),C(),Fe(t).then(n=>e(t,void 0,n))},onDismiss:()=>{Be(),C()}}),v,v,w.length>0&&O.jsx(ae,{w:"full",children:O.jsx(ae,{display:"grid",gridTemplateColumns:{base:"1fr",md:f.starterColumns},gap:p.space(3),w:"full",children:w.map((e,t)=>O.jsxs(ee,{variant:"outline",borderRadius:p.radius(24),border:"1px solid",borderColor:"borderColor",bg:"lightBackground",color:"text",fontSize:p.font(14),fontWeight:400,padding:"8px 12px",_hover:{bg:"veryLightBackground",borderColor:"borderColor"},onClick:()=>(e=>{j({message:e,imageUrl:void 0})})(e),justifyContent:"start",w:"full",height:"auto",lineHeight:"1.5",whiteSpace:"pre-wrap",children:[O.jsx(En,{boxSize:p.length(16),color:"text"}),O.jsx(ae,{as:"span",flex:"1",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"break-word",fontFamily:pe,children:e})]},t))})})]})}),O.jsx(ae,{w:"full",flexShrink:0,children:O.jsx(Nr,{channels:d?.merchant_support_channels})}),A&&O.jsx(ae,{w:"full",flexShrink:0,children:R}),O.jsx(ae,{flexShrink:0,transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:O.jsx(rr,{variant:"default"})})]})]})},Qr=({message:e,type:t="default"})=>{const n="loading"===t,{botData:r}=ie(),o=se(),a=e.replace(/\\([!?.,'":;\-\[\](){}#*_~`>+])/g,"$1"),i=r?.agent_image||Hn,s=ce(i),l=he(s.ratio),c=n?a.replace(/[.\u2026]{1,3}\s*$/u,"").trim():a;return O.jsxs(ae,{position:"relative",width:"full",children:[O.jsx(ae,{opacity:"0",bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),children:O.jsx(fe,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),fontFamily:pe,children:a})}),O.jsx(ae,{h:o.length(50)}),O.jsx(ae,{position:"absolute",left:0,bottom:0,children:O.jsx(de,{src:i,alt:"",role:"presentation",onLoad:s.onLoad,w:o.length(24),h:o.length(24),borderRadius:"50%",objectFit:l?"contain":"cover",...l?{p:"2px",bg:"background",border:"1px solid",borderColor:"borderColor"}:{}})}),O.jsx(ae,{position:"absolute",left:o.length(21),bottom:o.length(21),width:o.length(7.68),height:o.length(7.68),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),O.jsx(ae,{position:"absolute",left:o.length(27),bottom:o.length(27),width:o.length(15.8),height:o.length(15.8),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),O.jsx(ae,{position:"absolute",left:o.length(35),bottom:o.length(35),bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:n?O.jsxs(ue,{gap:o.length(8),align:"center",children:[c&&O.jsx(fe,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"mutedText",fontFamily:pe,children:c}),O.jsx(ue,{gap:o.length(3),align:"center","aria-hidden":"true",children:[0,1,2].map(e=>O.jsx(ae,{w:o.length(4),h:o.length(4),borderRadius:"full",bg:"mutedText",css:{animation:`dori-typing-dot 1.2s ease-in-out ${.15*e}s infinite`}},e))}),O.jsx("style",{children:"\n @keyframes dori-typing-dot {\n 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n }\n "})]}):O.jsx(fe,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"text",fontFamily:pe,children:a})})]})};function Gr(e,t){t?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}function Xr(e,t){let n=-1;const r=()=>{const r=e.getBoundingClientRect();n=r.width,t(function(e){const t={bgColor:null,transform:null};try{const n=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!n||!r)return t;const o=Math.min(1,256/Math.max(n,r)),a=Math.max(1,Math.round(n*o)),i=Math.max(1,Math.round(r*o)),s=document.createElement("canvas"),l=s.getContext("2d",{willReadFrequently:!0});if(!l)return t;s.width=a,s.height=i,l.drawImage(e,0,0,a,i);const{data:c}=l.getImageData(0,0,a,i),d=(e,t)=>{const n=4*(t*a+e);return[c[n],c[n+1],c[n+2],c[n+3]]},u=[d(0,0),d(a-1,0),d(0,i-1),d(a-1,i-1)].filter(([,,,e])=>e>=128),p=0===u.length;let f=null,h=null;if(!p){const e=new Map;for(const t of u){const n=`${t[0]},${t[1]},${t[2]}`,r=e.get(n);r?r.n+=1:e.set(n,{c:t,n:1})}f=Array.from(e.values()).sort((e,t)=>t.n-e.n)[0].c,h=`rgb(${f[0]}, ${f[1]}, ${f[2]})`}const g=Math.max(1,Math.floor(Math.max(a,i)/160)),m=(e,t)=>{const[n,r,o,a]=d(e,t);if(a<128)return!1;if(p)return!0;if(!f)return!1;const i=n-f[0],s=r-f[1],l=o-f[2];return Math.sqrt(i*i+s*s+l*l)>30};let b=a,x=i,y=-1,v=-1;for(let e=0;e<i;e+=g)for(let t=0;t<a;t+=g)m(t,e)&&(t<b&&(b=t),t>y&&(y=t),e<x&&(x=e),e>v&&(v=e));if(y<0||v<0)return{bgColor:h,transform:null};const w=(y-b+g)/a,k=(v-x+g)/i;if(Math.max(w,k)>.8)return{bgColor:h,transform:null};const C=e.getBoundingClientRect();if(!C.width||!C.height)return{bgColor:h,transform:null};const j=Math.min(C.width/n,C.height/r),S=Math.max(w*n*j/C.width,k*r*j/C.height);if(!S)return{bgColor:h,transform:null};const z=Math.min(2.2,.88/S);if(z<1.06)return{bgColor:h,transform:null};const E=-((x+(v-x+g)/2)/i-.5)*r*j*z;return{bgColor:h,transform:`translate(${(-((b+(y-b+g)/2)/a-.5)*n*j*z).toFixed(1)}px, ${E.toFixed(1)}px) scale(${z.toFixed(3)})`}}catch{return t}}(e))},o=()=>r();e.complete&&e.naturalWidth>0?r():e.addEventListener("load",o);const a="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{const o=t[0]?.contentRect?.width??0;o>0&&Math.abs(o-n)>8&&e.complete&&e.naturalWidth>0&&r()}):null;return a?.observe(e),()=>{e.removeEventListener("load",o),a?.disconnect()}}const Jr={black:"#222222",white:"#ffffff",offwhite:"#f3efe7","off-white":"#f3efe7",ivory:"#f4f0e1",cream:"#f3ead3",natural:"#e8ded0",beige:"#d9c7a8",tan:"#cba36b",taupe:"#9b8978",camel:"#bd9a6a",khaki:"#a39a6a",sand:"#d8c19a",stone:"#cabfa9",nude:"#e3c4a8",gray:"#808080",grey:"#808080",charcoal:"#3a3d40",slate:"#5a6470",graphite:"#4a4a4a",silver:"#c4c4c4",ash:"#b2b2b2",smoke:"#8c8c8c",pewter:"#9a9a94",gunmetal:"#53565a",red:"#c8302b",crimson:"#a31f34",scarlet:"#c4302a",cherry:"#a31330",ruby:"#9b1b30",wine:"#5e1f2b",burgundy:"#5b1a26",bordeaux:"#4e1822",maroon:"#6b1f2a",brick:"#9c4a3a",terracotta:"#c46a4a",rust:"#9e4a2e",coral:"#e36a52",salmon:"#e69079",punch:"#d83a5e",pink:"#e58aab",rose:"#d98ca0",blush:"#e8c0c4",magenta:"#b8336a",fuchsia:"#c2407e",orange:"#e08234",pumpkin:"#e07b39",apricot:"#e7a473",peach:"#f0b48f",amber:"#c98a2b",mustard:"#c9962f",gold:"#c9a227",honey:"#d7a13a",sunshine:"#f4c842",yellow:"#e8c63a",lemon:"#e7d44a",canary:"#e6d24a",brown:"#6b4a2e",chocolate:"#4f3422",coffee:"#5a4334",mocha:"#7a5a44",caramel:"#a9743f",chestnut:"#6e3f2a",walnut:"#5a4031",espresso:"#3a2a21",bronze:"#7d5a33",copper:"#a35d3a",clay:"#a86a4f",green:"#3f7a3f",forest:"#2c4a2c",olive:"#6b6a35",sage:"#9aa583",moss:"#5e6b3a",mint:"#8fd0b0",emerald:"#1f8a5a",jade:"#3a9b78",lime:"#9bc24a","olive green":"#6b6a35",leaf:"#5a8a3a",blue:"#2f5fa8",navy:"#27314f",cobalt:"#2a4d9b",azure:"#3a8fd0",sky:"#86b8e0",denim:"#46688f",sapphire:"#1f4e8c",marine:"#27506b",ocean:"#1f6e8c",teal:"#1d8a85",turquoise:"#3fb7b0",aqua:"#5fc7c0",cyan:"#3bb6c4",periwinkle:"#8a9cd8",indigo:"#3a3a7a",purple:"#6f4a8e",violet:"#7a4ba0",plum:"#6e3a5e",grape:"#6f4a8e",eggplant:"#4b2e57",aubergine:"#4b2e57",amethyst:"#8a6aa0",lavender:"#b9a7d6",lilac:"#c4a8d6",mauve:"#a07a8a",seafoam:"#8fcab0",sangria:"#7a1f2b",midnight:"#1f2540",onyx:"#2a2a2a",ebony:"#2b2622",jet:"#2a2a2a",pearl:"#f0ead9",snow:"#fafafa",heather:"#9a8fa0",oat:"#dcceb4",fog:"#cfd2cf",berry:"#8a2f4a",rosso:"#c8302b",rojo:"#c8302b",rouge:"#c8302b",rot:"#c8302b",vermelho:"#c8302b",blu:"#2f5fa8",azul:"#2f5fa8",bleu:"#2f5fa8",blau:"#2f5fa8",azzurro:"#3a8fd0",verde:"#3f7a3f",vert:"#3f7a3f","grün":"#3f7a3f",gruen:"#3f7a3f",nero:"#222222",negro:"#222222",noir:"#222222",schwarz:"#222222",preto:"#222222",bianco:"#ffffff",blanco:"#ffffff",blanc:"#ffffff","weiß":"#ffffff",weiss:"#ffffff",branco:"#ffffff",giallo:"#e8c63a",amarillo:"#e8c63a",jaune:"#e8c63a",gelb:"#e8c63a",grigio:"#808080",gris:"#808080",grau:"#808080",marrone:"#6b4a2e","marrón":"#6b4a2e",marron:"#6b4a2e",braun:"#6b4a2e",viola:"#7a4ba0",morado:"#7a4ba0",lila:"#c4a8d6",arancione:"#e08234",naranja:"#e08234"},$r=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function eo(e,t){return t&&$r.test(t)?t:function(e){if(!e)return null;const t=e.trim().toLowerCase();if(Jr[t])return Jr[t];for(const n of t.split(/[\s/_,&+().-]+/))if(n&&Jr[n])return Jr[n];return null}(e)}function to(e,t,n,r,o){for(const a of e?.options??[])if(a.position===n)for(const e of a.values){if(!e.swatch||!e.swatch_variant)continue;const r=t.find(t=>String(t.id)===e.swatch_variant);if(r&&De(r,n)===o)return e.swatch}return e?.options?.find(e=>e.name===r)?.values.find(e=>e.value===o)?.swatch??null}function no(e){return!!e?.values.some(e=>e.swatch)}const ro=/colo|couleur|farbe|màu|colore|kleur/i,oo=({product:e,selectedColor:t=null,onColorChange:n,showQuantity:r=!1,onAdded:o,controlled:a=!1,onSelectionChange:i,onLiveLoaded:s})=>{const l=se(),{addToCartDirect:c,botData:d,isTestMode:u}=ie(),{t:p}=le(),f=e.variant_summary,[h,g]=q.useState(null),[m,b]=q.useState(!1),x=q.useRef(s);x.current=s;const[y,v]=q.useState({}),[w,k]=q.useState("idle"),[C,j]=q.useState(null),[S,z]=q.useState(1);q.useEffect(()=>{let t=!1;const n=He(e.url);if(n)return Pe(n).then(e=>{!t&&e&&e.variants?.length&&(g(e),b(!0),x.current?.(e))}).catch(()=>{}),()=>{t=!0}},[e.url]);const E=(e.currency||d?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",A=q.useMemo(()=>h?qe(h):[],[h]),R=q.useMemo(()=>m&&h?A.map((e,t)=>{const n=ro.test(e.name)||function(e,t){return!!e?.options?.some(e=>e.position===t&&no(e))}(f,t+1),r=e.values.map(r=>{let o=null;if(n){const e=h.variants.find(e=>De(e,t+1)===r&&e.featured_image?.src);o=e?.featured_image?.src??null}return{value:r,image:o,swatch:n?to(f,h.variants,t+1,e.name,r):null}}),o=n&&new Set(r.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:n,useImages:o,values:r}}).filter(e=>e.values.length>1):(f?.options??[]).map(e=>{const t=ro.test(e.name)||no(e),n=e.values.map(e=>({value:e.value,image:e.image,swatch:e.swatch})),r=t&&new Set(n.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:t,useImages:r,values:n}}),[m,h,A,f]),_=R.findIndex(e=>e.isColor),T=q.useRef(null);q.useEffect(()=>{if(t===T.current)return;if(T.current=t??null,null==t||_<0)return;const e=R[_]?.name;e&&v(n=>{if(n[e]===t)return n;const r={};for(let e=0;e<_;e++){const t=R[e].name;n[t]&&(r[t]=n[t])}r[e]=t;for(let e=_+1;e<R.length;e++){const t=R[e],o=n[t.name];o&&((!m||!h||Oe(h,{...r,[t.name]:o}).some(e=>!1!==e.available))&&(r[t.name]=o))}return r})},[t,_,R,m,h]);const W=q.useRef(!1),I=e=>{const t=R.find(t=>t.name===e);return!!t&&(t.isColor||1===t.values.length)};q.useEffect(()=>{if(!a||W.current||0===R.length)return;if(Object.keys(y).length>0)return void(W.current=!0);const e=R.find(e=>e.isColor),r=t=>{e&&t[e.name]&&n?.(t[e.name])},o=e&&t&&e.values.some(e=>e.value===t)?t:null;if(m&&h){const t=e?A.findIndex(t=>t.name===e.name)+1:0,n=o&&h.variants.find(e=>!1!==e.available&&De(e,t)===o)||h.variants.find(e=>!1!==e.available),a={};return n&&A.forEach((e,t)=>{const r=De(n,t+1);r&&I(e.name)&&(a[e.name]=r)}),W.current=!0,void(Object.keys(a).length&&(v(a),r(a)))}const i={};for(const t of R){if(!I(t.name))continue;const e=f?.options.find(e=>e.name===t.name)?.values??[],n=t=>{const n=e.find(e=>e.value===t);return!n||!1!==n.available},r=t.isColor&&o&&n(o)?{value:o}:t.values.find(e=>n(e.value));r&&(i[t.name]=r.value)}W.current=!0,Object.keys(i).length&&(v(i),r(i))},[a,m,h,R,A]);const L=R.every(e=>y[e.name]),M=q.useMemo(()=>m&&h&&L?Oe(h,y).find(e=>!1!==e.available)??null:null,[m,h,L,y]),B=L&&!(m&&h&&!M),F=R.map(e=>y[e.name]).filter(Boolean).join(" · ");q.useEffect(()=>{a&&i?.({allChosen:L,canAdd:B,variantId:M?String(M.id):null,priceCents:M?.price??null,selectedLabel:F,selectedOptions:y})},[a,L,B,M,F,y]);const D=r&&null!=M?.price?Ne(M.price/100*S,E):null,H=null!=M?.price?` · ${Ne(M.price/100,E)}`:"",P=Ye(l),N=(e,t,r)=>{const o=((e,t)=>{const n=R[e];if(m&&h){const r={[n.name]:t};for(let t=0;t<e;t++){const e=y[R[t].name];e&&(r[R[t].name]=e)}return Oe(h,r).some(e=>!1!==e.available)}const r=f?.options.find(e=>e.name===n.name)?.values.find(e=>e.value===t);return!r||!1!==r.available})(e,r.value),i=y[t.name]===r.value,s=t.isColor?eo(r.value,r.swatch):null,c={as:"button",type:"button",disabled:!o,"aria-pressed":i,"aria-label":r.value,title:r.value,onClick:()=>o&&((e,t)=>{const r=R[e].name,o=y[r]===t;v(n=>{const a={};for(let t=0;t<e;t++){const e=R[t].name;n[e]&&(a[e]=n[e])}return o||(a[r]=t),a}),!o&&R[e]?.isColor&&n?.(t),"added"!==w&&"error"!==w||(k("idle"),j(null))})(e,r.value),cursor:o?"pointer":"not-allowed",opacity:o?1:.35,style:{appearance:"none",WebkitAppearance:"none"}},d=a?`${P.image}px`:l.length(40),u=a?`${P.dot}px`:l.length(26);return t.useImages&&r.image?O.jsx(ae,{...c,position:"relative",p:l.space(0),w:d,h:d,borderRadius:l.radius(10),overflow:"hidden",border:i?"3px solid":"2px solid",borderColor:i?"primary":"borderColor",boxShadow:i?"0 0 0 2px var(--chakra-colors-veryLightBackground)":void 0,backgroundImage:`url(${r.image})`,backgroundSize:"cover",backgroundPosition:"center",flexShrink:0,children:!o&&O.jsx(ae,{position:"absolute",top:"50%",left:"-4px",right:"-4px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):s?O.jsx(ae,{...c,position:"relative",p:l.space(0),w:u,h:u,borderRadius:"full",bg:s,border:i?"3px solid":"2px solid",borderColor:i?"primary":"transparent",boxShadow:i?"0 0 0 2px var(--chakra-colors-background)":"inset 0 0 0 0.5px rgba(0,0,0,0.2)",flexShrink:0,children:!o&&O.jsx(ae,{position:"absolute",top:"50%",left:"-2px",right:"-2px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):O.jsx(ae,{...c,px:l.space(2.5),py:l.space(1),minH:a?`${P.minH}px`:void 0,display:a?"flex":"inline-flex",alignItems:"center",justifyContent:"center",minW:0,borderRadius:l.radius(8),border:i?"2px solid":"1px solid",borderColor:i?"primary":"borderColor",bg:i?"primary":"background",children:O.jsx(fe,{fontSize:a?`${P.font}px`:l.font(12),overflow:"hidden",textOverflow:"ellipsis",fontWeight:i?600:400,color:i?"white":"text",textDecoration:o?"none":"line-through",whiteSpace:"nowrap",fontFamily:pe,children:r.value})},r.value)},Y=R.map((e,t)=>O.jsxs(ae,{children:[O.jsxs(fe,{fontSize:a?l.font(12):l.font(11),color:"mutedText",mb:l.space(1.5),fontFamily:pe,children:[e.name,y[e.name]?O.jsx(fe,{as:"span",color:"primary",fontWeight:600,children:` · ${y[e.name]}`}):""]}),!a||e.useImages||e.isColor?O.jsx(ue,{gap:l.space(a?P.gap:1.5),wrap:"wrap",children:e.values.map(n=>N(t,e,n))}):O.jsx(ae,{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${P.minWidth}px, 1fr))`,gap:l.space(P.gap),children:e.values.map(n=>N(t,e,n))})]},e.name));return a?O.jsx(ge,{align:"stretch",gap:l.space(3),w:"full",pt:l.space(1),children:Y}):O.jsxs(ge,{align:"stretch",gap:l.space(2),w:"full",pt:l.space(1),children:[Y,r&&O.jsxs(ue,{justify:"space-between",align:"center",children:[O.jsx(fe,{fontSize:l.font(12),fontWeight:500,color:"text",fontFamily:pe,children:p("quantity")}),O.jsxs(ue,{gap:l.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:l.radius(8),overflow:"hidden",children:[O.jsx(ee,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:S<=1?"mutedText":"text",disabled:S<=1||"adding"===w,onClick:()=>z(e=>Math.max(1,e-1)),"aria-label":p("decreaseQuantity"),children:"−"}),O.jsx(fe,{fontSize:l.font(13),fontWeight:600,minW:l.length(28),textAlign:"center",color:"text",fontFamily:pe,children:S}),O.jsx(ee,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:S>=10?"mutedText":"text",disabled:S>=10||"adding"===w,onClick:()=>z(e=>Math.min(10,e+1)),"aria-label":p("increaseQuantity"),children:"+"})]})]}),O.jsxs(ee,{size:"sm",h:l.length(34),borderRadius:l.radius(8),fontSize:l.font(12),fontWeight:500,bg:"primary",color:"buttonText",gap:l.space(1.5),w:"full",disabled:!L||"adding"===w,loading:"adding"===w,onClick:async()=>{if(!L||"adding"===w)return;if(m&&h&&!M)return k("error"),void j(null);k("adding"),j(null);const t=r?S:1,n=null!=e.id?String(e.id):void 0,a=M?{variant_id:String(M.id),product_id:n,product_name:e.name,quantity:t}:{product_id:n,product_name:e.name,product_url:e.url,selected_options:y,quantity:t},i=Ve(e,d);if(i)return void Gr(i.href,u);const s=await c(a);"success"===s.type?(k("added"),o?.({selectedLabel:F,quantity:t})):(k("error"),j(Ue(s,p)||null))},_hover:{opacity:.92},fontFamily:pe,children:[O.jsx(In,{boxSize:l.length(14)}),"added"===w?`✓ ${p("addedToCart")}`:L?D&&L?p("addQty").replace("{qty}",String(S)).replace("{price}",D):p("addToCartButton")+(F?` · ${F}`:"")+H:p("selectOptionsToContinue")]}),"error"===w&&O.jsx(fe,{fontSize:l.font(11),color:"error",fontFamily:pe,children:C||p("errorOccurred")})]})},ao=({src:e,alt:t,height:n,fallbackBg:r,onClick:o})=>{const{ref:a,bgColor:i,transform:s}=function(e){const t=q.useRef(null),[n,r]=q.useState({bgColor:null,transform:null});return q.useEffect(()=>{r({bgColor:null,transform:null});const n=t.current;if(n&&e)return Xr(n,r)},[e]),{ref:t,...n}}(e);return O.jsx(ae,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},bg:i||r,borderRadius:"md",overflow:"hidden",cursor:o?"pointer":"default",onClick:o,children:O.jsx(de,{ref:a,src:e,alt:t,w:"full",h:n,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:s??void 0,transition:"transform 0.25s ease"})})},io=({slides:e,activeColor:t,onColorChange:n,height:r,bgColor:o,alt:a,onImageClick:i})=>{const s=se(),l=q.useRef(null),c=q.useRef(!1),d=q.useRef(!1),u=q.useRef(null),[p,f]=q.useState(0),h=q.useRef(t);h.current=t;const g=q.useRef(e);g.current=e;const m=q.useRef(n);m.current=n;const b=q.useRef(p);b.current=p;const x=e=>{null!=e?.color&&e.color!==h.current&&m.current?.(e.color)},y=(e,t)=>{const n=l.current,r=g.current[e];n&&r&&(c.current=!0,n.scrollTo({left:e*n.clientWidth,behavior:"smooth"}),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{c.current=!1},450),f(e),t&&x(r))},v=q.useRef(y);v.current=y;const w=q.useRef(t??null);q.useEffect(()=>{if(t===w.current)return;if(w.current=t??null,null==t||d.current)return;const n=e.findIndex(e=>e.color===t);n<0||n===b.current||v.current(n,!1)},[t,e]);const k=e.map(e=>e.id+"\0"+e.src).join("|"),C=q.useRef(null);q.useEffect(()=>{if(C.current===k)return;C.current=k;const e=l.current,t=g.current.findIndex(e=>null!=e.color&&e.color===h.current),n=Math.max(0,t);e&&e.clientWidth>0&&e.scrollTo({left:n*e.clientWidth}),f(n)},[k]),q.useEffect(()=>{const e=l.current;if(!e)return;let t;const n=()=>{if(c.current||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth),n=g.current[t];n&&(f(t),x(n))},r=()=>{c.current||(d.current=!0,t&&window.clearTimeout(t),t=window.setTimeout(()=>{d.current=!1,n()},160))},o=()=>{t&&window.clearTimeout(t),d.current=!1,n()},a=t=>{if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;t.preventDefault();let n=e.parentElement;for(;n;){const e=getComputedStyle(n).overflowY;if(n.scrollHeight>n.clientHeight&&("auto"===e||"scroll"===e))return void n.scrollBy({top:t.deltaY});n=n.parentElement}window.scrollBy({top:t.deltaY})};return e.addEventListener("scroll",r,{passive:!0}),e.addEventListener("scrollend",o),e.addEventListener("wheel",a,{passive:!1}),()=>{e.removeEventListener("scroll",r),e.removeEventListener("scrollend",o),e.removeEventListener("wheel",a),t&&window.clearTimeout(t)}},[]),q.useEffect(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const j=e=>O.jsx(fn,{"aria-label":e<0?"Previous image":"Next image",position:"absolute",top:"50%",...e<0?{left:"6px"}:{right:"6px"},transform:"translateY(-50%)",size:"xs",minW:s.length(28),w:s.length(28),h:s.length(28),borderRadius:"full",bg:"rgba(255,255,255,0.92)",color:"text",border:"1px solid",borderColor:"borderColor",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",_hover:{bg:"white"},onClick:t=>{t.stopPropagation(),y(p+e,!0)},children:e<0?O.jsx(Tn,{boxSize:s.length(12)}):O.jsx(Bn,{boxSize:s.length(12)})});return O.jsxs(ae,{position:"relative",w:"full",dir:"ltr",children:[O.jsx(ue,{ref:l,gap:0,w:"full",css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map((e,t)=>O.jsx(ao,{src:e.src,alt:a,height:r,fallbackBg:o,onClick:i?()=>i(t):void 0},e.id))}),e.length>1&&p>0&&j(-1),e.length>1&&p<e.length-1&&j(1),e.length>1&&O.jsx(ue,{position:"absolute",bottom:s.length(6),left:"0",right:"0",justify:"center",gap:1,pointerEvents:"none",children:e.map((e,t)=>O.jsx(ae,{w:s.length(5),h:s.length(5),borderRadius:"full",bg:t===p?"primary":"rgba(0,0,0,0.25)",transition:"background 0.2s"},`dot-${e.id}`))})]})},so=/colo|couleur|farbe|màu|colore|kleur/i,lo=({product:e,isDesktop:t=!1,variant:r="default",badgeLabel:o,hideCta:a=!1})=>{const i="hero"===r,s="compact"===r,l=s?80:130,{sendMessage:p,setRepliedProduct:f,botData:h,chatState:g,addToCartDirect:m,isCartBusy:b,productFocusEnabled:x,shortlistEnabled:y,enterFocusMode:v,openVariantModal:w,isShortlisted:k,toggleShortlist:C,rememberCardColour:j,isTestMode:S}=ie(),z=se(),E=i?z.length(160):s?z.length(80):z.length(124),{t:A}=le(),R=(e?.currency||h?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",{name:_,price:T,originalPrice:W,discount:I,image:L,id:M,url:B}=e,F=n(h),D="full",H=Ve(e,h),P=null!==H,N=Boolean(e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=T&&e.sale_price<T),Y=N&&e.sale_price?e.sale_price:T,V=N?T:W,U=N&&null!=e.sale_percent_off&&e.sale_percent_off>0?e.sale_percent_off:I,Z=N&&null!=e.sale_amount_off&&e.sale_amount_off>0?e.sale_amount_off:void 0,K=!!V&&!!Y&&V>Y,Q=N?e.sale_label:void 0,G=e.minimum_quantity&&e.minimum_quantity>1?Math.floor(e.minimum_quantity):void 0,[X,J]=q.useState(!1),[$,te]=q.useState(!1),[ne,re]=q.useState(!1),[oe,ce]=q.useState(!1),he=q.useRef(null);q.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const[me,be]=q.useState(!1),xe=(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),ye=tn("colors","background"),ve=Array.isArray(ye)?ye[0]:ye,[we,ke]=q.useState(ve),Ce=!0===h?.feature_flags?.disable_image_backdrop?ve:we,[je,Se]=q.useState(null),ze=q.useRef(null),[Ee,Ae]=q.useState(e.selected_color??null);q.useEffect(()=>{null!=M&&j(String(M),Ee)},[M,Ee,j]);const Re=q.useMemo(()=>{const t=e.variant_summary?.options?.find(e=>so.test(e.name||""));return!s&&t&&L&&t.values.some(e=>e.image)?t.values.map(e=>({id:`color:${e.value}`,src:e.image||L,color:e.value})):[]},[e.variant_summary,L,s]),_e=Re.length>1,Te=e.description?.length&&e.description?.length>l;q.useEffect(()=>{const e=ze.current;if(e)return Xr(e,e=>{ke(e.bgColor??ve),Se(e.transform)})},[L,ve]);const We=async()=>{if(H)return void Gr(H.href,S);if(ne)return;re(!0);const t=He(B);try{const n=await m({product_id:null!=M?String(M):void 0,product_name:_,product_url:B||void 0,product_handle:t||void 0,quantity:u(e),quantity_label:d(e)});if("success"===n.type&&(ce(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(()=>ce(!1),1600)),"failed"===n.type&&"busy"===n.reason)return;if("success"!==n.type){const n=A("addToCartMessage").replace("{product}",_),r=`DORI_INTERNAL_EVENT:add_to_cart_request:${JSON.stringify({product_name:_,product_url:B||null,product_handle:t||null,quantity:e.price_unit?1:G??1})}`;await p({message:n,apiMessage:r})}}finally{re(!1)}},Ie=ne||b,Le=xe&&me,Me=k(M),[Be,Fe]=q.useState(!1),De=q.useRef(null);q.useEffect(()=>()=>{De.current&&clearTimeout(De.current)},[]);const Pe=x?()=>v(e,`card_body:${r}`):async()=>{if(!B||!h)return;const t=Gn(B);c(e,h,g.threadId),Gr(t,S)},qe=e=>{e.stopPropagation(),H&&Gr(H.href,S)},Oe=t=>{t.stopPropagation(),P?qe(t):xe?w(Ee?{...e,selected_color:Ee}:e,"card"):We()};return O.jsxs(ge,{gap:z.space(1),children:[O.jsx(ae,{bg:"background",borderRadius:s?z.radius(12):z.radius(16),border:"1px solid",borderColor:i?"primary":"borderColor",borderWidth:i?"1.5px":"1px",p:z.space(s?1.5:2),w:"full",transition:"all 0.2s ease",_hover:{borderColor:"primary",transform:"translateY(-1px)"},children:O.jsxs(ge,{gap:z.space(s?1.5:2),align:"stretch",children:[O.jsxs(ae,{position:"relative",borderRadius:"md",children:[y&&!s&&O.jsx(fn,{"aria-label":A(Me?"removeSaved":"saveForLater"),position:"absolute",top:z.length(6),right:z.length(6),zIndex:2,variant:"ghost",size:"xs",minW:z.length(26),w:z.length(26),h:z.length(26),p:z.space(0),borderRadius:"full",bg:"background",_hover:{bg:"background"},boxShadow:"0 1px 4px rgba(0,0,0,0.18)",color:Me?"primary":"mutedText",transform:Be?"scale(1.2)":"scale(1)",transition:"transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:t=>{t.stopPropagation(),C(e),Fe(!0),De.current&&clearTimeout(De.current),De.current=setTimeout(()=>Fe(!1),220)},children:Me?O.jsx(Mn,{boxSize:z.length(14)}):O.jsx(Ln,{boxSize:z.length(14)})}),i&&o&&O.jsx(ae,{position:"absolute",top:z.length(6),left:z.length(6),zIndex:1,bg:"primary",color:"buttonText",fontSize:z.font(10),fontWeight:"600",px:z.space(2),py:z.space(.5),borderRadius:z.radius(6),fontFamily:pe,boxShadow:"0 1px 3px rgba(0,0,0,0.15)",children:o}),_e?O.jsx(io,{slides:Re,activeColor:Ee,onColorChange:Ae,height:E,bgColor:Ce,alt:_,onImageClick:Pe}):O.jsx(ae,{cursor:"pointer",onClick:Pe,_hover:{opacity:.9},transition:"all 0.3s ease",bg:Ce,borderRadius:"md",overflow:"hidden",children:$?O.jsx(ae,{w:"full",h:E,display:"flex",alignItems:"center",justifyContent:"center",bg:"lightBackground",borderRadius:"md",children:O.jsx(In,{boxSize:z.length(24),color:"mutedText"})}):O.jsx(de,{ref:ze,src:L,alt:_,w:"full",h:E,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:je??void 0,transition:"transform 0.25s ease",onError:()=>te(!0)})})]}),O.jsx(ue,{gap:z.space(1),align:"center",w:"full",children:O.jsx(fe,{fontWeight:600,fontSize:s?z.font(11):z.font(12),lineHeight:s?z.lineHeight(18):z.lineHeight(24),color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1,minW:0,title:_,fontFamily:pe,cursor:"pointer",onClick:Pe,...x&&{role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Pe())},"aria-label":A("selectedProduct").replace("{name}",_)},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"2px",borderRadius:"4px"},transition:"color 0.2s",children:_})}),!s&&e.description&&O.jsx(ae,{borderRadius:z.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",padding:"6px 10px",w:"full",bg:"lightBackground",cursor:"pointer",onClick:Pe,_hover:{bg:"veryLightBackground"},transition:"background-color 0.2s",children:O.jsxs(fe,{fontSize:z.font(12),fontWeight:400,color:"text",lineHeight:z.lineHeight(20),overflow:"hidden",title:e.description,fontFamily:pe,children:[Te&&!X?e.description?.substring(0,l)+"... ":e.description,Te&&!X&&O.jsx(fe,{as:"span",fontSize:z.font(12),lineHeight:z.lineHeight(4),color:"primary",borderRadius:z.radius(4),flex:1,cursor:"pointer",fontWeight:400,fontFamily:pe,onClick:e=>{e.stopPropagation(),J(!0)},children:A("more")})]})}),O.jsxs(ue,{justify:"space-between",align:"end",cursor:"pointer",onClick:Pe,children:[O.jsxs(ge,{gap:z.space(1),align:"start",children:[(K||U||Z)&&O.jsxs(ue,{gap:z.space(1),children:[K&&O.jsx(fe,{fontSize:z.font(12),color:"mutedText",textDecoration:"line-through",fontFamily:pe,children:null!=V?Ne(V,R):null}),(U||Z)&&O.jsx(pn,{bg:"errorBackground",color:"error",fontSize:z.font(12),borderRadius:z.radius(24),title:Q||void 0,children:U?`${U}%`:`-${Ne(Z??0,R)}`})]}),!!Y&&Y>0&&O.jsxs(fe,{fontSize:z.font(12),fontWeight:"700",color:"text",fontFamily:pe,children:[Ne(Y,R),e.price_unit?O.jsxs(fe,{as:"span",fontSize:z.font(10),fontWeight:500,color:"mutedText",children:[" / ",e.price_unit]}):G?O.jsxs(fe,{as:"span",fontSize:z.font(10),fontWeight:500,color:"mutedText",children:[" ",A("perUnit")]}):null]}),e.price_on_request&&O.jsx(fe,{fontSize:z.font(12),fontWeight:"700",color:"text",fontFamily:pe,children:A("priceOnRequest")}),G&&!e.price_unit&&O.jsx(fe,{fontSize:z.font(11),fontWeight:600,color:"mutedText",fontFamily:pe,children:A("soldInSetsOf").replace("{count}",String(G))})]}),x&&!s&&O.jsxs(fe,{role:"button",tabIndex:0,fontSize:z.font(11.5),fontWeight:500,color:"mutedText",whiteSpace:"nowrap",flexShrink:0,cursor:"pointer",onClick:t=>{t.stopPropagation(),v(e,"details_button")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),v(e,"details_button"))},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",borderRadius:"4px"},fontFamily:pe,children:[A("detailsAction")," ›"]})]})]})}),a?null:x?F&&O.jsx(ge,{gap:z.space(1),w:D,align:"stretch",children:s?O.jsx(fn,{variant:"outline",size:"xs",h:z.length(26),color:"primary",borderColor:"borderColor",borderRadius:z.radius(6),borderWidth:"1px",_hover:{bg:"veryLightBackground"},onClick:Oe,disabled:!P&&!xe&&Ie,"aria-label":A(P?H.labelKey:"addToCartButton"),children:O.jsx(In,{boxSize:z.length(14)})}):O.jsxs(ee,{variant:"solid",size:"xs",h:z.length(36),fontSize:z.font(13),bg:"primary",color:"buttonText",borderRadius:z.radius(10),w:"full",fontWeight:600,onClick:Oe,disabled:!P&&!xe&&(Ie||oe),loading:!P&&!xe&&Ie,_hover:{opacity:.9},fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[P?null:O.jsx(In,{boxSize:z.length(15)}),P?A(H.labelKey):xe?A("addToCartFull"):oe?`✓ ${A("addedToCart")}`:A(Ie?"addToCartAdding":"addToCartFull")]})}):O.jsxs(ge,{gap:z.space(1),w:D,align:"stretch",children:[O.jsxs(ue,{gap:z.space(.5),children:[O.jsx(fn,{variant:"outline",size:"xs",h:s?z.length(26):z.length(30),fontSize:z.font(12),color:"primary",borderColor:"borderColor",borderRadius:z.radius(4),_hover:{bg:"veryLightBackground"},borderWidth:"1px",onClick:()=>{f({product:e,suggestions:[A("doesProductHaveDiscount"),A("whatFeaturesSpecial"),A("otherColorsAvailable")]})},"aria-label":"Reply to product",children:O.jsx(Sn,{boxSize:s?z.length(14):z.length(16)})}),!s&&O.jsxs(ee,{variant:"outline",size:"xs",h:z.length(30),fontSize:z.font(12),color:"primary",borderRadius:z.radius(4),flex:1,fontWeight:400,onClick:()=>{const e=`${A("doYouHaveSimilar")} ${_}`;p({message:e,apiMessage:`${e} (product id: ${M})`})},_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:pe,whiteSpace:"nowrap",minW:0,overflow:"hidden",textOverflow:"ellipsis",children:[O.jsx(zn,{boxSize:z.length(16)}),A("similar")]}),!s&&F&&O.jsxs(ee,{variant:"outline",size:"xs",h:z.length(30),fontSize:z.font(12),color:"primary",borderRadius:t?"4px":"6px",flex:1,minW:0,fontWeight:400,onClick:P?qe:xe?()=>be(e=>!e):We,disabled:!P&&!xe&&Ie,loading:!P&&!xe&&Ie,_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[P?null:Le?O.jsx(wn,{boxSize:z.length(11)}):O.jsx(In,{boxSize:z.length(16)}),A(P?H.labelKey:Le?"close":Ie?"addToCartAdding":"addToCartButton")]})]}),me&&xe&&!P&&O.jsx(oo,{product:e,selectedColor:Ee,onColorChange:Ae})]})]})},co=({index:e,delay:t=70,children:n})=>{const[r,o]=q.useState(!1);return q.useEffect(()=>{const n=setTimeout(()=>o(!0),e*t);return()=>clearTimeout(n)},[e,t]),O.jsx(ae,{opacity:r?1:0,transform:r?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:n})},uo=({products:e,isDesktop:t})=>O.jsx(xn,{dir:"ltr",columns:t?2:1,gapX:t?2:1,gapY:t?4:2,w:"full",children:e.map((e,n)=>O.jsx(co,{index:n,children:O.jsx(lo,{product:e,isDesktop:t})},e.id))});function po(e){return e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=e.price&&e.sale_price<e.price&&e.sale_price?e.sale_price:e.price}const fo=({product:e,index:t,isLast:n,isDesktop:r,delay:o,status:a,cardVariant:i,hideCardCta:s,onRemove:l})=>{const c=se(),[d,u]=q.useState(!1),{t:p}=le();q.useEffect(()=>{const e=setTimeout(()=>u(!0),o);return()=>clearTimeout(e)},[o]);const f=e.step_label?e.step_label.replace(/^\S+\s*\d+\s*[:.\-]\s*/i,"").trim()||e.step_label:null;return O.jsx(ae,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:O.jsxs(ue,{align:"stretch",gap:c.space(0),children:[O.jsxs(ge,{align:"center",gap:c.space(0),w:c.length(28),flexShrink:0,children:[O.jsx(ae,{w:c.length(28),h:c.length(28),borderRadius:"full",bg:"primary",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,children:"adding"===a?O.jsx(be,{size:"xs",color:"buttonText"}):O.jsx(fe,{fontSize:c.font(12),fontWeight:"700",color:"buttonText",lineHeight:"1",children:"added"===a?"✓":t+1})}),!n&&O.jsx(ae,{flex:1,w:"2px",bg:"borderColor",minH:c.length(8),opacity:d?1:0,transition:"opacity 0.3s ease-out 0.2s"})]}),O.jsxs(ge,{align:"stretch",gap:c.space(1.5),flex:1,minW:0,pl:c.space(2.5),pb:n?0:3,children:[O.jsxs(ue,{justify:"space-between",align:"center",minH:c.length(28),children:[f?O.jsx(fe,{fontSize:c.font(13),fontWeight:"600",color:"text",fontFamily:pe,pt:c.space(.5),children:f}):O.jsx(ae,{}),O.jsxs(ue,{gap:c.space(0),align:"center",children:["failed"===a&&O.jsx(fe,{fontSize:c.font(11),color:"red.500",fontFamily:pe,pr:c.space(1.5),children:p("stepAddFailed")}),"added"!==a&&O.jsx(ae,{as:"button","aria-label":p("removeProduct"),onClick:l,color:"mutedText",cursor:"pointer",w:c.length(28),h:c.length(28),display:"flex",alignItems:"center",justifyContent:"center",borderRadius:c.radius(6),_hover:{color:"text",bg:"veryLightBackground"},children:O.jsx(wn,{boxSize:c.length(10)})})]})]}),O.jsx(lo,{product:e,isDesktop:r,variant:i,hideCta:s})]})]})})};function ho(e,t){const n=e.external_product_id?String(e.external_product_id):null;return t.some(t=>n&&null!=t.product_id&&String(t.product_id)===n||!!e.name&&!!t.product_title&&t.product_title===e.name)}const go={single_pick:({products:e,isDesktop:t})=>{const n=se(),r=e[0],o=e.slice(1,3),{t:a}=le(),[i,s]=q.useState(!1),[l,c]=q.useState(!1);return q.useEffect(()=>{const e=requestAnimationFrame(()=>s(!0)),t=o.length>0?setTimeout(()=>c(!0),300):void 0;return()=>{cancelAnimationFrame(e),t&&clearTimeout(t)}},[o.length]),r?O.jsxs(ge,{gap:n.space(3),w:"full",align:"stretch",children:[O.jsx(ae,{opacity:i?1:0,transform:i?"translateY(0)":"translateY(8px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:O.jsx(lo,{product:r,isDesktop:t,variant:"hero",badgeLabel:a("topPick")})}),o.length>0&&O.jsxs(ae,{opacity:l?1:0,transform:l?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:[O.jsx(fe,{fontSize:n.font(11),fontWeight:500,color:"mutedText",fontFamily:pe,mb:n.space(2),px:n.space(1),children:a("alsoConsider")}),O.jsx(xn,{dir:"ltr",columns:1===o.length?1:2,gapX:n.space(2),gapY:n.space(2),w:"full",children:o.map(e=>O.jsx(ae,{children:O.jsx(lo,{product:e,isDesktop:t,variant:1===o.length?"default":"compact"})},e.id))})]})]}):null},shortlist:({products:e,isDesktop:t})=>{const{t:n}=le();return O.jsx(ge,{gap:3,w:"full",align:"stretch",children:e.map((e,r)=>O.jsx(co,{index:r,delay:120,children:O.jsx(lo,{product:e,isDesktop:t,variant:0===r?"hero":"default",badgeLabel:0===r?n("topPick"):void 0})},e.id))})},routine:({products:e,isDesktop:t})=>{const r=se(),{botData:o,addToCartDirect:a,isCartBusy:i,cartItemCount:s}=ie(),{t:l}=le(),[c,f]=q.useState({}),[h,g]=q.useState({}),[m,b]=q.useState({}),[x,y]=q.useState(!1);q.useEffect(()=>{if(!n(o))return;let t=!1;return(async()=>{const n=await p();if(t||!n)return;const r={};for(const t of e)ho(t,n.items||[])&&(r[t.id]=!0);b(r)})(),()=>{t=!0}},[o,e,s]);const v=e=>m[e.id]?"added":h[e.id]??"idle",w=e.filter(e=>!c[e.id]&&null===Ve(e,o)),k=w.filter(e=>"added"!==v(e)),C=w.length>0&&0===k.length,j=k.every(e=>Number.isFinite(po(e))&&po(e)>0),S=w[0]?.currency||o?.currency,z=w.reduce((e,t)=>e+po(t),0),E=k.reduce((e,t)=>e+po(t),0),A=w.every(e=>Number.isFinite(po(e))&&po(e)>0),R=n(o)&&w.length>=2&&w.every(e=>!function(e){return(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1)}(e)),_=x?l("addingRoutine"):C?`✓ ${l("addedToCart")}`:j?`${l("addRoutine")} · ${Ne(E,S)}`:l("addRoutine");return O.jsxs(ge,{gap:r.space(0),w:"full",align:"stretch",children:[O.jsxs(ue,{justify:"space-between",align:"baseline",mb:r.space(1.5),pl:r.length(38),children:[O.jsx(fe,{fontSize:r.font(13),fontWeight:"700",color:"text",fontFamily:pe,children:l("routineTitle")}),A&&w.length>=2&&O.jsx(fe,{fontSize:r.font(13),fontWeight:"700",color:"text",fontFamily:pe,children:Ne(z,S)})]}),e.map((e,n)=>{if(c[e.id])return O.jsxs(ue,{pl:r.length(38),pb:r.space(2),gap:r.space(2),align:"center",children:[O.jsx(fe,{fontSize:r.font(12),color:"mutedText",fontFamily:pe,textDecoration:"line-through",lineClamp:1,minW:0,children:e.name}),O.jsx(fe,{fontSize:r.font(12),color:"mutedText",fontFamily:pe,children:l("stepRemoved")}),O.jsx(ae,{as:"button",onClick:()=>f(t=>{const n={...t};return delete n[e.id],n}),color:"primary",fontSize:r.font(12),fontWeight:"600",cursor:"pointer",fontFamily:pe,px:r.space(2),h:r.length(24),children:l("undo")})]},e.id);const o=w.findIndex(t=>t.id===e.id);return O.jsx(fo,{product:e,index:o,isLast:o===w.length-1,isDesktop:t,delay:200*n,status:v(e),cardVariant:R?"compact":"default",hideCardCta:R,onRemove:()=>f(t=>({...t,[e.id]:!0}))},e.id)}),R&&O.jsx(ee,{mt:r.space(2.5),ml:r.length(38),size:"sm",h:r.length(36),fontSize:r.font(13),fontWeight:"600",bg:C?"veryLightBackground":"primary",color:C?"text":"white",borderRadius:r.radius(8),fontFamily:pe,onClick:async()=>{if(!x&&!i&&0!==k.length){y(!0);try{const e=[...k];for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;if(g(e=>({...e,[n.id]:"adding"})),"success"!==(await a({product_id:null!=n.id?String(n.id):void 0,product_name:n.name,product_url:n.url||void 0,product_handle:He(n.url)||void 0,quantity:u(n),quantity_label:d(n)},{deferCartEffects:!r})).type)return void g(e=>({...e,[n.id]:"failed"}));g(e=>({...e,[n.id]:"added"}))}}finally{y(!1)}}},disabled:x||i||C,loading:x,_hover:C?{}:{opacity:.9},children:_})]})},explore:uo},mo=({products:e,shape:t="explore"})=>{const{chatState:n,botData:r,isTestMode:o}=ie(),a=q.useRef(new Set),s=q.useRef(null),[l,c]=q.useState(!1),d=q.useCallback(()=>{s.current&&c(s.current.offsetWidth>=600)},[]);q.useEffect(()=>{d();const e=new ResizeObserver(d);return s.current&&e.observe(s.current),()=>e.disconnect()},[d]),q.useEffect(()=>{if(o)return;const t=Ze.SHOPIFY;if(!n.threadId)return;const i=r?.sharing_id||f();if(!i)return;const s=h(),l=[];if(e.forEach(e=>{const t=e.external_product_id;t&&(a.current.has(t)||(a.current.add(t),l.push(t)))}),l.length>0){const e=window.DORI_CUSTOMER_ID,r=null!=e?String(e):void 0,o=g();m(l,n.threadId||"",s,t,i,void 0,r,o)}},[e,t,n.threadId,r?.sharing_id,r?.assistant_id,o]);const u=q.useRef(null),p=q.useRef(!1);q.useEffect(()=>{if(o)return;const a=u.current;if(!a||p.current)return;const s=e.map(e=>e.external_product_id).filter(e=>Boolean(e)).slice(0,12);if(0===s.length)return;const l=new IntersectionObserver(o=>{for(const a of o)a.isIntersecting&&!p.current&&(p.current=!0,i("recommendation_seen",{assistantId:r?.assistant_id,threadId:n.threadId,payload:{set_id:s.join(","),shape:t,count:e.length,product_ids:s}}),l.disconnect())},{threshold:0});return l.observe(a),()=>l.disconnect()},[e,t,o,r?.assistant_id,n.threadId]);const b=go[t]||uo;return O.jsxs(ge,{ref:s,align:"stretch",gap:2,w:"full",children:[O.jsx(ae,{ref:u,h:"1px",w:"full","aria-hidden":!0}),O.jsx(ae,{px:1,w:"full",children:O.jsx(b,{products:e,isDesktop:l})})]})},bo=({index:e,children:t})=>{const[n,r]=q.useState(!1);return q.useEffect(()=>{const t=setTimeout(()=>r(!0),70*e);return()=>clearTimeout(t)},[e]),O.jsx(ae,{opacity:n?1:0,transform:n?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:t})},xo=({suggestions:e,options:t=!1})=>{const n=se(),{sendMessage:r,focusModeProduct:o}=ie(),{visible:a,asOptions:i}=Ke(e,{options:t,focusMode:!!o});return O.jsx(bn,{direction:"row",wrap:"wrap",gap:n.space(2),maxW:"full",alignSelf:"flex-start",children:a.map((e,t)=>O.jsx(bo,{index:t,children:O.jsxs(ee,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:n.radius(18),px:n.space(3.5),h:"auto",lineHeight:"1.4",py:n.space(2),onClick:()=>(e=>{r({message:e})})(e),_hover:{bg:"lightBackground",borderColor:"primary"},_active:{bg:"veryLightBackground"},textAlign:"start",justifyContent:"flex-start",gap:n.space(1.5),w:"auto",maxW:"100%",children:[!i&&O.jsx(En,{boxSize:n.length(13),color:"primary",flexShrink:0}),O.jsx(fe,{fontSize:{base:n.font(14),md:n.font(13)},fontWeight:"500",color:"text",textAlign:"start",wordBreak:"break-word",whiteSpace:"normal",lineClamp:2,children:e})]})},t))})},yo=()=>{const e=se(),{botData:t}=ie(),{t:n}=le(),a=!0===t?.hide_checkout_button;return O.jsxs(ue,{mt:e.space(3),gap:e.space(2),justify:"flex-start",children:[O.jsxs(ee,{size:"xs",variant:"outline",borderColor:"borderColor",color:"mutedText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{if(!r()){const e=`${o()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},_hover:{borderColor:"primary"},children:[O.jsx(In,{boxSize:e.length(14)}),n("cartViewCart")]}),!a&&O.jsxs(ee,{size:"xs",variant:"solid",bg:"primary",color:"buttonText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{b()},_hover:{opacity:.85},children:[n("cartCheckout"),O.jsx(Bn,{boxSize:e.length(14)})]})]})},vo=({add:e})=>{const t=se(),{botData:n,chatState:a}=ie(),{t:s}=le(),l=e?.cart??null,c=(l?.currency||n?.currency||"USD").split(" - ")[0]?.trim().toUpperCase(),d=e=>Ne(e/100,c),u=l?.added??null,p=u?.name||e?.product_name||null,f=u?.variant_title??null,h=u?.quantity??e?.quantity??null,g=null!=u?.unit_price&&null!=h?u.unit_price*h:null,m=null!=g?d(g):null,x=l?.others??[],y=e=>[e.variant_title,e.quantity>1?`x${e.quantity}`:null,null!=e.line_price?d(e.line_price):null].filter(Boolean).join(" · ");return O.jsx(ae,{mt:t.space(3),border:"1.5px solid",borderColor:"borderColor",borderRadius:t.radius(14),p:t.space(3.5),bg:"background",w:"full",maxW:t.length(360),boxShadow:"0 1px 6px rgba(0, 0, 0, 0.05)",children:O.jsxs(ge,{align:"stretch",gap:t.space(2.5),children:[O.jsxs(ue,{gap:t.space(1.5),children:[O.jsx(kn,{boxSize:t.length(16),color:"primary"}),O.jsx(fe,{fontSize:t.font(13),fontWeight:700,color:"primary",fontFamily:pe,children:s("addedToCart")})]}),p&&O.jsxs(ue,{gap:t.space(2.5),align:"center",children:[u?.image?O.jsx(de,{src:u.image,alt:p,w:t.length(48),h:t.length(48),objectFit:"cover",onLoad:Qe,borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground"}):O.jsx(ae,{w:t.length(48),h:t.length(48),borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:O.jsx(In,{boxSize:t.length(18),color:"mutedText"})}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:t.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:p}),O.jsx(fe,{fontSize:t.font(12),color:"mutedText",fontFamily:pe,children:[f,h&&h>1?`x${h}`:null,m].filter(Boolean).join(" · ")})]})]}),x.map((e,n)=>O.jsxs(ue,{gap:t.space(2.5),align:"center",opacity:.75,children:[e.image?O.jsx(de,{src:e.image,alt:e.title||"",w:t.length(32),h:t.length(32),objectFit:"cover",onLoad:Qe,borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground"}):O.jsx(ae,{w:t.length(32),h:t.length(32),borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:O.jsx(In,{boxSize:t.length(14),color:"mutedText"})}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:t.font(12),fontWeight:500,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:e.title}),O.jsx(fe,{fontSize:t.font(11),color:"mutedText",fontFamily:pe,children:y(e)})]})]},n)),!!l?.hidden_line_count&&l.hidden_line_count>0&&O.jsx(fe,{fontSize:t.font(11),color:"mutedText",fontFamily:pe,children:s("cartMoreItems").replace("{count}",String(l.hidden_line_count))}),l&&l.item_count>0&&O.jsx(fe,{fontSize:t.font(12),fontWeight:600,color:"text",borderTop:"1px solid",borderColor:"borderColor",pt:t.space(2),fontFamily:pe,children:s(1===l.item_count?"cartLineOne":"cartLine").replace("{count}",String(l.item_count)).replace("{total}",d(l.total_price))}),O.jsxs(ue,{gap:t.space(2),children:[O.jsxs(ee,{size:"sm",flex:1,variant:"outline",borderColor:"borderColor",color:"text",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{if(i("closer_action_clicked",{assistantId:n?.assistant_id,threadId:a.threadId,payload:{action:"view_cart"}}),!r()){const e=`${o()}cart`;window.location.href=e}},_hover:{borderColor:"primary"},children:[O.jsx(In,{boxSize:t.length(13)}),s("cartViewCart")]}),!0!==n?.hide_checkout_button&&O.jsxs(ee,{size:"sm",flex:1,variant:"solid",bg:"primary",color:"buttonText",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{i("closer_action_clicked",{assistantId:n?.assistant_id,threadId:a.threadId,payload:{action:"checkout"}}),b()},_hover:{opacity:.85},children:[s("cartCheckout"),O.jsx(Bn,{boxSize:t.length(13)})]})]})]})})},wo=({onSubmit:e,onClose:t,existingText:n})=>{const r=se(),[o,a]=q.useState(n||""),[i,s]=q.useState(!1);return q.useEffect(()=>{a(n||"")},[n]),O.jsx(ae,{mt:r.space(2),bg:"background",borderRadius:r.radius(10),p:r.space(3),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:r.length(280),children:O.jsxs(ge,{gap:r.space(3),align:"stretch",children:[O.jsxs(ge,{gap:r.space(.5),align:"start",children:[O.jsx(fe,{fontSize:r.font(13),fontWeight:"600",color:"text",lineHeight:"1.4",children:"Tell us what was wrong"}),O.jsx(fe,{fontSize:r.font(11),color:"mutedText",lineHeight:"1.4",children:"Your comment is optional and helps us improve responses."})]}),O.jsx(vn,{value:o,onChange:e=>a(e.target.value),placeholder:"Describe what you expected...","aria-label":"Describe what you expected",rows:3,fontSize:r.font(12),resize:"none",borderColor:"borderColor",borderRadius:r.radius(8),p:r.space(2),bg:"lightBackground",color:"text",autoFocus:!0,_placeholder:{color:"mutedText"},_focus:{outline:"none",borderColor:"primary",boxShadow:"none"}}),O.jsxs(ue,{gap:r.space(2),justify:"flex-end",children:[O.jsx(ee,{size:"sm",variant:"ghost",onClick:t,disabled:i,fontSize:r.font(12),color:"mutedText",px:r.space(3),h:r.length(30),_hover:{bg:"lightBackground"},children:"Cancel"}),O.jsx(ee,{size:"sm",variant:"outline",onClick:async()=>{s(!0),await e(void 0),s(!1)},disabled:i,fontSize:r.font(12),color:"text",borderColor:"borderColor",px:r.space(3),h:r.length(30),children:"No Comment"}),O.jsx(ee,{size:"sm",onClick:async()=>{s(!0),await e(o.trim()||void 0),s(!1)},disabled:i,fontSize:r.font(12),bg:"primary",color:"buttonText",px:r.space(3),h:r.length(30),borderRadius:r.radius(8),_hover:{opacity:.85},children:i?"Submitting...":"Submit"})]})]})})},ko=({messageIndex:e,feedback:t})=>{const n=se(),{submitFeedback:r}=ie(),[o,a]=q.useState(!1),i="like"===t?.rating,s="dislike"===t?.rating;return O.jsxs(ae,{mt:n.space(1.5),children:[O.jsxs(ue,{gap:n.space(1.5),align:"center",children:[O.jsx(ae,{as:"button",onClick:async()=>{i||(await r(e,"like"),a(!1))},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:i?"primary":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:i?"primary":"borderColor",cursor:"pointer",title:"This response was helpful","aria-label":"This response was helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:O.jsx(fe,{fontSize:n.font(16),lineHeight:"1",children:"👍"})}),O.jsx(ae,{as:"button",onClick:()=>{a(!0)},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:s?"red.500":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:s?"red.500":"borderColor",cursor:"pointer",title:"This response wasn't helpful","aria-label":"This response wasn't helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:O.jsx(fe,{fontSize:n.font(16),lineHeight:"1",children:"👎"})})]}),t?.feedbackText&&O.jsxs(ae,{mt:n.space(1),px:n.space(2.5),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:n.length(280),children:[O.jsx(fe,{fontSize:n.font(10),color:"mutedText",lineHeight:"1.2",fontWeight:"600",textTransform:"uppercase",mb:n.space(1),children:"Submitted Feedback"}),O.jsx(fe,{fontSize:n.font(11),color:"mutedText",lineHeight:"1.4",children:t.feedbackText})]}),o&&O.jsx(ae,{maxW:n.length(280),children:O.jsx(wo,{onSubmit:async t=>{await r(e,"dislike",t),a(!1)},onClose:()=>{a(!1)},existingText:t?.feedbackText})})]})},Co=({variant:e,children:t,textSize:n={base:"15px",md:"14px"}})=>{const r=se(),o=Ge(r,n);return"user"===e?O.jsx(fe,{wordBreak:"break-word",fontSize:r.font(14),fontWeight:"500",color:"text",fontFamily:pe,whiteSpace:"pre-wrap",children:t}):O.jsx(fe,{fontSize:o,fontWeight:"400",color:"text",textAlign:"left",lineHeight:"1.6",whiteSpace:"pre-wrap",children:t})},jo=(So=()=>v(()=>import("./MarkdownContent-D7AdAAbE.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),zo=Co,Eo="markdown",oe.lazy(()=>x(So,zo,(e,t)=>{console.warn(`[Dori] chunk "${Eo}" failed twice, rendering plain fallback`,e,t);try{y(t instanceof Error?t:new Error(String(t)),{chunk:Eo,degraded:!0})}catch{}})));var So,zo,Eo;const Ao=({message:e,isStreaming:t=!1,doriMessageIndex:n,isAfterProducts:r=!1})=>{const o=se(),{isTestMode:a,enterFocusMode:i,productFocusEnabled:s}=ie(),l=tn("colors","primary"),c=Re(l),d=function(e){const t=Date.now()-new Date(e).getTime()<2e3,[n,r]=q.useState(!t);return q.useEffect(()=>{if(!t)return;const e=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(e)},[t]),n}(e.timestamp),u=function(e,t){const n=q.useRef(e),r=q.useRef(t?0:e.length),[o,a]=q.useState(t?"":e),i=q.useRef(null),s=q.useRef(t);n.current=e,s.current=t;const l=q.useCallback(()=>{const e=n.current,t=e.length-r.current;if(t<=0||!s.current)return void(i.current=null);const o=Math.max(1,Math.ceil(.12*t));r.current=Math.min(e.length,r.current+o),a(e.slice(0,r.current)),r.current<e.length?i.current=requestAnimationFrame(l):i.current=null},[]),c=q.useCallback(()=>{null===i.current&&(i.current=requestAnimationFrame(l))},[l]),d=q.useCallback(()=>{null!==i.current&&(cancelAnimationFrame(i.current),i.current=null)},[]);return q.useEffect(()=>(t?r.current<e.length&&c():(d(),r.current=e.length,a(e)),d),[t]),q.useEffect(()=>{t&&r.current<e.length&&c()},[e,t,c]),o}(e.content,t);if("welcome"===e.type)return O.jsx(Qr,{message:e.content});if("loading"===e.type)return e.content&&O.jsx(Qr,{message:e.content,type:"loading"});if("user"===e.type)return O.jsxs(ae,{maxW:o.length(220),alignSelf:"flex-end",mb:o.space(2),children:[e.imageUrl&&O.jsx(ae,{w:o.length(120),h:o.length(120),mb:o.space(2),borderRadius:o.radius(12),background:c,children:O.jsx(de,{src:e.imageUrl,alt:"Uploaded image",w:"100%",h:"100%",borderRadius:o.radius(12),objectFit:"cover"})}),(e.content.length>0||e.repliedProduct)&&O.jsxs(ge,{bg:"lightBackground",borderRadius:o.radius(24),px:o.space(3),py:o.space(2),gap:o.space(2),alignItems:"start",w:"full",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:[e.repliedProduct&&(()=>{const t=e.repliedProduct,n=s&&null!=t.id,r=()=>i(t,"replied_chip");return O.jsxs(ue,{bg:"background",borderRadius:o.radius(12),p:o.space(2),gap:o.space(2),w:"full",...n&&{role:"button",tabIndex:0,cursor:"pointer","aria-label":t.name,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())},_hover:{bg:"veryLightBackground"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"background 0.15s"},children:[O.jsx(de,{src:t.image,alt:"product",w:o.length(40),h:o.length(40),objectFit:"cover",onLoad:Qe,borderRadius:o.radius(8)}),O.jsx(fe,{fontSize:o.font(12),fontWeight:"400",color:"text",children:t.name})]})})(),O.jsx(q.Suspense,{fallback:O.jsx(Co,{variant:"user",children:e.content}),children:O.jsx(jo,{variant:"user",children:e.content})})]})]});if("products"===e.type)return O.jsx(ae,{maxW:"100%",alignSelf:"flex-start",mb:o.space(4),w:"full",opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:O.jsx(mo,{products:e.products||[],shape:e.shape})});if("suggestions"===e.type)return O.jsx(xo,{suggestions:e.suggestions||[],options:e.optionChips});if("follow_up"===e.type&&e.followUp)return O.jsx(Je,{message:e});if("handover"===e.type&&e.handover)return O.jsx($e,{message:e});if("email_signup"===e.type&&e.emailSignup)return O.jsx(et,{message:e});if("team"===e.type)return O.jsx(tt,{message:e});if("handover_event"===e.type&&e.handoverEvent)return O.jsx(nt,{message:e});if("dori"===e.type&&!e.content?.trim()&&!t&&!e.showCartSummary)return null;const p="undefined"!=typeof document&&"true"===document.querySelector("script#dori-side-widget")?.getAttribute("data-hide-ratings"),f=a&&!p&&"dori"===e.type&&!t,h=Ge(o,r&&!t?{base:"14px",md:"13px"}:{base:"15px",md:"14px"});return O.jsxs(ge,{align:"stretch",gap:o.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[(!!u?.trim()||t)&&O.jsx(ae,{w:"full",alignSelf:"flex-start",children:O.jsx(q.Suspense,{fallback:O.jsx(Co,{variant:"dori",textSize:h,children:u}),children:O.jsx(jo,{variant:"dori",textSize:h,children:u})})}),e.showCartSummary?O.jsx(vo,{add:e.closerAdd}):e.showCartActions&&O.jsx(yo,{}),f&&void 0!==n&&O.jsx(ko,{messageIndex:n,feedback:e.feedback})]})},Ro=e=>O.jsx(Xe,{label:"message",fallback:e.message?.content?O.jsx(Co,{variant:"user"===e.message.type?"user":"dori",children:e.message.content}):null,children:O.jsx(Ao,{...e})}),_o=({product:e,messages:t})=>{const n=se(),{enterFocusMode:r}=ie(),{t:o}=le(),a=t.filter(e=>"user"===e.type||"products"===e.type||"dori"===e.type&&(!!e.content?.trim()||e.showCartSummary)).length,i=1===a?o("productChatMessageOne"):o("productChatMessages").replace("{count}",String(a)),s=()=>r(e,"chat_card");return O.jsxs(ue,{role:"button",tabIndex:0,"aria-label":`${e.name} · ${i}`,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())},mt:n.space(1),mb:n.space(1),px:n.space(3),py:n.space(2.5),gap:n.space(2.5),align:"center",border:"1.5px solid",borderColor:"borderColor",borderRadius:n.radius(14),bg:"background",cursor:"pointer",_hover:{borderColor:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"border-color 0.15s",children:[e.image&&O.jsx(de,{src:e.image,alt:"",w:n.length(36),h:n.length(36),objectFit:"cover",onLoad:Qe,borderRadius:n.radius(8),flexShrink:0,bg:"lightBackground"}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:n.font(12.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:e.name}),O.jsxs(fe,{fontSize:n.font(11),color:"mutedText",fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[o("productChatLabel")," · ",i]})]}),O.jsx(Bn,{boxSize:n.length(13),color:"mutedText",flexShrink:0})]})},To=["product_click","add_to_cart","exit_intent"];function Wo(e){const t=(e?.fields??[]).filter(e=>"phone"===e||"email"===e);return Array.from(new Set(t))}const Io="dori-lead-settled-",Lo="dori-lead-asks-";function Mo(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch{return null}}function Bo(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch{}}function Fo(e){e&&Bo(`${Io}${e}`,"1")}function Do(e){if(!e)return 0;const t=Number.parseInt(Mo(`${Lo}${e}`)??"",10);return Number.isFinite(t)&&t>0?t:0}const Ho=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.trim()),Po=({threadId:e,fields:t,rule:n,message:r,note:o,onSettled:a})=>{const i=se(),{isMobile:s}=ye(),{t:l}=le(),[c,d]=q.useState(!1),[u,p]=q.useState({phone:"",email:""}),[f,h]=q.useState(!1),[g,m]=q.useState(!1);q.useEffect(()=>{const e=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(e)},[]),q.useEffect(()=>{if(!g)return;const e=setTimeout(a,2500);return()=>clearTimeout(e)},[g,a]);const b=q.useMemo(()=>{return{phone:t.includes("phone")&&(e=u.phone,(e.match(/\d/g)||[]).length>=6)?u.phone:void 0,email:t.includes("email")&&Ho(u.email)?u.email:void 0};var e},[t,u]),x=Boolean(b.phone||b.email),y=async()=>{!f&&x&&(h(!0),Fo(e),await w(e,{...b,trigger:n.trigger}),h(!1),m(!0))},v=e=>l("phone"===e?"leadPromptPhonePlaceholder":"leadPromptEmailPlaceholder");return O.jsx(ae,{flexShrink:0,opacity:c?1:0,transform:c?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",borderWidth:"1px",borderColor:"border",borderRadius:i.radius(10),bg:"veryLightBackground",px:i.space(2.5),py:i.space(2),"data-dori-lead-capture":n.trigger,children:g?O.jsx(fe,{fontSize:i.font(12),color:"text",fontFamily:pe,children:l("leadPromptSaved")}):O.jsxs(ge,{align:"stretch",gap:i.space(1.5),children:[O.jsx(fe,{fontSize:i.font(12),lineHeight:"1.35",color:"text",fontFamily:pe,children:n.message||r||l("leadPromptText")}),O.jsxs(ue,{gap:i.space(1.5),wrap:"wrap",align:"center",children:[t.map(e=>O.jsx(je,{value:u[e],onChange:t=>p(n=>({...n,[e]:t.target.value})),onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:v(e),"aria-label":v(e),type:"phone"===e?"tel":"email",inputMode:"phone"===e?"tel":"email",autoComplete:"phone"===e?"tel":"email",fontSize:s?me(i,16):i.font(13),color:"text",bg:"background",borderColor:"border",borderRadius:i.radius(8),flex:"1 1 8rem",minW:"8rem",height:i.length(32),px:i.space(2.5),py:0,_placeholder:{color:"mutedText"},_focus:{borderColor:"primary",boxShadow:"none"}},e)),O.jsx(ee,{size:"sm",flexShrink:0,borderRadius:i.radius(8),bg:"primary",color:"buttonText",fontSize:i.font(12),px:i.space(3),height:i.length(32),loading:f,disabled:!x,onClick:y,fontFamily:pe,children:l("leadPromptSave")})]}),O.jsxs(ue,{justify:"space-between",align:"center",gap:i.space(2),children:[O.jsx(fe,{fontSize:i.font(10),lineHeight:"1.3",color:"mutedText",fontFamily:pe,children:o||l("leadPromptNote")}),O.jsx(ee,{size:"sm",variant:"plain",flexShrink:0,fontSize:i.font(11),color:"mutedText",px:0,height:"auto",minH:"auto",py:0,onClick:()=>{Fo(e),a()},fontFamily:pe,children:l("leadPromptSkip")})]})]})})};function qo(){const e=ie(),t=e.botData?.feature_flags?.lead_capture,n=e.chatState.threadId,[r,o]=q.useState(!1),[a,i]=q.useState(null),[s,l]=q.useState(0),[c,d]=q.useState([]),[u,p]=q.useState(0),f=Boolean(t?.enabled),h=q.useMemo(()=>e.messages.filter(e=>"dori"===e.type).length,[e.messages]);q.useEffect(()=>{o(function(e){return!!e&&"1"===Mo(`${Io}${e}`)}(n)),l(Do(n)),d([]),i(null)},[n]);const g=e=>d(t=>t.includes(e)?t:[...t,e]),m=q.useRef(Date.now());q.useEffect(()=>{m.current=Date.now(),p(0)},[e.messages.length]),q.useEffect(()=>{if(!f)return;const e=setInterval(()=>{p(Math.floor((Date.now()-m.current)/1e3))},5e3);return()=>clearInterval(e)},[f]),q.useEffect(()=>{f&&(e.focusedProduct||e.focusModeProduct)&&g("product_click")},[f,e.focusedProduct,e.focusModeProduct]);const b=q.useRef(e.cartItemCount??0);q.useEffect(()=>{if(!f)return;const t=e.cartItemCount??0;t>b.current&&g("add_to_cart"),b.current=t},[f,e.cartItemCount]),q.useEffect(()=>{if(!f)return;if("undefined"==typeof window||"undefined"==typeof document)return;if(window.matchMedia?.("(hover: none)")?.matches)return;const e=e=>{e.clientY<=0&&g("exit_intent")};return document.addEventListener("mouseout",e),()=>document.removeEventListener("mouseout",e)},[f]);const x=function(e,t){if(!e?.enabled)return null;if(!t.hasThread||t.settled||t.busy)return null;const n=e.fields??[],r=e.rules??[];if(0===n.length||0===r.length)return null;const o=e.max_asks??1;return t.asksUsed>=o?null:r.find(e=>function(e,t){switch(e.trigger){case"conversation_start":return!0;case"after_turns":return t.botTurns>=(e.value??1);case"idle":return t.botTurns>0&&t.idleSeconds>=(e.value??45);default:return!!To.includes(e.trigger)&&t.firedEvents.includes(e.trigger)}}(e,t))??null}(t,{botTurns:h,idleSeconds:u,firedEvents:c,asksUsed:s,settled:r,hasThread:Boolean(n),busy:e.anySheetOpen||"generating"===e.inputState||!!e.handover});q.useEffect(()=>{!r&&!a&&x&&n&&(i(x),l(function(e){if(!e)return 0;const t=Do(e)+1;return Bo(`${Lo}${e}`,String(t)),t}(n)))},[x,a,r,n]);const y=function(e,t,n){return n?null:e??t}(a,x,r);return{rule:y,threadId:n,fields:Wo(t),message:t?.message,note:t?.note,settle:()=>{i(null),o(!0)}}}const Oo=({chat:e,t:t})=>{const n=se(),[r,o]=q.useState(!1);return q.useEffect(()=>{const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),O.jsxs(ue,{role:"status","aria-live":"polite",flexShrink:0,justify:"space-between",align:"center",px:n.space(3),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderLeft:"3px solid",borderLeftColor:"primary",fontSize:n.font(13),opacity:r?1:0,transform:r?"translateY(0)":"translateY(8px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[O.jsx(fe,{color:"mutedText",fontSize:n.font(13),lineClamp:1,flex:1,children:"remove"===e.cartUndoState.operation?t("cartUndoRemoved").replace("{product}",e.cartUndoState.productName):t("cartUndoQuantityChanged").replace("{product}",e.cartUndoState.productName)}),O.jsxs(ue,{gap:n.space(1),children:[O.jsx(ee,{size:"xs",variant:"ghost",color:"primary",fontWeight:"600",fontSize:n.font(13),onClick:e.handleCartUndo,_hover:{bg:"transparent",opacity:.7},px:n.space(2),minW:"auto",children:t("cartUndoButton")}),O.jsx(fn,{size:"xs",variant:"ghost","aria-label":"Dismiss",onClick:e.dismissCartUndo,color:"mutedText",_hover:{bg:"transparent",opacity:.7},minW:"auto",h:"auto",p:n.space(.5),children:O.jsx(wn,{boxSize:n.length(12)})})]})]})},No=({header:e})=>{const t=ie(),n=rt(t.handover),r=t.messages[t.messages.length-1],o=!!t.handover&&"user"===r?.type&&null!==t.handoverTeamReadAt&&t.handoverTeamReadAt>=new Date(r.timestamp).getTime(),{botData:a}=t,{t:i,translations:c}=le(),d=s(a,c),{isMobile:u}=ye(),p=qo(),f=se(),h=Ie(u?1:Le(t.botData).width),g=q.useRef(null),m=q.useRef(!0),b=q.useRef(!1),x=q.useRef(0),y=q.useCallback(()=>{if(b.current)return void(b.current=!1);if(Date.now()-x.current>3e3)return;const e=g.current;if(!e)return;const n=e.scrollHeight-e.scrollTop-e.clientHeight<80;n!==m.current&&(m.current=n,t.setAutoScrollEnabled(n))},[t.setAutoScrollEnabled]);q.useEffect(()=>{const e=g.current;e&&(t.handoverTeamTyping||o)&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&k(t.messagesEndRef.current)},[t.handoverTeamTyping,o,t.messagesEndRef]);const v=q.useRef(null),w=q.useRef(null),C=q.useCallback(e=>{const t=g.current,n=t?.querySelector(`[data-turn-anchor="${e}"]`),r=n?.firstElementChild??null;if(!t||!r)return!0;const o=()=>r.getBoundingClientRect().top-t.getBoundingClientRect().top-4,a=o();if(Math.abs(a)<=1)return!0;const i=t.scrollTop;return b.current=!0,t.scrollTop=i+a,t.scrollTop===i&&(b.current=!1),Math.abs(o())<=1},[]);q.useEffect(()=>{const e=t.answerAnchorTurnRef.current;if(e&&v.current!==e){const n=t.messages,r=n.findIndex(t=>"user"===t.type&&t.id===e);(-1===r?void 0:n.slice(r+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))&&(v.current=e,t.setAutoScrollEnabled(!1),m.current=!1,w.current=e)}const n=w.current;n&&C(n)&&(w.current=null)},[t.messages,t.answerAnchorTurnRef,t.setAutoScrollEnabled,C]),q.useEffect(()=>{const e=g.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>{const e=w.current;e&&C(e)&&(w.current=null)});for(const n of Array.from(e.children))t.observe(n);return()=>t.disconnect()},[C]);const j=q.useCallback(()=>{x.current=Date.now(),w.current=null},[]),S=q.useRef(0),z=null!=t.focusModeProduct,E=q.useRef(z);q.useLayoutEffect(()=>{const e=g.current,n=E.current;E.current=z,e&&(!n&&z?S.current=e.scrollTop:n&&!z&&(t.setAutoScrollEnabled(!1),m.current=!1,e.scrollTop=S.current))},[z,t.setAutoScrollEnabled]);const[A,R]=Me(),_=tn("colors","primary"),T=Re(_),W=q.useMemo(()=>{if(!t.chatState.isRequestInProgress)return null;if(t.messages.some(e=>"loading"===e.type))return null;for(let e=t.messages.length-1;e>=0;e--)if("dori"===t.messages[e].type)return t.messages[e].id;return null},[t.chatState.isRequestInProgress,t.messages]),I=q.useMemo(()=>{const e=[];for(const n of t.messages){const t=n.focusProductId;if(null!=t){const r=e[e.length-1];if(r&&"productChat"===r.kind&&r.tagId===t){r.messages.push(n);continue}e.push({kind:"productChat",tagId:t,product:null,messages:[n]});continue}e.push({kind:"msg",msg:n})}return e.flatMap(e=>{if("productChat"!==e.kind)return[e];const t=e.messages.find(t=>"user"===t.type&&t.repliedProduct&&String(t.repliedProduct.id)===e.tagId)?.repliedProduct??e.messages.find(e=>"user"===e.type&&e.repliedProduct)?.repliedProduct??null;return t?[{...e,product:t}]:e.messages.map(e=>({kind:"msg",msg:e}))})},[t.messages]),L=q.useMemo(()=>{const e=new Map;let n=0;for(const r of t.messages)"dori"===r.type&&e.set(r.id,n++);return e},[t.messages]);return O.jsxs(O.Fragment,{children:[e,d&&O.jsx(fe,{fontWeight:"600",fontStyle:"normal",fontSize:f.isMini?f.font(24):`${h.greetingFontPx}px`,letterSpacing:"0",w:"fit-content",transition:"opacity 0.5s ease",fontFamily:pe,css:{background:T,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:d}),O.jsxs(ge,{flex:1,justify:"center",align:"stretch",gap:f.space(h.sectionGap),minH:0,transition:"opacity 0.5s ease",opacity:1,children:[O.jsx(ae,{ref:g,flex:1,overflowY:"scroll",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",onScroll:y,onWheel:j,onTouchStart:j,onTouchMove:j,onPointerDown:j,onKeyDown:j,css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:O.jsxs(ge,{overscrollBehavior:"contain",gap:f.space(2),align:"stretch",pb:f.space(2),children:["live"===t.handover?.state&&O.jsx(ot,{card:t.handover}),O.jsx(Xe,{label:"message-list",children:I.reduce((e,t)=>{if("productChat"===t.kind)return e.elements.push(O.jsx(_o,{product:t.product,messages:t.messages},`product-chat-${t.messages[0].id}`)),e.prevType="productChat",e;const n=t.msg,r="dori"===n.type,o=r&&"products"===e.prevType,a=O.jsx(Ro,{message:n,isStreaming:n.id===W,doriMessageIndex:r?L.get(n.id):void 0,isAfterProducts:o},n.id);return e.elements.push("user"===n.type?O.jsx("div",{"data-turn-anchor":n.id,style:{display:"contents"},children:a},n.id):a),e.prevType=n.type,e},{elements:[],prevType:""}).elements},I.length),t.handoverTeamTyping&&O.jsx(at,{card:t.handover}),o&&O.jsx(it,{}),O.jsx("div",{ref:t.messagesEndRef,style:{height:"1px"}})]})}),t.cartUndoState&&O.jsx(Oo,{chat:t,t:i}),A&&!t.anySheetOpen&&O.jsx(Zr,{chips:[A],onChipClick:e=>{l("offer_guide_chat_opened",{from:"chat"}),R(),Fe(e).then(n=>t.sendMessage({message:e,apiMessage:n}))},onDismiss:()=>{Be(),R()}}),p.rule&&p.threadId&&O.jsx(Po,{threadId:p.threadId,fields:p.fields,rule:p.rule,message:p.message,note:p.note,onSettled:p.settle}),O.jsx(ae,{flexShrink:0,bg:"transparent",borderRadius:f.radius(12),transition:"all 0.2s ease",onInput:t.noteHandoverTyping,children:O.jsx(Qn,{state:t.inputState,placeholder:"generating"===t.inputState?i("processing"):"live"===t.handover?.state?i("handoverMessagePlaceholder").replace("{team}",n):t.focusedProduct?i("askAboutProduct"):i("whatsYourQuestion"),onSend:t.isInputDisabled?void 0:t.sendMessage,onStop:t.stopCurrentRequest})})]})]})};function Yo(e){return{position:"fixed",transition:"all 0.5s ease",visibility:e?"visible":"hidden",opacity:e?1:0,bgColor:"background",zIndex:1e6,overflow:"hidden",willChange:"transform",pointerEvents:e?"auto":"none",overscrollBehavior:"contain",touchAction:"pan-x pan-y"}}const Vo=({children:e,showSuggestionScreen:t,isOpen:n,isExpanded:r=!1,onClose:o})=>{const{isMobile:a}=ye(),{botData:i}=ie(),s=q.useRef(null),l=i?.customization?.position?.align??"right",c=Le(i),d=ft(c.width,c.height),u=dt(i),p=Ie(a?1:c.width),f=ut(pt(i,a)),h=tn("colors","borderColor"),g=!0===i?.feature_flags?.panel_drawer,m=(b={isMobile:a,mobileScale:u,isOpen:n,isExpanded:r,isDrawer:g,align:l,panel:d,borderColor:h}).isMobile?function(e){const{isOpen:t,mobileScale:n}=e,r=n<1;return{...Yo(t),top:r?"auto":"0",left:"0",right:"0",bottom:"0",width:"auto",maxWidth:"100vw",height:r?`min(100dvh, max(${Math.round(100*n)}dvh, ${lt}px))`:"auto",border:"none",borderRadius:r?`${st}px ${st}px 0px 0px`:"0px",boxShadow:r?"0px -6px 24px rgba(0, 0, 0, 0.12)":"none",transform:t?"translateY(0)":"translateY(100vh)"}}(b):b.isDrawer?function(e){const{isOpen:t,align:n,panel:r}=e;return{...Yo(t),top:"0",left:"left"===n?"0":"auto",right:"right"===n?"0":"auto",bottom:"0",width:r.width,maxWidth:"100vw",height:"100dvh",border:"none",borderRadius:"0px",boxShadow:"right"===n?"-8px 0px 28px rgba(0, 0, 0, 0.14)":"8px 0px 28px rgba(0, 0, 0, 0.14)",transform:t?"translateX(0)":"right"===n?"translateX(100%)":"translateX(-100%)"}}(b):function(e){const{isOpen:t,isExpanded:n,align:r,panel:o,borderColor:a}=e,i=n?"50%":"20px";return{...Yo(t),top:"50%",left:"left"===r?i:"auto",right:"right"===r?i:"auto",bottom:"auto",width:n?o.expandedWidth:o.width,maxWidth:`calc(100vw - ${2*ct}px)`,height:n?o.expandedHeight:o.height,border:`1px solid ${a}`,borderRadius:"24px",boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",transform:t?n?"right"===r?"translate(50%, -50%)":"translate(-50%, -50%)":"translateY(-50%)":n?"right"===r?"translate(50%, -50%) translateX(120%)":"translate(-50%, -50%) translateX(-120%)":"right"===r?"translateY(-50%) translateX(120%)":"translateY(-50%) translateX(-120%)"}}(b);var b;return(({containerRef:e,isOpen:t,showSuggestionScreen:n})=>{q.useEffect(()=>{if(!t||!e.current)return;const n=e.current,r=e=>{if(e.scrollHeight<=e.clientHeight+1)return!1;const t=getComputedStyle(e).overflowY;return"auto"===t||"scroll"===t},o=e=>{e.preventDefault(),e.stopPropagation();const t=(e=>{let t=e.composedPath?.()[0]??e.target;for(;t&&t!==n;){if(t instanceof HTMLElement&&r(t))return t;t=t.parentElement}return null})(e)||n.querySelector('[data-scroll-container="sheet"]')||n.querySelector('[data-scroll-container="focus-mode"]')||n.querySelector('[data-scroll-container="chat-messages"]');t&&(t.scrollTop+=e.deltaY)};return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,n])})({containerRef:s,isOpen:n,showSuggestionScreen:t}),q.useEffect(()=>{const e=s.current;if(!e)return;const t=e=>e.preventDefault();return e.addEventListener("gesturestart",t,{passive:!1}),e.addEventListener("gesturechange",t,{passive:!1}),()=>{e.removeEventListener("gesturestart",t),e.removeEventListener("gesturechange",t)}},[]),q.useEffect(()=>{if(!n||!g||a||!o)return;const e=e=>{"Escape"===e.key&&setTimeout(()=>{e.defaultPrevented||o()},0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n,g,a,o]),O.jsxs(O.Fragment,{children:[!a&&g&&O.jsx(ae,{"data-dori-drawer-backdrop":"","aria-hidden":"true",position:"fixed",top:"0",left:"0",right:"0",bottom:"0",bgColor:"rgba(0, 0, 0, 0.4)",zIndex:1e6,opacity:n?1:0,visibility:n?"visible":"hidden",pointerEvents:n?"auto":"none",transition:"opacity 0.3s ease, visibility 0.3s ease",onClick:o}),O.jsx(ae,{ref:s,...m,children:O.jsxs(ge,{p:f.space(p.padding),pb:f.space(p.paddingBottom),h:"full",justify:"flex-start",align:"stretch",gap:f.space(p.contentGap),children:[e,!t&&O.jsx(ae,{transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:O.jsx(rr,{variant:"default"})})]})})]})},Uo=/colo|couleur|farbe|màu|colore|kleur/i,Zo=({variantSummary:e})=>{const t=se();if(!e?.options?.length)return null;const{options:n}=e,r=n.find(e=>Uo.test(e.name||"")||no(e)),o=r?(()=>{const e=new Set(r.values.map(e=>e.image).filter(Boolean)).size>1,n=r.values.slice(0,6),o=r.values.length-n.length;return O.jsxs(ue,{gap:t.space(1),align:"center",wrap:"wrap",children:[n.map((n,r)=>{const o=!1===n.available,a=eo(n.value,n.swatch);return e&&n.image?O.jsx(ae,{position:"relative",title:n.value,w:t.length(16),h:t.length(16),borderRadius:t.radius(4),backgroundImage:`url(${n.image})`,backgroundSize:"cover",backgroundPosition:"center",border:"0.5px solid rgba(0,0,0,0.15)",opacity:o?.35:1,flexShrink:0,children:o&&O.jsx(ae,{position:"absolute",top:t.length(7),left:"-2px",w:t.length(20),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):a?O.jsx(ae,{position:"relative",title:n.value,w:t.length(15),h:t.length(15),borderRadius:"full",bg:a,border:"0.5px solid rgba(0,0,0,0.2)",opacity:o?.35:1,flexShrink:0,children:o&&O.jsx(ae,{position:"absolute",top:t.length(7),left:"-1px",w:t.length(17),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):O.jsx(fe,{fontSize:t.font(10),px:t.space(1.5),py:t.space(.5),borderRadius:t.radius(6),border:"0.5px solid",borderColor:"borderColor",color:"mutedText",opacity:o?.5:1,textDecoration:o?"line-through":"none",whiteSpace:"nowrap",title:n.value,fontFamily:pe,children:n.value},r)}),o>0&&O.jsxs(fe,{fontSize:t.font(11),color:"mutedText",fontFamily:pe,children:["+",o]})]})})():null,a=(r?n.filter(e=>e!==r):n).map(e=>{const n=e.values.slice(0,4),r=e.values.length-n.length;return O.jsxs(fe,{fontSize:t.font(11),color:"mutedText",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxW:"100%",fontFamily:pe,children:[e.name,":"," ",n.map((e,t)=>O.jsxs(fe,{as:"span",textDecoration:!1===e.available?"line-through":"none",opacity:!1===e.available?.6:1,children:[e.value,t<n.length-1?", ":""]},t)),r>0?`, +${r}`:""]},e.name)});return o||0!==a.length?O.jsxs(ge,{align:"start",gap:t.space(.5),w:"full",children:[o,a]}):null};let Ko=1;const Qo=[];let Go=!1,Xo=0;function Jo(){if(Xo>0)return void Xo--;const e=Qo.pop();e&&e.close()}function $o(e,t){const n=q.useRef(t);n.current=t,q.useEffect(()=>{if(!e)return;const t=function(e){if("undefined"==typeof window||!window.history?.pushState)return null;const t=Ko++;try{window.history.pushState({__dori_layer:t},"")}catch{return null}return Go||(Go=!0,window.addEventListener("popstate",Jo)),Qo.push({id:t,close:e}),t}(()=>n.current());return null!=t?()=>function(e){const t=Qo.findIndex(t=>t.id===e);if(-1!==t){Qo.splice(t,1);try{window.history.state?.__dori_layer===e&&(Xo++,window.history.back())}catch{}}}(t):void 0},[e])}const ea=({slides:e,initialIndex:t,alt:n,onClose:r})=>{const o=se(),a=q.useRef(null),[i,s]=q.useState(t);$o(!0,r),q.useEffect(()=>{const e=a.current;e&&e.clientWidth>0&&t>0&&e.scrollTo({left:t*e.clientWidth})},[]);const l=t=>{const n=a.current;!n||t<0||t>=e.length||(n.scrollTo({left:t*n.clientWidth,behavior:"smooth"}),s(t))},c=q.useRef(null);q.useEffect(()=>{const e=c.current;if(!e)return;const t=e.getRootNode().activeElement;return e.focus({preventScroll:!0}),()=>{t?.isConnected&&t.focus({preventScroll:!0})}},[]),q.useEffect(()=>{document.activeElement===document.body&&c.current?.focus({preventScroll:!0})},[i]);const d=e=>O.jsx(fn,{"aria-label":e<0?"Previous image":"Next image",position:"absolute",top:"50%",...e<0?{left:o.length(10)}:{right:o.length(10)},transform:"translateY(-50%)",zIndex:2,size:"sm",minW:o.length(36),w:o.length(36),h:o.length(36),p:0,borderRadius:"full",bg:"rgba(255,255,255,0.92)",color:"text",border:"1px solid",borderColor:"borderColor",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",_hover:{bg:"white"},onClick:()=>l(i+e),children:e<0?O.jsx(Tn,{boxSize:o.length(14)}):O.jsx(Bn,{boxSize:o.length(14)})});return O.jsxs(ae,{ref:c,tabIndex:-1,role:"dialog","aria-label":n,outline:"none",onKeyDown:e=>{"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(e.preventDefault(),l(i+("ArrowLeft"===e.key?-1:1)))},dir:"ltr",position:"absolute",inset:0,zIndex:60,bg:"rgba(12, 12, 12, 0.94)","data-dori-sheet":"true",children:[O.jsx(fn,{"aria-label":"Close",position:"absolute",top:o.length(10),right:o.length(10),zIndex:2,size:"sm",minW:o.length(34),w:o.length(34),h:o.length(34),p:0,borderRadius:"full",bg:"rgba(255,255,255,0.14)",color:"white",_hover:{bg:"rgba(255,255,255,0.26)"},onClick:r,children:O.jsx(wn,{boxSize:o.length(12)})}),O.jsx(ue,{ref:a,gap:0,w:"full",h:"full",onScroll:()=>{const e=a.current;if(!e||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth);t!==i&&s(t)},onClick:r,css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map(e=>O.jsx(ae,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},h:"full",display:"flex",alignItems:"center",justifyContent:"center",p:4,children:O.jsx(de,{src:e.src,alt:n,w:"100%",h:"auto",maxH:"100%",objectFit:"contain",onClick:e=>e.stopPropagation()})},e.id))}),e.length>1&&i>0&&d(-1),e.length>1&&i<e.length-1&&d(1),e.length>1&&O.jsx(ue,{position:"absolute",bottom:o.length(14),left:"0",right:"0",justify:"center",gap:1.5,pointerEvents:"none",children:e.map((e,t)=>O.jsx(ae,{w:o.length(6),h:o.length(6),borderRadius:"full",bg:t===i?"white":"rgba(255,255,255,0.35)"},`dot-${e.id}`))})]})},ta=/colo|couleur|farbe|màu|colore|kleur/i,na=e=>(e||"").replace(/^https?:/,"").split("?")[0],ra=({onClose:e})=>{const{focusModeProduct:t,focusModeAnchorTs:r,exitFocusMode:o,openVariantModal:a,variantModalProduct:s,addToCartDirect:l,sendMessage:p,stopCurrentRequest:f,botData:h,chatState:g,messages:m,inputState:b,isInputDisabled:x,shortlistEnabled:y,isShortlisted:v,toggleShortlist:w,answerAnchorTurnRef:k,isTestMode:C}=ie(),j=se(),{t:S}=le(),z=t,E=null!=z,A=q.useRef(null),[R,_]=q.useState(!1),[T,W]=q.useState(!1),I=q.useRef(null),L=q.useMemo(()=>"undefined"!=typeof window&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,[]);q.useEffect(()=>{if(!E)return _(!1),void W(!1);const e=requestAnimationFrame(()=>_(!0));return()=>cancelAnimationFrame(e)},[E]),q.useEffect(()=>()=>{I.current&&clearTimeout(I.current)},[]);const M=q.useCallback(e=>{L?o(e):W(t=>t||(I.current=setTimeout(()=>o(e),180),!0))},[L,o]);$o(E,()=>M("back_gesture"));const[B,F]=q.useState(null);q.useEffect(()=>{if(!E)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),null==B?s||M("escape"):F(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E,s,B,M]),q.useEffect(()=>{if(E){const e=requestAnimationFrame(()=>A.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)}},[E]);const[D,H]=q.useState(null),P=z?.url;q.useEffect(()=>{H(null);const e=P?He(P):void 0;if(!e)return;let t=!1;return Pe(e).then(e=>{!t&&e&&H(e)}).catch(()=>{}),()=>{t=!0}},[P]);const N=null!=z?.id?String(z.id):null,Y=q.useMemo(()=>null==N?[]:m.filter(e=>null!=e.focusProductId&&String(e.focusProductId)===N),[m,N]),V=q.useMemo(()=>{if(!g.isRequestInProgress)return null;if(Y.some(e=>"loading"===e.type))return null;for(let e=Y.length-1;e>=0;e--)if("dori"===Y[e].type)return Y[e].id;return null},[g.isRequestInProgress,Y]),U=q.useRef(null),Z=q.useRef(null),K=q.useRef(!1),Q=q.useRef(!1);Q.current=Y.length>0,q.useEffect(()=>{F(null);const e=U.current;Q.current?(K.current=!0,e&&(e.scrollTop=e.scrollHeight)):(K.current=!1,e&&(e.scrollTop=0)),I.current&&(clearTimeout(I.current),I.current=null),W(!1)},[r]);const G=q.useRef(!1),X=q.useCallback(()=>{if(G.current)return void(G.current=!1);const e=U.current;e&&(K.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},[]);q.useEffect(()=>{if(!E)return;const e=U.current,t=Z.current;if(!e||!t)return;const n=new ResizeObserver(()=>{K.current&&(G.current=!0,e.scrollTop=e.scrollHeight)});return n.observe(t),()=>n.disconnect()},[E]);const J=q.useCallback(()=>{K.current=!0;const e=U.current;e&&(G.current=!0,e.scrollTop=e.scrollHeight)},[]),$=q.useRef(null);q.useEffect(()=>{if(!E)return;const e=k.current;if(!e||$.current===e)return;const t=Y.findIndex(t=>"user"===t.type&&t.id===e);if(-1===t)return;if(!Y.slice(t+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))return;$.current=e,K.current=!1;const n=U.current,r=n?.querySelector(`[data-turn-anchor="${e}"]`),o=r?.firstElementChild??null;if(n&&o){const e=o.getBoundingClientRect().top-n.getBoundingClientRect().top;Math.abs(e-4)>1&&(G.current=!0,n.scrollTop+=e-4)}},[E,Y,k]);const te=q.useMemo(()=>z?function(e,t){const n=[],r=new Set,o=(e,t,o)=>{t&&!r.has(na(t))&&(r.add(na(t)),n.push(null!=o?{id:e,src:t,color:o}:{id:e,src:t}))};if(t){const r=(t.options??[]).findIndex(e=>ta.test("string"==typeof e?e:e?.name||""));if(r>=0){const e=new Set;for(const n of t.variants){const t=De(n,r+1);t&&!e.has(t)&&(e.add(t),o(`color:${t}`,n.featured_image?.src,t))}}for(const[e,a]of(t.images??[]).entries()){if(n.length>=8)break;o(`img:${e}`,a)}return 0===n.length&&o("main",e.image),n.slice(0,8)}const a=e.variant_summary?.options?.find(e=>ta.test(e.name||""));if(a?.values?.some(e=>e.image))for(const i of a.values)o(`color:${i.value}`,i.image,i.value);return 0===n.length&&o("main",e.image),n.slice(0,8)}(z,D):[],[z,D]);if(!z)return null;const ne=te[0]?.src||z.image,re=te.length>0?te:ne?[{id:"hero",src:ne}]:[],oe=n(h),ce=(z.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),he=(z.currency||h?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",me=Boolean(z.is_on_sale&&null!=z.sale_price&&z.sale_price>0&&null!=z.price&&z.sale_price<z.price),be=me&&z.sale_price?z.sale_price:z.price,xe=e=>i("focus_path_clicked",{assistantId:h?.assistant_id,threadId:g.threadId,payload:{product_id:z.id,path:e,mode_version:"focused_chat_v2"}}),ye=Ve(z,h),ve=null!==ye,we=(e,t)=>{xe(e),J(),p({message:t,apiMessage:`${t} (product id: ${z.id})`,focusScoped:!0})},ke=!0===h?.feature_flags?.hide_price_check,Ce=(e,t,n)=>O.jsxs(ee,{variant:"outline",h:j.length(40),px:j.space(2),gap:j.space(1.5),fontSize:j.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",borderRadius:j.radius(10),bg:"background",justifyContent:"center",_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},onClick:n,fontFamily:pe,children:[O.jsx(de,{src:e,alt:"",w:j.length(15),h:j.length(15),objectFit:"contain",flexShrink:0}),O.jsx(ae,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),je=v(z.id);return O.jsxs(ae,{position:"absolute",inset:0,zIndex:30,bg:"background","data-dori-sheet":"true","data-focus-mode":"true",transform:R&&!T?"translateX(0)":"translateX(100%)",transition:L?"none":"transform 180ms ease-out",children:[O.jsxs(bn,{direction:"column",h:"full",minH:0,children:[O.jsxs(bn,{align:"center",gap:j.space(2),px:j.space(4),py:j.space(2.5),flexShrink:0,borderBottom:"1px solid",borderColor:"borderColor",bg:"background",children:[O.jsx(fn,{ref:A,"aria-label":S("back"),size:"sm",variant:"ghost",color:"text",borderRadius:"full",minW:j.length(34),w:j.length(34),h:j.length(34),p:j.space(0),flexShrink:0,css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:()=>M("back"),children:O.jsx(Tn,{boxSize:j.length(16)})}),z.image&&O.jsx(de,{src:z.image,alt:z.name,w:j.length(38),h:j.length(38),objectFit:"cover",onLoad:Qe,borderRadius:j.radius(8),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:j.font(13.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:z.name}),O.jsxs(ue,{gap:j.space(1.5),align:"center",children:[me&&null!=z.price&&O.jsx(fe,{fontSize:j.font(11),color:"mutedText",textDecoration:"line-through",fontFamily:pe,children:Ne(z.price,he)}),!!be&&be>0&&O.jsx(fe,{fontSize:j.font(12.5),fontWeight:700,color:"text",fontFamily:pe,children:Ne(be,he)}),z.price_on_request&&O.jsx(fe,{fontSize:j.font(12.5),fontWeight:700,color:"text",fontFamily:pe,children:S("priceOnRequest")}),me&&!!z.sale_percent_off&&O.jsxs(pn,{bg:"errorBackground",color:"error",fontSize:j.font(10),borderRadius:j.radius(12),children:[z.sale_percent_off,"%"]})]})]}),y&&O.jsx(fn,{"aria-label":S(je?"removeSaved":"saveForLater"),size:"sm",variant:"ghost",minW:j.length(34),w:j.length(34),h:j.length(34),p:j.space(0),borderRadius:"full",flexShrink:0,color:je?"primary":"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:()=>w(z),children:je?O.jsx(Mn,{boxSize:j.length(17)}):O.jsx(Ln,{boxSize:j.length(17)})}),e&&O.jsx(fn,{"aria-label":"Close",size:"sm",variant:"ghost",minW:j.length(34),w:j.length(34),h:j.length(34),p:j.space(0),borderRadius:"full",flexShrink:0,color:"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:e,children:O.jsx(wn,{boxSize:j.length(13)})})]}),O.jsx(ae,{ref:U,flex:1,minH:0,overflowY:"auto",overflowX:"hidden",overscrollBehavior:"contain","data-scroll-container":"focus-mode",onScroll:X,px:j.space(4),py:j.space(3),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:O.jsxs(ge,{ref:Z,align:"stretch",gap:j.space(3.5),children:[te.length>1?O.jsx(io,{slides:te,activeColor:null,height:ht(j,"gallery"),bgColor:"lightBackground",alt:z.name,onImageClick:e=>F(e)}):ne&&O.jsx(de,{src:ne,alt:z.name,role:"button",tabIndex:0,w:"full",h:ht(j,"single"),objectFit:"contain",borderRadius:j.radius(12),bg:"lightBackground",cursor:"zoom-in",onClick:()=>F(0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),F(0))}}),!!z.description&&O.jsx(ae,{borderRadius:j.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",px:j.length(10),py:j.length(6),bg:"lightBackground",children:O.jsx(fe,{fontSize:j.font(12.5),color:"text",lineHeight:"1.5",lineClamp:3,fontFamily:pe,children:z.description})}),z.variant_summary&&O.jsx(Zo,{variantSummary:z.variant_summary}),O.jsxs(ge,{align:"stretch",gap:j.space(1.5),children:[O.jsx(fe,{fontSize:j.font(11),fontWeight:600,color:"mutedText",textTransform:"uppercase",letterSpacing:"0.05em",fontFamily:pe,children:S("needHelpDeciding")}),O.jsxs(ae,{display:"grid",gridTemplateColumns:`repeat(${ke?2:3}, minmax(0, 1fr))`,gap:j.space(1.5),children:[Ce("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAY7klEQVR42tV7eZhU1bXvb+29z6mq7oamm0kGBZmEBlESPlEcqmX0xjhCNdg4RqM3GC6+jyRivpdX1PfevZrnM04vajDRvCuiVDnFqBFEoYxjAIkDLYMgqEwNDT1XnXP23uv9UVVNNzQy+fB7h95f0dX77LPWb695rwOc7CsOUfjvihUrwhs3bgx19reTddH38Dy+7Oex07+pr4t7vjeeAA6FQh/0KemWePXRF7YU5pwsgk4e4vG4AICr5szqv7l25zvNQfYGzwZDs1YPaw4y12/Zt/vdqbfNGJibGj9pdMmTuPsS27ZZd0j5vT5MpQ0C7QpnnyLZGujAhRJdfT/bdddnW/+Szs/9/18CmCkWi8loNKoAIJmMu1qbqNGaHek0DT+9YswZp48Y40in2WrNms0FyWTSBYBoNKpisZjESZSG74BhUCwWk8gzfPDlSgdnV1duGRIbxxWx8RuYWTGzGhE7f/2Q2Dg+q7pyiyudztcuAMLfrd36LhajWCwmUkgBKZg2eSeB2C9u7Lujuf4ML9M6wtfBULZ2YFZ7UwMd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OwU3grLD6fdOPh3p5P5He7Nr+mOvia6bsi0c+zw2Hl26uxpI0/0RUuFE+vNsc0mM5IUWQTgQAennD1rwrpRMy5UZ197saVDOsIO7hKjTk4JO07LWU/ikTMuFGOuncCBMWXMZKAkZY0/Gu06v08qAKjMHa65rgqLQEn2NTwblHm+Lus8k6V2Lv1wMQ4dpq3y0MxJKAWlXLc9LScVgHQid7zco6jnK/WNjX9zIkVngckW9i3Xjd0eB8r/HPqOEB3muJw6ygZR7o0eQEJIFp+Vu93+CoDytHx/cQABWPJGstQLSo5o9LrnP+s6+a79VZf/vrm5mUpKSrjwWQcg5Dg0c/KUBvsdvGT+fwEvnYKDff9ehQAAAABJRU5ErkJggg==",S("compareAction"),()=>we("compare",S("compareIntent").replace("{name}",z.name))),Ce("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVVklEQVR42t17e5xU1ZXut/bjnKrqbmleDSrGZHzwEALSiKjgqcZG0RGNSapvANF4o0OuoxF/SjQzv5uyvXeSEJM7xqC5zniTESXj7fpNYpxkFBC6SxBBacCAqIlMIgaFlnd3ddU5Z++97h9VhQ0+iDeho+5/uqpr733OWWfv9X1rfWsD/dyy2awAgAu/MuvzZ1/dtGvivIt2pW+4/At9f+vPRn+J62UfzCYfb2/fHsMNBwBNsuuCM9OnPdDaWqj04/66oX61eCaTEQB49abNjU5gODtn2TnLAg3bd22dBIArffCJNEBXVxcBQKG31MyCGAATgSHBh8Ke5r59PpEGyOfzThAhMmEzW0sEIgBkraPIxBcREfL5vP1kGqDs4FzL7dedZNie7awrX59JsHGIbTxhzsKvjADAyPbfffXbhYKODgEAu/e/PZWUSAKwXHaKxMwWSiZ27usKyn2DT54B8pW/h0qFSxyXnbyvVOgpXWIAzjn0Rr0zACDf0PAJRIF83mzYsEHHxgQuthBKyoTnPelr70mphHTGIjImaGtr85DL2U+UAaoE55uPLDrLgf/KOWuUlpCkf6mF/HehFJzj2IFPfXhNblx/kqJ+uUhHZ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/ORhdV5vJEp+7fBfAaCKgT56h6fb2tr0tx5/4NXQxZ9mBhJKvznvylmn39ZyW+nDHp6u4vnqX357YK3dkekJdee0lvs6q//HR61lMuVE5cybW2ZNnHfRW43XXLS76W9mff7PeVKMP4SQ//8Ae5YJEhPYjogAAAAASUVORK5CYII=",S("similarAction"),()=>we("similar",`${S("doYouHaveSimilar")} ${z.name}`)),!ke&&Ce("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVpElEQVR42s2beZyU1ZX3f+feZ+2NpluaIIYIcUEwEGiNW5yiBRS3OPqmUGlEQG2Zd4S4ZN5ETT5FzRsSEycqkDjayhpc6EokBhRkr2iMII3LCE40ajJJRNmapbue7d575o/qxoZIBFnv59N/dD1PVT2/7z3n3HPPPUXYdzAIBAJgOl4SIBgwJAkoo0kKyU/Pf9rZmmwtXbN2DXvdqkphdMnr729Ej+qeFQZc+uHmD6l7dfduuws7nSCI7PKKii8ooxPLEu+eXNWjeWb25x8CQDqdlrlcTuMYDdrrv0xGIJs1ADBiUv3ZO8MdI6I46SeIugVhQFLKEimt8iAMISQcS9rlcRJDkvBICDfRCYQQDoGkNhpSSjADzAwSBHDxKyXRVt91F/asrLnv1w/84p1jCYE+0Z4R2WzW1N/e0OO/t38wNUjCtCGG4eKfIAlmhjEGQgiAGQyGEALGGAAEIal4nQQAAnPxOjNA7d/E2gDGQDgSEqLthNKKCfnGhfNSqZSVz+fVMQHQIf7G79x68hsfvrsiVHEfHSlNtpDSlkUx2kAICYBhlIYlbRg2iTE6di0HypgCs4lcx+UoiVtsaStHWjqIo22lnq8N8y422lI66ZfA9E+UgjFsXNcR5dK/+ZU5S2bU1tbazc3NydEGQABo6tSp9sw1C14OWQ02SsWWbTuesBaXemWLPcfbum375pZu3WpQYnnB1m1bWk7u8SWKSLXt2r69bcBXBpBo89u8IIjGjh2LL/fpE4IBIoJms3eIYRYXT/zmJR/t2P5QopPTtNaxZVtOCdk3N89bedQhUIfpf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AfvPwvV+e0GtOjKzYAAAAASUVORK5CYII=",S("worthItAction"),()=>we("price_check",S("priceCheckIntent").replace("{name}",z.name)))]}),!!z.url&&O.jsxs(ee,{variant:"outline",h:j.length(40),w:"full",px:j.space(3),fontSize:j.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",bg:"background",justifyContent:"center",gap:j.space(1.5),borderRadius:j.radius(10),onClick:()=>{xe("product_page"),z.url&&h&&(c(z,h,g.threadId),Gr(Gn(z.url),C))},_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},fontFamily:pe,children:[O.jsx(Cn,{boxSize:j.length(13)}),S("productPage")]})]}),Y.length>0&&O.jsx(ge,{align:"stretch",gap:j.space(2),children:Y.reduce((e,t)=>{const n=O.jsx(Ro,{message:t,isStreaming:t.id===V,isAfterProducts:"products"===e.prevType},t.id);return e.elements.push("user"===t.type?O.jsx("div",{"data-turn-anchor":t.id,style:{display:"contents"},children:n},t.id):n),e.prevType=t.type,e},{elements:[],prevType:""}).elements})]})}),O.jsxs(ge,{flexShrink:0,align:"stretch",gap:j.space(2),px:j.space(4),pt:j.space(2.5),borderTop:"1px solid",borderColor:"borderColor",bg:"background",children:[oe&&O.jsxs(ee,{h:j.length(44),borderRadius:j.radius(12),fontSize:j.font(14),fontWeight:600,bg:"primary",color:"buttonText",w:"full",gap:j.space(1.5),onClick:()=>{ye?Gr(ye.href,C):(xe("add"),J(),ce?a(z,"focus_mode"):l({product_id:null!=z.id?String(z.id):void 0,product_name:z.name,product_url:z.url||void 0,product_handle:He(z.url)||void 0,quantity:u(z),quantity_label:d(z)}))},_hover:{opacity:.92},fontFamily:pe,children:[ve?null:O.jsx(In,{boxSize:j.length(16)}),S(ve?ye.labelKey:"addToCartFull")]}),O.jsx(ae,{children:O.jsx(Qn,{state:b,placeholder:S("generating"===b?"processing":"askAboutProduct"),onSend:x?void 0:(e,t)=>(J(),p({message:e.message,imageUrl:e.imageUrl,focusScoped:!0},t)),onStop:f})})]})]}),null!=B&&re.length>0&&O.jsx(ea,{slides:re,initialIndex:Math.min(B,re.length-1),alt:z.name,onClose:()=>F(null)})]})},oa=({open:e,onClose:t,title:n,children:r,onBack:o,footer:a})=>{const i=se(),s=q.useRef(null);return $o(e,o??t),q.useEffect(()=>{if(!e)return;const n=document.activeElement,r=e=>{"Escape"===e.key&&(e.preventDefault(),t())};window.addEventListener("keydown",r);const o=requestAnimationFrame(()=>{const e=s.current?.querySelector("[data-sheet-initial-focus='true']");(e||s.current)?.focus({preventScroll:!0})});return()=>{cancelAnimationFrame(o),window.removeEventListener("keydown",r),n?.focus?.({preventScroll:!0})}},[e,t]),e?O.jsxs(ae,{position:"absolute",inset:0,zIndex:30,"data-dori-sheet":"true",children:[O.jsx(ae,{position:"absolute",inset:0,bg:"blackAlpha.500",onClick:t,"aria-hidden":"true"}),O.jsxs(bn,{ref:s,tabIndex:-1,position:"absolute",bottom:0,left:0,right:0,direction:"column",bg:"background",borderTopRadius:"16px",maxH:"82%",pb:i.space(3),borderTop:"1px solid",borderColor:"borderColor",boxShadow:"0 -8px 24px rgba(0,0,0,0.18)",role:"dialog","aria-modal":"true","aria-label":n||void 0,children:[O.jsx(ae,{w:i.length(36),h:i.length(4),borderRadius:i.radius(2),bg:"borderColor",mx:"auto",mt:i.space(2),mb:i.space(1),flexShrink:0}),O.jsxs(bn,{align:"center",justify:"space-between",px:i.space(4),py:i.space(1),flexShrink:0,gap:i.space(2),children:[O.jsxs(bn,{align:"center",gap:i.space(1.5),minW:0,children:[o&&O.jsx(fn,{"aria-label":"Back",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:o,children:O.jsx(Tn,{boxSize:i.length(13)})}),O.jsx(fe,{fontSize:i.font(14),fontWeight:"600",color:"text",lineHeight:"1.3",fontFamily:pe,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:n||""})]}),O.jsx(fn,{"aria-label":"Close",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:t,children:O.jsx(wn,{boxSize:i.length(10)})})]}),O.jsx(ae,{flex:1,minH:0,overflowY:"auto","data-scroll-container":"sheet",px:i.space(4),pt:i.space(1),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},children:r}),a&&O.jsx(ae,{flexShrink:0,px:i.space(4),pt:i.space(2.5),borderTop:"1px solid",borderColor:"borderColor",children:a})]})]}):null},aa=()=>{const e=se(),{variantModalProduct:t,variantModalSource:n,openVariantModal:r,addToCartDirect:o,botData:a,chatState:s,isTestMode:l}=ie(),{t:c}=le(),d=q.useRef(null),[u,p]=q.useState(null),[f,h]=q.useState(1),[g,m]=q.useState("idle"),[b,x]=q.useState(null),[y,v]=q.useState(null),w=t,k=null!=w?.id?String(w.id):null,C=q.useRef(k);if(q.useEffect(()=>{C.current!==k&&(C.current=k,null!=k&&(p(null),h(1),m("idle"),x(null),v(null)))},[k]),!w)return null;const j=y??w.selected_color??null,S=(j?w.variant_summary?.options?.flatMap(e=>e.values).find(e=>e.value===j&&e.image)?.image:null)||w.image,z=(w.currency||a?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",E=()=>{d.current&&(clearTimeout(d.current),d.current=null),p(null),h(1),m("idle"),x(null),v(null),r(null)},A="focus_mode"===n?E:void 0,R=u?.canAdd??!1,_=u?.priceCents??null,T=null!=_?Ne(_/100*f,z):null,W=gt(e),I=!R&&"added"!==g,L="added"===g?`✓ ${c("addedToCart")}`:R?T?c("addQty").replace("{qty}",String(f)).replace("{price}",T):c("addToCartFull"):c("selectOptionsToContinue"),M=(e,t,n)=>O.jsx(ee,{variant:"ghost",size:"xs",minW:`${W.stepper}px`,h:`${W.stepper}px`,borderRadius:0,fontSize:`${W.stepperFont}px`,color:t?"mutedText":"text",disabled:t||"adding"===g||"added"===g,onClick:n,"aria-label":e,children:e}),B=O.jsxs(ge,{align:"stretch",gap:e.space(1.5),pb:e.space(1),children:[O.jsxs(ue,{gap:e.space(2.5),align:"center",children:[O.jsxs(ue,{gap:e.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:e.radius(10),overflow:"hidden",flexShrink:0,children:[M("−",f<=1,()=>h(e=>Math.max(1,e-1))),O.jsx(fe,{fontSize:`${W.stepperFont}px`,fontWeight:600,minW:`${W.qtyWidth}px`,textAlign:"center",color:"text",fontFamily:pe,children:f}),M("+",f>=10,()=>h(e=>Math.min(10,e+1)))]}),O.jsxs(ee,{flex:1,h:`${W.cta}px`,borderRadius:`${W.ctaRadius}px`,fontSize:`${I?W.ctaHintFont:W.ctaFont}px`,fontWeight:600,bg:"primary",color:"buttonText",gap:e.space(1.5),disabled:!R&&"added"!==g||"adding"===g,loading:"adding"===g,onClick:async()=>{if(!u?.canAdd||"adding"===g||"added"===g)return;m("adding"),x(null);const e=null!=w.id?String(w.id):void 0,t=u.variantId?{variant_id:u.variantId,product_id:e,product_name:w.name,quantity:f}:{product_id:e,product_name:w.name,product_url:w.url,selected_options:u.selectedOptions,quantity:f},n=Ve(w,a);if(n)return void Gr(n.href,l);const r=await o(t);"success"===r.type?(m("added"),i("variant_modal_added",{assistantId:a?.assistant_id,threadId:s.threadId,payload:{product_id:w.id,selected:u.selectedLabel,quantity:f}}),d.current=setTimeout(E,900)):"failed"===r.type&&"busy"===r.reason?m("idle"):(m("error"),x(Ue(r,c)||null))},_hover:{opacity:.92},fontFamily:pe,"data-sheet-initial-focus":"true",children:[O.jsx(In,{boxSize:`${W.ctaIcon}px`,flexShrink:0}),O.jsx(ae,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:L})]})]}),"error"===g&&O.jsx(fe,{fontSize:e.font(11),color:"error",fontFamily:pe,children:b||c("errorOccurred")})]});return O.jsx(oa,{open:!0,onClose:E,onBack:A,title:c("chooseOptions"),footer:B,children:O.jsxs(ge,{align:"stretch",gap:e.space(3),pb:e.space(2),children:[O.jsxs(ue,{gap:e.space(2.5),align:"center",children:[S&&O.jsx(de,{src:S,alt:w.name,w:e.length(52),h:e.length(52),objectFit:"cover",onLoad:Qe,borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground"}),O.jsxs(ae,{minW:0,children:[O.jsx(fe,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:w.name}),O.jsx(fe,{fontSize:e.font(12),color:"mutedText",fontFamily:pe,children:u?.selectedLabel||(w.price?Ne(w.price,z):"")})]})]}),O.jsx(oo,{product:w,controlled:!0,selectedColor:j,onColorChange:v,onSelectionChange:e=>{p(e),"error"===g&&(m("idle"),x(null))}},String(w.id))]})})},ia=()=>{const e=se(),{shortlist:t,removeFromShortlist:n,shortlistOpen:r,setShortlistOpen:o,enterFocusMode:a,sendMessage:s,botData:l,chatState:c}=ie(),{t:d}=le();if(q.useEffect(()=>{r&&i("shortlist_opened",{assistantId:l?.assistant_id,threadId:c.threadId,payload:{count:t.length}})},[r]),!r)return null;const u=()=>o(!1),p=(e,t)=>{const n=(t||l?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD";return Ne(e,n)},f=t.length>=2?O.jsx(ee,{w:"full",h:e.length(40),borderRadius:e.radius(12),fontSize:e.font(14),fontWeight:600,bg:"primary",color:"buttonText",onClick:()=>{const e=t.map(e=>e.name).join(", "),n=t.map(e=>e.id).join(", "),r=d("compareSavedIntent").replace("{names}",e);i("shortlist_compare_clicked",{assistantId:l?.assistant_id,threadId:c.threadId,payload:{count:t.length}}),u(),s({message:r,apiMessage:`${r} (product ids: ${n})`})},_hover:{opacity:.92},fontFamily:pe,children:d("compareSaved").replace("{count}",String(t.length))}):void 0;return O.jsx(oa,{open:!0,onClose:u,title:d("savedProducts"),footer:f,children:O.jsxs(ge,{align:"stretch",gap:e.space(1.5),pb:e.space(2),children:[0===t.length&&O.jsx(fe,{fontSize:e.font(13),color:"mutedText",textAlign:"center",py:e.space(6),fontFamily:pe,children:d("savedEmpty")}),t.map(t=>O.jsxs(ue,{gap:e.space(2.5),align:"center",p:e.space(1.5),borderRadius:e.radius(12),cursor:"pointer",onClick:()=>{u(),a(t,"shortlist")},_hover:{bg:"lightBackground"},transition:"background 0.15s",children:[t.image&&O.jsx(de,{src:t.image,alt:t.name,w:e.length(44),h:e.length(44),objectFit:"cover",onLoad:Qe,borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),O.jsxs(ae,{minW:0,flex:1,children:[O.jsx(fe,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:pe,children:t.name}),!!t.price&&t.price>0&&O.jsx(fe,{fontSize:e.font(12),color:"mutedText",fontFamily:pe,children:p(t.price,t.currency)}),t.price_on_request&&O.jsx(fe,{fontSize:e.font(12),color:"mutedText",fontFamily:pe,children:d("priceOnRequest")})]}),O.jsx(fn,{"aria-label":d("removeSaved"),size:"xs",variant:"ghost",minW:e.length(28),w:e.length(28),h:e.length(28),p:e.space(0),borderRadius:"full",color:"primary",css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:e=>{e.stopPropagation(),n(t.id)},children:O.jsx(Mn,{boxSize:e.length(14)})})]},String(t.id)))]})})},sa=({isOpen:n,onClose:r,isExpanded:o=!1,onToggleExpand:a,fullPageHref:i,pendingChat:s,onPendingChatConsumed:l})=>{const{sendMessage:c,addWelcomeMessage:d,resetBot:u,chatState:p,focusedProduct:f,isInputDisabled:h}=ie(),{showSuggestionScreen:g,goToChat:m,goToSuggestion:b}=(n=>{const[r,o]=q.useState(!0),a=q.useRef(!1),i=q.useRef(!1);return q.useEffect(()=>{if(!i.current){const n=e();t()&&n.length>0&&(a.current=!0,o(!1),console.log("Skipping welcome screen - existing messages found:",n.length)),i.current=!0}},[]),q.useEffect(()=>{n&&!a.current?o(!0):n&&a.current&&o(!1)},[n]),{showSuggestionScreen:r,goToChat:q.useCallback(()=>{a.current=!0,o(!1)},[]),goToSuggestion:q.useCallback(()=>{a.current=!1,o(!0)},[])}})(n);q.useEffect(()=>{g&&(p.isRequestInProgress||f)&&m()},[g,p.isRequestInProgress,f,m]);const{isMobile:x}=ye(),y=q.useRef(!1);q.useEffect(()=>{n&&!y.current&&(C(),y.current=!0)},[n]);const v=x,w=(e,t,n)=>{m(),d(),c({message:e,imageUrl:t,apiMessage:n})};q.useEffect(()=>{if(n&&s&&!h){const e=setTimeout(()=>{w(s.message,s.imageUrl,s.apiMessage),l?.()},100);return()=>clearTimeout(e)}},[n,s,h]);return O.jsxs(Vo,{showSuggestionScreen:g,isOpen:n,isExpanded:o,onClose:r,children:[g?O.jsx(Kr,{onStartChat:w,isMobile:v,isExpanded:o,onToggleExpand:a,fullPageHref:i,onClose:r}):O.jsx(No,{header:O.jsx(Pn,{onClose:r,isMobile:v,isExpanded:o,onToggleExpand:a,fullPageHref:i,onReload:()=>{u(),b()}})}),O.jsx(ra,{onClose:r}),O.jsx(aa,{}),O.jsx(ia,{})]})};function la(e,t=!1){const n=e?.feature_flags,r=(t?n?.mobile_fab_scale:void 0)??n?.fab_scale??e?.customization?.avatar_fab_scale;return"number"==typeof r&&Number.isFinite(r)?Math.min(1.5,Math.max(.4,r)):1}const ca="0 6px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06)",da={size:"xs",flexShrink:0,h:"32px",px:3,borderRadius:"full",bg:"primary",color:"buttonText",fontSize:"12px",fontWeight:600,fontFamily:pe,whiteSpace:"nowrap",transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},ua=q.forwardRef(function({icon:e,children:t,action:n,actionBelow:r=!1,onClose:o,closeLabel:a,maxW:i},s){return O.jsxs(ue,{ref:s,gap:2,align:r?"flex-start":"center",maxW:i,minH:"44px",py:r?2.5:1.5,ps:3,pe:1,bg:"background",borderRadius:"22px",border:"1px solid",borderColor:"borderColor",boxShadow:ca,children:[O.jsx(ae,{flexShrink:0,display:"flex",color:"primary",mt:r?"2px":0,children:e}),O.jsxs(ae,{flex:"1",minW:0,children:[t,r&&n?O.jsx(ae,{mt:2,children:n}):null]}),r?null:n,O.jsx(fn,{size:"xs",variant:"ghost","aria-label":a,onClick:o,flexShrink:0,w:"28px",minW:"28px",h:"28px",borderRadius:"full",color:"text",opacity:.55,transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:O.jsx(wn,{boxSize:"12px"})})]})}),pa=()=>!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function fa(e,t,n,r){const o=q.useRef(null),a=q.useRef(r);a.current=r;const i=q.useRef(n);return i.current=n,q.useEffect(()=>{if(!e)return;o.current?.focus({preventScroll:!0});const n=e=>{const n=o.current;if(!n)return;if("Escape"===e.key)return t&&e.stopPropagation(),void i.current();if(!t||"Tab"!==e.key)return;const r=Array.from(n.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])')),a=function(e){return e.getRootNode().activeElement??null}(n),s=r[0],l=r[r.length-1];if(s&&a&&n.contains(a))!e.shiftKey||a!==s&&a!==n?e.shiftKey||a!==l||(e.preventDefault(),s.focus()):(e.preventDefault(),l.focus());else{e.preventDefault();const t=e.shiftKey?l:s;t?t.focus():n.focus()}};return document.addEventListener("keydown",n,!0),()=>{document.removeEventListener("keydown",n,!0),a.current?.()}},[e,t]),o}function ha({layer:e,open:t,onCollapse:n,onClosed:r,label:o,children:a}){const i=fa(t,!0,n,r),[s,l]=q.useState(!1);if(q.useEffect(()=>{if(!t)return void l(!1);const e=requestAnimationFrame(()=>l(!0)),n=document.documentElement,r=n.style.overflow;return n.style.overflow="hidden",()=>{cancelAnimationFrame(e),n.style.overflow=r}},[t]),!e)return null;const c=pa()?void 0:"transform 220ms ease-out, opacity 220ms ease-out";return sn.createPortal(O.jsxs(ae,{display:t?"block":"none",children:[O.jsx(ae,{position:"fixed",inset:0,zIndex:1000001,bg:"blackAlpha.400",opacity:s?1:0,transition:c,touchAction:"none",onClick:n,"aria-hidden":!0}),O.jsxs(ae,{ref:i,role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,outline:"none",position:"fixed",left:0,right:0,bottom:0,zIndex:1000002,display:"flex",flexDirection:"column",bg:"background",borderTopRadius:"20px",boxShadow:"0 -8px 32px rgba(0,0,0,0.14)",css:{maxHeight:"85vh","@supports (height: 1dvh)":{maxHeight:"85dvh"}},transform:s||pa()?"none":"translateY(24px)",opacity:s?1:0,transition:c,children:[O.jsx(ae,{as:"button",tabIndex:-1,"aria-hidden":!0,onClick:n,py:2.5,flexShrink:0,cursor:"pointer",children:O.jsx(ae,{w:"36px",h:"4px",mx:"auto",borderRadius:"full",bg:"blackAlpha.300"})}),O.jsx(ae,{overflowY:"auto",overscrollBehavior:"contain",px:4,pb:"calc(16px + env(safe-area-inset-bottom, 0px))",children:a})]})]}),e)}function ga({open:e,onCollapse:t,onClosed:n,label:r,children:o,w:a,maxH:i}){const s=fa(e,!1,t,n),l=q.useRef(t);return l.current=t,q.useEffect(()=>{if(!e)return;const t=e=>{s.current&&!e.composedPath().includes(s.current)&&l.current()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,s]),O.jsx(ae,{ref:s,display:e?"block":"none",role:"dialog","aria-label":r,tabIndex:-1,outline:"none",w:a,maxH:i,overflowY:"auto",overscrollBehavior:"contain",bg:"background",borderRadius:"20px",border:"1px solid",borderColor:"borderColor",boxShadow:ca,p:4,children:o})}function ma({isMobile:e,layer:t,w:n,maxH:r,...o}){return e?O.jsx(ha,{layer:t,...o}):O.jsx(ga,{w:n,maxH:r,...o})}const ba={size:"xs",borderRadius:"999px",fontSize:"12.5px",fontWeight:600,px:3,h:"28px",fontFamily:pe,transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},xa=e=>e&&"Default Title"!==e?e:"";function ya({api:e,row:t}){const n=e.rowFacts(t),{price:r,note:o}=n,a="added"===t.state?null!=t.paid&&t.paid<r-.005?Math.max(0,t.paid):null:n.pay,i=t.variants.filter(e=>e.available),s="added"===t.state?e.say(null,"added_check"):"sold"===t.state?e.say(null,"sold_out"):e.say(null,"add");return O.jsxs(ge,{align:"stretch",gap:1.5,py:2,borderTop:"1px solid",borderColor:"blackAlpha.100","data-dori-guide-row":t.pid,children:[O.jsxs(ue,{align:"flex-start",gap:2,children:[t.image?O.jsx(de,{src:t.image,alt:"",boxSize:"48px",objectFit:"cover",onLoad:Qe,borderRadius:"8px",flexShrink:0,bg:"blackAlpha.50"}):null,O.jsxs(ge,{align:"stretch",gap:.5,flex:1,minW:0,children:[O.jsx(fe,{fontSize:"12.5px",lineHeight:"1.3",lineClamp:2,fontFamily:pe,color:"text",children:t.title}),O.jsxs(fe,{fontSize:"12.5px",fontFamily:pe,color:"text",children:[O.jsx("b",{children:null==a?e.money(r):a<.005?e.say(null,"free"):e.money(a)}),null!=a?O.jsx("s",{style:{marginInlineStart:6,opacity:.6},children:e.money(r)}):null]}),o?O.jsx(fe,{fontSize:"11.5px",color:"mutedText",fontFamily:pe,children:o}):null,1===i.length&&xa(i[0].title)?O.jsx(fe,{fontSize:"11.5px",color:"mutedText",fontFamily:pe,children:i[0].title}):null]}),O.jsx(ee,{...ba,flexShrink:0,bg:"idle"===t.state?"primary":"blackAlpha.100",color:"idle"===t.state?"buttonText":"text",disabled:"idle"!==t.state||!t.chosen,loading:"adding"===t.state,onClick:()=>{e.add(t.pid)},"aria-label":`${s}: ${t.title}`,children:s})]}),i.length>1&&"added"!==t.state?O.jsx(ue,{gap:1,flexWrap:"wrap",ps:t.image?"56px":0,children:i.map(n=>O.jsx(ee,{...ba,h:"auto",minH:"24px",py:"3px",maxW:"100%",whiteSpace:"normal",textAlign:"start",lineHeight:"1.25",fontWeight:500,variant:"outline","aria-pressed":t.chosen===n.id,bg:t.chosen===n.id?"text":"transparent",color:t.chosen===n.id?"background":"text",onClick:()=>e.choose(t.pid,n.id),children:n.title},n.id))}):null]})}const va=({api:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{v:i,visible:s}=function(e){const[t,n]=q.useState(e),[r,o]=q.useState(!1);return q.useEffect(()=>{if(e){n(e);const t=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(t)}o(!1);const t=window.setTimeout(()=>n(null),200);return()=>window.clearTimeout(t)},[e]),{v:e??t,visible:!!e&&r}}(e.view),l=q.useRef(null);if(!i)return null;const c=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,d=!e.view,u=i.decision,p="add_this"!==u.cta&&"add_it"!==u.cta||!i.rows?.[0]?null:i.rows[0],f=p?.variants.find(e=>e.id===p.chosen)??null,h=p&&f?e.rowFacts(p):null,g=e.say(null,"close")||"Close",m=h?.note??i.note;let b=null;if(i.result)i.result.undoVid&&(b={label:e.say(null,"undo"),run:()=>{e.undo()},quiet:!0});else if("see_picks"===u.cta)b={label:e.say(null,"show_picks"),run:()=>{e.unfold()},opens:!0};else if(p&&"idle"===p.state){const t=h?null==h.pay?e.money(h.price):h.pay<.005?e.say(null,"free"):e.money(h.pay):"",n=f?[e.say(null,"add"),xa(f.title),t].filter(Boolean).join(" · "):"";b=n&&n.length<=40?{label:n,run:()=>{e.add(p.pid)}}:{label:e.say(null,"choose"),run:()=>{e.unfold()},opens:!0}}const x=b?O.jsx(ee,{ref:l,...da,...b.quiet?{bg:"blackAlpha.100",color:"text"}:{},"aria-haspopup":b.opens?"dialog":void 0,onClick:b.run,children:b.label}):null,y=i.result?O.jsx(fe,{fontSize:"13px",lineHeight:"1.35",color:"text",fontFamily:pe,children:i.result.text}):null,v=i.rows??[];return O.jsxs(ae,{opacity:s?1:0,transform:s||c?"none":"translateY(8px) scale(0.98)",transformOrigin:"bottom",transition:"opacity 200ms ease-out, transform 200ms ease-out",pointerEvents:d?"none":void 0,"aria-hidden":d||void 0,"data-dori-offer-guide":d?void 0:u.offer,children:[!i.open&&O.jsx(ua,{maxW:r,icon:O.jsx(In,{boxSize:"16px"}),closeLabel:g,onClose:e.close,action:x,actionBelow:!!b&&b.label.length>12,children:O.jsx(ae,{"aria-live":"polite",role:i.result?"status":void 0,children:y??O.jsxs(O.Fragment,{children:[O.jsx(fe,{fontSize:"13px",fontWeight:600,lineHeight:"1.35",color:"text",fontFamily:pe,children:i.line}),m?O.jsx(fe,{fontSize:"12px",lineHeight:"1.35",color:"mutedText",mt:.5,fontFamily:pe,children:m}):null]})})}),i.open&&O.jsx(ma,{isMobile:t,layer:n,open:!0,label:i.head||i.line,w:o,maxH:a,onCollapse:e.fold,onClosed:()=>l.current?.focus(),children:O.jsxs(ge,{align:"stretch",gap:2,children:[O.jsxs(ue,{align:"flex-start",gap:2,children:[O.jsx(fe,{flex:1,fontSize:"13px",fontWeight:600,lineHeight:"1.4",color:"text",fontFamily:pe,children:i.line}),O.jsx(fn,{size:"xs",variant:"ghost","aria-label":g,onClick:e.close,h:"auto",minW:"auto",p:1,color:"text",transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:O.jsx(wn,{boxSize:"14px"})})]}),i.head?O.jsx(fe,{fontSize:"12px",color:"mutedText",fontFamily:pe,children:i.head}):null,null==i.rows?O.jsx(ue,{justify:"center",py:4,children:O.jsx(be,{size:"sm",color:"primary"})}):v.length?v.map(t=>O.jsx(ya,{api:e,row:t},t.pid)):O.jsx(fe,{fontSize:"12.5px",color:"mutedText",py:2,fontFamily:pe,children:e.say(null,"sold_out")}),i.result?O.jsxs(ue,{role:"status","aria-live":"polite",gap:2,pt:1,borderTop:"1px solid",borderColor:"blackAlpha.100",children:[O.jsx(ae,{flex:1,children:y}),i.result.undoVid?O.jsx(ee,{variant:"plain",size:"xs",h:"auto",p:0,textDecoration:"underline",fontWeight:400,onClick:()=>{e.undo()},children:e.say(null,"undo")}):null]}):null]})})]})},wa="dori-quiz-dismissed";function ka(){try{return"true"===sessionStorage.getItem(wa)}catch{return!1}}function Ca(){try{sessionStorage.setItem(wa,"true")}catch{}}const ja=e=>null==e?null:{p:new Set(e.p),v:new Set(e.v||[])},Sa=(e,t)=>null===e||e.p.has(t.pid)||e.v.has(t.vid),za=e=>Math.round(100*e)/100;function Ea(e,t=new Date){const n=e.offers.filter(e=>!e.ends_at||new Date(e.ends_at)>t);return{pack:e,offers:n.map(e=>({o:e,scope:ja(e.scope),buys:ja(e.buys),gets:e.same?ja(e.buys):ja(e.gets)}))}}const Aa=e=>e.reduce((e,t)=>e+t.price*t.qty,0),Ra=e=>e.flatMap(e=>Array.from({length:e.qty},()=>({pid:e.pid,vid:e.vid,price:e.price}))),_a=(e,t)=>null!=e.pct?t*e.pct:Math.min(e.amount??0,t);function Ta(e,t,n){const r=new Map,o=e.offers.filter(e=>"ship"!==e.o.kind).map(e=>"basic"===e.o.kind?function(e,t){const n=e.o,r=Ra(t).filter(t=>Sa(e.scope,t)),o=r.reduce((e,t)=>e+t.price,0),a=r.length,i=a>0&&(!n.min_amount||o>=n.min_amount)&&(!n.min_qty||a>=n.min_qty),s=i?null!=n.pct?n.pct*o:n.each?r.reduce((e,t)=>e+Math.min(n.amount??0,t.price),0):Math.min(n.amount??0,o):0;return{off:e,applies:i,value:s,disc:i?r:[],amt:o,qty:a,gapAmount:n.min_amount?Math.max(0,n.min_amount-o):null,gapQty:n.min_qty?Math.max(0,n.min_qty-a):null}}(e,t):function(e,t){const n=e.o,r=n.buy_qty||1,o=n.get_qty||1,a=Ra(t);if(n.same){const t=a.filter(t=>Sa(e.buys,t)).sort((e,t)=>t.price-e.price);let i=Math.floor(t.length/(r+o));n.per_order&&(i=Math.min(i,n.per_order));const s=t.slice(t.length-i*o).sort((e,t)=>e.price-t.price),l=t.length-i*(r+o);return{off:e,applies:i>0,value:s.reduce((e,t)=>e+_a(n,t.price),0),disc:s,el:t,earned:l>=r&&(!n.per_order||i<n.per_order)}}const i=a.filter(t=>Sa(e.buys,t)),s=a.filter(t=>Sa(e.gets,t)).sort((e,t)=>e.price-t.price),l=n.per_order?n.per_order*o:1/0,c=new Set;for(const f of s){if(c.size>=l)break;i.filter(e=>e!==f&&!c.has(e)).length>=r*Math.ceil((c.size+1)/o)&&c.add(f)}const d=s.filter(e=>c.has(e)),u=i.filter(e=>!c.has(e)).length,p=Math.min(Math.floor(u/r)*o,l);return{off:e,applies:d.length>0,value:d.reduce((e,t)=>e+_a(n,t.price),0),disc:d,earned:p>d.length,hasGet:s.length>0,hasBuy:u>0}}(e,t));o.forEach(e=>r.set(e.off.o.id,e));const a=o.filter(e=>e.applies&&e.value>0).sort((e,t)=>t.value-e.value),i=a.slice(0,1),s=a.slice(1).some(e=>{return t=i[0].off.o,n=e.off.o,!!t.cw?.[n.cls||"product"]&&!!n.cw?.[t.cls||"product"];var t,n}),l=za(Aa(t))-i.reduce((e,t)=>e+za(t.value),0),c=e.offers.filter(e=>"ship"===e.o.kind).map(e=>{const t=((e,t)=>!e.countries||!!t.country&&e.countries.includes(t.country))(e.o,n),o={off:e,applies:t&&l>=(e.o.min??0),value:0,disc:[],gap:Math.max(0,(e.o.min??0)-l)};var a,s;return!o.applies||!i.length||(a=i[0].off.o,"rates"===(s=e.o).source||a.ship_ok&&("order"===a.cls?s.with_order:s.with_product))||(o.applies=!1,o.offBy=i[0].off),r.set(e.o.id,o),o}),d=i.concat(c.filter(e=>e.applies));return{st:r,applied:d,ids:new Set(d.map(e=>e.off.o.id)),base:l,stacked:s}}const Wa=(e,t,n)=>za(Aa(t))-Ta(e,t,n).applied.reduce((e,t)=>e+za(t.value),0);function Ia(e,t,n,r){const o=Ta(e,t,r);if(o.stacked)return!1;const a=o.applied.reduce((e,t)=>e+t.disc.length,0);return Math.abs(Wa(e,t,r)-n)<=.01*(a+1)+1e-9}const La=(e,t,n,r="")=>e.concat([{pid:t,vid:r,qty:1,price:n}]),Ma=(e,t,n,r,o,a="")=>Wa(e,La(t,n,r,a),o)-Wa(e,t,o),Ba=(e,t,n)=>t.speak&&!n.blocked.has(t.id)&&!("ship"===t.kind&&n.country!==e.pack.main_country)&&(!t.ends_at||new Date(t.ends_at)>new Date),Fa=(e,t)=>e.pack.products[t]?.p??0,Da=(e,t)=>e.pack.products[t]?.ty||"",Ha=(e,t)=>e.offers.find(n=>"ship"===n.o.kind&&Ba(e,n.o,t))?.o??null;function Pa(e,t,n){const r=function(e,t,n){const r=e=>!!e&&"basic"===e.off.o.kind&&!e.off.o.scope,o=n.applied.find(e=>r(e));return[...t.ids].filter(e=>!n.ids.has(e)).map(e=>t.st.get(e)).filter(e=>!(e.off.o.free_anyway||r(e)&&o&&o.value>e.value)).map(e=>e.off.o)}(0,t,n);return{block:r.find(e=>"ship"!==e.kind)??null,shipLost:r.find(e=>"ship"===e.kind)??null}}const qa=e=>e.pct??0;function Oa(e,t){const n=e.applied.find(e=>"basic"===e.off.o.kind&&!e.off.o.scope);return n&&!t.scope&&n.off.o.id!==t.id&&qa(n.off.o)<qa(t)?n.off.o:null}function Na(e,t,n,r,o,a,i){const s=e.offers.find(e=>e.o.id===n)?.o;if(!s||s.ends_at&&new Date(s.ends_at)<=new Date)return!1;const l=Ta(e,t,i),c=Ta(e,La(t,r,a,o),i);return c.ids.has(n)&&!c.stacked&&!Pa(0,l,c).block}function Ya(e,t,n,r){const o=t.o,a=new Set(n.map(e=>e.pid)),i=t=>!a.has(t)&&!r.sold.has(t)&&!!e.pack.products[t],s=new Set(n.map(t=>Da(e,t.pid)).filter(Boolean)),l=t=>Ma(e,n,t,Fa(e,t),r);let c=[];if("ship"===o.kind||"basic"===o.kind&&!o.scope&&o.min_amount){const t=e.pack.closers.filter(t=>(t=>!r.sold.has(t)&&!!e.pack.products[t])(t)&&Ta(e,La(n,t,Fa(e,t)),r).ids.has(o.id)).map((e,t)=>({id:e,i:t,x:l(e)})).sort((e,t)=>e.x-t.x||e.i-t.i);if(t.length){const n=2*t[0].x;c=[t[0],...t.filter(t=>s.has(Da(e,t.id))&&t.x<=n),...t].map(e=>e.id)}}else if("basic"===o.kind)c=(o.scope?o.picks||[]:e.pack.closers).filter(i);else{c=(o.picks||[]).filter(e=>i(e)&&Sa(t.gets,{pid:e,vid:""}));const a=Ha(e,r);if(a?.fee){const t=t=>{const o=La(n,t,Fa(e,t));return Wa(e,o,r)+(Ta(e,o,r).ids.has(a.id)?0:a.fee)},o=c.filter(t=>Va(e,n,t,Fa(e,t),r)).sort((e,n)=>t(e)-t(n));o.length&&(!c.length||t(o[0])<t(c[0])-.005)&&(c=[o[0],...c])}}return[...new Set(c)].filter(t=>l(t)<=Fa(e,t)+.005&&Na(e,n,o.id,t,"",Fa(e,t),r)).slice(0,3)}function Va(e,t,n,r,o){const a=Ha(e,o);return a&&!Ta(e,t,o).ids.has(a.id)&&Ta(e,La(t,n,r),o).ids.has(a.id)?a:null}function Ua(e){return null!=e.pct?Math.round(1e3*e.pct)/10+"%":e.amount??0}function Za(e,t){const n=(t||e.language||"en").toLowerCase(),r=n.split("-")[0],o=e.copy[n]?n:e.copy[r]?r:null;return o?{lang:o,copy:e.copy[o]}:null}const Ka=new Set(["US","GB","AE","NL","PH","CZ","DO","BS","GM","CF","KM","MV","MH","SB","VA","CD","CG"]),Qa=new Set(["gap","fee","fee_lo","fee_hi","saving","price","paid","eff"]);const Ga=9e3;function Xa(e){const t=Date.parse(e?.checked_at||e?.built_at||"");return e&&Number.isFinite(t)&&Date.now()-t<2592e5?e:null}const Ja=new WeakMap;function $a(e){if(!1===e?.customization?.enable_offer_guide)return!1;const t=Xa(e?.offer_guide);if(!t||!Za(t,mt()))return!1;let n=Ja.get(t);return n||(n=Ea(t),Ja.set(t,n)),r=n,o=bt(j()??null),r.offers.some(e=>Ba(r,e.o,o));var r,o}const ei=e=>String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"");function ti(e,t){const n=t.variants.map(e=>({id:String(e.id),title:String(e.title||""),available:!1!==e.available,price:Number(e.price??0)/100})),r=n.filter(e=>e.available);return{pid:e,title:t.title,image:t.images?.[0]??null,variants:n,chosen:1===r.length?r[0].id:null,state:r.length?"idle":"sold"}}function ni(e,t){const n=q.useMemo(()=>Xa(e?.offer_guide),[e?.offer_guide]),r=q.useMemo(()=>n?Ea(n):null,[n]),o=q.useMemo(()=>n?Za(n,mt()):null,[n]),[a,i]=q.useState(null),[s,c]=q.useState(!1),d=q.useRef(null),u=q.useRef(null),p=q.useRef(!1),f=q.useRef(0),h=q.useRef(t);h.current!==t&&(h.current=t,t||(f.current+=1));const g=q.useRef(null),m=q.useRef(!1),b=j()??null,x=q.useCallback(e=>{d.current=e,i(e)},[]),y=q.useCallback(e=>{g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const e=d.current;!e||p.current||e.open||x(null)},e)},[x]),v=q.useCallback((e,t,r={})=>{if(!o||!n)return"";const a=function(e,t,n){return(t?e.copy.offers[t]?.[n]:void 0)??e.copy.ui[n]??null}(o,e,t),i=e?n.offers.find(t=>t.id===e)??null:null;return a?function(e,t,n,r,o){const a={...t};return o&&null==a.off&&(a.off=Ua(o)),o?.countries?.length&&null==a.country&&(a.country=function(e,t){try{const n=new Intl.DisplayNames([t],{type:"region"}).of(e)||e;return"en"===t&&Ka.has(e)?`the ${n}`:n}catch{return e}}(o.countries[0],r)),e.replace(/\{([a-z_]+)\}/g,(e,t)=>{const r=a[t];return null==r?e:"number"!=typeof r||!Qa.has(t)&&"off"!==t?String(r):Ne(r,n.currency)})}(a,r,n,o.lang,i):""},[o,n]),w=q.useCallback((e,t,n,o,a=()=>!0)=>{if(!r)return null;const i=e.variants.map(i=>({...i,available:i.available&&Na(r,n,t,e.pid,i.id,i.price,o)&&a(i)})),s=i.filter(e=>e.available);if(!s.length)return null;const l=1===s.length?s[0].id:s.some(t=>t.id===e.chosen)?e.chosen:null;return{...e,variants:i,chosen:l}},[r]),k=q.useCallback(async()=>{const e=f.current;if(!r||!o||!t||p.current||xt()||yt())return;const n=d.current;if(n&&(n.open||n.result))return;const a=await vt(),i=bt(b);if(!a||a.unknown||a.currency!==r.pack.currency||!Ia(r,a.lines,a.total,i))return void(n&&x(null));if(u.current=a,n&&n.cart===wt(a.lines))return;const s=await async function(){const e=window.ShopifyAnalytics?.meta?.product;if(!e?.id||!Array.isArray(e.variants)||!e.variants.length)return null;const t=new URLSearchParams(window.location.search).get("variant"),n=e.variants.find(e=>String(e.id)===t)??(1===e.variants.length?e.variants[0]:null),r=n?Number(n.price)/100:Math.min(...e.variants.map(e=>Number(e.price)/100));return{pid:String(e.id),vid:n?String(n.id):"",price:r}}(),c=function(e,t,n,r){const o=Ta(e,t,r);if(o.stacked)return{quiet:"two discounts combine here"};const a=Aa(t);if(n&&!t.some(e=>e.pid===n.pid)){const a=La(t,n.pid,n.price,n.vid),i=Ta(e,a,r),{block:s,shipLost:l}=Pa(0,o,i),c=i.applied.filter(t=>Ba(e,t.off.o,r)&&(!o.ids.has(t.off.o.id)||t.value>(o.st.get(t.off.o.id)?.value??0)+.001));if(c.length&&!s&&!i.stacked){const i=c[0],s=i.off.o,d={offer:s.id,cta:"add_this",picks:[n.pid],shipNote:!!l};if("ship"===s.kind)return{...d,key:t.length?"page_add":"page_alone",vars:{}};if("basic"===s.kind){const e=Oa(o,s);return e?{...d,key:"page_move",vars:{from:Ua(e)}}:{...d,key:"page_add",vars:{}}}if(s.same){const n=Wa(e,a,r)-Wa(e,t,r);return{...d,key:"page_add",vars:{n:i.el?.length??0},costsNothing:Math.abs(n)<.005}}return{...d,key:Sa(i.off.gets,n)?"page_get":"page_buy",vars:{}}}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||!a.earned||!Ba(e,n,r))continue;const s=Ya(e,i,t,r);if(!s.length)continue;const l=s[0],c=Ta(e,La(t,l,Fa(e,l)),r);if(!c.ids.has(n.id)||c.stacked)continue;const{block:d,shipLost:u}=Pa(0,o,c);if(d)continue;if(n.same){const t=Math.min(Fa(e,l),...(a.el??[]).map(e=>e.price));if(_a(n,t)<.2*Fa(e,l))continue;return{offer:n.id,key:"earned",vars:{},cta:"see_picks",picks:s,shipNote:!!u}}const p=!!i.gets&&1===i.gets.p.size;return{offer:n.id,key:"earned",vars:{},cta:p?"add_it":"see_picks",picks:s,shipNote:!!u}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||n.same||!a.hasGet||a.hasBuy||r.infoSeen.has(`lost-${n.id}`)||!Ba(e,n,r))continue;const s=t.find(e=>Sa(i.gets,e));if(s)return{offer:n.id,key:"lost",vars:{price:s.price},cta:"info",picks:[],shipNote:!1,once:`lost-${n.id}`}}for(const i of e.offers){const n=i.o,s=o.st.get(n.id);if(!Ba(e,n,r)||s.applies||!t.length)continue;const l="ship"===n.kind?s.gap??0:"basic"===n.kind&&!n.scope&&n.min_amount?s.gapAmount??0:0;if(l>0){if(l>.5*a)continue;const s=Ya(e,i,t,r);if(!s.length)continue;const c=s[0];if("basic"===n.kind&&Ma(e,t,c,Fa(e,c),r)>.8*Fa(e,c))continue;const d=Ta(e,La(t,c,Fa(e,c)),r),{block:u,shipLost:p}=Pa(0,o,d);if(u||d.stacked)continue;const f={offer:n.id,cta:"see_picks",picks:s,shipNote:!!p};if("ship"===n.kind)return null!=n.fee?{...f,key:"gap_fee",vars:{gap:l,fee:n.fee}}:n.fee_range?{...f,key:"gap_fee",vars:{gap:l,fee_lo:n.fee_range[0],fee_hi:n.fee_range[1]}}:{...f,key:"gap",vars:{gap:l}};const h=Oa(o,n);return h?{...f,key:"gap_move",vars:{gap:l,from:Ua(h)}}:{...f,key:"gap",vars:{gap:l}}}if("basic"===n.kind&&n.min_qty&&1===s.gapQty){const a=Ya(e,i,t,r);if(!a.length)continue;const s=Ta(e,La(t,a[0],Fa(e,a[0])),r),{block:l,shipLost:c}=Pa(0,o,s);if(!s.ids.has(n.id)||l||s.stacked)continue;const d=n.scope?null:Oa(o,n);return{offer:n.id,key:d?"one_more_move":"one_more",vars:d?{from:Ua(d)}:{},cta:"see_picks",picks:a,shipNote:!!c}}}if(n)for(const i of e.offers){const t=i.o,a=o.st.get(t.id);if(!r.infoSeen.has(t.id)&&!o.ids.has(t.id)&&Ba(e,t,r)){if("basic"===t.kind){if(!t.scope||!t.min_qty||!Sa(i.scope,n))continue}else{if("bxgy"!==t.kind)continue;if(!Sa(i.buys,n)||(t.same?(a.el?.length??0)>0:a.hasBuy))continue}return{offer:t.id,key:"info",vars:{},cta:"info",picks:[],shipNote:!1,once:t.id}}}return{quiet:"nothing true and worth saying here"}}(r,a.lines,s,i);if("quiet"in c)return void(n&&x(null));if("info"===c.cta&&m.current)return;const g=`${c.offer}|${c.key}|${wt(a.lines)}|${s?.pid??""}`;if(n?.sig===g||kt(g))return;const k=r.pack.offers.find(e=>e.id===c.offer)??null,C={sig:g,cart:wt(a.lines),decision:c,offer:k,line:v(c.offer,c.key,c.vars)+(c.costsNothing?` ${v(null,"costs_nothing")}`:""),note:c.shipNote?v(null,"ship_note"):null,head:"see_picks"===c.cta&&v(c.offer,"picks_head")||null,open:!1,rows:null,result:null,used:!1};if(C.line){if("add_this"===c.cta||"add_it"===c.cta){const e=c.picks[0],t=r.pack.products[e]?.h??("add_this"===c.cta?window.location.pathname.match(/\/products\/([^/?#]+)/)?.[1]:null),n=t?await Pe(decodeURIComponent(t)).catch(()=>null):null;if(!n)return;const o=ti(e,n),l=t=>!c.costsNothing||Math.abs(Ma(r,a.lines,e,t.price,i,t.id))<.005,d="sold"===o.state?null:w(o,c.offer,a.lines,i,l);if(!d)return;if("add_this"===c.cta&&s?.vid&&d.variants.some(e=>e.id===s.vid&&e.available)&&(d.chosen=s.vid),"add_it"===c.cta&&!d.chosen){const e=a.lines.find(e=>e.vt&&d.variants.some(t=>t.available&&ei(t.title)===ei(e.vt))),t=e&&d.variants.find(t=>t.available&&ei(t.title)===ei(e.vt));t&&(d.chosen=t.id,C.line=v(c.offer,"earned_size",c.vars)||C.line)}C.rows=[d]}e===f.current&&h.current&&(Ct(g),m.current=!0,c.once&&jt(c.once),St(C.line,a),x(C),y(15e3),l("offer_guide_shown",{offer:c.offer,key:c.key,cta:c.cta,kind:k?.kind,lang:o.lang}))}},[r,o,t,b,v,x,y,w]),C=q.useCallback(async()=>{try{await k()}finally{c(!0)}},[k]);q.useEffect(()=>{if(!r||!o||!t)return;let e=null;const n=window.setTimeout(()=>{C()},1500),a=()=>{e&&window.clearTimeout(e),e=window.setTimeout(()=>{C()},800)};return window.addEventListener(zt,a),()=>{window.clearTimeout(n),e&&window.clearTimeout(e),window.removeEventListener(zt,a)}},[r,o,t,C]),q.useEffect(()=>()=>{f.current+=1,g.current&&window.clearTimeout(g.current)},[]);const S=q.useCallback(e=>{const t=d.current;t&&x(e(t))},[x]),z=q.useCallback(async()=>{const e=d.current;if(!e||!r)return;if(e.open)return;if(g.current&&window.clearTimeout(g.current),Et(),l("offer_guide_unfolded",{offer:e.decision.offer,key:e.decision.key}),e.rows)return void S(e=>({...e,open:!0}));S(e=>({...e,open:!0}));const t=bt(b),n=(await Promise.all(e.decision.picks.map(async n=>{const o=r.pack.products[n]?.h,a=o?await Pe(o).catch(()=>null):null;if(!a)return null;const i=ti(n,a);return"sold"===i.state&&At(n),"sold"===i.state||t.sold.has(n)?null:w(i,e.decision.offer,u.current?.lines??[],t)}))).filter(e=>!!e);S(t=>t.sig===e.sig?{...t,rows:n}:t)},[r,b,S,w]),E=q.useCallback(()=>{const e=d.current;e?.open&&(S(e=>({...e,open:!1})),e.used&&y(Ga))},[S,y]),A=q.useCallback(e=>{const t=e.variants.find(t=>t.id===e.chosen)??e.variants.filter(e=>e.available).sort((e,t)=>e.price-t.price)[0],o=t?.price??0,a=u.current?.lines??[];if(!r||!n||"added"===e.state)return{price:o,pay:null,note:null};const i=bt(b),s=Ta(r,a.concat([{pid:e.pid,vid:t?.id??"",qty:1,price:o}]),i).applied.find(t=>"bxgy"===t.off.o.kind&&t.disc.some(t=>t.pid===e.pid)),l=Ma(r,a,e.pid,o,i,t?.id??""),c=[];let d=null;s&&Math.abs(l-o)>.005?d=Math.max(0,l):Math.abs(l-o)>.005&&c.push(v(null,"adds_to_total",{eff:l}));const p=Va(r,a,e.pid,o,i);return p&&c.push(v(p.id,"reaches")),function(e,t,n,r,o,a){return!!Pa(0,Ta(e,t,a),Ta(e,La(t,n,o,r),a)).shipLost}(r,a,e.pid,t?.id??"",o,i)&&c.push(v(null,"ship_note")),{price:o,pay:d,note:c.filter(Boolean).join(" · ")||null}},[r,n,b,v]),R=q.useCallback((e,t)=>{S(n=>({...n,rows:n.rows?.map(n=>n.pid===e?{...n,chosen:t}:n)??null}))},[S]),_=q.useCallback(async e=>{const t=d.current,o=t?.rows?.find(t=>t.pid===e);if(!t||!o||!o.chosen||!r||p.current)return;const a=o.variants.find(e=>e.id===o.chosen);if(!a)return;p.current=!0,g.current&&window.clearTimeout(g.current),S(t=>({...t,rows:t.rows?.map(t=>t.pid===e?{...t,state:"adding"}:t)??null}));const i=bt(b),s=await vt();if(!Xa(n)||!s||s.unknown||s.currency!==r.pack.currency||wt(s.lines)!==t.cart||!Ia(r,s.lines,s.total,i)||!Na(r,s.lines,t.decision.offer,e,a.id,a.price,i))return p.current=!1,x(null),void C();const c=await Rt(a.id,t.decision.offer),f="success"===c.type||"out_of_stock"===c.reason?s:await vt(),h="success"===c.type||!!f&&_t(f,a.id)>_t(s,a.id);let m,w=!1,k="idle",j=null;if(h){k="added";const n=await vt();u.current=n;const c=!!n&&!n.unknown&&n.currency===s.currency;if(j=c&&"bxgy"===t.offer?.kind?za(n.total-s.total):null,c&&Ia(r,n.lines,n.total,i)){const o=function(e,t,n,r,o,a,i,s){const l=e.offers.find(e=>e.o.id===t)??null,c=l?.o??null,d=s??Wa(e,r,i)-Wa(e,n,i),u=Ta(e,r,i),p=Ta(e,n,i).applied.find(e=>"ship"===e.off.o.kind),f=p?u.st.get(p.off.o.id):void 0,h=!(!p||!f||f.applies||!f.offBy||p.off.o.free_anyway),g=(e,t={},n=!1)=>({key:e,from:"ui",vars:t,ok:n,shipNote:h});if(!c)return d<a-.005?g("added_cost",{eff:d}):g("added");if("ship"===c.kind){const t=u.st.get(c.id);return Ba(e,c,i)?t.applies?{key:"added_reached",from:"offer",vars:{},ok:!0,shipNote:h}:{key:"added_gap",from:"offer",vars:{gap:t.gap??0},ok:!0,shipNote:h}:g("added")}const m=u.applied.find(e=>e.off.o.id===c.id);if(d<a-.005){if(!m)return g("added_cost",{eff:d});if("basic"===c.kind)return{key:"added",from:"offer",vars:{saving:za(m.value)},ok:!0,shipNote:h};if(c.same){const t=m.disc[0];return t?{key:"added",from:"offer",vars:{title:e.pack.products[t.pid]?.t??"",price:t.price},ok:!0,shipNote:h}:g("added_cost",{eff:d},!0)}return"bxgy"!==c.kind||m.disc.some(e=>e.pid===o)?{key:"added",from:"offer",vars:{paid:za(d),price:a},ok:!0,shipNote:h}:g("added_cost",{eff:d},!0)}if(Math.abs(d-a)<.005){if("bxgy"===c.kind&&!c.same){const t=m?.disc.find(e=>e.pid!==o),n=t?e.pack.products[t.pid]?.t:null;if(n)return{key:"added_full_went",from:"offer",vars:{title:n},ok:!1,shipNote:h}}return g("added_full")}return g("added_cost",{eff:d})}(r,t.decision.offer,s.lines,n.lines,e,a.price,i,j);m=v("offer"===o.from?t.decision.offer:null,o.key,o.vars)+(o.shipNote?` ${v(null,"ship_note")}`:""),w=o.ok}else m=v(null,"added");const d=t.offer;d&&"ship"!==d.kind&&c&&n.total-s.total>=a.price-.005&&!Ta(r,n.lines,i).ids.has(d.id)&&Tt(d.id),Wt(o.title),l("offer_guide_add",{offer:t.decision.offer,ok:!0,promised:w,kind:d?.kind})}else"out_of_stock"===c.reason?(At(e),k="sold",m=v(null,"sold_out_now")):f?m=v(null,"add_failed"):(k="unsure",m=v(null,"unsure")),l("offer_guide_add",{offer:t.decision.offer,ok:!1,reason:f?c.reason:"unread"});It(m),p.current=!1,S(t=>({...t,used:!0,rows:t.rows?.map(t=>t.pid===e?{...t,state:k,paid:j}:t)??null,result:{text:m,ok:w,undoVid:"added"===k?a.id:null}})),y(Ga)},[r,b,v,S,y,x,C]),T=q.useCallback(async()=>{const e=d.current,t=e?.result?.undoVid;if(!e||!t||p.current)return;p.current=!0,g.current&&window.clearTimeout(g.current);const n=await Lt(t,e.decision.offer),r="done"===n;p.current=!1,l("offer_guide_undo",{offer:e.decision.offer,ok:r});const o=e.rows?.find(e=>e.variants.some(e=>e.id===t));r&&o&&Mt(o.title),S(e=>({...e,rows:r?e.rows?.map(e=>e.variants.some(e=>e.id===t)?{...e,state:"idle",paid:null}:e)??null:e.rows,result:{text:v(null,r?"removed":"failed"===n?"undo_failed":"unsure"),ok:!1,undoVid:"failed"===n?t:null}})),u.current=await vt(),y(Ga)},[v,S,y]),W=q.useCallback(()=>{const e=d.current;f.current+=1,Bt(),Ca(),Ft(),Dt(),x(null),l("offer_guide_closed",{offer:e?.decision.offer,used:!!e?.used})},[x]),I=q.useCallback(e=>Ne(e,n?.currency),[n?.currency]);return{view:a,looked:s,unfold:z,fold:E,choose:R,add:_,undo:T,close:W,rowFacts:A,say:v,money:I}}const ri=q.forwardRef(function({hookText:e,cta:t,maxW:n,onStart:r,onDismiss:o},a){return O.jsx(ua,{maxW:n,icon:O.jsx(En,{boxSize:"16px"}),closeLabel:"Close",onClose:o,action:O.jsxs(ee,{ref:a,...da,gap:"4px",onClick:r,children:[t,O.jsx(Bn,{boxSize:"12px"})]}),children:O.jsx(ae,{as:"button",onClick:r,w:"full",textAlign:"start",cursor:"pointer",tabIndex:-1,children:O.jsx(fe,{fontSize:"13px",fontWeight:600,color:"text",lineHeight:"1.3",lineClamp:2,fontFamily:pe,children:e})})})});function oi(e,t,n,r){const o=e%10,a=e%100;return 1===o&&11!==a?t:o>=2&&o<=4&&(a<12||a>14)?n:r}const ai={English:{subtitle:e=>`Answer ${e} quick question${e>1?"s":""} for personalized recommendations`,cta:"Start",skip:"Or open chat instead"},Czech:{subtitle:e=>`Odpovězte na ${e} ${1===e?"otázku":"otázky"} pro personalizovaná doporučení`,cta:"Začít",skip:"Nebo otevřít chat"},German:{subtitle:e=>`Beantworten Sie ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten",skip:"Oder Chat öffnen"},Hungarian:{subtitle:e=>`Válaszolj ${e} gyors kérdésre személyre szabott ajánlásokért`,cta:"Indítás",skip:"Vagy nyisd meg a chatet"},Persian:{subtitle:e=>`به ${e} سوال کوتاه پاسخ بدید تا پیشنهادات شخصی دریافت کنید`,cta:"شروع",skip:"یا چت را باز کنید"},French:{subtitle:e=>`Répondez à ${e} question${e>1?"s":""} rapide${e>1?"s":""} pour des recommandations personnalisées`,cta:"Commencer",skip:"Ou ouvrir le chat"},Spanish:{subtitle:e=>`Responde ${e} pregunta${e>1?"s":""} rápida${e>1?"s":""} para recomendaciones personalizadas`,cta:"Empezar",skip:"O abrir el chat"},Arabic:{subtitle:e=>`أجب عن ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} للحصول على توصيات مخصصة`,cta:"ابدأ",skip:"أو افتح المحادثة"},Turkish:{subtitle:e=>`Kişiselleştirilmiş öneriler için ${e} hızlı soruyu yanıtlayın`,cta:"Başla",skip:"Veya sohbeti aç"},Portuguese:{subtitle:e=>`Responda ${e} pergunta${e>1?"s":""} rápida${e>1?"s":""} para recomendações personalizadas`,cta:"Começar",skip:"Ou abrir o chat"},Italian:{subtitle:e=>`Rispondi a ${e} ${1===e?"domanda veloce":"domande veloci"} per raccomandazioni personalizzate`,cta:"Inizia",skip:"Oppure apri la chat"},Japanese:{subtitle:e=>`${e}つの質問に答えるだけで、あなたにぴったりのおすすめをご提案します`,cta:"はじめる",skip:"チャットで相談する"},Chinese:{subtitle:e=>`回答${e}个简单问题,获取专属推荐`,cta:"开始",skip:"或直接打开聊天"},Korean:{subtitle:e=>`${e}개의 간단한 질문에 답하고 맞춤 추천을 받아보세요`,cta:"시작하기",skip:"또는 채팅 열기"},Russian:{subtitle:e=>`Ответьте на ${e} ${oi(e,"короткий вопрос","коротких вопроса","коротких вопросов")}, чтобы получить персональные рекомендации`,cta:"Начать",skip:"Или открыть чат"},Ukrainian:{subtitle:e=>`Дайте відповідь на ${e} ${oi(e,"коротке запитання","короткі запитання","коротких запитань")}, щоб отримати персональні рекомендації`,cta:"Почати",skip:"Або відкрити чат"},Polish:{subtitle:e=>`Odpowiedz na ${e} ${function(e){if(1===e)return"krótkie pytanie";const t=e%10,n=e%100;return t>=2&&t<=4&&(n<12||n>14)?"krótkie pytania":"krótkich pytań"}(e)}, aby otrzymać spersonalizowane rekomendacje`,cta:"Zacznij",skip:"Lub otwórz czat"},Slovak:{subtitle:e=>`Odpovedzte na ${e} ${1===e?"krátku otázku":e<5?"krátke otázky":"krátkych otázok"} a získajte odporúčania na mieru`,cta:"Začať",skip:"Alebo otvoriť chat"},Bulgarian:{subtitle:e=>`Отговорете на ${e} ${1===e?"кратък въпрос":"кратки въпроса"} за персонални препоръки`,cta:"Започни",skip:"Или отвори чата"},Croatian:{subtitle:e=>`Odgovorite na ${e} ${oi(e,"kratko pitanje","kratka pitanja","kratkih pitanja")} za osobne preporuke`,cta:"Započni",skip:"Ili otvori chat"},Dutch:{subtitle:e=>`Beantwoord ${e} korte ${1===e?"vraag":"vragen"} voor persoonlijke aanbevelingen`,cta:"Starten",skip:"Of open de chat"},Swedish:{subtitle:e=>`Svara på ${e} ${1===e?"snabb fråga":"snabba frågor"} för personliga rekommendationer`,cta:"Börja",skip:"Eller öppna chatten"},Norwegian:{subtitle:e=>`Svar på ${e} ${1===e?"raskt spørsmål":"raske spørsmål"} for personlige anbefalinger`,cta:"Start",skip:"Eller åpne chatten"},Danish:{subtitle:e=>`Svar på ${e} ${1===e?"hurtigt spørgsmål":"hurtige spørgsmål"} for personlige anbefalinger`,cta:"Start",skip:"Eller åbn chatten"},Finnish:{subtitle:e=>`Vastaa ${e} lyhyeen kysymykseen ja saat henkilökohtaisia suosituksia`,cta:"Aloita",skip:"Tai avaa chat"},Estonian:{subtitle:e=>`Vasta ${e} lühikesele küsimusele ja saa isikupärastatud soovitusi`,cta:"Alusta",skip:"Või ava vestlus"},Latvian:{subtitle:e=>`Atbildiet uz ${e} ${e%10==1&&e%100!=11?"īsu jautājumu":"īsiem jautājumiem"} un saņemiet personalizētus ieteikumus`,cta:"Sākt",skip:"Vai atvērt tērzēšanu"},Lithuanian:{subtitle:e=>`Atsakykite į ${e} ${e%10==1&&e%100!=11?"trumpą klausimą":e%10>=2&&(e%100<10||e%100>=20)?"trumpus klausimus":"trumpų klausimų"} ir gaukite asmeninių rekomendacijų`,cta:"Pradėti",skip:"Arba atidarykite pokalbį"},Greek:{subtitle:e=>`Απαντήστε σε ${e} ${1===e?"σύντομη ερώτηση":"σύντομες ερωτήσεις"} για εξατομικευμένες προτάσεις`,cta:"Έναρξη",skip:"Ή ανοίξτε τη συνομιλία"},Romanian:{subtitle:e=>`Răspunde la ${e} ${1===e?"întrebare scurtă":"întrebări scurte"} pentru recomandări personalizate`,cta:"Începe",skip:"Sau deschide chatul"},Albanian:{subtitle:e=>`Përgjigjuni ${e} ${1===e?"pyetjeje të shkurtër":"pyetjeve të shkurtra"} për rekomandime të personalizuara`,cta:"Fillo",skip:"Ose hap bisedën"},Hebrew:{subtitle:e=>1===e?"ענו על שאלה קצרה אחת לקבלת המלצות מותאמות אישית":`ענו על ${e} שאלות קצרות לקבלת המלצות מותאמות אישית`,cta:"התחלה",skip:"או פתחו את הצ׳אט"},Urdu:{subtitle:e=>`ذاتی سفارشات کے لیے ${e} مختصر ${1===e?"سوال":"سوالات"} کے جواب دیں`,cta:"شروع کریں",skip:"یا چیٹ کھولیں"},Hindi:{subtitle:e=>`व्यक्तिगत सुझावों के लिए ${e} ${1===e?"छोटे सवाल":"छोटे सवालों"} का जवाब दें`,cta:"शुरू करें",skip:"या चैट खोलें"},Bengali:{subtitle:e=>`ব্যক্তিগত সুপারিশ পেতে ${e}টি ছোট প্রশ্নের উত্তর দিন`,cta:"শুরু করুন",skip:"অথবা চ্যাট খুলুন"},Tamil:{subtitle:e=>`தனிப்பட்ட பரிந்துரைகளுக்கு ${e} சிறிய ${1===e?"கேள்விக்கு":"கேள்விகளுக்கு"} பதிலளிக்கவும்`,cta:"தொடங்கு",skip:"அல்லது அரட்டையைத் திற"},Telugu:{subtitle:e=>`వ్యక్తిగత సిఫార్సుల కోసం ${e} చిన్న ${1===e?"ప్రశ్నకు":"ప్రశ్నలకు"} సమాధానం ఇవ్వండి`,cta:"ప్రారంభించండి",skip:"లేదా చాట్ తెరవండి"},Thai:{subtitle:e=>`ตอบคำถามสั้นๆ ${e} ข้อ เพื่อรับคำแนะนำเฉพาะคุณ`,cta:"เริ่มเลย",skip:"หรือเปิดแชท"},Vietnamese:{subtitle:e=>`Trả lời ${e} câu hỏi ngắn để nhận gợi ý dành riêng cho bạn`,cta:"Bắt đầu",skip:"Hoặc mở trò chuyện"},Indonesian:{subtitle:e=>`Jawab ${e} pertanyaan singkat untuk rekomendasi yang dipersonalisasi`,cta:"Mulai",skip:"Atau buka obrolan"},Malay:{subtitle:e=>`Jawab ${e} soalan ringkas untuk cadangan yang diperibadikan`,cta:"Mula",skip:"Atau buka sembang"},Swahili:{subtitle:e=>`Jibu ${1===e?"swali 1 fupi":`maswali ${e} mafupi`} upate mapendekezo yanayokufaa`,cta:"Anza",skip:"Au fungua gumzo"},Filipino:{subtitle:e=>`Sagutin ang ${e} maikling tanong para sa mga personal na rekomendasyon`,cta:"Simulan",skip:"O buksan ang chat"},Iraqi:{subtitle:e=>`جاوب على ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} حتى تحصل على اقتراحات تناسبك`,cta:"ابدأ",skip:"أو افتح المحادثة"},Amharic:{subtitle:e=>`ለግል ምክሮች ${e} አጭር ጥያቄ${1===e?"":"ዎች"}ን ይመልሱ`,cta:"ጀምር",skip:"ወይም ውይይቱን ይክፈቱ"},Burmese:{subtitle:e=>`သင့်အတွက် အကြံပြုချက်များ ရရန် မေးခွန်းတို ${e} ခုကို ဖြေဆိုပါ`,cta:"စတင်ရန်",skip:"သို့မဟုတ် ချက်တင်ကို ဖွင့်ပါ"},Gujarati:{subtitle:e=>`વ્યક્તિગત ભલામણો માટે ${e} ટૂંકા ${1===e?"પ્રશ્નનો":"પ્રશ્નોના"} જવાબ આપો`,cta:"શરૂ કરો",skip:"અથવા ચેટ ખોલો"},Hausa:{subtitle:e=>`Amsa ${1===e?"tambaya 1 gajera":`tambayoyi ${e} gajeru`} don samun shawarwari na musamman`,cta:"Fara",skip:"Ko buɗe hira"},Igbo:{subtitle:e=>`Zaa ajụjụ ${e} dị mkpụmkpụ maka ndụmọdụ ahaziri gị`,cta:"Malite",skip:"Ma ọ bụ mepee nkata"},Kannada:{subtitle:e=>`ವೈಯಕ್ತಿಕ ಶಿಫಾರಸುಗಳಿಗಾಗಿ ${e} ಚಿಕ್ಕ ${1===e?"ಪ್ರಶ್ನೆಗೆ":"ಪ್ರಶ್ನೆಗಳಿಗೆ"} ಉತ್ತರಿಸಿ`,cta:"ಪ್ರಾರಂಭಿಸಿ",skip:"ಅಥವಾ ಚಾಟ್ ತೆರೆಯಿರಿ"},Khmer:{subtitle:e=>`ឆ្លើយសំណួរខ្លីៗ ${e} ដើម្បីទទួលបានការណែនាំសម្រាប់អ្នក`,cta:"ចាប់ផ្តើម",skip:"ឬបើកការជជែក"},Lao:{subtitle:e=>`ຕອບຄຳຖາມສັ້ນໆ ${e} ຂໍ້ ເພື່ອຮັບຄຳແນະນຳສະເພາະທ່ານ`,cta:"ເລີ່ມ",skip:"ຫຼື ເປີດແຊັດ"},Malayalam:{subtitle:e=>`വ്യക്തിഗത ശുപാർശകൾക്കായി ${e} ചെറിയ ${1===e?"ചോദ്യത്തിന്":"ചോദ്യങ്ങൾക്ക്"} ഉത്തരം നൽകുക`,cta:"തുടങ്ങുക",skip:"അല്ലെങ്കിൽ ചാറ്റ് തുറക്കുക"},Marathi:{subtitle:e=>`वैयक्तिक शिफारशींसाठी ${e} ${1===e?"छोट्या प्रश्नाचे":"छोट्या प्रश्नांची"} उत्तरे द्या`,cta:"सुरू करा",skip:"किंवा चॅट उघडा"},Mongolian:{subtitle:e=>`Танд тохирсон зөвлөмж авахын тулд ${e} богино асуултад хариулна уу`,cta:"Эхлэх",skip:"Эсвэл чат нээх"},Nepali:{subtitle:e=>`व्यक्तिगत सुझावका लागि ${e} वटा छोटा प्रश्नको जवाफ दिनुहोस्`,cta:"सुरु गर्नुहोस्",skip:"वा च्याट खोल्नुहोस्"},Pashto:{subtitle:e=>`د شخصي وړاندیزونو لپاره ${e} لنډو ${1===e?"پوښتنې":"پوښتنو"} ته ځواب ورکړئ`,cta:"پیل",skip:"یا چیټ پرانیزئ"},Punjabi:{subtitle:e=>`ਨਿੱਜੀ ਸਿਫ਼ਾਰਸ਼ਾਂ ਲਈ ${e} ਛੋਟੇ ${1===e?"ਸਵਾਲ":"ਸਵਾਲਾਂ"} ਦੇ ਜਵਾਬ ਦਿਓ`,cta:"ਸ਼ੁਰੂ ਕਰੋ",skip:"ਜਾਂ ਚੈਟ ਖੋਲ੍ਹੋ"},Sinhala:{subtitle:e=>`ඔබට ගැළපෙන නිර්දේශ ලබා ගැනීමට කෙටි ප්රශ්න ${e}කට පිළිතුරු දෙන්න`,cta:"අරඹන්න",skip:"නැතහොත් කතාබහ විවෘත කරන්න"},Somali:{subtitle:e=>`Ka jawaab ${e} ${1===e?"su'aal gaaban":"su'aalood oo gaagaaban"} si aad u hesho talooyin kuu gaar ah`,cta:"Bilow",skip:"Ama fur wada-sheekaysiga"},Yoruba:{subtitle:e=>`Dáhùn ìbéèrè kúkúrú ${e} láti gba àbá tó bá ọ mu`,cta:"Bẹ̀rẹ̀",skip:"Tàbí ṣí ìjíròrò"},Zulu:{subtitle:e=>`Phendula ${1===e?"umbuzo omfushane o-1":`imibuzo emifushane engu-${e}`} ukuze uthole iziphakamiso ezenzelwe wena`,cta:"Qala",skip:"Noma vula ingxoxo"},Afrikaans:{subtitle:e=>`Beantwoord ${e} kort ${1===e?"vraag":"vrae"} vir persoonlike aanbevelings`,cta:"Begin",skip:"Of maak die klets oop"}},ii={subtitle:e=>`Beantworte ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten",skip:"Oder Chat öffnen"};function si(e,t=!1){const n=Ht(e),r=Object.keys(ai).find(e=>e.toLowerCase()===n.toLowerCase()),o=ai[e]||ai[n]||(r?ai[r]:void 0)||ai.English;return t&&o===ai.German?ii:o}let li=!1;const ci=({quiz:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{phase:i,open:s,flow:l,text:c,handleStart:d,handleDismiss:u,handleCollapse:p,handleComplete:f,handleSkipToChat:h}=e,g=q.useRef(null);if("hidden"===i||!l)return null;const m={isMobile:t,layer:n,w:o,maxH:a,onCollapse:p,onClosed:()=>g.current?.focus()};return O.jsxs(O.Fragment,{children:[!s&&O.jsx(ri,{ref:g,hookText:l.welcome_hook,cta:c.cta,maxW:r,onStart:d,onDismiss:u}),"expanded"===i&&O.jsxs(ma,{...m,open:s,label:l.entry_label,children:[O.jsx(Vr,{flow:l,onComplete:f,onClose:u}),O.jsx(ae,{as:"button",onClick:h,display:"block",mx:"auto",mt:1,fontSize:"12px",color:"mutedText",textDecoration:"underline",fontFamily:pe,cursor:"pointer",children:c.skip})]})]})};function di(e){const t={};for(const[n,r]of Object.entries(e))t["left"===n?"right":"right"===n?"left":n]=r;return t}const ui=e=>"left"===e?"right":"left",pi=[".shopify-section-group-header-group","#shopify-section-header",".shopify-section-header","sticky-header","header-component","header"],fi="#dori-react-widget-host";function hi(e){const t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom,height:t.height}}const gi={own:3e3,hook:6400};function mi(e){const t=e.codePointAt(0)??0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12352&&t<=12543?4:t>=44032&&t<=55215?3:t>=1536&&t<=1791||t>=1872&&t<=1919?1.6:1}function bi(e){const t=e?.feature_flags?.bubble_seconds;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:null}function xi(e){const t=e?.feature_flags?.bubble_stay;return"until_closed"===t?"until_closed":"seconds"===t&&null!==bi(e)?"seconds":"read"}function yi(e,t,n,r=gi.own){const o=xi(e);if("until_closed"===o)return null;if("seconds"===o)return 1e3*Math.min(20,Math.max(3,bi(e)));const a="own"===n?r:gi[n];return Math.min(1e4,Math.max(a,function(e){let t=0;for(const n of e)t+=mi(n);return Math.round(1e3+55*t)}(t)))}const vi=["homepage","category","product","search","cart","other"],wi={home:"homepage",collection:"category",product:"product",searchresults:"search",search:"search",cart:"cart"};function ki(){if("undefined"==typeof window)return"other";try{const e=window.ShopifyAnalytics?.meta?.page?.pageType;if("string"==typeof e&&e)return wi[e.toLowerCase()]??"other"}catch{}return Pt()}function Ci(e){return!(!function(e,t=ki()){const n=function(e){const t=e?.customization?.quiz_pages;if(!Array.isArray(t))return null;const n=vi.filter(e=>t.includes(e));return n.length?n:null}(e);return null===n||n.includes(t)}(e)||"product"===ki()&&$a(e))}const ji=({onClick:e,suppressBubble:t=!1,slot:n})=>{const{botData:r,diagnosticFlow:o,diagnosticShown:a,proactiveSuppressedThisSession:i,suppressProactiveForSession:s,effectiveFabCta:l,handover:c,handoverUnread:d}=ie(),{t:u}=le(),p=tn("colors","primary"),f=tn("colors","background"),h=tn("colors","lightBackground"),g=Re(p),m=Array.isArray(p)?p[0]:p,b=qt(f,h),x=function(e,t){if(t)return null;const n=e?.feature_flags?.fab_pill_each_page_seconds;return"number"!=typeof n||!Number.isFinite(n)||n<=0?null:Math.min(10,Math.max(1,n))}(r,!!sr(r)),y="until_closed"===xi(r)&&!r?.customization?.disable_welcome_popup,[v,w]=q.useState(()=>y&&!Ot()||!y&&!Nt()&&!Yt()&&S()||null!==x&&!yt()?"expanded":"minimized"),[k,C]=q.useState(!1),[j,E]=q.useState(!1),[A,R]=q.useState(!1),[_,T]=q.useState(!1),[W,I]=q.useState(!1),L=q.useRef(null),M=()=>{L.current&&(clearTimeout(L.current),L.current=null)},B=Pr(r?.merchant_support_channels).length>0,F=()=>{M(),!U&&B&&(R(!0),T(!0))};q.useEffect(()=>()=>M(),[]);const D=!0!==r?.customization?.disable_idle_animation,{getStarfieldTransform:H,getIconStyle:P}=ir({enableTwinkling:D,enableFloating:D,enableRotation:D,enableScaling:D}),N=q.useRef(!1),Y=q.useRef(0),V=q.useRef(null),U=ln({base:!0,md:!1})??!1,Z=cr(r,U),K=sr(r),Q=!!K,G=la(r,U),X=(e,t)=>function(e,t,n){return{base:`${Math.round(e*n)}px`,md:`${Math.round(t*n)}px`}}(e,t,G),J=function(e,t){return t&&!0===e?.feature_flags?.fab_transparent}(r,Q),$=function(e,t){return!t&&!0===e?.feature_flags?.fab_always_expanded}(r,Q),te=function(e){return!0===e?.feature_flags?.fab_icon_only}(r),ne=l??(r?.agent_name?u("askAgent").replace("{name}",r.agent_name):u("askDori")),re=q.useRef(null),[oe,se]=q.useState(null);q.useEffect(()=>{let e=!1;const t=()=>{const t=re.current;!e&&t&&se(t.scrollWidth)};return t(),document.fonts?.ready?.then(t).catch(()=>{}),()=>{e=!0}},[ne,U]);const ce=(()=>{if(null==oe)return{base:"120px",md:"150px"};const e=U?120:150,t=2*(U?8:12),n=Math.round((U?20:24)*G),r=U?280:360,o=t+8+n+oe+2;return`${Math.min(r,Math.max(e,o))}px`})(),he=!0===r?.customization?.enable_standalone_quiz&&Ci(r)&&o&&!a?o.welcome_hook:null,ge=!he,me=q.useRef(Yt()),be=y?Ot():i,xe=t||be||!y&&ge&&me.current?null:function(e,t){return t||function(e){return e?.feature_flags?.bubble_text?.trim()||null}(e)}(r,he),ye=()=>{if(y&&Ot())return;z();const e=++Y.current;w("expanded"),E(!1),I(!1);const t=setTimeout(()=>{if(Y.current===e&&(C(!0),!r?.customization?.disable_welcome_popup)){const t=setTimeout(()=>{if(Y.current!==e)return;E(!0);const t=yi(r,xe??"","own",1e3*(x??3));if(null===t)return;const n=setTimeout(()=>{Y.current===e&&(E(!1),setTimeout(()=>{Y.current===e&&w("minimized")},300))},t);return()=>clearTimeout(n)},100);return()=>clearTimeout(t)}},100);return()=>clearTimeout(t)},ve=()=>{w("minimized"),E(!1);const e=setTimeout(()=>{C(!0)},0);return()=>clearTimeout(e)},we=e=>{const t=++Y.current;w("expanded"),E(!1);const n=setTimeout(()=>C(!0),100),r=setTimeout(()=>{Y.current===t&&w("minimized")},100+1e3*e);return()=>{clearTimeout(n),clearTimeout(r)}};q.useEffect(()=>{N.current||(N.current=!0,y?Ot()||he?ve():ye():Nt()?null===x||yt()?ve():we(x):!he||r?.customization?.disable_welcome_popup?!Yt()&&S()?ye():null!==x?we(x):ve():ve())},[]),q.useEffect(()=>{const e=setInterval(()=>{Nt()||Yt()||S()&&ye()},1e3);return()=>clearInterval(e)},[]),q.useEffect(()=>{if(!he)return;if(r?.customization?.disable_welcome_popup)return;if(y?Ot():Nt())return;Y.current++,C(!0),V.current&&(clearTimeout(V.current),V.current=null),I(!0),w("expanded");const e=setTimeout(()=>{E(!0)},400),t=yi(r,he,"hook"),n=null===t?null:setTimeout(()=>{E(!1),V.current=setTimeout(()=>{w("minimized"),V.current=null},350)},t);return()=>{clearTimeout(e),n&&clearTimeout(n),V.current&&(clearTimeout(V.current),V.current=null)}},[he]);const ke=q.useRef(null);q.useEffect(()=>{if(j&&xe&&!r?.customization?.disable_welcome_popup){if(ge){if(Yt())return;return Vt(),void Ut(!1)}ke.current!==xe&&(ke.current=xe,Ut(!0))}},[j,xe]);const Ce=()=>{Kt(),e&&(e(),"minimized"===v&&(E(!1),setTimeout(()=>{w("expanded"),setTimeout(()=>{r?.customization?.disable_welcome_popup||setTimeout(()=>{E(!0)},50)},100)},0)))},je=Ce,Se=te||!$&&("minimized"===v||Q),ze=function(e){const t=e.hasAvatarFab&&e.animationsEnabled&&e.isMinimized&&!e.isMenuOpen;return{breathe:t,halo:t&&!e.isTransparentFab}}({hasAvatarFab:Q,animationsEnabled:D,isMinimized:Se,isMenuOpen:A,isTransparentFab:J}),Ee=dr(Z,r,U),Ae="right"===Z.align?"32px 0px 32px 32px":"0px 32px 32px 32px";return O.jsxs(ae,{position:"relative",transform:k?Ee?"translateY(0) scale(1)":`translateY(calc(-50% + ${Z.bottomSpacing}px)) scale(1)`:Ee?"translateY(100px) scale(0.9)":`translateY(calc(-50% + ${Z.bottomSpacing}px + 100px)) scale(0.9)`,opacity:k?1:0,onMouseLeave:()=>{U||(M(),L.current=setTimeout(()=>{R(!1),T(!1)},100))},children:[O.jsx(Or,{channels:r?.merchant_support_channels,isOpen:A,onToggle:()=>R(!A),isMobile:U,onMouseEnter:F,onChatClick:e}),O.jsx(ae,{visibility:A?"hidden":void 0,"aria-hidden":A||void 0,children:n}),"expanded"===v&&xe&&!r?.customization?.disable_welcome_popup&&O.jsx(ae,{position:"absolute",bottom:"100%",[Z.align]:"0",mb:2,w:{base:"70vw",md:"25vw"},maxW:{base:"300px",md:"300px"},bg:b,borderRadius:"16px",p:2,pe:3,boxShadow:W?"0 8px 32px rgba(0,0,0,0.16), 0 0 0 1.5px rgba(120,120,200,0.13)":"lg",opacity:j?1:0,transform:j?"translateY(0) scale(1)":W?"translateY(20px) scale(0.88)":"translateY(10px) scale(0.95)",transition:j?W?"opacity 0.5s ease, transform 0.7s cubic-bezier(0.22, 1.61, 0.36, 1), box-shadow 0.4s ease":"opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)":"opacity 0.25s ease, transform 0.25s ease",cursor:"pointer",onClick:je,children:O.jsxs(ue,{gap:1,align:"center",width:"100%",justifyContent:"flex-start",children:[O.jsx(fn,{size:"xs",variant:"ghost","aria-label":"Close",onClick:e=>{e.stopPropagation(),s(),Dt(),Bt(),Ca(),E(!1),setTimeout(()=>w("minimized"),300)},color:"text",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"rgba(0,0,0,0.1)"}},h:"auto",p:1,children:O.jsx(wn,{boxSize:"16px"})}),O.jsx(fe,{fontSize:"12px",fontWeight:"400",color:"text",lineHeight:"1.75",flex:1,width:"100%",fontFamily:pe,children:xe})]})}),ze.breathe&&O.jsx("style",{children:"\n @keyframes dori-avatar-breathe {\n 0%, 100% { scale: 1; }\n 50% { scale: 1.06; }\n }\n @keyframes dori-avatar-halo {\n 0% { box-shadow: 0 0 0 0 var(--dori-halo); }\n 70%, 100% { box-shadow: 0 0 0 12px var(--dori-halo-end); }\n }\n .dori-avatar-breathe {\n animation: dori-avatar-breathe 3s ease-in-out infinite;\n }\n .dori-avatar-breathe.dori-avatar-halo {\n animation:\n dori-avatar-breathe 3s ease-in-out infinite,\n dori-avatar-halo 3s ease-out infinite;\n }\n @media (prefers-reduced-motion: reduce) {\n .dori-avatar-breathe { animation: none !important; }\n }\n "}),O.jsx(ee,{borderRadius:Se?"50%":Ae,borderWidth:0,bg:J?"transparent":g,color:"text",border:"none !important",w:Se?X(48,56):ce,minW:Se?X(48,56):ce,h:Se?X(48,56):"auto",p:Se?"0":{base:2,md:3},overflow:"hidden",transition:"width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), min-width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 0.4s ease, padding 0.3s ease, transform 0.2s ease",onClick:Ce,className:["fab-glass",ze.breathe&&"dori-avatar-breathe",ze.halo&&"dori-avatar-halo"].filter(Boolean).join(" "),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.05)"}},style:{borderRadius:Se?"50%":Ae,cursor:"pointer",touchAction:"manipulation",WebkitTapHighlightColor:"transparent",...ze.halo?{"--dori-halo":Zt(m,.5),"--dori-halo-end":Zt(m,0)}:{}},onMouseEnter:F,justifyContent:"center",children:O.jsxs(ue,{gap:Se?0:2,position:"relative",w:"full",justify:Se?"center":"space-between",overflow:"hidden",children:[O.jsx(fe,{fontSize:{base:"14px",md:"16px"},fontWeight:{base:"500",md:"600"},lineHeight:"1.5",whiteSpace:"nowrap",fontFamily:pe,color:"background",opacity:Se?0:1,maxW:Se?"0px":"none",transition:"opacity 0.2s ease, max-width 0.35s ease",overflow:"hidden",ref:re,children:ne}),!A&&(K?O.jsx(de,{src:K,alt:"",role:"presentation",boxSize:X(52,60),borderRadius:"full",objectFit:"cover",flexShrink:0}):O.jsx(Fn,{boxSize:X(20,24),color:"background",transform:H(v,Z),...P(),flexShrink:0}))]})}),d>0&&!A&&O.jsx(ae,{position:"absolute",top:X(-6,-6),..."right"===Z.align?{left:X(-6,-6)}:{right:X(-6,-6)},minW:"20px",h:"20px",px:"5px",borderRadius:"full",bg:"#E5484D",color:"white",fontSize:"12px",fontWeight:"600",fontFamily:pe,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",boxShadow:"0 0 0 2px white",role:"status","aria-label":u("handoverUnread").replace("{team}",c?.teamName||u("handoverTheTeam")),"data-dori-handover-unread":d,children:d>9?"9+":d})]})};let Si=!1;const zi=q.forwardRef(function({bubble:e,settled:t,styles:n,onClick:r,quiz:o,sheetLayer:a},i){const{botData:s}=ie(),l=ln({base:!0,md:!1})??!1,[c,d]=q.useState(!1),u=ni(s,!1!==s?.customization?.enable_offer_guide&&t&&!c),p=$a(s),[f,h]=q.useState(!1);q.useEffect(()=>{if(!p||!t||u.looked)return;const e=window.setTimeout(()=>h(!0),5e3);return()=>window.clearTimeout(e)},[p,t,u.looked]),q.useEffect(()=>{u.view&&(Si=!0)},[u.view]);const g=!p||u.looked||f,m=Si||!!u.view,b=c?"quiz":u.view?"guide":o.eligible&&t&&g&&!m?"quiz":null,x=function({speaking:e,onOpenWidget:t,onStartChat:n,onDismissed:r,onEngagedChange:o}){const{diagnosticFlow:a,diagnosticShown:i,markDiagnosticShown:s,effectiveLanguage:l,informalAddress:c,suppressProactiveForSession:d}=ie(),[u,p]=q.useState("hidden"),[f,h]=q.useState(!1),g=!!a&&!i&&!ka();return q.useEffect(()=>{o("expanded"===u)},[u]),q.useEffect(()=>()=>o(!1),[]),q.useEffect(()=>{if("expanded"!==u){if("hidden"===u&&e&&g){const e=setTimeout(()=>p("teaser"),800);return()=>clearTimeout(e)}"teaser"!==u||e&&g||p("hidden")}},[u,e,g]),q.useEffect(()=>{"teaser"!==u||li||(li=!0,C()?.capture("quiz_card_impression",{presentation:"pill"}))},[u]),{phase:u,open:f,flow:a,text:si(l||"English",c),handleStart:()=>{"expanded"!==u&&C()?.capture("quiz_card_started",{presentation:"pill"}),p("expanded"),h(!0)},handleDismiss:()=>{Ca(),d(),Bt(),Dt(),C()?.capture("quiz_card_dismiss",{phase:u,presentation:"pill"}),h(!1),p("hidden"),r?.()},handleCollapse:()=>h(!1),handleComplete:(e,t)=>{s(),C()?.capture("quiz_card_completed"),h(!1),p("hidden"),n(e,void 0,t),C()?.capture("quiz_card_widget_opened")},handleSkipToChat:()=>{Ca(),s(),C()?.capture("quiz_card_skip_to_chat"),h(!1),p("hidden"),r?.(),t()}}}({speaking:"quiz"===b,onStartChat:o.onStartChat,onOpenWidget:o.onOpenWidget,onDismissed:o.onDismissed,onEngagedChange:d}),y=cr(s,l),v=Math.round((l?48:56)*la(s,l)),w=dr(y,s,l),k=`calc(100vw - ${2*y.sideSpacing}px)`,j=`min(${l?340:360}px, ${k})`,S=`min(400px, ${k})`,z=e=>w?`max(240px, calc(100vh - ${ur(y,s)+(e?v+8:0)+16}px))`:`max(240px, calc(50vh + ${y.bottomSpacing+(e?-v/2-8:v/2)-16}px))`,E=z(e),A=l&&function(e){return"under_header"===e?.feature_flags?.quiz_mobile_place}(s),R=function(e){const[t,n]=q.useState(8);return q.useEffect(()=>{if(!e)return;let t=0;const r=()=>{t=0,n(function(){const e=[];for(const n of pi)document.querySelectorAll(n).forEach(t=>{t.closest(fi)||e.push(hi(t))});const t=window.innerWidth;for(const n of[8,t/2,t-8])for(const t of document.elementsFromPoint(n,1))if(!t.closest(fi))for(let n=t;n&&n!==document.body;n=n.parentElement){const t=getComputedStyle(n).position;"fixed"!==t&&"sticky"!==t||e.push(hi(n))}return function(e,t){let n=0;for(const r of e)r.height<=0||r.bottom<=0||r.top>.25*t||r.bottom>.4*t||(n=Math.max(n,r.bottom));return Math.round(n)}(e,window.innerHeight)}()+8)},o=()=>{t||(t=window.requestAnimationFrame(r))};r();const a=window.setTimeout(r,1500);return window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o),()=>{window.clearTimeout(a),t&&window.cancelAnimationFrame(t),window.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[e]),t}(A),_=!A&&"opposite"===function(e){return"opposite"===e?.customization?.quiz_position?"opposite":"launcher"}(s),T=l&&e,W=e&&!l?`calc(100vw - ${2*y.sideSpacing+v+16}px)`:k,I=_?{pillMaxW:`min(${l?340:360}px, ${W})`,panelW:`min(400px, ${W})`,panelMaxH:z(T)}:{pillMaxW:j,panelW:S,panelMaxH:E},L=("quiz"===b||c)&&O.jsx(ci,{quiz:x,isMobile:l,layer:a,...I}),M=O.jsxs(ae,{position:"absolute",bottom:e?"100%":0,mb:e?2:0,[y.align]:0,w:"max-content","data-dori-corner-slot":"",children:[O.jsx(va,{api:u,isMobile:l,layer:a,pillMaxW:j,panelW:S,panelMaxH:E}),!_&&!A&&L]}),B=_&&L?O.jsx(ae,{position:"fixed",zIndex:"1000000",...di(n),children:O.jsx(ae,{position:"relative",h:`${v}px`,transform:w?void 0:`translateY(calc(-50% + ${y.bottomSpacing}px))`,children:O.jsx(ae,{position:"absolute",bottom:T?`${v+8}px`:0,[ui(y.align)]:0,w:"max-content","data-dori-corner-slot":"","data-dori-quiz-corner":"",children:L})})}):null,F=A&&L?O.jsx(ae,{position:"fixed",zIndex:"1000000",top:`${R}px`,left:"50%",transform:"translateX(-50%)",w:"max-content",maxW:k,"data-dori-corner-slot":"","data-dori-quiz-under-header":"",children:L}):null,D=null!==b||m||o.eligible&&!g;return e?O.jsxs(O.Fragment,{children:[O.jsx(ae,{ref:i,position:"fixed",zIndex:"1000000",...n,children:O.jsx(ji,{onClick:r,suppressBubble:D,slot:M})}),B,F]}):O.jsxs(O.Fragment,{children:[O.jsx(ae,{position:"fixed",zIndex:"1000000",...n,children:O.jsx(ae,{position:"relative",h:`${v}px`,transform:w?void 0:`translateY(calc(-50% + ${y.bottomSpacing}px))`,children:M})}),B,F]})}),Ei="dori-chat",Ai="#dori-chat",Ri={open:!1,expand:!1};function _i(){if("undefined"==typeof window)return!1;try{const e=window.DORI_HIDE_LAUNCHER;if(!0===e||"true"===e)return!0;const t=document.querySelector("script#dori-side-widget");return"true"===t?.getAttribute("data-hide-launcher")}catch{return!1}}function Ti({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return!(r||"never"===e||"fallback"===e&&t&&!1!==n)}function Wi({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return r||"fallback"!==e||!t||null!==n}function Ii(){const[e,t]=q.useState(()=>{const e=document.querySelector("script#dori-side-widget");return"true"===e?.getAttribute("data-test-mode")}),[n,r]=q.useState(!1),[s,l]=q.useState(_i),[c,d]=q.useState(()=>window.__doriAskResult??null),[u,p]=q.useState(!1),f=c?c.placed:!u&&null,[h,g]=q.useState(""),{botData:m,botError:b,updateBotData:x,diagnosticFlow:y,diagnosticShown:v,onWidgetOpened:w,setPanelOpen:k}=ie(),C=se(),j=q.useRef(m);j.current=m;const S=q.useRef(null),z=q.useCallback(e=>{const t=L(e);if(!t)return!1;const n=j.current;if(!n)return S.current=e??{},!0;const r=R(n.feature_flags,o(),t);return!!r&&(window.location.assign(r),!0)},[]);q.useEffect(()=>{const e=S.current;m&&e&&(S.current=null,window.doriWidget?.open?.(e))},[m]),function(e){const{isTestMode:t,sendMessage:n,submitFeedback:r,messages:o,inputState:a,chatState:i}=ie(),s=q.useRef({open:e,sendMessage:n,submitFeedback:r});s.current={open:e,sendMessage:n,submitFeedback:r},q.useEffect(()=>{if(!t)return;const e=window,n=e=>{const t=String(e||"").trim();t&&(s.current.open(),s.current.sendMessage({message:t}))};return e.doriWidget={...e.doriWidget,ask:n,rateAnswer:(e,t,n)=>s.current.submitFeedback(e,t,n)},()=>{e.doriWidget?.ask===n&&(delete e.doriWidget.ask,delete e.doriWidget.rateAnswer)}},[t]);const l=q.useRef(o);l.current=o;const c=q.useRef(i.threadId);c.current=i.threadId;const d=q.useRef(!1);q.useEffect(()=>{const e="generating"===a,n=d.current&&!e;if(d.current=e,!t||!n)return;const r=window.setTimeout(()=>{const e=l.current.filter(e=>"dori"===e.type),t=e[e.length-1];t&&t.content?.trim()&&window.dispatchEvent(new CustomEvent("dori:test-answer",{detail:{widget:"side",index:e.length-1,text:t.content,threadId:c.current??null}}))},400);return()=>window.clearTimeout(r)},[a,t])}(()=>{V.current="api_open",t(!0)});const N=!0===m?.feature_flags?.panel_drawer,Y=n&&!C.isMini&&!N,V=q.useRef("unknown"),U=q.useRef(e),Z=q.useRef(e);Z.current=e,q.useEffect(()=>{e&&!U.current&&(w(),i("widget_opened",{assistantId:m?.assistant_id,payload:{trigger:V.current}}),V.current="unknown"),U.current=e},[e,m?.assistant_id,w]),q.useEffect(()=>{k(e)},[e,k]);const[K,Q]=q.useState(null),G=m?.assistant_id;q.useEffect(()=>{_()},[]),q.useEffect(()=>{K&&G&&(Q(null),i(K.event,{assistantId:G,payload:{intent:K.intent}}))},[K,G]),q.useEffect(()=>{if(G)return T(e=>i("banner_seen",{assistantId:G,payload:{intent:e}}))},[G]);const[X,J]=q.useState(null),[$,ee]=q.useState(!1),te=!0===m?.feature_flags?.base_channel&&!0===m?.customization?.disable_welcome_popup,ne=!0===m?.customization?.enable_standalone_quiz&&Ci(m)&&!!y&&!v&&!$&&!e&&!ka()&&!te&&!xt(),[re,oe]=q.useState(null),{isCurrentPathBanned:le}=(e=>{const[t,n]=q.useState("");return q.useEffect(()=>{const e=()=>{n(E())};e();const t=()=>{e()};window.addEventListener("popstate",t);const r=history.pushState,o=history.replaceState;return history.pushState=function(...t){r.apply(history,t),e()},history.replaceState=function(...t){o.apply(history,t),e()},()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=o}},[]),{isCurrentPathBanned:()=>A(t,e)}})(m?.banned_paths||[]);q.useEffect(()=>{e&&Dt()},[e]),q.useEffect(()=>{!function(e,t){if(!e)return;const n=function(e){return"number"==typeof e&&Number.isInteger(e)?e<1||e>2147483647?null:e:null}(t);if(null===n)return e.style.removeProperty("position"),void e.style.removeProperty("z-index");e.style.position="relative",e.style.zIndex=String(n)}(document.getElementById("dori-react-widget-host"),m?.feature_flags?.widget_z_index)},[m?.feature_flags?.widget_z_index]),q.useEffect(()=>{m?.merchant_support_channels?.crisp?.enabled&&(fr(),pr()&&window.$crisp.push(["on","chat:closed",()=>{fr()}]))},[m?.merchant_support_channels?.crisp?.enabled]),q.useEffect(()=>{m?.merchant_support_channels?.chatra?.enabled&&(jr("hideChatraWidget invoked"),br=!0,function(e){if(Sr())return void e();const t=Date.now(),n=setInterval(()=>{Sr()?(clearInterval(n),e()):Date.now()-t>gr&&(clearInterval(n),jr("Chatra never became ready within",gr,"ms"))},200)}(()=>{xr||Er("initial hide")}),null!==yr||"undefined"==typeof window||xr||(vr=Date.now(),yr=setInterval(Rr,1e3)))},[m?.merchant_support_channels?.chatra?.enabled]),q.useEffect(()=>{m?.merchant_support_channels?.shopifyInbox?.enabled&&function(){if("undefined"==typeof document)return;if(document.getElementById(Wr))return;const e=document.createElement("style");e.id=Wr,e.textContent=`\n html:not([${Ir}]) ${Lr}::part(activator) { display: none !important; }\n html:not([${Ir}]) ${Mr} { display: none !important; }\n `,document.head.appendChild(e),Fr("launcher hidden")}()},[m?.merchant_support_channels?.shopifyInbox?.enabled]),q.useEffect(()=>{if(!h||!m?.is_widget_enabled)return;const e=window.setTimeout(()=>{Qt(a.klaviyoStorefront,h)},4e3);return()=>window.clearTimeout(e)},[h,m?.is_widget_enabled]),Gt({sharingId:h});const ce=ln({base:!0,md:!1})??!1,de=cr(m,ce),ue=((e,t=!1,n=null)=>{const{align:r,sideSpacing:o}=e;return t?{bottom:`${ur(e,n)}px`,[r]:`${o}px`}:{top:"50%",[r]:`${o}px`}})(de,dr(de,m,ce),m);q.useEffect(()=>{window.chatbotData?g(window.chatbotData.sharingID):W("useEffect sharing ID",()=>{g((()=>{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||""})());const e=document.querySelector("script#dori-side-widget");if(!e)return;const t=new MutationObserver(t=>{for(const n of t)if("attributes"===n.type&&"data-sharing-id"===n.attributeName){const t=e.getAttribute("data-sharing-id")||"";g(t),console.log("data-sharing-id changed:",t)}});return t.observe(e,{attributes:!0,attributeFilter:["data-sharing-id"]}),()=>{t.disconnect()}})()},[]);const pe=q.useRef(null),fe=q.useRef(!1),he=q.useRef(null);q.useEffect(()=>{const e=e=>d(e.detail??null);return window.addEventListener("dori:ask-button",e),()=>window.removeEventListener("dori:ask-button",e)},[]);const ge=Boolean(m?.feature_flags?.ask_button);q.useEffect(()=>{if(!ge||c)return;const e=setTimeout(()=>p(!0),4e3);return()=>clearTimeout(e)},[ge,c]);const me={mode:m?.feature_flags?.bubble_mode,askOn:ge,askPlaced:f,pageHidden:s},be=c??(ge&&u?{zone:"none",device:rn()}:null);q.useEffect(()=>{if(!be||be.pending||!m?.assistant_id)return;let e=!0;try{e=on(window.sessionStorage,be.device)}catch{}e&&i("header_entry",{assistantId:m.assistant_id,payload:{zone:be.zone,spot:be.spot,label:be.label,device:be.device}})},[be?.zone,be?.device,be?.pending,m?.assistant_id]);const xe=q.useCallback(()=>{const e=document.getElementById("dori-react-widget-host");e&&e.contains(document.activeElement)&&(fe.current=!0),t(!1)},[]);q.useEffect(()=>{if(!e)return;const t=e=>{if("Escape"!==e.key)return;const t=document.getElementById("dori-react-widget-host");if(!(e.target instanceof Node))return;const n=he.current;(n&&n.contains(e.target)||t&&t.contains(e.target))&&setTimeout(()=>{e.defaultPrevented||xe()},0)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,xe]);const ye=Yn(),ve=q.useRef(ye);ve.current=ye,q.useEffect(()=>{if(!e||!ve.current)return;const t=setTimeout(()=>{(function(){const e=document.getElementById("dori-react-widget-host");if(!e)return null;const t=[e];for(;t.length;){const e=t.shift();for(const t of e.querySelectorAll("textarea"))if(t.getClientRects().length)return t;for(const n of e.querySelectorAll("*"))n.shadowRoot&&t.push(n.shadowRoot)}return null})()?.focus({preventScroll:!0})},350);return()=>clearTimeout(t)},[e]),q.useEffect(()=>{if(e||!fe.current)return;fe.current=!1;const t=he.current;he.current=null;const n=requestAnimationFrame(()=>{t?.isConnected?t.focus({preventScroll:!0}):pe.current?.querySelector("button.fab-glass")?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[e]),q.useEffect(()=>{const e=e=>{if(z(e))return;if(M(Z.current,e?.source))return void t(!1);const n=P(e),o="banner_link"===e?.source;V.current=n?o?"banner_link":"banner":e?.source??"api_open";const a=document.activeElement,i=document.getElementById("dori-react-widget-host");if(he.current=a instanceof HTMLElement&&a!==document.body&&!i?.contains(a)?a:null,t(!0),e?.expand&&r(!0),n){const t=B(e),n=F(t),{firstTap:r,sendOpener:a}=D(n);r&&Q({intent:n,event:o?"banner_link_tapped":"banner_tapped"});const i=a?H(n,t?.initiator):null;i&&J(i)}},n=()=>t(!1),o=e=>{"cart"===e.detail?.reason&&(Ca(),ee(!0)),n()},a=()=>{V.current="api_toggle",t(e=>!e)},i=e=>{x(e)},s=()=>l(!0),c=()=>l(!1),d=window;d.doriWidget={...d.doriWidget,open:e,close:n,toggle:a,updateConfig:i,hideLauncher:s,showLauncher:c},I(t=>e(t));const u=t=>{const n=t.detail;e(n)};return window.addEventListener("dori:open-widget",u),window.addEventListener("dori:close-widget",o),window.addEventListener("dori:toggle-widget",a),window.addEventListener("dori:hide-launcher",s),window.addEventListener("dori:show-launcher",c),()=>{d.doriWidget&&(d.doriWidget.open===e&&delete d.doriWidget.open,d.doriWidget.close===n&&delete d.doriWidget.close,d.doriWidget.toggle===a&&delete d.doriWidget.toggle,d.doriWidget.updateConfig===i&&delete d.doriWidget.updateConfig,d.doriWidget.hideLauncher===s&&delete d.doriWidget.hideLauncher,d.doriWidget.showLauncher===c&&delete d.doriWidget.showLauncher),window.removeEventListener("dori:open-widget",u),window.removeEventListener("dori:close-widget",o),window.removeEventListener("dori:toggle-widget",a),window.removeEventListener("dori:hide-launcher",s),window.removeEventListener("dori:show-launcher",c)}},[x,z]),q.useEffect(()=>{const e=function(){if("undefined"==typeof window)return Ri;try{const e=new URLSearchParams(window.location.search).get(Ei)?.trim().toLowerCase();if("banner"===e)return{open:!0,expand:!0,banner:!0};if("open"===e||"expand"===e)return{open:!0,expand:"expand"===e};if(window.location.hash.toLowerCase()===Ai)return{open:!0,expand:!1}}catch{}return Ri}();e.open&&(function(){if("undefined"!=typeof window&&window.history?.replaceState)try{const e=new URL(window.location.href);let t=!1;e.searchParams.has(Ei)&&(e.searchParams.delete(Ei),t=!0),e.hash.toLowerCase()===Ai&&(e.hash="",t=!0),t&&window.history.replaceState(window.history.state,"",e.toString())}catch{}}(),e.banner?window.doriWidget?.open?.({source:"banner_link",expand:!0}):e.expand&&z({expand:!0,source:"link"})||(V.current="deep_link",t(!0),e.expand&&r(!0)))},[z]);const we=Xt({botData:m,botError:b,isPathBanned:le()});b&&!m&&console.warn("[Dori Widget] bot data unavailable — hiding widget:",b);const ke=q.useCallback((e,n,r)=>{ee(!0),J({message:e,imageUrl:n,apiMessage:r}),V.current="quiz_chat",t(!0)},[]),Ce=q.useCallback(()=>{J(null)},[]);return O.jsx(ae,{fontFamily:Jt("system-ui, Avenir, Helvetica, Arial, sans-serif"),lineHeight:"1.5",fontWeight:"400",colorScheme:"light",children:!we&&O.jsxs(O.Fragment,{children:[O.jsx(sa,{isOpen:e,onClose:xe,isExpanded:Y,onToggleExpand:C.isMini||N?void 0:e=>r(void 0===e?!Y:e),fullPageHref:R(m?.feature_flags,o(),"chat"),pendingChat:X,onPendingChatConsumed:Ce}),!e&&O.jsx(zi,{ref:pe,bubble:Ti(me),settled:Wi(me),styles:ue,onClick:()=>{e||(V.current="fab",he.current=null),t(!e)},quiz:{eligible:ne,onStartChat:ke,onOpenWidget:()=>{V.current="quiz_card",t(!0)},onDismissed:()=>ee(!0)},sheetLayer:re}),O.jsx(ae,{ref:oe,"data-dori-corner-layer":""})]})})}function Li(){return O.jsx(Ii,{})}console.log("isDevelopment",!1);let Mi=!1;function Bi(){if(Mi)return console.log("[Dori Widget] Already initialized, skipping"),()=>{};Mi=!0;const e=[];let t=document.getElementById("dori-react-widget-host");t||(t=document.createElement("div"),t.id="dori-react-widget-host",t.setAttribute("data-nosnippet",""),document.body.appendChild(t));const n=$t.createRoot(t);n.render(O.jsx(oe.StrictMode,{children:O.jsx(Xe,{children:O.jsx(en,{children:O.jsx(Li,{})})})})),e.push(n);const r=()=>{v(()=>import("./MarkdownContent-D7AdAAbE.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})};return"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r,{timeout:3e3}):window.setTimeout(r,1500),()=>{e.forEach(e=>e.unmount()),Mi=!1}}export{Bi as initializeDoriWidget};
|