1customElements.get("quick-add-bulk")||customElements.define("quick-add-bulk",class extends BulkAdd{constructor(){super(),this.quantity=this.querySelector("quantity-input");const debouncedOnChange=debounce(event=>{parseInt(event.target.value)===0?this.startQueue(event.target.dataset.index,parseInt(event.target.value)):this.validateQuantity(event)},ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener("change",debouncedOnChange.bind(this)),this.listenForActiveInput(),this.listenForKeydown(),this.lastActiveInputId=null}connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,event=>{event.source==="quick-add"||event.cartData.items&&!event.cartData.items.some(item=>item.id===parseInt(this.dataset.index))||event.cartData.variant_id&&event.cartData.variant_id!==parseInt(this.dataset.index)||this.onCartUpdate().then(()=>{this.listenForActiveInput(),this.listenForKeydown()})})}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}get input(){return this.querySelector("quantity-input input")}selectProgressBar(){return this.querySelector(".progress-bar-container")}listenForActiveInput(){this.classList.contains("hidden")||this.input?.addEventListener("focusin",event=>event.target.select()),this.isEnterPressed=!1}listenForKeydown(){this.input?.addEventListener("keydown",event=>{event.key==="Enter"&&(this.input?.blur(),this.isEnterPressed=!0)})}cleanErrorMessageOnType(event){event.target.addEventListener("keypress",()=>{event.target.setCustomValidity("")},{once:!0})}get sectionId(){return this._sectionId||(this._sectionId=this.closest(".collection-quick-add-bulk").dataset.id),this._sectionId}onCartUpdate(){return new Promise((resolve,reject)=>{fetch(`${this.getSectionsUrl()}?section_id=${this.sectionId}`).then(response=>response.text()).then(responseText=>{const sourceQty=new DOMParser().parseFromString(responseText,"text/html").querySelector(`#quick-add-bulk-${this.dataset.index}-${this.sectionId}`);if(sourceQty){this.innerHTML=sourceQty.innerHTML;const submitButton=this.closest(".fg-product-card")?.querySelector(".quick-add__submit"),qtyInput=this.querySelector(".quantity__input");(qtyInput&&parseInt(qtyInput.value)||0)>0?(this.style.setProperty("display","block","important"),submitButton&&submitButton.style.setProperty("display","none","important")):(this.style.setProperty("display","none","important"),submitButton&&submitButton.style.setProperty("display","inline-block","important"))}resolve()}).catch(e=>{console.error(e),reject(e)})})}getSectionsUrl(){const pageParams=new URLSearchParams(window.location.search),pageNumber=decodeURIComponent(pageParams.get("page")||"");return`${window.location.pathname}${pageNumber?`?page=${pageNumber}`:""}`}updateMultipleQty(items){this.selectProgressBar().classList.remove("hidden");const ids=Object.keys(items),body=JSON.stringify({updates:items,sections:this.getSectionsToRender().map(section=>section.section),sections_url:this.getSectionsUrl()});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.text()).then(state=>{const parsedState=JSON.parse(state);this.renderSections(parsedState,ids),publish(PUB_SUB_EVENTS.cartUpdate,{source:"quick-add",cartData:parsedState})}).catch(()=>{}).finally(()=>{this.selectProgressBar().classList.add("hidden"),this.setRequestStarted(!1)})}getSectionsToRender(){return[{id:`quick-add-bulk-${this.dataset.index}-${this.sectionId}`,section:this.sectionId,selector:`#quick-add-bulk-${this.dataset.index}-${this.sectionId}`},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"CartDrawer",selector:".drawer__inner",section:"cart-drawer"}]}renderSections(parsedState,ids){this.queue.filter(element=>ids.includes(element.id)).length===0&&(this.getSectionsToRender().forEach(section=>{const sectionElement=document.getElementById(section.id);section.section==="cart-drawer"&§ionElement.closest("cart-drawer")?.classList.toggle("is-empty",parsedState.items.length.length===0);const elementToReplace=sectionElement&§ionElement.querySelector(section.selector)?sectionElement.querySelector(section.selector):sectionElement;if(elementToReplace&&(elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector),section.id.startsWith("quick-add-bul
1k"))){const submitButton=elementToReplace.closest(".fg-product-card")?.querySelector(".quick-add__submit"),qtyInput=elementToReplace.querySelector(".quantity__input");(qtyInput&&parseInt(qtyInput.value)||0)>0?(elementToReplace.style.setProperty("display","block","important"),submitButton&&submitButton.style.setProperty("display","none","important")):(elementToReplace.style.setProperty("display","none","important"),submitButton&&submitButton.style.setProperty("display","inline-block","important"))}}),this.isEnterPressed&&this.querySelector(`#Quantity-${this.lastActiveInputId}`).select(),this.listenForActiveInput(),this.listenForKeydown())}}); 2//# sourceMappingURL=/cdn/shop/t/224/assets/quick-add-bulk.js.map?v=95351572439730486641786373858
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.