tanya-chatbot 0.9.5 → 0.9.7

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.
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),n=require("react/jsx-runtime"),Yt=require("@apollo/client"),nt=require("react-redux"),vr=require("@reduxjs/toolkit"),Fo=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const fe=require("axios");require("crypto-js");const Po=require("@iconify/react"),Le=require("react-toastify"),Eo=require("react-dom");function To(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Cn=To(Fo),Oo='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-40{z-index:40}.z-50{z-index:50}.m-1{margin:.25rem}.m-3{margin:.75rem}.m-\\[15px\\]{margin:15px}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-24{margin-bottom:6rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.mr-2{margin-right:.5rem}.mr-6{margin-right:1.5rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-20{height:5rem}.h-28{height:7rem}.h-3{height:.75rem}.h-6{height:1.5rem}.h-\\[120px\\]{height:120px}.h-\\[150px\\]{height:150px}.h-\\[200px\\]{height:200px}.h-\\[60px\\]{height:60px}.h-\\[90vh\\]{height:90vh}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.w-12{width:3rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\\/4{width:75%}.w-5\\/6{width:83.333333%}.w-6{width:1.5rem}.w-72{width:18rem}.w-\\[100vw\\]{width:100vw}.w-\\[120px\\]{width:120px}.w-\\[150px\\]{width:150px}.w-\\[60px\\]{width:60px}.w-\\[64\\.7vw\\]{width:64.7vw}.w-\\[96\\%\\]{width:96%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.max-w-\\[200px\\]{max-width:200px}.max-w-\\[75\\%\\]{max-width:75%}.max-w-\\[90\\%\\]{max-width:90%}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-y-2{row-gap:.5rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.rounded-l-\\[20px\\]{border-top-left-radius:20px;border-bottom-left-radius:20px}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-bl-2xl{border-bottom-left-radius:1rem}.rounded-bl-xl{border-bottom-left-radius:.75rem}.rounded-br-xl{border-bottom-right-radius:.75rem}.rounded-tr-\\[20px\\]{border-top-right-radius:20px}.rounded-tr-\\[5px\\]{border-top-right-radius:5px}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.border-\\[\\#804c9e\\]{--tw-border-opacity: 1;border-color:rgb(128 76 158 / var(--tw-border-opacity, 1))}.border-\\[\\#C9C2DE\\]{--tw-border-opacity: 1;border-color:rgb(201 194 222 / var(--tw-border-opacity, 1))}.border-\\[\\#E5E5E5\\]{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity, 1))}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.bg-\\[\\#553D94\\]{--tw-bg-opacity: 1;background-color:rgb(85 61 148 / var(--tw-bg-opacity, 1))}.bg-\\[\\#6851C6\\]{--tw-bg-opacity: 1;background-color:rgb(104 81 198 / var(--tw-bg-opacity, 1))}.bg-\\[\\#804C9E0D\\]{background-color:#804c9e0d}.bg-\\[\\#A21CAF\\]{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity, 1))}.bg-\\[\\#AB192D\\]{--tw-bg-opacity: 1;background-color:rgb(171 25 45 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E2DBFF\\]{--tw-bg-opacity: 1;background-color:rgb(226 219 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E3DEEF\\]{--tw-bg-opacity: 1;background-color:rgb(227 222 239 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F3F3F3\\]{--tw-bg-opacity: 1;background-color:rgb(243 243 243 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FFFFFF\\],.bg-\\[\\#ffffff\\]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-black\\/30{background-color:#0000004d}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-indigo-300{--tw-bg-opacity: 1;background-color:rgb(165 180 252 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/70{background-color:#ffffffb3}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\\[1px\\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pr-5{padding-right:1.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-nunitoSans{font-family:Nunito Sans}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm,.text-sm\\/5{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-\\[\\#000000\\]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-\\[\\#14121F\\]{--tw-text-opacity: 1;color:rgb(20 18 31 / var(--tw-text-opacity, 1))}.text-\\[\\#18181B\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.text-\\[\\#232323\\]{--tw-text-opacity: 1;color:rgb(35 35 35 / var(--tw-text-opacity, 1))}.text-\\[\\#323135\\]{--tw-text-opacity: 1;color:rgb(50 49 53 / var(--tw-text-opacity, 1))}.text-\\[\\#494949\\]{--tw-text-opacity: 1;color:rgb(73 73 73 / var(--tw-text-opacity, 1))}.text-\\[\\#555555\\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\\[\\#5B5B5B\\]{--tw-text-opacity: 1;color:rgb(91 91 91 / var(--tw-text-opacity, 1))}.text-\\[\\#68656E\\]{--tw-text-opacity: 1;color:rgb(104 101 110 / var(--tw-text-opacity, 1))}.text-\\[\\#959595\\]{--tw-text-opacity: 1;color:rgb(149 149 149 / var(--tw-text-opacity, 1))}.text-\\[\\#EC5050\\]{--tw-text-opacity: 1;color:rgb(236 80 80 / var(--tw-text-opacity, 1))}.text-\\[\\#FBFBFC\\]{--tw-text-opacity: 1;color:rgb(251 251 252 / var(--tw-text-opacity, 1))}.text-\\[\\#FFFFFF\\]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-95{opacity:.95}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_2px_2px_0px_\\#9292BC40\\]{--tw-shadow: 0px 2px 2px 0px #9292BC40;--tw-shadow-colored: 0px 2px 2px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_4px_10px_0px_\\#5F499840\\]{--tw-shadow: 0px 4px 10px 0px #5F499840;--tw-shadow-colored: 0px 4px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-xl{--tw-drop-shadow: drop-shadow(0 20px 13px rgb(0 0 0 / .03)) drop-shadow(0 8px 5px rgb(0 0 0 / .08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-150{animation-duration:.15s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}html,body,#root{margin:0;padding:0}:root{line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;padding:0}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.placeholder\\:text-red-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.placeholder\\:text-red-400::placeholder{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\\:-translate-y-0\\.5:hover{--tw-translate-y: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\\:text-\\[\\#6952C7\\]:hover{--tw-text-opacity: 1;color:rgb(105 82 199 / var(--tw-text-opacity, 1))}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-sm:hover{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:border-transparent:focus{border-color:transparent}.focus\\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-gray-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}@media(min-width:640px){.sm\\:col-span-10{grid-column:span 10 / span 10}.sm\\:col-span-2{grid-column:span 2 / span 2}.sm\\:mx-0{margin-left:0;margin-right:0}.sm\\:w-\\[80vw\\]{width:80vw}.sm\\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:flex-row{flex-direction:row}.sm\\:items-center{align-items:center}.sm\\:justify-start{justify-content:flex-start}}@media(min-width:768px){.md\\:h-\\[100vh\\]{height:100vh}.md\\:w-1\\/2{width:50%}.md\\:w-\\[770px\\]{width:770px}.md\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\\:h-\\[100vh\\]{height:100vh}.lg\\:w-1\\/2{width:50%}.lg\\:w-2\\/3{width:66.666667%}.lg\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:flex-row{flex-direction:row}.lg\\:rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.lg\\:rounded-bl-xl{border-bottom-left-radius:.75rem}}';function Ao(){return g.useEffect(()=>{if(typeof document<"u"){const e=document.createElement("style");return e.textContent=Oo,document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]),null}const Lo={store:{storeCode:"",storeName:"",storeDescription:"",activeCatalogId:0,isDefault:!1,logoDarkBg:"",logoLightBg:"",logoTransparent:"",catalogs:[],themeColor:"",themeContrastColor:"",tanyaThemeColor:"",tanyaThemeColorLight:"",favicon:"",websiteTitle:"",flowId:"",aliasId:"",searchConfigs:{endpoint:"",accessKey:"",secretKey:""},homePageCategories:[],carouselImages:{web:[],mobile:[]},otherImages:{web:[],mobile:[]}}},_n=vr.createSlice({name:"store",initialState:Lo,reducers:{setStore:(e,t)=>{e.store=t.payload}}}),{setStore:Ua}=_n.actions,$o=_n.reducer,Do={product:null},In=vr.createSlice({name:"product",initialState:Do,reducers:{setProduct:(e,t)=>{e.product=t.payload}}}),{setProduct:dr}=In.actions,zo=In.reducer,Mo=vr.configureStore({reducer:{store:$o,product:zo}}),qo=({children:e})=>n.jsx(nt.Provider,{store:Mo,children:e}),Jt=e=>{const t=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:e}});window.dispatchEvent(t)};function Bo({...e}){return n.jsx(Cn.Root,{"data-slot":"popover",...e})}function Ro({...e}){return n.jsx(Cn.Trigger,{"data-slot":"popover-trigger",...e})}const ot=()=>({aiConversationUrl:"https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream",xAPIKey:"BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi",serverUrl:"https://tanya-sfcc-server.vercel.app/",basePath:"sc-api"}),Fn=async()=>{const e="https://tanya-sfcc-server.vercel.app/";try{const t=await fe.post(`${e}api/auth/token-bm-grant?baseUrl=${Ke()}&siteId=${Be()}`);return t.status===200&&t.data.access_token?t.data.access_token:(console.error("Failed to fetch token:",t.data),null)}catch(t){return fe.isAxiosError(t)?console.error("Error fetching token:",t.response||t.message):console.error("Unexpected error:",t),null}},Pn=async e=>{const t="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await fe.post(`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return o.status===200&&o.data?o.data:null}catch(r){return fe.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function yt(){var a;const e=Be(),t="access_token_"+e,r="expires_in_"+e,o=localStorage.getItem(r),s=localStorage.getItem(t);return console.log(s),(a=JSON.parse(sessionStorage.getItem("customerData")||"{}"))!=null&&a.isGuest,console.log("access token found in local storage"),{access_token:s,expires_in:o}}const ur=async(e,t)=>{if(e&&t&&Date.now()<t)return e;try{const r="https://us-east-1lsr29ln3u.auth.us-east-1.amazoncognito.com/oauth2/token",o=new URLSearchParams({grant_type:"client_credentials",client_id:"4i8rd70sgt961tc4dhskgf08c",client_secret:"bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",scope:"default-m2m-resource-server-8xzfzo/read"}),s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o});if(!s.ok)throw new Error(`Token request failed! status: ${s.status}`);const a=await s.json();e=a.access_token;const i=a.expires_in||3600;return t=Date.now()+(i-60)*1e3,e}catch(r){return console.error("Error obtaining JWT token:",r),e=null,t=null,null}},Ke=()=>sessionStorage.getItem("Host"),Be=()=>sessionStorage.getItem("SiteId"),st=()=>sessionStorage.getItem("pubCfg"),at=()=>sessionStorage.getItem("envRef"),it=()=>sessionStorage.getItem("orgRef"),Uo=async e=>{console.log("fetching results");const{serverUrl:t,basePath:r}=ot();let o="";{const s=await yt();console.log("the token from getSearchResults",s),o=s.access_token}try{const s=Ke();return(await fe.get(`${t}${r}/search-sfcc?baseUrl=${s}&query=${e}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(s){throw console.error("Error fetching search results:",s),s}},En=async e=>{if(!e)throw new Error("Product ID is required");const{serverUrl:t,basePath:r}=ot(),o=Ke();console.log("calling access");const{access_token:s}=await yt();return(await fe.get(`${t}${r}/product-sfcc/${e}?baseUrl=${o}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).data},Ho=async e=>{if(!e)throw new Error("customerId is required");const t=await Fn(),{customer_token:r}=await Pn(t),{serverUrl:o,basePath:s}=ot(),i=(await yt()).access_token;return(await fe.get(`${o}${s}/get-interest?baseUrl=${Ke()}&customerId=${e}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},Yr=e=>String(typeof e=="string"?e:e["en-US"]||e),Jr=e=>e!=null&&e.image?[e.image]:"variants"in e?e.variants[0].images:e.masterVariant.images.map(t=>t.url),Vo=(e,t)=>e.toLocaleString("en-US",{style:"currency",currency:t||"USD"}),Kr=e=>{var t,r,o;return"variants"in e?{centAmount:(t=e.variants[0])==null?void 0:t.prices.EUR.max,currencyCode:"DOL"}:{centAmount:(r=e.masterVariant)==null?void 0:r.prices[0].value.centAmount,currencyCode:(o=e.masterVariant)==null?void 0:o.prices[0].value.currencyCode}},Yo=e=>e.charAt(0).toUpperCase()+e.slice(1),Wr=(e,t)=>e.length<t?e:e.slice(0,t)+"...",nr=e=>e.split("\\n").map((t,r)=>{const o=t.match(/^(\d+)\.\s(.+)/);return o?`<p key=${r} class="mb-2"><strong>${o[1]}.</strong> ${o[2]}</p>`:t.trim()?`<p key=${r} class="mb-2">${t}</p>`:"<br/>"}).join("");function Jo(){const e=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[t,r]=g.useState(e);return g.useEffect(()=>{const o=()=>r(e());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}const Ko=({product:e})=>{const t=nt.useDispatch(),r=Jo(),[o,s]=g.useState(0),a=()=>{s(l=>l+r>=e.length?0:l+r)},i=()=>{s(l=>l-r<0?e.length-(e.length%r||r):l-r)},c=async l=>{const h=await En(l);t(dr(h))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:i,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:e.slice(o,o+r).map(l=>{var h,p,w,y;return n.jsxs("div",{className:"flex-shrink-0 flex flex-col w-[150px] h-[200px] p-2 items-center justify-between cursor-pointer bg-[#FFFFFF] rounded-[10px] shadow-[0px_2px_2px_0px_#9292BC40]",onClick:()=>{c(l.product_id??l.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((h=Jr(l)[0])==null?void 0:h.link)||Jr(l)[0]||"https://via.placeholder.com/120",alt:l!=null&&l.productName?l.productName:"Product",className:"w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"})}),n.jsxs("div",{className:"text-white w-full p-2 text-[12px] text-center h-[60px]",children:[n.jsxs("div",{className:"relative inline-block group",children:[n.jsx("div",{className:"w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans",children:l!=null&&l.productName?l.productName:l!=null&&l.product_name?l.product_name:Wr(Yr((p=l==null?void 0:l.name)==null?void 0:p["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:l!=null&&l.productName?l.productName:l!=null&&l.product_name?l.product_name:Wr(Yr((w=l==null?void 0:l.name)==null?void 0:w["en-US"]),60)||"Product"})]}),n.jsxs("div",{className:" flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1",children:[n.jsx("p",{children:Vo(l!=null&&l.price?Number(l==null?void 0:l.price):Kr(l).centAmount||0,(y=Kr(l))==null?void 0:y.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(l==null?void 0:l.price).toFixed(2)??5]})]})]})]},l.productId)})}),(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:a,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},Wo=({chat:e,storeDetails:t})=>n.jsx("div",{className:"bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",children:e.map((r,o)=>n.jsxs("div",{className:"mb-4 p-3 rounded-xl",style:{background:"linear-gradient(109.52deg, #F0EEF5 36.91%, #F4F3EE 100.34%"},children:[n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",children:Yo(r.keyword)||"No keyword"}),n.jsx(Ko,{product:r.items,storeDetails:t})]},o))}),Tn=async(e,t)=>{var a,i;const{serverUrl:r,basePath:o}=ot(),s=`${r}`;try{const c=await fe.post(`${s}${o}/basket/create?baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,t,{headers:{"Content-Type":"application/json",Authorization:e}});return window.postMessage({type:"WIDGET_CREATED_BASKET",basketId:((a=c.data)==null?void 0:a.basket_id)||((i=c.data)==null?void 0:i.basketId)},"*"),c.data}catch(c){return fe.isAxiosError(c)?console.error("Error creating basket:",c.response||c.message):console.error("Unexpected error:",c),null}},fr=async(e,t,r)=>{const{serverUrl:o,basePath:s}=ot(),a=`${o}`;try{const i=await fe.post(`${a}${s}/basket/add-product/${e}?baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,t,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return fe.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},On=async({basketId:e,customer_token:t})=>{var a;const{serverUrl:r,basePath:o}=ot(),s=`${r}`;try{const i=await fe.get(`${s}${o}/basket/${e}?baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:t}});return{status:i.status,data:i.data}}catch(i){return fe.isAxiosError(i)?{status:(a=i.response)==null?void 0:a.status,data:null}:{status:null,data:null}}},Kt="sfcc_basket_id",Qr="sfcc_customer_token",Ft="sfcc_token_expiry",Qo=300*1e3,Dt="1.0.0";const tt=e=>{try{e?localStorage.setItem(Kt,e):localStorage.removeItem(Kt)}catch(t){console.error("Error saving basket ID to storage:",t)}},Wt=e=>{try{if(e){localStorage.setItem(Qr,e);const t=Date.now()+Qo;localStorage.setItem(Ft,t.toString())}else localStorage.removeItem(Qr)}catch(t){console.error("Error storing token:",t)}},Gr=300,Go=({addToCartPwa:e})=>{var l,h,p,w,y,_;const t=nt.useDispatch(),r=nt.useSelector(k=>k.product.product),o=nt.useSelector(k=>k.store.store),[s,a]=g.useState(!!r);if(g.useEffect(()=>{a(!!r)},[r]),!r)return null;const i=async()=>{var k,E,j,C,H,B,z,_e,I,J,he,pe,v,Re,$e,de;try{if(!((E=(k=r==null?void 0:r.variants)==null?void 0:k[0])!=null&&E.product_id)&&!(r.type.item||r.type.bundle)&&!((C=(j=r==null?void 0:r.variants)==null?void 0:j[0])!=null&&C.productId)){Le.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const M=[{product_id:((H=r.variants)==null?void 0:H[0].product_id)||((B=r.variants)==null?void 0:B[0].productId)||(r==null?void 0:r.id),quantity:1}],$=JSON.parse(sessionStorage.getItem("customerData")||"{}"),be=($==null?void 0:$.basketId)||localStorage.getItem(Kt),Ie=!1,Fe=localStorage.getItem(Ft),We=Date.now();if(!Ie||!Fe||We>=parseInt(Fe)){let ge="";if(ge="Bearer "+(await yt()).access_token,!ge){console.error("Failed to get customer_token");return}const Ee=We+300*1e3;if(Wt(ge),localStorage.setItem(Ft,Ee.toString()),be){const Pe=await On({basketId:be,customer_token:ge});if(Pe.status===200&&Pe){const se=await fr(be,M,ge);(((z=se==null?void 0:se.product_items)==null?void 0:z.length)>0||((_e=se==null?void 0:se.productItems)==null?void 0:_e.length)>0)&&(Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(be));return}}const xe={productItems:[{productId:((I=r.variants)==null?void 0:I[0].product_id)||((J=r.variants)==null?void 0:J[0].productId)||(r==null?void 0:r.id),quantity:1}]},S=await Tn(ge,xe);if(!(S!=null&&S.basket_id)&&!(S!=null&&S.basketId)){console.error("Failed to create basket");return}tt((S==null?void 0:S.basket_id)||(S==null?void 0:S.basketId)),console.log("adding product to basket");const ve=await fr((S==null?void 0:S.basket_id)||(S==null?void 0:S.basketId),M,ge);console.log("object added to basket"),(((he=ve==null?void 0:ve.product_items)==null?void 0:he.length)>0||((pe=ve==null?void 0:ve.productItems)==null?void 0:pe.length)>0)&&Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(S.basket_id||(S==null?void 0:S.basketId))}}catch(M){console.error("Error adding to cart:",M),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((v=M==null?void 0:M.response)==null?void 0:v.status)===404||((Re=M==null?void 0:M.response)==null?void 0:Re.status)===401?((($e=M==null?void 0:M.response)==null?void 0:$e.status)===404&&tt(null),((de=M==null?void 0:M.response)==null?void 0:de.status)===401&&(tt(null),Wt(null))):(console.error("Failed to add product to basket:",M.message),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},c=()=>{if(!r)return;const k=window.location.origin+"/product/"+r.id;console.log("path",k),window.location.href=k};return console.log(r,"the prod"),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>{a(!1),setTimeout(()=>t(dr(null)),Gr)}}),n.jsxs("div",{className:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),n=require("react/jsx-runtime"),Yt=require("@apollo/client"),nt=require("react-redux"),vr=require("@reduxjs/toolkit"),Fo=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const fe=require("axios");require("crypto-js");const Po=require("@iconify/react"),$e=require("react-toastify"),Eo=require("react-dom");function To(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Cn=To(Fo),Oo='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-40{z-index:40}.z-50{z-index:50}.m-1{margin:.25rem}.m-3{margin:.75rem}.m-\\[15px\\]{margin:15px}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-24{margin-bottom:6rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.mr-2{margin-right:.5rem}.mr-6{margin-right:1.5rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-20{height:5rem}.h-28{height:7rem}.h-3{height:.75rem}.h-6{height:1.5rem}.h-\\[120px\\]{height:120px}.h-\\[150px\\]{height:150px}.h-\\[200px\\]{height:200px}.h-\\[60px\\]{height:60px}.h-\\[90vh\\]{height:90vh}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.w-12{width:3rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\\/4{width:75%}.w-5\\/6{width:83.333333%}.w-6{width:1.5rem}.w-72{width:18rem}.w-\\[100vw\\]{width:100vw}.w-\\[120px\\]{width:120px}.w-\\[150px\\]{width:150px}.w-\\[60px\\]{width:60px}.w-\\[64\\.7vw\\]{width:64.7vw}.w-\\[96\\%\\]{width:96%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.max-w-\\[200px\\]{max-width:200px}.max-w-\\[75\\%\\]{max-width:75%}.max-w-\\[90\\%\\]{max-width:90%}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-y-2{row-gap:.5rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.rounded-l-\\[20px\\]{border-top-left-radius:20px;border-bottom-left-radius:20px}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-bl-2xl{border-bottom-left-radius:1rem}.rounded-bl-xl{border-bottom-left-radius:.75rem}.rounded-br-xl{border-bottom-right-radius:.75rem}.rounded-tr-\\[20px\\]{border-top-right-radius:20px}.rounded-tr-\\[5px\\]{border-top-right-radius:5px}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.border-\\[\\#804c9e\\]{--tw-border-opacity: 1;border-color:rgb(128 76 158 / var(--tw-border-opacity, 1))}.border-\\[\\#C9C2DE\\]{--tw-border-opacity: 1;border-color:rgb(201 194 222 / var(--tw-border-opacity, 1))}.border-\\[\\#E5E5E5\\]{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity, 1))}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.bg-\\[\\#553D94\\]{--tw-bg-opacity: 1;background-color:rgb(85 61 148 / var(--tw-bg-opacity, 1))}.bg-\\[\\#6851C6\\]{--tw-bg-opacity: 1;background-color:rgb(104 81 198 / var(--tw-bg-opacity, 1))}.bg-\\[\\#804C9E0D\\]{background-color:#804c9e0d}.bg-\\[\\#A21CAF\\]{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity, 1))}.bg-\\[\\#AB192D\\]{--tw-bg-opacity: 1;background-color:rgb(171 25 45 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E2DBFF\\]{--tw-bg-opacity: 1;background-color:rgb(226 219 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E3DEEF\\]{--tw-bg-opacity: 1;background-color:rgb(227 222 239 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F3F3F3\\]{--tw-bg-opacity: 1;background-color:rgb(243 243 243 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FFFFFF\\],.bg-\\[\\#ffffff\\]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-black\\/30{background-color:#0000004d}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-indigo-300{--tw-bg-opacity: 1;background-color:rgb(165 180 252 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/70{background-color:#ffffffb3}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\\[1px\\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pr-5{padding-right:1.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-nunitoSans{font-family:Nunito Sans}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm,.text-sm\\/5{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-\\[\\#000000\\]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-\\[\\#14121F\\]{--tw-text-opacity: 1;color:rgb(20 18 31 / var(--tw-text-opacity, 1))}.text-\\[\\#18181B\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.text-\\[\\#232323\\]{--tw-text-opacity: 1;color:rgb(35 35 35 / var(--tw-text-opacity, 1))}.text-\\[\\#323135\\]{--tw-text-opacity: 1;color:rgb(50 49 53 / var(--tw-text-opacity, 1))}.text-\\[\\#494949\\]{--tw-text-opacity: 1;color:rgb(73 73 73 / var(--tw-text-opacity, 1))}.text-\\[\\#555555\\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\\[\\#5B5B5B\\]{--tw-text-opacity: 1;color:rgb(91 91 91 / var(--tw-text-opacity, 1))}.text-\\[\\#68656E\\]{--tw-text-opacity: 1;color:rgb(104 101 110 / var(--tw-text-opacity, 1))}.text-\\[\\#959595\\]{--tw-text-opacity: 1;color:rgb(149 149 149 / var(--tw-text-opacity, 1))}.text-\\[\\#EC5050\\]{--tw-text-opacity: 1;color:rgb(236 80 80 / var(--tw-text-opacity, 1))}.text-\\[\\#FBFBFC\\]{--tw-text-opacity: 1;color:rgb(251 251 252 / var(--tw-text-opacity, 1))}.text-\\[\\#FFFFFF\\]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-95{opacity:.95}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_2px_2px_0px_\\#9292BC40\\]{--tw-shadow: 0px 2px 2px 0px #9292BC40;--tw-shadow-colored: 0px 2px 2px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_4px_10px_0px_\\#5F499840\\]{--tw-shadow: 0px 4px 10px 0px #5F499840;--tw-shadow-colored: 0px 4px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-xl{--tw-drop-shadow: drop-shadow(0 20px 13px rgb(0 0 0 / .03)) drop-shadow(0 8px 5px rgb(0 0 0 / .08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-150{animation-duration:.15s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}html,body,#root{margin:0;padding:0}:root{line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;padding:0}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.placeholder\\:text-red-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.placeholder\\:text-red-400::placeholder{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\\:-translate-y-0\\.5:hover{--tw-translate-y: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\\:text-\\[\\#6952C7\\]:hover{--tw-text-opacity: 1;color:rgb(105 82 199 / var(--tw-text-opacity, 1))}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\\:shadow-sm:hover{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:border-transparent:focus{border-color:transparent}.focus\\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-gray-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}@media(min-width:640px){.sm\\:col-span-10{grid-column:span 10 / span 10}.sm\\:col-span-2{grid-column:span 2 / span 2}.sm\\:mx-0{margin-left:0;margin-right:0}.sm\\:w-\\[80vw\\]{width:80vw}.sm\\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:flex-row{flex-direction:row}.sm\\:items-center{align-items:center}.sm\\:justify-start{justify-content:flex-start}}@media(min-width:768px){.md\\:h-\\[100vh\\]{height:100vh}.md\\:w-1\\/2{width:50%}.md\\:w-\\[770px\\]{width:770px}.md\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\\:h-\\[100vh\\]{height:100vh}.lg\\:w-1\\/2{width:50%}.lg\\:w-2\\/3{width:66.666667%}.lg\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:flex-row{flex-direction:row}.lg\\:rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.lg\\:rounded-bl-xl{border-bottom-left-radius:.75rem}}';function Ao(){return g.useEffect(()=>{if(typeof document<"u"){const e=document.createElement("style");return e.textContent=Oo,document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]),null}const $o={store:{storeCode:"",storeName:"",storeDescription:"",activeCatalogId:0,isDefault:!1,logoDarkBg:"",logoLightBg:"",logoTransparent:"",catalogs:[],themeColor:"",themeContrastColor:"",tanyaThemeColor:"",tanyaThemeColorLight:"",favicon:"",websiteTitle:"",flowId:"",aliasId:"",searchConfigs:{endpoint:"",accessKey:"",secretKey:""},homePageCategories:[],carouselImages:{web:[],mobile:[]},otherImages:{web:[],mobile:[]}}},_n=vr.createSlice({name:"store",initialState:$o,reducers:{setStore:(e,t)=>{e.store=t.payload}}}),{setStore:Ua}=_n.actions,Lo=_n.reducer,Do={product:null},In=vr.createSlice({name:"product",initialState:Do,reducers:{setProduct:(e,t)=>{e.product=t.payload}}}),{setProduct:dr}=In.actions,zo=In.reducer,Mo=vr.configureStore({reducer:{store:Lo,product:zo}}),qo=({children:e})=>n.jsx(nt.Provider,{store:Mo,children:e}),Jt=e=>{const t=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:e}});window.dispatchEvent(t)};function Bo({...e}){return n.jsx(Cn.Root,{"data-slot":"popover",...e})}function Ro({...e}){return n.jsx(Cn.Trigger,{"data-slot":"popover-trigger",...e})}const ot=()=>({aiConversationUrl:"https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream",xAPIKey:"BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi",serverUrl:"https://tanya-sfcc-server.vercel.app/",basePath:"sc-api"}),Fn=async()=>{const e="https://tanya-sfcc-server.vercel.app/";try{const t=await fe.post(`${e}api/auth/token-bm-grant?baseUrl=${Ke()}&siteId=${Be()}`);return t.status===200&&t.data.access_token?t.data.access_token:(console.error("Failed to fetch token:",t.data),null)}catch(t){return fe.isAxiosError(t)?console.error("Error fetching token:",t.response||t.message):console.error("Unexpected error:",t),null}},Pn=async e=>{const t="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await fe.post(`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return o.status===200&&o.data?o.data:null}catch(r){return fe.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function yt(){var a;const e=Be(),t="access_token_"+e,r="expires_in_"+e,o=localStorage.getItem(r),s=localStorage.getItem(t);return console.log(s),(a=JSON.parse(sessionStorage.getItem("customerData")||"{}"))!=null&&a.isGuest,console.log("access token found in local storage"),{access_token:s,expires_in:o}}const ur=async(e,t)=>{if(e&&t&&Date.now()<t)return e;try{const r="https://us-east-1lsr29ln3u.auth.us-east-1.amazoncognito.com/oauth2/token",o=new URLSearchParams({grant_type:"client_credentials",client_id:"4i8rd70sgt961tc4dhskgf08c",client_secret:"bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",scope:"default-m2m-resource-server-8xzfzo/read"}),s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o});if(!s.ok)throw new Error(`Token request failed! status: ${s.status}`);const a=await s.json();e=a.access_token;const i=a.expires_in||3600;return t=Date.now()+(i-60)*1e3,e}catch(r){return console.error("Error obtaining JWT token:",r),e=null,t=null,null}},Ke=()=>sessionStorage.getItem("Host"),Be=()=>sessionStorage.getItem("SiteId"),st=()=>sessionStorage.getItem("pubCfg"),at=()=>sessionStorage.getItem("envRef"),it=()=>sessionStorage.getItem("orgRef"),Uo=async e=>{console.log("fetching results");const{serverUrl:t,basePath:r}=ot();let o="";{const s=await yt();console.log("the token from getSearchResults",s),o=s.access_token}try{const s=Ke();return(await fe.get(`${t}${r}/search-sfcc?baseUrl=${s}&query=${e}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(s){throw console.error("Error fetching search results:",s),s}},En=async e=>{if(!e)throw new Error("Product ID is required");const{serverUrl:t,basePath:r}=ot(),o=Ke();console.log("calling access");const{access_token:s}=await yt();return(await fe.get(`${t}${r}/product-sfcc/${e}?baseUrl=${o}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).data},Ho=async e=>{if(!e)throw new Error("customerId is required");const t=await Fn(),{customer_token:r}=await Pn(t),{serverUrl:o,basePath:s}=ot(),i=(await yt()).access_token;return(await fe.get(`${o}${s}/get-interest?baseUrl=${Ke()}&customerId=${e}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},Yr=e=>String(typeof e=="string"?e:e["en-US"]||e),Jr=e=>e!=null&&e.image?[e.image]:"variants"in e?e.variants[0].images:e.masterVariant.images.map(t=>t.url),Vo=(e,t)=>e.toLocaleString("en-US",{style:"currency",currency:t||"USD"}),Kr=e=>{var t,r,o;return"variants"in e?{centAmount:(t=e.variants[0])==null?void 0:t.prices.EUR.max,currencyCode:"DOL"}:{centAmount:(r=e.masterVariant)==null?void 0:r.prices[0].value.centAmount,currencyCode:(o=e.masterVariant)==null?void 0:o.prices[0].value.currencyCode}},Yo=e=>e.charAt(0).toUpperCase()+e.slice(1),Wr=(e,t)=>e.length<t?e:e.slice(0,t)+"...",nr=e=>e.split("\\n").map((t,r)=>{const o=t.match(/^(\d+)\.\s(.+)/);return o?`<p key=${r} class="mb-2"><strong>${o[1]}.</strong> ${o[2]}</p>`:t.trim()?`<p key=${r} class="mb-2">${t}</p>`:"<br/>"}).join("");function Jo(){const e=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[t,r]=g.useState(e);return g.useEffect(()=>{const o=()=>r(e());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}const Ko=({product:e})=>{const t=nt.useDispatch(),r=Jo(),[o,s]=g.useState(0),a=()=>{s(l=>l+r>=e.length?0:l+r)},i=()=>{s(l=>l-r<0?e.length-(e.length%r||r):l-r)},c=async l=>{const h=await En(l);t(dr(h))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:i,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:e.slice(o,o+r).map(l=>{var h,p,w,y;return n.jsxs("div",{className:"flex-shrink-0 flex flex-col w-[150px] h-[200px] p-2 items-center justify-between cursor-pointer bg-[#FFFFFF] rounded-[10px] shadow-[0px_2px_2px_0px_#9292BC40]",onClick:()=>{c(l.product_id??l.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((h=Jr(l)[0])==null?void 0:h.link)||Jr(l)[0]||"https://via.placeholder.com/120",alt:l!=null&&l.productName?l.productName:"Product",className:"w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"})}),n.jsxs("div",{className:"text-white w-full p-2 text-[12px] text-center h-[60px]",children:[n.jsxs("div",{className:"relative inline-block group",children:[n.jsx("div",{className:"w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans",children:l!=null&&l.productName?l.productName:l!=null&&l.product_name?l.product_name:Wr(Yr((p=l==null?void 0:l.name)==null?void 0:p["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:l!=null&&l.productName?l.productName:l!=null&&l.product_name?l.product_name:Wr(Yr((w=l==null?void 0:l.name)==null?void 0:w["en-US"]),60)||"Product"})]}),n.jsxs("div",{className:" flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1",children:[n.jsx("p",{children:Vo(l!=null&&l.price?Number(l==null?void 0:l.price):Kr(l).centAmount||0,(y=Kr(l))==null?void 0:y.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(l==null?void 0:l.price).toFixed(2)??5]})]})]})]},l.productId)})}),(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:a,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},Wo=({chat:e,storeDetails:t})=>n.jsx("div",{className:"bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",children:e.map((r,o)=>n.jsxs("div",{className:"mb-4 p-3 rounded-xl",style:{background:"linear-gradient(109.52deg, #F0EEF5 36.91%, #F4F3EE 100.34%"},children:[n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",children:Yo(r.keyword)||"No keyword"}),n.jsx(Ko,{product:r.items,storeDetails:t})]},o))}),Tn=async(e,t)=>{var a,i;const{serverUrl:r,basePath:o}=ot(),s=`${r}`;try{const c=await fe.post(`${s}${o}/basket/create?baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,t,{headers:{"Content-Type":"application/json",Authorization:e}});return window.postMessage({type:"WIDGET_CREATED_BASKET",basketId:((a=c.data)==null?void 0:a.basket_id)||((i=c.data)==null?void 0:i.basketId)},"*"),c.data}catch(c){return fe.isAxiosError(c)?console.error("Error creating basket:",c.response||c.message):console.error("Unexpected error:",c),null}},fr=async(e,t,r)=>{const{serverUrl:o,basePath:s}=ot(),a=`${o}`;try{const i=await fe.post(`${a}${s}/basket/add-product/${e}?baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,t,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return fe.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},On=async({basketId:e,customer_token:t})=>{var a;const{serverUrl:r,basePath:o}=ot(),s=`${r}`;try{const i=await fe.get(`${s}${o}/basket/${e}?baseUrl=${Ke()}&siteId=${Be()}&pubCfg=${st()}&envRef=${at()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:t}});return{status:i.status,data:i.data}}catch(i){return fe.isAxiosError(i)?{status:(a=i.response)==null?void 0:a.status,data:null}:{status:null,data:null}}},Kt="sfcc_basket_id",Qr="sfcc_customer_token",Ft="sfcc_token_expiry",Qo=300*1e3,Dt="1.0.0";const tt=e=>{try{e?localStorage.setItem(Kt,e):localStorage.removeItem(Kt)}catch(t){console.error("Error saving basket ID to storage:",t)}},Wt=e=>{try{if(e){localStorage.setItem(Qr,e);const t=Date.now()+Qo;localStorage.setItem(Ft,t.toString())}else localStorage.removeItem(Qr)}catch(t){console.error("Error storing token:",t)}},Gr=300,Go=({addToCartPwa:e})=>{var l,h,p,w,y,_;const t=nt.useDispatch(),r=nt.useSelector(k=>k.product.product),o=nt.useSelector(k=>k.store.store),[s,a]=g.useState(!!r);if(g.useEffect(()=>{a(!!r)},[r]),!r)return null;const i=async()=>{var k,E,j,C,H,B,z,_e,I,J,he,pe,v,Re,Le,de;try{if(!((E=(k=r==null?void 0:r.variants)==null?void 0:k[0])!=null&&E.product_id)&&!(r.type.item||r.type.bundle)&&!((C=(j=r==null?void 0:r.variants)==null?void 0:j[0])!=null&&C.productId)){$e.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const M=[{product_id:((H=r.variants)==null?void 0:H[0].product_id)||((B=r.variants)==null?void 0:B[0].productId)||(r==null?void 0:r.id),quantity:1}],L=JSON.parse(sessionStorage.getItem("customerData")||"{}"),be=(L==null?void 0:L.basketId)||localStorage.getItem(Kt),Ie=!1,Fe=localStorage.getItem(Ft),We=Date.now();if(!Ie||!Fe||We>=parseInt(Fe)){let ge="";if(ge="Bearer "+(await yt()).access_token,!ge){console.error("Failed to get customer_token");return}const Ee=We+300*1e3;if(Wt(ge),localStorage.setItem(Ft,Ee.toString()),be){const Pe=await On({basketId:be,customer_token:ge});if(Pe.status===200&&Pe){const se=await fr(be,M,ge);(((z=se==null?void 0:se.product_items)==null?void 0:z.length)>0||((_e=se==null?void 0:se.productItems)==null?void 0:_e.length)>0)&&($e.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(be));return}}const xe={productItems:[{productId:((I=r.variants)==null?void 0:I[0].product_id)||((J=r.variants)==null?void 0:J[0].productId)||(r==null?void 0:r.id),quantity:1}]},S=await Tn(ge,xe);if(!(S!=null&&S.basket_id)&&!(S!=null&&S.basketId)){console.error("Failed to create basket");return}tt((S==null?void 0:S.basket_id)||(S==null?void 0:S.basketId)),console.log("adding product to basket");const ve=await fr((S==null?void 0:S.basket_id)||(S==null?void 0:S.basketId),M,ge);console.log("object added to basket"),(((he=ve==null?void 0:ve.product_items)==null?void 0:he.length)>0||((pe=ve==null?void 0:ve.productItems)==null?void 0:pe.length)>0)&&$e.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(S.basket_id||(S==null?void 0:S.basketId))}}catch(M){console.error("Error adding to cart:",M),$e.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((v=M==null?void 0:M.response)==null?void 0:v.status)===404||((Re=M==null?void 0:M.response)==null?void 0:Re.status)===401?(((Le=M==null?void 0:M.response)==null?void 0:Le.status)===404&&tt(null),((de=M==null?void 0:M.response)==null?void 0:de.status)===401&&(tt(null),Wt(null))):(console.error("Failed to add product to basket:",M.message),$e.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},c=()=>{if(!r)return;const k=window.location.origin+"/product/"+r.id;console.log("path",k),window.location.href=k};return console.log(r,"the prod"),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>{a(!1),setTimeout(()=>t(dr(null)),Gr)}}),n.jsxs("div",{className:`
2
2
  flex flex-col gap-2 items-center h-[90vh] absolute right-0 bottom-0 z-50 w-full md:w-1/2 md:h-[100vh] lg:w-1/2 lg:h-[100vh] shadow-xl p-2 border-l-2 bg-white border-gray-200 overflow-y-scroll
3
3
  transition-all duration-300
4
4
  ${s?"translate-y-0 md:translate-y-0 md:translate-x-0 opacity-100":"translate-y-full md:translate-y-0 md:translate-x-full opacity-0 pointer-events-none"}
5
5
  `,style:{willChange:"transform, opacity"},onClick:k=>k.stopPropagation(),children:[n.jsxs("div",{className:"mt-3 flex flex-row justify-between w-full ",children:[n.jsx("div",{children:n.jsx("p",{className:"text-[#000000] font-bold font-nunitoSans",children:r.name})}),n.jsx("div",{children:n.jsx("div",{className:"text-[#555555] w-6 h-6 cursor-pointer",onClick:()=>{a(!1),setTimeout(()=>t(dr(null)),Gr)},children:"✕"})})]}),n.jsxs("div",{className:"flex flex-row gap-2 items-center flex-wrap",children:[n.jsx("div",{className:"flex flex-row items-center justify-center w-[120px] h-[120px] my-5",children:n.jsx("img",{src:(w=(p=(h=(l=r.imageGroups)==null?void 0:l[0])==null?void 0:h.images)==null?void 0:p[0])==null?void 0:w.link,alt:r.name,className:"rounded-[10px]"})}),n.jsx("div",{className:"flex flex-col items-center gap-2",children:r.imageGroups.slice(1,2).map(k=>k.images.slice(1,2).map(E=>n.jsx("img",{src:E.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},E.link)))})]}),n.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[n.jsxs("div",{className:"flex flex-row items-center gap-2",children:[n.jsxs("p",{className:"text-[#14121F] font-bold font-nunitoSans",children:[" ","$",r.price.toFixed(2)]})," ",n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans",children:[" ","$",(r.price+5).toFixed(2)]})]}),n.jsx("div",{children:n.jsx("p",{className:"text-[#EC5050] font-bold font-nunitoSans",children:r.discount})})]}),n.jsx("div",{className:"mt-2 w-full border-t-2 border-gray-200"}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("div",{className:"text-[#323135] font-bold font-nunitoSans mt-3 text-[14px]",children:"Product Details"}),n.jsx("div",{className:"text-[#68656E] font-normal font-nunitoSans text-xs pl-2 mt-3",dangerouslySetInnerHTML:{__html:r.short_description||r.longDescription}})]}),n.jsxs("div",{className:"mt-4 flex flex-col gap-2 w-full p-2",children:[n.jsx("div",{className:"flex flex-row items-center gap-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-left font-nunitoSans",children:[n.jsxs("div",{className:"text-[#323135] font-bold",children:[((y=r==null?void 0:r.rating)==null?void 0:y.rate)||0," /"," ",n.jsx("span",{className:"text-[#68656E]",children:"5"})]}),n.jsx("div",{className:"text-[#323135] font-semibold text-sm",children:"Overall Rating"}),n.jsxs("div",{className:"text-[#68656E] font-semibold text-sm",children:[((_=r==null?void 0:r.rating)==null?void 0:_.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((k,E)=>{var j;return n.jsx(Po.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
6
6
  ${((j=r==null?void 0:r.rating)==null?void 0:j.rate)>E?"text-yellow-500":"text-gray-300"}
7
- `},E)})})]}),n.jsxs("div",{className:"flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",style:{marginTop:"40px"},children:[n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",style:{backgroundColor:o.tanyaThemeColor},onClick:i,children:"Add to Cart"}),n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",style:{backgroundColor:o.tanyaThemeColor},onClick:c,children:"View more"})]})]})]})},Xo=({tanyaConfig:e,basketId:t,addToCart:r})=>{const o=["Myself","My Child","My Grandchild","Niece/Nephew","My Friends","Others"],s={Myself:"himself/herself","My Child":"his/her child","My Grandchild":"his/her grandchild","Niece/Nephew":"his/her niece/nephew","My Friends":"his/her friends",Others:"others"},a=g.useRef(null),i=g.useRef(null),c=g.useRef(null),l=g.useRef(null),[h,p]=g.useState(null);g.useRef(null);const[w,y]=g.useState(!1),[_,k]=g.useState(!1),[E,j]=g.useState(!1),[C,H]=g.useState(!1),[B,z]=g.useState(!1),[_e,I]=g.useState(!1),[J,he]=g.useState(""),[pe,v]=g.useState(""),Re=f=>({id:f.id,title:f.name,image:f.image??"",price:f.price??0}),[$e,de]=g.useState([]),M=g.useRef(null),$=nt.useSelector(f=>f.store.store),be=nt.useSelector(f=>f.product.product);g.useEffect(()=>{const f=localStorage.getItem(`access_token_${e.siteId}`),R=localStorage.getItem(`chat-token-${e.siteId}`);if(f&&R===f){const O=localStorage.getItem("chatHistory");O&&de(JSON.parse(O))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${e.siteId}`,f||"")},[]),g.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify($e));const f=localStorage.getItem(`access_token_${e.siteId}`);f&&localStorage.setItem(`chat-token-${e.siteId}`,f)},[$e]);const Ie=()=>{j(!0),setTimeout(()=>k(!0),10)},Fe=()=>{k(!1),setTimeout(()=>j(!1),300)};g.useEffect(()=>{w?Ie():Fe()},[w]);const We=f=>{v(s[f])};g.useEffect(()=>{E&&M.current&&M.current.scrollTo({top:M.current.scrollHeight,behavior:"smooth"})},[$e,E]);const ge=null,Ee=null,xe=async()=>{const f=await yt();f!=null&&p(f)};g.useEffect(()=>{if(e!=null&&e.siteId){const{clientID:f,host:R,organizationID:O,shortCode:K,siteId:V}=e;sessionStorage.setItem("Host",R),sessionStorage.setItem("SiteId",V),sessionStorage.setItem("pubCfg",btoa(f)),sessionStorage.setItem("envRef",K),sessionStorage.setItem("orgRef",O)}xe(),console.log("scapi environment v1")},[]),g.useEffect(()=>{t&&(console.log("setting the basket id",t),tt(t))},[t]);const S=async()=>{const f=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await Ho(f||"")).c_interests},ve=async(f,R)=>{console.log("in secondary flow",Dt);const O=await S();if(console.log(O,"interests of customer",Dt),!!O)try{de(ye=>ye.map((X,re)=>re===ye.length-1?{...X,secondaryLoading:!0}:X));const K=await ur(ge,Ee);if(!K)throw new Error("Failed to fetch token");const V=localStorage.getItem("customerNumber"),D=localStorage.getItem("isLoggedIn"),ee=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(D||!1),userId:String(V||new Date().getTime())}).toString()}`,L=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:f,productPoints:String(R||0),interests:O}}),W=await fetch(ee,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`},body:L});if(!W.body)throw new Error("Readable stream not supported");const je=W.body.getReader(),we=new TextDecoder;let te="";for(;;){const{done:ye,value:X}=await je.read();if(ye)break;te+=we.decode(X,{stream:!0});const re=te.split(`
8
- `);te=re.pop()||"";for(const ke of re)if(ke.startsWith("data:")){const b=ke.slice(5).trim();try{const ie=JSON.parse(b);ie.index===0&&de(Q=>Q.map((Y,G)=>G===Q.length-1?{...Y,secondaryResponse:ie.data,secondaryLoading:!1}:Y))}catch(ie){de(Q=>Q.map((Y,G)=>G===Q.length-1?{...Y,secondaryLoading:!1}:Y)),console.error("Secondary flow JSON parse error:",ie)}}}}catch(K){console.error("Secondary flow error:",K)}},Pe=async f=>{const R=f||J.trim();if(R){z(!0),he(""),a.current=null,i.current=null,c.current=null,l.current=null,de(O=>[...O,{query:R,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const O=pe,K=localStorage.getItem("customerNumber"),V=localStorage.getItem("isLoggedIn"),D=await ur(ge,Ee);if(!D)throw new Error("Failed to obtain access token");const ee=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(V||!1),userId:String(K||new Date().getTime())}).toString()}`,L=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:R,whom:O}}),W=await fetch(ee,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${D}`},body:L});if(!W.ok)throw new Error(`HTTP error! status: ${W.status}`);if(!W.body)throw new Error("Readable stream not supported");const je=W.body.getReader(),we=new TextDecoder;let te="",ye="";for(;;){I(!0);const{done:X,value:re}=await je.read();if(X)break;te+=we.decode(re,{stream:!0});const ke=te.split(`
9
- `);te=ke.pop()||"";for(const b of ke)if(b.startsWith("data:")){const ie=b.slice(5).trim();try{const Q=JSON.parse(ie);Q.index==1&&(ye=Q.data),de(Y=>Y.map((G,Ue)=>Ue===Y.length-1?{...G,[Q.index==0?"response":Q.index==1?"keywords":Q.index==2?"potentialQuestions":"end"]:Q.data}:G))}catch(Q){console.error("Error parsing JSON:",Q)}}}Zt(se(ye))}catch(O){console.error("Error sending message to Tanya:",O)}finally{z(!1)}}},se=f=>{const R=f.match(/top five relevant product or category names are: (.*)/i),V=(R?R[1]:f).split(", ").map(ue=>ue.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(V)].filter(Boolean).join(",")},Zt=async f=>{var O,K,V;const R=typeof f=="string"?f.split(","):f;I(!0);try{const D=await Promise.all(R.map(L=>Uo(L).catch(()=>[]))),ue=R.map((L,W)=>({keyword:L,items:D[W]??[],loading:!1})).filter(L=>L.items.length>0),ee=(K=(O=ue[0])==null?void 0:O.items)==null?void 0:K[0];if(ee){i.current=ee.product_id,a.current=ee.product_name,c.current=(V=ee.image)==null?void 0:V.link;const L=typeof ee.price=="number"?ee.price:null;l.current=L}if(de(L=>L.map((W,je)=>je===L.length-1?{...W,products:ue,productSnapshot:ee?{id:i.current,name:a.current,image:c.current,price:l.current,points:0,quantity:1}:W.productSnapshot}:W)),ee){const L=JSON.parse(sessionStorage.getItem("customerData")||"{}");L!=null&&L.isGuest||(console.log("running secondary flow",Dt),ve(a.current,0))}}catch(D){console.error("error in keyword search",D)}finally{I(!1)}},er=async(f,R)=>{var O,K,V,D,ue,ee,L,W,je,we,te,ye,X,re,ke;H(!0);try{const b=await En(f.id);if(!((K=(O=b==null?void 0:b.variants)==null?void 0:O[0])!=null&&K.product_id||(D=(V=b==null?void 0:b.variants)==null?void 0:V[0])!=null&&D.productId)&&!(b.type.item||b.type.bundle)){H(!1),Le.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const ie=[{product_id:((ue=b.variants)==null?void 0:ue[0].product_id)||((ee=b.variants)==null?void 0:ee[0].productId)||(b==null?void 0:b.id),quantity:R}];console.log(ie,"product data","app version",Dt);const Q=JSON.parse(sessionStorage.getItem("customerData")||"{}"),Y=(Q==null?void 0:Q.basketId)||localStorage.getItem(Kt),G=!1,Ue=localStorage.getItem(Ft),me=Date.now();if(!G||!Ue||me>=parseInt(Ue)){const De=await Fn();let{customer_token:Z}=await Pn(De);if(Z="Bearer "+h.access_token,!Z){console.error("Failed to get customer_token");return}const Et=me+300*1e3;if(Wt(Z),localStorage.setItem(Ft,Et.toString()),console.log(Y,"basketIdFromCustomer"),Y){const lt=await On({basketId:Y,customer_token:Z});if(lt.status===200&&lt){const ct=await fr(Y,ie,Z);((L=ct==null?void 0:ct.product_items)==null?void 0:L.length)>0&&(Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(Y),H(!1));return}}const tr={productItems:[{productId:((W=b.variants)==null?void 0:W[0].product_id)||((je=b.variants)==null?void 0:je[0].productId)||(b==null?void 0:b.id),quantity:1}]},P=await Tn(Z,tr);if(console.log(P,P==null?void 0:P.basket_id,P==null?void 0:P.basketId,"the basket response"),!(P!=null&&P.basket_id||!(P!=null&&P.basketId))){H(!1),console.error("Failed to create basket");return}tt((P==null?void 0:P.basket_id)||(P==null?void 0:P.basketId));const ze=await r({productId:i,quantity:R},(P==null?void 0:P.basket_id)||(P==null?void 0:P.basketId));(((we=ze==null?void 0:ze.product_items)==null?void 0:we.length)>0||((te=ze==null?void 0:ze.productItems)==null?void 0:te.length)>0)&&Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(P.basket_id||(P==null?void 0:P.basketId))}}catch(b){H(!1),console.error("Error adding to cart:",b),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((ye=b==null?void 0:b.response)==null?void 0:ye.status)===404||((X=b==null?void 0:b.response)==null?void 0:X.status)===401?(((re=b==null?void 0:b.response)==null?void 0:re.status)===404&&tt(null),((ke=b==null?void 0:b.response)==null?void 0:ke.status)===401&&(tt(null),Wt(null))):(console.error("Failed to add product to basket:",b.message),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}H(!1)};return g.useEffect(()=>{E?setTimeout(()=>k(!0),10):k(!1)},[E]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(Bo,{open:w,onOpenChange:y,children:[n.jsx(Ro,{onClick:()=>y(!0),style:{},className:"flex items-center rounded-lg cursor-pointer hover:opacity-90 transition-opacity p-0",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_958_585)",children:[n.jsx("path",{d:"M30.0002 5C31.7683 5 33.464 5.70238 34.7142 6.95262C35.9644 8.20286 36.6668 9.89856 36.6668 11.6667V25C36.6668 26.7681 35.9644 28.4638 34.7142 29.714C33.464 30.9643 31.7683 31.6667 30.0002 31.6667H25.6902L21.1785 36.1783C20.8915 36.4653 20.5097 36.6377 20.1046 36.6631C19.6996 36.6886 19.2992 36.5654 18.9785 36.3167L18.8218 36.1783L14.3085 31.6667H10.0002C8.28976 31.6667 6.64478 31.0093 5.40548 29.8305C4.16617 28.6516 3.42735 27.0416 3.34183 25.3333L3.3335 25V11.6667C3.3335 9.89856 4.03588 8.20286 5.28612 6.95262C6.53636 5.70238 8.23205 5 10.0002 5H30.0002Z",fill:"url(#paint0_linear_958_585)"}),n.jsx("path",{d:"M28.3335 15.6511V11.6667C28.3335 11.6667 22.2774 12.6042 20.1148 15.4167C17.9521 18.2292 18.6644 26.6667 18.6644 26.6667H22.5321C22.5321 26.6667 22.0614 18.9323 23.4989 17.2917C24.9364 15.6511 28.3335 15.6511 28.3335 15.6511Z",fill:"white"}),n.jsx("path",{d:"M13.3335 11.6667H19.6184V15.4167H13.3335V11.6667Z",fill:"white"})]}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_958_585",x1:"20.0002",y1:"5",x2:"35.0002",y2:"30",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"#452697"}),n.jsx("stop",{offset:"1",stopColor:"#7C5BFF"})]}),n.jsx("clipPath",{id:"clip0_958_585",children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})]})]})})}),E&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>y(!1)}),n.jsxs("div",{className:`
7
+ `},E)})})]}),n.jsxs("div",{className:"flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",style:{marginTop:"40px"},children:[n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",style:{backgroundColor:o.tanyaThemeColor},onClick:i,children:"Add to Cart"}),n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",style:{backgroundColor:o.tanyaThemeColor},onClick:c,children:"View more"})]})]})]})},Xo=({tanyaConfig:e,basketId:t,addToCart:r})=>{const o=["Myself","My Child","My Grandchild","Niece/Nephew","My Friends","Others"],s={Myself:"himself/herself","My Child":"his/her child","My Grandchild":"his/her grandchild","Niece/Nephew":"his/her niece/nephew","My Friends":"his/her friends",Others:"others"},a=g.useRef(null),i=g.useRef(null),c=g.useRef(null),l=g.useRef(null),[h,p]=g.useState(null);g.useRef(null);const[w,y]=g.useState(!1),[_,k]=g.useState(!1),[E,j]=g.useState(!1),[C,H]=g.useState(!1),[B,z]=g.useState(!1),[_e,I]=g.useState(!1),[J,he]=g.useState(""),[pe,v]=g.useState(""),Re=f=>({id:f.id,title:f.name,image:f.image??"",price:f.price??0}),[Le,de]=g.useState([]),M=g.useRef(null),L=nt.useSelector(f=>f.store.store),be=nt.useSelector(f=>f.product.product);g.useEffect(()=>{const f=localStorage.getItem(`access_token_${e.siteId}`),R=localStorage.getItem(`chat-token-${e.siteId}`);if(f&&R===f){const O=localStorage.getItem("chatHistory");O&&de(JSON.parse(O))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${e.siteId}`,f||"")},[]),g.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify(Le));const f=localStorage.getItem(`access_token_${e.siteId}`);f&&localStorage.setItem(`chat-token-${e.siteId}`,f)},[Le]);const Ie=()=>{j(!0),setTimeout(()=>k(!0),10)},Fe=()=>{k(!1),setTimeout(()=>j(!1),300)};g.useEffect(()=>{w?Ie():Fe()},[w]);const We=f=>{v(s[f])};g.useEffect(()=>{E&&M.current&&M.current.scrollTo({top:M.current.scrollHeight,behavior:"smooth"})},[Le,E]);const ge=null,Ee=null,xe=async()=>{const f=await yt();f!=null&&p(f)};g.useEffect(()=>{if(e!=null&&e.siteId){const{clientID:f,host:R,organizationID:O,shortCode:K,siteId:V}=e;sessionStorage.setItem("Host",R),sessionStorage.setItem("SiteId",V),sessionStorage.setItem("pubCfg",btoa(f)),sessionStorage.setItem("envRef",K),sessionStorage.setItem("orgRef",O)}xe(),console.log("scapi environment v1")},[]),g.useEffect(()=>{t&&(console.log("setting the basket id",t),tt(t))},[t]);const S=async()=>{const f=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await Ho(f||"")).c_interests},ve=async(f,R)=>{console.log("in secondary flow",Dt);const O=await S();if(console.log(O,"interests of customer",Dt),!!O)try{de(ye=>ye.map((X,re)=>re===ye.length-1?{...X,secondaryLoading:!0}:X));const K=await ur(ge,Ee);if(!K)throw new Error("Failed to fetch token");const V=localStorage.getItem("customerNumber"),D=localStorage.getItem("isLoggedIn"),ee=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(D||!1),userId:String(V||new Date().getTime())}).toString()}`,$=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:f,productPoints:String(R||0),interests:O}}),W=await fetch(ee,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`},body:$});if(!W.body)throw new Error("Readable stream not supported");const je=W.body.getReader(),we=new TextDecoder;let te="";for(;;){const{done:ye,value:X}=await je.read();if(ye)break;te+=we.decode(X,{stream:!0});const re=te.split(`
8
+ `);te=re.pop()||"";for(const ke of re)if(ke.startsWith("data:")){const b=ke.slice(5).trim();try{const ie=JSON.parse(b);ie.index===0&&de(Q=>Q.map((Y,G)=>G===Q.length-1?{...Y,secondaryResponse:ie.data,secondaryLoading:!1}:Y))}catch(ie){de(Q=>Q.map((Y,G)=>G===Q.length-1?{...Y,secondaryLoading:!1}:Y)),console.error("Secondary flow JSON parse error:",ie)}}}}catch(K){console.error("Secondary flow error:",K)}},Pe=async f=>{const R=f||J.trim();if(R){z(!0),he(""),a.current=null,i.current=null,c.current=null,l.current=null,de(O=>[...O,{query:R,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const O=pe,K=localStorage.getItem("customerNumber"),V=localStorage.getItem("isLoggedIn"),D=await ur(ge,Ee);if(!D)throw new Error("Failed to obtain access token");const ee=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(V||!1),userId:String(K||new Date().getTime())}).toString()}`,$=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:R,whom:O}}),W=await fetch(ee,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${D}`},body:$});if(!W.ok)throw new Error(`HTTP error! status: ${W.status}`);if(!W.body)throw new Error("Readable stream not supported");const je=W.body.getReader(),we=new TextDecoder;let te="",ye="";for(;;){I(!0);const{done:X,value:re}=await je.read();if(X)break;te+=we.decode(re,{stream:!0});const ke=te.split(`
9
+ `);te=ke.pop()||"";for(const b of ke)if(b.startsWith("data:")){const ie=b.slice(5).trim();try{const Q=JSON.parse(ie);Q.index==1&&(ye=Q.data),de(Y=>Y.map((G,Ue)=>Ue===Y.length-1?{...G,[Q.index==0?"response":Q.index==1?"keywords":Q.index==2?"potentialQuestions":"end"]:Q.data}:G))}catch(Q){console.error("Error parsing JSON:",Q)}}}Zt(se(ye))}catch(O){console.error("Error sending message to Tanya:",O)}finally{z(!1)}}},se=f=>{const R=f.match(/top five relevant product or category names are: (.*)/i),V=(R?R[1]:f).split(", ").map(ue=>ue.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(V)].filter(Boolean).join(",")},Zt=async f=>{var O,K,V;const R=typeof f=="string"?f.split(","):f;I(!0);try{const D=await Promise.all(R.map($=>Uo($).catch(()=>[]))),ue=R.map(($,W)=>({keyword:$,items:D[W]??[],loading:!1})).filter($=>$.items.length>0),ee=(K=(O=ue[0])==null?void 0:O.items)==null?void 0:K[0];if(ee){i.current=ee.product_id,a.current=ee.product_name,c.current=(V=ee.image)==null?void 0:V.link;const $=typeof ee.price=="number"?ee.price:null;l.current=$}if(de($=>$.map((W,je)=>je===$.length-1?{...W,products:ue,productSnapshot:ee?{id:i.current,name:a.current,image:c.current,price:l.current,points:0,quantity:1}:W.productSnapshot}:W)),ee){const $=JSON.parse(sessionStorage.getItem("customerData")||"{}");$!=null&&$.isGuest||(console.log("running secondary flow",Dt),ve(a.current,0))}}catch(D){console.error("error in keyword search",D)}finally{I(!1)}},er=async(f,R)=>{var O,K,V,D,ue,ee,$,W,je,we,te,ye,X,re,ke;H(!0);try{const b=await En(f.id);if(!((K=(O=b==null?void 0:b.variants)==null?void 0:O[0])!=null&&K.product_id||(D=(V=b==null?void 0:b.variants)==null?void 0:V[0])!=null&&D.productId)&&!(b.type.item||b.type.bundle)){H(!1),$e.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const ie=[{product_id:((ue=b.variants)==null?void 0:ue[0].product_id)||((ee=b.variants)==null?void 0:ee[0].productId)||(b==null?void 0:b.id),quantity:R}];console.log(ie,"product data","app version",Dt);const Q=JSON.parse(sessionStorage.getItem("customerData")||"{}"),Y=(Q==null?void 0:Q.basketId)||localStorage.getItem(Kt),G=!1,Ue=localStorage.getItem(Ft),me=Date.now();if(!G||!Ue||me>=parseInt(Ue)){const De=await Fn();let{customer_token:Z}=await Pn(De);if(Z="Bearer "+h.access_token,!Z){console.error("Failed to get customer_token");return}const Et=me+300*1e3;if(Wt(Z),localStorage.setItem(Ft,Et.toString()),console.log(Y,"basketIdFromCustomer"),Y){const lt=await On({basketId:Y,customer_token:Z});if(lt.status===200&&lt){const ct=await fr(Y,ie,Z);(($=ct==null?void 0:ct.product_items)==null?void 0:$.length)>0&&($e.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(Y),H(!1));return}}const tr={productItems:[{productId:((W=b.variants)==null?void 0:W[0].product_id)||((je=b.variants)==null?void 0:je[0].productId)||(b==null?void 0:b.id),quantity:1}]},P=await Tn(Z,tr);if(console.log(P,P==null?void 0:P.basket_id,P==null?void 0:P.basketId,"the basket response"),!(P!=null&&P.basket_id||!(P!=null&&P.basketId))){H(!1),console.error("Failed to create basket");return}tt((P==null?void 0:P.basket_id)||(P==null?void 0:P.basketId));const ze=await r({productId:i,quantity:R},(P==null?void 0:P.basket_id)||(P==null?void 0:P.basketId));(((we=ze==null?void 0:ze.product_items)==null?void 0:we.length)>0||((te=ze==null?void 0:ze.productItems)==null?void 0:te.length)>0)&&$e.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(P.basket_id||(P==null?void 0:P.basketId))}}catch(b){H(!1),console.error("Error adding to cart:",b),$e.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((ye=b==null?void 0:b.response)==null?void 0:ye.status)===404||((X=b==null?void 0:b.response)==null?void 0:X.status)===401?(((re=b==null?void 0:b.response)==null?void 0:re.status)===404&&tt(null),((ke=b==null?void 0:b.response)==null?void 0:ke.status)===401&&(tt(null),Wt(null))):(console.error("Failed to add product to basket:",b.message),$e.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}H(!1)};return g.useEffect(()=>{E?setTimeout(()=>k(!0),10):k(!1)},[E]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(Bo,{open:w,onOpenChange:y,children:[n.jsx(Ro,{onClick:()=>y(!0),style:{},className:"flex items-center rounded-lg cursor-pointer hover:opacity-90 transition-opacity p-0",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_958_585)",children:[n.jsx("path",{d:"M30.0002 5C31.7683 5 33.464 5.70238 34.7142 6.95262C35.9644 8.20286 36.6668 9.89856 36.6668 11.6667V25C36.6668 26.7681 35.9644 28.4638 34.7142 29.714C33.464 30.9643 31.7683 31.6667 30.0002 31.6667H25.6902L21.1785 36.1783C20.8915 36.4653 20.5097 36.6377 20.1046 36.6631C19.6996 36.6886 19.2992 36.5654 18.9785 36.3167L18.8218 36.1783L14.3085 31.6667H10.0002C8.28976 31.6667 6.64478 31.0093 5.40548 29.8305C4.16617 28.6516 3.42735 27.0416 3.34183 25.3333L3.3335 25V11.6667C3.3335 9.89856 4.03588 8.20286 5.28612 6.95262C6.53636 5.70238 8.23205 5 10.0002 5H30.0002Z",fill:"url(#paint0_linear_958_585)"}),n.jsx("path",{d:"M28.3335 15.6511V11.6667C28.3335 11.6667 22.2774 12.6042 20.1148 15.4167C17.9521 18.2292 18.6644 26.6667 18.6644 26.6667H22.5321C22.5321 26.6667 22.0614 18.9323 23.4989 17.2917C24.9364 15.6511 28.3335 15.6511 28.3335 15.6511Z",fill:"white"}),n.jsx("path",{d:"M13.3335 11.6667H19.6184V15.4167H13.3335V11.6667Z",fill:"white"})]}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_958_585",x1:"20.0002",y1:"5",x2:"35.0002",y2:"30",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"#452697"}),n.jsx("stop",{offset:"1",stopColor:"#7C5BFF"})]}),n.jsx("clipPath",{id:"clip0_958_585",children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})]})]})})}),E&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>y(!1)}),n.jsxs("div",{className:`
10
10
  fixed z-50 h-screen w-[100vw] sm:w-[80vw] md:w-[770px] border-0 bg-white lg:rounded-l-xl overflow-hidden flex flex-col shadow-[0px_4px_10px_0px_#5F499840]
11
11
  top-0 right-0
12
12
  transition-transform duration-300 ease-in-out
13
13
  lg:transform lg:translate-y-0
14
14
 
15
- `,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>y(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${be?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:M,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[($==null?void 0:$.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.map(f=>n.jsx("button",{onClick:()=>We(f),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:pe===s[f]?"#FFFFFF":"#F3F3F3",borderColor:pe===s[f]?"#BBB3DD":""},children:f},f))})]}),$e.map((f,R)=>{var O,K;return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]",children:f.query})}),f.response&&f.response.includes("Thinking")?n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans animate-pulse font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:nr(f.response)}})}):n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:nr(f.response)}})}),_e&&!f.response.includes("Thinking")&&((O=f.products)==null?void 0:O.length)==0&&n.jsx("div",{children:n.jsx("p",{className:"text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]",children:"Finding best products for you"})}),(f==null?void 0:f.products)&&((K=f==null?void 0:f.products)==null?void 0:K.length)>0&&n.jsx(Wo,{chat:f.products,storeDetails:$}),(f==null?void 0:f.potentialQuestions.length)>0&&n.jsxs("div",{className:"my-2 px-4 text-sm text-gray-700",children:[n.jsx("p",{className:"font-nunitoSans font-bold text-sm text-[#494949]",style:{color:$.themeDarkColor},children:"Why not explore these inquiries..."}),f.potentialQuestions.split(",").map((V,D)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${$.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>Pe(V),style:{backgroundColor:$.tanyaThemeColorLight},children:V},D))]}),(f==null?void 0:f.secondaryLoading)&&n.jsx("div",{className:"mt-3 mb-4 px-4",children:n.jsxs("div",{className:"tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",style:{margin:"0.75rem"},children:[n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"tanya-sparkle tanya-sparkle-1",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-2",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-3",children:"✨"})]}),n.jsx("div",{className:"tanya-shimmer"}),n.jsx("p",{className:"font-semibold tanya-pulse",style:{color:$.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:$.themeDarkColor},children:"• • •"})]})}),(f==null?void 0:f.secondaryResponse)&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]",children:[n.jsx("div",{className:"text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",style:{backgroundColor:$.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:nr(f.secondaryResponse)}}),f.productSnapshot&&n.jsx("div",{className:"mt-4 w-full",children:n.jsxs("div",{className:"flex gap-4 items-stretch rounded-2xl p-4",style:{backgroundColor:$.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:f.productSnapshot.image?n.jsx("img",{src:f.productSnapshot.image,alt:f.productSnapshot.name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-500",children:"No Image"})}),n.jsxs("div",{className:"flex flex-col flex-1 justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-[15px] leading-snug",children:f.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:f.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:($==null?void 0:$.currency)||"USD"}).format(f.productSnapshot.price):""}),f.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[f.productSnapshot.points," ","points"]})]})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center border rounded-full overflow-hidden",children:[n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>de(V=>V.map((D,ue)=>ue===R&&D.productSnapshot?{...D,productSnapshot:{...D.productSnapshot,quantity:Math.max(1,D.productSnapshot.quantity-1)}}:D)),style:{background:"transparent",color:$.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:f.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>de(V=>V.map((D,ue)=>ue===R&&D.productSnapshot?{...D,productSnapshot:{...D.productSnapshot,quantity:D.productSnapshot.quantity+1}}:D)),style:{background:"transparent",color:$.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{er(Re(f.productSnapshot),f.productSnapshot.quantity)},disabled:C,className:"px-4 py-2 rounded-full font-medium",style:{background:$.tanyaThemeColor,color:($==null?void 0:$.tanyaThemeContrastColor)||"#fff",opacity:C?.8:1},children:C?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},R)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:J,autoFocus:!0,onChange:f=>he(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!B&&Pe()}}),n.jsx("button",{type:"submit",disabled:B,className:"p-3",onClick:()=>Pe(),children:B?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:$.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(Go,{addToCartPwa:r})]})]})]})]})})};var mr=function(e,t){return mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},mr(e,t)};function Zo(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");mr(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Je=function(){return Je=Object.assign||function(t){for(var r,o=1,s=arguments.length;o<s;o++){r=arguments[o];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Je.apply(this,arguments)};function es(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(e);s<o.length;s++)t.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(r[o[s]]=e[o[s]]);return r}var or="Invariant Violation",Xr=Object.setPrototypeOf,ts=Xr===void 0?function(e,t){return e.__proto__=t,e}:Xr,An=(function(e){Zo(t,e);function t(r){r===void 0&&(r=or);var o=e.call(this,typeof r=="number"?or+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=or,ts(o,t.prototype),o}return t})(Error);function et(e,t){if(!e)throw new An(t)}var Ln=["debug","log","warn","error","silent"],rs=Ln.indexOf("log");function zt(e){return function(){if(Ln.indexOf(e)>=rs){var t=console[e]||console.log;return t.apply(console,arguments)}}}(function(e){e.debug=zt("debug"),e.log=zt("log"),e.warn=zt("warn"),e.error=zt("error")})(et||(et={}));var $n="3.14.0";function mt(e){try{return e()}catch{}}const hr=mt(function(){return globalThis})||mt(function(){return window})||mt(function(){return self})||mt(function(){return global})||mt(function(){return mt.constructor("return this")()});var Zr=new Map;function ns(e){var t=Zr.get(e)||1;return Zr.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function os(e,t){var r=ns("stringifyForDisplay");return JSON.stringify(e,function(o,s){return s===void 0?r:s},t).split(JSON.stringify(r)).join("<undefined>")}function Mt(e){return function(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof t=="number"){var s=t;t=jr(s),t||(t=kr(s,r),r=[])}e.apply(void 0,[t].concat(r))}}var sr=Object.assign(function(t,r){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];t||et(t,jr(r,o)||kr(r,o))},{debug:Mt(et.debug),log:Mt(et.log),warn:Mt(et.warn),error:Mt(et.error)});function Dn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new An(jr(e,t)||kr(e,t))}var en=Symbol.for("ApolloErrorMessageHandler_"+$n);function zn(e){if(typeof e=="string")return e;try{return os(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function jr(e,t){if(t===void 0&&(t=[]),!!e)return hr[en]&&hr[en](e,t.map(zn))}function kr(e,t){if(t===void 0&&(t=[]),!!e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:$n,message:e,args:t.map(zn)})))}function ss(e){return e.definitions.filter(function(t){return t.kind==="OperationDefinition"&&!!t.name}).map(function(t){return t.name.value})[0]||null}let ae=null;const tn={};let as=1;const is=()=>class{constructor(){this.id=["slot",as++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let t=ae;t;t=t.parent)if(this.id in t.slots){const r=t.slots[this.id];if(r===tn)break;return t!==ae&&(ae.slots[this.id]=r),!0}return ae&&(ae.slots[this.id]=tn),!1}getValue(){if(this.hasValue())return ae.slots[this.id]}withValue(t,r,o,s){const a={__proto__:null,[this.id]:t},i=ae;ae={parent:i,slots:a};try{return r.apply(s,o)}finally{ae=i}}static bind(t){const r=ae;return function(){const o=ae;try{return ae=r,t.apply(this,arguments)}finally{ae=o}}}static noContext(t,r,o){if(ae){const s=ae;try{return ae=null,t.apply(o,r)}finally{ae=s}}else return t.apply(o,r)}};function rn(e){try{return e()}catch{}}const ar="@wry/context:Slot",ls=rn(()=>globalThis)||rn(()=>global)||Object.create(null),nn=ls,Sr=nn[ar]||Array[ar]||(function(e){try{Object.defineProperty(nn,ar,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}})(is()),{bind:Va,noContext:Ya}=Sr;new Sr;function cs(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=ds(e))||t){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
16
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ds(e,t){if(e){if(typeof e=="string")return on(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return on(e,t)}}function on(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function sn(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Nr(e,t,r){return t&&sn(e.prototype,t),r&&sn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Cr=function(){return typeof Symbol=="function"},_r=function(e){return Cr()&&!!Symbol[e]},Ir=function(e){return _r(e)?Symbol[e]:"@@"+e};Cr()&&!_r("observable")&&(Symbol.observable=Symbol("observable"));var us=Ir("iterator"),pr=Ir("observable"),Mn=Ir("species");function Qt(e,t){var r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function St(e){var t=e.constructor;return t!==void 0&&(t=t[Mn],t===null&&(t=void 0)),t!==void 0?t:ce}function fs(e){return e instanceof ce}function xt(e){xt.log?xt.log(e):setTimeout(function(){throw e})}function Bt(e){Promise.resolve().then(function(){try{e()}catch(t){xt(t)}})}function qn(e){var t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t=="function")t();else{var r=Qt(t,"unsubscribe");r&&r.call(t)}}catch(o){xt(o)}}function gr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function ms(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(Bn(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function Bn(e,t,r){e._state="running";var o=e._observer;try{var s=Qt(o,t);switch(t){case"next":s&&s.call(o,r);break;case"error":if(gr(e),s)s.call(o,r);else throw r;break;case"complete":gr(e),s&&s.call(o);break}}catch(a){xt(a)}e._state==="closed"?qn(e):e._state==="running"&&(e._state="ready")}function ir(e,t,r){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:t,value:r});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:t,value:r}],Bt(function(){return ms(e)});return}Bn(e,t,r)}}var hs=(function(){function e(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new ps(this);try{this._cleanup=o.call(void 0,s)}catch(a){s.error(a)}this._state==="initializing"&&(this._state="ready")}var t=e.prototype;return t.unsubscribe=function(){this._state!=="closed"&&(gr(this),qn(this))},Nr(e,[{key:"closed",get:function(){return this._state==="closed"}}]),e})(),ps=(function(){function e(r){this._subscription=r}var t=e.prototype;return t.next=function(o){ir(this._subscription,"next",o)},t.error=function(o){ir(this._subscription,"error",o)},t.complete=function(){ir(this._subscription,"complete")},Nr(e,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),e})(),ce=(function(){function e(r){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var t=e.prototype;return t.subscribe=function(o){return(typeof o!="object"||o===null)&&(o={next:o,error:arguments[1],complete:arguments[2]}),new hs(o,this._subscriber)},t.forEach=function(o){var s=this;return new Promise(function(a,i){if(typeof o!="function"){i(new TypeError(o+" is not a function"));return}function c(){l.unsubscribe(),a()}var l=s.subscribe({next:function(h){try{o(h,c)}catch(p){i(p),l.unsubscribe()}},error:i,complete:a})})},t.map=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{c=o(c)}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.filter=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{if(!o(c))return}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.reduce=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this),i=arguments.length>1,c=!1,l=arguments[1],h=l;return new a(function(p){return s.subscribe({next:function(w){var y=!c;if(c=!0,!y||i)try{h=o(h,w)}catch(_){return p.error(_)}else h=w},error:function(w){p.error(w)},complete:function(){if(!c&&!i)return p.error(new TypeError("Cannot reduce an empty sequence"));p.next(h),p.complete()}})})},t.concat=function(){for(var o=this,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var c=St(this);return new c(function(l){var h,p=0;function w(y){h=y.subscribe({next:function(_){l.next(_)},error:function(_){l.error(_)},complete:function(){p===a.length?(h=void 0,l.complete()):w(c.from(a[p++]))}})}return w(o),function(){h&&(h.unsubscribe(),h=void 0)}})},t.flatMap=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){var c=[],l=s.subscribe({next:function(p){if(o)try{p=o(p)}catch(y){return i.error(y)}var w=a.from(p).subscribe({next:function(y){i.next(y)},error:function(y){i.error(y)},complete:function(){var y=c.indexOf(w);y>=0&&c.splice(y,1),h()}});c.push(w)},error:function(p){i.error(p)},complete:function(){h()}});function h(){l.closed&&c.length===0&&i.complete()}return function(){c.forEach(function(p){return p.unsubscribe()}),l.unsubscribe()}})},t[pr]=function(){return this},e.from=function(o){var s=typeof this=="function"?this:e;if(o==null)throw new TypeError(o+" is not an object");var a=Qt(o,pr);if(a){var i=a.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return fs(i)&&i.constructor===s?i:new s(function(c){return i.subscribe(c)})}if(_r("iterator")&&(a=Qt(o,us),a))return new s(function(c){Bt(function(){if(!c.closed){for(var l=cs(a.call(o)),h;!(h=l()).done;){var p=h.value;if(c.next(p),c.closed)return}c.complete()}})});if(Array.isArray(o))return new s(function(c){Bt(function(){if(!c.closed){for(var l=0;l<o.length;++l)if(c.next(o[l]),c.closed)return;c.complete()}})});throw new TypeError(o+" is not observable")},e.of=function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var i=typeof this=="function"?this:e;return new i(function(c){Bt(function(){if(!c.closed){for(var l=0;l<s.length;++l)if(c.next(s[l]),c.closed)return;c.complete()}})})},Nr(e,null,[{key:Mn,get:function(){return this}}]),e})();Cr()&&Object.defineProperty(ce,Symbol("extensions"),{value:{symbol:pr,hostReportError:xt},configurable:!0});function gs(e){var t,r=e.Symbol;if(typeof r=="function")if(r.observable)t=r.observable;else{typeof r.for=="function"?t=r.for("https://github.com/benlesh/symbol-observable"):t=r("https://github.com/benlesh/symbol-observable");try{r.observable=t}catch{}}else t="@@observable";return t}var gt;typeof self<"u"?gt=self:typeof window<"u"?gt=window:typeof global<"u"?gt=global:typeof module<"u"?gt=module:gt=Function("return this")();gs(gt);var an=ce.prototype,ln="@@observable";an[ln]||(an[ln]=function(){return this});function xs(e){for(var t=["query","operationName","variables","extensions","context"],r=0,o=Object.keys(e);r<o.length;r++){var s=o[r];if(t.indexOf(s)<0)throw Dn(58,s)}return e}function ws(e,t){var r=Je({},e),o=function(a){typeof a=="function"?r=Je(Je({},r),a(r)):r=Je(Je({},r),a)},s=function(){return Je({},r)};return Object.defineProperty(t,"setContext",{enumerable:!1,value:o}),Object.defineProperty(t,"getContext",{enumerable:!1,value:s}),t}function ys(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName=typeof t.query!="string"?ss(t.query)||void 0:""),t}var bs=Symbol.for("apollo.deprecations"),vs=hr,js=new Sr;function ks(e){return vs[bs]||(js.getValue()||[]).includes(e)}function Ss(e,t){ks(e)||t()}function cn(e,t){return t?t(e):ce.of()}function Nt(e){return typeof e=="function"?new Rn(e):e}function qt(e){return e.request.length<=1}var Rn=(function(){function e(t){t&&(this.request=t)}return e.empty=function(){return new e(function(){return ce.of()})},e.from=function(t){return t.length===0?e.empty():t.map(Nt).reduce(function(r,o){return r.concat(o)})},e.split=function(t,r,o){var s=Nt(r),a=Nt(o||new e(cn)),i;return qt(s)&&qt(a)?i=new e(function(c){return t(c)?s.request(c)||ce.of():a.request(c)||ce.of()}):i=new e(function(c,l){return t(c)?s.request(c,l)||ce.of():a.request(c,l)||ce.of()}),Object.assign(i,{left:s,right:a})},e.execute=function(t,r){return t.request(ws(r.context,ys(xs(r))))||ce.of()},e.concat=function(t,r){var o=Nt(t);if(qt(o))return globalThis.__DEV__!==!1&&sr.warn(47,o),o;var s=Nt(r),a;return qt(s)?a=new e(function(i){return o.request(i,function(c){return s.request(c)||ce.of()})||ce.of()}):a=new e(function(i,c){return o.request(i,function(l){return s.request(l,c)||ce.of()})||ce.of()}),Object.assign(a,{left:o,right:s})},e.prototype.split=function(t,r,o){return this.concat(e.split(t,r,o||new e(cn)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(t,r){throw Dn(48)},e.prototype.onError=function(t,r){if(globalThis.__DEV__!==!1&&Ss("onError",function(){globalThis.__DEV__!==!1&&sr.warn(49)}),r&&r.error)return r.error(t),!1;throw t},e.prototype.setOnError=function(t){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&sr.warn(50),this.onError=t,this},e})();function Ns(e){return new Rn(function(t,r){var o=es(t,[]);return new ce(function(s){var a,i=!1;return Promise.resolve(o).then(function(c){return e(c,t.getContext())}).then(t.setContext).then(function(){i||(a=r(t).subscribe({next:s.next.bind(s),error:s.error.bind(s),complete:s.complete.bind(s)}))}).catch(s.error.bind(s)),function(){i=!0,a&&a.unsubscribe()}})})}const Cs=async()=>{const e="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const s=await fe.post(e,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return s.status===200&&s.data.access_token?s.data.access_token:(console.error("Failed to fetch token:",s.data),null)}catch(s){return fe.isAxiosError(s)?console.error("Error fetching token:",s.response||s.message):console.error("Unexpected error:",s),null}},_s="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Is=Yt.createHttpLink({uri:`${_s}`}),Fs=Ns(async(e,{headers:t})=>{const r=await Cs();return{headers:{...t,authorization:`Bearer ${r}`}}}),Ps=new Yt.ApolloClient({link:Fs.concat(Is),cache:new Yt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),Es=e=>{const{tanyaConfig:t}=e;return n.jsx(Yt.ApolloProvider,{client:Ps,children:n.jsx(qo,{children:n.jsx(Xo,{tanyaConfig:t})})})};function Ts(e,t){const r=e.icons,o=e.aliases||Object.create(null),s=Object.create(null);function a(i){if(r[i])return s[i]=[];if(!(i in s)){s[i]=null;const c=o[i]&&o[i].parent,l=c&&a(c);l&&(s[i]=[c].concat(l))}return s[i]}return Object.keys(r).concat(Object.keys(o)).forEach(a),s}const Un=Object.freeze({left:0,top:0,width:16,height:16}),Gt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Fr=Object.freeze({...Un,...Gt}),xr=Object.freeze({...Fr,body:"",hidden:!1});function Os(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const o=((e.rotate||0)+(t.rotate||0))%4;return o&&(r.rotate=o),r}function dn(e,t){const r=Os(e,t);for(const o in xr)o in Gt?o in e&&!(o in r)&&(r[o]=Gt[o]):o in t?r[o]=t[o]:o in e&&(r[o]=e[o]);return r}function As(e,t,r){const o=e.icons,s=e.aliases||Object.create(null);let a={};function i(c){a=dn(o[c]||s[c],a)}return i(t),r.forEach(i),dn(e,a)}function Hn(e,t){const r=[];if(typeof e!="object"||typeof e.icons!="object")return r;e.not_found instanceof Array&&e.not_found.forEach(s=>{t(s,null),r.push(s)});const o=Ts(e);for(const s in o){const a=o[s];a&&(t(s,As(e,s,a)),r.push(s))}return r}const Ls={provider:"",aliases:{},not_found:{},...Un};function lr(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Vn(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!lr(e,Ls))return null;const r=t.icons;for(const s in r){const a=r[s];if(!s||typeof a.body!="string"||!lr(a,xr))return null}const o=t.aliases||Object.create(null);for(const s in o){const a=o[s],i=a.parent;if(!s||typeof i!="string"||!r[i]&&!o[i]||!lr(a,xr))return null}return t}const un=Object.create(null);function $s(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function wt(e,t){const r=un[e]||(un[e]=Object.create(null));return r[t]||(r[t]=$s(e,t))}function Yn(e,t){return Vn(t)?Hn(t,(r,o)=>{o?e.icons[r]=o:e.missing.add(r)}):[]}function Ds(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}const Jn=/^[a-z0-9]+(-[a-z0-9]+)*$/,Xt=(e,t,r,o="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;o=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const c=s.pop(),l=s.pop(),h={provider:s.length>0?s[0]:o,prefix:l,name:c};return t&&!Rt(h)?null:h}const a=s[0],i=a.split("-");if(i.length>1){const c={provider:o,prefix:i.shift(),name:i.join("-")};return t&&!Rt(c)?null:c}if(r&&o===""){const c={provider:o,prefix:"",name:a};return t&&!Rt(c,r)?null:c}return null},Rt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let Pt=!1;function Kn(e){return typeof e=="boolean"&&(Pt=e),Pt}function fn(e){const t=typeof e=="string"?Xt(e,!0,Pt):e;if(t){const r=wt(t.provider,t.prefix),o=t.name;return r.icons[o]||(r.missing.has(o)?null:void 0)}}function zs(e,t){const r=Xt(e,!0,Pt);if(!r)return!1;const o=wt(r.provider,r.prefix);return t?Ds(o,r.name,t):(o.missing.add(r.name),!0)}function Ms(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Pt&&!t&&!e.prefix){let s=!1;return Vn(e)&&(e.prefix="",Hn(e,(a,i)=>{zs(a,i)&&(s=!0)})),s}const r=e.prefix;if(!Rt({prefix:r,name:"a"}))return!1;const o=wt(t,r);return!!Yn(o,e)}const Wn=Object.freeze({width:null,height:null}),Qn=Object.freeze({...Wn,...Gt}),qs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Bs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function mn(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const o=e.split(qs);if(o===null||!o.length)return e;const s=[];let a=o.shift(),i=Bs.test(a);for(;;){if(i){const c=parseFloat(a);isNaN(c)?s.push(a):s.push(Math.ceil(c*t*r)/r)}else s.push(a);if(a=o.shift(),a===void 0)return s.join("");i=!i}}function Rs(e,t="defs"){let r="";const o=e.indexOf("<"+t);for(;o>=0;){const s=e.indexOf(">",o),a=e.indexOf("</"+t);if(s===-1||a===-1)break;const i=e.indexOf(">",a);if(i===-1)break;r+=e.slice(s+1,a).trim(),e=e.slice(0,o).trim()+e.slice(i+1)}return{defs:r,content:e}}function Us(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Hs(e,t,r){const o=Rs(e);return Us(o.defs,t+o.content+r)}const Vs=e=>e==="unset"||e==="undefined"||e==="none";function Ys(e,t){const r={...Fr,...e},o={...Qn,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let a=r.body;[r,o].forEach(E=>{const j=[],C=E.hFlip,H=E.vFlip;let B=E.rotate;C?H?B+=2:(j.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),j.push("scale(-1 1)"),s.top=s.left=0):H&&(j.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),j.push("scale(1 -1)"),s.top=s.left=0);let z;switch(B<0&&(B-=Math.floor(B/4)*4),B=B%4,B){case 1:z=s.height/2+s.top,j.unshift("rotate(90 "+z.toString()+" "+z.toString()+")");break;case 2:j.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:z=s.width/2+s.left,j.unshift("rotate(-90 "+z.toString()+" "+z.toString()+")");break}B%2===1&&(s.left!==s.top&&(z=s.left,s.left=s.top,s.top=z),s.width!==s.height&&(z=s.width,s.width=s.height,s.height=z)),j.length&&(a=Hs(a,'<g transform="'+j.join(" ")+'">',"</g>"))});const i=o.width,c=o.height,l=s.width,h=s.height;let p,w;i===null?(w=c===null?"1em":c==="auto"?h:c,p=mn(w,l/h)):(p=i==="auto"?l:i,w=c===null?mn(p,h/l):c==="auto"?h:c);const y={},_=(E,j)=>{Vs(j)||(y[E]=j.toString())};_("width",p),_("height",w);const k=[s.left,s.top,l,h];return y.viewBox=k.join(" "),{attributes:y,viewBox:k,body:a}}const Js=/\sid="(\S+)"/g,Ks="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ws=0;function Qs(e,t=Ks){const r=[];let o;for(;o=Js.exec(e);)r.push(o[1]);if(!r.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return r.forEach(a=>{const i=typeof t=="function"?t(a):t+(Ws++).toString(),c=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+c+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const wr=Object.create(null);function Gs(e,t){wr[e]=t}function yr(e){return wr[e]||wr[""]}function Pr(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Er=Object.create(null),Ct=["https://api.simplesvg.com","https://api.unisvg.com"],Ut=[];for(;Ct.length>0;)Ct.length===1||Math.random()>.5?Ut.push(Ct.shift()):Ut.push(Ct.pop());Er[""]=Pr({resources:["https://api.iconify.design"].concat(Ut)});function Xs(e,t){const r=Pr(t);return r===null?!1:(Er[e]=r,!0)}function Tr(e){return Er[e]}const Zs=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let hn=Zs();function ea(e,t){const r=Tr(e);if(!r)return 0;let o;if(!r.maxURL)o=0;else{let s=0;r.resources.forEach(i=>{s=Math.max(s,i.length)});const a=t+".json?icons=";o=r.maxURL-s-r.path.length-a.length}return o}function ta(e){return e===404}const ra=(e,t,r)=>{const o=[],s=ea(e,t),a="icons";let i={type:a,provider:e,prefix:t,icons:[]},c=0;return r.forEach((l,h)=>{c+=l.length+1,c>=s&&h>0&&(o.push(i),i={type:a,provider:e,prefix:t,icons:[]},c=l.length),i.icons.push(l)}),o.push(i),o};function na(e){if(typeof e=="string"){const t=Tr(e);if(t)return t.path}return"/"}const oa=(e,t,r)=>{if(!hn){r("abort",424);return}let o=na(t.provider);switch(t.type){case"icons":{const a=t.prefix,c=t.icons.join(","),l=new URLSearchParams({icons:c});o+=a+".json?"+l.toString();break}case"custom":{const a=t.uri;o+=a.slice(0,1)==="/"?a.slice(1):a;break}default:r("abort",400);return}let s=503;hn(e+o).then(a=>{const i=a.status;if(i!==200){setTimeout(()=>{r(ta(i)?"abort":"next",i)});return}return s=501,a.json()}).then(a=>{if(typeof a!="object"||a===null){setTimeout(()=>{a===404?r("abort",a):r("next",s)});return}setTimeout(()=>{r("success",a)})}).catch(()=>{r("next",s)})},sa={prepare:ra,send:oa};function Gn(e,t){e.forEach(r=>{const o=r.loaderCallbacks;o&&(r.loaderCallbacks=o.filter(s=>s.id!==t))})}function aa(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let r=!1;const o=e.provider,s=e.prefix;t.forEach(a=>{const i=a.icons,c=i.pending.length;i.pending=i.pending.filter(l=>{if(l.prefix!==s)return!0;const h=l.name;if(e.icons[h])i.loaded.push({provider:o,prefix:s,name:h});else if(e.missing.has(h))i.missing.push({provider:o,prefix:s,name:h});else return r=!0,!0;return!1}),i.pending.length!==c&&(r||Gn([e],a.id),a.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),a.abort))})}))}let ia=0;function la(e,t,r){const o=ia++,s=Gn.bind(null,r,o);if(!t.pending.length)return s;const a={id:o,icons:t,callback:e,abort:s};return r.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(a)}),s}function ca(e){const t={loaded:[],missing:[],pending:[]},r=Object.create(null);e.sort((s,a)=>s.provider!==a.provider?s.provider.localeCompare(a.provider):s.prefix!==a.prefix?s.prefix.localeCompare(a.prefix):s.name.localeCompare(a.name));let o={provider:"",prefix:"",name:""};return e.forEach(s=>{if(o.name===s.name&&o.prefix===s.prefix&&o.provider===s.provider)return;o=s;const a=s.provider,i=s.prefix,c=s.name,l=r[a]||(r[a]=Object.create(null)),h=l[i]||(l[i]=wt(a,i));let p;c in h.icons?p=t.loaded:i===""||h.missing.has(c)?p=t.missing:p=t.pending;const w={provider:a,prefix:i,name:c};p.push(w)}),t}function da(e,t=!0,r=!1){const o=[];return e.forEach(s=>{const a=typeof s=="string"?Xt(s,t,r):s;a&&o.push(a)}),o}const ua={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function fa(e,t,r,o){const s=e.resources.length,a=e.random?Math.floor(Math.random()*s):e.index;let i;if(e.random){let I=e.resources.slice(0);for(i=[];I.length>1;){const J=Math.floor(Math.random()*I.length);i.push(I[J]),I=I.slice(0,J).concat(I.slice(J+1))}i=i.concat(I)}else i=e.resources.slice(a).concat(e.resources.slice(0,a));const c=Date.now();let l="pending",h=0,p,w=null,y=[],_=[];typeof o=="function"&&_.push(o);function k(){w&&(clearTimeout(w),w=null)}function E(){l==="pending"&&(l="aborted"),k(),y.forEach(I=>{I.status==="pending"&&(I.status="aborted")}),y=[]}function j(I,J){J&&(_=[]),typeof I=="function"&&_.push(I)}function C(){return{startTime:c,payload:t,status:l,queriesSent:h,queriesPending:y.length,subscribe:j,abort:E}}function H(){l="failed",_.forEach(I=>{I(void 0,p)})}function B(){y.forEach(I=>{I.status==="pending"&&(I.status="aborted")}),y=[]}function z(I,J,he){const pe=J!=="success";switch(y=y.filter(v=>v!==I),l){case"pending":break;case"failed":if(pe||!e.dataAfterTimeout)return;break;default:return}if(J==="abort"){p=he,H();return}if(pe){p=he,y.length||(i.length?_e():H());return}if(k(),B(),!e.random){const v=e.resources.indexOf(I.resource);v!==-1&&v!==e.index&&(e.index=v)}l="completed",_.forEach(v=>{v(he)})}function _e(){if(l!=="pending")return;k();const I=i.shift();if(I===void 0){if(y.length){w=setTimeout(()=>{k(),l==="pending"&&(B(),H())},e.timeout);return}H();return}const J={status:"pending",resource:I,callback:(he,pe)=>{z(J,he,pe)}};y.push(J),h++,w=setTimeout(_e,e.rotate),r(I,t,J.callback)}return setTimeout(_e),C}function Xn(e){const t={...ua,...e};let r=[];function o(){r=r.filter(c=>c().status==="pending")}function s(c,l,h){const p=fa(t,c,l,(w,y)=>{o(),h&&h(w,y)});return r.push(p),p}function a(c){return r.find(l=>c(l))||null}return{query:s,find:a,setIndex:c=>{t.index=c},getIndex:()=>t.index,cleanup:o}}function pn(){}const cr=Object.create(null);function ma(e){if(!cr[e]){const t=Tr(e);if(!t)return;const r=Xn(t),o={config:t,redundancy:r};cr[e]=o}return cr[e]}function ha(e,t,r){let o,s;if(typeof e=="string"){const a=yr(e);if(!a)return r(void 0,424),pn;s=a.send;const i=ma(e);i&&(o=i.redundancy)}else{const a=Pr(e);if(a){o=Xn(a);const i=e.resources?e.resources[0]:"",c=yr(i);c&&(s=c.send)}}return!o||!s?(r(void 0,424),pn):o.query(t,s,r)().abort}function gn(){}function pa(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,aa(e)}))}function ga(e){const t=[],r=[];return e.forEach(o=>{(o.match(Jn)?t:r).push(o)}),{valid:t,invalid:r}}function _t(e,t,r){function o(){const s=e.pendingIcons;t.forEach(a=>{s&&s.delete(a),e.icons[a]||e.missing.add(a)})}if(r&&typeof r=="object")try{if(!Yn(e,r).length){o();return}}catch(s){console.error(s)}o(),pa(e)}function xn(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function xa(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:r,prefix:o}=e,s=e.iconsToLoad;if(delete e.iconsToLoad,!s||!s.length)return;const a=e.loadIcon;if(e.loadIcons&&(s.length>1||!a)){xn(e.loadIcons(s,o,r),p=>{_t(e,s,p)});return}if(a){s.forEach(p=>{const w=a(p,o,r);xn(w,y=>{const _=y?{prefix:o,icons:{[p]:y}}:null;_t(e,[p],_)})});return}const{valid:i,invalid:c}=ga(s);if(c.length&&_t(e,c,null),!i.length)return;const l=o.match(Jn)?yr(r):null;if(!l){_t(e,i,null);return}l.prepare(r,o,i).forEach(p=>{ha(r,p,w=>{_t(e,p.icons,w)})})}))}const wa=(e,t)=>{const r=da(e,!0,Kn()),o=ca(r);if(!o.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(o.loaded,o.missing,o.pending,gn)}),()=>{l=!1}}const s=Object.create(null),a=[];let i,c;return o.pending.forEach(l=>{const{provider:h,prefix:p}=l;if(p===c&&h===i)return;i=h,c=p,a.push(wt(h,p));const w=s[h]||(s[h]=Object.create(null));w[p]||(w[p]=[])}),o.pending.forEach(l=>{const{provider:h,prefix:p,name:w}=l,y=wt(h,p),_=y.pendingIcons||(y.pendingIcons=new Set);_.has(w)||(_.add(w),s[h][p].push(w))}),a.forEach(l=>{const h=s[l.provider][l.prefix];h.length&&xa(l,h)}),t?la(t,o,a):gn};function ya(e,t){const r={...e};for(const o in t){const s=t[o],a=typeof s;o in Wn?(s===null||s&&(a==="string"||a==="number"))&&(r[o]=s):a===typeof r[o]&&(r[o]=o==="rotate"?s%4:s)}return r}const ba=/[\s,]+/;function va(e,t){t.split(ba).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ja(e,t=0){const r=e.replace(/^-?[0-9.]*/,"");function o(s){for(;s<0;)s+=4;return s%4}if(r===""){const s=parseInt(e);return isNaN(s)?0:o(s)}else if(r!==e){let s=0;switch(r){case"%":s=25;break;case"deg":s=90}if(s){let a=parseFloat(e.slice(0,e.length-r.length));return isNaN(a)?0:(a=a/s,a%1===0?o(a):0)}}return t}function ka(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const o in t)r+=" "+o+'="'+t[o]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+e+"</svg>"}function Sa(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Na(e){return"data:image/svg+xml,"+Sa(e)}function Ca(e){return'url("'+Na(e)+'")'}let It;function _a(){try{It=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{It=null}}function Ia(e){return It===void 0&&_a(),It?It.createHTML(e):e}const Zn={...Qn,inline:!1},Fa={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Pa={display:"inline-block"},br={backgroundColor:"currentColor"},eo={backgroundColor:"transparent"},wn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},yn={WebkitMask:br,mask:br,background:eo};for(const e in yn){const t=yn[e];for(const r in wn)t[e+r]=wn[r]}const Ea={...Zn,inline:!0};function bn(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Ta=(e,t,r)=>{const o=t.inline?Ea:Zn,s=ya(o,t),a=t.mode||"svg",i={},c=t.style||{},l={...a==="svg"?Fa:{}};if(r){const j=Xt(r,!1,!0);if(j){const C=["iconify"],H=["provider","prefix"];for(const B of H)j[B]&&C.push("iconify--"+j[B]);l.className=C.join(" ")}}for(let j in t){const C=t[j];if(C!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":l.ref=C;break;case"className":l[j]=(l[j]?l[j]+" ":"")+C;break;case"inline":case"hFlip":case"vFlip":s[j]=C===!0||C==="true"||C===1;break;case"flip":typeof C=="string"&&va(s,C);break;case"color":i.color=C;break;case"rotate":typeof C=="string"?s[j]=ja(C):typeof C=="number"&&(s[j]=C);break;case"ariaHidden":case"aria-hidden":C!==!0&&C!=="true"&&delete l["aria-hidden"];break;default:o[j]===void 0&&(l[j]=C)}}const h=Ys(e,s),p=h.attributes;if(s.inline&&(i.verticalAlign="-0.125em"),a==="svg"){l.style={...i,...c},Object.assign(l,p);let j=0,C=t.id;return typeof C=="string"&&(C=C.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:Ia(Qs(h.body,C?()=>C+"ID"+j++:"iconifyReact"))},g.createElement("svg",l)}const{body:w,width:y,height:_}=e,k=a==="mask"||(a==="bg"?!1:w.indexOf("currentColor")!==-1),E=ka(w,{...p,width:y+"",height:_+""});return l.style={...i,"--svg":Ca(E),width:bn(p.width),height:bn(p.height),...Pa,...k?br:eo,...c},g.createElement("span",l)};Kn(!0);Gs("",sa);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,r="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(o=>{try{(typeof o!="object"||o===null||o instanceof Array||typeof o.icons!="object"||typeof o.prefix!="string"||!Ms(o))&&console.error(r)}catch{console.error(r)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let r in t){const o="IconifyProviders["+r+"] is invalid.";try{const s=t[r];if(typeof s!="object"||!s||s.resources===void 0)continue;Xs(r,s)||console.error(o)}catch{console.error(o)}}}}function to(e){const[t,r]=g.useState(!!e.ssr),[o,s]=g.useState({});function a(_){if(_){const k=e.icon;if(typeof k=="object")return{name:"",data:k};const E=fn(k);if(E)return{name:k,data:E}}return{name:""}}const[i,c]=g.useState(a(!!e.ssr));function l(){const _=o.callback;_&&(_(),s({}))}function h(_){if(JSON.stringify(i)!==JSON.stringify(_))return l(),c(_),!0}function p(){var _;const k=e.icon;if(typeof k=="object"){h({name:"",data:k});return}const E=fn(k);if(h({name:k,data:E}))if(E===void 0){const j=wa([k],p);s({callback:j})}else E&&((_=e.onLoad)===null||_===void 0||_.call(e,k))}g.useEffect(()=>(r(!0),l),[]),g.useEffect(()=>{t&&p()},[e.icon,t]);const{name:w,data:y}=i;return y?Ta({...Fr,...y},e,w):e.children?e.children:e.fallback?e.fallback:g.createElement("span",{})}const oe=g.forwardRef((e,t)=>to({...e,_ref:t}));g.forwardRef((e,t)=>to({inline:!0,...e,_ref:t}));const rt="USD",Oa=(e,t=rt)=>{const r=(e==null?void 0:e.prices)??[];if(!r.length)return null;const o=i=>{var h,p;const c=i.find(w=>{var y;return!!((y=w.discounted)!=null&&y.value)});if(c)return{cent:c.discounted.value.centAmount,cur:c.discounted.value.currencyCode,regularCent:(h=c.value)==null?void 0:h.centAmount};const l=(p=i[0])==null?void 0:p.value;return l?{cent:l.centAmount,cur:l.currencyCode}:null},s=r.filter(i=>{var c,l;return((l=((c=i.discounted)==null?void 0:c.value)||i.value)==null?void 0:l.currencyCode)===t}),a=o(s);return a||o(r)||null},Aa=(e,t)=>{if(!Array.isArray(e))return"";const r=e.find(o=>o.name===t)||e.find(o=>{var s;return((s=o.name)==null?void 0:s.toLowerCase())===t.toLowerCase()});return!r||!r.value?"":typeof r.value=="object"?r.value.label||"":r.value},La=e=>{let t="";if(Array.isArray(e)){const r=e.find(o=>o.name==="size")||e.find(o=>o.name==="Size");r&&r.value&&(t=typeof r.value=="object"?r.value.label||"":r.value)}return{sizeLabel:t}},ht=e=>Aa((e==null?void 0:e.attributesRaw)??[],"color"),pt=e=>La((e==null?void 0:e.attributesRaw)??[]).sizeLabel,Ve=e=>e.charAt(0).toUpperCase()+e.slice(1),Ze={standard:{label:"Standard Delivery",fee:0,subtitle:"Arrives in 4–6 days (Free)",icon:"mdi:clock-outline"},express:{label:"Express Delivery",fee:5,subtitle:"Arrives in 1–2 days (+$5)",icon:"mdi:flash"},sameday:{label:"Same-Day Delivery",fee:10,subtitle:"Available in select locations (+$10)",icon:"mdi:truck-fast-outline"}},$a={standard:"GROUND",express:"2-DAY SHIPPING",sameday:"OVERNIGHT"},Ye=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},ro=e=>e==null?void 0:e.masterVariant,vn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ht=e=>{const t=ro(e);return t?[t,...vn(e)]:vn(e)},Da=(e,t=0)=>Ht(e)[t],za=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},jn=(e,t)=>{var r,o,s,a,i,c,l,h;return za(t)||((a=(s=(o=(r=e.imageGroups)==null?void 0:r[0])==null?void 0:o.images)==null?void 0:s[0])==null?void 0:a.link)||((h=(l=(c=(i=e.image_groups)==null?void 0:i[0])==null?void 0:c.images)==null?void 0:l[0])==null?void 0:h.link)||""},kn=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Vt=e=>{var a,i,c,l,h,p;const t=e?Oa(e,rt):null;if(t!=null&&t.cent&&(t!=null&&t.cur))return{amount:+(t.cent/100),currency:t.cur,regularAmount:t.regularCent?t.regularCent/100:void 0};const r=(c=(i=(a=e==null?void 0:e.prices)==null?void 0:a[0])==null?void 0:i.value)==null?void 0:c.centAmount,o=((p=(h=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:h.value)==null?void 0:p.currencyCode)??rt;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},Sn=(e,t)=>{const{amount:r}=Vt(t);if(r)return r;const o=(e==null?void 0:e.price)??(e==null?void 0:e.sellingPrice)??(e==null?void 0:e.unitPrice)??(e==null?void 0:e.mrp)??0,s=Number(o);return Number.isFinite(s)?s:0},Ma=e=>{var t;return(e==null?void 0:e.sku)||((t=e==null?void 0:e.variant)==null?void 0:t.sku)||(e==null?void 0:e.selectedSku)||""},qa=e=>{var t;return(e==null?void 0:e.color)||(e==null?void 0:e.selectedColor)||((t=e==null?void 0:e.variant)==null?void 0:t.color)||""},Ba=e=>{var t;return(e==null?void 0:e.size)||(e==null?void 0:e.selectedSize)||((t=e==null?void 0:e.variant)==null?void 0:t.size)||""},Nn=20,Ra=({open:e,onClose:t,product:r,index:o,addressListProp:s,addressLoading:a,variationAttributes:i})=>{const h=Ht(r),p=Math.min(Math.max(0,o||0),Math.max(0,h.length-1)),[w,y]=g.useState([]),[_,k]=g.useState(0);g.useEffect(()=>{if(r!=null&&r.variants){const d=E(r.variants,r.imageGroups,i);y(d)}},[r]);const E=(d,m,u)=>{const{colorMap:x,sizeMap:N}=j(u),A={};m==null||m.forEach(F=>{var ne,Se,Te;const q=(ne=F.variationAttributes)==null?void 0:ne.find(Oe=>Oe.id==="color"),T=(Te=(Se=q==null?void 0:q.values)==null?void 0:Se[0])==null?void 0:Te.value;T&&(A[T]||(A[T]={}),A[T][F.viewType]=F.images)});const U=d.reduce((F,q)=>{const T=q.variationValues.color,ne=q.variationValues.size;return F[T]||(F[T]={color:T,name:x[T]||T,images:A[T]||{},variants:[]}),F[T].variants.push({size:ne,name:N[ne]||ne,...q}),F},{});return Object.values(U).sort((F,q)=>{const T=F.colorName||F.color||"",ne=q.colorName||q.color||"";return T.localeCompare(ne)}).map(F=>({...F,variants:F.variants.sort((q,T)=>Number(q.size)-Number(T.size))}))},j=d=>{const m={},u={};return d==null||d.forEach(x=>{x.id==="color"&&x.values.forEach(N=>{m[N.value]=N.name}),x.id==="size"&&x.values.forEach(N=>{u[N.value]=N.name})}),{colorMap:m,sizeMap:u}},C=h.length,[H,B]=g.useState(p),[z,_e]=g.useState(null),[I,J]=g.useState(null),he=g.useRef(null),pe=g.useRef(null),v=Da(r,H),[Re,$e]=g.useState(""),[de,M]=g.useState(!1),[$,be]=g.useState(!1),[Ie,Fe]=g.useState(!1),[We,ge]=g.useState(""),[Ee,xe]=g.useState(!1),[S,ve]=g.useState(null),[Pe,se]=g.useState([]),[Zt,er]=g.useState([]),[f,R]=g.useState([]),[O,K]=g.useState(!1),[V,D]=g.useState(),[ue,ee]=g.useState(!0),[L,W]=g.useState(!1),[je,we]=g.useState(!1),[te,ye]=g.useState("standard"),[X,re]=g.useState(!1),[ke,b]=g.useState(!1),[ie,Q]=g.useState("card"),[Y,G]=g.useState(!1),[Ue,me]=g.useState(!1),[De,Z]=g.useState(!1),[Et,tr]=g.useState(null),[P,ze]=g.useState(null),[lt,ct]=g.useState(""),[Or,Ar]=g.useState(!1),[bt,no]=g.useState(r==null?void 0:r.id),Tt=g.useRef(null);g.useEffect(()=>{const d=Ht(r),m=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));B(m);const u=ro(r),x=ht(u),N=pt(u);he.current=x||null,pe.current=N||null,_e(x||null),J(N||null)},[o,r]),g.useEffect(()=>{Tt.current&&(Tt.current.scrollTop=Tt.current.scrollHeight)},[Pe,O,L,je,X,ke,Y,Ue,De,de,$]);const dt="var(--tanya)",Lr="var(--tanya-contrast)",Ot=dt,Me="#804c9e",oo=()=>{console.log("AgenticShopping feedback:",{rating:P,comment:lt}),Ar(!0)},so=()=>{ze(null),ct(""),Ar(!0)},$r=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??Et;return e?n.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-lg border border-green-200 bg-green-50 p-4 text-green-800",children:[n.jsx("div",{className:"success-tick-animation",children:n.jsx(oe,{icon:"mdi:check-circle",width:"28",color:"#16a34a"})}),n.jsxs("div",{className:"text-sm w-full",children:[n.jsx("div",{className:"font-semibold",children:"Success!"}),n.jsx("div",{children:"Your smart order has been saved. I’ll watch the price and auto-purchase when the conditions are met."}),u&&n.jsxs("div",{className:"mt-2 text-xs font-medium",children:["Your Smart Order ID: ",n.jsx("span",{className:"font-semibold text-blue-600 cursor-pointer underline",children:u})]}),!Or&&n.jsxs("div",{className:"mt-4 rounded-lg bg-white/70 p-3 text-gray-900",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Please post your feedback here"}),n.jsx("p",{className:"text-sm text-gray-700 mb-3",children:"Rate us on how much our response was helpful"}),n.jsx("div",{className:"flex items-center gap-1 mb-3",children:[1,2,3,4,5].map(x=>n.jsx("button",{type:"button",onClick:()=>ze(x),className:"p-0.5",children:n.jsx(oe,{icon:P&&P>=x?"mdi:star":"mdi:star-outline",width:"20",className:"text-yellow-500"})},x))}),n.jsx("label",{className:"block text-sm text-gray-700 mb-1",children:"Tell us more about the response"}),n.jsx("textarea",{value:lt,onChange:x=>ct(x.target.value),rows:3,className:"mt-1 w-full rounded-md border border-gray-300 p-2 text-sm outline-none focus:ring-1 focus:ring-gray-300",placeholder:"Your feedback helps us improve..."}),n.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:so,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:oo,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:dt},disabled:!P&&!lt.trim(),children:"Submit"})]})]}),Or&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},ao=async()=>{try{R(s)}catch(d){console.error("Error fetching addresses:",d)}},vt=(d,m)=>{se(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:m}])},Dr=(d,m)=>{se(u=>u.map(x=>x.response==="__CARD__"?{...x,response:"__SNAPSHOT__",snapshotStage:d??x.snapshotStage,snapshotPayload:m??x.snapshotPayload}:x))},io=()=>{se(d=>d.filter(m=>!(m.query===""&&m.response!=="__SNAPSHOT__"&&m.response!=="__TEXT__")))},At=()=>{me(!1),K(!1),we(!1),b(!1),W(!1),re(!1),G(!1),Z(!1),xe(!1),ve(null),io(),M(!1),be(!1)},lo=()=>{K(!1),W(!1),we(!1),ye("standard"),re(!1),b(!1),Q("card"),G(!1),me(!1),Z(!1),ee(!0),ve(null),localStorage.removeItem("agentic_order"),localStorage.removeItem("agentic_order_address"),localStorage.removeItem("agentic_order_delivery"),localStorage.removeItem("agentic_order_payment"),localStorage.removeItem("agentic_order_final")},Lt=g.useMemo(()=>Ht(r).map((m,u)=>({index:u,variant:m,images:((m==null?void 0:m.images)||[]).map(x=>(x==null?void 0:x.url)||"").filter(Boolean)})),[r]),jt=g.useMemo(()=>Lt.length?!!((z||void 0)&&(I||void 0)):!1,[Lt,z,I,v]),co=Ie||Ee||!jt,kt=d=>{const m=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(m)&&m>0?m:1},zr=d=>{const m=kt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(Sn(r,v)*m)},Mr=d=>{var F;const m=S,u=Vt(v),x=d||(m==null?void 0:m.currency)||u.currency||rt,N=zr(m),A=+(N*.08).toFixed(2),U=((F=Ze[te])==null?void 0:F.fee)||0;return{product_total:N,tax:A,shipping_fee:U,currency:x}},rr=async(d,m,u)=>{Dr(),lo(),Fe(!0),xe(!0),M(!1),be(!1);const x=Zt.slice(-Nn);try{const N=await ur(null,null);if(!N)throw new Error("Failed to fetch token");const A=localStorage.getItem("customerNumber"),U=localStorage.getItem("isLoggedIn"),q=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(U||!1),userId:String(A||new Date().getTime())}).toString()}`,T=await fetch(`${q}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${N}`},body:JSON.stringify({flowId:"MTMI0P4LC6",flowAliasId:"BCUA138F2Q",input:{instruction:`Use SKU ${m}. Currency is USD. ${d}`,metadata:{productId:(r==null?void 0:r.id)??null,skuId:m??null,variantIndex:u},context:x}})});if(!T.body)throw new Error("Readable stream not supported");const ne=T.body.getReader(),Se=new TextDecoder;let Te="",Oe="",Qe="";for(;;){const{done:Ce,value:He}=await ne.read();if(Ce)break;Te+=Se.decode(He,{stream:!0});const ut=Te.split(`
17
- `);Te=ut.pop()||"";for(const ft of ut){if(!ft.startsWith("data:"))continue;const Ge=ft.slice(5).trim();try{const qe=JSON.parse(Ge),Ae=qe.index,le=qe.data;Ae===0?Oe=String(le??""):Ae===1&&(Qe=String(le??""))}catch(qe){console.error("Error parsing JSON chunk:",qe)}}}let Ne=null;if(Oe){const Ce=String(Oe).replace(/\\n/g,"").trim();if(Ce.startsWith("{")&&Ce.endsWith("}"))try{Ne=JSON.parse(Ce),Ne.product_id=m,Ne.sku_id=m,localStorage.setItem("agentic_order",JSON.stringify(Ne))}catch(He){console.log(He)}}ve(Ne),Ne&&se(Ce=>[...Ce,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:Ne}}]),er(Ce=>[...Ce,{userQuery:d,mainResponse:Oe||"",keywords:Qe||""}].slice(-Nn))}catch(N){console.error("Error sending message to Tanya:",N),xe(!1)}finally{Fe(!1)}},qr=async d=>{if(Ee||Ie||!jt)return;const m=We.trim();if(!m)return;se(x=>[...x,{query:m,response:""}]),ge(""),$e(m);const u=bt||"";if(C<=1){if(u){rr(m,u,H);return}be(!0),xe(!0);return}u?(M(!0),xe(!0)):(be(!0),xe(!0))},uo=()=>{const d=bt;d&&rr(Re,d,H)},fo=()=>{M(!1),be(!0),xe(!0)},mo=()=>{if(!bt)return;rr(Re,bt,H)},ho=async()=>{K(!0),we(!1),b(!1),me(!1),W(!1),re(!1),G(!1),Z(!1),await ao(),Dr("initial",{extractedDetails:S??void 0})},po=()=>{if(!V)return;const d=f.find(m=>String(m.addressId??m.id)===V)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),W(!0),we(!0),re(!1),b(!1),G(!1),me(!1),Z(!1),vt("address",d))},go=()=>{W(!1),we(!1),re(!1),b(!1),G(!1),me(!1),Z(!1),localStorage.removeItem("agentic_order_address")},xo=()=>{te&&(localStorage.setItem("agentic_order_delivery",te),re(!0),b(!0),G(!1),me(!1),Z(!1),vt("delivery",{method:te,...Ze[te]}))},Br=()=>{we(!1),re(!1),b(!1),G(!1),me(!1),Z(!1),xe(!1),At(),se(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},wo=()=>{re(!1),b(!1),G(!1),me(!1),Z(!1),localStorage.removeItem("agentic_order_delivery")},yo=()=>{ie&&(localStorage.setItem("agentic_order_payment",ie),G(!0),me(!0),Z(!1),vt("payment",{method:ie}))},bo=()=>{b(!1),G(!1),me(!1),Z(!1),xe(!1),At(),se(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},vo=()=>{G(!1),me(!1),Z(!1),localStorage.removeItem("agentic_order_payment")},jo=async()=>{try{Fe(!0);const d=S||{},m=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),x=localStorage.getItem("agentic_order_payment")||"card",{product_total:N,tax:A,shipping_fee:U,currency:F}=Mr(),q=d.shopper_id||localStorage.getItem("customerId")||void 0,T=(m==null?void 0:m.addressId)||(m==null?void 0:m.id)||void 0,ne=u?$a[u]:"GROUND",Se="card-visa",Te=v==null?void 0:v.sku,Oe=(r==null?void 0:r.id)||"",Qe=kt(d),Ne=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(N*100),ut={shopper_id:q,shipping_address_id:T,shipping_method_id:ne,payment_method_id:Se,sku:Te,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Oe,quantity:Qe,max_price_minor:Ne,currency:F,instruction_text:Re};if(!q||!T){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:q,shippingAddressId:T}),alert("Missing customer or address information. Please re-select address and try again."),Fe(!1);return}const Ge=(await yt()).access_token;if(!Ge)throw new Error("Failed to fetch auth token for intent-mandate");const{serverUrl:qe}=ot(),Ae=await fetch(`${qe}/api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ge}`},body:JSON.stringify(ut)});if(!Ae.ok){const Io=await Ae.text().catch(()=>"");console.error("intent-mandate failed",Ae.status,Io),alert("Something went wrong while saving your smart order. Please try again."),Fe(!1);return}const le=await Ae.json().catch(()=>null);console.log("intent-mandate success:",le);const Xe=(le==null?void 0:le.intent_mandate_id)||(le==null?void 0:le.intent_mandateId)||(le==null?void 0:le.key)||null;Xe&&tr(Xe);const $t={...d,address:m,delivery:u,payment:x,summary:{product_total:N,tax:A,shipping_fee:U,currency:F},intent_mandate_id:Xe};localStorage.setItem("agentic_order_final",JSON.stringify($t)),Z(!0),ee(!1),vt("final",$t),vt("success",{intentMandateId:Xe}),At()}catch(d){console.error("Error in handleConfirmWatch / intent-mandate:",d),alert("Unable to complete your smart order right now. Please try again in a moment.")}finally{Fe(!1)}},Rr=()=>{At(),se(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},ko=({selectedIndex:d})=>{var T;const m=((T=w[d])==null?void 0:T.images.large[0].link)||jn(r,v),u=kn(r),x=bt||"",N=ht(v)||"",A=pt(v)||"",{amount:U}=Vt(v),F=!!(r!=null&&r.id),q=F;return n.jsx("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-4",children:[n.jsx("div",{className:"flex-shrink-0 flex justify-center sm:justify-start",children:n.jsx("div",{className:"w-[150px] h-[150px] rounded-lg bg-gray-50 border border-gray-200 flex items-center justify-center overflow-hidden",children:m?n.jsx("img",{src:m,alt:u,className:"object-contain w-full h-full"}):n.jsx(oe,{icon:"mdi:image-outline",width:"28",className:"opacity-60"})})}),n.jsxs("div",{className:"flex-grow flex flex-col justify-center text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-gray-900 mb-1",children:u}),n.jsx("div",{className:"text-sm text-gray-700 mb-1",children:[x&&`SKU: ${x}`,N&&`Color: ${N}`,A&&`Size: ${A}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:F?`$${r.price}`:"Currently unavailable"}),F&&!q&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},Ur=({showSubmit:d=!0})=>{const m={};Lt.map(x=>ht(x.variant)).filter(x=>!!x&&!m[x]&&(m[x]=!0));const u={};return Lt.map(x=>pt(x.variant)).filter(x=>!!x&&!u[x]&&(u[x]=!0)),n.jsxs("div",{className:"mx-4 mt-4 mb-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsx("h3",{className:"font-semibold text-gray-800",children:"Choose a variant"}),n.jsxs("div",{className:"mt-4",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("div",{className:"text-sm font-bold",children:"Color :"}),z&&n.jsx("div",{className:"text-sm text-gray-600",children:z})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:w.map((x,N)=>{const A=x.name,U=z===A,F=x.images.large[0].disBaseLink||x.images.large[0].link;return n.jsx("div",{className:`flex flex-col items-center w-28 border rounded-md p-2
18
- ${U?"border-2 border-[#804c9e]":"border-gray-300"}`,children:n.jsx("button",{onClick:()=>{_e(A),J(null),B(null),k(N)},className:"w-full h-20 flex items-center justify-center overflow-hidden",title:A,children:F?n.jsx("img",{src:F,alt:A,className:"w/full h-full object-contain"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs px-1",children:A})})},A)})})]}),z&&n.jsxs("div",{className:"mt-4",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("div",{className:"text-sm font-bold",children:"Size :"}),I&&n.jsx("div",{className:"text-sm text-gray-600",children:I})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(()=>{const x=w.find(N=>N.name===z);return x?x.variants.map((N,A)=>{const U=N.name,F=I===U;return n.jsx("button",{onClick:()=>{J(U),B(A),no(N.productId)},className:`px-4 py-2 rounded-md border text-sm ${F?"border-2 border-[#804c9e] font-semibold":"border-gray-300"}`,title:U,children:U},`size-${U}`)}):null})()})]}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:mo,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:Me},disabled:!jt,children:"Submit"})})]})},Hr=(d,m=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||S;if(!u)return null;const x=kt(u),{currency:N}=Vt(v),A=Sn(r,v),U=Number((u==null?void 0:u.max_price_minor)??0),q=Number.isFinite(U)&&U>0?+(U/100):+(A*x),T=(u==null?void 0:u.currency)||N||rt,ne=v!=null&&v.sku?v.sku:u.product_id;return n.jsxs("div",{className:"px-6 pb-6 flex flex-col items-center space-y-4",style:{backgroundColor:"#e5dbeb"},children:[n.jsx("p",{className:"text-base font-semibold text-center mt-2",style:{color:Lr},children:"Here’s what I found from your instruction:"}),n.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-inner p-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-y-2 text-sm",children:[n.jsx("p",{className:"font-semibold text-gray-600",children:"SKU:"}),n.jsx("p",{className:"text-gray-800",children:ne}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Quantity:"}),n.jsx("p",{className:"text-gray-800",children:kt(u)}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Currency:"}),n.jsx("p",{className:"text-gray-800",children:T}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Maximum Total Price:"}),n.jsx("p",{className:"text-gray-800",children:Ye(q,T)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[ht(v)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",ht(v)]}),pt(v)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",pt(v)]}),(v==null?void 0:v.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",v.sku]})]})]}),!m&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"text-sm font-medium text-gray-700 text-center max-w-[90%] leading-relaxed",style:{color:Lr},children:["Would you like me to ",n.jsx("strong",{children:"lock this in"})," and monitor it for you?"]}),n.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[n.jsxs("button",{onClick:ho,disabled:O,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${O?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:Me},children:[n.jsx(oe,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Rr,disabled:O,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${O?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:Me,color:Me},children:[n.jsx(oe,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Vr=(d,m=!0)=>{var ft,Ge,qe,Ae,le,Xe;const u=d||{},x=((ft=u==null?void 0:u.summary)==null?void 0:ft.currency)||(S==null?void 0:S.currency)||rt,N=jn(r,v),A=kn(r),U=v!=null&&v.sku?v.sku:(r==null?void 0:r.id)??(S==null?void 0:S.product_id),F=(v==null?void 0:v.sku)??Ma(r),q=ht(v)||qa(r),T=pt(v)||Ba(r),ne=kt(u),Se=((Ge=u==null?void 0:u.summary)==null?void 0:Ge.product_total)!=null?+u.summary.product_total:zr(u),Te=ne>0?+(Se/ne).toFixed(2):0,Oe=Se,Qe=((qe=u==null?void 0:u.summary)==null?void 0:qe.tax)??+(Se*.08).toFixed(2),Ne=((Ae=u==null?void 0:u.summary)==null?void 0:Ae.shipping_fee)??(((le=Ze[te])==null?void 0:le.fee)||0),Ce=u!=null&&u.address?[u.address.addressLine1,u.address.addressLine2,u.address.street,[u.address.city,u.address.state,u.address.postalCode].filter(Boolean).join(", "),u.address.country].filter(Boolean).map($t=>Ve(String($t))).join(", "):"—",He=(u==null?void 0:u.payment)||"card",ut=He==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Ve(He)});return n.jsxs("div",{className:"mx-auto mt-3 mb-3 rounded-2xl bg-white",children:[n.jsx("div",{className:"px-6 pt-5 pb-3",children:n.jsxs("h3",{className:"font-semibold text-lg mb-2 text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:receipt-text-check-outline",width:"24",color:dt}),"All set! Here’s what your smart order looks like 🧾"]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-4 rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"sm:col-span-2 flex",children:n.jsx("div",{className:"w-30 h-26 sm:w-30 sm:h-26 overflow-hidden rounded-lg bg-white border border-gray-200 flex items-center justify-center mx-auto sm:mx-0",children:N?n.jsx("img",{src:N,alt:A,className:"w-full h-full object-contain"}):n.jsx(oe,{icon:"mdi:image-outline",width:"24",className:"opacity-50"})})}),n.jsxs("div",{className:"sm:col-span-10",children:[n.jsxs("div",{className:"mb-3",children:[n.jsx("div",{className:"text-lg text-center font-bold text-gray-900",children:A}),n.jsxs("div",{className:"text-xs text-center font-bold text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",U??"—"]}),(F||q||T)&&n.jsxs("div",{className:"text-xs text-gray-600 mt-0.5 text-center",children:[F&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",F,"  "]}),q&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",q,"  "]}),T&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Size:"})," ",T]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md-grid-cols-3 md:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Unit Price"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:Ye(Te,x)})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Quantity"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:ne})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Subtotal"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:Ye(Oe,x)})]})]})]})]})}),n.jsxs("div",{className:"px-6 pb-2",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-3",children:[n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🏠 Address"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:Ce})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💳 Payment"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:ut})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Delivery"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:u!=null&&u.delivery&&((Xe=Ze[u.delivery])==null?void 0:Xe.label)||"—"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💰 any(s)"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ye(Se,x)})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🏛️ Taxes"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ye(Qe,x)})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Shipping"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ye(Ne,x)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:Ot},children:[n.jsx("div",{className:"text-sm/5 opacity-95",children:"🔹 Total Payable"}),n.jsx("div",{className:"mt-1 text-3xl font-extrabold tracking-tight",children:Ye(Se+Qe+Ne,x)})]})]}),!m&&n.jsxs("div",{className:"px-6 pb-5",children:[!De&&n.jsx("p",{className:"mt-3 text-center text-sm text-gray-700",children:"Everything looks good! Do you want me to watch this product and buy it automatically when it meets your condition?"}),De&&$r({intentMandateId:Et}),ue&&!De&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:jo,className:"inline-flex items-center justify-center rounded-full px-6 py-2.5 font-semibold text-white shadow-md transition-transform duration-150 hover:-translate-y-0.5 hover:shadow-lg",style:{background:Ot},children:"Confirm"}),n.jsx("button",{onClick:Rr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:Ot,color:Ot},children:"Cancel"})]})]})]})},So=d=>{if(!d)return null;const m=[d.addressLine1,d.addressLine2,d.street,[d.city,d.state,d.postalCode].filter(Boolean).join(", "),d.country].filter(u=>!!u).map(u=>Ve(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"20",color:dt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:m})]})})},No=d=>{const m=d==null?void 0:d.method,u=m?Ze[m]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"20",color:dt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:u?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(oe,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},Co=d=>{const m=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"20",color:dt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Payment Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:m==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820   Exp: 12/26"]}):Ve(m)})]})})},_o=(d,m)=>{const u=d.snapshotStage;if(!u||u==="address"&&O||u==="delivery"&&je||u==="payment"&&ke||u==="final"&&Ue)return null;switch(u){case"initial":return Hr(d.snapshotPayload,!m);case"address":return So(d.snapshotPayload);case"delivery":return No(d.snapshotPayload);case"payment":return Co(d.snapshotPayload);case"final":return Vr(d.snapshotPayload,!m);case"success":return $r(d.snapshotPayload);default:return null}};return Eo.createPortal(n.jsxs("div",{className:"fixed inset-0",style:{zIndex:2147483647},"aria-modal":"true",role:"dialog",children:[n.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.25)"},onClick:t}),n.jsx("div",{className:"absolute right-0 ",children:n.jsxs("div",{className:"w-[64.7vw] h-screen bg-white rounded-xl overflow-hidden flex flex-col shadow-xl",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTopLeftRadius:"0.75rem",borderBottomLeftRadius:"0.75rem",padding:"0.25rem",background:Me},children:[n.jsxs("div",{style:{display:"flex",color:"#ffffff",alignItems:"center",gap:"0.5rem"},children:[n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 256 256",children:n.jsxs("g",{fill:"currentColor",children:[n.jsx("path",{d:"m194.82 151.43l-55.09 20.3l-20.3 55.09a7.92 7.92 0 0 1-14.86 0l-20.3-55.09l-55.09-20.3a7.92 7.92 0 0 1 0-14.86l55.09-20.3l20.3-55.09a7.92 7.92 0 0 1 14.86 0l20.3 55.09l55.09 20.3a7.92 7.92 0 0 1 0 14.86",opacity:"0.2"}),n.jsx("path",{d:"M197.58 129.06L146 110l-19-51.62a15.92 15.92 0 0 0-29.88 0L78 110l-51.62 19a15.92 15.92 0 0 0 0 29.88L78 178l19 51.62a15.92 15.92 0 0 0 29.88 0L146 178l51.62-19a15.92 15.92 0 0 0 0-29.88ZM137 164.22a8 8 0 0 0-4.74 4.74L112 223.85L91.78 169a8 8 0 0 0-4.78-4.78L32.15 144L87 123.78a8 8 0 0 0 4.78-4.78L112 64.15L132.22 119a8 8 0 0 0 4.74 4.74L191.85 144ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8"})]})}),n.jsx("div",{children:n.jsx("p",{className:"font-bold",children:"Agentic Shopping with TANYA"})})]}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx(oe,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:Tt,className:"overflow-y-auto pr-5 pb-4 space-y-4 hide-scrollbar flex-grow",children:[n.jsxs("div",{className:"text-sm text-[16px] rounded-r-xl p-3 m-3 rounded-bl-xl w-3/4 text-tanya-contrast",style:{backgroundColor:"#e5dbeb"},children:["Welcome to your smart shopping companion!",n.jsxs("p",{children:["Simply share your instruction — like “If this product goes below $",parseInt(r.price)-5," grab it for me.”"]}),n.jsx("p",{children:"I’ll monitor it, calculate total prices, and place the order when your conditions are met."})]}),n.jsx(ko,{selectedIndex:_}),C>1&&n.jsx(Ur,{showSubmit:!1}),Pe.map((d,m)=>{var N;const u=m===Pe.length-1,x=!!d.snapshotStage;return n.jsxs("div",{children:[d.query&&n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm rounded-l-xl p-3 m-3 mb-4 rounded-br-xl max-w-[75%]",style:{color:"#ffffff",backgroundColor:"var(--tanya)"},children:d.query})}),d.response==="__TEXT__"&&((N=d.snapshotPayload)==null?void 0:N.text)&&n.jsx("div",{className:"mt-2",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&de&&C>1&&n.jsxs("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsxs("div",{className:"text-sm text-gray-800",children:["Proceed with color:"," ",n.jsx("span",{className:"font-semibold",children:z||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:I||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:uo,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:Me},children:"Yes"}),n.jsx("button",{onClick:fo,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:Me,color:Me},children:"No, change SKU"})]})]}),u&&$&&n.jsx(Ur,{showSubmit:!0}),u&&Ie&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text",children:n.jsx("p",{children:"Reading your instruction and setting things up…"})})})}),(x||d.response==="__CARD__")&&(!Ie||!u)&&n.jsx("div",{className:"mt-6 mb-4 mx-4 animate-fade-in",style:{backgroundColor:"#fff",borderRadius:"1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.08)",overflow:"hidden"},children:x?_o(d,u):Hr(d.snapshotPayload,!1)})]},m)}),O&&n.jsxs("div",{className:"mt-6 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),L&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!De&&n.jsx("button",{onClick:go,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change address",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Choose where you’d like us to deliver this item."}),a?n.jsxs("div",{className:"flex items-center py-6",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottomColor:"var(--tanya-light)"}}),n.jsx("p",{className:"ml-3 text-gray-600",children:"Fetching your addresses..."})]}):f.length>0?n.jsxs("div",{className:`space-y-3 ${L?"opacity-70":""}`,children:[f.map(d=>{const m=[d.addressLine1,d.addressLine2].filter(Boolean).map(F=>Ve(F||"")).join(" "),u=Ve(d.city||""),x=`${Ve(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,N=Ve(d.country||""),A=String(d.addressId??d.id),U=V===A;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${U?"border-tanya-light":"border-gray-300"} ${L?"pointer-events-none":""}`,title:L?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:U,disabled:L,onChange:()=>D(A),value:A}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800",children:m||"Address"}),n.jsxs("div",{className:"text-sm text-gray-700",children:[u,n.jsx("br",{}),x,n.jsx("br",{}),N]})]})]},A)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:Br,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:po,disabled:L,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${L?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:Me},children:L?"Address Submitted":"Submit Address"})]})]}):n.jsx("div",{className:"text-center py-8 text-gray-600",children:"No addresses found. Please add a new one in your profile."})]}),je&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),X&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!De&&n.jsx("button",{onClick:wo,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change shipping method",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Which one would you like me to use for this order?"}),n.jsx("div",{className:`space-y-3 ${X?"opacity-70":""}`,children:Object.keys(Ze).map(d=>{const m=Ze[d],u=te===d;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${u?"border-tanya-light":"border-gray-300"} ${X?"pointer-events-none":""}`,title:X?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:u,disabled:X,onChange:()=>ye(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:m.icon,width:"18"})," ",m.label]}),n.jsx("div",{className:"text-sm text-gray-700",children:m.subtitle})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:m.fee===0?"Free":Ye(m.fee,(S==null?void 0:S.currency)||rt)})]},d)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:Br,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:xo,disabled:X,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${X?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:"var(--tanya)"},children:X?"Delivery Submitted":"Submit Delivery Option"})]})]}),ke&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),Y&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!De&&n.jsx("button",{onClick:vo,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change payment method",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Please choose a payment method for this order:"}),n.jsx("div",{className:`space-y-3 ${Y?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${ie==="card"?"border-tanya-light":"border-gray-300"} ${Y?"pointer-events-none":""}`,title:Y?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:ie==="card",disabled:Y,onChange:()=>Q("card")}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),ie==="card"&&n.jsxs("div",{className:"text-sm text-gray-700 mt-1",children:["Mastercard    •••• 7820",n.jsx("br",{}),"Expiry: 12/26"]})]})]})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:bo,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:yo,disabled:Y,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${Y?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:"var(--tanya)"},children:Y?"Payment Submitted":"Submit Payment Method"})]})]}),Ue&&Vr({...S,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:Mr(S==null?void 0:S.currency)},!1)]}),n.jsxs("div",{className:"sticky bottom-0 w-[96%] drop-shadow-xl flex items-center rounded-full bg-white border border-gray-300 m-[15px]",children:[n.jsx("input",{placeholder:Ee?"Complete the current step…":jt?`What would you like me to do? (e.g., If this product goes below $${parseInt(r.price)-5}, grab it for me.)`:"Please select a combination first.",disabled:co,className:`w-full rounded-full p-4 outline-none border-none focus:ring-0 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed
15
+ `,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>y(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${be?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:M,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(L==null?void 0:L.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.map(f=>n.jsx("button",{onClick:()=>We(f),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:pe===s[f]?"#FFFFFF":"#F3F3F3",borderColor:pe===s[f]?"#BBB3DD":""},children:f},f))})]}),Le.map((f,R)=>{var O,K;return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]",children:f.query})}),f.response&&f.response.includes("Thinking")?n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans animate-pulse font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:nr(f.response)}})}):n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:nr(f.response)}})}),_e&&!f.response.includes("Thinking")&&((O=f.products)==null?void 0:O.length)==0&&n.jsx("div",{children:n.jsx("p",{className:"text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]",children:"Finding best products for you"})}),(f==null?void 0:f.products)&&((K=f==null?void 0:f.products)==null?void 0:K.length)>0&&n.jsx(Wo,{chat:f.products,storeDetails:L}),(f==null?void 0:f.potentialQuestions.length)>0&&n.jsxs("div",{className:"my-2 px-4 text-sm text-gray-700",children:[n.jsx("p",{className:"font-nunitoSans font-bold text-sm text-[#494949]",style:{color:L.themeDarkColor},children:"Why not explore these inquiries..."}),f.potentialQuestions.split(",").map((V,D)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${L.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>Pe(V),style:{backgroundColor:L.tanyaThemeColorLight},children:V},D))]}),(f==null?void 0:f.secondaryLoading)&&n.jsx("div",{className:"mt-3 mb-4 px-4",children:n.jsxs("div",{className:"tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",style:{margin:"0.75rem"},children:[n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"tanya-sparkle tanya-sparkle-1",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-2",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-3",children:"✨"})]}),n.jsx("div",{className:"tanya-shimmer"}),n.jsx("p",{className:"font-semibold tanya-pulse",style:{color:L.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:L.themeDarkColor},children:"• • •"})]})}),(f==null?void 0:f.secondaryResponse)&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]",children:[n.jsx("div",{className:"text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",style:{backgroundColor:L.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:nr(f.secondaryResponse)}}),f.productSnapshot&&n.jsx("div",{className:"mt-4 w-full",children:n.jsxs("div",{className:"flex gap-4 items-stretch rounded-2xl p-4",style:{backgroundColor:L.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:f.productSnapshot.image?n.jsx("img",{src:f.productSnapshot.image,alt:f.productSnapshot.name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-500",children:"No Image"})}),n.jsxs("div",{className:"flex flex-col flex-1 justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-[15px] leading-snug",children:f.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:f.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(L==null?void 0:L.currency)||"USD"}).format(f.productSnapshot.price):""}),f.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[f.productSnapshot.points," ","points"]})]})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center border rounded-full overflow-hidden",children:[n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>de(V=>V.map((D,ue)=>ue===R&&D.productSnapshot?{...D,productSnapshot:{...D.productSnapshot,quantity:Math.max(1,D.productSnapshot.quantity-1)}}:D)),style:{background:"transparent",color:L.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:f.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>de(V=>V.map((D,ue)=>ue===R&&D.productSnapshot?{...D,productSnapshot:{...D.productSnapshot,quantity:D.productSnapshot.quantity+1}}:D)),style:{background:"transparent",color:L.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{er(Re(f.productSnapshot),f.productSnapshot.quantity)},disabled:C,className:"px-4 py-2 rounded-full font-medium",style:{background:L.tanyaThemeColor,color:(L==null?void 0:L.tanyaThemeContrastColor)||"#fff",opacity:C?.8:1},children:C?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},R)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:J,autoFocus:!0,onChange:f=>he(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!B&&Pe()}}),n.jsx("button",{type:"submit",disabled:B,className:"p-3",onClick:()=>Pe(),children:B?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:L.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(Go,{addToCartPwa:r})]})]})]})]})})};var mr=function(e,t){return mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},mr(e,t)};function Zo(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");mr(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Je=function(){return Je=Object.assign||function(t){for(var r,o=1,s=arguments.length;o<s;o++){r=arguments[o];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Je.apply(this,arguments)};function es(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(e);s<o.length;s++)t.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(r[o[s]]=e[o[s]]);return r}var or="Invariant Violation",Xr=Object.setPrototypeOf,ts=Xr===void 0?function(e,t){return e.__proto__=t,e}:Xr,An=(function(e){Zo(t,e);function t(r){r===void 0&&(r=or);var o=e.call(this,typeof r=="number"?or+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=or,ts(o,t.prototype),o}return t})(Error);function et(e,t){if(!e)throw new An(t)}var $n=["debug","log","warn","error","silent"],rs=$n.indexOf("log");function zt(e){return function(){if($n.indexOf(e)>=rs){var t=console[e]||console.log;return t.apply(console,arguments)}}}(function(e){e.debug=zt("debug"),e.log=zt("log"),e.warn=zt("warn"),e.error=zt("error")})(et||(et={}));var Ln="3.14.0";function mt(e){try{return e()}catch{}}const hr=mt(function(){return globalThis})||mt(function(){return window})||mt(function(){return self})||mt(function(){return global})||mt(function(){return mt.constructor("return this")()});var Zr=new Map;function ns(e){var t=Zr.get(e)||1;return Zr.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function os(e,t){var r=ns("stringifyForDisplay");return JSON.stringify(e,function(o,s){return s===void 0?r:s},t).split(JSON.stringify(r)).join("<undefined>")}function Mt(e){return function(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof t=="number"){var s=t;t=jr(s),t||(t=kr(s,r),r=[])}e.apply(void 0,[t].concat(r))}}var sr=Object.assign(function(t,r){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];t||et(t,jr(r,o)||kr(r,o))},{debug:Mt(et.debug),log:Mt(et.log),warn:Mt(et.warn),error:Mt(et.error)});function Dn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new An(jr(e,t)||kr(e,t))}var en=Symbol.for("ApolloErrorMessageHandler_"+Ln);function zn(e){if(typeof e=="string")return e;try{return os(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function jr(e,t){if(t===void 0&&(t=[]),!!e)return hr[en]&&hr[en](e,t.map(zn))}function kr(e,t){if(t===void 0&&(t=[]),!!e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:Ln,message:e,args:t.map(zn)})))}function ss(e){return e.definitions.filter(function(t){return t.kind==="OperationDefinition"&&!!t.name}).map(function(t){return t.name.value})[0]||null}let ae=null;const tn={};let as=1;const is=()=>class{constructor(){this.id=["slot",as++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let t=ae;t;t=t.parent)if(this.id in t.slots){const r=t.slots[this.id];if(r===tn)break;return t!==ae&&(ae.slots[this.id]=r),!0}return ae&&(ae.slots[this.id]=tn),!1}getValue(){if(this.hasValue())return ae.slots[this.id]}withValue(t,r,o,s){const a={__proto__:null,[this.id]:t},i=ae;ae={parent:i,slots:a};try{return r.apply(s,o)}finally{ae=i}}static bind(t){const r=ae;return function(){const o=ae;try{return ae=r,t.apply(this,arguments)}finally{ae=o}}}static noContext(t,r,o){if(ae){const s=ae;try{return ae=null,t.apply(o,r)}finally{ae=s}}else return t.apply(o,r)}};function rn(e){try{return e()}catch{}}const ar="@wry/context:Slot",ls=rn(()=>globalThis)||rn(()=>global)||Object.create(null),nn=ls,Sr=nn[ar]||Array[ar]||(function(e){try{Object.defineProperty(nn,ar,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}})(is()),{bind:Va,noContext:Ya}=Sr;new Sr;function cs(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=ds(e))||t){r&&(e=r);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
16
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ds(e,t){if(e){if(typeof e=="string")return on(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return on(e,t)}}function on(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function sn(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Nr(e,t,r){return t&&sn(e.prototype,t),r&&sn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Cr=function(){return typeof Symbol=="function"},_r=function(e){return Cr()&&!!Symbol[e]},Ir=function(e){return _r(e)?Symbol[e]:"@@"+e};Cr()&&!_r("observable")&&(Symbol.observable=Symbol("observable"));var us=Ir("iterator"),pr=Ir("observable"),Mn=Ir("species");function Qt(e,t){var r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function St(e){var t=e.constructor;return t!==void 0&&(t=t[Mn],t===null&&(t=void 0)),t!==void 0?t:ce}function fs(e){return e instanceof ce}function xt(e){xt.log?xt.log(e):setTimeout(function(){throw e})}function Bt(e){Promise.resolve().then(function(){try{e()}catch(t){xt(t)}})}function qn(e){var t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t=="function")t();else{var r=Qt(t,"unsubscribe");r&&r.call(t)}}catch(o){xt(o)}}function gr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function ms(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(Bn(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function Bn(e,t,r){e._state="running";var o=e._observer;try{var s=Qt(o,t);switch(t){case"next":s&&s.call(o,r);break;case"error":if(gr(e),s)s.call(o,r);else throw r;break;case"complete":gr(e),s&&s.call(o);break}}catch(a){xt(a)}e._state==="closed"?qn(e):e._state==="running"&&(e._state="ready")}function ir(e,t,r){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:t,value:r});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:t,value:r}],Bt(function(){return ms(e)});return}Bn(e,t,r)}}var hs=(function(){function e(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new ps(this);try{this._cleanup=o.call(void 0,s)}catch(a){s.error(a)}this._state==="initializing"&&(this._state="ready")}var t=e.prototype;return t.unsubscribe=function(){this._state!=="closed"&&(gr(this),qn(this))},Nr(e,[{key:"closed",get:function(){return this._state==="closed"}}]),e})(),ps=(function(){function e(r){this._subscription=r}var t=e.prototype;return t.next=function(o){ir(this._subscription,"next",o)},t.error=function(o){ir(this._subscription,"error",o)},t.complete=function(){ir(this._subscription,"complete")},Nr(e,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),e})(),ce=(function(){function e(r){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var t=e.prototype;return t.subscribe=function(o){return(typeof o!="object"||o===null)&&(o={next:o,error:arguments[1],complete:arguments[2]}),new hs(o,this._subscriber)},t.forEach=function(o){var s=this;return new Promise(function(a,i){if(typeof o!="function"){i(new TypeError(o+" is not a function"));return}function c(){l.unsubscribe(),a()}var l=s.subscribe({next:function(h){try{o(h,c)}catch(p){i(p),l.unsubscribe()}},error:i,complete:a})})},t.map=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{c=o(c)}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.filter=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{if(!o(c))return}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.reduce=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this),i=arguments.length>1,c=!1,l=arguments[1],h=l;return new a(function(p){return s.subscribe({next:function(w){var y=!c;if(c=!0,!y||i)try{h=o(h,w)}catch(_){return p.error(_)}else h=w},error:function(w){p.error(w)},complete:function(){if(!c&&!i)return p.error(new TypeError("Cannot reduce an empty sequence"));p.next(h),p.complete()}})})},t.concat=function(){for(var o=this,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var c=St(this);return new c(function(l){var h,p=0;function w(y){h=y.subscribe({next:function(_){l.next(_)},error:function(_){l.error(_)},complete:function(){p===a.length?(h=void 0,l.complete()):w(c.from(a[p++]))}})}return w(o),function(){h&&(h.unsubscribe(),h=void 0)}})},t.flatMap=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){var c=[],l=s.subscribe({next:function(p){if(o)try{p=o(p)}catch(y){return i.error(y)}var w=a.from(p).subscribe({next:function(y){i.next(y)},error:function(y){i.error(y)},complete:function(){var y=c.indexOf(w);y>=0&&c.splice(y,1),h()}});c.push(w)},error:function(p){i.error(p)},complete:function(){h()}});function h(){l.closed&&c.length===0&&i.complete()}return function(){c.forEach(function(p){return p.unsubscribe()}),l.unsubscribe()}})},t[pr]=function(){return this},e.from=function(o){var s=typeof this=="function"?this:e;if(o==null)throw new TypeError(o+" is not an object");var a=Qt(o,pr);if(a){var i=a.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return fs(i)&&i.constructor===s?i:new s(function(c){return i.subscribe(c)})}if(_r("iterator")&&(a=Qt(o,us),a))return new s(function(c){Bt(function(){if(!c.closed){for(var l=cs(a.call(o)),h;!(h=l()).done;){var p=h.value;if(c.next(p),c.closed)return}c.complete()}})});if(Array.isArray(o))return new s(function(c){Bt(function(){if(!c.closed){for(var l=0;l<o.length;++l)if(c.next(o[l]),c.closed)return;c.complete()}})});throw new TypeError(o+" is not observable")},e.of=function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var i=typeof this=="function"?this:e;return new i(function(c){Bt(function(){if(!c.closed){for(var l=0;l<s.length;++l)if(c.next(s[l]),c.closed)return;c.complete()}})})},Nr(e,null,[{key:Mn,get:function(){return this}}]),e})();Cr()&&Object.defineProperty(ce,Symbol("extensions"),{value:{symbol:pr,hostReportError:xt},configurable:!0});function gs(e){var t,r=e.Symbol;if(typeof r=="function")if(r.observable)t=r.observable;else{typeof r.for=="function"?t=r.for("https://github.com/benlesh/symbol-observable"):t=r("https://github.com/benlesh/symbol-observable");try{r.observable=t}catch{}}else t="@@observable";return t}var gt;typeof self<"u"?gt=self:typeof window<"u"?gt=window:typeof global<"u"?gt=global:typeof module<"u"?gt=module:gt=Function("return this")();gs(gt);var an=ce.prototype,ln="@@observable";an[ln]||(an[ln]=function(){return this});function xs(e){for(var t=["query","operationName","variables","extensions","context"],r=0,o=Object.keys(e);r<o.length;r++){var s=o[r];if(t.indexOf(s)<0)throw Dn(58,s)}return e}function ws(e,t){var r=Je({},e),o=function(a){typeof a=="function"?r=Je(Je({},r),a(r)):r=Je(Je({},r),a)},s=function(){return Je({},r)};return Object.defineProperty(t,"setContext",{enumerable:!1,value:o}),Object.defineProperty(t,"getContext",{enumerable:!1,value:s}),t}function ys(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName=typeof t.query!="string"?ss(t.query)||void 0:""),t}var bs=Symbol.for("apollo.deprecations"),vs=hr,js=new Sr;function ks(e){return vs[bs]||(js.getValue()||[]).includes(e)}function Ss(e,t){ks(e)||t()}function cn(e,t){return t?t(e):ce.of()}function Nt(e){return typeof e=="function"?new Rn(e):e}function qt(e){return e.request.length<=1}var Rn=(function(){function e(t){t&&(this.request=t)}return e.empty=function(){return new e(function(){return ce.of()})},e.from=function(t){return t.length===0?e.empty():t.map(Nt).reduce(function(r,o){return r.concat(o)})},e.split=function(t,r,o){var s=Nt(r),a=Nt(o||new e(cn)),i;return qt(s)&&qt(a)?i=new e(function(c){return t(c)?s.request(c)||ce.of():a.request(c)||ce.of()}):i=new e(function(c,l){return t(c)?s.request(c,l)||ce.of():a.request(c,l)||ce.of()}),Object.assign(i,{left:s,right:a})},e.execute=function(t,r){return t.request(ws(r.context,ys(xs(r))))||ce.of()},e.concat=function(t,r){var o=Nt(t);if(qt(o))return globalThis.__DEV__!==!1&&sr.warn(47,o),o;var s=Nt(r),a;return qt(s)?a=new e(function(i){return o.request(i,function(c){return s.request(c)||ce.of()})||ce.of()}):a=new e(function(i,c){return o.request(i,function(l){return s.request(l,c)||ce.of()})||ce.of()}),Object.assign(a,{left:o,right:s})},e.prototype.split=function(t,r,o){return this.concat(e.split(t,r,o||new e(cn)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(t,r){throw Dn(48)},e.prototype.onError=function(t,r){if(globalThis.__DEV__!==!1&&Ss("onError",function(){globalThis.__DEV__!==!1&&sr.warn(49)}),r&&r.error)return r.error(t),!1;throw t},e.prototype.setOnError=function(t){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&sr.warn(50),this.onError=t,this},e})();function Ns(e){return new Rn(function(t,r){var o=es(t,[]);return new ce(function(s){var a,i=!1;return Promise.resolve(o).then(function(c){return e(c,t.getContext())}).then(t.setContext).then(function(){i||(a=r(t).subscribe({next:s.next.bind(s),error:s.error.bind(s),complete:s.complete.bind(s)}))}).catch(s.error.bind(s)),function(){i=!0,a&&a.unsubscribe()}})})}const Cs=async()=>{const e="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const s=await fe.post(e,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return s.status===200&&s.data.access_token?s.data.access_token:(console.error("Failed to fetch token:",s.data),null)}catch(s){return fe.isAxiosError(s)?console.error("Error fetching token:",s.response||s.message):console.error("Unexpected error:",s),null}},_s="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Is=Yt.createHttpLink({uri:`${_s}`}),Fs=Ns(async(e,{headers:t})=>{const r=await Cs();return{headers:{...t,authorization:`Bearer ${r}`}}}),Ps=new Yt.ApolloClient({link:Fs.concat(Is),cache:new Yt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),Es=e=>{const{tanyaConfig:t}=e;return n.jsx(Yt.ApolloProvider,{client:Ps,children:n.jsx(qo,{children:n.jsx(Xo,{tanyaConfig:t})})})};function Ts(e,t){const r=e.icons,o=e.aliases||Object.create(null),s=Object.create(null);function a(i){if(r[i])return s[i]=[];if(!(i in s)){s[i]=null;const c=o[i]&&o[i].parent,l=c&&a(c);l&&(s[i]=[c].concat(l))}return s[i]}return Object.keys(r).concat(Object.keys(o)).forEach(a),s}const Un=Object.freeze({left:0,top:0,width:16,height:16}),Gt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Fr=Object.freeze({...Un,...Gt}),xr=Object.freeze({...Fr,body:"",hidden:!1});function Os(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const o=((e.rotate||0)+(t.rotate||0))%4;return o&&(r.rotate=o),r}function dn(e,t){const r=Os(e,t);for(const o in xr)o in Gt?o in e&&!(o in r)&&(r[o]=Gt[o]):o in t?r[o]=t[o]:o in e&&(r[o]=e[o]);return r}function As(e,t,r){const o=e.icons,s=e.aliases||Object.create(null);let a={};function i(c){a=dn(o[c]||s[c],a)}return i(t),r.forEach(i),dn(e,a)}function Hn(e,t){const r=[];if(typeof e!="object"||typeof e.icons!="object")return r;e.not_found instanceof Array&&e.not_found.forEach(s=>{t(s,null),r.push(s)});const o=Ts(e);for(const s in o){const a=o[s];a&&(t(s,As(e,s,a)),r.push(s))}return r}const $s={provider:"",aliases:{},not_found:{},...Un};function lr(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Vn(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!lr(e,$s))return null;const r=t.icons;for(const s in r){const a=r[s];if(!s||typeof a.body!="string"||!lr(a,xr))return null}const o=t.aliases||Object.create(null);for(const s in o){const a=o[s],i=a.parent;if(!s||typeof i!="string"||!r[i]&&!o[i]||!lr(a,xr))return null}return t}const un=Object.create(null);function Ls(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function wt(e,t){const r=un[e]||(un[e]=Object.create(null));return r[t]||(r[t]=Ls(e,t))}function Yn(e,t){return Vn(t)?Hn(t,(r,o)=>{o?e.icons[r]=o:e.missing.add(r)}):[]}function Ds(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}const Jn=/^[a-z0-9]+(-[a-z0-9]+)*$/,Xt=(e,t,r,o="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;o=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const c=s.pop(),l=s.pop(),h={provider:s.length>0?s[0]:o,prefix:l,name:c};return t&&!Rt(h)?null:h}const a=s[0],i=a.split("-");if(i.length>1){const c={provider:o,prefix:i.shift(),name:i.join("-")};return t&&!Rt(c)?null:c}if(r&&o===""){const c={provider:o,prefix:"",name:a};return t&&!Rt(c,r)?null:c}return null},Rt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let Pt=!1;function Kn(e){return typeof e=="boolean"&&(Pt=e),Pt}function fn(e){const t=typeof e=="string"?Xt(e,!0,Pt):e;if(t){const r=wt(t.provider,t.prefix),o=t.name;return r.icons[o]||(r.missing.has(o)?null:void 0)}}function zs(e,t){const r=Xt(e,!0,Pt);if(!r)return!1;const o=wt(r.provider,r.prefix);return t?Ds(o,r.name,t):(o.missing.add(r.name),!0)}function Ms(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Pt&&!t&&!e.prefix){let s=!1;return Vn(e)&&(e.prefix="",Hn(e,(a,i)=>{zs(a,i)&&(s=!0)})),s}const r=e.prefix;if(!Rt({prefix:r,name:"a"}))return!1;const o=wt(t,r);return!!Yn(o,e)}const Wn=Object.freeze({width:null,height:null}),Qn=Object.freeze({...Wn,...Gt}),qs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Bs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function mn(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const o=e.split(qs);if(o===null||!o.length)return e;const s=[];let a=o.shift(),i=Bs.test(a);for(;;){if(i){const c=parseFloat(a);isNaN(c)?s.push(a):s.push(Math.ceil(c*t*r)/r)}else s.push(a);if(a=o.shift(),a===void 0)return s.join("");i=!i}}function Rs(e,t="defs"){let r="";const o=e.indexOf("<"+t);for(;o>=0;){const s=e.indexOf(">",o),a=e.indexOf("</"+t);if(s===-1||a===-1)break;const i=e.indexOf(">",a);if(i===-1)break;r+=e.slice(s+1,a).trim(),e=e.slice(0,o).trim()+e.slice(i+1)}return{defs:r,content:e}}function Us(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Hs(e,t,r){const o=Rs(e);return Us(o.defs,t+o.content+r)}const Vs=e=>e==="unset"||e==="undefined"||e==="none";function Ys(e,t){const r={...Fr,...e},o={...Qn,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let a=r.body;[r,o].forEach(E=>{const j=[],C=E.hFlip,H=E.vFlip;let B=E.rotate;C?H?B+=2:(j.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),j.push("scale(-1 1)"),s.top=s.left=0):H&&(j.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),j.push("scale(1 -1)"),s.top=s.left=0);let z;switch(B<0&&(B-=Math.floor(B/4)*4),B=B%4,B){case 1:z=s.height/2+s.top,j.unshift("rotate(90 "+z.toString()+" "+z.toString()+")");break;case 2:j.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:z=s.width/2+s.left,j.unshift("rotate(-90 "+z.toString()+" "+z.toString()+")");break}B%2===1&&(s.left!==s.top&&(z=s.left,s.left=s.top,s.top=z),s.width!==s.height&&(z=s.width,s.width=s.height,s.height=z)),j.length&&(a=Hs(a,'<g transform="'+j.join(" ")+'">',"</g>"))});const i=o.width,c=o.height,l=s.width,h=s.height;let p,w;i===null?(w=c===null?"1em":c==="auto"?h:c,p=mn(w,l/h)):(p=i==="auto"?l:i,w=c===null?mn(p,h/l):c==="auto"?h:c);const y={},_=(E,j)=>{Vs(j)||(y[E]=j.toString())};_("width",p),_("height",w);const k=[s.left,s.top,l,h];return y.viewBox=k.join(" "),{attributes:y,viewBox:k,body:a}}const Js=/\sid="(\S+)"/g,Ks="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ws=0;function Qs(e,t=Ks){const r=[];let o;for(;o=Js.exec(e);)r.push(o[1]);if(!r.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return r.forEach(a=>{const i=typeof t=="function"?t(a):t+(Ws++).toString(),c=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+c+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const wr=Object.create(null);function Gs(e,t){wr[e]=t}function yr(e){return wr[e]||wr[""]}function Pr(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Er=Object.create(null),Ct=["https://api.simplesvg.com","https://api.unisvg.com"],Ut=[];for(;Ct.length>0;)Ct.length===1||Math.random()>.5?Ut.push(Ct.shift()):Ut.push(Ct.pop());Er[""]=Pr({resources:["https://api.iconify.design"].concat(Ut)});function Xs(e,t){const r=Pr(t);return r===null?!1:(Er[e]=r,!0)}function Tr(e){return Er[e]}const Zs=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let hn=Zs();function ea(e,t){const r=Tr(e);if(!r)return 0;let o;if(!r.maxURL)o=0;else{let s=0;r.resources.forEach(i=>{s=Math.max(s,i.length)});const a=t+".json?icons=";o=r.maxURL-s-r.path.length-a.length}return o}function ta(e){return e===404}const ra=(e,t,r)=>{const o=[],s=ea(e,t),a="icons";let i={type:a,provider:e,prefix:t,icons:[]},c=0;return r.forEach((l,h)=>{c+=l.length+1,c>=s&&h>0&&(o.push(i),i={type:a,provider:e,prefix:t,icons:[]},c=l.length),i.icons.push(l)}),o.push(i),o};function na(e){if(typeof e=="string"){const t=Tr(e);if(t)return t.path}return"/"}const oa=(e,t,r)=>{if(!hn){r("abort",424);return}let o=na(t.provider);switch(t.type){case"icons":{const a=t.prefix,c=t.icons.join(","),l=new URLSearchParams({icons:c});o+=a+".json?"+l.toString();break}case"custom":{const a=t.uri;o+=a.slice(0,1)==="/"?a.slice(1):a;break}default:r("abort",400);return}let s=503;hn(e+o).then(a=>{const i=a.status;if(i!==200){setTimeout(()=>{r(ta(i)?"abort":"next",i)});return}return s=501,a.json()}).then(a=>{if(typeof a!="object"||a===null){setTimeout(()=>{a===404?r("abort",a):r("next",s)});return}setTimeout(()=>{r("success",a)})}).catch(()=>{r("next",s)})},sa={prepare:ra,send:oa};function Gn(e,t){e.forEach(r=>{const o=r.loaderCallbacks;o&&(r.loaderCallbacks=o.filter(s=>s.id!==t))})}function aa(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let r=!1;const o=e.provider,s=e.prefix;t.forEach(a=>{const i=a.icons,c=i.pending.length;i.pending=i.pending.filter(l=>{if(l.prefix!==s)return!0;const h=l.name;if(e.icons[h])i.loaded.push({provider:o,prefix:s,name:h});else if(e.missing.has(h))i.missing.push({provider:o,prefix:s,name:h});else return r=!0,!0;return!1}),i.pending.length!==c&&(r||Gn([e],a.id),a.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),a.abort))})}))}let ia=0;function la(e,t,r){const o=ia++,s=Gn.bind(null,r,o);if(!t.pending.length)return s;const a={id:o,icons:t,callback:e,abort:s};return r.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(a)}),s}function ca(e){const t={loaded:[],missing:[],pending:[]},r=Object.create(null);e.sort((s,a)=>s.provider!==a.provider?s.provider.localeCompare(a.provider):s.prefix!==a.prefix?s.prefix.localeCompare(a.prefix):s.name.localeCompare(a.name));let o={provider:"",prefix:"",name:""};return e.forEach(s=>{if(o.name===s.name&&o.prefix===s.prefix&&o.provider===s.provider)return;o=s;const a=s.provider,i=s.prefix,c=s.name,l=r[a]||(r[a]=Object.create(null)),h=l[i]||(l[i]=wt(a,i));let p;c in h.icons?p=t.loaded:i===""||h.missing.has(c)?p=t.missing:p=t.pending;const w={provider:a,prefix:i,name:c};p.push(w)}),t}function da(e,t=!0,r=!1){const o=[];return e.forEach(s=>{const a=typeof s=="string"?Xt(s,t,r):s;a&&o.push(a)}),o}const ua={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function fa(e,t,r,o){const s=e.resources.length,a=e.random?Math.floor(Math.random()*s):e.index;let i;if(e.random){let I=e.resources.slice(0);for(i=[];I.length>1;){const J=Math.floor(Math.random()*I.length);i.push(I[J]),I=I.slice(0,J).concat(I.slice(J+1))}i=i.concat(I)}else i=e.resources.slice(a).concat(e.resources.slice(0,a));const c=Date.now();let l="pending",h=0,p,w=null,y=[],_=[];typeof o=="function"&&_.push(o);function k(){w&&(clearTimeout(w),w=null)}function E(){l==="pending"&&(l="aborted"),k(),y.forEach(I=>{I.status==="pending"&&(I.status="aborted")}),y=[]}function j(I,J){J&&(_=[]),typeof I=="function"&&_.push(I)}function C(){return{startTime:c,payload:t,status:l,queriesSent:h,queriesPending:y.length,subscribe:j,abort:E}}function H(){l="failed",_.forEach(I=>{I(void 0,p)})}function B(){y.forEach(I=>{I.status==="pending"&&(I.status="aborted")}),y=[]}function z(I,J,he){const pe=J!=="success";switch(y=y.filter(v=>v!==I),l){case"pending":break;case"failed":if(pe||!e.dataAfterTimeout)return;break;default:return}if(J==="abort"){p=he,H();return}if(pe){p=he,y.length||(i.length?_e():H());return}if(k(),B(),!e.random){const v=e.resources.indexOf(I.resource);v!==-1&&v!==e.index&&(e.index=v)}l="completed",_.forEach(v=>{v(he)})}function _e(){if(l!=="pending")return;k();const I=i.shift();if(I===void 0){if(y.length){w=setTimeout(()=>{k(),l==="pending"&&(B(),H())},e.timeout);return}H();return}const J={status:"pending",resource:I,callback:(he,pe)=>{z(J,he,pe)}};y.push(J),h++,w=setTimeout(_e,e.rotate),r(I,t,J.callback)}return setTimeout(_e),C}function Xn(e){const t={...ua,...e};let r=[];function o(){r=r.filter(c=>c().status==="pending")}function s(c,l,h){const p=fa(t,c,l,(w,y)=>{o(),h&&h(w,y)});return r.push(p),p}function a(c){return r.find(l=>c(l))||null}return{query:s,find:a,setIndex:c=>{t.index=c},getIndex:()=>t.index,cleanup:o}}function pn(){}const cr=Object.create(null);function ma(e){if(!cr[e]){const t=Tr(e);if(!t)return;const r=Xn(t),o={config:t,redundancy:r};cr[e]=o}return cr[e]}function ha(e,t,r){let o,s;if(typeof e=="string"){const a=yr(e);if(!a)return r(void 0,424),pn;s=a.send;const i=ma(e);i&&(o=i.redundancy)}else{const a=Pr(e);if(a){o=Xn(a);const i=e.resources?e.resources[0]:"",c=yr(i);c&&(s=c.send)}}return!o||!s?(r(void 0,424),pn):o.query(t,s,r)().abort}function gn(){}function pa(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,aa(e)}))}function ga(e){const t=[],r=[];return e.forEach(o=>{(o.match(Jn)?t:r).push(o)}),{valid:t,invalid:r}}function _t(e,t,r){function o(){const s=e.pendingIcons;t.forEach(a=>{s&&s.delete(a),e.icons[a]||e.missing.add(a)})}if(r&&typeof r=="object")try{if(!Yn(e,r).length){o();return}}catch(s){console.error(s)}o(),pa(e)}function xn(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function xa(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:r,prefix:o}=e,s=e.iconsToLoad;if(delete e.iconsToLoad,!s||!s.length)return;const a=e.loadIcon;if(e.loadIcons&&(s.length>1||!a)){xn(e.loadIcons(s,o,r),p=>{_t(e,s,p)});return}if(a){s.forEach(p=>{const w=a(p,o,r);xn(w,y=>{const _=y?{prefix:o,icons:{[p]:y}}:null;_t(e,[p],_)})});return}const{valid:i,invalid:c}=ga(s);if(c.length&&_t(e,c,null),!i.length)return;const l=o.match(Jn)?yr(r):null;if(!l){_t(e,i,null);return}l.prepare(r,o,i).forEach(p=>{ha(r,p,w=>{_t(e,p.icons,w)})})}))}const wa=(e,t)=>{const r=da(e,!0,Kn()),o=ca(r);if(!o.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(o.loaded,o.missing,o.pending,gn)}),()=>{l=!1}}const s=Object.create(null),a=[];let i,c;return o.pending.forEach(l=>{const{provider:h,prefix:p}=l;if(p===c&&h===i)return;i=h,c=p,a.push(wt(h,p));const w=s[h]||(s[h]=Object.create(null));w[p]||(w[p]=[])}),o.pending.forEach(l=>{const{provider:h,prefix:p,name:w}=l,y=wt(h,p),_=y.pendingIcons||(y.pendingIcons=new Set);_.has(w)||(_.add(w),s[h][p].push(w))}),a.forEach(l=>{const h=s[l.provider][l.prefix];h.length&&xa(l,h)}),t?la(t,o,a):gn};function ya(e,t){const r={...e};for(const o in t){const s=t[o],a=typeof s;o in Wn?(s===null||s&&(a==="string"||a==="number"))&&(r[o]=s):a===typeof r[o]&&(r[o]=o==="rotate"?s%4:s)}return r}const ba=/[\s,]+/;function va(e,t){t.split(ba).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ja(e,t=0){const r=e.replace(/^-?[0-9.]*/,"");function o(s){for(;s<0;)s+=4;return s%4}if(r===""){const s=parseInt(e);return isNaN(s)?0:o(s)}else if(r!==e){let s=0;switch(r){case"%":s=25;break;case"deg":s=90}if(s){let a=parseFloat(e.slice(0,e.length-r.length));return isNaN(a)?0:(a=a/s,a%1===0?o(a):0)}}return t}function ka(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const o in t)r+=" "+o+'="'+t[o]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+e+"</svg>"}function Sa(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Na(e){return"data:image/svg+xml,"+Sa(e)}function Ca(e){return'url("'+Na(e)+'")'}let It;function _a(){try{It=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{It=null}}function Ia(e){return It===void 0&&_a(),It?It.createHTML(e):e}const Zn={...Qn,inline:!1},Fa={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Pa={display:"inline-block"},br={backgroundColor:"currentColor"},eo={backgroundColor:"transparent"},wn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},yn={WebkitMask:br,mask:br,background:eo};for(const e in yn){const t=yn[e];for(const r in wn)t[e+r]=wn[r]}const Ea={...Zn,inline:!0};function bn(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Ta=(e,t,r)=>{const o=t.inline?Ea:Zn,s=ya(o,t),a=t.mode||"svg",i={},c=t.style||{},l={...a==="svg"?Fa:{}};if(r){const j=Xt(r,!1,!0);if(j){const C=["iconify"],H=["provider","prefix"];for(const B of H)j[B]&&C.push("iconify--"+j[B]);l.className=C.join(" ")}}for(let j in t){const C=t[j];if(C!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":l.ref=C;break;case"className":l[j]=(l[j]?l[j]+" ":"")+C;break;case"inline":case"hFlip":case"vFlip":s[j]=C===!0||C==="true"||C===1;break;case"flip":typeof C=="string"&&va(s,C);break;case"color":i.color=C;break;case"rotate":typeof C=="string"?s[j]=ja(C):typeof C=="number"&&(s[j]=C);break;case"ariaHidden":case"aria-hidden":C!==!0&&C!=="true"&&delete l["aria-hidden"];break;default:o[j]===void 0&&(l[j]=C)}}const h=Ys(e,s),p=h.attributes;if(s.inline&&(i.verticalAlign="-0.125em"),a==="svg"){l.style={...i,...c},Object.assign(l,p);let j=0,C=t.id;return typeof C=="string"&&(C=C.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:Ia(Qs(h.body,C?()=>C+"ID"+j++:"iconifyReact"))},g.createElement("svg",l)}const{body:w,width:y,height:_}=e,k=a==="mask"||(a==="bg"?!1:w.indexOf("currentColor")!==-1),E=ka(w,{...p,width:y+"",height:_+""});return l.style={...i,"--svg":Ca(E),width:bn(p.width),height:bn(p.height),...Pa,...k?br:eo,...c},g.createElement("span",l)};Kn(!0);Gs("",sa);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,r="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(o=>{try{(typeof o!="object"||o===null||o instanceof Array||typeof o.icons!="object"||typeof o.prefix!="string"||!Ms(o))&&console.error(r)}catch{console.error(r)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let r in t){const o="IconifyProviders["+r+"] is invalid.";try{const s=t[r];if(typeof s!="object"||!s||s.resources===void 0)continue;Xs(r,s)||console.error(o)}catch{console.error(o)}}}}function to(e){const[t,r]=g.useState(!!e.ssr),[o,s]=g.useState({});function a(_){if(_){const k=e.icon;if(typeof k=="object")return{name:"",data:k};const E=fn(k);if(E)return{name:k,data:E}}return{name:""}}const[i,c]=g.useState(a(!!e.ssr));function l(){const _=o.callback;_&&(_(),s({}))}function h(_){if(JSON.stringify(i)!==JSON.stringify(_))return l(),c(_),!0}function p(){var _;const k=e.icon;if(typeof k=="object"){h({name:"",data:k});return}const E=fn(k);if(h({name:k,data:E}))if(E===void 0){const j=wa([k],p);s({callback:j})}else E&&((_=e.onLoad)===null||_===void 0||_.call(e,k))}g.useEffect(()=>(r(!0),l),[]),g.useEffect(()=>{t&&p()},[e.icon,t]);const{name:w,data:y}=i;return y?Ta({...Fr,...y},e,w):e.children?e.children:e.fallback?e.fallback:g.createElement("span",{})}const oe=g.forwardRef((e,t)=>to({...e,_ref:t}));g.forwardRef((e,t)=>to({inline:!0,...e,_ref:t}));const rt="USD",Oa=(e,t=rt)=>{const r=(e==null?void 0:e.prices)??[];if(!r.length)return null;const o=i=>{var h,p;const c=i.find(w=>{var y;return!!((y=w.discounted)!=null&&y.value)});if(c)return{cent:c.discounted.value.centAmount,cur:c.discounted.value.currencyCode,regularCent:(h=c.value)==null?void 0:h.centAmount};const l=(p=i[0])==null?void 0:p.value;return l?{cent:l.centAmount,cur:l.currencyCode}:null},s=r.filter(i=>{var c,l;return((l=((c=i.discounted)==null?void 0:c.value)||i.value)==null?void 0:l.currencyCode)===t}),a=o(s);return a||o(r)||null},Aa=(e,t)=>{if(!Array.isArray(e))return"";const r=e.find(o=>o.name===t)||e.find(o=>{var s;return((s=o.name)==null?void 0:s.toLowerCase())===t.toLowerCase()});return!r||!r.value?"":typeof r.value=="object"?r.value.label||"":r.value},$a=e=>{let t="";if(Array.isArray(e)){const r=e.find(o=>o.name==="size")||e.find(o=>o.name==="Size");r&&r.value&&(t=typeof r.value=="object"?r.value.label||"":r.value)}return{sizeLabel:t}},ht=e=>Aa((e==null?void 0:e.attributesRaw)??[],"color"),pt=e=>$a((e==null?void 0:e.attributesRaw)??[]).sizeLabel,Ve=e=>e.charAt(0).toUpperCase()+e.slice(1),Ze={standard:{label:"Standard Delivery",fee:0,subtitle:"Arrives in 4–6 days (Free)",icon:"mdi:clock-outline"},express:{label:"Express Delivery",fee:5,subtitle:"Arrives in 1–2 days (+$5)",icon:"mdi:flash"},sameday:{label:"Same-Day Delivery",fee:10,subtitle:"Available in select locations (+$10)",icon:"mdi:truck-fast-outline"}},La={standard:"GROUND",express:"2-DAY SHIPPING",sameday:"OVERNIGHT"},Ye=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},ro=e=>e==null?void 0:e.masterVariant,vn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ht=e=>{const t=ro(e);return t?[t,...vn(e)]:vn(e)},Da=(e,t=0)=>Ht(e)[t],za=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},jn=(e,t)=>{var r,o,s,a,i,c,l,h;return za(t)||((a=(s=(o=(r=e.imageGroups)==null?void 0:r[0])==null?void 0:o.images)==null?void 0:s[0])==null?void 0:a.link)||((h=(l=(c=(i=e.image_groups)==null?void 0:i[0])==null?void 0:c.images)==null?void 0:l[0])==null?void 0:h.link)||""},kn=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Vt=e=>{var a,i,c,l,h,p;const t=e?Oa(e,rt):null;if(t!=null&&t.cent&&(t!=null&&t.cur))return{amount:+(t.cent/100),currency:t.cur,regularAmount:t.regularCent?t.regularCent/100:void 0};const r=(c=(i=(a=e==null?void 0:e.prices)==null?void 0:a[0])==null?void 0:i.value)==null?void 0:c.centAmount,o=((p=(h=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:h.value)==null?void 0:p.currencyCode)??rt;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},Sn=(e,t)=>{const{amount:r}=Vt(t);if(r)return r;const o=(e==null?void 0:e.price)??(e==null?void 0:e.sellingPrice)??(e==null?void 0:e.unitPrice)??(e==null?void 0:e.mrp)??0,s=Number(o);return Number.isFinite(s)?s:0},Ma=e=>{var t;return(e==null?void 0:e.sku)||((t=e==null?void 0:e.variant)==null?void 0:t.sku)||(e==null?void 0:e.selectedSku)||""},qa=e=>{var t;return(e==null?void 0:e.color)||(e==null?void 0:e.selectedColor)||((t=e==null?void 0:e.variant)==null?void 0:t.color)||""},Ba=e=>{var t;return(e==null?void 0:e.size)||(e==null?void 0:e.selectedSize)||((t=e==null?void 0:e.variant)==null?void 0:t.size)||""},Nn=20,Ra=({open:e,onClose:t,product:r,index:o,addresses:s,addressLoading:a,variationAttributes:i})=>{const h=Ht(r),p=Math.min(Math.max(0,o||0),Math.max(0,h.length-1)),[w,y]=g.useState([]),[_,k]=g.useState(0);g.useEffect(()=>{if(r!=null&&r.variants){const d=E(r.variants,r.imageGroups,i);y(d)}},[r]);const E=(d,m,u)=>{const{colorMap:x,sizeMap:N}=j(u),A={};m==null||m.forEach(F=>{var ne,Se,Te;const q=(ne=F.variationAttributes)==null?void 0:ne.find(Oe=>Oe.id==="color"),T=(Te=(Se=q==null?void 0:q.values)==null?void 0:Se[0])==null?void 0:Te.value;T&&(A[T]||(A[T]={}),A[T][F.viewType]=F.images)});const U=d.reduce((F,q)=>{const T=q.variationValues.color,ne=q.variationValues.size;return F[T]||(F[T]={color:T,name:x[T]||T,images:A[T]||{},variants:[]}),F[T].variants.push({size:ne,name:N[ne]||ne,...q}),F},{});return Object.values(U).sort((F,q)=>{const T=F.colorName||F.color||"",ne=q.colorName||q.color||"";return T.localeCompare(ne)}).map(F=>({...F,variants:F.variants.sort((q,T)=>Number(q.size)-Number(T.size))}))},j=d=>{const m={},u={};return d==null||d.forEach(x=>{x.id==="color"&&x.values.forEach(N=>{m[N.value]=N.name}),x.id==="size"&&x.values.forEach(N=>{u[N.value]=N.name})}),{colorMap:m,sizeMap:u}},C=h.length,[H,B]=g.useState(p),[z,_e]=g.useState(null),[I,J]=g.useState(null),he=g.useRef(null),pe=g.useRef(null),v=Da(r,H),[Re,Le]=g.useState(""),[de,M]=g.useState(!1),[L,be]=g.useState(!1),[Ie,Fe]=g.useState(!1),[We,ge]=g.useState(""),[Ee,xe]=g.useState(!1),[S,ve]=g.useState(null),[Pe,se]=g.useState([]),[Zt,er]=g.useState([]),[f,R]=g.useState([]),[O,K]=g.useState(!1),[V,D]=g.useState(),[ue,ee]=g.useState(!0),[$,W]=g.useState(!1),[je,we]=g.useState(!1),[te,ye]=g.useState("standard"),[X,re]=g.useState(!1),[ke,b]=g.useState(!1),[ie,Q]=g.useState("card"),[Y,G]=g.useState(!1),[Ue,me]=g.useState(!1),[De,Z]=g.useState(!1),[Et,tr]=g.useState(null),[P,ze]=g.useState(null),[lt,ct]=g.useState(""),[Or,Ar]=g.useState(!1),[bt,no]=g.useState(r==null?void 0:r.id),Tt=g.useRef(null);g.useEffect(()=>{const d=Ht(r),m=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));B(m);const u=ro(r),x=ht(u),N=pt(u);he.current=x||null,pe.current=N||null,_e(x||null),J(N||null)},[o,r]),g.useEffect(()=>{Tt.current&&(Tt.current.scrollTop=Tt.current.scrollHeight)},[Pe,O,$,je,X,ke,Y,Ue,De,de,L]);const dt="var(--tanya)",$r="var(--tanya-contrast)",Ot=dt,Me="#804c9e",oo=()=>{console.log("AgenticShopping feedback:",{rating:P,comment:lt}),Ar(!0)},so=()=>{ze(null),ct(""),Ar(!0)},Lr=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??Et;return e?n.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-lg border border-green-200 bg-green-50 p-4 text-green-800",children:[n.jsx("div",{className:"success-tick-animation",children:n.jsx(oe,{icon:"mdi:check-circle",width:"28",color:"#16a34a"})}),n.jsxs("div",{className:"text-sm w-full",children:[n.jsx("div",{className:"font-semibold",children:"Success!"}),n.jsx("div",{children:"Your smart order has been saved. I’ll watch the price and auto-purchase when the conditions are met."}),u&&n.jsxs("div",{className:"mt-2 text-xs font-medium",children:["Your Smart Order ID: ",n.jsx("span",{className:"font-semibold text-blue-600 cursor-pointer underline",children:u})]}),!Or&&n.jsxs("div",{className:"mt-4 rounded-lg bg-white/70 p-3 text-gray-900",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Please post your feedback here"}),n.jsx("p",{className:"text-sm text-gray-700 mb-3",children:"Rate us on how much our response was helpful"}),n.jsx("div",{className:"flex items-center gap-1 mb-3",children:[1,2,3,4,5].map(x=>n.jsx("button",{type:"button",onClick:()=>ze(x),className:"p-0.5",children:n.jsx(oe,{icon:P&&P>=x?"mdi:star":"mdi:star-outline",width:"20",className:"text-yellow-500"})},x))}),n.jsx("label",{className:"block text-sm text-gray-700 mb-1",children:"Tell us more about the response"}),n.jsx("textarea",{value:lt,onChange:x=>ct(x.target.value),rows:3,className:"mt-1 w-full rounded-md border border-gray-300 p-2 text-sm outline-none focus:ring-1 focus:ring-gray-300",placeholder:"Your feedback helps us improve..."}),n.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:so,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:oo,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:dt},disabled:!P&&!lt.trim(),children:"Submit"})]})]}),Or&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},ao=async()=>{try{R(s)}catch(d){console.error("Error fetching addresses:",d)}},vt=(d,m)=>{se(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:m}])},Dr=(d,m)=>{se(u=>u.map(x=>x.response==="__CARD__"?{...x,response:"__SNAPSHOT__",snapshotStage:d??x.snapshotStage,snapshotPayload:m??x.snapshotPayload}:x))},io=()=>{se(d=>d.filter(m=>!(m.query===""&&m.response!=="__SNAPSHOT__"&&m.response!=="__TEXT__")))},At=()=>{me(!1),K(!1),we(!1),b(!1),W(!1),re(!1),G(!1),Z(!1),xe(!1),ve(null),io(),M(!1),be(!1)},lo=()=>{K(!1),W(!1),we(!1),ye("standard"),re(!1),b(!1),Q("card"),G(!1),me(!1),Z(!1),ee(!0),ve(null),localStorage.removeItem("agentic_order"),localStorage.removeItem("agentic_order_address"),localStorage.removeItem("agentic_order_delivery"),localStorage.removeItem("agentic_order_payment"),localStorage.removeItem("agentic_order_final")},$t=g.useMemo(()=>Ht(r).map((m,u)=>({index:u,variant:m,images:((m==null?void 0:m.images)||[]).map(x=>(x==null?void 0:x.url)||"").filter(Boolean)})),[r]),jt=g.useMemo(()=>$t.length?!!((z||void 0)&&(I||void 0)):!1,[$t,z,I,v]),co=Ie||Ee||!jt,kt=d=>{const m=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(m)&&m>0?m:1},zr=d=>{const m=kt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(Sn(r,v)*m)},Mr=d=>{var F;const m=S,u=Vt(v),x=d||(m==null?void 0:m.currency)||u.currency||rt,N=zr(m),A=+(N*.08).toFixed(2),U=((F=Ze[te])==null?void 0:F.fee)||0;return{product_total:N,tax:A,shipping_fee:U,currency:x}},rr=async(d,m,u)=>{Dr(),lo(),Fe(!0),xe(!0),M(!1),be(!1);const x=Zt.slice(-Nn);try{const N=await ur(null,null);if(!N)throw new Error("Failed to fetch token");const A=localStorage.getItem("customerNumber"),U=localStorage.getItem("isLoggedIn"),q=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(U||!1),userId:String(A||new Date().getTime())}).toString()}`,T=await fetch(`${q}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${N}`},body:JSON.stringify({flowId:"MTMI0P4LC6",flowAliasId:"BCUA138F2Q",input:{instruction:`Use SKU ${m}. Currency is USD. ${d}`,metadata:{productId:(r==null?void 0:r.id)??null,skuId:m??null,variantIndex:u},context:x}})});if(!T.body)throw new Error("Readable stream not supported");const ne=T.body.getReader(),Se=new TextDecoder;let Te="",Oe="",Qe="";for(;;){const{done:Ce,value:He}=await ne.read();if(Ce)break;Te+=Se.decode(He,{stream:!0});const ut=Te.split(`
17
+ `);Te=ut.pop()||"";for(const ft of ut){if(!ft.startsWith("data:"))continue;const Ge=ft.slice(5).trim();try{const qe=JSON.parse(Ge),Ae=qe.index,le=qe.data;Ae===0?Oe=String(le??""):Ae===1&&(Qe=String(le??""))}catch(qe){console.error("Error parsing JSON chunk:",qe)}}}let Ne=null;if(Oe){const Ce=String(Oe).replace(/\\n/g,"").trim();if(Ce.startsWith("{")&&Ce.endsWith("}"))try{Ne=JSON.parse(Ce),Ne.product_id=m,Ne.sku_id=m,localStorage.setItem("agentic_order",JSON.stringify(Ne))}catch(He){console.log(He)}}ve(Ne),Ne&&se(Ce=>[...Ce,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:Ne}}]),er(Ce=>[...Ce,{userQuery:d,mainResponse:Oe||"",keywords:Qe||""}].slice(-Nn))}catch(N){console.error("Error sending message to Tanya:",N),xe(!1)}finally{Fe(!1)}},qr=async d=>{if(Ee||Ie||!jt)return;const m=We.trim();if(!m)return;se(x=>[...x,{query:m,response:""}]),ge(""),Le(m);const u=bt||"";if(C<=1){if(u){rr(m,u,H);return}be(!0),xe(!0);return}u?(M(!0),xe(!0)):(be(!0),xe(!0))},uo=()=>{const d=bt;d&&rr(Re,d,H)},fo=()=>{M(!1),be(!0),xe(!0)},mo=()=>{if(!bt)return;rr(Re,bt,H)},ho=async()=>{K(!0),we(!1),b(!1),me(!1),W(!1),re(!1),G(!1),Z(!1),await ao(),Dr("initial",{extractedDetails:S??void 0})},po=()=>{if(!V)return;const d=f.find(m=>String(m.addressId??m.id)===V)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),W(!0),we(!0),re(!1),b(!1),G(!1),me(!1),Z(!1),vt("address",d))},go=()=>{W(!1),we(!1),re(!1),b(!1),G(!1),me(!1),Z(!1),localStorage.removeItem("agentic_order_address")},xo=()=>{te&&(localStorage.setItem("agentic_order_delivery",te),re(!0),b(!0),G(!1),me(!1),Z(!1),vt("delivery",{method:te,...Ze[te]}))},Br=()=>{we(!1),re(!1),b(!1),G(!1),me(!1),Z(!1),xe(!1),At(),se(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},wo=()=>{re(!1),b(!1),G(!1),me(!1),Z(!1),localStorage.removeItem("agentic_order_delivery")},yo=()=>{ie&&(localStorage.setItem("agentic_order_payment",ie),G(!0),me(!0),Z(!1),vt("payment",{method:ie}))},bo=()=>{b(!1),G(!1),me(!1),Z(!1),xe(!1),At(),se(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},vo=()=>{G(!1),me(!1),Z(!1),localStorage.removeItem("agentic_order_payment")},jo=async()=>{try{Fe(!0);const d=S||{},m=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),x=localStorage.getItem("agentic_order_payment")||"card",{product_total:N,tax:A,shipping_fee:U,currency:F}=Mr(),q=d.shopper_id||localStorage.getItem("customerId")||void 0,T=(m==null?void 0:m.addressId)||(m==null?void 0:m.id)||void 0,ne=u?La[u]:"GROUND",Se="card-visa",Te=v==null?void 0:v.sku,Oe=(r==null?void 0:r.id)||"",Qe=kt(d),Ne=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(N*100),ut={shopper_id:q,shipping_address_id:T,shipping_method_id:ne,payment_method_id:Se,sku:Te,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Oe,quantity:Qe,max_price_minor:Ne,currency:F,instruction_text:Re};if(!q||!T){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:q,shippingAddressId:T}),alert("Missing customer or address information. Please re-select address and try again."),Fe(!1);return}const Ge=(await yt()).access_token;if(!Ge)throw new Error("Failed to fetch auth token for intent-mandate");const{serverUrl:qe}=ot(),Ae=await fetch(`${qe}/api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ge}`},body:JSON.stringify(ut)});if(!Ae.ok){const Io=await Ae.text().catch(()=>"");console.error("intent-mandate failed",Ae.status,Io),alert("Something went wrong while saving your smart order. Please try again."),Fe(!1);return}const le=await Ae.json().catch(()=>null);console.log("intent-mandate success:",le);const Xe=(le==null?void 0:le.intent_mandate_id)||(le==null?void 0:le.intent_mandateId)||(le==null?void 0:le.key)||null;Xe&&tr(Xe);const Lt={...d,address:m,delivery:u,payment:x,summary:{product_total:N,tax:A,shipping_fee:U,currency:F},intent_mandate_id:Xe};localStorage.setItem("agentic_order_final",JSON.stringify(Lt)),Z(!0),ee(!1),vt("final",Lt),vt("success",{intentMandateId:Xe}),At()}catch(d){console.error("Error in handleConfirmWatch / intent-mandate:",d),alert("Unable to complete your smart order right now. Please try again in a moment.")}finally{Fe(!1)}},Rr=()=>{At(),se(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},ko=({selectedIndex:d})=>{var T;const m=((T=w[d])==null?void 0:T.images.large[0].link)||jn(r,v),u=kn(r),x=bt||"",N=ht(v)||"",A=pt(v)||"",{amount:U}=Vt(v),F=!!(r!=null&&r.id),q=F;return n.jsx("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-4",children:[n.jsx("div",{className:"flex-shrink-0 flex justify-center sm:justify-start",children:n.jsx("div",{className:"w-[150px] h-[150px] rounded-lg bg-gray-50 border border-gray-200 flex items-center justify-center overflow-hidden",children:m?n.jsx("img",{src:m,alt:u,className:"object-contain w-full h-full"}):n.jsx(oe,{icon:"mdi:image-outline",width:"28",className:"opacity-60"})})}),n.jsxs("div",{className:"flex-grow flex flex-col justify-center text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-gray-900 mb-1",children:u}),n.jsx("div",{className:"text-sm text-gray-700 mb-1",children:[x&&`SKU: ${x}`,N&&`Color: ${N}`,A&&`Size: ${A}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:F?`$${r.price}`:"Currently unavailable"}),F&&!q&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},Ur=({showSubmit:d=!0})=>{const m={};$t.map(x=>ht(x.variant)).filter(x=>!!x&&!m[x]&&(m[x]=!0));const u={};return $t.map(x=>pt(x.variant)).filter(x=>!!x&&!u[x]&&(u[x]=!0)),n.jsxs("div",{className:"mx-4 mt-4 mb-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsx("h3",{className:"font-semibold text-gray-800",children:"Choose a variant"}),n.jsxs("div",{className:"mt-4",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("div",{className:"text-sm font-bold",children:"Color :"}),z&&n.jsx("div",{className:"text-sm text-gray-600",children:z})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:w.map((x,N)=>{const A=x.name,U=z===A,F=x.images.large[0].disBaseLink||x.images.large[0].link;return n.jsx("div",{className:`flex flex-col items-center w-28 border rounded-md p-2
18
+ ${U?"border-2 border-[#804c9e]":"border-gray-300"}`,children:n.jsx("button",{onClick:()=>{_e(A),J(null),B(null),k(N)},className:"w-full h-20 flex items-center justify-center overflow-hidden",title:A,children:F?n.jsx("img",{src:F,alt:A,className:"w/full h-full object-contain"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs px-1",children:A})})},A)})})]}),z&&n.jsxs("div",{className:"mt-4",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("div",{className:"text-sm font-bold",children:"Size :"}),I&&n.jsx("div",{className:"text-sm text-gray-600",children:I})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(()=>{const x=w.find(N=>N.name===z);return x?x.variants.map((N,A)=>{const U=N.name,F=I===U;return n.jsx("button",{onClick:()=>{J(U),B(A),no(N.productId)},className:`px-4 py-2 rounded-md border text-sm ${F?"border-2 border-[#804c9e] font-semibold":"border-gray-300"}`,title:U,children:U},`size-${U}`)}):null})()})]}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:mo,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:Me},disabled:!jt,children:"Submit"})})]})},Hr=(d,m=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||S;if(!u)return null;const x=kt(u),{currency:N}=Vt(v),A=Sn(r,v),U=Number((u==null?void 0:u.max_price_minor)??0),q=Number.isFinite(U)&&U>0?+(U/100):+(A*x),T=(u==null?void 0:u.currency)||N||rt,ne=v!=null&&v.sku?v.sku:u.product_id;return n.jsxs("div",{className:"px-6 pb-6 flex flex-col items-center space-y-4",style:{backgroundColor:"#e5dbeb"},children:[n.jsx("p",{className:"text-base font-semibold text-center mt-2",style:{color:$r},children:"Here’s what I found from your instruction:"}),n.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-inner p-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-y-2 text-sm",children:[n.jsx("p",{className:"font-semibold text-gray-600",children:"SKU:"}),n.jsx("p",{className:"text-gray-800",children:ne}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Quantity:"}),n.jsx("p",{className:"text-gray-800",children:kt(u)}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Currency:"}),n.jsx("p",{className:"text-gray-800",children:T}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Maximum Total Price:"}),n.jsx("p",{className:"text-gray-800",children:Ye(q,T)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[ht(v)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",ht(v)]}),pt(v)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",pt(v)]}),(v==null?void 0:v.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",v.sku]})]})]}),!m&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"text-sm font-medium text-gray-700 text-center max-w-[90%] leading-relaxed",style:{color:$r},children:["Would you like me to ",n.jsx("strong",{children:"lock this in"})," and monitor it for you?"]}),n.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[n.jsxs("button",{onClick:ho,disabled:O,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${O?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:Me},children:[n.jsx(oe,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Rr,disabled:O,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${O?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:Me,color:Me},children:[n.jsx(oe,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Vr=(d,m=!0)=>{var ft,Ge,qe,Ae,le,Xe;const u=d||{},x=((ft=u==null?void 0:u.summary)==null?void 0:ft.currency)||(S==null?void 0:S.currency)||rt,N=jn(r,v),A=kn(r),U=v!=null&&v.sku?v.sku:(r==null?void 0:r.id)??(S==null?void 0:S.product_id),F=(v==null?void 0:v.sku)??Ma(r),q=ht(v)||qa(r),T=pt(v)||Ba(r),ne=kt(u),Se=((Ge=u==null?void 0:u.summary)==null?void 0:Ge.product_total)!=null?+u.summary.product_total:zr(u),Te=ne>0?+(Se/ne).toFixed(2):0,Oe=Se,Qe=((qe=u==null?void 0:u.summary)==null?void 0:qe.tax)??+(Se*.08).toFixed(2),Ne=((Ae=u==null?void 0:u.summary)==null?void 0:Ae.shipping_fee)??(((le=Ze[te])==null?void 0:le.fee)||0),Ce=u!=null&&u.address?[u.address.addressLine1,u.address.addressLine2,u.address.street,[u.address.city,u.address.state,u.address.postalCode].filter(Boolean).join(", "),u.address.country].filter(Boolean).map(Lt=>Ve(String(Lt))).join(", "):"—",He=(u==null?void 0:u.payment)||"card",ut=He==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Ve(He)});return n.jsxs("div",{className:"mx-auto mt-3 mb-3 rounded-2xl bg-white",children:[n.jsx("div",{className:"px-6 pt-5 pb-3",children:n.jsxs("h3",{className:"font-semibold text-lg mb-2 text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:receipt-text-check-outline",width:"24",color:dt}),"All set! Here’s what your smart order looks like 🧾"]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-4 rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"sm:col-span-2 flex",children:n.jsx("div",{className:"w-30 h-26 sm:w-30 sm:h-26 overflow-hidden rounded-lg bg-white border border-gray-200 flex items-center justify-center mx-auto sm:mx-0",children:N?n.jsx("img",{src:N,alt:A,className:"w-full h-full object-contain"}):n.jsx(oe,{icon:"mdi:image-outline",width:"24",className:"opacity-50"})})}),n.jsxs("div",{className:"sm:col-span-10",children:[n.jsxs("div",{className:"mb-3",children:[n.jsx("div",{className:"text-lg text-center font-bold text-gray-900",children:A}),n.jsxs("div",{className:"text-xs text-center font-bold text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",U??"—"]}),(F||q||T)&&n.jsxs("div",{className:"text-xs text-gray-600 mt-0.5 text-center",children:[F&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",F,"  "]}),q&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",q,"  "]}),T&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Size:"})," ",T]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md-grid-cols-3 md:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Unit Price"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:Ye(Te,x)})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Quantity"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:ne})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Subtotal"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:Ye(Oe,x)})]})]})]})]})}),n.jsxs("div",{className:"px-6 pb-2",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-3",children:[n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🏠 Address"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:Ce})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💳 Payment"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:ut})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Delivery"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:u!=null&&u.delivery&&((Xe=Ze[u.delivery])==null?void 0:Xe.label)||"—"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💰 any(s)"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ye(Se,x)})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🏛️ Taxes"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ye(Qe,x)})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Shipping"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ye(Ne,x)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:Ot},children:[n.jsx("div",{className:"text-sm/5 opacity-95",children:"🔹 Total Payable"}),n.jsx("div",{className:"mt-1 text-3xl font-extrabold tracking-tight",children:Ye(Se+Qe+Ne,x)})]})]}),!m&&n.jsxs("div",{className:"px-6 pb-5",children:[!De&&n.jsx("p",{className:"mt-3 text-center text-sm text-gray-700",children:"Everything looks good! Do you want me to watch this product and buy it automatically when it meets your condition?"}),De&&Lr({intentMandateId:Et}),ue&&!De&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:jo,className:"inline-flex items-center justify-center rounded-full px-6 py-2.5 font-semibold text-white shadow-md transition-transform duration-150 hover:-translate-y-0.5 hover:shadow-lg",style:{background:Ot},children:"Confirm"}),n.jsx("button",{onClick:Rr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:Ot,color:Ot},children:"Cancel"})]})]})]})},So=d=>{if(!d)return null;const m=[d.addressLine1,d.addressLine2,d.street,[d.city,d.state,d.postalCode].filter(Boolean).join(", "),d.country].filter(u=>!!u).map(u=>Ve(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"20",color:dt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:m})]})})},No=d=>{const m=d==null?void 0:d.method,u=m?Ze[m]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"20",color:dt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:u?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(oe,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},Co=d=>{const m=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"20",color:dt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Payment Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:m==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820   Exp: 12/26"]}):Ve(m)})]})})},_o=(d,m)=>{const u=d.snapshotStage;if(!u||u==="address"&&O||u==="delivery"&&je||u==="payment"&&ke||u==="final"&&Ue)return null;switch(u){case"initial":return Hr(d.snapshotPayload,!m);case"address":return So(d.snapshotPayload);case"delivery":return No(d.snapshotPayload);case"payment":return Co(d.snapshotPayload);case"final":return Vr(d.snapshotPayload,!m);case"success":return Lr(d.snapshotPayload);default:return null}};return Eo.createPortal(n.jsxs("div",{className:"fixed inset-0",style:{zIndex:2147483647},"aria-modal":"true",role:"dialog",children:[n.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.25)"},onClick:t}),n.jsx("div",{className:"absolute right-0 ",children:n.jsxs("div",{className:"w-[64.7vw] h-screen bg-white rounded-xl overflow-hidden flex flex-col shadow-xl",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTopLeftRadius:"0.75rem",borderBottomLeftRadius:"0.75rem",padding:"0.25rem",background:Me},children:[n.jsxs("div",{style:{display:"flex",color:"#ffffff",alignItems:"center",gap:"0.5rem"},children:[n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 256 256",children:n.jsxs("g",{fill:"currentColor",children:[n.jsx("path",{d:"m194.82 151.43l-55.09 20.3l-20.3 55.09a7.92 7.92 0 0 1-14.86 0l-20.3-55.09l-55.09-20.3a7.92 7.92 0 0 1 0-14.86l55.09-20.3l20.3-55.09a7.92 7.92 0 0 1 14.86 0l20.3 55.09l55.09 20.3a7.92 7.92 0 0 1 0 14.86",opacity:"0.2"}),n.jsx("path",{d:"M197.58 129.06L146 110l-19-51.62a15.92 15.92 0 0 0-29.88 0L78 110l-51.62 19a15.92 15.92 0 0 0 0 29.88L78 178l19 51.62a15.92 15.92 0 0 0 29.88 0L146 178l51.62-19a15.92 15.92 0 0 0 0-29.88ZM137 164.22a8 8 0 0 0-4.74 4.74L112 223.85L91.78 169a8 8 0 0 0-4.78-4.78L32.15 144L87 123.78a8 8 0 0 0 4.78-4.78L112 64.15L132.22 119a8 8 0 0 0 4.74 4.74L191.85 144ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8"})]})}),n.jsx("div",{children:n.jsx("p",{className:"font-bold",children:"Agentic Shopping with TANYA"})})]}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx(oe,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:Tt,className:"overflow-y-auto pr-5 pb-4 space-y-4 hide-scrollbar flex-grow",children:[n.jsxs("div",{className:"text-sm text-[16px] rounded-r-xl p-3 m-3 rounded-bl-xl w-3/4 text-tanya-contrast",style:{backgroundColor:"#e5dbeb"},children:["Welcome to your smart shopping companion!",n.jsxs("p",{children:["Simply share your instruction — like “If this product goes below $",parseInt(r.price)-5," grab it for me.”"]}),n.jsx("p",{children:"I’ll monitor it, calculate total prices, and place the order when your conditions are met."})]}),n.jsx(ko,{selectedIndex:_}),C>1&&n.jsx(Ur,{showSubmit:!1}),Pe.map((d,m)=>{var N;const u=m===Pe.length-1,x=!!d.snapshotStage;return n.jsxs("div",{children:[d.query&&n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm rounded-l-xl p-3 m-3 mb-4 rounded-br-xl max-w-[75%]",style:{color:"#ffffff",backgroundColor:"var(--tanya)"},children:d.query})}),d.response==="__TEXT__"&&((N=d.snapshotPayload)==null?void 0:N.text)&&n.jsx("div",{className:"mt-2",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&de&&C>1&&n.jsxs("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsxs("div",{className:"text-sm text-gray-800",children:["Proceed with color:"," ",n.jsx("span",{className:"font-semibold",children:z||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:I||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:uo,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:Me},children:"Yes"}),n.jsx("button",{onClick:fo,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:Me,color:Me},children:"No, change SKU"})]})]}),u&&L&&n.jsx(Ur,{showSubmit:!0}),u&&Ie&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text",children:n.jsx("p",{children:"Reading your instruction and setting things up…"})})})}),(x||d.response==="__CARD__")&&(!Ie||!u)&&n.jsx("div",{className:"mt-6 mb-4 mx-4 animate-fade-in",style:{backgroundColor:"#fff",borderRadius:"1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.08)",overflow:"hidden"},children:x?_o(d,u):Hr(d.snapshotPayload,!1)})]},m)}),O&&n.jsxs("div",{className:"mt-6 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),$&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!De&&n.jsx("button",{onClick:go,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change address",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Choose where you’d like us to deliver this item."}),a?n.jsxs("div",{className:"flex items-center py-6",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottomColor:"var(--tanya-light)"}}),n.jsx("p",{className:"ml-3 text-gray-600",children:"Fetching your addresses..."})]}):(f==null?void 0:f.length)>0?n.jsxs("div",{className:`space-y-3 ${$?"opacity-70":""}`,children:[f.map(d=>{const m=[d.addressLine1,d.addressLine2].filter(Boolean).map(F=>Ve(F||"")).join(" "),u=Ve(d.city||""),x=`${Ve(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,N=Ve(d.country||""),A=String(d.addressId??d.id),U=V===A;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${U?"border-tanya-light":"border-gray-300"} ${$?"pointer-events-none":""}`,title:$?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:U,disabled:$,onChange:()=>D(A),value:A}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800",children:m||"Address"}),n.jsxs("div",{className:"text-sm text-gray-700",children:[u,n.jsx("br",{}),x,n.jsx("br",{}),N]})]})]},A)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:Br,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:po,disabled:$,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${$?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:Me},children:$?"Address Submitted":"Submit Address"})]})]}):n.jsx("div",{className:"text-center py-8 text-gray-600",children:"No addresses found. Please add a new one in your profile."})]}),je&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),X&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!De&&n.jsx("button",{onClick:wo,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change shipping method",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Which one would you like me to use for this order?"}),n.jsx("div",{className:`space-y-3 ${X?"opacity-70":""}`,children:Object.keys(Ze).map(d=>{const m=Ze[d],u=te===d;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${u?"border-tanya-light":"border-gray-300"} ${X?"pointer-events-none":""}`,title:X?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:u,disabled:X,onChange:()=>ye(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:m.icon,width:"18"})," ",m.label]}),n.jsx("div",{className:"text-sm text-gray-700",children:m.subtitle})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:m.fee===0?"Free":Ye(m.fee,(S==null?void 0:S.currency)||rt)})]},d)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:Br,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:xo,disabled:X,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${X?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:"var(--tanya)"},children:X?"Delivery Submitted":"Submit Delivery Option"})]})]}),ke&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),Y&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!De&&n.jsx("button",{onClick:vo,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change payment method",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Please choose a payment method for this order:"}),n.jsx("div",{className:`space-y-3 ${Y?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${ie==="card"?"border-tanya-light":"border-gray-300"} ${Y?"pointer-events-none":""}`,title:Y?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:ie==="card",disabled:Y,onChange:()=>Q("card")}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),ie==="card"&&n.jsxs("div",{className:"text-sm text-gray-700 mt-1",children:["Mastercard    •••• 7820",n.jsx("br",{}),"Expiry: 12/26"]})]})]})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:bo,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:yo,disabled:Y,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${Y?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:"var(--tanya)"},children:Y?"Payment Submitted":"Submit Payment Method"})]})]}),Ue&&Vr({...S,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:Mr(S==null?void 0:S.currency)},!1)]}),n.jsxs("div",{className:"sticky bottom-0 w-[96%] drop-shadow-xl flex items-center rounded-full bg-white border border-gray-300 m-[15px]",children:[n.jsx("input",{placeholder:Ee?"Complete the current step…":jt?`What would you like me to do? (e.g., If this product goes below $${parseInt(r.price)-5}, grab it for me.)`:"Please select a combination first.",disabled:co,className:`w-full rounded-full p-4 outline-none border-none focus:ring-0 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed
19
19
  ${jt?"":"placeholder:text-red-400 text-red-500"}`,value:We,onKeyDown:d=>{d.key==="Enter"&&!Ie&&!Ee&&qr()},onChange:d=>ge(d.target.value)}),n.jsx("button",{type:"submit",disabled:Ie||Ee,className:"mr-6 font-medium",style:{color:"var(--tanya-light)"},onClick:()=>qr(),children:Ie?n.jsx("div",{className:"m-3 animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottom:"2px solid"}}):n.jsx(oe,{icon:"fluent:send-48-filled",color:"var(--tanya-light)",width:"24",height:"24"})})]})]})})]}),document.body)};exports.AgenticShoppingButton=Ra;exports.TanyaChatbot=Es;exports.TanyaChatbotProvider=Ao;
20
20
  //# sourceMappingURL=tanya-chatbot.cjs.js.map