yt-uikit 0.10.108 → 0.10.109

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.
package/dist/esm/index.js CHANGED
@@ -3609,7 +3609,7 @@ function _n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;
3609
3609
  .yt-variant-selection-modal {
3610
3610
  }
3611
3611
  }
3612
- `,vm=({options:t,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i,showOutOfStockVariants:l=!0})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const i=!a||a(t.name);return l||i?e.createElement("div",{key:t.name,onClick:()=>{i&&r(t)},style:{cursor:i?"pointer":"not-allowed"}},((t,n)=>{const r=!a||a(t.name),i={cursor:r?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:r?1:.5};if("color"===o)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name);return"image"===o?e.createElement("img",{src:Io(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name)})(t,n?.name===t.name)):null})),Cm=({product:o,isOpen:a,onClose:i,variantOptions:l,cta:s,onConfirm:c,showOutOfStockVariants:d=!0})=>{const p=r(()=>e=>e?o?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[o?.tracksInventory]),m=r(()=>{const e=o.variants.edges.find(e=>{const t=e.node;return p(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):o.options?.map(e=>e.values[0])||[]},[o,p]),[u,g]=t(m),[f,y]=t(window.innerWidth<1024);n(()=>{const e=()=>y(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&i()};return a&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[a,i]);const x=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?u.join(" / "):u[0]))?.node,h=x?.image?.url||o.featuredMedia?.preview?.image?.url,b=Io(h,150,85,"webp"),w=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},v=e=>{if(!l?.options)return e.values.map(e=>({name:e,value:e}));const t=l.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},C=(e,t)=>{const n=u[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!a)return null;const E=e.createElement("div",{onClick:i,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:b,alt:o.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},o.title))),e.createElement("div",{style:{padding:"20px"}},o.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},C(t,n)?.name||t.values[0])),e.createElement(vm,{options:v(t),selectedValue:C(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,g(n)})(n,e)},type:w(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...u];n[e]=t;const r=o.options?.length>0?n.join(" / "):n[0],a=o.variants.edges.find(e=>e.node.title===r)?.node;return!!a&&p(a)>0})(n,e),isMobile:f,showOutOfStockVariants:d}))))),e.createElement("button",{onClick:()=>{const e=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?u.join(" / "):u[0]))?.node,t=!!e&&p(e)>0;if(e?.id&&t)c(e.id),i();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const e=o.variants.edges.find(e=>p(e.node)>0)?.node.id;e&&(c(e),i())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:s.backgroundColor,color:s.textColor,textAlign:"center",padding:"16px 0",border:"none",cursor:"pointer",borderBottomLeftRadius:16,borderBottomRightRadius:16},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9"},onMouseLeave:e=>{e.currentTarget.style.opacity="1"},"data-gokwik-processed":"true"},"Add to Bundle")));return V.createPortal(E,document.body)},Em=e=>Math.min(5,Math.max(1,e)),km=(e,t,n)=>e*n+t*(1-n),Tm=({src:r,previewSrc:i,alt:l,onClose:s})=>{const[c,d]=t(1),[p,m]=t(i||r),u=o(null),g=o(null),f=o(null),y=o(null),x=o({s:1,x:0,y:0}),h=o(),b=o(null),w=o(null),v=o(!1);n(()=>{if(r===p)return;const e=new Image;return e.onload=()=>m(r),e.src=r,()=>{e.onload=null}},[r]),n(()=>{const e=u.current;if(!e)return;const t=e=>e.stopPropagation();return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)},[]),n(()=>{const e=e=>{"Escape"===e.key&&s()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]),n(()=>{const e=g.current;if(!e)return;const t=()=>{h.current||(h.current=requestAnimationFrame(()=>{h.current=void 0;const e=x.current;f.current&&(f.current.style.transform=`translate3d(${e.x}px, ${e.y}px, 0) scale(${e.s})`);const t=y.current;t&&t.firstChild&&(t.firstChild.nodeValue=`${Math.round(100*e.s)}%`)}))},n=()=>{const t=f.current,n=x.current;if(!t)return;const r=Math.max(0,(t.offsetWidth*n.s-e.clientWidth)/2),o=Math.max(0,(t.offsetHeight*n.s-e.clientHeight)/2);n.x=Math.min(r,Math.max(-r,n.x)),n.y=Math.min(o,Math.max(-o,n.y))},r=e=>{f.current&&(f.current.style.transition=e?"transform 200ms ease-out":"")},o=(r,o,a)=>{const i=x.current,l=e.getBoundingClientRect(),s=Em(r),c=s/i.s;i.x=km(i.x,o-l.left-l.width/2,c),i.y=km(i.y,a-l.top-l.height/2,c),i.s=s,n(),t()},a=(e,r)=>{const o=x.current;o.x+=e,o.y+=r,n(),t()},i=e=>({x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2,dist:Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY)}),l=e=>{if(r(!1),v.current=!1,2===e.touches.length)return e.preventDefault(),b.current=i(e.touches),void(w.current=null);const t=e.touches[0];w.current={x:t.clientX,y:t.clientY}},s=e=>{e.preventDefault();const t=b.current;if(2===e.touches.length&&t){const n=i(e.touches);return o(x.current.s*(n.dist/t.dist),n.x,n.y),a(n.x-t.x,n.y-t.y),b.current=n,void(v.current=!0)}const n=w.current;if(!n||1!==e.touches.length||x.current.s<=1)return;const r=e.touches[0];a(r.clientX-n.x,r.clientY-n.y),w.current={x:r.clientX,y:r.clientY},v.current=!0},c=e=>{e.touches.length<2&&(b.current=null),w.current=1===e.touches.length?{x:e.touches[0].clientX,y:e.touches[0].clientY}:null,d(x.current.s)},p=e=>{e.preventDefault(),r(!1),e.ctrlKey||e.metaKey?o(x.current.s*Math.exp(-e.deltaY/120),e.clientX,e.clientY):a(-e.deltaX,-e.deltaY),d(x.current.s)},m=e=>{r(!0),o(x.current.s>1?1:2.5,e.clientX,e.clientY),d(x.current.s)};return e.addEventListener("touchstart",l,{passive:!1}),e.addEventListener("touchmove",s,{passive:!1}),e.addEventListener("touchend",c),e.addEventListener("touchcancel",c),e.addEventListener("wheel",p,{passive:!1}),e.addEventListener("dblclick",m),()=>{e.removeEventListener("touchstart",l),e.removeEventListener("touchmove",s),e.removeEventListener("touchend",c),e.removeEventListener("touchcancel",c),e.removeEventListener("wheel",p),e.removeEventListener("dblclick",m),h.current&&cancelAnimationFrame(h.current)}},[]);const C=a(e=>{const t=g.current,n=f.current,r=x.current;if(!t||!n)return;const o=Em(e),a=o/r.s;r.x=km(r.x,0,a),r.y=km(r.y,0,a),r.s=o;const i=Math.max(0,(n.offsetWidth*o-t.clientWidth)/2),l=Math.max(0,(n.offsetHeight*o-t.clientHeight)/2);r.x=Math.min(i,Math.max(-i,r.x)),r.y=Math.min(l,Math.max(-l,r.y)),n.style.transition="transform 200ms ease-out",n.style.transform=`translate3d(${r.x}px, ${r.y}px, 0) scale(${o})`,d(o)},[]),E={display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"38px",padding:0,border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.55)",color:"#fff",cursor:"pointer"};return V.createPortal(e.createElement("div",{ref:u,style:{position:"fixed",top:0,right:0,bottom:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.92)",zIndex:2147483646}},e.createElement("div",{ref:g,style:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none",cursor:c>1?"grab":"zoom-in"},onClick:e=>{v.current||"IMG"!==e.target.tagName&&s()},onPointerDown:e=>{v.current=!1,"touch"!==e.pointerType&&1!==c&&(f.current&&(f.current.style.transition=""),w.current={x:e.clientX,y:e.clientY})},onPointerMove:e=>{const t=w.current,n=f.current,r=g.current;if("touch"===e.pointerType||!t||!n||!r)return;const o=x.current,a=Math.max(0,(n.offsetWidth*o.s-r.clientWidth)/2),i=Math.max(0,(n.offsetHeight*o.s-r.clientHeight)/2);o.x=Math.min(a,Math.max(-a,o.x+e.clientX-t.x)),o.y=Math.min(i,Math.max(-i,o.y+e.clientY-t.y)),n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0) scale(${o.s})`,w.current={x:e.clientX,y:e.clientY},v.current=!0},onPointerUp:()=>{w.current=null},onPointerLeave:()=>{w.current=null}},e.createElement("img",{ref:f,src:p,alt:l,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",userSelect:"none",willChange:"transform"}})),e.createElement("button",{type:"button","aria-label":"Close image",onClick:s,style:{...E,position:"fixed",top:"16px",right:"16px"}},e.createElement(yt,{size:16})),e.createElement("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"10px"}},e.createElement("button",{type:"button","aria-label":"Zoom out",onClick:()=>C(c-.5),disabled:c<=1,style:{...E,opacity:c<=1?.4:1}},e.createElement(xt,{size:16})),e.createElement("span",{ref:y,style:{color:"#fff",fontSize:"13px",minWidth:"44px",textAlign:"center"}},`${Math.round(100*c)}%`),e.createElement("button",{type:"button","aria-label":"Zoom in",onClick:()=>C(c+.5),disabled:c>=5,style:{...E,opacity:c>=5?.4:1}},e.createElement(ht,{size:16})))),document.body)},Sm=({src:n,fullSrc:r,alt:o,className:a,style:i})=>{const[l,s]=t(!1);return e.createElement("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%",width:i?.width,height:i?.height,lineHeight:0}},e.createElement("img",{src:n,alt:o,className:a,onClick:()=>s(!0),style:{maxWidth:"100%",cursor:"zoom-in",...i},loading:"lazy"}),e.createElement("button",{type:"button","aria-label":"Expand image",onClick:e=>{e.stopPropagation(),s(!0)},style:{position:"absolute",bottom:"10px",right:"10px",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:0,border:"1px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.9)",color:"#000",cursor:"pointer"}},e.createElement(ft,{size:14})),l&&e.createElement(Tm,{src:r||n,previewSrc:n,alt:o,onClose:()=>s(!1)}))},Nm={appearance:"none",WebkitAppearance:"none",margin:0,minWidth:0,minHeight:0,width:"auto",height:"auto",boxShadow:"none",letterSpacing:"normal",textTransform:"none",fontFamily:"inherit"},Im=({options:r,value:l,onChange:s,className:c,style:d,menuStyle:p,chevronStyle:m,children:u,ariaLabel:g})=>{const f=o(null),y=o(null),[x,h]=t(!1),[w,v]=t(null),[C,E]=t({left:0,width:0,maxHeight:240}),k=r.find(e=>e.value===l),T=a(e=>{if(!e)return;const t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom-4,r=t.top-4,o=n<Math.min(240,160)&&r>n,a=Math.max(120,o?r:n),i=Math.min(240,a),l=Math.max(t.width,120);E({...o?{bottom:window.innerHeight-t.top+4}:{top:t.bottom+4},left:Math.min(t.left,Math.max(8,window.innerWidth-l-8)),width:l,maxHeight:i})},[]),S=a(()=>T(f.current),[T]);return n(()=>{const e=y.current;if(!e)return;const t=e=>e.stopPropagation();return e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0}),()=>{e.removeEventListener("mousedown",t),e.removeEventListener("touchstart",t)}},[x]),i(()=>{x&&S()},[x,S]),n(()=>{if(!x)return;const e=e=>{const t=e.target;f.current?.contains(t)||y.current?.contains(t)||h(!1)},t=e=>{"Escape"===e.key&&(h(!1),f.current?.focus())};document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",t),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S);const n="undefined"!=typeof ResizeObserver?new ResizeObserver(S):null;return f.current&&n?.observe(f.current),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",t),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S),n?.disconnect()}},[x,S]),r.length?e.createElement(e.Fragment,null,e.createElement("button",{type:"button",ref:f,className:c,"aria-haspopup":"listbox","aria-expanded":x,"aria-label":g||k?.label,onClick:e=>{e.preventDefault(),e.stopPropagation(),T(e.currentTarget),v(null),h(e=>!e)},style:{...Nm,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"6px",font:"inherit",textAlign:"left",cursor:"pointer",...d}},e.createElement("span",{className:c?`${c}-value`:void 0,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},u??k?.label??""),e.createElement("span",{className:c?`${c}-chevron`:void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"transform 0.15s ease",transform:x?"rotate(180deg)":"none",...m}},e.createElement(b,null))),x&&"undefined"!=typeof document&&W(e.createElement("div",{ref:y,role:"listbox",className:c?`${c}-menu`:void 0,style:{position:"fixed",top:C.top,bottom:C.bottom,left:C.left,minWidth:C.width,maxWidth:"calc(100vw - 16px)",maxHeight:C.maxHeight,overflowY:"auto",zIndex:2147483647,background:"#fff",color:"#333",border:"1px solid #ddd",borderRadius:"6px",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.14)",padding:"4px",boxSizing:"border-box",fontFamily:"inherit",...p}},r.map(t=>{const n=t.value===l,r=!t.disabled&&t.value===w;return e.createElement("button",{type:"button",key:t.value,role:"option","aria-selected":n,disabled:t.disabled,autoFocus:n,className:[c&&`${c}-menu-option`,t.className].filter(Boolean).join(" ")||void 0,onMouseEnter:()=>!t.disabled&&v(t.value),onMouseLeave:()=>v(e=>e===t.value?null:e),onFocus:()=>!t.disabled&&v(t.value),onClick:e=>{e.preventDefault(),e.stopPropagation(),h(!1),t.value!==l&&s(t.value),f.current?.focus()},style:{...Nm,display:"block",width:"100%",padding:"8px 10px",border:"none",borderRadius:"4px",background:r?"rgba(0, 0, 0, 0.05)":n?"rgba(0, 0, 0, 0.035)":"none",color:"inherit",font:"inherit",fontWeight:n?600:400,textAlign:"left",lineHeight:"normal",cursor:t.disabled?"not-allowed":"pointer",transition:"background-color 0.15s ease",opacity:t.disabled?.45:1}},t.label)})),document.body)):null},Fm=e=>e.split("?")[0],zm=({className:t,product:n,rating:r,reviewRatingType:o})=>{const a=n?.rating?.averageRating??r?.averageRating??0,i=n?.rating?.ratingCount??r?.ratingCount??0;return a<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===o&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},a," rating")),"ratingAndReviewCount"===o&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14}),a,e.createElement(Le,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",i," reviews)"))},Bm=({isMobile:t,product:n,bundleType:r,images:o,mobileScrollRef:a,desktopThumbsRef:i,selectedVariantImage:l,currentImageIndex:s,setCurrentImageIndex:c,themeColor:d})=>e.createElement(e.Fragment,null,e.createElement("div",{style:{position:t?"relative":void 0}},t?e.createElement("div",{ref:a,style:{display:"flex",flexDirection:"row",overflowX:"auto",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},o.length>0&&o.map((t,o)=>e.createElement("div",{key:o,style:{width:"100%",aspectRatio:"1 / 1",flex:"0 0 auto",scrollSnapAlign:"center",zIndex:999}},e.createElement(Sm,{src:Qf(t?.url),fullSrc:t?.url,alt:t.altText||`${n?.title||"Product"} - Image ${o+1}`,className:`yt-${r}-modal-desktop-main-image yt-${r}-modal-desktop-main-image`,style:{width:"100%",height:"100%",objectFit:"contain"}})))):e.createElement(e.Fragment,null,e.createElement(Sm,{src:Qf(l??"")||Qf(o[s]?.url),fullSrc:l||o[s]?.url,alt:o[s]?.altText||`${n?.title||"Product"}`,className:`yt-${r}-modal-desktop-main-image yt-${r}-modal-desktop-main-image main-image`}),e.createElement("div",{ref:i,style:{display:"flex",flexDirection:"row",overflowX:"auto",gap:t?"8px":"12px",padding:"12px 0",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},o.length>1&&o.map((r,o)=>e.createElement("img",{key:o,src:Qf(r?.url),alt:r.altText||`${n?.title||"Product"} - Image ${o+1}`,onClick:()=>c(o),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:s===o?`2px solid ${d||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),$m=({className:t,product:n,selectedVariant:r,onVariantChange:o,getMaxAvailableQty:a,showOutOfStockVariants:i})=>n?.variants?.edges?.length<=1?null:e.createElement("div",{className:t},e.createElement("div",{className:`${t}-label`,style:{marginBottom:"10px"}},e.createElement(Im,{className:`${t}-select`,ariaLabel:`Select ${n.options[0].name}`,value:r?.id||"",onChange:o,options:(n?.variants?.edges??[]).filter(({node:e})=>!1!==i||a(e)>0).map(({node:e})=>({value:e.id,label:e.title,disabled:0===a(e)})),style:{width:"100%",border:"none",borderBottom:"1px solid #e0e0e0",borderRadius:0,background:"transparent",padding:"0 5px 5px 0",fontSize:"16px",color:"#999"},chevronStyle:{fontSize:"12px",color:"#000"},menuStyle:{fontSize:"14px",color:"#000"}},e.createElement("span",null,n.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},r?.title))))),Am=({isMobile:t,product:n,selectedVariants:r,getOptionValues:o,getSelectedOption:a,getOptionType:i,isOptionValueAvailable:l,onOptionChange:s,showOutOfStockVariants:c})=>e.createElement(e.Fragment,null,n.options.map((n,d)=>e.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},r[d]||n.values[0])),e.createElement(vm,{options:o(n),selectedValue:a(n,d),onChange:e=>{s(d,e)},type:i(n.name),isOptionAvailable:e=>l(d,e),isMobile:t,showOutOfStockVariants:!1!==c}))))),Dm=({isMobile:t,bundleType:n,selectedVariant:r,discountedPrice:o,compareAtDisplayPrice:a,isFreebieTier:i,showFreebieTierProductPrices:l,currencySymbol:s,primaryColor:c})=>e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-price yt-${n}-modal-${t?"mobile":"desktop"}-price`,style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:t?"center":"baseline",gap:"6px"}},i&&!l?e.createElement(e.Fragment,null,e.createElement("span",{className:`yt-${n}-compare-price yt-${n}-compare-price yt-fixed-bundle-original-price`,style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Yf(s),Uf(r?.price)),e.createElement("span",{className:`yt-${n}-current-price yt-${n}-current-price`,style:{color:c||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,a>0&&e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-compare-price yt-${n}-modal-${t?"mobile":"desktop"}-compare-price`,style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Yf(s),Uf(a)),e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-current-price yt-${n}-modal-${t?"mobile":"desktop"}-current-price`},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"left",lineHeight:"normal"}},Yf(s),Uf(o))))),Pm=({isMobile:t,bundleType:n,hideAddToBundle:r,themeColor:o,cornerRadius:a,primaryTextColorCta:i,disabled:l,onClick:s,label:c})=>r?null:e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-atc-wrapper yt-${n}-modal-${t?"mobile":"desktop"}-atc-wrapper ${t?"":"yt-product-modal-atc-wrapper"}`,style:{width:t?"100%":"80%"}},e.createElement("button",{"data-gokwik-processed":"true",className:`yt-${n}-modal-${t?"mobile":"desktop"}-atc-button yt-${n}-modal-${t?"mobile":"desktop"}-atc-button ${t?"":"yt-product-modal-atc-button"}`,style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:o||"#111",borderRadius:a,color:i||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:l?.5:1,cursor:l?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),s()},disabled:l},c)),_m={display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px"},Lm={fontSize:"12px",fontWeight:600,lineHeight:"normal",color:"#777",border:"1px solid lightgray",borderRadius:"12px",padding:"2px 8px",flexShrink:0,whiteSpace:"nowrap"},Rm=s((i,l)=>{const[s,c]=Ce(ym),d=r(()=>{const e=i.bundleType;return e&&i.styles?.[e]?i.styles[e]:i.styles?.byob},[i.styles,i.bundleType]),p=i.reviewRatingType??{byob:i.styles?.byob?.productRatingsDisplay,fixedBundle:i.styles?.fixedBundle?.productRatingsDisplay,comboBundle:i.styles?.comboBundle?.comboProductRatingsDisplay}[i.bundleType??""]??i.bundle?.reviewRatingType,m=d?.productVariantTitleType,u=s?.selectedVariant?.title,g="byob"===i?.bundleType?("variant-display-name"===m?s?.selectedVariant?.displayName:"variant-title"===m&&"Default Title"!==u?u:void 0)??s?.title:s?.title,f=d?.variantSelectorType??d?.comboVariantTypeSelector??"dropdown",y=!("customOptions"===f?s?.options?.some(e=>(e?.values?.length??0)>1)??!1:(s?.variants?.edges?.length??0)>1)&&u&&"Default Title"!==u&&u!==g?u:"",x=r(()=>e=>{const t=i?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:e?s?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?i?.bundleProductsCustomQuantity??e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLocaleLowerCase()?i?.bundleProductsCustomQuantity??1/0:0:i?.bundleProductsCustomQuantity??1/0:0},[s?.tracksInventory,i?.customVariantsQuantity,i?.bundleProductsCustomQuantity]),h=s?.variants.edges?.filter(e=>x(e.node)>0)||[],[b,w]=t(h?.[0]?.node),v=r(()=>{if(!b)return 0;const e=parseFloat(b?.price??"0");let t=e;if("comboBundle"===i.bundleType){const n=Number(i.totalPriceSum||0);let r=Number(i.dealPrice||0);!r&&i.bundle&&(i.bundle?.percentageOff?r=n*(1-i.bundle.percentageOff/100):i.bundle?.dealAmount?r=i.bundle.dealAmount:i.bundle?.amountOff&&(r=n-i.bundle.amountOff)),n>0&&r>0&&(t=e/n*r)}else if("fixedBundle"===i.bundleType){const n=i.bundleDiscountType||(i.bundle?.percentageOff?"percentageOff":i.bundle?.dealAmount?"fixedPrice":i.bundle?.amountOff?"amountOff":""),r=i.bundleDiscountValue??i.bundle?.percentageOff??i.bundle?.dealAmount??i.bundle?.amountOff??0,o=i.totalSelectedOriginal??0;if(r)switch(n){case"percentOff":case"percentageOff":case"percentage":case"Percentage":t=e*(1-r/100);break;case"amountOff":case"amount":case"Amount Off":if(o>0){const n=e/o*r;t=Math.max(0,e-n)}break;case"fixedPrice":case"fixed":case"fixedPrice":if(o>0){t=r*(e/o)}}}return parseFloat(t.toFixed(2))},[b,i.bundleType,i.totalPriceSum,i.dealPrice,i.bundleDiscountType,i.bundleDiscountValue,i.totalSelectedOriginal,i.bundle]),C=r(()=>{if(!b)return 0;const e=parseFloat(b?.price??"0"),t=parseFloat(b?.compareAtPrice??"0"),n=i.styles?.[i.bundleType||""]||i.styles?.general,r=n?.discountBadgeDisplay;let o=0;return"comboBundle"===i.bundleType||"fixedBundle"===i.bundleType?"discount-on-compare"===r&&t>0?o=t:v<e?o=e:t>e&&(o=t):t>e&&(o=t),o>0?parseFloat(o.toFixed(2)):0},[b,i.bundleType,i.styles,v]),[E,k]=t(0),[T,S]=t("undefined"!=typeof window&&window.innerWidth<=600),[N,I]=t(1),[F,z]=t("idle"),B=o(null),$=o(null),A=o(null),[D,P]=t(null),_=o(!1),L=o(),[R,O]=t(0),[M,W]=t(),j=r(()=>{const e=s?.variants.edges.find(e=>{const t=e.node;return x(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):s?.options?.map(e=>e.values[0])||[]},[s,x]),[H,q]=t(j);n(()=>{if(s?.id){_.current=!1;const e=s.variants.edges?.filter(e=>x(e.node)>0),t=s?.selectedVariant??e[0]?.node;w(t);const n=t?.image?.url,r=n?(s.media?.edges??[]).map(e=>e?.node?.preview?.image??e?.node?.image).filter(e=>e?.url?.length>0).findIndex(e=>Fm(e.url)===Fm(n)):-1;P(s.selectedVariant&&r>=0?{index:r}:null),k(r>=0?r:0),W(r>=0?void 0:n),t?.title&&"Default Title"!==t.title&&q(t.title.split(" / "))}},[s?.id]),n(()=>{const e=i.selectedProducts?.find(e=>e.variantId===b?.id);I(e?e.quantity:0)},[i.selectedProducts,b?.id]);const U=o(i.onVariantSelect);n(()=>{U.current=i.onVariantSelect},[i.onVariantSelect]),n(()=>{b?.id&&s&&_.current&&U.current?.(b.id,s)},[b?.id,s?.id]),n(()=>{if(!D)return;let e=!1;[$.current,A.current].forEach(t=>{const n=t?.children[D.index];t&&n&&(n.scrollIntoView({behavior:"instant",block:"nearest",inline:"center"}),e=!0)}),e&&P(null)},[D,s?.media?.edges?.length]);const Y=()=>{b?.id&&s&&(z("check"),i.handleAddToBundle(b?.id,s,1),clearTimeout(L.current),L.current=setTimeout(()=>{z("idle"),c(void 0)},500))};n(()=>{const e=()=>S(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>()=>clearTimeout(L.current),[]);const Q=s?.descriptionHtml??"",G=s?.media,Z=G?.edges?.map(e=>e?.node?.preview?.image??e?.node?.image).filter(e=>e?.url?.length>0)??[],X=a(e=>{k(e),W(void 0)},[]),K=a(e=>{const t=h?.find(t=>t.node.id===e)?.node;t&&x(t)>0&&(_.current=!0,w(t),W(t?.image?.url),t.title&&"Default Title"!==t.title&&q(t.title.split(" / ")))},[h,x]),J=a(e=>{if(!i.bundleVariantOptions?.options)return"text";const t=i.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[i.bundleVariantOptions]),ee=a(e=>{if(!i?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=i?.bundleVariantOptions?.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},[i.bundleVariantOptions]),te=a((e,t)=>{const n=[...H];n[e]=t.name,q(n);const r=(s?.options?.length??0)>0?n.join(" / "):n[0],o=s?.variants.edges.find(e=>e.node.title===r)?.node;W(o?.image?.url),o&&x(o)>0&&(_.current=!0,w(o))},[H,s,x]),re=a((e,t)=>{const n=H[t];if(!n)return null;return ee(e).find(e=>e.name===n)||null},[H,ee]),oe=a((e,t)=>{const n=[...H];n[e]=t;const r=(s?.options?.length??0)>0?n.join(" / "):n[0],o=s?.variants.edges.find(e=>e.node.title===r)?.node;return!!o&&x(o)>0},[H,s,x]);if(n(()=>{if(s?.id){document.body.style.overflow="hidden",window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{c(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{document.body.style.overflow="unset",window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}},[s?.id,c]),n(()=>{if(T&&s?.id&&B.current){const e=()=>{B.current&&O(B.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[T,s?.id]),!s)return null;const ae=i.selectedProducts.filter(e=>e.variantId===b?.id).reduce((e,t)=>e+t.quantity,0),ie=i.customVariantsQuantity?.find(e=>e.variantId===b?.id)?.quantity??i.bundleProductsCustomQuantity??1/0,le=ie!==1/0&&ae>=ie,se=i.hideAddToBundle||!b||x(b)<=0||le||"idle"!==F||i?.disableQuantitySelector&&1===N,ce=e.createElement(hm,{className:`yt-${i?.bundleType}-modal-desktop-overlay yt-${i?.bundleType}-modal-desktop-overlay`,onClick:()=>c(void 0)},e.createElement(bm,{$isSmallScreen:T,ref:l,onClick:e=>e.stopPropagation()},e.createElement(wm,{ref:l,className:`yt-${i?.bundleType}-modal-desktop-container yt-${i?.bundleType}-modal-desktop-container yt-variant-selection-modal`},e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop yt-${i?.bundleType}-modal-desktop yt-variant-selection-modal ${T?"small-screen":"large-screen"}`},e.createElement(xm,{className:`yt-${i?.bundleType}-modal-desktop-close yt-${i?.bundleType}-modal-desktop-close`,onClick:()=>{c(void 0)},style:{backgroundColor:"white"}},e.createElement(ne,{size:"25"})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-image-section yt-${i?.bundleType}-modal-desktop-image-section image-section`},e.createElement(Bm,{product:s,bundleType:i.bundleType,images:Z,mobileScrollRef:$,desktopThumbsRef:A,selectedVariantImage:M,currentImageIndex:E,setCurrentImageIndex:X,themeColor:i.themeColor})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-details-section yt-${i?.bundleType}-modal-desktop-details-section details-section`,style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},e.createElement("h2",{className:`yt-${i?.bundleType}-modal-desktop-title yt-${i?.bundleType}-modal-desktop-title`,style:y?_m:void 0},g,y&&e.createElement("span",{className:`yt-${i?.bundleType}-modal-variant-badge`,style:Lm},y)),e.createElement(zm,{product:s,rating:i.rating,reviewRatingType:p,className:`yt-${i?.bundleType}-modal-desktop-rating yt-${i?.bundleType}-modal-desktop-rating`}),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-variant-price-wrapper yt-${i?.bundleType}-modal-desktop-variant-price-wrapper`,style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},"dropdown"===f&&e.createElement($m,{product:s,selectedVariant:b,onVariantChange:K,getMaxAvailableQty:x,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants,className:`yt-${i?.bundleType}-modal-desktop-variant-selector yt-${i?.bundleType}-modal-desktop-variant-selector`}),"customOptions"===f&&e.createElement(Am,{product:s,selectedVariants:H,getOptionValues:ee,getSelectedOption:re,getOptionType:J,isOptionValueAvailable:oe,onOptionChange:te,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants}),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-price-atc-wrapper yt-${i?.bundleType}-modal-desktop-price-atc-wrapper`,style:{display:"flex",justifyContent:i.hideAddToBundle?"flex-start":"center",alignItems:"center",width:"100%"}},e.createElement(Dm,{bundleType:i.bundleType,selectedVariant:b,discountedPrice:v,compareAtDisplayPrice:C,isFreebieTier:i.isFreebieTier,showFreebieTierProductPrices:i.showFreebieTierProductPrices,currencySymbol:i.styles.general.currencySymbol,primaryColor:i.styles.general.primaryColor}),e.createElement(Pm,{bundleType:i.bundleType,hideAddToBundle:i.hideAddToBundle,themeColor:i.themeColor,cornerRadius:i.cornerRadius,primaryTextColorCta:i.primaryTextColorCta,disabled:se,onClick:Y,label:i.styles?.byob?.addToBundleCTAText??"Add to bundle"}))),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-divider yt-${i?.bundleType}-modal-desktop-divider`,style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},e.createElement("span",null)),e.createElement("span",{className:`yt-${i?.bundleType}-modal-desktop-description yt-${i?.bundleType}-modal-desktop-description yt-description-content`,style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:Do(Q)}})))))),de=e.createElement(hm,{className:`yt-${i?.bundleType}-modal-mobile-overlay yt-${i?.bundleType}-modal-mobile-overlay`,onClick:()=>c(void 0)},e.createElement(bm,{className:`yt-${i?.bundleType}-modal-mobile-content yt-${i?.bundleType}-modal-mobile-content`,style:{padding:"0px",position:"relative"},$isSmallScreen:T,ref:l,onClick:e=>e.stopPropagation()},e.createElement(wm,{ref:l,className:`yt-${i?.bundleType}-modal-mobile-container yt-${i?.bundleType}-modal-mobile-container yt-variant-selection-modal`},e.createElement("button",{className:`yt-${i?.bundleType}-modal-mobile-close-btn yt-${i?.bundleType}-modal-mobile-close-btn`,style:{position:"fixed",top:"20px",right:"20px",zIndex:9999999999,backgroundColor:"#FFFFFF",padding:"4px",borderRadius:"50%",border:"1px solid lightgray",display:"flex",justifyContent:"center",alignItems:"center"},onClick:()=>{c(void 0)}},e.createElement(yt,{className:`yt-${i?.bundleType}-modal-mobile-close-icon yt-${i?.bundleType}-modal-mobile-close-icon`,style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile yt-${i?.bundleType}-modal-mobile yt-variant-selection-modal small-screen`,style:{padding:"0px"}},e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-image-section yt-${i?.bundleType}-modal-mobile-image-section image-section`},e.createElement(Bm,{product:s,bundleType:i.bundleType,images:Z,mobileScrollRef:$,desktopThumbsRef:A,selectedVariantImage:M,currentImageIndex:E,setCurrentImageIndex:X,themeColor:i.themeColor,isMobile:!0})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-details-section yt-${i?.bundleType}-modal-mobile-details-section details-section`,style:{padding:"0 30px",margin:"15px 0",paddingBottom:R?`${R+20}px`:"120px"}},e.createElement("h2",{className:`yt-${i?.bundleType}-modal-mobile-title yt-${i?.bundleType}-modal-mobile-title`,style:{margin:"0px",...y?_m:{}}},g,y&&e.createElement("span",{className:`yt-${i?.bundleType}-modal-variant-badge`,style:Lm},y)),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(zm,{product:s,rating:i.rating,reviewRatingType:p,className:`yt-${i?.bundleType}-modal-mobile-rating yt-${i?.bundleType}-modal-mobile-rating`})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-divider yt-${i?.bundleType}-modal-mobile-divider`,style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},e.createElement("span",null)),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-description yt-${i?.bundleType}-modal-mobile-description yt-description-content`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:Do(Q)}})))),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-bottom-bar yt-${i?.bundleType}-modal-mobile-bottom-bar`,ref:B,style:{position:"fixed",bottom:"0px",left:"0px",right:"0px",padding:"12px 15px",borderTop:"1px solid lightgray",boxShadow:"0px -4px 5px rgba(0, 0, 0, 0.1)",backgroundColor:"#fff",display:"flex",flexDirection:"column",gap:"2px",zIndex:9999999999}},"customOptions"===f?e.createElement(Am,{product:s,selectedVariants:H,getOptionValues:ee,getSelectedOption:re,getOptionType:J,isOptionValueAvailable:oe,onOptionChange:te,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants,isMobile:!0}):e.createElement($m,{product:s,selectedVariant:b,onVariantChange:K,getMaxAvailableQty:x,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants,className:`yt-${i?.bundleType}-modal-desktop-variant-selector yt-${i?.bundleType}-modal-desktop-variant-selector`}),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-price-atc-wrapper yt-${i?.bundleType}-modal-mobile-price-atc-wrapper`,style:{display:"flex",justifyContent:i.hideAddToBundle?"flex-start":"center",alignItems:"center",width:"100%"}},e.createElement(Dm,{bundleType:i.bundleType,selectedVariant:b,discountedPrice:v,compareAtDisplayPrice:C,isFreebieTier:i.isFreebieTier,showFreebieTierProductPrices:i.showFreebieTierProductPrices,currencySymbol:i.styles.general.currencySymbol,primaryColor:i.styles.general.primaryColor,isMobile:!0}),e.createElement(Pm,{bundleType:i.bundleType,hideAddToBundle:i.hideAddToBundle,themeColor:i.themeColor,cornerRadius:i.cornerRadius,primaryTextColorCta:i.primaryTextColorCta,disabled:se,onClick:Y,label:i.styles?.byob?.addToBundleCTAText??"Add to bundle",isMobile:!0})))));return V.createPortal(T?de:ce,document.body)}),Om=({coverImageUrl:t,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],i=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map(({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const s=t||n||"",c=i(s,800)||s,d=[];if(n&&n!==t){const t=l(n);t&&d.push(e.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:t}))}if(t){const n=l(t);n&&(d.length>0?d.push(e.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):d.push(e.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const t=l(n);t&&d.push(e.createElement("source",{key:"mobile",srcSet:t}))}return e.createElement("div",{style:{width:"100%",display:"block"}},e.createElement("picture",{style:{display:"block",width:"100%"}},d,e.createElement("img",{src:c,alt:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},Mm=({title:t,isOpen:n,onToggle:r,children:o})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:r,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(tt,{className:"yt-byob-icon-minus",size:20}):e.createElement(Xe,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},o)),Vm=({availableFilters:n,appliedFilters:r,toggleFilter:o,clearAllFilters:a,applyPriceFilter:i,priceMin:l,setPriceMin:s,priceMax:c,setPriceMax:d,maxPossiblePrice:p,styles:m,availableProductCount:u,products:g,unavailableProductCount:f,storeCurrencyCode:y,showActions:x=!0,openSections:h,toggleSection:b})=>{const[w,v]=t(null),C=Yf(m?.general?.currencySymbol)??y??"USD";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(Mm,{key:t.id,title:t.label,isOpen:!!h[t.id],onToggle:()=>b(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const a=r[t.id]?.includes(n.id)||!1;return"filter.v.availability.1"===n.id?u??g.length:"filter.v.availability.0"===n.id||n.count,e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:a,onChange:()=>o(t.id,n.id),style:{width:"18px",height:"18px",accentColor:m?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,c.toLocaleString()),e.createElement("div",{className:"yt-byob-price-slider-container",style:{position:"relative",width:"100%",height:"4px",background:"#e5e7eb",borderRadius:"4px",marginBottom:"10px"}},e.createElement("div",{className:"yt-byob-price-slider-track",style:{position:"absolute",height:"100%",background:"#333",borderRadius:"4px",left:l/p*100+"%",right:100-c/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>v("min"),onTouchStart:()=>v("min"),onChange:e=>{const t=Math.min(Number(e.target.value),c-10);s(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===w?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:c,onMouseDown:()=>v("max"),onTouchStart:()=>v("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);d(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===w?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),x&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:a,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:i,style:{flex:1,padding:"8px",background:m?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Wm=t=>{const{showFiltersDrawer:n,handleClose:r,isAnimating:o,isMobile:a}=t;return n?W(e.createElement("div",{className:"yt-byob-filter-drawer-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",justifyContent:"flex-end",opacity:o?1:0,transition:"opacity 300ms ease-in-out"},onClick:r},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:a?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:o?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Vm,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),r()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},jm=t=>{const{showFiltersDrawer:n}=t;return n&&0!==t?.availableFilters?.length?e.createElement("div",{className:"yt-byob-filters-sidebar",style:{width:"280px",minWidth:"280px",padding:"0",height:"auto",maxHeight:"calc(100vh - 40px)",position:"sticky",top:"20px",display:"flex",flexDirection:"column",borderRight:"1px solid #eee",marginRight:"20px"}},e.createElement(Vm,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Hm=({enableSortAndFilter:r,isMobile:o,setSearchTerm:a,searchTerm:i,styles:l,setSortBy:s,appliedFilters:c,setAppliedFilters:d,availableFilters:p=[],products:m,availableProductCount:u,unavailableProductCount:g,maxPossiblePrice:f,storeCurrencyCode:y,sharedFiltersState:x,openSections:h,toggleSection:w,sortBy:v})=>{const[C,E]=t(!1),[k,T]=t(i),{showFilters:S,setShowFilters:N,priceMax:I,setPriceMax:F,priceMin:z,setPriceMin:B}=x,[$,A]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",P=!o&&"sidebar"===D,_="none"===D;n(()=>{c["filter.v.price"]||(F(f),B(0))},[f,c]);n(()=>{const e=setTimeout(()=>{a(k)},300);return()=>clearTimeout(e)},[k,a]),n(()=>(S&&!P?(document.body.style.overflow="hidden",A(!0)):(document.body.style.overflow="",A(!1)),()=>{document.body.style.overflow=""}),[S,P]);const L=Object.entries(c).reduce((e,[t,n])=>"filter.v.price"===t?z>0||I<f?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:o?"column":"row",justifyContent:"space-between",alignItems:o?"flex-end":"center",marginBottom:"20px",width:"100%",gap:o?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:r?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},r&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:o?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},o&&!C?e.createElement(Ke,{className:"yt-byob-search-icon-trigger",fontSize:"20px",color:"#555",style:{cursor:"pointer"},onClick:()=>E(!0)}):e.createElement(e.Fragment,null,e.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:o?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Ke,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),o&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>N(!S),style:{display:_?"none":"flex",alignItems:"center",gap:o?"0px":"6px",background:S&&P?"#f3f4f6":"white",cursor:"pointer",fontSize:"14px",color:"#333",whiteSpace:"nowrap",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)"}},e.createElement(Je,{className:"yt-byob-filter-toggle-icon",size:18}),!o&&"Filters",L>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},L)),r&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!o&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),o&&e.createElement(et,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:v,onChange:e=>s(e.target.value)},e.createElement("option",{className:"yt-byob-sort-option",value:""},"Featured"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-low-to-high"},"Price: Low to High"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-high-to-low"},"Price: High to Low"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-asc"},"Alphabetical: A-Z"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-desc"},"Alphabetical: Z-A")),e.createElement(b,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!P&&!_&&e.createElement(Wm,{showFiltersDrawer:S,handleClose:()=>{P?N(!1):(document.body.style.overflow="",A(!1),setTimeout(()=>{N(!1)},300))},isAnimating:$,isMobile:o,availableFilters:p,appliedFilters:c,toggleFilter:(e,t)=>{d(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{F(f),B(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${I}`],t})},priceMin:z,setPriceMin:B,priceMax:I,setPriceMax:F,maxPossiblePrice:f,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:y,openSections:h,toggleSection:w}))},qm=()=>e.createElement(e.Fragment,null,e.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),e.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Um=({title:t,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="string"==typeof n?{url:n,name:"Attachment"}:n,l=i?.loading,s=i?.error,c=i?.url;return e.createElement("div",{className:"yt-personalization-upload-field",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",border:"1px dashed #ccc",borderRadius:"10px",background:"#fff",gap:"12px"}},e.createElement("div",{className:"yt-personalized-form-field-content",style:{flex:1,minWidth:0}},e.createElement("div",{className:"yt-personalized-form-field-title",style:{fontWeight:600,fontSize:"14px",color:"#1a1a1a"}},t),!i&&!l&&!s&&e.createElement("div",{className:"yt-personalized-form-field-hint",style:{fontSize:"12px",color:"#888",marginTop:"2px"}},"jpeg/png/img (max size: 5MB)"),l&&e.createElement("div",{className:"yt-personalized-form-field-loading",style:{display:"flex",alignItems:"center",gap:"6px",color:"#007bff",fontSize:"12px",marginTop:"4px"}},e.createElement(qm,null)," Uploading ",i?.name||"image","..."),s&&e.createElement("div",{className:"yt-personalized-form-field-error",style:{fontSize:"12px",color:"#dc3545",marginTop:"2px"}},"Upload failed."),c&&!l&&!s&&e.createElement("div",{className:"yt-personalized-form-field-preview",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},e.createElement("img",{className:"yt-personalized-form-field-preview-image",src:i.url,alt:"Uploaded",style:{width:"36px",height:"36px",objectFit:"cover",borderRadius:"4px",border:"1px solid #eee"}}),e.createElement("span",{className:"yt-personalized-form-field-preview-name",style:{fontSize:"12px",color:"#28a745",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},i.name))),e.createElement("div",{className:"yt-personalized-form-field-actions",style:{flexShrink:0}},s&&e.createElement("button",{type:"button",className:"yt-personalized-form-retry-button",onClick:a,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Retry"),c&&!l&&!s&&e.createElement("button",{type:"button",className:"yt-personalized-form-remove-button",onClick:o,style:{fontSize:"13px",fontWeight:600,color:"#fff",background:"#dc3545",border:"none",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Remove"),!i&&!l&&e.createElement("button",{type:"button",className:"yt-personalized-form-upload-button",onClick:r,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Upload Image")))},Ym=({form:r,formData:a,setFormData:i,barHeight:l=0,isUploading:s,setIsUploading:c})=>{const d=o(new Map),[p,m]=t(!1),u=c??m;n(()=>()=>{d.current.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),d.current.clear()},[]);const g=e=>{if(!d.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.multiple=!1,t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");i(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),u(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw alert("Upload failed. Try again."),e}finally{u(!1)}})(n);i(r=>({...r,[e]:{url:t,name:n.name}}))}catch{i(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),d.current.set(e,t)}return d.current.get(e)};return e.createElement("div",{className:"yt-personalized-form",style:{width:"100%",padding:"8px 0",marginBottom:`${l}px`,boxSizing:"border-box"}},r.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-personalized-form-section",style:{marginBottom:"28px"}},e.createElement("label",{className:"yt-personalized-form-section-title",style:{display:"block",fontWeight:700,marginBottom:"10px",color:"#1a1a1a",fontSize:"15px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-personalized-form-text-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement("textarea",{key:r,className:"yt-personalized-form-textarea",placeholder:t?.title,rows:3,maxLength:500,value:a[r]||"",onChange:e=>i(t=>({...t,[r]:e.target.value})),style:{width:"100%",padding:"8px 0",border:"none",borderBottom:"1.5px solid #ddd",borderRadius:0,fontSize:"14px",color:"#1a1a1a",background:"transparent",resize:"none",outline:"none",lineHeight:"1.5",boxSizing:"border-box"}})})),"image"===t.type&&e.createElement("div",{className:"yt-personalized-form-image-section"},e.createElement("div",{className:"yt-personalized-form-image-hint",style:{fontSize:"12px",color:"#888",marginBottom:"10px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),e.createElement("div",{className:"yt-personalized-form-image-fields",style:{display:"flex",flexDirection:"column",gap:"10px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement(Um,{key:r,title:t?.title,uploadState:a[r],onUpload:()=>g(r).click(),onRemove:()=>i(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>g(r).click()})}))))))},Qm={position:"absolute",width:72,height:72,border:"4px solid #333366",background:"#fff",boxSizing:"border-box"},Gm={...Qm},Zm="6s",Xm=({isOpen:t,message:n="Preparing Bundle..."})=>{if(!t)return null;const r=e.createElement(e.Fragment,null,e.createElement("style",null,"\n@keyframes ytBundleLoaderFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes ytBundleLoaderFloat {\n 0%, 100% { transform: translateY(0); }\n 50% { transform: translateY(-10px); }\n}\n\n/*\n * Flaps start OPEN, stay open while items fall, then close, pause, reopen.\n * 0-60%: open (180deg) — items fall in\n * 60-78%: closing\n * 78-88%: closed pause\n * 88-100%: reopening\n */\n@keyframes ytBundleLoaderOpenNorth {\n 0% { transform: rotateX(180deg); }\n 60% { transform: rotateX(180deg); }\n 78% { transform: rotateX(0deg); }\n 88% { transform: rotateX(0deg); }\n 100% { transform: rotateX(180deg); }\n}\n@keyframes ytBundleLoaderOpenSouth {\n 0% { transform: rotateX(-180deg); }\n 60% { transform: rotateX(-180deg); }\n 78% { transform: rotateX(0deg); }\n 88% { transform: rotateX(0deg); }\n 100% { transform: rotateX(-180deg); }\n}\n@keyframes ytBundleLoaderOpenEast {\n 0% { transform: rotateY(180deg); }\n 60% { transform: rotateY(180deg); }\n 78% { transform: rotateY(0deg); }\n 88% { transform: rotateY(0deg); }\n 100% { transform: rotateY(180deg); }\n}\n@keyframes ytBundleLoaderOpenWest {\n 0% { transform: rotateY(-180deg); }\n 60% { transform: rotateY(-180deg); }\n 78% { transform: rotateY(0deg); }\n 88% { transform: rotateY(0deg); }\n 100% { transform: rotateY(-180deg); }\n}\n\n/* Item 1: falls into top box opening and disappears behind front wall */\n@keyframes ytBundleLoaderItemFall1 {\n 0%, 5% {\n transform: translate3d(-50%, -90px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.5);\n opacity: 0;\n }\n 10% {\n transform: translate3d(-50%, -65px, 0px) rotateY(-50deg) rotateX(45deg) scale(1);\n opacity: 1;\n }\n 22% {\n transform: translate3d(-50%, -5px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.85);\n opacity: 1;\n }\n 27% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n}\n\n/* Item 2: falls 20-41% */\n@keyframes ytBundleLoaderItemFall2 {\n 0%, 19% {\n transform: translate3d(-50%, -90px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.5);\n opacity: 0;\n }\n 24% {\n transform: translate3d(-50%, -65px, 0px) rotateY(-50deg) rotateX(45deg) scale(1);\n opacity: 1;\n }\n 36% {\n transform: translate3d(-50%, -5px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.85);\n opacity: 1;\n }\n 41% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n}\n\n/* Item 3: falls 34-55% */\n@keyframes ytBundleLoaderItemFall3 {\n 0%, 33% {\n transform: translate3d(-50%, -90px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.5);\n opacity: 0;\n }\n 38% {\n transform: translate3d(-50%, -65px, 0px) rotateY(-50deg) rotateX(45deg) scale(1);\n opacity: 1;\n }\n 50% {\n transform: translate3d(-50%, -5px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.85);\n opacity: 1;\n }\n 55% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n}\n"),e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",backgroundColor:"rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",zIndex:2147483644,animation:"ytBundleLoaderFadeIn 0.4s ease-out"}},e.createElement("p",{style:{fontFamily:"inherit",fontSize:15,fontWeight:600,color:"#fff",margin:"0 0 48px",letterSpacing:"0.04em",textShadow:"0 1px 8px rgba(0,0,0,0.3)",lineHeight:"normal"}},n),e.createElement("div",{style:{position:"relative",width:140,height:140,display:"flex",justifyContent:"center",alignItems:"center",perspective:600}},e.createElement("div",{style:{animation:`ytBundleLoaderFloat ${Zm} ease-in-out infinite`,transformStyle:"preserve-3d"}},e.createElement("div",{style:{position:"relative",width:72,height:72,transformStyle:"preserve-3d",transform:"rotateX(-45deg) rotateY(50deg) rotateZ(0deg)"}},e.createElement("div",{style:{...Gm,transform:"rotateY(180deg) translateZ(36px)",background:"#f1f5f9"}}),e.createElement("div",{style:{...Gm,transform:"rotateY(-90deg) translateZ(36px)",background:"#f8fafc"}}),e.createElement("div",{style:{...Gm,transform:"rotateY(90deg) translateZ(36px)",background:"#f8fafc"}}),e.createElement("div",{style:{...Gm,transform:"rotateX(-90deg) translateZ(36px)",background:"#e2e8f0"}}),e.createElement("div",{style:{position:"absolute",top:0,left:"50%",width:24,height:24,animation:`ytBundleLoaderItemFall1 ${Zm} cubic-bezier(0.25, 1, 0.5, 1) infinite`,pointerEvents:"none"}},e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e.createElement("path",{d:"M6 2L3 6v14a2 2 0 002 2h14a2 2 0 002-2V6l-3-4H6z",stroke:"#f5a623",strokeWidth:"2",fill:"#fef3c7"}),e.createElement("path",{d:"M3 6h18",stroke:"#f5a623",strokeWidth:"2"}),e.createElement("path",{d:"M16 10a4 4 0 01-8 0",stroke:"#f5a623",strokeWidth:"2",fill:"none"}))),e.createElement("div",{style:{position:"absolute",top:0,left:"50%",width:22,height:22,animation:`ytBundleLoaderItemFall2 ${Zm} cubic-bezier(0.25, 1, 0.5, 1) infinite`,pointerEvents:"none"}},e.createElement("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none"},e.createElement("path",{d:"M16 3h4l2 4-4 2v13H6V9L2 7l2-4h4",stroke:"#4a90d9",strokeWidth:"2",fill:"#dbeafe"}),e.createElement("path",{d:"M8 3a4 4 0 008 0",stroke:"#4a90d9",strokeWidth:"2",fill:"none"}))),e.createElement("div",{style:{position:"absolute",top:0,left:"50%",width:22,height:22,animation:`ytBundleLoaderItemFall3 ${Zm} cubic-bezier(0.25, 1, 0.5, 1) infinite`,pointerEvents:"none"}},e.createElement("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none"},e.createElement("rect",{x:"3",y:"8",width:"18",height:"14",rx:"1",stroke:"#7ed321",strokeWidth:"2",fill:"#dcfce7"}),e.createElement("rect",{x:"1",y:"8",width:"22",height:"5",rx:"1",stroke:"#7ed321",strokeWidth:"2",fill:"#bbf7d0"}),e.createElement("path",{d:"M12 8V22",stroke:"#7ed321",strokeWidth:"2"}),e.createElement("path",{d:"M12 8c-2-4-6-4-6-1s4 1 6 1",stroke:"#7ed321",strokeWidth:"2",fill:"none"}),e.createElement("path",{d:"M12 8c2-4 6-4 6-1s-4 1-6 1",stroke:"#7ed321",strokeWidth:"2",fill:"none"}))),e.createElement("div",{style:{...Gm,transform:"translateZ(36px)"}}),e.createElement("div",{style:{position:"absolute",top:0,left:0,width:72,height:72,transform:"rotateX(90deg) translateZ(36px)",transformStyle:"preserve-3d"}},e.createElement("div",{style:{...Qm,top:0,left:0,width:"100%",height:"50%",transformOrigin:"top center",animation:`ytBundleLoaderOpenNorth ${Zm} ease-in-out infinite`}}),e.createElement("div",{style:{...Qm,bottom:0,left:0,width:"100%",height:"50%",transformOrigin:"bottom center",animation:`ytBundleLoaderOpenSouth ${Zm} ease-in-out infinite`}}),e.createElement("div",{style:{...Qm,top:0,right:0,width:"50%",height:"100%",transformOrigin:"right center",animation:`ytBundleLoaderOpenEast ${Zm} ease-in-out infinite`}}),e.createElement("div",{style:{...Qm,top:0,left:0,width:"50%",height:"100%",transformOrigin:"left center",animation:`ytBundleLoaderOpenWest ${Zm} ease-in-out infinite`}})))))));return V.createPortal(r,document.body)};function Km({quantity:t,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:s,selectedVariantInventoryQty:c}){const d={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=t<c;return e.createElement(Cp,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const r=Math.max(0,t-1);n?.(r),l&&a&&l(a,1)},style:d,"data-gokwik-processed":"true"},"-"),e.createElement(Ep,{className:"yt-byob-quantity-display","data-gokwik-processed":"true"},t," ",e.createElement("span",{className:"yt-byob-quantity-added-text",style:{paddingLeft:"4px"}}," ","added")),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(r,t+1,c);n?.(l),o&&a&&i&&o(a,i,1)},disabled:!p||s,style:{...d,cursor:!p||s?"not-allowed":"pointer",opacity:!p||s?.6:1},"data-gokwik-processed":"true"},"+"))}!function(){if("undefined"==typeof window||window.__yt_dom_safeguarded)return;window.__yt_dom_safeguarded=!0;const e=Node.prototype,t=e.insertBefore;e.insertBefore=function(e,n){return n&&n.parentNode!==this?n.parentNode?n.parentNode.insertBefore(e,n):this.appendChild(e):t.call(this,e,n)};const n=e.removeChild;e.removeChild=function(e){return e&&e.parentNode!==this?e.parentNode?e.parentNode.removeChild(e):e:n.call(this,e)}}();const Jm=({product:o,styles:a,selectedVariant:i})=>{const[l,s]=t(!1),c=r(()=>Qf(i?.image?.url||o?.featuredMedia?.preview?.image?.url||o?.media?.edges?.[0]?.node?.image?.url)||"",[i?.image?.url,o?.featuredMedia?.preview?.image?.url,o?.media?.edges]),d=r(()=>o?.media?.edges?.map(e=>Qf(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[o?.media?.edges]),p=r(()=>d?.[1]??c??"",[d,c]);n(()=>{if(c){(new Image).src=c}},[c]);const m=r(()=>c||d?.[0],[c,d]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:a.general.imageAspectRatio||"1/1"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1)},e.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},e.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:l&&m!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:m,alt:o.title}),m!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:o.title})))},eu=e=>{const t=e?.productDetails;if(!t)return!1;if("undefined"!=typeof window&&"clayco-com.myshopify.com"===window?.Shopify?.shop&&""===t.onlineStoreUrl)return!1;const n=t.status?.toLowerCase(),r="active"===n||"unlisted"===n||void 0===t.status||""===t.status,o="estailofashion.myshopify.com"!==window?.Shopify?.shop||null!==t.publishedAt;return r&&o},tu=({product:r,bundle:o,handleAddToBundle:i,hideAddToBundle:l,remainingQuantity:s,themeColor:c,handleRemoveItem:d,transitionActive:p,idx:m,selecteditems:u,customVariantsQuantity:g,currentProductTier:f,showFreebieTierProductPrices:y,tierIndex:x})=>{const h=ve(ym),b=o.customizations,w=b?.byob?.variantSelectorType,[v,C]=t(!1),E=b.general?.variantTitleSuffix?r?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const r=t[e];let o=0;for(;o<n.length&&o<r.length&&n[n.length-1-o]===r[r.length-1-o];)o++;n=n.slice(n.length-o)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),r=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:r,commonSuffix:n.join(" ")}}})})(r?.variants?.edges);if(!E||!E.length)return e.createElement(e.Fragment,null);const k=a(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;const n=E?.find(t=>t.node.id===e),a=n?.node;return a?r.tracksInventory&&a.inventoryItem?.tracked?a.inventoryQuantity>0?o?.customProductsQuantity??a.inventoryQuantity:a.inventoryQuantity<=0&&"continue"===a.inventoryPolicy?.toLowerCase()?o?.customProductsQuantity??1/0:0:o?.customProductsQuantity??1/0:0},[E,g,r.tracksInventory]),T=E?.filter(e=>!1!==b.general.showOutOfStockVariants||k(e.node.id)>0);if(!T||!T.length)return e.createElement(e.Fragment,null);const S=T?.find(e=>k(e.node.id)>0)?.node?.id;if(!S&&!b.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[N,I]=t(T?.find(e=>k(e.node.id)>0)?.node?.id||T[0]?.node?.id),[F,z]=t(window.innerWidth<450),[B,$]=t("normal"),A=T?.find(e=>e?.node?.id===N)?.node,D=k(N||""),P=u?.find(e=>e.variantId===N&&(void 0===x||e.tierIndex===x)),_=P?P.quantity:0;n(()=>{const e=()=>{z(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?$("500"):CSS.supports("font-weight","400")?$("400"):CSS.supports("font-weight","600")&&$("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",B)},[B]),n(()=>{if(N&&!T?.some(e=>e.node.id===N)){const e=T.find(e=>k(e.node.id)>0)?.node.id||T[0]?.node?.id;e&&I(e)}},[N,T,k]);const L=b?.byob?.productClickAction??(b?.general?.redirectToPDP?"redirect-pdp":"details-modal"),R=T.length>1,O=R&&"customOptions"!==w,M="75851235630"===("undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0),V=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(r),W=V.length>0;return e.createElement(e.Fragment,null,e.createElement(Sp,{borderRadius:b?.byob.borderRadius,borderColor:b?.byob.borderColor,shadowType:b?.byob.shadowType,backgroundColor:b?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":m%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if("details-modal"!==L)return;if(D<=0)return;const e={...r,variants:{...r.variants,edges:T},selectedVariant:A};h(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:b?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Np,{className:"yt-byob-image-wrapper",onClick:e=>{if("redirect-pdp"===L&&r?.handle){e.stopPropagation();const t=window?.Shopify?.routes?.root||"/";window.location.href=`${t}products/${r.handle}`}},style:{cursor:"none"===L?"default":"pointer"}},e.createElement(Jm,{product:r,styles:b,selectedVariant:A}),o?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:b?.general.primaryColor||"#111",color:b?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:b.byob.borderRadius}},o.productCardBadgeText),O&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Im,{className:"yt-byob-variant-selector",ariaLabel:"Select variant",value:N||"",onChange:I,options:T.map(e=>({value:e.node.id,label:e.node.title,className:0===k(e.node.id)?"variant-out-of-stock":void 0})),style:{position:"absolute",width:"98%",height:"38px",bottom:"4px",right:"3px",border:"1px solid #c7c7c7",padding:"8px 10px",backgroundColor:"#f5f5f5",fontSize:"14px",opacity:.8,boxSizing:"border-box",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"normal"},menuStyle:{fontSize:"14px"}},T.find(e=>e.node.id===N)?.node?.title??""))),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start"},className:"yt-byob-product-details-wrapper"},e.createElement("div",{className:"yt-byob-product-content"},"enabled"===o?.customizations?.byob?.productCardCategoryVisibility&&W&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px",justifyContent:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start"}},V.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:F?"10px":"14px",color:"#666",fontWeight:"500",paddingBottom:"4px"}},t.charAt(0).toUpperCase()+t.slice(1))),V.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",V.length-2," more"))),e.createElement(Ip,{isMobile:F,showBorder:o?.showBorder??!0,style:{...!b?.byob.productsPriceVisibility&&{padding:"8px"},...b?.byob.productTitleFontSize&&{fontSize:b?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:b?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(A?.displayName).replace("- Default Title",""):r.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&(b?.byob?.showVariantTitleInCard||!R)&&e.createElement("p",{style:{padding:o?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},A?.title),"ratingOnly"===(b?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===(b?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14})," ",r?.rating?.averageRating,e.createElement(Le,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),b?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:o?.showBorder?"0px 10px":"0 4px"}},f?.isFreebieTier&&!y?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Yf(b.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",Uf(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:b.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},Yf(b.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",Uf(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!f?.isFreebieTier||y)&&A?.compareAtPrice&&b?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Yf(b.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",Uf(A.compareAtPrice)))),(D>0||D===1/0)&&e.createElement(Fp,{borderRadius:b?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===_||void 0===_)&&e.createElement(kp,{key:"add-to-bundle-btn",style:{...!l&&{backgroundColor:b?.general.primaryColor||"#111",color:b?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),(()=>{if(!N)return;"customOptions"===w&&T.length>1?C(!0):i(N,r,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button","data-gokwik-processed":"true"},b?.byob.addToBundleCTAText),!o?.disableQuantitySelector&&_>0&&N&&e.createElement(Tp,{key:"quantity-selector-container",className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Km,{remainingQuantity:s,quantity:_,handleAddToBundle:i,variantId:N,product:r,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:D})),o?.disableQuantitySelector&&_>0&&N&&e.createElement(kp,{key:"single-qty-added-btn",style:{backgroundColor:"#747474",color:b?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector","data-gokwik-processed":"true"},e.createElement(zp,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Bp,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation(),d&&N&&d(N,x)},"data-gokwik-processed":"true"},e.createElement(nt,{style:{color:"#fff",fontSize:"20px"}})))),D<=0&&D!==1/0&&e.createElement(kp,{style:{backgroundColor:b.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled","data-gokwik-processed":"true"},b?.general.outOfStockLabel||"Out of Stock")),"customOptions"===w&&v&&T.length>1&&e.createElement(Cm,{product:r,isOpen:v,onClose:()=>C(!1),variantOptions:o.variantOptions,cta:{textColor:b?.general?.ctaTextColor||"#fff",backgroundColor:b?.general?.ctaBackgroundColor||"#000"},onConfirm:e=>{I(e),i(e,r,1)},showOutOfStockVariants:!1!==b.general.showOutOfStockVariants}))},nu=({currentStep:t,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:s="#fff",tierNavigation:c})=>e.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},e.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:r}).map((s,d)=>{const p=d+1,m=!o[d].isFormStep&&o[d].minimumQuantity-(i[d]?.length??0)===0,u=d===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===c?()=>{}:n(p-1)},e.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),e.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?"white":m?`${l}50`:"white",border:`2px solid ${u?"#666666":m?l:"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:a?"16px 0px":"15px 0px",fontSize:a?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},o[t]?.title)),ru=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...r].map(r=>{const a=o===r;return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(t.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px",maxWidth:"100%"}},e.createElement("div",{className:"yt-byob-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...r].map(r=>e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:o===r?t?.general.primaryColor:"white",color:o===r?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{o!==r&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1)))))},ou=({bundle:i,selectedItems:l,setSelectedItems:s,handleAddToCart:c,bundleAddToCartLoading:d,renderingOnPage:p,selectedItemsQuantity:m,handleRemoveItem:u,bundleSubtotal:g,dispatchAnalyticsEvent:f,fetchStoreDetails:y,productsPagination:x,categoryFilters:h})=>{const[b,w]=t(void 0),[v,C]=t(window.innerWidth<450),[E,k]=t(0),[T,S]=t({}),N=!!i.personalizedForm?.title&&"productTier"===i.builderTiers?.type,[I,F]=t({}),[z,B]=t(!1),$=N&&E===(i.builderTiers?.productTier?.length||0),A=E===(i.builderTiers?.productTier?.length||0)-1,D=N&&A&&!$,[P,_]=t(i?.products),[L,R]=t(!1),[O,M]=t({}),[V,W]=t(20),j=o(null),[H,q]=t(i?.products),[U,Y]=t({}),[Q,G]=t(x?.cursorData),Z=i.builderTiers?.type,X=i.customizations,K=i.builderTiers?.productTier??[],J=i.builderTiers?.offerTier??[],[ee,te]=t("All"),ne=o(null),re=o(!0);n(()=>(re.current=!0,()=>{re.current=!1}),[]);const[oe,ae]=t({}),ie=o(void 0),le=o({appliedFilters:oe,currentProductTier:E,tierType:Z}),[se,ce]=t([]),[de,pe]=t(!1),[me,ue]=t(0),[ge,fe]=t(0),[ye,xe]=t({}),he=e=>{xe(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{se.length>0&&xe(e=>{const t={...e};return se.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[se]),n(()=>{!(Object.values(oe).length>0)&&x?.cursorData&&G(x.cursorData)},[oe,x?.cursorData]);const be=i.customStoreDetails?.fixedInventoryDetails;n(()=>{X?.byob?.productFiltersDisplay&&"none"!==X?.byob?.productFiltersDisplay&&(async()=>{const e=X?.byob?.productFiltersDisplay??"none";if("drawer"===e||"sidebar"===e)try{const e=await(y?.());e?.productFilters&&ce(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[X?.byob,y]);const we=r(()=>{if(!h)return;const e=K[E]?.tier,t="productTier"===Z?e:1,n="object"!=typeof h||Array.isArray(h)||h.id?h:h[t];if(!n)return;const r=Array.isArray(n)?n.find(e=>"filter.p.m.categories"===e.id||"categories"===e.label):n;return r&&r.values?{...r,values:[...r.values].sort((e,t)=>e.label.localeCompare(t.label,void 0,{sensitivity:"base",numeric:!0}))}:void 0},[h,E,K]),ve=r(()=>{const e=(we?.values?.map(e=>e.label)??[])?.filter(e=>"All"!==e),t=i?.selectedCategories??[];if(0===t.length)return e;const n=new Set(t.map(e=>e.trim()));return e.filter(e=>n.has(e.trim()))},[we,i?.selectedCategories]),Ee=ve.length>0;n(()=>{ae({})},[E,ee]);const ke=((e,t)=>"All"===t?e:e.filter(e=>{const n=e?.productDetails;if(n.metafield&&"yourtoken_bundles_app"===n.metafield.namespace&&"categories"===n.metafield.key){let e=[];if(n.metafield.jsonValue&&Array.isArray(n.metafield.jsonValue))e=n.metafield.jsonValue;else if(n.metafield.value)try{const t=JSON.parse(n.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}return e.includes(t)}return!1}))(P.filter(eu),ee),Te="productTier"===Z?K.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===Z?J.reduce((e,t)=>e+t.minimumQuantity,0):i.minimumQuantity,Se=a((e,t)=>{const n=be?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const r=(e.variants?.edges||[]).find(e=>e.node.id===t),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[be]),[Ne,Fe]=t(3e3);n(()=>{const e=se?.find(e=>"PRICE_RANGE"===e.type||"filter.v.price"===e.id);e&&e.values?.[0]?.input?.price?.max&&Fe(e.values[0].input.price.max)},[P,se]);const[ze,Be]=t(""),[$e,Ae]=t(""),De=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(ke,ze),Pe=((e,t)=>[...e].sort((e,n)=>{const r=e?.productDetails?.title?.toLowerCase(),o=n?.productDetails?.title?.toLowerCase(),a=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),i=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return r.localeCompare(o);case"title-desc":return o.localeCompare(r);case"price-low-to-high":return a-i;case"price-high-to-low":return i-a;default:return 0}}))(De,$e);n(()=>{(async e=>{if(!x)return;const{initialCursorData:t,cursorData:n,fetchFn:r,setCursorData:o}=x,a="productTier"===Z?K?.[E]?.tier:1;if(0===Object.values(e)?.length)return void("productTier"===Z?(M(e=>({...e,[E]:U?.[E]||[]})),o(Q||{...n})):(_(H),o(Q||{1:t?.[1]})));const i=await r(e,a,null);re.current&&i&&("productTier"===Z?(M(e=>({...e,[E]:i})),_(e=>{const t=new Set(e.map(e=>e.productId)),n=i.filter(e=>!t.has(e.productId));return[...e,...n]})):_(i))})(oe)},[oe]);const[_e,Le]=Ce(ym),[Re,Oe]=t(!1);n(()=>{f?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:i?._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder"}}),setTimeout(()=>{Oe(!0)},100)},[]);const Me=o(null);n(()=>{const e=()=>{C(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(i.coverImageUrl){const e=new Image;e.src=Qf(i.coverImageUrl)??"",e.onload=()=>{w(e.width/e.height)}}},[i.coverImageUrl]),n(()=>{Oe(!1),setTimeout(()=>Oe(!0),100)},[E]);const Ve=(e,t)=>{if("productTier"===Z){let n={...T},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=K.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}S(n);const o=K.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==o&&k(o)}u(e,t)},We=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if(i){if("productTier"!==i?.builderTiers?.type)return _(i?.products??[]),void q(i?.products??[]);if(i?.workWithoutPagination){if("productTier"===i?.builderTiers?.type){const e={};i.builderTiers.productTier?.forEach((t,n)=>{const r=t.products.map(e=>{const t=i?.products?.find(t=>t.productId===e.productId);return t?{...t,variantIds:e.variantIds?.length?e.variantIds:t.variantIds}:null}).filter(Boolean);e[n]=r}),M(e),Y(e)}}else"productTier"===i?.builderTiers?.type&&(M({0:i?.products}),Y({0:i?.products}))}},[i]),n(()=>{if("productTier"!==Z||!K[E])return;if(Te===m)return;const e=K.findIndex((e,t)=>{const n=T[t]||[];return t>=E&&n.length<e.minimumQuantity});if(-1!==e&&e!==E){k(e);const t=K[E];t?.products?.length>1&&We()}else if(-1===e&&N&&E<K.length){K.every((e,t)=>(T[t]?.length||0)>=e.minimumQuantity)&&k(K.length)}},[T,K,Z,N]),n(()=>{Be(""),te("All")},[E]),n(()=>{function e(e){if(!Me.current||!e.target)return;!Me.current.contains(e.target)&&Le(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const je=(e,t,n)=>{var r;"productTier"===Z&&(r=e,S(e=>{const t={...e},n=K.findIndex((e,n)=>{const r=t[n]||[];return n>=E&&r.length<e.minimumQuantity}),o=-1!==n?n:E;return-1!==n&&k(n),t[o]||(t[o]=[]),t[o].push(r),t}));const o=!0===K[E]?.isFreebieTier;f?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),Gf(e,t,n,l,s,o,E)},He=(()=>{if(!i?.builderTiers)return i.minimumQuantity;const{type:e,offerTier:t,productTier:n}=i.builderTiers,r="offerTier"===e?t:"productTier"===e?n:null;if(!r)return i.minimumQuantity;let o=0;return r.map(e=>{o+=e.minimumQuantity}),o})(),qe=v&&i.mobileCoverImageUrl?Qf(i.mobileCoverImageUrl):Qf(i.coverImageUrl??"")||null,Ue=a(e=>{if("undefined"!=typeof window&&"clayco-com.myshopify.com"===window?.Shopify?.shop&&""===e?.productDetails?.onlineStoreUrl)return!1;const t=X?.general?.showOutOfStockProducts;if(t)return!0;const n=e?.productDetails,r=n?.variants?.edges||[];if(be){if(r.some(e=>be.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return r.some(e=>Se(n,e.node.id)>0)},[X?.general?.showOutOfStockProducts,be,Se]),Ye=r(()=>{if("productTier"===Z&&K.length>0){const e=O?.[E]??[];return $e?Pe.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Ue(t)):e.map(e=>Pe.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Ue(e))}return Pe.filter(Ue)},[Z,K,O,E,Pe,Ue,$e]),Qe=Ye;n(()=>{if("productTier"!==Z)return;const e=K[E];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;if(1!==O?.[E]?.length)return;const t=e.products[0],n=P.find(e=>e.productId===t.productId),r=n?.productDetails;if(!r)return;if(!eu(n))return;if(!Ue(n))return;if(r.variants?.edges?.length>1)return;const o=r.variants?.edges?.find(e=>Se(r,e.node.id)>0)?.node;if(!o)return;const a=o.id,i=T[E]?.includes(a);if(!i&&(je(a,r,1),E<K.length-(N?0:1))){k(E+1);const e=K?.[E];e?.products?.length>1&&We()}},[Z,K,E,P,T,Se,Ue,je]);const Ge=r(()=>ke.filter(e=>{const t=e?.productDetails;return(t.variants?.edges||[]).some(e=>Se(t,e.node.id)>0)}).length,[ke,Se]),Ze=r(()=>ke.length-Ge,[ke,Ge]),Xe="bundles"==i.appName?i.pageHeader?.title:i?.title,Ke="bundles"==i.appName?i.pageHeader?.description:i?.subtitle,Je=Ee&&Boolean(X?.byob?.enableProductCategories),et=r(()=>{if(i?.workWithoutPagination)return!1;if(!Je)return!1;if(!x)return!1;const e="productTier"===Z?K[E]?.tier:1;if(void 0===e)return!1;const t=x.cursorData?.[e];return t?t.hasNext:L},[i?.workWithoutPagination,Je,x,Z,K,E,L]);n(()=>{if(i?.workWithoutPagination)return;if(Je)return;if(!x)return;const{cursorData:e,fetchFn:t}=x,n=K[E]?.tier,r="productTier"===Z?n:1;if(e?.[r]&&!e?.[r]?.hasNext||!t)return;const o=le.current;o.currentProductTier===E&&o.tierType===Z||(ie.current=void 0,le.current={...o,currentProductTier:E,tierType:Z});const a=new IntersectionObserver(async([n])=>{if(!n.isIntersecting)return;if(L)return;const o=e?.[r]?.cursor||null;if(ie.current!==o){ie.current=o,R(!0);try{const n=await t(oe,r,e?.[r]?.cursor);if(!re.current)return;if(n?.length>0){const e=Object.values(oe).length>0;"productTier"===Z?(M(e=>({...e,[E]:[...e[E]||[],...n]})),e||Y(e=>({...e,[E]:[...e[E]||[],...n]})),_(e=>[...e,...n])):(_(e=>[...e,...n]),e||q(e=>[...e,...n]))}}catch(e){console.error("Pagination fetch failed:",e),ie.current=void 0}finally{re.current&&R(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),l=ne.current;return l&&a.observe(l),()=>{l&&a.unobserve(l)}},[i?.workWithoutPagination,Je,x,L,Z,E,K,oe]),n(()=>{if(i?.workWithoutPagination)return;if(!Je)return;if(!x)return;const{cursorData:e,fetchFn:t}=x,n=K[E]?.tier,r="productTier"===Z?n:1;if(!t)return;const o=le.current;(o.currentProductTier!==E||o.tierType!==Z||JSON.stringify(o.appliedFilters)!==JSON.stringify(oe))&&(ie.current=void 0,le.current={appliedFilters:oe,currentProductTier:E,tierType:Z});if(!(!e?.[r]||e[r].hasNext))return void R(!1);if(L)return;(async()=>{const n=e?.[r]?.cursor||null;if(ie.current!==n){ie.current=n,R(!0);try{const e=await t(oe,r,n);if(!re.current)return;if(e?.length>0){const t=Object.values(oe).length>0;"productTier"===Z?(M(t=>({...t,[E]:[...t[E]||[],...e]})),t||Y(t=>({...t,[E]:[...t[E]||[],...e]})),_(t=>[...t,...e])):(_(t=>[...t,...e]),t||q(t=>[...t,...e]))}}catch(e){console.error("Fetch all products pagination error:",e),ie.current=void 0}finally{re.current&&R(!1)}}})()},[i?.workWithoutPagination,Je,x,E,oe,Z,L,K]),n(()=>{if(!Je&&!i?.workWithoutPagination)return;if(et)return;if(!j.current)return;const e=new IntersectionObserver(([e])=>{e.isIntersecting&&V<Ye.length&&W(e=>Math.min(e+20,Ye.length))},{rootMargin:"200px"});return e.observe(j.current),()=>e.disconnect()},[Je,et,V,Ye.length]),n(()=>{W(20)},[E,Ye.length,Je,i?.workWithoutPagination]);const tt=()=>{f?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-builder-section",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:"15px",marginBottom:"20px",backgroundColor:X.byob.sectionBackgroundColor,padding:"transparent"!==X.fixedBundle.sectionBackgroundColor?"20px":"4px"}},qe?e.createElement("div",{className:"yt-byob-cover-image-container",style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...i?.coverImageVerticalMargin&&{marginBottom:i?.coverImageVerticalMargin,marginTop:i?.coverImageVerticalMargin}}},qe&&e.createElement(Om,{coverImageUrl:qe,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{className:"yt-byob-cover-image-overlay",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:X?.byob?.titleFontSize??"3rem",fontWeight:"700",color:X?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:X?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},Xe),e.createElement("span",{style:{lineHeight:"normal",fontSize:X?.byob?.subtitleFontSize??"1.5rem",color:X?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Ke))):(Xe||Ke)&&e.createElement("div",{className:"yt-byob-header-content",style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},Xe&&e.createElement("span",{className:"bundle-builder-title",style:{lineHeight:"normal",fontSize:X?.byob?.titleFontSize??"3rem",fontWeight:"700",color:X?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:X?.byob?.titleBackgroundColor??"transparent"}},Xe),Ke&&e.createElement("span",{className:"bundle-builder-subtitle",style:{lineHeight:"normal",fontSize:X?.byob?.subtitleFontSize??"1.5rem",color:X?.byob?.titleTextColor??"#000"}},Ke)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===Z&&K.length>0&&X?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-stepper-wrapper"},e.createElement(nu,{currentStep:E,totalSteps:K.length+(N?1:0),tiers:N?[...K,{title:i.personalizedForm?.title||"Personalize",tier:K.length,minimumQuantity:0,products:[],isFormStep:!0}]:K,isMobile:v,primaryColor:X?.general?.primaryColor,primaryTextColorCta:X?.general?.primaryContrastColor,setCurrentProductTier:k,selectedProductsByTier:T,tierNavigation:X.byob.tierNavigation})))),e.createElement("div",{className:"yt-byob-layout-wrapper",style:{display:"flex",flexDirection:"row",width:v?"100%":"90%",marginInline:"auto"}},"sidebar"===X?.byob?.productFiltersDisplay&&!v&&!$&&e.createElement(jm,{showFiltersDrawer:de,handleClose:()=>pe(!1),isAnimating:!1,isMobile:!1,availableFilters:se,appliedFilters:oe,toggleFilter:(e,t)=>{ae(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{ae({}),fe(0),ue(Ne)},applyPriceFilter:()=>{ae(e=>{const t={...e};return t["filter.v.price"]=[`min:${ge}-max:${me}`],t})},priceMin:ge,setPriceMin:fe,priceMax:me,setPriceMax:ue,maxPossiblePrice:Ne,styles:X,products:P,unavailableProductCount:Ze,storeCurrencyCode:i?.storeCurrencyCode,openSections:ye,toggleSection:he}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!$&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Hm,{enableSortAndFilter:i?.enableSortAndFilter??!1,isMobile:v,searchTerm:ze,setSearchTerm:Be,setSortBy:Ae,styles:X,appliedFilters:oe,setAppliedFilters:ae,availableFilters:se,products:P,availableProductCount:Ge,unavailableProductCount:Ze,maxPossiblePrice:Ne,storeCurrencyCode:i?.storeCurrencyCode,sharedFiltersState:{showFilters:de,setShowFilters:pe,priceMax:me,setPriceMax:ue,priceMin:ge,setPriceMin:fe},openSections:ye,toggleSection:he}),i?.customizations?.byob?.enableProductCategories&&Ee&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(ru,{styles:X,isMobile:v,categories:ve,activeCategory:ee,onCategoryChange:e=>{te(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:X?.byob?.listingsGap||"12px",justifyContent:de&&"sidebar"===X?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},$&&i.personalizedForm?.title?e.createElement(Ym,{form:i.personalizedForm,formData:I,setFormData:F,isUploading:z,setIsUploading:B}):0!==Qe?.length||L||et?(Je?Ye.slice(0,V):Ye).map((t,n)=>{if("productTier"===Z){const r=(K[E]?.minimumQuantity??0)>(T[E]?.length??0),o=Pe.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return o?e.createElement(tu,{bundle:i,idx:n,key:`tier-${E}-${t?.variantIds?.[0]??t.productId}-${n}`,product:o?.productDetails,handleAddToBundle:je,hideAddToBundle:!r,remainingQuantity:He-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>Ve(e,E),selecteditems:l,transitionActive:Re,customVariantsQuantity:be,currentProductTier:K[E],showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:E}):null}return e.createElement(tu,{bundle:i,idx:n,key:`card-${t.productId}-${n}`,product:t?.productDetails,handleAddToBundle:je,hideAddToBundle:m>=He,remainingQuantity:He-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>u(e),selecteditems:l,transitionActive:Re,customVariantsQuantity:be,tierIndex:E})}):e.createElement("div",{className:"yt-byob-empty-state",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",padding:"40px 20px",gap:"16px"}},e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",margin:0}},Object.values(oe).length>0?"No products match your filters":"No products found"),Object.values(oe).length>0&&e.createElement("button",{onClick:()=>{ae({}),fe(0),ue(Ne)},style:{padding:"8px 16px",background:X?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:X?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px"}},"Clear All Filters")),!$&&(L||et)&&e.createElement("div",{className:"yt-byob-loading-wrapper",style:{width:"100%",display:"flex",justifyContent:"center",padding:"20px"}},e.createElement(Ie,{color:X?.general?.primaryColor||"#333",size:30})),!Je&&!i?.workWithoutPagination&&e.createElement("div",{ref:ne,className:"yt-byob-pagination-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null)),(Je||i?.workWithoutPagination)&&!et&&e.createElement("div",{ref:j,className:"yt-byob-virtualFetchAll-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null))),!p&&e.createElement(fm,{builderTiers:i?.builderTiers,showNextStep:D,handleAddToCart:async e=>{if(D)return k(E+1),void We();const t={};N&&Object.entries(I).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await c(e,t),tt()},minimumQuantity:Te,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:Ve,selectedItemsQuantity:m,percentageOff:i.percentageOff,loading:d,bundleSubtotal:g,amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:i?.dealTextColor??"#333",primaryTextColorCta:i?.primaryTextColorCta??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:T,renderingOnPage:p,isUploading:z}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(fm,{showNextStep:D,handleAddToCart:async e=>{if(D)return k(E+1),void We();const t={};N&&Object.entries(I).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await c(e,t),tt()},minimumQuantity:Te,builderTiers:i?.builderTiers,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,loading:d,handleRemoveItem:u,handleRemoveItemProductTier:Ve,percentageOff:i.percentageOff,selectedItemsQuantity:m??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:X?.general.primaryColor||"#000",primaryTextColorCta:X.general.primaryContrastColor??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:T,renderingOnPage:p,isUploading:z})))),_e&&void 0!==m&&(()=>{let t=m<i.minimumQuantity;return"productTier"==Z?t=(K[E]?.minimumQuantity??0)>(T[E]?.length??0):"offerTier"==Z&&(t=m<J.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(Rm,{bundleType:"byob",bundle:i,handleAddToBundle:je,ref:Me,remainingQuantity:i.minimumQuantity-m,hideAddToBundle:!t,disableQuantitySelector:i?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:T,themeColor:X?.general.primaryColor||"#000",primaryTextColorCta:i?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:X?.general.primaryColor||"#000",cornerRadius:i?.customizations.byob.borderRadius,styles:i.customizations,customVariantsQuantity:be,bundleProductsCustomQuantity:i?.customProductsQuantity,isFreebieTier:K?.[E]?.isFreebieTier,showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:i?.variantOptions})})(),e.createElement(Xm,{isOpen:Boolean(d)&&"animated"===i?.customizations?.general?.atcLoaderType})))},au="\n@keyframes cartATCFadeIn {\n 0% {\n opacity: 0;\n transform: scale(0.96);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes cartATCSlideIn {\n 0% {\n transform: translateX(-150%);\n opacity: 0;\n }\n 20% {\n opacity: 1;\n }\n 100% {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@keyframes cartATCSlideOut {\n 0% {\n transform: translateX(0);\n opacity: 1;\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: translateX(150%);\n opacity: 0;\n }\n}\n\n@keyframes cartATCBounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(1.5px);\n }\n}\n\n@keyframes cartATCItemDrop1 {\n 0%, 5% {\n transform: translate3d(-50%, -22px, 0) scale(0.4);\n opacity: 0;\n }\n 20% {\n transform: translate3d(-50%, -10px, 0) scale(0.95);\n opacity: 1;\n }\n 55% {\n transform: translate3d(-50%, 3px, 0) scale(0.7);\n opacity: 1;\n }\n 75%, 100% {\n transform: translate3d(-50%, 7px, 0) scale(0.3);\n opacity: 0;\n }\n}\n\n@keyframes cartATCItemDrop2 {\n 0%, 30% {\n transform: translate3d(-50%, -22px, 0) scale(0.4);\n opacity: 0;\n }\n 45% {\n transform: translate3d(-50%, -10px, 0) scale(0.95);\n opacity: 1;\n }\n 80% {\n transform: translate3d(-50%, 3px, 0) scale(0.7);\n opacity: 1;\n }\n 95%, 100% {\n transform: translate3d(-50%, 7px, 0) scale(0.3);\n opacity: 0;\n }\n}\n",iu=({loading:r,color:a="currentColor",size:i=24,children:l,className:s="",style:c,onComplete:d})=>{const[p,m]=t(r?"entering":"idle"),u=o(null),g=o(null);if(n(()=>(r?(g.current&&clearTimeout(g.current),m("entering"),u.current=setTimeout(()=>{m("filling")},400)):(u.current&&clearTimeout(u.current),m(e=>"filling"===e||"entering"===e?(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{m("idle"),d?.()},450),"exiting"):"idle")),()=>{u.current&&clearTimeout(u.current),g.current&&clearTimeout(g.current)}),[r,d]),"idle"===p)return l?e.createElement("span",{className:s,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"100%",animation:"cartATCFadeIn 0.3s ease-out forwards",...c}},e.createElement("style",null,au),l):null;const f="entering"===p,y="exiting"===p,x={display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",overflow:"hidden",height:i+6,paddingLeft:8,paddingRight:8,verticalAlign:"middle",width:"100%",...c},h={display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",animation:f?"cartATCSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards":y?"cartATCSlideOut 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards":"cartATCBounce 1.2s ease-in-out infinite"};return e.createElement("span",{className:`yt-cart-atc-loader ${s}`,style:x},e.createElement("style",null,au),e.createElement("div",{style:h},e.createElement("svg",{width:i,height:Math.round(24*i/28),viewBox:"0 0 28 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M1 2h4l2.6 13.2a2 2 0 002 1.6h12.8a2 2 0 002-1.6L26 6H6.6",stroke:a,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("circle",{cx:"10.5",cy:"20.5",r:"1.8",fill:a}),e.createElement("circle",{cx:"21.5",cy:"20.5",r:"1.8",fill:a})),("filling"===p||"entering"===p||"exiting"===p)&&e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"absolute",top:1,left:"56%",width:9,height:9,animation:"cartATCItemDrop1 1.4s ease-in-out infinite",pointerEvents:"none"}},e.createElement("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none"},e.createElement("rect",{x:"1",y:"2",width:"8",height:"7",rx:"1",fill:"#f5a623",stroke:a,strokeWidth:"1"}),e.createElement("path",{d:"M5 2v7",stroke:a,strokeWidth:"1"}))),e.createElement("div",{style:{position:"absolute",top:1,left:"56%",width:9,height:9,animation:"cartATCItemDrop2 1.4s ease-in-out infinite",pointerEvents:"none"}},e.createElement("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none"},e.createElement("rect",{x:"1",y:"2",width:"8",height:"7",rx:"1",fill:"#4a90d9",stroke:a,strokeWidth:"1"}),e.createElement("path",{d:"M1 5h8",stroke:a,strokeWidth:"1"}))))))},lu=({isOpen:r,onClose:o,formConfig:a,onCheckout:i,cta:l,isMobile:s})=>{const[c,d]=t({}),[p,m]=t(!1);n(()=>{r||d({})},[r]);const u=e=>{if(p)return;const t={};Object.entries(c).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),i(e?{}:t)};if(!r)return null;const g=e.createElement("div",{className:"yt-personalized-form-modal-overlay",onClick:o,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:s?"flex-end":"center",justifyContent:"center"}},e.createElement("style",null,"\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n @keyframes fadeIn {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n "),e.createElement("div",{className:"yt-personalized-form-modal",onClick:e=>e.stopPropagation(),style:{background:"white",width:s?"100vw":"500px",maxWidth:s?"100vw":"560px",height:s?"80vh":"auto",maxHeight:s?"80vh":"90vh",borderRadius:s?"20px 20px 0 0":"20px",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:999,animation:s?"slideUp 0.3s ease-out":"fadeIn 0.2s ease-out"}},e.createElement("div",{className:"yt-personalized-form-modal-header",style:{width:"100%",padding:s?"20px 20px 16px":"18px 20px",fontWeight:700,fontSize:s?"18px":"16px",textAlign:"center",position:"relative",borderBottom:"1px solid #eee",flexShrink:0,backgroundColor:"#ffffff",color:"#1a1a1a",boxSizing:"border-box",lineHeight:"1.4"}},a.title||"Personalization",!s&&e.createElement("button",{className:"yt-personalized-form-modal-close",onClick:o,style:{position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",fontSize:"24px",lineHeight:1,cursor:"pointer",color:"#666",padding:"4px"}},"×")),e.createElement("div",{className:"yt-personalized-form-modal-body",style:{flex:1,overflowY:"auto",padding:s?"20px 20px":"16px 20px"}},e.createElement(Ym,{form:a,formData:c,setFormData:d,isUploading:p,setIsUploading:m})),e.createElement("div",{className:"yt-personalized-form-modal-footer",style:{padding:s?"12px 16px":"12px 24px 16px",borderTop:"1px solid #eee",flexShrink:0,background:"white",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"}},e.createElement("button",{"data-gokwik-processed":"true",className:"yt-personalized-form-submit-button",onClick:()=>{u(),o()},disabled:p,style:{width:"100%",fontSize:"15px",fontWeight:700,textAlign:"center",padding:"15px 0",border:"none",borderRadius:"10px",cursor:p?"not-allowed":"pointer",opacity:p?.7:1,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:l.backgroundColor,color:l.textColor,letterSpacing:"0.01em"}},p?e.createElement(Ie,{color:l.textColor,size:15}):"Submit"),e.createElement("button",{"data-gokwik-processed":"true",className:"yt-personalized-form-skip-button",onClick:()=>{u(!0),o()},style:{background:"none",border:"none",fontSize:"14px",fontWeight:600,color:"#1a1a1a",cursor:"pointer",padding:"4px 8px",textAlign:"center"}},"Add without customization"))));return V.createPortal(g,document.body)},su=({product:t,selectedVariantId:n,onVariantChange:o,styles:a,originalPrice:i,dealPrice:l,totalPriceSum:s,isVertical:c=!1,variantOptions:d,storeCurrencyCode:p,reviewRatingType:m,productIndex:u,setActiveModalIndex:g})=>{const f=ve(ym),y=a?.comboBundle?.productClickAction??"details-modal",x=r(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),r=n?.node;return r?t?.productDetails.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t?.productDetails]),h=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;x(n);const b=r(()=>(t?.productDetails?.variants?.edges??[]).filter(e=>!1!==a?.general?.showOutOfStockVariants||x(e?.node?.id)>0).map(e=>({value:e?.node?.id,label:e?.node?.title,disabled:0===x(e?.node?.id)})),[t?.productDetails?.variants?.edges,a?.general?.showOutOfStockVariants,x]),w=r(()=>{if(h?.title&&t?.productDetails.options){const e=h.title.split(" / ");if(e.length===t?.productDetails.options.length)return e}return t?.productDetails.options?.map(e=>e.values[0])||[]},[h,t?.productDetails.options]),v=t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)??[],C=v.length>1,E=1===v.length?h?.title??v[0].node.title:"",k=e=>{o(e)};return c?e.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},e.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},a.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Qf(h?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,onClick:e=>{if("details-modal"===y&&t?.productDetails){e.stopPropagation(),void 0!==u&&g?.(u);const n={...t.productDetails,selectedVariant:h||t.productDetails.variants?.edges?.[0]?.node};f(n)}},style:{cursor:"details-modal"===y?"pointer":"default",objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:a.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},C&&e.createElement(e.Fragment,null,e.createElement(Im,{className:"yt-comboBundle-product-variant-select-vertical",options:b,value:n,onChange:k,style:{padding:"0 2px 0 6px",gap:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",minHeight:"30px",fontSize:"12px",fontWeight:600,boxSizing:"border-box",lineHeight:"normal"},chevronStyle:{alignSelf:"stretch",backgroundColor:"#F3F3F3",width:"15%",margin:"2px 0"},menuStyle:{fontSize:"12px",fontWeight:600}},h?.title??""))))),(a.comboBundle.subProductsProductTitleVisibility||a.comboBundle.subProductsProductPriceVisibility||m)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),E&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-vertical",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd",whiteSpace:"nowrap",marginBlock:"4px"}},E),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal"}},e.createElement(qe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal",fontWeight:"500"}},e.createElement(qe,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(Le,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf((Number(h?.price||0)/Number(s)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.compareAtPrice?h.compareAtPrice:h?.price)):Number(l)<Number(s)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.price)))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===a.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===a.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},a.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Qf(h?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,onClick:e=>{if("details-modal"===y&&t?.productDetails){e.stopPropagation();const n={...t.productDetails,selectedVariant:h||t.productDetails.variants?.edges?.[0]?.node};f(n)}},style:{cursor:"details-modal"===y?"pointer":"default",objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:a?.general?.imageAspectRatio||"1 / 1",height:"100px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===a.comboBundle?.infoAlignment?"flex-start":"right"===a.comboBundle?.infoAlignment?"flex-end":"center"===a.comboBundle?.infoAlignment?"flex-start":void 0}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),v.length>0&&(E||"dropdown"!==a.comboBundle.comboVariantTypeSelector&&d&&w)&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},E||(w.length>1?w.join(" / "):w))),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal"}},e.createElement(qe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal",fontWeight:"500"}},e.createElement(qe,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(Le,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf((Number(h?.price||0)/Number(s)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.compareAtPrice?h?.compareAtPrice:h?.price)):Number(l)<Number(s)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.price)))),C&&("dropdown"===a.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement(Im,{className:"yt-comboBundle-product-variant-select-horizontal",options:b,value:n,onChange:k,style:{display:"inline-flex",alignItems:"center",gap:"6px",maxWidth:"100%",padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px",lineHeight:"normal"},menuStyle:{fontSize:"12px",fontWeight:600}})):t?.productDetails.options.length>0?e.createElement(e.Fragment,null,t?.productDetails.options.map((n,r)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t?.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(o=>{const i=[...w];i[r]=o;const l=t?.productDetails.options.length>0?i.join(" / "):i[r],s=t?.productDetails.variants.edges.find(e=>e.node.title===l)?.node,c=0===(s?x(s.id):0);if(!1===a?.general?.showOutOfStockVariants&&c)return null;const p=w[r]===o,m=d&&d?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${c?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!c&&s&&k(s.id)},disabled:c,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:c?.5:1,cursor:c?"not-allowed":"pointer"}},m?.values.find(e=>e.name===o)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:p&&!c?"26px":"24px",height:p&&!c?"26px":"24px",borderRadius:"50%",backgroundColor:m?.values.find(e=>e.name===o)?.value}},e.createElement("span",null)):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:c?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!c?"#F7F7F7":"transparent",color:c?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):m&&"image"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${c?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!c&&s&&k(s.id)},disabled:c,style:{border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:p&&!c?"#F7F7F7":"transparent",cursor:c?"not-allowed":"pointer",padding:"0px",width:p&&!c?"26px":"24px",height:p&&!c?"26px":"24px",overflow:"hidden",opacity:c?.5:1}},m?.values.find(e=>e.name===o)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Qf(m?.values.find(e=>e.name===o)?.value||"/placeholder.svg"),alt:o,style:{width:p&&!c?"26px":"24px",height:p&&!c?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:c?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!c?"#F7F7F7":"transparent",color:c?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${c?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!c&&s&&k(s.id)},disabled:c,style:{padding:"4px 8px",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:c?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!c?"#F7F7F7":"transparent",color:c?"#ccc":"#707070",cursor:c?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:c?.5:1}},o)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const r=0===x(t?.node?.id);return!1===a?.general?.showOutOfStockVariants&&r?null:e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${r?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>k(t?.node?.id),disabled:r,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:r?"#ccc":"#707070",cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:r?.5:1}},t?.node?.title)}))))))},cu=({bundle:o,addToCartFunction:a,dispatchAnalyticsEvent:i})=>{const l=r(()=>{const e="undefined"!=typeof window&&"clayco-com.myshopify.com"===window?.Shopify?.shop,t=o.products?.filter(t=>{if(e&&""===t?.productDetails?.onlineStoreUrl)return!1;const n=t?.productDetails?.status?.toLowerCase();return!n||("active"===n||"unlisted"===n)})||[];if(!t.some(e=>e.quantity&&e.quantity>1))return{...o,products:t};const n=t.reduce((e,t)=>{const n=t.quantity||1;for(let r=0;r<n;r++)e.push(t);return e},[]);return{...o,products:n}},[o]),[s,c]=t(!1),[d,p]=t(window.innerWidth<786),[m,u]=t(!1),[g,f]=t(null),y=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[x,h]=t(()=>{const e={};return l.products.forEach((t,n)=>{const r=t?.productDetails?.variants?.edges?.find(e=>y(t?.productDetails,e?.node?.id)>0)?.node;e[n]=r?r.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e}),[b,w]=t(null);n(()=>{if(b){const e=setTimeout(()=>w(null),2e3);return()=>clearTimeout(e)}},[b]);const v=l.products?.every((e,t)=>{const n=x[t];return y(e?.productDetails,n)>0});n(()=>(a&&(window.ytComboBundle={bundle:l,addToCart:a,selectedVariants:x},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))}),[l,a,x]);const C=(e,t)=>{h(n=>({...n,[e]:t}))},E=async e=>{const t=Object.entries(x).map(([e])=>({id:l.products[parseInt(e)].productId,title:l.products[parseInt(e)]?.productDetails?.title}));i?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:l._id,bundleType:"combo-bundle",selectedProducts:t}});try{if(c(!0),w(null),!a)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const t=Object.entries(x).map(([e,t])=>{const n=l.products[parseInt(e)],r=n?.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return r?{variantId:t,price:Number(r.price)}:null}).filter(e=>null!==e),n=Object.values(x);await a(Number(N),n,Number(I),t,e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e),w($p(e))}c(!1)},k=l.customizations,T=k?.comboBundle?.discountBadgeDisplay||"discount-on-compare",S=k?.comboBundle?.discountBadgeVisibility,{originalPrice:N,dealPrice:I,offerValue:F,totalPriceSum:z,offerPercentage:B}=r(()=>{const{price:e,compareAtPrice:t}=Object.entries(x).reduce((e,[t,n])=>{const r=l.products[parseInt(t)],o=r?.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e},{price:0,compareAtPrice:0}),n=!1===S?e:"discount-on-price"===T?e:t;let r=e;l?.percentageOff?r=e*(1-l.percentageOff/100):l?.dealAmount?r=l.dealAmount:l?.amountOff&&(r=e-l.amountOff);const o=n-r,a=n>0?Math.round((n-r)/n*100):0;return{originalPrice:n.toFixed(2),dealPrice:r.toFixed(2),offerValue:o.toFixed(2),totalPriceSum:e.toFixed(2),offerPercentage:a}},[x,l.products,l.percentageOff,l.dealAmount,l.amountOff,T,S]);n(()=>{i?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:l._id,bundleType:"combo-bundle"}});const e=()=>{p(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const $=k.comboBundle?.comboCardStyle||"auto",A="vertical"===$||"auto"===$&&!d,D=k.comboBundle?.embedContentVisibility,P="bundles"==l.appName?l.pageHeader?.title:l?.title,_="bundles"==l.appName?l.pageHeader?.description:l?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===k.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===k.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===k.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:k.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===k.comboBundle?.infoAlignment?"flex-start":"right"===k.comboBundle?.infoAlignment?"flex-end":"center"===k.comboBundle?.infoAlignment?"center":void 0,textAlign:k.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},D&&k.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},e.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:k.comboBundle?.productTitleFontSize||"28px",color:k.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},P)),D&&k?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:k.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(k.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},e.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},e.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Yf(k.general.currencySymbol,l.storeCurrencyCode),Uf(I)),!isNaN(Number(N))&&!isNaN(Number(I))&&Number(N)>Number(I)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:k.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Yf(k.general.currencySymbol,l.storeCurrencyCode),Uf(N)),Number(F)>0&&!1!==S&&(()=>{const t="percentage"===(k?.comboBundle?.discountDisplayType||"amount")?`${B}% Off`:`Save ${Yf(k.general.currencySymbol,l.storeCurrencyCode)}${Uf(F)}`;return e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},t)})())),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:k.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:k.comboBundle.productDescriptionFontSize||"16px",color:k.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",e.createElement("u",null,"Shipping")," calculated at checkout."))),k.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,A?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(d?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},l.products.map((t,n)=>{const r=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===x[n])?.node;return r?e.createElement(su,{key:`combo-product-${n}-${t.productId}`,product:t,styles:k,originalPrice:N,dealPrice:I,totalPriceSum:z,selectedVariantId:x[n],onVariantChange:e=>C(n,e),isVertical:A,variantOptions:l.variantOptions,storeCurrencyCode:l.storeCurrencyCode,reviewRatingType:k?.comboBundle?.comboProductRatingsDisplay,productIndex:n,setActiveModalIndex:f}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(d?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},k.comboBundle.subProductsSectionVisibility&&l.products.map((t,n)=>e.createElement(su,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:k,originalPrice:N,dealPrice:I,totalPriceSum:z,selectedVariantId:x[n],onVariantChange:e=>C(n,e),variantOptions:l.variantOptions,reviewRatingType:k?.comboBundle?.comboProductRatingsDisplay,productIndex:n,setActiveModalIndex:f})))),e.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},e.createElement("button",{"data-gokwik-processed":"true",className:`yt-comboBundle-bundle-cta-button ${v?"":"yt-comboBundle-bundle-cta-button-disabled"} ${d?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:b?"#dc2626":v?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor,color:b?"#ffffff":k.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:k.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:v?"pointer":"not-allowed",border:`1px solid ${b?"#dc2626":v?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor}`,boxShadow:Ho(k.general.ctaShadowType),padding:k.general?.ctaPadding,width:k.general?.ctaWidth,margin:"0"},disabled:!v||s,onMouseOver:e=>{k.general.customizeHoverState&&v&&!b&&!s&&(e.currentTarget.style.backgroundColor=k.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=k.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{k.general.customizeHoverState&&v&&!b&&!s&&(e.currentTarget.style.backgroundColor=k.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=k.general?.ctaTextColor||"#FFFFFF")},onClick:()=>{s||(async()=>{l?.personalizedForm?.title?u(!0):await E()})()}},"animated"===k?.general?.atcLoaderType?e.createElement(iu,{color:"white",loading:s,size:22},b?e.createElement(e.Fragment,null,b):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement("span",null,v?k.comboBundle?.ctaTitle??"Add Bundle to cart":k.general.outOfStockLabel||"Out of Stock"),v&&k?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"}))))):s?e.createElement(Ie,{color:"white",loading:s,size:20}):b?e.createElement(e.Fragment,null,b):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement("span",null,v?k.comboBundle?.ctaTitle??"Add Bundle to cart":k.general.outOfStockLabel||"Out of Stock"),v&&k?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"})))))),D&&k.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px",width:"100%"}},e.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:k.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:k.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:k.comboBundle.productDescriptionFontSize||"16px",color:k.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:k.general.primaryColor+"08"},dangerouslySetInnerHTML:{__html:Do(_)}})),l?.personalizedForm?.title&&e.createElement(lu,{isOpen:m,onClose:()=>u(!1),formConfig:l.personalizedForm,onCheckout:async e=>{await E(e),u(!1)},cta:{backgroundColor:k.general?.ctaBackgroundColor||"#121212",textColor:k.general?.ctaTextColor||"#FFFFFF"},isMobile:d}),e.createElement(Rm,{bundleType:"comboBundle",handleAddToBundle:()=>{},selectedProducts:[],remainingQuantity:0,hideAddToBundle:!0,disableQuantitySelector:!0,themeColor:k?.general?.primaryColor||"#000",primaryTextColorCta:k?.general?.primaryContrastColor||"#fff",primaryBackgroundColorCta:k?.general?.primaryColor||"#000",cornerRadius:"8px",styles:k,onVariantSelect:e=>{null!==g&&C(g,e)},bundle:l,totalPriceSum:z,dealPrice:I}))},du=d.div`
3612
+ `,vm=({options:t,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i,showOutOfStockVariants:l=!0})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const i=!a||a(t.name);return l||i?e.createElement("div",{key:t.name,onClick:()=>{i&&r(t)},style:{cursor:i?"pointer":"not-allowed"}},((t,n)=>{const r=!a||a(t.name),i={cursor:r?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:r?1:.5};if("color"===o)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name);return"image"===o?e.createElement("img",{src:Io(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name)})(t,n?.name===t.name)):null})),Cm=({product:o,isOpen:a,onClose:i,variantOptions:l,cta:s,onConfirm:c,showOutOfStockVariants:d=!0})=>{const p=r(()=>e=>e?o?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[o?.tracksInventory]),m=r(()=>{const e=o.variants.edges.find(e=>{const t=e.node;return p(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):o.options?.map(e=>e.values[0])||[]},[o,p]),[u,g]=t(m),[f,y]=t(window.innerWidth<1024);n(()=>{const e=()=>y(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&i()};return a&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[a,i]);const x=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?u.join(" / "):u[0]))?.node,h=x?.image?.url||o.featuredMedia?.preview?.image?.url,b=Io(h,150,85,"webp"),w=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},v=e=>{if(!l?.options)return e.values.map(e=>({name:e,value:e}));const t=l.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},C=(e,t)=>{const n=u[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!a)return null;const E=e.createElement("div",{onClick:i,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:b,alt:o.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},o.title))),e.createElement("div",{style:{padding:"20px"}},o.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},C(t,n)?.name||t.values[0])),e.createElement(vm,{options:v(t),selectedValue:C(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,g(n)})(n,e)},type:w(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...u];n[e]=t;const r=o.options?.length>0?n.join(" / "):n[0],a=o.variants.edges.find(e=>e.node.title===r)?.node;return!!a&&p(a)>0})(n,e),isMobile:f,showOutOfStockVariants:d}))))),e.createElement("button",{onClick:()=>{const e=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?u.join(" / "):u[0]))?.node,t=!!e&&p(e)>0;if(e?.id&&t)c(e.id),i();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const e=o.variants.edges.find(e=>p(e.node)>0)?.node.id;e&&(c(e),i())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:s.backgroundColor,color:s.textColor,textAlign:"center",padding:"16px 0",border:"none",cursor:"pointer",borderBottomLeftRadius:16,borderBottomRightRadius:16},onMouseEnter:e=>{e.currentTarget.style.opacity="0.9"},onMouseLeave:e=>{e.currentTarget.style.opacity="1"},"data-gokwik-processed":"true"},"Add to Bundle")));return V.createPortal(E,document.body)},Em=e=>Math.min(5,Math.max(1,e)),km=(e,t,n)=>e*n+t*(1-n),Tm=({src:r,previewSrc:i,alt:l,onClose:s})=>{const[c,d]=t(1),[p,m]=t(i||r),u=o(null),g=o(null),f=o(null),y=o(null),x=o({s:1,x:0,y:0}),h=o(),b=o(null),w=o(null),v=o(!1);n(()=>{if(r===p)return;const e=new Image;return e.onload=()=>m(r),e.src=r,()=>{e.onload=null}},[r]),n(()=>{const e=u.current;if(!e)return;const t=e=>e.stopPropagation();return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)},[]),n(()=>{const e=e=>{"Escape"===e.key&&s()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]),n(()=>{const e=g.current;if(!e)return;const t=()=>{h.current||(h.current=requestAnimationFrame(()=>{h.current=void 0;const e=x.current;f.current&&(f.current.style.transform=`translate3d(${e.x}px, ${e.y}px, 0) scale(${e.s})`);const t=y.current;t&&t.firstChild&&(t.firstChild.nodeValue=`${Math.round(100*e.s)}%`)}))},n=()=>{const t=f.current,n=x.current;if(!t)return;const r=Math.max(0,(t.offsetWidth*n.s-e.clientWidth)/2),o=Math.max(0,(t.offsetHeight*n.s-e.clientHeight)/2);n.x=Math.min(r,Math.max(-r,n.x)),n.y=Math.min(o,Math.max(-o,n.y))},r=e=>{f.current&&(f.current.style.transition=e?"transform 200ms ease-out":"")},o=(r,o,a)=>{const i=x.current,l=e.getBoundingClientRect(),s=Em(r),c=s/i.s;i.x=km(i.x,o-l.left-l.width/2,c),i.y=km(i.y,a-l.top-l.height/2,c),i.s=s,n(),t()},a=(e,r)=>{const o=x.current;o.x+=e,o.y+=r,n(),t()},i=e=>({x:(e[0].clientX+e[1].clientX)/2,y:(e[0].clientY+e[1].clientY)/2,dist:Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY)}),l=e=>{if(r(!1),v.current=!1,2===e.touches.length)return e.preventDefault(),b.current=i(e.touches),void(w.current=null);const t=e.touches[0];w.current={x:t.clientX,y:t.clientY}},s=e=>{e.preventDefault();const t=b.current;if(2===e.touches.length&&t){const n=i(e.touches);return o(x.current.s*(n.dist/t.dist),n.x,n.y),a(n.x-t.x,n.y-t.y),b.current=n,void(v.current=!0)}const n=w.current;if(!n||1!==e.touches.length||x.current.s<=1)return;const r=e.touches[0];a(r.clientX-n.x,r.clientY-n.y),w.current={x:r.clientX,y:r.clientY},v.current=!0},c=e=>{e.touches.length<2&&(b.current=null),w.current=1===e.touches.length?{x:e.touches[0].clientX,y:e.touches[0].clientY}:null,d(x.current.s)},p=e=>{e.preventDefault(),r(!1),e.ctrlKey||e.metaKey?o(x.current.s*Math.exp(-e.deltaY/120),e.clientX,e.clientY):a(-e.deltaX,-e.deltaY),d(x.current.s)},m=e=>{r(!0),o(x.current.s>1?1:2.5,e.clientX,e.clientY),d(x.current.s)};return e.addEventListener("touchstart",l,{passive:!1}),e.addEventListener("touchmove",s,{passive:!1}),e.addEventListener("touchend",c),e.addEventListener("touchcancel",c),e.addEventListener("wheel",p,{passive:!1}),e.addEventListener("dblclick",m),()=>{e.removeEventListener("touchstart",l),e.removeEventListener("touchmove",s),e.removeEventListener("touchend",c),e.removeEventListener("touchcancel",c),e.removeEventListener("wheel",p),e.removeEventListener("dblclick",m),h.current&&cancelAnimationFrame(h.current)}},[]);const C=a(e=>{const t=g.current,n=f.current,r=x.current;if(!t||!n)return;const o=Em(e),a=o/r.s;r.x=km(r.x,0,a),r.y=km(r.y,0,a),r.s=o;const i=Math.max(0,(n.offsetWidth*o-t.clientWidth)/2),l=Math.max(0,(n.offsetHeight*o-t.clientHeight)/2);r.x=Math.min(i,Math.max(-i,r.x)),r.y=Math.min(l,Math.max(-l,r.y)),n.style.transition="transform 200ms ease-out",n.style.transform=`translate3d(${r.x}px, ${r.y}px, 0) scale(${o})`,d(o)},[]),E={display:"flex",alignItems:"center",justifyContent:"center",width:"38px",height:"38px",padding:0,border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.55)",color:"#fff",cursor:"pointer"};return V.createPortal(e.createElement("div",{ref:u,style:{position:"fixed",top:0,right:0,bottom:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.92)",zIndex:2147483646}},e.createElement("div",{ref:g,style:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none",cursor:c>1?"grab":"zoom-in"},onClick:e=>{v.current||"IMG"!==e.target.tagName&&s()},onPointerDown:e=>{v.current=!1,"touch"!==e.pointerType&&1!==c&&(f.current&&(f.current.style.transition=""),w.current={x:e.clientX,y:e.clientY})},onPointerMove:e=>{const t=w.current,n=f.current,r=g.current;if("touch"===e.pointerType||!t||!n||!r)return;const o=x.current,a=Math.max(0,(n.offsetWidth*o.s-r.clientWidth)/2),i=Math.max(0,(n.offsetHeight*o.s-r.clientHeight)/2);o.x=Math.min(a,Math.max(-a,o.x+e.clientX-t.x)),o.y=Math.min(i,Math.max(-i,o.y+e.clientY-t.y)),n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0) scale(${o.s})`,w.current={x:e.clientX,y:e.clientY},v.current=!0},onPointerUp:()=>{w.current=null},onPointerLeave:()=>{w.current=null}},e.createElement("img",{ref:f,src:p,alt:l,draggable:!1,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",userSelect:"none",willChange:"transform"}})),e.createElement("button",{type:"button","aria-label":"Close image",onClick:s,style:{...E,position:"fixed",top:"16px",right:"16px"}},e.createElement(yt,{size:16})),e.createElement("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"10px"}},e.createElement("button",{type:"button","aria-label":"Zoom out",onClick:()=>C(c-.5),disabled:c<=1,style:{...E,opacity:c<=1?.4:1}},e.createElement(xt,{size:16})),e.createElement("span",{ref:y,style:{color:"#fff",fontSize:"13px",minWidth:"44px",textAlign:"center"}},`${Math.round(100*c)}%`),e.createElement("button",{type:"button","aria-label":"Zoom in",onClick:()=>C(c+.5),disabled:c>=5,style:{...E,opacity:c>=5?.4:1}},e.createElement(ht,{size:16})))),document.body)},Sm=({src:n,fullSrc:r,alt:o,className:a,style:i})=>{const[l,s]=t(!1);return e.createElement("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%",width:i?.width,height:i?.height,lineHeight:0}},e.createElement("img",{src:n,alt:o,className:a,onClick:()=>s(!0),style:{maxWidth:"100%",cursor:"zoom-in",...i},loading:"lazy"}),e.createElement("button",{type:"button","aria-label":"Expand image",onClick:e=>{e.stopPropagation(),s(!0)},style:{position:"absolute",bottom:"10px",right:"10px",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:0,border:"1px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.9)",color:"#000",cursor:"pointer"}},e.createElement(ft,{size:14})),l&&e.createElement(Tm,{src:r||n,previewSrc:n,alt:o,onClose:()=>s(!1)}))},Nm={appearance:"none",WebkitAppearance:"none",margin:0,minWidth:0,minHeight:0,width:"auto",height:"auto",boxShadow:"none",letterSpacing:"normal",textTransform:"none",fontFamily:"inherit"},Im=({options:r,value:l,onChange:s,className:c,style:d,menuStyle:p,chevronStyle:m,children:u,ariaLabel:g})=>{const f=o(null),y=o(null),[x,h]=t(!1),[w,v]=t(null),[C,E]=t({left:0,width:0,maxHeight:240}),k=r.find(e=>e.value===l),T=a(e=>{if(!e)return;const t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom-4,r=t.top-4,o=n<Math.min(240,160)&&r>n,a=Math.max(120,o?r:n),i=Math.min(240,a),l=Math.max(t.width,120);E({...o?{bottom:window.innerHeight-t.top+4}:{top:t.bottom+4},left:Math.min(t.left,Math.max(8,window.innerWidth-l-8)),width:l,maxHeight:i})},[]),S=a(()=>T(f.current),[T]);return n(()=>{const e=y.current;if(!e)return;const t=e=>e.stopPropagation();return e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0}),()=>{e.removeEventListener("mousedown",t),e.removeEventListener("touchstart",t)}},[x]),i(()=>{x&&S()},[x,S]),n(()=>{if(!x)return;const e=e=>{const t=e.target;f.current?.contains(t)||y.current?.contains(t)||h(!1)},t=e=>{"Escape"===e.key&&(h(!1),f.current?.focus())};document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",t),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S);const n="undefined"!=typeof ResizeObserver?new ResizeObserver(S):null;return f.current&&n?.observe(f.current),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",t),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S),n?.disconnect()}},[x,S]),r.length?e.createElement(e.Fragment,null,e.createElement("button",{type:"button",ref:f,className:c,"aria-haspopup":"listbox","aria-expanded":x,"aria-label":g||k?.label,onClick:e=>{e.preventDefault(),e.stopPropagation(),T(e.currentTarget),v(null),h(e=>!e)},style:{...Nm,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"6px",font:"inherit",textAlign:"left",cursor:"pointer",...d}},e.createElement("span",{className:c?`${c}-value`:void 0,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},u??k?.label??""),e.createElement("span",{className:c?`${c}-chevron`:void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"transform 0.15s ease",transform:x?"rotate(180deg)":"none",...m}},e.createElement(b,null))),x&&"undefined"!=typeof document&&W(e.createElement("div",{ref:y,role:"listbox",className:c?`${c}-menu`:void 0,style:{position:"fixed",top:C.top,bottom:C.bottom,left:C.left,minWidth:C.width,maxWidth:"calc(100vw - 16px)",maxHeight:C.maxHeight,overflowY:"auto",zIndex:2147483647,background:"#fff",color:"#333",border:"1px solid #ddd",borderRadius:"6px",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.14)",padding:"4px",boxSizing:"border-box",fontFamily:"inherit",...p}},r.map(t=>{const n=t.value===l,r=!t.disabled&&t.value===w;return e.createElement("button",{type:"button",key:t.value,role:"option","aria-selected":n,disabled:t.disabled,autoFocus:n,className:[c&&`${c}-menu-option`,t.className].filter(Boolean).join(" ")||void 0,onMouseEnter:()=>!t.disabled&&v(t.value),onMouseLeave:()=>v(e=>e===t.value?null:e),onFocus:()=>!t.disabled&&v(t.value),onClick:e=>{e.preventDefault(),e.stopPropagation(),h(!1),t.value!==l&&s(t.value),f.current?.focus()},style:{...Nm,display:"block",width:"100%",padding:"8px 10px",border:"none",borderRadius:"4px",background:r?"rgba(0, 0, 0, 0.05)":n?"rgba(0, 0, 0, 0.035)":"none",color:"inherit",font:"inherit",fontWeight:n?600:400,textAlign:"left",lineHeight:"normal",cursor:t.disabled?"not-allowed":"pointer",transition:"background-color 0.15s ease",opacity:t.disabled?.45:1}},t.label)})),document.body)):null},Fm=e=>e.split("?")[0],zm=({className:t,product:n,rating:r,reviewRatingType:o})=>{const a=n?.rating?.averageRating??r?.averageRating??0,i=n?.rating?.ratingCount??r?.ratingCount??0;return a<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===o&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},a," rating")),"ratingAndReviewCount"===o&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14}),a,e.createElement(Le,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",i," reviews)"))},Bm=({isMobile:t,product:n,bundleType:r,images:o,mobileScrollRef:a,desktopThumbsRef:i,selectedVariantImage:l,currentImageIndex:s,setCurrentImageIndex:c,themeColor:d})=>e.createElement(e.Fragment,null,e.createElement("div",{style:{position:t?"relative":void 0}},t?e.createElement("div",{ref:a,style:{display:"flex",flexDirection:"row",overflowX:"auto",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},o.length>0&&o.map((t,o)=>e.createElement("div",{key:o,style:{width:"100%",aspectRatio:"1 / 1",flex:"0 0 auto",scrollSnapAlign:"center",zIndex:999}},e.createElement(Sm,{src:Qf(t?.url),fullSrc:t?.url,alt:t.altText||`${n?.title||"Product"} - Image ${o+1}`,className:`yt-${r}-modal-desktop-main-image yt-${r}-modal-desktop-main-image`,style:{width:"100%",height:"100%",objectFit:"contain"}})))):e.createElement(e.Fragment,null,e.createElement(Sm,{src:Qf(l??"")||Qf(o[s]?.url),fullSrc:l||o[s]?.url,alt:o[s]?.altText||`${n?.title||"Product"}`,className:`yt-${r}-modal-desktop-main-image yt-${r}-modal-desktop-main-image main-image`}),e.createElement("div",{ref:i,style:{display:"flex",flexDirection:"row",overflowX:"auto",gap:t?"8px":"12px",padding:"12px 0",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},o.length>1&&o.map((r,o)=>e.createElement("img",{key:o,src:Qf(r?.url),alt:r.altText||`${n?.title||"Product"} - Image ${o+1}`,onClick:()=>c(o),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:s===o?`2px solid ${d||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),$m=({className:t,product:n,selectedVariant:r,onVariantChange:o,getMaxAvailableQty:a,showOutOfStockVariants:i})=>n?.variants?.edges?.length<=1?null:e.createElement("div",{className:t},e.createElement("div",{className:`${t}-label`,style:{marginBottom:"10px"}},e.createElement(Im,{className:`${t}-select`,ariaLabel:`Select ${n.options[0].name}`,value:r?.id||"",onChange:o,options:(n?.variants?.edges??[]).filter(({node:e})=>!1!==i||a(e)>0).map(({node:e})=>({value:e.id,label:e.title,disabled:0===a(e)})),style:{width:"100%",border:"none",borderBottom:"1px solid #e0e0e0",borderRadius:0,background:"transparent",padding:"0 5px 5px 0",fontSize:"16px",color:"#999"},chevronStyle:{fontSize:"12px",color:"#000"},menuStyle:{fontSize:"14px",color:"#000"}},e.createElement("span",null,n.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},r?.title))))),Am=({isMobile:t,product:n,selectedVariants:r,getOptionValues:o,getSelectedOption:a,getOptionType:i,isOptionValueAvailable:l,onOptionChange:s,showOutOfStockVariants:c})=>e.createElement(e.Fragment,null,n.options.map((n,d)=>e.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},r[d]||n.values[0])),e.createElement(vm,{options:o(n),selectedValue:a(n,d),onChange:e=>{s(d,e)},type:i(n.name),isOptionAvailable:e=>l(d,e),isMobile:t,showOutOfStockVariants:!1!==c}))))),Dm=({isMobile:t,bundleType:n,selectedVariant:r,discountedPrice:o,compareAtDisplayPrice:a,isFreebieTier:i,showFreebieTierProductPrices:l,currencySymbol:s,primaryColor:c})=>e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-price yt-${n}-modal-${t?"mobile":"desktop"}-price`,style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:t?"center":"baseline",gap:"6px"}},i&&!l?e.createElement(e.Fragment,null,e.createElement("span",{className:`yt-${n}-compare-price yt-${n}-compare-price yt-fixed-bundle-original-price`,style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Yf(s),Uf(r?.price)),e.createElement("span",{className:`yt-${n}-current-price yt-${n}-current-price`,style:{color:c||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,a>0&&e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-compare-price yt-${n}-modal-${t?"mobile":"desktop"}-compare-price`,style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Yf(s),Uf(a)),e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-current-price yt-${n}-modal-${t?"mobile":"desktop"}-current-price`},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"left",lineHeight:"normal"}},Yf(s),Uf(o))))),Pm=({isMobile:t,bundleType:n,hideAddToBundle:r,themeColor:o,cornerRadius:a,primaryTextColorCta:i,disabled:l,onClick:s,label:c})=>r?null:e.createElement("div",{className:`yt-${n}-modal-${t?"mobile":"desktop"}-atc-wrapper yt-${n}-modal-${t?"mobile":"desktop"}-atc-wrapper ${t?"":"yt-product-modal-atc-wrapper"}`,style:{width:t?"100%":"80%"}},e.createElement("button",{"data-gokwik-processed":"true",className:`yt-${n}-modal-${t?"mobile":"desktop"}-atc-button yt-${n}-modal-${t?"mobile":"desktop"}-atc-button ${t?"":"yt-product-modal-atc-button"}`,style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:o||"#111",borderRadius:a,color:i||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:l?.5:1,cursor:l?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),s()},disabled:l},c)),_m={display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px"},Lm={fontSize:"12px",fontWeight:600,lineHeight:"normal",color:"#777",border:"1px solid lightgray",borderRadius:"12px",padding:"2px 8px",flexShrink:0,whiteSpace:"nowrap"},Rm=s((i,l)=>{const[s,c]=Ce(ym),d=r(()=>{const e=i.bundleType;return e&&i.styles?.[e]?i.styles[e]:i.styles?.byob},[i.styles,i.bundleType]),p=i.reviewRatingType??{byob:i.styles?.byob?.productRatingsDisplay,fixedBundle:i.styles?.fixedBundle?.productRatingsDisplay,comboBundle:i.styles?.comboBundle?.comboProductRatingsDisplay}[i.bundleType??""]??i.bundle?.reviewRatingType,m=s?.selectedVariant?.title,u=s?.title,g=d?.variantSelectorType??d?.comboVariantTypeSelector??"dropdown",f=!("customOptions"===g?s?.options?.some(e=>(e?.values?.length??0)>1)??!1:(s?.variants?.edges?.length??0)>1)&&m&&"Default Title"!==m&&m!==u?m:"",y=r(()=>e=>{const t=i?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:e?s?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?i?.bundleProductsCustomQuantity??e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLocaleLowerCase()?i?.bundleProductsCustomQuantity??1/0:0:i?.bundleProductsCustomQuantity??1/0:0},[s?.tracksInventory,i?.customVariantsQuantity,i?.bundleProductsCustomQuantity]),x=s?.variants.edges?.filter(e=>y(e.node)>0)||[],[h,b]=t(x?.[0]?.node),w=r(()=>{if(!h)return 0;const e=parseFloat(h?.price??"0");let t=e;if("comboBundle"===i.bundleType){const n=Number(i.totalPriceSum||0);let r=Number(i.dealPrice||0);!r&&i.bundle&&(i.bundle?.percentageOff?r=n*(1-i.bundle.percentageOff/100):i.bundle?.dealAmount?r=i.bundle.dealAmount:i.bundle?.amountOff&&(r=n-i.bundle.amountOff)),n>0&&r>0&&(t=e/n*r)}else if("fixedBundle"===i.bundleType){const n=i.bundleDiscountType||(i.bundle?.percentageOff?"percentageOff":i.bundle?.dealAmount?"fixedPrice":i.bundle?.amountOff?"amountOff":""),r=i.bundleDiscountValue??i.bundle?.percentageOff??i.bundle?.dealAmount??i.bundle?.amountOff??0,o=i.totalSelectedOriginal??0;if(r)switch(n){case"percentOff":case"percentageOff":case"percentage":case"Percentage":t=e*(1-r/100);break;case"amountOff":case"amount":case"Amount Off":if(o>0){const n=e/o*r;t=Math.max(0,e-n)}break;case"fixedPrice":case"fixed":case"fixedPrice":if(o>0){t=r*(e/o)}}}return parseFloat(t.toFixed(2))},[h,i.bundleType,i.totalPriceSum,i.dealPrice,i.bundleDiscountType,i.bundleDiscountValue,i.totalSelectedOriginal,i.bundle]),v=r(()=>{if(!h)return 0;const e=parseFloat(h?.price??"0"),t=parseFloat(h?.compareAtPrice??"0"),n=i.styles?.[i.bundleType||""]||i.styles?.general,r=n?.discountBadgeDisplay;let o=0;return"comboBundle"===i.bundleType||"fixedBundle"===i.bundleType?"discount-on-compare"===r&&t>0?o=t:w<e?o=e:t>e&&(o=t):t>e&&(o=t),o>0?parseFloat(o.toFixed(2)):0},[h,i.bundleType,i.styles,w]),[C,E]=t(0),[k,T]=t("undefined"!=typeof window&&window.innerWidth<=600),[S,N]=t(1),[I,F]=t("idle"),z=o(null),B=o(null),$=o(null),[A,D]=t(null),P=o(!1),_=o(),[L,R]=t(0),[O,M]=t(),W=r(()=>{const e=s?.variants.edges.find(e=>{const t=e.node;return y(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):s?.options?.map(e=>e.values[0])||[]},[s,y]),[j,H]=t(W);n(()=>{if(s?.id){P.current=!1;const e=s.variants.edges?.filter(e=>y(e.node)>0),t=s?.selectedVariant??e[0]?.node;b(t);const n=t?.image?.url,r=n?(s.media?.edges??[]).map(e=>e?.node?.preview?.image??e?.node?.image).filter(e=>e?.url?.length>0).findIndex(e=>Fm(e.url)===Fm(n)):-1;D(s.selectedVariant&&r>=0?{index:r}:null),E(r>=0?r:0),M(r>=0?void 0:n),t?.title&&"Default Title"!==t.title&&H(t.title.split(" / "))}},[s?.id]),n(()=>{const e=i.selectedProducts?.find(e=>e.variantId===h?.id);N(e?e.quantity:0)},[i.selectedProducts,h?.id]);const q=o(i.onVariantSelect);n(()=>{q.current=i.onVariantSelect},[i.onVariantSelect]),n(()=>{h?.id&&s&&P.current&&q.current?.(h.id,s)},[h?.id,s?.id]),n(()=>{if(!A)return;let e=!1;[B.current,$.current].forEach(t=>{const n=t?.children[A.index];t&&n&&(n.scrollIntoView({behavior:"instant",block:"nearest",inline:"center"}),e=!0)}),e&&D(null)},[A,s?.media?.edges?.length]);const U=()=>{h?.id&&s&&(F("check"),i.handleAddToBundle(h?.id,s,1),clearTimeout(_.current),_.current=setTimeout(()=>{F("idle"),c(void 0)},500))};n(()=>{const e=()=>T(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>()=>clearTimeout(_.current),[]);const Y=s?.descriptionHtml??"",Q=s?.media,G=Q?.edges?.map(e=>e?.node?.preview?.image??e?.node?.image).filter(e=>e?.url?.length>0)??[],Z=a(e=>{E(e),M(void 0)},[]),X=a(e=>{const t=x?.find(t=>t.node.id===e)?.node;t&&y(t)>0&&(P.current=!0,b(t),M(t?.image?.url),t.title&&"Default Title"!==t.title&&H(t.title.split(" / ")))},[x,y]),K=a(e=>{if(!i.bundleVariantOptions?.options)return"text";const t=i.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[i.bundleVariantOptions]),J=a(e=>{if(!i?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=i?.bundleVariantOptions?.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},[i.bundleVariantOptions]),ee=a((e,t)=>{const n=[...j];n[e]=t.name,H(n);const r=(s?.options?.length??0)>0?n.join(" / "):n[0],o=s?.variants.edges.find(e=>e.node.title===r)?.node;M(o?.image?.url),o&&y(o)>0&&(P.current=!0,b(o))},[j,s,y]),te=a((e,t)=>{const n=j[t];if(!n)return null;return J(e).find(e=>e.name===n)||null},[j,J]),re=a((e,t)=>{const n=[...j];n[e]=t;const r=(s?.options?.length??0)>0?n.join(" / "):n[0],o=s?.variants.edges.find(e=>e.node.title===r)?.node;return!!o&&y(o)>0},[j,s,y]);if(n(()=>{if(s?.id){document.body.style.overflow="hidden",window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{c(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{document.body.style.overflow="unset",window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}},[s?.id,c]),n(()=>{if(k&&s?.id&&z.current){const e=()=>{z.current&&R(z.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[k,s?.id]),!s)return null;const oe=i.selectedProducts.filter(e=>e.variantId===h?.id).reduce((e,t)=>e+t.quantity,0),ae=i.customVariantsQuantity?.find(e=>e.variantId===h?.id)?.quantity??i.bundleProductsCustomQuantity??1/0,ie=ae!==1/0&&oe>=ae,le=i.hideAddToBundle||!h||y(h)<=0||ie||"idle"!==I||i?.disableQuantitySelector&&1===S,se=e.createElement(hm,{className:`yt-${i?.bundleType}-modal-desktop-overlay yt-${i?.bundleType}-modal-desktop-overlay`,onClick:()=>c(void 0)},e.createElement(bm,{$isSmallScreen:k,ref:l,onClick:e=>e.stopPropagation()},e.createElement(wm,{ref:l,className:`yt-${i?.bundleType}-modal-desktop-container yt-${i?.bundleType}-modal-desktop-container yt-variant-selection-modal`},e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop yt-${i?.bundleType}-modal-desktop yt-variant-selection-modal ${k?"small-screen":"large-screen"}`},e.createElement(xm,{className:`yt-${i?.bundleType}-modal-desktop-close yt-${i?.bundleType}-modal-desktop-close`,onClick:()=>{c(void 0)},style:{backgroundColor:"white"}},e.createElement(ne,{size:"25"})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-image-section yt-${i?.bundleType}-modal-desktop-image-section image-section`},e.createElement(Bm,{product:s,bundleType:i.bundleType,images:G,mobileScrollRef:B,desktopThumbsRef:$,selectedVariantImage:O,currentImageIndex:C,setCurrentImageIndex:Z,themeColor:i.themeColor})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-details-section yt-${i?.bundleType}-modal-desktop-details-section details-section`,style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},e.createElement("h2",{className:`yt-${i?.bundleType}-modal-desktop-title yt-${i?.bundleType}-modal-desktop-title`,style:f?_m:void 0},u,f&&e.createElement("span",{className:`yt-${i?.bundleType}-modal-variant-badge`,style:Lm},f)),e.createElement(zm,{product:s,rating:i.rating,reviewRatingType:p,className:`yt-${i?.bundleType}-modal-desktop-rating yt-${i?.bundleType}-modal-desktop-rating`}),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-variant-price-wrapper yt-${i?.bundleType}-modal-desktop-variant-price-wrapper`,style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},"dropdown"===g&&e.createElement($m,{product:s,selectedVariant:h,onVariantChange:X,getMaxAvailableQty:y,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants,className:`yt-${i?.bundleType}-modal-desktop-variant-selector yt-${i?.bundleType}-modal-desktop-variant-selector`}),"customOptions"===g&&e.createElement(Am,{product:s,selectedVariants:j,getOptionValues:J,getSelectedOption:te,getOptionType:K,isOptionValueAvailable:re,onOptionChange:ee,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants}),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-price-atc-wrapper yt-${i?.bundleType}-modal-desktop-price-atc-wrapper`,style:{display:"flex",justifyContent:i.hideAddToBundle?"flex-start":"center",alignItems:"center",width:"100%"}},e.createElement(Dm,{bundleType:i.bundleType,selectedVariant:h,discountedPrice:w,compareAtDisplayPrice:v,isFreebieTier:i.isFreebieTier,showFreebieTierProductPrices:i.showFreebieTierProductPrices,currencySymbol:i.styles.general.currencySymbol,primaryColor:i.styles.general.primaryColor}),e.createElement(Pm,{bundleType:i.bundleType,hideAddToBundle:i.hideAddToBundle,themeColor:i.themeColor,cornerRadius:i.cornerRadius,primaryTextColorCta:i.primaryTextColorCta,disabled:le,onClick:U,label:i.styles?.byob?.addToBundleCTAText??"Add to bundle"}))),e.createElement("div",{className:`yt-${i?.bundleType}-modal-desktop-divider yt-${i?.bundleType}-modal-desktop-divider`,style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},e.createElement("span",null)),e.createElement("span",{className:`yt-${i?.bundleType}-modal-desktop-description yt-${i?.bundleType}-modal-desktop-description yt-description-content`,style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:Do(Y)}})))))),ce=e.createElement(hm,{className:`yt-${i?.bundleType}-modal-mobile-overlay yt-${i?.bundleType}-modal-mobile-overlay`,onClick:()=>c(void 0)},e.createElement(bm,{className:`yt-${i?.bundleType}-modal-mobile-content yt-${i?.bundleType}-modal-mobile-content`,style:{padding:"0px",position:"relative"},$isSmallScreen:k,ref:l,onClick:e=>e.stopPropagation()},e.createElement(wm,{ref:l,className:`yt-${i?.bundleType}-modal-mobile-container yt-${i?.bundleType}-modal-mobile-container yt-variant-selection-modal`},e.createElement("button",{className:`yt-${i?.bundleType}-modal-mobile-close-btn yt-${i?.bundleType}-modal-mobile-close-btn`,style:{position:"fixed",top:"20px",right:"20px",zIndex:9999999999,backgroundColor:"#FFFFFF",padding:"4px",borderRadius:"50%",border:"1px solid lightgray",display:"flex",justifyContent:"center",alignItems:"center"},onClick:()=>{c(void 0)}},e.createElement(yt,{className:`yt-${i?.bundleType}-modal-mobile-close-icon yt-${i?.bundleType}-modal-mobile-close-icon`,style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile yt-${i?.bundleType}-modal-mobile yt-variant-selection-modal small-screen`,style:{padding:"0px"}},e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-image-section yt-${i?.bundleType}-modal-mobile-image-section image-section`},e.createElement(Bm,{product:s,bundleType:i.bundleType,images:G,mobileScrollRef:B,desktopThumbsRef:$,selectedVariantImage:O,currentImageIndex:C,setCurrentImageIndex:Z,themeColor:i.themeColor,isMobile:!0})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-details-section yt-${i?.bundleType}-modal-mobile-details-section details-section`,style:{padding:"0 30px",margin:"15px 0",paddingBottom:L?`${L+20}px`:"120px"}},e.createElement("h2",{className:`yt-${i?.bundleType}-modal-mobile-title yt-${i?.bundleType}-modal-mobile-title`,style:{margin:"0px",...f?_m:{}}},u,f&&e.createElement("span",{className:`yt-${i?.bundleType}-modal-variant-badge`,style:Lm},f)),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(zm,{product:s,rating:i.rating,reviewRatingType:p,className:`yt-${i?.bundleType}-modal-mobile-rating yt-${i?.bundleType}-modal-mobile-rating`})),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-divider yt-${i?.bundleType}-modal-mobile-divider`,style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},e.createElement("span",null)),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-description yt-${i?.bundleType}-modal-mobile-description yt-description-content`,style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:Do(Y)}})))),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-bottom-bar yt-${i?.bundleType}-modal-mobile-bottom-bar`,ref:z,style:{position:"fixed",bottom:"0px",left:"0px",right:"0px",padding:"12px 15px",borderTop:"1px solid lightgray",boxShadow:"0px -4px 5px rgba(0, 0, 0, 0.1)",backgroundColor:"#fff",display:"flex",flexDirection:"column",gap:"2px",zIndex:9999999999}},"customOptions"===g?e.createElement(Am,{product:s,selectedVariants:j,getOptionValues:J,getSelectedOption:te,getOptionType:K,isOptionValueAvailable:re,onOptionChange:ee,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants,isMobile:!0}):e.createElement($m,{product:s,selectedVariant:h,onVariantChange:X,getMaxAvailableQty:y,showOutOfStockVariants:i.styles?.general?.showOutOfStockVariants,className:`yt-${i?.bundleType}-modal-desktop-variant-selector yt-${i?.bundleType}-modal-desktop-variant-selector`}),e.createElement("div",{className:`yt-${i?.bundleType}-modal-mobile-price-atc-wrapper yt-${i?.bundleType}-modal-mobile-price-atc-wrapper`,style:{display:"flex",justifyContent:i.hideAddToBundle?"flex-start":"center",alignItems:"center",width:"100%"}},e.createElement(Dm,{bundleType:i.bundleType,selectedVariant:h,discountedPrice:w,compareAtDisplayPrice:v,isFreebieTier:i.isFreebieTier,showFreebieTierProductPrices:i.showFreebieTierProductPrices,currencySymbol:i.styles.general.currencySymbol,primaryColor:i.styles.general.primaryColor,isMobile:!0}),e.createElement(Pm,{bundleType:i.bundleType,hideAddToBundle:i.hideAddToBundle,themeColor:i.themeColor,cornerRadius:i.cornerRadius,primaryTextColorCta:i.primaryTextColorCta,disabled:le,onClick:U,label:i.styles?.byob?.addToBundleCTAText??"Add to bundle",isMobile:!0})))));return V.createPortal(k?ce:se,document.body)}),Om=({coverImageUrl:t,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],i=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map(({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const s=t||n||"",c=i(s,800)||s,d=[];if(n&&n!==t){const t=l(n);t&&d.push(e.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:t}))}if(t){const n=l(t);n&&(d.length>0?d.push(e.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):d.push(e.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const t=l(n);t&&d.push(e.createElement("source",{key:"mobile",srcSet:t}))}return e.createElement("div",{style:{width:"100%",display:"block"}},e.createElement("picture",{style:{display:"block",width:"100%"}},d,e.createElement("img",{src:c,alt:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},Mm=({title:t,isOpen:n,onToggle:r,children:o})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:r,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(tt,{className:"yt-byob-icon-minus",size:20}):e.createElement(Xe,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},o)),Vm=({availableFilters:n,appliedFilters:r,toggleFilter:o,clearAllFilters:a,applyPriceFilter:i,priceMin:l,setPriceMin:s,priceMax:c,setPriceMax:d,maxPossiblePrice:p,styles:m,availableProductCount:u,products:g,unavailableProductCount:f,storeCurrencyCode:y,showActions:x=!0,openSections:h,toggleSection:b})=>{const[w,v]=t(null),C=Yf(m?.general?.currencySymbol)??y??"USD";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(Mm,{key:t.id,title:t.label,isOpen:!!h[t.id],onToggle:()=>b(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const a=r[t.id]?.includes(n.id)||!1;return"filter.v.availability.1"===n.id?u??g.length:"filter.v.availability.0"===n.id||n.count,e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:a,onChange:()=>o(t.id,n.id),style:{width:"18px",height:"18px",accentColor:m?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,c.toLocaleString()),e.createElement("div",{className:"yt-byob-price-slider-container",style:{position:"relative",width:"100%",height:"4px",background:"#e5e7eb",borderRadius:"4px",marginBottom:"10px"}},e.createElement("div",{className:"yt-byob-price-slider-track",style:{position:"absolute",height:"100%",background:"#333",borderRadius:"4px",left:l/p*100+"%",right:100-c/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>v("min"),onTouchStart:()=>v("min"),onChange:e=>{const t=Math.min(Number(e.target.value),c-10);s(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===w?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:c,onMouseDown:()=>v("max"),onTouchStart:()=>v("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);d(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===w?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),x&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:a,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:i,style:{flex:1,padding:"8px",background:m?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Wm=t=>{const{showFiltersDrawer:n,handleClose:r,isAnimating:o,isMobile:a}=t;return n?W(e.createElement("div",{className:"yt-byob-filter-drawer-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",justifyContent:"flex-end",opacity:o?1:0,transition:"opacity 300ms ease-in-out"},onClick:r},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:a?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:o?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Vm,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),r()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},jm=t=>{const{showFiltersDrawer:n}=t;return n&&0!==t?.availableFilters?.length?e.createElement("div",{className:"yt-byob-filters-sidebar",style:{width:"280px",minWidth:"280px",padding:"0",height:"auto",maxHeight:"calc(100vh - 40px)",position:"sticky",top:"20px",display:"flex",flexDirection:"column",borderRight:"1px solid #eee",marginRight:"20px"}},e.createElement(Vm,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Hm=({enableSortAndFilter:r,isMobile:o,setSearchTerm:a,searchTerm:i,styles:l,setSortBy:s,appliedFilters:c,setAppliedFilters:d,availableFilters:p=[],products:m,availableProductCount:u,unavailableProductCount:g,maxPossiblePrice:f,storeCurrencyCode:y,sharedFiltersState:x,openSections:h,toggleSection:w,sortBy:v})=>{const[C,E]=t(!1),[k,T]=t(i),{showFilters:S,setShowFilters:N,priceMax:I,setPriceMax:F,priceMin:z,setPriceMin:B}=x,[$,A]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",P=!o&&"sidebar"===D,_="none"===D;n(()=>{c["filter.v.price"]||(F(f),B(0))},[f,c]);n(()=>{const e=setTimeout(()=>{a(k)},300);return()=>clearTimeout(e)},[k,a]),n(()=>(S&&!P?(document.body.style.overflow="hidden",A(!0)):(document.body.style.overflow="",A(!1)),()=>{document.body.style.overflow=""}),[S,P]);const L=Object.entries(c).reduce((e,[t,n])=>"filter.v.price"===t?z>0||I<f?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:o?"column":"row",justifyContent:"space-between",alignItems:o?"flex-end":"center",marginBottom:"20px",width:"100%",gap:o?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:r?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},r&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:o?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},o&&!C?e.createElement(Ke,{className:"yt-byob-search-icon-trigger",fontSize:"20px",color:"#555",style:{cursor:"pointer"},onClick:()=>E(!0)}):e.createElement(e.Fragment,null,e.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:o?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Ke,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),o&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>N(!S),style:{display:_?"none":"flex",alignItems:"center",gap:o?"0px":"6px",background:S&&P?"#f3f4f6":"white",cursor:"pointer",fontSize:"14px",color:"#333",whiteSpace:"nowrap",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)"}},e.createElement(Je,{className:"yt-byob-filter-toggle-icon",size:18}),!o&&"Filters",L>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},L)),r&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!o&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),o&&e.createElement(et,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:v,onChange:e=>s(e.target.value)},e.createElement("option",{className:"yt-byob-sort-option",value:""},"Featured"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-low-to-high"},"Price: Low to High"),e.createElement("option",{className:"yt-byob-sort-option",value:"price-high-to-low"},"Price: High to Low"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-asc"},"Alphabetical: A-Z"),e.createElement("option",{className:"yt-byob-sort-option",value:"title-desc"},"Alphabetical: Z-A")),e.createElement(b,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!P&&!_&&e.createElement(Wm,{showFiltersDrawer:S,handleClose:()=>{P?N(!1):(document.body.style.overflow="",A(!1),setTimeout(()=>{N(!1)},300))},isAnimating:$,isMobile:o,availableFilters:p,appliedFilters:c,toggleFilter:(e,t)=>{d(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{F(f),B(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${I}`],t})},priceMin:z,setPriceMin:B,priceMax:I,setPriceMax:F,maxPossiblePrice:f,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:y,openSections:h,toggleSection:w}))},qm=()=>e.createElement(e.Fragment,null,e.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),e.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Um=({title:t,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="string"==typeof n?{url:n,name:"Attachment"}:n,l=i?.loading,s=i?.error,c=i?.url;return e.createElement("div",{className:"yt-personalization-upload-field",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",border:"1px dashed #ccc",borderRadius:"10px",background:"#fff",gap:"12px"}},e.createElement("div",{className:"yt-personalized-form-field-content",style:{flex:1,minWidth:0}},e.createElement("div",{className:"yt-personalized-form-field-title",style:{fontWeight:600,fontSize:"14px",color:"#1a1a1a"}},t),!i&&!l&&!s&&e.createElement("div",{className:"yt-personalized-form-field-hint",style:{fontSize:"12px",color:"#888",marginTop:"2px"}},"jpeg/png/img (max size: 5MB)"),l&&e.createElement("div",{className:"yt-personalized-form-field-loading",style:{display:"flex",alignItems:"center",gap:"6px",color:"#007bff",fontSize:"12px",marginTop:"4px"}},e.createElement(qm,null)," Uploading ",i?.name||"image","..."),s&&e.createElement("div",{className:"yt-personalized-form-field-error",style:{fontSize:"12px",color:"#dc3545",marginTop:"2px"}},"Upload failed."),c&&!l&&!s&&e.createElement("div",{className:"yt-personalized-form-field-preview",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},e.createElement("img",{className:"yt-personalized-form-field-preview-image",src:i.url,alt:"Uploaded",style:{width:"36px",height:"36px",objectFit:"cover",borderRadius:"4px",border:"1px solid #eee"}}),e.createElement("span",{className:"yt-personalized-form-field-preview-name",style:{fontSize:"12px",color:"#28a745",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},i.name))),e.createElement("div",{className:"yt-personalized-form-field-actions",style:{flexShrink:0}},s&&e.createElement("button",{type:"button",className:"yt-personalized-form-retry-button",onClick:a,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Retry"),c&&!l&&!s&&e.createElement("button",{type:"button",className:"yt-personalized-form-remove-button",onClick:o,style:{fontSize:"13px",fontWeight:600,color:"#fff",background:"#dc3545",border:"none",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Remove"),!i&&!l&&e.createElement("button",{type:"button",className:"yt-personalized-form-upload-button",onClick:r,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Upload Image")))},Ym=({form:r,formData:a,setFormData:i,barHeight:l=0,isUploading:s,setIsUploading:c})=>{const d=o(new Map),[p,m]=t(!1),u=c??m;n(()=>()=>{d.current.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),d.current.clear()},[]);const g=e=>{if(!d.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.multiple=!1,t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");i(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),u(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw alert("Upload failed. Try again."),e}finally{u(!1)}})(n);i(r=>({...r,[e]:{url:t,name:n.name}}))}catch{i(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),d.current.set(e,t)}return d.current.get(e)};return e.createElement("div",{className:"yt-personalized-form",style:{width:"100%",padding:"8px 0",marginBottom:`${l}px`,boxSizing:"border-box"}},r.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-personalized-form-section",style:{marginBottom:"28px"}},e.createElement("label",{className:"yt-personalized-form-section-title",style:{display:"block",fontWeight:700,marginBottom:"10px",color:"#1a1a1a",fontSize:"15px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-personalized-form-text-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement("textarea",{key:r,className:"yt-personalized-form-textarea",placeholder:t?.title,rows:3,maxLength:500,value:a[r]||"",onChange:e=>i(t=>({...t,[r]:e.target.value})),style:{width:"100%",padding:"8px 0",border:"none",borderBottom:"1.5px solid #ddd",borderRadius:0,fontSize:"14px",color:"#1a1a1a",background:"transparent",resize:"none",outline:"none",lineHeight:"1.5",boxSizing:"border-box"}})})),"image"===t.type&&e.createElement("div",{className:"yt-personalized-form-image-section"},e.createElement("div",{className:"yt-personalized-form-image-hint",style:{fontSize:"12px",color:"#888",marginBottom:"10px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),e.createElement("div",{className:"yt-personalized-form-image-fields",style:{display:"flex",flexDirection:"column",gap:"10px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement(Um,{key:r,title:t?.title,uploadState:a[r],onUpload:()=>g(r).click(),onRemove:()=>i(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>g(r).click()})}))))))},Qm={position:"absolute",width:72,height:72,border:"4px solid #333366",background:"#fff",boxSizing:"border-box"},Gm={...Qm},Zm="6s",Xm=({isOpen:t,message:n="Preparing Bundle..."})=>{if(!t)return null;const r=e.createElement(e.Fragment,null,e.createElement("style",null,"\n@keyframes ytBundleLoaderFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes ytBundleLoaderFloat {\n 0%, 100% { transform: translateY(0); }\n 50% { transform: translateY(-10px); }\n}\n\n/*\n * Flaps start OPEN, stay open while items fall, then close, pause, reopen.\n * 0-60%: open (180deg) — items fall in\n * 60-78%: closing\n * 78-88%: closed pause\n * 88-100%: reopening\n */\n@keyframes ytBundleLoaderOpenNorth {\n 0% { transform: rotateX(180deg); }\n 60% { transform: rotateX(180deg); }\n 78% { transform: rotateX(0deg); }\n 88% { transform: rotateX(0deg); }\n 100% { transform: rotateX(180deg); }\n}\n@keyframes ytBundleLoaderOpenSouth {\n 0% { transform: rotateX(-180deg); }\n 60% { transform: rotateX(-180deg); }\n 78% { transform: rotateX(0deg); }\n 88% { transform: rotateX(0deg); }\n 100% { transform: rotateX(-180deg); }\n}\n@keyframes ytBundleLoaderOpenEast {\n 0% { transform: rotateY(180deg); }\n 60% { transform: rotateY(180deg); }\n 78% { transform: rotateY(0deg); }\n 88% { transform: rotateY(0deg); }\n 100% { transform: rotateY(180deg); }\n}\n@keyframes ytBundleLoaderOpenWest {\n 0% { transform: rotateY(-180deg); }\n 60% { transform: rotateY(-180deg); }\n 78% { transform: rotateY(0deg); }\n 88% { transform: rotateY(0deg); }\n 100% { transform: rotateY(-180deg); }\n}\n\n/* Item 1: falls into top box opening and disappears behind front wall */\n@keyframes ytBundleLoaderItemFall1 {\n 0%, 5% {\n transform: translate3d(-50%, -90px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.5);\n opacity: 0;\n }\n 10% {\n transform: translate3d(-50%, -65px, 0px) rotateY(-50deg) rotateX(45deg) scale(1);\n opacity: 1;\n }\n 22% {\n transform: translate3d(-50%, -5px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.85);\n opacity: 1;\n }\n 27% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n}\n\n/* Item 2: falls 20-41% */\n@keyframes ytBundleLoaderItemFall2 {\n 0%, 19% {\n transform: translate3d(-50%, -90px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.5);\n opacity: 0;\n }\n 24% {\n transform: translate3d(-50%, -65px, 0px) rotateY(-50deg) rotateX(45deg) scale(1);\n opacity: 1;\n }\n 36% {\n transform: translate3d(-50%, -5px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.85);\n opacity: 1;\n }\n 41% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n}\n\n/* Item 3: falls 34-55% */\n@keyframes ytBundleLoaderItemFall3 {\n 0%, 33% {\n transform: translate3d(-50%, -90px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.5);\n opacity: 0;\n }\n 38% {\n transform: translate3d(-50%, -65px, 0px) rotateY(-50deg) rotateX(45deg) scale(1);\n opacity: 1;\n }\n 50% {\n transform: translate3d(-50%, -5px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.85);\n opacity: 1;\n }\n 55% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: translate3d(-50%, 25px, 0px) rotateY(-50deg) rotateX(45deg) scale(0.6);\n opacity: 0;\n }\n}\n"),e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",backgroundColor:"rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",zIndex:2147483644,animation:"ytBundleLoaderFadeIn 0.4s ease-out"}},e.createElement("p",{style:{fontFamily:"inherit",fontSize:15,fontWeight:600,color:"#fff",margin:"0 0 48px",letterSpacing:"0.04em",textShadow:"0 1px 8px rgba(0,0,0,0.3)",lineHeight:"normal"}},n),e.createElement("div",{style:{position:"relative",width:140,height:140,display:"flex",justifyContent:"center",alignItems:"center",perspective:600}},e.createElement("div",{style:{animation:`ytBundleLoaderFloat ${Zm} ease-in-out infinite`,transformStyle:"preserve-3d"}},e.createElement("div",{style:{position:"relative",width:72,height:72,transformStyle:"preserve-3d",transform:"rotateX(-45deg) rotateY(50deg) rotateZ(0deg)"}},e.createElement("div",{style:{...Gm,transform:"rotateY(180deg) translateZ(36px)",background:"#f1f5f9"}}),e.createElement("div",{style:{...Gm,transform:"rotateY(-90deg) translateZ(36px)",background:"#f8fafc"}}),e.createElement("div",{style:{...Gm,transform:"rotateY(90deg) translateZ(36px)",background:"#f8fafc"}}),e.createElement("div",{style:{...Gm,transform:"rotateX(-90deg) translateZ(36px)",background:"#e2e8f0"}}),e.createElement("div",{style:{position:"absolute",top:0,left:"50%",width:24,height:24,animation:`ytBundleLoaderItemFall1 ${Zm} cubic-bezier(0.25, 1, 0.5, 1) infinite`,pointerEvents:"none"}},e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e.createElement("path",{d:"M6 2L3 6v14a2 2 0 002 2h14a2 2 0 002-2V6l-3-4H6z",stroke:"#f5a623",strokeWidth:"2",fill:"#fef3c7"}),e.createElement("path",{d:"M3 6h18",stroke:"#f5a623",strokeWidth:"2"}),e.createElement("path",{d:"M16 10a4 4 0 01-8 0",stroke:"#f5a623",strokeWidth:"2",fill:"none"}))),e.createElement("div",{style:{position:"absolute",top:0,left:"50%",width:22,height:22,animation:`ytBundleLoaderItemFall2 ${Zm} cubic-bezier(0.25, 1, 0.5, 1) infinite`,pointerEvents:"none"}},e.createElement("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none"},e.createElement("path",{d:"M16 3h4l2 4-4 2v13H6V9L2 7l2-4h4",stroke:"#4a90d9",strokeWidth:"2",fill:"#dbeafe"}),e.createElement("path",{d:"M8 3a4 4 0 008 0",stroke:"#4a90d9",strokeWidth:"2",fill:"none"}))),e.createElement("div",{style:{position:"absolute",top:0,left:"50%",width:22,height:22,animation:`ytBundleLoaderItemFall3 ${Zm} cubic-bezier(0.25, 1, 0.5, 1) infinite`,pointerEvents:"none"}},e.createElement("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none"},e.createElement("rect",{x:"3",y:"8",width:"18",height:"14",rx:"1",stroke:"#7ed321",strokeWidth:"2",fill:"#dcfce7"}),e.createElement("rect",{x:"1",y:"8",width:"22",height:"5",rx:"1",stroke:"#7ed321",strokeWidth:"2",fill:"#bbf7d0"}),e.createElement("path",{d:"M12 8V22",stroke:"#7ed321",strokeWidth:"2"}),e.createElement("path",{d:"M12 8c-2-4-6-4-6-1s4 1 6 1",stroke:"#7ed321",strokeWidth:"2",fill:"none"}),e.createElement("path",{d:"M12 8c2-4 6-4 6-1s-4 1-6 1",stroke:"#7ed321",strokeWidth:"2",fill:"none"}))),e.createElement("div",{style:{...Gm,transform:"translateZ(36px)"}}),e.createElement("div",{style:{position:"absolute",top:0,left:0,width:72,height:72,transform:"rotateX(90deg) translateZ(36px)",transformStyle:"preserve-3d"}},e.createElement("div",{style:{...Qm,top:0,left:0,width:"100%",height:"50%",transformOrigin:"top center",animation:`ytBundleLoaderOpenNorth ${Zm} ease-in-out infinite`}}),e.createElement("div",{style:{...Qm,bottom:0,left:0,width:"100%",height:"50%",transformOrigin:"bottom center",animation:`ytBundleLoaderOpenSouth ${Zm} ease-in-out infinite`}}),e.createElement("div",{style:{...Qm,top:0,right:0,width:"50%",height:"100%",transformOrigin:"right center",animation:`ytBundleLoaderOpenEast ${Zm} ease-in-out infinite`}}),e.createElement("div",{style:{...Qm,top:0,left:0,width:"50%",height:"100%",transformOrigin:"left center",animation:`ytBundleLoaderOpenWest ${Zm} ease-in-out infinite`}})))))));return V.createPortal(r,document.body)};function Km({quantity:t,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:s,selectedVariantInventoryQty:c}){const d={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=t<c;return e.createElement(Cp,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const r=Math.max(0,t-1);n?.(r),l&&a&&l(a,1)},style:d,"data-gokwik-processed":"true"},"-"),e.createElement(Ep,{className:"yt-byob-quantity-display","data-gokwik-processed":"true"},t," ",e.createElement("span",{className:"yt-byob-quantity-added-text",style:{paddingLeft:"4px"}}," ","added")),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(r,t+1,c);n?.(l),o&&a&&i&&o(a,i,1)},disabled:!p||s,style:{...d,cursor:!p||s?"not-allowed":"pointer",opacity:!p||s?.6:1},"data-gokwik-processed":"true"},"+"))}!function(){if("undefined"==typeof window||window.__yt_dom_safeguarded)return;window.__yt_dom_safeguarded=!0;const e=Node.prototype,t=e.insertBefore;e.insertBefore=function(e,n){return n&&n.parentNode!==this?n.parentNode?n.parentNode.insertBefore(e,n):this.appendChild(e):t.call(this,e,n)};const n=e.removeChild;e.removeChild=function(e){return e&&e.parentNode!==this?e.parentNode?e.parentNode.removeChild(e):e:n.call(this,e)}}();const Jm=({product:o,styles:a,selectedVariant:i})=>{const[l,s]=t(!1),c=r(()=>Qf(i?.image?.url||o?.featuredMedia?.preview?.image?.url||o?.media?.edges?.[0]?.node?.image?.url)||"",[i?.image?.url,o?.featuredMedia?.preview?.image?.url,o?.media?.edges]),d=r(()=>o?.media?.edges?.map(e=>Qf(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[o?.media?.edges]),p=r(()=>d?.[1]??c??"",[d,c]);n(()=>{if(c){(new Image).src=c}},[c]);const m=r(()=>c||d?.[0],[c,d]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:a.general.imageAspectRatio||"1/1"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1)},e.createElement("div",{className:"yt-byob-image-inner-container",style:{width:"100%",height:"100%",position:"relative"}},e.createElement("img",{className:"yt-byob-image-main",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:l&&m!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:m,alt:o.title}),m!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:o.title})))},eu=e=>{const t=e?.productDetails;if(!t)return!1;if("undefined"!=typeof window&&"clayco-com.myshopify.com"===window?.Shopify?.shop&&""===t.onlineStoreUrl)return!1;const n=t.status?.toLowerCase(),r="active"===n||"unlisted"===n||void 0===t.status||""===t.status,o="estailofashion.myshopify.com"!==window?.Shopify?.shop||null!==t.publishedAt;return r&&o},tu=({product:r,bundle:o,handleAddToBundle:i,hideAddToBundle:l,remainingQuantity:s,themeColor:c,handleRemoveItem:d,transitionActive:p,idx:m,selecteditems:u,customVariantsQuantity:g,currentProductTier:f,showFreebieTierProductPrices:y,tierIndex:x})=>{const h=ve(ym),b=o.customizations,w=b?.byob?.variantSelectorType,[v,C]=t(!1),E=b.general?.variantTitleSuffix?r?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const r=t[e];let o=0;for(;o<n.length&&o<r.length&&n[n.length-1-o]===r[r.length-1-o];)o++;n=n.slice(n.length-o)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),r=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:r,commonSuffix:n.join(" ")}}})})(r?.variants?.edges);if(!E||!E.length)return e.createElement(e.Fragment,null);const k=a(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;const n=E?.find(t=>t.node.id===e),a=n?.node;return a?r.tracksInventory&&a.inventoryItem?.tracked?a.inventoryQuantity>0?o?.customProductsQuantity??a.inventoryQuantity:a.inventoryQuantity<=0&&"continue"===a.inventoryPolicy?.toLowerCase()?o?.customProductsQuantity??1/0:0:o?.customProductsQuantity??1/0:0},[E,g,r.tracksInventory]),T=E?.filter(e=>!1!==b.general.showOutOfStockVariants||k(e.node.id)>0);if(!T||!T.length)return e.createElement(e.Fragment,null);const S=T?.find(e=>k(e.node.id)>0)?.node?.id;if(!S&&!b.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[N,I]=t(T?.find(e=>k(e.node.id)>0)?.node?.id||T[0]?.node?.id),[F,z]=t(window.innerWidth<450),[B,$]=t("normal"),A=T?.find(e=>e?.node?.id===N)?.node,D=k(N||""),P=u?.find(e=>e.variantId===N&&(void 0===x||e.tierIndex===x)),_=P?P.quantity:0;n(()=>{const e=()=>{z(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?$("500"):CSS.supports("font-weight","400")?$("400"):CSS.supports("font-weight","600")&&$("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",B)},[B]),n(()=>{if(N&&!T?.some(e=>e.node.id===N)){const e=T.find(e=>k(e.node.id)>0)?.node.id||T[0]?.node?.id;e&&I(e)}},[N,T,k]);const L=b?.byob?.productClickAction??(b?.general?.redirectToPDP?"redirect-pdp":"details-modal"),R=T.length>1,O=R&&"customOptions"!==w,M="75851235630"===("undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0),V=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(r),W=V.length>0;return e.createElement(e.Fragment,null,e.createElement(Sp,{borderRadius:b?.byob.borderRadius,borderColor:b?.byob.borderColor,shadowType:b?.byob.shadowType,backgroundColor:b?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":m%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if("details-modal"!==L)return;if(D<=0)return;const e={...r,variants:{...r.variants,edges:T},selectedVariant:A};h(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:b?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Np,{className:"yt-byob-image-wrapper",onClick:e=>{if("redirect-pdp"===L&&r?.handle){e.stopPropagation();const t=window?.Shopify?.routes?.root||"/";window.location.href=`${t}products/${r.handle}`}},style:{cursor:"none"===L?"default":"pointer"}},e.createElement(Jm,{product:r,styles:b,selectedVariant:A}),o?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:b?.general.primaryColor||"#111",color:b?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:b.byob.borderRadius}},o.productCardBadgeText),O&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Im,{className:"yt-byob-variant-selector",ariaLabel:"Select variant",value:N||"",onChange:I,options:T.map(e=>({value:e.node.id,label:e.node.title,className:0===k(e.node.id)?"variant-out-of-stock":void 0})),style:{position:"absolute",width:"98%",height:"38px",bottom:"4px",right:"3px",border:"1px solid #c7c7c7",padding:"8px 10px",backgroundColor:"#f5f5f5",fontSize:"14px",opacity:.8,boxSizing:"border-box",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"normal"},menuStyle:{fontSize:"14px"}},T.find(e=>e.node.id===N)?.node?.title??""))),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start"},className:"yt-byob-product-details-wrapper"},e.createElement("div",{className:"yt-byob-product-content"},"enabled"===o?.customizations?.byob?.productCardCategoryVisibility&&W&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px",justifyContent:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start"}},V.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:F?"10px":"14px",color:"#666",fontWeight:"500",paddingBottom:"4px"}},t.charAt(0).toUpperCase()+t.slice(1))),V.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",V.length-2," more"))),e.createElement(Ip,{isMobile:F,showBorder:o?.showBorder??!0,style:{...!b?.byob.productsPriceVisibility&&{padding:"8px"},...b?.byob.productTitleFontSize&&{fontSize:b?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:b?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(A?.displayName).replace("- Default Title",""):r.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&(b?.byob?.showVariantTitleInCard||!R)&&e.createElement("p",{style:{padding:o?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},A?.title),"ratingOnly"===(b?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===(b?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"center"===b?.byob?.productCardDetailsAlignment?"center":"right"===b?.byob?.productCardDetailsAlignment?"flex-end":"flex-start",fontSize:"14px",color:"#333"}},e.createElement(qe,{color:"gold",size:14})," ",r?.rating?.averageRating,e.createElement(Le,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),b?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:o?.showBorder?"0px 10px":"0 4px"}},f?.isFreebieTier&&!y?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Yf(b.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",Uf(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:b.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},Yf(b.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",Uf(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!f?.isFreebieTier||y)&&A?.compareAtPrice&&b?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Yf(b.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",Uf(A.compareAtPrice)))),(D>0||D===1/0)&&e.createElement(Fp,{borderRadius:b?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===_||void 0===_)&&e.createElement(kp,{key:"add-to-bundle-btn",style:{...!l&&{backgroundColor:b?.general.primaryColor||"#111",color:b?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),(()=>{if(!N)return;"customOptions"===w&&T.length>1?C(!0):i(N,r,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button","data-gokwik-processed":"true"},b?.byob.addToBundleCTAText),!o?.disableQuantitySelector&&_>0&&N&&e.createElement(Tp,{key:"quantity-selector-container",className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Km,{remainingQuantity:s,quantity:_,handleAddToBundle:i,variantId:N,product:r,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:D})),o?.disableQuantitySelector&&_>0&&N&&e.createElement(kp,{key:"single-qty-added-btn",style:{backgroundColor:"#747474",color:b?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector","data-gokwik-processed":"true"},e.createElement(zp,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Bp,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation(),d&&N&&d(N,x)},"data-gokwik-processed":"true"},e.createElement(nt,{style:{color:"#fff",fontSize:"20px"}})))),D<=0&&D!==1/0&&e.createElement(kp,{style:{backgroundColor:b.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled","data-gokwik-processed":"true"},b?.general.outOfStockLabel||"Out of Stock")),"customOptions"===w&&v&&T.length>1&&e.createElement(Cm,{product:r,isOpen:v,onClose:()=>C(!1),variantOptions:o.variantOptions,cta:{textColor:b?.general?.ctaTextColor||"#fff",backgroundColor:b?.general?.ctaBackgroundColor||"#000"},onConfirm:e=>{I(e),i(e,r,1)},showOutOfStockVariants:!1!==b.general.showOutOfStockVariants}))},nu=({currentStep:t,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:s="#fff",tierNavigation:c})=>e.createElement("div",{className:"yt-byob-stepper-container",style:{textAlign:"center",fontSize:"20px"}},e.createElement("div",{className:"yt-byob-stepper-steps",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:r}).map((s,d)=>{const p=d+1,m=!o[d].isFormStep&&o[d].minimumQuantity-(i[d]?.length??0)===0,u=d===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===c?()=>{}:n(p-1)},e.createElement("div",{className:"yt-byob-stepper-step-number",style:{fontSize:"14px"}},"Step ",p),e.createElement("div",{className:"yt-byob-stepper-step-bar",style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-stepper-step-left-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?"white":m?`${l}50`:"white",border:`2px solid ${u?"#666666":m?l:"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:a?"16px 0px":"15px 0px",fontSize:a?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},o[t]?.title)),ru=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...r].map(r=>{const a=o===r;return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(t.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px",maxWidth:"100%"}},e.createElement("div",{className:"yt-byob-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...r].map(r=>e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:o===r?t?.general.primaryColor:"white",color:o===r?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{o!==r&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1)))))},ou=({bundle:i,selectedItems:l,setSelectedItems:s,handleAddToCart:c,bundleAddToCartLoading:d,renderingOnPage:p,selectedItemsQuantity:m,handleRemoveItem:u,bundleSubtotal:g,dispatchAnalyticsEvent:f,fetchStoreDetails:y,productsPagination:x,categoryFilters:h})=>{const[b,w]=t(void 0),[v,C]=t(window.innerWidth<450),[E,k]=t(0),[T,S]=t({}),N=!!i.personalizedForm?.title&&"productTier"===i.builderTiers?.type,[I,F]=t({}),[z,B]=t(!1),$=N&&E===(i.builderTiers?.productTier?.length||0),A=E===(i.builderTiers?.productTier?.length||0)-1,D=N&&A&&!$,[P,_]=t(i?.products),[L,R]=t(!1),[O,M]=t({}),[V,W]=t(20),j=o(null),[H,q]=t(i?.products),[U,Y]=t({}),[Q,G]=t(x?.cursorData),Z=i.builderTiers?.type,X=i.customizations,K=i.builderTiers?.productTier??[],J=i.builderTiers?.offerTier??[],[ee,te]=t("All"),ne=o(null),re=o(!0);n(()=>(re.current=!0,()=>{re.current=!1}),[]);const[oe,ae]=t({}),ie=o(void 0),le=o({appliedFilters:oe,currentProductTier:E,tierType:Z}),[se,ce]=t([]),[de,pe]=t(!1),[me,ue]=t(0),[ge,fe]=t(0),[ye,xe]=t({}),he=e=>{xe(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{se.length>0&&xe(e=>{const t={...e};return se.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[se]),n(()=>{!(Object.values(oe).length>0)&&x?.cursorData&&G(x.cursorData)},[oe,x?.cursorData]);const be=i.customStoreDetails?.fixedInventoryDetails;n(()=>{X?.byob?.productFiltersDisplay&&"none"!==X?.byob?.productFiltersDisplay&&(async()=>{const e=X?.byob?.productFiltersDisplay??"none";if("drawer"===e||"sidebar"===e)try{const e=await(y?.());e?.productFilters&&ce(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[X?.byob,y]);const we=r(()=>{if(!h)return;const e=K[E]?.tier,t="productTier"===Z?e:1,n="object"!=typeof h||Array.isArray(h)||h.id?h:h[t];if(!n)return;const r=Array.isArray(n)?n.find(e=>"filter.p.m.categories"===e.id||"categories"===e.label):n;return r&&r.values?{...r,values:[...r.values].sort((e,t)=>e.label.localeCompare(t.label,void 0,{sensitivity:"base",numeric:!0}))}:void 0},[h,E,K]),ve=r(()=>{const e=(we?.values?.map(e=>e.label)??[])?.filter(e=>"All"!==e),t=i?.selectedCategories??[];if(0===t.length)return e;const n=new Set(t.map(e=>e.trim()));return e.filter(e=>n.has(e.trim()))},[we,i?.selectedCategories]),Ee=ve.length>0;n(()=>{ae({})},[E,ee]);const ke=((e,t)=>"All"===t?e:e.filter(e=>{const n=e?.productDetails;if(n.metafield&&"yourtoken_bundles_app"===n.metafield.namespace&&"categories"===n.metafield.key){let e=[];if(n.metafield.jsonValue&&Array.isArray(n.metafield.jsonValue))e=n.metafield.jsonValue;else if(n.metafield.value)try{const t=JSON.parse(n.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}return e.includes(t)}return!1}))(P.filter(eu),ee),Te="productTier"===Z?K.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===Z?J.reduce((e,t)=>e+t.minimumQuantity,0):i.minimumQuantity,Se=a((e,t)=>{const n=be?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const r=(e.variants?.edges||[]).find(e=>e.node.id===t),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[be]),[Ne,Fe]=t(3e3);n(()=>{const e=se?.find(e=>"PRICE_RANGE"===e.type||"filter.v.price"===e.id);e&&e.values?.[0]?.input?.price?.max&&Fe(e.values[0].input.price.max)},[P,se]);const[ze,Be]=t(""),[$e,Ae]=t(""),De=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(ke,ze),Pe=((e,t)=>[...e].sort((e,n)=>{const r=e?.productDetails?.title?.toLowerCase(),o=n?.productDetails?.title?.toLowerCase(),a=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),i=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return r.localeCompare(o);case"title-desc":return o.localeCompare(r);case"price-low-to-high":return a-i;case"price-high-to-low":return i-a;default:return 0}}))(De,$e);n(()=>{(async e=>{if(!x)return;const{initialCursorData:t,cursorData:n,fetchFn:r,setCursorData:o}=x,a="productTier"===Z?K?.[E]?.tier:1;if(0===Object.values(e)?.length)return void("productTier"===Z?(M(e=>({...e,[E]:U?.[E]||[]})),o(Q||{...n})):(_(H),o(Q||{1:t?.[1]})));const i=await r(e,a,null);re.current&&i&&("productTier"===Z?(M(e=>({...e,[E]:i})),_(e=>{const t=new Set(e.map(e=>e.productId)),n=i.filter(e=>!t.has(e.productId));return[...e,...n]})):_(i))})(oe)},[oe]);const[_e,Le]=Ce(ym),[Re,Oe]=t(!1);n(()=>{f?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:i?._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder"}}),setTimeout(()=>{Oe(!0)},100)},[]);const Me=o(null);n(()=>{const e=()=>{C(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(i.coverImageUrl){const e=new Image;e.src=Qf(i.coverImageUrl)??"",e.onload=()=>{w(e.width/e.height)}}},[i.coverImageUrl]),n(()=>{Oe(!1),setTimeout(()=>Oe(!0),100)},[E]);const Ve=(e,t)=>{if("productTier"===Z){let n={...T},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=K.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}S(n);const o=K.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==o&&k(o)}u(e,t)},We=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if(i){if("productTier"!==i?.builderTiers?.type)return _(i?.products??[]),void q(i?.products??[]);if(i?.workWithoutPagination){if("productTier"===i?.builderTiers?.type){const e={};i.builderTiers.productTier?.forEach((t,n)=>{const r=t.products.map(e=>{const t=i?.products?.find(t=>t.productId===e.productId);return t?{...t,variantIds:e.variantIds?.length?e.variantIds:t.variantIds}:null}).filter(Boolean);e[n]=r}),M(e),Y(e)}}else"productTier"===i?.builderTiers?.type&&(M({0:i?.products}),Y({0:i?.products}))}},[i]),n(()=>{if("productTier"!==Z||!K[E])return;if(Te===m)return;const e=K.findIndex((e,t)=>{const n=T[t]||[];return t>=E&&n.length<e.minimumQuantity});if(-1!==e&&e!==E){k(e);const t=K[E];t?.products?.length>1&&We()}else if(-1===e&&N&&E<K.length){K.every((e,t)=>(T[t]?.length||0)>=e.minimumQuantity)&&k(K.length)}},[T,K,Z,N]),n(()=>{Be(""),te("All")},[E]),n(()=>{function e(e){if(!Me.current||!e.target)return;!Me.current.contains(e.target)&&Le(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const je=(e,t,n)=>{var r;"productTier"===Z&&(r=e,S(e=>{const t={...e},n=K.findIndex((e,n)=>{const r=t[n]||[];return n>=E&&r.length<e.minimumQuantity}),o=-1!==n?n:E;return-1!==n&&k(n),t[o]||(t[o]=[]),t[o].push(r),t}));const o=!0===K[E]?.isFreebieTier;f?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),Gf(e,t,n,l,s,o,E)},He=(()=>{if(!i?.builderTiers)return i.minimumQuantity;const{type:e,offerTier:t,productTier:n}=i.builderTiers,r="offerTier"===e?t:"productTier"===e?n:null;if(!r)return i.minimumQuantity;let o=0;return r.map(e=>{o+=e.minimumQuantity}),o})(),qe=v&&i.mobileCoverImageUrl?Qf(i.mobileCoverImageUrl):Qf(i.coverImageUrl??"")||null,Ue=a(e=>{if("undefined"!=typeof window&&"clayco-com.myshopify.com"===window?.Shopify?.shop&&""===e?.productDetails?.onlineStoreUrl)return!1;const t=X?.general?.showOutOfStockProducts;if(t)return!0;const n=e?.productDetails,r=n?.variants?.edges||[];if(be){if(r.some(e=>be.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return r.some(e=>Se(n,e.node.id)>0)},[X?.general?.showOutOfStockProducts,be,Se]),Ye=r(()=>{if("productTier"===Z&&K.length>0){const e=O?.[E]??[];return $e?Pe.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Ue(t)):e.map(e=>Pe.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Ue(e))}return Pe.filter(Ue)},[Z,K,O,E,Pe,Ue,$e]),Qe=Ye;n(()=>{if("productTier"!==Z)return;const e=K[E];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;if(1!==O?.[E]?.length)return;const t=e.products[0],n=P.find(e=>e.productId===t.productId),r=n?.productDetails;if(!r)return;if(!eu(n))return;if(!Ue(n))return;if(r.variants?.edges?.length>1)return;const o=r.variants?.edges?.find(e=>Se(r,e.node.id)>0)?.node;if(!o)return;const a=o.id,i=T[E]?.includes(a);if(!i&&(je(a,r,1),E<K.length-(N?0:1))){k(E+1);const e=K?.[E];e?.products?.length>1&&We()}},[Z,K,E,P,T,Se,Ue,je]);const Ge=r(()=>ke.filter(e=>{const t=e?.productDetails;return(t.variants?.edges||[]).some(e=>Se(t,e.node.id)>0)}).length,[ke,Se]),Ze=r(()=>ke.length-Ge,[ke,Ge]),Xe="bundles"==i.appName?i.pageHeader?.title:i?.title,Ke="bundles"==i.appName?i.pageHeader?.description:i?.subtitle,Je=Ee&&Boolean(X?.byob?.enableProductCategories),et=r(()=>{if(i?.workWithoutPagination)return!1;if(!Je)return!1;if(!x)return!1;const e="productTier"===Z?K[E]?.tier:1;if(void 0===e)return!1;const t=x.cursorData?.[e];return t?t.hasNext:L},[i?.workWithoutPagination,Je,x,Z,K,E,L]);n(()=>{if(i?.workWithoutPagination)return;if(Je)return;if(!x)return;const{cursorData:e,fetchFn:t}=x,n=K[E]?.tier,r="productTier"===Z?n:1;if(e?.[r]&&!e?.[r]?.hasNext||!t)return;const o=le.current;o.currentProductTier===E&&o.tierType===Z||(ie.current=void 0,le.current={...o,currentProductTier:E,tierType:Z});const a=new IntersectionObserver(async([n])=>{if(!n.isIntersecting)return;if(L)return;const o=e?.[r]?.cursor||null;if(ie.current!==o){ie.current=o,R(!0);try{const n=await t(oe,r,e?.[r]?.cursor);if(!re.current)return;if(n?.length>0){const e=Object.values(oe).length>0;"productTier"===Z?(M(e=>({...e,[E]:[...e[E]||[],...n]})),e||Y(e=>({...e,[E]:[...e[E]||[],...n]})),_(e=>[...e,...n])):(_(e=>[...e,...n]),e||q(e=>[...e,...n]))}}catch(e){console.error("Pagination fetch failed:",e),ie.current=void 0}finally{re.current&&R(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),l=ne.current;return l&&a.observe(l),()=>{l&&a.unobserve(l)}},[i?.workWithoutPagination,Je,x,L,Z,E,K,oe]),n(()=>{if(i?.workWithoutPagination)return;if(!Je)return;if(!x)return;const{cursorData:e,fetchFn:t}=x,n=K[E]?.tier,r="productTier"===Z?n:1;if(!t)return;const o=le.current;(o.currentProductTier!==E||o.tierType!==Z||JSON.stringify(o.appliedFilters)!==JSON.stringify(oe))&&(ie.current=void 0,le.current={appliedFilters:oe,currentProductTier:E,tierType:Z});if(!(!e?.[r]||e[r].hasNext))return void R(!1);if(L)return;(async()=>{const n=e?.[r]?.cursor||null;if(ie.current!==n){ie.current=n,R(!0);try{const e=await t(oe,r,n);if(!re.current)return;if(e?.length>0){const t=Object.values(oe).length>0;"productTier"===Z?(M(t=>({...t,[E]:[...t[E]||[],...e]})),t||Y(t=>({...t,[E]:[...t[E]||[],...e]})),_(t=>[...t,...e])):(_(t=>[...t,...e]),t||q(t=>[...t,...e]))}}catch(e){console.error("Fetch all products pagination error:",e),ie.current=void 0}finally{re.current&&R(!1)}}})()},[i?.workWithoutPagination,Je,x,E,oe,Z,L,K]),n(()=>{if(!Je&&!i?.workWithoutPagination)return;if(et)return;if(!j.current)return;const e=new IntersectionObserver(([e])=>{e.isIntersecting&&V<Ye.length&&W(e=>Math.min(e+20,Ye.length))},{rootMargin:"200px"});return e.observe(j.current),()=>e.disconnect()},[Je,et,V,Ye.length]),n(()=>{W(20)},[E,Ye.length,Je,i?.workWithoutPagination]);const tt=()=>{f?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-builder-section",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:"15px",marginBottom:"20px",backgroundColor:X.byob.sectionBackgroundColor,padding:"transparent"!==X.fixedBundle.sectionBackgroundColor?"20px":"4px"}},qe?e.createElement("div",{className:"yt-byob-cover-image-container",style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...i?.coverImageVerticalMargin&&{marginBottom:i?.coverImageVerticalMargin,marginTop:i?.coverImageVerticalMargin}}},qe&&e.createElement(Om,{coverImageUrl:qe,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{className:"yt-byob-cover-image-overlay",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:X?.byob?.titleFontSize??"3rem",fontWeight:"700",color:X?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:X?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},Xe),e.createElement("span",{style:{lineHeight:"normal",fontSize:X?.byob?.subtitleFontSize??"1.5rem",color:X?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Ke))):(Xe||Ke)&&e.createElement("div",{className:"yt-byob-header-content",style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},Xe&&e.createElement("span",{className:"bundle-builder-title",style:{lineHeight:"normal",fontSize:X?.byob?.titleFontSize??"3rem",fontWeight:"700",color:X?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:X?.byob?.titleBackgroundColor??"transparent"}},Xe),Ke&&e.createElement("span",{className:"bundle-builder-subtitle",style:{lineHeight:"normal",fontSize:X?.byob?.subtitleFontSize??"1.5rem",color:X?.byob?.titleTextColor??"#000"}},Ke)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===Z&&K.length>0&&X?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-stepper-wrapper"},e.createElement(nu,{currentStep:E,totalSteps:K.length+(N?1:0),tiers:N?[...K,{title:i.personalizedForm?.title||"Personalize",tier:K.length,minimumQuantity:0,products:[],isFormStep:!0}]:K,isMobile:v,primaryColor:X?.general?.primaryColor,primaryTextColorCta:X?.general?.primaryContrastColor,setCurrentProductTier:k,selectedProductsByTier:T,tierNavigation:X.byob.tierNavigation})))),e.createElement("div",{className:"yt-byob-layout-wrapper",style:{display:"flex",flexDirection:"row",width:v?"100%":"90%",marginInline:"auto"}},"sidebar"===X?.byob?.productFiltersDisplay&&!v&&!$&&e.createElement(jm,{showFiltersDrawer:de,handleClose:()=>pe(!1),isAnimating:!1,isMobile:!1,availableFilters:se,appliedFilters:oe,toggleFilter:(e,t)=>{ae(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{ae({}),fe(0),ue(Ne)},applyPriceFilter:()=>{ae(e=>{const t={...e};return t["filter.v.price"]=[`min:${ge}-max:${me}`],t})},priceMin:ge,setPriceMin:fe,priceMax:me,setPriceMax:ue,maxPossiblePrice:Ne,styles:X,products:P,unavailableProductCount:Ze,storeCurrencyCode:i?.storeCurrencyCode,openSections:ye,toggleSection:he}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!$&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Hm,{enableSortAndFilter:i?.enableSortAndFilter??!1,isMobile:v,searchTerm:ze,setSearchTerm:Be,setSortBy:Ae,styles:X,appliedFilters:oe,setAppliedFilters:ae,availableFilters:se,products:P,availableProductCount:Ge,unavailableProductCount:Ze,maxPossiblePrice:Ne,storeCurrencyCode:i?.storeCurrencyCode,sharedFiltersState:{showFilters:de,setShowFilters:pe,priceMax:me,setPriceMax:ue,priceMin:ge,setPriceMin:fe},openSections:ye,toggleSection:he}),i?.customizations?.byob?.enableProductCategories&&Ee&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(ru,{styles:X,isMobile:v,categories:ve,activeCategory:ee,onCategoryChange:e=>{te(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:X?.byob?.listingsGap||"12px",justifyContent:de&&"sidebar"===X?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},$&&i.personalizedForm?.title?e.createElement(Ym,{form:i.personalizedForm,formData:I,setFormData:F,isUploading:z,setIsUploading:B}):0!==Qe?.length||L||et?(Je?Ye.slice(0,V):Ye).map((t,n)=>{if("productTier"===Z){const r=(K[E]?.minimumQuantity??0)>(T[E]?.length??0),o=Pe.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return o?e.createElement(tu,{bundle:i,idx:n,key:`tier-${E}-${t?.variantIds?.[0]??t.productId}-${n}`,product:o?.productDetails,handleAddToBundle:je,hideAddToBundle:!r,remainingQuantity:He-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>Ve(e,E),selecteditems:l,transitionActive:Re,customVariantsQuantity:be,currentProductTier:K[E],showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:E}):null}return e.createElement(tu,{bundle:i,idx:n,key:`card-${t.productId}-${n}`,product:t?.productDetails,handleAddToBundle:je,hideAddToBundle:m>=He,remainingQuantity:He-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>u(e),selecteditems:l,transitionActive:Re,customVariantsQuantity:be,tierIndex:E})}):e.createElement("div",{className:"yt-byob-empty-state",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",padding:"40px 20px",gap:"16px"}},e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",margin:0}},Object.values(oe).length>0?"No products match your filters":"No products found"),Object.values(oe).length>0&&e.createElement("button",{onClick:()=>{ae({}),fe(0),ue(Ne)},style:{padding:"8px 16px",background:X?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:X?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px"}},"Clear All Filters")),!$&&(L||et)&&e.createElement("div",{className:"yt-byob-loading-wrapper",style:{width:"100%",display:"flex",justifyContent:"center",padding:"20px"}},e.createElement(Ie,{color:X?.general?.primaryColor||"#333",size:30})),!Je&&!i?.workWithoutPagination&&e.createElement("div",{ref:ne,className:"yt-byob-pagination-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null)),(Je||i?.workWithoutPagination)&&!et&&e.createElement("div",{ref:j,className:"yt-byob-virtualFetchAll-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null))),!p&&e.createElement(fm,{builderTiers:i?.builderTiers,showNextStep:D,handleAddToCart:async e=>{if(D)return k(E+1),void We();const t={};N&&Object.entries(I).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await c(e,t),tt()},minimumQuantity:Te,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:Ve,selectedItemsQuantity:m,percentageOff:i.percentageOff,loading:d,bundleSubtotal:g,amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:i?.dealTextColor??"#333",primaryTextColorCta:i?.primaryTextColorCta??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:T,renderingOnPage:p,isUploading:z}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(fm,{showNextStep:D,handleAddToCart:async e=>{if(D)return k(E+1),void We();const t={};N&&Object.entries(I).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await c(e,t),tt()},minimumQuantity:Te,builderTiers:i?.builderTiers,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,loading:d,handleRemoveItem:u,handleRemoveItemProductTier:Ve,percentageOff:i.percentageOff,selectedItemsQuantity:m??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:X?.general.primaryColor||"#000",primaryTextColorCta:X.general.primaryContrastColor??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:T,renderingOnPage:p,isUploading:z})))),_e&&void 0!==m&&(()=>{let t=m<i.minimumQuantity;return"productTier"==Z?t=(K[E]?.minimumQuantity??0)>(T[E]?.length??0):"offerTier"==Z&&(t=m<J.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(Rm,{bundleType:"byob",bundle:i,handleAddToBundle:je,ref:Me,remainingQuantity:i.minimumQuantity-m,hideAddToBundle:!t,disableQuantitySelector:i?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:T,themeColor:X?.general.primaryColor||"#000",primaryTextColorCta:i?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:X?.general.primaryColor||"#000",cornerRadius:i?.customizations.byob.borderRadius,styles:i.customizations,customVariantsQuantity:be,bundleProductsCustomQuantity:i?.customProductsQuantity,isFreebieTier:K?.[E]?.isFreebieTier,showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:i?.variantOptions})})(),e.createElement(Xm,{isOpen:Boolean(d)&&"animated"===i?.customizations?.general?.atcLoaderType})))},au="\n@keyframes cartATCFadeIn {\n 0% {\n opacity: 0;\n transform: scale(0.96);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes cartATCSlideIn {\n 0% {\n transform: translateX(-150%);\n opacity: 0;\n }\n 20% {\n opacity: 1;\n }\n 100% {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@keyframes cartATCSlideOut {\n 0% {\n transform: translateX(0);\n opacity: 1;\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: translateX(150%);\n opacity: 0;\n }\n}\n\n@keyframes cartATCBounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(1.5px);\n }\n}\n\n@keyframes cartATCItemDrop1 {\n 0%, 5% {\n transform: translate3d(-50%, -22px, 0) scale(0.4);\n opacity: 0;\n }\n 20% {\n transform: translate3d(-50%, -10px, 0) scale(0.95);\n opacity: 1;\n }\n 55% {\n transform: translate3d(-50%, 3px, 0) scale(0.7);\n opacity: 1;\n }\n 75%, 100% {\n transform: translate3d(-50%, 7px, 0) scale(0.3);\n opacity: 0;\n }\n}\n\n@keyframes cartATCItemDrop2 {\n 0%, 30% {\n transform: translate3d(-50%, -22px, 0) scale(0.4);\n opacity: 0;\n }\n 45% {\n transform: translate3d(-50%, -10px, 0) scale(0.95);\n opacity: 1;\n }\n 80% {\n transform: translate3d(-50%, 3px, 0) scale(0.7);\n opacity: 1;\n }\n 95%, 100% {\n transform: translate3d(-50%, 7px, 0) scale(0.3);\n opacity: 0;\n }\n}\n",iu=({loading:r,color:a="currentColor",size:i=24,children:l,className:s="",style:c,onComplete:d})=>{const[p,m]=t(r?"entering":"idle"),u=o(null),g=o(null);if(n(()=>(r?(g.current&&clearTimeout(g.current),m("entering"),u.current=setTimeout(()=>{m("filling")},400)):(u.current&&clearTimeout(u.current),m(e=>"filling"===e||"entering"===e?(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{m("idle"),d?.()},450),"exiting"):"idle")),()=>{u.current&&clearTimeout(u.current),g.current&&clearTimeout(g.current)}),[r,d]),"idle"===p)return l?e.createElement("span",{className:s,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"100%",animation:"cartATCFadeIn 0.3s ease-out forwards",...c}},e.createElement("style",null,au),l):null;const f="entering"===p,y="exiting"===p,x={display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",overflow:"hidden",height:i+6,paddingLeft:8,paddingRight:8,verticalAlign:"middle",width:"100%",...c},h={display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",animation:f?"cartATCSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards":y?"cartATCSlideOut 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards":"cartATCBounce 1.2s ease-in-out infinite"};return e.createElement("span",{className:`yt-cart-atc-loader ${s}`,style:x},e.createElement("style",null,au),e.createElement("div",{style:h},e.createElement("svg",{width:i,height:Math.round(24*i/28),viewBox:"0 0 28 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M1 2h4l2.6 13.2a2 2 0 002 1.6h12.8a2 2 0 002-1.6L26 6H6.6",stroke:a,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("circle",{cx:"10.5",cy:"20.5",r:"1.8",fill:a}),e.createElement("circle",{cx:"21.5",cy:"20.5",r:"1.8",fill:a})),("filling"===p||"entering"===p||"exiting"===p)&&e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"absolute",top:1,left:"56%",width:9,height:9,animation:"cartATCItemDrop1 1.4s ease-in-out infinite",pointerEvents:"none"}},e.createElement("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none"},e.createElement("rect",{x:"1",y:"2",width:"8",height:"7",rx:"1",fill:"#f5a623",stroke:a,strokeWidth:"1"}),e.createElement("path",{d:"M5 2v7",stroke:a,strokeWidth:"1"}))),e.createElement("div",{style:{position:"absolute",top:1,left:"56%",width:9,height:9,animation:"cartATCItemDrop2 1.4s ease-in-out infinite",pointerEvents:"none"}},e.createElement("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none"},e.createElement("rect",{x:"1",y:"2",width:"8",height:"7",rx:"1",fill:"#4a90d9",stroke:a,strokeWidth:"1"}),e.createElement("path",{d:"M1 5h8",stroke:a,strokeWidth:"1"}))))))},lu=({isOpen:r,onClose:o,formConfig:a,onCheckout:i,cta:l,isMobile:s})=>{const[c,d]=t({}),[p,m]=t(!1);n(()=>{r||d({})},[r]);const u=e=>{if(p)return;const t={};Object.entries(c).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),i(e?{}:t)};if(!r)return null;const g=e.createElement("div",{className:"yt-personalized-form-modal-overlay",onClick:o,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:s?"flex-end":"center",justifyContent:"center"}},e.createElement("style",null,"\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n @keyframes fadeIn {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n "),e.createElement("div",{className:"yt-personalized-form-modal",onClick:e=>e.stopPropagation(),style:{background:"white",width:s?"100vw":"500px",maxWidth:s?"100vw":"560px",height:s?"80vh":"auto",maxHeight:s?"80vh":"90vh",borderRadius:s?"20px 20px 0 0":"20px",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:999,animation:s?"slideUp 0.3s ease-out":"fadeIn 0.2s ease-out"}},e.createElement("div",{className:"yt-personalized-form-modal-header",style:{width:"100%",padding:s?"20px 20px 16px":"18px 20px",fontWeight:700,fontSize:s?"18px":"16px",textAlign:"center",position:"relative",borderBottom:"1px solid #eee",flexShrink:0,backgroundColor:"#ffffff",color:"#1a1a1a",boxSizing:"border-box",lineHeight:"1.4"}},a.title||"Personalization",!s&&e.createElement("button",{className:"yt-personalized-form-modal-close",onClick:o,style:{position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",fontSize:"24px",lineHeight:1,cursor:"pointer",color:"#666",padding:"4px"}},"×")),e.createElement("div",{className:"yt-personalized-form-modal-body",style:{flex:1,overflowY:"auto",padding:s?"20px 20px":"16px 20px"}},e.createElement(Ym,{form:a,formData:c,setFormData:d,isUploading:p,setIsUploading:m})),e.createElement("div",{className:"yt-personalized-form-modal-footer",style:{padding:s?"12px 16px":"12px 24px 16px",borderTop:"1px solid #eee",flexShrink:0,background:"white",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"}},e.createElement("button",{"data-gokwik-processed":"true",className:"yt-personalized-form-submit-button",onClick:()=>{u(),o()},disabled:p,style:{width:"100%",fontSize:"15px",fontWeight:700,textAlign:"center",padding:"15px 0",border:"none",borderRadius:"10px",cursor:p?"not-allowed":"pointer",opacity:p?.7:1,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:l.backgroundColor,color:l.textColor,letterSpacing:"0.01em"}},p?e.createElement(Ie,{color:l.textColor,size:15}):"Submit"),e.createElement("button",{"data-gokwik-processed":"true",className:"yt-personalized-form-skip-button",onClick:()=>{u(!0),o()},style:{background:"none",border:"none",fontSize:"14px",fontWeight:600,color:"#1a1a1a",cursor:"pointer",padding:"4px 8px",textAlign:"center"}},"Add without customization"))));return V.createPortal(g,document.body)},su=({product:t,selectedVariantId:n,onVariantChange:o,styles:a,originalPrice:i,dealPrice:l,totalPriceSum:s,isVertical:c=!1,variantOptions:d,storeCurrencyCode:p,reviewRatingType:m,productIndex:u,setActiveModalIndex:g})=>{const f=ve(ym),y=a?.comboBundle?.productClickAction??"details-modal",x=r(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),r=n?.node;return r?t?.productDetails.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t?.productDetails]),h=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;x(n);const b=r(()=>(t?.productDetails?.variants?.edges??[]).filter(e=>!1!==a?.general?.showOutOfStockVariants||x(e?.node?.id)>0).map(e=>({value:e?.node?.id,label:e?.node?.title,disabled:0===x(e?.node?.id)})),[t?.productDetails?.variants?.edges,a?.general?.showOutOfStockVariants,x]),w=r(()=>{if(h?.title&&t?.productDetails.options){const e=h.title.split(" / ");if(e.length===t?.productDetails.options.length)return e}return t?.productDetails.options?.map(e=>e.values[0])||[]},[h,t?.productDetails.options]),v=t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)??[],C=v.length>1,E=1===v.length?h?.title??v[0].node.title:"",k=e=>{o(e)};return c?e.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},e.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},a.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Qf(h?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,onClick:e=>{if("details-modal"===y&&t?.productDetails){e.stopPropagation(),void 0!==u&&g?.(u);const n={...t.productDetails,selectedVariant:h||t.productDetails.variants?.edges?.[0]?.node};f(n)}},style:{cursor:"details-modal"===y?"pointer":"default",objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:a.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},C&&e.createElement(e.Fragment,null,e.createElement(Im,{className:"yt-comboBundle-product-variant-select-vertical",options:b,value:n,onChange:k,style:{padding:"0 2px 0 6px",gap:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",minHeight:"30px",fontSize:"12px",fontWeight:600,boxSizing:"border-box",lineHeight:"normal"},chevronStyle:{alignSelf:"stretch",backgroundColor:"#F3F3F3",width:"15%",margin:"2px 0"},menuStyle:{fontSize:"12px",fontWeight:600}},h?.title??""))))),(a.comboBundle.subProductsProductTitleVisibility||a.comboBundle.subProductsProductPriceVisibility||m)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),E&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-vertical",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd",whiteSpace:"nowrap",marginBlock:"4px"}},E),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal"}},e.createElement(qe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal",fontWeight:"500"}},e.createElement(qe,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(Le,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf((Number(h?.price||0)/Number(s)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.compareAtPrice?h.compareAtPrice:h?.price)):Number(l)<Number(s)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.price)))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===a.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===a.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},a.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Qf(h?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,onClick:e=>{if("details-modal"===y&&t?.productDetails){e.stopPropagation();const n={...t.productDetails,selectedVariant:h||t.productDetails.variants?.edges?.[0]?.node};f(n)}},style:{cursor:"details-modal"===y?"pointer":"default",objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:a?.general?.imageAspectRatio||"1 / 1",height:"100px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===a.comboBundle?.infoAlignment?"flex-start":"right"===a.comboBundle?.infoAlignment?"flex-end":"center"===a.comboBundle?.infoAlignment?"flex-start":void 0}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),v.length>0&&(E||"dropdown"!==a.comboBundle.comboVariantTypeSelector&&d&&w)&&e.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},E||(w.length>1?w.join(" / "):w))),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal"}},e.createElement(qe,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal",fontWeight:"500"}},e.createElement(qe,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(Le,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf((Number(h?.price||0)/Number(s)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.compareAtPrice?h?.compareAtPrice:h?.price)):Number(l)<Number(s)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Yf(a.general.currencySymbol),Uf(h?.price)))),C&&("dropdown"===a.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement(Im,{className:"yt-comboBundle-product-variant-select-horizontal",options:b,value:n,onChange:k,style:{display:"inline-flex",alignItems:"center",gap:"6px",maxWidth:"100%",padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px",lineHeight:"normal"},menuStyle:{fontSize:"12px",fontWeight:600}})):t?.productDetails.options.length>0?e.createElement(e.Fragment,null,t?.productDetails.options.map((n,r)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t?.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(o=>{const i=[...w];i[r]=o;const l=t?.productDetails.options.length>0?i.join(" / "):i[r],s=t?.productDetails.variants.edges.find(e=>e.node.title===l)?.node,c=0===(s?x(s.id):0);if(!1===a?.general?.showOutOfStockVariants&&c)return null;const p=w[r]===o,m=d&&d?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${c?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!c&&s&&k(s.id)},disabled:c,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:c?.5:1,cursor:c?"not-allowed":"pointer"}},m?.values.find(e=>e.name===o)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:p&&!c?"26px":"24px",height:p&&!c?"26px":"24px",borderRadius:"50%",backgroundColor:m?.values.find(e=>e.name===o)?.value}},e.createElement("span",null)):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:c?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!c?"#F7F7F7":"transparent",color:c?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):m&&"image"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${c?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!c&&s&&k(s.id)},disabled:c,style:{border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:p&&!c?"#F7F7F7":"transparent",cursor:c?"not-allowed":"pointer",padding:"0px",width:p&&!c?"26px":"24px",height:p&&!c?"26px":"24px",overflow:"hidden",opacity:c?.5:1}},m?.values.find(e=>e.name===o)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Qf(m?.values.find(e=>e.name===o)?.value||"/placeholder.svg"),alt:o,style:{width:p&&!c?"26px":"24px",height:p&&!c?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:c?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!c?"#F7F7F7":"transparent",color:c?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${c?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!c&&s&&k(s.id)},disabled:c,style:{padding:"4px 8px",border:p&&!c?`1px solid ${a.general?.ctaBackgroundColor}`:c?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!c?"#F7F7F7":"transparent",color:c?"#ccc":"#707070",cursor:c?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:c?.5:1}},o)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const r=0===x(t?.node?.id);return!1===a?.general?.showOutOfStockVariants&&r?null:e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${r?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>k(t?.node?.id),disabled:r,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:r?"#ccc":"#707070",cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:r?.5:1}},t?.node?.title)}))))))},cu=({bundle:o,addToCartFunction:a,dispatchAnalyticsEvent:i})=>{const l=r(()=>{const e="undefined"!=typeof window&&"clayco-com.myshopify.com"===window?.Shopify?.shop,t=o.products?.filter(t=>{if(e&&""===t?.productDetails?.onlineStoreUrl)return!1;const n=t?.productDetails?.status?.toLowerCase();return!n||("active"===n||"unlisted"===n)})||[];if(!t.some(e=>e.quantity&&e.quantity>1))return{...o,products:t};const n=t.reduce((e,t)=>{const n=t.quantity||1;for(let r=0;r<n;r++)e.push(t);return e},[]);return{...o,products:n}},[o]),[s,c]=t(!1),[d,p]=t(window.innerWidth<786),[m,u]=t(!1),[g,f]=t(null),y=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[x,h]=t(()=>{const e={};return l.products.forEach((t,n)=>{const r=t?.productDetails?.variants?.edges?.find(e=>y(t?.productDetails,e?.node?.id)>0)?.node;e[n]=r?r.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e}),[b,w]=t(null);n(()=>{if(b){const e=setTimeout(()=>w(null),2e3);return()=>clearTimeout(e)}},[b]);const v=l.products?.every((e,t)=>{const n=x[t];return y(e?.productDetails,n)>0});n(()=>(a&&(window.ytComboBundle={bundle:l,addToCart:a,selectedVariants:x},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))}),[l,a,x]);const C=(e,t)=>{h(n=>({...n,[e]:t}))},E=async e=>{const t=Object.entries(x).map(([e])=>({id:l.products[parseInt(e)].productId,title:l.products[parseInt(e)]?.productDetails?.title}));i?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:l._id,bundleType:"combo-bundle",selectedProducts:t}});try{if(c(!0),w(null),!a)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const t=Object.entries(x).map(([e,t])=>{const n=l.products[parseInt(e)],r=n?.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return r?{variantId:t,price:Number(r.price)}:null}).filter(e=>null!==e),n=Object.values(x);await a(Number(N),n,Number(I),t,e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e),w($p(e))}c(!1)},k=l.customizations,T=k?.comboBundle?.discountBadgeDisplay||"discount-on-compare",S=k?.comboBundle?.discountBadgeVisibility,{originalPrice:N,dealPrice:I,offerValue:F,totalPriceSum:z,offerPercentage:B}=r(()=>{const{price:e,compareAtPrice:t}=Object.entries(x).reduce((e,[t,n])=>{const r=l.products[parseInt(t)],o=r?.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e},{price:0,compareAtPrice:0}),n=!1===S?e:"discount-on-price"===T?e:t;let r=e;l?.percentageOff?r=e*(1-l.percentageOff/100):l?.dealAmount?r=l.dealAmount:l?.amountOff&&(r=e-l.amountOff);const o=n-r,a=n>0?Math.round((n-r)/n*100):0;return{originalPrice:n.toFixed(2),dealPrice:r.toFixed(2),offerValue:o.toFixed(2),totalPriceSum:e.toFixed(2),offerPercentage:a}},[x,l.products,l.percentageOff,l.dealAmount,l.amountOff,T,S]);n(()=>{i?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:l._id,bundleType:"combo-bundle"}});const e=()=>{p(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const $=k.comboBundle?.comboCardStyle||"auto",A="vertical"===$||"auto"===$&&!d,D=k.comboBundle?.embedContentVisibility,P="bundles"==l.appName?l.pageHeader?.title:l?.title,_="bundles"==l.appName?l.pageHeader?.description:l?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===k.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===k.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===k.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:k.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===k.comboBundle?.infoAlignment?"flex-start":"right"===k.comboBundle?.infoAlignment?"flex-end":"center"===k.comboBundle?.infoAlignment?"center":void 0,textAlign:k.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},D&&k.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},e.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:k.comboBundle?.productTitleFontSize||"28px",color:k.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},P)),D&&k?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:k.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(k.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},e.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},e.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Yf(k.general.currencySymbol,l.storeCurrencyCode),Uf(I)),!isNaN(Number(N))&&!isNaN(Number(I))&&Number(N)>Number(I)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:k.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Yf(k.general.currencySymbol,l.storeCurrencyCode),Uf(N)),Number(F)>0&&!1!==S&&(()=>{const t="percentage"===(k?.comboBundle?.discountDisplayType||"amount")?`${B}% Off`:`Save ${Yf(k.general.currencySymbol,l.storeCurrencyCode)}${Uf(F)}`;return e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},t)})())),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:k.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:k.comboBundle.productDescriptionFontSize||"16px",color:k.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",e.createElement("u",null,"Shipping")," calculated at checkout."))),k.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,A?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(d?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},l.products.map((t,n)=>{const r=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===x[n])?.node;return r?e.createElement(su,{key:`combo-product-${n}-${t.productId}`,product:t,styles:k,originalPrice:N,dealPrice:I,totalPriceSum:z,selectedVariantId:x[n],onVariantChange:e=>C(n,e),isVertical:A,variantOptions:l.variantOptions,storeCurrencyCode:l.storeCurrencyCode,reviewRatingType:k?.comboBundle?.comboProductRatingsDisplay,productIndex:n,setActiveModalIndex:f}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(d?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},k.comboBundle.subProductsSectionVisibility&&l.products.map((t,n)=>e.createElement(su,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:k,originalPrice:N,dealPrice:I,totalPriceSum:z,selectedVariantId:x[n],onVariantChange:e=>C(n,e),variantOptions:l.variantOptions,reviewRatingType:k?.comboBundle?.comboProductRatingsDisplay,productIndex:n,setActiveModalIndex:f})))),e.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},e.createElement("button",{"data-gokwik-processed":"true",className:`yt-comboBundle-bundle-cta-button ${v?"":"yt-comboBundle-bundle-cta-button-disabled"} ${d?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:b?"#dc2626":v?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor,color:b?"#ffffff":k.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:k.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:v?"pointer":"not-allowed",border:`1px solid ${b?"#dc2626":v?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor}`,boxShadow:Ho(k.general.ctaShadowType),padding:k.general?.ctaPadding,width:k.general?.ctaWidth,margin:"0"},disabled:!v||s,onMouseOver:e=>{k.general.customizeHoverState&&v&&!b&&!s&&(e.currentTarget.style.backgroundColor=k.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=k.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{k.general.customizeHoverState&&v&&!b&&!s&&(e.currentTarget.style.backgroundColor=k.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=k.general?.ctaTextColor||"#FFFFFF")},onClick:()=>{s||(async()=>{l?.personalizedForm?.title?u(!0):await E()})()}},"animated"===k?.general?.atcLoaderType?e.createElement(iu,{color:"white",loading:s,size:22},b?e.createElement(e.Fragment,null,b):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement("span",null,v?k.comboBundle?.ctaTitle??"Add Bundle to cart":k.general.outOfStockLabel||"Out of Stock"),v&&k?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"}))))):s?e.createElement(Ie,{color:"white",loading:s,size:20}):b?e.createElement(e.Fragment,null,b):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement("span",null,v?k.comboBundle?.ctaTitle??"Add Bundle to cart":k.general.outOfStockLabel||"Out of Stock"),v&&k?.general?.showPaymentIcons&&e.createElement("div",{style:{display:"flex",alignItems:"center",marginLeft:"10px"}},e.createElement("img",{src:"https://r2.yourtoken.io/checkout-button-payment-provider-icons.png",alt:"Payment methods",style:{height:"22px",width:"auto"}}),e.createElement("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",className:"yt-cart-summary-checkout-next-icon",fontSize:"24px",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},e.createElement("polyline",{fill:"none",strokeWidth:"2",points:"9 6 15 12 9 18"})))))),D&&k.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px",width:"100%"}},e.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:k.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:k.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:k.comboBundle.productDescriptionFontSize||"16px",color:k.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:k.general.primaryColor+"08"},dangerouslySetInnerHTML:{__html:Do(_)}})),l?.personalizedForm?.title&&e.createElement(lu,{isOpen:m,onClose:()=>u(!1),formConfig:l.personalizedForm,onCheckout:async e=>{await E(e),u(!1)},cta:{backgroundColor:k.general?.ctaBackgroundColor||"#121212",textColor:k.general?.ctaTextColor||"#FFFFFF"},isMobile:d}),e.createElement(Rm,{bundleType:"comboBundle",handleAddToBundle:()=>{},selectedProducts:[],remainingQuantity:0,hideAddToBundle:!0,disableQuantitySelector:!0,themeColor:k?.general?.primaryColor||"#000",primaryTextColorCta:k?.general?.primaryContrastColor||"#fff",primaryBackgroundColorCta:k?.general?.primaryColor||"#000",cornerRadius:"8px",styles:k,onVariantSelect:e=>{null!==g&&C(g,e)},bundle:l,totalPriceSum:z,dealPrice:I}))},du=d.div`
3613
3613
  max-width: 800px;
3614
3614
  container-type: inline-size;
3615
3615
  margin-top: ${e=>e.verticalMargin||"0px"};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.10.108",
3
+ "version": "0.10.109",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",