yt-uikit 0.10.14 → 0.10.15-variant-oos-class.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -3153,7 +3153,7 @@ import e,{useState as t,useEffect as n,useMemo as r,useRef as o,useCallback as a
|
|
|
3153
3153
|
font-size: 1em;
|
|
3154
3154
|
justify-content: center;
|
|
3155
3155
|
align-items: center;
|
|
3156
|
-
`;const bs=({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))})),ws=({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 x=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?m.join(" / "):m[0]))?.node,y=x?.image?.url||o.featuredMedia?.preview?.image?.url,h=Cn(y,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(bs,{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)},vs=l((i,l)=>{const[c,s]=ce(gs),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),[x,y]=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(),z=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]),[$,F]=t(z);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&&F(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=()=>y(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:I,descriptionHtml:P,media:A,variants:L}=c,_=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&&F(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=[...$];n[e]=t.name,F(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))},[$,c,d]),W=a((e,t)=>{const n=$[t];if(!n)return null;return O(e).find(e=>e.name===n)||null},[$,O]),H=a((e,t)=>{const n=[...$];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},[$,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(x&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[x,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(Fe,{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(Fe,{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"}},_.length>0&&_.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:Cm(t?.url),medium:Cm(t?.url),large:Cm(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:Cm(N??"")||Cm(_[g]?.url),medium:Cm(N??"")||Cm(_[g]?.url),large:Cm(N??"")||Cm(_[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"}},_.length>1&&_.filter(e=>e?.url?.length>0).map((n,r)=>e.createElement("img",{key:r,src:Cm(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"}},$[r]||n.values[0])),e.createElement(bs,{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"}},vm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),wm(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"}},vm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),wm(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"}},vm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),wm(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(ys,{$isSmallScreen:x,ref:l},e.createElement(hs,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(x?"small-screen":"large-screen")},e.createElement(fs,{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(ys,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:x,ref:l},e.createElement(hs,{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(x?ne:te,document.body)}),Cs=({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"})))},Es=({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(_e,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},o)),ks=({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:x,showActions:y=!0,openSections:h,toggleSection:b})=>{const[w,v]=t(null),C=vm(m?.general?.currencySymbol,x)??x??"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(Es,{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 "))))),y&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick: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")))},Ts=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(ks,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),r()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Ss=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(ks,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Ns=({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:x,sharedFiltersState:y,openSections:b,toggleSection:w,sortBy:v})=>{const[C,E]=t(!1),[k,T]=t(i),{showFilters:S,setShowFilters:N,priceMax:B,setPriceMax:z,priceMin:$,setPriceMin:F}=y,[I,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!o&&"sidebar"===D,L="none"===D;n(()=>{s["filter.v.price"]||(z(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 _=Object.entries(s).reduce((e,[t,n])=>"filter.v.price"===t?$>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:L?"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",_>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},_)),r&&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&&!L&&e.createElement(Ts,{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:()=>{z(f),F(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${$}-max:${B}`],t})},priceMin:$,setPriceMin:F,priceMax:B,setPriceMax:z,maxPossiblePrice:f,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:x,openSections:b,toggleSection:w}))},Bs=()=>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(Bs,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 Fs({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(vc,{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(Cc,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(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 Is=({product:o,styles:a,selectedVariant:i})=>{const[l,c]=t(!1),s=r(()=>Cm(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=>Cm(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})))},Ps=({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:x,tierIndex:y})=>{const b=de(gs),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),[z,$]=t(0),[F,I]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===N)?.node,L=T(N||"");n(()=>{const e=u.find(e=>e.variantId===N&&(void 0===y||e.tierIndex===y));$(e?e.quantity:0)},[u,N,y]),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 _=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(Tc,{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(L<=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(Sc,{className:"yt-byob-image-wrapper"},e.createElement(Is,{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),_&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Nc,{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:F?"10px":"14px",color:"#666",fontWeight:"500",paddingBottom:"4px"}},t.charAt(0).toUpperCase()+t.slice(1))),V.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",V.length-2," more"))),e.createElement(Bc,{isMobile:F,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(Fe,{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(Fe,{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&&!x?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"}},vm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",wm(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"},vm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",wm(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!f?.isFreebieTier||x)&&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"}},vm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",wm(A.compareAtPrice)))),(L>0||L===1/0)&&e.createElement(zc,{borderRadius:w?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===z||void 0===z)&&e.createElement(Ec,{style:{...!l&&{backgroundColor:w?.general.primaryColor||"#111",color:w?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),$(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&&z>0&&N&&e.createElement(kc,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Fs,{remainingQuantity:c,setQuantity:$,quantity:z,handleAddToBundle:i,variantId:N,product:r,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:L})),o?.disableQuantitySelector&&z>0&&N&&e.createElement(Ec,{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(Fc,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,z-1);$(t),d&&N&&d(N,y)}},e.createElement(We,{style:{color:"#fff",fontSize:"20px"}})))),L<=0&&L!==1/0&&e.createElement(Ec,{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(ws,{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)}}))},Ds=({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)),As=({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:x,productsPagination:y})=>{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({}),[z,$]=t(!1),F=S&&C===(i.builderTiers?.productTier?.length||0),I=C===(i.builderTiers?.productTier?.length||0)-1,P=S&&I&&!F,[D,A]=t(i?.products),[L,_]=t(!1),[R,M]=t({}),[O,V]=t(i?.products),[W,H]=t({}),[j,q]=t(y?.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,xe]=t({}),ye=e=>{xe(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{ae.length>0&&xe(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)&&y?.cursorData&&q(y.cursorData)},[re,y?.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(x?.());e?.productFilters&&ie(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[Q?.byob,x,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),ze=((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(!y)return;const{initialCursorData:t,cursorData:n,fetchFn:r,setCursorData:o}=y,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[$e,Fe]=ce(gs),[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=Cm(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)},Le=()=>{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&&Le()}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)&&Fe(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const _e=(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}}}),Em(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?Cm(i.mobileCoverImageUrl):Cm(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?ze.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Oe(t)):e.map(e=>ze.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Oe(e))}return ze.filter(Oe)},[U,Z,R,C,ze,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&&(_e(o,n,1),C<Z.length-(S?0:1))){E(C+1);const e=Z?.[C];e?.products?.length>1&&Le()}},[U,Z,C,D,k,ve,_e]);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(!y)return;const{cursorData:e,fetchFn:t}=y,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{_(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),a=ne.current;return a&&o.observe(a),()=>{a&&o.unobserve(a)}},[y,L,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(Cs,{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(Ds,{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&&!F&&e.createElement(Ss,{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:ye}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!F&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Ns,{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:ye}),i?.customizations?.byob?.enableProductCategories&&K&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(As,{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"},F&&i.personalizedForm?.title?e.createElement($s,{form:i.personalizedForm,formData:N,setFormData:B,isUploading:z,setIsUploading:$}):0!==We?.length||L?Ve.map((t,n)=>{if("productTier"===U){const r=(Z[C]?.minimumQuantity??0)>(k[C]?.length??0),o=ze.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return o?e.createElement(Ps,{bundle:i,idx:n,key:t?.variantIds?.[0]??t.productId,product:o?.productDetails,handleAddToBundle:_e,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(Ps,{bundle:i,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:_e,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")),!F&&L&&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(us,{builderTiers:i?.builderTiers,showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void Le();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:z}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(us,{showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void Le();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:z})))),$e&&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(vs,{handleAddToBundle:_e,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})})()))},_s=({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)},Rs=({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]),x=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:Cm(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=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(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(Fe,{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(Fe,{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"}},vm(a.general.currencySymbol,p),wm((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"}},vm(a.general.currencySymbol,p),wm(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"}},vm(a.general.currencySymbol,p),wm(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:Cm(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(Fe,{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(Fe,{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"}},vm(a.general.currencySymbol,p),wm((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"}},vm(a.general.currencySymbol,p),wm(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"}},vm(a.general.currencySymbol,p),wm(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=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(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&&x(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&&x(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:Cm(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&&x(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:()=>x(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)}))))))},Ms=({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}),x=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 y=(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,z=b.comboBundle?.embedContentVisibility,$="bundles"==o.appName?o.pageHeader?.title:o?.title,F="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"}},z&&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&&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"}},vm(b.general.currencySymbol,o.storeCurrencyCode),wm(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"}},vm(b.general.currencySymbol,o.storeCurrencyCode),wm(C)),Number(k)>0&&!1!==v&&(()=>{const t="percentage"===(b?.comboBundle?.discountDisplayType||"amount")?`${S}% Off`:`Save ${vm(b.general.currencySymbol,o.storeCurrencyCode)}${wm(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(Rs,{key:`combo-product-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>y(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(Rs,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>y(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 ${x?"":"yt-comboBundle-bundle-cta-button-disabled"} ${s?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:x?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor,color:b.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:b.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:x?"pointer":"not-allowed",border:`1px solid ${x?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor}`,boxShadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,margin:"0"},disabled:!x,onMouseOver:e=>{b.general.customizeHoverState&&x&&(e.currentTarget.style.backgroundColor=b.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=b.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{b.general.customizeHoverState&&x&&(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,x?b.comboBundle?.ctaTitle??"Add Bundle to cart":b.general.outOfStockLabel||"Out of Stock"," "))),z&&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,F))),o?.personalizedForm?.title&&e.createElement(_s,{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}))},Os=s.div`
|
|
3156
|
+
`;const bs=({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))})),ws=({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 x=o.variants.edges.find(e=>e.node.title===(o.options?.length>0?m.join(" / "):m[0]))?.node,y=x?.image?.url||o.featuredMedia?.preview?.image?.url,h=Cn(y,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(bs,{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)},vs=l((i,l)=>{const[c,s]=ce(gs),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),[x,y]=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(),z=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]),[$,F]=t(z);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&&F(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=()=>y(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!c)return null;const{title:I,descriptionHtml:P,media:A,variants:L}=c,_=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&&F(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=[...$];n[e]=t.name,F(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))},[$,c,d]),W=a((e,t)=>{const n=$[t];if(!n)return null;return O(e).find(e=>e.name===n)||null},[$,O]),H=a((e,t)=>{const n=[...$];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},[$,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(x&&c&&C.current){const e=()=>{C.current&&S(C.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}},[x,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(Fe,{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(Fe,{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"}},_.length>0&&_.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:Cm(t?.url),medium:Cm(t?.url),large:Cm(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:Cm(N??"")||Cm(_[g]?.url),medium:Cm(N??"")||Cm(_[g]?.url),large:Cm(N??"")||Cm(_[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"}},_.length>1&&_.filter(e=>e?.url?.length>0).map((n,r)=>e.createElement("img",{key:r,src:Cm(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"}},$[r]||n.values[0])),e.createElement(bs,{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"}},vm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),wm(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"}},vm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),wm(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"}},vm(i.styles.general.currencySymbol,i.styles.general.currencySymbol),wm(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(ys,{$isSmallScreen:x,ref:l},e.createElement(hs,{ref:l,className:"yt-byob-modal-desktop-container yt-variant-selection-modal"},e.createElement("div",{className:"yt-byob-modal-desktop yt-variant-selection-modal "+(x?"small-screen":"large-screen")},e.createElement(fs,{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(ys,{className:"yt-byob-modal-mobile-content",style:{padding:"0px",position:"relative"},$isSmallScreen:x,ref:l},e.createElement(hs,{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(x?ne:te,document.body)}),Cs=({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"})))},Es=({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(_e,{className:"yt-byob-icon-plus",size:20})),n&&e.createElement("div",{className:"yt-byob-filter-section-body",style:{marginTop:"16px"}},o)),ks=({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:x,showActions:y=!0,openSections:h,toggleSection:b})=>{const[w,v]=t(null),C=vm(m?.general?.currencySymbol,x)??x??"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(Es,{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 "))))),y&&e.createElement("div",{className:"yt-byob-filter-actions",style:{display:"flex",gap:"12px",borderTop:"1px solid #eee",padding:"16px 0px",position:"sticky",bottom:"2px",paddingInline:"10px"}},e.createElement("button",{className:"yt-byob-filter-clear-button",onClick: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")))},Ts=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(ks,{...t,applyPriceFilter:()=>{t.applyPriceFilter(),r()},openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})}))),document.body):null},Ss=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(ks,{...t,showActions:!0,openSections:t.openSections||{},toggleSection:t.toggleSection||(()=>{})})):null},Ns=({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:x,sharedFiltersState:y,openSections:b,toggleSection:w,sortBy:v})=>{const[C,E]=t(!1),[k,T]=t(i),{showFilters:S,setShowFilters:N,priceMax:B,setPriceMax:z,priceMin:$,setPriceMin:F}=y,[I,P]=t(!1),D=l?.byob?.productFiltersDisplay||"drawer",A=!o&&"sidebar"===D,L="none"===D;n(()=>{s["filter.v.price"]||(z(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 _=Object.entries(s).reduce((e,[t,n])=>"filter.v.price"===t?$>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:L?"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",_>0&&e.createElement("span",{className:"yt-byob-active-filter-badge",style:{background:l?.general?.primaryColor||"#ef4444",color:"white",borderRadius:"999px",padding:"2px 8px",fontSize:"12px",lineHeight:1}},_)),r&&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&&!L&&e.createElement(Ts,{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:()=>{z(f),F(0),d({})},applyPriceFilter:()=>{d(e=>{const t={...e};return t["filter.v.price"]=[`min:${$}-max:${B}`],t})},priceMin:$,setPriceMin:F,priceMax:B,setPriceMax:z,maxPossiblePrice:f,styles:l,availableProductCount:u,products:m,unavailableProductCount:g,storeCurrencyCode:x,openSections:b,toggleSection:w}))},Bs=()=>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(Bs,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 Fs({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(vc,{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(Cc,{className:"yt-byob-quantity-display"},t," added"),e.createElement("button",{className:"yt-byob-quantity-plus-button",onClick:e=>{e.stopPropagation();const l=Math.min(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 Is=({product:o,styles:a,selectedVariant:i})=>{const[l,c]=t(!1),s=r(()=>Cm(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=>Cm(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})))},Ps=({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:x,tierIndex:y})=>{const b=de(gs),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),[z,$]=t(0),[F,I]=t(window.innerWidth<450),[P,D]=t("normal"),A=k?.find(e=>e?.node?.id===N)?.node,L=T(N||"");n(()=>{const e=u.find(e=>e.variantId===N&&(void 0===y||e.tierIndex===y));$(e?e.quantity:0)},[u,N,y]),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 _=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(Tc,{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(L<=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(Sc,{className:"yt-byob-image-wrapper"},e.createElement(Is,{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),_&&e.createElement("div",{className:"yt-byob-variant-selector-wrapper",style:{position:"relative",width:"100%"}},e.createElement(Nc,{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:F?"10px":"14px",color:"#666",fontWeight:"500",paddingBottom:"4px"}},t.charAt(0).toUpperCase()+t.slice(1))),V.length>2&&e.createElement("span",{className:"yt-byob-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",V.length-2," more"))),e.createElement(Bc,{isMobile:F,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(Fe,{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(Fe,{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&&!x?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"}},vm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",wm(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"},vm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",wm(A?.price)):e.createElement("span",{className:"yt-byob-free-price"},"Free"),(!f?.isFreebieTier||x)&&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"}},vm(w.general.currencySymbol,o?.storeCurrencyCode)??"Rs.",wm(A.compareAtPrice)))),(L>0||L===1/0)&&e.createElement(zc,{borderRadius:w?.byob.borderRadius,className:"yt-byob-add-to-bundle-wrapper yt-product-atc-wrapper"},(0===z||void 0===z)&&e.createElement(Ec,{style:{...!l&&{backgroundColor:w?.general.primaryColor||"#111",color:w?.general.primaryContrastColor||"#fff"}},disabled:l,onClick:e=>{e.stopPropagation(),e.preventDefault(),$(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&&z>0&&N&&e.createElement(kc,{className:"yt-byob-quantity-selector-container visible",style:{overflow:"hidden"}},e.createElement(Fs,{remainingQuantity:c,setQuantity:$,quantity:z,handleAddToBundle:i,variantId:N,product:r,handleRemoveItem:d,hideAddToBundle:l,selectedVariantInventoryQty:L})),o?.disableQuantitySelector&&z>0&&N&&e.createElement(Ec,{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(Fc,{className:"yt-byob-single-qty-remove yt-product-atc-single-qty-selector-remove",onClick:e=>{e.stopPropagation();const t=Math.max(0,z-1);$(t),d&&N&&d(N,y)}},e.createElement(We,{style:{color:"#fff",fontSize:"20px"}})))),L<=0&&L!==1/0&&e.createElement(Ec,{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(ws,{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)}}))},Ds=({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)),As=({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:x,productsPagination:y})=>{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({}),[z,$]=t(!1),F=S&&C===(i.builderTiers?.productTier?.length||0),I=C===(i.builderTiers?.productTier?.length||0)-1,P=S&&I&&!F,[D,A]=t(i?.products),[L,_]=t(!1),[R,M]=t({}),[O,V]=t(i?.products),[W,H]=t({}),[j,q]=t(y?.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,xe]=t({}),ye=e=>{xe(t=>{const n=!1!==t[e];return{...t,[e]:!n}})};n(()=>{ae.length>0&&xe(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)&&y?.cursorData&&q(y.cursorData)},[re,y?.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(x?.());e?.productFilters&&ie(e.productFilters??[])}catch(e){console.error("no filters data found")}})()},[Q?.byob,x,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),ze=((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(!y)return;const{initialCursorData:t,cursorData:n,fetchFn:r,setCursorData:o}=y,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[$e,Fe]=ce(gs),[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=Cm(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)},Le=()=>{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&&Le()}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)&&Fe(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const _e=(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}}}),Em(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?Cm(i.mobileCoverImageUrl):Cm(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?ze.filter(t=>e.some(e=>e.productId===t.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))&&Oe(t)):e.map(e=>ze.find(t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds?.[0])))).filter(e=>e&&Oe(e))}return ze.filter(Oe)},[U,Z,R,C,ze,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&&(_e(o,n,1),C<Z.length-(S?0:1))){E(C+1);const e=Z?.[C];e?.products?.length>1&&Le()}},[U,Z,C,D,k,ve,_e]);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(!y)return;const{cursorData:e,fetchFn:t}=y,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{_(!1)}}},{root:null,rootMargin:"300px",threshold:.01}),a=ne.current;return a&&o.observe(a),()=>{a&&o.unobserve(a)}},[y,L,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(Cs,{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(Ds,{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&&!F&&e.createElement(Ss,{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:ye}),e.createElement("div",{className:"yt-byob-products-column",style:{display:"flex",flexDirection:"column",flex:1,minWidth:0}},!F&&e.createElement("div",{className:"yt-byob-filters-wrapper",style:{width:"100%",marginBottom:"20px",display:"flex",flexDirection:"column",gap:"20px"}},e.createElement(Ns,{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:ye}),i?.customizations?.byob?.enableProductCategories&&K&&e.createElement("div",{className:"yt-byob-category-filter-container"},e.createElement(As,{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"},F&&i.personalizedForm?.title?e.createElement($s,{form:i.personalizedForm,formData:N,setFormData:B,isUploading:z,setIsUploading:$}):0!==We?.length||L?Ve.map((t,n)=>{if("productTier"===U){const r=(Z[C]?.minimumQuantity??0)>(k[C]?.length??0),o=ze.find(e=>e.productId===t.productId&&(t.variantIds.length<1||e.variantIds.includes(t.variantIds[0])));return o?e.createElement(Ps,{bundle:i,idx:n,key:t?.variantIds?.[0]??t.productId,product:o?.productDetails,handleAddToBundle:_e,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(Ps,{bundle:i,idx:n,key:t.productId,product:t?.productDetails,handleAddToBundle:_e,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")),!F&&L&&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(us,{builderTiers:i?.builderTiers,showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void Le();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:z}),p&&e.createElement("div",{className:"yt-byob-sticky-tracker-wrapper",style:{width:"100%",marginTop:"20px",position:"sticky",bottom:"10px",zIndex:999}},e.createElement(us,{showNextStep:P,handleAddToCart:async e=>{if(P)return E(C+1),void Le();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:z})))),$e&&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(vs,{handleAddToBundle:_e,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})})()))},_s=({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)},Rs=({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]),x=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:Cm(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=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",width:"100%",appearance:"none",marginRight:"30px",fontSize:"12px",fontWeight:600}},t?.productDetails?.variants?.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(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(Fe,{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(Fe,{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"}},vm(a.general.currencySymbol,p),wm((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"}},vm(a.general.currencySymbol,p),wm(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"}},vm(a.general.currencySymbol,p),wm(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:Cm(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(Fe,{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(Fe,{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"}},vm(a.general.currencySymbol,p),wm((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"}},vm(a.general.currencySymbol,p),wm(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"}},vm(a.general.currencySymbol,p),wm(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=>x(e.target.value),style:{padding:"6px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"12px",fontWeight:600,borderRadius:"4px"}},t.productDetails.variants.edges.map(t=>{const n=u(t?.node?.id);return e.createElement("option",{key:t?.node?.id,value:t?.node?.id,disabled:0===n,className:"yt-comboBundle-product-variant-option"},t?.node?.title)})),e.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-horizontal",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(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&&x(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&&x(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:Cm(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&&x(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:()=>x(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)}))))))},Ms=({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}),x=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 y=(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,z=b.comboBundle?.embedContentVisibility,$="bundles"==o.appName?o.pageHeader?.title:o?.title,F="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"}},z&&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&&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"}},vm(b.general.currencySymbol,o.storeCurrencyCode),wm(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"}},vm(b.general.currencySymbol,o.storeCurrencyCode),wm(C)),Number(k)>0&&!1!==v&&(()=>{const t="percentage"===(b?.comboBundle?.discountDisplayType||"amount")?`${S}% Off`:`Save ${vm(b.general.currencySymbol,o.storeCurrencyCode)}${wm(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(Rs,{key:`combo-product-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>y(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(Rs,{key:`combo-product-horizontal-${n}-${t.productId}`,product:t,styles:b,originalPrice:C,dealPrice:E,totalPriceSum:T,selectedVariantId:g[n],onVariantChange:e=>y(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 ${x?"":"yt-comboBundle-bundle-cta-button-disabled"} ${s?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:x?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor,color:b.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:b.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:x?"pointer":"not-allowed",border:`1px solid ${x?b.general?.ctaBackgroundColor||"#121212":b.general.disabledButtonColor}`,boxShadow:b.general.ctaShadowType,padding:b.general?.ctaPadding,width:b.general?.ctaWidth,margin:"0"},disabled:!x,onMouseOver:e=>{b.general.customizeHoverState&&x&&(e.currentTarget.style.backgroundColor=b.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=b.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{b.general.customizeHoverState&&x&&(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,x?b.comboBundle?.ctaTitle??"Add Bundle to cart":b.general.outOfStockLabel||"Out of Stock"," "))),z&&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,F))),o?.personalizedForm?.title&&e.createElement(_s,{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}))},Os=s.div`
|
|
3157
3157
|
max-width: 800px;
|
|
3158
3158
|
container-type: inline-size;
|
|
3159
3159
|
margin-top: ${e=>e.verticalMargin||"0px"};
|