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