tanya-chatbot 0.10.8 → 0.11.0

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 h=require("react"),n=require("react/jsx-runtime"),Jt=require("@apollo/client"),nt=require("react-redux"),vr=require("@reduxjs/toolkit"),Oo=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const oe=require("axios");require("crypto-js");const Ao=require("@iconify/react"),De=require("react-toastify"),$o=require("react-dom");function Lo(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 Pn=Lo(Oo),zo='*,: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 Do(){return h.useEffect(()=>{if(typeof document<"u"){const e=document.createElement("style");return e.textContent=zo,document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]),null}const Mo={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:[]}}},En=vr.createSlice({name:"store",initialState:Mo,reducers:{setStore:(e,t)=>{e.store=t.payload}}}),{setStore:Ja}=En.actions,Bo=En.reducer,qo={product:null},Tn=vr.createSlice({name:"product",initialState:qo,reducers:{setProduct:(e,t)=>{e.product=t.payload}}}),{setProduct:dr}=Tn.actions,Uo=Tn.reducer,Ro=vr.configureStore({reducer:{store:Bo,product:Uo}}),Vo=({children:e})=>n.jsx(nt.Provider,{store:Ro,children:e}),Kt=e=>{const t=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:e}});window.dispatchEvent(t)};function Ho({...e}){return n.jsx(Pn.Root,{"data-slot":"popover",...e})}function Yo({...e}){return n.jsx(Pn.Trigger,{"data-slot":"popover-trigger",...e})}const Ke=()=>({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"}),On=async()=>{const e="https://tanya-sfcc-server.vercel.app/";try{const t=await oe.post(`${e}api/auth/token-bm-grant?baseUrl=${Re()}&siteId=${Me()}`);return t.status===200&&t.data.access_token?t.data.access_token:(console.error("Failed to fetch token:",t.data),null)}catch(t){return oe.isAxiosError(t)?console.error("Error fetching token:",t.response||t.message):console.error("Unexpected error:",t),null}},An=async e=>{const t="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await oe.post(`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Re()}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return o.status===200&&o.data?o.data:null}catch(r){return oe.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function ot(){var a;const e=Me(),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}},Re=()=>sessionStorage.getItem("Host"),Me=()=>sessionStorage.getItem("SiteId"),We=()=>sessionStorage.getItem("pubCfg"),Qe=()=>sessionStorage.getItem("envRef"),Xe=()=>sessionStorage.getItem("orgRef"),Jo=async e=>{console.log("fetching results");const{serverUrl:t,basePath:r}=Ke();let o="";{const s=await ot();console.log("the token from getSearchResults",s),o=s.access_token}try{const s=Re();return(await oe.get(`${t}${r}/search-sfcc?baseUrl=${s}&query=${e}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(s){throw console.error("Error fetching search results:",s),s}},$n=async e=>{if(!e)throw new Error("Product ID is required");const{serverUrl:t,basePath:r}=Ke(),o=Re();console.log("calling access");const{access_token:s}=await ot();return(await oe.get(`${t}${r}/product-sfcc/${e}?baseUrl=${o}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).data},Ko=async e=>{if(!e)throw new Error("customerId is required");const t=await On(),{customer_token:r}=await An(t),{serverUrl:o,basePath:s}=Ke(),i=(await ot()).access_token;return(await oe.get(`${o}${s}/get-interest?baseUrl=${Re()}&customerId=${e}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},Wr=e=>String(typeof e=="string"?e:e["en-US"]||e),Qr=e=>e!=null&&e.image?[e.image]:"variants"in e?e.variants[0].images:e.masterVariant.images.map(t=>t.url),Wo=(e,t)=>e.toLocaleString("en-US",{style:"currency",currency:t||"USD"}),Xr=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}},Qo=e=>e.charAt(0).toUpperCase()+e.slice(1),Gr=(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 Xo(){const e=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[t,r]=h.useState(e);return h.useEffect(()=>{const o=()=>r(e());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}const Go=({product:e})=>{const t=nt.useDispatch(),r=Xo(),[o,s]=h.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 p=await $n(l);t(dr(p))};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 p,g,y,w;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:((p=Qr(l)[0])==null?void 0:p.link)||Qr(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:Gr(Wr((g=l==null?void 0:l.name)==null?void 0:g["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:Gr(Wr((y=l==null?void 0:l.name)==null?void 0:y["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:Wo(l!=null&&l.price?Number(l==null?void 0:l.price):Xr(l).centAmount||0,(w=Xr(l))==null?void 0:w.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:">"})]})})},Zo=({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:Qo(r.keyword)||"No keyword"}),n.jsx(Go,{product:r.items,storeDetails:t})]},o))}),jr=async(e,t)=>{var a,i;const{serverUrl:r,basePath:o}=Ke(),s=`${r}`;try{const c=await oe.post(`${s}${o}/basket/create?baseUrl=${Re()}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,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 oe.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}=Ke(),a=`${o}`;try{const i=await oe.post(`${a}${s}/basket/add-product/${e}?baseUrl=${Re()}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,t,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return oe.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},Ln=async({basketId:e,customer_token:t})=>{var a;const{serverUrl:r,basePath:o}=Ke(),s=`${r}`;try{const i=await oe.get(`${s}${o}/basket/${e}?baseUrl=${Re()}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:t}});return{status:i.status,data:i.data}}catch(i){return oe.isAxiosError(i)?{status:(a=i.response)==null?void 0:a.status,data:null}:{status:null,data:null}}},es=async e=>{var i;const{serverUrl:t,basePath:r}=Ke(),o=`${t}`,s=await ot(),a="Bearer "+(s==null?void 0:s.access_token);try{const c=await oe.get(`${o}${r}/basket/shipping-methods/${e}?baseUrl=${Re()}&siteId=${Me()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:a}});return((i=c==null?void 0:c.data)==null?void 0:i.applicableShippingMethods)||[]}catch(c){return oe.isAxiosError(c)?console.error("Error fetching shipping methods:",c.response||c.message):console.error("Unexpected error:",c),[]}},Pt="sfcc_basket_id",Zr="sfcc_customer_token",Et="sfcc_token_expiry",ts=300*1e3,Dt="1.0.0";const rt=e=>{try{e?localStorage.setItem(Pt,e):localStorage.removeItem(Pt)}catch(t){console.error("Error saving basket ID to storage:",t)}},Wt=e=>{try{if(e){localStorage.setItem(Zr,e);const t=Date.now()+ts;localStorage.setItem(Et,t.toString())}else localStorage.removeItem(Zr)}catch(t){console.error("Error storing token:",t)}},en=300,rs=({addToCartPwa:e})=>{var l,p,g,y,w,C;const t=nt.useDispatch(),r=nt.useSelector(S=>S.product.product),o=nt.useSelector(S=>S.store.store),[s,a]=h.useState(!!r);if(h.useEffect(()=>{a(!!r)},[r]),!r)return null;const i=async()=>{var S,P,j,_,Q,V,K,be,I,D,pe,ee,se,st,Be,k;try{if(!((P=(S=r==null?void 0:r.variants)==null?void 0:S[0])!=null&&P.product_id)&&!(r.type.item||r.type.bundle)&&!((_=(j=r==null?void 0:r.variants)==null?void 0:j[0])!=null&&_.productId)){De.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const U=[{product_id:((Q=r.variants)==null?void 0:Q[0].product_id)||((V=r.variants)==null?void 0:V[0].productId)||(r==null?void 0:r.id),quantity:1}],M=JSON.parse(sessionStorage.getItem("customerData")||"{}"),Oe=(M==null?void 0:M.basketId)||localStorage.getItem(Pt),wt=!1,Ge=localStorage.getItem(Et),qe=Date.now();if(!wt||!Ge||qe>=parseInt(Ge)){let ve="";if(ve="Bearer "+(await ot()).access_token,!ve){console.error("Failed to get customer_token");return}const Ae=qe+300*1e3;if(Wt(ve),localStorage.setItem(Et,Ae.toString()),Oe){const $e=await Ln({basketId:Oe,customer_token:ve});if($e.status===200&&$e){const he=await fr(Oe,U,ve);(((K=he==null?void 0:he.product_items)==null?void 0:K.length)>0||((be=he==null?void 0:he.productItems)==null?void 0:be.length)>0)&&(De.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Kt(Oe));return}}const Fe={productItems:[{productId:((I=r.variants)==null?void 0:I[0].product_id)||((D=r.variants)==null?void 0:D[0].productId)||(r==null?void 0:r.id),quantity:1}]},$=await jr(ve,Fe);if(!($!=null&&$.basket_id)&&!($!=null&&$.basketId)){console.error("Failed to create basket");return}rt(($==null?void 0:$.basket_id)||($==null?void 0:$.basketId)),console.log("adding product to basket");const Pe=await fr(($==null?void 0:$.basket_id)||($==null?void 0:$.basketId),U,ve);console.log("object added to basket"),(((pe=Pe==null?void 0:Pe.product_items)==null?void 0:pe.length)>0||((ee=Pe==null?void 0:Pe.productItems)==null?void 0:ee.length)>0)&&De.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Kt($.basket_id||($==null?void 0:$.basketId))}}catch(U){console.error("Error adding to cart:",U),De.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((se=U==null?void 0:U.response)==null?void 0:se.status)===404||((st=U==null?void 0:U.response)==null?void 0:st.status)===401?(((Be=U==null?void 0:U.response)==null?void 0:Be.status)===404&&rt(null),((k=U==null?void 0:U.response)==null?void 0:k.status)===401&&(rt(null),Wt(null))):(console.error("Failed to add product to basket:",U.message),De.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},c=()=>{if(!r)return;const S=window.location.origin+"/product/"+r.id;console.log("path",S),window.location.href=S};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)),en)}}),n.jsxs("div",{className:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),n=require("react/jsx-runtime"),Ht=require("@apollo/client"),st=require("react-redux"),yr=require("@reduxjs/toolkit"),Eo=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const oe=require("axios");require("crypto-js");const To=require("@iconify/react"),Me=require("react-toastify"),Oo=require("react-dom");function Ao(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 Fn=Ao(Eo),$o='*,: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 Lo(){return h.useEffect(()=>{if(typeof document<"u"){const e=document.createElement("style");return e.textContent=$o,document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]),null}const zo={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:[]}}},Pn=yr.createSlice({name:"store",initialState:zo,reducers:{setStore:(e,t)=>{e.store=t.payload}}}),{setStore:Ja}=Pn.actions,Do=Pn.reducer,Mo={product:null},En=yr.createSlice({name:"product",initialState:Mo,reducers:{setProduct:(e,t)=>{e.product=t.payload}}}),{setProduct:ir}=En.actions,Bo=En.reducer,qo=yr.configureStore({reducer:{store:Do,product:Bo}}),Uo=({children:e})=>n.jsx(st.Provider,{store:qo,children:e}),Yt=e=>{const t=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:e}});window.dispatchEvent(t)};function Ro({...e}){return n.jsx(Fn.Root,{"data-slot":"popover",...e})}function Vo({...e}){return n.jsx(Fn.Trigger,{"data-slot":"popover-trigger",...e})}const Ke=()=>({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"}),Tn=async()=>{const e="https://tanya-sfcc-server.vercel.app/";try{const t=await oe.post(`${e}api/auth/token-bm-grant?baseUrl=${Ve()}&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 oe.isAxiosError(t)?console.error("Error fetching token:",t.response||t.message):console.error("Unexpected error:",t),null}},On=async e=>{const t="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await oe.post(`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Ve()}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return o.status===200&&o.data?o.data:null}catch(r){return oe.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function at(){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 lr=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}},Ve=()=>sessionStorage.getItem("Host"),Be=()=>sessionStorage.getItem("SiteId"),We=()=>sessionStorage.getItem("pubCfg"),Qe=()=>sessionStorage.getItem("envRef"),Xe=()=>sessionStorage.getItem("orgRef"),Ho=async e=>{console.log("fetching results");const{serverUrl:t,basePath:r}=Ke();let o="";{const s=await at();console.log("the token from getSearchResults",s),o=s.access_token}try{const s=Ve();return(await oe.get(`${t}${r}/search-sfcc?baseUrl=${s}&query=${e}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(s){throw console.error("Error fetching search results:",s),s}},An=async e=>{if(!e)throw new Error("Product ID is required");const{serverUrl:t,basePath:r}=Ke(),o=Ve();console.log("calling access");const{access_token:s}=await at();return(await oe.get(`${t}${r}/product-sfcc/${e}?baseUrl=${o}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).data},Yo=async e=>{if(!e)throw new Error("customerId is required");const t=await Tn(),{customer_token:r}=await On(t),{serverUrl:o,basePath:s}=Ke(),i=(await at()).access_token;return(await oe.get(`${o}${s}/get-interest?baseUrl=${Ve()}&customerId=${e}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},Wr=e=>String(typeof e=="string"?e:e["en-US"]||e),Qr=e=>e!=null&&e.image?[e.image]:"variants"in e?e.variants[0].images:e.masterVariant.images.map(t=>t.url),Jo=(e,t)=>e.toLocaleString("en-US",{style:"currency",currency:t||"USD"}),Xr=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}},Ko=e=>e.charAt(0).toUpperCase()+e.slice(1),Gr=(e,t)=>e.length<t?e:e.slice(0,t)+"...",er=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 Wo(){const e=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[t,r]=h.useState(e);return h.useEffect(()=>{const o=()=>r(e());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}const Qo=({product:e})=>{const t=st.useDispatch(),r=Wo(),[o,s]=h.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 p=await An(l);t(ir(p))};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 p,g,y,w;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:((p=Qr(l)[0])==null?void 0:p.link)||Qr(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:Gr(Wr((g=l==null?void 0:l.name)==null?void 0:g["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:Gr(Wr((y=l==null?void 0:l.name)==null?void 0:y["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:Jo(l!=null&&l.price?Number(l==null?void 0:l.price):Xr(l).centAmount||0,(w=Xr(l))==null?void 0:w.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:">"})]})})},Xo=({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:Ko(r.keyword)||"No keyword"}),n.jsx(Qo,{product:r.items,storeDetails:t})]},o))}),br=async(e,t)=>{var a,i;const{serverUrl:r,basePath:o}=Ke(),s=`${r}`;try{const c=await oe.post(`${s}${o}/basket/create?baseUrl=${Ve()}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,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 oe.isAxiosError(c)?console.error("Error creating basket:",c.response||c.message):console.error("Unexpected error:",c),null}},cr=async(e,t,r)=>{const{serverUrl:o,basePath:s}=Ke(),a=`${o}`;try{const i=await oe.post(`${a}${s}/basket/add-product/${e}?baseUrl=${Ve()}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,t,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return oe.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},$n=async({basketId:e,customer_token:t})=>{var a;const{serverUrl:r,basePath:o}=Ke(),s=`${r}`;try{const i=await oe.get(`${s}${o}/basket/${e}?baseUrl=${Ve()}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:t}});return{status:i.status,data:i.data}}catch(i){return oe.isAxiosError(i)?{status:(a=i.response)==null?void 0:a.status,data:null}:{status:null,data:null}}},Go=async e=>{var i;const{serverUrl:t,basePath:r}=Ke(),o=`${t}`,s=await at(),a="Bearer "+(s==null?void 0:s.access_token);try{const c=await oe.get(`${o}${r}/basket/shipping-methods/${e}?baseUrl=${Ve()}&siteId=${Be()}&pubCfg=${We()}&envRef=${Qe()}&orgRef=${Xe()}`,{headers:{"Content-Type":"application/json",Authorization:a}});return((i=c==null?void 0:c.data)==null?void 0:i.applicableShippingMethods)||[]}catch(c){return oe.isAxiosError(c)?console.error("Error fetching shipping methods:",c.response||c.message):console.error("Unexpected error:",c),[]}},Ft="sfcc_basket_id",Zr="sfcc_customer_token",Pt="sfcc_token_expiry",Zo=300*1e3,zt="1.0.0";const ot=e=>{try{e?localStorage.setItem(Ft,e):localStorage.removeItem(Ft)}catch(t){console.error("Error saving basket ID to storage:",t)}},Jt=e=>{try{if(e){localStorage.setItem(Zr,e);const t=Date.now()+Zo;localStorage.setItem(Pt,t.toString())}else localStorage.removeItem(Zr)}catch(t){console.error("Error storing token:",t)}},en=300,es=({addToCartPwa:e})=>{var l,p,g,y,w,C;const t=st.useDispatch(),r=st.useSelector(S=>S.product.product),o=st.useSelector(S=>S.store.store),[s,a]=h.useState(!!r);if(h.useEffect(()=>{a(!!r)},[r]),!r)return null;const i=async()=>{var S,P,j,I,Q,R,X,Oe,F,V,ce,B,de,te,_e,k;try{if(!((P=(S=r==null?void 0:r.variants)==null?void 0:S[0])!=null&&P.product_id)&&!(r.type.item||r.type.bundle)&&!((I=(j=r==null?void 0:r.variants)==null?void 0:j[0])!=null&&I.productId)){Me.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const H=[{product_id:((Q=r.variants)==null?void 0:Q[0].product_id)||((R=r.variants)==null?void 0:R[0].productId)||(r==null?void 0:r.id),quantity:1}],z=JSON.parse(sessionStorage.getItem("customerData")||"{}"),Ae=(z==null?void 0:z.basketId)||localStorage.getItem(Ft),gt=!1,Ge=localStorage.getItem(Pt),qe=Date.now();if(!gt||!Ge||qe>=parseInt(Ge)){let ye="";if(ye="Bearer "+(await at()).access_token,!ye){console.error("Failed to get customer_token");return}const $e=qe+300*1e3;if(Jt(ye),localStorage.setItem(Pt,$e.toString()),Ae){const Le=await $n({basketId:Ae,customer_token:ye});if(Le.status===200&&Le){const he=await cr(Ae,H,ye);(((X=he==null?void 0:he.product_items)==null?void 0:X.length)>0||((Oe=he==null?void 0:he.productItems)==null?void 0:Oe.length)>0)&&(Me.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(Ae));return}}const Ie={productItems:[{productId:((F=r.variants)==null?void 0:F[0].product_id)||((V=r.variants)==null?void 0:V[0].productId)||(r==null?void 0:r.id),quantity:1}]},A=await br(ye,Ie);if(!(A!=null&&A.basket_id)&&!(A!=null&&A.basketId)){console.error("Failed to create basket");return}ot((A==null?void 0:A.basket_id)||(A==null?void 0:A.basketId)),console.log("adding product to basket");const Fe=await cr((A==null?void 0:A.basket_id)||(A==null?void 0:A.basketId),H,ye);console.log("object added to basket"),(((ce=Fe==null?void 0:Fe.product_items)==null?void 0:ce.length)>0||((B=Fe==null?void 0:Fe.productItems)==null?void 0:B.length)>0)&&Me.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(A.basket_id||(A==null?void 0:A.basketId))}}catch(H){console.error("Error adding to cart:",H),Me.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((de=H==null?void 0:H.response)==null?void 0:de.status)===404||((te=H==null?void 0:H.response)==null?void 0:te.status)===401?(((_e=H==null?void 0:H.response)==null?void 0:_e.status)===404&&ot(null),((k=H==null?void 0:H.response)==null?void 0:k.status)===401&&(ot(null),Jt(null))):(console.error("Failed to add product to basket:",H.message),Me.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},c=()=>{if(!r)return;const S=window.location.origin+"/product/"+r.id;console.log("path",S),window.location.href=S};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(ir(null)),en)}}),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
- `,style:{willChange:"transform, opacity"},onClick:S=>S.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)),en)},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:(y=(g=(p=(l=r.imageGroups)==null?void 0:l[0])==null?void 0:p.images)==null?void 0:g[0])==null?void 0:y.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(S=>S.images.slice(1,2).map(P=>n.jsx("img",{src:P.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},P.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:[((w=r==null?void 0:r.rating)==null?void 0:w.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:[((C=r==null?void 0:r.rating)==null?void 0:C.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((S,P)=>{var j;return n.jsx(Ao.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
5
+ `,style:{willChange:"transform, opacity"},onClick:S=>S.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(ir(null)),en)},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:(y=(g=(p=(l=r.imageGroups)==null?void 0:l[0])==null?void 0:p.images)==null?void 0:g[0])==null?void 0:y.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(S=>S.images.slice(1,2).map(P=>n.jsx("img",{src:P.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},P.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:[((w=r==null?void 0:r.rating)==null?void 0:w.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:[((C=r==null?void 0:r.rating)==null?void 0:C.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((S,P)=>{var j;return n.jsx(To.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)>P?"text-yellow-500":"text-gray-300"}
7
- `},P)})})]}),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"})]})]})]})},ns=({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=h.useRef(null),i=h.useRef(null),c=h.useRef(null),l=h.useRef(null),[p,g]=h.useState(null);h.useRef(null);const[y,w]=h.useState(!1),[C,S]=h.useState(!1),[P,j]=h.useState(!1),[_,Q]=h.useState(!1),[V,K]=h.useState(!1),[be,I]=h.useState(!1),[D,pe]=h.useState(""),[ee,se]=h.useState(""),st=m=>({id:m.id,title:m.name,image:m.image??"",price:m.price??0}),[Be,k]=h.useState([]),U=h.useRef(null),M=nt.useSelector(m=>m.store.store),Oe=nt.useSelector(m=>m.product.product);h.useEffect(()=>{const m=localStorage.getItem(`access_token_${e.siteId}`),B=localStorage.getItem(`chat-token-${e.siteId}`);if(m&&B===m){const E=localStorage.getItem("chatHistory");E&&k(JSON.parse(E))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${e.siteId}`,m||"")},[]),h.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify(Be));const m=localStorage.getItem(`access_token_${e.siteId}`);m&&localStorage.setItem(`chat-token-${e.siteId}`,m)},[Be]);const wt=()=>{j(!0),setTimeout(()=>S(!0),10)},Ge=()=>{S(!1),setTimeout(()=>j(!1),300)};h.useEffect(()=>{y?wt():Ge()},[y]);const qe=m=>{se(s[m])};h.useEffect(()=>{P&&U.current&&U.current.scrollTo({top:U.current.scrollHeight,behavior:"smooth"})},[Be,P]);const ve=null,Ae=null,Fe=async()=>{const m=await ot();m!=null&&g(m)};h.useEffect(()=>{if(e!=null&&e.siteId){const{clientID:m,host:B,organizationID:E,shortCode:X,siteId:W}=e;sessionStorage.setItem("Host",B),sessionStorage.setItem("SiteId",W),sessionStorage.setItem("pubCfg",btoa(m)),sessionStorage.setItem("envRef",X),sessionStorage.setItem("orgRef",E)}Fe(),console.log("scapi environment v1")},[]),h.useEffect(()=>{t&&(console.log("setting the basket id",t),rt(t))},[t]);const $=async()=>{const m=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await Ko(m||"")).c_interests},Pe=async(m,B)=>{console.log("in secondary flow",Dt);const E=await $();if(console.log(E,"interests of customer",Dt),!!E)try{k(Z=>Z.map((ue,ke)=>ke===Z.length-1?{...ue,secondaryLoading:!0}:ue));const X=await ur(ve,Ae);if(!X)throw new Error("Failed to fetch token");const W=localStorage.getItem("customerNumber"),O=localStorage.getItem("isLoggedIn"),H=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(O||!1),userId:String(W||new Date().getTime())}).toString()}`,q=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:m,productPoints:String(B||0),interests:E}}),G=await fetch(H,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${X}`},body:q});if(!G.body)throw new Error("Readable stream not supported");const Le=G.body.getReader(),Ve=new TextDecoder;let je="";for(;;){const{done:Z,value:ue}=await Le.read();if(Z)break;je+=Ve.decode(ue,{stream:!0});const ke=je.split(`
8
- `);je=ke.pop()||"";for(const fe of ke)if(fe.startsWith("data:")){const b=fe.slice(5).trim();try{const Ne=JSON.parse(b);Ne.index===0&&k(L=>L.map((Y,Ce)=>Ce===L.length-1?{...Y,secondaryResponse:Ne.data,secondaryLoading:!1}:Y))}catch(Ne){k(L=>L.map((Y,Ce)=>Ce===L.length-1?{...Y,secondaryLoading:!1}:Y)),console.error("Secondary flow JSON parse error:",Ne)}}}}catch(X){console.error("Secondary flow error:",X)}},$e=async m=>{const B=m||D.trim();if(B){K(!0),pe(""),a.current=null,i.current=null,c.current=null,l.current=null,k(E=>[...E,{query:B,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const E=ee,X=localStorage.getItem("customerNumber"),W=localStorage.getItem("isLoggedIn"),O=await ur(ve,Ae);if(!O)throw new Error("Failed to obtain access token");const H=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(W||!1),userId:String(X||new Date().getTime())}).toString()}`,q=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:B,whom:E}}),G=await fetch(H,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${O}`},body:q});if(!G.ok)throw new Error(`HTTP error! status: ${G.status}`);if(!G.body)throw new Error("Readable stream not supported");const Le=G.body.getReader(),Ve=new TextDecoder;let je="",Z="";for(;;){I(!0);const{done:ue,value:ke}=await Le.read();if(ue)break;je+=Ve.decode(ke,{stream:!0});const fe=je.split(`
9
- `);je=fe.pop()||"";for(const b of fe)if(b.startsWith("data:")){const Ne=b.slice(5).trim();try{const L=JSON.parse(Ne);L.index==1&&(Z=L.data),k(Y=>Y.map((Ce,ge)=>ge===Y.length-1?{...Ce,[L.index==0?"response":L.index==1?"keywords":L.index==2?"potentialQuestions":"end"]:L.data}:Ce))}catch(L){console.error("Error parsing JSON:",L)}}}Ee(he(Z))}catch(E){console.error("Error sending message to Tanya:",E)}finally{K(!1)}}},he=m=>{const B=m.match(/top five relevant product or category names are: (.*)/i),W=(B?B[1]:m).split(", ").map(de=>de.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(W)].filter(Boolean).join(",")},Ee=async m=>{var E,X,W;const B=typeof m=="string"?m.split(","):m;I(!0);try{const O=await Promise.all(B.map(q=>Jo(q).catch(()=>[]))),de=B.map((q,G)=>({keyword:q,items:O[G]??[],loading:!1})).filter(q=>q.items.length>0),H=(X=(E=de[0])==null?void 0:E.items)==null?void 0:X[0];if(H){i.current=H.product_id,a.current=H.product_name,c.current=(W=H.image)==null?void 0:W.link;const q=typeof H.price=="number"?H.price:null;l.current=q}if(k(q=>q.map((G,Le)=>Le===q.length-1?{...G,products:de,productSnapshot:H?{id:i.current,name:a.current,image:c.current,price:l.current,points:0,quantity:1}:G.productSnapshot}:G)),H){const q=JSON.parse(sessionStorage.getItem("customerData")||"{}");q!=null&&q.isGuest||(console.log("running secondary flow",Dt),Pe(a.current,0))}}catch(O){console.error("error in keyword search",O)}finally{I(!1)}},ae=async(m,B)=>{var E,X,W,O,de,H,q,G,Le,Ve,je,Z,ue,ke,fe;Q(!0);try{const b=await $n(m.id);if(!((X=(E=b==null?void 0:b.variants)==null?void 0:E[0])!=null&&X.product_id||(O=(W=b==null?void 0:b.variants)==null?void 0:W[0])!=null&&O.productId)&&!(b.type.item||b.type.bundle)){Q(!1),De.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const Ne=[{product_id:((de=b.variants)==null?void 0:de[0].product_id)||((H=b.variants)==null?void 0:H[0].productId)||(b==null?void 0:b.id),quantity:B}];console.log(Ne,"product data","app version",Dt);const L=JSON.parse(sessionStorage.getItem("customerData")||"{}"),Y=(L==null?void 0:L.basketId)||localStorage.getItem(Pt),Ce=!1,ge=localStorage.getItem(Et),Ue=Date.now();if(!Ce||!ge||Ue>=parseInt(ge)){const Ot=await On();let{customer_token:ie}=await An(Ot);if(ie="Bearer "+p.access_token,!ie){console.error("Failed to get customer_token");return}const Se=Ue+300*1e3;if(Wt(ie),localStorage.setItem(Et,Se.toString()),console.log(Y,"basketIdFromCustomer"),Y){const me=await Ln({basketId:Y,customer_token:ie});if(me.status===200&&me){const at=await fr(Y,Ne,ie);((q=at==null?void 0:at.product_items)==null?void 0:q.length)>0&&(De.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Kt(Y),Q(!1));return}}const yt={productItems:[{productId:((G=b.variants)==null?void 0:G[0].product_id)||((Le=b.variants)==null?void 0:Le[0].productId)||(b==null?void 0:b.id),quantity:1}]},N=await jr(ie,yt);if(console.log(N,N==null?void 0:N.basket_id,N==null?void 0:N.basketId,"the basket response"),!(N!=null&&N.basket_id||!(N!=null&&N.basketId))){Q(!1),console.error("Failed to create basket");return}rt((N==null?void 0:N.basket_id)||(N==null?void 0:N.basketId));const xe=await r({productId:i,quantity:B},(N==null?void 0:N.basket_id)||(N==null?void 0:N.basketId));(((Ve=xe==null?void 0:xe.product_items)==null?void 0:Ve.length)>0||((je=xe==null?void 0:xe.productItems)==null?void 0:je.length)>0)&&De.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Kt(N.basket_id||(N==null?void 0:N.basketId))}}catch(b){Q(!1),console.error("Error adding to cart:",b),De.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((Z=b==null?void 0:b.response)==null?void 0:Z.status)===404||((ue=b==null?void 0:b.response)==null?void 0:ue.status)===401?(((ke=b==null?void 0:b.response)==null?void 0:ke.status)===404&&rt(null),((fe=b==null?void 0:b.response)==null?void 0:fe.status)===401&&(rt(null),Wt(null))):(console.error("Failed to add product to basket:",b.message),De.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}Q(!1)};return h.useEffect(()=>{P?setTimeout(()=>S(!0),10):S(!1)},[P]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(Ho,{open:y,onOpenChange:w,children:[n.jsx(Yo,{onClick:()=>w(!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"})})]})]})})}),P&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>w(!1)}),n.jsxs("div",{className:`
7
+ `},P)})})]}),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"})]})]})]})},ts=({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=h.useRef(null),i=h.useRef(null),c=h.useRef(null),l=h.useRef(null),[p,g]=h.useState(null);h.useRef(null);const[y,w]=h.useState(!1),[C,S]=h.useState(!1),[P,j]=h.useState(!1),[I,Q]=h.useState(!1),[R,X]=h.useState(!1),[Oe,F]=h.useState(!1),[V,ce]=h.useState(""),[B,de]=h.useState(""),te=m=>({id:m.id,title:m.name,image:m.image??"",price:m.price??0}),[_e,k]=h.useState([]),H=h.useRef(null),z=st.useSelector(m=>m.store.store),Ae=st.useSelector(m=>m.product.product);h.useEffect(()=>{const m=localStorage.getItem(`access_token_${e.siteId}`),D=localStorage.getItem(`chat-token-${e.siteId}`);if(m&&D===m){const T=localStorage.getItem("chatHistory");T&&k(JSON.parse(T))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${e.siteId}`,m||"")},[]),h.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify(_e));const m=localStorage.getItem(`access_token_${e.siteId}`);m&&localStorage.setItem(`chat-token-${e.siteId}`,m)},[_e]);const gt=()=>{j(!0),setTimeout(()=>S(!0),10)},Ge=()=>{S(!1),setTimeout(()=>j(!1),300)};h.useEffect(()=>{y?gt():Ge()},[y]);const qe=m=>{de(s[m])};h.useEffect(()=>{P&&H.current&&H.current.scrollTo({top:H.current.scrollHeight,behavior:"smooth"})},[_e,P]);const ye=null,$e=null,Ie=async()=>{const m=await at();m!=null&&g(m)};h.useEffect(()=>{if(e!=null&&e.siteId){const{clientID:m,host:D,organizationID:T,shortCode:G,siteId:W}=e;sessionStorage.setItem("Host",D),sessionStorage.setItem("SiteId",W),sessionStorage.setItem("pubCfg",btoa(m)),sessionStorage.setItem("envRef",G),sessionStorage.setItem("orgRef",T)}Ie(),console.log("scapi environment v1")},[]),h.useEffect(()=>{t&&ot(t)},[t]);const A=async()=>{const m=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await Yo(m||"")).c_interests},Fe=async(m,D)=>{console.log("in secondary flow",zt);const T=await A();if(console.log(T,"interests of customer",zt),!!T)try{k(ee=>ee.map((fe,ve)=>ve===ee.length-1?{...fe,secondaryLoading:!0}:fe));const G=await lr(ye,$e);if(!G)throw new Error("Failed to fetch token");const W=localStorage.getItem("customerNumber"),O=localStorage.getItem("isLoggedIn"),Y=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(O||!1),userId:String(W||new Date().getTime())}).toString()}`,q=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:m,productPoints:String(D||0),interests:T}}),Z=await fetch(Y,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${G}`},body:q});if(!Z.body)throw new Error("Readable stream not supported");const ze=Z.body.getReader(),He=new TextDecoder;let be="";for(;;){const{done:ee,value:fe}=await ze.read();if(ee)break;be+=He.decode(fe,{stream:!0});const ve=be.split(`
8
+ `);be=ve.pop()||"";for(const me of ve)if(me.startsWith("data:")){const b=me.slice(5).trim();try{const Se=JSON.parse(b);Se.index===0&&k(L=>L.map((J,Ne)=>Ne===L.length-1?{...J,secondaryResponse:Se.data,secondaryLoading:!1}:J))}catch(Se){k(L=>L.map((J,Ne)=>Ne===L.length-1?{...J,secondaryLoading:!1}:J)),console.error("Secondary flow JSON parse error:",Se)}}}}catch(G){console.error("Secondary flow error:",G)}},Le=async m=>{const D=m||V.trim();if(D){X(!0),ce(""),a.current=null,i.current=null,c.current=null,l.current=null,k(T=>[...T,{query:D,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const T=B,G=localStorage.getItem("customerNumber"),W=localStorage.getItem("isLoggedIn"),O=await lr(ye,$e);if(!O)throw new Error("Failed to obtain access token");const Y=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(W||!1),userId:String(G||new Date().getTime())}).toString()}`,q=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:D,whom:T}}),Z=await fetch(Y,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${O}`},body:q});if(!Z.ok)throw new Error(`HTTP error! status: ${Z.status}`);if(!Z.body)throw new Error("Readable stream not supported");const ze=Z.body.getReader(),He=new TextDecoder;let be="",ee="";for(;;){F(!0);const{done:fe,value:ve}=await ze.read();if(fe)break;be+=He.decode(ve,{stream:!0});const me=be.split(`
9
+ `);be=me.pop()||"";for(const b of me)if(b.startsWith("data:")){const Se=b.slice(5).trim();try{const L=JSON.parse(Se);L.index==1&&(ee=L.data),k(J=>J.map((Ne,ge)=>ge===J.length-1?{...Ne,[L.index==0?"response":L.index==1?"keywords":L.index==2?"potentialQuestions":"end"]:L.data}:Ne))}catch(L){console.error("Error parsing JSON:",L)}}}Pe(he(ee))}catch(T){console.error("Error sending message to Tanya:",T)}finally{X(!1)}}},he=m=>{const D=m.match(/top five relevant product or category names are: (.*)/i),W=(D?D[1]:m).split(", ").map(ue=>ue.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(W)].filter(Boolean).join(",")},Pe=async m=>{var T,G,W;const D=typeof m=="string"?m.split(","):m;F(!0);try{const O=await Promise.all(D.map(q=>Ho(q).catch(()=>[]))),ue=D.map((q,Z)=>({keyword:q,items:O[Z]??[],loading:!1})).filter(q=>q.items.length>0),Y=(G=(T=ue[0])==null?void 0:T.items)==null?void 0:G[0];if(Y){i.current=Y.product_id,a.current=Y.product_name,c.current=(W=Y.image)==null?void 0:W.link;const q=typeof Y.price=="number"?Y.price:null;l.current=q}if(k(q=>q.map((Z,ze)=>ze===q.length-1?{...Z,products:ue,productSnapshot:Y?{id:i.current,name:a.current,image:c.current,price:l.current,points:0,quantity:1}:Z.productSnapshot}:Z)),Y){const q=JSON.parse(sessionStorage.getItem("customerData")||"{}");q!=null&&q.isGuest||(console.log("running secondary flow",zt),Fe(a.current,0))}}catch(O){console.error("error in keyword search",O)}finally{F(!1)}},se=async(m,D)=>{var T,G,W,O,ue,Y,q,Z,ze,He,be,ee,fe,ve,me;Q(!0);try{const b=await An(m.id);if(!((G=(T=b==null?void 0:b.variants)==null?void 0:T[0])!=null&&G.product_id||(O=(W=b==null?void 0:b.variants)==null?void 0:W[0])!=null&&O.productId)&&!(b.type.item||b.type.bundle)){Q(!1),Me.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const Se=[{product_id:((ue=b.variants)==null?void 0:ue[0].product_id)||((Y=b.variants)==null?void 0:Y[0].productId)||(b==null?void 0:b.id),quantity:D}];console.log(Se,"product data","app version",zt);const L=JSON.parse(sessionStorage.getItem("customerData")||"{}"),J=(L==null?void 0:L.basketId)||localStorage.getItem(Ft),Ne=!1,ge=localStorage.getItem(Pt),Ue=Date.now();if(!Ne||!ge||Ue>=parseInt(ge)){const Tt=await Tn();let{customer_token:ae}=await On(Tt);if(ae="Bearer "+p.access_token,!ae){console.error("Failed to get customer_token");return}const je=Ue+300*1e3;if(Jt(ae),localStorage.setItem(Pt,je.toString()),console.log(J,"basketIdFromCustomer"),J){const pe=await $n({basketId:J,customer_token:ae});if(pe.status===200&&pe){const it=await cr(J,Se,ae);((q=it==null?void 0:it.product_items)==null?void 0:q.length)>0&&(Me.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(J),Q(!1));return}}const xt={productItems:[{productId:((Z=b.variants)==null?void 0:Z[0].product_id)||((ze=b.variants)==null?void 0:ze[0].productId)||(b==null?void 0:b.id),quantity:1}]},N=await br(ae,xt);if(console.log(N,N==null?void 0:N.basket_id,N==null?void 0:N.basketId,"the basket response"),!(N!=null&&N.basket_id||!(N!=null&&N.basketId))){Q(!1),console.error("Failed to create basket");return}ot((N==null?void 0:N.basket_id)||(N==null?void 0:N.basketId));const xe=await r({productId:i,quantity:D},(N==null?void 0:N.basket_id)||(N==null?void 0:N.basketId));(((He=xe==null?void 0:xe.product_items)==null?void 0:He.length)>0||((be=xe==null?void 0:xe.productItems)==null?void 0:be.length)>0)&&Me.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(N.basket_id||(N==null?void 0:N.basketId))}}catch(b){Q(!1),console.error("Error adding to cart:",b),Me.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((ee=b==null?void 0:b.response)==null?void 0:ee.status)===404||((fe=b==null?void 0:b.response)==null?void 0:fe.status)===401?(((ve=b==null?void 0:b.response)==null?void 0:ve.status)===404&&ot(null),((me=b==null?void 0:b.response)==null?void 0:me.status)===401&&(ot(null),Jt(null))):(console.error("Failed to add product to basket:",b.message),Me.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}Q(!1)};return h.useEffect(()=>{P?setTimeout(()=>S(!0),10):S(!1)},[P]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(Ro,{open:y,onOpenChange:w,children:[n.jsx(Vo,{onClick:()=>w(!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"})})]})]})})}),P&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>w(!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:()=>w(!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 ${Oe?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:U,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(M==null?void 0:M.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(m=>n.jsx("button",{onClick:()=>qe(m),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:ee===s[m]?"#FFFFFF":"#F3F3F3",borderColor:ee===s[m]?"#BBB3DD":""},children:m},m))})]}),Be.map((m,B)=>{var E,X;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:m.query})}),m.response&&m.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(m.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(m.response)}})}),be&&!m.response.includes("Thinking")&&((E=m.products)==null?void 0:E.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"})}),(m==null?void 0:m.products)&&((X=m==null?void 0:m.products)==null?void 0:X.length)>0&&n.jsx(Zo,{chat:m.products,storeDetails:M}),(m==null?void 0:m.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:M.themeDarkColor},children:"Why not explore these inquiries..."}),m.potentialQuestions.split(",").map((W,O)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${M.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>$e(W),style:{backgroundColor:M.tanyaThemeColorLight},children:W},O))]}),(m==null?void 0:m.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:M.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:M.themeDarkColor},children:"• • •"})]})}),(m==null?void 0:m.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:M.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:nr(m.secondaryResponse)}}),m.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:M.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:m.productSnapshot.image?n.jsx("img",{src:m.productSnapshot.image,alt:m.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:m.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:m.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(M==null?void 0:M.currency)||"USD"}).format(m.productSnapshot.price):""}),m.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[m.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:()=>k(W=>W.map((O,de)=>de===B&&O.productSnapshot?{...O,productSnapshot:{...O.productSnapshot,quantity:Math.max(1,O.productSnapshot.quantity-1)}}:O)),style:{background:"transparent",color:M.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:m.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>k(W=>W.map((O,de)=>de===B&&O.productSnapshot?{...O,productSnapshot:{...O.productSnapshot,quantity:O.productSnapshot.quantity+1}}:O)),style:{background:"transparent",color:M.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{ae(st(m.productSnapshot),m.productSnapshot.quantity)},disabled:_,className:"px-4 py-2 rounded-full font-medium",style:{background:M.tanyaThemeColor,color:(M==null?void 0:M.tanyaThemeContrastColor)||"#fff",opacity:_?.8:1},children:_?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},B)})]}),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:D,autoFocus:!0,onChange:m=>pe(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!V&&$e()}}),n.jsx("button",{type:"submit",disabled:V,className:"p-3",onClick:()=>$e(),children:V?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:M.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(rs,{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 os(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 ss(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",tn=Object.setPrototypeOf,as=tn===void 0?function(e,t){return e.__proto__=t,e}:tn,zn=(function(e){os(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,as(o,t.prototype),o}return t})(Error);function tt(e,t){if(!e)throw new zn(t)}var Dn=["debug","log","warn","error","silent"],is=Dn.indexOf("log");function Mt(e){return function(){if(Dn.indexOf(e)>=is){var t=console[e]||console.log;return t.apply(console,arguments)}}}(function(e){e.debug=Mt("debug"),e.log=Mt("log"),e.warn=Mt("warn"),e.error=Mt("error")})(tt||(tt={}));var Mn="3.14.0";function ut(e){try{return e()}catch{}}const pr=ut(function(){return globalThis})||ut(function(){return window})||ut(function(){return self})||ut(function(){return global})||ut(function(){return ut.constructor("return this")()});var rn=new Map;function ls(e){var t=rn.get(e)||1;return rn.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function cs(e,t){var r=ls("stringifyForDisplay");return JSON.stringify(e,function(o,s){return s===void 0?r:s},t).split(JSON.stringify(r)).join("<undefined>")}function Bt(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=kr(s),t||(t=Sr(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||tt(t,kr(r,o)||Sr(r,o))},{debug:Bt(tt.debug),log:Bt(tt.log),warn:Bt(tt.warn),error:Bt(tt.error)});function Bn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new zn(kr(e,t)||Sr(e,t))}var nn=Symbol.for("ApolloErrorMessageHandler_"+Mn);function qn(e){if(typeof e=="string")return e;try{return cs(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function kr(e,t){if(t===void 0&&(t=[]),!!e)return pr[nn]&&pr[nn](e,t.map(qn))}function Sr(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:Mn,message:e,args:t.map(qn)})))}function ds(e){return e.definitions.filter(function(t){return t.kind==="OperationDefinition"&&!!t.name}).map(function(t){return t.name.value})[0]||null}let re=null;const on={};let us=1;const fs=()=>class{constructor(){this.id=["slot",us++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let t=re;t;t=t.parent)if(this.id in t.slots){const r=t.slots[this.id];if(r===on)break;return t!==re&&(re.slots[this.id]=r),!0}return re&&(re.slots[this.id]=on),!1}getValue(){if(this.hasValue())return re.slots[this.id]}withValue(t,r,o,s){const a={__proto__:null,[this.id]:t},i=re;re={parent:i,slots:a};try{return r.apply(s,o)}finally{re=i}}static bind(t){const r=re;return function(){const o=re;try{return re=r,t.apply(this,arguments)}finally{re=o}}}static noContext(t,r,o){if(re){const s=re;try{return re=null,t.apply(o,r)}finally{re=s}}else return t.apply(o,r)}};function sn(e){try{return e()}catch{}}const ar="@wry/context:Slot",ms=sn(()=>globalThis)||sn(()=>global)||Object.create(null),an=ms,Nr=an[ar]||Array[ar]||(function(e){try{Object.defineProperty(an,ar,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}})(fs()),{bind:Wa,noContext:Qa}=Nr;new Nr;function ps(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=hs(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 hs(e,t){if(e){if(typeof e=="string")return ln(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 ln(e,t)}}function ln(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 cn(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 Cr(e,t,r){return t&&cn(e.prototype,t),r&&cn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var _r=function(){return typeof Symbol=="function"},Ir=function(e){return _r()&&!!Symbol[e]},Fr=function(e){return Ir(e)?Symbol[e]:"@@"+e};_r()&&!Ir("observable")&&(Symbol.observable=Symbol("observable"));var gs=Fr("iterator"),hr=Fr("observable"),Un=Fr("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 Nt(e){var t=e.constructor;return t!==void 0&&(t=t[Un],t===null&&(t=void 0)),t!==void 0?t:ce}function xs(e){return e instanceof ce}function gt(e){gt.log?gt.log(e):setTimeout(function(){throw e})}function Ut(e){Promise.resolve().then(function(){try{e()}catch(t){gt(t)}})}function Rn(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){gt(o)}}function gr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function ws(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(Vn(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function Vn(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){gt(a)}e._state==="closed"?Rn(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}],Ut(function(){return ws(e)});return}Vn(e,t,r)}}var ys=(function(){function e(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new bs(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),Rn(this))},Cr(e,[{key:"closed",get:function(){return this._state==="closed"}}]),e})(),bs=(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")},Cr(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 ys(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(p){try{o(p,c)}catch(g){i(g),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=Nt(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=Nt(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=Nt(this),i=arguments.length>1,c=!1,l=arguments[1],p=l;return new a(function(g){return s.subscribe({next:function(y){var w=!c;if(c=!0,!w||i)try{p=o(p,y)}catch(C){return g.error(C)}else p=y},error:function(y){g.error(y)},complete:function(){if(!c&&!i)return g.error(new TypeError("Cannot reduce an empty sequence"));g.next(p),g.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=Nt(this);return new c(function(l){var p,g=0;function y(w){p=w.subscribe({next:function(C){l.next(C)},error:function(C){l.error(C)},complete:function(){g===a.length?(p=void 0,l.complete()):y(c.from(a[g++]))}})}return y(o),function(){p&&(p.unsubscribe(),p=void 0)}})},t.flatMap=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=Nt(this);return new a(function(i){var c=[],l=s.subscribe({next:function(g){if(o)try{g=o(g)}catch(w){return i.error(w)}var y=a.from(g).subscribe({next:function(w){i.next(w)},error:function(w){i.error(w)},complete:function(){var w=c.indexOf(y);w>=0&&c.splice(w,1),p()}});c.push(y)},error:function(g){i.error(g)},complete:function(){p()}});function p(){l.closed&&c.length===0&&i.complete()}return function(){c.forEach(function(g){return g.unsubscribe()}),l.unsubscribe()}})},t[hr]=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,hr);if(a){var i=a.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return xs(i)&&i.constructor===s?i:new s(function(c){return i.subscribe(c)})}if(Ir("iterator")&&(a=Qt(o,gs),a))return new s(function(c){Ut(function(){if(!c.closed){for(var l=ps(a.call(o)),p;!(p=l()).done;){var g=p.value;if(c.next(g),c.closed)return}c.complete()}})});if(Array.isArray(o))return new s(function(c){Ut(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){Ut(function(){if(!c.closed){for(var l=0;l<s.length;++l)if(c.next(s[l]),c.closed)return;c.complete()}})})},Cr(e,null,[{key:Un,get:function(){return this}}]),e})();_r()&&Object.defineProperty(ce,Symbol("extensions"),{value:{symbol:hr,hostReportError:gt},configurable:!0});function vs(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 pt;typeof self<"u"?pt=self:typeof window<"u"?pt=window:typeof global<"u"?pt=global:typeof module<"u"?pt=module:pt=Function("return this")();vs(pt);var dn=ce.prototype,un="@@observable";dn[un]||(dn[un]=function(){return this});function js(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 Bn(58,s)}return e}function ks(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 Ss(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName=typeof t.query!="string"?ds(t.query)||void 0:""),t}var Ns=Symbol.for("apollo.deprecations"),Cs=pr,_s=new Nr;function Is(e){return Cs[Ns]||(_s.getValue()||[]).includes(e)}function Fs(e,t){Is(e)||t()}function fn(e,t){return t?t(e):ce.of()}function Ct(e){return typeof e=="function"?new Hn(e):e}function qt(e){return e.request.length<=1}var Hn=(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(Ct).reduce(function(r,o){return r.concat(o)})},e.split=function(t,r,o){var s=Ct(r),a=Ct(o||new e(fn)),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(ks(r.context,Ss(js(r))))||ce.of()},e.concat=function(t,r){var o=Ct(t);if(qt(o))return globalThis.__DEV__!==!1&&sr.warn(47,o),o;var s=Ct(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(fn)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(t,r){throw Bn(48)},e.prototype.onError=function(t,r){if(globalThis.__DEV__!==!1&&Fs("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 Ps(e){return new Hn(function(t,r){var o=ss(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 Es=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 oe.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 oe.isAxiosError(s)?console.error("Error fetching token:",s.response||s.message):console.error("Unexpected error:",s),null}},Ts="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Os=Jt.createHttpLink({uri:`${Ts}`}),As=Ps(async(e,{headers:t})=>{const r=await Es();return{headers:{...t,authorization:`Bearer ${r}`}}}),$s=new Jt.ApolloClient({link:As.concat(Os),cache:new Jt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),Ls=e=>{const{tanyaConfig:t}=e;return n.jsx(Jt.ApolloProvider,{client:$s,children:n.jsx(Vo,{children:n.jsx(ns,{tanyaConfig:t})})})};function zs(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 Yn=Object.freeze({left:0,top:0,width:16,height:16}),Xt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Pr=Object.freeze({...Yn,...Xt}),xr=Object.freeze({...Pr,body:"",hidden:!1});function Ds(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 mn(e,t){const r=Ds(e,t);for(const o in xr)o in Xt?o in e&&!(o in r)&&(r[o]=Xt[o]):o in t?r[o]=t[o]:o in e&&(r[o]=e[o]);return r}function Ms(e,t,r){const o=e.icons,s=e.aliases||Object.create(null);let a={};function i(c){a=mn(o[c]||s[c],a)}return i(t),r.forEach(i),mn(e,a)}function Jn(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=zs(e);for(const s in o){const a=o[s];a&&(t(s,Ms(e,s,a)),r.push(s))}return r}const Bs={provider:"",aliases:{},not_found:{},...Yn};function lr(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Kn(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,Bs))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 pn=Object.create(null);function qs(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function xt(e,t){const r=pn[e]||(pn[e]=Object.create(null));return r[t]||(r[t]=qs(e,t))}function Wn(e,t){return Kn(t)?Jn(t,(r,o)=>{o?e.icons[r]=o:e.missing.add(r)}):[]}function Us(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}const Qn=/^[a-z0-9]+(-[a-z0-9]+)*$/,Gt=(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(),p={provider:s.length>0?s[0]:o,prefix:l,name:c};return t&&!Rt(p)?null:p}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 Tt=!1;function Xn(e){return typeof e=="boolean"&&(Tt=e),Tt}function hn(e){const t=typeof e=="string"?Gt(e,!0,Tt):e;if(t){const r=xt(t.provider,t.prefix),o=t.name;return r.icons[o]||(r.missing.has(o)?null:void 0)}}function Rs(e,t){const r=Gt(e,!0,Tt);if(!r)return!1;const o=xt(r.provider,r.prefix);return t?Us(o,r.name,t):(o.missing.add(r.name),!0)}function Vs(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Tt&&!t&&!e.prefix){let s=!1;return Kn(e)&&(e.prefix="",Jn(e,(a,i)=>{Rs(a,i)&&(s=!0)})),s}const r=e.prefix;if(!Rt({prefix:r,name:"a"}))return!1;const o=xt(t,r);return!!Wn(o,e)}const Gn=Object.freeze({width:null,height:null}),Zn=Object.freeze({...Gn,...Xt}),Hs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ys=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function gn(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(Hs);if(o===null||!o.length)return e;const s=[];let a=o.shift(),i=Ys.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 Js(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 Ks(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Ws(e,t,r){const o=Js(e);return Ks(o.defs,t+o.content+r)}const Qs=e=>e==="unset"||e==="undefined"||e==="none";function Xs(e,t){const r={...Pr,...e},o={...Zn,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let a=r.body;[r,o].forEach(P=>{const j=[],_=P.hFlip,Q=P.vFlip;let V=P.rotate;_?Q?V+=2:(j.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),j.push("scale(-1 1)"),s.top=s.left=0):Q&&(j.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),j.push("scale(1 -1)"),s.top=s.left=0);let K;switch(V<0&&(V-=Math.floor(V/4)*4),V=V%4,V){case 1:K=s.height/2+s.top,j.unshift("rotate(90 "+K.toString()+" "+K.toString()+")");break;case 2:j.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:K=s.width/2+s.left,j.unshift("rotate(-90 "+K.toString()+" "+K.toString()+")");break}V%2===1&&(s.left!==s.top&&(K=s.left,s.left=s.top,s.top=K),s.width!==s.height&&(K=s.width,s.width=s.height,s.height=K)),j.length&&(a=Ws(a,'<g transform="'+j.join(" ")+'">',"</g>"))});const i=o.width,c=o.height,l=s.width,p=s.height;let g,y;i===null?(y=c===null?"1em":c==="auto"?p:c,g=gn(y,l/p)):(g=i==="auto"?l:i,y=c===null?gn(g,p/l):c==="auto"?p:c);const w={},C=(P,j)=>{Qs(j)||(w[P]=j.toString())};C("width",g),C("height",y);const S=[s.left,s.top,l,p];return w.viewBox=S.join(" "),{attributes:w,viewBox:S,body:a}}const Gs=/\sid="(\S+)"/g,Zs="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let ea=0;function ta(e,t=Zs){const r=[];let o;for(;o=Gs.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+(ea++).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 ra(e,t){wr[e]=t}function yr(e){return wr[e]||wr[""]}function Er(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 Tr=Object.create(null),_t=["https://api.simplesvg.com","https://api.unisvg.com"],Vt=[];for(;_t.length>0;)_t.length===1||Math.random()>.5?Vt.push(_t.shift()):Vt.push(_t.pop());Tr[""]=Er({resources:["https://api.iconify.design"].concat(Vt)});function na(e,t){const r=Er(t);return r===null?!1:(Tr[e]=r,!0)}function Or(e){return Tr[e]}const oa=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let xn=oa();function sa(e,t){const r=Or(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 aa(e){return e===404}const ia=(e,t,r)=>{const o=[],s=sa(e,t),a="icons";let i={type:a,provider:e,prefix:t,icons:[]},c=0;return r.forEach((l,p)=>{c+=l.length+1,c>=s&&p>0&&(o.push(i),i={type:a,provider:e,prefix:t,icons:[]},c=l.length),i.icons.push(l)}),o.push(i),o};function la(e){if(typeof e=="string"){const t=Or(e);if(t)return t.path}return"/"}const ca=(e,t,r)=>{if(!xn){r("abort",424);return}let o=la(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;xn(e+o).then(a=>{const i=a.status;if(i!==200){setTimeout(()=>{r(aa(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)})},da={prepare:ia,send:ca};function eo(e,t){e.forEach(r=>{const o=r.loaderCallbacks;o&&(r.loaderCallbacks=o.filter(s=>s.id!==t))})}function ua(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 p=l.name;if(e.icons[p])i.loaded.push({provider:o,prefix:s,name:p});else if(e.missing.has(p))i.missing.push({provider:o,prefix:s,name:p});else return r=!0,!0;return!1}),i.pending.length!==c&&(r||eo([e],a.id),a.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),a.abort))})}))}let fa=0;function ma(e,t,r){const o=fa++,s=eo.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 pa(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)),p=l[i]||(l[i]=xt(a,i));let g;c in p.icons?g=t.loaded:i===""||p.missing.has(c)?g=t.missing:g=t.pending;const y={provider:a,prefix:i,name:c};g.push(y)}),t}function ha(e,t=!0,r=!1){const o=[];return e.forEach(s=>{const a=typeof s=="string"?Gt(s,t,r):s;a&&o.push(a)}),o}const ga={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function xa(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 D=Math.floor(Math.random()*I.length);i.push(I[D]),I=I.slice(0,D).concat(I.slice(D+1))}i=i.concat(I)}else i=e.resources.slice(a).concat(e.resources.slice(0,a));const c=Date.now();let l="pending",p=0,g,y=null,w=[],C=[];typeof o=="function"&&C.push(o);function S(){y&&(clearTimeout(y),y=null)}function P(){l==="pending"&&(l="aborted"),S(),w.forEach(I=>{I.status==="pending"&&(I.status="aborted")}),w=[]}function j(I,D){D&&(C=[]),typeof I=="function"&&C.push(I)}function _(){return{startTime:c,payload:t,status:l,queriesSent:p,queriesPending:w.length,subscribe:j,abort:P}}function Q(){l="failed",C.forEach(I=>{I(void 0,g)})}function V(){w.forEach(I=>{I.status==="pending"&&(I.status="aborted")}),w=[]}function K(I,D,pe){const ee=D!=="success";switch(w=w.filter(se=>se!==I),l){case"pending":break;case"failed":if(ee||!e.dataAfterTimeout)return;break;default:return}if(D==="abort"){g=pe,Q();return}if(ee){g=pe,w.length||(i.length?be():Q());return}if(S(),V(),!e.random){const se=e.resources.indexOf(I.resource);se!==-1&&se!==e.index&&(e.index=se)}l="completed",C.forEach(se=>{se(pe)})}function be(){if(l!=="pending")return;S();const I=i.shift();if(I===void 0){if(w.length){y=setTimeout(()=>{S(),l==="pending"&&(V(),Q())},e.timeout);return}Q();return}const D={status:"pending",resource:I,callback:(pe,ee)=>{K(D,pe,ee)}};w.push(D),p++,y=setTimeout(be,e.rotate),r(I,t,D.callback)}return setTimeout(be),_}function to(e){const t={...ga,...e};let r=[];function o(){r=r.filter(c=>c().status==="pending")}function s(c,l,p){const g=xa(t,c,l,(y,w)=>{o(),p&&p(y,w)});return r.push(g),g}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 wn(){}const cr=Object.create(null);function wa(e){if(!cr[e]){const t=Or(e);if(!t)return;const r=to(t),o={config:t,redundancy:r};cr[e]=o}return cr[e]}function ya(e,t,r){let o,s;if(typeof e=="string"){const a=yr(e);if(!a)return r(void 0,424),wn;s=a.send;const i=wa(e);i&&(o=i.redundancy)}else{const a=Er(e);if(a){o=to(a);const i=e.resources?e.resources[0]:"",c=yr(i);c&&(s=c.send)}}return!o||!s?(r(void 0,424),wn):o.query(t,s,r)().abort}function yn(){}function ba(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,ua(e)}))}function va(e){const t=[],r=[];return e.forEach(o=>{(o.match(Qn)?t:r).push(o)}),{valid:t,invalid:r}}function It(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(!Wn(e,r).length){o();return}}catch(s){console.error(s)}o(),ba(e)}function bn(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function ja(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)){bn(e.loadIcons(s,o,r),g=>{It(e,s,g)});return}if(a){s.forEach(g=>{const y=a(g,o,r);bn(y,w=>{const C=w?{prefix:o,icons:{[g]:w}}:null;It(e,[g],C)})});return}const{valid:i,invalid:c}=va(s);if(c.length&&It(e,c,null),!i.length)return;const l=o.match(Qn)?yr(r):null;if(!l){It(e,i,null);return}l.prepare(r,o,i).forEach(g=>{ya(r,g,y=>{It(e,g.icons,y)})})}))}const ka=(e,t)=>{const r=ha(e,!0,Xn()),o=pa(r);if(!o.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(o.loaded,o.missing,o.pending,yn)}),()=>{l=!1}}const s=Object.create(null),a=[];let i,c;return o.pending.forEach(l=>{const{provider:p,prefix:g}=l;if(g===c&&p===i)return;i=p,c=g,a.push(xt(p,g));const y=s[p]||(s[p]=Object.create(null));y[g]||(y[g]=[])}),o.pending.forEach(l=>{const{provider:p,prefix:g,name:y}=l,w=xt(p,g),C=w.pendingIcons||(w.pendingIcons=new Set);C.has(y)||(C.add(y),s[p][g].push(y))}),a.forEach(l=>{const p=s[l.provider][l.prefix];p.length&&ja(l,p)}),t?ma(t,o,a):yn};function Sa(e,t){const r={...e};for(const o in t){const s=t[o],a=typeof s;o in Gn?(s===null||s&&(a==="string"||a==="number"))&&(r[o]=s):a===typeof r[o]&&(r[o]=o==="rotate"?s%4:s)}return r}const Na=/[\s,]+/;function Ca(e,t){t.split(Na).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function _a(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 Ia(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 Fa(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Pa(e){return"data:image/svg+xml,"+Fa(e)}function Ea(e){return'url("'+Pa(e)+'")'}let Ft;function Ta(){try{Ft=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ft=null}}function Oa(e){return Ft===void 0&&Ta(),Ft?Ft.createHTML(e):e}const ro={...Zn,inline:!1},Aa={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},$a={display:"inline-block"},br={backgroundColor:"currentColor"},no={backgroundColor:"transparent"},vn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:br,mask:br,background:no};for(const e in jn){const t=jn[e];for(const r in vn)t[e+r]=vn[r]}const La={...ro,inline:!0};function kn(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const za=(e,t,r)=>{const o=t.inline?La:ro,s=Sa(o,t),a=t.mode||"svg",i={},c=t.style||{},l={...a==="svg"?Aa:{}};if(r){const j=Gt(r,!1,!0);if(j){const _=["iconify"],Q=["provider","prefix"];for(const V of Q)j[V]&&_.push("iconify--"+j[V]);l.className=_.join(" ")}}for(let j in t){const _=t[j];if(_!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":l.ref=_;break;case"className":l[j]=(l[j]?l[j]+" ":"")+_;break;case"inline":case"hFlip":case"vFlip":s[j]=_===!0||_==="true"||_===1;break;case"flip":typeof _=="string"&&Ca(s,_);break;case"color":i.color=_;break;case"rotate":typeof _=="string"?s[j]=_a(_):typeof _=="number"&&(s[j]=_);break;case"ariaHidden":case"aria-hidden":_!==!0&&_!=="true"&&delete l["aria-hidden"];break;default:o[j]===void 0&&(l[j]=_)}}const p=Xs(e,s),g=p.attributes;if(s.inline&&(i.verticalAlign="-0.125em"),a==="svg"){l.style={...i,...c},Object.assign(l,g);let j=0,_=t.id;return typeof _=="string"&&(_=_.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:Oa(ta(p.body,_?()=>_+"ID"+j++:"iconifyReact"))},h.createElement("svg",l)}const{body:y,width:w,height:C}=e,S=a==="mask"||(a==="bg"?!1:y.indexOf("currentColor")!==-1),P=Ia(y,{...g,width:w+"",height:C+""});return l.style={...i,"--svg":Ea(P),width:kn(g.width),height:kn(g.height),...$a,...S?br:no,...c},h.createElement("span",l)};Xn(!0);ra("",da);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"||!Vs(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;na(r,s)||console.error(o)}catch{console.error(o)}}}}function oo(e){const[t,r]=h.useState(!!e.ssr),[o,s]=h.useState({});function a(C){if(C){const S=e.icon;if(typeof S=="object")return{name:"",data:S};const P=hn(S);if(P)return{name:S,data:P}}return{name:""}}const[i,c]=h.useState(a(!!e.ssr));function l(){const C=o.callback;C&&(C(),s({}))}function p(C){if(JSON.stringify(i)!==JSON.stringify(C))return l(),c(C),!0}function g(){var C;const S=e.icon;if(typeof S=="object"){p({name:"",data:S});return}const P=hn(S);if(p({name:S,data:P}))if(P===void 0){const j=ka([S],g);s({callback:j})}else P&&((C=e.onLoad)===null||C===void 0||C.call(e,S))}h.useEffect(()=>(r(!0),l),[]),h.useEffect(()=>{t&&g()},[e.icon,t]);const{name:y,data:w}=i;return w?za({...Pr,...w},e,y):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const ne=h.forwardRef((e,t)=>oo({...e,_ref:t}));h.forwardRef((e,t)=>oo({inline:!0,...e,_ref:t}));const ht="USD",Da=(e,t=ht)=>{const r=(e==null?void 0:e.prices)??[];if(!r.length)return null;const o=i=>{var p,g;const c=i.find(y=>{var w;return!!((w=y.discounted)!=null&&w.value)});if(c)return{cent:c.discounted.value.centAmount,cur:c.discounted.value.currencyCode,regularCent:(p=c.value)==null?void 0:p.centAmount};const l=(g=i[0])==null?void 0:g.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},Ma=(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},Ba=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}},ft=e=>Ma((e==null?void 0:e.attributesRaw)??[],"color"),mt=e=>Ba((e==null?void 0:e.attributesRaw)??[]).sizeLabel,Ye=e=>e.charAt(0).toUpperCase()+e.slice(1),Sn={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"}},et=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},so=e=>e==null?void 0:e.masterVariant,Nn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ht=e=>{const t=so(e);return t?[t,...Nn(e)]:Nn(e)},qa=(e,t=0)=>Ht(e)[t],Ua=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},Cn=(e,t)=>{var r,o,s,a,i,c,l,p;return Ua(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)||((p=(l=(c=(i=e.image_groups)==null?void 0:i[0])==null?void 0:c.images)==null?void 0:l[0])==null?void 0:p.link)||""},_n=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Yt=e=>{var a,i,c,l,p,g;const t=e?Da(e,ht):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=((g=(p=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:p.value)==null?void 0:g.currencyCode)??ht;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},In=(e,t)=>{const{amount:r}=Yt(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},Ra=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)||""},Va=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)||""},Ha=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)||""},Fn=20,Ya=({open:e,onClose:t,product:r,index:o,addresses:s,addressLoading:a,variationAttributes:i,customerId:c})=>{const g=Ht(r),y=Math.min(Math.max(0,o||0),Math.max(0,g.length-1)),[w,C]=h.useState([]),[S,P]=h.useState(0),[j,_]=h.useState([]);h.useEffect(()=>{if(r!=null&&r.variants){const d=Q(r.variants,r.imageGroups,i);C(d)}},[r]);const Q=(d,f,u)=>{const{colorMap:x,sizeMap:v}=V(u),A={};f==null||f.forEach(F=>{var te,we,Te;const z=(te=F.variationAttributes)==null?void 0:te.find(He=>He.id==="color"),T=(Te=(we=z==null?void 0:z.values)==null?void 0:we[0])==null?void 0:Te.value;T&&(A[T]||(A[T]={}),A[T][F.viewType]=F.images)});const R=d.reduce((F,z)=>{const T=z.variationValues.color,te=z.variationValues.size;return F[T]||(F[T]={color:T,name:x[T]||T,images:A[T]||{},variants:[]}),F[T].variants.push({size:te,name:v[te]||te,...z}),F},{});return Object.values(R).sort((F,z)=>{const T=F.colorName||F.color||"",te=z.colorName||z.color||"";return T.localeCompare(te)}).map(F=>({...F,variants:F.variants.sort((z,T)=>Number(z.size)-Number(T.size))}))},V=d=>{const f={},u={};return d==null||d.forEach(x=>{x.id==="color"&&x.values.forEach(v=>{f[v.value]=v.name}),x.id==="size"&&x.values.forEach(v=>{u[v.value]=v.name})}),{colorMap:f,sizeMap:u}},K=g.length,[be,I]=h.useState(y),[D,pe]=h.useState(null),[ee,se]=h.useState(null),st=h.useRef(null),Be=h.useRef(null),k=qa(r,be),[U,M]=h.useState(""),[Oe,wt]=h.useState(""),[Ge,qe]=h.useState(!1),[ve,Ae]=h.useState(!1),[Fe,$]=h.useState(!1),[Pe,$e]=h.useState(""),[he,Ee]=h.useState(!1),[ae,m]=h.useState(null),[B,E]=h.useState([]),[X,W]=h.useState([]),[O,de]=h.useState([]),[H,q]=h.useState(!1),[G,Le]=h.useState(),[Ve,je]=h.useState(!0),[Z,ue]=h.useState(!1),[ke,fe]=h.useState(!1),[b,Ne]=h.useState({id:"001"}),[L,Y]=h.useState(!1),[Ce,ge]=h.useState(!1),[Ue,Ot]=h.useState("card"),[ie,Se]=h.useState(!1),[yt,N]=h.useState(!1),[xe,me]=h.useState(!1),[at,ao]=h.useState(null),[At,Ar]=h.useState(null),[Zt,$r]=h.useState(""),[Lr,zr]=h.useState(!1),[it,io]=h.useState(r==null?void 0:r.id),$t=h.useRef(null);h.useEffect(()=>{const d=Ht(r),f=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));I(f);const u=so(r),x=ft(u),v=mt(u);st.current=x||null,Be.current=v||null,pe(x||null),se(v||null)},[o,r]),h.useEffect(()=>{$t.current&&($t.current.scrollTop=$t.current.scrollHeight)},[B,H,Z,ke,L,Ce,ie,yt,xe,Ge,ve]);const bt="var(--tanya)",Dr="var(--tanya-contrast)",J="#804c9e",er=J,lo=()=>{console.log("AgenticShopping feedback:",{rating:At,comment:Zt}),zr(!0)},co=()=>{Ar(null),$r(""),zr(!0)},Mr=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??at;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(ne,{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})]}),!Lr&&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:()=>Ar(x),className:"p-0.5",children:n.jsx(ne,{icon:At&&At>=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:Zt,onChange:x=>$r(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:co,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:lo,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:bt},disabled:!At&&!Zt.trim(),children:"Submit"})]})]}),Lr&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},uo=async()=>{try{de(s);const d=JSON.parse(sessionStorage.getItem("customerData")||"{}");let f=(d==null?void 0:d.basketId)||localStorage.getItem(Pt);if(!f){const u=await ot(),x="Bearer "+(u==null?void 0:u.access_token),v=await jr(x);f=(v==null?void 0:v.basket_id)||v.basketId}fo(f),M(f)}catch(d){console.error("Error fetching addresses:",d)}},fo=async d=>{const f=await es(d);console.log(f,"shipping methods"),_(f)};console.log(U,"the basket id");const vt=(d,f)=>{E(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:f}])},Br=(d,f)=>{E(u=>u.map(x=>x.response==="__CARD__"?{...x,response:"__SNAPSHOT__",snapshotStage:d??x.snapshotStage,snapshotPayload:f??x.snapshotPayload}:x))},mo=()=>{E(d=>d.filter(f=>!(f.query===""&&f.response!=="__SNAPSHOT__"&&f.response!=="__TEXT__")))},Lt=()=>{N(!1),q(!1),fe(!1),ge(!1),ue(!1),Y(!1),Se(!1),me(!1),Ee(!1),m(null),mo(),qe(!1),Ae(!1)},po=()=>{q(!1),ue(!1),fe(!1),Ne("standard"),Y(!1),ge(!1),Ot("card"),Se(!1),N(!1),me(!1),je(!0),m(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")},zt=h.useMemo(()=>Ht(r).map((f,u)=>({index:u,variant:f,images:((f==null?void 0:f.images)||[]).map(x=>(x==null?void 0:x.url)||"").filter(Boolean)})),[r]),jt=h.useMemo(()=>zt.length?!!((D||void 0)&&(ee||void 0)):!1,[zt,D,ee,k]),ho=Fe||he||!jt,kt=d=>{const f=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(f)&&f>0?f:1},qr=d=>{const f=kt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(In(r,k)*f)},Ur=d=>{const f=ae,u=Yt(k),x=d||(f==null?void 0:f.currency)||u.currency||ht,v=qr(f),A=+(v*.08).toFixed(2),R=(b==null?void 0:b.price)||0;return{product_total:v,tax:A,shipping_fee:R,currency:x}},tr=async(d,f,u)=>{Br(),po(),$(!0),Ee(!0),qe(!1),Ae(!1);const x=X.slice(-Fn);try{const v=await ur(null,null);if(!v)throw new Error("Failed to fetch token");const A=localStorage.getItem("isLoggedIn"),F=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(A||!0),userId:String(c||new Date().getTime())}).toString()}`,z=await fetch(`${F}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({flowId:"MTMI0P4LC6",flowAliasId:"BCUA138F2Q",input:{instruction:`Use SKU ${f}. Currency is USD. ${d}`,metadata:{productId:(r==null?void 0:r.id)??null,skuId:f??null,variantIndex:u},context:x}})});if(!z.body)throw new Error("Readable stream not supported");const T=z.body.getReader(),te=new TextDecoder;let we="",Te="",He="";for(;;){const{done:ye,value:Ze}=await T.read();if(ye)break;we+=te.decode(Ze,{stream:!0});const lt=we.split(`
17
- `);we=lt.pop()||"";for(const ct of lt){if(!ct.startsWith("data:"))continue;const dt=ct.slice(5).trim();try{const Ie=JSON.parse(dt),le=Ie.index,ze=Ie.data;le===0?Te=String(ze??""):le===1&&(He=String(ze??""))}catch(Ie){console.error("Error parsing JSON chunk:",Ie)}}}let _e=null;if(Te){const ye=String(Te).replace(/\\n/g,"").trim();if(ye.startsWith("{")&&ye.endsWith("}"))try{_e=JSON.parse(ye),_e.product_id=f,_e.sku_id=f,localStorage.setItem("agentic_order",JSON.stringify(_e))}catch(Ze){console.log(Ze)}}m(_e),_e&&E(ye=>[...ye,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:_e}}]),W(ye=>[...ye,{userQuery:d,mainResponse:Te||"",keywords:He||""}].slice(-Fn))}catch(v){console.error("Error sending message to Tanya:",v),Ee(!1)}finally{$(!1)}},Rr=async d=>{if(he||Fe||!jt)return;const f=Pe.trim();if(!f)return;E(x=>[...x,{query:f,response:""}]),$e(""),wt(f);const u=it||"";if(K<=1){if(u){tr(f,u,be);return}Ae(!0),Ee(!0);return}u?(qe(!0),Ee(!0)):(Ae(!0),Ee(!0))},go=()=>{const d=it;d&&tr(Oe,d,be)},xo=()=>{qe(!1),Ae(!0),Ee(!0)},wo=()=>{if(!it)return;tr(Oe,it,be)},yo=async()=>{q(!0),fe(!1),ge(!1),N(!1),ue(!1),Y(!1),Se(!1),me(!1),await uo(),console.log("calling"),Br("initial",{extractedDetails:ae??void 0})},bo=()=>{if(!G)return;const d=O.find(f=>String(f.addressId??f.id)===G)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),ue(!0),fe(!0),Y(!1),ge(!1),Se(!1),N(!1),me(!1),vt("address",d))},vo=()=>{ue(!1),fe(!1),Y(!1),ge(!1),Se(!1),N(!1),me(!1),localStorage.removeItem("agentic_order_address")},jo=()=>{b.id&&(localStorage.setItem("agentic_order_delivery",b.id),Y(!0),ge(!0),Se(!1),N(!1),me(!1),vt("delivery",{method:b.id,...b}))},Vr=()=>{fe(!1),Y(!1),ge(!1),Se(!1),N(!1),me(!1),Ee(!1),Lt(),E(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=()=>{Y(!1),ge(!1),Se(!1),N(!1),me(!1),localStorage.removeItem("agentic_order_delivery")},So=()=>{Ue&&(localStorage.setItem("agentic_order_payment",Ue),Se(!0),N(!0),me(!1),vt("payment",{method:Ue}))},No=()=>{ge(!1),Se(!1),N(!1),me(!1),Ee(!1),Lt(),E(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"}}])},Co=()=>{Se(!1),N(!1),me(!1),localStorage.removeItem("agentic_order_payment")},_o=async()=>{try{$(!0);const d=ae||{},f=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),x=localStorage.getItem("agentic_order_payment")||"card",{product_total:v,tax:A,shipping_fee:R,currency:F}=Ur(),z=c,T=(f==null?void 0:f.addressId)||(f==null?void 0:f.id)||void 0,te=u??"GROUND",we="card-visa",Te=it,He=(r==null?void 0:r.id)||"",_e=kt(d),ye=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(v*100),ct={shopper_id:z,shipping_address_id:T,shipping_method_id:te,payment_method_id:we,sku:Te,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:He,quantity:_e,max_price_minor:ye,currency:F,instruction_text:Oe};if(console.log(z,T,"the selected ids"),!z||!T){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:z,shippingAddressId:T}),alert("Missing customer or address information. Please re-select address and try again."),$(!1);return}const{serverUrl:dt}=Ke(),Ie=await fetch(`${dt}api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ct)});if(!Ie.ok){const rr=await Ie.text().catch(()=>"");console.error("intent-mandate failed",Ie.status,rr),alert("Something went wrong while saving your smart order. Please try again."),$(!1);return}const le=await Ie.json().catch(()=>null);console.log("intent-mandate success:",le);const ze=(le==null?void 0:le.intent_mandate_id)||(le==null?void 0:le.intent_mandateId)||(le==null?void 0:le.key)||null;ze&&ao(ze);const St={...d,address:f,delivery:u,payment:x,summary:{product_total:v,tax:A,shipping_fee:R,currency:F},intent_mandate_id:ze};localStorage.setItem("agentic_order_final",JSON.stringify(St)),me(!0),je(!1),vt("final",St),vt("success",{intentMandateId:ze}),Lt()}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{$(!1)}},Hr=()=>{Lt(),E(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"}}])},Io=({selectedIndex:d})=>{var T;const f=((T=w[d])==null?void 0:T.images.large[0].link)||Cn(r,k),u=_n(r),x=it||"",v=ft(k)||"",A=mt(k)||"",{amount:R}=Yt(k),F=!!(r!=null&&r.id),z=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:f?n.jsx("img",{src:f,alt:u,className:"object-contain w-full h-full"}):n.jsx(ne,{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}`,v&&`Color: ${v}`,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&&!z&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},Yr=({showSubmit:d=!0})=>{const f={};zt.map(x=>ft(x.variant)).filter(x=>!!x&&!f[x]&&(f[x]=!0));const u={};return zt.map(x=>mt(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 :"}),D&&n.jsx("div",{className:"text-sm text-gray-600",children:D})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:w.map((x,v)=>{const A=x.name,R=D===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
- ${R?"border-2 border-[#804c9e]":"border-gray-300"}`,children:n.jsx("button",{onClick:()=>{pe(A),se(null),I(null),P(v)},className:"w-full h-20 flex items-center justify-center overflow-hidden p-0",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)})})]}),D&&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 :"}),ee&&n.jsx("div",{className:"text-sm text-gray-600",children:ee})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(()=>{const x=w.find(v=>v.name===D);return x?x.variants.map((v,A)=>{const R=v.name,F=ee===R;return n.jsx("button",{onClick:()=>{se(R),I(A),io(v.productId)},className:`px-4 py-2 rounded-md border text-sm ${F?"border-2 border-[#804c9e] font-semibold":"border-gray-300"}`,title:R,children:R},`size-${R}`)}):null})()})]}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:wo,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:J},disabled:!jt,children:"Submit"})})]})},Jr=(d,f=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||ae;if(!u)return null;const x=kt(u),{currency:v}=Yt(k),A=In(r,k),R=Number((u==null?void 0:u.max_price_minor)??0),z=Number.isFinite(R)&&R>0?+(R/100):+(A*x),T=(u==null?void 0:u.currency)||v||ht,te=k!=null&&k.sku?k.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:Dr},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:te}),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:et(z,T)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[ft(k)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",ft(k)]}),mt(k)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",mt(k)]}),(k==null?void 0:k.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",k.sku]})]})]}),!f&&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:Dr},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:yo,disabled:H,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 ${H?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:J},children:[n.jsx(ne,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Hr,disabled:H,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${H?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:J,color:J},children:[n.jsx(ne,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Kr=(d,f=!0)=>{var dt,Ie,le,ze,St;const u=d||{},x=((dt=u==null?void 0:u.summary)==null?void 0:dt.currency)||(ae==null?void 0:ae.currency)||ht,v=Cn(r,k),A=_n(r),R=k!=null&&k.sku?k.sku:(r==null?void 0:r.id)??(ae==null?void 0:ae.product_id),F=(k==null?void 0:k.sku)??Ra(r),z=ft(k)||Va(r),T=mt(k)||Ha(r),te=kt(u),we=((Ie=u==null?void 0:u.summary)==null?void 0:Ie.product_total)!=null?+u.summary.product_total:qr(u),Te=te>0?+(we/te).toFixed(2):0,He=we,_e=((le=u==null?void 0:u.summary)==null?void 0:le.tax)??+(we*.08).toFixed(2),ye=((ze=u==null?void 0:u.summary)==null?void 0:ze.shipping_fee)??((b==null?void 0:b.price)||0),Ze=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(rr=>Ye(String(rr))).join(", "):"—",lt=(u==null?void 0:u.payment)||"card",ct=lt==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Ye(lt)});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(ne,{icon:"mdi:receipt-text-check-outline",width:"24",color:bt}),"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:v?n.jsx("img",{src:v,alt:A,className:"w-full h-full object-contain"}):n.jsx(ne,{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:"})," ",R??"—"]}),(F||z||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,"  "]}),z&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",z,"  "]}),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:et(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:te})]}),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:et(He,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:Ze})]}),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:ct})]}),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&&((St=Sn[u.delivery])==null?void 0:St.name)||"—"})]})]}),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:et(we,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:et(_e,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:et(ye,x)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:er},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:et(we+_e+ye,x)})]})]}),!f&&n.jsxs("div",{className:"px-6 pb-5",children:[!xe&&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?"}),xe&&Mr({intentMandateId:at}),Ve&&!xe&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:_o,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:J},children:"Confirm"}),n.jsx("button",{onClick:Hr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:er,color:er},children:"Cancel"})]})]})]})},Fo=d=>{if(!d)return null;const f=[d.addressLine1,d.addressLine2,d.street,[d.city,d.state,d.postalCode].filter(Boolean).join(", "),d.country].filter(u=>!!u).map(u=>Ye(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:J},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(ne,{icon:"mdi:home-map-marker",width:"20",color:bt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f})]})})},Po=d=>{const f=d==null?void 0:d.method,u=f?Sn[f]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:J},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(ne,{icon:"mdi:truck-delivery",width:"20",color:bt}),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(ne,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},Eo=d=>{const f=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:J},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(ne,{icon:"mdi:credit-card-outline",width:"20",color:bt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Payment Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820   Exp: 12/26"]}):Ye(f)})]})})},To=(d,f)=>{const u=d.snapshotStage;if(!u||u==="address"&&H||u==="delivery"&&ke||u==="payment"&&Ce||u==="final"&&yt)return null;switch(u){case"initial":return Jr(d.snapshotPayload,!f);case"address":return Fo(d.snapshotPayload);case"delivery":return Po(d.snapshotPayload);case"payment":return Eo(d.snapshotPayload);case"final":return Kr(d.snapshotPayload,!f);case"success":return Mr(d.snapshotPayload);default:return null}};return $o.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:J},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(ne,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:$t,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(Io,{selectedIndex:S}),K>1&&n.jsx(Yr,{showSubmit:!1}),B.map((d,f)=>{var v;const u=f===B.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:J},children:d.query})}),d.response==="__TEXT__"&&((v=d.snapshotPayload)==null?void 0:v.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:J,margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&Ge&&K>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:D||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:ee||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:go,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:J},children:"Yes"}),n.jsx("button",{onClick:xo,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:J,color:J},children:"No, change SKU"})]})]}),u&&ve&&n.jsx(Yr,{showSubmit:!0}),u&&Fe&&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:J,margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text text-white",children:n.jsx("p",{children:"Reading your instruction and setting things up…"})})})}),(x||d.response==="__CARD__")&&(!Fe||!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?To(d,u):Jr(d.snapshotPayload,!1)})]},f)}),H&&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(ne,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),Z&&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"}),!xe&&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 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..."})]}):(O==null?void 0:O.length)>0?n.jsxs("div",{className:`space-y-3 ${Z?"opacity-70":""}`,children:[O.map(d=>{const f=[d.addressLine1,d.addressLine2].filter(Boolean).map(F=>Ye(F||"")).join(" "),u=Ye(d.city||""),x=`${Ye(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,v=Ye(d.country||""),A=String(d.addressId??d.id),R=G===A;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${R?"border-tanya-light":"border-gray-300"} ${Z?"pointer-events-none":""}`,title:Z?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:R,disabled:Z,onChange:()=>Le(A),value:A}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800",children:f||"Address"}),n.jsxs("div",{className:"text-sm text-gray-700",children:[u,n.jsx("br",{}),x,n.jsx("br",{}),v]})]})]},A)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:Vr,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:bo,disabled:Z,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${Z?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:J},children:Z?"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."})]}),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(ne,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),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"}),!xe&&n.jsx("button",{onClick:ko,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 ${L?"opacity-70":""}`,children:j.map(d=>{const f=b.id===d.id;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${f?"border-tanya-light":"border-gray-300"} ${L?"pointer-events-none":""}`,title:L?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:f,disabled:L,onChange:()=>Ne(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:d.name}),n.jsx("div",{className:"text-sm text-gray-700",children:d.description})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:d.price===0?"Free":d.price})]},d.id)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:Vr,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:jo,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:J},children:L?"Delivery Submitted":"Submit Delivery Option"})]})]}),Ce&&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(ne,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),ie&&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"}),!xe&&n.jsx("button",{onClick:Co,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 ${ie?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${Ue==="card"?"border-tanya-light":"border-gray-300"} ${ie?"pointer-events-none":""}`,title:ie?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:Ue==="card",disabled:ie,onChange:()=>Ot("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(ne,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),Ue==="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:No,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:J,color:J},children:"Cancel"}),n.jsx("button",{onClick:So,disabled:ie,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${ie?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:J},children:ie?"Payment Submitted":"Submit Payment Method"})]})]}),yt&&Kr({...ae,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:Ur(ae==null?void 0:ae.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:he?"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:ho,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
- ${jt?"":"placeholder:text-red-400 text-red-500"}`,value:Pe,onKeyDown:d=>{d.key==="Enter"&&!Fe&&!he&&Rr()},onChange:d=>$e(d.target.value)}),n.jsx("button",{type:"submit",disabled:Fe||he,className:"mr-6 font-medium",style:{color:J},onClick:()=>Rr(),children:Fe?n.jsx("div",{className:"m-3 animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottom:"2px solid"}}):n.jsx(ne,{icon:"fluent:send-48-filled",color:J,width:"24",height:"24"})})]})]})})]}),document.body)};exports.AgenticShoppingButton=Ya;exports.TanyaChatbot=Ls;exports.TanyaChatbotProvider=Do;
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:()=>w(!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 ${Ae?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:H,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(z==null?void 0:z.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(m=>n.jsx("button",{onClick:()=>qe(m),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:B===s[m]?"#FFFFFF":"#F3F3F3",borderColor:B===s[m]?"#BBB3DD":""},children:m},m))})]}),_e.map((m,D)=>{var T,G;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:m.query})}),m.response&&m.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:er(m.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:er(m.response)}})}),Oe&&!m.response.includes("Thinking")&&((T=m.products)==null?void 0:T.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"})}),(m==null?void 0:m.products)&&((G=m==null?void 0:m.products)==null?void 0:G.length)>0&&n.jsx(Xo,{chat:m.products,storeDetails:z}),(m==null?void 0:m.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:z.themeDarkColor},children:"Why not explore these inquiries..."}),m.potentialQuestions.split(",").map((W,O)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${z.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>Le(W),style:{backgroundColor:z.tanyaThemeColorLight},children:W},O))]}),(m==null?void 0:m.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:z.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:z.themeDarkColor},children:"• • •"})]})}),(m==null?void 0:m.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:z.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:er(m.secondaryResponse)}}),m.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:z.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:m.productSnapshot.image?n.jsx("img",{src:m.productSnapshot.image,alt:m.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:m.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:m.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(z==null?void 0:z.currency)||"USD"}).format(m.productSnapshot.price):""}),m.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[m.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:()=>k(W=>W.map((O,ue)=>ue===D&&O.productSnapshot?{...O,productSnapshot:{...O.productSnapshot,quantity:Math.max(1,O.productSnapshot.quantity-1)}}:O)),style:{background:"transparent",color:z.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:m.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>k(W=>W.map((O,ue)=>ue===D&&O.productSnapshot?{...O,productSnapshot:{...O.productSnapshot,quantity:O.productSnapshot.quantity+1}}:O)),style:{background:"transparent",color:z.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{se(te(m.productSnapshot),m.productSnapshot.quantity)},disabled:I,className:"px-4 py-2 rounded-full font-medium",style:{background:z.tanyaThemeColor,color:(z==null?void 0:z.tanyaThemeContrastColor)||"#fff",opacity:I?.8:1},children:I?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},D)})]}),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:V,autoFocus:!0,onChange:m=>ce(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!R&&Le()}}),n.jsx("button",{type:"submit",disabled:R,className:"p-3",onClick:()=>Le(),children:R?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:z.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(es,{addToCartPwa:r})]})]})]})]})})};var dr=function(e,t){return dr=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])},dr(e,t)};function rs(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");dr(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 ns(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 tr="Invariant Violation",tn=Object.setPrototypeOf,os=tn===void 0?function(e,t){return e.__proto__=t,e}:tn,Ln=(function(e){rs(t,e);function t(r){r===void 0&&(r=tr);var o=e.call(this,typeof r=="number"?tr+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=tr,os(o,t.prototype),o}return t})(Error);function nt(e,t){if(!e)throw new Ln(t)}var zn=["debug","log","warn","error","silent"],ss=zn.indexOf("log");function Dt(e){return function(){if(zn.indexOf(e)>=ss){var t=console[e]||console.log;return t.apply(console,arguments)}}}(function(e){e.debug=Dt("debug"),e.log=Dt("log"),e.warn=Dt("warn"),e.error=Dt("error")})(nt||(nt={}));var Dn="3.14.0";function ut(e){try{return e()}catch{}}const ur=ut(function(){return globalThis})||ut(function(){return window})||ut(function(){return self})||ut(function(){return global})||ut(function(){return ut.constructor("return this")()});var rn=new Map;function as(e){var t=rn.get(e)||1;return rn.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function is(e,t){var r=as("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=vr(s),t||(t=jr(s,r),r=[])}e.apply(void 0,[t].concat(r))}}var rr=Object.assign(function(t,r){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];t||nt(t,vr(r,o)||jr(r,o))},{debug:Mt(nt.debug),log:Mt(nt.log),warn:Mt(nt.warn),error:Mt(nt.error)});function Mn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Ln(vr(e,t)||jr(e,t))}var nn=Symbol.for("ApolloErrorMessageHandler_"+Dn);function Bn(e){if(typeof e=="string")return e;try{return is(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function vr(e,t){if(t===void 0&&(t=[]),!!e)return ur[nn]&&ur[nn](e,t.map(Bn))}function jr(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:Dn,message:e,args:t.map(Bn)})))}function ls(e){return e.definitions.filter(function(t){return t.kind==="OperationDefinition"&&!!t.name}).map(function(t){return t.name.value})[0]||null}let re=null;const on={};let cs=1;const ds=()=>class{constructor(){this.id=["slot",cs++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let t=re;t;t=t.parent)if(this.id in t.slots){const r=t.slots[this.id];if(r===on)break;return t!==re&&(re.slots[this.id]=r),!0}return re&&(re.slots[this.id]=on),!1}getValue(){if(this.hasValue())return re.slots[this.id]}withValue(t,r,o,s){const a={__proto__:null,[this.id]:t},i=re;re={parent:i,slots:a};try{return r.apply(s,o)}finally{re=i}}static bind(t){const r=re;return function(){const o=re;try{return re=r,t.apply(this,arguments)}finally{re=o}}}static noContext(t,r,o){if(re){const s=re;try{return re=null,t.apply(o,r)}finally{re=s}}else return t.apply(o,r)}};function sn(e){try{return e()}catch{}}const nr="@wry/context:Slot",us=sn(()=>globalThis)||sn(()=>global)||Object.create(null),an=us,kr=an[nr]||Array[nr]||(function(e){try{Object.defineProperty(an,nr,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}})(ds()),{bind:Wa,noContext:Qa}=kr;new kr;function fs(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=ms(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 ms(e,t){if(e){if(typeof e=="string")return ln(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 ln(e,t)}}function ln(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 cn(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 Sr(e,t,r){return t&&cn(e.prototype,t),r&&cn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Nr=function(){return typeof Symbol=="function"},Cr=function(e){return Nr()&&!!Symbol[e]},_r=function(e){return Cr(e)?Symbol[e]:"@@"+e};Nr()&&!Cr("observable")&&(Symbol.observable=Symbol("observable"));var ps=_r("iterator"),fr=_r("observable"),qn=_r("species");function Kt(e,t){var r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function jt(e){var t=e.constructor;return t!==void 0&&(t=t[qn],t===null&&(t=void 0)),t!==void 0?t:le}function hs(e){return e instanceof le}function pt(e){pt.log?pt.log(e):setTimeout(function(){throw e})}function qt(e){Promise.resolve().then(function(){try{e()}catch(t){pt(t)}})}function Un(e){var t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t=="function")t();else{var r=Kt(t,"unsubscribe");r&&r.call(t)}}catch(o){pt(o)}}function mr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function gs(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(Rn(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function Rn(e,t,r){e._state="running";var o=e._observer;try{var s=Kt(o,t);switch(t){case"next":s&&s.call(o,r);break;case"error":if(mr(e),s)s.call(o,r);else throw r;break;case"complete":mr(e),s&&s.call(o);break}}catch(a){pt(a)}e._state==="closed"?Un(e):e._state==="running"&&(e._state="ready")}function or(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}],qt(function(){return gs(e)});return}Rn(e,t,r)}}var xs=(function(){function e(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new ws(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"&&(mr(this),Un(this))},Sr(e,[{key:"closed",get:function(){return this._state==="closed"}}]),e})(),ws=(function(){function e(r){this._subscription=r}var t=e.prototype;return t.next=function(o){or(this._subscription,"next",o)},t.error=function(o){or(this._subscription,"error",o)},t.complete=function(){or(this._subscription,"complete")},Sr(e,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),e})(),le=(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 xs(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(p){try{o(p,c)}catch(g){i(g),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=jt(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=jt(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=jt(this),i=arguments.length>1,c=!1,l=arguments[1],p=l;return new a(function(g){return s.subscribe({next:function(y){var w=!c;if(c=!0,!w||i)try{p=o(p,y)}catch(C){return g.error(C)}else p=y},error:function(y){g.error(y)},complete:function(){if(!c&&!i)return g.error(new TypeError("Cannot reduce an empty sequence"));g.next(p),g.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=jt(this);return new c(function(l){var p,g=0;function y(w){p=w.subscribe({next:function(C){l.next(C)},error:function(C){l.error(C)},complete:function(){g===a.length?(p=void 0,l.complete()):y(c.from(a[g++]))}})}return y(o),function(){p&&(p.unsubscribe(),p=void 0)}})},t.flatMap=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=jt(this);return new a(function(i){var c=[],l=s.subscribe({next:function(g){if(o)try{g=o(g)}catch(w){return i.error(w)}var y=a.from(g).subscribe({next:function(w){i.next(w)},error:function(w){i.error(w)},complete:function(){var w=c.indexOf(y);w>=0&&c.splice(w,1),p()}});c.push(y)},error:function(g){i.error(g)},complete:function(){p()}});function p(){l.closed&&c.length===0&&i.complete()}return function(){c.forEach(function(g){return g.unsubscribe()}),l.unsubscribe()}})},t[fr]=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=Kt(o,fr);if(a){var i=a.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return hs(i)&&i.constructor===s?i:new s(function(c){return i.subscribe(c)})}if(Cr("iterator")&&(a=Kt(o,ps),a))return new s(function(c){qt(function(){if(!c.closed){for(var l=fs(a.call(o)),p;!(p=l()).done;){var g=p.value;if(c.next(g),c.closed)return}c.complete()}})});if(Array.isArray(o))return new s(function(c){qt(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){qt(function(){if(!c.closed){for(var l=0;l<s.length;++l)if(c.next(s[l]),c.closed)return;c.complete()}})})},Sr(e,null,[{key:qn,get:function(){return this}}]),e})();Nr()&&Object.defineProperty(le,Symbol("extensions"),{value:{symbol:fr,hostReportError:pt},configurable:!0});function ys(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 ft;typeof self<"u"?ft=self:typeof window<"u"?ft=window:typeof global<"u"?ft=global:typeof module<"u"?ft=module:ft=Function("return this")();ys(ft);var dn=le.prototype,un="@@observable";dn[un]||(dn[un]=function(){return this});function bs(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 Mn(58,s)}return e}function vs(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 js(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName=typeof t.query!="string"?ls(t.query)||void 0:""),t}var ks=Symbol.for("apollo.deprecations"),Ss=ur,Ns=new kr;function Cs(e){return Ss[ks]||(Ns.getValue()||[]).includes(e)}function _s(e,t){Cs(e)||t()}function fn(e,t){return t?t(e):le.of()}function kt(e){return typeof e=="function"?new Vn(e):e}function Bt(e){return e.request.length<=1}var Vn=(function(){function e(t){t&&(this.request=t)}return e.empty=function(){return new e(function(){return le.of()})},e.from=function(t){return t.length===0?e.empty():t.map(kt).reduce(function(r,o){return r.concat(o)})},e.split=function(t,r,o){var s=kt(r),a=kt(o||new e(fn)),i;return Bt(s)&&Bt(a)?i=new e(function(c){return t(c)?s.request(c)||le.of():a.request(c)||le.of()}):i=new e(function(c,l){return t(c)?s.request(c,l)||le.of():a.request(c,l)||le.of()}),Object.assign(i,{left:s,right:a})},e.execute=function(t,r){return t.request(vs(r.context,js(bs(r))))||le.of()},e.concat=function(t,r){var o=kt(t);if(Bt(o))return globalThis.__DEV__!==!1&&rr.warn(47,o),o;var s=kt(r),a;return Bt(s)?a=new e(function(i){return o.request(i,function(c){return s.request(c)||le.of()})||le.of()}):a=new e(function(i,c){return o.request(i,function(l){return s.request(l,c)||le.of()})||le.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(fn)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(t,r){throw Mn(48)},e.prototype.onError=function(t,r){if(globalThis.__DEV__!==!1&&_s("onError",function(){globalThis.__DEV__!==!1&&rr.warn(49)}),r&&r.error)return r.error(t),!1;throw t},e.prototype.setOnError=function(t){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&rr.warn(50),this.onError=t,this},e})();function Is(e){return new Vn(function(t,r){var o=ns(t,[]);return new le(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 Fs=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 oe.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 oe.isAxiosError(s)?console.error("Error fetching token:",s.response||s.message):console.error("Unexpected error:",s),null}},Ps="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Es=Ht.createHttpLink({uri:`${Ps}`}),Ts=Is(async(e,{headers:t})=>{const r=await Fs();return{headers:{...t,authorization:`Bearer ${r}`}}}),Os=new Ht.ApolloClient({link:Ts.concat(Es),cache:new Ht.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),As=e=>{const{tanyaConfig:t}=e;return n.jsx(Ht.ApolloProvider,{client:Os,children:n.jsx(Uo,{children:n.jsx(ts,{tanyaConfig:t})})})};function $s(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 Hn=Object.freeze({left:0,top:0,width:16,height:16}),Wt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ir=Object.freeze({...Hn,...Wt}),pr=Object.freeze({...Ir,body:"",hidden:!1});function Ls(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 mn(e,t){const r=Ls(e,t);for(const o in pr)o in Wt?o in e&&!(o in r)&&(r[o]=Wt[o]):o in t?r[o]=t[o]:o in e&&(r[o]=e[o]);return r}function zs(e,t,r){const o=e.icons,s=e.aliases||Object.create(null);let a={};function i(c){a=mn(o[c]||s[c],a)}return i(t),r.forEach(i),mn(e,a)}function Yn(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=$s(e);for(const s in o){const a=o[s];a&&(t(s,zs(e,s,a)),r.push(s))}return r}const Ds={provider:"",aliases:{},not_found:{},...Hn};function sr(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Jn(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!sr(e,Ds))return null;const r=t.icons;for(const s in r){const a=r[s];if(!s||typeof a.body!="string"||!sr(a,pr))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]||!sr(a,pr))return null}return t}const pn=Object.create(null);function Ms(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function ht(e,t){const r=pn[e]||(pn[e]=Object.create(null));return r[t]||(r[t]=Ms(e,t))}function Kn(e,t){return Jn(t)?Yn(t,(r,o)=>{o?e.icons[r]=o:e.missing.add(r)}):[]}function Bs(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}const Wn=/^[a-z0-9]+(-[a-z0-9]+)*$/,Qt=(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(),p={provider:s.length>0?s[0]:o,prefix:l,name:c};return t&&!Ut(p)?null:p}const a=s[0],i=a.split("-");if(i.length>1){const c={provider:o,prefix:i.shift(),name:i.join("-")};return t&&!Ut(c)?null:c}if(r&&o===""){const c={provider:o,prefix:"",name:a};return t&&!Ut(c,r)?null:c}return null},Ut=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let Et=!1;function Qn(e){return typeof e=="boolean"&&(Et=e),Et}function hn(e){const t=typeof e=="string"?Qt(e,!0,Et):e;if(t){const r=ht(t.provider,t.prefix),o=t.name;return r.icons[o]||(r.missing.has(o)?null:void 0)}}function qs(e,t){const r=Qt(e,!0,Et);if(!r)return!1;const o=ht(r.provider,r.prefix);return t?Bs(o,r.name,t):(o.missing.add(r.name),!0)}function Us(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Et&&!t&&!e.prefix){let s=!1;return Jn(e)&&(e.prefix="",Yn(e,(a,i)=>{qs(a,i)&&(s=!0)})),s}const r=e.prefix;if(!Ut({prefix:r,name:"a"}))return!1;const o=ht(t,r);return!!Kn(o,e)}const Xn=Object.freeze({width:null,height:null}),Gn=Object.freeze({...Xn,...Wt}),Rs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Vs=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function gn(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(Rs);if(o===null||!o.length)return e;const s=[];let a=o.shift(),i=Vs.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 Hs(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 Ys(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Js(e,t,r){const o=Hs(e);return Ys(o.defs,t+o.content+r)}const Ks=e=>e==="unset"||e==="undefined"||e==="none";function Ws(e,t){const r={...Ir,...e},o={...Gn,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let a=r.body;[r,o].forEach(P=>{const j=[],I=P.hFlip,Q=P.vFlip;let R=P.rotate;I?Q?R+=2:(j.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),j.push("scale(-1 1)"),s.top=s.left=0):Q&&(j.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),j.push("scale(1 -1)"),s.top=s.left=0);let X;switch(R<0&&(R-=Math.floor(R/4)*4),R=R%4,R){case 1:X=s.height/2+s.top,j.unshift("rotate(90 "+X.toString()+" "+X.toString()+")");break;case 2:j.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:X=s.width/2+s.left,j.unshift("rotate(-90 "+X.toString()+" "+X.toString()+")");break}R%2===1&&(s.left!==s.top&&(X=s.left,s.left=s.top,s.top=X),s.width!==s.height&&(X=s.width,s.width=s.height,s.height=X)),j.length&&(a=Js(a,'<g transform="'+j.join(" ")+'">',"</g>"))});const i=o.width,c=o.height,l=s.width,p=s.height;let g,y;i===null?(y=c===null?"1em":c==="auto"?p:c,g=gn(y,l/p)):(g=i==="auto"?l:i,y=c===null?gn(g,p/l):c==="auto"?p:c);const w={},C=(P,j)=>{Ks(j)||(w[P]=j.toString())};C("width",g),C("height",y);const S=[s.left,s.top,l,p];return w.viewBox=S.join(" "),{attributes:w,viewBox:S,body:a}}const Qs=/\sid="(\S+)"/g,Xs="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Gs=0;function Zs(e,t=Xs){const r=[];let o;for(;o=Qs.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+(Gs++).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 hr=Object.create(null);function ea(e,t){hr[e]=t}function gr(e){return hr[e]||hr[""]}function Fr(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 Pr=Object.create(null),St=["https://api.simplesvg.com","https://api.unisvg.com"],Rt=[];for(;St.length>0;)St.length===1||Math.random()>.5?Rt.push(St.shift()):Rt.push(St.pop());Pr[""]=Fr({resources:["https://api.iconify.design"].concat(Rt)});function ta(e,t){const r=Fr(t);return r===null?!1:(Pr[e]=r,!0)}function Er(e){return Pr[e]}const ra=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let xn=ra();function na(e,t){const r=Er(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 oa(e){return e===404}const sa=(e,t,r)=>{const o=[],s=na(e,t),a="icons";let i={type:a,provider:e,prefix:t,icons:[]},c=0;return r.forEach((l,p)=>{c+=l.length+1,c>=s&&p>0&&(o.push(i),i={type:a,provider:e,prefix:t,icons:[]},c=l.length),i.icons.push(l)}),o.push(i),o};function aa(e){if(typeof e=="string"){const t=Er(e);if(t)return t.path}return"/"}const ia=(e,t,r)=>{if(!xn){r("abort",424);return}let o=aa(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;xn(e+o).then(a=>{const i=a.status;if(i!==200){setTimeout(()=>{r(oa(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)})},la={prepare:sa,send:ia};function Zn(e,t){e.forEach(r=>{const o=r.loaderCallbacks;o&&(r.loaderCallbacks=o.filter(s=>s.id!==t))})}function ca(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 p=l.name;if(e.icons[p])i.loaded.push({provider:o,prefix:s,name:p});else if(e.missing.has(p))i.missing.push({provider:o,prefix:s,name:p});else return r=!0,!0;return!1}),i.pending.length!==c&&(r||Zn([e],a.id),a.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),a.abort))})}))}let da=0;function ua(e,t,r){const o=da++,s=Zn.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 fa(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)),p=l[i]||(l[i]=ht(a,i));let g;c in p.icons?g=t.loaded:i===""||p.missing.has(c)?g=t.missing:g=t.pending;const y={provider:a,prefix:i,name:c};g.push(y)}),t}function ma(e,t=!0,r=!1){const o=[];return e.forEach(s=>{const a=typeof s=="string"?Qt(s,t,r):s;a&&o.push(a)}),o}const pa={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ha(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 F=e.resources.slice(0);for(i=[];F.length>1;){const V=Math.floor(Math.random()*F.length);i.push(F[V]),F=F.slice(0,V).concat(F.slice(V+1))}i=i.concat(F)}else i=e.resources.slice(a).concat(e.resources.slice(0,a));const c=Date.now();let l="pending",p=0,g,y=null,w=[],C=[];typeof o=="function"&&C.push(o);function S(){y&&(clearTimeout(y),y=null)}function P(){l==="pending"&&(l="aborted"),S(),w.forEach(F=>{F.status==="pending"&&(F.status="aborted")}),w=[]}function j(F,V){V&&(C=[]),typeof F=="function"&&C.push(F)}function I(){return{startTime:c,payload:t,status:l,queriesSent:p,queriesPending:w.length,subscribe:j,abort:P}}function Q(){l="failed",C.forEach(F=>{F(void 0,g)})}function R(){w.forEach(F=>{F.status==="pending"&&(F.status="aborted")}),w=[]}function X(F,V,ce){const B=V!=="success";switch(w=w.filter(de=>de!==F),l){case"pending":break;case"failed":if(B||!e.dataAfterTimeout)return;break;default:return}if(V==="abort"){g=ce,Q();return}if(B){g=ce,w.length||(i.length?Oe():Q());return}if(S(),R(),!e.random){const de=e.resources.indexOf(F.resource);de!==-1&&de!==e.index&&(e.index=de)}l="completed",C.forEach(de=>{de(ce)})}function Oe(){if(l!=="pending")return;S();const F=i.shift();if(F===void 0){if(w.length){y=setTimeout(()=>{S(),l==="pending"&&(R(),Q())},e.timeout);return}Q();return}const V={status:"pending",resource:F,callback:(ce,B)=>{X(V,ce,B)}};w.push(V),p++,y=setTimeout(Oe,e.rotate),r(F,t,V.callback)}return setTimeout(Oe),I}function eo(e){const t={...pa,...e};let r=[];function o(){r=r.filter(c=>c().status==="pending")}function s(c,l,p){const g=ha(t,c,l,(y,w)=>{o(),p&&p(y,w)});return r.push(g),g}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 wn(){}const ar=Object.create(null);function ga(e){if(!ar[e]){const t=Er(e);if(!t)return;const r=eo(t),o={config:t,redundancy:r};ar[e]=o}return ar[e]}function xa(e,t,r){let o,s;if(typeof e=="string"){const a=gr(e);if(!a)return r(void 0,424),wn;s=a.send;const i=ga(e);i&&(o=i.redundancy)}else{const a=Fr(e);if(a){o=eo(a);const i=e.resources?e.resources[0]:"",c=gr(i);c&&(s=c.send)}}return!o||!s?(r(void 0,424),wn):o.query(t,s,r)().abort}function yn(){}function wa(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,ca(e)}))}function ya(e){const t=[],r=[];return e.forEach(o=>{(o.match(Wn)?t:r).push(o)}),{valid:t,invalid:r}}function Nt(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(!Kn(e,r).length){o();return}}catch(s){console.error(s)}o(),wa(e)}function bn(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function ba(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)){bn(e.loadIcons(s,o,r),g=>{Nt(e,s,g)});return}if(a){s.forEach(g=>{const y=a(g,o,r);bn(y,w=>{const C=w?{prefix:o,icons:{[g]:w}}:null;Nt(e,[g],C)})});return}const{valid:i,invalid:c}=ya(s);if(c.length&&Nt(e,c,null),!i.length)return;const l=o.match(Wn)?gr(r):null;if(!l){Nt(e,i,null);return}l.prepare(r,o,i).forEach(g=>{xa(r,g,y=>{Nt(e,g.icons,y)})})}))}const va=(e,t)=>{const r=ma(e,!0,Qn()),o=fa(r);if(!o.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(o.loaded,o.missing,o.pending,yn)}),()=>{l=!1}}const s=Object.create(null),a=[];let i,c;return o.pending.forEach(l=>{const{provider:p,prefix:g}=l;if(g===c&&p===i)return;i=p,c=g,a.push(ht(p,g));const y=s[p]||(s[p]=Object.create(null));y[g]||(y[g]=[])}),o.pending.forEach(l=>{const{provider:p,prefix:g,name:y}=l,w=ht(p,g),C=w.pendingIcons||(w.pendingIcons=new Set);C.has(y)||(C.add(y),s[p][g].push(y))}),a.forEach(l=>{const p=s[l.provider][l.prefix];p.length&&ba(l,p)}),t?ua(t,o,a):yn};function ja(e,t){const r={...e};for(const o in t){const s=t[o],a=typeof s;o in Xn?(s===null||s&&(a==="string"||a==="number"))&&(r[o]=s):a===typeof r[o]&&(r[o]=o==="rotate"?s%4:s)}return r}const ka=/[\s,]+/;function Sa(e,t){t.split(ka).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Na(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 Ca(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 _a(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Ia(e){return"data:image/svg+xml,"+_a(e)}function Fa(e){return'url("'+Ia(e)+'")'}let It;function Pa(){try{It=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{It=null}}function Ea(e){return It===void 0&&Pa(),It?It.createHTML(e):e}const to={...Gn,inline:!1},Ta={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Oa={display:"inline-block"},xr={backgroundColor:"currentColor"},ro={backgroundColor:"transparent"},vn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},jn={WebkitMask:xr,mask:xr,background:ro};for(const e in jn){const t=jn[e];for(const r in vn)t[e+r]=vn[r]}const Aa={...to,inline:!0};function kn(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const $a=(e,t,r)=>{const o=t.inline?Aa:to,s=ja(o,t),a=t.mode||"svg",i={},c=t.style||{},l={...a==="svg"?Ta:{}};if(r){const j=Qt(r,!1,!0);if(j){const I=["iconify"],Q=["provider","prefix"];for(const R of Q)j[R]&&I.push("iconify--"+j[R]);l.className=I.join(" ")}}for(let j in t){const I=t[j];if(I!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":l.ref=I;break;case"className":l[j]=(l[j]?l[j]+" ":"")+I;break;case"inline":case"hFlip":case"vFlip":s[j]=I===!0||I==="true"||I===1;break;case"flip":typeof I=="string"&&Sa(s,I);break;case"color":i.color=I;break;case"rotate":typeof I=="string"?s[j]=Na(I):typeof I=="number"&&(s[j]=I);break;case"ariaHidden":case"aria-hidden":I!==!0&&I!=="true"&&delete l["aria-hidden"];break;default:o[j]===void 0&&(l[j]=I)}}const p=Ws(e,s),g=p.attributes;if(s.inline&&(i.verticalAlign="-0.125em"),a==="svg"){l.style={...i,...c},Object.assign(l,g);let j=0,I=t.id;return typeof I=="string"&&(I=I.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:Ea(Zs(p.body,I?()=>I+"ID"+j++:"iconifyReact"))},h.createElement("svg",l)}const{body:y,width:w,height:C}=e,S=a==="mask"||(a==="bg"?!1:y.indexOf("currentColor")!==-1),P=Ca(y,{...g,width:w+"",height:C+""});return l.style={...i,"--svg":Fa(P),width:kn(g.width),height:kn(g.height),...Oa,...S?xr:ro,...c},h.createElement("span",l)};Qn(!0);ea("",la);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"||!Us(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;ta(r,s)||console.error(o)}catch{console.error(o)}}}}function no(e){const[t,r]=h.useState(!!e.ssr),[o,s]=h.useState({});function a(C){if(C){const S=e.icon;if(typeof S=="object")return{name:"",data:S};const P=hn(S);if(P)return{name:S,data:P}}return{name:""}}const[i,c]=h.useState(a(!!e.ssr));function l(){const C=o.callback;C&&(C(),s({}))}function p(C){if(JSON.stringify(i)!==JSON.stringify(C))return l(),c(C),!0}function g(){var C;const S=e.icon;if(typeof S=="object"){p({name:"",data:S});return}const P=hn(S);if(p({name:S,data:P}))if(P===void 0){const j=va([S],g);s({callback:j})}else P&&((C=e.onLoad)===null||C===void 0||C.call(e,S))}h.useEffect(()=>(r(!0),l),[]),h.useEffect(()=>{t&&g()},[e.icon,t]);const{name:y,data:w}=i;return w?$a({...Ir,...w},e,y):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const ne=h.forwardRef((e,t)=>no({...e,_ref:t}));h.forwardRef((e,t)=>no({inline:!0,...e,_ref:t}));const mt="USD",La=(e,t=mt)=>{const r=(e==null?void 0:e.prices)??[];if(!r.length)return null;const o=i=>{var p,g;const c=i.find(y=>{var w;return!!((w=y.discounted)!=null&&w.value)});if(c)return{cent:c.discounted.value.centAmount,cur:c.discounted.value.currencyCode,regularCent:(p=c.value)==null?void 0:p.centAmount};const l=(g=i[0])==null?void 0:g.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},za=(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},Da=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}},Ct=e=>za((e==null?void 0:e.attributesRaw)??[],"color"),_t=e=>Da((e==null?void 0:e.attributesRaw)??[]).sizeLabel,Ye=e=>e.charAt(0).toUpperCase()+e.slice(1),Ma={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"}},rt=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},Ba=e=>e==null?void 0:e.masterVariant,Sn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],wr=e=>{const t=Ba(e);return t?[t,...Sn(e)]:Sn(e)},qa=(e,t=0)=>wr(e)[t],Ua=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},Nn=(e,t)=>{var r,o,s,a,i,c,l,p;return Ua(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)||((p=(l=(c=(i=e.image_groups)==null?void 0:i[0])==null?void 0:c.images)==null?void 0:l[0])==null?void 0:p.link)||""},Cn=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,p,g;const t=e?La(e,mt):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=((g=(p=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:p.value)==null?void 0:g.currencyCode)??mt;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},_n=(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},Ra=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)||""},Va=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)||""},Ha=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)||""},In=20,Ya=({open:e,onClose:t,product:r,index:o,addresses:s,addressLoading:a,variationAttributes:i,customerId:c})=>{const g=wr(r),y=Math.min(Math.max(0,o||0),Math.max(0,g.length-1)),[w,C]=h.useState([]),[S,P]=h.useState(0),[j,I]=h.useState([]),[Q,R]=h.useState(0),X=(d,f,u)=>{const{colorMap:x,sizeMap:v}=Oe(u),_={};f==null||f.forEach(E=>{var ie,De,Ce;const U=(ie=E.variationAttributes)==null?void 0:ie.find(Re=>Re.id==="color"),$=(Ce=(De=U==null?void 0:U.values)==null?void 0:De[0])==null?void 0:Ce.value;$&&(_[$]||(_[$]={}),_[$][E.viewType]=E.images)});const M=d.reduce((E,U)=>{const $=U.variationValues.color,ie=U.variationValues.size;return E[$]||(E[$]={color:$,name:x[$]||$,images:_[$]||{},variants:[]}),E[$].variants.push({size:ie,name:v[ie]||ie,...U}),E},{});return Object.values(M).sort((E,U)=>{const $=E.colorName||E.color||"",ie=U.colorName||U.color||"";return $.localeCompare(ie)}).map(E=>({...E,variants:E.variants.sort((U,$)=>Number(U.size)-Number($.size))}))},Oe=d=>{const f={},u={};return d==null||d.forEach(x=>{x.id==="color"&&x.values.forEach(v=>{f[v.value]=v.name}),x.id==="size"&&x.values.forEach(v=>{u[v.value]=v.name})}),{colorMap:f,sizeMap:u}},F=g.length,[V,ce]=h.useState(y),[B,de]=h.useState(null),[te,_e]=h.useState(null);h.useRef(null),h.useRef(null);const k=qa(r,V),[H,z]=h.useState(""),[Ae,gt]=h.useState(""),[Ge,qe]=h.useState(!1),[ye,$e]=h.useState(!1),[Ie,A]=h.useState(!1),[Fe,Le]=h.useState(""),[he,Pe]=h.useState(!1),[se,m]=h.useState(null),[D,T]=h.useState([]),[G,W]=h.useState([]),[O,ue]=h.useState([]),[Y,q]=h.useState(!1),[Z,ze]=h.useState(),[He,be]=h.useState(!0),[ee,fe]=h.useState(!1),[ve,me]=h.useState(!1),[b,Se]=h.useState({id:"001"}),[L,J]=h.useState(!1),[Ne,ge]=h.useState(!1),[Ue,Tt]=h.useState("card"),[ae,je]=h.useState(!1),[xt,N]=h.useState(!1),[xe,pe]=h.useState(!1),[it,oo]=h.useState(null),[Ot,Tr]=h.useState(null),[Xt,Or]=h.useState(""),[Ar,$r]=h.useState(!1),[lt,Lr]=h.useState(r==null?void 0:r.id),At=h.useRef(null);h.useEffect(()=>{var d,f,u,x,v;if(r!=null&&r.variants){const _=X(r.variants,r.imageGroups,i);if(C(_),_.length>0){const M=(d=_[0])==null?void 0:d.name;de(M),_e((u=(f=_[0])==null?void 0:f.variants[0])==null?void 0:u.name),ce(0),Lr((v=(x=_[0])==null?void 0:x.variants[0])==null?void 0:v.id),P(0)}}},[r]),h.useEffect(()=>{At.current&&(At.current.scrollTop=At.current.scrollHeight)},[D,Y,ee,ve,L,Ne,ae,xt,xe,Ge,ye]);const wt="var(--tanya)",zr="var(--tanya-contrast)",K="#804c9e",Gt=K,so=()=>{console.log("AgenticShopping feedback:",{rating:Ot,comment:Xt}),$r(!0)},ao=()=>{Tr(null),Or(""),$r(!0)},Dr=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??it;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(ne,{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})]}),!Ar&&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:()=>Tr(x),className:"p-0.5",children:n.jsx(ne,{icon:Ot&&Ot>=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:Xt,onChange:x=>Or(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:ao,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:so,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:wt},disabled:!Ot&&!Xt.trim(),children:"Submit"})]})]}),Ar&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},io=async()=>{try{ue(s);const d=JSON.parse(sessionStorage.getItem("customerData")||"{}");let f=(d==null?void 0:d.basketId)||localStorage.getItem(Ft);if(!f){const u=await at(),x="Bearer "+(u==null?void 0:u.access_token),v=await br(x);f=(v==null?void 0:v.basket_id)||v.basketId}lo(f),z(f)}catch(d){console.error("Error fetching addresses:",d)}},lo=async d=>{const f=await Go(d);I(f)},yt=(d,f)=>{T(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:f}])},Mr=(d,f)=>{T(u=>u.map(x=>x.response==="__CARD__"?{...x,response:"__SNAPSHOT__",snapshotStage:d??x.snapshotStage,snapshotPayload:f??x.snapshotPayload}:x))},co=()=>{T(d=>d.filter(f=>!(f.query===""&&f.response!=="__SNAPSHOT__"&&f.response!=="__TEXT__")))},$t=()=>{N(!1),q(!1),me(!1),ge(!1),fe(!1),J(!1),je(!1),pe(!1),Pe(!1),m(null),co(),qe(!1),$e(!1)},uo=()=>{q(!1),fe(!1),me(!1),Se("standard"),J(!1),ge(!1),Tt("card"),je(!1),N(!1),pe(!1),be(!0),m(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=h.useMemo(()=>wr(r).map((f,u)=>({index:u,variant:f,images:((f==null?void 0:f.images)||[]).map(x=>(x==null?void 0:x.url)||"").filter(Boolean)})),[r]),bt=h.useMemo(()=>Lt.length?!!((B||void 0)&&(te||void 0)):!1,[Lt,B,te,k]),fo=Ie||he||!bt,vt=d=>{const f=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(f)&&f>0?f:1},Br=d=>{const f=vt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(_n(r,k)*f)},qr=d=>{const f=se,u=Vt(k),x=d||(f==null?void 0:f.currency)||u.currency||mt,v=Br(f),_=+(v*.08).toFixed(2),M=(b==null?void 0:b.price)||0;return{product_total:v,tax:_,shipping_fee:M,currency:x}},Zt=async(d,f,u)=>{Mr(),uo(),A(!0),Pe(!0),qe(!1),$e(!1);const x=G.slice(-In);try{const v=await lr(null,null);if(!v)throw new Error("Failed to fetch token");const _=localStorage.getItem("isLoggedIn"),E=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(_||!0),userId:String(c||new Date().getTime())}).toString()}`,U=await fetch(`${E}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({flowId:"MTMI0P4LC6",flowAliasId:"BCUA138F2Q",input:{instruction:`Use SKU ${f}. Currency is USD. ${d}`,metadata:{productId:(r==null?void 0:r.id)??null,skuId:f??null,variantIndex:u},context:x}})});if(!U.body)throw new Error("Readable stream not supported");const $=U.body.getReader(),ie=new TextDecoder;let De="",Ce="",Re="";for(;;){const{done:we,value:Ze}=await $.read();if(we)break;De+=ie.decode(Ze,{stream:!0});const ct=De.split(`
17
+ `);De=ct.pop()||"";for(const et of ct){if(!et.startsWith("data:"))continue;const dt=et.slice(5).trim();try{const Te=JSON.parse(dt),ke=Te.index,tt=Te.data;ke===0?Ce=String(tt??""):ke===1&&(Re=String(tt??""))}catch(Te){console.error("Error parsing JSON chunk:",Te)}}}let Ee=null;if(Ce){const we=String(Ce).replace(/\\n/g,"").trim();if(we.startsWith("{")&&we.endsWith("}"))try{Ee=JSON.parse(we),Ee.product_id=f,Ee.sku_id=f,localStorage.setItem("agentic_order",JSON.stringify(Ee))}catch(Ze){console.log(Ze)}}m(Ee),Ee&&T(we=>[...we,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:Ee}}]),W(we=>[...we,{userQuery:d,mainResponse:Ce||"",keywords:Re||""}].slice(-In))}catch(v){console.error("Error sending message to Tanya:",v),Pe(!1)}finally{A(!1)}},Ur=async d=>{if(he||Ie||!bt)return;const f=Fe.trim();if(!f)return;T(x=>[...x,{query:f,response:""}]),Le(""),gt(f);const u=lt||"";if(F<=1){if(u){Zt(f,u,V);return}$e(!0),Pe(!0);return}u?(qe(!0),Pe(!0)):($e(!0),Pe(!0))},mo=()=>{const d=lt;d&&Zt(Ae,d,V)},po=()=>{qe(!1),$e(!0),Pe(!0)},ho=()=>{if(!lt)return;Zt(Ae,lt,V)},go=async()=>{q(!0),me(!1),ge(!1),N(!1),fe(!1),J(!1),je(!1),pe(!1),await io(),console.log("calling"),Mr("initial",{extractedDetails:se??void 0})},xo=()=>{if(!Z)return;const d=O.find(f=>String(f.addressId??f.id)===Z)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),fe(!0),me(!0),J(!1),ge(!1),je(!1),N(!1),pe(!1),yt("address",d))},wo=()=>{fe(!1),me(!1),J(!1),ge(!1),je(!1),N(!1),pe(!1),localStorage.removeItem("agentic_order_address")},yo=()=>{b.id&&(localStorage.setItem("agentic_order_delivery",b.id),J(!0),ge(!0),je(!1),N(!1),pe(!1),yt("delivery",{method:b.id,...b}))},Rr=()=>{me(!1),J(!1),ge(!1),je(!1),N(!1),pe(!1),Pe(!1),$t(),T(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"}}])},bo=()=>{J(!1),ge(!1),je(!1),N(!1),pe(!1),localStorage.removeItem("agentic_order_delivery")},vo=()=>{Ue&&(localStorage.setItem("agentic_order_payment",Ue),je(!0),N(!0),pe(!1),yt("payment",{method:Ue}))},jo=()=>{ge(!1),je(!1),N(!1),pe(!1),Pe(!1),$t(),T(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=()=>{je(!1),N(!1),pe(!1),localStorage.removeItem("agentic_order_payment")},So=async()=>{try{A(!0);const d=se||{},f=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),x=localStorage.getItem("agentic_order_payment")||"card",{product_total:v,tax:_,shipping_fee:M,currency:E}=qr(),U=c,$=(f==null?void 0:f.addressId)||(f==null?void 0:f.id)||void 0,ie=u??"GROUND",De="card-visa",Ce=lt,Re=(r==null?void 0:r.id)||"",Ee=vt(d),we=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(v*100),et={shopper_id:U,shipping_address_id:$,shipping_method_id:ie,payment_method_id:De,sku:Ce,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Re,quantity:Ee,max_price_minor:we,currency:E,instruction_text:Ae};if(!U||!$){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:U,shippingAddressId:$}),alert("Missing customer or address information. Please re-select address and try again."),A(!1);return}const{serverUrl:dt}=Ke(),Te=await fetch(`${dt}api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(et)});if(!Te.ok){const Po=await Te.text().catch(()=>"");console.error("intent-mandate failed",Te.status,Po),alert("Something went wrong while saving your smart order. Please try again."),A(!1);return}const ke=await Te.json().catch(()=>null);console.log("intent-mandate success:",ke);const tt=(ke==null?void 0:ke.intent_mandate_id)||(ke==null?void 0:ke.intent_mandateId)||(ke==null?void 0:ke.key)||null;tt&&oo(tt);const Kr={...d,address:f,delivery:u,payment:x,summary:{product_total:v,tax:_,shipping_fee:M,currency:E},intent_mandate_id:tt};localStorage.setItem("agentic_order_final",JSON.stringify(Kr)),pe(!0),be(!1),yt("final",Kr),yt("success",{intentMandateId:tt}),$t()}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{A(!1)}},Vr=()=>{$t(),T(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"}}])},No=({selectedIndex:d})=>{var E;const f=((E=w[d])==null?void 0:E.images.large[0].link)||Nn(r,k),u=Cn(r),x=lt||"";Ct(k),_t(k);const{amount:v}=Vt(k),_=!!(r!=null&&r.id),M=_;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:f?n.jsx("img",{src:f,alt:u,className:"object-contain w-full h-full"}):n.jsx(ne,{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}`,B&&`Color: ${B}`,te&&`Size: ${te}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:_?`$${Q||(r==null?void 0:r.price)}`:"Currently unavailable"}),_&&!M&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},Hr=({showSubmit:d=!0})=>{const f={};Lt.map(x=>Ct(x.variant)).filter(x=>!!x&&!f[x]&&(f[x]=!0));const u={};return Lt.map(x=>_t(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 :"}),B&&n.jsx("div",{className:"text-sm text-gray-600",children:B})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:w.map((x,v)=>{const _=x.name,M=B===_,E=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
+ ${M?"border-2 border-[#804c9e]":"border-gray-300"}`,children:n.jsx("button",{onClick:()=>{de(_),_e(null),ce(null),P(v)},className:"w-full h-20 flex items-center justify-center overflow-hidden p-0",title:_,children:E?n.jsx("img",{src:E,alt:_,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:_})})},_)})})]}),B&&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 :"}),te&&n.jsx("div",{className:"text-sm text-gray-600",children:te})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(()=>{const x=w.find(v=>v.name===B);return x?x.variants.map((v,_)=>{const M=v.name,E=te===M;return n.jsx("button",{onClick:()=>{_e(M),ce(_),Lr(v.productId),R(v.price)},className:`px-4 py-2 rounded-md border text-sm ${E?"border-2 border-[#804c9e] font-semibold":"border-gray-300"}`,title:M,children:M},`size-${M}`)}):null})()})]}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:ho,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:K},disabled:!bt,children:"Submit"})})]})},Yr=(d,f=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||se;if(!u)return null;const x=vt(u),{currency:v}=Vt(k),_=_n(r,k),M=Number((u==null?void 0:u.max_price_minor)??0),U=Number.isFinite(M)&&M>0?+(M/100):+(_*x),$=(u==null?void 0:u.currency)||v||mt,ie=k!=null&&k.sku?k.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:zr},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:ie}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Quantity:"}),n.jsx("p",{className:"text-gray-800",children:vt(u)}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Currency:"}),n.jsx("p",{className:"text-gray-800",children:$}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Maximum Total Price:"}),n.jsx("p",{className:"text-gray-800",children:rt(U,$)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[Ct(k)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",Ct(k)]}),_t(k)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",_t(k)]}),(k==null?void 0:k.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",k.sku]})]})]}),!f&&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:zr},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:go,disabled:Y,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 ${Y?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:K},children:[n.jsx(ne,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Vr,disabled:Y,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${Y?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:K,color:K},children:[n.jsx(ne,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Jr=(d,f=!0)=>{var ct,et,dt;const u=d||{},x=((ct=u==null?void 0:u.summary)==null?void 0:ct.currency)||(se==null?void 0:se.currency)||mt,v=Nn(r,k),_=Cn(r),M=k!=null&&k.sku?k.sku:(r==null?void 0:r.id)??(se==null?void 0:se.product_id),E=(k==null?void 0:k.sku)??Ra(r);Ct(k)||Va(r),_t(k)||Ha(r);const U=vt(u),$=((et=u==null?void 0:u.summary)==null?void 0:et.product_total)!=null?+u.summary.product_total:Br(u),ie=U>0?+($/U).toFixed(2):0,De=$,Ce=((dt=u==null?void 0:u.summary)==null?void 0:dt.tax)??+($*.08).toFixed(2),Re=(b==null?void 0:b.price)||0,Ee=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(Te=>Ye(String(Te))).join(", "):"—",we=(u==null?void 0:u.payment)||"card",Ze=we==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Ye(we)});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(ne,{icon:"mdi:receipt-text-check-outline",width:"24",color:wt}),"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:v?n.jsx("img",{src:v,alt:_,className:"w-full h-full object-contain"}):n.jsx(ne,{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:_}),n.jsxs("div",{className:"text-xs text-center font-bold text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",M??"—"]}),(E||B||te)&&n.jsxs("div",{className:"text-xs text-gray-600 mt-0.5 text-center",children:[E&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",E,"  "]}),B&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",B,"  "]}),te&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Size:"})," ",te]})]})]}),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:rt(ie,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:U})]}),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:rt(De,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:Ee})]}),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:Ze})]}),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:(b==null?void 0:b.name)||"—"})]})]}),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:rt($,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:rt(Ce,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:rt(Re,x)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:Gt},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:rt($+Ce+Re,x)})]})]}),!f&&n.jsxs("div",{className:"px-6 pb-5",children:[!xe&&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?"}),xe&&Dr({intentMandateId:it}),He&&!xe&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:So,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:K},children:"Confirm"}),n.jsx("button",{onClick:Vr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:Gt,color:Gt},children:"Cancel"})]})]})]})},Co=d=>{if(!d)return null;const f=[d.addressLine1,d.addressLine2,d.street,[d.city,d.state,d.postalCode].filter(Boolean).join(", "),d.country].filter(u=>!!u).map(u=>Ye(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:K},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(ne,{icon:"mdi:home-map-marker",width:"20",color:wt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f})]})})},_o=d=>{const f=d==null?void 0:d.method,u=f?Ma[f]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:K},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(ne,{icon:"mdi:truck-delivery",width:"20",color:wt}),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(ne,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},Io=d=>{const f=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:K},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(ne,{icon:"mdi:credit-card-outline",width:"20",color:wt}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Payment Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820   Exp: 12/26"]}):Ye(f)})]})})},Fo=(d,f)=>{const u=d.snapshotStage;if(!u||u==="address"&&Y||u==="delivery"&&ve||u==="payment"&&Ne||u==="final"&&xt)return null;switch(u){case"initial":return Yr(d.snapshotPayload,!f);case"address":return Co(d.snapshotPayload);case"delivery":return _o(d.snapshotPayload);case"payment":return Io(d.snapshotPayload);case"final":return Jr(d.snapshotPayload,!f);case"success":return Dr(d.snapshotPayload);default:return null}};return Oo.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:{height:"100px",display:"flex",justifyContent:"space-between",borderTopLeftRadius:"0.75rem",borderBottomLeftRadius:"0.75rem",padding:"0.5rem",background:K},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(ne,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:At,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(No,{selectedIndex:S}),F>1&&n.jsx(Hr,{showSubmit:!1}),D.map((d,f)=>{var v;const u=f===D.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:K},children:d.query})}),d.response==="__TEXT__"&&((v=d.snapshotPayload)==null?void 0:v.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:K,margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&Ge&&F>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:B||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:te||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:mo,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:K},children:"Yes"}),n.jsx("button",{onClick:po,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:K,color:K},children:"No, change SKU"})]})]}),u&&ye&&n.jsx(Hr,{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:K,margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text text-white",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?Fo(d,u):Yr(d.snapshotPayload,!1)})]},f)}),Y&&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(ne,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),ee&&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"}),!xe&&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 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..."})]}):(O==null?void 0:O.length)>0?n.jsxs("div",{className:`space-y-3 ${ee?"opacity-70":""}`,children:[O.map(d=>{const f=[d.addressLine1,d.addressLine2].filter(Boolean).map(E=>Ye(E||"")).join(" "),u=Ye(d.city||""),x=`${Ye(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,v=Ye(d.country||""),_=String(d.addressId??d.id),M=Z===_;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${M?"border-tanya-light":"border-gray-300"} ${ee?"pointer-events-none":""}`,title:ee?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:M,disabled:ee,onChange:()=>ze(_),value:_}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800",children:f||"Address"}),n.jsxs("div",{className:"text-sm text-gray-700",children:[u,n.jsx("br",{}),x,n.jsx("br",{}),v]})]})]},_)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:Rr,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:ee,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${ee?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:K},children:ee?"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."})]}),ve&&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(ne,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),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"}),!xe&&n.jsx("button",{onClick:bo,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 ${L?"opacity-70":""}`,children:j.map(d=>{const f=b.id===d.id;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${f?"border-tanya-light":"border-gray-300"} ${L?"pointer-events-none":""}`,title:L?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:f,disabled:L,onChange:()=>Se(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:d.name}),n.jsx("div",{className:"text-sm text-gray-700",children:d.description})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:d.price===0?"Free":d.price})]},d.id)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:Rr,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: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:K},children:L?"Delivery Submitted":"Submit Delivery Option"})]})]}),Ne&&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(ne,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),ae&&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"}),!xe&&n.jsx("button",{onClick:ko,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 ${ae?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${Ue==="card"?"border-tanya-light":"border-gray-300"} ${ae?"pointer-events-none":""}`,title:ae?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:Ue==="card",disabled:ae,onChange:()=>Tt("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(ne,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),Ue==="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:jo,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:K,color:K},children:"Cancel"}),n.jsx("button",{onClick:vo,disabled:ae,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${ae?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:K},children:ae?"Payment Submitted":"Submit Payment Method"})]})]}),xt&&Jr({...se,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:qr(se==null?void 0:se.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:he?"Complete the current step…":bt?`What would you like me to do? (e.g., If this product goes below $${parseInt(r.price)-5}, grab it for me.)`:te?"Please select a combination first.":"Please select a size first.",disabled:fo,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
+ ${bt?"":"placeholder:text-red-400 text-red-500"}`,value:Fe,onKeyDown:d=>{d.key==="Enter"&&!Ie&&!he&&Ur()},onChange:d=>Le(d.target.value)}),n.jsx("button",{type:"submit",disabled:Ie||he,className:"mr-6 font-medium",style:{color:K},onClick:()=>Ur(),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(ne,{icon:"fluent:send-48-filled",color:K,width:"24",height:"24"})})]})]})})]}),document.body)};exports.AgenticShoppingButton=Ya;exports.TanyaChatbot=As;exports.TanyaChatbotProvider=Lo;
20
20
  //# sourceMappingURL=tanya-chatbot.cjs.js.map