yt-uikit 0.8.91 → 0.8.92

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.
@@ -80,6 +80,7 @@ export type BundleConfig = {
80
80
  discountData: DiscountData;
81
81
  }[];
82
82
  };
83
+ splitVariants?: boolean;
83
84
  form?: {
84
85
  title?: string;
85
86
  sections?: {
@@ -10,6 +10,7 @@ type ProductDetailsModalProps = {
10
10
  isSelected: boolean;
11
11
  customizations: BundleConfig["customizations"];
12
12
  isMobile: boolean;
13
+ splitVariants?: boolean;
13
14
  };
14
- export declare const ProductDetailsModal: ({ product, tierIdx, isOpen, onClose, onAddToBundle, canAdd, isSelected, customizations, isMobile, }: ProductDetailsModalProps) => React.ReactPortal | null;
15
+ export declare const ProductDetailsModal: ({ product, tierIdx, isOpen, onClose, onAddToBundle, canAdd, isSelected, customizations, isMobile, splitVariants, }: ProductDetailsModalProps) => React.ReactPortal | null;
15
16
  export {};
package/dist/esm/index.js CHANGED
@@ -4659,7 +4659,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4659
4659
  }
4660
4660
  `,lp=c.span`
4661
4661
  font-size: 12px;
4662
- `,cp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},s(o,r.id))}),x(e),y(t)},[r,p,u,s,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),s(n,o.id)}},[u,p,r,s,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(s(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(Ud,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(Yd,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Gd,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(Zd,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(Kd,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Jd,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(ep,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(np,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name),a=o.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[r]===e));return 0===a.length||1===a.length&&"Default Title"===a[0]?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(op,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(rp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(ip,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(op,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(ap,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(ip,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(op,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(ip,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(tp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(Xd,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return P.createPortal(v,document.body)},sp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,s]=t(!1),d=r(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(jd,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Wd,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Ad,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(_d,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(Rd,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(Od,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Ld,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Md,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{t.disabled||(a(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(Vd,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},dp=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:s="dropdown"})=>{const[d,p]=t(i||[]);n(()=>{i&&i.length>0&&p(i)},[i]),n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{const n=d[t];if(!n)return null;return g(e,t).find(e=>e.name===n)||null},g=(e,t)=>{const n=r?.options?.find(t=>t.name===e.name);return e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const r=n?.values?.find(t=>t.name===e),i=!((e,t,n)=>{const o=[...d||[]];o[e]=t;const r=o.join(" / "),i=n.variants.edges.find(e=>e.node.title===r)?.node;return!!i&&((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0})(n,i.id)>0})(t,e,o);return{name:e,value:r?.value||e,disabled:i}})};return e.createElement(Hd,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>{const r=g(t,n);return 0===r.length||1===r.length&&"Default Title"===r[0].name?null:e.createElement(qd,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(sp,{options:r,selectedValue:m(t,n),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))}))},pp=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[r]),[$,B]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),N=o(()=>$?.title?.split(" / ")||[],[$]),I=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(B(e),d(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;B(e)}},[r,h,a,v,d,S]);const z=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[r,d]),F=s?.fixedBundle?.discountBadgeDisplay,D=parseFloat($?.price??"0"),P=w?.size===k,A=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(D,E,C??0,w?.size,k,T),_=P?A:parseFloat($?.price??"0"),R="discount-on-compare"===F?parseFloat($?.compareAtPrice||$?.price||"0"):parseFloat($?.price??"0"),O=!1!==s?.fixedBundle?.discountBadgeVisibility&&(R>_&&s?.fixedBundle?.compareAtPriceVisibility||"discount-on-compare"===F&&s?.fixedBundle?.compareAtPriceVisibility),L=_.toFixed(2),M="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,V=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(ld,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(cd,{className:"yt-fixedBundle-product-card-horizontal_image",src:Tp(V),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(sd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(dd,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(pd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(ud,{className:"yt-fixedBundle-product-card-horizontal_price--new"},kp(s.general.currencySymbol,b)," ",Ep(L)),O&&R>_&&e.createElement(md,{className:"yt-fixedBundle-product-card-horizontal_price--old"},kp(s.general.currencySymbol,b),Ep(R))),e.createElement(dp,{product:r,variantOptions:x,selectedVariants:N,onVariantChange:z,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(Cd,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...M&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(Qd,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:M},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(Ed,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(kd,{className:"yt-fixedBundle-product-card_image--vertical",src:Tp(V),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Td,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Sd,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement($d,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(Bd,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Nd,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Id,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(Fd,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(zd,{className:"yt-fixedBundle-product-card-vertical_price--new"},kp(s.general.currencySymbol,b),Ep(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(md,{className:"yt-fixedBundle-product-card-vertical_price--old"},kp(s.general.currencySymbol,b),Ep(R))))),(f<=3||!u)&&g<f-1&&e.createElement(Dd,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Pd,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},up=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),f="undefined"!=typeof window?window.location.href:null,y=r?.products?.find(e=>e.productDetails?.handle===f?.split("/").pop()?.split("?")[0]),b=y?.productId,h=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[v,w]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>h(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),C="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain),E=r?.showIndividualProductSelector??!0,[k,T]=t(new Set(r.products.reduce((e,t,n)=>(C&&t?.productId!==b&&!E||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&b&&w(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===b&&(t[n.toString()]=u)}),t})},[u,b,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=i((e,t)=>{w(n=>({...n,[e.toString()]:t}))},[]),$=(e,t)=>{const n=r.products[t].productId;C&&n===b||T(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},B=o(()=>(e,t)=>h(e.productDetails,t)>0,[h]),N=o(()=>r.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[r.products,k]),{originalPrice:I,dealPrice:z,offerValue:F}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!k.has(n))return e;const o=v[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n="discount-on-compare"===(r?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?t:e;let o=e;k.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=n-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,v,k,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),D=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[r.products,k]),P=D.every(({product:e,index:t})=>B(e,v[t.toString()])),A=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(k.has(n)){const o=v[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,k,v]),_=async e=>{if(P){e.preventDefault(),e.stopPropagation(),s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:D?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const e=Object.entries(v).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);a&&await a(Number(I),e)}catch(e){console.error("Error adding to cart:",e)}s(!1)}};if(!a)return e.createElement(e.Fragment,null);const R=r.customizations,O=R.fixedBundle?.cardLayoutStyle||"auto",L="horizontal"===O||"auto"===O&&d,M="bundles"==r.appName?r.pageHeader?.title:r?.title,V="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(od,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:R.fixedBundle.sectionBackgroundColor,..."transparent"!==R.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&e.createElement(rd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:R.fixedBundle?.titleBackgroundColor||"none",color:R.fixedBundle?.titleTextColor||"black",textAlign:R.fixedBundle.infoAlignment??"center",fontSize:R.fixedBundle?.titleFontSize,..."transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),V&&e.createElement(id,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:R.fixedBundle?.subtitleFontSize,textAlign:R.fixedBundle.infoAlignment??"center",..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},V),L?e.createElement(ad,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(pp,{isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>S(n,e),onCheckChange:e=>{$(e,n)},isMobile:d,index:n,isHorizontal:L,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})))):e.createElement(vd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(wd,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(pp,{key:`${t.productId}-${n}`,isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>{S(n,e)},onCheckChange:e=>$(e,n),isMobile:d,index:n,isHorizontal:L,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})),N&&e.createElement(cp,{productsWithIndices:D,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:R.general.ctaTextColor,backgroundColor:R.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:_,primaryProductId:b,variantId:u||void 0}))),e.createElement(gd,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},Number(I)>0&&Number(F)>0&&R.fixedBundle.compareAtPriceVisibility&&e.createElement(xd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(yd,{className:"yt-fixedBundle-summary_price"},kp(R.general.currencySymbol,r?.storeCurrencyCode),Ep(I))),0!==k.size&&e.createElement(fd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(yd,{className:"yt-fixedBundle-summary_price"},kp(R.general.currencySymbol,r?.storeCurrencyCode),Ep(z))," ",Number(F)>0&&e.createElement(bd,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",kp(R.general.currencySymbol,r?.storeCurrencyCode),Ep(F)))),e.createElement(hd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),L||!N?_(e):x(!0)},disabled:k.size<1||c||!P,style:{backgroundColor:R.general?.ctaBackgroundColor||"#121212",color:R.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${R.general?.ctaBackgroundColor||"#121212"}`,boxShadow:R.general.ctaShadowType,paddingTop:R.general?.ctaPadding,paddingBottom:R.general?.ctaPadding,borderRadius:R.general.ctaBorderRadius,width:R.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=R.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=R.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ue,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):P?e.createElement(e.Fragment,null,R.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")))},mp=()=>e.createElement(e.Fragment,null,e.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),e.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),gp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p})=>{const[u,m]=t(0),[g,x]=t(o.variants[0]?.id.toString()||""),[f,y]=t(!0),b=o.variants.find(e=>e.id.toString()===g)||o.variants[0],h=o.images.filter(Boolean),v=()=>{h.length<=1||(m(e=>0===e?h.length-1:e-1),y(!0))},w=()=>{h.length<=1||(m(e=>e===h.length-1?0:e+1),y(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(b&&b?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=Tp(b?.featured_image?.src);e?.setAttribute("src",t)}},[b]),!i)return null;const C=h.length>1,E=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},h.length>0&&e.createElement(e.Fragment,null,f&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),f&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:Tp(h[u]||o.images[0]),alt:o.title,onLoad:()=>y(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:f?0:1,transition:"opacity 0.3s"}}),C&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:v,disabled:0===u,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===u?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===u?.5:1}},e.createElement(Z,{size:24})),e.createElement("button",{onClick:w,disabled:u===h.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:u===h.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:u===h.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:u===h.length-1?.5:1}},e.createElement(L,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},o.title),o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:g,onChange:e=>{x(e.target.value),y(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(b.price/100).toLocaleString(),b.compare_at_price&&b.compare_at_price>b.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(b.compare_at_price/100).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!b.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:b.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},h.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},f&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:h[u]||o.images[0],alt:o.title,onLoad:()=>y(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:f?0:1,transition:"opacity 0.3s"}}),C&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:v,disabled:0===u,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===u?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===u?.5:1,cursor:0===u?"not-allowed":"pointer"}},e.createElement(Z,{size:20})),e.createElement("button",{onClick:w,disabled:u===h.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:u===h.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:u===h.length-1?.5:1,cursor:u===h.length-1?"not-allowed":"pointer"}},e.createElement(L,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,b.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:g,onChange:e=>{x(e.target.value),y(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(b.price/100).toLocaleString(),b.compare_at_price?b.compare_at_price>b.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(b.compare_at_price/100).toLocaleString()):null),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!b.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&b.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&b.available?"pointer":"not-allowed"}},s?"Added to Box":b.available?"Add to Box":"Out of Stock"))));return P.createPortal(p?k:E,document.body)},xp=({title:t,uploadState:n,onUpload:o,onRemove:r,onRetry:i})=>{const a="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return e.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},e.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},t),a&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},e.createElement(mp,null)," Uploading ",n?.name,"...")),l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:i,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!a&&!l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},e.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),e.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:r,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:o,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},fp=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(c,.07):"transparent",borderBottom:i?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=c)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>{const i=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?i:"#e0e0e0"}`,borderRadius:l,backgroundColor:r===o?i:"white",color:r===o?"white":"#333",cursor:"pointer"}},o.charAt(0).toUpperCase()+o.slice(1))})))},yp=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},bp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[u,m]=t([]),[g,x]=t(null),[f,y]=t({}),[b,h]=t(window.innerWidth<640),[v,w]=t({}),C=r(new Map),[E,k]=t(!1),T=r(null),S=r(new Map),[$,B]=t(160),N=b?8:20,{customizations:I}=o,z=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),F=!!o.config.form,D=z.length+(F?1:0),P=I.hideSelectedProducts,A=I.allowMultipleQty,_=I.hideOutOfStockProducts,R=i((e,t=d)=>{const n=z[e-1]?.products||[],o="All"===t?n:n.filter(e=>yp(e).includes(t));return _?o.filter(e=>e.available):o},[z,d,_]),O=i(e=>{const t=R(e).length;w(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,R]);n(()=>(T.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&O(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{T.current?.disconnect()}),[O,c]),n(()=>{p("All")},[c]),n(()=>{if(F&&c===D)return;const e=c,t=R(e).length;w(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(N,t),[`${e}_category`]:d}:n})},[c,N,d,R]),n(()=>{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 L=i(e=>{B(e+10)},[]),M=u.reduce((e,t)=>e+t.quantity,0),V=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,j=u.reduce((e,t)=>{const n=z.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.compare_at_price??t.price)*t.quantity},0)/100,W=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},H=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());m(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=U[t],c=q(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},q=e=>{const t=z[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},Q=(e,t)=>{const n=q(t);if(n===1/0)return!0;const o=U[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},U=z.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),Y=(e,t,n)=>{const o=q(n);if(o===1/0)return!0;return U[n]<o},G=e=>{if(!C.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");y(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),k(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",o=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!o.ok)throw new Error("Upload failed");return(await o.json()).url}catch(e){throw k(!1),alert("Upload failed. Try again."),e}finally{k(!1)}})(n);y(o=>({...o,[e]:{url:t,name:n.name}}))}catch{y(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),C.current.set(e,t)}return C.current.get(e)},X=F&&c===D,Z=(X?null:z[c-1])?q(c-1):0,K=z.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:U[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},I.headerImage&&!I.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:I.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),I.showTierSteps&&e.createElement("div",{style:{paddingTop:I.headerImage&&!I.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(hp,{totalSteps:D,isFormStep:X,currentStep:c,getStepTitle:e=>F&&e===D?"Customize Gift Details":z[e-1]?.title||`Step ${e}`,isMobile:b,formTitle:o?.config?.form?.title,hasForm:F,onStepClick:e=>{if(e>1&&!u.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:D},(e,t)=>t+1).map(t=>{const n=F&&t===D,r=n?[]:(e=>z[e-1]?.products||[])(t);let i=[];if(!n&&I.enableProductCategories){const e=new Set;r.forEach(t=>yp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const a=n?[]:R(t),l=t-1,s=a.slice(0,v[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${$}px`}},o?.config?.form?.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},e.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement("textarea",{key:o,className:"yt-collection-bundle-textarea",placeholder:t?.title,rows:3,maxLength:500,onChange:e=>y(t=>({...t,[o]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===t.type&&e.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},e.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n,r=f[o];return e.createElement(xp,{key:o,title:t?.title,uploadState:r,onUpload:()=>G(o).click(),onRemove:()=>y(e=>{const{[o]:t,...n}=e;return n}),onRetry:()=>G(o).click()})})))))):e.createElement(e.Fragment,null,I.enableProductCategories&&i.length>0&&e.createElement(fp,{styles:I,isMobile:b,categories:i,activeCategory:d,onCategoryChange:p}),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:b?"grid":"flex",gridTemplateColumns:b?"repeat(2,1fr)":"",flexWrap:b?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${$}px`}},s.map(t=>e.createElement(vp,{key:t.id,product:t,tierIdx:l,customizations:I,isMobile:b,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:H,canAddProduct:Q,allowMultipleQty:A,handleVariantChange:W,canIncrement:Y,setSelectedProducts:m})),c===t&&(v[t]||0)<a.length&&e.createElement("div",{ref:e=>{const n=S.current.get(t);n&&T.current?.unobserve(n),e?(S.current.set(t,e),T.current?.observe(e)):S.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))))}),e.createElement(wp,{config:o,selectedProducts:u,selectedByTier:K,totalItems:M,totalPrice:V,totalCompareAtPrice:j,currentStep:c,totalSteps:D,currentTierMax:Z,tierSelectedCounts:U,isMobile:b,bundleAddToCartLoading:a,isUploading:E,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:P,getProductStep:e=>{for(let t=0;t<z.length;t++)if(z[t].products.some(t=>t.id.toString()===e))return t+1;return F?D:z.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{m(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},handleCheckout:async()=>{if(c!==D||!u.length)return;const e={};F&&Object.entries(f).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},hasForm:F,onHeightChange:L}))},hp=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!a||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},vp=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g})=>{const[x,f]=t(!1),y=document.querySelector(`[data-product-id="${n.id}"]`),b=y?.dataset.selectedVariant||n.variants[0].id.toString(),h=n.variants.find(e=>e.id.toString()===b)||n.variants[0],v=c.some(e=>e.productId===n.id.toString()&&e.variantId===b&&e.tierIndex===o),w=a===n.id,C=c.filter(e=>e.productId===n.id.toString()&&e.variantId===h.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:n.id,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":h.id,"data-current-price":h.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:i?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>f(!0),onMouseEnter:()=>l(n.id),onMouseLeave:()=>l(null)},e.createElement("img",{src:Tp(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?0:1,transform:w?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:Tp(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:w?1:0,transform:"scale(1.05)"},alt:n.title}),n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:h.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},r.productCardCategoryVisibility&&yp(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},yp(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:i?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),yp(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",yp(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:1}},n.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(h.price/100).toLocaleString()),h.compare_at_price&&0!==h.compare_at_price&&h.compare_at_price>h.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()):null)),p&&C>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:h.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${h.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},C),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:h.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{h.available&&m(n,h.id.toString(),o)&&g(e=>{const t=`${n.id}-${h.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:h.id.toString(),price:h.price,quantity:1,tierIndex:o}]})},disabled:!h.available||!m(n,h.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(v?"yt-collection-bundle-add-btn-added":""),style:{background:v?"#28a745":d(n,o)&&h.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:h.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{h.available&&d(n,o)&&s(n,o)},disabled:!h.available||!d(n,o)},v?"Added":h.available?"ADD TO BOX":"Out of Stock")),x&&e.createElement(gp,{product:n,tierIdx:o,isOpen:x,onClose:()=>f(!1),onAddToBundle:(e,t)=>{s(e,t),f(!1)},canAdd:d(n,o),isSelected:v,customizations:r,isMobile:i}))},wp=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,B]=t(!1),N=r(null),I=r(null),{totalOriginal:z,hasSavings:F,formattedSavings:D,totalAfterDiscount:P}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(N.current&&T){const e=N.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(I.current??0)&&(I.current=e),e>(I.current??0)){I.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:N,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:Tp(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(U,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",z.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(mp,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",z.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(mp,null)):p===u?"Checkout":"Next")))},Cp=window?.Shopify?.currency||{rate:1,active:"INR"},Ep=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Cp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},kp=(e,t)=>t==Cp.active?e:se(Cp.active)||Cp.active,Tp=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},Sp=(e,t,n,o,r,i,a)=>{const l=o.findIndex(t=>t.variantId===e&&(void 0===a||t.tierIndex===a));r(0===n?e=>e.filter((e,t)=>t!==l):-1===l?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i,tierIndex:a}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:i,tierIndex:a}:e))},$p=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Hc,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m}):"combo"===t.type?e.createElement(Qc,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(nd,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(bp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(Es,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(up,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),Bp=c.div`
4662
+ `,cp=({productsWithIndices:r,isOpen:i,onClose:a,cta:l,variantOptions:c,onVariantChange:s,handleAddToCart:d,primaryProductId:p,variantId:u})=>{const m=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[g,x]=t({}),[f,y]=t({});n(()=>{const e={},t={};r?.forEach(({product:n,index:o})=>{let r,i=[];if(n.productId===p&&u){const e=n?.productDetails?.variants?.edges.find(e=>e?.node?.id?.includes(u))?.node;e&&m(n.productDetails,e.id)>0&&(i=e.title.split(" / "),r=e)}if(!i.length){const e=n.productDetails.variants.edges.find(e=>m(n.productDetails,e?.node?.id)>0)?.node||n?.productDetails?.variants?.edges?.[0]?.node;e?(i=e.title.split(" / "),r=e):i=n?.productDetails?.options?.map(e=>e.values[0]??"")}e[o]=i,r&&(t[o]={node:r},s(o,r.id))}),x(e),y(t)},[r,p,u,s,m]),n(()=>{if(!p||!u)return;const e=r?.find(({product:e})=>e?.productId===p);if(!e)return;const{product:t,index:n}=e,o=t?.productDetails?.variants?.edges?.find(e=>e.node.id.includes(u))?.node;if(o&&m(t.productDetails,o.id)>0){const e=o.title.split(" / ");x(t=>({...t,[n]:e})),y(e=>({...e,[n]:{node:o}})),s(n,o.id)}},[u,p,r,s,m]);const b=(e,t,n,o)=>{const r=[...g[e]||[]];r[t]=n;const i=r.join(" / "),a=o.productDetails.variants.edges.find(e=>e.node.title===i)?.node;return!!a&&m(o.productDetails,a.id)>0},h=(e,t,n)=>{const{product:o}=r?.find(t=>t.index===e)||{product:{productDetails:{variants:{edges:[]}}}};if(!o?.productDetails)return;if(!b(e,n,t,o))return;const i={...g};i[e][n]=t,x(i);const a=o?.productDetails?.variants?.edges?.find(t=>t.node.title===i[e].join(" / "))?.node;a&&(s(e,a.id),y(t=>({...t,[e]:{node:a}})))};if(!i)return null;const v=e.createElement(Ud,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(Yd,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(Gd,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:l.backgroundColor,color:l.textColor}},"Select Options"),r?.map(({product:t,index:n},o)=>e.createElement(e.Fragment,null,e.createElement(Zd,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(Kd,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(Jd,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(ep,{className:"yt-fixedBundle-variant-modal_product-name"},t.productDetails.title,t?.productDetails?.variants?.edges?.filter(e=>"Default Title"!==e.node.title)?.length>0&&e.createElement(np,{className:"yt-fixedBundle-variant-modal_selected-value"},g[n]?.join(" / "))),t.productDetails.options.map((o,r)=>{const i=c&&c?.options?.find(e=>e.name===o.name),a=o.values.filter(e=>t.productDetails.variants.edges.some(t=>t.node.title.split(" / ")[r]===e));return 0===a.length||1===a.length&&"Default Title"===a[0]?e.createElement(e.Fragment,null):i&&"color"===i?.type?e.createElement(op,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i.values.find(e=>e.name===o)?.value?e.createElement(rp,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:i.values.find(e=>e.name===o)?.value||o,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},e.createElement("span",null)):e.createElement(ip,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):i&&"image"===i?.type?e.createElement(op,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,a)=>{const l=!b(n,r,o,t);return e.createElement(e.Fragment,null,i?.values.find(e=>e.name===o)?.value?e.createElement(ap,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)},src:i.values.find(e=>e.name===o)?.value},e.createElement("span",null)):e.createElement(ip,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(op,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(ip,{className:"yt-fixedBundle-variant-modal_text-swatch",key:i,selected:g[n]?.[r]==o,disabled:a,onClick:()=>{h(n,o,r)}},o)}))}))),o<r.length-1&&e.createElement(tp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(Xd,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:l.backgroundColor,color:l.textColor},onClick:d},"Add bundle to cart")));return P.createPortal(v,document.body)},sp=({options:o,selectedValue:i,onChange:a,type:l="text"})=>{const[c,s]=t(!1),d=r(null);n(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const p=t=>"color"===l?e.createElement(jd,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(Wd,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Ad,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(_d,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(Rd,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},i&&("color"===l||"image"===l)&&p(i),e.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},i&&i.name)),e.createElement(Od,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Ld,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Md,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(i?.name===t.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:t.name,$isSelected:i?.name===t.name,onClick:()=>{t.disabled||(a(t),s(!1))},style:{opacity:t.disabled?.5:1,cursor:t.disabled?"not-allowed":"pointer"}},("color"===l||"image"===l)&&p(t),e.createElement(Vd,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},dp=({product:o,variantOptions:r,selectedVariants:i,onVariantChange:a,variantId:l,primaryProductId:c,variantType:s="dropdown"})=>{const[d,p]=t(i||[]);n(()=>{i&&i.length>0&&p(i)},[i]),n(()=>{if(l&&o.variants.edges.some(e=>e.node.id.includes(l))){const e=o.variants.edges.find(e=>e.node.id.includes(l))?.node;if(e){const t=e.title.split(" / ");p(t)}}},[l,o]);const u=e=>{if(!r?.options)return"text";const t=r.options.find(t=>t.name===e);return t?.type||"text"},m=(e,t)=>{const n=d[t];if(!n)return null;return g(e,t).find(e=>e.name===n)||null},g=(e,t)=>{const n=r?.options?.find(t=>t.name===e.name);return e.values.filter(e=>o.variants.edges.some(n=>n.node.title.split(" / ")[t]===e)).map(e=>{const r=n?.values?.find(t=>t.name===e),i=!((e,t,n)=>{const o=[...d||[]];o[e]=t;const r=o.join(" / "),i=n.variants.edges.find(e=>e.node.title===r)?.node;return!!i&&((e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLocaleLowerCase()?1/0:0:1/0:0})(n,i.id)>0})(t,e,o);return{name:e,value:r?.value||e,disabled:i}})};return e.createElement(Hd,{className:"yt-fixedBundle-variant-selector-horizontal_container"},o.options.map((t,n)=>{const r=g(t,n);return 0===r.length||1===r.length&&"Default Title"===r[0].name?null:e.createElement(qd,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(sp,{options:r,selectedValue:m(t,n),onChange:e=>{((e,t)=>{const n=[...d];n[e]=t.name,p(n);const r=o.variants.edges.find(t=>t.node.title===(o.options?.length>0?n.join(" / "):n[e]))?.node.id;a(r||"")})(n,e)},type:u(t.name)}))}))},pp=({product:r,selectedVariantId:a,isChecked:l,canCustomize:c,styles:s,onVariantChange:d,onCheckChange:p,isMobile:u,isHorizontal:m,index:g,variantOptions:x,productsLength:f,handleOpenModal:y,storeCurrencyCode:b,primaryProductId:h,variantId:v,checkedProducts:w,bundleDiscountValue:C,bundleDiscountType:E,bundleProductsCount:k,totalSelectedOriginal:T})=>{const S=o(()=>e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e),n=t?.node;return n?r?.tracksInventory&&n.inventoryItem?.tracked?n.inventoryQuantity>0?n.inventoryQuantity:n.inventoryQuantity<=0&&"continue"===n.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[r]),[$,B]=t(r?.variants?.edges.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node),N=o(()=>$?.title?.split(" / ")||[],[$]),I=r?.id===h;n(()=>{if(r.id===h){const e=r?.variants?.edges?.find(e=>e?.node?.id?.includes(a))?.node;e&&S(e.id)>0&&(B(e),d(e.id))}else{const e=r?.variants?.edges?.find(e=>e?.node?.id===a)?.node||r?.variants?.edges?.find(e=>S(e?.node?.id)>0)?.node||r?.variants?.edges?.[0]?.node;B(e)}},[r,h,a,v,d,S]);const z=i(e=>{const t=r?.variants?.edges?.find(t=>t.node.id===e)?.node;t&&d(e)},[r,d]),F=s?.fixedBundle?.discountBadgeDisplay,D=parseFloat($?.price??"0"),P=w?.size===k,A=((e,t,n,o,r,i)=>{if(0===o||!n)return e;if(o!==r)return e;switch(t){case"percentOff":case"percentageOff":case"percentage":case"Percentage":return e*(1-n/100);case"amountOff":case"amount":case"Amount Off":{if(i<=0)return e;const t=e/i*n;return Math.max(0,e-t)}case"fixedPrice":case"fixed":case"fixedPrice":return n*(e/i);default:return e}})(D,E,C??0,w?.size,k,T),_=P?A:parseFloat($?.price??"0"),R="discount-on-compare"===F?parseFloat($?.compareAtPrice||$?.price||"0"):parseFloat($?.price??"0"),O=!1!==s?.fixedBundle?.discountBadgeVisibility&&(R>_&&s?.fixedBundle?.compareAtPriceVisibility||"discount-on-compare"===F&&s?.fixedBundle?.compareAtPriceVisibility),L=_.toFixed(2),M="undefined"!=typeof window&&"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,V=$?.image?.url||r.featuredMedia?.preview?.image?.url;return e.createElement(e.Fragment,null,m?e.createElement("div",{className:""+(r.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px"}},c&&e.createElement("div",{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},e.createElement("input",{type:"checkbox",style:{display:"none"},className:"yt-fixedBundle-product-card_checkbox-hidden",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixed-bundle-checkbox-label yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),e.createElement(ld,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}80`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${s.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}80`}[s.fixedBundle.shadowType]||"none"},canCustomize:c},"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(cd,{className:"yt-fixedBundle-product-card-horizontal_image",src:Tp(V),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(sd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(dd,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(pd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(ud,{className:"yt-fixedBundle-product-card-horizontal_price--new"},kp(s.general.currencySymbol,b)," ",Ep(L)),O&&R>_&&e.createElement(md,{className:"yt-fixedBundle-product-card-horizontal_price--old"},kp(s.general.currencySymbol,b),Ep(R))),e.createElement(dp,{product:r,variantOptions:x,selectedVariants:N,onVariantChange:z,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(Cd,{className:""+(r.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:s.fixedBundle?.borderRadius,border:`1px solid ${s.fixedBundle?.borderColor}50`,backgroundColor:s.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${s.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${s.fixedBundle.borderColor}50`}[s.fixedBundle.shadowType]||"none",...c&&{position:"relative"},...M&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,backgroundColor:s.fixedBundle?.cardBackgroundColor},c&&e.createElement(Qd,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:M},e.createElement("input",{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${r.id}-${g}`,defaultChecked:l,onChange:e=>p(e.target.checked),disabled:I}),e.createElement("label",{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${r.id}-${g}`,style:{width:"18px",height:"18px",border:"1.5px solid "+((s.fixedBundle?.borderColor??"#ccc")+"80"),borderRadius:s.fixedBundle?.borderRadius??"4px",backgroundColor:l?s.general?.ctaBackgroundColor??"#d3122a":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",color:"white"}},e.createElement(X,{size:10,style:{fontSize:"14px",visibility:l?"visible":"hidden"}}))),"undefined"!=typeof window&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&e.createElement(Ed,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(kd,{className:"yt-fixedBundle-product-card_image--vertical",src:Tp(V),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Td,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Sd,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement($d,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(Bd,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Nd,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Id,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(Fd,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(zd,{className:"yt-fixedBundle-product-card-vertical_price--new"},kp(s.general.currencySymbol,b),Ep(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(md,{className:"yt-fixedBundle-product-card-vertical_price--old"},kp(s.general.currencySymbol,b),Ep(R))))),(f<=3||!u)&&g<f-1&&e.createElement(Dd,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Pd,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},up=({bundle:r,addToCartFunction:a,dispatchAnalyticsEvent:l})=>{const[c,s]=t(!1),[d,p]=t(window.innerWidth<786),[u,m]=t(null),[g,x]=t(!1),f="undefined"!=typeof window?window.location.href:null,y=r?.products?.find(e=>e.productDetails?.handle===f?.split("/").pop()?.split("?")[0]),b=y?.productId,h=o(()=>(e,t)=>{const n=e?.variants?.edges?.find(e=>e.node.id===t),o=n?.node;return o?e?.tracksInventory&&o.inventoryItem?.tracked?o.inventoryQuantity>0?o.inventoryQuantity:o.inventoryQuantity<=0&&"continue"===o.inventoryPolicy?.toLowerCase()?1/0:0:1/0:0},[]),[v,w]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>h(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),C="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain),E=r?.showIndividualProductSelector??!0,[k,T]=t(new Set(r.products.reduce((e,t,n)=>(C&&t?.productId!==b&&!E||e.push(n),e),[])));n(()=>{l?.({eventNameCustom:"block_visibility",eventTypeCustom:"views",data:{bundleId:r._id,bundleType:"fixed-bundle"}});const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");m(e)},t=e=>{const t=history[e];return function(...n){const o=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),o}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}},[]),n(()=>{u&&b&&w(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===b&&(t[n.toString()]=u)}),t})},[u,b,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const S=i((e,t)=>{w(n=>({...n,[e.toString()]:t}))},[]),$=(e,t)=>{const n=r.products[t].productId;C&&n===b||T(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},B=o(()=>(e,t)=>h(e.productDetails,t)>0,[h]),N=o(()=>r.products.some((e,t)=>k.has(t)&&e.productDetails.variants.edges.length>1),[r.products,k]),{originalPrice:I,dealPrice:z,offerValue:F}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!k.has(n))return e;const o=v[n.toString()];if(!o)return e;const r=t.productDetails.variants.edges?.find(e=>e.node.id===o)?.node;if(!r)return e;const i=parseFloat(r?.price??"0"),a=parseFloat(r?.compareAtPrice||i.toString());return e.price+=i,e.compareAtPrice+=a,e},{price:0,compareAtPrice:0}),n="discount-on-compare"===(r?.customizations?.fixedBundle?.discountBadgeDisplay||"discount-on-price")?t:e;let o=e;k.size===r.products.length&&(r?.percentageOff?o=e*(1-r.percentageOff/100):r?.dealAmount?o=r.dealAmount:r?.amountOff&&(o=e-r.amountOff));const i=n-o;return{originalPrice:n.toFixed(2),dealPrice:o.toFixed(2),offerValue:i.toFixed(2)}},[r.products,v,k,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),D=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>k.has(e)),[r.products,k]),P=D.every(({product:e,index:t})=>B(e,v[t.toString()])),A=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(k.has(n)){const o=v[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,k,v]),_=async e=>{if(P){e.preventDefault(),e.stopPropagation(),s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:D?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const e=Object.entries(v).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!k.has(n)?null:t}).filter(Boolean);a&&await a(Number(I),e)}catch(e){console.error("Error adding to cart:",e)}s(!1)}};if(!a)return e.createElement(e.Fragment,null);const R=r.customizations,O=R.fixedBundle?.cardLayoutStyle||"auto",L="horizontal"===O||"auto"===O&&d,M="bundles"==r.appName?r.pageHeader?.title:r?.title,V="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(od,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:R.fixedBundle.sectionBackgroundColor,..."transparent"!==R.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},M&&e.createElement(rd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:R.fixedBundle?.titleBackgroundColor||"none",color:R.fixedBundle?.titleTextColor||"black",textAlign:R.fixedBundle.infoAlignment??"center",fontSize:R.fixedBundle?.titleFontSize,..."transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},M),V&&e.createElement(id,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:R.fixedBundle?.subtitleFontSize,textAlign:R.fixedBundle.infoAlignment??"center",..."left"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===R.fixedBundle.infoAlignment&&"transparent"!==R.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===R.fixedBundle.infoAlignment&&"transparent"===R.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},V),L?e.createElement(ad,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},r?.products?.map((t,n)=>e.createElement(e.Fragment,{key:`${t.productId}-${n}`},e.createElement(pp,{isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>S(n,e),onCheckChange:e=>{$(e,n)},isMobile:d,index:n,isHorizontal:L,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})))):e.createElement(vd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(wd,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(pp,{key:`${t.productId}-${n}`,isChecked:k.has(n),product:t.productDetails,selectedVariantId:v[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:R,onVariantChange:e=>{S(n,e)},onCheckChange:e=>$(e,n),isMobile:d,index:n,isHorizontal:L,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:b,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:k,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:A})),N&&e.createElement(cp,{productsWithIndices:D,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:R.general.ctaTextColor,backgroundColor:R.general.ctaBackgroundColor},onVariantChange:S,handleAddToCart:_,primaryProductId:b,variantId:u||void 0}))),e.createElement(gd,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===R.fixedBundle.infoAlignment?"flex-start":"right"===R.fixedBundle.infoAlignment?"flex-end":"center"}},Number(I)>0&&Number(F)>0&&R.fixedBundle.compareAtPriceVisibility&&e.createElement(xd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(yd,{className:"yt-fixedBundle-summary_price"},kp(R.general.currencySymbol,r?.storeCurrencyCode),Ep(I))),0!==k.size&&e.createElement(fd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(yd,{className:"yt-fixedBundle-summary_price"},kp(R.general.currencySymbol,r?.storeCurrencyCode),Ep(z))," ",Number(F)>0&&e.createElement(bd,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",kp(R.general.currencySymbol,r?.storeCurrencyCode),Ep(F)))),e.createElement(hd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),L||!N?_(e):x(!0)},disabled:k.size<1||c||!P,style:{backgroundColor:R.general?.ctaBackgroundColor||"#121212",color:R.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${R.general?.ctaBackgroundColor||"#121212"}`,boxShadow:R.general.ctaShadowType,paddingTop:R.general?.ctaPadding,paddingBottom:R.general?.ctaPadding,borderRadius:R.general.ctaBorderRadius,width:R.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=R.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{R.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=R.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=R.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ue,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):P?e.createElement(e.Fragment,null,R.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")))},mp=()=>e.createElement(e.Fragment,null,e.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),e.createElement("div",{className:"yt-collection-bundle-loader-spinner",style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),gp=({product:o,tierIdx:r,isOpen:i,onClose:a,onAddToBundle:l,canAdd:c,isSelected:s,customizations:d,isMobile:p,splitVariants:u=!1})=>{const[m,g]=t(0),[x,f]=t(o.variants[0]?.id.toString()||""),[y,b]=t(!0),h=o.variants.find(e=>e.id.toString()===x)||o.variants[0],v=o.images.filter(Boolean),w=()=>{v.length<=1||(g(e=>0===e?v.length-1:e-1),b(!0))},C=()=>{v.length<=1||(g(e=>e===v.length-1?0:e+1),b(!0))};if(n(()=>(i&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=""}),[i]),n(()=>{if(h&&h?.featured_image?.src){const e=document.querySelector(".yt-collection-bundle-modal-image"),t=Tp(h?.featured_image?.src);e?.setAttribute("src",t)}},[h]),!i)return null;const E=v.length>1,k=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",borderRadius:d?.borderRadius||"12px",maxWidth:1e3,width:"100%",height:"72dvh",margin:"auto",display:"flex",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-image-container",style:{flex:1,position:"relative",margin:"20px 0 20px 20px",borderRadius:d?.borderRadius||"12px",background:"#f5f5f5"}},v.length>0&&e.createElement(e.Fragment,null,y&&e.createElement("style",null,"\n @keyframes shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "),y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite",borderRadius:d?.borderRadius||"12px"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:Tp(v[m]||o.images[0]),alt:o.title,onLoad:()=>b(!1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:d?.borderRadius||"12px",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:0===m?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:0===m?.5:1}},e.createElement(Z,{size:24})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:16,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.2)":"rgba(0,0,0,0.4)",border:"none",borderRadius:"50%",width:44,height:44,display:"flex",alignItems:"center",justifyContent:"center",cursor:m===v.length-1?"not-allowed":"pointer",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1}},e.createElement(L,{size:24}))))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{flex:1,padding:"30px",overflowY:"auto",display:"flex",flexDirection:"column",scrollbarWidth:"none"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"6px 0",fontSize:24,fontWeight:600,lineHeight:"normal"}},u&&h?.name||o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative"}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee",lineHeight:"normal"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer",lineHeight:"normal"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0",lineHeight:"normal"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price&&h.compare_at_price>h.price?e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999",lineHeight:"normal"}},"₹",(h.compare_at_price/100).toLocaleString()):null),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"white"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"12px",fontSize:17,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:h.available?s||!c?"#28a745":d?.atcBg||"#007bff":"rgb(204, 204, 204)",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed",textAlign:"center",lineHeight:"normal"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock")),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:"normal",color:"#444",marginTop:"10px"}})))),T=e.createElement("div",{className:"yt-collection-bundle-modal-overlay",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:9999,display:"flex"},onClick:a},e.createElement("div",{className:"yt-collection-bundle-modal-container",style:{background:"#fff",width:"100%",height:"100dvh",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{className:"yt-collection-bundle-modal-close-btn",onClick:a,style:{position:"absolute",top:12,right:12,zIndex:10,background:"#fff",border:"1px solid #ddd",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(G,{size:22})),e.createElement("div",{className:"yt-collection-bundle-modal-scroll-container",style:{flex:1,overflowY:"auto",paddingBottom:100}},v.length>0&&e.createElement("div",{className:"yt-collection-bundle-modal-image-wrapper",style:{position:"relative",background:"#f5f5f5"}},y&&e.createElement("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s infinite"}}),e.createElement("img",{className:"yt-collection-bundle-modal-image",src:v[m]||o.images[0],alt:o.title,onLoad:()=>b(!1),style:{width:"100%",minWidth:"100%",display:"block",maxHeight:"50vh",minHeight:"50vh",objectFit:"cover",objectPosition:"center",opacity:y?0:1,transition:"opacity 0.3s"}}),E&&e.createElement(e.Fragment,null,e.createElement("button",{onClick:w,disabled:0===m,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",background:0===m?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:0===m?.5:1,cursor:0===m?"not-allowed":"pointer"}},e.createElement(Z,{size:20})),e.createElement("button",{onClick:C,disabled:m===v.length-1,style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",background:m===v.length-1?"rgba(0,0,0,0.3)":"rgba(0,0,0,0.5)",border:"none",borderRadius:"50%",width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",zIndex:5,opacity:m===v.length-1?.5:1,cursor:m===v.length-1?"not-allowed":"pointer"}},e.createElement(L,{size:20})))),e.createElement("div",{className:"yt-collection-bundle-modal-content",style:{padding:"20px"}},e.createElement("h2",{className:"yt-collection-bundle-modal-title",style:{margin:"0 0 12px",fontSize:22,fontWeight:600}},o.title),!u&&o.variants.length>1&&e.createElement("div",{className:"yt-collection-bundle-modal-variant-container",style:{position:"relative",marginBottom:20}},e.createElement("div",{className:"yt-collection-bundle-modal-variant-label",style:{padding:"8px 0",borderBottom:"1px solid #eee"}},o?.options?.join(" & "),":"," ",e.createElement("strong",null,h.title)),e.createElement("select",{className:"yt-collection-bundle-modal-variant-select",value:x,onChange:e=>{f(e.target.value),b(!0)},style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}},o.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-modal-price-container",style:{fontSize:28,fontWeight:"bold",margin:"10px 0"}},"₹",(h.price/100).toLocaleString(),h.compare_at_price?h.compare_at_price>h.price&&e.createElement("span",{className:"yt-collection-bundle-modal-compare-price",style:{marginLeft:12,fontSize:20,textDecoration:"line-through",color:"#999"}},"₹",(h.compare_at_price/100).toLocaleString()):null),o.description&&e.createElement("div",{className:"yt-collection-bundle-modal-description",dangerouslySetInnerHTML:{__html:o.description},style:{lineHeight:1.7,color:"#444"}}))),e.createElement("div",{className:"yt-collection-bundle-modal-add-section",style:{position:"sticky",bottom:0,background:"#fff",padding:"8px 10px",borderTop:"1px solid #eee",boxShadow:"0 -4px 10px rgba(0,0,0,0.05)"}},e.createElement("button",{className:"yt-collection-bundle-modal-add-btn "+(s||!c?"yt-collection-bundle-modal-add-btn-added":""),onClick:()=>l(o,r),disabled:!c||!h.available,style:{width:"100%",padding:"10px",fontSize:14,fontWeight:600,border:"none",borderRadius:d?.borderRadius||"8px",background:!s&&c&&h.available?d?.atcBg||"#007bff":"#28a745",color:d?.atcText||"#fff",cursor:c&&h.available?"pointer":"not-allowed"}},s?"Added to Box":h.available?"Add to Box":"Out of Stock"))));return P.createPortal(p?T:k,document.body)},xp=({title:t,uploadState:n,onUpload:o,onRemove:r,onRetry:i})=>{const a="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return e.createElement("div",{className:"yt-collection-bundle-upload-field",style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},e.createElement("div",{className:"yt-collection-bundle-upload-title",style:{fontWeight:500,color:"#333",marginBottom:"4px"}},t),a&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},e.createElement(mp,null)," Uploading ",n?.name,"...")),l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-error",style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-retry-btn",onClick:i,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!a&&!l&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-image-container",style:{margin:"12px 0"}},e.createElement("img",{className:"yt-collection-bundle-upload-image",src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),e.createElement("div",{className:"yt-collection-bundle-upload-filename",style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-remove-btn",onClick:r,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&e.createElement(e.Fragment,null,e.createElement("div",{className:"yt-collection-bundle-upload-hint",style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),e.createElement("button",{type:"button",className:"yt-collection-bundle-upload-btn",onClick:o,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},fp=({styles:t,isMobile:n,categories:o,activeCategory:r,onCategoryChange:i})=>{const a=e=>{i(e)},l=(e,t)=>{const n=e.replace("#","");return`rgba(${parseInt(n.substring(0,2),16)||0}, ${parseInt(n.substring(2,4),16)||0}, ${parseInt(n.substring(4,6),16)||0}, ${t})`};return"tabs"===t?.categoryFilterOnPage?e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",width:"100%"}},e.createElement("div",{className:"yt-collection-bundle-category-tabs-container",style:{display:"flex",gap:"0px",minWidth:"max-content",paddingBottom:"1px",flexWrap:"nowrap",justifyContent:"center",borderBottom:"1px solid #e0e0e0",width:"auto",height:n?"28px":"45px"}},["All",...o].map(o=>{const i=r===o,c=t.btnPrimaryBg||"#111";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-tab-button",style:{background:"none",border:"none",padding:n?"12px 16px":"12px 20px",fontSize:n?"14px":"16px",fontWeight:i?"600":"400",color:i?c:"#666",cursor:"pointer",position:"relative",transition:"all 0.3s ease",backgroundColor:i?l(c,.07):"transparent",borderBottom:i?`2px solid ${c}`:"2px solid transparent",marginBottom:"-1px",whiteSpace:"nowrap",minWidth:"fit-content"},onMouseEnter:e=>{i||(e.currentTarget.style.color=c)},onMouseLeave:e=>{i||(e.currentTarget.style.color="#666")}},e.createElement("span",{style:{visibility:"hidden",height:0,display:"block",overflow:"hidden",fontWeight:600},"aria-hidden":"true"},o.charAt(0).toUpperCase()+o.slice(1)),e.createElement("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",textAlign:"center"}},o.charAt(0).toUpperCase()+o.slice(1)))}))):e.createElement("div",{className:"yt-collection-bundle-category-filter-wrapper",style:{overflowX:n?"auto":"visible",scrollbarWidth:"none",msOverflowStyle:"none",marginBottom:"20px",paddingBottom:"5px"}},e.createElement("div",{className:"yt-collection-bundle-category-buttons-container",style:{display:"flex",gap:"8px",minWidth:"max-content",flexWrap:"nowrap",justifyContent:"center",paddingRight:n?"10px":"0px"}},["All",...o].map(o=>{const i=t.btnPrimaryBg||"#111",l=t.borderRadius||"8px";return e.createElement("button",{key:o,onClick:()=>a(o),className:"yt-collection-bundle-category-button",style:{padding:n?"8px 16px":"10px 18px",fontSize:n?"13px":"14px",fontWeight:"500",border:`1px solid ${r===o?i:"#e0e0e0"}`,borderRadius:l,backgroundColor:r===o?i:"white",color:r===o?"white":"#333",cursor:"pointer"}},o.charAt(0).toUpperCase()+o.slice(1))})))},yp=e=>{if(e.metafields&&e.metafields.yourtoken_bundles_app&&e.metafields.yourtoken_bundles_app.categories){const t=e.metafields.yourtoken_bundles_app.categories;if(Array.isArray(t))return t;if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch(e){console.error("Failed to parse categories:",e)}}return[]},bp=({config:o,bundleAddToCartLoading:a,addCustomBundleToCart:l})=>{const[c,s]=t(1),[d,p]=t("All"),[u,m]=t([]),[g,x]=t(null),[f,y]=t({}),[b,h]=t(window.innerWidth<640),[v,w]=t({}),C=r(new Map),[E,k]=t(!1),T=r(null),S=r(new Map),[$,B]=t(160),N=b?8:20,{customizations:I}=o,z=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),F=!!o.config.form,D=z.length+(F?1:0),P=I.hideSelectedProducts,A=I.allowMultipleQty,_=I.hideOutOfStockProducts,R=o.config.splitVariants??!1,O=r(new Set),L=i((e,t=d)=>{const n=z[e-1]?.products||[],o="All"===t?n:n.filter(e=>yp(e).includes(t));return _?o.filter(e=>e.available):o},[z,d,_]),M=i(e=>{const t=L(e).length;w(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,L]);n(()=>(T.current=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){const e=parseInt(t.target.getAttribute("data-sentinel-step")||"0");e>0&&e===c&&M(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{T.current?.disconnect()}),[M,c]),n(()=>{p("All")},[c]),n(()=>{if(F&&c===D)return;const e=c-1;if(!z[e])return;if(O.current.has(e))return;const t=L(c);if(console.log("filteredProducts",t),1!==t.length)return;const n=t[0],o=n.variants.filter(e=>e.available);if(1!==o.length)return;const r=o[0],i=U(e),a=G[e];if(i!==1/0&&a>=i)return;if(!u.some(t=>t.productId===n.id.toString()&&t.variantId===r.id.toString()&&t.tierIndex===e)&&(O.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<D)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(F&&c===D)return;const e=c,t=L(e).length;w(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(N,t),[`${e}_category`]:d}:n})},[c,N,d,L]),n(()=>{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 V=i(e=>{B(e+10)},[]),j=u.reduce((e,t)=>e+t.quantity,0),W=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,H=u.reduce((e,t)=>{const n=z.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId),o=n?.variants.find(e=>e.id.toString()===t.variantId);return e+(o?.compare_at_price??t.price)*t.quantity},0)/100,q=(e,t)=>{const n=e.variants.find(e=>e.id===parseInt(t));if(!n)return;const o=document.querySelector(`[data-product-id="${e.id}"]`);o&&(o.dataset.selectedVariant=t,o.dataset.currentPrice=n.price.toString())},Q=(e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const o=n.dataset.selectedVariant||e.variants[0].id.toString(),r=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());m(n=>{const i=`${e.id}-${o}-${t}`,a=n.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===i);if(a)return n.filter(e=>e!==a);const l=G[t],c=U(t);return c!==1/0&&l>=c?n:[...n,{productId:e.id.toString(),variantId:o,price:r,quantity:1,tierIndex:t}]})},U=e=>{const t=z[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},Y=(e,t)=>{const n=U(t);if(n===1/0)return!0;const o=G[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},G=z.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),X=(e,t,n)=>{const o=U(n);if(o===1/0)return!0;return G[n]<o},Z=e=>{if(!C.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");y(t=>({...t,[e]:{loading:!0,name:n.name}}));try{const t=await(async e=>{const t=new FormData;t.append("file",e),k(!0);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",o=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!o.ok)throw new Error("Upload failed");return(await o.json()).url}catch(e){throw k(!1),alert("Upload failed. Try again."),e}finally{k(!1)}})(n);y(o=>({...o,[e]:{url:t,name:n.name}}))}catch{y(t=>({...t,[e]:{error:!0,name:n.name}}))}}},document.body.appendChild(t),C.current.set(e,t)}return C.current.get(e)},K=F&&c===D,J=(K?null:z[c-1])?U(c-1):0,ee=z.map((e,t)=>({tier:e,items:u.filter(e=>e.tierIndex===t).reduce((e,t)=>{const n=`${t.productId}-${t.variantId}`,o=e.find(e=>`${e.productId}-${e.variantId}`===n);return o?o.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e},[]),count:G[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},I.headerImage&&!I.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:I.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),I.showTierSteps&&e.createElement("div",{style:{paddingTop:I.headerImage&&!I.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(hp,{totalSteps:D,isFormStep:K,currentStep:c,getStepTitle:e=>F&&e===D?"Customize Gift Details":z[e-1]?.title||`Step ${e}`,isMobile:b,formTitle:o?.config?.form?.title,hasForm:F,onStepClick:e=>{if(e>1&&!u.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:D},(e,t)=>t+1).map(t=>{const n=F&&t===D,r=n?[]:(e=>z[e-1]?.products||[])(t);let i=[];if(!n&&I.enableProductCategories){const e=new Set;r.forEach(t=>yp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const a=n?[]:L(t),l=t-1,s=a.slice(0,v[t]||0);return e.createElement("div",{key:t,className:"yt-collection-bundle-step-content "+(c===t?"yt-collection-bundle-step-content-active":""),style:{display:c===t?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},n&&o.config.form?e.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:`${$}px`}},o?.config?.form?.sections?.map((t,n)=>e.createElement("div",{key:`sec_${n}`,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},e.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px",lineHeight:"normal"}},t?.title),"text"===t.type&&e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"12px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n;return e.createElement("textarea",{key:o,className:"yt-collection-bundle-textarea",placeholder:t?.title,rows:3,maxLength:500,onChange:e=>y(t=>({...t,[o]:e.target.value})),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical",lineHeight:"normal"}})})),"image"===t.type&&e.createElement("div",{className:"yt-collection-bundle-image-section",style:{marginBottom:"24px"}},e.createElement("sub",{className:"yt-collection-bundle-upload-hint",style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px",lineHeight:"normal"}},"jpeg/png (max 5MB)"),e.createElement("div",{className:"yt-collection-bundle-form-fields",style:{display:"flex",flexDirection:"column",gap:"16px"}},t.fields.map((t,n)=>{const o=t?.title??"Field "+n,r=f[o];return e.createElement(xp,{key:o,title:t?.title,uploadState:r,onUpload:()=>Z(o).click(),onRemove:()=>y(e=>{const{[o]:t,...n}=e;return n}),onRetry:()=>Z(o).click()})})))))):e.createElement(e.Fragment,null,I.enableProductCategories&&i.length>0&&e.createElement(fp,{styles:I,isMobile:b,categories:i,activeCategory:d,onCategoryChange:p}),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:b?"grid":"flex",gridTemplateColumns:b?"repeat(2,1fr)":"",flexWrap:b?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${$}px`}},R?s.flatMap(t=>t.variants.filter(e=>!_||e.available).map(n=>e.createElement(vp,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:l,customizations:I,isMobile:b,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:Q,canAddProduct:Y,allowMultipleQty:A,handleVariantChange:q,canIncrement:X,setSelectedProducts:m,splitVariants:!0}))):s.map(t=>e.createElement(vp,{key:t.id,product:t,tierIdx:l,customizations:I,isMobile:b,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:Q,canAddProduct:Y,allowMultipleQty:A,handleVariantChange:q,canIncrement:X,setSelectedProducts:m,splitVariants:!1})),c===t&&(v[t]||0)<a.length&&e.createElement("div",{ref:e=>{const n=S.current.get(t);n&&T.current?.unobserve(n),e?(S.current.set(t,e),T.current?.observe(e)):S.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))))}),e.createElement(wp,{config:o,selectedProducts:u,selectedByTier:ee,totalItems:j,totalPrice:W,totalCompareAtPrice:H,currentStep:c,totalSteps:D,currentTierMax:J,tierSelectedCounts:G,isMobile:b,bundleAddToCartLoading:a,isUploading:E,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:P,getProductStep:e=>{for(let t=0;t<z.length;t++)if(z[t].products.some(t=>t.id.toString()===e))return t+1;return F?D:z.length},setCurrentStep:s,handleRemoveItem:(e,t,n)=>{m(o=>o.filter(o=>!(o.productId===e&&o.variantId===t&&o.tierIndex===n)))},handleCheckout:async()=>{if(c!==D||!u.length)return;const e={};F&&Object.entries(f).forEach(([t,n])=>{const o=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[o]=n:n&&"object"==typeof n&&"url"in n&&(e[o]=n.url)});const t=u.map(t=>({variantId:t.variantId,quantity:t.quantity,properties:e}));l(t)},hasForm:F,onHeightChange:V}))},hp=({totalSteps:t,isFormStep:o,currentStep:r,getStepTitle:i,isMobile:a,formTitle:l,hasForm:c,onStepClick:s})=>{const d=e.useRef(null);return n(()=>{if(!a||!d.current)return;const e=d.current.querySelector(".yt-collection-bundle-step-item-active");e&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[r,a]),e.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:a?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:a?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},e.createElement("div",{ref:d,className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:a?"flex-start":"center",gap:a?"1rem":"2rem",minWidth:a?100*t+"px":"auto",paddingInline:a?"calc(50% - 60px)":"0",scrollPaddingInline:a?"calc(50% - 60px)":"0",scrollBehavior:"smooth",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:t},(e,t)=>t+1).map(n=>e.createElement("div",{key:n,className:"yt-collection-bundle-step-item "+(r===n?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:a?"100px":"120px",flexShrink:0,cursor:"pointer",opacity:r===n?1:.5,transition:"opacity 0.2s"},onClick:()=>s(n)},e.createElement("div",{className:"yt-collection-bundle-step-icon "+(r===n?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:r===n?"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},c&&n===t?e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):e.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:r===n?"#fff":"#999"}},e.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),e.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600",lineHeight:"normal"}},i(n))))),l&&c&&o&&e.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:a?"14px":"16px",marginBottom:a?"0":"14px",fontWeight:"400",color:"#000",lineHeight:"normal"}},l))},vp=({product:n,tierIdx:o,customizations:r,isMobile:i,hoveredCard:a,setHoveredCard:l,selectedProducts:c,handleAddToBundle:s,canAddProduct:d,allowMultipleQty:p,handleVariantChange:u,canIncrement:m,setSelectedProducts:g,splitVariants:x=!1})=>{const[f,y]=t(!1),b=x?null:document.querySelector(`[data-product-id="${n.id}"]`),h=x?n.variants[0].id.toString():b?.dataset.selectedVariant??n.variants[0].id.toString(),v=n.variants.find(e=>e.id.toString()===h)||n.variants[0],w=x?`${n.id}-${v.id}`:n.id,C=c.some(e=>e.productId===n.id.toString()&&e.variantId===h&&e.tierIndex===o),E=a===w,k=c.filter(e=>e.productId===n.id.toString()&&e.variantId===v.id.toString()&&e.tierIndex===o).reduce((e,t)=>e+t.quantity,0);return e.createElement(e.Fragment,null,e.createElement("div",{key:w,className:"yt-collection-bundle-product-item","data-product-id":n.id,"data-selected-variant":v.id,"data-current-price":v.price,style:{display:"flex",flexDirection:"column",border:r?.productCardBorder||"1px solid #ddd",background:r?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:i?0:"250px",maxWidth:i?"none":"250px",borderRadius:r?.borderRadius||"8px",boxShadow:"spread"===r?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===r?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:i?"100%":""}},e.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:r?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onClick:()=>y(!0),onMouseEnter:()=>l(w),onMouseLeave:()=>l(null)},e.createElement("img",{src:Tp(n.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px"),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?0:1,transform:E?"scale(1.05)":"scale(1)"},alt:n.title}),e.createElement("img",{src:Tp(n.images[1]||n.images[0]),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:E?1:0,transform:"scale(1.05)"},alt:n.title}),!x&&n.variants.length>1&&e.createElement("select",{className:"yt-collection-bundle-variant-selector",style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"8px",fontSize:"12px",fontWeight:"600",zIndex:2,lineHeight:"normal"},onChange:e=>u(n,e.target.value),defaultValue:v.id,onClick:e=>{e.stopPropagation()}},n.variants.map(t=>e.createElement("option",{key:t.id,value:t.id,disabled:!t.available},t.title," ",!t.available&&"(Out of stock)")))),e.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},r.productCardCategoryVisibility&&yp(n).length>0&&e.createElement("div",{className:"yt-collection-bundle-product-categories-wrapper",style:{paddingBottom:"8px"}},e.createElement("div",{className:"yt-collection-bundle-product-categories",style:{display:"flex",flexWrap:"wrap",gap:"4px"}},yp(n).slice(0,2).map((t,n)=>e.createElement("span",{className:"yt-collection-bundle-category-tag",key:n,style:{fontSize:i?"10px":"12px",color:"#666",fontWeight:"500"}},t.charAt(0).toUpperCase()+t.slice(1))),yp(n).length>2&&e.createElement("span",{className:"yt-collection-bundle-more-categories",style:{fontSize:"10px",padding:"2px 6px",backgroundColor:"rgba(0, 0, 0, 0.05)",borderRadius:"8px",color:"#666",fontWeight:"500"}},"+",yp(n).length-2," more"))),e.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:i?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:"normal",color:"#333",flexGrow:x?0:1}},n.title),x&&"Default Title"!==v.title&&e.createElement("p",{className:"yt-collection-bundle-variant-label",style:{fontSize:i?"10px":"12px",color:"#666",margin:"0 0 4px",lineHeight:"normal",flexGrow:1}},v.title),e.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden",lineHeight:"normal"}},e.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:i?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0,lineHeight:"normal"}},"₹",(v.price/100).toLocaleString()),v.compare_at_price&&0!==v.compare_at_price&&v.compare_at_price>v.price?e.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0,lineHeight:"normal"}},"₹",(v.compare_at_price/100).toLocaleString()):null)),p&&k>0?e.createElement("div",{className:"yt-collection-bundle-quantity-row",style:{display:"flex",alignItems:"center",flexWrap:"nowrap",background:"#cccccc"}},e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-minus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r&&r.quantity>1?e.map(e=>e===r?{...e,quantity:e.quantity-1}:e):r?e.filter(e=>e!==r):e})}},"-"),e.createElement("span",{className:"yt-collection-bundle-qty-display",style:{minWidth:"24px",textAlign:"center",fontWeight:600,width:"100%",lineHeight:"normal"}},k),e.createElement("button",{className:"yt-collection-bundle-qty-btn yt-collection-bundle-qty-plus",style:{width:"40%",height:v.available?"fit-content":"36px",border:"1px solid #ddd",background:"#fff",fontWeight:"bold",cursor:"pointer",padding:i?"6px":"12px",fontSize:i?"12px":"14px",textAlign:"center",lineHeight:"normal"},onClick:()=>{v.available&&m(n,v.id.toString(),o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.map(e=>e===r?{...e,quantity:e.quantity+1}:e):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]})},disabled:!v.available||!m(n,v.id.toString(),o)},"+")):e.createElement("button",{className:"yt-collection-bundle-add-btn "+(C?"yt-collection-bundle-add-btn-added":""),style:{background:C?"#28a745":d(n,o)&&v.available?r?.atcBg||"#007bff":"#ccc",color:r?.atcText||"#fff",border:"none",padding:i?"6px":"12px",fontSize:i?"12px":"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",opacity:v.available?1:.6,lineHeight:"normal",textAlign:"center"},onClick:()=>{if(x)v.available&&d(n,o)&&g(e=>{const t=`${n.id}-${v.id}-${o}`,r=e.find(e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===t);return r?e.filter(e=>e!==r):[...e,{productId:n.id.toString(),variantId:v.id.toString(),price:v.price,quantity:1,tierIndex:o}]});else{if(!v.available||!d(n,o))return;s(n,o)}},disabled:!v.available||!d(n,o)},C?"Added":v.available?"ADD TO BOX":"Out of Stock")),f&&e.createElement(gp,{product:n,tierIdx:o,isOpen:f,onClose:()=>y(!1),onAddToBundle:(e,t)=>{s(e,t),y(!1)},canAdd:d(n,o),isSelected:C,customizations:r,isMobile:i,splitVariants:x}))},wp=o=>{const{config:i,selectedProducts:a,selectedByTier:l,totalItems:c,totalPrice:s,totalCompareAtPrice:d,currentStep:p,totalSteps:u,currentTierMax:m,tierSelectedCounts:g,isMobile:x,bundleAddToCartLoading:f,isUploading:y,hoveredCard:b,setHoveredCard:h,getProductStep:v,setCurrentStep:w,handleRemoveItem:C,handleCheckout:E,hasForm:k,onHeightChange:T}=o,{customizations:S}=i,[$,B]=t(!1),N=r(null),I=r(null),{totalOriginal:z,hasSavings:F,formattedSavings:D,totalAfterDiscount:P}=(e=>{let t=0,n=0;e.forEach(({items:e,tier:o})=>{const r=o?.discountData;let i=0;e.forEach(e=>{const t=(e.price||0)/100,n=e.quantity||1;i+=t*n}),t+=i;let a=i;if("mov_percentage"===r?.type&&r.tiers?.length){const e=[...r.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity).filter(e=>i>=e.minimumQuantity);if(e.length>0){const t=e.reduce((e,t)=>t.discountValue>e.discountValue?t:e).discountValue/100;a=i*(1-t)}}n+=a});const o=Math.round(t-n),r=o>0;return{savings:o,totalOriginal:t,totalAfterDiscount:n,hasSavings:r,formattedSavings:r?`₹${o.toLocaleString()}`:"",calculatedDiscountedTotal:Math.round(n)}})(l),A=l.filter(({count:e})=>e>0).map(({tier:e,items:t})=>{const n=t.reduce((e,t)=>{if(!t)return e;return e+(t.price||0)*(t.quantity||1)},0)/100;return((e,t,n)=>{const o=e.discountData;if(!o||!o.tiers?.length)return null;const r=[...o.tiers].sort((e,t)=>e.minimumQuantity-t.minimumQuantity),i=[];if("mov_percentage"===o.type){if("number"!=typeof n)return null;const e=r.filter(e=>n>=e.minimumQuantity).pop();e&&i.push(`${e.discountValue}% OFF`);const t=r.find(e=>n<e.minimumQuantity);if(t){const e=t.minimumQuantity-n;i.push(`Add ₹${e} more to get ${t.discountValue}% OFF`)}return i.length?i.join(" + "):null}const a=r.filter(e=>t>=e.minimumQuantity);if(a.length>0){const e=a.reduce((e,t)=>e.minimumQuantity>t.minimumQuantity?e:t);let t=null;switch(o.type){case"percentage_discount_coupon":t=`${e.discountValue}% OFF`;break;case"amount_discount_coupon":t=`₹${e.discountValue} OFF`;break;case"fixed_price_collection":t=`Fixed ₹${e.discountValue}`;break;case"dummy_coupon":t="Discount Applied"}t&&i.push(t)}const l=r.find(e=>t<e.minimumQuantity);if(l){const e=l.minimumQuantity-t;let n=null;switch(o.type){case"percentage_discount_coupon":n=`${l.discountValue}% OFF`;break;case"amount_discount_coupon":n=`₹${l.discountValue} OFF`;break;case"fixed_price_collection":n=`Fixed ₹${l.discountValue}`;break;case"dummy_coupon":n="Discount"}n&&i.push(`Add ${e} more item${1!==e?"s":""} to get ${n}`)}return i.length?i.join(" + "):null})(e,t.length,n)}).filter(Boolean);return n(()=>{const e=m!==1/0&&g[p-1]===m-2&&m>1;let t=null;return e?(B(!0),t=setTimeout(()=>{B(!1)},3e3)):B(!1),()=>{t&&clearTimeout(t)}},[m,g,p]),n(()=>{if(N.current&&T){const e=N.current.offsetHeight;T(e)}},[x,T,a]),n(()=>{const e=Math.max(...l.map(({tier:e,items:t})=>{if("mov_percentage"!==e?.discountData?.type)return 0;const n=t.reduce((e,t)=>e+(t.price||0)*(t.quantity||1),0)/100,o=(e?.discountData?.tiers||[]).filter(e=>n>=e.minimumQuantity).sort((e,t)=>t.discountValue-e.discountValue)[0];return o?.discountValue??0}));if(e<(I.current??0)&&(I.current=e),e>(I.current??0)){I.current=e;const t=document.querySelector(".yt-collection-bundle-next-btn");if(!t)return;const n=t.getBoundingClientRect(),o=(n.left+n.width/2)/window.innerWidth,r=(n.top+n.height/2)/window.innerHeight;Ce({particleCount:100,spread:70,origin:{x:o,y:r},zIndex:9999})}},[l]),e.createElement("div",{ref:N,className:"yt-collection-bundle-bar",style:{background:S?.bundleBg||"#fff",color:S?.bundleText||"#333",border:S?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"compact"==S.stickyBarWidth?"600px":"90%",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},A.length>0&&e.createElement("div",{style:{padding:"4px 8px",background:"#dbdbdbc5",color:"#6c757d",textAlign:"center",fontSize:"12px",fontWeight:500}},A.join(" + ")),e.createElement("div",{className:"yt-collection-bundle-bar-header",style:{position:"relative",textAlign:"center"}},$&&e.createElement(e.Fragment,null,e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; transform: translateX(-50%) translateY(10px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n "),e.createElement("div",{className:"yt-collection-bundle-ctx",style:{position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)",background:S?.atcBg||"#007bff",color:S?.atcText||"#fff",padding:"4px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"14px",whiteSpace:"nowrap",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.2)",animation:"fadeIn 0.3s ease-out",minWidth:"300px",textAlign:"center",border:"1px solid rgba(0,0,0,0.1)",lineHeight:"normal"}},"Add up to"," ",e.createElement("span",{style:{fontWeight:600}},m," item",m>1?"s":"")))),a.length>0&&e.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",position:"relative",borderRadius:S?.borderRadius||"8px"}},e.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",scrollbarWidth:"none"}},l.filter(({count:e})=>e>0).map(({items:t},n,o)=>e.createElement(e.Fragment,{key:n},e.createElement("div",{className:"yt-collection-bundle-tier-images",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",minWidth:"fit-content"}},e.createElement("div",{style:{display:"flex",gap:"4px"}},t.map((t,o)=>{const r=i.config.builderTiers.collectionTier.flatMap(e=>e.products).find(e=>e.id.toString()===t.productId);if(!r)return null;const a=v(t.productId),l=p===a;return e.createElement("div",{key:o,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},e.createElement("div",{style:{position:"relative",width:"67px",height:"67px",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:l?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!l&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!l&&w(a)},e.createElement("img",{src:Tp(r.images[0]),style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${S?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none",border:"1px solid #ddd"},alt:"Selected"}),t.quantity>1&&e.createElement("div",{className:"yt-collection-bundle-qty-badge",style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600,lineHeight:"normal"}},"x",t.quantity),e.createElement("button",{className:"yt-collection-bundle-remove-btn",style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",textAlign:"center",lineHeight:"normal"},onClick:e=>{e.stopPropagation(),C(t.productId,t.variantId,n)}},"×")))}))),n<o.length-1&&o[n+1].count>0&&e.createElement("div",{style:{color:"#666",paddingInline:"6px",lineHeight:"normal"}},e.createElement(U,null)))))),x?e.createElement("div",{className:"yt-collection-bundle-mobile-bar-content",style:{display:"flex",flexDirection:c>0&&(k||i?.config?.builderTiers?.collectionTier?.length>1)?"column":"row",margin:"4px",gap:c>0?"10px":"0",background:"#dbdbdb",borderRadius:S?.borderRadius||"8px",overflow:"hidden"}},e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",alignItems:"center",borderRadius:S?.borderRadius||"8px"}},e.createElement(e.Fragment,null,0===c&&e.createElement("div",{style:{fontSize:"14px",color:"#6c757d",lineHeight:"normal",...0===c&&{padding:"8px 0 12px 0",background:"#dbdbdb",color:"#6c757d",width:"100%",borderRadius:S?.borderRadius||"8px"}}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"6px",width:"100%",justifyContent:"center",flexWrap:"wrap"}},e.createElement("div",{style:{fontSize:"14px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",z.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"12px",color:"#000",fontWeight:500}},"(",c," items)")))),e.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:1===p?"not-allowed":"pointer",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:p===u&&0===c||y?.6:1,textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(mp,null)):p===u?"Checkout":"Next"))):e.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:S?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},(i?.config?.builderTiers?.collectionTier?.length>1||k)&&c>0&&e.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:1===p?"#515151":"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:1===p?"not-allowed":"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===b&&{filter:"brightness(60%)"},textAlign:"center",lineHeight:"normal"},onClick:()=>w(e=>Math.max(1,e-1)),onMouseEnter:()=>h(-1),onMouseLeave:()=>h(null),disabled:1===p},"Back"),e.createElement("div",{className:"yt-collection-bundle-selected-info",style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:a.length>0?"space-between":"center",paddingInline:"6px",alignItems:"center",...0===c&&{padding:"12px 24px"}}},0===c&&e.createElement("div",{style:{fontSize:"16px",color:"#6c757d",lineHeight:"normal"}},"Add Items to Checkout"),c>0&&e.createElement("div",{className:"yt-collection-bundle-price-display",style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",justifyContent:"center"}},e.createElement("div",{style:{fontSize:"16px",color:"#000",fontWeight:600}},"₹",(P??s).toLocaleString()),F?e.createElement(e.Fragment,null,e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",z.toLocaleString()),e.createElement("div",{style:{background:"#d32f2f",color:"#fff",padding:"2px 8px",borderRadius:S?.borderRadius||"8px",fontSize:"10px",fontWeight:600}},"SAVE ",D)):e.createElement(e.Fragment,null,d>s&&e.createElement("div",{style:{fontSize:"14px",color:"#787878",textDecoration:"line-through"}},"₹",d.toLocaleString())),e.createElement("span",{style:{fontSize:"16px",color:"#000",fontWeight:500}},"(",c," items)"))),c>0&&e.createElement("button",{className:"yt-collection-bundle-next-btn "+(p===u&&0===c||y?"yt-collection-bundle-next-btn-disabled":""),style:{background:S?.btnPrimaryBg||"#28a745",color:S?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:p===u&&0===c||y?.6:1,...-2===b&&{filter:"brightness(90%)"},textAlign:"center",lineHeight:"normal"},onClick:p===u?E:()=>w(p+1),disabled:p===u&&0===c||f||y,onMouseEnter:()=>h(-2),onMouseLeave:()=>h(null)},f?e.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},e.createElement(mp,null)):p===u?"Checkout":"Next")))},Cp=window?.Shopify?.currency||{rate:1,active:"INR"},Ep=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Cp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},kp=(e,t)=>t==Cp.active?e:se(Cp.active)||Cp.active,Tp=(e,t)=>{if(!e||!e.includes("cdn.shopify")&&!e.includes("/cdn/shop/files/"))return e;try{const n=new URL(e),o=n.searchParams;return o.has("format")||o.set("format","webp"),o.has("quality")||o.set("quality",t?.toString()||"70"),o.has("width")||o.set("width","600"),n.toString()}catch{const n=e.includes("?")?"&":"?";return e+n+`format=webp&quality=70&width=${t?.toString()||"600"}`}},Sp=(e,t,n,o,r,i,a)=>{const l=o.findIndex(t=>t.variantId===e&&(void 0===a||t.tierIndex===a));r(0===n?e=>e.filter((e,t)=>t!==l):-1===l?o=>[...o,{product:t,variantId:e,quantity:n,isFree:i,tierIndex:a}]:e=>e.map((e,t)=>t===l?{...e,quantity:e.quantity+n,isFree:i,tierIndex:a}:e))},$p=({bundle:t,currentProductId:n,addToCartFunction:o,addCustomBundleToCart:r,selectedItems:i,setSelectedItems:a,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:s,renderingOnPage:d,bundleSubtotal:p,dispatchAnalyticsEvent:u,fetchStoreDetails:m})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(Hc,{bundleAddToCartLoading:l,bundle:t,selectedItems:i,setSelectedItems:a,handleAddToCart:r,handleRemoveItem:c,renderingOnPage:d,selectedItemsQuantity:s??0,bundleSubtotal:p??{price:0,compareAtPrice:0},dispatchAnalyticsEvent:u,fetchStoreDetails:m}):"combo"===t.type?e.createElement(Qc,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(nd,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(bp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(Es,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(up,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),Bp=c.div`
4663
4663
  position: relative;
4664
4664
  `,Np=c.button`
4665
4665
  border: 1px solid #ccc;
@@ -5291,4 +5291,4 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
5291
5291
  &:hover {
5292
5292
  border-color: ${({$themeColor:e})=>e||"#000"};
5293
5293
  }
5294
- `,xu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=ie(en),w=ae(Ut),C=r(null),[E,k]=t(null),[T,S]=t(!1),[$,B]=t({}),[N,I]=t(h?.variantId),[z,F]=t(h?.quantity||1),[D,P]=t(!1),A=ir();n(()=>{h?.open?setTimeout(()=>{P(!0)},10):P(!1)},[h?.open]);n(()=>{(async()=>{if(!E&&l&&h?.variantId&&h?.handle){const e=await l(h.handle,h.variantId);if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){I(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),B(n)}else I(void 0),B({})}k(e)}})()},[E,l,h]);const _=(e,t)=>{const n={...$,[e]:t};B(n);const o=E?.variants?.find(e=>E.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&I(String(o.id))}},R=E?.variants?.find(e=>String(e.id)===String(N)),O=on(w,w?.currency),L=o(()=>{const e={};if(!E)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return E.options.forEach(n=>{e[n.name]=n.values.filter(e=>E.variants.filter(o=>{const r=E.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!E.options.every((e,t)=>{if(e.name===n.name)return!0;const r=$[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[E,$,h]);return E?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:D?1:0,transition:"opacity 0.3s ease"},onClick:()=>{P(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(Up,{ref:b,className:"yt-variant-selection-popup"},e.createElement(Gp,{ref:C,style:{backgroundColor:p||"white",opacity:D?1:0,transform:D?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Yp,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Zp,null,e.createElement(Kp,null,e.createElement(Jp,null,e.createElement(eu,{src:R?.featured_image?.src??E?.featured_image,alt:R?.featured_image?.alt??E?.title})),e.createElement(tu,null,e.createElement(nu,{$themeColor:c,$primaryTextColor:y,href:`${E?.url}?variant=${R?.id}`},E?.title),e.createElement(uu,null,e.createElement(ou,null,e.createElement(ru,{$primaryTextColor:y},O,tn(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(iu,null,O,tn(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(Ko,{value:z,handleItemQuantityIncrement:async()=>{F(e=>e+1)},handleItemQuantityDecrement:async()=>{z>1&&F(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),E?.options?.map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(lu,{key:t.name},e.createElement(su,null,e.createElement("span",null,"Select ",t.name),$[t.name]&&e.createElement(du,null,$[t.name])),e.createElement(pu,null,L[t.name]?.map(o=>{const r=$[t.name]===o,i=rr(n,o);return"color"===n?.type&&i?.value?e.createElement(mu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(gu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(cu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(au,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(N&&a){S(!0);try{await a(N,z,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}S(!1)}}:async()=>{if(!N)return;const e=!!h?.lineItemKey,t=String(N)!==String(h?.variantId);if(!e||t){S(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(N,h.allowedVariantIds):e&&m?await m(N,h.allowedVariantIds):a&&N&&await a(N,z,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}S(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!N||T},T?e.createElement(ue,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(Up,{ref:b},e.createElement(Gp,{style:{backgroundColor:p||"white"}},e.createElement(Xp,null,e.createElement(me,{color:c||"#868E96"}))))});xu.displayName="DesktopVariantPopup";const fu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=ie(en),w=ae(Ut),[C,E]=t(null),[k,T]=t(!1),[S,$]=t({}),[B,N]=t(h?.variantId),[I,z]=t(h?.quantity||1),F=r(null),D=ir(),[P,A]=t(!1);n(()=>{h?.open?setTimeout(()=>{A(!0)},10):A(!1)},[h?.open]);n(()=>{(async()=>{if(!C&&l&&h?.variantId&&h?.handle)try{const e=await l(h.handle,h.variantId);if(!e)return;if(!e.variants||!Array.isArray(e.variants))return;if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){N(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),$(n)}else N(void 0),$({})}E(e)}catch(e){}})()},[C,l,h]),n(()=>{},[p,i,a,l]);const _=(e,t)=>{const n={...S,[e]:t};$(n);const o=C?.variants?.find(e=>C.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&N(String(o.id))}},R=C?.variants?.find(e=>String(e.id)===String(B)),O=on(w,w?.currency),L=o(()=>{const e={};if(!C)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return C.options.forEach(n=>{e[n.name]=n.values.filter(e=>C.variants.filter(o=>{const r=C.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!C.options.every((e,t)=>{if(e.name===n.name)return!0;const r=S[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[C,S,h]);return C?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:P?1:0,transition:"opacity 0.3s ease"},onClick:()=>{A(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(Up,{ref:b,className:"yt-variant-selection-popup"},e.createElement(Gp,{ref:F,style:{backgroundColor:p||"white",opacity:P?1:0,transform:P?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Yp,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Zp,null,e.createElement(Kp,null,e.createElement(Jp,null,e.createElement(eu,{src:R?.featured_image?.src??C?.featured_image,alt:R?.featured_image?.alt??C?.title})),e.createElement(tu,null,e.createElement(nu,{$themeColor:c,$primaryTextColor:y,href:`${C?.url}?variant=${R?.id}`},C?.title),e.createElement(uu,null,e.createElement(ou,null,e.createElement(ru,{$primaryTextColor:y},O,tn(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(iu,null,O,tn(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(Ko,{value:I,handleItemQuantityIncrement:async()=>{z(e=>e+1)},handleItemQuantityDecrement:async()=>{I>1&&z(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),C?.options?.map(t=>{const n=D?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(lu,{key:t.name},e.createElement(su,null,e.createElement("span",null,"Select ",t.name,":"),S[t.name]&&e.createElement(du,null,S[t.name])),e.createElement(pu,null,L[t.name]?.map(o=>{const r=S[t.name]===o,i=rr(n,o);return"color"===n?.type&&i?.value?e.createElement(mu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(gu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(cu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(au,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(B&&a){T(!0);try{await a(B,I,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}T(!1)}}:async()=>{if(!B)return;const e=!!h?.lineItemKey,t=String(B)!==String(h?.variantId);if(!e||t){T(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(B,h.allowedVariantIds):e&&m?await m(B,h.allowedVariantIds):a&&B&&await a(B,I,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}T(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!B||k},k?e.createElement(ue,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(Up,{ref:b},e.createElement(Gp,{style:{backgroundColor:p||"white"}},e.createElement(Xp,null,e.createElement(me,{color:c||"#868E96"}))))});const yu=({setIsCartOpen:t,isCartOpen:n,cartCheckpoints:o,customCartProgressBarCriteria:r,floatingCartData:i,effectiveQuantityForProgressBar:a,cartComponentsCornerType:l,cartComponentsCornerRadius:c})=>{const s=ae(Ut),d=i?.bannerFooterText,p="string"==typeof d&&d.trim().length>0,u=!n&&(e=>{try{if("undefined"==typeof window)return!1;const t=window.location.pathname||"/";if("/"===t||""===t)return!0;const n=e?.showOnPages;if(!Array.isArray(n)||0===n.length)return!1;const o=t.toLowerCase(),r=o.endsWith("/")?o:`${o}/`;return n.some(e=>{if(!e||"string"!=typeof e)return!1;const t=e.trim().toLowerCase().replace(/^\/|\/$/g,"");if(!t)return!1;const n=`/${t}/`;return r.includes(n)})}catch{return!1}})(i),m=s?.item_count??0,g=tn(s?.items_subtotal_price??0,s?.currency??"INR"),x=on(s),f=function(e,t,n,o,r){if(!e||0===e.length)return{deltaValue:0,show:!1};const i=(t??"minimum_order_value").toLowerCase(),a="quantity_threshold"===i?"number"==typeof r?r:o:n,l=[...e].sort((e,t)=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)-("quantity_threshold"===i?t.quantityThreshold:t.minimumOrderValue)).find(e=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)>a);if(!l)return{deltaValue:0,show:!1};const c="quantity_threshold"===i?l.quantityThreshold:l.minimumOrderValue,s=Math.max(0,c-a);return{deltaValue:s,show:s>0,isQuantity:"quantity_threshold"===i}}(o,r,g,m,a),y="sharp"===l?0:c??12,h=i?.textColor??"#111",v=i?.backgroundColor??"#FF7E6E",w=i?.bannerBackgroundColor??"#FFE0DC",C=i?.buttonColor??"#E8513F",E=e.useRef(null);e.useEffect(()=>{pn(E.current)},[C]);const k={position:"fixed",width:"100%",bottom:0,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"},T={background:"#FFFFFF",color:"#111",padding:"5px",fontSize:12,fontFamily:"Poppins",fontWeight:600,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",gap:8},S={background:"#fff",color:h,borderRadius:y,boxShadow:"0 10px 24px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:"Poppins"},$={position:"absolute",top:0,left:"50%",transform:"translate(-50%, -70%)",backgroundColor:w,color:h,padding:8,fontSize:12,lineHeight:"normal",borderTopLeftRadius:13,borderTopRightRadius:13,width:"97%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,zIndex:-1},B={display:"flex",alignItems:"center",gap:12,padding:"10px 12px",backgroundColor:v,cursor:"pointer"},N={display:"flex",alignItems:"center",gap:8,fontWeight:700,fontSize:16,color:h},I={fontSize:12,color:h,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},z={padding:"5px 10px",background:C,color:"#fff",borderRadius:8,fontSize:15,fontWeight:700,border:"none",outline:"none",flexShrink:0};if(!u)return null;if(0===m){if(!f.show)return null;const t=f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${un(f.deltaValue.toFixed(0))} to get freebie`;return e.createElement("div",{style:k},e.createElement("div",{className:"yt-cart-floating-ribbon",style:T},e.createElement(b,{"aria-hidden":!0}),e.createElement("span",null,t)))}const F=1===m?"1 item":`${m} items`,D=i?.lastTierUnlockedText||"Best tier unlocked",P=f.show?f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${un(f.deltaValue.toFixed(0))} more to get freebie`:D;return e.createElement("div",{style:{position:"fixed",left:12,right:12,bottom:12,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"}},e.createElement("div",{style:{position:"relative"}},(f.show||o&&o.length>0)&&e.createElement("div",{className:"yt-cart-floating-banner",style:$},e.createElement(b,{"aria-hidden":!0,style:{marginBottom:7}}),e.createElement("span",{style:{display:"inline-block",marginBottom:7}},P)),e.createElement("div",{style:S},e.createElement("div",{className:"yt-cart-floating-body",style:B,onClick:()=>t(!0)},e.createElement(_,{width:24,height:24,color:h}),e.createElement("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,lineHeight:"normal"}},e.createElement("div",{style:N},e.createElement("span",null,x,un(g.toFixed(0))),e.createElement("span",{style:{fontSize:9,fontWeight:600,color:"#fff",backgroundColor:"#828282",marginBottom:5,paddingInline:5}},F)),p?e.createElement("span",{style:I,title:d},d):null),e.createElement("button",{ref:E,style:z,onClick:()=>t(!0),"aria-label":"View Cart"},"View Cart")))))},bu=({exploreCTAColor:o,checkoutFontSize:i,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,cartTitle:p,emptyCartTitle:u,emptyCartDescription:m,emptyCartButtons:g,backgroundColor:x,backgroundSubdued:f,tertiaryColor:y,tertiaryTextColor:b,backdrop:h=!0,cartData:v,isUserSignedIn:w,showBundle:C,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:B,removeDiscount:N,applyDiscount:I,discountApplied:z,checkoutFunction:F,joinNowFunction:D,guestLoyaltyPercentage:P,showToggleButton:A,isOpen:_,setIsOpen:R,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K,checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ae,showProductRecsOnDesktop:ce,showProductRecsOnMobile:se,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,showNoteOption:Ee,applyNoteToCart:ke,note:Te,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Be,showEditOptionOnProducts:Ne,getProductDetailsByVariantId:Ie,onSetLoading:ze,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:De,currentTier:Pe,freebieProductsInCart:Ae,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,showStickyAddToCart:Ge,stickyCartLineItem:Xe,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,enableCustomCartOnCartPage:rt,isCartPage:it,progressBarFreeProductIconType:at,addToStickyCart:lt,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,showFloatingCart:ut,floatingCartData:mt,freebieMilestoneData:gt,cartTimerInMinutes:xt,cartTimerCustomText:ft,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,stickyCartCustomizationData:vt,cartOffersCarousalData:wt,stickyBarBuyNowFunction:Ct,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Bt,loyaltyDiscount:Nt,brandTokenName:It,showDiscountOnMRP:zt,prefixMessageText:Ft,suffixMessageText:Dt,successMessageText:Pt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht=!0,showCouponOptions:qt,rewardCoupons:Qt,comboBundleData:Yt,comboBundleAddToCartFunction:Gt,stealDealCheckpoints:Xt,stealDealProducts:Zt,stealDealAddToCart:Kt,useCartShell:Jt,showTrustedBadge:tn,trustedBadgeData:nn})=>{const on=le(Ut),[rn,an]=ie(en),[ln,cn]=ie(Vi),sn=()=>R(!_),[dn,pn]=t(()=>{const e=window.ytComboBundle;return{comboBundleData:e?.bundle??null,comboBundleAddToCartFunction:e?.addToCart??null}});n(()=>{const e=e=>{const t=e.detail;pn({comboBundleData:t?.bundle??null,comboBundleAddToCartFunction:t?.addToCart??null})};return window.addEventListener("yt-combo-bundle-updated",e),()=>window.removeEventListener("yt-combo-bundle-updated",e)},[]);const un=dn.comboBundleData??Yt,mn=dn.comboBundleAddToCartFunction??Gt,[gn,xn]=t(()=>{const e=window.ytVolumeBundle;return{bundle:e?.bundle??void 0,currentTier:e?.currentTier??void 0,volumeBundleAddToCartFunction:e?.addToCart??void 0}});n(()=>{const e=e=>{const t=e.detail;xn({bundle:t?.bundle??void 0,currentTier:t?.tierData??void 0,volumeBundleAddToCartFunction:t?.addToCart??void 0})};return window.addEventListener("yt-volume-bundle-updated",e),()=>window.removeEventListener("yt-volume-bundle-updated",e)},[]);const fn=r(null),yn=r(0);a(()=>{if(v){const e=v?.token??null,t="number"==typeof v?.cartUpdatedAtMs?v.cartUpdatedAtMs:void 0;e!==fn.current&&(fn.current=e,yn.current=t??0);const n=yn.current;if(!(void 0===t||t>=n))return;void 0!==t&&(yn.current=t),on(v)}},[v]);const bn=r(null);n(()=>{function e(e){bn.current&&!bn.current.contains(e.target)&&(an({open:!1,variantId:void 0,quantity:void 0,handle:void 0}),cn({isOpen:!1}))}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const[hn,vn]=t(!1);return n(()=>{const e=()=>{vn(window.innerWidth>=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{if(!Jt)return;const e=window.ytCartShell;if(!e)return;const t=e.getDrawerElement?.(),n=e.getOverlayElement?.();t&&(!_||rt&&it?(t.style.setProperty("transform","translateX(100%)","important"),t.style.boxShadow="none",n&&(n.style.display="none"),document.body.classList.remove("drawer-open")):(t.style.setProperty("transform","translateX(0)","important"),t.style.boxShadow="-14px 8px 14.4px 0px rgba(0, 0, 0, 0.35)",h&&n&&(n.style.display="block"),document.body.classList.add("drawer-open")))},[_,Jt,rt,it,h]),n(()=>{if(!Jt)return;const e=window.ytCartShell,t=e?.getOverlayElement?.();if(!t)return;const n=()=>R(!1);return t.addEventListener("click",n),()=>t.removeEventListener("click",n)},[Jt,R]),e.createElement(e.Fragment,null,e.createElement("div",{style:{position:rt&&it?"relative":"absolute",width:"100%",display:rt&&it?"flex":"block",alignItems:"center",justifyContent:"center"}},A&&!(rt&&it)&&e.createElement("button",{style:{margin:"16px"},onClick:sn},_?"Close Drawer":"Open Drawer"),!Jt&&_&&h&&!(rt&&it)&&e.createElement("div",{onClick:sn,id:"custom-cart-yt-overlay",style:{position:"fixed",top:0,right:0,zIndex:1e4,transform:"translateX(0)",backgroundColor:"rgba(0,0,0,0.5)",inset:0,height:"100%",width:"100%"}},"‎"),e.createElement(Il,{useCartShell:Jt,isCartPage:it,enableCustomCartOnCartPage:rt,isOpen:_,setIsOpen:R,backgroundColor:x,backgroundSubdued:f??"#F5F5F5",tertiaryColor:y,tertiaryTextColor:b,exploreCTAColor:o,checkoutFontSize:i,cartTitle:p,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,emptyCartTitle:u,emptyCartButtons:g,emptyCartDescription:m,showBundle:C,isUserSignedIn:w,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:B,removeDiscount:N,applyDiscount:I,discountApplied:z,checkoutFunction:F,joinNowFunction:D,guestLoyaltyPercentage:P,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K??"minimum_order_value",checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ae,showProductRecsOnDesktop:ce,showProductRecsOnMobile:se,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,applyNoteToCart:ke,note:Te,showNoteOption:Ee,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Be,showEditOptionOnProducts:Ne,onSetLoading:ze,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:De,currentTier:Pe,freebieProductsInCart:Ae,cartOffersCarousalData:wt,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,progressBarFreeProductIconType:at,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,freebieMilestoneData:gt,cartTimerCustomText:ft,cartTimerInMinutes:xt,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Bt,loyaltyDiscount:Nt,getProductDetailsByVariantId:Ie,brandTokenName:It,showDiscountOnMRP:zt??!0,prefixMessageText:Ft,suffixMessageText:Dt,successMessageText:Pt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht,stealDealCheckpoints:Xt,stealDealProducts:Zt,stealDealAddToCart:Kt,showCouponOptions:qt,rewardCoupons:Qt,showTrustedBadge:tn,trustedBadgeData:nn}),Ge&&Xe&&d&&e.createElement(Qp,{showStickyCart:Ge,stickyCartCustomizationData:vt,product:Xe,addCartItem:d,onSetLoading:ze,themeColor:de,themeTextColor:pe,cartData:v,isCartOpen:_,setIsCartOpen:R,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,addToStickyCart:lt,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,checkoutFunction:Ct,backgroundColor:x,primaryTextColor:ne,comboBundleData:un,comboBundleAddToCartFunction:mn,volumeBundleCurrentTier:gn.currentTier,volumeBundleData:gn.bundle,volumeBundleAddToCartFunction:gn.volumeBundleAddToCartFunction}),hn&&rn.open&&e.createElement(xu,{backgroundColor:x,ref:bn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:Ie,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Kt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne}),!hn&&rn.open&&e.createElement(fu,{ref:bn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:Ie,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,backgroundColor:x,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Kt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne})),!hn&&ut&&e.createElement(yu,{isCartOpen:_,setIsCartOpen:R,cartCheckpoints:j,customCartProgressBarCriteria:K,floatingCartData:mt,effectiveQuantityForProgressBar:Le,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt}))};gt(".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 hu=()=>e.createElement("div",{className:"scene"},e.createElement("div",{className:"floating"},e.createElement("div",{className:"cube"},e.createElement("div",{className:"side front"},"‎"),e.createElement("div",{className:"side back"},"‎"),e.createElement("div",{className:"side left"},"‎"),e.createElement("div",{className:"side right"},"‎"),e.createElement("div",{className:"side bottom"},"‎"),e.createElement("div",{className:"lid"},e.createElement("div",{className:"flap north"},"‎"),e.createElement("div",{className:"flap south"},"‎"),e.createElement("div",{className:"flap east"},"‎"),e.createElement("div",{className:"flap west"},"‎"))))),vu=({config:t,brandConfig:n})=>{const{heroDesktopImage:o,heroMobileImage:r,heroTitle:i="ZERO WASTE PREMIUM PET CARE",heroSubtitle:a="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:s="#000000",heroSubtitleFontWeight:d="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:g="#1C1C1D",primaryContrastColor:x="#FFFFFF",secondaryColor:f="#FFFFFF",secondaryContrastColor:y="#000000",accentColor:b="#FFFFFF",borderColor:N="#E5E5E5",themeRoundness:I="0px",heroBannerVisibility:z="show",stepsVisibility:F="show",waysToEarnVisibility:D="show",waysToEarnCustomText:P="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",customSectionVisibility:A="show",footerSignupVisibility:_="show",customSectionImagePosition:R="left",customSectionTitle:O="Earn Doglycoins every time you shop",customSectionSubtitle:L="Collect more Doglycoins by entering your birthday, following us on social or referring a friend (details below)\n\nRedeem your Doglycoins for cash off at checkout by signing in or creating an account. Did you shop without registering? No worries, your Credits have been saved for you",customSectionTitleFontSize:M="36px",customSectionSubtitleFontSize:V="18px",customSectionImage:j,customSectionTextAlignment:W="left",customSectionTitleColor:H="#000000",customSectionSubtitleColor:q="#000000",stepsTitle:Q="Getting started is easy",stepsSubtitle:U="Earn Stars and get rewarded in a few easy steps.",step1Title:Y="CREATE AN ACCOUNT",step1Description:G="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:X="ORDER AND EARN REWARDS POINTS",step2Description:Z="Use cash, credit/debit card or save some time and pay right through the app. You'll collect Stars all ways.",step3Title:K="UNLOCK REWARDS AND OFFERS",step3Description:J="As you earn Stars, you can redeem them for Rewards—like free food, drinks, and more. Start redeeming with as little as 25 Stars!",footerCustomText:ee="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:te="Use your points to redeem samples and more."}=t||{},ne="undefined"!=typeof window&&window.innerWidth<=768,oe=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${g}`,transition:"all 0.3s ease"},ie={...re,backgroundColor:g,color:x,borderColor:g},ae={...re,backgroundColor:f,color:y,borderColor:N},{newSignupTokens:le,firstOrderTokens:ce,instagramFollowPoints:se,twitterFollowPoints:de,facebookFollowPoints:pe,youtubeSubscriptionPoints:ue,rewardToLeaveReview:me,birthdayPoints:ge,referralPointsForReferrer:xe,tokenCreditPercentage:fe,brandTokenName:ye}=n||{},be=[...le?[{icon:e.createElement(h,null),title:`${le} ${ye}`,subtitle:"Create an account"}]:[],...ce?[{icon:e.createElement(v,null),title:`${ce} ${ye}`,subtitle:"Place your first order"}]:[],...fe?[{icon:e.createElement(v,null),title:`${fe}% ${ye}`,subtitle:`Earn ${fe}% back on every order`}]:[],...xe?[{icon:e.createElement(w,null),title:`${xe} ${ye}`,subtitle:"Refer a friend and get"}]:[],...ge?[{icon:e.createElement(C,null),title:`${ge} ${ye}`,subtitle:"Get on your birthday to spend"}]:[],...me?[{icon:e.createElement(E,null),title:`${me} ${ye}`,subtitle:"Write a Review"}]:[],...pe?[{icon:e.createElement(k,null),title:`${pe} ${ye}`,subtitle:"Like on Facebook"}]:[],...se?[{icon:e.createElement(T,null),title:`${se} ${ye}`,subtitle:"Follow on Instagram"}]:[],...de?[{icon:e.createElement(S,null),title:`${de} ${ye}`,subtitle:"Follow on Twitter"}]:[],...ue?[{icon:e.createElement($,null),title:`${ue} ${ye}`,subtitle:"Subscribe on YouTube"}]:[]];return e.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===z&&e.createElement("div",{className:"yt-loyalty-page-hero",style:{position:"relative",minHeight:"500px",display:"flex",alignItems:"center",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start",backgroundImage:`url(${oe(ne&&r?r:o)})`,backgroundSize:"cover",backgroundPosition:"center",padding:ne?"40px 20px":"60px 80px"}},e.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},e.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:ne?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},i),e.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:s,fontWeight:Number(d)||400,marginBottom:"32px"}},a),m&&e.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},e.createElement("button",{className:"yt-loyalty-page-hero-button",style:ie,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===F&&e.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},e.createElement("div",{className:"yt-loyalty-page-steps-background-text",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"GETTING STARTED"),e.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},e.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},Q),e.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:g,marginBottom:"24px"}},U),e.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:e.createElement(v,null),title:Y,desc:G},{icon:e.createElement(B,null),title:X,desc:Z},{icon:e.createElement(C,null),title:K,desc:J}].map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{className:"yt-loyalty-page-step-icon",style:{width:"80px",height:"80px",borderRadius:"50%",border:"4px solid #ccc",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"32px",color:"#666",marginBottom:"12px"}},t.icon),e.createElement("div",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,color:g,textTransform:"uppercase",lineHeight:"normal"}},t.title),e.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:g,lineHeight:1.2,maxWidth:"300px"}},t.desc)))))),"show"===D&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-background-text",style:{position:"absolute",top:ne?"10%":"35%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"WAYS TO EARN"),e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"12px"}},be.map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{width:ne?"100%":"220px",border:"2px solid #ddd",padding:"12px 8px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:I,boxShadow:"-1px 2px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"4px",color:"#1a1a2e"}},t.icon),e.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"13px",fontWeight:700,marginBottom:"2px",textTransform:"uppercase",color:"#000"}},t.title),e.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"11px",color:"#666"}},t.subtitle)))),P&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-custom-text",style:{maxWidth:"1000px",margin:"24px auto 0",backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},P)),"show"===A&&e.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:ne?"40px 0px":"40px 20px",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:ne?"column":"row",alignItems:"center",gap:"40px",borderRadius:I,overflow:"hidden",backgroundColor:"#F9F9F9"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:ne||"left"===R?0:1}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:j?`url(${oe(j)})`:o?`url(${oe(o)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),e.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:ne?"20px":"10px",textAlign:ne?"center":W,order:ne||"left"===R?1:0,marginBottom:ne?"20px":"0px"}},e.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:M,fontWeight:700,marginBottom:"16px",color:H}},O),e.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:V,color:q,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},L)))),"show"===_&&e.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},e.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},e.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},ee),e.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:ne?"center":"left"}},e.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},e.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000",textAlign:ne?"center":"left"}},"Rewards Program"),e.createElement("p",{style:{fontSize:"14px",color:"#666"}},te)),e.createElement("button",{className:"yt-loyalty-page-footer-signup-button",style:ae,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"JOIN NOW")))))},wu=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:i},e.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"16px",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},"free_product"===o.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},o.name),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"16px",padding:"12px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"clamp(16px, 4vw, 18px)",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"20px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(N,null):e.createElement(I,null))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),e.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},e.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),e.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return A(p,document.body)},Cu=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:i},e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),e.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),e.createElement("div",{style:{overflowY:"auto",flex:1}},e.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},e.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},"free_product"===o.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},o.name),e.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"20px",padding:"14px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"18px",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"22px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(N,null):e.createElement(I,null)))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),e.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},e.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t)))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return A(p,document.body)},Eu=({offersToShow:o,offersConfig:i,getOfferCardMessage:a,setSelectedOffer:l,setShowPopup:c})=>{const s=r(null),[d,p]=t(!1),[u,m]=t(!0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=768),f=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};n(()=>{f();const e=s.current;if(e)return e.addEventListener("scroll",f),()=>e.removeEventListener("scroll",f)},[o]),n(()=>{const e=()=>{x(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const y=e=>{if(s.current){const t=g?280:365,n=16,o="right"===e?t+n:-(t+n);s.current.scrollBy({left:o,behavior:"smooth"})}};return e.createElement("div",{style:{position:"relative"}},e.createElement("svg",{style:{position:"absolute",width:0,height:0}},e.createElement("defs",null,e.createElement("mask",{id:"coupon-cut-mask-desktop"},e.createElement("rect",{width:"365",height:"138",fill:"white"}),e.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),e.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),e.createElement("mask",{id:"coupon-cut-mask-mobile"},e.createElement("rect",{width:"280",height:"120",fill:"white"}),e.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),e.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&e.createElement("button",{onClick:()=>y("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(z,{size:20})),u&&e.createElement("button",{onClick:()=>y("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(F,{size:20})),e.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:g?"110px":"128px"}},o?.map(t=>e.createElement("div",{key:t.discountId,style:{flexShrink:0,width:g?"280px":"365px",minWidth:g?"280px":"365px",minHeight:g?"110px":"128px",backgroundColor:"transparent",borderRadius:`${i?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},e.createElement("div",{style:{width:g?"60px":"80px",minHeight:g?"110px":"128px",backgroundColor:i?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:g?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${i?.roundness||0}px`,borderBottomLeftRadius:`${i?.roundness||0}px`}},e.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),i?.iconVisibility&&e.createElement("div",{style:{position:"absolute",left:g?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:g?"32px":"40px",height:g?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===t.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{flex:1,padding:g?"12px 12px":"15px 15px",paddingLeft:g?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${i?.roundness||0}px`,borderBottomRightRadius:`${i?.roundness||0}px`,overflow:"hidden",backgroundColor:i?.cardBackgroundColor||"#ffffff",minWidth:0}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:g?"4px":"6px",lineHeight:"normal"}},e.createElement("div",{style:{fontSize:g?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===t.couponType?"Free Gift":t._customOffer?.code?"Coupon":"Special Deal"),e.createElement("div",{style:{fontSize:g?"13px":"15px",fontWeight:"600",color:i?.textColor||"#2c3e50"}},t.name),e.createElement("div",{style:{fontSize:g?"11px":"12px",color:i?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:g?"28px":"32px"}},a(t))),e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),l(t),c(!0)},style:{fontSize:g?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},i?.viewDetailsTitle||"View Details")))))),e.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},ku=({offersToShow:o,offersConfig:r,getOfferCardMessage:i,setSelectedOffer:a,setShowPopup:l})=>{const[c,s]=t("undefined"!=typeof window&&window.innerWidth<=768);return n(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.createElement("div",{style:{borderRadius:`${r?.roundness||8}px`}},o?.map((t,n)=>e.createElement("div",{key:t.discountId,style:{display:"flex",alignItems:"flex-start",gap:c?"8px":"12px",padding:c?"12px 0":"16px 0",paddingLeft:c?"10px":"20px",backgroundColor:!0===r?.cardBackgroundTransparent||"true"===String(r?.cardBackgroundTransparent)?"transparent":r?.cardBackgroundColor||"#ffffff",borderBottom:n<(o?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${r?.roundness||0}px`}},r?.iconVisibility&&e.createElement("div",{style:{width:c?"40px":"50px",height:c?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:c?"20px":"25px",marginTop:c?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===t.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:c?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},t.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",e.createElement("span",{style:{fontWeight:600,color:r?.textColor||"#34495e"}},t.name)),e.createElement("div",{style:{fontSize:c?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},i(t)),e.createElement("div",{style:{fontSize:c?"11px":"12px",color:"#000000"}},"offer auto applied",e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),a(t),l(!0)},style:{color:r?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},r?.viewDetailsTitle||"T&C"))))))},Tu=({offersConfig:o,offers:i})=>{const[a,l]=t(!1),[c,s]=t(null),[d,p]=t(null),[u,m]=t("undefined"!=typeof window&&window.innerWidth<=768),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=450),f=r(null);n(()=>{const e=()=>{m(window.innerWidth<=768),x(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{f.current&&pn(f.current)},[o?.sectionBgContrastColor]);const y=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",o=-1;Object.keys(t).forEach(e=>{t[e]>o&&(o=t[e],n=e)});const r=e.map((e,t)=>({o:e,idx:t})),i=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return r.sort((e,t)=>{const o=e.o.customCartProgressBarCriteria===n,r=t.o.customCartProgressBarCriteria===n;if(o&&r){const n=i(e.o),o=i(t.o);return n!==o?n-o:e.idx-t.idx}return o&&!r?-1:!o&&r?1:e.idx-t.idx}),r.map(e=>e.o)})((!1===o?.showBackendOffers&&o?.customOffers&&o.customOffers.length>0?o.customOffers.map((e,t)=>{return{discountId:-(t+1),name:(n=e).title,couponType:n.code?"discount_code":"special_deal",customCartProgressBarCriteria:null,discountPercentage:null,couponTemplateId:0,minimumOrderValue:0,quantityThreshold:0,_allVariantIds:[],description:n.description,_customOffer:n};var n}):i)||[]),b=e=>{if(s(e),e){const t=e._customOffer;p(t?(e=>({offerMessage:e.description||"Special offer available",terms:e.terms?e.terms.split("\n").filter(e=>""!==e.trim()):[]}))(t):(e=>{const t="free_product"===e.couponType;let n="";t?n="Get this product for free!":e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const o=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?o.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&o.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&o.push("Combines with other order discounts"),t||o.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:o}})(e))}},h=e=>{const t=e._customOffer;return t?t.description||"Special offer available":(e=>"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?`add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to unlock`:"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue?`unlocks on orders above ${e.minimumOrderValue}`:"Special offer available")(e)};return e.createElement("div",null,e.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===o?.sectionType?`${o?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:o?.sectionBackgroundColor||"#fff"}},e.createElement("div",{style:{border:"coupon"===o?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=o?.cardPadding?`${o.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===o?.sectionType?`${o?.roundness||8}px`:"0px"}},e.createElement("span",{ref:f,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"right"===o?.alignment?"auto":"50%",right:"right"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===o?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:o?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},o?.sectionTitle||"Available Deals and Offers"),(()=>{const t=o?.sectionType;return"list"===t?e.createElement(ku,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):"coupon"===t?e.createElement(Eu,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):null})(),g?e.createElement(Cu,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}):e.createElement(wu,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}))))};export{$p as Bundle,hu as BundleLoader,bu as Cart,vu as LoyaltyPageBlock,Lt as Nudge,Tu as ProductOffers,Qt as SpinnerWheel};
5294
+ `,xu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=ie(en),w=ae(Ut),C=r(null),[E,k]=t(null),[T,S]=t(!1),[$,B]=t({}),[N,I]=t(h?.variantId),[z,F]=t(h?.quantity||1),[D,P]=t(!1),A=ir();n(()=>{h?.open?setTimeout(()=>{P(!0)},10):P(!1)},[h?.open]);n(()=>{(async()=>{if(!E&&l&&h?.variantId&&h?.handle){const e=await l(h.handle,h.variantId);if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){I(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),B(n)}else I(void 0),B({})}k(e)}})()},[E,l,h]);const _=(e,t)=>{const n={...$,[e]:t};B(n);const o=E?.variants?.find(e=>E.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&I(String(o.id))}},R=E?.variants?.find(e=>String(e.id)===String(N)),O=on(w,w?.currency),L=o(()=>{const e={};if(!E)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return E.options.forEach(n=>{e[n.name]=n.values.filter(e=>E.variants.filter(o=>{const r=E.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!E.options.every((e,t)=>{if(e.name===n.name)return!0;const r=$[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[E,$,h]);return E?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:D?1:0,transition:"opacity 0.3s ease"},onClick:()=>{P(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(Up,{ref:b,className:"yt-variant-selection-popup"},e.createElement(Gp,{ref:C,style:{backgroundColor:p||"white",opacity:D?1:0,transform:D?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Yp,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Zp,null,e.createElement(Kp,null,e.createElement(Jp,null,e.createElement(eu,{src:R?.featured_image?.src??E?.featured_image,alt:R?.featured_image?.alt??E?.title})),e.createElement(tu,null,e.createElement(nu,{$themeColor:c,$primaryTextColor:y,href:`${E?.url}?variant=${R?.id}`},E?.title),e.createElement(uu,null,e.createElement(ou,null,e.createElement(ru,{$primaryTextColor:y},O,tn(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(iu,null,O,tn(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(Ko,{value:z,handleItemQuantityIncrement:async()=>{F(e=>e+1)},handleItemQuantityDecrement:async()=>{z>1&&F(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),E?.options?.map(t=>{const n=A?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(lu,{key:t.name},e.createElement(su,null,e.createElement("span",null,"Select ",t.name),$[t.name]&&e.createElement(du,null,$[t.name])),e.createElement(pu,null,L[t.name]?.map(o=>{const r=$[t.name]===o,i=rr(n,o);return"color"===n?.type&&i?.value?e.createElement(mu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(gu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(cu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(au,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(N&&a){S(!0);try{await a(N,z,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}S(!1)}}:async()=>{if(!N)return;const e=!!h?.lineItemKey,t=String(N)!==String(h?.variantId);if(!e||t){S(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(N,h.allowedVariantIds):e&&m?await m(N,h.allowedVariantIds):a&&N&&await a(N,z,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}S(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!N||T},T?e.createElement(ue,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(Up,{ref:b},e.createElement(Gp,{style:{backgroundColor:p||"white"}},e.createElement(Xp,null,e.createElement(me,{color:c||"#868E96"}))))});xu.displayName="DesktopVariantPopup";const fu=l(({removeCartItem:i,addCartItem:a,getProductDetailsByVariantId:l,themeColor:c,cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundColor:p,removeFreebieFromCart:u,freebieClaimAddToCart:m,stealDealAddToCart:g,productClaimCtaButtonText:x,backgroundSubdued:f,primaryTextColor:y},b)=>{const[h,v]=ie(en),w=ae(Ut),[C,E]=t(null),[k,T]=t(!1),[S,$]=t({}),[B,N]=t(h?.variantId),[I,z]=t(h?.quantity||1),F=r(null),D=ir(),[P,A]=t(!1);n(()=>{h?.open?setTimeout(()=>{A(!0)},10):A(!1)},[h?.open]);n(()=>{(async()=>{if(!C&&l&&h?.variantId&&h?.handle)try{const e=await l(h.handle,h.variantId);if(!e)return;if(!e.variants||!Array.isArray(e.variants))return;if(e&&e.variants&&e.options){let t;const n=h.allowedVariantIds,o=Array.isArray(n)&&n.length>0;if(t=o?e.variants.find(e=>e.available&&n.includes(String(e.id))&&String(e.id)===String(h.variantId))||e.variants.find(e=>e.available&&n.includes(String(e.id))):e.variants.find(e=>e.available&&String(e.id)===String(h.variantId)),t){N(String(t.id));const n={};e.options.forEach((e,o)=>{n[e.name]=t[`option${o+1}`]}),$(n)}else N(void 0),$({})}E(e)}catch(e){}})()},[C,l,h]),n(()=>{},[p,i,a,l]);const _=(e,t)=>{const n={...S,[e]:t};$(n);const o=C?.variants?.find(e=>C.options.every((t,o)=>e[`option${o+1}`]===n[t.name]));if(o){const e=h?.allowedVariantIds;if(Array.isArray(e)&&e.length>0&&!e.includes(String(o.id)))return;o.available&&N(String(o.id))}},R=C?.variants?.find(e=>String(e.id)===String(B)),O=on(w,w?.currency),L=o(()=>{const e={};if(!C)return e;const t=Array.isArray(h?.allowedVariantIds)&&h.allowedVariantIds.length>0;return C.options.forEach(n=>{e[n.name]=n.values.filter(e=>C.variants.filter(o=>{const r=C.options.indexOf(n);if(o[`option${r+1}`]!==e)return!1;return!!C.options.every((e,t)=>{if(e.name===n.name)return!0;const r=S[e.name];return!r||o[`option${t+1}`]===r})&&(!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(o.id)))&&!!o.available)}).some(e=>!!(!t||Array.isArray(h.allowedVariantIds)&&h.allowedVariantIds.includes(String(e.id)))&&e.available))}),e},[C,S,h]);return C?e.createElement(e.Fragment,null,e.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:2147483643,display:h?.open?"flex":"none",justifyContent:"center",alignItems:"center",opacity:P?1:0,transition:"opacity 0.3s ease"},onClick:()=>{A(!1),setTimeout(()=>{v({open:!1,variantId:void 0,handle:void 0,quantity:void 0})},300)}}),e.createElement(Up,{ref:b,className:"yt-variant-selection-popup"},e.createElement(Gp,{ref:F,style:{backgroundColor:p||"white",opacity:P?1:0,transform:P?"translateY(0)":"translateY(20px)"},$themeColor:c,onClick:e=>e.stopPropagation()},h?.freebieSelection&&e.createElement(Yp,null,h?.stealDealSelection?"Unlocked Steal Deal":"Unlocked Freebie"),e.createElement(Zp,null,e.createElement(Kp,null,e.createElement(Jp,null,e.createElement(eu,{src:R?.featured_image?.src??C?.featured_image,alt:R?.featured_image?.alt??C?.title})),e.createElement(tu,null,e.createElement(nu,{$themeColor:c,$primaryTextColor:y,href:`${C?.url}?variant=${R?.id}`},C?.title),e.createElement(uu,null,e.createElement(ou,null,e.createElement(ru,{$primaryTextColor:y},O,tn(R?.price,w?.currency??"INR")),null!=R?.compare_at_price&&null!=R?.price&&R.compare_at_price>R.price&&e.createElement(iu,null,O,tn(R?.compare_at_price,w?.currency??"INR"))),!h?.freebieSelection&&e.createElement(Ko,{value:I,handleItemQuantityIncrement:async()=>{z(e=>e+1)},handleItemQuantityDecrement:async()=>{I>1&&z(e=>e-1)},cartComponentsCornerRadius:s,cartComponentsCornerType:d,backgroundSubdued:f})))),C?.options?.map(t=>{const n=D?.options?.find(e=>e.name.trim().toLowerCase()===t.name.trim().toLowerCase());return e.createElement(lu,{key:t.name},e.createElement(su,null,e.createElement("span",null,"Select ",t.name,":"),S[t.name]&&e.createElement(du,null,S[t.name])),e.createElement(pu,null,L[t.name]?.map(o=>{const r=S[t.name]===o,i=rr(n,o);return"color"===n?.type&&i?.value?e.createElement(mu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$colorValue:i.value}):"image"===n?.type&&i?.value?e.createElement(gu,{key:o,$isSelected:r,$themeColor:c,onClick:()=>_(t.name,o),$imageUrl:i.value}):e.createElement(cu,{$themeColor:c,key:o,$isSelected:r,backgroundColor:r?c:void 0,onClick:()=>_(t.name,o)},o)})))})),e.createElement(au,{className:"yt-cart-variant-popup-ATC-button",$themeColor:c??"#C33",onClick:h?.productRec?async()=>{if(B&&a){T(!0);try{await a(B,I,"product-recommendation-variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,productRec:!1})}catch(e){console.error("Error adding item from product recommendation:",e)}T(!1)}}:async()=>{if(!B)return;const e=!!h?.lineItemKey,t=String(B)!==String(h?.variantId);if(!e||t){T(!0);try{const e=h?.freebieSelection;e&&!h?.lineItemKey||(e&&u&&h?.lineItemKey?await u(h.lineItemKey):await i(h?.lineItemKey||h?.variantId,"variant-selector",!0)),e&&h?.stealDealSelection&&g?await g(B,h.allowedVariantIds):e&&m?await m(B,h.allowedVariantIds):a&&B&&await a(B,I,"variant-selector",!1,h.handle),v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})}catch(e){}T(!1)}else v({open:!1,variantId:void 0,quantity:void 0,handle:void 0,lineItemKey:void 0})},disabled:!B||k},k?e.createElement(ue,{color:"white",size:13}):h?.productRec?"ADD TO BAG":h?.stealDealSelection?"CLAIM DEAL":h?.freebieSelection?x||"CLAIM FREEBIE":"GET IN BAG")))):e.createElement(Up,{ref:b},e.createElement(Gp,{style:{backgroundColor:p||"white"}},e.createElement(Xp,null,e.createElement(me,{color:c||"#868E96"}))))});const yu=({setIsCartOpen:t,isCartOpen:n,cartCheckpoints:o,customCartProgressBarCriteria:r,floatingCartData:i,effectiveQuantityForProgressBar:a,cartComponentsCornerType:l,cartComponentsCornerRadius:c})=>{const s=ae(Ut),d=i?.bannerFooterText,p="string"==typeof d&&d.trim().length>0,u=!n&&(e=>{try{if("undefined"==typeof window)return!1;const t=window.location.pathname||"/";if("/"===t||""===t)return!0;const n=e?.showOnPages;if(!Array.isArray(n)||0===n.length)return!1;const o=t.toLowerCase(),r=o.endsWith("/")?o:`${o}/`;return n.some(e=>{if(!e||"string"!=typeof e)return!1;const t=e.trim().toLowerCase().replace(/^\/|\/$/g,"");if(!t)return!1;const n=`/${t}/`;return r.includes(n)})}catch{return!1}})(i),m=s?.item_count??0,g=tn(s?.items_subtotal_price??0,s?.currency??"INR"),x=on(s),f=function(e,t,n,o,r){if(!e||0===e.length)return{deltaValue:0,show:!1};const i=(t??"minimum_order_value").toLowerCase(),a="quantity_threshold"===i?"number"==typeof r?r:o:n,l=[...e].sort((e,t)=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)-("quantity_threshold"===i?t.quantityThreshold:t.minimumOrderValue)).find(e=>("quantity_threshold"===i?e.quantityThreshold:e.minimumOrderValue)>a);if(!l)return{deltaValue:0,show:!1};const c="quantity_threshold"===i?l.quantityThreshold:l.minimumOrderValue,s=Math.max(0,c-a);return{deltaValue:s,show:s>0,isQuantity:"quantity_threshold"===i}}(o,r,g,m,a),y="sharp"===l?0:c??12,h=i?.textColor??"#111",v=i?.backgroundColor??"#FF7E6E",w=i?.bannerBackgroundColor??"#FFE0DC",C=i?.buttonColor??"#E8513F",E=e.useRef(null);e.useEffect(()=>{pn(E.current)},[C]);const k={position:"fixed",width:"100%",bottom:0,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"},T={background:"#FFFFFF",color:"#111",padding:"5px",fontSize:12,fontFamily:"Poppins",fontWeight:600,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",gap:8},S={background:"#fff",color:h,borderRadius:y,boxShadow:"0 10px 24px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:"Poppins"},$={position:"absolute",top:0,left:"50%",transform:"translate(-50%, -70%)",backgroundColor:w,color:h,padding:8,fontSize:12,lineHeight:"normal",borderTopLeftRadius:13,borderTopRightRadius:13,width:"97%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,zIndex:-1},B={display:"flex",alignItems:"center",gap:12,padding:"10px 12px",backgroundColor:v,cursor:"pointer"},N={display:"flex",alignItems:"center",gap:8,fontWeight:700,fontSize:16,color:h},I={fontSize:12,color:h,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},z={padding:"5px 10px",background:C,color:"#fff",borderRadius:8,fontSize:15,fontWeight:700,border:"none",outline:"none",flexShrink:0};if(!u)return null;if(0===m){if(!f.show)return null;const t=f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${un(f.deltaValue.toFixed(0))} to get freebie`;return e.createElement("div",{style:k},e.createElement("div",{className:"yt-cart-floating-ribbon",style:T},e.createElement(b,{"aria-hidden":!0}),e.createElement("span",null,t)))}const F=1===m?"1 item":`${m} items`,D=i?.lastTierUnlockedText||"Best tier unlocked",P=f.show?f.isQuantity?`${f.deltaValue} more items to get freebie`:`Add items worth ${x}${un(f.deltaValue.toFixed(0))} more to get freebie`:D;return e.createElement("div",{style:{position:"fixed",left:12,right:12,bottom:12,zIndex:2147483642,paddingBottom:"env(safe-area-inset-bottom)"}},e.createElement("div",{style:{position:"relative"}},(f.show||o&&o.length>0)&&e.createElement("div",{className:"yt-cart-floating-banner",style:$},e.createElement(b,{"aria-hidden":!0,style:{marginBottom:7}}),e.createElement("span",{style:{display:"inline-block",marginBottom:7}},P)),e.createElement("div",{style:S},e.createElement("div",{className:"yt-cart-floating-body",style:B,onClick:()=>t(!0)},e.createElement(_,{width:24,height:24,color:h}),e.createElement("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,lineHeight:"normal"}},e.createElement("div",{style:N},e.createElement("span",null,x,un(g.toFixed(0))),e.createElement("span",{style:{fontSize:9,fontWeight:600,color:"#fff",backgroundColor:"#828282",marginBottom:5,paddingInline:5}},F)),p?e.createElement("span",{style:I,title:d},d):null),e.createElement("button",{ref:E,style:z,onClick:()=>t(!0),"aria-label":"View Cart"},"View Cart")))))},bu=({exploreCTAColor:o,checkoutFontSize:i,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,cartTitle:p,emptyCartTitle:u,emptyCartDescription:m,emptyCartButtons:g,backgroundColor:x,backgroundSubdued:f,tertiaryColor:y,tertiaryTextColor:b,backdrop:h=!0,cartData:v,isUserSignedIn:w,showBundle:C,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:B,removeDiscount:N,applyDiscount:I,discountApplied:z,checkoutFunction:F,joinNowFunction:D,guestLoyaltyPercentage:P,showToggleButton:A,isOpen:_,setIsOpen:R,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K,checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ae,showProductRecsOnDesktop:ce,showProductRecsOnMobile:se,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,showNoteOption:Ee,applyNoteToCart:ke,note:Te,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Be,showEditOptionOnProducts:Ne,getProductDetailsByVariantId:Ie,onSetLoading:ze,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:De,currentTier:Pe,freebieProductsInCart:Ae,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,showStickyAddToCart:Ge,stickyCartLineItem:Xe,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,enableCustomCartOnCartPage:rt,isCartPage:it,progressBarFreeProductIconType:at,addToStickyCart:lt,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,showFloatingCart:ut,floatingCartData:mt,freebieMilestoneData:gt,cartTimerInMinutes:xt,cartTimerCustomText:ft,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,stickyCartCustomizationData:vt,cartOffersCarousalData:wt,stickyBarBuyNowFunction:Ct,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Bt,loyaltyDiscount:Nt,brandTokenName:It,showDiscountOnMRP:zt,prefixMessageText:Ft,suffixMessageText:Dt,successMessageText:Pt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht=!0,showCouponOptions:qt,rewardCoupons:Qt,comboBundleData:Yt,comboBundleAddToCartFunction:Gt,stealDealCheckpoints:Xt,stealDealProducts:Zt,stealDealAddToCart:Kt,useCartShell:Jt,showTrustedBadge:tn,trustedBadgeData:nn})=>{const on=le(Ut),[rn,an]=ie(en),[ln,cn]=ie(Vi),sn=()=>R(!_),[dn,pn]=t(()=>{const e=window.ytComboBundle;return{comboBundleData:e?.bundle??null,comboBundleAddToCartFunction:e?.addToCart??null}});n(()=>{const e=e=>{const t=e.detail;pn({comboBundleData:t?.bundle??null,comboBundleAddToCartFunction:t?.addToCart??null})};return window.addEventListener("yt-combo-bundle-updated",e),()=>window.removeEventListener("yt-combo-bundle-updated",e)},[]);const un=dn.comboBundleData??Yt,mn=dn.comboBundleAddToCartFunction??Gt,[gn,xn]=t(()=>{const e=window.ytVolumeBundle;return{bundle:e?.bundle??void 0,currentTier:e?.currentTier??void 0,volumeBundleAddToCartFunction:e?.addToCart??void 0}});n(()=>{const e=e=>{const t=e.detail;xn({bundle:t?.bundle??void 0,currentTier:t?.tierData??void 0,volumeBundleAddToCartFunction:t?.addToCart??void 0})};return window.addEventListener("yt-volume-bundle-updated",e),()=>window.removeEventListener("yt-volume-bundle-updated",e)},[]);const fn=r(null),yn=r(0);a(()=>{if(v){const e=v?.token??null,t="number"==typeof v?.cartUpdatedAtMs?v.cartUpdatedAtMs:void 0;e!==fn.current&&(fn.current=e,yn.current=t??0);const n=yn.current;if(!(void 0===t||t>=n))return;void 0!==t&&(yn.current=t),on(v)}},[v]);const bn=r(null);n(()=>{function e(e){bn.current&&!bn.current.contains(e.target)&&(an({open:!1,variantId:void 0,quantity:void 0,handle:void 0}),cn({isOpen:!1}))}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const[hn,vn]=t(!1);return n(()=>{const e=()=>{vn(window.innerWidth>=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{if(!Jt)return;const e=window.ytCartShell;if(!e)return;const t=e.getDrawerElement?.(),n=e.getOverlayElement?.();t&&(!_||rt&&it?(t.style.setProperty("transform","translateX(100%)","important"),t.style.boxShadow="none",n&&(n.style.display="none"),document.body.classList.remove("drawer-open")):(t.style.setProperty("transform","translateX(0)","important"),t.style.boxShadow="-14px 8px 14.4px 0px rgba(0, 0, 0, 0.35)",h&&n&&(n.style.display="block"),document.body.classList.add("drawer-open")))},[_,Jt,rt,it,h]),n(()=>{if(!Jt)return;const e=window.ytCartShell,t=e?.getOverlayElement?.();if(!t)return;const n=()=>R(!1);return t.addEventListener("click",n),()=>t.removeEventListener("click",n)},[Jt,R]),e.createElement(e.Fragment,null,e.createElement("div",{style:{position:rt&&it?"relative":"absolute",width:"100%",display:rt&&it?"flex":"block",alignItems:"center",justifyContent:"center"}},A&&!(rt&&it)&&e.createElement("button",{style:{margin:"16px"},onClick:sn},_?"Close Drawer":"Open Drawer"),!Jt&&_&&h&&!(rt&&it)&&e.createElement("div",{onClick:sn,id:"custom-cart-yt-overlay",style:{position:"fixed",top:0,right:0,zIndex:1e4,transform:"translateX(0)",backgroundColor:"rgba(0,0,0,0.5)",inset:0,height:"100%",width:"100%"}},"‎"),e.createElement(Il,{useCartShell:Jt,isCartPage:it,enableCustomCartOnCartPage:rt,isOpen:_,setIsOpen:R,backgroundColor:x,backgroundSubdued:f??"#F5F5F5",tertiaryColor:y,tertiaryTextColor:b,exploreCTAColor:o,checkoutFontSize:i,cartTitle:p,handleDecrement:l,handleIncrement:c,removeCartItem:s,addCartItem:d,emptyCartTitle:u,emptyCartButtons:g,emptyCartDescription:m,showBundle:C,isUserSignedIn:w,bundleProducts:E,discountAmountOff:k,loyaltyIcon:T,pointsToBeUsed:S,rewardMultiplier:$,redemptionMultiplier:B,removeDiscount:N,applyDiscount:I,discountApplied:z,checkoutFunction:F,joinNowFunction:D,guestLoyaltyPercentage:P,isDev:O,switchWidthVariant:L,recProductsList:M,showMultiStepProgressBar:V,cartCheckpoints:j,redemptionRate:W,pointsRewardRate:H,showCartLevelAltPay:q,exploreCtaRedirectLink:Q,discountAmountApplied:U,minimumCartValue:Y,discountInCheckoutButton:G,isStickyCheckout:X,handleCheckpointCrossed:Z,customCartProgressBarCriteria:K??"minimum_order_value",checkoutButtonColor:J,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,primaryTextColor:ne,productRecsCtaButtonText:oe,productRecsTitleText:re,secondaryTextColor:ae,showProductRecsOnDesktop:ce,showProductRecsOnMobile:se,themeColor:de,themeTextColor:pe,companyName:ue,gstNumber:me,showGSTOption:ge,applyGSTToCart:xe,showMOVForProgressTiers:fe,freeProduct:ye,showLoyaltyCta:be,freeProductAdjustedCartTotal:he,minimumOrderValueToAvailDiscount:ve,signinCTAButtonVisible:we,cartSigninCTAMainText:Ce,applyNoteToCart:ke,note:Te,showNoteOption:Ee,inlineCartOfferInfoText:Se,inlineCartOfferInfoRedirectLink:$e,cartOfferTermsAndConditionsText:Be,showEditOptionOnProducts:Ne,onSetLoading:ze,showVariantSelectionDropdownInProductRecs:Fe,originalCartSubtotal:De,currentTier:Pe,freebieProductsInCart:Ae,cartOffersCarousalData:wt,showFreebieClaim:_e,addFreebieToCart:Re,freebiesInCart:Oe,effectiveQuantityForProgressBar:Le,productPercentageOffMapping:Me,removeFreebieFromCart:Ve,postalCodeList:je,enableGeoLocationDeliveryRestriction:We,applyPostalCodeAndDeliverySlotToCart:He,showDeleteOnFreebies:qe,freebieCouponTemplates:Qe,freebieFlowCheckpoints:Ue,freebieClaimData:Ye,postalCodeBasedItemTrackingParameter:Ze,enableSlotPicker:Ke,deliveryHeaderTitle:Je,deliveryAvailableText:et,deliveryNotAvailableText:tt,giftWrapSetupData:nt,giftWrapProductDetail:ot,progressBarFreeProductIconType:at,productRecsCardLayout:ct,productRecsCardListVariant:st,showCartTimer:dt,showFreebieMilestone:pt,freebieMilestoneData:gt,cartTimerCustomText:ft,cartTimerInMinutes:xt,imageAspectSelector:yt,cartComponentsCornerType:bt,cartComponentsCornerRadius:ht,gstSectionCustomizationData:Et,noteSectionTitle:kt,checkoutSectionMessage:Tt,checkoutSectionMessageRedirectLink:St,checkoutSectionMessageDisplay:$t,showVariantSelectionDropdownInProductClaim:Bt,loyaltyDiscount:Nt,getProductDetailsByVariantId:Ie,brandTokenName:It,showDiscountOnMRP:zt??!0,prefixMessageText:Ft,suffixMessageText:Dt,successMessageText:Pt,toggleDecimal:At,cartOffersCarouselHeight:_t,disableCheckoutButton:Rt,showEmptyCartRecommendations:Ot,emptyProductRecsTitleText:Lt,checkoutButtonBottomSpacing:Mt,applyCouponCode:Vt,showApplyCoupon:jt,enableConfetti:Wt,showCheckoutButtonPaymentIcons:Ht,stealDealCheckpoints:Xt,stealDealProducts:Zt,stealDealAddToCart:Kt,showCouponOptions:qt,rewardCoupons:Qt,showTrustedBadge:tn,trustedBadgeData:nn}),Ge&&Xe&&d&&e.createElement(Qp,{showStickyCart:Ge,stickyCartCustomizationData:vt,product:Xe,addCartItem:d,onSetLoading:ze,themeColor:de,themeTextColor:pe,cartData:v,isCartOpen:_,setIsCartOpen:R,ctaButtonBackgroundColor:ee,ctaButtonTextColor:te,addToStickyCart:lt,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,checkoutFunction:Ct,backgroundColor:x,primaryTextColor:ne,comboBundleData:un,comboBundleAddToCartFunction:mn,volumeBundleCurrentTier:gn.currentTier,volumeBundleData:gn.bundle,volumeBundleAddToCartFunction:gn.volumeBundleAddToCartFunction}),hn&&rn.open&&e.createElement(xu,{backgroundColor:x,ref:bn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:Ie,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Kt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne}),!hn&&rn.open&&e.createElement(fu,{ref:bn,isDev:O,removeCartItem:s,addCartItem:d,getProductDetailsByVariantId:Ie,themeColor:de,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt,backgroundColor:x,removeFreebieFromCart:Ve,freebieClaimAddToCart:Re,stealDealAddToCart:Kt,productClaimCtaButtonText:Ye?.productClaimCtaButtonText,backgroundSubdued:f??"#F5F5F5",primaryTextColor:ne})),!hn&&ut&&e.createElement(yu,{isCartOpen:_,setIsCartOpen:R,cartCheckpoints:j,customCartProgressBarCriteria:K,floatingCartData:mt,effectiveQuantityForProgressBar:Le,cartComponentsCornerRadius:ht,cartComponentsCornerType:bt}))};gt(".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 hu=()=>e.createElement("div",{className:"scene"},e.createElement("div",{className:"floating"},e.createElement("div",{className:"cube"},e.createElement("div",{className:"side front"},"‎"),e.createElement("div",{className:"side back"},"‎"),e.createElement("div",{className:"side left"},"‎"),e.createElement("div",{className:"side right"},"‎"),e.createElement("div",{className:"side bottom"},"‎"),e.createElement("div",{className:"lid"},e.createElement("div",{className:"flap north"},"‎"),e.createElement("div",{className:"flap south"},"‎"),e.createElement("div",{className:"flap east"},"‎"),e.createElement("div",{className:"flap west"},"‎"))))),vu=({config:t,brandConfig:n})=>{const{heroDesktopImage:o,heroMobileImage:r,heroTitle:i="ZERO WASTE PREMIUM PET CARE",heroSubtitle:a="Earn Doglycoins for exclusive rewards every time you shop.",heroTextAlignment:l="left",heroSubtitleFontSize:c="18px",heroSubtitleColor:s="#000000",heroSubtitleFontWeight:d="400",heroTitleFontSize:p="48px",heroTitleColor:u="#000000",heroRegistrationCTAVisibility:m=!0,primaryColor:g="#1C1C1D",primaryContrastColor:x="#FFFFFF",secondaryColor:f="#FFFFFF",secondaryContrastColor:y="#000000",accentColor:b="#FFFFFF",borderColor:N="#E5E5E5",themeRoundness:I="0px",heroBannerVisibility:z="show",stepsVisibility:F="show",waysToEarnVisibility:D="show",waysToEarnCustomText:P="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",customSectionVisibility:A="show",footerSignupVisibility:_="show",customSectionImagePosition:R="left",customSectionTitle:O="Earn Doglycoins every time you shop",customSectionSubtitle:L="Collect more Doglycoins by entering your birthday, following us on social or referring a friend (details below)\n\nRedeem your Doglycoins for cash off at checkout by signing in or creating an account. Did you shop without registering? No worries, your Credits have been saved for you",customSectionTitleFontSize:M="36px",customSectionSubtitleFontSize:V="18px",customSectionImage:j,customSectionTextAlignment:W="left",customSectionTitleColor:H="#000000",customSectionSubtitleColor:q="#000000",stepsTitle:Q="Getting started is easy",stepsSubtitle:U="Earn Stars and get rewarded in a few easy steps.",step1Title:Y="CREATE AN ACCOUNT",step1Description:G="To get started, Join Now. You can also register on the mobile app to get access to the full range of reward benefits",step2Title:X="ORDER AND EARN REWARDS POINTS",step2Description:Z="Use cash, credit/debit card or save some time and pay right through the app. You'll collect Stars all ways.",step3Title:K="UNLOCK REWARDS AND OFFERS",step3Description:J="As you earn Stars, you can redeem them for Rewards—like free food, drinks, and more. Start redeeming with as little as 25 Stars!",footerCustomText:ee="Individual rewards of 750 points or more ship FREE. No merchandise purchase required.",footerSignupSubtext:te="Use your points to redeem samples and more."}=t||{},ne="undefined"!=typeof window&&window.innerWidth<=768,oe=e=>e&&e.startsWith("//")?`https:${e}`:e,re={padding:"12px 32px",borderRadius:"30px",fontSize:"14px",fontWeight:600,cursor:"pointer",textTransform:"uppercase",border:`1px solid ${g}`,transition:"all 0.3s ease"},ie={...re,backgroundColor:g,color:x,borderColor:g},ae={...re,backgroundColor:f,color:y,borderColor:N},{newSignupTokens:le,firstOrderTokens:ce,instagramFollowPoints:se,twitterFollowPoints:de,facebookFollowPoints:pe,youtubeSubscriptionPoints:ue,rewardToLeaveReview:me,birthdayPoints:ge,referralPointsForReferrer:xe,tokenCreditPercentage:fe,brandTokenName:ye}=n||{},be=[...le?[{icon:e.createElement(h,null),title:`${le} ${ye}`,subtitle:"Create an account"}]:[],...ce?[{icon:e.createElement(v,null),title:`${ce} ${ye}`,subtitle:"Place your first order"}]:[],...fe?[{icon:e.createElement(v,null),title:`${fe}% ${ye}`,subtitle:`Earn ${fe}% back on every order`}]:[],...xe?[{icon:e.createElement(w,null),title:`${xe} ${ye}`,subtitle:"Refer a friend and get"}]:[],...ge?[{icon:e.createElement(C,null),title:`${ge} ${ye}`,subtitle:"Get on your birthday to spend"}]:[],...me?[{icon:e.createElement(E,null),title:`${me} ${ye}`,subtitle:"Write a Review"}]:[],...pe?[{icon:e.createElement(k,null),title:`${pe} ${ye}`,subtitle:"Like on Facebook"}]:[],...se?[{icon:e.createElement(T,null),title:`${se} ${ye}`,subtitle:"Follow on Instagram"}]:[],...de?[{icon:e.createElement(S,null),title:`${de} ${ye}`,subtitle:"Follow on Twitter"}]:[],...ue?[{icon:e.createElement($,null),title:`${ue} ${ye}`,subtitle:"Subscribe on YouTube"}]:[]];return e.createElement("div",{className:"yt-loyalty-page-container",style:{fontFamily:"'Poppins', sans-serif",width:"100%",overflow:"hidden"}},"show"===z&&e.createElement("div",{className:"yt-loyalty-page-hero",style:{position:"relative",minHeight:"500px",display:"flex",alignItems:"center",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start",backgroundImage:`url(${oe(ne&&r?r:o)})`,backgroundSize:"cover",backgroundPosition:"center",padding:ne?"40px 20px":"60px 80px"}},e.createElement("div",{className:"yt-loyalty-page-hero-content",style:{maxWidth:"600px",zIndex:2,textAlign:l}},e.createElement("h1",{className:"yt-loyalty-page-hero-title",style:{fontSize:ne?"32px":p,color:u,marginBottom:"16px",lineHeight:1.1,fontWeight:800,textTransform:"uppercase"}},i),e.createElement("p",{className:"yt-loyalty-page-hero-subtitle",style:{fontSize:c,color:s,fontWeight:Number(d)||400,marginBottom:"32px"}},a),m&&e.createElement("div",{className:"yt-loyalty-page-hero-button-wrapper",style:{display:"flex",gap:"16px",justifyContent:"center"===l?"center":"right"===l?"flex-end":"flex-start"}},e.createElement("button",{className:"yt-loyalty-page-hero-button",style:ie,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"Join Now")))),"show"===F&&e.createElement("div",{className:"yt-loyalty-page-steps",style:{padding:"40px 20px",position:"relative",textAlign:"center"}},e.createElement("div",{className:"yt-loyalty-page-steps-background-text",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"GETTING STARTED"),e.createElement("div",{className:"yt-loyalty-page-steps-content",style:{position:"relative",zIndex:1}},e.createElement("h2",{className:"yt-loyalty-page-steps-title",style:{fontSize:"32px",fontWeight:700,marginBottom:"8px",color:"#000"}},Q),e.createElement("p",{className:"yt-loyalty-page-steps-subtitle",style:{color:g,marginBottom:"24px"}},U),e.createElement("div",{className:"yt-loyalty-page-steps-grid",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"center",gap:"40px",maxWidth:"1200px",margin:"0 auto"}},[{icon:e.createElement(v,null),title:Y,desc:G},{icon:e.createElement(B,null),title:X,desc:Z},{icon:e.createElement(C,null),title:K,desc:J}].map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-step-item",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{className:"yt-loyalty-page-step-icon",style:{width:"80px",height:"80px",borderRadius:"50%",border:"4px solid #ccc",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"32px",color:"#666",marginBottom:"12px"}},t.icon),e.createElement("div",{className:"yt-loyalty-page-step-title",style:{fontSize:"16px",fontWeight:700,color:g,textTransform:"uppercase",lineHeight:"normal"}},t.title),e.createElement("p",{className:"yt-loyalty-page-step-description",style:{fontSize:"13px",color:g,lineHeight:1.2,maxWidth:"300px"}},t.desc)))))),"show"===D&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn",style:{padding:"40px 20px",position:"relative",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-background-text",style:{position:"absolute",top:ne?"10%":"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"12vw",fontWeight:900,color:"#F5F5F5",zIndex:0,whiteSpace:"nowrap",pointerEvents:"none",opacity:.5}},"WAYS TO EARN"),e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-grid",style:{position:"relative",zIndex:1,maxWidth:"1000px",margin:"0 auto",display:"flex",flexWrap:"wrap",justifyContent:"center",gap:"12px"}},be.map((t,n)=>e.createElement("div",{key:n,className:"yt-loyalty-page-ways-to-earn-item",style:{width:ne?"100%":"220px",border:"2px solid #ddd",padding:"12px 8px",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",borderRadius:I,boxShadow:"-1px 2px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-icon",style:{fontSize:"32px",marginBottom:"4px",color:"#1a1a2e"}},t.icon),e.createElement("h3",{className:"yt-loyalty-page-ways-to-earn-title",style:{fontSize:"13px",fontWeight:700,marginBottom:"2px",textTransform:"uppercase",color:"#000"}},t.title),e.createElement("p",{className:"yt-loyalty-page-ways-to-earn-subtitle",style:{fontSize:"11px",color:"#666"}},t.subtitle)))),P&&e.createElement("div",{className:"yt-loyalty-page-ways-to-earn-custom-text",style:{maxWidth:"1000px",margin:"24px auto 0",backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},P)),"show"===A&&e.createElement("div",{className:"yt-loyalty-page-custom-section",style:{padding:ne?"40px 0px":"40px 20px",borderTop:"1px solid #eee"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-container",style:{maxWidth:"1200px",margin:"0 auto",display:"flex",flexDirection:ne?"column":"row",alignItems:"center",gap:"40px",borderRadius:I,overflow:"hidden",backgroundColor:"#F9F9F9"}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image-wrapper",style:{flex:1,width:"100%",order:ne||"left"===R?0:1}},e.createElement("div",{className:"yt-loyalty-page-custom-section-image",style:{display:"flex",width:"100%",height:"300px",backgroundColor:"#ddd",backgroundImage:j?`url(${oe(j)})`:o?`url(${oe(o)})`:void 0,backgroundSize:"cover",backgroundPosition:"center"}})),e.createElement("div",{className:"yt-loyalty-page-custom-section-content",style:{flex:1,paddingInline:ne?"20px":"10px",textAlign:ne?"center":W,order:ne||"left"===R?1:0,marginBottom:ne?"20px":"0px"}},e.createElement("h2",{className:"yt-loyalty-page-custom-section-title",style:{fontSize:M,fontWeight:700,marginBottom:"16px",color:H}},O),e.createElement("p",{className:"yt-loyalty-page-custom-section-subtitle",style:{fontSize:V,color:q,marginBottom:"24px",lineHeight:1.6,whiteSpace:"pre-line"}},L)))),"show"===_&&e.createElement("div",{className:"yt-loyalty-page-footer",style:{marginBottom:"20px"}},e.createElement("div",{className:"yt-loyalty-page-footer-container",style:{maxWidth:"1200px",margin:"0 auto"}},e.createElement("div",{className:"yt-loyalty-page-footer-custom-text",style:{backgroundColor:b,color:"#fff",padding:"16px",textAlign:"center",fontSize:"12px",fontStyle:"italic",borderRadius:"4px"}},ee),e.createElement("div",{className:"yt-loyalty-page-footer-signup",style:{display:"flex",flexDirection:ne?"column":"row",justifyContent:"space-between",alignItems:"center",marginTop:"40px",padding:"20px",border:"1px solid #eee",borderRadius:"4px",gap:"20px",textAlign:ne?"center":"left"}},e.createElement("div",{className:"yt-loyalty-page-footer-signup-content"},e.createElement("h3",{style:{fontSize:"20px",fontWeight:700,marginBottom:"4px",color:"#000",textAlign:ne?"center":"left"}},"Rewards Program"),e.createElement("p",{style:{fontSize:"14px",color:"#666"}},te)),e.createElement("button",{className:"yt-loyalty-page-footer-signup-button",style:ae,onClick:()=>{"undefined"!=typeof window&&window.ytapp&&(window.ytapp.loyaltyWidgetOpen=!0,window.dispatchEvent(new Event("loyaltyWidgetOpenChanged")))}},"JOIN NOW")))))},wu=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2147483647},onClick:i},e.createElement("div",{style:{width:"90vw",minWidth:"375px",maxWidth:"480px",maxHeight:"90vh",backgroundColor:"#fff",borderRadius:"12px",padding:"16px",boxShadow:"0 4px 15px rgba(0,0,0,0.3)",position:"relative",flexDirection:"column",display:"flex"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{fontSize:"clamp(32px, 8vw, 40px)",color:"#4C4C4C",marginTop:"16px",marginBottom:"8px",display:"flex",justifyContent:"center",position:"relative"}},"free_product"===o.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",fontWeight:500,color:"#4C4C4C",lineHeight:"normal",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"clamp(28px, 7vw, 40px)",fontWeight:"600",color:a?.textColor||"#EE8E35",lineHeight:"normal",textAlign:"center"}},o.name),e.createElement("div",{style:{fontSize:"clamp(16px, 4vw, 20px)",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"16px",padding:"12px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"clamp(16px, 4vw, 18px)",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"20px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(N,null):e.createElement(I,null))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("hr",{style:{border:"none",height:"2px",width:"100%",margin:"10px 0 18px 0",backgroundColor:"transparent",backgroundImage:"repeating-linear-gradient(to right, #ccc 0, #ccc 12px, transparent 12px, transparent 20px)",backgroundSize:"100% 2px",backgroundPosition:"0 0",backgroundRepeat:"repeat-x"}}),e.createElement("div",{style:{marginTop:"15px",fontSize:"clamp(14px, 3.5vw, 16px)",textAlign:"center",display:"flex",flexDirection:"column"}},e.createElement("strong",{style:{color:"#888"}},"Terms & Conditions"),e.createElement("ul",{style:{marginTop:"5px",paddingLeft:"20px",textAlign:"left",display:"inline-block",color:"#000",lineHeight:"1.3",marginBottom:"0"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"10px 20px",marginTop:"10px",backgroundColor:"#fff",border:"none",borderTop:"1px solid #ddd",borderRadius:"0",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",flexShrink:0}},"Close")));return A(p,document.body)},Cu=({showPopup:n,selectedOffer:o,selectedOfferTerms:r,onClose:i,offersConfig:a})=>{const[l,c]=t(!1);if(!n||!o||!r)return null;const s=o._customOffer,d=s?.code||o.code,p=e.createElement("div",{className:"yt-product-offers-isolated",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"flex-end",justifyContent:"center",zIndex:2147483647,animation:"fadeIn 0.3s ease"},onClick:i},e.createElement("style",null,"\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes slideUp {\n from { transform: translateY(100%); }\n to { transform: translateY(0); }\n }\n "),e.createElement("div",{style:{width:"100%",maxHeight:"85vh",backgroundColor:"#fff",borderTopLeftRadius:"20px",borderTopRightRadius:"20px",borderTop:"1px solid #E5E5E5",position:"relative",flexDirection:"column",display:"flex",animation:"slideUp 0.3s ease",overflow:"hidden"},onClick:e=>e.stopPropagation()},e.createElement("div",{style:{width:"40px",height:"4px",backgroundColor:"#ddd",borderRadius:"2px",margin:"12px auto 16px",flexShrink:0}}),e.createElement("div",{style:{overflowY:"auto",flex:1}},e.createElement("div",{style:{padding:"0 20px 20px",backgroundColor:"#fff"}},e.createElement("div",{style:{fontSize:"48px",color:"#4C4C4C",display:"flex",justifyContent:"center",margin:"16px"}},"free_product"===o.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{fontSize:"14px",fontWeight:500,color:"#888",textAlign:"center"}},o.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")),e.createElement("div",{style:{fontSize:"32px",fontWeight:"700",color:a?.textColor||"#EE8E35",textAlign:"center",lineHeight:"1.2"}},o.name),e.createElement("div",{style:{fontSize:"18px",color:"#000000",textAlign:"center",fontWeight:500}},r.offerMessage),d&&e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"20px",padding:"14px 20px",backgroundColor:a?.cardBackgroundColor||"#F5F5F5",borderRadius:`${a?.roundness||8}px`,border:`1px dashed ${a?.accentColor||"#EE8E35"}`}},e.createElement("span",{style:{fontSize:"18px",fontWeight:"600",color:a?.textColor||"#333",letterSpacing:"1px"}},d),e.createElement("button",{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:l?"#22c55e":a?.accentColor||"#EE8E35",fontSize:"22px",transition:"color 0.2s ease"},title:l?"Copied!":"Copy code"},l?e.createElement(N,null):e.createElement(I,null)))),r.terms.length>0&&e.createElement(e.Fragment,null,e.createElement("div",{style:{backgroundColor:"#F5F5F5",padding:"16px 20px"}},e.createElement("div",{style:{fontSize:"16px",fontWeight:"600",color:"#333",textAlign:"center"}},"Terms & Conditions")),e.createElement("div",{style:{padding:"20px",backgroundColor:"#fff"}},e.createElement("ul",{style:{margin:"0",paddingLeft:"20px",color:"#333",lineHeight:"1.6",fontSize:"14px"}},r.terms.map((t,n)=>e.createElement("li",{key:n,style:{marginBottom:"4px"}},t)))))),e.createElement("button",{onClick:i,style:{width:"100%",padding:"18px 20px",backgroundColor:"#F5F5F5",border:"none",borderTop:"1px solid #E5E5E5",fontSize:"16px",fontWeight:"600",color:"#333",cursor:"pointer",textAlign:"center",fontFamily:"'Poppins', sans-serif",flexShrink:0}},"Close")));return A(p,document.body)},Eu=({offersToShow:o,offersConfig:i,getOfferCardMessage:a,setSelectedOffer:l,setShowPopup:c})=>{const s=r(null),[d,p]=t(!1),[u,m]=t(!0),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=768),f=()=>{if(s.current){const{scrollLeft:e,scrollWidth:t,clientWidth:n}=s.current;p(e>0),m(e<t-n-10)}};n(()=>{f();const e=s.current;if(e)return e.addEventListener("scroll",f),()=>e.removeEventListener("scroll",f)},[o]),n(()=>{const e=()=>{x(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const y=e=>{if(s.current){const t=g?280:365,n=16,o="right"===e?t+n:-(t+n);s.current.scrollBy({left:o,behavior:"smooth"})}};return e.createElement("div",{style:{position:"relative"}},e.createElement("svg",{style:{position:"absolute",width:0,height:0}},e.createElement("defs",null,e.createElement("mask",{id:"coupon-cut-mask-desktop"},e.createElement("rect",{width:"365",height:"138",fill:"white"}),e.createElement("circle",{cx:"80",cy:"0",r:"12",fill:"black"}),e.createElement("circle",{cx:"80",cy:"138",r:"12",fill:"black"})),e.createElement("mask",{id:"coupon-cut-mask-mobile"},e.createElement("rect",{width:"280",height:"120",fill:"white"}),e.createElement("circle",{cx:"60",cy:"0",r:"10",fill:"black"}),e.createElement("circle",{cx:"60",cy:"120",r:"10",fill:"black"})))),d&&e.createElement("button",{onClick:()=>y("left"),style:{position:"absolute",left:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(z,{size:20})),u&&e.createElement("button",{onClick:()=>y("right"),style:{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"#fff",border:"1px solid #e0e0e0",borderRadius:"50%",width:"clamp(28px, 5vw, 38px)",height:"clamp(28px, 5vw, 38px)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",color:"#333"}},e.createElement(F,{size:20})),e.createElement("div",{ref:s,className:"hide-scrollbar",style:{display:"flex",alignItems:"stretch",overflowX:"auto",gap:"16px",scrollbarWidth:"none",msOverflowStyle:"none",minHeight:g?"110px":"128px"}},o?.map(t=>e.createElement("div",{key:t.discountId,style:{flexShrink:0,width:g?"280px":"365px",minWidth:g?"280px":"365px",minHeight:g?"110px":"128px",backgroundColor:"transparent",borderRadius:`${i?.roundness||0}px`,border:"1px solid #e0e0e0",display:"flex",position:"relative",overflow:"visible",mask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMask:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,maskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`,WebkitMaskImage:`url(#${g?"coupon-cut-mask-mobile":"coupon-cut-mask-desktop"})`}},e.createElement("div",{style:{width:g?"60px":"80px",minHeight:g?"110px":"128px",backgroundColor:i?.accentColor||"#EE8E35",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:g?"10px 6px":"12px 8px",position:"relative",borderTopLeftRadius:`${i?.roundness||0}px`,borderBottomLeftRadius:`${i?.roundness||0}px`}},e.createElement("div",{style:{position:"absolute",right:"-2px",top:"12px",bottom:"12px",width:"2px",borderLeft:"2px dashed #FFFFFF"}})),i?.iconVisibility&&e.createElement("div",{style:{position:"absolute",left:g?"42.5px":"57.5px",top:"35%",transform:"translateY(-50%)",width:g?"32px":"40px",height:g?"32px":"40px",backgroundColor:"#FFFFFF",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?"16px":"20px",color:"#333333",zIndex:10,boxShadow:"0 2px 5px rgba(0,0,0,0.1)",border:"1px solid #E0E0E0"}},"free_product"===t.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{flex:1,padding:g?"12px 12px":"15px 15px",paddingLeft:g?"25px":"35px",display:"flex",flexDirection:"column",justifyContent:"space-between",borderTopRightRadius:`${i?.roundness||0}px`,borderBottomRightRadius:`${i?.roundness||0}px`,overflow:"hidden",backgroundColor:i?.cardBackgroundColor||"#ffffff",minWidth:0}},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:g?"4px":"6px",lineHeight:"normal"}},e.createElement("div",{style:{fontSize:g?"9px":"10px",color:"#666666",fontWeight:"400"}},"free_product"===t.couponType?"Free Gift":t._customOffer?.code?"Coupon":"Special Deal"),e.createElement("div",{style:{fontSize:g?"13px":"15px",fontWeight:"600",color:i?.textColor||"#2c3e50"}},t.name),e.createElement("div",{style:{fontSize:g?"11px":"12px",color:i?.accentColor||"#EE8E35",wordWrap:"break-word",overflowWrap:"break-word",whiteSpace:"normal",minHeight:g?"28px":"32px"}},a(t))),e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},e.createElement("div",{style:{borderTop:"1px solid #999999",marginTop:"4px",width:"100%",height:"0",display:"block"}}),e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),l(t),c(!0)},style:{fontSize:g?"11px":"12px",color:"#2c3e50",fontWeight:"500",textDecoration:"none",cursor:"pointer",textAlign:"center",marginTop:"0"}},i?.viewDetailsTitle||"View Details")))))),e.createElement("style",null,"\n .hide-scrollbar::-webkit-scrollbar {\n display: none;\n }\n .hide-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n "))},ku=({offersToShow:o,offersConfig:r,getOfferCardMessage:i,setSelectedOffer:a,setShowPopup:l})=>{const[c,s]=t("undefined"!=typeof window&&window.innerWidth<=768);return n(()=>{const e=()=>{s(window.innerWidth<=768)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.createElement("div",{style:{borderRadius:`${r?.roundness||8}px`}},o?.map((t,n)=>e.createElement("div",{key:t.discountId,style:{display:"flex",alignItems:"flex-start",gap:c?"8px":"12px",padding:c?"12px 0":"16px 0",paddingLeft:c?"10px":"20px",backgroundColor:!0===r?.cardBackgroundTransparent||"true"===String(r?.cardBackgroundTransparent)?"transparent":r?.cardBackgroundColor||"#ffffff",borderBottom:n<(o?.length||0)-1?"1px solid rgb(225 218 218)":"none",marginBottom:"4px",borderRadius:`${r?.roundness||0}px`}},r?.iconVisibility&&e.createElement("div",{style:{width:c?"40px":"50px",height:c?"40px":"50px",backgroundColor:"#f8f9fa",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:c?"20px":"25px",marginTop:c?"5px":"10px",border:"2px solid #4a4a4a",color:"#4a4a4a"}},"free_product"===t.couponType?e.createElement(b,null):e.createElement(We,null)),e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{fontSize:c?"14px":"15px",fontWeight:600,color:"#000000",lineHeight:"1"}},t.couponType.replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),":"," ",e.createElement("span",{style:{fontWeight:600,color:r?.textColor||"#34495e"}},t.name)),e.createElement("div",{style:{fontSize:c?"12px":"13px",color:"#7f8c8d",marginBottom:"6px"}},i(t)),e.createElement("div",{style:{fontSize:c?"11px":"12px",color:"#000000"}},"offer auto applied",e.createElement("a",{href:"#",onClick:e=>{e.preventDefault(),a(t),l(!0)},style:{color:r?.accentColor||"#7f8c8d",fontWeight:700,textDecoration:"none",marginLeft:"2px"}},r?.viewDetailsTitle||"T&C"))))))},Tu=({offersConfig:o,offers:i})=>{const[a,l]=t(!1),[c,s]=t(null),[d,p]=t(null),[u,m]=t("undefined"!=typeof window&&window.innerWidth<=768),[g,x]=t("undefined"!=typeof window&&window.innerWidth<=450),f=r(null);n(()=>{const e=()=>{m(window.innerWidth<=768),x(window.innerWidth<=450)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),n(()=>{f.current&&pn(f.current)},[o?.sectionBgContrastColor]);const y=(e=>{if(!e||0===e.length)return e;const t={};e.forEach(e=>{const n=e.customCartProgressBarCriteria||"none";t[n]=(t[n]||0)+1});let n="none",o=-1;Object.keys(t).forEach(e=>{t[e]>o&&(o=t[e],n=e)});const r=e.map((e,t)=>({o:e,idx:t})),i=e=>"minimum_order_value"===n?void 0!==e.minimumOrderValue&&null!==e.minimumOrderValue?Number(e.minimumOrderValue):1/0:"quantity"===n&&void 0!==e.quantityThreshold&&null!==e.quantityThreshold?Number(e.quantityThreshold):1/0;return r.sort((e,t)=>{const o=e.o.customCartProgressBarCriteria===n,r=t.o.customCartProgressBarCriteria===n;if(o&&r){const n=i(e.o),o=i(t.o);return n!==o?n-o:e.idx-t.idx}return o&&!r?-1:!o&&r?1:e.idx-t.idx}),r.map(e=>e.o)})((!1===o?.showBackendOffers&&o?.customOffers&&o.customOffers.length>0?o.customOffers.map((e,t)=>{return{discountId:-(t+1),name:(n=e).title,couponType:n.code?"discount_code":"special_deal",customCartProgressBarCriteria:null,discountPercentage:null,couponTemplateId:0,minimumOrderValue:0,quantityThreshold:0,_allVariantIds:[],description:n.description,_customOffer:n};var n}):i)||[]),b=e=>{if(s(e),e){const t=e._customOffer;p(t?(e=>({offerMessage:e.description||"Special offer available",terms:e.terms?e.terms.split("\n").filter(e=>""!==e.trim()):[]}))(t):(e=>{const t="free_product"===e.couponType;let n="";t?n="Get this product for free!":e.discountPercentage?n=`Get ${e.discountPercentage}% off`:e.discountValue&&(n=`Get ${e.discountValue} off`);const o=["Limited Time Offer","Applies automatically when criteria is met"];return"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?o.push(`Unlock when you add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to cart`):"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue&&o.push(`Unlock at order value of ${e.minimumOrderValue}`),t&&o.push("Combines with other order discounts"),t||o.push("Not applicable if other offer with higher discount applied on same product"),{offerMessage:n,terms:o}})(e))}},h=e=>{const t=e._customOffer;return t?t.description||"Special offer available":(e=>"quantity"===e.customCartProgressBarCriteria&&e.quantityThreshold?`add ${e.quantityThreshold} ${e.quantityThreshold>1?"items":"item"} to unlock`:"minimum_order_value"===e.customCartProgressBarCriteria&&e.minimumOrderValue?`unlocks on orders above ${e.minimumOrderValue}`:"Special offer available")(e)};return e.createElement("div",null,e.createElement("div",{style:{position:"relative",width:"100%",maxWidth:"450px",borderRadius:"list"===o?.sectionType?`${o?.roundness||0}px`:"0px",boxSizing:"border-box",backgroundColor:o?.sectionBackgroundColor||"#fff"}},e.createElement("div",{style:{border:"coupon"===o?.sectionType?"none":"1px solid rgb(169, 163, 163)",borderTop:"1px solid rgb(169, 163, 163)",padding:null!=o?.cardPadding?`${o.cardPadding}px`:u?"20px 10px 15px":"30px 15px 20px",position:"relative",borderRadius:"list"===o?.sectionType?`${o?.roundness||8}px`:"0px"}},e.createElement("span",{ref:f,className:"yt-product-offers-section-title",style:{position:"absolute",top:"0",left:"left"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"right"===o?.alignment?"auto":"50%",right:"right"===o?.alignment?"coupon"===o?.sectionType?"0px":u?"10px":"20px":"auto",transform:"middle"===o?.alignment?"translateX(-50%) translateY(-50%)":"translateY(-50%)",background:o?.sectionBgContrastColor||"#fff",padding:u?"0 8px":"0 10px",fontWeight:"500",fontSize:u?"14px":"16px",textTransform:"uppercase",textAlign:"center"}},o?.sectionTitle||"Available Deals and Offers"),(()=>{const t=o?.sectionType;return"list"===t?e.createElement(ku,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):"coupon"===t?e.createElement(Eu,{offersToShow:y,offersConfig:o||{},getOfferCardMessage:h,setSelectedOffer:b,setShowPopup:l}):null})(),g?e.createElement(Cu,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}):e.createElement(wu,{selectedOffer:c,selectedOfferTerms:d,showPopup:a,offersConfig:o,onClose:()=>{l(!1),s(null),p(null)}}))))};export{$p as Bundle,hu as BundleLoader,bu as Cart,vu as LoyaltyPageBlock,Lt as Nudge,Tu as ProductOffers,Qt as SpinnerWheel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.8.91",
3
+ "version": "0.8.92",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",