customElements.get("quick-add-modal")||customElements.define("quick-add-modal",class extends ModalDialog{constructor(){super(),this.modalContent=this.querySelector('[id^="QuickAddInfo-"]')}hide(preventFocus=!1){const cartNotification=document.querySelector("cart-notification")||document.querySelector("cart-drawer");cartNotification&&cartNotification.setActiveElement(this.openedBy),this.modalContent.innerHTML="",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 responseHTML=new DOMParser().parseFromString(responseText,"text/html");this.productElement=responseHTML.querySelector('section[id^="MainProduct-"]'),this.productElement.classList.forEach(classApplied=>{(classApplied.startsWith("color-")||classApplied==="gradient")&&this.modalContent.classList.add(classApplied)}),this.preventDuplicatedIDs(),this.removeDOMElements(),this.setInnerHTML(this.modalContent,this.productElement.innerHTML),window.Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init(),window.ProductModel&&window.ProductModel.loadShopifyXR(),this.removeGalleryListSemantic(),this.updateImageSizes(),this.preventVariantURLSwitching(),super.show(opener)}).finally(()=>{opener.removeAttribute("aria-disabled"),opener.classList.remove("loading"),opener.querySelector(".loading__spinner").classList.add("hidden")})}setInnerHTML(element,html){element.innerHTML=html,element.querySelectorAll("script").forEach(oldScriptTag=>{const newScriptTag=document.createElement("script");Array.from(oldScriptTag.attributes).forEach(attribute=>{newScriptTag.setAttribute(attribute.name,attribute.value)}),newScriptTag.appendChild(document.createTextNode(oldScriptTag.innerHTML)),oldScriptTag.parentNode.replaceChild(newScriptTag,oldScriptTag)})}preventVariantURLSwitching(){const variantPicker=this.modalContent.querySelector("variant-radios,variant-selects");variantPicker&&variantPicker.setAttribute("data-update-url","false")}removeDOMElements(){const pickupAvailability=this.productElement.querySelector("pickup-availability");pickupAvailability&&pickupAvailability.remove();const productModal=this.productElement.querySelector("product-modal");productModal&&productModal.remove();const modalDialog=this.productElement.querySelectorAll("modal-dialog");modalDialog&&modalDialog.forEach(modal=>modal.remove())}preventDuplicatedIDs(){const sectionId=this.productElement.dataset.section;this.productElement.innerHTML=this.productElement.innerHTML.replaceAll(sectionId,`quickadd-${sectionId}`),this.productElement.querySelectorAll("variant-selects, variant-radios, product-info").forEach(element=>{element.dataset.originalSection=sectionId})}removeGalleryListSemantic(){const galleryList=this.modalContent.querySelector('[id^="Slider-Gallery"]');galleryList&&(galleryList.setAttribute("role","presentation"),galleryList.querySelectorAll('[id^="Slide-"]').forEach(li=>li.setAttribute("role","presentation")))}updateImageSizes(){const product=this.modalContent.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))}}); //# sourceMappingURL=/cdn/shop/t/21/assets/quick-add.js.map?v=89084998881394762061731113568