PageSourceSearch

https://aroma360.com/cdn/shop/t/2243/assets/cart-product-bundles.js?v=36363520481301557641788893986

js aroma360.com collected 2026-09-24 09:27:28 UTC 60,340 bytes, 597 lines download raw bytes

1async function switchToSubscription(event,itemKey,itemId){try{await upgradeToSubs(event.target,itemKey,itemId)}catch(error){console.error("Failed to parse bundleItem or call switchToSubscription:",error)}finally{setTimeout(()=>{renderStarterKitLineItems()},2e3)}}const BUNDLE_PRICES_CACHE={};function getBundleCacheKey(bundleId){return`bundle_${bundleId}`}function storeBundlePrice(bundleId,salePrice,capPrice){const cacheKey=getBundleCacheKey(bundleId);BUNDLE_PRICES_CACHE[cacheKey]||(BUNDLE_PRICES_CACHE[cacheKey]={salePrice,capPrice},console.log(`[Pricing Cache] Stored bundle prices for ${bundleId}`,{salePrice,capPrice}))}function getCachedBundlePrice(bundleId){const cacheKey=getBundleCacheKey(bundleId);return BUNDLE_PRICES_CACHE[cacheKey]?.salePrice}function getCachedBundleCapPrice(bundleId){const cacheKey=getBundleCacheKey(bundleId);return BUNDLE_PRICES_CACHE[cacheKey]?.capPrice}function getPerUnitPrice(item){return item.final_price/(item.quantity||1)}function getPerUnitCapPrice(item){return(item.properties._compare_at_price&&item.properties._compare_at_price!=="0"?parseFloat(item.properties._compare_at_price):item.original_price||0)/(item.quantity||1)}function isMainBundleItem(item){return item.product_type=="Diffuser"||item.product_type=="Hourglass Diffuser"}function getBundleUnitCount(bundleProducts){const mainItems=bundleProducts.filter(isMainBundleItem);if(mainItems.length)return Math.max(1,mainItems.reduce((sum,item)=>sum+parseInt(item.quantity||1),0));if(bundleProducts.some(item=>item.properties?._bundle_instance_id)){const instanceIds=new Set(bundleProducts.map(item=>item.properties?._bundle_instance_id||item.key));return Math.max(1,instanceIds.size)}return Math.max(1,Math.min(...bundleProducts.map(item=>parseInt(item.quantity||1))))}function getPerBundleQty(item,bundleProducts){const storedBundleQty=parseInt(item.properties?._bundle_qty||0);if(storedBundleQty)return storedBundleQty;const currentBundleQty=Math.max(1,Math.min(...bundleProducts.map(bundleItem=>parseInt(bundleItem.quantity||1))));return Math.max(1,Math.round(parseInt(item.quantity||1)/currentBundleQty))}function getBundleUnitSalePrice(bundleProducts){const bundleQty=getBundleUnitCount(bundleProducts);return bundleProducts.reduce((sum,item)=>sum+(item.final_price||0),0)/bundleQty}function getBundleUnitCapPrice(bundleProducts){const bundleQty=getBundleUnitCount(bundleProducts);return bundleProducts.reduce((sum,item)=>{const capUnit=item.properties?._compare_at_price&&item.properties._compare_at_price!=="0"?parseFloat(item.properties._compare_at_price):item.original_price||0;return sum+capUnit*parseInt(item.quantity||1)},0)/bundleQty}function getBundleDisplayId(item){return item.properties?._bundle_group_id||item.properties?._bundle_id}async function renderBundleSetLineItems(){let items;window.Rebuy&&Rebuy.Cart&&Rebuy.Cart.status=="ready"&&Rebuy.Cart.cart?items=Rebuy.Cart.cart.items:items=(await fetchCart()).items;const bundlesInCart={};let cartPageItemsNode=document.querySelector(cartItemsSelector);document.querySelectorAll(".static-line-item-bundle-set-ctn").forEach(item=>item.remove()),items.forEach(item=>{const bundleId=item.properties._bundle_set;bundleId&&(bundlesInCart[bundleId]||(bundlesInCart[bundleId]=[]),bundlesInCart[bundleId].push(item))}),Object.entries(bundlesInCart).forEach(([bundleId,bundleItems])=>{let bundleLineItemQty=document.createElement("div");bundleLineItemQty.id=bundleId,bundleLineItemQty.classList.add("line-item","rebuy-cart__flyout-item","static-line-item","static-line-item-bundle-set-qty"),bundleLineItemQty.dataset.type="_bundle_set";const config={showQty:!1,showQtyChange:!1,showQtyRemove:!1,showPrice:!0};bundleItems.sort((a,b)=>{const isDiffuserA=a.product_type==="Diffuser"?-1:1,isDiffuserB=b.product_type==="Diffuser"?-1:1;return isDiffuserA-isDiffuserB});let bundleMarkup=document.createElement(isCartPage?"tr":"li");bundleMarkup.id=bundleId,bundleMarkup.classList.add("line-item","static-line-item","rebuy-cart__flyout-item","static-line-item-bundle-set-ctn"),bundleMarkup.dataset.type="_bundle_set";const bundleTitle=document.createElement("h3");bundleTitle.classList.add("bundle-set-cart-title"),bundleTitle.textContent=`${bundleItems[0].product_title} Bundle Set includes:`,bundleMarkup.appendChild(bundleTitle),bundleItems.forEac
1h((item,index)=>{let newBundleLineItem=document.createElement("div");newBundleLineItem.id=bundleId,newBundleLineItem.classList.add("line-item","rebuy-cart__flyout-item","static-line-item-bundle-set");const isLastItem=index===bundleItems.length-1;isCartPage?newBundleLineItem.innerHTML=bundleSetLineItemMarkupCartPage(item,index,config,isLastItem):newBundleLineItem.innerHTML=bundleSetItemMarkup(item,index,config,isLastItem),bundleMarkup.appendChild(newBundleLineItem)}),bundleLineItemQty.innerHTML=isCartPage?bundleQtyButtonsCartPage(bundleItems[0]):bundleQtyButtons(bundleItems[0]),bundleMarkup.appendChild(bundleLineItemQty),document.querySelector(`.static-line-item-bundle-set-ctn[id="${bundleId}"]`)||cartPageItemsNode.appendChild(bundleMarkup)}),setTimeout(()=>{attachELToLineItem()},1500)}function bundleQtyButtons(item){return`
2    <div class="state-line-item-quantity">
3      <div class="rebuy-cart__flyout-item-quantity">
4      <h4>Quantity</h4>
5      <div class="rebuy-cart__flyout-item-quantity-widget">
6        <button
7          alt="Decrease quantity"
8          aria-label="Decrease quantity of"
9          type="button"
10          class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-decrease quantity-selector__button-dec">
11          <i aria-hidden="true" class="far fa-minus"></i>
12        </button>
13        <span class="rebuy-cart__flyout-item-quantity-widget-label quantity-selector__input">
14          ${item.quantity}
15        </span>
16        <button
17          alt="Increase quantity"
18          aria-label="Increase quantity"
19          type="button"
20          class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-increase quantity-selector__button-inc">
21          <i aria-hidden="true" class="far fa-plus"></i>
22        </button>
23      </div>
24    </div>
25      <button
26      type="button"
27      alt="Remove"
28      aria-label="Remove"
29      class="line-item__remove-button text-underline">
30      Remove Set
31    </button>
32    </div>
33  `}function bundleQtyButtonsCartPage(item){return`
34    <div class="state-line-item-quantity">
35      <div class="rebuy-cart__flyout-item-quantity">
36      <h4>Quantity</h4>
37      <line-item-quantity style="display: block; margin-top: -4px">
38      <div class="quantity-selector quantity-selector--small">
39        <a href="javascript:void(0)" class="quantity-selector__button quantity-selector__button-dec" aria-label="Decrease quantity" data-no-instant="">
40        <svg focusable="false" width="8" height="2" class="icon icon--minus   " viewBox="0 0 8 2">
41          <path fill="currentColor" d="M0 0h8v2H0z"></path>
42        </svg>
43        </a>
44        <span is="input-number" class="quantity-selector__input text--xsmall" autocomplete="off" type="text" inputmode="numeric" name="updates[]" data-line="1" size="2" aria-label="Change quantity" data-gaconnector-tracked="true">${item.quantity}</span>
45        <a href="javascript:void(0)" class="quantity-selector__button quantity-selector__button-inc" aria-label="Increase quantity" data-no-instant="">
46        <svg focusable="false" width="8" height="8" class="icon icon--plus   " viewBox="0 0 8 8">
47          <path fill-rule="evenodd" clip-rule="evenodd" d="M3 5v3h2V5h3V3H5V0H3v3H0v2h3z" fill="currentColor"></path>
48        </svg>
49        </a>
50      </div>
51      <a href="javascript:void(0)" class="line-item__remove-button link text--subdued text--xsmall" data-no-instant="">Remove Set</a>
52      </line-item-quantity>
53    </div>
54    </div>
55  `}function bundleSetItemMarkup(item,index,config,isLastItem){const itemTitle=item.product_title,itemVariantTitle=item?.variant_title||"",compareAtProp=item.properties._compare_at_price,rebuyCap=item?.product?.selected_variant?.compare_at_price,compareAtPrice=rebuyCap&&typeof rebuyCap=="string"?parseFloat(rebuyCap)*100:rebuyCap&&typeof rebuyCap=="number"?rebuyCap:null,itemSlashedOutPrice=compareAtProp&&compareAtProp!=="0"?parseFloat(compareAtProp):IS_US&&compareAtPrice?compareAtPrice:item.original_price||0,itemSalePrice=getPerUnitPrice(item),itemOffValue=Math.round((itemSlashedOutPrice-itemSalePrice)/itemSlashedOutPrice*100),itemImg=item.image,itemUrl=item.url||"";return`
56          <div class="rebuy-cart__flyout-item-media">
57            <a href="${itemUrl}" tabindex="-1">
58              <img src="${itemImg}" alt="${itemTitle}">
59            </a>
60          </div>
61          <div class="rebuy-cart__flyout-item-info">
62            <a
63              role="heading"
64              aria-level="5"
65              href="${itemUrl}"
66              alt="View ${itemTitle}"
67              class="rebuy-cart__flyout-item-product-title">${itemTitle}</a>
68              
69            ${item.quantity>1?`<div class="rebuy-cart__flyout-item-variant-qty" style="color: #535353; font-size: 12px;">Quantity: ${item.quantity}</div>`:""}
70            <div class="rebuy-cart__flyout-item-variant-title">${itemVariantTitle.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</div>
71            ${itemOffValue>0?`<div class="rebuy-cart__flyout-item-discount-message">Save ${itemOffValue}%</div>`:""}
72             <div class="rebuy-cart__flyout-item-properties" style="margin: 0;">
73              ${item.selling_plan_allocation?`<p style="margin: 0;font-size: 12px;" class="rebuy-cart__flyout-item-property-value">
74                  ${item.selling_plan_allocation.selling_plan.name.replace("Delivered every 90 days.","Delivered every 90 days.")}</p>`:item.properties._source!=="Rebuy"&&item.product?.selling_plan_groups?.length?`<button
75                      type="button"
76                      style="display: block;background: none; border: none; padding: 0; margin: 3px 0; text-decoration: underline;
76 color: #000; font-size: 13px; cursor: pointer;"
77                      class="rebuy-cart__flyout-item-switch-button"
78                      onclick="switchToSubscription(event, '${item.key}', '${item.id})'">
79                      Upgrade to Subscribe & Save
80                  </button>`:""}
81             </div>
82            <div class="rebuy-cart__flyout-item-price">
83              <div>
84                <span class="rebuy-money sale">
85                  <span class="sr-only">Sale price</span>
86                  <span>${formatMoney(itemSalePrice)}</span>
87                </span>
88                ${itemSlashedOutPrice&&itemSlashedOutPrice!="0"&&itemSlashedOutPrice>itemSalePrice?`
89                  <span class="rebuy-money compare-at">
90                  <span class="sr-only">Original price</span>
91                  <span>${formatMoney(itemSlashedOutPrice)}</span>
92                </span>
93                  `:""}
94              </div>
95            </div>
96          </div>
97      `}function bundleSetLineItemMarkupCartPage(item,index,config,isLastItem){const itemTitle=item.product_title,itemVariantTitle=item?.variant_title||"",itemSlashedOutPrice=item.properties._compare_at_price&&item.properties._compare_at_price!=="0"?parseFloat(item.properties._compare_at_price):item.original_price||0,itemSalePrice=getPerUnitPrice(item),itemOffValue=Math.round((itemSlashedOutPrice-itemSalePrice)/itemSlashedOutPrice*100),itemImg=item.image,itemUrl=item.url||"";return`
98		<td class="md:w-1/12 pt-7 pb-0 md:pt-5 md:pb-5 col-start-1 col-end-1 align-top">
99			<div class="relative w-full md:w-32 float-left before:h-0 before:block before:pb-[100%]">
100				<a href="${itemUrl}" class="absolute top-0 left-0 disable-effect w-full h-full overflow-hidden bg-[#f5f1ec] rounded-md" aria-label="Item added to your cart" tabindex="-1">
101					<img src="${itemImg}" class="object-cover h-full w-full top-0 left-0 absolute duration-300 image-hover z-0" alt="${itemTitle}" loading="lazy" width="150" height="150">
102				</a>
103			</div>
104		</td>
105		<td class="md:w-5/12 pt-7 pb-0 px-5 md:pt-5 md:pb-5 lg:pl-9 lg:pr-14 col-start-2 col-end-5 md:col-end-4 align-top">
106			<div>
107				<a href="${itemUrl}" class="text-[rgba(var(--colors-heading))] font-bold table disable-effect hover-text-link p-break-words mb-1.5">
108					${itemTitle}
109				</a>
110			</div>
111			<dl class="text-normal pb-1.5">
112				${itemVariantTitle?`<dd class="rebuy-cart__flyout-item-variant-title">${itemVariantTitle.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</dd>`:""}
113				${item.quantity>1?`<dd class="rebuy-cart__flyout-item-variant-qty" style="color: #535353; font-size: 12px;">Quantity: ${item.quantity}</dd>`:""}
114			</dl>
115			${item.selling_plan_allocation?`<p class="text-normal pb-1.5">${item.selling_plan_allocation.selling_plan.name.replace("Delivered every 90 days.","Delivered every 90 days.")}</p>`:""}
116			${item.properties._source!=="Rebuy"&&item.product?.selling_plan_groups?.length?`
117				<button type="button" style="display: block;background: none; border: none; padding: 0; margin: 3px 0; text-decoration: underline; color: #000; font-size: 13px; cursor: pointer;" class="rebuy-cart__flyout-item-switch-button" onclick="switchToSubscription(event, '${item.key}', '${item.id}')">
118					Upgrade to Subscribe & Save
119				</button>
120			`:""}
121			<div class="price mb-1.5 md:hidden">
122				${itemSlashedOutPrice>itemSalePrice?`<s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(itemSlashedOutPrice)}</s>`:""}
123				<span class="selection:bg-text-[rgb(var(--colors-price-sale),0.2)] text-[#6b2e16] font-semibold">
124					${formatMoney(itemSalePrice)}
125				</span>
126			</div>
127			${itemOffValue>0?`
128			<ul class="w-fit p-1 bg-[#6b2e16] lg:mb-0 rounded-md mt-2">
129				<li class="flex text-white relative x-discount items-center gap-2">
130					<span class="leading-none text-normal discount-title">${itemOffValue}% Off on Sale</span>
131				</li>
132			</ul>
133			`:""}
134		</td>
135		<td class="lg:pl-2 pt-0 pb-5 pl-5 mt-2 md:pr-5 lg:pr-0 md:mt-3.5 md:pl-0 md:pt-5 rtl:pr-5 rtl:md:pr-0 rtl:md:pl-5 rtl:lg:pl-0 col-start-2 col-end-4 flex items-center md:table-cell md:align-top">
136		</td>
137		<td class="pb-5 md:pt-5 md:table-cell md:align-top lg:w-2/12 lg:pl-2">
138			<div class="flex justify-end">
139				<div class="price cart-item-price-1 hidden md:flex md:flex-wrap md:flex-col text-right">
140					${itemSlashedOutPrice>itemSalePrice?`<s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(itemSlashedOutPrice)}</s>`:""}
141					<span class="text-[#6b2e16] font-semibold">${formatMoney(itemSalePrice)}</span>
142				</div>
143			</div>
144		</td>
145   `}
145async function renderStarterKitLineItems(){console.log("renderStarterKitLineItems");let items;window.Rebuy&&Rebuy.Cart&&Rebuy.Cart.status=="ready"&&Rebuy.Cart.cart?items=Rebuy.Cart.cart.items:items=(await fetchCart()).items;const bundlesInCart={};let cartPageItemsNode=document.querySelector(cartItemsSelector);document.querySelectorAll(".static-line-item-starter-kit").forEach(item=>item.remove()),document.querySelectorAll(".cart-bundle-promo-cards-row").forEach(el=>el.remove()),items.forEach(item=>{const bundleId=getBundleDisplayId(item);bundleId&&(bundlesInCart[bundleId]||(bundlesInCart[bundleId]=[]),bundlesInCart[bundleId].push(item))});let lastPromoAnchorEl=null;Object.entries(bundlesInCart).forEach(([bundleId,bundleItems])=>{let newBundleLineItem=document.createElement(isCartPage?"tr":"li");newBundleLineItem.id=bundleId,newBundleLineItem.classList.add("line-item","rebuy-cart__flyout-item","static-line-item","static-line-item-starter-kit"),newBundleLineItem.dataset.type="_bundle_id",isCartPage?newBundleLineItem.innerHTML=starterKitLineItemMarkupCartPage(bundleItems,bundleId):newBundleLineItem.innerHTML=startKitBundleItemMarkup(bundleItems,bundleId);const addedBundleItem=document.getElementById(bundleId);addedBundleItem||cartPageItemsNode.append(newBundleLineItem),bundleItems.some(it=>it.properties&&it.properties._bundle_identifier==="true")&&(lastPromoAnchorEl=addedBundleItem||newBundleLineItem)}),appendCartBundlePromoCards(lastPromoAnchorEl),setTimeout(()=>{attachELToLineItem()},2e3)}function getCartBundlePromoCardsConfig(){return window.themeVariables&&window.themeVariables.settings&&window.themeVariables.settings.cartBundlePromoCards||{}}function buildCartBundlePromoCardsInnerHTML(){const cfg=getCartBundlePromoCardsConfig(),trustHeading=cfg.trustHeading||"",trustText=cfg.trustText||"",quote=cfg.testimonialQuote||"",author=cfg.testimonialAuthor||"";let html="";return(trustHeading||trustText)&&(html+=`
146      <div class="cart-bundle-promo-cards__trust">
147        ${trustHeading?`<b>${trustHeading}</b>`:""}
148        ${trustText?`<span>${trustText}</span>`:""}
149      </div>`),quote&&(html+=`
150      <div class="cart-bundle-promo-cards__testimonial">
151        <p>&ldquo;${quote}&rdquo;</p>
152        <span class="cart-bundle-promo-cards__stars" aria-hidden="true">&#9733;&#9733;&#9733;&#9733;&#9733;</span>
153        ${author?`<span class="cart-bundle-promo-cards__who">${author}</span>`:""}
154      </div>`),html}function ensureCartBundlePromoCardsStyle(){if(document.getElementById("cart-bundle-promo-cards-style"))return;const style=document.createElement("style");style.id="cart-bundle-promo-cards-style",style.textContent=`
155    .cart-bundle-promo-cards { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
156    .cart-bundle-promo-cards__trust { background: rgba(107,119,104,.12); border-radius: 12px; padding: 12px 14px; }
157    .cart-bundle-promo-cards__trust b { display: block; font-size: 13px; color: rgb(var(--colors-heading)); margin-bottom: 2px; }
158    .cart-bundle-promo-cards__trust span { font-size: 12px; color: rgb(var(--colors-text)); opacity: .8; }
159    .cart-bundle-promo-cards__testimonial { background: rgb(var(--colors-background)); border: 1px solid rgba(var(--colors-text), .12); border-radius: 12px; padding: 12px 14px; }
160    .cart-bundle-promo-cards__testimonial p { font-size: 12.5px; color: rgb(var(--colors-heading)); line-height: 1.5; margin: 0 0 6px; }
161    .cart-bundle-promo-cards__stars { color: #C9A227; font-size: 12px; letter-spacing: 2px; }
162    .cart-bundle-promo-cards__who { font-size: 11px; color: rgb(var(--colors-text)); opacity: .75; font-weight: 700; margin-left: 6px; }
163  `,document.head.appendChild(style)}function appendCartBundlePromoCards(anchorEl){const cfg=getCartBundlePromoCardsConfig();if(!anchorEl||cfg.enabled===!1)return;const innerHTML=buildCartBundlePromoCardsInnerHTML();if(!innerHTML)return;ensureCartBundlePromoCardsStyle();const promoRow=document.createElement(isCartPage?"tr":"li");promoRow.classList.add("cart-bundle-promo-cards-row"),promoRow.innerHTML=isCartPage?`<td colspan="4"><div class="cart-bundle-promo-cards">${innerHTML}</div></td>`:`<div class="cart-bundle-promo-cards">${innerHTML}</div>`,anchorEl.insertAdjacentElement("afterend",promoRow)}function startKitBundleItemMarkup(bundleItems,bundleId){let mainBundleItem=bundleItems.find(item=>item.product_type=="Diffuser"||item.product_type=="Hourglass Diffuser"),fpTitle=mainBundleItem?.product_title||"Bundle";const fpVariantTitle=mainBundleItem?.variant_title||"",fpSlashedOutPrice=getBundleUnitCapPrice(bundleItems),fpSalePrice=getBundleUnitSalePrice(bundleItems);storeBundlePrice(bundleId,fpSalePrice,fpSlashedOutPrice);const cachedSalePrice=getCachedBundlePrice(bundleId),cachedCapPrice=getCachedBundleCapPrice(bundleId),finalFpSalePrice=cachedSalePrice!==void 0?cachedSalePrice:fpSalePrice,finalFpCapPrice=cachedCapPrice!==void 0?cachedCapPrice:fpSlashedOutPrice;mainBundleItem||(mainBundleItem=bundleItems[0]);const isStarterKitBundle=mainBundleItem?.properties._starter_kit_bundle,isBundle=mainBundleItem?.properties._source==="Rebuy"||mainBundleItem?.properties._bundle_title;fpTitle=isBundle&&mainBundleItem.properties._bundle_title?mainBundleItem.properties._bundle_title:fpTitle;const fpOffValue=Math.round((finalFpCapPrice-finalFpSalePrice)/finalFpCapPrice*100),fpImg=isBundle||isStarterKitBundle?mainBundleItem.properties._bundle_image_url:mainBundleItem?.image||"",fpUrl=mainBundleItem?.url||"",bundleQty=getBundleUnitCount(bundleItems),discountValue=finalFpCapPrice>finalFpSalePrice?(finalFpCapPrice-finalFpSalePrice)/finalFpCapPrice*100:0,bundleSaleMsg=!1,bundleSetMsg=mainBundleItem.properties._bundle_set_message||"";function fpProductsTitleProp(){let string="";
163return bundleItems.forEach(bundleItem=>{(isBundle||bundleItem.product_type!="Diffuser"&&bundleItem.product_type!="Hourglass Diffuser")&&(string+=`
164        <div class="rebuy-cart__flyout-item-member">
165          <div class="rebuy-cart__flyout-item-property">
166           ${isStarterKitBundle?"":`
167            <span class="rebuy-cart__flyout-item-property-name">${bundleItem.product_type}</span>
168            <span class="rebuy-cart__flyout-item-property-separator"> - </span>`}
169            <span class="rebuy-cart__flyout-item-property-value">${bundleItem.title.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</span>
170            <span class="rebuy-cart__flyout-item-property-value">x ${bundleItem.quantity}</span>
171            ${bundleItem.selling_plan_allocation?`<p style="margin: 0;font-size: 12px;" class="rebuy-cart__flyout-item-property-value">${bundleItem.selling_plan_allocation.selling_plan.name.replace("Delivered every 90 days.","3-month supply, delivered quarterly")}</p>`:bundleItem.properties._source!=="Rebuy"&&bundleItem.product?.selling_plan_groups?.length&&(bundleItem.properties._bundle_subs_upgrade===void 0||bundleItem.properties._bundle_subs_upgrade)?`<button 
172                    type="button" 
173                    style="display: block;background: none; border: none; padding: 0; margin: 3px 0; text-decoration: underline; color: #000; font-size: 13px; cursor: pointer;" 
174                    class="rebuy-cart__flyout-item-switch-button" 
175                    onclick="switchToSubscription(event, '${bundleItem.key}', '${bundleItem.id}')">
176                    Upgrade to Subscribe & Save
177                 </button>`:""}
178          </div>
179        </div>`)}),string}return`
180          <div class="rebuy-cart__flyout-item-media">
181            <a href="${fpUrl}" tabindex="-1">
182              <img src="${fpImg}" alt="${fpTitle}">
183            </a>
184          </div>
185          <div class="rebuy-cart__flyout-item-info">
186            <a
187              role="heading"
188              aria-level="5"
189              href="${fpUrl}"
190              alt="View ${fpTitle}"
191              class="rebuy-cart__flyout-item-product-title">${fpTitle}</a>
192            <div class="rebuy-cart__flyout-item-variant-title">${fpVariantTitle}</div>
193            ${bundleSaleMsg?`<div class="rebuy-cart__flyout-item-discount-message">${bundleSaleMsg}</div>`:""}
194            ${bundleSetMsg?`<div class="rebuy-cart__flyout-item-bundle-set-message" style="margin-bottom: 4px;">Bundle - ${bundleSetMsg}</div>`:""}
195            
196            <div class="rebuy-cart__flyout-item-properties">
197              ${fpProductsTitleProp(bundleItems)}
198            </div>
199            <button
200              type="button"
201              alt="Remove ${fpTitle}"
202              aria-label="Remove ${fpTitle}"
203              class="rebuy-cart__flyout-item-remove line-item__remove-button">
204              <i aria-hidden="true" class="far fa-trash"></i>
205            </button>
206            <div class="rebuy-cart__flyout-item-quantity">
207              <div class="rebuy-cart__flyout-item-quantity-widget">
208                <button
209                  alt="Decrease quantity of ${fpTitle}"
210                  aria-label="Decrease quantity of ${fpTitle}"
211                  type="button"
212                  class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-decrease quantity-selector__button-dec">
213                  <i aria-hidden="true" class="far fa-minus"></i>
214                </button>
215                <span class="rebuy-cart__flyout-item-quantity-widget-label quantity-selector__input">
216                  ${bundleQty}
217                </span>
218                <button
219                  alt="Increase quantity of ${fpTitle}"
220                  aria-label="Increase quantity of ${fpTitle}"
221                  type="button"
222                  class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-increase quantity-selector__button-inc">
223                  <i aria-hidden="true" class="far fa-plus"></i>
224                </button>
225              </div>
226            </div>
227            <div class="rebuy-cart__flyout-item-price">
228              <div>
229                <span class="rebuy-money ${finalFpCapPrice>finalFpSalePrice?"sale":""}">
230                  <span class="sr-only">Sale price</span>
231                  <span>${formatMoney(finalFpSalePrice)}</span>
232                </span>
233                ${finalFpCapPrice&&finalFpCapPrice!="0"&&finalFpCapPrice>finalFpSalePrice?`
234                  <span class="rebuy-money compare-at">
235                  <span class="sr-only">Original price</span>
236                  <span>${formatMoney(finalFpCapPrice)}</span>
237                </span>
238                  `:""}
239              </div>
240            </div>
241          </div>
242      `}function starterKitLineItemMarkupCartPage(bundleItems,bundleId){let mainBundleItem=bundleItems.find(item=>item.product_type=="Diffuser"||item.product_type=="Hourglass Diffuser"),bundleTitle=mainBundleItem?.product_title||"Bundle";const bundleVariantTitle=mainBundleItem?.variant_title||"",bundleSlashedOutPrice=getBundleUnitCapPrice(bundleItems),bundleSalePrice=getBundleUnitSalePrice(bundleItems);storeBundlePrice(bundleId,bundleSalePrice,bundleSlashedOutPrice);const cachedSalePrice=getCachedBundlePrice(bundleId),cachedCapPrice=getCachedBundleCapPrice(bundleId),finalBundleSalePrice=cachedSalePrice!==void 0?cachedSalePrice:bundleSalePrice,finalBundleCapPrice=cachedCapPrice!==void 0?cachedCapPrice:bundleSlashedOutPrice;mainBundleItem||(mainBundleItem=bundleItems[0]);const isStarterKitBundle=mainBundleItem?.properties._starter_kit_bundle,isBundle=mainBundleItem?.properties._source==="Rebuy"||mainBundleItem?.properties._bundle_title;bundleTitle=isBundle&&mainBundleItem.properties._bundle_title?mainBundleItem.properties._bundle_title:bundleTitle;const bundleOffValue=Math.round((finalBundleCapPrice-finalBundleSalePrice)/finalBundleCapPrice*100),bundleImg=isBundle||isStarterKitBundle?mainBundleItem.properties._bundle_image_url:mainBundleItem?.image||"",bundleUrl=mainBundleItem?.url||"",bundleQty=getBundleUnitCount(bundleItems);function bundleProductsTitleProp(){let string="";return bundleItems.forEach(bundleItem=>{(isBundle||bundleItem.product_type!="Diffuser"&&bundleItem.product_type!="Hourglass Diffuser")&&(string+=`
243        <div class="rebuy-cart__flyout-item-member">
244          <div class="rebuy-cart__flyout-item-property">
245           ${isStarterKitBundle?"":`
246            <span class="rebuy-cart__flyout-item-property-name">${bundleItem.product_type}</span>
247            <span class="rebuy-cart__flyout-item-property-separator"> - </span>
248            `}
249            <span class="rebuy-cart__flyout-item-property-value">${bundleItem.title.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</span>
250            <span class="rebuy-cart__flyout-item-property-value">x ${bundleItem.quantity}</span>
251            ${bundleItem.selling_plan_allocation?`<p style="margin: 0;font-size: 12px;" class="rebuy-cart__flyout-item-property-value">${bundleItem.selling_plan_allocation.selling_plan.name.replace("Delivered every 90 days.","3-month supply, delivered quarterly")}</p>`:bundleItem.properties._source!=="Rebuy"&&bundleItem.product?.selling_plan_groups?.length&&(bundleItem.properties._bundle_subs_upgrade===void 0||bundleItem.properties._bundle_subs_upgrade)?`<button 
252                    type="button" 
253                    style="display: block;background: none; border: none; padding: 0; margin: 3px 0; text-decoration: underline; color: #000; font-size: 13px; cursor: pointer;" 
254                    class="rebuy-cart__flyout-item-switch-button" 
255                    onclick="switchToSubscription(event, '${bundleItem.key}', '${bundleItem.id}')">
256                    Upgrade to Subscribe & Save
257                 </button>`:""}
258          </div>
259        </div>`)}),string}return`
260		<td class="md:w-1/12 pt-7 pb-0 md:pt-5 md:pb-5 col-start-1 col-end-1 align-top">
261			<div class="relative w-full md:w-32 float-left before:h-0 before:block before:pb-[100%]">
262				<a href="${bundleUrl}" class="absolute top-0 left-0 disable-effect w-full h-full overflow-hidden bg-[#f5f1ec] rounded-md" aria-label="Item added to your cart" tabindex="-1">
263					<img src="${bundleImg}" class="object-cover h-full w-full top-0 left-0 absolute duration-300 image-hover z-0" alt="${bundleTitle}" loading="lazy" width="150" height="150">
264				</a>
265			</div>
266		</td>
267		<td class="md:w-5/12 pt-7 pb-0 px-5 md:pt-5 md:pb-5 lg:pl-9 lg:pr-14 col-start-2 col-end-5 md:col-end-4 align-top">
268			<div>
269				<a href="${bundleUrl}" class="text-[rgba(var(--colors-heading))] font-bold table disable-effect hover-text-link p-break-words mb-1.5">
270					${bundleTitle}
271				</a>
272			</div>
273			<dl class="text-normal pb-1.5">
274				${bundleVariantTitle?`<dd class="rebuy-cart__flyout-item-variant-title">${bundleVariantTitle}</dd>`:""}
275			</dl>
276			<div class="rebuy-cart__flyout-item-properties">
277				${bundleProductsTitleProp()}
278			</div>
279			<div class="price mb-1.5 md:hidden">
280				${finalBundleCapPrice>finalBundleSalePrice?`<s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(finalBundleCapPrice)}</s>`:""}
281				<span class="selection:bg-text-[rgb(var(--colors-price-sale),0.2)] text-[#6b2e16] font-semibold">
282					${formatMoney(finalBundleSalePrice)}
283				</span>
284			</div>
285			${bundleOffValue>0?`
286			<ul class="w-fit p-1 bg-[#6b2e16] lg:mb-0 rounded-md mt-2">
287				<li class="flex text-white relative x-discount items-center gap-2">
288					<span class="leading-none text-normal discount-title">${bundleOffValue}% Off on Sale</span>
289				</li>
290			</ul>
291			`:""}
292		</td>
293		<td class="lg:pl-2 pt-0 pb-5 pl-5 mt-2 md:pr-5 lg:pr-0 md:mt-3.5 md:pl-0 md:pt-5 rtl:pr-5 rtl:md:pr-0 rtl:md:pl-5 rtl:lg:pl-0 col-start-2 col-end-4 flex items-center md:table-cell md:align-top">
294			<div class="x-cart-item-quantity flex justify-center">
295				<div class="flex flex-row md:flex-col items-center gap-2">
296					<div class="relative flex w-28 h-10 border border-solid justify-between rounded-full">
297						<button class="items-center w-1/3 justify-center flex opacity-70 cursor-pointer quantity-selector__button-dec quantity-button-decrease" aria-label="button-minus" data-no-instant="">
298							<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" class="w-3" fill="none" viewBox="0 0 10 2">
299								<path fill-rule="evenodd" clip-rule="evenodd" d="M.5 1C.5.7.7.5 1 .5h8a.5.5 0 110 1H1A.5.5 0 01.5 1z" fill="currentColor"></path>
300							</svg>
301						</button>
302						<span class="cart-item-qty outer-spin-button bg-transparent w-1/3 text-center pt-2 pb-2 placeholder:opacity-60 focus-within:outline-none quantity-selector__input" aria-label="Quantity for ${bundleTitle}">${bundleQty}</span>
303						<button class="items-center w-1/3 justify-center flex opacity-70 cursor-pointer quantity-selector__button-inc quantity-button-increase" aria-label="button-plus" data-no-instant="">
304							<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" class="w-3" fill="none" viewBox="0 0 10 10">
305								<path fill-rule="evenodd" clip-rule="evenodd" d="M1 4.51a.5.5 0 000 1h3.5l.01 3.5a.5.5 0 001-.01V5.5l3.5-.01a.5.5 0 00-.01-1H5.5L5.49.99a.5.5 0 00-1 .01v3.5l-3.5.01H1z" fill="currentColor"></path>
306							</svg>
307						</button>
308					</div>
309				</div>
310			</div>
311		</td>
312		<td class="pb-5 md:pt-5 md:table-cell md:align-top lg:w-2/12 lg:pl-2">
313			<div class="flex justify-end">
314				<div class="price cart-item-price-1 hidden md:flex md:flex-wrap md:flex-col text-right">
315					${finalBundleCapPrice&&finalBundleCapPrice!="0"&&finalBundleCapPrice>finalBundleSalePrice?`<s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(finalBundleCapPrice)}</s>`:""}
316					<span class="text-[#6b2e16] font-semibold">${formatMoney(finalBundleSalePrice)}</span>
317				</div>
318			</div>
319		</td>
320   `}async function renderBundleLineItems(){let items;window.Rebuy&&Rebuy.Cart&&Rebuy.Cart.status=="ready"&&Rebuy.Cart.cart?items=Rebuy.Cart.cart.items:items=(await fetchCart()).items;const bundlesInCart=[];let CartPageItemsNode=document.querySelector(cartItemsSelector);CartPageItemsNode.querySelectorAll(".static-line-item-bundle").forEach(item=>{item.remove()}),items.map(item=>{const bundleCodeProp=item.properties._bundle_hash;if(bundleCodeProp&&!bundlesInCart.includes(bundleCodeProp)){bundlesInCart.push(bundleCodeProp);let newBundleLineItem=document.createElement("li");isCartPage&&(newBundleLineItem=document.createElement("tr")),newBundleLineItem.id=bundleCodeProp,newBundleLineItem.dataset.type="_bundle_hash",newBundleLineItem.classList.add("line-item","rebuy-cart__flyout-item","static-line-item","static-line-item-bundle"),isCartPage?newBundleLineItem.innerHTML=bundleLineItemMarkupCartPage(item):newBundleLineItem.innerHTML=bundleLineItemMarkup(item),document.getElementById(`${bundleCodeProp}`)||CartPageItemsNode.append(newBundleLineItem)}}),setTimeout(()=>{attachELToLineItem()},2e3)}async function renderFpLineItems(){let items;window.Rebuy&&Rebuy.Cart&&Rebuy.Cart.status=="ready"&&Rebuy.Cart.cart?items=Rebuy.Cart.cart.items:items=(await fetchCart()).items;const bundlesInCart=[];let cartPageItemsNode=document.querySelector(cartItemsSelector);cartPageItemsNode.querySelectorAll(".static-line-item-fp").forEach(item=>{item.remove()}),items.map(item=>{const fpCodeProp=item.properties._fp_id;if(fpCodeProp&&!bundlesInCart.includes(fpCodeProp)){bundlesInCart.push(fpCodeProp);let newBundleLineItem=document.createElement("li");isCartPage&&(newBundleLineItem=document.createElement("tr")),newBundleLineItem.id=fpCodeProp,newBundleLineItem.classList.add("line-item","rebuy-cart__flyout-item","static-line-item","static-line-item-fp"),newBundleLineItem.dataset.type="_fp_id",isCartPage?newBundleLineItem.innerHTML=fpLineItemMarkupCartPage(item):newBundleLineItem.innerHTML=fpLineItemMarkup(item),document.getElementById(`${fpCodeProp}`)||cartPageItemsNode.append(newBundleLineItem)}}),setTimeout(()=>{attachELToLineItem()},2e3)}function fpLineItemMarkupCartPage(item){const fpTitle="Family Plan",fpSlashedOutPrice=parseFloat(item.properties._fp_slashed_out_price||0)/(item.quantity||1),fpSalePrice=parseFloat(item.properties._fp_sale_price||0)/(item.quantity||1);let fpOffValue=parseFloat(item.properties._fp_off_value||0)/(item.quantity||1);const fpImg=item.properties._fp_img,fpUrl=item.properties._fp_url;function fpProductsTitleProp(item2){let string="";return item2.properties._fq_products&&item2.properties._fq_products.forEac
320h((productGroup,index)=>{string+=`
321			<div class="rebuy-cart__flyout-item-member">
322			  <h4>Member ${index+1}</h4>
323			  <div class="rebuy-cart__flyout-item-property">
324				<span class="rebuy-cart__flyout-item-property-name">Diffuser</span>
325				<span class="rebuy-cart__flyout-item-property-separator"> - </span>
326				<span class="rebuy-cart__flyout-item-property-value">${productGroup.product_title}</span>
327			  </div>
328			  <div class="rebuy-cart__flyout-item-property">
329				<span class="rebuy-cart__flyout-item-property-name">Oil</span>
330				<span class="rebuy-cart__flyout-item-property-separator"> - </span>
331				<span class="rebuy-cart__flyout-item-property-value">${productGroup.addon_title.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</span>
332			  </div>
333			</div>`}),string}return`
334		 <td class="md:w-1/12 pt-7 pb-0 md:pt-5 md:pb-5 col-start-1 col-end-1 align-top">
335			 <div class="relative w-full md:w-32 float-left before:h-0 before:block before:pb-[100%]">
336				 <a href="${fpUrl}" class="absolute top-0 left-0 disable-effect w-full h-full overflow-hidden bg-[#f5f1ec] rounded-md" aria-label="Item added to your cart" tabindex="-1">
337					 <img src="${fpImg}" class="object-cover h-full w-full top-0 left-0 absolute duration-300 image-hover z-0" alt="${fpTitle}" loading="lazy" width="150" height="150">
338				 </a>
339			 </div>
340		 </td>
341		 <td class="md:w-5/12 pt-7 pb-0 px-5 md:pt-5 md:pb-5 lg:pl-9 lg:pr-14 col-start-2 col-end-5 md:col-end-4 align-top">
342			 <div>
343				 <a href="${fpUrl}" class="text-[rgba(var(--colors-heading))] font-bold table disable-effect hover-text-link p-break-words mb-1.5">
344					 ${fpTitle}
345				 </a>
346			 </div>
347			 <dl class="text-normal pb-1.5">
348			 </dl>
349			 <div class="rebuy-cart__flyout-item-properties">
350				 ${fpProductsTitleProp(item)}
351			 </div>
352			 <div class="price mb-1.5 md:hidden">
353				 <s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(fpSlashedOutPrice)}</s>
354				 <span class="selection:bg-text-[rgb(var(--colors-price-sale),0.2)] text-[#6b2e16] font-semibold">
355					 ${formatMoney(fpSalePrice)}
356				 </span>
357			 </div>
358			 <ul class="w-fit p-1 bg-[#6b2e16] lg:mb-0 rounded-md mt-2">
359				 <li class="flex text-white relative x-discount items-center gap-2">
360					 <span class="leading-none text-normal discount-title">Family plan savings (-${formatMoney(fpOffValue)})</span>
361				 </li>
362			 </ul>
363		 </td>
364		 <td class="lg:pl-2 pt-0 pb-5 pl-5 mt-2 md:pr-5 lg:pr-0 md:mt-3.5 md:pl-0 md:pt-5 rtl:pr-5 rtl:md:pr-0 rtl:md:pl-5 rtl:lg:pl-0 col-start-2 col-end-4 flex items-center md:table-cell md:align-top">
365			 <div class="x-cart-item-quantity flex justify-center">
366				 <div class="flex flex-row md:flex-col items-center gap-2">
367					 <div class="relative flex w-28 h-10 border border-solid justify-between rounded-full">
368						 <button class="items-center w-1/3 justify-center flex opacity-70 cursor-pointer quantity-selector__button-dec quantity-button-decrease" aria-label="button-minus" data-no-instant="">
369							 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" class="w-3" fill="none" viewBox="0 0 10 2">
370								 <path fill-rule="evenodd" clip-rule="evenodd" d="M.5 1C.5.7.7.5 1 .5h8a.5.5 0 110 1H1A.5.5 0 01.5 1z" fill="currentColor"></path>
371							 </svg>
372						 </button>
373						 <span class="cart-item-qty outer-spin-button bg-transparent w-1/3 text-center pt-2 pb-2 placeholder:opacity-60 focus-within:outline-none quantity-selector__input" aria-label="Quantity for ${fpTitle}">${item.quantity}</span>
374						 <button class="items-center w-1/3 justify-center flex opacity-70 cursor-pointer quantity-selector__button-inc quantity-button-increase" aria-label="button-plus" data-no-instant="">
375							 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" class="w-3" fill="none" viewBox="0 0 10 10">
376								 <path fill-rule="evenodd" clip-rule="evenodd" d="M1 4.51a.5.5 0 000 1h3.5l.01 3.5a.5.5 0 001-.01V5.5l3.5-.01a.5.5 0 00-.01-1H5.5L5.49.99a.5.5 0 00-1 .01v3.5l-3.5.01H1z" fill="currentColor"></path>
377							 </svg>
378						 </button>
379					 </div>
380				 </div>
381			 </div>
382		 </td>
383		 <td class="pb-5 md:pt-5 md:table-cell md:align-top lg:w-2/12 lg:pl-2">
384			 <div class="flex justify-end">
385				 <div class="price cart-item-price-1 hidden md:flex md:flex-wrap md:flex-col text-right">
386					 <s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(fpSlashedOutPrice)}</s>
387					 <span class="text-[#6b2e16] font-semibold">${formatMoney(fpSalePrice)}</span>
388				 </div>
389			 </div>
390		 </td>
391	`}function fpLineItemMarkup(item){const fpTitle="Family Plan",fpSlashedOutPrice=parseFloat(item.properties._fp_slashed_out_price||0)/(item.quantity||1),fpSalePrice=parseFloat(item.properties._fp_sale_price||0)/(item.quantity||1);let fpOffValue=parseFloat(item.properties._fp_off_value||0)/(item.quantity||1);const fpImg=item.properties._fp_img,fpUrl=item.properties._fp_url;function fpProductsTitleProp(item2){let string="";return item2.properties._fq_products&&item2.properties._fq_products.forEach((productGroup,index)=>{string+=`
392            <div class="rebuy-cart__flyout-item-member">
393              <h4>Member ${index+1}</h4>
394              <div class="rebuy-cart__flyout-item-property">
395                <span class="rebuy-cart__flyout-item-property-name">Diffuser</span>
396                <span class="rebuy-cart__flyout-item-property-separator"> - </span>
397                <span class="rebuy-cart__flyout-item-property-value">${productGroup.product_title}</span>
398              </div>
399              <div class="rebuy-cart__flyout-item-property">
400                <span class="rebuy-cart__flyout-item-property-name">Oil</span>
401                <span class="rebuy-cart__flyout-item-property-separator"> - </span>
402                <span class="rebuy-cart__flyout-item-property-value">${productGroup.addon_title.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</span>
403              </div>
404            </div>`}),string}return`
405        <div class="rebuy-cart__flyout-item-media">
406          <a href="${fpUrl}" tabindex="-1">
407            <img src="${fpImg} alt="${fpTitle}"></a>
408        </div>
409        <div class="rebuy-cart__flyout-item-info">
410          <a
411            role="heading"
412            aria-level="5"
413            href="${fpUrl}"
414            alt="View ${fpTitle}"
415            class="rebuy-cart__flyout-item-product-title">${fpTitle}</a>
416          <div class="rebuy-cart__flyout-item-discount-message">Family plan savings ${formatMoney(fpOffValue)}</div>
417          <div class="rebuy-cart__flyout-item-properties">
418            ${fpProductsTitleProp(item)}
419        </div>
420          <!---->
421          <button
422            type="button"
423            alt="Remove ${fpTitle}"
424            aria-label="Remove ${fpTitle}"
425            class="rebuy-cart__flyout-item-remove line-item__remove-button">
426            <i aria-hidden="true" class="far fa-trash"></i>
427          </button>
428          <div class="rebuy-cart__flyout-item-quantity">
429            <div class="rebuy-cart__flyout-item-quantity-widget">
430              <button
431                alt="Decrease quantity of ${fpTitle}"
432                aria-label="Decrease quantity of ${fpTitle}"
433                type="button"
434                class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-decrease quantity-selector__button-dec">
435                <i aria-hidden="true" class="far fa-minus"></i>
436              </button>
437              <span class="rebuy-cart__flyout-item-quantity-widget-label quantity-selector__input">
438                ${item.quantity}
439              </span>
440              <button
441                alt="Increase quantity of ${fpTitle}"
442                aria-label="Increase quantity of ${fpTitle}"
443                type="button"
444                class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-increase quantity-selector__button-inc">
445                <i aria-hidden="true" class="far fa-plus"></i>
446              </button>
447            </div>
448          </div>
449          <div class="rebuy-cart__flyout-item-price">
450            <div>
451              <span class="rebuy-money sale">
452                <span class="sr-only">Sale price</span>
453                <span>${formatMoney(fpSalePrice)}</span>
454              </span>
455              <span class="rebuy-money compare-at">
456                <span class="sr-only">Original price</span>
457                <span>${formatMoney(fpSlashedOutPrice)}</span>
458              </span>
459            </div>
460            <!---->
461          </div>
462          <!---->
463        </div>
464    `}function bundleLineItemMarkupCartPage(item){const bundleCodeProp=item.properties._bundle_hash,bundleTitle=item.properties._bundle_title,bundleSlashedOutPrice=parseFloat(item.properties._bundle_slashed_out_price||0)/(item.quantity||1),bundleSalePrice=parseFloat(item.properties._bundle_sale_price||0)/(item.quantity||1);let bundleOffValue=item.properties._bundle_off_value;const bundleImg=item.properties._bundle_img,bundleUrl=item.properties._bundle_url;bundleOffValue&&bundleOffValue.includes("(")&&(bundleOffValue=bundleOffValue.split("(")[1].split(")")[0].toUpperCase()+" Sale");function bundleProductsTitleProp(item2){var string="";for(const[key,value]of Object.entries(item2.properties._bundle_products)){const formattedKey="Bundle "+key.charAt(0).toUpperCase()+key.slice(1).replace(/_/g," ");if(key.includes("product")&&value){let propertyString=`
465        <div class="rebuy-cart__flyout-item-property">
466          <span class="rebuy-cart__flyout-item-property-value">${value.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122")}</span>
467        </div>
468        `;string=string.concat(propertyString)}}return string}return`
469		<td class="md:w-1/12 pt-7 pb-0 md:pt-5 md:pb-5 col-start-1 col-end-1 align-top">
470			<div class="relative w-full md:w-32 float-left before:h-0 before:block before:pb-[100%]">
471				<a href="${bundleUrl}" class="absolute top-0 left-0 disable-effect w-full h-full overflow-hidden bg-[#f5f1ec] rounded-md" aria-label="Item added to your cart" tabindex="-1">
472					<img src="${bundleImg}" class="object-cover h-full w-full top-0 left-0 absolute duration-300 image-hover z-0" alt="${bundleTitle}" loading="lazy" width="150" height="150">
473				</a>
474			</div>
475		</td>
476		<td class="md:w-5/12 pt-7 pb-0 px-5 md:pt-5 md:pb-5 lg:pl-9 lg:pr-14 col-start-2 col-end-5 md:col-end-4 align-top">
477			<div>
478				<a href="${bundleUrl}" class="text-[rgba(var(--colors-heading))] font-bold table disable-effect hover-text-link p-break-words mb-1.5">
479					${bundleTitle}
480				</a>
481			</div>
482			<dl class="text-normal pb-1.5">
483			</dl>
484			<div class="rebuy-cart__flyout-item-properties">
485				<span><b>Bundle Products</b></span>
486				${bundleProductsTitleProp(item)}
487			</div>
488			<div class="price mb-1.5 md:hidden">
489				<s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(bundleSlashedOutPrice)}</s>
490				<span class="selection:bg-text-[rgb(var(--colors-price-sale),0.2)] text-[#6b2e16] font-semibold">
491					${formatMoney(bundleSalePrice)}
492				</span>
493			</div>
494			${bundleOffValue?`
495			<ul class="w-fit p-1 bg-[#6b2e16] lg:mb-0 rounded-md mt-2">
496				<li class="flex text-white relative x-discount items-center gap-2">
497					<span class="leading-none text-normal discount-title">${bundleOffValue}</span>
498				</li>
499			</ul>
500			`:""}
501		</td>
502		<td class="lg:pl-2 pt-0 pb-5 pl-5 mt-2 md:pr-5 lg:pr-0 md:mt-3.5 md:pl-0 md:pt-5 rtl:pr-5 rtl:md:pr-0 rtl:md:pl-5 rtl:lg:pl-0 col-start-2 col-end-4 flex items-center md:table-cell md:align-top">
503			<div class="x-cart-item-quantity flex justify-center">
504				<div class="flex flex-row md:flex-col items-center gap-2">
505					<div class="relative flex w-28 h-10 border border-solid justify-between rounded-full">
506						<button class="items-center w-1/3 justify-center flex opacity-70 cursor-pointer quantity-selector__button-dec quantity-button-decrease" aria-label="button-minus" data-no-instant="">
507							<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" class="w-3" fill="none" viewBox="0 0 10 2">
508								<path fill-rule="evenodd" clip-rule="evenodd" d="M.5 1C.5.7.7.5 1 .5h8a.5.5 0 110 1H1A.5.5 0 01.5 1z" fill="currentColor"></path>
509							</svg>
510						</button>
511						<span class="cart-item-qty outer-spin-button bg-transparent w-1/3 text-center pt-2 pb-2 placeholder:opacity-60 focus-within:outline-none quantity-selector__input" aria-label="Quantity for ${bundleTitle}">${item.quantity}</span>
512						<button class="items-center w-1/3 justify-center flex opacity-70 cursor-pointer quantity-selector__button-inc quantity-button-increase" aria-label="button-plus" data-no-instant="">
513							<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" role="presentation" class="w-3" fill="none" viewBox="0 0 10 10">
514								<path fill-rule="evenodd" clip-rule="evenodd" d="M1 4.51a.5.5 0 000 1h3.5l.01 3.5a.5.5 0 001-.01V5.5l3.5-.01a.5.5 0 00-.01-1H5.5L5.49.99a.5.5 0 00-1 .01v3.5l-3.5.01H1z" fill="currentColor"></path>
515							</svg>
516						</button>
517					</div>
518				</div>
519			</div>
520		</td>
521		<td class="pb-5 md:pt-5 md:table-cell md:align-top lg:w-2/12 lg:pl-2">
522			<div class="flex justify-end">
523				<div class="price cart-item-price-1 hidden md:flex md:flex-wrap md:flex-col text-right">
524					<s class="cap mr-1 rtl:ml-1 rtl:mr-0 inline-block opacity-50 text-[#1a1a1a]">${formatMoney(bundleSlashedOutPrice)}</s>
525					<span class="text-[#6b2e16] font-semibold">${formatMoney(bundleSalePrice)}</span>
526				</div>
527			</div>
528		</td>
529   `}function bundleLineItemMarkup(item){const bundleCodeProp=item.properties._bundle_hash,bundleTitle=item.properties._bundle_title,bundleSlashedOutPrice=parseFloat(item.properties._bundle_slashed_out_price||0)/(item.quantity||1),bundleSalePrice=parseFloat(item.properties._bundle_sale_price||0)/(item.quantity||1);let bundleOffValue=item.properties._bundle_off_value;const bundleImg=item.properties._bundle_img,bundleUrl=item.properties._bundle_url;function bundleProductsTitleProp(item2){var string="";for(const[key,value]of Object.entries(item2.properties._bundle_products)){const formattedKey="Bundle "+key.charAt(0).toUpperCase()+key.slice(1).replace(/_/g," ");if(key.includes("product")&&value){let propertyString=`
530        <div class="rebuy-cart__flyout-item-property"><span class="rebuy-cart__flyout-item-property-name">${formattedKey}</span> <span class="rebuy-cart__flyout-item-property-separator">
531          -
532          </span> 
533           <span class="rebuy-cart__flyout-item-property-value">${value.replace(/Pro-Pod™\s*\/\s*30mL/g,"Pro-Pod\u2122").replace(/20\s?ml/gi,"One Month Supply")}
534            </span>
535        </div>
536        `;string=string.concat(propertyString)}}return string}return`
537      <div class="rebuy-cart__flyout-item-media">
538        <a href="${bundleUrl}" tabindex="-1">
539          <img src="${bundleImg} alt="${bundleTitle}"></a>
540      </div>
541      <div class="rebuy-cart__flyout-item-info">
542        <a
543          role="heading"
544          aria-level="5"
545          href="${bundleUrl}"
546          alt="View ${bundleTitle}"
547          class="rebuy-cart__flyout-item-product-title">${bundleTitle}</a>
548        <div class="rebuy-cart__flyout-item-discount-message">${bundleOffValue}</div>
549        <div class="rebuy-cart__flyout-item-properties">
550        ${bundleProductsTitleProp(item)}
551      </div>
552        <!---->
553        <button
554          type="button"
555          alt="Remove ${bundleTitle}"
556          aria-label="Remove ${bundleTitle}"
557          class="rebuy-cart__flyout-item-remove line-item__remove-button">
558          <i aria-hidden="true" class="far fa-trash"></i>
559        </button>
560        <div class="rebuy-cart__flyout-item-quantity">
561          <div class="rebuy-cart__flyout-item-quantity-widget">
562            <button
563              alt="Decrease quantity of ${bundleTitle}"
564              aria-label="Decrease quantity of ${bundleTitle}"
565              type="button"
566              class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-decrease quantity-selector__button-dec">
567              <i aria-hidden="true" class="far fa-minus"></i>
568            </button>
569            <span class="rebuy-cart__flyout-item-quantity-widget-label quantity-selector__input">
570              ${item.quantity}
571            </span>
572            <button
573              alt="Increase quantity of ${bundleTitle}"
574              aria-label="Increase quantity of ${bundleTitle}"
575              type="button"
576              class="rebuy-cart__flyout-item-quantity-widget-button quantity-button-increase quantity-selector__button-inc">
577              <i aria-hidden="true" class="far fa-plus"></i>
578            </button>
579          </div>
580        </div>
581        <div class="rebuy-cart__flyout-item-price">
582          <div>
583            <span class="rebuy-money sale">
584              <span class="sr-only">Sale price</span>
585              <span>${bundleSalePrice}</span>
586            </span>
587            <span class="rebuy-money compare-at">
588              <span class="sr-only">Original price</span>
589              <span>${bundleSlashedOutPrice}</span>
590            </span>
591          </div>
592          <!---->
593        </div>
594        <!---->
595      </div>
596  `}async function getbundleProducts(bundleProp,bundleId){const{items}=await fetchCart();let bundleProducts=[];return items.map(item=>{(bundleProp==="_bundle_id"?getBundleDisplayId(item):item.properties[bundleProp])==bundleId&&bundleProducts.push(item)}),bundleProducts}async function refreshCartState(){if(window.Rebuy?.Cart?.fetchShopifyCart)return await new Promise(resolve=>{Rebuy.Cart.fetchShopifyCart(cart2=>resolve(cart2))});const cart=await fetchCart();
596return window.Rebuy?.Cart&&(Rebuy.Cart.cart=cart),cart}function updateLineItemWithQty(bundleProducts,bundleQty){return new Promise((resolve,reject)=>{if(!bundleProducts.length)return resolve();const newObj={};bundleProducts.forEach(item=>{const perBundleQty=getPerBundleQty(item,bundleProducts);newObj[item.key.toString()]=bundleQty*perBundleQty}),jQuery.post(window.Shopify.routes.root+"cart/update.js",{updates:newObj}).done(async()=>{const cart=await refreshCartState();resolve(cart)}).fail(error=>{console.log(error),reject(error)})})}async function addBundleUnit(bundleProducts){const bundleInstanceId=`_bundle_instance_${Date.now()}_${Math.random().toString(36).slice(2)}`,bundleGroupId=getBundleDisplayId(bundleProducts[0]),lineItemsByVariant=new Map;return bundleProducts.forEach(item=>{const sellingPlanId=item.selling_plan_allocation?.selling_plan?.id||null,variantKey=`${item.id}_${sellingPlanId||"one_time"}`;if(lineItemsByVariant.has(variantKey))return;const perBundleQty=getPerBundleQty(item,bundleProducts),lineItem={id:item.id,quantity:perBundleQty,properties:{...item.properties||{},_bundle_id:`${bundleGroupId}_${bundleInstanceId}`,_bundle_group_id:bundleGroupId,_bundle_qty:perBundleQty,_bundle_instance_id:bundleInstanceId}};sellingPlanId&&(lineItem.selling_plan=sellingPlanId),lineItemsByVariant.set(variantKey,lineItem)}),await fetch(window.Shopify.routes.root+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:Array.from(lineItemsByVariant.values())})}),await refreshCartState()}async function removeBundleUnit(bundleProducts){const updates={},instanceGroups={};bundleProducts.forEach(item=>{const instanceId=item.properties?._bundle_instance_id||"__legacy__";instanceGroups[instanceId]||(instanceGroups[instanceId]=[]),instanceGroups[instanceId].push(item)});const removableInstanceId=Object.keys(instanceGroups).find(instanceId=>instanceId!=="__legacy__");return removableInstanceId?instanceGroups[removableInstanceId].forEach(item=>{updates[item.key.toString()]=0}):bundleProducts.forEach(item=>{const perBundleQty=getPerBundleQty(item,bundleProducts);updates[item.key.toString()]=Math.max(0,parseInt(item.quantity||1)-perBundleQty)}),await jQuery.post(window.Shopify.routes.root+"cart/update.js",{updates}),await refreshCartState()}async function updateBundleIdLineItemWithQty(bundleProducts,bundleQty){let currentBundleQty=getBundleUnitCount(bundleProducts);const bundleGroupId=getBundleDisplayId(bundleProducts[0]);for(;bundleQty>currentBundleQty;)await addBundleUnit(bundleProducts),bundleProducts=await getbundleProducts("_bundle_id",bundleGroupId),currentBundleQty=getBundleUnitCount(bundleProducts);for(;bundleQty<currentBundleQty;)await removeBundleUnit(bundleProducts),bundleProducts=await getbundleProducts("_bundle_id",bundleGroupId),currentBundleQty=bundleProducts.length?getBundleUnitCount(bundleProducts):0;return await refreshCartState()}async function rerenderBundleLineItem(bundleProp){bundleProp==="_bundle_id"?await renderStarterKitLineItems():bundleProp==="_bundle_set"?await renderBundleSetLineItems():bundleProp==="_bundle_hash"?await renderBundleLineItems():bundleProp==="_fp_id"&&await renderFpLineItems()}async function attachELToLineItem(){let staticLineItems=document.querySelectorAll(".static-line-item");for(let i=0;i<staticLineItems.length;i++){const lineItem=staticLineItems[i];let removeBtns=lineItem.querySelectorAll(".line-item__remove-button"),qtyIncBtns=lineItem.querySelectorAll(".quantity-selector__button-inc"),qtyDecBtns=lineItem.querySelectorAll(".quantity-selector__button-dec"),qtyTexts=lineItem.querySelectorAll(".quantity-selector__input"),lineBundleId=lineItem.id,bundleProp=lineItem.dataset.type;removeBtns.forEach(removeBtn=>{removeBtn.hasAttribute("data-listener-attached")||(removeBtn.addEventListener("click",async function(event){const bundleProducts=await getbundleProducts(bundleProp,lineBundleId);try{await updateLineItemWithQty(bundleProducts,0),lineItem.remove()}catch(error){console.log("Error updating quantity:",error)}}),removeBtn.setAttribute("data-listener-attached","true"))}),qtyIncBtns.forEach(qtyIncBtn=>{qtyIncBtn.hasAttribute("data-listener-attached")||(qtyIncBtn.addEventListener("click",async function(event){const bundleProducts=await getbundleProducts(bundleProp,lineBundleId),oldQty=parseInt(qtyTexts[0].innerText);let qtyTextInt=oldQty+1;console.log(`[Cart] Quantity increased for bundle ID: ${lineBundleId}`,{bundleType:bundleProp,oldQuantity:oldQty,newQuantity:qtyTextInt,itemCount:bundleProducts.length,timestamp:new Date().toISOString()});try{bundleProp==="_bundle_id"?await updateBundleIdLineItemWithQty(bundleProducts,qtyTextInt):await updateLineItemWithQty(bundleProducts,qtyTextInt),await rerenderBundleLineItem(bundleProp),qtyTexts.forEac
596h(qtyTxt=>{qtyTxt.innerText=qtyTextInt})}catch(error){console.log("Error updating quantity:",error)}}),qtyIncBtn.setAttribute("data-listener-attached","true"))}),qtyDecBtns.forEach(qtyDecBtn=>{qtyDecBtn.hasAttribute("data-listener-attached")||(qtyDecBtn.addEventListener("click",async function(event){const bundleProducts=await getbundleProducts(bundleProp,lineBundleId),oldQty=parseInt(qtyTexts[0].innerText);let qtyTextInt=oldQty-1;console.log(`[Cart] Quantity decreased for bundle ID: ${lineBundleId}`,{bundleType:bundleProp,oldQuantity:oldQty,newQuantity:qtyTextInt,itemCount:bundleProducts.length,timestamp:new Date().toISOString()});try{bundleProp==="_bundle_id"?await updateBundleIdLineItemWithQty(bundleProducts,qtyTextInt):await updateLineItemWithQty(bundleProducts,qtyTextInt),qtyTextInt==0?lineItem.remove():(await rerenderBundleLineItem(bundleProp),qtyTexts.forEach(qtyTxt=>{qtyTxt.innerText=qtyTextInt}))}catch(error){console.log("Error updating quantity:",error)}}),qtyDecBtn.setAttribute("data-listener-attached","true"))})}}document.addEventListener("rebuy:smartcart.show",event=>{setTimeout(()=>{const{items}=Rebuy.Cart.cart;items.some(item=>item.properties?._bundle_id)&&renderStarterKitLineItems(),items.some(item=>item.properties?._bundle_set)&&renderBundleSetLineItems()},1e3)});const bundleATCBtn=document.querySelector(".bundle-add-to-cart__btn");bundleATCBtn&&bundleATCBtn.addEventListener("click",function(){setTimeout(async()=>{await renderBundleLineItems()},2e3)}),isCartPage?(async()=>{const cart=await fetchCart();cart.items.some(item=>item.properties?._bundle_id)&&await renderStarterKitLineItems(),cart.items.some(item=>item.properties?._bundle_hash)&&await renderBundleLineItems(),cart.items.some(item=>item.properties?._fp_id)&&await renderFpLineItems(),cart.items.some(item=>item.properties?._bundle_set)&&await renderBundleSetLineItems()})():document.addEventListener("rebuy:smartcart.ready",async()=>{const{items}=Rebuy.Cart.cart;items.length&&(items.some(item=>item.properties?._bundle_id)&&await renderStarterKitLineItems(),items.some(item=>item.properties?._bundle_set)&&await renderBundleSetLineItems(),items.some(item=>item.properties?._bundle_hash)&&await renderBundleLineItems(),items.some(item=>item.properties?._fp_id)&&await renderFpLineItems())}),document.addEventListener("eurus:cart:items-changed",async()=>{isCartPage&&setTimeout(async()=>{let items;window.Rebuy?items=Rebuy.Cart.cart.items:items=(await fetchCart()).items,!(!items||!items.length)&&(items.length&&(items.some(item=>item.properties?._bundle_id)&&await renderStarterKitLineItems(),items.some(item=>item.properties?._bundle_set)&&await renderBundleSetLineItems(),items.some(item=>item.properties?._bundle_hash)&&await renderBundleLineItems(),items.some(item=>item.properties?._fp_id)&&await renderFpLineItems()),console.log("cart items changed"))},1e3)});
597//# sourceMappingURL=/cdn/shop/t/2243/assets/cart-product-bundles.js.map?v=36363520481301557641788893986

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.