"use strict";(globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[902],{4902:function(t,e,n){n.r(e),n.d(e,{mount:function(){return l}});var o=n(8043),r=n.n(o),c=n(2151),u=n.n(c);let a=null,i=null;r()(document.body).on("updated_cart_totals",function(){setTimeout(function(){[...document.querySelectorAll(`[name="${i}"]`)].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 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(){r()("[name='update_cart']").trigger("click")},300))}(t,n);if(!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})}}}]);