1class ProductForm extends HTMLElement{constructor(){super()}connectedCallback(){this._eventAttached=!1,setTimeout(()=>{this.form=this.querySelector("form"),this.idInput=this.form.elements.id,this.submitButton=this.form.elements.add,this.idInput.removeAttribute("disabled"),this.notifyOnAdd=this.hasAttribute("notify-on-add"),this._boundSubmit=this.submit.bind(this),this._eventAttached=!0,this.form.addEventListener("submit",this._boundSubmit)})}disconnectedCallback(){this._eventAttached&&(this._eventAttached=!1,this.form.removeEventListener("submit",this._boundSubmit))}async submit(e){e.preventDefault();const data=new FormData(e.target),item=Object.fromEntries(data.entries());try{this.removeError(),await this._setIsAdding(),await window.theme.cart.store.getState().add(item),await this._setIsAdding(!1);const quickShop=this.closest("quick-shop");quickShop&&await quickShop.hide(),this.notifyOnAdd?(await window.theme.cart.store.getState().resetVariantsBeingAdded(),this.closest(".cart-draw")||theme.mfpOpen("cart")):(await window.theme.cart.store.getState().resetLatestAddedProduct(),await window.theme.cart.store.getState().resetVariantsBeingAdded(item.id))}catch(e2){this._renderError(e2.message),await this._setIsAdding(!1,!0)}}_setIsAdding(isAdding=!0,error=!1){return new Promise(resolve=>{if(!this.submitButton){resolve("No submit button");return}if(error){this.submitButton.classList.remove("is-adding"),resolve("error");return}isAdding?(this.submitButton.classList.remove("is-added"),this.submitButton.classList.add("is-adding"),resolve("Adding")):(this.submitButton.classList.remove("is-adding"),this.submitButton.classList.add("is-added"),this.submitButton.addEventListener("animationend",()=>{this.submitButton.classList.remove("is-added"),resolve("Added")}))})}_renderError(message){if(this.removeError(),this.submitButton){const error=document.createElement("div");error.classList.add("errors","qty-error","u-small"),error.innerHTML=message,this.submitButton.before(error)}}removeError(){const error=this.querySelector(".errors");error&&error.remove()}}customElements.define("product-form",ProductForm); 2//# sourceMappingURL=/cdn/shop/t/25/assets/product-form.js.map?v=166760770228120350161763292255
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.