1import{E as s}from"./events.CylfRtLc.min.js";class a extends HTMLElement{constructor(){super(),this.variants=JSON.parse(this.dataset.variants),this.wrapperEl=this.querySelector(".low-inventory-wrapper"),this.outOfStockNotificationEl=this.querySelector(".js-out-of-stock"),this.lowStockNotificationEl=this.querySelector(".js-low-stock"),this.currentVariantId=this.dataset.currentVariantId,this.render()}connectedCallback(){this.addEventListener(s.PRODUCT_VARIANT_UPDATE,this.handleProductVariantUpdate.bind(this))}disconnectedCallback(){this.removeEventListener(s.PRODUCT_VARIANT_UPDATE,this.handleProductVariantUpdate.bind(this))}handleProductVariantUpdate(t){var i;this.currentVariantId=((i=t.detail.variant)==null?void 0:i.id)??null,this.render()}render(){if(this.outOfStockNotificationEl.classList.add("hidden"),this.lowStockNotificationEl.classList.add("hidden"),this.currentVariantId==null||this.currentVariantId===""){this.wrapperEl.classList.add("hidden"),this.style.display="none";return}this.style.display="";let t=this.variants[this.currentVariantId];t===void 0&&String(this.currentVariantId)===String(this.dataset.currentVariantId)&&(t=this.dataset.currentVariantStatus||""),t==="out-of-stock"?this.outOfStockNotificationEl.classList.remove("hidden"):t==="low-stock"&&this.lowStockNotificationEl.classList.remove("hidden");const i=this.outOfStockNotificationEl.classList.contains("hidden")&&this.lowStockNotificationEl.classList.contains("hidden");this.wrapperEl.classList.toggle("hidden",i)}}const r=()=>{customElements.get("low-inventory-variants")||customElements.define("low-inventory-variants",a)};export{r as default};
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.