1customElements.get("quick-add-modal")||customElements.define("quick-add-modal",class extends ModalDialog{constructor(){super(),this.modalContent=this.querySelector('[id^="QuickAddInfo-"]'),this.subscriptionObserver=null,this.addEventListener("product-info:loaded",({target})=>{target.addPreProcessCallback(this.preprocessHTML.bind(this)),this.preselectSubscription(this.openedBy,target)})}hide(preventFocus=!1){const cartNotification=document.querySelector("cart-notification")||document.querySelector("cart-drawer");cartNotification&&cartNotification.setActiveElement(this.openedBy),this.modalContent.innerHTML="",this.subscriptionObserver?.disconnect(),this.subscriptionObserver=null,preventFocus&&(this.openedBy=null),super.hide()}show(opener){opener.setAttribute("aria-disabled",!0),opener.classList.add("loading"),opener.querySelector(".loading__spinner").classList.remove("hidden"),fetch(opener.getAttribute("data-product-url")).then(response=>response.text()).then(responseText=>{const productElement=new DOMParser().parseFromString(responseText,"text/html").querySelector("product-info");this.preprocessHTML(productElement),HTMLUpdateUtility.setInnerHTML(this.modalContent,productElement.outerHTML),window.Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init(),window.ProductModel&&window.ProductModel.loadShopifyXR(),super.show(opener),this.watchForSubscriptionWidget(opener)}).finally(()=>{opener.removeAttribute("aria-disabled"),opener.classList.remove("loading"),opener.querySelector(".loading__spinner").classList.add("hidden")})}watchForSubscriptionWidget(opener){if(opener?.dataset.selectSubscription!=="true"||this.preselectSubscription(opener,this.modalContent))return;this.subscriptionObserver?.disconnect();let attempts=0;this.subscriptionObserver=new MutationObserver(()=>{attempts+=1,(this.preselectSubscription(opener,this.modalContent)||attempts>=100)&&(this.subscriptionObserver?.disconnect(),this.subscriptionObserver=null)}),this.subscriptionObserver.observe(this.modalContent,{childList:!0,subtree:!0}),setTimeout(()=>{this.subscriptionObserver?.disconnect(),this.subscriptionObserver=null,this.preselectSubscription(opener,this.modalContent)},5e3)}preselectSubscription(opener,container){if(opener?.dataset.selectSubscription!=="true"||!container)return!1;const sellingPlanId=opener.dataset.sellingPlanId;return this.selectRechargeSubscription(container,sellingPlanId)?!0:this.setProductFormSellingPlan(container,sellingPlanId)}selectRechargeSubscription(container,sellingPlanId){const widget=container.querySelector("recharge-subscription-widget");return!!(widget&&this.clickSubscriptionOptionInRoot(widget,sellingPlanId)||this.clickSubscriptionOptionInRoot(container,sellingPlanId))}clickSubscriptionOptionInRoot(node,sellingPlanId){if(this.clickSubscriptionOption(node,sellingPlanId))return!0;const elements=node.querySelectorAll?node.querySelectorAll("*"):[];for(const element of elements)if(element.shadowRoot&&this.clickSubscriptionOptionInRoot(element.shadowRoot,sellingPlanId))return!0;return!1}clickSubscriptionOption(root,sellingPlanId){const subscriptionSelectors=['.rc-purchase-option__subscription input[type="radio"]',".rc-purchase-option__subscription .rc-purchase-option__input",'.rc_widget__option--autodeliver input[type="radio"]',".rc_widget__option--autodeliver",'.rc-option--subscription input[type="radio"]'];for(const selector of subscriptionSelectors){const option=root.querySelector(selector);if(option&&this.activateSubscriptionOption(option,root,sellingPlanId))return!0}const radios=root.querySelectorAll(".rc-template__radio-group .rc-radio, .rc-radio-group__options .rc-radio");for(const radio of radios){if(!/subscribe|subscription|autodeliver/i.test(radio.textContent))continue;const option=radio.querySelector('input[type="radio"], input[type="checkbox"], label, button')||radio;if(this.activateSubscriptionOption(option,root,sellingPlanId))return!0}if(radios.length>=2){const option=radios[1].querySelector('input[type="radio"], input[type="checkbox"], label, button')||radios[1];return this.activateSubscriptionOption(option,root,sellingPlanId)}return!1}activateSubscriptionOption(option,root,sellingPlanId){return option?(option.type==="radio"||option.type==="checkbox")&&option.checked?(this.setSellingPlanSelect(root,sellingPlanId),!0):(option.click(),this.setSellingPlanSelect(root,sellingPlanId),!0):!1}setSellingPlanSelect(root,sellingPlanId){sellingPlanId&&this.forEachRootNode(root,scope=>{scope.querySelectorAll('select[name="selling_plan"], .rc-selling-plans select, select.rc-plans-select, select.rc-plans-dropdown__select').forEach(select=>{const matchingOption=Array.from(select.options).find(option=>option.value===sellingPlanId||option.dataset.sellingPlanId===sellingPlanId);matchingOption&&select.value!==matchingOption.value&&(select.value=matchingOption.value,select.dispatchEvent(new Event("change",{bubbles:!0})))})})}forEachRootNode(root,callback){callback(root);const elements=root.querySelectorAll?root.querySelectorAll("*"):[];for(const element of elements)element.shadowRoot&&this.forEachRootNode(element.shadowRoot,callback)}setProductFormSellingPlan(container,sellingPlanId){if(!sellingPlanId)return!1;let updated=!1;return container.querySelectorAll('form input[name="selling_plan"]').forEach(input=>{input.value!==sellingPlanId&&(input.value=sellingPlanId,input.dispatchEvent(new Event("change",{bubbles:!0})),updated=!0)}),updated}preprocessHTML(productElement){productElement.classList.forEach(classApplied=>{(classApplied.startsWith("color-")||classApplied==="gradient")&&this.modalContent.classList.add(classApplied)}),this.preventDuplicatedIDs(productElement),this.removeDOMElements(productElement),this.removeGalleryListSemantic(productElement),this.updateImageSizes(productElement),this.preventVariantURLSwitching(productElement)}preventVariantURLSwitching(productElement){productElement.setAttribute("data-update-url","false")}removeDOMElements(productElement){const pickupAvailability=productElement.querySelector("pickup-availability");pickupAvailability&&pickupAvailability.remove();const productModal=productElement.querySelector("product-modal");productModal&&productModal.remove();const modalDialog=productElement.querySelectorAll("modal-dialog");modalDialog&&modalDialog.forEach(modal=>modal.remove())}preventDuplicatedIDs(productElement){const sectionId=productElement.dataset.section,oldId=sectionId,newId=`quickadd-${sectionId}`;productElement.innerHTML=productElement.innerHTML.replaceAll(oldId,newId),Array.from(productElement.attributes).forEac
1h(attribute=>{attribute.value.includes(oldId)&&productElement.setAttribute(attribute.name,attribute.value.replace(oldId,newId))}),productElement.dataset.originalSection=sectionId}removeGalleryListSemantic(productElement){const galleryList=productElement.querySelector('[id^="Slider-Gallery"]');galleryList&&(galleryList.setAttribute("role","presentation"),galleryList.querySelectorAll('[id^="Slide-"]').forEach(li=>li.setAttribute("role","presentation")))}updateImageSizes(productElement){const product=productElement.querySelector(".product");if(!product?.classList.contains("product--columns"))return;const mediaImages=product.querySelectorAll(".product__media img");if(!mediaImages.length)return;let mediaImageSizes="(min-width: 1000px) 715px, (min-width: 750px) calc((100vw - 11.5rem) / 2), calc(100vw - 4rem)";product.classList.contains("product--medium")?mediaImageSizes=mediaImageSizes.replace("715px","605px"):product.classList.contains("product--small")&&(mediaImageSizes=mediaImageSizes.replace("715px","495px")),mediaImages.forEach(img=>img.setAttribute("sizes",mediaImageSizes))}}); 2//# sourceMappingURL=/cdn/shop/t/367/assets/quick-add.js.map?v=121245695382992664061790871526
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.