!function(o){"use strict";var e=function(){var e,n,c=0;e=fusion.getAdminbarHeight(),n=o(".fusion-header-wrapper").find("div"),c=0,n.each(function(){"fixed"===o(this).css("position")&&(c=o(this).height())}),o("html, body").stop(),setTimeout(function(){o("html, body").animate({scrollTop:o(".woocommerce-notices-wrapper").offset().top-e-c-10},500)},10)};o("form.checkout").on("checkout_place_order",function(){if(Boolean(fusionWooNoticesVars.login_required)&&!fusionWooNoticesVars.is_logged_in)return e(),!1}),o(document.body).on("checkout_error avada_checkout_error",function(e,n){var c,t,r=0,i=0,s=0,a="undefined"!=typeof avadaWooCommerceVars?avadaWooCommerceVars.woocommerce_checkout_error:"";o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").length&&("checkout_error"===e.type&&void 0!==n?((c=o(n.replace(/<li>/g,'<li class="avada-checkout-error">'))).find("li[data-id]").each(function(){o("#"+o(this).data("id")+"_field").addClass("woocommerce-invalid woocommerce-invalid-required-field")}),1<c.find("li").length&&c.find("li").each(function(){o(this)[0].hasAttribute("data-id")&&(s++,o(this).remove())}),0<s&&c.find("ul").append('<li class="avada-checkout-error">'+a+"</li>"),r=fusion.getAdminbarHeight(),t=o(".fusion-header-wrapper").find("div"),i=0,t.each(function(){"fixed"===o(this).css("position")&&(i=o(this).height())})):(void 0===n&&(n=a),c=o('<ul class="woocommerce-error"><li class="avada-checkout-error">'+n+"</li><ul>")),c.find(".wc-block-components-notice-banner__summary").length?c.find(".wc-block-components-notice-banner__summary").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars.error_icon):c.find(".wc-block-components-notice-banner__content").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars.error_icon),o(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message").remove(),o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").prepend(c[0].outerHTML),"checkout_error"===e.type&&(o("html, body").stop(),setTimeout(function(){o("html, body").animate({scrollTop:o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").offset().top-r-i-10},500)},10)))}).on("applied_coupon_in_checkout removed_coupon_in_checkout",function(n,c){var t="applied_coupon_in_checkout"===n.type?"form.checkout_coupon":"form.woocommerce-checkout",r="success",i=o(t).prev(),s=o(".fusion-woo-notices-tb .woocommerce-notices-wrapper");s.empty(),i.hasClass("is-error")?r="error":i.hasClass("is-info")&&(r="notice"),s.length&&i.length&&(i.find(".wc-block-components-notice-banner__summary").length?i.find(".wc-block-components-notice-banner__summary").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[r+"_icon"]):i.find(".wc-block-components-notice-banner__content").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[r+"_icon"]),s.prepend(i),e())}).on("applied_coupon removed_coupon",function(e,n){var c=o(".fusion-woo-notices-tb .woocommerce-notices-wrapper"),t="success";c.find(".is-error").length?t="error":c.find(".is-info").length&&(t="notice"),c.length&&(c.find(".wc-block-components-notice-banner__summary").length?c.find(".wc-block-components-notice-banner__summary").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[t+"_icon"]):c.find(".wc-block-components-notice-banner__content").wrapInner('<span class="wc-notices-text"></span>').prepend(fusionWooNoticesVars[t+"_icon"]))}).on("updated_checkout payment_method_selected",function(e,n){o(".fusion-woo-notices-tb .woocommerce-notices-wrapper").length&&o(".woocommerce-notices-wrapper").filter(function(){return 0===o(this).closest(".fusion-woo-notices-tb").length}).remove()})}(jQuery);