@neurodyn/ai-try-on 0.0.1 → 0.0.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.
@@ -1030,6 +1030,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
1030
1030
  width: 56px;
1031
1031
  }
1032
1032
 
1033
+ .w-\\[90\\%\\] {
1034
+ width: 90%;
1035
+ }
1036
+
1033
1037
  .w-\\[340px\\] {
1034
1038
  width: 340px;
1035
1039
  }
@@ -5483,4 +5487,4 @@ ${h}`:h),sq=["full-body","upper-body","lower-body","footwear","headwear","eyewea
5483
5487
  - less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
5484
5488
  - \`null\` or \`undefined\` if the progress is indeterminate.
5485
5489
 
5486
- Defaulting to \`null\`.`));let c=fw(o,u)?o:null,d=fy(c)?s(c,u):void 0;return(0,A.jsx)(fd,{scope:a,value:c,max:u,children:(0,A.jsx)(fs.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fy(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fv(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});fh.displayName=fl;var ff="ProgressIndicator",fg=L.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=fp(ff,r);return(0,A.jsx)(fs.div,{"data-state":fv(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fm(e,t){return`${Math.round(e/t*100)}%`}function fv(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fy(e){return"number"==typeof e}function fb(e){return fy(e)&&!isNaN(e)&&e>0}function fw(e,t){return fy(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,A.jsx)(fh,{"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)(fg,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fx(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 fS(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 fC({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 fP({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 fE({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 fT({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 fR({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 fO({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)(fR,{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)(fR,{className:"absolute inset-0 size-full opacity-70"})})]})}function fj({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)(fx,{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)(fk,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fz({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 fN({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 fA({good:e,imageSrc:t,label:r}){return(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)(fx,{className:"size-5 text-background-containers"}):(0,A.jsx)(fe,{className:"size-5 text-background-containers"})})]})}function fL({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)(fC,{"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)(fE,{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)(fn,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}):(0,A.jsxs)("span",{className:i,children:[(0,A.jsx)(fn,{"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)(fS,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fI({onAddToCart:e,onClose:t,onDeleteResult:r,onSaveResult:n,onShareResult:a,portalContainer:o,productName:i,productUrl:s,result:l}){let{t:u}=rT(),c=i??u("resultProductLink");return(0,A.jsx)(sr,{open:!0,onOpenChange:e=>!e&&t(),children:(0,A.jsxs)(so,{className:"dark fixed inset-0 left-0 top-0 flex h-svh 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:o,showCloseButton:!1,children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:u("comparisonTitle")}),(0,A.jsx)(sl,{children:u("comparisonSlider")})]}),(0,A.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[s?(0,A.jsx)(i4,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,A.jsxs)("a",{href:s,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:c})]})}):(0,A.jsxs)(i4,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:c})]}),(0,A.jsx)(i4,{"aria-label":u("close"),size:"icon-lg",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fe,{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)(h4,{"aria-label":u("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,A.jsx)(h6,{position:"right",children:(0,A.jsx)(fz,{className:"w-full object-contain",photo:l?.after})}),(0,A.jsx)(h6,{position:"left",children:(0,A.jsx)(fz,{className:"w-full object-contain",photo:l?.before})}),(0,A.jsxs)(h8,{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.jsx)("div",{className:"flex h-23 shrink-0 items-center justify-center px-8 pb-6 pt-3",children:(0,A.jsxs)("div",{className:"flex w-full max-w-104 items-start gap-2",children:[(0,A.jsxs)(i4,{className:"min-w-0 flex-1",size:"lg",type:"button",variant:"contrast",onClick:e,children:[(0,A.jsx)(h7,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:u("resultTryAnother")})]}),(0,A.jsx)(i4,{"aria-label":u("share"),size:"icon-lg",type:"button",variant:"outline",onClick:a,children:(0,A.jsx)(fa,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":u("download"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,A.jsx)(ft,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":u("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){r()},children:(0,A.jsx)(fr,{"data-icon":"inline-start"})})]})})]})})}fg.displayName=ff;let fM=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 fF({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,A.jsx)(n?o0:"span",{"data-slot":"badge",className:i2(fM({variant:t,size:r,className:e})),...a})}function fD({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex max-h-svh 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 fB({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)(f$,{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)(fe,{"data-icon":"inline-start"})})]})}function f$({className:e,tone:t="gray",...r}){return(0,A.jsx)(fF,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fV({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 fU(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 fH(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 fW(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 fK(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 fG({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 fX={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:ok,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:ox,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:oN,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:o_,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 fY({view:e}){let{t}=rT(),r=fX[e.productType];return(0,A.jsxs)(f9,{title:t("startTitle"),subtitle:t(r.titleKey),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fP,{src:e.productImageSrc}),(0,A.jsx)(fz,{fallbackSrc:e.productImageSrc})]}),(0,A.jsxs)(f4,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,A.jsx)(fU,{"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)(f6,{})]})]})}function fQ({view:e}){let{t}=rT(),r=fX[e.productType];return(0,A.jsxs)(f9,{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)(fA,{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")})})]})}function fZ({view:e}){let{t}=rT();return(0,A.jsxs)(f9,{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)(fj,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,A.jsxs)(f4,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,A.jsx)(fW,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,A.jsx)(f6,{})]})]})}function fJ({view:e}){let{t}=rT();return(0,A.jsxs)(f9,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fE,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fN,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,A.jsxs)(f4,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,A.jsx)(fG,{"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)(fK,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,A.jsx)(f6,{})]})]})}function f0({view:e}){let{t}=rT();return(0,A.jsxs)(f9,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fT,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fO,{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 f1({view:e}){let{t}=rT();return(0,A.jsxs)(f9,{title:t("errorTitle"),subtitle:t("errorSubtitle"),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fT,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fO,{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:t("errorGuidance")})]})]}),(0,A.jsxs)(f4,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,A.jsx)(fG,{"data-icon":"inline-start"}),t("errorRetry")]}),(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,A.jsx)(fK,{"data-icon":"inline-start"}),t("errorDifferentPhoto")]}),(0,A.jsx)(f6,{className:"text-text-sub"})]})]})}function f2({view:e}){let{t}=rT();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((t,r)=>(0,A.jsx)(f3,{compact:r>0,onAddToCart:e.addToCart,productName:t.productName??e.productName,productUrl:t.productUrl??e.productUrl,result:t,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},t.id??t.after.id))})}):(0,A.jsxs)(f9,{className:"pb-6",subtitle:void 0,title:t("resultTitle"),children:[(0,A.jsx)(fL,{className:"mt-6",productLabel:e.productName??t("resultProductLink"),productUrl:e.productUrl,zoomLabel:t("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,A.jsxs)(f4,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.addToCart,children:[(0,A.jsx)(h7,{"data-icon":"inline-start"}),t("resultTryAnother")]}),(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)(fK,{"data-icon":"inline-start"}),t("resultCompare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,A.jsx)(fa,{"data-icon":"inline-start"}),t("resultShare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),t("resultReset")]})]})]})]})}function f3({compact:e=!1,onAddToCart:t,onDeleteResult:r,onOpenComparison:n,onSaveResult:a,onShareResult:o,productName:i,productUrl:s,result:l}){let{t:u}=rT(),c=i??u("resultProductLink");return(0,A.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,A.jsx)(fL,{productLabel:c,productUrl:s,zoomLabel:u("resultOpenComparison"),result:l,onOpenComparison:()=>n(l.id)}),(0,A.jsxs)("div",{className:"flex gap-2",children:[(0,A.jsxs)(i4,{className:"min-w-0 flex-1",size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(h7,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:u("resultTryAnother")})]}),(0,A.jsx)(i4,{"aria-label":u("share"),size:"icon",type:"button",variant:"outline",onClick:()=>o(l.id),children:(0,A.jsx)(fa,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":u("download"),size:"icon",type:"button",variant:"outline",onClick:()=>a(l.id),children:(0,A.jsx)(ft,{"data-icon":"inline-start"})}),!e&&(0,A.jsx)(i4,{"aria-label":u("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>r(l.id),children:(0,A.jsx)(fr,{"data-icon":"inline-start"})})]})]})}function f5({label:e,onClick:t}){return(0,A.jsx)(i4,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fH,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function f9({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 f4({children:e,className:t}){return(0,A.jsx)("div",{className:i2("flex flex-col gap-2",t),children:e})}function f6({className:e}){let{t}=rT();return(0,A.jsxs)("p",{className:i2("pt-1 text-center text-xs font-medium text-text-base",e),children:[t("termsPrefix")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:"https://vizbl.com/legal/terms-of-use",rel:"noopener noreferrer",target:"_blank",children:t("termsLink")})," ",t("termsJoiner")," ",(0,A.jsx)("a",{className:"underline underline-offset-2",href:"https://vizbl.com/legal/privacy-policy",rel:"noopener noreferrer",target:"_blank",children:t("privacyLink")})]})}function f8(e){return"string"==typeof e?e.trim():""}function f7(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 ge(e,t,r){let n=await f7(r)(e,{body:t,method:"PUT"});if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${n.status}${e?`: ${e}`:""}`)}}async function gt(e,t){let r=e?.trim();return r?gn(r,t,"AI try-on product image fetch failed"):null}async function gr(e,t){return e.blob?e.blob:e.file?e.file:e.src?gn(e.src,t,"AI try-on source photo fetch failed"):null}async function gn(e,t,r){let n=await f7(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}async function ga(e){if(e instanceof Blob)return e.type?e:new Blob([e],{type:"image/jpeg"});if(e instanceof ArrayBuffer||"string"==typeof e)return new Blob([e],{type:"image/jpeg"});throw Error("AI try-on generation did not return an image")}let go="ai-try-on-result";async function gi(e,t={}){let r=await gl(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gc,o=t.revokeObjectUrl??gd,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gu(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gs(e,t={}){let r=await gl(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],gu(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 gi(e,t)}async function gl(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 gu(e,t,r=go){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,"")||go;return`${o}.${a}`}function gc(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gd(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gp="results";function gh(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gf(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 gg(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gm(e){return{after:await gv(e.after),before:await gv(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productUrl:e.productUrl}}async function gv(e){let t=await gy(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 gy(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 gb(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gw(e,t=gk()){if(t)try{t.setItem(gb(e),"true")}catch{}}function gk(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gx={delete:async function e(e){let t=gh();if(!t)return!1;try{let r=await gf(t),n=r.transaction(gp,"readwrite"),a=gg(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=gh();if(!e)return[];try{var t;let r=await gf(e),n=r.transaction(gp,"readonly"),a=gg(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=gh();if(!t)return!1;try{let r=await gm(e),n=await gf(t),a=n.transaction(gp,"readwrite"),o=gg(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})}}},gS={save:gi,share:gs},gC={consumeFirstView:function(e,t=gk()){return!function(e,t=gk()){if(!t)return!1;try{return"true"===t.getItem(gb(e))}catch{return!1}}(e,t)&&(gw(e,t),!0)},markSeen:gw},gP={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gE=["image/jpeg","image/png"];class gT{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productType:n,productUrl:a,tipStore:o}){this.createObjectUrl=e,this.tipStore=o,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productType:n,productUrl:a,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,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,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,productType:r,productUrl:n}){this.state={...this.state,productImageSrc:e,productName:t,productType:r,productUrl:n}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gR(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.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(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,gE.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,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:gR(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e){this.state={...this.state,error:{kind:"generation",message:e},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=>!gO(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=>gO(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,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gR(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function gO(e,t){return e.id===t||e.after.id===t}function gj(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&&(gz(e,t.before),gz(e,t.after))}function gz(e,t){gN(t)?.forEach(t=>e.add(t))}function gN(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gA(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))}function gL({dialogPortalContainer:e,language:t,onClose:r,processPhoto:n,productImageSrc:a,productName:o,productType:i,productUrl:s,tryOnClient:l,apiKey:u,showDialogCloseButton:c=!1}){sX(i);let{i18n:d,t:p}=rT(),h=(0,L.useRef)(null),f=sN(u),g=(0,L.useMemo)(()=>l??sV({apiKey:f}),[l,f]);(0,L.useEffect)(()=>{"string"==typeof t&&d.changeLanguage(t)},[d,t]);let m=function({historyStore:e=gx,objectUrls:t=gP,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productType:s,productUrl:l,tryOnClient:u,resultActions:c=gS,tipStore:d=gC}){var p;let[,h]=(0,L.useReducer)(e=>e+1,0),f=(0,L.useRef)(new Set),g=(0,L.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&f.current.add(r),r},[t]),m=(0,L.useRef)(null);m.current||(m.current=new gT({createObjectUrl:g,productImageSrc:o,productName:i,productType:s,productUrl:l,tipStore:d}));let v=m.current;v.updateProduct({productImageSrc:o,productName:i,productType:s,productUrl:l});let y=(0,L.useMemo)(()=>a??function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sX(n);let i=a??sV({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await gr(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gt(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=f8(e.key),r=f8(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([ge(c.uploadUrl,l,t),ge(d.uploadUrl,u,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 h=await ga(s);if(h.size<=0)throw Error("AI try-on generation returned an empty 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:g,productImageSrc:o,productType:s,tryOnClient:u}),[g,a,o,s,u]),b=(0,L.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),w=(0,L.useCallback)(()=>h(),[]),k=(0,L.useCallback)(e=>{let t=e()??null;w(),b(t)},[b,w]),x=(0,L.useCallback)(e=>{v.failHistory(e),w()},[v,w]),S=(0,L.useCallback)(t=>{e.save(t).catch(()=>{x("save-result")})},[e,x]),C=(0,L.useCallback)(t=>{e.delete(t).catch(()=>{x("delete-result")})},[e,x]),P=(0,L.useCallback)(()=>{k(()=>v.choosePhoto())},[k,v]),E=(0,L.useCallback)(async()=>{let e=v.selectedPhoto;if(!e||!v.startGeneration())return;w();let t=Date.now();try{var r;let n=await y(e,{reportProgress:e=>{v.reportGenerationProgress(e),w()}});await gA(t);let a=v.completeGeneration(n);r=f.current,gN(a.before)?.forEach(e=>r.add(e)),gN(a.after)?.forEach(e=>r.add(e)),S(a),w()}catch(e){await gA(t),v.failGeneration(e instanceof Error?e.message:void 0),w()}},[S,y,v,w]),T=(0,L.useCallback)(e=>{let t=v.deleteResult(e);t&&C(t.id),w()},[C,v,w]),R=(0,L.useCallback)(e=>{c.save(v.resolveResultActionPhoto(e))},[c,v]),O=(0,L.useCallback)(e=>{c.share(v.resolveResultActionPhoto(e))},[c,v]),j=(0,L.useCallback)(()=>{u.sendWidgetEvent("add_to_cart_from_widget")},[u]);(0,L.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;v.hydrateHistory(r.map(e=>({after:gj(e.after,g),before:gj(e.before,g),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productUrl:e.productUrl}))),w()}catch{t||x("hydrate-history")}}(),()=>{t=!0}},[g,e,x,v,w]),(0,L.useEffect)(()=>()=>{var e,r;e=f.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,L.useEffect)(()=>{var e,r,n,a,o;let i;a=f.current,e=v.view,r=v.comparison.result,n=v.history,i=new Set,"photo"in e&&gz(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,v.view,v.comparison.result,v.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}})(v,{addToCart:j,choosePhoto:P,deleteResult:T,generate:()=>void E(),runSessionCommand:k,saveResult:R,shareResult:O,sync:w}),[j,P,T,E,k,R,v,O,w]);return{canGoBack:"start"!==(p=v.view.stage)&&"intro"!==p&&"processing"!==p&&"error"!==p&&"result"!==p,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)}}(v,{addToCart:j,deleteResult:T,runSessionCommand:k,saveResult:R,shareResult:O}),goBack:()=>k(()=>v.goBack()),requestClose:()=>k(()=>v.requestClose()),selectFile:e=>k(()=>{v.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>h.current?.click(),processPhoto:n,productImageSrc:a,productName:o,productType:i,productUrl:s,tryOnClient:g}),v=m.view.stage,y="result"===m.view.stage&&m.view.myFitsOpen,b=m.canGoBack?(0,A.jsx)(f5,{label:p("back"),onClick:m.goBack}):null,w="result"===m.view.stage&&m.view.canOpenMyFits?(0,A.jsxs)(i4,{"aria-expanded":y,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:m.view.toggleMyFits,children:[p("myFits"),(0,A.jsx)(sY,{className:i2("!size-3 transition-transform",y&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,A.jsxs)(fD,{className:y?"h-svh max-h-svh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":v,children:[(0,A.jsx)(fB,{badge:"history"===v?null:p(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"}}(v)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(v),closeLabel:p("close"),leftSlot:b,middleSlot:w,preferMiddleSlotFirst:"result"===v,showCloseButton:c,onClose:m.requestClose}),(0,A.jsx)("input",{ref:h,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&m.selectFile(t),e.currentTarget.value=""}}),(0,A.jsxs)(fV,{children:["start"===m.view.stage?(0,A.jsx)(fY,{view:m.view}):null,"intro"===m.view.stage?(0,A.jsx)(fQ,{view:m.view}):null,"history"===m.view.stage?(0,A.jsx)(fZ,{view:m.view}):null,"confirm"===m.view.stage?(0,A.jsx)(fJ,{view:m.view}):null,"processing"===m.view.stage?(0,A.jsx)(f0,{view:m.view}):null,"error"===m.view.stage?(0,A.jsx)(f1,{view:m.view}):null,"result"===m.view.stage?(0,A.jsx)(f2,{view:m.view}):null]},v),m.comparison.open&&(0,A.jsx)(fI,{productName:m.comparison.productName,productUrl:m.comparison.productUrl,portalContainer:e??void 0,result:m.comparison.result,onAddToCart:m.comparison.addToCart,onClose:m.comparison.close,onDeleteResult:m.comparison.deleteResult,onSaveResult:m.comparison.saveResult,onShareResult:m.comparison.shareResult})]})}function gI({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productType:i,productUrl:s,apiKey:l,...u}){sX(i);let c=(0,L.useMemo)(()=>{let e;return(e=rl.createInstance()).use(oo).use(rO).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sU}),e},[t]),[d,p]=(0,L.useState)(null),[h,f]=(0,L.useState)(e),g=(0,L.useRef)(!1),m=void 0!==n,v=m?n:h,y=sN(l),b=(0,L.useMemo)(()=>sV({apiKey:y}),[y]);function w(e){m||f(e),r?.(e)}return(0,L.useEffect)(()=>{if(!v){g.current=!1;return}g.current||(g.current=!0,b.sendWidgetEvent("widget_opened"))},[v,b]),(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:sW}),(0,A.jsx)("div",{ref:p}),d&&(0,A.jsx)(sc,{defaultTheme:"light",root:d,storageKey:"neurodyn-ai-try-on-theme",children:(0,A.jsx)(rR,{i18n:c,children:(0,A.jsx)(gM,{language:t,open:v,portalContainer:d,productImageSrc:a,productName:o,productType:i,productUrl:s,tryOnClient:b,onRequestClose:()=>w(!1),onOpenChange:w,...u})})})]}),document.body)]})}function gM({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productType:o,productUrl:i,tryOnClient:s,...l}){let{t:u}=rT();return(0,A.jsx)(sr,{...l,children:(0,A.jsxs)(so,{className:"inset-x-0 bottom-0 top-auto block max-h-svh 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:u("dialogTitle")}),(0,A.jsx)(sl,{children:u("dialogDescription")})]}),(0,A.jsx)(gL,{dialogPortalContainer:r,language:e,productImageSrc:n,productName:a,productType:o,productUrl:i,tryOnClient:s,showDialogCloseButton:!0,onClose:t})]})})}sx({baseURL:"https://api.neurodyn.ai/"});var gF=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");let gD=0,gB="data-neurodyn-ai-try-on-product-type";function g$(e,t){let r=e.getAttribute(t);return r&&r.trim().length>0?r:void 0}function gV(e,t){let r=g$(e,t);if(!r)throw Error(`AI try-on dialog trigger is missing ${t}`);return r}window.__neurodynAiTryOnDialog?.destroy();let gU=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-${gD++}`,document.body.appendChild(this.container),this.root=(0,gF.createRoot)(this.container)),this.root}render(){let e=this.ensureRoot();this.props&&this.openState?e.render((0,L.createElement)(gI,{...this.props,open:!0,onOpenChange:this.handleOpenChange})):e.render(null)}};function gH(e){let t=e.target instanceof Element?e.target.closest("[data-neurodyn-ai-try-on-dialog]"):null;t&&gU.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:gV(e,"data-neurodyn-ai-try-on-product-image-src"),productName:void 0!==t.productName?t.productName:gV(e,"data-neurodyn-ai-try-on-product-name"),productUrl:void 0!==t.productUrl?t.productUrl:g$(e,"data-neurodyn-ai-try-on-product-url"),productType:function(e){if(!sG(e)){let t="string"==typeof e&&e.length>0?` "${e}"`:"";throw Error(`AI try-on product type from ${gB} must be one of: ${sq.join(", ")}; received${t||" no value"}`)}return e}(void 0!==t.productType?t.productType:e.getAttribute(gB)),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",gH),gU.destroy(),window.__neurodynAiTryOnDialog===n&&(window.__neurodynAiTryOnDialog=void 0)}},document.addEventListener("click",gH),window.__neurodynAiTryOnDialog=n})()})();
5490
+ Defaulting to \`null\`.`));let c=fw(o,u)?o:null,d=fy(c)?s(c,u):void 0;return(0,A.jsx)(fd,{scope:a,value:c,max:u,children:(0,A.jsx)(fs.div,{"aria-valuemax":u,"aria-valuemin":0,"aria-valuenow":fy(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fv(c,u),"data-value":c??void 0,"data-max":u,...l,ref:t})})});fh.displayName=fl;var ff="ProgressIndicator",fg=L.forwardRef((e,t)=>{let{__scopeProgress:r,...n}=e,a=fp(ff,r);return(0,A.jsx)(fs.div,{"data-state":fv(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});function fm(e,t){return`${Math.round(e/t*100)}%`}function fv(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function fy(e){return"number"==typeof e}function fb(e){return fy(e)&&!isNaN(e)&&e>0}function fw(e,t){return fy(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,A.jsx)(fh,{"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)(fg,{"data-slot":"progress-indicator",className:"h-full bg-primary transition-[width]",style:{width:`${o}%`}})})}function fx(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 fS(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 fC({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 fP({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 fE({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 fT({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 fR({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 fO({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)(fR,{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)(fR,{className:"absolute inset-0 size-full opacity-70"})})]})}function fj({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)(fx,{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)(fk,{className:"h-1 bg-background-base-3 [&_[data-slot=progress-indicator]]:bg-background-dark",value:a})]})}function fz({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 fN({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 fA({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)(fx,{className:"size-5 text-background-containers"}):(0,A.jsx)(fe,{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 fL({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)(fC,{"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)(fE,{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)(fn,{"aria-hidden":"true",className:"size-4"}),(0,A.jsx)("span",{className:"truncate",children:r})]}):(0,A.jsxs)("span",{className:i,children:[(0,A.jsx)(fn,{"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)(fS,{"aria-hidden":"true",className:"size-3.5"})})]})]})}function fI({onAddToCart:e,onClose:t,onDeleteResult:r,onSaveResult:n,onShareResult:a,portalContainer:o,productName:i,productUrl:s,result:l}){let{t:u}=rT(),c=i??u("resultProductLink");return(0,A.jsx)(sr,{open:!0,onOpenChange:e=>!e&&t(),children:(0,A.jsxs)(so,{className:"dark fixed inset-0 left-0 top-0 flex h-svh 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:o,showCloseButton:!1,children:[(0,A.jsxs)(si,{className:"sr-only",children:[(0,A.jsx)(ss,{children:u("comparisonTitle")}),(0,A.jsx)(sl,{children:u("comparisonSlider")})]}),(0,A.jsxs)("div",{className:"flex h-23 shrink-0 items-center justify-between px-8 py-6",children:[s?(0,A.jsx)(i4,{asChild:!0,className:"max-w-80",size:"lg",variant:"outline",children:(0,A.jsxs)("a",{href:s,children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:c})]})}):(0,A.jsxs)(i4,{className:"max-w-80",size:"lg",type:"button",variant:"outline",children:[(0,A.jsx)(fn,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:c})]}),(0,A.jsx)(i4,{"aria-label":u("close"),size:"icon-lg",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fe,{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)(h4,{"aria-label":u("comparisonSlider"),className:"h-full max-h-179 w-full max-w-143 bg-background-base-2",children:[(0,A.jsx)(h6,{position:"right",children:(0,A.jsx)(fz,{className:"w-full object-contain",photo:l?.after})}),(0,A.jsx)(h6,{position:"left",children:(0,A.jsx)(fz,{className:"w-full object-contain",photo:l?.before})}),(0,A.jsxs)(h8,{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.jsx)("div",{className:"flex h-23 shrink-0 items-center justify-center px-8 pb-6 pt-3",children:(0,A.jsxs)("div",{className:"flex w-full max-w-104 items-start gap-2",children:[(0,A.jsxs)(i4,{className:"min-w-0 flex-1",size:"lg",type:"button",variant:"contrast",onClick:e,children:[(0,A.jsx)(h7,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:u("resultTryAnother")})]}),(0,A.jsx)(i4,{"aria-label":u("share"),size:"icon-lg",type:"button",variant:"outline",onClick:a,children:(0,A.jsx)(fa,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":u("download"),size:"icon-lg",type:"button",variant:"outline",onClick:n,children:(0,A.jsx)(ft,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":u("reset"),size:"icon-lg",type:"button",variant:"outline",onClick:function(){r()},children:(0,A.jsx)(fr,{"data-icon":"inline-start"})})]})})]})})}fg.displayName=ff;let fM=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 fF({className:e,variant:t,size:r,asChild:n=!1,...a}){return(0,A.jsx)(n?o0:"span",{"data-slot":"badge",className:i2(fM({variant:t,size:r,className:e})),...a})}function fD({className:e,...t}){return(0,A.jsx)("div",{className:i2("flex max-h-svh 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 fB({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)(f$,{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)(fe,{"data-icon":"inline-start"})})]})}function f$({className:e,tone:t="gray",...r}){return(0,A.jsx)(fF,{className:e,size:"md",variant:"blue"===t?"standard":"green"===t?"positive":"red"===t?"negative":"secondary",...r})}function fV({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 fU(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 fH(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 fW(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 fK(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 fG({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 fX={privacy:"https://vizbl.com/legal/privacy-policy",terms:"https://vizbl.com/legal/terms-of-use"},fY={privacy:"https://arizo.ru/privacy-policy/",terms:"https://arizo.ru/terms-of-use/"},fQ={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:ok,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:ox,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:oN,labelKey:"neckIntroGoodOpenNeckline"},{good:!1,imageSrc:oj,labelKey:"neckIntroBadHairCovering"},{good:!1,imageSrc:o_,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 fZ({view:e}){let{t}=rT(),r=fQ[e.productType];return(0,A.jsxs)(f6,{title:t("startTitle"),subtitle:t(r.titleKey),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fP,{src:e.productImageSrc}),(0,A.jsx)(fz,{fallbackSrc:e.productImageSrc})]}),(0,A.jsxs)(f8,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.choosePhoto,children:[(0,A.jsx)(fU,{"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)(f7,{})]})]})}function fJ({view:e}){let{t}=rT(),r=fQ[e.productType];return(0,A.jsxs)(f6,{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)(fA,{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")})})]})}function f0({view:e}){let{t}=rT();return(0,A.jsxs)(f6,{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)(fj,{"aria-label":r.after.name??t("historyPhoto"),photo:r.after,onClick:()=>e.selectResult(r.id)},r.id))}),(0,A.jsxs)(f8,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.chooseNew,children:[(0,A.jsx)(fW,{"data-icon":"inline-start"}),t("historyUploadNew")]}),(0,A.jsx)(f7,{})]})]})}function f1({view:e}){let{t}=rT();return(0,A.jsxs)(f6,{title:t("confirmTitle"),subtitle:t("confirmSubtitle"),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fE,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fN,{className:"bottom-2 left-2",imageSrc:e.productImageSrc,name:e.productName})]}),(0,A.jsxs)(f8,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.generate,children:[(0,A.jsx)(fG,{"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)(fK,{"data-icon":"inline-start"}),t("confirmChangePhoto")]}),(0,A.jsx)(f7,{})]})]})}function f2({view:e}){let{t}=rT();return(0,A.jsxs)(f6,{title:t("processingTitle"),subtitle:t("processingSubtitle"),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fT,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fO,{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 f3({view:e}){let{t}=rT();return(0,A.jsxs)(f6,{title:t("errorTitle"),subtitle:t("errorSubtitle"),children:[(0,A.jsxs)(fC,{className:"mt-3",children:[(0,A.jsx)(fT,{fallbackSrc:e.productImageSrc,photo:e.photo}),(0,A.jsx)(fO,{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:t("errorGuidance")})]})]}),(0,A.jsxs)(f8,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.retry,children:[(0,A.jsx)(fG,{"data-icon":"inline-start"}),t("errorRetry")]}),(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"outline",onClick:e.chooseDifferentPhoto,children:[(0,A.jsx)(fK,{"data-icon":"inline-start"}),t("errorDifferentPhoto")]}),(0,A.jsx)(f7,{className:"text-text-sub"})]})]})}function f5({view:e}){let{t}=rT();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((t,r)=>(0,A.jsx)(f9,{compact:r>0,onAddToCart:e.addToCart,productName:t.productName??e.productName,productUrl:t.productUrl??e.productUrl,result:t,onDeleteResult:e.deleteResult,onOpenComparison:e.openComparison,onSaveResult:e.saveResult,onShareResult:e.shareResult},t.id??t.after.id))})}):(0,A.jsxs)(f6,{className:"pb-6",subtitle:void 0,title:t("resultTitle"),children:[(0,A.jsx)(fL,{className:"mt-6",productLabel:e.productName??t("resultProductLink"),productUrl:e.productUrl,zoomLabel:t("resultOpenComparison"),result:e.result,onOpenComparison:()=>e.openComparison(e.result?.id)}),(0,A.jsxs)(f8,{className:"mt-4",children:[(0,A.jsxs)(i4,{className:"w-full",size:"lg",type:"button",variant:"contrast",onClick:e.addToCart,children:[(0,A.jsx)(h7,{"data-icon":"inline-start"}),t("resultTryAnother")]}),(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)(fK,{"data-icon":"inline-start"}),t("resultCompare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.shareResult(e.result?.id),children:[(0,A.jsx)(fa,{"data-icon":"inline-start"}),t("resultShare")]}),(0,A.jsxs)(i4,{type:"button",variant:"outline",onClick:()=>e.saveResult(e.result?.id),children:[(0,A.jsx)(ft,{"data-icon":"inline-start"}),t("resultReset")]})]})]})]})}function f9({compact:e=!1,onAddToCart:t,onDeleteResult:r,onOpenComparison:n,onSaveResult:a,onShareResult:o,productName:i,productUrl:s,result:l}){let{t:u}=rT(),c=i??u("resultProductLink");return(0,A.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,A.jsx)(fL,{productLabel:c,productUrl:s,zoomLabel:u("resultOpenComparison"),result:l,onOpenComparison:()=>n(l.id)}),(0,A.jsxs)("div",{className:"flex gap-2",children:[(0,A.jsxs)(i4,{className:"min-w-0 flex-1",size:"default",type:"button",variant:"contrast",onClick:t,children:[(0,A.jsx)(h7,{"data-icon":"inline-start"}),(0,A.jsx)("span",{className:"truncate",children:u("resultTryAnother")})]}),(0,A.jsx)(i4,{"aria-label":u("share"),size:"icon",type:"button",variant:"outline",onClick:()=>o(l.id),children:(0,A.jsx)(fa,{"data-icon":"inline-start"})}),(0,A.jsx)(i4,{"aria-label":u("download"),size:"icon",type:"button",variant:"outline",onClick:()=>a(l.id),children:(0,A.jsx)(ft,{"data-icon":"inline-start"})}),!e&&(0,A.jsx)(i4,{"aria-label":u("reset"),size:"icon",type:"button",variant:"outline",onClick:()=>r(l.id),children:(0,A.jsx)(fr,{"data-icon":"inline-start"})})]})]})}function f4({label:e,onClick:t}){return(0,A.jsx)(i4,{"aria-label":e,size:"icon",type:"button",variant:"outline",onClick:t,children:(0,A.jsx)(fH,{className:"rotate-180 !size-3","data-icon":"inline-start"})})}function f6({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 f8({children:e,className:t}){return(0,A.jsx)("div",{className:i2("flex flex-col gap-2",t),children:e})}function f7({className:e}){var t;let{i18n:r,t:n}=rT(),a=(t=r.resolvedLanguage??r.language,t?.startsWith("ru")?fY:fX);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 ge(e){return"string"==typeof e?e.trim():""}function gt(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 gr(e,t,r){let n=await gt(r)(e,{body:t,method:"PUT"});if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`Nano Banana image upload failed with status ${n.status}${e?`: ${e}`:""}`)}}async function gn(e,t){let r=e?.trim();return r?go(r,t,"AI try-on product image fetch failed"):null}async function ga(e,t){return e.blob?e.blob:e.file?e.file:e.src?go(e.src,t,"AI try-on source photo fetch failed"):null}async function go(e,t,r){let n=await gt(t)(e);if(!n.ok){let e=await n.text().catch(()=>"");throw Error(`${r} with status ${n.status}${e?`: ${e}`:""}`)}return n.blob()}async function gi(e){if(e instanceof Blob)return e.type?e:new Blob([e],{type:"image/jpeg"});if(e instanceof ArrayBuffer||"string"==typeof e)return new Blob([e],{type:"image/jpeg"});throw Error("AI try-on generation did not return an image")}let gs="ai-try-on-result";async function gl(e,t={}){let r=await gc(e,t.fetch),n=t.document??globalThis.document;if(!r||!n?.body)return!1;let a=t.createObjectUrl??gp,o=t.revokeObjectUrl??gh,i=a(r);if(!i)return!1;let s=n.createElement("a");return s.href=i,s.download=gd(r,e,t.filename),s.style.display="none",n.body.appendChild(s),s.click(),s.remove(),o(i),!0}async function gu(e,t={}){let r=await gc(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],gd(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 gl(e,t)}async function gc(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 gd(e,t,r=gs){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,"")||gs;return`${o}.${a}`}function gp(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""}function gh(e){"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}let gf="results";function gg(){return void 0===globalThis.indexedDB?null:globalThis.indexedDB}function gm(e){return new Promise((t,r)=>{let n=e.open("neurodyn-ai-try-on",1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(gf)||e.createObjectStore(gf,{keyPath:"id"}).createIndex("createdAt","createdAt")},n.onerror=()=>r(n.error),n.onsuccess=()=>t(n.result)})}function gv(e){return new Promise((t,r)=>{e.onabort=()=>r(e.error),e.onerror=()=>r(e.error),e.oncomplete=()=>t()})}async function gy(e){return{after:await gb(e.after),before:await gb(e.before),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productUrl:e.productUrl}}async function gb(e){let t=await gw(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 gw(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 gk(e){return`neurodyn_ai_try_on_seen_tip:${e}`}function gx(e,t=gS()){if(t)try{t.setItem(gk(e),"true")}catch{}}function gS(){try{return void 0===globalThis.localStorage?null:globalThis.localStorage}catch{return null}}let gC={delete:async function e(e){let t=gg();if(!t)return!1;try{let r=await gm(t),n=r.transaction(gf,"readwrite"),a=gv(n);return n.objectStore(gf).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=gg();if(!e)return[];try{var t;let r=await gm(e),n=r.transaction(gf,"readonly"),a=gv(n),o=await (t=n.objectStore(gf).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=gg();if(!t)return!1;try{let r=await gy(e),n=await gm(t),a=n.transaction(gf,"readwrite"),o=gv(a);return a.objectStore(gf).put(r),await o,n.close(),!0}catch(e){throw Error("AI try-on result could not be saved to history",{cause:e})}}},gP={save:gl,share:gu},gE={consumeFirstView:function(e,t=gS()){return!function(e,t=gS()){if(!t)return!1;try{return"true"===t.getItem(gk(e))}catch{return!1}}(e,t)&&(gx(e,t),!0)},markSeen:gx},gT={createObjectUrl:e=>"function"==typeof URL.createObjectURL?URL.createObjectURL(e):"",revokeObjectUrl:e=>{"function"==typeof URL.revokeObjectURL&&URL.revokeObjectURL(e)}},gR=["image/jpeg","image/png"];class gO{createObjectUrl;tipStore;state;constructor({createObjectUrl:e,productImageSrc:t,productName:r,productType:n,productUrl:a,tipStore:o}){this.createObjectUrl=e,this.tipStore=o,this.state={comparisonOpen:!1,comparisonResultId:null,error:null,generationProduct:null,history:[],myFitsOpen:!1,processingProgress:0,productImageSrc:t,productName:r,productType:n,productUrl:a,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,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,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,productType:r,productUrl:n}){this.state={...this.state,productImageSrc:e,productName:t,productType:r,productUrl:n}}hydrateHistory(e){this.state={...this.state,error:null,history:[...e,...this.state.history].reduce((e,t)=>gj(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.tipStore.consumeFirstView(this.state.productType)?(this.state={...this.state,stage:"intro"},null):{type:"request-file-input"}}continueIntro(){return this.tipStore.markSeen(this.state.productType),{type:"request-file-input"}}requestClose(){return"intro"===this.state.stage?(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,gR.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,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:gj(this.state.history,r),myFitsOpen:!1,processingProgress:100,result:r,selectedPhoto:r.before,stage:"result"},r}failGeneration(e){this.state={...this.state,error:{kind:"generation",message:e},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=>!g_(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=>g_(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,productUrl:this.state.productUrl}}getComparisonResult(){return this.state.comparisonOpen?this.state.comparisonResultId?this.findResult(this.state.comparisonResultId):this.state.result:null}}function gj(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.createdAt-e.createdAt)}function g_(e,t){return e.id===t||e.after.id===t}function gz(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 gN(e,t){t&&(gA(e,t.before),gA(e,t.after))}function gA(e,t){gL(t)?.forEach(t=>e.add(t))}function gL(e){return e?.src?.startsWith("blob:")?[e.src]:null}function gI(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))}function gM({dialogPortalContainer:e,language:t,onClose:r,processPhoto:n,productImageSrc:a,productName:o,productType:i,productUrl:s,tryOnClient:l,apiKey:u,showDialogCloseButton:c=!1}){sX(i);let{i18n:d,t:p}=rT(),h=(0,L.useRef)(null),f=sN(u),g=(0,L.useMemo)(()=>l??sV({apiKey:f}),[l,f]);(0,L.useEffect)(()=>{"string"==typeof t&&d.changeLanguage(t)},[d,t]);let m=function({historyStore:e=gC,objectUrls:t=gT,onRequestClose:r,onRequestFileInput:n,processPhoto:a,productImageSrc:o,productName:i,productType:s,productUrl:l,tryOnClient:u,resultActions:c=gP,tipStore:d=gE}){var p;let[,h]=(0,L.useReducer)(e=>e+1,0),f=(0,L.useRef)(new Set),g=(0,L.useCallback)(e=>{let r=t.createObjectUrl(e);return r&&f.current.add(r),r},[t]),m=(0,L.useRef)(null);m.current||(m.current=new gO({createObjectUrl:g,productImageSrc:o,productName:i,productType:s,productUrl:l,tipStore:d}));let v=m.current;v.updateProduct({productImageSrc:o,productName:i,productType:s,productUrl:l});let y=(0,L.useMemo)(()=>a??function({createObjectUrl:e=function(e){return"function"==typeof URL.createObjectURL?URL.createObjectURL(e):""},fetch:t,productImageSrc:r,productType:n,tryOnClient:a,apiKey:o}){sX(n);let i=a??sV({apiKey:o});return async function(a,o){let s;o?.reportProgress(4);let l=await ga(a,t);if(!l||l.size<=0)throw Error("AI try-on source photo is empty");o?.reportProgress(12);let u=await gn(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=ge(e.key),r=ge(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([gr(c.uploadUrl,l,t),gr(d.uploadUrl,u,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 h=await gi(s);if(h.size<=0)throw Error("AI try-on generation returned an empty 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:g,productImageSrc:o,productType:s,tryOnClient:u}),[g,a,o,s,u]),b=(0,L.useCallback)(e=>{if(e){if("request-file-input"===e.type)return void n();r?.()}},[r,n]),w=(0,L.useCallback)(()=>h(),[]),k=(0,L.useCallback)(e=>{let t=e()??null;w(),b(t)},[b,w]),x=(0,L.useCallback)(e=>{v.failHistory(e),w()},[v,w]),S=(0,L.useCallback)(t=>{e.save(t).catch(()=>{x("save-result")})},[e,x]),C=(0,L.useCallback)(t=>{e.delete(t).catch(()=>{x("delete-result")})},[e,x]),P=(0,L.useCallback)(()=>{k(()=>v.choosePhoto())},[k,v]),E=(0,L.useCallback)(async()=>{let e=v.selectedPhoto;if(!e||!v.startGeneration())return;w();let t=Date.now();try{var r;let n=await y(e,{reportProgress:e=>{v.reportGenerationProgress(e),w()}});await gI(t);let a=v.completeGeneration(n);r=f.current,gL(a.before)?.forEach(e=>r.add(e)),gL(a.after)?.forEach(e=>r.add(e)),S(a),w()}catch(e){await gI(t),v.failGeneration(e instanceof Error?e.message:void 0),w()}},[S,y,v,w]),T=(0,L.useCallback)(e=>{let t=v.deleteResult(e);t&&C(t.id),w()},[C,v,w]),R=(0,L.useCallback)(e=>{c.save(v.resolveResultActionPhoto(e))},[c,v]),O=(0,L.useCallback)(e=>{c.share(v.resolveResultActionPhoto(e))},[c,v]),j=(0,L.useCallback)(()=>{u.sendWidgetEvent("add_to_cart_from_widget")},[u]);(0,L.useEffect)(()=>{let t=!1;return async function(){try{let r=await e.list();if(t)return;v.hydrateHistory(r.map(e=>({after:gz(e.after,g),before:gz(e.before,g),createdAt:e.createdAt,id:e.id,productImageSrc:e.productImageSrc,productName:e.productName,productUrl:e.productUrl}))),w()}catch{t||x("hydrate-history")}}(),()=>{t=!0}},[g,e,x,v,w]),(0,L.useEffect)(()=>()=>{var e,r;e=f.current,r=t.revokeObjectUrl,e.forEach(e=>r(e)),e.clear()},[t]),(0,L.useEffect)(()=>{var e,r,n,a,o;let i;a=f.current,e=v.view,r=v.comparison.result,n=v.history,i=new Set,"photo"in e&&gA(i,e.photo),"result"===e.stage&&(gN(i,e.result),e.resultHistory.forEach(e=>gN(i,e))),n.forEach(e=>gN(i,e)),gN(i,r),o=t.revokeObjectUrl,a.forEach(e=>{i.has(e)||(o(e),a.delete(e))})},[t,v.view,v.comparison.result,v.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}})(v,{addToCart:j,choosePhoto:P,deleteResult:T,generate:()=>void E(),runSessionCommand:k,saveResult:R,shareResult:O,sync:w}),[j,P,T,E,k,R,v,O,w]);return{canGoBack:"start"!==(p=v.view.stage)&&"intro"!==p&&"processing"!==p&&"error"!==p&&"result"!==p,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)}}(v,{addToCart:j,deleteResult:T,runSessionCommand:k,saveResult:R,shareResult:O}),goBack:()=>k(()=>v.goBack()),requestClose:()=>k(()=>v.requestClose()),selectFile:e=>k(()=>{v.selectFile(e)}),view:_}}({onRequestClose:r,onRequestFileInput:()=>h.current?.click(),processPhoto:n,productImageSrc:a,productName:o,productType:i,productUrl:s,tryOnClient:g}),v=m.view.stage,y="result"===m.view.stage&&m.view.myFitsOpen,b=m.canGoBack?(0,A.jsx)(f4,{label:p("back"),onClick:m.goBack}):null,w="result"===m.view.stage&&m.view.canOpenMyFits?(0,A.jsxs)(i4,{"aria-expanded":y,className:"h-9 px-3.5",type:"button",variant:"outline",onClick:m.view.toggleMyFits,children:[p("myFits"),(0,A.jsx)(sY,{className:i2("!size-3 transition-transform",y&&"rotate-180"),"data-icon":"inline-end"})]}):null;return(0,A.jsxs)(fD,{className:y?"h-svh max-h-svh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]":void 0,"data-ai-try-on-stage":v,children:[(0,A.jsx)(fB,{badge:"history"===v?null:p(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"}}(v)),badgeTone:function(e){switch(e){case"confirm":return"blue";case"result":return"green";case"error":return"red";default:return"gray"}}(v),closeLabel:p("close"),leftSlot:b,middleSlot:w,preferMiddleSlotFirst:"result"===v,showCloseButton:c,onClose:m.requestClose}),(0,A.jsx)("input",{ref:h,accept:"image/jpeg,image/png",className:"hidden",type:"file",onChange:function(e){let t=e.currentTarget.files?.[0];t&&m.selectFile(t),e.currentTarget.value=""}}),(0,A.jsxs)(fV,{children:["start"===m.view.stage?(0,A.jsx)(fZ,{view:m.view}):null,"intro"===m.view.stage?(0,A.jsx)(fJ,{view:m.view}):null,"history"===m.view.stage?(0,A.jsx)(f0,{view:m.view}):null,"confirm"===m.view.stage?(0,A.jsx)(f1,{view:m.view}):null,"processing"===m.view.stage?(0,A.jsx)(f2,{view:m.view}):null,"error"===m.view.stage?(0,A.jsx)(f3,{view:m.view}):null,"result"===m.view.stage?(0,A.jsx)(f5,{view:m.view}):null]},v),m.comparison.open&&(0,A.jsx)(fI,{productName:m.comparison.productName,productUrl:m.comparison.productUrl,portalContainer:e??void 0,result:m.comparison.result,onAddToCart:m.comparison.addToCart,onClose:m.comparison.close,onDeleteResult:m.comparison.deleteResult,onSaveResult:m.comparison.saveResult,onShareResult:m.comparison.shareResult})]})}function gF({defaultOpen:e=!1,language:t,onOpenChange:r,open:n,productImageSrc:a,productName:o,productType:i,productUrl:s,apiKey:l,...u}){sX(i);let c=(0,L.useMemo)(()=>{let e;return(e=rl.createInstance()).use(oo).use(rO).init({defaultNS:"ns1",fallbackLng:"en",interpolation:{escapeValue:!1},lng:t,resources:sU}),e},[t]),[d,p]=(0,L.useState)(null),[h,f]=(0,L.useState)(e),g=(0,L.useRef)(!1),m=void 0!==n,v=m?n:h,y=sN(l),b=(0,L.useMemo)(()=>sV({apiKey:y}),[y]);function w(e){m||f(e),r?.(e)}return(0,L.useEffect)(()=>{if(!v){g.current=!1;return}g.current||(g.current=!0,b.sendWidgetEvent("widget_opened"))},[v,b]),(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:sW}),(0,A.jsx)("div",{ref:p}),d&&(0,A.jsx)(sc,{defaultTheme:"light",root:d,storageKey:"neurodyn-ai-try-on-theme",children:(0,A.jsx)(rR,{i18n:c,children:(0,A.jsx)(gD,{language:t,open:v,portalContainer:d,productImageSrc:a,productName:o,productType:i,productUrl:s,tryOnClient:b,onRequestClose:()=>w(!1),onOpenChange:w,...u})})})]}),document.body)]})}function gD({language:e,onRequestClose:t,portalContainer:r,productImageSrc:n,productName:a,productType:o,productUrl:i,tryOnClient:s,...l}){let{t:u}=rT();return(0,A.jsx)(sr,{...l,children:(0,A.jsxs)(so,{className:"inset-x-0 bottom-0 top-auto block max-h-svh 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:u("dialogTitle")}),(0,A.jsx)(sl,{children:u("dialogDescription")})]}),(0,A.jsx)(gM,{dialogPortalContainer:r,language:e,productImageSrc:n,productName:a,productType:o,productUrl:i,tryOnClient:s,showDialogCloseButton:!0,onClose:t})]})})}sx({baseURL:"https://api.neurodyn.ai/"});var gB=r("../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js");let g$=0,gV="data-neurodyn-ai-try-on-product-type";function gU(e,t){let r=e.getAttribute(t);return r&&r.trim().length>0?r:void 0}function gH(e,t){let r=gU(e,t);if(!r)throw Error(`AI try-on dialog trigger is missing ${t}`);return r}window.__neurodynAiTryOnDialog?.destroy();let gW=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-${g$++}`,document.body.appendChild(this.container),this.root=(0,gB.createRoot)(this.container)),this.root}render(){let e=this.ensureRoot();this.props&&this.openState?e.render((0,L.createElement)(gF,{...this.props,open:!0,onOpenChange:this.handleOpenChange})):e.render(null)}};function gq(e){let t=e.target instanceof Element?e.target.closest("[data-neurodyn-ai-try-on-dialog]"):null;t&&gW.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:gH(e,"data-neurodyn-ai-try-on-product-image-src"),productName:void 0!==t.productName?t.productName:gH(e,"data-neurodyn-ai-try-on-product-name"),productUrl:void 0!==t.productUrl?t.productUrl:gU(e,"data-neurodyn-ai-try-on-product-url"),productType:function(e){if(!sG(e)){let t="string"==typeof e&&e.length>0?` "${e}"`:"";throw Error(`AI try-on product type from ${gV} must be one of: ${sq.join(", ")}; received${t||" no value"}`)}return e}(void 0!==t.productType?t.productType:e.getAttribute(gV)),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",gq),gW.destroy(),window.__neurodynAiTryOnDialog===n&&(window.__neurodynAiTryOnDialog=void 0)}},document.addEventListener("click",gq),window.__neurodynAiTryOnDialog=n})()})();