yt-uikit 0.7.397-collection-bundle.9 → 0.7.397-collection-bundle.10

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
@@ -4933,4 +4933,4 @@ import*as e from"react";import t,{forwardRef as n,useImperativeHandle as r,useRe
4933
4933
  }
4934
4934
  `,kx=h.span`
4935
4935
  font-size: 12px;
4936
- `,Tx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:d,primaryProductId:s,variantId:p})=>{const[u,m]=c((()=>{const t={};return e?.forEach((({product:e,index:n})=>{let r=e?.productDetails?.options?.map((e=>e.values[0]??""));if(e.productId===s&&p){const t=e?.productDetails?.variants?.edges.find((e=>e?.node?.id?.includes(p)))?.node;t&&(r=t.title.split(" / "))}t[n]=r})),t}));l((()=>{if(!s||!p)return;const t=e?.find((({product:e})=>e?.productId===s));if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find((e=>e.node.id.includes(p)))?.node;if(o){const e=o.title.split(" / ");m((t=>({...t,[r]:e}))),g((e=>({...e,[r]:{node:o}}))),i(r,o.id)}}),[p,s,e,i]);const[f,g]=c({}),x=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const{product:a}=e?.find((e=>e.index===t))||{product:{productDetails:{variants:{edges:[]}}}};if(!a?.productDetails)return;const l=a?.productDetails?.variants?.edges?.find((e=>e.node.title===o[t].join(" / ")))?.node;l&&(i(t,l.id),g((e=>({...e,[t]:{node:l}}))))};if(!n)return null;const h=t.createElement(sx,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(px,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(ux,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map((({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(fx,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(gx,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(xx,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(hx,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(bx,{className:"yt-fixedBundle-variant-modal_selected-value"},u[r].join(" / "))),n.productDetails.options.map(((e,n)=>{const o=a&&a?.options?.find((t=>t.name===e.name));return e.values.length<=1?t.createElement(t.Fragment,null):o&&"color"===o?.type?t.createElement(vx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(kx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o.values.find((t=>t.name===e))?.value?t.createElement(wx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},t.createElement("span",null)):t.createElement(Cx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):o&&"image"===o?.type?t.createElement(vx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(kx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o?.values.find((t=>t.name===e))?.value?t.createElement(Ex,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(Cx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):t.createElement(vx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(kx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,o)=>t.createElement(Cx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))})))),o<e.length-1&&t.createElement(yx,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(mx,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(h,document.body)},Sx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,d]=c(!1),s=o(null);l((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(tx,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(nx,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Gg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},t.createElement(Yg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!i)},t.createElement(Zg,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(Kg,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Xg,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(Jg,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),d(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(ex,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},$x=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:d="dropdown"})=>{const[s,p]=c(r||[]);l((()=>{if(a&&e.variants.edges.some((e=>e.node.id.includes(a)))){const t=e.variants.edges.find((e=>e.node.id.includes(a)))?.node;if(t){const e=t.title.split(" / ");p(e)}}}),[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find((t=>t.name===e));return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map((e=>({name:e,value:e})));const r=n.options.find((t=>t.name===e.name));return e.values.map((e=>{const t=r?.values?.find((t=>t.name===e));return{name:e,value:t?.value||e}}))},f=(e,t)=>{const n=s[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(rx,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(ox,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Sx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...s];r[t]=n.name,p(r);const a=e.variants.edges.find((n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t])))?.node.id;o(a||"")})(r,t)},type:u(n.name)})))))},Bx=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:d,isMobile:s,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:x,primaryProductId:h,variantId:y})=>{const[b,v]=c(e?.variants?.edges.find((e=>e?.node?.id===n))?.node),[w]=c(e?.options?.map((e=>e?.values?.[0]))||[]),C=e?.id===h;l((()=>{if(y&&e.id===h){const t=e?.variants?.edges?.find((e=>e?.node?.id?.includes(y)))?.node;t&&(v(t),i(t.id))}else{const t=e?.variants?.edges?.find((e=>e?.node?.id===n))?.node;v(t)}}),[e,h,n,y,i]);const E="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,k=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(cx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(lx,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(vg,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(wg,{className:"yt-fixedBundle-product-card-horizontal_image",src:k,alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(Cg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(Eg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(kg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(Tg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Px(a.general.currencySymbol,x)," ",Ox(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Sg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Px(a.general.currencySymbol,x),Ox(b?.compareAtPrice))),t.createElement($x,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:h})))):t.createElement(t.Fragment,null,t.createElement(Pg,{className:""+(e.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...E&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(dx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:E},t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(lx,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Ag,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(Fg,{className:"yt-fixedBundle-product-card_image--vertical",src:k,style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Mg,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(Rg,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Lg,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(jg,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(Vg,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Wg,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Ug,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Hg,{className:"yt-fixedBundle-product-card-vertical_price--new"},Px(a.general.currencySymbol,x),Ox(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Sg,{className:"yt-fixedBundle-product-card-vertical_price--old"},Px(a.general.currencySymbol,x),Ox(b?.compareAtPrice))))),(f<=3||!s)&&u<f-1&&t.createElement(qg,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(Qg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},zx=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[d,s]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,x=e?.products?.find((e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0])),h=x?.productId,[y,b]=c(Object.fromEntries(e?.products?.map(((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),v="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),w=e?.showIndividualProductSelector||!0,[C,E]=c(new Set(e.products.reduce(((e,t,n)=>(v&&t?.productId!==h&&!w||e.push(n),e)),[])));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}}),[]),l((()=>{p&&h&&b((t=>{const n={...t};return e?.products?.forEach(((e,t)=>{e.productId===h&&(n[t.toString()]=p)})),n}))}),[p,h,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=a(((e,t)=>{b((n=>({...n,[e.toString()]:t})))}),[]),T=(t,n)=>{const r=e.products[n].productId;v&&w&&r===h||E((e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r}))},S=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),$=i((()=>e.products.some(((e,t)=>C.has(t)&&e.productDetails.variants.edges.length>1))),[e.products,C]),{originalPrice:B,dealPrice:z,offerValue:D}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t,n)=>{if(!C.has(n))return e;const r=y[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find((e=>e.node.id===r))?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);C.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[e.products,y,C,e.percentageOff,e.dealAmount,e.amountOff]),I=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(y).map((([e,t])=>{const n=parseInt(e);return isNaN(n)||!C.has(n)?null:t})).filter(Boolean);n&&await n(Number(B),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)},_=i((()=>e.products.map(((e,t)=>({product:e,index:t}))).filter((({index:e})=>C.has(e)))),[e.products,C]);if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!S)return t.createElement(t.Fragment,null);const N=e.customizations,O=N.fixedBundle?.cardLayoutStyle||"auto",P="horizontal"===O||"auto"===O&&d,A="bundles"==e.appName?e.pageHeader?.title:e?.title,F="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(xg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:N.fixedBundle.sectionBackgroundColor,..."transparent"!==N.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(hg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:N.fixedBundle?.titleBackgroundColor||"none",color:N.fixedBundle?.titleTextColor||"black",textAlign:N.fixedBundle.infoAlignment??"center",fontSize:N.fixedBundle?.titleFontSize,..."transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),F&&t.createElement(yg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:N.fixedBundle?.subtitleFontSize,textAlign:N.fixedBundle.infoAlignment??"center",..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},F),P?t.createElement(bg,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(Bx,{isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>{T(e,r)},isMobile:d,index:r,isHorizontal:P,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))))):t.createElement(Ng,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Og,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement(Bx,{key:`${n.productId}-${r}`,isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>T(e,r),isMobile:d,index:r,isHorizontal:P,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))),$&&t.createElement(Tx,{productsWithIndices:_,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:N.general.ctaTextColor,backgroundColor:N.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:I,primaryProductId:h,variantId:p||void 0}))),t.createElement($g,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},Number(B)>0&&Number(D)>0&&N.fixedBundle.compareAtPriceVisibility&&t.createElement(Bg,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(Dg,{className:"yt-fixedBundle-summary_price"},Px(N.general.currencySymbol,e?.storeCurrencyCode),Ox(B))),0!==C.size&&t.createElement(zg,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(Dg,{className:"yt-fixedBundle-summary_price"},Px(N.general.currencySymbol,e?.storeCurrencyCode),Ox(z))," ",Number(D)>0&&t.createElement(Ig,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Px(N.general.currencySymbol,e?.storeCurrencyCode),Ox(D)))),t.createElement(_g,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),P||!$?I(e):f(!0)},disabled:C.size<1||r,style:{backgroundColor:N.general?.ctaBackgroundColor||"#121212",color:N.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${N.general?.ctaBackgroundColor||"#121212"}`,boxShadow:N.general.ctaShadowType,paddingTop:N.general?.ctaPadding,paddingBottom:N.general?.ctaPadding,borderRadius:N.general.ctaBorderRadius,width:N.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=N.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=N.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(qo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,N.fixedBundle?.ctaTitle??"Add Bundle to cart")))},Dx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[a,i]=c(1),[d,s]=c([]),[p,u]=c(null),[m,f]=c({}),[g,x]=c(window.innerWidth<640),h=o(new Map);l((()=>{const e=()=>x(window.innerWidth<640);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]);const{customizations:y}=e,b=e.config.builderTiers.collectionTier.sort(((e,t)=>e.tier-t.tier)),v=b.length+1,w=v,C=d.reduce(((e,t)=>e+t.quantity),0),E=d.reduce(((e,t)=>e+t.price*t.quantity),0)/100,k=d.reduce(((e,t)=>{const n=b.flatMap((e=>e.products)).find((e=>e.id.toString()===t.productId)),r=n?.variants.find((e=>e.id.toString()===t.variantId));return e+(r?.compare_at_price??t.price)*t.quantity}),0)/100,T=e=>{if(e>1&&!d.length)return alert("Add at least one product first");i(e),window.scrollTo(0,0)},S=b.map(((e,t)=>d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>e+t.quantity),0))),$=e=>{const t=b[e];return t.minimumQuantity>0?t.minimumQuantity:1/0},B=(e,t)=>{const n=S[t],r=$(t);return r===1/0||n<r},z=e=>{if(!h.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");f((t=>({...t,[e]:{loading:!0,name:n.name}})));try{const t=await(async e=>{const t=new FormData;t.append("file",e);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw alert("Upload failed. Try again."),e}})(n);f((r=>({...r,[e]:{url:t,name:n.name}})))}catch{f((t=>({...t,[e]:{error:!0,name:n.name}})))}}},document.body.appendChild(t),h.current.set(e,t)}return h.current.get(e)},D=async()=>{if(a!==w||!d.length)return;const e={};Object.entries(m).forEach((([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}));const t=d.map((t=>({variantId:t.variantId,quantity:t.quantity,properties:e})));r(t)},I=a<=b.length?b[a-1]:null,_=I?$(a-1):0,N=_===1/0?`Add items from ${I?.title}`:`Add up to ${_} item${_>1?"s":""} from ${I?.title}`,O=b.map(((e,t)=>{const n=d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find((e=>`${e.productId}-${e.variantId}`===n));return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e}),[]);return{tier:e,items:n,count:S[t]}}));return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"20px auto",maxWidth:"1400px"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:g?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:g?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:g?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:v},((e,t)=>t+1)).map((e=>t.createElement("div",{key:e,className:"yt-collection-bundle-step-item "+(a===e?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:a===e?1:.5,transition:"opacity 0.2s"},onClick:()=>T(e)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(a===e?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:a===e?y?.stepActiveBg||"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},e===w?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:a===e?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:a===e?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600"}},(e=>e===w?"Customize Gift Details":b[e-1]?.title||`Step ${e}`)(e)))))),e.config.form.title&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:g?"14px":"16px",marginBottom:g?"0":"14px",fontWeight:"400",color:"#000"}},e.config.form.title)),Array.from({length:v},((e,t)=>t+1)).map((n=>{const r=n===w,o=r?[]:(e=>b[e-1]?.products||[])(n),i=o.filter((e=>e.available)),l=n-1;return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(a===n?"yt-collection-bundle-step-content-active":""),style:{display:a===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:"100px"}},e.config.form.sections.map(((e,n)=>{const r=`sec_${n}`;return t.createElement("div",{key:r,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px"}},e.title),"text"===e.type&&t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e.title,rows:3,maxLength:500,onChange:e=>f((t=>({...t,[r]:e.target.value}))),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical"}})}))),"image"===e.type&&t.createElement("div",{style:{marginBottom:"24px"}},t.createElement("sub",{style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px"}},"jpeg/png (max 5MB)"),t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n,o=m[r];return t.createElement(Ix,{key:r,title:e.title,uploadState:o,onUpload:()=>z(r).click(),onRemove:()=>f((e=>{const{[r]:t,...n}=e;return n})),onRetry:()=>z(r).click()})})))))}))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:g?"grid":"flex",gridTemplateColumns:g?"repeat(2,1fr)":"",flexWrap:g?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:"100px"}},i.map((e=>{const n=document.querySelector(`[data-product-id="${e.id}"]`),r=n?.dataset.selectedVariant||e.variants[0].id.toString(),o=e.variants.find((e=>e.id.toString()===r))||e.variants[0],a=d.some((t=>t.productId===e.id.toString()&&t.variantId===r&&t.tierIndex===l)),i=p===e.id;return t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":o.id,"data-current-price":o.price,style:{display:"flex",flexDirection:"column",border:y?.productCardBorder||"1px solid #ddd",background:y?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:g?0:"250px",maxWidth:g?"none":"250px",borderRadius:y?.borderRadius||"8px",boxShadow:"spread"===y?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===y?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:g?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:y?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onMouseEnter:()=>u(e.id),onMouseLeave:()=>u(null)},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:i?0:1,transform:i?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:e.images[1]||e.images[0],style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:i?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"10px",fontSize:"12px",zIndex:2},onChange:t=>((e,t)=>{const n=e.variants.find((e=>e.id===parseInt(t)));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())})(e,t.target.value),defaultValue:o.id},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("a",{href:"#",style:{textDecoration:"none",color:"inherit"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:g?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title)),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:g?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0}},"₹",(o.price/100).toFixed(0)),o.compare_at_price&&o.compare_at_price>o.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0}},"₹",(o.compare_at_price/100).toFixed(0)))),t.createElement("button",{className:"yt-collection-bundle-add-btn "+(a?"yt-collection-bundle-add-btn-added":""),style:{background:a?"#28a745":B(0,l)?y?.atcBg||"#007bff":"#ccc",color:y?.atcText||"#fff",border:"none",padding:g?"6px":"12px",fontSize:g?"12px":"14px",fontWeight:600,cursor:o.available?"pointer":"not-allowed",transition:"all 0.2s",opacity:o.available?1:.6},onClick:()=>o.available&&((e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());s((n=>{const a=`${e.id}-${r}-${t}`,i=n.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a));return i?n.filter((e=>e!==i)):[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]}))})(e,l),disabled:!o.available},a?"Added":o.available?"ADD TO BOX":"Out of Stock"))}))))})),t.createElement("div",{className:"yt-collection-bundle-bar",style:{background:y?.bundleBg||"#fff",color:y?.bundleText||"#333",border:y?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"600px",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:y?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",background:"#fff",position:"relative",borderRadius:y?.borderRadius||"8px"}},d.length>0?t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",margin:"0 0 0 20px",scrollbarWidth:"none"}},O.filter((({count:e})=>e>0)).map((({items:e},n,r)=>t.createElement(t.Fragment,{key:n},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map(((e,r)=>{const o=b.flatMap((e=>e.products)).find((t=>t.id.toString()===e.productId));if(!o)return null;const l=(e=>{for(let t=0;t<b.length;t++)if(b[t].products.some((t=>t.id.toString()===e)))return t+1;return w})(e.productId),c=a===l;return t.createElement("div",{key:r,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"65px",height:"65px",borderRadius:`calc(${y?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:c?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!c&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!c&&i(l)},t.createElement("img",{src:o.images[0],style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${y?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600}},"x",e.quantity),t.createElement("button",{style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},onClick:t=>{var r,o,a;t.stopPropagation(),r=e.productId,o=e.variantId,a=n,s((e=>e.filter((e=>!(e.productId===r&&e.variantId===o&&e.tierIndex===a)))))}},"x")))})))),n<r.length-1&&r[n+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px"}},t.createElement(lt,null)))))):t.createElement("div",{className:"yt-collection-bundle-items-ctx",style:{textAlign:"center",fontSize:"16px",color:"#555",zIndex:1,padding:"6px 60px",width:"100%"}},N)),g?t.createElement("div",{style:{display:"flex",flexDirection:"column",padding:"4px",gap:"10px"}},t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},C," Gifts Selected"),C>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",E.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",k.toLocaleString()))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",borderRadius:y?.borderRadius||"8px"},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>u(-1),onMouseLeave:()=>u(null)},"Back"),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(a===w&&0===C?"yt-collection-bundle-next-btn-disabled":""),style:{background:y?.btnPrimaryBg||"#28a745",color:y?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:a===w&&0===C?.6:1,borderRadius:y?.borderRadius||"8px"},onClick:a===w?D:()=>T(a+1),disabled:a===w&&0===C,onMouseEnter:()=>u(-2),onMouseLeave:()=>u(null)},n?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(_x,null)):a===w?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:y?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===p&&{filter:"brightness(60%)"}},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>u(-1),onMouseLeave:()=>u(null)},"Back"),t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},C," Gifts Selected"),C>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",E.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",k.toLocaleString()))),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(a===w&&0===C?"yt-collection-bundle-next-btn-disabled":""),style:{background:y?.btnPrimaryBg||"#28a745",color:y?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:a===w&&0===C?.6:1,...-2===p&&{filter:"brightness(90%)"}},onClick:a===w?D:()=>T(a+1),disabled:a===w&&0===C||n,onMouseEnter:()=>u(-2),onMouseLeave:()=>u(null)},n?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(_x,null)):a===w?"Checkout":"Next"))))},Ix=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(_x,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{margin:"12px 0"}},t.createElement("img",{src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},_x=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite"}})),Nx=window?.Shopify?.currency||{rate:1,active:"INR"},Ox=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Nx.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Px=(e,t)=>t==Nx.active?e:sn(Nx.active)||Nx.active,Ax=(e,t,n,r,o)=>{const a=r.findIndex((t=>t.variantId===e));o(0===n?e=>e.filter(((e,t)=>t!==a)):-1===a?r=>[...r,{product:t,variantId:e,quantity:n}]:e=>e.map(((e,t)=>t===a?{...e,quantity:e.quantity+n}:e)))},Fx=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(nf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(of,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(gg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(Dx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Af,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(zx,{addToCartFunction:r,bundle:e});L(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Mx=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},"‎"),t.createElement("div",{className:"side back"},"‎"),t.createElement("div",{className:"side left"},"‎"),t.createElement("div",{className:"side right"},"‎"),t.createElement("div",{className:"side bottom"},"‎"),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},"‎"),t.createElement("div",{className:"flap south"},"‎"),t.createElement("div",{className:"flap east"},"‎"),t.createElement("div",{className:"flap west"},"‎")))));export{Fx as Bundle,Mx as BundleLoader,du as Cart,oa as CouponFrame,qe as Nudge,Je as SpinnerWheel};
4936
+ `,Tx=({productsWithIndices:e,isOpen:n,onClose:r,cta:o,variantOptions:a,onVariantChange:i,handleAddToCart:d,primaryProductId:s,variantId:p})=>{const[u,m]=c((()=>{const t={};return e?.forEach((({product:e,index:n})=>{let r=e?.productDetails?.options?.map((e=>e.values[0]??""));if(e.productId===s&&p){const t=e?.productDetails?.variants?.edges.find((e=>e?.node?.id?.includes(p)))?.node;t&&(r=t.title.split(" / "))}t[n]=r})),t}));l((()=>{if(!s||!p)return;const t=e?.find((({product:e})=>e?.productId===s));if(!t)return;const{product:n,index:r}=t,o=n?.productDetails?.variants?.edges?.find((e=>e.node.id.includes(p)))?.node;if(o){const e=o.title.split(" / ");m((t=>({...t,[r]:e}))),g((e=>({...e,[r]:{node:o}}))),i(r,o.id)}}),[p,s,e,i]);const[f,g]=c({}),x=(t,n,r)=>{const o={...u};o[t][r]=n,m(o);const{product:a}=e?.find((e=>e.index===t))||{product:{productDetails:{variants:{edges:[]}}}};if(!a?.productDetails)return;const l=a?.productDetails?.variants?.edges?.find((e=>e.node.title===o[t].join(" / ")))?.node;l&&(i(t,l.id),g((e=>({...e,[t]:{node:l}}))))};if(!n)return null;const h=t.createElement(sx,{className:"yt-fixedBundle-variant-modal_overlay",onClick:r},t.createElement(px,{className:"yt-fixedBundle-variant-modal_container",onClick:e=>e.stopPropagation()},t.createElement(ux,{className:"yt-fixedBundle-variant-modal_header",style:{backgroundColor:o.backgroundColor,color:o.textColor}},"Select Options"),e?.map((({product:n,index:r},o)=>t.createElement(t.Fragment,null,t.createElement(fx,{className:"yt-fixedBundle-variant-modal_product-block"},t.createElement(gx,{className:"yt-fixedBundle-variant-modal_thumbnail",src:f[r]?.node?.image?.url||n.productDetails.featuredMedia?.preview?.image?.url,alt:n.productDetails.title}),t.createElement(xx,{className:"yt-fixedBundle-variant-modal_product-info"},t.createElement(hx,{className:"yt-fixedBundle-variant-modal_product-name"},n.productDetails.title,n.productDetails.variants.edges.length>1&&t.createElement(bx,{className:"yt-fixedBundle-variant-modal_selected-value"},u[r].join(" / "))),n.productDetails.options.map(((e,n)=>{const o=a&&a?.options?.find((t=>t.name===e.name));return e.values.length<=1?t.createElement(t.Fragment,null):o&&"color"===o?.type?t.createElement(vx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(kx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o.values.find((t=>t.name===e))?.value?t.createElement(wx,{className:"yt-fixedBundle-variant-modal_color-swatch",key:a,color:o.values.find((t=>t.name===e))?.value||e,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},t.createElement("span",null)):t.createElement(Cx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):o&&"image"===o?.type?t.createElement(vx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(kx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,a)=>t.createElement(t.Fragment,null,o?.values.find((t=>t.name===e))?.value?t.createElement(Ex,{className:"yt-fixedBundle-variant-modal_image-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)},src:o.values.find((t=>t.name===e))?.value},t.createElement("span",null)):t.createElement(Cx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:a,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))):t.createElement(vx,{className:"yt-fixedBundle-variant-modal_options-row"},t.createElement(kx,{className:"yt-fixedBundle-variant-modal_option-name"},e.name," :"," "),e.values.map(((e,o)=>t.createElement(Cx,{className:"yt-fixedBundle-variant-modal_text-swatch",key:o,selected:u[r][n]==e,onClick:()=>{x(r,e,n)}},e))))})))),o<e.length-1&&t.createElement(yx,{className:"yt-fixedBundle-variant-modal_divider"})))),t.createElement(mx,{className:"yt-fixedBundle-variant-modal_confirm-button",style:{backgroundColor:o.backgroundColor,color:o.textColor},onClick:d},"Add bundle to cart")));return v.createPortal(h,document.body)},Sx=({options:e,selectedValue:n,onChange:r,type:a="text"})=>{const[i,d]=c(!1),s=o(null);l((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);const p=e=>"color"===a?t.createElement(tx,{className:"yt-fixedBundle-variant-dropdown-horizontal_color-swatch",$color:e.value},t.createElement("span",null)):"image"===a?t.createElement(nx,{className:"yt-fixedBundle-variant-dropdown-horizontal_image-swatch",src:e.value||"/placeholder.svg",alt:e.name},t.createElement("span",null)):null;return t.createElement(Gg,{className:"yt-fixedBundle-variant-dropdown-horizontal_container",ref:s},t.createElement(Yg,{className:"yt-fixedBundle-variant-dropdown-horizontal_header",onClick:()=>d(!i)},t.createElement(Zg,{className:"yt-fixedBundle-variant-dropdown-horizontal_content"},n&&("color"===a||"image"===a)&&p(n),t.createElement("span",{className:"yt-fixedBundle-variant-dropdown-horizontal_selected-text"},n&&n.name)),t.createElement(Kg,{className:"yt-fixedBundle-variant-dropdown-horizontal_chevron-icon",$isOpen:i})),i&&t.createElement(Xg,{className:"yt-fixedBundle-variant-dropdown-horizontal_list"},e?.map((e=>t.createElement(Jg,{className:"yt-fixedBundle-variant-selector_dropdown-item "+(n?.name===e.name?"yt-fixedBundle-variant-selector_dropdown-item--selected":""),key:e.name,$isSelected:n?.name===e.name,onClick:()=>{r(e),d(!1)}},("color"===a||"image"===a)&&p(e),t.createElement(ex,{className:"yt-fixedBundle-variant-dropdown-horizontal_item-text"},e.name))))))},$x=({product:e,variantOptions:n,selectedVariants:r,onVariantChange:o,variantId:a,primaryProductId:i,variantType:d="dropdown"})=>{const[s,p]=c(r||[]);l((()=>{if(a&&e.variants.edges.some((e=>e.node.id.includes(a)))){const t=e.variants.edges.find((e=>e.node.id.includes(a)))?.node;if(t){const e=t.title.split(" / ");p(e)}}}),[a,e]);const u=e=>{if(!n?.options)return"text";const t=n.options.find((t=>t.name===e));return t?.type||"text"},m=(e,t)=>{if(!n?.options)return e.values.map((e=>({name:e,value:e})));const r=n.options.find((t=>t.name===e.name));return e.values.map((e=>{const t=r?.values?.find((t=>t.name===e));return{name:e,value:t?.value||e}}))},f=(e,t)=>{const n=s[t];if(!n)return null;return m(e).find((e=>e.name===n))||null};return t.createElement(rx,{className:"yt-fixedBundle-variant-selector-horizontal_container"},e.options.map(((n,r)=>t.createElement(ox,{className:"yt-fixedBundle-variant-selector-horizontal_option-row",key:n.name,$isFirst:0===r},n?.values?.length>1&&t.createElement(Sx,{options:m(n),selectedValue:f(n,r),onChange:t=>{console.log(t),((t,n)=>{const r=[...s];r[t]=n.name,p(r);const a=e.variants.edges.find((n=>n.node.title===(e.options?.length>0?r.join(" / "):r[t])))?.node.id;o(a||"")})(r,t)},type:u(n.name)})))))},Bx=({product:e,selectedVariantId:n,isChecked:r,canCustomize:o,styles:a,onVariantChange:i,onCheckChange:d,isMobile:s,isHorizontal:p,index:u,variantOptions:m,productsLength:f,handleOpenModal:g,storeCurrencyCode:x,primaryProductId:h,variantId:y})=>{const[b,v]=c(e?.variants?.edges.find((e=>e?.node?.id===n))?.node),[w]=c(e?.options?.map((e=>e?.values?.[0]))||[]),C=e?.id===h;l((()=>{if(y&&e.id===h){const t=e?.variants?.edges?.find((e=>e?.node?.id?.includes(y)))?.node;t&&(v(t),i(t.id))}else{const t=e?.variants?.edges?.find((e=>e?.node?.id===n))?.node;v(t)}}),[e,h,n,y,i]);const E="undefined"!=typeof window&&"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain||"usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain,k=b?.image?.url||e.featuredMedia?.preview?.image?.url;return t.createElement(t.Fragment,null,p?t.createElement("div",{className:""+(e.id===h?"yt-fixedBundle-product-card--horizontal-primary":"yt-fixedBundle-product-card--horizontal-associated"),style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:a.fixedBundle?.cardBackgroundColor}},o&&t.createElement(cx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--horizontal"},t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-hidden",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(lx,{className:"yt-fixedBundle-product-card_checkbox-label",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,null))),t.createElement(vg,{className:"yt-fixedBundle-product-card-horizontal_item",style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}80`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`8px 8px 8px -6px ${a.fixedBundle.borderColor}`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}80`}[a.fixedBundle.shadowType]||"none"},canCustomize:o},"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(wg,{className:"yt-fixedBundle-product-card-horizontal_image",src:k,alt:e.title,style:{borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,aspectRatio:a.general.imageAspectRatio||"1/1",borderTopRightRadius:"0",borderBottomRightRadius:"0"}}),t.createElement(Cg,{className:"yt-fixedBundle-product-card-horizontal_details"},t.createElement(Eg,{className:"yt-fixedBundle-product-card-horizontal_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(kg,{className:"yt-fixedBundle-product-card-horizontal_price-section"},t.createElement(Tg,{className:"yt-fixedBundle-product-card-horizontal_price--new"},Px(a.general.currencySymbol,x)," ",Ox(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Sg,{className:"yt-fixedBundle-product-card-horizontal_price--old"},Px(a.general.currencySymbol,x),Ox(b?.compareAtPrice))),t.createElement($x,{product:e,variantOptions:m,selectedVariants:w,onVariantChange:e=>{i(e)},variantId:y,primaryProductId:h})))):t.createElement(t.Fragment,null,t.createElement(Pg,{className:""+(e.id===h?"yt-fixedBundle-product-card--vertical-primary":"yt-fixedBundle-product-card--vertical-associated"),productsLength:f,style:{borderRadius:a.fixedBundle?.borderRadius,border:`1px solid ${a.fixedBundle?.borderColor}50`,backgroundColor:a.fixedBundle?.cardBackgroundColor,boxShadow:{none:"none",spread:`0 4px 10px -6px ${a.fixedBundle.borderColor}50`,"no-spread":`4px 4px 0px -1px ${a.fixedBundle.borderColor}50`}[a.fixedBundle.shadowType]||"none",...o&&{position:"relative"},...E&&{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",minWidth:"max-content",paddingLeft:"2px"}},borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.fixedBundle?.cardBackgroundColor},o&&t.createElement(dx,{className:"yt-fixedBundle-product-card_checkbox-wrapper--vertical",isImage:E},t.createElement(ix,{className:"yt-fixedBundle-product-card_checkbox-hidden--vertical",style:{display:"none"},type:"checkbox",id:`checkbox-${e.id}-${u}`,defaultChecked:r,onChange:e=>d(e.target.checked),disabled:C}),t.createElement(lx,{className:"yt-fixedBundle-product-card_checkbox-label--vertical",htmlFor:`checkbox-${e.id}-${u}`,isChecked:r,borderRadius:a.fixedBundle?.borderRadius,borderColor:a.fixedBundle?.borderColor,backgroundColor:a.general?.ctaBackgroundColor},t.createElement(rt,{size:10}))),"undefined"!=typeof window&&"devansh-test123.myshopify.com"!==window.ytBundleApp?.storeDomain&&"usee-shop-app.myshopify.com"!==window.ytBundleApp?.storeDomain&&t.createElement(Ag,{className:"yt-fixedBundle-product-card_image-wrapper--vertical",style:{aspectRatio:a.general.imageAspectRatio,height:"fit-content"}},t.createElement(Fg,{className:"yt-fixedBundle-product-card_image--vertical",src:k,style:{aspectRatio:a.general.imageAspectRatio},alt:e.title}),e.variants.edges.length>1&&t.createElement(Mg,{className:"yt-fixedBundle-product-card_badge-container"},t.createElement(Rg,{className:"yt-fixedBundle-product-card_circle-button"},t.createElement("span",null)),t.createElement(Lg,{className:"yt-fixedBundle-product-card_circle-button-two"},t.createElement("span",null)),t.createElement(jg,{className:"yt-fixedBundle-product-card_count-badge"},e.variants.edges.length,"+"))),t.createElement(Vg,{className:"yt-fixedBundle-product-card-vertical_info"},t.createElement(Wg,{className:"yt-fixedBundle-product-card-vertical_title"},e.title),a.fixedBundle.productsPriceVisibility&&t.createElement(Ug,{className:"yt-fixedBundle-product-card-vertical_price-line"},t.createElement(Hg,{className:"yt-fixedBundle-product-card-vertical_price--new"},Px(a.general.currencySymbol,x),Ox(b?.price)),a.fixedBundle.compareAtPriceVisibility&&b?.compareAtPrice&&parseFloat(b.compareAtPrice)>parseFloat(b?.price)&&t.createElement(Sg,{className:"yt-fixedBundle-product-card-vertical_price--old"},Px(a.general.currencySymbol,x),Ox(b?.compareAtPrice))))),(f<=3||!s)&&u<f-1&&t.createElement(qg,{className:"yt-fixedBundle-plus-wrapper"}," ",t.createElement(Qg,{className:"yt-fixedBundle-plus-icon"},"+")," ")))},zx=({bundle:e,addToCartFunction:n})=>{const[r,o]=c(!1),[d,s]=c(window.innerWidth<786),[p,u]=c(null),[m,f]=c(!1),g="undefined"!=typeof window?window.location.href:null,x=e?.products?.find((e=>e.productDetails?.handle===g?.split("/").pop()?.split("?")[0])),h=x?.productId,[y,b]=c(Object.fromEntries(e?.products?.map(((e,t)=>[t.toString(),e?.productDetails?.variants?.edges?.find((e=>e?.node?.inventoryQuantity>0))?.node?.id||e.productDetails?.variants?.edges?.[0]?.node?.id])))),v="undefined"!=typeof window&&("usee-shop-app.myshopify.com"===window.ytBundleApp?.storeDomain||"devansh-test123.myshopify.com"===window.ytBundleApp?.storeDomain),w=e?.showIndividualProductSelector||!0,[C,E]=c(new Set(e.products.reduce(((e,t,n)=>(v&&t?.productId!==h&&!w||e.push(n),e)),[])));l((()=>{const e=()=>{const e=new URL(window.location.href).searchParams.get("variant");u(e)},t=e=>{const t=history[e];return function(...n){const r=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),r}};return history.pushState=t("pushState"),history.replaceState=t("replaceState"),window.addEventListener("pushstate",e),window.addEventListener("replacestate",e),e(),()=>{window.removeEventListener("pushstate",e),window.removeEventListener("replacestate",e)}}),[]),l((()=>{p&&h&&b((t=>{const n={...t};return e?.products?.forEach(((e,t)=>{e.productId===h&&(n[t.toString()]=p)})),n}))}),[p,h,e?.products]),l((()=>{const e=()=>{s(window.innerWidth<600)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const k=a(((e,t)=>{b((n=>({...n,[e.toString()]:t})))}),[]),T=(t,n)=>{const r=e.products[n].productId;v&&w&&r===h||E((e=>{const r=new Set(e);return t?r.add(n):r.delete(n),r}))},S=e.disableInventoryTracking||e.products.every((e=>e.productDetails.variants.edges.some((e=>e.node.inventoryQuantity>0)))),$=i((()=>e.products.some(((e,t)=>C.has(t)&&e.productDetails.variants.edges.length>1))),[e.products,C]),{originalPrice:B,dealPrice:z,offerValue:D}=i((()=>{const{price:t,compareAtPrice:n}=e.products.reduce(((e,t,n)=>{if(!C.has(n))return e;const r=y[n.toString()];if(!r)return e;const o=t.productDetails.variants.edges?.find((e=>e.node.id===r))?.node;if(!o)return e;const a=parseFloat(o?.price??"0"),i=parseFloat(o?.compareAtPrice||a.toString());return e.price+=a,e.compareAtPrice+=i,e}),{price:0,compareAtPrice:0}),r=Math.max(t,n);let o=Math.min(t,n);C.size===e.products.length&&(e?.percentageOff?o=t*(1-e.percentageOff/100):e?.dealAmount?o=e.dealAmount:e?.amountOff&&(o=t-e.amountOff));const a=n-o;return{originalPrice:r.toFixed(2),dealPrice:o.toFixed(2),offerValue:a.toFixed(2)}}),[e.products,y,C,e.percentageOff,e.dealAmount,e.amountOff]),I=async e=>{e.preventDefault(),e.stopPropagation(),o(!0),f(!1);try{const e=Object.entries(y).map((([e,t])=>{const n=parseInt(e);return isNaN(n)||!C.has(n)?null:t})).filter(Boolean);n&&await n(Number(B),e)}catch(e){console.error("Error adding to cart:",e)}o(!1)},_=i((()=>e.products.map(((e,t)=>({product:e,index:t}))).filter((({index:e})=>C.has(e)))),[e.products,C]);if(!n)return t.createElement(t.Fragment,null);if(e?.customizations.general?.trackInventory&&!S)return t.createElement(t.Fragment,null);const N=e.customizations,O=N.fixedBundle?.cardLayoutStyle||"auto",P="horizontal"===O||"auto"===O&&d,A="bundles"==e.appName?e.pageHeader?.title:e?.title,F="bundles"==e.appName?e.pageHeader?.description:e?.subtitle;return t.createElement(xg,{id:"yt-fixedBundle-container",className:"yt-fixedBundle-container",style:{maxWidth:"800px",backgroundColor:N.fixedBundle.sectionBackgroundColor,..."transparent"!==N.fixedBundle.sectionBackgroundColor&&{padding:"20px"}}},A&&t.createElement(hg,{id:"yt-fixedBundle-header",className:"yt-fixedBundle-header",style:{backgroundColor:N.fixedBundle?.titleBackgroundColor||"none",color:N.fixedBundle?.titleTextColor||"black",textAlign:N.fixedBundle.infoAlignment??"center",fontSize:N.fixedBundle?.titleFontSize,..."transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingBlock:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},A),F&&t.createElement(yg,{id:"yt-fixedBundle-subheader",className:"yt-fixedBundle-subheader",style:{color:"#121212",fontSize:N.fixedBundle?.subtitleFontSize,textAlign:N.fixedBundle.infoAlignment??"center",..."left"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingLeft:"7px"},..."right"===N.fixedBundle.infoAlignment&&"transparent"!==N.fixedBundle.titleBackgroundColor&&{paddingRight:"7px"},..."left"===N.fixedBundle.infoAlignment&&"transparent"===N.fixedBundle.titleBackgroundColor&&{paddingLeft:"0px"}}},F),P?t.createElement(bg,{id:"yt-fixedBundle-horizontal-container",className:"yt-fixedBundle-horizontal-container"},e?.products?.map(((n,r)=>t.createElement(t.Fragment,{key:`${n.productId}-${r}`},t.createElement(Bx,{isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>{T(e,r)},isMobile:d,index:r,isHorizontal:P,variantOptions:e.variantOptions,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))))):t.createElement(Ng,{id:"yt-fixedBundle-vertical-container",className:"yt-fixedBundle-vertical-container"},t.createElement(Og,{id:"yt-fixedBundle-product-list",className:"yt-fixedBundle-product-list",style:{justifyContent:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},e?.products?.map(((n,r)=>t.createElement(Bx,{key:`${n.productId}-${r}`,isChecked:C.has(r),product:n.productDetails,selectedVariantId:y[r.toString()]||"",canCustomize:e?.canCustomizeFixedBundle||!1,styles:N,onVariantChange:e=>k(r,e),onCheckChange:e=>T(e,r),isMobile:d,index:r,isHorizontal:P,productsLength:e.products.length,storeCurrencyCode:e.storeCurrencyCode,primaryProductId:h,variantId:p||void 0}))),$&&t.createElement(Tx,{productsWithIndices:_,isOpen:m,onClose:()=>f(!1),variantOptions:e.variantOptions,cta:{textColor:N.general.ctaTextColor,backgroundColor:N.general.ctaBackgroundColor},onVariantChange:k,handleAddToCart:I,primaryProductId:h,variantId:p||void 0}))),t.createElement($g,{id:"yt-fixedBundle-summary",className:"yt-fixedBundle-summary",style:{alignItems:"left"===N.fixedBundle.infoAlignment?"flex-start":"right"===N.fixedBundle.infoAlignment?"flex-end":"center"}},Number(B)>0&&Number(D)>0&&N.fixedBundle.compareAtPriceVisibility&&t.createElement(Bg,{className:"yt-fixedBundle-summary_original-price"},"Original Price:"," ",t.createElement(Dg,{className:"yt-fixedBundle-summary_price"},Px(N.general.currencySymbol,e?.storeCurrencyCode),Ox(B))),0!==C.size&&t.createElement(zg,{className:"yt-fixedBundle-summary_total-price"},"Total Price:"," ",t.createElement(Dg,{className:"yt-fixedBundle-summary_price"},Px(N.general.currencySymbol,e?.storeCurrencyCode),Ox(z))," ",Number(D)>0&&t.createElement(Ig,{className:"yt-fixedBundle-summary_save-tag"},"Save:"," ",Px(N.general.currencySymbol,e?.storeCurrencyCode),Ox(D)))),t.createElement(_g,{id:"yt-fixedBundle-add-to-cart",className:"yt-fixedBundle-add-to-cart",onClick:e=>{e.preventDefault(),e.stopPropagation(),P||!$?I(e):f(!0)},disabled:C.size<1||r,style:{backgroundColor:N.general?.ctaBackgroundColor||"#121212",color:N.general?.ctaTextColor||"#FFFFFF",border:`1px solid ${N.general?.ctaBackgroundColor||"#121212"}`,boxShadow:N.general.ctaShadowType,paddingTop:N.general?.ctaPadding,paddingBottom:N.general?.ctaPadding,borderRadius:N.general.ctaBorderRadius,width:N.general.ctaWidth||"100%",textAlign:"center"},onMouseOver:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaHoverBackgroundColor||"#F1F1F1",e.currentTarget.style.color=N.general?.ctaHoverTextColor||"#121212")},onMouseOut:e=>{N.general.customizeHoverState&&(e.currentTarget.style.backgroundColor=N.general?.ctaBackgroundColor||"#121212",e.currentTarget.style.color=N.general?.ctaTextColor||"#FFFFFF")}},r?t.createElement(qo,{color:"white",loading:r,size:15,"aria-label":"Loading Spinner","data-testid":"loader"}):t.createElement(t.Fragment,null,N.fixedBundle?.ctaTitle??"Add Bundle to cart")))},Dx=({config:e,bundleAddToCartLoading:n,addCustomBundleToCart:r})=>{const[a,i]=c(1),[d,s]=c([]),[p,u]=c(null),[m,f]=c({}),[g,x]=c(window.innerWidth<640),h=o(new Map);l((()=>{const e=()=>x(window.innerWidth<640);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[]);const{customizations:y}=e,b=e.config.builderTiers.collectionTier.sort(((e,t)=>e.tier-t.tier)),v=b.length+1,w=v,C=d.reduce(((e,t)=>e+t.quantity),0),E=d.reduce(((e,t)=>e+t.price*t.quantity),0)/100,k=d.reduce(((e,t)=>{const n=b.flatMap((e=>e.products)).find((e=>e.id.toString()===t.productId)),r=n?.variants.find((e=>e.id.toString()===t.variantId));return e+(r?.compare_at_price??t.price)*t.quantity}),0)/100,T=e=>{if(e>1&&!d.length)return alert("Add at least one product first");i(e),window.scrollTo(0,0)},S=b.map(((e,t)=>d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>e+t.quantity),0))),$=e=>{const t=b[e];return t.minimumQuantity>0?t.minimumQuantity:1/0},B=(e,t)=>{const n=S[t],r=$(t);return r===1/0||n<r},z=e=>{if(!h.current.has(e)){const t=document.createElement("input");t.type="file",t.accept="image/jpeg,image/png",t.style.display="none",t.onchange=async t=>{const n=t.target.files?.[0];if(n){if(n.size>5242880)return alert("Max 5MB");if(!n.type.match(/^image\/(jpeg|png)$/i))return alert("JPEG/PNG only");f((t=>({...t,[e]:{loading:!0,name:n.name}})));try{const t=await(async e=>{const t=new FormData;t.append("file",e);try{const e=window?.Shopify?.shop||"falah-devstore.myshopify.com",n=window?.Shopify?.shop?"https://products.yourtoken.io":"http://localhost:8000",r=await fetch(`${n}/shopify/upload?shop=${e}`,{method:"POST",headers:{"x-yourtoken-app-name":"bundles"},body:t});if(!r.ok)throw new Error("Upload failed");return(await r.json()).url}catch(e){throw alert("Upload failed. Try again."),e}})(n);f((r=>({...r,[e]:{url:t,name:n.name}})))}catch{f((t=>({...t,[e]:{error:!0,name:n.name}})))}}},document.body.appendChild(t),h.current.set(e,t)}return h.current.get(e)},D=async()=>{if(a!==w||!d.length)return;const e={};Object.entries(m).forEach((([t,n])=>{const r=t.split("|").pop()?.replace(/^f_\d+$/,"")||t;"string"==typeof n&&n.trim()?e[r]=n:n&&"object"==typeof n&&"url"in n&&(e[r]=n.url)}));const t=d.map((t=>({variantId:t.variantId,quantity:t.quantity,properties:e})));r(t)},I=a<=b.length?b[a-1]:null,_=I?$(a-1):0,N=_===1/0?`Add items from ${I?.title}`:`Add up to ${_} item${_>1?"s":""} from ${I?.title}`,O=b.map(((e,t)=>{const n=d.filter((e=>e.tierIndex===t)).reduce(((e,t)=>{const n=`${t.productId}-${t.variantId}`,r=e.find((e=>`${e.productId}-${e.variantId}`===n));return r?r.quantity+=t.quantity:e.push({...t,quantity:t.quantity}),e}),[]);return{tier:e,items:n,count:S[t]}}));return t.createElement("div",{className:"yt-collection-bundle-builder",style:{margin:"20px auto",maxWidth:"1400px"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav-container",style:{display:"flex",justifyContent:"center",flexDirection:"column",gap:g?"0":"1rem",overflowX:"auto",scrollbarWidth:"none",borderBottom:"1px solid #878787",marginInline:g?"0":"2%",paddingBottom:"1rem",textAlign:"center"}},t.createElement("div",{className:"yt-collection-bundle-steps-nav",style:{display:"flex",justifyContent:"center",gap:g?"0":"2rem",overflowX:"auto",scrollbarWidth:"none"}},Array.from({length:v},((e,t)=>t+1)).map((e=>t.createElement("div",{key:e,className:"yt-collection-bundle-step-item "+(a===e?"yt-collection-bundle-step-item-active":""),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.5rem",minWidth:"120px",cursor:"pointer",opacity:a===e?1:.5,transition:"opacity 0.2s"},onClick:()=>T(e)},t.createElement("div",{className:"yt-collection-bundle-step-icon "+(a===e?"yt-collection-bundle-step-icon-active":""),style:{width:"40px",height:"40px",background:a===e?y?.stepActiveBg||"#000":"#fff",border:"2px solid #ccc",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"}},e===w?t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:a===e?"#fff":"#999"}},t.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.67C10.96 2.54 10.05 2 9 2c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1h-2c-.55 0-1-.45-1-1s.45-1 1-1h2zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1H7c-.55 0-1-.45-1-1s.45-1 1-1h2zM20 19H4V8h16v11z"})):t.createElement("svg",{viewBox:"0 0 24 24",style:{width:"20px",height:"20px",fill:a===e?"#fff":"#999"}},t.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}))),t.createElement("div",{className:"yt-collection-bundle-step-label",style:{fontSize:"14px",textAlign:"center",color:"#333",fontWeight:"600"}},(e=>e===w?"Customize Gift Details":b[e-1]?.title||`Step ${e}`)(e)))))),e.config.form.title&&t.createElement("p",{className:"yt-collection-bundle-steps-nav-description",style:{fontSize:g?"14px":"16px",marginBottom:g?"0":"14px",fontWeight:"400",color:"#000"}},e.config.form.title)),Array.from({length:v},((e,t)=>t+1)).map((n=>{const r=n===w,o=r?[]:(e=>b[e-1]?.products||[])(n),i=o.filter((e=>e.available)),l=n-1;return t.createElement("div",{key:n,className:"yt-collection-bundle-step-content "+(a===n?"yt-collection-bundle-step-content-active":""),style:{display:a===n?"block":"none",padding:"1.5rem 0",minHeight:"40vh"}},r&&e.config.form?t.createElement("div",{className:"yt-collection-bundle-customize-form",style:{maxWidth:"80%",margin:"0 auto",padding:"1rem",marginBottom:"100px"}},e.config.form.sections.map(((e,n)=>{const r=`sec_${n}`;return t.createElement("div",{key:r,className:"yt-collection-bundle-form-group",style:{marginBottom:"32px"}},t.createElement("label",{className:"yt-collection-bundle-label",style:{display:"block",fontWeight:600,marginBottom:"12px",color:"#333",fontSize:"16px"}},e.title),"text"===e.type&&t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n;return t.createElement("textarea",{key:r,className:"yt-collection-bundle-textarea",placeholder:e.title,rows:3,maxLength:500,onChange:e=>f((t=>({...t,[r]:e.target.value}))),style:{padding:"12px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",resize:"vertical"}})}))),"image"===e.type&&t.createElement("div",{style:{marginBottom:"24px"}},t.createElement("sub",{style:{display:"block",color:"#666",fontSize:"12px",marginBottom:"8px"}},"jpeg/png (max 5MB)"),t.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e.fields.map(((e,n)=>{const r=e.title??"Field "+n,o=m[r];return t.createElement(Ix,{key:r,title:e.title,uploadState:o,onUpload:()=>z(r).click(),onRemove:()=>f((e=>{const{[r]:t,...n}=e;return n})),onRetry:()=>z(r).click()})})))))}))):t.createElement("div",{className:"yt-collection-bundle-product-grid",style:{display:g?"grid":"flex",gridTemplateColumns:g?"repeat(2,1fr)":"",flexWrap:g?"unset":"wrap",justifyContent:"center",gap:"16px",padding:"16px",marginBottom:"100px"}},i.map((e=>{const n=document.querySelector(`[data-product-id="${e.id}"]`),r=n?.dataset.selectedVariant||e.variants[0].id.toString(),o=e.variants.find((e=>e.id.toString()===r))||e.variants[0],a=d.some((t=>t.productId===e.id.toString()&&t.variantId===r&&t.tierIndex===l)),i=p===e.id;return t.createElement("div",{key:e.id,className:"yt-collection-bundle-product-item","data-product-id":e.id,"data-selected-variant":o.id,"data-current-price":o.price,style:{display:"flex",flexDirection:"column",border:y?.productCardBorder||"1px solid #ddd",background:y?.productCardBg||"#fff",overflow:"hidden",transition:"all 0.2s ease",minWidth:g?0:"250px",maxWidth:g?"none":"250px",borderRadius:y?.borderRadius||"8px",boxShadow:"spread"===y?.productCardShadow?"8px 8px 8px -6px #0000004D":"no-spread"===y?.productCardShadow?"6px 6px 0px -1px #00000033":"none",width:g?"100%":""}},t.createElement("div",{className:"yt-collection-bundle-product-image",style:{position:"relative",width:"100%",aspectRatio:y?.productImageRatio||"1/1",overflow:"hidden",cursor:"pointer",background:"#f9f9f9"},onMouseEnter:()=>u(e.id),onMouseLeave:()=>u(null)},t.createElement("img",{src:e.images[0]||"https://cdn.shopify.com/s/files/1/0750/9937/3789/files/placeholder-thumbnail.png?width=250px",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:i?0:1,transform:i?"scale(1.05)":"scale(1)"},alt:e.title}),t.createElement("img",{src:e.images[1]||e.images[0],style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover",transition:"opacity 0.3s ease, transform 0.3s ease",opacity:i?1:0,transform:"scale(1.05)"},alt:e.title}),e.variants.length>1&&t.createElement("select",{style:{position:"absolute",bottom:"10px",left:"10px",right:"10px",background:"rgba(255,255,255,0.9)",border:"none",borderRadius:"4px",padding:"10px",fontSize:"12px",zIndex:2},onChange:t=>((e,t)=>{const n=e.variants.find((e=>e.id===parseInt(t)));if(!n)return;const r=document.querySelector(`[data-product-id="${e.id}"]`);r&&(r.dataset.selectedVariant=t,r.dataset.currentPrice=n.price.toString())})(e,t.target.value),defaultValue:o.id},e.variants.map((e=>t.createElement("option",{key:e.id,value:e.id,disabled:!e.available},e.title," ",!e.available&&"(Out of stock)"))))),t.createElement("div",{className:"yt-collection-bundle-product-info",style:{padding:"12px",flexGrow:1,display:"flex",flexDirection:"column"}},t.createElement("a",{href:"#",style:{textDecoration:"none",color:"inherit"}},t.createElement("h3",{className:"yt-collection-bundle-product-title",style:{fontSize:g?"12px":"14px",fontWeight:600,margin:"0 0 4px",lineHeight:1.3,color:"#333",flexGrow:1}},e.title)),t.createElement("div",{className:"yt-collection-bundle-product-prices",style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"nowrap",whiteSpace:"nowrap",overflow:"hidden"}},t.createElement("span",{className:"yt-collection-bundle-product-price",style:{fontSize:g?"14px":"16px",fontWeight:"bold",color:"#000",flexShrink:0}},"₹",(o.price/100).toFixed(0)),o.compare_at_price&&o.compare_at_price>o.price&&t.createElement("span",{className:"yt-collection-bundle-product-compare",style:{fontSize:"14px",textDecoration:"line-through",color:"#999",flexShrink:0}},"₹",(o.compare_at_price/100).toFixed(0)))),t.createElement("button",{className:"yt-collection-bundle-add-btn "+(a?"yt-collection-bundle-add-btn-added":""),style:{background:a?"#28a745":B(0,l)?y?.atcBg||"#007bff":"#ccc",color:y?.atcText||"#fff",border:"none",padding:g?"6px":"12px",fontSize:g?"12px":"14px",fontWeight:600,cursor:o.available?"pointer":"not-allowed",transition:"all 0.2s",opacity:o.available?1:.6},onClick:()=>o.available&&((e,t)=>{const n=document.querySelector(`[data-product-id="${e.id}"]`);if(!n)return;const r=n.dataset.selectedVariant||e.variants[0].id.toString(),o=parseInt(n.dataset.currentPrice||e.variants[0].price.toString());s((n=>{const a=`${e.id}-${r}-${t}`,i=n.find((e=>`${e.productId}-${e.variantId}-${e.tierIndex}`===a));return i?n.filter((e=>e!==i)):[...n,{productId:e.id.toString(),variantId:r,price:o,quantity:1,tierIndex:t}]}))})(e,l),disabled:!o.available},a?"Added":o.available?"ADD TO BOX":"Out of Stock"))}))))})),t.createElement("div",{className:"yt-collection-bundle-bar",style:{background:y?.bundleBg||"#fff",color:y?.bundleText||"#333",border:y?.bundleBorder||"1px solid #878787",display:"flex",flexDirection:"column",position:"fixed",bottom:"10px",left:"50%",transform:"translateX(-50%)",width:"600px",maxWidth:"95%",zIndex:899,boxShadow:"0 -2px 10px rgba(0,0,0,0.1)",transition:"bottom 0.3s ease",borderRadius:y?.borderRadius||"8px"}},t.createElement("div",{className:"yt-collection-bundle-bar-top",style:{display:"flex",alignItems:"center",padding:"8px 8px 0",background:"#fff",position:"relative",borderRadius:y?.borderRadius||"8px"}},d.length>0?t.createElement("div",{className:"yt-collection-bundle-images",style:{display:"flex",flex:1,gap:"5px",justifyContent:"center",alignItems:"center",overflowX:"auto",padding:"4px 0",margin:"0 0 0 20px",scrollbarWidth:"none"}},O.filter((({count:e})=>e>0)).map((({items:e},n,r)=>t.createElement(t.Fragment,{key:n},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",minWidth:"fit-content"}},t.createElement("div",{style:{display:"flex",gap:"4px"}},e.map(((e,r)=>{const o=b.flatMap((e=>e.products)).find((t=>t.id.toString()===e.productId));if(!o)return null;const l=(e=>{for(let t=0;t<b.length;t++)if(b[t].products.some((t=>t.id.toString()===e)))return t+1;return w})(e.productId),c=a===l;return t.createElement("div",{key:r,className:"yt-collection-bundle-img-wrapper",style:{position:"relative",flexShrink:0,height:"65px"}},t.createElement("div",{style:{position:"relative",width:"65px",height:"65px",borderRadius:`calc(${y?.borderRadius||"8px"} / 2)`,overflow:"hidden",cursor:c?"default":"pointer",transition:"transform 0.2s ease"},onMouseEnter:e=>!c&&(e.currentTarget.style.transform="scale(1.08)"),onMouseLeave:e=>e.currentTarget.style.transform="scale(1)",onClick:()=>!c&&i(l)},t.createElement("img",{src:o.images[0],style:{width:"65px",height:"65px",objectFit:"cover",borderRadius:`calc(${y?.borderRadius||"8px"} / 2)`,transition:"opacity 0.2s",pointerEvents:"none"},alt:"Selected"}),e.quantity>1&&t.createElement("div",{style:{position:"absolute",bottom:"4px",right:"4px",background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:"10px",padding:"2px 6px",fontSize:"10px",fontWeight:600}},"x",e.quantity),t.createElement("button",{style:{position:"absolute",top:"4px",right:"4px",width:"20px",height:"20px",background:"rgba(220,53,69,0.95)",color:"white",border:"none",borderRadius:"50%",fontSize:"12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"},onClick:t=>{var r,o,a;t.stopPropagation(),r=e.productId,o=e.variantId,a=n,s((e=>e.filter((e=>!(e.productId===r&&e.variantId===o&&e.tierIndex===a)))))}},"x")))})))),n<r.length-1&&r[n+1].count>0&&t.createElement("div",{style:{color:"#666",paddingInline:"6px"}},t.createElement(lt,null)))))):t.createElement("div",{className:"yt-collection-bundle-items-ctx",style:{textAlign:"center",fontSize:"16px",color:"#555",zIndex:1,padding:"6px 60px",width:"100%"}},N)),g?t.createElement("div",{style:{display:"flex",flexDirection:"column",padding:"4px",gap:"10px"}},t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},C," Gifts Selected"),C>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",E.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",k.toLocaleString()))),t.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"4px"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",borderRadius:y?.borderRadius||"8px"},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>u(-1),onMouseLeave:()=>u(null)},"Back"),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(a===w&&0===C?"yt-collection-bundle-next-btn-disabled":""),style:{background:y?.btnPrimaryBg||"#28a745",color:y?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"100%",transition:"background 0.2s",opacity:a===w&&0===C?.6:1,borderRadius:y?.borderRadius||"8px"},onClick:a===w?D:()=>T(a+1),disabled:a===w&&0===C,onMouseEnter:()=>u(-2),onMouseLeave:()=>u(null)},n?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(_x,null)):a===w?"Checkout":"Next"))):t.createElement("div",{className:"yt-collection-bundle-bar-bottom",style:{display:"flex",alignItems:"center",padding:"0px",background:"#dbdbdb",margin:"8px",borderRadius:y?.borderRadius||"8px",overflow:"hidden",scrollbarWidth:"none"}},t.createElement("button",{className:"yt-collection-bundle-back-btn",style:{background:"#000",color:"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",...-1===p&&{filter:"brightness(60%)"}},onClick:()=>i((e=>Math.max(1,e-1))),onMouseEnter:()=>u(-1),onMouseLeave:()=>u(null)},"Back"),t.createElement("div",{style:{flex:1,textAlign:"center",display:"flex",flexDirection:"row",justifyContent:d.length>0?"space-between":"center",paddingInline:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d"}},C," Gifts Selected"),C>0&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement("div",{style:{fontSize:"14px",color:"#6c757d",fontWeight:600}},"₹",E.toLocaleString()),t.createElement("div",{style:{fontSize:"14px",color:"#6c757dc9",fontWeight:500,textDecoration:"line-through"}},"₹",k.toLocaleString()))),t.createElement("button",{className:"yt-collection-bundle-next-btn "+(a===w&&0===C?"yt-collection-bundle-next-btn-disabled":""),style:{background:y?.btnPrimaryBg||"#28a745",color:y?.btnPrimaryText||"#fff",border:"none",padding:"12px 24px",cursor:"pointer",fontWeight:600,width:"138px",transition:"all 0.2s",opacity:a===w&&0===C?.6:1,...-2===p&&{filter:"brightness(90%)"}},onClick:a===w?D:()=>T(a+1),disabled:a===w&&0===C||n,onMouseEnter:()=>u(-2),onMouseLeave:()=>u(null)},n?t.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",justifyContent:"center"}},t.createElement(_x,null)):a===w?"Checkout":"Next"))))},Ix=({title:e,uploadState:n,onUpload:r,onRemove:o,onRetry:a})=>{const i="object"==typeof n&&n?.loading,l="object"==typeof n&&n?.error,c="object"==typeof n&&n?.url;return t.createElement("div",{style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",textAlign:"center",background:"#fafafa"}},t.createElement("div",{style:{fontWeight:500,color:"#333",marginBottom:"4px"}},e),i&&t.createElement(t.Fragment,null,t.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:"#007bff",fontSize:"13px",margin:"12px 0"}},t.createElement(_x,null)," Uploading ",n?.name,"...")),l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#dc3545",fontSize:"13px",margin:"8px 0"}},"Upload failed. Try again."),t.createElement("button",{type:"button",onClick:a,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Retry Upload")),c&&!i&&!l&&t.createElement(t.Fragment,null,t.createElement("div",{style:{margin:"12px 0"}},t.createElement("img",{src:n.url,alt:"Uploaded",style:{maxWidth:"100%",maxHeight:"150px",borderRadius:"6px"}})),t.createElement("div",{style:{fontSize:"12px",color:"#28a745",marginBottom:"8px"}},n.name),t.createElement("button",{type:"button",onClick:o,style:{background:"#dc3545",color:"white",border:"none",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",cursor:"pointer"}},"Remove")),!n&&t.createElement(t.Fragment,null,t.createElement("div",{style:{color:"#888",fontSize:"12px",marginBottom:"12px"}},"jpeg/png (max 5MB)"),t.createElement("button",{type:"button",onClick:r,style:{color:"#303030",fontSize:"12px",borderRadius:"10px",border:"1px solid #E3E3E3",fontWeight:550,padding:"8px 16px",background:"white",cursor:"pointer"}},"Upload")))},_x=()=>t.createElement(t.Fragment,null,t.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg); } }"),t.createElement("div",{style:{width:"14px",height:"14px",border:"2px solid #f3f3f3",borderTop:"2px solid #007bff",borderRadius:"50%",animation:"spin 1s linear infinite",display:"block"}})),Nx=window?.Shopify?.currency||{rate:1,active:"INR"},Ox=e=>{if(!e)return;const t=navigator.language||"en-US",n=Number((Number(e)*Nx.rate).toFixed(2));return new Intl.NumberFormat(t).format(n)},Px=(e,t)=>t==Nx.active?e:sn(Nx.active)||Nx.active,Ax=(e,t,n,r,o)=>{const a=r.findIndex((t=>t.variantId===e));o(0===n?e=>e.filter(((e,t)=>t!==a)):-1===a?r=>[...r,{product:t,variantId:e,quantity:n}]:e=>e.map(((e,t)=>t===a?{...e,quantity:e.quantity+n}:e)))},Fx=({bundle:e,currentProductId:n,addToCartFunction:r,addCustomBundleToCart:o,selectedItems:a,setSelectedItems:i,bundleAddToCartLoading:l,handleRemoveItem:c,selectedItemsQuantity:d,renderingOnPage:s,bundleSubtotal:p})=>"fixed"!==e.type&&e.type&&0!==e?.type?.length?"builder"===e.type?t.createElement(nf,{bundleAddToCartLoading:l,bundle:e,selectedItems:a,setSelectedItems:i,handleAddToCart:o,handleRemoveItem:c,renderingOnPage:s,selectedItemsQuantity:d??0,bundleSubtotal:p??{price:0,compareAtPrice:0}}):"combo"===e.type?t.createElement(of,{bundle:e,addToCartFunction:r}):"mixAndMatch"===e.type?t.createElement(gg,{bundle:e,addToCartFunction:r}):"collection"===e.type?t.createElement(Dx,{config:e,addCustomBundleToCart:o,bundleAddToCartLoading:l}):t.createElement(Af,{bundle:e,currentProductId:n,addToCartFunction:r}):t.createElement(zx,{addToCartFunction:r,bundle:e});L(".scene {\n width: 100%;\n height: 60vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.floating {\n animation: float 3s ease-in-out infinite;\n}\n\n@keyframes float {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n}\n.cube {\n position: relative;\n width: 50px;\n height: 50px;\n transform-style: preserve-3d;\n transform: rotateX(-45deg) rotateY(50deg) rotateZ(0deg);\n}\n\n.side,\n.lid,\n.flap {\n position: absolute;\n width: 100px;\n height: 100px;\n border: 4px solid #333366;\n background: transparent;\n box-sizing: border-box;\n}\n\n.side {\n background: #fff;\n backface-visibility: hidden;\n}\n\n.side.front {\n transform: translateZ(50px);\n}\n\n.side.back {\n transform: rotateY(180deg) translateZ(50px);\n}\n\n.side.left {\n transform: rotateY(-90deg) translateZ(50px);\n}\n\n.side.right {\n transform: rotateY(90deg) translateZ(50px);\n}\n\n.side.bottom {\n transform: rotateX(-90deg) translateZ(50px);\n}\n\n.lid {\n transform: rotateX(90deg) translateZ(50px);\n transform-style: preserve-3d;\n}\n\n.flap.north {\n top: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: top center;\n animation: openNorth 3s ease-in-out infinite;\n}\n\n.flap.south {\n bottom: 0;\n left: 0;\n width: 100%;\n height: 50%;\n transform-origin: bottom center;\n animation: openSouth 3s ease-in-out infinite;\n}\n\n.flap.east {\n top: 0;\n right: 0;\n width: 50%;\n height: 100%;\n transform-origin: right center;\n animation: openEast 3s ease-in-out infinite;\n}\n\n.flap.west {\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n transform-origin: left center;\n animation: openWest 3s ease-in-out infinite;\n}\n\n@keyframes openNorth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(180deg);\n }\n}\n@keyframes openSouth {\n 0%, 100% {\n transform: rotateX(0deg);\n }\n 50% {\n transform: rotateX(-180deg);\n }\n}\n@keyframes openEast {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n}\n@keyframes openWest {\n 0%, 100% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(-180deg);\n }\n}");const Mx=()=>t.createElement("div",{className:"scene"},t.createElement("div",{className:"floating"},t.createElement("div",{className:"cube"},t.createElement("div",{className:"side front"},"‎"),t.createElement("div",{className:"side back"},"‎"),t.createElement("div",{className:"side left"},"‎"),t.createElement("div",{className:"side right"},"‎"),t.createElement("div",{className:"side bottom"},"‎"),t.createElement("div",{className:"lid"},t.createElement("div",{className:"flap north"},"‎"),t.createElement("div",{className:"flap south"},"‎"),t.createElement("div",{className:"flap east"},"‎"),t.createElement("div",{className:"flap west"},"‎")))));export{Fx as Bundle,Mx as BundleLoader,du as Cart,oa as CouponFrame,qe as Nudge,Je as SpinnerWheel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-uikit",
3
- "version": "0.7.397-collection-bundle.9",
3
+ "version": "0.7.397-collection-bundle.10",
4
4
  "description": "YourToken UI Kit",
5
5
  "scripts": {
6
6
  "rollup": "tsc && rollup -c",