"use strict";function woostifyInfiniteScroll(e,o){let t=document.querySelector(".site-main .products"),r=document.querySelector(".woostify-view-more"),n=document.querySelector(".woostify-view-prev"),c=document.querySelector(".w-view-prev-button"),i=document.querySelector(".woocommerce-pagination ul.page-numbers");if(null==t&&(t=document.querySelector(".site-content .products")),!(null!=r&&void 0!==r||null!=n&&void 0!==n))return!1;if(null==r||void 0===r){let e={path:o||".prev.page-numbers",append:".product.type-product",history:"push",hideNav:".woocommerce-pagination",loadOnScroll:!1};window.infScroll=new InfiniteScroll(t,e);var a=woostify_woocommerce_general.paged-1,s=woostify_woocommerce_general.paged,l={};return jQuery(".page-numbers").each((function(e,o){l[jQuery(o).text()]=jQuery(o).attr("href")})),n&&c&&c.addEventListener("click",(function(){var e=infScroll.element.getBoundingClientRect().height,o=document.querySelector(".woostify-view-prev");if(s<=1)return;let t,r=new DOMParser,{responseBody:n,domParseResponse:i,fetchOptions:u}=infScroll.options;t=l[a],history.pushState(null,"",t);jQuery(".page-numbers");"function"==typeof u&&(u=u()),c.classList.add("circle-loading");fetch(t,u).then((s=>{if(!s.ok){let e=new Error(s.statusText);return infScroll.onPageError(e,t,s),{response:s}}return c.classList.remove("circle-loading"),--a<=0&&(o.style.display="none"),s[n]().then((o=>{"text"==n&&i&&(o=r.parseFromString(o,"text/html"));let c=o.querySelectorAll(infScroll.options.append);if(!c||!c.length)return;let a=getItemsFragment(c);infScroll.element.insertBefore(a,infScroll.element.children[0]);infScroll.scrollPages;var l={top:0,path:t,title:s.title};infScroll.scrollPages.unshift(l);for(var u=1;u{console.log(e)}))})),!1}let u=r.querySelector(".woostify-loading-status"),d=woostify_woocommerce_general.loading_type,m=r.querySelector(".w-view-more-button"),f={path:o||".next.page-numbers",append:".product.type-product",history:"push",hideNav:".woocommerce-pagination",checkLastPage:".next.page-numbers",loadOnScroll:"button"!==d};null==i||void 0===i?"button"===d?r.style.display="none":f.loadOnScroll=!1:"button"===d?(r.style.display="block",m.style.display="inline-flex"):f.loadOnScroll=!0,window.infScroll=new InfiniteScroll(t,f),infScroll.loadCount=0,infScroll.on("request",(function(e,o){"button"===d?m.classList.add("circle-loading"):u.style.display="inline-block"})),infScroll.on("load",(function(e,o,t){let r=e.querySelectorAll(".woocommerce-pagination .page-numbers .page-numbers:not(.next):not(.prev):not(.dots)"),n=!e.querySelectorAll(".woocommerce-pagination .page-numbers .page-numbers.next").length;"button"===d?m.classList.remove("circle-loading"):u.style.display="none",r.length?n?"button"===d?m.style.display="none":(u.style.display="none",infScroll.option({loadOnScroll:!1})):"button"!==d&&infScroll.option({loadOnScroll:!0}):"button"===d?m.style.display="inline-flex":u.style.display="inline-block"})),infScroll.on("append",(function(e,o,t,r){"function"==typeof woostifyQuickView&&woostifyQuickView(),"function"==typeof woostifyVariationSwatches&&woostifyVariationSwatches(),"function"==typeof woostifySwatchList&&woostifySwatchList(),"function"==typeof customQuantity&&customQuantity(),"function"==typeof woostifyCountdownUrgency&&woostifyCountdownUrgency(),"1"===woostify_woocommerce_general.is_active_wvs&&jQuery(".variations_form").each((function(){jQuery(this).wc_variation_form()}))})),infScroll.on("last",(function(e,o){"button"===d?m.style.display="none":u.style.display="none"}));a=woostify_woocommerce_general.paged-1,s=infScroll.pageIndex,l={};jQuery(".page-numbers").each((function(e,o){l[jQuery(o).text()]=jQuery(o).attr("href")})),n&&c&&c.addEventListener("click",(function(){loadPreviewPage(infScroll,a,l),a--})),"button"===d&&e&&m.addEventListener("click",(function(){infScroll.loadNextPage()}))}function loadPreviewPage(e,o,t){let r=document.querySelector(".w-view-prev-button");var n=e.element.getBoundingClientRect().height,c=document.querySelector(".woostify-view-prev"),i=e.pageIndex;if(i<=1)return;let a,s=new DOMParser,{responseBody:l,domParseResponse:u,fetchOptions:d}=e.options;i-1==o&&(a=jQuery(".prev.page-numbers").attr("href")),a=t[o],history.pushState(null,"",a);jQuery(".page-numbers");"function"==typeof d&&(d=d()),r.classList.add("circle-loading");fetch(a,d).then((t=>{if(!t.ok){let o=new Error(t.statusText);return e.onPageError(o,a,t),{response:t}}return r.classList.remove("circle-loading"),--o<=0&&(c.style.display="none"),t[l]().then((o=>{"text"==l&&u&&(o=s.parseFromString(o,"text/html"));let r=o.querySelectorAll(e.options.append);if(!r||!r.length)return;let c=getItemsFragment(r);e.element.insertBefore(c,e.element.children[0]);e.scrollPages;var i={top:0,path:a,title:t.title};e.scrollPages.unshift(i);for(var d=1;d{console.log(e)}))}function refreshScripts(e){let o=e.querySelectorAll("script");for(let e of o){let o=document.createElement("script"),t=e.attributes;for(let e of t)o.setAttribute(e.name,e.value);o.innerHTML=e.innerHTML,e.parentNode.replaceChild(o,e)}}function getItemsFragment(e){let o=document.createDocumentFragment();return e&&o.append(...e),o}function cartSidebarOpen(){document.body.classList.contains("no-cart-sidebar")||document.body.classList.contains("disabled-sidebar-cart")||document.documentElement.classList.add("cart-sidebar-open")}function eventCartSidebarOpen(){document.body.classList.add("updating-cart"),document.body.classList.remove("cart-updated")}function eventCartSidebarClose(){document.body.classList.add("cart-updated"),document.body.classList.remove("updating-cart")}function shoppingBag(){var e=document.getElementsByClassName("shopping-bag-button"),o=document.getElementById("shop-cart-sidebar");if(e.length&&o&&!document.body.classList.contains("woocommerce-cart")&&!document.body.classList.contains("woocommerce-checkout"))for(var t=0,r=e.length;t=100||o=100){let e=document.createElement("canvas");e.className="confetti-canvas",document.querySelector("#shop-cart-sidebar").appendChild(e);let o=confetti.create(e,{resize:!0});confettiSnowEffect(o,5e3),setTimeout((function(){o.reset(),document.querySelector(".confetti-canvas").remove()}),6e3)}o=r}},confettiSnowEffect=function(e,o){var t=Date.now()+o;function r(e,o){return Math.random()*(o-e)+e}!function n(){var c=t-Date.now(),i=Math.max(200,c/o*500);e({particleCount:1,startVelocity:0,ticks:i,origin:{x:Math.random(),y:0},colors:["#EF2964"],shapes:["circle","square"],gravity:1,scalar:r(.4,1),drift:r(-.4,.4)}),e({particleCount:1,startVelocity:0,ticks:i,origin:{x:Math.random(),y:0},colors:["#2D87B0"],shapes:["circle","square"],gravity:1,scalar:r(.4,1),drift:r(-.4,.4)}),c>0&&requestAnimationFrame(n)}()},woostifyQuantityMiniCart=function(){var e=document.querySelector(".shopping-bag-button .shop-cart-count, .boostify-count-product"),o=document.querySelectorAll(".mini-cart-product-infor");o.length&&e?(e.classList.remove("hide"),o.forEach((function(e,o){var t=e.querySelectorAll(".mini-cart-product-qty"),r=e.querySelector("input.qty"),n=r.value,c=Number(r.getAttribute("max")||-1),i=r.getAttribute("data-cart_item_key")||"",a=new Event("change"),s=new Event("quantity_updated");if(t.length&&r){o=0;for(var l=t.length;o0&&(e>=c||e+o>c))return;s=Number((e+o).toFixed(o.countDecimals()));r.value=s,n=s}r.dispatchEvent(a)}};r.addEventListener("change",(function(){var e=Number(r.value||0);if(e0&&Number(e)>c)return alert(woostify_woocommerce_general.qty_warning),void(r.value=n);var o=new Request(woostify_woocommerce_general.ajax_url,{method:"POST",body:"action=update_quantity_in_mini_cart&ajax_nonce="+woostify_woocommerce_general.ajax_nonce+"&key="+i+"&qty="+e,credentials:"same-origin",headers:new Headers({"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"})});document.documentElement.classList.add("mini-cart-updating"),fetch(o).then((function(e){if(200!==e.status)throw alert(woostify_woocommerce_general.ajax_error),console.log("Status Code: "+e.status),e;return e.json()})).then((function(e){if(e.success){jQuery(document.body).trigger("updated_wc_div");var o=e.data,t=document.querySelector(".cart-sidebar-content .woocommerce-mini-cart__total .woocommerce-Price-amount.amount"),r=document.querySelectorAll(".woostify-header-total-price, .boostify-subtotal"),n=document.querySelectorAll(".shop-cart-count, .boostify-count-product"),c=document.querySelectorAll(".free-shipping-progress-bar");if(t&&(t.innerHTML=o.total_price,r.length))for(var i=0,a=r.length;i=100){var m=document.createElement("canvas");m.className="confetti-canvas",document.querySelector("#shop-cart-sidebar").appendChild(m);var f=confetti.create(m,{resize:!0});confettiSnowEffect(f,5e3),setTimeout((function(){f.reset(),document.querySelector(".confetti-canvas").remove()}),6e3)}}}})).catch((function(e){console.log(e)})).finally((function(){document.documentElement.classList.remove("mini-cart-updating"),document.dispatchEvent(s)}))}))}}))):e&&e.classList.add("hide")},updateHeaderCartPrice=function(){var e=document.querySelector(".cart-sidebar-content .woocommerce-mini-cart__total .woocommerce-Price-amount.amount"),o="",t=document.querySelectorAll(".woostify-header-total-price");if(t.length){switch(woostify_woocommerce_general.currency_pos){case"left":o=''+woostify_woocommerce_general.currency_symbol+"0";break;case"right":o='0'+woostify_woocommerce_general.currency_symbol+"";break;case"left_space":o=''+woostify_woocommerce_general.currency_symbol+" 0";break;case"right_space":o=''+woostify_woocommerce_general.currency_symbol+""}for(var r=0,n=t.length;r'+e.innerHTML+"":o}},woostifyProductsCarousel=function(e){var o=document.querySelectorAll(e);o.length&&o.forEach((function(e){if(!e.classList.contains("tns-slider")&&woostify_woocommerce_general.related_carousel_opts.hasOwnProperty("loop")){var o=woostify_woocommerce_general.related_carousel_opts;o.container=e;tns(o)}}))},woostiftToggleShow=function(e){var o=function(){e.style.display="block";var o=e.scrollHeight+"px";return e.style.display="",o}();e.classList.add("is-visible"),e.style.height=o,window.setTimeout((function(){e.style.height=""}),350)},woostiftToggleHide=function(e){e.style.height=e.scrollHeight+"px",window.setTimeout((function(){e.style.height="0"}),1),window.setTimeout((function(){e.classList.remove("is-visible")}),350)},woostifyToggleSlide=function(e,o){e.classList.contains("is-visible")?woostiftToggleHide(e):woostiftToggleShow(e)},productDataTabsAccordion=function(){var e=document.querySelectorAll(".woocommerce-tabs.layout-accordion");e.length&&e.forEach((function(e){var o=e.querySelectorAll(".woostify-accordion-title");if(o.length){var t=e.querySelectorAll(".woostify-tab-wrapper");o.forEach((function(e,o){e.onclick=function(){t.forEach((function(e,t){t!==o&&(e.classList.contains("active")&&woostifyToggleSlide(e.querySelector(".woocommerce-Tabs-panel")),e.classList.remove("active"))})),e.parentNode.classList.contains("active")?e.parentNode.classList.remove("active"):e.parentNode.classList.add("active");var r=nextSiblings(e);woostifyToggleSlide(r[0])}}))}}))},stickyOrderReview=function(){new WSYSticky("form.woocommerce-checkout .woostify-col .col-right-inner",{stickyContainer:"form.woocommerce-checkout",marginTop:96})},checkoutOrder=function(){var e=document.querySelector(".before-checkout");if(e){var o=e.offsetHeight,t=o,r=document.querySelector(".showlogin");document.querySelector("#coupons_list")?document.arrive(".sc-coupon",(function(){document.getElementById("coupons_list").style.display="block",setTimeout((function(){n(),jQuery(document).unbindArrive(".sc-coupon")}),1e3)})):n(),document.body.addEventListener("click",(function(e){if(e.target===r){var c=setInterval((function(){n()}),50);setTimeout((function(){o==t&&clearInterval(c)}),2e3)}}))}function n(){setTimeout((function(){var o=e.offsetHeight;document.querySelector("#checkout-spacer").style.minHeight=o+"px",e.classList.add("ready")}),200)}},woostifyGetUrl=function(e){return wc_cart_fragments_params.wc_ajax_url.toString().replace("%%endpoint%%",e)},woostifyShowNotice=function(e,o){o||(o=jQuery(".woocommerce-notices-wrapper:first")||jQuery(".cart-empty").closest(".woocommerce")||jQuery(".woocommerce-cart-form")),o.prepend(e)},ajaxCouponForm=function(){var e=document.querySelector("form.checkout_coupon");e&&e.addEventListener("submit",(function(e){e.preventDefault();var o=document.getElementById("coupon_code"),t=o.value,r={security:woostify_woocommerce_general.apply_coupon_nonce,coupon_code:t};jQuery.ajax({type:"POST",url:woostifyGetUrl("apply_coupon"),data:r,dataType:"html",success:function(e){jQuery(".woocommerce-error, .woocommerce-message, .woocommerce-NoticeGroup .woocommerce-info, .woocommerce-notices-wrapper .woocommerce-info").remove(),woostifyShowNotice(e,jQuery(".woostify-woocommerce-NoticeGroup")),jQuery(document.body).trigger("applied_coupon",[t])},complete:function(){o.value="",jQuery(document.body).trigger("update_checkout")}})}))},woostifyMoveNoticesInCheckoutPage=function(){var e=document.querySelectorAll(".woocommerce-notices-wrapper"),o=document.querySelectorAll(".woocommerce > .woocommerce-info"),t=document.querySelector(".woostify-woocommerce-NoticeGroup");if(e.length){var r=e[0],n=document.createElement("div");n.innerHTML=r.innerHTML,t.appendChild(n),r.remove()}o.length&&o.forEach((function(e){var o=e.cloneNode(!0),r=e.getAttribute("class");o.setAttribute("class",r),t.appendChild(o),e.remove()}))},woostifyCheckoutFormFieldAnimation=function(){var e=document.querySelectorAll("form.checkout .input-text, form.checkout_coupon .input-text"),o=document.querySelectorAll("form.checkout .form-row");e.length&&e.forEach((function(e){var o=e.closest(".form-row");o&&(""!==e.value&&o.classList.add("w-anim-wrap"),e.addEventListener("focus",(function(e){e.target.closest(".form-row").classList.add("w-anim-wrap")})),e.addEventListener("blur",(function(e){var o=e.target.closest(".form-row");""===e.target.value&&(o.classList.remove("w-anim-wrap"),o.classList.contains("validate-required")&&o.classList.add("woocommerce-invalid-required-field"))})))})),o.length&&o.forEach((function(e){var o=e.querySelector("label");if(null==o?e.classList.add("no-label"):o.classList.remove("screen-reader-text"),e.classList.contains("address-field")){var t=e.querySelectorAll("input"),r=e.querySelectorAll("span.select2");t.length&&t.length>0&&t.forEach((function(o){"hidden"===o.getAttribute("type")?e.classList.add("field-readonly"):e.classList.remove("field-readonly")})),r.length&&r.length>0&&(e.classList.add("w-anim-wrap"),e.classList.remove("field-readonly"))}}))};document.addEventListener("DOMContentLoaded",(function(){if(shoppingBag(),woostifyQuantityMiniCart(),woostifyProductsCarousel(".related.products ul.products"),woostifyProductsCarousel(".upsells.products ul.products"),woostifyProductsCarousel(".woostify-product-recently-viewed-section ul.products"),productDataTabsAccordion(),window.addEventListener("load",(function(){woostifyStockQuantityProgressBar()})),console.log(222),woostifyInfiniteScroll(!0),jQuery(document.body).on("adding_to_cart",(function(){eventCartSidebarOpen()})).on("added_to_cart",(function(e,o,t,r){if(woostifyQuantityMiniCart(),updateHeaderCartPrice(),eventCartSidebarClose(),closeAll(),r=void 0!==r&&r){if(r.removeClass("loading"),cartSidebarOpen(),o&&r.addClass("added"),o&&!wc_add_to_cart_params.is_cart&&0===r.parent().find(".added_to_cart").length){var n=get_svg_icon("shopping-cart-full");r.after(''+n+wc_add_to_cart_params.i18n_view_cart+"")}jQuery(document.body).trigger("wc_cart_button_updated",[r])}})).on("removed_from_cart",(function(){woostifyQuantityMiniCart(),updateHeaderCartPrice()})).on("updated_cart_totals",(function(){"function"==typeof customQuantity&&customQuantity(),woostifyQuantityMiniCart(),updateHeaderCartPrice()})).on("wc_fragments_loaded wc_fragments_refreshed",(function(){if(woostifyQuantityMiniCart(),updateHeaderCartPrice(),woostify_woocommerce_general.shipping_threshold.enabled_shipping_threshold&&woostify_woocommerce_general.shipping_threshold.enabled_shipping_threshold_effect){var e=document.querySelectorAll(".free-shipping-progress-bar"),o=0;e.length&&(o=parseInt(e[0].getAttribute("data-progress"))),progressBarConfetti(e,o)}})).on("wc_cart_emptied",(function(){location.reload()})),jQuery(document.body).on("init_checkout updated_checkout payment_method_selected",(function(){"function"==typeof customQuantity&&customQuantity()})),document.body.classList.contains("checkout-layout-3")){var e=!1;woostifyCheckoutFormFieldAnimation(),woostifyMoveNoticesInCheckoutPage(),jQuery(document.body).on("updated_checkout",(function(e,o){setTimeout((function(){woostifyCheckoutFormFieldAnimation()}),100)})).on("init_checkout updated_checkout payment_method_selected",(function(e,o){jQuery(".woostify-woocommerce-NoticeGroup").html(""),jQuery("form.checkout").arrive("form.checkout_coupon",(function(e){ajaxCouponForm(),jQuery("form.checkout").unbindArrive("form.checkout_coupon")})),jQuery("form.checkout").arrive(".ajax-coupon-form",(function(e){jQuery(e).removeClass("loading"),jQuery(e).addClass("ready")})),jQuery("form.checkout").arrive(".woocommerce-NoticeGroup",(function(){jQuery(".woostify-woocommerce-NoticeGroup").append(jQuery(".woocommerce-NoticeGroup").html()),jQuery(".woocommerce-NoticeGroup").remove()})),jQuery(document).arrive(".woocommerce > .woocommerce-message",(function(e){var o=jQuery(e).clone();jQuery(".woostify-woocommerce-NoticeGroup").append(o),jQuery(e).remove()})),jQuery(document).arrive(".woocommerce > .woocommerce-info",(function(e){var o=jQuery(e).clone();jQuery(".woostify-woocommerce-NoticeGroup").append(o),jQuery(e).remove()}))})).on("applied_coupon",(function(){jQuery("form.checkout").arrive("form.checkout_coupon",(function(e){ajaxCouponForm(),jQuery("form.checkout").unbindArrive("form.checkout_coupon")}))})),jQuery("form.checkout").arrive("form.checkout_coupon",(function(e){ajaxCouponForm(),jQuery("form.checkout").unbindArrive("form.checkout_coupon")})),checkoutOrder(),stickyOrderReview(),window.onscroll=function(){e||(window.dispatchEvent(new Event("resize")),e=!0)}}"function"==typeof onElementorLoaded&&onElementorLoaded((function(){window.elementorFrontend.hooks.addAction("frontend/element_ready/global",(function(){productDataTabsAccordion()}))}))}));