"use strict";(self.blocksyJsonP=self.blocksyJsonP||[]).push([[316],{5316:function(t,e,n){n.r(e),n.d(e,{mount:function(){return d}});var o=n(2194),r=n.n(o),c=n(1601),u=n.n(c);let a=!1,i=null,l=null;const s=function(){return[...document.querySelectorAll(".quantity")].map((function(t){[...t.querySelectorAll("input")].map((function(t){t.hasInputListener||(t.hasInputListener=!0,t.addEventListener("input",(function(e){t.closest("tr")&&[...t.closest("tr").querySelectorAll(".quantity input")].filter((function(e){return e!==t})).map((function(t){return t.value=e.target.value})),document.activeElement===t&&(l=t.name),t.closest(".ct-cart-auto-update")&&(i&&clearTimeout(i),i=setTimeout((function(){r()("[name='update_cart']").trigger("click")}),300))})))}))}))};r()(document.body).on("updated_cart_totals",(function(){setTimeout((function(){[...document.querySelectorAll(`[name="${l}"]`)].map((function(t){t.focus()}))}),500),u().trigger("blocksy:frontend:init")})),r()(document.body).on("updated_checkout",(function(t,e){var n;if(null==e||null===(n=e.fragments)||void 0===n||!n[".woocommerce-checkout-review-order-table"])return;const o=document.createElement("div");o.innerHTML=e.fragments[".woocommerce-checkout-review-order-table"],[...o.querySelectorAll(".cart_item")].length?o.remove():window.location.reload()}));const d=function(t,e){let{event:n}=e;if(r()&&!a&&(a=!0,r()(document.body).on("updated_cart_totals",s),s()),!t.classList.contains("ct-increase")&&!t.classList.contains("ct-decrease"))return;const o=t.parentNode.querySelector("input"),c=parseFloat(o.value,10)||0;if(t.classList.contains("ct-increase")){const t=o.getAttribute("max")&&parseFloat(o.getAttribute("max"),0)||1/0;o.value=c<t?Math.round(100*(c+parseFloat(o.step||"1")))/100:t}if(t.classList.contains("ct-decrease")){const t=o.getAttribute("min")?Math.round(100*parseFloat(o.getAttribute("min"),0))/100:0;o.value=c>t?Math.round(100*(c-parseFloat(o.step||"1")))/100:t}r()(o).trigger("change"),r()(o).trigger("input"),o.dispatchEvent(new Event("input",{bubbles:!0})),o.closest("tr")&&[...o.closest("tr").querySelectorAll(".quantity input")].filter((function(t){return t!==o})).map((function(t){return t.value=o.value}))}}}]);