!function(e){"use strict";if("undefined"==typeof _wfsb_params)return;let s,t,r,a;function o(){let e=!1;var s;return s=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(s)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(s.substr(0,4)))&&(e=!0),e}e(document).ready(function(){if("undefined"!=typeof wc)if(void 0!==wc.blocksCheckout){let{registerCheckoutFilters:s}=wc.blocksCheckout;s("wfspb_add_checkout_filter",{proceedToCheckoutButtonLink:function(s,t,r){let a=t?.wfspb_message||r?.cart?.extensions?.wfspb_message;if(!a)return s;if(!_wfsb_params?.mini_bar_on_checkout||e("#wfspb-shortcode.wfspb_add_checkout_filter").length||o()&&!_wfsb_params?.mobile)e(document).triggerHandler("wfspb-refresh-message",[a]);else{let s,t,r=`<div id="wfspb-shortcode" class="wfspb_add_checkout_filter wfspb-hidden"><div class="${["woocommerce-free-shipping-bar-order wfspb-is-shortcode wfspb-shortcode-"+(new Date).getTime()]}"><div class="woocommerce-free-shipping-bar-order-content"><div class="woocommerce-free-shipping-bar-message"><div id="wfspb-main-content" class="wfspb-message-in-cart-checkout"></div></div><div class="woocommerce-free-shipping-bar-order-bar"><div class="woocommerce-free-shipping-bar-order-bar-inner"></div></div></div></div></div>`;switch(_wfsb_params?.positionCart){case"0":s=".wp-block-woocommerce-proceed-to-checkout-block";break;case"2":s=".wc-block-cart";break;default:t=".wp-block-woocommerce-proceed-to-checkout-block"}if(s||t){let o=setInterval(function(s,t,a){if(!e(s).length&&!e(t).length)return!1;clearInterval(o),e(s).length&&e(s).eq(0).before(r),e(t).length&&e(t).eq(0).after(r),e(document).triggerHandler("wfspb-refresh-message",[a])},100,s,t,a)}if(s="",t="","0"===_wfsb_params?.positionCheckout)s="#payment-method";else t=".wc-block-checkout__actions.wp-block-woocommerce-checkout-actions-block";if(s||t){let o=setInterval(function(s,t,a){if(!e(s).length&&!e(t).length)return!1;clearInterval(o),e(s).length&&e(s).eq(0).before(r),e(t).length&&e(t).eq(0).after(r),e(document).triggerHandler("wfspb-refresh-message",[a])},100,s,t,a)}}return s}})}else"undefined"!=typeof wp&&wp?.data?.select&&wp?.data?.subscribe&&"undefined"!=typeof wc&&wc?.wcBlocksData?.CART_STORE_KEY&&(a||(s=wp.data.select,t=wp.data.subscribe,r=wc.wcBlocksData.CART_STORE_KEY,a=t(function(){let t=s(r).getCartData(),a=t?.extensions?.wfspb_message;a&&e(document).triggerHandler("wfspb-refresh-message",[a])},r)));if(e('[data-block-name="woocommerce/product-button"]').length&&e('[data-wp-on--click="actions.addCartItem"]').length){let s=window.fetch;window.fetch=async function(...t){let r=await s.apply(this,t);if(t[0]&&"string"==typeof t[0]&&t[0].includes("/wc/store/v1/cart")){r.clone().json().then(s=>{let t=s?.extensions?.wfspb_message;t&&e(document).triggerHandler("wfspb-refresh-message",[t])})}return r}}let n,i;e(document).on("click","#wfspb-close",function(){e("#wfspb-top-bar").addClass("wfspb-closing"),e(".wfspb-gift-box").removeClass("wfspb-hidden"),e("#wfspb-top-bar").removeClass("wfsb-fixed").fadeOut(500),_wfsb_params?.headerSelector&&e(`${_wfsb_params.headerSelector}`).length&&e(`${_wfsb_params.headerSelector}`).css("cssText","top:inherit;")}),e(document).on("click",".wfspb-gift-box",function(){e(document).trigger("wfspb-show-bar")}),e(document).on("wfspb-bar-init",function(){e("#wfspb-close").trigger("click"),n&&clearTimeout(n),i&&clearTimeout(i),_wfsb_params?.initialDelay?n=setTimeout(function(){e(document).trigger("wfspb-show-bar")},1e3*parseInt(_wfsb_params.initialDelay)):e(document).trigger("wfspb-show-bar")}),e(document).on("wfspb-show-bar",function(){e("#wfspb-top-bar").removeClass("wfspb-closing"),e(document).trigger("wfspb-design"),clearTimeout(i),clearTimeout(n),e(".wfspb-gift-box").addClass("wfspb-hidden"),e("#wfspb-top-bar").hasClass("wfspb-hidden")||e("#wfspb-top-bar").fadeIn(500),(void 0===wp.wfspbConditionalVariable||wp.wfspbConditionalVariable)&&_wfsb_params?.time_to_disappear&&_wfsb_params?.displayTime&&(i=setTimeout(function(){e("#wfspb-close").trigger("click")},1e3*parseInt(_wfsb_params.displayTime)))}),e(document.body).on("wc_fragments_refreshed wc_fragments_loaded wc_fragments_ajax_error updated_checkout",function(){e(document).trigger("wfspb-design")}),e(document).on("wfspb-request-new-message",function(){let s=(new Date).getTime();e.ajax({url:_wfsb_params.ajax_url,cache:!1,type:"POST",data:{action:"wfspb_get_new_message",nonce:_wfsb_params.nonce},success:function(t){if(t?.status&&"success"===t.status&&t?.fragment&&void 0!==t.fragment["#wfspb-progress"]){if(e(document).triggerHandler("wfspb-refresh-message",[t.fragment]),"undefined"!=typeof wc_cart_fragments_params&&wc_cart_fragments_params?.fragment_name){let s=JSON.parse(sessionStorage.getItem(wc_cart_fragments_params.fragment_name));s&&(e.each(t.fragment,function(e,t){s[e]=t}),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(s)))}if(_wfsb_params?.initialDelay){let e=1e3*parseInt(_wfsb_params.initialDelay)-((new Date).getTime()-s);_wfsb_params.initialDelay=e>0?e:0}e(document).trigger("wfspb-bar-init")}t?.message&&console.log(t.message)},error:function(e){console.log(e)}})}),e(document).on("wfspb-refresh-message",function(s,t){if(!_wfsb_params?.html_refresh||!t)return!1;let r=!1;return e.each(_wfsb_params.html_refresh,function(s,a){e(a).length&&void 0!==t[a]&&(r=!0,e(a).replaceWith(t[a]))}),e(document).trigger("wfspb-design"),r}),e(document).on("wfspb-scroll-design",function(){let s;_wfsb_params?.headerSelector&&e(`${_wfsb_params.headerSelector}`).length&&(s=e(`${_wfsb_params.headerSelector}`));let t=document.documentElement.scrollTop;if(t>100){if(e("#wfspb-top-bar").hasClass("wfspb-hidden"))return void e("#wfspb-top-bar").removeClass("wfsb-fixed");if(e("#wfspb-top-bar").addClass("wfsb-fixed"),e("#wfspb-top-bar").hasClass("top_bar")){let t=e("#wfspb-top-bar").outerHeight(!0);s&&s.css("top",`${t}px !important`)}}else 0===t&&(e("#wfspb-top-bar").removeClass("wfsb-fixed"),s&&s.css("top","inherit"))}),e(document).on("wfspb-design",function(){let s="";o()&&!_wfsb_params?.mobile?e("#wfspb-top-bar,.wfspb-gift-box,.wfspb-mini-bar-in-cart,.wfspb-mini-bar-in-product,.wfspb-mini-bar-in-checkout").addClass("wfsb-hidden"):e("#wfspb-top-bar,.wfspb-gift-box,.wfspb-mini-bar-in-cart,.wfspb-mini-bar-in-product,.wfspb-mini-bar-in-checkout").removeClass("wfsb-hidden"),e("#wfspb-main-content").length&&e("#wfspb-main-content").html()?e("#wfspb-top-bar, #wfspb-shortcode, .woocommerce-free-shipping-bar-order").removeClass("wfspb-hidden"):e("#wfspb-top-bar, #wfspb-shortcode").addClass("wfspb-hidden"),e("#wfspb-current-progress").length&&(s+="#wfspb-current-progress{width: "+e("#wfspb-current-progress").data("current_percent")+"%}"),e(".woocommerce-free-shipping-bar-order-bar-inner").length&&(s+=".woocommerce-free-shipping-bar-order-bar-inner{width: "+e(".woocommerce-free-shipping-bar-order-bar-inner").data("current_percent")+"%}"),e("#wfspb-design-inline-css").length||e("head").append('<style id="wfspb-design-inline-css"></style>'),e("#wfspb-design-inline-css").html(s),e(document).trigger("wfspb-scroll-design")}),setTimeout(function(){if(_wfsb_params?.cacheCompa)if("undefined"!=typeof wc_cart_fragments_params&&wc_cart_fragments_params?.fragment_name){let s=JSON.parse(sessionStorage.getItem(wc_cart_fragments_params.fragment_name));s&&void 0!==s["#wfspb-progress"]?(e(document).triggerHandler("wfspb-refresh-message",[s]),e(document).trigger("wfspb-bar-init")):e(document).trigger("wfspb-request-new-message")}else e(document).trigger("wfspb-request-new-message");else e(document).trigger("wfspb-bar-init")},100)}),e(window).on("scroll",function(){e(document).trigger("wfspb-scroll-design")}),e(window).on("resize",function(){if(e(document).trigger("wfspb-design"),e("#wfspb-top-bar.wfsb-fixed.top_bar").length){let e=document.documentElement.scrollTop;e>100&&window.scrollTo(0,e+1)}})}(jQuery);