yt-uikit 0.10.26 → 0.10.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
|
@@ -3152,7 +3152,7 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
|
|
|
3152
3152
|
font-size: 1em;
|
|
3153
3153
|
justify-content: center;
|
|
3154
3154
|
align-items: center;
|
|
3155
|
-
`;const ws=({options:t,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const i=!a||a(t.name);return e.createElement("div",{key:t.name,onClick:()=>{i&&r(t)},style:{cursor:i?"pointer":"not-allowed"}},((t,n)=>{const r=!a||a(t.name),i={cursor:r?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:r?1:.5};if("color"===o)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name);return"image"===o?e.createElement("img",{src:Cn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name)})(t,n?.name===t.name))})),vs=({product:o,isOpen:a,onClose:i,variantOptions:l,cta:c,onConfirm:s})=>{const d=r(()=>e=>e?o?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[o?.tracksInventory]),p=r(()=>{const e=o.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):o.options?.map(e=>e.values[0])||[]},[o,d]),[m,u]=t(p),[g,f]=t(window.innerWidth<1024);n(()=>{const e=()=>f(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&i()};return a&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[a,i]);const y=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?m.join(" / "):m[0]))?.node,x=y?.image?.url||o.featuredMedia?.preview?.image?.url,h=Cn(x,150,85,"webp"),b=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},w=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}})},v=(e,t)=>{const n=m[t];if(!n)return null;return w(e).find(e=>e.name===n)||null};if(!a)return null;const C=e.createElement("div",{onClick:i,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:h,alt:o.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},o.title))),e.createElement("div",{style:{padding:"20px"}},o.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},v(t,n)?.name||t.values[0])),e.createElement(ws,{options:w(t),selectedValue:v(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n)})(n,e)},type:b(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...m];n[e]=t;const r=o.options?.length>0?n.join(" / "):n[0],a=o.variants.edges.find(e=>e.node.title===r)?.node;return!!a&&d(a)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?m.join(" / "):m[0]))?.node,t=!!e&&d(e)>0;if(e?.id&&t)s(e.id),i();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",m);const e=o.variants.edges.find(e=>d(e.node)>0)?.node.id;e&&(s(e),i())}},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)},Cs=l((i,l)=>{const[c,s]=ce(fs),d=r(()=>e=>{const t=i?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:i?.bundleProductsCustomQuantity?i?.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,i?.customVariantsQuantity,i?.bundleProductsCustomQuantity]),p=c?.variants.edges?.filter(e=>d(e.node)>0)||[],[m,u]=t(p?.[0]?.node),[g,f]=t(0),[y,x]=t("undefined"!=typeof window&&window.innerWidth<=600),[h,b]=t(1),[w,v]=t("idle"),C=o(null),E=o(null),k=o(!1),[T,S]=t(0),[N,B]=t(),F=r(()=>{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,$]=t(F);n(()=>{if(c){const e=c.variants.edges?.filter(e=>d(e.node)>0),t=c?.selectedVariant??e[0]?.node;u(t),t?.title&&"Default Title"!==t.title&&$(t.title.split(" / "))}},[c,d]),n(()=>{const e=i.selectedProducts.find(e=>e.variantId===m?.id);b(e?e.quantity:0)},[h,i.selectedProducts,m]),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=()=>x(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:I,descriptionHtml:P,media:A,variants:_}=c,L=A.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0),R=a(e=>{const t=e.target.value,n=p?.find(e=>e.node.id===t)?.node;n&&d(n)>0&&(k.current=!0,u(n),B(n?.image?.url),n.title&&"Default Title"!==n.title&&$(n.title.split(" / ")))},[p,d]),M=a(e=>{if(!i.bundleVariantOptions?.options)return"text";const t=i.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[i.bundleVariantOptions]),O=a(e=>{if(!i?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=i?.bundleVariantOptions?.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},[i.bundleVariantOptions]),V=a((e,t)=>{const n=[...z];n[e]=t.name,$(n);const r=c?.options?.length>0?n.join(" / "):n[0],o=c?.variants.edges.find(e=>e.node.title===r)?.node;B(o?.image?.url),o&&d(o)>0&&(k.current=!0,u(o))},[z,c,d]),W=a((e,t)=>{const n=z[t];if(!n)return null;return O(e).find(e=>e.name===n)||null},[z,O]),H=a((e,t)=>{const n=[...z];n[e]=t;const r=c?.options?.length>0?n.join(" / "):n[0],o=c?.variants.edges.find(e=>e.node.title===r)?.node;return!!o&&d(o)>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(y&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[y,c]);const j=i.selectedProducts.filter(e=>e.variantId===m?.id).reduce((e,t)=>e+t.quantity,0),q=i.customVariantsQuantity?.find(e=>e.variantId===m?.id)?.quantity??i.bundleProductsCustomQuantity??1/0,U=q!==1/0&&j>=q,Q=i.hideAddToBundle||!m||d(m)<=0||U||"idle"!==w||i?.disableQuantitySelector&&1===h,Z=({className:t})=>{const n=c?.rating?.averageRating??i?.rating?.averageRating??0,r=c?.rating?.ratingCount??i?.rating?.ratingCount??0;return n<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===i.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement($e,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},n," rating")),"ratingAndReviewCount"===i.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement($e,{color:"gold",size:14}),n,e.createElement(ke,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",r," reviews)"))},Y=({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"}},L.length>0&&L.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(bt,{small:Em(t?.url),medium:Em(t?.url),large:Em(t?.url),alt:t.altText||`${I} - Image ${n+1}`,hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image"})))):e.createElement(e.Fragment,null,e.createElement(bt,{small:Em(N??"")||Em(L[g]?.url),medium:Em(N??"")||Em(L[g]?.url),large:Em(N??"")||Em(L[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"}},L.length>1&&L.filter(e=>e?.url?.length>0).map((n,r)=>e.createElement("img",{key:r,src:Em(n?.url),alt:n.altText||`${I} - Image ${r+1}`,onClick:()=>f(r),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:g===r?`2px solid ${i.themeColor||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),X=({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"}},m?.title)),e.createElement("select",{className:`${t}-select`,value:m?.id||"",onChange:R,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),className:0===d(t)?"variant-out-of-stock":""},t.title))),e.createElement("span",{className:`${t}-chevron`,style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(tt,null)))),K=({isMobile:t})=>e.createElement(e.Fragment,null,c.options.map((n,r)=>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[r]||n.values[0])),e.createElement(ws,{options:O(n),selectedValue:W(n,r),onChange:e=>{V(r,e)},type:M(n.name),isOptionAvailable:e=>H(r,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"}},i?.isFreebieTier&&!i.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"}},Cm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),vm(m?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:i.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,m?.compareAtPrice&&parseFloat(m.compareAtPrice)>parseFloat(m?.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"}},Cm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),vm(m?.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"}},Cm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),vm(m?.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:i.themeColor||"#111",borderRadius:i.cornerRadius,color:i.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(),m?.id&&c&&(v("check"),i.handleAddToBundle(m?.id,c,1),setTimeout(()=>{v("idle"),s(void 0)},500))},disabled:Q},i.styles.byob.addToBundleCTAText??"Add to bundle")),te=e.createElement(xs,{className:"yt-byob-modal-desktop-overlay"},e.createElement(hs,{$isSmallScreen:y,ref:l},e.createElement(bs,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(y?"small-screen":"large-screen")},e.createElement(ys,{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(Y,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"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement(Z,{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"===i?.styles?.byob.variantSelectorType&&e.createElement(X,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===i?.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(xs,{className:"yt-byob-modal-mobile-overlay"},e.createElement(hs,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:y,ref:l},e.createElement(bs,{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(et,{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(Y,{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"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(Z,{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"===i?.styles?.byob.variantSelectorType?e.createElement(K,{isMobile:!0}):e.createElement(X,{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(y?ne:te,document.body)}),Es=({coverImageUrl:t,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],i=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map(({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",s=i(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:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},ks=({title:t,isOpen:n,onToggle:r,children:o})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:r,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(Ve,{className:"yt-byob-icon-minus",size:20}):e.createElement(Le,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},o)),Ts=({availableFilters:n,appliedFilters:r,toggleFilter:o,clearAllFilters:a,applyPriceFilter:i,priceMin:l,setPriceMin:c,priceMax:s,setPriceMax:d,maxPossiblePrice:p,styles:m,availableProductCount:u,products:g,unavailableProductCount:f,storeCurrencyCode:y,showActions:x=!0,openSections:h,toggleSection:b})=>{const[w,v]=t(null),C=Cm(m?.general?.currencySymbol)??y??"USD";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(ks,{key:t.id,title:t.label,isOpen:!!h[t.id],onToggle:()=>b(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const a=r[t.id]?.includes(n.id)||!1;return"filter.v.availability.1"===n.id?u??g.length:"filter.v.availability.0"===n.id||n.count,e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:a,onChange:()=>o(t.id,n.id),style:{width:"18px",height:"18px",accentColor:m?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,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:()=>v("min"),onTouchStart:()=>v("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"===w?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:s,onMouseDown:()=>v("max"),onTouchStart:()=>v("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);d(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===w?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),x&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:a,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:i,style:{flex:1,padding:"8px",background:m?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Ss=t=>{const{showFiltersDrawer:n,handleClose:r,isAnimating:o,isMobile:a}=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:o?1:0,transition:"opacity 300ms ease-in-out"},onClick:r},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:a?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:o?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Ts,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),r()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Ns=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(Ts,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Bs=({enableSortAndFilter:r,isMobile:o,setSearchTerm:a,searchTerm:i,styles:l,setSortBy:c,appliedFilters:s,setAppliedFilters:d,availableFilters:p=[],products:m,availableProductCount:u,unavailableProductCount:g,maxPossiblePrice:f,storeCurrencyCode:y,sharedFiltersState:x,openSections:b,toggleSection:w,sortBy:v})=>{const[C,E]=t(!1),[k,T]=t(i),{showFilters:S,setShowFilters:N,priceMax:B,setPriceMax:F,priceMin:z,setPriceMin:$}=x,[I,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!o&&"sidebar"===D,_="none"===D;n(()=>{s["filter.v.price"]||(F(f),$(0))},[f,s]);n(()=>{const e=setTimeout(()=>{a(k)},300);return()=>clearTimeout(e)},[k,a]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const L=Object.entries(s).reduce((e,[t,n])=>"filter.v.price"===t?z>0||B<f?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:o?"column":"row",justifyContent:"space-between",alignItems:o?"flex-end":"center",marginBottom:"20px",width:"100%",gap:o?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:r?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},r&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:o?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},o&&!C?e.createElement(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:o?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Re,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),o&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>N(!S),style:{display:_?"none":"flex",alignItems:"center",gap:o?"0px":"6px",background:S&&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(Me,{className:"yt-byob-filter-toggle-icon",size:18}),!o&&"Filters",L>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},L)),r&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!o&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),o&&e.createElement(Oe,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:v,onChange:e=>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(h,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(Ss,{showFiltersDrawer:S,handleClose:()=>{A?N(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{N(!1)},300))},isAnimating:I,isMobile:o,availableFilters:p,appliedFilters:s,toggleFilter:(e,t)=>{d(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{F(f),$(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${B}`],t})},priceMin:z,setPriceMin:$,priceMax:B,setPriceMax:F,maxPossiblePrice:f,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:y,openSections:b,toggleSection:w}))},Fs=()=>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"}})),zs=({title:t,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="string"==typeof n?{url:n,name:"Attachment"}:n,l=i?.loading,c=i?.error,s=i?.url;return e.createElement("div",{className:"yt-personalization-upload-field",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",border:"1px dashed #ccc",borderRadius:"10px",background:"#fff",gap:"12px"}},e.createElement("div",{className:"yt-personalized-form-field-content",style:{flex:1,minWidth:0}},e.createElement("div",{className:"yt-personalized-form-field-title",style:{fontWeight:600,fontSize:"14px",color:"#1a1a1a"}},t),!i&&!l&&!c&&e.createElement("div",{className:"yt-personalized-form-field-hint",style:{fontSize:"12px",color:"#888",marginTop:"2px"}},"jpeg/png/img (max size: 5MB)"),l&&e.createElement("div",{className:"yt-personalized-form-field-loading",style:{display:"flex",alignItems:"center",gap:"6px",color:"#007bff",fontSize:"12px",marginTop:"4px"}},e.createElement(Fs,null)," Uploading ",i?.name||"image","..."),c&&e.createElement("div",{className:"yt-personalized-form-field-error",style:{fontSize:"12px",color:"#dc3545",marginTop:"2px"}},"Upload failed."),s&&!l&&!c&&e.createElement("div",{className:"yt-personalized-form-field-preview",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},e.createElement("img",{className:"yt-personalized-form-field-preview-image",src:i.url,alt:"Uploaded",style:{width:"36px",height:"36px",objectFit:"cover",borderRadius:"4px",border:"1px solid #eee"}}),e.createElement("span",{className:"yt-personalized-form-field-preview-name",style:{fontSize:"12px",color:"#28a745",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},i.name))),e.createElement("div",{className:"yt-personalized-form-field-actions",style:{flexShrink:0}},c&&e.createElement("button",{type:"button",className:"yt-personalized-form-retry-button",onClick:a,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Retry"),s&&!l&&!c&&e.createElement("button",{type:"button",className:"yt-personalized-form-remove-button",onClick:o,style:{fontSize:"13px",fontWeight:600,color:"#fff",background:"#dc3545",border:"none",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Remove"),!i&&!l&&e.createElement("button",{type:"button",className:"yt-personalized-form-upload-button",onClick:r,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Upload Image")))},$s=({form:r,formData:a,setFormData:i,barHeight:l=0,isUploading:c,setIsUploading:s})=>{const d=o(new Map),[p,m]=t(!1),u=s??m;n(()=>()=>{d.current.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),d.current.clear()},[]);const g=e=>{if(!d.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.multiple=!1,t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");i(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),u(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw alert("Upload failed. Try again."),e}finally{u(!1)}})(n);i(r=>({...r,[e]:{url:t,name:n.name}}))}catch{i(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),d.current.set(e,t)}return d.current.get(e)};return e.createElement("div",{className:"yt-personalized-form",style:{width:"100%",padding:"8px 0",marginBottom:`${l}px`,boxSizing:"border-box"}},r.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-personalized-form-section",style:{marginBottom:"28px"}},e.createElement("label",{className:"yt-personalized-form-section-title",style:{display:"block",fontWeight:700,marginBottom:"10px",color:"#1a1a1a",fontSize:"15px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-personalized-form-text-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement("textarea",{key:r,className:"yt-personalized-form-textarea",placeholder:t?.title,rows:3,maxLength:500,value:a[r]||"",onChange:e=>i(t=>({...t,[r]:e.target.value})),style:{width:"100%",padding:"8px 0",border:"none",borderBottom:"1.5px solid #ddd",borderRadius:0,fontSize:"14px",color:"#1a1a1a",background:"transparent",resize:"none",outline:"none",lineHeight:"1.5",boxSizing:"border-box"}})})),"image"===t.type&&e.createElement("div",{className:"yt-personalized-form-image-section"},e.createElement("div",{className:"yt-personalized-form-image-hint",style:{fontSize:"12px",color:"#888",marginBottom:"10px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),e.createElement("div",{className:"yt-personalized-form-image-fields",style:{display:"flex",flexDirection:"column",gap:"10px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement(zs,{key:r,title:t?.title,uploadState:a[r],onUpload:()=>g(r).click(),onRemove:()=>i(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>g(r).click()})}))))))};function Is({quantity:t,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,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(Cc,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const r=Math.max(0,t-1);n(r),l&&a&&l(a,1)},style:d},"-"),e.createElement(Ec,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(r,t+1,s);n(l),o&&a&&i&&o(a,i,1)},disabled:!p||c,style:{...d,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const Ps=({product:o,styles:a,selectedVariant:i})=>{const[l,c]=t(!1),s=r(()=>Em(i?.image?.url||o?.featuredMedia?.preview?.image?.url||o?.media?.edges?.[0]?.node?.image?.url)||"",[i?.image?.url,o?.featuredMedia?.preview?.image?.url,o?.media?.edges]),d=r(()=>o?.media?.edges?.map(e=>Em(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[o?.media?.edges]),p=r(()=>d?.[1]??s??"",[d,s]);n(()=>{if(s){(new Image).src=s}},[s]);const m=r(()=>s||d?.[0],[s,d]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:a.general.imageAspectRatio||"1/1"},onMouseEnter:()=>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&&m!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:m,alt:o.title}),m!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:o.title})))},Ds=({product:r,bundle:o,handleAddToBundle:i,hideAddToBundle:l,remainingQuantity:c,themeColor:s,handleRemoveItem:d,transitionActive:p,idx:m,selecteditems:u,customVariantsQuantity:g,currentProductTier:f,showFreebieTierProductPrices:y,tierIndex:x})=>{const b=de(fs),w=o.customizations,v=w?.byob?.variantSelectorType,[C,E]=t(!1),k=w.general?.variantTitleSuffix?r?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const r=t[e];let o=0;for(;o<n.length&&o<r.length&&n[n.length-1-o]===r[r.length-1-o];)o++;n=n.slice(n.length-o)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),r=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:r,commonSuffix:n.join(" ")}}})})(r?.variants?.edges);if(!k||!k.length)return e.createElement(e.Fragment,null);const T=a(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(o?.customProductsQuantity)return o?.customProductsQuantity;const n=k?.find(t=>t.node.id===e),a=n?.node;return a?r.tracksInventory&&a.inventoryItem?.tracked?a.inventoryQuantity>0?a.inventoryQuantity:a.inventoryQuantity<=0&&"continue"===a.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[k,g,r.tracksInventory]),S=k?.find(e=>T(e.node.id)>0)?.node?.id;if(!S&&!w.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[N,B]=t(k?.find(e=>T(e.node.id)>0)?.node?.id||k[0]?.node?.id),[F,z]=t(0),[$,I]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===N)?.node,_=T(N||"");n(()=>{const e=u.find(e=>e.variantId===N&&(void 0===x||e.tierIndex===x));z(e?e.quantity:0)},[u,N,x]),n(()=>{const e=()=>{I(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(N&&!k?.some(e=>e.node.id===N)){const e=k.find(e=>T(e.node.id)>0)?.node.id||k[0]?.node?.id;e&&B(e)}},[N,k,T]);const L=r.variants&&r.variants.edges?.length>1&&"customOptions"!==v,R="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,M="53933408435"===R,O="75851235630"===R,V=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(r),W=V.length>0;return e.createElement(e.Fragment,null,e.createElement(Sc,{borderRadius:w?.byob.borderRadius,borderColor:w?.byob.borderColor,shadowType:w?.byob.shadowType,backgroundColor:w?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":m%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(_<=0)return;const e={...r,variants:{...r.variants,edges:k},selectedVariant:A};b(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:w?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Nc,{className:"yt-byob-image-wrapper"},e.createElement(Ps,{product:r,styles:w,selectedVariant:A}),o?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:w?.general.primaryColor||"#111",color:w?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:w.byob.borderRadius}},o.productCardBadgeText),L&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Bc,{className:"yt-byob-variant-selector",isCoralHaze:M,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:N||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),B(e.target.value)}},k?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,r=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,className:0===T(t.node.id)?"variant-out-of-stock":""},r)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(h,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"===o?.customizations?.byob?.productCardCategoryVisibility&&W&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},V.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:$?"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(Fc,{isMobile:$,showBorder:o?.showBorder??!0,style:{...!w?.byob.productsPriceVisibility&&{padding:"8px"},...w?.byob.productTitleFontSize&&{fontSize:w?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:w?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},O?String(A?.displayName).replace("- Default Title",""):r.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&w?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:o?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},A?.title),"ratingOnly"===(w?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.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($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===(w?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.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($e,{color:"gold",size:14})," ",r?.rating?.averageRating,e.createElement(ke,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),w?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:o?.showBorder?"0px 10px":"0 4px"}},f?.isFreebieTier&&!y?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Cm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",vm(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:w.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},Cm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",vm(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!f?.isFreebieTier||y)&&A?.compareAtPrice&&w?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Cm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",vm(A.compareAtPrice)))),(_>0||_===1/0)&&e.createElement(zc,{borderRadius:w?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===F||void 0===F)&&e.createElement(kc,{style:{...!l&&{backgroundColor:w?.general.primaryColor||"#111",color:w?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),z(1),(()=>{if(!N)return;"customOptions"===v&&k.length>1?E(!0):i(N,r,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},w?.byob.addToBundleCTAText),!o?.disableQuantitySelector&&F>0&&N&&e.createElement(Tc,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Is,{remainingQuantity:c,setQuantity:z,quantity:F,handleAddToBundle:i,variantId:N,product:r,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:_})),o?.disableQuantitySelector&&F>0&&N&&e.createElement(kc,{style:{backgroundColor:"#747474",color:w?.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($c,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Ic,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,F-1);z(t),d&&N&&d(N,x)}},e.createElement(We,{style:{color:"#fff",fontSize:"20px"}})))),_<=0&&_!==1/0&&e.createElement(kc,{style:{backgroundColor:w.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},w?.general.outOfStockLabel||"Out of Stock")),"customOptions"===v&&C&&k.length>1&&e.createElement(vs,{product:r,isOpen:C,onClose:()=>E(!1),variantOptions:o.variantOptions,cta:{textColor:w.general.ctaTextColor,backgroundColor:w.general.primaryColor},onConfirm:e=>{B(e),i(e,r,1)}}))},As=({currentStep:t,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,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:r}).map((c,d)=>{const p=d+1,m=!o[d].isFormStep&&o[d].minimumQuantity-(i[d]?.length??0)===0,u=d===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===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:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?"white":m?`${l}50`:"white",border:`2px solid ${u?"#666666":m?l:"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:a?"16px 0px":"15px 0px",fontSize:a?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},o[t]?.title)),_s=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...r].map(r=>{const a=o===r;return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(t.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX: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",...r].map(r=>e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:o===r?t?.general.primaryColor:"white",color:o===r?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{o!==r&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1)))))},Ls=({bundle:i,selectedItems:l,setSelectedItems:c,handleAddToCart:s,bundleAddToCartLoading:d,renderingOnPage:p,selectedItemsQuantity:m,handleRemoveItem:u,bundleSubtotal:g,dispatchAnalyticsEvent:f,fetchStoreDetails:y,productsPagination:x})=>{const[h,b]=t(void 0),[w,v]=t(window.innerWidth<450),[C,E]=t(0),[k,T]=t({}),S=!!i.personalizedForm?.title&&"productTier"===i.builderTiers?.type,[N,B]=t({}),[F,z]=t(!1),$=S&&C===(i.builderTiers?.productTier?.length||0),I=C===(i.builderTiers?.productTier?.length||0)-1,P=S&&I&&!$,[D,A]=t(i?.products),[_,L]=t(!1),[R,M]=t({}),[O,V]=t(i?.products),[W,H]=t({}),[j,q]=t(x?.cursorData),U=i.builderTiers?.type,Q=i.customizations,Z=i.builderTiers?.productTier??[],G=i.builderTiers?.offerTier??[],[Y,X]=t([]),[K,J]=t(!1),[ee,te]=t("All"),ne=o(null),[re,oe]=t({}),[ae,ie]=t([]),[le,se]=t(!1),[de,pe]=t(0),[me,ue]=t(0),[ge,ye]=t({}),xe=e=>{ye(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{ae.length>0&&ye(e=>{const t={...e};return ae.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[ae]),n(()=>{!(Object.values(re).length>0)&&x?.cursorData&&q(x.cursorData)},[re,x?.cursorData]);const he=i.customStoreDetails?.fixedInventoryDetails;n(()=>{const e=new Set;let t=!1;D?.forEach(n=>{const r=n?.productDetails;if(r.metafield&&"yourtoken_bundles_app"===r.metafield.namespace&&"categories"===r.metafield.key){let n=[];if(r.metafield.jsonValue&&Array.isArray(r.metafield.jsonValue))n=r.metafield.jsonValue;else if(r.metafield.value)try{const e=JSON.parse(r.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)))}}),X(Array.from(e)),J(t);Q?.byob?.productFiltersDisplay&&"none"!==Q?.byob?.productFiltersDisplay&&(async()=>{const e=Q?.byob?.productFiltersDisplay??"none";if("drawer"===e||"sidebar"===e)try{const e=await(y?.());e?.productFilters&&ie(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[Q?.byob,y,D]),n(()=>{oe({})},[C,ee]);const be=((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,r="estailofashion.myshopify.com"!==window?.Shopify?.shop||null!==e?.productDetails?.publishedAt;return n&&r}),ee),we="productTier"===U?Z.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===U?G.reduce((e,t)=>e+t.minimumQuantity,0):i.minimumQuantity,ve=a((e,t)=>{const n=he?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const r=(e.variants?.edges||[]).find(e=>e.node.id===t),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[he]),[Ce,Ee]=t(3e3);n(()=>{const e=ae?.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,ae]);const[ke,Te]=t(""),[Se,Ne]=t(""),Be=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(be,ke),Fe=((e,t)=>[...e].sort((e,n)=>{const r=e?.productDetails?.title?.toLowerCase(),o=n?.productDetails?.title?.toLowerCase(),a=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),i=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return r.localeCompare(o);case"title-desc":return o.localeCompare(r);case"price-low-to-high":return a-i;case"price-high-to-low":return i-a;default:return 0}}))(Be,Se);n(()=>{(async e=>{if(!x)return;const{initialCursorData:t,cursorData:n,fetchFn:r,setCursorData:o}=x,a="productTier"===U?Z?.[C]?.tier:1;if(0===Object.values(e)?.length)return void("productTier"===U?(M(e=>({...e,[C]:W?.[C]||[]})),o(j||{...n})):(A(O),o(j||{1:t?.[1]})));const i=await r(e,a,null);i&&("productTier"===U?(M(e=>({...e,[C]:i})),A(e=>{const t=new Set(e.map(e=>e.productId)),n=i.filter(e=>!t.has(e.productId));return[...e,...n]})):A(i))})(re)},[re]);const[ze,$e]=ce(fs),[Ie,Pe]=t(!1);n(()=>{f?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:i?._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder"}}),setTimeout(()=>{Pe(!0)},100)},[]);const De=o(null);n(()=>{const e=()=>{v(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(i.coverImageUrl){const e=new Image;e.src=Em(i.coverImageUrl)??"",e.onload=()=>{b(e.width/e.height)}}},[i.coverImageUrl]),n(()=>{Pe(!1),setTimeout(()=>Pe(!0),100)},[C]);const Ae=(e,t)=>{if("productTier"===U){let n={...k},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=Z.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}T(n);const o=Z.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==o&&E(o)}u(e,t)},_e=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if(i)return"productTier"!==i?.builderTiers?.type?(A(i?.products??[]),void V(i?.products??[])):void("productTier"===i?.builderTiers?.type&&(M({0:i?.products}),H({0:i?.products})))},[i]),n(()=>{if("productTier"!==U||!Z[C])return;if(we===m)return;const e=Z.findIndex((e,t)=>{const n=k[t]||[];return t>=C&&n.length<e.minimumQuantity});if(-1!==e&&e!==C){E(e);const t=Z[C];t?.products?.length>1&&_e()}else if(-1===e&&S&&C<Z.length){Z.every((e,t)=>(k[t]?.length||0)>=e.minimumQuantity)&&E(Z.length)}},[k,Z,U,S]),n(()=>{Te("")},[C]),n(()=>{function e(e){if(!De.current||!e.target)return;!De.current.contains(e.target)&&$e(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const Le=(e,t,n)=>{var r;"productTier"===U&&(r=e,T(e=>{const t={...e},n=Z.findIndex((e,n)=>{const r=t[n]||[];return n>=C&&r.length<e.minimumQuantity}),o=-1!==n?n:C;return-1!==n&&E(n),t[o]||(t[o]=[]),t[o].push(r),t}));const o=!0===Z[C]?.isFreebieTier;f?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),km(e,t,n,l,c,o,C)},Re=(()=>{if(!i?.builderTiers)return i.minimumQuantity;const{type:e,offerTier:t,productTier:n}=i.builderTiers,r="offerTier"===e?t:"productTier"===e?n:null;if(!r)return i.minimumQuantity;let o=0;return r.map(e=>{o+=e.minimumQuantity}),o})(),Me=w&&i.mobileCoverImageUrl?Em(i.mobileCoverImageUrl):Em(i.coverImageUrl??"")||null,Oe=a(e=>{const t=Q?.general?.showOutOfStockProducts;if(t)return!0;const n=e?.productDetails,r=n?.variants?.edges||[];if(he){if(r.some(e=>he.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return r.some(e=>ve(n,e.node.id)>0)},[Q?.general?.showOutOfStockProducts,he,ve]),Ve=r(()=>{if("productTier"===U&&Z.length>0){const e=R?.[C]??[];return Se?Fe.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Oe(t)):e.map(e=>Fe.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Oe(e))}return Fe.filter(Oe)},[U,Z,R,C,Fe,Oe,Se]),We=Ve;n(()=>{if("productTier"!==U)return;const e=Z[C];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;if(1!==R?.[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 r=n.variants?.edges?.find(e=>ve(n,e.node.id)>0)?.node;if(!r)return;const o=r.id,a=k[C]?.includes(o);if(!a&&(Le(o,n,1),C<Z.length-(S?0:1))){E(C+1);const e=Z?.[C];e?.products?.length>1&&_e()}},[U,Z,C,D,k,ve,Le]);const He=r(()=>be.filter(e=>{const t=e?.productDetails;return(t.variants?.edges||[]).some(e=>ve(t,e.node.id)>0)}).length,[be,ve]),je=r(()=>be.length-He,[be,He]),qe="bundles"==i.appName?i.pageHeader?.title:i?.title,Ue="bundles"==i.appName?i.pageHeader?.description:i?.subtitle;n(()=>{if(!x)return;const{cursorData:e,fetchFn:t}=x,n=Z[C]?.tier,r="productTier"===U?n:1;if(e?.[r]&&!e?.[r]?.hasNext||!t)return;const o=new IntersectionObserver(async([n])=>{if(n.isIntersecting&&!_){L(!0);try{const n=await t(re,r,e?.[r]?.cursor);if(n?.length>0){const e=Object.values(re).length>0;"productTier"===U?(M(e=>({...e,[C]:[...e[C]||[],...n]})),e||H(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{L(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),a=ne.current;return a&&o.observe(a),()=>{a&&o.unobserve(a)}},[x,_,U,C,Z]);const Qe=()=>{f?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-builder-section",style:{display:"flex",flexDirection:"column",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:Q.byob.sectionBackgroundColor,..."transparent"!==Q.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Me?e.createElement("div",{className:"yt-byob-cover-image-container",style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...i?.coverImageVerticalMargin&&{marginBottom:i?.coverImageVerticalMargin,marginTop:i?.coverImageVerticalMargin}}},Me&&e.createElement(Es,{coverImageUrl:Me,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:Q?.byob?.titleFontSize??"3rem",fontWeight:"700",color:Q?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:Q?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},qe),e.createElement("span",{style:{lineHeight:"normal",fontSize:Q?.byob?.subtitleFontSize??"1.5rem",color:Q?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Ue))):(qe||Ue)&&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:Q?.byob?.titleFontSize??"3rem",fontWeight:"700",color:Q?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:Q?.byob?.titleBackgroundColor??"transparent"}},qe),Ue&&e.createElement("span",{className:"bundle-builder-subtitle",style:{lineHeight:"normal",fontSize:Q?.byob?.subtitleFontSize??"1.5rem",color:Q?.byob?.titleTextColor??"#000"}},Ue)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===U&&Z.length>0&&Q?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-stepper-wrapper"},e.createElement(As,{currentStep:C,totalSteps:Z.length+(S?1:0),tiers:S?[...Z,{title:i.personalizedForm?.title||"Personalize",tier:Z.length,minimumQuantity:0,products:[],isFormStep:!0}]:Z,isMobile:w,primaryColor:Q?.general?.primaryColor,primaryTextColorCta:Q?.general?.primaryContrastColor,setCurrentProductTier:E,selectedProductsByTier:k,tierNavigation:Q.byob.tierNavigation})))),e.createElement("div",{className:"yt-byob-layout-wrapper",style:{display:"flex",flexDirection:"row",width:w?"100%":"90%",marginInline:"auto"}},"sidebar"===Q?.byob?.productFiltersDisplay&&!w&&!$&&e.createElement(Ns,{showFiltersDrawer:le,handleClose:()=>se(!1),isAnimating:!1,isMobile:!1,availableFilters:ae,appliedFilters:re,toggleFilter:(e,t)=>{oe(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{oe({}),ue(0),pe(Ce)},applyPriceFilter:()=>{oe(e=>{const t={...e};return t["filter.v.price"]=[`min:${me}-max:${de}`],t})},priceMin:me,setPriceMin:ue,priceMax:de,setPriceMax:pe,maxPossiblePrice:Ce,styles:Q,products:D,unavailableProductCount:je,storeCurrencyCode:i?.storeCurrencyCode,openSections:ge,toggleSection:xe}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!$&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Bs,{enableSortAndFilter:i?.enableSortAndFilter??!1,isMobile:w,searchTerm:ke,setSearchTerm:Te,setSortBy:Ne,styles:Q,appliedFilters:re,setAppliedFilters:oe,availableFilters:ae,products:D,availableProductCount:He,unavailableProductCount:je,maxPossiblePrice:Ce,storeCurrencyCode:i?.storeCurrencyCode,sharedFiltersState:{showFilters:le,setShowFilters:se,priceMax:de,setPriceMax:pe,priceMin:me,setPriceMin:ue},openSections:ge,toggleSection:xe}),i?.customizations?.byob?.enableProductCategories&&K&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(_s,{styles:Q,isMobile:w,categories:Y,activeCategory:ee,onCategoryChange:e=>{te(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:le&&"sidebar"===Q?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},$&&i.personalizedForm?.title?e.createElement($s,{form:i.personalizedForm,formData:N,setFormData:B,isUploading:F,setIsUploading:z}):0!==We?.length||_?Ve.map((t,n)=>{if("productTier"===U){const r=(Z[C]?.minimumQuantity??0)>(k[C]?.length??0),o=Fe.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return o?e.createElement(Ds,{bundle:i,idx:n,key:t?.variantIds?.[0]??t.productId,product:o?.productDetails,handleAddToBundle:Le,hideAddToBundle:!r,remainingQuantity:Re-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>Ae(e,C),selecteditems:l,transitionActive:Ie,customVariantsQuantity:he,currentProductTier:Z[C],showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:C}):null}return e.createElement(Ds,{bundle:i,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:Le,hideAddToBundle:m>=Re,remainingQuantity:Re-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>u(e),selecteditems:l,transitionActive:Ie,customVariantsQuantity:he,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(re).length>0?"No products match your filters":"No products found"),Object.values(re).length>0&&e.createElement("button",{onClick:()=>{oe({}),ue(0),pe(Ce)},style:{padding:"8px 16px",background:Q?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:Q?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px"}},"Clear All Filters")),!$&&_&&e.createElement("div",{className:"yt-byob-loading-wrapper",style:{width:"100%",display:"flex",justifyContent:"center",padding:"20px"}},e.createElement(fe,{color:Q?.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(gs,{builderTiers:i?.builderTiers,showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void _e();const t={};S&&Object.entries(N).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await s(e,t),Qe()},minimumQuantity:we,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:Ae,selectedItemsQuantity:m,percentageOff:i.percentageOff,loading:d,bundleSubtotal:g,amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:i?.dealTextColor??"#333",primaryTextColorCta:i?.primaryTextColorCta??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:k,renderingOnPage:p,isUploading:F}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(gs,{showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void _e();const t={};S&&Object.entries(N).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await s(e,t),Qe()},minimumQuantity:we,builderTiers:i?.builderTiers,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,loading:d,handleRemoveItem:u,handleRemoveItemProductTier:Ae,percentageOff:i.percentageOff,selectedItemsQuantity:m??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:Q?.general.primaryColor||"#000",primaryTextColorCta:Q.general.primaryContrastColor??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:k,renderingOnPage:p,isUploading:F})))),ze&&void 0!==m&&(()=>{let t=m<i.minimumQuantity;return"productTier"==U?t=(Z[C]?.minimumQuantity??0)>(k[C]?.length??0):"offerTier"==U&&(t=m<G.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(Cs,{handleAddToBundle:Le,ref:De,remainingQuantity:i.minimumQuantity-m,hideAddToBundle:!t,disableQuantitySelector:i?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:k,themeColor:Q?.general.primaryColor||"#000",primaryTextColorCta:i?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:Q?.general.primaryColor||"#000",cornerRadius:i?.customizations.byob.borderRadius,styles:i.customizations,reviewRatingType:Q?.fixedBundle?.productRatingsDisplay??i?.reviewRatingType,customVariantsQuantity:he,bundleProductsCustomQuantity:i?.customProductsQuantity,isFreebieTier:Z?.[C]?.isFreebieTier,showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:i?.variantOptions})})()))},Rs=({isOpen:r,onClose:o,formConfig:a,onCheckout:i,cta:l,isMobile:c})=>{const[s,d]=t({}),[p,m]=t(!1);n(()=>{r||d({})},[r]);const u=e=>{if(p)return;const t={};Object.entries(s).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),i(e?{}:t)};if(!r)return null;const g=e.createElement("div",{className:"yt-personalized-form-modal-overlay",onClick:o,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems: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",{className:"yt-personalized-form-modal",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",{className:"yt-personalized-form-modal-header",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"}},a.title||"Personalization",!c&&e.createElement("button",{className:"yt-personalized-form-modal-close",onClick:o,style:{position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",fontSize:"24px",lineHeight:1,cursor:"pointer",color:"#666",padding:"4px"}},"×")),e.createElement("div",{className:"yt-personalized-form-modal-body",style:{flex:1,overflowY:"auto",padding:c?"20px 20px":"16px 20px"}},e.createElement($s,{form:a,formData:s,setFormData:d,isUploading:p,setIsUploading:m})),e.createElement("div",{className:"yt-personalized-form-modal-footer",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",{className:"yt-personalized-form-submit-button",onClick:()=>{u(),o()},disabled:p,style:{width:"100%",fontSize:"15px",fontWeight:700,textAlign:"center",padding:"15px 0",border:"none",borderRadius:"10px",cursor:p?"not-allowed":"pointer",opacity:p?.7:1,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:l.backgroundColor,color:l.textColor,letterSpacing:"0.01em"}},p?e.createElement(fe,{color:l.textColor,size:15}):"Submit"),e.createElement("button",{className:"yt-personalized-form-skip-button",onClick:()=>{u(!0),o()},style:{background:"none",border:"none",fontSize:"14px",fontWeight:600,color:"#1a1a1a",cursor:"pointer",padding:"4px 8px",textAlign:"center"}},"Add without customization"))));return D.createPortal(g,document.body)},Ms=({product:t,selectedVariantId:n,onVariantChange:o,styles:a,originalPrice:i,dealPrice:l,totalPriceSum:c,isVertical:s=!1,variantOptions:d,storeCurrencyCode:p,reviewRatingType:m})=>{const u=r(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),r=n?.node;return r?t.productDetails.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t.productDetails]),g=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;u(n);const f=r(()=>{if(g?.title&&t.productDetails.options){const e=g.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[g,t.productDetails.options]),y=e=>{o(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%"}},a.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Em(g?.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:a.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},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=>y(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(h,null)))))),(a.comboBundle.subProductsProductTitleVisibility||a.comboBundle.subProductsProductPriceVisibility||m)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal",fontWeight:"500"}},e.createElement($e,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(ke,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Cm(a.general.currencySymbol),vm((Number(g?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Cm(a.general.currencySymbol),vm(g?.compareAtPrice?g.compareAtPrice:g?.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"}},Cm(a.general.currencySymbol),vm(g?.price)))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===a.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===a.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},a.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Em(g?.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:a?.general?.imageAspectRatio||"1 / 1",height:"100px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===a.comboBundle?.infoAlignment?"flex-start":"right"===a.comboBundle?.infoAlignment?"flex-end":"center"===a.comboBundle?.infoAlignment?"flex-start":void 0}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),"dropdown"!==a.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.filter(e=>"Default Title"!==e.node.title).length>0&&d&&f&&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"}},f.length>1?f.join(" / "):f)),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal",fontWeight:"500"}},e.createElement($e,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(ke,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Cm(a.general.currencySymbol),vm((Number(g?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Cm(a.general.currencySymbol),vm(g?.compareAtPrice?g?.compareAtPrice:g?.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"}},Cm(a.general.currencySymbol),vm(g?.price)))),t.productDetails.variants.edges.length>1&&("dropdown"===a.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>y(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(h,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,r)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(o=>{const i=[...f];i[r]=o;const l=t.productDetails.options.length>0?i.join(" / "):i[r],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?u(c.id):0),p=f[r]===o,m=d&&d?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&y(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!s?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},m?.values.find(e=>e.name===o)?.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===o)?.value}},e.createElement("span",null)):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${a.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):m&&"image"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&y(c.id)},disabled:s,style:{border:p&&!s?`1px solid ${a.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===o)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Em(m?.values.find(e=>e.name===o)?.value||"/placeholder.svg"),alt:o,style:{width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${a.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&y(c.id)},disabled:s,style:{padding:"4px 8px",border:p&&!s?`1px solid ${a.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}},o)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const r=0===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":""} ${r?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>y(t?.node?.id),disabled:r,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:r?"#ccc":"#707070",cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:r?.5:1}},t?.node?.title)}))))))},Os=({bundle:o,addToCartFunction:a,dispatchAnalyticsEvent:i})=>{const[l,c]=t(!1),[s,d]=t(window.innerWidth<786),[p,m]=t(!1),u=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,f]=t(()=>{const e={};return o.products.forEach((t,n)=>{const r=t.productDetails?.variants?.edges?.find(e=>u(t.productDetails,e?.node?.id)>0)?.node;e[n]=r?r.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e}),y=o.products?.every((e,t)=>{const n=g[t];return u(e.productDetails,n)>0});n(()=>(a&&(window.ytComboBundle={bundle:o,addToCart:a,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}))}),[o,a,g]);const x=(e,t)=>{f(n=>({...n,[e]:t}))},h=async e=>{const t=Object.entries(g).map(([e])=>({id:o.products[parseInt(e)].productId,title:o.products[parseInt(e)]?.productDetails?.title}));i?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:o._id,bundleType:"combo-bundle",selectedProducts:t}});try{if(c(!0),!a)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const t=Object.entries(g).map(([e,t])=>{const n=o.products[parseInt(e)],r=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return r?{variantId:t,price:Number(r.price)}:null}).filter(e=>null!==e),n=Object.values(g);await a(Number(C),n,Number(E),t,e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)},b=o.customizations,w=b?.comboBundle?.discountBadgeDisplay||"discount-on-compare",v=b?.comboBundle?.discountBadgeVisibility,{originalPrice:C,dealPrice:E,offerValue:k,totalPriceSum:T,offerPercentage:S}=r(()=>{const{price:e,compareAtPrice:t}=Object.entries(g).reduce((e,[t,n])=>{const r=o.products[parseInt(t)],a=r.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,i=parseFloat(a?.price??"0"),l=parseFloat(a?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=!1===v?e:"discount-on-price"===w?e:t;let r=e;o?.percentageOff?r=e*(1-o.percentageOff/100):o?.dealAmount?r=o.dealAmount:o?.amountOff&&(r=e-o.amountOff);const a=n-r,i=n>0?Math.round((n-r)/n*100):0;return{originalPrice:n.toFixed(2),dealPrice:r.toFixed(2),offerValue:a.toFixed(2),totalPriceSum:e.toFixed(2),offerPercentage:i}},[g,o.products,o.percentageOff,o.dealAmount,o.amountOff,w,v]);n(()=>{i?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:o._id,bundleType:"combo-bundle"}});const e=()=>{d(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const N=b.comboBundle?.comboCardStyle||"auto",B="vertical"===N||"auto"===N&&!s,F=b.comboBundle?.embedContentVisibility,z="bundles"==o.appName?o.pageHeader?.title:o?.title,$="bundles"==o.appName?o.pageHeader?.description:o?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===b.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===b.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===b.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:b.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===b.comboBundle?.infoAlignment?"flex-start":"right"===b.comboBundle?.infoAlignment?"flex-end":"center"===b.comboBundle?.infoAlignment?"center":void 0,textAlign:b.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},F&&b.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:b.comboBundle?.productTitleFontSize||"28px",color:b.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},z)),F&&b?.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:b.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(b.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"}},Cm(b.general.currencySymbol,o.storeCurrencyCode),vm(E)),!isNaN(Number(C))&&!isNaN(Number(E))&&Number(C)>Number(E)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:b.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Cm(b.general.currencySymbol,o.storeCurrencyCode),vm(C)),Number(k)>0&&!1!==v&&(()=>{const t="percentage"===(b?.comboBundle?.discountDisplayType||"amount")?`${S}% Off`:`Save ${Cm(b.general.currencySymbol,o.storeCurrencyCode)}${vm(k)}`;return e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},t)})())),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:b.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:b.comboBundle.productDescriptionFontSize||"16px",color:b.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."))),b.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,B?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"}},o.products.map((t,n)=>{const r=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===g[n])?.node;return r?e.createElement(Ms,{key:`combo-product-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>x(n,e),isVertical:B,variantOptions:o.variantOptions,storeCurrencyCode:o.storeCurrencyCode,reviewRatingType:b?.comboBundle?.comboProductRatingsDisplay}):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%"}},b.comboBundle.subProductsSectionVisibility&&o.products.map((t,n)=>e.createElement(Ms,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>x(n,e),variantOptions:o.variantOptions,reviewRatingType:b?.comboBundle?.comboProductRatingsDisplay})))),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 ${y?"":"yt-comboBundle-bundle-cta-button-disabled"} ${s?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:y?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor,color:b.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:b.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:y?"pointer":"not-allowed",border:`1px solid ${y?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor}`,boxShadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,margin:"0"},disabled:!y,onMouseOver:e=>{b.general.customizeHoverState&&y&&(e.currentTarget.style.backgroundColor=b.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=b.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{b.general.customizeHoverState&&y&&(e.currentTarget.style.backgroundColor=b.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=b.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{o?.personalizedForm?.title?m(!0):await h()}},l?e.createElement(fe,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,y?b.comboBundle?.ctaTitle??"Add Bundle to cart":b.general.outOfStockLabel||"Out of Stock"," "))),F&&b.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:b.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:b.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:b.comboBundle.productDescriptionFontSize||"16px",color:b.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:b.general.primaryColor+"08"}},e.createElement("p",null,$))),o?.personalizedForm?.title&&e.createElement(Rs,{isOpen:p,onClose:()=>m(!1),formConfig:o.personalizedForm,onCheckout:async e=>{await h(e),m(!1)},cta:{backgroundColor:b.general?.ctaBackgroundColor||"#121212",textColor:b.general?.ctaTextColor||"#FFFFFF"},isMobile:s}))},Vs=s.div`
|
|
3155
|
+
`;const ws=({options:t,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i})=>e.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},t?.map(t=>{const i=!a||a(t.name);return e.createElement("div",{key:t.name,onClick:()=>{i&&r(t)},style:{cursor:i?"pointer":"not-allowed"}},((t,n)=>{const r=!a||a(t.name),i={cursor:r?"pointer":"not-allowed",border:n?"2px solid #333":"1px solid #d1d5db",transition:"all 0.2s ease",opacity:r?1:.5};if("color"===o)return t.value&&(()=>{if(!t.value.trim())return!1;if(t.value===t.name||t.value.length<3)return!1;try{const e=document.createElement("div");return e.style.color=t.value,""!==e.style.color}catch{return!1}})()?e.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:t.value,display:"block"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name);return"image"===o?e.createElement("img",{src:Cn(t.value,48,85,"webp")||"/placeholder.svg",alt:t.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"},className:r?"":"variant-out-of-stock"}):e.createElement("div",{style:{...i,padding:"4px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:n?"600":"400",backgroundColor:n?"#f3f4f6":"white",color:"#333",minWidth:"fit-content",textAlign:"center"},className:r?"":"variant-out-of-stock"},t.name)})(t,n?.name===t.name))})),vs=({product:o,isOpen:a,onClose:i,variantOptions:l,cta:c,onConfirm:s})=>{const d=r(()=>e=>e?o?.tracksInventory&&e?.inventoryItem?.tracked?e.inventoryQuantity>0?e?.inventoryQuantity:e.inventoryQuantity<=0&&"continue"===e.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0,[o?.tracksInventory]),p=r(()=>{const e=o.variants.edges.find(e=>{const t=e.node;return d(t)>0})?.node;return e?.title&&"Default Title"!==e.title?e.title.split(" / "):o.options?.map(e=>e.values[0])||[]},[o,d]),[m,u]=t(p),[g,f]=t(window.innerWidth<1024);n(()=>{const e=()=>f(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{const e=e=>{"Escape"===e.key&&i()};return a&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[a,i]);const y=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?m.join(" / "):m[0]))?.node,x=y?.image?.url||o.featuredMedia?.preview?.image?.url,h=Cn(x,150,85,"webp"),b=e=>{if(!l?.options)return"text";const t=l.options.find(t=>t.name===e);return t?.type||"text"},w=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}})},v=(e,t)=>{const n=m[t];if(!n)return null;return w(e).find(e=>e.name===n)||null};if(!a)return null;const C=e.createElement("div",{onClick:i,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},e.createElement("div",{onClick:e=>e.stopPropagation(),style:{background:"white",borderRadius:16,width:"fit-content",minWidth:350,maxWidth:450,maxHeight:"90vh",overflowY:"auto",position:"relative",zIndex:999,...window.innerWidth<=600&&{width:"90vw",maxWidth:"90vw",minWidth:"90vw"}}},e.createElement("div",{id:"yt-variant-options-modal-title",style:{width:"100%",padding:"16px 0",fontWeight:600,fontSize:14,textTransform:"uppercase",backgroundColor:"rgba(217, 217, 217)",color:"black",textAlign:"center",borderTopLeftRadius:16,borderTopRightRadius:16}},"Select Options"),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},e.createElement("img",{src:h,alt:o.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),e.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},e.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},o.title))),e.createElement("div",{style:{padding:"20px"}},o.options.map((t,n)=>e.createElement("div",{key:t.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:t?.values?.length>1?16:0}},t?.values?.length>1&&e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},e.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",t.name),e.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},v(t,n)?.name||t.values[0])),e.createElement(ws,{options:w(t),selectedValue:v(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n)})(n,e)},type:b(t.name),isOptionAvailable:e=>((e,t)=>{const n=[...m];n[e]=t;const r=o.options?.length>0?n.join(" / "):n[0],a=o.variants.edges.find(e=>e.node.title===r)?.node;return!!a&&d(a)>0})(n,e),isMobile:g}))))),e.createElement("button",{onClick:()=>{const e=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?m.join(" / "):m[0]))?.node,t=!!e&&d(e)>0;if(e?.id&&t)s(e.id),i();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",m);const e=o.variants.edges.find(e=>d(e.node)>0)?.node.id;e&&(s(e),i())}},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)},Cs=l((i,l)=>{const[c,s]=ce(fs),d=r(()=>e=>{const t=i?.customVariantsQuantity?.find(t=>t.variantId===e?.id)?.quantity;return void 0!==t?t:i?.bundleProductsCustomQuantity?i?.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,i?.customVariantsQuantity,i?.bundleProductsCustomQuantity]),p=c?.variants.edges?.filter(e=>d(e.node)>0)||[],[m,u]=t(p?.[0]?.node),[g,f]=t(0),[y,x]=t("undefined"!=typeof window&&window.innerWidth<=600),[h,b]=t(1),[w,v]=t("idle"),C=o(null),E=o(null),k=o(!1),[T,S]=t(0),[N,B]=t(),F=r(()=>{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,$]=t(F);n(()=>{if(c){const e=c.variants.edges?.filter(e=>d(e.node)>0),t=c?.selectedVariant??e[0]?.node;u(t),t?.title&&"Default Title"!==t.title&&$(t.title.split(" / "))}},[c,d]),n(()=>{const e=i.selectedProducts.find(e=>e.variantId===m?.id);b(e?e.quantity:0)},[h,i.selectedProducts,m]),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=()=>x(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:I,descriptionHtml:P,media:A,variants:_}=c,L=A.edges.map(e=>e?.node.preview.image??e?.node.image).filter(e=>e?.url?.length>0),R=a(e=>{const t=e.target.value,n=p?.find(e=>e.node.id===t)?.node;n&&d(n)>0&&(k.current=!0,u(n),B(n?.image?.url),n.title&&"Default Title"!==n.title&&$(n.title.split(" / ")))},[p,d]),M=a(e=>{if(!i.bundleVariantOptions?.options)return"text";const t=i.bundleVariantOptions?.options.find(t=>t.name===e);return t?.type||"text"},[i.bundleVariantOptions]),O=a(e=>{if(!i?.bundleVariantOptions?.options)return e.values.map(e=>({name:e,value:e}));const t=i?.bundleVariantOptions?.options.find(t=>t.name===e.name);return e.values.map(e=>{const n=t?.values?.find(t=>t.name===e);return{name:e,value:n?.value||e}})},[i.bundleVariantOptions]),V=a((e,t)=>{const n=[...z];n[e]=t.name,$(n);const r=c?.options?.length>0?n.join(" / "):n[0],o=c?.variants.edges.find(e=>e.node.title===r)?.node;B(o?.image?.url),o&&d(o)>0&&(k.current=!0,u(o))},[z,c,d]),W=a((e,t)=>{const n=z[t];if(!n)return null;return O(e).find(e=>e.name===n)||null},[z,O]),H=a((e,t)=>{const n=[...z];n[e]=t;const r=c?.options?.length>0?n.join(" / "):n[0],o=c?.variants.edges.find(e=>e.node.title===r)?.node;return!!o&&d(o)>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(y&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[y,c]);const j=i.selectedProducts.filter(e=>e.variantId===m?.id).reduce((e,t)=>e+t.quantity,0),q=i.customVariantsQuantity?.find(e=>e.variantId===m?.id)?.quantity??i.bundleProductsCustomQuantity??1/0,U=q!==1/0&&j>=q,Q=i.hideAddToBundle||!m||d(m)<=0||U||"idle"!==w||i?.disableQuantitySelector&&1===h,Z=({className:t})=>{const n=c?.rating?.averageRating??i?.rating?.averageRating??0,r=c?.rating?.ratingCount??i?.rating?.ratingCount??0;return n<=0?null:e.createElement(e.Fragment,null,"ratingOnly"===i.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement($e,{color:"gold",size:14}),e.createElement("span",{style:{marginLeft:6}},n," rating")),"ratingAndReviewCount"===i.reviewRatingType&&e.createElement("div",{className:t,style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},e.createElement($e,{color:"gold",size:14}),n,e.createElement(ke,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}}),"(",r," reviews)"))},Y=({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"}},L.length>0&&L.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(bt,{small:Em(t?.url),medium:Em(t?.url),large:Em(t?.url),alt:t.altText||`${I} - Image ${n+1}`,hideDownload:!0,imageBackgroundColor:"#000",className:"yt-byob-modal-desktop-main-image"})))):e.createElement(e.Fragment,null,e.createElement(bt,{small:Em(N??"")||Em(L[g]?.url),medium:Em(N??"")||Em(L[g]?.url),large:Em(N??"")||Em(L[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"}},L.length>1&&L.filter(e=>e?.url?.length>0).map((n,r)=>e.createElement("img",{key:r,src:Em(n?.url),alt:n.altText||`${I} - Image ${r+1}`,onClick:()=>f(r),style:{width:t?"60px":"73px",height:t?"60px":"73px",flex:"0 0 auto",scrollSnapAlign:"center",borderRadius:"7px",border:g===r?`2px solid ${i.themeColor||"#111"}`:"1px solid lightgray",objectFit:"cover",cursor:"pointer"},loading:"lazy"})))))),X=({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"}},m?.title)),e.createElement("select",{className:`${t}-select`,value:m?.id||"",onChange:R,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),className:0===d(t)?"variant-out-of-stock":""},t.title))),e.createElement("span",{className:`${t}-chevron`,style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},e.createElement(tt,null)))),K=({isMobile:t})=>e.createElement(e.Fragment,null,c.options.map((n,r)=>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[r]||n.values[0])),e.createElement(ws,{options:O(n),selectedValue:W(n,r),onChange:e=>{V(r,e)},type:M(n.name),isOptionAvailable:e=>H(r,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"}},i?.isFreebieTier&&!i.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"}},Cm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),vm(m?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:i.styles.general.primaryColor||"#d32f2f",fontWeight:"bold",fontSize:"20px"}},"FREE")):e.createElement(e.Fragment,null,m?.compareAtPrice&&parseFloat(m.compareAtPrice)>parseFloat(m?.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"}},Cm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),vm(m?.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"}},Cm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),vm(m?.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:i.themeColor||"#111",borderRadius:i.cornerRadius,color:i.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(),m?.id&&c&&(v("check"),i.handleAddToBundle(m?.id,c,1),setTimeout(()=>{v("idle"),s(void 0)},500))},disabled:Q},i.styles.byob.addToBundleCTAText??"Add to bundle")),te=e.createElement(xs,{className:"yt-byob-modal-desktop-overlay"},e.createElement(hs,{$isSmallScreen:y,ref:l},e.createElement(bs,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(y?"small-screen":"large-screen")},e.createElement(ys,{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(Y,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"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement(Z,{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"===i?.styles?.byob.variantSelectorType&&e.createElement(X,{className:"yt-byob-modal-desktop-variant-selector"}),"customOptions"===i?.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(xs,{className:"yt-byob-modal-mobile-overlay"},e.createElement(hs,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:y,ref:l},e.createElement(bs,{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(et,{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(Y,{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"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.displayName:"variant-title"===i?.styles?.byob?.productVariantTitleType?c?.selectedVariant?.title:c?.title),e.createElement("div",{style:{paddingBlockStart:"10px"}},e.createElement(Z,{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"===i?.styles?.byob.variantSelectorType?e.createElement(K,{isMobile:!0}):e.createElement(X,{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(y?ne:te,document.body)}),Es=({coverImageUrl:t,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],i=(e,t)=>{if(e&&e.includes("cdn.shopify"))try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map(({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""}).filter(Boolean).join(", "):"";if(!t&&!n)return null;const c=t||n||"",s=i(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:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))},ks=({title:t,isOpen:n,onToggle:r,children:o})=>e.createElement("div",{className:"yt-byob-filter-section",style:{borderBottom:"1px solid #eee",paddingBottom:n?"20px":"12px",marginBottom:"12px"}},e.createElement("div",{className:"yt-byob-filter-section-header",onClick:r,style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",padding:"8px 0"}},e.createElement("span",{className:"yt-byob-filter-section-title",style:{fontSize:"16px",fontWeight:500,color:"#111"}},t),n?e.createElement(Ve,{className:"yt-byob-icon-minus",size:20}):e.createElement(Le,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},o)),Ts=({availableFilters:n,appliedFilters:r,toggleFilter:o,clearAllFilters:a,applyPriceFilter:i,priceMin:l,setPriceMin:c,priceMax:s,setPriceMax:d,maxPossiblePrice:p,styles:m,availableProductCount:u,products:g,unavailableProductCount:f,storeCurrencyCode:y,showActions:x=!0,openSections:h,toggleSection:b})=>{const[w,v]=t(null),C=Cm(m?.general?.currencySymbol)??y??"USD";return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-filters-content-wrapper",style:{overflowY:"auto",scrollbarWidth:"none",padding:"20px",flex:1,minHeight:0,overscrollBehavior:"contain"}},n.map(t=>e.createElement(ks,{key:t.id,title:t.label,isOpen:!!h[t.id],onToggle:()=>b(t.id)},"LIST"===t.type&&e.createElement("div",{className:"yt-byob-filter-list",style:{display:"flex",flexDirection:"column",gap:"14px"}},t.values.map(n=>{const a=r[t.id]?.includes(n.id)||!1;return"filter.v.availability.1"===n.id?u??g.length:"filter.v.availability.0"===n.id||n.count,e.createElement("label",{key:n.id,className:"yt-byob-filter-item-label",style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer"}},e.createElement("div",{className:"yt-byob-filter-item-left",style:{display:"flex",alignItems:"center",gap:"10px"}},e.createElement("input",{className:"yt-byob-filter-checkbox",type:"checkbox",checked:a,onChange:()=>o(t.id,n.id),style:{width:"18px",height:"18px",accentColor:m?.general?.primaryColor||"#333",cursor:"pointer"}}),e.createElement("span",{className:"yt-byob-filter-item-text",style:{fontSize:"15px",color:"#333"}},n.label)))})),"PRICE_RANGE"===t.type&&e.createElement("div",{className:"yt-byob-price-filter",style:{padding:"0 4px"}},e.createElement("div",{className:"yt-byob-price-range-display",style:{fontSize:"15px",color:"#333",marginBottom:"24px",fontWeight:500}},C,l.toLocaleString()," – ",C,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:()=>v("min"),onTouchStart:()=>v("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"===w?11:5,margin:0},className:"yt-byob-dual-range-input-min"}),e.createElement("input",{type:"range",min:0,max:p,value:s,onMouseDown:()=>v("max"),onTouchStart:()=>v("max"),onChange:e=>{const t=Math.max(Number(e.target.value),l+10);d(t)},style:{position:"absolute",width:"100%",height:"0px",top:"50%",transform:"translateY(-50%)",background:"none",pointerEvents:"none",appearance:"none",WebkitAppearance:"none",zIndex:"max"===w?11:4,margin:0},className:"yt-byob-dual-range-input-max"})),e.createElement("style",null,"\n .yt-byob-dual-range-input-min::-webkit-slider-thumb,\n .yt-byob-dual-range-input-max::-webkit-slider-thumb {\n pointer-events: auto;\n appearance: none;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n .yt-byob-dual-range-input-min::-moz-range-thumb,\n .yt-byob-dual-range-input-max::-moz-range-thumb {\n pointer-events: auto;\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: #444;\n border: 3px solid white;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n position: relative;\n z-index: 20;\n }\n "))))),x&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick:a,style:{flex:1,padding:"8px",background:"#f3f4f6",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",color:"#333",fontFamily:"inherit"}},"Clear All"),e.createElement("button",{className:"yt-byob-filter-apply-button",onClick:i,style:{flex:1,padding:"8px",background:m?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:m?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px",fontFamily:"inherit"}},"Apply")))},Ss=t=>{const{showFiltersDrawer:n,handleClose:r,isAnimating:o,isMobile:a}=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:o?1:0,transition:"opacity 300ms ease-in-out"},onClick:r},e.createElement("div",{className:"yt-byob-filter-drawer-content",style:{width:a?"85%":"380px",height:"100%",background:"white",boxShadow:"-4px 0 12px rgba(0,0,0,0.15)",transform:o?"translateX(0)":"translateX(100%)",transition:"transform 300ms ease-in-out",display:"flex",flexDirection:"column",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement(Ts,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),r()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Ns=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(Ts,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Bs=({enableSortAndFilter:r,isMobile:o,setSearchTerm:a,searchTerm:i,styles:l,setSortBy:c,appliedFilters:s,setAppliedFilters:d,availableFilters:p=[],products:m,availableProductCount:u,unavailableProductCount:g,maxPossiblePrice:f,storeCurrencyCode:y,sharedFiltersState:x,openSections:b,toggleSection:w,sortBy:v})=>{const[C,E]=t(!1),[k,T]=t(i),{showFilters:S,setShowFilters:N,priceMax:B,setPriceMax:F,priceMin:z,setPriceMin:$}=x,[I,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!o&&"sidebar"===D,_="none"===D;n(()=>{s["filter.v.price"]||(F(f),$(0))},[f,s]);n(()=>{const e=setTimeout(()=>{a(k)},300);return()=>clearTimeout(e)},[k,a]),n(()=>(S&&!A?(document.body.style.overflow="hidden",P(!0)):(document.body.style.overflow="",P(!1)),()=>{document.body.style.overflow=""}),[S,A]);const L=Object.entries(s).reduce((e,[t,n])=>"filter.v.price"===t?z>0||B<f?e+1:e:e+(n?n.length:0),0);return e.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:o?"column":"row",justifyContent:"space-between",alignItems:o?"flex-end":"center",marginBottom:"20px",width:"100%",gap:o?"10px":"0"}},e.createElement("div",{className:"yt-byob-search-filter-controls",style:{display:"flex",flexDirection:r?"row-reverse":"row",justifyContent:"space-between",alignItems:C?void 0:"center",gap:"12px",width:"100%"}},r&&e.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:o?C?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},o&&!C?e.createElement(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:o?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:l?.byob.borderRadius,boxShadow:l?.byob.borderColor?"0 2px 4px rgba(0,0,0,0.1)":"none"},placeholder:"Search by Product Name",value:k,onChange:e=>T(e.target.value)}),!C&&e.createElement(Re,{className:"yt-byob-search-icon",fontSize:"18px",style:{position:"absolute",right:"12px",color:"#aaa",pointerEvents:"none"}})),o&&C&&e.createElement("span",{className:"yt-byob-search-close",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>E(!1)},"X")),e.createElement("div",{className:"yt-byob-actions-wrapper",style:{display:"flex",flexDirection:"row",gap:"10px"}},p?.length>0&&e.createElement("button",{className:"yt-byob-filter-toggle-button",onClick:()=>N(!S),style:{display:_?"none":"flex",alignItems:"center",gap:o?"0px":"6px",background:S&&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(Me,{className:"yt-byob-filter-toggle-icon",size:18}),!o&&"Filters",L>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},L)),r&&e.createElement("div",{className:"yt-byob-sort-wrapper",style:{display:"flex",alignItems:"center",border:"1px solid #d1d5db",padding:"8px 12px",borderRadius:l?.byob.borderRadius,boxShadow:"0 2px 4px rgba(0,0,0,0.1)",position:"relative"}},!o&&e.createElement("span",{className:"yt-byob-sort-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),o&&e.createElement(Oe,{className:"yt-byob-sort-icon",size:18,style:{color:"#555"}}),e.createElement("select",{className:"yt-byob-sort-select",style:{border:"none",background:"transparent",fontSize:"14px",color:"#333",cursor:"pointer",outline:"none",appearance:"none",WebkitAppearance:"none",paddingRight:"20px"},value:v,onChange:e=>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(h,{className:"yt-byob-sort-chevron",size:14,style:{position:"absolute",right:"10px",pointerEvents:"none",color:"#555"}})))),!A&&!_&&e.createElement(Ss,{showFiltersDrawer:S,handleClose:()=>{A?N(!1):(document.body.style.overflow="",P(!1),setTimeout(()=>{N(!1)},300))},isAnimating:I,isMobile:o,availableFilters:p,appliedFilters:s,toggleFilter:(e,t)=>{d(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{F(f),$(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${z}-max:${B}`],t})},priceMin:z,setPriceMin:$,priceMax:B,setPriceMax:F,maxPossiblePrice:f,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:y,openSections:b,toggleSection:w}))},Fs=()=>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"}})),zs=({title:t,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="string"==typeof n?{url:n,name:"Attachment"}:n,l=i?.loading,c=i?.error,s=i?.url;return e.createElement("div",{className:"yt-personalization-upload-field",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",border:"1px dashed #ccc",borderRadius:"10px",background:"#fff",gap:"12px"}},e.createElement("div",{className:"yt-personalized-form-field-content",style:{flex:1,minWidth:0}},e.createElement("div",{className:"yt-personalized-form-field-title",style:{fontWeight:600,fontSize:"14px",color:"#1a1a1a"}},t),!i&&!l&&!c&&e.createElement("div",{className:"yt-personalized-form-field-hint",style:{fontSize:"12px",color:"#888",marginTop:"2px"}},"jpeg/png/img (max size: 5MB)"),l&&e.createElement("div",{className:"yt-personalized-form-field-loading",style:{display:"flex",alignItems:"center",gap:"6px",color:"#007bff",fontSize:"12px",marginTop:"4px"}},e.createElement(Fs,null)," Uploading ",i?.name||"image","..."),c&&e.createElement("div",{className:"yt-personalized-form-field-error",style:{fontSize:"12px",color:"#dc3545",marginTop:"2px"}},"Upload failed."),s&&!l&&!c&&e.createElement("div",{className:"yt-personalized-form-field-preview",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px"}},e.createElement("img",{className:"yt-personalized-form-field-preview-image",src:i.url,alt:"Uploaded",style:{width:"36px",height:"36px",objectFit:"cover",borderRadius:"4px",border:"1px solid #eee"}}),e.createElement("span",{className:"yt-personalized-form-field-preview-name",style:{fontSize:"12px",color:"#28a745",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},i.name))),e.createElement("div",{className:"yt-personalized-form-field-actions",style:{flexShrink:0}},c&&e.createElement("button",{type:"button",className:"yt-personalized-form-retry-button",onClick:a,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Retry"),s&&!l&&!c&&e.createElement("button",{type:"button",className:"yt-personalized-form-remove-button",onClick:o,style:{fontSize:"13px",fontWeight:600,color:"#fff",background:"#dc3545",border:"none",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Remove"),!i&&!l&&e.createElement("button",{type:"button",className:"yt-personalized-form-upload-button",onClick:r,style:{fontSize:"13px",fontWeight:600,color:"#303030",background:"white",border:"1.5px solid #E3E3E3",borderRadius:"10px",padding:"8px 16px",cursor:"pointer",whiteSpace:"nowrap"}},"Upload Image")))},$s=({form:r,formData:a,setFormData:i,barHeight:l=0,isUploading:c,setIsUploading:s})=>{const d=o(new Map),[p,m]=t(!1),u=s??m;n(()=>()=>{d.current.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),d.current.clear()},[]);const g=e=>{if(!d.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.multiple=!1,t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");i(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),u(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw alert("Upload failed. Try again."),e}finally{u(!1)}})(n);i(r=>({...r,[e]:{url:t,name:n.name}}))}catch{i(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),d.current.set(e,t)}return d.current.get(e)};return e.createElement("div",{className:"yt-personalized-form",style:{width:"100%",padding:"8px 0",marginBottom:`${l}px`,boxSizing:"border-box"}},r.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-personalized-form-section",style:{marginBottom:"28px"}},e.createElement("label",{className:"yt-personalized-form-section-title",style:{display:"block",fontWeight:700,marginBottom:"10px",color:"#1a1a1a",fontSize:"15px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-personalized-form-text-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement("textarea",{key:r,className:"yt-personalized-form-textarea",placeholder:t?.title,rows:3,maxLength:500,value:a[r]||"",onChange:e=>i(t=>({...t,[r]:e.target.value})),style:{width:"100%",padding:"8px 0",border:"none",borderBottom:"1.5px solid #ddd",borderRadius:0,fontSize:"14px",color:"#1a1a1a",background:"transparent",resize:"none",outline:"none",lineHeight:"1.5",boxSizing:"border-box"}})})),"image"===t.type&&e.createElement("div",{className:"yt-personalized-form-image-section"},e.createElement("div",{className:"yt-personalized-form-image-hint",style:{fontSize:"12px",color:"#888",marginBottom:"10px"}},"Supported formats - jpeg/png/img (max size: 5MB)"),e.createElement("div",{className:"yt-personalized-form-image-fields",style:{display:"flex",flexDirection:"column",gap:"10px"}},t.fields.map((t,n)=>{const r=t?.title??"Field "+n;return e.createElement(zs,{key:r,title:t?.title,uploadState:a[r],onUpload:()=>g(r).click(),onRemove:()=>i(e=>{const{[r]:t,...n}=e;return n}),onRetry:()=>g(r).click()})}))))))};function Is({quantity:t,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,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(Cc,{className:"yt-byob-quantity-selector-container"},e.createElement("button",{className:"yt-byob-quantity-minus-button",onClick:e=>{e.stopPropagation();const r=Math.max(0,t-1);n(r),l&&a&&l(a,1)},style:d},"-"),e.createElement(Ec,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(r,t+1,s);n(l),o&&a&&i&&o(a,i,1)},disabled:!p||c,style:{...d,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const Ps=({product:o,styles:a,selectedVariant:i})=>{const[l,c]=t(!1),s=r(()=>Em(i?.image?.url||o?.featuredMedia?.preview?.image?.url||o?.media?.edges?.[0]?.node?.image?.url)||"",[i?.image?.url,o?.featuredMedia?.preview?.image?.url,o?.media?.edges]),d=r(()=>o?.media?.edges?.map(e=>Em(e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean)??[],[o?.media?.edges]),p=r(()=>d?.[1]??s??"",[d,s]);n(()=>{if(s){(new Image).src=s}},[s]);const m=r(()=>s||d?.[0],[s,d]);return e.createElement("div",{className:"yt-byob-image-hover-container",style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:a.general.imageAspectRatio||"1/1"},onMouseEnter:()=>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&&m!==p?0:1,transition:d?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:l?"scale(1.1)":"scale(1)"},src:m,alt:o.title}),m!==p&&e.createElement("img",{className:"yt-byob-image-hover",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",opacity:l?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:l?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0,objectPosition:"top"},src:p,alt:o.title})))},Ds=({product:r,bundle:o,handleAddToBundle:i,hideAddToBundle:l,remainingQuantity:c,themeColor:s,handleRemoveItem:d,transitionActive:p,idx:m,selecteditems:u,customVariantsQuantity:g,currentProductTier:f,showFreebieTierProductPrices:y,tierIndex:x})=>{const b=de(fs),w=o.customizations,v=w?.byob?.variantSelectorType,[C,E]=t(!1),k=w.general?.variantTitleSuffix?r?.variants?.edges:(e=>{if(!e||e.length<2)return e;const t=e.map(e=>e.node.title).map(e=>e.split(" "));let n=[...t[0]];for(let e=1;e<t.length;e++){const r=t[e];let o=0;for(;o<n.length&&o<r.length&&n[n.length-1-o]===r[r.length-1-o];)o++;n=n.slice(n.length-o)}return n.length<1?e:e.map(e=>{const t=e.node.title.split(" "),r=t.slice(0,t.length-n.length).join(" ");return{...e,node:{...e.node,title:r,commonSuffix:n.join(" ")}}})})(r?.variants?.edges);if(!k||!k.length)return e.createElement(e.Fragment,null);const T=a(e=>{const t=g?.find(t=>t.variantId===e)?.quantity;if(void 0!==t)return t;if(o?.customProductsQuantity)return o?.customProductsQuantity;const n=k?.find(t=>t.node.id===e),a=n?.node;return a?r.tracksInventory&&a.inventoryItem?.tracked?a.inventoryQuantity>0?a.inventoryQuantity:a.inventoryQuantity<=0&&"continue"===a.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[k,g,r.tracksInventory]),S=k?.find(e=>T(e.node.id)>0)?.node?.id;if(!S&&!w.general.showOutOfStockProducts)return e.createElement(e.Fragment,null);const[N,B]=t(k?.find(e=>T(e.node.id)>0)?.node?.id||k[0]?.node?.id),[F,z]=t(0),[$,I]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===N)?.node,_=T(N||"");n(()=>{const e=u.find(e=>e.variantId===N&&(void 0===x||e.tierIndex===x));z(e?e.quantity:0)},[u,N,x]),n(()=>{const e=()=>{I(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(N&&!k?.some(e=>e.node.id===N)){const e=k.find(e=>T(e.node.id)>0)?.node.id||k[0]?.node?.id;e&&B(e)}},[N,k,T]);const L=r.variants&&r.variants.edges?.length>1&&"customOptions"!==v,R="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,M="53933408435"===R,O="75851235630"===R,V=(e=>{if(e.metafield&&"yourtoken_bundles_app"===e.metafield.namespace&&"categories"===e.metafield.key){if(e.metafield.jsonValue&&Array.isArray(e.metafield.jsonValue))return e.metafield.jsonValue;if(e.metafield.value)try{const t=JSON.parse(e.metafield.value);if(Array.isArray(t))return t}catch(e){console.error("Failed to parse categories:",e)}}return[]})(r),W=V.length>0;return e.createElement(e.Fragment,null,e.createElement(Sc,{borderRadius:w?.byob.borderRadius,borderColor:w?.byob.borderColor,shadowType:w?.byob.shadowType,backgroundColor:w?.byob.cardBackgroundColor,className:"yt-byob-product-container bundle-builder-product-container "+(p?"yt-product-card-transition-active":m%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(_<=0)return;const e={...r,variants:{...r.variants,edges:k},selectedVariant:A};b(e)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent",textAlign:w?.byob?.productCardDetailsAlignment||"left"}},e.createElement(Nc,{className:"yt-byob-image-wrapper"},e.createElement(Ps,{product:r,styles:w,selectedVariant:A}),o?.productCardBadgeText&&e.createElement("div",{className:"yt-byob-product-badge",style:{position:"absolute",top:"0px",left:"0px",backgroundColor:w?.general.primaryColor||"#111",color:w?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:w.byob.borderRadius}},o.productCardBadgeText),L&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Bc,{className:"yt-byob-variant-selector",isCoralHaze:M,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:N||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),B(e.target.value)}},k?.map(t=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,r=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,className:0===T(t.node.id)?"variant-out-of-stock":""},r)})),e.createElement("div",{className:"yt-byob-variant-chevron",style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},e.createElement(h,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"===o?.customizations?.byob?.productCardCategoryVisibility&&W&&e.createElement("div",{className:"yt-byob-product-categories-wrapper",style:{padding:"2px 4px"}},e.createElement("div",{className:"yt-byob-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},V.slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-byob-category-tag",key:n,style:{fontSize:$?"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(Fc,{isMobile:$,showBorder:o?.showBorder??!0,style:{...!w?.byob.productsPriceVisibility&&{padding:"8px"},...w?.byob.productTitleFontSize&&{fontSize:w?.byob.productTitleFontSize||"18px"}},className:"yt-byob-product-title-wrapper"},e.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:w?.byob?.productTitleWrapLines||2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"},className:"yt-byob-product-title"},O?String(A?.displayName).replace("- Default Title",""):r.title,A?.commonSuffix?" -"+A?.commonSuffix:""))),"Default Title"!==A?.title&&w?.byob?.showVariantTitleInCard&&e.createElement("p",{style:{padding:o?.showBorder??1?"0px 10px":"0 4px",fontSize:"12px",margin:"0",fontWeight:"600",color:"#888",lineHeight:"normal"},className:"yt-byob-product-variant-title"},A?.title),"ratingOnly"===(w?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.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($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===(w?.byob?.productRatingsDisplay??o?.reviewRatingType)&&(r?.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($e,{color:"gold",size:14})," ",r?.rating?.averageRating,e.createElement(ke,{className:"yt-byob-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),w?.byob.productsPriceVisibility&&e.createElement("div",{className:"yt-byob-product-price yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:o?.showBorder?"0px 10px":"0 4px"}},f?.isFreebieTier&&!y?e.createElement(e.Fragment,null,e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px",textDecoration:"line-through",color:"#888",marginRight:"6px"}},Cm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",vm(A?.price)),e.createElement("span",{className:"yt-byob-current-price",style:{color:w.general.primaryColor||"#d32f2f",fontWeight:"bold"}},"FREE")):parseFloat(A?.price??"0")>0?e.createElement("span",{className:"yt-byob-current-price"},Cm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",vm(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!f?.isFreebieTier||y)&&A?.compareAtPrice&&w?.byob.compareAtPriceVisibility&&parseFloat(A.compareAtPrice)>parseFloat(A?.price)&&e.createElement("span",{className:"yt-byob-compare-price yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Cm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",vm(A.compareAtPrice)))),(_>0||_===1/0)&&e.createElement(zc,{borderRadius:w?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===F||void 0===F)&&e.createElement(kc,{style:{...!l&&{backgroundColor:w?.general.primaryColor||"#111",color:w?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),z(1),(()=>{if(!N)return;"customOptions"===v&&k.length>1?E(!0):i(N,r,1)})()},className:"yt-byob-add-to-bundle-button yt-product-atc-button"},w?.byob.addToBundleCTAText),!o?.disableQuantitySelector&&F>0&&N&&e.createElement(Tc,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Is,{remainingQuantity:c,setQuantity:z,quantity:F,handleAddToBundle:i,variantId:N,product:r,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:_})),o?.disableQuantitySelector&&F>0&&N&&e.createElement(kc,{style:{backgroundColor:"#747474",color:w?.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($c,{className:"yt-byob-added-text yt-product-atc-single-qty-selector-added"},"ADDED"),e.createElement(Ic,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,F-1);z(t),d&&N&&d(N,x)}},e.createElement(We,{style:{color:"#fff",fontSize:"20px"}})))),_<=0&&_!==1/0&&e.createElement(kc,{style:{backgroundColor:w.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},w?.general.outOfStockLabel||"Out of Stock")),"customOptions"===v&&C&&k.length>1&&e.createElement(vs,{product:r,isOpen:C,onClose:()=>E(!1),variantOptions:o.variantOptions,cta:{textColor:w.general.ctaTextColor,backgroundColor:w.general.primaryColor},onConfirm:e=>{B(e),i(e,r,1)}}))},As=({currentStep:t,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,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:r}).map((c,d)=>{const p=d+1,m=!o[d].isFormStep&&o[d].minimumQuantity-(i[d]?.length??0)===0,u=d===t;return l="black"===l?"#000000":l,e.createElement(e.Fragment,{key:p},e.createElement("div",{className:"yt-byob-stepper-step-wrapper",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===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:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),e.createElement("div",{className:"yt-byob-stepper-step-circle",style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?"white":m?`${l}50`:"white",border:`2px solid ${u?"#666666":m?l:"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),e.createElement("div",{className:"yt-byob-stepper-step-right-bar",style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?"#666666":m?l:"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))})),e.createElement("div",{className:"yt-byob-stepper-title",style:{margin:a?"16px 0px":"15px 0px",fontSize:a?"16px":"18px",padding:"4px",background:"rgba(0, 0, 0, 0.03)",borderBottom:"1px solid rgba(130, 130, 130, 0.28)"}},o[t]?.title)),_s=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)}, ${parseInt(n.substring(2,4),16)}, ${parseInt(n.substring(4,6),16)}, ${t})`};return"tabs"===t?.byob?.categoryFilterOnPage?e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-byob-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...r].map(r=>{const a=o===r;return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?t.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(t.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${t?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-byob-category-filter-wrapper",style:{overflowX: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",...r].map(r=>e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-byob-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?t?.general.primaryColor:"#e0e0e0"}`,borderRadius:t?.general.ctaBorderRadius,backgroundColor:o===r?t?.general.primaryColor:"white",color:o===r?"white":"#333",cursor:"pointer",transition:"all 0.3s ease",outline:"none",whiteSpace:"nowrap",minWidth:"fit-content",flexShrink:0},onMouseEnter:e=>{o!==r&&(e.currentTarget.style.borderColor=t?.general.primaryColor,e.currentTarget.style.color=t?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1)))))},Ls=({bundle:i,selectedItems:l,setSelectedItems:c,handleAddToCart:s,bundleAddToCartLoading:d,renderingOnPage:p,selectedItemsQuantity:m,handleRemoveItem:u,bundleSubtotal:g,dispatchAnalyticsEvent:f,fetchStoreDetails:y,productsPagination:x,categoryFilters:h})=>{const[b,w]=t(void 0),[v,C]=t(window.innerWidth<450),[E,k]=t(0),[T,S]=t({}),N=!!i.personalizedForm?.title&&"productTier"===i.builderTiers?.type,[B,F]=t({}),[z,$]=t(!1),I=N&&E===(i.builderTiers?.productTier?.length||0),P=E===(i.builderTiers?.productTier?.length||0)-1,D=N&&P&&!I,[A,_]=t(i?.products),[L,R]=t(!1),[M,O]=t({}),[V,W]=t(20),H=o(null),[j,q]=t(i?.products),[U,Q]=t({}),[Z,G]=t(x?.cursorData),Y=i.builderTiers?.type,X=i.customizations,K=i.builderTiers?.productTier??[],J=i.builderTiers?.offerTier??[],[ee,te]=t("All"),ne=o(null),re=o(!0);n(()=>(re.current=!0,()=>{re.current=!1}),[]);const[oe,ae]=t({}),ie=o(void 0),le=o({appliedFilters:oe,currentProductTier:E,tierType:Y}),[se,de]=t([]),[pe,me]=t(!1),[ue,ge]=t(0),[ye,xe]=t(0),[he,be]=t({}),we=e=>{be(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{se.length>0&&be(e=>{const t={...e};return se.forEach(e=>{void 0===t[e.id]&&(t[e.id]=!1)}),t})},[se]),n(()=>{!(Object.values(oe).length>0)&&x?.cursorData&&G(x.cursorData)},[oe,x?.cursorData]);const ve=i.customStoreDetails?.fixedInventoryDetails;n(()=>{X?.byob?.productFiltersDisplay&&"none"!==X?.byob?.productFiltersDisplay&&(async()=>{const e=X?.byob?.productFiltersDisplay??"none";if("drawer"===e||"sidebar"===e)try{const e=await(y?.());e?.productFilters&&de(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[X?.byob,y]);const Ce=r(()=>{if(!h)return;const e=K[E]?.tier,t="productTier"===Y?e:1,n="object"!=typeof h||Array.isArray(h)||h.id?h:h[t];if(!n)return;const r=Array.isArray(n)?n.find(e=>"filter.p.m.categories"===e.id||"categories"===e.label):n;return r&&r.values?{...r,values:[...r.values].sort((e,t)=>e.label.localeCompare(t.label,void 0,{sensitivity:"base",numeric:!0}))}:void 0},[h,E,K]),Ee=r(()=>{const e=(Ce?.values?.map(e=>e.label)??[])?.filter(e=>"All"!==e);return e},[Ce]),ke=Ee.length>0;n(()=>{ae({})},[E,ee]);const Te=((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}))(A.filter(e=>{const t=e.productDetails.status?.toLowerCase(),n="active"===t||"unlisted"===t||void 0===e.productDetails.status||""===e.productDetails.status,r="estailofashion.myshopify.com"!==window?.Shopify?.shop||null!==e?.productDetails?.publishedAt;return n&&r}),ee),Se="productTier"===Y?K.reduce((e,t)=>e+t.minimumQuantity,0):"offerTier"===Y?J.reduce((e,t)=>e+t.minimumQuantity,0):i.minimumQuantity,Ne=a((e,t)=>{const n=ve?.find(e=>e.variantId===t)?.quantity;if(void 0!==n)return n;const r=(e.variants?.edges||[]).find(e=>e.node.id===t),o=r?.node;return o?e.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[ve]),[Be,Fe]=t(3e3);n(()=>{const e=se?.find(e=>"PRICE_RANGE"===e.type||"filter.v.price"===e.id);e&&e.values?.[0]?.input?.price?.max&&Fe(e.values[0].input.price.max)},[A,se]);const[ze,$e]=t(""),[Ie,Pe]=t(""),De=((e,t)=>e.filter(e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase())))(Te,ze),Ae=((e,t)=>[...e].sort((e,n)=>{const r=e?.productDetails?.title?.toLowerCase(),o=n?.productDetails?.title?.toLowerCase(),a=parseFloat(e?.productDetails?.variants?.edges?.[0]?.node?.price||"0"),i=parseFloat(n?.productDetails?.variants?.edges?.[0]?.node?.price||"0");switch(t){case"title-asc":return r.localeCompare(o);case"title-desc":return o.localeCompare(r);case"price-low-to-high":return a-i;case"price-high-to-low":return i-a;default:return 0}}))(De,Ie);n(()=>{(async e=>{if(!x)return;const{initialCursorData:t,cursorData:n,fetchFn:r,setCursorData:o}=x,a="productTier"===Y?K?.[E]?.tier:1;if(0===Object.values(e)?.length)return void("productTier"===Y?(O(e=>({...e,[E]:U?.[E]||[]})),o(Z||{...n})):(_(j),o(Z||{1:t?.[1]})));const i=await r(e,a,null);re.current&&i&&("productTier"===Y?(O(e=>({...e,[E]:i})),_(e=>{const t=new Set(e.map(e=>e.productId)),n=i.filter(e=>!t.has(e.productId));return[...e,...n]})):_(i))})(oe)},[oe]);const[_e,Le]=ce(fs),[Re,Me]=t(!1);n(()=>{f?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:i?._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder"}}),setTimeout(()=>{Me(!0)},100)},[]);const Oe=o(null);n(()=>{const e=()=>{C(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),n(()=>{if(i.coverImageUrl){const e=new Image;e.src=Em(i.coverImageUrl)??"",e.onload=()=>{w(e.width/e.height)}}},[i.coverImageUrl]),n(()=>{Me(!1),setTimeout(()=>Me(!0),100)},[E]);const Ve=(e,t)=>{if("productTier"===Y){let n={...T},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=K.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}S(n);const o=K.findIndex((e,t)=>n[t]?.length<e.minimumQuantity);-1!==o&&k(o)}u(e,t)},We=()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})};n(()=>{if(i){if("productTier"!==i?.builderTiers?.type)return _(i?.products??[]),void q(i?.products??[]);if(i?.workWithoutPagination){if("productTier"===i?.builderTiers?.type){const e={};i.builderTiers.productTier?.forEach((t,n)=>{const r=t.products.map(e=>{const t=i?.products?.find(t=>t.productId===e.productId);return t?{...t,variantIds:e.variantIds?.length?e.variantIds:t.variantIds}:null}).filter(Boolean);e[n]=r}),O(e),Q(e)}}else"productTier"===i?.builderTiers?.type&&(O({0:i?.products}),Q({0:i?.products}))}},[i]),n(()=>{if("productTier"!==Y||!K[E])return;if(Se===m)return;const e=K.findIndex((e,t)=>{const n=T[t]||[];return t>=E&&n.length<e.minimumQuantity});if(-1!==e&&e!==E){k(e);const t=K[E];t?.products?.length>1&&We()}else if(-1===e&&N&&E<K.length){K.every((e,t)=>(T[t]?.length||0)>=e.minimumQuantity)&&k(K.length)}},[T,K,Y,N]),n(()=>{$e(""),te("All")},[E]),n(()=>{function e(e){if(!Oe.current||!e.target)return;!Oe.current.contains(e.target)&&Le(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const He=(e,t,n)=>{var r;"productTier"===Y&&(r=e,S(e=>{const t={...e},n=K.findIndex((e,n)=>{const r=t[n]||[];return n>=E&&r.length<e.minimumQuantity}),o=-1!==n?n:E;return-1!==n&&k(n),t[o]||(t[o]=[]),t[o].push(r),t}));const o=!0===K[E]?.isFreebieTier;f?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",addedProduct:{id:t?.id,title:t?.title}}}),km(e,t,n,l,c,o,E)},je=(()=>{if(!i?.builderTiers)return i.minimumQuantity;const{type:e,offerTier:t,productTier:n}=i.builderTiers,r="offerTier"===e?t:"productTier"===e?n:null;if(!r)return i.minimumQuantity;let o=0;return r.map(e=>{o+=e.minimumQuantity}),o})(),qe=v&&i.mobileCoverImageUrl?Em(i.mobileCoverImageUrl):Em(i.coverImageUrl??"")||null,Ue=a(e=>{const t=X?.general?.showOutOfStockProducts;if(t)return!0;const n=e?.productDetails,r=n?.variants?.edges||[];if(ve){if(r.some(e=>ve.some(t=>t.variantId===e.node.id&&t.quantity>0)))return!0}return r.some(e=>Ne(n,e.node.id)>0)},[X?.general?.showOutOfStockProducts,ve,Ne]),Qe=r(()=>{if("productTier"===Y&&K.length>0){const e=M?.[E]??[];return Ie?Ae.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Ue(t)):e.map(e=>Ae.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Ue(e))}return Ae.filter(Ue)},[Y,K,M,E,Ae,Ue,Ie]),Ze=Qe;n(()=>{if("productTier"!==Y)return;const e=K[E];if(!e)return;if(1!==e.minimumQuantity)return;if(1!==e.products.length)return;if(1!==M?.[E]?.length)return;const t=e.products[0],n=A.find(e=>e.productId===t.productId)?.productDetails;if(!n)return;if(n.variants?.edges?.length>1)return;const r=n.variants?.edges?.find(e=>Ne(n,e.node.id)>0)?.node;if(!r)return;const o=r.id,a=T[E]?.includes(o);if(!a&&(He(o,n,1),E<K.length-(N?0:1))){k(E+1);const e=K?.[E];e?.products?.length>1&&We()}},[Y,K,E,A,T,Ne,He]);const Ge=r(()=>Te.filter(e=>{const t=e?.productDetails;return(t.variants?.edges||[]).some(e=>Ne(t,e.node.id)>0)}).length,[Te,Ne]),Ye=r(()=>Te.length-Ge,[Te,Ge]),Xe="bundles"==i.appName?i.pageHeader?.title:i?.title,Ke="bundles"==i.appName?i.pageHeader?.description:i?.subtitle,Je=["6a3bbae2bd8dcb5d8fa51920","6a33aedda23f4f475eabe035","6a3cfd33bce20f2427f4bd62"].includes(i._id),et=r(()=>{if(i?.workWithoutPagination)return!1;if(!Je)return!1;if(!x)return!1;const e="productTier"===Y?K[E]?.tier:1;if(void 0===e)return!1;const t=x.cursorData?.[e];return t?t.hasNext:L},[i?.workWithoutPagination,Je,x,Y,K,E,L]);n(()=>{if(i?.workWithoutPagination)return;if(Je)return;if(!x)return;const{cursorData:e,fetchFn:t}=x,n=K[E]?.tier,r="productTier"===Y?n:1;if(e?.[r]&&!e?.[r]?.hasNext||!t)return;const o=new IntersectionObserver(async([n])=>{if(n.isIntersecting&&!L){R(!0);try{const n=await t(oe,r,e?.[r]?.cursor);if(!re.current)return;if(n?.length>0){const e=Object.values(oe).length>0;"productTier"===Y?(O(e=>({...e,[E]:[...e[E]||[],...n]})),e||Q(e=>({...e,[E]:[...e[E]||[],...n]})),_(e=>[...e,...n])):(_(e=>[...e,...n]),e||q(e=>[...e,...n]))}}catch(e){console.error("Pagination fetch failed:",e)}finally{re.current&&R(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),a=ne.current;return a&&o.observe(a),()=>{a&&o.unobserve(a)}},[i?.workWithoutPagination,x,L,Y,E,K]),n(()=>{if(i?.workWithoutPagination)return;if(!Je)return;if(!x)return;const{cursorData:e,fetchFn:t}=x,n=K[E]?.tier,r="productTier"===Y?n:1;if(!t)return;const o=le.current;(o.currentProductTier!==E||o.tierType!==Y||JSON.stringify(o.appliedFilters)!==JSON.stringify(oe))&&(ie.current=void 0,le.current={appliedFilters:oe,currentProductTier:E,tierType:Y});if(!(!e?.[r]||e[r].hasNext))return void R(!1);(async()=>{const n=e?.[r]?.cursor||null;if(ie.current!==n){ie.current=n,R(!0);try{const e=await t(oe,r,n);if(!re.current)return;if(e?.length>0){const t=Object.values(oe).length>0;"productTier"===Y?(O(t=>({...t,[E]:[...t[E]||[],...e]})),t||Q(t=>({...t,[E]:[...t[E]||[],...e]})),_(t=>[...t,...e])):(_(t=>[...t,...e]),t||q(t=>[...t,...e]))}}catch(e){console.error("Fetch all products pagination error:",e)}finally{re.current&&R(!1)}}})()},[i?.workWithoutPagination,Je,x,E,oe,Y]),n(()=>{if(!Je&&!i?.workWithoutPagination)return;if(et)return;if(!H.current)return;const e=new IntersectionObserver(([e])=>{e.isIntersecting&&V<Qe.length&&W(e=>Math.min(e+20,Qe.length))},{rootMargin:"200px"});return e.observe(H.current),()=>e.disconnect()},[Je,et,V,Qe.length]),n(()=>{W(20)},[E,Qe.length,Je,i?.workWithoutPagination]);const tt=()=>{f?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:i._id,bundleType:"byob-page-bundle",byobBundleType:i.builderTiers?.type??"builder",selectedProducts:l.map(e=>({id:e?.product?.id,title:e?.product?.title,quantity:e?.quantity}))}})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-builder-section",style:{display:"flex",flexDirection:"column",width:"100%",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:X.byob.sectionBackgroundColor,..."transparent"!==X.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},qe?e.createElement("div",{className:"yt-byob-cover-image-container",style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...i?.coverImageVerticalMargin&&{marginBottom:i?.coverImageVerticalMargin,marginTop:i?.coverImageVerticalMargin}}},qe&&e.createElement(Es,{coverImageUrl:qe,alt:"Background",styles:{width:"100%",height:"auto",display:"block"}}),e.createElement("div",{className:"yt-byob-cover-image-overlay",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px",textShadow:"2px 2px 8px rgba(0, 0, 0, 0.4)"}},e.createElement("span",{style:{lineHeight:"normal",fontSize:X?.byob?.titleFontSize??"3rem",fontWeight:"700",color:X?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:X?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},Xe),e.createElement("span",{style:{lineHeight:"normal",fontSize:X?.byob?.subtitleFontSize??"1.5rem",color:X?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},Ke))):(Xe||Ke)&&e.createElement("div",{className:"yt-byob-header-content",style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},Xe&&e.createElement("span",{className:"bundle-builder-title",style:{lineHeight:"normal",fontSize:X?.byob?.titleFontSize??"3rem",fontWeight:"700",color:X?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:X?.byob?.titleBackgroundColor??"transparent"}},Xe),Ke&&e.createElement("span",{className:"bundle-builder-subtitle",style:{lineHeight:"normal",fontSize:X?.byob?.subtitleFontSize??"1.5rem",color:X?.byob?.titleTextColor??"#000"}},Ke)),e.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===Y&&K.length>0&&X?.byob.productTiersVisibility&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-byob-stepper-wrapper"},e.createElement(As,{currentStep:E,totalSteps:K.length+(N?1:0),tiers:N?[...K,{title:i.personalizedForm?.title||"Personalize",tier:K.length,minimumQuantity:0,products:[],isFormStep:!0}]:K,isMobile:v,primaryColor:X?.general?.primaryColor,primaryTextColorCta:X?.general?.primaryContrastColor,setCurrentProductTier:k,selectedProductsByTier:T,tierNavigation:X.byob.tierNavigation})))),e.createElement("div",{className:"yt-byob-layout-wrapper",style:{display:"flex",flexDirection:"row",width:v?"100%":"90%",marginInline:"auto"}},"sidebar"===X?.byob?.productFiltersDisplay&&!v&&!I&&e.createElement(Ns,{showFiltersDrawer:pe,handleClose:()=>me(!1),isAnimating:!1,isMobile:!1,availableFilters:se,appliedFilters:oe,toggleFilter:(e,t)=>{ae(n=>{const r=n[e]||[],o=r.includes(t)?r.filter(e=>e!==t):[...r,t],a={...n,[e]:o.length?o:void 0};return Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e))})},clearAllFilters:()=>{ae({}),xe(0),ge(Be)},applyPriceFilter:()=>{ae(e=>{const t={...e};return t["filter.v.price"]=[`min:${ye}-max:${ue}`],t})},priceMin:ye,setPriceMin:xe,priceMax:ue,setPriceMax:ge,maxPossiblePrice:Be,styles:X,products:A,unavailableProductCount:Ye,storeCurrencyCode:i?.storeCurrencyCode,openSections:he,toggleSection:we}),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(Bs,{enableSortAndFilter:i?.enableSortAndFilter??!1,isMobile:v,searchTerm:ze,setSearchTerm:$e,setSortBy:Pe,styles:X,appliedFilters:oe,setAppliedFilters:ae,availableFilters:se,products:A,availableProductCount:Ge,unavailableProductCount:Ye,maxPossiblePrice:Be,storeCurrencyCode:i?.storeCurrencyCode,sharedFiltersState:{showFilters:pe,setShowFilters:me,priceMax:ue,setPriceMax:ge,priceMin:ye,setPriceMin:xe},openSections:he,toggleSection:we}),i?.customizations?.byob?.enableProductCategories&&ke&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(_s,{styles:X,isMobile:v,categories:Ee,activeCategory:ee,onCategoryChange:e=>{te(e)}}))),e.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:pe&&"sidebar"===X?.byob?.productFiltersDisplay?"flex-start":"center",width:"100%",height:"fit-content",paddingBottom:p?"100px":"20px"},className:"products-display"},I&&i.personalizedForm?.title?e.createElement($s,{form:i.personalizedForm,formData:B,setFormData:F,isUploading:z,setIsUploading:$}):0!==Ze?.length||L||et?(Je?Qe.slice(0,V):Qe).map((t,n)=>{if("productTier"===Y){const r=(K[E]?.minimumQuantity??0)>(T[E]?.length??0),o=Ae.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return o?e.createElement(Ds,{bundle:i,idx:n,key:t?.variantIds?.[0]??t.productId,product:o?.productDetails,handleAddToBundle:He,hideAddToBundle:!r,remainingQuantity:je-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>Ve(e,E),selecteditems:l,transitionActive:Re,customVariantsQuantity:ve,currentProductTier:K[E],showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,tierIndex:E}):null}return e.createElement(Ds,{bundle:i,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:He,hideAddToBundle:m>=je,remainingQuantity:je-m,themeColor:i?.dealTextColor,handleRemoveItem:e=>u(e),selecteditems:l,transitionActive:Re,customVariantsQuantity:ve,tierIndex:E})}):e.createElement("div",{className:"yt-byob-empty-state",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",padding:"40px 20px",gap:"16px"}},e.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",margin:0}},Object.values(oe).length>0?"No products match your filters":"No products found"),Object.values(oe).length>0&&e.createElement("button",{onClick:()=>{ae({}),xe(0),ge(Be)},style:{padding:"8px 16px",background:X?.general?.primaryColor||"#333",color:"white",border:"none",borderRadius:X?.byob?.borderRadius||"8px",cursor:"pointer",fontWeight:600,fontSize:"14px"}},"Clear All Filters")),!I&&(L||et)&&e.createElement("div",{className:"yt-byob-loading-wrapper",style:{width:"100%",display:"flex",justifyContent:"center",padding:"20px"}},e.createElement(fe,{color:X?.general?.primaryColor||"#333",size:30})),!Je&&!i?.workWithoutPagination&&e.createElement("div",{ref:ne,className:"yt-byob-pagination-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null)),(Je||i?.workWithoutPagination)&&!et&&e.createElement("div",{ref:H,className:"yt-byob-virtualFetchAll-observer",style:{height:"1px",width:"100%",display:"block"}},e.createElement("span",null))),!p&&e.createElement(gs,{builderTiers:i?.builderTiers,showNextStep:D,handleAddToCart:async e=>{if(D)return k(E+1),void We();const t={};N&&Object.entries(B).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await s(e,t),tt()},minimumQuantity:Se,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:Ve,selectedItemsQuantity:m,percentageOff:i.percentageOff,loading:d,bundleSubtotal:g,amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:i?.dealTextColor??"#333",primaryTextColorCta:i?.primaryTextColorCta??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:T,renderingOnPage:p,isUploading:z}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(gs,{showNextStep:D,handleAddToCart:async e=>{if(D)return k(E+1),void We();const t={};N&&Object.entries(B).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),await s(e,t),tt()},minimumQuantity:Se,builderTiers:i?.builderTiers,selectedProducts:l,showProductDetailsInTracker:i.showProductDetailsInTracker,loading:d,handleRemoveItem:u,handleRemoveItemProductTier:Ve,percentageOff:i.percentageOff,selectedItemsQuantity:m??0,bundleSubtotal:g??{price:0,compareAtPrice:0},amountOff:i.amountOff,styles:i.customizations,dealAmount:i.dealAmount,discountType:i.discountType,themeColor:X?.general.primaryColor||"#000",primaryTextColorCta:X.general.primaryContrastColor??"#fff",cornerRadiusType:i?.cornerRadiusType??"",selectedProductsByTier:T,renderingOnPage:p,isUploading:z})))),_e&&void 0!==m&&(()=>{let t=m<i.minimumQuantity;return"productTier"==Y?t=(K[E]?.minimumQuantity??0)>(T[E]?.length??0):"offerTier"==Y&&(t=m<J.reduce((e,t)=>e+t.minimumQuantity,0)),e.createElement(Cs,{handleAddToBundle:He,ref:Oe,remainingQuantity:i.minimumQuantity-m,hideAddToBundle:!t,disableQuantitySelector:i?.disableQuantitySelector??!1,selectedProducts:l,selectedProductsByTier:T,themeColor:X?.general.primaryColor||"#000",primaryTextColorCta:i?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:X?.general.primaryColor||"#000",cornerRadius:i?.customizations.byob.borderRadius,styles:i.customizations,reviewRatingType:X?.fixedBundle?.productRatingsDisplay??i?.reviewRatingType,customVariantsQuantity:ve,bundleProductsCustomQuantity:i?.customProductsQuantity,isFreebieTier:K?.[E]?.isFreebieTier,showFreebieTierProductPrices:i?.customStoreDetails?.showFreebieTierProductPrices,bundleVariantOptions:i?.variantOptions})})()))},Rs=({isOpen:r,onClose:o,formConfig:a,onCheckout:i,cta:l,isMobile:c})=>{const[s,d]=t({}),[p,m]=t(!1);n(()=>{r||d({})},[r]);const u=e=>{if(p)return;const t={};Object.entries(s).forEach(([e,n])=>{const r=e.split("|").pop()?.replace(/^f_\d+$/,"")||e;"string"==typeof n&&n.trim()?t[r]=n:n&&"object"==typeof n&&"url"in n&&(t[r]=n.url)}),i(e?{}:t)};if(!r)return null;const g=e.createElement("div",{className:"yt-personalized-form-modal-overlay",onClick:o,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems: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",{className:"yt-personalized-form-modal",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",{className:"yt-personalized-form-modal-header",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"}},a.title||"Personalization",!c&&e.createElement("button",{className:"yt-personalized-form-modal-close",onClick:o,style:{position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",fontSize:"24px",lineHeight:1,cursor:"pointer",color:"#666",padding:"4px"}},"×")),e.createElement("div",{className:"yt-personalized-form-modal-body",style:{flex:1,overflowY:"auto",padding:c?"20px 20px":"16px 20px"}},e.createElement($s,{form:a,formData:s,setFormData:d,isUploading:p,setIsUploading:m})),e.createElement("div",{className:"yt-personalized-form-modal-footer",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",{className:"yt-personalized-form-submit-button",onClick:()=>{u(),o()},disabled:p,style:{width:"100%",fontSize:"15px",fontWeight:700,textAlign:"center",padding:"15px 0",border:"none",borderRadius:"10px",cursor:p?"not-allowed":"pointer",opacity:p?.7:1,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:l.backgroundColor,color:l.textColor,letterSpacing:"0.01em"}},p?e.createElement(fe,{color:l.textColor,size:15}):"Submit"),e.createElement("button",{className:"yt-personalized-form-skip-button",onClick:()=>{u(!0),o()},style:{background:"none",border:"none",fontSize:"14px",fontWeight:600,color:"#1a1a1a",cursor:"pointer",padding:"4px 8px",textAlign:"center"}},"Add without customization"))));return D.createPortal(g,document.body)},Ms=({product:t,selectedVariantId:n,onVariantChange:o,styles:a,originalPrice:i,dealPrice:l,totalPriceSum:c,isVertical:s=!1,variantOptions:d,storeCurrencyCode:p,reviewRatingType:m})=>{const u=r(()=>e=>{const n=t?.productDetails?.variants?.edges?.find(t=>t.node.id===e),r=n?.node;return r?t.productDetails.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[t.productDetails]),g=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===n)?.node;u(n);const f=r(()=>{if(g?.title&&t.productDetails.options){const e=g.title.split(" / ");if(e.length===t.productDetails.options.length)return e}return t.productDetails.options?.map(e=>e.values[0])||[]},[g,t.productDetails.options]),y=e=>{o(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%"}},a.comboBundle.subProductsImageVisibility&&e.createElement(e.Fragment,null,e.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Em(g?.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:a.general?.imageAspectRatio||"1/1"}}),e.createElement("div",{className:"yt-comboBundle-product-variant-selector-container-vertical",style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},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=>y(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(h,null)))))),(a.comboBundle.subProductsProductTitleVisibility||a.comboBundle.subProductsProductPriceVisibility||m)&&e.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},t?.productDetails?.title),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingBlock:"6px",lineHeight:"normal",fontWeight:"500"}},e.createElement($e,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(ke,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Cm(a.general.currencySymbol),vm((Number(g?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Cm(a.general.currencySymbol),vm(g?.compareAtPrice?g.compareAtPrice:g?.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"}},Cm(a.general.currencySymbol),vm(g?.price)))))):e.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===a.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===a.comboBundle.infoAlignment&&{justifyContent:"center"}},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fafafa",e.currentTarget.style.border="1px solid #DFDFDF"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.border="1px solid transparent"}},a.comboBundle.subProductsImageVisibility&&e.createElement("div",{className:"yt-comboBundle-product-image-wrapper-horizontal"},e.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Em(g?.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:a?.general?.imageAspectRatio||"1 / 1",height:"100px"}})),e.createElement("div",{className:"yt-comboBundle-product-info-horizontal",style:{display:"flex",flexDirection:"column",alignItems:"left"===a.comboBundle?.infoAlignment?"flex-start":"right"===a.comboBundle?.infoAlignment?"flex-end":"center"===a.comboBundle?.infoAlignment?"flex-start":void 0}},a.comboBundle.subProductsProductTitleVisibility&&e.createElement("span",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},e.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",t?.productDetails?.title," "),"dropdown"!==a.comboBundle.comboVariantTypeSelector&&t.productDetails.variants.edges.filter(e=>"Default Title"!==e.node.title).length>0&&d&&f&&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"}},f.length>1?f.join(" / "):f)),"ratingOnly"===m&&(t?.productDetails.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},t?.productDetails?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===m&&(t?.productDetails?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-comboBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"12px",color:"#3f3f3f",paddingTop:"4px",paddingBottom:"0px",lineHeight:"normal",fontWeight:"500"}},e.createElement($e,{color:"gold",size:14})," ",t?.productDetails?.rating?.averageRating,e.createElement(ke,{className:"yt-comboBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",t?.productDetails?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),a.comboBundle.subProductsProductPriceVisibility&&e.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},e.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Cm(a.general.currencySymbol),vm((Number(g?.price||0)/Number(c)*Number(l)).toFixed(2))),!1!==a.comboBundle.discountBadgeVisibility&&("discount-on-compare"===a.comboBundle.discountBadgeDisplay?e.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Cm(a.general.currencySymbol),vm(g?.compareAtPrice?g?.compareAtPrice:g?.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"}},Cm(a.general.currencySymbol),vm(g?.price)))),t.productDetails.variants.edges.length>1&&("dropdown"===a.comboBundle.comboVariantTypeSelector?e.createElement("div",{className:"yt-comboBundle-product-variant-dropdown-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e.createElement("select",{className:"yt-comboBundle-product-variant-select-horizontal",value:n,onChange:e=>y(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(h,null))):t.productDetails.options.length>0?e.createElement(e.Fragment,null,t.productDetails.options.map((n,r)=>e.createElement("div",{key:n.name,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},t.productDetails.options.length>1&&n?.values?.length>1&&e.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map(o=>{const i=[...f];i[r]=o;const l=t.productDetails.options.length>0?i.join(" / "):i[r],c=t.productDetails.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?u(c.id):0),p=f[r]===o,m=d&&d?.options?.find(e=>e.name===n.name);return m&&"color"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-color ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&y(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:p&&!s?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},m?.values.find(e=>e.name===o)?.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===o)?.value}},e.createElement("span",null)):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${a.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):m&&"image"===m?.type?e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-image ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&y(c.id)},disabled:s,style:{border:p&&!s?`1px solid ${a.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===o)?.value?e.createElement("img",{className:"yt-comboBundle-product-option-image",src:Em(m?.values.find(e=>e.name===o)?.value||"/placeholder.svg"),alt:o,style:{width:p&&!s?"26px":"24px",height:p&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{key:o,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:p&&!s?`1px solid ${a.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:p&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},o)):e.createElement("button",{key:o,className:`yt-comboBundle-product-option-button-text ${p?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&y(c.id)},disabled:s,style:{padding:"4px 8px",border:p&&!s?`1px solid ${a.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}},o)}))))):e.createElement(e.Fragment,null,t?.productDetails?.variants?.edges?.length>1&&e.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},t?.productDetails?.variants?.edges.map(t=>{const r=0===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":""} ${r?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>y(t?.node?.id),disabled:r,style:{padding:"4px 8px",border:n===t?.node?.id?`1px solid ${a.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===t?.node?.id?"#F7F7F7":"transparent",color:r?"#ccc":"#707070",cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:"500",opacity:r?.5:1}},t?.node?.title)}))))))},Os=({bundle:o,addToCartFunction:a,dispatchAnalyticsEvent:i})=>{const[l,c]=t(!1),[s,d]=t(window.innerWidth<786),[p,m]=t(!1),u=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,f]=t(()=>{const e={};return o.products.forEach((t,n)=>{const r=t.productDetails?.variants?.edges?.find(e=>u(t.productDetails,e?.node?.id)>0)?.node;e[n]=r?r.id:t?.productDetails?.variants?.edges[0]?.node?.id}),e}),y=o.products?.every((e,t)=>{const n=g[t];return u(e.productDetails,n)>0});n(()=>(a&&(window.ytComboBundle={bundle:o,addToCart:a,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}))}),[o,a,g]);const x=(e,t)=>{f(n=>({...n,[e]:t}))},h=async e=>{const t=Object.entries(g).map(([e])=>({id:o.products[parseInt(e)].productId,title:o.products[parseInt(e)]?.productDetails?.title}));i?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:o._id,bundleType:"combo-bundle",selectedProducts:t}});try{if(c(!0),!a)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void c(!1);const t=Object.entries(g).map(([e,t])=>{const n=o.products[parseInt(e)],r=n.productDetails.variants.edges.find(e=>e.node.id===t)?.node;return r?{variantId:t,price:Number(r.price)}:null}).filter(e=>null!==e),n=Object.values(g);await a(Number(C),n,Number(E),t,e)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}c(!1)},b=o.customizations,w=b?.comboBundle?.discountBadgeDisplay||"discount-on-compare",v=b?.comboBundle?.discountBadgeVisibility,{originalPrice:C,dealPrice:E,offerValue:k,totalPriceSum:T,offerPercentage:S}=r(()=>{const{price:e,compareAtPrice:t}=Object.entries(g).reduce((e,[t,n])=>{const r=o.products[parseInt(t)],a=r.productDetails.variants.edges?.find(e=>e.node.id===n)?.node,i=parseFloat(a?.price??"0"),l=parseFloat(a?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=!1===v?e:"discount-on-price"===w?e:t;let r=e;o?.percentageOff?r=e*(1-o.percentageOff/100):o?.dealAmount?r=o.dealAmount:o?.amountOff&&(r=e-o.amountOff);const a=n-r,i=n>0?Math.round((n-r)/n*100):0;return{originalPrice:n.toFixed(2),dealPrice:r.toFixed(2),offerValue:a.toFixed(2),totalPriceSum:e.toFixed(2),offerPercentage:i}},[g,o.products,o.percentageOff,o.dealAmount,o.amountOff,w,v]);n(()=>{i?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:o._id,bundleType:"combo-bundle"}});const e=()=>{d(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const N=b.comboBundle?.comboCardStyle||"auto",B="vertical"===N||"auto"===N&&!s,F=b.comboBundle?.embedContentVisibility,z="bundles"==o.appName?o.pageHeader?.title:o?.title,$="bundles"==o.appName?o.pageHeader?.description:o?.subtitle;return e.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===b.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===b.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===b.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:b.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===b.comboBundle?.infoAlignment?"flex-start":"right"===b.comboBundle?.infoAlignment?"flex-end":"center"===b.comboBundle?.infoAlignment?"center":void 0,textAlign:b.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},F&&b.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:b.comboBundle?.productTitleFontSize||"28px",color:b.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},z)),F&&b?.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:b.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(b.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"}},Cm(b.general.currencySymbol,o.storeCurrencyCode),vm(E)),!isNaN(Number(C))&&!isNaN(Number(E))&&Number(C)>Number(E)&&e.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:b.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Cm(b.general.currencySymbol,o.storeCurrencyCode),vm(C)),Number(k)>0&&!1!==v&&(()=>{const t="percentage"===(b?.comboBundle?.discountDisplayType||"amount")?`${S}% Off`:`Save ${Cm(b.general.currencySymbol,o.storeCurrencyCode)}${vm(k)}`;return e.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},t)})())),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},e.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:b.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},e.createElement("span",null)),e.createElement("p",{style:{fontSize:b.comboBundle.productDescriptionFontSize||"16px",color:b.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."))),b.comboBundle.subProductsSectionVisibility&&e.createElement(e.Fragment,null,B?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"}},o.products.map((t,n)=>{const r=t?.productDetails?.variants?.edges?.find(e=>e?.node?.id===g[n])?.node;return r?e.createElement(Ms,{key:`combo-product-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>x(n,e),isVertical:B,variantOptions:o.variantOptions,storeCurrencyCode:o.storeCurrencyCode,reviewRatingType:b?.comboBundle?.comboProductRatingsDisplay}):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%"}},b.comboBundle.subProductsSectionVisibility&&o.products.map((t,n)=>e.createElement(Ms,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>x(n,e),variantOptions:o.variantOptions,reviewRatingType:b?.comboBundle?.comboProductRatingsDisplay})))),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 ${y?"":"yt-comboBundle-bundle-cta-button-disabled"} ${s?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:y?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor,color:b.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:b.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:y?"pointer":"not-allowed",border:`1px solid ${y?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor}`,boxShadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,margin:"0"},disabled:!y,onMouseOver:e=>{b.general.customizeHoverState&&y&&(e.currentTarget.style.backgroundColor=b.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=b.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{b.general.customizeHoverState&&y&&(e.currentTarget.style.backgroundColor=b.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=b.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{o?.personalizedForm?.title?m(!0):await h()}},l?e.createElement(fe,{color:"white",loading:l,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):e.createElement(e.Fragment,null,y?b.comboBundle?.ctaTitle??"Add Bundle to cart":b.general.outOfStockLabel||"Out of Stock"," "))),F&&b.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:b.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:b.general.primaryColor+"20"}},"Description"),e.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:b.comboBundle.productDescriptionFontSize||"16px",color:b.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:b.general.primaryColor+"08"}},e.createElement("p",null,$))),o?.personalizedForm?.title&&e.createElement(Rs,{isOpen:p,onClose:()=>m(!1),formConfig:o.personalizedForm,onCheckout:async e=>{await h(e),m(!1)},cta:{backgroundColor:b.general?.ctaBackgroundColor||"#121212",textColor:b.general?.ctaTextColor||"#FFFFFF"},isMobile:s}))},Vs=s.div`
|
|
3156
3156
|
max-width: 800px;
|
|
3157
3157
|
container-type: inline-size;
|
|
3158
3158
|
margin-top: ${e=>e.verticalMargin||"0px"};
|
|
@@ -4676,7 +4676,7 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
|
|
|
4676
4676
|
}
|
|
4677
4677
|
`,tm=s.span`
|
|
4678
4678
|
font-size: 12px;
|
|
4679
|
-
`,nm=({productsWithIndices:o,isOpen:a,onClose:i,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:m})=>{const u=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,f]=t({}),[y,x]=t({});n(()=>{const e={},t={};o?.forEach(({product:n,index:r})=>{let o,a=[];if(n.productId===p&&m){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(m))?.node;e&&u(n.productDetails,e.id)>0&&(a=e.title.split(" / "),o=e)}if(!a.length){const e=n.productDetails.variants.edges.find(e=>u(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(a=e.title.split(" / "),o=e):a=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[r]=a,o&&(t[r]={node:o},s(r,o.id))}),f(e),x(t)},[o,p,m,s,u]),n(()=>{if(!p||!m)return;const e=o?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,r=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(m))?.node;if(r&&u(t.productDetails,r.id)>0){const e=r.title.split(" / ");f(t=>({...t,[n]:e})),x(e=>({...e,[n]:{node:r}})),s(n,r.id)}},[m,p,o,s,u]);const h=(e,t,n,r)=>{const o=[...g[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&u(r.productDetails,i.id)>0},b=(e,t,n)=>{const{product:r}=o?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!r?.productDetails)return;if(!h(e,n,t,r))return;const a={...g};a[e][n]=t,f(a);const i=r?.productDetails?.variants?.edges?.find(t=>t.node.title===a[e].join(" / "))?.node;i&&(s(e,i.id),x(t=>({...t,[e]:{node:i}})))};if(!a)return null;const w=e.createElement(Vp,{className:"yt-fixedBundle-variant-modal_overlay",onClick:i},e.createElement(Wp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Hp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),o?.map(({product:t,index:n},r)=>e.createElement(e.Fragment,null,e.createElement(qp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(Up,{className:"yt-fixedBundle-variant-modal_thumbnail",src:y[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Qp,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(Zp,{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(Yp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((r,o)=>{const a=c&&c?.options?.find(e=>e.name===r.name),i=r.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[o]===e));return 0===i.length||1===i.length&&"Default Title"===i[0]?e.createElement(e.Fragment,null):a&&"color"===a?.type?e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(tm,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a.values.find(e=>e.name===r)?.value?e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:i,color:a.values.find(e=>e.name===r)?.value||r,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},e.createElement("span",null)):e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):a&&"image"===a?.type?e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(tm,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a?.values.find(e=>e.name===r)?.value?e.createElement(em,{className:"yt-fixedBundle-variant-modal_image-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)},src:a.values.find(e=>e.name===r)?.value}):e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(tm,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},"text"===a?.type&&a.values.find(e=>e.name===r)?.value||r)}))}))),r<o.length-1&&e.createElement(Gp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(jp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return D.createPortal(w,document.body)},rm=(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}},om=({options:r,selectedValue:a,onChange:i,type:l="text"})=>{const[c,s]=t(!1),d=o(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(_p,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Lp,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Fp,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(zp,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement($p,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},a&&("color"===l||"image"===l)&&p(a),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},a&&a.name)),e.createElement(Ip,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Pp,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},r?.map(t=>e.createElement(Dp,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(a?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:a?.name===t.name,onClick:()=>{t.disabled||(i(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(Ap,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},am=({product:r,variantOptions:o,selectedVariants:a,onVariantChange:i,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),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[m,u]=t(a||[]);n(()=>{a&&a.length>0&&u(a)},[a]),n(()=>{if(l&&r.variants.edges.some(e=>e.node.id.includes(l))){const e=r.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");u(t)}}},[l,r]);const g=e=>{if(!o?.options)return"text";const t=o.options.find(t=>t.name===e);return t?.type||"text"},f=(e,t)=>{const n=m[t];if(!n)return null;return y(e,t).find(e=>e.name===n)||null},y=(e,t)=>{const n=o?.options?.find(t=>t.name===e.name);return e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const o=n?.values?.find(t=>t.name===e),a=!((e,t,n)=>{const r=[...m||[]];r[e]=t;const o=r.join(" / "),a=n.variants.edges.find(e=>e.node.title===o)?.node;return!!a&&p(n,a.id)>0})(t,e,r);return{name:e,value:o?.value||e,disabled:a}})},x=(e,t)=>e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e));return"swatches"===s||"auto"===s?e.createElement(e.Fragment,null,r.options.map((t,n)=>{const a=o?.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"}},r.options.length>1&&x(t,n)?.length>1&&e.createElement("label",{className:"yt-fixedBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},t.name,":"),x(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"}},x(t,n).map(t=>{const o=[...m];o[n]=t;const l=r.options.length>0?o.join(" / "):o[n],c=r.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(r,c.id):0),u=m[n]===t;if("color"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-color${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!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:u&&!s?"26px":"24px",height:u&&!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:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}if("image"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-image${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{border:u&&!s?`1px solid ${d}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},n?e.createElement("img",{className:"yt-fixedBundle-product-option-image",src:rm(n),alt:t,style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!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${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},"text"===a?.type&&a.values.find(e=>e.name===t)?.value||t)})))})):e.createElement(Rp,{className:"yt-fixedBundle-variant-selector-horizontal_container"},r.options.map((t,n)=>{const o=y(t,n);return 0===o.length||1===o.length&&"Default Title"===o[0].name?null:e.createElement(Mp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(om,{options:o,selectedValue:f(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n);const o=r.variants.edges.find(t=>t.node.title===(r.options?.length>0?n.join(" / "):n[e]))?.node.id;i(o||"")})(n,e)},type:g(t.name)}))}))},im=({qty:t,min:n=1,max:r=1/0,accentColor:o="#121212",onChange:a,borderRadius:i,isMobile:l})=>e.createElement("div",{className:"yt-fixedBundle-qty-selector",style:{display:"inline-flex",alignItems:"center",gap:0,border:`1px solid ${o}`,borderRadius:i??"6px",overflow:"hidden",userSelect:"none"}},e.createElement("button",{type:"button",className:"yt-fixedBundle-qty-btn yt-fixedBundle-qty-btn--minus",onClick:e=>{e.preventDefault(),e.stopPropagation(),t>n&&a(t-1)},disabled:t<=n,style:{width:l?"24px":"28px",height:l?"24px":"28px",display:"flex",alignItems:"center",justifyContent:"center",background:t<=n?"#f0f0f0":o,color:t<=n?"#999":"#fff",border:"none",cursor:t<=n?"not-allowed":"pointer",fontSize:l?"14px":"16px",lineHeight:"normal",transition:"background 0.15s",flexShrink:0},"aria-label":"Decrease quantity"},"-"),e.createElement("span",{className:"yt-fixedBundle-qty-count",style:{minWidth:l?"26px":"32px",textAlign:"center",fontSize:"13px",fontWeight:600,color:"#121212",padding:"0 4px",background:"#fff",lineHeight:l?"24px":"28px",height:l?"24px":"28px",display:"inline-block"}},t),e.createElement("button",{type:"button",className:"yt-fixedBundle-qty-btn yt-fixedBundle-qty-btn--plus",onClick:e=>{e.preventDefault(),e.stopPropagation(),t<r&&a(t+1)},disabled:t>=r,style:{width:l?"24px":"28px",height:l?"24px":"28px",display:"flex",alignItems:"center",justifyContent:"center",background:t>=r?"#f0f0f0":o,color:t>=r?"#999":"#fff",border:"none",cursor:t>=r?"not-allowed":"pointer",fontSize:l?"14px":"16px",lineHeight:"normal",transition:"background 0.15s",flexShrink:0},"aria-label":"Increase quantity"},"+")),lm=({product:o,selectedVariantId:i,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:m,isHorizontal:u,index:g,variantOptions:f,productsLength:y,handleOpenVariantModal:x,storeCurrencyCode:h,primaryProductId:b,variantId:w,checkedProducts:v,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T,reviewRatingType:S,qty:N,onQtyChange:B,disableQuantitySelector:F})=>{const z="23e4dd-58.myshopify.com"!==window.Shopify?.shop,$=e=>{const t="string"==typeof e?parseFloat(e):e;return z?t.toFixed(2):Math.round(t).toString()},I=r(()=>e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?o?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[o]),[P,D]=t(o?.variants?.edges.find(e=>I(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node),A=r(()=>P?.title?.split(" / ")||[],[P]),_=o?.id===b;n(()=>{if(o.id===b){const e=o?.variants?.edges?.find(e=>e?.node?.id?.includes(i))?.node;e&&I(e.id)>0&&(D(e),d(e.id))}else{const e=o?.variants?.edges?.find(e=>e?.node?.id===i)?.node||o?.variants?.edges?.find(e=>I(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node;D(e)}},[o,b,i,w,d,I]);const L=a(e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[o,d]),R=s?.fixedBundle?.discountBadgeDisplay,M=parseFloat(P?.price??"0"),O=v?.size===k,V=((e,t,n,r,o,a)=>{if(0===r||!n)return e;if(r!==o)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(a<=0)return e;const t=e/a*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/a);default:return e}})(M,E,C??0,v?.size,k,T),W=O?V:parseFloat(P?.price??"0"),H="discount-on-compare"===R?parseFloat(P?.compareAtPrice||P?.price||"0"):parseFloat(P?.price??"0"),j=s?.fixedBundle?.compareAtPriceVisibility&&H>W,q=$(W*N),U=$(H*N),Q="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,Z=P?.image?.url||o.featuredMedia?.preview?.image?.url,G=I(P?.id??""),X=0===G,K=e.createElement(im,{qty:N,min:1,max:G===1/0?999:G,accentColor:s?.general?.ctaBackgroundColor,onChange:B,borderRadius:s?.fixedBundle?.borderRadius,isMobile:m});return e.createElement(e.Fragment,null,u?e.createElement("div",{className:`${o.id===b?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"}${X?" yt-fixedBundle-product-card--out-of-stock":""}`,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-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:_}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${o.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(Y,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(tp,{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(np,{className:"yt-fixedBundle-product-card-horizontal_image",src:Em(Z),alt:o.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general?.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(rp,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(op,{className:"yt-fixedBundle-product-card-horizontal_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null," rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),s.fixedBundle.productsPriceVisibility&&e.createElement(ap,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(ip,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Cm(s.general.currencySymbol)," ",vm(q)),j&&H>W&&e.createElement(lp,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Cm(s.general.currencySymbol),vm(U))),e.createElement(am,{product:o,variantOptions:f,selectedVariants:A,onVariantChange:L,variantId:w,primaryProductId:b,variantType:s?.fixedBundle?.variantSelectorType,accentColor:s?.general?.ctaBackgroundColor}),m&&!F&&e.createElement("div",{style:{marginTop:"10px"},className:"yt-fixedBundle-qty-selector-wrapper-horizontal"},K)),!m&&!F&&e.createElement("div",{style:{marginRight:"20px"},className:"yt-fixedBundle-qty-selector-wrapper-horizontal"},K))):e.createElement(e.Fragment,null,e.createElement(yp,{className:`${o.id===b?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"}${X?" yt-fixedBundle-product-card--out-of-stock":""}`,productsLength:y,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||!F&&!m)&&{position:"relative"},...Q&&{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},!m&&!F&&e.createElement("div",{style:{position:"absolute",left:"5px",top:"5px",zIndex:"10"},className:"yt-fixedBundle-qty-selector-wrapper-vertical"},K),c&&e.createElement(Op,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:Q,showQtySelector:!F},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:_}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${o.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(Y,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(xp,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(hp,{className:"yt-fixedBundle-product-card_image--vertical",src:Em(Z),style:{aspectRatio:s.general.imageAspectRatio},alt:o.title}),o.variants.edges.length>1&&e.createElement(bp,{onClick:x,as:"button",className:"yt-fixedBundle-product-card_badge-container"},e.createElement(wp,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(vp,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(Cp,{className:"yt-fixedBundle-product-card_count-badge"},o.variants.edges.length,"+"))),e.createElement(Ep,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(kp,{className:"yt-fixedBundle-product-card-vertical_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),s.fixedBundle.productsPriceVisibility&&e.createElement(Sp,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Tp,{className:"yt-fixedBundle-product-card-vertical_price--new"},Cm(s.general.currencySymbol),vm(q)),s.fixedBundle.compareAtPriceVisibility&&j&&H>W&&e.createElement(lp,{className:"yt-fixedBundle-product-card-vertical_price--old"},Cm(s.general.currencySymbol),vm(U))),m&&!F&&e.createElement("div",{style:{marginTop:"6px"},className:"yt-fixedBundle-qty-selector-wrapper-vertical"},K))),(y<=3||!m)&&g<y-1&&e.createElement(Np,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Bp,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},cm=({bundle:o,addToCartFunction:i,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[m,u]=t(null),[g,f]=t(!1),[y,x]=t(!1),h="undefined"!=typeof window?window.location.href:null,b=o?.products?.find(e=>e.productDetails?.handle===h?.split("/").pop()?.split("?")[0]),w=b?.productId,v=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[C,E]=t(Object.fromEntries(o?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>v(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),[k,T]=t(Object.fromEntries(o?.products?.map((e,t)=>[t.toString(),1]))),S=a((e,t)=>{T(n=>({...n,[e.toString()]:t}))},[]),N="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),B=N?o?.showIndividualProductSelector??!0:o?.showIndividualProductSelector??!1,[F,z]=t(new Set(o.products.reduce((e,t,n)=>(!(t?.productId===w)&&B||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:o._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};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(()=>{m&&w&&E(e=>{const t={...e};return o?.products?.forEach((e,n)=>{e.productId===w&&(t[n.toString()]=m)}),t})},[m,w,o?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const $=a((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),I=(e,t)=>{const n=o.products[t].productId;N&&n===w||z(n=>{const r=new Set(n);return e?r.add(t):r.delete(t),r})},P=r(()=>(e,t)=>v(e.productDetails,t)>0,[v]),D=r(()=>o.products.some((e,t)=>F.has(t)&&e.productDetails.variants.edges.length>1),[o.products,F]),A="23e4dd-58.myshopify.com"!==window.Shopify?.shop,_=e=>{const t="string"==typeof e?parseFloat(e):e;return A?t.toFixed(2):Math.round(t).toString()},L=r(()=>{let e=0;return o.products.forEach((t,n)=>{if(F.has(n)){const r=C[n.toString()],o=t.productDetails.variants.edges.find(e=>e.node.id===r)?.node;o&&(e+=parseFloat(o.price??"0"))}}),e},[o.products,F,C]),{originalPrice:R,dealPrice:M,offerValue:O,totalCompareAtPrice:V,totalPrice:W}=r(()=>{const{price:e,compareAtPrice:t}=o.products.reduce((e,t,n)=>{if(!F.has(n))return e;const r=C[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find(e=>e.node.id===r)?.node;if(!o)return e;const a=k[n.toString()]??1,i=parseFloat(o?.price??"0")*a,l=parseFloat(o?.compareAtPrice||o?.price||"0")*a;return e.price+=i,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=o?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price";let r=e;if(F.size===o.products.length)if(o?.percentageOff)r=e*(1-o.percentageOff/100);else if(o?.dealAmount){const e=Array.from(F).reduce((e,t)=>e+(k[t.toString()]??1),0),t=e/F.size;r=o.dealAmount*t}else o?.amountOff&&(r=e-o.amountOff);const a=o?.customizations?.fixedBundle?.discountBadgeVisibility,i=!1===a?r:"discount-on-compare"===n?t:e,l=i-r;return{originalPrice:_(i),dealPrice:_(r),offerValue:_(l),totalPrice:e,totalCompareAtPrice:t}},[o.products,C,F,k,o.percentageOff,o.dealAmount,o.amountOff,o?.customizations?.fixedBundle?.discountBadgeDisplay,o?.customizations?.fixedBundle?.discountBadgeVisibility]),H=r(()=>o.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>F.has(e)),[o.products,F]),j=H.every(({product:e,index:t})=>P(e,C[t.toString()])),q=async e=>{s(!0),f(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:o._id,bundleType:"fixed-bundle",selectedProducts:H?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).flatMap(([e,t])=>{const n=parseInt(e);if(isNaN(n)||!F.has(n))return[];const r=k[e]??1;return Array(r).fill(t)}).filter(Boolean);i&&await i(Number(R),t,Number(M),void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},U=async e=>{if(j){if(e&&(e.preventDefault(),e.stopPropagation()),o?.personalizedForm?.title)return f(!1),void x(!0);await q()}};if(!i)return e.createElement(e.Fragment,null);const Q=o.customizations,Z=Q.fixedBundle?.cardLayoutStyle||"auto",G="horizontal"===Z||"auto"===Z&&d,Y="bundles"==o.appName?o.pageHeader?.title:o?.title,X="bundles"==o.appName?o.pageHeader?.description:o?.subtitle;return e.createElement(Xd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:Q.fixedBundle.sectionBackgroundColor,..."transparent"!==Q.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Y&&e.createElement(Kd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:Q.fixedBundle?.titleBackgroundColor||"none",color:Q.fixedBundle?.titleTextColor||"black",textAlign:Q.fixedBundle.infoAlignment??"center",fontSize:Q.fixedBundle?.titleFontSize,..."transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===Q.fixedBundle.infoAlignment&&"transparent"===Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},Y),X&&e.createElement(Jd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:Q.fixedBundle?.subtitleFontSize,textAlign:Q.fixedBundle.infoAlignment??"center",..."left"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===Q.fixedBundle.infoAlignment&&"transparent"===Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},X),G?e.createElement(ep,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},o?.products?.map((t,n,r)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(lm,{isChecked:F.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:Q,onVariantChange:e=>$(n,e),onCheckChange:e=>{I(e,n)},isMobile:d,index:n,isHorizontal:G,variantOptions:o.variantOptions,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:F,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:L,reviewRatingType:Q?.fixedBundle?.productRatingsDisplay??o?.reviewRatingType,qty:k[n.toString()]??1,onQtyChange:e=>S(n,e),disableQuantitySelector:!["falah-devstore.myshopify.com","swashaa.myshopify.com"].includes(window?.Shopify?.shop??"")||(o?.disableQuantitySelector??!0)}),n<r.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"!==Q?.fixedBundle?.shadowType&&{marginTop:"2px"},display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},className:"yt-fixedBundle-plus-icon-wrapper"},e.createElement(Le,{color:"black",style:{height:d?"16px":"24px",width:d?"16px":"24px",color:"black",lineHeight:"nomal"},className:"yt-fixedBundle-plus-icon-svg"})))))):e.createElement(gp,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(fp,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===Q.fixedBundle.infoAlignment?"flex-start":"right"===Q.fixedBundle.infoAlignment?"flex-end":"center"}},o?.products?.map((t,n)=>e.createElement(lm,{key:`${t.productId}-${n}`,isChecked:F.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:Q,onVariantChange:e=>{$(n,e)},onCheckChange:e=>I(e,n),isMobile:d,index:n,isHorizontal:G,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:F,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:L,reviewRatingType:Q?.fixedBundle.productRatingsDisplay??o?.reviewRatingType,qty:k[n.toString()]??1,onQtyChange:e=>S(n,e),handleOpenVariantModal:()=>f(!0),disableQuantitySelector:!["falah-devstore.myshopify.com","swashaa.myshopify.com"].includes(window?.Shopify?.shop??"")||(o?.disableQuantitySelector??!0)})),D&&e.createElement(nm,{productsWithIndices:H,isOpen:g,onClose:()=>f(!1),variantOptions:o.variantOptions,cta:{textColor:Q.general.ctaTextColor,backgroundColor:Q.general.ctaBackgroundColor},onVariantChange:$,handleAddToCart:U,primaryProductId:w,variantId:m||void 0}))),e.createElement(cp,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===Q.fixedBundle.infoAlignment?"flex-start":"right"===Q.fixedBundle.infoAlignment?"flex-end":"center"}},Number(R)>0&&Number(O)>0&&Q.fixedBundle.compareAtPriceVisibility&&e.createElement(sp,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(pp,{className:"yt-fixedBundle-summary_price"},Cm(Q.general.currencySymbol,o?.storeCurrencyCode),vm(R))),0!==F.size&&e.createElement(dp,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(pp,{className:"yt-fixedBundle-summary_price"},Cm(Q.general.currencySymbol,o?.storeCurrencyCode),vm(M))," ",Number(O)>0&&(()=>{let t="";if("percentage"===(Q?.fixedBundle?.discountDisplayType||"amount")){const e="discount-on-compare"===(Q?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?V:W,n=e>0?Math.round(Number(O)/e*100):0;t=n>0?`${n}% Off`:""}else t=`Save: ${Cm(Q.general.currencySymbol,o?.storeCurrencyCode)}${vm(O)}`;return t?e.createElement(mp,{className:"yt-fixedBundle-summary_save-tag"},t):null})())),e.createElement(up,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),G||!D?U(e):f(!0)},disabled:F.size<1||c||!j,style:{backgroundColor:Q.general?.ctaBackgroundColor||"#121212",color:Q.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${Q.general?.ctaBackgroundColor||"#121212"}`,boxShadow:Q.general.ctaShadowType,paddingTop:Q.general?.ctaPadding,paddingBottom:Q.general?.ctaPadding,borderRadius:Q.general.ctaBorderRadius,width:Q.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{Q.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=Q.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=Q.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{Q.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=Q.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=Q.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(fe,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):j?e.createElement(e.Fragment,null,Q.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),o?.personalizedForm?.title&&e.createElement(Rs,{isOpen:y,onClose:()=>x(!1),formConfig:o.personalizedForm,onCheckout:async e=>{await q(e),x(!1)},cta:{backgroundColor:Q.general?.ctaBackgroundColor||"#121212",textColor:Q.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},sm=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",dm=({product:r,tierIdx:o,isOpen:a,onClose:i,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:m=!1})=>{const[u,g]=t(0),[f,y]=t(r.variants[0]?.id.toString()||""),[x,h]=t(!0),b=r.variants.find(e=>e.id.toString()===f)||r.variants[0],w=r.images.filter(Boolean),v=(e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}})(sm()),C=(()=>{const e=sm();return me(e)??e})(),E=()=>{w.length<=1||(g(e=>0===e?w.length-1:e-1),h(!0))},k=()=>{w.length<=1||(g(e=>e===w.length-1?0:e+1),h(!0))};if(n(()=>(a&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[a]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=Em(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!a)return null;const T=w.length>1,S=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:i},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:i,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"}},w.length>0&&e.createElement(e.Fragment,null,x&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),x&&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:Em(w[u]||r.images[0]),alt:r.title,onLoad:()=>h(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:x?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"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===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(X,{size:24})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===w.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:u===w.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===w.length-1?.5:1}},e.createElement(M,{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"}},m&&b?.name||r.title),!m&&r.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"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{y(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},r.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"}},C,(b.price/v).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},C,(b.compare_at_price/v).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(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:b.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock")),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),N=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:i},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:i,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}},w.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},x&&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:w[u]||r.images[0],alt:r.title,onLoad:()=>h(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:x?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"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===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(X,{size:20})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===w.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:u===w.length-1?.5:1,cursor:u===w.length-1?"not-allowed":"pointer"}},e.createElement(M,{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}},r.title),!m&&r.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"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{y(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},r.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"}},C,(b.price/v).toLocaleString(),b.compare_at_price?b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},C,(b.compare_at_price/v).toLocaleString()):null),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.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(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&b.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return D.createPortal(p?N:S,document.body)},pm=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||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",...r].map(r=>{const a=o===r,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(c,.07):"transparent",borderBottom:a?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=c)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-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",...r].map(r=>{const a=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?a:"#e0e0e0"}`,borderRadius:l,backgroundColor:o===r?a:"white",color:o===r?"white":"#333",cursor:"pointer"}},r.charAt(0).toUpperCase()+r.slice(1))})))},mm=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[]},um=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",gm=e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}},fm=()=>{const e=um();return me(e)??e},ym=({config:r,bundleAddToCartLoading:i,addCustomBundleToCart:l,dispatchAnalyticsEvent:c})=>{const[s,d]=t(1),[p,m]=t("All"),[u,g]=t([]),[f,y]=t(null),[x,h]=t({}),[b,w]=t(!1),[v,C]=t(window.innerWidth<640),[E,k]=t({}),T=o(null),S=o(new Map),[N,B]=t(160),[F,z]=t(""),[$,I]=t(""),[P,D]=t(!1),[A,_]=t("none"),L=v?8:20,{customizations:R}=r,M=r.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),O=!!r.config.form,W=M.length+(O?1:0),H=R.hideSelectedProducts,j=R.allowMultipleQty,q=R.hideOutOfStockProducts,U=r.config.splitVariants??!1,Q=o(new Set),Z=a((e,t=p,n=$,r=A)=>{const o=M[e-1]?.products||[];let a="All"===t?o:o.filter(e=>mm(e).includes(t));if(n.trim()){const e=n.toLowerCase();a=a.filter(t=>t.title.toLowerCase().includes(e))}return q&&(a=a.filter(e=>e.available)),"none"!==r&&(a=[...a].sort((e,t)=>{if("asc"===r||"desc"===r){const n=e.price||e.price_min||0,o=t.price||t.price_min||0;return"asc"===r?n-o:o-n}{const n=(e.title||"").toLowerCase(),o=(t.title||"").toLowerCase();return"alpha-asc"===r?n.localeCompare(o):o.localeCompare(n)}})),a},[M,p,$,A,q]),Y=a(e=>{const t=Z(e).length;k(n=>{const r=n[e]||0,o=Math.min(r+8,t);return o<=r?n:{...n,[e]:o}})},[8,Z]);n(()=>{c?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r?.id,bundleType:"collection-bundle"}})},[]),n(()=>(T.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===s&&Y(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{T.current?.disconnect()}),[Y,s]),n(()=>{m("All"),z(""),I(""),D(!1),_("none")},[s]),n(()=>{const e=setTimeout(()=>{I(F)},300);return()=>clearTimeout(e)},[F]),n(()=>{if(O&&s===W)return;const e=s-1;if(!M[e])return;if(Q.current.has(e))return;const t=Z(s);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],r=n.variants.filter(e=>e.available);if(1!==r.length)return;const o=r[0],a=le(e),i=se[e];if(a!==1/0&&i>=a)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===o.id.toString()&&t.tierIndex===e)&&(Q.current.add(e),g(t=>[...t,{productId:n.id.toString(),variantId:o.id.toString(),price:o.price,quantity:1,tierIndex:e}]),s<W)){const e=setTimeout(()=>{d(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[s]),n(()=>{if(O&&s===W)return;const e=s,t=Z(e).length;k(n=>{const r=n[`${e}_category`]!==p;return 0===(n[e]||0)||r?{...n,[e]:Math.min(L,t),[`${e}_category`]:p}:n})},[s,L,p,Z]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>C(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const X=a(e=>{B(e+10)},[]),ee=gm(um()),te=u.reduce((e,t)=>e+t.quantity,0),ne=u.reduce((e,t)=>e+t.price*t.quantity,0)/ee,re=u.reduce((e,t)=>{const n=M.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),r=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(r?.compare_at_price??t.price)*t.quantity},0)/ee,oe=e=>{for(let t=0;t<M.length;t++)if(M[t].products.some(t=>t.id.toString()===e))return t+1;return O?W:M.length},ae=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},ie=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),a=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());g(n=>{const i=`${e.id}-${o}-${t}`,l=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(l)return n.filter(e=>e!==l);const s=se[t],d=le(t);return d!==1/0&&s>=d?n:(c?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:r?.id,bundleType:"collection-bundle",addedProduct:{id:e.id,title:e.title},tierIndex:t}}),[...n,{productId:e.id.toString(),variantId:o,price:a,quantity:1,tierIndex:t}])})},le=e=>{const t=M[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},ce=(e,t)=>{const n=le(t);if(n===1/0)return!0;const r=se[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||r<n},se=M.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),de=(e,t,n)=>{const r=le(n);if(r===1/0)return!0;return se[n]<r},pe=(e,t,n)=>{g(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},me=async()=>{if(s!==W||!u.length)return;const e={};O&&Object.entries(x).forEach(([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}),c?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r?.id,bundleType:"collection-bundle",selectedProducts:u.map(e=>({id:e.productId,variantId:e.variantId,quantity:e.quantity,tierIndex:e.tierIndex}))}});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},ue=O&&s===W,ge=(ue?null:M[s-1])?le(s-1):0,fe=M.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find(e=>`${e.productId}-${e.variantId}`===n);return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:se[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(xm,{totalSteps:W,isFormStep:ue,currentStep:s,getStepTitle:e=>O&&e===W?"Customize Gift Details":M[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:r?.config?.form?.title,hasForm:O,onStepClick:e=>{d(e),window.scrollTo(0,0)}})),Array.from({length:W},(e,t)=>t+1).map(t=>{const n=O&&t===W,o=n?[]:(e=>M[e-1]?.products||[])(t);let a=[];if(!n&&R.enableProductCategories){const e=new Set;o.forEach(t=>mm(t).forEach(t=>e.add(t))),a=Array.from(e).sort()}const l=n?[]:Z(t),c=t-1,C=l.slice(0,E[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(s===t?"yt-collection-bundle-step-content-active":""),style:{display:s===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&r.config.form?e.createElement($s,{form:r.config.form,formData:x,setFormData:h,barHeight:N,isUploading:b,setIsUploading:w}):e.createElement(e.Fragment,null,R.enableProductCategories&&a.length>0&&e.createElement(pm,{styles:R,isMobile:v,categories:a,activeCategory:p,onCategoryChange:m}),(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,P?e.createElement("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",gap:"8px"}},e.createElement("input",{type:"text",autoFocus:!0,placeholder:"Search...",value:F,onChange:e=>z(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:()=>{D(!1),z(""),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:()=>D(!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:A,onChange:e=>_(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:A,onChange:e=>_(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:F,onChange:e=>z(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:`${N}px`}},0===l.length&&""!==$.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 "',F,'"'),e.createElement("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"}},"Try checking your spelling or using more general terms."),e.createElement("button",{onClick:()=>{z(""),I(""),D(!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")):U?C.flatMap(t=>t.variants.filter(e=>!q||e.available).map(n=>e.createElement(hm,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:c,customizations:R,isMobile:v,hoveredCard:f,setHoveredCard:y,selectedProducts:u,handleAddToBundle:ie,canAddProduct:ce,allowMultipleQty:j,handleVariantChange:ae,canIncrement:de,setSelectedProducts:g,splitVariants:!0}))):C.map(t=>e.createElement(hm,{key:t.id,product:t,tierIdx:c,customizations:R,isMobile:v,hoveredCard:f,setHoveredCard:y,selectedProducts:u,handleAddToBundle:ie,canAddProduct:ce,allowMultipleQty:j,handleVariantChange:ae,canIncrement:de,setSelectedProducts:g,splitVariants:!1})),s===t&&(E[t]||0)<l.length&&e.createElement("div",{ref:e=>{const n=S.current.get(t);n&&T.current?.unobserve(n),e?(S.current.set(t,e),T.current?.observe(e)):S.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))),s===t&&e.createElement(bm,{config:r,selectedProducts:u,selectedByTier:fe,totalItems:te,totalPrice:ne,totalCompareAtPrice:re,currentStep:s,totalSteps:W,currentTierMax:ge,tierSelectedCounts:se,isMobile:v,bundleAddToCartLoading:i,isUploading:b,hoveredCard:f,setHoveredCard:y,hideSelectedProducts:H,getProductStep:oe,setCurrentStep:d,handleRemoveItem:pe,handleCheckout:me,hasForm:O,onHeightChange:X}))}))},xm=({totalSteps:t,isFormStep:r,currentStep:o,getStepTitle:a,isMobile:i,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!i||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[o,i]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:i?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:i?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:i?"flex-start":"center",gap:i?"1rem":"2rem",minWidth:i?100*t+"px":"auto",paddingInline:i?"calc(50% - 60px)":"0",scrollPaddingInline:i?"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 "+(o===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:i?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:o===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(o===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:o===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:o===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:o===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"}},a(n))))),l&&c&&r&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:i?"14px":"16px",marginBottom:i?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},hm=({product:n,tierIdx:r,customizations:o,isMobile:a,hoveredCard:i,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:m,canIncrement:u,setSelectedProducts:g,splitVariants:f=!1})=>{const[y,x]=t(!1),h=f?null:document.querySelector(`[data-product-id="${n.id}"]`),b=f?n.variants[0].id.toString():h?.dataset.selectedVariant??n.variants[0].id.toString(),w=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=gm(um()),C=fm(),E=f?`${n.id}-${w.id}`:n.id,k=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===r),T=i===E,S=c.filter(e=>e.productId===n.id.toString()&&e.variantId===w.id.toString()&&e.tierIndex===r).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:E,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":w.id,"data-current-price":w.price,style:{display:"flex",flexDirection:"column",border:o?.productCardBorder||"1px solid #ddd",background:o?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:a?0:"250px",maxWidth:a?"none":"250px",borderRadius:o?.borderRadius||"8px",boxShadow:"spread"===o?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===o?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:a?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:o?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>x(!0),onMouseEnter:()=>l(E),onMouseLeave:()=>l(null)},e.createElement("img",{src:Em(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:T?0:1,transform:T?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:Em(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:T?1:0,transform:"scale(1.05)"},alt:n.title}),!f&&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=>m(n,e.target.value),defaultValue:w.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"}},o.productCardCategoryVisibility&&mm(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"}},mm(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:a?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),mm(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"}},"+",mm(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:a?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:f?0:1}},n.title),f&&"Default Title"!==w.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:a?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},w.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:a?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},C,(w.price/v).toLocaleString()),w.compare_at_price&&0!==w.compare_at_price&&w.compare_at_price>w.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},C,(w.compare_at_price/v).toLocaleString()):null)),p&&S>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:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o&&o.quantity>1?e.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?e.filter(e=>e!==o):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},S),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{w.available&&u(n,w.id.toString(),r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]})},disabled:!w.available||!u(n,w.id.toString(),r)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(k?"yt-collection-bundle-add-btn-added":""),style:{background:k?"#28a745":d(n,r)&&w.available?o?.atcBg||"#007bff":"#ccc",color:o?.atcText||"#fff",border:"none",padding:a?"6px":"12px",fontSize:a?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:w.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(f)w.available&&d(n,r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.filter(e=>e!==o):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]});else{if(!w.available||!d(n,r))return;s(n,r)}},disabled:!w.available||!d(n,r)},k?"Added":w.available?"ADD TO BOX":"Out of Stock")),y&&e.createElement(dm,{product:n,tierIdx:r,isOpen:y,onClose:()=>x(!1),onAddToBundle:(e,t)=>{s(e,t),x(!1)},canAdd:d(n,r),isSelected:k,customizations:o,isMobile:a,splitVariants:f}))},bm=r=>{const{config:a,selectedProducts:i,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:m,currentTierMax:u,tierSelectedCounts:g,isMobile:f,bundleAddToCartLoading:y,isUploading:x,hoveredCard:h,setHoveredCard:b,getProductStep:w,setCurrentStep:v,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=r,{customizations:S}=a,[N,B]=t(!1),F=o(null),z=o(null),$=gm(um()),I=fm(),{totalOriginal:P,hasSavings:D,formattedSavings:A,totalAfterDiscount:_}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:r})=>{const o=r?.discountData;let a=0;e.forEach(e=>{const t=(e.price||0)/$,n=e.quantity||1;a+=t*n}),t+=a;let i=a;if("mov_percentage"===o?.type&&o.tiers?.length){const e=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>a>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;i=a*(1-t)}}n+=i});const r=Math.round(t-n),o=r>0;return{savings:r,totalOriginal:t,totalAfterDiscount:n,hasSavings:o,formattedSavings:o?`${I}${r.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),L=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)/$;return((e,t,n)=>{const r=e.discountData;if(!r||!r.tiers?.length)return null;const o=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),a=[];if("mov_percentage"===r.type){if("number"!=typeof n)return null;const e=o.filter(e=>n>=e.minimumQuantity).pop();e&&a.push(`${e.discountValue}% OFF`);const t=o.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;a.push(`Add ${I}${e} more to get ${t.discountValue}% OFF`)}return a.length?a.join(" + "):null}const i=o.filter(e=>t>=e.minimumQuantity);if(i.length>0){const e=i.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(r.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`${I}${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ${I}${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&a.push(t)}const l=o.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(r.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`${I}${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ${I}${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&a.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return a.length?a.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=u!==1/0&&g[p-1]===u-2&&u>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[u,g,p]),n(()=>{if(F.current&&T){const e=F.current.offsetHeight;T(e)}},[f,T,i]),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,r=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return r?.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(),r=(n.left+n.width/2)/window.innerWidth,o=(n.top+n.height/2)/window.innerHeight;Te({particleCount:100,spread:70,origin:{x:r,y:o},zIndex:9999})}},[l]),e.createElement("div",{ref:F,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"}},L.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},L.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},N&&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}},u," item",u>1?"s":"")))),i.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,r)=>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,r)=>{const o=a.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!o)return null;const i=w(t.productId),l=p===i;return e.createElement("div",{key:r,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&&v(i)},e.createElement("img",{src:Em(o.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<r.length-1&&r[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(Q,null)))))),f?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||a?.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:i.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}},I,(_??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(a?.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:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===m&&0===c||x?"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===m&&0===c||x?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||y||x},y?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Fs,null)):p===m?"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"}},(a?.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===h&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:i.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}},I,(_??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,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===m&&0===c||x?"yt-collection-bundle-next-btn-disabled":""),"data-gokwik-processed":"true",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===m&&0===c||x?.6:1,...-2===h&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||y||x,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},y?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Fs,null)):p===m?"Checkout":"Next")))},wm=window?.Shopify?.currency||{rate:1,active:window?.ShopifyAnalytics?.meta?.currency||"INR"},vm=e=>{if(!e)return;const t=navigator.language||"en-US";return new Intl.NumberFormat(t).format(Number(e))},Cm=(e,t)=>e||(me(wm.active)||wm.active),Em=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality",t?.toString()||"70"),r.has("width")||r.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},km=(e,t,n,r,o,a,i)=>{const l=r.findIndex(t=>t.variantId===e&&(void 0===i||t.tierIndex===i));o(0===n?e=>e.filter((e,t)=>t!==l):-1===l?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a,tierIndex:i}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:a,tierIndex:i}:e))},Tm=({bundle:t,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Ls,{bundleAddToCartLoading:l,bundle:t,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g}):"combo"===t.type?e.createElement(Os,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"mixAndMatch"===t.type?e.createElement(Yd,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"collection"===t.type?e.createElement(ym,{config:t,addCustomBundleToCart:o,bundleAddToCartLoading:l,dispatchAnalyticsEvent:m}):e.createElement(xd,{bundle:t,currentProductId:n,addToCartFunction:r,dispatchAnalyticsEvent:m}):e.createElement(cm,{addToCartFunction:r,bundle:t,dispatchAnalyticsEvent:m}),Sm=s.div`
|
|
4679
|
+
`,nm=({productsWithIndices:o,isOpen:a,onClose:i,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:m})=>{const u=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,f]=t({}),[y,x]=t({});n(()=>{const e={},t={};o?.forEach(({product:n,index:r})=>{let o,a=[];if(n.productId===p&&m){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(m))?.node;e&&u(n.productDetails,e.id)>0&&(a=e.title.split(" / "),o=e)}if(!a.length){const e=n.productDetails.variants.edges.find(e=>u(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(a=e.title.split(" / "),o=e):a=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[r]=a,o&&(t[r]={node:o},s(r,o.id))}),f(e),x(t)},[o,p,m,s,u]),n(()=>{if(!p||!m)return;const e=o?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,r=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(m))?.node;if(r&&u(t.productDetails,r.id)>0){const e=r.title.split(" / ");f(t=>({...t,[n]:e})),x(e=>({...e,[n]:{node:r}})),s(n,r.id)}},[m,p,o,s,u]);const h=(e,t,n,r)=>{const o=[...g[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find(e=>e.node.title===a)?.node;return!!i&&u(r.productDetails,i.id)>0},b=(e,t,n)=>{const{product:r}=o?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!r?.productDetails)return;if(!h(e,n,t,r))return;const a={...g};a[e][n]=t,f(a);const i=r?.productDetails?.variants?.edges?.find(t=>t.node.title===a[e].join(" / "))?.node;i&&(s(e,i.id),x(t=>({...t,[e]:{node:i}})))};if(!a)return null;const w=e.createElement(Vp,{className:"yt-fixedBundle-variant-modal_overlay",onClick:i},e.createElement(Wp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Hp,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),o?.map(({product:t,index:n},r)=>e.createElement(e.Fragment,null,e.createElement(qp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(Up,{className:"yt-fixedBundle-variant-modal_thumbnail",src:y[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Qp,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(Zp,{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(Yp,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((r,o)=>{const a=c&&c?.options?.find(e=>e.name===r.name),i=r.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[o]===e));return 0===i.length||1===i.length&&"Default Title"===i[0]?e.createElement(e.Fragment,null):a&&"color"===a?.type?e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(tm,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a.values.find(e=>e.name===r)?.value?e.createElement(Kp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:i,color:a.values.find(e=>e.name===r)?.value||r,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},e.createElement("span",null)):e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):a&&"image"===a?.type?e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(tm,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(e.Fragment,null,a?.values.find(e=>e.name===r)?.value?e.createElement(em,{className:"yt-fixedBundle-variant-modal_image-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)},src:a.values.find(e=>e.name===r)?.value}):e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},r))})):e.createElement(Xp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(tm,{className:"yt-fixedBundle-variant-modal_option-name"},r.name," :"," "),i.map((r,i)=>{const l=!h(n,o,r,t);return e.createElement(Jp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[o]==r,disabled:l,onClick:()=>{b(n,r,o)}},"text"===a?.type&&a.values.find(e=>e.name===r)?.value||r)}))}))),r<o.length-1&&e.createElement(Gp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(jp,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return D.createPortal(w,document.body)},rm=(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}},om=({options:r,selectedValue:a,onChange:i,type:l="text"})=>{const[c,s]=t(!1),d=o(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(_p,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Lp,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Fp,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(zp,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement($p,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},a&&("color"===l||"image"===l)&&p(a),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},a&&a.name)),e.createElement(Ip,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Pp,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},r?.map(t=>e.createElement(Dp,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(a?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:a?.name===t.name,onClick:()=>{t.disabled||(i(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(Ap,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},am=({product:r,variantOptions:o,selectedVariants:a,onVariantChange:i,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),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0},[m,u]=t(a||[]);n(()=>{a&&a.length>0&&u(a)},[a]),n(()=>{if(l&&r.variants.edges.some(e=>e.node.id.includes(l))){const e=r.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");u(t)}}},[l,r]);const g=e=>{if(!o?.options)return"text";const t=o.options.find(t=>t.name===e);return t?.type||"text"},f=(e,t)=>{const n=m[t];if(!n)return null;return y(e,t).find(e=>e.name===n)||null},y=(e,t)=>{const n=o?.options?.find(t=>t.name===e.name);return e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const o=n?.values?.find(t=>t.name===e),a=!((e,t,n)=>{const r=[...m||[]];r[e]=t;const o=r.join(" / "),a=n.variants.edges.find(e=>e.node.title===o)?.node;return!!a&&p(n,a.id)>0})(t,e,r);return{name:e,value:o?.value||e,disabled:a}})},x=(e,t)=>e.values.filter(e=>r.variants.edges.some(n=>n.node.title.split(" / ")[t]===e));return"swatches"===s||"auto"===s?e.createElement(e.Fragment,null,r.options.map((t,n)=>{const a=o?.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"}},r.options.length>1&&x(t,n)?.length>1&&e.createElement("label",{className:"yt-fixedBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},t.name,":"),x(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"}},x(t,n).map(t=>{const o=[...m];o[n]=t;const l=r.options.length>0?o.join(" / "):o[n],c=r.variants.edges.find(e=>e.node.title===l)?.node,s=0===(c?p(r,c.id):0),u=m[n]===t;if("color"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-color${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!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:u&&!s?"26px":"24px",height:u&&!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:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},t))}if("image"===a?.type){const n=a.values.find(e=>e.name===t)?.value;return e.createElement("button",{key:t,className:`yt-fixedBundle-product-option-button-image${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{border:u&&!s?`1px solid ${d}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},n?e.createElement("img",{className:"yt-fixedBundle-product-option-image",src:rm(n),alt:t,style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):e.createElement("span",{className:"yt-fixedBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!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${u?" yt-fixedBundle-product-option-button-selected":""}${s?" yt-fixedBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&i(c.id)},disabled:s,style:{padding:"4px 8px",border:u&&!s?`1px solid ${d}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},"text"===a?.type&&a.values.find(e=>e.name===t)?.value||t)})))})):e.createElement(Rp,{className:"yt-fixedBundle-variant-selector-horizontal_container"},r.options.map((t,n)=>{const o=y(t,n);return 0===o.length||1===o.length&&"Default Title"===o[0].name?null:e.createElement(Mp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(om,{options:o,selectedValue:f(t,n),onChange:e=>{((e,t)=>{const n=[...m];n[e]=t.name,u(n);const o=r.variants.edges.find(t=>t.node.title===(r.options?.length>0?n.join(" / "):n[e]))?.node.id;i(o||"")})(n,e)},type:g(t.name)}))}))},im=({qty:t,min:n=1,max:r=1/0,accentColor:o="#121212",onChange:a,borderRadius:i,isMobile:l})=>e.createElement("div",{className:"yt-fixedBundle-qty-selector",style:{display:"inline-flex",alignItems:"center",gap:0,border:`1px solid ${o}`,borderRadius:i??"6px",overflow:"hidden",userSelect:"none"}},e.createElement("button",{type:"button",className:"yt-fixedBundle-qty-btn yt-fixedBundle-qty-btn--minus",onClick:e=>{e.preventDefault(),e.stopPropagation(),t>n&&a(t-1)},disabled:t<=n,style:{width:l?"24px":"28px",height:l?"24px":"28px",display:"flex",alignItems:"center",justifyContent:"center",background:t<=n?"#f0f0f0":o,color:t<=n?"#999":"#fff",border:"none",cursor:t<=n?"not-allowed":"pointer",fontSize:l?"14px":"16px",lineHeight:"normal",transition:"background 0.15s",flexShrink:0},"aria-label":"Decrease quantity"},"-"),e.createElement("span",{className:"yt-fixedBundle-qty-count",style:{minWidth:l?"26px":"32px",textAlign:"center",fontSize:"13px",fontWeight:600,color:"#121212",padding:"0 4px",background:"#fff",lineHeight:l?"24px":"28px",height:l?"24px":"28px",display:"inline-block"}},t),e.createElement("button",{type:"button",className:"yt-fixedBundle-qty-btn yt-fixedBundle-qty-btn--plus",onClick:e=>{e.preventDefault(),e.stopPropagation(),t<r&&a(t+1)},disabled:t>=r,style:{width:l?"24px":"28px",height:l?"24px":"28px",display:"flex",alignItems:"center",justifyContent:"center",background:t>=r?"#f0f0f0":o,color:t>=r?"#999":"#fff",border:"none",cursor:t>=r?"not-allowed":"pointer",fontSize:l?"14px":"16px",lineHeight:"normal",transition:"background 0.15s",flexShrink:0},"aria-label":"Increase quantity"},"+")),lm=({product:o,selectedVariantId:i,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:m,isHorizontal:u,index:g,variantOptions:f,productsLength:y,handleOpenVariantModal:x,storeCurrencyCode:h,primaryProductId:b,variantId:w,checkedProducts:v,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T,reviewRatingType:S,qty:N,onQtyChange:B,disableQuantitySelector:F})=>{const z="23e4dd-58.myshopify.com"!==window.Shopify?.shop,$=e=>{const t="string"==typeof e?parseFloat(e):e;return z?t.toFixed(2):Math.round(t).toString()},I=r(()=>e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?o?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[o]),[P,D]=t(o?.variants?.edges.find(e=>I(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node),A=r(()=>P?.title?.split(" / ")||[],[P]),_=o?.id===b;n(()=>{if(o.id===b){const e=o?.variants?.edges?.find(e=>e?.node?.id?.includes(i))?.node;e&&I(e.id)>0&&(D(e),d(e.id))}else{const e=o?.variants?.edges?.find(e=>e?.node?.id===i)?.node||o?.variants?.edges?.find(e=>I(e?.node?.id)>0)?.node||o?.variants?.edges?.[0]?.node;D(e)}},[o,b,i,w,d,I]);const L=a(e=>{const t=o?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[o,d]),R=s?.fixedBundle?.discountBadgeDisplay,M=parseFloat(P?.price??"0"),O=v?.size===k,V=((e,t,n,r,o,a)=>{if(0===r||!n)return e;if(r!==o)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(a<=0)return e;const t=e/a*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/a);default:return e}})(M,E,C??0,v?.size,k,T),W=O?V:parseFloat(P?.price??"0"),H="discount-on-compare"===R?parseFloat(P?.compareAtPrice||P?.price||"0"):parseFloat(P?.price??"0"),j=s?.fixedBundle?.compareAtPriceVisibility&&H>W,q=$(W*N),U=$(H*N),Q="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,Z=P?.image?.url||o.featuredMedia?.preview?.image?.url,G=I(P?.id??""),X=0===G,K=e.createElement(im,{qty:N,min:1,max:G===1/0?999:G,accentColor:s?.general?.ctaBackgroundColor,onChange:B,borderRadius:s?.fixedBundle?.borderRadius,isMobile:m});return e.createElement(e.Fragment,null,u?e.createElement("div",{className:`${o.id===b?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"}${X?" yt-fixedBundle-product-card--out-of-stock":""}`,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-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:_}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${o.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(Y,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(tp,{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(np,{className:"yt-fixedBundle-product-card-horizontal_image",src:Em(Z),alt:o.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general?.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(rp,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(op,{className:"yt-fixedBundle-product-card-horizontal_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null," rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingBottom:"4px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews")," ",")"),s.fixedBundle.productsPriceVisibility&&e.createElement(ap,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(ip,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Cm(s.general.currencySymbol)," ",vm(q)),j&&H>W&&e.createElement(lp,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Cm(s.general.currencySymbol),vm(U))),e.createElement(am,{product:o,variantOptions:f,selectedVariants:A,onVariantChange:L,variantId:w,primaryProductId:b,variantType:s?.fixedBundle?.variantSelectorType,accentColor:s?.general?.ctaBackgroundColor}),m&&!F&&e.createElement("div",{style:{marginTop:"10px"},className:"yt-fixedBundle-qty-selector-wrapper-horizontal"},K)),!m&&!F&&e.createElement("div",{style:{marginRight:"20px"},className:"yt-fixedBundle-qty-selector-wrapper-horizontal"},K))):e.createElement(e.Fragment,null,e.createElement(yp,{className:`${o.id===b?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"}${X?" yt-fixedBundle-product-card--out-of-stock":""}`,productsLength:y,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||!F&&!m)&&{position:"relative"},...Q&&{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},!m&&!F&&e.createElement("div",{style:{position:"absolute",left:"5px",top:"5px",zIndex:"10"},className:"yt-fixedBundle-qty-selector-wrapper-vertical"},K),c&&e.createElement(Op,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:Q,showQtySelector:!F},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${o.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:_}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${o.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(Y,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(xp,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(hp,{className:"yt-fixedBundle-product-card_image--vertical",src:Em(Z),style:{aspectRatio:s.general.imageAspectRatio},alt:o.title}),o.variants.edges.length>1&&e.createElement(bp,{onClick:x,as:"button",className:"yt-fixedBundle-product-card_badge-container"},e.createElement(wp,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(vp,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(Cp,{className:"yt-fixedBundle-product-card_count-badge"},o.variants.edges.length,"+"))),e.createElement(Ep,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(kp,{className:"yt-fixedBundle-product-card-vertical_title"},o.title),"ratingOnly"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",e.createElement("span",{style:{marginLeft:6,lineHeight:"normal"}},o?.rating?.averageRating," ",e.createElement("span",null,"rating"))),"ratingAndReviewCount"===S&&(o?.rating?.averageRating??0)>0&&e.createElement("div",{className:"yt-fixedBundle-product-ratings-count",style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333",paddingTop:"4px",paddingBottom:"6px",lineHeight:"normal"}},e.createElement($e,{color:"gold",size:14})," ",o?.rating?.averageRating,e.createElement(ke,{className:"yt-fixedBundle-verified-icon",size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",o?.rating?.ratingCount," ",e.createElement("span",{style:{marginLeft:"2px"}},"reviews"),")"),s.fixedBundle.productsPriceVisibility&&e.createElement(Sp,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Tp,{className:"yt-fixedBundle-product-card-vertical_price--new"},Cm(s.general.currencySymbol),vm(q)),s.fixedBundle.compareAtPriceVisibility&&j&&H>W&&e.createElement(lp,{className:"yt-fixedBundle-product-card-vertical_price--old"},Cm(s.general.currencySymbol),vm(U))),m&&!F&&e.createElement("div",{style:{marginTop:"6px"},className:"yt-fixedBundle-qty-selector-wrapper-vertical"},K))),(y<=3||!m)&&g<y-1&&e.createElement(Np,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Bp,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},cm=({bundle:o,addToCartFunction:i,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[m,u]=t(null),[g,f]=t(!1),[y,x]=t(!1),h="undefined"!=typeof window?window.location.href:null,b=o?.products?.find(e=>e.productDetails?.handle===h?.split("/").pop()?.split("?")[0]),w=b?.productId,v=r(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),r=n?.node;return r?e?.tracksInventory&&r.inventoryItem?.tracked?r.inventoryQuantity>0?r.inventoryQuantity:r.inventoryQuantity<=0&&"continue"===r.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[C,E]=t(Object.fromEntries(o?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>v(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),[k,T]=t(Object.fromEntries(o?.products?.map((e,t)=>[t.toString(),1]))),S=a((e,t)=>{T(n=>({...n,[e.toString()]:t}))},[]),N="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),B=N?o?.showIndividualProductSelector??!0:o?.showIndividualProductSelector??!1,[F,z]=t(new Set(o.products.reduce((e,t,n)=>(!(t?.productId===w)&&B||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:o._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};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(()=>{m&&w&&E(e=>{const t={...e};return o?.products?.forEach((e,n)=>{e.productId===w&&(t[n.toString()]=m)}),t})},[m,w,o?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const $=a((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),I=(e,t)=>{const n=o.products[t].productId;N&&n===w||z(n=>{const r=new Set(n);return e?r.add(t):r.delete(t),r})},P=r(()=>(e,t)=>v(e.productDetails,t)>0,[v]),D=r(()=>o.products.some((e,t)=>F.has(t)&&e.productDetails.variants.edges.length>1),[o.products,F]),A="23e4dd-58.myshopify.com"!==window.Shopify?.shop,_=e=>{const t="string"==typeof e?parseFloat(e):e;return A?t.toFixed(2):Math.round(t).toString()},L=r(()=>{let e=0;return o.products.forEach((t,n)=>{if(F.has(n)){const r=C[n.toString()],o=t.productDetails.variants.edges.find(e=>e.node.id===r)?.node;o&&(e+=parseFloat(o.price??"0"))}}),e},[o.products,F,C]),{originalPrice:R,dealPrice:M,offerValue:O,totalCompareAtPrice:V,totalPrice:W}=r(()=>{const{price:e,compareAtPrice:t}=o.products.reduce((e,t,n)=>{if(!F.has(n))return e;const r=C[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find(e=>e.node.id===r)?.node;if(!o)return e;const a=k[n.toString()]??1,i=parseFloat(o?.price??"0")*a,l=parseFloat(o?.compareAtPrice||o?.price||"0")*a;return e.price+=i,e.compareAtPrice+=l,e},{price:0,compareAtPrice:0}),n=o?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price";let r=e;if(F.size===o.products.length)if(o?.percentageOff)r=e*(1-o.percentageOff/100);else if(o?.dealAmount){const e=Array.from(F).reduce((e,t)=>e+(k[t.toString()]??1),0),t=e/F.size;r=o.dealAmount*t}else o?.amountOff&&(r=e-o.amountOff);const a=o?.customizations?.fixedBundle?.discountBadgeVisibility,i=!1===a?r:"discount-on-compare"===n?t:e,l=i-r;return{originalPrice:_(i),dealPrice:_(r),offerValue:_(l),totalPrice:e,totalCompareAtPrice:t}},[o.products,C,F,k,o.percentageOff,o.dealAmount,o.amountOff,o?.customizations?.fixedBundle?.discountBadgeDisplay,o?.customizations?.fixedBundle?.discountBadgeVisibility]),H=r(()=>o.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>F.has(e)),[o.products,F]),j=H.every(({product:e,index:t})=>P(e,C[t.toString()])),q=async e=>{s(!0),f(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:o._id,bundleType:"fixed-bundle",selectedProducts:H?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).flatMap(([e,t])=>{const n=parseInt(e);if(isNaN(n)||!F.has(n))return[];const r=k[e]??1;return Array(r).fill(t)}).filter(Boolean);i&&await i(Number(R),t,Number(M),void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},U=async e=>{if(j){if(e&&(e.preventDefault(),e.stopPropagation()),o?.personalizedForm?.title)return f(!1),void x(!0);await q()}};if(!i)return e.createElement(e.Fragment,null);const Q=o.customizations,Z=Q.fixedBundle?.cardLayoutStyle||"auto",G="horizontal"===Z||"auto"===Z&&d,Y="bundles"==o.appName?o.pageHeader?.title:o?.title,X="bundles"==o.appName?o.pageHeader?.description:o?.subtitle;return e.createElement(Xd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:Q.fixedBundle.sectionBackgroundColor,..."transparent"!==Q.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Y&&e.createElement(Kd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:Q.fixedBundle?.titleBackgroundColor||"none",color:Q.fixedBundle?.titleTextColor||"black",textAlign:Q.fixedBundle.infoAlignment??"center",fontSize:Q.fixedBundle?.titleFontSize,..."transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===Q.fixedBundle.infoAlignment&&"transparent"===Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},Y),X&&e.createElement(Jd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:Q.fixedBundle?.subtitleFontSize,textAlign:Q.fixedBundle.infoAlignment??"center",..."left"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===Q.fixedBundle.infoAlignment&&"transparent"!==Q.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===Q.fixedBundle.infoAlignment&&"transparent"===Q.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},X),G?e.createElement(ep,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},o?.products?.map((t,n,r)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(lm,{isChecked:F.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:Q,onVariantChange:e=>$(n,e),onCheckChange:e=>{I(e,n)},isMobile:d,index:n,isHorizontal:G,variantOptions:o.variantOptions,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:F,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:L,reviewRatingType:Q?.fixedBundle?.productRatingsDisplay??o?.reviewRatingType,qty:k[n.toString()]??1,onQtyChange:e=>S(n,e),disableQuantitySelector:!["falah-devstore.myshopify.com","swashaa.myshopify.com"].includes(window?.Shopify?.shop??"")||(o?.disableQuantitySelector??!0)}),n<r.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"!==Q?.fixedBundle?.shadowType&&{marginTop:"2px"},display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},className:"yt-fixedBundle-plus-icon-wrapper"},e.createElement(Le,{color:"black",style:{height:d?"16px":"24px",width:d?"16px":"24px",color:"black",lineHeight:"nomal"},className:"yt-fixedBundle-plus-icon-svg"})))))):e.createElement(gp,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(fp,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===Q.fixedBundle.infoAlignment?"flex-start":"right"===Q.fixedBundle.infoAlignment?"flex-end":"center"}},o?.products?.map((t,n)=>e.createElement(lm,{key:`${t.productId}-${n}`,isChecked:F.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:o?.canCustomizeFixedBundle||!1,styles:Q,onVariantChange:e=>{$(n,e)},onCheckChange:e=>I(e,n),isMobile:d,index:n,isHorizontal:G,productsLength:o.products.length,storeCurrencyCode:o.storeCurrencyCode,primaryProductId:w,variantId:m||void 0,bundleDiscountType:o.discountType??"none",checkedProducts:F,bundleProductsCount:o.products.length,bundleDiscountValue:o.percentageOff||o.amountOff||o.dealAmount,totalSelectedOriginal:L,reviewRatingType:Q?.fixedBundle.productRatingsDisplay??o?.reviewRatingType,qty:k[n.toString()]??1,onQtyChange:e=>S(n,e),handleOpenVariantModal:()=>f(!0),disableQuantitySelector:!["falah-devstore.myshopify.com","swashaa.myshopify.com"].includes(window?.Shopify?.shop??"")||(o?.disableQuantitySelector??!0)})),D&&e.createElement(nm,{productsWithIndices:H,isOpen:g,onClose:()=>f(!1),variantOptions:o.variantOptions,cta:{textColor:Q.general.ctaTextColor,backgroundColor:Q.general.ctaBackgroundColor},onVariantChange:$,handleAddToCart:U,primaryProductId:w,variantId:m||void 0}))),e.createElement(cp,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===Q.fixedBundle.infoAlignment?"flex-start":"right"===Q.fixedBundle.infoAlignment?"flex-end":"center"}},Number(R)>0&&Number(O)>0&&Q.fixedBundle.compareAtPriceVisibility&&e.createElement(sp,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(pp,{className:"yt-fixedBundle-summary_price"},Cm(Q.general.currencySymbol,o?.storeCurrencyCode),vm(R))),0!==F.size&&e.createElement(dp,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(pp,{className:"yt-fixedBundle-summary_price"},Cm(Q.general.currencySymbol,o?.storeCurrencyCode),vm(M))," ",Number(O)>0&&(()=>{let t="";if("percentage"===(Q?.fixedBundle?.discountDisplayType||"amount")){const e="discount-on-compare"===(Q?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?V:W,n=e>0?Math.round(Number(O)/e*100):0;t=n>0?`${n}% Off`:""}else t=`Save: ${Cm(Q.general.currencySymbol,o?.storeCurrencyCode)}${vm(O)}`;return t?e.createElement(mp,{className:"yt-fixedBundle-summary_save-tag"},t):null})())),e.createElement(up,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),G||!D?U(e):f(!0)},disabled:F.size<1||c||!j,style:{backgroundColor:Q.general?.ctaBackgroundColor||"#121212",color:Q.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${Q.general?.ctaBackgroundColor||"#121212"}`,boxShadow:Q.general.ctaShadowType,paddingTop:Q.general?.ctaPadding,paddingBottom:Q.general?.ctaPadding,borderRadius:Q.general.ctaBorderRadius,width:Q.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{Q.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=Q.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=Q.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{Q.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=Q.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=Q.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(fe,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):j?e.createElement(e.Fragment,null,Q.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),o?.personalizedForm?.title&&e.createElement(Rs,{isOpen:y,onClose:()=>x(!1),formConfig:o.personalizedForm,onCheckout:async e=>{await q(e),x(!1)},cta:{backgroundColor:Q.general?.ctaBackgroundColor||"#121212",textColor:Q.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},sm=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",dm=({product:r,tierIdx:o,isOpen:a,onClose:i,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:m=!1})=>{const[u,g]=t(0),[f,y]=t(r.variants[0]?.id.toString()||""),[x,h]=t(!0),b=r.variants.find(e=>e.id.toString()===f)||r.variants[0],w=r.images.filter(Boolean),v=(e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}})(sm()),C=(()=>{const e=sm();return me(e)??e})(),E=()=>{w.length<=1||(g(e=>0===e?w.length-1:e-1),h(!0))},k=()=>{w.length<=1||(g(e=>e===w.length-1?0:e+1),h(!0))};if(n(()=>(a&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[a]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=Em(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!a)return null;const T=w.length>1,S=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:i},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:i,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"}},w.length>0&&e.createElement(e.Fragment,null,x&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),x&&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:Em(w[u]||r.images[0]),alt:r.title,onLoad:()=>h(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:x?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"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===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(X,{size:24})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===w.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:u===w.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===w.length-1?.5:1}},e.createElement(M,{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"}},m&&b?.name||r.title),!m&&r.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"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{y(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},r.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"}},C,(b.price/v).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},C,(b.compare_at_price/v).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(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:b.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock")),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),N=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:i},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:i,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}},w.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},x&&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:w[u]||r.images[0],alt:r.title,onLoad:()=>h(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:x?0:1,transition:"opacity 0.3s"}}),T&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:E,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"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===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(X,{size:20})),e.createElement("button",{onClick:k,disabled:u===w.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===w.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:u===w.length-1?.5:1,cursor:u===w.length-1?"not-allowed":"pointer"}},e.createElement(M,{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}},r.title),!m&&r.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"}},r?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:f,onChange:e=>{y(e.target.value),h(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},r.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"}},C,(b.price/v).toLocaleString(),b.compare_at_price?b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},C,(b.compare_at_price/v).toLocaleString()):null),r.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:r.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(r,o),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&b.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return D.createPortal(p?N:S,document.body)},pm=({styles:t,isMobile:n,categories:r,activeCategory:o,onCategoryChange:a})=>{const i=e=>{a(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||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",...r].map(r=>{const a=o===r,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(c,.07):"transparent",borderBottom:a?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{a||(e.currentTarget.style.color=c)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))}))):e.createElement("div",{className:"yt-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",...r].map(r=>{const a=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:r,onClick:()=>i(r),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?a:"#e0e0e0"}`,borderRadius:l,backgroundColor:o===r?a:"white",color:o===r?"white":"#333",cursor:"pointer"}},r.charAt(0).toUpperCase()+r.slice(1))})))},mm=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[]},um=()=>window?.ShopifyAnalytics?.meta?.currency||window?.Shopify?.currency?.active||"USD",gm=e=>{try{const t=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??2;return Math.pow(10,t)}catch{return 100}},fm=()=>{const e=um();return me(e)??e},ym=({config:r,bundleAddToCartLoading:i,addCustomBundleToCart:l,dispatchAnalyticsEvent:c})=>{const[s,d]=t(1),[p,m]=t("All"),[u,g]=t([]),[f,y]=t(null),[x,h]=t({}),[b,w]=t(!1),[v,C]=t(window.innerWidth<640),[E,k]=t({}),T=o(null),S=o(new Map),[N,B]=t(160),[F,z]=t(""),[$,I]=t(""),[P,D]=t(!1),[A,_]=t("none"),L=v?8:20,{customizations:R}=r,M=r.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),O=!!r.config.form,W=M.length+(O?1:0),H=R.hideSelectedProducts,j=R.allowMultipleQty,q=R.hideOutOfStockProducts,U=r.config.splitVariants??!1,Q=o(new Set),Z=a((e,t=p,n=$,r=A)=>{const o=M[e-1]?.products||[];let a="All"===t?o:o.filter(e=>mm(e).includes(t));if(n.trim()){const e=n.toLowerCase();a=a.filter(t=>t.title.toLowerCase().includes(e))}return q&&(a=a.filter(e=>e.available)),"none"!==r&&(a=[...a].sort((e,t)=>{if("asc"===r||"desc"===r){const n=e.price||e.price_min||0,o=t.price||t.price_min||0;return"asc"===r?n-o:o-n}{const n=(e.title||"").toLowerCase(),o=(t.title||"").toLowerCase();return"alpha-asc"===r?n.localeCompare(o):o.localeCompare(n)}})),a},[M,p,$,A,q]),Y=a(e=>{const t=Z(e).length;k(n=>{const r=n[e]||0,o=Math.min(r+8,t);return o<=r?n:{...n,[e]:o}})},[8,Z]);n(()=>{c?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r?.id,bundleType:"collection-bundle"}})},[]),n(()=>(T.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===s&&Y(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{T.current?.disconnect()}),[Y,s]),n(()=>{m("All"),z(""),I(""),D(!1),_("none")},[s]),n(()=>{const e=setTimeout(()=>{I(F)},300);return()=>clearTimeout(e)},[F]),n(()=>{if(O&&s===W)return;const e=s-1;if(!M[e])return;if(Q.current.has(e))return;const t=Z(s);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],r=n.variants.filter(e=>e.available);if(1!==r.length)return;const o=r[0],a=le(e),i=se[e];if(a!==1/0&&i>=a)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===o.id.toString()&&t.tierIndex===e)&&(Q.current.add(e),g(t=>[...t,{productId:n.id.toString(),variantId:o.id.toString(),price:o.price,quantity:1,tierIndex:e}]),s<W)){const e=setTimeout(()=>{d(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[s]),n(()=>{if(O&&s===W)return;const e=s,t=Z(e).length;k(n=>{const r=n[`${e}_category`]!==p;return 0===(n[e]||0)||r?{...n,[e]:Math.min(L,t),[`${e}_category`]:p}:n})},[s,L,p,Z]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>C(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const X=a(e=>{B(e+10)},[]),ee=gm(um()),te=u.reduce((e,t)=>e+t.quantity,0),ne=u.reduce((e,t)=>e+t.price*t.quantity,0)/ee,re=u.reduce((e,t)=>{const n=M.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),r=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(r?.compare_at_price??t.price)*t.quantity},0)/ee,oe=e=>{for(let t=0;t<M.length;t++)if(M[t].products.some(t=>t.id.toString()===e))return t+1;return O?W:M.length},ae=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},ie=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),a=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());g(n=>{const i=`${e.id}-${o}-${t}`,l=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(l)return n.filter(e=>e!==l);const s=se[t],d=le(t);return d!==1/0&&s>=d?n:(c?.({eventNameCustom:"byob_add_to_bundle",eventTypeCustom:"clicks",data:{bundleId:r?.id,bundleType:"collection-bundle",addedProduct:{id:e.id,title:e.title},tierIndex:t}}),[...n,{productId:e.id.toString(),variantId:o,price:a,quantity:1,tierIndex:t}])})},le=e=>{const t=M[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},ce=(e,t)=>{const n=le(t);if(n===1/0)return!0;const r=se[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||r<n},se=M.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),de=(e,t,n)=>{const r=le(n);if(r===1/0)return!0;return se[n]<r},pe=(e,t,n)=>{g(r=>r.filter(r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))},me=async()=>{if(s!==W||!u.length)return;const e={};O&&Object.entries(x).forEach(([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}),c?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r?.id,bundleType:"collection-bundle",selectedProducts:u.map(e=>({id:e.productId,variantId:e.variantId,quantity:e.quantity,tierIndex:e.tierIndex}))}});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},ue=O&&s===W,ge=(ue?null:M[s-1])?le(s-1):0,fe=M.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find(e=>`${e.productId}-${e.variantId}`===n);return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:se[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(xm,{totalSteps:W,isFormStep:ue,currentStep:s,getStepTitle:e=>O&&e===W?"Customize Gift Details":M[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:r?.config?.form?.title,hasForm:O,onStepClick:e=>{d(e),window.scrollTo(0,0)}})),Array.from({length:W},(e,t)=>t+1).map(t=>{const n=O&&t===W,o=n?[]:(e=>M[e-1]?.products||[])(t);let a=[];if(!n&&R.enableProductCategories){const e=new Set;o.forEach(t=>mm(t).forEach(t=>e.add(t))),a=Array.from(e).sort()}const l=n?[]:Z(t),c=t-1,C=l.slice(0,E[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(s===t?"yt-collection-bundle-step-content-active":""),style:{display:s===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&r.config.form?e.createElement($s,{form:r.config.form,formData:x,setFormData:h,barHeight:N,isUploading:b,setIsUploading:w}):e.createElement(e.Fragment,null,R.enableProductCategories&&a.length>0&&e.createElement(pm,{styles:R,isMobile:v,categories:a,activeCategory:p,onCategoryChange:m}),(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,P?e.createElement("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",gap:"8px"}},e.createElement("input",{type:"text",autoFocus:!0,placeholder:"Search...",value:F,onChange:e=>z(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:()=>{D(!1),z(""),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:()=>D(!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:A,onChange:e=>_(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:A,onChange:e=>_(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:F,onChange:e=>z(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:`${N}px`}},0===l.length&&""!==$.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 "',F,'"'),e.createElement("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"}},"Try checking your spelling or using more general terms."),e.createElement("button",{onClick:()=>{z(""),I(""),D(!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")):U?C.flatMap(t=>t.variants.filter(e=>!q||e.available).map(n=>e.createElement(hm,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:c,customizations:R,isMobile:v,hoveredCard:f,setHoveredCard:y,selectedProducts:u,handleAddToBundle:ie,canAddProduct:ce,allowMultipleQty:j,handleVariantChange:ae,canIncrement:de,setSelectedProducts:g,splitVariants:!0}))):C.map(t=>e.createElement(hm,{key:t.id,product:t,tierIdx:c,customizations:R,isMobile:v,hoveredCard:f,setHoveredCard:y,selectedProducts:u,handleAddToBundle:ie,canAddProduct:ce,allowMultipleQty:j,handleVariantChange:ae,canIncrement:de,setSelectedProducts:g,splitVariants:!1})),s===t&&(E[t]||0)<l.length&&e.createElement("div",{ref:e=>{const n=S.current.get(t);n&&T.current?.unobserve(n),e?(S.current.set(t,e),T.current?.observe(e)):S.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))),s===t&&e.createElement(bm,{config:r,selectedProducts:u,selectedByTier:fe,totalItems:te,totalPrice:ne,totalCompareAtPrice:re,currentStep:s,totalSteps:W,currentTierMax:ge,tierSelectedCounts:se,isMobile:v,bundleAddToCartLoading:i,isUploading:b,hoveredCard:f,setHoveredCard:y,hideSelectedProducts:H,getProductStep:oe,setCurrentStep:d,handleRemoveItem:pe,handleCheckout:me,hasForm:O,onHeightChange:X}))}))},xm=({totalSteps:t,isFormStep:r,currentStep:o,getStepTitle:a,isMobile:i,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!i||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[o,i]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:i?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:i?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:i?"flex-start":"center",gap:i?"1rem":"2rem",minWidth:i?100*t+"px":"auto",paddingInline:i?"calc(50% - 60px)":"0",scrollPaddingInline:i?"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 "+(o===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:i?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:o===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(o===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:o===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:o===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:o===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"}},a(n))))),l&&c&&r&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:i?"14px":"16px",marginBottom:i?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},hm=({product:n,tierIdx:r,customizations:o,isMobile:a,hoveredCard:i,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:m,canIncrement:u,setSelectedProducts:g,splitVariants:f=!1})=>{const[y,x]=t(!1),h=f?null:document.querySelector(`[data-product-id="${n.id}"]`),b=f?n.variants[0].id.toString():h?.dataset.selectedVariant??n.variants[0].id.toString(),w=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=gm(um()),C=fm(),E=f?`${n.id}-${w.id}`:n.id,k=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===r),T=i===E,S=c.filter(e=>e.productId===n.id.toString()&&e.variantId===w.id.toString()&&e.tierIndex===r).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:E,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":w.id,"data-current-price":w.price,style:{display:"flex",flexDirection:"column",border:o?.productCardBorder||"1px solid #ddd",background:o?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:a?0:"250px",maxWidth:a?"none":"250px",borderRadius:o?.borderRadius||"8px",boxShadow:"spread"===o?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===o?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:a?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:o?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>x(!0),onMouseEnter:()=>l(E),onMouseLeave:()=>l(null)},e.createElement("img",{src:Em(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:T?0:1,transform:T?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:Em(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:T?1:0,transform:"scale(1.05)"},alt:n.title}),!f&&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=>m(n,e.target.value),defaultValue:w.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"}},o.productCardCategoryVisibility&&mm(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"}},mm(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:a?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),mm(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"}},"+",mm(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:a?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:f?0:1}},n.title),f&&"Default Title"!==w.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:a?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},w.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:a?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},C,(w.price/v).toLocaleString()),w.compare_at_price&&0!==w.compare_at_price&&w.compare_at_price>w.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},C,(w.compare_at_price/v).toLocaleString()):null)),p&&S>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:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o&&o.quantity>1?e.map(e=>e===o?{...e,quantity:e.quantity-1}:e):o?e.filter(e=>e!==o):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},S),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:w.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:a?"6px":"12px",fontSize:a?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{w.available&&u(n,w.id.toString(),r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.map(e=>e===o?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]})},disabled:!w.available||!u(n,w.id.toString(),r)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(k?"yt-collection-bundle-add-btn-added":""),style:{background:k?"#28a745":d(n,r)&&w.available?o?.atcBg||"#007bff":"#ccc",color:o?.atcText||"#fff",border:"none",padding:a?"6px":"12px",fontSize:a?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:w.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(f)w.available&&d(n,r)&&g(e=>{const t=`${n.id}-${w.id}-${r}`,o=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return o?e.filter(e=>e!==o):[...e,{productId:n.id.toString(),variantId:w.id.toString(),price:w.price,quantity:1,tierIndex:r}]});else{if(!w.available||!d(n,r))return;s(n,r)}},disabled:!w.available||!d(n,r)},k?"Added":w.available?"ADD TO BOX":"Out of Stock")),y&&e.createElement(dm,{product:n,tierIdx:r,isOpen:y,onClose:()=>x(!1),onAddToBundle:(e,t)=>{s(e,t),x(!1)},canAdd:d(n,r),isSelected:k,customizations:o,isMobile:a,splitVariants:f}))},bm=r=>{const{config:a,selectedProducts:i,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:m,currentTierMax:u,tierSelectedCounts:g,isMobile:f,bundleAddToCartLoading:y,isUploading:x,hoveredCard:h,setHoveredCard:b,getProductStep:w,setCurrentStep:v,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=r,{customizations:S}=a,[N,B]=t(!1),F=o(null),z=o(null),$=gm(um()),I=fm(),{totalOriginal:P,hasSavings:D,formattedSavings:A,totalAfterDiscount:_}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:r})=>{const o=r?.discountData;let a=0;e.forEach(e=>{const t=(e.price||0)/$,n=e.quantity||1;a+=t*n}),t+=a;let i=a;if("mov_percentage"===o?.type&&o.tiers?.length){const e=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>a>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;i=a*(1-t)}}n+=i});const r=Math.round(t-n),o=r>0;return{savings:r,totalOriginal:t,totalAfterDiscount:n,hasSavings:o,formattedSavings:o?`${I}${r.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),L=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)/$;return((e,t,n)=>{const r=e.discountData;if(!r||!r.tiers?.length)return null;const o=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),a=[];if("mov_percentage"===r.type){if("number"!=typeof n)return null;const e=o.filter(e=>n>=e.minimumQuantity).pop();e&&a.push(`${e.discountValue}% OFF`);const t=o.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;a.push(`Add ${I}${e} more to get ${t.discountValue}% OFF`)}return a.length?a.join(" + "):null}const i=o.filter(e=>t>=e.minimumQuantity);if(i.length>0){const e=i.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(r.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`${I}${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ${I}${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&a.push(t)}const l=o.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(r.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`${I}${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ${I}${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&a.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return a.length?a.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=u!==1/0&&g[p-1]===u-2&&u>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[u,g,p]),n(()=>{if(F.current&&T){const e=F.current.offsetHeight;T(e)}},[f,T,i]),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,r=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return r?.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(),r=(n.left+n.width/2)/window.innerWidth,o=(n.top+n.height/2)/window.innerHeight;Te({particleCount:100,spread:70,origin:{x:r,y:o},zIndex:9999})}},[l]),e.createElement("div",{ref:F,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"}},L.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},L.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},N&&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}},u," item",u>1?"s":"")))),i.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,r)=>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,r)=>{const o=a.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!o)return null;const i=w(t.productId),l=p===i;return e.createElement("div",{key:r,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&&v(i)},e.createElement("img",{src:Em(o.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<r.length-1&&r[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(Q,null)))))),f?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||a?.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:i.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}},I,(_??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(a?.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:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===m&&0===c||x?"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===m&&0===c||x?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||y||x},y?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Fs,null)):p===m?"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"}},(a?.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===h&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>v(e=>Math.max(1,e-1)),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:i.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}},I,(_??s).toLocaleString()),D?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,P.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",A)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},I,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===m&&0===c||x?"yt-collection-bundle-next-btn-disabled":""),"data-gokwik-processed":"true",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===m&&0===c||x?.6:1,...-2===h&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===m?E:()=>v(p+1),disabled:p===m&&0===c||y||x,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},y?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(Fs,null)):p===m?"Checkout":"Next")))},wm=window?.Shopify?.currency||{rate:1,active:window?.ShopifyAnalytics?.meta?.currency||"INR"},vm=e=>{if(!e)return;const t=navigator.language||"en-US";return new Intl.NumberFormat(t).format(Number(e))},Cm=(e,t)=>e||(me(wm.active)||wm.active),Em=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality",t?.toString()||"70"),r.has("width")||r.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},km=(e,t,n,r,o,a,i)=>{const l=r.findIndex(t=>t.variantId===e&&(void 0===i||t.tierIndex===i));o(0===n?e=>e.filter((e,t)=>t!==l):-1===l?r=>[...r,{product:t,variantId:e,quantity:n,isFree:a,tierIndex:i}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:a,tierIndex:i}:e))},Tm=({bundle:t,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g,categoryFilters:f})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Ls,{bundleAddToCartLoading:l,bundle:t,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:m,fetchStoreDetails:u,productsPagination:g,categoryFilters:f}):"combo"===t.type?e.createElement(Os,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"mixAndMatch"===t.type?e.createElement(Yd,{bundle:t,addToCartFunction:r,dispatchAnalyticsEvent:m}):"collection"===t.type?e.createElement(ym,{config:t,addCustomBundleToCart:o,bundleAddToCartLoading:l,dispatchAnalyticsEvent:m}):e.createElement(xd,{bundle:t,currentProductId:n,addToCartFunction:r,dispatchAnalyticsEvent:m}):e.createElement(cm,{addToCartFunction:r,bundle:t,dispatchAnalyticsEvent:m}),Sm=s.div`
|
|
4680
4680
|
position: relative;
|
|
4681
4681
|
`,Nm=s.button`
|
|
4682
4682
|
border: 1px solid #ccc;
|