yt-uikit 0.7.413-tracks-inventory.0 → 0.7.4123

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.
@@ -83,7 +83,6 @@ export type ProductDetails = {
83
83
  status: "active" | "archived" | "draft" | "";
84
84
  options: ProductOption[];
85
85
  onlineStoreUrl: string;
86
- tracksInventory?: boolean;
87
86
  collections: {
88
87
  edges: CollectionNode[];
89
88
  };
@@ -336,6 +335,7 @@ export type BundlePayload = {
336
335
  customStoreDetails?: {
337
336
  [key: string]: any;
338
337
  };
338
+ customProductsQuantity?: number | null;
339
339
  reviewRatingType?: "none" | "ratingOnly" | "ratingAndReviewCount";
340
340
  appName?: string;
341
341
  pageHeader?: {
@@ -1,7 +1,7 @@
1
1
  import "../bundle.scss";
2
2
  import React from "react";
3
3
  import { BundlePayload, ProductDetails } from "../Bundle";
4
- export declare function QuantitySelectorForBundle({ quantity, setQuantity, remainingQuantity, handleAddToBundle, variantId, product, handleRemoveItem, hideAddToBundle, selectedVariantInventoryQty, }: {
4
+ export declare function QuantitySelectorForBundle({ quantity, setQuantity, remainingQuantity, handleAddToBundle, variantId, product, handleRemoveItem, hideAddToBundle, disableInventoryTracking, selectedVariantInventoryQty, }: {
5
5
  quantity: number;
6
6
  setQuantity: React.Dispatch<React.SetStateAction<number>>;
7
7
  remainingQuantity: number;
@@ -10,6 +10,7 @@ export declare function QuantitySelectorForBundle({ quantity, setQuantity, remai
10
10
  product?: ProductDetails;
11
11
  handleRemoveItem?: (variantId: string, quantity: number) => void;
12
12
  hideAddToBundle?: boolean;
13
+ disableInventoryTracking?: boolean;
13
14
  selectedVariantInventoryQty: number;
14
15
  }): React.JSX.Element;
15
16
  type BundleBuilderProps = {
package/dist/esm/index.js CHANGED
@@ -3537,7 +3537,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
3537
3537
  font-size: 1em;
3538
3538
  justify-content: center;
3539
3539
  align-items: center;
3540
- `;const Zm=n(((e,n)=>{const[r,o]=Qt(im),a=(e.disableInventoryTracking?r?.variants.edges?.filter((t=>t.node.inventoryQuantity>0||e.disableInventoryTracking)):r?.variants.edges)??[],[i,d]=c(a[0]?.node),[s,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));d(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 E=()=>{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:k,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!==s&&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)&&d(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 I=e=>{b(e.targetTouches[0].clientX),C(null)},D=e=>{C(e.targetTouches[0].clientX)},_=()=>{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)},N=e.hideAddToBundle||(i?.inventoryQuantity??0)<=0&&!e.disableInventoryTracking||e?.disableQuantitySelector&&f>=1||"idle"!==h,P=t.createElement(Qm,null,t.createElement(Gm,{$isSmallScreen:u,ref:n},t.createElement(Ym,{ref:n,className:"yt-variant-selection-modal"},t.createElement("div",{className:"yt-variant-selection-modal "+(u?"small-screen":"large-screen")},t.createElement(qm,{onClick:()=>{o(void 0)},style:{backgroundColor:"white"}},t.createElement(ct,{size:"25"})),t.createElement("div",{className:"image-section"},t.createElement(t.Fragment,null,t.createElement("div",{onTouchStart:I,onTouchMove:D,onTouchEnd:_},t.createElement(Um,{small:Hh(B[s]?.url),medium:Hh(B[s]?.url),large:Hh(B[s]?.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:Hh(n?.url),alt:n.altText||`${k} - Image ${r+1}`,onClick:()=>p(r),className:s===r?"active":"",style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...s===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),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(Qr,{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(Qr,{color:"gold",size:14})," ",r?.rating?.averageRating,t.createElement(Zn,{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(co,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"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(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:N?.5:1,cursor:N?"not-allowed":"pointer"},className:"yt-product-modal-atc-button",onClick:e=>{e.stopPropagation(),e.preventDefault(),E()},disabled:N},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}})))))),O=t.createElement(Qm,null,t.createElement(Gm,{style:{padding:"0px",position:"relative"},$isSmallScreen:u,ref:n},t.createElement(Ym,{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(so,{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:I,onTouchMove:D,onTouchEnd:_},t.createElement(Um,{small:Hh(B[s]?.url),medium:Hh(B[s]?.url),large:Hh(B[s]?.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:s===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:Hh(n?.url),alt:n.altText||`${k} - Image ${r+1}`,onClick:()=>p(r),className:s===r?"active":"",style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...s===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),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(Qr,{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(Qr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Zn,{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(co,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"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(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(),E()},disabled:"idle"!==h},e.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return v.createPortal(u?O:P,document.body)})),Xm=({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:Sn(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))}))),Km=({product:e,isOpen:n,onClose:r,variantOptions:o,cta:a,onConfirm:i,disableInventoryTracking:d})=>{const[s,p]=c((()=>{const t=e.variants.edges.find((e=>d||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?s.join(" / "):s[0])))?.node,g=f?.image?.url||e.featuredMedia?.preview?.image?.url,h=Sn(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=s[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(Xm,{options:y(n),selectedValue:b(n,r),onChange:e=>{((e,t)=>{const n=[...s];n[e]=t.name,p(n)})(r,e)},type:x(n.name),isOptionAvailable:t=>((t,n)=>{if(d)return!0;const r=[...s];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?s.join(" / "):s[0])))?.node,n=t&&(d||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:",s);const t=e.variants.edges.find((e=>d||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)},Jm=({coverImageUrl:e,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],i=(e,t)=>{if(e)try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map((({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""})).filter(Boolean).join(", "):"";if(!e&&!n)return null;const c=e||n||"",d=i(c,800)||c,s=[];if(n&&n!==e){const e=l(n);e&&s.push(t.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:e}))}if(e){const n=l(e);n&&(s.length>0?s.push(t.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):s.push(t.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const e=l(n);e&&s.push(t.createElement("source",{key:"mobile",srcSet:e}))}return t.createElement("div",{style:{width:"100%",display:"block"}},t.createElement("picture",{style:{display:"block",width:"100%"}},s,t.createElement("img",{src:d,alt:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))};function ef({quantity:e,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:c,selectedVariantInventoryQty:d}){const s={display:"flex",alignItems:"center",justifyContent:"center",width:"33%",cursor:"pointer",backgroundColor:"#f2f2f2",userSelect:"none",border:"none",padding:"8px",margin:"0",fontSize:"20px",color:"#333",textDecoration:"none",boxShadow:"none",outline:"none",borderRadius:"0",boxSizing:"border-box"},p=!i?.tracksInventory||e<d;return t.createElement(mu,null,t.createElement("button",{onClick:t=>{t.stopPropagation();const r=Math.max(0,e-1);n(r),l&&a&&l(a,1)},style:s},"-"),t.createElement(fu,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:!p||c,style:{...s,cursor:!p||c?"not-allowed":"pointer",opacity:!p||c?.6:1}},"+"))}const tf=({product:e,styles:n,selectedVariant:r})=>{const[o,a]=c(!1),d=i((()=>Hh(r?.image?.url||e?.featuredMedia?.preview?.image?.url||e?.media?.edges?.[0]?.node?.image?.url)||""),[r?.image?.url,e?.featuredMedia?.preview?.image?.url,e?.media?.edges]),s=i((()=>e?.media?.edges?.map((e=>Hh(e?.node?.preview?.image?.url??e?.node?.image?.url))).filter(Boolean)??[]),[e?.media?.edges]),p=i((()=>s?.[1]??d??""),[s,d]);l((()=>{if(d){(new Image).src=d}}),[d]);const u=i((()=>d||s?.[0]),[d,s]);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",{loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:o&&u!==p?0:1,transition:s?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:o?"scale(1.1)":"scale(1)"},src:u,alt:e.title}),u!==p&&t.createElement("img",{loading:"lazy",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,objectPosition:"top"},src:p,alt:e.title})))},nf=({product:e,bundle:n,handleAddToBundle:r,hideAddToBundle:o,remainingQuantity:a,themeColor:i,handleRemoveItem:d,transitionActive:s,idx:p,selecteditems:u,customVariantsQuantity:m})=>{const f=qt(im),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((t=>t.node.inventoryQuantity>0||!e.tracksInventory))?.node?.id;if(!v&&!g.general.showOutOfStockProducts)return t.createElement(t.Fragment,null);const[w,C]=c(b?.find((t=>!e.tracksInventory||t.node.inventoryQuantity>0))?.node?.id||b[0]?.node?.id),[E,k]=c(0),[T,S]=c(window.innerWidth<450),[$,B]=c("normal"),z=b?.find((e=>e?.node?.id===w))?.node,I=m&&m.length>0&&m.find((e=>e.variantId==z?.id))?.quantity||z&&z?.inventoryQuantity;l((()=>{const e=u.find((e=>e.variantId===w));k(e?e.quantity:0)}),[E,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 D=e.variants&&e.variants.edges?.length>1&&"customOptions"!==h,_="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,N="53933408435"===_,P="75851235630"===_,O=(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),A=O.length>0;return t.createElement(t.Fragment,null,t.createElement(xu,{borderRadius:g?.byob.borderRadius,borderColor:g?.byob.borderColor,shadowType:g?.byob.shadowType,backgroundColor:g?.byob.cardBackgroundColor,className:"bundle-builder-product-container "+(s?"yt-product-card-transition-active":p%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(I<=0&&e.tracksInventory)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(yu,null,t.createElement(tf,{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),D&&t.createElement("div",{style:{position:"relative",width:"100%"}},t.createElement(bu,{isCoralHaze:N,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&&A&&t.createElement("div",{style:{padding:"2px 4px"}},t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"}},O.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)))),O.length>2&&t.createElement("span",{style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",O.length-2," more"))),t.createElement(vu,{isMobile:T,showBorder:n?.showBorder??!0,style:{...!g?.byob.productsPriceVisibility&&{padding:"8px"},...g?.byob.productTitleFontSize&&{fontSize:g?.byob.productTitleFontSize}}},t.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"}},P?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(Qr,{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(Qr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Zn,{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,Wh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Vh(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"}},Wh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Vh(z.compareAtPrice))),(I>0||!e.tracksInventory)&&t.createElement(wu,{borderRadius:g?.byob.borderRadius,className:"yt-product-atc-wrapper"},(0===E||void 0===E)&&t.createElement(gu,{style:{...!o&&{backgroundColor:g?.general.primaryColor||"#111",color:g?.general.primaryContrastColor||"#fff"}},disabled:o,onClick:t=>{t.stopPropagation(),t.preventDefault(),k(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&&E>0&&w&&t.createElement(hu,{className:"visible",style:{overflow:"hidden"}},t.createElement(ef,{remainingQuantity:a,setQuantity:k,quantity:E,handleAddToBundle:r,variantId:w,product:e,handleRemoveItem:d,hideAddToBundle:o,selectedVariantInventoryQty:I})),n?.disableQuantitySelector&&E>0&&w&&t.createElement(gu,{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(Cu,{className:"yt-product-atc-single-qty-selector-added"},"ADDED"),t.createElement(Eu,{onClick:e=>{e.stopPropagation();const t=Math.max(0,E-1);k(t),d&&w&&d(w,1)},className:"yt-product-atc-single-qty-selector-remove"},t.createElement(ao,{style:{color:"#fff",fontSize:"20px"}})))),I<=0&&e.tracksInventory&&t.createElement(gu,{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(Km,{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:!e.tracksInventory}))},rf=({currentStep:e,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:d})=>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,s)=>{const p=s+1,u=o[s].minimumQuantity-(i[s]?.length??0)==0,m=s===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===d?()=>{}: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:s<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)),of=({isMobile:e,setSearchTerm:n,searchTerm:r,styles:o,setSortBy:a})=>{const[i,d]=c(!1),[s,p]=c(r);return l((()=>{const e=setTimeout((()=>{n(s)}),300);return()=>clearTimeout(e)}),[s,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(oo,{className:"yt-byob-search-icon",fontSize:"20px",color:"#555",style:{cursor:"pointer",lineHeight:"normal"},onClick:()=>d(!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:s,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(oo,{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:()=>d(!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)")))))},af=({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))))))},lf=({bundle:e,selectedItems:n,setSelectedItems:r,handleAddToCart:i,bundleAddToCartLoading:d,renderingOnPage:s,selectedItemsQuantity:p,handleRemoveItem:u,bundleSubtotal:m})=>{const[f,g]=c(void 0),[h,x]=c(window.innerWidth<450),[y,b]=c(0),[v,w]=c({}),C=e.builderTiers?.type,E=e.customizations,k=e.builderTiers?.productTier??[],T=e.builderTiers?.offerTier??[],[S,$]=c([]),[B,z]=c(!1),[I,D]=c("All"),[_,N]=c(0),P=o(null);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))))}})),$(Array.from(t)),z(n)}),[e.products]);const O=((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)),I),A="productTier"===C?k.reduce(((e,t)=>e+t.minimumQuantity),0):"offerTier"===C?T.reduce(((e,t)=>e+t.minimumQuantity),0):e.minimumQuantity,[F,M]=c(""),[R,L]=c(""),j=((e,t)=>e.filter((e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase()))))(O,F),V=((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}})))(j,R),W=((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"),d=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-d;case"price-high-to-low":return d-c;default:return 0}})))(k,V,F,R,y),[H,U]=Qt(im),[q,Q]=c(!1),G="productTier"===C?W:V,Y=G.slice(0,20*(_+1));l((()=>{setTimeout((()=>{Q(!0)}),100)}),[]);const Z=o(null);l((()=>{const e=()=>{x(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(e.coverImageUrl){const t=new Image;t.src=Hh(e.coverImageUrl)??"",t.onload=()=>{g(t.width/t.height)}}}),[e.coverImageUrl]),l((()=>{Q(!1),setTimeout((()=>Q(!0)),100)}),[y]);const X=(e,t)=>{if("productTier"===C){let n={...v},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}}w(n);const o=k.findIndex(((e,t)=>n[t]?.length<e.minimumQuantity));-1!==o&&b(o)}u(e)};l((()=>{if("productTier"===C){const e=Object.fromEntries(k.map((e=>[e.tier,[]])));w(e)}}),[e]),l((()=>{if("productTier"!==C||!k[y])return;if(A===p)return;const e=k.findIndex(((e,t)=>{const n=v[t]||[];return t>=y&&n.length<e.minimumQuantity}));-1!==e&&e!==y&&(b(e),(()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})})())}),[v,k,C]),l((()=>{M("")}),[y]),l((()=>{function e(e){if(!Z.current||!e.target)return;!Z.current.contains(e.target)&&U(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]);const K=(e,t,o)=>{var a;"productTier"===C&&(a=e,w((e=>{const t={...e},n=k.findIndex(((e,n)=>{const r=t[n]||[];return n>=y&&r.length<e.minimumQuantity}));return-1!==n&&b(n),t[n]||(t[n]=[]),t[n].push(a),t}))),Uh(e,t,o,n,r)},J=(()=>{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})(),ee=h&&e.mobileCoverImageUrl?Hh(e.mobileCoverImageUrl):Hh(e.coverImageUrl??"")||null,te=e.customStoreDetails?.fixedInventoryDetails,ne=e=>{const t=E?.general?.showOutOfStockProducts,n=e.productDetails.tracksInventory;if(t||!n)return!0;const r=e?.productDetails?.variants?.edges||[];if(te){if(r.some((e=>te.some((t=>t.variantId===e.node.id&&t.quantity>0)))))return!0}return r.some((e=>e.node.inventoryQuantity>0))},re="bundles"==e.appName?e.pageHeader?.title:e?.title,oe="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;l((()=>{N(0)}),[F,R,I,y]);const ae=a((()=>{Y.length<G.length&&N((e=>e+1))}),[Y.length,G.length]);return l((()=>{const e=new IntersectionObserver((([e])=>{e.isIntersecting&&ae()}),{threshold:.1});return P.current&&e.observe(P.current),()=>{P.current&&e.unobserve(P.current)}}),[ae]),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:E.byob.sectionBackgroundColor,..."transparent"!==E.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},ee?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}}},ee&&t.createElement(Jm,{coverImageUrl:ee,alt:"Background",styles:{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:E?.byob?.titleFontSize??"3rem",fontWeight:"700",color:E?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:E?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},re),t.createElement("span",{style:{lineHeight:"normal",fontSize:E?.byob?.subtitleFontSize??"1.5rem",color:E?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},oe))):(re||oe)&&t.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},re&&t.createElement("span",{style:{lineHeight:"normal",fontSize:E?.byob?.titleFontSize??"3rem",fontWeight:"700",color:E?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:E?.byob?.titleBackgroundColor??"transparent"}},re),oe&&t.createElement("span",{style:{lineHeight:"normal",fontSize:E?.byob?.subtitleFontSize??"1.5rem",color:E?.byob?.titleTextColor??"#000"}},oe)),t.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===C&&k.length>0&&E?.byob.productTiersVisibility&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(rf,{currentStep:y,totalSteps:k.length,tiers:k,isMobile:h,primaryColor:E?.general?.primaryColor,primaryTextColorCta:E?.general?.primaryContrastColor,setCurrentProductTier:b,selectedProductsByTier:v,tierNavigation:E.byob.tierNavigation})))),t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},e?.enableSortAndFilter&&t.createElement(of,{isMobile:h,searchTerm:F,setSearchTerm:M,setSortBy:L,styles:E}),e?.customizations?.byob?.enableProductCategories&&B&&t.createElement("div",null,t.createElement(af,{styles:E,isMobile:h,categories:S,activeCategory:I,onCategoryChange:e=>{D(e)}}))),t.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:"center",width:"100%"},className:"products-display"},0===G?.length?t.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===C&&k.length>0?Y.filter((e=>ne(V.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))))).map(((r,o)=>{const a=(k[y]?.minimumQuantity??0)>(v[y]?.length??0),i=V.find((e=>e.productId===r.productId&&(r.variantIds.length<1||e.variantIds.includes(r.variantIds[0]))));return i?t.createElement(nf,{bundle:e,idx:o,key:r?.variantIds?.[0]??r.productId,product:i?.productDetails,handleAddToBundle:K,hideAddToBundle:!a,remainingQuantity:J-p,themeColor:e?.dealTextColor,handleRemoveItem:e=>X(e,y),selecteditems:n,transitionActive:q,customVariantsQuantity:te}):null})):Y.filter(ne).map(((r,o)=>t.createElement(nf,{bundle:e,idx:o,key:r.productId,product:r?.productDetails,handleAddToBundle:K,hideAddToBundle:p>=J,remainingQuantity:J-p,themeColor:e?.dealTextColor,handleRemoveItem:u,selecteditems:n,transitionActive:q,customVariantsQuantity:te}))),Y.length<G.length&&t.createElement("div",{ref:P,style:{height:"1px",width:"100%",display:"block"}})),!s&&t.createElement(am,{builderTiers:e?.builderTiers,handleAddToCart:i,minimumQuantity:A,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:X,selectedItemsQuantity:p,percentageOff:e.percentageOff,loading:d,bundleSubtotal:m,amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:e?.dealTextColor??"#333",primaryTextColorCta:e?.primaryTextColorCta??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:s})),s&&t.createElement(am,{handleAddToCart:i,minimumQuantity:A,builderTiers:e?.builderTiers,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,loading:d,handleRemoveItem:u,handleRemoveItemProductTier:X,percentageOff:e.percentageOff,selectedItemsQuantity:p??0,bundleSubtotal:m??{price:0,compareAtPrice:0},amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:E?.general.primaryColor||"#000",primaryTextColorCta:E.general.primaryContrastColor??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:s}),H&&void 0!==p&&(()=>{let r=p<e.minimumQuantity;return"productTier"==C?r=(k[y]?.minimumQuantity??0)>(v[y]?.length??0):"offerTier"==C&&(r=p<T.reduce(((e,t)=>e+t.minimumQuantity),0)),t.createElement(Zm,{handleAddToBundle:K,ref:Z,remainingQuantity:e.minimumQuantity-p,hideAddToBundle:!r,disableQuantitySelector:e?.disableQuantitySelector??!1,disableInventoryTracking:!H.tracksInventory,selectedProducts:n,themeColor:E?.general.primaryColor||"#000",primaryTextColorCta:e?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:E?.general.primaryColor||"#000",cornerRadius:e?.customizations.byob.borderRadius,styles:e.customizations,reviewRatingType:e?.reviewRatingType??"none"})})())},cf=({product:e,selectedVariantId:n,onVariantChange:r,styles:o,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:d,storeCurrencyCode:s,trackInventory:p})=>{const u=e?.productDetails?.variants?.edges?.find((e=>e?.node?.id===n))?.node,m=i((()=>{if(u?.title&&e.productDetails.options){const t=u.title.split(" / ");if(t.length===e.productDetails.options.length)return t}return e.productDetails.options?.map((e=>e.values[0]))||[]}),[u,e.productDetails.options]),f=e=>{r(e)};return c?t.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},t.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},o.comboBundle.subProductsImageVisibility&&t.createElement(t.Fragment,null,t.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Hh(u?.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",{className:"yt-comboBundle-product-variant-selector-container-vertical",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",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>f(e.target.value),style:{padding:"8px 10px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"14px",width:"100%",appearance:"none",marginRight:"30px"},disabled:!!p&&e?.productDetails?.variants?.edges.every((e=>e.node.inventoryQuantity<=0))},e?.productDetails?.variants?.edges.map((e=>t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:!!p&&e.node.inventoryQuantity<=0,className:"yt-comboBundle-product-variant-option"},e?.node?.title)))),t.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},t.createElement(F,null)))))),(o.comboBundle.subProductsProductTitleVisibility||o.comboBundle.subProductsProductPriceVisibility)&&t.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},e?.productDetails?.title),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Wh(o.general.currencySymbol,s),Vh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-vertical",style:{textDecoration:"line-through",color:"#999",lineHeight:"normal",fontSize:"12px"}},Wh(o.general.currencySymbol,s),Vh(u?.compareAtPrice?u?.compareAtPrice:u?.price))))):t.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===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",{className:"yt-comboBundle-product-image-wrapper-horizontal"},t.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Hh(u?.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",{className:"yt-comboBundle-product-info-horizontal",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",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},t.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",e?.productDetails?.title," "),e.productDetails.variants.edges.length>1&&d&&m&&t.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},m.length>1?m.join(" / "):m)),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Wh(o.general.currencySymbol,s),Vh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Wh(o.general.currencySymbol,s),Vh(u?.compareAtPrice?u?.compareAtPrice:u?.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,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},e.productDetails.options.length>1&&n?.values?.length>1&&t.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map((a=>{const i=[...m];i[r]=a;const l=e.productDetails.options.length>0?i.join(" / "):i[r],c=e.productDetails.variants.edges.find((e=>e.node.title===l))?.node,s=!!p&&(!c||c.inventoryQuantity<=0),u=m[r]===a,g=d&&d?.options?.find((e=>e.name===n.name));return g&&"color"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-color ${u?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&f(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},g?.values.find((e=>e.name===a))?.value?t.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:g?.values.find((e=>e.name===a))?.value}},t.createElement("span",null)):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):g&&"image"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-image ${u?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&f(c.id)},disabled:s,style:{border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},g?.values.find((e=>e.name===a))?.value?t.createElement("img",{className:"yt-comboBundle-product-option-image",src:Hh(g?.values.find((e=>e.name===a))?.value||"/placeholder.svg"),alt:a,style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-text ${u?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&f(c.id)},disabled:s,style:{padding:"4px 8px",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},a)}))))))):t.createElement(t.Fragment,null,e?.productDetails?.variants?.edges?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e?.productDetails?.variants?.edges.map((e=>t.createElement("button",{key:e?.node?.id,className:`yt-comboBundle-product-variant-button ${n===e?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${e.node.inventoryQuantity<=0?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>f(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)))))))},df=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,d]=c(window.innerWidth<786);l((()=>(n&&(window.ytComboBundle={bundle:e,addToCart:n},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))})),[e,n]);const[s,p]=c((()=>{const t={};return e.products.forEach(((e,n)=>{const r=e?.productDetails?.tracksInventory?e.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node:e.productDetails?.variants?.edges?.[0]?.node;t[n]=r?r.id:e?.productDetails?.variants?.edges[0]?.node?.id})),t})),u=e.products?.every(((e,t)=>{const n=e?.productDetails?.tracksInventory;if(!n)return!0;const r=s[t],o=e.productDetails?.variants?.edges?.find((e=>e.node.id===r))?.node;return(o?.inventoryQuantity??0)>0})),m=(e,t)=>{p((n=>({...n,[e]:t})))},{originalPrice:f,dealPrice:g,offerValue:h}=i((()=>{const{price:t,compareAtPrice:n}=Object.entries(s).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)}}),[s,e.products,e.percentageOff,e.dealAmount,e.amountOff]);l((()=>{const e=()=>{d(window.innerWidth<786)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const x=e.customizations,y=x.comboBundle?.comboCardStyle||"auto",b="vertical"===y||"auto"===y&&!a,v=x.comboBundle?.embedContentVisibility,w="bundles"==e.appName?e.pageHeader?.title:e?.title,C="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===x.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===x.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===x.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,style:{lineHeight:"normal",maxWidth:"800px",marginBlock:x.comboBundle?.verticalMargin||"0px",display:"flex",flexDirection:"column",alignItems:"left"===x.comboBundle?.infoAlignment?"flex-start":"right"===x.comboBundle?.infoAlignment?"flex-end":"center"===x.comboBundle?.infoAlignment?"center":void 0,textAlign:x.comboBundle?.infoAlignment??"left",fontFamily:"system-ui, -apple-system, sans-serif"}},v&&x.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Title")&&t.createElement("div",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},t.createElement("h2",{className:"yt-comboBundle-bundle-title",style:{fontSize:x.comboBundle?.productTitleFontSize||"28px",color:x.comboBundle?.titleTextColor||"#000",fontWeight:"bold",lineHeight:"1.6",margin:0}},w)),v&&x?.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Price")&&t.createElement(t.Fragment,null,t.createElement("div",{className:"yt-comboBundle-bundle-price-container",style:{display:"flex",alignItems:"center",gap:"8px",color:x.comboBundle?.titleTextColor||"#000",fontSize:(parseInt(x.comboBundle?.productTitleFontSize?.replace("px",""))||28)-4+"px"}},t.createElement("div",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},t.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Wh(x.general.currencySymbol,e.storeCurrencyCode),Vh(g)),t.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:x.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Wh(x.general.currencySymbol,e.storeCurrencyCode),Vh(f)),t.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},e?.percentageOff?`${e?.percentageOff}% Off`:e?.amountOff?`${Wh(x.general.currencySymbol,e.storeCurrencyCode)}${Vh(e?.amountOff)} Off`:`Save ${Wh(x.general.currencySymbol,e.storeCurrencyCode)}${Vh(h)}`))),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:x.general?.ctaBackgroundColor||"#1e1e1e",flexShrink:0},className:"yt-comboBundle-checkoutSpecific-dot"},t.createElement("span",null)),t.createElement("p",{style:{fontSize:x.comboBundle.productDescriptionFontSize||"16px",color:x.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."))),x.comboBundle.subProductsSectionVisibility&&t.createElement(t.Fragment,null,b?t.createElement("div",{className:"yt-comboBundle-products-grid-vertical "+(a?"yt-comboBundle-products-grid-mobile":""),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===s[r]))?.node;return o?t.createElement(cf,{key:`combo-product-${r}-${n.productId}`,product:n,styles:x,originalPrice:f,dealPrice:g,selectedVariantId:s[r],onVariantChange:e=>m(r,e),isVertical:b,variantOptions:e.variantOptions,storeCurrencyCode:e.storeCurrencyCode,trackInventory:n?.productDetails?.tracksInventory}):null}))):t.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(a?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},x.comboBundle.subProductsSectionVisibility&&e.products.map(((n,r)=>t.createElement(cf,{key:`combo-product-horizontal-${r}-${n.productId}`,product:n,styles:x,originalPrice:f,dealPrice:g,selectedVariantId:s[r],onVariantChange:e=>m(r,e),variantOptions:e.variantOptions,trackInventory:n?.productDetails?.tracksInventory}))))),t.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},t.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${u?"":"yt-comboBundle-bundle-cta-button-disabled"} ${a?"yt-comboBundle-bundle-cta-button-mobile":""}`,style:{backgroundColor:u?x.general?.ctaBackgroundColor||"#121212":x.general.disabledButtonColor,color:x.general?.ctaTextColor||"#FFFFFF",fontSize:"16px",borderRadius:x.general.ctaBorderRadius??"20px",fontWeight:"bold",cursor:u?"pointer":"not-allowed",border:`1px solid ${u?x.general?.ctaBackgroundColor||"#121212":x.general.disabledButtonColor}`,boxShadow:x.general.ctaShadowType,padding:x.general?.ctaPadding,width:x.general?.ctaWidth,margin:"0"},disabled:!u,onMouseOver:e=>{x.general.customizeHoverState&&u&&(e.currentTarget.style.backgroundColor=x.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=x.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{x.general.customizeHoverState&&u&&(e.currentTarget.style.backgroundColor=x.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=x.general?.ctaTextColor||"#FFFFFF")},onClick:async()=>{try{if(o(!0),!n)return console.error("[ComboBundle.tsx] No addToCartFunction available"),void o(!1);const t=Object.entries(s).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(s);await n(Number(f),r,Number(g),t)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}o(!1)}},r?t.createElement(Yo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,u?x.comboBundle?.ctaTitle??"Add Bundle to cart":x.general.outOfStockLabel||"Out of Stock"," "))),v&&x.comboBundle?.selectedEmbedContentVisibilityOptions?.includes("Combo Description")&&t.createElement("div",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},t.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:x.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:x.general.primaryColor+"20"}},"Description"),t.createElement("div",{className:"yt-comboBundle-bundle-description-content",style:{fontSize:x.comboBundle.productDescriptionFontSize||"16px",color:x.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",padding:"8px",backgroundColor:x.general.primaryColor+"08"}},t.createElement("p",null,C))))},sf=x.div`
3540
+ `;const Zm=n(((e,n)=>{const[r,o]=Qt(im),a=(e.disableInventoryTracking?r?.variants.edges?.filter((t=>t.node.inventoryQuantity>0||e.disableInventoryTracking)):r?.variants.edges)??[],[i,d]=c(a[0]?.node),[s,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));d(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 E=()=>{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:k,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!==s&&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)&&d(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 I=e=>{b(e.targetTouches[0].clientX),C(null)},D=e=>{C(e.targetTouches[0].clientX)},_=()=>{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)},N=e.hideAddToBundle||(i?.inventoryQuantity??0)<=0&&!e.disableInventoryTracking||e?.disableQuantitySelector&&f>=1||"idle"!==h,P=t.createElement(Qm,null,t.createElement(Gm,{$isSmallScreen:u,ref:n},t.createElement(Ym,{ref:n,className:"yt-variant-selection-modal"},t.createElement("div",{className:"yt-variant-selection-modal "+(u?"small-screen":"large-screen")},t.createElement(qm,{onClick:()=>{o(void 0)},style:{backgroundColor:"white"}},t.createElement(ct,{size:"25"})),t.createElement("div",{className:"image-section"},t.createElement(t.Fragment,null,t.createElement("div",{onTouchStart:I,onTouchMove:D,onTouchEnd:_},t.createElement(Um,{small:Hh(B[s]?.url),medium:Hh(B[s]?.url),large:Hh(B[s]?.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:Hh(n?.url),alt:n.altText||`${k} - Image ${r+1}`,onClick:()=>p(r),className:s===r?"active":"",style:{width:"73px",height:"73px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...s===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),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(Qr,{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(Qr,{color:"gold",size:14})," ",r?.rating?.averageRating,t.createElement(Zn,{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(co,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"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(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:N?.5:1,cursor:N?"not-allowed":"pointer"},className:"yt-product-modal-atc-button",onClick:e=>{e.stopPropagation(),e.preventDefault(),E()},disabled:N},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}})))))),O=t.createElement(Qm,null,t.createElement(Gm,{style:{padding:"0px",position:"relative"},$isSmallScreen:u,ref:n},t.createElement(Ym,{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(so,{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:I,onTouchMove:D,onTouchEnd:_},t.createElement(Um,{small:Hh(B[s]?.url),medium:Hh(B[s]?.url),large:Hh(B[s]?.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:s===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:Hh(n?.url),alt:n.altText||`${k} - Image ${r+1}`,onClick:()=>p(r),className:s===r?"active":"",style:{width:"60px",height:"60px",cursor:"pointer",borderRadius:"7px",border:"1px solid lightgray",...s===r&&{border:`2px solid ${e.themeColor||"#111"}`},objectFit:"cover"},loading:"lazy"})))))),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(Qr,{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(Qr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Zn,{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(co,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"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(i?.compareAtPrice)),t.createElement("div",null,t.createElement("span",{style:{fontSize:"20px",fontWeight:"600",color:"#000",textAlign:"center",lineHeight:"normal"}},Wh(e.styles.general.currencySymbol,e.styles.general.currencySymbol),Vh(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(),E()},disabled:"idle"!==h},e.styles.byob.addToBundleCTAText||"Add to Bundle"))))));return v.createPortal(u?O:P,document.body)})),Xm=({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:Sn(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))}))),Km=({product:e,isOpen:n,onClose:r,variantOptions:o,cta:a,onConfirm:i,disableInventoryTracking:d})=>{const[s,p]=c((()=>{const t=e.variants.edges.find((e=>d||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?s.join(" / "):s[0])))?.node,g=f?.image?.url||e.featuredMedia?.preview?.image?.url,h=Sn(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=s[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(Xm,{options:y(n),selectedValue:b(n,r),onChange:e=>{((e,t)=>{const n=[...s];n[e]=t.name,p(n)})(r,e)},type:x(n.name),isOptionAvailable:t=>((t,n)=>{if(d)return!0;const r=[...s];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?s.join(" / "):s[0])))?.node,n=t&&(d||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:",s);const t=e.variants.edges.find((e=>d||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)},Jm=({coverImageUrl:e,mobileCoverImageUrl:n,alt:r="Background",styles:o})=>{const a=[{imageWidth:21,descriptor:36},{imageWidth:48,descriptor:80},{imageWidth:99,descriptor:165},{imageWidth:216,descriptor:360},{imageWidth:225,descriptor:375},{imageWidth:319,descriptor:533},{imageWidth:330,descriptor:550},{imageWidth:432,descriptor:720},{imageWidth:564,descriptor:940},{imageWidth:639,descriptor:1066},{imageWidth:648,descriptor:1080},{imageWidth:900,descriptor:1500},{imageWidth:1068,descriptor:1780},{imageWidth:1296,descriptor:2160}],i=(e,t)=>{if(e)try{const n=new URL(e),r=n.searchParams;return r.has("format")||r.set("format","webp"),r.has("quality")||r.set("quality","80"),r.set("width",t.toString()),n.toString()}catch{const n=e.includes("?")?"&":"?";return`${e}${n}format=webp&quality=80&width=${t}`}},l=e=>e?a.map((({imageWidth:t,descriptor:n})=>{const r=i(e,t);return r?`${r} ${n}w`:""})).filter(Boolean).join(", "):"";if(!e&&!n)return null;const c=e||n||"",d=i(c,800)||c,s=[];if(n&&n!==e){const e=l(n);e&&s.push(t.createElement("source",{key:"mobile",media:"(max-width: 768px)",srcSet:e}))}if(e){const n=l(e);n&&(s.length>0?s.push(t.createElement("source",{key:"desktop",media:"(min-width: 769px)",srcSet:n})):s.push(t.createElement("source",{key:"desktop",srcSet:n})))}else if(n){const e=l(n);e&&s.push(t.createElement("source",{key:"mobile",srcSet:e}))}return t.createElement("div",{style:{width:"100%",display:"block"}},t.createElement("picture",{style:{display:"block",width:"100%"}},s,t.createElement("img",{src:d,alt:r,style:{width:"100%",height:"auto",display:"block",...o},loading:"eager",fetchPriority:"high",sizes:"100vw"})))};function ef({quantity:e,setQuantity:n,remainingQuantity:r,handleAddToBundle:o,variantId:a,product:i,handleRemoveItem:l,hideAddToBundle:c,disableInventoryTracking:d,selectedVariantInventoryQty:s}){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=d||e<s;return t.createElement(mu,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(fu,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 tf=({product:e,styles:n,selectedVariant:r})=>{const[o,a]=c(!1),d=i((()=>Hh(r?.image?.url||e?.featuredMedia?.preview?.image?.url||e?.media?.edges?.[0]?.node?.image?.url)||""),[r?.image?.url,e?.featuredMedia?.preview?.image?.url,e?.media?.edges]),s=i((()=>e?.media?.edges?.map((e=>Hh(e?.node?.preview?.image?.url??e?.node?.image?.url))).filter(Boolean)??[]),[e?.media?.edges]),p=i((()=>s?.[1]??d??""),[s,d]);l((()=>{if(d){(new Image).src=d}}),[d]);const u=i((()=>d||s?.[0]),[d,s]);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",{loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"top",opacity:o&&u!==p?0:1,transition:s?.length>0?"opacity 300ms ease, transform 300ms ease":"",transform:o?"scale(1.1)":"scale(1)"},src:u,alt:e.title}),u!==p&&t.createElement("img",{loading:"lazy",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,objectPosition:"top"},src:p,alt:e.title})))},nf=({product:e,bundle:n,handleAddToBundle:r,hideAddToBundle:o,remainingQuantity:a,themeColor:i,handleRemoveItem:d,transitionActive:s,idx:p,selecteditems:u,customVariantsQuantity:m})=>{const f=qt(im),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),[E,k]=c(0),[T,S]=c(window.innerWidth<450),[$,B]=c("normal"),z=b?.find((e=>e?.node?.id===w))?.node,I=m&&m.length>0&&m.find((e=>e.variantId==z?.id))?.quantity||n.customProductsQuantity||z&&z?.inventoryQuantity;l((()=>{const e=u.find((e=>e.variantId===w));k(e?e.quantity:0)}),[E,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 D=e.variants&&e.variants.edges?.length>1&&"customOptions"!==h,_="undefined"!=typeof window?(window?.ytapp||window?.ytBundleApp)?.storeId:void 0,N="53933408435"===_,P="75851235630"===_,O=(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),A=O.length>0;return t.createElement(t.Fragment,null,t.createElement(xu,{borderRadius:g?.byob.borderRadius,borderColor:g?.byob.borderColor,shadowType:g?.byob.shadowType,backgroundColor:g?.byob.cardBackgroundColor,className:"bundle-builder-product-container "+(s?"yt-product-card-transition-active":p%2==0?"yt-product-card-transition":"yt-product-card-transition-up"),onClick:()=>{if(I<=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(yu,null,t.createElement(tf,{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),D&&t.createElement("div",{style:{position:"relative",width:"100%"}},t.createElement(bu,{isCoralHaze:N,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&&A&&t.createElement("div",{style:{padding:"2px 4px"}},t.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"}},O.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)))),O.length>2&&t.createElement("span",{style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",O.length-2," more"))),t.createElement(vu,{isMobile:T,showBorder:n?.showBorder??!0,style:{...!g?.byob.productsPriceVisibility&&{padding:"8px"},...g?.byob.productTitleFontSize&&{fontSize:g?.byob.productTitleFontSize}}},t.createElement("div",{style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:"normal"}},P?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(Qr,{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(Qr,{color:"gold",size:14})," ",e?.rating?.averageRating,t.createElement(Zn,{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,Wh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Vh(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"}},Wh(g.general.currencySymbol,n?.storeCurrencyCode)??"Rs.",Vh(z.compareAtPrice))),(I>0||!g?.general.trackInventory)&&t.createElement(wu,{borderRadius:g?.byob.borderRadius,className:"yt-product-atc-wrapper"},(0===E||void 0===E)&&t.createElement(gu,{style:{...!o&&{backgroundColor:g?.general.primaryColor||"#111",color:g?.general.primaryContrastColor||"#fff"}},disabled:o,onClick:t=>{t.stopPropagation(),t.preventDefault(),k(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&&E>0&&w&&t.createElement(hu,{className:"visible",style:{overflow:"hidden"}},t.createElement(ef,{remainingQuantity:a,setQuantity:k,quantity:E,handleAddToBundle:r,variantId:w,product:e,handleRemoveItem:d,hideAddToBundle:o,disableInventoryTracking:!g?.general.trackInventory,selectedVariantInventoryQty:I})),n?.disableQuantitySelector&&E>0&&w&&t.createElement(gu,{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(Cu,{className:"yt-product-atc-single-qty-selector-added"},"ADDED"),t.createElement(Eu,{onClick:e=>{e.stopPropagation();const t=Math.max(0,E-1);k(t),d&&w&&d(w,1)},className:"yt-product-atc-single-qty-selector-remove"},t.createElement(ao,{style:{color:"#fff",fontSize:"20px"}})))),I<=0&&g?.general.trackInventory&&t.createElement(gu,{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(Km,{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}))},rf=({currentStep:e,setCurrentProductTier:n,totalSteps:r,tiers:o,isMobile:a,selectedProductsByTier:i,primaryColor:l="#000",primaryTextColorCta:c="#fff",tierNavigation:d})=>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,s)=>{const p=s+1,u=o[s].minimumQuantity-(i[s]?.length??0)==0,m=s===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===d?()=>{}: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:s<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)),of=({isMobile:e,setSearchTerm:n,searchTerm:r,styles:o,setSortBy:a})=>{const[i,d]=c(!1),[s,p]=c(r);return l((()=>{const e=setTimeout((()=>{n(s)}),300);return()=>clearTimeout(e)}),[s,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(oo,{className:"yt-byob-search-icon",fontSize:"20px",color:"#555",style:{cursor:"pointer",lineHeight:"normal"},onClick:()=>d(!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:s,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(oo,{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:()=>d(!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)")))))},af=({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))))))},lf=({bundle:e,selectedItems:n,setSelectedItems:r,handleAddToCart:i,bundleAddToCartLoading:d,renderingOnPage:s,selectedItemsQuantity:p,handleRemoveItem:u,bundleSubtotal:m})=>{const[f,g]=c(void 0),[h,x]=c(window.innerWidth<450),[y,b]=c(0),[v,w]=c({}),C=e.builderTiers?.type,E=e.customizations,k=e.builderTiers?.productTier??[],T=e.builderTiers?.offerTier??[],[S,$]=c([]),[B,z]=c(!1),[I,D]=c("All"),[_,N]=c(0),P=o(null);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))))}})),$(Array.from(t)),z(n)}),[e.products]);const O=((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)),I),A="productTier"===C?k.reduce(((e,t)=>e+t.minimumQuantity),0):"offerTier"===C?T.reduce(((e,t)=>e+t.minimumQuantity),0):e.minimumQuantity,[F,M]=c(""),[R,L]=c(""),j=((e,t)=>e.filter((e=>e?.productDetails?.title?.toLowerCase().includes(t?.toLowerCase()))))(O,F),V=((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}})))(j,R),W=((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"),d=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-d;case"price-high-to-low":return d-c;default:return 0}})))(k,V,F,R,y),[H,U]=Qt(im),[q,Q]=c(!1),G="productTier"===C?W:V,Y=G.slice(0,20*(_+1));l((()=>{setTimeout((()=>{Q(!0)}),100)}),[]);const Z=o(null);l((()=>{const e=()=>{x(window.innerWidth<450)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(e.coverImageUrl){const t=new Image;t.src=Hh(e.coverImageUrl)??"",t.onload=()=>{g(t.width/t.height)}}}),[e.coverImageUrl]),l((()=>{Q(!1),setTimeout((()=>Q(!0)),100)}),[y]);const X=(e,t)=>{if("productTier"===C){let n={...v},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}}w(n);const o=k.findIndex(((e,t)=>n[t]?.length<e.minimumQuantity));-1!==o&&b(o)}u(e)};l((()=>{if("productTier"===C){const e=Object.fromEntries(k.map((e=>[e.tier,[]])));w(e)}}),[e]),l((()=>{if("productTier"!==C||!k[y])return;if(A===p)return;const e=k.findIndex(((e,t)=>{const n=v[t]||[];return t>=y&&n.length<e.minimumQuantity}));-1!==e&&e!==y&&(b(e),(()=>{const e=document.querySelector(".products-display");e&&e.scrollIntoView({behavior:"smooth"})})())}),[v,k,C]),l((()=>{M("")}),[y]),l((()=>{function e(e){if(!Z.current||!e.target)return;!Z.current.contains(e.target)&&U(void 0)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[]);const K=(e,t,o)=>{var a;"productTier"===C&&(a=e,w((e=>{const t={...e},n=k.findIndex(((e,n)=>{const r=t[n]||[];return n>=y&&r.length<e.minimumQuantity}));return-1!==n&&b(n),t[n]||(t[n]=[]),t[n].push(a),t}))),Uh(e,t,o,n,r)},J=(()=>{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})(),ee=h&&e.mobileCoverImageUrl?Hh(e.mobileCoverImageUrl):Hh(e.coverImageUrl??"")||null,te=e.customStoreDetails?.fixedInventoryDetails,ne=e=>{const t=E?.general?.showOutOfStockProducts;if(t||!E?.general.trackInventory)return!0;const n=e?.productDetails?.variants?.edges||[];if(te){if(n.some((e=>te.some((t=>t.variantId===e.node.id&&t.quantity>0)))))return!0}return n.some((e=>e.node.inventoryQuantity>0))},re="bundles"==e.appName?e.pageHeader?.title:e?.title,oe="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;l((()=>{N(0)}),[F,R,I,y]);const ae=a((()=>{Y.length<G.length&&N((e=>e+1))}),[Y.length,G.length]);return l((()=>{const e=new IntersectionObserver((([e])=>{e.isIntersecting&&ae()}),{threshold:.1});return P.current&&e.observe(P.current),()=>{P.current&&e.unobserve(P.current)}}),[ae]),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:E.byob.sectionBackgroundColor,..."transparent"!==E.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},ee?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}}},ee&&t.createElement(Jm,{coverImageUrl:ee,alt:"Background",styles:{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:E?.byob?.titleFontSize??"3rem",fontWeight:"700",color:E?.byob?.titleTextColor??"#000",marginBottom:"15px",backgroundColor:E?.byob?.titleBackgroundColor??"transparent",width:"100%",textAlign:"center"},className:"bundle-builder-title"},re),t.createElement("span",{style:{lineHeight:"normal",fontSize:E?.byob?.subtitleFontSize??"1.5rem",color:E?.byob?.titleTextColor??"#000"},className:"bundle-builder-subtitle"},oe))):(re||oe)&&t.createElement("div",{style:{zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",padding:"20px",width:"90%",maxWidth:"1000px"}},re&&t.createElement("span",{style:{lineHeight:"normal",fontSize:E?.byob?.titleFontSize??"3rem",fontWeight:"700",color:E?.byob?.titleTextColor??"#000",marginBottom:"15px",textAlign:"center",width:"100%",backgroundColor:E?.byob?.titleBackgroundColor??"transparent"}},re),oe&&t.createElement("span",{style:{lineHeight:"normal",fontSize:E?.byob?.subtitleFontSize??"1.5rem",color:E?.byob?.titleTextColor??"#000"}},oe)),t.createElement("div",{style:{fontSize:"20px",width:"100%"},className:"products-display"},"productTier"===C&&k.length>0&&E?.byob.productTiersVisibility&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(rf,{currentStep:y,totalSteps:k.length,tiers:k,isMobile:h,primaryColor:E?.general?.primaryColor,primaryTextColorCta:E?.general?.primaryContrastColor,setCurrentProductTier:b,selectedProductsByTier:v,tierNavigation:E.byob.tierNavigation})))),t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},e?.enableSortAndFilter&&t.createElement(of,{isMobile:h,searchTerm:F,setSearchTerm:M,setSortBy:L,styles:E}),e?.customizations?.byob?.enableProductCategories&&B&&t.createElement("div",null,t.createElement(af,{styles:E,isMobile:h,categories:S,activeCategory:I,onCategoryChange:e=>{D(e)}}))),t.createElement("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"12px",justifyContent:"center",width:"100%"},className:"products-display"},0===G?.length?t.createElement("p",{style:{fontSize:"20px",color:"#333",textAlign:"center",width:"100%"}},"No products found"):"productTier"===C&&k.length>0?Y.filter((e=>ne(V.find((t=>t.productId===e.productId&&(e.variantIds.length<1||t.variantIds.includes(e.variantIds[0]))))))).map(((r,o)=>{const a=(k[y]?.minimumQuantity??0)>(v[y]?.length??0),i=V.find((e=>e.productId===r.productId&&(r.variantIds.length<1||e.variantIds.includes(r.variantIds[0]))));return i?t.createElement(nf,{bundle:e,idx:o,key:r?.variantIds?.[0]??r.productId,product:i?.productDetails,handleAddToBundle:K,hideAddToBundle:!a,remainingQuantity:J-p,themeColor:e?.dealTextColor,handleRemoveItem:e=>X(e,y),selecteditems:n,transitionActive:q,customVariantsQuantity:te}):null})):Y.filter(ne).map(((r,o)=>t.createElement(nf,{bundle:e,idx:o,key:r.productId,product:r?.productDetails,handleAddToBundle:K,hideAddToBundle:p>=J,remainingQuantity:J-p,themeColor:e?.dealTextColor,handleRemoveItem:u,selecteditems:n,transitionActive:q,customVariantsQuantity:te}))),Y.length<G.length&&t.createElement("div",{ref:P,style:{height:"1px",width:"100%",display:"block"}})),!s&&t.createElement(am,{builderTiers:e?.builderTiers,handleAddToCart:i,minimumQuantity:A,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,handleRemoveItem:u,handleRemoveItemProductTier:X,selectedItemsQuantity:p,percentageOff:e.percentageOff,loading:d,bundleSubtotal:m,amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:e?.dealTextColor??"#333",primaryTextColorCta:e?.primaryTextColorCta??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:s})),s&&t.createElement(am,{handleAddToCart:i,minimumQuantity:A,builderTiers:e?.builderTiers,selectedProducts:n,showProductDetailsInTracker:e.showProductDetailsInTracker,loading:d,handleRemoveItem:u,handleRemoveItemProductTier:X,percentageOff:e.percentageOff,selectedItemsQuantity:p??0,bundleSubtotal:m??{price:0,compareAtPrice:0},amountOff:e.amountOff,styles:e.customizations,dealAmount:e.dealAmount,themeColor:E?.general.primaryColor||"#000",primaryTextColorCta:E.general.primaryContrastColor??"#fff",cornerRadiusType:e?.cornerRadiusType??"",selectedProductsByTier:v,renderingOnPage:s}),H&&void 0!==p&&(()=>{let r=p<e.minimumQuantity;return"productTier"==C?r=(k[y]?.minimumQuantity??0)>(v[y]?.length??0):"offerTier"==C&&(r=p<T.reduce(((e,t)=>e+t.minimumQuantity),0)),t.createElement(Zm,{handleAddToBundle:K,ref:Z,remainingQuantity:e.minimumQuantity-p,hideAddToBundle:!r,disableQuantitySelector:e?.disableQuantitySelector??!1,disableInventoryTracking:!e?.customizations.general.trackInventory,selectedProducts:n,themeColor:E?.general.primaryColor||"#000",primaryTextColorCta:e?.customizations?.general.primaryContrastColor??"#fff",primaryBackgroundColorCta:E?.general.primaryColor||"#000",cornerRadius:e?.customizations.byob.borderRadius,styles:e.customizations,reviewRatingType:e?.reviewRatingType??"none"})})())},cf=({product:e,selectedVariantId:n,onVariantChange:r,styles:o,originalPrice:a,dealPrice:l,isVertical:c=!1,variantOptions:d,storeCurrencyCode:s,trackInventory:p})=>{const u=e?.productDetails?.variants?.edges?.find((e=>e?.node?.id===n))?.node,m=i((()=>{if(u?.title&&e.productDetails.options){const t=u.title.split(" / ");if(t.length===e.productDetails.options.length)return t}return e.productDetails.options?.map((e=>e.values[0]))||[]}),[u,e.productDetails.options]),f=e=>{r(e)};return c?t.createElement("div",{className:"yt-comboBundle-product-card-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:"normal",width:"165px",backgroundColor:"#F6F6F6",borderRadius:"20px",border:"1px solid #B3B3B3",boxShadow:"4px 4px 0px -1px #00000033",overflow:"hidden"}},t.createElement("div",{className:"yt-comboBundle-product-card-image-container-vertical",style:{position:"relative",width:"100%"}},o.comboBundle.subProductsImageVisibility&&t.createElement(t.Fragment,null,t.createElement("img",{className:"yt-comboBundle-product-image-vertical",src:Hh(u?.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",{className:"yt-comboBundle-product-variant-selector-container-vertical",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",{className:"yt-comboBundle-product-variant-select-vertical",value:n,onChange:e=>f(e.target.value),style:{padding:"8px 10px",border:"1px solid #ddd",backgroundColor:"#fff",color:"#333",fontSize:"14px",width:"100%",appearance:"none",marginRight:"30px"},disabled:!!p&&e?.productDetails?.variants?.edges.every((e=>e.node.inventoryQuantity<=0))},e?.productDetails?.variants?.edges.map((e=>t.createElement("option",{key:e?.node?.id,value:e?.node?.id,disabled:!!p&&e.node.inventoryQuantity<=0,className:"yt-comboBundle-product-variant-option"},e?.node?.title)))),t.createElement("div",{className:"yt-comboBundle-product-variant-select-icon-vertical",style:{position:"absolute",right:"1px",top:"2px",bottom:"0px",pointerEvents:"none",backgroundColor:"#F3F3F3",width:"15%",height:"calc(100% - 4px)",display:"flex",justifyContent:"center",alignItems:"center"}},t.createElement(F,null)))))),(o.comboBundle.subProductsProductTitleVisibility||o.comboBundle.subProductsProductPriceVisibility)&&t.createElement("div",{className:"yt-comboBundle-product-info-container-vertical",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"40px",width:"100%",paddingBlock:"5px"}},o.comboBundle.subProductsProductTitleVisibility&&t.createElement("span",{className:"yt-comboBundle-product-title-vertical",style:{fontSize:"12px",color:"#333",fontWeight:"600",lineHeight:"normal",textAlign:"center",width:"fit-content"}},e?.productDetails?.title),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-container-vertical",style:{display:"flex",alignItems:"center",gap:"8px",lineHeight:"normal",fontSize:"14px"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-vertical",style:{lineHeight:"normal"}},Wh(o.general.currencySymbol,s),Vh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-vertical",style:{textDecoration:"line-through",color:"#999",lineHeight:"normal",fontSize:"12px"}},Wh(o.general.currencySymbol,s),Vh(u?.compareAtPrice?u?.compareAtPrice:u?.price))))):t.createElement("div",{className:"yt-comboBundle-product-card-horizontal",style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px",lineHeight:"normal",borderRadius:"8px",transition:"background-color 0.3s",width:"100%",border:"1px solid transparent",..."right"===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",{className:"yt-comboBundle-product-image-wrapper-horizontal"},t.createElement("img",{className:"yt-comboBundle-product-image-horizontal",src:Hh(u?.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",{className:"yt-comboBundle-product-info-horizontal",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",{className:"yt-comboBundle-product-title-horizontal",style:{fontSize:"14px",fontWeight:"600",lineHeight:"normal",display:"flex",alignItems:"center",gap:"8px"}},t.createElement("span",{className:"yt-comboBundle-product-title-text"}," ",e?.productDetails?.title," "),e.productDetails.variants.edges.length>1&&d&&m&&t.createElement("span",{className:"yt-comboBundle-product-variant-tag-horizontal",style:{fontSize:"10px",color:"#666",backgroundColor:"#F4F4F4",padding:"2px 8px",borderRadius:"10px",border:"1px solid #ddd"}},m.length>1?m.join(" / "):m)),o.comboBundle.subProductsProductPriceVisibility&&t.createElement("div",{className:"yt-comboBundle-product-price-wrapper-horizontal",style:{display:"flex",gap:"8px",marginTop:"5px",alignItems:"baseline"}},t.createElement("span",{className:"yt-comboBundle-product-deal-price-horizontal",style:{lineHeight:"normal"}},Wh(o.general.currencySymbol,s),Vh((Number(u?.compareAtPrice?Number(u?.compareAtPrice):u?.price)/Number(a)*Number(l)).toFixed(2))),u?.compareAtPrice&&t.createElement("span",{className:"yt-comboBundle-product-original-price-horizontal",style:{textDecoration:"line-through",color:"#999",fontSize:"14px",lineHeight:"normal"}},Wh(o.general.currencySymbol,s),Vh(u?.compareAtPrice?u?.compareAtPrice:u?.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,className:"yt-comboBundle-product-option-group-horizontal",style:{...n?.values?.length>1&&{marginTop:"10px"},display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"}},e.productDetails.options.length>1&&n?.values?.length>1&&t.createElement("label",{className:"yt-comboBundle-product-option-label",style:{fontSize:"12px",fontWeight:"500",color:"#333"}},n.name,":"),n?.values?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-option-values-horizontal",style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"}},n.values.map((a=>{const i=[...m];i[r]=a;const l=e.productDetails.options.length>0?i.join(" / "):i[r],c=e.productDetails.variants.edges.find((e=>e.node.title===l))?.node,s=!!p&&(!c||c.inventoryQuantity<=0),u=m[r]===a,g=d&&d?.options?.find((e=>e.name===n.name));return g&&"color"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-color ${u?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&f(c.id)},disabled:s,style:{borderRadius:"50%",padding:"1px",backgroundColor:"white",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid transparent",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"}},g?.values.find((e=>e.name===a))?.value?t.createElement("div",{className:"yt-comboBundle-product-option-color-swatch",style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",borderRadius:"50%",backgroundColor:g?.values.find((e=>e.name===a))?.value}},t.createElement("span",null)):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):g&&"image"===g?.type?t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-image ${u?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&f(c.id)},disabled:s,style:{border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:u&&!s?"#F7F7F7":"transparent",cursor:s?"not-allowed":"pointer",padding:"0px",width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",overflow:"hidden",opacity:s?.5:1}},g?.values.find((e=>e.name===a))?.value?t.createElement("img",{className:"yt-comboBundle-product-option-image",src:Hh(g?.values.find((e=>e.name===a))?.value||"/placeholder.svg"),alt:a,style:{width:u&&!s?"26px":"24px",height:u&&!s?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}}):t.createElement("span",{key:a,className:"yt-comboBundle-product-option-text",style:{padding:"4px 8px",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",fontSize:"10px",fontWeight:"600"}},a)):t.createElement("button",{key:a,className:`yt-comboBundle-product-option-button-text ${u?"yt-comboBundle-product-option-button-selected":""} ${s?"yt-comboBundle-product-option-button-disabled":""}`,onClick:()=>{!s&&c&&f(c.id)},disabled:s,style:{padding:"4px 8px",border:u&&!s?`1px solid ${o.general?.ctaBackgroundColor}`:s?"1px solid #ccc":"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:u&&!s?"#F7F7F7":"transparent",color:s?"#ccc":"#707070",cursor:s?"not-allowed":"pointer",fontSize:"10px",fontWeight:"600",opacity:s?.5:1}},a)}))))))):t.createElement(t.Fragment,null,e?.productDetails?.variants?.edges?.length>1&&t.createElement("div",{className:"yt-comboBundle-product-variant-buttons-horizontal",style:{display:"flex",gap:"8px",flexWrap:"wrap",lineHeight:"normal",marginTop:"10px"}},e?.productDetails?.variants?.edges.map((e=>t.createElement("button",{key:e?.node?.id,className:`yt-comboBundle-product-variant-button ${n===e?.node?.id?"yt-comboBundle-product-variant-button-selected":""} ${e.node.inventoryQuantity<=0?"yt-comboBundle-product-variant-button-disabled":""}`,onClick:()=>f(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)))))))},df=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[a,d]=c(window.innerWidth<786);l((()=>(n&&(window.ytComboBundle={bundle:e,addToCart:n},window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:window.ytComboBundle}))),()=>{window.ytComboBundle=void 0,window.dispatchEvent(new CustomEvent("yt-combo-bundle-updated",{detail:void 0}))})),[e,n]);const[s,p]=c((()=>{const t={};return e.products.forEach(((n,r)=>{const o=e?.customizations?.general?.trackInventory?n.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node:n.productDetails?.variants?.edges?.[0]?.node;t[r]=o?o.id:n?.productDetails?.variants?.edges[0]?.node?.id})),t})),u=e.products?.filter((e=>e?.productDetails?.variants?.edges.some((e=>e?.node?.inventoryQuantity>0))))||[],m=!e.customizations.general.trackInventory||Object.keys(s).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(s).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)}}),[s,e.products,e.percentageOff,e.dealAmount,e.amountOff]);l((()=>{const e=()=>{d(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,E="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement("div",{className:`yt-comboBundle-bundle-container ${"left"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-left":"right"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-right":"center"===y.comboBundle?.infoAlignment?"yt-comboBundle-bundle-align-center":void 0}`,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",{className:"yt-comboBundle-bundle-title-container",style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"10px"}},t.createElement("h2",{className:"yt-comboBundle-bundle-title",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",{className:"yt-comboBundle-bundle-price-container",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",{className:"yt-comboBundle-bundle-price-details",style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"}},t.createElement("span",{className:"yt-comboBundle-bundle-deal-price-text",style:{fontWeight:"bold",lineHeight:"1",minWidth:"fit-content"}},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(h)),t.createElement("div",{className:"yt-comboBundle-bundle-original-price-text",style:{color:y.comboBundle?.titleTextColor||"#666",textDecoration:"line-through",verticalAlign:"middle",display:"inline-block",minWidth:"fit-content"}},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(g)),t.createElement("span",{className:"yt-comboBundle-bundle-offer-badge",style:{backgroundColor:"#D3122A",color:"white",padding:"4px 8px",fontSize:"14px",borderRadius:"20px",fontWeight:"500",lineHeight:"1",minWidth:"fit-content"}},e?.percentageOff?`${e?.percentageOff}% Off`:e?.amountOff?`${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(e?.amountOff)} Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(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",{className:"yt-comboBundle-products-grid-vertical "+(a?"yt-comboBundle-products-grid-mobile":""),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===s[r]))?.node;return o?t.createElement(cf,{key:`combo-product-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:s[r],onVariantChange:e=>f(r,e),isVertical:v,variantOptions:e.variantOptions,storeCurrencyCode:e.storeCurrencyCode,trackInventory:e?.customizations?.general?.trackInventory}):null}))):t.createElement("div",{className:"yt-comboBundle-products-list-horizontal "+(a?"yt-comboBundle-products-list-mobile":""),style:{display:"flex",flexDirection:"column",gap:"10px",width:"100%"}},y.comboBundle.subProductsSectionVisibility&&e.products.map(((n,r)=>t.createElement(cf,{key:`combo-product-horizontal-${r}-${n.productId}`,product:n,styles:y,originalPrice:g,dealPrice:h,selectedVariantId:s[r],onVariantChange:e=>f(r,e),variantOptions:e.variantOptions,trackInventory:e?.customizations?.general?.trackInventory}))))),t.createElement("div",{className:"yt-comboBundle-bundle-cta-section",style:{borderTop:"1px solid #eee",display:"flex",flexDirection:"column",rowGap:"5px",marginTop:"20px",width:"100%"}},t.createElement("button",{className:`yt-comboBundle-bundle-cta-button ${m?"":"yt-comboBundle-bundle-cta-button-disabled"} ${a?"yt-comboBundle-bundle-cta-button-mobile":""}`,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 console.error("[ComboBundle.tsx] No addToCartFunction available"),void o(!1);const t=Object.entries(s).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(s);await n(Number(g),r,Number(h),t)}catch(e){console.error("[ComboBundle.tsx] Error adding to cart:",e)}o(!1)}},r?t.createElement(Yo,{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",{className:"yt-comboBundle-bundle-description-section",style:{margin:"20px 0px"}},t.createElement("h4",{className:"yt-comboBundle-bundle-description-header",style:{fontSize:"16px",color:y.comboBundle?.descriptionTextColor||"#000",lineHeight:"1.2",margin:0,padding:"8px",backgroundColor:y.general.primaryColor+"20"}},"Description"),t.createElement("div",{className:"yt-comboBundle-bundle-description-content",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,E))))},sf=x.div`
3541
3541
  max-width: 800px;
3542
3542
  container-type: inline-size;
3543
3543
  margin-top: ${e=>e.verticalMargin||"0px"};
@@ -3883,7 +3883,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
3883
3883
  scrollbar-width: none;
3884
3884
 
3885
3885
  -ms-overflow-style: none;
3886
- `,Rf=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function Lf({bundle:e,addToCartFunction:n,currentProductId:r}){const d=i((()=>{if(r){const t="gid://shopify/Product/"+r,n=e.products?.some((e=>e.productId===t));return n?t:e.products?.[0]?.productId}return e.products?.[0]?.productId}),[r,e.products]),s=i((()=>Rf(d,e.products)),[d,e.products]),p=o(null),u=o(null),m=o({});document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[f,g]=c(0),[h,x]=c(""),y=e.customizations??{},b=!1===y?.general?.showDecimalsInBundlePricing,v=s?.productDetails?.tracksInventory,w=(i((()=>s?.productDetails?.variants?.edges?.reduce(((e,{node:t})=>!s?.productDetails?.tracksInventory||t.inventoryQuantity>0?e+=1:e),0)),[s,v]),i((()=>Rf(d,e.products)?.id),[d,e.products]));i((()=>w?Rf(d,e.products):void 0),[d,e.products,w]),i((()=>e.products?.some((e=>e.productDetails?.options?.some((e=>e.values.length>1))))||!1),[e.products]),y.volumeBundle;const C=i((()=>e?.volumeTiers||[]),[e?.volumeTiers]),E=C.findIndex((e=>e.isDefault)),[k,T]=c(-1!==E?C[E].tier:C?.[0]?.tier||1),[S,$]=c(s?.productDetails?.variants?.edges?.find((e=>!s?.productDetails?.tracksInventory||e?.node?.inventoryQuantity>0))?.node?.id||s?.productDetails?.variants?.edges?.[0]?.node?.id||""),[B,z]=c({}),[I,D]=c(C.reduce(((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},(()=>s?.productDetails?.options?.map((e=>e.values[0]))||[])),e)),{})||{}),[_,N]=c(!1),[P,O]=c(window.innerWidth<550),[A,F]=c(null),[M,R]=c(null);o([]);const L=o([]),j=o(k);l((()=>{const e=()=>{O(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{const e=e=>{A&&L.current[A.index]&&L.current[A.index][A.optionIndex]&&!L.current[A.index][A.optionIndex]?.contains(e.target)&&F(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[A]);const V=a((e=>{if(!v)return null;const t=C.find((t=>t.tier===e));if(!t)return null;const n=t.minimumQuantity,r=s?.productDetails?.variants?.edges||[];for(const e of r){const t=e.node;if(t.inventoryQuantity>=n&&t.availableForSale){const e=t.title.split(" / ");return Array(n).fill(e)}}const o=[],a={},i=[...r].sort(((e,t)=>t.node.inventoryQuantity-e.node.inventoryQuantity));for(let e=0;e<n&&o.length<n;e++){let e=!1;for(const t of i){const n=t.node,r=a[n.id]||0;if(n.inventoryQuantity>r&&n.availableForSale){const t=n.title.split(" / ");o.push(t),a[n.id]=r+1,e=!0;break}}if(!e)return null}return o.length===n?o:null}),[s,C,v]),W=a((e=>{if(!v)return!0;const t=C.find((t=>t.tier===e));if(!t)return!1;const n=t.minimumQuantity,r=s?.productDetails?.variants?.edges||[];let o=0;for(const e of r){const t=e.node;t.availableForSale&&(o+=Math.max(0,t.inventoryQuantity))}return o>=n}),[v,C,s]);l((()=>{const e={},t=s?.productDetails?.variants?.edges?.find((e=>!v||e?.node?.inventoryQuantity>0))?.node?.id||s?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&C.forEach((n=>{e[n.tier]={};for(let r=0;r<n.minimumQuantity;r++)e[n.tier][r]=t})),z(e)}),[s?.id,C?.map((e=>`${e.tier}-${e.minimumQuantity}`)).join("|"),v]),l((()=>{if(!m.current[k]){const e=V(k);if(e){const t=k-1;D((n=>({...n,[t]:e})));const n={};e.forEach(((e,t)=>{const r=e.join(" / "),o=s?.productDetails?.variants?.edges?.find((e=>e.node.title===r))?.node.id||S;n[t]=o})),z((e=>({...e,[k]:n})))}m.current[k]=!0}}),[k,s,S,V]);const H=(e,t)=>e?.productDetails?.variants?.edges?.find((e=>e.node.id===t))?.node,U=a(((e,t,n,r,o)=>{if(!v)return!0;const a=C.find((t=>t.tier===e));if(!a)return!1;const i=a.minimumQuantity,l=[...n];l[r]=o;const c=l.join(" / "),d=s?.productDetails?.variants?.edges?.find((e=>e.node.title===c))?.node;if(!d||!d.availableForSale||d.inventoryQuantity<=0)return!1;const p={},u=B[e]||{};for(let e=0;e<i;e++){let n;if(e===t)n=d.id;else{const t=u[e]||S,r=H(s,t);if(!r)return!1;n=r.id}p[n]=(p[n]||0)+1}for(const[e,t]of Object.entries(p)){const n=H(s,e);if(n&&t>n.inventoryQuantity)return!1}return!0}),[v,C,s,I,I,B,S]),q=a((e=>{if(!v)return!0;const t=C.find((t=>t.tier===e));if(!t)return!1;const n=t.minimumQuantity,r=e-1,o={};for(let e=0;e<n;e++){const t=(I[r]?.[e]||s.productDetails.options.map((e=>e.values[0]))).join(" / "),n=s?.productDetails?.variants?.edges?.find((e=>e.node.title===t));if(!n)return!1;const a=n.node.id;o[a]=(o[a]||0)+1}for(const[e,t]of Object.entries(o)){const n=H(s,e);if(t>(n?.inventoryQuantity??0))return!1}return!0}),[v,C,s,I]);l((()=>{g((e=>e+1))}),[B]);const Q=(e,t,n)=>{z((r=>({...r,[e]:{...r[e]||{},[t]:n}})))},G=a((()=>v&&s?.productDetails?.variants?.edges?.find((e=>e.node.inventoryQuantity>0))?.node||s?.productDetails?.variants?.edges?.[0]?.node),[s,v]),Y=a((()=>new URLSearchParams(window.location.search).get("variant")||""),[]);l((()=>{j.current=k}),[k]),l((()=>{M?(R(null),Z()):Z()}),[k]),l((()=>{if(e){const e=G();if(e)x(e.id),$(e.id);else{const e=s?.productDetails?.variants?.edges?.[0]?.node?.id||"";x(e),$(e)}}}),[e,s,G]);const Z=()=>{const e=Y();if(e){const t=s?.productDetails?.variants?.edges?.find((t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e)));let n=t?.node;if(n)$(String(n.id)),g((e=>e+1));else{const e=G();e&&($(String(e.id)),n=e),g((e=>e+1))}if(n){!n.availableForSale||n.inventoryQuantity<=0?(R(null),setTimeout((()=>{R({tier:j.current,index:0,optionIndex:0,value:n.title})}),0)):M&&R(null)}}};l((()=>{Z();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,r=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(r.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",Z),()=>{t=!1,window.removeEventListener("urlChange",Z),window.history.pushState=n,window.history.replaceState=r}}),[Y,s?.id,G]);const X=t=>{const n=C.find((e=>e.tier===t));if(!n)return{original:0,discounted:0};let r=0,o=0;const a=B[t]||{};for(let e=0;e<n.minimumQuantity;e++){const t=a[e]||S,n=H(s,t);n&&(n.compareAtPrice?r+=Number.parseFloat(n.compareAtPrice):r+=Number.parseFloat(n.price),o+=Number.parseFloat(n.price))}return"percentOff"===e?.discountType?o*=1-n.discountValue/100:"amountOff"===e?.discountType&&(o-=n.discountValue),o<0&&(o=0),{original:r,discounted:o,discountValue:n.discountValue}},K=(e,t,n,r)=>{let o=H(e,t);if(r){const a=B[r]?.[n||0]||t;o=H(e,a)}return o?.image?.url?o.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""};function J(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}l((()=>{const e=()=>{if("shopify_atc_button"!==y.volumeBundle?.addtoCartMethod&&"06cf02-81.myshopify.com"!==window.ytBundleApp?.storeDomain)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let n=1;t&&t.value&&(n=parseInt(t.value,10)||1);const r=C.find((e=>e.tier===k));if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"]').forEach((e=>e.remove()));const o=r.minimumQuantity;let a={};const i=Math.max(o,n);if("vertical"===y.volumeBundle.cardStyle){const e=h||S;if(!e)return;a[e]=i}else if(n>o){const e=h||S;if(!e)return;a[e]=i}else{const e=B[r.tier]||{};for(let t=0;t<o;t++){let n=e[t];n||(n=S),n&&(a[n]=(a[n]||0)+1)}}const l=X(r.tier),c=Object.fromEntries(Object.entries(a).map((([e,t])=>[J(e),Math.round(t)]))),d=(t,n,r="bundle-input-field")=>{const o=document.createElement("input");o.type="hidden",o.name=t,o.value=n,o.className=r,e.appendChild(o)};if(n>o){const e=h||S;e&&d("id",J(e))}d("properties[_bundle_price]",String(l.original)),d("properties[_bundle_tier]",String(r.tier)),d("properties[_bundle_items]",JSON.stringify(c));let s=0;Object.entries(c).forEach((([e,t])=>{t>0&&(d(`items[${s}][id]`,e),d(`items[${s}][quantity]`,String(t)),s++)})),requestAnimationFrame((()=>{const t=e.querySelector('[type="submit"]'),r=e.querySelector('[name="checkout"]'),a=e.querySelector(".noti-btn-main-wrap"),i=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const r=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");r&&(r.textContent=n)};n<=o&&(M?(i(t,!0,"Sold out"),i(r,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),a&&(a.style.display="block",a.classList.remove("hidden"),a.classList.add("block"))):(i(t,!1,"Add to cart"),i(r,!1,"Buy it now"),t&&t.classList.remove("btn--sold-out","hidden"),a&&(a.style.display="none",a.classList.add("hidden"))))}))};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame((()=>{e()}))};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}}),[k,JSON.stringify(B),S,y.volumeBundle?.cardStyle,r,h,M]);const ee=i((()=>C.find((e=>e.tier===k))),[C,k]),te=i((()=>ee?X(ee.tier):null),[ee,B,S]),ne=i((()=>{if(!ee||!te)return;const e=B[ee.tier]||{},t={};for(let n=0;n<ee.minimumQuantity;n++){const r=e[n]||S;t[r]=(t[r]||0)+1}return t}),[ee?.minimumQuantity,S,B,te]),re=i((()=>Object.entries(ne??{}).map((([e,t])=>({variantId:e,quantity:t})))),[ne]);if(l((()=>{if(!ee||!te)return;const e={tier:k,items:ee.minimumQuantity,discountedPrice:te.discounted,originalPrice:te.original,variants:re,productId:s?.id??null,tierMeta:{title:ee.title,subtitle:ee.subtitle,badgeTitle:ee.badgeTitle},productData:s,tierData:ee},t=u.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(p.current&&clearTimeout(p.current),p.current=window.setTimeout((()=>{u.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t)}),50),()=>{p.current&&clearTimeout(p.current)})}),[k,ee?.tier,ee?.minimumQuantity,te?.discounted,te?.original,s?.id,JSON.stringify(re)]),l((()=>{if(!S||!ee)return;const e=H(s,S);if(!e)return;const t={};for(let e=0;e<ee.minimumQuantity;e++)t[e]=S;z((e=>({...e,[k]:{...t}})));const n=e.title.split(" / "),r=Array.from({length:ee.minimumQuantity},(()=>[...n]));D((e=>({...e,[k-1]:r})))}),[S,k,s,ee]),!n)return t.createElement(t.Fragment,null);const oe=y.volumeBundle?.cardStyle,ae=y.general?.primaryColor,ie=y.general?.secondaryColor,le=y.general.primaryContrastColor,ce=y.general.secondaryContrastColor,de="high"===e.cornerRadiusType?"20px":"medium"===e.cornerRadiusType?"6px":"0px",se="bundles"==e.appName?e.pageHeader?.title:e?.title,pe="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return l((()=>{q(k)&&M?.tier===k&&R(null)}),[k,re,q,M]),t.createElement(sf,{verticalMargin:y.volumeBundle?.verticalMargin,$backgroundColor:y.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},t.createElement(pf,{className:"yt-bundle-header"},se&&se.trim().length>0&&t.createElement(uf,{fontSize:y.volumeBundle?.titleFontSize,$backgroundColor:y.volumeBundle?.titleBackgroundColor,textColor:y.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},se),t.createElement(mf,{className:"yt-bundle-header-subtitle",fontSize:y.volumeBundle?.subtitleFontSize},pe)),"vertical"===oe?t.createElement("div",{style:{display:"grid",gridTemplateColumns:P||4===C.length?"repeat(2, 1fr)":C.length>4?"repeat(3, 1fr)":`repeat(${C.length}, 1fr)`,justifyItems:"center",gap:P?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},C.map((n=>{const r=X(n.tier),o=r.original-r.discounted,a=k===n.tier,i=!W(n.tier);return t.createElement(t.Fragment,{key:n.tier},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:de||"24px",...a?{border:`2px solid ${ae}`}:{border:`1px solid ${ie}`},boxShadow:`6px 6px 0px -1px ${a?ae:ie}20`,...n.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(a?"yt-volume-vertical-tier-item-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),onClick:()=>!i&&T(n.tier)},n.badgeTitle&&t.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:a?ae:ie,color:a?le:ce,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:a?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},0!==r.discountValue&&t.createElement(t.Fragment,null,P&&o>0&&!!r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},t.createElement(yf,{primaryBackgroundColorCta:a?ae:ie,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?le:ce},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(r.discountValue)}`))),n.imageUrl&&t.createElement("img",{src:Hh(n.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:de||"24px",borderTopRightRadius:de||"24px"},className:"yt-volume-vertical-tier-badge"})),t.createElement("div",{style:{padding:"8px",paddingTop:"0"}},t.createElement(bf,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},t.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},t.createElement(vf,{style:{fontSize:P?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),!P&&o>0&&!!r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility&&t.createElement(yf,{primaryBackgroundColorCta:a?ae:ie,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?le:ce},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(r.discountValue)}`),a&&n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ae,color:le,padding:"2px"}},t.createElement(no,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),t.createElement(wf,{style:{lineHeight:"normal",fontSize:P?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null))),t.createElement(Cf,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":n.tier,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),"data-savings":o.toFixed(b?0:2)},t.createElement(Ef,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.discounted.toFixed(b?0:2))),o>0?t.createElement(kf,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.original.toFixed(b?0:2))):"")),a&&!n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:ae,color:le,padding:"2px"}},t.createElement(no,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))}))):t.createElement(t.Fragment,null,C.map((n=>{const r=X(n.tier),o=r.original-r.discounted,a=!W(n.tier);return t.createElement(t.Fragment,{key:n.tier},n.badgeTitle&&t.createElement(ff,{primaryTextColorCta:le,primaryBackgroundColorCta:ae,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement(gf,{cornerRadiusType:e?.cornerRadiusType??"",key:n.tier,primaryBackgroundColorCta:ae??"",isSelected:k===n.tier,onClick:()=>T(n.tier),style:{borderRadius:de,cursor:"pointer",backgroundColor:a?"#f5f5f5":"white",opacity:a?.6:1},className:"yt-volume-horizontal-tier-container "+(k===n.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2)},t.createElement(hf,{cornerRadiusType:e?.cornerRadiusType??"",style:{borderRadius:de,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},t.createElement(xf,{className:"yt-volume-horizontal-tier-info"},t.createElement(zf,{"data-active":k===n.tier,accentColor:ae,className:"yt-volume-horizontal-tier-radio-wrapper"},t.createElement(If,{name:"tier",checked:k===n.tier,onChange:()=>!a&&T(n.tier),disabled:a,className:"yt-volume-horizontal-tier-radio-hidden"}),t.createElement(Df,{accentColor:ae,className:"yt-volume-horizontal-tier-radio-custom"})),t.createElement(bf,{className:"yt-volume-horizontal-tier-details"},t.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},t.createElement(vf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),o>0&&r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility?t.createElement(yf,{primaryBackgroundColorCta:ae,isSelected:k===n.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(r.discountValue)}`):""),t.createElement(wf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null)))),t.createElement(Cf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":n.tier,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),"data-savings":o.toFixed(0)},o>0?t.createElement(kf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.original.toFixed(b?0:2))):"",t.createElement(Ef,{className:"yt-volume-horizontal-tier-discounted-price"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.discounted.toFixed(b?0:2))))),k===n.tier&&t.createElement(Tf,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:s.productDetails.variants.edges.length<=1?"0":"10px 15px",gap:s.productDetails.variants.edges.length<=1?"0":"10px"}},Array.from({length:n.minimumQuantity}).map(((r,o)=>{const i=n.tier-1,l=(I[i]||[])[o]||s.productDetails.options?.map((e=>e.values[0]))||[],c=s?.productDetails?.options.some((e=>e.values.length>1));return t.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&t.createElement(_f,{src:Hh(K(s,S,o,n.tier)),alt:s?.productDetails?.title||"Product",className:"yt-volume-horizontal-tier-product-image"}),"auto"===y?.volumeBundle?.variantSelectorType?t.createElement("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"}},s?.productDetails?.options?.map(((r,d)=>{if(!c)return null;const p=A?.tier===n.tier&&A?.index===o&&A?.optionIndex===d,u=e?.variantOptions?.options?.find((e=>e.name===r.name));let m="";return"color"===u?.type&&(m=u?.values?.find((e=>e.name===l[d]))?.value||""),t.createElement(Af,{key:d,ref:e=>{L.current[o]||(L.current[o]=[]),L.current[o][d]=e},style:{zIndex:p?1e3:"auto",display:"flex"},isActive:p},t.createElement(Ff,{onClick:e=>{e.stopPropagation(),F(p?null:{tier:n.tier,index:o,optionIndex:d})},isActive:p,disabled:a},"color"===u?.type&&m&&t.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[d],t.createElement(Ur,null)),p&&t.createElement(Mf,{style:{zIndex:1001}},r.values.map(((e,r)=>{const c=[...l];c[d]=e;const p=!U(n.tier,o,l,d,e)||a;s.productDetails.variants.edges.find((({node:e})=>e.title===c.join(" / ")));const m=t=>{if(t.preventDefault(),t.stopPropagation(),D((e=>{const t={...e},n=[...t[i]||[]];return n[o]=c,t[i]=n,t})),p){R({tier:k,index:o,optionIndex:d,value:e}),F(null);const t=c.join(" / "),r=s.productDetails.variants.edges.find((e=>e.node.title===t))?.node.id||S;return void Q(n.tier,o,r)}const r=c.join(" / "),a=s.productDetails.variants.edges.find((e=>e.node.title===r))?.node.id||S;Q(n.tier,o,a),F(null)},f=u?.values.find((t=>t.name===e));return"image"===u?.type&&f?.value?t.createElement(Nf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Pf,{src:f.value,alt:e}),e):"color"===u?.type&&f?.value?t.createElement(Nf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Of,{style:{backgroundColor:f.value}}),e):t.createElement(Nf,{key:e,onClick:m,style:{cursor:"pointer"}},e)}))))}))):t.createElement(Sf,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},s?.productDetails?.options.map(((r,c)=>{if(!(r.values.length>1))return null;const d=e.variantOptions?.options?.find((e=>e.name===r.name))||null;return t.createElement("div",{key:r.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},r.values.map((e=>{const r=l[c]===e,p=!U(n.tier,o,l,c,e)||a,u=d?.values.find((t=>t.name===e)),m=t=>{if(t.preventDefault(),t.stopPropagation(),p)return;const r=[...l];r[c]=e,D((e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t}));const a=r.join(" / "),d=s.productDetails.variants.edges.find((e=>e.node.title===a))?.node.id||S;Q(n.tier,o,d)},f={opacity:p?.5:1,cursor:p?"not-allowed":"pointer"};return"color"===d?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button",disabled:p},t.createElement("div",{style:{width:r?"24px":"20px",height:r?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},t.createElement("span",null))):"image"===d?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:r?"#F7F7F7":"transparent",padding:"0px",width:r?"20px":"18px",height:r?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button",disabled:p},t.createElement("img",{src:u.value,alt:e,style:{width:r?"26px":"24px",height:r?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):t.createElement($f,{key:e,isSelected:r,onClick:m,style:{...f,padding:"4px 8px",border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:r?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default",disabled:p},e)}))))}))))}))),M&&M.tier===n.tier&&t.createElement("div",{style:{color:ae,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${ae}1A`,padding:"12px",borderBottomLeftRadius:de,borderBottomRightRadius:de}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))}))),e?.showCta&&(!y.volumeBundle?.addtoCartMethod||"shopify_atc_button"!==y.volumeBundle?.addtoCartMethod)&&!("devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"06cf02-81.myshopify.com"===window.ytBundleApp?.storeDomain)&&t.createElement("div",{style:{position:"relative"}},t.createElement(Bf,{bgColor:q(k)?y.general?.ctaBackgroundColor:"#ccc",textColor:q(k)?y.general?.ctaTextColor:"#666",border:`1px solid ${q(k)?y.general?.ctaBorderColor||"#121212":"#999"}`,shadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,hoverProperties:{customizeHoverState:!!q(k)&&y.general?.customizeHoverState,backgroundColor:y.general?.ctaHoverBackgroundColor,textColor:y.general?.ctaHoverTextColor},onClick:async()=>{if(q(k))try{N(!0);const e=C.find((e=>e.tier===k));if(!e)return;const t={},r=B[e.tier]||{};for(let n=0;n<e.minimumQuantity;n++){const e=r[n]||S;t[e]?t[e].quantity+=1:t[e]={quantity:1}}const o=X(e.tier),a=Array.from({length:e.minimumQuantity},((e,t)=>r[t]||S));n&&await n(o.original,a)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{N(!1)}else console.error("Selected tier is out of stock")},borderRadius:y.general.ctaBorderRadius??"",disabled:_||!q(k),className:"yt-volume-add-to-cart-button"},q(k)?t.createElement(t.Fragment,null,_?t.createElement(Yo,{color:"white",loading:_,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},t.createElement("span",null,y.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",t.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const n=X(k);return t.createElement(t.Fragment,null,Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(n.discounted.toFixed(b?0:2))," ",n?.original!==n.discounted&&t.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(n?.original.toFixed(b?0:2))," "))})()))):t.createElement(t.Fragment,null,"Out of Stock"))))}const jf=x.div`
3886
+ `,Rf=(e,t)=>{if(!t)return{};for(const n of t)if(n.productId==e)return n;return{}};function Lf({bundle:e,addToCartFunction:n,currentProductId:r}){const d=i((()=>{if(r){const t="gid://shopify/Product/"+r,n=e.products?.some((e=>e.productId===t));return n?t:e.products?.[0]?.productId}return e.products?.[0]?.productId}),[r,e.products]),s=i((()=>Rf(d,e.products)),[d,e.products]),p=o(null),u=o(null),m=o({});document.querySelector("#ProductSelect-product-template"),document.querySelector('form[action="/cart/add"]');const[f,g]=c(0),[h,x]=c(""),y=e.customizations??{},b=!1===y?.general?.showDecimalsInBundlePricing,v=(i((()=>s?.productDetails?.variants?.edges?.reduce(((e,{node:t})=>t.inventoryQuantity>0?e+=1:e),0)),[s]),i((()=>Rf(d,e.products)?.id),[d,e.products]));i((()=>v?Rf(d,e.products):void 0),[d,e.products,v]),i((()=>e.products?.some((e=>e.productDetails?.options?.some((e=>e.values.length>1))))||!1),[e.products]),y.volumeBundle;const w=i((()=>e?.volumeTiers||[]),[e?.volumeTiers]),C=w.findIndex((e=>e.isDefault)),[E,k]=c(-1!==C?w[C].tier:w?.[0]?.tier||1),[T,S]=c(s?.productDetails?.variants?.edges?.[0]?.node?.id||""),[$,B]=c({}),[z,I]=c(w.reduce(((e,t,n)=>(e[t.tier-1]=Array.from({length:t.minimumQuantity},(()=>s?.productDetails?.options?.map((e=>e.values[0]))||[])),e)),{})||{}),[D,_]=c(!1),[N,P]=c(window.innerWidth<550),[O,A]=c(null),[F,M]=c(null);o([]);const R=o([]),L=o(E);l((()=>{const e=()=>{P(window.innerWidth<550)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{const e=e=>{O&&R.current[O.index]&&R.current[O.index][O.optionIndex]&&!R.current[O.index][O.optionIndex]?.contains(e.target)&&A(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[O]);const j=a((e=>{if(!y.general?.trackInventory)return null;const t=w.find((t=>t.tier===e));if(!t)return null;const n=t.minimumQuantity,r=s?.productDetails?.variants?.edges||[];for(const e of r){const t=e.node;if(t.inventoryQuantity>=n&&t.availableForSale){const e=t.title.split(" / ");return Array(n).fill(e)}}const o=[],a={},i=[...r].sort(((e,t)=>t.node.inventoryQuantity-e.node.inventoryQuantity));for(let e=0;e<n&&o.length<n;e++){let e=!1;for(const t of i){const n=t.node,r=a[n.id]||0;if(n.inventoryQuantity>r&&n.availableForSale){const t=n.title.split(" / ");o.push(t),a[n.id]=r+1,e=!0;break}}if(!e)return null}return o.length===n?o:null}),[s,w]),V=a((e=>{if(!y.general?.trackInventory)return!0;const t=w.find((t=>t.tier===e));if(!t)return!1;const n=t.minimumQuantity,r=s?.productDetails?.variants?.edges||[];let o=0;for(const e of r){const t=e.node;t.availableForSale&&(o+=Math.max(0,t.inventoryQuantity))}return o>=n}),[y.general?.trackInventory,w,s]);l((()=>{const e={},t=s?.productDetails?.variants?.edges?.[0]?.node?.id||"";t&&w.forEach((n=>{e[n.tier]={};for(let r=0;r<n.minimumQuantity;r++)e[n.tier][r]=t})),B(e)}),[s?.id,w?.map((e=>`${e.tier}-${e.minimumQuantity}`)).join("|")]),l((()=>{if(!m.current[E]){const e=j(E);if(e){const t=E-1;I((n=>({...n,[t]:e})));const n={};e.forEach(((e,t)=>{const r=e.join(" / "),o=s?.productDetails?.variants?.edges?.find((e=>e.node.title===r))?.node.id||T;n[t]=o})),B((e=>({...e,[E]:n})))}m.current[E]=!0}}),[E,s,T,j]);const W=(e,t)=>e?.productDetails?.variants?.edges?.find((e=>e.node.id===t))?.node,H=a(((e,t,n,r,o)=>{if(!y?.general?.trackInventory)return!0;const a=w.find((t=>t.tier===e));if(!a)return!1;const i=a.minimumQuantity,l=[...n];l[r]=o;const c=l.join(" / "),d=s?.productDetails?.variants?.edges?.find((e=>e.node.title===c))?.node;if(!d||!d.availableForSale||d.inventoryQuantity<=0)return!1;const p={},u=$[e]||{};for(let e=0;e<i;e++){let n;if(e===t)n=d.id;else{const t=u[e]||T,r=W(s,t);if(!r)return!1;n=r.id}p[n]=(p[n]||0)+1}for(const[e,t]of Object.entries(p)){const n=W(s,e);if(n&&t>n.inventoryQuantity)return!1}return!0}),[y?.general?.trackInventory,w,s,z,z,$,T]),U=a((e=>{if(!y.general?.trackInventory)return!0;const t=w.find((t=>t.tier===e));if(!t)return!1;const n=t.minimumQuantity,r=e-1,o={};for(let e=0;e<n;e++){const t=(z[r]?.[e]||s.productDetails.options.map((e=>e.values[0]))).join(" / "),n=s?.productDetails?.variants?.edges?.find((e=>e.node.title===t));if(!n)return!1;const a=n.node.id;o[a]=(o[a]||0)+1}for(const[e,t]of Object.entries(o)){const n=W(s,e);if(n&&t>n.inventoryQuantity)return!1}return!0}),[y.general?.trackInventory,w,s,z]);l((()=>{g((e=>e+1))}),[$]);const q=(e,t,n)=>{B((r=>({...r,[e]:{...r[e]||{},[t]:n}})))},Q=a((()=>!1===y.general?.trackInventory?s?.productDetails?.variants?.edges?.[0]?.node:s?.productDetails?.variants?.edges?.find((e=>e.node.inventoryQuantity>0))?.node||s?.productDetails?.variants?.edges?.[0]?.node),[s]),G=a((()=>new URLSearchParams(window.location.search).get("variant")||""),[]);l((()=>{L.current=E}),[E]),l((()=>{F?(M(null),Y()):Y()}),[E]),l((()=>{if(e){const e=Q();if(e)x(e.id),S(e.id);else{const e=s?.productDetails?.variants?.edges?.[0]?.node?.id||"";x(e),S(e)}}}),[e,s,Q]);const Y=()=>{const e=G();if(e){const t=s?.productDetails?.variants?.edges?.find((t=>String(t.node.id)==="gid://shopify/ProductVariant/"+String(e)));let n=t?.node;if(n)S(String(n.id)),g((e=>e+1));else{const e=Q();e&&(S(String(e.id)),n=e),g((e=>e+1))}if(n){!n.availableForSale||n.inventoryQuantity<=0?(M(null),setTimeout((()=>{M({tier:L.current,index:0,optionIndex:0,value:n.title})}),0)):F&&M(null)}}};l((()=>{Y();const e=new Event("urlChange");let t=!0;const n=window.history.pushState,r=window.history.replaceState;return window.history.pushState=function(){t&&(n.apply(this,arguments),window.dispatchEvent(e))},window.history.replaceState=function(){t&&(r.apply(this,arguments),window.dispatchEvent(e))},window.addEventListener("urlChange",Y),()=>{t=!1,window.removeEventListener("urlChange",Y),window.history.pushState=n,window.history.replaceState=r}}),[G,s?.id,Q]);const Z=t=>{const n=w.find((e=>e.tier===t));if(!n)return{original:0,discounted:0};let r=0,o=0;const a=$[t]||{};for(let e=0;e<n.minimumQuantity;e++){const t=a[e]||T,n=W(s,t);n&&(n.compareAtPrice?r+=Number.parseFloat(n.compareAtPrice):r+=Number.parseFloat(n.price),o+=Number.parseFloat(n.price))}return"percentOff"===e?.discountType?o*=1-n.discountValue/100:"amountOff"===e?.discountType&&(o-=n.discountValue),o<0&&(o=0),{original:r,discounted:o,discountValue:n.discountValue}},X=(e,t,n,r)=>{let o=W(e,t);if(r){const a=$[r]?.[n||0]||t;o=W(e,a)}return o?.image?.url?o.image.url:e.productDetails?.media?.edges[0]?.node?.preview?.image?.url||""};function K(e){if(e.startsWith("gid://")){const t=e.split("/");return t[t.length-1]}return e}l((()=>{const e=()=>{if("shopify_atc_button"!==y.volumeBundle?.addtoCartMethod&&"06cf02-81.myshopify.com"!==window.ytBundleApp?.storeDomain)return;const e=document.querySelector('form[action="/cart/add"]');if(!e)return;const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');let n=1;t&&t.value&&(n=parseInt(t.value,10)||1);const r=w.find((e=>e.tier===E));if(!r)return;e.querySelectorAll('.bundle-input-field, [name^="properties["], [name="id"], [name="quantity"]').forEach((e=>e.remove()));const o=r.minimumQuantity;let a={};const i=Math.max(o,n);if("vertical"===y.volumeBundle.cardStyle){const e=h||T;if(!e)return;a[e]=i}else if(n>o){const e=h||T;if(!e)return;a[e]=i}else{const e=$[r.tier]||{};for(let t=0;t<o;t++){let n=e[t];n||(n=T),n&&(a[n]=(a[n]||0)+1)}}const l=Z(r.tier),c=Object.fromEntries(Object.entries(a).map((([e,t])=>[K(e),Math.round(t)]))),d=(t,n,r="bundle-input-field")=>{const o=document.createElement("input");o.type="hidden",o.name=t,o.value=n,o.className=r,e.appendChild(o)};if(n>o){const e=h||T;e&&d("id",K(e))}d("properties[_bundle_price]",String(l.original)),d("properties[_bundle_tier]",String(r.tier)),d("properties[_bundle_items]",JSON.stringify(c));let s=0;Object.entries(c).forEach((([e,t])=>{t>0&&(d(`items[${s}][id]`,e),d(`items[${s}][quantity]`,String(t)),s++)})),requestAnimationFrame((()=>{const t=e.querySelector('[type="submit"]'),r=e.querySelector('[name="checkout"]'),a=e.querySelector(".noti-btn-main-wrap"),i=(e,t,n)=>{if(!e)return;e.disabled=t,e.classList.toggle("disabled",t);const r=e.querySelector("[data-add-to-cart-text]")||e.querySelector("span");r&&(r.textContent=n)};n<=o&&(F?(i(t,!0,"Sold out"),i(r,!0,"Sold out"),t&&t.classList.add("btn--sold-out","hidden"),a&&(a.style.display="block",a.classList.remove("hidden"),a.classList.add("block"))):(i(t,!1,"Add to cart"),i(r,!1,"Buy it now"),t&&t.classList.remove("btn--sold-out","hidden"),a&&(a.style.display="none",a.classList.add("hidden"))))}))};e();const t=document.querySelector("#Quantity-product-template")||document.querySelector('input[name="quantity"]')||document.querySelector('input[type="number"][min="1"]');if(t){const n=()=>{requestAnimationFrame((()=>{e()}))};return t.addEventListener("input",n),t.addEventListener("change",n),()=>{t.removeEventListener("input",n),t.removeEventListener("change",n)}}return()=>{}}),[E,JSON.stringify($),T,y.volumeBundle?.cardStyle,r,h,F]);const J=i((()=>w.find((e=>e.tier===E))),[w,E]),ee=i((()=>J?Z(J.tier):null),[J,$,T]),te=i((()=>{if(!J||!ee)return;const e=$[J.tier]||{},t={};for(let n=0;n<J.minimumQuantity;n++){const r=e[n]||T;t[r]=(t[r]||0)+1}return t}),[J?.minimumQuantity,T,$,ee]),ne=i((()=>Object.entries(te??{}).map((([e,t])=>({variantId:e,quantity:t})))),[te]);if(l((()=>{if(!J||!ee)return;const e={tier:E,items:J.minimumQuantity,discountedPrice:ee.discounted,originalPrice:ee.original,variants:ne,productId:s?.id??null,tierMeta:{title:J.title,subtitle:J.subtitle,badgeTitle:J.badgeTitle},productData:s,tierData:J},t=u.current;return t&&JSON.stringify(t)===JSON.stringify(e)?void 0:(p.current&&clearTimeout(p.current),p.current=window.setTimeout((()=>{u.current=e;const t=new CustomEvent("ytBundleTierChange",{detail:e});window.dispatchEvent(t)}),50),()=>{p.current&&clearTimeout(p.current)})}),[E,J?.tier,J?.minimumQuantity,ee?.discounted,ee?.original,s?.id,JSON.stringify(ne)]),l((()=>{if(!T||!J)return;const e=W(s,T);if(!e)return;const t={};for(let e=0;e<J.minimumQuantity;e++)t[e]=T;B((e=>({...e,[E]:{...t}})));const n=e.title.split(" / "),r=Array.from({length:J.minimumQuantity},(()=>[...n]));I((e=>({...e,[E-1]:r})))}),[T,E,s,J]),!n)return t.createElement(t.Fragment,null);const re=y.volumeBundle?.cardStyle,oe=y.general?.primaryColor,ae=y.general?.secondaryColor,ie=y.general.primaryContrastColor,le=y.general.secondaryContrastColor,ce="high"===e.cornerRadiusType?"20px":"medium"===e.cornerRadiusType?"6px":"0px",de="bundles"==e.appName?e.pageHeader?.title:e?.title,se="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return l((()=>{U(E)&&F?.tier===E&&M(null)}),[E,ne,U,F]),t.createElement(sf,{verticalMargin:y.volumeBundle?.verticalMargin,$backgroundColor:y.volumeBundle?.sectionBackgroundColor,className:"yt-bundle-container"},t.createElement(pf,{className:"yt-bundle-header"},de&&de.trim().length>0&&t.createElement(uf,{fontSize:y.volumeBundle?.titleFontSize,$backgroundColor:y.volumeBundle?.titleBackgroundColor,textColor:y.volumeBundle?.titleTextColor,className:"yt-bundle-header-title"},de),t.createElement(mf,{className:"yt-bundle-header-subtitle",fontSize:y.volumeBundle?.subtitleFontSize},se)),"vertical"===re?t.createElement("div",{style:{display:"grid",gridTemplateColumns:N||4===w.length?"repeat(2, 1fr)":w.length>4?"repeat(3, 1fr)":`repeat(${w.length}, 1fr)`,justifyItems:"center",gap:N?"10px":"16px",paddingTop:"10px"},className:"yt-bundle-vertical-container"},w.map((n=>{const r=Z(n.tier),o=r.original-r.discounted,a=E===n.tier,i=!V(n.tier);return t.createElement(t.Fragment,{key:n.tier},t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderRadius:ce||"24px",...a?{border:`2px solid ${oe}`}:{border:`1px solid ${ae}`},boxShadow:`6px 6px 0px -1px ${a?oe:ae}20`,...n.badgeTitle&&{position:"relative"},zIndex:5,backgroundColor:i?"#f5f5f5":"white",cursor:i?"not-allowed":"pointer",position:"relative",height:"100%",maxHeight:"350px",width:"100%",opacity:i?.6:1},className:"yt-volume-vertical-tier-item "+(a?"yt-volume-vertical-tier-item-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),onClick:()=>!i&&k(n.tier)},n.badgeTitle&&t.createElement("div",{style:{position:"absolute",top:"-15px",zIndex:-1,left:"0",right:"0",width:"80%",textAlign:"center",margin:"0 auto",fontSize:"10px",clipPath:"polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%)",backgroundColor:a?oe:ae,color:a?ie:le,padding:"2px 0",borderRadius:"12px 12px 0px 0px",lineHeight:"normal"},className:a?"yt-volume-vertical-tier-badge-active":"yt-volume-vertical-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement("div",{style:{position:"relative",width:"100%",display:"flex",justifyContent:"center",height:"fit-content"},className:"yt-volume-vertical-tier-save-badge-container"},0!==r.discountValue&&t.createElement(t.Fragment,null,N&&o>0&&!!r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"5px",top:"8px"}},t.createElement(yf,{primaryBackgroundColorCta:a?oe:ae,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?ie:le},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(r.discountValue)}`))),n.imageUrl&&t.createElement("img",{src:Hh(n.imageUrl),style:{objectFit:"cover",aspectRatio:"1/1",width:"100%",maxHeight:"160px",maxWidth:"160px",height:"fit-content",borderTopLeftRadius:ce||"24px",borderTopRightRadius:ce||"24px"},className:"yt-volume-vertical-tier-badge"})),t.createElement("div",{style:{padding:"8px",paddingTop:"0"}},t.createElement(bf,{style:{display:"flex",width:"100%",gap:"4px"},className:"yt-volume-vertical-details-container"},t.createElement("div",{style:{display:"flex",alignItems:"center",position:"relative",width:"100%"},className:"yt-volume-vertical-details-title-container"},t.createElement(vf,{style:{fontSize:N?"12px":"14px",lineHeight:"normal"},className:"yt-volume-vertical-details-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),!N&&o>0&&!!r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility&&t.createElement(yf,{primaryBackgroundColorCta:a?oe:ae,isSelected:a,style:{height:"fit-content",fontSize:"10px",lineHeight:"normal",color:a?ie:le},className:"yt-volume-vertical-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(r.discountValue)}`),a&&n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"0px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:oe,color:ie,padding:"2px"}},t.createElement(no,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))),t.createElement(wf,{style:{lineHeight:"normal",fontSize:N?"10px":"14px",color:"#666"},className:"yt-volume-vertical-details-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null))),t.createElement(Cf,{style:{textAlign:"left",marginTop:"4px",display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center"},className:"yt-volume-vertical-details-price","data-tier":n.tier,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),"data-savings":o.toFixed(b?0:2)},t.createElement(Ef,{style:{marginLeft:"0",lineHeight:"normal",marginRight:"8px"},className:"yt-volume-vertical-details-price-discount"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.discounted.toFixed(b?0:2))),o>0?t.createElement(kf,{style:{lineHeight:"normal"},className:"yt-volume-vertical-details-price-original"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.original.toFixed(b?0:2))):"")),a&&!n.imageUrl&&t.createElement("div",{style:{lineHeight:"normal",position:"absolute",right:"10px",bottom:"10px"},className:"yt-volume-vertical-tier-selected-check"},t.createElement("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",borderRadius:"50%",backgroundColor:oe,color:ie,padding:"2px"}},t.createElement(no,{style:{paddingBottom:"1px"},size:20,fontWeight:20})))))}))):t.createElement(t.Fragment,null,w.map((n=>{const r=Z(n.tier),o=r.original-r.discounted,a=!V(n.tier);return t.createElement(t.Fragment,{key:n.tier},n.badgeTitle&&t.createElement(ff,{primaryTextColorCta:ie,primaryBackgroundColorCta:oe,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-badge","data-tier":n.tier,"data-badge-title":n.badgeTitle},n.badgeTitle),t.createElement(gf,{cornerRadiusType:e?.cornerRadiusType??"",key:n.tier,primaryBackgroundColorCta:oe??"",isSelected:E===n.tier,onClick:()=>k(n.tier),style:{borderRadius:ce,cursor:"pointer",backgroundColor:a?"#f5f5f5":"white",opacity:a?.6:1},className:"yt-volume-horizontal-tier-container "+(E===n.tier?"yt-volume-horizontal-tier-container-active":""),"data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType,"data-minimum-quantity":n.minimumQuantity,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2)},t.createElement(hf,{cornerRadiusType:e?.cornerRadiusType??"",style:{borderRadius:ce,borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},className:"yt-volume-horizontal-tier-header"},t.createElement(xf,{className:"yt-volume-horizontal-tier-info"},t.createElement(zf,{"data-active":E===n.tier,accentColor:oe,className:"yt-volume-horizontal-tier-radio-wrapper"},t.createElement(If,{name:"tier",checked:E===n.tier,onChange:()=>!a&&k(n.tier),disabled:a,className:"yt-volume-horizontal-tier-radio-hidden"}),t.createElement(Df,{accentColor:oe,className:"yt-volume-horizontal-tier-radio-custom"})),t.createElement(bf,{className:"yt-volume-horizontal-tier-details"},t.createElement("div",{style:{display:"flex"},className:"yt-volume-horizontal-tier-title-container"},t.createElement(vf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-title"},n.title?n.title:t.createElement(t.Fragment,null,"Buy ",n.minimumQuantity,", Get"," ",n.discountValue,"% Off")),o>0&&r?.discountValue&&"Enabled"===y.volumeBundle?.discountBadgeVisibility?t.createElement(yf,{primaryBackgroundColorCta:oe,isSelected:E===n.tier,style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-save-badge","data-tier":n.tier,"data-discount-value":r.discountValue,"data-discount-type":e?.discountType}," ","percentOff"===e?.discountType?`${r.discountValue}% Off`:`Save ${Wh(y.general.currencySymbol,e.storeCurrencyCode)}${Vh(r.discountValue)}`):""),t.createElement(wf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-subtitle"},n.subtitle?n.subtitle:t.createElement(t.Fragment,null)))),t.createElement(Cf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-price","data-tier":n.tier,"data-original-price":r.original.toFixed(b?0:2),"data-discounted-price":r.discounted.toFixed(b?0:2),"data-savings":o.toFixed(0)},o>0?t.createElement(kf,{style:{lineHeight:"normal"},className:"yt-volume-horizontal-tier-original-price"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.original.toFixed(b?0:2))):"",t.createElement(Ef,{className:"yt-volume-horizontal-tier-discounted-price"},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(r.discounted.toFixed(b?0:2))))),E===n.tier&&t.createElement(Tf,{className:"yt-volume-horizontal-tier-product-grid",style:{padding:s.productDetails.variants.edges.length<=1?"0":"10px 15px",gap:s.productDetails.variants.edges.length<=1?"0":"10px"}},Array.from({length:n.minimumQuantity}).map(((r,o)=>{const i=n.tier-1,l=(z[i]||[])[o]||s.productDetails.options?.map((e=>e.values[0]))||[],c=s?.productDetails?.options.some((e=>e.values.length>1));return t.createElement("div",{key:o,style:{display:"flex",gap:"10px",alignItems:"center",position:"relative"},className:"yt-volume-horizontal-tier-product-item"},c&&t.createElement(_f,{src:Hh(X(s,T,o,n.tier)),alt:s?.productDetails?.title||"Product",className:"yt-volume-horizontal-tier-product-image"}),"auto"===y?.volumeBundle?.variantSelectorType?t.createElement("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"}},s?.productDetails?.options?.map(((r,d)=>{if(!c)return null;const p=O?.tier===n.tier&&O?.index===o&&O?.optionIndex===d,u=e?.variantOptions?.options?.find((e=>e.name===r.name));let m="";return"color"===u?.type&&(m=u?.values?.find((e=>e.name===l[d]))?.value||""),t.createElement(Af,{key:d,ref:e=>{R.current[o]||(R.current[o]=[]),R.current[o][d]=e},style:{zIndex:p?1e3:"auto",display:"flex"},isActive:p},t.createElement(Ff,{onClick:e=>{e.stopPropagation(),A(p?null:{tier:n.tier,index:o,optionIndex:d})},isActive:p,disabled:a},"color"===u?.type&&m&&t.createElement("div",{className:"yt-fixedBundle-product-card_color-swatch",style:{display:"inline-block",width:20,height:20,borderRadius:"50%",backgroundColor:m||"transparent",border:"1px solid #ddd"}}),l[d],t.createElement(Ur,null)),p&&t.createElement(Mf,{style:{zIndex:1001}},r.values.map(((e,r)=>{const c=[...l];c[d]=e;const p=!H(n.tier,o,l,d,e)||a;s.productDetails.variants.edges.find((({node:e})=>e.title===c.join(" / ")));const m=t=>{if(t.preventDefault(),t.stopPropagation(),I((e=>{const t={...e},n=[...t[i]||[]];return n[o]=c,t[i]=n,t})),p){M({tier:E,index:o,optionIndex:d,value:e}),A(null);const t=c.join(" / "),r=s.productDetails.variants.edges.find((e=>e.node.title===t))?.node.id||T;return void q(n.tier,o,r)}const r=c.join(" / "),a=s.productDetails.variants.edges.find((e=>e.node.title===r))?.node.id||T;q(n.tier,o,a),A(null)},f=u?.values.find((t=>t.name===e));return"image"===u?.type&&f?.value?t.createElement(Nf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Pf,{src:f.value,alt:e}),e):"color"===u?.type&&f?.value?t.createElement(Nf,{key:e,onClick:m,style:{cursor:"pointer"}},t.createElement(Of,{style:{backgroundColor:f.value}}),e):t.createElement(Nf,{key:e,onClick:m,style:{cursor:"pointer"}},e)}))))}))):t.createElement(Sf,{style:{display:"flex",flexDirection:"column",gap:"5px"},className:"yt-volume-horizontal-tier-variant-selector"},s?.productDetails?.options.map(((r,c)=>{if(!(r.values.length>1))return null;const d=e.variantOptions?.options?.find((e=>e.name===r.name))||null;return t.createElement("div",{key:r.name,style:{width:"100%",display:"flex",flexDirection:"row",gap:"8px",alignItems:"center"},className:"yt-volume-horizontal-tier-variant-option"},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:"wrap"},className:"yt-volume-horizontal-tier-variant-values"},r.values.map((e=>{const r=l[c]===e,p=!H(n.tier,o,l,c,e)||a,u=d?.values.find((t=>t.name===e)),m=t=>{if(t.preventDefault(),t.stopPropagation(),p)return;const r=[...l];r[c]=e,I((e=>{const t={...e},n=[...t[i]||[]];return n[o]=r,t[i]=n,t}));const a=r.join(" / "),d=s.productDetails.variants.edges.find((e=>e.node.title===a))?.node.id||T;q(n.tier,o,d)},f={opacity:p?.5:1,cursor:p?"not-allowed":"pointer"};return"color"===d?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,borderRadius:"50%",padding:"1px",backgroundColor:"white",border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid transparent",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-color-button",disabled:p},t.createElement("div",{style:{width:r?"24px":"20px",height:r?"24px":"20px",borderRadius:"50%",backgroundColor:u.value,lineHeight:"normal",boxShadow:"rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 2px"}},t.createElement("span",null))):"image"===d?.type&&u?.value?t.createElement("button",{key:e,onClick:m,style:{...f,border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"100%",backgroundColor:r?"#F7F7F7":"transparent",padding:"0px",width:r?"20px":"18px",height:r?"20px":"18px",overflow:"hidden"},className:"yt-volume-horizontal-tier-variant-image-button",disabled:p},t.createElement("img",{src:u.value,alt:e,style:{width:r?"26px":"24px",height:r?"26px":"24px",objectFit:"cover",borderRadius:"100%",aspectRatio:"1/1"}})):t.createElement($f,{key:e,isSelected:r,onClick:m,style:{...f,padding:"4px 8px",border:r?`1px solid ${y.general?.ctaBackgroundColor||"#121212"}`:"1px solid #E4E4E4",borderRadius:"16px",backgroundColor:r?"#F7F7F7":"transparent",color:"#707070",cursor:"pointer",fontSize:"12px",fontWeight:"600",lineHeight:"normal"},className:"yt-volume-horizontal-tier-variant-button-default",disabled:p},e)}))))}))))}))),F&&F.tier===n.tier&&t.createElement("div",{style:{color:oe,textAlign:"center",fontSize:"14px",fontStyle:"normal",fontWeight:"500",lineHeight:"110%",background:`${oe}1A`,padding:"12px",borderBottomLeftRadius:ce,borderBottomRightRadius:ce}},"There aren’t enough items in our stock for select option, please select smaller bundle.")))}))),e?.showCta&&(!y.volumeBundle?.addtoCartMethod||"shopify_atc_button"!==y.volumeBundle?.addtoCartMethod)&&!("devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"06cf02-81.myshopify.com"===window.ytBundleApp?.storeDomain)&&t.createElement("div",{style:{position:"relative"}},t.createElement(Bf,{bgColor:U(E)?y.general?.ctaBackgroundColor:"#ccc",textColor:U(E)?y.general?.ctaTextColor:"#666",border:`1px solid ${U(E)?y.general?.ctaBorderColor||"#121212":"#999"}`,shadow:y.general.ctaShadowType,padding:y.general?.ctaPadding,width:y.general?.ctaWidth,hoverProperties:{customizeHoverState:!!U(E)&&y.general?.customizeHoverState,backgroundColor:y.general?.ctaHoverBackgroundColor,textColor:y.general?.ctaHoverTextColor},onClick:async()=>{if(U(E))try{_(!0);const e=w.find((e=>e.tier===E));if(!e)return;const t={},r=$[e.tier]||{};for(let n=0;n<e.minimumQuantity;n++){const e=r[n]||T;t[e]?t[e].quantity+=1:t[e]={quantity:1}}const o=Z(e.tier),a=Array.from({length:e.minimumQuantity},((e,t)=>r[t]||T));n&&await n(o.original,a)}catch(e){console.error("VolumeBundle handleAddToCart error:",e)}finally{_(!1)}else console.error("Selected tier is out of stock")},borderRadius:y.general.ctaBorderRadius??"",disabled:D||!U(E),className:"yt-volume-add-to-cart-button"},U(E)?t.createElement(t.Fragment,null,D?t.createElement(Yo,{color:"white",loading:D,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement("div",{style:{display:"flex",flexDirection:"row",gap:"8px",justifyContent:"center",alignItems:"center"}},t.createElement("span",null,y.volumeBundle?.ctaTitle??"Add Bundle to Cart")," ","•",t.createElement("div",{className:"yt-volume-add-to-cart-button-info"},(()=>{const n=Z(E);return t.createElement(t.Fragment,null,Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(n.discounted.toFixed(b?0:2))," ",n?.original!==n.discounted&&t.createElement("span",{style:{lineHeight:"normal",textDecoration:"line-through",fontWeight:"550"}},Wh(y.general.currencySymbol,e.storeCurrencyCode),Vh(n?.original.toFixed(b?0:2))," "))})()))):t.createElement(t.Fragment,null,"Out of Stock"))))}const jf=x.div`
3887
3887
  container-type: inline-size;
3888
3888
  border-radius: ${e=>e.borderRadius?e.borderRadius:"8px"};
3889
3889
  max-width: 800px;
@@ -5047,8 +5047,7 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
5047
5047
  border-radius: 50%;
5048
5048
  background-color: ${e=>e.color};
5049
5049
  border: ${e=>e.selected?"1.5px solid #777":"1px solid #ccc"};
5050
- cursor: ${e=>e.disabled?"not-allowed":"pointer"};
5051
- opacity: ${e=>e.disabled?.5:1};
5050
+ cursor: pointer;
5052
5051
 
5053
5052
  @container (max-width : 468px) {
5054
5053
  width: 16px;
@@ -5056,11 +5055,11 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
5056
5055
  }
5057
5056
 
5058
5057
  &:hover {
5059
- cursor: ${e=>e.disabled?"not-allowed":"pointer"};
5058
+ cursor: pointer;
5060
5059
  }
5061
5060
  `,Sh=x.span`
5062
5061
  font-size: 10px;
5063
- color: ${e=>e.disabled?"#999":"#777"};
5062
+ color: #777;
5064
5063
  padding: 2px 4px;
5065
5064
  background-color: #f3f3f3bd;
5066
5065
 
@@ -5069,8 +5068,8 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
5069
5068
  border-radius: 8px;
5070
5069
 
5071
5070
  &:hover {
5072
- cursor: ${e=>e.disabled?"not-allowed":"pointer"};
5073
- background-color: ${e=>e.disabled?"#f3f3f3bd":"#f3f3f35f"};
5071
+ cursor: pointer;
5072
+ background-color: #f3f3f35f;
5074
5073
  }
5075
5074
  `,$h=x.img`
5076
5075
  width: 16px;
@@ -5078,12 +5077,11 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
5078
5077
  border-radius: 50%;
5079
5078
  background-color: #f3f3f3bd;
5080
5079
  border: ${e=>e.selected?"1px solid #777":"1px solid #ccc"};
5081
- cursor: ${e=>e.disabled?"not-allowed":"pointer"};
5082
- opacity: ${e=>e.disabled?.5:1};
5080
+ cursor: pointer;
5083
5081
 
5084
5082
  &:hover {
5085
- cursor: ${e=>e.disabled?"not-allowed":"pointer"};
5083
+ cursor: pointer;
5086
5084
  }
5087
5085
  `,Bh=x.span`
5088
5086
  font-size: 12px;
5089
- `,zh=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:d,primaryProductId:s,variantId:p})=>{const[u,m]=c({}),[f,g]=c({});l((()=>{const t={},n={};e?.forEach((({product:e,index:r})=>{let o,a=[];if(e.productId===s&&p){const t=e?.productDetails?.variants?.edges.find((e=>e?.node?.id?.includes(p)))?.node;t&&(a=t.title.split(" / "),o=t)}if(!a.length){const t=e.productDetails.variants.edges.find((t=>!e.productDetails.tracksInventory||t?.node?.inventoryQuantity>0))?.node||e?.productDetails?.variants?.edges?.[0]?.node;t?(a=t.title.split(" / "),o=t):a=e?.productDetails?.options?.map((e=>e.values[0]??""))}t[r]=a,o&&(n[r]={node:o},i(r,o.id))})),m(t),g(n)}),[e,s,p,i]),l((()=>{if(!s||!p)return;const t=e?.find((({product:e})=>e?.productId===s));if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find((e=>e.node.id.includes(p)))?.node;if(o){const e=o.title.split(" / ");m((t=>({...t,[r]:e}))),g((e=>({...e,[r]:{node:o}}))),i(r,o.id)}}),[p,s,e,i]);const h=(e,t,n,r)=>{if(!r.productDetails.tracksInventory)return!0;const o=[...u[e]||[]];o[t]=n;const a=o.join(" / "),i=r.productDetails.variants.edges.find((e=>e.node.title===a))?.node;return!!i&&i.inventoryQuantity>0},x=(t,n,r)=>{const{product:o}=e?.find((e=>e.index===t))||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!h(t,r,n,o))return;const a={...u};a[t][r]=n,m(a);const l=o?.productDetails?.variants?.edges?.find((e=>e.node.title===a[t].join(" / ")))?.node;l&&(i(t,l.id),g((e=>({...e,[t]:{node:l}}))))};if(!n)return null;const y=t.createElement(fh,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(gh,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(hh,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map((({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(yh,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(bh,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(vh,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(wh,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(Eh,{className:"yt-fixedBundle-variant-modal_selected-value"},u[r]?.join(" / "))),n.productDetails.options.map(((e,o)=>{const i=a&&a?.options?.find((t=>t.name===e.name));return e.values.length<=1?t.createElement(t.Fragment,null):i&&"color"===i?.type?t.createElement(kh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Bh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>{const l=!h(r,o,e,n);return t.createElement(t.Fragment,null,i.values.find((t=>t.name===e))?.value?t.createElement(Th,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find((t=>t.name===e))?.value||e,selected:u[r]?.[o]==e,disabled:l,onClick:()=>{x(r,e,o)}},t.createElement("span",null)):t.createElement(Sh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r]?.[o]==e,disabled:l,onClick:()=>{x(r,e,o)}},e))}))):i&&"image"===i?.type?t.createElement(kh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Bh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>{const l=!h(r,o,e,n);return t.createElement(t.Fragment,null,i?.values.find((t=>t.name===e))?.value?t.createElement($h,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[r]?.[o]==e,disabled:l,onClick:()=>{x(r,e,o)},src:i.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(Sh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r]?.[o]==e,disabled:l,onClick:()=>{x(r,e,o)}},e))}))):t.createElement(kh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Bh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>{const i=!h(r,o,e,n);return t.createElement(Sh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r]?.[o]==e,disabled:i,onClick:()=>{x(r,e,o)}},e)})))})))),o<e.length-1&&t.createElement(Ch,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(xh,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(y,document.body)},Ih=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,d]=c(!1),s=o(null);l((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(ah,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(ih,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Kg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},t.createElement(Jg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!i)},t.createElement(eh,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(th,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(nh,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(rh,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),d(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(oh,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},Dh=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:d="dropdown"})=>{const[s,p]=c(r||[]);l((()=>{if(a&&e.variants.edges.some((e=>e.node.id.includes(a)))){const t=e.variants.edges.find((e=>e.node.id.includes(a)))?.node;if(t){const e=t.title.split(" / ");p(e)}}}),[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find((t=>t.name===e));return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map((e=>({name:e,value:e})));const r=n.options.find((t=>t.name===e.name));return e.values.map((e=>{const t=r?.values?.find((t=>t.name===e));return{name:e,value:t?.value||e}}))},f=(e,t)=>{const n=s[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(lh,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(ch,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Ih,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...s];r[t]=n.name,p(r);const a=e.variants.edges.find((n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t])))?.node.id;o(a||"")})(r,t)},type:u(n.name)})))))},_h=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:d,isMobile:s,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:h,primaryProductId:x,variantId:y})=>{const[b,v]=c(e?.variants?.edges.find((t=>!e.tracksInventory||t?.node?.inventoryQuantity>0))?.node||e?.variants?.edges?.[0]?.node),[w]=c(e?.options?.map((e=>e?.values?.[0]))||[]),C=e?.id===x;l((()=>{if(y&&e.id===x){const t=e?.variants?.edges?.find((e=>e?.node?.id?.includes(y)))?.node;t&&(v(t),i(t.id))}else{const t=e?.variants?.edges?.find((t=>!e.tracksInventory||t.node.inventoryQuantity>0))?.node||e?.variants?.edges?.[0]?.node;v(t)}}),[e,x,n,y,i]);const E="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,k=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===x?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(uh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(sh,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ph,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(kg,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Tg,{className:"yt-fixedBundle-product-card-horizontal_image",src:Hh(k),alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(Sg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement($g,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Bg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(zg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Wh(a.general.currencySymbol,h)," ",Vh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Ig,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Wh(a.general.currencySymbol,h),Vh(b?.compareAtPrice))),t.createElement(Dh,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:x})))):t.createElement(t.Fragment,null,t.createElement(Rg,{className:""+(e.id===x?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...E&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(mh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:E},t.createElement(sh,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ph,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Lg,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(jg,{className:"yt-fixedBundle-product-card_image--vertical",src:Hh(k),style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Vg,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(Wg,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Hg,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(Ug,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(qg,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Qg,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Yg,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Gg,{className:"yt-fixedBundle-product-card-vertical_price--new"},Wh(a.general.currencySymbol,h),Vh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Ig,{className:"yt-fixedBundle-product-card-vertical_price--old"},Wh(a.general.currencySymbol,h),Vh(b.compareAtPrice))))),(f<=3||!s)&&u<f-1&&t.createElement(Zg,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(Xg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Nh=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[d,s]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,h=e?.products?.find((e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0])),x=h?.productId,[y,b]=c(Object.fromEntries(e?.products?.map(((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find((t=>!e.productDetails.tracksInventory||t?.node?.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),v="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),w=e?.showIndividualProductSelector||!0,[C,E]=c(new Set(e.products.reduce(((e,t,n)=>(v&&t?.productId!==x&&!w||e.push(n),e)),[])));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}}),[]),l((()=>{p&&x&&b((t=>{const n={...t};return e?.products?.forEach(((e,t)=>{e.productId===x&&(n[t.toString()]=p)})),n}))}),[p,x,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=a(((e,t)=>{b((n=>({...n,[e.toString()]:t})))}),[]),T=(t,n)=>{const r=e.products[n].productId;v&&w&&r===x||E((e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r}))},S=i((()=>e.products.some(((e,t)=>C.has(t)&&e.productDetails.variants.edges.length>1))),[e.products,C]),{originalPrice:$,dealPrice:B,offerValue:z}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t,n)=>{if(!C.has(n))return e;const r=y[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find((e=>e.node.id===r))?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);C.size===e.products.length&&(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)}}),[e.products,y,C,e.percentageOff,e.dealAmount,e.amountOff]),I=i((()=>e.products.map(((e,t)=>({product:e,index:t}))).filter((({index:e})=>C.has(e)))),[e.products,C]),D=I.every((({product:e,index:t})=>((e,t)=>{if(!e.productDetails.tracksInventory)return!0;const n=e.productDetails.variants.edges?.find((e=>e.node.id===t))?.node;return n?.inventoryQuantity>0})(e,y[t.toString()]))),_=async e=>{if(D){e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(y).map((([e,t])=>{const n=parseInt(e);return isNaN(n)||!C.has(n)?null:t})).filter(Boolean);n&&await n(Number($),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)}};if(!n)return t.createElement(t.Fragment,null);const N=e.customizations,P=N.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===P||"auto"===P&&d,A="bundles"==e.appName?e.pageHeader?.title:e?.title,F="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(vg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:N.fixedBundle.sectionBackgroundColor,..."transparent"!==N.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(wg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:N.fixedBundle?.titleBackgroundColor||"none",color:N.fixedBundle?.titleTextColor||"black",textAlign:N.fixedBundle.infoAlignment??"center",fontSize:N.fixedBundle?.titleFontSize,..."transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),F&&t.createElement(Cg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:N.fixedBundle?.subtitleFontSize,textAlign:N.fixedBundle.infoAlignment??"center",..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},F),O?t.createElement(Eg,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(_h,{isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>{T(e,r)},isMobile:d,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0}))))):t.createElement(Fg,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Mg,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement(_h,{key:`${n.productId}-${r}`,isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>T(e,r),isMobile:d,index:r,isHorizontal:O,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0}))),S&&t.createElement(zh,{productsWithIndices:I,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:N.general.ctaTextColor,backgroundColor:N.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:_,primaryProductId:x,variantId:p||void 0}))),t.createElement(Dg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},Number($)>0&&Number(z)>0&&N.fixedBundle.compareAtPriceVisibility&&t.createElement(_g,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(Pg,{className:"yt-fixedBundle-summary_price"},Wh(N.general.currencySymbol,e?.storeCurrencyCode),Vh($))),0!==C.size&&t.createElement(Ng,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(Pg,{className:"yt-fixedBundle-summary_price"},Wh(N.general.currencySymbol,e?.storeCurrencyCode),Vh(B))," ",Number(z)>0&&t.createElement(Og,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Wh(N.general.currencySymbol,e?.storeCurrencyCode),Vh(z)))),t.createElement(Ag,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!S?_(e):f(!0)},disabled:C.size<1||r||!D,style:{backgroundColor:N.general?.ctaBackgroundColor||"#121212",color:N.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${N.general?.ctaBackgroundColor||"#121212"}`,boxShadow:N.general.ctaShadowType,paddingTop:N.general?.ctaPadding,paddingBottom:N.general?.ctaPadding,borderRadius:N.general.ctaBorderRadius,width:N.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=N.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=N.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(Yo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):D?t.createElement(t.Fragment,null,N.fixedBundle?.ctaTitle??"Add Bundle to cart"):t.createElement(t.Fragment,null,"Out of Stock")))},Ph=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Oh=({product:e,tierIdx:n,isOpen:r,onClose:o,onAddToBundle:a,canAdd:i,isSelected:d,customizations:s,isMobile:p})=>{const[u,m]=c(0),[f,g]=c(e.variants[0].id.toString()),h=e.variants.find((e=>e.id.toString()===f))||e.variants[0],x=e.images.filter(Boolean);if(l((()=>(r&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""})),[r]),!r)return null;const y=t.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{style:{background:"#fff",borderRadius:s?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(ct,{size:22})),t.createElement("div",{style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:s?.borderRadius||"12px"}},x.length>0&&t.createElement("img",{src:h.featured_image?.src||x[u]||e.images[0],alt:e.title,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:s?.borderRadius||"12px"}}),x.length>1&&t.createElement("div",{style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map(((e,n)=>t.createElement("div",{key:n,onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer",display:"block"}}))))),t.createElement("div",{style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},t.createElement("h2",{style:{margin:"0 0 12px",fontSize:24,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{style:{position:"relative"}},t.createElement("div",{style:{padding:"8px 0",borderBottom:"1px solid #eee"}},e?.options?.join(" & "),":"," ",t.createElement("strong",null,h.title)),t.createElement("select",{value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toFixed(0))),t.createElement("div",{style:{position:"sticky",bottom:0,background:"white"}},t.createElement("button",{onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:h.available?d||!i?"#28a745":s?.atcBg||"#007bff":"rgb(204, 204, 204)",color:s?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed"}},d?"Added to Box":h.available?"Add to Box":"Out of Stock")),e.description&&t.createElement("div",{dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}})))),b=t.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(ct,{size:22})),t.createElement("div",{style:{flex:1,overflowY:"auto",paddingBottom:100}},x.length>0&&t.createElement("div",{style:{position:"relative"}},t.createElement("img",{src:h.featured_image?.src||x[u]||e.images[0],alt:e.title,style:{width:"100%",display:"block",maxHeight:"50vh",objectFit:"cover",objectPosition:"center"}}),x.length>1&&t.createElement("div",{style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map(((e,n)=>t.createElement("div",{key:n,onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer"}}))))),t.createElement("div",{style:{padding:"20px"}},t.createElement("h2",{style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{style:{position:"relative",marginBottom:20}},t.createElement("div",{style:{padding:"8px 0",borderBottom:"1px solid #eee"}},"Variant: ",t.createElement("strong",null,h.title)),t.createElement("select",{value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toFixed(0))),e.description&&t.createElement("div",{dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}}))),t.createElement("div",{style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},t.createElement("button",{onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:!d&&i&&h.available?s?.atcBg||"#007bff":"#28a745",color:s?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed"}},d?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return v.createPortal(p?b:y,document.body)},Ah=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(Ph,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{margin:"12px 0"}},t.createElement("img",{src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},Fh=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[a,i]=c(1),[d,s]=c([]),[p,u]=c(null),[m,f]=c({}),[g,h]=c(window.innerWidth<640),x=o(new Map),[y,b]=c(!1);l((()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>h(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[]);const{customizations:v}=e,w=e.config.builderTiers.collectionTier.sort(((e,t)=>e.tier-t.tier)),C=w.length+1,E=C,k=v.hideSelectedProducts,T=v.allowMultipleQty,S=v.hideOutOfStockProducts,$=d.reduce(((e,t)=>e+t.quantity),0),B=d.reduce(((e,t)=>e+t.price*t.quantity),0)/100,z=d.reduce(((e,t)=>{const n=w.flatMap((e=>e.products)).find((e=>e.id.toString()===t.productId)),r=n?.variants.find((e=>e.id.toString()===t.variantId));return e+(r?.compare_at_price??t.price)*t.quantity}),0)/100,I=(e,t)=>{const n=e.variants.find((e=>e.id===parseInt(t)));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},D=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());s((n=>{const a=`${e.id}-${r}-${t}`,i=n.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a));if(i)return n.filter((e=>e!==i));const l=P[t],c=_(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]}))},_=e=>{const t=w[e];return t.minimumQuantity>0?t.minimumQuantity:1/0},N=(e,t)=>{const n=_(t);if(n===1/0)return!0;const r=P[t],o=d.some((n=>n.productId===e.id.toString()&&n.tierIndex===t));return!!o||r<n},P=w.map(((e,t)=>d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>e+t.quantity),0))),O=(e,t,n)=>{const r=_(n);if(r===1/0)return!0;return P[n]<r},A=e=>{if(!x.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");f((t=>({...t,[e]:{loading:!0,name:n.name}})));try{const t=await(async e=>{const t=new FormData;t.append("file",e),b(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw b(!1),alert("Upload failed. Try again."),e}finally{b(!1)}})(n);f((r=>({...r,[e]:{url:t,name:n.name}})))}catch{f((t=>({...t,[e]:{error:!0,name:n.name}})))}}},document.body.appendChild(t),x.current.set(e,t)}return x.current.get(e)},F=a<=w.length?w[a-1]:null,M=F?_(a-1):0,R=w.map(((e,t)=>{const n=d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find((e=>`${e.productId}-${e.variantId}`===n));return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e}),[]);return{tier:e,items:n,count:P[t]}}));return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"20px auto",maxWidth:"1400px"}},t.createElement(Mh,{totalSteps:C,formStepIndex:E,currentStep:a,getStepTitle:e=>e===E?"Customize Gift Details":w[e-1]?.title||`Step ${e}`,isMobile:g,formTitle:e.config.form.title,onStepClick:e=>{if(e>1&&!d.length)return alert("Add at least one product first");i(e),window.scrollTo(0,0)}}),Array.from({length:C},((e,t)=>t+1)).map((n=>{const r=n===E,o=r?[]:(e=>w[e-1]?.products||[])(n),i=S?o.filter((e=>e.available)):o,l=n-1;return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(a===n?"yt-collection-bundle-step-content-active":""),style:{display:a===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:g?"180px":"160px"}},e.config.form.sections.map(((e,n)=>t.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px"}},e.title),"text"===e.type&&t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e.title,rows:3,maxLength:500,onChange:e=>f((t=>({...t,[r]:e.target.value}))),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical"}})}))),"image"===e.type&&t.createElement("div",{style:{marginBottom:"24px"}},t.createElement("sub",{style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px"}},"jpeg/png (max 5MB)"),t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n,o=m[r];return t.createElement(Ah,{key:r,title:e.title,uploadState:o,onUpload:()=>A(r).click(),onRemove:()=>f((e=>{const{[r]:t,...n}=e;return n})),onRetry:()=>A(r).click()})})))))))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:g?"grid":"flex",gridTemplateColumns:g?"repeat(2,1fr)":"",flexWrap:g?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:g?"180px":"160px"}},i.map((e=>t.createElement(Rh,{key:e.id,product:e,tierIdx:l,customizations:v,isMobile:g,hoveredCard:p,setHoveredCard:u,selectedProducts:d,handleAddToBundle:D,canAddProduct:N,allowMultipleQty:T,handleVariantChange:I,canIncrement:O,setSelectedProducts:s})))))})),t.createElement(Lh,{config:e,selectedProducts:d,selectedByTier:R,totalItems:$,totalPrice:B,totalCompareAtPrice:z,currentStep:a,formStepIndex:E,currentTierMax:M,tierSelectedCounts:P,isMobile:g,bundleAddToCartLoading:n,isUploading:y,hoveredCard:p,setHoveredCard:u,hideSelectedProducts:k,getProductStep:e=>{for(let t=0;t<w.length;t++)if(w[t].products.some((t=>t.id.toString()===e)))return t+1;return E},setCurrentStep:i,handleRemoveItem:(e,t,n)=>{s((r=>r.filter((r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))))},handleCheckout:async()=>{if(a!==E||!d.length)return;const e={};Object.entries(m).forEach((([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}));const t=d.map((t=>({variantId:t.variantId,quantity:t.quantity,properties:e})));r(t)}}))},Mh=({totalSteps:e,formStepIndex:n,currentStep:r,getStepTitle:o,isMobile:a,formTitle:i,onStepClick:l})=>t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:a?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:e},((e,t)=>t+1)).map((e=>t.createElement("div",{key:e,className:"yt-collection-bundle-step-item "+(r===e?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:r===e?1:.5,transition:"opacity 0.2s"},onClick:()=>l(e)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===e?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===e?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},e===n?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===e?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===e?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600"}},o(e)))))),i&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000"}},i)),Rh=({product:e,tierIdx:n,customizations:r,isMobile:o,hoveredCard:a,setHoveredCard:i,selectedProducts:l,handleAddToBundle:d,canAddProduct:s,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:f})=>{const[g,h]=c(!1),x=document.querySelector(`[data-product-id="${e.id}"]`),y=x?.dataset.selectedVariant||e.variants[0].id.toString(),b=e.variants.find((e=>e.id.toString()===y))||e.variants[0],v=l.some((t=>t.productId===e.id.toString()&&t.variantId===y&&t.tierIndex===n)),w=a===e.id,C=l.filter((t=>t.productId===e.id.toString()&&t.variantId===b.id.toString()&&t.tierIndex===n)).reduce(((e,t)=>e+t.quantity),0);return t.createElement(t.Fragment,null,t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":b.id,"data-current-price":b.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:o?0:"250px",maxWidth:o?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:o?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>h(!0),onMouseEnter:()=>i(e.id),onMouseLeave:()=>i(null)},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:e.images[1]||e.images[0],style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"10px",fontSize:"12px",zIndex:2},onChange:t=>u(e,t.target.value),defaultValue:b.id},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:o?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:o?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0}},"₹",(b.price/100).toFixed(0)),b.compare_at_price&&b.compare_at_price>b.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0}},"₹",(b.compare_at_price/100).toFixed(0)))),p&&C>0?t.createElement("div",{style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px"},onClick:()=>{f((t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r));return o&&o.quantity>1?t.map((e=>e===o?{...e,quantity:e.quantity-1}:e)):o?t.filter((e=>e!==o)):t}))}},"-"),t.createElement("span",{style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%"}},C),t.createElement("button",{style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px"},onClick:()=>{b.available&&m(e,b.id.toString(),n)&&f((t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r));return o?t.map((e=>e===o?{...e,quantity:e.quantity+1}:e)):[...t,{productId:e.id.toString(),variantId:b.id.toString(),price:b.price,quantity:1,tierIndex:n}]}))},disabled:!b.available||!m(e,b.id.toString(),n)},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":s(e,n)&&b.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:o?"6px":"12px",fontSize:o?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:b.available?1:.6},onClick:()=>{b.available&&s(e,n)&&d(e,n)},disabled:!b.available||!s(e,n)},v?"Added":b.available?"ADD TO BOX":"Out of Stock")),g&&t.createElement(Oh,{product:e,tierIdx:n,isOpen:g,onClose:()=>h(!1),onAddToBundle:(e,t)=>{d(e,t),h(!1)},canAdd:s(e,n),isSelected:v,customizations:r,isMobile:o}))},Lh=e=>{const{config:n,selectedProducts:r,selectedByTier:a,totalItems:i,totalPrice:d,totalCompareAtPrice:s,currentStep:p,formStepIndex:u,currentTierMax:m,tierSelectedCounts:f,isMobile:g,bundleAddToCartLoading:h,isUploading:x,hoveredCard:y,setHoveredCard:b,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E}=e,{customizations:k}=n,[T,S]=c(!0),[$,B]=c(!1),z=o(null);return l((()=>(m!==1/0&&f[p-1]===m-2&&m>1&&!$&&(B(!0),z.current=setTimeout((()=>{B(!1),z.current=null}),3e3)),()=>{z.current&&clearTimeout(z.current)})),[m,f,p]),t.createElement("div",{className:"yt-collection-bundle-bar",style:{background:k?.bundleBg||"#fff",color:k?.bundleText||"#333",border:k?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"600px",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:k?.borderRadius||"8px"}},t.createElement("div",{style:{position:"relative",textAlign:"center"}},r.length>0&&t.createElement("button",{onClick:()=>S((e=>!e)),style:{background:"#87878766",border:"none",cursor:"pointer",fontSize:"16px",padding:"4px 12px",color:"#555555",borderRadius:"0 0 28px 28px"}},T?t.createElement(gn,null):t.createElement(at,null)),$&&t.createElement(t.Fragment,null,t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),t.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:k?.atcBg||"#007bff",color:k?.atcText||"#fff",padding:"4px 8px",borderRadius:k?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)"}},"Add up to"," ",t.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),T&&r.length>0&&t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:k?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},a.filter((({count:e})=>e>0)).map((({items:e},r,o)=>t.createElement(t.Fragment,{key:r},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map(((e,o)=>{const a=n.config.builderTiers.collectionTier.flatMap((e=>e.products)).find((t=>t.id.toString()===e.productId));if(!a)return null;const i=v(e.productId),l=p===i;return t.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"65px",height:"65px",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(i)},t.createElement("img",{src:a.images[0],style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600}},"x",e.quantity),t.createElement("button",{style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},onClick:t=>{t.stopPropagation(),C(e.productId,e.variantId,r)}},"×")))})))),r<o.length-1&&o[r+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px"}},t.createElement(lt,null))))))),g?t.createElement("div",{style:{display:"flex",flexDirection:"column",padding:"4px",gap:"10px"}},t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},i," items Selected"),i>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",d.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",s.toLocaleString()))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",borderRadius:k?.borderRadius||"8px"},onClick:()=>w((e=>Math.max(1,e-1))),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===i||x?.6:1,borderRadius:k?.borderRadius||"8px"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===i||h||x},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Ph,null)):p===u?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:k?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===y&&{filter:"brightness(60%)"}},onClick:()=>w((e=>Math.max(1,e-1))),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},i," items Selected"),i>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",d.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",s.toLocaleString()))),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===i||x?.6:1,...-2===y&&{filter:"brightness(90%)"}},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===i||h||x,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Ph,null)):p===u?"Checkout":"Next")))},jh=window?.Shopify?.currency||{rate:1,active:"INR"},Vh=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*jh.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Wh=(e,t)=>t==jh.active?e:sn(jh.active)||jh.active,Hh=e=>{if(!e)return e;try{const t=new URL(e),n=t.searchParams;return n.has("format")||n.set("format","webp"),n.has("quality")||n.set("quality","70"),n.has("width")||n.set("width","600"),t.toString()}catch{const t=e.includes("?")?"&":"?";return e+t+"format=webp&quality=70&width=600"}},Uh=(e,t,n,r,o)=>{const a=r.findIndex((t=>t.variantId===e));o(0===n?e=>e.filter(((e,t)=>t!==a)):-1===a?r=>[...r,{product:t,variantId:e,quantity:n}]:e=>e.map(((e,t)=>t===a?{...e,quantity:e.quantity+n}:e)))},qh=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(lf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(df,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(bg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(Fh,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Lf,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Nh,{addToCartFunction:r,bundle:e});L(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Qh=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},"‎"),t.createElement("div",{className:"side back"},"‎"),t.createElement("div",{className:"side left"},"‎"),t.createElement("div",{className:"side right"},"‎"),t.createElement("div",{className:"side bottom"},"‎"),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},"‎"),t.createElement("div",{className:"flap south"},"‎"),t.createElement("div",{className:"flap east"},"‎"),t.createElement("div",{className:"flap west"},"‎")))));export{qh as Bundle,Qh as BundleLoader,uu as Cart,la as CouponFrame,qe as Nudge,Je as SpinnerWheel};
5087
+ `,zh=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:d,primaryProductId:s,variantId:p})=>{const[u,m]=c((()=>{const t={};return e?.forEach((({product:e,index:n})=>{let r=e?.productDetails?.options?.map((e=>e.values[0]??""));if(e.productId===s&&p){const t=e?.productDetails?.variants?.edges.find((e=>e?.node?.id?.includes(p)))?.node;t&&(r=t.title.split(" / "))}t[n]=r})),t}));l((()=>{if(!s||!p)return;const t=e?.find((({product:e})=>e?.productId===s));if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find((e=>e.node.id.includes(p)))?.node;if(o){const e=o.title.split(" / ");m((t=>({...t,[r]:e}))),g((e=>({...e,[r]:{node:o}}))),i(r,o.id)}}),[p,s,e,i]);const[f,g]=c({}),h=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const{product:a}=e?.find((e=>e.index===t))||{product:{productDetails:{variants:{edges:[]}}}};if(!a?.productDetails)return;const l=a?.productDetails?.variants?.edges?.find((e=>e.node.title===o[t].join(" / ")))?.node;l&&(i(t,l.id),g((e=>({...e,[t]:{node:l}}))))};if(!n)return null;const x=t.createElement(fh,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(gh,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(hh,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map((({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(yh,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(bh,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(vh,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(wh,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(Eh,{className:"yt-fixedBundle-variant-modal_selected-value"},u[r].join(" / "))),n.productDetails.options.map(((e,n)=>{const o=a&&a?.options?.find((t=>t.name===e.name));return e.values.length<=1?t.createElement(t.Fragment,null):o&&"color"===o?.type?t.createElement(kh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Bh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o.values.find((t=>t.name===e))?.value?t.createElement(Th,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[r][n]==e,onClick:()=>{h(r,e,n)}},t.createElement("span",null)):t.createElement(Sh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{h(r,e,n)}},e))))):o&&"image"===o?.type?t.createElement(kh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Bh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o?.values.find((t=>t.name===e))?.value?t.createElement($h,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[r][n]==e,onClick:()=>{h(r,e,n)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(Sh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{h(r,e,n)}},e))))):t.createElement(kh,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(Bh,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,o)=>t.createElement(Sh,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[r][n]==e,onClick:()=>{h(r,e,n)}},e))))})))),o<e.length-1&&t.createElement(Ch,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(xh,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(x,document.body)},Ih=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,d]=c(!1),s=o(null);l((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(ah,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(ih,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Kg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},t.createElement(Jg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!i)},t.createElement(eh,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(th,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(nh,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(rh,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),d(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(oh,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},Dh=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:d="dropdown"})=>{const[s,p]=c(r||[]);l((()=>{if(a&&e.variants.edges.some((e=>e.node.id.includes(a)))){const t=e.variants.edges.find((e=>e.node.id.includes(a)))?.node;if(t){const e=t.title.split(" / ");p(e)}}}),[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find((t=>t.name===e));return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map((e=>({name:e,value:e})));const r=n.options.find((t=>t.name===e.name));return e.values.map((e=>{const t=r?.values?.find((t=>t.name===e));return{name:e,value:t?.value||e}}))},f=(e,t)=>{const n=s[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(lh,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(ch,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Ih,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...s];r[t]=n.name,p(r);const a=e.variants.edges.find((n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t])))?.node.id;o(a||"")})(r,t)},type:u(n.name)})))))},_h=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:d,isMobile:s,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:h,primaryProductId:x,variantId:y})=>{const[b,v]=c(e?.variants?.edges.find((e=>e?.node?.id===n))?.node),[w]=c(e?.options?.map((e=>e?.values?.[0]))||[]),C=e?.id===x;l((()=>{if(y&&e.id===x){const t=e?.variants?.edges?.find((e=>e?.node?.id?.includes(y)))?.node;t&&(v(t),i(t.id))}else{const t=e?.variants?.edges?.find((e=>e?.node?.id===n))?.node;v(t)}}),[e,x,n,y,i]);const E="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,k=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===x?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(uh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(sh,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ph,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(kg,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Tg,{className:"yt-fixedBundle-product-card-horizontal_image",src:Hh(k),alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(Sg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement($g,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Bg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(zg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Wh(a.general.currencySymbol,h)," ",Vh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Ig,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Wh(a.general.currencySymbol,h),Vh(b?.compareAtPrice))),t.createElement(Dh,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:x})))):t.createElement(t.Fragment,null,t.createElement(Rg,{className:""+(e.id===x?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...E&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(mh,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:E},t.createElement(sh,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(ph,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Lg,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(jg,{className:"yt-fixedBundle-product-card_image--vertical",src:Hh(k),style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Vg,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(Wg,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Hg,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(Ug,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(qg,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Qg,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Yg,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Gg,{className:"yt-fixedBundle-product-card-vertical_price--new"},Wh(a.general.currencySymbol,h),Vh(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Ig,{className:"yt-fixedBundle-product-card-vertical_price--old"},Wh(a.general.currencySymbol,h),Vh(b?.compareAtPrice))))),(f<=3||!s)&&u<f-1&&t.createElement(Zg,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(Xg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Nh=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[d,s]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,h=e?.products?.find((e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0])),x=h?.productId,[y,b]=c(Object.fromEntries(e?.products?.map(((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),v="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),w=e?.showIndividualProductSelector||!0,[C,E]=c(new Set(e.products.reduce(((e,t,n)=>(v&&t?.productId!==x&&!w||e.push(n),e)),[])));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}}),[]),l((()=>{p&&x&&b((t=>{const n={...t};return e?.products?.forEach(((e,t)=>{e.productId===x&&(n[t.toString()]=p)})),n}))}),[p,x,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=a(((e,t)=>{b((n=>({...n,[e.toString()]:t})))}),[]),T=(t,n)=>{const r=e.products[n].productId;v&&w&&r===x||E((e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r}))},S=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),$=i((()=>e.products.some(((e,t)=>C.has(t)&&e.productDetails.variants.edges.length>1))),[e.products,C]),{originalPrice:B,dealPrice:z,offerValue:I}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t,n)=>{if(!C.has(n))return e;const r=y[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find((e=>e.node.id===r))?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);C.size===e.products.length&&(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)}}),[e.products,y,C,e.percentageOff,e.dealAmount,e.amountOff]),D=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(y).map((([e,t])=>{const n=parseInt(e);return isNaN(n)||!C.has(n)?null:t})).filter(Boolean);n&&await n(Number(B),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)},_=i((()=>e.products.map(((e,t)=>({product:e,index:t}))).filter((({index:e})=>C.has(e)))),[e.products,C]);if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!S)return t.createElement(t.Fragment,null);const N=e.customizations,P=N.fixedBundle?.cardLayoutStyle||"auto",O="horizontal"===P||"auto"===P&&d,A="bundles"==e.appName?e.pageHeader?.title:e?.title,F="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(vg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:N.fixedBundle.sectionBackgroundColor,..."transparent"!==N.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(wg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:N.fixedBundle?.titleBackgroundColor||"none",color:N.fixedBundle?.titleTextColor||"black",textAlign:N.fixedBundle.infoAlignment??"center",fontSize:N.fixedBundle?.titleFontSize,..."transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),F&&t.createElement(Cg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:N.fixedBundle?.subtitleFontSize,textAlign:N.fixedBundle.infoAlignment??"center",..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},F),O?t.createElement(Eg,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(_h,{isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>{T(e,r)},isMobile:d,index:r,isHorizontal:O,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0}))))):t.createElement(Fg,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Mg,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement(_h,{key:`${n.productId}-${r}`,isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>T(e,r),isMobile:d,index:r,isHorizontal:O,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:x,variantId:p||void 0}))),$&&t.createElement(zh,{productsWithIndices:_,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:N.general.ctaTextColor,backgroundColor:N.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:D,primaryProductId:x,variantId:p||void 0}))),t.createElement(Dg,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},Number(B)>0&&Number(I)>0&&N.fixedBundle.compareAtPriceVisibility&&t.createElement(_g,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(Pg,{className:"yt-fixedBundle-summary_price"},Wh(N.general.currencySymbol,e?.storeCurrencyCode),Vh(B))),0!==C.size&&t.createElement(Ng,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(Pg,{className:"yt-fixedBundle-summary_price"},Wh(N.general.currencySymbol,e?.storeCurrencyCode),Vh(z))," ",Number(I)>0&&t.createElement(Og,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Wh(N.general.currencySymbol,e?.storeCurrencyCode),Vh(I)))),t.createElement(Ag,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),O||!$?D(e):f(!0)},disabled:C.size<1||r,style:{backgroundColor:N.general?.ctaBackgroundColor||"#121212",color:N.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${N.general?.ctaBackgroundColor||"#121212"}`,boxShadow:N.general.ctaShadowType,paddingTop:N.general?.ctaPadding,paddingBottom:N.general?.ctaPadding,borderRadius:N.general.ctaBorderRadius,width:N.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=N.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=N.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(Yo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,N.fixedBundle?.ctaTitle??"Add Bundle to cart")))},Ph=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Oh=({product:e,tierIdx:n,isOpen:r,onClose:o,onAddToBundle:a,canAdd:i,isSelected:d,customizations:s,isMobile:p})=>{const[u,m]=c(0),[f,g]=c(e.variants[0].id.toString()),h=e.variants.find((e=>e.id.toString()===f))||e.variants[0],x=e.images.filter(Boolean);if(l((()=>(r&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""})),[r]),!r)return null;const y=t.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{style:{background:"#fff",borderRadius:s?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(ct,{size:22})),t.createElement("div",{style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:s?.borderRadius||"12px"}},x.length>0&&t.createElement("img",{src:h.featured_image?.src||x[u]||e.images[0],alt:e.title,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:s?.borderRadius||"12px"}}),x.length>1&&t.createElement("div",{style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map(((e,n)=>t.createElement("div",{key:n,onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer",display:"block"}}))))),t.createElement("div",{style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},t.createElement("h2",{style:{margin:"0 0 12px",fontSize:24,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{style:{position:"relative"}},t.createElement("div",{style:{padding:"8px 0",borderBottom:"1px solid #eee"}},e?.options?.join(" & "),":"," ",t.createElement("strong",null,h.title)),t.createElement("select",{value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toFixed(0))),t.createElement("div",{style:{position:"sticky",bottom:0,background:"white"}},t.createElement("button",{onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:h.available?d||!i?"#28a745":s?.atcBg||"#007bff":"rgb(204, 204, 204)",color:s?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed"}},d?"Added to Box":h.available?"Add to Box":"Out of Stock")),e.description&&t.createElement("div",{dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}})))),b=t.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:o},t.createElement("div",{style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{onClick:o,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(ct,{size:22})),t.createElement("div",{style:{flex:1,overflowY:"auto",paddingBottom:100}},x.length>0&&t.createElement("div",{style:{position:"relative"}},t.createElement("img",{src:h.featured_image?.src||x[u]||e.images[0],alt:e.title,style:{width:"100%",display:"block",maxHeight:"50vh",objectFit:"cover",objectPosition:"center"}}),x.length>1&&t.createElement("div",{style:{position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,background:"rgba(0,0,0,0.4)",padding:"6px 12px",borderRadius:20}},x.map(((e,n)=>t.createElement("div",{key:n,onClick:()=>m(n),style:{width:10,height:10,borderRadius:"50%",background:n===u?"#fff":"#fff8",cursor:"pointer"}}))))),t.createElement("div",{style:{padding:"20px"}},t.createElement("h2",{style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},e.title),e.variants.length>1&&t.createElement("div",{style:{position:"relative",marginBottom:20}},t.createElement("div",{style:{padding:"8px 0",borderBottom:"1px solid #eee"}},"Variant: ",t.createElement("strong",null,h.title)),t.createElement("select",{value:f,onChange:e=>g(e.target.value),style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toFixed(0),h.compare_at_price&&h.compare_at_price>h.price&&t.createElement("span",{style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toFixed(0))),e.description&&t.createElement("div",{dangerouslySetInnerHTML:{__html:e.description},style:{lineHeight:1.7,color:"#444"}}))),t.createElement("div",{style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},t.createElement("button",{onClick:()=>a(e,n),disabled:!i||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:s?.borderRadius||"8px",background:!d&&i&&h.available?s?.atcBg||"#007bff":"#28a745",color:s?.atcText||"#fff",cursor:i&&h.available?"pointer":"not-allowed"}},d?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return v.createPortal(p?b:y,document.body)},Ah=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(Ph,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{margin:"12px 0"}},t.createElement("img",{src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},Fh=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[a,i]=c(1),[d,s]=c([]),[p,u]=c(null),[m,f]=c({}),[g,h]=c(window.innerWidth<640),x=o(new Map),[y,b]=c(!1);l((()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>h(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[]);const{customizations:v}=e,w=e.config.builderTiers.collectionTier.sort(((e,t)=>e.tier-t.tier)),C=w.length+1,E=C,k=v.hideSelectedProducts,T=v.allowMultipleQty,S=v.hideOutOfStockProducts,$=d.reduce(((e,t)=>e+t.quantity),0),B=d.reduce(((e,t)=>e+t.price*t.quantity),0)/100,z=d.reduce(((e,t)=>{const n=w.flatMap((e=>e.products)).find((e=>e.id.toString()===t.productId)),r=n?.variants.find((e=>e.id.toString()===t.variantId));return e+(r?.compare_at_price??t.price)*t.quantity}),0)/100,I=(e,t)=>{const n=e.variants.find((e=>e.id===parseInt(t)));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())},D=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());s((n=>{const a=`${e.id}-${r}-${t}`,i=n.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a));if(i)return n.filter((e=>e!==i));const l=P[t],c=_(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]}))},_=e=>{const t=w[e];return t.minimumQuantity>0?t.minimumQuantity:1/0},N=(e,t)=>{const n=_(t);if(n===1/0)return!0;const r=P[t],o=d.some((n=>n.productId===e.id.toString()&&n.tierIndex===t));return!!o||r<n},P=w.map(((e,t)=>d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>e+t.quantity),0))),O=(e,t,n)=>{const r=_(n);if(r===1/0)return!0;return P[n]<r},A=e=>{if(!x.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");f((t=>({...t,[e]:{loading:!0,name:n.name}})));try{const t=await(async e=>{const t=new FormData;t.append("file",e),b(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw b(!1),alert("Upload failed. Try again."),e}finally{b(!1)}})(n);f((r=>({...r,[e]:{url:t,name:n.name}})))}catch{f((t=>({...t,[e]:{error:!0,name:n.name}})))}}},document.body.appendChild(t),x.current.set(e,t)}return x.current.get(e)},F=a<=w.length?w[a-1]:null,M=F?_(a-1):0,R=w.map(((e,t)=>{const n=d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find((e=>`${e.productId}-${e.variantId}`===n));return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e}),[]);return{tier:e,items:n,count:P[t]}}));return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"20px auto",maxWidth:"1400px"}},t.createElement(Mh,{totalSteps:C,formStepIndex:E,currentStep:a,getStepTitle:e=>e===E?"Customize Gift Details":w[e-1]?.title||`Step ${e}`,isMobile:g,formTitle:e.config.form.title,onStepClick:e=>{if(e>1&&!d.length)return alert("Add at least one product first");i(e),window.scrollTo(0,0)}}),Array.from({length:C},((e,t)=>t+1)).map((n=>{const r=n===E,o=r?[]:(e=>w[e-1]?.products||[])(n),i=S?o.filter((e=>e.available)):o,l=n-1;return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(a===n?"yt-collection-bundle-step-content-active":""),style:{display:a===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:g?"180px":"160px"}},e.config.form.sections.map(((e,n)=>t.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px"}},e.title),"text"===e.type&&t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e.title,rows:3,maxLength:500,onChange:e=>f((t=>({...t,[r]:e.target.value}))),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical"}})}))),"image"===e.type&&t.createElement("div",{style:{marginBottom:"24px"}},t.createElement("sub",{style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px"}},"jpeg/png (max 5MB)"),t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n,o=m[r];return t.createElement(Ah,{key:r,title:e.title,uploadState:o,onUpload:()=>A(r).click(),onRemove:()=>f((e=>{const{[r]:t,...n}=e;return n})),onRetry:()=>A(r).click()})})))))))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:g?"grid":"flex",gridTemplateColumns:g?"repeat(2,1fr)":"",flexWrap:g?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:g?"180px":"160px"}},i.map((e=>t.createElement(Rh,{key:e.id,product:e,tierIdx:l,customizations:v,isMobile:g,hoveredCard:p,setHoveredCard:u,selectedProducts:d,handleAddToBundle:D,canAddProduct:N,allowMultipleQty:T,handleVariantChange:I,canIncrement:O,setSelectedProducts:s})))))})),t.createElement(Lh,{config:e,selectedProducts:d,selectedByTier:R,totalItems:$,totalPrice:B,totalCompareAtPrice:z,currentStep:a,formStepIndex:E,currentTierMax:M,tierSelectedCounts:P,isMobile:g,bundleAddToCartLoading:n,isUploading:y,hoveredCard:p,setHoveredCard:u,hideSelectedProducts:k,getProductStep:e=>{for(let t=0;t<w.length;t++)if(w[t].products.some((t=>t.id.toString()===e)))return t+1;return E},setCurrentStep:i,handleRemoveItem:(e,t,n)=>{s((r=>r.filter((r=>!(r.productId===e&&r.variantId===t&&r.tierIndex===n)))))},handleCheckout:async()=>{if(a!==E||!d.length)return;const e={};Object.entries(m).forEach((([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}));const t=d.map((t=>({variantId:t.variantId,quantity:t.quantity,properties:e})));r(t)}}))},Mh=({totalSteps:e,formStepIndex:n,currentStep:r,getStepTitle:o,isMobile:a,formTitle:i,onStepClick:l})=>t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:a?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:e},((e,t)=>t+1)).map((e=>t.createElement("div",{key:e,className:"yt-collection-bundle-step-item "+(r===e?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:r===e?1:.5,transition:"opacity 0.2s"},onClick:()=>l(e)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===e?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===e?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},e===n?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===e?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===e?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600"}},o(e)))))),i&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000"}},i)),Rh=({product:e,tierIdx:n,customizations:r,isMobile:o,hoveredCard:a,setHoveredCard:i,selectedProducts:l,handleAddToBundle:d,canAddProduct:s,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:f})=>{const[g,h]=c(!1),x=document.querySelector(`[data-product-id="${e.id}"]`),y=x?.dataset.selectedVariant||e.variants[0].id.toString(),b=e.variants.find((e=>e.id.toString()===y))||e.variants[0],v=l.some((t=>t.productId===e.id.toString()&&t.variantId===y&&t.tierIndex===n)),w=a===e.id,C=l.filter((t=>t.productId===e.id.toString()&&t.variantId===b.id.toString()&&t.tierIndex===n)).reduce(((e,t)=>e+t.quantity),0);return t.createElement(t.Fragment,null,t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":b.id,"data-current-price":b.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:o?0:"250px",maxWidth:o?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:o?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>h(!0),onMouseEnter:()=>i(e.id),onMouseLeave:()=>i(null)},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:e.images[1]||e.images[0],style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"10px",fontSize:"12px",zIndex:2},onChange:t=>u(e,t.target.value),defaultValue:b.id},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:o?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:o?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0}},"₹",(b.price/100).toFixed(0)),b.compare_at_price&&b.compare_at_price>b.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0}},"₹",(b.compare_at_price/100).toFixed(0)))),p&&C>0?t.createElement("div",{style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},t.createElement("button",{style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px"},onClick:()=>{f((t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r));return o&&o.quantity>1?t.map((e=>e===o?{...e,quantity:e.quantity-1}:e)):o?t.filter((e=>e!==o)):t}))}},"-"),t.createElement("span",{style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%"}},C),t.createElement("button",{style:{width:"40%",height:b.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:o?"6px":"12px",fontSize:o?"12px":"14px"},onClick:()=>{b.available&&m(e,b.id.toString(),n)&&f((t=>{const r=`${e.id}-${b.id}-${n}`,o=t.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===r));return o?t.map((e=>e===o?{...e,quantity:e.quantity+1}:e)):[...t,{productId:e.id.toString(),variantId:b.id.toString(),price:b.price,quantity:1,tierIndex:n}]}))},disabled:!b.available||!m(e,b.id.toString(),n)},"+")):t.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":s(e,n)&&b.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:o?"6px":"12px",fontSize:o?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:b.available?1:.6},onClick:()=>{b.available&&s(e,n)&&d(e,n)},disabled:!b.available||!s(e,n)},v?"Added":b.available?"ADD TO BOX":"Out of Stock")),g&&t.createElement(Oh,{product:e,tierIdx:n,isOpen:g,onClose:()=>h(!1),onAddToBundle:(e,t)=>{d(e,t),h(!1)},canAdd:s(e,n),isSelected:v,customizations:r,isMobile:o}))},Lh=e=>{const{config:n,selectedProducts:r,selectedByTier:a,totalItems:i,totalPrice:d,totalCompareAtPrice:s,currentStep:p,formStepIndex:u,currentTierMax:m,tierSelectedCounts:f,isMobile:g,bundleAddToCartLoading:h,isUploading:x,hoveredCard:y,setHoveredCard:b,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E}=e,{customizations:k}=n,[T,S]=c(!0),[$,B]=c(!1),z=o(null);return l((()=>(m!==1/0&&f[p-1]===m-2&&m>1&&!$&&(B(!0),z.current=setTimeout((()=>{B(!1),z.current=null}),3e3)),()=>{z.current&&clearTimeout(z.current)})),[m,f,p]),t.createElement("div",{className:"yt-collection-bundle-bar",style:{background:k?.bundleBg||"#fff",color:k?.bundleText||"#333",border:k?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"600px",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:k?.borderRadius||"8px"}},t.createElement("div",{style:{position:"relative",textAlign:"center"}},r.length>0&&t.createElement("button",{onClick:()=>S((e=>!e)),style:{background:"#87878766",border:"none",cursor:"pointer",fontSize:"16px",padding:"4px 12px",color:"#555555",borderRadius:"0 0 28px 28px"}},T?t.createElement(gn,null):t.createElement(at,null)),$&&t.createElement(t.Fragment,null,t.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),t.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:k?.atcBg||"#007bff",color:k?.atcText||"#fff",padding:"4px 8px",borderRadius:k?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)"}},"Add up to"," ",t.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),T&&r.length>0&&t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:k?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},a.filter((({count:e})=>e>0)).map((({items:e},r,o)=>t.createElement(t.Fragment,{key:r},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map(((e,o)=>{const a=n.config.builderTiers.collectionTier.flatMap((e=>e.products)).find((t=>t.id.toString()===e.productId));if(!a)return null;const i=v(e.productId),l=p===i;return t.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"65px",height:"65px",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(i)},t.createElement("img",{src:a.images[0],style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${k?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600}},"x",e.quantity),t.createElement("button",{style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},onClick:t=>{t.stopPropagation(),C(e.productId,e.variantId,r)}},"×")))})))),r<o.length-1&&o[r+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px"}},t.createElement(lt,null))))))),g?t.createElement("div",{style:{display:"flex",flexDirection:"column",padding:"4px",gap:"10px"}},t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},i," items Selected"),i>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",d.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",s.toLocaleString()))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",borderRadius:k?.borderRadius||"8px"},onClick:()=>w((e=>Math.max(1,e-1))),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===i||x?.6:1,borderRadius:k?.borderRadius||"8px"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===i||h||x},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Ph,null)):p===u?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:k?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===y&&{filter:"brightness(60%)"}},onClick:()=>w((e=>Math.max(1,e-1))),onMouseEnter:()=>b(-1),onMouseLeave:()=>b(null),disabled:1===p},"Back"),t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:r.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},i," items Selected"),i>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",d.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",s.toLocaleString()))),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===i||x?"yt-collection-bundle-next-btn-disabled":""),style:{background:k?.btnPrimaryBg||"#28a745",color:k?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===i||x?.6:1,...-2===y&&{filter:"brightness(90%)"}},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===i||h||x,onMouseEnter:()=>b(-2),onMouseLeave:()=>b(null)},h?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(Ph,null)):p===u?"Checkout":"Next")))},jh=window?.Shopify?.currency||{rate:1,active:"INR"},Vh=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*jh.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Wh=(e,t)=>t==jh.active?e:sn(jh.active)||jh.active,Hh=e=>{if(!e)return e;try{const t=new URL(e),n=t.searchParams;return n.has("format")||n.set("format","webp"),n.has("quality")||n.set("quality","70"),n.has("width")||n.set("width","600"),t.toString()}catch{const t=e.includes("?")?"&":"?";return e+t+"format=webp&quality=70&width=600"}},Uh=(e,t,n,r,o)=>{const a=r.findIndex((t=>t.variantId===e));o(0===n?e=>e.filter(((e,t)=>t!==a)):-1===a?r=>[...r,{product:t,variantId:e,quantity:n}]:e=>e.map(((e,t)=>t===a?{...e,quantity:e.quantity+n}:e)))},qh=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(lf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(df,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(bg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(Fh,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Lf,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(Nh,{addToCartFunction:r,bundle:e});L(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Qh=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},"‎"),t.createElement("div",{className:"side back"},"‎"),t.createElement("div",{className:"side left"},"‎"),t.createElement("div",{className:"side right"},"‎"),t.createElement("div",{className:"side bottom"},"‎"),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},"‎"),t.createElement("div",{className:"flap south"},"‎"),t.createElement("div",{className:"flap east"},"‎"),t.createElement("div",{className:"flap west"},"‎")))));export{qh as Bundle,Qh as BundleLoader,uu as Cart,la as CouponFrame,qe as Nudge,Je as SpinnerWheel};
@@ -83,7 +83,6 @@ export type ProductDetails = {
83
83
  status: "active" | "archived" | "draft" | "";
84
84
  options: ProductOption[];
85
85
  onlineStoreUrl: string;
86
- tracksInventory?: boolean;
87
86
  collections: {
88
87
  edges: CollectionNode[];
89
88
  };
@@ -336,6 +335,7 @@ export type BundlePayload = {
336
335
  customStoreDetails?: {
337
336
  [key: string]: any;
338
337
  };
338
+ customProductsQuantity?: number | null;
339
339
  reviewRatingType?: "none" | "ratingOnly" | "ratingAndReviewCount";
340
340
  appName?: string;
341
341
  pageHeader?: {
@@ -1,7 +1,7 @@
1
1
  import "../bundle.scss";
2
2
  import React from "react";
3
3
  import { BundlePayload, ProductDetails } from "../Bundle";
4
- export declare function QuantitySelectorForBundle({ quantity, setQuantity, remainingQuantity, handleAddToBundle, variantId, product, handleRemoveItem, hideAddToBundle, selectedVariantInventoryQty, }: {
4
+ export declare function QuantitySelectorForBundle({ quantity, setQuantity, remainingQuantity, handleAddToBundle, variantId, product, handleRemoveItem, hideAddToBundle, disableInventoryTracking, selectedVariantInventoryQty, }: {
5
5
  quantity: number;
6
6
  setQuantity: React.Dispatch<React.SetStateAction<number>>;
7
7
  remainingQuantity: number;
@@ -10,6 +10,7 @@ export declare function QuantitySelectorForBundle({ quantity, setQuantity, remai
10
10
  product?: ProductDetails;
11
11
  handleRemoveItem?: (variantId: string, quantity: number) => void;
12
12
  hideAddToBundle?: boolean;
13
+ disableInventoryTracking?: boolean;
13
14
  selectedVariantInventoryQty: number;
14
15
  }): React.JSX.Element;
15
16
  type BundleBuilderProps = {
package/dist/index.d.ts CHANGED
@@ -156,7 +156,6 @@ type ProductDetails = {
156
156
  status: "active" | "archived" | "draft" | "";
157
157
  options: ProductOption[];
158
158
  onlineStoreUrl: string;
159
- tracksInventory?: boolean;
160
159
  collections: {
161
160
  edges: CollectionNode[];
162
161
  };
@@ -409,6 +408,7 @@ type BundlePayload = {
409
408
  customStoreDetails?: {
410
409
  [key: string]: any;
411
410
  };
411
+ customProductsQuantity?: number | null;
412
412
  reviewRatingType?: "none" | "ratingOnly" | "ratingAndReviewCount";
413
413
  appName?: string;
414
414
  pageHeader?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.7.413-tracks-inventory.0",
3
+ "version": "0.7.4123",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "tsc && rollup -c",