yt-uikit 0.7.364 → 0.7.366
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 +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1926,7 +1926,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
1926
1926
|
font-size: 12px;
|
|
1927
1927
|
margin-top: 5px;
|
|
1928
1928
|
padding: 0 20px;
|
|
1929
|
-
`,Bd=e=>{if("string"!=typeof e)return e;const t=e.match(/^gid:\/\/shopify\/\w+\/(\d+)$/);return t?t[1]:e};function zd({themeColor:e,id:n,showPrice:r,detail:o,errorText:a,customText:i,showGiftIcon:s,addCartItem:d,removeCartItem:p}){const[u,m]=Gt(Cd),[f,g]=c(null),[h,x]=c(!1),[y,b]=c(null),{setLoading:v}=nn();l((()=>{o?.availableForSale&&x(!0),o?.variants?.nodes&&o?.variants?.nodes.length>0&&g(o?.variants?.nodes[0])}),[o]);const w=f?.price?.amount;return h?t.createElement(kd,null,t.createElement(Ed,null,t.createElement(Td,null,s?t.createElement(it,{size:24,color:e,style:{height:"24px",width:"24px"}}):null,i||"+ Gift-Wrap",r?t.createElement("span",{style:{color:e}},"₹",w):""),t.createElement(Sd,{type:"checkbox",checked:u,onChange:async()=>{try{v(!0,!0),b(null),m(!u),!u&&d&&f?await d(Bd(f?.id),1):u&&p&&f&&await p(Bd(f?.id),"giftWrap"),v(!1,!1)}catch(e){v(!1,!1),b("Failed to add to cart"),m(u),console.error("Error updating gift wrap:",e)}},$themeColor:e,disabled:!h})),y&&t.createElement($d,null,y)):null}const Dd=x.div`
|
|
1929
|
+
`,Bd=e=>{if("string"!=typeof e)return e;const t=e.match(/^gid:\/\/shopify\/\w+\/(\d+)$/);return t?t[1]:e};function zd({themeColor:e,id:n,showPrice:r,detail:o,errorText:a,customText:i,showGiftIcon:s,addCartItem:d,removeCartItem:p}){const[u,m]=Gt(Cd),[f,g]=c(null),[h,x]=c(!1),[y,b]=c(null),{setLoading:v}=nn();l((()=>{o?.availableForSale&&x(!0),o?.variants?.nodes&&o?.variants?.nodes.length>0&&g(o?.variants?.nodes[0])}),[o]);const w=f?.price?.amount;return h?t.createElement(kd,null,t.createElement(Ed,null,t.createElement(Td,null,s?t.createElement(it,{size:24,color:e,style:{height:"24px",width:"24px"}}):null,i||"+ Gift-Wrap",r?t.createElement("span",{style:{color:e}},"₹",Number(w).toFixed(0)):""),t.createElement(Sd,{type:"checkbox",checked:u,onChange:async()=>{try{v(!0,!0),b(null),m(!u),!u&&d&&f?await d(Bd(f?.id),1):u&&p&&f&&await p(Bd(f?.id),"giftWrap"),v(!1,!1)}catch(e){v(!1,!1),b("Failed to add to cart"),m(u),console.error("Error updating gift wrap:",e)}},$themeColor:e,disabled:!h})),y&&t.createElement($d,null,y)):null}const Dd=x.div`
|
|
1930
1930
|
margin-top: 10px;
|
|
1931
1931
|
margin-bottom: 5px;
|
|
1932
1932
|
margin-left: 1rem;
|
|
@@ -3530,7 +3530,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
|
|
|
3530
3530
|
font-size: 1em;
|
|
3531
3531
|
justify-content: center;
|
|
3532
3532
|
align-items: center;
|
|
3533
|
-
`;const Rm=n(((e,n)=>{const[r,o]=Gt(qu),a=(e.disableInventoryTracking?r?.variants.edges?.filter((t=>t.node.inventoryQuantity>0||e.disableInventoryTracking)):r?.variants.edges)??[],[i,s]=c(a[0]?.node),[d,p]=c(0),[u,m]=c("undefined"!=typeof window&&window.innerWidth<=600),[f,g]=c(1),[h,x]=c("idle"),[y,b]=c(null),[w,C]=c(null);l((()=>{if(r){const t=r.variants.edges?.filter((t=>t.node.inventoryQuantity>0||e.disableQuantitySelector));s(r?.selectedVariant??t[0]?.node)}}),[r]),l((()=>{const t=e.selectedProducts.find((e=>e.variantId===i?.id));g(t?t.quantity:0)}),[f,e.selectedProducts,i]);const k=()=>{i?.id&&r&&(x("check"),e.handleAddToBundle(i?.id,r,1),setTimeout((()=>{x("idle"),o(void 0)}),500))};if(l((()=>{const e=()=>m(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),!r||0===a.length)return null;const{title:E,descriptionHtml:T,media:S,variants:$}=r,B=S.edges.map((e=>e?.node.preview.image)).filter((e=>e?.url?.length>0));l((()=>{if(r&&i?.image?.url&&Array.isArray(B)){const e=B.findIndex((e=>e?.url===i?.image?.url));-1!==e&&e!==d&&p(e)}}),[i]);const z=t=>{const n=t.target.value,r=a.find((e=>e.node.id===n))?.node;r&&(r.inventoryQuantity>0||e.disableInventoryTracking)&&s(r)};l((()=>{if(r){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{o(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}}),[r,o]);const D=e=>{b(e.targetTouches[0].clientX),C(null)},_=e=>{C(e.targetTouches[0].clientX)},I=()=>{if(null!==y&&null!==w&&B.length>1){const e=y-w,t=50;e>t?p((e=>e<B.length-1?e+1:0)):e<-t&&p((e=>e>0?e-1:B.length-1))}b(null),C(null)},P=e.hideAddToBundle||(i?.inventoryQuantity??0)<=0&&!e.disableInventoryTracking||e?.disableQuantitySelector&&f>=1||"idle"!==h,O=t.createElement(Nm,null,t.createElement(Fm,{$isSmallScreen:u,ref:n},t.createElement(Mm,{ref:n,className:"yt-variant-selection-modal"},t.createElement("div",{className:"yt-variant-selection-modal "+(u?"small-screen":"large-screen")},t.createElement(Am,{onClick:()=>{o(void 0)},style:{backgroundColor:"white"}},t.createElement(lt,{size:"25"})),t.createElement("div",{className:"image-section"},t.createElement(t.Fragment,null,t.createElement("div",{onTouchStart:D,onTouchMove:_,onTouchEnd:I},t.createElement(Om,{small:B[d]?.url,medium:B[d]?.url,large:B[d]?.url,hideDownload:!0,className:"main-image",imageBackgroundColor:"#000"})),t.createElement("div",{className:"image-gallery",style:{display:"flex",flexDirection:"row",overflow:"auto",gap:"10px",scrollbarWidth:"none"}},B.length>1&&B.filter((e=>e?.url.length>0)).map(((n,r)=>t.createElement("img",{key:r,src:n?.url,alt:n.altText||`${E} - Image ${r+1}`,onClick:()=>p(r),className:d===r?"active":"",style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...d===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"}})))))),t.createElement("div",{className:"details-section",style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},t.createElement("h2",null,a.length>1?i?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating,"rating")),"ratingAndReviewCount"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",r?.rating?.averageRating,t.createElement(Gn,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," reviews)"),t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},a.length>1&&t.createElement("div",null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},i?.title)),t.createElement("select",{value:i?.id||"",onChange:z,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}},a.map((({node:n})=>t.createElement("option",{key:n.id,value:n.id,disabled:!n.inventoryQuantity&&!e.disableInventoryTracking},n.title)))),t.createElement("span",{style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(oo,null)))),t.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"column"}},i?.compareAtPrice&&parseFloat(i.compareAtPrice)>parseFloat(i?.price)&&t.createElement("div",{style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.price)))),t.createElement("div",{style:{width:"80%"},className:"yt-product-modal-atc-wrapper"},t.createElement("button",{style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:P?.5:1,cursor:P?"not-allowed":"pointer"},className:"yt-product-modal-atc-button",onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:P},e.styles.byob.addToBundleCTAText??"Add to bundle")))),t.createElement("div",{style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},t.createElement("span",null)),t.createElement("span",{className:"yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:T}})))))),A=t.createElement(Nm,null,t.createElement(Fm,{style:{padding:"0px",position:"relative"},$isSmallScreen:u,ref:n},t.createElement(Mm,{ref:n,className:"yt-variant-selection-modal"},t.createElement("button",{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:()=>{o(void 0)}},t.createElement(ao,{style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),t.createElement("div",{className:"yt-variant-selection-modal small-screen",style:{padding:"0px"}},t.createElement("div",{className:"image-section"},t.createElement(t.Fragment,null,t.createElement("div",{style:{position:"relative"},onTouchStart:D,onTouchMove:_,onTouchEnd:I},t.createElement(Om,{small:B[d]?.url,medium:B[d]?.url,large:B[d]?.url,hideDownload:!0,className:"main-image",imageBackgroundColor:"#000"}),t.createElement("div",{style:{position:"absolute",bottom:"20px",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},B.length>1&&B.map(((e,n)=>t.createElement("span",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:d===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}}))))),t.createElement("div",{className:"image-gallery",style:{display:"flex",flexDirection:"row",overflowX:"auto",padding:"5px 20px",gap:"5px",scrollbarWidth:"none"}},B.length>1&&B.map(((n,r)=>t.createElement("img",{key:r,src:n?.url,alt:n.altText||`${E} - Image ${r+1}`,onClick:()=>p(r),className:d===r?"active":"",style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...d===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"}})))))),t.createElement("div",{className:"details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},t.createElement("h2",{style:{margin:"0px"}},a.length>1?i?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Gn,{style:{color:"dodgerblue",marginLeft:"4px"},size:14})," ","(",e?.rating?.ratingCount," reviews)"),t.createElement("div",{style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},t.createElement("span",null)),t.createElement("div",{className:"yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:T}})))),t.createElement("div",{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}},a.length>1&&t.createElement("div",null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",margin:"10px 0"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},i?.title)),t.createElement("select",{value:i?.id||"",onChange:z,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}},a.map((({node:n})=>t.createElement("option",{key:n.id,value:n.id,disabled:!n.inventoryQuantity&&!e.disableInventoryTracking},n.title)))),t.createElement("span",{style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(oo,null)))),t.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{style:{width:"fit-content",minWidth:"fit-content",display:"flex",flexDirection:"column",paddingRight:"10px"}},i?.compareAtPrice&&t.createElement("div",{style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.price)))),!e.hideAddToBundle&&((i?.inventoryQuantity??0)>0||e.disableInventoryTracking)&&(!e?.disableQuantitySelector||f<1)&&t.createElement("div",{style:{width:"100%"}},t.createElement("button",{style:{textTransform:"uppercase",fontWeight:"800",width:"100%",cursor:"pointer",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden"},onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:"idle"!==h},e.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return v.createPortal(u?A:O,document.body)})),Lm=({options:e,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i})=>t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},e?.map((e=>{const l=!a||a(e.name);return i&&!l?null:t.createElement("div",{key:e.name,onClick:()=>{l&&r(e)},style:{cursor:l?"pointer":"not-allowed"}},((e,n)=>{const r=!a||a(e.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 e.value&&(()=>{if(!e.value.trim())return!1;if(e.value===e.name||e.value.length<3)return!1;try{const t=document.createElement("div");return t.style.color=e.value,""!==t.style.color}catch{return!1}})()?t.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:e.value}}):t.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"}},e.name);return"image"===o?t.createElement("img",{src:En(e.value,48,85,"webp")||"/placeholder.svg",alt:e.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):t.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"}},e.name)})(e,n?.name===e.name))}))),jm=({product:e,isOpen:n,onClose:r,variantOptions:o,cta:a,onConfirm:i,disableInventoryTracking:s})=>{const[d,p]=c((()=>{const t=e.variants.edges.find((e=>s||e.node.inventoryQuantity>0))?.node;return t?.title&&"Default Title"!==t.title?t.title.split(" / "):e.options?.map((e=>e.values[0]))||[]})),[u,m]=c(window.innerWidth<1024);l((()=>{const e=()=>m(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),l((()=>{const e=e=>{"Escape"===e.key&&r()};return n&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[n,r]);const f=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?d.join(" / "):d[0])))?.node,g=f?.image?.url||e.featuredMedia?.preview?.image?.url,h=En(g,150,85,"webp"),x=e=>{if(!o?.options)return"text";const t=o.options.find((t=>t.name===e));return t?.type||"text"},y=e=>{if(!o?.options)return e.values.map((e=>({name:e,value:e})));const t=o.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}}))},b=(e,t)=>{const n=d[t];if(!n)return null;return y(e).find((e=>e.name===n))||null};if(!n)return null;const w=t.createElement("div",{onClick:r,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},t.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"}}},t.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"),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},t.createElement("img",{src:h,alt:e.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),t.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},t.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},e.title))),t.createElement("div",{style:{padding:"20px"}},e.options.map(((n,r)=>t.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},t.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),t.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},b(n,r)?.name||n.values[0])),t.createElement(Lm,{options:y(n),selectedValue:b(n,r),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n)})(r,e)},type:x(n.name),isOptionAvailable:t=>((t,n)=>{if(s)return!0;const r=[...d];r[t]=n;const o=e.options?.length>0?r.join(" / "):r[0],a=e.variants.edges.find((e=>e.node.title===o))?.node;return!!a&&a.inventoryQuantity>0})(r,t),isMobile:u})))))),t.createElement("button",{onClick:()=>{const t=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?d.join(" / "):d[0])))?.node,n=t&&(s||t.inventoryQuantity>0);if(t?.id&&n)i(t.id),r();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",d);const t=e.variants.edges.find((e=>s||e.node.inventoryQuantity>0))?.node.id;t&&(i(t),r())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:a.backgroundColor,color:a.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 v.createPortal(w,document.body)};function Vm({quantity:e,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:c,disableInventoryTracking:s,selectedVariantInventoryQty:d}){const p={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"},u=s||e<d;return t.createElement(nu,null,t.createElement("button",{onClick:t=>{t.stopPropagation();const r=Math.max(0,e-1);n(r),l&&a&&l(a,1)},style:p},"-"),t.createElement(ru,null,e," added"),t.createElement("button",{onClick:t=>{t.stopPropagation();const l=Math.min(r,e+1);n(l),o&&a&&i&&o(a,i,1)},disabled:!u||c,style:{...p,cursor:!u||c?"not-allowed":"pointer",opacity:!u||c?.6:1}},"+"))}const Hm=({product:e,styles:n,selectedVariant:r})=>{const[o,a]=c(!1),i=r?.image?.url||e?.featuredMedia?.preview?.image?.url||e?.media?.edges?.[0]?.node?.image?.url||"",l=e?.media?.edges?.map((e=>e?.node?.preview.image?.url)).filter(Boolean),s=l?.[1]??i??"";return t.createElement("div",{style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:n.general.imageAspectRatio||"1/1"},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1)},t.createElement("div",{style:{width:"100%",height:"100%",position:"relative"}},t.createElement("img",{style:{width:"100%",height:"100%",objectFit:"cover",opacity:o&&(i||l?.[0])!==s?0:1,transition:l?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:o?"scale(1.1)":"scale(1)"},src:i||l?.[0],alt:e.title}),(i||l?.[0])!==s&&t.createElement("img",{style:{width:"100%",height:"100%",objectFit:"cover",opacity:o?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:o?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0},src:s||i,alt:e.title})))},Wm=({product:e,bundle:n,handleAddToBundle:r,hideAddToBundle:o,remainingQuantity:a,themeColor:i,handleRemoveItem:s,transitionActive:d,idx:p,selecteditems:u,customVariantsQuantity:m})=>{const f=Ut(qu),g=n.customizations,h=g?.byob?.variantSelectorType,[x,y]=c(!1),b=g.general?.variantTitleSuffix?e?.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(" ")}}}))})(e?.variants?.edges);if(!b||!b.length)return t.createElement(t.Fragment,null);const v=b?.find((e=>e.node.inventoryQuantity>0||!g?.general.trackInventory))?.node?.id;if(!v&&!g.general.showOutOfStockProducts)return t.createElement(t.Fragment,null);const[w,C]=c(b?.find((e=>!g?.general.trackInventory||e.node.inventoryQuantity>0))?.node?.id||b[0]?.node?.id),[k,E]=c(0),[T,S]=c(window.innerWidth<450),[$,B]=c("normal"),z=b?.find((e=>e?.node?.id===w))?.node,D=m&&m.length>0&&m.find((e=>e.variantId==z?.id))?.quantity||z&&z?.inventoryQuantity;l((()=>{const e=u.find((e=>e.variantId===w));E(e?e.quantity:0)}),[k,u,w]),l((()=>{const e=()=>{S(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{CSS.supports("font-weight","500")?B("500"):CSS.supports("font-weight","400")?B("400"):CSS.supports("font-weight","600")&&B("600")}),[]),l((()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",$)}),[$]),l((()=>{if(w&&!b?.some((e=>e.node.id===w))){const e=b[0]?.node.id;e&&C(e)}}),[w,b]);const _=e.variants&&e.variants.edges?.length>1&&"customOptions"!==h,I="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,P="53933408435"===I,O="75851235630"===I,A=(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[]})(e),N=A.length>0;return t.createElement(t.Fragment,null,t.createElement(iu,{borderRadius:g?.byob.borderRadius,borderColor:g?.byob.borderColor,shadowType:g?.byob.shadowType,backgroundColor:g?.byob.cardBackgroundColor,className:"bundle-builder-product-container "+(d?"yt-product-card-transition-active":p%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(D<=0&&g?.general.trackInventory)return;const t={...e,variants:{...e.variants,edges:b},selectedVariant:z};f(t)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent"}},t.createElement(lu,null,t.createElement(Hm,{product:e,styles:g,selectedVariant:z}),n?.productCardBadgeText&&t.createElement("div",{style:{position:"absolute",top:"0px",left:"0px",backgroundColor:g?.general.primaryColor||"#111",color:g?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:g.byob.borderRadius}},n.productCardBadgeText),_&&t.createElement("div",{style:{position:"relative",width:"100%"}},t.createElement(cu,{isCoralHaze:P,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:w||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),C(e.target.value)}},b?.map((e=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,r=e.node.title.length>n?e.node.title.substring(0,n)+"...":e.node.title;return t.createElement("option",{key:e.node.id,value:e.node.id},r)}))),t.createElement("div",{style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},t.createElement(F,null)))),t.createElement("div",null,"enabled"===n?.customizations?.byob?.productCardCategoryVisibility&&N&&t.createElement("div",{style:{padding:"2px 4px"}},t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"}},A.slice(0,2).map(((e,n)=>t.createElement("span",{key:n,style:{fontSize:T?"8px":"12px",color:"#666",fontWeight:"500"}},e.charAt(0).toUpperCase()+e.slice(1)))),A.length>2&&t.createElement("span",{style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",A.length-2," more"))),t.createElement(su,{isMobile:T,showBorder:n?.showBorder??!0,style:{...!g?.byob.productsPriceVisibility&&{padding:"8px"},...g?.byob.productTitleFontSize&&{fontSize:g?.byob.productTitleFontSize}}},O?String(z?.displayName).replace("- Default Title",""):e.title,z?.commonSuffix?" -"+z?.commonSuffix:"")),"ratingOnly"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Gn,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",e?.rating?.ratingCount," reviews)"),g?.byob.productsPriceVisibility&&t.createElement("div",{className:"yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:n?.showBorder?"0px 10px":"0 4px"}},parseFloat(z?.price??"0")>0?t.createElement("span",null,Eh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",kh(z?.price)):t.createElement("span",null,"Free"),z?.compareAtPrice&&g?.byob.compareAtPriceVisibility&&parseFloat(z.compareAtPrice)>parseFloat(z?.price)&&t.createElement("span",{className:"yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Eh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",kh(z.compareAtPrice))),(D>0||!g?.general.trackInventory)&&t.createElement(du,{borderRadius:g?.byob.borderRadius,className:"yt-product-atc-wrapper"},(0===k||void 0===k)&&t.createElement(ou,{style:{...!o&&{backgroundColor:g?.general.primaryColor||"#111",color:g?.general.primaryContrastColor||"#fff"}},disabled:o,onClick:t=>{t.stopPropagation(),t.preventDefault(),E(1),(()=>{if(!w)return;"customOptions"===h&&b.length>1?y(!0):r(w,e,1)})()},className:"yt-product-atc-button"},g?.byob.addToBundleCTAText),!n?.disableQuantitySelector&&k>0&&w&&t.createElement(au,{className:"visible",style:{overflow:"hidden"}},t.createElement(Vm,{remainingQuantity:a,setQuantity:E,quantity:k,handleAddToBundle:r,variantId:w,product:e,handleRemoveItem:s,hideAddToBundle:o,disableInventoryTracking:!g?.general.trackInventory,selectedVariantInventoryQty:D})),n?.disableQuantitySelector&&k>0&&w&&t.createElement(ou,{style:{backgroundColor:"#747474",color:g?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-product-atc-single-qty-selector"},t.createElement(pu,{className:"yt-product-atc-single-qty-selector-added"},"ADDED"),t.createElement(uu,{onClick:e=>{e.stopPropagation();const t=Math.max(0,k-1);E(t),s&&w&&s(w,1)},className:"yt-product-atc-single-qty-selector-remove"},t.createElement(to,{style:{color:"#fff",fontSize:"20px"}})))),D<=0&&g?.general.trackInventory&&t.createElement(ou,{style:{backgroundColor:g.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},g?.general.outOfStockLabel||"Out of Stock")),"customOptions"===h&&x&&b.length>1&&t.createElement(jm,{product:e,isOpen:x,onClose:()=>y(!1),variantOptions:n.variantOptions,cta:{textColor:g.general.ctaTextColor,backgroundColor:g.general.primaryColor},onConfirm:t=>{C(t),r(t,e,1)},disableInventoryTracking:!g?.general.trackInventory}))},Um=({currentStep:e,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:s})=>t.createElement("div",{style:{textAlign:"center",fontSize:"20px"}},t.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:r}).map(((c,d)=>{const p=d+1,u=o[d].minimumQuantity-(i[d]?.length??0)==0,m=d===e;return l="black"===l?"#000000":l,t.createElement(t.Fragment,{key:p},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===s?()=>{}:n(p-1)},t.createElement("div",{style:{fontSize:"14px"}},"Step ",p),t.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},t.createElement("div",{style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),t.createElement("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?`${l}50`:"white",border:`2px solid ${u?l:m?"#666666":"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),t.createElement("div",{style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))}))),t.createElement("div",{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[e]?.title)),Gm=({isMobile:e,setSearchTerm:n,searchTerm:r,styles:o,setSortBy:a})=>{const[i,s]=c(!1),[d,p]=c(r);return l((()=>{const e=setTimeout((()=>{n(d)}),300);return()=>clearTimeout(e)}),[d,n]),t.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:e?"column":"row",justifyContent:"space-between",alignItems:e?"flex-end":"center",textAlign:"center",marginBottom:"20px",width:"97%",gap:e?"10px":"0"}},t.createElement("div",{className:"yt-byob-sort-filter-inner",style:{display:"flex",flexDirection:i&&e?"column":e?"row-reverse":"row",justifyContent:"space-between",alignItems:i?"":"center",gap:"12px",width:"100%"}},t.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:e?i?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},e&&!i?t.createElement(eo,{className:"yt-byob-search-icon",fontSize:"20px",color:"#555",style:{cursor:"pointer",lineHeight:"normal"},onClick:()=>s(!0)}):t.createElement(t.Fragment,null,t.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:e?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?"0 2px 4px rgba(0, 0, 0, 0.1)":"none",textAlign:"start"},placeholder:"Search by Product Name",value:d,onChange:e=>p(e.target.value)}),!i&&t.createElement("span",{className:"yt-byob-search-icon-input",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center",background:"white",paddingLeft:"5px"}},t.createElement(eo,{fontSize:"18px",style:{lineHeight:"normal"}}))),e&&i&&t.createElement("span",{className:"yt-byob-search-close-icon",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>s(!1)},"✖")),t.createElement("div",{className:"yt-byob-filter-wrapper",style:{display:"flex",alignItems:"center",textAlign:"center",border:window.innerWidth>600?"1px solid #d1d5db":"",padding:"8px 12px",fontSize:"14px",cursor:"pointer",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?window.innerWidth>600?"0 2px 4px rgba(0, 0, 0, 0.1)":" ":"none"}},t.createElement("span",{className:"yt-byob-filter-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),t.createElement("select",{className:"yt-byob-filter-select",style:{flex:1,border:"none",height:"auto",padding:"0px",marginBottom:"0px",background:"transparent",fontSize:"14px",color:"#333",fontWeight:"500",width:e?"120px":"",outline:"none",cursor:"pointer",textAlign:"start"},onChange:e=>a(e.target.value)},t.createElement("option",{value:"best-selling"},"Featured"),t.createElement("option",{value:"title-asc"},"Product Title (A-Z)"),t.createElement("option",{value:"title-desc"},"Product Title (Z-A)"),t.createElement("option",{value:"price-low-to-high"},"Price (Low to High)"),t.createElement("option",{value:"price-high-to-low"},"Price (High to Low)")))))},Qm=({styles:e,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"===e?.byob?.categoryFilterOnPage?t.createElement("div",{style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"},className:"yt-categoryfilter-wrapper"},t.createElement("div",{style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"},className:"yt-categoryfilter-tabs-container"},["All",...r].map((r=>{const a=o===r;return t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-categoryfilter-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?e.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(e.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${e?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:t=>{a||(t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},t.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),t.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))})))):t.createElement("div",{style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"},className:"yt-categoryfilter-wrapper"},t.createElement("div",{style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"},className:"yt-categoryfilter-buttons-container"},["All",...r].map((r=>t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-categoryfilter-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?e?.general.primaryColor:"#e0e0e0"}`,borderRadius:e?.general.ctaBorderRadius,backgroundColor:o===r?e?.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:t=>{o!==r&&(t.currentTarget.style.borderColor=e?.general.primaryColor,t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1))))))},Ym=({bundle:e,selectedItems:n,setSelectedItems:r,handleAddToCart:a,bundleAddToCartLoading:i,renderingOnPage:s,selectedItemsQuantity:d,handleRemoveItem:p,bundleSubtotal:u})=>{const[m,f]=c(void 0),[g,h]=c(window.innerWidth<450),[x,y]=c(0),[b,v]=c({}),w=e.builderTiers?.type,C=e.customizations,k=e.builderTiers?.productTier??[],E=e.builderTiers?.offerTier??[],[T,S]=c([]),[$,B]=c(!1),[z,D]=c("All");l((()=>{const t=new Set;let n=!1;e?.products?.forEach((e=>{const r=e.productDetails;if(r.metafield&&"yourtoken_bundles_app"===r.metafield.namespace&&"categories"===r.metafield.key){let e=[];if(r.metafield.jsonValue&&Array.isArray(r.metafield.jsonValue))e=r.metafield.jsonValue;else if(r.metafield.value)try{const t=JSON.parse(r.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}e.length>0&&(n=!0,e.forEach((e=>t.add(e))))}})),S(Array.from(t)),B(n)}),[e.products]);const _=((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})))(e.products.filter((e=>"active"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status)),z),I="productTier"===w?k.reduce(((e,t)=>e+t.minimumQuantity),0):"offerTier"===w?E.reduce(((e,t)=>e+t.minimumQuantity),0):e.minimumQuantity,[P,O]=c(""),[A,N]=c(""),F=((e,t)=>e.filter((e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase()))))(_,P),M=((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}})))(F,A),R=((e,t,n,r,o)=>(e[o]?.products.filter((e=>t.some((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))&&t?.productDetails.title.toLowerCase().includes(n?.toLowerCase())))))||[]).sort(((e,n)=>{let o=t.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0])))),a=t.find((e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0]))));if(!o||!a)return 0;const i=o.productDetails?.title?.toLowerCase(),l=a.productDetails?.title?.toLowerCase(),c=parseFloat(o?.productDetails?.variants?.edges[0]?.node?.price||"0"),s=parseFloat(a?.productDetails?.variants?.edges[0]?.node?.price||"0");switch(r){case"title-asc":return i.localeCompare(l);case"title-desc":return l.localeCompare(i);case"price-low-to-high":return c-s;case"price-high-to-low":return s-c;default:return 0}})))(k,M,P,A,x),[L,j]=Gt(qu),[V,H]=c(!1);l((()=>{setTimeout((()=>{H(!0)}),100)}),[]);const W=o(null);l((()=>{const e=()=>{h(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(e.coverImageUrl){const t=new Image;t.src=e.coverImageUrl,t.onload=()=>{f(t.width/t.height)}}}),[e.coverImageUrl]),l((()=>{H(!1),setTimeout((()=>H(!0)),100)}),[x]);const U=(e,t)=>{if("productTier"===w){let n={...b},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=k.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}v(n);const o=k.findIndex(((e,t)=>n[t]?.length<e.minimumQuantity));-1!==o&&y(o)}p(e)};l((()=>{if("productTier"===w){const e=Object.fromEntries(k.map((e=>[e.tier,[]])));v(e)}}),[e]),l((()=>{if("productTier"!==w||!k[x])return;if(I===d)return;const e=k.findIndex(((e,t)=>{const n=b[t]||[];return t>=x&&n.length<e.minimumQuantity}));-1!==e&&e!==x&&(y(e),(()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})})())}),[b,k,w]),l((()=>{O("")}),[x]),l((()=>{function e(e){if(!W.current||!e.target)return;!W.current.contains(e.target)&&j(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]);const G=(e,t,o)=>{var a;"productTier"===w&&(a=e,v((e=>{const t={...e},n=k.findIndex(((e,n)=>{const r=t[n]||[];return n>=x&&r.length<e.minimumQuantity}));return-1!==n&&y(n),t[n]||(t[n]=[]),t[n].push(a),t}))),Th(e,t,o,n,r)},Q=(()=>{if(!e?.builderTiers)return e.minimumQuantity;const{type:t,offerTier:n,productTier:r}=e.builderTiers,o="offerTier"===t?n:"productTier"===t?r:null;if(!o)return e.minimumQuantity;let a=0;return o.map((e=>{a+=e.minimumQuantity})),a})(),Y=g&&e.mobileCoverImageUrl?e.mobileCoverImageUrl:e.coverImageUrl||null,q=e.customStoreDetails?.fixedInventoryDetails,Z=e=>{const t=C?.general?.showOutOfStockProducts;if(t||!C?.general.trackInventory)return!0;const n=e?.productDetails?.variants?.edges||[];if(q){if(n.some((e=>q.some((t=>t.variantId===e.node.id&&t.quantity>0)))))return!0}return n.some((e=>e.node.inventoryQuantity>0))},K="bundles"==e.appName?e.pageHeader?.title:e?.title,X="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:C.byob.sectionBackgroundColor,..."transparent"!==C.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Y?t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...e?.coverImageVerticalMargin&&{marginBottom:e?.coverImageVerticalMargin,marginTop:e?.coverImageVerticalMargin}}},Y&&t.createElement("img",{src:Y,alt:"Background",style:{width:"100%",height:"auto",display:"block"}}),t.createElement("div",{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)"}},t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.titleFontSize??"3rem",fontWeight:"700",color:C?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:C?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},K),t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.subtitleFontSize??"1.5rem",color:C?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},X))):(K||X)&&t.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},K&&t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.titleFontSize??"3rem",fontWeight:"700",color:C?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:C?.byob?.titleBackgroundColor??"transparent"}},K),X&&t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.subtitleFontSize??"1.5rem",color:C?.byob?.titleTextColor??"#000"}},X)),t.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===w&&k.length>0&&C?.byob.productTiersVisibility&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(Um,{currentStep:x,totalSteps:k.length,tiers:k,isMobile:g,primaryColor:C?.general?.primaryColor,primaryTextColorCta:C?.general?.primaryContrastColor,setCurrentProductTier:y,selectedProductsByTier:b,tierNavigation:C.byob.tierNavigation})))),t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},e?.enableSortAndFilter&&t.createElement(Gm,{isMobile:g,searchTerm:P,setSearchTerm:O,setSortBy:N,styles:C}),e?.customizations?.byob?.enableProductCategories&&$&&t.createElement("div",null,t.createElement(Qm,{styles:C,isMobile:g,categories:T,activeCategory:z,onCategoryChange:e=>{D(e)}}))),t.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:"center",width:"100%"},className:"products-display"},0===M?.length||"productTier"===w&&0===R?.length?t.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===w&&k.length>0?R.filter((e=>Z(M.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))))).map(((r,o)=>{const a=(k[x]?.minimumQuantity??0)>(b[x]?.length??0),i=M.find((e=>e.productId===r.productId&&(r.variantIds.length<1||e.variantIds.includes(r.variantIds[0]))));return i?t.createElement(Wm,{bundle:e,idx:o,key:r?.variantIds?.[0]??r.productId,product:i?.productDetails,handleAddToBundle:G,hideAddToBundle:!a,remainingQuantity:Q-d,themeColor:e?.dealTextColor,handleRemoveItem:e=>U(e,x),selecteditems:n,transitionActive:V,customVariantsQuantity:q}):null})):M.filter(Z).map(((r,o)=>t.createElement(Wm,{bundle:e,idx:o,key:r.productId,product:r?.productDetails,handleAddToBundle:G,hideAddToBundle:d>=Q,remainingQuantity:Q-d,themeColor:e?.dealTextColor,handleRemoveItem:p,selecteditems:n,transitionActive:V,customVariantsQuantity:q})))),!s&&t.createElement(Yu,{builderTiers:e?.builderTiers,handleAddToCart:a,minimumQuantity:I,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,handleRemoveItem:p,handleRemoveItemProductTier:U,selectedItemsQuantity:d,percentageOff:e.percentageOff,loading:i,bundleSubtotal:u,amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:e?.dealTextColor??"#333",primaryTextColorCta:e?.primaryTextColorCta??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:b,renderingOnPage:s})),s&&t.createElement(Yu,{handleAddToCart:a,minimumQuantity:I,builderTiers:e?.builderTiers,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,loading:i,handleRemoveItem:p,handleRemoveItemProductTier:U,percentageOff:e.percentageOff,selectedItemsQuantity:d??0,bundleSubtotal:u??{price:0,compareAtPrice:0},amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:C?.general.primaryColor||"#000",primaryTextColorCta:C.general.primaryContrastColor??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:b,renderingOnPage:s}),L&&void 0!==d&&(()=>{let r=d<e.minimumQuantity;return"productTier"==w?r=(k[x]?.minimumQuantity??0)>(b[x]?.length??0):"offerTier"==w&&(r=d<E.reduce(((e,t)=>e+t.minimumQuantity),0)),t.createElement(Rm,{handleAddToBundle:G,ref:W,remainingQuantity:e.minimumQuantity-d,hideAddToBundle:!r,disableQuantitySelector:e?.disableQuantitySelector??!1,disableInventoryTracking:!e?.customizations.general.trackInventory,selectedProducts:n,themeColor:C?.general.primaryColor||"#000",primaryTextColorCta:e?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:C?.general.primaryColor||"#000",cornerRadius:e?.customizations.byob.borderRadius,styles:e.customizations,reviewRatingType:e?.reviewRatingType??"none"})})())},qm=({product:e,selectedVariantId:n,onVariantChange:r,styles:o,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:s,storeCurrencyCode:d})=>{const p=e?.productDetails?.variants?.edges?.find((e=>e?.node?.id===n))?.node,u=i((()=>{if(p?.title&&e.productDetails.options){const t=p.title.split(" / ");if(t.length===e.productDetails.options.length)return t}return e.productDetails.options?.map((e=>e.values[0]))||[]}),[p,e.productDetails.options]),m=e=>{r(e)};return c?t.createElement("div",{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"}},t.createElement("div",{style:{position:"relative",width:"100%"}},o.comboBundle.subProductsImageVisibility&&t.createElement(t.Fragment,null,t.createElement("img",{src:p?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg",alt:e?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:o.general?.imageAspectRatio||"1/1"}}),t.createElement("div",{style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},e?.productDetails?.variants?.edges?.length>1&&t.createElement(t.Fragment,null,t.createElement("select",{value:n,onChange:e=>m(e.target.value),style:{padding:"8px 10px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"14px",width:"100%",appearance:"none",marginRight:"30px"}},e?.productDetails?.variants?.edges.map((e=>t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:e.node.inventoryQuantity<=0},e?.node?.title)))),t.createElement("div",{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"}},t.createElement(F,null)))))),(o.comboBundle.subProductsProductTitleVisibility||o.comboBundle.subProductsProductPriceVisibility)&&t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},e?.productDetails?.title),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},t.createElement("span",{style:{lineHeight:"normal"}},Eh(o.general.currencySymbol,d),kh((Number(""!==p?.compareAtPrice?Number(p?.compareAtPrice):p?.price)/Number(a)*Number(l)).toFixed(2))),t.createElement("span",{style:{textDecoration:"line-through",color:"#999",lineHeight:"normal",fontSize:"12px"}},Eh(o.general.currencySymbol,d),kh(""!==p?.compareAtPrice?p?.compareAtPrice:p?.price))))):t.createElement("div",{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"===o.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===o.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"}},o.comboBundle.subProductsImageVisibility&&t.createElement("div",{style:{position:"relative"}},t.createElement("img",{src:p?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg",alt:e?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}}),t.createElement("div",{style:{position:"absolute",top:-8,right:-8,backgroundColor:"#f8f8f8",borderRadius:"50%",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid #eee",fontSize:"14px"}},"1")),t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"left"===o.comboBundle?.infoAlignment?"flex-start":"right"===o.comboBundle?.infoAlignment?"flex-end":"center"===o.comboBundle?.infoAlignment?"flex-start":void 0}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},t.createElement("span",null," ",e?.productDetails?.title," "),e.productDetails.variants.edges.length>1&&s&&u&&t.createElement("span",{style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},u.length>1?u.join(" / "):u)),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},t.createElement("span",{style:{lineHeight:"normal"}},Eh(o.general.currencySymbol,d),kh((Number(""!==p?.compareAtPrice?Number(p?.compareAtPrice):p?.price)/Number(a)*Number(l)).toFixed(2))),t.createElement("span",{style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Eh(o.general.currencySymbol,d),kh(""!==p?.compareAtPrice?p?.compareAtPrice:p?.price))),e.productDetails.variants.edges.length>1&&e.productDetails.options.length>0?t.createElement(t.Fragment,null,e.productDetails.options.map(((n,r)=>t.createElement("div",{key:n.name,style:{marginTop:"10px",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},e.productDetails.options.length>1&&t.createElement("label",{style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map((a=>{const i=s&&s?.options?.find((e=>e.name===n.name));return i&&"color"===i?.type?t.createElement("button",{key:a,onClick:()=>{const t=[...u];t[r]=a;const n=e.productDetails.options.length>0?t.join(" / "):t[r],o=e.productDetails.variants.edges.find((e=>e.node.title===n))?.node.id;o&&m(o)},style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid transparent"}},i?.values.find((e=>e.name===a))?.value?t.createElement("div",{style:{width:u[r]===a?"26px":"24px",height:u[r]===a?"26px":"24px",borderRadius:"50%",backgroundColor:i?.values.find((e=>e.name===a))?.value,cursor:"pointer"}},t.createElement("span",null)):t.createElement("span",{key:a,style:{padding:"4px 8px",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u[r]===a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"10px",fontWeight:"600"}},a)):i&&"image"===i?.type?t.createElement("button",{key:a,onClick:()=>{const t=[...u];t[r]=a;const n=e.productDetails.options.length>0?t.join(" / "):t[r],o=e.productDetails.variants.edges.find((e=>e.node.title===n))?.node.id;o&&m(o)},style:{border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u[r]===a?"#F7F7F7":"transparent",cursor:"pointer",padding:"0px",width:u[r]===a?"26px":"24px",height:u[r]===a?"26px":"24px",overflow:"hidden"}},i?.values.find((e=>e.name===a))?.value?t.createElement("img",{src:i?.values.find((e=>e.name===a))?.value||"/placeholder.svg",alt:a,style:{width:u[r]===a?"26px":"24px",height:u[r]===a?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):t.createElement("span",{key:a,style:{padding:"4px 8px",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u[r]===a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"10px",fontWeight:"600"}},a)):t.createElement("button",{key:a,onClick:()=>{const t=[...u];t[r]=a;const n=e.productDetails.options.length>0?t.join(" / "):t[r],o=e.productDetails.variants.edges.find((e=>e.node.title===n))?.node.id;o&&m(o)},style:{padding:"4px 8px",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u[r]===a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"10px",fontWeight:"600"}},a)}))))))):t.createElement(t.Fragment,null,e?.productDetails?.variants?.edges?.length>1&&t.createElement("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e?.productDetails?.variants?.edges.map((e=>t.createElement("button",{key:e?.node?.id,onClick:()=>m(e?.node?.id),disabled:e.node.inventoryQuantity<=0,style:{padding:"4px 8px",border:n===e?.node?.id?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===e?.node?.id?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"500"}},e?.node?.title)))))))},Zm=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,s]=c(window.innerWidth<786),[d,p]=c((()=>{const t={};return e.products.forEach(((e,n)=>{const r=e.productDetails.variants.edges.find((e=>e.node.inventoryQuantity>0))?.node;t[n]=r?r.id:e?.productDetails?.variants?.edges[0]?.node?.id})),t})),u=e.products?.filter((e=>e?.productDetails?.variants?.edges.some((e=>e?.node?.inventoryQuantity>0))))||[],m=Object.keys(d).length===u.length,f=(e,t)=>{p((n=>({...n,[e]:t})))},{originalPrice:g,dealPrice:h,offerValue:x}=i((()=>{const{price:t,compareAtPrice:n}=Object.entries(d).reduce(((t,[n,r])=>{const o=e.products[parseInt(n)],a=o.productDetails.variants.edges?.find((e=>e.node.id===r))?.node,i=parseFloat(a?.price??"0"),l=parseFloat(a?.compareAtPrice||i.toString());return t.price+=i,t.compareAtPrice+=l,t}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff);const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[d,e.products,e.percentageOff,e.dealAmount,e.amountOff]);l((()=>{const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const y=e.customizations,b=y.comboBundle?.comboCardStyle||"auto",v="vertical"===b||"auto"===b&&!a,w=y.comboBundle?.embedContentVisibility,C="bundles"==e.appName?e.pageHeader?.title:e?.title,k="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement("div",{style:{lineHeight:"normal",maxWidth:"800px",marginBlock:y.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===y.comboBundle?.infoAlignment?"flex-start":"right"===y.comboBundle?.infoAlignment?"flex-end":"center"===y.comboBundle?.infoAlignment?"center":void 0,textAlign:y.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},t.createElement("h2",{style:{fontSize:y.comboBundle?.productTitleFontSize||"28px",color:y.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},C)),w&&y?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:y.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(y.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},t.createElement("span",{style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Eh(y.general.currencySymbol,e.storeCurrencyCode),kh(h)),t.createElement("div",{style:{color:y.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Eh(y.general.currencySymbol,e.storeCurrencyCode),kh(g)),t.createElement("span",{style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},e?.percentageOff?`${e?.percentageOff}% Off`:e?.amountOff?`${Eh(y.general.currencySymbol,e.storeCurrencyCode)}${kh(e?.amountOff)} Off`:`Save ${Eh(y.general.currencySymbol,e.storeCurrencyCode)}${kh(x)}`))),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},t.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:y.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},t.createElement("span",null)),t.createElement("p",{style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",t.createElement("u",null,"Shipping")," calculated at checkout."))),y.comboBundle.subProductsSectionVisibility&&t.createElement(t.Fragment,null,v?t.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},e.products.map(((n,r)=>{const o=n?.productDetails?.variants?.edges?.find((e=>e?.node?.id===d[r]))?.node;return o?t.createElement(qm,{key:`combo-product-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:d[r],onVariantChange:e=>f(r,e),isVertical:v,variantOptions:e.variantOptions,storeCurrencyCode:e.storeCurrencyCode}):null}))):t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},y.comboBundle.subProductsSectionVisibility&&e.products.map(((n,r)=>t.createElement(qm,{key:`combo-product-horizontal-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:d[r],onVariantChange:e=>f(r,e),variantOptions:e.variantOptions}))))),t.createElement("div",{style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},t.createElement("button",{style:{backgroundColor:m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor,color:y.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:y.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:m?"pointer":"not-allowed",border:`1px solid ${m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor}`,boxShadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,margin:"0"},disabled:!m,onMouseOver:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=y.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=y.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{try{if(o(!0),!n)return void o(!1);const t=Object.entries(d).map((([t,n])=>{const r=e.products[parseInt(t)],o=r.productDetails.variants.edges.find((e=>e.node.id===n))?.node;return o?{variantId:n,price:Number(o.price)}:null})).filter((e=>null!==e)),r=Object.values(d);await n(Number(g),r,Number(h),t)}catch(e){}o(!1)}},r?t.createElement(Wo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,m?y.comboBundle?.ctaTitle??"Add Bundle to cart":y.general.outOfStockLabel||"Out of Stock"," "))),w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{style:{margin:"20px 0px"}},t.createElement("h4",{style:{fontSize:"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:y.general.primaryColor+"20"}},"Description"),t.createElement("div",{style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:y.general.primaryColor+"08"}},t.createElement("p",null,k))))},Km=x.div`
|
|
3533
|
+
`;const Rm=n(((e,n)=>{const[r,o]=Gt(qu),a=(e.disableInventoryTracking?r?.variants.edges?.filter((t=>t.node.inventoryQuantity>0||e.disableInventoryTracking)):r?.variants.edges)??[],[i,s]=c(a[0]?.node),[d,p]=c(0),[u,m]=c("undefined"!=typeof window&&window.innerWidth<=600),[f,g]=c(1),[h,x]=c("idle"),[y,b]=c(null),[w,C]=c(null);l((()=>{if(r){const t=r.variants.edges?.filter((t=>t.node.inventoryQuantity>0||e.disableQuantitySelector));s(r?.selectedVariant??t[0]?.node)}}),[r]),l((()=>{const t=e.selectedProducts.find((e=>e.variantId===i?.id));g(t?t.quantity:0)}),[f,e.selectedProducts,i]);const k=()=>{i?.id&&r&&(x("check"),e.handleAddToBundle(i?.id,r,1),setTimeout((()=>{x("idle"),o(void 0)}),500))};if(l((()=>{const e=()=>m(window.innerWidth<=600);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),!r||0===a.length)return null;const{title:E,descriptionHtml:T,media:S,variants:$}=r,B=S.edges.map((e=>e?.node.preview.image??e?.node.image)).filter((e=>e?.url?.length>0));l((()=>{if(r&&i?.image?.url&&Array.isArray(B)){const e=B.findIndex((e=>e?.url===i?.image?.url));-1!==e&&e!==d&&p(e)}}),[i]);const z=t=>{const n=t.target.value,r=a.find((e=>e.node.id===n))?.node;r&&(r.inventoryQuantity>0||e.disableInventoryTracking)&&s(r)};l((()=>{if(r){window.history.pushState({modalOpen:!0},"",window.location.href);const e=e=>{o(void 0),e.preventDefault()};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),window.history.state?.modalOpen&&window.history.back()}}}),[r,o]);const D=e=>{b(e.targetTouches[0].clientX),C(null)},_=e=>{C(e.targetTouches[0].clientX)},I=()=>{if(null!==y&&null!==w&&B.length>1){const e=y-w,t=50;e>t?p((e=>e<B.length-1?e+1:0)):e<-t&&p((e=>e>0?e-1:B.length-1))}b(null),C(null)},P=e.hideAddToBundle||(i?.inventoryQuantity??0)<=0&&!e.disableInventoryTracking||e?.disableQuantitySelector&&f>=1||"idle"!==h,O=t.createElement(Nm,null,t.createElement(Fm,{$isSmallScreen:u,ref:n},t.createElement(Mm,{ref:n,className:"yt-variant-selection-modal"},t.createElement("div",{className:"yt-variant-selection-modal "+(u?"small-screen":"large-screen")},t.createElement(Am,{onClick:()=>{o(void 0)},style:{backgroundColor:"white"}},t.createElement(lt,{size:"25"})),t.createElement("div",{className:"image-section"},t.createElement(t.Fragment,null,t.createElement("div",{onTouchStart:D,onTouchMove:_,onTouchEnd:I},t.createElement(Om,{small:B[d]?.url,medium:B[d]?.url,large:B[d]?.url,hideDownload:!0,className:"main-image",imageBackgroundColor:"#000"})),t.createElement("div",{className:"image-gallery",style:{display:"flex",flexDirection:"row",overflow:"auto",gap:"10px",scrollbarWidth:"none"}},B.length>1&&B.filter((e=>e?.url.length>0)).map(((n,r)=>t.createElement("img",{key:r,src:n?.url,alt:n.altText||`${E} - Image ${r+1}`,onClick:()=>p(r),className:d===r?"active":"",style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...d===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"}})))))),t.createElement("div",{className:"details-section",style:{marginLeft:"20px",minHeight:"100%",maxHeight:"70vh",scrollbarWidth:"none",overflowY:"auto",display:"flex",flexDirection:"column"}},t.createElement("h2",null,a.length>1?i?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},r?.rating?.averageRating,"rating")),"ratingAndReviewCount"===e.reviewRatingType&&(r?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",r?.rating?.averageRating,t.createElement(Gn,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",r?.rating?.ratingCount," reviews)"),t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"2px",marginTop:"20px"}},a.length>1&&t.createElement("div",null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",marginBottom:"10px"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},i?.title)),t.createElement("select",{value:i?.id||"",onChange:z,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}},a.map((({node:n})=>t.createElement("option",{key:n.id,value:n.id,disabled:!n.inventoryQuantity&&!e.disableInventoryTracking},n.title)))),t.createElement("span",{style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(oo,null)))),t.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{style:{width:"fit-content",minWidth:"fit-content",paddingRight:"10px",display:"flex",flexDirection:"column"}},i?.compareAtPrice&&parseFloat(i.compareAtPrice)>parseFloat(i?.price)&&t.createElement("div",{style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.price)))),t.createElement("div",{style:{width:"80%"},className:"yt-product-modal-atc-wrapper"},t.createElement("button",{style:{textTransform:"uppercase",fontWeight:"800",width:"100%",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden",opacity:P?.5:1,cursor:P?"not-allowed":"pointer"},className:"yt-product-modal-atc-button",onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:P},e.styles.byob.addToBundleCTAText??"Add to bundle")))),t.createElement("div",{style:{height:"10px",minHeight:"10px",border:"none",backgroundColor:"#D9D9D96B",margin:"20px 0 10px 0",display:"block !important"}},t.createElement("span",null)),t.createElement("span",{className:"yt-description-content",style:{scrollBehavior:"smooth"},dangerouslySetInnerHTML:{__html:T}})))))),A=t.createElement(Nm,null,t.createElement(Fm,{style:{padding:"0px",position:"relative"},$isSmallScreen:u,ref:n},t.createElement(Mm,{ref:n,className:"yt-variant-selection-modal"},t.createElement("button",{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:()=>{o(void 0)}},t.createElement(ao,{style:{height:"22px",width:"22px",padding:"4px",color:"black"},onMouseEnter:e=>e.currentTarget.style.color="black"})),t.createElement("div",{className:"yt-variant-selection-modal small-screen",style:{padding:"0px"}},t.createElement("div",{className:"image-section"},t.createElement(t.Fragment,null,t.createElement("div",{style:{position:"relative"},onTouchStart:D,onTouchMove:_,onTouchEnd:I},t.createElement(Om,{small:B[d]?.url,medium:B[d]?.url,large:B[d]?.url,hideDownload:!0,className:"main-image",imageBackgroundColor:"#000"}),t.createElement("div",{style:{position:"absolute",bottom:"20px",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},B.length>1&&B.map(((e,n)=>t.createElement("span",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:d===n?"#FFFFFF":"#EBEBEB",margin:"0 3px",cursor:"pointer",backdropFilter:"blur(10px)"}}))))),t.createElement("div",{className:"image-gallery",style:{display:"flex",flexDirection:"row",overflowX:"auto",padding:"5px 20px",gap:"5px",scrollbarWidth:"none"}},B.length>1&&B.map(((n,r)=>t.createElement("img",{key:r,src:n?.url,alt:n.altText||`${E} - Image ${r+1}`,onClick:()=>p(r),className:d===r?"active":"",style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...d===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"}})))))),t.createElement("div",{className:"details-section",style:{padding:"0 30px",margin:"15px 0",paddingBottom:"120px"}},t.createElement("h2",{style:{margin:"0px"}},a.length>1?i?.displayName:r.title),"ratingOnly"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===e.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Gn,{style:{color:"dodgerblue",marginLeft:"4px"},size:14})," ","(",e?.rating?.ratingCount," reviews)"),t.createElement("div",{style:{opacity:"0.2",border:"none",height:"2px",backgroundColor:"#000000",margin:"10px 0px",display:"block !important"}},t.createElement("span",null)),t.createElement("div",{className:"yt-description-content",style:{scrollbarWidth:"none",scrollBehavior:"smooth",margin:"0px"},dangerouslySetInnerHTML:{__html:T}})))),t.createElement("div",{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}},a.length>1&&t.createElement("div",null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",paddingBottom:"5px",fontSize:"16px",color:"#999",position:"relative",margin:"10px 0"}},t.createElement("span",{style:{flexShrink:0}},r.options[0].name," :"," ",t.createElement("strong",{style:{color:"#000",paddingLeft:"5px"}},i?.title)),t.createElement("select",{value:i?.id||"",onChange:z,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}},a.map((({node:n})=>t.createElement("option",{key:n.id,value:n.id,disabled:!n.inventoryQuantity&&!e.disableInventoryTracking},n.title)))),t.createElement("span",{style:{position:"absolute",right:5,pointerEvents:"none",fontSize:"12px",color:"#000"}},t.createElement(oo,null)))),t.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"}},t.createElement("div",{style:{width:"fit-content",minWidth:"fit-content",display:"flex",flexDirection:"column",paddingRight:"10px"}},i?.compareAtPrice&&t.createElement("div",{style:{textDecoration:"line-through",opacity:"0.5",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Eh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),kh(i?.price)))),!e.hideAddToBundle&&((i?.inventoryQuantity??0)>0||e.disableInventoryTracking)&&(!e?.disableQuantitySelector||f<1)&&t.createElement("div",{style:{width:"100%"}},t.createElement("button",{style:{textTransform:"uppercase",fontWeight:"800",width:"100%",cursor:"pointer",border:"none",backgroundColor:e.themeColor||"#111",borderRadius:e.cornerRadius,color:e.primaryTextColorCta||"#fff",minHeight:"40px",padding:"0px 15px",position:"relative",overflow:"hidden"},onClick:e=>{e.stopPropagation(),e.preventDefault(),k()},disabled:"idle"!==h},e.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return v.createPortal(u?A:O,document.body)})),Lm=({options:e,selectedValue:n,onChange:r,type:o="text",isOptionAvailable:a,isMobile:i})=>t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"}},e?.map((e=>{const l=!a||a(e.name);return i&&!l?null:t.createElement("div",{key:e.name,onClick:()=>{l&&r(e)},style:{cursor:l?"pointer":"not-allowed"}},((e,n)=>{const r=!a||a(e.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 e.value&&(()=>{if(!e.value.trim())return!1;if(e.value===e.name||e.value.length<3)return!1;try{const t=document.createElement("div");return t.style.color=e.value,""!==t.style.color}catch{return!1}})()?t.createElement("div",{style:{...i,width:24,height:24,borderRadius:"50%",backgroundColor:e.value}}):t.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"}},e.name);return"image"===o?t.createElement("img",{src:En(e.value,48,85,"webp")||"/placeholder.svg",alt:e.name,style:{...i,width:24,height:24,borderRadius:"50%",objectFit:"cover"}}):t.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"}},e.name)})(e,n?.name===e.name))}))),jm=({product:e,isOpen:n,onClose:r,variantOptions:o,cta:a,onConfirm:i,disableInventoryTracking:s})=>{const[d,p]=c((()=>{const t=e.variants.edges.find((e=>s||e.node.inventoryQuantity>0))?.node;return t?.title&&"Default Title"!==t.title?t.title.split(" / "):e.options?.map((e=>e.values[0]))||[]})),[u,m]=c(window.innerWidth<1024);l((()=>{const e=()=>m(window.innerWidth<1024);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]),l((()=>{const e=e=>{"Escape"===e.key&&r()};return n&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[n,r]);const f=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?d.join(" / "):d[0])))?.node,g=f?.image?.url||e.featuredMedia?.preview?.image?.url,h=En(g,150,85,"webp"),x=e=>{if(!o?.options)return"text";const t=o.options.find((t=>t.name===e));return t?.type||"text"},y=e=>{if(!o?.options)return e.values.map((e=>({name:e,value:e})));const t=o.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}}))},b=(e,t)=>{const n=d[t];if(!n)return null;return y(e).find((e=>e.name===n))||null};if(!n)return null;const w=t.createElement("div",{onClick:r,style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.4)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"yt-variant-options-modal-title"},t.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"}}},t.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"),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid #f0f0f0"}},t.createElement("img",{src:h,alt:e.title,style:{width:60,height:60,borderRadius:8,objectFit:"cover",flexShrink:0,transition:"opacity 0.3s ease"}}),t.createElement("div",{style:{display:"flex",flexDirection:"column",flex:1,gap:4}},t.createElement("div",{style:{fontSize:14,fontWeight:600,color:"#333"}},e.title))),t.createElement("div",{style:{padding:"20px"}},e.options.map(((n,r)=>t.createElement("div",{key:n.name,style:{display:"flex",flexDirection:"column",gap:8,marginBottom:n?.values?.length>1?16:0}},n?.values?.length>1&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8}},t.createElement("span",{style:{fontSize:14,fontWeight:500,color:"#333"}},"Select ",n.name),t.createElement("span",{style:{fontSize:12,fontWeight:500,color:"#666",backgroundColor:"#f5f5f5",padding:"4px 12px",borderRadius:16,textTransform:"capitalize"}},b(n,r)?.name||n.values[0])),t.createElement(Lm,{options:y(n),selectedValue:b(n,r),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n)})(r,e)},type:x(n.name),isOptionAvailable:t=>((t,n)=>{if(s)return!0;const r=[...d];r[t]=n;const o=e.options?.length>0?r.join(" / "):r[0],a=e.variants.edges.find((e=>e.node.title===o))?.node;return!!a&&a.inventoryQuantity>0})(r,t),isMobile:u})))))),t.createElement("button",{onClick:()=>{const t=e.variants.edges.find((t=>t.node.title===(e.options?.length>0?d.join(" / "):d[0])))?.node,n=t&&(s||t.inventoryQuantity>0);if(t?.id&&n)i(t.id),r();else{console.warn("yt::variant options modal - selected variant not available or out of stock:",d);const t=e.variants.edges.find((e=>s||e.node.inventoryQuantity>0))?.node.id;t&&(i(t),r())}},style:{width:"100%",fontSize:14,fontWeight:600,textTransform:"uppercase",backgroundColor:a.backgroundColor,color:a.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 v.createPortal(w,document.body)};function Vm({quantity:e,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:c,disableInventoryTracking:s,selectedVariantInventoryQty:d}){const p={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"},u=s||e<d;return t.createElement(nu,null,t.createElement("button",{onClick:t=>{t.stopPropagation();const r=Math.max(0,e-1);n(r),l&&a&&l(a,1)},style:p},"-"),t.createElement(ru,null,e," added"),t.createElement("button",{onClick:t=>{t.stopPropagation();const l=Math.min(r,e+1);n(l),o&&a&&i&&o(a,i,1)},disabled:!u||c,style:{...p,cursor:!u||c?"not-allowed":"pointer",opacity:!u||c?.6:1}},"+"))}const Hm=({product:e,styles:n,selectedVariant:r})=>{const[o,a]=c(!1),i=r?.image?.url||e?.featuredMedia?.preview?.image?.url||e?.media?.edges?.[0]?.node?.image?.url||"",l=e?.media?.edges?.map((e=>e?.node?.preview?.image?.url??e?.node?.image?.url)).filter(Boolean),s=l?.[1]??i??"";return t.createElement("div",{style:{position:"relative",width:"100%",overflow:"hidden",aspectRatio:n.general.imageAspectRatio||"1/1"},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1)},t.createElement("div",{style:{width:"100%",height:"100%",position:"relative"}},t.createElement("img",{style:{width:"100%",height:"100%",objectFit:"cover",opacity:o&&(i||l?.[0])!==s?0:1,transition:l?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:o?"scale(1.1)":"scale(1)"},src:i||l?.[0],alt:e.title}),(i||l?.[0])!==s&&t.createElement("img",{style:{width:"100%",height:"100%",objectFit:"cover",opacity:o?1:0,transition:"opacity 400ms ease, transform 400ms ease",transform:o?"scale(1.1)":"scale(1)",position:"absolute",top:0,left:0},src:s||i,alt:e.title})))},Wm=({product:e,bundle:n,handleAddToBundle:r,hideAddToBundle:o,remainingQuantity:a,themeColor:i,handleRemoveItem:s,transitionActive:d,idx:p,selecteditems:u,customVariantsQuantity:m})=>{const f=Ut(qu),g=n.customizations,h=g?.byob?.variantSelectorType,[x,y]=c(!1),b=g.general?.variantTitleSuffix?e?.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(" ")}}}))})(e?.variants?.edges);if(!b||!b.length)return t.createElement(t.Fragment,null);const v=b?.find((e=>e.node.inventoryQuantity>0||!g?.general.trackInventory))?.node?.id;if(!v&&!g.general.showOutOfStockProducts)return t.createElement(t.Fragment,null);const[w,C]=c(b?.find((e=>!g?.general.trackInventory||e.node.inventoryQuantity>0))?.node?.id||b[0]?.node?.id),[k,E]=c(0),[T,S]=c(window.innerWidth<450),[$,B]=c("normal"),z=b?.find((e=>e?.node?.id===w))?.node,D=m&&m.length>0&&m.find((e=>e.variantId==z?.id))?.quantity||z&&z?.inventoryQuantity;l((()=>{const e=u.find((e=>e.variantId===w));E(e?e.quantity:0)}),[k,u,w]),l((()=>{const e=()=>{S(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{CSS.supports("font-weight","500")?B("500"):CSS.supports("font-weight","400")?B("400"):CSS.supports("font-weight","600")&&B("600")}),[]),l((()=>{document.documentElement.style.setProperty("--yt-bundle-font-weight",$)}),[$]),l((()=>{if(w&&!b?.some((e=>e.node.id===w))){const e=b[0]?.node.id;e&&C(e)}}),[w,b]);const _=e.variants&&e.variants.edges?.length>1&&"customOptions"!==h,I="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,P="53933408435"===I,O="75851235630"===I,A=(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[]})(e),N=A.length>0;return t.createElement(t.Fragment,null,t.createElement(iu,{borderRadius:g?.byob.borderRadius,borderColor:g?.byob.borderColor,shadowType:g?.byob.shadowType,backgroundColor:g?.byob.cardBackgroundColor,className:"bundle-builder-product-container "+(d?"yt-product-card-transition-active":p%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(D<=0&&g?.general.trackInventory)return;const t={...e,variants:{...e.variants,edges:b},selectedVariant:z};f(t)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.01)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},style:{WebkitTapHighlightColor:"transparent"}},t.createElement(lu,null,t.createElement(Hm,{product:e,styles:g,selectedVariant:z}),n?.productCardBadgeText&&t.createElement("div",{style:{position:"absolute",top:"0px",left:"0px",backgroundColor:g?.general.primaryColor||"#111",color:g?.general.primaryContrastColor||"#fff",zIndex:1,margin:"0px",whiteSpace:"pre",padding:"4px 8px",fontSize:"12px",borderTopLeftRadius:g.byob.borderRadius}},n.productCardBadgeText),_&&t.createElement("div",{style:{position:"relative",width:"100%"}},t.createElement(cu,{isCoralHaze:P,onClick:e=>{e.preventDefault(),e.stopPropagation()},value:w||"",onChange:e=>{e.stopPropagation(),e.preventDefault(),C(e.target.value)}},b?.map((e=>{const n=window.innerWidth<=320?10:window.innerWidth<=420?15:22,r=e.node.title.length>n?e.node.title.substring(0,n)+"...":e.node.title;return t.createElement("option",{key:e.node.id,value:e.node.id},r)}))),t.createElement("div",{style:{position:"absolute",right:"16px",bottom:"10px",pointerEvents:"none"}},t.createElement(F,null)))),t.createElement("div",null,"enabled"===n?.customizations?.byob?.productCardCategoryVisibility&&N&&t.createElement("div",{style:{padding:"2px 4px"}},t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"}},A.slice(0,2).map(((e,n)=>t.createElement("span",{key:n,style:{fontSize:T?"8px":"12px",color:"#666",fontWeight:"500"}},e.charAt(0).toUpperCase()+e.slice(1)))),A.length>2&&t.createElement("span",{style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",A.length-2," more"))),t.createElement(su,{isMobile:T,showBorder:n?.showBorder??!0,style:{...!g?.byob.productsPriceVisibility&&{padding:"8px"},...g?.byob.productTitleFontSize&&{fontSize:g?.byob.productTitleFontSize}}},O?String(z?.displayName).replace("- Default Title",""):e.title,z?.commonSuffix?" -"+z?.commonSuffix:"")),"ratingOnly"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",t.createElement("span",{style:{marginLeft:6}},e?.rating?.averageRating," rating")),"ratingAndReviewCount"===n?.reviewRatingType&&(e?.rating?.averageRating??0)>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"start",fontSize:"14px",color:"#333"}},t.createElement(Hr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Gn,{size:14,style:{color:"dodgerblue",marginLeft:"4px"}})," ","(",e?.rating?.ratingCount," reviews)"),g?.byob.productsPriceVisibility&&t.createElement("div",{className:"yt-bundle-builder-product-price",style:{marginBottom:"5px",padding:n?.showBorder?"0px 10px":"0 4px"}},parseFloat(z?.price??"0")>0?t.createElement("span",null,Eh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",kh(z?.price)):t.createElement("span",null,"Free"),z?.compareAtPrice&&g?.byob.compareAtPriceVisibility&&parseFloat(z.compareAtPrice)>parseFloat(z?.price)&&t.createElement("span",{className:"yt-fixed-bundle-original-price",style:{fontSize:"14px"}},Eh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",kh(z.compareAtPrice))),(D>0||!g?.general.trackInventory)&&t.createElement(du,{borderRadius:g?.byob.borderRadius,className:"yt-product-atc-wrapper"},(0===k||void 0===k)&&t.createElement(ou,{style:{...!o&&{backgroundColor:g?.general.primaryColor||"#111",color:g?.general.primaryContrastColor||"#fff"}},disabled:o,onClick:t=>{t.stopPropagation(),t.preventDefault(),E(1),(()=>{if(!w)return;"customOptions"===h&&b.length>1?y(!0):r(w,e,1)})()},className:"yt-product-atc-button"},g?.byob.addToBundleCTAText),!n?.disableQuantitySelector&&k>0&&w&&t.createElement(au,{className:"visible",style:{overflow:"hidden"}},t.createElement(Vm,{remainingQuantity:a,setQuantity:E,quantity:k,handleAddToBundle:r,variantId:w,product:e,handleRemoveItem:s,hideAddToBundle:o,disableInventoryTracking:!g?.general.trackInventory,selectedVariantInventoryQty:D})),n?.disableQuantitySelector&&k>0&&w&&t.createElement(ou,{style:{backgroundColor:"#747474",color:g?.general.primaryContrastColor||"#fff",display:"flex",justifyContent:"space-between",overflow:"hidden",height:"40px"},className:"yt-product-atc-single-qty-selector"},t.createElement(pu,{className:"yt-product-atc-single-qty-selector-added"},"ADDED"),t.createElement(uu,{onClick:e=>{e.stopPropagation();const t=Math.max(0,k-1);E(t),s&&w&&s(w,1)},className:"yt-product-atc-single-qty-selector-remove"},t.createElement(to,{style:{color:"#fff",fontSize:"20px"}})))),D<=0&&g?.general.trackInventory&&t.createElement(ou,{style:{backgroundColor:g.general.disabledButtonColor,color:"#fff",cursor:"not-allowed",transition:"transform 0.2s ease-in-out"},className:"yt-product-atc-disabled"},g?.general.outOfStockLabel||"Out of Stock")),"customOptions"===h&&x&&b.length>1&&t.createElement(jm,{product:e,isOpen:x,onClose:()=>y(!1),variantOptions:n.variantOptions,cta:{textColor:g.general.ctaTextColor,backgroundColor:g.general.primaryColor},onConfirm:t=>{C(t),r(t,e,1)},disableInventoryTracking:!g?.general.trackInventory}))},Um=({currentStep:e,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:s})=>t.createElement("div",{style:{textAlign:"center",fontSize:"20px"}},t.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center"}},Array.from({length:r}).map(((c,d)=>{const p=d+1,u=o[d].minimumQuantity-(i[d]?.length??0)==0,m=d===e;return l="black"===l?"#000000":l,t.createElement(t.Fragment,{key:p},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",gap:a?"4px":"8px"},onClick:()=>!1===s?()=>{}:n(p-1)},t.createElement("div",{style:{fontSize:"14px"}},"Step ",p),t.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",cursor:"pointer"}},t.createElement("div",{style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px"}}),t.createElement("div",{style:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:u?`${l}50`:"white",border:`2px solid ${u?l:m?"#666666":"#CBD5E0"}`,display:"flex",alignItems:"center",justifyContent:"center"}}),t.createElement("div",{style:{height:"3px",width:a?"30px":"50px",backgroundColor:u?l:m?"#666666":"#CBD5E0",display:"block",marginRight:d<r?a?"4px":"6px":"",borderTopRightRadius:"5px",borderBottomRightRadius:"5px"}}))))}))),t.createElement("div",{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[e]?.title)),Gm=({isMobile:e,setSearchTerm:n,searchTerm:r,styles:o,setSortBy:a})=>{const[i,s]=c(!1),[d,p]=c(r);return l((()=>{const e=setTimeout((()=>{n(d)}),300);return()=>clearTimeout(e)}),[d,n]),t.createElement("div",{className:"yt-byob-sort-filter-container",style:{display:"flex",flexDirection:e?"column":"row",justifyContent:"space-between",alignItems:e?"flex-end":"center",textAlign:"center",marginBottom:"20px",width:"97%",gap:e?"10px":"0"}},t.createElement("div",{className:"yt-byob-sort-filter-inner",style:{display:"flex",flexDirection:i&&e?"column":e?"row-reverse":"row",justifyContent:"space-between",alignItems:i?"":"center",gap:"12px",width:"100%"}},t.createElement("div",{className:"yt-byob-search-wrapper",style:{position:"relative",display:"flex",alignItems:"center",width:e?i?"100%":"auto":"400px",transition:"width 0.3s ease-in-out"}},e&&!i?t.createElement(eo,{className:"yt-byob-search-icon",fontSize:"20px",color:"#555",style:{cursor:"pointer",lineHeight:"normal"},onClick:()=>s(!0)}):t.createElement(t.Fragment,null,t.createElement("input",{className:"yt-byob-search-input",style:{width:"100%",padding:e?"10px 12px":"10px 14px",fontSize:"14px",outline:"none",color:"#333",border:"1px solid #c7c7c7",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?"0 2px 4px rgba(0, 0, 0, 0.1)":"none",textAlign:"start"},placeholder:"Search by Product Name",value:d,onChange:e=>p(e.target.value)}),!i&&t.createElement("span",{className:"yt-byob-search-icon-input",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",display:"flex",alignItems:"center",justifyContent:"center",background:"white",paddingLeft:"5px"}},t.createElement(eo,{fontSize:"18px",style:{lineHeight:"normal"}}))),e&&i&&t.createElement("span",{className:"yt-byob-search-close-icon",style:{position:"absolute",right:"12px",color:"#aaa",fontSize:"16px",cursor:"pointer"},onClick:()=>s(!1)},"✖")),t.createElement("div",{className:"yt-byob-filter-wrapper",style:{display:"flex",alignItems:"center",textAlign:"center",border:window.innerWidth>600?"1px solid #d1d5db":"",padding:"8px 12px",fontSize:"14px",cursor:"pointer",borderRadius:o?.byob.borderRadius,boxShadow:o?.byob.borderColor?window.innerWidth>600?"0 2px 4px rgba(0, 0, 0, 0.1)":" ":"none"}},t.createElement("span",{className:"yt-byob-filter-label",style:{fontSize:"14px",color:"#555",marginRight:"6px"}},"Sort:"),t.createElement("select",{className:"yt-byob-filter-select",style:{flex:1,border:"none",height:"auto",padding:"0px",marginBottom:"0px",background:"transparent",fontSize:"14px",color:"#333",fontWeight:"500",width:e?"120px":"",outline:"none",cursor:"pointer",textAlign:"start"},onChange:e=>a(e.target.value)},t.createElement("option",{value:"best-selling"},"Featured"),t.createElement("option",{value:"title-asc"},"Product Title (A-Z)"),t.createElement("option",{value:"title-desc"},"Product Title (Z-A)"),t.createElement("option",{value:"price-low-to-high"},"Price (Low to High)"),t.createElement("option",{value:"price-high-to-low"},"Price (High to Low)")))))},Qm=({styles:e,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"===e?.byob?.categoryFilterOnPage?t.createElement("div",{style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"},className:"yt-categoryfilter-wrapper"},t.createElement("div",{style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"},className:"yt-categoryfilter-tabs-container"},["All",...r].map((r=>{const a=o===r;return t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-categoryfilter-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:a?"600":"400",color:a?e.general.primaryColor:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:a?l(e.general.primaryColor,.07):"transparent",borderBottom:a?`2px solid ${e?.general.primaryColor}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:t=>{a||(t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{a||(e.currentTarget.style.color="#666")}},t.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},r.charAt(0).toUpperCase()+r.slice(1)),t.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},r.charAt(0).toUpperCase()+r.slice(1)))})))):t.createElement("div",{style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"},className:"yt-categoryfilter-wrapper"},t.createElement("div",{style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"},className:"yt-categoryfilter-buttons-container"},["All",...r].map((r=>t.createElement("button",{key:r,onClick:()=>i(r),className:"yt-categoryfilter-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${o===r?e?.general.primaryColor:"#e0e0e0"}`,borderRadius:e?.general.ctaBorderRadius,backgroundColor:o===r?e?.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:t=>{o!==r&&(t.currentTarget.style.borderColor=e?.general.primaryColor,t.currentTarget.style.color=e?.general.primaryColor)},onMouseLeave:e=>{o!==r&&(e.currentTarget.style.borderColor="#e0e0e0",e.currentTarget.style.color="#333")}},r.charAt(0).toUpperCase()+r.slice(1))))))},Ym=({bundle:e,selectedItems:n,setSelectedItems:r,handleAddToCart:a,bundleAddToCartLoading:i,renderingOnPage:s,selectedItemsQuantity:d,handleRemoveItem:p,bundleSubtotal:u})=>{const[m,f]=c(void 0),[g,h]=c(window.innerWidth<450),[x,y]=c(0),[b,v]=c({}),w=e.builderTiers?.type,C=e.customizations,k=e.builderTiers?.productTier??[],E=e.builderTiers?.offerTier??[],[T,S]=c([]),[$,B]=c(!1),[z,D]=c("All");l((()=>{const t=new Set;let n=!1;e?.products?.forEach((e=>{const r=e.productDetails;if(r.metafield&&"yourtoken_bundles_app"===r.metafield.namespace&&"categories"===r.metafield.key){let e=[];if(r.metafield.jsonValue&&Array.isArray(r.metafield.jsonValue))e=r.metafield.jsonValue;else if(r.metafield.value)try{const t=JSON.parse(r.metafield.value);Array.isArray(t)&&(e=t)}catch(e){console.error("Failed to parse categories:",e)}e.length>0&&(n=!0,e.forEach((e=>t.add(e))))}})),S(Array.from(t)),B(n)}),[e.products]);const _=((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})))(e.products.filter((e=>"active"===e.productDetails.status?.toLowerCase()||void 0===e.productDetails.status||""===e.productDetails.status)),z),I="productTier"===w?k.reduce(((e,t)=>e+t.minimumQuantity),0):"offerTier"===w?E.reduce(((e,t)=>e+t.minimumQuantity),0):e.minimumQuantity,[P,O]=c(""),[A,N]=c(""),F=((e,t)=>e.filter((e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase()))))(_,P),M=((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}})))(F,A),R=((e,t,n,r,o)=>(e[o]?.products.filter((e=>t.some((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))&&t?.productDetails.title.toLowerCase().includes(n?.toLowerCase())))))||[]).sort(((e,n)=>{let o=t.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0])))),a=t.find((e=>e.productId===n.productId&&(n.variantIds.length<1||e.variantIds.includes(n.variantIds[0]))));if(!o||!a)return 0;const i=o.productDetails?.title?.toLowerCase(),l=a.productDetails?.title?.toLowerCase(),c=parseFloat(o?.productDetails?.variants?.edges[0]?.node?.price||"0"),s=parseFloat(a?.productDetails?.variants?.edges[0]?.node?.price||"0");switch(r){case"title-asc":return i.localeCompare(l);case"title-desc":return l.localeCompare(i);case"price-low-to-high":return c-s;case"price-high-to-low":return s-c;default:return 0}})))(k,M,P,A,x),[L,j]=Gt(qu),[V,H]=c(!1);l((()=>{setTimeout((()=>{H(!0)}),100)}),[]);const W=o(null);l((()=>{const e=()=>{h(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(e.coverImageUrl){const t=new Image;t.src=e.coverImageUrl,t.onload=()=>{f(t.width/t.height)}}}),[e.coverImageUrl]),l((()=>{H(!1),setTimeout((()=>H(!0)),100)}),[x]);const U=(e,t)=>{if("productTier"===w){let n={...b},r=!1;if(n[t]){const o=n[t].indexOf(e);-1!==o&&(n[t]=[...n[t]],n[t].splice(o,1),r=!0)}if(!r)for(let t=k.length;t>=0;t--){const r=n[t].indexOf(e);if(-1!==r){n[t]=[...n[t]],n[t].splice(r,1);break}}v(n);const o=k.findIndex(((e,t)=>n[t]?.length<e.minimumQuantity));-1!==o&&y(o)}p(e)};l((()=>{if("productTier"===w){const e=Object.fromEntries(k.map((e=>[e.tier,[]])));v(e)}}),[e]),l((()=>{if("productTier"!==w||!k[x])return;if(I===d)return;const e=k.findIndex(((e,t)=>{const n=b[t]||[];return t>=x&&n.length<e.minimumQuantity}));-1!==e&&e!==x&&(y(e),(()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})})())}),[b,k,w]),l((()=>{O("")}),[x]),l((()=>{function e(e){if(!W.current||!e.target)return;!W.current.contains(e.target)&&j(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]);const G=(e,t,o)=>{var a;"productTier"===w&&(a=e,v((e=>{const t={...e},n=k.findIndex(((e,n)=>{const r=t[n]||[];return n>=x&&r.length<e.minimumQuantity}));return-1!==n&&y(n),t[n]||(t[n]=[]),t[n].push(a),t}))),Th(e,t,o,n,r)},Q=(()=>{if(!e?.builderTiers)return e.minimumQuantity;const{type:t,offerTier:n,productTier:r}=e.builderTiers,o="offerTier"===t?n:"productTier"===t?r:null;if(!o)return e.minimumQuantity;let a=0;return o.map((e=>{a+=e.minimumQuantity})),a})(),Y=g&&e.mobileCoverImageUrl?e.mobileCoverImageUrl:e.coverImageUrl||null,q=e.customStoreDetails?.fixedInventoryDetails,Z=e=>{const t=C?.general?.showOutOfStockProducts;if(t||!C?.general.trackInventory)return!0;const n=e?.productDetails?.variants?.edges||[];if(q){if(n.some((e=>q.some((t=>t.variantId===e.node.id&&t.quantity>0)))))return!0}return n.some((e=>e.node.inventoryQuantity>0))},K="bundles"==e.appName?e.pageHeader?.title:e?.title,X="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",rowGap:"15px",padding:"20px 0px",marginBottom:"20px",backgroundColor:C.byob.sectionBackgroundColor,..."transparent"!==C.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},Y?t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center",overflow:"hidden",...e?.coverImageVerticalMargin&&{marginBottom:e?.coverImageVerticalMargin,marginTop:e?.coverImageVerticalMargin}}},Y&&t.createElement("img",{src:Y,alt:"Background",style:{width:"100%",height:"auto",display:"block"}}),t.createElement("div",{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)"}},t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.titleFontSize??"3rem",fontWeight:"700",color:C?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:C?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},K),t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.subtitleFontSize??"1.5rem",color:C?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},X))):(K||X)&&t.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},K&&t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.titleFontSize??"3rem",fontWeight:"700",color:C?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:C?.byob?.titleBackgroundColor??"transparent"}},K),X&&t.createElement("span",{style:{lineHeight:"normal",fontSize:C?.byob?.subtitleFontSize??"1.5rem",color:C?.byob?.titleTextColor??"#000"}},X)),t.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===w&&k.length>0&&C?.byob.productTiersVisibility&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(Um,{currentStep:x,totalSteps:k.length,tiers:k,isMobile:g,primaryColor:C?.general?.primaryColor,primaryTextColorCta:C?.general?.primaryContrastColor,setCurrentProductTier:y,selectedProductsByTier:b,tierNavigation:C.byob.tierNavigation})))),t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},e?.enableSortAndFilter&&t.createElement(Gm,{isMobile:g,searchTerm:P,setSearchTerm:O,setSortBy:N,styles:C}),e?.customizations?.byob?.enableProductCategories&&$&&t.createElement("div",null,t.createElement(Qm,{styles:C,isMobile:g,categories:T,activeCategory:z,onCategoryChange:e=>{D(e)}}))),t.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:"center",width:"100%"},className:"products-display"},0===M?.length||"productTier"===w&&0===R?.length?t.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===w&&k.length>0?R.filter((e=>Z(M.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))))).map(((r,o)=>{const a=(k[x]?.minimumQuantity??0)>(b[x]?.length??0),i=M.find((e=>e.productId===r.productId&&(r.variantIds.length<1||e.variantIds.includes(r.variantIds[0]))));return i?t.createElement(Wm,{bundle:e,idx:o,key:r?.variantIds?.[0]??r.productId,product:i?.productDetails,handleAddToBundle:G,hideAddToBundle:!a,remainingQuantity:Q-d,themeColor:e?.dealTextColor,handleRemoveItem:e=>U(e,x),selecteditems:n,transitionActive:V,customVariantsQuantity:q}):null})):M.filter(Z).map(((r,o)=>t.createElement(Wm,{bundle:e,idx:o,key:r.productId,product:r?.productDetails,handleAddToBundle:G,hideAddToBundle:d>=Q,remainingQuantity:Q-d,themeColor:e?.dealTextColor,handleRemoveItem:p,selecteditems:n,transitionActive:V,customVariantsQuantity:q})))),!s&&t.createElement(Yu,{builderTiers:e?.builderTiers,handleAddToCart:a,minimumQuantity:I,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,handleRemoveItem:p,handleRemoveItemProductTier:U,selectedItemsQuantity:d,percentageOff:e.percentageOff,loading:i,bundleSubtotal:u,amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:e?.dealTextColor??"#333",primaryTextColorCta:e?.primaryTextColorCta??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:b,renderingOnPage:s})),s&&t.createElement(Yu,{handleAddToCart:a,minimumQuantity:I,builderTiers:e?.builderTiers,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,loading:i,handleRemoveItem:p,handleRemoveItemProductTier:U,percentageOff:e.percentageOff,selectedItemsQuantity:d??0,bundleSubtotal:u??{price:0,compareAtPrice:0},amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:C?.general.primaryColor||"#000",primaryTextColorCta:C.general.primaryContrastColor??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:b,renderingOnPage:s}),L&&void 0!==d&&(()=>{let r=d<e.minimumQuantity;return"productTier"==w?r=(k[x]?.minimumQuantity??0)>(b[x]?.length??0):"offerTier"==w&&(r=d<E.reduce(((e,t)=>e+t.minimumQuantity),0)),t.createElement(Rm,{handleAddToBundle:G,ref:W,remainingQuantity:e.minimumQuantity-d,hideAddToBundle:!r,disableQuantitySelector:e?.disableQuantitySelector??!1,disableInventoryTracking:!e?.customizations.general.trackInventory,selectedProducts:n,themeColor:C?.general.primaryColor||"#000",primaryTextColorCta:e?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:C?.general.primaryColor||"#000",cornerRadius:e?.customizations.byob.borderRadius,styles:e.customizations,reviewRatingType:e?.reviewRatingType??"none"})})())},qm=({product:e,selectedVariantId:n,onVariantChange:r,styles:o,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:s,storeCurrencyCode:d})=>{const p=e?.productDetails?.variants?.edges?.find((e=>e?.node?.id===n))?.node,u=i((()=>{if(p?.title&&e.productDetails.options){const t=p.title.split(" / ");if(t.length===e.productDetails.options.length)return t}return e.productDetails.options?.map((e=>e.values[0]))||[]}),[p,e.productDetails.options]),m=e=>{r(e)};return c?t.createElement("div",{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"}},t.createElement("div",{style:{position:"relative",width:"100%"}},o.comboBundle.subProductsImageVisibility&&t.createElement(t.Fragment,null,t.createElement("img",{src:p?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg",alt:e?.productDetails?.featuredMedia?.alt,width:165,height:165,style:{objectFit:"cover",borderRadius:"20px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",height:"100%",aspectRatio:o.general?.imageAspectRatio||"1/1"}}),t.createElement("div",{style:{marginTop:"8px",position:"absolute",bottom:"10px",left:"5px",right:"5px"}},e?.productDetails?.variants?.edges?.length>1&&t.createElement(t.Fragment,null,t.createElement("select",{value:n,onChange:e=>m(e.target.value),style:{padding:"8px 10px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"14px",width:"100%",appearance:"none",marginRight:"30px"}},e?.productDetails?.variants?.edges.map((e=>t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:e.node.inventoryQuantity<=0},e?.node?.title)))),t.createElement("div",{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"}},t.createElement(F,null)))))),(o.comboBundle.subProductsProductTitleVisibility||o.comboBundle.subProductsProductPriceVisibility)&&t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},e?.productDetails?.title),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},t.createElement("span",{style:{lineHeight:"normal"}},Eh(o.general.currencySymbol,d),kh((Number(""!==p?.compareAtPrice?Number(p?.compareAtPrice):p?.price)/Number(a)*Number(l)).toFixed(2))),t.createElement("span",{style:{textDecoration:"line-through",color:"#999",lineHeight:"normal",fontSize:"12px"}},Eh(o.general.currencySymbol,d),kh(""!==p?.compareAtPrice?p?.compareAtPrice:p?.price))))):t.createElement("div",{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"===o.comboBundle.infoAlignment&&{flexDirection:"row-reverse"},..."center"===o.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"}},o.comboBundle.subProductsImageVisibility&&t.createElement("div",{style:{position:"relative"}},t.createElement("img",{src:p?.image?.url||e?.productDetails?.featuredMedia?.preview?.image?.url||"/placeholder.svg",alt:e?.productDetails?.featuredMedia?.alt,height:80,style:{objectFit:"cover",borderRadius:"10px",border:"1px solid #DEDEDE",aspectRatio:"1/1",width:"90px",height:"90px"}}),t.createElement("div",{style:{position:"absolute",top:-8,right:-8,backgroundColor:"#f8f8f8",borderRadius:"50%",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid #eee",fontSize:"14px"}},"1")),t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"left"===o.comboBundle?.infoAlignment?"flex-start":"right"===o.comboBundle?.infoAlignment?"flex-end":"center"===o.comboBundle?.infoAlignment?"flex-start":void 0}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},t.createElement("span",null," ",e?.productDetails?.title," "),e.productDetails.variants.edges.length>1&&s&&u&&t.createElement("span",{style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},u.length>1?u.join(" / "):u)),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},t.createElement("span",{style:{lineHeight:"normal"}},Eh(o.general.currencySymbol,d),kh((Number(""!==p?.compareAtPrice?Number(p?.compareAtPrice):p?.price)/Number(a)*Number(l)).toFixed(2))),t.createElement("span",{style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Eh(o.general.currencySymbol,d),kh(""!==p?.compareAtPrice?p?.compareAtPrice:p?.price))),e.productDetails.variants.edges.length>1&&e.productDetails.options.length>0?t.createElement(t.Fragment,null,e.productDetails.options.map(((n,r)=>t.createElement("div",{key:n.name,style:{marginTop:"10px",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},e.productDetails.options.length>1&&t.createElement("label",{style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map((a=>{const i=s&&s?.options?.find((e=>e.name===n.name));return i&&"color"===i?.type?t.createElement("button",{key:a,onClick:()=>{const t=[...u];t[r]=a;const n=e.productDetails.options.length>0?t.join(" / "):t[r],o=e.productDetails.variants.edges.find((e=>e.node.title===n))?.node.id;o&&m(o)},style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid transparent"}},i?.values.find((e=>e.name===a))?.value?t.createElement("div",{style:{width:u[r]===a?"26px":"24px",height:u[r]===a?"26px":"24px",borderRadius:"50%",backgroundColor:i?.values.find((e=>e.name===a))?.value,cursor:"pointer"}},t.createElement("span",null)):t.createElement("span",{key:a,style:{padding:"4px 8px",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u[r]===a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"10px",fontWeight:"600"}},a)):i&&"image"===i?.type?t.createElement("button",{key:a,onClick:()=>{const t=[...u];t[r]=a;const n=e.productDetails.options.length>0?t.join(" / "):t[r],o=e.productDetails.variants.edges.find((e=>e.node.title===n))?.node.id;o&&m(o)},style:{border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u[r]===a?"#F7F7F7":"transparent",cursor:"pointer",padding:"0px",width:u[r]===a?"26px":"24px",height:u[r]===a?"26px":"24px",overflow:"hidden"}},i?.values.find((e=>e.name===a))?.value?t.createElement("img",{src:i?.values.find((e=>e.name===a))?.value||"/placeholder.svg",alt:a,style:{width:u[r]===a?"26px":"24px",height:u[r]===a?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):t.createElement("span",{key:a,style:{padding:"4px 8px",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u[r]===a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"10px",fontWeight:"600"}},a)):t.createElement("button",{key:a,onClick:()=>{const t=[...u];t[r]=a;const n=e.productDetails.options.length>0?t.join(" / "):t[r],o=e.productDetails.variants.edges.find((e=>e.node.title===n))?.node.id;o&&m(o)},style:{padding:"4px 8px",border:u[r]===a?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u[r]===a?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"10px",fontWeight:"600"}},a)}))))))):t.createElement(t.Fragment,null,e?.productDetails?.variants?.edges?.length>1&&t.createElement("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e?.productDetails?.variants?.edges.map((e=>t.createElement("button",{key:e?.node?.id,onClick:()=>m(e?.node?.id),disabled:e.node.inventoryQuantity<=0,style:{padding:"4px 8px",border:n===e?.node?.id?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:n===e?.node?.id?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"500"}},e?.node?.title)))))))},Zm=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,s]=c(window.innerWidth<786),[d,p]=c((()=>{const t={};return e.products.forEach(((e,n)=>{const r=e.productDetails.variants.edges.find((e=>e.node.inventoryQuantity>0))?.node;t[n]=r?r.id:e?.productDetails?.variants?.edges[0]?.node?.id})),t})),u=e.products?.filter((e=>e?.productDetails?.variants?.edges.some((e=>e?.node?.inventoryQuantity>0))))||[],m=Object.keys(d).length===u.length,f=(e,t)=>{p((n=>({...n,[e]:t})))},{originalPrice:g,dealPrice:h,offerValue:x}=i((()=>{const{price:t,compareAtPrice:n}=Object.entries(d).reduce(((t,[n,r])=>{const o=e.products[parseInt(n)],a=o.productDetails.variants.edges?.find((e=>e.node.id===r))?.node,i=parseFloat(a?.price??"0"),l=parseFloat(a?.compareAtPrice||i.toString());return t.price+=i,t.compareAtPrice+=l,t}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff);const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[d,e.products,e.percentageOff,e.dealAmount,e.amountOff]);l((()=>{const e=()=>{s(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const y=e.customizations,b=y.comboBundle?.comboCardStyle||"auto",v="vertical"===b||"auto"===b&&!a,w=y.comboBundle?.embedContentVisibility,C="bundles"==e.appName?e.pageHeader?.title:e?.title,k="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement("div",{style:{lineHeight:"normal",maxWidth:"800px",marginBlock:y.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===y.comboBundle?.infoAlignment?"flex-start":"right"===y.comboBundle?.infoAlignment?"flex-end":"center"===y.comboBundle?.infoAlignment?"center":void 0,textAlign:y.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},t.createElement("h2",{style:{fontSize:y.comboBundle?.productTitleFontSize||"28px",color:y.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},C)),w&&y?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:y.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(y.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},t.createElement("span",{style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Eh(y.general.currencySymbol,e.storeCurrencyCode),kh(h)),t.createElement("div",{style:{color:y.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Eh(y.general.currencySymbol,e.storeCurrencyCode),kh(g)),t.createElement("span",{style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},e?.percentageOff?`${e?.percentageOff}% Off`:e?.amountOff?`${Eh(y.general.currencySymbol,e.storeCurrencyCode)}${kh(e?.amountOff)} Off`:`Save ${Eh(y.general.currencySymbol,e.storeCurrencyCode)}${kh(x)}`))),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",margin:"15px 0px"},className:"yt-comboBundle-checkoutSpecific-container"},t.createElement("div",{style:{display:"flex",width:"12px",height:"12px",justifyContent:"center",alignItems:"center",alignContent:"center",borderRadius:"50%",backgroundColor:y.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},t.createElement("span",null)),t.createElement("p",{style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",alignItems:"center",margin:0,lineHeight:"1.2"},className:"yt-comboBundle-checkoutSpecific-text"},"Tax included. ",t.createElement("u",null,"Shipping")," calculated at checkout."))),y.comboBundle.subProductsSectionVisibility&&t.createElement(t.Fragment,null,v?t.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"20px",marginTop:"10px",flexWrap:"wrap"}},e.products.map(((n,r)=>{const o=n?.productDetails?.variants?.edges?.find((e=>e?.node?.id===d[r]))?.node;return o?t.createElement(qm,{key:`combo-product-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:d[r],onVariantChange:e=>f(r,e),isVertical:v,variantOptions:e.variantOptions,storeCurrencyCode:e.storeCurrencyCode}):null}))):t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},y.comboBundle.subProductsSectionVisibility&&e.products.map(((n,r)=>t.createElement(qm,{key:`combo-product-horizontal-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:d[r],onVariantChange:e=>f(r,e),variantOptions:e.variantOptions}))))),t.createElement("div",{style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},t.createElement("button",{style:{backgroundColor:m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor,color:y.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:y.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:m?"pointer":"not-allowed",border:`1px solid ${m?y.general?.ctaBackgroundColor||"#121212":y.general.disabledButtonColor}`,boxShadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,margin:"0"},disabled:!m,onMouseOver:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=y.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{y.general.customizeHoverState&&m&&(e.currentTarget.style.backgroundColor=y.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=y.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{try{if(o(!0),!n)return void o(!1);const t=Object.entries(d).map((([t,n])=>{const r=e.products[parseInt(t)],o=r.productDetails.variants.edges.find((e=>e.node.id===n))?.node;return o?{variantId:n,price:Number(o.price)}:null})).filter((e=>null!==e)),r=Object.values(d);await n(Number(g),r,Number(h),t)}catch(e){}o(!1)}},r?t.createElement(Wo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,m?y.comboBundle?.ctaTitle??"Add Bundle to cart":y.general.outOfStockLabel||"Out of Stock"," "))),w&&y.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{style:{margin:"20px 0px"}},t.createElement("h4",{style:{fontSize:"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:y.general.primaryColor+"20"}},"Description"),t.createElement("div",{style:{fontSize:y.comboBundle.productDescriptionFontSize||"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:y.general.primaryColor+"08"}},t.createElement("p",null,k))))},Km=x.div`
|
|
3534
3534
|
max-width: 800px;
|
|
3535
3535
|
container-type: inline-size;
|
|
3536
3536
|
margin-top: ${e=>e.verticalMargin||"0px"};
|