1(function(){"use strict";var WAITLIST_LABEL="JOIN WAITLIST",productCache={};function fetchProduct(handle){return productCache[handle]?Promise.resolve(productCache[handle]):fetch("/products/"+handle+".js").then(function(res){return res.ok?res.json():null}).then(function(product){if(!product)return null;var availMap={};return product.variants.forEach(function(v){availMap[String(v.id)]=v.available}),productCache[handle]={availMap:availMap,productData:product},productCache[handle]}).catch(function(){return null})}function getHandle(formEl){var card=formEl.closest(".gw-product-card");if(!card)return null;var link=card.querySelector("[data-product-link]");if(!link||!link.href)return null;var m=link.href.match(/\/products\/([^?#\/]+)/);return m?m[1]:null}function getAddToCartLabel(btn){if(!btn._origLabel){var text="";btn.childNodes.forEach(function(n){n.nodeType===3&&(text+=n.textContent)}),btn._origLabel=text.trim()||"Add to cart"}return btn._origLabel}function setButtonState(formEl,available){var btn=formEl.querySelector("button.gw-button--solid");if(btn){var loader=btn.querySelector("[data-loader]"),origLabel=getAddToCartLabel(btn);available?(btn.textContent=origLabel,loader&&btn.appendChild(loader),btn.removeAttribute("data-waitlist")):(btn.textContent=WAITLIST_LABEL,loader&&btn.appendChild(loader),btn.setAttribute("data-waitlist","true"))}}function processForm(formEl){if(!formEl.getAttribute("data-gw-avail-processed")){var select=formEl.querySelector('select[name="id"]');if(!(!select||select.options.length===0)){var handle=getHandle(formEl);handle&&(formEl.setAttribute("data-gw-avail-processed","true"),fetchProduct(handle).then(function(cached){if(cached){var availMap=cached.availMap,productData=cached.productData;Array.from(select.options).forEach(function(opt){availMap[String(opt.value)]||opt.setAttribute("data-unavailable","true")}),setButtonState(formEl,!!availMap[String(select.value)]),select.addEventListener("change",function(){setButtonState(formEl,!!availMap[String(select.value)])}),formEl.addEventListener("submit",function(e){var btn=formEl.querySelector("button.gw-button--solid");if(btn&&btn.getAttribute("data-waitlist")==="true"){e.preventDefault(),e.stopImmediatePropagation();var selectedVariantId=select.value,trigger=document.createElement("a");trigger.href="#",trigger.className="BIS_trigger",trigger.setAttribute("data-product-data",JSON.stringify(productData)),trigger.setAttribute("data-variant-id",selectedVariantId),trigger.style.display="none",document.body.appendChild(trigger),trigger.click(),setTimeout(function(){trigger.parentNode&&trigger.parentNode.removeChild(trigger)},500)}})}}))}}}function scanRoot(root){if(root){var forms=root.querySelectorAll("gw-quick-add-to-cart-form form[data-quick-add-to-cart-form]");forms.forEach(processForm)}}function startObserving(root){scanRoot(root);var obs=new MutationObserver(function(){scanRoot(root)});obs.observe(root,{childList:!0,subtree:!0})}function init(){var gwEl=document.querySelector("gw-customer-accounts");if(gwEl){if(gwEl.shadowRoot){startObserving(gwEl.shadowRoot);return}var attempts=0,poll=setInterval(function(){gwEl.shadowRoot?(clearInterval(poll),startObserving(gwEl.shadowRoot)):++attempts>150&&(clearInterval(poll),startObserving(gwEl))},200)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",init):init()})(); 2//# sourceMappingURL=/cdn/shop/t/1660/assets/gw-quick-add-availability.js.map?v=17148992826695338001790868484
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.