1if(!customElements.get("products-resume")){class ComponentProductsResume extends HTMLElement{constructor(){super(),this.productMain=this.closest("product-main"),this.addForm=this.productMain.querySelector("add-to-cart-form"),this.mainProductData=JSON.parse(this.productMain.querySelector('[type="application/json"][data-product-json]').textContent),this.list=this.querySelector(".resume-list"),this.listedProducts=[],this.addonInputs=this.addForm.querySelectorAll("input[data-name]:not(.addon-qtty)"),this.mainVariantSelector=this.addForm.querySelector("product-variants input[name]"),this.mainQttyInput=this.addForm.querySelector("input.quantity-input"),this.mulberryInput=this.productMain.querySelector("input#mulberry-addon"),this.initEvents(),this.checkaddonInputs()}initEvents(){var inputsToInit=[];inputsToInit.push(this.mainQttyInput),inputsToInit.push(this.mainVariantSelector),this.mulberryInput&&inputsToInit.push(this.mulberryInput),this.addonInputs.forEach(input=>{inputsToInit.push(input)}),inputsToInit.forEach(input=>{input.addEventListener("change",()=>{this.checkaddonInputs()})}),this.addMutationCallback()}addMutationCallback(){const mutationCallback=mutationsList=>{for(const mutation of mutationsList)mutation.type==="attributes"&&this.checkaddonInputs()},observer=new MutationObserver(mutationCallback);this.addonInputs.forEach(addonInput=>{observer.observe(addonInput,{attributes:!0})})}getResumeElements(resumeData,qtty){var productElements=[];return resumeData.resume_values.forEach(element=>{if(resumeData.metafield_value){var splitElement=element.split(/\/(.*)/),qttyNumber=Number(splitElement[0])||1,name=splitElement[1]||element;productElements.push({qtty:qtty*qttyNumber,name})}else productElements.push({qtty,name:element})}),productElements}getMainProductElements(){const resumeData=this.mainProductData.resume_data.find(x=>x.id==this.mainVariantSelector.value);return this.getResumeElements(resumeData,this.mainQttyInput.value)}checkaddonInputs(){this.listedProducts=[],this.listedProducts=this.getMainProductElements(),this.addonInputs.forEach(addonInput=>{if(addonInput.hasAttribute("name")){const resumeData=JSON.parse(addonInput.dataset.resumeData);var quantity=1;const qttyInput=addonInput.parentElement.querySelector("input.addon-qtty");if(qttyInput&&(quantity=Number(qttyInput.value)),addonInput.dataset.overridingLabel)this.listedProducts.push({qtty:quantity,name:addonInput.dataset.overridingLabel});else{const dataSelected=resumeData.find(x=>x.id==addonInput.value);this.listedProducts=this.listedProducts.concat(this.getResumeElements(dataSelected,quantity))}}}),this.mulberryInput&&this.mulberryInput.checked&&this.listedProducts.push({qtty:1,name:this.dataset.mulberryLabel}),this.drawList()}drawList(){this.list.innerHTML="",this.listedProducts.forEach(listing=>{this.list.innerHTML+="<li>"+listing.qtty+" x "+listing.name+"</li>"})}}customElements.define("products-resume",ComponentProductsResume)} 2//# sourceMappingURL=/cdn/shop/t/478/assets/component_product_resume.js.map?v=131115507905298812291756124287
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.