tanya-chatbot 0.9.0 → 0.9.1

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,26 +1,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),n=require("react/jsx-runtime"),Yt=require("@apollo/client"),ot=require("react-redux"),vr=require("@reduxjs/toolkit"),_o=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const we=require("axios");require("crypto-js");const Io=require("@iconify/react"),Le=require("react-toastify"),Fo=require("react-dom");function Po(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 Sn=Po(_o),Eo='*,: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-1{margin-left:.25rem}.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{border-top-width:1px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.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 To(){return g.useEffect(()=>{if(typeof document<"u"){const e=document.createElement("style");return e.textContent=Eo,document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]),null}const Oo={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:[]}}},Nn=vr.createSlice({name:"store",initialState:Oo,reducers:{setStore:(e,t)=>{e.store=t.payload}}}),{setStore:Ra}=Nn.actions,Ao=Nn.reducer,$o={product:null},Cn=vr.createSlice({name:"product",initialState:$o,reducers:{setProduct:(e,t)=>{e.product=t.payload}}}),{setProduct:cr}=Cn.actions,Lo=Cn.reducer,Do=vr.configureStore({reducer:{store:Ao,product:Lo}}),zo=({children:e})=>n.jsx(ot.Provider,{store:Do,children:e}),Jt=e=>{const t=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:e}});window.dispatchEvent(t)};function Mo({...e}){return n.jsx(Sn.Root,{"data-slot":"popover",...e})}function qo({...e}){return n.jsx(Sn.Trigger,{"data-slot":"popover-trigger",...e})}const st=()=>({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"}),_n=async()=>{const e="https://tanya-sfcc-server.vercel.app/";try{const t=await we.post(`${e}api/auth/token-bm-grant?baseUrl=${Qe()}&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 we.isAxiosError(t)?console.error("Error fetching token:",t.response||t.message):console.error("Unexpected error:",t),null}},In=async e=>{const t="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await we.post(`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Qe()}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return o.status===200&&o.data?o.data:null}catch(r){return we.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function gt(){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 dr=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}},Qe=()=>sessionStorage.getItem("Host"),Be=()=>sessionStorage.getItem("SiteId"),at=()=>sessionStorage.getItem("pubCfg"),it=()=>sessionStorage.getItem("envRef"),lt=()=>sessionStorage.getItem("orgRef"),Bo=async e=>{console.log("fetching results");const{serverUrl:t,basePath:r}=st();let o="";{const s=await gt();console.log("the token from getSearchResults",s),o=s.access_token}try{const s=Qe();return(await we.get(`${t}${r}/search-sfcc?baseUrl=${s}&query=${e}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(s){throw console.error("Error fetching search results:",s),s}},Fn=async e=>{if(!e)throw new Error("Product ID is required");const{serverUrl:t,basePath:r}=st(),o=Qe();console.log("calling access");const{access_token:s}=await gt();return(await we.get(`${t}${r}/product-sfcc/${e}?baseUrl=${o}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).data},Ro=async e=>{if(!e)throw new Error("customerId is required");const t=await _n(),{customer_token:r}=await In(t),{serverUrl:o,basePath:s}=st(),i=(await gt()).access_token;return(await we.get(`${o}${s}/get-interest?baseUrl=${Qe()}&customerId=${e}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},Ur=e=>String(typeof e=="string"?e:e["en-US"]||e),Hr=e=>e!=null&&e.image?[e.image]:"variants"in e?e.variants[0].images:e.masterVariant.images.map(t=>t.url),Uo=(e,t)=>e.toLocaleString("en-US",{style:"currency",currency:t||"USD"}),Vr=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}},Ho=e=>e.charAt(0).toUpperCase()+e.slice(1),Yr=(e,t)=>e.length<t?e:e.slice(0,t)+"...",rr=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 Vo(){const e=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[t,r]=g.useState(e);return g.useEffect(()=>{const o=()=>r(e());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}const Yo=({product:e})=>{const t=ot.useDispatch(),r=Vo(),[o,s]=g.useState(0),a=()=>{s(l=>l+r>=e.length?0:l+r)},i=()=>{s(l=>l-r<0?e.length-(e.length%r||r):l-r)},c=async l=>{const h=await Fn(l);t(cr(h))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:i,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:e.slice(o,o+r).map(l=>{var h,p,b,y;return n.jsxs("div",{className:"flex-shrink-0 flex flex-col w-[150px] h-[200px] p-2 items-center justify-between cursor-pointer bg-[#FFFFFF] rounded-[10px] shadow-[0px_2px_2px_0px_#9292BC40]",onClick:()=>{c(l.product_id??l.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((h=Hr(l)[0])==null?void 0:h.link)||Hr(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:Yr(Ur((p=l==null?void 0:l.name)==null?void 0:p["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:l!=null&&l.productName?l.productName:l!=null&&l.product_name?l.product_name:Yr(Ur((b=l==null?void 0:l.name)==null?void 0:b["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:Uo(l!=null&&l.price?Number(l==null?void 0:l.price):Vr(l).centAmount||0,(y=Vr(l))==null?void 0:y.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(l==null?void 0:l.price).toFixed(2)??5]})]})]})]},l.productId)})}),(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:a,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},Jo=({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:Ho(r.keyword)||"No keyword"}),n.jsx(Yo,{product:r.items,storeDetails:t})]},o))}),Pn=async(e,t)=>{var a,i;const{serverUrl:r,basePath:o}=st(),s=`${r}`;try{const c=await we.post(`${s}${o}/basket/create?baseUrl=${Qe()}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,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 we.isAxiosError(c)?console.error("Error creating basket:",c.response||c.message):console.error("Unexpected error:",c),null}},ur=async(e,t,r)=>{const{serverUrl:o,basePath:s}=st(),a=`${o}`;try{const i=await we.post(`${a}${s}/basket/add-product/${e}?baseUrl=${Qe()}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,t,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return we.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},En=async({basketId:e,customer_token:t})=>{var a;const{serverUrl:r,basePath:o}=st(),s=`${r}`;try{const i=await we.get(`${s}${o}/basket/${e}?baseUrl=${Qe()}&siteId=${Be()}&pubCfg=${at()}&envRef=${it()}&orgRef=${lt()}`,{headers:{"Content-Type":"application/json",Authorization:t}});return{status:i.status,data:i.data}}catch(i){return we.isAxiosError(i)?{status:(a=i.response)==null?void 0:a.status,data:null}:{status:null,data:null}}},Kt="sfcc_basket_id",Jr="sfcc_customer_token",Ft="sfcc_token_expiry",Ko=300*1e3,Dt="1.0.0";const nt=e=>{try{e?localStorage.setItem(Kt,e):localStorage.removeItem(Kt)}catch(t){console.error("Error saving basket ID to storage:",t)}},Wt=e=>{try{if(e){localStorage.setItem(Jr,e);const t=Date.now()+Ko;localStorage.setItem(Ft,t.toString())}else localStorage.removeItem(Jr)}catch(t){console.error("Error storing token:",t)}},Kr=300,Wo=({addToCartPwa:e})=>{var l,h,p,b,y,N;const t=ot.useDispatch(),r=ot.useSelector(S=>S.product.product),o=ot.useSelector(S=>S.store.store),[s,a]=g.useState(!!r);if(g.useEffect(()=>{a(!!r)},[r]),!r)return null;const i=async()=>{var S,I,j,C,Y,M,x,Ce,F,J,de,ye,te,_e,be,pe;try{if(!((I=(S=r==null?void 0:r.variants)==null?void 0:S[0])!=null&&I.product_id)&&!(r.type.item||r.type.bundle)&&!((C=(j=r==null?void 0:r.variants)==null?void 0:j[0])!=null&&C.productId)){Le.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const q=[{product_id:((Y=r.variants)==null?void 0:Y[0].product_id)||((M=r.variants)==null?void 0:M[0].productId)||(r==null?void 0:r.id),quantity:1}],O=JSON.parse(sessionStorage.getItem("customerData")||"{}"),ue=(O==null?void 0:O.basketId)||localStorage.getItem(Kt),K=!1,Re=localStorage.getItem(Ft),Ue=Date.now();if(!K||!Re||Ue>=parseInt(Re)){let X="";if(X="Bearer "+(await gt()).access_token,!X){console.error("Failed to get customer_token");return}const ct=Ue+300*1e3;if(Wt(X),localStorage.setItem(Ft,ct.toString()),ue){const ge=await En({basketId:ue,customer_token:X});if(ge.status===200&&ge){const Ie=await ur(ue,q,X);(((x=Ie==null?void 0:Ie.product_items)==null?void 0:x.length)>0||((Ce=Ie==null?void 0:Ie.productItems)==null?void 0:Ce.length)>0)&&(Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(ue));return}}const xt={productItems:[{productId:((F=r.variants)==null?void 0:F[0].product_id)||((J=r.variants)==null?void 0:J[0].productId)||(r==null?void 0:r.id),quantity:1}]},L=await Pn(X,xt);if(!(L!=null&&L.basket_id)&&!(L!=null&&L.basketId)){console.error("Failed to create basket");return}nt((L==null?void 0:L.basket_id)||(L==null?void 0:L.basketId)),console.log("adding product to basket");const Te=await ur((L==null?void 0:L.basket_id)||(L==null?void 0:L.basketId),q,X);console.log("object added to basket"),(((de=Te==null?void 0:Te.product_items)==null?void 0:de.length)>0||((ye=Te==null?void 0:Te.productItems)==null?void 0:ye.length)>0)&&Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(L.basket_id||(L==null?void 0:L.basketId))}}catch(q){console.error("Error adding to cart:",q),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((te=q==null?void 0:q.response)==null?void 0:te.status)===404||((_e=q==null?void 0:q.response)==null?void 0:_e.status)===401?(((be=q==null?void 0:q.response)==null?void 0:be.status)===404&&nt(null),((pe=q==null?void 0:q.response)==null?void 0:pe.status)===401&&(nt(null),Wt(null))):(console.error("Failed to add product to basket:",q.message),Le.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(cr(null)),Kr)}}),n.jsxs("div",{className:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),n=require("react/jsx-runtime"),Vt=require("@apollo/client"),st=require("react-redux"),wr=require("@reduxjs/toolkit"),So=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const fe=require("axios");require("crypto-js");const No=require("@iconify/react"),Pe=require("react-toastify"),Co=require("react-dom");function _o(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 vn=_o(So),Io='*,: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{border-top-width:1px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.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 Fo(){return x.useEffect(()=>{if(typeof document<"u"){const e=document.createElement("style");return e.textContent=Io,document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]),null}const Po={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:[]}}},jn=wr.createSlice({name:"store",initialState:Po,reducers:{setStore:(e,t)=>{e.store=t.payload}}}),{setStore:Ma}=jn.actions,Eo=jn.reducer,To={product:null},kn=wr.createSlice({name:"product",initialState:To,reducers:{setProduct:(e,t)=>{e.product=t.payload}}}),{setProduct:ir}=kn.actions,Oo=kn.reducer,Ao=wr.configureStore({reducer:{store:Eo,product:Oo}}),$o=({children:e})=>n.jsx(st.Provider,{store:Ao,children:e}),Yt=e=>{const t=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:e}});window.dispatchEvent(t)},Lo=(e=[],t)=>{console.log(t,"the option");let{viewType:r,selectedVariationAttributes:o={}}=t;e=e.filter(({viewType:a})=>a===r);const s=[...new Set(e.reduce((a,{variationAttributes:i=[]})=>[...a,...i],[]).map(({id:a})=>a))];return o=Object.keys(o).reduce((a,i)=>s.includes(i)?{...a,[`${i}`]:o[i]}:a,{}),e=e.find(({variationAttributes:a=[]})=>Object.keys(o).every(c=>{const l=o[c];return a.find(({id:h,values:p})=>h===c&&p.every(({value:b})=>b===l))})),e};function Do({...e}){return n.jsx(vn.Root,{"data-slot":"popover",...e})}function zo({...e}){return n.jsx(vn.Trigger,{"data-slot":"popover-trigger",...e})}const at=()=>({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"}),Sn=async()=>{const e="https://tanya-sfcc-server.vercel.app/";try{const t=await fe.post(`${e}api/auth/token-bm-grant?baseUrl=${Je()}&siteId=${ze()}`);return t.status===200&&t.data.access_token?t.data.access_token:(console.error("Failed to fetch token:",t.data),null)}catch(t){return fe.isAxiosError(t)?console.error("Error fetching token:",t.response||t.message):console.error("Unexpected error:",t),null}},Nn=async e=>{const t="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await fe.post(`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Je()}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return o.status===200&&o.data?o.data:null}catch(r){return fe.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function xt(){var a;const e=ze(),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}},Je=()=>sessionStorage.getItem("Host"),ze=()=>sessionStorage.getItem("SiteId"),it=()=>sessionStorage.getItem("pubCfg"),lt=()=>sessionStorage.getItem("envRef"),ct=()=>sessionStorage.getItem("orgRef"),Mo=async e=>{console.log("fetching results");const{serverUrl:t,basePath:r}=at();let o="";{const s=await xt();console.log("the token from getSearchResults",s),o=s.access_token}try{const s=Je();return(await fe.get(`${t}${r}/search-sfcc?baseUrl=${s}&query=${e}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(s){throw console.error("Error fetching search results:",s),s}},Cn=async e=>{if(!e)throw new Error("Product ID is required");const{serverUrl:t,basePath:r}=at(),o=Je();console.log("calling access");const{access_token:s}=await xt();return(await fe.get(`${t}${r}/product-sfcc/${e}?baseUrl=${o}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})).data},Bo=async e=>{if(!e)throw new Error("customerId is required");const t=await Sn(),{customer_token:r}=await Nn(t),{serverUrl:o,basePath:s}=at(),i=(await xt()).access_token;return(await fe.get(`${o}${s}/get-interest?baseUrl=${Je()}&customerId=${e}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},Br=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),qo=(e,t)=>e.toLocaleString("en-US",{style:"currency",currency:t||"USD"}),Rr=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}},Ro=e=>e.charAt(0).toUpperCase()+e.slice(1),Ur=(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 Uo(){const e=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[t,r]=x.useState(e);return x.useEffect(()=>{const o=()=>r(e());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),t}const Ho=({product:e})=>{const t=st.useDispatch(),r=Uo(),[o,s]=x.useState(0),a=()=>{s(l=>l+r>=e.length?0:l+r)},i=()=>{s(l=>l-r<0?e.length-(e.length%r||r):l-r)},c=async l=>{const h=await Cn(l);t(ir(h))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(e==null?void 0:e.length)>r&&n.jsx("button",{onClick:i,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:e.slice(o,o+r).map(l=>{var h,p,b,v;return n.jsxs("div",{className:"flex-shrink-0 flex flex-col w-[150px] h-[200px] p-2 items-center justify-between cursor-pointer bg-[#FFFFFF] rounded-[10px] shadow-[0px_2px_2px_0px_#9292BC40]",onClick:()=>{c(l.product_id??l.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((h=qr(l)[0])==null?void 0:h.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:Ur(Br((p=l==null?void 0:l.name)==null?void 0:p["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:l!=null&&l.productName?l.productName:l!=null&&l.product_name?l.product_name:Ur(Br((b=l==null?void 0:l.name)==null?void 0:b["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:qo(l!=null&&l.price?Number(l==null?void 0:l.price):Rr(l).centAmount||0,(v=Rr(l))==null?void 0:v.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:">"})]})})},Vo=({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:Ro(r.keyword)||"No keyword"}),n.jsx(Ho,{product:r.items,storeDetails:t})]},o))}),_n=async(e,t)=>{var a,i;const{serverUrl:r,basePath:o}=at(),s=`${r}`;try{const c=await fe.post(`${s}${o}/basket/create?baseUrl=${Je()}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,t,{headers:{"Content-Type":"application/json",Authorization:e}});return window.postMessage({type:"WIDGET_CREATED_BASKET",basketId:((a=c.data)==null?void 0:a.basket_id)||((i=c.data)==null?void 0:i.basketId)},"*"),c.data}catch(c){return fe.isAxiosError(c)?console.error("Error creating basket:",c.response||c.message):console.error("Unexpected error:",c),null}},cr=async(e,t,r)=>{const{serverUrl:o,basePath:s}=at(),a=`${o}`;try{const i=await fe.post(`${a}${s}/basket/add-product/${e}?baseUrl=${Je()}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,t,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return fe.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},In=async({basketId:e,customer_token:t})=>{var a;const{serverUrl:r,basePath:o}=at(),s=`${r}`;try{const i=await fe.get(`${s}${o}/basket/${e}?baseUrl=${Je()}&siteId=${ze()}&pubCfg=${it()}&envRef=${lt()}&orgRef=${ct()}`,{headers:{"Content-Type":"application/json",Authorization:t}});return{status:i.status,data:i.data}}catch(i){return fe.isAxiosError(i)?{status:(a=i.response)==null?void 0:a.status,data:null}:{status:null,data:null}}},Jt="sfcc_basket_id",Hr="sfcc_customer_token",Ft="sfcc_token_expiry",Yo=300*1e3,Lt="1.0.0";const nt=e=>{try{e?localStorage.setItem(Jt,e):localStorage.removeItem(Jt)}catch(t){console.error("Error saving basket ID to storage:",t)}},Kt=e=>{try{if(e){localStorage.setItem(Hr,e);const t=Date.now()+Yo;localStorage.setItem(Ft,t.toString())}else localStorage.removeItem(Hr)}catch(t){console.error("Error storing token:",t)}},Vr=300,Jo=({addToCartPwa:e})=>{var l,h,p,b,v,C;const t=st.useDispatch(),r=st.useSelector(S=>S.product.product),o=st.useSelector(S=>S.store.store),[s,a]=x.useState(!!r);if(x.useEffect(()=>{a(!!r)},[r]),!r)return null;const i=async()=>{var S,F,j,_,M,B,W,Ce,g,R,xe,me,re,Ke,we,Q;try{if(!((F=(S=r==null?void 0:r.variants)==null?void 0:S[0])!=null&&F.product_id)&&!(r.type.item||r.type.bundle)&&!((_=(j=r==null?void 0:r.variants)==null?void 0:j[0])!=null&&_.productId)){Pe.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const A=[{product_id:((M=r.variants)==null?void 0:M[0].product_id)||((B=r.variants)==null?void 0:B[0].productId)||(r==null?void 0:r.id),quantity:1}],L=JSON.parse(sessionStorage.getItem("customerData")||"{}"),Ee=(L==null?void 0:L.basketId)||localStorage.getItem(Jt),Te=!1,he=localStorage.getItem(Ft),U=Date.now();if(!Te||!he||U>=parseInt(he)){let pe="";if(pe="Bearer "+(await xt()).access_token,!pe){console.error("Failed to get customer_token");return}const Me=U+300*1e3;if(Kt(pe),localStorage.setItem(Ft,Me.toString()),Ee){const Se=await In({basketId:Ee,customer_token:pe});if(Se.status===200&&Se){const Ie=await cr(Ee,A,pe);(((W=Ie==null?void 0:Ie.product_items)==null?void 0:W.length)>0||((Ce=Ie==null?void 0:Ie.productItems)==null?void 0:Ce.length)>0)&&(Pe.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(Ee));return}}const be={productItems:[{productId:((g=r.variants)==null?void 0:g[0].product_id)||((R=r.variants)==null?void 0:R[0].productId)||(r==null?void 0:r.id),quantity:1}]},D=await _n(pe,be);if(!(D!=null&&D.basket_id)&&!(D!=null&&D.basketId)){console.error("Failed to create basket");return}nt((D==null?void 0:D.basket_id)||(D==null?void 0:D.basketId)),console.log("adding product to basket");const _e=await cr((D==null?void 0:D.basket_id)||(D==null?void 0:D.basketId),A,pe);console.log("object added to basket"),(((xe=_e==null?void 0:_e.product_items)==null?void 0:xe.length)>0||((me=_e==null?void 0:_e.productItems)==null?void 0:me.length)>0)&&Pe.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(D.basket_id||(D==null?void 0:D.basketId))}}catch(A){console.error("Error adding to cart:",A),Pe.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((re=A==null?void 0:A.response)==null?void 0:re.status)===404||((Ke=A==null?void 0:A.response)==null?void 0:Ke.status)===401?(((we=A==null?void 0:A.response)==null?void 0:we.status)===404&&nt(null),((Q=A==null?void 0:A.response)==null?void 0:Q.status)===401&&(nt(null),Kt(null))):(console.error("Failed to add product to basket:",A.message),Pe.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)),Vr)}}),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(cr(null)),Kr)},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:(b=(p=(h=(l=r.imageGroups)==null?void 0:l[0])==null?void 0:h.images)==null?void 0:p[0])==null?void 0:b.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(I=>n.jsx("img",{src:I.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},I.link)))})]}),n.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[n.jsxs("div",{className:"flex flex-row items-center gap-2",children:[n.jsxs("p",{className:"text-[#14121F] font-bold font-nunitoSans",children:[" ","$",r.price.toFixed(2)]})," ",n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans",children:[" ","$",(r.price+5).toFixed(2)]})]}),n.jsx("div",{children:n.jsx("p",{className:"text-[#EC5050] font-bold font-nunitoSans",children:r.discount})})]}),n.jsx("div",{className:"mt-2 w-full border-t-2 border-gray-200"}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("div",{className:"text-[#323135] font-bold font-nunitoSans mt-3 text-[14px]",children:"Product Details"}),n.jsx("div",{className:"text-[#68656E] font-normal font-nunitoSans text-xs pl-2 mt-3",dangerouslySetInnerHTML:{__html:r.short_description||r.longDescription}})]}),n.jsxs("div",{className:"mt-4 flex flex-col gap-2 w-full p-2",children:[n.jsx("div",{className:"flex flex-row items-center gap-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-left font-nunitoSans",children:[n.jsxs("div",{className:"text-[#323135] font-bold",children:[((y=r==null?void 0:r.rating)==null?void 0:y.rate)||0," /"," ",n.jsx("span",{className:"text-[#68656E]",children:"5"})]}),n.jsx("div",{className:"text-[#323135] font-semibold text-sm",children:"Overall Rating"}),n.jsxs("div",{className:"text-[#68656E] font-semibold text-sm",children:[((N=r==null?void 0:r.rating)==null?void 0:N.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((S,I)=>{var j;return n.jsx(Io.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
6
- ${((j=r==null?void 0:r.rating)==null?void 0:j.rate)>I?"text-yellow-500":"text-gray-300"}
7
- `},I)})})]}),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"})]})]})]})},Go=({tanyaConfig:e,basketId:t,addToCart:r})=>{const o=["Myself","My Child","My Grandchild","Niece/Nephew","My Friends","Others"],s={Myself:"himself/herself","My Child":"his/her child","My Grandchild":"his/her grandchild","Niece/Nephew":"his/her niece/nephew","My Friends":"his/her friends",Others:"others"},a=g.useRef(null),i=g.useRef(null),c=g.useRef(null),l=g.useRef(null),[h,p]=g.useState(null);g.useRef(null);const[b,y]=g.useState(!1),[N,S]=g.useState(!1),[I,j]=g.useState(!1),[C,Y]=g.useState(!1),[M,x]=g.useState(!1),[Ce,F]=g.useState(!1),[J,de]=g.useState(""),[ye,te]=g.useState(""),_e=m=>({id:m.id,title:m.name,image:m.image??"",price:m.price??0}),[be,pe]=g.useState([]),q=g.useRef(null),O=ot.useSelector(m=>m.store.store),ue=ot.useSelector(m=>m.product.product);g.useEffect(()=>{const m=localStorage.getItem(`access_token_${e.siteId}`),z=localStorage.getItem(`chat-token-${e.siteId}`);if(m&&z===m){const P=localStorage.getItem("chatHistory");P&&pe(JSON.parse(P))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${e.siteId}`,m||"")},[]),g.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 K=()=>{j(!0),setTimeout(()=>S(!0),10)},Re=()=>{S(!1),setTimeout(()=>j(!1),300)};g.useEffect(()=>{b?K():Re()},[b]);const Ue=m=>{te(s[m])};g.useEffect(()=>{I&&q.current&&q.current.scrollTo({top:q.current.scrollHeight,behavior:"smooth"})},[be,I]);const X=null,ct=null,xt=async()=>{const m=await gt();m!=null&&p(m)};g.useEffect(()=>{if(e!=null&&e.siteId){const{clientID:m,host:z,organizationID:P,shortCode:R,siteId:U}=e;sessionStorage.setItem("Host",z),sessionStorage.setItem("SiteId",U),sessionStorage.setItem("pubCfg",btoa(m)),sessionStorage.setItem("envRef",R),sessionStorage.setItem("orgRef",P)}xt(),console.log("scapi environment v1")},[]),g.useEffect(()=>{t&&(console.log("setting the basket id",t),nt(t))},[t]);const L=async()=>{const m=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await Ro(m||"")).c_interests},Te=async(m,z)=>{console.log("in secondary flow",Dt);const P=await L();if(console.log(P,"interests of customer",Dt),!!P)try{pe(ve=>ve.map((Z,G)=>G===ve.length-1?{...Z,secondaryLoading:!0}:Z));const R=await dr(X,ct);if(!R)throw new Error("Failed to fetch token");const U=localStorage.getItem("customerNumber"),E=localStorage.getItem("isLoggedIn"),re=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(E||!1),userId:String(U||new Date().getTime())}).toString()}`,A=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:m,productPoints:String(z||0),interests:P}}),B=await fetch(re,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`},body:A});if(!B.body)throw new Error("Readable stream not supported");const Fe=B.body.getReader(),fe=new TextDecoder;let se="";for(;;){const{done:ve,value:Z}=await Fe.read();if(ve)break;se+=fe.decode(Z,{stream:!0});const G=se.split(`
8
- `);se=G.pop()||"";for(const Pe of G)if(Pe.startsWith("data:")){const k=Pe.slice(5).trim();try{const ae=JSON.parse(k);ae.index===0&&pe($=>$.map((ie,Oe)=>Oe===$.length-1?{...ie,secondaryResponse:ae.data,secondaryLoading:!1}:ie))}catch(ae){pe($=>$.map((ie,Oe)=>Oe===$.length-1?{...ie,secondaryLoading:!1}:ie)),console.error("Secondary flow JSON parse error:",ae)}}}}catch(R){console.error("Secondary flow error:",R)}},ge=async m=>{const z=m||J.trim();if(z){x(!0),de(""),a.current=null,i.current=null,c.current=null,l.current=null,pe(P=>[...P,{query:z,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const P=ye,R=localStorage.getItem("customerNumber"),U=localStorage.getItem("isLoggedIn"),E=await dr(X,ct);if(!E)throw new Error("Failed to obtain access token");const re=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(U||!1),userId:String(R||new Date().getTime())}).toString()}`,A=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:z,whom:P}}),B=await fetch(re,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${E}`},body:A});if(!B.ok)throw new Error(`HTTP error! status: ${B.status}`);if(!B.body)throw new Error("Readable stream not supported");const Fe=B.body.getReader(),fe=new TextDecoder;let se="",ve="";for(;;){F(!0);const{done:Z,value:G}=await Fe.read();if(Z)break;se+=fe.decode(G,{stream:!0});const Pe=se.split(`
9
- `);se=Pe.pop()||"";for(const k of Pe)if(k.startsWith("data:")){const ae=k.slice(5).trim();try{const $=JSON.parse(ae);$.index==1&&(ve=$.data),pe(ie=>ie.map((Oe,De)=>De===ie.length-1?{...Oe,[$.index==0?"response":$.index==1?"keywords":$.index==2?"potentialQuestions":"end"]:$.data}:Oe))}catch($){console.error("Error parsing JSON:",$)}}}wt(Ie(ve))}catch(P){console.error("Error sending message to Tanya:",P)}finally{x(!1)}}},Ie=m=>{const z=m.match(/top five relevant product or category names are: (.*)/i),U=(z?z[1]:m).split(", ").map(W=>W.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(U)].filter(Boolean).join(",")},wt=async m=>{var P,R,U;const z=typeof m=="string"?m.split(","):m;F(!0);try{const E=await Promise.all(z.map(A=>Bo(A).catch(()=>[]))),W=z.map((A,B)=>({keyword:A,items:E[B]??[],loading:!1})).filter(A=>A.items.length>0),re=(R=(P=W[0])==null?void 0:P.items)==null?void 0:R[0];if(re){i.current=re.product_id,a.current=re.product_name,c.current=(U=re.image)==null?void 0:U.link;const A=typeof re.price=="number"?re.price:null;l.current=A}if(pe(A=>A.map((B,Fe)=>Fe===A.length-1?{...B,products:W,productSnapshot:re?{id:i.current,name:a.current,image:c.current,price:l.current,points:0,quantity:1}:B.productSnapshot}:B)),re){const A=JSON.parse(sessionStorage.getItem("customerData")||"{}");A!=null&&A.isGuest||(console.log("running secondary flow",Dt),Te(a.current,0))}}catch(E){console.error("error in keyword search",E)}finally{F(!1)}},Zt=async(m,z)=>{var P,R,U,E,W,re,A,B,Fe,fe,se,ve,Z,G,Pe;Y(!0);try{const k=await Fn(m.id);if(!((R=(P=k==null?void 0:k.variants)==null?void 0:P[0])!=null&&R.product_id||(E=(U=k==null?void 0:k.variants)==null?void 0:U[0])!=null&&E.productId)&&!(k.type.item||k.type.bundle)){Y(!1),Le.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const ae=[{product_id:((W=k.variants)==null?void 0:W[0].product_id)||((re=k.variants)==null?void 0:re[0].productId)||(k==null?void 0:k.id),quantity:z}];console.log(ae,"product data","app version",Dt);const $=JSON.parse(sessionStorage.getItem("customerData")||"{}"),ie=($==null?void 0:$.basketId)||localStorage.getItem(Kt),Oe=!1,De=localStorage.getItem(Ft),yt=Date.now();if(!Oe||!De||yt>=parseInt(De)){const bt=await _n();let{customer_token:ze}=await In(bt);if(ze="Bearer "+h.access_token,!ze){console.error("Failed to get customer_token");return}const Et=yt+300*1e3;if(Wt(ze),localStorage.setItem(Ft,Et.toString()),console.log(ie,"basketIdFromCustomer"),ie){const Ot=await En({basketId:ie,customer_token:ze});if(Ot.status===200&&Ot){const Ve=await ur(ie,ae,ze);((A=Ve==null?void 0:Ve.product_items)==null?void 0:A.length)>0&&(Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(ie),Y(!1));return}}const Tt={productItems:[{productId:((B=k.variants)==null?void 0:B[0].product_id)||((Fe=k.variants)==null?void 0:Fe[0].productId)||(k==null?void 0:k.id),quantity:1}]},T=await Pn(ze,Tt);if(console.log(T,T==null?void 0:T.basket_id,T==null?void 0:T.basketId,"the basket response"),!(T!=null&&T.basket_id||!(T!=null&&T.basketId))){Y(!1),console.error("Failed to create basket");return}nt((T==null?void 0:T.basket_id)||(T==null?void 0:T.basketId));const He=await r({productId:i,quantity:z},(T==null?void 0:T.basket_id)||(T==null?void 0:T.basketId));(((fe=He==null?void 0:He.product_items)==null?void 0:fe.length)>0||((se=He==null?void 0:He.productItems)==null?void 0:se.length)>0)&&Le.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Jt(T.basket_id||(T==null?void 0:T.basketId))}}catch(k){Y(!1),console.error("Error adding to cart:",k),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((ve=k==null?void 0:k.response)==null?void 0:ve.status)===404||((Z=k==null?void 0:k.response)==null?void 0:Z.status)===401?(((G=k==null?void 0:k.response)==null?void 0:G.status)===404&&nt(null),((Pe=k==null?void 0:k.response)==null?void 0:Pe.status)===401&&(nt(null),Wt(null))):(console.error("Failed to add product to basket:",k.message),Le.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}Y(!1)};return g.useEffect(()=>{I?setTimeout(()=>S(!0),10):S(!1)},[I]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(Mo,{open:b,onOpenChange:y,children:[n.jsx(qo,{onClick:()=>y(!0),style:{},className:"flex items-center rounded-lg cursor-pointer hover:opacity-90 transition-opacity p-0",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_958_585)",children:[n.jsx("path",{d:"M30.0002 5C31.7683 5 33.464 5.70238 34.7142 6.95262C35.9644 8.20286 36.6668 9.89856 36.6668 11.6667V25C36.6668 26.7681 35.9644 28.4638 34.7142 29.714C33.464 30.9643 31.7683 31.6667 30.0002 31.6667H25.6902L21.1785 36.1783C20.8915 36.4653 20.5097 36.6377 20.1046 36.6631C19.6996 36.6886 19.2992 36.5654 18.9785 36.3167L18.8218 36.1783L14.3085 31.6667H10.0002C8.28976 31.6667 6.64478 31.0093 5.40548 29.8305C4.16617 28.6516 3.42735 27.0416 3.34183 25.3333L3.3335 25V11.6667C3.3335 9.89856 4.03588 8.20286 5.28612 6.95262C6.53636 5.70238 8.23205 5 10.0002 5H30.0002Z",fill:"url(#paint0_linear_958_585)"}),n.jsx("path",{d:"M28.3335 15.6511V11.6667C28.3335 11.6667 22.2774 12.6042 20.1148 15.4167C17.9521 18.2292 18.6644 26.6667 18.6644 26.6667H22.5321C22.5321 26.6667 22.0614 18.9323 23.4989 17.2917C24.9364 15.6511 28.3335 15.6511 28.3335 15.6511Z",fill:"white"}),n.jsx("path",{d:"M13.3335 11.6667H19.6184V15.4167H13.3335V11.6667Z",fill:"white"})]}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_958_585",x1:"20.0002",y1:"5",x2:"35.0002",y2:"30",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"#452697"}),n.jsx("stop",{offset:"1",stopColor:"#7C5BFF"})]}),n.jsx("clipPath",{id:"clip0_958_585",children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})]})]})})}),I&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>y(!1)}),n.jsxs("div",{className:`
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)),Vr)},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:(b=(p=(h=(l=r.imageGroups)==null?void 0:l[0])==null?void 0:h.images)==null?void 0:p[0])==null?void 0:b.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(F=>n.jsx("img",{src:F.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},F.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:[((v=r==null?void 0:r.rating)==null?void 0:v.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,F)=>{var j;return n.jsx(No.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
6
+ ${((j=r==null?void 0:r.rating)==null?void 0:j.rate)>F?"text-yellow-500":"text-gray-300"}
7
+ `},F)})})]}),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"})]})]})]})},Ko=({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=x.useRef(null),i=x.useRef(null),c=x.useRef(null),l=x.useRef(null),[h,p]=x.useState(null);x.useRef(null);const[b,v]=x.useState(!1),[C,S]=x.useState(!1),[F,j]=x.useState(!1),[_,M]=x.useState(!1),[B,W]=x.useState(!1),[Ce,g]=x.useState(!1),[R,xe]=x.useState(""),[me,re]=x.useState(""),Ke=m=>({id:m.id,title:m.name,image:m.image??"",price:m.price??0}),[we,Q]=x.useState([]),A=x.useRef(null),L=st.useSelector(m=>m.store.store),Ee=st.useSelector(m=>m.product.product);x.useEffect(()=>{const m=localStorage.getItem(`access_token_${e.siteId}`),q=localStorage.getItem(`chat-token-${e.siteId}`);if(m&&q===m){const z=localStorage.getItem("chatHistory");z&&Q(JSON.parse(z))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${e.siteId}`,m||"")},[]),x.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify(we));const m=localStorage.getItem(`access_token_${e.siteId}`);m&&localStorage.setItem(`chat-token-${e.siteId}`,m)},[we]);const Te=()=>{j(!0),setTimeout(()=>S(!0),10)},he=()=>{S(!1),setTimeout(()=>j(!1),300)};x.useEffect(()=>{b?Te():he()},[b]);const U=m=>{re(s[m])};x.useEffect(()=>{F&&A.current&&A.current.scrollTo({top:A.current.scrollHeight,behavior:"smooth"})},[we,F]);const pe=null,Me=null,be=async()=>{const m=await xt();m!=null&&p(m)};x.useEffect(()=>{if(e!=null&&e.siteId){const{clientID:m,host:q,organizationID:z,shortCode:J,siteId:T}=e;sessionStorage.setItem("Host",q),sessionStorage.setItem("SiteId",T),sessionStorage.setItem("pubCfg",btoa(m)),sessionStorage.setItem("envRef",J),sessionStorage.setItem("orgRef",z)}be(),console.log("scapi environment v1")},[]),x.useEffect(()=>{t&&(console.log("setting the basket id",t),nt(t))},[t]);const D=async()=>{const m=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await Bo(m||"")).c_interests},_e=async(m,q)=>{console.log("in secondary flow",Lt);const z=await D();if(console.log(z,"interests of customer",Lt),!!z)try{Q(X=>X.map((ae,ve)=>ve===X.length-1?{...ae,secondaryLoading:!0}:ae));const J=await lr(pe,Me);if(!J)throw new Error("Failed to fetch token");const T=localStorage.getItem("customerNumber"),P=localStorage.getItem("isLoggedIn"),H=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(P||!1),userId:String(T||new Date().getTime())}).toString()}`,$=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:m,productPoints:String(q||0),interests:z}}),G=await fetch(H,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`},body:$});if(!G.body)throw new Error("Readable stream not supported");const Z=G.body.getReader(),ue=new TextDecoder;let ge="";for(;;){const{done:X,value:ae}=await Z.read();if(X)break;ge+=ue.decode(ae,{stream:!0});const ve=ge.split(`
8
+ `);ge=ve.pop()||"";for(const ee of ve)if(ee.startsWith("data:")){const k=ee.slice(5).trim();try{const ye=JSON.parse(k);ye.index===0&&Q(O=>O.map((V,K)=>K===O.length-1?{...V,secondaryResponse:ye.data,secondaryLoading:!1}:V))}catch(ye){Q(O=>O.map((V,K)=>K===O.length-1?{...V,secondaryLoading:!1}:V)),console.error("Secondary flow JSON parse error:",ye)}}}}catch(J){console.error("Secondary flow error:",J)}},Se=async m=>{const q=m||R.trim();if(q){W(!0),xe(""),a.current=null,i.current=null,c.current=null,l.current=null,Q(z=>[...z,{query:q,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const z=me,J=localStorage.getItem("customerNumber"),T=localStorage.getItem("isLoggedIn"),P=await lr(pe,Me);if(!P)throw new Error("Failed to obtain access token");const H=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(T||!1),userId:String(J||new Date().getTime())}).toString()}`,$=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:q,whom:z}}),G=await fetch(H,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${P}`},body:$});if(!G.ok)throw new Error(`HTTP error! status: ${G.status}`);if(!G.body)throw new Error("Readable stream not supported");const Z=G.body.getReader(),ue=new TextDecoder;let ge="",X="";for(;;){g(!0);const{done:ae,value:ve}=await Z.read();if(ae)break;ge+=ue.decode(ve,{stream:!0});const ee=ge.split(`
9
+ `);ge=ee.pop()||"";for(const k of ee)if(k.startsWith("data:")){const ye=k.slice(5).trim();try{const O=JSON.parse(ye);O.index==1&&(X=O.data),Q(V=>V.map((K,We)=>We===V.length-1?{...K,[O.index==0?"response":O.index==1?"keywords":O.index==2?"potentialQuestions":"end"]:O.data}:K))}catch(O){console.error("Error parsing JSON:",O)}}}Oe(Ie(X))}catch(z){console.error("Error sending message to Tanya:",z)}finally{W(!1)}}},Ie=m=>{const q=m.match(/top five relevant product or category names are: (.*)/i),T=(q?q[1]:m).split(", ").map(ne=>ne.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(T)].filter(Boolean).join(",")},Oe=async m=>{var z,J,T;const q=typeof m=="string"?m.split(","):m;g(!0);try{const P=await Promise.all(q.map($=>Mo($).catch(()=>[]))),ne=q.map(($,G)=>({keyword:$,items:P[G]??[],loading:!1})).filter($=>$.items.length>0),H=(J=(z=ne[0])==null?void 0:z.items)==null?void 0:J[0];if(H){i.current=H.product_id,a.current=H.product_name,c.current=(T=H.image)==null?void 0:T.link;const $=typeof H.price=="number"?H.price:null;l.current=$}if(Q($=>$.map((G,Z)=>Z===$.length-1?{...G,products:ne,productSnapshot:H?{id:i.current,name:a.current,image:c.current,price:l.current,points:0,quantity:1}:G.productSnapshot}:G)),H){const $=JSON.parse(sessionStorage.getItem("customerData")||"{}");$!=null&&$.isGuest||(console.log("running secondary flow",Lt),_e(a.current,0))}}catch(P){console.error("error in keyword search",P)}finally{g(!1)}},wt=async(m,q)=>{var z,J,T,P,ne,H,$,G,Z,ue,ge,X,ae,ve,ee;M(!0);try{const k=await Cn(m.id);if(!((J=(z=k==null?void 0:k.variants)==null?void 0:z[0])!=null&&J.product_id||(P=(T=k==null?void 0:k.variants)==null?void 0:T[0])!=null&&P.productId)&&!(k.type.item||k.type.bundle)){M(!1),Pe.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const ye=[{product_id:((ne=k.variants)==null?void 0:ne[0].product_id)||((H=k.variants)==null?void 0:H[0].productId)||(k==null?void 0:k.id),quantity:q}];console.log(ye,"product data","app version",Lt);const O=JSON.parse(sessionStorage.getItem("customerData")||"{}"),V=(O==null?void 0:O.basketId)||localStorage.getItem(Jt),K=!1,We=localStorage.getItem(Ft),Et=Date.now();if(!K||!We||Et>=parseInt(We)){const dt=await Sn();let{customer_token:Ae}=await Nn(dt);if(Ae="Bearer "+h.access_token,!Ae){console.error("Failed to get customer_token");return}const yt=Et+300*1e3;if(Kt(Ae),localStorage.setItem(Ft,yt.toString()),console.log(V,"basketIdFromCustomer"),V){const Qe=await In({basketId:V,customer_token:Ae});if(Qe.status===200&&Qe){const oe=await cr(V,ye,Ae);(($=oe==null?void 0:oe.product_items)==null?void 0:$.length)>0&&(Pe.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(V),M(!1));return}}const Tt={productItems:[{productId:((G=k.variants)==null?void 0:G[0].product_id)||((Z=k.variants)==null?void 0:Z[0].productId)||(k==null?void 0:k.id),quantity:1}]},E=await _n(Ae,Tt);if(console.log(E,E==null?void 0:E.basket_id,E==null?void 0:E.basketId,"the basket response"),!(E!=null&&E.basket_id||!(E!=null&&E.basketId))){M(!1),console.error("Failed to create basket");return}nt((E==null?void 0:E.basket_id)||(E==null?void 0:E.basketId));const $e=await r({productId:i,quantity:q},(E==null?void 0:E.basket_id)||(E==null?void 0:E.basketId));(((ue=$e==null?void 0:$e.product_items)==null?void 0:ue.length)>0||((ge=$e==null?void 0:$e.productItems)==null?void 0:ge.length)>0)&&Pe.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Yt(E.basket_id||(E==null?void 0:E.basketId))}}catch(k){M(!1),console.error("Error adding to cart:",k),Pe.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((X=k==null?void 0:k.response)==null?void 0:X.status)===404||((ae=k==null?void 0:k.response)==null?void 0:ae.status)===401?(((ve=k==null?void 0:k.response)==null?void 0:ve.status)===404&&nt(null),((ee=k==null?void 0:k.response)==null?void 0:ee.status)===401&&(nt(null),Kt(null))):(console.error("Failed to add product to basket:",k.message),Pe.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}M(!1)};return x.useEffect(()=>{F?setTimeout(()=>S(!0),10):S(!1)},[F]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(Do,{open:b,onOpenChange:v,children:[n.jsx(zo,{onClick:()=>v(!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"})})]})]})})}),F&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>v(!1)}),n.jsxs("div",{className:`
10
10
  fixed z-50 h-screen w-[100vw] sm:w-[80vw] md:w-[770px] border-0 bg-white lg:rounded-l-xl overflow-hidden flex flex-col shadow-[0px_4px_10px_0px_#5F499840]
11
11
  top-0 right-0
12
12
  transition-transform duration-300 ease-in-out
13
13
  lg:transform lg:translate-y-0
14
14
 
15
- `,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>y(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${ue?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:q,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(O==null?void 0:O.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:()=>Ue(m),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:ye===s[m]?"#FFFFFF":"#F3F3F3",borderColor:ye===s[m]?"#BBB3DD":""},children:m},m))})]}),be.map((m,z)=>{var P,R;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:rr(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:rr(m.response)}})}),Ce&&!m.response.includes("Thinking")&&((P=m.products)==null?void 0:P.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)&&((R=m==null?void 0:m.products)==null?void 0:R.length)>0&&n.jsx(Jo,{chat:m.products,storeDetails:O}),(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:O.themeDarkColor},children:"Why not explore these inquiries..."}),m.potentialQuestions.split(",").map((U,E)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${O.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>ge(U),style:{backgroundColor:O.tanyaThemeColorLight},children:U},E))]}),(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:O.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:O.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:O.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:rr(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:O.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:(O==null?void 0:O.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:()=>pe(U=>U.map((E,W)=>W===z&&E.productSnapshot?{...E,productSnapshot:{...E.productSnapshot,quantity:Math.max(1,E.productSnapshot.quantity-1)}}:E)),style:{background:"transparent",color:O.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:()=>pe(U=>U.map((E,W)=>W===z&&E.productSnapshot?{...E,productSnapshot:{...E.productSnapshot,quantity:E.productSnapshot.quantity+1}}:E)),style:{background:"transparent",color:O.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{Zt(_e(m.productSnapshot),m.productSnapshot.quantity)},disabled:C,className:"px-4 py-2 rounded-full font-medium",style:{background:O.tanyaThemeColor,color:(O==null?void 0:O.tanyaThemeContrastColor)||"#fff",opacity:C?.8:1},children:C?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},z)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:J,autoFocus:!0,onChange:m=>de(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!M&&ge()}}),n.jsx("button",{type:"submit",disabled:M,className:"p-3",onClick:()=>ge(),children:M?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:O.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(Wo,{addToCartPwa:r})]})]})]})]})})};var fr=function(e,t){return fr=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])},fr(e,t)};function Qo(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");fr(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var We=function(){return We=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},We.apply(this,arguments)};function Xo(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 nr="Invariant Violation",Wr=Object.setPrototypeOf,Zo=Wr===void 0?function(e,t){return e.__proto__=t,e}:Wr,Tn=(function(e){Qo(t,e);function t(r){r===void 0&&(r=nr);var o=e.call(this,typeof r=="number"?nr+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=nr,Zo(o,t.prototype),o}return t})(Error);function rt(e,t){if(!e)throw new Tn(t)}var On=["debug","log","warn","error","silent"],es=On.indexOf("log");function zt(e){return function(){if(On.indexOf(e)>=es){var t=console[e]||console.log;return t.apply(console,arguments)}}}(function(e){e.debug=zt("debug"),e.log=zt("log"),e.warn=zt("warn"),e.error=zt("error")})(rt||(rt={}));var An="3.14.0";function ft(e){try{return e()}catch{}}const mr=ft(function(){return globalThis})||ft(function(){return window})||ft(function(){return self})||ft(function(){return global})||ft(function(){return ft.constructor("return this")()});var Gr=new Map;function ts(e){var t=Gr.get(e)||1;return Gr.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function rs(e,t){var r=ts("stringifyForDisplay");return JSON.stringify(e,function(o,s){return s===void 0?r:s},t).split(JSON.stringify(r)).join("<undefined>")}function Mt(e){return function(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof t=="number"){var s=t;t=jr(s),t||(t=kr(s,r),r=[])}e.apply(void 0,[t].concat(r))}}var or=Object.assign(function(t,r){for(var o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];t||rt(t,jr(r,o)||kr(r,o))},{debug:Mt(rt.debug),log:Mt(rt.log),warn:Mt(rt.warn),error:Mt(rt.error)});function $n(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Tn(jr(e,t)||kr(e,t))}var Qr=Symbol.for("ApolloErrorMessageHandler_"+An);function Ln(e){if(typeof e=="string")return e;try{return rs(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function jr(e,t){if(t===void 0&&(t=[]),!!e)return mr[Qr]&&mr[Qr](e,t.map(Ln))}function kr(e,t){if(t===void 0&&(t=[]),!!e)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:An,message:e,args:t.map(Ln)})))}function ns(e){return e.definitions.filter(function(t){return t.kind==="OperationDefinition"&&!!t.name}).map(function(t){return t.name.value})[0]||null}let ce=null;const Xr={};let os=1;const ss=()=>class{constructor(){this.id=["slot",os++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let t=ce;t;t=t.parent)if(this.id in t.slots){const r=t.slots[this.id];if(r===Xr)break;return t!==ce&&(ce.slots[this.id]=r),!0}return ce&&(ce.slots[this.id]=Xr),!1}getValue(){if(this.hasValue())return ce.slots[this.id]}withValue(t,r,o,s){const a={__proto__:null,[this.id]:t},i=ce;ce={parent:i,slots:a};try{return r.apply(s,o)}finally{ce=i}}static bind(t){const r=ce;return function(){const o=ce;try{return ce=r,t.apply(this,arguments)}finally{ce=o}}}static noContext(t,r,o){if(ce){const s=ce;try{return ce=null,t.apply(o,r)}finally{ce=s}}else return t.apply(o,r)}};function Zr(e){try{return e()}catch{}}const sr="@wry/context:Slot",as=Zr(()=>globalThis)||Zr(()=>global)||Object.create(null),en=as,Sr=en[sr]||Array[sr]||(function(e){try{Object.defineProperty(en,sr,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}})(ss()),{bind:Ha,noContext:Va}=Sr;new Sr;function is(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=ls(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 ls(e,t){if(e){if(typeof e=="string")return tn(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 tn(e,t)}}function tn(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 rn(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Nr(e,t,r){return t&&rn(e.prototype,t),r&&rn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Cr=function(){return typeof Symbol=="function"},_r=function(e){return Cr()&&!!Symbol[e]},Ir=function(e){return _r(e)?Symbol[e]:"@@"+e};Cr()&&!_r("observable")&&(Symbol.observable=Symbol("observable"));var cs=Ir("iterator"),hr=Ir("observable"),Dn=Ir("species");function Gt(e,t){var r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function St(e){var t=e.constructor;return t!==void 0&&(t=t[Dn],t===null&&(t=void 0)),t!==void 0?t:he}function ds(e){return e instanceof he}function ht(e){ht.log?ht.log(e):setTimeout(function(){throw e})}function Bt(e){Promise.resolve().then(function(){try{e()}catch(t){ht(t)}})}function zn(e){var t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t=="function")t();else{var r=Gt(t,"unsubscribe");r&&r.call(t)}}catch(o){ht(o)}}function pr(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function us(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(Mn(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function Mn(e,t,r){e._state="running";var o=e._observer;try{var s=Gt(o,t);switch(t){case"next":s&&s.call(o,r);break;case"error":if(pr(e),s)s.call(o,r);else throw r;break;case"complete":pr(e),s&&s.call(o);break}}catch(a){ht(a)}e._state==="closed"?zn(e):e._state==="running"&&(e._state="ready")}function ar(e,t,r){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:t,value:r});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:t,value:r}],Bt(function(){return us(e)});return}Mn(e,t,r)}}var fs=(function(){function e(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new ms(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"&&(pr(this),zn(this))},Nr(e,[{key:"closed",get:function(){return this._state==="closed"}}]),e})(),ms=(function(){function e(r){this._subscription=r}var t=e.prototype;return t.next=function(o){ar(this._subscription,"next",o)},t.error=function(o){ar(this._subscription,"error",o)},t.complete=function(){ar(this._subscription,"complete")},Nr(e,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),e})(),he=(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 fs(o,this._subscriber)},t.forEach=function(o){var s=this;return new Promise(function(a,i){if(typeof o!="function"){i(new TypeError(o+" is not a function"));return}function c(){l.unsubscribe(),a()}var l=s.subscribe({next:function(h){try{o(h,c)}catch(p){i(p),l.unsubscribe()}},error:i,complete:a})})},t.map=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{c=o(c)}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.filter=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{if(!o(c))return}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.reduce=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this),i=arguments.length>1,c=!1,l=arguments[1],h=l;return new a(function(p){return s.subscribe({next:function(b){var y=!c;if(c=!0,!y||i)try{h=o(h,b)}catch(N){return p.error(N)}else h=b},error:function(b){p.error(b)},complete:function(){if(!c&&!i)return p.error(new TypeError("Cannot reduce an empty sequence"));p.next(h),p.complete()}})})},t.concat=function(){for(var o=this,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var c=St(this);return new c(function(l){var h,p=0;function b(y){h=y.subscribe({next:function(N){l.next(N)},error:function(N){l.error(N)},complete:function(){p===a.length?(h=void 0,l.complete()):b(c.from(a[p++]))}})}return b(o),function(){h&&(h.unsubscribe(),h=void 0)}})},t.flatMap=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){var c=[],l=s.subscribe({next:function(p){if(o)try{p=o(p)}catch(y){return i.error(y)}var b=a.from(p).subscribe({next:function(y){i.next(y)},error:function(y){i.error(y)},complete:function(){var y=c.indexOf(b);y>=0&&c.splice(y,1),h()}});c.push(b)},error:function(p){i.error(p)},complete:function(){h()}});function h(){l.closed&&c.length===0&&i.complete()}return function(){c.forEach(function(p){return p.unsubscribe()}),l.unsubscribe()}})},t[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=Gt(o,hr);if(a){var i=a.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return ds(i)&&i.constructor===s?i:new s(function(c){return i.subscribe(c)})}if(_r("iterator")&&(a=Gt(o,cs),a))return new s(function(c){Bt(function(){if(!c.closed){for(var l=is(a.call(o)),h;!(h=l()).done;){var p=h.value;if(c.next(p),c.closed)return}c.complete()}})});if(Array.isArray(o))return new s(function(c){Bt(function(){if(!c.closed){for(var l=0;l<o.length;++l)if(c.next(o[l]),c.closed)return;c.complete()}})});throw new TypeError(o+" is not observable")},e.of=function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var i=typeof this=="function"?this:e;return new i(function(c){Bt(function(){if(!c.closed){for(var l=0;l<s.length;++l)if(c.next(s[l]),c.closed)return;c.complete()}})})},Nr(e,null,[{key:Dn,get:function(){return this}}]),e})();Cr()&&Object.defineProperty(he,Symbol("extensions"),{value:{symbol:hr,hostReportError:ht},configurable:!0});function hs(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 mt;typeof self<"u"?mt=self:typeof window<"u"?mt=window:typeof global<"u"?mt=global:typeof module<"u"?mt=module:mt=Function("return this")();hs(mt);var nn=he.prototype,on="@@observable";nn[on]||(nn[on]=function(){return this});function ps(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 $n(58,s)}return e}function gs(e,t){var r=We({},e),o=function(a){typeof a=="function"?r=We(We({},r),a(r)):r=We(We({},r),a)},s=function(){return We({},r)};return Object.defineProperty(t,"setContext",{enumerable:!1,value:o}),Object.defineProperty(t,"getContext",{enumerable:!1,value:s}),t}function xs(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName=typeof t.query!="string"?ns(t.query)||void 0:""),t}var ws=Symbol.for("apollo.deprecations"),ys=mr,bs=new Sr;function vs(e){return ys[ws]||(bs.getValue()||[]).includes(e)}function js(e,t){vs(e)||t()}function sn(e,t){return t?t(e):he.of()}function Nt(e){return typeof e=="function"?new qn(e):e}function qt(e){return e.request.length<=1}var qn=(function(){function e(t){t&&(this.request=t)}return e.empty=function(){return new e(function(){return he.of()})},e.from=function(t){return t.length===0?e.empty():t.map(Nt).reduce(function(r,o){return r.concat(o)})},e.split=function(t,r,o){var s=Nt(r),a=Nt(o||new e(sn)),i;return qt(s)&&qt(a)?i=new e(function(c){return t(c)?s.request(c)||he.of():a.request(c)||he.of()}):i=new e(function(c,l){return t(c)?s.request(c,l)||he.of():a.request(c,l)||he.of()}),Object.assign(i,{left:s,right:a})},e.execute=function(t,r){return t.request(gs(r.context,xs(ps(r))))||he.of()},e.concat=function(t,r){var o=Nt(t);if(qt(o))return globalThis.__DEV__!==!1&&or.warn(47,o),o;var s=Nt(r),a;return qt(s)?a=new e(function(i){return o.request(i,function(c){return s.request(c)||he.of()})||he.of()}):a=new e(function(i,c){return o.request(i,function(l){return s.request(l,c)||he.of()})||he.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(sn)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(t,r){throw $n(48)},e.prototype.onError=function(t,r){if(globalThis.__DEV__!==!1&&js("onError",function(){globalThis.__DEV__!==!1&&or.warn(49)}),r&&r.error)return r.error(t),!1;throw t},e.prototype.setOnError=function(t){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&or.warn(50),this.onError=t,this},e})();function ks(e){return new qn(function(t,r){var o=Xo(t,[]);return new he(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 Ss=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 we.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 we.isAxiosError(s)?console.error("Error fetching token:",s.response||s.message):console.error("Unexpected error:",s),null}},Ns="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Cs=Yt.createHttpLink({uri:`${Ns}`}),_s=ks(async(e,{headers:t})=>{const r=await Ss();return{headers:{...t,authorization:`Bearer ${r}`}}}),Is=new Yt.ApolloClient({link:_s.concat(Cs),cache:new Yt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),Fs=e=>{const{tanyaConfig:t}=e;return n.jsx(Yt.ApolloProvider,{client:Is,children:n.jsx(zo,{children:n.jsx(Go,{tanyaConfig:t})})})};function Ps(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 Bn=Object.freeze({left:0,top:0,width:16,height:16}),Qt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Fr=Object.freeze({...Bn,...Qt}),gr=Object.freeze({...Fr,body:"",hidden:!1});function Es(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 an(e,t){const r=Es(e,t);for(const o in gr)o in Qt?o in e&&!(o in r)&&(r[o]=Qt[o]):o in t?r[o]=t[o]:o in e&&(r[o]=e[o]);return r}function Ts(e,t,r){const o=e.icons,s=e.aliases||Object.create(null);let a={};function i(c){a=an(o[c]||s[c],a)}return i(t),r.forEach(i),an(e,a)}function Rn(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=Ps(e);for(const s in o){const a=o[s];a&&(t(s,Ts(e,s,a)),r.push(s))}return r}const Os={provider:"",aliases:{},not_found:{},...Bn};function ir(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Un(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!ir(e,Os))return null;const r=t.icons;for(const s in r){const a=r[s];if(!s||typeof a.body!="string"||!ir(a,gr))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]||!ir(a,gr))return null}return t}const ln=Object.create(null);function As(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function pt(e,t){const r=ln[e]||(ln[e]=Object.create(null));return r[t]||(r[t]=As(e,t))}function Hn(e,t){return Un(t)?Rn(t,(r,o)=>{o?e.icons[r]=o:e.missing.add(r)}):[]}function $s(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}const Vn=/^[a-z0-9]+(-[a-z0-9]+)*$/,Xt=(e,t,r,o="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;o=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const c=s.pop(),l=s.pop(),h={provider:s.length>0?s[0]:o,prefix:l,name:c};return t&&!Rt(h)?null:h}const a=s[0],i=a.split("-");if(i.length>1){const c={provider:o,prefix:i.shift(),name:i.join("-")};return t&&!Rt(c)?null:c}if(r&&o===""){const c={provider:o,prefix:"",name:a};return t&&!Rt(c,r)?null:c}return null},Rt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let Pt=!1;function Yn(e){return typeof e=="boolean"&&(Pt=e),Pt}function cn(e){const t=typeof e=="string"?Xt(e,!0,Pt):e;if(t){const r=pt(t.provider,t.prefix),o=t.name;return r.icons[o]||(r.missing.has(o)?null:void 0)}}function Ls(e,t){const r=Xt(e,!0,Pt);if(!r)return!1;const o=pt(r.provider,r.prefix);return t?$s(o,r.name,t):(o.missing.add(r.name),!0)}function Ds(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Pt&&!t&&!e.prefix){let s=!1;return Un(e)&&(e.prefix="",Rn(e,(a,i)=>{Ls(a,i)&&(s=!0)})),s}const r=e.prefix;if(!Rt({prefix:r,name:"a"}))return!1;const o=pt(t,r);return!!Hn(o,e)}const Jn=Object.freeze({width:null,height:null}),Kn=Object.freeze({...Jn,...Qt}),zs=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ms=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function dn(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(zs);if(o===null||!o.length)return e;const s=[];let a=o.shift(),i=Ms.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 qs(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 Bs(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Rs(e,t,r){const o=qs(e);return Bs(o.defs,t+o.content+r)}const Us=e=>e==="unset"||e==="undefined"||e==="none";function Hs(e,t){const r={...Fr,...e},o={...Kn,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let a=r.body;[r,o].forEach(I=>{const j=[],C=I.hFlip,Y=I.vFlip;let M=I.rotate;C?Y?M+=2:(j.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),j.push("scale(-1 1)"),s.top=s.left=0):Y&&(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(M<0&&(M-=Math.floor(M/4)*4),M=M%4,M){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}M%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=Rs(a,'<g transform="'+j.join(" ")+'">',"</g>"))});const i=o.width,c=o.height,l=s.width,h=s.height;let p,b;i===null?(b=c===null?"1em":c==="auto"?h:c,p=dn(b,l/h)):(p=i==="auto"?l:i,b=c===null?dn(p,h/l):c==="auto"?h:c);const y={},N=(I,j)=>{Us(j)||(y[I]=j.toString())};N("width",p),N("height",b);const S=[s.left,s.top,l,h];return y.viewBox=S.join(" "),{attributes:y,viewBox:S,body:a}}const Vs=/\sid="(\S+)"/g,Ys="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Js=0;function Ks(e,t=Ys){const r=[];let o;for(;o=Vs.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+(Js++).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 xr=Object.create(null);function Ws(e,t){xr[e]=t}function wr(e){return xr[e]||xr[""]}function Pr(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Er=Object.create(null),Ct=["https://api.simplesvg.com","https://api.unisvg.com"],Ut=[];for(;Ct.length>0;)Ct.length===1||Math.random()>.5?Ut.push(Ct.shift()):Ut.push(Ct.pop());Er[""]=Pr({resources:["https://api.iconify.design"].concat(Ut)});function Gs(e,t){const r=Pr(t);return r===null?!1:(Er[e]=r,!0)}function Tr(e){return Er[e]}const Qs=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let un=Qs();function Xs(e,t){const r=Tr(e);if(!r)return 0;let o;if(!r.maxURL)o=0;else{let s=0;r.resources.forEach(i=>{s=Math.max(s,i.length)});const a=t+".json?icons=";o=r.maxURL-s-r.path.length-a.length}return o}function Zs(e){return e===404}const ea=(e,t,r)=>{const o=[],s=Xs(e,t),a="icons";let i={type:a,provider:e,prefix:t,icons:[]},c=0;return r.forEach((l,h)=>{c+=l.length+1,c>=s&&h>0&&(o.push(i),i={type:a,provider:e,prefix:t,icons:[]},c=l.length),i.icons.push(l)}),o.push(i),o};function ta(e){if(typeof e=="string"){const t=Tr(e);if(t)return t.path}return"/"}const ra=(e,t,r)=>{if(!un){r("abort",424);return}let o=ta(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;un(e+o).then(a=>{const i=a.status;if(i!==200){setTimeout(()=>{r(Zs(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)})},na={prepare:ea,send:ra};function Wn(e,t){e.forEach(r=>{const o=r.loaderCallbacks;o&&(r.loaderCallbacks=o.filter(s=>s.id!==t))})}function oa(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let r=!1;const o=e.provider,s=e.prefix;t.forEach(a=>{const i=a.icons,c=i.pending.length;i.pending=i.pending.filter(l=>{if(l.prefix!==s)return!0;const h=l.name;if(e.icons[h])i.loaded.push({provider:o,prefix:s,name:h});else if(e.missing.has(h))i.missing.push({provider:o,prefix:s,name:h});else return r=!0,!0;return!1}),i.pending.length!==c&&(r||Wn([e],a.id),a.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),a.abort))})}))}let sa=0;function aa(e,t,r){const o=sa++,s=Wn.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 ia(e){const t={loaded:[],missing:[],pending:[]},r=Object.create(null);e.sort((s,a)=>s.provider!==a.provider?s.provider.localeCompare(a.provider):s.prefix!==a.prefix?s.prefix.localeCompare(a.prefix):s.name.localeCompare(a.name));let o={provider:"",prefix:"",name:""};return e.forEach(s=>{if(o.name===s.name&&o.prefix===s.prefix&&o.provider===s.provider)return;o=s;const a=s.provider,i=s.prefix,c=s.name,l=r[a]||(r[a]=Object.create(null)),h=l[i]||(l[i]=pt(a,i));let p;c in h.icons?p=t.loaded:i===""||h.missing.has(c)?p=t.missing:p=t.pending;const b={provider:a,prefix:i,name:c};p.push(b)}),t}function la(e,t=!0,r=!1){const o=[];return e.forEach(s=>{const a=typeof s=="string"?Xt(s,t,r):s;a&&o.push(a)}),o}const ca={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function da(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 J=Math.floor(Math.random()*F.length);i.push(F[J]),F=F.slice(0,J).concat(F.slice(J+1))}i=i.concat(F)}else i=e.resources.slice(a).concat(e.resources.slice(0,a));const c=Date.now();let l="pending",h=0,p,b=null,y=[],N=[];typeof o=="function"&&N.push(o);function S(){b&&(clearTimeout(b),b=null)}function I(){l==="pending"&&(l="aborted"),S(),y.forEach(F=>{F.status==="pending"&&(F.status="aborted")}),y=[]}function j(F,J){J&&(N=[]),typeof F=="function"&&N.push(F)}function C(){return{startTime:c,payload:t,status:l,queriesSent:h,queriesPending:y.length,subscribe:j,abort:I}}function Y(){l="failed",N.forEach(F=>{F(void 0,p)})}function M(){y.forEach(F=>{F.status==="pending"&&(F.status="aborted")}),y=[]}function x(F,J,de){const ye=J!=="success";switch(y=y.filter(te=>te!==F),l){case"pending":break;case"failed":if(ye||!e.dataAfterTimeout)return;break;default:return}if(J==="abort"){p=de,Y();return}if(ye){p=de,y.length||(i.length?Ce():Y());return}if(S(),M(),!e.random){const te=e.resources.indexOf(F.resource);te!==-1&&te!==e.index&&(e.index=te)}l="completed",N.forEach(te=>{te(de)})}function Ce(){if(l!=="pending")return;S();const F=i.shift();if(F===void 0){if(y.length){b=setTimeout(()=>{S(),l==="pending"&&(M(),Y())},e.timeout);return}Y();return}const J={status:"pending",resource:F,callback:(de,ye)=>{x(J,de,ye)}};y.push(J),h++,b=setTimeout(Ce,e.rotate),r(F,t,J.callback)}return setTimeout(Ce),C}function Gn(e){const t={...ca,...e};let r=[];function o(){r=r.filter(c=>c().status==="pending")}function s(c,l,h){const p=da(t,c,l,(b,y)=>{o(),h&&h(b,y)});return r.push(p),p}function a(c){return r.find(l=>c(l))||null}return{query:s,find:a,setIndex:c=>{t.index=c},getIndex:()=>t.index,cleanup:o}}function fn(){}const lr=Object.create(null);function ua(e){if(!lr[e]){const t=Tr(e);if(!t)return;const r=Gn(t),o={config:t,redundancy:r};lr[e]=o}return lr[e]}function fa(e,t,r){let o,s;if(typeof e=="string"){const a=wr(e);if(!a)return r(void 0,424),fn;s=a.send;const i=ua(e);i&&(o=i.redundancy)}else{const a=Pr(e);if(a){o=Gn(a);const i=e.resources?e.resources[0]:"",c=wr(i);c&&(s=c.send)}}return!o||!s?(r(void 0,424),fn):o.query(t,s,r)().abort}function mn(){}function ma(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,oa(e)}))}function ha(e){const t=[],r=[];return e.forEach(o=>{(o.match(Vn)?t:r).push(o)}),{valid:t,invalid:r}}function _t(e,t,r){function o(){const s=e.pendingIcons;t.forEach(a=>{s&&s.delete(a),e.icons[a]||e.missing.add(a)})}if(r&&typeof r=="object")try{if(!Hn(e,r).length){o();return}}catch(s){console.error(s)}o(),ma(e)}function hn(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function pa(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)){hn(e.loadIcons(s,o,r),p=>{_t(e,s,p)});return}if(a){s.forEach(p=>{const b=a(p,o,r);hn(b,y=>{const N=y?{prefix:o,icons:{[p]:y}}:null;_t(e,[p],N)})});return}const{valid:i,invalid:c}=ha(s);if(c.length&&_t(e,c,null),!i.length)return;const l=o.match(Vn)?wr(r):null;if(!l){_t(e,i,null);return}l.prepare(r,o,i).forEach(p=>{fa(r,p,b=>{_t(e,p.icons,b)})})}))}const ga=(e,t)=>{const r=la(e,!0,Yn()),o=ia(r);if(!o.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(o.loaded,o.missing,o.pending,mn)}),()=>{l=!1}}const s=Object.create(null),a=[];let i,c;return o.pending.forEach(l=>{const{provider:h,prefix:p}=l;if(p===c&&h===i)return;i=h,c=p,a.push(pt(h,p));const b=s[h]||(s[h]=Object.create(null));b[p]||(b[p]=[])}),o.pending.forEach(l=>{const{provider:h,prefix:p,name:b}=l,y=pt(h,p),N=y.pendingIcons||(y.pendingIcons=new Set);N.has(b)||(N.add(b),s[h][p].push(b))}),a.forEach(l=>{const h=s[l.provider][l.prefix];h.length&&pa(l,h)}),t?aa(t,o,a):mn};function xa(e,t){const r={...e};for(const o in t){const s=t[o],a=typeof s;o in Jn?(s===null||s&&(a==="string"||a==="number"))&&(r[o]=s):a===typeof r[o]&&(r[o]=o==="rotate"?s%4:s)}return r}const wa=/[\s,]+/;function ya(e,t){t.split(wa).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ba(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 va(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 ja(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ka(e){return"data:image/svg+xml,"+ja(e)}function Sa(e){return'url("'+ka(e)+'")'}let It;function Na(){try{It=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{It=null}}function Ca(e){return It===void 0&&Na(),It?It.createHTML(e):e}const Qn={...Kn,inline:!1},_a={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Ia={display:"inline-block"},yr={backgroundColor:"currentColor"},Xn={backgroundColor:"transparent"},pn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},gn={WebkitMask:yr,mask:yr,background:Xn};for(const e in gn){const t=gn[e];for(const r in pn)t[e+r]=pn[r]}const Fa={...Qn,inline:!0};function xn(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Pa=(e,t,r)=>{const o=t.inline?Fa:Qn,s=xa(o,t),a=t.mode||"svg",i={},c=t.style||{},l={...a==="svg"?_a:{}};if(r){const j=Xt(r,!1,!0);if(j){const C=["iconify"],Y=["provider","prefix"];for(const M of Y)j[M]&&C.push("iconify--"+j[M]);l.className=C.join(" ")}}for(let j in t){const C=t[j];if(C!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":l.ref=C;break;case"className":l[j]=(l[j]?l[j]+" ":"")+C;break;case"inline":case"hFlip":case"vFlip":s[j]=C===!0||C==="true"||C===1;break;case"flip":typeof C=="string"&&ya(s,C);break;case"color":i.color=C;break;case"rotate":typeof C=="string"?s[j]=ba(C):typeof C=="number"&&(s[j]=C);break;case"ariaHidden":case"aria-hidden":C!==!0&&C!=="true"&&delete l["aria-hidden"];break;default:o[j]===void 0&&(l[j]=C)}}const h=Hs(e,s),p=h.attributes;if(s.inline&&(i.verticalAlign="-0.125em"),a==="svg"){l.style={...i,...c},Object.assign(l,p);let j=0,C=t.id;return typeof C=="string"&&(C=C.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:Ca(Ks(h.body,C?()=>C+"ID"+j++:"iconifyReact"))},g.createElement("svg",l)}const{body:b,width:y,height:N}=e,S=a==="mask"||(a==="bg"?!1:b.indexOf("currentColor")!==-1),I=va(b,{...p,width:y+"",height:N+""});return l.style={...i,"--svg":Sa(I),width:xn(p.width),height:xn(p.height),...Ia,...S?yr:Xn,...c},g.createElement("span",l)};Yn(!0);Ws("",na);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"||!Ds(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;Gs(r,s)||console.error(o)}catch{console.error(o)}}}}function Zn(e){const[t,r]=g.useState(!!e.ssr),[o,s]=g.useState({});function a(N){if(N){const S=e.icon;if(typeof S=="object")return{name:"",data:S};const I=cn(S);if(I)return{name:S,data:I}}return{name:""}}const[i,c]=g.useState(a(!!e.ssr));function l(){const N=o.callback;N&&(N(),s({}))}function h(N){if(JSON.stringify(i)!==JSON.stringify(N))return l(),c(N),!0}function p(){var N;const S=e.icon;if(typeof S=="object"){h({name:"",data:S});return}const I=cn(S);if(h({name:S,data:I}))if(I===void 0){const j=ga([S],p);s({callback:j})}else I&&((N=e.onLoad)===null||N===void 0||N.call(e,S))}g.useEffect(()=>(r(!0),l),[]),g.useEffect(()=>{t&&p()},[e.icon,t]);const{name:b,data:y}=i;return y?Pa({...Fr,...y},e,b):e.children?e.children:e.fallback?e.fallback:g.createElement("span",{})}const oe=g.forwardRef((e,t)=>Zn({...e,_ref:t}));g.forwardRef((e,t)=>Zn({inline:!0,...e,_ref:t}));const Ge="USD",Ea=e=>{var o,s,a;const t=e==null?void 0:e.availability;if(!t)return!1;const r=(a=(s=(o=t.channels)==null?void 0:o.results)==null?void 0:s[0])==null?void 0:a.availability;return r?r.isOnStock===!0&&(r.availableQuantity??0)>0:!1},br=(e,t=Ge)=>{const r=(e==null?void 0:e.prices)??[];if(!r.length)return null;const o=i=>{var h,p;const c=i.find(b=>{var y;return!!((y=b.discounted)!=null&&y.value)});if(c)return{cent:c.discounted.value.centAmount,cur:c.discounted.value.currencyCode,regularCent:(h=c.value)==null?void 0:h.centAmount};const l=(p=i[0])==null?void 0:p.value;return l?{cent:l.centAmount,cur:l.currencyCode}:null},s=r.filter(i=>{var c,l;return((l=((c=i.discounted)==null?void 0:c.value)||i.value)==null?void 0:l.currencyCode)===t}),a=o(s);return a||o(r)||null},Ta=(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},Oa=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}},qe=e=>Ta((e==null?void 0:e.attributesRaw)??[],"color"),Ke=e=>Oa((e==null?void 0:e.attributesRaw)??[]).sizeLabel,et=(e,t,r)=>{for(const o of e){const s=qe(o.variant),a=Ke(o.variant);if((t?s===t:!0)&&(r?a===r:!0))return o}return null},Aa=({value:e,name:t,variant:r="square",image:o,selected:s,onClick:a})=>{const i=r==="circle"?"h-12 w-12 rounded-full":"h-12 w-12 rounded-md";return n.jsxs("button",{onClick:a,className:`
17
- flex items-center justify-center border p-2
18
- ${i}
19
- bg-white cursor-pointer relative
20
- ${s?"border-black":"border-gray-300 hover:border-gray-500"}
21
- `,children:[r==="circle"?n.jsx("div",{className:"h-full w-full rounded-full",style:{backgroundImage:`url(${(o==null?void 0:o.disBaseLink)||(o==null?void 0:o.link)||""})`,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:t==null?void 0:t.toLowerCase()}}):n.jsx("span",{className:"text-base font-medium",children:t}),s&&r==="circle"&&n.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-black pointer-events-none"})]})},$a=({label:e,selectedValue:t,onChange:r,children:o})=>n.jsxs("div",{className:"mb-6",children:[n.jsxs("div",{className:"font-medium text-lg mb-2",children:[e,":"," ",n.jsx("span",{className:"font-normal text-gray-700",children:t||""})]}),n.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:o})]}),Je=e=>e.charAt(0).toUpperCase()+e.slice(1),tt={standard:{label:"Standard Delivery",fee:0,subtitle:"Arrives in 4–6 days (Free)",icon:"mdi:clock-outline"},express:{label:"Express Delivery",fee:5,subtitle:"Arrives in 1–2 days (+$5)",icon:"mdi:flash"},sameday:{label:"Same-Day Delivery",fee:10,subtitle:"Available in select locations (+$10)",icon:"mdi:truck-fast-outline"}},La={standard:"GROUND",express:"2-DAY SHIPPING",sameday:"OVERNIGHT"},$e=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},eo=e=>e==null?void 0:e.masterVariant,wn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ht=e=>{const t=eo(e);return t?[t,...wn(e)]:wn(e)},Da=(e,t=0)=>Ht(e)[t],za=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},yn=(e,t)=>{var r,o,s,a,i,c,l,h;return za(t)||((a=(s=(o=(r=e.imageGroups)==null?void 0:r[0])==null?void 0:o.images)==null?void 0:s[0])==null?void 0:a.link)||((h=(l=(c=(i=e.image_groups)==null?void 0:i[0])==null?void 0:c.images)==null?void 0:l[0])==null?void 0:h.link)||""},bn=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Vt=e=>{var a,i,c,l,h,p;const t=e?br(e,Ge):null;if(t!=null&&t.cent&&(t!=null&&t.cur))return{amount:+(t.cent/100),currency:t.cur,regularAmount:t.regularCent?t.regularCent/100:void 0};const r=(c=(i=(a=e==null?void 0:e.prices)==null?void 0:a[0])==null?void 0:i.value)==null?void 0:c.centAmount,o=((p=(h=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:h.value)==null?void 0:p.currencyCode)??Ge;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},vn=(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},jn=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)||""},Ma=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)||""},qa=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)||""},kn=20,Ba=({open:e,onClose:t,product:r,index:o,addressListProp:s,addressLoading:a,variationAttributes:i})=>{console.log(r,"the product for ai shopping");const c=null,l=null,h=Ht(r),p=Math.min(Math.max(0,o||0),Math.max(0,h.length-1)),b=h.length,[y,N]=g.useState(p),[S,I]=g.useState(null),[j,C]=g.useState(null),Y=g.useRef(null),M=g.useRef(null),x=Da(r,y),[Ce,F]=g.useState(""),[J,de]=g.useState(!1),[ye,te]=g.useState(!1),[_e,be]=g.useState(!1),[pe,q]=g.useState(""),[O,ue]=g.useState(!1),[K,Re]=g.useState(null),[Ue,X]=g.useState([]),[ct,xt]=g.useState([]),[L,Te]=g.useState([]),[ge,Ie]=g.useState(!1),[wt,Zt]=g.useState(),[m,z]=g.useState(!0),[P,R]=g.useState(!1),[U,E]=g.useState(!1),[W,re]=g.useState("standard"),[A,B]=g.useState(!1),[Fe,fe]=g.useState(!1),[se,ve]=g.useState("card"),[Z,G]=g.useState(!1),[Pe,k]=g.useState(!1),[ae,$]=g.useState(!1),[ie,Oe]=g.useState(null),[De,yt]=g.useState(null),[bt,ze]=g.useState(""),[Et,Tt]=g.useState(!1),[T,He]=g.useState({}),Ot=(d,f,u)=>{He(v=>({...v,[d]:{value:f,name:u}}))},Ve=g.useRef(null);g.useEffect(()=>{const d=Ht(r),f=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));N(f);const u=eo(r),v=qe(u),_=Ke(u);Y.current=v||null,M.current=_||null,I(v||null),C(_||null)},[o,r]),g.useEffect(()=>{Ve.current&&(Ve.current.scrollTop=Ve.current.scrollHeight)},[Ue,ge,P,U,A,Fe,Z,Pe,ae,J,ye]);const je="var(--tanya)",er="var(--tanya-contrast)",At=je,to="#804c9e",ro=()=>{console.log("AgenticShopping feedback:",{rating:De,comment:bt}),Tt(!0)},no=()=>{yt(null),ze(""),Tt(!0)},Or=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??ie;return e?n.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-lg border border-green-200 bg-green-50 p-4 text-green-800",children:[n.jsx("div",{className:"success-tick-animation",children:n.jsx(oe,{icon:"mdi:check-circle",width:"28",color:"#16a34a"})}),n.jsxs("div",{className:"text-sm w-full",children:[n.jsx("div",{className:"font-semibold",children:"Success!"}),n.jsx("div",{children:"Your smart order has been saved. I’ll watch the price and auto-purchase when the conditions are met."}),u&&n.jsxs("div",{className:"mt-2 text-xs font-medium",children:["Your Smart Order ID: ",n.jsx("span",{className:"font-semibold text-blue-600 cursor-pointer underline",children:u})]}),!Et&&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(v=>n.jsx("button",{type:"button",onClick:()=>yt(v),className:"p-0.5",children:n.jsx(oe,{icon:De&&De>=v?"mdi:star":"mdi:star-outline",width:"20",className:"text-yellow-500"})},v))}),n.jsx("label",{className:"block text-sm text-gray-700 mb-1",children:"Tell us more about the response"}),n.jsx("textarea",{value:bt,onChange:v=>ze(v.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:no,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:ro,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:je},disabled:!De&&!bt.trim(),children:"Submit"})]})]}),Et&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},oo=async()=>{try{Te(s)}catch(d){console.error("Error fetching addresses:",d)}},vt=(d,f)=>{X(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:f}])},Ar=(d,f)=>{X(u=>u.map(v=>v.response==="__CARD__"?{...v,response:"__SNAPSHOT__",snapshotStage:d??v.snapshotStage,snapshotPayload:f??v.snapshotPayload}:v))},so=()=>{X(d=>d.filter(f=>!(f.query===""&&f.response!=="__SNAPSHOT__"&&f.response!=="__TEXT__")))},$t=()=>{k(!1),Ie(!1),E(!1),fe(!1),R(!1),B(!1),G(!1),$(!1),ue(!1),Re(null),so(),de(!1),te(!1)},ao=()=>{Ie(!1),R(!1),E(!1),re("standard"),B(!1),fe(!1),ve("card"),G(!1),k(!1),$(!1),z(!0),Re(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")},Ee=g.useMemo(()=>Ht(r).map((f,u)=>({index:u,variant:f,images:((f==null?void 0:f.images)||[]).map(v=>(v==null?void 0:v.url)||"").filter(Boolean)})),[r]),jt=g.useMemo(()=>{if(!Ee.length)return!1;const d=S||void 0,f=j||void 0,u=(v,_)=>{var D;const w=et(Ee,v||void 0,_||void 0);return!!(w&&((D=w.variant)!=null&&D.sku))};return d&&f?u(d,f):d&&!f?u(d,null):!d&&f?u(void 0,f):!0},[Ee,S,j,x]),io=_e||O||!jt,kt=d=>{const f=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(f)&&f>0?f:1},$r=d=>{const f=kt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(vn(r,x)*f)},Lr=d=>{var H;const f=K,u=Vt(x),v=d||(f==null?void 0:f.currency)||u.currency||Ge,_=$r(f),w=+(_*.08).toFixed(2),D=((H=tt[W])==null?void 0:H.fee)||0;return{product_total:_,tax:w,shipping_fee:D,currency:v}},tr=async(d,f,u)=>{Ar(),ao(),be(!0),ue(!0),de(!1),te(!1);const v=ct.slice(-kn);try{const _=await dr(c,l);if(!_)throw new Error("Failed to fetch token");const w=localStorage.getItem("customerNumber"),D=localStorage.getItem("isLoggedIn"),ne=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(D||!1),userId:String(w||new Date().getTime())}).toString()}`,V=await fetch(`${ne}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_}`},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:v}})});if(!V.body)throw new Error("Readable stream not supported");const ee=V.body.getReader(),Q=new TextDecoder;let ke="",Se="",Ne="";for(;;){const{done:xe,value:Ye}=await ee.read();if(xe)break;ke+=Q.decode(Ye,{stream:!0});const dt=ke.split(`
22
- `);ke=dt.pop()||"";for(const ut of dt){if(!ut.startsWith("data:"))continue;const Xe=ut.slice(5).trim();try{const Me=JSON.parse(Xe),Ae=Me.index,me=Me.data;Ae===0?Se=String(me??""):Ae===1&&(Ne=String(me??""))}catch(Me){console.error("Error parsing JSON chunk:",Me)}}}let le=null;if(Se){const xe=String(Se).replace(/\\n/g,"").trim();if(xe.startsWith("{")&&xe.endsWith("}"))try{le=JSON.parse(xe),le.product_id=f,le.sku_id=f,localStorage.setItem("agentic_order",JSON.stringify(le))}catch(Ye){console.log(Ye)}}Re(le),le&&X(xe=>[...xe,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:le}}]),xt(xe=>[...xe,{userQuery:d,mainResponse:Se||"",keywords:Ne||""}].slice(-kn))}catch(_){console.error("Error sending message to Tanya:",_),ue(!1)}finally{be(!1)}},Dr=async d=>{if(O||_e||!jt)return;const f=pe.trim();if(!f)return;X(w=>[...w,{query:f,response:""}]),q(""),F(f);const u=x==null?void 0:x.sku,v=jn(r),_=u||v||"";if(b<=1){if(_){tr(f,_,y);return}te(!0),ue(!0);return}_?(de(!0),ue(!0)):(te(!0),ue(!0))},lo=()=>{const d=x==null?void 0:x.sku;d&&tr(Ce,d,y)},co=()=>{de(!1),te(!0),ue(!0)},uo=()=>{if(!x||!x.sku)return;const d=x.sku;tr(Ce,d,y)},fo=async()=>{Ie(!0),E(!1),fe(!1),k(!1),R(!1),B(!1),G(!1),$(!1),await oo(),Ar("initial",{extractedDetails:K??void 0})},mo=()=>{if(!wt)return;const d=L.find(f=>String(f.addressId??f.id)===wt)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),R(!0),E(!0),B(!1),fe(!1),G(!1),k(!1),$(!1),vt("address",d))},ho=()=>{R(!1),E(!1),B(!1),fe(!1),G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_address")},po=()=>{W&&(localStorage.setItem("agentic_order_delivery",W),B(!0),fe(!0),G(!1),k(!1),$(!1),vt("delivery",{method:W,...tt[W]}))},zr=()=>{E(!1),B(!1),fe(!1),G(!1),k(!1),$(!1),ue(!1),$t(),X(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"}}])},go=()=>{B(!1),fe(!1),G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_delivery")},xo=()=>{se&&(localStorage.setItem("agentic_order_payment",se),G(!0),k(!0),$(!1),vt("payment",{method:se}))},wo=()=>{fe(!1),G(!1),k(!1),$(!1),ue(!1),$t(),X(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"}}])},yo=()=>{G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_payment")},bo=async()=>{try{be(!0);const d=K||{},f=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),v=localStorage.getItem("agentic_order_payment")||"card",{product_total:_,tax:w,shipping_fee:D,currency:H}=Lr(),ne=d.shopper_id||localStorage.getItem("customerId")||void 0,V=(f==null?void 0:f.addressId)||(f==null?void 0:f.id)||void 0,ee=u?La[u]:"GROUND",Q="card-visa",ke=x==null?void 0:x.sku,Se=(r==null?void 0:r.id)||"",Ne=kt(d),le=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(_*100),dt={shopper_id:ne,shipping_address_id:V,shipping_method_id:ee,payment_method_id:Q,sku:ke,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Se,quantity:Ne,max_price_minor:le,currency:H,instruction_text:Ce};if(!ne||!V){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:ne,shippingAddressId:V}),alert("Missing customer or address information. Please re-select address and try again."),be(!1);return}const Xe=(await gt()).access_token;if(!Xe)throw new Error("Failed to fetch auth token for intent-mandate");const{serverUrl:Me}=st(),Ae=await fetch(`${Me}/api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Xe}`},body:JSON.stringify(dt)});if(!Ae.ok){const Co=await Ae.text().catch(()=>"");console.error("intent-mandate failed",Ae.status,Co),alert("Something went wrong while saving your smart order. Please try again."),be(!1);return}const me=await Ae.json().catch(()=>null);console.log("intent-mandate success:",me);const Ze=(me==null?void 0:me.intent_mandate_id)||(me==null?void 0:me.intent_mandateId)||(me==null?void 0:me.key)||null;Ze&&Oe(Ze);const Lt={...d,address:f,delivery:u,payment:v,summary:{product_total:_,tax:w,shipping_fee:D,currency:H},intent_mandate_id:Ze};localStorage.setItem("agentic_order_final",JSON.stringify(Lt)),$(!0),z(!1),vt("final",Lt),vt("success",{intentMandateId:Ze}),$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{be(!1)}},Mr=()=>{$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},vo=()=>{const d=yn(r,x),f=bn(r),u=(r==null?void 0:r.id)||"",v=qe(x)||"",_=Ke(x)||"",{amount:w}=Vt(x),D=!!(r!=null&&r.id),H=D;return console.log(d,f,u,v,_,w,D,H,"base product"),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:d?n.jsx("img",{src:d,alt:f,className:"object-contain w-full h-full"}):n.jsx(oe,{icon:"mdi:image-outline",width:"28",className:"opacity-60"})})}),n.jsxs("div",{className:"flex-grow flex flex-col justify-center text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-gray-900 mb-1",children:f}),n.jsx("div",{className:"text-sm text-gray-700 mb-1",children:[u&&`SKU: ${u}`,v&&`Color: ${v}`,_&&`Size: ${_}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:D?`$${r.price}`:"Currently unavailable"}),D&&!H&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},qr=({showSubmit:d=!0})=>{const f={},u=Ee.map(w=>qe(w.variant)).filter(w=>!!w&&!f[w]&&(f[w]=!0)),v={},_=Ee.map(w=>Ke(w.variant)).filter(w=>!!w&&!v[w]&&(v[w]=!0));return 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"}),u.length>0&&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 :"}),S&&n.jsx("div",{className:"text-sm text-gray-600",children:S})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:u.map(w=>{var Ne;const D=S===w,H=j||M.current||null,ne=H?et(Ee,w,H):et(Ee,w,null),V=!!ne,ee=V&&Ea(ne.variant),Q=V&&ee?br(ne.variant,Ge)||br(ne.variant):null,ke=Ee.find(le=>qe(le.variant)===w),Se=(Ne=ke==null?void 0:ke.images)==null?void 0:Ne[0];return n.jsxs("div",{className:`flex flex-col items-center w-28 border rounded-md p-2
23
- ${D?"border-2 border-tanya-light":"border-gray-300"}
24
- ${!V||!ee?"opacity-60":""}`,children:[n.jsx("button",{onClick:()=>{I(w);const le=j||M.current||null,xe=le&&et(Ee,w,le)||et(Ee,w,null);xe&&N(xe.index)},className:"w-full h-20 flex items-center justify-center overflow-hidden",title:w,children:Se?n.jsx("img",{src:Se,alt:w,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:w})}),n.jsx("div",{className:"w-full border-t my-2"}),V&&!ee&&n.jsx("div",{className:"text-[11px] text-red-600 text-center",children:"Out of stock"}),!V&&n.jsx("div",{className:"text-[11px] text-red-600 text-center",children:"any not offered"}),V&&ee&&Q&&n.jsxs("div",{className:"text-xs text-gray-800 font-medium text-center",children:[$e(Q.cent/100,Q.cur),Q.regularCent&&Q.regularCent>Q.cent&&n.jsx("span",{className:"ml-1 line-through text-gray-500",children:$e(Q.regularCent/100,Q.cur)})]})]},`color-${w}`)})})]}),_.length>0&&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 :"}),j&&n.jsx("div",{className:"text-sm text-gray-600",children:j})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:_.map(w=>{const D=j===w;return n.jsx("button",{onClick:()=>{C(w);const H=S&&et(Ee,S,w)||et(Ee,void 0,w);H&&N(H.index)},className:`px-4 py-2 rounded-md border text-sm ${D?"border-2 border-tanya-light font-semibold":"border-gray-300"}`,title:w,children:w},`size-${w}`)})})]}),i.map(({id:w,name:D,selectedValue:H,values:ne})=>{var V;return n.jsx($a,{label:D,selectedValue:((V=T[w])==null?void 0:V.name)||"",children:ne.map(({value:ee,name:Q,image:ke})=>{var Ne;const Se=((Ne=T[w])==null?void 0:Ne.value)===ee;return n.jsx(Aa,{value:ee,name:Q,image:ke,variant:w==="color"?"circle":"square",selected:Se,onClick:()=>Ot(w,ee,Q)},ee)})},w)}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:uo,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:je},disabled:!jt,children:"Submit"})})]})},Br=(d,f=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||K;if(!u)return null;const v=kt(u),{currency:_}=Vt(x),w=vn(r,x),D=Number((u==null?void 0:u.max_price_minor)??0),ne=Number.isFinite(D)&&D>0?+(D/100):+(w*v),V=(u==null?void 0:u.currency)||_||Ge,ee=x!=null&&x.sku?x.sku:u.product_id;return n.jsxs("div",{className:"px-6 pb-6 flex flex-col items-center space-y-4",style:{backgroundColor:"#14377D"},children:[n.jsx("p",{className:"text-base font-semibold text-center mt-2",style:{color:er},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:ee}),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:V}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Maximum Total Price:"}),n.jsx("p",{className:"text-gray-800",children:$e(ne,V)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[qe(x)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",qe(x)]}),Ke(x)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",Ke(x)]}),(x==null?void 0:x.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",x.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:er},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:fo,disabled:ge,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 ${ge?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:`${je}`},children:[n.jsx(oe,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Mr,disabled:ge,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${ge?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:je,color:er},children:[n.jsx(oe,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Rr=(d,f=!0)=>{var ut,Xe,Me,Ae,me,Ze;const u=d||{},v=((ut=u==null?void 0:u.summary)==null?void 0:ut.currency)||(K==null?void 0:K.currency)||Ge,_=yn(r,x),w=bn(r),D=x!=null&&x.sku?x.sku:(r==null?void 0:r.id)??(K==null?void 0:K.product_id),H=(x==null?void 0:x.sku)??jn(r),ne=qe(x)||Ma(r),V=Ke(x)||qa(r),ee=kt(u),Q=((Xe=u==null?void 0:u.summary)==null?void 0:Xe.product_total)!=null?+u.summary.product_total:$r(u),ke=ee>0?+(Q/ee).toFixed(2):0,Se=Q,Ne=((Me=u==null?void 0:u.summary)==null?void 0:Me.tax)??+(Q*.08).toFixed(2),le=((Ae=u==null?void 0:u.summary)==null?void 0:Ae.shipping_fee)??(((me=tt[W])==null?void 0:me.fee)||0),xe=u!=null&&u.address?[u.address.addressLine1,u.address.addressLine2,u.address.street,[u.address.city,u.address.state,u.address.postalCode].filter(Boolean).join(", "),u.address.country].filter(Boolean).map(Lt=>Je(String(Lt))).join(", "):"—",Ye=(u==null?void 0:u.payment)||"card",dt=Ye==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Je(Ye)});return n.jsxs("div",{className:"mx-auto mt-3 mb-3 rounded-2xl bg-white",children:[n.jsx("div",{className:"px-6 pt-5 pb-3",children:n.jsxs("h3",{className:"font-semibold text-lg mb-2 text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:receipt-text-check-outline",width:"24",color:je}),"All set! Here’s what your smart order looks like 🧾"]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-4 rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"sm:col-span-2 flex",children:n.jsx("div",{className:"w-30 h-26 sm:w-30 sm:h-26 overflow-hidden rounded-lg bg-white border border-gray-200 flex items-center justify-center mx-auto sm:mx-0",children:_?n.jsx("img",{src:_,alt:w,className:"w-full h-full object-contain"}):n.jsx(oe,{icon:"mdi:image-outline",width:"24",className:"opacity-50"})})}),n.jsxs("div",{className:"sm:col-span-10",children:[n.jsxs("div",{className:"mb-3",children:[n.jsx("div",{className:"text-lg text-center font-bold text-gray-900",children:w}),n.jsxs("div",{className:"text-xs text-center font-bold text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",D??"—"]}),(H||ne||V)&&n.jsxs("div",{className:"text-xs text-gray-600 mt-0.5 text-center",children:[H&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",H,"  "]}),ne&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",ne,"  "]}),V&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Size:"})," ",V]})]})]}),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:$e(ke,v)})]}),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:ee})]}),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:$e(Se,v)})]})]})]})]})}),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:xe})]}),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:dt})]}),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&&((Ze=tt[u.delivery])==null?void 0:Ze.label)||"—"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💰 any(s)"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:$e(Q,v)})]}),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:$e(Ne,v)})]}),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:$e(le,v)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:At},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:$e(Q+Ne+le,v)})]})]}),!f&&n.jsxs("div",{className:"px-6 pb-5",children:[!ae&&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?"}),ae&&Or({intentMandateId:ie}),m&&!ae&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:bo,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:At},children:"Confirm"}),n.jsx("button",{onClick:Mr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:At,color:At},children:"Cancel"})]})]})]})},jo=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=>Je(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"20",color:je}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f})]})})},ko=d=>{const f=d==null?void 0:d.method,u=f?tt[f]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"20",color:je}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:u?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(oe,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},So=d=>{const f=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"20",color:je}),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"]}):Je(f)})]})})},No=(d,f)=>{const u=d.snapshotStage;if(!u||u==="address"&&ge||u==="delivery"&&U||u==="payment"&&Fe||u==="final"&&Pe)return null;switch(u){case"initial":return Br(d.snapshotPayload,!f);case"address":return jo(d.snapshotPayload);case"delivery":return ko(d.snapshotPayload);case"payment":return So(d.snapshotPayload);case"final":return Rr(d.snapshotPayload,!f);case"success":return Or(d.snapshotPayload);default:return null}};return Fo.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:to},children:[n.jsxs("div",{style:{display:"flex",color:"#ffffff",alignItems:"center",gap:"0.5rem"},children:[n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 256 256",children:n.jsxs("g",{fill:"currentColor",children:[n.jsx("path",{d:"m194.82 151.43l-55.09 20.3l-20.3 55.09a7.92 7.92 0 0 1-14.86 0l-20.3-55.09l-55.09-20.3a7.92 7.92 0 0 1 0-14.86l55.09-20.3l20.3-55.09a7.92 7.92 0 0 1 14.86 0l20.3 55.09l55.09 20.3a7.92 7.92 0 0 1 0 14.86",opacity:"0.2"}),n.jsx("path",{d:"M197.58 129.06L146 110l-19-51.62a15.92 15.92 0 0 0-29.88 0L78 110l-51.62 19a15.92 15.92 0 0 0 0 29.88L78 178l19 51.62a15.92 15.92 0 0 0 29.88 0L146 178l51.62-19a15.92 15.92 0 0 0 0-29.88ZM137 164.22a8 8 0 0 0-4.74 4.74L112 223.85L91.78 169a8 8 0 0 0-4.78-4.78L32.15 144L87 123.78a8 8 0 0 0 4.78-4.78L112 64.15L132.22 119a8 8 0 0 0 4.74 4.74L191.85 144ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8"})]})}),n.jsx("div",{children:n.jsx("p",{className:"font-bold",children:"Agentic Shopping with TANYA"})})]}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx(oe,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:Ve,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(vo,{}),b>1&&n.jsx(qr,{showSubmit:!1}),Ue.map((d,f)=>{var _;const u=f===Ue.length-1,v=!!d.snapshotStage;return n.jsxs("div",{children:[d.query&&n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm rounded-l-xl p-3 m-3 mb-4 rounded-br-xl max-w-[75%]",style:{color:"#ffffff",backgroundColor:"var(--tanya)"},children:d.query})}),d.response==="__TEXT__"&&((_=d.snapshotPayload)==null?void 0:_.text)&&n.jsx("div",{className:"mt-2",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&J&&b>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:qe(x)||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:Ke(x)||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:lo,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:je},children:"Yes"}),n.jsx("button",{onClick:co,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:je,color:je},children:"No, change SKU"})]})]}),u&&ye&&n.jsx(qr,{showSubmit:!0}),u&&_e&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text",children:n.jsx("p",{children:"Reading your instruction and setting things up…"})})})}),(v||d.response==="__CARD__")&&(!_e||!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:v?No(d,u):Br(d.snapshotPayload,!1)})]},f)}),ge&&n.jsxs("div",{className:"mt-6 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),P&&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"}),!ae&&n.jsx("button",{onClick:ho,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..."})]}):L.length>0?n.jsxs("div",{className:`space-y-3 ${P?"opacity-70":""}`,children:[L.map(d=>{const f=[d.addressLine1,d.addressLine2].filter(Boolean).map(H=>Je(H||"")).join(" "),u=Je(d.city||""),v=`${Je(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,_=Je(d.country||""),w=String(d.addressId??d.id),D=wt===w;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${D?"border-tanya-light":"border-gray-300"} ${P?"pointer-events-none":""}`,title:P?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:D,disabled:P,onChange:()=>Zt(w),value:w}),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",{}),v,n.jsx("br",{}),_]})]})]},w)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:zr,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:mo,disabled:P,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${P?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:je},children:P?"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."})]}),U&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),A&&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"}),!ae&&n.jsx("button",{onClick:go,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change 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 ${A?"opacity-70":""}`,children:Object.keys(tt).map(d=>{const f=tt[d],u=W===d;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${u?"border-tanya-light":"border-gray-300"} ${A?"pointer-events-none":""}`,title:A?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:u,disabled:A,onChange:()=>re(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:f.icon,width:"18"})," ",f.label]}),n.jsx("div",{className:"text-sm text-gray-700",children:f.subtitle})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:f.fee===0?"Free":$e(f.fee,(K==null?void 0:K.currency)||Ge)})]},d)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:zr,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:po,disabled:A,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${A?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:"var(--tanya)"},children:A?"Delivery Submitted":"Submit Delivery Option"})]})]}),Fe&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),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"}),!ae&&n.jsx("button",{onClick:yo,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 ${Z?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${se==="card"?"border-tanya-light":"border-gray-300"} ${Z?"pointer-events-none":""}`,title:Z?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:se==="card",disabled:Z,onChange:()=>ve("card")}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),se==="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:wo,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: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:"var(--tanya)"},children:Z?"Payment Submitted":"Submit Payment Method"})]})]}),Pe&&Rr({...K,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:Lr(K==null?void 0:K.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:O?"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.)`:"Oops! This combination isn’t available for this product. Try a different option.",disabled:io,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
25
- ${jt?"":"placeholder:text-red-400 text-red-500"}`,value:pe,onKeyDown:d=>{d.key==="Enter"&&!_e&&!O&&Dr()},onChange:d=>q(d.target.value)}),n.jsx("button",{type:"submit",disabled:_e||O,className:"mr-6 font-medium",style:{color:"var(--tanya-light)"},onClick:()=>Dr(),children:_e?n.jsx("div",{className:"m-3 animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottom:"2px solid"}}):n.jsx(oe,{icon:"fluent:send-48-filled",color:"var(--tanya-light)",width:"24",height:"24"})})]})]})})]}),document.body)};exports.AgenticShoppingButton=Ba;exports.TanyaChatbot=Fs;exports.TanyaChatbotProvider=To;
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:()=>v(!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 ${Ee?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:A,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(L==null?void 0:L.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.map(m=>n.jsx("button",{onClick:()=>U(m),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:me===s[m]?"#FFFFFF":"#F3F3F3",borderColor:me===s[m]?"#BBB3DD":""},children:m},m))})]}),we.map((m,q)=>{var z,J;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)}})}),Ce&&!m.response.includes("Thinking")&&((z=m.products)==null?void 0:z.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)&&((J=m==null?void 0:m.products)==null?void 0:J.length)>0&&n.jsx(Vo,{chat:m.products,storeDetails:L}),(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:L.themeDarkColor},children:"Why not explore these inquiries..."}),m.potentialQuestions.split(",").map((T,P)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${L.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>Se(T),style:{backgroundColor:L.tanyaThemeColorLight},children:T},P))]}),(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:L.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:L.themeDarkColor},children:"• • •"})]})}),(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:L.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:L.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:(L==null?void 0:L.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:()=>Q(T=>T.map((P,ne)=>ne===q&&P.productSnapshot?{...P,productSnapshot:{...P.productSnapshot,quantity:Math.max(1,P.productSnapshot.quantity-1)}}:P)),style:{background:"transparent",color:L.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:()=>Q(T=>T.map((P,ne)=>ne===q&&P.productSnapshot?{...P,productSnapshot:{...P.productSnapshot,quantity:P.productSnapshot.quantity+1}}:P)),style:{background:"transparent",color:L.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{wt(Ke(m.productSnapshot),m.productSnapshot.quantity)},disabled:_,className:"px-4 py-2 rounded-full font-medium",style:{background:L.tanyaThemeColor,color:(L==null?void 0:L.tanyaThemeContrastColor)||"#fff",opacity:_?.8:1},children:_?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},q)})]}),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:R,autoFocus:!0,onChange:m=>xe(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!B&&Se()}}),n.jsx("button",{type:"submit",disabled:B,className:"p-3",onClick:()=>Se(),children:B?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:L.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(Jo,{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 Wo(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 Ye=function(){return Ye=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},Ye.apply(this,arguments)};function Qo(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",Yr=Object.setPrototypeOf,Xo=Yr===void 0?function(e,t){return e.__proto__=t,e}:Yr,Fn=(function(e){Wo(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,Xo(o,t.prototype),o}return t})(Error);function rt(e,t){if(!e)throw new Fn(t)}var Pn=["debug","log","warn","error","silent"],Go=Pn.indexOf("log");function Dt(e){return function(){if(Pn.indexOf(e)>=Go){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")})(rt||(rt={}));var En="3.14.0";function mt(e){try{return e()}catch{}}const ur=mt(function(){return globalThis})||mt(function(){return window})||mt(function(){return self})||mt(function(){return global})||mt(function(){return mt.constructor("return this")()});var Jr=new Map;function Zo(e){var t=Jr.get(e)||1;return Jr.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function es(e,t){var r=Zo("stringifyForDisplay");return JSON.stringify(e,function(o,s){return s===void 0?r:s},t).split(JSON.stringify(r)).join("<undefined>")}function zt(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=yr(s),t||(t=br(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||rt(t,yr(r,o)||br(r,o))},{debug:zt(rt.debug),log:zt(rt.log),warn:zt(rt.warn),error:zt(rt.error)});function Tn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Fn(yr(e,t)||br(e,t))}var Kr=Symbol.for("ApolloErrorMessageHandler_"+En);function On(e){if(typeof e=="string")return e;try{return es(e,2).slice(0,1e3)}catch{return"<non-serializable>"}}function yr(e,t){if(t===void 0&&(t=[]),!!e)return ur[Kr]&&ur[Kr](e,t.map(On))}function br(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:En,message:e,args:t.map(On)})))}function ts(e){return e.definitions.filter(function(t){return t.kind==="OperationDefinition"&&!!t.name}).map(function(t){return t.name.value})[0]||null}let se=null;const Wr={};let rs=1;const ns=()=>class{constructor(){this.id=["slot",rs++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let t=se;t;t=t.parent)if(this.id in t.slots){const r=t.slots[this.id];if(r===Wr)break;return t!==se&&(se.slots[this.id]=r),!0}return se&&(se.slots[this.id]=Wr),!1}getValue(){if(this.hasValue())return se.slots[this.id]}withValue(t,r,o,s){const a={__proto__:null,[this.id]:t},i=se;se={parent:i,slots:a};try{return r.apply(s,o)}finally{se=i}}static bind(t){const r=se;return function(){const o=se;try{return se=r,t.apply(this,arguments)}finally{se=o}}}static noContext(t,r,o){if(se){const s=se;try{return se=null,t.apply(o,r)}finally{se=s}}else return t.apply(o,r)}};function Qr(e){try{return e()}catch{}}const nr="@wry/context:Slot",os=Qr(()=>globalThis)||Qr(()=>global)||Object.create(null),Xr=os,vr=Xr[nr]||Array[nr]||(function(e){try{Object.defineProperty(Xr,nr,{value:e,enumerable:!1,writable:!1,configurable:!0})}finally{return e}})(ns()),{bind:qa,noContext:Ra}=vr;new vr;function ss(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=as(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 as(e,t){if(e){if(typeof e=="string")return Gr(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 Gr(e,t)}}function Gr(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 Zr(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 jr(e,t,r){return t&&Zr(e.prototype,t),r&&Zr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var kr=function(){return typeof Symbol=="function"},Sr=function(e){return kr()&&!!Symbol[e]},Nr=function(e){return Sr(e)?Symbol[e]:"@@"+e};kr()&&!Sr("observable")&&(Symbol.observable=Symbol("observable"));var is=Nr("iterator"),fr=Nr("observable"),An=Nr("species");function Wt(e,t){var r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function St(e){var t=e.constructor;return t!==void 0&&(t=t[An],t===null&&(t=void 0)),t!==void 0?t:de}function ls(e){return e instanceof de}function pt(e){pt.log?pt.log(e):setTimeout(function(){throw e})}function Bt(e){Promise.resolve().then(function(){try{e()}catch(t){pt(t)}})}function $n(e){var t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t=="function")t();else{var r=Wt(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 cs(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(Ln(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function Ln(e,t,r){e._state="running";var o=e._observer;try{var s=Wt(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"?$n(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}],Bt(function(){return cs(e)});return}Ln(e,t,r)}}var ds=(function(){function e(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var s=new us(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),$n(this))},jr(e,[{key:"closed",get:function(){return this._state==="closed"}}]),e})(),us=(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")},jr(e,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),e})(),de=(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 ds(o,this._subscriber)},t.forEach=function(o){var s=this;return new Promise(function(a,i){if(typeof o!="function"){i(new TypeError(o+" is not a function"));return}function c(){l.unsubscribe(),a()}var l=s.subscribe({next:function(h){try{o(h,c)}catch(p){i(p),l.unsubscribe()}},error:i,complete:a})})},t.map=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{c=o(c)}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.filter=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){return s.subscribe({next:function(c){try{if(!o(c))return}catch(l){return i.error(l)}i.next(c)},error:function(c){i.error(c)},complete:function(){i.complete()}})})},t.reduce=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this),i=arguments.length>1,c=!1,l=arguments[1],h=l;return new a(function(p){return s.subscribe({next:function(b){var v=!c;if(c=!0,!v||i)try{h=o(h,b)}catch(C){return p.error(C)}else h=b},error:function(b){p.error(b)},complete:function(){if(!c&&!i)return p.error(new TypeError("Cannot reduce an empty sequence"));p.next(h),p.complete()}})})},t.concat=function(){for(var o=this,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var c=St(this);return new c(function(l){var h,p=0;function b(v){h=v.subscribe({next:function(C){l.next(C)},error:function(C){l.error(C)},complete:function(){p===a.length?(h=void 0,l.complete()):b(c.from(a[p++]))}})}return b(o),function(){h&&(h.unsubscribe(),h=void 0)}})},t.flatMap=function(o){var s=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var a=St(this);return new a(function(i){var c=[],l=s.subscribe({next:function(p){if(o)try{p=o(p)}catch(v){return i.error(v)}var b=a.from(p).subscribe({next:function(v){i.next(v)},error:function(v){i.error(v)},complete:function(){var v=c.indexOf(b);v>=0&&c.splice(v,1),h()}});c.push(b)},error:function(p){i.error(p)},complete:function(){h()}});function h(){l.closed&&c.length===0&&i.complete()}return function(){c.forEach(function(p){return p.unsubscribe()}),l.unsubscribe()}})},t[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=Wt(o,fr);if(a){var i=a.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return ls(i)&&i.constructor===s?i:new s(function(c){return i.subscribe(c)})}if(Sr("iterator")&&(a=Wt(o,is),a))return new s(function(c){Bt(function(){if(!c.closed){for(var l=ss(a.call(o)),h;!(h=l()).done;){var p=h.value;if(c.next(p),c.closed)return}c.complete()}})});if(Array.isArray(o))return new s(function(c){Bt(function(){if(!c.closed){for(var l=0;l<o.length;++l)if(c.next(o[l]),c.closed)return;c.complete()}})});throw new TypeError(o+" is not observable")},e.of=function(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];var i=typeof this=="function"?this:e;return new i(function(c){Bt(function(){if(!c.closed){for(var l=0;l<s.length;++l)if(c.next(s[l]),c.closed)return;c.complete()}})})},jr(e,null,[{key:An,get:function(){return this}}]),e})();kr()&&Object.defineProperty(de,Symbol("extensions"),{value:{symbol:fr,hostReportError:pt},configurable:!0});function fs(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 ht;typeof self<"u"?ht=self:typeof window<"u"?ht=window:typeof global<"u"?ht=global:typeof module<"u"?ht=module:ht=Function("return this")();fs(ht);var en=de.prototype,tn="@@observable";en[tn]||(en[tn]=function(){return this});function ms(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 Tn(58,s)}return e}function hs(e,t){var r=Ye({},e),o=function(a){typeof a=="function"?r=Ye(Ye({},r),a(r)):r=Ye(Ye({},r),a)},s=function(){return Ye({},r)};return Object.defineProperty(t,"setContext",{enumerable:!1,value:o}),Object.defineProperty(t,"getContext",{enumerable:!1,value:s}),t}function ps(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName=typeof t.query!="string"?ts(t.query)||void 0:""),t}var gs=Symbol.for("apollo.deprecations"),xs=ur,ws=new vr;function ys(e){return xs[gs]||(ws.getValue()||[]).includes(e)}function bs(e,t){ys(e)||t()}function rn(e,t){return t?t(e):de.of()}function Nt(e){return typeof e=="function"?new Dn(e):e}function Mt(e){return e.request.length<=1}var Dn=(function(){function e(t){t&&(this.request=t)}return e.empty=function(){return new e(function(){return de.of()})},e.from=function(t){return t.length===0?e.empty():t.map(Nt).reduce(function(r,o){return r.concat(o)})},e.split=function(t,r,o){var s=Nt(r),a=Nt(o||new e(rn)),i;return Mt(s)&&Mt(a)?i=new e(function(c){return t(c)?s.request(c)||de.of():a.request(c)||de.of()}):i=new e(function(c,l){return t(c)?s.request(c,l)||de.of():a.request(c,l)||de.of()}),Object.assign(i,{left:s,right:a})},e.execute=function(t,r){return t.request(hs(r.context,ps(ms(r))))||de.of()},e.concat=function(t,r){var o=Nt(t);if(Mt(o))return globalThis.__DEV__!==!1&&rr.warn(47,o),o;var s=Nt(r),a;return Mt(s)?a=new e(function(i){return o.request(i,function(c){return s.request(c)||de.of()})||de.of()}):a=new e(function(i,c){return o.request(i,function(l){return s.request(l,c)||de.of()})||de.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(rn)))},e.prototype.concat=function(t){return e.concat(this,t)},e.prototype.request=function(t,r){throw Tn(48)},e.prototype.onError=function(t,r){if(globalThis.__DEV__!==!1&&bs("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 vs(e){return new Dn(function(t,r){var o=Qo(t,[]);return new de(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 js=async()=>{const e="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const s=await fe.post(e,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return s.status===200&&s.data.access_token?s.data.access_token:(console.error("Failed to fetch token:",s.data),null)}catch(s){return fe.isAxiosError(s)?console.error("Error fetching token:",s.response||s.message):console.error("Unexpected error:",s),null}},ks="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Ss=Vt.createHttpLink({uri:`${ks}`}),Ns=vs(async(e,{headers:t})=>{const r=await js();return{headers:{...t,authorization:`Bearer ${r}`}}}),Cs=new Vt.ApolloClient({link:Ns.concat(Ss),cache:new Vt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),_s=e=>{const{tanyaConfig:t}=e;return n.jsx(Vt.ApolloProvider,{client:Cs,children:n.jsx($o,{children:n.jsx(Ko,{tanyaConfig:t})})})};function Is(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 zn=Object.freeze({left:0,top:0,width:16,height:16}),Qt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Cr=Object.freeze({...zn,...Qt}),hr=Object.freeze({...Cr,body:"",hidden:!1});function Fs(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 nn(e,t){const r=Fs(e,t);for(const o in hr)o in Qt?o in e&&!(o in r)&&(r[o]=Qt[o]):o in t?r[o]=t[o]:o in e&&(r[o]=e[o]);return r}function Ps(e,t,r){const o=e.icons,s=e.aliases||Object.create(null);let a={};function i(c){a=nn(o[c]||s[c],a)}return i(t),r.forEach(i),nn(e,a)}function Mn(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=Is(e);for(const s in o){const a=o[s];a&&(t(s,Ps(e,s,a)),r.push(s))}return r}const Es={provider:"",aliases:{},not_found:{},...zn};function sr(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Bn(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,Es))return null;const r=t.icons;for(const s in r){const a=r[s];if(!s||typeof a.body!="string"||!sr(a,hr))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,hr))return null}return t}const on=Object.create(null);function Ts(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function gt(e,t){const r=on[e]||(on[e]=Object.create(null));return r[t]||(r[t]=Ts(e,t))}function qn(e,t){return Bn(t)?Mn(t,(r,o)=>{o?e.icons[r]=o:e.missing.add(r)}):[]}function Os(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}const Rn=/^[a-z0-9]+(-[a-z0-9]+)*$/,Xt=(e,t,r,o="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;o=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const c=s.pop(),l=s.pop(),h={provider:s.length>0?s[0]:o,prefix:l,name:c};return t&&!qt(h)?null:h}const a=s[0],i=a.split("-");if(i.length>1){const c={provider:o,prefix:i.shift(),name:i.join("-")};return t&&!qt(c)?null:c}if(r&&o===""){const c={provider:o,prefix:"",name:a};return t&&!qt(c,r)?null:c}return null},qt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let Pt=!1;function Un(e){return typeof e=="boolean"&&(Pt=e),Pt}function sn(e){const t=typeof e=="string"?Xt(e,!0,Pt):e;if(t){const r=gt(t.provider,t.prefix),o=t.name;return r.icons[o]||(r.missing.has(o)?null:void 0)}}function As(e,t){const r=Xt(e,!0,Pt);if(!r)return!1;const o=gt(r.provider,r.prefix);return t?Os(o,r.name,t):(o.missing.add(r.name),!0)}function $s(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Pt&&!t&&!e.prefix){let s=!1;return Bn(e)&&(e.prefix="",Mn(e,(a,i)=>{As(a,i)&&(s=!0)})),s}const r=e.prefix;if(!qt({prefix:r,name:"a"}))return!1;const o=gt(t,r);return!!qn(o,e)}const Hn=Object.freeze({width:null,height:null}),Vn=Object.freeze({...Hn,...Qt}),Ls=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ds=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function an(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(Ls);if(o===null||!o.length)return e;const s=[];let a=o.shift(),i=Ds.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 zs(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 Ms(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Bs(e,t,r){const o=zs(e);return Ms(o.defs,t+o.content+r)}const qs=e=>e==="unset"||e==="undefined"||e==="none";function Rs(e,t){const r={...Cr,...e},o={...Vn,...t},s={left:r.left,top:r.top,width:r.width,height:r.height};let a=r.body;[r,o].forEach(F=>{const j=[],_=F.hFlip,M=F.vFlip;let B=F.rotate;_?M?B+=2:(j.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),j.push("scale(-1 1)"),s.top=s.left=0):M&&(j.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),j.push("scale(1 -1)"),s.top=s.left=0);let W;switch(B<0&&(B-=Math.floor(B/4)*4),B=B%4,B){case 1:W=s.height/2+s.top,j.unshift("rotate(90 "+W.toString()+" "+W.toString()+")");break;case 2:j.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:W=s.width/2+s.left,j.unshift("rotate(-90 "+W.toString()+" "+W.toString()+")");break}B%2===1&&(s.left!==s.top&&(W=s.left,s.left=s.top,s.top=W),s.width!==s.height&&(W=s.width,s.width=s.height,s.height=W)),j.length&&(a=Bs(a,'<g transform="'+j.join(" ")+'">',"</g>"))});const i=o.width,c=o.height,l=s.width,h=s.height;let p,b;i===null?(b=c===null?"1em":c==="auto"?h:c,p=an(b,l/h)):(p=i==="auto"?l:i,b=c===null?an(p,h/l):c==="auto"?h:c);const v={},C=(F,j)=>{qs(j)||(v[F]=j.toString())};C("width",p),C("height",b);const S=[s.left,s.top,l,h];return v.viewBox=S.join(" "),{attributes:v,viewBox:S,body:a}}const Us=/\sid="(\S+)"/g,Hs="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Vs=0;function Ys(e,t=Hs){const r=[];let o;for(;o=Us.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+(Vs++).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 pr=Object.create(null);function Js(e,t){pr[e]=t}function gr(e){return pr[e]||pr[""]}function _r(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 Ir=Object.create(null),Ct=["https://api.simplesvg.com","https://api.unisvg.com"],Rt=[];for(;Ct.length>0;)Ct.length===1||Math.random()>.5?Rt.push(Ct.shift()):Rt.push(Ct.pop());Ir[""]=_r({resources:["https://api.iconify.design"].concat(Rt)});function Ks(e,t){const r=_r(t);return r===null?!1:(Ir[e]=r,!0)}function Fr(e){return Ir[e]}const Ws=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ln=Ws();function Qs(e,t){const r=Fr(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 Xs(e){return e===404}const Gs=(e,t,r)=>{const o=[],s=Qs(e,t),a="icons";let i={type:a,provider:e,prefix:t,icons:[]},c=0;return r.forEach((l,h)=>{c+=l.length+1,c>=s&&h>0&&(o.push(i),i={type:a,provider:e,prefix:t,icons:[]},c=l.length),i.icons.push(l)}),o.push(i),o};function Zs(e){if(typeof e=="string"){const t=Fr(e);if(t)return t.path}return"/"}const ea=(e,t,r)=>{if(!ln){r("abort",424);return}let o=Zs(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;ln(e+o).then(a=>{const i=a.status;if(i!==200){setTimeout(()=>{r(Xs(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)})},ta={prepare:Gs,send:ea};function Yn(e,t){e.forEach(r=>{const o=r.loaderCallbacks;o&&(r.loaderCallbacks=o.filter(s=>s.id!==t))})}function ra(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let r=!1;const o=e.provider,s=e.prefix;t.forEach(a=>{const i=a.icons,c=i.pending.length;i.pending=i.pending.filter(l=>{if(l.prefix!==s)return!0;const h=l.name;if(e.icons[h])i.loaded.push({provider:o,prefix:s,name:h});else if(e.missing.has(h))i.missing.push({provider:o,prefix:s,name:h});else return r=!0,!0;return!1}),i.pending.length!==c&&(r||Yn([e],a.id),a.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),a.abort))})}))}let na=0;function oa(e,t,r){const o=na++,s=Yn.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 sa(e){const t={loaded:[],missing:[],pending:[]},r=Object.create(null);e.sort((s,a)=>s.provider!==a.provider?s.provider.localeCompare(a.provider):s.prefix!==a.prefix?s.prefix.localeCompare(a.prefix):s.name.localeCompare(a.name));let o={provider:"",prefix:"",name:""};return e.forEach(s=>{if(o.name===s.name&&o.prefix===s.prefix&&o.provider===s.provider)return;o=s;const a=s.provider,i=s.prefix,c=s.name,l=r[a]||(r[a]=Object.create(null)),h=l[i]||(l[i]=gt(a,i));let p;c in h.icons?p=t.loaded:i===""||h.missing.has(c)?p=t.missing:p=t.pending;const b={provider:a,prefix:i,name:c};p.push(b)}),t}function aa(e,t=!0,r=!1){const o=[];return e.forEach(s=>{const a=typeof s=="string"?Xt(s,t,r):s;a&&o.push(a)}),o}const ia={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function la(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 g=e.resources.slice(0);for(i=[];g.length>1;){const R=Math.floor(Math.random()*g.length);i.push(g[R]),g=g.slice(0,R).concat(g.slice(R+1))}i=i.concat(g)}else i=e.resources.slice(a).concat(e.resources.slice(0,a));const c=Date.now();let l="pending",h=0,p,b=null,v=[],C=[];typeof o=="function"&&C.push(o);function S(){b&&(clearTimeout(b),b=null)}function F(){l==="pending"&&(l="aborted"),S(),v.forEach(g=>{g.status==="pending"&&(g.status="aborted")}),v=[]}function j(g,R){R&&(C=[]),typeof g=="function"&&C.push(g)}function _(){return{startTime:c,payload:t,status:l,queriesSent:h,queriesPending:v.length,subscribe:j,abort:F}}function M(){l="failed",C.forEach(g=>{g(void 0,p)})}function B(){v.forEach(g=>{g.status==="pending"&&(g.status="aborted")}),v=[]}function W(g,R,xe){const me=R!=="success";switch(v=v.filter(re=>re!==g),l){case"pending":break;case"failed":if(me||!e.dataAfterTimeout)return;break;default:return}if(R==="abort"){p=xe,M();return}if(me){p=xe,v.length||(i.length?Ce():M());return}if(S(),B(),!e.random){const re=e.resources.indexOf(g.resource);re!==-1&&re!==e.index&&(e.index=re)}l="completed",C.forEach(re=>{re(xe)})}function Ce(){if(l!=="pending")return;S();const g=i.shift();if(g===void 0){if(v.length){b=setTimeout(()=>{S(),l==="pending"&&(B(),M())},e.timeout);return}M();return}const R={status:"pending",resource:g,callback:(xe,me)=>{W(R,xe,me)}};v.push(R),h++,b=setTimeout(Ce,e.rotate),r(g,t,R.callback)}return setTimeout(Ce),_}function Jn(e){const t={...ia,...e};let r=[];function o(){r=r.filter(c=>c().status==="pending")}function s(c,l,h){const p=la(t,c,l,(b,v)=>{o(),h&&h(b,v)});return r.push(p),p}function a(c){return r.find(l=>c(l))||null}return{query:s,find:a,setIndex:c=>{t.index=c},getIndex:()=>t.index,cleanup:o}}function cn(){}const ar=Object.create(null);function ca(e){if(!ar[e]){const t=Fr(e);if(!t)return;const r=Jn(t),o={config:t,redundancy:r};ar[e]=o}return ar[e]}function da(e,t,r){let o,s;if(typeof e=="string"){const a=gr(e);if(!a)return r(void 0,424),cn;s=a.send;const i=ca(e);i&&(o=i.redundancy)}else{const a=_r(e);if(a){o=Jn(a);const i=e.resources?e.resources[0]:"",c=gr(i);c&&(s=c.send)}}return!o||!s?(r(void 0,424),cn):o.query(t,s,r)().abort}function dn(){}function ua(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,ra(e)}))}function fa(e){const t=[],r=[];return e.forEach(o=>{(o.match(Rn)?t:r).push(o)}),{valid:t,invalid:r}}function _t(e,t,r){function o(){const s=e.pendingIcons;t.forEach(a=>{s&&s.delete(a),e.icons[a]||e.missing.add(a)})}if(r&&typeof r=="object")try{if(!qn(e,r).length){o();return}}catch(s){console.error(s)}o(),ua(e)}function un(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function ma(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)){un(e.loadIcons(s,o,r),p=>{_t(e,s,p)});return}if(a){s.forEach(p=>{const b=a(p,o,r);un(b,v=>{const C=v?{prefix:o,icons:{[p]:v}}:null;_t(e,[p],C)})});return}const{valid:i,invalid:c}=fa(s);if(c.length&&_t(e,c,null),!i.length)return;const l=o.match(Rn)?gr(r):null;if(!l){_t(e,i,null);return}l.prepare(r,o,i).forEach(p=>{da(r,p,b=>{_t(e,p.icons,b)})})}))}const ha=(e,t)=>{const r=aa(e,!0,Un()),o=sa(r);if(!o.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(o.loaded,o.missing,o.pending,dn)}),()=>{l=!1}}const s=Object.create(null),a=[];let i,c;return o.pending.forEach(l=>{const{provider:h,prefix:p}=l;if(p===c&&h===i)return;i=h,c=p,a.push(gt(h,p));const b=s[h]||(s[h]=Object.create(null));b[p]||(b[p]=[])}),o.pending.forEach(l=>{const{provider:h,prefix:p,name:b}=l,v=gt(h,p),C=v.pendingIcons||(v.pendingIcons=new Set);C.has(b)||(C.add(b),s[h][p].push(b))}),a.forEach(l=>{const h=s[l.provider][l.prefix];h.length&&ma(l,h)}),t?oa(t,o,a):dn};function pa(e,t){const r={...e};for(const o in t){const s=t[o],a=typeof s;o in Hn?(s===null||s&&(a==="string"||a==="number"))&&(r[o]=s):a===typeof r[o]&&(r[o]=o==="rotate"?s%4:s)}return r}const ga=/[\s,]+/;function xa(e,t){t.split(ga).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function wa(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 ya(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 ba(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function va(e){return"data:image/svg+xml,"+ba(e)}function ja(e){return'url("'+va(e)+'")'}let It;function ka(){try{It=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{It=null}}function Sa(e){return It===void 0&&ka(),It?It.createHTML(e):e}const Kn={...Vn,inline:!1},Na={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Ca={display:"inline-block"},xr={backgroundColor:"currentColor"},Wn={backgroundColor:"transparent"},fn={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},mn={WebkitMask:xr,mask:xr,background:Wn};for(const e in mn){const t=mn[e];for(const r in fn)t[e+r]=fn[r]}const _a={...Kn,inline:!0};function hn(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Ia=(e,t,r)=>{const o=t.inline?_a:Kn,s=pa(o,t),a=t.mode||"svg",i={},c=t.style||{},l={...a==="svg"?Na:{}};if(r){const j=Xt(r,!1,!0);if(j){const _=["iconify"],M=["provider","prefix"];for(const B of M)j[B]&&_.push("iconify--"+j[B]);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"&&xa(s,_);break;case"color":i.color=_;break;case"rotate":typeof _=="string"?s[j]=wa(_):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 h=Rs(e,s),p=h.attributes;if(s.inline&&(i.verticalAlign="-0.125em"),a==="svg"){l.style={...i,...c},Object.assign(l,p);let j=0,_=t.id;return typeof _=="string"&&(_=_.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:Sa(Ys(h.body,_?()=>_+"ID"+j++:"iconifyReact"))},x.createElement("svg",l)}const{body:b,width:v,height:C}=e,S=a==="mask"||(a==="bg"?!1:b.indexOf("currentColor")!==-1),F=ya(b,{...p,width:v+"",height:C+""});return l.style={...i,"--svg":ja(F),width:hn(p.width),height:hn(p.height),...Ca,...S?xr:Wn,...c},x.createElement("span",l)};Un(!0);Js("",ta);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"||!$s(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;Ks(r,s)||console.error(o)}catch{console.error(o)}}}}function Qn(e){const[t,r]=x.useState(!!e.ssr),[o,s]=x.useState({});function a(C){if(C){const S=e.icon;if(typeof S=="object")return{name:"",data:S};const F=sn(S);if(F)return{name:S,data:F}}return{name:""}}const[i,c]=x.useState(a(!!e.ssr));function l(){const C=o.callback;C&&(C(),s({}))}function h(C){if(JSON.stringify(i)!==JSON.stringify(C))return l(),c(C),!0}function p(){var C;const S=e.icon;if(typeof S=="object"){h({name:"",data:S});return}const F=sn(S);if(h({name:S,data:F}))if(F===void 0){const j=ha([S],p);s({callback:j})}else F&&((C=e.onLoad)===null||C===void 0||C.call(e,S))}x.useEffect(()=>(r(!0),l),[]),x.useEffect(()=>{t&&p()},[e.icon,t]);const{name:b,data:v}=i;return v?Ia({...Cr,...v},e,b):e.children?e.children:e.fallback?e.fallback:x.createElement("span",{})}const te=x.forwardRef((e,t)=>Qn({...e,_ref:t}));x.forwardRef((e,t)=>Qn({inline:!0,...e,_ref:t}));const ot="USD",Fa=(e,t=ot)=>{const r=(e==null?void 0:e.prices)??[];if(!r.length)return null;const o=i=>{var h,p;const c=i.find(b=>{var v;return!!((v=b.discounted)!=null&&v.value)});if(c)return{cent:c.discounted.value.centAmount,cur:c.discounted.value.currencyCode,regularCent:(h=c.value)==null?void 0:h.centAmount};const l=(p=i[0])==null?void 0:p.value;return l?{cent:l.centAmount,cur:l.currencyCode}:null},s=r.filter(i=>{var c,l;return((l=((c=i.discounted)==null?void 0:c.value)||i.value)==null?void 0:l.currencyCode)===t}),a=o(s);return a||o(r)||null},Pa=(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},Ea=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}},He=e=>Pa((e==null?void 0:e.attributesRaw)??[],"color"),Ve=e=>Ea((e==null?void 0:e.attributesRaw)??[]).sizeLabel,Ta=(e,t,r)=>{for(const o of e){const s=He(o.variant),a=Ve(o.variant);if((t?s===t:!0)&&(r?a===r:!0))return o}return null},Re=e=>e.charAt(0).toUpperCase()+e.slice(1),tt={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"}},Oa={standard:"GROUND",express:"2-DAY SHIPPING",sameday:"OVERNIGHT"},Ue=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},Xn=e=>e==null?void 0:e.masterVariant,pn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ut=e=>{const t=Xn(e);return t?[t,...pn(e)]:pn(e)},Aa=(e,t=0)=>Ut(e)[t],$a=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},gn=(e,t)=>{var r,o,s,a,i,c,l,h;return $a(t)||((a=(s=(o=(r=e.imageGroups)==null?void 0:r[0])==null?void 0:o.images)==null?void 0:s[0])==null?void 0:a.link)||((h=(l=(c=(i=e.image_groups)==null?void 0:i[0])==null?void 0:c.images)==null?void 0:l[0])==null?void 0:h.link)||""},xn=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Ht=e=>{var a,i,c,l,h,p;const t=e?Fa(e,ot):null;if(t!=null&&t.cent&&(t!=null&&t.cur))return{amount:+(t.cent/100),currency:t.cur,regularAmount:t.regularCent?t.regularCent/100:void 0};const r=(c=(i=(a=e==null?void 0:e.prices)==null?void 0:a[0])==null?void 0:i.value)==null?void 0:c.centAmount,o=((p=(h=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:h.value)==null?void 0:p.currencyCode)??ot;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},wn=(e,t)=>{const{amount:r}=Ht(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},yn=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)||""},La=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)||""},Da=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)||""},bn=20,za=({open:e,onClose:t,product:r,index:o,addressListProp:s,addressLoading:a})=>{console.log(r.imageGroups,"the product for ai shopping");const i=null,c=null,l=Ut(r),h=Math.min(Math.max(0,o||0),Math.max(0,l.length-1)),[p,b]=x.useState([]);x.useEffect(()=>{if(r!=null&&r.variants){const d=v(r.variants,r.imageGroups);b(d)}},[r]);const v=(d,f)=>{const u={};f==null||f.forEach(y=>{var Y,ie,le;const I=(Y=y.variationAttributes)==null?void 0:Y.find(Ne=>Ne.id==="color");if(!I)return;const N=(le=(ie=I.values)==null?void 0:ie[0])==null?void 0:le.value;N&&(u[N]||(u[N]={}),u[N][y.viewType]=y.images)});const w=d.reduce((y,I)=>{const N=I.variationValues.color,Y=I.variationValues.size,ie={color:N};return y[N]||(y[N]={color:N,images:Lo(f,{viewType:"large",selectedVariationAttributes:ie}),variants:[]}),y[N].variants.push({size:Y,...I}),y},{});return Object.values(w).sort((y,I)=>y.color.localeCompare(I.color)).map(y=>({...y,variants:y.variants.sort((I,N)=>Number(I.size)-Number(N.size))}))},C=l.length,[S,F]=x.useState(h),[j,_]=x.useState(null),[M,B]=x.useState(null),W=x.useRef(null),Ce=x.useRef(null),g=Aa(r,S),[R,xe]=x.useState(""),[me,re]=x.useState(!1),[Ke,we]=x.useState(!1),[Q,A]=x.useState(!1),[L,Ee]=x.useState(""),[Te,he]=x.useState(!1),[U,pe]=x.useState(null),[Me,be]=x.useState([]),[D,_e]=x.useState([]),[Se,Ie]=x.useState([]),[Oe,wt]=x.useState(!1),[m,q]=x.useState(),[z,J]=x.useState(!0),[T,P]=x.useState(!1),[ne,H]=x.useState(!1),[$,G]=x.useState("standard"),[Z,ue]=x.useState(!1),[ge,X]=x.useState(!1),[ae,ve]=x.useState("card"),[ee,k]=x.useState(!1),[ye,O]=x.useState(!1),[V,K]=x.useState(!1),[We,Et]=x.useState(null),[dt,Ae]=x.useState(null),[yt,Tt]=x.useState(""),[E,$e]=x.useState(!1),Qe=x.useRef(null);x.useEffect(()=>{const d=Ut(r),f=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));F(f);const u=Xn(r),w=He(u),y=Ve(u);W.current=w||null,Ce.current=y||null,_(w||null),B(y||null)},[o,r]),x.useEffect(()=>{Qe.current&&(Qe.current.scrollTop=Qe.current.scrollHeight)},[Me,Oe,T,ne,Z,ge,ee,ye,V,me,Ke]);const oe="var(--tanya)",Gt="var(--tanya-contrast)",Ot=oe,Gn="#804c9e",Zn=()=>{console.log("AgenticShopping feedback:",{rating:dt,comment:yt}),$e(!0)},eo=()=>{Ae(null),Tt(""),$e(!0)},Pr=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??We;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(te,{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})]}),!E&&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(w=>n.jsx("button",{type:"button",onClick:()=>Ae(w),className:"p-0.5",children:n.jsx(te,{icon:dt&&dt>=w?"mdi:star":"mdi:star-outline",width:"20",className:"text-yellow-500"})},w))}),n.jsx("label",{className:"block text-sm text-gray-700 mb-1",children:"Tell us more about the response"}),n.jsx("textarea",{value:yt,onChange:w=>Tt(w.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:eo,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:Zn,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:oe},disabled:!dt&&!yt.trim(),children:"Submit"})]})]}),E&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},to=async()=>{try{Ie(s)}catch(d){console.error("Error fetching addresses:",d)}},bt=(d,f)=>{be(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:f}])},Er=(d,f)=>{be(u=>u.map(w=>w.response==="__CARD__"?{...w,response:"__SNAPSHOT__",snapshotStage:d??w.snapshotStage,snapshotPayload:f??w.snapshotPayload}:w))},ro=()=>{be(d=>d.filter(f=>!(f.query===""&&f.response!=="__SNAPSHOT__"&&f.response!=="__TEXT__")))},At=()=>{O(!1),wt(!1),H(!1),X(!1),P(!1),ue(!1),k(!1),K(!1),he(!1),pe(null),ro(),re(!1),we(!1)},no=()=>{wt(!1),P(!1),H(!1),G("standard"),ue(!1),X(!1),ve("card"),k(!1),O(!1),K(!1),J(!0),pe(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")},vt=x.useMemo(()=>Ut(r).map((f,u)=>({index:u,variant:f,images:((f==null?void 0:f.images)||[]).map(w=>(w==null?void 0:w.url)||"").filter(Boolean)})),[r]),jt=x.useMemo(()=>{if(!vt.length)return!1;const d=j||void 0,f=M||void 0,u=(w,y)=>{var N;const I=Ta(vt,w||void 0,y||void 0);return!!(I&&((N=I.variant)!=null&&N.sku))};return d&&f?u(d,f):d&&!f?u(d,null):!d&&f?u(void 0,f):!0},[vt,j,M,g]),oo=Q||Te||!jt,kt=d=>{const f=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(f)&&f>0?f:1},Tr=d=>{const f=kt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(wn(r,g)*f)},Or=d=>{var Y;const f=U,u=Ht(g),w=d||(f==null?void 0:f.currency)||u.currency||ot,y=Tr(f),I=+(y*.08).toFixed(2),N=((Y=tt[$])==null?void 0:Y.fee)||0;return{product_total:y,tax:I,shipping_fee:N,currency:w}},Zt=async(d,f,u)=>{Er(),no(),A(!0),he(!0),re(!1),we(!1);const w=D.slice(-bn);try{const y=await lr(i,c);if(!y)throw new Error("Failed to fetch token");const I=localStorage.getItem("customerNumber"),N=localStorage.getItem("isLoggedIn"),ie=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(N||!1),userId:String(I||new Date().getTime())}).toString()}`,le=await fetch(`${ie}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},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:w}})});if(!le.body)throw new Error("Readable stream not supported");const Ne=le.body.getReader(),Le=new TextDecoder;let Xe="",Be="",Ge="";for(;;){const{done:ke,value:qe}=await Ne.read();if(ke)break;Xe+=Le.decode(qe,{stream:!0});const ut=Xe.split(`
17
+ `);Xe=ut.pop()||"";for(const ft of ut){if(!ft.startsWith("data:"))continue;const Ze=ft.slice(5).trim();try{const De=JSON.parse(Ze),Fe=De.index,ce=De.data;Fe===0?Be=String(ce??""):Fe===1&&(Ge=String(ce??""))}catch(De){console.error("Error parsing JSON chunk:",De)}}}let je=null;if(Be){const ke=String(Be).replace(/\\n/g,"").trim();if(ke.startsWith("{")&&ke.endsWith("}"))try{je=JSON.parse(ke),je.product_id=f,je.sku_id=f,localStorage.setItem("agentic_order",JSON.stringify(je))}catch(qe){console.log(qe)}}pe(je),je&&be(ke=>[...ke,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:je}}]),_e(ke=>[...ke,{userQuery:d,mainResponse:Be||"",keywords:Ge||""}].slice(-bn))}catch(y){console.error("Error sending message to Tanya:",y),he(!1)}finally{A(!1)}},Ar=async d=>{if(Te||Q||!jt)return;const f=L.trim();if(!f)return;be(I=>[...I,{query:f,response:""}]),Ee(""),xe(f);const u=g==null?void 0:g.sku,w=yn(r),y=u||w||"";if(C<=1){if(y){Zt(f,y,S);return}we(!0),he(!0);return}y?(re(!0),he(!0)):(we(!0),he(!0))},so=()=>{const d=g==null?void 0:g.sku;d&&Zt(R,d,S)},ao=()=>{re(!1),we(!0),he(!0)},io=()=>{if(!g||!g.sku)return;const d=g.sku;Zt(R,d,S)},lo=async()=>{wt(!0),H(!1),X(!1),O(!1),P(!1),ue(!1),k(!1),K(!1),await to(),Er("initial",{extractedDetails:U??void 0})},co=()=>{if(!m)return;const d=Se.find(f=>String(f.addressId??f.id)===m)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),P(!0),H(!0),ue(!1),X(!1),k(!1),O(!1),K(!1),bt("address",d))},uo=()=>{P(!1),H(!1),ue(!1),X(!1),k(!1),O(!1),K(!1),localStorage.removeItem("agentic_order_address")},fo=()=>{$&&(localStorage.setItem("agentic_order_delivery",$),ue(!0),X(!0),k(!1),O(!1),K(!1),bt("delivery",{method:$,...tt[$]}))},$r=()=>{H(!1),ue(!1),X(!1),k(!1),O(!1),K(!1),he(!1),At(),be(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"}}])},mo=()=>{ue(!1),X(!1),k(!1),O(!1),K(!1),localStorage.removeItem("agentic_order_delivery")},ho=()=>{ae&&(localStorage.setItem("agentic_order_payment",ae),k(!0),O(!0),K(!1),bt("payment",{method:ae}))},po=()=>{X(!1),k(!1),O(!1),K(!1),he(!1),At(),be(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"}}])},go=()=>{k(!1),O(!1),K(!1),localStorage.removeItem("agentic_order_payment")},xo=async()=>{try{A(!0);const d=U||{},f=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),w=localStorage.getItem("agentic_order_payment")||"card",{product_total:y,tax:I,shipping_fee:N,currency:Y}=Or(),ie=d.shopper_id||localStorage.getItem("customerId")||void 0,le=(f==null?void 0:f.addressId)||(f==null?void 0:f.id)||void 0,Ne=u?Oa[u]:"GROUND",Le="card-visa",Xe=g==null?void 0:g.sku,Be=(r==null?void 0:r.id)||"",Ge=kt(d),je=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(y*100),ut={shopper_id:ie,shipping_address_id:le,shipping_method_id:Ne,payment_method_id:Le,sku:Xe,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Be,quantity:Ge,max_price_minor:je,currency:Y,instruction_text:R};if(!ie||!le){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:ie,shippingAddressId:le}),alert("Missing customer or address information. Please re-select address and try again."),A(!1);return}const Ze=(await xt()).access_token;if(!Ze)throw new Error("Failed to fetch auth token for intent-mandate");const{serverUrl:De}=at(),Fe=await fetch(`${De}/api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ze}`},body:JSON.stringify(ut)});if(!Fe.ok){const ko=await Fe.text().catch(()=>"");console.error("intent-mandate failed",Fe.status,ko),alert("Something went wrong while saving your smart order. Please try again."),A(!1);return}const ce=await Fe.json().catch(()=>null);console.log("intent-mandate success:",ce);const et=(ce==null?void 0:ce.intent_mandate_id)||(ce==null?void 0:ce.intent_mandateId)||(ce==null?void 0:ce.key)||null;et&&Et(et);const $t={...d,address:f,delivery:u,payment:w,summary:{product_total:y,tax:I,shipping_fee:N,currency:Y},intent_mandate_id:et};localStorage.setItem("agentic_order_final",JSON.stringify($t)),K(!0),J(!1),bt("final",$t),bt("success",{intentMandateId:et}),At()}catch(d){console.error("Error in handleConfirmWatch / intent-mandate:",d),alert("Unable to complete your smart order right now. Please try again in a moment.")}finally{A(!1)}},Lr=()=>{At(),be(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},wo=()=>{const d=gn(r,g),f=xn(r),u=(r==null?void 0:r.id)||"",w=He(g)||"",y=Ve(g)||"",{amount:I}=Ht(g),N=!!(r!=null&&r.id),Y=N;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:d?n.jsx("img",{src:d,alt:f,className:"object-contain w-full h-full"}):n.jsx(te,{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:f}),n.jsx("div",{className:"text-sm text-gray-700 mb-1",children:[u&&`SKU: ${u}`,w&&`Color: ${w}`,y&&`Size: ${y}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:N?`$${r.price}`:"Currently unavailable"}),N&&!Y&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},Dr=({showSubmit:d=!0})=>{const f={};vt.map(w=>He(w.variant)).filter(w=>!!w&&!f[w]&&(f[w]=!0));const u={};return vt.map(w=>Ve(w.variant)).filter(w=>!!w&&!u[w]&&(u[w]=!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 :"}),j&&n.jsx("div",{className:"text-sm text-gray-600",children:j})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:p.map(w=>{const y=w.color,I=j===y,N=w.images.images[0].disBaseLink||w.images.images[0].link;return n.jsxs("div",{className:`flex flex-col items-center w-28 border rounded-md p-2
18
+ ${I?"border-2 border-tanya-light":"border-gray-300"}`,children:[n.jsx("button",{onClick:()=>{_(y),B(null),F(null)},className:"w-full h-20 flex items-center justify-center overflow-hidden",title:y,children:N?n.jsx("img",{src:N,alt:y,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:y})}),n.jsx("div",{className:"w-full border-t my-2"})]},y)})})]}),j&&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 :"}),M&&n.jsx("div",{className:"text-sm text-gray-600",children:M})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(()=>{const w=p.find(y=>y.color===j);return w?w.variants.map((y,I)=>{const N=y.variationValues.size,Y=M===N;return n.jsx("button",{onClick:()=>{B(N),F(I)},className:`px-4 py-2 rounded-md border text-sm ${Y?"border-2 border-tanya-light font-semibold":"border-gray-300"}`,title:N,children:N},`size-${N}`)}):null})()})]}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:io,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:oe},disabled:!jt,children:"Submit"})})]})},zr=(d,f=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||U;if(!u)return null;const w=kt(u),{currency:y}=Ht(g),I=wn(r,g),N=Number((u==null?void 0:u.max_price_minor)??0),ie=Number.isFinite(N)&&N>0?+(N/100):+(I*w),le=(u==null?void 0:u.currency)||y||ot,Ne=g!=null&&g.sku?g.sku:u.product_id;return n.jsxs("div",{className:"px-6 pb-6 flex flex-col items-center space-y-4",style:{backgroundColor:"#14377D"},children:[n.jsx("p",{className:"text-base font-semibold text-center mt-2",style:{color:Gt},children:"Here’s what I found from your instruction:"}),n.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-inner p-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-y-2 text-sm",children:[n.jsx("p",{className:"font-semibold text-gray-600",children:"SKU:"}),n.jsx("p",{className:"text-gray-800",children:Ne}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Quantity:"}),n.jsx("p",{className:"text-gray-800",children:kt(u)}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Currency:"}),n.jsx("p",{className:"text-gray-800",children:le}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Maximum Total Price:"}),n.jsx("p",{className:"text-gray-800",children:Ue(ie,le)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[He(g)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",He(g)]}),Ve(g)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",Ve(g)]}),(g==null?void 0:g.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",g.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:Gt},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:lo,disabled:Oe,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 ${Oe?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:`${oe}`},children:[n.jsx(te,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Lr,disabled:Oe,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${Oe?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:oe,color:Gt},children:[n.jsx(te,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Mr=(d,f=!0)=>{var ft,Ze,De,Fe,ce,et;const u=d||{},w=((ft=u==null?void 0:u.summary)==null?void 0:ft.currency)||(U==null?void 0:U.currency)||ot,y=gn(r,g),I=xn(r),N=g!=null&&g.sku?g.sku:(r==null?void 0:r.id)??(U==null?void 0:U.product_id),Y=(g==null?void 0:g.sku)??yn(r),ie=He(g)||La(r),le=Ve(g)||Da(r),Ne=kt(u),Le=((Ze=u==null?void 0:u.summary)==null?void 0:Ze.product_total)!=null?+u.summary.product_total:Tr(u),Xe=Ne>0?+(Le/Ne).toFixed(2):0,Be=Le,Ge=((De=u==null?void 0:u.summary)==null?void 0:De.tax)??+(Le*.08).toFixed(2),je=((Fe=u==null?void 0:u.summary)==null?void 0:Fe.shipping_fee)??(((ce=tt[$])==null?void 0:ce.fee)||0),ke=u!=null&&u.address?[u.address.addressLine1,u.address.addressLine2,u.address.street,[u.address.city,u.address.state,u.address.postalCode].filter(Boolean).join(", "),u.address.country].filter(Boolean).map($t=>Re(String($t))).join(", "):"—",qe=(u==null?void 0:u.payment)||"card",ut=qe==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Re(qe)});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(te,{icon:"mdi:receipt-text-check-outline",width:"24",color:oe}),"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:y?n.jsx("img",{src:y,alt:I,className:"w-full h-full object-contain"}):n.jsx(te,{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:I}),n.jsxs("div",{className:"text-xs text-center font-bold text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",N??"—"]}),(Y||ie||le)&&n.jsxs("div",{className:"text-xs text-gray-600 mt-0.5 text-center",children:[Y&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",Y,"  "]}),ie&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",ie,"  "]}),le&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Size:"})," ",le]})]})]}),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:Ue(Xe,w)})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Quantity"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:Ne})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Subtotal"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:Ue(Be,w)})]})]})]})]})}),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:ke})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💳 Payment"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:ut})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Delivery"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:u!=null&&u.delivery&&((et=tt[u.delivery])==null?void 0:et.label)||"—"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💰 any(s)"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:Ue(Le,w)})]}),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:Ue(Ge,w)})]}),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:Ue(je,w)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:Ot},children:[n.jsx("div",{className:"text-sm/5 opacity-95",children:"🔹 Total Payable"}),n.jsx("div",{className:"mt-1 text-3xl font-extrabold tracking-tight",children:Ue(Le+Ge+je,w)})]})]}),!f&&n.jsxs("div",{className:"px-6 pb-5",children:[!V&&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?"}),V&&Pr({intentMandateId:We}),z&&!V&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:xo,className:"inline-flex items-center justify-center rounded-full px-6 py-2.5 font-semibold text-white shadow-md transition-transform duration-150 hover:-translate-y-0.5 hover:shadow-lg",style:{background:Ot},children:"Confirm"}),n.jsx("button",{onClick:Lr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:Ot,color:Ot},children:"Cancel"})]})]})]})},yo=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=>Re(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(te,{icon:"mdi:home-map-marker",width:"20",color:oe}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f})]})})},bo=d=>{const f=d==null?void 0:d.method,u=f?tt[f]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(te,{icon:"mdi:truck-delivery",width:"20",color:oe}),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(te,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},vo=d=>{const f=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(te,{icon:"mdi:credit-card-outline",width:"20",color:oe}),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"]}):Re(f)})]})})},jo=(d,f)=>{const u=d.snapshotStage;if(!u||u==="address"&&Oe||u==="delivery"&&ne||u==="payment"&&ge||u==="final"&&ye)return null;switch(u){case"initial":return zr(d.snapshotPayload,!f);case"address":return yo(d.snapshotPayload);case"delivery":return bo(d.snapshotPayload);case"payment":return vo(d.snapshotPayload);case"final":return Mr(d.snapshotPayload,!f);case"success":return Pr(d.snapshotPayload);default:return null}};return Co.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:Gn},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(te,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:Qe,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(wo,{}),C>1&&n.jsx(Dr,{showSubmit:!1}),Me.map((d,f)=>{var y;const u=f===Me.length-1,w=!!d.snapshotStage;return n.jsxs("div",{children:[d.query&&n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm rounded-l-xl p-3 m-3 mb-4 rounded-br-xl max-w-[75%]",style:{color:"#ffffff",backgroundColor:"var(--tanya)"},children:d.query})}),d.response==="__TEXT__"&&((y=d.snapshotPayload)==null?void 0:y.text)&&n.jsx("div",{className:"mt-2",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&me&&C>1&&n.jsxs("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsxs("div",{className:"text-sm text-gray-800",children:["Proceed with color:"," ",n.jsx("span",{className:"font-semibold",children:He(g)||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:Ve(g)||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:so,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:oe},children:"Yes"}),n.jsx("button",{onClick:ao,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:oe,color:oe},children:"No, change SKU"})]})]}),u&&Ke&&n.jsx(Dr,{showSubmit:!0}),u&&Q&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text",children:n.jsx("p",{children:"Reading your instruction and setting things up…"})})})}),(w||d.response==="__CARD__")&&(!Q||!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:w?jo(d,u):zr(d.snapshotPayload,!1)})]},f)}),Oe&&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(te,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),T&&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"}),!V&&n.jsx("button",{onClick:uo,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..."})]}):Se.length>0?n.jsxs("div",{className:`space-y-3 ${T?"opacity-70":""}`,children:[Se.map(d=>{const f=[d.addressLine1,d.addressLine2].filter(Boolean).map(Y=>Re(Y||"")).join(" "),u=Re(d.city||""),w=`${Re(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,y=Re(d.country||""),I=String(d.addressId??d.id),N=m===I;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${N?"border-tanya-light":"border-gray-300"} ${T?"pointer-events-none":""}`,title:T?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:N,disabled:T,onChange:()=>q(I),value:I}),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",{}),w,n.jsx("br",{}),y]})]})]},I)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:$r,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:co,disabled:T,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${T?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:oe},children:T?"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."})]}),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(te,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),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"}),!V&&n.jsx("button",{onClick:mo,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 ${Z?"opacity-70":""}`,children:Object.keys(tt).map(d=>{const f=tt[d],u=$===d;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${u?"border-tanya-light":"border-gray-300"} ${Z?"pointer-events-none":""}`,title:Z?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:u,disabled:Z,onChange:()=>G(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(te,{icon:f.icon,width:"18"})," ",f.label]}),n.jsx("div",{className:"text-sm text-gray-700",children:f.subtitle})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:f.fee===0?"Free":Ue(f.fee,(U==null?void 0:U.currency)||ot)})]},d)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:$r,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:fo,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:"var(--tanya)"},children:Z?"Delivery Submitted":"Submit Delivery Option"})]})]}),ge&&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(te,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),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"}),!V&&n.jsx("button",{onClick:go,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change 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 ${ee?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${ae==="card"?"border-tanya-light":"border-gray-300"} ${ee?"pointer-events-none":""}`,title:ee?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:ae==="card",disabled:ee,onChange:()=>ve("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(te,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),ae==="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:po,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:ho,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:"var(--tanya)"},children:ee?"Payment Submitted":"Submit Payment Method"})]})]}),ye&&Mr({...U,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:Or(U==null?void 0:U.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:Te?"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.)`:"Oops! This combination isn’t available for this product. Try a different option.",disabled:oo,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:L,onKeyDown:d=>{d.key==="Enter"&&!Q&&!Te&&Ar()},onChange:d=>Ee(d.target.value)}),n.jsx("button",{type:"submit",disabled:Q||Te,className:"mr-6 font-medium",style:{color:"var(--tanya-light)"},onClick:()=>Ar(),children:Q?n.jsx("div",{className:"m-3 animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottom:"2px solid"}}):n.jsx(te,{icon:"fluent:send-48-filled",color:"var(--tanya-light)",width:"24",height:"24"})})]})]})})]}),document.body)};exports.AgenticShoppingButton=za;exports.TanyaChatbot=_s;exports.TanyaChatbotProvider=Fo;
26
20
  //# sourceMappingURL=tanya-chatbot.cjs.js.map