yt-uikit 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -4665,7 +4665,7 @@ import e,{useState as t,useEffect as n,useMemo as o,useRef as r,useCallback as i
4665
4665
  }
4666
4666
  `,vp=c.span`
4667
4667
  font-size: 12px;
4668
- `,wp=({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(ap,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(cp,{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(dp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(pp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(up,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(mp,{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(xp,{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(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{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(yp,{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(bp,{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(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{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(hp,{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(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(bp,{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(gp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(sp,{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)},Cp=({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(tp,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(np,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Yd,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(Gd,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(Xd,{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(Zd,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Kd,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Jd,{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(ep,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Ep=({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(op,{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(rp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(Cp,{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)}))}))},kp=({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),z=o(()=>$?.title?.split(" / ")||[],[$]),N=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 I=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,j=$?.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:N}),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(vd,{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(wd,{className:"yt-fixedBundle-product-card-horizontal_image",src:_p(j),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(Cd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(Ed,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(kd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(Td,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Ap(s.general.currencySymbol,b)," ",Pp(L)),O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Ap(s.general.currencySymbol,b),Pp(R))),e.createElement(Ep,{product:r,variantOptions:x,selectedVariants:z,onVariantChange:I,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(Ad,{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(ip,{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:N}),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(_d,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(Rd,{className:"yt-fixedBundle-product-card_image--vertical",src:_p(j),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Od,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Ld,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(Md,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(jd,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Vd,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Wd,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(qd,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Hd,{className:"yt-fixedBundle-product-card-vertical_price--new"},Ap(s.general.currencySymbol,b),Pp(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-vertical_price--old"},Ap(s.general.currencySymbol,b),Pp(R))))),(f<=3||!u)&&g<f-1&&e.createElement(Qd,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Ud,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Tp=({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,y]=t(!1),b="undefined"!=typeof window?window.location.href:null,h=r?.products?.find(e=>e.productDetails?.handle===b?.split("/").pop()?.split("?")[0]),v=h?.productId,w=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},[]),[C,E]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>w(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k=r?.showIndividualProductSelector??!0,[T,S]=t(new Set(r.products.reduce((e,t,n)=>((t?.productId===v||k)&&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&&v&&E(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===v&&(t[n.toString()]=u)}),t})},[u,v,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const $=i((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),B=(e,t)=>{r.products[t].productId!==v&&S(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},z=o(()=>(e,t)=>w(e.productDetails,t)>0,[w]),N=o(()=>r.products.some((e,t)=>T.has(t)&&e.productDetails.variants.edges.length>1),[r.products,T]),{originalPrice:I,dealPrice:F,offerValue:D}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!T.has(n))return e;const o=C[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;T.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,C,T,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),P=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>T.has(e)),[r.products,T]),A=P.every(({product:e,index:t})=>z(e,C[t.toString()])),_=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(T.has(n)){const o=C[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,T,C]),R=async e=>{s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:P?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!T.has(n)?null:t}).filter(Boolean);a&&await a(Number(I),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},O=async e=>{if(A){if(e&&(e.preventDefault(),e.stopPropagation()),r.personalizedForm)return x(!1),void y(!0);await R()}};if(!a)return e.createElement(e.Fragment,null);const L=r.customizations,M=L.fixedBundle?.cardLayoutStyle||"auto",j="horizontal"===M||"auto"===M&&d,V="bundles"==r.appName?r.pageHeader?.title:r?.title,W="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(fd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:L.fixedBundle.sectionBackgroundColor,..."transparent"!==L.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},V&&e.createElement(yd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:L.fixedBundle?.titleBackgroundColor||"none",color:L.fixedBundle?.titleTextColor||"black",textAlign:L.fixedBundle.infoAlignment??"center",fontSize:L.fixedBundle?.titleFontSize,..."transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===L.fixedBundle.infoAlignment&&"transparent"===L.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},V),W&&e.createElement(bd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:L.fixedBundle?.subtitleFontSize,textAlign:L.fixedBundle.infoAlignment??"center",..."left"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===L.fixedBundle.infoAlignment&&"transparent"!==L.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===L.fixedBundle.infoAlignment&&"transparent"===L.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},W),j?e.createElement(hd,{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(kp,{isChecked:T.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:L,onVariantChange:e=>$(n,e),onCheckChange:e=>{B(e,n)},isMobile:d,index:n,isHorizontal:j,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:T,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:_})))):e.createElement(Dd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(Pd,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===L.fixedBundle.infoAlignment?"flex-start":"right"===L.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(kp,{key:`${t.productId}-${n}`,isChecked:T.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:L,onVariantChange:e=>{$(n,e)},onCheckChange:e=>B(e,n),isMobile:d,index:n,isHorizontal:j,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:T,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:_})),N&&e.createElement(wp,{productsWithIndices:P,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:L.general.ctaTextColor,backgroundColor:L.general.ctaBackgroundColor},onVariantChange:$,handleAddToCart:O,primaryProductId:v,variantId:u||void 0}))),e.createElement($d,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===L.fixedBundle.infoAlignment?"flex-start":"right"===L.fixedBundle.infoAlignment?"flex-end":"center"}},Number(I)>0&&Number(D)>0&&L.fixedBundle.compareAtPriceVisibility&&e.createElement(Bd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(L.general.currencySymbol,r?.storeCurrencyCode),Pp(I))),0!==T.size&&e.createElement(zd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(L.general.currencySymbol,r?.storeCurrencyCode),Pp(F))," ",Number(D)>0&&e.createElement(Id,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Ap(L.general.currencySymbol,r?.storeCurrencyCode),Pp(D)))),e.createElement(Fd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),j||!N?O(e):x(!0)},disabled:T.size<1||c||!A,style:{backgroundColor:L.general?.ctaBackgroundColor||"#121212",color:L.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${L.general?.ctaBackgroundColor||"#121212"}`,boxShadow:L.general.ctaShadowType,paddingTop:L.general?.ctaPadding,paddingBottom:L.general?.ctaPadding,borderRadius:L.general.ctaBorderRadius,width:L.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{L.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=L.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=L.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{L.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=L.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=L.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ue,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):A?e.createElement(e.Fragment,null,L.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),r?.personalizedForm&&e.createElement(os,{isOpen:f,onClose:()=>y(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await R(e),y(!1)},cta:{backgroundColor:L.general?.ctaBackgroundColor||"#121212",textColor:L.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},Sp=({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=_p(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:_p(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)},$p=({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))})))},Bp=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[]},zp=({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(!1),[v,w]=t(window.innerWidth<640),[C,E]=t({}),k=r(null),T=r(new Map),[S,$]=t(160),B=v?8:20,{customizations:z}=o,N=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),I=!!o.config.form,F=N.length+(I?1:0),D=z.hideSelectedProducts,P=z.allowMultipleQty,A=z.hideOutOfStockProducts,_=o.config.splitVariants??!1,R=r(new Set),O=i((e,t=d)=>{const n=N[e-1]?.products||[],o="All"===t?n:n.filter(e=>Bp(e).includes(t));return A?o.filter(e=>e.available):o},[N,d,A]),L=i(e=>{const t=O(e).length;E(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,O]);n(()=>(k.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&&L(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[L,c]),n(()=>{p("All")},[c]),n(()=>{if(I&&c===F)return;const e=c-1;if(!N[e])return;if(R.current.has(e))return;const t=O(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=Q(e),a=Y[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)&&(R.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<F)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(I&&c===F)return;const e=c,t=O(e).length;E(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(B,t),[`${e}_category`]:d}:n})},[c,B,d,O]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>w(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const M=i(e=>{$(e+10)},[]),j=u.reduce((e,t)=>e+t.quantity,0),V=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,W=u.reduce((e,t)=>{const n=N.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,H=(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=Y[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=N[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},U=(e,t)=>{const n=Q(t);if(n===1/0)return!0;const o=Y[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},Y=N.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),G=(e,t,n)=>{const o=Q(n);if(o===1/0)return!0;return Y[n]<o},X=I&&c===F,Z=(X?null:N[c-1])?Q(c-1):0,K=N.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:Y[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},z.headerImage&&!z.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:z.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),z.showTierSteps&&e.createElement("div",{style:{paddingTop:z.headerImage&&!z.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Np,{totalSteps:F,isFormStep:X,currentStep:c,getStepTitle:e=>I&&e===F?"Customize Gift Details":N[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:o?.config?.form?.title,hasForm:I,onStepClick:e=>{if(e>1&&!u.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:F},(e,t)=>t+1).map(t=>{const n=I&&t===F,r=n?[]:(e=>N[e-1]?.products||[])(t);let i=[];if(!n&&z.enableProductCategories){const e=new Set;r.forEach(t=>Bp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const a=n?[]:O(t),l=t-1,s=a.slice(0,C[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(Xc,{form:o.config.form,formData:f,setFormData:y,barHeight:S,isUploading:b,setIsUploading:h}):e.createElement(e.Fragment,null,z.enableProductCategories&&i.length>0&&e.createElement($p,{styles:z,isMobile:v,categories:i,activeCategory:d,onCategoryChange:p}),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},_?s.flatMap(t=>t.variants.filter(e=>!A||e.available).map(n=>e.createElement(Ip,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!0}))):s.map(t=>e.createElement(Ip,{key:t.id,product:t,tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!1})),c===t&&(C[t]||0)<a.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))))}),e.createElement(Fp,{config:o,selectedProducts:u,selectedByTier:K,totalItems:j,totalPrice:V,totalCompareAtPrice:W,currentStep:c,totalSteps:F,currentTierMax:Z,tierSelectedCounts:Y,isMobile:v,bundleAddToCartLoading:a,isUploading:b,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<N.length;t++)if(N[t].products.some(t=>t.id.toString()===e))return t+1;return I?F:N.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!==F||!u.length)return;const e={};I&&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:I,onHeightChange:M}))},Np=({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))},Ip=({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:_p(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:_p(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&&Bp(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"}},Bp(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))),Bp(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"}},"+",Bp(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(Sp,{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}))},Fp=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),z=r(null),N=r(null),{totalOriginal:I,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(z.current&&T){const e=z.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<(N.current??0)&&(N.current=e),e>(N.current??0)){N.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:z,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:_p(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"}},"₹",I.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(Yc,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"}},"₹",I.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(Yc,null)):p===u?"Checkout":"Next")))},Dp=window?.Shopify?.currency||{rate:1,active:"INR"},Pp=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Dp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Ap=(e,t)=>t==Dp.active?e:se(Dp.active)||Dp.active,_p=(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"}`}},Rp=(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))},Op=({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,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(ns,{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,productsPagination:g}):"combo"===t.type?e.createElement(is,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(xd,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(zp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(_s,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(Tp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),Lp=c.div`
4668
+ `,wp=({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(ap,{className:"yt-fixedBundle-variant-modal_overlay",onClick:a},e.createElement(lp,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},e.createElement(cp,{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(dp,{className:"yt-fixedBundle-variant-modal_product-block"},e.createElement(pp,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[n]?.node?.image?.url||t.productDetails.featuredMedia?.preview?.image?.url,alt:t.productDetails.title}),e.createElement(up,{className:"yt-fixedBundle-variant-modal_product-info"},e.createElement(mp,{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(xp,{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(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{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(yp,{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(bp,{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(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{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(hp,{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(bp,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:g[n]?.[r]==o,disabled:l,onClick:()=>{h(n,o,r)}},o))})):e.createElement(fp,{className:"yt-fixedBundle-variant-modal_options-row"},e.createElement(vp,{className:"yt-fixedBundle-variant-modal_option-name"},o.name," :"," "),a.map((o,i)=>{const a=!b(n,r,o,t);return e.createElement(bp,{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(gp,{className:"yt-fixedBundle-variant-modal_divider"}))),e.createElement(sp,{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)},Cp=({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(tp,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:t.value},e.createElement("span",null)):"image"===l?e.createElement(np,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:t.value||"/placeholder.svg",alt:t.name},e.createElement("span",null)):null;return e.createElement(Yd,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:d},e.createElement(Gd,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>s(!c)},e.createElement(Xd,{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(Zd,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:c})),c&&e.createElement(Kd,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},o?.map(t=>e.createElement(Jd,{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(ep,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},t.name)))))},Ep=({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(op,{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(rp,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:t.name,$isFirst:0===n},e.createElement(Cp,{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)}))}))},kp=({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),z=o(()=>$?.title?.split(" / ")||[],[$]),N=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 I=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,j=$?.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:N}),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(vd,{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(wd,{className:"yt-fixedBundle-product-card-horizontal_image",src:_p(j),alt:r.title,style:{borderRadius:s.fixedBundle?.borderRadius,borderColor:s.fixedBundle?.borderColor,aspectRatio:s.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),e.createElement(Cd,{className:"yt-fixedBundle-product-card-horizontal_details"},e.createElement(Ed,{className:"yt-fixedBundle-product-card-horizontal_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(kd,{className:"yt-fixedBundle-product-card-horizontal_price-section"},e.createElement(Td,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Ap(s.general.currencySymbol,b)," ",Pp(L)),O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Ap(s.general.currencySymbol,b),Pp(R))),e.createElement(Ep,{product:r,variantOptions:x,selectedVariants:z,onVariantChange:I,variantId:v,primaryProductId:h})))):e.createElement(e.Fragment,null,e.createElement(Ad,{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(ip,{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:N}),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(_d,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:s.general.imageAspectRatio,height:"fit-content"}},e.createElement(Rd,{className:"yt-fixedBundle-product-card_image--vertical",src:_p(j),style:{aspectRatio:s.general.imageAspectRatio},alt:r.title}),r.variants.edges.length>1&&e.createElement(Od,{className:"yt-fixedBundle-product-card_badge-container"},e.createElement(Ld,{className:"yt-fixedBundle-product-card_circle-button"},e.createElement("span",null)),e.createElement(Md,{className:"yt-fixedBundle-product-card_circle-button-two"},e.createElement("span",null)),e.createElement(jd,{className:"yt-fixedBundle-product-card_count-badge"},r.variants.edges.length,"+"))),e.createElement(Vd,{className:"yt-fixedBundle-product-card-vertical_info"},e.createElement(Wd,{className:"yt-fixedBundle-product-card-vertical_title"},r.title),s.fixedBundle.productsPriceVisibility&&e.createElement(qd,{className:"yt-fixedBundle-product-card-vertical_price-line"},e.createElement(Hd,{className:"yt-fixedBundle-product-card-vertical_price--new"},Ap(s.general.currencySymbol,b),Pp(L)),s.fixedBundle.compareAtPriceVisibility&&O&&R>_&&e.createElement(Sd,{className:"yt-fixedBundle-product-card-vertical_price--old"},Ap(s.general.currencySymbol,b),Pp(R))))),(f<=3||!u)&&g<f-1&&e.createElement(Qd,{className:"yt-fixedBundle-plus-wrapper"}," ",e.createElement(Ud,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},Tp=({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,y]=t(!1),b="undefined"!=typeof window?window.location.href:null,h=r?.products?.find(e=>e.productDetails?.handle===b?.split("/").pop()?.split("?")[0]),v=h?.productId,w=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},[]),[C,E]=t(Object.fromEntries(r?.products?.map((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find(t=>w(e.productDetails,t?.node?.id)>0)?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id]))),k="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"beautywiseshop.myshopify.com"===window.ytBundleApp?.storeDomain||"swashaa.myshopify.com"===window.ytBundleApp?.storeDomain),T=r?.showIndividualProductSelector??!0,[S,$]=t(new Set(r.products.reduce((e,t,n)=>(k&&t?.productId!==v&&!T||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&&v&&E(e=>{const t={...e};return r?.products?.forEach((e,n)=>{e.productId===v&&(t[n.toString()]=u)}),t})},[u,v,r?.products]),n(()=>{const e=()=>{p(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]);const B=i((e,t)=>{E(n=>({...n,[e.toString()]:t}))},[]),z=(e,t)=>{const n=r.products[t].productId;k&&n===v||$(n=>{const o=new Set(n);return e?o.add(t):o.delete(t),o})},N=o(()=>(e,t)=>w(e.productDetails,t)>0,[w]),I=o(()=>r.products.some((e,t)=>S.has(t)&&e.productDetails.variants.edges.length>1),[r.products,S]),{originalPrice:F,dealPrice:D,offerValue:P}=o(()=>{const{price:e,compareAtPrice:t}=r.products.reduce((e,t,n)=>{if(!S.has(n))return e;const o=C[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;S.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,C,S,r.percentageOff,r.dealAmount,r.amountOff,r?.customizations?.fixedBundle?.discountBadgeDisplay]),A=o(()=>r.products.map((e,t)=>({product:e,index:t})).filter(({index:e})=>S.has(e)),[r.products,S]),_=A.every(({product:e,index:t})=>N(e,C[t.toString()])),R=o(()=>{let e=0;return r.products.forEach((t,n)=>{if(S.has(n)){const o=C[n.toString()],r=t.productDetails.variants.edges.find(e=>e.node.id===o)?.node;r&&(e+=parseFloat(r.price??"0"))}}),e},[r.products,S,C]),O=async e=>{s(!0),x(!1),l?.({eventNameCustom:"bundle_add_to_cart",eventTypeCustom:"clicks",data:{bundleId:r._id,bundleType:"fixed-bundle",selectedProducts:A?.map(e=>({id:e?.product?.productId,title:e?.product?.productDetails?.title}))}});try{const t=Object.entries(C).map(([e,t])=>{const n=parseInt(e);return isNaN(n)||!S.has(n)?null:t}).filter(Boolean);a&&await a(Number(F),t,void 0,void 0,e)}catch(e){console.error("Error adding to cart:",e)}s(!1)},L=async e=>{if(_){if(e&&(e.preventDefault(),e.stopPropagation()),r.personalizedForm)return x(!1),void y(!0);await O()}};if(!a)return e.createElement(e.Fragment,null);const M=r.customizations,j=M.fixedBundle?.cardLayoutStyle||"auto",V="horizontal"===j||"auto"===j&&d,W="bundles"==r.appName?r.pageHeader?.title:r?.title,H="bundles"==r.appName?r.pageHeader?.description:r?.subtitle;return e.createElement(fd,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:M.fixedBundle.sectionBackgroundColor,..."transparent"!==M.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},W&&e.createElement(yd,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:M.fixedBundle?.titleBackgroundColor||"none",color:M.fixedBundle?.titleTextColor||"black",textAlign:M.fixedBundle.infoAlignment??"center",fontSize:M.fixedBundle?.titleFontSize,..."transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},W),H&&e.createElement(bd,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:M.fixedBundle?.subtitleFontSize,textAlign:M.fixedBundle.infoAlignment??"center",..."left"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===M.fixedBundle.infoAlignment&&"transparent"!==M.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===M.fixedBundle.infoAlignment&&"transparent"===M.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},H),V?e.createElement(hd,{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(kp,{isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>B(n,e),onCheckChange:e=>{z(e,n)},isMobile:d,index:n,isHorizontal:V,variantOptions:r.variantOptions,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})))):e.createElement(Dd,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},e.createElement(Pd,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},r?.products?.map((t,n)=>e.createElement(kp,{key:`${t.productId}-${n}`,isChecked:S.has(n),product:t.productDetails,selectedVariantId:C[n.toString()]||"",canCustomize:r?.canCustomizeFixedBundle||!1,styles:M,onVariantChange:e=>{B(n,e)},onCheckChange:e=>z(e,n),isMobile:d,index:n,isHorizontal:V,productsLength:r.products.length,storeCurrencyCode:r.storeCurrencyCode,primaryProductId:v,variantId:u||void 0,bundleDiscountType:r.discountType??"none",checkedProducts:S,bundleProductsCount:r.products.length,bundleDiscountValue:r.percentageOff||r.amountOff||r.dealAmount,totalSelectedOriginal:R})),I&&e.createElement(wp,{productsWithIndices:A,isOpen:g,onClose:()=>x(!1),variantOptions:r.variantOptions,cta:{textColor:M.general.ctaTextColor,backgroundColor:M.general.ctaBackgroundColor},onVariantChange:B,handleAddToCart:L,primaryProductId:v,variantId:u||void 0}))),e.createElement($d,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===M.fixedBundle.infoAlignment?"flex-start":"right"===M.fixedBundle.infoAlignment?"flex-end":"center"}},Number(F)>0&&Number(P)>0&&M.fixedBundle.compareAtPriceVisibility&&e.createElement(Bd,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(M.general.currencySymbol,r?.storeCurrencyCode),Pp(F))),0!==S.size&&e.createElement(zd,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",e.createElement(Nd,{className:"yt-fixedBundle-summary_price"},Ap(M.general.currencySymbol,r?.storeCurrencyCode),Pp(D))," ",Number(P)>0&&e.createElement(Id,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Ap(M.general.currencySymbol,r?.storeCurrencyCode),Pp(P)))),e.createElement(Fd,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),V||!I?L(e):x(!0)},disabled:S.size<1||c||!_,style:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",color:M.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${M.general?.ctaBackgroundColor||"#121212"}`,boxShadow:M.general.ctaShadowType,paddingTop:M.general?.ctaPadding,paddingBottom:M.general?.ctaPadding,borderRadius:M.general.ctaBorderRadius,width:M.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=M.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{M.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=M.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=M.general?.ctaTextColor||"#FFFFFF")}},c?e.createElement(ue,{color:"white",loading:c,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):_?e.createElement(e.Fragment,null,M.fixedBundle?.ctaTitle??"Add Bundle to cart"):e.createElement(e.Fragment,null,"Out of Stock")),r?.personalizedForm&&e.createElement(os,{isOpen:f,onClose:()=>y(!1),formConfig:r.personalizedForm,onCheckout:async e=>{await O(e),y(!1)},cta:{backgroundColor:M.general?.ctaBackgroundColor||"#121212",textColor:M.general?.ctaTextColor||"#FFFFFF"},isMobile:d}))},Sp=({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=_p(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:_p(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)},$p=({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))})))},Bp=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[]},zp=({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(!1),[v,w]=t(window.innerWidth<640),[C,E]=t({}),k=r(null),T=r(new Map),[S,$]=t(160),B=v?8:20,{customizations:z}=o,N=o.config.builderTiers.collectionTier.sort((e,t)=>e.tier-t.tier),I=!!o.config.form,F=N.length+(I?1:0),D=z.hideSelectedProducts,P=z.allowMultipleQty,A=z.hideOutOfStockProducts,_=o.config.splitVariants??!1,R=r(new Set),O=i((e,t=d)=>{const n=N[e-1]?.products||[],o="All"===t?n:n.filter(e=>Bp(e).includes(t));return A?o.filter(e=>e.available):o},[N,d,A]),L=i(e=>{const t=O(e).length;E(n=>{const o=n[e]||0,r=Math.min(o+8,t);return r<=o?n:{...n,[e]:r}})},[8,O]);n(()=>(k.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&&L(e)}},{root:null,threshold:0,rootMargin:"100px 0px"}),()=>{k.current?.disconnect()}),[L,c]),n(()=>{p("All")},[c]),n(()=>{if(I&&c===F)return;const e=c-1;if(!N[e])return;if(R.current.has(e))return;const t=O(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=Q(e),a=Y[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)&&(R.current.add(e),m(t=>[...t,{productId:n.id.toString(),variantId:r.id.toString(),price:r.price,quantity:1,tierIndex:e}]),c<F)){const e=setTimeout(()=>{s(e=>e+1),window.scrollTo(0,0)},50);return()=>clearTimeout(e)}},[c]),n(()=>{if(I&&c===F)return;const e=c,t=O(e).length;E(n=>{const o=n[`${e}_category`]!==d;return 0===(n[e]||0)||o?{...n,[e]:Math.min(B,t),[`${e}_category`]:d}:n})},[c,B,d,O]),n(()=>{const e=document.querySelector(".box-loader-scene");e&&e.setAttribute("style","display: none;");const t=()=>w(window.innerWidth<640);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const M=i(e=>{$(e+10)},[]),j=u.reduce((e,t)=>e+t.quantity,0),V=u.reduce((e,t)=>e+t.price*t.quantity,0)/100,W=u.reduce((e,t)=>{const n=N.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,H=(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=Y[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=N[e];return t.maximumQuantity>0?t.maximumQuantity:1/0},U=(e,t)=>{const n=Q(t);if(n===1/0)return!0;const o=Y[t];return!!u.some(n=>n.productId===e.id.toString()&&n.tierIndex===t)||o<n},Y=N.map((e,t)=>u.filter(e=>e.tierIndex===t).reduce((e,t)=>e+t.quantity,0)),G=(e,t,n)=>{const o=Q(n);if(o===1/0)return!0;return Y[n]<o},X=I&&c===F,Z=(X?null:N[c-1])?Q(c-1):0,K=N.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:Y[t]}));return e.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"0 auto",maxWidth:"1600px"}},z.headerImage&&!z.headerImage.includes("Liquid error")&&e.createElement("img",{className:"yt-collection-bundle-header-img",src:z.headerImage,alt:"Collection Bundle header",style:{width:"100%"}}),z.showTierSteps&&e.createElement("div",{style:{paddingTop:z.headerImage&&!z.headerImage.includes("Liquid error")?"20px":"0"}},e.createElement(Np,{totalSteps:F,isFormStep:X,currentStep:c,getStepTitle:e=>I&&e===F?"Customize Gift Details":N[e-1]?.title||`Step ${e}`,isMobile:v,formTitle:o?.config?.form?.title,hasForm:I,onStepClick:e=>{if(e>1&&!u.length)return alert("Add at least one product first");s(e),window.scrollTo(0,0)}})),Array.from({length:F},(e,t)=>t+1).map(t=>{const n=I&&t===F,r=n?[]:(e=>N[e-1]?.products||[])(t);let i=[];if(!n&&z.enableProductCategories){const e=new Set;r.forEach(t=>Bp(t).forEach(t=>e.add(t))),i=Array.from(e).sort()}const a=n?[]:O(t),l=t-1,s=a.slice(0,C[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(Xc,{form:o.config.form,formData:f,setFormData:y,barHeight:S,isUploading:b,setIsUploading:h}):e.createElement(e.Fragment,null,z.enableProductCategories&&i.length>0&&e.createElement($p,{styles:z,isMobile:v,categories:i,activeCategory:d,onCategoryChange:p}),e.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:v?"grid":"flex",gridTemplateColumns:v?"repeat(2,1fr)":"",flexWrap:v?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:`${S}px`}},_?s.flatMap(t=>t.variants.filter(e=>!A||e.available).map(n=>e.createElement(Ip,{key:`${t.id}-${n.id}`,product:{...t,variants:[n]},tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!0}))):s.map(t=>e.createElement(Ip,{key:t.id,product:t,tierIdx:l,customizations:z,isMobile:v,hoveredCard:g,setHoveredCard:x,selectedProducts:u,handleAddToBundle:q,canAddProduct:U,allowMultipleQty:P,handleVariantChange:H,canIncrement:G,setSelectedProducts:m,splitVariants:!1})),c===t&&(C[t]||0)<a.length&&e.createElement("div",{ref:e=>{const n=T.current.get(t);n&&k.current?.unobserve(n),e?(T.current.set(t,e),k.current?.observe(e)):T.current.delete(t)},"data-sentinel-step":t.toString(),style:{height:"20px",width:"100%",display:"block"}}))))}),e.createElement(Fp,{config:o,selectedProducts:u,selectedByTier:K,totalItems:j,totalPrice:V,totalCompareAtPrice:W,currentStep:c,totalSteps:F,currentTierMax:Z,tierSelectedCounts:Y,isMobile:v,bundleAddToCartLoading:a,isUploading:b,hoveredCard:g,setHoveredCard:x,hideSelectedProducts:D,getProductStep:e=>{for(let t=0;t<N.length;t++)if(N[t].products.some(t=>t.id.toString()===e))return t+1;return I?F:N.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!==F||!u.length)return;const e={};I&&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:I,onHeightChange:M}))},Np=({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))},Ip=({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:_p(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:_p(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&&Bp(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"}},Bp(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))),Bp(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"}},"+",Bp(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(Sp,{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}))},Fp=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),z=r(null),N=r(null),{totalOriginal:I,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(z.current&&T){const e=z.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<(N.current??0)&&(N.current=e),e>(N.current??0)){N.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:z,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:_p(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"}},"₹",I.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(Yc,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"}},"₹",I.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(Yc,null)):p===u?"Checkout":"Next")))},Dp=window?.Shopify?.currency||{rate:1,active:"INR"},Pp=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Dp.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Ap=(e,t)=>t==Dp.active?e:se(Dp.active)||Dp.active,_p=(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"}`}},Rp=(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))},Op=({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,productsPagination:g})=>"fixed"!==t.type&&t.type&&0!==t?.type?.length?"builder"===t.type?e.createElement(ns,{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,productsPagination:g}):"combo"===t.type?e.createElement(is,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"mixAndMatch"===t.type?e.createElement(xd,{bundle:t,addToCartFunction:o,dispatchAnalyticsEvent:u}):"collection"===t.type?e.createElement(zp,{config:t,addCustomBundleToCart:r,bundleAddToCartLoading:l}):e.createElement(_s,{bundle:t,currentProductId:n,addToCartFunction:o,dispatchAnalyticsEvent:u}):e.createElement(Tp,{addToCartFunction:o,bundle:t,dispatchAnalyticsEvent:u}),Lp=c.div`
4669
4669
  position: relative;
4670
4670
  `,Mp=c.button`
4671
4671
  border: 1px solid #ccc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "rm -rf dist && tsc && rollup -c",