1import{executeJSmodules}from"@archetype-themes/utils/utils";class QuickShop extends HTMLElement{constructor(){super(),this.selectors={quickShopContainer:"[data-tool-tip-content]",blocksHolder:"[data-blocks-holder]",blocks:"[data-product-blocks]",form:".product-single__form"},!matchMedia("(max-width: 768px)").matches&&(this.addEventListener("tooltip:interact",async e=>{e.detail.context==="QuickShop"&&(this.quickShopData||(this.quickShopData=await this.loadQuickShopData(e)))}),this.addEventListener("tooltip:open",async e=>{if(e.detail.context==="QuickShop"){this.quickShopData||(this.quickShopData=await this.loadQuickShopData(e));const quickShopContainer=document.querySelector(this.selectors.quickShopContainer),clonedQuickShopData=this.quickShopData.cloneNode(!0);quickShopContainer.innerHTML="",quickShopContainer.appendChild(clonedQuickShopData),this.dispatchEvent(new CustomEvent("quickshop:opened",{bubbles:!0})),Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init();const scripts=document.querySelectorAll(`tool-tip [data-product-id="${this.prodId}"] script[type="module"]`);executeJSmodules(scripts)}}),this.addEventListener("quickshop:opened",async()=>{Shopify&&Shopify.PaymentButton&&Shopify.PaymentButton.init()}))}async loadQuickShopData(evt){const gridItem=evt.currentTarget.closest(".grid-product");if(this.handle=gridItem.firstElementChild.getAttribute("data-product-handle"),this.prodId=gridItem.firstElementChild.getAttribute("data-product-id"),!gridItem||!this.handle||!this.prodId)return;let url=`${window.Shopify.routes.root}/products/${this.handle}`;url=url.replace("//","/");try{const text=await(await fetch(url)).text(),responseHTML=new DOMParser().parseFromString(text,"text/html"),fragment=document.createDocumentFragment(),div=responseHTML.querySelector(`.page-content[data-product-id="${this.prodId}"]`);return this.processHTML(div),div&&(div.dataset.modal=!0,fragment.appendChild(div.cloneNode(!0))),window.dispatchEvent(new CustomEvent(`quickshop:loaded-${this.prodId}`)),fragment}catch(error){console.error("Error:",error)}}processHTML(productElement){this.removeBreadcrumbs(productElement),this.preventVariantURLSwitching(productElement)}removeBreadcrumbs(productElement){const breadcrumbs=productElement.querySelector(".breadcrumb");breadcrumbs&&breadcrumbs.remove()}preventVariantURLSwitching(productElement){const variantPicker=productElement.querySelector("block-variant-picker");variantPicker&&variantPicker.removeAttribute("data-update-url")}}customElements.define("quick-shop",QuickShop); 2//# sourceMappingURL=/cdn/shop/t/183/assets/quick-shop.js.map?v=169214600794817870211733903735
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.