yt-uikit 0.9.26 → 0.9.27

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
@@ -2931,7 +2931,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
2931
2931
  text-align: center;
2932
2932
  display: flex;
2933
2933
  flex-shrink: 0;
2934
- `,Gc=({tiers:t,isMobile:n=!1,selectedProductsByTier:o,selectedProducts:r,themeColor:i,showProductDetailsInTracker:a,handleRemoveItemProductTier:l,cornerRadius:c,currencySymbol:s})=>e.createElement(e.Fragment,null,t.map((i,d)=>{const p=i.minimumQuantity-(o[d]?.length??0),u=r?.filter(e=>e.tierIndex===d);return Math.min(o[d]?.length/i.minimumQuantity*100,100),e.createElement("div",{className:"yt-byob-tracker-product-list-tier-wrapper",style:{display:"flex",width:"100%"}},e.createElement("div",{className:"yt-byob-tracker-product-list-tier-items"},e.createElement("div",{className:"yt-byob-tracker-product-list-items",style:{display:"flex",gap:"5px"}},u?.map?.(t=>{const r=t.product.variants?.edges?.find(e=>e.node.id===t.variantId),p=o[d]?.filter(e=>e===r?.node.id).length||0;return a?e.createElement(Uc,{className:"yt-byob-tracker-detailed-product-item",key:t.variantId},e.createElement(zc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.isFree&&e.createElement("div",{style:{position:"absolute",bottom:4,left:"30%",background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"40px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},"FREE",e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),t?.quantity>1&&e.createElement($c,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},t.quantity,"x")),e.createElement(Fc,{className:"yt-byob-tracker-info-block"},e.createElement(Pc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(Dc,{className:"yt-byob-tracker-product-price"},s,eu(r?.node?.price)),e.createElement(Nc,{className:"yt-byob-tracker-remove-detailed-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(st,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Qc,{className:"yt-byob-tracker-product-list-item",isMobile:n,borderRadius:c,imageUrl:r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url,style:{borderRadius:c||"12px"}},t?.isFree&&e.createElement("div",{style:{position:"absolute",top:4,left:4,background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"8px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},e.createElement(lt,null),e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),p>1&&e.createElement($c,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},p,"x"),e.createElement(Nc,{className:"yt-byob-tracker-remove-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(te,{fontSize:"12px"}))))}),p>=1&&[...Array(p)].map((t,o)=>e.createElement(_c,{className:"yt-byob-tracker-placeholder-box",isMobile:n,borderRadius:c,key:o},e.createElement(_e,{size:40,color:"#A0A0A0"}))))),d<t.length-1&&e.createElement(Yc,{className:"yt-byob-tracker-plus-icon-container"},e.createElement(_e,{size:"16px",style:{backgroundColor:"#f2f2f2"}})))})),Xc=({builderTiers:o,handleAddToCart:r,minimumQuantity:i,selectedProducts:a,showProductDetailsInTracker:l,loading:c,handleRemoveItem:s,percentageOff:d,selectedItemsQuantity:p,bundleSubtotal:u,amountOff:m,styles:g,dealAmount:x,isMobile:f=!1,themeColor:y,cornerRadiusType:b,primaryTextColorCta:h,handleRemoveItemProductTier:v,selectedProductsByTier:w,storeCurrencyCode:C,isUploading:E,showNextStep:k})=>{const[T,S]=t(!1),[$,N]=t(0),[B,z]=t([]),[I,F]=t(0),[P,D]=t(0),[A,_]=t(!1),[R,O]=t(null),[L,M]=t(!1),V=u?.price||0,j=o?.type,W=e=>{if(e<0||!B[e])return V;const t=B[e].discountValue??0;return d?V*(1-t/100):x?t:m?V-t:V};n(()=>{if(o&&"none"!==o.type)if("productTier"===j&&o.productTier){const e=o.productTier||[];z(e);let t=0;o.productTier.map(e=>{t+=e.minimumQuantity}),D(t-p)}else if(B.length)I>0&&p<B[I-1]?.minimumQuantity?(F(I-1),O(I-1)):p<B[I]?.minimumQuantity&&O(I-1),N(W(I));else{const e=o.offerTier||[];z(e),F(0),D(e[0]?.minimumQuantity-p||i-p)}else z([]),D(i-p),F(0)},[o,i,p]),n(()=>{B.length&&"productTier"!=j?(()=>{if(!B?.length)return;let e=-1,t=null,n=0;if("offerTier"===j)for(let o=0;o<B.length&&(n+=B[o].minimumQuantity,p>=n);o++)t=o,e=o+1<B.length?o+1:o;if(F(e),O(t),null!==t){let e=B.slice(0,t+1).reduce((e,t)=>e+t.minimumQuantity,0);_(e===p),S(!0),N(W(t))}else _(!1),S(!1),N(V);const o=e>=0&&e<B.length?B.slice(0,e+1).reduce((e,t)=>e+t.minimumQuantity,0)-p:B[0].minimumQuantity-p;D(o)})():p===i?(S(!0),N(d?V*(1-d/100):x||(m?V-m:V)),_(!0)):(_(!1),S(!1))},[p,B]);const H=T?Math.max(u?.compareAtPrice,u?.price):u?.compareAtPrice>u?.price?u?.compareAtPrice:null,q=T?$.toFixed(2):u?.price?.toFixed(2),Q=H&&q?(H-Number(q)).toFixed(2):0,U=o&&"none"!==j&&o.offerTier?"offerTier"===j?Math.min(p/(p+P)*100,100):void 0:p/i*100;n(()=>{if(T&&g.byob.enableConfetti){console.log("remainingItems",P);const e=document.getElementById("checkoutButton");if(!e)return;const t=e.getBoundingClientRect(),n=(t.left+t.width/2)/window.innerWidth,o=(t.top+t.height/2)/window.innerHeight;ke({particleCount:100,spread:70,origin:{x:n,y:o},zIndex:9999})}},[T,g]),I>=0&&I<B.length&&B[I].tier;const Y=e.useMemo(()=>null!==R&&B[R+1]?B[R+1]?.customText||"":o?.offerTier?.[0]?.customText||"",[R,B,o]),G="number"==typeof R?B[R]?.customText:void 0,X="string"==typeof G&&""!==G.trim();return e.createElement(bc,{className:"yt-byob-tracker-container bundle-builder-tracker-container "+(f?"yt-byob-tracker-mobile":"yt-byob-tracker-desktop"),isMobile:f,style:{justifyContent:g.byob.selectedProductsVisibility&&!f?"space-between":"center"}},"offerTier"==j&&null!==R&&R>=0&&e.createElement(hc,{className:"yt-byob-tracker-offer-tier-tag"},X?e.createElement(e.Fragment,null,G," unlocked"):e.createElement(e.Fragment,null,e.createElement(e.Fragment,null,"Buy"," ",B.slice(0,R+1).reduce((e,t)=>e+t.minimumQuantity,0)," ","at",m||x?e.createElement(e.Fragment,null," ",tu(g.general.currencySymbol,C)):""," ",eu(B[R]?.discountValue),d?e.createElement(e.Fragment,null,"% "):eu(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):""),e.createElement("span",{style:{fontStyle:"italic"}}," applied"))),f&&P>=1&&!A&&"offerTier"!==j?e.createElement(vc,{className:"yt-byob-tracker-mobile-remaining",style:{margin:"0"}},0===B.length?e.createElement(e.Fragment,null,"Select ",P," more item(s)"," ",0!==x||0!==d?"to get the bundle at":"",0!==x&&e.createElement(e.Fragment,null,` ${tu(g.general.currencySymbol,C)}${x}`),!!d&&0!==d&&e.createElement(e.Fragment,null," ",` ${d}% Off`)):e.createElement(e.Fragment,null," Select ",P," more item(s)")):e.createElement(e.Fragment,null),"productTier"!==j&&e.createElement(wc,{className:"yt-byob-tracker-tier-progress-container"},e.createElement(Cc,{className:"yt-byob-tracker-tier-progress-text"},"offerTier"==j&&B.length>0&&P>0&&e.createElement(e.Fragment,null,Y?e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," more to unlock ",Y):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," More Item(s)",e.createElement("span",{style:{fontWeight:"500"}}," to "),"Buy ",p+P," at"," ",m||x?e.createElement(e.Fragment,null,tu(g.general.currencySymbol,C)):""," ",eu(B[I>=0?I:0]?.discountValue),d?e.createElement(e.Fragment,null,"% "):eu(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):"")))),e.createElement(Ec,{className:"yt-byob-tracker-progress-bar-bg"},e.createElement(kc,{className:"yt-byob-tracker-progress-bar-fill bundle-builder-tracker-progress",progressPercentage:U??0,primaryColor:y??g?.general.primaryColor}," "))),g.byob.selectedProductsVisibility&&e.createElement(Tc,{className:"yt-byob-tracker-product-list-wrapper hide-tracker-scrollbar "+(f?"yt-byob-tracker-mobile-product-list":"yt-byob-tracker-desktop-product-list"),tierType:j??"",isMobile:f},"productTier"===j?e.createElement(Gc,{tiers:B,isMobile:f,selectedProductsByTier:w??{},selectedProducts:a,themeColor:g.general.primaryColor,showProductDetailsInTracker:l,handleRemoveItemProductTier:v,cornerRadius:g.byob.borderRadius,currencySymbol:tu(g.general.currencySymbol,C)}):e.createElement(e.Fragment,null,a?.map?.(t=>{const n=t.product.variants?.edges?.find(e=>e.node.id===t.variantId);return l?e.createElement(Bc,{className:"yt-byob-tracker-detailed-item-container",borderRadius:g.byob.borderRadius,key:t.variantId},e.createElement(zc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.quantity>1&&e.createElement(Ic,{className:"yt-byob-tracker-badge"},t.quantity,"x")),e.createElement(Fc,{className:"yt-byob-tracker-info-block"},e.createElement(Pc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(Dc,{className:"yt-byob-tracker-product-price"},g.general.currencySymbol,n?.node?.price),e.createElement(Ac,{className:"yt-byob-tracker-remove-link",onClick:()=>s(t.variantId)},e.createElement(st,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(qc,{className:"yt-byob-tracker-item bundle-builder-tracker-item",isMobile:f,borderRadius:g.byob.borderRadius,imageUrl:n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url},t?.quantity>1&&e.createElement($c,{className:"yt-byob-tracker-quantity-badge",borderRadius:g.byob.borderRadius},t.quantity,"x"),e.createElement(Nc,{className:"yt-byob-tracker-remove-btn",onClick:()=>s(t.variantId)},e.createElement(te,{fontSize:"12px"}))))}),P>=1&&[...Array(P)].map((t,n)=>e.createElement(_c,{className:"yt-byob-tracker-placeholder-box",isMobile:f,borderRadius:g.byob.borderRadius,key:n},e.createElement(_e,{size:40,color:"#A0A0A0"}))))),(!f||A)&&e.createElement(Sc,{className:"yt-byob-tracker-summary-container bundle-summary "+(f?"yt-byob-tracker-mobile-summary":"yt-byob-tracker-desktop-summary"),isMobile:f},Number(q)>0&&e.createElement(Rc,{className:"yt-byob-tracker-summary-info summary-info"},e.createElement("div",{className:"yt-byob-tracker-summary-info-content",style:{display:"flex",...window.innerWidth<=600&&{flexDirection:"column"},gap:"5px",justifyContent:"center"}},f?e.createElement("div",{className:"yt-byob-tracker-mobile-subtotal-row",style:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center"}},e.createElement(Oc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(Q)>0&&e.createElement(Lc,{className:"yt-byob-tracker-save-label",style:{}},"Save:"," ",tu(g.general.currencySymbol,C),eu(Q))):e.createElement(e.Fragment,null,e.createElement(Oc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(Q)>0&&!f&&e.createElement(Lc,{className:"yt-byob-tracker-save-label"},"Save:"," ",tu(g.general.currencySymbol,C),eu(Q)))),e.createElement(Mc,{className:"yt-byob-tracker-subtotal-row"},e.createElement(Vc,{className:"yt-byob-tracker-final-price"},tu(g.general.currencySymbol,C),Number(q)>=0?eu(Number(q).toFixed(2)):0),H&&g.byob.compareAtPriceVisibility&&Number(H)>Number(q)&&e.createElement(jc,{className:"yt-byob-tracker-line-through-price"},tu(g.general.currencySymbol,C),eu(Number(H).toFixed(2))))),e.createElement(Wc,{className:"yt-byob-tracker-checkout-button yt-tracking-bar-checkout-button",canCheckout:A,progressPercentage:U??0,ctaColors:{customizeHoverState:g?.general?.customizeHoverState,ctaBackgroundColor:g.general.ctaBackgroundColor,ctaBorderColor:g.general.ctaBorderColor,ctaHoverBackgroundColor:g.general.ctaHoverBackgroundColor,ctaTextColor:g.general.ctaTextColor,ctaHoverTextColor:g.general.ctaHoverTextColor},borderRadius:g.general.ctaBorderRadius,disabled:!A&&P>=1||E,onClick:e=>{c||console.log("saving"),r(e.target??e.currentTarget)},id:"checkoutButton",onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1)},c?e.createElement(ge,{color:L&&g?.general?.customizeHoverState?g.general.ctaHoverTextColor||g.general.ctaTextColor||"black":g.general.ctaTextColor||"black",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):P>=1&&!A?e.createElement("div",{className:"yt-byob-tracker-add-more-btn-text yt-tracking-bar-checkout-button-items-text",style:{color:g.general.primaryColor}},"Add ",P," More Item(s)"):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement(Hc,{className:"yt-byob-tracker-checkout-text yt-tracking-bar-checkout-button-text"},k?"Next Step":g.byob.checkoutCTAText??"Checkout"),!k&&g?.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"})))))))},Zc={8087437412:{position:"fixed",bottom:"10px",zIndex:100,width:"95%",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"50px"}},66134737152:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},83438567714:{zIndex:100,position:"fixed",width:"95%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},72726479068:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px",mobile:{bottom:"70px"}},64800161992:{zIndex:20,mobile:{bottom:"50px"},position:"sticky",bottom:"10px"},53933408435:{zIndex:5,mobile:{bottom:"60px"},position:"sticky",bottom:"10px"},68377018594:{zIndex:5,bottom:"10px",position:"fixed",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"70px"}},84569063743:{zIndex:999,bottom:"0px",width:"100%",position:"fixed",right:"0px",left:"0px"},62022680789:{bottom:"65px",zIndex:999,width:"100%",position:"fixed",right:"0px",left:"0px"},63102222549:{position:"sticky",bottom:"100px",zIndex:999,mobile:{bottom:"60px"}},26666008755:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},67641475285:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},61613179125:{position:"fixed",left:"50%",transform:"translateX(-50%)"},80866345280:{bottom:"10px",mobile:{bottom:"70px"}}},Kc={position:"sticky",bottom:"10px",zIndex:999,width:"96%"},Jc=o=>{const[r,i]=t(!1);n(()=>{const e=()=>{i(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,l=((e,t=!1)=>{const n=e&&Zc[e]?Zc[e]:{},o={...Kc,...n};return t&&n.mobile?{...o,...n.mobile}:o})(String(a),r);o.renderingOnPage||(l.position="static",l.zIndex=0);const c={display:"flex",backgroundColor:"white",borderRadius:"4px",paddingBottom:"5px",justifyContent:"center",margin:"0 auto",transition:"box-shadow 0.3s ease, transform 0.3s ease",border:"1px solid #CBCBCB",boxShadow:"\n 0px 3px 6px 0px #00000040, \n 0px 11px 11px 0px #00000036, \n 0px 24px 14px 0px #00000021, \n 0px 43px 17px 0px #0000000A, \n 0px 68px 19px 0px #00000000\n ",...l};return e.createElement("div",{className:"yt-byob-tracker-bar yt-bundle-builder-tracker-bar "+(r?"yt-byob-tracker-mobile-bar":"yt-byob-tracker-desktop-bar"),style:{...c,width:r?"100%":l.width,...!o.styles.byob.selectedProductsVisibility&&{width:r?"96%":"fit-content",paddingInline:"10px"},...r&&{display:"flex",flexDirection:"row",paadingTop:"0px"}},onMouseEnter:e=>{e.currentTarget.style.boxShadow="\n 0px 8px 16px 0px #00000040, \n 0px 24px 24px 0px #00000036, \n 0px 50px 30px 0px #00000021, \n 0px 90px 36px 0px #0000000A, \n 0px 140px 40px 0px #00000000\n ",e.currentTarget.style.transform="translateX(-50%)"===l.transform?"translate(-50%, -3px)":"translateY(-3px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="\n 0px 5px 12px 0px #00000040, \n 0px 22px 22px 0px #00000036, \n 0px 49px 29px 0px #00000021, \n 0px 87px 35px 0px #0000000A, \n 0px 136px 38px 0px #00000000\n ",e.currentTarget.style.transform=l.transform||"translateY(0)"}},e.createElement(Xc,{...o,isMobile:r}))},es=ae(void 0),ts=c.div`
2934
+ `,Gc=({tiers:t,isMobile:n=!1,selectedProductsByTier:o,selectedProducts:r,themeColor:i,showProductDetailsInTracker:a,handleRemoveItemProductTier:l,cornerRadius:c,currencySymbol:s})=>e.createElement(e.Fragment,null,t.map((i,d)=>{const p=i.minimumQuantity-(o[d]?.length??0),u=r?.filter(e=>e.tierIndex===d);return Math.min(o[d]?.length/i.minimumQuantity*100,100),e.createElement("div",{className:"yt-byob-tracker-product-list-tier-wrapper",style:{display:"flex",width:"100%"}},e.createElement("div",{className:"yt-byob-tracker-product-list-tier-items"},e.createElement("div",{className:"yt-byob-tracker-product-list-items",style:{display:"flex",gap:"5px"}},u?.map?.(t=>{const r=t.product.variants?.edges?.find(e=>e.node.id===t.variantId),p=o[d]?.filter(e=>e===r?.node.id).length||0;return a?e.createElement(Uc,{className:"yt-byob-tracker-detailed-product-item",key:t.variantId},e.createElement(zc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.isFree&&e.createElement("div",{style:{position:"absolute",bottom:4,left:"30%",background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"40px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},"FREE",e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),t?.quantity>1&&e.createElement($c,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},t.quantity,"x")),e.createElement(Fc,{className:"yt-byob-tracker-info-block"},e.createElement(Pc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(Dc,{className:"yt-byob-tracker-product-price"},s,tu(r?.node?.price)),e.createElement(Nc,{className:"yt-byob-tracker-remove-detailed-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(st,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(Qc,{className:"yt-byob-tracker-product-list-item",isMobile:n,borderRadius:c,imageUrl:r?.node.image?.url&&r?.node.image?.url?.length>0?r?.node.image.url:t.product.featuredMedia?.preview?.image?.url,style:{borderRadius:c||"12px"}},t?.isFree&&e.createElement("div",{style:{position:"absolute",top:4,left:4,background:"linear-gradient(135deg, #ff0080, #ff4d4d)",color:"white",fontWeight:900,fontSize:"8px",padding:"4px 6px",borderRadius:"8px",letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 6px 20px rgba(255, 0, 128, 0.7)",zIndex:20,border:"1px solid white",animation:"popup 0.6s ease-out"}},e.createElement(lt,null),e.createElement("style",null,"\n @keyframes popup {\n 0% { transform: scale(0) rotate(-30deg); opacity: 0; }\n 70% { transform: scale(1.3); }\n 100% { transform: scale(1); }\n }\n ")),p>1&&e.createElement($c,{className:"yt-byob-tracker-quantity-badge",borderRadius:c},p,"x"),e.createElement(Nc,{className:"yt-byob-tracker-remove-btn",onClick:()=>l(t.variantId,d),style:{...1===i.minimumQuantity&&1===i.products.length&&1===o[d]?.length?{display:"none"}:{}}},e.createElement(te,{fontSize:"12px"}))))}),p>=1&&[...Array(p)].map((t,o)=>e.createElement(_c,{className:"yt-byob-tracker-placeholder-box",isMobile:n,borderRadius:c,key:o},e.createElement(_e,{size:40,color:"#A0A0A0"}))))),d<t.length-1&&e.createElement(Yc,{className:"yt-byob-tracker-plus-icon-container"},e.createElement(_e,{size:"16px",style:{backgroundColor:"#f2f2f2"}})))})),Xc=({builderTiers:o,handleAddToCart:r,minimumQuantity:i,selectedProducts:a,showProductDetailsInTracker:l,loading:c,handleRemoveItem:s,percentageOff:d,selectedItemsQuantity:p,bundleSubtotal:u,amountOff:m,styles:g,dealAmount:x,isMobile:f=!1,themeColor:y,cornerRadiusType:b,primaryTextColorCta:h,handleRemoveItemProductTier:v,selectedProductsByTier:w,storeCurrencyCode:C,isUploading:E,showNextStep:k})=>{const[T,S]=t(!1),[$,N]=t(0),[B,z]=t([]),[I,F]=t(0),[P,D]=t(0),[A,_]=t(!1),[R,O]=t(null),[L,M]=t(!1),V=u?.price||0,j=o?.type,W=e=>{if(e<0||!B[e])return V;const t=B[e].discountValue??0;return d?V*(1-t/100):x?t:m?V-t:V};n(()=>{if(o&&"none"!==o.type)if("productTier"===j&&o.productTier){const e=o.productTier||[];z(e);let t=0;o.productTier.map(e=>{t+=e.minimumQuantity}),D(t-p)}else if(B.length)I>0&&p<B[I-1]?.minimumQuantity?(F(I-1),O(I-1)):p<B[I]?.minimumQuantity&&O(I-1),N(W(I));else{const e=o.offerTier||[];z(e),F(0),D(e[0]?.minimumQuantity-p||i-p)}else z([]),D(i-p),F(0)},[o,i,p]),n(()=>{B.length&&"productTier"!=j?(()=>{if(!B?.length)return;let e=-1,t=null,n=0;if("offerTier"===j)for(let o=0;o<B.length&&(n+=B[o].minimumQuantity,p>=n);o++)t=o,e=o+1<B.length?o+1:o;if(F(e),O(t),null!==t){let e=B.slice(0,t+1).reduce((e,t)=>e+t.minimumQuantity,0);_(e===p),S(!0),N(W(t))}else _(!1),S(!1),N(V);const o=e>=0&&e<B.length?B.slice(0,e+1).reduce((e,t)=>e+t.minimumQuantity,0)-p:B[0].minimumQuantity-p;D(o)})():p===i?(S(!0),N(d?V*(1-d/100):x||(m?V-m:V)),_(!0)):(_(!1),S(!1))},[p,B]);const H=T?Math.max(u?.compareAtPrice,u?.price):u?.compareAtPrice>u?.price?u?.compareAtPrice:null,q=T?$.toFixed(2):u?.price?.toFixed(2),Q=H&&q?(H-Number(q)).toFixed(2):0,U=o&&"none"!==j&&o.offerTier?"offerTier"===j?Math.min(p/(p+P)*100,100):void 0:p/i*100;n(()=>{if(T&&g.byob.enableConfetti){console.log("remainingItems",P);const e=document.getElementById("checkoutButton");if(!e)return;const t=e.getBoundingClientRect(),n=(t.left+t.width/2)/window.innerWidth,o=(t.top+t.height/2)/window.innerHeight;ke({particleCount:100,spread:70,origin:{x:n,y:o},zIndex:9999})}},[T,g]),I>=0&&I<B.length&&B[I].tier;const Y=e.useMemo(()=>null!==R&&B[R+1]?B[R+1]?.customText||"":o?.offerTier?.[0]?.customText||"",[R,B,o]),G="number"==typeof R?B[R]?.customText:void 0,X="string"==typeof G&&""!==G.trim();return e.createElement(bc,{className:"yt-byob-tracker-container bundle-builder-tracker-container "+(f?"yt-byob-tracker-mobile":"yt-byob-tracker-desktop"),isMobile:f,style:{justifyContent:g.byob.selectedProductsVisibility&&!f?"space-between":"center"}},"offerTier"==j&&null!==R&&R>=0&&e.createElement(hc,{className:"yt-byob-tracker-offer-tier-tag"},X?e.createElement(e.Fragment,null,G," unlocked"):e.createElement(e.Fragment,null,e.createElement(e.Fragment,null,"Buy"," ",B.slice(0,R+1).reduce((e,t)=>e+t.minimumQuantity,0)," ","at",m||x?e.createElement(e.Fragment,null," ",nu(g.general.currencySymbol,C)):""," ",tu(B[R]?.discountValue),d?e.createElement(e.Fragment,null,"% "):tu(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):""),e.createElement("span",{style:{fontStyle:"italic"}}," applied"))),f&&P>=1&&!A&&"offerTier"!==j?e.createElement(vc,{className:"yt-byob-tracker-mobile-remaining",style:{margin:"0"}},0===B.length?e.createElement(e.Fragment,null,"Select ",P," more item(s)"," ",0!==x||0!==d?"to get the bundle at":"",0!==x&&e.createElement(e.Fragment,null,` ${nu(g.general.currencySymbol,C)}${x}`),!!d&&0!==d&&e.createElement(e.Fragment,null," ",` ${d}% Off`)):e.createElement(e.Fragment,null," Select ",P," more item(s)")):e.createElement(e.Fragment,null),"productTier"!==j&&e.createElement(wc,{className:"yt-byob-tracker-tier-progress-container"},e.createElement(Cc,{className:"yt-byob-tracker-tier-progress-text"},"offerTier"==j&&B.length>0&&P>0&&e.createElement(e.Fragment,null,Y?e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," more to unlock ",Y):e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-tracker-add-more-text",style:{padding:"4px",fontWeight:"600",...window.innerWidth<=768&&{fontSize:"12px"},color:"#121212"}},"Add ",P," More Item(s)",e.createElement("span",{style:{fontWeight:"500"}}," to "),"Buy ",p+P," at"," ",m||x?e.createElement(e.Fragment,null,nu(g.general.currencySymbol,C)):""," ",tu(B[I>=0?I:0]?.discountValue),d?e.createElement(e.Fragment,null,"% "):tu(x)?e.createElement(e.Fragment,null):"",d||m?e.createElement(e.Fragment,null," Off"):"")))),e.createElement(Ec,{className:"yt-byob-tracker-progress-bar-bg"},e.createElement(kc,{className:"yt-byob-tracker-progress-bar-fill bundle-builder-tracker-progress",progressPercentage:U??0,primaryColor:y??g?.general.primaryColor}," "))),g.byob.selectedProductsVisibility&&e.createElement(Tc,{className:"yt-byob-tracker-product-list-wrapper hide-tracker-scrollbar "+(f?"yt-byob-tracker-mobile-product-list":"yt-byob-tracker-desktop-product-list"),tierType:j??"",isMobile:f},"productTier"===j?e.createElement(Gc,{tiers:B,isMobile:f,selectedProductsByTier:w??{},selectedProducts:a,themeColor:g.general.primaryColor,showProductDetailsInTracker:l,handleRemoveItemProductTier:v,cornerRadius:g.byob.borderRadius,currencySymbol:nu(g.general.currencySymbol,C)}):e.createElement(e.Fragment,null,a?.map?.(t=>{const n=t.product.variants?.edges?.find(e=>e.node.id===t.variantId);return l?e.createElement(Bc,{className:"yt-byob-tracker-detailed-item-container",borderRadius:g.byob.borderRadius,key:t.variantId},e.createElement(zc,{className:"yt-byob-tracker-detailed-image",style:{backgroundImage:`url(${n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url})`}},t?.quantity>1&&e.createElement(Ic,{className:"yt-byob-tracker-badge"},t.quantity,"x")),e.createElement(Fc,{className:"yt-byob-tracker-info-block"},e.createElement(Pc,{className:"yt-byob-tracker-product-title"},t.product.title),e.createElement(Dc,{className:"yt-byob-tracker-product-price"},g.general.currencySymbol,n?.node?.price),e.createElement(Ac,{className:"yt-byob-tracker-remove-link",onClick:()=>s(t.variantId)},e.createElement(st,null),e.createElement("span",null,"Remove")))):e.createElement("div",{className:"yt-byob-tracker-product-item",key:t.variantId},e.createElement(qc,{className:"yt-byob-tracker-item bundle-builder-tracker-item",isMobile:f,borderRadius:g.byob.borderRadius,imageUrl:n?.node.image?.url&&n?.node.image?.url?.length>0?n?.node.image.url:t.product.featuredMedia?.preview?.image?.url},t?.quantity>1&&e.createElement($c,{className:"yt-byob-tracker-quantity-badge",borderRadius:g.byob.borderRadius},t.quantity,"x"),e.createElement(Nc,{className:"yt-byob-tracker-remove-btn",onClick:()=>s(t.variantId)},e.createElement(te,{fontSize:"12px"}))))}),P>=1&&[...Array(P)].map((t,n)=>e.createElement(_c,{className:"yt-byob-tracker-placeholder-box",isMobile:f,borderRadius:g.byob.borderRadius,key:n},e.createElement(_e,{size:40,color:"#A0A0A0"}))))),(!f||A)&&e.createElement(Sc,{className:"yt-byob-tracker-summary-container bundle-summary "+(f?"yt-byob-tracker-mobile-summary":"yt-byob-tracker-desktop-summary"),isMobile:f},Number(q)>0&&e.createElement(Rc,{className:"yt-byob-tracker-summary-info summary-info"},e.createElement("div",{className:"yt-byob-tracker-summary-info-content",style:{display:"flex",...window.innerWidth<=600&&{flexDirection:"column"},gap:"5px",justifyContent:"center"}},f?e.createElement("div",{className:"yt-byob-tracker-mobile-subtotal-row",style:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center"}},e.createElement(Oc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(Q)>0&&e.createElement(Lc,{className:"yt-byob-tracker-save-label",style:{}},"Save:"," ",nu(g.general.currencySymbol,C),tu(Q))):e.createElement(e.Fragment,null,e.createElement(Oc,{className:"yt-byob-tracker-subtotal-label"},"Subtotal"),Number(Q)>0&&!f&&e.createElement(Lc,{className:"yt-byob-tracker-save-label"},"Save:"," ",nu(g.general.currencySymbol,C),tu(Q)))),e.createElement(Mc,{className:"yt-byob-tracker-subtotal-row"},e.createElement(Vc,{className:"yt-byob-tracker-final-price"},nu(g.general.currencySymbol,C),Number(q)>=0?tu(Number(q).toFixed(2)):0),H&&g.byob.compareAtPriceVisibility&&Number(H)>Number(q)&&e.createElement(jc,{className:"yt-byob-tracker-line-through-price"},nu(g.general.currencySymbol,C),tu(Number(H).toFixed(2))))),e.createElement(Wc,{className:"yt-byob-tracker-checkout-button yt-tracking-bar-checkout-button",canCheckout:A,progressPercentage:U??0,ctaColors:{customizeHoverState:g?.general?.customizeHoverState,ctaBackgroundColor:g.general.ctaBackgroundColor,ctaBorderColor:g.general.ctaBorderColor,ctaHoverBackgroundColor:g.general.ctaHoverBackgroundColor,ctaTextColor:g.general.ctaTextColor,ctaHoverTextColor:g.general.ctaHoverTextColor},borderRadius:g.general.ctaBorderRadius,disabled:!A&&P>=1||E,onClick:e=>{c||console.log("saving"),r(e.target??e.currentTarget)},id:"checkoutButton",onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1)},c?e.createElement(ge,{color:L&&g?.general?.customizeHoverState?g.general.ctaHoverTextColor||g.general.ctaTextColor||"black":g.general.ctaTextColor||"black",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):P>=1&&!A?e.createElement("div",{className:"yt-byob-tracker-add-more-btn-text yt-tracking-bar-checkout-button-items-text",style:{color:g.general.primaryColor}},"Add ",P," More Item(s)"):e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},e.createElement(Hc,{className:"yt-byob-tracker-checkout-text yt-tracking-bar-checkout-button-text"},k?"Next Step":g.byob.checkoutCTAText??"Checkout"),!k&&g?.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"})))))))},Zc={8087437412:{position:"fixed",bottom:"10px",zIndex:100,width:"95%",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"50px"}},66134737152:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},83438567714:{zIndex:100,position:"fixed",width:"95%",left:"50%",transform:"translateX(-50%)",bottom:"10px"},72726479068:{position:"fixed",zIndex:20,width:"90%",left:"50%",transform:"translateX(-50%)",bottom:"10px",mobile:{bottom:"70px"}},64800161992:{zIndex:20,mobile:{bottom:"50px"},position:"sticky",bottom:"10px"},53933408435:{zIndex:5,mobile:{bottom:"60px"},position:"sticky",bottom:"10px"},68377018594:{zIndex:5,bottom:"10px",position:"fixed",left:"50%",transform:"translateX(-50%)",mobile:{bottom:"70px"}},84569063743:{zIndex:999,bottom:"0px",width:"100%",position:"fixed",right:"0px",left:"0px"},62022680789:{bottom:"65px",zIndex:999,width:"100%",position:"fixed",right:"0px",left:"0px"},63102222549:{position:"sticky",bottom:"100px",zIndex:999,mobile:{bottom:"60px"}},26666008755:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},67641475285:{bottom:"10px",zIndex:999,position:"fixed",left:"50%",transform:"translateX(-50%)"},61613179125:{position:"fixed",left:"50%",transform:"translateX(-50%)"},80866345280:{bottom:"10px",mobile:{bottom:"70px"}}},Kc={position:"sticky",bottom:"10px",zIndex:999,width:"96%"},Jc=o=>{const[r,i]=t(!1);n(()=>{const e=()=>{i(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const a="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,l=((e,t=!1)=>{const n=e&&Zc[e]?Zc[e]:{},o={...Kc,...n};return t&&n.mobile?{...o,...n.mobile}:o})(String(a),r);o.renderingOnPage||(l.position="static",l.zIndex=0);const c={display:"flex",backgroundColor:"white",borderRadius:"4px",paddingBottom:"5px",justifyContent:"center",margin:"0 auto",transition:"box-shadow 0.3s ease, transform 0.3s ease",border:"1px solid #CBCBCB",boxShadow:"\n 0px 3px 6px 0px #00000040, \n 0px 11px 11px 0px #00000036, \n 0px 24px 14px 0px #00000021, \n 0px 43px 17px 0px #0000000A, \n 0px 68px 19px 0px #00000000\n ",...l};return e.createElement("div",{className:"yt-byob-tracker-bar yt-bundle-builder-tracker-bar "+(r?"yt-byob-tracker-mobile-bar":"yt-byob-tracker-desktop-bar"),style:{...c,width:r?"100%":l.width,...!o.styles.byob.selectedProductsVisibility&&{width:r?"96%":"fit-content",paddingInline:"10px"},...r&&{display:"flex",flexDirection:"row",paadingTop:"0px"}},onMouseEnter:e=>{e.currentTarget.style.boxShadow="\n 0px 8px 16px 0px #00000040, \n 0px 24px 24px 0px #00000036, \n 0px 50px 30px 0px #00000021, \n 0px 90px 36px 0px #0000000A, \n 0px 140px 40px 0px #00000000\n ",e.currentTarget.style.transform="translateX(-50%)"===l.transform?"translate(-50%, -3px)":"translateY(-3px)"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="\n 0px 5px 12px 0px #00000040, \n 0px 22px 22px 0px #00000036, \n 0px 49px 29px 0px #00000021, \n 0px 87px 35px 0px #0000000A, \n 0px 136px 38px 0px #00000000\n ",e.currentTarget.style.transform=l.transform||"translateY(0)"}},e.createElement(Xc,{...o,isMobile:r}))},es=ae(void 0),ts=c.div`
2935
2935
  position: absolute;
2936
2936
  top: 0px;
2937
2937
  right: 0px;
@@ -3150,7 +3150,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
3150
3150
  font-size: 1em;
3151
3151
  justify-content: center;
3152
3152
  align-items: center;
3153
- `;const is=({options:t,selectedValue:n,onChange:o,type:r="text",isOptionAvailable:i,isMobile:a})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const a=!i||i(t.name);return e.createElement("div",{key:t.name,onClick:()=>{a&&o(t)},style:{cursor:a?"pointer":"not-allowed"}},((t,n)=>{const o=!i||i(t.name),a={cursor:o?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:o?1:.5};if("color"===r)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:{...a,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name);return"image"===r?e.createElement("img",{src:bn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...a,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name)})(t,n?.name===t.name))})),as=({product:r,isOpen:i,onClose:a,variantOptions:l,cta:c,onConfirm:s})=>{const d=o(()=>e=>e?r?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[r?.tracksInventory]),p=o(()=>{const e=r.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):r.options?.map(e=>e.values[0])||[]},[r,d]),[u,m]=t(p),[g,x]=t(window.innerWidth<1024);n(()=>{const e=()=>x(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&a()};return i&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i,a]);const f=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,y=f?.image?.url||r.featuredMedia?.preview?.image?.url,b=bn(y,150,85,"webp"),h=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}})},w=(e,t)=>{const n=u[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!i)return null;const C=e.createElement("div",{onClick:a,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:r.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"}},r.title))),e.createElement("div",{style:{padding:"20px"}},r.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"}},w(t,n)?.name||t.values[0])),e.createElement(is,{options:v(t),selectedValue:w(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n)})(n,e)},type:h(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...u];n[e]=t;const o=r.options?.length>0?n.join(" / "):n[0],i=r.variants.edges.find(e=>e.node.title===o)?.node;return!!i&&d(i)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,t=!!e&&d(e)>0;if(e?.id&&t)s(e.id),a();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const e=r.variants.edges.find(e=>d(e.node)>0)?.node.id;e&&(s(e),a())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:c.backgroundColor,color:c.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"}},"Add to Bundle")));return D.createPortal(C,document.body)},ls=l((a,l)=>{const[c,s]=le(es),d=o(()=>e=>{const t=a?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:a?.bundleProductsCustomQuantity?a?.bundleProductsCustomQuantity:e?c?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[c?.tracksInventory,a?.customVariantsQuantity,a?.bundleProductsCustomQuantity]),p=c?.variants.edges?.filter(e=>d(e.node)>0)||[],[u,m]=t(p?.[0]?.node),[g,x]=t(0),[f,y]=t("undefined"!=typeof window&&window.innerWidth<=600),[b,h]=t(1),[v,w]=t("idle"),C=r(null),E=r(null),k=r(!1),[T,S]=t(0),$=o(()=>{const e=c?.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):c?.options?.map(e=>e.values[0])||[]},[c,d]),[N,B]=t($);n(()=>{if(c){const e=c.variants.edges?.filter(e=>d(e.node)>0),t=c?.selectedVariant??e[0]?.node;m(t),t?.title&&"Default Title"!==t.title&&B(t.title.split(" / "))}},[c,d]),n(()=>{const e=a.selectedProducts.find(e=>e.variantId===u?.id);h(e?e.quantity:0)},[b,a.selectedProducts,u]),n(()=>{if(E.current&&-1!==g&&k.current){const e=E.current.children;e[g]&&e[g].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),k.current=!1}},[g]);if(n(()=>{const e=()=>y(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:z,descriptionHtml:I,media:F,variants:P}=c,A=F.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0),_=i(e=>{const t=e.target.value,n=p?.find(e=>e.node.id===t)?.node;n&&d(n)>0&&(k.current=!0,m(n),n.title&&"Default Title"!==n.title&&B(n.title.split(" / ")))},[p,d]),R=i(e=>{if(!a.bundleVariantOptions?.options)return"text";const t=a.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[a.bundleVariantOptions]),O=i(e=>{if(!a?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=a?.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}})},[a.bundleVariantOptions]),L=i((e,t)=>{const n=[...N];n[e]=t.name,B(n);const o=c?.options?.length>0?n.join(" / "):n[0],r=c?.variants.edges.find(e=>e.node.title===o)?.node;r&&d(r)>0&&(k.current=!0,m(r))},[N,c,d]),M=i((e,t)=>{const n=N[t];if(!n)return null;return O(e).find(e=>e.name===n)||null},[N,O]),V=i((e,t)=>{const n=[...N];n[e]=t;const o=c?.options?.length>0?n.join(" / "):n[0],r=c?.variants.edges.find(e=>e.node.title===o)?.node;return!!r&&d(r)>0},[N,c,d]);n(()=>{if(c&&u?.image?.url&&Array.isArray(A)){const e=A.findIndex(e=>e?.url===u?.image?.url);-1!==e&&e!==g&&x(e)}},[u,g,A]),n(()=>{if(c){document.body.style.overflow="hidden",window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{s(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()}}},[c,s]),n(()=>{if(f&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[f,c]);const j=a.selectedProducts.filter(e=>e.variantId===u?.id).reduce((e,t)=>e+t.quantity,0),W=a.customVariantsQuantity?.find(e=>e.variantId===u?.id)?.quantity??a.bundleProductsCustomQuantity??1/0,H=W!==1/0&&j>=W,q=a.hideAddToBundle||!u||d(u)<=0||H||"idle"!==v||a?.disableQuantitySelector&&1===b,Q=({className:t})=>{const n=c?.rating?.averageRating??a?.rating?.averageRating??0,o=c?.rating?.ratingCount??a?.rating?.ratingCount??0;return n<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===a.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},n," rating")),"ratingAndReviewCount"===a.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14}),n,e.createElement(Ee,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",o," reviews)"))},U=({isMobile:t})=>e.createElement(e.Fragment,null,e.createElement("div",{style:{position:t?"relative":void 0}},t?e.createElement("div",{ref:E,style:{display:"flex",flexDirection:"row",overflowX:"auto",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},A.length>0&&A.map((t,n)=>e.createElement("div",{key:n,style:{width:"100%",flex:"0 0 auto",scrollSnapAlign:"center",objectFit:"contain",maxHeight:"50vh",zIndex:999}},e.createElement(ft,{small:nu(t?.url),medium:nu(t?.url),large:nu(t?.url),alt:t.altText||`${z} - Image ${n+1}`,hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image"})))):e.createElement(e.Fragment,null,e.createElement(ft,{small:nu(A[g]?.url),medium:nu(A[g]?.url),large:nu(A[g]?.url),hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image main-image"}),e.createElement("div",{style:{display:"flex",flexDirection:"row",overflowX:"auto",gap:t?"8px":"12px",padding:"12px 0",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},A.length>1&&A.filter(e=>e?.url?.length>0).map((n,o)=>e.createElement("img",{key:o,src:nu(n?.url),alt:n.altText||`${z} - Image ${o+1}`,onClick:()=>x(o),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:g===o?`2px solid ${a.themeColor||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),Y=({className:t})=>c?.variants?.edges?.length<=1?null:e.createElement("div",{className:t},e.createElement("div",{className:`${t}-label`,style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},e.createElement("span",{style:{flexShrink:0}},c.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},u?.title)),e.createElement("select",{className:`${t}-select`,value:u?.id||"",onChange:_,style:{appearance:"none",border:"none",background:"transparent",fontWeight:"bold",color:"#000",cursor:"pointer",paddingRight:"20px",position:"absolute",right:0,top:0,bottom:0,width:"100%",opacity:0,zIndex:2}},c?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===d(t)},t.title))),e.createElement("span",{className:`${t}-chevron`,style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Je,null)))),X=({isMobile:t})=>e.createElement(e.Fragment,null,c.options.map((n,o)=>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"}},N[o]||n.values[0])),e.createElement(is,{options:O(n),selectedValue:M(n,o),onChange:e=>{L(o,e)},type:R(n.name),isOptionAvailable:e=>V(o,e),isMobile:t}))))),Z=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-price":"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:t?"center":"baseline",gap:"6px"}},a?.isFreebieTier&&!a.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},tu(a.styles.general.currencySymbol,a.styles.general.currencySymbol),eu(u?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:a.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,u?.compareAtPrice&&parseFloat(u.compareAtPrice)>parseFloat(u?.price)&&e.createElement("div",{className:t?"yt-byob-modal-mobile-compare-price":"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},tu(a.styles.general.currencySymbol,a.styles.general.currencySymbol),eu(u?.compareAtPrice)),e.createElement("div",{className:t?"yt-byob-modal-mobile-current-price":"yt-byob-modal-desktop-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},tu(a.styles.general.currencySymbol,a.styles.general.currencySymbol),eu(u?.price))))),K=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-atc-wrapper":"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:t?"100%":"80%"}},e.createElement("button",{className:t?"yt-byob-modal-mobile-atc-button":"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:a.themeColor||"#111",borderRadius:a.cornerRadius,color:a.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:q?.5:1,cursor:q?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),u?.id&&c&&(w("check"),a.handleAddToBundle(u?.id,c,1),setTimeout(()=>{w("idle"),s(void 0)},500))},disabled:q},a.styles.byob.addToBundleCTAText??"Add to bundle")),J=e.createElement(ns,{className:"yt-byob-modal-desktop-overlay"},e.createElement(os,{$isSmallScreen:f,ref:l},e.createElement(rs,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(f?"small-screen":"large-screen")},e.createElement(ts,{className:"yt-byob-modal-desktop-close",onClick:()=>{s(void 0)},style:{backgroundColor:"white"}},e.createElement(G,{size:"25"})),e.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},e.createElement(U,null)),e.createElement("div",{className:"yt-byob-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-byob-modal-desktop-title"},"variant-display-name"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement(Q,{className:"yt-byob-modal-desktop-rating"}),e.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},"dropdown"===a?.styles?.byob.variantSelectorType&&e.createElement(Y,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===a?.styles?.byob.variantSelectorType&&e.createElement(X,null),e.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(Z,{isMobile:!1}),e.createElement(K,{isMobile:!1}))),e.createElement("div",{className:"yt-byob-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-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:I}})))))),ee=e.createElement(ns,{className:"yt-byob-modal-mobile-overlay"},e.createElement(os,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:f,ref:l},e.createElement(rs,{ref:l,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},e.createElement("button",{className:"yt-byob-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:()=>{s(void 0)}},e.createElement(Ke,{className:"yt-byob-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-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},e.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},e.createElement(U,{isMobile:!0})),e.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:T?`${T+20}px`:"120px"}},e.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},"variant-display-name"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(Q,{className:"yt-byob-modal-mobile-rating"})),e.createElement("div",{className:"yt-byob-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-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:I}})))),e.createElement("div",{className:"yt-byob-modal-mobile-bottom-bar",ref:C,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"===a?.styles?.byob.variantSelectorType?e.createElement(X,{isMobile:!0}):e.createElement(Y,{className:"yt-byob-modal-desktop-variant-selector"}),e.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(Z,{isMobile:!0}),e.createElement(K,{isMobile:!0})))));return D.createPortal(f?ee:J,document.body)}),cs=({coverImageUrl:t,mobileCoverImageUrl:n,alt:o="Background",styles:r})=>{const i=[{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}],a=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality","80"),o.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?i.map(({imageWidth:t,descriptor:n})=>{const o=a(e,t);return o?`${o} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",s=a(c,800)||c,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:s,alt:o,style:{width:"100%",height:"auto",display:"block",...r},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},ss=({title:t,isOpen:n,onToggle:o,children:r})=>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:o,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(Me,{className:"yt-byob-icon-minus",size:20}):e.createElement(_e,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},r)),ds=({availableFilters:n,appliedFilters:o,toggleFilter:r,clearAllFilters:i,applyPriceFilter:a,priceMin:l,setPriceMin:c,priceMax:s,setPriceMax:d,maxPossiblePrice:p,styles:u,availableProductCount:m,products:g,unavailableProductCount:x,storeCurrencyCode:f,showActions:y=!0,openSections:b,toggleSection:h})=>{const[v,w]=t(null),C=tu(u?.general?.currencySymbol,f)??"₹";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(ss,{key:t.id,title:t.label,isOpen:!!b[t.id],onToggle:()=>h(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 i=o[t.id]?.includes(n.id)||!1;return"filter.v.availability.1"===n.id?m??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:i,onChange:()=>r(t.id,n.id),style:{width:"18px",height:"18px",accentColor:u?.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,s.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-s/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>w("min"),onTouchStart:()=>w("min"),onChange:e=>{const t=Math.min(Number(e.target.value),s-10);c(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===v?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:s,onMouseDown:()=>w("max"),onTouchStart:()=>w("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"===v?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 "))))),y&&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:i,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:u?.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:a,style:{flex:1,padding:"8px",background:u?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:u?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},ps=t=>{const{showFiltersDrawer:n,handleClose:o,isAnimating:r,isMobile:i}=t;return n?A(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:r?1:0,transition:"opacity 300ms ease-in-out"},onClick:o},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:i?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(ds,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),o()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},us=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(ds,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},ms=({enableSortAndFilter:o,isMobile:r,setSearchTerm:i,searchTerm:a,styles:l,setSortBy:c,appliedFilters:s,setAppliedFilters:d,availableFilters:p=[],products:u,availableProductCount:m,unavailableProductCount:g,maxPossiblePrice:x,storeCurrencyCode:f,sharedFiltersState:b,openSections:h,toggleSection:v,sortBy:w})=>{const[C,E]=t(!1),[k,T]=t(a),{showFilters:S,setShowFilters:$,priceMax:N,setPriceMax:B,priceMin:z,setPriceMin:I}=b,[F,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!r&&"sidebar"===D,_="none"===D;n(()=>{s["filter.v.price"]||(B(x),I(0))},[x,s]);n(()=>{const e=setTimeout(()=>{i(k)},300);return()=>clearTimeout(e)},[k,i]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const R=Object.entries(s).reduce((e,[t,n])=>"filter.v.price"===t?z>0||N<x?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",alignItems:r?"flex-end":"center",marginBottom:"20px",width:"100%",gap:r?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:o?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},o&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:r?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},r&&!C?e.createElement(Re,{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:r?"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(Re,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),r&&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:()=>$(!S),style:{display:_?"none":"flex",alignItems:"center",gap:r?"0px":"6px",background:S&&A?"#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(Oe,{className:"yt-byob-filter-toggle-icon",size:18}),!r&&"Filters",R>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}},R)),o&&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"}},!r&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),r&&e.createElement(Le,{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:w,onChange:e=>c(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(y,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(ps,{showFiltersDrawer:S,handleClose:()=>{A?$(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{$(!1)},300))},isAnimating:F,isMobile:r,availableFilters:p,appliedFilters:s,toggleFilter:(e,t)=>{d(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{B(x),I(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${N}`],t})},priceMin:z,setPriceMin:I,priceMax:N,setPriceMax:B,maxPossiblePrice:x,styles:l,availableProductCount:m,products:u,unavailableProductCount:g,storeCurrencyCode:f,openSections:h,toggleSection:v}))},gs=()=>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"}})),xs=({title:t,uploadState:n,onUpload:o,onRemove:r,onRetry:i})=>{const a="string"==typeof n?{url:n,name:"Attachment"}:n,l=a?.loading,c=a?.error,s=a?.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",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:600,fontSize:"14px",color:"#1a1a1a"}},t),!a&&!l&&!c&&e.createElement("div",{style:{fontSize:"12px",color:"#888",marginTop:"2px"}},"jpeg/png/img (max size: 5MB)"),l&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"#007bff",fontSize:"12px",marginTop:"4px"}},e.createElement(gs,null)," Uploading ",a?.name||"image","..."),c&&e.createElement("div",{style:{fontSize:"12px",color:"#dc3545",marginTop:"2px"}},"Upload failed."),s&&!l&&!c&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},e.createElement("img",{src:a.url,alt:"Uploaded",style:{width:"36px",height:"36px",objectFit:"cover",borderRadius:"4px",border:"1px solid #eee"}}),e.createElement("span",{style:{fontSize:"12px",color:"#28a745",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},a.name))),e.createElement("div",{style:{flexShrink:0}},c&&e.createElement("button",{type:"button",onClick:i,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Retry"),s&&!l&&!c&&e.createElement("button",{type:"button",onClick:r,style:{fontSize:"13px",fontWeight:600,color:"#fff",background:"#dc3545",border:"none",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Remove"),!a&&!l&&e.createElement("button",{type:"button",onClick:o,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")))},fs=({form:o,formData:i,setFormData:a,barHeight:l=0,isUploading:c,setIsUploading:s})=>{const d=r(new Map),[p,u]=t(!1),m=s??u;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");a(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),m(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",o=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!o.ok)throw new Error("Upload failed");return(await o.json()).url}catch(e){throw alert("Upload failed. Try again."),e}finally{m(!1)}})(n);a(o=>({...o,[e]:{url:t,name:n.name}}))}catch{a(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",{style:{width:"100%",padding:"8px 0",marginBottom:`${l}px`,boxSizing:"border-box"}},o.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,style:{marginBottom:"28px"}},e.createElement("label",{style:{display:"block",fontWeight:700,marginBottom:"10px",color:"#1a1a1a",fontSize:"15px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement("textarea",{key:o,placeholder:t?.title,rows:3,maxLength:500,value:i[o]||"",onChange:e=>a(t=>({...t,[o]: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",null,e.createElement("div",{style:{fontSize:"12px",color:"#888",marginBottom:"10px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement(xs,{key:o,title:t?.title,uploadState:i[o],onUpload:()=>g(o).click(),onRemove:()=>a(e=>{const{[o]:t,...n}=e;return n}),onRetry:()=>g(o).click()})}))))))};function ys({quantity:t,setQuantity:n,remainingQuantity:o,handleAddToBundle:r,variantId:i,product:a,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:s}){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<s;return e.createElement(lc,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const o=Math.max(0,t-1);n(o),l&&i&&l(i,1)},style:d},"-"),e.createElement(cc,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(o,t+1,s);n(l),r&&i&&a&&r(i,a,1)},disabled:!p||c,style:{...d,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const bs=({product:r,styles:i,selectedVariant:a})=>{const[l,c]=t(!1),s=o(()=>nu(a?.image?.url||r?.featuredMedia?.preview?.image?.url||r?.media?.edges?.[0]?.node?.image?.url)||"",[a?.image?.url,r?.featuredMedia?.preview?.image?.url,r?.media?.edges]),d=o(()=>r?.media?.edges?.map(e=>nu(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[r?.media?.edges]),p=o(()=>d?.[1]??s??"",[d,s]);n(()=>{if(s){(new Image).src=s}},[s]);const u=o(()=>s||d?.[0],[s,d]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:i.general.imageAspectRatio||"1/1"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!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&&u!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:u,alt:r.title}),u!==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:r.title})))},hs=({product:o,bundle:r,handleAddToBundle:a,hideAddToBundle:l,remainingQuantity:c,themeColor:s,handleRemoveItem:d,transitionActive:p,idx:u,selecteditems:m,customVariantsQuantity:g,currentProductTier:x,showFreebieTierProductPrices:f,tierIndex:b})=>{const h=se(es),v=r.customizations,w=v?.byob?.variantSelectorType,[C,E]=t(!1),k=v.general?.variantTitleSuffix?o?.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 o=t[e];let r=0;for(;r<n.length&&r<o.length&&n[n.length-1-r]===o[o.length-1-r];)r++;n=n.slice(n.length-r)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),o=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:o,commonSuffix:n.join(" ")}}})})(o?.variants?.edges);if(!k||!k.length)return e.createElement(e.Fragment,null);const T=i(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(r?.customProductsQuantity)return r?.customProductsQuantity;const n=k?.find(t=>t.node.id===e),i=n?.node;return i?o.tracksInventory&&i.inventoryItem?.tracked?i.inventoryQuantity>0?i.inventoryQuantity:i.inventoryQuantity<=0&&"continue"===i.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[k,g,o.tracksInventory]),S=k?.find(e=>T(e.node.id)>0)?.node?.id;if(!S&&!v.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[$,N]=t(k?.find(e=>T(e.node.id)>0)?.node?.id||k[0]?.node?.id),[B,z]=t(0),[I,F]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===$)?.node,_=T($||"");n(()=>{const e=m.find(e=>e.variantId===$&&(void 0===b||e.tierIndex===b));z(e?e.quantity:0)},[m,$,b]),n(()=>{const e=()=>{F(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?D("500"):CSS.supports("font-weight","400")?D("400"):CSS.supports("font-weight","600")&&D("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",P)},[P]),n(()=>{if($&&!k?.some(e=>e.node.id===$)){const e=k.find(e=>T(e.node.id)>0)?.node.id||k[0]?.node?.id;e&&N(e)}},[$,k,T]);const R=o.variants&&o.variants.edges?.length>1&&"customOptions"!==w,O="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,L="53933408435"===O,M="75851235630"===O,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[]})(o),j=V.length>0;return e.createElement(e.Fragment,null,e.createElement(pc,{borderRadius:v?.byob.borderRadius,borderColor:v?.byob.borderColor,shadowType:v?.byob.shadowType,backgroundColor:v?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":u%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(_<=0)return;const e={...o,variants:{...o.variants,edges:k},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:v?.byob?.productCardDetailsAlignment||"left"}},e.createElement(uc,{className:"yt-byob-image-wrapper"},e.createElement(bs,{product:o,styles:v,selectedVariant:A}),r?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:v.byob.borderRadius}},r.productCardBadgeText),R&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(mc,{className:"yt-byob-variant-selector",isCoralHaze:L,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:$||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),N(e.target.value)}},k?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,o=t.node.title.length>n?t.node.title.substring(0,n)+"...":t.node.title;return e.createElement("option",{key:t.node.id,value:t.node.id},o)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(y,null)))),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"},className:"yt-byob-product-details-wrapper"},e.createElement("div",{className:"yt-byob-product-content"},"enabled"===r?.customizations?.byob?.productCardCategoryVisibility&&j&&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"}},V.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:I?"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(gc,{isMobile:I,showBorder:r?.showBorder??!0,style:{...!v?.byob.productsPriceVisibility&&{padding:"8px"},...v?.byob.productTitleFontSize&&{fontSize:v?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:v?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(A?.displayName).replace("- Default Title",""):o.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&v?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:r?.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"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},o?.rating?.averageRating," rating")),"ratingAndReviewCount"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(Ee,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," reviews)"),v?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:r?.showBorder?"0px 10px":"0 4px"}},x?.isFreebieTier&&!f?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"}},tu(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",eu(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:v.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},tu(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",eu(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!x?.isFreebieTier||f)&&A?.compareAtPrice&&v?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},tu(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",eu(A.compareAtPrice)))),(_>0||_===1/0)&&e.createElement(xc,{borderRadius:v?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===B||void 0===B)&&e.createElement(sc,{style:{...!l&&{backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),z(1),(()=>{if(!$)return;"customOptions"===w&&k.length>1?E(!0):a($,o,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},v?.byob.addToBundleCTAText),!r?.disableQuantitySelector&&B>0&&$&&e.createElement(dc,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(ys,{remainingQuantity:c,setQuantity:z,quantity:B,handleAddToBundle:a,variantId:$,product:o,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:_})),r?.disableQuantitySelector&&B>0&&$&&e.createElement(sc,{style:{backgroundColor:"#747474",color:v?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},e.createElement(fc,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(yc,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,B-1);z(t),d&&$&&d($,b)}},e.createElement(Ve,{style:{color:"#fff",fontSize:"20px"}})))),_<=0&&_!==1/0&&e.createElement(sc,{style:{backgroundColor:v.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},v?.general.outOfStockLabel||"Out of Stock")),"customOptions"===w&&C&&k.length>1&&e.createElement(as,{product:o,isOpen:C,onClose:()=>E(!1),variantOptions:r.variantOptions,cta:{textColor:v.general.ctaTextColor,backgroundColor:v.general.primaryColor},onConfirm:e=>{N(e),a(e,o,1)}}))},vs=({currentStep:t,setCurrentProductTier:n,totalSteps:o,tiers:r,isMobile:i,selectedProductsByTier:a,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:s})=>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:o}).map((c,d)=>{const p=d+1,u=!r[d].isFormStep&&r[d].minimumQuantity-(a[d]?.length??0)===0,m=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:i?"4px":"8px"},onClick:()=>!1===s?()=>{}: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:i?"30px":"50px",backgroundColor:m?"#666666":u?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:m?"white":u?`${l}50`:"white",border:`2px solid ${m?"#666666":u?l:"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:m?"#666666":u?l:"#CBD5E0",display:"block",marginRight:d<o?i?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:i?"16px 0px":"15px 0px",fontSize:i?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},r[t]?.title)),ws=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(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",...o].map(o=>{const i=r===o;return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(t.general.primaryColor,.07):"transparent",borderBottom:i?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},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",...o].map(o=>e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:r===o?t?.general.primaryColor:"white",color:r===o?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{r!==o&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{r!==o&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},o.charAt(0).toUpperCase()+o.slice(1)))))},Cs=({bundle:a,selectedItems:l,setSelectedItems:c,handleAddToCart:s,bundleAddToCartLoading:d,renderingOnPage:p,selectedItemsQuantity:u,handleRemoveItem:m,bundleSubtotal:g,dispatchAnalyticsEvent:x,fetchStoreDetails:f,productsPagination:y})=>{const[b,h]=t(void 0),[v,w]=t(window.innerWidth<450),[C,E]=t(0),[k,T]=t({}),S=!!a.personalizedForm?.title&&"productTier"===a.builderTiers?.type,[$,N]=t({}),[B,z]=t(!1),I=S&&C===(a.builderTiers?.productTier?.length||0),F=C===(a.builderTiers?.productTier?.length||0)-1,P=S&&F&&!I,[D,A]=t(a?.products),[_,R]=t(!1),[O,L]=t({}),[M,V]=t(a?.products),[j,W]=t({}),[H,q]=t(y?.cursorData),Q=a.builderTiers?.type,U=a.customizations,Y=a.builderTiers?.productTier??[],G=a.builderTiers?.offerTier??[],[X,Z]=t([]),[K,J]=t(!1),[ee,te]=t("All"),ne=r(null),[oe,re]=t({}),[ie,ae]=t([]),[ce,se]=t(!1),[de,pe]=t(0),[ue,me]=t(0),[xe,fe]=t({}),ye=e=>{fe(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{ie.length>0&&fe(e=>{const t={...e};return ie.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[ie]),n(()=>{!(Object.values(oe).length>0)&&y?.cursorData&&q(y.cursorData)},[oe,y?.cursorData]);const be=a.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;D?.forEach(n=>{const o=n?.productDetails;if(o.metafield&&"yourtoken_bundles_app"===o.metafield.namespace&&"categories"===o.metafield.key){let n=[];if(o.metafield.jsonValue&&Array.isArray(o.metafield.jsonValue))n=o.metafield.jsonValue;else if(o.metafield.value)try{const e=JSON.parse(o.metafield.value);Array.isArray(e)&&(n=e)}catch(e){console.error("Failed to parse categories:",e)}n.length>0&&(t=!0,n.forEach(t=>e.add(t)))}}),Z(Array.from(e)),J(t);U?.byob?.productFiltersDisplay&&"none"!==U?.byob?.productFiltersDisplay&&(async()=>{const e=U?.byob?.productFiltersDisplay??"none";if("drawer"===e||"sidebar"===e)try{const e=await(f?.());e?.productFilters&&ae(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[U?.byob,f,D]),n(()=>{re({})},[C,ee]);const he=((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}))(D.filter(e=>{const t=e.productDetails.status?.toLowerCase(),n="active"===t||"unlisted"===t||void 0===e.productDetails.status||""===e.productDetails.status,o="estailofashion.myshopify.com"!==window?.Shopify?.shop||null!==e?.productDetails?.publishedAt;return n&&o}),ee),ve="productTier"===Q?Y.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===Q?G.reduce((e,t)=>e+t.minimumQuantity,0):a.minimumQuantity,we=i((e,t)=>{const n=be?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const o=(e.variants?.edges||[]).find(e=>e.node.id===t),r=o?.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},[be]),[Ce,Ee]=t(3e3);n(()=>{const e=ie?.find(e=>"PRICE_RANGE"===e.type||"filter.v.price"===e.id);e&&e.values?.[0]?.input?.price?.max&&Ee(e.values[0].input.price.max)},[D,ie]);const[ke,Te]=t(""),[Se,$e]=t(""),Ne=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(he,ke),Be=((e,t)=>[...e].sort((e,n)=>{const o=e?.productDetails?.title?.toLowerCase(),r=n?.productDetails?.title?.toLowerCase(),i=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),a=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return o.localeCompare(r);case"title-desc":return r.localeCompare(o);case"price-low-to-high":return i-a;case"price-high-to-low":return a-i;default:return 0}}))(Ne,Se);n(()=>{(async e=>{if(!y)return;const{initialCursorData:t,cursorData:n,fetchFn:o,setCursorData:r}=y,i="productTier"===Q?Y?.[C]?.tier:1;if(0===Object.values(e)?.length)return void("productTier"===Q?(L(e=>({...e,[C]:j?.[C]||[]})),r(H||{...n})):(A(M),r(H||{1:t?.[1]})));const a=await o(e,i,null);a&&("productTier"===Q?(L(e=>({...e,[C]:a})),A(e=>{const t=new Set(e.map(e=>e.productId)),n=a.filter(e=>!t.has(e.productId));return[...e,...n]})):A(a))})(oe)},[oe]);const[ze,Ie]=le(es),[Fe,Pe]=t(!1);n(()=>{x?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a?._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder"}}),setTimeout(()=>{Pe(!0)},100)},[]);const De=r(null);n(()=>{const e=()=>{w(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(a.coverImageUrl){const e=new Image;e.src=nu(a.coverImageUrl)??"",e.onload=()=>{h(e.width/e.height)}}},[a.coverImageUrl]),n(()=>{Pe(!1),setTimeout(()=>Pe(!0),100)},[C]);const Ae=(e,t)=>{if("productTier"===Q){let n={...k},o=!1;if(n[t]){const r=n[t].indexOf(e);-1!==r&&(n[t]=[...n[t]],n[t].splice(r,1),o=!0)}if(!o)for(let t=Y.length;t>=0;t--){const o=n[t].indexOf(e);if(-1!==o){n[t]=[...n[t]],n[t].splice(o,1);break}}T(n);const r=Y.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==r&&E(r)}m(e,t)},_e=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if(a)return"productTier"!==a?.builderTiers?.type?(A(a?.products??[]),void V(a?.products??[])):void("productTier"===a?.builderTiers?.type&&(L({0:a?.products}),W({0:a?.products})))},[a]),n(()=>{if("productTier"!==Q||!Y[C])return;if(ve===u)return;const e=Y.findIndex((e,t)=>{const n=k[t]||[];return t>=C&&n.length<e.minimumQuantity});if(-1!==e&&e!==C){E(e);const t=Y[C];t?.products?.length>1&&_e()}else if(-1===e&&S&&C<Y.length){Y.every((e,t)=>(k[t]?.length||0)>=e.minimumQuantity)&&E(Y.length)}},[k,Y,Q,S]),n(()=>{Te("")},[C]),n(()=>{function e(e){if(!De.current||!e.target)return;!De.current.contains(e.target)&&Ie(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const Re=(e,t,n)=>{var o;"productTier"===Q&&(o=e,T(e=>{const t={...e},n=Y.findIndex((e,n)=>{const o=t[n]||[];return n>=C&&o.length<e.minimumQuantity}),r=-1!==n?n:C;return-1!==n&&E(n),t[r]||(t[r]=[]),t[r].push(o),t}));const r=!0===Y[C]?.isFreebieTier;x?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),ou(e,t,n,l,c,r,C)},Oe=(()=>{if(!a?.builderTiers)return a.minimumQuantity;const{type:e,offerTier:t,productTier:n}=a.builderTiers,o="offerTier"===e?t:"productTier"===e?n:null;if(!o)return a.minimumQuantity;let r=0;return o.map(e=>{r+=e.minimumQuantity}),r})(),Le=v&&a.mobileCoverImageUrl?nu(a.mobileCoverImageUrl):nu(a.coverImageUrl??"")||null,Me=i(e=>{const t=U?.general?.showOutOfStockProducts;if(t)return!0;const n=e?.productDetails,o=n?.variants?.edges||[];if(be){if(o.some(e=>be.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return o.some(e=>we(n,e.node.id)>0)},[U?.general?.showOutOfStockProducts,be,we]),Ve=o(()=>{if("productTier"===Q&&Y.length>0){const e=O?.[C]??[];return Se?Be.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Me(t)):e.map(e=>Be.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Me(e))}return Be.filter(Me)},[Q,Y,O,C,Be,Me,Se]),je=Ve;n(()=>{if("productTier"!==Q)return;const e=Y[C];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;if(1!==O?.[C]?.length)return;const t=e.products[0],n=D.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const o=n.variants?.edges?.find(e=>we(n,e.node.id)>0)?.node;if(!o)return;const r=o.id,i=k[C]?.includes(r);if(!i&&(Re(r,n,1),C<Y.length-(S?0:1))){E(C+1);const e=Y?.[C];e?.products?.length>1&&_e()}},[Q,Y,C,D,k,we,Re]);const We=o(()=>he.filter(e=>{const t=e?.productDetails;return(t.variants?.edges||[]).some(e=>we(t,e.node.id)>0)}).length,[he,we]),He=o(()=>he.length-We,[he,We]),qe="bundles"==a.appName?a.pageHeader?.title:a?.title,Qe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;n(()=>{if(!y)return;const{cursorData:e,fetchFn:t}=y,n=Y[C]?.tier,o="productTier"===Q?n:1;if(e?.[o]&&!e?.[o]?.hasNext||!t)return;const r=new IntersectionObserver(async([n])=>{if(n.isIntersecting&&!_){R(!0);try{const n=await t(oe,o,e?.[o]?.cursor);if(n?.length>0){const e=Object.values(oe).length>0;"productTier"===Q?(L(e=>({...e,[C]:[...e[C]||[],...n]})),e||W(e=>({...e,[C]:[...e[C]||[],...n]})),A(e=>[...e,...n])):(A(e=>[...e,...n]),e||V(e=>[...e,...n]))}}catch(e){console.error("Pagination fetch failed:",e)}finally{R(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),i=ne.current;return i&&r.observe(i),()=>{i&&r.unobserve(i)}},[y,_,Q,C,Y]);const Ue=()=>{x?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.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",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:U.byob.sectionBackgroundColor,..."transparent"!==U.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Le?e.createElement("div",{className:"yt-byob-cover-image-container",style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...a?.coverImageVerticalMargin&&{marginBottom:a?.coverImageVerticalMargin,marginTop:a?.coverImageVerticalMargin}}},Le&&e.createElement(cs,{coverImageUrl:Le,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:U?.byob?.titleFontSize??"3rem",fontWeight:"700",color:U?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:U?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},qe),e.createElement("span",{style:{lineHeight:"normal",fontSize:U?.byob?.subtitleFontSize??"1.5rem",color:U?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Qe))):(qe||Qe)&&e.createElement("div",{className:"yt-byob-header-content",style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},qe&&e.createElement("span",{className:"bundle-builder-title",style:{lineHeight:"normal",fontSize:U?.byob?.titleFontSize??"3rem",fontWeight:"700",color:U?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:U?.byob?.titleBackgroundColor??"transparent"}},qe),Qe&&e.createElement("span",{className:"bundle-builder-subtitle",style:{lineHeight:"normal",fontSize:U?.byob?.subtitleFontSize??"1.5rem",color:U?.byob?.titleTextColor??"#000"}},Qe)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===Q&&Y.length>0&&U?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-stepper-wrapper"},e.createElement(vs,{currentStep:C,totalSteps:Y.length+(S?1:0),tiers:S?[...Y,{title:a.personalizedForm?.title||"Personalize",tier:Y.length,minimumQuantity:0,products:[],isFormStep:!0}]:Y,isMobile:v,primaryColor:U?.general?.primaryColor,primaryTextColorCta:U?.general?.primaryContrastColor,setCurrentProductTier:E,selectedProductsByTier:k,tierNavigation:U.byob.tierNavigation})))),e.createElement("div",{className:"yt-byob-layout-wrapper",style:{display:"flex",flexDirection:"row",width:v?"100%":"90%",marginInline:"auto"}},"sidebar"===U?.byob?.productFiltersDisplay&&!v&&!I&&e.createElement(us,{showFiltersDrawer:ce,handleClose:()=>se(!1),isAnimating:!1,isMobile:!1,availableFilters:ie,appliedFilters:oe,toggleFilter:(e,t)=>{re(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{re({}),me(0),pe(Ce)},applyPriceFilter:()=>{re(e=>{const t={...e};return t["filter.v.price"]=[`min:${ue}-max:${de}`],t})},priceMin:ue,setPriceMin:me,priceMax:de,setPriceMax:pe,maxPossiblePrice:Ce,styles:U,products:D,unavailableProductCount:He,storeCurrencyCode:a?.storeCurrencyCode,openSections:xe,toggleSection:ye}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!I&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(ms,{enableSortAndFilter:a?.enableSortAndFilter??!1,isMobile:v,searchTerm:ke,setSearchTerm:Te,setSortBy:$e,styles:U,appliedFilters:oe,setAppliedFilters:re,availableFilters:ie,products:D,availableProductCount:We,unavailableProductCount:He,maxPossiblePrice:Ce,storeCurrencyCode:a?.storeCurrencyCode,sharedFiltersState:{showFilters:ce,setShowFilters:se,priceMax:de,setPriceMax:pe,priceMin:ue,setPriceMin:me},openSections:xe,toggleSection:ye}),a?.customizations?.byob?.enableProductCategories&&K&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(ws,{styles:U,isMobile:v,categories:X,activeCategory:ee,onCategoryChange:e=>{te(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:ce&&"sidebar"===U?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},I&&a.personalizedForm?.title?e.createElement(fs,{form:a.personalizedForm,formData:$,setFormData:N,isUploading:B,setIsUploading:z}):0!==je?.length||_?Ve.map((t,n)=>{if("productTier"===Q){const o=(Y[C]?.minimumQuantity??0)>(k[C]?.length??0),r=Be.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return r?e.createElement(hs,{bundle:a,idx:n,key:t?.variantIds?.[0]??t.productId,product:r?.productDetails,handleAddToBundle:Re,hideAddToBundle:!o,remainingQuantity:Oe-u,themeColor:a?.dealTextColor,handleRemoveItem:e=>Ae(e,C),selecteditems:l,transitionActive:Fe,customVariantsQuantity:be,currentProductTier:Y[C],showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:C}):null}return e.createElement(hs,{bundle:a,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:Re,hideAddToBundle:u>=Oe,remainingQuantity:Oe-u,themeColor:a?.dealTextColor,handleRemoveItem:m,selecteditems:l,transitionActive:Fe,customVariantsQuantity:be,tierIndex:C})}):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:()=>{re({}),me(0),pe(Ce)},style:{padding:"8px 16px",background:U?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:U?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px"}},"Clear All Filters")),!I&&_&&e.createElement("div",{className:"yt-byob-loading-wrapper",style:{width:"100%",display:"flex",justifyContent:"center",padding:"20px"}},e.createElement(ge,{color:U?.general?.primaryColor||"#333",size:30})),e.createElement("div",{ref:ne,className:"yt-byob-pagination-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null))),!p&&e.createElement(Jc,{builderTiers:a?.builderTiers,showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void _e();const t={};S&&Object.entries($).forEach(([e,n])=>{const o=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[o]=n:n&&"object"==typeof n&&"url"in n&&(t[o]=n.url)}),await s(e,t),Ue()},minimumQuantity:ve,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,handleRemoveItem:m,handleRemoveItemProductTier:Ae,selectedItemsQuantity:u,percentageOff:a.percentageOff,loading:d,bundleSubtotal:g,amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:a?.dealTextColor??"#333",primaryTextColorCta:a?.primaryTextColorCta??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:k,renderingOnPage:p,isUploading:B}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(Jc,{showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void _e();const t={};S&&Object.entries($).forEach(([e,n])=>{const o=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[o]=n:n&&"object"==typeof n&&"url"in n&&(t[o]=n.url)}),await s(e,t),Ue()},minimumQuantity:ve,builderTiers:a?.builderTiers,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,loading:d,handleRemoveItem:m,handleRemoveItemProductTier:Ae,percentageOff:a.percentageOff,selectedItemsQuantity:u??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:U?.general.primaryColor||"#000",primaryTextColorCta:U.general.primaryContrastColor??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:k,renderingOnPage:p,isUploading:B})))),ze&&void 0!==u&&(()=>{let t=u<a.minimumQuantity;return"productTier"==Q?t=(Y[C]?.minimumQuantity??0)>(k[C]?.length??0):"offerTier"==Q&&(t=u<G.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(ls,{handleAddToBundle:Re,ref:De,remainingQuantity:a.minimumQuantity-u,hideAddToBundle:!t,disableQuantitySelector:a?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:k,themeColor:U?.general.primaryColor||"#000",primaryTextColorCta:a?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:U?.general.primaryColor||"#000",cornerRadius:a?.customizations.byob.borderRadius,styles:a.customizations,reviewRatingType:a?.reviewRatingType??"none",customVariantsQuantity:be,bundleProductsCustomQuantity:a?.customProductsQuantity,isFreebieTier:Y?.[C]?.isFreebieTier,showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:a?.variantOptions})})()))},Es=({isOpen:o,onClose:r,formConfig:i,onCheckout:a,cta:l,isMobile:c})=>{const[s,d]=t({}),[p,u]=t(!1);n(()=>{o||d({})},[o]);const m=e=>{if(p)return;const t={};Object.entries(s).forEach(([e,n])=>{const o=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[o]=n:n&&"object"==typeof n&&"url"in n&&(t[o]=n.url)}),a(e?{}:t)};if(!o)return null;const g=e.createElement("div",{onClick:r,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:c?"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",{onClick:e=>e.stopPropagation(),style:{background:"white",width:c?"100vw":"500px",maxWidth:c?"100vw":"560px",height:c?"80vh":"auto",maxHeight:c?"80vh":"90vh",borderRadius:c?"20px 20px 0 0":"20px",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:999,animation:c?"slideUp 0.3s ease-out":"fadeIn 0.2s ease-out"}},e.createElement("div",{style:{width:"100%",padding:c?"20px 20px 16px":"18px 20px",fontWeight:700,fontSize:c?"18px":"16px",textAlign:"center",position:"relative",borderBottom:"1px solid #eee",flexShrink:0,backgroundColor:"#ffffff",color:"#1a1a1a",boxSizing:"border-box",lineHeight:"1.4"}},i.title||"Personalization",!c&&e.createElement("button",{onClick:r,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",{style:{flex:1,overflowY:"auto",padding:c?"20px 20px":"16px 20px"}},e.createElement(fs,{form:i,formData:s,setFormData:d,isUploading:p,setIsUploading:u})),e.createElement("div",{style:{padding:c?"12px 16px":"12px 24px 16px",borderTop:"1px solid #eee",flexShrink:0,background:"white",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"}},e.createElement("button",{onClick:()=>{m(),r()},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(ge,{color:l.textColor,size:15}):"Submit"),e.createElement("button",{onClick:()=>{m(!0),r()},style:{background:"none",border:"none",fontSize:"14px",fontWeight:600,color:"#1a1a1a",cursor:"pointer",padding:"4px 8px",textAlign:"center"}},"Add without customization"))));return D.createPortal(g,document.body)},ks=({product:t,selectedVariantId:n,onVariantChange:r,styles:i,originalPrice:a,dealPrice:l,totalPriceSum:c,isVertical:s=!1,variantOptions:d,storeCurrencyCode:p})=>{const u=o(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),o=n?.node;return o?t.productDetails.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t.productDetails]),m=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;u(n);const g=o(()=>{if(m?.title&&t.productDetails.options){const e=m.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[m,t.productDetails.options]),x=e=>{r(e)};return s?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%"}},i.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:nu(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:i.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"}},t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(e.Fragment,null,e.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null)))))),(i.comboBundle.subProductsProductTitleVisibility||i.comboBundle.subProductsProductPriceVisibility)&&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"}},i.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),i.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"}},tu(i.general.currencySymbol,p),eu((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==i.comboBundle.discountBadgeVisibility&&("discount-on-compare"===i.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},tu(i.general.currencySymbol,p),eu(m?.compareAtPrice?m.compareAtPrice:m?.price)):Number(l)<Number(c)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},tu(i.general.currencySymbol,p),eu(m?.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"===i.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===i.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"}},i.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:nu(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===i.comboBundle?.infoAlignment?"flex-start":"right"===i.comboBundle?.infoAlignment?"flex-end":"center"===i.comboBundle?.infoAlignment?"flex-start":void 0}},i.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," "),"dropdown"!==i.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.filter(e=>"Default Title"!==e.node.title).length>0&&d&&g&&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"}},g.length>1?g.join(" / "):g)),i.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"}},tu(i.general.currencySymbol,p),eu((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==i.comboBundle.discountBadgeVisibility&&("discount-on-compare"===i.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},tu(i.general.currencySymbol,p),eu(m?.compareAtPrice?m?.compareAtPrice:m?.price)):Number(l)<Number(c)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},tu(i.general.currencySymbol,p),eu(m?.price)))),t.productDetails.variants.edges.length>1&&("dropdown"===i.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("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,o)=>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(r=>{const a=[...g];a[o]=r;const l=t.productDetails.options.length>0?a.join(" / "):a[o],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?u(c.id):0),p=g[o]===r,m=d&&d?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&x(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},m?.values.find(e=>e.name===r)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:m?.values.find(e=>e.name===r)?.value}},e.createElement("span",null)):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):m&&"image"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&x(c.id)},disabled:s,style:{border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:p&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},m?.values.find(e=>e.name===r)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:nu(m?.values.find(e=>e.name===r)?.value||"/placeholder.svg"),alt:r,style:{width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&x(c.id)},disabled:s,style:{padding:"4px 8px",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},r)}))))):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 o=0===u(t?.node?.id);return e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${o?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>x(t?.node?.id),disabled:o,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:o?"#ccc":"#707070",cursor:o?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:o?.5:1}},t?.node?.title)}))))))},Ts=({bundle:r,addToCartFunction:i,dispatchAnalyticsEvent:a})=>{const[l,c]=t(!1),[s,d]=t(window.innerWidth<786),[p,u]=t(!1),m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),[g,x]=t(()=>{const e={};return r.products.forEach((t,n)=>{const o=t.productDetails?.variants?.edges?.find(e=>m(t.productDetails,e?.node?.id)>0)?.node;e[n]=o?o.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e});n(()=>(i&&(window.ytComboBundle={bundle:r,addToCart:i,selectedVariants:g},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}))}),[r,i,g]);const f=r.products?.every((e,t)=>{const n=g[t];return m(e.productDetails,n)>0}),y=(e,t)=>{x(n=>({...n,[e]:t}))},b=async e=>{const t=Object.entries(g).map(([e])=>({id:r.products[parseInt(e)].productId,title:r.products[parseInt(e)]?.productDetails?.title}));a?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"combo-bundle",selectedProducts:t}});try{if(c(!0),!i)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const t=Object.entries(g).map(([e,t])=>{const n=r.products[parseInt(e)],o=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return o?{variantId:t,price:Number(o.price)}:null}).filter(e=>null!==e),n=Object.values(g);await i(Number(h),n,Number(v),t,e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)},{originalPrice:h,dealPrice:v,offerValue:w,totalPriceSum:C,offerPercentage:E}=o(()=>{const{price:e,compareAtPrice:t}=Object.entries(g).reduce((e,[t,n])=>{const o=r.products[parseInt(t)],i=o.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(i?.price??"0"),l=parseFloat(i?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=r?.customizations?.comboBundle?.discountBadgeDisplay,o="discount-on-price"===n?e:t;let i=e;r?.percentageOff?i=e*(1-r.percentageOff/100):r?.dealAmount?i=r.dealAmount:r?.amountOff&&(i=e-r.amountOff);const a=o-i,l=o>0?Math.round((o-i)/o*100):0;return{originalPrice:o.toFixed(2),dealPrice:i.toFixed(2),offerValue:a.toFixed(2),totalPriceSum:e.toFixed(2),offerPercentage:l}},[g,r.products,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.comboBundle?.discountBadgeDisplay]);n(()=>{a?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"combo-bundle"}});const e=()=>{d(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const k=r.customizations,T=k.comboBundle?.comboCardStyle||"auto",S="vertical"===T||"auto"===T&&!s,$=k.comboBundle?.embedContentVisibility,N="bundles"==r.appName?r.pageHeader?.title:r?.title,B="bundles"==r.appName?r.pageHeader?.description:r?.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"}},$&&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}},N)),$&&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"}},tu(k.general.currencySymbol,r.storeCurrencyCode),eu(v)),!isNaN(Number(h))&&!isNaN(Number(v))&&Number(h)>Number(v)&&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"}},tu(k.general.currencySymbol,r.storeCurrencyCode),eu(h)),Number(w)>0&&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"}},"discount-on-compare"===k.comboBundle.discountBadgeDisplay?`${E}% Off`:r?.percentageOff?`${r?.percentageOff}% Off`:r?.amountOff?`${tu(k.general.currencySymbol,r.storeCurrencyCode)}${eu(r?.amountOff)} Off`:`Save ${tu(k.general.currencySymbol,r.storeCurrencyCode)}${eu(w)}`))),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,S?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(s?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},r.products.map((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===g[n])?.node;return o?e.createElement(ks,{key:`combo-product-${n}-${t.productId}`,product:t,styles:k,originalPrice:h,dealPrice:v,totalPriceSum:C,selectedVariantId:g[n],onVariantChange:e=>y(n,e),isVertical:S,variantOptions:r.variantOptions,storeCurrencyCode:r.storeCurrencyCode}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(s?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},k.comboBundle.subProductsSectionVisibility&&r.products.map((t,n)=>e.createElement(ks,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:k,originalPrice:h,dealPrice:v,totalPriceSum:C,selectedVariantId:g[n],onVariantChange:e=>y(n,e),variantOptions:r.variantOptions})))),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",{className:`yt-comboBundle-bundle-cta-button ${f?"":"yt-comboBundle-bundle-cta-button-disabled"} ${s?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:f?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor,color:k.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:k.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:f?"pointer":"not-allowed",border:`1px solid ${f?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor}`,boxShadow:k.general.ctaShadowType,padding:k.general?.ctaPadding,width:k.general?.ctaWidth,margin:"0"},disabled:!f,onMouseOver:e=>{k.general.customizeHoverState&&f&&(e.currentTarget.style.backgroundColor=k.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=k.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{k.general.customizeHoverState&&f&&(e.currentTarget.style.backgroundColor=k.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=k.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{r?.personalizedForm?.title?u(!0):await b()}},l?e.createElement(ge,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,f?k.comboBundle?.ctaTitle??"Add Bundle to cart":k.general.outOfStockLabel||"Out of Stock"," "))),$&&k.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},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"}},e.createElement("p",null,B))),r?.personalizedForm?.title&&e.createElement(Es,{isOpen:p,onClose:()=>u(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await b(e),u(!1)},cta:{backgroundColor:k.general?.ctaBackgroundColor||"#121212",textColor:k.general?.ctaTextColor||"#FFFFFF"},isMobile:s}))},Ss=c.div`
3153
+ `;const is=({options:t,selectedValue:n,onChange:o,type:r="text",isOptionAvailable:i,isMobile:a})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const a=!i||i(t.name);return e.createElement("div",{key:t.name,onClick:()=>{a&&o(t)},style:{cursor:a?"pointer":"not-allowed"}},((t,n)=>{const o=!i||i(t.name),a={cursor:o?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:o?1:.5};if("color"===r)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:{...a,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name);return"image"===r?e.createElement("img",{src:bn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...a,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):e.createElement("div",{style:{...a,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"}},t.name)})(t,n?.name===t.name))})),as=({product:r,isOpen:i,onClose:a,variantOptions:l,cta:c,onConfirm:s})=>{const d=o(()=>e=>e?r?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[r?.tracksInventory]),p=o(()=>{const e=r.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):r.options?.map(e=>e.values[0])||[]},[r,d]),[u,m]=t(p),[g,x]=t(window.innerWidth<1024);n(()=>{const e=()=>x(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&a()};return i&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i,a]);const f=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,y=f?.image?.url||r.featuredMedia?.preview?.image?.url,b=bn(y,150,85,"webp"),h=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}})},w=(e,t)=>{const n=u[t];if(!n)return null;return v(e).find(e=>e.name===n)||null};if(!i)return null;const C=e.createElement("div",{onClick:a,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:r.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"}},r.title))),e.createElement("div",{style:{padding:"20px"}},r.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"}},w(t,n)?.name||t.values[0])),e.createElement(is,{options:v(t),selectedValue:w(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n)})(n,e)},type:h(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...u];n[e]=t;const o=r.options?.length>0?n.join(" / "):n[0],i=r.variants.edges.find(e=>e.node.title===o)?.node;return!!i&&d(i)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=r.variants.edges.find(e=>e.node.title===(r.options?.length>0?u.join(" / "):u[0]))?.node,t=!!e&&d(e)>0;if(e?.id&&t)s(e.id),a();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",u);const e=r.variants.edges.find(e=>d(e.node)>0)?.node.id;e&&(s(e),a())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:c.backgroundColor,color:c.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"}},"Add to Bundle")));return D.createPortal(C,document.body)},ls=l((a,l)=>{const[c,s]=le(es),d=o(()=>e=>{const t=a?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:a?.bundleProductsCustomQuantity?a?.bundleProductsCustomQuantity:e?c?.tracksInventory&&e.inventoryItem?.tracked?e.inventoryQuantity>0?e.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[c?.tracksInventory,a?.customVariantsQuantity,a?.bundleProductsCustomQuantity]),p=c?.variants.edges?.filter(e=>d(e.node)>0)||[],[u,m]=t(p?.[0]?.node),[g,x]=t(0),[f,y]=t("undefined"!=typeof window&&window.innerWidth<=600),[b,h]=t(1),[v,w]=t("idle"),C=r(null),E=r(null),k=r(!1),[T,S]=t(0),[$,N]=t(),B=o(()=>{const e=c?.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):c?.options?.map(e=>e.values[0])||[]},[c,d]),[z,I]=t(B);n(()=>{if(c){const e=c.variants.edges?.filter(e=>d(e.node)>0),t=c?.selectedVariant??e[0]?.node;m(t),t?.title&&"Default Title"!==t.title&&I(t.title.split(" / "))}},[c,d]),n(()=>{const e=a.selectedProducts.find(e=>e.variantId===u?.id);h(e?e.quantity:0)},[b,a.selectedProducts,u]),n(()=>{if(E.current&&-1!==g&&k.current){const e=E.current.children;e[g]&&e[g].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),k.current=!1}},[g]);if(n(()=>{const e=()=>y(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:F,descriptionHtml:P,media:A,variants:_}=c,R=A.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0),O=i(e=>{const t=e.target.value,n=p?.find(e=>e.node.id===t)?.node;n&&d(n)>0&&(k.current=!0,m(n),N(n?.image?.url),n.title&&"Default Title"!==n.title&&I(n.title.split(" / ")))},[p,d]),L=i(e=>{if(!a.bundleVariantOptions?.options)return"text";const t=a.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[a.bundleVariantOptions]),M=i(e=>{if(!a?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=a?.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}})},[a.bundleVariantOptions]),V=i((e,t)=>{const n=[...z];n[e]=t.name,I(n);const o=c?.options?.length>0?n.join(" / "):n[0],r=c?.variants.edges.find(e=>e.node.title===o)?.node;N(r?.image?.url),r&&d(r)>0&&(k.current=!0,m(r))},[z,c,d]),j=i((e,t)=>{const n=z[t];if(!n)return null;return M(e).find(e=>e.name===n)||null},[z,M]),W=i((e,t)=>{const n=[...z];n[e]=t;const o=c?.options?.length>0?n.join(" / "):n[0],r=c?.variants.edges.find(e=>e.node.title===o)?.node;return!!r&&d(r)>0},[z,c,d]);n(()=>{if(c){document.body.style.overflow="hidden",window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{s(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()}}},[c,s]),n(()=>{if(f&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[f,c]);const H=a.selectedProducts.filter(e=>e.variantId===u?.id).reduce((e,t)=>e+t.quantity,0),q=a.customVariantsQuantity?.find(e=>e.variantId===u?.id)?.quantity??a.bundleProductsCustomQuantity??1/0,Q=q!==1/0&&H>=q,U=a.hideAddToBundle||!u||d(u)<=0||Q||"idle"!==v||a?.disableQuantitySelector&&1===b,Y=({className:t})=>{const n=c?.rating?.averageRating??a?.rating?.averageRating??0,o=c?.rating?.ratingCount??a?.rating?.ratingCount??0;return n<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===a.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},n," rating")),"ratingAndReviewCount"===a.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14}),n,e.createElement(Ee,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",o," reviews)"))},X=({isMobile:t})=>e.createElement(e.Fragment,null,e.createElement("div",{style:{position:t?"relative":void 0}},t?e.createElement("div",{ref:E,style:{display:"flex",flexDirection:"row",overflowX:"auto",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},R.length>0&&R.map((t,n)=>e.createElement("div",{key:n,style:{width:"100%",flex:"0 0 auto",scrollSnapAlign:"center",objectFit:"contain",maxHeight:"50vh",zIndex:999}},e.createElement(ft,{small:ou(t?.url),medium:ou(t?.url),large:ou(t?.url),alt:t.altText||`${F} - Image ${n+1}`,hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image"})))):e.createElement(e.Fragment,null,e.createElement(ft,{small:ou($??"")||ou(R[g]?.url),medium:ou($??"")||ou(R[g]?.url),large:ou($??"")||ou(R[g]?.url),hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image main-image"}),e.createElement("div",{style:{display:"flex",flexDirection:"row",overflowX:"auto",gap:t?"8px":"12px",padding:"12px 0",WebkitOverflowScrolling:"touch",scrollSnapType:"x mandatory",scrollbarWidth:"none",msOverflowStyle:"none"}},R.length>1&&R.filter(e=>e?.url?.length>0).map((n,o)=>e.createElement("img",{key:o,src:ou(n?.url),alt:n.altText||`${F} - Image ${o+1}`,onClick:()=>x(o),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:g===o?`2px solid ${a.themeColor||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),Z=({className:t})=>c?.variants?.edges?.length<=1?null:e.createElement("div",{className:t},e.createElement("div",{className:`${t}-label`,style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},e.createElement("span",{style:{flexShrink:0}},c.options[0].name," :"," ",e.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},u?.title)),e.createElement("select",{className:`${t}-select`,value:u?.id||"",onChange:O,style:{appearance:"none",border:"none",background:"transparent",fontWeight:"bold",color:"#000",cursor:"pointer",paddingRight:"20px",position:"absolute",right:0,top:0,bottom:0,width:"100%",opacity:0,zIndex:2}},c?.variants?.edges?.map(({node:t})=>e.createElement("option",{key:t.id,value:t.id,disabled:0===d(t)},t.title))),e.createElement("span",{className:`${t}-chevron`,style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(Je,null)))),K=({isMobile:t})=>e.createElement(e.Fragment,null,c.options.map((n,o)=>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"}},z[o]||n.values[0])),e.createElement(is,{options:M(n),selectedValue:j(n,o),onChange:e=>{V(o,e)},type:L(n.name),isOptionAvailable:e=>W(o,e),isMobile:t}))))),J=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-price":"yt-byob-modal-desktop-price",style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"row",alignItems:t?"center":"baseline",gap:"6px"}},a?.isFreebieTier&&!a.showFreebieTierProductPrices?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"20px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},nu(a.styles.general.currencySymbol,a.styles.general.currencySymbol),tu(u?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:a.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,u?.compareAtPrice&&parseFloat(u.compareAtPrice)>parseFloat(u?.price)&&e.createElement("div",{className:t?"yt-byob-modal-mobile-compare-price":"yt-byob-modal-desktop-compare-price",style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},nu(a.styles.general.currencySymbol,a.styles.general.currencySymbol),tu(u?.compareAtPrice)),e.createElement("div",{className:t?"yt-byob-modal-mobile-current-price":"yt-byob-modal-desktop-current-price"},e.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},nu(a.styles.general.currencySymbol,a.styles.general.currencySymbol),tu(u?.price))))),ee=({isMobile:t})=>e.createElement("div",{className:t?"yt-byob-modal-mobile-atc-wrapper":"yt-byob-modal-desktop-atc-wrapper yt-product-modal-atc-wrapper",style:{width:t?"100%":"80%"}},e.createElement("button",{className:t?"yt-byob-modal-mobile-atc-button":"yt-byob-modal-desktop-atc-button yt-product-modal-atc-button",style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:a.themeColor||"#111",borderRadius:a.cornerRadius,color:a.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:U?.5:1,cursor:U?"not-allowed":"pointer"},onClick:e=>{e.stopPropagation(),e.preventDefault(),u?.id&&c&&(w("check"),a.handleAddToBundle(u?.id,c,1),setTimeout(()=>{w("idle"),s(void 0)},500))},disabled:U},a.styles.byob.addToBundleCTAText??"Add to bundle")),te=e.createElement(ns,{className:"yt-byob-modal-desktop-overlay"},e.createElement(os,{$isSmallScreen:f,ref:l},e.createElement(rs,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(f?"small-screen":"large-screen")},e.createElement(ts,{className:"yt-byob-modal-desktop-close",onClick:()=>{s(void 0)},style:{backgroundColor:"white"}},e.createElement(G,{size:"25"})),e.createElement("div",{className:"yt-byob-modal-desktop-image-section image-section"},e.createElement(X,null)),e.createElement("div",{className:"yt-byob-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-byob-modal-desktop-title"},"variant-display-name"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement(Y,{className:"yt-byob-modal-desktop-rating"}),e.createElement("div",{className:"yt-byob-modal-desktop-variant-price-wrapper",style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},"dropdown"===a?.styles?.byob.variantSelectorType&&e.createElement(Z,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===a?.styles?.byob.variantSelectorType&&e.createElement(K,null),e.createElement("div",{className:"yt-byob-modal-desktop-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(J,{isMobile:!1}),e.createElement(ee,{isMobile:!1}))),e.createElement("div",{className:"yt-byob-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-byob-modal-desktop-description yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:P}})))))),ne=e.createElement(ns,{className:"yt-byob-modal-mobile-overlay"},e.createElement(os,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:f,ref:l},e.createElement(rs,{ref:l,className:"yt-byob-modal-mobile-container yt-variant-selection-modal"},e.createElement("button",{className:"yt-byob-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:()=>{s(void 0)}},e.createElement(Ke,{className:"yt-byob-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-byob-modal-mobile yt-variant-selection-modal small-screen",style:{padding:"0px"}},e.createElement("div",{className:"yt-byob-modal-mobile-image-section image-section"},e.createElement(X,{isMobile:!0})),e.createElement("div",{className:"yt-byob-modal-mobile-details-section details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:T?`${T+20}px`:"120px"}},e.createElement("h2",{className:"yt-byob-modal-mobile-title",style:{margin:"0px"}},"variant-display-name"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===a?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(Y,{className:"yt-byob-modal-mobile-rating"})),e.createElement("div",{className:"yt-byob-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-byob-modal-mobile-description yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:P}})))),e.createElement("div",{className:"yt-byob-modal-mobile-bottom-bar",ref:C,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"===a?.styles?.byob.variantSelectorType?e.createElement(K,{isMobile:!0}):e.createElement(Z,{className:"yt-byob-modal-desktop-variant-selector"}),e.createElement("div",{className:"yt-byob-modal-mobile-price-atc-wrapper",style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},e.createElement(J,{isMobile:!0}),e.createElement(ee,{isMobile:!0})))));return D.createPortal(f?ne:te,document.body)}),cs=({coverImageUrl:t,mobileCoverImageUrl:n,alt:o="Background",styles:r})=>{const i=[{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}],a=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality","80"),o.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?i.map(({imageWidth:t,descriptor:n})=>{const o=a(e,t);return o?`${o} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",s=a(c,800)||c,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:s,alt:o,style:{width:"100%",height:"auto",display:"block",...r},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},ss=({title:t,isOpen:n,onToggle:o,children:r})=>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:o,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(Me,{className:"yt-byob-icon-minus",size:20}):e.createElement(_e,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},r)),ds=({availableFilters:n,appliedFilters:o,toggleFilter:r,clearAllFilters:i,applyPriceFilter:a,priceMin:l,setPriceMin:c,priceMax:s,setPriceMax:d,maxPossiblePrice:p,styles:u,availableProductCount:m,products:g,unavailableProductCount:x,storeCurrencyCode:f,showActions:y=!0,openSections:b,toggleSection:h})=>{const[v,w]=t(null),C=nu(u?.general?.currencySymbol,f)??"₹";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(ss,{key:t.id,title:t.label,isOpen:!!b[t.id],onToggle:()=>h(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 i=o[t.id]?.includes(n.id)||!1;return"filter.v.availability.1"===n.id?m??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:i,onChange:()=>r(t.id,n.id),style:{width:"18px",height:"18px",accentColor:u?.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,s.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-s/p*100+"%"}}),e.createElement("input",{type:"range",min:0,max:p,value:l,onMouseDown:()=>w("min"),onTouchStart:()=>w("min"),onChange:e=>{const t=Math.min(Number(e.target.value),s-10);c(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"min"===v?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:s,onMouseDown:()=>w("max"),onTouchStart:()=>w("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"===v?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 "))))),y&&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:i,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:u?.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:a,style:{flex:1,padding:"8px",background:u?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:u?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},ps=t=>{const{showFiltersDrawer:n,handleClose:o,isAnimating:r,isMobile:i}=t;return n?A(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:r?1:0,transition:"opacity 300ms ease-in-out"},onClick:o},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:i?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(ds,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),o()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},us=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(ds,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},ms=({enableSortAndFilter:o,isMobile:r,setSearchTerm:i,searchTerm:a,styles:l,setSortBy:c,appliedFilters:s,setAppliedFilters:d,availableFilters:p=[],products:u,availableProductCount:m,unavailableProductCount:g,maxPossiblePrice:x,storeCurrencyCode:f,sharedFiltersState:b,openSections:h,toggleSection:v,sortBy:w})=>{const[C,E]=t(!1),[k,T]=t(a),{showFilters:S,setShowFilters:$,priceMax:N,setPriceMax:B,priceMin:z,setPriceMin:I}=b,[F,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!r&&"sidebar"===D,_="none"===D;n(()=>{s["filter.v.price"]||(B(x),I(0))},[x,s]);n(()=>{const e=setTimeout(()=>{i(k)},300);return()=>clearTimeout(e)},[k,i]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const R=Object.entries(s).reduce((e,[t,n])=>"filter.v.price"===t?z>0||N<x?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",alignItems:r?"flex-end":"center",marginBottom:"20px",width:"100%",gap:r?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:o?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},o&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:r?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},r&&!C?e.createElement(Re,{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:r?"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(Re,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),r&&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:()=>$(!S),style:{display:_?"none":"flex",alignItems:"center",gap:r?"0px":"6px",background:S&&A?"#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(Oe,{className:"yt-byob-filter-toggle-icon",size:18}),!r&&"Filters",R>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}},R)),o&&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"}},!r&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),r&&e.createElement(Le,{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:w,onChange:e=>c(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(y,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(ps,{showFiltersDrawer:S,handleClose:()=>{A?$(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{$(!1)},300))},isAnimating:F,isMobile:r,availableFilters:p,appliedFilters:s,toggleFilter:(e,t)=>{d(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{B(x),I(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${N}`],t})},priceMin:z,setPriceMin:I,priceMax:N,setPriceMax:B,maxPossiblePrice:x,styles:l,availableProductCount:m,products:u,unavailableProductCount:g,storeCurrencyCode:f,openSections:h,toggleSection:v}))},gs=()=>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"}})),xs=({title:t,uploadState:n,onUpload:o,onRemove:r,onRetry:i})=>{const a="string"==typeof n?{url:n,name:"Attachment"}:n,l=a?.loading,c=a?.error,s=a?.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",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:600,fontSize:"14px",color:"#1a1a1a"}},t),!a&&!l&&!c&&e.createElement("div",{style:{fontSize:"12px",color:"#888",marginTop:"2px"}},"jpeg/png/img (max size: 5MB)"),l&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"#007bff",fontSize:"12px",marginTop:"4px"}},e.createElement(gs,null)," Uploading ",a?.name||"image","..."),c&&e.createElement("div",{style:{fontSize:"12px",color:"#dc3545",marginTop:"2px"}},"Upload failed."),s&&!l&&!c&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},e.createElement("img",{src:a.url,alt:"Uploaded",style:{width:"36px",height:"36px",objectFit:"cover",borderRadius:"4px",border:"1px solid #eee"}}),e.createElement("span",{style:{fontSize:"12px",color:"#28a745",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},a.name))),e.createElement("div",{style:{flexShrink:0}},c&&e.createElement("button",{type:"button",onClick:i,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Retry"),s&&!l&&!c&&e.createElement("button",{type:"button",onClick:r,style:{fontSize:"13px",fontWeight:600,color:"#fff",background:"#dc3545",border:"none",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Remove"),!a&&!l&&e.createElement("button",{type:"button",onClick:o,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")))},fs=({form:o,formData:i,setFormData:a,barHeight:l=0,isUploading:c,setIsUploading:s})=>{const d=r(new Map),[p,u]=t(!1),m=s??u;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");a(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),m(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",o=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!o.ok)throw new Error("Upload failed");return(await o.json()).url}catch(e){throw alert("Upload failed. Try again."),e}finally{m(!1)}})(n);a(o=>({...o,[e]:{url:t,name:n.name}}))}catch{a(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",{style:{width:"100%",padding:"8px 0",marginBottom:`${l}px`,boxSizing:"border-box"}},o.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,style:{marginBottom:"28px"}},e.createElement("label",{style:{display:"block",fontWeight:700,marginBottom:"10px",color:"#1a1a1a",fontSize:"15px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement("textarea",{key:o,placeholder:t?.title,rows:3,maxLength:500,value:i[o]||"",onChange:e=>a(t=>({...t,[o]: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",null,e.createElement("div",{style:{fontSize:"12px",color:"#888",marginBottom:"10px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement(xs,{key:o,title:t?.title,uploadState:i[o],onUpload:()=>g(o).click(),onRemove:()=>a(e=>{const{[o]:t,...n}=e;return n}),onRetry:()=>g(o).click()})}))))))};function ys({quantity:t,setQuantity:n,remainingQuantity:o,handleAddToBundle:r,variantId:i,product:a,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:s}){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<s;return e.createElement(lc,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const o=Math.max(0,t-1);n(o),l&&i&&l(i,1)},style:d},"-"),e.createElement(cc,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(o,t+1,s);n(l),r&&i&&a&&r(i,a,1)},disabled:!p||c,style:{...d,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const bs=({product:r,styles:i,selectedVariant:a})=>{const[l,c]=t(!1),s=o(()=>ou(a?.image?.url||r?.featuredMedia?.preview?.image?.url||r?.media?.edges?.[0]?.node?.image?.url)||"",[a?.image?.url,r?.featuredMedia?.preview?.image?.url,r?.media?.edges]),d=o(()=>r?.media?.edges?.map(e=>ou(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[r?.media?.edges]),p=o(()=>d?.[1]??s??"",[d,s]);n(()=>{if(s){(new Image).src=s}},[s]);const u=o(()=>s||d?.[0],[s,d]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:i.general.imageAspectRatio||"1/1"},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!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&&u!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:u,alt:r.title}),u!==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:r.title})))},hs=({product:o,bundle:r,handleAddToBundle:a,hideAddToBundle:l,remainingQuantity:c,themeColor:s,handleRemoveItem:d,transitionActive:p,idx:u,selecteditems:m,customVariantsQuantity:g,currentProductTier:x,showFreebieTierProductPrices:f,tierIndex:b})=>{const h=se(es),v=r.customizations,w=v?.byob?.variantSelectorType,[C,E]=t(!1),k=v.general?.variantTitleSuffix?o?.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 o=t[e];let r=0;for(;r<n.length&&r<o.length&&n[n.length-1-r]===o[o.length-1-r];)r++;n=n.slice(n.length-r)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),o=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:o,commonSuffix:n.join(" ")}}})})(o?.variants?.edges);if(!k||!k.length)return e.createElement(e.Fragment,null);const T=i(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(r?.customProductsQuantity)return r?.customProductsQuantity;const n=k?.find(t=>t.node.id===e),i=n?.node;return i?o.tracksInventory&&i.inventoryItem?.tracked?i.inventoryQuantity>0?i.inventoryQuantity:i.inventoryQuantity<=0&&"continue"===i.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[k,g,o.tracksInventory]),S=k?.find(e=>T(e.node.id)>0)?.node?.id;if(!S&&!v.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[$,N]=t(k?.find(e=>T(e.node.id)>0)?.node?.id||k[0]?.node?.id),[B,z]=t(0),[I,F]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===$)?.node,_=T($||"");n(()=>{const e=m.find(e=>e.variantId===$&&(void 0===b||e.tierIndex===b));z(e?e.quantity:0)},[m,$,b]),n(()=>{const e=()=>{F(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{CSS.supports("font-weight","500")?D("500"):CSS.supports("font-weight","400")?D("400"):CSS.supports("font-weight","600")&&D("600")},[]),n(()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",P)},[P]),n(()=>{if($&&!k?.some(e=>e.node.id===$)){const e=k.find(e=>T(e.node.id)>0)?.node.id||k[0]?.node?.id;e&&N(e)}},[$,k,T]);const R=o.variants&&o.variants.edges?.length>1&&"customOptions"!==w,O="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,L="53933408435"===O,M="75851235630"===O,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[]})(o),j=V.length>0;return e.createElement(e.Fragment,null,e.createElement(pc,{borderRadius:v?.byob.borderRadius,borderColor:v?.byob.borderColor,shadowType:v?.byob.shadowType,backgroundColor:v?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":u%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(_<=0)return;const e={...o,variants:{...o.variants,edges:k},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:v?.byob?.productCardDetailsAlignment||"left"}},e.createElement(uc,{className:"yt-byob-image-wrapper"},e.createElement(bs,{product:o,styles:v,selectedVariant:A}),r?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:v.byob.borderRadius}},r.productCardBadgeText),R&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(mc,{className:"yt-byob-variant-selector",isCoralHaze:L,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:$||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),N(e.target.value)}},k?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,o=t.node.title.length>n?t.node.title.substring(0,n)+"...":t.node.title;return e.createElement("option",{key:t.node.id,value:t.node.id},o)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(y,null)))),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-start"},className:"yt-byob-product-details-wrapper"},e.createElement("div",{className:"yt-byob-product-content"},"enabled"===r?.customizations?.byob?.productCardCategoryVisibility&&j&&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"}},V.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:I?"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(gc,{isMobile:I,showBorder:r?.showBorder??!0,style:{...!v?.byob.productsPriceVisibility&&{padding:"8px"},...v?.byob.productTitleFontSize&&{fontSize:v?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:v?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},M?String(A?.displayName).replace("- Default Title",""):o.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&v?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:r?.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"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},o?.rating?.averageRating," rating")),"ratingAndReviewCount"===r?.reviewRatingType&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-byob-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement(ze,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(Ee,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," reviews)"),v?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:r?.showBorder?"0px 10px":"0 4px"}},x?.isFreebieTier&&!f?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"}},nu(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",tu(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:v.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},nu(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",tu(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!x?.isFreebieTier||f)&&A?.compareAtPrice&&v?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},nu(v.general.currencySymbol,r?.storeCurrencyCode)??"Rs.",tu(A.compareAtPrice)))),(_>0||_===1/0)&&e.createElement(xc,{borderRadius:v?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===B||void 0===B)&&e.createElement(sc,{style:{...!l&&{backgroundColor:v?.general.primaryColor||"#111",color:v?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),z(1),(()=>{if(!$)return;"customOptions"===w&&k.length>1?E(!0):a($,o,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},v?.byob.addToBundleCTAText),!r?.disableQuantitySelector&&B>0&&$&&e.createElement(dc,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(ys,{remainingQuantity:c,setQuantity:z,quantity:B,handleAddToBundle:a,variantId:$,product:o,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:_})),r?.disableQuantitySelector&&B>0&&$&&e.createElement(sc,{style:{backgroundColor:"#747474",color:v?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-byob-added-button yt-product-atc-single-qty-selector"},e.createElement(fc,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(yc,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,B-1);z(t),d&&$&&d($,b)}},e.createElement(Ve,{style:{color:"#fff",fontSize:"20px"}})))),_<=0&&_!==1/0&&e.createElement(sc,{style:{backgroundColor:v.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},v?.general.outOfStockLabel||"Out of Stock")),"customOptions"===w&&C&&k.length>1&&e.createElement(as,{product:o,isOpen:C,onClose:()=>E(!1),variantOptions:r.variantOptions,cta:{textColor:v.general.ctaTextColor,backgroundColor:v.general.primaryColor},onConfirm:e=>{N(e),a(e,o,1)}}))},vs=({currentStep:t,setCurrentProductTier:n,totalSteps:o,tiers:r,isMobile:i,selectedProductsByTier:a,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:s})=>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:o}).map((c,d)=>{const p=d+1,u=!r[d].isFormStep&&r[d].minimumQuantity-(a[d]?.length??0)===0,m=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:i?"4px":"8px"},onClick:()=>!1===s?()=>{}: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:i?"30px":"50px",backgroundColor:m?"#666666":u?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:m?"white":u?`${l}50`:"white",border:`2px solid ${m?"#666666":u?l:"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:i?"30px":"50px",backgroundColor:m?"#666666":u?l:"#CBD5E0",display:"block",marginRight:d<o?i?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:i?"16px 0px":"15px 0px",fontSize:i?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},r[t]?.title)),ws=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(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",...o].map(o=>{const i=r===o;return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(t.general.primaryColor,.07):"transparent",borderBottom:i?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},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",...o].map(o=>e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:r===o?t?.general.primaryColor:"white",color:r===o?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{r!==o&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{r!==o&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},o.charAt(0).toUpperCase()+o.slice(1)))))},Cs=({bundle:a,selectedItems:l,setSelectedItems:c,handleAddToCart:s,bundleAddToCartLoading:d,renderingOnPage:p,selectedItemsQuantity:u,handleRemoveItem:m,bundleSubtotal:g,dispatchAnalyticsEvent:x,fetchStoreDetails:f,productsPagination:y})=>{const[b,h]=t(void 0),[v,w]=t(window.innerWidth<450),[C,E]=t(0),[k,T]=t({}),S=!!a.personalizedForm?.title&&"productTier"===a.builderTiers?.type,[$,N]=t({}),[B,z]=t(!1),I=S&&C===(a.builderTiers?.productTier?.length||0),F=C===(a.builderTiers?.productTier?.length||0)-1,P=S&&F&&!I,[D,A]=t(a?.products),[_,R]=t(!1),[O,L]=t({}),[M,V]=t(a?.products),[j,W]=t({}),[H,q]=t(y?.cursorData),Q=a.builderTiers?.type,U=a.customizations,Y=a.builderTiers?.productTier??[],G=a.builderTiers?.offerTier??[],[X,Z]=t([]),[K,J]=t(!1),[ee,te]=t("All"),ne=r(null),[oe,re]=t({}),[ie,ae]=t([]),[ce,se]=t(!1),[de,pe]=t(0),[ue,me]=t(0),[xe,fe]=t({}),ye=e=>{fe(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{ie.length>0&&fe(e=>{const t={...e};return ie.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[ie]),n(()=>{!(Object.values(oe).length>0)&&y?.cursorData&&q(y.cursorData)},[oe,y?.cursorData]);const be=a.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;D?.forEach(n=>{const o=n?.productDetails;if(o.metafield&&"yourtoken_bundles_app"===o.metafield.namespace&&"categories"===o.metafield.key){let n=[];if(o.metafield.jsonValue&&Array.isArray(o.metafield.jsonValue))n=o.metafield.jsonValue;else if(o.metafield.value)try{const e=JSON.parse(o.metafield.value);Array.isArray(e)&&(n=e)}catch(e){console.error("Failed to parse categories:",e)}n.length>0&&(t=!0,n.forEach(t=>e.add(t)))}}),Z(Array.from(e)),J(t);U?.byob?.productFiltersDisplay&&"none"!==U?.byob?.productFiltersDisplay&&(async()=>{const e=U?.byob?.productFiltersDisplay??"none";if("drawer"===e||"sidebar"===e)try{const e=await(f?.());e?.productFilters&&ae(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[U?.byob,f,D]),n(()=>{re({})},[C,ee]);const he=((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}))(D.filter(e=>{const t=e.productDetails.status?.toLowerCase(),n="active"===t||"unlisted"===t||void 0===e.productDetails.status||""===e.productDetails.status,o="estailofashion.myshopify.com"!==window?.Shopify?.shop||null!==e?.productDetails?.publishedAt;return n&&o}),ee),ve="productTier"===Q?Y.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===Q?G.reduce((e,t)=>e+t.minimumQuantity,0):a.minimumQuantity,we=i((e,t)=>{const n=be?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const o=(e.variants?.edges||[]).find(e=>e.node.id===t),r=o?.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},[be]),[Ce,Ee]=t(3e3);n(()=>{const e=ie?.find(e=>"PRICE_RANGE"===e.type||"filter.v.price"===e.id);e&&e.values?.[0]?.input?.price?.max&&Ee(e.values[0].input.price.max)},[D,ie]);const[ke,Te]=t(""),[Se,$e]=t(""),Ne=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(he,ke),Be=((e,t)=>[...e].sort((e,n)=>{const o=e?.productDetails?.title?.toLowerCase(),r=n?.productDetails?.title?.toLowerCase(),i=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),a=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return o.localeCompare(r);case"title-desc":return r.localeCompare(o);case"price-low-to-high":return i-a;case"price-high-to-low":return a-i;default:return 0}}))(Ne,Se);n(()=>{(async e=>{if(!y)return;const{initialCursorData:t,cursorData:n,fetchFn:o,setCursorData:r}=y,i="productTier"===Q?Y?.[C]?.tier:1;if(0===Object.values(e)?.length)return void("productTier"===Q?(L(e=>({...e,[C]:j?.[C]||[]})),r(H||{...n})):(A(M),r(H||{1:t?.[1]})));const a=await o(e,i,null);a&&("productTier"===Q?(L(e=>({...e,[C]:a})),A(e=>{const t=new Set(e.map(e=>e.productId)),n=a.filter(e=>!t.has(e.productId));return[...e,...n]})):A(a))})(oe)},[oe]);const[ze,Ie]=le(es),[Fe,Pe]=t(!1);n(()=>{x?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a?._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder"}}),setTimeout(()=>{Pe(!0)},100)},[]);const De=r(null);n(()=>{const e=()=>{w(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(a.coverImageUrl){const e=new Image;e.src=ou(a.coverImageUrl)??"",e.onload=()=>{h(e.width/e.height)}}},[a.coverImageUrl]),n(()=>{Pe(!1),setTimeout(()=>Pe(!0),100)},[C]);const Ae=(e,t)=>{if("productTier"===Q){let n={...k},o=!1;if(n[t]){const r=n[t].indexOf(e);-1!==r&&(n[t]=[...n[t]],n[t].splice(r,1),o=!0)}if(!o)for(let t=Y.length;t>=0;t--){const o=n[t].indexOf(e);if(-1!==o){n[t]=[...n[t]],n[t].splice(o,1);break}}T(n);const r=Y.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==r&&E(r)}m(e,t)},_e=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if(a)return"productTier"!==a?.builderTiers?.type?(A(a?.products??[]),void V(a?.products??[])):void("productTier"===a?.builderTiers?.type&&(L({0:a?.products}),W({0:a?.products})))},[a]),n(()=>{if("productTier"!==Q||!Y[C])return;if(ve===u)return;const e=Y.findIndex((e,t)=>{const n=k[t]||[];return t>=C&&n.length<e.minimumQuantity});if(-1!==e&&e!==C){E(e);const t=Y[C];t?.products?.length>1&&_e()}else if(-1===e&&S&&C<Y.length){Y.every((e,t)=>(k[t]?.length||0)>=e.minimumQuantity)&&E(Y.length)}},[k,Y,Q,S]),n(()=>{Te("")},[C]),n(()=>{function e(e){if(!De.current||!e.target)return;!De.current.contains(e.target)&&Ie(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const Re=(e,t,n)=>{var o;"productTier"===Q&&(o=e,T(e=>{const t={...e},n=Y.findIndex((e,n)=>{const o=t[n]||[];return n>=C&&o.length<e.minimumQuantity}),r=-1!==n?n:C;return-1!==n&&E(n),t[r]||(t[r]=[]),t[r].push(o),t}));const r=!0===Y[C]?.isFreebieTier;x?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),ru(e,t,n,l,c,r,C)},Oe=(()=>{if(!a?.builderTiers)return a.minimumQuantity;const{type:e,offerTier:t,productTier:n}=a.builderTiers,o="offerTier"===e?t:"productTier"===e?n:null;if(!o)return a.minimumQuantity;let r=0;return o.map(e=>{r+=e.minimumQuantity}),r})(),Le=v&&a.mobileCoverImageUrl?ou(a.mobileCoverImageUrl):ou(a.coverImageUrl??"")||null,Me=i(e=>{const t=U?.general?.showOutOfStockProducts;if(t)return!0;const n=e?.productDetails,o=n?.variants?.edges||[];if(be){if(o.some(e=>be.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return o.some(e=>we(n,e.node.id)>0)},[U?.general?.showOutOfStockProducts,be,we]),Ve=o(()=>{if("productTier"===Q&&Y.length>0){const e=O?.[C]??[];return Se?Be.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Me(t)):e.map(e=>Be.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Me(e))}return Be.filter(Me)},[Q,Y,O,C,Be,Me,Se]),je=Ve;n(()=>{if("productTier"!==Q)return;const e=Y[C];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;if(1!==O?.[C]?.length)return;const t=e.products[0],n=D.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const o=n.variants?.edges?.find(e=>we(n,e.node.id)>0)?.node;if(!o)return;const r=o.id,i=k[C]?.includes(r);if(!i&&(Re(r,n,1),C<Y.length-(S?0:1))){E(C+1);const e=Y?.[C];e?.products?.length>1&&_e()}},[Q,Y,C,D,k,we,Re]);const We=o(()=>he.filter(e=>{const t=e?.productDetails;return(t.variants?.edges||[]).some(e=>we(t,e.node.id)>0)}).length,[he,we]),He=o(()=>he.length-We,[he,We]),qe="bundles"==a.appName?a.pageHeader?.title:a?.title,Qe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;n(()=>{if(!y)return;const{cursorData:e,fetchFn:t}=y,n=Y[C]?.tier,o="productTier"===Q?n:1;if(e?.[o]&&!e?.[o]?.hasNext||!t)return;const r=new IntersectionObserver(async([n])=>{if(n.isIntersecting&&!_){R(!0);try{const n=await t(oe,o,e?.[o]?.cursor);if(n?.length>0){const e=Object.values(oe).length>0;"productTier"===Q?(L(e=>({...e,[C]:[...e[C]||[],...n]})),e||W(e=>({...e,[C]:[...e[C]||[],...n]})),A(e=>[...e,...n])):(A(e=>[...e,...n]),e||V(e=>[...e,...n]))}}catch(e){console.error("Pagination fetch failed:",e)}finally{R(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),i=ne.current;return i&&r.observe(i),()=>{i&&r.unobserve(i)}},[y,_,Q,C,Y]);const Ue=()=>{x?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"byob-page-bundle",byobBundleType:a.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",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:U.byob.sectionBackgroundColor,..."transparent"!==U.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Le?e.createElement("div",{className:"yt-byob-cover-image-container",style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...a?.coverImageVerticalMargin&&{marginBottom:a?.coverImageVerticalMargin,marginTop:a?.coverImageVerticalMargin}}},Le&&e.createElement(cs,{coverImageUrl:Le,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:U?.byob?.titleFontSize??"3rem",fontWeight:"700",color:U?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:U?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},qe),e.createElement("span",{style:{lineHeight:"normal",fontSize:U?.byob?.subtitleFontSize??"1.5rem",color:U?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Qe))):(qe||Qe)&&e.createElement("div",{className:"yt-byob-header-content",style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},qe&&e.createElement("span",{className:"bundle-builder-title",style:{lineHeight:"normal",fontSize:U?.byob?.titleFontSize??"3rem",fontWeight:"700",color:U?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:U?.byob?.titleBackgroundColor??"transparent"}},qe),Qe&&e.createElement("span",{className:"bundle-builder-subtitle",style:{lineHeight:"normal",fontSize:U?.byob?.subtitleFontSize??"1.5rem",color:U?.byob?.titleTextColor??"#000"}},Qe)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===Q&&Y.length>0&&U?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-stepper-wrapper"},e.createElement(vs,{currentStep:C,totalSteps:Y.length+(S?1:0),tiers:S?[...Y,{title:a.personalizedForm?.title||"Personalize",tier:Y.length,minimumQuantity:0,products:[],isFormStep:!0}]:Y,isMobile:v,primaryColor:U?.general?.primaryColor,primaryTextColorCta:U?.general?.primaryContrastColor,setCurrentProductTier:E,selectedProductsByTier:k,tierNavigation:U.byob.tierNavigation})))),e.createElement("div",{className:"yt-byob-layout-wrapper",style:{display:"flex",flexDirection:"row",width:v?"100%":"90%",marginInline:"auto"}},"sidebar"===U?.byob?.productFiltersDisplay&&!v&&!I&&e.createElement(us,{showFiltersDrawer:ce,handleClose:()=>se(!1),isAnimating:!1,isMobile:!1,availableFilters:ie,appliedFilters:oe,toggleFilter:(e,t)=>{re(n=>{const o=n[e]||[],r=o.includes(t)?o.filter(e=>e!==t):[...o,t],i={...n,[e]:r.length?r:void 0};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{re({}),me(0),pe(Ce)},applyPriceFilter:()=>{re(e=>{const t={...e};return t["filter.v.price"]=[`min:${ue}-max:${de}`],t})},priceMin:ue,setPriceMin:me,priceMax:de,setPriceMax:pe,maxPossiblePrice:Ce,styles:U,products:D,unavailableProductCount:He,storeCurrencyCode:a?.storeCurrencyCode,openSections:xe,toggleSection:ye}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!I&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(ms,{enableSortAndFilter:a?.enableSortAndFilter??!1,isMobile:v,searchTerm:ke,setSearchTerm:Te,setSortBy:$e,styles:U,appliedFilters:oe,setAppliedFilters:re,availableFilters:ie,products:D,availableProductCount:We,unavailableProductCount:He,maxPossiblePrice:Ce,storeCurrencyCode:a?.storeCurrencyCode,sharedFiltersState:{showFilters:ce,setShowFilters:se,priceMax:de,setPriceMax:pe,priceMin:ue,setPriceMin:me},openSections:xe,toggleSection:ye}),a?.customizations?.byob?.enableProductCategories&&K&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(ws,{styles:U,isMobile:v,categories:X,activeCategory:ee,onCategoryChange:e=>{te(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:ce&&"sidebar"===U?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},I&&a.personalizedForm?.title?e.createElement(fs,{form:a.personalizedForm,formData:$,setFormData:N,isUploading:B,setIsUploading:z}):0!==je?.length||_?Ve.map((t,n)=>{if("productTier"===Q){const o=(Y[C]?.minimumQuantity??0)>(k[C]?.length??0),r=Be.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return r?e.createElement(hs,{bundle:a,idx:n,key:t?.variantIds?.[0]??t.productId,product:r?.productDetails,handleAddToBundle:Re,hideAddToBundle:!o,remainingQuantity:Oe-u,themeColor:a?.dealTextColor,handleRemoveItem:e=>Ae(e,C),selecteditems:l,transitionActive:Fe,customVariantsQuantity:be,currentProductTier:Y[C],showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:C}):null}return e.createElement(hs,{bundle:a,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:Re,hideAddToBundle:u>=Oe,remainingQuantity:Oe-u,themeColor:a?.dealTextColor,handleRemoveItem:m,selecteditems:l,transitionActive:Fe,customVariantsQuantity:be,tierIndex:C})}):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:()=>{re({}),me(0),pe(Ce)},style:{padding:"8px 16px",background:U?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:U?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px"}},"Clear All Filters")),!I&&_&&e.createElement("div",{className:"yt-byob-loading-wrapper",style:{width:"100%",display:"flex",justifyContent:"center",padding:"20px"}},e.createElement(ge,{color:U?.general?.primaryColor||"#333",size:30})),e.createElement("div",{ref:ne,className:"yt-byob-pagination-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null))),!p&&e.createElement(Jc,{builderTiers:a?.builderTiers,showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void _e();const t={};S&&Object.entries($).forEach(([e,n])=>{const o=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[o]=n:n&&"object"==typeof n&&"url"in n&&(t[o]=n.url)}),await s(e,t),Ue()},minimumQuantity:ve,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,handleRemoveItem:m,handleRemoveItemProductTier:Ae,selectedItemsQuantity:u,percentageOff:a.percentageOff,loading:d,bundleSubtotal:g,amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:a?.dealTextColor??"#333",primaryTextColorCta:a?.primaryTextColorCta??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:k,renderingOnPage:p,isUploading:B}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(Jc,{showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void _e();const t={};S&&Object.entries($).forEach(([e,n])=>{const o=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[o]=n:n&&"object"==typeof n&&"url"in n&&(t[o]=n.url)}),await s(e,t),Ue()},minimumQuantity:ve,builderTiers:a?.builderTiers,selectedProducts:l,showProductDetailsInTracker:a.showProductDetailsInTracker,loading:d,handleRemoveItem:m,handleRemoveItemProductTier:Ae,percentageOff:a.percentageOff,selectedItemsQuantity:u??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:a.amountOff,styles:a.customizations,dealAmount:a.dealAmount,themeColor:U?.general.primaryColor||"#000",primaryTextColorCta:U.general.primaryContrastColor??"#fff",cornerRadiusType:a?.cornerRadiusType??"",selectedProductsByTier:k,renderingOnPage:p,isUploading:B})))),ze&&void 0!==u&&(()=>{let t=u<a.minimumQuantity;return"productTier"==Q?t=(Y[C]?.minimumQuantity??0)>(k[C]?.length??0):"offerTier"==Q&&(t=u<G.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(ls,{handleAddToBundle:Re,ref:De,remainingQuantity:a.minimumQuantity-u,hideAddToBundle:!t,disableQuantitySelector:a?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:k,themeColor:U?.general.primaryColor||"#000",primaryTextColorCta:a?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:U?.general.primaryColor||"#000",cornerRadius:a?.customizations.byob.borderRadius,styles:a.customizations,reviewRatingType:a?.reviewRatingType??"none",customVariantsQuantity:be,bundleProductsCustomQuantity:a?.customProductsQuantity,isFreebieTier:Y?.[C]?.isFreebieTier,showFreebieTierProductPrices:a?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:a?.variantOptions})})()))},Es=({isOpen:o,onClose:r,formConfig:i,onCheckout:a,cta:l,isMobile:c})=>{const[s,d]=t({}),[p,u]=t(!1);n(()=>{o||d({})},[o]);const m=e=>{if(p)return;const t={};Object.entries(s).forEach(([e,n])=>{const o=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[o]=n:n&&"object"==typeof n&&"url"in n&&(t[o]=n.url)}),a(e?{}:t)};if(!o)return null;const g=e.createElement("div",{onClick:r,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:c?"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",{onClick:e=>e.stopPropagation(),style:{background:"white",width:c?"100vw":"500px",maxWidth:c?"100vw":"560px",height:c?"80vh":"auto",maxHeight:c?"80vh":"90vh",borderRadius:c?"20px 20px 0 0":"20px",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:999,animation:c?"slideUp 0.3s ease-out":"fadeIn 0.2s ease-out"}},e.createElement("div",{style:{width:"100%",padding:c?"20px 20px 16px":"18px 20px",fontWeight:700,fontSize:c?"18px":"16px",textAlign:"center",position:"relative",borderBottom:"1px solid #eee",flexShrink:0,backgroundColor:"#ffffff",color:"#1a1a1a",boxSizing:"border-box",lineHeight:"1.4"}},i.title||"Personalization",!c&&e.createElement("button",{onClick:r,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",{style:{flex:1,overflowY:"auto",padding:c?"20px 20px":"16px 20px"}},e.createElement(fs,{form:i,formData:s,setFormData:d,isUploading:p,setIsUploading:u})),e.createElement("div",{style:{padding:c?"12px 16px":"12px 24px 16px",borderTop:"1px solid #eee",flexShrink:0,background:"white",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"}},e.createElement("button",{onClick:()=>{m(),r()},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(ge,{color:l.textColor,size:15}):"Submit"),e.createElement("button",{onClick:()=>{m(!0),r()},style:{background:"none",border:"none",fontSize:"14px",fontWeight:600,color:"#1a1a1a",cursor:"pointer",padding:"4px 8px",textAlign:"center"}},"Add without customization"))));return D.createPortal(g,document.body)},ks=({product:t,selectedVariantId:n,onVariantChange:r,styles:i,originalPrice:a,dealPrice:l,totalPriceSum:c,isVertical:s=!1,variantOptions:d,storeCurrencyCode:p})=>{const u=o(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),o=n?.node;return o?t.productDetails.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t.productDetails]),m=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;u(n);const g=o(()=>{if(m?.title&&t.productDetails.options){const e=m.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[m,t.productDetails.options]),x=e=>{r(e)};return s?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%"}},i.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:ou(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:i.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"}},t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(e.Fragment,null,e.createElement("select",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null)))))),(i.comboBundle.subProductsProductTitleVisibility||i.comboBundle.subProductsProductPriceVisibility)&&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"}},i.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),i.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"}},nu(i.general.currencySymbol,p),tu((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==i.comboBundle.discountBadgeVisibility&&("discount-on-compare"===i.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},nu(i.general.currencySymbol,p),tu(m?.compareAtPrice?m.compareAtPrice:m?.price)):Number(l)<Number(c)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},nu(i.general.currencySymbol,p),tu(m?.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"===i.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===i.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"}},i.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:ou(m?.image?.url||t?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg"),alt:t?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===i.comboBundle?.infoAlignment?"flex-start":"right"===i.comboBundle?.infoAlignment?"flex-end":"center"===i.comboBundle?.infoAlignment?"flex-start":void 0}},i.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," "),"dropdown"!==i.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.filter(e=>"Default Title"!==e.node.title).length>0&&d&&g&&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"}},g.length>1?g.join(" / "):g)),i.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"}},nu(i.general.currencySymbol,p),tu((Number(m?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==i.comboBundle.discountBadgeVisibility&&("discount-on-compare"===i.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},nu(i.general.currencySymbol,p),tu(m?.compareAtPrice?m?.compareAtPrice:m?.price)):Number(l)<Number(c)&&e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},nu(i.general.currencySymbol,p),tu(m?.price)))),t.productDetails.variants.edges.length>1&&("dropdown"===i.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("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(y,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,o)=>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(r=>{const a=[...g];a[o]=r;const l=t.productDetails.options.length>0?a.join(" / "):a[o],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?u(c.id):0),p=g[o]===r,m=d&&d?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&x(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},m?.values.find(e=>e.name===r)?.value?e.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:m?.values.find(e=>e.name===r)?.value}},e.createElement("span",null)):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):m&&"image"===m?.type?e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&x(c.id)},disabled:s,style:{border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:p&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},m?.values.find(e=>e.name===r)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:ou(m?.values.find(e=>e.name===r)?.value||"/placeholder.svg"),alt:r,style:{width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:r,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},r)):e.createElement("button",{key:r,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&x(c.id)},disabled:s,style:{padding:"4px 8px",border:p&&!s?`1px solid ${i.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},r)}))))):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 o=0===u(t?.node?.id);return e.createElement("button",{key:t?.node?.id,className:`yt-comboBundle-product-variant-button ${n===t?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${o?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>x(t?.node?.id),disabled:o,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${i.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:o?"#ccc":"#707070",cursor:o?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:o?.5:1}},t?.node?.title)}))))))},Ts=({bundle:r,addToCartFunction:i,dispatchAnalyticsEvent:a})=>{const[l,c]=t(!1),[s,d]=t(window.innerWidth<786),[p,u]=t(!1),m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),[g,x]=t(()=>{const e={};return r.products.forEach((t,n)=>{const o=t.productDetails?.variants?.edges?.find(e=>m(t.productDetails,e?.node?.id)>0)?.node;e[n]=o?o.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e});n(()=>(i&&(window.ytComboBundle={bundle:r,addToCart:i,selectedVariants:g},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}))}),[r,i,g]);const f=r.products?.every((e,t)=>{const n=g[t];return m(e.productDetails,n)>0}),y=(e,t)=>{x(n=>({...n,[e]:t}))},b=async e=>{const t=Object.entries(g).map(([e])=>({id:r.products[parseInt(e)].productId,title:r.products[parseInt(e)]?.productDetails?.title}));a?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"combo-bundle",selectedProducts:t}});try{if(c(!0),!i)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const t=Object.entries(g).map(([e,t])=>{const n=r.products[parseInt(e)],o=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return o?{variantId:t,price:Number(o.price)}:null}).filter(e=>null!==e),n=Object.values(g);await i(Number(h),n,Number(v),t,e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)},{originalPrice:h,dealPrice:v,offerValue:w,totalPriceSum:C,offerPercentage:E}=o(()=>{const{price:e,compareAtPrice:t}=Object.entries(g).reduce((e,[t,n])=>{const o=r.products[parseInt(t)],i=o.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,a=parseFloat(i?.price??"0"),l=parseFloat(i?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=r?.customizations?.comboBundle?.discountBadgeDisplay,o="discount-on-price"===n?e:t;let i=e;r?.percentageOff?i=e*(1-r.percentageOff/100):r?.dealAmount?i=r.dealAmount:r?.amountOff&&(i=e-r.amountOff);const a=o-i,l=o>0?Math.round((o-i)/o*100):0;return{originalPrice:o.toFixed(2),dealPrice:i.toFixed(2),offerValue:a.toFixed(2),totalPriceSum:e.toFixed(2),offerPercentage:l}},[g,r.products,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.comboBundle?.discountBadgeDisplay]);n(()=>{a?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"combo-bundle"}});const e=()=>{d(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const k=r.customizations,T=k.comboBundle?.comboCardStyle||"auto",S="vertical"===T||"auto"===T&&!s,$=k.comboBundle?.embedContentVisibility,N="bundles"==r.appName?r.pageHeader?.title:r?.title,B="bundles"==r.appName?r.pageHeader?.description:r?.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"}},$&&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}},N)),$&&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"}},nu(k.general.currencySymbol,r.storeCurrencyCode),tu(v)),!isNaN(Number(h))&&!isNaN(Number(v))&&Number(h)>Number(v)&&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"}},nu(k.general.currencySymbol,r.storeCurrencyCode),tu(h)),Number(w)>0&&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"}},"discount-on-compare"===k.comboBundle.discountBadgeDisplay?`${E}% Off`:r?.percentageOff?`${r?.percentageOff}% Off`:r?.amountOff?`${nu(k.general.currencySymbol,r.storeCurrencyCode)}${tu(r?.amountOff)} Off`:`Save ${nu(k.general.currencySymbol,r.storeCurrencyCode)}${tu(w)}`))),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,S?e.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(s?"yt-comboBundle-products-grid-mobile":""),style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},r.products.map((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===g[n])?.node;return o?e.createElement(ks,{key:`combo-product-${n}-${t.productId}`,product:t,styles:k,originalPrice:h,dealPrice:v,totalPriceSum:C,selectedVariantId:g[n],onVariantChange:e=>y(n,e),isVertical:S,variantOptions:r.variantOptions,storeCurrencyCode:r.storeCurrencyCode}):null})):e.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(s?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},k.comboBundle.subProductsSectionVisibility&&r.products.map((t,n)=>e.createElement(ks,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:k,originalPrice:h,dealPrice:v,totalPriceSum:C,selectedVariantId:g[n],onVariantChange:e=>y(n,e),variantOptions:r.variantOptions})))),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",{className:`yt-comboBundle-bundle-cta-button ${f?"":"yt-comboBundle-bundle-cta-button-disabled"} ${s?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:f?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor,color:k.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:k.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:f?"pointer":"not-allowed",border:`1px solid ${f?k.general?.ctaBackgroundColor||"#121212":k.general.disabledButtonColor}`,boxShadow:k.general.ctaShadowType,padding:k.general?.ctaPadding,width:k.general?.ctaWidth,margin:"0"},disabled:!f,onMouseOver:e=>{k.general.customizeHoverState&&f&&(e.currentTarget.style.backgroundColor=k.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=k.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{k.general.customizeHoverState&&f&&(e.currentTarget.style.backgroundColor=k.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=k.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{r?.personalizedForm?.title?u(!0):await b()}},l?e.createElement(ge,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,f?k.comboBundle?.ctaTitle??"Add Bundle to cart":k.general.outOfStockLabel||"Out of Stock"," "))),$&&k.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},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"}},e.createElement("p",null,B))),r?.personalizedForm?.title&&e.createElement(Es,{isOpen:p,onClose:()=>u(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await b(e),u(!1)},cta:{backgroundColor:k.general?.ctaBackgroundColor||"#121212",textColor:k.general?.ctaTextColor||"#FFFFFF"},isMobile:s}))},Ss=c.div`
3154
3154
  max-width: 800px;
3155
3155
  container-type: inline-size;
3156
3156
  margin-top: ${e=>e.verticalMargin||"0px"};
@@ -3495,7 +3495,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
3495
3495
  scrollbar-width: none;
3496
3496
 
3497
3497
  -ms-overflow-style: none;
3498
- `,td=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function nd({bundle:a,addToCartFunction:l,currentProductId:c,dispatchAnalyticsEvent:s}){const d=o(()=>{if(c){const e="gid://shopify/Product/"+c,t=a.products?.some(t=>t.productId===e);return t?e:a.products?.[0]?.productId}return a.products?.[0]?.productId},[c,a.products]),p=o(()=>td(d,a.products),[d,a.products]),u=r(null),m=r(null);r({}),document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[g,x]=t(0),[f,y]=t(""),b=a.customizations??{},h=!1===b?.general?.showDecimalsInBundlePricing,v=o(()=>p?.productDetails?.tracksInventory??!0,[p?.productDetails?.tracksInventory]),w=i(e=>{if(!v)return 1/0;if(!e)return 0;if(!e.inventoryItem?.tracked)return 1/0;let t=e.inventoryQuantity??0;return t>0?t:"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0},[v]),C=(o(()=>p?.productDetails?.variants?.edges?.reduce((e,{node:t})=>w(t)>0?e+1:e,0),[p,w]),o(()=>td(d,a.products)?.id,[d,a.products]));o(()=>C?td(d,a.products):void 0,[d,a.products,C]),o(()=>a.products?.some(e=>e.productDetails?.options?.some(e=>e.values.length>1))||!1,[a.products]),b.volumeBundle;const E=o(()=>a?.volumeTiers||[],[a?.volumeTiers]),k=E.findIndex(e=>e.isDefault),[T,S]=t(-1!==k?E[k].tier:E?.[0]?.tier||1),[$,N]=t(p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||""),[B,z]=t({}),[I,F]=t(E.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>p?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[P,D]=t(!1),[A,_]=t(!1),[R,O]=t(window.innerWidth<550),[L,M]=t(null),[V,j]=t(null);r([]);const W=r([]),H=r(T);n(()=>{if(s?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a._id,bundleType:"volume-bundle"}}),"officialhouseofzelena.myshopify.com"===window?.Shopify?.shop||"791204-63.myshopify.com"===window?.Shopify?.shop){const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelectorAll('[type="submit"]');t&&t.forEach(e=>{e.setAttribute("style","display: none;")})}const e=()=>{O(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{const e=e=>{L&&W.current[L.index]&&W.current[L.index][L.optionIndex]&&!W.current[L.index][L.optionIndex]?.contains(e.target)&&M(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[L]),i(e=>{const t=E.find(t=>t.tier===e);if(!t)return null;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];for(const e of o){const t=e.node;if(w(t)>=n){const e=t.title.split(" / ");return Array(n).fill(e)}}const r=[],i={},a=[...o].sort((e,t)=>{const n=w(e.node),o=w(t.node);return n===1/0&&o===1/0?0:n===1/0?-1:o===1/0?1:o-n});for(let e=0;e<n&&r.length<n;e++){let e=!1;for(const t of a){const n=t.node,o=i[n.id]||0;if(w(n)>o&&n.availableForSale){const t=n.title.split(" / ");r.push(t),i[n.id]=o+1,e=!0;break}}if(!e)return null}return r.length===n?r:null},[p,E,w]);const q=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];let r=0;for(const e of o){const t=w(e.node);if(t===1/0){r=1/0;break}r+=t}return r>=n},[E,p,w]);n(()=>{const e={},t=p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&E.forEach(n=>{e[n.tier]={};for(let o=0;o<n.minimumQuantity;o++)e[n.tier][o]=t}),z(e)},[p?.id,E?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]);const Q=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,U=i((e,t,n,o,r)=>{const i=E.find(t=>t.tier===e);if(!i)return!1;const a=i.minimumQuantity,l=[...n];l[o]=r;const c=l.join(" / "),s=p?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!s||0===w(s))return!1;const d={},u=B[e]||{};for(let e=0;e<a;e++){let n;if(e===t)n=s.id;else{const t=u[e]||$,o=Q(p,t);if(!o)return!1;n=o.id}d[n]=(d[n]||0)+1}for(const[e,t]of Object.entries(d)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,I,B,$,w]),Y=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=e-1,r={};for(let e=0;e<n;e++){const t=(I[o]?.[e]||p.productDetails.options.map(e=>e.values[0])).join(" / "),n=p?.productDetails?.variants?.edges?.find(e=>e.node.title===t);if(!n)return!1;const i=n.node.id;r[i]=(r[i]||0)+1}for(const[e,t]of Object.entries(r)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,w]);n(()=>{x(e=>e+1)},[B]);const G=(e,t,n)=>{z(o=>({...o,[e]:{...o[e]||{},[t]:n}}))},X=i(()=>p?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||p?.productDetails?.variants?.edges?.[0]?.node,[p,w]),Z=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);n(()=>{H.current=T},[T]),n(()=>{V?(j(null),K()):K()},[T]),n(()=>{if(a){const e=X();if(e)y(e.id),N(e.id);else{const e=p?.productDetails?.variants?.edges?.[0]?.node?.id||"";y(e),N(e)}}},[a,p,X]);const K=()=>{const e=Z();if(e){const t=p?.productDetails?.variants?.edges?.find(t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e));let n=t?.node;if(n)N(String(n.id)),x(e=>e+1);else{const e=X();e&&(N(String(e.id)),n=e),x(e=>e+1)}if(n){0===w(n)?(j(null),setTimeout(()=>{j({tier:H.current,index:0,optionIndex:0,value:n.title})},0)):V&&j(null)}}};n(()=>{K();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",K),()=>{t=!1,window.removeEventListener("urlChange",K),window.history.pushState=n,window.history.replaceState=o}},[Z,p?.id,X,w]);const J=e=>{const t=E.find(t=>t.tier===e);if(!t)return{original:0,discounted:0,discountedFromPrice:0,discountedFromCompare:0,diffAmountFromPrice:0,diffAmountFromCompare:0,diffPercentFromPrice:0,diffPercentFromCompare:0,discountValue:0};let n=0,o=0,r=0;const i=B[e]||{};for(let e=0;e<t.minimumQuantity;e++){const t=i[e]||$,a=Q(p,t);if(!a)continue;const l=Number.parseFloat(a.price);n+=a.compareAtPrice?Number.parseFloat(a.compareAtPrice):l,o+=l,r+=l}if("percentOff"===a?.discountType){r*=1-(t.discountValue??0)/100}else"amountOff"===a?.discountType&&(r-=t.discountValue??0);const l=Math.max(0,r),c=b?.volumeBundle?.discountBadgeDisplay,s=b?.volumeBundle?.discountBadgeVisibility;let d=n;"Disabled"===s?d=l:"discount-on-price"===c&&(d=o);const u=o-l,m=d-l,g=o>0?u/o*100:0,x=d>0?m/d*100:0;return{original:d,discounted:l,discountedFromPrice:l,discountedFromCompare:l,diffAmountFromPrice:u,diffAmountFromCompare:m,diffPercentFromPrice:Math.round(g),diffPercentFromCompare:Math.round(x),discountValue:t.discountValue??0}},ee=(e,t,n,o)=>{let r=Q(e,t);if(o){const i=B[o]?.[n||0]||t;r=Q(e,i)}return r?.image?.url?r.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""},te=async e=>{if(Y(T))try{D(!0);const t=E.find(e=>e.tier===T);if(!t)return;const n={},o=B[t.tier]||{};for(let e=0;e<t.minimumQuantity;e++){const t=o[e]||$;n[t]?n[t].quantity+=1:n[t]={quantity:1}}s?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"volume-bundle",selectedProducts:p?[{id:p?.productId,title:p?.productDetails?.title}]:[],selectedVariants:Object.values(o)}});const r=J(t.tier),i=Array.from({length:t.minimumQuantity},(e,t)=>o[t]||$);l&&await l(r.original,i,void 0,void 0,e)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{D(!1)}else console.error("Selected tier is out of stock")};function ne(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}n(()=>{const e=()=>{if(b.volumeBundle?.addtoCartMethod&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelector(".sr-headless-checkout");t&&t?.setAttribute("style","display: none;");const n=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let o=1;n&&n.value&&(o=parseInt(n.value,10)||1);const r=E.find(e=>e.tier===T);if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"], .t4s-quantity-wrapper').forEach(e=>e.remove());const i=r.minimumQuantity;let a={};const l=Math.max(i,o);if(o>i){const e=f||$;if(!e)return;a[e]=l}else{const e=B[r.tier]||{};for(let t=0;t<i;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const c=J(r.tier),s=Object.fromEntries(Object.entries(a).map(([e,t])=>[ne(e),Math.round(t)])),d=(t,n,o="bundle-input-field")=>{const r=document.createElement("input");r.type="hidden",r.name=t,r.value=n,r.className=o,e.appendChild(r)};if(o>i){const e=f||$;e&&d("id",ne(e))}d("properties[_bundle_price]",String(c.original)),d("properties[_bundle_tier]",String(r.tier)),d("properties[_bundle_items]",JSON.stringify(s));let p=0;Object.entries(s).forEach(([e,t])=>{t>0&&(d(`items[${p}][id]`,e),d(`items[${p}][quantity]`,String(t)),p++)}),requestAnimationFrame(()=>{const t=e.querySelector('[type="submit"]'),n=e.querySelector(".noti-btn-main-wrap"),r=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const o=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");o&&(o.textContent=n)};o<=i&&(V?(r(t,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),n&&(n.style.display="block",n.classList.remove("hidden"),n.classList.add("block"))):(r(t,!1,"Add to cart"),t&&t.classList.remove("btn--sold-out","hidden"),n&&(n.style.display="none",n.classList.add("hidden"))))})};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame(()=>{e()})};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}},[T,JSON.stringify(B),$,b.volumeBundle?.cardStyle,c,f,V]);const oe=o(()=>E.find(e=>e.tier===T),[E,T]),re=o(()=>oe?J(oe.tier):null,[oe,B,$]),ie=o(()=>{if(!oe||!re)return;const e=B[oe.tier]||{},t={};for(let n=0;n<oe.minimumQuantity;n++){const o=e[n]||$;t[o]=(t[o]||0)+1}return t},[oe?.minimumQuantity,$,B,re]),ae=o(()=>Object.entries(ie??{}).map(([e,t])=>({variantId:e,quantity:t})),[ie]);if(n(()=>{if(!oe||!re)return;const e={tier:T,items:oe.minimumQuantity,discountedPrice:re.discounted,originalPrice:re.original,variants:ae,productId:p?.id??null,tierMeta:{title:oe.title,subtitle:oe.subtitle,badgeTitle:oe.badgeTitle},productData:p,tierData:oe},t=m.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{m.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t),l&&(window.ytVolumeBundle={bundle:a,addToCart:l,currentTier:oe,selectedVariants:ae},window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:{...e,addToCart:l}})))},50),()=>{u.current&&clearTimeout(u.current)})},[T,oe?.tier,oe?.minimumQuantity,re?.discounted,re?.original,p?.id,JSON.stringify(ae),l,a]),n(()=>()=>{window.ytVolumeBundle=void 0,window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:void 0}))},[]),n(()=>{if(!$||!p)return;const e=Q(p,$);if(!e)return;const t=e.title.split(" / "),n={},o={};E.forEach(e=>{const r=e.tier-1,i={};for(let t=0;t<e.minimumQuantity;t++)i[t]=$;n[e.tier]=i,o[r]=Array(e.minimumQuantity).fill(t)}),z(e=>({...e,...n})),F(e=>({...e,...o}))},[$,p?.id,E.length]),!l)return e.createElement(e.Fragment,null);const le=b.volumeBundle?.cardStyle,ce=b.general?.primaryColor,se=b.general?.secondaryColor,de=b.general.primaryContrastColor,pe=b.general.secondaryContrastColor,ue="high"===a.cornerRadiusType?"20px":"medium"===a.cornerRadiusType?"6px":"0px",me="bundles"==a.appName?a.pageHeader?.title:a?.title,xe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;return n(()=>{const e=Y(T);e?j(null):e||j({tier:T,index:0,optionIndex:0,value:""})},[T,ae,Y]),e.createElement(Ss,{verticalMargin:b.volumeBundle?.verticalMargin,$backgroundColor:b.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},(me||xe)&&e.createElement($s,{className:"yt-bundle-header"},me&&me.trim().length>0&&e.createElement(Ns,{fontSize:b.volumeBundle?.titleFontSize,$backgroundColor:b.volumeBundle?.titleBackgroundColor,textColor:b.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},me),e.createElement(Bs,{className:"yt-bundle-header-subtitle",fontSize:b.volumeBundle?.subtitleFontSize},xe)),"vertical"===le?e.createElement("div",{style:{display:"grid",gridTemplateColumns:R||4===E.length?"repeat(2, 1fr)":E.length>4?"repeat(3, 1fr)":`repeat(${E.length}, 1fr)`,justifyItems:"center",gap:R?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=T===t.tier,i=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:ue||"24px",...r?{border:`2px solid ${ce}`}:{border:`1px solid ${se}`},boxShadow:`6px 6px 0px -1px ${r?ce:se}20`,...t.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(r?"yt-volume-vertical-tier-item-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),onClick:()=>!i&&S(t.tier)},t.badgeTitle&&e.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:r?ce:se,color:r?de:pe,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:r?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},"Enabled"===b.volumeBundle?.discountBadgeVisibility&&R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=tu(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${eu(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${eu(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${eu(n.discountValue)}`);return i?e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},e.createElement(Ds,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i)):null})(),t.imageUrl&&e.createElement("img",{src:nu(t.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:ue||"24px",borderTopRightRadius:ue||"24px"},className:"yt-volume-vertical-tier-badge"})),e.createElement("div",{style:{padding:"8px",paddingTop:"0"}},e.createElement(As,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},e.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},e.createElement(_s,{style:{fontSize:R?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&!R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=tu(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${eu(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${eu(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${eu(n.discountValue)}`);return i?e.createElement(Ds,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i):null})(),r&&t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(je,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),e.createElement(Rs,{style:{lineHeight:"normal",fontSize:R?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null))),q(t.tier)?e.createElement(Os,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(h?0:2)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,e.createElement(Ls,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},tu(b.general.currencySymbol,a.storeCurrencyCode),eu(l),"unit-price"===r?"/unit":""),o>0&&e.createElement(Ms,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},tu(b.general.currencySymbol,a.storeCurrencyCode),eu(i),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{textAlign:"center",color:"#999",fontSize:"14px",fontWeight:"500",padding:"4px 0",lineHeight:"normal"}},"Out of Stock")),r&&!t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(je,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):e.createElement(e.Fragment,null,E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement(Is,{cornerRadiusType:a?.cornerRadiusType??"",key:t.tier,primaryBackgroundColorCta:ce??"",isSelected:T===t.tier,onClick:()=>S(t.tier),style:{borderRadius:ue,cursor:"pointer",backgroundColor:r?"#f5f5f5":"white",opacity:r?.6:1,...t?.badgeTitle&&{position:"relative",marginTop:"30px"}},className:"yt-volume-horizontal-tier-container "+(T===t.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2)},t.badgeTitle&&e.createElement(zs,{primaryTextColorCta:de,primaryBackgroundColorCta:ce,style:{lineHeight:"normal",position:"absolute",top:"-16.5px",left:"2%",right:"2%",marginInline:"auto"},className:"yt-volume-horizontal-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement(Fs,{cornerRadiusType:a?.cornerRadiusType??"",style:{borderRadius:ue,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},e.createElement(Ps,{className:"yt-volume-horizontal-tier-info"},e.createElement(qs,{"data-active":T===t.tier,accentColor:ce,className:"yt-volume-horizontal-tier-radio-wrapper"},e.createElement(Qs,{name:"tier",checked:T===t.tier,onChange:()=>!r&&S(t.tier),disabled:r,className:"yt-volume-horizontal-tier-radio-hidden"}),e.createElement(Us,{accentColor:ce,className:"yt-volume-horizontal-tier-radio-custom"})),e.createElement(As,{className:"yt-volume-horizontal-tier-details"},e.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},e.createElement(_s,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=tu(b.general.currencySymbol,a.storeCurrencyCode);let r="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(r="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${eu(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(r="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${eu(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(r="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${eu(n.discountValue)}`);return r?e.createElement(Ds,{primaryBackgroundColorCta:ce,isSelected:T===t.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},r):null})()),e.createElement(Rs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null)))),q(t.tier)?e.createElement(Os,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(0)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,o>0?e.createElement(Ms,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},tu(b.general.currencySymbol,a.storeCurrencyCode),eu(i),"unit-price"===r?"/unit":""):"",e.createElement(Ls,{className:"yt-volume-horizontal-tier-discounted-price"},tu(b.general.currencySymbol,a.storeCurrencyCode),eu(l),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"normal"}},e.createElement("span",{style:{color:"#999",fontSize:"14px",fontWeight:"500"}},"Out of Stock"))),T===t.tier&&e.createElement(Vs,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px 15px":"0",gap:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px":"0"}},Array.from({length:t.minimumQuantity}).map((n,o)=>{const i=t.tier-1,l=(I[i]||[])[o]||p.productDetails.options?.map(e=>e.values[0])||[],c=p?.productDetails?.options.some(e=>e.values.length>1)||1===p?.productDetails?.variants?.edges?.length&&"Default Title"!==p?.productDetails?.variants?.edges[0]?.node?.title;return e.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&e.createElement(Ys,{src:nu(ee(p,$,o,t.tier)),alt:p?.productDetails?.title||"Product",style:{height:"64px",width:"auto"},className:"yt-volume-horizontal-tier-product-image"}),("auto"===b?.volumeBundle?.variantSelectorType||"dropdown"===b?.volumeBundle?.variantSelectorType)&&e.createElement("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"}},p?.productDetails?.options?.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=L?.tier===t.tier&&L?.index===o&&L?.optionIndex===c,u=a?.variantOptions?.options?.find(e=>e.name===n.name);let m="";return"color"===u?.type&&(m=u?.values?.find(e=>e.name===l[c])?.value||""),e.createElement(Ks,{key:c,ref:e=>{W.current[o]||(W.current[o]=[]),W.current[o][c]=e},style:{zIndex:d?1e3:"auto",display:"flex",flexDirection:"column",gap:"4px"},isActive:d},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement(Js,{onClick:e=>{e.stopPropagation(),M(d?null:{tier:t.tier,index:o,optionIndex:c})},isActive:d,disabled:r},"color"===u?.type&&m&&e.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[c],e.createElement(Ie,{style:{display:"block"}})),d&&e.createElement(ed,{style:{zIndex:1001}},s.map((n,a)=>{const s=[...l];s[c]=n;const d=!U(t.tier,o,l,c,n)||r;p.productDetails.variants.edges.find(({node:e})=>e.title===s.join(" / "));const m=e=>{if(e.preventDefault(),e.stopPropagation(),F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=s,t[i]=n,t}),d){j({tier:T,index:o,optionIndex:c,value:n}),M(null);const e=s.join(" / "),r=p.productDetails.variants.edges.find(t=>t.node.title===e)?.node.id||$;return void G(t.tier,o,r)}const r=s.join(" / "),a=p.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;G(t.tier,o,a),M(null)},g=u?.values.find(e=>e.name===n);return"image"===u?.type&&g?.value?e.createElement(Gs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Xs,{src:g.value,alt:n}),n):"color"===u?.type&&g?.value?e.createElement(Gs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Zs,{style:{backgroundColor:g.value}}),n):e.createElement(Gs,{key:n,onClick:m,style:{cursor:"pointer"}},n)})))})),"swatches"===b?.volumeBundle?.variantSelectorType&&e.createElement(js,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},p?.productDetails?.options.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=a.variantOptions?.options?.find(e=>e.name===n.name)||null;return e.createElement("div",{key:n.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},s.map(n=>{const a=l[c]===n,s=!U(t.tier,o,l,c,n)||r,u=d?.values.find(e=>e.name===n),m=e=>{if(e.preventDefault(),e.stopPropagation(),s)return;const r=[...l];r[c]=n,F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),d=p.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;G(t.tier,o,d)},g={opacity:s?.5:1,cursor:s?"not-allowed":"pointer"};return"color"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button"+(a?" yt-volume-horizontal-tier-variant-color-button--selected":""),disabled:s},e.createElement("div",{style:{width:a?"24px":"20px",height:a?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},e.createElement("span",null))):"image"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:a?"#F7F7F7":"transparent",padding:"0px",width:a?"20px":"18px",height:a?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button"+(a?" yt-volume-horizontal-tier-variant-image-button--selected":""),disabled:s},e.createElement("img",{src:u.value,alt:n,style:{width:a?"26px":"24px",height:a?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):e.createElement(Ws,{key:n,isSelected:a,onClick:m,style:{...g,padding:"4px 8px",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default"+(a?" yt-volume-horizontal-tier-variant-button-default--selected":""),disabled:s},n)})))})))})),V&&V.tier===t.tier&&e.createElement("div",{style:{color:ce,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ce}1A`,padding:"12px",borderBottomLeftRadius:ue,borderBottomRightRadius:ue}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))})),a?.showCta&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod&&e.createElement("div",{style:{position:"relative"}},e.createElement(Hs,{bgColor:Y(T)?b.general?.ctaBackgroundColor:"#ccc",textColor:Y(T)?b.general?.ctaTextColor:"#666",border:`1px solid ${Y(T)?b.general?.ctaBorderColor||"#121212":"#999"}`,shadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Y(T)&&b.general?.customizeHoverState,backgroundColor:b.general?.ctaHoverBackgroundColor,textColor:b.general?.ctaHoverTextColor},onClick:async()=>{a?.personalizedForm?.title?_(!0):await te()},borderRadius:b.general.ctaBorderRadius??"",disabled:P||!Y(T),className:"yt-volume-add-to-cart-button"},Y(T)?e.createElement(e.Fragment,null,P?e.createElement(ge,{color:"white",loading:P,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},e.createElement("span",null,b.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",e.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const t=J(T);return e.createElement(e.Fragment,null,tu(b.general.currencySymbol,a.storeCurrencyCode),eu(t.discounted.toFixed(h?0:2))," ",t?.original!==t.discounted&&t?.original>t.discounted&&e.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},tu(b.general.currencySymbol,a.storeCurrencyCode),eu(t?.original.toFixed(h?0:2))," "))})()))):e.createElement(e.Fragment,null,"Out of Stock"))),a?.personalizedForm?.title&&e.createElement(Es,{isOpen:A,onClose:()=>_(!1),formConfig:a.personalizedForm,onCheckout:async e=>{await te(e),_(!1)},cta:{backgroundColor:b.general?.ctaBackgroundColor||"#121212",textColor:b.general?.ctaTextColor||"#FFFFFF"},isMobile:R}))}const od=c.div`
3498
+ `,td=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function nd({bundle:a,addToCartFunction:l,currentProductId:c,dispatchAnalyticsEvent:s}){const d=o(()=>{if(c){const e="gid://shopify/Product/"+c,t=a.products?.some(t=>t.productId===e);return t?e:a.products?.[0]?.productId}return a.products?.[0]?.productId},[c,a.products]),p=o(()=>td(d,a.products),[d,a.products]),u=r(null),m=r(null);r({}),document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[g,x]=t(0),[f,y]=t(""),b=a.customizations??{},h=!1===b?.general?.showDecimalsInBundlePricing,v=o(()=>p?.productDetails?.tracksInventory??!0,[p?.productDetails?.tracksInventory]),w=i(e=>{if(!v)return 1/0;if(!e)return 0;if(!e.inventoryItem?.tracked)return 1/0;let t=e.inventoryQuantity??0;return t>0?t:"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0},[v]),C=(o(()=>p?.productDetails?.variants?.edges?.reduce((e,{node:t})=>w(t)>0?e+1:e,0),[p,w]),o(()=>td(d,a.products)?.id,[d,a.products]));o(()=>C?td(d,a.products):void 0,[d,a.products,C]),o(()=>a.products?.some(e=>e.productDetails?.options?.some(e=>e.values.length>1))||!1,[a.products]),b.volumeBundle;const E=o(()=>a?.volumeTiers||[],[a?.volumeTiers]),k=E.findIndex(e=>e.isDefault),[T,S]=t(-1!==k?E[k].tier:E?.[0]?.tier||1),[$,N]=t(p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||""),[B,z]=t({}),[I,F]=t(E.reduce((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},()=>p?.productDetails?.options?.map(e=>e.values[0])||[]),e),{})||{}),[P,D]=t(!1),[A,_]=t(!1),[R,O]=t(window.innerWidth<550),[L,M]=t(null),[V,j]=t(null);r([]);const W=r([]),H=r(T);n(()=>{if(s?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:a._id,bundleType:"volume-bundle"}}),"officialhouseofzelena.myshopify.com"===window?.Shopify?.shop||"791204-63.myshopify.com"===window?.Shopify?.shop){const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelectorAll('[type="submit"]');t&&t.forEach(e=>{e.setAttribute("style","display: none;")})}const e=()=>{O(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{const e=e=>{L&&W.current[L.index]&&W.current[L.index][L.optionIndex]&&!W.current[L.index][L.optionIndex]?.contains(e.target)&&M(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[L]),i(e=>{const t=E.find(t=>t.tier===e);if(!t)return null;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];for(const e of o){const t=e.node;if(w(t)>=n){const e=t.title.split(" / ");return Array(n).fill(e)}}const r=[],i={},a=[...o].sort((e,t)=>{const n=w(e.node),o=w(t.node);return n===1/0&&o===1/0?0:n===1/0?-1:o===1/0?1:o-n});for(let e=0;e<n&&r.length<n;e++){let e=!1;for(const t of a){const n=t.node,o=i[n.id]||0;if(w(n)>o&&n.availableForSale){const t=n.title.split(" / ");r.push(t),i[n.id]=o+1,e=!0;break}}if(!e)return null}return r.length===n?r:null},[p,E,w]);const q=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=p?.productDetails?.variants?.edges||[];let r=0;for(const e of o){const t=w(e.node);if(t===1/0){r=1/0;break}r+=t}return r>=n},[E,p,w]);n(()=>{const e={},t=p?.productDetails?.variants?.edges?.find(e=>w(e?.node)>0)?.node?.id||p?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&E.forEach(n=>{e[n.tier]={};for(let o=0;o<n.minimumQuantity;o++)e[n.tier][o]=t}),z(e)},[p?.id,E?.map(e=>`${e.tier}-${e.minimumQuantity}`).join("|"),w]);const Q=(e,t)=>e?.productDetails?.variants?.edges?.find(e=>e.node.id===t)?.node,U=i((e,t,n,o,r)=>{const i=E.find(t=>t.tier===e);if(!i)return!1;const a=i.minimumQuantity,l=[...n];l[o]=r;const c=l.join(" / "),s=p?.productDetails?.variants?.edges?.find(e=>e.node.title===c)?.node;if(!s||0===w(s))return!1;const d={},u=B[e]||{};for(let e=0;e<a;e++){let n;if(e===t)n=s.id;else{const t=u[e]||$,o=Q(p,t);if(!o)return!1;n=o.id}d[n]=(d[n]||0)+1}for(const[e,t]of Object.entries(d)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,I,B,$,w]),Y=i(e=>{const t=E.find(t=>t.tier===e);if(!t)return!1;const n=t.minimumQuantity,o=e-1,r={};for(let e=0;e<n;e++){const t=(I[o]?.[e]||p.productDetails.options.map(e=>e.values[0])).join(" / "),n=p?.productDetails?.variants?.edges?.find(e=>e.node.title===t);if(!n)return!1;const i=n.node.id;r[i]=(r[i]||0)+1}for(const[e,t]of Object.entries(r)){const n=Q(p,e),o=w(n);if(o!==1/0&&t>o)return!1}return!0},[E,p,I,w]);n(()=>{x(e=>e+1)},[B]);const G=(e,t,n)=>{z(o=>({...o,[e]:{...o[e]||{},[t]:n}}))},X=i(()=>p?.productDetails?.variants?.edges?.find(e=>w(e.node)>0)?.node||p?.productDetails?.variants?.edges?.[0]?.node,[p,w]),Z=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]);n(()=>{H.current=T},[T]),n(()=>{V?(j(null),K()):K()},[T]),n(()=>{if(a){const e=X();if(e)y(e.id),N(e.id);else{const e=p?.productDetails?.variants?.edges?.[0]?.node?.id||"";y(e),N(e)}}},[a,p,X]);const K=()=>{const e=Z();if(e){const t=p?.productDetails?.variants?.edges?.find(t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e));let n=t?.node;if(n)N(String(n.id)),x(e=>e+1);else{const e=X();e&&(N(String(e.id)),n=e),x(e=>e+1)}if(n){0===w(n)?(j(null),setTimeout(()=>{j({tier:H.current,index:0,optionIndex:0,value:n.title})},0)):V&&j(null)}}};n(()=>{K();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",K),()=>{t=!1,window.removeEventListener("urlChange",K),window.history.pushState=n,window.history.replaceState=o}},[Z,p?.id,X,w]);const J=e=>{const t=E.find(t=>t.tier===e);if(!t)return{original:0,discounted:0,discountedFromPrice:0,discountedFromCompare:0,diffAmountFromPrice:0,diffAmountFromCompare:0,diffPercentFromPrice:0,diffPercentFromCompare:0,discountValue:0};let n=0,o=0,r=0;const i=B[e]||{};for(let e=0;e<t.minimumQuantity;e++){const t=i[e]||$,a=Q(p,t);if(!a)continue;const l=Number.parseFloat(a.price);n+=a.compareAtPrice?Number.parseFloat(a.compareAtPrice):l,o+=l,r+=l}if("percentOff"===a?.discountType){r*=1-(t.discountValue??0)/100}else"amountOff"===a?.discountType&&(r-=t.discountValue??0);const l=Math.max(0,r),c=b?.volumeBundle?.discountBadgeDisplay,s=b?.volumeBundle?.discountBadgeVisibility;let d=n;"Disabled"===s?d=l:"discount-on-price"===c&&(d=o);const u=o-l,m=d-l,g=o>0?u/o*100:0,x=d>0?m/d*100:0;return{original:d,discounted:l,discountedFromPrice:l,discountedFromCompare:l,diffAmountFromPrice:u,diffAmountFromCompare:m,diffPercentFromPrice:Math.round(g),diffPercentFromCompare:Math.round(x),discountValue:t.discountValue??0}},ee=(e,t,n,o)=>{let r=Q(e,t);if(o){const i=B[o]?.[n||0]||t;r=Q(e,i)}return r?.image?.url?r.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""},te=async e=>{if(Y(T))try{D(!0);const t=E.find(e=>e.tier===T);if(!t)return;const n={},o=B[t.tier]||{};for(let e=0;e<t.minimumQuantity;e++){const t=o[e]||$;n[t]?n[t].quantity+=1:n[t]={quantity:1}}s?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:a._id,bundleType:"volume-bundle",selectedProducts:p?[{id:p?.productId,title:p?.productDetails?.title}]:[],selectedVariants:Object.values(o)}});const r=J(t.tier),i=Array.from({length:t.minimumQuantity},(e,t)=>o[t]||$);l&&await l(r.original,i,void 0,void 0,e)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{D(!1)}else console.error("Selected tier is out of stock")};function ne(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}n(()=>{const e=()=>{if(b.volumeBundle?.addtoCartMethod&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=e.querySelector(".sr-headless-checkout");t&&t?.setAttribute("style","display: none;");const n=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let o=1;n&&n.value&&(o=parseInt(n.value,10)||1);const r=E.find(e=>e.tier===T);if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"], .t4s-quantity-wrapper').forEach(e=>e.remove());const i=r.minimumQuantity;let a={};const l=Math.max(i,o);if(o>i){const e=f||$;if(!e)return;a[e]=l}else{const e=B[r.tier]||{};for(let t=0;t<i;t++){let n=e[t];n||(n=$),n&&(a[n]=(a[n]||0)+1)}}const c=J(r.tier),s=Object.fromEntries(Object.entries(a).map(([e,t])=>[ne(e),Math.round(t)])),d=(t,n,o="bundle-input-field")=>{const r=document.createElement("input");r.type="hidden",r.name=t,r.value=n,r.className=o,e.appendChild(r)};if(o>i){const e=f||$;e&&d("id",ne(e))}d("properties[_bundle_price]",String(c.original)),d("properties[_bundle_tier]",String(r.tier)),d("properties[_bundle_items]",JSON.stringify(s));let p=0;Object.entries(s).forEach(([e,t])=>{t>0&&(d(`items[${p}][id]`,e),d(`items[${p}][quantity]`,String(t)),p++)}),requestAnimationFrame(()=>{const t=e.querySelector('[type="submit"]'),n=e.querySelector(".noti-btn-main-wrap"),r=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const o=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");o&&(o.textContent=n)};o<=i&&(V?(r(t,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),n&&(n.style.display="block",n.classList.remove("hidden"),n.classList.add("block"))):(r(t,!1,"Add to cart"),t&&t.classList.remove("btn--sold-out","hidden"),n&&(n.style.display="none",n.classList.add("hidden"))))})};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame(()=>{e()})};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}},[T,JSON.stringify(B),$,b.volumeBundle?.cardStyle,c,f,V]);const oe=o(()=>E.find(e=>e.tier===T),[E,T]),re=o(()=>oe?J(oe.tier):null,[oe,B,$]),ie=o(()=>{if(!oe||!re)return;const e=B[oe.tier]||{},t={};for(let n=0;n<oe.minimumQuantity;n++){const o=e[n]||$;t[o]=(t[o]||0)+1}return t},[oe?.minimumQuantity,$,B,re]),ae=o(()=>Object.entries(ie??{}).map(([e,t])=>({variantId:e,quantity:t})),[ie]);if(n(()=>{if(!oe||!re)return;const e={tier:T,items:oe.minimumQuantity,discountedPrice:re.discounted,originalPrice:re.original,variants:ae,productId:p?.id??null,tierMeta:{title:oe.title,subtitle:oe.subtitle,badgeTitle:oe.badgeTitle},productData:p,tierData:oe},t=m.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{m.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t),l&&(window.ytVolumeBundle={bundle:a,addToCart:l,currentTier:oe,selectedVariants:ae},window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:{...e,addToCart:l}})))},50),()=>{u.current&&clearTimeout(u.current)})},[T,oe?.tier,oe?.minimumQuantity,re?.discounted,re?.original,p?.id,JSON.stringify(ae),l,a]),n(()=>()=>{window.ytVolumeBundle=void 0,window.dispatchEvent(new CustomEvent("yt-volume-bundle-updated",{detail:void 0}))},[]),n(()=>{if(!$||!p)return;const e=Q(p,$);if(!e)return;const t=e.title.split(" / "),n={},o={};E.forEach(e=>{const r=e.tier-1,i={};for(let t=0;t<e.minimumQuantity;t++)i[t]=$;n[e.tier]=i,o[r]=Array(e.minimumQuantity).fill(t)}),z(e=>({...e,...n})),F(e=>({...e,...o}))},[$,p?.id,E.length]),!l)return e.createElement(e.Fragment,null);const le=b.volumeBundle?.cardStyle,ce=b.general?.primaryColor,se=b.general?.secondaryColor,de=b.general.primaryContrastColor,pe=b.general.secondaryContrastColor,ue="high"===a.cornerRadiusType?"20px":"medium"===a.cornerRadiusType?"6px":"0px",me="bundles"==a.appName?a.pageHeader?.title:a?.title,xe="bundles"==a.appName?a.pageHeader?.description:a?.subtitle;return n(()=>{const e=Y(T);e?j(null):e||j({tier:T,index:0,optionIndex:0,value:""})},[T,ae,Y]),e.createElement(Ss,{verticalMargin:b.volumeBundle?.verticalMargin,$backgroundColor:b.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},(me||xe)&&e.createElement($s,{className:"yt-bundle-header"},me&&me.trim().length>0&&e.createElement(Ns,{fontSize:b.volumeBundle?.titleFontSize,$backgroundColor:b.volumeBundle?.titleBackgroundColor,textColor:b.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},me),e.createElement(Bs,{className:"yt-bundle-header-subtitle",fontSize:b.volumeBundle?.subtitleFontSize},xe)),"vertical"===le?e.createElement("div",{style:{display:"grid",gridTemplateColumns:R||4===E.length?"repeat(2, 1fr)":E.length>4?"repeat(3, 1fr)":`repeat(${E.length}, 1fr)`,justifyItems:"center",gap:R?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=T===t.tier,i=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:ue||"24px",...r?{border:`2px solid ${ce}`}:{border:`1px solid ${se}`},boxShadow:`6px 6px 0px -1px ${r?ce:se}20`,...t.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(r?"yt-volume-vertical-tier-item-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),onClick:()=>!i&&S(t.tier)},t.badgeTitle&&e.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:r?ce:se,color:r?de:pe,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:r?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},"Enabled"===b.volumeBundle?.discountBadgeVisibility&&R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=nu(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${tu(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${tu(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${tu(n.discountValue)}`);return i?e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},e.createElement(Ds,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i)):null})(),t.imageUrl&&e.createElement("img",{src:ou(t.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:ue||"24px",borderTopRightRadius:ue||"24px"},className:"yt-volume-vertical-tier-badge"})),e.createElement("div",{style:{padding:"8px",paddingTop:"0"}},e.createElement(As,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},e.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},e.createElement(_s,{style:{fontSize:R?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&!R&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=nu(b.general.currencySymbol,a.storeCurrencyCode);let i="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(i="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${tu(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(i="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${tu(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(i="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${tu(n.discountValue)}`);return i?e.createElement(Ds,{primaryBackgroundColorCta:r?ce:se,isSelected:r,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:r?de:pe},className:"yt-volume-vertical-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},i):null})(),r&&t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(je,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),e.createElement(Rs,{style:{lineHeight:"normal",fontSize:R?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null))),q(t.tier)?e.createElement(Os,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(h?0:2)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,e.createElement(Ls,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},nu(b.general.currencySymbol,a.storeCurrencyCode),tu(l),"unit-price"===r?"/unit":""),o>0&&e.createElement(Ms,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},nu(b.general.currencySymbol,a.storeCurrencyCode),tu(i),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{textAlign:"center",color:"#999",fontSize:"14px",fontWeight:"500",padding:"4px 0",lineHeight:"normal"}},"Out of Stock")),r&&!t.imageUrl&&e.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},e.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ce,color:de,padding:"2px"}},e.createElement(je,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))})):e.createElement(e.Fragment,null,E.map(t=>{const n=J(t.tier),o=n.original-n.discounted,r=!q(t.tier);return e.createElement(e.Fragment,{key:t.tier},e.createElement(Is,{cornerRadiusType:a?.cornerRadiusType??"",key:t.tier,primaryBackgroundColorCta:ce??"",isSelected:T===t.tier,onClick:()=>S(t.tier),style:{borderRadius:ue,cursor:"pointer",backgroundColor:r?"#f5f5f5":"white",opacity:r?.6:1,...t?.badgeTitle&&{position:"relative",marginTop:"30px"}},className:"yt-volume-horizontal-tier-container "+(T===t.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType,"data-minimum-quantity":t.minimumQuantity,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2)},t.badgeTitle&&e.createElement(zs,{primaryTextColorCta:de,primaryBackgroundColorCta:ce,style:{lineHeight:"normal",position:"absolute",top:"-16.5px",left:"2%",right:"2%",marginInline:"auto"},className:"yt-volume-horizontal-tier-badge","data-tier":t.tier,"data-badge-title":t.badgeTitle},t.badgeTitle),e.createElement(Fs,{cornerRadiusType:a?.cornerRadiusType??"",style:{borderRadius:ue,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},e.createElement(Ps,{className:"yt-volume-horizontal-tier-info"},e.createElement(qs,{"data-active":T===t.tier,accentColor:ce,className:"yt-volume-horizontal-tier-radio-wrapper"},e.createElement(Qs,{name:"tier",checked:T===t.tier,onChange:()=>!r&&S(t.tier),disabled:r,className:"yt-volume-horizontal-tier-radio-hidden"}),e.createElement(Us,{accentColor:ce,className:"yt-volume-horizontal-tier-radio-custom"})),e.createElement(As,{className:"yt-volume-horizontal-tier-details"},e.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},e.createElement(_s,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},t.title?t.title:e.createElement(e.Fragment,null,"Buy ",t.minimumQuantity,", Get"," ",t.discountValue,"% Off")),"Enabled"===b.volumeBundle?.discountBadgeVisibility&&(()=>{if(!((n?.diffAmountFromPrice>0||n?.diffAmountFromCompare>0)&&(n?.diffPercentFromPrice>0||n?.diffPercentFromCompare>0)))return null;const o=nu(b.general.currencySymbol,a.storeCurrencyCode);let r="";if(b?.volumeBundle?.discountBadgeDisplay&&b?.volumeBundle?.discountDisplayType){const{discountBadgeDisplay:e,discountDisplayType:t}=b.volumeBundle;"discount-on-compare"===e&&(r="percentage"===t?n.diffPercentFromCompare>0?`${Math.round(n.diffPercentFromCompare)}% Off`:"":n.diffAmountFromCompare>0?`Save ${o}${tu(n.diffAmountFromCompare)}`:""),"discount-on-price"===e&&(r="percentage"===t?n.diffPercentFromPrice>0?`${Math.round(n.diffPercentFromPrice)}% Off`:"":n.diffAmountFromPrice>0?`Save ${o}${tu(n.diffAmountFromPrice)}`:"")}else n?.discountValue>0&&(r="percentOff"===a?.discountType?`${n.discountValue}% Off`:`Save ${o}${tu(n.discountValue)}`);return r?e.createElement(Ds,{primaryBackgroundColorCta:ce,isSelected:T===t.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":t.tier,"data-discount-value":n.discountValue,"data-discount-type":a?.discountType},r):null})()),e.createElement(Rs,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},t.subtitle?t.subtitle:e.createElement(e.Fragment,null)))),q(t.tier)?e.createElement(Os,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":t.tier,"data-original-price":n.original.toFixed(h?0:2),"data-discounted-price":n.discounted.toFixed(h?0:2),"data-savings":o.toFixed(0)},(()=>{const r=b?.volumeBundle?.tierPriceType||"tier-price";if("none"===r)return;let i="",l="";if("unit-price"===r){const e=n.discounted/t.minimumQuantity;i=(n.original/t.minimumQuantity).toFixed(h?0:2),l=e.toFixed(h?0:2)}else"tier-price"===r&&(i=n.original.toFixed(h?0:2),l=n.discounted.toFixed(h?0:2));return e.createElement(e.Fragment,null,o>0?e.createElement(Ms,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},nu(b.general.currencySymbol,a.storeCurrencyCode),tu(i),"unit-price"===r?"/unit":""):"",e.createElement(Ls,{className:"yt-volume-horizontal-tier-discounted-price"},nu(b.general.currencySymbol,a.storeCurrencyCode),tu(l),"unit-price"===r?"/unit":""))})()):e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:"normal"}},e.createElement("span",{style:{color:"#999",fontSize:"14px",fontWeight:"500"}},"Out of Stock"))),T===t.tier&&e.createElement(Vs,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px 15px":"0",gap:p.productDetails.variants.edges.length>1||1===p.productDetails.variants.edges.length&&"Default Title"!==p.productDetails.variants.edges[0].node.title?"10px":"0"}},Array.from({length:t.minimumQuantity}).map((n,o)=>{const i=t.tier-1,l=(I[i]||[])[o]||p.productDetails.options?.map(e=>e.values[0])||[],c=p?.productDetails?.options.some(e=>e.values.length>1)||1===p?.productDetails?.variants?.edges?.length&&"Default Title"!==p?.productDetails?.variants?.edges[0]?.node?.title;return e.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&e.createElement(Ys,{src:ou(ee(p,$,o,t.tier)),alt:p?.productDetails?.title||"Product",style:{height:"64px",width:"auto"},className:"yt-volume-horizontal-tier-product-image"}),("auto"===b?.volumeBundle?.variantSelectorType||"dropdown"===b?.volumeBundle?.variantSelectorType)&&e.createElement("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap"}},p?.productDetails?.options?.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=L?.tier===t.tier&&L?.index===o&&L?.optionIndex===c,u=a?.variantOptions?.options?.find(e=>e.name===n.name);let m="";return"color"===u?.type&&(m=u?.values?.find(e=>e.name===l[c])?.value||""),e.createElement(Ks,{key:c,ref:e=>{W.current[o]||(W.current[o]=[]),W.current[o][c]=e},style:{zIndex:d?1e3:"auto",display:"flex",flexDirection:"column",gap:"4px"},isActive:d},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement(Js,{onClick:e=>{e.stopPropagation(),M(d?null:{tier:t.tier,index:o,optionIndex:c})},isActive:d,disabled:r},"color"===u?.type&&m&&e.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[c],e.createElement(Ie,{style:{display:"block"}})),d&&e.createElement(ed,{style:{zIndex:1001}},s.map((n,a)=>{const s=[...l];s[c]=n;const d=!U(t.tier,o,l,c,n)||r;p.productDetails.variants.edges.find(({node:e})=>e.title===s.join(" / "));const m=e=>{if(e.preventDefault(),e.stopPropagation(),F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=s,t[i]=n,t}),d){j({tier:T,index:o,optionIndex:c,value:n}),M(null);const e=s.join(" / "),r=p.productDetails.variants.edges.find(t=>t.node.title===e)?.node.id||$;return void G(t.tier,o,r)}const r=s.join(" / "),a=p.productDetails.variants.edges.find(e=>e.node.title===r)?.node.id||$;G(t.tier,o,a),M(null)},g=u?.values.find(e=>e.name===n);return"image"===u?.type&&g?.value?e.createElement(Gs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Xs,{src:g.value,alt:n}),n):"color"===u?.type&&g?.value?e.createElement(Gs,{key:n,onClick:m,style:{cursor:"pointer"}},e.createElement(Zs,{style:{backgroundColor:g.value}}),n):e.createElement(Gs,{key:n,onClick:m,style:{cursor:"pointer"}},n)})))})),"swatches"===b?.volumeBundle?.variantSelectorType&&e.createElement(js,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},p?.productDetails?.options.map((n,c)=>{const s=n.values.filter(e=>p.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[c]===e));if(0===s.length||1===s.length&&"Default Title"===s[0])return null;const d=a.variantOptions?.options?.find(e=>e.name===n.name)||null;return e.createElement("div",{key:n.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},b?.volumeBundle?.showVariantOptionsLabel&&n?.name&&e.createElement("p",{style:{lineHeight:"normal",fontSize:"14px",margin:0}},n?.name),e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},s.map(n=>{const a=l[c]===n,s=!U(t.tier,o,l,c,n)||r,u=d?.values.find(e=>e.name===n),m=e=>{if(e.preventDefault(),e.stopPropagation(),s)return;const r=[...l];r[c]=n,F(e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t});const a=r.join(" / "),d=p.productDetails.variants.edges.find(e=>e.node.title===a)?.node.id||$;G(t.tier,o,d)},g={opacity:s?.5:1,cursor:s?"not-allowed":"pointer"};return"color"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button"+(a?" yt-volume-horizontal-tier-variant-color-button--selected":""),disabled:s},e.createElement("div",{style:{width:a?"24px":"20px",height:a?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},e.createElement("span",null))):"image"===d?.type&&u?.value?e.createElement("button",{key:n,onClick:m,style:{...g,border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:a?"#F7F7F7":"transparent",padding:"0px",width:a?"20px":"18px",height:a?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button"+(a?" yt-volume-horizontal-tier-variant-image-button--selected":""),disabled:s},e.createElement("img",{src:u.value,alt:n,style:{width:a?"26px":"24px",height:a?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):e.createElement(Ws,{key:n,isSelected:a,onClick:m,style:{...g,padding:"4px 8px",border:a?`1px solid ${b.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default"+(a?" yt-volume-horizontal-tier-variant-button-default--selected":""),disabled:s},n)})))})))})),V&&V.tier===t.tier&&e.createElement("div",{style:{color:ce,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ce}1A`,padding:"12px",borderBottomLeftRadius:ue,borderBottomRightRadius:ue}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))})),a?.showCta&&"shopify_atc_button"!==b.volumeBundle?.addtoCartMethod&&e.createElement("div",{style:{position:"relative"}},e.createElement(Hs,{bgColor:Y(T)?b.general?.ctaBackgroundColor:"#ccc",textColor:Y(T)?b.general?.ctaTextColor:"#666",border:`1px solid ${Y(T)?b.general?.ctaBorderColor||"#121212":"#999"}`,shadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,hoverProperties:{customizeHoverState:!!Y(T)&&b.general?.customizeHoverState,backgroundColor:b.general?.ctaHoverBackgroundColor,textColor:b.general?.ctaHoverTextColor},onClick:async()=>{a?.personalizedForm?.title?_(!0):await te()},borderRadius:b.general.ctaBorderRadius??"",disabled:P||!Y(T),className:"yt-volume-add-to-cart-button"},Y(T)?e.createElement(e.Fragment,null,P?e.createElement(ge,{color:"white",loading:P,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},e.createElement("span",null,b.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",e.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const t=J(T);return e.createElement(e.Fragment,null,nu(b.general.currencySymbol,a.storeCurrencyCode),tu(t.discounted.toFixed(h?0:2))," ",t?.original!==t.discounted&&t?.original>t.discounted&&e.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},nu(b.general.currencySymbol,a.storeCurrencyCode),tu(t?.original.toFixed(h?0:2))," "))})()))):e.createElement(e.Fragment,null,"Out of Stock"))),a?.personalizedForm?.title&&e.createElement(Es,{isOpen:A,onClose:()=>_(!1),formConfig:a.personalizedForm,onCheckout:async e=>{await te(e),_(!1)},cta:{backgroundColor:b.general?.ctaBackgroundColor||"#121212",textColor:b.general?.ctaTextColor||"#FFFFFF"},isMobile:R}))}const od=c.div`
3499
3499
  container-type: inline-size;
3500
3500
  border-radius: ${e=>e.borderRadius?e.borderRadius:"8px"};
3501
3501
  max-width: 800px;
@@ -4019,7 +4019,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4019
4019
  font-size: 11px;
4020
4020
  padding: 4px 8px;
4021
4021
  }
4022
- `,Ad=({bundle:i,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t({}),[d,p]=t(!1),[u,m]=t(!1),[g,x]=t(0),[f,y]=t(0),[b,h]=t(""),[v,w]=t([]),[C,E]=t({}),[k,T]=t(!1),[S,$]=t(window.innerWidth<450),N=i.builderTiers?.productTier||[],B=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),{originalPrice:z,dealPrice:I,offerValue:F}=o(()=>{const e=[];let t=0;Object.values(c).forEach(n=>{n.productId&&n.variantId&&(e.push({productId:n.productId,variantId:n.variantId}),t++)});let n=0,o=0;for(const{productId:t,variantId:r}of e){const e=i.products.find(e=>e.productId===t);if(!e)continue;const a=e?.productDetails?.variants?.edges?.find(e=>e?.node?.id===r)?.node;if(!a)continue;const l=Number.parseFloat(a?.price||"0"),c=Number.parseFloat(a?.compareAtPrice||"0");n+=l,o+=c>0?c:l}let r=n;(t===N.length||i?.dealAmount)&&(i?.percentageOff?r=n*(1-i.percentageOff/100):i?.dealAmount?r=i.dealAmount:i?.amountOff&&i.amountOff<n&&(r=n-i.amountOff));const a=o||n,l=a-r;return{originalPrice:a.toFixed(2),dealPrice:r.toFixed(2),offerValue:l.toFixed(2)}},[i,c,N.length]);n(()=>{x(N.length-Object.keys(c).length)},[c]),n(()=>{const e={};let t=!1;N.forEach((n,o)=>{if(n.isFixed&&n.products&&n.products.length>0){const r=n.products[0];if(r&&r.productId){const n=r?.variantIds?.[0]||D(r?.productId);n&&(e[o]={productId:r.productId,variantId:n},t=!0)}}}),t&&s(t=>({...t,...e}))},[N]),n(()=>{if(null===f||0===N.length)return;const e=N[f].products.map(e=>e.productId),t=new Map;i.products.forEach(n=>{e.includes(n.productId)&&!t.has(n.productId)&&t.set(n.productId,n)});let n=Array.from(t.values());if(""!==b.trim()){const e=b.toLowerCase();n=n.filter(t=>t.productDetails.title.toLowerCase().includes(e)||t.productDetails.selectedVariant?.displayName?.toLowerCase().includes(e)||t.productDetails.collections?.edges?.some(t=>t.node.title.toLowerCase().includes(e)))}w(n)},[b,i.products,f,N]);const P=e=>{const t=i.products.find(t=>t.productId===e);return t?.productDetails},D=e=>{const t=i.products.find(t=>t.productId===e);if(!t||!t.productDetails?.variants?.edges?.length)return"";const n=t.productDetails.variants.edges.find(e=>B(t.productDetails,e.node.id)>0)?.node;return n?n.id:t.productDetails.variants.edges[0].node.id},_=(e,t)=>{if(null==f)return;const n=t||D(e),o=i.products.find(t=>t.productId===e);if(o){if(0===B(o.productDetails,n))return void console.log("Cannot select out of stock variant")}s(t=>({...t,[f]:{productId:e,variantId:n}})),p(!1),h("")},R=e=>{s(t=>{const n={...t};return delete n[e],n}),E({})},O=e=>{const t=N[e];if(t.isFixed)return;y(e),p(!0),h("");const n=t.products.map(e=>e.productId),o=i.products.filter(e=>n.includes(e.productId)),r=new Map;o.forEach(e=>{r.has(e.productId)||r.set(e.productId,e)}),w(Array.from(r.values()))},L=async e=>{const t=Object.values(c).map(e=>{const t=i.products.find(t=>t.productId===e.productId);return{id:t?.productId,title:t?.productDetails?.title}});l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"mixandmatch-bundle",byobBundleType:i.builderTiers?.type??"builder",selectedProducts:t}}),T(!0);try{if(g>0)return console.log("Please select all products"),void T(!1);const t=Object.values(c).map(e=>e.variantId),n=Object.values(c).map(e=>{const t=i.products.find(t=>t.productId===e.productId);if(!t)return null;const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e.variantId)?.node;return n?{variantId:e.variantId,price:Number(n.price)}:null}).filter(Boolean);await a(t.length,t,Number(I),n,e)}catch(e){console.log("Add to cart error:",e)}finally{T(!1)}};n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:i._id,bundleType:"mixandmatch-bundle"}});const e=()=>{$(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const M=i.customizations,V=S,j="bundles"===i.appName?i.pageHeader?.title:i?.title,W="bundles"===i.appName?i.pageHeader?.description:i?.subtitle;return e.createElement(e.Fragment,null,e.createElement(od,{verticalMargin:M.comboBundle.verticalMargin,borderRadius:"20px"},M.comboBundle.embedContentVisibility&&e.createElement(rd,null,M.comboBundle?.embedContentVisibility&&M.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"10px",width:"100%",textAlign:M.comboBundle.infoAlignment||"left"}},e.createElement("h2",{style:{fontSize:"28px",color:M.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},j)),M.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&Number(I)>1&&e.createElement(e.Fragment,null,e.createElement(id,{infoAlignment:M.comboBundle.infoAlignment},e.createElement(ad,null,tu(M.general.currencySymbol,i.storeCurrencyCode),eu(I)),Number(I)<Number(z)&&e.createElement(ld,{style:{minWidth:"fit-content"}},tu(M.general.currencySymbol,i.storeCurrencyCode)," ",eu(z)),e.createElement(cd,{style:{minWidth:"fit-content"}},"In Stock")),e.createElement(sd,{style:{textAlign:M.comboBundle.infoAlignment||"left",fontSize:M.comboBundle.productDescriptionFontSize}},"Tax included. Shipping calculated at checkout."))),e.createElement(dd,{gridSize:N.length,isHorizontal:V},N.map((t,o)=>{const i=(e=>!!c[e]&&!!c[e].productId)(o),{product:a,variantId:l}=(e=>{const t=c?.[e];return t?{product:P(t.productId),variantId:t.variantId}:{product:void 0,variantId:""}})(o),s=a?((e,t)=>{if(!e||!e.variants.edges)return null;const n=e.variants.edges.find(e=>e.node.id===t);return n?.node})(a,l):null,d=t.isFixed,p=r(null);return n(()=>{const e=p.current;if(!e)return;const t=e.querySelector("span");if(!t)return;const n=e.clientWidth,o=t.scrollWidth;if(o<=n)return e.setAttribute("data-overflow","false"),e.style.removeProperty("--scroll-end"),void e.style.removeProperty("--duration");const r=-(o-n);e.style.setProperty("--scroll-end",`${r}px`);const i=2*Math.max(1,Math.abs(r)/40)+3;e.style.setProperty("--duration",`${i}s`),e.setAttribute("data-overflow","true")},[s?.displayName,s?.title]),i&&a?e.createElement(pd,{key:`tier-${o}`,onClick:()=>!d&&O(o),style:{borderRadius:"20px",cursor:d?"default":"pointer"},isHorizontal:V,infoAlignment:M.comboBundle.infoAlignment},!d&&e.createElement(yd,{onClick:e=>{e.stopPropagation(),R(o)}},"×"),e.createElement(md,{src:a?.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=200&width=200",alt:a?.title,style:{aspectRatio:M?.general.imageAspectRatio||"1/1"},isHorizontal:V}),e.createElement(gd,{style:{color:"#1e1e1e",textAlign:"center",...V&&"right"===M.comboBundle.infoAlignment&&{padding:"0 8px",textAlign:"right",alignItems:"flex-end"},...V&&"left"===M.comboBundle.infoAlignment&&{padding:"0 5px",textAlign:"left",alignItems:"flex-start"},...!V&&"left"===M.comboBundle.infoAlignment&&{padding:"0 10px"},...V&&"center"===M.comboBundle.infoAlignment&&{textAlign:"left",alignItems:"flex-start",padding:"0 5px"}},isHorizontal:V},e.createElement(fd,{style:{fontSize:"15px",width:"100%",display:"flex",alignItems:"center",fontWeight:"600",textAlign:"center",lineHeight:"normal"},ref:p},e.createElement("span",null,a?.title," - ",s?.title)))):e.createElement(ud,{key:`tier-${o}`,onClick:()=>!d&&O(o),isHorizontal:V,infoAlignment:M.comboBundle.infoAlignment,style:{cursor:d?"default":"pointer"}},d?e.createElement("div",{style:{textAlign:"center",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},e.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"8px"}},"Fixed Product"),e.createElement("div",{style:{fontSize:"14px",fontWeight:"600"}},t.title||`Product ${o+1}`)):e.createElement(e.Fragment,null,e.createElement("div",{style:{width:"100%",height:"80%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"18px",borderTopRightRadius:"18px",flexShrink:0,backgroundColor:"#f8f9fa"}},e.createElement(bd,null,"+")),e.createElement(xd,{style:{fontSize:"15px",fontWeight:"600",color:M.comboBundle.titleTextColor||"#1e1e1e",lineHeight:"normal",height:"20%",display:"flex",alignItems:"center",justifyContent:"center"},isHorizontal:V,infoAlignment:M.comboBundle.infoAlignment},e.createElement("p",{style:{width:"80%",margin:"0",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},t.title?`${t.title}`:`Select Product ${o+1}`))))})),e.createElement(hd,{hoverProperties:{customizeHoverState:M.general.customizeHoverState,backgroundColor:M.general.ctaHoverBackgroundColor,textColor:M.general.ctaHoverTextColor},borderRadius:M.general.ctaBorderRadius,primaryBgColor:M.general.ctaBackgroundColor,onClick:async()=>{0===g&&i?.personalizedForm?.title?m(!0):await L()},textColor:M.general.ctaTextColor,borderColor:M.general.ctaBorderColor},0===g?k?e.createElement(ge,{color:"white",loading:k,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,M.comboBundle.ctaTitle||"Add Bundle to cart"):`Add ${g} more item(s)`),M.comboBundle?.embedContentVisibility&&M.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{style:{margin:"20px 0px"}},e.createElement("h4",{style:{fontSize:"16px",color:M.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:M.general.primaryColor+"20",textAlign:M.comboBundle.infoAlignment||"left"}},"Description"),e.createElement("div",{style:{fontSize:M.comboBundle.productDescriptionFontSize||"16px",color:M.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:M.general.primaryColor+"08",textAlign:M.comboBundle.infoAlignment||"left"},dangerouslySetInnerHTML:{__html:W}}))),d&&A(e.createElement(vd,{onClick:()=>p(!1)},e.createElement(wd,{onClick:e=>e.stopPropagation()},e.createElement(Cd,{style:{position:"sticky",top:0,background:"#fff",zIndex:10}},e.createElement("div",{style:{display:"flex",width:"100%",gap:"2px",alignItems:"center",marginBottom:"8px"}},e.createElement(Ed,{placeholder:"Search",value:b,onChange:e=>{h(e.target.value)}}),e.createElement(kd,{onClick:()=>p(!1)},"Cancel")),e.createElement("div",{style:{height:"1px",width:"100%",backgroundColor:"#EBEBEB"}})),e.createElement("div",{style:{marginBottom:S?"20px":"5px",flex:1,minHeight:0,overflow:"scroll"}},e.createElement(Td,{style:{height:"auto",flex:"unset"}},v?.length>0?v?.map(t=>{const n=t?.productDetails;if(!n)return null;const o=(e=>{if(null==f)return!1;const t=c?.[f];return!!t&&t.productId===e})(t.productId),r=D(t.productId);let a=r||"";return a=o&&null!==f?c?.[f]?.variantId||a:C[t.productId]||r,e.createElement(Sd,{className:"mixAndMatch-product-item",primaryBgColor:M.general.primaryColor||"#1e1e1e",key:n.id,isSelected:o,onClick:()=>{_(t.productId,a)}},e.createElement($d,{className:"mixAndMatch-vendor-image",src:n.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=50&width=50",alt:n.title}),e.createElement(Nd,{className:"mixAndMatch-vendor-info"},e.createElement(Bd,{className:"mixAndMatch-vendor-name"},n.title),e.createElement(Pd,{className:"mixAndMatch-variant-options"},n.variants?.edges?.filter(({node:e})=>"Default Title"!==e.title)?.map(({node:r})=>{const i=0===B(n,r.id);return e.createElement(Dd,{className:"mixAndMatch-variant-button "+(a===r.id?"mixAndMatch-variant-button--selected":""),primaryBgColor:M.general?.primaryColor,disabled:!!o||i,key:r.id,isSelected:a===r.id,tierHasProductId:!!o,onClick:e=>{var n,o;e.stopPropagation(),i||(n=t.productId,o=r.id,E(e=>({...e,[n]:o})))},style:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"}},r.title)}))),e.createElement(zd,{cornerRadiusType:i?.cornerRadiusType??"",primaryBgColor:M.general?.primaryColor||"#1e1e1e",onClick:()=>o?R(f||0):_(t.productId,a)},o?e.createElement(Id,null,"Added"):" + Add"))}):e.createElement(Fd,null,'No products found matching "',b,'"'))))),document.body),i?.personalizedForm?.title&&e.createElement(Es,{isOpen:u,onClose:()=>m(!1),formConfig:i.personalizedForm,onCheckout:async e=>{await L(e),m(!1)},cta:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",textColor:M.general?.ctaTextColor||"#FFFFFF"},isMobile:S}))},_d=c.div`
4022
+ `,Ad=({bundle:i,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t({}),[d,p]=t(!1),[u,m]=t(!1),[g,x]=t(0),[f,y]=t(0),[b,h]=t(""),[v,w]=t([]),[C,E]=t({}),[k,T]=t(!1),[S,$]=t(window.innerWidth<450),N=i.builderTiers?.productTier||[],B=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),{originalPrice:z,dealPrice:I,offerValue:F}=o(()=>{const e=[];let t=0;Object.values(c).forEach(n=>{n.productId&&n.variantId&&(e.push({productId:n.productId,variantId:n.variantId}),t++)});let n=0,o=0;for(const{productId:t,variantId:r}of e){const e=i.products.find(e=>e.productId===t);if(!e)continue;const a=e?.productDetails?.variants?.edges?.find(e=>e?.node?.id===r)?.node;if(!a)continue;const l=Number.parseFloat(a?.price||"0"),c=Number.parseFloat(a?.compareAtPrice||"0");n+=l,o+=c>0?c:l}let r=n;(t===N.length||i?.dealAmount)&&(i?.percentageOff?r=n*(1-i.percentageOff/100):i?.dealAmount?r=i.dealAmount:i?.amountOff&&i.amountOff<n&&(r=n-i.amountOff));const a=o||n,l=a-r;return{originalPrice:a.toFixed(2),dealPrice:r.toFixed(2),offerValue:l.toFixed(2)}},[i,c,N.length]);n(()=>{x(N.length-Object.keys(c).length)},[c]),n(()=>{const e={};let t=!1;N.forEach((n,o)=>{if(n.isFixed&&n.products&&n.products.length>0){const r=n.products[0];if(r&&r.productId){const n=r?.variantIds?.[0]||D(r?.productId);n&&(e[o]={productId:r.productId,variantId:n},t=!0)}}}),t&&s(t=>({...t,...e}))},[N]),n(()=>{if(null===f||0===N.length)return;const e=N[f].products.map(e=>e.productId),t=new Map;i.products.forEach(n=>{e.includes(n.productId)&&!t.has(n.productId)&&t.set(n.productId,n)});let n=Array.from(t.values());if(""!==b.trim()){const e=b.toLowerCase();n=n.filter(t=>t.productDetails.title.toLowerCase().includes(e)||t.productDetails.selectedVariant?.displayName?.toLowerCase().includes(e)||t.productDetails.collections?.edges?.some(t=>t.node.title.toLowerCase().includes(e)))}w(n)},[b,i.products,f,N]);const P=e=>{const t=i.products.find(t=>t.productId===e);return t?.productDetails},D=e=>{const t=i.products.find(t=>t.productId===e);if(!t||!t.productDetails?.variants?.edges?.length)return"";const n=t.productDetails.variants.edges.find(e=>B(t.productDetails,e.node.id)>0)?.node;return n?n.id:t.productDetails.variants.edges[0].node.id},_=(e,t)=>{if(null==f)return;const n=t||D(e),o=i.products.find(t=>t.productId===e);if(o){if(0===B(o.productDetails,n))return void console.log("Cannot select out of stock variant")}s(t=>({...t,[f]:{productId:e,variantId:n}})),p(!1),h("")},R=e=>{s(t=>{const n={...t};return delete n[e],n}),E({})},O=e=>{const t=N[e];if(t.isFixed)return;y(e),p(!0),h("");const n=t.products.map(e=>e.productId),o=i.products.filter(e=>n.includes(e.productId)),r=new Map;o.forEach(e=>{r.has(e.productId)||r.set(e.productId,e)}),w(Array.from(r.values()))},L=async e=>{const t=Object.values(c).map(e=>{const t=i.products.find(t=>t.productId===e.productId);return{id:t?.productId,title:t?.productDetails?.title}});l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"mixandmatch-bundle",byobBundleType:i.builderTiers?.type??"builder",selectedProducts:t}}),T(!0);try{if(g>0)return console.log("Please select all products"),void T(!1);const t=Object.values(c).map(e=>e.variantId),n=Object.values(c).map(e=>{const t=i.products.find(t=>t.productId===e.productId);if(!t)return null;const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e.variantId)?.node;return n?{variantId:e.variantId,price:Number(n.price)}:null}).filter(Boolean);await a(t.length,t,Number(I),n,e)}catch(e){console.log("Add to cart error:",e)}finally{T(!1)}};n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:i._id,bundleType:"mixandmatch-bundle"}});const e=()=>{$(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const M=i.customizations,V=S,j="bundles"===i.appName?i.pageHeader?.title:i?.title,W="bundles"===i.appName?i.pageHeader?.description:i?.subtitle;return e.createElement(e.Fragment,null,e.createElement(od,{verticalMargin:M.comboBundle.verticalMargin,borderRadius:"20px"},M.comboBundle.embedContentVisibility&&e.createElement(rd,null,M.comboBundle?.embedContentVisibility&&M.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",marginBottom:"10px",width:"100%",textAlign:M.comboBundle.infoAlignment||"left"}},e.createElement("h2",{style:{fontSize:"28px",color:M.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},j)),M.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&Number(I)>1&&e.createElement(e.Fragment,null,e.createElement(id,{infoAlignment:M.comboBundle.infoAlignment},e.createElement(ad,null,nu(M.general.currencySymbol,i.storeCurrencyCode),tu(I)),Number(I)<Number(z)&&e.createElement(ld,{style:{minWidth:"fit-content"}},nu(M.general.currencySymbol,i.storeCurrencyCode)," ",tu(z)),e.createElement(cd,{style:{minWidth:"fit-content"}},"In Stock")),e.createElement(sd,{style:{textAlign:M.comboBundle.infoAlignment||"left",fontSize:M.comboBundle.productDescriptionFontSize}},"Tax included. Shipping calculated at checkout."))),e.createElement(dd,{gridSize:N.length,isHorizontal:V},N.map((t,o)=>{const i=(e=>!!c[e]&&!!c[e].productId)(o),{product:a,variantId:l}=(e=>{const t=c?.[e];return t?{product:P(t.productId),variantId:t.variantId}:{product:void 0,variantId:""}})(o),s=a?((e,t)=>{if(!e||!e.variants.edges)return null;const n=e.variants.edges.find(e=>e.node.id===t);return n?.node})(a,l):null,d=t.isFixed,p=r(null);return n(()=>{const e=p.current;if(!e)return;const t=e.querySelector("span");if(!t)return;const n=e.clientWidth,o=t.scrollWidth;if(o<=n)return e.setAttribute("data-overflow","false"),e.style.removeProperty("--scroll-end"),void e.style.removeProperty("--duration");const r=-(o-n);e.style.setProperty("--scroll-end",`${r}px`);const i=2*Math.max(1,Math.abs(r)/40)+3;e.style.setProperty("--duration",`${i}s`),e.setAttribute("data-overflow","true")},[s?.displayName,s?.title]),i&&a?e.createElement(pd,{key:`tier-${o}`,onClick:()=>!d&&O(o),style:{borderRadius:"20px",cursor:d?"default":"pointer"},isHorizontal:V,infoAlignment:M.comboBundle.infoAlignment},!d&&e.createElement(yd,{onClick:e=>{e.stopPropagation(),R(o)}},"×"),e.createElement(md,{src:a?.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=200&width=200",alt:a?.title,style:{aspectRatio:M?.general.imageAspectRatio||"1/1"},isHorizontal:V}),e.createElement(gd,{style:{color:"#1e1e1e",textAlign:"center",...V&&"right"===M.comboBundle.infoAlignment&&{padding:"0 8px",textAlign:"right",alignItems:"flex-end"},...V&&"left"===M.comboBundle.infoAlignment&&{padding:"0 5px",textAlign:"left",alignItems:"flex-start"},...!V&&"left"===M.comboBundle.infoAlignment&&{padding:"0 10px"},...V&&"center"===M.comboBundle.infoAlignment&&{textAlign:"left",alignItems:"flex-start",padding:"0 5px"}},isHorizontal:V},e.createElement(fd,{style:{fontSize:"15px",width:"100%",display:"flex",alignItems:"center",fontWeight:"600",textAlign:"center",lineHeight:"normal"},ref:p},e.createElement("span",null,a?.title," - ",s?.title)))):e.createElement(ud,{key:`tier-${o}`,onClick:()=>!d&&O(o),isHorizontal:V,infoAlignment:M.comboBundle.infoAlignment,style:{cursor:d?"default":"pointer"}},d?e.createElement("div",{style:{textAlign:"center",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},e.createElement("div",{style:{fontSize:"12px",color:"#666",marginBottom:"8px"}},"Fixed Product"),e.createElement("div",{style:{fontSize:"14px",fontWeight:"600"}},t.title||`Product ${o+1}`)):e.createElement(e.Fragment,null,e.createElement("div",{style:{width:"100%",height:"80%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderTopLeftRadius:"18px",borderTopRightRadius:"18px",flexShrink:0,backgroundColor:"#f8f9fa"}},e.createElement(bd,null,"+")),e.createElement(xd,{style:{fontSize:"15px",fontWeight:"600",color:M.comboBundle.titleTextColor||"#1e1e1e",lineHeight:"normal",height:"20%",display:"flex",alignItems:"center",justifyContent:"center"},isHorizontal:V,infoAlignment:M.comboBundle.infoAlignment},e.createElement("p",{style:{width:"80%",margin:"0",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},t.title?`${t.title}`:`Select Product ${o+1}`))))})),e.createElement(hd,{hoverProperties:{customizeHoverState:M.general.customizeHoverState,backgroundColor:M.general.ctaHoverBackgroundColor,textColor:M.general.ctaHoverTextColor},borderRadius:M.general.ctaBorderRadius,primaryBgColor:M.general.ctaBackgroundColor,onClick:async()=>{0===g&&i?.personalizedForm?.title?m(!0):await L()},textColor:M.general.ctaTextColor,borderColor:M.general.ctaBorderColor},0===g?k?e.createElement(ge,{color:"white",loading:k,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,M.comboBundle.ctaTitle||"Add Bundle to cart"):`Add ${g} more item(s)`),M.comboBundle?.embedContentVisibility&&M.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&e.createElement("div",{style:{margin:"20px 0px"}},e.createElement("h4",{style:{fontSize:"16px",color:M.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:M.general.primaryColor+"20",textAlign:M.comboBundle.infoAlignment||"left"}},"Description"),e.createElement("div",{style:{fontSize:M.comboBundle.productDescriptionFontSize||"16px",color:M.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:M.general.primaryColor+"08",textAlign:M.comboBundle.infoAlignment||"left"},dangerouslySetInnerHTML:{__html:W}}))),d&&A(e.createElement(vd,{onClick:()=>p(!1)},e.createElement(wd,{onClick:e=>e.stopPropagation()},e.createElement(Cd,{style:{position:"sticky",top:0,background:"#fff",zIndex:10}},e.createElement("div",{style:{display:"flex",width:"100%",gap:"2px",alignItems:"center",marginBottom:"8px"}},e.createElement(Ed,{placeholder:"Search",value:b,onChange:e=>{h(e.target.value)}}),e.createElement(kd,{onClick:()=>p(!1)},"Cancel")),e.createElement("div",{style:{height:"1px",width:"100%",backgroundColor:"#EBEBEB"}})),e.createElement("div",{style:{marginBottom:S?"20px":"5px",flex:1,minHeight:0,overflow:"scroll"}},e.createElement(Td,{style:{height:"auto",flex:"unset"}},v?.length>0?v?.map(t=>{const n=t?.productDetails;if(!n)return null;const o=(e=>{if(null==f)return!1;const t=c?.[f];return!!t&&t.productId===e})(t.productId),r=D(t.productId);let a=r||"";return a=o&&null!==f?c?.[f]?.variantId||a:C[t.productId]||r,e.createElement(Sd,{className:"mixAndMatch-product-item",primaryBgColor:M.general.primaryColor||"#1e1e1e",key:n.id,isSelected:o,onClick:()=>{_(t.productId,a)}},e.createElement($d,{className:"mixAndMatch-vendor-image",src:n.featuredMedia?.preview?.image?.url||"/placeholder.svg?height=50&width=50",alt:n.title}),e.createElement(Nd,{className:"mixAndMatch-vendor-info"},e.createElement(Bd,{className:"mixAndMatch-vendor-name"},n.title),e.createElement(Pd,{className:"mixAndMatch-variant-options"},n.variants?.edges?.filter(({node:e})=>"Default Title"!==e.title)?.map(({node:r})=>{const i=0===B(n,r.id);return e.createElement(Dd,{className:"mixAndMatch-variant-button "+(a===r.id?"mixAndMatch-variant-button--selected":""),primaryBgColor:M.general?.primaryColor,disabled:!!o||i,key:r.id,isSelected:a===r.id,tierHasProductId:!!o,onClick:e=>{var n,o;e.stopPropagation(),i||(n=t.productId,o=r.id,E(e=>({...e,[n]:o})))},style:{opacity:i?.5:1,cursor:i?"not-allowed":"pointer"}},r.title)}))),e.createElement(zd,{cornerRadiusType:i?.cornerRadiusType??"",primaryBgColor:M.general?.primaryColor||"#1e1e1e",onClick:()=>o?R(f||0):_(t.productId,a)},o?e.createElement(Id,null,"Added"):" + Add"))}):e.createElement(Fd,null,'No products found matching "',b,'"'))))),document.body),i?.personalizedForm?.title&&e.createElement(Es,{isOpen:u,onClose:()=>m(!1),formConfig:i.personalizedForm,onCheckout:async e=>{await L(e),m(!1)},cta:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",textColor:M.general?.ctaTextColor||"#FFFFFF"},isMobile:S}))},_d=c.div`
4023
4023
  border-radius: 8px;
4024
4024
  container-type: inline-size;
4025
4025
  `,Rd=c.div`
@@ -4673,9 +4673,9 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4673
4673
  }
4674
4674
  `,Mp=c.span`
4675
4675
  font-size: 12px;
4676
- `,Vp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},s(o,r.id))}),x(e),y(t)},[r,p,u,s,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),s(n,o.id)}},[u,p,r,s,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(s(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(Sp,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement($p,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Np,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(zp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(Ip,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Fp,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(Pp,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(Ap,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name),a=o.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[r]===e));return 0===a.length||1===a.length&&"Default Title"===a[0]?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(_p,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(Mp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(Rp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(Op,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(_p,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(Mp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(Lp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(Op,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(_p,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(Mp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(Op,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(Dp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(Bp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return D.createPortal(v,document.body)},jp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,s]=t(!1),d=r(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(wp,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Cp,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(gp,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(xp,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(fp,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(yp,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(bp,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(hp,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{t.disabled||(a(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(vp,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Wp=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:s="dropdown"})=>{const[d,p]=t(i||[]);n(()=>{i&&i.length>0&&p(i)},[i]),n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{const n=d[t];if(!n)return null;return g(e,t).find(e=>e.name===n)||null},g=(e,t)=>{const n=r?.options?.find(t=>t.name===e.name);return e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const r=n?.values?.find(t=>t.name===e),i=!((e,t,n)=>{const o=[...d||[]];o[e]=t;const r=o.join(" / "),i=n.variants.edges.find(e=>e.node.title===r)?.node;return!!i&&((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0})(n,i.id)>0})(t,e,o);return{name:e,value:r?.value||e,disabled:i}})};return e.createElement(Ep,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>{const r=g(t,n);return 0===r.length||1===r.length&&"Default Title"===r[0].name?null:e.createElement(kp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(jp,{options:r,selectedValue:m(t,n),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))}))},Hp=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[r]),[$,N]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),B=o(()=>$?.title?.split(" / ")||[],[$]),z=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(N(e),d(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;N(e)}},[r,h,a,v,d,S]);const I=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[r,d]),F=s?.fixedBundle?.discountBadgeDisplay,P=parseFloat($?.price??"0"),D=w?.size===k,A=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(P,E,C??0,w?.size,k,T),_=D?A:parseFloat($?.price??"0"),R="discount-on-compare"===F?parseFloat($?.compareAtPrice||$?.price||"0"):parseFloat($?.price??"0"),O=!1!==s?.fixedBundle?.discountBadgeVisibility&&(R>_&&s?.fixedBundle?.compareAtPriceVisibility||"discount-on-compare"===F&&s?.fixedBundle?.compareAtPriceVisibility),L=_.toFixed(2),M="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,V=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(Md,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(Vd,{className:"yt-fixedBundle-product-card-horizontal_image",src:nu(V),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(jd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(Wd,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(Hd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(qd,{className:"yt-fixedBundle-product-card-horizontal_price--new"},tu(s.general.currencySymbol,b)," ",eu(L)),O&&R>_&&e.createElement(Qd,{className:"yt-fixedBundle-product-card-horizontal_price--old"},tu(s.general.currencySymbol,b),eu(R))),e.createElement(Wp,{product:r,variantOptions:x,selectedVariants:B,onVariantChange:I,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(tp,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...M&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(Tp,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:M},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(np,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(op,{className:"yt-fixedBundle-product-card_image--vertical",src:nu(V),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(rp,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(ip,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(ap,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(lp,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(cp,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(sp,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(pp,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(dp,{className:"yt-fixedBundle-product-card-vertical_price--new"},tu(s.general.currencySymbol,b),eu(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(Qd,{className:"yt-fixedBundle-product-card-vertical_price--old"},tu(s.general.currencySymbol,b),eu(R))))),(f<=3||!u)&&g<f-1&&e.createElement(up,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(mp,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},qp=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),[f,y]=t(!1),b="undefined"!=typeof window?window.location.href:null,h=r?.products?.find(e=>e.productDetails?.handle===b?.split("/").pop()?.split("?")[0]),v=h?.productId,w=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),[C,E]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>w(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),T=r?.showIndividualProductSelector??!0,[S,$]=t(new Set(r.products.reduce((e,t,n)=>(k&&t?.productId!==v&&!T||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&v&&E(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===v&&(t[n.toString()]=u)}),t})},[u,v,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const N=i((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),B=(e,t)=>{const n=r.products[t].productId;k&&n===v||$(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},z=o(()=>(e,t)=>w(e.productDetails,t)>0,[w]),I=o(()=>r.products.some((e,t)=>S.has(t)&&e.productDetails.variants.edges.length>1),[r.products,S]),{originalPrice:F,dealPrice:P,offerValue:D}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!S.has(n))return e;const o=C[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n="discount-on-compare"===(r?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?t:e;let o=e;S.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=n-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,C,S,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),A=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>S.has(e)),[r.products,S]),_=A.every(({product:e,index:t})=>z(e,C[t.toString()])),R=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(S.has(n)){const o=C[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,S,C]),O=async e=>{s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:A?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!S.has(n)?null:t}).filter(Boolean);a&&await a(Number(F),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},L=async e=>{if(_){if(e&&(e.preventDefault(),e.stopPropagation()),r?.personalizedForm?.title)return x(!1),void y(!0);await O()}};if(!a)return e.createElement(e.Fragment,null);const M=r.customizations,V=M.fixedBundle?.cardLayoutStyle||"auto",j="horizontal"===V||"auto"===V&&d,W="bundles"==r.appName?r.pageHeader?.title:r?.title,H="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(_d,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:M.fixedBundle.sectionBackgroundColor,..."transparent"!==M.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},W&&e.createElement(Rd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:M.fixedBundle?.titleBackgroundColor||"none",color:M.fixedBundle?.titleTextColor||"black",textAlign:M.fixedBundle.infoAlignment??"center",fontSize:M.fixedBundle?.titleFontSize,..."transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},W),H&&e.createElement(Od,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:M.fixedBundle?.subtitleFontSize,textAlign:M.fixedBundle.infoAlignment??"center",..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},H),j?e.createElement(Ld,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(Hp,{isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>N(n,e),onCheckChange:e=>{B(e,n)},isMobile:d,index:n,isHorizontal:j,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})))):e.createElement(Jd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(ep,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(Hp,{key:`${t.productId}-${n}`,isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>{N(n,e)},onCheckChange:e=>B(e,n),isMobile:d,index:n,isHorizontal:j,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})),I&&e.createElement(Vp,{productsWithIndices:A,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:M.general.ctaTextColor,backgroundColor:M.general.ctaBackgroundColor},onVariantChange:N,handleAddToCart:L,primaryProductId:v,variantId:u||void 0}))),e.createElement(Ud,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},Number(F)>0&&Number(D)>0&&M.fixedBundle.compareAtPriceVisibility&&e.createElement(Yd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Xd,{className:"yt-fixedBundle-summary_price"},tu(M.general.currencySymbol,r?.storeCurrencyCode),eu(F))),0!==S.size&&e.createElement(Gd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Xd,{className:"yt-fixedBundle-summary_price"},tu(M.general.currencySymbol,r?.storeCurrencyCode),eu(P))," ",Number(D)>0&&e.createElement(Zd,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",tu(M.general.currencySymbol,r?.storeCurrencyCode),eu(D)))),e.createElement(Kd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),j||!I?L(e):x(!0)},disabled:S.size<1||c||!_,style:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",color:M.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${M.general?.ctaBackgroundColor||"#121212"}`,boxShadow:M.general.ctaShadowType,paddingTop:M.general?.ctaPadding,paddingBottom:M.general?.ctaPadding,borderRadius:M.general.ctaBorderRadius,width:M.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=M.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=M.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ge,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?e.createElement(e.Fragment,null,M.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),r?.personalizedForm?.title&&e.createElement(Es,{isOpen:f,onClose:()=>y(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await O(e),y(!1)},cta:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",textColor:M.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},Qp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:u=!1})=>{const[m,g]=t(0),[x,f]=t(o.variants[0]?.id.toString()||""),[y,b]=t(!0),h=o.variants.find(e=>e.id.toString()===x)||o.variants[0],v=o.images.filter(Boolean),w=()=>{v.length<=1||(g(e=>0===e?v.length-1:e-1),b(!0))},C=()=>{v.length<=1||(g(e=>e===v.length-1?0:e+1),b(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=nu(h?.featured_image?.src);e?.setAttribute("src",t)}},[h]),!i)return null;const E=v.length>1,k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},v.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:nu(v[m]||o.images[0]),alt:o.title,onLoad:()=>b(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===m?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===m?.5:1}},e.createElement(Z,{size:24})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:m===v.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1}},e.createElement(L,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},u&&h?.name||o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price&&h.compare_at_price>h.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),T=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},v.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:v[m]||o.images[0],alt:o.title,onLoad:()=>b(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===m?.5:1,cursor:0===m?"not-allowed":"pointer"}},e.createElement(Z,{size:20})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1,cursor:m===v.length-1?"not-allowed":"pointer"}},e.createElement(L,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price?h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toLocaleString()):null),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return D.createPortal(p?T:k,document.body)},Up=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-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",...o].map(o=>{const i=r===o,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(c,.07):"transparent",borderBottom:i?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=c)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>{const i=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?i:"#e0e0e0"}`,borderRadius:l,backgroundColor:r===o?i:"white",color:r===o?"white":"#333",cursor:"pointer"}},o.charAt(0).toUpperCase()+o.slice(1))})))},Yp=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},Gp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[u,m]=t([]),[g,x]=t(null),[f,y]=t({}),[b,h]=t(!1),[v,w]=t(window.innerWidth<640),[C,E]=t({}),k=r(null),T=r(new Map),[S,$]=t(160),[N,B]=t(""),[z,I]=t(""),[F,P]=t(!1),[D,A]=t("none"),_=v?8:20,{customizations:R}=o,O=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),L=!!o.config.form,M=O.length+(L?1:0),j=R.hideSelectedProducts,W=R.allowMultipleQty,H=R.hideOutOfStockProducts,q=o.config.splitVariants??!1,Q=r(new Set),U=i((e,t=d,n=z,o=D)=>{const r=O[e-1]?.products||[];let i="All"===t?r:r.filter(e=>Yp(e).includes(t));if(n.trim()){const e=n.toLowerCase();i=i.filter(t=>t.title.toLowerCase().includes(e))}return H&&(i=i.filter(e=>e.available)),"none"!==o&&(i=[...i].sort((e,t)=>{if("asc"===o||"desc"===o){const n=e.price||e.price_min||0,r=t.price||t.price_min||0;return"asc"===o?n-r:r-n}{const n=(e.title||"").toLowerCase(),r=(t.title||"").toLowerCase();return"alpha-asc"===o?n.localeCompare(r):r.localeCompare(n)}})),i},[O,d,z,D,H]),Y=i(e=>{const t=U(e).length;E(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,U]);n(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&Y(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[Y,c]),n(()=>{p("All"),B(""),I(""),P(!1),A("none")},[c]),n(()=>{const e=setTimeout(()=>{I(N)},300);return()=>clearTimeout(e)},[N]),n(()=>{if(L&&c===M)return;const e=c-1;if(!O[e])return;if(Q.current.has(e))return;const t=U(c);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],o=n.variants.filter(e=>e.available);if(1!==o.length)return;const r=o[0],i=ie(e),a=le[e];if(i!==1/0&&a>=i)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===r.id.toString()&&t.tierIndex===e)&&(Q.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<M)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(L&&c===M)return;const e=c,t=U(e).length;E(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(_,t),[`${e}_category`]:d}:n})},[c,_,d,U]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>w(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const X=i(e=>{$(e+10)},[]),Z=u.reduce((e,t)=>e+t.quantity,0),ee=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,te=u.reduce((e,t)=>{const n=O.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.compare_at_price??t.price)*t.quantity},0)/100,ne=e=>{for(let t=0;t<O.length;t++)if(O[t].products.some(t=>t.id.toString()===e))return t+1;return L?M:O.length},oe=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},re=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());m(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=le[t],c=ie(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},ie=e=>{const t=O[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},ae=(e,t)=>{const n=ie(t);if(n===1/0)return!0;const o=le[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},le=O.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),ce=(e,t,n)=>{const o=ie(n);if(o===1/0)return!0;return le[n]<o},se=(e,t,n)=>{m(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},de=async()=>{if(c!==M||!u.length)return;const e={};L&&Object.entries(f).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},pe=L&&c===M,ue=(pe?null:O[c-1])?ie(c-1):0,me=O.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:le[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},R.headerImage&&!R.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:R.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),R.showTierSteps&&e.createElement("div",{style:{paddingTop:R.headerImage&&!R.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Xp,{totalSteps:M,isFormStep:pe,currentStep:c,getStepTitle:e=>L&&e===M?"Customize Gift Details":O[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:o?.config?.form?.title,hasForm:L,onStepClick:e=>{s(e),window.scrollTo(0,0)}})),Array.from({length:M},(e,t)=>t+1).map(t=>{const n=L&&t===M,r=n?[]:(e=>O[e-1]?.products||[])(t);let i=[];if(!n&&R.enableProductCategories){const e=new Set;r.forEach(t=>Yp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const l=n?[]:U(t),w=t-1,E=l.slice(0,C[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement(fs,{form:o.config.form,formData:f,setFormData:y,barHeight:S,isUploading:b,setIsUploading:h}):e.createElement(e.Fragment,null,R.enableProductCategories&&i.length>0&&e.createElement(Up,{styles:R,isMobile:v,categories:i,activeCategory:d,onCategoryChange:p}),(R.enableSearch||R.enableSort)&&e.createElement("div",{className:"yt-collection-bundle-controls",style:{display:"flex",alignItems:"center",justifyContent:v?"flex-end":"space-between",gap:"12px",padding:"0 16px",marginBottom:"16px",flexWrap:"nowrap",height:"45px"}},v?e.createElement(e.Fragment,null,F?e.createElement("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",gap:"8px"}},e.createElement("input",{type:"text",autoFocus:!0,placeholder:"Search...",value:N,onChange:e=>B(e.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:R.borderRadius||"8px",border:`1px solid ${R.bundleBorder||"#878787"}`,background:R.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none"}}),e.createElement("button",{onClick:()=>{P(!1),B(""),I("")},style:{background:"none",border:"none",color:"#888",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center"}},e.createElement(G,null))):e.createElement("div",{style:{display:"flex",gap:"20px",alignItems:"center"}},R.enableSearch&&e.createElement("button",{onClick:()=>P(!0),style:{background:"none",border:"none",color:"#333",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center"},className:"yt-collection-bundle-search-btn-mobile"},e.createElement(K,null)),R.enableSort&&e.createElement("div",{style:{position:"relative",display:"flex",alignItems:"center"},className:"yt-collection-bundle-sort-selecter-mobile-wrapper"},e.createElement("select",{value:D,onChange:e=>A(e.target.value),style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer",left:0,top:0,zIndex:1},className:"yt-collection-bundle-sort-selecter-mobile"},e.createElement("option",{value:"none"},"Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{fontSize:"20px",color:"#333",pointerEvents:"none",display:"flex",alignItems:"center"}},e.createElement(J,null))))):e.createElement(e.Fragment,null,R.enableSort&&e.createElement("div",{style:{position:"relative",flex:"0 1 200px",marginLeft:"12px",padding:"10px 16px",borderRadius:R.borderRadius||"8px",border:"1px solid #878787",background:R.productCardBg||"#fff",display:"flex",flexDirection:"row",alignItems:"center",gap:"6px"},className:"yt-collection-bundle-sort-wrapper"},e.createElement("span",{style:{fontWeight:"500",minWidth:"fit-content",fontSize:"14px"}},"Sort By"),e.createElement("select",{value:D,onChange:e=>A(e.target.value),style:{width:"100%",color:"#333",fontSize:"14px",outline:"none",cursor:"pointer",appearance:"none",boxSizing:"border-box",lineHeight:"normal",border:"none",fontFamily:"inherit"},className:"yt-collection-bundle-sort-selector"},e.createElement("option",{value:"none"}," Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888",pointerEvents:"none"}},e.createElement(V,null))),R.enableSearch&&e.createElement("div",{style:{position:"relative",flex:"0 1 300px"},className:"yt-collection-bundle-search-wrapper"},e.createElement("input",{type:"text",placeholder:"Search products...",value:N,onChange:e=>B(e.target.value),style:{width:"100%",padding:"10px 16px",paddingRight:"40px",borderRadius:R.borderRadius||"8px",border:"1px solid #878787",background:R.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none",boxSizing:"border-box",lineHeight:"normal"},className:"yt-collection-bundle-search-input"}),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888"}},e.createElement(K,null))))),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},0===l.length&&""!==z.trim()?e.createElement("div",{style:{padding:"60px 20px",textAlign:"center",width:"100%",gridColumn:"1 / -1"}},e.createElement("div",{style:{fontSize:"18px",color:"#333",marginBottom:"8px",fontWeight:600}},'No results found for "',N,'"'),e.createElement("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"}},"Try checking your spelling or using more general terms."),e.createElement("button",{onClick:()=>{B(""),I(""),P(!1)},style:{background:R.atcBg||"#000",color:R.atcText||"#fff",padding:"12px 32px",borderRadius:R.borderRadius||"8px",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:600,transition:"opacity 0.2s"},onMouseEnter:e=>e.currentTarget.style.opacity="0.8",onMouseLeave:e=>e.currentTarget.style.opacity="1"},"Clear Search")):q?E.flatMap(t=>t.variants.filter(e=>!H||e.available).map(n=>e.createElement(Zp,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:w,customizations:R,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:re,canAddProduct:ae,allowMultipleQty:W,handleVariantChange:oe,canIncrement:ce,setSelectedProducts:m,splitVariants:!0}))):E.map(t=>e.createElement(Zp,{key:t.id,product:t,tierIdx:w,customizations:R,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:re,canAddProduct:ae,allowMultipleQty:W,handleVariantChange:oe,canIncrement:ce,setSelectedProducts:m,splitVariants:!1})),c===t&&(C[t]||0)<l.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))),c===t&&e.createElement(Kp,{config:o,selectedProducts:u,selectedByTier:me,totalItems:Z,totalPrice:ee,totalCompareAtPrice:te,currentStep:c,totalSteps:M,currentTierMax:ue,tierSelectedCounts:le,isMobile:v,bundleAddToCartLoading:a,isUploading:b,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:j,getProductStep:ne,setCurrentStep:s,handleRemoveItem:se,handleCheckout:de,hasForm:L,onHeightChange:X}))}))},Xp=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!a||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},Zp=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g,splitVariants:x=!1})=>{const[f,y]=t(!1),b=x?null:document.querySelector(`[data-product-id="${n.id}"]`),h=x?n.variants[0].id.toString():b?.dataset.selectedVariant??n.variants[0].id.toString(),v=n.variants.find(e=>e.id.toString()===h)||n.variants[0],w=x?`${n.id}-${v.id}`:n.id,C=c.some(e=>e.productId===n.id.toString()&&e.variantId===h&&e.tierIndex===o),E=a===w,k=c.filter(e=>e.productId===n.id.toString()&&e.variantId===v.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:w,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":v.id,"data-current-price":v.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:i?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(w),onMouseLeave:()=>l(null)},e.createElement("img",{src:nu(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?0:1,transform:E?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:nu(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?1:0,transform:"scale(1.05)"},alt:n.title}),!x&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:v.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},r.productCardCategoryVisibility&&Yp(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},Yp(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:i?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),Yp(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",Yp(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:x?0:1}},n.title),x&&"Default Title"!==v.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:i?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},v.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(v.price/100).toLocaleString()),v.compare_at_price&&0!==v.compare_at_price&&v.compare_at_price>v.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(v.compare_at_price/100).toLocaleString()):null)),p&&k>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},k),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{v.available&&m(n,v.id.toString(),o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]})},disabled:!v.available||!m(n,v.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(C?"yt-collection-bundle-add-btn-added":""),style:{background:C?"#28a745":d(n,o)&&v.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:v.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(x)v.available&&d(n,o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.filter(e=>e!==r):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]});else{if(!v.available||!d(n,o))return;s(n,o)}},disabled:!v.available||!d(n,o)},C?"Added":v.available?"ADD TO BOX":"Out of Stock")),f&&e.createElement(Qp,{product:n,tierIdx:o,isOpen:f,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,o),isSelected:C,customizations:r,isMobile:i,splitVariants:x}))},Kp=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,N]=t(!1),B=r(null),z=r(null),{totalOriginal:I,hasSavings:F,formattedSavings:P,totalAfterDiscount:D}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(N(!0),t=setTimeout(()=>{N(!1)},3e3)):N(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(B.current&&T){const e=B.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(z.current??0)&&(z.current=e),e>(z.current??0)){z.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;ke({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:B,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"sticky",bottom:"10px",left:"0",right:"0",marginInline:"auto",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:nu(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(U,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(D??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(gs,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(D??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(gs,null)):p===u?"Checkout":"Next")))},Jp=window?.Shopify?.currency||{rate:1,active:"INR"},eu=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Jp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},tu=(e,t)=>t==Jp.active?e:pe(Jp.active)||Jp.active,nu=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},ou=(e,t,n,o,r,i,a)=>{const l=o.findIndex(t=>t.variantId===e&&(void 0===a||t.tierIndex===a));r(0===n?e=>e.filter((e,t)=>t!==l):-1===l?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i,tierIndex:a}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:i,tierIndex:a}:e))},ru=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Cs,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g}):"combo"===t.type?e.createElement(Ts,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(Ad,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(Gp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(nd,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(qp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),iu=c.div`
4676
+ `,Vp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},s(o,r.id))}),x(e),y(t)},[r,p,u,s,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),s(n,o.id)}},[u,p,r,s,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(s(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(Sp,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement($p,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Np,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(zp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(Ip,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Fp,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(Pp,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(Ap,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name),a=o.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[r]===e));return 0===a.length||1===a.length&&"Default Title"===a[0]?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(_p,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(Mp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(Rp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(Op,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(_p,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(Mp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(Lp,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(Op,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(_p,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(Mp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(Op,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},"text"===i?.type&&i.values.find(e=>e.name===o)?.value||o)}))}))),o<r.length-1&&e.createElement(Dp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(Bp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return D.createPortal(v,document.body)},jp=(e,t=64)=>{if(!e)return"/placeholder.svg";try{const n=new URL(e);return n.searchParams.set("width",String(t)),n.toString()}catch{return e}},Wp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,s]=t(!1),d=r(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(wp,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Cp,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(gp,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(xp,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(fp,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(yp,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(bp,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(hp,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{t.disabled||(a(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(vp,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Hp=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:s="dropdown",accentColor:d="#000000"})=>{const p=(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[u,m]=t(i||[]);n(()=>{i&&i.length>0&&m(i)},[i]),n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");m(t)}}},[l,o]);const g=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},x=(e,t)=>{const n=u[t];if(!n)return null;return f(e,t).find(e=>e.name===n)||null},f=(e,t)=>{const n=r?.options?.find(t=>t.name===e.name);return e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const r=n?.values?.find(t=>t.name===e),i=!((e,t,n)=>{const o=[...u||[]];o[e]=t;const r=o.join(" / "),i=n.variants.edges.find(e=>e.node.title===r)?.node;return!!i&&p(n,i.id)>0})(t,e,o);return{name:e,value:r?.value||e,disabled:i}})},y=(e,t)=>e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e));return"swatches"===s||"auto"===s?e.createElement(e.Fragment,null,o.options.map((t,n)=>{const i=r?.options?.find(e=>e.name===t.name);return e.createElement("div",{key:t.name,className:"yt-fixedBundle-product-option-group-horizontal",style:{...t?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},o.options.length>1&&y(t,n)?.length>1&&e.createElement("label",{className:"yt-fixedBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},t.name,":"),y(t,n)?.length>1&&e.createElement("div",{className:"yt-fixedBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},y(t,n).map(t=>{const r=[...u];r[n]=t;const l=o.options.length>0?r.join(" / "):r[n],c=o.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(o,c.id):0),m=u[n]===t;if("color"===i?.type){const n=i.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-color${m?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&a(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:m&&!s?`1px solid ${d}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},n?e.createElement("div",{className:"yt-fixedBundle-product-option-color-swatch",style:{width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:n}},e.createElement("span",null)):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:m&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}if("image"===i?.type){const n=i.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-image${m?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&a(c.id)},disabled:s,style:{border:m&&!s?`1px solid ${d}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:m&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},n?e.createElement("img",{className:"yt-fixedBundle-product-option-image",src:jp(n),alt:t,style:{width:m&&!s?"26px":"24px",height:m&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:m&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-text${m?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&a(c.id)},disabled:s,style:{padding:"4px 8px",border:m&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:m&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},"text"===i?.type&&i.values.find(e=>e.name===t)?.value||t)})))})):e.createElement(Ep,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>{const r=f(t,n);return 0===r.length||1===r.length&&"Default Title"===r[0].name?null:e.createElement(kp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(Wp,{options:r,selectedValue:x(t,n),onChange:e=>{((e,t)=>{const n=[...u];n[e]=t.name,m(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:g(t.name)}))}))},qp=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[r]),[$,N]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),B=o(()=>$?.title?.split(" / ")||[],[$]),z=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(N(e),d(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;N(e)}},[r,h,a,v,d,S]);const I=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[r,d]),F=s?.fixedBundle?.discountBadgeDisplay,P=parseFloat($?.price??"0"),D=w?.size===k,A=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(P,E,C??0,w?.size,k,T),_=D?A:parseFloat($?.price??"0"),R="discount-on-compare"===F?parseFloat($?.compareAtPrice||$?.price||"0"):parseFloat($?.price??"0"),O=!1!==s?.fixedBundle?.discountBadgeVisibility&&(R>_&&s?.fixedBundle?.compareAtPriceVisibility||"discount-on-compare"===F&&s?.fixedBundle?.compareAtPriceVisibility),L=_.toFixed(2),M="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,V=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(Md,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(Vd,{className:"yt-fixedBundle-product-card-horizontal_image",src:ou(V),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(jd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(Wd,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(Hd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(qd,{className:"yt-fixedBundle-product-card-horizontal_price--new"},nu(s.general.currencySymbol,b)," ",tu(L)),O&&R>_&&e.createElement(Qd,{className:"yt-fixedBundle-product-card-horizontal_price--old"},nu(s.general.currencySymbol,b),tu(R))),e.createElement(Hp,{product:r,variantOptions:x,selectedVariants:B,onVariantChange:I,variantId:v,primaryProductId:h,variantType:s?.fixedBundle?.variantSelectorType,accentColor:s?.general?.ctaBackgroundColor})))):e.createElement(e.Fragment,null,e.createElement(tp,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...M&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(Tp,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:M},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:z}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(np,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(op,{className:"yt-fixedBundle-product-card_image--vertical",src:ou(V),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(rp,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(ip,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(ap,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(lp,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(cp,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(sp,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(pp,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(dp,{className:"yt-fixedBundle-product-card-vertical_price--new"},nu(s.general.currencySymbol,b),tu(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(Qd,{className:"yt-fixedBundle-product-card-vertical_price--old"},nu(s.general.currencySymbol,b),tu(R))))),(f<=3||!u)&&g<f-1&&e.createElement(up,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(mp,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Qp=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),[f,y]=t(!1),b="undefined"!=typeof window?window.location.href:null,h=r?.products?.find(e=>e.productDetails?.handle===b?.split("/").pop()?.split("?")[0]),v=h?.productId,w=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),[C,E]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>w(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),T=r?.showIndividualProductSelector??!0,[S,$]=t(new Set(r.products.reduce((e,t,n)=>(k&&t?.productId!==v&&!T||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&v&&E(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===v&&(t[n.toString()]=u)}),t})},[u,v,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const N=i((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),B=(e,t)=>{const n=r.products[t].productId;k&&n===v||$(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},z=o(()=>(e,t)=>w(e.productDetails,t)>0,[w]),I=o(()=>r.products.some((e,t)=>S.has(t)&&e.productDetails.variants.edges.length>1),[r.products,S]),{originalPrice:F,dealPrice:P,offerValue:D}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!S.has(n))return e;const o=C[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n="discount-on-compare"===(r?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?t:e;let o=e;S.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=n-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,C,S,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),A=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>S.has(e)),[r.products,S]),_=A.every(({product:e,index:t})=>z(e,C[t.toString()])),R=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(S.has(n)){const o=C[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,S,C]),O=async e=>{s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:A?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!S.has(n)?null:t}).filter(Boolean);a&&await a(Number(F),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},L=async e=>{if(_){if(e&&(e.preventDefault(),e.stopPropagation()),r?.personalizedForm?.title)return x(!1),void y(!0);await O()}};if(!a)return e.createElement(e.Fragment,null);const M=r.customizations,V=M.fixedBundle?.cardLayoutStyle||"auto",j="horizontal"===V||"auto"===V&&d,W="bundles"==r.appName?r.pageHeader?.title:r?.title,H="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(_d,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:M.fixedBundle.sectionBackgroundColor,..."transparent"!==M.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},W&&e.createElement(Rd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:M.fixedBundle?.titleBackgroundColor||"none",color:M.fixedBundle?.titleTextColor||"black",textAlign:M.fixedBundle.infoAlignment??"center",fontSize:M.fixedBundle?.titleFontSize,..."transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},W),H&&e.createElement(Od,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:M.fixedBundle?.subtitleFontSize,textAlign:M.fixedBundle.infoAlignment??"center",..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},H),j?e.createElement(Ld,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n,o)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(qp,{isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>N(n,e),onCheckChange:e=>{B(e,n)},isMobile:d,index:n,isHorizontal:j,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R}),n<o.length-1&&e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"},className:"yt-fixedBundle-plus-icon-container"},e.createElement("span",{style:{padding:d?"1px":"2px",background:"#0000000D",..."none"!==M?.fixedBundle?.shadowType&&{marginTop:"2px"},display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},className:"yt-fixedBundle-plus-icon-wrapper"},e.createElement(_e,{color:"black",style:{height:d?"16px":"24px",width:d?"16px":"24px",color:"black",lineHeight:"nomal"},className:"yt-fixedBundle-plus-icon-svg"})))))):e.createElement(Jd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(ep,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(qp,{key:`${t.productId}-${n}`,isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>{N(n,e)},onCheckChange:e=>B(e,n),isMobile:d,index:n,isHorizontal:j,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})),I&&e.createElement(Vp,{productsWithIndices:A,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:M.general.ctaTextColor,backgroundColor:M.general.ctaBackgroundColor},onVariantChange:N,handleAddToCart:L,primaryProductId:v,variantId:u||void 0}))),e.createElement(Ud,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},Number(F)>0&&Number(D)>0&&M.fixedBundle.compareAtPriceVisibility&&e.createElement(Yd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Xd,{className:"yt-fixedBundle-summary_price"},nu(M.general.currencySymbol,r?.storeCurrencyCode),tu(F))),0!==S.size&&e.createElement(Gd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Xd,{className:"yt-fixedBundle-summary_price"},nu(M.general.currencySymbol,r?.storeCurrencyCode),tu(P))," ",Number(D)>0&&e.createElement(Zd,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",nu(M.general.currencySymbol,r?.storeCurrencyCode),tu(D)))),e.createElement(Kd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),j||!I?L(e):x(!0)},disabled:S.size<1||c||!_,style:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",color:M.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${M.general?.ctaBackgroundColor||"#121212"}`,boxShadow:M.general.ctaShadowType,paddingTop:M.general?.ctaPadding,paddingBottom:M.general?.ctaPadding,borderRadius:M.general.ctaBorderRadius,width:M.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=M.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=M.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ge,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?e.createElement(e.Fragment,null,M.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),r?.personalizedForm?.title&&e.createElement(Es,{isOpen:f,onClose:()=>y(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await O(e),y(!1)},cta:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",textColor:M.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},Up=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:u=!1})=>{const[m,g]=t(0),[x,f]=t(o.variants[0]?.id.toString()||""),[y,b]=t(!0),h=o.variants.find(e=>e.id.toString()===x)||o.variants[0],v=o.images.filter(Boolean),w=()=>{v.length<=1||(g(e=>0===e?v.length-1:e-1),b(!0))},C=()=>{v.length<=1||(g(e=>e===v.length-1?0:e+1),b(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=ou(h?.featured_image?.src);e?.setAttribute("src",t)}},[h]),!i)return null;const E=v.length>1,k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},v.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:ou(v[m]||o.images[0]),alt:o.title,onLoad:()=>b(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===m?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===m?.5:1}},e.createElement(Z,{size:24})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:m===v.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1}},e.createElement(L,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},u&&h?.name||o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price&&h.compare_at_price>h.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),T=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},v.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:v[m]||o.images[0],alt:o.title,onLoad:()=>b(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===m?.5:1,cursor:0===m?"not-allowed":"pointer"}},e.createElement(Z,{size:20})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1,cursor:m===v.length-1?"not-allowed":"pointer"}},e.createElement(L,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price?h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toLocaleString()):null),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return D.createPortal(p?T:k,document.body)},Yp=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-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",...o].map(o=>{const i=r===o,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(c,.07):"transparent",borderBottom:i?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=c)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>{const i=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?i:"#e0e0e0"}`,borderRadius:l,backgroundColor:r===o?i:"white",color:r===o?"white":"#333",cursor:"pointer"}},o.charAt(0).toUpperCase()+o.slice(1))})))},Gp=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},Xp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[u,m]=t([]),[g,x]=t(null),[f,y]=t({}),[b,h]=t(!1),[v,w]=t(window.innerWidth<640),[C,E]=t({}),k=r(null),T=r(new Map),[S,$]=t(160),[N,B]=t(""),[z,I]=t(""),[F,P]=t(!1),[D,A]=t("none"),_=v?8:20,{customizations:R}=o,O=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),L=!!o.config.form,M=O.length+(L?1:0),j=R.hideSelectedProducts,W=R.allowMultipleQty,H=R.hideOutOfStockProducts,q=o.config.splitVariants??!1,Q=r(new Set),U=i((e,t=d,n=z,o=D)=>{const r=O[e-1]?.products||[];let i="All"===t?r:r.filter(e=>Gp(e).includes(t));if(n.trim()){const e=n.toLowerCase();i=i.filter(t=>t.title.toLowerCase().includes(e))}return H&&(i=i.filter(e=>e.available)),"none"!==o&&(i=[...i].sort((e,t)=>{if("asc"===o||"desc"===o){const n=e.price||e.price_min||0,r=t.price||t.price_min||0;return"asc"===o?n-r:r-n}{const n=(e.title||"").toLowerCase(),r=(t.title||"").toLowerCase();return"alpha-asc"===o?n.localeCompare(r):r.localeCompare(n)}})),i},[O,d,z,D,H]),Y=i(e=>{const t=U(e).length;E(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,U]);n(()=>(k.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&Y(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[Y,c]),n(()=>{p("All"),B(""),I(""),P(!1),A("none")},[c]),n(()=>{const e=setTimeout(()=>{I(N)},300);return()=>clearTimeout(e)},[N]),n(()=>{if(L&&c===M)return;const e=c-1;if(!O[e])return;if(Q.current.has(e))return;const t=U(c);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],o=n.variants.filter(e=>e.available);if(1!==o.length)return;const r=o[0],i=ie(e),a=le[e];if(i!==1/0&&a>=i)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===r.id.toString()&&t.tierIndex===e)&&(Q.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<M)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(L&&c===M)return;const e=c,t=U(e).length;E(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(_,t),[`${e}_category`]:d}:n})},[c,_,d,U]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>w(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const X=i(e=>{$(e+10)},[]),Z=u.reduce((e,t)=>e+t.quantity,0),ee=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,te=u.reduce((e,t)=>{const n=O.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.compare_at_price??t.price)*t.quantity},0)/100,ne=e=>{for(let t=0;t<O.length;t++)if(O[t].products.some(t=>t.id.toString()===e))return t+1;return L?M:O.length},oe=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},re=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());m(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=le[t],c=ie(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},ie=e=>{const t=O[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},ae=(e,t)=>{const n=ie(t);if(n===1/0)return!0;const o=le[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},le=O.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),ce=(e,t,n)=>{const o=ie(n);if(o===1/0)return!0;return le[n]<o},se=(e,t,n)=>{m(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},de=async()=>{if(c!==M||!u.length)return;const e={};L&&Object.entries(f).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},pe=L&&c===M,ue=(pe?null:O[c-1])?ie(c-1):0,me=O.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:le[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},R.headerImage&&!R.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:R.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),R.showTierSteps&&e.createElement("div",{style:{paddingTop:R.headerImage&&!R.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Zp,{totalSteps:M,isFormStep:pe,currentStep:c,getStepTitle:e=>L&&e===M?"Customize Gift Details":O[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:o?.config?.form?.title,hasForm:L,onStepClick:e=>{s(e),window.scrollTo(0,0)}})),Array.from({length:M},(e,t)=>t+1).map(t=>{const n=L&&t===M,r=n?[]:(e=>O[e-1]?.products||[])(t);let i=[];if(!n&&R.enableProductCategories){const e=new Set;r.forEach(t=>Gp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const l=n?[]:U(t),w=t-1,E=l.slice(0,C[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement(fs,{form:o.config.form,formData:f,setFormData:y,barHeight:S,isUploading:b,setIsUploading:h}):e.createElement(e.Fragment,null,R.enableProductCategories&&i.length>0&&e.createElement(Yp,{styles:R,isMobile:v,categories:i,activeCategory:d,onCategoryChange:p}),(R.enableSearch||R.enableSort)&&e.createElement("div",{className:"yt-collection-bundle-controls",style:{display:"flex",alignItems:"center",justifyContent:v?"flex-end":"space-between",gap:"12px",padding:"0 16px",marginBottom:"16px",flexWrap:"nowrap",height:"45px"}},v?e.createElement(e.Fragment,null,F?e.createElement("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",gap:"8px"}},e.createElement("input",{type:"text",autoFocus:!0,placeholder:"Search...",value:N,onChange:e=>B(e.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:R.borderRadius||"8px",border:`1px solid ${R.bundleBorder||"#878787"}`,background:R.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none"}}),e.createElement("button",{onClick:()=>{P(!1),B(""),I("")},style:{background:"none",border:"none",color:"#888",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center"}},e.createElement(G,null))):e.createElement("div",{style:{display:"flex",gap:"20px",alignItems:"center"}},R.enableSearch&&e.createElement("button",{onClick:()=>P(!0),style:{background:"none",border:"none",color:"#333",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center"},className:"yt-collection-bundle-search-btn-mobile"},e.createElement(K,null)),R.enableSort&&e.createElement("div",{style:{position:"relative",display:"flex",alignItems:"center"},className:"yt-collection-bundle-sort-selecter-mobile-wrapper"},e.createElement("select",{value:D,onChange:e=>A(e.target.value),style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer",left:0,top:0,zIndex:1},className:"yt-collection-bundle-sort-selecter-mobile"},e.createElement("option",{value:"none"},"Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{fontSize:"20px",color:"#333",pointerEvents:"none",display:"flex",alignItems:"center"}},e.createElement(J,null))))):e.createElement(e.Fragment,null,R.enableSort&&e.createElement("div",{style:{position:"relative",flex:"0 1 200px",marginLeft:"12px",padding:"10px 16px",borderRadius:R.borderRadius||"8px",border:"1px solid #878787",background:R.productCardBg||"#fff",display:"flex",flexDirection:"row",alignItems:"center",gap:"6px"},className:"yt-collection-bundle-sort-wrapper"},e.createElement("span",{style:{fontWeight:"500",minWidth:"fit-content",fontSize:"14px"}},"Sort By"),e.createElement("select",{value:D,onChange:e=>A(e.target.value),style:{width:"100%",color:"#333",fontSize:"14px",outline:"none",cursor:"pointer",appearance:"none",boxSizing:"border-box",lineHeight:"normal",border:"none",fontFamily:"inherit"},className:"yt-collection-bundle-sort-selector"},e.createElement("option",{value:"none"}," Featured"),e.createElement("option",{value:"asc"},"Price: Low to High"),e.createElement("option",{value:"desc"},"Price: High to Low"),e.createElement("option",{value:"alpha-asc"},"Alphabetical: A-Z"),e.createElement("option",{value:"alpha-desc"},"Alphabetical: Z-A")),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888",pointerEvents:"none"}},e.createElement(V,null))),R.enableSearch&&e.createElement("div",{style:{position:"relative",flex:"0 1 300px"},className:"yt-collection-bundle-search-wrapper"},e.createElement("input",{type:"text",placeholder:"Search products...",value:N,onChange:e=>B(e.target.value),style:{width:"100%",padding:"10px 16px",paddingRight:"40px",borderRadius:R.borderRadius||"8px",border:"1px solid #878787",background:R.productCardBg||"#fff",color:"#333",fontSize:"14px",outline:"none",boxSizing:"border-box",lineHeight:"normal"},className:"yt-collection-bundle-search-input"}),e.createElement("div",{style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",color:"#888"}},e.createElement(K,null))))),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},0===l.length&&""!==z.trim()?e.createElement("div",{style:{padding:"60px 20px",textAlign:"center",width:"100%",gridColumn:"1 / -1"}},e.createElement("div",{style:{fontSize:"18px",color:"#333",marginBottom:"8px",fontWeight:600}},'No results found for "',N,'"'),e.createElement("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"}},"Try checking your spelling or using more general terms."),e.createElement("button",{onClick:()=>{B(""),I(""),P(!1)},style:{background:R.atcBg||"#000",color:R.atcText||"#fff",padding:"12px 32px",borderRadius:R.borderRadius||"8px",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:600,transition:"opacity 0.2s"},onMouseEnter:e=>e.currentTarget.style.opacity="0.8",onMouseLeave:e=>e.currentTarget.style.opacity="1"},"Clear Search")):q?E.flatMap(t=>t.variants.filter(e=>!H||e.available).map(n=>e.createElement(Kp,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:w,customizations:R,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:re,canAddProduct:ae,allowMultipleQty:W,handleVariantChange:oe,canIncrement:ce,setSelectedProducts:m,splitVariants:!0}))):E.map(t=>e.createElement(Kp,{key:t.id,product:t,tierIdx:w,customizations:R,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:re,canAddProduct:ae,allowMultipleQty:W,handleVariantChange:oe,canIncrement:ce,setSelectedProducts:m,splitVariants:!1})),c===t&&(C[t]||0)<l.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))),c===t&&e.createElement(Jp,{config:o,selectedProducts:u,selectedByTier:me,totalItems:Z,totalPrice:ee,totalCompareAtPrice:te,currentStep:c,totalSteps:M,currentTierMax:ue,tierSelectedCounts:le,isMobile:v,bundleAddToCartLoading:a,isUploading:b,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:j,getProductStep:ne,setCurrentStep:s,handleRemoveItem:se,handleCheckout:de,hasForm:L,onHeightChange:X}))}))},Zp=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!a||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},Kp=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g,splitVariants:x=!1})=>{const[f,y]=t(!1),b=x?null:document.querySelector(`[data-product-id="${n.id}"]`),h=x?n.variants[0].id.toString():b?.dataset.selectedVariant??n.variants[0].id.toString(),v=n.variants.find(e=>e.id.toString()===h)||n.variants[0],w=x?`${n.id}-${v.id}`:n.id,C=c.some(e=>e.productId===n.id.toString()&&e.variantId===h&&e.tierIndex===o),E=a===w,k=c.filter(e=>e.productId===n.id.toString()&&e.variantId===v.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:w,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":v.id,"data-current-price":v.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:i?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(w),onMouseLeave:()=>l(null)},e.createElement("img",{src:ou(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?0:1,transform:E?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:ou(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?1:0,transform:"scale(1.05)"},alt:n.title}),!x&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:v.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},r.productCardCategoryVisibility&&Gp(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},Gp(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:i?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),Gp(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",Gp(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:x?0:1}},n.title),x&&"Default Title"!==v.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:i?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},v.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(v.price/100).toLocaleString()),v.compare_at_price&&0!==v.compare_at_price&&v.compare_at_price>v.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(v.compare_at_price/100).toLocaleString()):null)),p&&k>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},k),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{v.available&&m(n,v.id.toString(),o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]})},disabled:!v.available||!m(n,v.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(C?"yt-collection-bundle-add-btn-added":""),style:{background:C?"#28a745":d(n,o)&&v.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:v.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(x)v.available&&d(n,o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.filter(e=>e!==r):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]});else{if(!v.available||!d(n,o))return;s(n,o)}},disabled:!v.available||!d(n,o)},C?"Added":v.available?"ADD TO BOX":"Out of Stock")),f&&e.createElement(Up,{product:n,tierIdx:o,isOpen:f,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,o),isSelected:C,customizations:r,isMobile:i,splitVariants:x}))},Jp=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,N]=t(!1),B=r(null),z=r(null),{totalOriginal:I,hasSavings:F,formattedSavings:P,totalAfterDiscount:D}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(N(!0),t=setTimeout(()=>{N(!1)},3e3)):N(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(B.current&&T){const e=B.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(z.current??0)&&(z.current=e),e>(z.current??0)){z.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;ke({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:B,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"sticky",bottom:"10px",left:"0",right:"0",marginInline:"auto",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:ou(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(U,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(D??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(gs,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(D??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",I.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",P)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(gs,null)):p===u?"Checkout":"Next")))},eu=window?.Shopify?.currency||{rate:1,active:"INR"},tu=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*eu.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},nu=(e,t)=>t==eu.active?e:pe(eu.active)||eu.active,ou=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},ru=(e,t,n,o,r,i,a)=>{const l=o.findIndex(t=>t.variantId===e&&(void 0===a||t.tierIndex===a));r(0===n?e=>e.filter((e,t)=>t!==l):-1===l?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i,tierIndex:a}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:i,tierIndex:a}:e))},iu=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Cs,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m,productsPagination:g}):"combo"===t.type?e.createElement(Ts,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(Ad,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(Xp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(nd,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(Qp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),au=c.div`
4677
4677
  position: relative;
4678
- `,au=c.button`
4678
+ `,lu=c.button`
4679
4679
  border: 1px solid #ccc;
4680
4680
  border-radius: 4px;
4681
4681
  padding: 2px 8px;
@@ -4685,7 +4685,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4685
4685
  font-size: 13px;
4686
4686
  font-weight: 500;
4687
4687
  cursor: pointer;
4688
- `,lu=c.div`
4688
+ `,cu=c.div`
4689
4689
  position: absolute;
4690
4690
  bottom: calc(100% + 5px);
4691
4691
  left: 0;
@@ -4697,7 +4697,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4697
4697
  min-width: 100px;
4698
4698
  max-height: 150px;
4699
4699
  overflow-y: auto;
4700
- `,cu=c.div`
4700
+ `,su=c.div`
4701
4701
  padding: 8px 12px;
4702
4702
  display: flex;
4703
4703
  align-items: center;
@@ -4707,31 +4707,31 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4707
4707
  &:hover {
4708
4708
  background-color: #f1f1f1;
4709
4709
  }
4710
- `,su=c.span`
4710
+ `,du=c.span`
4711
4711
  width: 16px;
4712
4712
  height: 16px;
4713
4713
  border-radius: 50%;
4714
4714
  background-color: ${({$colorValue:e})=>e};
4715
4715
  border: 1px solid #eee;
4716
- `,du=c.img`
4716
+ `,pu=c.img`
4717
4717
  width: 20px;
4718
4718
  height: 20px;
4719
4719
  border-radius: 50%;
4720
4720
  object-fit: cover;
4721
- `,pu=c(V)`
4721
+ `,uu=c(V)`
4722
4722
  transition: transform 0.2s ease-in-out;
4723
4723
  transform: ${({$isOpen:e})=>e?"rotate(180deg)":"none"};
4724
- `,uu=c.div`
4724
+ `,mu=c.div`
4725
4725
  display: flex;
4726
4726
  align-items: center;
4727
4727
  gap: 15px;
4728
4728
  margin-top: 4px;
4729
4729
  flex-wrap: wrap;
4730
- `,mu=c.span`
4730
+ `,gu=c.span`
4731
4731
  font-size: 14px;
4732
4732
  color: #666;
4733
4733
  font-weight: 400;
4734
- `,gu=c.div`
4734
+ `,xu=c.div`
4735
4735
  position: fixed;
4736
4736
  bottom: 0;
4737
4737
  left: 0;
@@ -4745,7 +4745,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4745
4745
  transform: translateY(${e=>e.$translateY}px);
4746
4746
  pointer-events: ${e=>0===e.$opacity?"none":"auto"};
4747
4747
  background-color: ${e=>"stretch"===e.$desktopBarType?"white":"none"};
4748
- `,xu=c.div`
4748
+ `,fu=c.div`
4749
4749
  display: flex;
4750
4750
  align-items: center;
4751
4751
  flex-direction: column;
@@ -4770,7 +4770,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4770
4770
 
4771
4771
  ${e=>e.$topRibbonText&&`&::before {\n content: "${e.$topRibbonText}";\n position: absolute;\n top: 0;\n left: 50%;\n transform: translate(-50%, -70%);\n background-color: ${e.$themeColor||"black"};\n color: ${e.$themeTextColor||"white"};\n padding-top: 2px;\n padding-bottom: 8px;\n font-size: 12px;\n line-height: normal;\n text-align: center;\n border-top-left-radius: ${"rounded"===e.$cornerType?"30px":"0px"};\n border-top-right-radius: ${"rounded"===e.$cornerType?"30px":"0px"};\n line-height: normal;\n width: ${"rounded"===e.$cornerType?"97%":"100%"};\n z-index: -1;\n }`}
4772
4772
  ${e=>"hover"===e.$desktopBarType&&"\n box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);\n &:hover {\n box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);\n }\n "}
4773
- `,fu=c.div`
4773
+ `,yu=c.div`
4774
4774
  display: flex;
4775
4775
  align-items: center;
4776
4776
  justify-content: space-between;
@@ -4781,7 +4781,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4781
4781
  flex-direction: row;
4782
4782
  width: 498px;
4783
4783
  }
4784
- `,yu=c.img`
4784
+ `,bu=c.img`
4785
4785
  width: 80px;
4786
4786
  // height: 50px;
4787
4787
  object-fit: cover;
@@ -4789,7 +4789,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4789
4789
  aspect-ratio: 1;
4790
4790
  border-radius: 8px;
4791
4791
  border: 1.55px solid var(--base-border, #dedede);
4792
- `,bu=c.div`
4792
+ `,hu=c.div`
4793
4793
  display: flex;
4794
4794
  flex-direction: column;
4795
4795
  align-items: flex-start;
@@ -4809,7 +4809,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4809
4809
  @media (min-width: 768px) {
4810
4810
  max-width: 200px;
4811
4811
  }
4812
- `;const hu=c.div`
4812
+ `;const vu=c.div`
4813
4813
  display: flex;
4814
4814
  width: 100%;
4815
4815
  justify-content: space-between;
@@ -4821,7 +4821,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4821
4821
  width: auto;
4822
4822
  flex-direction: row;
4823
4823
  }
4824
- `,vu=c.button`
4824
+ `,wu=c.button`
4825
4825
  display: flex;
4826
4826
  justify-content: center;
4827
4827
  align-items: center;
@@ -4847,7 +4847,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4847
4847
  transform: scale(1.01);
4848
4848
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
4849
4849
  }
4850
- `,wu=c.button`
4850
+ `,Cu=c.button`
4851
4851
  display: flex;
4852
4852
  justify-content: center;
4853
4853
  align-items: center;
@@ -4874,7 +4874,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4874
4874
  transform: scale(1.01);
4875
4875
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
4876
4876
  }
4877
- `,Cu={showPrice:!0,productImage:{id:"",path:""},buyNowCtaTitle:"BUY NOW",desktopBarType:"stretch",showProductName:!0,showBuyNowButton:!1,showProductImage:!0,addToCartCtaTitle:"ADD TO CART",showAddToCartButton:!0,showVariantSelector:!1,productInfoVisibility:!0,excludeProducts:[],showBarOnDesktop:!0,ctaButtonFontSize:18,startsAppearingAtHeight:200,fullyAppearsAtHeight:400,alwaysPersistent:!1},Eu=({showStickyCart:o,product:a,addCartItem:l,onSetLoading:c,themeColor:s,cartData:d,isCartOpen:p,setIsCartOpen:u,ctaButtonBackgroundColor:m,ctaButtonTextColor:g,addToStickyCart:x,cartComponentsCornerType:f,cartComponentsCornerRadius:y,themeTextColor:b,stickyCartCustomizationData:h,checkoutFunction:v,backgroundColor:w,primaryTextColor:C,comboBundleData:E,comboBundleAddToCartFunction:k,volumeBundleCurrentTier:T,volumeBundleData:S,volumeBundleAddToCartFunction:$})=>{const[N,B]=t(""),[z,I]=t(null),[F,P]=t({}),D=sr(),[A,_]=t(null),R=r(null);n(()=>{const e=e=>{R.current&&!R.current.contains(e.target)&&_(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const O=i((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),L=i(()=>E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>O(E.products[0].productDetails,e?.node?.id)>0)?.node:a?.variants?.find(e=>e?.available),[E,a,O]),[M,V]=t(()=>{if(!E||"combo"!==E.type)return{};const e={};return E?.products?.forEach((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>O(t.productDetails,e?.node?.id)>0)?.node;o?e[n]=o.id:t?.productDetails?.variants?.edges?.length>0&&(e[n]=t.productDetails.variants.edges[0].node.id)}),e}),j=i(e=>{if(!E||"combo"!==E.type)return;const t={};E?.products?.forEach((n,o)=>{const r=n?.productDetails?.variants?.edges?.find(t=>{const o=t?.node;return n?.productDetails?.options?.every((t,n)=>{const r=e?.[t?.name],i=o?.title?.split(" / ")?.at(n);return!(!r||!i)&&r.trim().toLowerCase()===i.trim().toLowerCase()})});r?.node?.id&&(t[o]=r.node.id)}),Object.keys(t).length>0&&V(e=>({...e,...t}))},[E]);n(()=>{const e=L();if(e){B(String(e.id)),I(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),P(t)}else if(a?.variants?.length>0){const e=a.variants[0];B(String(e.id)),I(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),P(t)}},[a,L]);const W=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]),H=()=>{const e=W();if(e){const t=a?.variants?.find(t=>String(t?.id)===String(e));if(t&&t?.available){B(String(t.id)),I(t);const e={};a?.options?.forEach((n,o)=>{const r=`option${o+1}`;t?.[r]&&(e[n?.name]=t[r])}),P(e)}else{const e=L();e?(B(String(e.id)),I(e)):a?.variants?.length>0&&(B(String(a.variants[0].id)),I(a.variants[0]))}}};n(()=>{H();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",H),()=>{t=!1,window.removeEventListener("urlChange",H),window.history.pushState=n,window.history.replaceState=o}},[W,a,L]);const q=r(null),[Q,U]=t(1),Y=cn(d,d?.currency),G=e.useMemo(()=>{if(!E||"combo"!==E.type)return null;const{price:e,compareAtPrice:t}=Object.entries(M).reduce((e,[t,n])=>{const o=E.products?.[Number(t)],r=o?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node,i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);return E?.percentageOff?o=e*(1-E.percentageOff/100):E?.dealAmount?o=E.dealAmount:E?.amountOff&&(o=e-E.amountOff),{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),savings:(n-o).toFixed(2),hasSavings:n>o}},[E,M]),X=e.useMemo(()=>{if(!T||!z)return null;const e=parseFloat(z.price??"0"),t=parseFloat(z.compare_at_price||e.toString()),n=an(e,d?.currency),o=an(t,d?.currency),r=T.minimumQuantity,i=Math.max(n,o)*r;let a=n*r;const l=S?.discountType||T.discountType;"percentOff"===l?a*=1-T.discountValue/100:"amountOff"===l&&(a-=T.discountValue);const c=Math.max(0,a);return{originalPrice:i.toFixed(2),dealPrice:c.toFixed(2),savings:(i-c).toFixed(2),hasSavings:i>c&&void 0!==l}},[T,S,z,d]);n(()=>{(async()=>{try{if(E&&"combo"===E.type)return;a&&N&&I(a?.variants?.filter(e=>String(e?.id)===String(N))[0])}catch(e){console.error("Error getting selected product variant id")}})()},[a,N,E]),n(()=>{const e=e=>{const t=e;t.detail?.selectedVariants&&V(t.detail.selectedVariants)};return window.addEventListener("yt-combo-bundle-updated",e),()=>{window.removeEventListener("yt-combo-bundle-updated",e)}},[]);const{cartLoading:Z}=on(),K=r(null),[J,ee]=t(0);n(()=>{K.current&&ee(K.current.offsetWidth)},[]);const te=a?.options?.find(e=>e?.name?.toLowerCase()?.includes("color"))?.name,ne=te?F?.[te]:null,oe=h&&(re=h,0!==Object.keys(re).length||re.constructor!==Object)?h:Cu;var re;const{showProductName:ie,showPrice:ae,showVariantSelector:le,showBuyNowButton:ce,showAddToCartButton:se,desktopBarType:de,showProductImage:pe,buyNowCtaTitle:ue,addToCartCtaTitle:me,productInfoVisibility:xe,showBarOnDesktop:fe,ctaButtonFontSize:ye,startsAppearingAtHeight:be,fullyAppearsAtHeight:he,topRibbonText:ve,alwaysPersistent:we}=oe,[Ce,Ee]=t(we?1:0),[ke,Te]=t(we?0:100),[Se,$e]=t(!1);if(n(()=>{if(we)return Ee(1),void Te(0);const e=()=>{const e=window.scrollY;document.documentElement.scrollHeight;const t=be||200,n=he||400;if(e>t){const o=Math.min((e-t)/(n-t),1);Ee(o),Te(100-100*o)}else Ee(0),Te(100)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[we,be,he]),n(()=>{const e=()=>{const e=window.innerWidth<768;$e(e||!1!==fe)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[fe]),a?.variants?.length<1)return null;const Ne=a?.available??!0,Be=L(),ze=E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>e?.node?.id===M?.[0])?.node?.price:z?.price??Be?.price??a?.variants?.[0]?.price;if(0===Number(ze)&&(!E||"combo"!==E.type))return null;if(!o||!Se)return null;if(h?.excludeProducts?.includes(a?.handle))return null;const Ie=E&&"combo"===E.type?E.products?.every((e,t)=>{const n=M[t];return!!n&&O(e.productDetails,n)>0})??!1:z?.available??!0;return e.createElement(gu,{className:"yt-sticky-bar-container",$opacity:Ce,$translateY:ke,$desktopBarType:de||"stretch"},e.createElement(xu,{className:"yt-sticky-bar-inner-container",$desktopBarType:de||"stretch",$themeColor:s,$cornerType:f??"sharp",$cornerRadius:y??20,$themeTextColor:b,$productInfoVisibility:xe,$topRibbonText:ve,$backgroundColor:w},xe&&e.createElement(fu,null,pe&&e.createElement(yu,{className:"yt-sticky-bar-product-image",src:((e,t)=>"string"==typeof e?.featured_image?e.featured_image:e?.featured_image?.src?e.featured_image.src:t?.featured_image)(z,a),alt:z?.name}),e.createElement(bu,{ref:K,className:"yt-sticky-bar-product-details"},ie&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{style:{fontSize:"20px",fontWeight:"500",color:C,display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",lineHeight:"normal"}},`${a?.title}`),ne&&e.createElement("span",{style:{fontSize:"11px",color:"#666",backgroundColor:"#f1f1f1",padding:"2px 6px",borderRadius:"10px",border:"1px solid #ddd"}},ne)),a?.variants?.length>1&&le&&e.createElement(uu,{className:"yt-sticky-bar-option-container",ref:R},a?.options?.map(t=>{const n=D?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),o=F[t.name],r=A===t.name,i=e=>{((e,t)=>{const n={...F,[e]:t};P(n);const o=a?.variants?.find(e=>a?.options?.every((t,o)=>{const r=n?.[t?.name],i=e?.[`option${o+1}`];return"string"==typeof r&&"string"==typeof i?r.trim().toLowerCase()===i.trim().toLowerCase():r===i}));o&&(B(String(o.id)),I(o)),E&&"combo"===E?.type&&j(n)})(t.name,e),_(null)},l=cr(n,o);return e.createElement("div",{key:t.name,style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement(mu,null,t.name),e.createElement(iu,null,e.createElement(au,{onClick:()=>{_(r?null:t.name)},className:"yt-sticky-bar-dropdown-button"},"color"===n?.type&&l?.value?e.createElement(su,{$colorValue:l.value}):"image"===n?.type&&l?.value?e.createElement(du,{src:l.value}):null,o,e.createElement(pu,{size:8,$isOpen:r})),r&&e.createElement(lu,{$backgroundColor:w,className:"yt-sticky-bar-dropdown-panel"},t.values.map(t=>{const o=cr(n,t);return e.createElement(cu,{className:"yt-sticky-bar-dropdown-item",key:t,onClick:()=>i(t)},"color"===n?.type&&o?.value?e.createElement(su,{$colorValue:o.value}):"image"===n?.type&&o?.value?e.createElement(du,{src:o.value}):null,t)}))))})),ae&&e.createElement(e.Fragment,null,G?G.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,eu(G.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,eu(G.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,eu(G.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,eu(G.dealPrice)):X?X.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,eu(X.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,eu(X.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,eu(X.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,eu(X.dealPrice)):z?.compare_at_price&&z?.compare_at_price>z?.price?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,an(z?.price,d?.currency)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,an(z?.compare_at_price,d?.currency)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,an(z?.compare_at_price-z?.price,d?.currency))):e.createElement(e.Fragment,null,e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,an(z?.price,d?.currency)))),e.createElement("span",{style:{color:"#6E747B",fontSize:10},className:"yt-sticky-bar-product-tax-inclusion"},"Inclusive of all taxes"))),Ne&&e.createElement(hu,{className:"yt-sticky-bar-product-line-item-control",$flexDirection:xe?"row":"column"},se&&e.createElement(wu,{ref:q,onClick:async()=>{if(E&&"combo"===E.type){if(!k)return void console.error("[StickyCart.tsx] comboBundleAddToCartFunction is undefined");const e=Object.entries(M);if(0===e.length)return;const t=e.map(([,e])=>e),n=e.map(([e,t])=>{const n=E?.products?.[Number(e)],o=n?.productDetails?.variants?.edges?.find(e=>e?.node?.id===t)?.node;return o?{variantId:t,price:Number(o?.price),compareAtPrice:Number(o?.compareAtPrice||o?.price)}:null}).filter(e=>null!==e),o=n.reduce((e,t)=>e+Math.max(t.compareAtPrice,t.price),0),r=n.reduce((e,t)=>e+t.price,0);let i=Math.min(o,r);E?.percentageOff?i=r*(1-E.percentageOff/100):E?.dealAmount?i=E.dealAmount:E?.amountOff&&(i=r-E.amountOff);const a=n.map(({variantId:e,price:t})=>({variantId:e,price:t}));try{await k(Number(o.toFixed(2)),t,Number(i.toFixed(2)),a)}catch(e){console.error("[StickyCart.tsx] Error adding combo bundle to cart:",e)}return}if(T&&T.minimumQuantity>1){if(!$)return void console.error("[StickyCart.tsx] volumeBundleAddToCartFunction is undefined");const e=String(N)??String(a?.variants[0]?.id),t=Array(T.minimumQuantity).fill(e),n=X?Number(X.originalPrice):0;try{await $(n,t)}catch(e){console.error("[StickyCart.tsx] Error adding volume bundle to cart:",e)}return}x&&await x(String(N)??String(a?.variants[0]?.id),Q)},disabled:Z.cartLoading||!Ie,$bgColor:Ie?m:"#d1d5db",$textColor:Ie?g:"#6b7280",className:"yt-sticky-add-to-cart-button",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:Ie?"pointer":"not-allowed",opacity:Ie?1:.6}},Z.cartLoading?e.createElement(ge,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,Ie?me??"Add to Cart":"Out of Stock")),ce&&e.createElement(vu,{onClick:async()=>{try{v&&await v(String(N)??String(a?.variants[0]?.id),Q)}catch(e){console.error("Error checking out from sticky bar")}},id:"yt-checkout-button",className:"yt-checkout-button",disabled:Z.cartLoading||!Ie,$bgColor:Ie?s:"#d1d5db",$textColor:Ie?b:"#6b7280",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:Ie?"pointer":"not-allowed",opacity:Ie?1:.6}},Z.cartLoading?e.createElement(ge,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,Ie?ue??"Buy Now":"Out of Stock")))))},ku=c.div`
4877
+ `,Eu={showPrice:!0,productImage:{id:"",path:""},buyNowCtaTitle:"BUY NOW",desktopBarType:"stretch",showProductName:!0,showBuyNowButton:!1,showProductImage:!0,addToCartCtaTitle:"ADD TO CART",showAddToCartButton:!0,showVariantSelector:!1,productInfoVisibility:!0,excludeProducts:[],showBarOnDesktop:!0,ctaButtonFontSize:18,startsAppearingAtHeight:200,fullyAppearsAtHeight:400,alwaysPersistent:!1},ku=({showStickyCart:o,product:a,addCartItem:l,onSetLoading:c,themeColor:s,cartData:d,isCartOpen:p,setIsCartOpen:u,ctaButtonBackgroundColor:m,ctaButtonTextColor:g,addToStickyCart:x,cartComponentsCornerType:f,cartComponentsCornerRadius:y,themeTextColor:b,stickyCartCustomizationData:h,checkoutFunction:v,backgroundColor:w,primaryTextColor:C,comboBundleData:E,comboBundleAddToCartFunction:k,volumeBundleCurrentTier:T,volumeBundleData:S,volumeBundleAddToCartFunction:$})=>{const[N,B]=t(""),[z,I]=t(null),[F,P]=t({}),D=sr(),[A,_]=t(null),R=r(null);n(()=>{const e=e=>{R.current&&!R.current.contains(e.target)&&_(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const O=i((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.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},[]),L=i(()=>E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>O(E.products[0].productDetails,e?.node?.id)>0)?.node:a?.variants?.find(e=>e?.available),[E,a,O]),[M,V]=t(()=>{if(!E||"combo"!==E.type)return{};const e={};return E?.products?.forEach((t,n)=>{const o=t?.productDetails?.variants?.edges?.find(e=>O(t.productDetails,e?.node?.id)>0)?.node;o?e[n]=o.id:t?.productDetails?.variants?.edges?.length>0&&(e[n]=t.productDetails.variants.edges[0].node.id)}),e}),j=i(e=>{if(!E||"combo"!==E.type)return;const t={};E?.products?.forEach((n,o)=>{const r=n?.productDetails?.variants?.edges?.find(t=>{const o=t?.node;return n?.productDetails?.options?.every((t,n)=>{const r=e?.[t?.name],i=o?.title?.split(" / ")?.at(n);return!(!r||!i)&&r.trim().toLowerCase()===i.trim().toLowerCase()})});r?.node?.id&&(t[o]=r.node.id)}),Object.keys(t).length>0&&V(e=>({...e,...t}))},[E]);n(()=>{const e=L();if(e){B(String(e.id)),I(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),P(t)}else if(a?.variants?.length>0){const e=a.variants[0];B(String(e.id)),I(e);const t={};a?.options&&Array.isArray(a.options)&&a.options.forEach((n,o)=>{const r=`option${o+1}`;e?.[r]&&(t[n?.name]=e[r])}),P(t)}},[a,L]);const W=i(()=>new URLSearchParams(window.location.search).get("variant")||"",[]),H=()=>{const e=W();if(e){const t=a?.variants?.find(t=>String(t?.id)===String(e));if(t&&t?.available){B(String(t.id)),I(t);const e={};a?.options?.forEach((n,o)=>{const r=`option${o+1}`;t?.[r]&&(e[n?.name]=t[r])}),P(e)}else{const e=L();e?(B(String(e.id)),I(e)):a?.variants?.length>0&&(B(String(a.variants[0].id)),I(a.variants[0]))}}};n(()=>{H();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,o=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(o.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",H),()=>{t=!1,window.removeEventListener("urlChange",H),window.history.pushState=n,window.history.replaceState=o}},[W,a,L]);const q=r(null),[Q,U]=t(1),Y=cn(d,d?.currency),G=e.useMemo(()=>{if(!E||"combo"!==E.type)return null;const{price:e,compareAtPrice:t}=Object.entries(M).reduce((e,[t,n])=>{const o=E.products?.[Number(t)],r=o?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node,i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n=Math.max(e,t);let o=Math.min(e,t);return E?.percentageOff?o=e*(1-E.percentageOff/100):E?.dealAmount?o=E.dealAmount:E?.amountOff&&(o=e-E.amountOff),{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),savings:(n-o).toFixed(2),hasSavings:n>o}},[E,M]),X=e.useMemo(()=>{if(!T||!z)return null;const e=parseFloat(z.price??"0"),t=parseFloat(z.compare_at_price||e.toString()),n=an(e,d?.currency),o=an(t,d?.currency),r=T.minimumQuantity,i=Math.max(n,o)*r;let a=n*r;const l=S?.discountType||T.discountType;"percentOff"===l?a*=1-T.discountValue/100:"amountOff"===l&&(a-=T.discountValue);const c=Math.max(0,a);return{originalPrice:i.toFixed(2),dealPrice:c.toFixed(2),savings:(i-c).toFixed(2),hasSavings:i>c&&void 0!==l}},[T,S,z,d]);n(()=>{(async()=>{try{if(E&&"combo"===E.type)return;a&&N&&I(a?.variants?.filter(e=>String(e?.id)===String(N))[0])}catch(e){console.error("Error getting selected product variant id")}})()},[a,N,E]),n(()=>{const e=e=>{const t=e;t.detail?.selectedVariants&&V(t.detail.selectedVariants)};return window.addEventListener("yt-combo-bundle-updated",e),()=>{window.removeEventListener("yt-combo-bundle-updated",e)}},[]);const{cartLoading:Z}=on(),K=r(null),[J,ee]=t(0);n(()=>{K.current&&ee(K.current.offsetWidth)},[]);const te=a?.options?.find(e=>e?.name?.toLowerCase()?.includes("color"))?.name,ne=te?F?.[te]:null,oe=h&&(re=h,0!==Object.keys(re).length||re.constructor!==Object)?h:Eu;var re;const{showProductName:ie,showPrice:ae,showVariantSelector:le,showBuyNowButton:ce,showAddToCartButton:se,desktopBarType:de,showProductImage:pe,buyNowCtaTitle:ue,addToCartCtaTitle:me,productInfoVisibility:xe,showBarOnDesktop:fe,ctaButtonFontSize:ye,startsAppearingAtHeight:be,fullyAppearsAtHeight:he,topRibbonText:ve,alwaysPersistent:we}=oe,[Ce,Ee]=t(we?1:0),[ke,Te]=t(we?0:100),[Se,$e]=t(!1);if(n(()=>{if(we)return Ee(1),void Te(0);const e=()=>{const e=window.scrollY;document.documentElement.scrollHeight;const t=be||200,n=he||400;if(e>t){const o=Math.min((e-t)/(n-t),1);Ee(o),Te(100-100*o)}else Ee(0),Te(100)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[we,be,he]),n(()=>{const e=()=>{const e=window.innerWidth<768;$e(e||!1!==fe)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[fe]),a?.variants?.length<1)return null;const Ne=a?.available??!0,Be=L(),ze=E&&"combo"===E.type?E?.products?.[0]?.productDetails?.variants?.edges?.find(e=>e?.node?.id===M?.[0])?.node?.price:z?.price??Be?.price??a?.variants?.[0]?.price;if(0===Number(ze)&&(!E||"combo"!==E.type))return null;if(!o||!Se)return null;if(h?.excludeProducts?.includes(a?.handle))return null;const Ie=E&&"combo"===E.type?E.products?.every((e,t)=>{const n=M[t];return!!n&&O(e.productDetails,n)>0})??!1:z?.available??!0;return e.createElement(xu,{className:"yt-sticky-bar-container",$opacity:Ce,$translateY:ke,$desktopBarType:de||"stretch"},e.createElement(fu,{className:"yt-sticky-bar-inner-container",$desktopBarType:de||"stretch",$themeColor:s,$cornerType:f??"sharp",$cornerRadius:y??20,$themeTextColor:b,$productInfoVisibility:xe,$topRibbonText:ve,$backgroundColor:w},xe&&e.createElement(yu,null,pe&&e.createElement(bu,{className:"yt-sticky-bar-product-image",src:((e,t)=>"string"==typeof e?.featured_image?e.featured_image:e?.featured_image?.src?e.featured_image.src:t?.featured_image)(z,a),alt:z?.name}),e.createElement(hu,{ref:K,className:"yt-sticky-bar-product-details"},ie&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{style:{fontSize:"20px",fontWeight:"500",color:C,display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",lineHeight:"normal"}},`${a?.title}`),ne&&e.createElement("span",{style:{fontSize:"11px",color:"#666",backgroundColor:"#f1f1f1",padding:"2px 6px",borderRadius:"10px",border:"1px solid #ddd"}},ne)),a?.variants?.length>1&&le&&e.createElement(mu,{className:"yt-sticky-bar-option-container",ref:R},a?.options?.map(t=>{const n=D?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase()),o=F[t.name],r=A===t.name,i=e=>{((e,t)=>{const n={...F,[e]:t};P(n);const o=a?.variants?.find(e=>a?.options?.every((t,o)=>{const r=n?.[t?.name],i=e?.[`option${o+1}`];return"string"==typeof r&&"string"==typeof i?r.trim().toLowerCase()===i.trim().toLowerCase():r===i}));o&&(B(String(o.id)),I(o)),E&&"combo"===E?.type&&j(n)})(t.name,e),_(null)},l=cr(n,o);return e.createElement("div",{key:t.name,style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement(gu,null,t.name),e.createElement(au,null,e.createElement(lu,{onClick:()=>{_(r?null:t.name)},className:"yt-sticky-bar-dropdown-button"},"color"===n?.type&&l?.value?e.createElement(du,{$colorValue:l.value}):"image"===n?.type&&l?.value?e.createElement(pu,{src:l.value}):null,o,e.createElement(uu,{size:8,$isOpen:r})),r&&e.createElement(cu,{$backgroundColor:w,className:"yt-sticky-bar-dropdown-panel"},t.values.map(t=>{const o=cr(n,t);return e.createElement(su,{className:"yt-sticky-bar-dropdown-item",key:t,onClick:()=>i(t)},"color"===n?.type&&o?.value?e.createElement(du,{$colorValue:o.value}):"image"===n?.type&&o?.value?e.createElement(pu,{src:o.value}):null,t)}))))})),ae&&e.createElement(e.Fragment,null,G?G.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,tu(G.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,tu(G.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,tu(G.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,tu(G.dealPrice)):X?X.hasSavings?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,tu(X.dealPrice)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,tu(X.originalPrice)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,tu(X.savings))):e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,tu(X.dealPrice)):z?.compare_at_price&&z?.compare_at_price>z?.price?e.createElement("div",{style:{display:"flex",flexDirection:"row",gap:5,alignItems:"center"}},e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,an(z?.price,d?.currency)),e.createElement("span",{style:{textDecoration:"line-through",color:"#6b7280",fontSize:14},className:"yt-sticky-bar-product-compare-price"},`${Y}`,an(z?.compare_at_price,d?.currency)),e.createElement("span",{style:{backgroundColor:s??"black",color:b??"white",padding:"3px 9px",fontSize:"12px",borderRadius:"rounded"===f?`${y}px`:"0"},className:"yt-sticky-bar-product-discount"},"Save ",`${Y}`,an(z?.compare_at_price-z?.price,d?.currency))):e.createElement(e.Fragment,null,e.createElement("span",{style:{fontWeight:"500",fontSize:18,color:C},className:"yt-sticky-bar-product-price"},`${Y}`,an(z?.price,d?.currency)))),e.createElement("span",{style:{color:"#6E747B",fontSize:10},className:"yt-sticky-bar-product-tax-inclusion"},"Inclusive of all taxes"))),Ne&&e.createElement(vu,{className:"yt-sticky-bar-product-line-item-control",$flexDirection:xe?"row":"column"},se&&e.createElement(Cu,{ref:q,onClick:async()=>{if(E&&"combo"===E.type){if(!k)return void console.error("[StickyCart.tsx] comboBundleAddToCartFunction is undefined");const e=Object.entries(M);if(0===e.length)return;const t=e.map(([,e])=>e),n=e.map(([e,t])=>{const n=E?.products?.[Number(e)],o=n?.productDetails?.variants?.edges?.find(e=>e?.node?.id===t)?.node;return o?{variantId:t,price:Number(o?.price),compareAtPrice:Number(o?.compareAtPrice||o?.price)}:null}).filter(e=>null!==e),o=n.reduce((e,t)=>e+Math.max(t.compareAtPrice,t.price),0),r=n.reduce((e,t)=>e+t.price,0);let i=Math.min(o,r);E?.percentageOff?i=r*(1-E.percentageOff/100):E?.dealAmount?i=E.dealAmount:E?.amountOff&&(i=r-E.amountOff);const a=n.map(({variantId:e,price:t})=>({variantId:e,price:t}));try{await k(Number(o.toFixed(2)),t,Number(i.toFixed(2)),a)}catch(e){console.error("[StickyCart.tsx] Error adding combo bundle to cart:",e)}return}if(T&&T.minimumQuantity>1){if(!$)return void console.error("[StickyCart.tsx] volumeBundleAddToCartFunction is undefined");const e=String(N)??String(a?.variants[0]?.id),t=Array(T.minimumQuantity).fill(e),n=X?Number(X.originalPrice):0;try{await $(n,t)}catch(e){console.error("[StickyCart.tsx] Error adding volume bundle to cart:",e)}return}x&&await x(String(N)??String(a?.variants[0]?.id),Q)},disabled:Z.cartLoading||!Ie,$bgColor:Ie?m:"#d1d5db",$textColor:Ie?g:"#6b7280",className:"yt-sticky-add-to-cart-button",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:Ie?"pointer":"not-allowed",opacity:Ie?1:.6}},Z.cartLoading?e.createElement(ge,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,Ie?me??"Add to Cart":"Out of Stock")),ce&&e.createElement(wu,{onClick:async()=>{try{v&&await v(String(N)??String(a?.variants[0]?.id),Q)}catch(e){console.error("Error checking out from sticky bar")}},id:"yt-checkout-button",className:"yt-checkout-button",disabled:Z.cartLoading||!Ie,$bgColor:Ie?s:"#d1d5db",$textColor:Ie?b:"#6b7280",$cornerType:f??"sharp",$cornerRadius:y??20,$fontSize:ye,style:{cursor:Ie?"pointer":"not-allowed",opacity:Ie?1:.6}},Z.cartLoading?e.createElement(ge,{color:"white",loading:Z.cartLoading,size:15}):e.createElement(e.Fragment,null,Ie?ue??"Buy Now":"Out of Stock")))))},Tu=c.div`
4878
4878
  width: 100%;
4879
4879
  height: 100%;
4880
4880
  display: flex;
@@ -4887,7 +4887,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4887
4887
  bottom: 0;
4888
4888
  z-index: 2147483644;
4889
4889
  pointer-events: none; /* Allow clicks to pass through to overlay */
4890
- `,Tu=c.div`
4890
+ `,Su=c.div`
4891
4891
  width: 100%;
4892
4892
  text-align: center;
4893
4893
  font-size: 18px;
@@ -4905,7 +4905,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4905
4905
  padding: 5px 0;
4906
4906
  font-size: 14px;
4907
4907
  }
4908
- `,Su=c.div`
4908
+ `,$u=c.div`
4909
4909
  position: relative;
4910
4910
  display: flex;
4911
4911
  flex-direction: column;
@@ -4953,13 +4953,13 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4953
4953
  `,c.label`
4954
4954
  font-size: 14px;
4955
4955
  color: #2d2d2d;
4956
- `;const $u=c.div`
4956
+ `;const Nu=c.div`
4957
4957
  display: flex;
4958
4958
  justify-content: center;
4959
4959
  align-items: center;
4960
4960
  width: 100%;
4961
4961
  height: 150px;
4962
- `,Nu=c.div`
4962
+ `,Bu=c.div`
4963
4963
  display: flex;
4964
4964
  flex-direction: column;
4965
4965
  row-gap: 12px;
@@ -4978,7 +4978,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4978
4978
  padding: 12px 15px;
4979
4979
  row-gap: 10px;
4980
4980
  }
4981
- `,Bu=c.div`
4981
+ `,zu=c.div`
4982
4982
  display: flex;
4983
4983
  flex-direction: row;
4984
4984
  width: 100%;
@@ -4996,7 +4996,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4996
4996
  gap: 10px;
4997
4997
  margin-bottom: 8px;
4998
4998
  }
4999
- `,zu=c.div`
4999
+ `,Iu=c.div`
5000
5000
  flex-shrink: 0;
5001
5001
  width: 90px;
5002
5002
 
@@ -5008,7 +5008,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5008
5008
  @media (max-width: 480px) {
5009
5009
  width: 75px;
5010
5010
  }
5011
- `,Iu=c.img`
5011
+ `,Fu=c.img`
5012
5012
  width: 90px;
5013
5013
  height: 90px;
5014
5014
  border-radius: 8px;
@@ -5025,12 +5025,12 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5025
5025
  width: 75px;
5026
5026
  height: 75px;
5027
5027
  }
5028
- `,Fu=c.div`
5028
+ `,Pu=c.div`
5029
5029
  display: flex;
5030
5030
  flex-direction: column;
5031
5031
  flex: 1;
5032
5032
  gap: 5px;
5033
- `,Pu=c.a`
5033
+ `,Du=c.a`
5034
5034
  margin: 0 0 5px 0;
5035
5035
  font-size: 16px;
5036
5036
  font-weight: 500;
@@ -5057,12 +5057,12 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5057
5057
  font-size: 14px;
5058
5058
  margin: 0 0 3px 0;
5059
5059
  }
5060
- `,Du=c.div`
5060
+ `,Au=c.div`
5061
5061
  display: flex;
5062
5062
  flex-direction: row;
5063
5063
  align-items: center;
5064
5064
  gap: 4px;
5065
- `,Au=c.span`
5065
+ `,_u=c.span`
5066
5066
  font-weight: 600;
5067
5067
  font-size: 16px;
5068
5068
  color: ${e=>e.$primaryTextColor??"#1a1a1a"};
@@ -5075,7 +5075,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5075
5075
  @media (max-width: 480px) {
5076
5076
  font-size: 14px;
5077
5077
  }
5078
- `,_u=c.span`
5078
+ `,Ru=c.span`
5079
5079
  text-decoration-line: line-through;
5080
5080
  color: #9b9c9d;
5081
5081
  font-size: 14px;
@@ -5109,7 +5109,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5109
5109
  justify-content: space-between;
5110
5110
  align-items: center;
5111
5111
  margin-top: 15px;
5112
- `;const Ru=c.button`
5112
+ `;const Ou=c.button`
5113
5113
  width: 100%;
5114
5114
  padding: 16px;
5115
5115
  background: ${e=>e.$themeColor||"#C33"};
@@ -5151,7 +5151,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5151
5151
  align-items: flex-start;
5152
5152
  gap: 24px;
5153
5153
  width: 100%;
5154
- `;const Ou=c.div`
5154
+ `;const Lu=c.div`
5155
5155
  display: flex;
5156
5156
  flex-direction: column;
5157
5157
  align-items: flex-start;
@@ -5175,7 +5175,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5175
5175
  `,c.div`
5176
5176
  display: flex;
5177
5177
  flex-wrap: wrap;
5178
- `;const Lu=c.button`
5178
+ `;const Mu=c.button`
5179
5179
  height: 23px;
5180
5180
  min-width: 35px;
5181
5181
  padding: 0 15px;
@@ -5210,7 +5210,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5210
5210
  min-width: 32px;
5211
5211
  font-size: 12px;
5212
5212
  }
5213
- `,Mu=c.div`
5213
+ `,Vu=c.div`
5214
5214
  font-family: inherit;
5215
5215
  font-weight: 500;
5216
5216
  font-size: 13px;
@@ -5228,7 +5228,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5228
5228
  @media (max-width: 480px) {
5229
5229
  font-size: 12px;
5230
5230
  }
5231
- `,Vu=c.span`
5231
+ `,ju=c.span`
5232
5232
  font-weight: 400;
5233
5233
  font-size: 12px;
5234
5234
  color: #333;
@@ -5251,13 +5251,13 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5251
5251
  @media (max-width: 480px) {
5252
5252
  font-size: 12px;
5253
5253
  }
5254
- `;const ju=c.div`
5254
+ `;const Wu=c.div`
5255
5255
  display: flex;
5256
5256
  flex-wrap: wrap;
5257
5257
  width: 100%;
5258
5258
  gap: 2px;
5259
5259
  margin-top: 8px;
5260
- `,Wu=c.div`
5260
+ `,Hu=c.div`
5261
5261
  display: flex;
5262
5262
  flex-direction: row;
5263
5263
  justify-content: space-between;
@@ -5274,7 +5274,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5274
5274
  @media (max-width: 480px) {
5275
5275
  margin-top: 3px;
5276
5276
  }
5277
- `,Hu=c.button`
5277
+ `,qu=c.button`
5278
5278
  border-radius: 50%;
5279
5279
  padding: 2px;
5280
5280
  background-color: ${({$colorValue:e})=>e||"transparent"};
@@ -5289,7 +5289,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5289
5289
  &:hover {
5290
5290
  border-color: ${({$themeColor:e})=>e||"#000"};
5291
5291
  }
5292
- `,qu=c.button`
5292
+ `,Qu=c.button`
5293
5293
  border-radius: 50%;
5294
5294
  padding: 2px;
5295
5295
  background-color: transparent;
@@ -5305,4 +5305,4 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5305
5305
  &:hover {
5306
5306
  border-color: ${({$themeColor:e})=>e||"#000"};
5307
5307
  }
5308
- `,Qu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=le(rn),w=ce(Zt),C=r(null),[E,k]=t(null),[T,S]=t(!1),[$,N]=t({}),[B,z]=t(h?.variantId),[I,F]=t(h?.quantity||1),[P,D]=t(!1),A=sr();n(()=>{h?.open?setTimeout(()=>{D(!0)},10):D(!1)},[h?.open]);n(()=>{(async()=>{if(!E&&l&&h?.variantId&&h?.handle){const e=await l(h.handle,h.variantId);if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){z(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),N(n)}else z(void 0),N({})}k(e)}})()},[E,l,h]);const _=(e,t)=>{const n={...$,[e]:t};N(n);const o=E?.variants?.find(e=>E.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&z(String(o.id))}},R=E?.variants?.find(e=>String(e.id)===String(B)),O=cn(w,w?.currency),L=o(()=>{const e={};if(!E)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return E.options.forEach(n=>{e[n.name]=n.values.filter(e=>E.variants.filter(o=>{const r=E.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!E.options.every((e,t)=>{if(e.name===n.name)return!0;const r=$[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[E,$,h]);return E?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:P?1:0,transition:"opacity 0.3s ease"},onClick:()=>{D(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(ku,{ref:b,className:"yt-variant-selection-popup"},e.createElement(Su,{ref:C,style:{backgroundColor:p||"white",opacity:P?1:0,transform:P?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Tu,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Nu,null,e.createElement(Bu,null,e.createElement(zu,null,e.createElement(Iu,{src:R?.featured_image?.src??E?.featured_image,alt:R?.featured_image?.alt??E?.title})),e.createElement(Fu,null,e.createElement(Pu,{$themeColor:c,$primaryTextColor:y,href:`${E?.url}?variant=${R?.id}`},E?.title),e.createElement(Wu,null,e.createElement(Du,null,e.createElement(Au,{$primaryTextColor:y},O,an(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(_u,null,O,an(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(nr,{value:I,handleItemQuantityIncrement:async()=>{F(e=>e+1)},handleItemQuantityDecrement:async()=>{I>1&&F(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),E?.options?.map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(Ou,{key:t.name},e.createElement(Mu,null,e.createElement("span",null,"Select ",t.name),$[t.name]&&e.createElement(Vu,null,$[t.name])),e.createElement(ju,null,L[t.name]?.map(o=>{const r=$[t.name]===o,i=cr(n,o);return"color"===n?.type&&i?.value?e.createElement(Hu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(qu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(Lu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(Ru,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(B&&a){S(!0);try{await a(B,I,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}S(!1)}}:async()=>{if(!B)return;const e=!!h?.lineItemKey,t=String(B)!==String(h?.variantId);if(!e||t){S(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(B,h.allowedVariantIds):e&&m?await m(B,h.allowedVariantIds):a&&B&&await a(B,I,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}S(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!B||T},T?e.createElement(ge,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(ku,{ref:b},e.createElement(Su,{style:{backgroundColor:p||"white"}},e.createElement($u,null,e.createElement(xe,{color:c||"#868E96"}))))});Qu.displayName="DesktopVariantPopup";const Uu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=le(rn),w=ce(Zt),[C,E]=t(null),[k,T]=t(!1),[S,$]=t({}),[N,B]=t(h?.variantId),[z,I]=t(h?.quantity||1),F=r(null),P=sr(),[D,A]=t(!1);n(()=>{h?.open?setTimeout(()=>{A(!0)},10):A(!1)},[h?.open]);n(()=>{(async()=>{if(!C&&l&&h?.variantId&&h?.handle)try{const e=await l(h.handle,h.variantId);if(!e)return;if(!e.variants||!Array.isArray(e.variants))return;if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){B(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),$(n)}else B(void 0),$({})}E(e)}catch(e){}})()},[C,l,h]),n(()=>{},[p,i,a,l]);const _=(e,t)=>{const n={...S,[e]:t};$(n);const o=C?.variants?.find(e=>C.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&B(String(o.id))}},R=C?.variants?.find(e=>String(e.id)===String(N)),O=cn(w,w?.currency),L=o(()=>{const e={};if(!C)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return C.options.forEach(n=>{e[n.name]=n.values.filter(e=>C.variants.filter(o=>{const r=C.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!C.options.every((e,t)=>{if(e.name===n.name)return!0;const r=S[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[C,S,h]);return C?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:D?1:0,transition:"opacity 0.3s ease"},onClick:()=>{A(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(ku,{ref:b,className:"yt-variant-selection-popup"},e.createElement(Su,{ref:F,style:{backgroundColor:p||"white",opacity:D?1:0,transform:D?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Tu,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Nu,null,e.createElement(Bu,null,e.createElement(zu,null,e.createElement(Iu,{src:R?.featured_image?.src??C?.featured_image,alt:R?.featured_image?.alt??C?.title})),e.createElement(Fu,null,e.createElement(Pu,{$themeColor:c,$primaryTextColor:y,href:`${C?.url}?variant=${R?.id}`},C?.title),e.createElement(Wu,null,e.createElement(Du,null,e.createElement(Au,{$primaryTextColor:y},O,an(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(_u,null,O,an(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(nr,{value:z,handleItemQuantityIncrement:async()=>{I(e=>e+1)},handleItemQuantityDecrement:async()=>{z>1&&I(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),C?.options?.map(t=>{const n=P?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(Ou,{key:t.name},e.createElement(Mu,null,e.createElement("span",null,"Select ",t.name,":"),S[t.name]&&e.createElement(Vu,null,S[t.name])),e.createElement(ju,null,L[t.name]?.map(o=>{const r=S[t.name]===o,i=cr(n,o);return"color"===n?.type&&i?.value?e.createElement(Hu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(qu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(Lu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(Ru,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(N&&a){T(!0);try{await a(N,z,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}T(!1)}}:async()=>{if(!N)return;const e=!!h?.lineItemKey,t=String(N)!==String(h?.variantId);if(!e||t){T(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(N,h.allowedVariantIds):e&&m?await m(N,h.allowedVariantIds):a&&N&&await a(N,z,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}T(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!N||k},k?e.createElement(ge,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(ku,{ref:b},e.createElement(Su,{style:{backgroundColor:p||"white"}},e.createElement($u,null,e.createElement(xe,{color:c||"#868E96"}))))});const Yu=({setIsCartOpen:t,isCartOpen:n,cartCheckpoints:o,customCartProgressBarCriteria:r,floatingCartData:i,effectiveQuantityForProgressBar:a,cartComponentsCornerType:l,cartComponentsCornerRadius:c})=>{const s=ce(Zt),d=i?.bannerFooterText,p="string"==typeof d&&d.trim().length>0,u=!n&&(e=>{try{if("undefined"==typeof window)return!1;const t=window.location.pathname||"/";if("/"===t||""===t)return!0;const n=e?.showOnPages;if(!Array.isArray(n)||0===n.length)return!1;const o=t.toLowerCase(),r=o.endsWith("/")?o:`${o}/`;return n.some(e=>{if(!e||"string"!=typeof e)return!1;const t=e.trim().toLowerCase().replace(/^\/|\/$/g,"");if(!t)return!1;const n=`/${t}/`;return r.includes(n)})}catch{return!1}})(i),m=s?.item_count??0,g=an(s?.items_subtotal_price??0,s?.currency??"INR"),x=cn(s),f=function(e,t,n,o,r){if(!e||0===e.length)return{deltaValue:0,show:!1};const i=(t??"minimum_order_value").toLowerCase(),a="quantity_threshold"===i?"number"==typeof r?r:o:n,l=[...e].sort((e,t)=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)-("quantity_threshold"===i?t.quantityThreshold:t.minimumOrderValue)).find(e=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)>a);if(!l)return{deltaValue:0,show:!1};const c="quantity_threshold"===i?l.quantityThreshold:l.minimumOrderValue,s=Math.max(0,c-a);return{deltaValue:s,show:s>0,isQuantity:"quantity_threshold"===i}}(o,r,g,m,a),y="sharp"===l?0:c??12,h=i?.textColor??"#111",v=i?.backgroundColor??"#FF7E6E",w=i?.bannerBackgroundColor??"#FFE0DC",C=i?.buttonColor??"#E8513F",E=e.useRef(null);e.useEffect(()=>{xn(E.current)},[C]);const k={position:"fixed",width:"100%",bottom:0,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"},T={background:"#FFFFFF",color:"#111",padding:"5px",fontSize:12,fontFamily:"Poppins",fontWeight:600,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",gap:8},S={background:"#fff",color:h,borderRadius:y,boxShadow:"0 10px 24px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:"Poppins"},$={position:"absolute",top:0,left:"50%",transform:"translate(-50%, -70%)",backgroundColor:w,color:h,padding:8,fontSize:12,lineHeight:"normal",borderTopLeftRadius:13,borderTopRightRadius:13,width:"97%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,zIndex:-1},N={display:"flex",alignItems:"center",gap:12,padding:"10px 12px",backgroundColor:v,cursor:"pointer"},B={display:"flex",alignItems:"center",gap:8,fontWeight:700,fontSize:16,color:h},z={fontSize:12,color:h,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},I={padding:"5px 10px",background:C,color:"#fff",borderRadius:8,fontSize:15,fontWeight:700,border:"none",outline:"none",flexShrink:0};if(!u)return null;if(0===m){if(!f.show)return null;const t=f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${fn(f.deltaValue.toFixed(0))} to get freebie`;return e.createElement("div",{style:k},e.createElement("div",{className:"yt-cart-floating-ribbon",style:T},e.createElement(b,{"aria-hidden":!0}),e.createElement("span",null,t)))}const F=1===m?"1 item":`${m} items`,P=i?.lastTierUnlockedText||"Best tier unlocked",D=f.show?f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${fn(f.deltaValue.toFixed(0))} more to get freebie`:P;return e.createElement("div",{style:{position:"fixed",left:12,right:12,bottom:12,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"}},e.createElement("div",{style:{position:"relative"}},(f.show||o&&o.length>0)&&e.createElement("div",{className:"yt-cart-floating-banner",style:$},e.createElement(b,{"aria-hidden":!0,style:{marginBottom:7}}),e.createElement("span",{style:{display:"inline-block",marginBottom:7}},D)),e.createElement("div",{style:S},e.createElement("div",{className:"yt-cart-floating-body",style:N,onClick:()=>t(!0)},e.createElement(_,{width:24,height:24,color:h}),e.createElement("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,lineHeight:"normal"}},e.createElement("div",{style:B},e.createElement("span",null,x,fn(g.toFixed(0))),e.createElement("span",{style:{fontSize:9,fontWeight:600,color:"#fff",backgroundColor:"#828282",marginBottom:5,paddingInline:5}},F)),p?e.createElement("span",{style:z,title:d},d):null),e.createElement("button",{ref:E,style:I,onClick:()=>t(!0),"aria-label":"View Cart"},"View Cart")))))},Gu=({exploreCTAColor:o,checkoutFontSize:i,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,cartTitle:p,emptyCartTitle:u,emptyCartDescription:m,emptyCartButtons:g,backgroundColor:x,backgroundSubdued:f,tertiaryColor:y,tertiaryTextColor:b,backdrop:h=!0,cartData:v,isUserSignedIn:w,showBundle:C,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:N,removeDiscount:B,applyDiscount:z,discountApplied:I,checkoutFunction:F,joinNowFunction:P,guestLoyaltyPercentage:D,showToggleButton:A,isOpen:_,setIsOpen:R,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K,checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ie,showProductRecsOnDesktop:ae,showProductRecsOnMobile:ce,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,showNoteOption:Ee,applyNoteToCart:ke,note:Te,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Ne,showEditOptionOnProducts:Be,getProductDetailsByVariantId:ze,onSetLoading:Ie,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:Pe,currentTier:De,freebieProductsInCart:Ae,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,showStickyAddToCart:Ge,stickyCartLineItem:Xe,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,enableCustomCartOnCartPage:rt,isCartPage:it,progressBarFreeProductIconType:at,addToStickyCart:lt,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,showFloatingCart:ut,floatingCartData:mt,freebieMilestoneData:gt,cartTimerInMinutes:xt,cartTimerCustomText:ft,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,stickyCartCustomizationData:vt,cartOffersCarousalData:wt,stickyBarBuyNowFunction:Ct,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Nt,loyaltyDiscount:Bt,brandTokenName:zt,showDiscountOnMRP:It,prefixMessageText:Ft,suffixMessageText:Pt,successMessageText:Dt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht=!0,showCouponOptions:qt,rewardCoupons:Qt,couponSelectionData:Ut,comboBundleData:Yt,comboBundleAddToCartFunction:Gt,stealDealCheckpoints:Xt,stealDealProducts:Kt,stealDealAddToCart:Jt,useCartShell:en,showTrustedBadge:tn,trustedBadgeData:nn,drawerLayoutData:on})=>{const an=se(Zt),[ln,cn]=le(rn),[sn,dn]=le(ma),pn=()=>R(!_),[un,mn]=t(()=>{const e=window.ytComboBundle;return{comboBundleData:e?.bundle??null,comboBundleAddToCartFunction:e?.addToCart??null}});n(()=>{const e=e=>{const t=e.detail;mn({comboBundleData:t?.bundle??null,comboBundleAddToCartFunction:t?.addToCart??null})};return window.addEventListener("yt-combo-bundle-updated",e),()=>window.removeEventListener("yt-combo-bundle-updated",e)},[]);const gn=un.comboBundleData??Yt,xn=un.comboBundleAddToCartFunction??Gt,[fn,yn]=t(()=>{const e=window.ytVolumeBundle;return{bundle:e?.bundle??void 0,currentTier:e?.currentTier??void 0,volumeBundleAddToCartFunction:e?.addToCart??void 0}});n(()=>{const e=e=>{const t=e.detail;yn({bundle:t?.bundle??void 0,currentTier:t?.tierData??void 0,volumeBundleAddToCartFunction:t?.addToCart??void 0})};return window.addEventListener("yt-volume-bundle-updated",e),()=>window.removeEventListener("yt-volume-bundle-updated",e)},[]);const bn=r(null),hn=r(0);a(()=>{if(v){const e=v?.token??null,t="number"==typeof v?.cartUpdatedAtMs?v.cartUpdatedAtMs:void 0;e!==bn.current&&(bn.current=e,hn.current=t??0);const n=hn.current;if(!(void 0===t||t>=n))return;void 0!==t&&(hn.current=t),an(v)}},[v]);const vn=r(null);n(()=>{function e(e){vn.current&&!vn.current.contains(e.target)&&(cn({open:!1,variantId:void 0,quantity:void 0,handle:void 0}),dn({isOpen:!1}))}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const[wn,Cn]=t(!1);return n(()=>{const e=()=>{Cn(window.innerWidth>=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{if(!en)return;const e=window.ytCartShell;if(!e)return;const t=e.getDrawerElement?.(),n=e.getOverlayElement?.();t&&(!_||rt&&it?(t.style.setProperty("transform","translateX(100%)","important"),t.style.boxShadow="none",n&&(n.style.display="none"),document.body.classList.remove("drawer-open")):(t.style.setProperty("transform","translateX(0)","important"),t.style.boxShadow="-14px 8px 14.4px 0px rgba(0, 0, 0, 0.35)",h&&n&&(n.style.display="block"),document.body.classList.add("drawer-open")))},[_,en,rt,it,h]),n(()=>{if(!en)return;const e=window.ytCartShell,t=e?.getOverlayElement?.();if(!t)return;const n=()=>R(!1);return t.addEventListener("click",n),()=>t.removeEventListener("click",n)},[en,R]),e.createElement(e.Fragment,null,e.createElement("div",{style:{position:rt&&it?"relative":"absolute",width:"100%",display:rt&&it?"flex":"block",alignItems:"center",justifyContent:"center"}},A&&!(rt&&it)&&e.createElement("button",{style:{margin:"16px"},onClick:pn},_?"Close Drawer":"Open Drawer"),!en&&_&&h&&!(rt&&it)&&e.createElement("div",{onClick:pn,id:"custom-cart-yt-overlay",style:{position:"fixed",top:0,right:0,zIndex:1e4,transform:"translateX(0)",backgroundColor:"rgba(0,0,0,0.5)",inset:0,height:"100%",width:"100%"}},"‎"),e.createElement(ac,{useCartShell:en,isCartPage:it,enableCustomCartOnCartPage:rt,isOpen:_,setIsOpen:R,backgroundColor:x,backgroundSubdued:f??"#F5F5F5",tertiaryColor:y,tertiaryTextColor:b,exploreCTAColor:o,checkoutFontSize:i,cartTitle:p,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,emptyCartTitle:u,emptyCartButtons:g,emptyCartDescription:m,showBundle:C,isUserSignedIn:w,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:N,removeDiscount:B,applyDiscount:z,discountApplied:I,checkoutFunction:F,joinNowFunction:P,guestLoyaltyPercentage:D,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K??"minimum_order_value",checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ie,showProductRecsOnDesktop:ae,showProductRecsOnMobile:ce,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,applyNoteToCart:ke,note:Te,showNoteOption:Ee,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Ne,showEditOptionOnProducts:Be,onSetLoading:Ie,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:Pe,currentTier:De,freebieProductsInCart:Ae,cartOffersCarousalData:wt,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,progressBarFreeProductIconType:at,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,freebieMilestoneData:gt,cartTimerCustomText:ft,cartTimerInMinutes:xt,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Nt,loyaltyDiscount:Bt,getProductDetailsByVariantId:ze,brandTokenName:zt,showDiscountOnMRP:It??!0,prefixMessageText:Ft,suffixMessageText:Pt,successMessageText:Dt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht,stealDealCheckpoints:Xt,stealDealProducts:Kt,stealDealAddToCart:Jt,showCouponOptions:qt,rewardCoupons:Qt,couponSelectionData:Ut,showTrustedBadge:tn,trustedBadgeData:nn,drawerLayoutData:on}),Ge&&Xe&&d&&e.createElement(Eu,{showStickyCart:Ge,stickyCartCustomizationData:vt,product:Xe,addCartItem:d,onSetLoading:Ie,themeColor:de,themeTextColor:pe,cartData:v,isCartOpen:_,setIsCartOpen:R,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,addToStickyCart:lt,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,checkoutFunction:Ct,backgroundColor:x,primaryTextColor:ne,comboBundleData:gn,comboBundleAddToCartFunction:xn,volumeBundleCurrentTier:fn.currentTier,volumeBundleData:fn.bundle,volumeBundleAddToCartFunction:fn.volumeBundleAddToCartFunction}),wn&&ln.open&&e.createElement(Qu,{backgroundColor:x,ref:vn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:ze,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Jt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne}),!wn&&ln.open&&e.createElement(Uu,{ref:vn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:ze,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,backgroundColor:x,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Jt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne})),!wn&&ut&&e.createElement(Yu,{isCartOpen:_,setIsCartOpen:R,cartCheckpoints:j,customCartProgressBarCriteria:K,floatingCartData:mt,effectiveQuantityForProgressBar:Le,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt}))};bt(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Xu=()=>e.createElement("div",{className:"scene"},e.createElement("div",{className:"floating"},e.createElement("div",{className:"cube"},e.createElement("div",{className:"side front"},"‎"),e.createElement("div",{className:"side back"},"‎"),e.createElement("div",{className:"side left"},"‎"),e.createElement("div",{className:"side right"},"‎"),e.createElement("div",{className:"side bottom"},"‎"),e.createElement("div",{className:"lid"},e.createElement("div",{className:"flap north"},"‎"),e.createElement("div",{className:"flap south"},"‎"),e.createElement("div",{className:"flap east"},"‎"),e.createElement("div",{className:"flap west"},"‎")))));bt("\n@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Urbanist:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n@font-face {\n font-family: 'Circular Std';\n src: local('Circular Std Book'), local('Circular Std');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n}\n@font-face {\n font-family: 'Circular Std';\n src: local('Circular Std Medium'), local('Circular Std');\n font-weight: 500;\n font-style: normal;\n font-display: swap;\n}\n@font-face {\n font-family: 'Circular Std';\n src: local('Circular Std Bold'), local('Circular Std');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n}\n\n\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Regular.ttf') format('truetype');\n font-weight: 400;\n font-style: normal;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Bold.ttf') format('truetype');\n font-weight: 700;\n font-style: normal;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Light.ttf') format('truetype');\n font-weight: 300;\n font-style: normal;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Italic.ttf') format('truetype');\n font-weight: 400;\n font-style: italic;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-BoldItalic.ttf') format('truetype');\n font-weight: 700;\n font-style: italic;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-LightItalic.ttf') format('truetype');\n font-weight: 300;\n font-style: italic;\n}\n\n\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-Regular.otf') format('opentype');\n font-weight: 400;\n font-style: normal;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-RegularOblique.otf') format('opentype');\n font-weight: 400;\n font-style: oblique;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-RegularSlanted.otf') format('opentype');\n font-weight: 400;\n font-style: italic;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-Ultralight.otf') format('opentype');\n font-weight: 200;\n font-style: normal;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltralightOblique.otf') format('opentype');\n font-weight: 200;\n font-style: oblique;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltralightSlanted.otf') format('opentype');\n font-weight: 200;\n font-style: italic;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-Ultrabold.otf') format('opentype');\n font-weight: 800;\n font-style: normal;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltraboldOblique.otf') format('opentype');\n font-weight: 800;\n font-style: oblique;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltraboldSlanted.otf') format('opentype');\n font-weight: 800;\n font-style: italic;\n}\n\n:root {\n --font-primary: 'Poppins', sans-serif;\n --font-secondary: 'Urbanist', sans-serif;\n --font-tertiary: 'Inter', sans-serif;\n --font-alt: 'Sansation', sans-serif;\n --font-brand: 'PP Telegraf', sans-serif;\n}\n");bt('.lpc-root {\n width: 100%;\n background: #ffffff;\n overflow: hidden;\n font-family: var(--font-primary, "Poppins", sans-serif);\n}\n\n.lpc-header {\n background: #ffffff;\n padding: 56px 16px 28px;\n}\n\n.lpc-banner {\n max-width: 100%;\n height: auto;\n display: block;\n margin: 0 auto 20px;\n}\n\n.lpc-align-left {\n text-align: left;\n}\n\n.lpc-align-center {\n text-align: center;\n}\n\n.lpc-align-right {\n text-align: right;\n}\n\n.lpc-heading {\n margin: 0px;\n color: rgba(0, 0, 0, 0.87);\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 32px;\nfont-style: normal;\nfont-weight: 600;\nline-height: 38.78px; /* 121.187% */\nletter-spacing: -0.16px;\n}\n\n.lpc-subheading {\n margin-top: 12px;\n color: #292C77;\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 16px;\nfont-style: normal;\nfont-weight: 400;\nline-height: 112%; /* 17.92px */\n}\n\n.lpc-sectionTitle {\n margin: 10px 0 0;\n color: #636381;\n font-size: 14px;\n line-height: 1.4;\n}\n\n.lpc-tierBar {\n width: 100%;\n}\n\n.lpc-tierRow {\n max-width: 1200px;\n margin: 0 auto;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0;\n}\n\n.lpc-tierButton {\n border: 0;\n outline: none;\n appearance: none;\n cursor: pointer;\n min-width: 108px;\n padding: 20px 18px;\n color: rgba(0, 0, 0, 0.87);\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 24px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 36px; /* 150% */\n border-bottom: 4px solid transparent;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n}\n\n.lpc-balanceBar {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n margin: 20px 60px 8px;\n padding: 10px 14px;\n background: #d9e4eb;\n}\n\n.lpc-balanceLabel {\n color: #000;\nfont-family: Poppins;\nfont-size: 18px;\nfont-style: normal;\nfont-weight: 500;\nline-height: 31.9px; \n}\n\n.lpc-balanceValue {\n color: #000;\ntext-align: center;\nfont-family: Poppins;\nfont-size: 18px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 31.9px; \n}\n\n.lpc-cardList {\n margin: 0;\n padding: 20px 60px 50px;\n gap: 36px;\n}\n\n.lpc-cardList--scroll {\n display: flex;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-behavior: smooth;\n}\n\n.lpc-cardList--scroll::-webkit-scrollbar {\n height: 0;\n}\n\n.lpc-cardList--grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));\n}\n\n.lpc-cardList--wrap {\n display: flex;\n flex-wrap: wrap;\n}\n\n.lpc-card {\n flex: 0 0 360px;\n min-height: 430px;\n border: 1px solid;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n\n.lpc-cardList--grid .lpc-card {\n flex: unset;\n}\n\n.lpc-cardList--wrap .lpc-card {\n flex: 0 0 360px;\n}\n\n.lpc-imageWrap {\n width: 100%;\n aspect-ratio: 1 / 1;\n background: #ffffff;\n overflow: hidden;\n}\n\n.lpc-image {\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center;\n display: block;\n}\n\n.lpc-meta {\n padding: 14px 10px 12px;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n}\n\n.lpc-coins {\n color: #A5A5A5;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 11px;\nfont-style: normal;\nfont-weight: 600;\nline-height: 110%; /* 12.1px */\nletter-spacing: 0.109px;\npadding: 3px 0px;\n}\n\n.lpc-title {\n overflow: hidden;\ncolor: var(--Text-color, #252B42);\ntext-overflow: ellipsis;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 16px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 120%;\nletter-spacing: 0.109px;\ndisplay: -webkit-box;\n-webkit-line-clamp: 2;\n-webkit-box-orient: vertical;\n min-height: 40px;\n margin: 0;\n}\n\n.lpc-description {\n margin: 6px 0 0;\n color: #E4A8BD;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 112%;\n}\n\n.lpc-ratingRow {\n padding: 5px 0px;\n display: flex;\n align-items: center;\n gap: 6px;\n color: #4b4d60;\n font-size: 16px;\n line-height: 1.2;\n}\n\n.lpc-star {\n color: #f6a623;\n font-size: 14px;\n}\n\n.lpc-ratingText {\n color: #3A3A3A;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 11px;\nfont-style: normal;\nfont-weight: 400;\nline-height: 150%; /* 16.5px */\n}\n\n.lpc-priceRow {\n margin-top: auto;\n padding: 10px 0 5px;\n display: flex;\n align-items: center;\n gap: 8px;\n color: #1f1f1f;\n}\n\n.lpc-priceMuted {\n color: #767676;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-priceStrikethrough {\n color: #767676;\n text-decoration: line-through;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-priceNow {\n color: #111111;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-pricePlus {\n color: #111111;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-priceCoins {\n color: #111111;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 700;\n line-height: 120%;\n}\n\n.lpc-coinIcon {\n width: 14px;\n height: 14px;\n object-fit: contain;\n display: inline-block;\n}\n\n.lpc-cta {\n margin-top: 8px;\n border: 1px solid transparent;\n outline: none;\n width: 100%;\n padding: 12px 14px;\n cursor: pointer;\n background: #DC8EAB;\n color: var(--Theme-Text-Color, #FFF);\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 14px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 180%; /* 25.2px */\n/* text-transform: uppercase; */\n box-shadow: var(--lpc-cta-shadow);\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.lpc-cta:hover:not(:disabled) {\n transform: translateY(-1px);\n}\n\n.lpc-cta:active:not(:disabled) {\n transform: translateY(1px);\n box-shadow: var(--lpc-cta-shadow-active);\n}\n\n.lpc-cta:disabled {\n cursor: not-allowed;\n}\n\n.lpc-nav {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0px;\n padding: 0px 0 30px;\n}\n\n.lpc-navBtn {\n padding: 9px;\n border: none;\n background: transparent;\n color: #bcbcc7;\n font-size: 37px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;\n}\n\n.lpc-navBtn:disabled {\n color: #bcbcc7;\n opacity: 0.75;\n cursor: not-allowed;\n}\n\n.lpc-navBtn--enabled {\n background: #ececef;\n color: #3b3c4b;\n}\n\n@media (max-width: 1024px) {\n .lpc-heading {\n font-size: 32px !important;\n }\n\n .lpc-tierButton {\n min-width: 84px;\n padding: 16px 14px;\n font-size: 14px;\n }\n\n .lpc-cardList {\n padding: 20px 16px;\n gap: 12px;\n }\n\n .lpc-balanceBar {\n margin: 0 16px 8px;\n padding: 8px 10px;\n }\n\n .lpc-balanceLabel,\n .lpc-balanceValue {\n font-size: 14px;\n }\n\n .lpc-card {\n flex-basis: 260px;\n min-height: 360px;\n }\n\n .lpc-coins {\n font-size: 11px;\n }\n\n .lpc-title {\n font-size: 16px;\n }\n\n .lpc-ratingRow {\n font-size: 12px;\n }\n\n .lpc-cta {\n padding: 12px;\n font-size: 13px;\n }\n\n .lpc-navBtn {\n width: 42px;\n height: 42px;\n font-size: 24px;\n }\n}\n');function Zu({size:t=20,color:n="#000",thickness:o=2,centered:r=!1}){const i=e.createElement("div",{className:"yt-loader",style:{width:`${t}px`,height:`${t}px`,border:`${o}px solid rgba(0,0,0,0.15)`,borderTop:`${o}px solid ${n}`}}," ");return r?e.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"}},i):i}bt(".yt-loader {\n border-radius: 50%;\n animation: yt-spin 0.8s linear infinite;\n }\n \n @keyframes yt-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n ");const Ku={sectionTitle:"Get your favorites for free",subheading:"Earn more and unlock Freebies",display:"scroll",alignment:"center",titleFontSize:46,titleColor:"#25262D",subtitleColor:"#41439A",tabBackgroundColor:"#FFFFFF",tabActiveColor:"#FFFFFF",tabActiveTextColor:"#25262D",tabTextColor:"#25262D",cardBackgroundColor:"#FFFFFF",buttonColor:"#DC8EAB",buttonTextColor:"#FFFFFF",borderColor:"#E2E2E8",roundness:0,ctaText:"Sign in to access",coinBalanceLabel:"Balance:"},Ju=e=>{if(null==e||""===e)return null;const t="number"==typeof e?e.toString():e;return t.includes("₹")?t:`₹${t}`},em=({config:i})=>{const a={...Ku,...i},{sectionTitle:l,catalogBanner:c,coinBalance:s,coinBalanceLabel:d,coinIconUrl:p,display:u,alignment:m,titleFontSize:g,titleColor:x,cardBackgroundColor:f,buttonColor:y,buttonTextColor:b,borderColor:h,roundness:v,tiers:w,selectedTierId:C,products:E,ctaText:k}=a,T=r(null),[S,$]=t(!1),[N,B]=t(!1),[z,I]=t(null),F=o(()=>E,[E]),P=e=>{if(!T.current)return;const t=.8*T.current.clientWidth;T.current.scrollBy({left:"left"===e?-t:t,behavior:"smooth"})};n(()=>{const e=T.current;if(!e)return;const t=()=>{const t=e.scrollWidth-e.clientWidth;$(e.scrollLeft>1),B(e.scrollLeft<t-1)};return t(),e.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[F.length]);const D="grid"===u?"lpc-cardList lpc-cardList--grid":"wrap"===u?"lpc-cardList lpc-cardList--wrap":"lpc-cardList lpc-cardList--scroll";return e.createElement("section",{className:"lpc-root"},e.createElement("div",{className:`lpc-header lpc-align-${m||"center"}`},c?e.createElement("img",{className:"lpc-banner",src:c,alt:"Catalog banner"}):null,l?e.createElement("h2",{className:"lpc-heading",style:{color:x,fontSize:`${g}px`}},l):null),null!=s&&""!==s?e.createElement("div",{className:"lpc-balanceBar"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19",fill:"none"},e.createElement("path",{d:"M1.53613 6.91208H16.1281C16.3318 6.91208 16.5272 6.99299 16.6712 7.13702C16.8152 7.28105 16.8961 7.47639 16.8961 7.68008V15.3601C16.8961 15.5638 16.8152 15.7591 16.6712 15.9031C16.5272 16.0472 16.3318 16.1281 16.1281 16.1281H2.30413C2.10045 16.1281 1.9051 16.0472 1.76107 15.9031C1.61705 15.7591 1.53613 15.5638 1.53613 15.3601V6.91208ZM2.30413 2.30408H13.8241V5.37608H1.53613V3.07208C1.53613 2.86839 1.61705 2.67305 1.76107 2.52902C1.9051 2.38499 2.10045 2.30408 2.30413 2.30408ZM11.5201 10.7521V12.2881H13.8241V10.7521H11.5201Z",fill:"black"})),e.createElement("span",{className:"lpc-balanceLabel"},d),p?e.createElement("img",{className:"lpc-coinIcon",src:p,alt:"Coin icon"}):null,e.createElement("span",{className:"lpc-balanceValue"},s," coins")):null,e.createElement("div",{className:D,ref:T},F.map(t=>{const n=z===t.id,o=`${v||0}px`,r=Boolean(t.productUrl);return e.createElement("article",{key:t.id,className:"lpc-card",style:{background:f,borderColor:h,borderRadius:o,cursor:r?"pointer":void 0},onClick:()=>{t.productUrl&&"undefined"!=typeof window&&(window.location.href=t.productUrl)}},e.createElement("div",{className:"lpc-imageWrap",style:{borderTopLeftRadius:o,borderTopRightRadius:o}},e.createElement("img",{className:"lpc-image",src:t.imageUrl,alt:t.title})),e.createElement("div",{className:"lpc-meta"},e.createElement("h3",{className:"lpc-title"},t.title),t.description?e.createElement("p",{className:"lpc-description"},t.description):null,e.createElement("div",{className:"lpc-priceRow"},Ju(t.mrp)?e.createElement(e.Fragment,null,e.createElement("span",{className:"lpc-priceMuted"},"MRP:"),e.createElement("span",{className:"lpc-priceStrikethrough"},Ju(t.mrp))):null,Ju(t.price)?e.createElement("span",{className:"lpc-priceNow"},Ju(t.price)):null,Ju(t.price)?e.createElement("span",{className:"lpc-pricePlus"},"+"):null,p?e.createElement("img",{className:"lpc-coinIcon",src:p,alt:"Coin icon"}):null,e.createElement("span",{className:"lpc-priceCoins"},t.coinsRequired," coins"))),e.createElement("button",{className:"lpc-cta",style:{background:y,color:b,borderColor:y,borderBottomLeftRadius:o,borderBottomRightRadius:o,boxShadow:"0 3px 0 rgba(0, 0, 0, 0.18)","--lpc-cta-shadow":"0 3px 0 rgba(0, 0, 0, 0.18)","--lpc-cta-shadow-active":"0 1px 0 rgba(0, 0, 0, 0.18)",opacity:t.disabled?.55:1},type:"button","aria-busy":n,disabled:Boolean(t.disabled)||null!==z,onClick:async e=>{if(e.stopPropagation(),t.onButtonClick&&!t.disabled&&null===z)try{I(t.id),await t.onButtonClick(t)}finally{I(null)}}},n?e.createElement(Zu,{size:18,color:"#fff",centered:!0}):t.buttonText||k))})),"scroll"===u?e.createElement("div",{className:"lpc-nav"},e.createElement("button",{className:"lpc-navBtn "+(S?"lpc-navBtn--enabled":""),type:"button",onClick:()=>P("left"),disabled:!S},e.createElement(dt,null)),e.createElement("button",{className:"lpc-navBtn "+(N?"lpc-navBtn--enabled":""),type:"button",onClick:()=>P("right"),disabled:!N},e.createElement(pt,null))):null)},tm=({config:t,brandConfig:n})=>{const{heroDesktopImage:o,heroMobileImage:r,heroTitle:i="ZERO WASTE PREMIUM PET CARE",heroSubtitle:a="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:s="#000000",heroSubtitleFontWeight:d="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:g="#1C1C1D",primaryContrastColor:x="#FFFFFF",secondaryColor:f="#FFFFFF",secondaryContrastColor:y="#000000",accentColor:b="#FFFFFF",borderColor:B="#E5E5E5",themeRoundness:z="0px",heroBannerVisibility:I="show",stepsVisibility:F="show",waysToEarnVisibility:P="show",waysToEarnCustomText:D="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",customSectionVisibility:A="show",footerSignupVisibility:_="show",customSectionImagePosition:R="left",customSectionTitle:O="Earn Doglycoins every time you shop",customSectionSubtitle:L="Collect more Doglycoins by entering your birthday, following us on social or referring a friend (details below)\n\nRedeem your Doglycoins for cash off at checkout by signing in or creating an account. Did you shop without registering? No worries, your Credits have been saved for you",customSectionTitleFontSize:M="36px",customSectionSubtitleFontSize:V="18px",customSectionImage:j,customSectionTextAlignment:W="left",customSectionTitleColor:H="#000000",customSectionSubtitleColor:q="#000000",stepsTitle:Q="Getting started is easy",stepsSubtitle:U="Earn Stars and get rewarded in a few easy steps.",step1Title:Y="CREATE AN ACCOUNT",step1Description:G="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:X="ORDER AND EARN REWARDS POINTS",step2Description:Z="Use cash, credit/debit card or save some time and pay right through the app. You'll collect Stars all ways.",step3Title:K="UNLOCK REWARDS AND OFFERS",step3Description:J="As you earn Stars, you can redeem them for Rewards—like free food, drinks, and more. Start redeeming with as little as 25 Stars!",footerCustomText:ee="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:te="Use your points to redeem samples and more."}=t||{},ne="undefined"!=typeof window&&window.innerWidth<=768,oe=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${g}`,transition:"all 0.3s ease"},ie={...re,backgroundColor:g,color:x,borderColor:g},ae={...re,backgroundColor:f,color:y,borderColor:B},{newSignupTokens:le,firstOrderTokens:ce,instagramFollowPoints:se,twitterFollowPoints:de,facebookFollowPoints:pe,youtubeSubscriptionPoints:ue,rewardToLeaveReview:me,birthdayPoints:ge,referralPointsForReferrer:xe,tokenCreditPercentage:fe,brandTokenName:ye}=n||{},be=[...le?[{icon:e.createElement(h,null),title:`${le} ${ye}`,subtitle:"Create an account"}]:[],...ce?[{icon:e.createElement(v,null),title:`${ce} ${ye}`,subtitle:"Place your first order"}]:[],...fe?[{icon:e.createElement(v,null),title:`${fe}% ${ye}`,subtitle:`Earn ${fe}% back on every order`}]:[],...xe?[{icon:e.createElement(w,null),title:`${xe} ${ye}`,subtitle:"Refer a friend and get"}]:[],...ge?[{icon:e.createElement(C,null),title:`${ge} ${ye}`,subtitle:"Get on your birthday to spend"}]:[],...me?[{icon:e.createElement(E,null),title:`${me} ${ye}`,subtitle:"Write a Review"}]:[],...pe?[{icon:e.createElement(k,null),title:`${pe} ${ye}`,subtitle:"Like on Facebook"}]:[],...se?[{icon:e.createElement(T,null),title:`${se} ${ye}`,subtitle:"Follow on Instagram"}]:[],...de?[{icon:e.createElement(S,null),title:`${de} ${ye}`,subtitle:"Follow on Twitter"}]:[],...ue?[{icon:e.createElement($,null),title:`${ue} ${ye}`,subtitle:"Subscribe on YouTube"}]:[]];return e.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===I&&e.createElement("div",{className:"yt-loyalty-page-hero",style:{position:"relative",minHeight:"500px",display:"flex",alignItems:"center",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start",backgroundImage:`url(${oe(ne&&r?r:o)})`,backgroundSize:"cover",backgroundPosition:"center",padding:ne?"40px 20px":"60px 80px"}},e.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},e.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:ne?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},i),e.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:s,fontWeight:Number(d)||400,marginBottom:"32px"}},a),m&&e.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},e.createElement("button",{className:"yt-loyalty-page-hero-button",style:ie,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===F&&e.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},e.createElement("div",{className:"yt-loyalty-page-steps-background-text",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"GETTING STARTED"),e.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},e.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},Q),e.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:g,marginBottom:"24px"}},U),e.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:e.createElement(v,null),title:Y,desc:G},{icon:e.createElement(N,null),title:X,desc:Z},{icon:e.createElement(C,null),title:K,desc:J}].map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{className:"yt-loyalty-page-step-icon",style:{width:"80px",height:"80px",borderRadius:"50%",border:"4px solid #ccc",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"32px",color:"#666",marginBottom:"12px"}},t.icon),e.createElement("div",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,color:g,textTransform:"uppercase",lineHeight:"normal"}},t.title),e.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:g,lineHeight:1.2,maxWidth:"300px"}},t.desc)))))),"show"===P&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-background-text",style:{position:"absolute",top:ne?"10%":"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"WAYS TO EARN"),e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"12px"}},be.map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{width:ne?"100%":"220px",border:"2px solid #ddd",padding:"12px 8px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:z,boxShadow:"-1px 2px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"4px",color:"#1a1a2e"}},t.icon),e.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"13px",fontWeight:700,marginBottom:"2px",textTransform:"uppercase",color:"#000"}},t.title),e.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"11px",color:"#666"}},t.subtitle)))),D&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-custom-text",style:{maxWidth:"1000px",margin:"24px auto 0",backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},D)),"show"===A&&e.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:ne?"40px 0px":"40px 20px",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:ne?"column":"row",alignItems:"center",gap:"40px",borderRadius:z,overflow:"hidden",backgroundColor:"#F9F9F9"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:ne||"left"===R?0:1}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:j?`url(${oe(j)})`:o?`url(${oe(o)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),e.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:ne?"20px":"10px",textAlign:ne?"center":W,order:ne||"left"===R?1:0,marginBottom:ne?"20px":"0px"}},e.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:M,fontWeight:700,marginBottom:"16px",color:H}},O),e.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:V,color:q,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},L)))),"show"===_&&e.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},e.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},e.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},ee),e.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:ne?"center":"left"}},e.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},e.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000",textAlign:ne?"center":"left"}},"Rewards Program"),e.createElement("p",{style:{fontSize:"14px",color:"#666"}},te)),e.createElement("button",{className:"yt-loyalty-page-footer-signup-button",style:ae,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"JOIN NOW")))))},nm=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:i},e.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"16px",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},lm(o)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},am(o)),e.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},o.name),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"16px",padding:"12px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"clamp(16px, 4vw, 18px)",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"20px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(B,null):e.createElement(z,null))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),e.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},e.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),e.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return A(p,document.body)},om=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:i},e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),e.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),e.createElement("div",{style:{overflowY:"auto",flex:1}},e.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},e.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},lm(o)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},am(o)),e.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},o.name),e.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"20px",padding:"14px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"18px",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"22px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(B,null):e.createElement(z,null)))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),e.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},e.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t)))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return A(p,document.body)},rm=({offersToShow:o,offersConfig:i,getOfferCardMessage:a,setSelectedOffer:l,setShowPopup:c})=>{const s=r(null),[d,p]=t(!1),[u,m]=t(!0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=768),f=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};n(()=>{f();const e=s.current;if(e)return e.addEventListener("scroll",f),()=>e.removeEventListener("scroll",f)},[o]),n(()=>{const e=()=>{x(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const y=e=>{if(s.current){const t=g?280:365,n=16,o="right"===e?t+n:-(t+n);s.current.scrollBy({left:o,behavior:"smooth"})}};return e.createElement("div",{style:{position:"relative"}},e.createElement("svg",{style:{position:"absolute",width:0,height:0}},e.createElement("defs",null,e.createElement("mask",{id:"coupon-cut-mask-desktop"},e.createElement("rect",{width:"365",height:"138",fill:"white"}),e.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),e.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),e.createElement("mask",{id:"coupon-cut-mask-mobile"},e.createElement("rect",{width:"280",height:"120",fill:"white"}),e.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),e.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&e.createElement("button",{onClick:()=>y("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(I,{size:20})),u&&e.createElement("button",{onClick:()=>y("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(F,{size:20})),e.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:g?"110px":"128px"}},o?.map(t=>e.createElement("div",{key:t.discountId,style:{flexShrink:0,width:g?"280px":"365px",minWidth:g?"280px":"365px",minHeight:g?"110px":"128px",backgroundColor:"transparent",borderRadius:`${i?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},e.createElement("div",{style:{width:g?"60px":"80px",minHeight:g?"110px":"128px",backgroundColor:i?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:g?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${i?.roundness||0}px`,borderBottomLeftRadius:`${i?.roundness||0}px`}},e.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),i?.iconVisibility&&e.createElement("div",{style:{position:"absolute",left:g?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:g?"32px":"40px",height:g?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},lm(t)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{flex:1,padding:g?"12px 12px":"15px 15px",paddingLeft:g?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${i?.roundness||0}px`,borderBottomRightRadius:`${i?.roundness||0}px`,overflow:"hidden",backgroundColor:i?.cardBackgroundColor||"#ffffff",minWidth:0}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:g?"4px":"6px",lineHeight:"normal"}},e.createElement("div",{style:{fontSize:g?"9px":"10px",color:"#666666",fontWeight:"400"}},am(t)),e.createElement("div",{style:{fontSize:g?"13px":"15px",fontWeight:"600",color:i?.textColor||"#2c3e50"}},t.name),e.createElement("div",{style:{fontSize:g?"11px":"12px",color:i?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:g?"28px":"32px"}},a(t))),e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),l(t),c(!0)},style:{fontSize:g?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},i?.viewDetailsTitle||"View Details")))))),e.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},im=({offersToShow:o,offersConfig:r,getOfferCardMessage:i,setSelectedOffer:a,setShowPopup:l})=>{const[c,s]=t("undefined"!=typeof window&&window.innerWidth<=768);return n(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.createElement("div",{style:{borderRadius:`${r?.roundness||8}px`}},o?.map((t,n)=>e.createElement("div",{key:t.discountId,style:{display:"flex",alignItems:"flex-start",gap:c?"8px":"12px",padding:c?"12px 0":"16px 0",paddingLeft:c?"10px":"20px",backgroundColor:!0===r?.cardBackgroundTransparent||"true"===String(r?.cardBackgroundTransparent)?"transparent":r?.cardBackgroundColor||"#ffffff",borderBottom:n<(o?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${r?.roundness||0}px`}},r?.iconVisibility&&e.createElement("div",{style:{width:c?"40px":"50px",height:c?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:c?"20px":"25px",marginTop:c?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},lm(t)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:c?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},am(t),":"," ",e.createElement("span",{style:{fontWeight:600,color:r?.textColor||"#34495e"}},t.name)),e.createElement("div",{style:{fontSize:c?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},i(t)),e.createElement("div",{style:{fontSize:c?"11px":"12px",color:"#000000"}},"offer auto applied",e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),a(t),l(!0)},style:{color:r?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},r?.viewDetailsTitle||"T&C"))))))},am=e=>"free_product"===e.couponType?"deal_amount"===e.freebieType?"Deal":"percentage_off"===e.freebieType?"% Off":"Free Gift":e._customOffer?.code?"Coupon":"Special Deal",lm=e=>"free_product"===e.couponType&&"deal_amount"!==e.freebieType&&"percentage_off"!==e.freebieType,cm=({offersConfig:o,offers:i})=>{const[a,l]=t(!1),[c,s]=t(null),[d,p]=t(null),[u,m]=t("undefined"!=typeof window&&window.innerWidth<=768),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=450),f=r(null);n(()=>{const e=()=>{m(window.innerWidth<=768),x(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{f.current&&xn(f.current)},[o?.sectionBgContrastColor]);const y=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",o=-1;Object.keys(t).forEach(e=>{t[e]>o&&(o=t[e],n=e)});const r=e.map((e,t)=>({o:e,idx:t})),i=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return r.sort((e,t)=>{const o=e.o.customCartProgressBarCriteria===n,r=t.o.customCartProgressBarCriteria===n;if(o&&r){const n=i(e.o),o=i(t.o);return n!==o?n-o:e.idx-t.idx}return o&&!r?-1:!o&&r?1:e.idx-t.idx}),r.map(e=>e.o)})((!1===o?.showBackendOffers&&o?.customOffers&&o.customOffers.length>0?o.customOffers.map((e,t)=>{return{discountId:-(t+1),name:(n=e).title,couponType:n.code?"discount_code":"special_deal",customCartProgressBarCriteria:null,discountPercentage:null,couponTemplateId:0,minimumOrderValue:0,quantityThreshold:0,_allVariantIds:[],description:n.description,_customOffer:n};var n}):i)||[]),b=e=>{if(s(e),e){const t=e._customOffer;p(t?(e=>({offerMessage:e.description||"Special offer available",terms:e.terms?e.terms.split("\n").filter(e=>""!==e.trim()):[]}))(t):(e=>{const t="free_product"===e.couponType;let n="";if(t){const t="deal_amount"===e.freebieType?`at ${e.discountValue}`:"percentage_off"===e.freebieType?`at ${e.discountPercentage}% off`:"free"===e.freebieType?"for free!":"";t&&(n=`Get the product ${t}`)}else e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const o=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?o.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&o.push(`Unlock at order value of ${e.minimumOrderValue}`),t||o.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:o}})(e))}},h=e=>{const t=e._customOffer;return t?t.description||"Special offer available":(e=>"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?`add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to unlock`:"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue?`unlocks on orders above ${e.minimumOrderValue}`:"Special offer available")(e)};return e.createElement("div",null,e.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===o?.sectionType?`${o?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:o?.sectionBackgroundColor||"#fff"}},e.createElement("div",{style:{border:"coupon"===o?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=o?.cardPadding?`${o.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===o?.sectionType?`${o?.roundness||8}px`:"0px"}},e.createElement("span",{ref:f,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"right"===o?.alignment?"auto":"50%",right:"right"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===o?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:o?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},o?.sectionTitle||"Available Deals and Offers"),(()=>{const t=o?.sectionType;return"list"===t?e.createElement(im,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):"coupon"===t?e.createElement(rm,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):null})(),g?e.createElement(om,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}):e.createElement(nm,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}))))};export{ru as Bundle,Xu as BundleLoader,Gu as Cart,tm as LoyaltyPageBlock,em as LoyaltyProductCatalog,Wt as Nudge,cm as ProductOffers,Xt as SpinnerWheel};
5308
+ `,Uu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=le(rn),w=ce(Zt),C=r(null),[E,k]=t(null),[T,S]=t(!1),[$,N]=t({}),[B,z]=t(h?.variantId),[I,F]=t(h?.quantity||1),[P,D]=t(!1),A=sr();n(()=>{h?.open?setTimeout(()=>{D(!0)},10):D(!1)},[h?.open]);n(()=>{(async()=>{if(!E&&l&&h?.variantId&&h?.handle){const e=await l(h.handle,h.variantId);if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){z(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),N(n)}else z(void 0),N({})}k(e)}})()},[E,l,h]);const _=(e,t)=>{const n={...$,[e]:t};N(n);const o=E?.variants?.find(e=>E.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&z(String(o.id))}},R=E?.variants?.find(e=>String(e.id)===String(B)),O=cn(w,w?.currency),L=o(()=>{const e={};if(!E)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return E.options.forEach(n=>{e[n.name]=n.values.filter(e=>E.variants.filter(o=>{const r=E.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!E.options.every((e,t)=>{if(e.name===n.name)return!0;const r=$[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[E,$,h]);return E?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:P?1:0,transition:"opacity 0.3s ease"},onClick:()=>{D(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(Tu,{ref:b,className:"yt-variant-selection-popup"},e.createElement($u,{ref:C,style:{backgroundColor:p||"white",opacity:P?1:0,transform:P?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Su,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Bu,null,e.createElement(zu,null,e.createElement(Iu,null,e.createElement(Fu,{src:R?.featured_image?.src??E?.featured_image,alt:R?.featured_image?.alt??E?.title})),e.createElement(Pu,null,e.createElement(Du,{$themeColor:c,$primaryTextColor:y,href:`${E?.url}?variant=${R?.id}`},E?.title),e.createElement(Hu,null,e.createElement(Au,null,e.createElement(_u,{$primaryTextColor:y},O,an(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(Ru,null,O,an(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(nr,{value:I,handleItemQuantityIncrement:async()=>{F(e=>e+1)},handleItemQuantityDecrement:async()=>{I>1&&F(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),E?.options?.map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(Lu,{key:t.name},e.createElement(Vu,null,e.createElement("span",null,"Select ",t.name),$[t.name]&&e.createElement(ju,null,$[t.name])),e.createElement(Wu,null,L[t.name]?.map(o=>{const r=$[t.name]===o,i=cr(n,o);return"color"===n?.type&&i?.value?e.createElement(qu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(Qu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(Mu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(Ou,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(B&&a){S(!0);try{await a(B,I,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}S(!1)}}:async()=>{if(!B)return;const e=!!h?.lineItemKey,t=String(B)!==String(h?.variantId);if(!e||t){S(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(B,h.allowedVariantIds):e&&m?await m(B,h.allowedVariantIds):a&&B&&await a(B,I,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}S(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!B||T},T?e.createElement(ge,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(Tu,{ref:b},e.createElement($u,{style:{backgroundColor:p||"white"}},e.createElement(Nu,null,e.createElement(xe,{color:c||"#868E96"}))))});Uu.displayName="DesktopVariantPopup";const Yu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=le(rn),w=ce(Zt),[C,E]=t(null),[k,T]=t(!1),[S,$]=t({}),[N,B]=t(h?.variantId),[z,I]=t(h?.quantity||1),F=r(null),P=sr(),[D,A]=t(!1);n(()=>{h?.open?setTimeout(()=>{A(!0)},10):A(!1)},[h?.open]);n(()=>{(async()=>{if(!C&&l&&h?.variantId&&h?.handle)try{const e=await l(h.handle,h.variantId);if(!e)return;if(!e.variants||!Array.isArray(e.variants))return;if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){B(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),$(n)}else B(void 0),$({})}E(e)}catch(e){}})()},[C,l,h]),n(()=>{},[p,i,a,l]);const _=(e,t)=>{const n={...S,[e]:t};$(n);const o=C?.variants?.find(e=>C.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&B(String(o.id))}},R=C?.variants?.find(e=>String(e.id)===String(N)),O=cn(w,w?.currency),L=o(()=>{const e={};if(!C)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return C.options.forEach(n=>{e[n.name]=n.values.filter(e=>C.variants.filter(o=>{const r=C.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!C.options.every((e,t)=>{if(e.name===n.name)return!0;const r=S[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[C,S,h]);return C?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:D?1:0,transition:"opacity 0.3s ease"},onClick:()=>{A(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(Tu,{ref:b,className:"yt-variant-selection-popup"},e.createElement($u,{ref:F,style:{backgroundColor:p||"white",opacity:D?1:0,transform:D?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Su,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Bu,null,e.createElement(zu,null,e.createElement(Iu,null,e.createElement(Fu,{src:R?.featured_image?.src??C?.featured_image,alt:R?.featured_image?.alt??C?.title})),e.createElement(Pu,null,e.createElement(Du,{$themeColor:c,$primaryTextColor:y,href:`${C?.url}?variant=${R?.id}`},C?.title),e.createElement(Hu,null,e.createElement(Au,null,e.createElement(_u,{$primaryTextColor:y},O,an(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(Ru,null,O,an(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(nr,{value:z,handleItemQuantityIncrement:async()=>{I(e=>e+1)},handleItemQuantityDecrement:async()=>{z>1&&I(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),C?.options?.map(t=>{const n=P?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(Lu,{key:t.name},e.createElement(Vu,null,e.createElement("span",null,"Select ",t.name,":"),S[t.name]&&e.createElement(ju,null,S[t.name])),e.createElement(Wu,null,L[t.name]?.map(o=>{const r=S[t.name]===o,i=cr(n,o);return"color"===n?.type&&i?.value?e.createElement(qu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(Qu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(Mu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(Ou,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(N&&a){T(!0);try{await a(N,z,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}T(!1)}}:async()=>{if(!N)return;const e=!!h?.lineItemKey,t=String(N)!==String(h?.variantId);if(!e||t){T(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(N,h.allowedVariantIds):e&&m?await m(N,h.allowedVariantIds):a&&N&&await a(N,z,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}T(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!N||k},k?e.createElement(ge,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(Tu,{ref:b},e.createElement($u,{style:{backgroundColor:p||"white"}},e.createElement(Nu,null,e.createElement(xe,{color:c||"#868E96"}))))});const Gu=({setIsCartOpen:t,isCartOpen:n,cartCheckpoints:o,customCartProgressBarCriteria:r,floatingCartData:i,effectiveQuantityForProgressBar:a,cartComponentsCornerType:l,cartComponentsCornerRadius:c})=>{const s=ce(Zt),d=i?.bannerFooterText,p="string"==typeof d&&d.trim().length>0,u=!n&&(e=>{try{if("undefined"==typeof window)return!1;const t=window.location.pathname||"/";if("/"===t||""===t)return!0;const n=e?.showOnPages;if(!Array.isArray(n)||0===n.length)return!1;const o=t.toLowerCase(),r=o.endsWith("/")?o:`${o}/`;return n.some(e=>{if(!e||"string"!=typeof e)return!1;const t=e.trim().toLowerCase().replace(/^\/|\/$/g,"");if(!t)return!1;const n=`/${t}/`;return r.includes(n)})}catch{return!1}})(i),m=s?.item_count??0,g=an(s?.items_subtotal_price??0,s?.currency??"INR"),x=cn(s),f=function(e,t,n,o,r){if(!e||0===e.length)return{deltaValue:0,show:!1};const i=(t??"minimum_order_value").toLowerCase(),a="quantity_threshold"===i?"number"==typeof r?r:o:n,l=[...e].sort((e,t)=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)-("quantity_threshold"===i?t.quantityThreshold:t.minimumOrderValue)).find(e=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)>a);if(!l)return{deltaValue:0,show:!1};const c="quantity_threshold"===i?l.quantityThreshold:l.minimumOrderValue,s=Math.max(0,c-a);return{deltaValue:s,show:s>0,isQuantity:"quantity_threshold"===i}}(o,r,g,m,a),y="sharp"===l?0:c??12,h=i?.textColor??"#111",v=i?.backgroundColor??"#FF7E6E",w=i?.bannerBackgroundColor??"#FFE0DC",C=i?.buttonColor??"#E8513F",E=e.useRef(null);e.useEffect(()=>{xn(E.current)},[C]);const k={position:"fixed",width:"100%",bottom:0,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"},T={background:"#FFFFFF",color:"#111",padding:"5px",fontSize:12,fontFamily:"Poppins",fontWeight:600,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",gap:8},S={background:"#fff",color:h,borderRadius:y,boxShadow:"0 10px 24px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:"Poppins"},$={position:"absolute",top:0,left:"50%",transform:"translate(-50%, -70%)",backgroundColor:w,color:h,padding:8,fontSize:12,lineHeight:"normal",borderTopLeftRadius:13,borderTopRightRadius:13,width:"97%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,zIndex:-1},N={display:"flex",alignItems:"center",gap:12,padding:"10px 12px",backgroundColor:v,cursor:"pointer"},B={display:"flex",alignItems:"center",gap:8,fontWeight:700,fontSize:16,color:h},z={fontSize:12,color:h,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},I={padding:"5px 10px",background:C,color:"#fff",borderRadius:8,fontSize:15,fontWeight:700,border:"none",outline:"none",flexShrink:0};if(!u)return null;if(0===m){if(!f.show)return null;const t=f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${fn(f.deltaValue.toFixed(0))} to get freebie`;return e.createElement("div",{style:k},e.createElement("div",{className:"yt-cart-floating-ribbon",style:T},e.createElement(b,{"aria-hidden":!0}),e.createElement("span",null,t)))}const F=1===m?"1 item":`${m} items`,P=i?.lastTierUnlockedText||"Best tier unlocked",D=f.show?f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${fn(f.deltaValue.toFixed(0))} more to get freebie`:P;return e.createElement("div",{style:{position:"fixed",left:12,right:12,bottom:12,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"}},e.createElement("div",{style:{position:"relative"}},(f.show||o&&o.length>0)&&e.createElement("div",{className:"yt-cart-floating-banner",style:$},e.createElement(b,{"aria-hidden":!0,style:{marginBottom:7}}),e.createElement("span",{style:{display:"inline-block",marginBottom:7}},D)),e.createElement("div",{style:S},e.createElement("div",{className:"yt-cart-floating-body",style:N,onClick:()=>t(!0)},e.createElement(_,{width:24,height:24,color:h}),e.createElement("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,lineHeight:"normal"}},e.createElement("div",{style:B},e.createElement("span",null,x,fn(g.toFixed(0))),e.createElement("span",{style:{fontSize:9,fontWeight:600,color:"#fff",backgroundColor:"#828282",marginBottom:5,paddingInline:5}},F)),p?e.createElement("span",{style:z,title:d},d):null),e.createElement("button",{ref:E,style:I,onClick:()=>t(!0),"aria-label":"View Cart"},"View Cart")))))},Xu=({exploreCTAColor:o,checkoutFontSize:i,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,cartTitle:p,emptyCartTitle:u,emptyCartDescription:m,emptyCartButtons:g,backgroundColor:x,backgroundSubdued:f,tertiaryColor:y,tertiaryTextColor:b,backdrop:h=!0,cartData:v,isUserSignedIn:w,showBundle:C,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:N,removeDiscount:B,applyDiscount:z,discountApplied:I,checkoutFunction:F,joinNowFunction:P,guestLoyaltyPercentage:D,showToggleButton:A,isOpen:_,setIsOpen:R,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K,checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ie,showProductRecsOnDesktop:ae,showProductRecsOnMobile:ce,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,showNoteOption:Ee,applyNoteToCart:ke,note:Te,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Ne,showEditOptionOnProducts:Be,getProductDetailsByVariantId:ze,onSetLoading:Ie,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:Pe,currentTier:De,freebieProductsInCart:Ae,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,showStickyAddToCart:Ge,stickyCartLineItem:Xe,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,enableCustomCartOnCartPage:rt,isCartPage:it,progressBarFreeProductIconType:at,addToStickyCart:lt,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,showFloatingCart:ut,floatingCartData:mt,freebieMilestoneData:gt,cartTimerInMinutes:xt,cartTimerCustomText:ft,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,stickyCartCustomizationData:vt,cartOffersCarousalData:wt,stickyBarBuyNowFunction:Ct,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Nt,loyaltyDiscount:Bt,brandTokenName:zt,showDiscountOnMRP:It,prefixMessageText:Ft,suffixMessageText:Pt,successMessageText:Dt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht=!0,showCouponOptions:qt,rewardCoupons:Qt,couponSelectionData:Ut,comboBundleData:Yt,comboBundleAddToCartFunction:Gt,stealDealCheckpoints:Xt,stealDealProducts:Kt,stealDealAddToCart:Jt,useCartShell:en,showTrustedBadge:tn,trustedBadgeData:nn,drawerLayoutData:on})=>{const an=se(Zt),[ln,cn]=le(rn),[sn,dn]=le(ma),pn=()=>R(!_),[un,mn]=t(()=>{const e=window.ytComboBundle;return{comboBundleData:e?.bundle??null,comboBundleAddToCartFunction:e?.addToCart??null}});n(()=>{const e=e=>{const t=e.detail;mn({comboBundleData:t?.bundle??null,comboBundleAddToCartFunction:t?.addToCart??null})};return window.addEventListener("yt-combo-bundle-updated",e),()=>window.removeEventListener("yt-combo-bundle-updated",e)},[]);const gn=un.comboBundleData??Yt,xn=un.comboBundleAddToCartFunction??Gt,[fn,yn]=t(()=>{const e=window.ytVolumeBundle;return{bundle:e?.bundle??void 0,currentTier:e?.currentTier??void 0,volumeBundleAddToCartFunction:e?.addToCart??void 0}});n(()=>{const e=e=>{const t=e.detail;yn({bundle:t?.bundle??void 0,currentTier:t?.tierData??void 0,volumeBundleAddToCartFunction:t?.addToCart??void 0})};return window.addEventListener("yt-volume-bundle-updated",e),()=>window.removeEventListener("yt-volume-bundle-updated",e)},[]);const bn=r(null),hn=r(0);a(()=>{if(v){const e=v?.token??null,t="number"==typeof v?.cartUpdatedAtMs?v.cartUpdatedAtMs:void 0;e!==bn.current&&(bn.current=e,hn.current=t??0);const n=hn.current;if(!(void 0===t||t>=n))return;void 0!==t&&(hn.current=t),an(v)}},[v]);const vn=r(null);n(()=>{function e(e){vn.current&&!vn.current.contains(e.target)&&(cn({open:!1,variantId:void 0,quantity:void 0,handle:void 0}),dn({isOpen:!1}))}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const[wn,Cn]=t(!1);return n(()=>{const e=()=>{Cn(window.innerWidth>=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{if(!en)return;const e=window.ytCartShell;if(!e)return;const t=e.getDrawerElement?.(),n=e.getOverlayElement?.();t&&(!_||rt&&it?(t.style.setProperty("transform","translateX(100%)","important"),t.style.boxShadow="none",n&&(n.style.display="none"),document.body.classList.remove("drawer-open")):(t.style.setProperty("transform","translateX(0)","important"),t.style.boxShadow="-14px 8px 14.4px 0px rgba(0, 0, 0, 0.35)",h&&n&&(n.style.display="block"),document.body.classList.add("drawer-open")))},[_,en,rt,it,h]),n(()=>{if(!en)return;const e=window.ytCartShell,t=e?.getOverlayElement?.();if(!t)return;const n=()=>R(!1);return t.addEventListener("click",n),()=>t.removeEventListener("click",n)},[en,R]),e.createElement(e.Fragment,null,e.createElement("div",{style:{position:rt&&it?"relative":"absolute",width:"100%",display:rt&&it?"flex":"block",alignItems:"center",justifyContent:"center"}},A&&!(rt&&it)&&e.createElement("button",{style:{margin:"16px"},onClick:pn},_?"Close Drawer":"Open Drawer"),!en&&_&&h&&!(rt&&it)&&e.createElement("div",{onClick:pn,id:"custom-cart-yt-overlay",style:{position:"fixed",top:0,right:0,zIndex:1e4,transform:"translateX(0)",backgroundColor:"rgba(0,0,0,0.5)",inset:0,height:"100%",width:"100%"}},"‎"),e.createElement(ac,{useCartShell:en,isCartPage:it,enableCustomCartOnCartPage:rt,isOpen:_,setIsOpen:R,backgroundColor:x,backgroundSubdued:f??"#F5F5F5",tertiaryColor:y,tertiaryTextColor:b,exploreCTAColor:o,checkoutFontSize:i,cartTitle:p,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,emptyCartTitle:u,emptyCartButtons:g,emptyCartDescription:m,showBundle:C,isUserSignedIn:w,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:N,removeDiscount:B,applyDiscount:z,discountApplied:I,checkoutFunction:F,joinNowFunction:P,guestLoyaltyPercentage:D,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K??"minimum_order_value",checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ie,showProductRecsOnDesktop:ae,showProductRecsOnMobile:ce,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,applyNoteToCart:ke,note:Te,showNoteOption:Ee,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Ne,showEditOptionOnProducts:Be,onSetLoading:Ie,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:Pe,currentTier:De,freebieProductsInCart:Ae,cartOffersCarousalData:wt,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,progressBarFreeProductIconType:at,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,freebieMilestoneData:gt,cartTimerCustomText:ft,cartTimerInMinutes:xt,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Nt,loyaltyDiscount:Bt,getProductDetailsByVariantId:ze,brandTokenName:zt,showDiscountOnMRP:It??!0,prefixMessageText:Ft,suffixMessageText:Pt,successMessageText:Dt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht,stealDealCheckpoints:Xt,stealDealProducts:Kt,stealDealAddToCart:Jt,showCouponOptions:qt,rewardCoupons:Qt,couponSelectionData:Ut,showTrustedBadge:tn,trustedBadgeData:nn,drawerLayoutData:on}),Ge&&Xe&&d&&e.createElement(ku,{showStickyCart:Ge,stickyCartCustomizationData:vt,product:Xe,addCartItem:d,onSetLoading:Ie,themeColor:de,themeTextColor:pe,cartData:v,isCartOpen:_,setIsCartOpen:R,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,addToStickyCart:lt,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,checkoutFunction:Ct,backgroundColor:x,primaryTextColor:ne,comboBundleData:gn,comboBundleAddToCartFunction:xn,volumeBundleCurrentTier:fn.currentTier,volumeBundleData:fn.bundle,volumeBundleAddToCartFunction:fn.volumeBundleAddToCartFunction}),wn&&ln.open&&e.createElement(Uu,{backgroundColor:x,ref:vn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:ze,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Jt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne}),!wn&&ln.open&&e.createElement(Yu,{ref:vn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:ze,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,backgroundColor:x,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Jt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne})),!wn&&ut&&e.createElement(Gu,{isCartOpen:_,setIsCartOpen:R,cartCheckpoints:j,customCartProgressBarCriteria:K,floatingCartData:mt,effectiveQuantityForProgressBar:Le,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt}))};bt(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Zu=()=>e.createElement("div",{className:"scene"},e.createElement("div",{className:"floating"},e.createElement("div",{className:"cube"},e.createElement("div",{className:"side front"},"‎"),e.createElement("div",{className:"side back"},"‎"),e.createElement("div",{className:"side left"},"‎"),e.createElement("div",{className:"side right"},"‎"),e.createElement("div",{className:"side bottom"},"‎"),e.createElement("div",{className:"lid"},e.createElement("div",{className:"flap north"},"‎"),e.createElement("div",{className:"flap south"},"‎"),e.createElement("div",{className:"flap east"},"‎"),e.createElement("div",{className:"flap west"},"‎")))));bt("\n@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Urbanist:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n@font-face {\n font-family: 'Circular Std';\n src: local('Circular Std Book'), local('Circular Std');\n font-weight: 400;\n font-style: normal;\n font-display: swap;\n}\n@font-face {\n font-family: 'Circular Std';\n src: local('Circular Std Medium'), local('Circular Std');\n font-weight: 500;\n font-style: normal;\n font-display: swap;\n}\n@font-face {\n font-family: 'Circular Std';\n src: local('Circular Std Bold'), local('Circular Std');\n font-weight: 700;\n font-style: normal;\n font-display: swap;\n}\n\n\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Regular.ttf') format('truetype');\n font-weight: 400;\n font-style: normal;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Bold.ttf') format('truetype');\n font-weight: 700;\n font-style: normal;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Light.ttf') format('truetype');\n font-weight: 300;\n font-style: normal;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-Italic.ttf') format('truetype');\n font-weight: 400;\n font-style: italic;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-BoldItalic.ttf') format('truetype');\n font-weight: 700;\n font-style: italic;\n}\n@font-face {\n font-family: 'Sansation';\n src: url('/public/fonts/sansation/Sansation-LightItalic.ttf') format('truetype');\n font-weight: 300;\n font-style: italic;\n}\n\n\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-Regular.otf') format('opentype');\n font-weight: 400;\n font-style: normal;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-RegularOblique.otf') format('opentype');\n font-weight: 400;\n font-style: oblique;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-RegularSlanted.otf') format('opentype');\n font-weight: 400;\n font-style: italic;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-Ultralight.otf') format('opentype');\n font-weight: 200;\n font-style: normal;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltralightOblique.otf') format('opentype');\n font-weight: 200;\n font-style: oblique;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltralightSlanted.otf') format('opentype');\n font-weight: 200;\n font-style: italic;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-Ultrabold.otf') format('opentype');\n font-weight: 800;\n font-style: normal;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltraboldOblique.otf') format('opentype');\n font-weight: 800;\n font-style: oblique;\n}\n@font-face {\n font-family: 'PP Telegraf';\n src: url('/public/fonts/pp-telegraf/PPTelegraf-UltraboldSlanted.otf') format('opentype');\n font-weight: 800;\n font-style: italic;\n}\n\n:root {\n --font-primary: 'Poppins', sans-serif;\n --font-secondary: 'Urbanist', sans-serif;\n --font-tertiary: 'Inter', sans-serif;\n --font-alt: 'Sansation', sans-serif;\n --font-brand: 'PP Telegraf', sans-serif;\n}\n");bt('.lpc-root {\n width: 100%;\n background: #ffffff;\n overflow: hidden;\n font-family: var(--font-primary, "Poppins", sans-serif);\n}\n\n.lpc-header {\n background: #ffffff;\n padding: 56px 16px 28px;\n}\n\n.lpc-banner {\n max-width: 100%;\n height: auto;\n display: block;\n margin: 0 auto 20px;\n}\n\n.lpc-align-left {\n text-align: left;\n}\n\n.lpc-align-center {\n text-align: center;\n}\n\n.lpc-align-right {\n text-align: right;\n}\n\n.lpc-heading {\n margin: 0px;\n color: rgba(0, 0, 0, 0.87);\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 32px;\nfont-style: normal;\nfont-weight: 600;\nline-height: 38.78px; /* 121.187% */\nletter-spacing: -0.16px;\n}\n\n.lpc-subheading {\n margin-top: 12px;\n color: #292C77;\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 16px;\nfont-style: normal;\nfont-weight: 400;\nline-height: 112%; /* 17.92px */\n}\n\n.lpc-sectionTitle {\n margin: 10px 0 0;\n color: #636381;\n font-size: 14px;\n line-height: 1.4;\n}\n\n.lpc-tierBar {\n width: 100%;\n}\n\n.lpc-tierRow {\n max-width: 1200px;\n margin: 0 auto;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0;\n}\n\n.lpc-tierButton {\n border: 0;\n outline: none;\n appearance: none;\n cursor: pointer;\n min-width: 108px;\n padding: 20px 18px;\n color: rgba(0, 0, 0, 0.87);\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 24px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 36px; /* 150% */\n border-bottom: 4px solid transparent;\n transition: background-color 0.2s ease, border-color 0.2s ease;\n}\n\n.lpc-balanceBar {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n margin: 20px 60px 8px;\n padding: 10px 14px;\n background: #d9e4eb;\n}\n\n.lpc-balanceLabel {\n color: #000;\nfont-family: Poppins;\nfont-size: 18px;\nfont-style: normal;\nfont-weight: 500;\nline-height: 31.9px; \n}\n\n.lpc-balanceValue {\n color: #000;\ntext-align: center;\nfont-family: Poppins;\nfont-size: 18px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 31.9px; \n}\n\n.lpc-cardList {\n margin: 0;\n padding: 20px 60px 50px;\n gap: 36px;\n}\n\n.lpc-cardList--scroll {\n display: flex;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-behavior: smooth;\n}\n\n.lpc-cardList--scroll::-webkit-scrollbar {\n height: 0;\n}\n\n.lpc-cardList--grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));\n}\n\n.lpc-cardList--wrap {\n display: flex;\n flex-wrap: wrap;\n}\n\n.lpc-card {\n flex: 0 0 360px;\n min-height: 430px;\n border: 1px solid;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n\n.lpc-cardList--grid .lpc-card {\n flex: unset;\n}\n\n.lpc-cardList--wrap .lpc-card {\n flex: 0 0 360px;\n}\n\n.lpc-imageWrap {\n width: 100%;\n aspect-ratio: 1 / 1;\n background: #ffffff;\n overflow: hidden;\n}\n\n.lpc-image {\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center;\n display: block;\n}\n\n.lpc-meta {\n padding: 14px 10px 12px;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n}\n\n.lpc-coins {\n color: #A5A5A5;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 11px;\nfont-style: normal;\nfont-weight: 600;\nline-height: 110%; /* 12.1px */\nletter-spacing: 0.109px;\npadding: 3px 0px;\n}\n\n.lpc-title {\n overflow: hidden;\ncolor: var(--Text-color, #252B42);\ntext-overflow: ellipsis;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 16px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 120%;\nletter-spacing: 0.109px;\ndisplay: -webkit-box;\n-webkit-line-clamp: 2;\n-webkit-box-orient: vertical;\n min-height: 40px;\n margin: 0;\n}\n\n.lpc-description {\n margin: 6px 0 0;\n color: #E4A8BD;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 112%;\n}\n\n.lpc-ratingRow {\n padding: 5px 0px;\n display: flex;\n align-items: center;\n gap: 6px;\n color: #4b4d60;\n font-size: 16px;\n line-height: 1.2;\n}\n\n.lpc-star {\n color: #f6a623;\n font-size: 14px;\n}\n\n.lpc-ratingText {\n color: #3A3A3A;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 11px;\nfont-style: normal;\nfont-weight: 400;\nline-height: 150%; /* 16.5px */\n}\n\n.lpc-priceRow {\n margin-top: auto;\n padding: 10px 0 5px;\n display: flex;\n align-items: center;\n gap: 8px;\n color: #1f1f1f;\n}\n\n.lpc-priceMuted {\n color: #767676;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-priceStrikethrough {\n color: #767676;\n text-decoration: line-through;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-priceNow {\n color: #111111;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-pricePlus {\n color: #111111;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 120%;\n}\n\n.lpc-priceCoins {\n color: #111111;\n font-family: var(--font-primary, "Poppins", sans-serif);\n font-size: 14px;\n font-style: normal;\n font-weight: 700;\n line-height: 120%;\n}\n\n.lpc-coinIcon {\n width: 14px;\n height: 14px;\n object-fit: contain;\n display: inline-block;\n}\n\n.lpc-cta {\n margin-top: 8px;\n border: 1px solid transparent;\n outline: none;\n width: 100%;\n padding: 12px 14px;\n cursor: pointer;\n background: #DC8EAB;\n color: var(--Theme-Text-Color, #FFF);\ntext-align: center;\nfont-family: var(--font-primary, "Poppins", sans-serif);\nfont-size: 14px;\nfont-style: normal;\nfont-weight: 700;\nline-height: 180%; /* 25.2px */\n/* text-transform: uppercase; */\n box-shadow: var(--lpc-cta-shadow);\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n}\n\n.lpc-cta:hover:not(:disabled) {\n transform: translateY(-1px);\n}\n\n.lpc-cta:active:not(:disabled) {\n transform: translateY(1px);\n box-shadow: var(--lpc-cta-shadow-active);\n}\n\n.lpc-cta:disabled {\n cursor: not-allowed;\n}\n\n.lpc-nav {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0px;\n padding: 0px 0 30px;\n}\n\n.lpc-navBtn {\n padding: 9px;\n border: none;\n background: transparent;\n color: #bcbcc7;\n font-size: 37px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;\n}\n\n.lpc-navBtn:disabled {\n color: #bcbcc7;\n opacity: 0.75;\n cursor: not-allowed;\n}\n\n.lpc-navBtn--enabled {\n background: #ececef;\n color: #3b3c4b;\n}\n\n@media (max-width: 1024px) {\n .lpc-heading {\n font-size: 32px !important;\n }\n\n .lpc-tierButton {\n min-width: 84px;\n padding: 16px 14px;\n font-size: 14px;\n }\n\n .lpc-cardList {\n padding: 20px 16px;\n gap: 12px;\n }\n\n .lpc-balanceBar {\n margin: 0 16px 8px;\n padding: 8px 10px;\n }\n\n .lpc-balanceLabel,\n .lpc-balanceValue {\n font-size: 14px;\n }\n\n .lpc-card {\n flex-basis: 260px;\n min-height: 360px;\n }\n\n .lpc-coins {\n font-size: 11px;\n }\n\n .lpc-title {\n font-size: 16px;\n }\n\n .lpc-ratingRow {\n font-size: 12px;\n }\n\n .lpc-cta {\n padding: 12px;\n font-size: 13px;\n }\n\n .lpc-navBtn {\n width: 42px;\n height: 42px;\n font-size: 24px;\n }\n}\n');function Ku({size:t=20,color:n="#000",thickness:o=2,centered:r=!1}){const i=e.createElement("div",{className:"yt-loader",style:{width:`${t}px`,height:`${t}px`,border:`${o}px solid rgba(0,0,0,0.15)`,borderTop:`${o}px solid ${n}`}}," ");return r?e.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"}},i):i}bt(".yt-loader {\n border-radius: 50%;\n animation: yt-spin 0.8s linear infinite;\n }\n \n @keyframes yt-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n ");const Ju={sectionTitle:"Get your favorites for free",subheading:"Earn more and unlock Freebies",display:"scroll",alignment:"center",titleFontSize:46,titleColor:"#25262D",subtitleColor:"#41439A",tabBackgroundColor:"#FFFFFF",tabActiveColor:"#FFFFFF",tabActiveTextColor:"#25262D",tabTextColor:"#25262D",cardBackgroundColor:"#FFFFFF",buttonColor:"#DC8EAB",buttonTextColor:"#FFFFFF",borderColor:"#E2E2E8",roundness:0,ctaText:"Sign in to access",coinBalanceLabel:"Balance:"},em=e=>{if(null==e||""===e)return null;const t="number"==typeof e?e.toString():e;return t.includes("₹")?t:`₹${t}`},tm=({config:i})=>{const a={...Ju,...i},{sectionTitle:l,catalogBanner:c,coinBalance:s,coinBalanceLabel:d,coinIconUrl:p,display:u,alignment:m,titleFontSize:g,titleColor:x,cardBackgroundColor:f,buttonColor:y,buttonTextColor:b,borderColor:h,roundness:v,tiers:w,selectedTierId:C,products:E,ctaText:k}=a,T=r(null),[S,$]=t(!1),[N,B]=t(!1),[z,I]=t(null),F=o(()=>E,[E]),P=e=>{if(!T.current)return;const t=.8*T.current.clientWidth;T.current.scrollBy({left:"left"===e?-t:t,behavior:"smooth"})};n(()=>{const e=T.current;if(!e)return;const t=()=>{const t=e.scrollWidth-e.clientWidth;$(e.scrollLeft>1),B(e.scrollLeft<t-1)};return t(),e.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[F.length]);const D="grid"===u?"lpc-cardList lpc-cardList--grid":"wrap"===u?"lpc-cardList lpc-cardList--wrap":"lpc-cardList lpc-cardList--scroll";return e.createElement("section",{className:"lpc-root"},e.createElement("div",{className:`lpc-header lpc-align-${m||"center"}`},c?e.createElement("img",{className:"lpc-banner",src:c,alt:"Catalog banner"}):null,l?e.createElement("h2",{className:"lpc-heading",style:{color:x,fontSize:`${g}px`}},l):null),null!=s&&""!==s?e.createElement("div",{className:"lpc-balanceBar"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19",fill:"none"},e.createElement("path",{d:"M1.53613 6.91208H16.1281C16.3318 6.91208 16.5272 6.99299 16.6712 7.13702C16.8152 7.28105 16.8961 7.47639 16.8961 7.68008V15.3601C16.8961 15.5638 16.8152 15.7591 16.6712 15.9031C16.5272 16.0472 16.3318 16.1281 16.1281 16.1281H2.30413C2.10045 16.1281 1.9051 16.0472 1.76107 15.9031C1.61705 15.7591 1.53613 15.5638 1.53613 15.3601V6.91208ZM2.30413 2.30408H13.8241V5.37608H1.53613V3.07208C1.53613 2.86839 1.61705 2.67305 1.76107 2.52902C1.9051 2.38499 2.10045 2.30408 2.30413 2.30408ZM11.5201 10.7521V12.2881H13.8241V10.7521H11.5201Z",fill:"black"})),e.createElement("span",{className:"lpc-balanceLabel"},d),p?e.createElement("img",{className:"lpc-coinIcon",src:p,alt:"Coin icon"}):null,e.createElement("span",{className:"lpc-balanceValue"},s," coins")):null,e.createElement("div",{className:D,ref:T},F.map(t=>{const n=z===t.id,o=`${v||0}px`,r=Boolean(t.productUrl);return e.createElement("article",{key:t.id,className:"lpc-card",style:{background:f,borderColor:h,borderRadius:o,cursor:r?"pointer":void 0},onClick:()=>{t.productUrl&&"undefined"!=typeof window&&(window.location.href=t.productUrl)}},e.createElement("div",{className:"lpc-imageWrap",style:{borderTopLeftRadius:o,borderTopRightRadius:o}},e.createElement("img",{className:"lpc-image",src:t.imageUrl,alt:t.title})),e.createElement("div",{className:"lpc-meta"},e.createElement("h3",{className:"lpc-title"},t.title),t.description?e.createElement("p",{className:"lpc-description"},t.description):null,e.createElement("div",{className:"lpc-priceRow"},em(t.mrp)?e.createElement(e.Fragment,null,e.createElement("span",{className:"lpc-priceMuted"},"MRP:"),e.createElement("span",{className:"lpc-priceStrikethrough"},em(t.mrp))):null,em(t.price)?e.createElement("span",{className:"lpc-priceNow"},em(t.price)):null,em(t.price)?e.createElement("span",{className:"lpc-pricePlus"},"+"):null,p?e.createElement("img",{className:"lpc-coinIcon",src:p,alt:"Coin icon"}):null,e.createElement("span",{className:"lpc-priceCoins"},t.coinsRequired," coins"))),e.createElement("button",{className:"lpc-cta",style:{background:y,color:b,borderColor:y,borderBottomLeftRadius:o,borderBottomRightRadius:o,boxShadow:"0 3px 0 rgba(0, 0, 0, 0.18)","--lpc-cta-shadow":"0 3px 0 rgba(0, 0, 0, 0.18)","--lpc-cta-shadow-active":"0 1px 0 rgba(0, 0, 0, 0.18)",opacity:t.disabled?.55:1},type:"button","aria-busy":n,disabled:Boolean(t.disabled)||null!==z,onClick:async e=>{if(e.stopPropagation(),t.onButtonClick&&!t.disabled&&null===z)try{I(t.id),await t.onButtonClick(t)}finally{I(null)}}},n?e.createElement(Ku,{size:18,color:"#fff",centered:!0}):t.buttonText||k))})),"scroll"===u?e.createElement("div",{className:"lpc-nav"},e.createElement("button",{className:"lpc-navBtn "+(S?"lpc-navBtn--enabled":""),type:"button",onClick:()=>P("left"),disabled:!S},e.createElement(dt,null)),e.createElement("button",{className:"lpc-navBtn "+(N?"lpc-navBtn--enabled":""),type:"button",onClick:()=>P("right"),disabled:!N},e.createElement(pt,null))):null)},nm=({config:t,brandConfig:n})=>{const{heroDesktopImage:o,heroMobileImage:r,heroTitle:i="ZERO WASTE PREMIUM PET CARE",heroSubtitle:a="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:s="#000000",heroSubtitleFontWeight:d="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:g="#1C1C1D",primaryContrastColor:x="#FFFFFF",secondaryColor:f="#FFFFFF",secondaryContrastColor:y="#000000",accentColor:b="#FFFFFF",borderColor:B="#E5E5E5",themeRoundness:z="0px",heroBannerVisibility:I="show",stepsVisibility:F="show",waysToEarnVisibility:P="show",waysToEarnCustomText:D="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",customSectionVisibility:A="show",footerSignupVisibility:_="show",customSectionImagePosition:R="left",customSectionTitle:O="Earn Doglycoins every time you shop",customSectionSubtitle:L="Collect more Doglycoins by entering your birthday, following us on social or referring a friend (details below)\n\nRedeem your Doglycoins for cash off at checkout by signing in or creating an account. Did you shop without registering? No worries, your Credits have been saved for you",customSectionTitleFontSize:M="36px",customSectionSubtitleFontSize:V="18px",customSectionImage:j,customSectionTextAlignment:W="left",customSectionTitleColor:H="#000000",customSectionSubtitleColor:q="#000000",stepsTitle:Q="Getting started is easy",stepsSubtitle:U="Earn Stars and get rewarded in a few easy steps.",step1Title:Y="CREATE AN ACCOUNT",step1Description:G="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:X="ORDER AND EARN REWARDS POINTS",step2Description:Z="Use cash, credit/debit card or save some time and pay right through the app. You'll collect Stars all ways.",step3Title:K="UNLOCK REWARDS AND OFFERS",step3Description:J="As you earn Stars, you can redeem them for Rewards—like free food, drinks, and more. Start redeeming with as little as 25 Stars!",footerCustomText:ee="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:te="Use your points to redeem samples and more."}=t||{},ne="undefined"!=typeof window&&window.innerWidth<=768,oe=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${g}`,transition:"all 0.3s ease"},ie={...re,backgroundColor:g,color:x,borderColor:g},ae={...re,backgroundColor:f,color:y,borderColor:B},{newSignupTokens:le,firstOrderTokens:ce,instagramFollowPoints:se,twitterFollowPoints:de,facebookFollowPoints:pe,youtubeSubscriptionPoints:ue,rewardToLeaveReview:me,birthdayPoints:ge,referralPointsForReferrer:xe,tokenCreditPercentage:fe,brandTokenName:ye}=n||{},be=[...le?[{icon:e.createElement(h,null),title:`${le} ${ye}`,subtitle:"Create an account"}]:[],...ce?[{icon:e.createElement(v,null),title:`${ce} ${ye}`,subtitle:"Place your first order"}]:[],...fe?[{icon:e.createElement(v,null),title:`${fe}% ${ye}`,subtitle:`Earn ${fe}% back on every order`}]:[],...xe?[{icon:e.createElement(w,null),title:`${xe} ${ye}`,subtitle:"Refer a friend and get"}]:[],...ge?[{icon:e.createElement(C,null),title:`${ge} ${ye}`,subtitle:"Get on your birthday to spend"}]:[],...me?[{icon:e.createElement(E,null),title:`${me} ${ye}`,subtitle:"Write a Review"}]:[],...pe?[{icon:e.createElement(k,null),title:`${pe} ${ye}`,subtitle:"Like on Facebook"}]:[],...se?[{icon:e.createElement(T,null),title:`${se} ${ye}`,subtitle:"Follow on Instagram"}]:[],...de?[{icon:e.createElement(S,null),title:`${de} ${ye}`,subtitle:"Follow on Twitter"}]:[],...ue?[{icon:e.createElement($,null),title:`${ue} ${ye}`,subtitle:"Subscribe on YouTube"}]:[]];return e.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===I&&e.createElement("div",{className:"yt-loyalty-page-hero",style:{position:"relative",minHeight:"500px",display:"flex",alignItems:"center",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start",backgroundImage:`url(${oe(ne&&r?r:o)})`,backgroundSize:"cover",backgroundPosition:"center",padding:ne?"40px 20px":"60px 80px"}},e.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},e.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:ne?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},i),e.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:s,fontWeight:Number(d)||400,marginBottom:"32px"}},a),m&&e.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},e.createElement("button",{className:"yt-loyalty-page-hero-button",style:ie,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===F&&e.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},e.createElement("div",{className:"yt-loyalty-page-steps-background-text",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"GETTING STARTED"),e.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},e.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},Q),e.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:g,marginBottom:"24px"}},U),e.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:e.createElement(v,null),title:Y,desc:G},{icon:e.createElement(N,null),title:X,desc:Z},{icon:e.createElement(C,null),title:K,desc:J}].map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{className:"yt-loyalty-page-step-icon",style:{width:"80px",height:"80px",borderRadius:"50%",border:"4px solid #ccc",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"32px",color:"#666",marginBottom:"12px"}},t.icon),e.createElement("div",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,color:g,textTransform:"uppercase",lineHeight:"normal"}},t.title),e.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:g,lineHeight:1.2,maxWidth:"300px"}},t.desc)))))),"show"===P&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-background-text",style:{position:"absolute",top:ne?"10%":"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"WAYS TO EARN"),e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"12px"}},be.map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{width:ne?"100%":"220px",border:"2px solid #ddd",padding:"12px 8px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:z,boxShadow:"-1px 2px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"4px",color:"#1a1a2e"}},t.icon),e.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"13px",fontWeight:700,marginBottom:"2px",textTransform:"uppercase",color:"#000"}},t.title),e.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"11px",color:"#666"}},t.subtitle)))),D&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-custom-text",style:{maxWidth:"1000px",margin:"24px auto 0",backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},D)),"show"===A&&e.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:ne?"40px 0px":"40px 20px",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:ne?"column":"row",alignItems:"center",gap:"40px",borderRadius:z,overflow:"hidden",backgroundColor:"#F9F9F9"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:ne||"left"===R?0:1}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:j?`url(${oe(j)})`:o?`url(${oe(o)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),e.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:ne?"20px":"10px",textAlign:ne?"center":W,order:ne||"left"===R?1:0,marginBottom:ne?"20px":"0px"}},e.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:M,fontWeight:700,marginBottom:"16px",color:H}},O),e.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:V,color:q,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},L)))),"show"===_&&e.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},e.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},e.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},ee),e.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:ne?"center":"left"}},e.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},e.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000",textAlign:ne?"center":"left"}},"Rewards Program"),e.createElement("p",{style:{fontSize:"14px",color:"#666"}},te)),e.createElement("button",{className:"yt-loyalty-page-footer-signup-button",style:ae,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"JOIN NOW")))))},om=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:i},e.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"16px",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},cm(o)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},lm(o)),e.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},o.name),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"16px",padding:"12px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"clamp(16px, 4vw, 18px)",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"20px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(B,null):e.createElement(z,null))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),e.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},e.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),e.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return A(p,document.body)},rm=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:i},e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),e.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),e.createElement("div",{style:{overflowY:"auto",flex:1}},e.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},e.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},cm(o)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},lm(o)),e.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},o.name),e.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"20px",padding:"14px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"18px",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"22px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(B,null):e.createElement(z,null)))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),e.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},e.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t)))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return A(p,document.body)},im=({offersToShow:o,offersConfig:i,getOfferCardMessage:a,setSelectedOffer:l,setShowPopup:c})=>{const s=r(null),[d,p]=t(!1),[u,m]=t(!0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=768),f=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};n(()=>{f();const e=s.current;if(e)return e.addEventListener("scroll",f),()=>e.removeEventListener("scroll",f)},[o]),n(()=>{const e=()=>{x(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const y=e=>{if(s.current){const t=g?280:365,n=16,o="right"===e?t+n:-(t+n);s.current.scrollBy({left:o,behavior:"smooth"})}};return e.createElement("div",{style:{position:"relative"}},e.createElement("svg",{style:{position:"absolute",width:0,height:0}},e.createElement("defs",null,e.createElement("mask",{id:"coupon-cut-mask-desktop"},e.createElement("rect",{width:"365",height:"138",fill:"white"}),e.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),e.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),e.createElement("mask",{id:"coupon-cut-mask-mobile"},e.createElement("rect",{width:"280",height:"120",fill:"white"}),e.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),e.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&e.createElement("button",{onClick:()=>y("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(I,{size:20})),u&&e.createElement("button",{onClick:()=>y("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(F,{size:20})),e.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:g?"110px":"128px"}},o?.map(t=>e.createElement("div",{key:t.discountId,style:{flexShrink:0,width:g?"280px":"365px",minWidth:g?"280px":"365px",minHeight:g?"110px":"128px",backgroundColor:"transparent",borderRadius:`${i?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},e.createElement("div",{style:{width:g?"60px":"80px",minHeight:g?"110px":"128px",backgroundColor:i?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:g?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${i?.roundness||0}px`,borderBottomLeftRadius:`${i?.roundness||0}px`}},e.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),i?.iconVisibility&&e.createElement("div",{style:{position:"absolute",left:g?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:g?"32px":"40px",height:g?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},cm(t)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{flex:1,padding:g?"12px 12px":"15px 15px",paddingLeft:g?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${i?.roundness||0}px`,borderBottomRightRadius:`${i?.roundness||0}px`,overflow:"hidden",backgroundColor:i?.cardBackgroundColor||"#ffffff",minWidth:0}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:g?"4px":"6px",lineHeight:"normal"}},e.createElement("div",{style:{fontSize:g?"9px":"10px",color:"#666666",fontWeight:"400"}},lm(t)),e.createElement("div",{style:{fontSize:g?"13px":"15px",fontWeight:"600",color:i?.textColor||"#2c3e50"}},t.name),e.createElement("div",{style:{fontSize:g?"11px":"12px",color:i?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:g?"28px":"32px"}},a(t))),e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),l(t),c(!0)},style:{fontSize:g?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},i?.viewDetailsTitle||"View Details")))))),e.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},am=({offersToShow:o,offersConfig:r,getOfferCardMessage:i,setSelectedOffer:a,setShowPopup:l})=>{const[c,s]=t("undefined"!=typeof window&&window.innerWidth<=768);return n(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.createElement("div",{style:{borderRadius:`${r?.roundness||8}px`}},o?.map((t,n)=>e.createElement("div",{key:t.discountId,style:{display:"flex",alignItems:"flex-start",gap:c?"8px":"12px",padding:c?"12px 0":"16px 0",paddingLeft:c?"10px":"20px",backgroundColor:!0===r?.cardBackgroundTransparent||"true"===String(r?.cardBackgroundTransparent)?"transparent":r?.cardBackgroundColor||"#ffffff",borderBottom:n<(o?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${r?.roundness||0}px`}},r?.iconVisibility&&e.createElement("div",{style:{width:c?"40px":"50px",height:c?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:c?"20px":"25px",marginTop:c?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},cm(t)?e.createElement(b,null):e.createElement(qe,null)),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:c?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},lm(t),":"," ",e.createElement("span",{style:{fontWeight:600,color:r?.textColor||"#34495e"}},t.name)),e.createElement("div",{style:{fontSize:c?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},i(t)),e.createElement("div",{style:{fontSize:c?"11px":"12px",color:"#000000"}},"offer auto applied",e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),a(t),l(!0)},style:{color:r?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},r?.viewDetailsTitle||"T&C"))))))},lm=e=>"free_product"===e.couponType?"deal_amount"===e.freebieType?"Deal":"percentage_off"===e.freebieType?"% Off":"Free Gift":e._customOffer?.code?"Coupon":"Special Deal",cm=e=>"free_product"===e.couponType&&"deal_amount"!==e.freebieType&&"percentage_off"!==e.freebieType,sm=({offersConfig:o,offers:i})=>{const[a,l]=t(!1),[c,s]=t(null),[d,p]=t(null),[u,m]=t("undefined"!=typeof window&&window.innerWidth<=768),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=450),f=r(null);n(()=>{const e=()=>{m(window.innerWidth<=768),x(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{f.current&&xn(f.current)},[o?.sectionBgContrastColor]);const y=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",o=-1;Object.keys(t).forEach(e=>{t[e]>o&&(o=t[e],n=e)});const r=e.map((e,t)=>({o:e,idx:t})),i=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return r.sort((e,t)=>{const o=e.o.customCartProgressBarCriteria===n,r=t.o.customCartProgressBarCriteria===n;if(o&&r){const n=i(e.o),o=i(t.o);return n!==o?n-o:e.idx-t.idx}return o&&!r?-1:!o&&r?1:e.idx-t.idx}),r.map(e=>e.o)})((!1===o?.showBackendOffers&&o?.customOffers&&o.customOffers.length>0?o.customOffers.map((e,t)=>{return{discountId:-(t+1),name:(n=e).title,couponType:n.code?"discount_code":"special_deal",customCartProgressBarCriteria:null,discountPercentage:null,couponTemplateId:0,minimumOrderValue:0,quantityThreshold:0,_allVariantIds:[],description:n.description,_customOffer:n};var n}):i)||[]),b=e=>{if(s(e),e){const t=e._customOffer;p(t?(e=>({offerMessage:e.description||"Special offer available",terms:e.terms?e.terms.split("\n").filter(e=>""!==e.trim()):[]}))(t):(e=>{const t="free_product"===e.couponType;let n="";if(t){const t="deal_amount"===e.freebieType?`at ${e.discountValue}`:"percentage_off"===e.freebieType?`at ${e.discountPercentage}% off`:"free"===e.freebieType?"for free!":"";t&&(n=`Get the product ${t}`)}else e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const o=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?o.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&o.push(`Unlock at order value of ${e.minimumOrderValue}`),t||o.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:o}})(e))}},h=e=>{const t=e._customOffer;return t?t.description||"Special offer available":(e=>"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?`add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to unlock`:"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue?`unlocks on orders above ${e.minimumOrderValue}`:"Special offer available")(e)};return e.createElement("div",null,e.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===o?.sectionType?`${o?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:o?.sectionBackgroundColor||"#fff"}},e.createElement("div",{style:{border:"coupon"===o?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=o?.cardPadding?`${o.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===o?.sectionType?`${o?.roundness||8}px`:"0px"}},e.createElement("span",{ref:f,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"right"===o?.alignment?"auto":"50%",right:"right"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===o?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:o?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},o?.sectionTitle||"Available Deals and Offers"),(()=>{const t=o?.sectionType;return"list"===t?e.createElement(am,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):"coupon"===t?e.createElement(im,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):null})(),g?e.createElement(rm,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}):e.createElement(om,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}))))};export{iu as Bundle,Zu as BundleLoader,Xu as Cart,nm as LoyaltyPageBlock,tm as LoyaltyProductCatalog,Wt as Nudge,sm as ProductOffers,Xt as SpinnerWheel};