"use strict";(globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[21],{5021(e,t,n){n.r(t),n.d(t,{mount:function(){return c}});var o=n(8043),r=n.n(o);const c=function(e,{event:t}){r()&&(ctEvents.trigger("ct:header:update"),function(e,t){if(!r())return;var n=e.closest("form"),o=n.find(t.submitter),c=r()(n)[0].action;if("string"!=typeof c)return void n.submit();var i=n.attr("method");void 0!==i&&""!=i||(i="POST");var a=new FormData(n[0]);a.append(o.attr("name"),o.val()),[...a.entries()].reduce(function(e,t){return e+(t[0].indexOf("quantity")>-1?parseInt(t[1],10):0)},0),n.closest(".quick-view-modal").length&&(n.closest(".quick-view-modal").find(".ct-quick-add").removeClass("added"),n.closest(".quick-view-modal").find(".ct-quick-add").addClass("loading")),o.removeClass("added"),o.addClass("loading"),r()(document.body).trigger("adding_to_cart",[o,[...a.entries()].reduce(function(e,[t,n]){return e[t]=n,e},{})]);const d=new URL(c),s=new URLSearchParams(d.search);s.append("blocksy_add_to_cart","yes"),window.ct_customizer_localizations&&s.set("wp_customize","on"),d.search=s.toString(),c=d.toString(),fetch(c,{method:i,body:a}).then(function(e){return e.json()}).then(function({success:e,data:t}){if(!e)return;const{notices:c,fragments:i,cart_hash:a}=t,d=".woocommerce-error, .wc-block-components-notice-banner.is-error",s=document.createElement("div");s.innerHTML=c;let l=s.querySelector(d);if(l&&l.innerHTML.length>0){let e=document.querySelector(".woocommerce-notices-wrapper");return e.querySelector(d)&&e.querySelector(d).remove(),void(e&&e.appendChild(l))}r()(document.body).trigger("added_to_cart",[i,a,o]),n.closest(".quick-view-modal").length&&(n.closest(".quick-view-modal").find(".ct-quick-add").addClass("added"),n.closest(".quick-view-modal").find(".ct-quick-add").removeClass("loading"))}).catch(function(){return o.removeClass("loading")}).finally(function(){return o.removeClass("loading")})}(r()(e),t))}}}]);