1(function(){const SELECTORS={bundleRoot:"[data-bundle-options]",bundleOption:"[data-bundle-option]",productFormEl:"product-form",addToCartForm:'form[action="/cart/add"]',qtyInput:'input[name="quantity"]',priceAmounts:".product-price-container ins .amount, .main-product-2026__price ins .amount",priceRoots:".product-price-container .price, .main-product-2026__price .price"};function parseVariantIds(raw){try{const arr=JSON.parse(raw);return Array.isArray(arr)?arr.map(n=>String(n)).filter(Boolean):[]}catch{return[]}}function formatMoney(cents){if(typeof window.Shopify?.formatMoney=="function"){const fmt=window.theme?.moneyFormat||"${{amount}}";return window.Shopify.formatMoney(cents,fmt)}const n=Number(cents);return Number.isFinite(n)?`$${(n/100).toFixed(2)}`:null}function normalizeText(value){return String(value||"").replace(/\s+/g," ").trim()}function findWhatsIncludedList(root){const containers=[root,document];for(const container of containers){const accordions=Array.from(container.querySelectorAll("collapsible-row.product__accordion"));for(const accordion of accordions){const summary=accordion.querySelector("summary");if(!summary||!normalizeText(summary.textContent).toUpperCase().includes("WHAT'S INCLUDED"))continue;const list=accordion.querySelector(".accordion__content")?.querySelector("ul");if(list)return list}}return null}function syncWhatsIncludedCompanion(root,companionName){const list=findWhatsIncludedList(root);if(!list)return;list.querySelectorAll('[data-bundle-whats-included-item="true"]').forEach(item=>item.remove());const normalizedCompanionName=normalizeText(companionName);if(!normalizedCompanionName)return;const dynamicLi=document.createElement("li");dynamicLi.textContent=normalizedCompanionName,dynamicLi.setAttribute("data-bundle-whats-included-item","true");const secondBullet=list.children[1];secondBullet?list.insertBefore(dynamicLi,secondBullet):list.appendChild(dynamicLi)}function setDisplayedPrice(root,cents){const formatted=formatMoney(cents);if(!formatted)return;root.querySelectorAll(SELECTORS.priceAmounts).forEach(el=>{el.textContent=formatted}),typeof window.applyStrikethroughPrices=="function"&&window.applyStrikethroughPrices(window.discountPercentage||0);const sectionId=root.querySelector(SELECTORS.productFormEl)?.dataset?.section;sectionId&&([`price-${sectionId}`,`price-${sectionId}--sticky`].forEach(id=>{const node=document.getElementById(id);node&&node.querySelectorAll("ins .amount").forEach(el=>el.textContent=formatted)}),typeof window.applyStrikethroughPrices=="function"&&window.applyStrikethroughPrices(window.discountPercentage||0))}function setBundleComparePrice(root,compareCents,priceCents){const shouldShow=Number.isFinite(compareCents)&&compareCents>0&&Number.isFinite(priceCents)&&compareCents!==priceCents,formatted=shouldShow?formatMoney(compareCents):null;function applyTo(priceEl){let del=priceEl.querySelector("del");if(!shouldShow||!formatted){del&&del.remove();return}if(!del){del=document.createElement("del");const amount=document.createElement("span");amount.className="amount",del.appendChild(amount);const ins=priceEl.querySelector("ins");ins?priceEl.insertBefore(del,ins):priceEl.insertBefore(del,priceEl.firstChild)}const amountEl=del.querySelector(".amount")||del;amountEl.textContent=formatted}root.querySelectorAll(SELECTORS.priceRoots).forEach(applyTo);const sectionId=root.querySelector(SELECTORS.productFormEl)?.dataset?.section;sectionId&&[`price-${sectionId}`,`price-${sectionId}--sticky`].forEach(id=>{const node=document.getElementById(id);node&&node.querySelectorAll(".price").forEach(applyTo)})}function getSectionsToRender(){return[{id:"Cart",section:"main-cart",selector:".thb-cart-form"},{id:"Cart-Drawer",section:"cart-drawer",selector:".side-panel-content"},{id:"Cart-Drawer",section:"cart-drawer",selector:".side-panel-footer"},{id:"cart-drawer-toggle",section:"cart-bubble",selector:".thb-item-count"}]}function getSectionInnerHTML(html,selector=".shopify-section"){return new DOMParser().parseFromString(html,"text/html").querySelector(selector)?.innerHTML||""}
1function renderCartDrawer(resp){getSectionsToRender().forEach(e=>{const host=document.getElementById(e.id);if(!host)return;const target=host.querySelector(e.selector)||host;target.innerHTML=getSectionInnerHTML(resp.sections?.[e.section]||"",e.selector),typeof CartDrawer<"u"&&new CartDrawer,typeof Cart<"u"&&new Cart().renderContents(resp)});const cartDrawer=document.getElementById("Cart-Drawer");cartDrawer&&(document.body.classList.add("open-cc","open-cart"),cartDrawer.classList.add("active"),typeof dispatchCustomEvent=="function"&&dispatchCustomEvent("cart-drawer:open"))}async function addBundleToCart({variantIds,quantity,sections,sectionsUrl}){const payload={items:variantIds.map(id=>({id,quantity})),sections,sections_url:sectionsUrl};return await(await fetch(window.Shopify.routes.root+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload)})).json()}function getCurrentVariantIdFromForm(addForm){const idInput=addForm.querySelector('input[name="id"]');return idInput?.value?String(idInput.value):null}function getCurrentDisplayedPriceCentsFromVariantSelects(root){const currentVariant=root.querySelector("variant-selects")?.currentVariant;return currentVariant?.price!=null?Number(currentVariant.price):null}function getCurrentCompareAtCentsFromVariantSelects(root){const currentVariant=root.querySelector("variant-selects")?.currentVariant;return currentVariant?.compare_at_price!=null?Number(currentVariant.compare_at_price):null}function wireBundleUI(root){const bundleRoot=root.querySelector(SELECTORS.bundleRoot);if(!bundleRoot)return;const options=Array.from(bundleRoot.querySelectorAll(SELECTORS.bundleOption));if(!options.length)return;const productFormEl=root.querySelector(SELECTORS.productFormEl),addForm=productFormEl?.querySelector(SELECTORS.addToCartForm);if(!productFormEl||!addForm)return;const state={selectedType:"default",selectedVariantIds:[],selectedPriceCents:null,selectedCompareCents:null},defaultBtn=options.find(b=>(b.getAttribute("data-bundle-type")||"")==="default")||null;function emitBundleChange(type,owner){window.dispatchEvent(new CustomEvent("bundle:change",{detail:{type,owner:owner||"default"}}))}function setSelected(btn){options.forEach(b=>b.classList.toggle("is-selected",b===btn));const type=btn.getAttribute("data-bundle-type")||"bundle";state.selectedType=type;const ids=parseVariantIds(btn.getAttribute("data-bundle-variant-ids")||"[]");state.selectedVariantIds=ids;const rawPrice=btn.getAttribute("data-bundle-price"),priceCents=Number(rawPrice);state.selectedPriceCents=Number.isFinite(priceCents)?priceCents:null;const rawComparePrice=btn.getAttribute("data-bundle-compare-price"),compareCents=Number(rawComparePrice);state.selectedCompareCents=Number.isFinite(compareCents)?compareCents:null,state.selectedPriceCents!=null&&(setDisplayedPrice(root,state.selectedPriceCents),setBundleComparePrice(root,state.selectedCompareCents,state.selectedPriceCents)),type==="default"?(syncWhatsIncludedCompanion(root,""),emitBundleChange("default","default")):(syncWhatsIncludedCompanion(root,btn.getAttribute("data-bundle-companion-name")||""),emitBundleChange("bundle",btn.getAttribute("data-bundle-owner")||"default"))}function syncDefaultOptionToCurrentVariant(){if(!defaultBtn)return;const currentVariantId=getCurrentVariantIdFromForm(addForm);currentVariantId&&defaultBtn.setAttribute("data-bundle-variant-ids",`[${currentVariantId}]`);const cents=getCurrentDisplayedPriceCentsFromVariantSelects(root),compareCents=getCurrentCompareAtCentsFromVariantSelects(root);Number.isFinite(cents)&&defaultBtn.setAttribute("data-bundle-price",String(cents)),Number.isFinite(compareCents)&&defaultBtn.setAttribute("data-bundle-compare-price",String(compareCents)),state.selectedType==="default"&&Number.isFinite(cents)&&(setDisplayedPrice(root,cents),setBundleComparePrice(root,Number.isFinite(compareCents)?compareCents:null,cents))}options.forEach(btn=>btn.addEventListener("click",()=>setSelected(btn))),defaultBtn&&setSelected(defaultBtn),syncDefaultOptionToCurrentVariant(),root.addEventListener("product:variant-change",()=>{syncDefaultOptionToCurrentVariant()});
1async function handleBundleSubmit(e,source){e.preventDefault(),e.stopPropagation(),typeof e.stopImmediatePropagation=="function"&&e.stopImmediatePropagation();const atcButtons=root.querySelectorAll(".single-add-to-cart-button");atcButtons.forEach(b=>{b.classList.contains("loading")||(b.setAttribute("aria-disabled","true"),b.classList.add("loading"))});const qtyEl=addForm.querySelector(SELECTORS.qtyInput),quantity=Math.max(1,Number(qtyEl?.value||1)||1),sections=getSectionsToRender().map(t=>t.section),sectionsUrl=window.location.pathname;try{const resp=await addBundleToCart({variantIds:state.selectedVariantIds,quantity,sections,sectionsUrl});if(resp?.status){const errorWrapper=productFormEl.querySelector(".product-form__error-message-wrapper"),errorMsg=productFormEl.querySelector(".product-form__error-message");errorWrapper&&errorMsg&&(errorWrapper.toggleAttribute("hidden",!1),errorMsg.textContent=resp.description||resp.message||"Unable to add bundle to cart.");return}renderCartDrawer(resp),typeof dispatchCustomEvent=="function"&&dispatchCustomEvent("cart:item-added",{product:resp?.items?.[0]||resp})}catch{}finally{atcButtons.forEach(b=>{b.classList.remove("loading"),b.removeAttribute("aria-disabled")})}}productFormEl.addEventListener("submit",e=>handleBundleSubmit(e,"product-form element"),!0),addForm.addEventListener("submit",e=>handleBundleSubmit(e,"inner form"),!0)}function init(){document.querySelectorAll("product-form").forEach(productFormEl=>{const root=productFormEl.closest(".main-product-2026")||productFormEl.closest(".product-information--inner")||productFormEl;root.querySelector(SELECTORS.bundleRoot)&&wireBundleUI(root)});const legacyRoot=document.getElementById("ProductInfo-template--19419671363674__main-product");legacyRoot?.querySelector(SELECTORS.bundleRoot)&&wireBundleUI(legacyRoot)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",init):init()})(); 2//# sourceMappingURL=/cdn/shop/t/1009/assets/product-information.js.map?v=172448762328454458491789651959
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.