@neurodyn/ai-try-on 0.1.0 → 0.1.2
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.
|
@@ -5506,4 +5506,4 @@ ${f}
|
|
|
5506
5506
|
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
|
|
5507
5507
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5508
5508
|
|
|
5509
|
-
Defaulting to \`null\`.`));let c=fk(o,u)?o:null,d=fw(c)?s(c,u):void 0;return(0,A.jsx)(fh,{scope:a,value:c,max:u,children:(0,A.jsx)(fu.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fw(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fb(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});fg.displayName=fc;var fm="ProgressIndicator",fv=L.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=ff(fm,r);return(0,A.jsx)(fu.div,{"data-state":fb(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fy(e,t){return`${Math.round(e/t*100)}%`}function fb(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fw(e){return"number"==typeof e}function fx(e){return fw(e)&&!isNaN(e)&&e>0}function fk(e,t){return fw(e)&&!isNaN(e)&&e<=t&&e>=0}function fS({className:e,value:t,max:r=100,...n}){let a=r>0?r:100,o="number"==typeof t?Math.min(Math.max(t/a*100,0),100):0;return(0,A.jsx)(fg,{"data-slot":"progress",className:i2("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:a,...n,children:(0,A.jsx)(fv,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fC(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...e,children:(0,A.jsx)("path",{d:"M8.21723 14.9975C8.10298 14.997 7.99004 14.9731 7.8854 14.9272C7.78077 14.8814 7.68665 14.8145 7.60889 14.7308L3.55889 10.4225C3.4075 10.2611 3.3264 10.0463 3.33343 9.82513C3.34046 9.604 3.43505 9.39471 3.59639 9.24332C3.75773 9.09192 3.97261 9.01082 4.19374 9.01785C4.41488 9.02489 4.62417 9.11948 4.77556 9.28082L8.20889 12.9392L15.2172 5.27248C15.2883 5.18392 15.3768 5.11083 15.4772 5.0577C15.5776 5.00458 15.6878 4.97254 15.8011 4.96355C15.9143 4.95456 16.0282 4.96882 16.1357 5.00544C16.2432 5.04207 16.3421 5.10029 16.4263 5.17652C16.5105 5.25276 16.5782 5.3454 16.6253 5.44877C16.6724 5.55213 16.6979 5.66403 16.7001 5.7776C16.7024 5.89116 16.6815 6.00399 16.6385 6.10916C16.5956 6.21433 16.5316 6.30961 16.4506 6.38915L8.83389 14.7225C8.75686 14.8077 8.66308 14.8761 8.55841 14.9234C8.45373 14.9707 8.34042 14.996 8.22556 14.9975H8.21723Z",fill:"currentColor"})})}function fP(e){return(0,A.jsxs)("svg",{fill:"none",viewBox:"0 0 19.9993 19.9996",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,A.jsx)("path",{d:"M16 9C16 7.14348 15.2629 5.36256 13.9502 4.0498C12.6374 2.73705 10.8565 2 9 2C7.14348 2 5.36256 2.73705 4.0498 4.0498C2.73705 5.36256 2 7.14348 2 9C2 10.8565 2.73705 12.6374 4.0498 13.9502C5.36256 15.2629 7.14348 16 9 16C10.8565 16 12.6374 15.2629 13.9502 13.9502C15.2629 12.6374 16 10.8565 16 9ZM18 9C18 11.3869 17.0521 13.6764 15.3643 15.3643C13.6764 17.0521 11.3869 18 9 18C6.61305 18 4.32357 17.0521 2.63574 15.3643C0.947915 13.6764 0 11.3869 0 9C0 6.61305 0.947915 4.32357 2.63574 2.63574C4.32357 0.947915 6.61305 0 9 0C11.3869 0 13.6764 0.947915 15.3643 2.63574C17.0521 4.32357 18 6.61305 18 9Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M13.9428 13.943C14.3333 13.5525 14.9663 13.5525 15.3568 13.943L19.7064 18.2926C20.097 18.6832 20.097 19.3162 19.7064 19.7067C19.3159 20.0972 18.6829 20.0972 18.2924 19.7067L13.9428 15.3571C13.5522 14.9666 13.5522 14.3335 13.9428 13.943Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 12.0001V6.00008C7.99983 5.4478 8.44755 5.00008 8.99983 5.00008C9.55211 5.00008 9.99983 5.4478 9.99983 6.00008V12.0001C9.99983 12.5524 9.55211 13.0001 8.99983 13.0001C8.44755 13.0001 7.99983 12.5524 7.99983 12.0001Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M11.9998 8.00008C12.5521 8.00008 12.9998 8.4478 12.9998 9.00008C12.9998 9.55237 12.5521 10.0001 11.9998 10.0001H5.99983C5.44755 10.0001 4.99983 9.55237 4.99983 9.00008C4.99983 8.4478 5.44755 8.00008 5.99983 8.00008H11.9998Z",fill:"currentColor"})]})}function fE({children:e,className:t,...r}){return(0,A.jsx)("div",{className:i2("relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100",t),...r,children:e})}function fT({className:e,src:t}){return(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:t}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"})]})}function fR({backdropClassName:e,className:t,fallbackSrc:r,imageClassName:n,photo:a}){let o=a?.src??r;function i(e){r&&(e.currentTarget.src=r)}return(0,A.jsxs)(A.Fragment,{children:[o&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",t,e),src:o,onError:i}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"}),o&&(0,A.jsx)("img",{alt:a?.name??"",className:i2("absolute inset-0 size-full object-contain",t,n),src:o,onError:i})]})}function fO({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return(0,A.jsxs)(A.Fragment,{children:[n&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:n,onError:e=>{t&&(e.currentTarget.src=t)}}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/20"})]})}function fj({className:e,...t}){let r=(0,L.useId)().replace(/:/g,""),n=`${r}-loading-texture-gradient`,a=`${r}-loading-texture-pattern`,o=`${r}-loading-texture-mask`;return(0,A.jsxs)("svg",{className:i2("text-constant-white",e),fill:"none",focusable:"false",viewBox:"0 0 776 992",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,A.jsxs)("defs",{children:[(0,A.jsxs)("radialGradient",{id:n,cx:"0",cy:"0",gradientTransform:"translate(388 496) rotate(90) scale(1021)",gradientUnits:"userSpaceOnUse",r:"1",children:[(0,A.jsx)("stop",{stopColor:"currentColor",stopOpacity:"0.7"}),(0,A.jsx)("stop",{offset:"0.586538",stopColor:"currentColor",stopOpacity:"0"})]}),(0,A.jsx)("pattern",{id:a,width:"24",height:"24",patternUnits:"userSpaceOnUse",children:(0,A.jsx)("circle",{cx:"4",cy:"4",r:"4",fill:"currentColor"})}),(0,A.jsx)("mask",{id:o,children:(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${a})`})})]}),(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${n})`,mask:`url(#${o})`})]})}function fN({animated:e=!1,className:t,...r}){return(0,A.jsxs)("div",{"aria-hidden":"true",className:i2("absolute h-133 w-104 max-w-none",t),...r,children:[!e&&(0,A.jsx)(fj,{className:"absolute inset-0 size-full opacity-30"}),e&&(0,A.jsx)("span",{className:"absolute inset-0 [mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [mask-position:center] [mask-repeat:no-repeat] [mask-size:18%_18%] [-webkit-mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [-webkit-mask-position:center] [-webkit-mask-repeat:no-repeat] [-webkit-mask-size:18%_18%] animate-[ai-try-on-loading-texture-pulse_2.6s_linear_infinite] motion-reduce:animate-none motion-reduce:[mask-size:220%_220%] motion-reduce:[-webkit-mask-size:220%_220%]",children:(0,A.jsx)(fj,{className:"absolute inset-0 size-full opacity-70"})})]})}function fz({badge:e,className:t,fallbackSrc:r,photo:n,selected:a,...o}){return(0,A.jsxs)("button",{className:i2("group relative aspect-square w-full overflow-hidden rounded-xl bg-background-base-2 text-left ring-offset-2 transition","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground",a?"ring-2 ring-foreground":null,t),type:"button",...o,children:[n?.src?(0,A.jsx)("img",{alt:n.name??"",className:"size-full object-cover",src:n.src}):r?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:r}):null,a&&(0,A.jsx)("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-foreground text-background-containers",children:(0,A.jsx)(fC,{className:"size-4"})}),e&&(0,A.jsx)("span",{className:"absolute right-2 top-2",children:e})]})}function f_({className:e,label:t,progress:r=0,...n}){let a=Math.min(Math.max(r,0),100);return(0,A.jsxs)("div",{className:i2("rounded-xl bg-background-base px-6 py-8",e),...n,children:[(0,A.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm font-medium text-text-sub",children:[(0,A.jsx)("span",{children:t}),(0,A.jsxs)("span",{children:[Math.round(a),"%"]})]}),(0,A.jsx)(fS,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fA({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return n?(0,A.jsx)("img",{alt:r?.name??"",className:i2("absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover",e),src:n,onError:e=>{t&&(e.currentTarget.src=t)}}):null}function fL({className:e,imageSrc:t,name:r}){return t?(0,A.jsx)("img",{alt:r??"",className:i2("absolute bottom-2 left-2 h-30 w-auto rounded-xl border border-background-containers bg-background-containers object-contain shadow-md",e),src:t}):null}function fI({good:e,imageSrc:t,label:r}){return(0,A.jsxs)("figure",{className:"flex min-w-0 flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"relative aspect-square w-full overflow-hidden rounded-xl border border-border-light bg-background-base",children:[(0,A.jsx)("img",{alt:r,className:"size-full object-cover",src:t}),(0,A.jsx)("span",{className:i2("absolute right-2 top-2 flex size-7 items-center justify-center rounded-full",e?"bg-background-green":"bg-background-red"),children:e?(0,A.jsx)(fC,{className:"size-5 text-background-containers"}):(0,A.jsx)(fr,{className:"size-5 text-background-containers"})})]}),(0,A.jsx)("figcaption",{className:"w-[90%] break-words text-xs font-medium leading-[1.6] tracking-[0.02em] text-text-base",children:r})]})}function fM({className:e,onOpenComparison:t,productLabel:r,productUrl:n,result:a,zoomLabel:o}){let i="inline-flex h-8 min-w-0 max-w-52 flex-1 items-center justify-center gap-1.5 rounded-xl bg-button-light px-3 text-xs font-semibold text-text-dark";return(0,A.jsxs)(fE,{"aria-label":o,className:i2("block cursor-pointer text-left",e),role:"button",tabIndex:0,onClick:t,onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},children:[(0,A.jsx)(fR,{photo:a?.after}),(0,A.jsxs)("div",{className:"absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2",children:[n?(0,A.jsxs)("a",{className:i,href:n,onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(fo,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}):(0,A.jsxs)("span",{className:i,children:[(0,A.jsx)(fo,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}),(0,A.jsx)("button",{"aria-label":o,className:"inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-button-light text-text-dark",type:"button",onClick:e=>{e.stopPropagation(),t()},children:(0,A.jsx)(fP,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fF({addToCartError:e,addToCartPending:t=!1,onAddToCart:r,onClose:n,onDeleteResult:a,onSaveResult:o,onShareResult:i,portalContainer:s,productName:l,productPrice:u,productUrl:c,result:d}){var p;let{t:h}=rT(),f=l??h("resultProductLink"),g=(p=u,p?.trim()||void 0),m=g?h("resultTryAnotherWithPrice",{price:g}):h("resultTryAnother");return(0,A.jsx)(sr,{open:!0,onOpenChange:e=>!e&&n(),children:(0,A.jsxs)(so,{className:"dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none bg-[#212124E5] p-0 text-text-dark duration-200 sm:max-w-none sm:p-0",portalContainer:s,showCloseButton:!1,children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:h("comparisonTitle")}),(0,A.jsx)(sl,{children:h("comparisonSlider")})]}),(0,A.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[c?(0,A.jsx)(i4,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,A.jsxs)("a",{href:c,children:[(0,A.jsx)(fo,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]})}):(0,A.jsxs)(i4,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,A.jsx)(fo,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":h("close"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,A.jsx)(fr,{className:"!size-3","data-icon":"inline-start"})})]}),(0,A.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center px-8",children:(0,A.jsxs)(h8,{"aria-label":h("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,A.jsx)(h7,{position:"right",children:(0,A.jsx)(fA,{className:"w-full object-contain",photo:d?.after})}),(0,A.jsx)(h7,{position:"left",children:(0,A.jsx)(fA,{className:"w-full object-contain",photo:d?.before})}),(0,A.jsxs)(fe,{className:"w-11",children:[(0,A.jsx)("div",{className:"absolute left-1/2 h-full w-0.5 -translate-x-1/2 bg-constant-white"}),(0,A.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-constant-white text-constant-black shadow-lg",children:(0,A.jsx)("span",{className:"h-5 w-0.5 rounded-full bg-current"})})]})]})}),(0,A.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1 px-8 pb-6 pt-3",children:[e&&(0,A.jsx)("p",{className:"text-xs text-text-sub",role:"alert",children:e}),(0,A.jsxs)("div",{className:"flex h-23 w-full max-w-104 items-start gap-2",children:[r&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:t,size:"lg",type:"button",variant:"contrast",onClick:r,children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:m})]}),(0,A.jsx)(i4,{"aria-label":h("share"),size:"icon-lg",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fi,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("download"),size:"icon-lg",type:"button",variant:"outline",onClick:o,children:(0,A.jsx)(fn,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){a()},children:(0,A.jsx)(fa,{"data-icon":"inline-start"})})]})]})]})})}fv.displayName=fm;let fD=i5("inline-flex w-fit items-center justify-center overflow-hidden rounded-full whitespace-nowrap",{variants:{variant:{default:"bg-contrast text-contrast-foreground",secondary:"bg-[var(--color-background-gray-transparent)] text-text-base",positive:"bg-[var(--color-background-green-transparent)] text-text-green",negative:"bg-[var(--color-background-red-transparent)] text-text-red",standard:"bg-[var(--color-background-blue-transparent)] text-text-blue"},size:{sm:"h-6 px-2 typo-button-small",md:"h-[30px] px-3 typo-button-normal"}},defaultVariants:{variant:"default",size:"sm"}});function fB({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,A.jsx)(n?o0:"span",{"data-slot":"badge",className:i2(fD({variant:t,size:r,className:e})),...a})}function f$({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl",e),...t})}function fV({badge:e,badgeTone:t="gray",className:r,closeLabel:n,leftSlot:a,middleSlot:o,onClose:i,preferMiddleSlotFirst:s=!1,showCloseButton:l=!1,...u}){let c=e?(0,A.jsx)(fU,{tone:t,children:e}):null;return(0,A.jsxs)("div",{className:i2("flex h-17 items-center justify-between p-4",r),...u,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[a,s?o:c,s?c:o]}),l&&(0,A.jsx)(i4,{"aria-label":n,size:"icon",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fr,{"data-icon":"inline-start"})})]})}function fU({className:e,tone:t="gray",...r}){return(0,A.jsx)(fB,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fH({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex min-h-0 flex-1 flex-col animate-in fade-in-0 duration-100 motion-reduce:animate-none",e),...t})}function fW(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{d:"M21.1667 8.4C21.1667 8.16131 21.07 7.93245 20.8981 7.76367C20.7262 7.59489 20.4931 7.5 20.25 7.5H16.5833C16.2768 7.5 15.9906 7.3496 15.8206 7.09922L14.2594 4.8H9.74056L8.17936 7.09922C8.00935 7.3496 7.72316 7.5 7.41667 7.5H3.75C3.50688 7.5 3.2738 7.59489 3.10189 7.76367C2.92998 7.93245 2.83333 8.16131 2.83333 8.4V18.3C2.83333 18.5387 2.92998 18.7675 3.10189 18.9363C3.2738 19.1051 3.50689 19.2 3.75 19.2H20.25C20.4931 19.2 20.7262 19.1051 20.8981 18.9363C21.07 18.7675 21.1667 18.5387 21.1667 18.3V8.4ZM14.75 12.9C14.75 12.184 14.46 11.4973 13.9443 10.991C13.4287 10.4847 12.7292 10.2001 12 10.2C11.2707 10.2 10.5705 10.4847 10.0548 10.991C9.53923 11.4973 9.25 12.1841 9.25 12.9C9.25 13.6159 9.53923 14.3027 10.0548 14.809C10.5705 15.3153 11.2707 15.6 12 15.6C12.7292 15.5999 13.4287 15.3153 13.9443 14.809C14.46 14.3027 14.75 13.616 14.75 12.9ZM16.5833 12.9C16.5833 14.0934 16.1 15.2377 15.2406 16.0816C14.3811 16.9255 13.2155 17.3999 12 17.4C10.7844 17.4 9.61809 16.9256 8.75854 16.0816C7.89919 15.2378 7.41667 14.0933 7.41667 12.9C7.41667 11.7067 7.89919 10.5622 8.75854 9.71836C9.61809 8.87445 10.7844 8.4 12 8.4C13.2155 8.40008 14.3811 8.87452 15.2406 9.71836C16.1 10.5623 16.5833 11.7066 16.5833 12.9ZM23 18.3C23 19.0161 22.7101 19.7026 22.1943 20.209C21.6786 20.7153 20.9793 21 20.25 21H3.75C3.02065 21 2.32139 20.7153 1.80566 20.209C1.28994 19.7026 1 19.0161 1 18.3V8.4C1 7.68392 1.28994 6.99736 1.80566 6.49102C2.32139 5.98467 3.02065 5.7 3.75 5.7H6.92611L8.4873 3.40078L8.55623 3.31201C8.72911 3.11535 8.98172 3 9.25 3H14.75L14.8637 3.00703C15.1262 3.03922 15.3639 3.18167 15.5127 3.40078L17.0739 5.7H20.25C20.9793 5.7 21.6786 5.98467 22.1943 6.49102C22.7101 6.99736 23 7.68392 23 8.4V18.3Z",fill:"currentColor"})})}function fq(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 5.00342 8.37303",fill:"none",...e,children:(0,A.jsx)("path",{d:"M1 1L4.00342 4.18652L1 7.37303",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fK(e){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,A.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function fG(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 3C18.7956 3 19.5585 3.3163 20.1211 3.87891C20.6837 4.44152 21 5.20435 21 6V18C21 18.7956 20.6837 19.5585 20.1211 20.1211C19.5585 20.6837 18.7956 21 18 21H6C5.20435 21 4.44152 20.6837 3.87891 20.1211C3.3163 19.5585 3 18.7956 3 18V6C3 5.20435 3.3163 4.44152 3.87891 3.87891C4.44152 3.3163 5.20435 3 6 3H18ZM14.0352 12C13.8633 12 13.6974 12.0639 13.5703 12.1797L6 19H18C18.2876 18.977 18.5547 18.8414 18.7422 18.6221C18.9296 18.4028 19.0221 18.1177 19 17.8301V16.6602L14.5 12.1797C14.3729 12.0639 14.2071 12 14.0352 12ZM8 7C7.60218 7 7.22076 7.15815 6.93945 7.43945C6.65815 7.72076 6.5 8.10218 6.5 8.5C6.5 8.89782 6.65815 9.27924 6.93945 9.56055C7.22076 9.84185 7.60218 10 8 10C8.39782 10 8.77924 9.84185 9.06055 9.56055C9.34185 9.27924 9.5 8.89782 9.5 8.5C9.5 8.10218 9.34185 7.72076 9.06055 7.43945C8.77924 7.15815 8.39782 7 8 7Z",fill:"currentColor"})})}function fX(e){return(0,A.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,A.jsx)("path",{d:"M6.05944 11.1406C6.47507 8.23438 8.97819 6 12.0001 6C13.6563 6 15.1563 6.67187 16.2438 7.75625L16.2626 7.775L16.5001 8H15.0032C14.4501 8 14.0032 8.44687 14.0032 9C14.0032 9.55313 14.4501 10 15.0032 10H19.0032C19.5563 10 20.0032 9.55313 20.0032 9V5C20.0032 4.44688 19.5563 4 19.0032 4C18.4501 4 18.0032 4.44688 18.0032 5V6.66875L17.6501 6.33437C16.2032 4.89375 14.2032 4 12.0001 4C7.96882 4 4.63444 6.98125 4.08132 10.8594C4.00319 11.4062 4.38132 11.9125 4.92819 11.9906C5.47507 12.0688 5.98132 11.6875 6.05944 11.1438V11.1406ZM19.9188 13.1406C19.9969 12.5938 19.6157 12.0875 19.0719 12.0094C18.5282 11.9312 18.0188 12.3125 17.9407 12.8562C17.5251 15.7625 15.0219 17.9969 12.0001 17.9969C10.3438 17.9969 8.84382 17.325 7.75632 16.2406L7.73757 16.2219L7.50007 15.9969H8.99694C9.55007 15.9969 9.99694 15.55 9.99694 14.9969C9.99694 14.4437 9.55007 13.9969 8.99694 13.9969L5.00007 14C4.73444 14 4.47819 14.1063 4.29069 14.2969C4.10319 14.4875 3.99694 14.7406 4.00007 15.0094L4.03132 18.9781C4.03444 19.5312 4.48757 19.975 5.04069 19.9688C5.59382 19.9625 6.03757 19.5125 6.03132 18.9594L6.01882 17.35L6.35319 17.6656C7.80007 19.1062 9.79694 20 12.0001 20C16.0313 20 19.3657 17.0187 19.9188 13.1406Z",fill:"currentColor"})})}function fY({className:e,...t}){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:i2("size-6",e),...t,children:[(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}let fQ={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},fZ={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},fJ={bag:{cards:[{good:!0,imageSrc:ou,labelKey:"bagIntroGoodFullBody"},{good:!0,imageSrc:ol,labelKey:"bagIntroGoodAngle"},{good:!1,imageSrc:os,labelKey:"bagIntroBadHandsFull"},{good:!1,imageSrc:oi,labelKey:"bagIntroBadCropped"}],subtitleKey:"bagIntroSubtitle",titleKey:"bagIntroTitle"},eyewear:{cards:[{good:!0,imageSrc:op,labelKey:"eyewearIntroGoodFacingCamera"},{good:!0,imageSrc:oh,labelKey:"eyewearIntroGoodHairBack"},{good:!1,imageSrc:od,labelKey:"eyewearIntroBadWearingGlasses"},{good:!1,imageSrc:oc,labelKey:"eyewearIntroBadFaceTurned"}],subtitleKey:"eyewearIntroSubtitle",titleKey:"eyewearIntroTitle"},footwear:{cards:[{good:!0,imageSrc:ov,labelKey:"footwearIntroGoodStanding"},{good:!0,imageSrc:om,labelKey:"footwearIntroGoodKneesDown"},{good:!1,imageSrc:og,labelKey:"footwearIntroBadOneFootCropped"},{good:!1,imageSrc:of,labelKey:"footwearIntroBadFeetHidden"}],subtitleKey:"footwearIntroSubtitle",titleKey:"footwearIntroTitle"},"full-body":{cards:[{good:!0,imageSrc:ox,labelKey:"fullBodyIntroGoodHeadToToe"},{good:!0,imageSrc:ow,labelKey:"fullBodyIntroGoodAngle"},{good:!1,imageSrc:oy,labelKey:"fullBodyIntroBadCropped"},{good:!1,imageSrc:ob,labelKey:"fullBodyIntroBadSitting"}],subtitleKey:"fullBodyIntroSubtitle",titleKey:"fullBodyIntroTitle"},headwear:{cards:[{good:!0,imageSrc:oP,labelKey:"headwearIntroGoodFront"},{good:!0,imageSrc:oC,labelKey:"headwearIntroGoodAngle"},{good:!1,imageSrc:oS,labelKey:"headwearIntroBadWearingHat"},{good:!1,imageSrc:ok,labelKey:"headwearIntroBadCroppedHead"}],subtitleKey:"headwearIntroSubtitle",titleKey:"headwearIntroTitle"},"lower-body":{cards:[{good:!0,imageSrc:oO,labelKey:"lowerBodyIntroGoodWaistToFeet"},{good:!0,imageSrc:oR,labelKey:"lowerBodyIntroGoodFullBody"},{good:!1,imageSrc:oT,labelKey:"lowerBodyIntroBadSitting"},{good:!1,imageSrc:oE,labelKey:"lowerBodyIntroBadCoveredWaist"}],subtitleKey:"lowerBodyIntroSubtitle",titleKey:"lowerBodyIntroTitle"},neck:{cards:[{good:!0,imageSrc:oz,labelKey:"neckIntroGoodHairUp"},{good:!0,imageSrc:o_,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:oN,labelKey:"neckIntroBadHighCollar"}],subtitleKey:"neckIntroSubtitle",titleKey:"neckIntroTitle"},"upper-body":{cards:[{good:!0,imageSrc:oM,labelKey:"upperBodyIntroGoodFacingCamera"},{good:!0,imageSrc:oI,labelKey:"upperBodyIntroGoodAngle"},{good:!1,imageSrc:oA,labelKey:"upperBodyIntroBadArmsCrossed"},{good:!1,imageSrc:oL,labelKey:"upperBodyIntroBadObjectBlockingTorso"}],subtitleKey:"upperBodyIntroSubtitle",titleKey:"upperBodyIntroTitle"},waist:{cards:[{good:!0,imageSrc:oB,labelKey:"waistIntroGoodFullBody"},{good:!0,imageSrc:o$,labelKey:"waistIntroGoodTopTucked"},{good:!1,imageSrc:oF,labelKey:"waistIntroBadOversizedTop"},{good:!1,imageSrc:oD,labelKey:"waistIntroBadSitting"}],subtitleKey:"waistIntroSubtitle",titleKey:"waistIntroTitle"},wrist:{cards:[{good:!0,imageSrc:oH,labelKey:"wristIntroGoodCloseUp"},{good:!0,imageSrc:oW,labelKey:"wristIntroGoodSleeveBack"},{good:!1,imageSrc:oV,labelKey:"wristIntroBadClenchedFist"},{good:!1,imageSrc:oU,labelKey:"wristIntroBadCovered"}],subtitleKey:"wristIntroSubtitle",titleKey:"wristIntroTitle"}};function f0({view:e}){let{t}=rT(),r=e.productType?fJ[e.productType]:null;return(0,A.jsxs)(gr,{title:t("startTitle"),subtitle:t(r?.titleKey??"externalPhotoHint"),children:[(0,A.jsxs)(fE,{className:"mt-3",children:[(0,A.jsx)(fT,{src:e.productImageSrc}),(0,A.jsx)(fA,{fallbackSrc:e.productImageSrc})]}),(0,A.jsxs)(gn,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,A.jsx)(fW,{"data-icon":"inline-start"}),t("startUpload")]}),(0,A.jsxs)(i4,{className:"w-full",disabled:!e.canOpenHistory,size:"lg",type:"button",variant:"outline",onClick:e.openHistory,children:[(0,A.jsx)(fG,{"data-icon":"inline-start"}),t("startHistory")]}),(0,A.jsx)(ga,{})]})]})}function f1({view:e}){let{t}=rT(),r=e.productType?fJ[e.productType]:null;return r?(0,A.jsxs)(gr,{title:t(r.titleKey),subtitle:t(r.subtitleKey),children:[(0,A.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:gap-4",children:r.cards.map(e=>(0,A.jsx)(fI,{good:e.good,imageSrc:e.imageSrc,label:t(e.labelKey)},e.labelKey))}),(0,A.jsx)("div",{className:"mt-4",children:(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.continueIntro,children:t("introCta")})})]}):null}function f2({view:e}){let{t}=rT();return(0,A.jsxs)(gr,{title:t("historyTitle"),subtitle:t("historySubtitle"),children:[(0,A.jsx)("div",{className:"mt-3 grid min-h-104 flex-1 grid-cols-3 content-start gap-x-3 gap-y-4 overflow-x-hidden overflow-y-auto overscroll-contain pb-2 sm:gap-4",children:e.history.map(r=>(0,A.jsx)(fz,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,A.jsxs)(gn,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,A.jsx)(fK,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,A.jsx)(ga,{})]})]})}function f3({view:e}){let{t}=rT();return(0,A.jsxs)(gr,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,A.jsxs)(fE,{className:"mt-3",children:[(0,A.jsx)(fR,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fL,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,A.jsxs)(gn,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),t("confirmGenerate")]}),(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fX,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,A.jsx)(ga,{})]})]})}function f5(){let{t:e}=rT();return(0,A.jsx)(gr,{title:e("activationLoading"),subtitle:e("activationLoadingSubtitle"),children:(0,A.jsx)(fE,{className:"mt-3",children:(0,A.jsx)(fN,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"})})})}function f9({onClose:e,temporary:t}){let{t:r}=rT();return(0,A.jsx)(gr,{title:r("activationUnavailableTitle"),subtitle:r(t?"activationTemporarilyUnavailable":"externalProductUnavailable"),children:(0,A.jsxs)(gn,{className:"mt-4",children:[e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e,children:r("close")}),(0,A.jsx)(ga,{className:"text-text-sub"})]})})}function f4({onClose:e,onRetry:t}){let{t:r}=rT();return(0,A.jsx)(gr,{title:r("errorTitle"),subtitle:r("externalServiceUnavailable"),children:(0,A.jsxs)(gn,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),r("errorRetry")]}),e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e,children:r("close")}),(0,A.jsx)(ga,{className:"text-text-sub"})]})})}function f6({view:e}){let{t}=rT();return(0,A.jsxs)(gr,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,A.jsxs)(fE,{className:"mt-3",children:[(0,A.jsx)(fO,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fN,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:e.photo.src}):null})]})]}),(0,A.jsx)(f_,{className:"mt-4",label:t("processingProgress"),progress:e.processingProgress})]})}function f8({view:e,onClose:t}){let{t:r}=rT(),n="upload-validation"===e.error.kind&&"file-too-large"===e.error.code,a="generation"===e.error.kind?e.error.code:void 0;return(0,A.jsxs)(gr,{title:r(n?"errorFileTooLarge":"errorTitle"),subtitle:n?void 0:r((a?({tokens:"externalNoTokens",product:"externalProductUnavailable",service:"externalServiceUnavailable",timeout:"externalTimeout","photo-required":"externalPhotoRequired"})[a]:void 0)??"errorSubtitle"),children:[!n&&!a&&(0,A.jsxs)(fE,{className:"mt-3",children:[(0,A.jsx)(fO,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fN,{className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-6 px-6 sm:px-12",children:[(0,A.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white bg-background-containers shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:e.photo.name??"",className:"size-full object-cover",src:e.photo.src,onError:t=>{t.currentTarget.src=e.productImageSrc}}):null})]}),(0,A.jsx)("p",{className:"w-56 text-center text-xs font-medium tracking-wider text-constant-white",children:r("errorGuidance")})]})]}),(0,A.jsxs)(gn,{className:"mt-4",children:[(!a||"service"===a||"timeout"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),r("errorRetry")]}),(!a||"photo-required"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,A.jsx)(fX,{"data-icon":"inline-start"}),r("errorDifferentPhoto")]}),a&&t&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:t,children:r("close")}),(0,A.jsx)(ga,{className:"text-text-sub"})]})]})}function f7({view:e,showAddToCart:t=!0,onAddToCart:r,addToCartPending:n=!1,addToCartError:a}){let{t:o}=rT(),i=r??e.addToCart,s=go(e.productPrice),l=s?o("resultTryAnotherWithPrice",{price:s}):o("resultTryAnother");return e.myFitsOpen?(0,A.jsx)("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain pb-4",children:(0,A.jsx)("div",{className:"flex flex-col gap-4 px-6 pb-2 pt-4 sm:px-8",children:e.resultHistory.map((r,a)=>(0,A.jsx)(ge,{compact:a>0,onAddToCart:t?i:void 0,addToCartPending:n,productName:r.productName??e.productName,productPrice:r.productPrice,productUrl:r.productUrl??e.productUrl,result:r,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},r.id??r.after.id))})}):(0,A.jsxs)(gr,{className:"pb-6",subtitle:void 0,title:o("resultTitle"),children:[(0,A.jsx)(fM,{className:"mt-6",productLabel:e.productName??o("resultProductLink"),productUrl:e.productUrl,zoomLabel:o("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,A.jsxs)(gn,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",disabled:n,size:"lg",type:"button",variant:"contrast",onClick:i,children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),l]}),a&&(0,A.jsx)("p",{className:"text-center text-xs text-text-sub",role:"alert",children:a}),(0,A.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fX,{"data-icon":"inline-start"}),o("resultCompare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,A.jsx)(fi,{"data-icon":"inline-start"}),o("resultShare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),o("resultReset")]})]})]})]})}function ge({compact:e=!1,onAddToCart:t,addToCartPending:r=!1,onDeleteResult:n,onOpenComparison:a,onSaveResult:o,onShareResult:i,productName:s,productPrice:l,productUrl:u,result:c}){let{t:d}=rT(),p=s??d("resultProductLink"),h=go(l),f=h?d("resultTryAnotherWithPrice",{price:h}):d("resultTryAnother");return(0,A.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,A.jsx)(fM,{productLabel:p,productUrl:u,zoomLabel:d("resultOpenComparison"),result:c,onOpenComparison:()=>a(c.id)}),(0,A.jsxs)("div",{className:"flex gap-2",children:[t&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:r,size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":d("share"),size:"icon",type:"button",variant:"outline",onClick:()=>i(c.id),children:(0,A.jsx)(fi,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":d("download"),size:"icon",type:"button",variant:"outline",onClick:()=>o(c.id),children:(0,A.jsx)(fn,{"data-icon":"inline-start"})}),!e&&(0,A.jsx)(i4,{"aria-label":d("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>n(c.id),children:(0,A.jsx)(fa,{"data-icon":"inline-start"})})]})]})}function gt({label:e,onClick:t}){return(0,A.jsx)(i4,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fq,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function gr({children:e,className:t,subtitle:r,title:n}){return(0,A.jsxs)("div",{className:i2("flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto overscroll-contain px-6 pb-5 sm:px-8",t),children:[(0,A.jsxs)("div",{className:"mb-1 flex flex-col gap-1",children:[(0,A.jsx)("h2",{className:"text-2xl font-medium tracking-tight text-text-dark",children:n}),r&&(0,A.jsx)("p",{className:"text-sm font-medium text-text-base",children:r})]}),e]})}function gn({children:e,className:t}){return(0,A.jsx)("div",{className:i2("flex flex-col gap-2",t),children:e})}function ga({className:e}){var t;let{i18n:r,t:n}=rT(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?fZ:fQ);return(0,A.jsxs)("p",{className:i2("pt-1 text-center text-xs font-medium text-text-base",e),children:[n("termsPrefix")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.terms,rel:"noopener noreferrer",target:"_blank",children:n("termsLink")})," ",n("termsJoiner")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.privacy,rel:"noopener noreferrer",target:"_blank",children:n("privacyLink")})]})}function go(e){return e?.trim()||void 0}let gi=new Set(["avif","avis","heic","heix","heim","heis","hevc","hevx","mif1","msf1"]);async function gs(e){var t,r;let n,a,o=(t=e)instanceof Blob?t:t instanceof ArrayBuffer?new Blob([t]):ArrayBuffer.isView(t)?new Blob([new Uint8Array(t.buffer,t.byteOffset,t.byteLength)]):null;return!o||o.size<=0?{blob:null,errorText:null}:(r=new Uint8Array(await o.slice(0,16).arrayBuffer()),n=(...e)=>e.every((e,t)=>r[t]===e),a=(e,...t)=>t.every((t,n)=>r[e+n]===t),n(255,216,255)||n(137,80,78,71,13,10,26,10)||n(71,73,70,56)||n(66,77)||n(82,73,70,70)&&a(8,87,69,66,80)||a(4,102,116,121,112)&&gi.has(function(e){let t="";for(let r=8;r<12;r++)t+=String.fromCharCode(e[r]??0);return t}(r)))?{blob:o,errorText:null}:{blob:null,errorText:(await o.text().catch(()=>"")).slice(0,2e3)}}function gl(e){return"string"==typeof e?e.trim():""}function gu(e){if(e)return e;if("function"==typeof fetch)return fetch;throw Error("Fetch API is not available for AI try-on image upload")}async function gc(e,t,r={}){let{fetch:n,signal:a,timeoutMs:o}=r,i=new AbortController,s=()=>i.abort(a?.reason),l=void 0===o?void 0:setTimeout(()=>i.abort(new DOMException("AI try-on image upload timed out","TimeoutError")),o);a?.aborted?s():a?.addEventListener("abort",s,{once:!0});try{let r=await gu(n)(e,{body:t,method:"PUT",signal:i.signal});if(!r.ok){let e=await r.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${r.status}${e?`: ${e}`:""}`)}}finally{clearTimeout(l),a?.removeEventListener("abort",s)}}async function gd(e,t){let r=e?.trim();return r?gh(r,t,"AI try-on product image fetch failed"):null}async function gp(e,t){return e.blob?e.blob:e.file?e.file:e.src?gh(e.src,t,"AI try-on source photo fetch failed"):null}async function gh(e,t,r){let n=await gu(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}let gf="ai-try-on-result";async function gg(e,t={}){let r=await gv(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gb,o=t.revokeObjectUrl??gw,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gy(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gm(e,t={}){let r=await gv(e,t.fetch),n=t.navigator??globalThis.navigator;if(!r)return!1;if("function"==typeof File&&"function"==typeof n?.share){let a={files:[new File([r],gy(r,e,t.filename),{type:r.type||e?.type||"image/png"})]};if("function"!=typeof n.canShare||n.canShare(a))try{return await n.share(a),!0}catch(e){if("u">typeof DOMException&&e instanceof DOMException&&"AbortError"===e.name)return!1}}return gg(e,t)}async function gv(e,t=globalThis.fetch){if(!e)return null;if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof t)return null;try{let r=await t(e.src);if(!r.ok)return null;return r.blob()}catch{return null}}function gy(e,t,r=gf){var n;let a=function(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}(e.type||t?.type)??(n=t?.name,n?.match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??null)??"png",o=r.replace(/\.[a-z0-9]+$/i,"").replace(/[^\w-]+/g,"-").replace(/^-+|-+$/g,"")||gf;return`${o}.${a}`}function gb(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gw(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gx="results";function gk(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gS(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gx)||e.createObjectStore(gx,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gC(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gP(e){return{after:await gE(e.after),before:await gE(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}}async function gE(e){let t=await gT(e);if(!t)throw Error("AI try-on photo cannot be persisted without image data");return{blob:t,id:e.id,lastModified:e.file?.lastModified??e.lastModified,name:e.name,size:t.size,type:t.type||e.type}}async function gT(e){if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof fetch)return null;try{let t=await fetch(e.src);return t.ok?t.blob():null}catch{return null}}function gR(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gO(e,t=gj()){if(t)try{t.setItem(gR(e),"true")}catch{}}function gj(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gN={delete:async function e(e){let t=gk();if(!t)return!1;try{let r=await gS(t),n=r.transaction(gx,"readwrite"),a=gC(n);return n.objectStore(gx).delete(e),await a,r.close(),!0}catch(e){throw Error("AI try-on result could not be removed from history",{cause:e})}},list:async function e(){let e=gk();if(!e)return[];try{var t;let r=await gS(e),n=r.transaction(gx,"readonly"),a=gC(n),o=await (t=n.objectStore(gx).getAll(),new Promise((e,r)=>{t.onerror=()=>r(t.error),t.onsuccess=()=>e(t.result)}));return await a,r.close(),o.sort((e,t)=>t.createdAt-e.createdAt)}catch(e){throw Error("AI try-on history could not be loaded",{cause:e})}},save:async function e(e){let t=gk();if(!t)return!1;try{let r=await gP(e),n=await gS(t),a=n.transaction(gx,"readwrite"),o=gC(a);return a.objectStore(gx).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},gz={save:gg,share:gm},g_={consumeFirstView:function(e,t=gj()){return!function(e,t=gj()){if(!t)return!1;try{return"true"===t.getItem(gR(e))}catch{return!1}}(e,t)&&(gO(e,t),!0)},markSeen:gO},gA={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gL=["image/jpeg","image/png"];class gI{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productPrice:n,productType:a,productUrl:o,tipStore:i}){this.createObjectUrl=e,this.tipStore=i,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productPrice:gM(n),productType:a,productUrl:o,result:null,selectedPhoto:null,stage:"start"}}get view(){switch(this.state.stage){case"intro":return{productType:this.state.productType,stage:"intro"};case"history":return{history:this.state.history,stage:"history"};case"confirm":return{photo:this.state.selectedPhoto,productImageSrc:this.state.productImageSrc,productName:this.state.productName,stage:"confirm"};case"processing":return this.createProcessingView();case"error":return this.createErrorView();case"result":return{canOpenMyFits:this.state.history.length>0,myFitsOpen:this.state.myFitsOpen,productName:this.state.result?.productName??this.state.productName,productPrice:this.state.result?gM(this.state.result.productPrice):this.state.productPrice,productUrl:this.state.result?.productUrl??this.state.productUrl,result:this.state.result,resultHistory:function(e,t){if(!e)return[];let r=[e,...t.filter(t=>t.id!==e.id)];return r.filter((e,t)=>{let n=e.id??e.after.id;return r.findIndex(e=>(e.id??e.after.id)===n)===t})}(this.state.result,this.state.history),stage:"result"};default:return{canOpenHistory:this.state.history.length>0,productImageSrc:this.state.productImageSrc,productName:this.state.productName,productType:this.state.productType,productUrl:this.state.productUrl,stage:"start"}}}get comparison(){let e=this.getComparisonResult();return{open:this.state.comparisonOpen&&null!==e,productName:e?.productName??this.state.productName,productPrice:e?gM(e.productPrice):this.state.productPrice,productUrl:e?.productUrl??this.state.productUrl,result:e}}get selectedPhoto(){return this.state.selectedPhoto}get history(){return this.state.history}updateProduct({productImageSrc:e,productName:t,productPrice:r,productType:n,productUrl:a}){this.state={...this.state,productImageSrc:e,productName:t,productPrice:gM(r),productType:n,productUrl:a}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gF(e,t),[])}}failHistory(e,t){this.state={...this.state,error:{kind:"hydrate-history"===e?"history-load":"save-result"===e?"history-save":"history-delete",message:t}}}choosePhoto(){return this.state.productType&&this.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.state.productType&&this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(this.state.productType&&this.tipStore.markSeen(this.state.productType),this.goBack(),null):{type:"close-dialog"}}openHistory(){0!==this.state.history.length&&(this.state={...this.state,stage:"history"})}goBack(){switch(this.state.stage){case"intro":case"history":this.state={...this.state,stage:"start"};return;case"confirm":this.state={...this.state,stage:this.state.history.length>0?"history":"start"};return;case"processing":case"error":case"result":this.state={...this.state,stage:"confirm"}}}reset(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"}}selectHistoryResult(e){let t=this.state.history.find(t=>t.id===e);t&&(this.state={...this.state,error:null,myFitsOpen:!1,result:t,selectedPhoto:t.before,stage:"result"})}selectFile(e){var t,r;let n=(t=e,gL.includes(t.type)||""===t.type&&/\.(?:jpe?g|png)$/i.test(t.name)?t.size>0xa00000?"file-too-large":null:"unsupported-file-format");if(n)return this.state={...this.state,error:{code:n,kind:"upload-validation"},myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"error"},null;let a=this.createObjectUrl(e),o={blob:e,file:e,id:(r=e,`${r.name}-${r.size}-${r.lastModified}`),lastModified:e.lastModified,name:e.name,size:e.size,src:a,type:e.type};return this.selectPhoto(o),o}selectPhoto(e){this.state={...this.state,error:null,myFitsOpen:!1,processingProgress:0,selectedPhoto:e,stage:"confirm"}}startGeneration(){return!!this.state.selectedPhoto&&(this.state={...this.state,error:null,generationProduct:this.getProductMetadata(),myFitsOpen:!1,processingProgress:0,result:null,stage:"processing"},!0)}reportGenerationProgress(e){var t;"processing"===this.state.stage&&(this.state={...this.state,processingProgress:Math.max(this.state.processingProgress,Number.isFinite(t=e)?Math.min(Math.max(t,0),100):0)})}completeGeneration(e,t=Date.now()){let r=function(e,t,r=Date.now()){return{...e,...t,productPrice:gM(t.productPrice),createdAt:r,id:`${e.before.id}-result-${r}`}}(e,this.state.generationProduct??this.getProductMetadata(),t);return this.state={...this.state,error:null,generationProduct:null,history:gF(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e,t){this.state={...this.state,error:{kind:"generation",message:e,...t?{code:t}:{}},generationProduct:null,stage:"error"}}toggleMyFits(){"result"===this.state.stage&&0!==this.state.history.length&&(this.state={...this.state,myFitsOpen:!this.state.myFitsOpen})}closeMyFits(){this.state={...this.state,myFitsOpen:!1}}openComparison(e){let t=e?this.findResult(e):this.state.result;t&&(this.state={...this.state,comparisonOpen:!0,comparisonResultId:t.id})}closeComparison(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null}}deleteResult(e){let t=this.findResult(e),r=this.state.history.filter(t=>!gD(t,e)),n=this.state.result?.id??this.state.result?.after.id,a=this.getComparisonResult()?.id===e;if(n!==e)return this.state={...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,history:r},t;let o=r[0]??null;return this.state=o?{...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,error:null,generationProduct:null,history:r,myFitsOpen:r.length>0&&this.state.myFitsOpen,result:o,selectedPhoto:o.before,stage:"result"}:{...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:r,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"},t}resolveResultActionPhoto(e){let t=e?this.findResult(e):this.comparison.open?this.comparison.result:this.state.result;return t?.after??null}findResult(e){return this.state.history.find(t=>gD(t,e))??null}createProcessingView(){let e=this.state.generationProduct??this.getProductMetadata();return{photo:this.state.selectedPhoto,processingProgress:this.state.processingProgress,productImageSrc:e.productImageSrc,productName:e.productName,stage:"processing"}}createErrorView(){let e=this.state.generationProduct??this.getProductMetadata();return{error:this.state.error??{kind:"generation"},photo:this.state.selectedPhoto,productImageSrc:e.productImageSrc,productName:e.productName,stage:"error"}}getProductMetadata(){return{productImageSrc:this.state.productImageSrc,productName:this.state.productName,productPrice:this.state.productPrice,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gM(e){return e?.trim()||void 0}function gF(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gD(e,t){return e.id===t||e.after.id===t}class gB extends Error{code;constructor(e){super(e),this.code=e,this.name="AiTryOnGenerationError"}}function g$(e,t){return{blob:e.blob,id:e.id,lastModified:e.lastModified,name:e.name,size:e.size,src:t(e.blob),type:e.type}}function gV(e,t){t&&(gU(e,t.before),gU(e,t.after))}function gU(e,t){gH(t)?.forEach(t=>e.add(t))}function gH(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gW(e){return function(e=5e3){return new Promise(t=>setTimeout(t,e))}(function(e,t=Date.now()){return Math.max(0,5e3-(t-e))}(e))}let gq={status:"ready"};function gK({dialogPortalContainer:e,language:t,onClose:r,onAddToCart:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,apiKey:d,showDialogCloseButton:p=!1,showAddToCart:h=!0,activation:f=gq,onRetryActivation:g}){a||sQ(l);let{i18n:m,t:v}=rT(),y=(0,L.useRef)(null),b=sA(d),w=(0,L.useMemo)(()=>c??sU({apiKey:b}),[c,b]);(0,L.useEffect)(()=>{"string"==typeof t&&m.changeLanguage(t)},[m,t]);let x=function({historyStore:e=gN,objectUrls:t=gA,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,resultActions:d=gz,tipStore:p=g_}){var h;let[,f]=(0,L.useReducer)(e=>e+1,0),g=(0,L.useRef)(new Set),m=(0,L.useRef)(!0);(0,L.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let v=(0,L.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&g.current.add(r),r},[t]),y=(0,L.useRef)(null);y.current||(y.current=new gI({createObjectUrl:v,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tipStore:p}));let b=y.current;b.updateProduct({productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u});let w=(0,L.useMemo)(()=>a||(sQ(l),function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sQ(n);let i=a??sU({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gp(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gd(r,t);if(!u||u.size<=0)throw Error("AI try-on product image is missing");o?.reportProgress(22),o?.reportProgress(32);let[c,d]=function(e,t){let r=e?.uploads;if(!Array.isArray(r)||r.length<2)throw Error("Nano Banana upload URL response is missing uploads");return r.slice(0,2).map(e=>{if(null===e||"object"!=typeof e)throw Error("Nano Banana upload URL response is missing uploads");let t=gl(e.key),r=gl(e.uploadUrl);if(!t||!r)throw Error("Nano Banana upload URL response is missing key or uploadUrl");return{key:t,uploadUrl:r}})}(await i.requestUploadUrls(2),2);o?.reportProgress(44),await Promise.all([gc(c.uploadUrl,l,{fetch:t}),gc(d.uploadUrl,u,{fetch:t})]),o?.reportProgress(62);let p=function(e){if(!e)return()=>{};e(70);let t=Date.now(),r=globalThis.setInterval(()=>{e(70+24*(1-(1-Math.min((Date.now()-t)/45e3,1))**3))},750);return()=>globalThis.clearInterval(r)}(o?.reportProgress);try{s=await i.generateTryOn({category:n,personImage:c.key,productImages:[d.key]},{timeout:9e4})}finally{p()}o?.reportProgress(96);let{blob:h}=await gs(s);if(!h)throw Error("AI try-on generation did not return an image");o?.reportProgress(98);let f=e(h);if(!f)throw Error("AI try-on result image URL cannot be created");return{before:a,after:{blob:h,id:`${a.id}-nano-banana-result`,name:a.name?`${a.name} result`:"AI try-on result",size:h.size,src:f,type:h.type||"image/jpeg"}}}}({createObjectUrl:v,productImageSrc:o,productType:l,tryOnClient:c})),[v,a,o,l,c]),x=(0,L.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),k=(0,L.useCallback)(()=>f(),[]),S=(0,L.useCallback)(e=>{let t=e()??null;k(),x(t)},[x,k]),C=(0,L.useCallback)(e=>{b.failHistory(e),k()},[b,k]),P=(0,L.useCallback)(t=>{e.save(t).catch(()=>{C("save-result")})},[e,C]),E=(0,L.useCallback)(t=>{e.delete(t).catch(()=>{C("delete-result")})},[e,C]),T=(0,L.useCallback)(()=>{S(()=>b.choosePhoto())},[S,b]),R=(0,L.useCallback)(async()=>{let e=b.selectedPhoto;if(!e||!b.startGeneration())return;k();let r=Date.now();try{var n;let a=await w(e,{reportProgress:e=>{m.current&&(b.reportGenerationProgress(e),k())}});if(await gW(r),!m.current){P(b.completeGeneration(a)),a.after.src.startsWith("blob:")&&t.revokeObjectUrl(a.after.src);return}let o=b.completeGeneration(a);n=g.current,gH(o.before)?.forEach(e=>n.add(e)),gH(o.after)?.forEach(e=>n.add(e)),P(o),k()}catch(e){if(await gW(r),!m.current)return;b.failGeneration(e instanceof Error?e.message:void 0,e instanceof gB?e.code:void 0),k()}},[t,P,w,b,k]),O=(0,L.useCallback)(e=>{let t=b.deleteResult(e);t&&E(t.id),k()},[E,b,k]),j=(0,L.useCallback)(e=>{d.save(b.resolveResultActionPhoto(e))},[d,b]),N=(0,L.useCallback)(e=>{d.share(b.resolveResultActionPhoto(e))},[d,b]),z=(0,L.useCallback)(()=>{c.sendWidgetEvent("add_to_cart_from_widget")},[c]);(0,L.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;b.hydrateHistory(r.map(e=>({after:g$(e.after,v),before:g$(e.before,v),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}))),k()}catch{t||C("hydrate-history")}}(),()=>{t=!0}},[v,e,C,b,k]),(0,L.useEffect)(()=>()=>{var e,r;e=g.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,L.useEffect)(()=>{var e,r,n,a,o;let i;a=g.current,e=b.view,r=b.comparison.result,n=b.history,i=new Set,"photo"in e&&gU(i,e.photo),"result"===e.stage&&(gV(i,e.result),e.resultHistory.forEach(e=>gV(i,e))),n.forEach(e=>gV(i,e)),gV(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,b.view,b.comparison.result,b.history]);let _=(0,L.useMemo)(()=>(function(e,{addToCart:t,choosePhoto:r,deleteResult:n,generate:a,runSessionCommand:o,saveResult:i,shareResult:s,sync:l}){let u=e.view;switch(u.stage){case"start":return{...u,choosePhoto:r,openHistory:()=>o(()=>e.openHistory())};case"intro":return{...u,continueIntro:()=>o(()=>e.continueIntro())};case"history":return{...u,chooseNew:r,selectResult:t=>o(()=>e.selectHistoryResult(t))};case"confirm":return{...u,changePhoto:r,generate:a};case"error":return{...u,chooseDifferentPhoto:r,retry:u.photo?a:r};case"result":return{...u,addToCart:t,changePhoto:()=>{e.closeMyFits(),l(),r()},deleteResult:n,openComparison:t=>o(()=>e.openComparison(t)),reset:()=>o(()=>e.reset()),saveResult:i,shareResult:s,toggleMyFits:()=>o(()=>e.toggleMyFits())};default:return u}})(b,{addToCart:z,choosePhoto:T,deleteResult:O,generate:()=>void R(),runSessionCommand:S,saveResult:j,shareResult:N,sync:k}),[z,T,O,R,S,j,b,N,k]);return{canGoBack:"start"!==(h=b.view.stage)&&"intro"!==h&&"processing"!==h&&"error"!==h&&"result"!==h,comparison:function(e,{addToCart:t,deleteResult:r,runSessionCommand:n,saveResult:a,shareResult:o}){let i=e.comparison;return{...i,addToCart:t,close:()=>n(()=>e.closeComparison()),deleteResult:()=>{let e=i.result?.id??i.result?.after.id;e&&r(e)},saveResult:()=>a(i.result?.id??i.result?.after.id),shareResult:()=>o(i.result?.id??i.result?.after.id)}}(b,{addToCart:z,deleteResult:O,runSessionCommand:S,saveResult:j,shareResult:N}),goBack:()=>S(()=>b.goBack()),requestClose:()=>S(()=>b.requestClose()),selectFile:e=>S(()=>{b.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>y.current?.click(),processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:w}),k=x.view.stage,S=r??x.requestClose,C="result"===x.view.stage&&x.view.myFitsOpen,[P,E]=(0,L.useState)(!1),[T,R]=(0,L.useState)(void 0),O=(0,L.useCallback)(()=>{"result"!==x.view.stage||(x.view.addToCart(),n&&(E(!0),R(void 0),Promise.resolve(n()).catch(e=>R(e instanceof Error&&e.message?e.message:v("externalServiceUnavailable"))).finally(()=>E(!1))))},[n,x.view,v]),j=x.canGoBack?(0,A.jsx)(gt,{label:v("back"),onClick:x.goBack}):null,N="result"===x.view.stage&&x.view.canOpenMyFits?(0,A.jsxs)(i4,{"aria-expanded":C,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:x.view.toggleMyFits,children:[v("myFits"),(0,A.jsx)(sZ,{className:i2("!size-3 transition-transform",C&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,A.jsxs)(f$,{className:C?"h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":k,children:[(0,A.jsx)(fV,{badge:"history"===k||"ready"!==f.status?null:v(function(e){switch(e){case"intro":return"introBadge";case"confirm":return"confirmBadge";case"processing":return"processingBadge";case"error":return"errorBadge";case"result":return"resultBadge";default:return"badge"}}(k)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(k),closeLabel:v("close"),leftSlot:"ready"===f.status?j:null,middleSlot:"ready"===f.status?N:null,preferMiddleSlotFirst:"result"===k,showCloseButton:p,onClose:"ready"===f.status?x.requestClose:S}),(0,A.jsx)("input",{ref:y,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&x.selectFile(t),e.currentTarget.value=""}}),(0,A.jsxs)(fH,{children:["loading"===f.status?(0,A.jsx)(f5,{}):null,"unavailable"===f.status?(0,A.jsx)(f9,{temporary:f.temporary,onClose:S}):null,"error"===f.status?(0,A.jsx)(f4,{onClose:S,onRetry:g}):null,"ready"!==f.status?null:(0,A.jsxs)(A.Fragment,{children:["start"===x.view.stage?(0,A.jsx)(f0,{view:x.view}):null,"intro"===x.view.stage?(0,A.jsx)(f1,{view:x.view}):null,"history"===x.view.stage?(0,A.jsx)(f2,{view:x.view}):null,"confirm"===x.view.stage?(0,A.jsx)(f3,{view:x.view}):null,"processing"===x.view.stage?(0,A.jsx)(f6,{view:x.view}):null,"error"===x.view.stage?(0,A.jsx)(f8,{view:x.view,onClose:x.requestClose}):null,"result"===x.view.stage?(0,A.jsx)(f7,{view:x.view,showAddToCart:h,onAddToCart:n?O:void 0,addToCartPending:P,addToCartError:T}):null]})]},"ready"===f.status?k:`activation-${f.status}`),x.comparison.open&&(0,A.jsx)(fF,{productName:x.comparison.productName,productPrice:x.comparison.productPrice,productUrl:x.comparison.productUrl,portalContainer:e??void 0,result:x.comparison.result,addToCartPending:P,addToCartError:T,onAddToCart:h?n?O:x.comparison.addToCart:void 0,onClose:x.comparison.close,onDeleteResult:x.comparison.deleteResult,onSaveResult:x.comparison.saveResult,onShareResult:x.comparison.shareResult})]})}sS({baseURL:"https://api.neurodyn.ai/"});let gG={status:"loading"},gX={status:"ready"};function gY({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,apiKey:u,externalGeneration:c,externalActivation:d,externalAddToCart:p,externalClient:h,...f}){c||sQ(s);let g=(0,L.useMemo)(()=>{let e;return(e=rl.createInstance()).use(oo).use(rO).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sH}),e},[t]),[m,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(e),w=(0,L.useRef)(!1),x=void 0!==n,k=x?n:y,S=sA(u),C=(0,L.useMemo)(()=>c?h??sp:sU({apiKey:S}),[S,c,h]),[P,E]=(0,L.useState)(gG),[T,R]=(0,L.useState)(0),O=d?P:gX,j=(0,L.useRef)(d);function N(e){x||b(e),r?.(e)}return(0,L.useEffect)(()=>{j.current=d}),(0,L.useEffect)(()=>{let e=j.current;if(!e||(E(gG),!k))return;let t=!1;return e().then(e=>{t||E(e.enabled?{...e,status:"ready"}:{status:"unavailable",temporary:e.temporarilyUnavailable})}).catch(()=>{t||E({status:"error"})}),()=>{t=!0}},[T,k,!!d]),(0,L.useEffect)(()=>{if(!k){w.current=!1;return}"ready"!==O.status||w.current||(w.current=!0,C.sendWidgetEvent("widget_opened"))},[O.status,k,C]),(0,A.jsxs)(A.Fragment,{children:[(0,q.createPortal)((0,A.jsx)("style",{children:sd.A}),document.head),(0,q.createPortal)((0,A.jsxs)(rG.div,{className:"fixed inset-x-0 bottom-0 w-svw tracking-normal sm:inset-x-auto sm:right-4 sm:bottom-4 sm:w-120",style:{zIndex:0x7fffffff},children:[(0,A.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,A.jsx)("style",{children:sK}),(0,A.jsx)("div",{ref:v}),m&&(0,A.jsx)(sc,{defaultTheme:"light",root:m,storageKey:"neurodyn-ai-try-on-theme",children:(0,A.jsx)(rR,{i18n:g,children:(0,A.jsx)(gQ,{language:t,open:k,portalContainer:m,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,tryOnClient:C,externalGeneration:c,externalAddToCart:p,activation:O,onRetryActivation:()=>R(e=>e+1),onRequestClose:()=>N(!1),onOpenChange:N,...f})})})]}),document.body)]})}function gQ({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productPrice:o,productType:i,productUrl:s,tryOnClient:l,externalGeneration:u,externalAddToCart:c,activation:d,onRetryActivation:p,...h}){let{t:f}=rT();return(0,A.jsx)(sr,{...h,children:(0,A.jsxs)(so,{className:"inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:f("dialogTitle")}),(0,A.jsx)(sl,{children:f("dialogDescription")})]}),(0,A.jsx)(gK,{dialogPortalContainer:r,language:e,productImageSrc:"ready"===d.status&&d.productImageSrc||n,productName:a,productPrice:o,productType:"ready"===d.status?d.productType??i:i,productUrl:s,tryOnClient:l,processPhoto:u,activation:d,onRetryActivation:p,onAddToCart:c,showAddToCart:!u||!!c,showDialogCloseButton:!0,onClose:t})]})})}var gZ=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");let gJ=0,g0="data-neurodyn-ai-try-on-product-type";function g1(e,t){return g2(e.getAttribute(t))}function g2(e){return e?.trim()||void 0}function g3(e,t){let r=g1(e,t);if(!r)throw Error(`AI try-on dialog trigger is missing ${t}`);return r}window.__neurodynAiTryOnDialog?.destroy();let g5=new class{container=null;openState=!1;props=null;root=null;destroy(){this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null,this.props=null,this.openState=!1}open(e){this.props=e,this.openState=!0,this.render()}handleOpenChange=e=>{this.openState=e,this.render()};ensureRoot(){return this.root||(this.container=document.createElement("div"),this.container.id=`neurodyn-ai-try-on-dialog-root-${gJ++}`,document.body.appendChild(this.container),this.root=(0,gZ.createRoot)(this.container)),this.root}render(){let e=this.ensureRoot();this.props&&this.openState?e.render((0,L.createElement)(gY,{...this.props,open:!0,onOpenChange:this.handleOpenChange})):e.render(null)}};function g9(e){let t=e.target instanceof Element?e.target.closest("[data-neurodyn-ai-try-on-dialog]"):null;t&&g5.open(function(e,t={}){var r,n;let a;return{language:void 0!==t.language?t.language:(r="data-neurodyn-ai-try-on-language","en"===(a=e.getAttribute(r))||"ru"===a?a:void 0),productImageSrc:void 0!==t.productImageSrc?t.productImageSrc:g3(e,"data-neurodyn-ai-try-on-product-image-src"),productName:void 0!==t.productName?t.productName:g3(e,"data-neurodyn-ai-try-on-product-name"),productPrice:void 0!==t.productPrice?g2(t.productPrice):g1(e,"data-neurodyn-ai-try-on-product-price"),productUrl:void 0!==t.productUrl?t.productUrl:g1(e,"data-neurodyn-ai-try-on-product-url"),productType:function(e){if(!sY(e)){let t="string"==typeof e&&e.length>0?` "${e}"`:"";throw Error(`AI try-on product type from ${g0} must be one of: ${sG.join(", ")}; received${t||" no value"}`)}return e}(void 0!==t.productType?t.productType:e.getAttribute(g0)),apiKey:(n=void 0!==t.apiKey?t.apiKey:e.getAttribute("data-neurodyn-ai-try-on-api-key"),n?.trim()||void 0)}}(t))}n={destroy:function(){document.removeEventListener("click",g9),g5.destroy(),window.__neurodynAiTryOnDialog===n&&(window.__neurodynAiTryOnDialog=void 0)}},document.addEventListener("click",g9),window.__neurodynAiTryOnDialog=n})()})();
|
|
5509
|
+
Defaulting to \`null\`.`));let c=fk(o,u)?o:null,d=fw(c)?s(c,u):void 0;return(0,A.jsx)(fh,{scope:a,value:c,max:u,children:(0,A.jsx)(fu.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fw(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fb(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});fg.displayName=fc;var fm="ProgressIndicator",fv=L.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=ff(fm,r);return(0,A.jsx)(fu.div,{"data-state":fb(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fy(e,t){return`${Math.round(e/t*100)}%`}function fb(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fw(e){return"number"==typeof e}function fx(e){return fw(e)&&!isNaN(e)&&e>0}function fk(e,t){return fw(e)&&!isNaN(e)&&e<=t&&e>=0}function fS({className:e,value:t,max:r=100,...n}){let a=r>0?r:100,o="number"==typeof t?Math.min(Math.max(t/a*100,0),100):0;return(0,A.jsx)(fg,{"data-slot":"progress",className:i2("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:a,...n,children:(0,A.jsx)(fv,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fC(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...e,children:(0,A.jsx)("path",{d:"M8.21723 14.9975C8.10298 14.997 7.99004 14.9731 7.8854 14.9272C7.78077 14.8814 7.68665 14.8145 7.60889 14.7308L3.55889 10.4225C3.4075 10.2611 3.3264 10.0463 3.33343 9.82513C3.34046 9.604 3.43505 9.39471 3.59639 9.24332C3.75773 9.09192 3.97261 9.01082 4.19374 9.01785C4.41488 9.02489 4.62417 9.11948 4.77556 9.28082L8.20889 12.9392L15.2172 5.27248C15.2883 5.18392 15.3768 5.11083 15.4772 5.0577C15.5776 5.00458 15.6878 4.97254 15.8011 4.96355C15.9143 4.95456 16.0282 4.96882 16.1357 5.00544C16.2432 5.04207 16.3421 5.10029 16.4263 5.17652C16.5105 5.25276 16.5782 5.3454 16.6253 5.44877C16.6724 5.55213 16.6979 5.66403 16.7001 5.7776C16.7024 5.89116 16.6815 6.00399 16.6385 6.10916C16.5956 6.21433 16.5316 6.30961 16.4506 6.38915L8.83389 14.7225C8.75686 14.8077 8.66308 14.8761 8.55841 14.9234C8.45373 14.9707 8.34042 14.996 8.22556 14.9975H8.21723Z",fill:"currentColor"})})}function fP(e){return(0,A.jsxs)("svg",{fill:"none",viewBox:"0 0 19.9993 19.9996",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,A.jsx)("path",{d:"M16 9C16 7.14348 15.2629 5.36256 13.9502 4.0498C12.6374 2.73705 10.8565 2 9 2C7.14348 2 5.36256 2.73705 4.0498 4.0498C2.73705 5.36256 2 7.14348 2 9C2 10.8565 2.73705 12.6374 4.0498 13.9502C5.36256 15.2629 7.14348 16 9 16C10.8565 16 12.6374 15.2629 13.9502 13.9502C15.2629 12.6374 16 10.8565 16 9ZM18 9C18 11.3869 17.0521 13.6764 15.3643 15.3643C13.6764 17.0521 11.3869 18 9 18C6.61305 18 4.32357 17.0521 2.63574 15.3643C0.947915 13.6764 0 11.3869 0 9C0 6.61305 0.947915 4.32357 2.63574 2.63574C4.32357 0.947915 6.61305 0 9 0C11.3869 0 13.6764 0.947915 15.3643 2.63574C17.0521 4.32357 18 6.61305 18 9Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M13.9428 13.943C14.3333 13.5525 14.9663 13.5525 15.3568 13.943L19.7064 18.2926C20.097 18.6832 20.097 19.3162 19.7064 19.7067C19.3159 20.0972 18.6829 20.0972 18.2924 19.7067L13.9428 15.3571C13.5522 14.9666 13.5522 14.3335 13.9428 13.943Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 12.0001V6.00008C7.99983 5.4478 8.44755 5.00008 8.99983 5.00008C9.55211 5.00008 9.99983 5.4478 9.99983 6.00008V12.0001C9.99983 12.5524 9.55211 13.0001 8.99983 13.0001C8.44755 13.0001 7.99983 12.5524 7.99983 12.0001Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M11.9998 8.00008C12.5521 8.00008 12.9998 8.4478 12.9998 9.00008C12.9998 9.55237 12.5521 10.0001 11.9998 10.0001H5.99983C5.44755 10.0001 4.99983 9.55237 4.99983 9.00008C4.99983 8.4478 5.44755 8.00008 5.99983 8.00008H11.9998Z",fill:"currentColor"})]})}function fE(e){return t=>{let r=t.currentTarget;e&&r.getAttribute("src")!==e&&(r.src=e)}}function fT({children:e,className:t,...r}){return(0,A.jsx)("div",{className:i2("relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100",t),...r,children:e})}function fR({className:e,src:t}){return(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:t}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"})]})}function fO({backdropClassName:e,className:t,fallbackSrc:r,imageClassName:n,photo:a}){let o=a?.src??r,i=fE(r);return(0,A.jsxs)(A.Fragment,{children:[o&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",t,e),src:o,onError:i}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"}),o&&(0,A.jsx)("img",{alt:a?.name??"",className:i2("absolute inset-0 size-full object-contain",t,n),src:o,onError:i})]})}function fj({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return(0,A.jsxs)(A.Fragment,{children:[n&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:n,onError:fE(t)}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/20"})]})}function fN({className:e,...t}){let r=(0,L.useId)().replace(/:/g,""),n=`${r}-loading-texture-gradient`,a=`${r}-loading-texture-pattern`,o=`${r}-loading-texture-mask`;return(0,A.jsxs)("svg",{className:i2("text-constant-white",e),fill:"none",focusable:"false",viewBox:"0 0 776 992",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,A.jsxs)("defs",{children:[(0,A.jsxs)("radialGradient",{id:n,cx:"0",cy:"0",gradientTransform:"translate(388 496) rotate(90) scale(1021)",gradientUnits:"userSpaceOnUse",r:"1",children:[(0,A.jsx)("stop",{stopColor:"currentColor",stopOpacity:"0.7"}),(0,A.jsx)("stop",{offset:"0.586538",stopColor:"currentColor",stopOpacity:"0"})]}),(0,A.jsx)("pattern",{id:a,width:"24",height:"24",patternUnits:"userSpaceOnUse",children:(0,A.jsx)("circle",{cx:"4",cy:"4",r:"4",fill:"currentColor"})}),(0,A.jsx)("mask",{id:o,children:(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${a})`})})]}),(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${n})`,mask:`url(#${o})`})]})}function fz({animated:e=!1,className:t,...r}){return(0,A.jsxs)("div",{"aria-hidden":"true",className:i2("absolute h-133 w-104 max-w-none",t),...r,children:[!e&&(0,A.jsx)(fN,{className:"absolute inset-0 size-full opacity-30"}),e&&(0,A.jsx)("span",{className:"absolute inset-0 [mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [mask-position:center] [mask-repeat:no-repeat] [mask-size:18%_18%] [-webkit-mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [-webkit-mask-position:center] [-webkit-mask-repeat:no-repeat] [-webkit-mask-size:18%_18%] animate-[ai-try-on-loading-texture-pulse_2.6s_linear_infinite] motion-reduce:animate-none motion-reduce:[mask-size:220%_220%] motion-reduce:[-webkit-mask-size:220%_220%]",children:(0,A.jsx)(fN,{className:"absolute inset-0 size-full opacity-70"})})]})}function f_({badge:e,className:t,fallbackSrc:r,photo:n,selected:a,...o}){return(0,A.jsxs)("button",{className:i2("group relative aspect-square w-full overflow-hidden rounded-xl bg-background-base-2 text-left ring-offset-2 transition","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground",a?"ring-2 ring-foreground":null,t),type:"button",...o,children:[n?.src?(0,A.jsx)("img",{alt:n.name??"",className:"size-full object-cover",src:n.src}):r?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:r}):null,a&&(0,A.jsx)("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-foreground text-background-containers",children:(0,A.jsx)(fC,{className:"size-4"})}),e&&(0,A.jsx)("span",{className:"absolute right-2 top-2",children:e})]})}function fA({className:e,label:t,progress:r=0,...n}){let a=Math.min(Math.max(r,0),100);return(0,A.jsxs)("div",{className:i2("rounded-xl bg-background-base px-6 py-8",e),...n,children:[(0,A.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm font-medium text-text-sub",children:[(0,A.jsx)("span",{children:t}),(0,A.jsxs)("span",{children:[Math.round(a),"%"]})]}),(0,A.jsx)(fS,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fL({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return n?(0,A.jsx)("img",{alt:r?.name??"",className:i2("absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover",e),src:n,onError:fE(t)}):null}function fI({className:e,imageSrc:t,name:r}){return t?(0,A.jsx)("img",{alt:r??"",className:i2("absolute bottom-2 left-2 h-30 w-auto rounded-xl border border-background-containers bg-background-containers object-contain shadow-md",e),src:t}):null}function fM({good:e,imageSrc:t,label:r}){return(0,A.jsxs)("figure",{className:"flex min-w-0 flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"relative aspect-square w-full overflow-hidden rounded-xl border border-border-light bg-background-base",children:[(0,A.jsx)("img",{alt:r,className:"size-full object-cover",src:t}),(0,A.jsx)("span",{className:i2("absolute right-2 top-2 flex size-7 items-center justify-center rounded-full",e?"bg-background-green":"bg-background-red"),children:e?(0,A.jsx)(fC,{className:"size-5 text-background-containers"}):(0,A.jsx)(fr,{className:"size-5 text-background-containers"})})]}),(0,A.jsx)("figcaption",{className:"w-[90%] break-words text-xs font-medium leading-[1.6] tracking-[0.02em] text-text-base",children:r})]})}function fF({className:e,onOpenComparison:t,productLabel:r,productUrl:n,result:a,zoomLabel:o}){let i="inline-flex h-8 min-w-0 max-w-52 flex-1 items-center justify-center gap-1.5 rounded-xl bg-button-light px-3 text-xs font-semibold text-text-dark";return(0,A.jsxs)(fT,{"aria-label":o,className:i2("block cursor-pointer text-left",e),role:"button",tabIndex:0,onClick:t,onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},children:[(0,A.jsx)(fO,{photo:a?.after}),(0,A.jsxs)("div",{className:"absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2",children:[n?(0,A.jsxs)("a",{className:i,href:n,onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(fo,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}):(0,A.jsxs)("span",{className:i,children:[(0,A.jsx)(fo,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}),(0,A.jsx)("button",{"aria-label":o,className:"inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-button-light text-text-dark",type:"button",onClick:e=>{e.stopPropagation(),t()},children:(0,A.jsx)(fP,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fD({addToCartError:e,addToCartPending:t=!1,onAddToCart:r,onClose:n,onDeleteResult:a,onSaveResult:o,onShareResult:i,portalContainer:s,productName:l,productPrice:u,productUrl:c,result:d}){var p;let{t:h}=rT(),f=l??h("resultProductLink"),g=(p=u,p?.trim()||void 0),m=g?h("resultTryAnotherWithPrice",{price:g}):h("resultTryAnother");return(0,A.jsx)(sr,{open:!0,onOpenChange:e=>!e&&n(),children:(0,A.jsxs)(so,{className:"dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none bg-[#212124E5] p-0 text-text-dark duration-200 sm:max-w-none sm:p-0",portalContainer:s,showCloseButton:!1,children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:h("comparisonTitle")}),(0,A.jsx)(sl,{children:h("comparisonSlider")})]}),(0,A.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[c?(0,A.jsx)(i4,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,A.jsxs)("a",{href:c,children:[(0,A.jsx)(fo,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]})}):(0,A.jsxs)(i4,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,A.jsx)(fo,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":h("close"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,A.jsx)(fr,{className:"!size-3","data-icon":"inline-start"})})]}),(0,A.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center px-8",children:(0,A.jsxs)(h8,{"aria-label":h("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,A.jsx)(h7,{position:"right",children:(0,A.jsx)(fL,{className:"w-full object-contain",photo:d?.after})}),(0,A.jsx)(h7,{position:"left",children:(0,A.jsx)(fL,{className:"w-full object-contain",photo:d?.before})}),(0,A.jsxs)(fe,{className:"w-11",children:[(0,A.jsx)("div",{className:"absolute left-1/2 h-full w-0.5 -translate-x-1/2 bg-constant-white"}),(0,A.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-constant-white text-constant-black shadow-lg",children:(0,A.jsx)("span",{className:"h-5 w-0.5 rounded-full bg-current"})})]})]})}),(0,A.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1 px-8 pb-6 pt-3",children:[e&&(0,A.jsx)("p",{className:"text-xs text-text-sub",role:"alert",children:e}),(0,A.jsxs)("div",{className:"flex h-23 w-full max-w-104 items-start gap-2",children:[r&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:t,size:"lg",type:"button",variant:"contrast",onClick:r,children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:m})]}),(0,A.jsx)(i4,{"aria-label":h("share"),size:"icon-lg",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fi,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("download"),size:"icon-lg",type:"button",variant:"outline",onClick:o,children:(0,A.jsx)(fn,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){a()},children:(0,A.jsx)(fa,{"data-icon":"inline-start"})})]})]})]})})}fv.displayName=fm;let fB=i5("inline-flex w-fit items-center justify-center overflow-hidden rounded-full whitespace-nowrap",{variants:{variant:{default:"bg-contrast text-contrast-foreground",secondary:"bg-[var(--color-background-gray-transparent)] text-text-base",positive:"bg-[var(--color-background-green-transparent)] text-text-green",negative:"bg-[var(--color-background-red-transparent)] text-text-red",standard:"bg-[var(--color-background-blue-transparent)] text-text-blue"},size:{sm:"h-6 px-2 typo-button-small",md:"h-[30px] px-3 typo-button-normal"}},defaultVariants:{variant:"default",size:"sm"}});function f$({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,A.jsx)(n?o0:"span",{"data-slot":"badge",className:i2(fB({variant:t,size:r,className:e})),...a})}function fV({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl",e),...t})}function fU({badge:e,badgeTone:t="gray",className:r,closeLabel:n,leftSlot:a,middleSlot:o,onClose:i,preferMiddleSlotFirst:s=!1,showCloseButton:l=!1,...u}){let c=e?(0,A.jsx)(fH,{tone:t,children:e}):null;return(0,A.jsxs)("div",{className:i2("flex h-17 items-center justify-between p-4",r),...u,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[a,s?o:c,s?c:o]}),l&&(0,A.jsx)(i4,{"aria-label":n,size:"icon",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fr,{"data-icon":"inline-start"})})]})}function fH({className:e,tone:t="gray",...r}){return(0,A.jsx)(f$,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fW({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex min-h-0 flex-1 flex-col animate-in fade-in-0 duration-100 motion-reduce:animate-none",e),...t})}function fq(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{d:"M21.1667 8.4C21.1667 8.16131 21.07 7.93245 20.8981 7.76367C20.7262 7.59489 20.4931 7.5 20.25 7.5H16.5833C16.2768 7.5 15.9906 7.3496 15.8206 7.09922L14.2594 4.8H9.74056L8.17936 7.09922C8.00935 7.3496 7.72316 7.5 7.41667 7.5H3.75C3.50688 7.5 3.2738 7.59489 3.10189 7.76367C2.92998 7.93245 2.83333 8.16131 2.83333 8.4V18.3C2.83333 18.5387 2.92998 18.7675 3.10189 18.9363C3.2738 19.1051 3.50689 19.2 3.75 19.2H20.25C20.4931 19.2 20.7262 19.1051 20.8981 18.9363C21.07 18.7675 21.1667 18.5387 21.1667 18.3V8.4ZM14.75 12.9C14.75 12.184 14.46 11.4973 13.9443 10.991C13.4287 10.4847 12.7292 10.2001 12 10.2C11.2707 10.2 10.5705 10.4847 10.0548 10.991C9.53923 11.4973 9.25 12.1841 9.25 12.9C9.25 13.6159 9.53923 14.3027 10.0548 14.809C10.5705 15.3153 11.2707 15.6 12 15.6C12.7292 15.5999 13.4287 15.3153 13.9443 14.809C14.46 14.3027 14.75 13.616 14.75 12.9ZM16.5833 12.9C16.5833 14.0934 16.1 15.2377 15.2406 16.0816C14.3811 16.9255 13.2155 17.3999 12 17.4C10.7844 17.4 9.61809 16.9256 8.75854 16.0816C7.89919 15.2378 7.41667 14.0933 7.41667 12.9C7.41667 11.7067 7.89919 10.5622 8.75854 9.71836C9.61809 8.87445 10.7844 8.4 12 8.4C13.2155 8.40008 14.3811 8.87452 15.2406 9.71836C16.1 10.5623 16.5833 11.7066 16.5833 12.9ZM23 18.3C23 19.0161 22.7101 19.7026 22.1943 20.209C21.6786 20.7153 20.9793 21 20.25 21H3.75C3.02065 21 2.32139 20.7153 1.80566 20.209C1.28994 19.7026 1 19.0161 1 18.3V8.4C1 7.68392 1.28994 6.99736 1.80566 6.49102C2.32139 5.98467 3.02065 5.7 3.75 5.7H6.92611L8.4873 3.40078L8.55623 3.31201C8.72911 3.11535 8.98172 3 9.25 3H14.75L14.8637 3.00703C15.1262 3.03922 15.3639 3.18167 15.5127 3.40078L17.0739 5.7H20.25C20.9793 5.7 21.6786 5.98467 22.1943 6.49102C22.7101 6.99736 23 7.68392 23 8.4V18.3Z",fill:"currentColor"})})}function fK(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 5.00342 8.37303",fill:"none",...e,children:(0,A.jsx)("path",{d:"M1 1L4.00342 4.18652L1 7.37303",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fG(e){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,A.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function fX(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 3C18.7956 3 19.5585 3.3163 20.1211 3.87891C20.6837 4.44152 21 5.20435 21 6V18C21 18.7956 20.6837 19.5585 20.1211 20.1211C19.5585 20.6837 18.7956 21 18 21H6C5.20435 21 4.44152 20.6837 3.87891 20.1211C3.3163 19.5585 3 18.7956 3 18V6C3 5.20435 3.3163 4.44152 3.87891 3.87891C4.44152 3.3163 5.20435 3 6 3H18ZM14.0352 12C13.8633 12 13.6974 12.0639 13.5703 12.1797L6 19H18C18.2876 18.977 18.5547 18.8414 18.7422 18.6221C18.9296 18.4028 19.0221 18.1177 19 17.8301V16.6602L14.5 12.1797C14.3729 12.0639 14.2071 12 14.0352 12ZM8 7C7.60218 7 7.22076 7.15815 6.93945 7.43945C6.65815 7.72076 6.5 8.10218 6.5 8.5C6.5 8.89782 6.65815 9.27924 6.93945 9.56055C7.22076 9.84185 7.60218 10 8 10C8.39782 10 8.77924 9.84185 9.06055 9.56055C9.34185 9.27924 9.5 8.89782 9.5 8.5C9.5 8.10218 9.34185 7.72076 9.06055 7.43945C8.77924 7.15815 8.39782 7 8 7Z",fill:"currentColor"})})}function fY(e){return(0,A.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,A.jsx)("path",{d:"M6.05944 11.1406C6.47507 8.23438 8.97819 6 12.0001 6C13.6563 6 15.1563 6.67187 16.2438 7.75625L16.2626 7.775L16.5001 8H15.0032C14.4501 8 14.0032 8.44687 14.0032 9C14.0032 9.55313 14.4501 10 15.0032 10H19.0032C19.5563 10 20.0032 9.55313 20.0032 9V5C20.0032 4.44688 19.5563 4 19.0032 4C18.4501 4 18.0032 4.44688 18.0032 5V6.66875L17.6501 6.33437C16.2032 4.89375 14.2032 4 12.0001 4C7.96882 4 4.63444 6.98125 4.08132 10.8594C4.00319 11.4062 4.38132 11.9125 4.92819 11.9906C5.47507 12.0688 5.98132 11.6875 6.05944 11.1438V11.1406ZM19.9188 13.1406C19.9969 12.5938 19.6157 12.0875 19.0719 12.0094C18.5282 11.9312 18.0188 12.3125 17.9407 12.8562C17.5251 15.7625 15.0219 17.9969 12.0001 17.9969C10.3438 17.9969 8.84382 17.325 7.75632 16.2406L7.73757 16.2219L7.50007 15.9969H8.99694C9.55007 15.9969 9.99694 15.55 9.99694 14.9969C9.99694 14.4437 9.55007 13.9969 8.99694 13.9969L5.00007 14C4.73444 14 4.47819 14.1063 4.29069 14.2969C4.10319 14.4875 3.99694 14.7406 4.00007 15.0094L4.03132 18.9781C4.03444 19.5312 4.48757 19.975 5.04069 19.9688C5.59382 19.9625 6.03757 19.5125 6.03132 18.9594L6.01882 17.35L6.35319 17.6656C7.80007 19.1062 9.79694 20 12.0001 20C16.0313 20 19.3657 17.0187 19.9188 13.1406Z",fill:"currentColor"})})}function fQ({className:e,...t}){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:i2("size-6",e),...t,children:[(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}let fZ={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},fJ={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},f0={bag:{cards:[{good:!0,imageSrc:ou,labelKey:"bagIntroGoodFullBody"},{good:!0,imageSrc:ol,labelKey:"bagIntroGoodAngle"},{good:!1,imageSrc:os,labelKey:"bagIntroBadHandsFull"},{good:!1,imageSrc:oi,labelKey:"bagIntroBadCropped"}],subtitleKey:"bagIntroSubtitle",titleKey:"bagIntroTitle"},eyewear:{cards:[{good:!0,imageSrc:op,labelKey:"eyewearIntroGoodFacingCamera"},{good:!0,imageSrc:oh,labelKey:"eyewearIntroGoodHairBack"},{good:!1,imageSrc:od,labelKey:"eyewearIntroBadWearingGlasses"},{good:!1,imageSrc:oc,labelKey:"eyewearIntroBadFaceTurned"}],subtitleKey:"eyewearIntroSubtitle",titleKey:"eyewearIntroTitle"},footwear:{cards:[{good:!0,imageSrc:ov,labelKey:"footwearIntroGoodStanding"},{good:!0,imageSrc:om,labelKey:"footwearIntroGoodKneesDown"},{good:!1,imageSrc:og,labelKey:"footwearIntroBadOneFootCropped"},{good:!1,imageSrc:of,labelKey:"footwearIntroBadFeetHidden"}],subtitleKey:"footwearIntroSubtitle",titleKey:"footwearIntroTitle"},"full-body":{cards:[{good:!0,imageSrc:ox,labelKey:"fullBodyIntroGoodHeadToToe"},{good:!0,imageSrc:ow,labelKey:"fullBodyIntroGoodAngle"},{good:!1,imageSrc:oy,labelKey:"fullBodyIntroBadCropped"},{good:!1,imageSrc:ob,labelKey:"fullBodyIntroBadSitting"}],subtitleKey:"fullBodyIntroSubtitle",titleKey:"fullBodyIntroTitle"},headwear:{cards:[{good:!0,imageSrc:oP,labelKey:"headwearIntroGoodFront"},{good:!0,imageSrc:oC,labelKey:"headwearIntroGoodAngle"},{good:!1,imageSrc:oS,labelKey:"headwearIntroBadWearingHat"},{good:!1,imageSrc:ok,labelKey:"headwearIntroBadCroppedHead"}],subtitleKey:"headwearIntroSubtitle",titleKey:"headwearIntroTitle"},"lower-body":{cards:[{good:!0,imageSrc:oO,labelKey:"lowerBodyIntroGoodWaistToFeet"},{good:!0,imageSrc:oR,labelKey:"lowerBodyIntroGoodFullBody"},{good:!1,imageSrc:oT,labelKey:"lowerBodyIntroBadSitting"},{good:!1,imageSrc:oE,labelKey:"lowerBodyIntroBadCoveredWaist"}],subtitleKey:"lowerBodyIntroSubtitle",titleKey:"lowerBodyIntroTitle"},neck:{cards:[{good:!0,imageSrc:oz,labelKey:"neckIntroGoodHairUp"},{good:!0,imageSrc:o_,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:oN,labelKey:"neckIntroBadHighCollar"}],subtitleKey:"neckIntroSubtitle",titleKey:"neckIntroTitle"},"upper-body":{cards:[{good:!0,imageSrc:oM,labelKey:"upperBodyIntroGoodFacingCamera"},{good:!0,imageSrc:oI,labelKey:"upperBodyIntroGoodAngle"},{good:!1,imageSrc:oA,labelKey:"upperBodyIntroBadArmsCrossed"},{good:!1,imageSrc:oL,labelKey:"upperBodyIntroBadObjectBlockingTorso"}],subtitleKey:"upperBodyIntroSubtitle",titleKey:"upperBodyIntroTitle"},waist:{cards:[{good:!0,imageSrc:oB,labelKey:"waistIntroGoodFullBody"},{good:!0,imageSrc:o$,labelKey:"waistIntroGoodTopTucked"},{good:!1,imageSrc:oF,labelKey:"waistIntroBadOversizedTop"},{good:!1,imageSrc:oD,labelKey:"waistIntroBadSitting"}],subtitleKey:"waistIntroSubtitle",titleKey:"waistIntroTitle"},wrist:{cards:[{good:!0,imageSrc:oH,labelKey:"wristIntroGoodCloseUp"},{good:!0,imageSrc:oW,labelKey:"wristIntroGoodSleeveBack"},{good:!1,imageSrc:oV,labelKey:"wristIntroBadClenchedFist"},{good:!1,imageSrc:oU,labelKey:"wristIntroBadCovered"}],subtitleKey:"wristIntroSubtitle",titleKey:"wristIntroTitle"}};function f1({view:e}){let{t}=rT(),r=e.productType?f0[e.productType]:null;return(0,A.jsxs)(gn,{title:t("startTitle"),subtitle:t(r?.titleKey??"externalPhotoHint"),children:[(0,A.jsxs)(fT,{className:"mt-3",children:[(0,A.jsx)(fR,{src:e.productImageSrc}),(0,A.jsx)(fL,{fallbackSrc:e.productImageSrc})]}),(0,A.jsxs)(ga,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,A.jsx)(fq,{"data-icon":"inline-start"}),t("startUpload")]}),(0,A.jsxs)(i4,{className:"w-full",disabled:!e.canOpenHistory,size:"lg",type:"button",variant:"outline",onClick:e.openHistory,children:[(0,A.jsx)(fX,{"data-icon":"inline-start"}),t("startHistory")]}),(0,A.jsx)(go,{})]})]})}function f2({view:e}){let{t}=rT(),r=e.productType?f0[e.productType]:null;return r?(0,A.jsxs)(gn,{title:t(r.titleKey),subtitle:t(r.subtitleKey),children:[(0,A.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:gap-4",children:r.cards.map(e=>(0,A.jsx)(fM,{good:e.good,imageSrc:e.imageSrc,label:t(e.labelKey)},e.labelKey))}),(0,A.jsx)("div",{className:"mt-4",children:(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.continueIntro,children:t("introCta")})})]}):null}function f3({view:e}){let{t}=rT();return(0,A.jsxs)(gn,{title:t("historyTitle"),subtitle:t("historySubtitle"),children:[(0,A.jsx)("div",{className:"mt-3 grid min-h-104 flex-1 grid-cols-3 content-start gap-x-3 gap-y-4 overflow-x-hidden overflow-y-auto overscroll-contain pb-2 sm:gap-4",children:e.history.map(r=>(0,A.jsx)(f_,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,A.jsxs)(ga,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,A.jsx)(fG,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,A.jsx)(go,{})]})]})}function f5({view:e}){let{t}=rT();return(0,A.jsxs)(gn,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,A.jsxs)(fT,{className:"mt-3",children:[(0,A.jsx)(fO,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fI,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,A.jsxs)(ga,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),t("confirmGenerate")]}),(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,A.jsx)(go,{})]})]})}function f9(){let{t:e}=rT();return(0,A.jsx)(gn,{title:e("activationLoading"),subtitle:e("activationLoadingSubtitle"),children:(0,A.jsx)(fT,{className:"mt-3",children:(0,A.jsx)(fz,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"})})})}function f4({onClose:e,temporary:t}){let{t:r}=rT();return(0,A.jsx)(gn,{title:r("activationUnavailableTitle"),subtitle:r(t?"activationTemporarilyUnavailable":"externalProductUnavailable"),children:(0,A.jsxs)(ga,{className:"mt-4",children:[e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e,children:r("close")}),(0,A.jsx)(go,{className:"text-text-sub"})]})})}function f6({onClose:e,onRetry:t}){let{t:r}=rT();return(0,A.jsx)(gn,{title:r("errorTitle"),subtitle:r("externalServiceUnavailable"),children:(0,A.jsxs)(ga,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),r("errorRetry")]}),e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e,children:r("close")}),(0,A.jsx)(go,{className:"text-text-sub"})]})})}function f8({view:e}){let{t}=rT();return(0,A.jsxs)(gn,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,A.jsxs)(fT,{className:"mt-3",children:[(0,A.jsx)(fj,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fz,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:e.photo.src}):null})]})]}),(0,A.jsx)(fA,{className:"mt-4",label:t("processingProgress"),progress:e.processingProgress})]})}function f7({view:e,onClose:t}){let{t:r}=rT(),n="upload-validation"===e.error.kind&&"file-too-large"===e.error.code,a="generation"===e.error.kind?e.error.code:void 0;return(0,A.jsxs)(gn,{title:r(n?"errorFileTooLarge":"errorTitle"),subtitle:n?void 0:r((a?({tokens:"externalNoTokens",product:"externalProductUnavailable",service:"externalServiceUnavailable",timeout:"externalTimeout","photo-required":"externalPhotoRequired"})[a]:void 0)??"errorSubtitle"),children:[!n&&!a&&(0,A.jsxs)(fT,{className:"mt-3",children:[(0,A.jsx)(fj,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fz,{className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-6 px-6 sm:px-12",children:[(0,A.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white bg-background-containers shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:e.photo.name??"",className:"size-full object-cover",src:e.photo.src,onError:fE(e.productImageSrc)}):null})]}),(0,A.jsx)("p",{className:"w-56 text-center text-xs font-medium tracking-wider text-constant-white",children:r("errorGuidance")})]})]}),(0,A.jsxs)(ga,{className:"mt-4",children:[(!a||"service"===a||"timeout"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),r("errorRetry")]}),(!a||"photo-required"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),r("errorDifferentPhoto")]}),a&&t&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:t,children:r("close")}),(0,A.jsx)(go,{className:"text-text-sub"})]})]})}function ge({view:e,showAddToCart:t=!0,onAddToCart:r,addToCartPending:n=!1,addToCartError:a}){let{t:o}=rT(),i=r??e.addToCart,s=gi(e.productPrice),l=s?o("resultTryAnotherWithPrice",{price:s}):o("resultTryAnother");return e.myFitsOpen?(0,A.jsx)("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain pb-4",children:(0,A.jsx)("div",{className:"flex flex-col gap-4 px-6 pb-2 pt-4 sm:px-8",children:e.resultHistory.map((r,a)=>(0,A.jsx)(gt,{compact:a>0,onAddToCart:t?i:void 0,addToCartPending:n,productName:r.productName??e.productName,productPrice:r.productPrice,productUrl:r.productUrl??e.productUrl,result:r,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},r.id??r.after.id))})}):(0,A.jsxs)(gn,{className:"pb-6",subtitle:void 0,title:o("resultTitle"),children:[(0,A.jsx)(fF,{className:"mt-6",productLabel:e.productName??o("resultProductLink"),productUrl:e.productUrl,zoomLabel:o("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,A.jsxs)(ga,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",disabled:n,size:"lg",type:"button",variant:"contrast",onClick:i,children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),l]}),a&&(0,A.jsx)("p",{className:"text-center text-xs text-text-sub",role:"alert",children:a}),(0,A.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),o("resultCompare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,A.jsx)(fi,{"data-icon":"inline-start"}),o("resultShare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),o("resultReset")]})]})]})]})}function gt({compact:e=!1,onAddToCart:t,addToCartPending:r=!1,onDeleteResult:n,onOpenComparison:a,onSaveResult:o,onShareResult:i,productName:s,productPrice:l,productUrl:u,result:c}){let{t:d}=rT(),p=s??d("resultProductLink"),h=gi(l),f=h?d("resultTryAnotherWithPrice",{price:h}):d("resultTryAnother");return(0,A.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,A.jsx)(fF,{productLabel:p,productUrl:u,zoomLabel:d("resultOpenComparison"),result:c,onOpenComparison:()=>a(c.id)}),(0,A.jsxs)("div",{className:"flex gap-2",children:[t&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:r,size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":d("share"),size:"icon",type:"button",variant:"outline",onClick:()=>i(c.id),children:(0,A.jsx)(fi,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":d("download"),size:"icon",type:"button",variant:"outline",onClick:()=>o(c.id),children:(0,A.jsx)(fn,{"data-icon":"inline-start"})}),!e&&(0,A.jsx)(i4,{"aria-label":d("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>n(c.id),children:(0,A.jsx)(fa,{"data-icon":"inline-start"})})]})]})}function gr({label:e,onClick:t}){return(0,A.jsx)(i4,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fK,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function gn({children:e,className:t,subtitle:r,title:n}){return(0,A.jsxs)("div",{className:i2("flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto overscroll-contain px-6 pb-5 sm:px-8",t),children:[(0,A.jsxs)("div",{className:"mb-1 flex flex-col gap-1",children:[(0,A.jsx)("h2",{className:"text-2xl font-medium tracking-tight text-text-dark",children:n}),r&&(0,A.jsx)("p",{className:"text-sm font-medium text-text-base",children:r})]}),e]})}function ga({children:e,className:t}){return(0,A.jsx)("div",{className:i2("flex flex-col gap-2",t),children:e})}function go({className:e}){var t;let{i18n:r,t:n}=rT(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?fJ:fZ);return(0,A.jsxs)("p",{className:i2("pt-1 text-center text-xs font-medium text-text-base",e),children:[n("termsPrefix")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.terms,rel:"noopener noreferrer",target:"_blank",children:n("termsLink")})," ",n("termsJoiner")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.privacy,rel:"noopener noreferrer",target:"_blank",children:n("privacyLink")})]})}function gi(e){return e?.trim()||void 0}let gs=new Set(["avif","avis","heic","heix","heim","heis","hevc","hevx","mif1","msf1"]);async function gl(e){var t,r;let n,a,o=(t=e)instanceof Blob?t:t instanceof ArrayBuffer?new Blob([t]):ArrayBuffer.isView(t)?new Blob([new Uint8Array(t.buffer,t.byteOffset,t.byteLength)]):null;return!o||o.size<=0?{blob:null,errorText:null}:(r=new Uint8Array(await o.slice(0,16).arrayBuffer()),n=(...e)=>e.every((e,t)=>r[t]===e),a=(e,...t)=>t.every((t,n)=>r[e+n]===t),n(255,216,255)||n(137,80,78,71,13,10,26,10)||n(71,73,70,56)||n(66,77)||n(82,73,70,70)&&a(8,87,69,66,80)||a(4,102,116,121,112)&&gs.has(function(e){let t="";for(let r=8;r<12;r++)t+=String.fromCharCode(e[r]??0);return t}(r)))?{blob:o,errorText:null}:{blob:null,errorText:(await o.text().catch(()=>"")).slice(0,2e3)}}function gu(e){return"string"==typeof e?e.trim():""}function gc(e){if(e)return e;if("function"==typeof fetch)return fetch;throw Error("Fetch API is not available for AI try-on image upload")}async function gd(e,t,r={}){let{fetch:n,signal:a,timeoutMs:o}=r,i=new AbortController,s=()=>i.abort(a?.reason),l=void 0===o?void 0:setTimeout(()=>i.abort(new DOMException("AI try-on image upload timed out","TimeoutError")),o);a?.aborted?s():a?.addEventListener("abort",s,{once:!0});try{let r=await gc(n)(e,{body:t,method:"PUT",signal:i.signal});if(!r.ok){let e=await r.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${r.status}${e?`: ${e}`:""}`)}}finally{clearTimeout(l),a?.removeEventListener("abort",s)}}async function gp(e,t){let r=e?.trim();return r?gf(r,t,"AI try-on product image fetch failed"):null}async function gh(e,t){return e.blob?e.blob:e.file?e.file:e.src?gf(e.src,t,"AI try-on source photo fetch failed"):null}async function gf(e,t,r){let n=await gc(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}let gg="ai-try-on-result";async function gm(e,t={}){let r=await gy(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gw,o=t.revokeObjectUrl??gx,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gb(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gv(e,t={}){let r=await gy(e,t.fetch),n=t.navigator??globalThis.navigator;if(!r)return!1;if("function"==typeof File&&"function"==typeof n?.share){let a={files:[new File([r],gb(r,e,t.filename),{type:r.type||e?.type||"image/png"})]};if("function"!=typeof n.canShare||n.canShare(a))try{return await n.share(a),!0}catch(e){if("u">typeof DOMException&&e instanceof DOMException&&"AbortError"===e.name)return!1}}return gm(e,t)}async function gy(e,t=globalThis.fetch){if(!e)return null;if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof t)return null;try{let r=await t(e.src);if(!r.ok)return null;return r.blob()}catch{return null}}function gb(e,t,r=gg){var n;let a=function(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}(e.type||t?.type)??(n=t?.name,n?.match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??null)??"png",o=r.replace(/\.[a-z0-9]+$/i,"").replace(/[^\w-]+/g,"-").replace(/^-+|-+$/g,"")||gg;return`${o}.${a}`}function gw(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gx(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gk="results";function gS(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gC(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gk)||e.createObjectStore(gk,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gP(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gE(e){return{after:await gT(e.after),before:await gT(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}}async function gT(e){let t=await gR(e);if(!t)throw Error("AI try-on photo cannot be persisted without image data");return{blob:t,id:e.id,lastModified:e.file?.lastModified??e.lastModified,name:e.name,size:t.size,type:t.type||e.type}}async function gR(e){if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof fetch)return null;try{let t=await fetch(e.src);return t.ok?t.blob():null}catch{return null}}function gO(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gj(e,t=gN()){if(t)try{t.setItem(gO(e),"true")}catch{}}function gN(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gz={delete:async function e(e){let t=gS();if(!t)return!1;try{let r=await gC(t),n=r.transaction(gk,"readwrite"),a=gP(n);return n.objectStore(gk).delete(e),await a,r.close(),!0}catch(e){throw Error("AI try-on result could not be removed from history",{cause:e})}},list:async function e(){let e=gS();if(!e)return[];try{var t;let r=await gC(e),n=r.transaction(gk,"readonly"),a=gP(n),o=await (t=n.objectStore(gk).getAll(),new Promise((e,r)=>{t.onerror=()=>r(t.error),t.onsuccess=()=>e(t.result)}));return await a,r.close(),o.sort((e,t)=>t.createdAt-e.createdAt)}catch(e){throw Error("AI try-on history could not be loaded",{cause:e})}},save:async function e(e){let t=gS();if(!t)return!1;try{let r=await gE(e),n=await gC(t),a=n.transaction(gk,"readwrite"),o=gP(a);return a.objectStore(gk).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},g_={save:gm,share:gv},gA={consumeFirstView:function(e,t=gN()){return!function(e,t=gN()){if(!t)return!1;try{return"true"===t.getItem(gO(e))}catch{return!1}}(e,t)&&(gj(e,t),!0)},markSeen:gj},gL={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gI=["image/jpeg","image/png"];class gM{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productPrice:n,productType:a,productUrl:o,tipStore:i}){this.createObjectUrl=e,this.tipStore=i,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productPrice:gF(n),productType:a,productUrl:o,result:null,selectedPhoto:null,stage:"start"}}get view(){switch(this.state.stage){case"intro":return{productType:this.state.productType,stage:"intro"};case"history":return{history:this.state.history,stage:"history"};case"confirm":return{photo:this.state.selectedPhoto,productImageSrc:this.state.productImageSrc,productName:this.state.productName,stage:"confirm"};case"processing":return this.createProcessingView();case"error":return this.createErrorView();case"result":return{canOpenMyFits:this.state.history.length>0,myFitsOpen:this.state.myFitsOpen,productName:this.state.result?.productName??this.state.productName,productPrice:this.state.result?gF(this.state.result.productPrice):this.state.productPrice,productUrl:this.state.result?.productUrl??this.state.productUrl,result:this.state.result,resultHistory:function(e,t){if(!e)return[];let r=[e,...t.filter(t=>t.id!==e.id)];return r.filter((e,t)=>{let n=e.id??e.after.id;return r.findIndex(e=>(e.id??e.after.id)===n)===t})}(this.state.result,this.state.history),stage:"result"};default:return{canOpenHistory:this.state.history.length>0,productImageSrc:this.state.productImageSrc,productName:this.state.productName,productType:this.state.productType,productUrl:this.state.productUrl,stage:"start"}}}get comparison(){let e=this.getComparisonResult();return{open:this.state.comparisonOpen&&null!==e,productName:e?.productName??this.state.productName,productPrice:e?gF(e.productPrice):this.state.productPrice,productUrl:e?.productUrl??this.state.productUrl,result:e}}get selectedPhoto(){return this.state.selectedPhoto}get history(){return this.state.history}updateProduct({productImageSrc:e,productName:t,productPrice:r,productType:n,productUrl:a}){this.state={...this.state,productImageSrc:e,productName:t,productPrice:gF(r),productType:n,productUrl:a}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gD(e,t),[])}}failHistory(e,t){this.state={...this.state,error:{kind:"hydrate-history"===e?"history-load":"save-result"===e?"history-save":"history-delete",message:t}}}choosePhoto(){return this.state.productType&&this.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.state.productType&&this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(this.state.productType&&this.tipStore.markSeen(this.state.productType),this.goBack(),null):{type:"close-dialog"}}openHistory(){0!==this.state.history.length&&(this.state={...this.state,stage:"history"})}goBack(){switch(this.state.stage){case"intro":case"history":this.state={...this.state,stage:"start"};return;case"confirm":this.state={...this.state,stage:this.state.history.length>0?"history":"start"};return;case"processing":case"error":case"result":this.state={...this.state,stage:"confirm"}}}reset(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"}}selectHistoryResult(e){let t=this.state.history.find(t=>t.id===e);t&&(this.state={...this.state,error:null,myFitsOpen:!1,result:t,selectedPhoto:t.before,stage:"result"})}selectFile(e){var t,r;let n=(t=e,gI.includes(t.type)||""===t.type&&/\.(?:jpe?g|png)$/i.test(t.name)?t.size>0xa00000?"file-too-large":null:"unsupported-file-format");if(n)return this.state={...this.state,error:{code:n,kind:"upload-validation"},myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"error"},null;let a=this.createObjectUrl(e),o={blob:e,file:e,id:(r=e,`${r.name}-${r.size}-${r.lastModified}`),lastModified:e.lastModified,name:e.name,size:e.size,src:a,type:e.type};return this.selectPhoto(o),o}selectPhoto(e){this.state={...this.state,error:null,myFitsOpen:!1,processingProgress:0,selectedPhoto:e,stage:"confirm"}}startGeneration(){return!!this.state.selectedPhoto&&(this.state={...this.state,error:null,generationProduct:this.getProductMetadata(),myFitsOpen:!1,processingProgress:0,result:null,stage:"processing"},!0)}reportGenerationProgress(e){var t;"processing"===this.state.stage&&(this.state={...this.state,processingProgress:Math.max(this.state.processingProgress,Number.isFinite(t=e)?Math.min(Math.max(t,0),100):0)})}completeGeneration(e,t=Date.now()){let r=function(e,t,r=Date.now()){return{...e,...t,productPrice:gF(t.productPrice),createdAt:r,id:`${e.before.id}-result-${r}`}}(e,this.state.generationProduct??this.getProductMetadata(),t);return this.state={...this.state,error:null,generationProduct:null,history:gD(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e,t){this.state={...this.state,error:{kind:"generation",message:e,...t?{code:t}:{}},generationProduct:null,stage:"error"}}toggleMyFits(){"result"===this.state.stage&&0!==this.state.history.length&&(this.state={...this.state,myFitsOpen:!this.state.myFitsOpen})}closeMyFits(){this.state={...this.state,myFitsOpen:!1}}openComparison(e){let t=e?this.findResult(e):this.state.result;t&&(this.state={...this.state,comparisonOpen:!0,comparisonResultId:t.id})}closeComparison(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null}}deleteResult(e){let t=this.findResult(e),r=this.state.history.filter(t=>!gB(t,e)),n=this.state.result?.id??this.state.result?.after.id,a=this.getComparisonResult()?.id===e;if(n!==e)return this.state={...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,history:r},t;let o=r[0]??null;return this.state=o?{...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,error:null,generationProduct:null,history:r,myFitsOpen:r.length>0&&this.state.myFitsOpen,result:o,selectedPhoto:o.before,stage:"result"}:{...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:r,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"},t}resolveResultActionPhoto(e){let t=e?this.findResult(e):this.comparison.open?this.comparison.result:this.state.result;return t?.after??null}findResult(e){return this.state.history.find(t=>gB(t,e))??null}createProcessingView(){let e=this.state.generationProduct??this.getProductMetadata();return{photo:this.state.selectedPhoto,processingProgress:this.state.processingProgress,productImageSrc:e.productImageSrc,productName:e.productName,stage:"processing"}}createErrorView(){let e=this.state.generationProduct??this.getProductMetadata();return{error:this.state.error??{kind:"generation"},photo:this.state.selectedPhoto,productImageSrc:e.productImageSrc,productName:e.productName,stage:"error"}}getProductMetadata(){return{productImageSrc:this.state.productImageSrc,productName:this.state.productName,productPrice:this.state.productPrice,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gF(e){return e?.trim()||void 0}function gD(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gB(e,t){return e.id===t||e.after.id===t}class g$ extends Error{code;constructor(e){super(e),this.code=e,this.name="AiTryOnGenerationError"}}function gV(e,t){return{blob:e.blob,id:e.id,lastModified:e.lastModified,name:e.name,size:e.size,src:t(e.blob),type:e.type}}function gU(e,t){t&&(gH(e,t.before),gH(e,t.after))}function gH(e,t){gW(t)?.forEach(t=>e.add(t))}function gW(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gq(e){return function(e=5e3){return new Promise(t=>setTimeout(t,e))}(function(e,t=Date.now()){return Math.max(0,5e3-(t-e))}(e))}let gK={status:"ready"};function gG({dialogPortalContainer:e,language:t,onClose:r,onAddToCart:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,apiKey:d,showDialogCloseButton:p=!1,showAddToCart:h=!0,activation:f=gK,onRetryActivation:g}){a||sQ(l);let{i18n:m,t:v}=rT(),y=(0,L.useRef)(null),b=sA(d),w=(0,L.useMemo)(()=>c??sU({apiKey:b}),[c,b]);(0,L.useEffect)(()=>{"string"==typeof t&&m.changeLanguage(t)},[m,t]);let x=function({historyStore:e=gz,objectUrls:t=gL,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,resultActions:d=g_,tipStore:p=gA}){var h;let[,f]=(0,L.useReducer)(e=>e+1,0),g=(0,L.useRef)(new Set),m=(0,L.useRef)(!0);(0,L.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let v=(0,L.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&g.current.add(r),r},[t]),y=(0,L.useRef)(null);y.current||(y.current=new gM({createObjectUrl:v,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tipStore:p}));let b=y.current;b.updateProduct({productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u});let w=(0,L.useMemo)(()=>a||(sQ(l),function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sQ(n);let i=a??sU({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gh(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gp(r,t);if(!u||u.size<=0)throw Error("AI try-on product image is missing");o?.reportProgress(22),o?.reportProgress(32);let[c,d]=function(e,t){let r=e?.uploads;if(!Array.isArray(r)||r.length<2)throw Error("Nano Banana upload URL response is missing uploads");return r.slice(0,2).map(e=>{if(null===e||"object"!=typeof e)throw Error("Nano Banana upload URL response is missing uploads");let t=gu(e.key),r=gu(e.uploadUrl);if(!t||!r)throw Error("Nano Banana upload URL response is missing key or uploadUrl");return{key:t,uploadUrl:r}})}(await i.requestUploadUrls(2),2);o?.reportProgress(44),await Promise.all([gd(c.uploadUrl,l,{fetch:t}),gd(d.uploadUrl,u,{fetch:t})]),o?.reportProgress(62);let p=function(e){if(!e)return()=>{};e(70);let t=Date.now(),r=globalThis.setInterval(()=>{e(70+24*(1-(1-Math.min((Date.now()-t)/45e3,1))**3))},750);return()=>globalThis.clearInterval(r)}(o?.reportProgress);try{s=await i.generateTryOn({category:n,personImage:c.key,productImages:[d.key]},{timeout:9e4})}finally{p()}o?.reportProgress(96);let{blob:h}=await gl(s);if(!h)throw Error("AI try-on generation did not return an image");o?.reportProgress(98);let f=e(h);if(!f)throw Error("AI try-on result image URL cannot be created");return{before:a,after:{blob:h,id:`${a.id}-nano-banana-result`,name:a.name?`${a.name} result`:"AI try-on result",size:h.size,src:f,type:h.type||"image/jpeg"}}}}({createObjectUrl:t.createObjectUrl,productImageSrc:o,productType:l,tryOnClient:c})),[t,a,o,l,c]),x=(0,L.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),k=(0,L.useCallback)(()=>f(),[]),S=(0,L.useCallback)(e=>{let t=e()??null;k(),x(t)},[x,k]),C=(0,L.useCallback)(e=>{b.failHistory(e),k()},[b,k]),P=(0,L.useCallback)(t=>{e.save(t).catch(()=>{C("save-result")})},[e,C]),E=(0,L.useCallback)(t=>{e.delete(t).catch(()=>{C("delete-result")})},[e,C]),T=(0,L.useCallback)(()=>{S(()=>b.choosePhoto())},[S,b]),R=(0,L.useCallback)(async()=>{let e=b.selectedPhoto;if(!e||!b.startGeneration())return;k();let r=Date.now();try{var n;let a=await w(e,{reportProgress:e=>{m.current&&(b.reportGenerationProgress(e),k())}});if(await gq(r),!m.current){P(b.completeGeneration(a)),a.after.src.startsWith("blob:")&&t.revokeObjectUrl(a.after.src);return}let o=b.completeGeneration(a);n=g.current,gW(o.before)?.forEach(e=>n.add(e)),gW(o.after)?.forEach(e=>n.add(e)),P(o),k()}catch(e){if(await gq(r),!m.current)return;b.failGeneration(e instanceof Error?e.message:void 0,e instanceof g$?e.code:void 0),k()}},[t,P,w,b,k]),O=(0,L.useCallback)(e=>{let t=b.deleteResult(e);t&&E(t.id),k()},[E,b,k]),j=(0,L.useCallback)(e=>{d.save(b.resolveResultActionPhoto(e))},[d,b]),N=(0,L.useCallback)(e=>{d.share(b.resolveResultActionPhoto(e))},[d,b]),z=(0,L.useCallback)(()=>{c.sendWidgetEvent("add_to_cart_from_widget")},[c]);(0,L.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;b.hydrateHistory(r.map(e=>({after:gV(e.after,v),before:gV(e.before,v),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}))),k()}catch{t||C("hydrate-history")}}(),()=>{t=!0}},[v,e,C,b,k]),(0,L.useEffect)(()=>()=>{var e,r;e=g.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,L.useEffect)(()=>{var e,r,n,a,o;let i;a=g.current,e=b.view,r=b.comparison.result,n=b.history,i=new Set,"photo"in e&&gH(i,e.photo),"result"===e.stage&&(gU(i,e.result),e.resultHistory.forEach(e=>gU(i,e))),n.forEach(e=>gU(i,e)),gU(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,b.view,b.comparison.result,b.history]);let _=(0,L.useMemo)(()=>(function(e,{addToCart:t,choosePhoto:r,deleteResult:n,generate:a,runSessionCommand:o,saveResult:i,shareResult:s,sync:l}){let u=e.view;switch(u.stage){case"start":return{...u,choosePhoto:r,openHistory:()=>o(()=>e.openHistory())};case"intro":return{...u,continueIntro:()=>o(()=>e.continueIntro())};case"history":return{...u,chooseNew:r,selectResult:t=>o(()=>e.selectHistoryResult(t))};case"confirm":return{...u,changePhoto:r,generate:a};case"error":return{...u,chooseDifferentPhoto:r,retry:u.photo?a:r};case"result":return{...u,addToCart:t,changePhoto:()=>{e.closeMyFits(),l(),r()},deleteResult:n,openComparison:t=>o(()=>e.openComparison(t)),reset:()=>o(()=>e.reset()),saveResult:i,shareResult:s,toggleMyFits:()=>o(()=>e.toggleMyFits())};default:return u}})(b,{addToCart:z,choosePhoto:T,deleteResult:O,generate:()=>void R(),runSessionCommand:S,saveResult:j,shareResult:N,sync:k}),[z,T,O,R,S,j,b,N,k]);return{canGoBack:"start"!==(h=b.view.stage)&&"intro"!==h&&"processing"!==h&&"error"!==h&&"result"!==h,comparison:function(e,{addToCart:t,deleteResult:r,runSessionCommand:n,saveResult:a,shareResult:o}){let i=e.comparison;return{...i,addToCart:t,close:()=>n(()=>e.closeComparison()),deleteResult:()=>{let e=i.result?.id??i.result?.after.id;e&&r(e)},saveResult:()=>a(i.result?.id??i.result?.after.id),shareResult:()=>o(i.result?.id??i.result?.after.id)}}(b,{addToCart:z,deleteResult:O,runSessionCommand:S,saveResult:j,shareResult:N}),goBack:()=>S(()=>b.goBack()),requestClose:()=>S(()=>b.requestClose()),selectFile:e=>S(()=>{b.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>y.current?.click(),processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:w}),k=x.view.stage,S=r??x.requestClose,C="result"===x.view.stage&&x.view.myFitsOpen,[P,E]=(0,L.useState)(!1),[T,R]=(0,L.useState)(void 0),O=(0,L.useCallback)(()=>{"result"!==x.view.stage||(x.view.addToCart(),n&&(E(!0),R(void 0),Promise.resolve(n()).catch(e=>R(e instanceof Error&&e.message?e.message:v("externalServiceUnavailable"))).finally(()=>E(!1))))},[n,x.view,v]),j=x.canGoBack?(0,A.jsx)(gr,{label:v("back"),onClick:x.goBack}):null,N="result"===x.view.stage&&x.view.canOpenMyFits?(0,A.jsxs)(i4,{"aria-expanded":C,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:x.view.toggleMyFits,children:[v("myFits"),(0,A.jsx)(sZ,{className:i2("!size-3 transition-transform",C&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,A.jsxs)(fV,{className:C?"h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":k,children:[(0,A.jsx)(fU,{badge:"history"===k||"ready"!==f.status?null:v(function(e){switch(e){case"intro":return"introBadge";case"confirm":return"confirmBadge";case"processing":return"processingBadge";case"error":return"errorBadge";case"result":return"resultBadge";default:return"badge"}}(k)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(k),closeLabel:v("close"),leftSlot:"ready"===f.status?j:null,middleSlot:"ready"===f.status?N:null,preferMiddleSlotFirst:"result"===k,showCloseButton:p,onClose:"ready"===f.status?x.requestClose:S}),(0,A.jsx)("input",{ref:y,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&x.selectFile(t),e.currentTarget.value=""}}),(0,A.jsxs)(fW,{children:["loading"===f.status?(0,A.jsx)(f9,{}):null,"unavailable"===f.status?(0,A.jsx)(f4,{temporary:f.temporary,onClose:S}):null,"error"===f.status?(0,A.jsx)(f6,{onClose:S,onRetry:g}):null,"ready"!==f.status?null:(0,A.jsxs)(A.Fragment,{children:["start"===x.view.stage?(0,A.jsx)(f1,{view:x.view}):null,"intro"===x.view.stage?(0,A.jsx)(f2,{view:x.view}):null,"history"===x.view.stage?(0,A.jsx)(f3,{view:x.view}):null,"confirm"===x.view.stage?(0,A.jsx)(f5,{view:x.view}):null,"processing"===x.view.stage?(0,A.jsx)(f8,{view:x.view}):null,"error"===x.view.stage?(0,A.jsx)(f7,{view:x.view,onClose:x.requestClose}):null,"result"===x.view.stage?(0,A.jsx)(ge,{view:x.view,showAddToCart:h,onAddToCart:n?O:void 0,addToCartPending:P,addToCartError:T}):null]})]},"ready"===f.status?k:`activation-${f.status}`),x.comparison.open&&(0,A.jsx)(fD,{productName:x.comparison.productName,productPrice:x.comparison.productPrice,productUrl:x.comparison.productUrl,portalContainer:e??void 0,result:x.comparison.result,addToCartPending:P,addToCartError:T,onAddToCart:h?n?O:x.comparison.addToCart:void 0,onClose:x.comparison.close,onDeleteResult:x.comparison.deleteResult,onSaveResult:x.comparison.saveResult,onShareResult:x.comparison.shareResult})]})}sS({baseURL:"https://api.neurodyn.ai/"});let gX={status:"loading"},gY={status:"ready"};function gQ({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,apiKey:u,externalGeneration:c,externalActivation:d,externalAddToCart:p,externalClient:h,...f}){c||sQ(s);let g=(0,L.useMemo)(()=>{let e;return(e=rl.createInstance()).use(oo).use(rO).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sH}),e},[t]),[m,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(e),w=(0,L.useRef)(!1),x=void 0!==n,k=x?n:y,S=sA(u),C=(0,L.useMemo)(()=>c?h??sp:sU({apiKey:S}),[S,c,h]),[P,E]=(0,L.useState)(gX),[T,R]=(0,L.useState)(0),O=d?P:gY,j=(0,L.useRef)(d);function N(e){x||b(e),r?.(e)}return(0,L.useEffect)(()=>{j.current=d}),(0,L.useEffect)(()=>{let e=j.current;if(!e||(E(gX),!k))return;let t=!1;return e().then(e=>{t||E(e.enabled?{...e,status:"ready"}:{status:"unavailable",temporary:e.temporarilyUnavailable})}).catch(()=>{t||E({status:"error"})}),()=>{t=!0}},[T,k,!!d]),(0,L.useEffect)(()=>{if(!k){w.current=!1;return}"ready"!==O.status||w.current||(w.current=!0,C.sendWidgetEvent("widget_opened"))},[O.status,k,C]),(0,A.jsxs)(A.Fragment,{children:[(0,q.createPortal)((0,A.jsx)("style",{children:sd.A}),document.head),(0,q.createPortal)((0,A.jsxs)(rG.div,{className:"fixed inset-x-0 bottom-0 w-svw tracking-normal sm:inset-x-auto sm:right-4 sm:bottom-4 sm:w-120",style:{zIndex:0x7fffffff},children:[(0,A.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,A.jsx)("style",{children:sK}),(0,A.jsx)("div",{ref:v}),m&&(0,A.jsx)(sc,{defaultTheme:"light",root:m,storageKey:"neurodyn-ai-try-on-theme",children:(0,A.jsx)(rR,{i18n:g,children:(0,A.jsx)(gZ,{language:t,open:k,portalContainer:m,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,tryOnClient:C,externalGeneration:c,externalAddToCart:p,activation:O,onRetryActivation:()=>R(e=>e+1),onRequestClose:()=>N(!1),onOpenChange:N,...f})})})]}),document.body)]})}function gZ({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productPrice:o,productType:i,productUrl:s,tryOnClient:l,externalGeneration:u,externalAddToCart:c,activation:d,onRetryActivation:p,...h}){let{t:f}=rT();return(0,A.jsx)(sr,{...h,children:(0,A.jsxs)(so,{className:"inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:f("dialogTitle")}),(0,A.jsx)(sl,{children:f("dialogDescription")})]}),(0,A.jsx)(gG,{dialogPortalContainer:r,language:e,productImageSrc:"ready"===d.status&&d.productImageSrc||n,productName:a,productPrice:o,productType:"ready"===d.status?d.productType??i:i,productUrl:s,tryOnClient:l,processPhoto:u,activation:d,onRetryActivation:p,onAddToCart:c,showAddToCart:!u||!!c,showDialogCloseButton:!0,onClose:t})]})})}var gJ=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");let g0=0,g1="data-neurodyn-ai-try-on-product-type";function g2(e,t){return g3(e.getAttribute(t))}function g3(e){return e?.trim()||void 0}function g5(e,t){let r=g2(e,t);if(!r)throw Error(`AI try-on dialog trigger is missing ${t}`);return r}window.__neurodynAiTryOnDialog?.destroy();let g9=new class{container=null;openState=!1;props=null;root=null;destroy(){this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null,this.props=null,this.openState=!1}open(e){this.props=e,this.openState=!0,this.render()}handleOpenChange=e=>{this.openState=e,this.render()};ensureRoot(){return this.root||(this.container=document.createElement("div"),this.container.id=`neurodyn-ai-try-on-dialog-root-${g0++}`,document.body.appendChild(this.container),this.root=(0,gJ.createRoot)(this.container)),this.root}render(){let e=this.ensureRoot();this.props&&this.openState?e.render((0,L.createElement)(gQ,{...this.props,open:!0,onOpenChange:this.handleOpenChange})):e.render(null)}};function g4(e){let t=e.target instanceof Element?e.target.closest("[data-neurodyn-ai-try-on-dialog]"):null;t&&g9.open(function(e,t={}){var r,n;let a;return{language:void 0!==t.language?t.language:(r="data-neurodyn-ai-try-on-language","en"===(a=e.getAttribute(r))||"ru"===a?a:void 0),productImageSrc:void 0!==t.productImageSrc?t.productImageSrc:g5(e,"data-neurodyn-ai-try-on-product-image-src"),productName:void 0!==t.productName?t.productName:g5(e,"data-neurodyn-ai-try-on-product-name"),productPrice:void 0!==t.productPrice?g3(t.productPrice):g2(e,"data-neurodyn-ai-try-on-product-price"),productUrl:void 0!==t.productUrl?t.productUrl:g2(e,"data-neurodyn-ai-try-on-product-url"),productType:function(e){if(!sY(e)){let t="string"==typeof e&&e.length>0?` "${e}"`:"";throw Error(`AI try-on product type from ${g1} must be one of: ${sG.join(", ")}; received${t||" no value"}`)}return e}(void 0!==t.productType?t.productType:e.getAttribute(g1)),apiKey:(n=void 0!==t.apiKey?t.apiKey:e.getAttribute("data-neurodyn-ai-try-on-api-key"),n?.trim()||void 0)}}(t))}n={destroy:function(){document.removeEventListener("click",g4),g9.destroy(),window.__neurodynAiTryOnDialog===n&&(window.__neurodynAiTryOnDialog=void 0)}},document.addEventListener("click",g4),window.__neurodynAiTryOnDialog=n})()})();
|
|
@@ -5506,4 +5506,4 @@ ${h}
|
|
|
5506
5506
|
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
|
|
5507
5507
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5508
5508
|
|
|
5509
|
-
Defaulting to \`null\`.`));let c=fx(o,u)?o:null,d=fb(c)?s(c,u):void 0;return(0,_.jsx)(fp,{scope:a,value:c,max:u,children:(0,_.jsx)(fl.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fb(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fy(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});ff.displayName=fu;var fg="ProgressIndicator",fm=A.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=fh(fg,r);return(0,_.jsx)(fl.div,{"data-state":fy(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fv(e,t){return`${Math.round(e/t*100)}%`}function fy(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fb(e){return"number"==typeof e}function fw(e){return fb(e)&&!isNaN(e)&&e>0}function fx(e,t){return fb(e)&&!isNaN(e)&&e<=t&&e>=0}function fk({className:e,value:t,max:r=100,...n}){let a=r>0?r:100,o="number"==typeof t?Math.min(Math.max(t/a*100,0),100):0;return(0,_.jsx)(ff,{"data-slot":"progress",className:i1("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:a,...n,children:(0,_.jsx)(fm,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fS(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...e,children:(0,_.jsx)("path",{d:"M8.21723 14.9975C8.10298 14.997 7.99004 14.9731 7.8854 14.9272C7.78077 14.8814 7.68665 14.8145 7.60889 14.7308L3.55889 10.4225C3.4075 10.2611 3.3264 10.0463 3.33343 9.82513C3.34046 9.604 3.43505 9.39471 3.59639 9.24332C3.75773 9.09192 3.97261 9.01082 4.19374 9.01785C4.41488 9.02489 4.62417 9.11948 4.77556 9.28082L8.20889 12.9392L15.2172 5.27248C15.2883 5.18392 15.3768 5.11083 15.4772 5.0577C15.5776 5.00458 15.6878 4.97254 15.8011 4.96355C15.9143 4.95456 16.0282 4.96882 16.1357 5.00544C16.2432 5.04207 16.3421 5.10029 16.4263 5.17652C16.5105 5.25276 16.5782 5.3454 16.6253 5.44877C16.6724 5.55213 16.6979 5.66403 16.7001 5.7776C16.7024 5.89116 16.6815 6.00399 16.6385 6.10916C16.5956 6.21433 16.5316 6.30961 16.4506 6.38915L8.83389 14.7225C8.75686 14.8077 8.66308 14.8761 8.55841 14.9234C8.45373 14.9707 8.34042 14.996 8.22556 14.9975H8.21723Z",fill:"currentColor"})})}function fC(e){return(0,_.jsxs)("svg",{fill:"none",viewBox:"0 0 19.9993 19.9996",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,_.jsx)("path",{d:"M16 9C16 7.14348 15.2629 5.36256 13.9502 4.0498C12.6374 2.73705 10.8565 2 9 2C7.14348 2 5.36256 2.73705 4.0498 4.0498C2.73705 5.36256 2 7.14348 2 9C2 10.8565 2.73705 12.6374 4.0498 13.9502C5.36256 15.2629 7.14348 16 9 16C10.8565 16 12.6374 15.2629 13.9502 13.9502C15.2629 12.6374 16 10.8565 16 9ZM18 9C18 11.3869 17.0521 13.6764 15.3643 15.3643C13.6764 17.0521 11.3869 18 9 18C6.61305 18 4.32357 17.0521 2.63574 15.3643C0.947915 13.6764 0 11.3869 0 9C0 6.61305 0.947915 4.32357 2.63574 2.63574C4.32357 0.947915 6.61305 0 9 0C11.3869 0 13.6764 0.947915 15.3643 2.63574C17.0521 4.32357 18 6.61305 18 9Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M13.9428 13.943C14.3333 13.5525 14.9663 13.5525 15.3568 13.943L19.7064 18.2926C20.097 18.6832 20.097 19.3162 19.7064 19.7067C19.3159 20.0972 18.6829 20.0972 18.2924 19.7067L13.9428 15.3571C13.5522 14.9666 13.5522 14.3335 13.9428 13.943Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M7.99983 12.0001V6.00008C7.99983 5.4478 8.44755 5.00008 8.99983 5.00008C9.55211 5.00008 9.99983 5.4478 9.99983 6.00008V12.0001C9.99983 12.5524 9.55211 13.0001 8.99983 13.0001C8.44755 13.0001 7.99983 12.5524 7.99983 12.0001Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M11.9998 8.00008C12.5521 8.00008 12.9998 8.4478 12.9998 9.00008C12.9998 9.55237 12.5521 10.0001 11.9998 10.0001H5.99983C5.44755 10.0001 4.99983 9.55237 4.99983 9.00008C4.99983 8.4478 5.44755 8.00008 5.99983 8.00008H11.9998Z",fill:"currentColor"})]})}function fP({children:e,className:t,...r}){return(0,_.jsx)("div",{className:i1("relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100",t),...r,children:e})}function fE({className:e,src:t}){return(0,_.jsxs)(_.Fragment,{children:[t&&(0,_.jsx)("img",{"aria-hidden":"true",className:i1("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:t}),(0,_.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"})]})}function fT({backdropClassName:e,className:t,fallbackSrc:r,imageClassName:n,photo:a}){let o=a?.src??r;function i(e){r&&(e.currentTarget.src=r)}return(0,_.jsxs)(_.Fragment,{children:[o&&(0,_.jsx)("img",{"aria-hidden":"true",className:i1("absolute inset-0 size-full scale-125 object-cover blur-3xl",t,e),src:o,onError:i}),(0,_.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"}),o&&(0,_.jsx)("img",{alt:a?.name??"",className:i1("absolute inset-0 size-full object-contain",t,n),src:o,onError:i})]})}function fR({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return(0,_.jsxs)(_.Fragment,{children:[n&&(0,_.jsx)("img",{"aria-hidden":"true",className:i1("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:n,onError:e=>{t&&(e.currentTarget.src=t)}}),(0,_.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/20"})]})}function fj({className:e,...t}){let r=(0,A.useId)().replace(/:/g,""),n=`${r}-loading-texture-gradient`,a=`${r}-loading-texture-pattern`,o=`${r}-loading-texture-mask`;return(0,_.jsxs)("svg",{className:i1("text-constant-white",e),fill:"none",focusable:"false",viewBox:"0 0 776 992",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,_.jsxs)("defs",{children:[(0,_.jsxs)("radialGradient",{id:n,cx:"0",cy:"0",gradientTransform:"translate(388 496) rotate(90) scale(1021)",gradientUnits:"userSpaceOnUse",r:"1",children:[(0,_.jsx)("stop",{stopColor:"currentColor",stopOpacity:"0.7"}),(0,_.jsx)("stop",{offset:"0.586538",stopColor:"currentColor",stopOpacity:"0"})]}),(0,_.jsx)("pattern",{id:a,width:"24",height:"24",patternUnits:"userSpaceOnUse",children:(0,_.jsx)("circle",{cx:"4",cy:"4",r:"4",fill:"currentColor"})}),(0,_.jsx)("mask",{id:o,children:(0,_.jsx)("rect",{width:"776",height:"992",fill:`url(#${a})`})})]}),(0,_.jsx)("rect",{width:"776",height:"992",fill:`url(#${n})`,mask:`url(#${o})`})]})}function fO({animated:e=!1,className:t,...r}){return(0,_.jsxs)("div",{"aria-hidden":"true",className:i1("absolute h-133 w-104 max-w-none",t),...r,children:[!e&&(0,_.jsx)(fj,{className:"absolute inset-0 size-full opacity-30"}),e&&(0,_.jsx)("span",{className:"absolute inset-0 [mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [mask-position:center] [mask-repeat:no-repeat] [mask-size:18%_18%] [-webkit-mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [-webkit-mask-position:center] [-webkit-mask-repeat:no-repeat] [-webkit-mask-size:18%_18%] animate-[ai-try-on-loading-texture-pulse_2.6s_linear_infinite] motion-reduce:animate-none motion-reduce:[mask-size:220%_220%] motion-reduce:[-webkit-mask-size:220%_220%]",children:(0,_.jsx)(fj,{className:"absolute inset-0 size-full opacity-70"})})]})}function fN({badge:e,className:t,fallbackSrc:r,photo:n,selected:a,...o}){return(0,_.jsxs)("button",{className:i1("group relative aspect-square w-full overflow-hidden rounded-xl bg-background-base-2 text-left ring-offset-2 transition","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground",a?"ring-2 ring-foreground":null,t),type:"button",...o,children:[n?.src?(0,_.jsx)("img",{alt:n.name??"",className:"size-full object-cover",src:n.src}):r?(0,_.jsx)("img",{alt:"",className:"size-full object-cover",src:r}):null,a&&(0,_.jsx)("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-foreground text-background-containers",children:(0,_.jsx)(fS,{className:"size-4"})}),e&&(0,_.jsx)("span",{className:"absolute right-2 top-2",children:e})]})}function fz({className:e,label:t,progress:r=0,...n}){let a=Math.min(Math.max(r,0),100);return(0,_.jsxs)("div",{className:i1("rounded-xl bg-background-base px-6 py-8",e),...n,children:[(0,_.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm font-medium text-text-sub",children:[(0,_.jsx)("span",{children:t}),(0,_.jsxs)("span",{children:[Math.round(a),"%"]})]}),(0,_.jsx)(fk,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function f_({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return n?(0,_.jsx)("img",{alt:r?.name??"",className:i1("absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover",e),src:n,onError:e=>{t&&(e.currentTarget.src=t)}}):null}function fA({className:e,imageSrc:t,name:r}){return t?(0,_.jsx)("img",{alt:r??"",className:i1("absolute bottom-2 left-2 h-30 w-auto rounded-xl border border-background-containers bg-background-containers object-contain shadow-md",e),src:t}):null}function fL({good:e,imageSrc:t,label:r}){return(0,_.jsxs)("figure",{className:"flex min-w-0 flex-col items-start gap-2",children:[(0,_.jsxs)("div",{className:"relative aspect-square w-full overflow-hidden rounded-xl border border-border-light bg-background-base",children:[(0,_.jsx)("img",{alt:r,className:"size-full object-cover",src:t}),(0,_.jsx)("span",{className:i1("absolute right-2 top-2 flex size-7 items-center justify-center rounded-full",e?"bg-background-green":"bg-background-red"),children:e?(0,_.jsx)(fS,{className:"size-5 text-background-containers"}):(0,_.jsx)(ft,{className:"size-5 text-background-containers"})})]}),(0,_.jsx)("figcaption",{className:"w-[90%] break-words text-xs font-medium leading-[1.6] tracking-[0.02em] text-text-base",children:r})]})}function fI({className:e,onOpenComparison:t,productLabel:r,productUrl:n,result:a,zoomLabel:o}){let i="inline-flex h-8 min-w-0 max-w-52 flex-1 items-center justify-center gap-1.5 rounded-xl bg-button-light px-3 text-xs font-semibold text-text-dark";return(0,_.jsxs)(fP,{"aria-label":o,className:i1("block cursor-pointer text-left",e),role:"button",tabIndex:0,onClick:t,onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},children:[(0,_.jsx)(fT,{photo:a?.after}),(0,_.jsxs)("div",{className:"absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2",children:[n?(0,_.jsxs)("a",{className:i,href:n,onClick:e=>e.stopPropagation(),children:[(0,_.jsx)(fa,{"aria-hidden":"true",className:"size-4"}),(0,_.jsx)("span",{className:"truncate",children:r})]}):(0,_.jsxs)("span",{className:i,children:[(0,_.jsx)(fa,{"aria-hidden":"true",className:"size-4"}),(0,_.jsx)("span",{className:"truncate",children:r})]}),(0,_.jsx)("button",{"aria-label":o,className:"inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-button-light text-text-dark",type:"button",onClick:e=>{e.stopPropagation(),t()},children:(0,_.jsx)(fC,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fM({addToCartError:e,addToCartPending:t=!1,onAddToCart:r,onClose:n,onDeleteResult:a,onSaveResult:o,onShareResult:i,portalContainer:s,productName:l,productPrice:u,productUrl:c,result:d}){var p;let{t:h}=rE(),f=l??h("resultProductLink"),g=(p=u,p?.trim()||void 0),m=g?h("resultTryAnotherWithPrice",{price:g}):h("resultTryAnother");return(0,_.jsx)(st,{open:!0,onOpenChange:e=>!e&&n(),children:(0,_.jsxs)(sa,{className:"dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none bg-[#212124E5] p-0 text-text-dark duration-200 sm:max-w-none sm:p-0",portalContainer:s,showCloseButton:!1,children:[(0,_.jsxs)(so,{className:"sr-only",children:[(0,_.jsx)(si,{children:h("comparisonTitle")}),(0,_.jsx)(ss,{children:h("comparisonSlider")})]}),(0,_.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[c?(0,_.jsx)(i9,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,_.jsxs)("a",{href:c,children:[(0,_.jsx)(fa,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:f})]})}):(0,_.jsxs)(i9,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,_.jsx)(fa,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:f})]}),(0,_.jsx)(i9,{"aria-label":h("close"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,_.jsx)(ft,{className:"!size-3","data-icon":"inline-start"})})]}),(0,_.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center px-8",children:(0,_.jsxs)(h6,{"aria-label":h("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,_.jsx)(h8,{position:"right",children:(0,_.jsx)(f_,{className:"w-full object-contain",photo:d?.after})}),(0,_.jsx)(h8,{position:"left",children:(0,_.jsx)(f_,{className:"w-full object-contain",photo:d?.before})}),(0,_.jsxs)(h7,{className:"w-11",children:[(0,_.jsx)("div",{className:"absolute left-1/2 h-full w-0.5 -translate-x-1/2 bg-constant-white"}),(0,_.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-constant-white text-constant-black shadow-lg",children:(0,_.jsx)("span",{className:"h-5 w-0.5 rounded-full bg-current"})})]})]})}),(0,_.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1 px-8 pb-6 pt-3",children:[e&&(0,_.jsx)("p",{className:"text-xs text-text-sub",role:"alert",children:e}),(0,_.jsxs)("div",{className:"flex h-23 w-full max-w-104 items-start gap-2",children:[r&&(0,_.jsxs)(i9,{className:"min-w-0 flex-1",disabled:t,size:"lg",type:"button",variant:"contrast",onClick:r,children:[(0,_.jsx)(fe,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:m})]}),(0,_.jsx)(i9,{"aria-label":h("share"),size:"icon-lg",type:"button",variant:"outline",onClick:i,children:(0,_.jsx)(fo,{"data-icon":"inline-start"})}),(0,_.jsx)(i9,{"aria-label":h("download"),size:"icon-lg",type:"button",variant:"outline",onClick:o,children:(0,_.jsx)(fr,{"data-icon":"inline-start"})}),(0,_.jsx)(i9,{"aria-label":h("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){a()},children:(0,_.jsx)(fn,{"data-icon":"inline-start"})})]})]})]})})}fm.displayName=fg;let fF=i3("inline-flex w-fit items-center justify-center overflow-hidden rounded-full whitespace-nowrap",{variants:{variant:{default:"bg-contrast text-contrast-foreground",secondary:"bg-[var(--color-background-gray-transparent)] text-text-base",positive:"bg-[var(--color-background-green-transparent)] text-text-green",negative:"bg-[var(--color-background-red-transparent)] text-text-red",standard:"bg-[var(--color-background-blue-transparent)] text-text-blue"},size:{sm:"h-6 px-2 typo-button-small",md:"h-[30px] px-3 typo-button-normal"}},defaultVariants:{variant:"default",size:"sm"}});function fD({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,_.jsx)(n?oJ:"span",{"data-slot":"badge",className:i1(fF({variant:t,size:r,className:e})),...a})}function fB({className:e,...t}){return(0,_.jsx)("div",{className:i1("flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl",e),...t})}function f$({badge:e,badgeTone:t="gray",className:r,closeLabel:n,leftSlot:a,middleSlot:o,onClose:i,preferMiddleSlotFirst:s=!1,showCloseButton:l=!1,...u}){let c=e?(0,_.jsx)(fV,{tone:t,children:e}):null;return(0,_.jsxs)("div",{className:i1("flex h-17 items-center justify-between p-4",r),...u,children:[(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[a,s?o:c,s?c:o]}),l&&(0,_.jsx)(i9,{"aria-label":n,size:"icon",type:"button",variant:"outline",onClick:i,children:(0,_.jsx)(ft,{"data-icon":"inline-start"})})]})}function fV({className:e,tone:t="gray",...r}){return(0,_.jsx)(fD,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fU({className:e,...t}){return(0,_.jsx)("div",{className:i1("flex min-h-0 flex-1 flex-col animate-in fade-in-0 duration-100 motion-reduce:animate-none",e),...t})}function fH(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,_.jsx)("path",{d:"M21.1667 8.4C21.1667 8.16131 21.07 7.93245 20.8981 7.76367C20.7262 7.59489 20.4931 7.5 20.25 7.5H16.5833C16.2768 7.5 15.9906 7.3496 15.8206 7.09922L14.2594 4.8H9.74056L8.17936 7.09922C8.00935 7.3496 7.72316 7.5 7.41667 7.5H3.75C3.50688 7.5 3.2738 7.59489 3.10189 7.76367C2.92998 7.93245 2.83333 8.16131 2.83333 8.4V18.3C2.83333 18.5387 2.92998 18.7675 3.10189 18.9363C3.2738 19.1051 3.50689 19.2 3.75 19.2H20.25C20.4931 19.2 20.7262 19.1051 20.8981 18.9363C21.07 18.7675 21.1667 18.5387 21.1667 18.3V8.4ZM14.75 12.9C14.75 12.184 14.46 11.4973 13.9443 10.991C13.4287 10.4847 12.7292 10.2001 12 10.2C11.2707 10.2 10.5705 10.4847 10.0548 10.991C9.53923 11.4973 9.25 12.1841 9.25 12.9C9.25 13.6159 9.53923 14.3027 10.0548 14.809C10.5705 15.3153 11.2707 15.6 12 15.6C12.7292 15.5999 13.4287 15.3153 13.9443 14.809C14.46 14.3027 14.75 13.616 14.75 12.9ZM16.5833 12.9C16.5833 14.0934 16.1 15.2377 15.2406 16.0816C14.3811 16.9255 13.2155 17.3999 12 17.4C10.7844 17.4 9.61809 16.9256 8.75854 16.0816C7.89919 15.2378 7.41667 14.0933 7.41667 12.9C7.41667 11.7067 7.89919 10.5622 8.75854 9.71836C9.61809 8.87445 10.7844 8.4 12 8.4C13.2155 8.40008 14.3811 8.87452 15.2406 9.71836C16.1 10.5623 16.5833 11.7066 16.5833 12.9ZM23 18.3C23 19.0161 22.7101 19.7026 22.1943 20.209C21.6786 20.7153 20.9793 21 20.25 21H3.75C3.02065 21 2.32139 20.7153 1.80566 20.209C1.28994 19.7026 1 19.0161 1 18.3V8.4C1 7.68392 1.28994 6.99736 1.80566 6.49102C2.32139 5.98467 3.02065 5.7 3.75 5.7H6.92611L8.4873 3.40078L8.55623 3.31201C8.72911 3.11535 8.98172 3 9.25 3H14.75L14.8637 3.00703C15.1262 3.03922 15.3639 3.18167 15.5127 3.40078L17.0739 5.7H20.25C20.9793 5.7 21.6786 5.98467 22.1943 6.49102C22.7101 6.99736 23 7.68392 23 8.4V18.3Z",fill:"currentColor"})})}function fW(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 5.00342 8.37303",fill:"none",...e,children:(0,_.jsx)("path",{d:"M1 1L4.00342 4.18652L1 7.37303",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fq(e){return(0,_.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,_.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function fK(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,_.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 3C18.7956 3 19.5585 3.3163 20.1211 3.87891C20.6837 4.44152 21 5.20435 21 6V18C21 18.7956 20.6837 19.5585 20.1211 20.1211C19.5585 20.6837 18.7956 21 18 21H6C5.20435 21 4.44152 20.6837 3.87891 20.1211C3.3163 19.5585 3 18.7956 3 18V6C3 5.20435 3.3163 4.44152 3.87891 3.87891C4.44152 3.3163 5.20435 3 6 3H18ZM14.0352 12C13.8633 12 13.6974 12.0639 13.5703 12.1797L6 19H18C18.2876 18.977 18.5547 18.8414 18.7422 18.6221C18.9296 18.4028 19.0221 18.1177 19 17.8301V16.6602L14.5 12.1797C14.3729 12.0639 14.2071 12 14.0352 12ZM8 7C7.60218 7 7.22076 7.15815 6.93945 7.43945C6.65815 7.72076 6.5 8.10218 6.5 8.5C6.5 8.89782 6.65815 9.27924 6.93945 9.56055C7.22076 9.84185 7.60218 10 8 10C8.39782 10 8.77924 9.84185 9.06055 9.56055C9.34185 9.27924 9.5 8.89782 9.5 8.5C9.5 8.10218 9.34185 7.72076 9.06055 7.43945C8.77924 7.15815 8.39782 7 8 7Z",fill:"currentColor"})})}function fG(e){return(0,_.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,_.jsx)("path",{d:"M6.05944 11.1406C6.47507 8.23438 8.97819 6 12.0001 6C13.6563 6 15.1563 6.67187 16.2438 7.75625L16.2626 7.775L16.5001 8H15.0032C14.4501 8 14.0032 8.44687 14.0032 9C14.0032 9.55313 14.4501 10 15.0032 10H19.0032C19.5563 10 20.0032 9.55313 20.0032 9V5C20.0032 4.44688 19.5563 4 19.0032 4C18.4501 4 18.0032 4.44688 18.0032 5V6.66875L17.6501 6.33437C16.2032 4.89375 14.2032 4 12.0001 4C7.96882 4 4.63444 6.98125 4.08132 10.8594C4.00319 11.4062 4.38132 11.9125 4.92819 11.9906C5.47507 12.0688 5.98132 11.6875 6.05944 11.1438V11.1406ZM19.9188 13.1406C19.9969 12.5938 19.6157 12.0875 19.0719 12.0094C18.5282 11.9312 18.0188 12.3125 17.9407 12.8562C17.5251 15.7625 15.0219 17.9969 12.0001 17.9969C10.3438 17.9969 8.84382 17.325 7.75632 16.2406L7.73757 16.2219L7.50007 15.9969H8.99694C9.55007 15.9969 9.99694 15.55 9.99694 14.9969C9.99694 14.4437 9.55007 13.9969 8.99694 13.9969L5.00007 14C4.73444 14 4.47819 14.1063 4.29069 14.2969C4.10319 14.4875 3.99694 14.7406 4.00007 15.0094L4.03132 18.9781C4.03444 19.5312 4.48757 19.975 5.04069 19.9688C5.59382 19.9625 6.03757 19.5125 6.03132 18.9594L6.01882 17.35L6.35319 17.6656C7.80007 19.1062 9.79694 20 12.0001 20C16.0313 20 19.3657 17.0187 19.9188 13.1406Z",fill:"currentColor"})})}function fX({className:e,...t}){return(0,_.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:i1("size-6",e),...t,children:[(0,_.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,_.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}let fY={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},fQ={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},fZ={bag:{cards:[{good:!0,imageSrc:ol,labelKey:"bagIntroGoodFullBody"},{good:!0,imageSrc:os,labelKey:"bagIntroGoodAngle"},{good:!1,imageSrc:oi,labelKey:"bagIntroBadHandsFull"},{good:!1,imageSrc:oo,labelKey:"bagIntroBadCropped"}],subtitleKey:"bagIntroSubtitle",titleKey:"bagIntroTitle"},eyewear:{cards:[{good:!0,imageSrc:od,labelKey:"eyewearIntroGoodFacingCamera"},{good:!0,imageSrc:op,labelKey:"eyewearIntroGoodHairBack"},{good:!1,imageSrc:oc,labelKey:"eyewearIntroBadWearingGlasses"},{good:!1,imageSrc:ou,labelKey:"eyewearIntroBadFaceTurned"}],subtitleKey:"eyewearIntroSubtitle",titleKey:"eyewearIntroTitle"},footwear:{cards:[{good:!0,imageSrc:om,labelKey:"footwearIntroGoodStanding"},{good:!0,imageSrc:og,labelKey:"footwearIntroGoodKneesDown"},{good:!1,imageSrc:of,labelKey:"footwearIntroBadOneFootCropped"},{good:!1,imageSrc:oh,labelKey:"footwearIntroBadFeetHidden"}],subtitleKey:"footwearIntroSubtitle",titleKey:"footwearIntroTitle"},"full-body":{cards:[{good:!0,imageSrc:ow,labelKey:"fullBodyIntroGoodHeadToToe"},{good:!0,imageSrc:ob,labelKey:"fullBodyIntroGoodAngle"},{good:!1,imageSrc:ov,labelKey:"fullBodyIntroBadCropped"},{good:!1,imageSrc:oy,labelKey:"fullBodyIntroBadSitting"}],subtitleKey:"fullBodyIntroSubtitle",titleKey:"fullBodyIntroTitle"},headwear:{cards:[{good:!0,imageSrc:oC,labelKey:"headwearIntroGoodFront"},{good:!0,imageSrc:oS,labelKey:"headwearIntroGoodAngle"},{good:!1,imageSrc:ok,labelKey:"headwearIntroBadWearingHat"},{good:!1,imageSrc:ox,labelKey:"headwearIntroBadCroppedHead"}],subtitleKey:"headwearIntroSubtitle",titleKey:"headwearIntroTitle"},"lower-body":{cards:[{good:!0,imageSrc:oR,labelKey:"lowerBodyIntroGoodWaistToFeet"},{good:!0,imageSrc:oT,labelKey:"lowerBodyIntroGoodFullBody"},{good:!1,imageSrc:oE,labelKey:"lowerBodyIntroBadSitting"},{good:!1,imageSrc:oP,labelKey:"lowerBodyIntroBadCoveredWaist"}],subtitleKey:"lowerBodyIntroSubtitle",titleKey:"lowerBodyIntroTitle"},neck:{cards:[{good:!0,imageSrc:oN,labelKey:"neckIntroGoodHairUp"},{good:!0,imageSrc:oz,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:oO,labelKey:"neckIntroBadHighCollar"}],subtitleKey:"neckIntroSubtitle",titleKey:"neckIntroTitle"},"upper-body":{cards:[{good:!0,imageSrc:oI,labelKey:"upperBodyIntroGoodFacingCamera"},{good:!0,imageSrc:oL,labelKey:"upperBodyIntroGoodAngle"},{good:!1,imageSrc:o_,labelKey:"upperBodyIntroBadArmsCrossed"},{good:!1,imageSrc:oA,labelKey:"upperBodyIntroBadObjectBlockingTorso"}],subtitleKey:"upperBodyIntroSubtitle",titleKey:"upperBodyIntroTitle"},waist:{cards:[{good:!0,imageSrc:oD,labelKey:"waistIntroGoodFullBody"},{good:!0,imageSrc:oB,labelKey:"waistIntroGoodTopTucked"},{good:!1,imageSrc:oM,labelKey:"waistIntroBadOversizedTop"},{good:!1,imageSrc:oF,labelKey:"waistIntroBadSitting"}],subtitleKey:"waistIntroSubtitle",titleKey:"waistIntroTitle"},wrist:{cards:[{good:!0,imageSrc:oU,labelKey:"wristIntroGoodCloseUp"},{good:!0,imageSrc:oH,labelKey:"wristIntroGoodSleeveBack"},{good:!1,imageSrc:o$,labelKey:"wristIntroBadClenchedFist"},{good:!1,imageSrc:oV,labelKey:"wristIntroBadCovered"}],subtitleKey:"wristIntroSubtitle",titleKey:"wristIntroTitle"}};function fJ({view:e}){let{t}=rE(),r=e.productType?fZ[e.productType]:null;return(0,_.jsxs)(gt,{title:t("startTitle"),subtitle:t(r?.titleKey??"externalPhotoHint"),children:[(0,_.jsxs)(fP,{className:"mt-3",children:[(0,_.jsx)(fE,{src:e.productImageSrc}),(0,_.jsx)(f_,{fallbackSrc:e.productImageSrc})]}),(0,_.jsxs)(gr,{className:"mt-4",children:[(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,_.jsx)(fH,{"data-icon":"inline-start"}),t("startUpload")]}),(0,_.jsxs)(i9,{className:"w-full",disabled:!e.canOpenHistory,size:"lg",type:"button",variant:"outline",onClick:e.openHistory,children:[(0,_.jsx)(fK,{"data-icon":"inline-start"}),t("startHistory")]}),(0,_.jsx)(gn,{})]})]})}function f0({view:e}){let{t}=rE(),r=e.productType?fZ[e.productType]:null;return r?(0,_.jsxs)(gt,{title:t(r.titleKey),subtitle:t(r.subtitleKey),children:[(0,_.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:gap-4",children:r.cards.map(e=>(0,_.jsx)(fL,{good:e.good,imageSrc:e.imageSrc,label:t(e.labelKey)},e.labelKey))}),(0,_.jsx)("div",{className:"mt-4",children:(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.continueIntro,children:t("introCta")})})]}):null}function f1({view:e}){let{t}=rE();return(0,_.jsxs)(gt,{title:t("historyTitle"),subtitle:t("historySubtitle"),children:[(0,_.jsx)("div",{className:"mt-3 grid min-h-104 flex-1 grid-cols-3 content-start gap-x-3 gap-y-4 overflow-x-hidden overflow-y-auto overscroll-contain pb-2 sm:gap-4",children:e.history.map(r=>(0,_.jsx)(fN,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,_.jsxs)(gr,{className:"mt-4",children:[(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,_.jsx)(fq,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,_.jsx)(gn,{})]})]})}function f2({view:e}){let{t}=rE();return(0,_.jsxs)(gt,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,_.jsxs)(fP,{className:"mt-3",children:[(0,_.jsx)(fT,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,_.jsx)(fA,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,_.jsxs)(gr,{className:"mt-4",children:[(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,_.jsx)(fX,{"data-icon":"inline-start"}),t("confirmGenerate")]}),(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,_.jsx)(fG,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,_.jsx)(gn,{})]})]})}function f3(){let{t:e}=rE();return(0,_.jsx)(gt,{title:e("activationLoading"),subtitle:e("activationLoadingSubtitle"),children:(0,_.jsx)(fP,{className:"mt-3",children:(0,_.jsx)(fO,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"})})})}function f5({onClose:e,temporary:t}){let{t:r}=rE();return(0,_.jsx)(gt,{title:r("activationUnavailableTitle"),subtitle:r(t?"activationTemporarilyUnavailable":"externalProductUnavailable"),children:(0,_.jsxs)(gr,{className:"mt-4",children:[e&&(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e,children:r("close")}),(0,_.jsx)(gn,{className:"text-text-sub"})]})})}function f9({onClose:e,onRetry:t}){let{t:r}=rE();return(0,_.jsx)(gt,{title:r("errorTitle"),subtitle:r("externalServiceUnavailable"),children:(0,_.jsxs)(gr,{className:"mt-4",children:[t&&(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:t,children:[(0,_.jsx)(fX,{"data-icon":"inline-start"}),r("errorRetry")]}),e&&(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e,children:r("close")}),(0,_.jsx)(gn,{className:"text-text-sub"})]})})}function f4({view:e}){let{t}=rE();return(0,_.jsxs)(gt,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,_.jsxs)(fP,{className:"mt-3",children:[(0,_.jsx)(fR,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,_.jsx)(fO,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,_.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white shadow-md sm:size-37.5",children:(0,_.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,_.jsx)("img",{alt:"",className:"size-full object-cover",src:e.photo.src}):null})]})]}),(0,_.jsx)(fz,{className:"mt-4",label:t("processingProgress"),progress:e.processingProgress})]})}function f6({view:e,onClose:t}){let{t:r}=rE(),n="upload-validation"===e.error.kind&&"file-too-large"===e.error.code,a="generation"===e.error.kind?e.error.code:void 0;return(0,_.jsxs)(gt,{title:r(n?"errorFileTooLarge":"errorTitle"),subtitle:n?void 0:r((a?({tokens:"externalNoTokens",product:"externalProductUnavailable",service:"externalServiceUnavailable",timeout:"externalTimeout","photo-required":"externalPhotoRequired"})[a]:void 0)??"errorSubtitle"),children:[!n&&!a&&(0,_.jsxs)(fP,{className:"mt-3",children:[(0,_.jsx)(fR,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,_.jsx)(fO,{className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,_.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-6 px-6 sm:px-12",children:[(0,_.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white bg-background-containers shadow-md sm:size-37.5",children:(0,_.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,_.jsx)("img",{alt:e.photo.name??"",className:"size-full object-cover",src:e.photo.src,onError:t=>{t.currentTarget.src=e.productImageSrc}}):null})]}),(0,_.jsx)("p",{className:"w-56 text-center text-xs font-medium tracking-wider text-constant-white",children:r("errorGuidance")})]})]}),(0,_.jsxs)(gr,{className:"mt-4",children:[(!a||"service"===a||"timeout"===a)&&(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,_.jsx)(fX,{"data-icon":"inline-start"}),r("errorRetry")]}),(!a||"photo-required"===a)&&(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,_.jsx)(fG,{"data-icon":"inline-start"}),r("errorDifferentPhoto")]}),a&&t&&(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:t,children:r("close")}),(0,_.jsx)(gn,{className:"text-text-sub"})]})]})}function f8({view:e,showAddToCart:t=!0,onAddToCart:r,addToCartPending:n=!1,addToCartError:a}){let{t:o}=rE(),i=r??e.addToCart,s=ga(e.productPrice),l=s?o("resultTryAnotherWithPrice",{price:s}):o("resultTryAnother");return e.myFitsOpen?(0,_.jsx)("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain pb-4",children:(0,_.jsx)("div",{className:"flex flex-col gap-4 px-6 pb-2 pt-4 sm:px-8",children:e.resultHistory.map((r,a)=>(0,_.jsx)(f7,{compact:a>0,onAddToCart:t?i:void 0,addToCartPending:n,productName:r.productName??e.productName,productPrice:r.productPrice,productUrl:r.productUrl??e.productUrl,result:r,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},r.id??r.after.id))})}):(0,_.jsxs)(gt,{className:"pb-6",subtitle:void 0,title:o("resultTitle"),children:[(0,_.jsx)(fI,{className:"mt-6",productLabel:e.productName??o("resultProductLink"),productUrl:e.productUrl,zoomLabel:o("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,_.jsxs)(gr,{className:"mt-4",children:[t&&(0,_.jsxs)(i9,{className:"w-full",disabled:n,size:"lg",type:"button",variant:"contrast",onClick:i,children:[(0,_.jsx)(fe,{"data-icon":"inline-start"}),l]}),a&&(0,_.jsx)("p",{className:"text-center text-xs text-text-sub",role:"alert",children:a}),(0,_.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,_.jsxs)(i9,{type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,_.jsx)(fG,{"data-icon":"inline-start"}),o("resultCompare")]}),(0,_.jsxs)(i9,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,_.jsx)(fo,{"data-icon":"inline-start"}),o("resultShare")]}),(0,_.jsxs)(i9,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,_.jsx)(fr,{"data-icon":"inline-start"}),o("resultReset")]})]})]})]})}function f7({compact:e=!1,onAddToCart:t,addToCartPending:r=!1,onDeleteResult:n,onOpenComparison:a,onSaveResult:o,onShareResult:i,productName:s,productPrice:l,productUrl:u,result:c}){let{t:d}=rE(),p=s??d("resultProductLink"),h=ga(l),f=h?d("resultTryAnotherWithPrice",{price:h}):d("resultTryAnother");return(0,_.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,_.jsx)(fI,{productLabel:p,productUrl:u,zoomLabel:d("resultOpenComparison"),result:c,onOpenComparison:()=>a(c.id)}),(0,_.jsxs)("div",{className:"flex gap-2",children:[t&&(0,_.jsxs)(i9,{className:"min-w-0 flex-1",disabled:r,size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,_.jsx)(fe,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:f})]}),(0,_.jsx)(i9,{"aria-label":d("share"),size:"icon",type:"button",variant:"outline",onClick:()=>i(c.id),children:(0,_.jsx)(fo,{"data-icon":"inline-start"})}),(0,_.jsx)(i9,{"aria-label":d("download"),size:"icon",type:"button",variant:"outline",onClick:()=>o(c.id),children:(0,_.jsx)(fr,{"data-icon":"inline-start"})}),!e&&(0,_.jsx)(i9,{"aria-label":d("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>n(c.id),children:(0,_.jsx)(fn,{"data-icon":"inline-start"})})]})]})}function ge({label:e,onClick:t}){return(0,_.jsx)(i9,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,_.jsx)(fW,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function gt({children:e,className:t,subtitle:r,title:n}){return(0,_.jsxs)("div",{className:i1("flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto overscroll-contain px-6 pb-5 sm:px-8",t),children:[(0,_.jsxs)("div",{className:"mb-1 flex flex-col gap-1",children:[(0,_.jsx)("h2",{className:"text-2xl font-medium tracking-tight text-text-dark",children:n}),r&&(0,_.jsx)("p",{className:"text-sm font-medium text-text-base",children:r})]}),e]})}function gr({children:e,className:t}){return(0,_.jsx)("div",{className:i1("flex flex-col gap-2",t),children:e})}function gn({className:e}){var t;let{i18n:r,t:n}=rE(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?fQ:fY);return(0,_.jsxs)("p",{className:i1("pt-1 text-center text-xs font-medium text-text-base",e),children:[n("termsPrefix")," ",(0,_.jsx)("a",{className:"underline underline-offset-2",href:a.terms,rel:"noopener noreferrer",target:"_blank",children:n("termsLink")})," ",n("termsJoiner")," ",(0,_.jsx)("a",{className:"underline underline-offset-2",href:a.privacy,rel:"noopener noreferrer",target:"_blank",children:n("privacyLink")})]})}function ga(e){return e?.trim()||void 0}let go=new Set(["avif","avis","heic","heix","heim","heis","hevc","hevx","mif1","msf1"]);async function gi(e){var t,r;let n,a,o=(t=e)instanceof Blob?t:t instanceof ArrayBuffer?new Blob([t]):ArrayBuffer.isView(t)?new Blob([new Uint8Array(t.buffer,t.byteOffset,t.byteLength)]):null;return!o||o.size<=0?{blob:null,errorText:null}:(r=new Uint8Array(await o.slice(0,16).arrayBuffer()),n=(...e)=>e.every((e,t)=>r[t]===e),a=(e,...t)=>t.every((t,n)=>r[e+n]===t),n(255,216,255)||n(137,80,78,71,13,10,26,10)||n(71,73,70,56)||n(66,77)||n(82,73,70,70)&&a(8,87,69,66,80)||a(4,102,116,121,112)&&go.has(function(e){let t="";for(let r=8;r<12;r++)t+=String.fromCharCode(e[r]??0);return t}(r)))?{blob:o,errorText:null}:{blob:null,errorText:(await o.text().catch(()=>"")).slice(0,2e3)}}function gs(e){return"string"==typeof e?e.trim():""}function gl(e){if(e)return e;if("function"==typeof fetch)return fetch;throw Error("Fetch API is not available for AI try-on image upload")}async function gu(e,t,r={}){let{fetch:n,signal:a,timeoutMs:o}=r,i=new AbortController,s=()=>i.abort(a?.reason),l=void 0===o?void 0:setTimeout(()=>i.abort(new DOMException("AI try-on image upload timed out","TimeoutError")),o);a?.aborted?s():a?.addEventListener("abort",s,{once:!0});try{let r=await gl(n)(e,{body:t,method:"PUT",signal:i.signal});if(!r.ok){let e=await r.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${r.status}${e?`: ${e}`:""}`)}}finally{clearTimeout(l),a?.removeEventListener("abort",s)}}async function gc(e,t){let r=e?.trim();return r?gp(r,t,"AI try-on product image fetch failed"):null}async function gd(e,t){return e.blob?e.blob:e.file?e.file:e.src?gp(e.src,t,"AI try-on source photo fetch failed"):null}async function gp(e,t,r){let n=await gl(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}let gh="ai-try-on-result";async function gf(e,t={}){let r=await gm(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gy,o=t.revokeObjectUrl??gb,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gv(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gg(e,t={}){let r=await gm(e,t.fetch),n=t.navigator??globalThis.navigator;if(!r)return!1;if("function"==typeof File&&"function"==typeof n?.share){let a={files:[new File([r],gv(r,e,t.filename),{type:r.type||e?.type||"image/png"})]};if("function"!=typeof n.canShare||n.canShare(a))try{return await n.share(a),!0}catch(e){if("u">typeof DOMException&&e instanceof DOMException&&"AbortError"===e.name)return!1}}return gf(e,t)}async function gm(e,t=globalThis.fetch){if(!e)return null;if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof t)return null;try{let r=await t(e.src);if(!r.ok)return null;return r.blob()}catch{return null}}function gv(e,t,r=gh){var n;let a=function(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}(e.type||t?.type)??(n=t?.name,n?.match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??null)??"png",o=r.replace(/\.[a-z0-9]+$/i,"").replace(/[^\w-]+/g,"-").replace(/^-+|-+$/g,"")||gh;return`${o}.${a}`}function gy(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gb(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gw="results";function gx(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gk(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gw)||e.createObjectStore(gw,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gS(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gC(e){return{after:await gP(e.after),before:await gP(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}}async function gP(e){let t=await gE(e);if(!t)throw Error("AI try-on photo cannot be persisted without image data");return{blob:t,id:e.id,lastModified:e.file?.lastModified??e.lastModified,name:e.name,size:t.size,type:t.type||e.type}}async function gE(e){if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof fetch)return null;try{let t=await fetch(e.src);return t.ok?t.blob():null}catch{return null}}function gT(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gR(e,t=gj()){if(t)try{t.setItem(gT(e),"true")}catch{}}function gj(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gO={delete:async function e(e){let t=gx();if(!t)return!1;try{let r=await gk(t),n=r.transaction(gw,"readwrite"),a=gS(n);return n.objectStore(gw).delete(e),await a,r.close(),!0}catch(e){throw Error("AI try-on result could not be removed from history",{cause:e})}},list:async function e(){let e=gx();if(!e)return[];try{var t;let r=await gk(e),n=r.transaction(gw,"readonly"),a=gS(n),o=await (t=n.objectStore(gw).getAll(),new Promise((e,r)=>{t.onerror=()=>r(t.error),t.onsuccess=()=>e(t.result)}));return await a,r.close(),o.sort((e,t)=>t.createdAt-e.createdAt)}catch(e){throw Error("AI try-on history could not be loaded",{cause:e})}},save:async function e(e){let t=gx();if(!t)return!1;try{let r=await gC(e),n=await gk(t),a=n.transaction(gw,"readwrite"),o=gS(a);return a.objectStore(gw).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},gN={save:gf,share:gg},gz={consumeFirstView:function(e,t=gj()){return!function(e,t=gj()){if(!t)return!1;try{return"true"===t.getItem(gT(e))}catch{return!1}}(e,t)&&(gR(e,t),!0)},markSeen:gR},g_={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gA=["image/jpeg","image/png"];class gL{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productPrice:n,productType:a,productUrl:o,tipStore:i}){this.createObjectUrl=e,this.tipStore=i,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productPrice:gI(n),productType:a,productUrl:o,result:null,selectedPhoto:null,stage:"start"}}get view(){switch(this.state.stage){case"intro":return{productType:this.state.productType,stage:"intro"};case"history":return{history:this.state.history,stage:"history"};case"confirm":return{photo:this.state.selectedPhoto,productImageSrc:this.state.productImageSrc,productName:this.state.productName,stage:"confirm"};case"processing":return this.createProcessingView();case"error":return this.createErrorView();case"result":return{canOpenMyFits:this.state.history.length>0,myFitsOpen:this.state.myFitsOpen,productName:this.state.result?.productName??this.state.productName,productPrice:this.state.result?gI(this.state.result.productPrice):this.state.productPrice,productUrl:this.state.result?.productUrl??this.state.productUrl,result:this.state.result,resultHistory:function(e,t){if(!e)return[];let r=[e,...t.filter(t=>t.id!==e.id)];return r.filter((e,t)=>{let n=e.id??e.after.id;return r.findIndex(e=>(e.id??e.after.id)===n)===t})}(this.state.result,this.state.history),stage:"result"};default:return{canOpenHistory:this.state.history.length>0,productImageSrc:this.state.productImageSrc,productName:this.state.productName,productType:this.state.productType,productUrl:this.state.productUrl,stage:"start"}}}get comparison(){let e=this.getComparisonResult();return{open:this.state.comparisonOpen&&null!==e,productName:e?.productName??this.state.productName,productPrice:e?gI(e.productPrice):this.state.productPrice,productUrl:e?.productUrl??this.state.productUrl,result:e}}get selectedPhoto(){return this.state.selectedPhoto}get history(){return this.state.history}updateProduct({productImageSrc:e,productName:t,productPrice:r,productType:n,productUrl:a}){this.state={...this.state,productImageSrc:e,productName:t,productPrice:gI(r),productType:n,productUrl:a}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gM(e,t),[])}}failHistory(e,t){this.state={...this.state,error:{kind:"hydrate-history"===e?"history-load":"save-result"===e?"history-save":"history-delete",message:t}}}choosePhoto(){return this.state.productType&&this.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.state.productType&&this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(this.state.productType&&this.tipStore.markSeen(this.state.productType),this.goBack(),null):{type:"close-dialog"}}openHistory(){0!==this.state.history.length&&(this.state={...this.state,stage:"history"})}goBack(){switch(this.state.stage){case"intro":case"history":this.state={...this.state,stage:"start"};return;case"confirm":this.state={...this.state,stage:this.state.history.length>0?"history":"start"};return;case"processing":case"error":case"result":this.state={...this.state,stage:"confirm"}}}reset(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"}}selectHistoryResult(e){let t=this.state.history.find(t=>t.id===e);t&&(this.state={...this.state,error:null,myFitsOpen:!1,result:t,selectedPhoto:t.before,stage:"result"})}selectFile(e){var t,r;let n=(t=e,gA.includes(t.type)||""===t.type&&/\.(?:jpe?g|png)$/i.test(t.name)?t.size>0xa00000?"file-too-large":null:"unsupported-file-format");if(n)return this.state={...this.state,error:{code:n,kind:"upload-validation"},myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"error"},null;let a=this.createObjectUrl(e),o={blob:e,file:e,id:(r=e,`${r.name}-${r.size}-${r.lastModified}`),lastModified:e.lastModified,name:e.name,size:e.size,src:a,type:e.type};return this.selectPhoto(o),o}selectPhoto(e){this.state={...this.state,error:null,myFitsOpen:!1,processingProgress:0,selectedPhoto:e,stage:"confirm"}}startGeneration(){return!!this.state.selectedPhoto&&(this.state={...this.state,error:null,generationProduct:this.getProductMetadata(),myFitsOpen:!1,processingProgress:0,result:null,stage:"processing"},!0)}reportGenerationProgress(e){var t;"processing"===this.state.stage&&(this.state={...this.state,processingProgress:Math.max(this.state.processingProgress,Number.isFinite(t=e)?Math.min(Math.max(t,0),100):0)})}completeGeneration(e,t=Date.now()){let r=function(e,t,r=Date.now()){return{...e,...t,productPrice:gI(t.productPrice),createdAt:r,id:`${e.before.id}-result-${r}`}}(e,this.state.generationProduct??this.getProductMetadata(),t);return this.state={...this.state,error:null,generationProduct:null,history:gM(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e,t){this.state={...this.state,error:{kind:"generation",message:e,...t?{code:t}:{}},generationProduct:null,stage:"error"}}toggleMyFits(){"result"===this.state.stage&&0!==this.state.history.length&&(this.state={...this.state,myFitsOpen:!this.state.myFitsOpen})}closeMyFits(){this.state={...this.state,myFitsOpen:!1}}openComparison(e){let t=e?this.findResult(e):this.state.result;t&&(this.state={...this.state,comparisonOpen:!0,comparisonResultId:t.id})}closeComparison(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null}}deleteResult(e){let t=this.findResult(e),r=this.state.history.filter(t=>!gF(t,e)),n=this.state.result?.id??this.state.result?.after.id,a=this.getComparisonResult()?.id===e;if(n!==e)return this.state={...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,history:r},t;let o=r[0]??null;return this.state=o?{...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,error:null,generationProduct:null,history:r,myFitsOpen:r.length>0&&this.state.myFitsOpen,result:o,selectedPhoto:o.before,stage:"result"}:{...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:r,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"},t}resolveResultActionPhoto(e){let t=e?this.findResult(e):this.comparison.open?this.comparison.result:this.state.result;return t?.after??null}findResult(e){return this.state.history.find(t=>gF(t,e))??null}createProcessingView(){let e=this.state.generationProduct??this.getProductMetadata();return{photo:this.state.selectedPhoto,processingProgress:this.state.processingProgress,productImageSrc:e.productImageSrc,productName:e.productName,stage:"processing"}}createErrorView(){let e=this.state.generationProduct??this.getProductMetadata();return{error:this.state.error??{kind:"generation"},photo:this.state.selectedPhoto,productImageSrc:e.productImageSrc,productName:e.productName,stage:"error"}}getProductMetadata(){return{productImageSrc:this.state.productImageSrc,productName:this.state.productName,productPrice:this.state.productPrice,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gI(e){return e?.trim()||void 0}function gM(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gF(e,t){return e.id===t||e.after.id===t}class gD extends Error{code;constructor(e){super(e),this.code=e,this.name="AiTryOnGenerationError"}}function gB(e,t){return{blob:e.blob,id:e.id,lastModified:e.lastModified,name:e.name,size:e.size,src:t(e.blob),type:e.type}}function g$(e,t){t&&(gV(e,t.before),gV(e,t.after))}function gV(e,t){gU(t)?.forEach(t=>e.add(t))}function gU(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gH(e){return function(e=5e3){return new Promise(t=>setTimeout(t,e))}(function(e,t=Date.now()){return Math.max(0,5e3-(t-e))}(e))}let gW={status:"ready"};function gq({dialogPortalContainer:e,language:t,onClose:r,onAddToCart:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,apiKey:d,showDialogCloseButton:p=!1,showAddToCart:h=!0,activation:f=gW,onRetryActivation:g}){a||sY(l);let{i18n:m,t:v}=rE(),y=(0,A.useRef)(null),b=s_(d),w=(0,A.useMemo)(()=>c??sV({apiKey:b}),[c,b]);(0,A.useEffect)(()=>{"string"==typeof t&&m.changeLanguage(t)},[m,t]);let x=function({historyStore:e=gO,objectUrls:t=g_,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,resultActions:d=gN,tipStore:p=gz}){var h;let[,f]=(0,A.useReducer)(e=>e+1,0),g=(0,A.useRef)(new Set),m=(0,A.useRef)(!0);(0,A.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let v=(0,A.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&g.current.add(r),r},[t]),y=(0,A.useRef)(null);y.current||(y.current=new gL({createObjectUrl:v,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tipStore:p}));let b=y.current;b.updateProduct({productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u});let w=(0,A.useMemo)(()=>a||(sY(l),function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sY(n);let i=a??sV({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gd(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gc(r,t);if(!u||u.size<=0)throw Error("AI try-on product image is missing");o?.reportProgress(22),o?.reportProgress(32);let[c,d]=function(e,t){let r=e?.uploads;if(!Array.isArray(r)||r.length<2)throw Error("Nano Banana upload URL response is missing uploads");return r.slice(0,2).map(e=>{if(null===e||"object"!=typeof e)throw Error("Nano Banana upload URL response is missing uploads");let t=gs(e.key),r=gs(e.uploadUrl);if(!t||!r)throw Error("Nano Banana upload URL response is missing key or uploadUrl");return{key:t,uploadUrl:r}})}(await i.requestUploadUrls(2),2);o?.reportProgress(44),await Promise.all([gu(c.uploadUrl,l,{fetch:t}),gu(d.uploadUrl,u,{fetch:t})]),o?.reportProgress(62);let p=function(e){if(!e)return()=>{};e(70);let t=Date.now(),r=globalThis.setInterval(()=>{e(70+24*(1-(1-Math.min((Date.now()-t)/45e3,1))**3))},750);return()=>globalThis.clearInterval(r)}(o?.reportProgress);try{s=await i.generateTryOn({category:n,personImage:c.key,productImages:[d.key]},{timeout:9e4})}finally{p()}o?.reportProgress(96);let{blob:h}=await gi(s);if(!h)throw Error("AI try-on generation did not return an image");o?.reportProgress(98);let f=e(h);if(!f)throw Error("AI try-on result image URL cannot be created");return{before:a,after:{blob:h,id:`${a.id}-nano-banana-result`,name:a.name?`${a.name} result`:"AI try-on result",size:h.size,src:f,type:h.type||"image/jpeg"}}}}({createObjectUrl:v,productImageSrc:o,productType:l,tryOnClient:c})),[v,a,o,l,c]),x=(0,A.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),k=(0,A.useCallback)(()=>f(),[]),S=(0,A.useCallback)(e=>{let t=e()??null;k(),x(t)},[x,k]),C=(0,A.useCallback)(e=>{b.failHistory(e),k()},[b,k]),P=(0,A.useCallback)(t=>{e.save(t).catch(()=>{C("save-result")})},[e,C]),E=(0,A.useCallback)(t=>{e.delete(t).catch(()=>{C("delete-result")})},[e,C]),T=(0,A.useCallback)(()=>{S(()=>b.choosePhoto())},[S,b]),R=(0,A.useCallback)(async()=>{let e=b.selectedPhoto;if(!e||!b.startGeneration())return;k();let r=Date.now();try{var n;let a=await w(e,{reportProgress:e=>{m.current&&(b.reportGenerationProgress(e),k())}});if(await gH(r),!m.current){P(b.completeGeneration(a)),a.after.src.startsWith("blob:")&&t.revokeObjectUrl(a.after.src);return}let o=b.completeGeneration(a);n=g.current,gU(o.before)?.forEach(e=>n.add(e)),gU(o.after)?.forEach(e=>n.add(e)),P(o),k()}catch(e){if(await gH(r),!m.current)return;b.failGeneration(e instanceof Error?e.message:void 0,e instanceof gD?e.code:void 0),k()}},[t,P,w,b,k]),j=(0,A.useCallback)(e=>{let t=b.deleteResult(e);t&&E(t.id),k()},[E,b,k]),O=(0,A.useCallback)(e=>{d.save(b.resolveResultActionPhoto(e))},[d,b]),N=(0,A.useCallback)(e=>{d.share(b.resolveResultActionPhoto(e))},[d,b]),z=(0,A.useCallback)(()=>{c.sendWidgetEvent("add_to_cart_from_widget")},[c]);(0,A.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;b.hydrateHistory(r.map(e=>({after:gB(e.after,v),before:gB(e.before,v),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}))),k()}catch{t||C("hydrate-history")}}(),()=>{t=!0}},[v,e,C,b,k]),(0,A.useEffect)(()=>()=>{var e,r;e=g.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,A.useEffect)(()=>{var e,r,n,a,o;let i;a=g.current,e=b.view,r=b.comparison.result,n=b.history,i=new Set,"photo"in e&&gV(i,e.photo),"result"===e.stage&&(g$(i,e.result),e.resultHistory.forEach(e=>g$(i,e))),n.forEach(e=>g$(i,e)),g$(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,b.view,b.comparison.result,b.history]);let _=(0,A.useMemo)(()=>(function(e,{addToCart:t,choosePhoto:r,deleteResult:n,generate:a,runSessionCommand:o,saveResult:i,shareResult:s,sync:l}){let u=e.view;switch(u.stage){case"start":return{...u,choosePhoto:r,openHistory:()=>o(()=>e.openHistory())};case"intro":return{...u,continueIntro:()=>o(()=>e.continueIntro())};case"history":return{...u,chooseNew:r,selectResult:t=>o(()=>e.selectHistoryResult(t))};case"confirm":return{...u,changePhoto:r,generate:a};case"error":return{...u,chooseDifferentPhoto:r,retry:u.photo?a:r};case"result":return{...u,addToCart:t,changePhoto:()=>{e.closeMyFits(),l(),r()},deleteResult:n,openComparison:t=>o(()=>e.openComparison(t)),reset:()=>o(()=>e.reset()),saveResult:i,shareResult:s,toggleMyFits:()=>o(()=>e.toggleMyFits())};default:return u}})(b,{addToCart:z,choosePhoto:T,deleteResult:j,generate:()=>void R(),runSessionCommand:S,saveResult:O,shareResult:N,sync:k}),[z,T,j,R,S,O,b,N,k]);return{canGoBack:"start"!==(h=b.view.stage)&&"intro"!==h&&"processing"!==h&&"error"!==h&&"result"!==h,comparison:function(e,{addToCart:t,deleteResult:r,runSessionCommand:n,saveResult:a,shareResult:o}){let i=e.comparison;return{...i,addToCart:t,close:()=>n(()=>e.closeComparison()),deleteResult:()=>{let e=i.result?.id??i.result?.after.id;e&&r(e)},saveResult:()=>a(i.result?.id??i.result?.after.id),shareResult:()=>o(i.result?.id??i.result?.after.id)}}(b,{addToCart:z,deleteResult:j,runSessionCommand:S,saveResult:O,shareResult:N}),goBack:()=>S(()=>b.goBack()),requestClose:()=>S(()=>b.requestClose()),selectFile:e=>S(()=>{b.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>y.current?.click(),processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:w}),k=x.view.stage,S=r??x.requestClose,C="result"===x.view.stage&&x.view.myFitsOpen,[P,E]=(0,A.useState)(!1),[T,R]=(0,A.useState)(void 0),j=(0,A.useCallback)(()=>{"result"!==x.view.stage||(x.view.addToCart(),n&&(E(!0),R(void 0),Promise.resolve(n()).catch(e=>R(e instanceof Error&&e.message?e.message:v("externalServiceUnavailable"))).finally(()=>E(!1))))},[n,x.view,v]),O=x.canGoBack?(0,_.jsx)(ge,{label:v("back"),onClick:x.goBack}):null,N="result"===x.view.stage&&x.view.canOpenMyFits?(0,_.jsxs)(i9,{"aria-expanded":C,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:x.view.toggleMyFits,children:[v("myFits"),(0,_.jsx)(sQ,{className:i1("!size-3 transition-transform",C&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,_.jsxs)(fB,{className:C?"h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":k,children:[(0,_.jsx)(f$,{badge:"history"===k||"ready"!==f.status?null:v(function(e){switch(e){case"intro":return"introBadge";case"confirm":return"confirmBadge";case"processing":return"processingBadge";case"error":return"errorBadge";case"result":return"resultBadge";default:return"badge"}}(k)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(k),closeLabel:v("close"),leftSlot:"ready"===f.status?O:null,middleSlot:"ready"===f.status?N:null,preferMiddleSlotFirst:"result"===k,showCloseButton:p,onClose:"ready"===f.status?x.requestClose:S}),(0,_.jsx)("input",{ref:y,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&x.selectFile(t),e.currentTarget.value=""}}),(0,_.jsxs)(fU,{children:["loading"===f.status?(0,_.jsx)(f3,{}):null,"unavailable"===f.status?(0,_.jsx)(f5,{temporary:f.temporary,onClose:S}):null,"error"===f.status?(0,_.jsx)(f9,{onClose:S,onRetry:g}):null,"ready"!==f.status?null:(0,_.jsxs)(_.Fragment,{children:["start"===x.view.stage?(0,_.jsx)(fJ,{view:x.view}):null,"intro"===x.view.stage?(0,_.jsx)(f0,{view:x.view}):null,"history"===x.view.stage?(0,_.jsx)(f1,{view:x.view}):null,"confirm"===x.view.stage?(0,_.jsx)(f2,{view:x.view}):null,"processing"===x.view.stage?(0,_.jsx)(f4,{view:x.view}):null,"error"===x.view.stage?(0,_.jsx)(f6,{view:x.view,onClose:x.requestClose}):null,"result"===x.view.stage?(0,_.jsx)(f8,{view:x.view,showAddToCart:h,onAddToCart:n?j:void 0,addToCartPending:P,addToCartError:T}):null]})]},"ready"===f.status?k:`activation-${f.status}`),x.comparison.open&&(0,_.jsx)(fM,{productName:x.comparison.productName,productPrice:x.comparison.productPrice,productUrl:x.comparison.productUrl,portalContainer:e??void 0,result:x.comparison.result,addToCartPending:P,addToCartError:T,onAddToCart:h?n?j:x.comparison.addToCart:void 0,onClose:x.comparison.close,onDeleteResult:x.comparison.deleteResult,onSaveResult:x.comparison.saveResult,onShareResult:x.comparison.shareResult})]})}sk({baseURL:"https://api.neurodyn.ai/"});let gK={status:"loading"},gG={status:"ready"};function gX({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,apiKey:u,externalGeneration:c,externalActivation:d,externalAddToCart:p,externalClient:h,...f}){c||sY(s);let g=(0,A.useMemo)(()=>{let e;return(e=rs.createInstance()).use(oa).use(rR).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sU}),e},[t]),[m,v]=(0,A.useState)(null),[y,b]=(0,A.useState)(e),w=(0,A.useRef)(!1),x=void 0!==n,k=x?n:y,S=s_(u),C=(0,A.useMemo)(()=>c?h??sd:sV({apiKey:S}),[S,c,h]),[P,E]=(0,A.useState)(gK),[T,R]=(0,A.useState)(0),j=d?P:gG,O=(0,A.useRef)(d);function N(e){x||b(e),r?.(e)}return(0,A.useEffect)(()=>{O.current=d}),(0,A.useEffect)(()=>{let e=O.current;if(!e||(E(gK),!k))return;let t=!1;return e().then(e=>{t||E(e.enabled?{...e,status:"ready"}:{status:"unavailable",temporary:e.temporarilyUnavailable})}).catch(()=>{t||E({status:"error"})}),()=>{t=!0}},[T,k,!!d]),(0,A.useEffect)(()=>{if(!k){w.current=!1;return}"ready"!==j.status||w.current||(w.current=!0,C.sendWidgetEvent("widget_opened"))},[j.status,k,C]),(0,_.jsxs)(_.Fragment,{children:[(0,W.createPortal)((0,_.jsx)("style",{children:sc.A}),document.head),(0,W.createPortal)((0,_.jsxs)(rK.div,{className:"fixed inset-x-0 bottom-0 w-svw tracking-normal sm:inset-x-auto sm:right-4 sm:bottom-4 sm:w-120",style:{zIndex:0x7fffffff},children:[(0,_.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,_.jsx)("style",{children:sq}),(0,_.jsx)("div",{ref:v}),m&&(0,_.jsx)(su,{defaultTheme:"light",root:m,storageKey:"neurodyn-ai-try-on-theme",children:(0,_.jsx)(rT,{i18n:g,children:(0,_.jsx)(gY,{language:t,open:k,portalContainer:m,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,tryOnClient:C,externalGeneration:c,externalAddToCart:p,activation:j,onRetryActivation:()=>R(e=>e+1),onRequestClose:()=>N(!1),onOpenChange:N,...f})})})]}),document.body)]})}function gY({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productPrice:o,productType:i,productUrl:s,tryOnClient:l,externalGeneration:u,externalAddToCart:c,activation:d,onRetryActivation:p,...h}){let{t:f}=rE();return(0,_.jsx)(st,{...h,children:(0,_.jsxs)(sa,{className:"inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,_.jsxs)(so,{className:"sr-only",children:[(0,_.jsx)(si,{children:f("dialogTitle")}),(0,_.jsx)(ss,{children:f("dialogDescription")})]}),(0,_.jsx)(gq,{dialogPortalContainer:r,language:e,productImageSrc:"ready"===d.status&&d.productImageSrc||n,productName:a,productPrice:o,productType:"ready"===d.status?d.productType??i:i,productUrl:s,tryOnClient:l,processPhoto:u,activation:d,onRetryActivation:p,onAddToCart:c,showAddToCart:!u||!!c,showDialogCloseButton:!0,onClose:t})]})})}var gQ=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");let gZ=0;class gJ{container=null;openState=!1;props=null;root=null;destroy(){this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null,this.props=null,this.openState=!1}open(e){this.props=e,this.openState=!0,this.render()}handleOpenChange=e=>{this.openState=e,this.render()};ensureRoot(){return this.root||(this.container=document.createElement("div"),this.container.id=`neurodyn-ai-try-on-dialog-root-${gZ++}`,document.body.appendChild(this.container),this.root=(0,gQ.createRoot)(this.container)),this.root}render(){let e=this.ensureRoot();this.props&&this.openState?e.render((0,A.createElement)(gX,{...this.props,open:!0,onOpenChange:this.handleOpenChange})):e.render(null)}}let g0="data-neurodyn-ai-try-on-product-type";function g1(e,t){return g2(e.getAttribute(t))}function g2(e){return e?.trim()||void 0}function g3(e,t){let r=g1(e,t);if(!r)throw Error(`AI try-on dialog trigger is missing ${t}`);return r}class g5{destroyed=!1;props;renderer=new gJ;triggers;constructor(e,t={}){for(const r of(this.triggers="string"==typeof e?Array.from(document.querySelectorAll(e)):[e],this.props=t,this.triggers))r.addEventListener("click",this.handleClick)}destroy(){if(!this.destroyed){for(let e of(this.destroyed=!0,this.triggers))e.removeEventListener("click",this.handleClick);this.renderer.destroy()}}handleClick=e=>{!this.destroyed&&e.currentTarget instanceof Element&&this.renderer.open(function(e,t={}){var r,n;let a;return{language:void 0!==t.language?t.language:(r="data-neurodyn-ai-try-on-language","en"===(a=e.getAttribute(r))||"ru"===a?a:void 0),productImageSrc:void 0!==t.productImageSrc?t.productImageSrc:g3(e,"data-neurodyn-ai-try-on-product-image-src"),productName:void 0!==t.productName?t.productName:g3(e,"data-neurodyn-ai-try-on-product-name"),productPrice:void 0!==t.productPrice?g2(t.productPrice):g1(e,"data-neurodyn-ai-try-on-product-price"),productUrl:void 0!==t.productUrl?t.productUrl:g1(e,"data-neurodyn-ai-try-on-product-url"),productType:function(e){if(!sX(e)){let t="string"==typeof e&&e.length>0?` "${e}"`:"";throw Error(`AI try-on product type from ${g0} must be one of: ${sK.join(", ")}; received${t||" no value"}`)}return e}(void 0!==t.productType?t.productType:e.getAttribute(g0)),apiKey:(n=void 0!==t.apiKey?t.apiKey:e.getAttribute("data-neurodyn-ai-try-on-api-key"),n?.trim()||void 0)}}(e.currentTarget,this.props))}}window.AiTryOnDialog=g5})()})();
|
|
5509
|
+
Defaulting to \`null\`.`));let c=fx(o,u)?o:null,d=fb(c)?s(c,u):void 0;return(0,_.jsx)(fp,{scope:a,value:c,max:u,children:(0,_.jsx)(fl.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fb(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fy(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});ff.displayName=fu;var fg="ProgressIndicator",fm=A.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=fh(fg,r);return(0,_.jsx)(fl.div,{"data-state":fy(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fv(e,t){return`${Math.round(e/t*100)}%`}function fy(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fb(e){return"number"==typeof e}function fw(e){return fb(e)&&!isNaN(e)&&e>0}function fx(e,t){return fb(e)&&!isNaN(e)&&e<=t&&e>=0}function fk({className:e,value:t,max:r=100,...n}){let a=r>0?r:100,o="number"==typeof t?Math.min(Math.max(t/a*100,0),100):0;return(0,_.jsx)(ff,{"data-slot":"progress",className:i1("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:a,...n,children:(0,_.jsx)(fm,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fS(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...e,children:(0,_.jsx)("path",{d:"M8.21723 14.9975C8.10298 14.997 7.99004 14.9731 7.8854 14.9272C7.78077 14.8814 7.68665 14.8145 7.60889 14.7308L3.55889 10.4225C3.4075 10.2611 3.3264 10.0463 3.33343 9.82513C3.34046 9.604 3.43505 9.39471 3.59639 9.24332C3.75773 9.09192 3.97261 9.01082 4.19374 9.01785C4.41488 9.02489 4.62417 9.11948 4.77556 9.28082L8.20889 12.9392L15.2172 5.27248C15.2883 5.18392 15.3768 5.11083 15.4772 5.0577C15.5776 5.00458 15.6878 4.97254 15.8011 4.96355C15.9143 4.95456 16.0282 4.96882 16.1357 5.00544C16.2432 5.04207 16.3421 5.10029 16.4263 5.17652C16.5105 5.25276 16.5782 5.3454 16.6253 5.44877C16.6724 5.55213 16.6979 5.66403 16.7001 5.7776C16.7024 5.89116 16.6815 6.00399 16.6385 6.10916C16.5956 6.21433 16.5316 6.30961 16.4506 6.38915L8.83389 14.7225C8.75686 14.8077 8.66308 14.8761 8.55841 14.9234C8.45373 14.9707 8.34042 14.996 8.22556 14.9975H8.21723Z",fill:"currentColor"})})}function fC(e){return(0,_.jsxs)("svg",{fill:"none",viewBox:"0 0 19.9993 19.9996",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,_.jsx)("path",{d:"M16 9C16 7.14348 15.2629 5.36256 13.9502 4.0498C12.6374 2.73705 10.8565 2 9 2C7.14348 2 5.36256 2.73705 4.0498 4.0498C2.73705 5.36256 2 7.14348 2 9C2 10.8565 2.73705 12.6374 4.0498 13.9502C5.36256 15.2629 7.14348 16 9 16C10.8565 16 12.6374 15.2629 13.9502 13.9502C15.2629 12.6374 16 10.8565 16 9ZM18 9C18 11.3869 17.0521 13.6764 15.3643 15.3643C13.6764 17.0521 11.3869 18 9 18C6.61305 18 4.32357 17.0521 2.63574 15.3643C0.947915 13.6764 0 11.3869 0 9C0 6.61305 0.947915 4.32357 2.63574 2.63574C4.32357 0.947915 6.61305 0 9 0C11.3869 0 13.6764 0.947915 15.3643 2.63574C17.0521 4.32357 18 6.61305 18 9Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M13.9428 13.943C14.3333 13.5525 14.9663 13.5525 15.3568 13.943L19.7064 18.2926C20.097 18.6832 20.097 19.3162 19.7064 19.7067C19.3159 20.0972 18.6829 20.0972 18.2924 19.7067L13.9428 15.3571C13.5522 14.9666 13.5522 14.3335 13.9428 13.943Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M7.99983 12.0001V6.00008C7.99983 5.4478 8.44755 5.00008 8.99983 5.00008C9.55211 5.00008 9.99983 5.4478 9.99983 6.00008V12.0001C9.99983 12.5524 9.55211 13.0001 8.99983 13.0001C8.44755 13.0001 7.99983 12.5524 7.99983 12.0001Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M11.9998 8.00008C12.5521 8.00008 12.9998 8.4478 12.9998 9.00008C12.9998 9.55237 12.5521 10.0001 11.9998 10.0001H5.99983C5.44755 10.0001 4.99983 9.55237 4.99983 9.00008C4.99983 8.4478 5.44755 8.00008 5.99983 8.00008H11.9998Z",fill:"currentColor"})]})}function fP(e){return t=>{let r=t.currentTarget;e&&r.getAttribute("src")!==e&&(r.src=e)}}function fE({children:e,className:t,...r}){return(0,_.jsx)("div",{className:i1("relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100",t),...r,children:e})}function fT({className:e,src:t}){return(0,_.jsxs)(_.Fragment,{children:[t&&(0,_.jsx)("img",{"aria-hidden":"true",className:i1("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:t}),(0,_.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"})]})}function fR({backdropClassName:e,className:t,fallbackSrc:r,imageClassName:n,photo:a}){let o=a?.src??r,i=fP(r);return(0,_.jsxs)(_.Fragment,{children:[o&&(0,_.jsx)("img",{"aria-hidden":"true",className:i1("absolute inset-0 size-full scale-125 object-cover blur-3xl",t,e),src:o,onError:i}),(0,_.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"}),o&&(0,_.jsx)("img",{alt:a?.name??"",className:i1("absolute inset-0 size-full object-contain",t,n),src:o,onError:i})]})}function fj({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return(0,_.jsxs)(_.Fragment,{children:[n&&(0,_.jsx)("img",{"aria-hidden":"true",className:i1("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:n,onError:fP(t)}),(0,_.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/20"})]})}function fO({className:e,...t}){let r=(0,A.useId)().replace(/:/g,""),n=`${r}-loading-texture-gradient`,a=`${r}-loading-texture-pattern`,o=`${r}-loading-texture-mask`;return(0,_.jsxs)("svg",{className:i1("text-constant-white",e),fill:"none",focusable:"false",viewBox:"0 0 776 992",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,_.jsxs)("defs",{children:[(0,_.jsxs)("radialGradient",{id:n,cx:"0",cy:"0",gradientTransform:"translate(388 496) rotate(90) scale(1021)",gradientUnits:"userSpaceOnUse",r:"1",children:[(0,_.jsx)("stop",{stopColor:"currentColor",stopOpacity:"0.7"}),(0,_.jsx)("stop",{offset:"0.586538",stopColor:"currentColor",stopOpacity:"0"})]}),(0,_.jsx)("pattern",{id:a,width:"24",height:"24",patternUnits:"userSpaceOnUse",children:(0,_.jsx)("circle",{cx:"4",cy:"4",r:"4",fill:"currentColor"})}),(0,_.jsx)("mask",{id:o,children:(0,_.jsx)("rect",{width:"776",height:"992",fill:`url(#${a})`})})]}),(0,_.jsx)("rect",{width:"776",height:"992",fill:`url(#${n})`,mask:`url(#${o})`})]})}function fN({animated:e=!1,className:t,...r}){return(0,_.jsxs)("div",{"aria-hidden":"true",className:i1("absolute h-133 w-104 max-w-none",t),...r,children:[!e&&(0,_.jsx)(fO,{className:"absolute inset-0 size-full opacity-30"}),e&&(0,_.jsx)("span",{className:"absolute inset-0 [mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [mask-position:center] [mask-repeat:no-repeat] [mask-size:18%_18%] [-webkit-mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [-webkit-mask-position:center] [-webkit-mask-repeat:no-repeat] [-webkit-mask-size:18%_18%] animate-[ai-try-on-loading-texture-pulse_2.6s_linear_infinite] motion-reduce:animate-none motion-reduce:[mask-size:220%_220%] motion-reduce:[-webkit-mask-size:220%_220%]",children:(0,_.jsx)(fO,{className:"absolute inset-0 size-full opacity-70"})})]})}function fz({badge:e,className:t,fallbackSrc:r,photo:n,selected:a,...o}){return(0,_.jsxs)("button",{className:i1("group relative aspect-square w-full overflow-hidden rounded-xl bg-background-base-2 text-left ring-offset-2 transition","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground",a?"ring-2 ring-foreground":null,t),type:"button",...o,children:[n?.src?(0,_.jsx)("img",{alt:n.name??"",className:"size-full object-cover",src:n.src}):r?(0,_.jsx)("img",{alt:"",className:"size-full object-cover",src:r}):null,a&&(0,_.jsx)("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-foreground text-background-containers",children:(0,_.jsx)(fS,{className:"size-4"})}),e&&(0,_.jsx)("span",{className:"absolute right-2 top-2",children:e})]})}function f_({className:e,label:t,progress:r=0,...n}){let a=Math.min(Math.max(r,0),100);return(0,_.jsxs)("div",{className:i1("rounded-xl bg-background-base px-6 py-8",e),...n,children:[(0,_.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm font-medium text-text-sub",children:[(0,_.jsx)("span",{children:t}),(0,_.jsxs)("span",{children:[Math.round(a),"%"]})]}),(0,_.jsx)(fk,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fA({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return n?(0,_.jsx)("img",{alt:r?.name??"",className:i1("absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover",e),src:n,onError:fP(t)}):null}function fL({className:e,imageSrc:t,name:r}){return t?(0,_.jsx)("img",{alt:r??"",className:i1("absolute bottom-2 left-2 h-30 w-auto rounded-xl border border-background-containers bg-background-containers object-contain shadow-md",e),src:t}):null}function fI({good:e,imageSrc:t,label:r}){return(0,_.jsxs)("figure",{className:"flex min-w-0 flex-col items-start gap-2",children:[(0,_.jsxs)("div",{className:"relative aspect-square w-full overflow-hidden rounded-xl border border-border-light bg-background-base",children:[(0,_.jsx)("img",{alt:r,className:"size-full object-cover",src:t}),(0,_.jsx)("span",{className:i1("absolute right-2 top-2 flex size-7 items-center justify-center rounded-full",e?"bg-background-green":"bg-background-red"),children:e?(0,_.jsx)(fS,{className:"size-5 text-background-containers"}):(0,_.jsx)(ft,{className:"size-5 text-background-containers"})})]}),(0,_.jsx)("figcaption",{className:"w-[90%] break-words text-xs font-medium leading-[1.6] tracking-[0.02em] text-text-base",children:r})]})}function fM({className:e,onOpenComparison:t,productLabel:r,productUrl:n,result:a,zoomLabel:o}){let i="inline-flex h-8 min-w-0 max-w-52 flex-1 items-center justify-center gap-1.5 rounded-xl bg-button-light px-3 text-xs font-semibold text-text-dark";return(0,_.jsxs)(fE,{"aria-label":o,className:i1("block cursor-pointer text-left",e),role:"button",tabIndex:0,onClick:t,onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},children:[(0,_.jsx)(fR,{photo:a?.after}),(0,_.jsxs)("div",{className:"absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2",children:[n?(0,_.jsxs)("a",{className:i,href:n,onClick:e=>e.stopPropagation(),children:[(0,_.jsx)(fa,{"aria-hidden":"true",className:"size-4"}),(0,_.jsx)("span",{className:"truncate",children:r})]}):(0,_.jsxs)("span",{className:i,children:[(0,_.jsx)(fa,{"aria-hidden":"true",className:"size-4"}),(0,_.jsx)("span",{className:"truncate",children:r})]}),(0,_.jsx)("button",{"aria-label":o,className:"inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-button-light text-text-dark",type:"button",onClick:e=>{e.stopPropagation(),t()},children:(0,_.jsx)(fC,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fF({addToCartError:e,addToCartPending:t=!1,onAddToCart:r,onClose:n,onDeleteResult:a,onSaveResult:o,onShareResult:i,portalContainer:s,productName:l,productPrice:u,productUrl:c,result:d}){var p;let{t:h}=rE(),f=l??h("resultProductLink"),g=(p=u,p?.trim()||void 0),m=g?h("resultTryAnotherWithPrice",{price:g}):h("resultTryAnother");return(0,_.jsx)(st,{open:!0,onOpenChange:e=>!e&&n(),children:(0,_.jsxs)(sa,{className:"dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none bg-[#212124E5] p-0 text-text-dark duration-200 sm:max-w-none sm:p-0",portalContainer:s,showCloseButton:!1,children:[(0,_.jsxs)(so,{className:"sr-only",children:[(0,_.jsx)(si,{children:h("comparisonTitle")}),(0,_.jsx)(ss,{children:h("comparisonSlider")})]}),(0,_.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[c?(0,_.jsx)(i9,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,_.jsxs)("a",{href:c,children:[(0,_.jsx)(fa,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:f})]})}):(0,_.jsxs)(i9,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,_.jsx)(fa,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:f})]}),(0,_.jsx)(i9,{"aria-label":h("close"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,_.jsx)(ft,{className:"!size-3","data-icon":"inline-start"})})]}),(0,_.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center px-8",children:(0,_.jsxs)(h6,{"aria-label":h("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,_.jsx)(h8,{position:"right",children:(0,_.jsx)(fA,{className:"w-full object-contain",photo:d?.after})}),(0,_.jsx)(h8,{position:"left",children:(0,_.jsx)(fA,{className:"w-full object-contain",photo:d?.before})}),(0,_.jsxs)(h7,{className:"w-11",children:[(0,_.jsx)("div",{className:"absolute left-1/2 h-full w-0.5 -translate-x-1/2 bg-constant-white"}),(0,_.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-constant-white text-constant-black shadow-lg",children:(0,_.jsx)("span",{className:"h-5 w-0.5 rounded-full bg-current"})})]})]})}),(0,_.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1 px-8 pb-6 pt-3",children:[e&&(0,_.jsx)("p",{className:"text-xs text-text-sub",role:"alert",children:e}),(0,_.jsxs)("div",{className:"flex h-23 w-full max-w-104 items-start gap-2",children:[r&&(0,_.jsxs)(i9,{className:"min-w-0 flex-1",disabled:t,size:"lg",type:"button",variant:"contrast",onClick:r,children:[(0,_.jsx)(fe,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:m})]}),(0,_.jsx)(i9,{"aria-label":h("share"),size:"icon-lg",type:"button",variant:"outline",onClick:i,children:(0,_.jsx)(fo,{"data-icon":"inline-start"})}),(0,_.jsx)(i9,{"aria-label":h("download"),size:"icon-lg",type:"button",variant:"outline",onClick:o,children:(0,_.jsx)(fr,{"data-icon":"inline-start"})}),(0,_.jsx)(i9,{"aria-label":h("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){a()},children:(0,_.jsx)(fn,{"data-icon":"inline-start"})})]})]})]})})}fm.displayName=fg;let fD=i3("inline-flex w-fit items-center justify-center overflow-hidden rounded-full whitespace-nowrap",{variants:{variant:{default:"bg-contrast text-contrast-foreground",secondary:"bg-[var(--color-background-gray-transparent)] text-text-base",positive:"bg-[var(--color-background-green-transparent)] text-text-green",negative:"bg-[var(--color-background-red-transparent)] text-text-red",standard:"bg-[var(--color-background-blue-transparent)] text-text-blue"},size:{sm:"h-6 px-2 typo-button-small",md:"h-[30px] px-3 typo-button-normal"}},defaultVariants:{variant:"default",size:"sm"}});function fB({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,_.jsx)(n?oJ:"span",{"data-slot":"badge",className:i1(fD({variant:t,size:r,className:e})),...a})}function f$({className:e,...t}){return(0,_.jsx)("div",{className:i1("flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl",e),...t})}function fV({badge:e,badgeTone:t="gray",className:r,closeLabel:n,leftSlot:a,middleSlot:o,onClose:i,preferMiddleSlotFirst:s=!1,showCloseButton:l=!1,...u}){let c=e?(0,_.jsx)(fU,{tone:t,children:e}):null;return(0,_.jsxs)("div",{className:i1("flex h-17 items-center justify-between p-4",r),...u,children:[(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[a,s?o:c,s?c:o]}),l&&(0,_.jsx)(i9,{"aria-label":n,size:"icon",type:"button",variant:"outline",onClick:i,children:(0,_.jsx)(ft,{"data-icon":"inline-start"})})]})}function fU({className:e,tone:t="gray",...r}){return(0,_.jsx)(fB,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fH({className:e,...t}){return(0,_.jsx)("div",{className:i1("flex min-h-0 flex-1 flex-col animate-in fade-in-0 duration-100 motion-reduce:animate-none",e),...t})}function fW(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,_.jsx)("path",{d:"M21.1667 8.4C21.1667 8.16131 21.07 7.93245 20.8981 7.76367C20.7262 7.59489 20.4931 7.5 20.25 7.5H16.5833C16.2768 7.5 15.9906 7.3496 15.8206 7.09922L14.2594 4.8H9.74056L8.17936 7.09922C8.00935 7.3496 7.72316 7.5 7.41667 7.5H3.75C3.50688 7.5 3.2738 7.59489 3.10189 7.76367C2.92998 7.93245 2.83333 8.16131 2.83333 8.4V18.3C2.83333 18.5387 2.92998 18.7675 3.10189 18.9363C3.2738 19.1051 3.50689 19.2 3.75 19.2H20.25C20.4931 19.2 20.7262 19.1051 20.8981 18.9363C21.07 18.7675 21.1667 18.5387 21.1667 18.3V8.4ZM14.75 12.9C14.75 12.184 14.46 11.4973 13.9443 10.991C13.4287 10.4847 12.7292 10.2001 12 10.2C11.2707 10.2 10.5705 10.4847 10.0548 10.991C9.53923 11.4973 9.25 12.1841 9.25 12.9C9.25 13.6159 9.53923 14.3027 10.0548 14.809C10.5705 15.3153 11.2707 15.6 12 15.6C12.7292 15.5999 13.4287 15.3153 13.9443 14.809C14.46 14.3027 14.75 13.616 14.75 12.9ZM16.5833 12.9C16.5833 14.0934 16.1 15.2377 15.2406 16.0816C14.3811 16.9255 13.2155 17.3999 12 17.4C10.7844 17.4 9.61809 16.9256 8.75854 16.0816C7.89919 15.2378 7.41667 14.0933 7.41667 12.9C7.41667 11.7067 7.89919 10.5622 8.75854 9.71836C9.61809 8.87445 10.7844 8.4 12 8.4C13.2155 8.40008 14.3811 8.87452 15.2406 9.71836C16.1 10.5623 16.5833 11.7066 16.5833 12.9ZM23 18.3C23 19.0161 22.7101 19.7026 22.1943 20.209C21.6786 20.7153 20.9793 21 20.25 21H3.75C3.02065 21 2.32139 20.7153 1.80566 20.209C1.28994 19.7026 1 19.0161 1 18.3V8.4C1 7.68392 1.28994 6.99736 1.80566 6.49102C2.32139 5.98467 3.02065 5.7 3.75 5.7H6.92611L8.4873 3.40078L8.55623 3.31201C8.72911 3.11535 8.98172 3 9.25 3H14.75L14.8637 3.00703C15.1262 3.03922 15.3639 3.18167 15.5127 3.40078L17.0739 5.7H20.25C20.9793 5.7 21.6786 5.98467 22.1943 6.49102C22.7101 6.99736 23 7.68392 23 8.4V18.3Z",fill:"currentColor"})})}function fq(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 5.00342 8.37303",fill:"none",...e,children:(0,_.jsx)("path",{d:"M1 1L4.00342 4.18652L1 7.37303",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fK(e){return(0,_.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,_.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,_.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function fG(e){return(0,_.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,_.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 3C18.7956 3 19.5585 3.3163 20.1211 3.87891C20.6837 4.44152 21 5.20435 21 6V18C21 18.7956 20.6837 19.5585 20.1211 20.1211C19.5585 20.6837 18.7956 21 18 21H6C5.20435 21 4.44152 20.6837 3.87891 20.1211C3.3163 19.5585 3 18.7956 3 18V6C3 5.20435 3.3163 4.44152 3.87891 3.87891C4.44152 3.3163 5.20435 3 6 3H18ZM14.0352 12C13.8633 12 13.6974 12.0639 13.5703 12.1797L6 19H18C18.2876 18.977 18.5547 18.8414 18.7422 18.6221C18.9296 18.4028 19.0221 18.1177 19 17.8301V16.6602L14.5 12.1797C14.3729 12.0639 14.2071 12 14.0352 12ZM8 7C7.60218 7 7.22076 7.15815 6.93945 7.43945C6.65815 7.72076 6.5 8.10218 6.5 8.5C6.5 8.89782 6.65815 9.27924 6.93945 9.56055C7.22076 9.84185 7.60218 10 8 10C8.39782 10 8.77924 9.84185 9.06055 9.56055C9.34185 9.27924 9.5 8.89782 9.5 8.5C9.5 8.10218 9.34185 7.72076 9.06055 7.43945C8.77924 7.15815 8.39782 7 8 7Z",fill:"currentColor"})})}function fX(e){return(0,_.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,_.jsx)("path",{d:"M6.05944 11.1406C6.47507 8.23438 8.97819 6 12.0001 6C13.6563 6 15.1563 6.67187 16.2438 7.75625L16.2626 7.775L16.5001 8H15.0032C14.4501 8 14.0032 8.44687 14.0032 9C14.0032 9.55313 14.4501 10 15.0032 10H19.0032C19.5563 10 20.0032 9.55313 20.0032 9V5C20.0032 4.44688 19.5563 4 19.0032 4C18.4501 4 18.0032 4.44688 18.0032 5V6.66875L17.6501 6.33437C16.2032 4.89375 14.2032 4 12.0001 4C7.96882 4 4.63444 6.98125 4.08132 10.8594C4.00319 11.4062 4.38132 11.9125 4.92819 11.9906C5.47507 12.0688 5.98132 11.6875 6.05944 11.1438V11.1406ZM19.9188 13.1406C19.9969 12.5938 19.6157 12.0875 19.0719 12.0094C18.5282 11.9312 18.0188 12.3125 17.9407 12.8562C17.5251 15.7625 15.0219 17.9969 12.0001 17.9969C10.3438 17.9969 8.84382 17.325 7.75632 16.2406L7.73757 16.2219L7.50007 15.9969H8.99694C9.55007 15.9969 9.99694 15.55 9.99694 14.9969C9.99694 14.4437 9.55007 13.9969 8.99694 13.9969L5.00007 14C4.73444 14 4.47819 14.1063 4.29069 14.2969C4.10319 14.4875 3.99694 14.7406 4.00007 15.0094L4.03132 18.9781C4.03444 19.5312 4.48757 19.975 5.04069 19.9688C5.59382 19.9625 6.03757 19.5125 6.03132 18.9594L6.01882 17.35L6.35319 17.6656C7.80007 19.1062 9.79694 20 12.0001 20C16.0313 20 19.3657 17.0187 19.9188 13.1406Z",fill:"currentColor"})})}function fY({className:e,...t}){return(0,_.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:i1("size-6",e),...t,children:[(0,_.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,_.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}let fQ={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},fZ={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},fJ={bag:{cards:[{good:!0,imageSrc:ol,labelKey:"bagIntroGoodFullBody"},{good:!0,imageSrc:os,labelKey:"bagIntroGoodAngle"},{good:!1,imageSrc:oi,labelKey:"bagIntroBadHandsFull"},{good:!1,imageSrc:oo,labelKey:"bagIntroBadCropped"}],subtitleKey:"bagIntroSubtitle",titleKey:"bagIntroTitle"},eyewear:{cards:[{good:!0,imageSrc:od,labelKey:"eyewearIntroGoodFacingCamera"},{good:!0,imageSrc:op,labelKey:"eyewearIntroGoodHairBack"},{good:!1,imageSrc:oc,labelKey:"eyewearIntroBadWearingGlasses"},{good:!1,imageSrc:ou,labelKey:"eyewearIntroBadFaceTurned"}],subtitleKey:"eyewearIntroSubtitle",titleKey:"eyewearIntroTitle"},footwear:{cards:[{good:!0,imageSrc:om,labelKey:"footwearIntroGoodStanding"},{good:!0,imageSrc:og,labelKey:"footwearIntroGoodKneesDown"},{good:!1,imageSrc:of,labelKey:"footwearIntroBadOneFootCropped"},{good:!1,imageSrc:oh,labelKey:"footwearIntroBadFeetHidden"}],subtitleKey:"footwearIntroSubtitle",titleKey:"footwearIntroTitle"},"full-body":{cards:[{good:!0,imageSrc:ow,labelKey:"fullBodyIntroGoodHeadToToe"},{good:!0,imageSrc:ob,labelKey:"fullBodyIntroGoodAngle"},{good:!1,imageSrc:ov,labelKey:"fullBodyIntroBadCropped"},{good:!1,imageSrc:oy,labelKey:"fullBodyIntroBadSitting"}],subtitleKey:"fullBodyIntroSubtitle",titleKey:"fullBodyIntroTitle"},headwear:{cards:[{good:!0,imageSrc:oC,labelKey:"headwearIntroGoodFront"},{good:!0,imageSrc:oS,labelKey:"headwearIntroGoodAngle"},{good:!1,imageSrc:ok,labelKey:"headwearIntroBadWearingHat"},{good:!1,imageSrc:ox,labelKey:"headwearIntroBadCroppedHead"}],subtitleKey:"headwearIntroSubtitle",titleKey:"headwearIntroTitle"},"lower-body":{cards:[{good:!0,imageSrc:oR,labelKey:"lowerBodyIntroGoodWaistToFeet"},{good:!0,imageSrc:oT,labelKey:"lowerBodyIntroGoodFullBody"},{good:!1,imageSrc:oE,labelKey:"lowerBodyIntroBadSitting"},{good:!1,imageSrc:oP,labelKey:"lowerBodyIntroBadCoveredWaist"}],subtitleKey:"lowerBodyIntroSubtitle",titleKey:"lowerBodyIntroTitle"},neck:{cards:[{good:!0,imageSrc:oN,labelKey:"neckIntroGoodHairUp"},{good:!0,imageSrc:oz,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:oO,labelKey:"neckIntroBadHighCollar"}],subtitleKey:"neckIntroSubtitle",titleKey:"neckIntroTitle"},"upper-body":{cards:[{good:!0,imageSrc:oI,labelKey:"upperBodyIntroGoodFacingCamera"},{good:!0,imageSrc:oL,labelKey:"upperBodyIntroGoodAngle"},{good:!1,imageSrc:o_,labelKey:"upperBodyIntroBadArmsCrossed"},{good:!1,imageSrc:oA,labelKey:"upperBodyIntroBadObjectBlockingTorso"}],subtitleKey:"upperBodyIntroSubtitle",titleKey:"upperBodyIntroTitle"},waist:{cards:[{good:!0,imageSrc:oD,labelKey:"waistIntroGoodFullBody"},{good:!0,imageSrc:oB,labelKey:"waistIntroGoodTopTucked"},{good:!1,imageSrc:oM,labelKey:"waistIntroBadOversizedTop"},{good:!1,imageSrc:oF,labelKey:"waistIntroBadSitting"}],subtitleKey:"waistIntroSubtitle",titleKey:"waistIntroTitle"},wrist:{cards:[{good:!0,imageSrc:oU,labelKey:"wristIntroGoodCloseUp"},{good:!0,imageSrc:oH,labelKey:"wristIntroGoodSleeveBack"},{good:!1,imageSrc:o$,labelKey:"wristIntroBadClenchedFist"},{good:!1,imageSrc:oV,labelKey:"wristIntroBadCovered"}],subtitleKey:"wristIntroSubtitle",titleKey:"wristIntroTitle"}};function f0({view:e}){let{t}=rE(),r=e.productType?fJ[e.productType]:null;return(0,_.jsxs)(gr,{title:t("startTitle"),subtitle:t(r?.titleKey??"externalPhotoHint"),children:[(0,_.jsxs)(fE,{className:"mt-3",children:[(0,_.jsx)(fT,{src:e.productImageSrc}),(0,_.jsx)(fA,{fallbackSrc:e.productImageSrc})]}),(0,_.jsxs)(gn,{className:"mt-4",children:[(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,_.jsx)(fW,{"data-icon":"inline-start"}),t("startUpload")]}),(0,_.jsxs)(i9,{className:"w-full",disabled:!e.canOpenHistory,size:"lg",type:"button",variant:"outline",onClick:e.openHistory,children:[(0,_.jsx)(fG,{"data-icon":"inline-start"}),t("startHistory")]}),(0,_.jsx)(ga,{})]})]})}function f1({view:e}){let{t}=rE(),r=e.productType?fJ[e.productType]:null;return r?(0,_.jsxs)(gr,{title:t(r.titleKey),subtitle:t(r.subtitleKey),children:[(0,_.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:gap-4",children:r.cards.map(e=>(0,_.jsx)(fI,{good:e.good,imageSrc:e.imageSrc,label:t(e.labelKey)},e.labelKey))}),(0,_.jsx)("div",{className:"mt-4",children:(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.continueIntro,children:t("introCta")})})]}):null}function f2({view:e}){let{t}=rE();return(0,_.jsxs)(gr,{title:t("historyTitle"),subtitle:t("historySubtitle"),children:[(0,_.jsx)("div",{className:"mt-3 grid min-h-104 flex-1 grid-cols-3 content-start gap-x-3 gap-y-4 overflow-x-hidden overflow-y-auto overscroll-contain pb-2 sm:gap-4",children:e.history.map(r=>(0,_.jsx)(fz,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,_.jsxs)(gn,{className:"mt-4",children:[(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,_.jsx)(fK,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,_.jsx)(ga,{})]})]})}function f3({view:e}){let{t}=rE();return(0,_.jsxs)(gr,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,_.jsxs)(fE,{className:"mt-3",children:[(0,_.jsx)(fR,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,_.jsx)(fL,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,_.jsxs)(gn,{className:"mt-4",children:[(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,_.jsx)(fY,{"data-icon":"inline-start"}),t("confirmGenerate")]}),(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,_.jsx)(fX,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,_.jsx)(ga,{})]})]})}function f5(){let{t:e}=rE();return(0,_.jsx)(gr,{title:e("activationLoading"),subtitle:e("activationLoadingSubtitle"),children:(0,_.jsx)(fE,{className:"mt-3",children:(0,_.jsx)(fN,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"})})})}function f9({onClose:e,temporary:t}){let{t:r}=rE();return(0,_.jsx)(gr,{title:r("activationUnavailableTitle"),subtitle:r(t?"activationTemporarilyUnavailable":"externalProductUnavailable"),children:(0,_.jsxs)(gn,{className:"mt-4",children:[e&&(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e,children:r("close")}),(0,_.jsx)(ga,{className:"text-text-sub"})]})})}function f4({onClose:e,onRetry:t}){let{t:r}=rE();return(0,_.jsx)(gr,{title:r("errorTitle"),subtitle:r("externalServiceUnavailable"),children:(0,_.jsxs)(gn,{className:"mt-4",children:[t&&(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:t,children:[(0,_.jsx)(fY,{"data-icon":"inline-start"}),r("errorRetry")]}),e&&(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e,children:r("close")}),(0,_.jsx)(ga,{className:"text-text-sub"})]})})}function f6({view:e}){let{t}=rE();return(0,_.jsxs)(gr,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,_.jsxs)(fE,{className:"mt-3",children:[(0,_.jsx)(fj,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,_.jsx)(fN,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,_.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white shadow-md sm:size-37.5",children:(0,_.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,_.jsx)("img",{alt:"",className:"size-full object-cover",src:e.photo.src}):null})]})]}),(0,_.jsx)(f_,{className:"mt-4",label:t("processingProgress"),progress:e.processingProgress})]})}function f8({view:e,onClose:t}){let{t:r}=rE(),n="upload-validation"===e.error.kind&&"file-too-large"===e.error.code,a="generation"===e.error.kind?e.error.code:void 0;return(0,_.jsxs)(gr,{title:r(n?"errorFileTooLarge":"errorTitle"),subtitle:n?void 0:r((a?({tokens:"externalNoTokens",product:"externalProductUnavailable",service:"externalServiceUnavailable",timeout:"externalTimeout","photo-required":"externalPhotoRequired"})[a]:void 0)??"errorSubtitle"),children:[!n&&!a&&(0,_.jsxs)(fE,{className:"mt-3",children:[(0,_.jsx)(fj,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,_.jsx)(fN,{className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,_.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-6 px-6 sm:px-12",children:[(0,_.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white bg-background-containers shadow-md sm:size-37.5",children:(0,_.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,_.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,_.jsx)("img",{alt:e.photo.name??"",className:"size-full object-cover",src:e.photo.src,onError:fP(e.productImageSrc)}):null})]}),(0,_.jsx)("p",{className:"w-56 text-center text-xs font-medium tracking-wider text-constant-white",children:r("errorGuidance")})]})]}),(0,_.jsxs)(gn,{className:"mt-4",children:[(!a||"service"===a||"timeout"===a)&&(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,_.jsx)(fY,{"data-icon":"inline-start"}),r("errorRetry")]}),(!a||"photo-required"===a)&&(0,_.jsxs)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,_.jsx)(fX,{"data-icon":"inline-start"}),r("errorDifferentPhoto")]}),a&&t&&(0,_.jsx)(i9,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:t,children:r("close")}),(0,_.jsx)(ga,{className:"text-text-sub"})]})]})}function f7({view:e,showAddToCart:t=!0,onAddToCart:r,addToCartPending:n=!1,addToCartError:a}){let{t:o}=rE(),i=r??e.addToCart,s=go(e.productPrice),l=s?o("resultTryAnotherWithPrice",{price:s}):o("resultTryAnother");return e.myFitsOpen?(0,_.jsx)("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain pb-4",children:(0,_.jsx)("div",{className:"flex flex-col gap-4 px-6 pb-2 pt-4 sm:px-8",children:e.resultHistory.map((r,a)=>(0,_.jsx)(ge,{compact:a>0,onAddToCart:t?i:void 0,addToCartPending:n,productName:r.productName??e.productName,productPrice:r.productPrice,productUrl:r.productUrl??e.productUrl,result:r,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},r.id??r.after.id))})}):(0,_.jsxs)(gr,{className:"pb-6",subtitle:void 0,title:o("resultTitle"),children:[(0,_.jsx)(fM,{className:"mt-6",productLabel:e.productName??o("resultProductLink"),productUrl:e.productUrl,zoomLabel:o("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,_.jsxs)(gn,{className:"mt-4",children:[t&&(0,_.jsxs)(i9,{className:"w-full",disabled:n,size:"lg",type:"button",variant:"contrast",onClick:i,children:[(0,_.jsx)(fe,{"data-icon":"inline-start"}),l]}),a&&(0,_.jsx)("p",{className:"text-center text-xs text-text-sub",role:"alert",children:a}),(0,_.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,_.jsxs)(i9,{type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,_.jsx)(fX,{"data-icon":"inline-start"}),o("resultCompare")]}),(0,_.jsxs)(i9,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,_.jsx)(fo,{"data-icon":"inline-start"}),o("resultShare")]}),(0,_.jsxs)(i9,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,_.jsx)(fr,{"data-icon":"inline-start"}),o("resultReset")]})]})]})]})}function ge({compact:e=!1,onAddToCart:t,addToCartPending:r=!1,onDeleteResult:n,onOpenComparison:a,onSaveResult:o,onShareResult:i,productName:s,productPrice:l,productUrl:u,result:c}){let{t:d}=rE(),p=s??d("resultProductLink"),h=go(l),f=h?d("resultTryAnotherWithPrice",{price:h}):d("resultTryAnother");return(0,_.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,_.jsx)(fM,{productLabel:p,productUrl:u,zoomLabel:d("resultOpenComparison"),result:c,onOpenComparison:()=>a(c.id)}),(0,_.jsxs)("div",{className:"flex gap-2",children:[t&&(0,_.jsxs)(i9,{className:"min-w-0 flex-1",disabled:r,size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,_.jsx)(fe,{"data-icon":"inline-start"}),(0,_.jsx)("span",{className:"truncate",children:f})]}),(0,_.jsx)(i9,{"aria-label":d("share"),size:"icon",type:"button",variant:"outline",onClick:()=>i(c.id),children:(0,_.jsx)(fo,{"data-icon":"inline-start"})}),(0,_.jsx)(i9,{"aria-label":d("download"),size:"icon",type:"button",variant:"outline",onClick:()=>o(c.id),children:(0,_.jsx)(fr,{"data-icon":"inline-start"})}),!e&&(0,_.jsx)(i9,{"aria-label":d("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>n(c.id),children:(0,_.jsx)(fn,{"data-icon":"inline-start"})})]})]})}function gt({label:e,onClick:t}){return(0,_.jsx)(i9,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,_.jsx)(fq,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function gr({children:e,className:t,subtitle:r,title:n}){return(0,_.jsxs)("div",{className:i1("flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto overscroll-contain px-6 pb-5 sm:px-8",t),children:[(0,_.jsxs)("div",{className:"mb-1 flex flex-col gap-1",children:[(0,_.jsx)("h2",{className:"text-2xl font-medium tracking-tight text-text-dark",children:n}),r&&(0,_.jsx)("p",{className:"text-sm font-medium text-text-base",children:r})]}),e]})}function gn({children:e,className:t}){return(0,_.jsx)("div",{className:i1("flex flex-col gap-2",t),children:e})}function ga({className:e}){var t;let{i18n:r,t:n}=rE(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?fZ:fQ);return(0,_.jsxs)("p",{className:i1("pt-1 text-center text-xs font-medium text-text-base",e),children:[n("termsPrefix")," ",(0,_.jsx)("a",{className:"underline underline-offset-2",href:a.terms,rel:"noopener noreferrer",target:"_blank",children:n("termsLink")})," ",n("termsJoiner")," ",(0,_.jsx)("a",{className:"underline underline-offset-2",href:a.privacy,rel:"noopener noreferrer",target:"_blank",children:n("privacyLink")})]})}function go(e){return e?.trim()||void 0}let gi=new Set(["avif","avis","heic","heix","heim","heis","hevc","hevx","mif1","msf1"]);async function gs(e){var t,r;let n,a,o=(t=e)instanceof Blob?t:t instanceof ArrayBuffer?new Blob([t]):ArrayBuffer.isView(t)?new Blob([new Uint8Array(t.buffer,t.byteOffset,t.byteLength)]):null;return!o||o.size<=0?{blob:null,errorText:null}:(r=new Uint8Array(await o.slice(0,16).arrayBuffer()),n=(...e)=>e.every((e,t)=>r[t]===e),a=(e,...t)=>t.every((t,n)=>r[e+n]===t),n(255,216,255)||n(137,80,78,71,13,10,26,10)||n(71,73,70,56)||n(66,77)||n(82,73,70,70)&&a(8,87,69,66,80)||a(4,102,116,121,112)&&gi.has(function(e){let t="";for(let r=8;r<12;r++)t+=String.fromCharCode(e[r]??0);return t}(r)))?{blob:o,errorText:null}:{blob:null,errorText:(await o.text().catch(()=>"")).slice(0,2e3)}}function gl(e){return"string"==typeof e?e.trim():""}function gu(e){if(e)return e;if("function"==typeof fetch)return fetch;throw Error("Fetch API is not available for AI try-on image upload")}async function gc(e,t,r={}){let{fetch:n,signal:a,timeoutMs:o}=r,i=new AbortController,s=()=>i.abort(a?.reason),l=void 0===o?void 0:setTimeout(()=>i.abort(new DOMException("AI try-on image upload timed out","TimeoutError")),o);a?.aborted?s():a?.addEventListener("abort",s,{once:!0});try{let r=await gu(n)(e,{body:t,method:"PUT",signal:i.signal});if(!r.ok){let e=await r.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${r.status}${e?`: ${e}`:""}`)}}finally{clearTimeout(l),a?.removeEventListener("abort",s)}}async function gd(e,t){let r=e?.trim();return r?gh(r,t,"AI try-on product image fetch failed"):null}async function gp(e,t){return e.blob?e.blob:e.file?e.file:e.src?gh(e.src,t,"AI try-on source photo fetch failed"):null}async function gh(e,t,r){let n=await gu(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}let gf="ai-try-on-result";async function gg(e,t={}){let r=await gv(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gb,o=t.revokeObjectUrl??gw,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gy(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gm(e,t={}){let r=await gv(e,t.fetch),n=t.navigator??globalThis.navigator;if(!r)return!1;if("function"==typeof File&&"function"==typeof n?.share){let a={files:[new File([r],gy(r,e,t.filename),{type:r.type||e?.type||"image/png"})]};if("function"!=typeof n.canShare||n.canShare(a))try{return await n.share(a),!0}catch(e){if("u">typeof DOMException&&e instanceof DOMException&&"AbortError"===e.name)return!1}}return gg(e,t)}async function gv(e,t=globalThis.fetch){if(!e)return null;if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof t)return null;try{let r=await t(e.src);if(!r.ok)return null;return r.blob()}catch{return null}}function gy(e,t,r=gf){var n;let a=function(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}(e.type||t?.type)??(n=t?.name,n?.match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??null)??"png",o=r.replace(/\.[a-z0-9]+$/i,"").replace(/[^\w-]+/g,"-").replace(/^-+|-+$/g,"")||gf;return`${o}.${a}`}function gb(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gw(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gx="results";function gk(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gS(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gx)||e.createObjectStore(gx,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gC(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gP(e){return{after:await gE(e.after),before:await gE(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}}async function gE(e){let t=await gT(e);if(!t)throw Error("AI try-on photo cannot be persisted without image data");return{blob:t,id:e.id,lastModified:e.file?.lastModified??e.lastModified,name:e.name,size:t.size,type:t.type||e.type}}async function gT(e){if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof fetch)return null;try{let t=await fetch(e.src);return t.ok?t.blob():null}catch{return null}}function gR(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gj(e,t=gO()){if(t)try{t.setItem(gR(e),"true")}catch{}}function gO(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gN={delete:async function e(e){let t=gk();if(!t)return!1;try{let r=await gS(t),n=r.transaction(gx,"readwrite"),a=gC(n);return n.objectStore(gx).delete(e),await a,r.close(),!0}catch(e){throw Error("AI try-on result could not be removed from history",{cause:e})}},list:async function e(){let e=gk();if(!e)return[];try{var t;let r=await gS(e),n=r.transaction(gx,"readonly"),a=gC(n),o=await (t=n.objectStore(gx).getAll(),new Promise((e,r)=>{t.onerror=()=>r(t.error),t.onsuccess=()=>e(t.result)}));return await a,r.close(),o.sort((e,t)=>t.createdAt-e.createdAt)}catch(e){throw Error("AI try-on history could not be loaded",{cause:e})}},save:async function e(e){let t=gk();if(!t)return!1;try{let r=await gP(e),n=await gS(t),a=n.transaction(gx,"readwrite"),o=gC(a);return a.objectStore(gx).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},gz={save:gg,share:gm},g_={consumeFirstView:function(e,t=gO()){return!function(e,t=gO()){if(!t)return!1;try{return"true"===t.getItem(gR(e))}catch{return!1}}(e,t)&&(gj(e,t),!0)},markSeen:gj},gA={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gL=["image/jpeg","image/png"];class gI{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productPrice:n,productType:a,productUrl:o,tipStore:i}){this.createObjectUrl=e,this.tipStore=i,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productPrice:gM(n),productType:a,productUrl:o,result:null,selectedPhoto:null,stage:"start"}}get view(){switch(this.state.stage){case"intro":return{productType:this.state.productType,stage:"intro"};case"history":return{history:this.state.history,stage:"history"};case"confirm":return{photo:this.state.selectedPhoto,productImageSrc:this.state.productImageSrc,productName:this.state.productName,stage:"confirm"};case"processing":return this.createProcessingView();case"error":return this.createErrorView();case"result":return{canOpenMyFits:this.state.history.length>0,myFitsOpen:this.state.myFitsOpen,productName:this.state.result?.productName??this.state.productName,productPrice:this.state.result?gM(this.state.result.productPrice):this.state.productPrice,productUrl:this.state.result?.productUrl??this.state.productUrl,result:this.state.result,resultHistory:function(e,t){if(!e)return[];let r=[e,...t.filter(t=>t.id!==e.id)];return r.filter((e,t)=>{let n=e.id??e.after.id;return r.findIndex(e=>(e.id??e.after.id)===n)===t})}(this.state.result,this.state.history),stage:"result"};default:return{canOpenHistory:this.state.history.length>0,productImageSrc:this.state.productImageSrc,productName:this.state.productName,productType:this.state.productType,productUrl:this.state.productUrl,stage:"start"}}}get comparison(){let e=this.getComparisonResult();return{open:this.state.comparisonOpen&&null!==e,productName:e?.productName??this.state.productName,productPrice:e?gM(e.productPrice):this.state.productPrice,productUrl:e?.productUrl??this.state.productUrl,result:e}}get selectedPhoto(){return this.state.selectedPhoto}get history(){return this.state.history}updateProduct({productImageSrc:e,productName:t,productPrice:r,productType:n,productUrl:a}){this.state={...this.state,productImageSrc:e,productName:t,productPrice:gM(r),productType:n,productUrl:a}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gF(e,t),[])}}failHistory(e,t){this.state={...this.state,error:{kind:"hydrate-history"===e?"history-load":"save-result"===e?"history-save":"history-delete",message:t}}}choosePhoto(){return this.state.productType&&this.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.state.productType&&this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(this.state.productType&&this.tipStore.markSeen(this.state.productType),this.goBack(),null):{type:"close-dialog"}}openHistory(){0!==this.state.history.length&&(this.state={...this.state,stage:"history"})}goBack(){switch(this.state.stage){case"intro":case"history":this.state={...this.state,stage:"start"};return;case"confirm":this.state={...this.state,stage:this.state.history.length>0?"history":"start"};return;case"processing":case"error":case"result":this.state={...this.state,stage:"confirm"}}}reset(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"}}selectHistoryResult(e){let t=this.state.history.find(t=>t.id===e);t&&(this.state={...this.state,error:null,myFitsOpen:!1,result:t,selectedPhoto:t.before,stage:"result"})}selectFile(e){var t,r;let n=(t=e,gL.includes(t.type)||""===t.type&&/\.(?:jpe?g|png)$/i.test(t.name)?t.size>0xa00000?"file-too-large":null:"unsupported-file-format");if(n)return this.state={...this.state,error:{code:n,kind:"upload-validation"},myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"error"},null;let a=this.createObjectUrl(e),o={blob:e,file:e,id:(r=e,`${r.name}-${r.size}-${r.lastModified}`),lastModified:e.lastModified,name:e.name,size:e.size,src:a,type:e.type};return this.selectPhoto(o),o}selectPhoto(e){this.state={...this.state,error:null,myFitsOpen:!1,processingProgress:0,selectedPhoto:e,stage:"confirm"}}startGeneration(){return!!this.state.selectedPhoto&&(this.state={...this.state,error:null,generationProduct:this.getProductMetadata(),myFitsOpen:!1,processingProgress:0,result:null,stage:"processing"},!0)}reportGenerationProgress(e){var t;"processing"===this.state.stage&&(this.state={...this.state,processingProgress:Math.max(this.state.processingProgress,Number.isFinite(t=e)?Math.min(Math.max(t,0),100):0)})}completeGeneration(e,t=Date.now()){let r=function(e,t,r=Date.now()){return{...e,...t,productPrice:gM(t.productPrice),createdAt:r,id:`${e.before.id}-result-${r}`}}(e,this.state.generationProduct??this.getProductMetadata(),t);return this.state={...this.state,error:null,generationProduct:null,history:gF(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e,t){this.state={...this.state,error:{kind:"generation",message:e,...t?{code:t}:{}},generationProduct:null,stage:"error"}}toggleMyFits(){"result"===this.state.stage&&0!==this.state.history.length&&(this.state={...this.state,myFitsOpen:!this.state.myFitsOpen})}closeMyFits(){this.state={...this.state,myFitsOpen:!1}}openComparison(e){let t=e?this.findResult(e):this.state.result;t&&(this.state={...this.state,comparisonOpen:!0,comparisonResultId:t.id})}closeComparison(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null}}deleteResult(e){let t=this.findResult(e),r=this.state.history.filter(t=>!gD(t,e)),n=this.state.result?.id??this.state.result?.after.id,a=this.getComparisonResult()?.id===e;if(n!==e)return this.state={...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,history:r},t;let o=r[0]??null;return this.state=o?{...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,error:null,generationProduct:null,history:r,myFitsOpen:r.length>0&&this.state.myFitsOpen,result:o,selectedPhoto:o.before,stage:"result"}:{...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:r,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"},t}resolveResultActionPhoto(e){let t=e?this.findResult(e):this.comparison.open?this.comparison.result:this.state.result;return t?.after??null}findResult(e){return this.state.history.find(t=>gD(t,e))??null}createProcessingView(){let e=this.state.generationProduct??this.getProductMetadata();return{photo:this.state.selectedPhoto,processingProgress:this.state.processingProgress,productImageSrc:e.productImageSrc,productName:e.productName,stage:"processing"}}createErrorView(){let e=this.state.generationProduct??this.getProductMetadata();return{error:this.state.error??{kind:"generation"},photo:this.state.selectedPhoto,productImageSrc:e.productImageSrc,productName:e.productName,stage:"error"}}getProductMetadata(){return{productImageSrc:this.state.productImageSrc,productName:this.state.productName,productPrice:this.state.productPrice,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gM(e){return e?.trim()||void 0}function gF(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gD(e,t){return e.id===t||e.after.id===t}class gB extends Error{code;constructor(e){super(e),this.code=e,this.name="AiTryOnGenerationError"}}function g$(e,t){return{blob:e.blob,id:e.id,lastModified:e.lastModified,name:e.name,size:e.size,src:t(e.blob),type:e.type}}function gV(e,t){t&&(gU(e,t.before),gU(e,t.after))}function gU(e,t){gH(t)?.forEach(t=>e.add(t))}function gH(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gW(e){return function(e=5e3){return new Promise(t=>setTimeout(t,e))}(function(e,t=Date.now()){return Math.max(0,5e3-(t-e))}(e))}let gq={status:"ready"};function gK({dialogPortalContainer:e,language:t,onClose:r,onAddToCart:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,apiKey:d,showDialogCloseButton:p=!1,showAddToCart:h=!0,activation:f=gq,onRetryActivation:g}){a||sY(l);let{i18n:m,t:v}=rE(),y=(0,A.useRef)(null),b=s_(d),w=(0,A.useMemo)(()=>c??sV({apiKey:b}),[c,b]);(0,A.useEffect)(()=>{"string"==typeof t&&m.changeLanguage(t)},[m,t]);let x=function({historyStore:e=gN,objectUrls:t=gA,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,resultActions:d=gz,tipStore:p=g_}){var h;let[,f]=(0,A.useReducer)(e=>e+1,0),g=(0,A.useRef)(new Set),m=(0,A.useRef)(!0);(0,A.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let v=(0,A.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&g.current.add(r),r},[t]),y=(0,A.useRef)(null);y.current||(y.current=new gI({createObjectUrl:v,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tipStore:p}));let b=y.current;b.updateProduct({productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u});let w=(0,A.useMemo)(()=>a||(sY(l),function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sY(n);let i=a??sV({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gp(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gd(r,t);if(!u||u.size<=0)throw Error("AI try-on product image is missing");o?.reportProgress(22),o?.reportProgress(32);let[c,d]=function(e,t){let r=e?.uploads;if(!Array.isArray(r)||r.length<2)throw Error("Nano Banana upload URL response is missing uploads");return r.slice(0,2).map(e=>{if(null===e||"object"!=typeof e)throw Error("Nano Banana upload URL response is missing uploads");let t=gl(e.key),r=gl(e.uploadUrl);if(!t||!r)throw Error("Nano Banana upload URL response is missing key or uploadUrl");return{key:t,uploadUrl:r}})}(await i.requestUploadUrls(2),2);o?.reportProgress(44),await Promise.all([gc(c.uploadUrl,l,{fetch:t}),gc(d.uploadUrl,u,{fetch:t})]),o?.reportProgress(62);let p=function(e){if(!e)return()=>{};e(70);let t=Date.now(),r=globalThis.setInterval(()=>{e(70+24*(1-(1-Math.min((Date.now()-t)/45e3,1))**3))},750);return()=>globalThis.clearInterval(r)}(o?.reportProgress);try{s=await i.generateTryOn({category:n,personImage:c.key,productImages:[d.key]},{timeout:9e4})}finally{p()}o?.reportProgress(96);let{blob:h}=await gs(s);if(!h)throw Error("AI try-on generation did not return an image");o?.reportProgress(98);let f=e(h);if(!f)throw Error("AI try-on result image URL cannot be created");return{before:a,after:{blob:h,id:`${a.id}-nano-banana-result`,name:a.name?`${a.name} result`:"AI try-on result",size:h.size,src:f,type:h.type||"image/jpeg"}}}}({createObjectUrl:t.createObjectUrl,productImageSrc:o,productType:l,tryOnClient:c})),[t,a,o,l,c]),x=(0,A.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),k=(0,A.useCallback)(()=>f(),[]),S=(0,A.useCallback)(e=>{let t=e()??null;k(),x(t)},[x,k]),C=(0,A.useCallback)(e=>{b.failHistory(e),k()},[b,k]),P=(0,A.useCallback)(t=>{e.save(t).catch(()=>{C("save-result")})},[e,C]),E=(0,A.useCallback)(t=>{e.delete(t).catch(()=>{C("delete-result")})},[e,C]),T=(0,A.useCallback)(()=>{S(()=>b.choosePhoto())},[S,b]),R=(0,A.useCallback)(async()=>{let e=b.selectedPhoto;if(!e||!b.startGeneration())return;k();let r=Date.now();try{var n;let a=await w(e,{reportProgress:e=>{m.current&&(b.reportGenerationProgress(e),k())}});if(await gW(r),!m.current){P(b.completeGeneration(a)),a.after.src.startsWith("blob:")&&t.revokeObjectUrl(a.after.src);return}let o=b.completeGeneration(a);n=g.current,gH(o.before)?.forEach(e=>n.add(e)),gH(o.after)?.forEach(e=>n.add(e)),P(o),k()}catch(e){if(await gW(r),!m.current)return;b.failGeneration(e instanceof Error?e.message:void 0,e instanceof gB?e.code:void 0),k()}},[t,P,w,b,k]),j=(0,A.useCallback)(e=>{let t=b.deleteResult(e);t&&E(t.id),k()},[E,b,k]),O=(0,A.useCallback)(e=>{d.save(b.resolveResultActionPhoto(e))},[d,b]),N=(0,A.useCallback)(e=>{d.share(b.resolveResultActionPhoto(e))},[d,b]),z=(0,A.useCallback)(()=>{c.sendWidgetEvent("add_to_cart_from_widget")},[c]);(0,A.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;b.hydrateHistory(r.map(e=>({after:g$(e.after,v),before:g$(e.before,v),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}))),k()}catch{t||C("hydrate-history")}}(),()=>{t=!0}},[v,e,C,b,k]),(0,A.useEffect)(()=>()=>{var e,r;e=g.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,A.useEffect)(()=>{var e,r,n,a,o;let i;a=g.current,e=b.view,r=b.comparison.result,n=b.history,i=new Set,"photo"in e&&gU(i,e.photo),"result"===e.stage&&(gV(i,e.result),e.resultHistory.forEach(e=>gV(i,e))),n.forEach(e=>gV(i,e)),gV(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,b.view,b.comparison.result,b.history]);let _=(0,A.useMemo)(()=>(function(e,{addToCart:t,choosePhoto:r,deleteResult:n,generate:a,runSessionCommand:o,saveResult:i,shareResult:s,sync:l}){let u=e.view;switch(u.stage){case"start":return{...u,choosePhoto:r,openHistory:()=>o(()=>e.openHistory())};case"intro":return{...u,continueIntro:()=>o(()=>e.continueIntro())};case"history":return{...u,chooseNew:r,selectResult:t=>o(()=>e.selectHistoryResult(t))};case"confirm":return{...u,changePhoto:r,generate:a};case"error":return{...u,chooseDifferentPhoto:r,retry:u.photo?a:r};case"result":return{...u,addToCart:t,changePhoto:()=>{e.closeMyFits(),l(),r()},deleteResult:n,openComparison:t=>o(()=>e.openComparison(t)),reset:()=>o(()=>e.reset()),saveResult:i,shareResult:s,toggleMyFits:()=>o(()=>e.toggleMyFits())};default:return u}})(b,{addToCart:z,choosePhoto:T,deleteResult:j,generate:()=>void R(),runSessionCommand:S,saveResult:O,shareResult:N,sync:k}),[z,T,j,R,S,O,b,N,k]);return{canGoBack:"start"!==(h=b.view.stage)&&"intro"!==h&&"processing"!==h&&"error"!==h&&"result"!==h,comparison:function(e,{addToCart:t,deleteResult:r,runSessionCommand:n,saveResult:a,shareResult:o}){let i=e.comparison;return{...i,addToCart:t,close:()=>n(()=>e.closeComparison()),deleteResult:()=>{let e=i.result?.id??i.result?.after.id;e&&r(e)},saveResult:()=>a(i.result?.id??i.result?.after.id),shareResult:()=>o(i.result?.id??i.result?.after.id)}}(b,{addToCart:z,deleteResult:j,runSessionCommand:S,saveResult:O,shareResult:N}),goBack:()=>S(()=>b.goBack()),requestClose:()=>S(()=>b.requestClose()),selectFile:e=>S(()=>{b.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>y.current?.click(),processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:w}),k=x.view.stage,S=r??x.requestClose,C="result"===x.view.stage&&x.view.myFitsOpen,[P,E]=(0,A.useState)(!1),[T,R]=(0,A.useState)(void 0),j=(0,A.useCallback)(()=>{"result"!==x.view.stage||(x.view.addToCart(),n&&(E(!0),R(void 0),Promise.resolve(n()).catch(e=>R(e instanceof Error&&e.message?e.message:v("externalServiceUnavailable"))).finally(()=>E(!1))))},[n,x.view,v]),O=x.canGoBack?(0,_.jsx)(gt,{label:v("back"),onClick:x.goBack}):null,N="result"===x.view.stage&&x.view.canOpenMyFits?(0,_.jsxs)(i9,{"aria-expanded":C,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:x.view.toggleMyFits,children:[v("myFits"),(0,_.jsx)(sQ,{className:i1("!size-3 transition-transform",C&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,_.jsxs)(f$,{className:C?"h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":k,children:[(0,_.jsx)(fV,{badge:"history"===k||"ready"!==f.status?null:v(function(e){switch(e){case"intro":return"introBadge";case"confirm":return"confirmBadge";case"processing":return"processingBadge";case"error":return"errorBadge";case"result":return"resultBadge";default:return"badge"}}(k)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(k),closeLabel:v("close"),leftSlot:"ready"===f.status?O:null,middleSlot:"ready"===f.status?N:null,preferMiddleSlotFirst:"result"===k,showCloseButton:p,onClose:"ready"===f.status?x.requestClose:S}),(0,_.jsx)("input",{ref:y,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&x.selectFile(t),e.currentTarget.value=""}}),(0,_.jsxs)(fH,{children:["loading"===f.status?(0,_.jsx)(f5,{}):null,"unavailable"===f.status?(0,_.jsx)(f9,{temporary:f.temporary,onClose:S}):null,"error"===f.status?(0,_.jsx)(f4,{onClose:S,onRetry:g}):null,"ready"!==f.status?null:(0,_.jsxs)(_.Fragment,{children:["start"===x.view.stage?(0,_.jsx)(f0,{view:x.view}):null,"intro"===x.view.stage?(0,_.jsx)(f1,{view:x.view}):null,"history"===x.view.stage?(0,_.jsx)(f2,{view:x.view}):null,"confirm"===x.view.stage?(0,_.jsx)(f3,{view:x.view}):null,"processing"===x.view.stage?(0,_.jsx)(f6,{view:x.view}):null,"error"===x.view.stage?(0,_.jsx)(f8,{view:x.view,onClose:x.requestClose}):null,"result"===x.view.stage?(0,_.jsx)(f7,{view:x.view,showAddToCart:h,onAddToCart:n?j:void 0,addToCartPending:P,addToCartError:T}):null]})]},"ready"===f.status?k:`activation-${f.status}`),x.comparison.open&&(0,_.jsx)(fF,{productName:x.comparison.productName,productPrice:x.comparison.productPrice,productUrl:x.comparison.productUrl,portalContainer:e??void 0,result:x.comparison.result,addToCartPending:P,addToCartError:T,onAddToCart:h?n?j:x.comparison.addToCart:void 0,onClose:x.comparison.close,onDeleteResult:x.comparison.deleteResult,onSaveResult:x.comparison.saveResult,onShareResult:x.comparison.shareResult})]})}sk({baseURL:"https://api.neurodyn.ai/"});let gG={status:"loading"},gX={status:"ready"};function gY({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,apiKey:u,externalGeneration:c,externalActivation:d,externalAddToCart:p,externalClient:h,...f}){c||sY(s);let g=(0,A.useMemo)(()=>{let e;return(e=rs.createInstance()).use(oa).use(rR).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sU}),e},[t]),[m,v]=(0,A.useState)(null),[y,b]=(0,A.useState)(e),w=(0,A.useRef)(!1),x=void 0!==n,k=x?n:y,S=s_(u),C=(0,A.useMemo)(()=>c?h??sd:sV({apiKey:S}),[S,c,h]),[P,E]=(0,A.useState)(gG),[T,R]=(0,A.useState)(0),j=d?P:gX,O=(0,A.useRef)(d);function N(e){x||b(e),r?.(e)}return(0,A.useEffect)(()=>{O.current=d}),(0,A.useEffect)(()=>{let e=O.current;if(!e||(E(gG),!k))return;let t=!1;return e().then(e=>{t||E(e.enabled?{...e,status:"ready"}:{status:"unavailable",temporary:e.temporarilyUnavailable})}).catch(()=>{t||E({status:"error"})}),()=>{t=!0}},[T,k,!!d]),(0,A.useEffect)(()=>{if(!k){w.current=!1;return}"ready"!==j.status||w.current||(w.current=!0,C.sendWidgetEvent("widget_opened"))},[j.status,k,C]),(0,_.jsxs)(_.Fragment,{children:[(0,W.createPortal)((0,_.jsx)("style",{children:sc.A}),document.head),(0,W.createPortal)((0,_.jsxs)(rK.div,{className:"fixed inset-x-0 bottom-0 w-svw tracking-normal sm:inset-x-auto sm:right-4 sm:bottom-4 sm:w-120",style:{zIndex:0x7fffffff},children:[(0,_.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,_.jsx)("style",{children:sq}),(0,_.jsx)("div",{ref:v}),m&&(0,_.jsx)(su,{defaultTheme:"light",root:m,storageKey:"neurodyn-ai-try-on-theme",children:(0,_.jsx)(rT,{i18n:g,children:(0,_.jsx)(gQ,{language:t,open:k,portalContainer:m,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,tryOnClient:C,externalGeneration:c,externalAddToCart:p,activation:j,onRetryActivation:()=>R(e=>e+1),onRequestClose:()=>N(!1),onOpenChange:N,...f})})})]}),document.body)]})}function gQ({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productPrice:o,productType:i,productUrl:s,tryOnClient:l,externalGeneration:u,externalAddToCart:c,activation:d,onRetryActivation:p,...h}){let{t:f}=rE();return(0,_.jsx)(st,{...h,children:(0,_.jsxs)(sa,{className:"inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,_.jsxs)(so,{className:"sr-only",children:[(0,_.jsx)(si,{children:f("dialogTitle")}),(0,_.jsx)(ss,{children:f("dialogDescription")})]}),(0,_.jsx)(gK,{dialogPortalContainer:r,language:e,productImageSrc:"ready"===d.status&&d.productImageSrc||n,productName:a,productPrice:o,productType:"ready"===d.status?d.productType??i:i,productUrl:s,tryOnClient:l,processPhoto:u,activation:d,onRetryActivation:p,onAddToCart:c,showAddToCart:!u||!!c,showDialogCloseButton:!0,onClose:t})]})})}var gZ=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");let gJ=0;class g0{container=null;openState=!1;props=null;root=null;destroy(){this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null,this.props=null,this.openState=!1}open(e){this.props=e,this.openState=!0,this.render()}handleOpenChange=e=>{this.openState=e,this.render()};ensureRoot(){return this.root||(this.container=document.createElement("div"),this.container.id=`neurodyn-ai-try-on-dialog-root-${gJ++}`,document.body.appendChild(this.container),this.root=(0,gZ.createRoot)(this.container)),this.root}render(){let e=this.ensureRoot();this.props&&this.openState?e.render((0,A.createElement)(gY,{...this.props,open:!0,onOpenChange:this.handleOpenChange})):e.render(null)}}let g1="data-neurodyn-ai-try-on-product-type";function g2(e,t){return g3(e.getAttribute(t))}function g3(e){return e?.trim()||void 0}function g5(e,t){let r=g2(e,t);if(!r)throw Error(`AI try-on dialog trigger is missing ${t}`);return r}class g9{destroyed=!1;props;renderer=new g0;triggers;constructor(e,t={}){for(const r of(this.triggers="string"==typeof e?Array.from(document.querySelectorAll(e)):[e],this.props=t,this.triggers))r.addEventListener("click",this.handleClick)}destroy(){if(!this.destroyed){for(let e of(this.destroyed=!0,this.triggers))e.removeEventListener("click",this.handleClick);this.renderer.destroy()}}handleClick=e=>{!this.destroyed&&e.currentTarget instanceof Element&&this.renderer.open(function(e,t={}){var r,n;let a;return{language:void 0!==t.language?t.language:(r="data-neurodyn-ai-try-on-language","en"===(a=e.getAttribute(r))||"ru"===a?a:void 0),productImageSrc:void 0!==t.productImageSrc?t.productImageSrc:g5(e,"data-neurodyn-ai-try-on-product-image-src"),productName:void 0!==t.productName?t.productName:g5(e,"data-neurodyn-ai-try-on-product-name"),productPrice:void 0!==t.productPrice?g3(t.productPrice):g2(e,"data-neurodyn-ai-try-on-product-price"),productUrl:void 0!==t.productUrl?t.productUrl:g2(e,"data-neurodyn-ai-try-on-product-url"),productType:function(e){if(!sX(e)){let t="string"==typeof e&&e.length>0?` "${e}"`:"";throw Error(`AI try-on product type from ${g1} must be one of: ${sK.join(", ")}; received${t||" no value"}`)}return e}(void 0!==t.productType?t.productType:e.getAttribute(g1)),apiKey:(n=void 0!==t.apiKey?t.apiKey:e.getAttribute("data-neurodyn-ai-try-on-api-key"),n?.trim()||void 0)}}(e.currentTarget,this.props))}}window.AiTryOnDialog=g9})()})();
|
|
@@ -5506,4 +5506,4 @@ ${f}
|
|
|
5506
5506
|
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
|
|
5507
5507
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5508
5508
|
|
|
5509
|
-
Defaulting to \`null\`.`));let c=fC(o,u)?o:null,d=fk(c)?s(c,u):void 0;return(0,A.jsx)(fg,{scope:a,value:c,max:u,children:(0,A.jsx)(fd.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fk(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fx(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});fv.displayName=fp;var fy="ProgressIndicator",fb=L.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=fm(fy,r);return(0,A.jsx)(fd.div,{"data-state":fx(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fw(e,t){return`${Math.round(e/t*100)}%`}function fx(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fk(e){return"number"==typeof e}function fS(e){return fk(e)&&!isNaN(e)&&e>0}function fC(e,t){return fk(e)&&!isNaN(e)&&e<=t&&e>=0}function fP({className:e,value:t,max:r=100,...n}){let a=r>0?r:100,o="number"==typeof t?Math.min(Math.max(t/a*100,0),100):0;return(0,A.jsx)(fv,{"data-slot":"progress",className:i2("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:a,...n,children:(0,A.jsx)(fb,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fE(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...e,children:(0,A.jsx)("path",{d:"M8.21723 14.9975C8.10298 14.997 7.99004 14.9731 7.8854 14.9272C7.78077 14.8814 7.68665 14.8145 7.60889 14.7308L3.55889 10.4225C3.4075 10.2611 3.3264 10.0463 3.33343 9.82513C3.34046 9.604 3.43505 9.39471 3.59639 9.24332C3.75773 9.09192 3.97261 9.01082 4.19374 9.01785C4.41488 9.02489 4.62417 9.11948 4.77556 9.28082L8.20889 12.9392L15.2172 5.27248C15.2883 5.18392 15.3768 5.11083 15.4772 5.0577C15.5776 5.00458 15.6878 4.97254 15.8011 4.96355C15.9143 4.95456 16.0282 4.96882 16.1357 5.00544C16.2432 5.04207 16.3421 5.10029 16.4263 5.17652C16.5105 5.25276 16.5782 5.3454 16.6253 5.44877C16.6724 5.55213 16.6979 5.66403 16.7001 5.7776C16.7024 5.89116 16.6815 6.00399 16.6385 6.10916C16.5956 6.21433 16.5316 6.30961 16.4506 6.38915L8.83389 14.7225C8.75686 14.8077 8.66308 14.8761 8.55841 14.9234C8.45373 14.9707 8.34042 14.996 8.22556 14.9975H8.21723Z",fill:"currentColor"})})}function fT(e){return(0,A.jsxs)("svg",{fill:"none",viewBox:"0 0 19.9993 19.9996",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,A.jsx)("path",{d:"M16 9C16 7.14348 15.2629 5.36256 13.9502 4.0498C12.6374 2.73705 10.8565 2 9 2C7.14348 2 5.36256 2.73705 4.0498 4.0498C2.73705 5.36256 2 7.14348 2 9C2 10.8565 2.73705 12.6374 4.0498 13.9502C5.36256 15.2629 7.14348 16 9 16C10.8565 16 12.6374 15.2629 13.9502 13.9502C15.2629 12.6374 16 10.8565 16 9ZM18 9C18 11.3869 17.0521 13.6764 15.3643 15.3643C13.6764 17.0521 11.3869 18 9 18C6.61305 18 4.32357 17.0521 2.63574 15.3643C0.947915 13.6764 0 11.3869 0 9C0 6.61305 0.947915 4.32357 2.63574 2.63574C4.32357 0.947915 6.61305 0 9 0C11.3869 0 13.6764 0.947915 15.3643 2.63574C17.0521 4.32357 18 6.61305 18 9Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M13.9428 13.943C14.3333 13.5525 14.9663 13.5525 15.3568 13.943L19.7064 18.2926C20.097 18.6832 20.097 19.3162 19.7064 19.7067C19.3159 20.0972 18.6829 20.0972 18.2924 19.7067L13.9428 15.3571C13.5522 14.9666 13.5522 14.3335 13.9428 13.943Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 12.0001V6.00008C7.99983 5.4478 8.44755 5.00008 8.99983 5.00008C9.55211 5.00008 9.99983 5.4478 9.99983 6.00008V12.0001C9.99983 12.5524 9.55211 13.0001 8.99983 13.0001C8.44755 13.0001 7.99983 12.5524 7.99983 12.0001Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M11.9998 8.00008C12.5521 8.00008 12.9998 8.4478 12.9998 9.00008C12.9998 9.55237 12.5521 10.0001 11.9998 10.0001H5.99983C5.44755 10.0001 4.99983 9.55237 4.99983 9.00008C4.99983 8.4478 5.44755 8.00008 5.99983 8.00008H11.9998Z",fill:"currentColor"})]})}function fR({children:e,className:t,...r}){return(0,A.jsx)("div",{className:i2("relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100",t),...r,children:e})}function fO({className:e,src:t}){return(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:t}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"})]})}function fj({backdropClassName:e,className:t,fallbackSrc:r,imageClassName:n,photo:a}){let o=a?.src??r;function i(e){r&&(e.currentTarget.src=r)}return(0,A.jsxs)(A.Fragment,{children:[o&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",t,e),src:o,onError:i}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"}),o&&(0,A.jsx)("img",{alt:a?.name??"",className:i2("absolute inset-0 size-full object-contain",t,n),src:o,onError:i})]})}function fz({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return(0,A.jsxs)(A.Fragment,{children:[n&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:n,onError:e=>{t&&(e.currentTarget.src=t)}}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/20"})]})}function fN({className:e,...t}){let r=(0,L.useId)().replace(/:/g,""),n=`${r}-loading-texture-gradient`,a=`${r}-loading-texture-pattern`,o=`${r}-loading-texture-mask`;return(0,A.jsxs)("svg",{className:i2("text-constant-white",e),fill:"none",focusable:"false",viewBox:"0 0 776 992",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,A.jsxs)("defs",{children:[(0,A.jsxs)("radialGradient",{id:n,cx:"0",cy:"0",gradientTransform:"translate(388 496) rotate(90) scale(1021)",gradientUnits:"userSpaceOnUse",r:"1",children:[(0,A.jsx)("stop",{stopColor:"currentColor",stopOpacity:"0.7"}),(0,A.jsx)("stop",{offset:"0.586538",stopColor:"currentColor",stopOpacity:"0"})]}),(0,A.jsx)("pattern",{id:a,width:"24",height:"24",patternUnits:"userSpaceOnUse",children:(0,A.jsx)("circle",{cx:"4",cy:"4",r:"4",fill:"currentColor"})}),(0,A.jsx)("mask",{id:o,children:(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${a})`})})]}),(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${n})`,mask:`url(#${o})`})]})}function f_({animated:e=!1,className:t,...r}){return(0,A.jsxs)("div",{"aria-hidden":"true",className:i2("absolute h-133 w-104 max-w-none",t),...r,children:[!e&&(0,A.jsx)(fN,{className:"absolute inset-0 size-full opacity-30"}),e&&(0,A.jsx)("span",{className:"absolute inset-0 [mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [mask-position:center] [mask-repeat:no-repeat] [mask-size:18%_18%] [-webkit-mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [-webkit-mask-position:center] [-webkit-mask-repeat:no-repeat] [-webkit-mask-size:18%_18%] animate-[ai-try-on-loading-texture-pulse_2.6s_linear_infinite] motion-reduce:animate-none motion-reduce:[mask-size:220%_220%] motion-reduce:[-webkit-mask-size:220%_220%]",children:(0,A.jsx)(fN,{className:"absolute inset-0 size-full opacity-70"})})]})}function fA({badge:e,className:t,fallbackSrc:r,photo:n,selected:a,...o}){return(0,A.jsxs)("button",{className:i2("group relative aspect-square w-full overflow-hidden rounded-xl bg-background-base-2 text-left ring-offset-2 transition","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground",a?"ring-2 ring-foreground":null,t),type:"button",...o,children:[n?.src?(0,A.jsx)("img",{alt:n.name??"",className:"size-full object-cover",src:n.src}):r?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:r}):null,a&&(0,A.jsx)("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-foreground text-background-containers",children:(0,A.jsx)(fE,{className:"size-4"})}),e&&(0,A.jsx)("span",{className:"absolute right-2 top-2",children:e})]})}function fL({className:e,label:t,progress:r=0,...n}){let a=Math.min(Math.max(r,0),100);return(0,A.jsxs)("div",{className:i2("rounded-xl bg-background-base px-6 py-8",e),...n,children:[(0,A.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm font-medium text-text-sub",children:[(0,A.jsx)("span",{children:t}),(0,A.jsxs)("span",{children:[Math.round(a),"%"]})]}),(0,A.jsx)(fP,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fI({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return n?(0,A.jsx)("img",{alt:r?.name??"",className:i2("absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover",e),src:n,onError:e=>{t&&(e.currentTarget.src=t)}}):null}function fM({className:e,imageSrc:t,name:r}){return t?(0,A.jsx)("img",{alt:r??"",className:i2("absolute bottom-2 left-2 h-30 w-auto rounded-xl border border-background-containers bg-background-containers object-contain shadow-md",e),src:t}):null}function fF({good:e,imageSrc:t,label:r}){return(0,A.jsxs)("figure",{className:"flex min-w-0 flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"relative aspect-square w-full overflow-hidden rounded-xl border border-border-light bg-background-base",children:[(0,A.jsx)("img",{alt:r,className:"size-full object-cover",src:t}),(0,A.jsx)("span",{className:i2("absolute right-2 top-2 flex size-7 items-center justify-center rounded-full",e?"bg-background-green":"bg-background-red"),children:e?(0,A.jsx)(fE,{className:"size-5 text-background-containers"}):(0,A.jsx)(fa,{className:"size-5 text-background-containers"})})]}),(0,A.jsx)("figcaption",{className:"w-[90%] break-words text-xs font-medium leading-[1.6] tracking-[0.02em] text-text-base",children:r})]})}function fD({className:e,onOpenComparison:t,productLabel:r,productUrl:n,result:a,zoomLabel:o}){let i="inline-flex h-8 min-w-0 max-w-52 flex-1 items-center justify-center gap-1.5 rounded-xl bg-button-light px-3 text-xs font-semibold text-text-dark";return(0,A.jsxs)(fR,{"aria-label":o,className:i2("block cursor-pointer text-left",e),role:"button",tabIndex:0,onClick:t,onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},children:[(0,A.jsx)(fj,{photo:a?.after}),(0,A.jsxs)("div",{className:"absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2",children:[n?(0,A.jsxs)("a",{className:i,href:n,onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(fs,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}):(0,A.jsxs)("span",{className:i,children:[(0,A.jsx)(fs,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}),(0,A.jsx)("button",{"aria-label":o,className:"inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-button-light text-text-dark",type:"button",onClick:e=>{e.stopPropagation(),t()},children:(0,A.jsx)(fT,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fB({addToCartError:e,addToCartPending:t=!1,onAddToCart:r,onClose:n,onDeleteResult:a,onSaveResult:o,onShareResult:i,portalContainer:s,productName:l,productPrice:u,productUrl:c,result:d}){var p;let{t:h}=rT(),f=l??h("resultProductLink"),g=(p=u,p?.trim()||void 0),m=g?h("resultTryAnotherWithPrice",{price:g}):h("resultTryAnother");return(0,A.jsx)(sr,{open:!0,onOpenChange:e=>!e&&n(),children:(0,A.jsxs)(so,{className:"dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none bg-[#212124E5] p-0 text-text-dark duration-200 sm:max-w-none sm:p-0",portalContainer:s,showCloseButton:!1,children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:h("comparisonTitle")}),(0,A.jsx)(sl,{children:h("comparisonSlider")})]}),(0,A.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[c?(0,A.jsx)(i4,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,A.jsxs)("a",{href:c,children:[(0,A.jsx)(fs,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]})}):(0,A.jsxs)(i4,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,A.jsx)(fs,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":h("close"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,A.jsx)(fa,{className:"!size-3","data-icon":"inline-start"})})]}),(0,A.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center px-8",children:(0,A.jsxs)(fe,{"aria-label":h("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,A.jsx)(ft,{position:"right",children:(0,A.jsx)(fI,{className:"w-full object-contain",photo:d?.after})}),(0,A.jsx)(ft,{position:"left",children:(0,A.jsx)(fI,{className:"w-full object-contain",photo:d?.before})}),(0,A.jsxs)(fr,{className:"w-11",children:[(0,A.jsx)("div",{className:"absolute left-1/2 h-full w-0.5 -translate-x-1/2 bg-constant-white"}),(0,A.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-constant-white text-constant-black shadow-lg",children:(0,A.jsx)("span",{className:"h-5 w-0.5 rounded-full bg-current"})})]})]})}),(0,A.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1 px-8 pb-6 pt-3",children:[e&&(0,A.jsx)("p",{className:"text-xs text-text-sub",role:"alert",children:e}),(0,A.jsxs)("div",{className:"flex h-23 w-full max-w-104 items-start gap-2",children:[r&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:t,size:"lg",type:"button",variant:"contrast",onClick:r,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:m})]}),(0,A.jsx)(i4,{"aria-label":h("share"),size:"icon-lg",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fl,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("download"),size:"icon-lg",type:"button",variant:"outline",onClick:o,children:(0,A.jsx)(fo,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){a()},children:(0,A.jsx)(fi,{"data-icon":"inline-start"})})]})]})]})})}fb.displayName=fy;let f$=i5("inline-flex w-fit items-center justify-center overflow-hidden rounded-full whitespace-nowrap",{variants:{variant:{default:"bg-contrast text-contrast-foreground",secondary:"bg-[var(--color-background-gray-transparent)] text-text-base",positive:"bg-[var(--color-background-green-transparent)] text-text-green",negative:"bg-[var(--color-background-red-transparent)] text-text-red",standard:"bg-[var(--color-background-blue-transparent)] text-text-blue"},size:{sm:"h-6 px-2 typo-button-small",md:"h-[30px] px-3 typo-button-normal"}},defaultVariants:{variant:"default",size:"sm"}});function fV({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,A.jsx)(n?o0:"span",{"data-slot":"badge",className:i2(f$({variant:t,size:r,className:e})),...a})}function fU({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl",e),...t})}function fH({badge:e,badgeTone:t="gray",className:r,closeLabel:n,leftSlot:a,middleSlot:o,onClose:i,preferMiddleSlotFirst:s=!1,showCloseButton:l=!1,...u}){let c=e?(0,A.jsx)(fW,{tone:t,children:e}):null;return(0,A.jsxs)("div",{className:i2("flex h-17 items-center justify-between p-4",r),...u,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[a,s?o:c,s?c:o]}),l&&(0,A.jsx)(i4,{"aria-label":n,size:"icon",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fa,{"data-icon":"inline-start"})})]})}function fW({className:e,tone:t="gray",...r}){return(0,A.jsx)(fV,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fq({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex min-h-0 flex-1 flex-col animate-in fade-in-0 duration-100 motion-reduce:animate-none",e),...t})}function fK(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{d:"M21.1667 8.4C21.1667 8.16131 21.07 7.93245 20.8981 7.76367C20.7262 7.59489 20.4931 7.5 20.25 7.5H16.5833C16.2768 7.5 15.9906 7.3496 15.8206 7.09922L14.2594 4.8H9.74056L8.17936 7.09922C8.00935 7.3496 7.72316 7.5 7.41667 7.5H3.75C3.50688 7.5 3.2738 7.59489 3.10189 7.76367C2.92998 7.93245 2.83333 8.16131 2.83333 8.4V18.3C2.83333 18.5387 2.92998 18.7675 3.10189 18.9363C3.2738 19.1051 3.50689 19.2 3.75 19.2H20.25C20.4931 19.2 20.7262 19.1051 20.8981 18.9363C21.07 18.7675 21.1667 18.5387 21.1667 18.3V8.4ZM14.75 12.9C14.75 12.184 14.46 11.4973 13.9443 10.991C13.4287 10.4847 12.7292 10.2001 12 10.2C11.2707 10.2 10.5705 10.4847 10.0548 10.991C9.53923 11.4973 9.25 12.1841 9.25 12.9C9.25 13.6159 9.53923 14.3027 10.0548 14.809C10.5705 15.3153 11.2707 15.6 12 15.6C12.7292 15.5999 13.4287 15.3153 13.9443 14.809C14.46 14.3027 14.75 13.616 14.75 12.9ZM16.5833 12.9C16.5833 14.0934 16.1 15.2377 15.2406 16.0816C14.3811 16.9255 13.2155 17.3999 12 17.4C10.7844 17.4 9.61809 16.9256 8.75854 16.0816C7.89919 15.2378 7.41667 14.0933 7.41667 12.9C7.41667 11.7067 7.89919 10.5622 8.75854 9.71836C9.61809 8.87445 10.7844 8.4 12 8.4C13.2155 8.40008 14.3811 8.87452 15.2406 9.71836C16.1 10.5623 16.5833 11.7066 16.5833 12.9ZM23 18.3C23 19.0161 22.7101 19.7026 22.1943 20.209C21.6786 20.7153 20.9793 21 20.25 21H3.75C3.02065 21 2.32139 20.7153 1.80566 20.209C1.28994 19.7026 1 19.0161 1 18.3V8.4C1 7.68392 1.28994 6.99736 1.80566 6.49102C2.32139 5.98467 3.02065 5.7 3.75 5.7H6.92611L8.4873 3.40078L8.55623 3.31201C8.72911 3.11535 8.98172 3 9.25 3H14.75L14.8637 3.00703C15.1262 3.03922 15.3639 3.18167 15.5127 3.40078L17.0739 5.7H20.25C20.9793 5.7 21.6786 5.98467 22.1943 6.49102C22.7101 6.99736 23 7.68392 23 8.4V18.3Z",fill:"currentColor"})})}function fG(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 5.00342 8.37303",fill:"none",...e,children:(0,A.jsx)("path",{d:"M1 1L4.00342 4.18652L1 7.37303",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fX(e){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,A.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function fY(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 3C18.7956 3 19.5585 3.3163 20.1211 3.87891C20.6837 4.44152 21 5.20435 21 6V18C21 18.7956 20.6837 19.5585 20.1211 20.1211C19.5585 20.6837 18.7956 21 18 21H6C5.20435 21 4.44152 20.6837 3.87891 20.1211C3.3163 19.5585 3 18.7956 3 18V6C3 5.20435 3.3163 4.44152 3.87891 3.87891C4.44152 3.3163 5.20435 3 6 3H18ZM14.0352 12C13.8633 12 13.6974 12.0639 13.5703 12.1797L6 19H18C18.2876 18.977 18.5547 18.8414 18.7422 18.6221C18.9296 18.4028 19.0221 18.1177 19 17.8301V16.6602L14.5 12.1797C14.3729 12.0639 14.2071 12 14.0352 12ZM8 7C7.60218 7 7.22076 7.15815 6.93945 7.43945C6.65815 7.72076 6.5 8.10218 6.5 8.5C6.5 8.89782 6.65815 9.27924 6.93945 9.56055C7.22076 9.84185 7.60218 10 8 10C8.39782 10 8.77924 9.84185 9.06055 9.56055C9.34185 9.27924 9.5 8.89782 9.5 8.5C9.5 8.10218 9.34185 7.72076 9.06055 7.43945C8.77924 7.15815 8.39782 7 8 7Z",fill:"currentColor"})})}function fQ(e){return(0,A.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,A.jsx)("path",{d:"M6.05944 11.1406C6.47507 8.23438 8.97819 6 12.0001 6C13.6563 6 15.1563 6.67187 16.2438 7.75625L16.2626 7.775L16.5001 8H15.0032C14.4501 8 14.0032 8.44687 14.0032 9C14.0032 9.55313 14.4501 10 15.0032 10H19.0032C19.5563 10 20.0032 9.55313 20.0032 9V5C20.0032 4.44688 19.5563 4 19.0032 4C18.4501 4 18.0032 4.44688 18.0032 5V6.66875L17.6501 6.33437C16.2032 4.89375 14.2032 4 12.0001 4C7.96882 4 4.63444 6.98125 4.08132 10.8594C4.00319 11.4062 4.38132 11.9125 4.92819 11.9906C5.47507 12.0688 5.98132 11.6875 6.05944 11.1438V11.1406ZM19.9188 13.1406C19.9969 12.5938 19.6157 12.0875 19.0719 12.0094C18.5282 11.9312 18.0188 12.3125 17.9407 12.8562C17.5251 15.7625 15.0219 17.9969 12.0001 17.9969C10.3438 17.9969 8.84382 17.325 7.75632 16.2406L7.73757 16.2219L7.50007 15.9969H8.99694C9.55007 15.9969 9.99694 15.55 9.99694 14.9969C9.99694 14.4437 9.55007 13.9969 8.99694 13.9969L5.00007 14C4.73444 14 4.47819 14.1063 4.29069 14.2969C4.10319 14.4875 3.99694 14.7406 4.00007 15.0094L4.03132 18.9781C4.03444 19.5312 4.48757 19.975 5.04069 19.9688C5.59382 19.9625 6.03757 19.5125 6.03132 18.9594L6.01882 17.35L6.35319 17.6656C7.80007 19.1062 9.79694 20 12.0001 20C16.0313 20 19.3657 17.0187 19.9188 13.1406Z",fill:"currentColor"})})}function fZ({className:e,...t}){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:i2("size-6",e),...t,children:[(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}let fJ={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},f0={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},f1={bag:{cards:[{good:!0,imageSrc:ou,labelKey:"bagIntroGoodFullBody"},{good:!0,imageSrc:ol,labelKey:"bagIntroGoodAngle"},{good:!1,imageSrc:os,labelKey:"bagIntroBadHandsFull"},{good:!1,imageSrc:oi,labelKey:"bagIntroBadCropped"}],subtitleKey:"bagIntroSubtitle",titleKey:"bagIntroTitle"},eyewear:{cards:[{good:!0,imageSrc:op,labelKey:"eyewearIntroGoodFacingCamera"},{good:!0,imageSrc:oh,labelKey:"eyewearIntroGoodHairBack"},{good:!1,imageSrc:od,labelKey:"eyewearIntroBadWearingGlasses"},{good:!1,imageSrc:oc,labelKey:"eyewearIntroBadFaceTurned"}],subtitleKey:"eyewearIntroSubtitle",titleKey:"eyewearIntroTitle"},footwear:{cards:[{good:!0,imageSrc:ov,labelKey:"footwearIntroGoodStanding"},{good:!0,imageSrc:om,labelKey:"footwearIntroGoodKneesDown"},{good:!1,imageSrc:og,labelKey:"footwearIntroBadOneFootCropped"},{good:!1,imageSrc:of,labelKey:"footwearIntroBadFeetHidden"}],subtitleKey:"footwearIntroSubtitle",titleKey:"footwearIntroTitle"},"full-body":{cards:[{good:!0,imageSrc:ox,labelKey:"fullBodyIntroGoodHeadToToe"},{good:!0,imageSrc:ow,labelKey:"fullBodyIntroGoodAngle"},{good:!1,imageSrc:oy,labelKey:"fullBodyIntroBadCropped"},{good:!1,imageSrc:ob,labelKey:"fullBodyIntroBadSitting"}],subtitleKey:"fullBodyIntroSubtitle",titleKey:"fullBodyIntroTitle"},headwear:{cards:[{good:!0,imageSrc:oP,labelKey:"headwearIntroGoodFront"},{good:!0,imageSrc:oC,labelKey:"headwearIntroGoodAngle"},{good:!1,imageSrc:oS,labelKey:"headwearIntroBadWearingHat"},{good:!1,imageSrc:ok,labelKey:"headwearIntroBadCroppedHead"}],subtitleKey:"headwearIntroSubtitle",titleKey:"headwearIntroTitle"},"lower-body":{cards:[{good:!0,imageSrc:oO,labelKey:"lowerBodyIntroGoodWaistToFeet"},{good:!0,imageSrc:oR,labelKey:"lowerBodyIntroGoodFullBody"},{good:!1,imageSrc:oT,labelKey:"lowerBodyIntroBadSitting"},{good:!1,imageSrc:oE,labelKey:"lowerBodyIntroBadCoveredWaist"}],subtitleKey:"lowerBodyIntroSubtitle",titleKey:"lowerBodyIntroTitle"},neck:{cards:[{good:!0,imageSrc:oN,labelKey:"neckIntroGoodHairUp"},{good:!0,imageSrc:o_,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:oz,labelKey:"neckIntroBadHighCollar"}],subtitleKey:"neckIntroSubtitle",titleKey:"neckIntroTitle"},"upper-body":{cards:[{good:!0,imageSrc:oM,labelKey:"upperBodyIntroGoodFacingCamera"},{good:!0,imageSrc:oI,labelKey:"upperBodyIntroGoodAngle"},{good:!1,imageSrc:oA,labelKey:"upperBodyIntroBadArmsCrossed"},{good:!1,imageSrc:oL,labelKey:"upperBodyIntroBadObjectBlockingTorso"}],subtitleKey:"upperBodyIntroSubtitle",titleKey:"upperBodyIntroTitle"},waist:{cards:[{good:!0,imageSrc:oB,labelKey:"waistIntroGoodFullBody"},{good:!0,imageSrc:o$,labelKey:"waistIntroGoodTopTucked"},{good:!1,imageSrc:oF,labelKey:"waistIntroBadOversizedTop"},{good:!1,imageSrc:oD,labelKey:"waistIntroBadSitting"}],subtitleKey:"waistIntroSubtitle",titleKey:"waistIntroTitle"},wrist:{cards:[{good:!0,imageSrc:oH,labelKey:"wristIntroGoodCloseUp"},{good:!0,imageSrc:oW,labelKey:"wristIntroGoodSleeveBack"},{good:!1,imageSrc:oV,labelKey:"wristIntroBadClenchedFist"},{good:!1,imageSrc:oU,labelKey:"wristIntroBadCovered"}],subtitleKey:"wristIntroSubtitle",titleKey:"wristIntroTitle"}};function f2({view:e}){let{t}=rT(),r=e.productType?f1[e.productType]:null;return(0,A.jsxs)(ga,{title:t("startTitle"),subtitle:t(r?.titleKey??"externalPhotoHint"),children:[(0,A.jsxs)(fR,{className:"mt-3",children:[(0,A.jsx)(fO,{src:e.productImageSrc}),(0,A.jsx)(fI,{fallbackSrc:e.productImageSrc})]}),(0,A.jsxs)(go,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,A.jsx)(fK,{"data-icon":"inline-start"}),t("startUpload")]}),(0,A.jsxs)(i4,{className:"w-full",disabled:!e.canOpenHistory,size:"lg",type:"button",variant:"outline",onClick:e.openHistory,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),t("startHistory")]}),(0,A.jsx)(gi,{})]})]})}function f3({view:e}){let{t}=rT(),r=e.productType?f1[e.productType]:null;return r?(0,A.jsxs)(ga,{title:t(r.titleKey),subtitle:t(r.subtitleKey),children:[(0,A.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:gap-4",children:r.cards.map(e=>(0,A.jsx)(fF,{good:e.good,imageSrc:e.imageSrc,label:t(e.labelKey)},e.labelKey))}),(0,A.jsx)("div",{className:"mt-4",children:(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.continueIntro,children:t("introCta")})})]}):null}function f5({view:e}){let{t}=rT();return(0,A.jsxs)(ga,{title:t("historyTitle"),subtitle:t("historySubtitle"),children:[(0,A.jsx)("div",{className:"mt-3 grid min-h-104 flex-1 grid-cols-3 content-start gap-x-3 gap-y-4 overflow-x-hidden overflow-y-auto overscroll-contain pb-2 sm:gap-4",children:e.history.map(r=>(0,A.jsx)(fA,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,A.jsxs)(go,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,A.jsx)(fX,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,A.jsx)(gi,{})]})]})}function f9({view:e}){let{t}=rT();return(0,A.jsxs)(ga,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,A.jsxs)(fR,{className:"mt-3",children:[(0,A.jsx)(fj,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fM,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,A.jsxs)(go,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,A.jsx)(fZ,{"data-icon":"inline-start"}),t("confirmGenerate")]}),(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,A.jsx)(gi,{})]})]})}function f4(){let{t:e}=rT();return(0,A.jsx)(ga,{title:e("activationLoading"),subtitle:e("activationLoadingSubtitle"),children:(0,A.jsx)(fR,{className:"mt-3",children:(0,A.jsx)(f_,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"})})})}function f6({onClose:e,temporary:t}){let{t:r}=rT();return(0,A.jsx)(ga,{title:r("activationUnavailableTitle"),subtitle:r(t?"activationTemporarilyUnavailable":"externalProductUnavailable"),children:(0,A.jsxs)(go,{className:"mt-4",children:[e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e,children:r("close")}),(0,A.jsx)(gi,{className:"text-text-sub"})]})})}function f8({onClose:e,onRetry:t}){let{t:r}=rT();return(0,A.jsx)(ga,{title:r("errorTitle"),subtitle:r("externalServiceUnavailable"),children:(0,A.jsxs)(go,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(fZ,{"data-icon":"inline-start"}),r("errorRetry")]}),e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e,children:r("close")}),(0,A.jsx)(gi,{className:"text-text-sub"})]})})}function f7({view:e}){let{t}=rT();return(0,A.jsxs)(ga,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,A.jsxs)(fR,{className:"mt-3",children:[(0,A.jsx)(fz,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(f_,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:e.photo.src}):null})]})]}),(0,A.jsx)(fL,{className:"mt-4",label:t("processingProgress"),progress:e.processingProgress})]})}function ge({view:e,onClose:t}){let{t:r}=rT(),n="upload-validation"===e.error.kind&&"file-too-large"===e.error.code,a="generation"===e.error.kind?e.error.code:void 0;return(0,A.jsxs)(ga,{title:r(n?"errorFileTooLarge":"errorTitle"),subtitle:n?void 0:r((a?({tokens:"externalNoTokens",product:"externalProductUnavailable",service:"externalServiceUnavailable",timeout:"externalTimeout","photo-required":"externalPhotoRequired"})[a]:void 0)??"errorSubtitle"),children:[!n&&!a&&(0,A.jsxs)(fR,{className:"mt-3",children:[(0,A.jsx)(fz,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(f_,{className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-6 px-6 sm:px-12",children:[(0,A.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white bg-background-containers shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:e.photo.name??"",className:"size-full object-cover",src:e.photo.src,onError:t=>{t.currentTarget.src=e.productImageSrc}}):null})]}),(0,A.jsx)("p",{className:"w-56 text-center text-xs font-medium tracking-wider text-constant-white",children:r("errorGuidance")})]})]}),(0,A.jsxs)(go,{className:"mt-4",children:[(!a||"service"===a||"timeout"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,A.jsx)(fZ,{"data-icon":"inline-start"}),r("errorRetry")]}),(!a||"photo-required"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),r("errorDifferentPhoto")]}),a&&t&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:t,children:r("close")}),(0,A.jsx)(gi,{className:"text-text-sub"})]})]})}function gt({view:e,showAddToCart:t=!0,onAddToCart:r,addToCartPending:n=!1,addToCartError:a}){let{t:o}=rT(),i=r??e.addToCart,s=gs(e.productPrice),l=s?o("resultTryAnotherWithPrice",{price:s}):o("resultTryAnother");return e.myFitsOpen?(0,A.jsx)("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain pb-4",children:(0,A.jsx)("div",{className:"flex flex-col gap-4 px-6 pb-2 pt-4 sm:px-8",children:e.resultHistory.map((r,a)=>(0,A.jsx)(gr,{compact:a>0,onAddToCart:t?i:void 0,addToCartPending:n,productName:r.productName??e.productName,productPrice:r.productPrice,productUrl:r.productUrl??e.productUrl,result:r,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},r.id??r.after.id))})}):(0,A.jsxs)(ga,{className:"pb-6",subtitle:void 0,title:o("resultTitle"),children:[(0,A.jsx)(fD,{className:"mt-6",productLabel:e.productName??o("resultProductLink"),productUrl:e.productUrl,zoomLabel:o("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,A.jsxs)(go,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",disabled:n,size:"lg",type:"button",variant:"contrast",onClick:i,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),l]}),a&&(0,A.jsx)("p",{className:"text-center text-xs text-text-sub",role:"alert",children:a}),(0,A.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),o("resultCompare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,A.jsx)(fl,{"data-icon":"inline-start"}),o("resultShare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,A.jsx)(fo,{"data-icon":"inline-start"}),o("resultReset")]})]})]})]})}function gr({compact:e=!1,onAddToCart:t,addToCartPending:r=!1,onDeleteResult:n,onOpenComparison:a,onSaveResult:o,onShareResult:i,productName:s,productPrice:l,productUrl:u,result:c}){let{t:d}=rT(),p=s??d("resultProductLink"),h=gs(l),f=h?d("resultTryAnotherWithPrice",{price:h}):d("resultTryAnother");return(0,A.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,A.jsx)(fD,{productLabel:p,productUrl:u,zoomLabel:d("resultOpenComparison"),result:c,onOpenComparison:()=>a(c.id)}),(0,A.jsxs)("div",{className:"flex gap-2",children:[t&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:r,size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":d("share"),size:"icon",type:"button",variant:"outline",onClick:()=>i(c.id),children:(0,A.jsx)(fl,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":d("download"),size:"icon",type:"button",variant:"outline",onClick:()=>o(c.id),children:(0,A.jsx)(fo,{"data-icon":"inline-start"})}),!e&&(0,A.jsx)(i4,{"aria-label":d("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>n(c.id),children:(0,A.jsx)(fi,{"data-icon":"inline-start"})})]})]})}function gn({label:e,onClick:t}){return(0,A.jsx)(i4,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fG,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function ga({children:e,className:t,subtitle:r,title:n}){return(0,A.jsxs)("div",{className:i2("flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto overscroll-contain px-6 pb-5 sm:px-8",t),children:[(0,A.jsxs)("div",{className:"mb-1 flex flex-col gap-1",children:[(0,A.jsx)("h2",{className:"text-2xl font-medium tracking-tight text-text-dark",children:n}),r&&(0,A.jsx)("p",{className:"text-sm font-medium text-text-base",children:r})]}),e]})}function go({children:e,className:t}){return(0,A.jsx)("div",{className:i2("flex flex-col gap-2",t),children:e})}function gi({className:e}){var t;let{i18n:r,t:n}=rT(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?f0:fJ);return(0,A.jsxs)("p",{className:i2("pt-1 text-center text-xs font-medium text-text-base",e),children:[n("termsPrefix")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.terms,rel:"noopener noreferrer",target:"_blank",children:n("termsLink")})," ",n("termsJoiner")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.privacy,rel:"noopener noreferrer",target:"_blank",children:n("privacyLink")})]})}function gs(e){return e?.trim()||void 0}let gl=new Set(["avif","avis","heic","heix","heim","heis","hevc","hevx","mif1","msf1"]);async function gu(e){var t,r;let n,a,o=(t=e)instanceof Blob?t:t instanceof ArrayBuffer?new Blob([t]):ArrayBuffer.isView(t)?new Blob([new Uint8Array(t.buffer,t.byteOffset,t.byteLength)]):null;return!o||o.size<=0?{blob:null,errorText:null}:(r=new Uint8Array(await o.slice(0,16).arrayBuffer()),n=(...e)=>e.every((e,t)=>r[t]===e),a=(e,...t)=>t.every((t,n)=>r[e+n]===t),n(255,216,255)||n(137,80,78,71,13,10,26,10)||n(71,73,70,56)||n(66,77)||n(82,73,70,70)&&a(8,87,69,66,80)||a(4,102,116,121,112)&&gl.has(function(e){let t="";for(let r=8;r<12;r++)t+=String.fromCharCode(e[r]??0);return t}(r)))?{blob:o,errorText:null}:{blob:null,errorText:(await o.text().catch(()=>"")).slice(0,2e3)}}function gc(e){return"string"==typeof e?e.trim():""}function gd(e,t){let r=e?.uploads;if(!Array.isArray(r)||r.length<t)throw Error("Nano Banana upload URL response is missing uploads");return r.slice(0,t).map(e=>{if(null===e||"object"!=typeof e)throw Error("Nano Banana upload URL response is missing uploads");let t=gc(e.key),r=gc(e.uploadUrl);if(!t||!r)throw Error("Nano Banana upload URL response is missing key or uploadUrl");return{key:t,uploadUrl:r}})}function gp(e){if(e)return e;if("function"==typeof fetch)return fetch;throw Error("Fetch API is not available for AI try-on image upload")}async function gh(e,t,r={}){let{fetch:n,signal:a,timeoutMs:o}=r,i=new AbortController,s=()=>i.abort(a?.reason),l=void 0===o?void 0:setTimeout(()=>i.abort(new DOMException("AI try-on image upload timed out","TimeoutError")),o);a?.aborted?s():a?.addEventListener("abort",s,{once:!0});try{let r=await gp(n)(e,{body:t,method:"PUT",signal:i.signal});if(!r.ok){let e=await r.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${r.status}${e?`: ${e}`:""}`)}}finally{clearTimeout(l),a?.removeEventListener("abort",s)}}async function gf(e,t){let r=e?.trim();return r?gm(r,t,"AI try-on product image fetch failed"):null}async function gg(e,t){return e.blob?e.blob:e.file?e.file:e.src?gm(e.src,t,"AI try-on source photo fetch failed"):null}async function gm(e,t,r){let n=await gp(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}function gv(e){if(!e)return()=>{};e(70);let t=Date.now(),r=globalThis.setInterval(()=>{e(70+24*(1-(1-Math.min((Date.now()-t)/45e3,1))**3))},750);return()=>globalThis.clearInterval(r)}let gy="ai-try-on-result";async function gb(e,t={}){let r=await gx(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gS,o=t.revokeObjectUrl??gC,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gk(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gw(e,t={}){let r=await gx(e,t.fetch),n=t.navigator??globalThis.navigator;if(!r)return!1;if("function"==typeof File&&"function"==typeof n?.share){let a={files:[new File([r],gk(r,e,t.filename),{type:r.type||e?.type||"image/png"})]};if("function"!=typeof n.canShare||n.canShare(a))try{return await n.share(a),!0}catch(e){if("u">typeof DOMException&&e instanceof DOMException&&"AbortError"===e.name)return!1}}return gb(e,t)}async function gx(e,t=globalThis.fetch){if(!e)return null;if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof t)return null;try{let r=await t(e.src);if(!r.ok)return null;return r.blob()}catch{return null}}function gk(e,t,r=gy){var n;let a=function(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}(e.type||t?.type)??(n=t?.name,n?.match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??null)??"png",o=r.replace(/\.[a-z0-9]+$/i,"").replace(/[^\w-]+/g,"-").replace(/^-+|-+$/g,"")||gy;return`${o}.${a}`}function gS(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gC(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gP="results";function gE(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gT(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gP)||e.createObjectStore(gP,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gR(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gO(e){return{after:await gj(e.after),before:await gj(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}}async function gj(e){let t=await gz(e);if(!t)throw Error("AI try-on photo cannot be persisted without image data");return{blob:t,id:e.id,lastModified:e.file?.lastModified??e.lastModified,name:e.name,size:t.size,type:t.type||e.type}}async function gz(e){if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof fetch)return null;try{let t=await fetch(e.src);return t.ok?t.blob():null}catch{return null}}function gN(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function g_(e,t=gA()){if(t)try{t.setItem(gN(e),"true")}catch{}}function gA(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gL={delete:async function e(e){let t=gE();if(!t)return!1;try{let r=await gT(t),n=r.transaction(gP,"readwrite"),a=gR(n);return n.objectStore(gP).delete(e),await a,r.close(),!0}catch(e){throw Error("AI try-on result could not be removed from history",{cause:e})}},list:async function e(){let e=gE();if(!e)return[];try{var t;let r=await gT(e),n=r.transaction(gP,"readonly"),a=gR(n),o=await (t=n.objectStore(gP).getAll(),new Promise((e,r)=>{t.onerror=()=>r(t.error),t.onsuccess=()=>e(t.result)}));return await a,r.close(),o.sort((e,t)=>t.createdAt-e.createdAt)}catch(e){throw Error("AI try-on history could not be loaded",{cause:e})}},save:async function e(e){let t=gE();if(!t)return!1;try{let r=await gO(e),n=await gT(t),a=n.transaction(gP,"readwrite"),o=gR(a);return a.objectStore(gP).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},gI={save:gb,share:gw},gM={consumeFirstView:function(e,t=gA()){return!function(e,t=gA()){if(!t)return!1;try{return"true"===t.getItem(gN(e))}catch{return!1}}(e,t)&&(g_(e,t),!0)},markSeen:g_},gF={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gD=["image/jpeg","image/png"];class gB{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productPrice:n,productType:a,productUrl:o,tipStore:i}){this.createObjectUrl=e,this.tipStore=i,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productPrice:g$(n),productType:a,productUrl:o,result:null,selectedPhoto:null,stage:"start"}}get view(){switch(this.state.stage){case"intro":return{productType:this.state.productType,stage:"intro"};case"history":return{history:this.state.history,stage:"history"};case"confirm":return{photo:this.state.selectedPhoto,productImageSrc:this.state.productImageSrc,productName:this.state.productName,stage:"confirm"};case"processing":return this.createProcessingView();case"error":return this.createErrorView();case"result":return{canOpenMyFits:this.state.history.length>0,myFitsOpen:this.state.myFitsOpen,productName:this.state.result?.productName??this.state.productName,productPrice:this.state.result?g$(this.state.result.productPrice):this.state.productPrice,productUrl:this.state.result?.productUrl??this.state.productUrl,result:this.state.result,resultHistory:function(e,t){if(!e)return[];let r=[e,...t.filter(t=>t.id!==e.id)];return r.filter((e,t)=>{let n=e.id??e.after.id;return r.findIndex(e=>(e.id??e.after.id)===n)===t})}(this.state.result,this.state.history),stage:"result"};default:return{canOpenHistory:this.state.history.length>0,productImageSrc:this.state.productImageSrc,productName:this.state.productName,productType:this.state.productType,productUrl:this.state.productUrl,stage:"start"}}}get comparison(){let e=this.getComparisonResult();return{open:this.state.comparisonOpen&&null!==e,productName:e?.productName??this.state.productName,productPrice:e?g$(e.productPrice):this.state.productPrice,productUrl:e?.productUrl??this.state.productUrl,result:e}}get selectedPhoto(){return this.state.selectedPhoto}get history(){return this.state.history}updateProduct({productImageSrc:e,productName:t,productPrice:r,productType:n,productUrl:a}){this.state={...this.state,productImageSrc:e,productName:t,productPrice:g$(r),productType:n,productUrl:a}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gV(e,t),[])}}failHistory(e,t){this.state={...this.state,error:{kind:"hydrate-history"===e?"history-load":"save-result"===e?"history-save":"history-delete",message:t}}}choosePhoto(){return this.state.productType&&this.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.state.productType&&this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(this.state.productType&&this.tipStore.markSeen(this.state.productType),this.goBack(),null):{type:"close-dialog"}}openHistory(){0!==this.state.history.length&&(this.state={...this.state,stage:"history"})}goBack(){switch(this.state.stage){case"intro":case"history":this.state={...this.state,stage:"start"};return;case"confirm":this.state={...this.state,stage:this.state.history.length>0?"history":"start"};return;case"processing":case"error":case"result":this.state={...this.state,stage:"confirm"}}}reset(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"}}selectHistoryResult(e){let t=this.state.history.find(t=>t.id===e);t&&(this.state={...this.state,error:null,myFitsOpen:!1,result:t,selectedPhoto:t.before,stage:"result"})}selectFile(e){var t,r;let n=(t=e,gD.includes(t.type)||""===t.type&&/\.(?:jpe?g|png)$/i.test(t.name)?t.size>0xa00000?"file-too-large":null:"unsupported-file-format");if(n)return this.state={...this.state,error:{code:n,kind:"upload-validation"},myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"error"},null;let a=this.createObjectUrl(e),o={blob:e,file:e,id:(r=e,`${r.name}-${r.size}-${r.lastModified}`),lastModified:e.lastModified,name:e.name,size:e.size,src:a,type:e.type};return this.selectPhoto(o),o}selectPhoto(e){this.state={...this.state,error:null,myFitsOpen:!1,processingProgress:0,selectedPhoto:e,stage:"confirm"}}startGeneration(){return!!this.state.selectedPhoto&&(this.state={...this.state,error:null,generationProduct:this.getProductMetadata(),myFitsOpen:!1,processingProgress:0,result:null,stage:"processing"},!0)}reportGenerationProgress(e){var t;"processing"===this.state.stage&&(this.state={...this.state,processingProgress:Math.max(this.state.processingProgress,Number.isFinite(t=e)?Math.min(Math.max(t,0),100):0)})}completeGeneration(e,t=Date.now()){let r=function(e,t,r=Date.now()){return{...e,...t,productPrice:g$(t.productPrice),createdAt:r,id:`${e.before.id}-result-${r}`}}(e,this.state.generationProduct??this.getProductMetadata(),t);return this.state={...this.state,error:null,generationProduct:null,history:gV(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e,t){this.state={...this.state,error:{kind:"generation",message:e,...t?{code:t}:{}},generationProduct:null,stage:"error"}}toggleMyFits(){"result"===this.state.stage&&0!==this.state.history.length&&(this.state={...this.state,myFitsOpen:!this.state.myFitsOpen})}closeMyFits(){this.state={...this.state,myFitsOpen:!1}}openComparison(e){let t=e?this.findResult(e):this.state.result;t&&(this.state={...this.state,comparisonOpen:!0,comparisonResultId:t.id})}closeComparison(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null}}deleteResult(e){let t=this.findResult(e),r=this.state.history.filter(t=>!gU(t,e)),n=this.state.result?.id??this.state.result?.after.id,a=this.getComparisonResult()?.id===e;if(n!==e)return this.state={...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,history:r},t;let o=r[0]??null;return this.state=o?{...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,error:null,generationProduct:null,history:r,myFitsOpen:r.length>0&&this.state.myFitsOpen,result:o,selectedPhoto:o.before,stage:"result"}:{...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:r,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"},t}resolveResultActionPhoto(e){let t=e?this.findResult(e):this.comparison.open?this.comparison.result:this.state.result;return t?.after??null}findResult(e){return this.state.history.find(t=>gU(t,e))??null}createProcessingView(){let e=this.state.generationProduct??this.getProductMetadata();return{photo:this.state.selectedPhoto,processingProgress:this.state.processingProgress,productImageSrc:e.productImageSrc,productName:e.productName,stage:"processing"}}createErrorView(){let e=this.state.generationProduct??this.getProductMetadata();return{error:this.state.error??{kind:"generation"},photo:this.state.selectedPhoto,productImageSrc:e.productImageSrc,productName:e.productName,stage:"error"}}getProductMetadata(){return{productImageSrc:this.state.productImageSrc,productName:this.state.productName,productPrice:this.state.productPrice,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function g$(e){return e?.trim()||void 0}function gV(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gU(e,t){return e.id===t||e.after.id===t}class gH extends Error{code;constructor(e){super(e),this.code=e,this.name="AiTryOnGenerationError"}}function gW(e,t){return{blob:e.blob,id:e.id,lastModified:e.lastModified,name:e.name,size:e.size,src:t(e.blob),type:e.type}}function gq(e,t){t&&(gK(e,t.before),gK(e,t.after))}function gK(e,t){gG(t)?.forEach(t=>e.add(t))}function gG(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gX(e){return function(e=5e3){return new Promise(t=>setTimeout(t,e))}(function(e,t=Date.now()){return Math.max(0,5e3-(t-e))}(e))}let gY={status:"ready"};function gQ({dialogPortalContainer:e,language:t,onClose:r,onAddToCart:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,apiKey:d,showDialogCloseButton:p=!1,showAddToCart:h=!0,activation:f=gY,onRetryActivation:g}){a||sJ(l);let{i18n:m,t:v}=rT(),y=(0,L.useRef)(null),b=sL(d),w=(0,L.useMemo)(()=>c??sW({apiKey:b}),[c,b]);(0,L.useEffect)(()=>{"string"==typeof t&&m.changeLanguage(t)},[m,t]);let x=function({historyStore:e=gL,objectUrls:t=gF,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,resultActions:d=gI,tipStore:p=gM}){var h;let[,f]=(0,L.useReducer)(e=>e+1,0),g=(0,L.useRef)(new Set),m=(0,L.useRef)(!0);(0,L.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let v=(0,L.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&g.current.add(r),r},[t]),y=(0,L.useRef)(null);y.current||(y.current=new gB({createObjectUrl:v,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tipStore:p}));let b=y.current;b.updateProduct({productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u});let w=(0,L.useMemo)(()=>a||(sJ(l),function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sJ(n);let i=a??sW({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gg(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gf(r,t);if(!u||u.size<=0)throw Error("AI try-on product image is missing");o?.reportProgress(22),o?.reportProgress(32);let[c,d]=gd(await i.requestUploadUrls(2),2);o?.reportProgress(44),await Promise.all([gh(c.uploadUrl,l,{fetch:t}),gh(d.uploadUrl,u,{fetch:t})]),o?.reportProgress(62);let p=gv(o?.reportProgress);try{s=await i.generateTryOn({category:n,personImage:c.key,productImages:[d.key]},{timeout:9e4})}finally{p()}o?.reportProgress(96);let{blob:h}=await gu(s);if(!h)throw Error("AI try-on generation did not return an image");o?.reportProgress(98);let f=e(h);if(!f)throw Error("AI try-on result image URL cannot be created");return{before:a,after:{blob:h,id:`${a.id}-nano-banana-result`,name:a.name?`${a.name} result`:"AI try-on result",size:h.size,src:f,type:h.type||"image/jpeg"}}}}({createObjectUrl:v,productImageSrc:o,productType:l,tryOnClient:c})),[v,a,o,l,c]),x=(0,L.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),k=(0,L.useCallback)(()=>f(),[]),S=(0,L.useCallback)(e=>{let t=e()??null;k(),x(t)},[x,k]),C=(0,L.useCallback)(e=>{b.failHistory(e),k()},[b,k]),P=(0,L.useCallback)(t=>{e.save(t).catch(()=>{C("save-result")})},[e,C]),E=(0,L.useCallback)(t=>{e.delete(t).catch(()=>{C("delete-result")})},[e,C]),T=(0,L.useCallback)(()=>{S(()=>b.choosePhoto())},[S,b]),R=(0,L.useCallback)(async()=>{let e=b.selectedPhoto;if(!e||!b.startGeneration())return;k();let r=Date.now();try{var n;let a=await w(e,{reportProgress:e=>{m.current&&(b.reportGenerationProgress(e),k())}});if(await gX(r),!m.current){P(b.completeGeneration(a)),a.after.src.startsWith("blob:")&&t.revokeObjectUrl(a.after.src);return}let o=b.completeGeneration(a);n=g.current,gG(o.before)?.forEach(e=>n.add(e)),gG(o.after)?.forEach(e=>n.add(e)),P(o),k()}catch(e){if(await gX(r),!m.current)return;b.failGeneration(e instanceof Error?e.message:void 0,e instanceof gH?e.code:void 0),k()}},[t,P,w,b,k]),O=(0,L.useCallback)(e=>{let t=b.deleteResult(e);t&&E(t.id),k()},[E,b,k]),j=(0,L.useCallback)(e=>{d.save(b.resolveResultActionPhoto(e))},[d,b]),z=(0,L.useCallback)(e=>{d.share(b.resolveResultActionPhoto(e))},[d,b]),N=(0,L.useCallback)(()=>{c.sendWidgetEvent("add_to_cart_from_widget")},[c]);(0,L.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;b.hydrateHistory(r.map(e=>({after:gW(e.after,v),before:gW(e.before,v),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}))),k()}catch{t||C("hydrate-history")}}(),()=>{t=!0}},[v,e,C,b,k]),(0,L.useEffect)(()=>()=>{var e,r;e=g.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,L.useEffect)(()=>{var e,r,n,a,o;let i;a=g.current,e=b.view,r=b.comparison.result,n=b.history,i=new Set,"photo"in e&&gK(i,e.photo),"result"===e.stage&&(gq(i,e.result),e.resultHistory.forEach(e=>gq(i,e))),n.forEach(e=>gq(i,e)),gq(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,b.view,b.comparison.result,b.history]);let _=(0,L.useMemo)(()=>(function(e,{addToCart:t,choosePhoto:r,deleteResult:n,generate:a,runSessionCommand:o,saveResult:i,shareResult:s,sync:l}){let u=e.view;switch(u.stage){case"start":return{...u,choosePhoto:r,openHistory:()=>o(()=>e.openHistory())};case"intro":return{...u,continueIntro:()=>o(()=>e.continueIntro())};case"history":return{...u,chooseNew:r,selectResult:t=>o(()=>e.selectHistoryResult(t))};case"confirm":return{...u,changePhoto:r,generate:a};case"error":return{...u,chooseDifferentPhoto:r,retry:u.photo?a:r};case"result":return{...u,addToCart:t,changePhoto:()=>{e.closeMyFits(),l(),r()},deleteResult:n,openComparison:t=>o(()=>e.openComparison(t)),reset:()=>o(()=>e.reset()),saveResult:i,shareResult:s,toggleMyFits:()=>o(()=>e.toggleMyFits())};default:return u}})(b,{addToCart:N,choosePhoto:T,deleteResult:O,generate:()=>void R(),runSessionCommand:S,saveResult:j,shareResult:z,sync:k}),[N,T,O,R,S,j,b,z,k]);return{canGoBack:"start"!==(h=b.view.stage)&&"intro"!==h&&"processing"!==h&&"error"!==h&&"result"!==h,comparison:function(e,{addToCart:t,deleteResult:r,runSessionCommand:n,saveResult:a,shareResult:o}){let i=e.comparison;return{...i,addToCart:t,close:()=>n(()=>e.closeComparison()),deleteResult:()=>{let e=i.result?.id??i.result?.after.id;e&&r(e)},saveResult:()=>a(i.result?.id??i.result?.after.id),shareResult:()=>o(i.result?.id??i.result?.after.id)}}(b,{addToCart:N,deleteResult:O,runSessionCommand:S,saveResult:j,shareResult:z}),goBack:()=>S(()=>b.goBack()),requestClose:()=>S(()=>b.requestClose()),selectFile:e=>S(()=>{b.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>y.current?.click(),processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:w}),k=x.view.stage,S=r??x.requestClose,C="result"===x.view.stage&&x.view.myFitsOpen,[P,E]=(0,L.useState)(!1),[T,R]=(0,L.useState)(void 0),O=(0,L.useCallback)(()=>{"result"!==x.view.stage||(x.view.addToCart(),n&&(E(!0),R(void 0),Promise.resolve(n()).catch(e=>R(e instanceof Error&&e.message?e.message:v("externalServiceUnavailable"))).finally(()=>E(!1))))},[n,x.view,v]),j=x.canGoBack?(0,A.jsx)(gn,{label:v("back"),onClick:x.goBack}):null,z="result"===x.view.stage&&x.view.canOpenMyFits?(0,A.jsxs)(i4,{"aria-expanded":C,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:x.view.toggleMyFits,children:[v("myFits"),(0,A.jsx)(s0,{className:i2("!size-3 transition-transform",C&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,A.jsxs)(fU,{className:C?"h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":k,children:[(0,A.jsx)(fH,{badge:"history"===k||"ready"!==f.status?null:v(function(e){switch(e){case"intro":return"introBadge";case"confirm":return"confirmBadge";case"processing":return"processingBadge";case"error":return"errorBadge";case"result":return"resultBadge";default:return"badge"}}(k)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(k),closeLabel:v("close"),leftSlot:"ready"===f.status?j:null,middleSlot:"ready"===f.status?z:null,preferMiddleSlotFirst:"result"===k,showCloseButton:p,onClose:"ready"===f.status?x.requestClose:S}),(0,A.jsx)("input",{ref:y,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&x.selectFile(t),e.currentTarget.value=""}}),(0,A.jsxs)(fq,{children:["loading"===f.status?(0,A.jsx)(f4,{}):null,"unavailable"===f.status?(0,A.jsx)(f6,{temporary:f.temporary,onClose:S}):null,"error"===f.status?(0,A.jsx)(f8,{onClose:S,onRetry:g}):null,"ready"!==f.status?null:(0,A.jsxs)(A.Fragment,{children:["start"===x.view.stage?(0,A.jsx)(f2,{view:x.view}):null,"intro"===x.view.stage?(0,A.jsx)(f3,{view:x.view}):null,"history"===x.view.stage?(0,A.jsx)(f5,{view:x.view}):null,"confirm"===x.view.stage?(0,A.jsx)(f9,{view:x.view}):null,"processing"===x.view.stage?(0,A.jsx)(f7,{view:x.view}):null,"error"===x.view.stage?(0,A.jsx)(ge,{view:x.view,onClose:x.requestClose}):null,"result"===x.view.stage?(0,A.jsx)(gt,{view:x.view,showAddToCart:h,onAddToCart:n?O:void 0,addToCartPending:P,addToCartError:T}):null]})]},"ready"===f.status?k:`activation-${f.status}`),x.comparison.open&&(0,A.jsx)(fB,{productName:x.comparison.productName,productPrice:x.comparison.productPrice,productUrl:x.comparison.productUrl,portalContainer:e??void 0,result:x.comparison.result,addToCartPending:P,addToCartError:T,onAddToCart:h?n?O:x.comparison.addToCart:void 0,onClose:x.comparison.close,onDeleteResult:x.comparison.deleteResult,onSaveResult:x.comparison.saveResult,onShareResult:x.comparison.shareResult})]})}sS({baseURL:"https://api.neurodyn.ai/"});class gZ{createObjectUrl;operations;signal;session=null;constructor({createObjectUrl:e=g4,operations:t,signal:r}){this.createObjectUrl=e,this.operations=t,this.signal=r}async activate(e){var t,r;let n,a,o,i,s,l,u,{activation:c,session:d}=(a="string"==typeof(n=g5(t=await this.run(()=>this.operations.activate(e,this.baseConfig())))?t:{}).zoneType?n.zoneType:void 0,o=g9(n.photoUrl)||void 0,i=function(e){if(!g5(e))return null;let t=g9(e.token),r=g9(e.sid),n="number"==typeof e.expiresIn?e.expiresIn:NaN;return t&&r&&Number.isFinite(n)&&n>0?{expiresIn:n,sid:r,token:t}:null}(n.widgetSession),s=void 0!==o,u=(l=!0===n.available&&null!==i&&s)?void 0:("string"==typeof(r=n.unavailableReason)&&gJ.has(r)?r:void 0)??(!0!==n.available||s?void 0:"no_product_photo"),{activation:{available:l,photoUrl:o,reason:u,zoneType:sZ(a)?a:void 0},session:l?i:null});return d&&(this.session=sB(d,{apiConfig:this.baseConfig(),issueWidgetToken:this.operations.issueWidgetToken})),c}createProcessPhoto(e){return async(t,r)=>{let n;r?.reportProgress(4);let a=await gg(t);if(!a||a.size<=0)throw new gH("photo-required");r?.reportProgress(18);let[o]=gd(await this.run(async()=>this.operations.requestUploadUrls(1,await this.requestConfig())),1);r?.reportProgress(38);let i={signal:this.signal,timeoutMs:3e5};await this.run(()=>this.operations.uploadPhoto?this.operations.uploadPhoto(o.uploadUrl,a,i):gh(o.uploadUrl,a,i)),r?.reportProgress(58);let s=gv(r?.reportProgress);try{n=await this.run(async()=>this.operations.generate({...e,personImageKey:o.key},await this.requestConfig({responseType:"blob",timeout:9e4})))}finally{s()}let{blob:l,errorText:u}=await gu(n);if(!l)throw g0(u);r?.reportProgress(98);let c=this.createObjectUrl(l);if(!c)throw new gH("service");return{before:t,after:{blob:l,id:`${t.id}-shopify-result`,name:t.name?`${t.name} result`:"AI try-on result",size:l.size,src:c,type:l.type||"image/jpeg"}}}}async run(e){try{return await e()}catch(e){var t,r,n;if(e instanceof gH||(t=e,r=this.signal,r?.aborted===!0||"AbortError"===g1(t)||"ERR_CANCELED"===g2(t)))throw e;throw"TimeoutError"===g1(n=e)||"ECONNABORTED"===g2(n)||"ETIMEDOUT"===g2(n)?new gH("timeout"):g0(await g3(e))}}sendWidgetEvent(e){let t=this.operations.sendWidgetEvent;t&&this.requestConfig().then(r=>t({event:e,timestamp:new Date().toISOString()},r)).catch(()=>{})}async requestUploadUrls(){throw Error("Shopify generation handles its own uploads")}async generateTryOn(){throw Error("Shopify generation runs through its own processor")}baseConfig(){return{signal:this.signal,timeout:3e4}}async requestConfig(e={}){let t={...this.baseConfig(),...e};return this.session?this.session.getApiConfigForRequest(t):t}}let gJ=new Set(["not_enabled","zone_not_configured","no_product_photo","tokens_exhausted"]);function g0(e){if(!e)return new gH("service");try{let t=JSON.parse(e),r=g5(t)?t.code:void 0;if("tokens"===r||"product"===r||"timeout"===r||"service"===r)return new gH(r)}catch{}return new gH("service")}function g1(e){return g5(e)&&"string"==typeof e.name?e.name:""}function g2(e){return g5(e)&&"string"==typeof e.code?e.code:""}async function g3(e){let t=g5(e)?e.response:void 0,r=g5(t)?t.data:void 0;return r instanceof Blob?(await r.text().catch(()=>"")).slice(0,2e3)||null:"string"==typeof r?r.slice(0,2e3)||null:g5(r)?JSON.stringify(r).slice(0,2e3):null}function g5(e){return null!==e&&"object"==typeof e}function g9(e){return"string"==typeof e?e.trim():""}function g4(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}let g6={status:"loading"},g8={status:"ready"};function g7({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,apiKey:u,externalGeneration:c,externalActivation:d,externalAddToCart:p,externalClient:h,...f}){c||sJ(s);let g=(0,L.useMemo)(()=>{let e;return(e=rl.createInstance()).use(oo).use(rO).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sq}),e},[t]),[m,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(e),w=(0,L.useRef)(!1),x=void 0!==n,k=x?n:y,S=sL(u),C=(0,L.useMemo)(()=>c?h??sp:sW({apiKey:S}),[S,c,h]),[P,E]=(0,L.useState)(g6),[T,R]=(0,L.useState)(0),O=d?P:g8,j=(0,L.useRef)(d);function z(e){x||b(e),r?.(e)}return(0,L.useEffect)(()=>{j.current=d}),(0,L.useEffect)(()=>{let e=j.current;if(!e||(E(g6),!k))return;let t=!1;return e().then(e=>{t||E(e.enabled?{...e,status:"ready"}:{status:"unavailable",temporary:e.temporarilyUnavailable})}).catch(()=>{t||E({status:"error"})}),()=>{t=!0}},[T,k,!!d]),(0,L.useEffect)(()=>{if(!k){w.current=!1;return}"ready"!==O.status||w.current||(w.current=!0,C.sendWidgetEvent("widget_opened"))},[O.status,k,C]),(0,A.jsxs)(A.Fragment,{children:[(0,q.createPortal)((0,A.jsx)("style",{children:sd.A}),document.head),(0,q.createPortal)((0,A.jsxs)(rG.div,{className:"fixed inset-x-0 bottom-0 w-svw tracking-normal sm:inset-x-auto sm:right-4 sm:bottom-4 sm:w-120",style:{zIndex:0x7fffffff},children:[(0,A.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,A.jsx)("style",{children:sX}),(0,A.jsx)("div",{ref:v}),m&&(0,A.jsx)(sc,{defaultTheme:"light",root:m,storageKey:"neurodyn-ai-try-on-theme",children:(0,A.jsx)(rR,{i18n:g,children:(0,A.jsx)(me,{language:t,open:k,portalContainer:m,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,tryOnClient:C,externalGeneration:c,externalAddToCart:p,activation:O,onRetryActivation:()=>R(e=>e+1),onRequestClose:()=>z(!1),onOpenChange:z,...f})})})]}),document.body)]})}function me({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productPrice:o,productType:i,productUrl:s,tryOnClient:l,externalGeneration:u,externalAddToCart:c,activation:d,onRetryActivation:p,...h}){let{t:f}=rT();return(0,A.jsx)(sr,{...h,children:(0,A.jsxs)(so,{className:"inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:f("dialogTitle")}),(0,A.jsx)(sl,{children:f("dialogDescription")})]}),(0,A.jsx)(gQ,{dialogPortalContainer:r,language:e,productImageSrc:"ready"===d.status&&d.productImageSrc||n,productName:a,productPrice:o,productType:"ready"===d.status?d.productType??i:i,productUrl:s,tryOnClient:l,processPhoto:u,activation:d,onRetryActivation:p,onAddToCart:c,showAddToCart:!u||!!c,showDialogCloseButton:!0,onClose:t})]})})}var mt=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");class mr extends Error{constructor(e){super(e),this.name="ShopifyCartError"}}async function mn(e,{signal:t,win:r=window}={}){let n=await r.fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:e,quantity:1}]}),signal:t});if(!n.ok)throw new mr(await ma(n));var a=r;for(let e of["cart:refresh","cart:update"])a.document.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:{source:"vizbl-try-on"}}))}async function ma(e){try{let t=await e.json(),r="string"==typeof t.description?t.description.trim():"",n="string"==typeof t.message?t.message.trim():"";return r||n||""}catch{return""}}let mo=new WeakMap;window.VizblShopifyTryOn?.destroy();let mi=null;function ms(e=document,t){return mi=function(e=document,t={}){let r,a=mo.get(e);if(a)return a.configure(t),a;let o={...t},i=e.createElement("div");i.dataset.vizblTryOnDialog="",e.body.append(i);let s=(0,mt.createRoot)(i),l=null,u=null,c=!1,d=0,p=()=>{r.disconnect(),u?.abort(),u=null,l=null,s.render(null)},h=t=>{let a=t.target instanceof Element?t.target.closest("[data-vizbl-try-on]"):null;if(!a||"true"===a.getAttribute("aria-disabled")||a instanceof HTMLButtonElement&&a.disabled)return;let i=a.dataset.productId;if(!i||(t.preventDefault(),l===a))return;p(),l=a,r.observe(e.body,{childList:!0,subtree:!0});let c=new AbortController;u=c;let h=a.dataset.language?.toLowerCase().split(/[-_]/)[0],f=()=>o.operations??(n??=function(e){let t,r=e.trim().replace(/\/+$/,"");if(!r)return;let n=(t=aN.create({baseURL:r,timeout:3e4}),async function(e){let r=await t.request(e);return{data:r.data,headers:r.headers,status:r.status,statusText:r.statusText}});return{activate:({productId:e,variantId:t},r)=>sR({product_id:e,variant_id:t,productType:"ai-try-on-shopify"},{...r,client:n}),generate:(e,t)=>sj(e,{...t,client:n}),issueWidgetToken:(e,t)=>sN(e,{...t,client:n}),requestUploadUrls:(e,t)=>sO({count:e},{...t,client:n}),sendWidgetEvent:(e,t)=>s_(e,{...t,client:n})}}("/apps/vizbl-ai-try-on")),g=()=>{let e=f();if(!e)throw new gH("service");return e},m=new gZ({operations:{activate:(e,t)=>g().activate(e,t),requestUploadUrls:(e,t)=>g().requestUploadUrls(e,t),generate:(e,t)=>g().generate(e,t),issueWidgetToken:(e,t)=>g().issueWidgetToken(e,t),uploadPhoto:(e,t,r)=>(f()?.uploadPhoto??gh)(e,t,r),sendWidgetEvent:(e,t)=>f()?.sendWidgetEvent?.(e,t)??Promise.resolve()},signal:c.signal}),v={productId:i,variantId:function(e,t=document){let r=t.defaultView?.location?.search??"",n=new URLSearchParams(r).get("variant")?.trim();if(n)return n;let a=t.querySelector('form[action*="/cart/add"] [name="id"]:checked, form[action*="/cart/add"] select[name="id"], form[action*="/cart/add"] input[name="id"]'),o=a?.value?.trim();return o||e.getAttribute("data-variant-id")?.trim()||void 0}(a,e)},y=m.createProcessPhoto(v),b=!1,w=async()=>{if(!f())return{enabled:!1};let{available:e,photoUrl:t,reason:r,zoneType:n}=await m.activate(v);return{enabled:e,productImageSrc:t,productType:n,temporarilyUnavailable:"tokens_exhausted"===r}},x=async(e,t)=>{if(b||c.signal.aborted)throw new gH("service");b=!0;try{let n=await y(e,t);if(c.signal.aborted){var r;throw r=n.after.src,r?.startsWith("blob:")&&"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(r),new DOMException("Generation was aborted","AbortError")}return n}catch(e){if(e instanceof gH||c.signal.aborted)throw e;throw new gH("service")}finally{b=!1}},k=v.variantId?()=>mn(v.variantId,{signal:c.signal}):void 0;s.render((0,L.createElement)(g7,{key:++d,open:!0,language:void 0===h?void 0:"ru"===h?"ru":"en",productName:a.dataset.productName??"",productImageSrc:a.dataset.productImage??"",productPrice:function(e,t){let r=e.getAttribute("data-product-price")?.trim()||void 0;if(!t)return r;let n=e.closest("[data-vizbl-try-on-block]")?.querySelector("[data-vizbl-try-on-variants]")?.textContent;if(!n)return r;try{let e=JSON.parse(n),a=e[t]?.price;return"string"==typeof a&&a.trim()||r}catch{return r}}(a,v.variantId),productUrl:a.dataset.productUrl,externalActivation:w,externalAddToCart:k,externalGeneration:x,externalClient:m,onOpenChange:e=>!e&&p()}))},f=e=>{e.target instanceof Element&&l&&e.target.contains(l)&&p()};e.addEventListener("click",h),e.addEventListener("shopify:section:unload",f),r=new MutationObserver(()=>{l&&!l.isConnected&&p()});let g={configure(e){c||(o={...o,...e})},destroy(){c||(c=!0,u?.abort(),e.removeEventListener("click",h),e.removeEventListener("shopify:section:unload",f),r.disconnect(),mo.delete(e),queueMicrotask(()=>{s.unmount(),i.remove()}))}};return mo.set(e,g),g}(e,t)}window.VizblShopifyTryOn={ShopifyGenerationError:gH,mount:ms,configure:e=>void ms(document,e),destroy:()=>{mi?.destroy(),mi=null}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>ms(),{once:!0}):ms()})()})();
|
|
5509
|
+
Defaulting to \`null\`.`));let c=fC(o,u)?o:null,d=fk(c)?s(c,u):void 0;return(0,A.jsx)(fg,{scope:a,value:c,max:u,children:(0,A.jsx)(fd.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fk(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fx(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});fv.displayName=fp;var fy="ProgressIndicator",fb=L.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=fm(fy,r);return(0,A.jsx)(fd.div,{"data-state":fx(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fw(e,t){return`${Math.round(e/t*100)}%`}function fx(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fk(e){return"number"==typeof e}function fS(e){return fk(e)&&!isNaN(e)&&e>0}function fC(e,t){return fk(e)&&!isNaN(e)&&e<=t&&e>=0}function fP({className:e,value:t,max:r=100,...n}){let a=r>0?r:100,o="number"==typeof t?Math.min(Math.max(t/a*100,0),100):0;return(0,A.jsx)(fv,{"data-slot":"progress",className:i2("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),value:t,max:a,...n,children:(0,A.jsx)(fb,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fE(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...e,children:(0,A.jsx)("path",{d:"M8.21723 14.9975C8.10298 14.997 7.99004 14.9731 7.8854 14.9272C7.78077 14.8814 7.68665 14.8145 7.60889 14.7308L3.55889 10.4225C3.4075 10.2611 3.3264 10.0463 3.33343 9.82513C3.34046 9.604 3.43505 9.39471 3.59639 9.24332C3.75773 9.09192 3.97261 9.01082 4.19374 9.01785C4.41488 9.02489 4.62417 9.11948 4.77556 9.28082L8.20889 12.9392L15.2172 5.27248C15.2883 5.18392 15.3768 5.11083 15.4772 5.0577C15.5776 5.00458 15.6878 4.97254 15.8011 4.96355C15.9143 4.95456 16.0282 4.96882 16.1357 5.00544C16.2432 5.04207 16.3421 5.10029 16.4263 5.17652C16.5105 5.25276 16.5782 5.3454 16.6253 5.44877C16.6724 5.55213 16.6979 5.66403 16.7001 5.7776C16.7024 5.89116 16.6815 6.00399 16.6385 6.10916C16.5956 6.21433 16.5316 6.30961 16.4506 6.38915L8.83389 14.7225C8.75686 14.8077 8.66308 14.8761 8.55841 14.9234C8.45373 14.9707 8.34042 14.996 8.22556 14.9975H8.21723Z",fill:"currentColor"})})}function fT(e){return(0,A.jsxs)("svg",{fill:"none",viewBox:"0 0 19.9993 19.9996",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,A.jsx)("path",{d:"M16 9C16 7.14348 15.2629 5.36256 13.9502 4.0498C12.6374 2.73705 10.8565 2 9 2C7.14348 2 5.36256 2.73705 4.0498 4.0498C2.73705 5.36256 2 7.14348 2 9C2 10.8565 2.73705 12.6374 4.0498 13.9502C5.36256 15.2629 7.14348 16 9 16C10.8565 16 12.6374 15.2629 13.9502 13.9502C15.2629 12.6374 16 10.8565 16 9ZM18 9C18 11.3869 17.0521 13.6764 15.3643 15.3643C13.6764 17.0521 11.3869 18 9 18C6.61305 18 4.32357 17.0521 2.63574 15.3643C0.947915 13.6764 0 11.3869 0 9C0 6.61305 0.947915 4.32357 2.63574 2.63574C4.32357 0.947915 6.61305 0 9 0C11.3869 0 13.6764 0.947915 15.3643 2.63574C17.0521 4.32357 18 6.61305 18 9Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M13.9428 13.943C14.3333 13.5525 14.9663 13.5525 15.3568 13.943L19.7064 18.2926C20.097 18.6832 20.097 19.3162 19.7064 19.7067C19.3159 20.0972 18.6829 20.0972 18.2924 19.7067L13.9428 15.3571C13.5522 14.9666 13.5522 14.3335 13.9428 13.943Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 12.0001V6.00008C7.99983 5.4478 8.44755 5.00008 8.99983 5.00008C9.55211 5.00008 9.99983 5.4478 9.99983 6.00008V12.0001C9.99983 12.5524 9.55211 13.0001 8.99983 13.0001C8.44755 13.0001 7.99983 12.5524 7.99983 12.0001Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M11.9998 8.00008C12.5521 8.00008 12.9998 8.4478 12.9998 9.00008C12.9998 9.55237 12.5521 10.0001 11.9998 10.0001H5.99983C5.44755 10.0001 4.99983 9.55237 4.99983 9.00008C4.99983 8.4478 5.44755 8.00008 5.99983 8.00008H11.9998Z",fill:"currentColor"})]})}function fR(e){return t=>{let r=t.currentTarget;e&&r.getAttribute("src")!==e&&(r.src=e)}}function fO({children:e,className:t,...r}){return(0,A.jsx)("div",{className:i2("relative h-82 w-full overflow-hidden rounded-xl bg-background-base sm:h-100",t),...r,children:e})}function fj({className:e,src:t}){return(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:t}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"})]})}function fz({backdropClassName:e,className:t,fallbackSrc:r,imageClassName:n,photo:a}){let o=a?.src??r,i=fR(r);return(0,A.jsxs)(A.Fragment,{children:[o&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",t,e),src:o,onError:i}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/5"}),o&&(0,A.jsx)("img",{alt:a?.name??"",className:i2("absolute inset-0 size-full object-contain",t,n),src:o,onError:i})]})}function fN({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return(0,A.jsxs)(A.Fragment,{children:[n&&(0,A.jsx)("img",{"aria-hidden":"true",className:i2("absolute inset-0 size-full scale-125 object-cover blur-3xl",e),src:n,onError:fR(t)}),(0,A.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-background-dark/20"})]})}function f_({className:e,...t}){let r=(0,L.useId)().replace(/:/g,""),n=`${r}-loading-texture-gradient`,a=`${r}-loading-texture-pattern`,o=`${r}-loading-texture-mask`;return(0,A.jsxs)("svg",{className:i2("text-constant-white",e),fill:"none",focusable:"false",viewBox:"0 0 776 992",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,A.jsxs)("defs",{children:[(0,A.jsxs)("radialGradient",{id:n,cx:"0",cy:"0",gradientTransform:"translate(388 496) rotate(90) scale(1021)",gradientUnits:"userSpaceOnUse",r:"1",children:[(0,A.jsx)("stop",{stopColor:"currentColor",stopOpacity:"0.7"}),(0,A.jsx)("stop",{offset:"0.586538",stopColor:"currentColor",stopOpacity:"0"})]}),(0,A.jsx)("pattern",{id:a,width:"24",height:"24",patternUnits:"userSpaceOnUse",children:(0,A.jsx)("circle",{cx:"4",cy:"4",r:"4",fill:"currentColor"})}),(0,A.jsx)("mask",{id:o,children:(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${a})`})})]}),(0,A.jsx)("rect",{width:"776",height:"992",fill:`url(#${n})`,mask:`url(#${o})`})]})}function fA({animated:e=!1,className:t,...r}){return(0,A.jsxs)("div",{"aria-hidden":"true",className:i2("absolute h-133 w-104 max-w-none",t),...r,children:[!e&&(0,A.jsx)(f_,{className:"absolute inset-0 size-full opacity-30"}),e&&(0,A.jsx)("span",{className:"absolute inset-0 [mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [mask-position:center] [mask-repeat:no-repeat] [mask-size:18%_18%] [-webkit-mask-image:radial-gradient(circle,var(--v-constant-black)_0_36%,transparent_82%)] [-webkit-mask-position:center] [-webkit-mask-repeat:no-repeat] [-webkit-mask-size:18%_18%] animate-[ai-try-on-loading-texture-pulse_2.6s_linear_infinite] motion-reduce:animate-none motion-reduce:[mask-size:220%_220%] motion-reduce:[-webkit-mask-size:220%_220%]",children:(0,A.jsx)(f_,{className:"absolute inset-0 size-full opacity-70"})})]})}function fL({badge:e,className:t,fallbackSrc:r,photo:n,selected:a,...o}){return(0,A.jsxs)("button",{className:i2("group relative aspect-square w-full overflow-hidden rounded-xl bg-background-base-2 text-left ring-offset-2 transition","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground",a?"ring-2 ring-foreground":null,t),type:"button",...o,children:[n?.src?(0,A.jsx)("img",{alt:n.name??"",className:"size-full object-cover",src:n.src}):r?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:r}):null,a&&(0,A.jsx)("span",{className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full bg-foreground text-background-containers",children:(0,A.jsx)(fE,{className:"size-4"})}),e&&(0,A.jsx)("span",{className:"absolute right-2 top-2",children:e})]})}function fI({className:e,label:t,progress:r=0,...n}){let a=Math.min(Math.max(r,0),100);return(0,A.jsxs)("div",{className:i2("rounded-xl bg-background-base px-6 py-8",e),...n,children:[(0,A.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm font-medium text-text-sub",children:[(0,A.jsx)("span",{children:t}),(0,A.jsxs)("span",{children:[Math.round(a),"%"]})]}),(0,A.jsx)(fP,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fM({className:e,fallbackSrc:t,photo:r}){let n=r?.src??t;return n?(0,A.jsx)("img",{alt:r?.name??"",className:i2("absolute left-1/2 top-0 h-full w-69 -translate-x-1/2 object-cover",e),src:n,onError:fR(t)}):null}function fF({className:e,imageSrc:t,name:r}){return t?(0,A.jsx)("img",{alt:r??"",className:i2("absolute bottom-2 left-2 h-30 w-auto rounded-xl border border-background-containers bg-background-containers object-contain shadow-md",e),src:t}):null}function fD({good:e,imageSrc:t,label:r}){return(0,A.jsxs)("figure",{className:"flex min-w-0 flex-col items-start gap-2",children:[(0,A.jsxs)("div",{className:"relative aspect-square w-full overflow-hidden rounded-xl border border-border-light bg-background-base",children:[(0,A.jsx)("img",{alt:r,className:"size-full object-cover",src:t}),(0,A.jsx)("span",{className:i2("absolute right-2 top-2 flex size-7 items-center justify-center rounded-full",e?"bg-background-green":"bg-background-red"),children:e?(0,A.jsx)(fE,{className:"size-5 text-background-containers"}):(0,A.jsx)(fa,{className:"size-5 text-background-containers"})})]}),(0,A.jsx)("figcaption",{className:"w-[90%] break-words text-xs font-medium leading-[1.6] tracking-[0.02em] text-text-base",children:r})]})}function fB({className:e,onOpenComparison:t,productLabel:r,productUrl:n,result:a,zoomLabel:o}){let i="inline-flex h-8 min-w-0 max-w-52 flex-1 items-center justify-center gap-1.5 rounded-xl bg-button-light px-3 text-xs font-semibold text-text-dark";return(0,A.jsxs)(fO,{"aria-label":o,className:i2("block cursor-pointer text-left",e),role:"button",tabIndex:0,onClick:t,onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},children:[(0,A.jsx)(fz,{photo:a?.after}),(0,A.jsxs)("div",{className:"absolute bottom-2 left-2 right-2 flex items-center justify-between gap-2",children:[n?(0,A.jsxs)("a",{className:i,href:n,onClick:e=>e.stopPropagation(),children:[(0,A.jsx)(fs,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}):(0,A.jsxs)("span",{className:i,children:[(0,A.jsx)(fs,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}),(0,A.jsx)("button",{"aria-label":o,className:"inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-button-light text-text-dark",type:"button",onClick:e=>{e.stopPropagation(),t()},children:(0,A.jsx)(fT,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function f$({addToCartError:e,addToCartPending:t=!1,onAddToCart:r,onClose:n,onDeleteResult:a,onSaveResult:o,onShareResult:i,portalContainer:s,productName:l,productPrice:u,productUrl:c,result:d}){var p;let{t:h}=rT(),f=l??h("resultProductLink"),g=(p=u,p?.trim()||void 0),m=g?h("resultTryAnotherWithPrice",{price:g}):h("resultTryAnother");return(0,A.jsx)(sr,{open:!0,onOpenChange:e=>!e&&n(),children:(0,A.jsxs)(so,{className:"dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none bg-[#212124E5] p-0 text-text-dark duration-200 sm:max-w-none sm:p-0",portalContainer:s,showCloseButton:!1,children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:h("comparisonTitle")}),(0,A.jsx)(sl,{children:h("comparisonSlider")})]}),(0,A.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[c?(0,A.jsx)(i4,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,A.jsxs)("a",{href:c,children:[(0,A.jsx)(fs,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]})}):(0,A.jsxs)(i4,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,A.jsx)(fs,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":h("close"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,A.jsx)(fa,{className:"!size-3","data-icon":"inline-start"})})]}),(0,A.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center px-8",children:(0,A.jsxs)(fe,{"aria-label":h("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,A.jsx)(ft,{position:"right",children:(0,A.jsx)(fM,{className:"w-full object-contain",photo:d?.after})}),(0,A.jsx)(ft,{position:"left",children:(0,A.jsx)(fM,{className:"w-full object-contain",photo:d?.before})}),(0,A.jsxs)(fr,{className:"w-11",children:[(0,A.jsx)("div",{className:"absolute left-1/2 h-full w-0.5 -translate-x-1/2 bg-constant-white"}),(0,A.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-constant-white text-constant-black shadow-lg",children:(0,A.jsx)("span",{className:"h-5 w-0.5 rounded-full bg-current"})})]})]})}),(0,A.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1 px-8 pb-6 pt-3",children:[e&&(0,A.jsx)("p",{className:"text-xs text-text-sub",role:"alert",children:e}),(0,A.jsxs)("div",{className:"flex h-23 w-full max-w-104 items-start gap-2",children:[r&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:t,size:"lg",type:"button",variant:"contrast",onClick:r,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:m})]}),(0,A.jsx)(i4,{"aria-label":h("share"),size:"icon-lg",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fl,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("download"),size:"icon-lg",type:"button",variant:"outline",onClick:o,children:(0,A.jsx)(fo,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":h("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){a()},children:(0,A.jsx)(fi,{"data-icon":"inline-start"})})]})]})]})})}fb.displayName=fy;let fV=i5("inline-flex w-fit items-center justify-center overflow-hidden rounded-full whitespace-nowrap",{variants:{variant:{default:"bg-contrast text-contrast-foreground",secondary:"bg-[var(--color-background-gray-transparent)] text-text-base",positive:"bg-[var(--color-background-green-transparent)] text-text-green",negative:"bg-[var(--color-background-red-transparent)] text-text-red",standard:"bg-[var(--color-background-blue-transparent)] text-text-blue"},size:{sm:"h-6 px-2 typo-button-small",md:"h-[30px] px-3 typo-button-normal"}},defaultVariants:{variant:"default",size:"sm"}});function fU({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,A.jsx)(n?o0:"span",{"data-slot":"badge",className:i2(fV({variant:t,size:r,className:e})),...a})}function fH({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl",e),...t})}function fW({badge:e,badgeTone:t="gray",className:r,closeLabel:n,leftSlot:a,middleSlot:o,onClose:i,preferMiddleSlotFirst:s=!1,showCloseButton:l=!1,...u}){let c=e?(0,A.jsx)(fq,{tone:t,children:e}):null;return(0,A.jsxs)("div",{className:i2("flex h-17 items-center justify-between p-4",r),...u,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[a,s?o:c,s?c:o]}),l&&(0,A.jsx)(i4,{"aria-label":n,size:"icon",type:"button",variant:"outline",onClick:i,children:(0,A.jsx)(fa,{"data-icon":"inline-start"})})]})}function fq({className:e,tone:t="gray",...r}){return(0,A.jsx)(fU,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fK({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex min-h-0 flex-1 flex-col animate-in fade-in-0 duration-100 motion-reduce:animate-none",e),...t})}function fG(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{d:"M21.1667 8.4C21.1667 8.16131 21.07 7.93245 20.8981 7.76367C20.7262 7.59489 20.4931 7.5 20.25 7.5H16.5833C16.2768 7.5 15.9906 7.3496 15.8206 7.09922L14.2594 4.8H9.74056L8.17936 7.09922C8.00935 7.3496 7.72316 7.5 7.41667 7.5H3.75C3.50688 7.5 3.2738 7.59489 3.10189 7.76367C2.92998 7.93245 2.83333 8.16131 2.83333 8.4V18.3C2.83333 18.5387 2.92998 18.7675 3.10189 18.9363C3.2738 19.1051 3.50689 19.2 3.75 19.2H20.25C20.4931 19.2 20.7262 19.1051 20.8981 18.9363C21.07 18.7675 21.1667 18.5387 21.1667 18.3V8.4ZM14.75 12.9C14.75 12.184 14.46 11.4973 13.9443 10.991C13.4287 10.4847 12.7292 10.2001 12 10.2C11.2707 10.2 10.5705 10.4847 10.0548 10.991C9.53923 11.4973 9.25 12.1841 9.25 12.9C9.25 13.6159 9.53923 14.3027 10.0548 14.809C10.5705 15.3153 11.2707 15.6 12 15.6C12.7292 15.5999 13.4287 15.3153 13.9443 14.809C14.46 14.3027 14.75 13.616 14.75 12.9ZM16.5833 12.9C16.5833 14.0934 16.1 15.2377 15.2406 16.0816C14.3811 16.9255 13.2155 17.3999 12 17.4C10.7844 17.4 9.61809 16.9256 8.75854 16.0816C7.89919 15.2378 7.41667 14.0933 7.41667 12.9C7.41667 11.7067 7.89919 10.5622 8.75854 9.71836C9.61809 8.87445 10.7844 8.4 12 8.4C13.2155 8.40008 14.3811 8.87452 15.2406 9.71836C16.1 10.5623 16.5833 11.7066 16.5833 12.9ZM23 18.3C23 19.0161 22.7101 19.7026 22.1943 20.209C21.6786 20.7153 20.9793 21 20.25 21H3.75C3.02065 21 2.32139 20.7153 1.80566 20.209C1.28994 19.7026 1 19.0161 1 18.3V8.4C1 7.68392 1.28994 6.99736 1.80566 6.49102C2.32139 5.98467 3.02065 5.7 3.75 5.7H6.92611L8.4873 3.40078L8.55623 3.31201C8.72911 3.11535 8.98172 3 9.25 3H14.75L14.8637 3.00703C15.1262 3.03922 15.3639 3.18167 15.5127 3.40078L17.0739 5.7H20.25C20.9793 5.7 21.6786 5.98467 22.1943 6.49102C22.7101 6.99736 23 7.68392 23 8.4V18.3Z",fill:"currentColor"})})}function fX(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 5.00342 8.37303",fill:"none",...e,children:(0,A.jsx)("path",{d:"M1 1L4.00342 4.18652L1 7.37303",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fY(e){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:[(0,A.jsx)("path",{d:"M18 3H6C5.20435 3 4.44129 3.31607 3.87868 3.87868C3.31607 4.44129 3 5.20435 3 6V18C3 18.7956 3.31607 19.5587 3.87868 20.1213C4.44129 20.6839 5.20435 21 6 21H18C18.7956 21 19.5587 20.6839 20.1213 20.1213C20.6839 19.5587 21 18.7956 21 18V6C21 5.20435 20.6839 4.44129 20.1213 3.87868C19.5587 3.31607 18.7956 3 18 3ZM6 5H18C18.2652 5 18.5196 5.10536 18.7071 5.29289C18.8946 5.48043 19 5.73478 19 6V14.36L15.8 11.63C15.3042 11.222 14.6821 10.999 14.04 10.999C13.3979 10.999 12.7758 11.222 12.28 11.63L5 17.7V6C5 5.73478 5.10536 5.48043 5.29289 5.29289C5.48043 5.10536 5.73478 5 6 5ZM18 19H6.56L13.56 13.16C13.6945 13.0602 13.8575 13.0062 14.025 13.0062C14.1925 13.0062 14.3555 13.0602 14.49 13.16L19 17V18C19 18.2652 18.8946 18.5196 18.7071 18.7071C18.5196 18.8946 18.2652 19 18 19Z",fill:"currentColor"}),(0,A.jsx)("path",{d:"M7.99983 9.99992C8.39766 9.99992 8.77919 9.84188 9.06049 9.56058C9.34179 9.27927 9.49983 8.89774 9.49983 8.49992C9.49983 8.10209 9.34179 7.72056 9.06049 7.43925C8.77919 7.15795 8.39766 6.99992 7.99983 6.99992C7.60201 6.99992 7.22047 7.15795 6.93917 7.43925C6.65787 7.72056 6.49983 8.10209 6.49983 8.49992C6.49983 8.89774 6.65787 9.27927 6.93917 9.56058C7.22047 9.84188 7.60201 9.99992 7.99983 9.99992Z",fill:"currentColor"})]})}function fQ(e){return(0,A.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",...e,children:(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 3C18.7956 3 19.5585 3.3163 20.1211 3.87891C20.6837 4.44152 21 5.20435 21 6V18C21 18.7956 20.6837 19.5585 20.1211 20.1211C19.5585 20.6837 18.7956 21 18 21H6C5.20435 21 4.44152 20.6837 3.87891 20.1211C3.3163 19.5585 3 18.7956 3 18V6C3 5.20435 3.3163 4.44152 3.87891 3.87891C4.44152 3.3163 5.20435 3 6 3H18ZM14.0352 12C13.8633 12 13.6974 12.0639 13.5703 12.1797L6 19H18C18.2876 18.977 18.5547 18.8414 18.7422 18.6221C18.9296 18.4028 19.0221 18.1177 19 17.8301V16.6602L14.5 12.1797C14.3729 12.0639 14.2071 12 14.0352 12ZM8 7C7.60218 7 7.22076 7.15815 6.93945 7.43945C6.65815 7.72076 6.5 8.10218 6.5 8.5C6.5 8.89782 6.65815 9.27924 6.93945 9.56055C7.22076 9.84185 7.60218 10 8 10C8.39782 10 8.77924 9.84185 9.06055 9.56055C9.34185 9.27924 9.5 8.89782 9.5 8.5C9.5 8.10218 9.34185 7.72076 9.06055 7.43945C8.77924 7.15815 8.39782 7 8 7Z",fill:"currentColor"})})}function fZ(e){return(0,A.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,A.jsx)("path",{d:"M6.05944 11.1406C6.47507 8.23438 8.97819 6 12.0001 6C13.6563 6 15.1563 6.67187 16.2438 7.75625L16.2626 7.775L16.5001 8H15.0032C14.4501 8 14.0032 8.44687 14.0032 9C14.0032 9.55313 14.4501 10 15.0032 10H19.0032C19.5563 10 20.0032 9.55313 20.0032 9V5C20.0032 4.44688 19.5563 4 19.0032 4C18.4501 4 18.0032 4.44688 18.0032 5V6.66875L17.6501 6.33437C16.2032 4.89375 14.2032 4 12.0001 4C7.96882 4 4.63444 6.98125 4.08132 10.8594C4.00319 11.4062 4.38132 11.9125 4.92819 11.9906C5.47507 12.0688 5.98132 11.6875 6.05944 11.1438V11.1406ZM19.9188 13.1406C19.9969 12.5938 19.6157 12.0875 19.0719 12.0094C18.5282 11.9312 18.0188 12.3125 17.9407 12.8562C17.5251 15.7625 15.0219 17.9969 12.0001 17.9969C10.3438 17.9969 8.84382 17.325 7.75632 16.2406L7.73757 16.2219L7.50007 15.9969H8.99694C9.55007 15.9969 9.99694 15.55 9.99694 14.9969C9.99694 14.4437 9.55007 13.9969 8.99694 13.9969L5.00007 14C4.73444 14 4.47819 14.1063 4.29069 14.2969C4.10319 14.4875 3.99694 14.7406 4.00007 15.0094L4.03132 18.9781C4.03444 19.5312 4.48757 19.975 5.04069 19.9688C5.59382 19.9625 6.03757 19.5125 6.03132 18.9594L6.01882 17.35L6.35319 17.6656C7.80007 19.1062 9.79694 20 12.0001 20C16.0313 20 19.3657 17.0187 19.9188 13.1406Z",fill:"currentColor"})})}function fJ({className:e,...t}){return(0,A.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:i2("size-6",e),...t,children:[(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0625 1.70412C12.1393 1.70359 12.2136 1.7151 12.2842 1.73439C12.6576 1.76978 13.0261 1.88527 13.3604 2.08303L19.7012 5.84084L19.7031 5.84181C20.1036 6.08032 20.4348 6.42322 20.665 6.83498C20.8952 7.24671 21.0168 7.71415 21.0166 8.19142V8.19338L20.998 15.7403C20.9979 16.1352 20.9124 16.526 20.751 16.8848C20.7319 16.9557 20.7049 17.026 20.667 17.0928C20.6355 17.1482 20.5983 17.1987 20.5576 17.2442C20.3296 17.6 20.023 17.8979 19.6631 18.1133L13.2998 21.9072C12.4738 22.3996 11.4611 22.4004 10.6436 21.917L10.6416 21.916L4.30078 18.1582L4.29883 18.1572C3.91023 17.9258 3.58764 17.5957 3.3584 17.2002C3.35105 17.1885 3.34181 17.1773 3.33496 17.1651C3.32803 17.1526 3.32268 17.1387 3.31641 17.126C3.09976 16.7236 2.98517 16.2703 2.98535 15.8076V15.8057L3.00391 8.25588C3.00603 7.28279 3.51293 6.37777 4.33984 5.88478L10.7021 2.09181C11.0682 1.87369 11.4708 1.75231 11.877 1.72658C11.9365 1.71245 11.999 1.70462 12.0625 1.70412ZM5.16895 7.36818C4.87108 7.54583 4.6844 7.87497 4.68359 8.23635L4.66602 15.3838L9.45801 12.5254C9.51085 12.7718 9.60256 13.0142 9.73535 13.2442C9.90127 13.5315 10.1161 13.7727 10.3633 13.9639L5.49512 16.8662L11.499 20.4248C11.8036 20.6044 12.1738 20.6008 12.4707 20.4238L18.5107 16.8233L13.4971 13.877C13.9543 13.482 14.2391 12.9423 14.3242 12.3672L19.3193 15.3037L19.3379 8.21291L19.3369 8.21388C19.3369 8.03517 19.2923 7.85955 19.2061 7.7051C19.1196 7.55056 18.9947 7.42151 18.8447 7.33205L12.8887 3.80275L12.8535 9.73439C12.3304 9.51037 11.7366 9.46806 11.1738 9.63576L11.21 3.76662L5.16895 7.36818Z",fill:"currentColor"}),(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.91641 8.60885C11.7928 7.52595 14.1912 8.16845 15.2748 10.0444C16.3582 11.9209 15.7156 14.3211 13.8393 15.4047C11.9627 16.4879 9.56339 15.8446 8.47989 13.9682C7.39671 12.0916 8.03987 9.69227 9.91641 8.60885ZM13.8031 10.894C13.189 9.83118 11.8293 9.46704 10.766 10.0805C9.7026 10.6945 9.33693 12.0551 9.95059 13.1186C10.5646 14.1821 11.9261 14.5469 12.9897 13.9331C14.0529 13.3189 14.4171 11.9575 13.8031 10.894Z",fill:"currentColor"})]})}let f0={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},f1={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},f2={bag:{cards:[{good:!0,imageSrc:ou,labelKey:"bagIntroGoodFullBody"},{good:!0,imageSrc:ol,labelKey:"bagIntroGoodAngle"},{good:!1,imageSrc:os,labelKey:"bagIntroBadHandsFull"},{good:!1,imageSrc:oi,labelKey:"bagIntroBadCropped"}],subtitleKey:"bagIntroSubtitle",titleKey:"bagIntroTitle"},eyewear:{cards:[{good:!0,imageSrc:op,labelKey:"eyewearIntroGoodFacingCamera"},{good:!0,imageSrc:oh,labelKey:"eyewearIntroGoodHairBack"},{good:!1,imageSrc:od,labelKey:"eyewearIntroBadWearingGlasses"},{good:!1,imageSrc:oc,labelKey:"eyewearIntroBadFaceTurned"}],subtitleKey:"eyewearIntroSubtitle",titleKey:"eyewearIntroTitle"},footwear:{cards:[{good:!0,imageSrc:ov,labelKey:"footwearIntroGoodStanding"},{good:!0,imageSrc:om,labelKey:"footwearIntroGoodKneesDown"},{good:!1,imageSrc:og,labelKey:"footwearIntroBadOneFootCropped"},{good:!1,imageSrc:of,labelKey:"footwearIntroBadFeetHidden"}],subtitleKey:"footwearIntroSubtitle",titleKey:"footwearIntroTitle"},"full-body":{cards:[{good:!0,imageSrc:ox,labelKey:"fullBodyIntroGoodHeadToToe"},{good:!0,imageSrc:ow,labelKey:"fullBodyIntroGoodAngle"},{good:!1,imageSrc:oy,labelKey:"fullBodyIntroBadCropped"},{good:!1,imageSrc:ob,labelKey:"fullBodyIntroBadSitting"}],subtitleKey:"fullBodyIntroSubtitle",titleKey:"fullBodyIntroTitle"},headwear:{cards:[{good:!0,imageSrc:oP,labelKey:"headwearIntroGoodFront"},{good:!0,imageSrc:oC,labelKey:"headwearIntroGoodAngle"},{good:!1,imageSrc:oS,labelKey:"headwearIntroBadWearingHat"},{good:!1,imageSrc:ok,labelKey:"headwearIntroBadCroppedHead"}],subtitleKey:"headwearIntroSubtitle",titleKey:"headwearIntroTitle"},"lower-body":{cards:[{good:!0,imageSrc:oO,labelKey:"lowerBodyIntroGoodWaistToFeet"},{good:!0,imageSrc:oR,labelKey:"lowerBodyIntroGoodFullBody"},{good:!1,imageSrc:oT,labelKey:"lowerBodyIntroBadSitting"},{good:!1,imageSrc:oE,labelKey:"lowerBodyIntroBadCoveredWaist"}],subtitleKey:"lowerBodyIntroSubtitle",titleKey:"lowerBodyIntroTitle"},neck:{cards:[{good:!0,imageSrc:oN,labelKey:"neckIntroGoodHairUp"},{good:!0,imageSrc:o_,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:oz,labelKey:"neckIntroBadHighCollar"}],subtitleKey:"neckIntroSubtitle",titleKey:"neckIntroTitle"},"upper-body":{cards:[{good:!0,imageSrc:oM,labelKey:"upperBodyIntroGoodFacingCamera"},{good:!0,imageSrc:oI,labelKey:"upperBodyIntroGoodAngle"},{good:!1,imageSrc:oA,labelKey:"upperBodyIntroBadArmsCrossed"},{good:!1,imageSrc:oL,labelKey:"upperBodyIntroBadObjectBlockingTorso"}],subtitleKey:"upperBodyIntroSubtitle",titleKey:"upperBodyIntroTitle"},waist:{cards:[{good:!0,imageSrc:oB,labelKey:"waistIntroGoodFullBody"},{good:!0,imageSrc:o$,labelKey:"waistIntroGoodTopTucked"},{good:!1,imageSrc:oF,labelKey:"waistIntroBadOversizedTop"},{good:!1,imageSrc:oD,labelKey:"waistIntroBadSitting"}],subtitleKey:"waistIntroSubtitle",titleKey:"waistIntroTitle"},wrist:{cards:[{good:!0,imageSrc:oH,labelKey:"wristIntroGoodCloseUp"},{good:!0,imageSrc:oW,labelKey:"wristIntroGoodSleeveBack"},{good:!1,imageSrc:oV,labelKey:"wristIntroBadClenchedFist"},{good:!1,imageSrc:oU,labelKey:"wristIntroBadCovered"}],subtitleKey:"wristIntroSubtitle",titleKey:"wristIntroTitle"}};function f3({view:e}){let{t}=rT(),r=e.productType?f2[e.productType]:null;return(0,A.jsxs)(go,{title:t("startTitle"),subtitle:t(r?.titleKey??"externalPhotoHint"),children:[(0,A.jsxs)(fO,{className:"mt-3",children:[(0,A.jsx)(fj,{src:e.productImageSrc}),(0,A.jsx)(fM,{fallbackSrc:e.productImageSrc})]}),(0,A.jsxs)(gi,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,A.jsx)(fG,{"data-icon":"inline-start"}),t("startUpload")]}),(0,A.jsxs)(i4,{className:"w-full",disabled:!e.canOpenHistory,size:"lg",type:"button",variant:"outline",onClick:e.openHistory,children:[(0,A.jsx)(fQ,{"data-icon":"inline-start"}),t("startHistory")]}),(0,A.jsx)(gs,{})]})]})}function f5({view:e}){let{t}=rT(),r=e.productType?f2[e.productType]:null;return r?(0,A.jsxs)(go,{title:t(r.titleKey),subtitle:t(r.subtitleKey),children:[(0,A.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:gap-4",children:r.cards.map(e=>(0,A.jsx)(fD,{good:e.good,imageSrc:e.imageSrc,label:t(e.labelKey)},e.labelKey))}),(0,A.jsx)("div",{className:"mt-4",children:(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.continueIntro,children:t("introCta")})})]}):null}function f9({view:e}){let{t}=rT();return(0,A.jsxs)(go,{title:t("historyTitle"),subtitle:t("historySubtitle"),children:[(0,A.jsx)("div",{className:"mt-3 grid min-h-104 flex-1 grid-cols-3 content-start gap-x-3 gap-y-4 overflow-x-hidden overflow-y-auto overscroll-contain pb-2 sm:gap-4",children:e.history.map(r=>(0,A.jsx)(fL,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,A.jsxs)(gi,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,A.jsx)(fY,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,A.jsx)(gs,{})]})]})}function f4({view:e}){let{t}=rT();return(0,A.jsxs)(go,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,A.jsxs)(fO,{className:"mt-3",children:[(0,A.jsx)(fz,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fF,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,A.jsxs)(gi,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,A.jsx)(fJ,{"data-icon":"inline-start"}),t("confirmGenerate")]}),(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fZ,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,A.jsx)(gs,{})]})]})}function f6(){let{t:e}=rT();return(0,A.jsx)(go,{title:e("activationLoading"),subtitle:e("activationLoadingSubtitle"),children:(0,A.jsx)(fO,{className:"mt-3",children:(0,A.jsx)(fA,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"})})})}function f8({onClose:e,temporary:t}){let{t:r}=rT();return(0,A.jsx)(go,{title:r("activationUnavailableTitle"),subtitle:r(t?"activationTemporarilyUnavailable":"externalProductUnavailable"),children:(0,A.jsxs)(gi,{className:"mt-4",children:[e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e,children:r("close")}),(0,A.jsx)(gs,{className:"text-text-sub"})]})})}function f7({onClose:e,onRetry:t}){let{t:r}=rT();return(0,A.jsx)(go,{title:r("errorTitle"),subtitle:r("externalServiceUnavailable"),children:(0,A.jsxs)(gi,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(fJ,{"data-icon":"inline-start"}),r("errorRetry")]}),e&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e,children:r("close")}),(0,A.jsx)(gs,{className:"text-text-sub"})]})})}function ge({view:e}){let{t}=rT();return(0,A.jsxs)(go,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,A.jsxs)(fO,{className:"mt-3",children:[(0,A.jsx)(fN,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fA,{animated:!0,className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:"",className:"size-full object-cover",src:e.photo.src}):null})]})]}),(0,A.jsx)(fI,{className:"mt-4",label:t("processingProgress"),progress:e.processingProgress})]})}function gt({view:e,onClose:t}){let{t:r}=rT(),n="upload-validation"===e.error.kind&&"file-too-large"===e.error.code,a="generation"===e.error.kind?e.error.code:void 0;return(0,A.jsxs)(go,{title:r(n?"errorFileTooLarge":"errorTitle"),subtitle:n?void 0:r((a?({tokens:"externalNoTokens",product:"externalProductUnavailable",service:"externalServiceUnavailable",timeout:"externalTimeout","photo-required":"externalPhotoRequired"})[a]:void 0)??"errorSubtitle"),children:[!n&&!a&&(0,A.jsxs)(fO,{className:"mt-3",children:[(0,A.jsx)(fN,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fA,{className:"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}),(0,A.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-6 px-6 sm:px-12",children:[(0,A.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white bg-background-containers shadow-md sm:size-37.5",children:(0,A.jsx)("img",{alt:e.productName,className:"size-full object-cover",src:e.productImageSrc})}),(0,A.jsx)("div",{className:"size-32 overflow-hidden rounded-xl border border-constant-white sm:size-37.5",children:e.photo?.src?(0,A.jsx)("img",{alt:e.photo.name??"",className:"size-full object-cover",src:e.photo.src,onError:fR(e.productImageSrc)}):null})]}),(0,A.jsx)("p",{className:"w-56 text-center text-xs font-medium tracking-wider text-constant-white",children:r("errorGuidance")})]})]}),(0,A.jsxs)(gi,{className:"mt-4",children:[(!a||"service"===a||"timeout"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,A.jsx)(fJ,{"data-icon":"inline-start"}),r("errorRetry")]}),(!a||"photo-required"===a)&&(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,A.jsx)(fZ,{"data-icon":"inline-start"}),r("errorDifferentPhoto")]}),a&&t&&(0,A.jsx)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:t,children:r("close")}),(0,A.jsx)(gs,{className:"text-text-sub"})]})]})}function gr({view:e,showAddToCart:t=!0,onAddToCart:r,addToCartPending:n=!1,addToCartError:a}){let{t:o}=rT(),i=r??e.addToCart,s=gl(e.productPrice),l=s?o("resultTryAnotherWithPrice",{price:s}):o("resultTryAnother");return e.myFitsOpen?(0,A.jsx)("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain pb-4",children:(0,A.jsx)("div",{className:"flex flex-col gap-4 px-6 pb-2 pt-4 sm:px-8",children:e.resultHistory.map((r,a)=>(0,A.jsx)(gn,{compact:a>0,onAddToCart:t?i:void 0,addToCartPending:n,productName:r.productName??e.productName,productPrice:r.productPrice,productUrl:r.productUrl??e.productUrl,result:r,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},r.id??r.after.id))})}):(0,A.jsxs)(go,{className:"pb-6",subtitle:void 0,title:o("resultTitle"),children:[(0,A.jsx)(fB,{className:"mt-6",productLabel:e.productName??o("resultProductLink"),productUrl:e.productUrl,zoomLabel:o("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,A.jsxs)(gi,{className:"mt-4",children:[t&&(0,A.jsxs)(i4,{className:"w-full",disabled:n,size:"lg",type:"button",variant:"contrast",onClick:i,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),l]}),a&&(0,A.jsx)("p",{className:"text-center text-xs text-text-sub",role:"alert",children:a}),(0,A.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:e.changePhoto,children:[(0,A.jsx)(fZ,{"data-icon":"inline-start"}),o("resultCompare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,A.jsx)(fl,{"data-icon":"inline-start"}),o("resultShare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,A.jsx)(fo,{"data-icon":"inline-start"}),o("resultReset")]})]})]})]})}function gn({compact:e=!1,onAddToCart:t,addToCartPending:r=!1,onDeleteResult:n,onOpenComparison:a,onSaveResult:o,onShareResult:i,productName:s,productPrice:l,productUrl:u,result:c}){let{t:d}=rT(),p=s??d("resultProductLink"),h=gl(l),f=h?d("resultTryAnotherWithPrice",{price:h}):d("resultTryAnother");return(0,A.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,A.jsx)(fB,{productLabel:p,productUrl:u,zoomLabel:d("resultOpenComparison"),result:c,onOpenComparison:()=>a(c.id)}),(0,A.jsxs)("div",{className:"flex gap-2",children:[t&&(0,A.jsxs)(i4,{className:"min-w-0 flex-1",disabled:r,size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:f})]}),(0,A.jsx)(i4,{"aria-label":d("share"),size:"icon",type:"button",variant:"outline",onClick:()=>i(c.id),children:(0,A.jsx)(fl,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":d("download"),size:"icon",type:"button",variant:"outline",onClick:()=>o(c.id),children:(0,A.jsx)(fo,{"data-icon":"inline-start"})}),!e&&(0,A.jsx)(i4,{"aria-label":d("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>n(c.id),children:(0,A.jsx)(fi,{"data-icon":"inline-start"})})]})]})}function ga({label:e,onClick:t}){return(0,A.jsx)(i4,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fX,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function go({children:e,className:t,subtitle:r,title:n}){return(0,A.jsxs)("div",{className:i2("flex min-h-0 flex-1 flex-col overflow-x-hidden overflow-y-auto overscroll-contain px-6 pb-5 sm:px-8",t),children:[(0,A.jsxs)("div",{className:"mb-1 flex flex-col gap-1",children:[(0,A.jsx)("h2",{className:"text-2xl font-medium tracking-tight text-text-dark",children:n}),r&&(0,A.jsx)("p",{className:"text-sm font-medium text-text-base",children:r})]}),e]})}function gi({children:e,className:t}){return(0,A.jsx)("div",{className:i2("flex flex-col gap-2",t),children:e})}function gs({className:e}){var t;let{i18n:r,t:n}=rT(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?f1:f0);return(0,A.jsxs)("p",{className:i2("pt-1 text-center text-xs font-medium text-text-base",e),children:[n("termsPrefix")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.terms,rel:"noopener noreferrer",target:"_blank",children:n("termsLink")})," ",n("termsJoiner")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:a.privacy,rel:"noopener noreferrer",target:"_blank",children:n("privacyLink")})]})}function gl(e){return e?.trim()||void 0}let gu=new Set(["avif","avis","heic","heix","heim","heis","hevc","hevx","mif1","msf1"]);async function gc(e){var t,r;let n,a,o=(t=e)instanceof Blob?t:t instanceof ArrayBuffer?new Blob([t]):ArrayBuffer.isView(t)?new Blob([new Uint8Array(t.buffer,t.byteOffset,t.byteLength)]):null;return!o||o.size<=0?{blob:null,errorText:null}:(r=new Uint8Array(await o.slice(0,16).arrayBuffer()),n=(...e)=>e.every((e,t)=>r[t]===e),a=(e,...t)=>t.every((t,n)=>r[e+n]===t),n(255,216,255)||n(137,80,78,71,13,10,26,10)||n(71,73,70,56)||n(66,77)||n(82,73,70,70)&&a(8,87,69,66,80)||a(4,102,116,121,112)&&gu.has(function(e){let t="";for(let r=8;r<12;r++)t+=String.fromCharCode(e[r]??0);return t}(r)))?{blob:o,errorText:null}:{blob:null,errorText:(await o.text().catch(()=>"")).slice(0,2e3)}}function gd(e){return"string"==typeof e?e.trim():""}function gp(e,t){let r=e?.uploads;if(!Array.isArray(r)||r.length<t)throw Error("Nano Banana upload URL response is missing uploads");return r.slice(0,t).map(e=>{if(null===e||"object"!=typeof e)throw Error("Nano Banana upload URL response is missing uploads");let t=gd(e.key),r=gd(e.uploadUrl);if(!t||!r)throw Error("Nano Banana upload URL response is missing key or uploadUrl");return{key:t,uploadUrl:r}})}function gh(e){if(e)return e;if("function"==typeof fetch)return fetch;throw Error("Fetch API is not available for AI try-on image upload")}async function gf(e,t,r={}){let{fetch:n,signal:a,timeoutMs:o}=r,i=new AbortController,s=()=>i.abort(a?.reason),l=void 0===o?void 0:setTimeout(()=>i.abort(new DOMException("AI try-on image upload timed out","TimeoutError")),o);a?.aborted?s():a?.addEventListener("abort",s,{once:!0});try{let r=await gh(n)(e,{body:t,method:"PUT",signal:i.signal});if(!r.ok){let e=await r.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${r.status}${e?`: ${e}`:""}`)}}finally{clearTimeout(l),a?.removeEventListener("abort",s)}}async function gg(e,t){let r=e?.trim();return r?gv(r,t,"AI try-on product image fetch failed"):null}async function gm(e,t){return e.blob?e.blob:e.file?e.file:e.src?gv(e.src,t,"AI try-on source photo fetch failed"):null}async function gv(e,t,r){let n=await gh(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}function gy(e){if(!e)return()=>{};e(70);let t=Date.now(),r=globalThis.setInterval(()=>{e(70+24*(1-(1-Math.min((Date.now()-t)/45e3,1))**3))},750);return()=>globalThis.clearInterval(r)}let gb="ai-try-on-result";async function gw(e,t={}){let r=await gk(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gC,o=t.revokeObjectUrl??gP,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gS(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gx(e,t={}){let r=await gk(e,t.fetch),n=t.navigator??globalThis.navigator;if(!r)return!1;if("function"==typeof File&&"function"==typeof n?.share){let a={files:[new File([r],gS(r,e,t.filename),{type:r.type||e?.type||"image/png"})]};if("function"!=typeof n.canShare||n.canShare(a))try{return await n.share(a),!0}catch(e){if("u">typeof DOMException&&e instanceof DOMException&&"AbortError"===e.name)return!1}}return gw(e,t)}async function gk(e,t=globalThis.fetch){if(!e)return null;if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof t)return null;try{let r=await t(e.src);if(!r.ok)return null;return r.blob()}catch{return null}}function gS(e,t,r=gb){var n;let a=function(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/webp":return"webp";case"image/gif":return"gif";case"image/svg+xml":return"svg";default:return null}}(e.type||t?.type)??(n=t?.name,n?.match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??null)??"png",o=r.replace(/\.[a-z0-9]+$/i,"").replace(/[^\w-]+/g,"-").replace(/^-+|-+$/g,"")||gb;return`${o}.${a}`}function gC(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gP(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gE="results";function gT(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gR(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gE)||e.createObjectStore(gE,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gO(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gj(e){return{after:await gz(e.after),before:await gz(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}}async function gz(e){let t=await gN(e);if(!t)throw Error("AI try-on photo cannot be persisted without image data");return{blob:t,id:e.id,lastModified:e.file?.lastModified??e.lastModified,name:e.name,size:t.size,type:t.type||e.type}}async function gN(e){if(e.blob)return e.blob;if(e.file)return e.file;if(!e.src||"function"!=typeof fetch)return null;try{let t=await fetch(e.src);return t.ok?t.blob():null}catch{return null}}function g_(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gA(e,t=gL()){if(t)try{t.setItem(g_(e),"true")}catch{}}function gL(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gI={delete:async function e(e){let t=gT();if(!t)return!1;try{let r=await gR(t),n=r.transaction(gE,"readwrite"),a=gO(n);return n.objectStore(gE).delete(e),await a,r.close(),!0}catch(e){throw Error("AI try-on result could not be removed from history",{cause:e})}},list:async function e(){let e=gT();if(!e)return[];try{var t;let r=await gR(e),n=r.transaction(gE,"readonly"),a=gO(n),o=await (t=n.objectStore(gE).getAll(),new Promise((e,r)=>{t.onerror=()=>r(t.error),t.onsuccess=()=>e(t.result)}));return await a,r.close(),o.sort((e,t)=>t.createdAt-e.createdAt)}catch(e){throw Error("AI try-on history could not be loaded",{cause:e})}},save:async function e(e){let t=gT();if(!t)return!1;try{let r=await gj(e),n=await gR(t),a=n.transaction(gE,"readwrite"),o=gO(a);return a.objectStore(gE).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},gM={save:gw,share:gx},gF={consumeFirstView:function(e,t=gL()){return!function(e,t=gL()){if(!t)return!1;try{return"true"===t.getItem(g_(e))}catch{return!1}}(e,t)&&(gA(e,t),!0)},markSeen:gA},gD={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gB=["image/jpeg","image/png"];class g${createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productPrice:n,productType:a,productUrl:o,tipStore:i}){this.createObjectUrl=e,this.tipStore=i,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productPrice:gV(n),productType:a,productUrl:o,result:null,selectedPhoto:null,stage:"start"}}get view(){switch(this.state.stage){case"intro":return{productType:this.state.productType,stage:"intro"};case"history":return{history:this.state.history,stage:"history"};case"confirm":return{photo:this.state.selectedPhoto,productImageSrc:this.state.productImageSrc,productName:this.state.productName,stage:"confirm"};case"processing":return this.createProcessingView();case"error":return this.createErrorView();case"result":return{canOpenMyFits:this.state.history.length>0,myFitsOpen:this.state.myFitsOpen,productName:this.state.result?.productName??this.state.productName,productPrice:this.state.result?gV(this.state.result.productPrice):this.state.productPrice,productUrl:this.state.result?.productUrl??this.state.productUrl,result:this.state.result,resultHistory:function(e,t){if(!e)return[];let r=[e,...t.filter(t=>t.id!==e.id)];return r.filter((e,t)=>{let n=e.id??e.after.id;return r.findIndex(e=>(e.id??e.after.id)===n)===t})}(this.state.result,this.state.history),stage:"result"};default:return{canOpenHistory:this.state.history.length>0,productImageSrc:this.state.productImageSrc,productName:this.state.productName,productType:this.state.productType,productUrl:this.state.productUrl,stage:"start"}}}get comparison(){let e=this.getComparisonResult();return{open:this.state.comparisonOpen&&null!==e,productName:e?.productName??this.state.productName,productPrice:e?gV(e.productPrice):this.state.productPrice,productUrl:e?.productUrl??this.state.productUrl,result:e}}get selectedPhoto(){return this.state.selectedPhoto}get history(){return this.state.history}updateProduct({productImageSrc:e,productName:t,productPrice:r,productType:n,productUrl:a}){this.state={...this.state,productImageSrc:e,productName:t,productPrice:gV(r),productType:n,productUrl:a}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gU(e,t),[])}}failHistory(e,t){this.state={...this.state,error:{kind:"hydrate-history"===e?"history-load":"save-result"===e?"history-save":"history-delete",message:t}}}choosePhoto(){return this.state.productType&&this.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.state.productType&&this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(this.state.productType&&this.tipStore.markSeen(this.state.productType),this.goBack(),null):{type:"close-dialog"}}openHistory(){0!==this.state.history.length&&(this.state={...this.state,stage:"history"})}goBack(){switch(this.state.stage){case"intro":case"history":this.state={...this.state,stage:"start"};return;case"confirm":this.state={...this.state,stage:this.state.history.length>0?"history":"start"};return;case"processing":case"error":case"result":this.state={...this.state,stage:"confirm"}}}reset(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"}}selectHistoryResult(e){let t=this.state.history.find(t=>t.id===e);t&&(this.state={...this.state,error:null,myFitsOpen:!1,result:t,selectedPhoto:t.before,stage:"result"})}selectFile(e){var t,r;let n=(t=e,gB.includes(t.type)||""===t.type&&/\.(?:jpe?g|png)$/i.test(t.name)?t.size>0xa00000?"file-too-large":null:"unsupported-file-format");if(n)return this.state={...this.state,error:{code:n,kind:"upload-validation"},myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"error"},null;let a=this.createObjectUrl(e),o={blob:e,file:e,id:(r=e,`${r.name}-${r.size}-${r.lastModified}`),lastModified:e.lastModified,name:e.name,size:e.size,src:a,type:e.type};return this.selectPhoto(o),o}selectPhoto(e){this.state={...this.state,error:null,myFitsOpen:!1,processingProgress:0,selectedPhoto:e,stage:"confirm"}}startGeneration(){return!!this.state.selectedPhoto&&(this.state={...this.state,error:null,generationProduct:this.getProductMetadata(),myFitsOpen:!1,processingProgress:0,result:null,stage:"processing"},!0)}reportGenerationProgress(e){var t;"processing"===this.state.stage&&(this.state={...this.state,processingProgress:Math.max(this.state.processingProgress,Number.isFinite(t=e)?Math.min(Math.max(t,0),100):0)})}completeGeneration(e,t=Date.now()){let r=function(e,t,r=Date.now()){return{...e,...t,productPrice:gV(t.productPrice),createdAt:r,id:`${e.before.id}-result-${r}`}}(e,this.state.generationProduct??this.getProductMetadata(),t);return this.state={...this.state,error:null,generationProduct:null,history:gU(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e,t){this.state={...this.state,error:{kind:"generation",message:e,...t?{code:t}:{}},generationProduct:null,stage:"error"}}toggleMyFits(){"result"===this.state.stage&&0!==this.state.history.length&&(this.state={...this.state,myFitsOpen:!this.state.myFitsOpen})}closeMyFits(){this.state={...this.state,myFitsOpen:!1}}openComparison(e){let t=e?this.findResult(e):this.state.result;t&&(this.state={...this.state,comparisonOpen:!0,comparisonResultId:t.id})}closeComparison(){this.state={...this.state,comparisonOpen:!1,comparisonResultId:null}}deleteResult(e){let t=this.findResult(e),r=this.state.history.filter(t=>!gH(t,e)),n=this.state.result?.id??this.state.result?.after.id,a=this.getComparisonResult()?.id===e;if(n!==e)return this.state={...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,history:r},t;let o=r[0]??null;return this.state=o?{...this.state,comparisonOpen:!a&&this.state.comparisonOpen,comparisonResultId:a?null:this.state.comparisonResultId,error:null,generationProduct:null,history:r,myFitsOpen:r.length>0&&this.state.myFitsOpen,result:o,selectedPhoto:o.before,stage:"result"}:{...this.state,comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:r,myFitsOpen:!1,processingProgress:0,result:null,selectedPhoto:null,stage:"start"},t}resolveResultActionPhoto(e){let t=e?this.findResult(e):this.comparison.open?this.comparison.result:this.state.result;return t?.after??null}findResult(e){return this.state.history.find(t=>gH(t,e))??null}createProcessingView(){let e=this.state.generationProduct??this.getProductMetadata();return{photo:this.state.selectedPhoto,processingProgress:this.state.processingProgress,productImageSrc:e.productImageSrc,productName:e.productName,stage:"processing"}}createErrorView(){let e=this.state.generationProduct??this.getProductMetadata();return{error:this.state.error??{kind:"generation"},photo:this.state.selectedPhoto,productImageSrc:e.productImageSrc,productName:e.productName,stage:"error"}}getProductMetadata(){return{productImageSrc:this.state.productImageSrc,productName:this.state.productName,productPrice:this.state.productPrice,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gV(e){return e?.trim()||void 0}function gU(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gH(e,t){return e.id===t||e.after.id===t}class gW extends Error{code;constructor(e){super(e),this.code=e,this.name="AiTryOnGenerationError"}}function gq(e,t){return{blob:e.blob,id:e.id,lastModified:e.lastModified,name:e.name,size:e.size,src:t(e.blob),type:e.type}}function gK(e,t){t&&(gG(e,t.before),gG(e,t.after))}function gG(e,t){gX(t)?.forEach(t=>e.add(t))}function gX(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gY(e){return function(e=5e3){return new Promise(t=>setTimeout(t,e))}(function(e,t=Date.now()){return Math.max(0,5e3-(t-e))}(e))}let gQ={status:"ready"};function gZ({dialogPortalContainer:e,language:t,onClose:r,onAddToCart:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,apiKey:d,showDialogCloseButton:p=!1,showAddToCart:h=!0,activation:f=gQ,onRetryActivation:g}){a||sJ(l);let{i18n:m,t:v}=rT(),y=(0,L.useRef)(null),b=sL(d),w=(0,L.useMemo)(()=>c??sW({apiKey:b}),[c,b]);(0,L.useEffect)(()=>{"string"==typeof t&&m.changeLanguage(t)},[m,t]);let x=function({historyStore:e=gI,objectUrls:t=gD,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:c,resultActions:d=gM,tipStore:p=gF}){var h;let[,f]=(0,L.useReducer)(e=>e+1,0),g=(0,L.useRef)(new Set),m=(0,L.useRef)(!0);(0,L.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let v=(0,L.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&g.current.add(r),r},[t]),y=(0,L.useRef)(null);y.current||(y.current=new g$({createObjectUrl:v,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tipStore:p}));let b=y.current;b.updateProduct({productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u});let w=(0,L.useMemo)(()=>a||(sJ(l),function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sJ(n);let i=a??sW({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gm(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gg(r,t);if(!u||u.size<=0)throw Error("AI try-on product image is missing");o?.reportProgress(22),o?.reportProgress(32);let[c,d]=gp(await i.requestUploadUrls(2),2);o?.reportProgress(44),await Promise.all([gf(c.uploadUrl,l,{fetch:t}),gf(d.uploadUrl,u,{fetch:t})]),o?.reportProgress(62);let p=gy(o?.reportProgress);try{s=await i.generateTryOn({category:n,personImage:c.key,productImages:[d.key]},{timeout:9e4})}finally{p()}o?.reportProgress(96);let{blob:h}=await gc(s);if(!h)throw Error("AI try-on generation did not return an image");o?.reportProgress(98);let f=e(h);if(!f)throw Error("AI try-on result image URL cannot be created");return{before:a,after:{blob:h,id:`${a.id}-nano-banana-result`,name:a.name?`${a.name} result`:"AI try-on result",size:h.size,src:f,type:h.type||"image/jpeg"}}}}({createObjectUrl:t.createObjectUrl,productImageSrc:o,productType:l,tryOnClient:c})),[t,a,o,l,c]),x=(0,L.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),k=(0,L.useCallback)(()=>f(),[]),S=(0,L.useCallback)(e=>{let t=e()??null;k(),x(t)},[x,k]),C=(0,L.useCallback)(e=>{b.failHistory(e),k()},[b,k]),P=(0,L.useCallback)(t=>{e.save(t).catch(()=>{C("save-result")})},[e,C]),E=(0,L.useCallback)(t=>{e.delete(t).catch(()=>{C("delete-result")})},[e,C]),T=(0,L.useCallback)(()=>{S(()=>b.choosePhoto())},[S,b]),R=(0,L.useCallback)(async()=>{let e=b.selectedPhoto;if(!e||!b.startGeneration())return;k();let r=Date.now();try{var n;let a=await w(e,{reportProgress:e=>{m.current&&(b.reportGenerationProgress(e),k())}});if(await gY(r),!m.current){P(b.completeGeneration(a)),a.after.src.startsWith("blob:")&&t.revokeObjectUrl(a.after.src);return}let o=b.completeGeneration(a);n=g.current,gX(o.before)?.forEach(e=>n.add(e)),gX(o.after)?.forEach(e=>n.add(e)),P(o),k()}catch(e){if(await gY(r),!m.current)return;b.failGeneration(e instanceof Error?e.message:void 0,e instanceof gW?e.code:void 0),k()}},[t,P,w,b,k]),O=(0,L.useCallback)(e=>{let t=b.deleteResult(e);t&&E(t.id),k()},[E,b,k]),j=(0,L.useCallback)(e=>{d.save(b.resolveResultActionPhoto(e))},[d,b]),z=(0,L.useCallback)(e=>{d.share(b.resolveResultActionPhoto(e))},[d,b]),N=(0,L.useCallback)(()=>{c.sendWidgetEvent("add_to_cart_from_widget")},[c]);(0,L.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;b.hydrateHistory(r.map(e=>({after:gq(e.after,v),before:gq(e.before,v),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productPrice:e.productPrice,productUrl:e.productUrl}))),k()}catch{t||C("hydrate-history")}}(),()=>{t=!0}},[v,e,C,b,k]),(0,L.useEffect)(()=>()=>{var e,r;e=g.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,L.useEffect)(()=>{var e,r,n,a,o;let i;a=g.current,e=b.view,r=b.comparison.result,n=b.history,i=new Set,"photo"in e&&gG(i,e.photo),"result"===e.stage&&(gK(i,e.result),e.resultHistory.forEach(e=>gK(i,e))),n.forEach(e=>gK(i,e)),gK(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,b.view,b.comparison.result,b.history]);let _=(0,L.useMemo)(()=>(function(e,{addToCart:t,choosePhoto:r,deleteResult:n,generate:a,runSessionCommand:o,saveResult:i,shareResult:s,sync:l}){let u=e.view;switch(u.stage){case"start":return{...u,choosePhoto:r,openHistory:()=>o(()=>e.openHistory())};case"intro":return{...u,continueIntro:()=>o(()=>e.continueIntro())};case"history":return{...u,chooseNew:r,selectResult:t=>o(()=>e.selectHistoryResult(t))};case"confirm":return{...u,changePhoto:r,generate:a};case"error":return{...u,chooseDifferentPhoto:r,retry:u.photo?a:r};case"result":return{...u,addToCart:t,changePhoto:()=>{e.closeMyFits(),l(),r()},deleteResult:n,openComparison:t=>o(()=>e.openComparison(t)),reset:()=>o(()=>e.reset()),saveResult:i,shareResult:s,toggleMyFits:()=>o(()=>e.toggleMyFits())};default:return u}})(b,{addToCart:N,choosePhoto:T,deleteResult:O,generate:()=>void R(),runSessionCommand:S,saveResult:j,shareResult:z,sync:k}),[N,T,O,R,S,j,b,z,k]);return{canGoBack:"start"!==(h=b.view.stage)&&"intro"!==h&&"processing"!==h&&"error"!==h&&"result"!==h,comparison:function(e,{addToCart:t,deleteResult:r,runSessionCommand:n,saveResult:a,shareResult:o}){let i=e.comparison;return{...i,addToCart:t,close:()=>n(()=>e.closeComparison()),deleteResult:()=>{let e=i.result?.id??i.result?.after.id;e&&r(e)},saveResult:()=>a(i.result?.id??i.result?.after.id),shareResult:()=>o(i.result?.id??i.result?.after.id)}}(b,{addToCart:N,deleteResult:O,runSessionCommand:S,saveResult:j,shareResult:z}),goBack:()=>S(()=>b.goBack()),requestClose:()=>S(()=>b.requestClose()),selectFile:e=>S(()=>{b.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>y.current?.click(),processPhoto:a,productImageSrc:o,productName:i,productPrice:s,productType:l,productUrl:u,tryOnClient:w}),k=x.view.stage,S=r??x.requestClose,C="result"===x.view.stage&&x.view.myFitsOpen,[P,E]=(0,L.useState)(!1),[T,R]=(0,L.useState)(void 0),O=(0,L.useCallback)(()=>{"result"!==x.view.stage||(x.view.addToCart(),n&&(E(!0),R(void 0),Promise.resolve(n()).catch(e=>R(e instanceof Error&&e.message?e.message:v("externalServiceUnavailable"))).finally(()=>E(!1))))},[n,x.view,v]),j=x.canGoBack?(0,A.jsx)(ga,{label:v("back"),onClick:x.goBack}):null,z="result"===x.view.stage&&x.view.canOpenMyFits?(0,A.jsxs)(i4,{"aria-expanded":C,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:x.view.toggleMyFits,children:[v("myFits"),(0,A.jsx)(s0,{className:i2("!size-3 transition-transform",C&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,A.jsxs)(fH,{className:C?"h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":k,children:[(0,A.jsx)(fW,{badge:"history"===k||"ready"!==f.status?null:v(function(e){switch(e){case"intro":return"introBadge";case"confirm":return"confirmBadge";case"processing":return"processingBadge";case"error":return"errorBadge";case"result":return"resultBadge";default:return"badge"}}(k)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(k),closeLabel:v("close"),leftSlot:"ready"===f.status?j:null,middleSlot:"ready"===f.status?z:null,preferMiddleSlotFirst:"result"===k,showCloseButton:p,onClose:"ready"===f.status?x.requestClose:S}),(0,A.jsx)("input",{ref:y,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&x.selectFile(t),e.currentTarget.value=""}}),(0,A.jsxs)(fK,{children:["loading"===f.status?(0,A.jsx)(f6,{}):null,"unavailable"===f.status?(0,A.jsx)(f8,{temporary:f.temporary,onClose:S}):null,"error"===f.status?(0,A.jsx)(f7,{onClose:S,onRetry:g}):null,"ready"!==f.status?null:(0,A.jsxs)(A.Fragment,{children:["start"===x.view.stage?(0,A.jsx)(f3,{view:x.view}):null,"intro"===x.view.stage?(0,A.jsx)(f5,{view:x.view}):null,"history"===x.view.stage?(0,A.jsx)(f9,{view:x.view}):null,"confirm"===x.view.stage?(0,A.jsx)(f4,{view:x.view}):null,"processing"===x.view.stage?(0,A.jsx)(ge,{view:x.view}):null,"error"===x.view.stage?(0,A.jsx)(gt,{view:x.view,onClose:x.requestClose}):null,"result"===x.view.stage?(0,A.jsx)(gr,{view:x.view,showAddToCart:h,onAddToCart:n?O:void 0,addToCartPending:P,addToCartError:T}):null]})]},"ready"===f.status?k:`activation-${f.status}`),x.comparison.open&&(0,A.jsx)(f$,{productName:x.comparison.productName,productPrice:x.comparison.productPrice,productUrl:x.comparison.productUrl,portalContainer:e??void 0,result:x.comparison.result,addToCartPending:P,addToCartError:T,onAddToCart:h?n?O:x.comparison.addToCart:void 0,onClose:x.comparison.close,onDeleteResult:x.comparison.deleteResult,onSaveResult:x.comparison.saveResult,onShareResult:x.comparison.shareResult})]})}sS({baseURL:"https://api.neurodyn.ai/"});class gJ{createObjectUrl;operations;signal;session=null;constructor({createObjectUrl:e=g6,operations:t,signal:r}){this.createObjectUrl=e,this.operations=t,this.signal=r}async activate(e){var t,r;let n,a,o,i,s,l,u,{activation:c,session:d}=(a="string"==typeof(n=g9(t=await this.run(()=>this.operations.activate(e,this.baseConfig())))?t:{}).zoneType?n.zoneType:void 0,o=g4(n.photoUrl)||void 0,i=function(e){if(!g9(e))return null;let t=g4(e.token),r=g4(e.sid),n="number"==typeof e.expiresIn?e.expiresIn:NaN;return t&&r&&Number.isFinite(n)&&n>0?{expiresIn:n,sid:r,token:t}:null}(n.widgetSession),s=void 0!==o,u=(l=!0===n.available&&null!==i&&s)?void 0:("string"==typeof(r=n.unavailableReason)&&g0.has(r)?r:void 0)??(!0!==n.available||s?void 0:"no_product_photo"),{activation:{available:l,photoUrl:o,reason:u,zoneType:sZ(a)?a:void 0},session:l?i:null});return d&&(this.session=sB(d,{apiConfig:this.baseConfig(),issueWidgetToken:this.operations.issueWidgetToken})),c}createProcessPhoto(e){return async(t,r)=>{let n;r?.reportProgress(4);let a=await gm(t);if(!a||a.size<=0)throw new gW("photo-required");r?.reportProgress(18);let[o]=gp(await this.run(async()=>this.operations.requestUploadUrls(1,await this.requestConfig())),1);r?.reportProgress(38);let i={signal:this.signal,timeoutMs:3e5};await this.run(()=>this.operations.uploadPhoto?this.operations.uploadPhoto(o.uploadUrl,a,i):gf(o.uploadUrl,a,i)),r?.reportProgress(58);let s=gy(r?.reportProgress);try{n=await this.run(async()=>this.operations.generate({...e,personImageKey:o.key},await this.requestConfig({responseType:"blob",timeout:9e4})))}finally{s()}let{blob:l,errorText:u}=await gc(n);if(!l)throw g1(u);r?.reportProgress(98);let c=this.createObjectUrl(l);if(!c)throw new gW("service");return{before:t,after:{blob:l,id:`${t.id}-shopify-result`,name:t.name?`${t.name} result`:"AI try-on result",size:l.size,src:c,type:l.type||"image/jpeg"}}}}async run(e){try{return await e()}catch(e){var t,r,n;if(e instanceof gW||(t=e,r=this.signal,r?.aborted===!0||"AbortError"===g2(t)||"ERR_CANCELED"===g3(t)))throw e;throw"TimeoutError"===g2(n=e)||"ECONNABORTED"===g3(n)||"ETIMEDOUT"===g3(n)?new gW("timeout"):g1(await g5(e))}}sendWidgetEvent(e){let t=this.operations.sendWidgetEvent;t&&this.requestConfig().then(r=>t({event:e,timestamp:new Date().toISOString()},r)).catch(()=>{})}async requestUploadUrls(){throw Error("Shopify generation handles its own uploads")}async generateTryOn(){throw Error("Shopify generation runs through its own processor")}baseConfig(){return{signal:this.signal,timeout:3e4}}async requestConfig(e={}){let t={...this.baseConfig(),...e};return this.session?this.session.getApiConfigForRequest(t):t}}let g0=new Set(["not_enabled","zone_not_configured","no_product_photo","tokens_exhausted"]);function g1(e){if(!e)return new gW("service");try{let t=JSON.parse(e),r=g9(t)?t.code:void 0;if("tokens"===r||"product"===r||"timeout"===r||"service"===r)return new gW(r)}catch{}return new gW("service")}function g2(e){return g9(e)&&"string"==typeof e.name?e.name:""}function g3(e){return g9(e)&&"string"==typeof e.code?e.code:""}async function g5(e){let t=g9(e)?e.response:void 0,r=g9(t)?t.data:void 0;return r instanceof Blob?(await r.text().catch(()=>"")).slice(0,2e3)||null:"string"==typeof r?r.slice(0,2e3)||null:g9(r)?JSON.stringify(r).slice(0,2e3):null}function g9(e){return null!==e&&"object"==typeof e}function g4(e){return"string"==typeof e?e.trim():""}function g6(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}let g8={status:"loading"},g7={status:"ready"};function me({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,apiKey:u,externalGeneration:c,externalActivation:d,externalAddToCart:p,externalClient:h,...f}){c||sJ(s);let g=(0,L.useMemo)(()=>{let e;return(e=rl.createInstance()).use(oo).use(rO).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sq}),e},[t]),[m,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(e),w=(0,L.useRef)(!1),x=void 0!==n,k=x?n:y,S=sL(u),C=(0,L.useMemo)(()=>c?h??sp:sW({apiKey:S}),[S,c,h]),[P,E]=(0,L.useState)(g8),[T,R]=(0,L.useState)(0),O=d?P:g7,j=(0,L.useRef)(d);function z(e){x||b(e),r?.(e)}return(0,L.useEffect)(()=>{j.current=d}),(0,L.useEffect)(()=>{let e=j.current;if(!e||(E(g8),!k))return;let t=!1;return e().then(e=>{t||E(e.enabled?{...e,status:"ready"}:{status:"unavailable",temporary:e.temporarilyUnavailable})}).catch(()=>{t||E({status:"error"})}),()=>{t=!0}},[T,k,!!d]),(0,L.useEffect)(()=>{if(!k){w.current=!1;return}"ready"!==O.status||w.current||(w.current=!0,C.sendWidgetEvent("widget_opened"))},[O.status,k,C]),(0,A.jsxs)(A.Fragment,{children:[(0,q.createPortal)((0,A.jsx)("style",{children:sd.A}),document.head),(0,q.createPortal)((0,A.jsxs)(rG.div,{className:"fixed inset-x-0 bottom-0 w-svw tracking-normal sm:inset-x-auto sm:right-4 sm:bottom-4 sm:w-120",style:{zIndex:0x7fffffff},children:[(0,A.jsx)("style",{children:":host{display:block!important;visibility:visible!important}"}),(0,A.jsx)("style",{children:sX}),(0,A.jsx)("div",{ref:v}),m&&(0,A.jsx)(sc,{defaultTheme:"light",root:m,storageKey:"neurodyn-ai-try-on-theme",children:(0,A.jsx)(rR,{i18n:g,children:(0,A.jsx)(mt,{language:t,open:k,portalContainer:m,productImageSrc:a,productName:o,productPrice:i,productType:s,productUrl:l,tryOnClient:C,externalGeneration:c,externalAddToCart:p,activation:O,onRetryActivation:()=>R(e=>e+1),onRequestClose:()=>z(!1),onOpenChange:z,...f})})})]}),document.body)]})}function mt({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productPrice:o,productType:i,productUrl:s,tryOnClient:l,externalGeneration:u,externalAddToCart:c,activation:d,onRetryActivation:p,...h}){let{t:f}=rT();return(0,A.jsx)(sr,{...h,children:(0,A.jsxs)(so,{className:"inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",contentInsideOverlay:!0,portalContainer:r,showCloseButton:!1,onInteractOutside:e=>{e.preventDefault()},children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:f("dialogTitle")}),(0,A.jsx)(sl,{children:f("dialogDescription")})]}),(0,A.jsx)(gZ,{dialogPortalContainer:r,language:e,productImageSrc:"ready"===d.status&&d.productImageSrc||n,productName:a,productPrice:o,productType:"ready"===d.status?d.productType??i:i,productUrl:s,tryOnClient:l,processPhoto:u,activation:d,onRetryActivation:p,onAddToCart:c,showAddToCart:!u||!!c,showDialogCloseButton:!0,onClose:t})]})})}var mr=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");class mn extends Error{constructor(e){super(e),this.name="ShopifyCartError"}}async function ma(e,{signal:t,win:r=window}={}){let n=await r.fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:e,quantity:1}]}),signal:t});if(!n.ok)throw new mn(await mo(n));var a=r;for(let e of["cart:refresh","cart:update"])a.document.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:{source:"vizbl-try-on"}}))}async function mo(e){try{let t=await e.json(),r="string"==typeof t.description?t.description.trim():"",n="string"==typeof t.message?t.message.trim():"";return r||n||""}catch{return""}}let mi=new WeakMap;window.VizblShopifyTryOn?.destroy();let ms=null;function ml(e=document,t){return ms=function(e=document,t={}){let r,a=mi.get(e);if(a)return a.configure(t),a;let o={...t},i=e.createElement("div");i.dataset.vizblTryOnDialog="",e.body.append(i);let s=(0,mr.createRoot)(i),l=null,u=null,c=!1,d=0,p=()=>{r.disconnect(),u?.abort(),u=null,l=null,s.render(null)},h=t=>{let a=t.target instanceof Element?t.target.closest("[data-vizbl-try-on]"):null;if(!a||"true"===a.getAttribute("aria-disabled")||a instanceof HTMLButtonElement&&a.disabled)return;let i=a.dataset.productId;if(!i||(t.preventDefault(),l===a))return;p(),l=a,r.observe(e.body,{childList:!0,subtree:!0});let c=new AbortController;u=c;let h=a.dataset.language?.toLowerCase().split(/[-_]/)[0],f=()=>o.operations??(n??=function(e){let t,r=e.trim().replace(/\/+$/,"");if(!r)return;let n=(t=aN.create({baseURL:r,timeout:3e4}),async function(e){let r=await t.request(e);return{data:r.data,headers:r.headers,status:r.status,statusText:r.statusText}});return{activate:({productId:e,variantId:t},r)=>sR({product_id:e,variant_id:t,productType:"ai-try-on-shopify"},{...r,client:n}),generate:(e,t)=>sj(e,{...t,client:n}),issueWidgetToken:(e,t)=>sN(e,{...t,client:n}),requestUploadUrls:(e,t)=>sO({count:e},{...t,client:n}),sendWidgetEvent:(e,t)=>s_(e,{...t,client:n})}}("/apps/vizbl-ai-try-on")),g=()=>{let e=f();if(!e)throw new gW("service");return e},m=new gJ({operations:{activate:(e,t)=>g().activate(e,t),requestUploadUrls:(e,t)=>g().requestUploadUrls(e,t),generate:(e,t)=>g().generate(e,t),issueWidgetToken:(e,t)=>g().issueWidgetToken(e,t),uploadPhoto:(e,t,r)=>(f()?.uploadPhoto??gf)(e,t,r),sendWidgetEvent:(e,t)=>f()?.sendWidgetEvent?.(e,t)??Promise.resolve()},signal:c.signal}),v={productId:i,variantId:function(e,t=document){let r=t.defaultView?.location?.search??"",n=new URLSearchParams(r).get("variant")?.trim();if(n)return n;let a=t.querySelector('form[action*="/cart/add"] [name="id"]:checked, form[action*="/cart/add"] select[name="id"], form[action*="/cart/add"] input[name="id"]'),o=a?.value?.trim();return o||e.getAttribute("data-variant-id")?.trim()||void 0}(a,e)},y=m.createProcessPhoto(v),b=!1,w=async()=>{if(!f())return{enabled:!1};let{available:e,photoUrl:t,reason:r,zoneType:n}=await m.activate(v);return{enabled:e,productImageSrc:t,productType:n,temporarilyUnavailable:"tokens_exhausted"===r}},x=async(e,t)=>{if(b||c.signal.aborted)throw new gW("service");b=!0;try{let n=await y(e,t);if(c.signal.aborted){var r;throw r=n.after.src,r?.startsWith("blob:")&&"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(r),new DOMException("Generation was aborted","AbortError")}return n}catch(e){if(e instanceof gW||c.signal.aborted)throw e;throw new gW("service")}finally{b=!1}},k=v.variantId?()=>ma(v.variantId,{signal:c.signal}):void 0;s.render((0,L.createElement)(me,{key:++d,open:!0,language:void 0===h?void 0:"ru"===h?"ru":"en",productName:a.dataset.productName??"",productImageSrc:a.dataset.productImage??"",productPrice:function(e,t){let r=e.getAttribute("data-product-price")?.trim()||void 0;if(!t)return r;let n=e.closest("[data-vizbl-try-on-block]")?.querySelector("[data-vizbl-try-on-variants]")?.textContent;if(!n)return r;try{let e=JSON.parse(n),a=e[t]?.price;return"string"==typeof a&&a.trim()||r}catch{return r}}(a,v.variantId),productUrl:a.dataset.productUrl,externalActivation:w,externalAddToCart:k,externalGeneration:x,externalClient:m,onOpenChange:e=>!e&&p()}))},f=e=>{e.target instanceof Element&&l&&e.target.contains(l)&&p()};e.addEventListener("click",h),e.addEventListener("shopify:section:unload",f),r=new MutationObserver(()=>{l&&!l.isConnected&&p()});let g={configure(e){c||(o={...o,...e})},destroy(){c||(c=!0,u?.abort(),e.removeEventListener("click",h),e.removeEventListener("shopify:section:unload",f),r.disconnect(),mi.delete(e),queueMicrotask(()=>{s.unmount(),i.remove()}))}};return mi.set(e,g),g}(e,t)}window.VizblShopifyTryOn={ShopifyGenerationError:gW,mount:ml,configure:e=>void ml(document,e),destroy:()=>{ms?.destroy(),ms=null}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>ml(),{once:!0}):ml()})()})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neurodyn/ai-try-on",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./shopify": {
|
|
7
7
|
"types": "./dist/shopify.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"react": "^19.2.0",
|
|
24
24
|
"react-dom": "^19.2.0",
|
|
25
|
-
"@neurodyn/react-ai-try-on": "0.1.
|
|
25
|
+
"@neurodyn/react-ai-try-on": "0.1.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@rsbuild/core": "1.7.1",
|